pdf.worker.js 1.1 MB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287228822892290229122922293229422952296229722982299230023012302230323042305230623072308230923102311231223132314231523162317231823192320232123222323232423252326232723282329233023312332233323342335233623372338233923402341234223432344234523462347234823492350235123522353235423552356235723582359236023612362236323642365236623672368236923702371237223732374237523762377237823792380238123822383238423852386238723882389239023912392239323942395239623972398239924002401240224032404240524062407240824092410241124122413241424152416241724182419242024212422242324242425242624272428242924302431243224332434243524362437243824392440244124422443244424452446244724482449245024512452245324542455245624572458245924602461246224632464246524662467246824692470247124722473247424752476247724782479248024812482248324842485248624872488248924902491249224932494249524962497249824992500250125022503250425052506250725082509251025112512251325142515251625172518251925202521252225232524252525262527252825292530253125322533253425352536253725382539254025412542254325442545254625472548254925502551255225532554255525562557255825592560256125622563256425652566256725682569257025712572257325742575257625772578257925802581258225832584258525862587258825892590259125922593259425952596259725982599260026012602260326042605260626072608260926102611261226132614261526162617261826192620262126222623262426252626262726282629263026312632263326342635263626372638263926402641264226432644264526462647264826492650265126522653265426552656265726582659266026612662266326642665266626672668266926702671267226732674267526762677267826792680268126822683268426852686268726882689269026912692269326942695269626972698269927002701270227032704270527062707270827092710271127122713271427152716271727182719272027212722272327242725272627272728272927302731273227332734273527362737273827392740274127422743274427452746274727482749275027512752275327542755275627572758275927602761276227632764276527662767276827692770277127722773277427752776277727782779278027812782278327842785278627872788278927902791279227932794279527962797279827992800280128022803280428052806280728082809281028112812281328142815281628172818281928202821282228232824282528262827282828292830283128322833283428352836283728382839284028412842284328442845284628472848284928502851285228532854285528562857285828592860286128622863286428652866286728682869287028712872287328742875287628772878287928802881288228832884288528862887288828892890289128922893289428952896289728982899290029012902290329042905290629072908290929102911291229132914291529162917291829192920292129222923292429252926292729282929293029312932293329342935293629372938293929402941294229432944294529462947294829492950295129522953295429552956295729582959296029612962296329642965296629672968296929702971297229732974297529762977297829792980298129822983298429852986298729882989299029912992299329942995299629972998299930003001300230033004300530063007300830093010301130123013301430153016301730183019302030213022302330243025302630273028302930303031303230333034303530363037303830393040304130423043304430453046304730483049305030513052305330543055305630573058305930603061306230633064306530663067306830693070307130723073307430753076307730783079308030813082308330843085308630873088308930903091309230933094309530963097309830993100310131023103310431053106310731083109311031113112311331143115311631173118311931203121312231233124312531263127312831293130313131323133313431353136313731383139314031413142314331443145314631473148314931503151315231533154315531563157315831593160316131623163316431653166316731683169317031713172317331743175317631773178317931803181318231833184318531863187318831893190319131923193319431953196319731983199320032013202320332043205320632073208320932103211321232133214321532163217321832193220322132223223322432253226322732283229323032313232323332343235323632373238323932403241324232433244324532463247324832493250325132523253325432553256325732583259326032613262326332643265326632673268326932703271327232733274327532763277327832793280328132823283328432853286328732883289329032913292329332943295329632973298329933003301330233033304330533063307330833093310331133123313331433153316331733183319332033213322332333243325332633273328332933303331333233333334333533363337333833393340334133423343334433453346334733483349335033513352335333543355335633573358335933603361336233633364336533663367336833693370337133723373337433753376337733783379338033813382338333843385338633873388338933903391339233933394339533963397339833993400340134023403340434053406340734083409341034113412341334143415341634173418341934203421342234233424342534263427342834293430343134323433343434353436343734383439344034413442344334443445344634473448344934503451345234533454345534563457345834593460346134623463346434653466346734683469347034713472347334743475347634773478347934803481348234833484348534863487348834893490349134923493349434953496349734983499350035013502350335043505350635073508350935103511351235133514351535163517351835193520352135223523352435253526352735283529353035313532353335343535353635373538353935403541354235433544354535463547354835493550355135523553355435553556355735583559356035613562356335643565356635673568356935703571357235733574357535763577357835793580358135823583358435853586358735883589359035913592359335943595359635973598359936003601360236033604360536063607360836093610361136123613361436153616361736183619362036213622362336243625362636273628362936303631363236333634363536363637363836393640364136423643364436453646364736483649365036513652365336543655365636573658365936603661366236633664366536663667366836693670367136723673367436753676367736783679368036813682368336843685368636873688368936903691369236933694369536963697369836993700370137023703370437053706370737083709371037113712371337143715371637173718371937203721372237233724372537263727372837293730373137323733373437353736373737383739374037413742374337443745374637473748374937503751375237533754375537563757375837593760376137623763376437653766376737683769377037713772377337743775377637773778377937803781378237833784378537863787378837893790379137923793379437953796379737983799380038013802380338043805380638073808380938103811381238133814381538163817381838193820382138223823382438253826382738283829383038313832383338343835383638373838383938403841384238433844384538463847384838493850385138523853385438553856385738583859386038613862386338643865386638673868386938703871387238733874387538763877387838793880388138823883388438853886388738883889389038913892389338943895389638973898389939003901390239033904390539063907390839093910391139123913391439153916391739183919392039213922392339243925392639273928392939303931393239333934393539363937393839393940394139423943394439453946394739483949395039513952395339543955395639573958395939603961396239633964396539663967396839693970397139723973397439753976397739783979398039813982398339843985398639873988398939903991399239933994399539963997399839994000400140024003400440054006400740084009401040114012401340144015401640174018401940204021402240234024402540264027402840294030403140324033403440354036403740384039404040414042404340444045404640474048404940504051405240534054405540564057405840594060406140624063406440654066406740684069407040714072407340744075407640774078407940804081408240834084408540864087408840894090409140924093409440954096409740984099410041014102410341044105410641074108410941104111411241134114411541164117411841194120412141224123412441254126412741284129413041314132413341344135413641374138413941404141414241434144414541464147414841494150415141524153415441554156415741584159416041614162416341644165416641674168416941704171417241734174417541764177417841794180418141824183418441854186418741884189419041914192419341944195419641974198419942004201420242034204420542064207420842094210421142124213421442154216421742184219422042214222422342244225422642274228422942304231423242334234423542364237423842394240424142424243424442454246424742484249425042514252425342544255425642574258425942604261426242634264426542664267426842694270427142724273427442754276427742784279428042814282428342844285428642874288428942904291429242934294429542964297429842994300430143024303430443054306430743084309431043114312431343144315431643174318431943204321432243234324432543264327432843294330433143324333433443354336433743384339434043414342434343444345434643474348434943504351435243534354435543564357435843594360436143624363436443654366436743684369437043714372437343744375437643774378437943804381438243834384438543864387438843894390439143924393439443954396439743984399440044014402440344044405440644074408440944104411441244134414441544164417441844194420442144224423442444254426442744284429443044314432443344344435443644374438443944404441444244434444444544464447444844494450445144524453445444554456445744584459446044614462446344644465446644674468446944704471447244734474447544764477447844794480448144824483448444854486448744884489449044914492449344944495449644974498449945004501450245034504450545064507450845094510451145124513451445154516451745184519452045214522452345244525452645274528452945304531453245334534453545364537453845394540454145424543454445454546454745484549455045514552455345544555455645574558455945604561456245634564456545664567456845694570457145724573457445754576457745784579458045814582458345844585458645874588458945904591459245934594459545964597459845994600460146024603460446054606460746084609461046114612461346144615461646174618461946204621462246234624462546264627462846294630463146324633463446354636463746384639464046414642464346444645464646474648464946504651465246534654465546564657465846594660466146624663466446654666466746684669467046714672467346744675467646774678467946804681468246834684468546864687468846894690469146924693469446954696469746984699470047014702470347044705470647074708470947104711471247134714471547164717471847194720472147224723472447254726472747284729473047314732473347344735473647374738473947404741474247434744474547464747474847494750475147524753475447554756475747584759476047614762476347644765476647674768476947704771477247734774477547764777477847794780478147824783478447854786478747884789479047914792479347944795479647974798479948004801480248034804480548064807480848094810481148124813481448154816481748184819482048214822482348244825482648274828482948304831483248334834483548364837483848394840484148424843484448454846484748484849485048514852485348544855485648574858485948604861486248634864486548664867486848694870487148724873487448754876487748784879488048814882488348844885488648874888488948904891489248934894489548964897489848994900490149024903490449054906490749084909491049114912491349144915491649174918491949204921492249234924492549264927492849294930493149324933493449354936493749384939494049414942494349444945494649474948494949504951495249534954495549564957495849594960496149624963496449654966496749684969497049714972497349744975497649774978497949804981498249834984498549864987498849894990499149924993499449954996499749984999500050015002500350045005500650075008500950105011501250135014501550165017501850195020502150225023502450255026502750285029503050315032503350345035503650375038503950405041504250435044504550465047504850495050505150525053505450555056505750585059506050615062506350645065506650675068506950705071507250735074507550765077507850795080508150825083508450855086508750885089509050915092509350945095509650975098509951005101510251035104510551065107510851095110511151125113511451155116511751185119512051215122512351245125512651275128512951305131513251335134513551365137513851395140514151425143514451455146514751485149515051515152515351545155515651575158515951605161516251635164516551665167516851695170517151725173517451755176517751785179518051815182518351845185518651875188518951905191519251935194519551965197519851995200520152025203520452055206520752085209521052115212521352145215521652175218521952205221522252235224522552265227522852295230523152325233523452355236523752385239524052415242524352445245524652475248524952505251525252535254525552565257525852595260526152625263526452655266526752685269527052715272527352745275527652775278527952805281528252835284528552865287528852895290529152925293529452955296529752985299530053015302530353045305530653075308530953105311531253135314531553165317531853195320532153225323532453255326532753285329533053315332533353345335533653375338533953405341534253435344534553465347534853495350535153525353535453555356535753585359536053615362536353645365536653675368536953705371537253735374537553765377537853795380538153825383538453855386538753885389539053915392539353945395539653975398539954005401540254035404540554065407540854095410541154125413541454155416541754185419542054215422542354245425542654275428542954305431543254335434543554365437543854395440544154425443544454455446544754485449545054515452545354545455545654575458545954605461546254635464546554665467546854695470547154725473547454755476547754785479548054815482548354845485548654875488548954905491549254935494549554965497549854995500550155025503550455055506550755085509551055115512551355145515551655175518551955205521552255235524552555265527552855295530553155325533553455355536553755385539554055415542554355445545554655475548554955505551555255535554555555565557555855595560556155625563556455655566556755685569557055715572557355745575557655775578557955805581558255835584558555865587558855895590559155925593559455955596559755985599560056015602560356045605560656075608560956105611561256135614561556165617561856195620562156225623562456255626562756285629563056315632563356345635563656375638563956405641564256435644564556465647564856495650565156525653565456555656565756585659566056615662566356645665566656675668566956705671567256735674567556765677567856795680568156825683568456855686568756885689569056915692569356945695569656975698569957005701570257035704570557065707570857095710571157125713571457155716571757185719572057215722572357245725572657275728572957305731573257335734573557365737573857395740574157425743574457455746574757485749575057515752575357545755575657575758575957605761576257635764576557665767576857695770577157725773577457755776577757785779578057815782578357845785578657875788578957905791579257935794579557965797579857995800580158025803580458055806580758085809581058115812581358145815581658175818581958205821582258235824582558265827582858295830583158325833583458355836583758385839584058415842584358445845584658475848584958505851585258535854585558565857585858595860586158625863586458655866586758685869587058715872587358745875587658775878587958805881588258835884588558865887588858895890589158925893589458955896589758985899590059015902590359045905590659075908590959105911591259135914591559165917591859195920592159225923592459255926592759285929593059315932593359345935593659375938593959405941594259435944594559465947594859495950595159525953595459555956595759585959596059615962596359645965596659675968596959705971597259735974597559765977597859795980598159825983598459855986598759885989599059915992599359945995599659975998599960006001600260036004600560066007600860096010601160126013601460156016601760186019602060216022602360246025602660276028602960306031603260336034603560366037603860396040604160426043604460456046604760486049605060516052605360546055605660576058605960606061606260636064606560666067606860696070607160726073607460756076607760786079608060816082608360846085608660876088608960906091609260936094609560966097609860996100610161026103610461056106610761086109611061116112611361146115611661176118611961206121612261236124612561266127612861296130613161326133613461356136613761386139614061416142614361446145614661476148614961506151615261536154615561566157615861596160616161626163616461656166616761686169617061716172617361746175617661776178617961806181618261836184618561866187618861896190619161926193619461956196619761986199620062016202620362046205620662076208620962106211621262136214621562166217621862196220622162226223622462256226622762286229623062316232623362346235623662376238623962406241624262436244624562466247624862496250625162526253625462556256625762586259626062616262626362646265626662676268626962706271627262736274627562766277627862796280628162826283628462856286628762886289629062916292629362946295629662976298629963006301630263036304630563066307630863096310631163126313631463156316631763186319632063216322632363246325632663276328632963306331633263336334633563366337633863396340634163426343634463456346634763486349635063516352635363546355635663576358635963606361636263636364636563666367636863696370637163726373637463756376637763786379638063816382638363846385638663876388638963906391639263936394639563966397639863996400640164026403640464056406640764086409641064116412641364146415641664176418641964206421642264236424642564266427642864296430643164326433643464356436643764386439644064416442644364446445644664476448644964506451645264536454645564566457645864596460646164626463646464656466646764686469647064716472647364746475647664776478647964806481648264836484648564866487648864896490649164926493649464956496649764986499650065016502650365046505650665076508650965106511651265136514651565166517651865196520652165226523652465256526652765286529653065316532653365346535653665376538653965406541654265436544654565466547654865496550655165526553655465556556655765586559656065616562656365646565656665676568656965706571657265736574657565766577657865796580658165826583658465856586658765886589659065916592659365946595659665976598659966006601660266036604660566066607660866096610661166126613661466156616661766186619662066216622662366246625662666276628662966306631663266336634663566366637663866396640664166426643664466456646664766486649665066516652665366546655665666576658665966606661666266636664666566666667666866696670667166726673667466756676667766786679668066816682668366846685668666876688668966906691669266936694669566966697669866996700670167026703670467056706670767086709671067116712671367146715671667176718671967206721672267236724672567266727672867296730673167326733673467356736673767386739674067416742674367446745674667476748674967506751675267536754675567566757675867596760676167626763676467656766676767686769677067716772677367746775677667776778677967806781678267836784678567866787678867896790679167926793679467956796679767986799680068016802680368046805680668076808680968106811681268136814681568166817681868196820682168226823682468256826682768286829683068316832683368346835683668376838683968406841684268436844684568466847684868496850685168526853685468556856685768586859686068616862686368646865686668676868686968706871687268736874687568766877687868796880688168826883688468856886688768886889689068916892689368946895689668976898689969006901690269036904690569066907690869096910691169126913691469156916691769186919692069216922692369246925692669276928692969306931693269336934693569366937693869396940694169426943694469456946694769486949695069516952695369546955695669576958695969606961696269636964696569666967696869696970697169726973697469756976697769786979698069816982698369846985698669876988698969906991699269936994699569966997699869997000700170027003700470057006700770087009701070117012701370147015701670177018701970207021702270237024702570267027702870297030703170327033703470357036703770387039704070417042704370447045704670477048704970507051705270537054705570567057705870597060706170627063706470657066706770687069707070717072707370747075707670777078707970807081708270837084708570867087708870897090709170927093709470957096709770987099710071017102710371047105710671077108710971107111711271137114711571167117711871197120712171227123712471257126712771287129713071317132713371347135713671377138713971407141714271437144714571467147714871497150715171527153715471557156715771587159716071617162716371647165716671677168716971707171717271737174717571767177717871797180718171827183718471857186718771887189719071917192719371947195719671977198719972007201720272037204720572067207720872097210721172127213721472157216721772187219722072217222722372247225722672277228722972307231723272337234723572367237723872397240724172427243724472457246724772487249725072517252725372547255725672577258725972607261726272637264726572667267726872697270727172727273727472757276727772787279728072817282728372847285728672877288728972907291729272937294729572967297729872997300730173027303730473057306730773087309731073117312731373147315731673177318731973207321732273237324732573267327732873297330733173327333733473357336733773387339734073417342734373447345734673477348734973507351735273537354735573567357735873597360736173627363736473657366736773687369737073717372737373747375737673777378737973807381738273837384738573867387738873897390739173927393739473957396739773987399740074017402740374047405740674077408740974107411741274137414741574167417741874197420742174227423742474257426742774287429743074317432743374347435743674377438743974407441744274437444744574467447744874497450745174527453745474557456745774587459746074617462746374647465746674677468746974707471747274737474747574767477747874797480748174827483748474857486748774887489749074917492749374947495749674977498749975007501750275037504750575067507750875097510751175127513751475157516751775187519752075217522752375247525752675277528752975307531753275337534753575367537753875397540754175427543754475457546754775487549755075517552755375547555755675577558755975607561756275637564756575667567756875697570757175727573757475757576757775787579758075817582758375847585758675877588758975907591759275937594759575967597759875997600760176027603760476057606760776087609761076117612761376147615761676177618761976207621762276237624762576267627762876297630763176327633763476357636763776387639764076417642764376447645764676477648764976507651765276537654765576567657765876597660766176627663766476657666766776687669767076717672767376747675767676777678767976807681768276837684768576867687768876897690769176927693769476957696769776987699770077017702770377047705770677077708770977107711771277137714771577167717771877197720772177227723772477257726772777287729773077317732773377347735773677377738773977407741774277437744774577467747774877497750775177527753775477557756775777587759776077617762776377647765776677677768776977707771777277737774777577767777777877797780778177827783778477857786778777887789779077917792779377947795779677977798779978007801780278037804780578067807780878097810781178127813781478157816781778187819782078217822782378247825782678277828782978307831783278337834783578367837783878397840784178427843784478457846784778487849785078517852785378547855785678577858785978607861786278637864786578667867786878697870787178727873787478757876787778787879788078817882788378847885788678877888788978907891789278937894789578967897789878997900790179027903790479057906790779087909791079117912791379147915791679177918791979207921792279237924792579267927792879297930793179327933793479357936793779387939794079417942794379447945794679477948794979507951795279537954795579567957795879597960796179627963796479657966796779687969797079717972797379747975797679777978797979807981798279837984798579867987798879897990799179927993799479957996799779987999800080018002800380048005800680078008800980108011801280138014801580168017801880198020802180228023802480258026802780288029803080318032803380348035803680378038803980408041804280438044804580468047804880498050805180528053805480558056805780588059806080618062806380648065806680678068806980708071807280738074807580768077807880798080808180828083808480858086808780888089809080918092809380948095809680978098809981008101810281038104810581068107810881098110811181128113811481158116811781188119812081218122812381248125812681278128812981308131813281338134813581368137813881398140814181428143814481458146814781488149815081518152815381548155815681578158815981608161816281638164816581668167816881698170817181728173817481758176817781788179818081818182818381848185818681878188818981908191819281938194819581968197819881998200820182028203820482058206820782088209821082118212821382148215821682178218821982208221822282238224822582268227822882298230823182328233823482358236823782388239824082418242824382448245824682478248824982508251825282538254825582568257825882598260826182628263826482658266826782688269827082718272827382748275827682778278827982808281828282838284828582868287828882898290829182928293829482958296829782988299830083018302830383048305830683078308830983108311831283138314831583168317831883198320832183228323832483258326832783288329833083318332833383348335833683378338833983408341834283438344834583468347834883498350835183528353835483558356835783588359836083618362836383648365836683678368836983708371837283738374837583768377837883798380838183828383838483858386838783888389839083918392839383948395839683978398839984008401840284038404840584068407840884098410841184128413841484158416841784188419842084218422842384248425842684278428842984308431843284338434843584368437843884398440844184428443844484458446844784488449845084518452845384548455845684578458845984608461846284638464846584668467846884698470847184728473847484758476847784788479848084818482848384848485848684878488848984908491849284938494849584968497849884998500850185028503850485058506850785088509851085118512851385148515851685178518851985208521852285238524852585268527852885298530853185328533853485358536853785388539854085418542854385448545854685478548854985508551855285538554855585568557855885598560856185628563856485658566856785688569857085718572857385748575857685778578857985808581858285838584858585868587858885898590859185928593859485958596859785988599860086018602860386048605860686078608860986108611861286138614861586168617861886198620862186228623862486258626862786288629863086318632863386348635863686378638863986408641864286438644864586468647864886498650865186528653865486558656865786588659866086618662866386648665866686678668866986708671867286738674867586768677867886798680868186828683868486858686868786888689869086918692869386948695869686978698869987008701870287038704870587068707870887098710871187128713871487158716871787188719872087218722872387248725872687278728872987308731873287338734873587368737873887398740874187428743874487458746874787488749875087518752875387548755875687578758875987608761876287638764876587668767876887698770877187728773877487758776877787788779878087818782878387848785878687878788878987908791879287938794879587968797879887998800880188028803880488058806880788088809881088118812881388148815881688178818881988208821882288238824882588268827882888298830883188328833883488358836883788388839884088418842884388448845884688478848884988508851885288538854885588568857885888598860886188628863886488658866886788688869887088718872887388748875887688778878887988808881888288838884888588868887888888898890889188928893889488958896889788988899890089018902890389048905890689078908890989108911891289138914891589168917891889198920892189228923892489258926892789288929893089318932893389348935893689378938893989408941894289438944894589468947894889498950895189528953895489558956895789588959896089618962896389648965896689678968896989708971897289738974897589768977897889798980898189828983898489858986898789888989899089918992899389948995899689978998899990009001900290039004900590069007900890099010901190129013901490159016901790189019902090219022902390249025902690279028902990309031903290339034903590369037903890399040904190429043904490459046904790489049905090519052905390549055905690579058905990609061906290639064906590669067906890699070907190729073907490759076907790789079908090819082908390849085908690879088908990909091909290939094909590969097909890999100910191029103910491059106910791089109911091119112911391149115911691179118911991209121912291239124912591269127912891299130913191329133913491359136913791389139914091419142914391449145914691479148914991509151915291539154915591569157915891599160916191629163916491659166916791689169917091719172917391749175917691779178917991809181918291839184918591869187918891899190919191929193919491959196919791989199920092019202920392049205920692079208920992109211921292139214921592169217921892199220922192229223922492259226922792289229923092319232923392349235923692379238923992409241924292439244924592469247924892499250925192529253925492559256925792589259926092619262926392649265926692679268926992709271927292739274927592769277927892799280928192829283928492859286928792889289929092919292929392949295929692979298929993009301930293039304930593069307930893099310931193129313931493159316931793189319932093219322932393249325932693279328932993309331933293339334933593369337933893399340934193429343934493459346934793489349935093519352935393549355935693579358935993609361936293639364936593669367936893699370937193729373937493759376937793789379938093819382938393849385938693879388938993909391939293939394939593969397939893999400940194029403940494059406940794089409941094119412941394149415941694179418941994209421942294239424942594269427942894299430943194329433943494359436943794389439944094419442944394449445944694479448944994509451945294539454945594569457945894599460946194629463946494659466946794689469947094719472947394749475947694779478947994809481948294839484948594869487948894899490949194929493949494959496949794989499950095019502950395049505950695079508950995109511951295139514951595169517951895199520952195229523952495259526952795289529953095319532953395349535953695379538953995409541954295439544954595469547954895499550955195529553955495559556955795589559956095619562956395649565956695679568956995709571957295739574957595769577957895799580958195829583958495859586958795889589959095919592959395949595959695979598959996009601960296039604960596069607960896099610961196129613961496159616961796189619962096219622962396249625962696279628962996309631963296339634963596369637963896399640964196429643964496459646964796489649965096519652965396549655965696579658965996609661966296639664966596669667966896699670967196729673967496759676967796789679968096819682968396849685968696879688968996909691969296939694969596969697969896999700970197029703970497059706970797089709971097119712971397149715971697179718971997209721972297239724972597269727972897299730973197329733973497359736973797389739974097419742974397449745974697479748974997509751975297539754975597569757975897599760976197629763976497659766976797689769977097719772977397749775977697779778977997809781978297839784978597869787978897899790979197929793979497959796979797989799980098019802980398049805980698079808980998109811981298139814981598169817981898199820982198229823982498259826982798289829983098319832983398349835983698379838983998409841984298439844984598469847984898499850985198529853985498559856985798589859986098619862986398649865986698679868986998709871987298739874987598769877987898799880988198829883988498859886988798889889989098919892989398949895989698979898989999009901990299039904990599069907990899099910991199129913991499159916991799189919992099219922992399249925992699279928992999309931993299339934993599369937993899399940994199429943994499459946994799489949995099519952995399549955995699579958995999609961996299639964996599669967996899699970997199729973997499759976997799789979998099819982998399849985998699879988998999909991999299939994999599969997999899991000010001100021000310004100051000610007100081000910010100111001210013100141001510016100171001810019100201002110022100231002410025100261002710028100291003010031100321003310034100351003610037100381003910040100411004210043100441004510046100471004810049100501005110052100531005410055100561005710058100591006010061100621006310064100651006610067100681006910070100711007210073100741007510076100771007810079100801008110082100831008410085100861008710088100891009010091100921009310094100951009610097100981009910100101011010210103101041010510106101071010810109101101011110112101131011410115101161011710118101191012010121101221012310124101251012610127101281012910130101311013210133101341013510136101371013810139101401014110142101431014410145101461014710148101491015010151101521015310154101551015610157101581015910160101611016210163101641016510166101671016810169101701017110172101731017410175101761017710178101791018010181101821018310184101851018610187101881018910190101911019210193101941019510196101971019810199102001020110202102031020410205102061020710208102091021010211102121021310214102151021610217102181021910220102211022210223102241022510226102271022810229102301023110232102331023410235102361023710238102391024010241102421024310244102451024610247102481024910250102511025210253102541025510256102571025810259102601026110262102631026410265102661026710268102691027010271102721027310274102751027610277102781027910280102811028210283102841028510286102871028810289102901029110292102931029410295102961029710298102991030010301103021030310304103051030610307103081030910310103111031210313103141031510316103171031810319103201032110322103231032410325103261032710328103291033010331103321033310334103351033610337103381033910340103411034210343103441034510346103471034810349103501035110352103531035410355103561035710358103591036010361103621036310364103651036610367103681036910370103711037210373103741037510376103771037810379103801038110382103831038410385103861038710388103891039010391103921039310394103951039610397103981039910400104011040210403104041040510406104071040810409104101041110412104131041410415104161041710418104191042010421104221042310424104251042610427104281042910430104311043210433104341043510436104371043810439104401044110442104431044410445104461044710448104491045010451104521045310454104551045610457104581045910460104611046210463104641046510466104671046810469104701047110472104731047410475104761047710478104791048010481104821048310484104851048610487104881048910490104911049210493104941049510496104971049810499105001050110502105031050410505105061050710508105091051010511105121051310514105151051610517105181051910520105211052210523105241052510526105271052810529105301053110532105331053410535105361053710538105391054010541105421054310544105451054610547105481054910550105511055210553105541055510556105571055810559105601056110562105631056410565105661056710568105691057010571105721057310574105751057610577105781057910580105811058210583105841058510586105871058810589105901059110592105931059410595105961059710598105991060010601106021060310604106051060610607106081060910610106111061210613106141061510616106171061810619106201062110622106231062410625106261062710628106291063010631106321063310634106351063610637106381063910640106411064210643106441064510646106471064810649106501065110652106531065410655106561065710658106591066010661106621066310664106651066610667106681066910670106711067210673106741067510676106771067810679106801068110682106831068410685106861068710688106891069010691106921069310694106951069610697106981069910700107011070210703107041070510706107071070810709107101071110712107131071410715107161071710718107191072010721107221072310724107251072610727107281072910730107311073210733107341073510736107371073810739107401074110742107431074410745107461074710748107491075010751107521075310754107551075610757107581075910760107611076210763107641076510766107671076810769107701077110772107731077410775107761077710778107791078010781107821078310784107851078610787107881078910790107911079210793107941079510796107971079810799108001080110802108031080410805108061080710808108091081010811108121081310814108151081610817108181081910820108211082210823108241082510826108271082810829108301083110832108331083410835108361083710838108391084010841108421084310844108451084610847108481084910850108511085210853108541085510856108571085810859108601086110862108631086410865108661086710868108691087010871108721087310874108751087610877108781087910880108811088210883108841088510886108871088810889108901089110892108931089410895108961089710898108991090010901109021090310904109051090610907109081090910910109111091210913109141091510916109171091810919109201092110922109231092410925109261092710928109291093010931109321093310934109351093610937109381093910940109411094210943109441094510946109471094810949109501095110952109531095410955109561095710958109591096010961109621096310964109651096610967109681096910970109711097210973109741097510976109771097810979109801098110982109831098410985109861098710988109891099010991109921099310994109951099610997109981099911000110011100211003110041100511006110071100811009110101101111012110131101411015110161101711018110191102011021110221102311024110251102611027110281102911030110311103211033110341103511036110371103811039110401104111042110431104411045110461104711048110491105011051110521105311054110551105611057110581105911060110611106211063110641106511066110671106811069110701107111072110731107411075110761107711078110791108011081110821108311084110851108611087110881108911090110911109211093110941109511096110971109811099111001110111102111031110411105111061110711108111091111011111111121111311114111151111611117111181111911120111211112211123111241112511126111271112811129111301113111132111331113411135111361113711138111391114011141111421114311144111451114611147111481114911150111511115211153111541115511156111571115811159111601116111162111631116411165111661116711168111691117011171111721117311174111751117611177111781117911180111811118211183111841118511186111871118811189111901119111192111931119411195111961119711198111991120011201112021120311204112051120611207112081120911210112111121211213112141121511216112171121811219112201122111222112231122411225112261122711228112291123011231112321123311234112351123611237112381123911240112411124211243112441124511246112471124811249112501125111252112531125411255112561125711258112591126011261112621126311264112651126611267112681126911270112711127211273112741127511276112771127811279112801128111282112831128411285112861128711288112891129011291112921129311294112951129611297112981129911300113011130211303113041130511306113071130811309113101131111312113131131411315113161131711318113191132011321113221132311324113251132611327113281132911330113311133211333113341133511336113371133811339113401134111342113431134411345113461134711348113491135011351113521135311354113551135611357113581135911360113611136211363113641136511366113671136811369113701137111372113731137411375113761137711378113791138011381113821138311384113851138611387113881138911390113911139211393113941139511396113971139811399114001140111402114031140411405114061140711408114091141011411114121141311414114151141611417114181141911420114211142211423114241142511426114271142811429114301143111432114331143411435114361143711438114391144011441114421144311444114451144611447114481144911450114511145211453114541145511456114571145811459114601146111462114631146411465114661146711468114691147011471114721147311474114751147611477114781147911480114811148211483114841148511486114871148811489114901149111492114931149411495114961149711498114991150011501115021150311504115051150611507115081150911510115111151211513115141151511516115171151811519115201152111522115231152411525115261152711528115291153011531115321153311534115351153611537115381153911540115411154211543115441154511546115471154811549115501155111552115531155411555115561155711558115591156011561115621156311564115651156611567115681156911570115711157211573115741157511576115771157811579115801158111582115831158411585115861158711588115891159011591115921159311594115951159611597115981159911600116011160211603116041160511606116071160811609116101161111612116131161411615116161161711618116191162011621116221162311624116251162611627116281162911630116311163211633116341163511636116371163811639116401164111642116431164411645116461164711648116491165011651116521165311654116551165611657116581165911660116611166211663116641166511666116671166811669116701167111672116731167411675116761167711678116791168011681116821168311684116851168611687116881168911690116911169211693116941169511696116971169811699117001170111702117031170411705117061170711708117091171011711117121171311714117151171611717117181171911720117211172211723117241172511726117271172811729117301173111732117331173411735117361173711738117391174011741117421174311744117451174611747117481174911750117511175211753117541175511756117571175811759117601176111762117631176411765117661176711768117691177011771117721177311774117751177611777117781177911780117811178211783117841178511786117871178811789117901179111792117931179411795117961179711798117991180011801118021180311804118051180611807118081180911810118111181211813118141181511816118171181811819118201182111822118231182411825118261182711828118291183011831118321183311834118351183611837118381183911840118411184211843118441184511846118471184811849118501185111852118531185411855118561185711858118591186011861118621186311864118651186611867118681186911870118711187211873118741187511876118771187811879118801188111882118831188411885118861188711888118891189011891118921189311894118951189611897118981189911900119011190211903119041190511906119071190811909119101191111912119131191411915119161191711918119191192011921119221192311924119251192611927119281192911930119311193211933119341193511936119371193811939119401194111942119431194411945119461194711948119491195011951119521195311954119551195611957119581195911960119611196211963119641196511966119671196811969119701197111972119731197411975119761197711978119791198011981119821198311984119851198611987119881198911990119911199211993119941199511996119971199811999120001200112002120031200412005120061200712008120091201012011120121201312014120151201612017120181201912020120211202212023120241202512026120271202812029120301203112032120331203412035120361203712038120391204012041120421204312044120451204612047120481204912050120511205212053120541205512056120571205812059120601206112062120631206412065120661206712068120691207012071120721207312074120751207612077120781207912080120811208212083120841208512086120871208812089120901209112092120931209412095120961209712098120991210012101121021210312104121051210612107121081210912110121111211212113121141211512116121171211812119121201212112122121231212412125121261212712128121291213012131121321213312134121351213612137121381213912140121411214212143121441214512146121471214812149121501215112152121531215412155121561215712158121591216012161121621216312164121651216612167121681216912170121711217212173121741217512176121771217812179121801218112182121831218412185121861218712188121891219012191121921219312194121951219612197121981219912200122011220212203122041220512206122071220812209122101221112212122131221412215122161221712218122191222012221122221222312224122251222612227122281222912230122311223212233122341223512236122371223812239122401224112242122431224412245122461224712248122491225012251122521225312254122551225612257122581225912260122611226212263122641226512266122671226812269122701227112272122731227412275122761227712278122791228012281122821228312284122851228612287122881228912290122911229212293122941229512296122971229812299123001230112302123031230412305123061230712308123091231012311123121231312314123151231612317123181231912320123211232212323123241232512326123271232812329123301233112332123331233412335123361233712338123391234012341123421234312344123451234612347123481234912350123511235212353123541235512356123571235812359123601236112362123631236412365123661236712368123691237012371123721237312374123751237612377123781237912380123811238212383123841238512386123871238812389123901239112392123931239412395123961239712398123991240012401124021240312404124051240612407124081240912410124111241212413124141241512416124171241812419124201242112422124231242412425124261242712428124291243012431124321243312434124351243612437124381243912440124411244212443124441244512446124471244812449124501245112452124531245412455124561245712458124591246012461124621246312464124651246612467124681246912470124711247212473124741247512476124771247812479124801248112482124831248412485124861248712488124891249012491124921249312494124951249612497124981249912500125011250212503125041250512506125071250812509125101251112512125131251412515125161251712518125191252012521125221252312524125251252612527125281252912530125311253212533125341253512536125371253812539125401254112542125431254412545125461254712548125491255012551125521255312554125551255612557125581255912560125611256212563125641256512566125671256812569125701257112572125731257412575125761257712578125791258012581125821258312584125851258612587125881258912590125911259212593125941259512596125971259812599126001260112602126031260412605126061260712608126091261012611126121261312614126151261612617126181261912620126211262212623126241262512626126271262812629126301263112632126331263412635126361263712638126391264012641126421264312644126451264612647126481264912650126511265212653126541265512656126571265812659126601266112662126631266412665126661266712668126691267012671126721267312674126751267612677126781267912680126811268212683126841268512686126871268812689126901269112692126931269412695126961269712698126991270012701127021270312704127051270612707127081270912710127111271212713127141271512716127171271812719127201272112722127231272412725127261272712728127291273012731127321273312734127351273612737127381273912740127411274212743127441274512746127471274812749127501275112752127531275412755127561275712758127591276012761127621276312764127651276612767127681276912770127711277212773127741277512776127771277812779127801278112782127831278412785127861278712788127891279012791127921279312794127951279612797127981279912800128011280212803128041280512806128071280812809128101281112812128131281412815128161281712818128191282012821128221282312824128251282612827128281282912830128311283212833128341283512836128371283812839128401284112842128431284412845128461284712848128491285012851128521285312854128551285612857128581285912860128611286212863128641286512866128671286812869128701287112872128731287412875128761287712878128791288012881128821288312884128851288612887128881288912890128911289212893128941289512896128971289812899129001290112902129031290412905129061290712908129091291012911129121291312914129151291612917129181291912920129211292212923129241292512926129271292812929129301293112932129331293412935129361293712938129391294012941129421294312944129451294612947129481294912950129511295212953129541295512956129571295812959129601296112962129631296412965129661296712968129691297012971129721297312974129751297612977129781297912980129811298212983129841298512986129871298812989129901299112992129931299412995129961299712998129991300013001130021300313004130051300613007130081300913010130111301213013130141301513016130171301813019130201302113022130231302413025130261302713028130291303013031130321303313034130351303613037130381303913040130411304213043130441304513046130471304813049130501305113052130531305413055130561305713058130591306013061130621306313064130651306613067130681306913070130711307213073130741307513076130771307813079130801308113082130831308413085130861308713088130891309013091130921309313094130951309613097130981309913100131011310213103131041310513106131071310813109131101311113112131131311413115131161311713118131191312013121131221312313124131251312613127131281312913130131311313213133131341313513136131371313813139131401314113142131431314413145131461314713148131491315013151131521315313154131551315613157131581315913160131611316213163131641316513166131671316813169131701317113172131731317413175131761317713178131791318013181131821318313184131851318613187131881318913190131911319213193131941319513196131971319813199132001320113202132031320413205132061320713208132091321013211132121321313214132151321613217132181321913220132211322213223132241322513226132271322813229132301323113232132331323413235132361323713238132391324013241132421324313244132451324613247132481324913250132511325213253132541325513256132571325813259132601326113262132631326413265132661326713268132691327013271132721327313274132751327613277132781327913280132811328213283132841328513286132871328813289132901329113292132931329413295132961329713298132991330013301133021330313304133051330613307133081330913310133111331213313133141331513316133171331813319133201332113322133231332413325133261332713328133291333013331133321333313334133351333613337133381333913340133411334213343133441334513346133471334813349133501335113352133531335413355133561335713358133591336013361133621336313364133651336613367133681336913370133711337213373133741337513376133771337813379133801338113382133831338413385133861338713388133891339013391133921339313394133951339613397133981339913400134011340213403134041340513406134071340813409134101341113412134131341413415134161341713418134191342013421134221342313424134251342613427134281342913430134311343213433134341343513436134371343813439134401344113442134431344413445134461344713448134491345013451134521345313454134551345613457134581345913460134611346213463134641346513466134671346813469134701347113472134731347413475134761347713478134791348013481134821348313484134851348613487134881348913490134911349213493134941349513496134971349813499135001350113502135031350413505135061350713508135091351013511135121351313514135151351613517135181351913520135211352213523135241352513526135271352813529135301353113532135331353413535135361353713538135391354013541135421354313544135451354613547135481354913550135511355213553135541355513556135571355813559135601356113562135631356413565135661356713568135691357013571135721357313574135751357613577135781357913580135811358213583135841358513586135871358813589135901359113592135931359413595135961359713598135991360013601136021360313604136051360613607136081360913610136111361213613136141361513616136171361813619136201362113622136231362413625136261362713628136291363013631136321363313634136351363613637136381363913640136411364213643136441364513646136471364813649136501365113652136531365413655136561365713658136591366013661136621366313664136651366613667136681366913670136711367213673136741367513676136771367813679136801368113682136831368413685136861368713688136891369013691136921369313694136951369613697136981369913700137011370213703137041370513706137071370813709137101371113712137131371413715137161371713718137191372013721137221372313724137251372613727137281372913730137311373213733137341373513736137371373813739137401374113742137431374413745137461374713748137491375013751137521375313754137551375613757137581375913760137611376213763137641376513766137671376813769137701377113772137731377413775137761377713778137791378013781137821378313784137851378613787137881378913790137911379213793137941379513796137971379813799138001380113802138031380413805138061380713808138091381013811138121381313814138151381613817138181381913820138211382213823138241382513826138271382813829138301383113832138331383413835138361383713838138391384013841138421384313844138451384613847138481384913850138511385213853138541385513856138571385813859138601386113862138631386413865138661386713868138691387013871138721387313874138751387613877138781387913880138811388213883138841388513886138871388813889138901389113892138931389413895138961389713898138991390013901139021390313904139051390613907139081390913910139111391213913139141391513916139171391813919139201392113922139231392413925139261392713928139291393013931139321393313934139351393613937139381393913940139411394213943139441394513946139471394813949139501395113952139531395413955139561395713958139591396013961139621396313964139651396613967139681396913970139711397213973139741397513976139771397813979139801398113982139831398413985139861398713988139891399013991139921399313994139951399613997139981399914000140011400214003140041400514006140071400814009140101401114012140131401414015140161401714018140191402014021140221402314024140251402614027140281402914030140311403214033140341403514036140371403814039140401404114042140431404414045140461404714048140491405014051140521405314054140551405614057140581405914060140611406214063140641406514066140671406814069140701407114072140731407414075140761407714078140791408014081140821408314084140851408614087140881408914090140911409214093140941409514096140971409814099141001410114102141031410414105141061410714108141091411014111141121411314114141151411614117141181411914120141211412214123141241412514126141271412814129141301413114132141331413414135141361413714138141391414014141141421414314144141451414614147141481414914150141511415214153141541415514156141571415814159141601416114162141631416414165141661416714168141691417014171141721417314174141751417614177141781417914180141811418214183141841418514186141871418814189141901419114192141931419414195141961419714198141991420014201142021420314204142051420614207142081420914210142111421214213142141421514216142171421814219142201422114222142231422414225142261422714228142291423014231142321423314234142351423614237142381423914240142411424214243142441424514246142471424814249142501425114252142531425414255142561425714258142591426014261142621426314264142651426614267142681426914270142711427214273142741427514276142771427814279142801428114282142831428414285142861428714288142891429014291142921429314294142951429614297142981429914300143011430214303143041430514306143071430814309143101431114312143131431414315143161431714318143191432014321143221432314324143251432614327143281432914330143311433214333143341433514336143371433814339143401434114342143431434414345143461434714348143491435014351143521435314354143551435614357143581435914360143611436214363143641436514366143671436814369143701437114372143731437414375143761437714378143791438014381143821438314384143851438614387143881438914390143911439214393143941439514396143971439814399144001440114402144031440414405144061440714408144091441014411144121441314414144151441614417144181441914420144211442214423144241442514426144271442814429144301443114432144331443414435144361443714438144391444014441144421444314444144451444614447144481444914450144511445214453144541445514456144571445814459144601446114462144631446414465144661446714468144691447014471144721447314474144751447614477144781447914480144811448214483144841448514486144871448814489144901449114492144931449414495144961449714498144991450014501145021450314504145051450614507145081450914510145111451214513145141451514516145171451814519145201452114522145231452414525145261452714528145291453014531145321453314534145351453614537145381453914540145411454214543145441454514546145471454814549145501455114552145531455414555145561455714558145591456014561145621456314564145651456614567145681456914570145711457214573145741457514576145771457814579145801458114582145831458414585145861458714588145891459014591145921459314594145951459614597145981459914600146011460214603146041460514606146071460814609146101461114612146131461414615146161461714618146191462014621146221462314624146251462614627146281462914630146311463214633146341463514636146371463814639146401464114642146431464414645146461464714648146491465014651146521465314654146551465614657146581465914660146611466214663146641466514666146671466814669146701467114672146731467414675146761467714678146791468014681146821468314684146851468614687146881468914690146911469214693146941469514696146971469814699147001470114702147031470414705147061470714708147091471014711147121471314714147151471614717147181471914720147211472214723147241472514726147271472814729147301473114732147331473414735147361473714738147391474014741147421474314744147451474614747147481474914750147511475214753147541475514756147571475814759147601476114762147631476414765147661476714768147691477014771147721477314774147751477614777147781477914780147811478214783147841478514786147871478814789147901479114792147931479414795147961479714798147991480014801148021480314804148051480614807148081480914810148111481214813148141481514816148171481814819148201482114822148231482414825148261482714828148291483014831148321483314834148351483614837148381483914840148411484214843148441484514846148471484814849148501485114852148531485414855148561485714858148591486014861148621486314864148651486614867148681486914870148711487214873148741487514876148771487814879148801488114882148831488414885148861488714888148891489014891148921489314894148951489614897148981489914900149011490214903149041490514906149071490814909149101491114912149131491414915149161491714918149191492014921149221492314924149251492614927149281492914930149311493214933149341493514936149371493814939149401494114942149431494414945149461494714948149491495014951149521495314954149551495614957149581495914960149611496214963149641496514966149671496814969149701497114972149731497414975149761497714978149791498014981149821498314984149851498614987149881498914990149911499214993149941499514996149971499814999150001500115002150031500415005150061500715008150091501015011150121501315014150151501615017150181501915020150211502215023150241502515026150271502815029150301503115032150331503415035150361503715038150391504015041150421504315044150451504615047150481504915050150511505215053150541505515056150571505815059150601506115062150631506415065150661506715068150691507015071150721507315074150751507615077150781507915080150811508215083150841508515086150871508815089150901509115092150931509415095150961509715098150991510015101151021510315104151051510615107151081510915110151111511215113151141511515116151171511815119151201512115122151231512415125151261512715128151291513015131151321513315134151351513615137151381513915140151411514215143151441514515146151471514815149151501515115152151531515415155151561515715158151591516015161151621516315164151651516615167151681516915170151711517215173151741517515176151771517815179151801518115182151831518415185151861518715188151891519015191151921519315194151951519615197151981519915200152011520215203152041520515206152071520815209152101521115212152131521415215152161521715218152191522015221152221522315224152251522615227152281522915230152311523215233152341523515236152371523815239152401524115242152431524415245152461524715248152491525015251152521525315254152551525615257152581525915260152611526215263152641526515266152671526815269152701527115272152731527415275152761527715278152791528015281152821528315284152851528615287152881528915290152911529215293152941529515296152971529815299153001530115302153031530415305153061530715308153091531015311153121531315314153151531615317153181531915320153211532215323153241532515326153271532815329153301533115332153331533415335153361533715338153391534015341153421534315344153451534615347153481534915350153511535215353153541535515356153571535815359153601536115362153631536415365153661536715368153691537015371153721537315374153751537615377153781537915380153811538215383153841538515386153871538815389153901539115392153931539415395153961539715398153991540015401154021540315404154051540615407154081540915410154111541215413154141541515416154171541815419154201542115422154231542415425154261542715428154291543015431154321543315434154351543615437154381543915440154411544215443154441544515446154471544815449154501545115452154531545415455154561545715458154591546015461154621546315464154651546615467154681546915470154711547215473154741547515476154771547815479154801548115482154831548415485154861548715488154891549015491154921549315494154951549615497154981549915500155011550215503155041550515506155071550815509155101551115512155131551415515155161551715518155191552015521155221552315524155251552615527155281552915530155311553215533155341553515536155371553815539155401554115542155431554415545155461554715548155491555015551155521555315554155551555615557155581555915560155611556215563155641556515566155671556815569155701557115572155731557415575155761557715578155791558015581155821558315584155851558615587155881558915590155911559215593155941559515596155971559815599156001560115602156031560415605156061560715608156091561015611156121561315614156151561615617156181561915620156211562215623156241562515626156271562815629156301563115632156331563415635156361563715638156391564015641156421564315644156451564615647156481564915650156511565215653156541565515656156571565815659156601566115662156631566415665156661566715668156691567015671156721567315674156751567615677156781567915680156811568215683156841568515686156871568815689156901569115692156931569415695156961569715698156991570015701157021570315704157051570615707157081570915710157111571215713157141571515716157171571815719157201572115722157231572415725157261572715728157291573015731157321573315734157351573615737157381573915740157411574215743157441574515746157471574815749157501575115752157531575415755157561575715758157591576015761157621576315764157651576615767157681576915770157711577215773157741577515776157771577815779157801578115782157831578415785157861578715788157891579015791157921579315794157951579615797157981579915800158011580215803158041580515806158071580815809158101581115812158131581415815158161581715818158191582015821158221582315824158251582615827158281582915830158311583215833158341583515836158371583815839158401584115842158431584415845158461584715848158491585015851158521585315854158551585615857158581585915860158611586215863158641586515866158671586815869158701587115872158731587415875158761587715878158791588015881158821588315884158851588615887158881588915890158911589215893158941589515896158971589815899159001590115902159031590415905159061590715908159091591015911159121591315914159151591615917159181591915920159211592215923159241592515926159271592815929159301593115932159331593415935159361593715938159391594015941159421594315944159451594615947159481594915950159511595215953159541595515956159571595815959159601596115962159631596415965159661596715968159691597015971159721597315974159751597615977159781597915980159811598215983159841598515986159871598815989159901599115992159931599415995159961599715998159991600016001160021600316004160051600616007160081600916010160111601216013160141601516016160171601816019160201602116022160231602416025160261602716028160291603016031160321603316034160351603616037160381603916040160411604216043160441604516046160471604816049160501605116052160531605416055160561605716058160591606016061160621606316064160651606616067160681606916070160711607216073160741607516076160771607816079160801608116082160831608416085160861608716088160891609016091160921609316094160951609616097160981609916100161011610216103161041610516106161071610816109161101611116112161131611416115161161611716118161191612016121161221612316124161251612616127161281612916130161311613216133161341613516136161371613816139161401614116142161431614416145161461614716148161491615016151161521615316154161551615616157161581615916160161611616216163161641616516166161671616816169161701617116172161731617416175161761617716178161791618016181161821618316184161851618616187161881618916190161911619216193161941619516196161971619816199162001620116202162031620416205162061620716208162091621016211162121621316214162151621616217162181621916220162211622216223162241622516226162271622816229162301623116232162331623416235162361623716238162391624016241162421624316244162451624616247162481624916250162511625216253162541625516256162571625816259162601626116262162631626416265162661626716268162691627016271162721627316274162751627616277162781627916280162811628216283162841628516286162871628816289162901629116292162931629416295162961629716298162991630016301163021630316304163051630616307163081630916310163111631216313163141631516316163171631816319163201632116322163231632416325163261632716328163291633016331163321633316334163351633616337163381633916340163411634216343163441634516346163471634816349163501635116352163531635416355163561635716358163591636016361163621636316364163651636616367163681636916370163711637216373163741637516376163771637816379163801638116382163831638416385163861638716388163891639016391163921639316394163951639616397163981639916400164011640216403164041640516406164071640816409164101641116412164131641416415164161641716418164191642016421164221642316424164251642616427164281642916430164311643216433164341643516436164371643816439164401644116442164431644416445164461644716448164491645016451164521645316454164551645616457164581645916460164611646216463164641646516466164671646816469164701647116472164731647416475164761647716478164791648016481164821648316484164851648616487164881648916490164911649216493164941649516496164971649816499165001650116502165031650416505165061650716508165091651016511165121651316514165151651616517165181651916520165211652216523165241652516526165271652816529165301653116532165331653416535165361653716538165391654016541165421654316544165451654616547165481654916550165511655216553165541655516556165571655816559165601656116562165631656416565165661656716568165691657016571165721657316574165751657616577165781657916580165811658216583165841658516586165871658816589165901659116592165931659416595165961659716598165991660016601166021660316604166051660616607166081660916610166111661216613166141661516616166171661816619166201662116622166231662416625166261662716628166291663016631166321663316634166351663616637166381663916640166411664216643166441664516646166471664816649166501665116652166531665416655166561665716658166591666016661166621666316664166651666616667166681666916670166711667216673166741667516676166771667816679166801668116682166831668416685166861668716688166891669016691166921669316694166951669616697166981669916700167011670216703167041670516706167071670816709167101671116712167131671416715167161671716718167191672016721167221672316724167251672616727167281672916730167311673216733167341673516736167371673816739167401674116742167431674416745167461674716748167491675016751167521675316754167551675616757167581675916760167611676216763167641676516766167671676816769167701677116772167731677416775167761677716778167791678016781167821678316784167851678616787167881678916790167911679216793167941679516796167971679816799168001680116802168031680416805168061680716808168091681016811168121681316814168151681616817168181681916820168211682216823168241682516826168271682816829168301683116832168331683416835168361683716838168391684016841168421684316844168451684616847168481684916850168511685216853168541685516856168571685816859168601686116862168631686416865168661686716868168691687016871168721687316874168751687616877168781687916880168811688216883168841688516886168871688816889168901689116892168931689416895168961689716898168991690016901169021690316904169051690616907169081690916910169111691216913169141691516916169171691816919169201692116922169231692416925169261692716928169291693016931169321693316934169351693616937169381693916940169411694216943169441694516946169471694816949169501695116952169531695416955169561695716958169591696016961169621696316964169651696616967169681696916970169711697216973169741697516976169771697816979169801698116982169831698416985169861698716988169891699016991169921699316994169951699616997169981699917000170011700217003170041700517006170071700817009170101701117012170131701417015170161701717018170191702017021170221702317024170251702617027170281702917030170311703217033170341703517036170371703817039170401704117042170431704417045170461704717048170491705017051170521705317054170551705617057170581705917060170611706217063170641706517066170671706817069170701707117072170731707417075170761707717078170791708017081170821708317084170851708617087170881708917090170911709217093170941709517096170971709817099171001710117102171031710417105171061710717108171091711017111171121711317114171151711617117171181711917120171211712217123171241712517126171271712817129171301713117132171331713417135171361713717138171391714017141171421714317144171451714617147171481714917150171511715217153171541715517156171571715817159171601716117162171631716417165171661716717168171691717017171171721717317174171751717617177171781717917180171811718217183171841718517186171871718817189171901719117192171931719417195171961719717198171991720017201172021720317204172051720617207172081720917210172111721217213172141721517216172171721817219172201722117222172231722417225172261722717228172291723017231172321723317234172351723617237172381723917240172411724217243172441724517246172471724817249172501725117252172531725417255172561725717258172591726017261172621726317264172651726617267172681726917270172711727217273172741727517276172771727817279172801728117282172831728417285172861728717288172891729017291172921729317294172951729617297172981729917300173011730217303173041730517306173071730817309173101731117312173131731417315173161731717318173191732017321173221732317324173251732617327173281732917330173311733217333173341733517336173371733817339173401734117342173431734417345173461734717348173491735017351173521735317354173551735617357173581735917360173611736217363173641736517366173671736817369173701737117372173731737417375173761737717378173791738017381173821738317384173851738617387173881738917390173911739217393173941739517396173971739817399174001740117402174031740417405174061740717408174091741017411174121741317414174151741617417174181741917420174211742217423174241742517426174271742817429174301743117432174331743417435174361743717438174391744017441174421744317444174451744617447174481744917450174511745217453174541745517456174571745817459174601746117462174631746417465174661746717468174691747017471174721747317474174751747617477174781747917480174811748217483174841748517486174871748817489174901749117492174931749417495174961749717498174991750017501175021750317504175051750617507175081750917510175111751217513175141751517516175171751817519175201752117522175231752417525175261752717528175291753017531175321753317534175351753617537175381753917540175411754217543175441754517546175471754817549175501755117552175531755417555175561755717558175591756017561175621756317564175651756617567175681756917570175711757217573175741757517576175771757817579175801758117582175831758417585175861758717588175891759017591175921759317594175951759617597175981759917600176011760217603176041760517606176071760817609176101761117612176131761417615176161761717618176191762017621176221762317624176251762617627176281762917630176311763217633176341763517636176371763817639176401764117642176431764417645176461764717648176491765017651176521765317654176551765617657176581765917660176611766217663176641766517666176671766817669176701767117672176731767417675176761767717678176791768017681176821768317684176851768617687176881768917690176911769217693176941769517696176971769817699177001770117702177031770417705177061770717708177091771017711177121771317714177151771617717177181771917720177211772217723177241772517726177271772817729177301773117732177331773417735177361773717738177391774017741177421774317744177451774617747177481774917750177511775217753177541775517756177571775817759177601776117762177631776417765177661776717768177691777017771177721777317774177751777617777177781777917780177811778217783177841778517786177871778817789177901779117792177931779417795177961779717798177991780017801178021780317804178051780617807178081780917810178111781217813178141781517816178171781817819178201782117822178231782417825178261782717828178291783017831178321783317834178351783617837178381783917840178411784217843178441784517846178471784817849178501785117852178531785417855178561785717858178591786017861178621786317864178651786617867178681786917870178711787217873178741787517876178771787817879178801788117882178831788417885178861788717888178891789017891178921789317894178951789617897178981789917900179011790217903179041790517906179071790817909179101791117912179131791417915179161791717918179191792017921179221792317924179251792617927179281792917930179311793217933179341793517936179371793817939179401794117942179431794417945179461794717948179491795017951179521795317954179551795617957179581795917960179611796217963179641796517966179671796817969179701797117972179731797417975179761797717978179791798017981179821798317984179851798617987179881798917990179911799217993179941799517996179971799817999180001800118002180031800418005180061800718008180091801018011180121801318014180151801618017180181801918020180211802218023180241802518026180271802818029180301803118032180331803418035180361803718038180391804018041180421804318044180451804618047180481804918050180511805218053180541805518056180571805818059180601806118062180631806418065180661806718068180691807018071180721807318074180751807618077180781807918080180811808218083180841808518086180871808818089180901809118092180931809418095180961809718098180991810018101181021810318104181051810618107181081810918110181111811218113181141811518116181171811818119181201812118122181231812418125181261812718128181291813018131181321813318134181351813618137181381813918140181411814218143181441814518146181471814818149181501815118152181531815418155181561815718158181591816018161181621816318164181651816618167181681816918170181711817218173181741817518176181771817818179181801818118182181831818418185181861818718188181891819018191181921819318194181951819618197181981819918200182011820218203182041820518206182071820818209182101821118212182131821418215182161821718218182191822018221182221822318224182251822618227182281822918230182311823218233182341823518236182371823818239182401824118242182431824418245182461824718248182491825018251182521825318254182551825618257182581825918260182611826218263182641826518266182671826818269182701827118272182731827418275182761827718278182791828018281182821828318284182851828618287182881828918290182911829218293182941829518296182971829818299183001830118302183031830418305183061830718308183091831018311183121831318314183151831618317183181831918320183211832218323183241832518326183271832818329183301833118332183331833418335183361833718338183391834018341183421834318344183451834618347183481834918350183511835218353183541835518356183571835818359183601836118362183631836418365183661836718368183691837018371183721837318374183751837618377183781837918380183811838218383183841838518386183871838818389183901839118392183931839418395183961839718398183991840018401184021840318404184051840618407184081840918410184111841218413184141841518416184171841818419184201842118422184231842418425184261842718428184291843018431184321843318434184351843618437184381843918440184411844218443184441844518446184471844818449184501845118452184531845418455184561845718458184591846018461184621846318464184651846618467184681846918470184711847218473184741847518476184771847818479184801848118482184831848418485184861848718488184891849018491184921849318494184951849618497184981849918500185011850218503185041850518506185071850818509185101851118512185131851418515185161851718518185191852018521185221852318524185251852618527185281852918530185311853218533185341853518536185371853818539185401854118542185431854418545185461854718548185491855018551185521855318554185551855618557185581855918560185611856218563185641856518566185671856818569185701857118572185731857418575185761857718578185791858018581185821858318584185851858618587185881858918590185911859218593185941859518596185971859818599186001860118602186031860418605186061860718608186091861018611186121861318614186151861618617186181861918620186211862218623186241862518626186271862818629186301863118632186331863418635186361863718638186391864018641186421864318644186451864618647186481864918650186511865218653186541865518656186571865818659186601866118662186631866418665186661866718668186691867018671186721867318674186751867618677186781867918680186811868218683186841868518686186871868818689186901869118692186931869418695186961869718698186991870018701187021870318704187051870618707187081870918710187111871218713187141871518716187171871818719187201872118722187231872418725187261872718728187291873018731187321873318734187351873618737187381873918740187411874218743187441874518746187471874818749187501875118752187531875418755187561875718758187591876018761187621876318764187651876618767187681876918770187711877218773187741877518776187771877818779187801878118782187831878418785187861878718788187891879018791187921879318794187951879618797187981879918800188011880218803188041880518806188071880818809188101881118812188131881418815188161881718818188191882018821188221882318824188251882618827188281882918830188311883218833188341883518836188371883818839188401884118842188431884418845188461884718848188491885018851188521885318854188551885618857188581885918860188611886218863188641886518866188671886818869188701887118872188731887418875188761887718878188791888018881188821888318884188851888618887188881888918890188911889218893188941889518896188971889818899189001890118902189031890418905189061890718908189091891018911189121891318914189151891618917189181891918920189211892218923189241892518926189271892818929189301893118932189331893418935189361893718938189391894018941189421894318944189451894618947189481894918950189511895218953189541895518956189571895818959189601896118962189631896418965189661896718968189691897018971189721897318974189751897618977189781897918980189811898218983189841898518986189871898818989189901899118992189931899418995189961899718998189991900019001190021900319004190051900619007190081900919010190111901219013190141901519016190171901819019190201902119022190231902419025190261902719028190291903019031190321903319034190351903619037190381903919040190411904219043190441904519046190471904819049190501905119052190531905419055190561905719058190591906019061190621906319064190651906619067190681906919070190711907219073190741907519076190771907819079190801908119082190831908419085190861908719088190891909019091190921909319094190951909619097190981909919100191011910219103191041910519106191071910819109191101911119112191131911419115191161911719118191191912019121191221912319124191251912619127191281912919130191311913219133191341913519136191371913819139191401914119142191431914419145191461914719148191491915019151191521915319154191551915619157191581915919160191611916219163191641916519166191671916819169191701917119172191731917419175191761917719178191791918019181191821918319184191851918619187191881918919190191911919219193191941919519196191971919819199192001920119202192031920419205192061920719208192091921019211192121921319214192151921619217192181921919220192211922219223192241922519226192271922819229192301923119232192331923419235192361923719238192391924019241192421924319244192451924619247192481924919250192511925219253192541925519256192571925819259192601926119262192631926419265192661926719268192691927019271192721927319274192751927619277192781927919280192811928219283192841928519286192871928819289192901929119292192931929419295192961929719298192991930019301193021930319304193051930619307193081930919310193111931219313193141931519316193171931819319193201932119322193231932419325193261932719328193291933019331193321933319334193351933619337193381933919340193411934219343193441934519346193471934819349193501935119352193531935419355193561935719358193591936019361193621936319364193651936619367193681936919370193711937219373193741937519376193771937819379193801938119382193831938419385193861938719388193891939019391193921939319394193951939619397193981939919400194011940219403194041940519406194071940819409194101941119412194131941419415194161941719418194191942019421194221942319424194251942619427194281942919430194311943219433194341943519436194371943819439194401944119442194431944419445194461944719448194491945019451194521945319454194551945619457194581945919460194611946219463194641946519466194671946819469194701947119472194731947419475194761947719478194791948019481194821948319484194851948619487194881948919490194911949219493194941949519496194971949819499195001950119502195031950419505195061950719508195091951019511195121951319514195151951619517195181951919520195211952219523195241952519526195271952819529195301953119532195331953419535195361953719538195391954019541195421954319544195451954619547195481954919550195511955219553195541955519556195571955819559195601956119562195631956419565195661956719568195691957019571195721957319574195751957619577195781957919580195811958219583195841958519586195871958819589195901959119592195931959419595195961959719598195991960019601196021960319604196051960619607196081960919610196111961219613196141961519616196171961819619196201962119622196231962419625196261962719628196291963019631196321963319634196351963619637196381963919640196411964219643196441964519646196471964819649196501965119652196531965419655196561965719658196591966019661196621966319664196651966619667196681966919670196711967219673196741967519676196771967819679196801968119682196831968419685196861968719688196891969019691196921969319694196951969619697196981969919700197011970219703197041970519706197071970819709197101971119712197131971419715197161971719718197191972019721197221972319724197251972619727197281972919730197311973219733197341973519736197371973819739197401974119742197431974419745197461974719748197491975019751197521975319754197551975619757197581975919760197611976219763197641976519766197671976819769197701977119772197731977419775197761977719778197791978019781197821978319784197851978619787197881978919790197911979219793197941979519796197971979819799198001980119802198031980419805198061980719808198091981019811198121981319814198151981619817198181981919820198211982219823198241982519826198271982819829198301983119832198331983419835198361983719838198391984019841198421984319844198451984619847198481984919850198511985219853198541985519856198571985819859198601986119862198631986419865198661986719868198691987019871198721987319874198751987619877198781987919880198811988219883198841988519886198871988819889198901989119892198931989419895198961989719898198991990019901199021990319904199051990619907199081990919910199111991219913199141991519916199171991819919199201992119922199231992419925199261992719928199291993019931199321993319934199351993619937199381993919940199411994219943199441994519946199471994819949199501995119952199531995419955199561995719958199591996019961199621996319964199651996619967199681996919970199711997219973199741997519976199771997819979199801998119982199831998419985199861998719988199891999019991199921999319994199951999619997199981999920000200012000220003200042000520006200072000820009200102001120012200132001420015200162001720018200192002020021200222002320024200252002620027200282002920030200312003220033200342003520036200372003820039200402004120042200432004420045200462004720048200492005020051200522005320054200552005620057200582005920060200612006220063200642006520066200672006820069200702007120072200732007420075200762007720078200792008020081200822008320084200852008620087200882008920090200912009220093200942009520096200972009820099201002010120102201032010420105201062010720108201092011020111201122011320114201152011620117201182011920120201212012220123201242012520126201272012820129201302013120132201332013420135201362013720138201392014020141201422014320144201452014620147201482014920150201512015220153201542015520156201572015820159201602016120162201632016420165201662016720168201692017020171201722017320174201752017620177201782017920180201812018220183201842018520186201872018820189201902019120192201932019420195201962019720198201992020020201202022020320204202052020620207202082020920210202112021220213202142021520216202172021820219202202022120222202232022420225202262022720228202292023020231202322023320234202352023620237202382023920240202412024220243202442024520246202472024820249202502025120252202532025420255202562025720258202592026020261202622026320264202652026620267202682026920270202712027220273202742027520276202772027820279202802028120282202832028420285202862028720288202892029020291202922029320294202952029620297202982029920300203012030220303203042030520306203072030820309203102031120312203132031420315203162031720318203192032020321203222032320324203252032620327203282032920330203312033220333203342033520336203372033820339203402034120342203432034420345203462034720348203492035020351203522035320354203552035620357203582035920360203612036220363203642036520366203672036820369203702037120372203732037420375203762037720378203792038020381203822038320384203852038620387203882038920390203912039220393203942039520396203972039820399204002040120402204032040420405204062040720408204092041020411204122041320414204152041620417204182041920420204212042220423204242042520426204272042820429204302043120432204332043420435204362043720438204392044020441204422044320444204452044620447204482044920450204512045220453204542045520456204572045820459204602046120462204632046420465204662046720468204692047020471204722047320474204752047620477204782047920480204812048220483204842048520486204872048820489204902049120492204932049420495204962049720498204992050020501205022050320504205052050620507205082050920510205112051220513205142051520516205172051820519205202052120522205232052420525205262052720528205292053020531205322053320534205352053620537205382053920540205412054220543205442054520546205472054820549205502055120552205532055420555205562055720558205592056020561205622056320564205652056620567205682056920570205712057220573205742057520576205772057820579205802058120582205832058420585205862058720588205892059020591205922059320594205952059620597205982059920600206012060220603206042060520606206072060820609206102061120612206132061420615206162061720618206192062020621206222062320624206252062620627206282062920630206312063220633206342063520636206372063820639206402064120642206432064420645206462064720648206492065020651206522065320654206552065620657206582065920660206612066220663206642066520666206672066820669206702067120672206732067420675206762067720678206792068020681206822068320684206852068620687206882068920690206912069220693206942069520696206972069820699207002070120702207032070420705207062070720708207092071020711207122071320714207152071620717207182071920720207212072220723207242072520726207272072820729207302073120732207332073420735207362073720738207392074020741207422074320744207452074620747207482074920750207512075220753207542075520756207572075820759207602076120762207632076420765207662076720768207692077020771207722077320774207752077620777207782077920780207812078220783207842078520786207872078820789207902079120792207932079420795207962079720798207992080020801208022080320804208052080620807208082080920810208112081220813208142081520816208172081820819208202082120822208232082420825208262082720828208292083020831208322083320834208352083620837208382083920840208412084220843208442084520846208472084820849208502085120852208532085420855208562085720858208592086020861208622086320864208652086620867208682086920870208712087220873208742087520876208772087820879208802088120882208832088420885208862088720888208892089020891208922089320894208952089620897208982089920900209012090220903209042090520906209072090820909209102091120912209132091420915209162091720918209192092020921209222092320924209252092620927209282092920930209312093220933209342093520936209372093820939209402094120942209432094420945209462094720948209492095020951209522095320954209552095620957209582095920960209612096220963209642096520966209672096820969209702097120972209732097420975209762097720978209792098020981209822098320984209852098620987209882098920990209912099220993209942099520996209972099820999210002100121002210032100421005210062100721008210092101021011210122101321014210152101621017210182101921020210212102221023210242102521026210272102821029210302103121032210332103421035210362103721038210392104021041210422104321044210452104621047210482104921050210512105221053210542105521056210572105821059210602106121062210632106421065210662106721068210692107021071210722107321074210752107621077210782107921080210812108221083210842108521086210872108821089210902109121092210932109421095210962109721098210992110021101211022110321104211052110621107211082110921110211112111221113211142111521116211172111821119211202112121122211232112421125211262112721128211292113021131211322113321134211352113621137211382113921140211412114221143211442114521146211472114821149211502115121152211532115421155211562115721158211592116021161211622116321164211652116621167211682116921170211712117221173211742117521176211772117821179211802118121182211832118421185211862118721188211892119021191211922119321194211952119621197211982119921200212012120221203212042120521206212072120821209212102121121212212132121421215212162121721218212192122021221212222122321224212252122621227212282122921230212312123221233212342123521236212372123821239212402124121242212432124421245212462124721248212492125021251212522125321254212552125621257212582125921260212612126221263212642126521266212672126821269212702127121272212732127421275212762127721278212792128021281212822128321284212852128621287212882128921290212912129221293212942129521296212972129821299213002130121302213032130421305213062130721308213092131021311213122131321314213152131621317213182131921320213212132221323213242132521326213272132821329213302133121332213332133421335213362133721338213392134021341213422134321344213452134621347213482134921350213512135221353213542135521356213572135821359213602136121362213632136421365213662136721368213692137021371213722137321374213752137621377213782137921380213812138221383213842138521386213872138821389213902139121392213932139421395213962139721398213992140021401214022140321404214052140621407214082140921410214112141221413214142141521416214172141821419214202142121422214232142421425214262142721428214292143021431214322143321434214352143621437214382143921440214412144221443214442144521446214472144821449214502145121452214532145421455214562145721458214592146021461214622146321464214652146621467214682146921470214712147221473214742147521476214772147821479214802148121482214832148421485214862148721488214892149021491214922149321494214952149621497214982149921500215012150221503215042150521506215072150821509215102151121512215132151421515215162151721518215192152021521215222152321524215252152621527215282152921530215312153221533215342153521536215372153821539215402154121542215432154421545215462154721548215492155021551215522155321554215552155621557215582155921560215612156221563215642156521566215672156821569215702157121572215732157421575215762157721578215792158021581215822158321584215852158621587215882158921590215912159221593215942159521596215972159821599216002160121602216032160421605216062160721608216092161021611216122161321614216152161621617216182161921620216212162221623216242162521626216272162821629216302163121632216332163421635216362163721638216392164021641216422164321644216452164621647216482164921650216512165221653216542165521656216572165821659216602166121662216632166421665216662166721668216692167021671216722167321674216752167621677216782167921680216812168221683216842168521686216872168821689216902169121692216932169421695216962169721698216992170021701217022170321704217052170621707217082170921710217112171221713217142171521716217172171821719217202172121722217232172421725217262172721728217292173021731217322173321734217352173621737217382173921740217412174221743217442174521746217472174821749217502175121752217532175421755217562175721758217592176021761217622176321764217652176621767217682176921770217712177221773217742177521776217772177821779217802178121782217832178421785217862178721788217892179021791217922179321794217952179621797217982179921800218012180221803218042180521806218072180821809218102181121812218132181421815218162181721818218192182021821218222182321824218252182621827218282182921830218312183221833218342183521836218372183821839218402184121842218432184421845218462184721848218492185021851218522185321854218552185621857218582185921860218612186221863218642186521866218672186821869218702187121872218732187421875218762187721878218792188021881218822188321884218852188621887218882188921890218912189221893218942189521896218972189821899219002190121902219032190421905219062190721908219092191021911219122191321914219152191621917219182191921920219212192221923219242192521926219272192821929219302193121932219332193421935219362193721938219392194021941219422194321944219452194621947219482194921950219512195221953219542195521956219572195821959219602196121962219632196421965219662196721968219692197021971219722197321974219752197621977219782197921980219812198221983219842198521986219872198821989219902199121992219932199421995219962199721998219992200022001220022200322004220052200622007220082200922010220112201222013220142201522016220172201822019220202202122022220232202422025220262202722028220292203022031220322203322034220352203622037220382203922040220412204222043220442204522046220472204822049220502205122052220532205422055220562205722058220592206022061220622206322064220652206622067220682206922070220712207222073220742207522076220772207822079220802208122082220832208422085220862208722088220892209022091220922209322094220952209622097220982209922100221012210222103221042210522106221072210822109221102211122112221132211422115221162211722118221192212022121221222212322124221252212622127221282212922130221312213222133221342213522136221372213822139221402214122142221432214422145221462214722148221492215022151221522215322154221552215622157221582215922160221612216222163221642216522166221672216822169221702217122172221732217422175221762217722178221792218022181221822218322184221852218622187221882218922190221912219222193221942219522196221972219822199222002220122202222032220422205222062220722208222092221022211222122221322214222152221622217222182221922220222212222222223222242222522226222272222822229222302223122232222332223422235222362223722238222392224022241222422224322244222452224622247222482224922250222512225222253222542225522256222572225822259222602226122262222632226422265222662226722268222692227022271222722227322274222752227622277222782227922280222812228222283222842228522286222872228822289222902229122292222932229422295222962229722298222992230022301223022230322304223052230622307223082230922310223112231222313223142231522316223172231822319223202232122322223232232422325223262232722328223292233022331223322233322334223352233622337223382233922340223412234222343223442234522346223472234822349223502235122352223532235422355223562235722358223592236022361223622236322364223652236622367223682236922370223712237222373223742237522376223772237822379223802238122382223832238422385223862238722388223892239022391223922239322394223952239622397223982239922400224012240222403224042240522406224072240822409224102241122412224132241422415224162241722418224192242022421224222242322424224252242622427224282242922430224312243222433224342243522436224372243822439224402244122442224432244422445224462244722448224492245022451224522245322454224552245622457224582245922460224612246222463224642246522466224672246822469224702247122472224732247422475224762247722478224792248022481224822248322484224852248622487224882248922490224912249222493224942249522496224972249822499225002250122502225032250422505225062250722508225092251022511225122251322514225152251622517225182251922520225212252222523225242252522526225272252822529225302253122532225332253422535225362253722538225392254022541225422254322544225452254622547225482254922550225512255222553225542255522556225572255822559225602256122562225632256422565225662256722568225692257022571225722257322574225752257622577225782257922580225812258222583225842258522586225872258822589225902259122592225932259422595225962259722598225992260022601226022260322604226052260622607226082260922610226112261222613226142261522616226172261822619226202262122622226232262422625226262262722628226292263022631226322263322634226352263622637226382263922640226412264222643226442264522646226472264822649226502265122652226532265422655226562265722658226592266022661226622266322664226652266622667226682266922670226712267222673226742267522676226772267822679226802268122682226832268422685226862268722688226892269022691226922269322694226952269622697226982269922700227012270222703227042270522706227072270822709227102271122712227132271422715227162271722718227192272022721227222272322724227252272622727227282272922730227312273222733227342273522736227372273822739227402274122742227432274422745227462274722748227492275022751227522275322754227552275622757227582275922760227612276222763227642276522766227672276822769227702277122772227732277422775227762277722778227792278022781227822278322784227852278622787227882278922790227912279222793227942279522796227972279822799228002280122802228032280422805228062280722808228092281022811228122281322814228152281622817228182281922820228212282222823228242282522826228272282822829228302283122832228332283422835228362283722838228392284022841228422284322844228452284622847228482284922850228512285222853228542285522856228572285822859228602286122862228632286422865228662286722868228692287022871228722287322874228752287622877228782287922880228812288222883228842288522886228872288822889228902289122892228932289422895228962289722898228992290022901229022290322904229052290622907229082290922910229112291222913229142291522916229172291822919229202292122922229232292422925229262292722928229292293022931229322293322934229352293622937229382293922940229412294222943229442294522946229472294822949229502295122952229532295422955229562295722958229592296022961229622296322964229652296622967229682296922970229712297222973229742297522976229772297822979229802298122982229832298422985229862298722988229892299022991229922299322994229952299622997229982299923000230012300223003230042300523006230072300823009230102301123012230132301423015230162301723018230192302023021230222302323024230252302623027230282302923030230312303223033230342303523036230372303823039230402304123042230432304423045230462304723048230492305023051230522305323054230552305623057230582305923060230612306223063230642306523066230672306823069230702307123072230732307423075230762307723078230792308023081230822308323084230852308623087230882308923090230912309223093230942309523096230972309823099231002310123102231032310423105231062310723108231092311023111231122311323114231152311623117231182311923120231212312223123231242312523126231272312823129231302313123132231332313423135231362313723138231392314023141231422314323144231452314623147231482314923150231512315223153231542315523156231572315823159231602316123162231632316423165231662316723168231692317023171231722317323174231752317623177231782317923180231812318223183231842318523186231872318823189231902319123192231932319423195231962319723198231992320023201232022320323204232052320623207232082320923210232112321223213232142321523216232172321823219232202322123222232232322423225232262322723228232292323023231232322323323234232352323623237232382323923240232412324223243232442324523246232472324823249232502325123252232532325423255232562325723258232592326023261232622326323264232652326623267232682326923270232712327223273232742327523276232772327823279232802328123282232832328423285232862328723288232892329023291232922329323294232952329623297232982329923300233012330223303233042330523306233072330823309233102331123312233132331423315233162331723318233192332023321233222332323324233252332623327233282332923330233312333223333233342333523336233372333823339233402334123342233432334423345233462334723348233492335023351233522335323354233552335623357233582335923360233612336223363233642336523366233672336823369233702337123372233732337423375233762337723378233792338023381233822338323384233852338623387233882338923390233912339223393233942339523396233972339823399234002340123402234032340423405234062340723408234092341023411234122341323414234152341623417234182341923420234212342223423234242342523426234272342823429234302343123432234332343423435234362343723438234392344023441234422344323444234452344623447234482344923450234512345223453234542345523456234572345823459234602346123462234632346423465234662346723468234692347023471234722347323474234752347623477234782347923480234812348223483234842348523486234872348823489234902349123492234932349423495234962349723498234992350023501235022350323504235052350623507235082350923510235112351223513235142351523516235172351823519235202352123522235232352423525235262352723528235292353023531235322353323534235352353623537235382353923540235412354223543235442354523546235472354823549235502355123552235532355423555235562355723558235592356023561235622356323564235652356623567235682356923570235712357223573235742357523576235772357823579235802358123582235832358423585235862358723588235892359023591235922359323594235952359623597235982359923600236012360223603236042360523606236072360823609236102361123612236132361423615236162361723618236192362023621236222362323624236252362623627236282362923630236312363223633236342363523636236372363823639236402364123642236432364423645236462364723648236492365023651236522365323654236552365623657236582365923660236612366223663236642366523666236672366823669236702367123672236732367423675236762367723678236792368023681236822368323684236852368623687236882368923690236912369223693236942369523696236972369823699237002370123702237032370423705237062370723708237092371023711237122371323714237152371623717237182371923720237212372223723237242372523726237272372823729237302373123732237332373423735237362373723738237392374023741237422374323744237452374623747237482374923750237512375223753237542375523756237572375823759237602376123762237632376423765237662376723768237692377023771237722377323774237752377623777237782377923780237812378223783237842378523786237872378823789237902379123792237932379423795237962379723798237992380023801238022380323804238052380623807238082380923810238112381223813238142381523816238172381823819238202382123822238232382423825238262382723828238292383023831238322383323834238352383623837238382383923840238412384223843238442384523846238472384823849238502385123852238532385423855238562385723858238592386023861238622386323864238652386623867238682386923870238712387223873238742387523876238772387823879238802388123882238832388423885238862388723888238892389023891238922389323894238952389623897238982389923900239012390223903239042390523906239072390823909239102391123912239132391423915239162391723918239192392023921239222392323924239252392623927239282392923930239312393223933239342393523936239372393823939239402394123942239432394423945239462394723948239492395023951239522395323954239552395623957239582395923960239612396223963239642396523966239672396823969239702397123972239732397423975239762397723978239792398023981239822398323984239852398623987239882398923990239912399223993239942399523996239972399823999240002400124002240032400424005240062400724008240092401024011240122401324014240152401624017240182401924020240212402224023240242402524026240272402824029240302403124032240332403424035240362403724038240392404024041240422404324044240452404624047240482404924050240512405224053240542405524056240572405824059240602406124062240632406424065240662406724068240692407024071240722407324074240752407624077240782407924080240812408224083240842408524086240872408824089240902409124092240932409424095240962409724098240992410024101241022410324104241052410624107241082410924110241112411224113241142411524116241172411824119241202412124122241232412424125241262412724128241292413024131241322413324134241352413624137241382413924140241412414224143241442414524146241472414824149241502415124152241532415424155241562415724158241592416024161241622416324164241652416624167241682416924170241712417224173241742417524176241772417824179241802418124182241832418424185241862418724188241892419024191241922419324194241952419624197241982419924200242012420224203242042420524206242072420824209242102421124212242132421424215242162421724218242192422024221242222422324224242252422624227242282422924230242312423224233242342423524236242372423824239242402424124242242432424424245242462424724248242492425024251242522425324254242552425624257242582425924260242612426224263242642426524266242672426824269242702427124272242732427424275242762427724278242792428024281242822428324284242852428624287242882428924290242912429224293242942429524296242972429824299243002430124302243032430424305243062430724308243092431024311243122431324314243152431624317243182431924320243212432224323243242432524326243272432824329243302433124332243332433424335243362433724338243392434024341243422434324344243452434624347243482434924350243512435224353243542435524356243572435824359243602436124362243632436424365243662436724368243692437024371243722437324374243752437624377243782437924380243812438224383243842438524386243872438824389243902439124392243932439424395243962439724398243992440024401244022440324404244052440624407244082440924410244112441224413244142441524416244172441824419244202442124422244232442424425244262442724428244292443024431244322443324434244352443624437244382443924440244412444224443244442444524446244472444824449244502445124452244532445424455244562445724458244592446024461244622446324464244652446624467244682446924470244712447224473244742447524476244772447824479244802448124482244832448424485244862448724488244892449024491244922449324494244952449624497244982449924500245012450224503245042450524506245072450824509245102451124512245132451424515245162451724518245192452024521245222452324524245252452624527245282452924530245312453224533245342453524536245372453824539245402454124542245432454424545245462454724548245492455024551245522455324554245552455624557245582455924560245612456224563245642456524566245672456824569245702457124572245732457424575245762457724578245792458024581245822458324584245852458624587245882458924590245912459224593245942459524596245972459824599246002460124602246032460424605246062460724608246092461024611246122461324614246152461624617246182461924620246212462224623246242462524626246272462824629246302463124632246332463424635246362463724638246392464024641246422464324644246452464624647246482464924650246512465224653246542465524656246572465824659246602466124662246632466424665246662466724668246692467024671246722467324674246752467624677246782467924680246812468224683246842468524686246872468824689246902469124692246932469424695246962469724698246992470024701247022470324704247052470624707247082470924710247112471224713247142471524716247172471824719247202472124722247232472424725247262472724728247292473024731247322473324734247352473624737247382473924740247412474224743247442474524746247472474824749247502475124752247532475424755247562475724758247592476024761247622476324764247652476624767247682476924770247712477224773247742477524776247772477824779247802478124782247832478424785247862478724788247892479024791247922479324794247952479624797247982479924800248012480224803248042480524806248072480824809248102481124812248132481424815248162481724818248192482024821248222482324824248252482624827248282482924830248312483224833248342483524836248372483824839248402484124842248432484424845248462484724848248492485024851248522485324854248552485624857248582485924860248612486224863248642486524866248672486824869248702487124872248732487424875248762487724878248792488024881248822488324884248852488624887248882488924890248912489224893248942489524896248972489824899249002490124902249032490424905249062490724908249092491024911249122491324914249152491624917249182491924920249212492224923249242492524926249272492824929249302493124932249332493424935249362493724938249392494024941249422494324944249452494624947249482494924950249512495224953249542495524956249572495824959249602496124962249632496424965249662496724968249692497024971249722497324974249752497624977249782497924980249812498224983249842498524986249872498824989249902499124992249932499424995249962499724998249992500025001250022500325004250052500625007250082500925010250112501225013250142501525016250172501825019250202502125022250232502425025250262502725028250292503025031250322503325034250352503625037250382503925040250412504225043250442504525046250472504825049250502505125052250532505425055250562505725058250592506025061250622506325064250652506625067250682506925070250712507225073250742507525076250772507825079250802508125082250832508425085250862508725088250892509025091250922509325094250952509625097250982509925100251012510225103251042510525106251072510825109251102511125112251132511425115251162511725118251192512025121251222512325124251252512625127251282512925130251312513225133251342513525136251372513825139251402514125142251432514425145251462514725148251492515025151251522515325154251552515625157251582515925160251612516225163251642516525166251672516825169251702517125172251732517425175251762517725178251792518025181251822518325184251852518625187251882518925190251912519225193251942519525196251972519825199252002520125202252032520425205252062520725208252092521025211252122521325214252152521625217252182521925220252212522225223252242522525226252272522825229252302523125232252332523425235252362523725238252392524025241252422524325244252452524625247252482524925250252512525225253252542525525256252572525825259252602526125262252632526425265252662526725268252692527025271252722527325274252752527625277252782527925280252812528225283252842528525286252872528825289252902529125292252932529425295252962529725298252992530025301253022530325304253052530625307253082530925310253112531225313253142531525316253172531825319253202532125322253232532425325253262532725328253292533025331253322533325334253352533625337253382533925340253412534225343253442534525346253472534825349253502535125352253532535425355253562535725358253592536025361253622536325364253652536625367253682536925370253712537225373253742537525376253772537825379253802538125382253832538425385253862538725388253892539025391253922539325394253952539625397253982539925400254012540225403254042540525406254072540825409254102541125412254132541425415254162541725418254192542025421254222542325424254252542625427254282542925430254312543225433254342543525436254372543825439254402544125442254432544425445254462544725448254492545025451254522545325454254552545625457254582545925460254612546225463254642546525466254672546825469254702547125472254732547425475254762547725478254792548025481254822548325484254852548625487254882548925490254912549225493254942549525496254972549825499255002550125502255032550425505255062550725508255092551025511255122551325514255152551625517255182551925520255212552225523255242552525526255272552825529255302553125532255332553425535255362553725538255392554025541255422554325544255452554625547255482554925550255512555225553255542555525556255572555825559255602556125562255632556425565255662556725568255692557025571255722557325574255752557625577255782557925580255812558225583255842558525586255872558825589255902559125592255932559425595255962559725598255992560025601256022560325604256052560625607256082560925610256112561225613256142561525616256172561825619256202562125622256232562425625256262562725628256292563025631256322563325634256352563625637256382563925640256412564225643256442564525646256472564825649256502565125652256532565425655256562565725658256592566025661256622566325664256652566625667256682566925670256712567225673256742567525676256772567825679256802568125682256832568425685256862568725688256892569025691256922569325694256952569625697256982569925700257012570225703257042570525706257072570825709257102571125712257132571425715257162571725718257192572025721257222572325724257252572625727257282572925730257312573225733257342573525736257372573825739257402574125742257432574425745257462574725748257492575025751257522575325754257552575625757257582575925760257612576225763257642576525766257672576825769257702577125772257732577425775257762577725778257792578025781257822578325784257852578625787257882578925790257912579225793257942579525796257972579825799258002580125802258032580425805258062580725808258092581025811258122581325814258152581625817258182581925820258212582225823258242582525826258272582825829258302583125832258332583425835258362583725838258392584025841258422584325844258452584625847258482584925850258512585225853258542585525856258572585825859258602586125862258632586425865258662586725868258692587025871258722587325874258752587625877258782587925880258812588225883258842588525886258872588825889258902589125892258932589425895258962589725898258992590025901259022590325904259052590625907259082590925910259112591225913259142591525916259172591825919259202592125922259232592425925259262592725928259292593025931259322593325934259352593625937259382593925940259412594225943259442594525946259472594825949259502595125952259532595425955259562595725958259592596025961259622596325964259652596625967259682596925970259712597225973259742597525976259772597825979259802598125982259832598425985259862598725988259892599025991259922599325994259952599625997259982599926000260012600226003260042600526006260072600826009260102601126012260132601426015260162601726018260192602026021260222602326024260252602626027260282602926030260312603226033260342603526036260372603826039260402604126042260432604426045260462604726048260492605026051260522605326054260552605626057260582605926060260612606226063260642606526066260672606826069260702607126072260732607426075260762607726078260792608026081260822608326084260852608626087260882608926090260912609226093260942609526096260972609826099261002610126102261032610426105261062610726108261092611026111261122611326114261152611626117261182611926120261212612226123261242612526126261272612826129261302613126132261332613426135261362613726138261392614026141261422614326144261452614626147261482614926150261512615226153261542615526156261572615826159261602616126162261632616426165261662616726168261692617026171261722617326174261752617626177261782617926180261812618226183261842618526186261872618826189261902619126192261932619426195261962619726198261992620026201262022620326204262052620626207262082620926210262112621226213262142621526216262172621826219262202622126222262232622426225262262622726228262292623026231262322623326234262352623626237262382623926240262412624226243262442624526246262472624826249262502625126252262532625426255262562625726258262592626026261262622626326264262652626626267262682626926270262712627226273262742627526276262772627826279262802628126282262832628426285262862628726288262892629026291262922629326294262952629626297262982629926300263012630226303263042630526306263072630826309263102631126312263132631426315263162631726318263192632026321263222632326324263252632626327263282632926330263312633226333263342633526336263372633826339263402634126342263432634426345263462634726348263492635026351263522635326354263552635626357263582635926360263612636226363263642636526366263672636826369263702637126372263732637426375263762637726378263792638026381263822638326384263852638626387263882638926390263912639226393263942639526396263972639826399264002640126402264032640426405264062640726408264092641026411264122641326414264152641626417264182641926420264212642226423264242642526426264272642826429264302643126432264332643426435264362643726438264392644026441264422644326444264452644626447264482644926450264512645226453264542645526456264572645826459264602646126462264632646426465264662646726468264692647026471264722647326474264752647626477264782647926480264812648226483264842648526486264872648826489264902649126492264932649426495264962649726498264992650026501265022650326504265052650626507265082650926510265112651226513265142651526516265172651826519265202652126522265232652426525265262652726528265292653026531265322653326534265352653626537265382653926540265412654226543265442654526546265472654826549265502655126552265532655426555265562655726558265592656026561265622656326564265652656626567265682656926570265712657226573265742657526576265772657826579265802658126582265832658426585265862658726588265892659026591265922659326594265952659626597265982659926600266012660226603266042660526606266072660826609266102661126612266132661426615266162661726618266192662026621266222662326624266252662626627266282662926630266312663226633266342663526636266372663826639266402664126642266432664426645266462664726648266492665026651266522665326654266552665626657266582665926660266612666226663266642666526666266672666826669266702667126672266732667426675266762667726678266792668026681266822668326684266852668626687266882668926690266912669226693266942669526696266972669826699267002670126702267032670426705267062670726708267092671026711267122671326714267152671626717267182671926720267212672226723267242672526726267272672826729267302673126732267332673426735267362673726738267392674026741267422674326744267452674626747267482674926750267512675226753267542675526756267572675826759267602676126762267632676426765267662676726768267692677026771267722677326774267752677626777267782677926780267812678226783267842678526786267872678826789267902679126792267932679426795267962679726798267992680026801268022680326804268052680626807268082680926810268112681226813268142681526816268172681826819268202682126822268232682426825268262682726828268292683026831268322683326834268352683626837268382683926840268412684226843268442684526846268472684826849268502685126852268532685426855268562685726858268592686026861268622686326864268652686626867268682686926870268712687226873268742687526876268772687826879268802688126882268832688426885268862688726888268892689026891268922689326894268952689626897268982689926900269012690226903269042690526906269072690826909269102691126912269132691426915269162691726918269192692026921269222692326924269252692626927269282692926930269312693226933269342693526936269372693826939269402694126942269432694426945269462694726948269492695026951269522695326954269552695626957269582695926960269612696226963269642696526966269672696826969269702697126972269732697426975269762697726978269792698026981269822698326984269852698626987269882698926990269912699226993269942699526996269972699826999270002700127002270032700427005270062700727008270092701027011270122701327014270152701627017270182701927020270212702227023270242702527026270272702827029270302703127032270332703427035270362703727038270392704027041270422704327044270452704627047270482704927050270512705227053270542705527056270572705827059270602706127062270632706427065270662706727068270692707027071270722707327074270752707627077270782707927080270812708227083270842708527086270872708827089270902709127092270932709427095270962709727098270992710027101271022710327104271052710627107271082710927110271112711227113271142711527116271172711827119271202712127122271232712427125271262712727128271292713027131271322713327134271352713627137271382713927140271412714227143271442714527146271472714827149271502715127152271532715427155271562715727158271592716027161271622716327164271652716627167271682716927170271712717227173271742717527176271772717827179271802718127182271832718427185271862718727188271892719027191271922719327194271952719627197271982719927200272012720227203272042720527206272072720827209272102721127212272132721427215272162721727218272192722027221272222722327224272252722627227272282722927230272312723227233272342723527236272372723827239272402724127242272432724427245272462724727248272492725027251272522725327254272552725627257272582725927260272612726227263272642726527266272672726827269272702727127272272732727427275272762727727278272792728027281272822728327284272852728627287272882728927290272912729227293272942729527296272972729827299273002730127302273032730427305273062730727308273092731027311273122731327314273152731627317273182731927320273212732227323273242732527326273272732827329273302733127332273332733427335273362733727338273392734027341273422734327344273452734627347273482734927350273512735227353273542735527356273572735827359273602736127362273632736427365273662736727368273692737027371273722737327374273752737627377273782737927380273812738227383273842738527386273872738827389273902739127392273932739427395273962739727398273992740027401274022740327404274052740627407274082740927410274112741227413274142741527416274172741827419274202742127422274232742427425274262742727428274292743027431274322743327434274352743627437274382743927440274412744227443274442744527446274472744827449274502745127452274532745427455274562745727458274592746027461274622746327464274652746627467274682746927470274712747227473274742747527476274772747827479274802748127482274832748427485274862748727488274892749027491274922749327494274952749627497274982749927500275012750227503275042750527506275072750827509275102751127512275132751427515275162751727518275192752027521275222752327524275252752627527275282752927530275312753227533275342753527536275372753827539275402754127542275432754427545275462754727548275492755027551275522755327554275552755627557275582755927560275612756227563275642756527566275672756827569275702757127572275732757427575275762757727578275792758027581275822758327584275852758627587275882758927590275912759227593275942759527596275972759827599276002760127602276032760427605276062760727608276092761027611276122761327614276152761627617276182761927620276212762227623276242762527626276272762827629276302763127632276332763427635276362763727638276392764027641276422764327644276452764627647276482764927650276512765227653276542765527656276572765827659276602766127662276632766427665276662766727668276692767027671276722767327674276752767627677276782767927680276812768227683276842768527686276872768827689276902769127692276932769427695276962769727698276992770027701277022770327704277052770627707277082770927710277112771227713277142771527716277172771827719277202772127722277232772427725277262772727728277292773027731277322773327734277352773627737277382773927740277412774227743277442774527746277472774827749277502775127752277532775427755277562775727758277592776027761277622776327764277652776627767277682776927770277712777227773277742777527776277772777827779277802778127782277832778427785277862778727788277892779027791277922779327794277952779627797277982779927800278012780227803278042780527806278072780827809278102781127812278132781427815278162781727818278192782027821278222782327824278252782627827278282782927830278312783227833278342783527836278372783827839278402784127842278432784427845278462784727848278492785027851278522785327854278552785627857278582785927860278612786227863278642786527866278672786827869278702787127872278732787427875278762787727878278792788027881278822788327884278852788627887278882788927890278912789227893278942789527896278972789827899279002790127902279032790427905279062790727908279092791027911279122791327914279152791627917279182791927920279212792227923279242792527926279272792827929279302793127932279332793427935279362793727938279392794027941279422794327944279452794627947279482794927950279512795227953279542795527956279572795827959279602796127962279632796427965279662796727968279692797027971279722797327974279752797627977279782797927980279812798227983279842798527986279872798827989279902799127992279932799427995279962799727998279992800028001280022800328004280052800628007280082800928010280112801228013280142801528016280172801828019280202802128022280232802428025280262802728028280292803028031280322803328034280352803628037280382803928040280412804228043280442804528046280472804828049280502805128052280532805428055280562805728058280592806028061280622806328064280652806628067280682806928070280712807228073280742807528076280772807828079280802808128082280832808428085280862808728088280892809028091280922809328094280952809628097280982809928100281012810228103281042810528106281072810828109281102811128112281132811428115281162811728118281192812028121281222812328124281252812628127281282812928130281312813228133281342813528136281372813828139281402814128142281432814428145281462814728148281492815028151281522815328154281552815628157281582815928160281612816228163281642816528166281672816828169281702817128172281732817428175281762817728178281792818028181281822818328184281852818628187281882818928190281912819228193281942819528196281972819828199282002820128202282032820428205282062820728208282092821028211282122821328214282152821628217282182821928220282212822228223282242822528226282272822828229282302823128232282332823428235282362823728238282392824028241282422824328244282452824628247282482824928250282512825228253282542825528256282572825828259282602826128262282632826428265282662826728268282692827028271282722827328274282752827628277282782827928280282812828228283282842828528286282872828828289282902829128292282932829428295282962829728298282992830028301283022830328304283052830628307283082830928310283112831228313283142831528316283172831828319283202832128322283232832428325283262832728328283292833028331283322833328334283352833628337283382833928340283412834228343283442834528346283472834828349283502835128352283532835428355283562835728358283592836028361283622836328364283652836628367283682836928370283712837228373283742837528376283772837828379283802838128382283832838428385283862838728388283892839028391283922839328394283952839628397283982839928400284012840228403284042840528406284072840828409284102841128412284132841428415284162841728418284192842028421284222842328424284252842628427284282842928430284312843228433284342843528436284372843828439284402844128442284432844428445284462844728448284492845028451284522845328454284552845628457284582845928460284612846228463284642846528466284672846828469284702847128472284732847428475284762847728478284792848028481284822848328484284852848628487284882848928490284912849228493284942849528496284972849828499285002850128502285032850428505285062850728508285092851028511285122851328514285152851628517285182851928520285212852228523285242852528526285272852828529285302853128532285332853428535285362853728538285392854028541285422854328544285452854628547285482854928550285512855228553285542855528556285572855828559285602856128562285632856428565285662856728568285692857028571285722857328574285752857628577285782857928580285812858228583285842858528586285872858828589285902859128592285932859428595285962859728598285992860028601286022860328604286052860628607286082860928610286112861228613286142861528616286172861828619286202862128622286232862428625286262862728628286292863028631286322863328634286352863628637286382863928640286412864228643286442864528646286472864828649286502865128652286532865428655286562865728658286592866028661286622866328664286652866628667286682866928670286712867228673286742867528676286772867828679286802868128682286832868428685286862868728688286892869028691286922869328694286952869628697286982869928700287012870228703287042870528706287072870828709287102871128712287132871428715287162871728718287192872028721287222872328724287252872628727287282872928730287312873228733287342873528736287372873828739287402874128742287432874428745287462874728748287492875028751287522875328754287552875628757287582875928760287612876228763287642876528766287672876828769287702877128772287732877428775287762877728778287792878028781287822878328784287852878628787287882878928790287912879228793287942879528796287972879828799288002880128802288032880428805288062880728808288092881028811288122881328814288152881628817288182881928820288212882228823288242882528826288272882828829288302883128832288332883428835288362883728838288392884028841288422884328844288452884628847288482884928850288512885228853288542885528856288572885828859288602886128862288632886428865288662886728868288692887028871288722887328874288752887628877288782887928880288812888228883288842888528886288872888828889288902889128892288932889428895288962889728898288992890028901289022890328904289052890628907289082890928910289112891228913289142891528916289172891828919289202892128922289232892428925289262892728928289292893028931289322893328934289352893628937289382893928940289412894228943289442894528946289472894828949289502895128952289532895428955289562895728958289592896028961289622896328964289652896628967289682896928970289712897228973289742897528976289772897828979289802898128982289832898428985289862898728988289892899028991289922899328994289952899628997289982899929000290012900229003290042900529006290072900829009290102901129012290132901429015290162901729018290192902029021290222902329024290252902629027290282902929030290312903229033290342903529036290372903829039290402904129042290432904429045290462904729048290492905029051290522905329054290552905629057290582905929060290612906229063290642906529066290672906829069290702907129072290732907429075290762907729078290792908029081290822908329084290852908629087290882908929090290912909229093290942909529096290972909829099291002910129102291032910429105291062910729108291092911029111291122911329114291152911629117291182911929120291212912229123291242912529126291272912829129291302913129132291332913429135291362913729138291392914029141291422914329144291452914629147291482914929150291512915229153291542915529156291572915829159291602916129162291632916429165291662916729168291692917029171291722917329174291752917629177291782917929180291812918229183291842918529186291872918829189291902919129192291932919429195291962919729198291992920029201292022920329204292052920629207292082920929210292112921229213292142921529216292172921829219292202922129222292232922429225292262922729228292292923029231292322923329234292352923629237292382923929240292412924229243292442924529246292472924829249292502925129252292532925429255292562925729258292592926029261292622926329264292652926629267292682926929270292712927229273292742927529276292772927829279292802928129282292832928429285292862928729288292892929029291292922929329294292952929629297292982929929300293012930229303293042930529306293072930829309293102931129312293132931429315293162931729318293192932029321293222932329324293252932629327293282932929330293312933229333293342933529336293372933829339293402934129342293432934429345293462934729348293492935029351293522935329354293552935629357293582935929360293612936229363293642936529366293672936829369293702937129372293732937429375293762937729378293792938029381293822938329384293852938629387293882938929390293912939229393293942939529396293972939829399294002940129402294032940429405294062940729408294092941029411294122941329414294152941629417294182941929420294212942229423294242942529426294272942829429294302943129432294332943429435294362943729438294392944029441294422944329444294452944629447294482944929450294512945229453294542945529456294572945829459294602946129462294632946429465294662946729468294692947029471294722947329474294752947629477294782947929480294812948229483294842948529486294872948829489294902949129492294932949429495294962949729498294992950029501295022950329504295052950629507295082950929510295112951229513295142951529516295172951829519295202952129522295232952429525295262952729528295292953029531295322953329534295352953629537295382953929540295412954229543295442954529546295472954829549295502955129552295532955429555295562955729558295592956029561295622956329564295652956629567295682956929570295712957229573295742957529576295772957829579295802958129582295832958429585295862958729588295892959029591295922959329594295952959629597295982959929600296012960229603296042960529606296072960829609296102961129612296132961429615296162961729618296192962029621296222962329624296252962629627296282962929630296312963229633296342963529636296372963829639296402964129642296432964429645296462964729648296492965029651296522965329654296552965629657296582965929660296612966229663296642966529666296672966829669296702967129672296732967429675296762967729678296792968029681296822968329684296852968629687296882968929690296912969229693296942969529696296972969829699297002970129702297032970429705297062970729708297092971029711297122971329714297152971629717297182971929720297212972229723297242972529726297272972829729297302973129732297332973429735297362973729738297392974029741297422974329744297452974629747297482974929750297512975229753297542975529756297572975829759297602976129762297632976429765297662976729768297692977029771297722977329774297752977629777297782977929780297812978229783297842978529786297872978829789297902979129792297932979429795297962979729798297992980029801298022980329804298052980629807298082980929810298112981229813298142981529816298172981829819298202982129822298232982429825298262982729828298292983029831298322983329834298352983629837298382983929840298412984229843298442984529846298472984829849298502985129852298532985429855298562985729858298592986029861298622986329864298652986629867298682986929870298712987229873298742987529876298772987829879298802988129882298832988429885298862988729888298892989029891298922989329894298952989629897298982989929900299012990229903299042990529906299072990829909299102991129912299132991429915299162991729918299192992029921299222992329924299252992629927299282992929930299312993229933299342993529936299372993829939299402994129942299432994429945299462994729948299492995029951299522995329954299552995629957299582995929960299612996229963299642996529966299672996829969299702997129972299732997429975299762997729978299792998029981299822998329984299852998629987299882998929990299912999229993299942999529996299972999829999300003000130002300033000430005300063000730008300093001030011300123001330014300153001630017300183001930020300213002230023300243002530026300273002830029300303003130032300333003430035300363003730038300393004030041300423004330044300453004630047300483004930050300513005230053300543005530056300573005830059300603006130062300633006430065300663006730068300693007030071300723007330074300753007630077300783007930080300813008230083300843008530086300873008830089300903009130092300933009430095300963009730098300993010030101301023010330104301053010630107301083010930110301113011230113301143011530116301173011830119301203012130122301233012430125301263012730128301293013030131301323013330134301353013630137301383013930140301413014230143301443014530146301473014830149301503015130152301533015430155301563015730158301593016030161301623016330164301653016630167301683016930170301713017230173301743017530176301773017830179301803018130182301833018430185301863018730188301893019030191301923019330194301953019630197301983019930200302013020230203302043020530206302073020830209302103021130212302133021430215302163021730218302193022030221302223022330224302253022630227302283022930230302313023230233302343023530236302373023830239302403024130242302433024430245302463024730248302493025030251302523025330254302553025630257302583025930260302613026230263302643026530266302673026830269302703027130272302733027430275302763027730278302793028030281302823028330284302853028630287302883028930290302913029230293302943029530296302973029830299303003030130302303033030430305303063030730308303093031030311303123031330314303153031630317303183031930320303213032230323303243032530326303273032830329303303033130332303333033430335303363033730338303393034030341303423034330344303453034630347303483034930350303513035230353303543035530356303573035830359303603036130362303633036430365303663036730368303693037030371303723037330374303753037630377303783037930380303813038230383303843038530386303873038830389303903039130392303933039430395303963039730398303993040030401304023040330404304053040630407304083040930410304113041230413304143041530416304173041830419304203042130422304233042430425304263042730428304293043030431304323043330434304353043630437304383043930440304413044230443304443044530446304473044830449304503045130452304533045430455304563045730458304593046030461304623046330464304653046630467304683046930470304713047230473304743047530476304773047830479304803048130482304833048430485304863048730488304893049030491304923049330494304953049630497304983049930500305013050230503305043050530506305073050830509305103051130512305133051430515305163051730518305193052030521305223052330524305253052630527305283052930530305313053230533305343053530536305373053830539305403054130542305433054430545305463054730548305493055030551305523055330554305553055630557305583055930560305613056230563305643056530566305673056830569305703057130572305733057430575305763057730578305793058030581305823058330584305853058630587305883058930590305913059230593305943059530596305973059830599306003060130602306033060430605306063060730608306093061030611306123061330614306153061630617306183061930620306213062230623306243062530626306273062830629306303063130632306333063430635306363063730638306393064030641306423064330644306453064630647306483064930650306513065230653306543065530656306573065830659306603066130662306633066430665306663066730668306693067030671306723067330674306753067630677306783067930680306813068230683306843068530686306873068830689306903069130692306933069430695306963069730698306993070030701307023070330704307053070630707307083070930710307113071230713307143071530716307173071830719307203072130722307233072430725307263072730728307293073030731307323073330734307353073630737307383073930740307413074230743307443074530746307473074830749307503075130752307533075430755307563075730758307593076030761307623076330764307653076630767307683076930770307713077230773307743077530776307773077830779307803078130782307833078430785307863078730788307893079030791307923079330794307953079630797307983079930800308013080230803308043080530806308073080830809308103081130812308133081430815308163081730818308193082030821308223082330824308253082630827308283082930830308313083230833308343083530836308373083830839308403084130842308433084430845308463084730848308493085030851308523085330854308553085630857308583085930860308613086230863308643086530866308673086830869308703087130872308733087430875308763087730878308793088030881308823088330884308853088630887308883088930890308913089230893308943089530896308973089830899309003090130902309033090430905309063090730908309093091030911309123091330914309153091630917309183091930920309213092230923309243092530926309273092830929309303093130932309333093430935309363093730938309393094030941309423094330944309453094630947309483094930950309513095230953309543095530956309573095830959309603096130962309633096430965309663096730968309693097030971309723097330974309753097630977309783097930980309813098230983309843098530986309873098830989309903099130992309933099430995309963099730998309993100031001310023100331004310053100631007310083100931010310113101231013310143101531016310173101831019310203102131022310233102431025310263102731028310293103031031310323103331034310353103631037310383103931040310413104231043310443104531046310473104831049310503105131052310533105431055310563105731058310593106031061310623106331064310653106631067310683106931070310713107231073310743107531076310773107831079310803108131082310833108431085310863108731088310893109031091310923109331094310953109631097310983109931100311013110231103311043110531106311073110831109311103111131112311133111431115311163111731118311193112031121311223112331124311253112631127311283112931130311313113231133311343113531136311373113831139311403114131142311433114431145311463114731148311493115031151311523115331154311553115631157311583115931160311613116231163311643116531166311673116831169311703117131172311733117431175311763117731178311793118031181311823118331184311853118631187311883118931190311913119231193311943119531196311973119831199312003120131202312033120431205312063120731208312093121031211312123121331214312153121631217312183121931220312213122231223312243122531226312273122831229312303123131232312333123431235312363123731238312393124031241312423124331244312453124631247312483124931250312513125231253312543125531256312573125831259312603126131262312633126431265312663126731268312693127031271312723127331274312753127631277312783127931280312813128231283312843128531286312873128831289312903129131292312933129431295312963129731298312993130031301313023130331304313053130631307313083130931310313113131231313313143131531316313173131831319313203132131322313233132431325313263132731328313293133031331313323133331334313353133631337313383133931340313413134231343313443134531346313473134831349313503135131352313533135431355313563135731358313593136031361313623136331364313653136631367313683136931370313713137231373313743137531376313773137831379313803138131382313833138431385313863138731388313893139031391313923139331394313953139631397313983139931400314013140231403314043140531406314073140831409314103141131412314133141431415314163141731418314193142031421314223142331424314253142631427314283142931430314313143231433314343143531436314373143831439314403144131442314433144431445314463144731448314493145031451314523145331454314553145631457314583145931460314613146231463314643146531466314673146831469314703147131472314733147431475314763147731478314793148031481314823148331484314853148631487314883148931490314913149231493314943149531496314973149831499315003150131502315033150431505315063150731508315093151031511315123151331514315153151631517315183151931520315213152231523315243152531526315273152831529315303153131532315333153431535315363153731538315393154031541315423154331544315453154631547315483154931550315513155231553315543155531556315573155831559315603156131562315633156431565315663156731568315693157031571315723157331574315753157631577315783157931580315813158231583315843158531586315873158831589315903159131592315933159431595315963159731598315993160031601316023160331604316053160631607316083160931610316113161231613316143161531616316173161831619316203162131622316233162431625316263162731628316293163031631316323163331634316353163631637316383163931640316413164231643316443164531646316473164831649316503165131652316533165431655316563165731658316593166031661316623166331664316653166631667316683166931670316713167231673316743167531676316773167831679316803168131682316833168431685316863168731688316893169031691316923169331694316953169631697316983169931700317013170231703317043170531706317073170831709317103171131712317133171431715317163171731718317193172031721317223172331724317253172631727317283172931730317313173231733317343173531736317373173831739317403174131742317433174431745317463174731748317493175031751317523175331754317553175631757317583175931760317613176231763317643176531766317673176831769317703177131772317733177431775317763177731778317793178031781317823178331784317853178631787317883178931790317913179231793317943179531796317973179831799318003180131802318033180431805318063180731808318093181031811318123181331814318153181631817318183181931820318213182231823318243182531826318273182831829318303183131832318333183431835318363183731838318393184031841318423184331844318453184631847318483184931850318513185231853318543185531856318573185831859318603186131862318633186431865318663186731868318693187031871318723187331874318753187631877318783187931880318813188231883318843188531886318873188831889318903189131892318933189431895318963189731898318993190031901319023190331904319053190631907319083190931910319113191231913319143191531916319173191831919319203192131922319233192431925319263192731928319293193031931319323193331934319353193631937319383193931940319413194231943319443194531946319473194831949319503195131952319533195431955319563195731958319593196031961319623196331964319653196631967319683196931970319713197231973319743197531976319773197831979319803198131982319833198431985319863198731988319893199031991319923199331994319953199631997319983199932000320013200232003320043200532006320073200832009320103201132012320133201432015320163201732018320193202032021320223202332024320253202632027320283202932030320313203232033320343203532036320373203832039320403204132042320433204432045320463204732048320493205032051320523205332054320553205632057320583205932060320613206232063320643206532066320673206832069320703207132072320733207432075320763207732078320793208032081320823208332084320853208632087320883208932090320913209232093320943209532096320973209832099321003210132102321033210432105321063210732108321093211032111321123211332114321153211632117321183211932120321213212232123321243212532126321273212832129321303213132132321333213432135321363213732138321393214032141321423214332144321453214632147321483214932150321513215232153321543215532156321573215832159321603216132162321633216432165321663216732168321693217032171321723217332174321753217632177321783217932180321813218232183321843218532186321873218832189321903219132192321933219432195321963219732198321993220032201322023220332204322053220632207322083220932210322113221232213322143221532216322173221832219322203222132222322233222432225322263222732228322293223032231322323223332234322353223632237322383223932240322413224232243322443224532246322473224832249322503225132252322533225432255322563225732258322593226032261322623226332264322653226632267322683226932270322713227232273322743227532276322773227832279322803228132282322833228432285322863228732288322893229032291322923229332294322953229632297322983229932300323013230232303323043230532306323073230832309323103231132312323133231432315323163231732318323193232032321323223232332324323253232632327323283232932330323313233232333323343233532336323373233832339323403234132342323433234432345323463234732348323493235032351323523235332354323553235632357323583235932360323613236232363323643236532366323673236832369323703237132372323733237432375323763237732378323793238032381323823238332384323853238632387323883238932390323913239232393323943239532396323973239832399324003240132402324033240432405324063240732408324093241032411324123241332414324153241632417324183241932420324213242232423324243242532426324273242832429324303243132432324333243432435324363243732438324393244032441324423244332444324453244632447324483244932450324513245232453324543245532456324573245832459324603246132462324633246432465324663246732468324693247032471324723247332474324753247632477324783247932480324813248232483324843248532486324873248832489324903249132492324933249432495324963249732498324993250032501325023250332504325053250632507325083250932510325113251232513325143251532516325173251832519325203252132522325233252432525325263252732528325293253032531325323253332534325353253632537325383253932540325413254232543325443254532546325473254832549325503255132552325533255432555325563255732558325593256032561325623256332564325653256632567325683256932570325713257232573325743257532576325773257832579325803258132582325833258432585325863258732588325893259032591325923259332594325953259632597325983259932600326013260232603326043260532606326073260832609326103261132612326133261432615326163261732618326193262032621326223262332624326253262632627326283262932630326313263232633326343263532636326373263832639326403264132642326433264432645326463264732648326493265032651326523265332654326553265632657326583265932660326613266232663326643266532666326673266832669326703267132672326733267432675326763267732678326793268032681326823268332684326853268632687326883268932690326913269232693326943269532696326973269832699327003270132702327033270432705327063270732708327093271032711327123271332714327153271632717327183271932720327213272232723327243272532726327273272832729327303273132732327333273432735327363273732738327393274032741327423274332744327453274632747327483274932750327513275232753327543275532756327573275832759327603276132762327633276432765327663276732768327693277032771327723277332774327753277632777327783277932780327813278232783327843278532786327873278832789327903279132792327933279432795327963279732798327993280032801328023280332804328053280632807328083280932810328113281232813328143281532816328173281832819328203282132822328233282432825328263282732828328293283032831328323283332834328353283632837328383283932840328413284232843328443284532846328473284832849328503285132852328533285432855328563285732858328593286032861328623286332864328653286632867328683286932870328713287232873328743287532876328773287832879328803288132882328833288432885328863288732888328893289032891328923289332894328953289632897328983289932900329013290232903329043290532906329073290832909329103291132912329133291432915329163291732918329193292032921329223292332924329253292632927329283292932930329313293232933329343293532936329373293832939329403294132942329433294432945329463294732948329493295032951329523295332954329553295632957329583295932960329613296232963329643296532966329673296832969329703297132972329733297432975329763297732978329793298032981329823298332984329853298632987329883298932990329913299232993329943299532996329973299832999330003300133002330033300433005330063300733008330093301033011330123301333014330153301633017330183301933020330213302233023330243302533026330273302833029330303303133032330333303433035330363303733038330393304033041330423304333044330453304633047330483304933050330513305233053330543305533056330573305833059330603306133062330633306433065330663306733068330693307033071330723307333074330753307633077330783307933080330813308233083330843308533086330873308833089330903309133092330933309433095330963309733098330993310033101331023310333104331053310633107331083310933110331113311233113331143311533116331173311833119331203312133122331233312433125331263312733128331293313033131331323313333134331353313633137331383313933140331413314233143331443314533146331473314833149331503315133152331533315433155331563315733158331593316033161331623316333164331653316633167331683316933170331713317233173331743317533176331773317833179331803318133182331833318433185331863318733188331893319033191331923319333194331953319633197331983319933200332013320233203332043320533206332073320833209332103321133212332133321433215332163321733218332193322033221332223322333224332253322633227332283322933230332313323233233332343323533236332373323833239332403324133242332433324433245332463324733248332493325033251332523325333254332553325633257332583325933260332613326233263332643326533266332673326833269332703327133272332733327433275332763327733278332793328033281332823328333284332853328633287332883328933290332913329233293332943329533296332973329833299333003330133302333033330433305333063330733308333093331033311333123331333314333153331633317333183331933320333213332233323333243332533326333273332833329333303333133332333333333433335333363333733338333393334033341333423334333344333453334633347333483334933350333513335233353333543335533356333573335833359333603336133362333633336433365333663336733368333693337033371333723337333374333753337633377333783337933380333813338233383333843338533386333873338833389333903339133392333933339433395333963339733398333993340033401334023340333404334053340633407334083340933410334113341233413334143341533416334173341833419334203342133422334233342433425334263342733428334293343033431334323343333434334353343633437334383343933440334413344233443334443344533446334473344833449334503345133452334533345433455334563345733458334593346033461334623346333464334653346633467334683346933470334713347233473334743347533476334773347833479334803348133482334833348433485334863348733488334893349033491334923349333494334953349633497334983349933500335013350233503335043350533506335073350833509335103351133512335133351433515335163351733518335193352033521335223352333524335253352633527335283352933530335313353233533335343353533536335373353833539335403354133542335433354433545335463354733548335493355033551335523355333554335553355633557335583355933560335613356233563335643356533566335673356833569335703357133572335733357433575335763357733578335793358033581335823358333584335853358633587335883358933590335913359233593335943359533596335973359833599336003360133602336033360433605336063360733608336093361033611336123361333614336153361633617336183361933620336213362233623336243362533626336273362833629336303363133632336333363433635336363363733638336393364033641336423364333644336453364633647336483364933650336513365233653336543365533656336573365833659336603366133662336633366433665336663366733668336693367033671336723367333674336753367633677336783367933680336813368233683336843368533686336873368833689336903369133692336933369433695336963369733698336993370033701337023370333704337053370633707337083370933710337113371233713337143371533716337173371833719337203372133722337233372433725337263372733728337293373033731337323373333734337353373633737337383373933740337413374233743337443374533746337473374833749337503375133752337533375433755337563375733758337593376033761337623376333764337653376633767337683376933770337713377233773337743377533776337773377833779337803378133782337833378433785337863378733788337893379033791337923379333794337953379633797337983379933800338013380233803338043380533806338073380833809338103381133812338133381433815338163381733818338193382033821338223382333824338253382633827338283382933830338313383233833338343383533836338373383833839338403384133842338433384433845338463384733848338493385033851338523385333854338553385633857338583385933860338613386233863338643386533866338673386833869338703387133872338733387433875338763387733878338793388033881338823388333884338853388633887338883388933890338913389233893338943389533896338973389833899339003390133902339033390433905339063390733908339093391033911339123391333914339153391633917339183391933920339213392233923339243392533926339273392833929339303393133932339333393433935339363393733938339393394033941339423394333944339453394633947339483394933950339513395233953339543395533956339573395833959339603396133962339633396433965339663396733968339693397033971339723397333974339753397633977339783397933980339813398233983339843398533986339873398833989339903399133992339933399433995339963399733998339993400034001340023400334004340053400634007340083400934010340113401234013340143401534016340173401834019340203402134022340233402434025340263402734028340293403034031340323403334034340353403634037340383403934040340413404234043340443404534046340473404834049340503405134052340533405434055340563405734058340593406034061340623406334064340653406634067340683406934070340713407234073340743407534076340773407834079340803408134082340833408434085340863408734088340893409034091340923409334094340953409634097340983409934100341013410234103341043410534106341073410834109341103411134112341133411434115341163411734118341193412034121341223412334124341253412634127341283412934130341313413234133341343413534136341373413834139341403414134142341433414434145341463414734148341493415034151341523415334154341553415634157341583415934160341613416234163341643416534166341673416834169341703417134172341733417434175341763417734178341793418034181341823418334184341853418634187341883418934190341913419234193341943419534196341973419834199342003420134202342033420434205342063420734208342093421034211342123421334214342153421634217342183421934220342213422234223342243422534226342273422834229342303423134232342333423434235342363423734238342393424034241342423424334244342453424634247342483424934250342513425234253342543425534256342573425834259342603426134262342633426434265342663426734268342693427034271342723427334274342753427634277342783427934280342813428234283342843428534286342873428834289342903429134292342933429434295342963429734298342993430034301343023430334304343053430634307343083430934310343113431234313343143431534316343173431834319343203432134322343233432434325343263432734328343293433034331343323433334334343353433634337343383433934340343413434234343343443434534346343473434834349343503435134352343533435434355343563435734358343593436034361343623436334364343653436634367343683436934370343713437234373343743437534376343773437834379343803438134382343833438434385343863438734388343893439034391343923439334394343953439634397343983439934400344013440234403344043440534406344073440834409344103441134412344133441434415344163441734418344193442034421344223442334424344253442634427344283442934430344313443234433344343443534436344373443834439344403444134442344433444434445344463444734448344493445034451344523445334454344553445634457344583445934460344613446234463344643446534466344673446834469344703447134472344733447434475344763447734478344793448034481344823448334484344853448634487344883448934490344913449234493344943449534496344973449834499345003450134502345033450434505345063450734508345093451034511345123451334514345153451634517345183451934520345213452234523345243452534526345273452834529345303453134532345333453434535345363453734538345393454034541345423454334544345453454634547345483454934550345513455234553345543455534556345573455834559345603456134562345633456434565345663456734568345693457034571345723457334574345753457634577345783457934580345813458234583345843458534586345873458834589345903459134592345933459434595345963459734598345993460034601346023460334604346053460634607346083460934610346113461234613346143461534616346173461834619346203462134622346233462434625346263462734628346293463034631346323463334634346353463634637346383463934640346413464234643346443464534646346473464834649346503465134652346533465434655346563465734658346593466034661346623466334664346653466634667346683466934670346713467234673346743467534676346773467834679346803468134682346833468434685346863468734688346893469034691346923469334694346953469634697346983469934700347013470234703347043470534706347073470834709347103471134712347133471434715347163471734718347193472034721347223472334724347253472634727347283472934730347313473234733347343473534736347373473834739347403474134742347433474434745347463474734748347493475034751347523475334754347553475634757347583475934760347613476234763347643476534766347673476834769347703477134772347733477434775347763477734778347793478034781347823478334784347853478634787347883478934790347913479234793347943479534796347973479834799348003480134802348033480434805348063480734808348093481034811348123481334814348153481634817348183481934820348213482234823348243482534826348273482834829348303483134832348333483434835348363483734838348393484034841348423484334844348453484634847348483484934850348513485234853348543485534856348573485834859348603486134862348633486434865348663486734868348693487034871348723487334874348753487634877348783487934880348813488234883348843488534886348873488834889348903489134892348933489434895348963489734898348993490034901349023490334904349053490634907349083490934910349113491234913349143491534916349173491834919349203492134922349233492434925349263492734928349293493034931349323493334934349353493634937349383493934940349413494234943349443494534946349473494834949349503495134952349533495434955349563495734958349593496034961349623496334964349653496634967349683496934970349713497234973349743497534976349773497834979349803498134982349833498434985349863498734988349893499034991349923499334994349953499634997349983499935000350013500235003350043500535006350073500835009350103501135012350133501435015350163501735018350193502035021350223502335024350253502635027350283502935030350313503235033350343503535036350373503835039350403504135042350433504435045350463504735048350493505035051350523505335054350553505635057350583505935060350613506235063350643506535066350673506835069350703507135072350733507435075350763507735078350793508035081350823508335084350853508635087350883508935090350913509235093350943509535096350973509835099351003510135102351033510435105351063510735108351093511035111351123511335114351153511635117351183511935120351213512235123351243512535126351273512835129351303513135132351333513435135351363513735138351393514035141351423514335144351453514635147351483514935150351513515235153351543515535156351573515835159351603516135162351633516435165351663516735168351693517035171351723517335174351753517635177351783517935180351813518235183351843518535186351873518835189351903519135192351933519435195351963519735198351993520035201352023520335204352053520635207352083520935210352113521235213352143521535216352173521835219352203522135222352233522435225352263522735228352293523035231352323523335234352353523635237352383523935240352413524235243352443524535246352473524835249352503525135252352533525435255352563525735258352593526035261352623526335264352653526635267352683526935270352713527235273352743527535276352773527835279352803528135282352833528435285352863528735288352893529035291352923529335294352953529635297352983529935300353013530235303353043530535306353073530835309353103531135312353133531435315353163531735318353193532035321353223532335324353253532635327353283532935330353313533235333353343533535336353373533835339353403534135342353433534435345353463534735348353493535035351353523535335354353553535635357353583535935360353613536235363353643536535366353673536835369353703537135372353733537435375353763537735378353793538035381353823538335384353853538635387353883538935390353913539235393353943539535396353973539835399354003540135402354033540435405354063540735408354093541035411354123541335414354153541635417354183541935420354213542235423354243542535426354273542835429354303543135432354333543435435354363543735438354393544035441354423544335444354453544635447354483544935450354513545235453354543545535456354573545835459354603546135462354633546435465354663546735468354693547035471354723547335474354753547635477354783547935480354813548235483354843548535486354873548835489354903549135492354933549435495354963549735498354993550035501355023550335504355053550635507355083550935510355113551235513355143551535516355173551835519355203552135522355233552435525355263552735528355293553035531355323553335534355353553635537355383553935540355413554235543355443554535546355473554835549355503555135552355533555435555355563555735558355593556035561355623556335564355653556635567355683556935570355713557235573355743557535576355773557835579355803558135582355833558435585355863558735588355893559035591355923559335594355953559635597355983559935600356013560235603356043560535606356073560835609356103561135612356133561435615356163561735618356193562035621356223562335624356253562635627356283562935630356313563235633356343563535636356373563835639356403564135642356433564435645356463564735648356493565035651356523565335654356553565635657356583565935660356613566235663356643566535666356673566835669356703567135672356733567435675356763567735678356793568035681356823568335684356853568635687356883568935690356913569235693356943569535696356973569835699357003570135702357033570435705357063570735708357093571035711357123571335714357153571635717357183571935720357213572235723357243572535726357273572835729357303573135732357333573435735357363573735738357393574035741357423574335744357453574635747357483574935750357513575235753357543575535756357573575835759357603576135762357633576435765357663576735768357693577035771357723577335774357753577635777357783577935780357813578235783357843578535786357873578835789357903579135792357933579435795357963579735798357993580035801358023580335804358053580635807358083580935810358113581235813358143581535816358173581835819358203582135822358233582435825358263582735828358293583035831358323583335834358353583635837358383583935840358413584235843358443584535846358473584835849358503585135852358533585435855358563585735858358593586035861358623586335864358653586635867358683586935870358713587235873358743587535876358773587835879358803588135882358833588435885358863588735888358893589035891358923589335894358953589635897358983589935900359013590235903359043590535906359073590835909359103591135912359133591435915359163591735918359193592035921359223592335924359253592635927359283592935930359313593235933359343593535936359373593835939359403594135942359433594435945359463594735948359493595035951359523595335954359553595635957359583595935960359613596235963359643596535966359673596835969359703597135972359733597435975359763597735978359793598035981359823598335984359853598635987359883598935990359913599235993359943599535996359973599835999360003600136002360033600436005360063600736008360093601036011360123601336014360153601636017360183601936020360213602236023360243602536026360273602836029360303603136032360333603436035360363603736038360393604036041360423604336044360453604636047360483604936050360513605236053360543605536056360573605836059360603606136062360633606436065360663606736068360693607036071360723607336074360753607636077360783607936080360813608236083360843608536086360873608836089360903609136092360933609436095360963609736098360993610036101361023610336104361053610636107361083610936110361113611236113361143611536116361173611836119361203612136122361233612436125361263612736128361293613036131361323613336134361353613636137361383613936140361413614236143361443614536146361473614836149361503615136152361533615436155361563615736158361593616036161361623616336164361653616636167361683616936170361713617236173361743617536176361773617836179361803618136182361833618436185361863618736188361893619036191361923619336194361953619636197361983619936200362013620236203362043620536206362073620836209362103621136212362133621436215362163621736218362193622036221362223622336224362253622636227362283622936230362313623236233362343623536236362373623836239362403624136242362433624436245362463624736248362493625036251362523625336254362553625636257362583625936260362613626236263362643626536266362673626836269362703627136272362733627436275362763627736278362793628036281362823628336284362853628636287362883628936290362913629236293362943629536296362973629836299363003630136302363033630436305363063630736308363093631036311363123631336314363153631636317363183631936320363213632236323363243632536326363273632836329363303633136332363333633436335363363633736338363393634036341363423634336344363453634636347363483634936350363513635236353363543635536356363573635836359363603636136362363633636436365363663636736368363693637036371363723637336374363753637636377363783637936380363813638236383363843638536386363873638836389363903639136392363933639436395363963639736398363993640036401364023640336404364053640636407364083640936410364113641236413364143641536416364173641836419364203642136422364233642436425364263642736428364293643036431364323643336434364353643636437364383643936440364413644236443364443644536446364473644836449364503645136452364533645436455364563645736458364593646036461364623646336464364653646636467364683646936470364713647236473364743647536476364773647836479364803648136482364833648436485364863648736488364893649036491364923649336494364953649636497364983649936500365013650236503365043650536506365073650836509365103651136512365133651436515365163651736518365193652036521365223652336524365253652636527365283652936530365313653236533365343653536536365373653836539365403654136542365433654436545365463654736548365493655036551365523655336554365553655636557365583655936560365613656236563365643656536566365673656836569365703657136572365733657436575365763657736578365793658036581365823658336584365853658636587365883658936590365913659236593365943659536596365973659836599366003660136602366033660436605366063660736608366093661036611366123661336614366153661636617366183661936620366213662236623366243662536626366273662836629366303663136632366333663436635366363663736638366393664036641366423664336644366453664636647366483664936650366513665236653366543665536656366573665836659366603666136662366633666436665366663666736668366693667036671366723667336674366753667636677366783667936680366813668236683366843668536686366873668836689366903669136692366933669436695366963669736698366993670036701367023670336704367053670636707367083670936710367113671236713367143671536716367173671836719367203672136722367233672436725367263672736728367293673036731367323673336734367353673636737367383673936740367413674236743367443674536746367473674836749367503675136752367533675436755367563675736758367593676036761367623676336764367653676636767367683676936770367713677236773367743677536776367773677836779367803678136782367833678436785367863678736788367893679036791367923679336794367953679636797367983679936800368013680236803368043680536806368073680836809368103681136812368133681436815368163681736818368193682036821368223682336824368253682636827368283682936830368313683236833368343683536836368373683836839368403684136842368433684436845368463684736848368493685036851368523685336854368553685636857368583685936860368613686236863368643686536866368673686836869368703687136872368733687436875368763687736878368793688036881368823688336884368853688636887368883688936890368913689236893368943689536896368973689836899369003690136902369033690436905369063690736908369093691036911369123691336914369153691636917369183691936920369213692236923369243692536926369273692836929369303693136932369333693436935369363693736938369393694036941369423694336944369453694636947369483694936950369513695236953369543695536956369573695836959369603696136962369633696436965369663696736968369693697036971369723697336974369753697636977369783697936980369813698236983369843698536986369873698836989369903699136992369933699436995369963699736998369993700037001370023700337004370053700637007370083700937010370113701237013370143701537016370173701837019370203702137022370233702437025370263702737028370293703037031370323703337034370353703637037370383703937040370413704237043370443704537046370473704837049370503705137052370533705437055370563705737058370593706037061370623706337064370653706637067370683706937070370713707237073370743707537076370773707837079370803708137082370833708437085370863708737088370893709037091370923709337094370953709637097370983709937100371013710237103371043710537106371073710837109371103711137112371133711437115371163711737118371193712037121371223712337124371253712637127371283712937130371313713237133371343713537136371373713837139371403714137142371433714437145371463714737148371493715037151371523715337154371553715637157371583715937160371613716237163371643716537166371673716837169371703717137172371733717437175371763717737178371793718037181371823718337184371853718637187371883718937190371913719237193371943719537196371973719837199372003720137202372033720437205372063720737208372093721037211372123721337214372153721637217372183721937220372213722237223372243722537226372273722837229372303723137232372333723437235372363723737238372393724037241372423724337244372453724637247372483724937250372513725237253372543725537256372573725837259372603726137262372633726437265372663726737268372693727037271372723727337274372753727637277372783727937280372813728237283372843728537286372873728837289372903729137292372933729437295372963729737298372993730037301373023730337304373053730637307373083730937310373113731237313373143731537316373173731837319373203732137322373233732437325373263732737328373293733037331373323733337334373353733637337373383733937340373413734237343373443734537346373473734837349373503735137352373533735437355373563735737358373593736037361373623736337364373653736637367373683736937370373713737237373373743737537376373773737837379373803738137382373833738437385373863738737388373893739037391373923739337394373953739637397373983739937400374013740237403374043740537406374073740837409374103741137412374133741437415374163741737418374193742037421374223742337424374253742637427374283742937430374313743237433374343743537436374373743837439374403744137442374433744437445374463744737448374493745037451374523745337454374553745637457374583745937460374613746237463374643746537466374673746837469374703747137472374733747437475374763747737478374793748037481374823748337484374853748637487374883748937490374913749237493374943749537496374973749837499375003750137502375033750437505375063750737508375093751037511375123751337514375153751637517375183751937520375213752237523375243752537526375273752837529375303753137532375333753437535375363753737538375393754037541375423754337544375453754637547375483754937550375513755237553375543755537556375573755837559375603756137562375633756437565375663756737568375693757037571375723757337574375753757637577375783757937580375813758237583375843758537586375873758837589375903759137592375933759437595375963759737598375993760037601376023760337604376053760637607376083760937610376113761237613376143761537616376173761837619376203762137622376233762437625376263762737628376293763037631376323763337634376353763637637376383763937640376413764237643376443764537646376473764837649376503765137652376533765437655376563765737658376593766037661376623766337664376653766637667376683766937670376713767237673376743767537676376773767837679376803768137682376833768437685376863768737688376893769037691376923769337694376953769637697376983769937700377013770237703377043770537706377073770837709377103771137712377133771437715377163771737718377193772037721377223772337724377253772637727377283772937730377313773237733377343773537736377373773837739377403774137742377433774437745377463774737748377493775037751377523775337754377553775637757377583775937760377613776237763377643776537766377673776837769377703777137772377733777437775377763777737778377793778037781377823778337784377853778637787377883778937790377913779237793377943779537796377973779837799378003780137802378033780437805378063780737808378093781037811378123781337814378153781637817378183781937820378213782237823378243782537826378273782837829378303783137832378333783437835378363783737838378393784037841378423784337844378453784637847378483784937850378513785237853378543785537856378573785837859378603786137862378633786437865378663786737868378693787037871378723787337874378753787637877378783787937880378813788237883378843788537886378873788837889378903789137892378933789437895378963789737898378993790037901379023790337904379053790637907379083790937910379113791237913379143791537916379173791837919379203792137922379233792437925379263792737928379293793037931379323793337934379353793637937379383793937940379413794237943379443794537946379473794837949379503795137952379533795437955379563795737958379593796037961379623796337964379653796637967379683796937970379713797237973379743797537976379773797837979379803798137982379833798437985379863798737988379893799037991379923799337994379953799637997379983799938000380013800238003380043800538006380073800838009380103801138012380133801438015380163801738018380193802038021380223802338024380253802638027380283802938030380313803238033380343803538036380373803838039380403804138042380433804438045380463804738048380493805038051380523805338054380553805638057380583805938060380613806238063380643806538066380673806838069380703807138072380733807438075380763807738078380793808038081380823808338084380853808638087380883808938090380913809238093380943809538096380973809838099381003810138102381033810438105381063810738108381093811038111381123811338114381153811638117381183811938120381213812238123381243812538126381273812838129381303813138132381333813438135381363813738138381393814038141381423814338144381453814638147381483814938150381513815238153381543815538156381573815838159381603816138162381633816438165381663816738168381693817038171381723817338174381753817638177381783817938180381813818238183381843818538186381873818838189381903819138192381933819438195381963819738198381993820038201382023820338204382053820638207382083820938210382113821238213382143821538216382173821838219382203822138222382233822438225382263822738228382293823038231382323823338234382353823638237382383823938240382413824238243382443824538246382473824838249382503825138252382533825438255382563825738258382593826038261382623826338264382653826638267382683826938270382713827238273382743827538276382773827838279382803828138282382833828438285382863828738288382893829038291382923829338294382953829638297382983829938300383013830238303383043830538306383073830838309383103831138312383133831438315383163831738318383193832038321383223832338324383253832638327383283832938330383313833238333383343833538336383373833838339383403834138342383433834438345383463834738348383493835038351383523835338354383553835638357383583835938360383613836238363383643836538366383673836838369383703837138372383733837438375383763837738378383793838038381383823838338384383853838638387383883838938390383913839238393383943839538396383973839838399384003840138402384033840438405384063840738408384093841038411384123841338414384153841638417384183841938420384213842238423384243842538426384273842838429384303843138432384333843438435384363843738438384393844038441384423844338444384453844638447384483844938450384513845238453384543845538456384573845838459384603846138462384633846438465384663846738468384693847038471384723847338474384753847638477384783847938480384813848238483384843848538486384873848838489384903849138492384933849438495384963849738498384993850038501385023850338504385053850638507385083850938510385113851238513385143851538516385173851838519385203852138522385233852438525385263852738528385293853038531385323853338534385353853638537385383853938540385413854238543385443854538546385473854838549385503855138552385533855438555385563855738558385593856038561385623856338564385653856638567385683856938570385713857238573385743857538576385773857838579385803858138582385833858438585385863858738588385893859038591385923859338594385953859638597385983859938600386013860238603386043860538606386073860838609386103861138612386133861438615386163861738618386193862038621386223862338624386253862638627386283862938630386313863238633386343863538636386373863838639386403864138642386433864438645386463864738648386493865038651386523865338654386553865638657386583865938660386613866238663386643866538666386673866838669386703867138672386733867438675386763867738678386793868038681386823868338684386853868638687386883868938690386913869238693386943869538696386973869838699387003870138702387033870438705387063870738708387093871038711387123871338714387153871638717387183871938720387213872238723387243872538726387273872838729387303873138732387333873438735387363873738738387393874038741387423874338744387453874638747387483874938750387513875238753387543875538756387573875838759387603876138762387633876438765387663876738768387693877038771387723877338774387753877638777387783877938780387813878238783387843878538786387873878838789387903879138792387933879438795387963879738798387993880038801388023880338804388053880638807388083880938810388113881238813388143881538816388173881838819388203882138822388233882438825388263882738828388293883038831388323883338834388353883638837388383883938840388413884238843388443884538846388473884838849388503885138852388533885438855388563885738858388593886038861388623886338864388653886638867388683886938870388713887238873388743887538876388773887838879388803888138882388833888438885388863888738888388893889038891388923889338894388953889638897388983889938900389013890238903389043890538906389073890838909389103891138912389133891438915389163891738918389193892038921389223892338924389253892638927389283892938930389313893238933389343893538936389373893838939389403894138942389433894438945389463894738948389493895038951389523895338954389553895638957389583895938960389613896238963389643896538966389673896838969389703897138972389733897438975389763897738978389793898038981389823898338984389853898638987389883898938990389913899238993389943899538996389973899838999390003900139002390033900439005390063900739008390093901039011390123901339014390153901639017390183901939020390213902239023390243902539026390273902839029390303903139032390333903439035390363903739038390393904039041390423904339044390453904639047390483904939050390513905239053390543905539056390573905839059390603906139062390633906439065390663906739068390693907039071390723907339074390753907639077390783907939080390813908239083390843908539086390873908839089390903909139092390933909439095390963909739098390993910039101391023910339104391053910639107391083910939110391113911239113391143911539116391173911839119391203912139122391233912439125391263912739128391293913039131391323913339134391353913639137391383913939140391413914239143391443914539146391473914839149391503915139152391533915439155391563915739158391593916039161391623916339164391653916639167391683916939170391713917239173391743917539176391773917839179391803918139182391833918439185391863918739188391893919039191391923919339194391953919639197391983919939200392013920239203392043920539206392073920839209392103921139212392133921439215392163921739218392193922039221392223922339224392253922639227392283922939230392313923239233392343923539236392373923839239392403924139242392433924439245392463924739248392493925039251392523925339254392553925639257392583925939260392613926239263392643926539266392673926839269392703927139272392733927439275392763927739278392793928039281392823928339284392853928639287392883928939290392913929239293392943929539296392973929839299393003930139302393033930439305393063930739308393093931039311393123931339314393153931639317393183931939320393213932239323393243932539326393273932839329393303933139332393333933439335393363933739338393393934039341393423934339344393453934639347393483934939350393513935239353393543935539356393573935839359393603936139362393633936439365393663936739368393693937039371393723937339374393753937639377393783937939380393813938239383393843938539386393873938839389393903939139392393933939439395393963939739398393993940039401394023940339404394053940639407394083940939410394113941239413394143941539416394173941839419394203942139422394233942439425394263942739428394293943039431394323943339434394353943639437394383943939440394413944239443394443944539446394473944839449394503945139452394533945439455394563945739458394593946039461394623946339464394653946639467394683946939470394713947239473394743947539476394773947839479394803948139482394833948439485394863948739488394893949039491394923949339494394953949639497394983949939500395013950239503395043950539506395073950839509395103951139512395133951439515395163951739518395193952039521395223952339524395253952639527395283952939530395313953239533395343953539536395373953839539395403954139542395433954439545395463954739548395493955039551395523955339554395553955639557395583955939560395613956239563395643956539566395673956839569395703957139572395733957439575395763957739578395793958039581395823958339584395853958639587395883958939590395913959239593395943959539596395973959839599396003960139602396033960439605396063960739608396093961039611396123961339614396153961639617396183961939620396213962239623396243962539626396273962839629396303963139632396333963439635396363963739638396393964039641396423964339644396453964639647396483964939650396513965239653396543965539656396573965839659396603966139662396633966439665396663966739668396693967039671396723967339674396753967639677396783967939680396813968239683396843968539686396873968839689396903969139692396933969439695396963969739698396993970039701397023970339704397053970639707397083970939710397113971239713397143971539716397173971839719397203972139722397233972439725397263972739728397293973039731397323973339734397353973639737397383973939740397413974239743397443974539746397473974839749397503975139752397533975439755397563975739758397593976039761397623976339764397653976639767397683976939770397713977239773397743977539776397773977839779397803978139782397833978439785397863978739788397893979039791397923979339794397953979639797397983979939800398013980239803398043980539806398073980839809398103981139812398133981439815398163981739818398193982039821398223982339824398253982639827398283982939830398313983239833398343983539836398373983839839398403984139842398433984439845398463984739848398493985039851398523985339854398553985639857398583985939860398613986239863398643986539866398673986839869398703987139872398733987439875398763987739878398793988039881398823988339884398853988639887398883988939890398913989239893398943989539896398973989839899399003990139902399033990439905399063990739908399093991039911399123991339914399153991639917399183991939920399213992239923399243992539926399273992839929399303993139932399333993439935399363993739938399393994039941399423994339944399453994639947399483994939950399513995239953399543995539956399573995839959399603996139962399633996439965399663996739968399693997039971399723997339974399753997639977399783997939980399813998239983399843998539986399873998839989399903999139992399933999439995399963999739998399994000040001400024000340004400054000640007400084000940010400114001240013400144001540016400174001840019400204002140022400234002440025400264002740028400294003040031400324003340034400354003640037400384003940040400414004240043400444004540046400474004840049400504005140052400534005440055400564005740058400594006040061400624006340064400654006640067400684006940070400714007240073400744007540076400774007840079400804008140082400834008440085400864008740088400894009040091400924009340094400954009640097400984009940100401014010240103401044010540106401074010840109401104011140112401134011440115401164011740118401194012040121401224012340124401254012640127401284012940130401314013240133401344013540136401374013840139401404014140142401434014440145401464014740148401494015040151401524015340154401554015640157401584015940160401614016240163401644016540166401674016840169401704017140172401734017440175401764017740178401794018040181401824018340184401854018640187401884018940190401914019240193401944019540196401974019840199402004020140202402034020440205402064020740208402094021040211402124021340214402154021640217402184021940220402214022240223402244022540226402274022840229402304023140232402334023440235402364023740238402394024040241402424024340244402454024640247402484024940250402514025240253402544025540256402574025840259402604026140262402634026440265402664026740268402694027040271402724027340274402754027640277402784027940280402814028240283402844028540286402874028840289402904029140292402934029440295402964029740298402994030040301403024030340304403054030640307403084030940310403114031240313403144031540316403174031840319403204032140322403234032440325403264032740328403294033040331403324033340334403354033640337403384033940340403414034240343403444034540346403474034840349403504035140352403534035440355403564035740358403594036040361403624036340364403654036640367403684036940370403714037240373403744037540376403774037840379403804038140382403834038440385403864038740388403894039040391403924039340394403954039640397403984039940400404014040240403404044040540406404074040840409404104041140412404134041440415404164041740418404194042040421404224042340424404254042640427404284042940430404314043240433404344043540436404374043840439404404044140442404434044440445404464044740448404494045040451404524045340454404554045640457404584045940460404614046240463404644046540466404674046840469404704047140472404734047440475404764047740478404794048040481404824048340484404854048640487404884048940490404914049240493404944049540496404974049840499405004050140502405034050440505405064050740508405094051040511405124051340514405154051640517405184051940520405214052240523405244052540526405274052840529405304053140532405334053440535405364053740538405394054040541405424054340544405454054640547405484054940550405514055240553405544055540556405574055840559405604056140562405634056440565405664056740568405694057040571405724057340574405754057640577405784057940580405814058240583405844058540586405874058840589405904059140592405934059440595405964059740598405994060040601406024060340604406054060640607406084060940610406114061240613406144061540616406174061840619406204062140622406234062440625406264062740628406294063040631406324063340634406354063640637406384063940640406414064240643406444064540646406474064840649406504065140652406534065440655406564065740658406594066040661406624066340664406654066640667406684066940670406714067240673406744067540676406774067840679406804068140682406834068440685406864068740688406894069040691406924069340694406954069640697406984069940700407014070240703407044070540706407074070840709407104071140712407134071440715407164071740718407194072040721407224072340724407254072640727407284072940730407314073240733407344073540736407374073840739407404074140742407434074440745407464074740748407494075040751407524075340754407554075640757407584075940760407614076240763407644076540766407674076840769407704077140772407734077440775407764077740778407794078040781407824078340784407854078640787407884078940790407914079240793407944079540796407974079840799408004080140802408034080440805408064080740808408094081040811408124081340814408154081640817408184081940820408214082240823408244082540826408274082840829408304083140832408334083440835408364083740838408394084040841408424084340844408454084640847408484084940850408514085240853408544085540856408574085840859408604086140862408634086440865408664086740868408694087040871408724087340874408754087640877408784087940880408814088240883408844088540886408874088840889408904089140892408934089440895408964089740898408994090040901409024090340904409054090640907409084090940910409114091240913409144091540916409174091840919409204092140922409234092440925409264092740928409294093040931409324093340934409354093640937409384093940940409414094240943409444094540946409474094840949409504095140952409534095440955409564095740958409594096040961409624096340964409654096640967409684096940970409714097240973409744097540976409774097840979409804098140982409834098440985409864098740988409894099040991409924099340994409954099640997409984099941000410014100241003410044100541006410074100841009410104101141012410134101441015410164101741018410194102041021410224102341024410254102641027410284102941030410314103241033410344103541036410374103841039410404104141042410434104441045410464104741048410494105041051410524105341054410554105641057410584105941060410614106241063410644106541066410674106841069410704107141072410734107441075410764107741078410794108041081410824108341084410854108641087410884108941090410914109241093410944109541096410974109841099411004110141102411034110441105411064110741108411094111041111411124111341114411154111641117411184111941120411214112241123411244112541126411274112841129411304113141132411334113441135411364113741138411394114041141411424114341144411454114641147411484114941150411514115241153411544115541156411574115841159411604116141162411634116441165411664116741168411694117041171411724117341174411754117641177411784117941180411814118241183411844118541186411874118841189411904119141192411934119441195411964119741198411994120041201412024120341204412054120641207412084120941210412114121241213412144121541216412174121841219412204122141222412234122441225412264122741228412294123041231412324123341234412354123641237412384123941240412414124241243412444124541246412474124841249412504125141252412534125441255412564125741258412594126041261412624126341264412654126641267412684126941270412714127241273412744127541276412774127841279412804128141282412834128441285412864128741288412894129041291412924129341294412954129641297412984129941300413014130241303413044130541306413074130841309413104131141312413134131441315413164131741318413194132041321413224132341324413254132641327413284132941330413314133241333413344133541336413374133841339413404134141342413434134441345413464134741348413494135041351413524135341354413554135641357413584135941360413614136241363413644136541366413674136841369413704137141372413734137441375413764137741378413794138041381413824138341384413854138641387413884138941390413914139241393413944139541396413974139841399414004140141402414034140441405414064140741408414094141041411414124141341414414154141641417414184141941420414214142241423414244142541426414274142841429414304143141432414334143441435414364143741438414394144041441414424144341444414454144641447414484144941450414514145241453414544145541456414574145841459414604146141462414634146441465414664146741468414694147041471414724147341474414754147641477414784147941480414814148241483414844148541486414874148841489414904149141492414934149441495414964149741498414994150041501415024150341504415054150641507415084150941510415114151241513415144151541516415174151841519415204152141522415234152441525415264152741528415294153041531415324153341534415354153641537415384153941540415414154241543415444154541546415474154841549415504155141552415534155441555415564155741558415594156041561415624156341564415654156641567415684156941570415714157241573415744157541576415774157841579415804158141582415834158441585415864158741588415894159041591415924159341594415954159641597415984159941600416014160241603416044160541606416074160841609416104161141612416134161441615416164161741618416194162041621416224162341624416254162641627416284162941630416314163241633416344163541636416374163841639416404164141642416434164441645416464164741648416494165041651416524165341654416554165641657416584165941660416614166241663416644166541666416674166841669416704167141672416734167441675416764167741678416794168041681416824168341684416854168641687416884168941690416914169241693416944169541696416974169841699417004170141702417034170441705417064170741708417094171041711417124171341714417154171641717417184171941720417214172241723417244172541726417274172841729417304173141732417334173441735417364173741738417394174041741417424174341744417454174641747417484174941750417514175241753417544175541756417574175841759417604176141762417634176441765417664176741768417694177041771417724177341774417754177641777417784177941780417814178241783417844178541786417874178841789417904179141792417934179441795417964179741798417994180041801418024180341804418054180641807418084180941810418114181241813418144181541816418174181841819418204182141822418234182441825418264182741828418294183041831418324183341834418354183641837418384183941840418414184241843418444184541846418474184841849418504185141852418534185441855418564185741858418594186041861418624186341864418654186641867418684186941870418714187241873418744187541876418774187841879418804188141882418834188441885418864188741888418894189041891418924189341894418954189641897418984189941900419014190241903419044190541906419074190841909419104191141912419134191441915419164191741918419194192041921419224192341924419254192641927419284192941930419314193241933419344193541936419374193841939419404194141942419434194441945419464194741948419494195041951419524195341954419554195641957419584195941960419614196241963419644196541966419674196841969419704197141972419734197441975419764197741978419794198041981419824198341984419854198641987419884198941990419914199241993419944199541996419974199841999420004200142002420034200442005420064200742008420094201042011420124201342014420154201642017420184201942020420214202242023420244202542026420274202842029420304203142032420334203442035420364203742038420394204042041420424204342044420454204642047420484204942050420514205242053420544205542056420574205842059420604206142062420634206442065420664206742068420694207042071420724207342074420754207642077420784207942080420814208242083420844208542086420874208842089420904209142092420934209442095420964209742098420994210042101421024210342104421054210642107421084210942110421114211242113421144211542116421174211842119421204212142122421234212442125421264212742128421294213042131421324213342134421354213642137421384213942140421414214242143421444214542146421474214842149421504215142152421534215442155421564215742158421594216042161421624216342164421654216642167421684216942170421714217242173421744217542176421774217842179421804218142182421834218442185421864218742188421894219042191421924219342194421954219642197421984219942200422014220242203422044220542206422074220842209422104221142212422134221442215422164221742218422194222042221422224222342224422254222642227422284222942230422314223242233422344223542236422374223842239422404224142242422434224442245422464224742248422494225042251422524225342254422554225642257422584225942260422614226242263422644226542266422674226842269422704227142272422734227442275422764227742278422794228042281422824228342284422854228642287422884228942290422914229242293422944229542296422974229842299423004230142302423034230442305423064230742308423094231042311423124231342314423154231642317423184231942320423214232242323423244232542326423274232842329423304233142332423334233442335423364233742338423394234042341423424234342344423454234642347423484234942350423514235242353423544235542356423574235842359423604236142362423634236442365423664236742368423694237042371423724237342374423754237642377423784237942380423814238242383423844238542386423874238842389423904239142392423934239442395423964239742398423994240042401424024240342404424054240642407424084240942410424114241242413424144241542416424174241842419424204242142422424234242442425424264242742428424294243042431424324243342434424354243642437424384243942440424414244242443424444244542446424474244842449424504245142452424534245442455424564245742458424594246042461424624246342464424654246642467424684246942470424714247242473424744247542476424774247842479424804248142482424834248442485424864248742488424894249042491424924249342494424954249642497424984249942500425014250242503425044250542506425074250842509425104251142512425134251442515425164251742518425194252042521425224252342524425254252642527425284252942530425314253242533425344253542536425374253842539425404254142542425434254442545425464254742548425494255042551425524255342554425554255642557425584255942560425614256242563425644256542566425674256842569425704257142572425734257442575425764257742578425794258042581425824258342584425854258642587425884258942590425914259242593425944259542596425974259842599426004260142602426034260442605426064260742608426094261042611426124261342614426154261642617426184261942620426214262242623426244262542626426274262842629426304263142632426334263442635426364263742638426394264042641426424264342644426454264642647426484264942650426514265242653426544265542656426574265842659426604266142662426634266442665426664266742668426694267042671426724267342674426754267642677426784267942680426814268242683426844268542686426874268842689426904269142692426934269442695426964269742698426994270042701427024270342704427054270642707427084270942710427114271242713427144271542716427174271842719427204272142722427234272442725427264272742728427294273042731427324273342734427354273642737427384273942740427414274242743427444274542746427474274842749427504275142752427534275442755427564275742758427594276042761427624276342764427654276642767427684276942770427714277242773427744277542776427774277842779427804278142782427834278442785427864278742788427894279042791427924279342794427954279642797427984279942800428014280242803428044280542806428074280842809428104281142812428134281442815428164281742818428194282042821428224282342824428254282642827428284282942830428314283242833428344283542836428374283842839428404284142842428434284442845428464284742848428494285042851428524285342854428554285642857428584285942860428614286242863428644286542866428674286842869428704287142872428734287442875428764287742878428794288042881428824288342884428854288642887428884288942890428914289242893428944289542896428974289842899429004290142902429034290442905429064290742908429094291042911429124291342914429154291642917429184291942920429214292242923429244292542926429274292842929429304293142932429334293442935429364293742938429394294042941429424294342944429454294642947429484294942950429514295242953429544295542956429574295842959429604296142962429634296442965429664296742968429694297042971429724297342974429754297642977429784297942980429814298242983429844298542986429874298842989429904299142992429934299442995429964299742998429994300043001430024300343004430054300643007430084300943010430114301243013430144301543016430174301843019430204302143022430234302443025430264302743028430294303043031430324303343034430354303643037430384303943040430414304243043430444304543046430474304843049430504305143052430534305443055430564305743058430594306043061430624306343064430654306643067430684306943070430714307243073430744307543076430774307843079430804308143082430834308443085430864308743088430894309043091430924309343094430954309643097430984309943100431014310243103431044310543106431074310843109431104311143112431134311443115431164311743118431194312043121431224312343124431254312643127431284312943130431314313243133431344313543136431374313843139431404314143142431434314443145431464314743148431494315043151431524315343154431554315643157431584315943160431614316243163431644316543166431674316843169431704317143172431734317443175431764317743178431794318043181431824318343184431854318643187431884318943190431914319243193431944319543196431974319843199432004320143202432034320443205432064320743208432094321043211432124321343214432154321643217432184321943220432214322243223432244322543226432274322843229432304323143232432334323443235432364323743238432394324043241432424324343244432454324643247432484324943250432514325243253432544325543256432574325843259432604326143262432634326443265432664326743268432694327043271432724327343274432754327643277432784327943280432814328243283432844328543286432874328843289432904329143292432934329443295432964329743298432994330043301433024330343304433054330643307433084330943310433114331243313433144331543316433174331843319433204332143322433234332443325433264332743328433294333043331433324333343334433354333643337433384333943340433414334243343433444334543346433474334843349433504335143352433534335443355433564335743358433594336043361433624336343364433654336643367433684336943370433714337243373433744337543376433774337843379433804338143382433834338443385433864338743388433894339043391433924339343394433954339643397433984339943400434014340243403434044340543406434074340843409434104341143412434134341443415434164341743418434194342043421434224342343424434254342643427434284342943430434314343243433434344343543436434374343843439434404344143442434434344443445434464344743448434494345043451434524345343454434554345643457434584345943460434614346243463434644346543466434674346843469434704347143472434734347443475434764347743478434794348043481434824348343484434854348643487434884348943490434914349243493434944349543496434974349843499435004350143502435034350443505435064350743508435094351043511435124351343514435154351643517435184351943520435214352243523435244352543526435274352843529435304353143532435334353443535435364353743538435394354043541435424354343544435454354643547435484354943550435514355243553435544355543556435574355843559435604356143562435634356443565435664356743568435694357043571435724357343574435754357643577435784357943580435814358243583435844358543586435874358843589435904359143592435934359443595435964359743598435994360043601436024360343604436054360643607436084360943610436114361243613436144361543616436174361843619436204362143622436234362443625436264362743628436294363043631436324363343634436354363643637436384363943640436414364243643436444364543646436474364843649436504365143652436534365443655436564365743658436594366043661436624366343664436654366643667436684366943670436714367243673436744367543676436774367843679436804368143682436834368443685436864368743688436894369043691436924369343694436954369643697436984369943700437014370243703437044370543706437074370843709437104371143712437134371443715437164371743718437194372043721437224372343724437254372643727437284372943730437314373243733437344373543736437374373843739437404374143742437434374443745437464374743748437494375043751437524375343754437554375643757437584375943760437614376243763437644376543766437674376843769437704377143772437734377443775437764377743778437794378043781437824378343784437854378643787437884378943790437914379243793437944379543796437974379843799438004380143802438034380443805438064380743808438094381043811438124381343814438154381643817438184381943820438214382243823438244382543826438274382843829438304383143832438334383443835438364383743838438394384043841438424384343844438454384643847438484384943850438514385243853438544385543856438574385843859438604386143862438634386443865438664386743868438694387043871438724387343874438754387643877438784387943880438814388243883438844388543886438874388843889438904389143892438934389443895438964389743898438994390043901439024390343904439054390643907439084390943910439114391243913439144391543916439174391843919439204392143922439234392443925439264392743928439294393043931439324393343934439354393643937439384393943940439414394243943439444394543946439474394843949439504395143952439534395443955439564395743958439594396043961439624396343964439654396643967439684396943970439714397243973439744397543976439774397843979439804398143982439834398443985439864398743988439894399043991439924399343994439954399643997439984399944000440014400244003440044400544006440074400844009440104401144012440134401444015440164401744018440194402044021440224402344024440254402644027440284402944030440314403244033440344403544036440374403844039440404404144042440434404444045440464404744048440494405044051440524405344054440554405644057440584405944060440614406244063440644406544066440674406844069440704407144072440734407444075440764407744078440794408044081440824408344084440854408644087440884408944090440914409244093440944409544096440974409844099441004410144102441034410444105441064410744108441094411044111441124411344114441154411644117441184411944120441214412244123441244412544126441274412844129441304413144132441334413444135441364413744138441394414044141441424414344144441454414644147441484414944150441514415244153441544415544156441574415844159441604416144162441634416444165441664416744168441694417044171441724417344174441754417644177441784417944180441814418244183441844418544186441874418844189441904419144192441934419444195441964419744198441994420044201442024420344204442054420644207442084420944210442114421244213442144421544216442174421844219442204422144222442234422444225442264422744228442294423044231442324423344234442354423644237442384423944240442414424244243442444424544246442474424844249442504425144252442534425444255442564425744258442594426044261442624426344264442654426644267442684426944270442714427244273442744427544276442774427844279442804428144282442834428444285442864428744288442894429044291442924429344294442954429644297442984429944300443014430244303443044430544306443074430844309443104431144312443134431444315443164431744318443194432044321443224432344324443254432644327443284432944330443314433244333443344433544336443374433844339443404434144342443434434444345443464434744348443494435044351443524435344354443554435644357443584435944360443614436244363443644436544366443674436844369443704437144372443734437444375443764437744378443794438044381443824438344384443854438644387443884438944390443914439244393443944439544396443974439844399444004440144402444034440444405444064440744408444094441044411444124441344414444154441644417444184441944420444214442244423444244442544426444274442844429444304443144432444334443444435444364443744438444394444044441444424444344444444454444644447444484444944450444514445244453444544445544456444574445844459444604446144462444634446444465444664446744468444694447044471444724447344474444754447644477444784447944480444814448244483444844448544486444874448844489444904449144492444934449444495444964449744498444994450044501445024450344504445054450644507445084450944510445114451244513445144451544516445174451844519445204452144522445234452444525445264452744528445294453044531445324453344534445354453644537445384453944540445414454244543445444454544546445474454844549445504455144552445534455444555445564455744558445594456044561445624456344564445654456644567445684456944570445714457244573445744457544576445774457844579445804458144582445834458444585445864458744588445894459044591445924459344594445954459644597445984459944600446014460244603446044460544606446074460844609446104461144612446134461444615446164461744618446194462044621446224462344624446254462644627446284462944630446314463244633446344463544636446374463844639446404464144642446434464444645446464464744648446494465044651446524465344654446554465644657446584465944660446614466244663446644466544666446674466844669446704467144672446734467444675446764467744678446794468044681446824468344684446854468644687446884468944690446914469244693446944469544696446974469844699447004470144702447034470444705447064470744708447094471044711447124471344714447154471644717447184471944720447214472244723447244472544726447274472844729447304473144732447334473444735447364473744738447394474044741447424474344744447454474644747447484474944750447514475244753447544475544756447574475844759447604476144762447634476444765447664476744768447694477044771447724477344774447754477644777447784477944780447814478244783447844478544786447874478844789447904479144792447934479444795447964479744798447994480044801448024480344804448054480644807448084480944810448114481244813448144481544816448174481844819448204482144822448234482444825448264482744828448294483044831448324483344834448354483644837448384483944840448414484244843448444484544846448474484844849448504485144852448534485444855448564485744858448594486044861448624486344864448654486644867448684486944870448714487244873448744487544876448774487844879448804488144882448834488444885448864488744888448894489044891448924489344894448954489644897448984489944900449014490244903449044490544906449074490844909449104491144912449134491444915449164491744918449194492044921449224492344924449254492644927449284492944930449314493244933449344493544936449374493844939449404494144942449434494444945449464494744948449494495044951449524495344954449554495644957449584495944960449614496244963449644496544966449674496844969449704497144972449734497444975449764497744978449794498044981449824498344984449854498644987449884498944990449914499244993449944499544996449974499844999450004500145002450034500445005450064500745008450094501045011450124501345014450154501645017450184501945020450214502245023450244502545026450274502845029450304503145032450334503445035450364503745038450394504045041450424504345044450454504645047450484504945050450514505245053450544505545056450574505845059450604506145062450634506445065450664506745068450694507045071450724507345074450754507645077450784507945080450814508245083450844508545086450874508845089450904509145092450934509445095450964509745098450994510045101451024510345104451054510645107451084510945110451114511245113451144511545116451174511845119451204512145122451234512445125451264512745128451294513045131451324513345134451354513645137451384513945140451414514245143451444514545146451474514845149451504515145152451534515445155451564515745158451594516045161451624516345164451654516645167451684516945170451714517245173451744517545176451774517845179451804518145182451834518445185451864518745188451894519045191451924519345194451954519645197451984519945200452014520245203452044520545206452074520845209452104521145212452134521445215452164521745218452194522045221452224522345224452254522645227452284522945230452314523245233452344523545236452374523845239452404524145242452434524445245452464524745248452494525045251452524525345254452554525645257452584525945260452614526245263452644526545266452674526845269452704527145272452734527445275452764527745278452794528045281452824528345284452854528645287452884528945290452914529245293452944529545296452974529845299453004530145302453034530445305453064530745308453094531045311453124531345314453154531645317453184531945320453214532245323453244532545326453274532845329453304533145332453334533445335453364533745338453394534045341453424534345344453454534645347453484534945350453514535245353453544535545356453574535845359453604536145362453634536445365453664536745368453694537045371453724537345374453754537645377453784537945380453814538245383453844538545386453874538845389453904539145392453934539445395453964539745398453994540045401454024540345404454054540645407454084540945410454114541245413454144541545416454174541845419454204542145422454234542445425454264542745428454294543045431454324543345434454354543645437454384543945440454414544245443454444544545446454474544845449454504545145452454534545445455454564545745458454594546045461454624546345464454654546645467454684546945470454714547245473454744547545476454774547845479454804548145482454834548445485454864548745488454894549045491454924549345494454954549645497454984549945500455014550245503455044550545506455074550845509455104551145512455134551445515455164551745518455194552045521455224552345524455254552645527455284552945530455314553245533455344553545536455374553845539455404554145542455434554445545455464554745548455494555045551455524555345554455554555645557455584555945560455614556245563455644556545566455674556845569455704557145572455734557445575455764557745578455794558045581455824558345584455854558645587455884558945590455914559245593455944559545596455974559845599456004560145602456034560445605456064560745608456094561045611456124561345614456154561645617456184561945620456214562245623456244562545626456274562845629456304563145632456334563445635456364563745638456394564045641456424564345644456454564645647456484564945650456514565245653456544565545656456574565845659456604566145662456634566445665456664566745668456694567045671456724567345674456754567645677456784567945680456814568245683456844568545686456874568845689456904569145692456934569445695456964569745698456994570045701457024570345704457054570645707457084570945710457114571245713457144571545716457174571845719457204572145722457234572445725457264572745728457294573045731457324573345734457354573645737457384573945740457414574245743457444574545746457474574845749457504575145752457534575445755457564575745758457594576045761457624576345764457654576645767457684576945770457714577245773457744577545776457774577845779457804578145782457834578445785457864578745788457894579045791457924579345794457954579645797457984579945800458014580245803458044580545806458074580845809458104581145812458134581445815458164581745818458194582045821458224582345824458254582645827458284582945830458314583245833458344583545836458374583845839458404584145842458434584445845458464584745848458494585045851458524585345854458554585645857458584585945860458614586245863458644586545866458674586845869458704587145872458734587445875458764587745878458794588045881458824588345884458854588645887458884588945890458914589245893458944589545896458974589845899459004590145902459034590445905459064590745908459094591045911459124591345914459154591645917459184591945920459214592245923459244592545926459274592845929459304593145932459334593445935459364593745938459394594045941459424594345944459454594645947459484594945950459514595245953459544595545956459574595845959459604596145962459634596445965459664596745968459694597045971459724597345974459754597645977459784597945980459814598245983459844598545986459874598845989459904599145992459934599445995459964599745998459994600046001460024600346004460054600646007460084600946010460114601246013460144601546016460174601846019460204602146022460234602446025460264602746028460294603046031460324603346034460354603646037460384603946040460414604246043460444604546046460474604846049460504605146052460534605446055460564605746058460594606046061460624606346064460654606646067460684606946070460714607246073460744607546076460774607846079460804608146082460834608446085460864608746088460894609046091460924609346094460954609646097460984609946100461014610246103461044610546106461074610846109461104611146112461134611446115461164611746118461194612046121461224612346124461254612646127461284612946130461314613246133461344613546136461374613846139461404614146142461434614446145461464614746148461494615046151461524615346154461554615646157461584615946160461614616246163461644616546166461674616846169461704617146172461734617446175461764617746178461794618046181461824618346184461854618646187461884618946190461914619246193461944619546196461974619846199462004620146202462034620446205462064620746208462094621046211462124621346214462154621646217462184621946220462214622246223462244622546226462274622846229462304623146232462334623446235462364623746238462394624046241462424624346244462454624646247462484624946250462514625246253462544625546256462574625846259462604626146262462634626446265462664626746268462694627046271462724627346274462754627646277462784627946280462814628246283462844628546286462874628846289462904629146292462934629446295462964629746298462994630046301463024630346304463054630646307463084630946310463114631246313463144631546316463174631846319463204632146322463234632446325463264632746328463294633046331463324633346334463354633646337463384633946340463414634246343463444634546346463474634846349463504635146352463534635446355463564635746358463594636046361463624636346364463654636646367463684636946370463714637246373463744637546376463774637846379463804638146382463834638446385463864638746388463894639046391463924639346394463954639646397463984639946400464014640246403464044640546406464074640846409464104641146412464134641446415464164641746418464194642046421464224642346424464254642646427464284642946430464314643246433464344643546436464374643846439464404644146442464434644446445464464644746448464494645046451464524645346454464554645646457464584645946460464614646246463464644646546466464674646846469464704647146472464734647446475464764647746478464794648046481464824648346484464854648646487464884648946490464914649246493464944649546496464974649846499465004650146502465034650446505465064650746508465094651046511465124651346514465154651646517465184651946520465214652246523465244652546526465274652846529465304653146532465334653446535465364653746538465394654046541465424654346544465454654646547465484654946550465514655246553465544655546556465574655846559465604656146562465634656446565465664656746568465694657046571465724657346574465754657646577465784657946580465814658246583465844658546586465874658846589465904659146592465934659446595465964659746598465994660046601466024660346604466054660646607466084660946610466114661246613466144661546616466174661846619466204662146622466234662446625466264662746628466294663046631466324663346634466354663646637466384663946640466414664246643466444664546646466474664846649466504665146652466534665446655466564665746658466594666046661466624666346664466654666646667466684666946670466714667246673466744667546676466774667846679466804668146682466834668446685466864668746688466894669046691466924669346694466954669646697466984669946700467014670246703467044670546706467074670846709467104671146712467134671446715467164671746718467194672046721467224672346724467254672646727467284672946730467314673246733467344673546736467374673846739467404674146742467434674446745467464674746748467494675046751467524675346754467554675646757467584675946760467614676246763467644676546766467674676846769467704677146772467734677446775467764677746778467794678046781467824678346784467854678646787467884678946790467914679246793467944679546796467974679846799468004680146802468034680446805468064680746808468094681046811468124681346814468154681646817468184681946820468214682246823468244682546826468274682846829468304683146832468334683446835468364683746838468394684046841468424684346844468454684646847468484684946850468514685246853468544685546856468574685846859468604686146862468634686446865468664686746868468694687046871468724687346874468754687646877468784687946880468814688246883468844688546886468874688846889468904689146892468934689446895468964689746898468994690046901469024690346904469054690646907469084690946910469114691246913469144691546916469174691846919469204692146922469234692446925469264692746928469294693046931469324693346934469354693646937469384693946940469414694246943469444694546946469474694846949469504695146952469534695446955469564695746958469594696046961469624696346964469654696646967469684696946970469714697246973469744697546976469774697846979469804698146982469834698446985469864698746988469894699046991469924699346994469954699646997469984699947000470014700247003470044700547006470074700847009470104701147012470134701447015470164701747018470194702047021470224702347024470254702647027470284702947030470314703247033470344703547036470374703847039470404704147042470434704447045470464704747048470494705047051470524705347054470554705647057470584705947060470614706247063470644706547066470674706847069470704707147072470734707447075470764707747078470794708047081470824708347084470854708647087470884708947090470914709247093470944709547096470974709847099471004710147102471034710447105471064710747108471094711047111471124711347114471154711647117471184711947120471214712247123471244712547126471274712847129471304713147132471334713447135471364713747138471394714047141471424714347144471454714647147471484714947150471514715247153471544715547156471574715847159471604716147162471634716447165471664716747168471694717047171471724717347174471754717647177471784717947180471814718247183471844718547186471874718847189471904719147192471934719447195471964719747198471994720047201472024720347204472054720647207472084720947210472114721247213472144721547216472174721847219472204722147222472234722447225472264722747228472294723047231472324723347234472354723647237472384723947240472414724247243472444724547246472474724847249472504725147252472534725447255472564725747258472594726047261472624726347264472654726647267472684726947270472714727247273472744727547276472774727847279472804728147282472834728447285472864728747288472894729047291472924729347294472954729647297472984729947300473014730247303473044730547306473074730847309473104731147312473134731447315473164731747318473194732047321473224732347324473254732647327473284732947330473314733247333473344733547336473374733847339473404734147342473434734447345473464734747348473494735047351473524735347354473554735647357473584735947360473614736247363473644736547366473674736847369473704737147372473734737447375473764737747378473794738047381473824738347384473854738647387473884738947390473914739247393473944739547396473974739847399474004740147402474034740447405474064740747408474094741047411474124741347414474154741647417474184741947420474214742247423474244742547426474274742847429474304743147432474334743447435474364743747438474394744047441474424744347444474454744647447474484744947450474514745247453474544745547456474574745847459474604746147462474634746447465474664746747468474694747047471474724747347474474754747647477474784747947480474814748247483474844748547486474874748847489474904749147492474934749447495474964749747498474994750047501475024750347504475054750647507475084750947510475114751247513475144751547516475174751847519475204752147522475234752447525475264752747528475294753047531475324753347534475354753647537475384753947540475414754247543475444754547546475474754847549475504755147552475534755447555475564755747558475594756047561475624756347564475654756647567475684756947570475714757247573475744757547576475774757847579475804758147582475834758447585475864758747588475894759047591475924759347594475954759647597475984759947600476014760247603476044760547606476074760847609476104761147612476134761447615476164761747618476194762047621476224762347624476254762647627476284762947630476314763247633476344763547636476374763847639476404764147642476434764447645476464764747648476494765047651476524765347654476554765647657476584765947660476614766247663476644766547666476674766847669476704767147672476734767447675476764767747678476794768047681476824768347684476854768647687476884768947690476914769247693476944769547696476974769847699477004770147702477034770447705477064770747708477094771047711477124771347714477154771647717477184771947720477214772247723477244772547726477274772847729477304773147732477334773447735477364773747738477394774047741477424774347744477454774647747477484774947750477514775247753477544775547756477574775847759477604776147762477634776447765477664776747768477694777047771477724777347774477754777647777477784777947780477814778247783477844778547786477874778847789477904779147792477934779447795477964779747798477994780047801478024780347804478054780647807478084780947810478114781247813478144781547816478174781847819478204782147822478234782447825478264782747828478294783047831478324783347834478354783647837478384783947840478414784247843478444784547846478474784847849478504785147852478534785447855478564785747858478594786047861478624786347864478654786647867478684786947870478714787247873478744787547876478774787847879478804788147882478834788447885478864788747888478894789047891478924789347894478954789647897478984789947900479014790247903479044790547906479074790847909479104791147912479134791447915479164791747918479194792047921479224792347924479254792647927479284792947930479314793247933479344793547936479374793847939479404794147942479434794447945479464794747948479494795047951479524795347954479554795647957479584795947960479614796247963479644796547966479674796847969479704797147972479734797447975479764797747978479794798047981479824798347984479854798647987479884798947990479914799247993479944799547996479974799847999480004800148002480034800448005480064800748008480094801048011480124801348014480154801648017480184801948020480214802248023480244802548026480274802848029480304803148032480334803448035480364803748038480394804048041480424804348044480454804648047480484804948050480514805248053480544805548056480574805848059480604806148062480634806448065480664806748068480694807048071480724807348074480754807648077480784807948080480814808248083480844808548086480874808848089480904809148092480934809448095480964809748098480994810048101481024810348104481054810648107481084810948110481114811248113481144811548116481174811848119481204812148122481234812448125481264812748128481294813048131481324813348134481354813648137481384813948140481414814248143481444814548146481474814848149481504815148152481534815448155481564815748158481594816048161481624816348164481654816648167481684816948170481714817248173481744817548176481774817848179481804818148182481834818448185481864818748188481894819048191481924819348194481954819648197481984819948200482014820248203482044820548206482074820848209482104821148212482134821448215482164821748218482194822048221482224822348224482254822648227482284822948230482314823248233482344823548236482374823848239482404824148242482434824448245482464824748248482494825048251482524825348254482554825648257482584825948260482614826248263482644826548266482674826848269482704827148272482734827448275482764827748278482794828048281482824828348284482854828648287482884828948290482914829248293482944829548296482974829848299483004830148302483034830448305483064830748308483094831048311483124831348314483154831648317483184831948320483214832248323483244832548326483274832848329483304833148332483334833448335483364833748338483394834048341483424834348344483454834648347483484834948350483514835248353483544835548356483574835848359483604836148362483634836448365483664836748368483694837048371483724837348374483754837648377483784837948380483814838248383483844838548386483874838848389483904839148392483934839448395483964839748398483994840048401484024840348404484054840648407484084840948410484114841248413484144841548416484174841848419484204842148422484234842448425484264842748428484294843048431484324843348434484354843648437484384843948440484414844248443484444844548446484474844848449484504845148452484534845448455484564845748458484594846048461484624846348464484654846648467484684846948470484714847248473484744847548476484774847848479484804848148482484834848448485484864848748488484894849048491484924849348494484954849648497484984849948500485014850248503485044850548506485074850848509485104851148512485134851448515485164851748518485194852048521485224852348524485254852648527485284852948530485314853248533485344853548536485374853848539485404854148542485434854448545485464854748548485494855048551485524855348554485554855648557485584855948560485614856248563485644856548566485674856848569485704857148572485734857448575485764857748578485794858048581485824858348584485854858648587485884858948590485914859248593485944859548596485974859848599486004860148602486034860448605486064860748608486094861048611486124861348614486154861648617486184861948620486214862248623486244862548626486274862848629486304863148632486334863448635486364863748638486394864048641486424864348644486454864648647486484864948650486514865248653486544865548656486574865848659486604866148662486634866448665486664866748668486694867048671486724867348674486754867648677486784867948680486814868248683486844868548686486874868848689486904869148692486934869448695486964869748698486994870048701487024870348704487054870648707487084870948710487114871248713487144871548716487174871848719487204872148722487234872448725487264872748728487294873048731487324873348734487354873648737487384873948740487414874248743487444874548746487474874848749487504875148752487534875448755487564875748758487594876048761487624876348764487654876648767487684876948770487714877248773487744877548776487774877848779487804878148782487834878448785487864878748788487894879048791487924879348794487954879648797487984879948800488014880248803488044880548806488074880848809488104881148812488134881448815488164881748818488194882048821488224882348824488254882648827488284882948830488314883248833488344883548836488374883848839488404884148842488434884448845488464884748848488494885048851488524885348854488554885648857488584885948860488614886248863488644886548866488674886848869488704887148872488734887448875488764887748878488794888048881488824888348884488854888648887488884888948890488914889248893488944889548896488974889848899489004890148902489034890448905489064890748908489094891048911489124891348914489154891648917489184891948920489214892248923489244892548926489274892848929489304893148932489334893448935489364893748938489394894048941489424894348944489454894648947489484894948950489514895248953489544895548956489574895848959489604896148962489634896448965489664896748968489694897048971489724897348974489754897648977489784897948980489814898248983489844898548986489874898848989489904899148992489934899448995489964899748998489994900049001490024900349004490054900649007490084900949010490114901249013490144901549016490174901849019490204902149022490234902449025490264902749028490294903049031490324903349034490354903649037490384903949040490414904249043490444904549046490474904849049490504905149052490534905449055490564905749058490594906049061490624906349064490654906649067490684906949070490714907249073490744907549076490774907849079490804908149082490834908449085490864908749088490894909049091490924909349094490954909649097490984909949100491014910249103491044910549106491074910849109491104911149112491134911449115491164911749118491194912049121491224912349124491254912649127491284912949130491314913249133491344913549136491374913849139491404914149142491434914449145491464914749148491494915049151491524915349154491554915649157491584915949160491614916249163491644916549166491674916849169491704917149172491734917449175491764917749178491794918049181491824918349184491854918649187491884918949190491914919249193491944919549196491974919849199492004920149202492034920449205492064920749208492094921049211492124921349214492154921649217492184921949220492214922249223492244922549226492274922849229492304923149232492334923449235492364923749238492394924049241492424924349244492454924649247492484924949250492514925249253492544925549256492574925849259492604926149262492634926449265492664926749268492694927049271492724927349274492754927649277492784927949280492814928249283492844928549286492874928849289492904929149292492934929449295492964929749298492994930049301493024930349304493054930649307493084930949310493114931249313493144931549316493174931849319493204932149322493234932449325493264932749328493294933049331493324933349334493354933649337493384933949340493414934249343493444934549346493474934849349493504935149352493534935449355493564935749358493594936049361493624936349364493654936649367493684936949370493714937249373493744937549376493774937849379493804938149382493834938449385493864938749388493894939049391493924939349394493954939649397493984939949400494014940249403494044940549406494074940849409494104941149412494134941449415494164941749418494194942049421494224942349424494254942649427494284942949430494314943249433494344943549436494374943849439494404944149442494434944449445494464944749448494494945049451494524945349454494554945649457494584945949460494614946249463494644946549466494674946849469494704947149472494734947449475494764947749478494794948049481494824948349484494854948649487494884948949490494914949249493494944949549496494974949849499495004950149502495034950449505495064950749508495094951049511495124951349514495154951649517495184951949520495214952249523495244952549526495274952849529495304953149532495334953449535495364953749538495394954049541495424954349544495454954649547495484954949550495514955249553495544955549556495574955849559495604956149562495634956449565495664956749568495694957049571495724957349574495754957649577495784957949580495814958249583495844958549586495874958849589495904959149592495934959449595495964959749598495994960049601496024960349604496054960649607496084960949610496114961249613496144961549616496174961849619496204962149622496234962449625496264962749628496294963049631496324963349634496354963649637496384963949640496414964249643496444964549646496474964849649496504965149652496534965449655496564965749658496594966049661496624966349664496654966649667496684966949670496714967249673496744967549676496774967849679496804968149682496834968449685496864968749688496894969049691496924969349694496954969649697496984969949700497014970249703497044970549706497074970849709497104971149712497134971449715497164971749718497194972049721497224972349724497254972649727497284972949730497314973249733497344973549736497374973849739497404974149742497434974449745497464974749748497494975049751497524975349754497554975649757497584975949760497614976249763497644976549766497674976849769497704977149772497734977449775497764977749778497794978049781497824978349784497854978649787497884978949790497914979249793497944979549796497974979849799498004980149802498034980449805498064980749808498094981049811498124981349814498154981649817498184981949820498214982249823498244982549826498274982849829498304983149832498334983449835498364983749838498394984049841498424984349844498454984649847498484984949850498514985249853498544985549856498574985849859498604986149862498634986449865498664986749868498694987049871498724987349874498754987649877498784987949880498814988249883498844988549886498874988849889498904989149892498934989449895498964989749898498994990049901499024990349904499054990649907499084990949910499114991249913499144991549916499174991849919499204992149922499234992449925499264992749928499294993049931499324993349934499354993649937499384993949940499414994249943499444994549946499474994849949499504995149952499534995449955499564995749958499594996049961499624996349964499654996649967499684996949970499714997249973499744997549976499774997849979499804998149982499834998449985499864998749988499894999049991499924999349994499954999649997499984999950000500015000250003500045000550006500075000850009500105001150012500135001450015500165001750018500195002050021500225002350024500255002650027500285002950030500315003250033500345003550036500375003850039500405004150042500435004450045500465004750048500495005050051500525005350054500555005650057500585005950060500615006250063500645006550066500675006850069500705007150072500735007450075500765007750078500795008050081500825008350084500855008650087500885008950090500915009250093500945009550096500975009850099501005010150102501035010450105501065010750108501095011050111501125011350114501155011650117501185011950120501215012250123501245012550126501275012850129501305013150132501335013450135501365013750138501395014050141501425014350144501455014650147501485014950150501515015250153501545015550156501575015850159501605016150162501635016450165501665016750168501695017050171501725017350174501755017650177501785017950180501815018250183501845018550186501875018850189501905019150192501935019450195501965019750198501995020050201502025020350204502055020650207502085020950210502115021250213502145021550216502175021850219502205022150222502235022450225502265022750228502295023050231502325023350234502355023650237502385023950240502415024250243502445024550246502475024850249502505025150252502535025450255502565025750258502595026050261502625026350264502655026650267502685026950270502715027250273502745027550276502775027850279502805028150282502835028450285502865028750288502895029050291502925029350294502955029650297502985029950300503015030250303503045030550306503075030850309503105031150312503135031450315503165031750318503195032050321503225032350324503255032650327503285032950330503315033250333503345033550336503375033850339503405034150342503435034450345503465034750348503495035050351503525035350354503555035650357503585035950360503615036250363503645036550366503675036850369503705037150372503735037450375503765037750378503795038050381503825038350384503855038650387503885038950390503915039250393503945039550396503975039850399504005040150402504035040450405504065040750408504095041050411504125041350414504155041650417504185041950420504215042250423504245042550426504275042850429504305043150432504335043450435504365043750438504395044050441504425044350444504455044650447504485044950450504515045250453504545045550456504575045850459504605046150462504635046450465504665046750468504695047050471504725047350474504755047650477504785047950480504815048250483504845048550486504875048850489504905049150492504935049450495504965049750498504995050050501505025050350504505055050650507505085050950510505115051250513505145051550516505175051850519505205052150522505235052450525505265052750528505295053050531505325053350534505355053650537
  1. /* Copyright 2017 Mozilla Foundation
  2. *
  3. * Licensed under the Apache License, Version 2.0 (the "License");
  4. * you may not use this file except in compliance with the License.
  5. * You may obtain a copy of the License at
  6. *
  7. * http://www.apache.org/licenses/LICENSE-2.0
  8. *
  9. * Unless required by applicable law or agreed to in writing, software
  10. * distributed under the License is distributed on an "AS IS" BASIS,
  11. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  12. * See the License for the specific language governing permissions and
  13. * limitations under the License.
  14. */
  15. (function webpackUniversalModuleDefinition(root, factory) {
  16. if(typeof exports === 'object' && typeof module === 'object')
  17. module.exports = factory();
  18. else if(typeof define === 'function' && define.amd)
  19. define("pdfjs-dist/build/pdf.worker", [], factory);
  20. else if(typeof exports === 'object')
  21. exports["pdfjs-dist/build/pdf.worker"] = factory();
  22. else
  23. root["pdfjs-dist/build/pdf.worker"] = root.pdfjsDistBuildPdfWorker = factory();
  24. })(this, function() {
  25. return /******/ (function(modules) { // webpackBootstrap
  26. /******/ // The module cache
  27. /******/ var installedModules = {};
  28. /******/ // The require function
  29. /******/ function __w_pdfjs_require__(moduleId) {
  30. /******/ // Check if module is in cache
  31. /******/ if(installedModules[moduleId])
  32. /******/ return installedModules[moduleId].exports;
  33. /******/ // Create a new module (and put it into the cache)
  34. /******/ var module = installedModules[moduleId] = {
  35. /******/ i: moduleId,
  36. /******/ l: false,
  37. /******/ exports: {}
  38. /******/ };
  39. /******/ // Execute the module function
  40. /******/ modules[moduleId].call(module.exports, module, module.exports, __w_pdfjs_require__);
  41. /******/ // Flag the module as loaded
  42. /******/ module.l = true;
  43. /******/ // Return the exports of the module
  44. /******/ return module.exports;
  45. /******/ }
  46. /******/ // expose the modules object (__webpack_modules__)
  47. /******/ __w_pdfjs_require__.m = modules;
  48. /******/ // expose the module cache
  49. /******/ __w_pdfjs_require__.c = installedModules;
  50. /******/ // identity function for calling harmony imports with the correct context
  51. /******/ __w_pdfjs_require__.i = function(value) { return value; };
  52. /******/ // define getter function for harmony exports
  53. /******/ __w_pdfjs_require__.d = function(exports, name, getter) {
  54. /******/ if(!__w_pdfjs_require__.o(exports, name)) {
  55. /******/ Object.defineProperty(exports, name, {
  56. /******/ configurable: false,
  57. /******/ enumerable: true,
  58. /******/ get: getter
  59. /******/ });
  60. /******/ }
  61. /******/ };
  62. /******/ // getDefaultExport function for compatibility with non-harmony modules
  63. /******/ __w_pdfjs_require__.n = function(module) {
  64. /******/ var getter = module && module.__esModule ?
  65. /******/ function getDefault() { return module['default']; } :
  66. /******/ function getModuleExports() { return module; };
  67. /******/ __w_pdfjs_require__.d(getter, 'a', getter);
  68. /******/ return getter;
  69. /******/ };
  70. /******/ // Object.prototype.hasOwnProperty.call
  71. /******/ __w_pdfjs_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };
  72. /******/ // __webpack_public_path__
  73. /******/ __w_pdfjs_require__.p = "";
  74. /******/ // Load entry module and return exports
  75. /******/ return __w_pdfjs_require__(__w_pdfjs_require__.s = 36);
  76. /******/ })
  77. /************************************************************************/
  78. /******/ ([
  79. /* 0 */
  80. /***/ (function(module, exports, __w_pdfjs_require__) {
  81. "use strict";
  82. /* WEBPACK VAR INJECTION */(function(global) {
  83. var globalScope = typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : this;
  84. var FONT_IDENTITY_MATRIX = [
  85. 0.001,
  86. 0,
  87. 0,
  88. 0.001,
  89. 0,
  90. 0
  91. ];
  92. var TextRenderingMode = {
  93. FILL: 0,
  94. STROKE: 1,
  95. FILL_STROKE: 2,
  96. INVISIBLE: 3,
  97. FILL_ADD_TO_PATH: 4,
  98. STROKE_ADD_TO_PATH: 5,
  99. FILL_STROKE_ADD_TO_PATH: 6,
  100. ADD_TO_PATH: 7,
  101. FILL_STROKE_MASK: 3,
  102. ADD_TO_PATH_FLAG: 4
  103. };
  104. var ImageKind = {
  105. GRAYSCALE_1BPP: 1,
  106. RGB_24BPP: 2,
  107. RGBA_32BPP: 3
  108. };
  109. var AnnotationType = {
  110. TEXT: 1,
  111. LINK: 2,
  112. FREETEXT: 3,
  113. LINE: 4,
  114. SQUARE: 5,
  115. CIRCLE: 6,
  116. POLYGON: 7,
  117. POLYLINE: 8,
  118. HIGHLIGHT: 9,
  119. UNDERLINE: 10,
  120. SQUIGGLY: 11,
  121. STRIKEOUT: 12,
  122. STAMP: 13,
  123. CARET: 14,
  124. INK: 15,
  125. POPUP: 16,
  126. FILEATTACHMENT: 17,
  127. SOUND: 18,
  128. MOVIE: 19,
  129. WIDGET: 20,
  130. SCREEN: 21,
  131. PRINTERMARK: 22,
  132. TRAPNET: 23,
  133. WATERMARK: 24,
  134. THREED: 25,
  135. REDACT: 26
  136. };
  137. var AnnotationFlag = {
  138. INVISIBLE: 0x01,
  139. HIDDEN: 0x02,
  140. PRINT: 0x04,
  141. NOZOOM: 0x08,
  142. NOROTATE: 0x10,
  143. NOVIEW: 0x20,
  144. READONLY: 0x40,
  145. LOCKED: 0x80,
  146. TOGGLENOVIEW: 0x100,
  147. LOCKEDCONTENTS: 0x200
  148. };
  149. var AnnotationFieldFlag = {
  150. READONLY: 0x0000001,
  151. REQUIRED: 0x0000002,
  152. NOEXPORT: 0x0000004,
  153. MULTILINE: 0x0001000,
  154. PASSWORD: 0x0002000,
  155. NOTOGGLETOOFF: 0x0004000,
  156. RADIO: 0x0008000,
  157. PUSHBUTTON: 0x0010000,
  158. COMBO: 0x0020000,
  159. EDIT: 0x0040000,
  160. SORT: 0x0080000,
  161. FILESELECT: 0x0100000,
  162. MULTISELECT: 0x0200000,
  163. DONOTSPELLCHECK: 0x0400000,
  164. DONOTSCROLL: 0x0800000,
  165. COMB: 0x1000000,
  166. RICHTEXT: 0x2000000,
  167. RADIOSINUNISON: 0x2000000,
  168. COMMITONSELCHANGE: 0x4000000
  169. };
  170. var AnnotationBorderStyleType = {
  171. SOLID: 1,
  172. DASHED: 2,
  173. BEVELED: 3,
  174. INSET: 4,
  175. UNDERLINE: 5
  176. };
  177. var StreamType = {
  178. UNKNOWN: 0,
  179. FLATE: 1,
  180. LZW: 2,
  181. DCT: 3,
  182. JPX: 4,
  183. JBIG: 5,
  184. A85: 6,
  185. AHX: 7,
  186. CCF: 8,
  187. RL: 9
  188. };
  189. var FontType = {
  190. UNKNOWN: 0,
  191. TYPE1: 1,
  192. TYPE1C: 2,
  193. CIDFONTTYPE0: 3,
  194. CIDFONTTYPE0C: 4,
  195. TRUETYPE: 5,
  196. CIDFONTTYPE2: 6,
  197. TYPE3: 7,
  198. OPENTYPE: 8,
  199. TYPE0: 9,
  200. MMTYPE1: 10
  201. };
  202. var VERBOSITY_LEVELS = {
  203. errors: 0,
  204. warnings: 1,
  205. infos: 5
  206. };
  207. var CMapCompressionType = {
  208. NONE: 0,
  209. BINARY: 1,
  210. STREAM: 2
  211. };
  212. var OPS = {
  213. dependency: 1,
  214. setLineWidth: 2,
  215. setLineCap: 3,
  216. setLineJoin: 4,
  217. setMiterLimit: 5,
  218. setDash: 6,
  219. setRenderingIntent: 7,
  220. setFlatness: 8,
  221. setGState: 9,
  222. save: 10,
  223. restore: 11,
  224. transform: 12,
  225. moveTo: 13,
  226. lineTo: 14,
  227. curveTo: 15,
  228. curveTo2: 16,
  229. curveTo3: 17,
  230. closePath: 18,
  231. rectangle: 19,
  232. stroke: 20,
  233. closeStroke: 21,
  234. fill: 22,
  235. eoFill: 23,
  236. fillStroke: 24,
  237. eoFillStroke: 25,
  238. closeFillStroke: 26,
  239. closeEOFillStroke: 27,
  240. endPath: 28,
  241. clip: 29,
  242. eoClip: 30,
  243. beginText: 31,
  244. endText: 32,
  245. setCharSpacing: 33,
  246. setWordSpacing: 34,
  247. setHScale: 35,
  248. setLeading: 36,
  249. setFont: 37,
  250. setTextRenderingMode: 38,
  251. setTextRise: 39,
  252. moveText: 40,
  253. setLeadingMoveText: 41,
  254. setTextMatrix: 42,
  255. nextLine: 43,
  256. showText: 44,
  257. showSpacedText: 45,
  258. nextLineShowText: 46,
  259. nextLineSetSpacingShowText: 47,
  260. setCharWidth: 48,
  261. setCharWidthAndBounds: 49,
  262. setStrokeColorSpace: 50,
  263. setFillColorSpace: 51,
  264. setStrokeColor: 52,
  265. setStrokeColorN: 53,
  266. setFillColor: 54,
  267. setFillColorN: 55,
  268. setStrokeGray: 56,
  269. setFillGray: 57,
  270. setStrokeRGBColor: 58,
  271. setFillRGBColor: 59,
  272. setStrokeCMYKColor: 60,
  273. setFillCMYKColor: 61,
  274. shadingFill: 62,
  275. beginInlineImage: 63,
  276. beginImageData: 64,
  277. endInlineImage: 65,
  278. paintXObject: 66,
  279. markPoint: 67,
  280. markPointProps: 68,
  281. beginMarkedContent: 69,
  282. beginMarkedContentProps: 70,
  283. endMarkedContent: 71,
  284. beginCompat: 72,
  285. endCompat: 73,
  286. paintFormXObjectBegin: 74,
  287. paintFormXObjectEnd: 75,
  288. beginGroup: 76,
  289. endGroup: 77,
  290. beginAnnotations: 78,
  291. endAnnotations: 79,
  292. beginAnnotation: 80,
  293. endAnnotation: 81,
  294. paintJpegXObject: 82,
  295. paintImageMaskXObject: 83,
  296. paintImageMaskXObjectGroup: 84,
  297. paintImageXObject: 85,
  298. paintInlineImageXObject: 86,
  299. paintInlineImageXObjectGroup: 87,
  300. paintImageXObjectRepeat: 88,
  301. paintImageMaskXObjectRepeat: 89,
  302. paintSolidColorImageMask: 90,
  303. constructPath: 91
  304. };
  305. var verbosity = VERBOSITY_LEVELS.warnings;
  306. function setVerbosityLevel(level) {
  307. verbosity = level;
  308. }
  309. function getVerbosityLevel() {
  310. return verbosity;
  311. }
  312. function info(msg) {
  313. if (verbosity >= VERBOSITY_LEVELS.infos) {
  314. console.log('Info: ' + msg);
  315. }
  316. }
  317. function warn(msg) {
  318. if (verbosity >= VERBOSITY_LEVELS.warnings) {
  319. console.log('Warning: ' + msg);
  320. }
  321. }
  322. function deprecated(details) {
  323. console.log('Deprecated API usage: ' + details);
  324. }
  325. function error(msg) {
  326. if (verbosity >= VERBOSITY_LEVELS.errors) {
  327. console.log('Error: ' + msg);
  328. console.log(backtrace());
  329. }
  330. throw new Error(msg);
  331. }
  332. function backtrace() {
  333. try {
  334. throw new Error();
  335. } catch (e) {
  336. return e.stack ? e.stack.split('\n').slice(2).join('\n') : '';
  337. }
  338. }
  339. function assert(cond, msg) {
  340. if (!cond) {
  341. error(msg);
  342. }
  343. }
  344. var UNSUPPORTED_FEATURES = {
  345. unknown: 'unknown',
  346. forms: 'forms',
  347. javaScript: 'javaScript',
  348. smask: 'smask',
  349. shadingPattern: 'shadingPattern',
  350. font: 'font'
  351. };
  352. function isSameOrigin(baseUrl, otherUrl) {
  353. try {
  354. var base = new URL(baseUrl);
  355. if (!base.origin || base.origin === 'null') {
  356. return false;
  357. }
  358. } catch (e) {
  359. return false;
  360. }
  361. var other = new URL(otherUrl, base);
  362. return base.origin === other.origin;
  363. }
  364. function isValidProtocol(url) {
  365. if (!url) {
  366. return false;
  367. }
  368. switch (url.protocol) {
  369. case 'http:':
  370. case 'https:':
  371. case 'ftp:':
  372. case 'mailto:':
  373. case 'tel:':
  374. return true;
  375. default:
  376. return false;
  377. }
  378. }
  379. function createValidAbsoluteUrl(url, baseUrl) {
  380. if (!url) {
  381. return null;
  382. }
  383. try {
  384. var absoluteUrl = baseUrl ? new URL(url, baseUrl) : new URL(url);
  385. if (isValidProtocol(absoluteUrl)) {
  386. return absoluteUrl;
  387. }
  388. } catch (ex) {
  389. }
  390. return null;
  391. }
  392. function shadow(obj, prop, value) {
  393. Object.defineProperty(obj, prop, {
  394. value: value,
  395. enumerable: true,
  396. configurable: true,
  397. writable: false
  398. });
  399. return value;
  400. }
  401. function getLookupTableFactory(initializer) {
  402. var lookup;
  403. return function () {
  404. if (initializer) {
  405. lookup = Object.create(null);
  406. initializer(lookup);
  407. initializer = null;
  408. }
  409. return lookup;
  410. };
  411. }
  412. var PasswordResponses = {
  413. NEED_PASSWORD: 1,
  414. INCORRECT_PASSWORD: 2
  415. };
  416. var PasswordException = function PasswordExceptionClosure() {
  417. function PasswordException(msg, code) {
  418. this.name = 'PasswordException';
  419. this.message = msg;
  420. this.code = code;
  421. }
  422. PasswordException.prototype = new Error();
  423. PasswordException.constructor = PasswordException;
  424. return PasswordException;
  425. }();
  426. var UnknownErrorException = function UnknownErrorExceptionClosure() {
  427. function UnknownErrorException(msg, details) {
  428. this.name = 'UnknownErrorException';
  429. this.message = msg;
  430. this.details = details;
  431. }
  432. UnknownErrorException.prototype = new Error();
  433. UnknownErrorException.constructor = UnknownErrorException;
  434. return UnknownErrorException;
  435. }();
  436. var InvalidPDFException = function InvalidPDFExceptionClosure() {
  437. function InvalidPDFException(msg) {
  438. this.name = 'InvalidPDFException';
  439. this.message = msg;
  440. }
  441. InvalidPDFException.prototype = new Error();
  442. InvalidPDFException.constructor = InvalidPDFException;
  443. return InvalidPDFException;
  444. }();
  445. var MissingPDFException = function MissingPDFExceptionClosure() {
  446. function MissingPDFException(msg) {
  447. this.name = 'MissingPDFException';
  448. this.message = msg;
  449. }
  450. MissingPDFException.prototype = new Error();
  451. MissingPDFException.constructor = MissingPDFException;
  452. return MissingPDFException;
  453. }();
  454. var UnexpectedResponseException = function UnexpectedResponseExceptionClosure() {
  455. function UnexpectedResponseException(msg, status) {
  456. this.name = 'UnexpectedResponseException';
  457. this.message = msg;
  458. this.status = status;
  459. }
  460. UnexpectedResponseException.prototype = new Error();
  461. UnexpectedResponseException.constructor = UnexpectedResponseException;
  462. return UnexpectedResponseException;
  463. }();
  464. var NotImplementedException = function NotImplementedExceptionClosure() {
  465. function NotImplementedException(msg) {
  466. this.message = msg;
  467. }
  468. NotImplementedException.prototype = new Error();
  469. NotImplementedException.prototype.name = 'NotImplementedException';
  470. NotImplementedException.constructor = NotImplementedException;
  471. return NotImplementedException;
  472. }();
  473. var MissingDataException = function MissingDataExceptionClosure() {
  474. function MissingDataException(begin, end) {
  475. this.begin = begin;
  476. this.end = end;
  477. this.message = 'Missing data [' + begin + ', ' + end + ')';
  478. }
  479. MissingDataException.prototype = new Error();
  480. MissingDataException.prototype.name = 'MissingDataException';
  481. MissingDataException.constructor = MissingDataException;
  482. return MissingDataException;
  483. }();
  484. var XRefParseException = function XRefParseExceptionClosure() {
  485. function XRefParseException(msg) {
  486. this.message = msg;
  487. }
  488. XRefParseException.prototype = new Error();
  489. XRefParseException.prototype.name = 'XRefParseException';
  490. XRefParseException.constructor = XRefParseException;
  491. return XRefParseException;
  492. }();
  493. var NullCharactersRegExp = /\x00/g;
  494. function removeNullCharacters(str) {
  495. if (typeof str !== 'string') {
  496. warn('The argument for removeNullCharacters must be a string.');
  497. return str;
  498. }
  499. return str.replace(NullCharactersRegExp, '');
  500. }
  501. function bytesToString(bytes) {
  502. assert(bytes !== null && typeof bytes === 'object' && bytes.length !== undefined, 'Invalid argument for bytesToString');
  503. var length = bytes.length;
  504. var MAX_ARGUMENT_COUNT = 8192;
  505. if (length < MAX_ARGUMENT_COUNT) {
  506. return String.fromCharCode.apply(null, bytes);
  507. }
  508. var strBuf = [];
  509. for (var i = 0; i < length; i += MAX_ARGUMENT_COUNT) {
  510. var chunkEnd = Math.min(i + MAX_ARGUMENT_COUNT, length);
  511. var chunk = bytes.subarray(i, chunkEnd);
  512. strBuf.push(String.fromCharCode.apply(null, chunk));
  513. }
  514. return strBuf.join('');
  515. }
  516. function stringToBytes(str) {
  517. assert(typeof str === 'string', 'Invalid argument for stringToBytes');
  518. var length = str.length;
  519. var bytes = new Uint8Array(length);
  520. for (var i = 0; i < length; ++i) {
  521. bytes[i] = str.charCodeAt(i) & 0xFF;
  522. }
  523. return bytes;
  524. }
  525. function arrayByteLength(arr) {
  526. if (arr.length !== undefined) {
  527. return arr.length;
  528. }
  529. assert(arr.byteLength !== undefined);
  530. return arr.byteLength;
  531. }
  532. function arraysToBytes(arr) {
  533. if (arr.length === 1 && arr[0] instanceof Uint8Array) {
  534. return arr[0];
  535. }
  536. var resultLength = 0;
  537. var i, ii = arr.length;
  538. var item, itemLength;
  539. for (i = 0; i < ii; i++) {
  540. item = arr[i];
  541. itemLength = arrayByteLength(item);
  542. resultLength += itemLength;
  543. }
  544. var pos = 0;
  545. var data = new Uint8Array(resultLength);
  546. for (i = 0; i < ii; i++) {
  547. item = arr[i];
  548. if (!(item instanceof Uint8Array)) {
  549. if (typeof item === 'string') {
  550. item = stringToBytes(item);
  551. } else {
  552. item = new Uint8Array(item);
  553. }
  554. }
  555. itemLength = item.byteLength;
  556. data.set(item, pos);
  557. pos += itemLength;
  558. }
  559. return data;
  560. }
  561. function string32(value) {
  562. return String.fromCharCode(value >> 24 & 0xff, value >> 16 & 0xff, value >> 8 & 0xff, value & 0xff);
  563. }
  564. function log2(x) {
  565. var n = 1, i = 0;
  566. while (x > n) {
  567. n <<= 1;
  568. i++;
  569. }
  570. return i;
  571. }
  572. function readInt8(data, start) {
  573. return data[start] << 24 >> 24;
  574. }
  575. function readUint16(data, offset) {
  576. return data[offset] << 8 | data[offset + 1];
  577. }
  578. function readUint32(data, offset) {
  579. return (data[offset] << 24 | data[offset + 1] << 16 | data[offset + 2] << 8 | data[offset + 3]) >>> 0;
  580. }
  581. function isLittleEndian() {
  582. var buffer8 = new Uint8Array(2);
  583. buffer8[0] = 1;
  584. var buffer16 = new Uint16Array(buffer8.buffer);
  585. return buffer16[0] === 1;
  586. }
  587. function isEvalSupported() {
  588. try {
  589. new Function('');
  590. return true;
  591. } catch (e) {
  592. return false;
  593. }
  594. }
  595. var Uint32ArrayView = function Uint32ArrayViewClosure() {
  596. function Uint32ArrayView(buffer, length) {
  597. this.buffer = buffer;
  598. this.byteLength = buffer.length;
  599. this.length = length === undefined ? this.byteLength >> 2 : length;
  600. ensureUint32ArrayViewProps(this.length);
  601. }
  602. Uint32ArrayView.prototype = Object.create(null);
  603. var uint32ArrayViewSetters = 0;
  604. function createUint32ArrayProp(index) {
  605. return {
  606. get: function () {
  607. var buffer = this.buffer, offset = index << 2;
  608. return (buffer[offset] | buffer[offset + 1] << 8 | buffer[offset + 2] << 16 | buffer[offset + 3] << 24) >>> 0;
  609. },
  610. set: function (value) {
  611. var buffer = this.buffer, offset = index << 2;
  612. buffer[offset] = value & 255;
  613. buffer[offset + 1] = value >> 8 & 255;
  614. buffer[offset + 2] = value >> 16 & 255;
  615. buffer[offset + 3] = value >>> 24 & 255;
  616. }
  617. };
  618. }
  619. function ensureUint32ArrayViewProps(length) {
  620. while (uint32ArrayViewSetters < length) {
  621. Object.defineProperty(Uint32ArrayView.prototype, uint32ArrayViewSetters, createUint32ArrayProp(uint32ArrayViewSetters));
  622. uint32ArrayViewSetters++;
  623. }
  624. }
  625. return Uint32ArrayView;
  626. }();
  627. exports.Uint32ArrayView = Uint32ArrayView;
  628. var IDENTITY_MATRIX = [
  629. 1,
  630. 0,
  631. 0,
  632. 1,
  633. 0,
  634. 0
  635. ];
  636. var Util = function UtilClosure() {
  637. function Util() {
  638. }
  639. var rgbBuf = [
  640. 'rgb(',
  641. 0,
  642. ',',
  643. 0,
  644. ',',
  645. 0,
  646. ')'
  647. ];
  648. Util.makeCssRgb = function Util_makeCssRgb(r, g, b) {
  649. rgbBuf[1] = r;
  650. rgbBuf[3] = g;
  651. rgbBuf[5] = b;
  652. return rgbBuf.join('');
  653. };
  654. Util.transform = function Util_transform(m1, m2) {
  655. return [
  656. m1[0] * m2[0] + m1[2] * m2[1],
  657. m1[1] * m2[0] + m1[3] * m2[1],
  658. m1[0] * m2[2] + m1[2] * m2[3],
  659. m1[1] * m2[2] + m1[3] * m2[3],
  660. m1[0] * m2[4] + m1[2] * m2[5] + m1[4],
  661. m1[1] * m2[4] + m1[3] * m2[5] + m1[5]
  662. ];
  663. };
  664. Util.applyTransform = function Util_applyTransform(p, m) {
  665. var xt = p[0] * m[0] + p[1] * m[2] + m[4];
  666. var yt = p[0] * m[1] + p[1] * m[3] + m[5];
  667. return [
  668. xt,
  669. yt
  670. ];
  671. };
  672. Util.applyInverseTransform = function Util_applyInverseTransform(p, m) {
  673. var d = m[0] * m[3] - m[1] * m[2];
  674. var xt = (p[0] * m[3] - p[1] * m[2] + m[2] * m[5] - m[4] * m[3]) / d;
  675. var yt = (-p[0] * m[1] + p[1] * m[0] + m[4] * m[1] - m[5] * m[0]) / d;
  676. return [
  677. xt,
  678. yt
  679. ];
  680. };
  681. Util.getAxialAlignedBoundingBox = function Util_getAxialAlignedBoundingBox(r, m) {
  682. var p1 = Util.applyTransform(r, m);
  683. var p2 = Util.applyTransform(r.slice(2, 4), m);
  684. var p3 = Util.applyTransform([
  685. r[0],
  686. r[3]
  687. ], m);
  688. var p4 = Util.applyTransform([
  689. r[2],
  690. r[1]
  691. ], m);
  692. return [
  693. Math.min(p1[0], p2[0], p3[0], p4[0]),
  694. Math.min(p1[1], p2[1], p3[1], p4[1]),
  695. Math.max(p1[0], p2[0], p3[0], p4[0]),
  696. Math.max(p1[1], p2[1], p3[1], p4[1])
  697. ];
  698. };
  699. Util.inverseTransform = function Util_inverseTransform(m) {
  700. var d = m[0] * m[3] - m[1] * m[2];
  701. return [
  702. m[3] / d,
  703. -m[1] / d,
  704. -m[2] / d,
  705. m[0] / d,
  706. (m[2] * m[5] - m[4] * m[3]) / d,
  707. (m[4] * m[1] - m[5] * m[0]) / d
  708. ];
  709. };
  710. Util.apply3dTransform = function Util_apply3dTransform(m, v) {
  711. return [
  712. m[0] * v[0] + m[1] * v[1] + m[2] * v[2],
  713. m[3] * v[0] + m[4] * v[1] + m[5] * v[2],
  714. m[6] * v[0] + m[7] * v[1] + m[8] * v[2]
  715. ];
  716. };
  717. Util.singularValueDecompose2dScale = function Util_singularValueDecompose2dScale(m) {
  718. var transpose = [
  719. m[0],
  720. m[2],
  721. m[1],
  722. m[3]
  723. ];
  724. var a = m[0] * transpose[0] + m[1] * transpose[2];
  725. var b = m[0] * transpose[1] + m[1] * transpose[3];
  726. var c = m[2] * transpose[0] + m[3] * transpose[2];
  727. var d = m[2] * transpose[1] + m[3] * transpose[3];
  728. var first = (a + d) / 2;
  729. var second = Math.sqrt((a + d) * (a + d) - 4 * (a * d - c * b)) / 2;
  730. var sx = first + second || 1;
  731. var sy = first - second || 1;
  732. return [
  733. Math.sqrt(sx),
  734. Math.sqrt(sy)
  735. ];
  736. };
  737. Util.normalizeRect = function Util_normalizeRect(rect) {
  738. var r = rect.slice(0);
  739. if (rect[0] > rect[2]) {
  740. r[0] = rect[2];
  741. r[2] = rect[0];
  742. }
  743. if (rect[1] > rect[3]) {
  744. r[1] = rect[3];
  745. r[3] = rect[1];
  746. }
  747. return r;
  748. };
  749. Util.intersect = function Util_intersect(rect1, rect2) {
  750. function compare(a, b) {
  751. return a - b;
  752. }
  753. var orderedX = [
  754. rect1[0],
  755. rect1[2],
  756. rect2[0],
  757. rect2[2]
  758. ].sort(compare), orderedY = [
  759. rect1[1],
  760. rect1[3],
  761. rect2[1],
  762. rect2[3]
  763. ].sort(compare), result = [];
  764. rect1 = Util.normalizeRect(rect1);
  765. rect2 = Util.normalizeRect(rect2);
  766. if (orderedX[0] === rect1[0] && orderedX[1] === rect2[0] || orderedX[0] === rect2[0] && orderedX[1] === rect1[0]) {
  767. result[0] = orderedX[1];
  768. result[2] = orderedX[2];
  769. } else {
  770. return false;
  771. }
  772. if (orderedY[0] === rect1[1] && orderedY[1] === rect2[1] || orderedY[0] === rect2[1] && orderedY[1] === rect1[1]) {
  773. result[1] = orderedY[1];
  774. result[3] = orderedY[2];
  775. } else {
  776. return false;
  777. }
  778. return result;
  779. };
  780. Util.sign = function Util_sign(num) {
  781. return num < 0 ? -1 : 1;
  782. };
  783. var ROMAN_NUMBER_MAP = [
  784. '',
  785. 'C',
  786. 'CC',
  787. 'CCC',
  788. 'CD',
  789. 'D',
  790. 'DC',
  791. 'DCC',
  792. 'DCCC',
  793. 'CM',
  794. '',
  795. 'X',
  796. 'XX',
  797. 'XXX',
  798. 'XL',
  799. 'L',
  800. 'LX',
  801. 'LXX',
  802. 'LXXX',
  803. 'XC',
  804. '',
  805. 'I',
  806. 'II',
  807. 'III',
  808. 'IV',
  809. 'V',
  810. 'VI',
  811. 'VII',
  812. 'VIII',
  813. 'IX'
  814. ];
  815. Util.toRoman = function Util_toRoman(number, lowerCase) {
  816. assert(isInt(number) && number > 0, 'The number should be a positive integer.');
  817. var pos, romanBuf = [];
  818. while (number >= 1000) {
  819. number -= 1000;
  820. romanBuf.push('M');
  821. }
  822. pos = number / 100 | 0;
  823. number %= 100;
  824. romanBuf.push(ROMAN_NUMBER_MAP[pos]);
  825. pos = number / 10 | 0;
  826. number %= 10;
  827. romanBuf.push(ROMAN_NUMBER_MAP[10 + pos]);
  828. romanBuf.push(ROMAN_NUMBER_MAP[20 + number]);
  829. var romanStr = romanBuf.join('');
  830. return lowerCase ? romanStr.toLowerCase() : romanStr;
  831. };
  832. Util.appendToArray = function Util_appendToArray(arr1, arr2) {
  833. Array.prototype.push.apply(arr1, arr2);
  834. };
  835. Util.prependToArray = function Util_prependToArray(arr1, arr2) {
  836. Array.prototype.unshift.apply(arr1, arr2);
  837. };
  838. Util.extendObj = function extendObj(obj1, obj2) {
  839. for (var key in obj2) {
  840. obj1[key] = obj2[key];
  841. }
  842. };
  843. Util.getInheritableProperty = function Util_getInheritableProperty(dict, name, getArray) {
  844. while (dict && !dict.has(name)) {
  845. dict = dict.get('Parent');
  846. }
  847. if (!dict) {
  848. return null;
  849. }
  850. return getArray ? dict.getArray(name) : dict.get(name);
  851. };
  852. Util.inherit = function Util_inherit(sub, base, prototype) {
  853. sub.prototype = Object.create(base.prototype);
  854. sub.prototype.constructor = sub;
  855. for (var prop in prototype) {
  856. sub.prototype[prop] = prototype[prop];
  857. }
  858. };
  859. Util.loadScript = function Util_loadScript(src, callback) {
  860. var script = document.createElement('script');
  861. var loaded = false;
  862. script.setAttribute('src', src);
  863. if (callback) {
  864. script.onload = function () {
  865. if (!loaded) {
  866. callback();
  867. }
  868. loaded = true;
  869. };
  870. }
  871. document.getElementsByTagName('head')[0].appendChild(script);
  872. };
  873. return Util;
  874. }();
  875. var PageViewport = function PageViewportClosure() {
  876. function PageViewport(viewBox, scale, rotation, offsetX, offsetY, dontFlip) {
  877. this.viewBox = viewBox;
  878. this.scale = scale;
  879. this.rotation = rotation;
  880. this.offsetX = offsetX;
  881. this.offsetY = offsetY;
  882. var centerX = (viewBox[2] + viewBox[0]) / 2;
  883. var centerY = (viewBox[3] + viewBox[1]) / 2;
  884. var rotateA, rotateB, rotateC, rotateD;
  885. rotation = rotation % 360;
  886. rotation = rotation < 0 ? rotation + 360 : rotation;
  887. switch (rotation) {
  888. case 180:
  889. rotateA = -1;
  890. rotateB = 0;
  891. rotateC = 0;
  892. rotateD = 1;
  893. break;
  894. case 90:
  895. rotateA = 0;
  896. rotateB = 1;
  897. rotateC = 1;
  898. rotateD = 0;
  899. break;
  900. case 270:
  901. rotateA = 0;
  902. rotateB = -1;
  903. rotateC = -1;
  904. rotateD = 0;
  905. break;
  906. default:
  907. rotateA = 1;
  908. rotateB = 0;
  909. rotateC = 0;
  910. rotateD = -1;
  911. break;
  912. }
  913. if (dontFlip) {
  914. rotateC = -rotateC;
  915. rotateD = -rotateD;
  916. }
  917. var offsetCanvasX, offsetCanvasY;
  918. var width, height;
  919. if (rotateA === 0) {
  920. offsetCanvasX = Math.abs(centerY - viewBox[1]) * scale + offsetX;
  921. offsetCanvasY = Math.abs(centerX - viewBox[0]) * scale + offsetY;
  922. width = Math.abs(viewBox[3] - viewBox[1]) * scale;
  923. height = Math.abs(viewBox[2] - viewBox[0]) * scale;
  924. } else {
  925. offsetCanvasX = Math.abs(centerX - viewBox[0]) * scale + offsetX;
  926. offsetCanvasY = Math.abs(centerY - viewBox[1]) * scale + offsetY;
  927. width = Math.abs(viewBox[2] - viewBox[0]) * scale;
  928. height = Math.abs(viewBox[3] - viewBox[1]) * scale;
  929. }
  930. this.transform = [
  931. rotateA * scale,
  932. rotateB * scale,
  933. rotateC * scale,
  934. rotateD * scale,
  935. offsetCanvasX - rotateA * scale * centerX - rotateC * scale * centerY,
  936. offsetCanvasY - rotateB * scale * centerX - rotateD * scale * centerY
  937. ];
  938. this.width = width;
  939. this.height = height;
  940. this.fontScale = scale;
  941. }
  942. PageViewport.prototype = {
  943. clone: function PageViewPort_clone(args) {
  944. args = args || {};
  945. var scale = 'scale' in args ? args.scale : this.scale;
  946. var rotation = 'rotation' in args ? args.rotation : this.rotation;
  947. return new PageViewport(this.viewBox.slice(), scale, rotation, this.offsetX, this.offsetY, args.dontFlip);
  948. },
  949. convertToViewportPoint: function PageViewport_convertToViewportPoint(x, y) {
  950. return Util.applyTransform([
  951. x,
  952. y
  953. ], this.transform);
  954. },
  955. convertToViewportRectangle: function PageViewport_convertToViewportRectangle(rect) {
  956. var tl = Util.applyTransform([
  957. rect[0],
  958. rect[1]
  959. ], this.transform);
  960. var br = Util.applyTransform([
  961. rect[2],
  962. rect[3]
  963. ], this.transform);
  964. return [
  965. tl[0],
  966. tl[1],
  967. br[0],
  968. br[1]
  969. ];
  970. },
  971. convertToPdfPoint: function PageViewport_convertToPdfPoint(x, y) {
  972. return Util.applyInverseTransform([
  973. x,
  974. y
  975. ], this.transform);
  976. }
  977. };
  978. return PageViewport;
  979. }();
  980. var PDFStringTranslateTable = [
  981. 0,
  982. 0,
  983. 0,
  984. 0,
  985. 0,
  986. 0,
  987. 0,
  988. 0,
  989. 0,
  990. 0,
  991. 0,
  992. 0,
  993. 0,
  994. 0,
  995. 0,
  996. 0,
  997. 0,
  998. 0,
  999. 0,
  1000. 0,
  1001. 0,
  1002. 0,
  1003. 0,
  1004. 0,
  1005. 0x2D8,
  1006. 0x2C7,
  1007. 0x2C6,
  1008. 0x2D9,
  1009. 0x2DD,
  1010. 0x2DB,
  1011. 0x2DA,
  1012. 0x2DC,
  1013. 0,
  1014. 0,
  1015. 0,
  1016. 0,
  1017. 0,
  1018. 0,
  1019. 0,
  1020. 0,
  1021. 0,
  1022. 0,
  1023. 0,
  1024. 0,
  1025. 0,
  1026. 0,
  1027. 0,
  1028. 0,
  1029. 0,
  1030. 0,
  1031. 0,
  1032. 0,
  1033. 0,
  1034. 0,
  1035. 0,
  1036. 0,
  1037. 0,
  1038. 0,
  1039. 0,
  1040. 0,
  1041. 0,
  1042. 0,
  1043. 0,
  1044. 0,
  1045. 0,
  1046. 0,
  1047. 0,
  1048. 0,
  1049. 0,
  1050. 0,
  1051. 0,
  1052. 0,
  1053. 0,
  1054. 0,
  1055. 0,
  1056. 0,
  1057. 0,
  1058. 0,
  1059. 0,
  1060. 0,
  1061. 0,
  1062. 0,
  1063. 0,
  1064. 0,
  1065. 0,
  1066. 0,
  1067. 0,
  1068. 0,
  1069. 0,
  1070. 0,
  1071. 0,
  1072. 0,
  1073. 0,
  1074. 0,
  1075. 0,
  1076. 0,
  1077. 0,
  1078. 0,
  1079. 0,
  1080. 0,
  1081. 0,
  1082. 0,
  1083. 0,
  1084. 0,
  1085. 0,
  1086. 0,
  1087. 0,
  1088. 0,
  1089. 0,
  1090. 0,
  1091. 0,
  1092. 0,
  1093. 0,
  1094. 0,
  1095. 0,
  1096. 0,
  1097. 0,
  1098. 0,
  1099. 0,
  1100. 0,
  1101. 0,
  1102. 0,
  1103. 0,
  1104. 0,
  1105. 0,
  1106. 0,
  1107. 0,
  1108. 0,
  1109. 0x2022,
  1110. 0x2020,
  1111. 0x2021,
  1112. 0x2026,
  1113. 0x2014,
  1114. 0x2013,
  1115. 0x192,
  1116. 0x2044,
  1117. 0x2039,
  1118. 0x203A,
  1119. 0x2212,
  1120. 0x2030,
  1121. 0x201E,
  1122. 0x201C,
  1123. 0x201D,
  1124. 0x2018,
  1125. 0x2019,
  1126. 0x201A,
  1127. 0x2122,
  1128. 0xFB01,
  1129. 0xFB02,
  1130. 0x141,
  1131. 0x152,
  1132. 0x160,
  1133. 0x178,
  1134. 0x17D,
  1135. 0x131,
  1136. 0x142,
  1137. 0x153,
  1138. 0x161,
  1139. 0x17E,
  1140. 0,
  1141. 0x20AC
  1142. ];
  1143. function stringToPDFString(str) {
  1144. var i, n = str.length, strBuf = [];
  1145. if (str[0] === '\xFE' && str[1] === '\xFF') {
  1146. for (i = 2; i < n; i += 2) {
  1147. strBuf.push(String.fromCharCode(str.charCodeAt(i) << 8 | str.charCodeAt(i + 1)));
  1148. }
  1149. } else {
  1150. for (i = 0; i < n; ++i) {
  1151. var code = PDFStringTranslateTable[str.charCodeAt(i)];
  1152. strBuf.push(code ? String.fromCharCode(code) : str.charAt(i));
  1153. }
  1154. }
  1155. return strBuf.join('');
  1156. }
  1157. function stringToUTF8String(str) {
  1158. return decodeURIComponent(escape(str));
  1159. }
  1160. function utf8StringToString(str) {
  1161. return unescape(encodeURIComponent(str));
  1162. }
  1163. function isEmptyObj(obj) {
  1164. for (var key in obj) {
  1165. return false;
  1166. }
  1167. return true;
  1168. }
  1169. function isBool(v) {
  1170. return typeof v === 'boolean';
  1171. }
  1172. function isInt(v) {
  1173. return typeof v === 'number' && (v | 0) === v;
  1174. }
  1175. function isNum(v) {
  1176. return typeof v === 'number';
  1177. }
  1178. function isString(v) {
  1179. return typeof v === 'string';
  1180. }
  1181. function isArray(v) {
  1182. return v instanceof Array;
  1183. }
  1184. function isArrayBuffer(v) {
  1185. return typeof v === 'object' && v !== null && v.byteLength !== undefined;
  1186. }
  1187. function isSpace(ch) {
  1188. return ch === 0x20 || ch === 0x09 || ch === 0x0D || ch === 0x0A;
  1189. }
  1190. function isNodeJS() {
  1191. if (typeof __pdfjsdev_webpack__ === 'undefined') {
  1192. return typeof process === 'object' && process + '' === '[object process]';
  1193. }
  1194. return false;
  1195. }
  1196. function createPromiseCapability() {
  1197. var capability = {};
  1198. capability.promise = new Promise(function (resolve, reject) {
  1199. capability.resolve = resolve;
  1200. capability.reject = reject;
  1201. });
  1202. return capability;
  1203. }
  1204. (function PromiseClosure() {
  1205. if (globalScope.Promise) {
  1206. if (typeof globalScope.Promise.all !== 'function') {
  1207. globalScope.Promise.all = function (iterable) {
  1208. var count = 0, results = [], resolve, reject;
  1209. var promise = new globalScope.Promise(function (resolve_, reject_) {
  1210. resolve = resolve_;
  1211. reject = reject_;
  1212. });
  1213. iterable.forEach(function (p, i) {
  1214. count++;
  1215. p.then(function (result) {
  1216. results[i] = result;
  1217. count--;
  1218. if (count === 0) {
  1219. resolve(results);
  1220. }
  1221. }, reject);
  1222. });
  1223. if (count === 0) {
  1224. resolve(results);
  1225. }
  1226. return promise;
  1227. };
  1228. }
  1229. if (typeof globalScope.Promise.resolve !== 'function') {
  1230. globalScope.Promise.resolve = function (value) {
  1231. return new globalScope.Promise(function (resolve) {
  1232. resolve(value);
  1233. });
  1234. };
  1235. }
  1236. if (typeof globalScope.Promise.reject !== 'function') {
  1237. globalScope.Promise.reject = function (reason) {
  1238. return new globalScope.Promise(function (resolve, reject) {
  1239. reject(reason);
  1240. });
  1241. };
  1242. }
  1243. if (typeof globalScope.Promise.prototype.catch !== 'function') {
  1244. globalScope.Promise.prototype.catch = function (onReject) {
  1245. return globalScope.Promise.prototype.then(undefined, onReject);
  1246. };
  1247. }
  1248. return;
  1249. }
  1250. var STATUS_PENDING = 0;
  1251. var STATUS_RESOLVED = 1;
  1252. var STATUS_REJECTED = 2;
  1253. var REJECTION_TIMEOUT = 500;
  1254. var HandlerManager = {
  1255. handlers: [],
  1256. running: false,
  1257. unhandledRejections: [],
  1258. pendingRejectionCheck: false,
  1259. scheduleHandlers: function scheduleHandlers(promise) {
  1260. if (promise._status === STATUS_PENDING) {
  1261. return;
  1262. }
  1263. this.handlers = this.handlers.concat(promise._handlers);
  1264. promise._handlers = [];
  1265. if (this.running) {
  1266. return;
  1267. }
  1268. this.running = true;
  1269. setTimeout(this.runHandlers.bind(this), 0);
  1270. },
  1271. runHandlers: function runHandlers() {
  1272. var RUN_TIMEOUT = 1;
  1273. var timeoutAt = Date.now() + RUN_TIMEOUT;
  1274. while (this.handlers.length > 0) {
  1275. var handler = this.handlers.shift();
  1276. var nextStatus = handler.thisPromise._status;
  1277. var nextValue = handler.thisPromise._value;
  1278. try {
  1279. if (nextStatus === STATUS_RESOLVED) {
  1280. if (typeof handler.onResolve === 'function') {
  1281. nextValue = handler.onResolve(nextValue);
  1282. }
  1283. } else if (typeof handler.onReject === 'function') {
  1284. nextValue = handler.onReject(nextValue);
  1285. nextStatus = STATUS_RESOLVED;
  1286. if (handler.thisPromise._unhandledRejection) {
  1287. this.removeUnhandeledRejection(handler.thisPromise);
  1288. }
  1289. }
  1290. } catch (ex) {
  1291. nextStatus = STATUS_REJECTED;
  1292. nextValue = ex;
  1293. }
  1294. handler.nextPromise._updateStatus(nextStatus, nextValue);
  1295. if (Date.now() >= timeoutAt) {
  1296. break;
  1297. }
  1298. }
  1299. if (this.handlers.length > 0) {
  1300. setTimeout(this.runHandlers.bind(this), 0);
  1301. return;
  1302. }
  1303. this.running = false;
  1304. },
  1305. addUnhandledRejection: function addUnhandledRejection(promise) {
  1306. this.unhandledRejections.push({
  1307. promise: promise,
  1308. time: Date.now()
  1309. });
  1310. this.scheduleRejectionCheck();
  1311. },
  1312. removeUnhandeledRejection: function removeUnhandeledRejection(promise) {
  1313. promise._unhandledRejection = false;
  1314. for (var i = 0; i < this.unhandledRejections.length; i++) {
  1315. if (this.unhandledRejections[i].promise === promise) {
  1316. this.unhandledRejections.splice(i);
  1317. i--;
  1318. }
  1319. }
  1320. },
  1321. scheduleRejectionCheck: function scheduleRejectionCheck() {
  1322. if (this.pendingRejectionCheck) {
  1323. return;
  1324. }
  1325. this.pendingRejectionCheck = true;
  1326. setTimeout(function rejectionCheck() {
  1327. this.pendingRejectionCheck = false;
  1328. var now = Date.now();
  1329. for (var i = 0; i < this.unhandledRejections.length; i++) {
  1330. if (now - this.unhandledRejections[i].time > REJECTION_TIMEOUT) {
  1331. var unhandled = this.unhandledRejections[i].promise._value;
  1332. var msg = 'Unhandled rejection: ' + unhandled;
  1333. if (unhandled.stack) {
  1334. msg += '\n' + unhandled.stack;
  1335. }
  1336. warn(msg);
  1337. this.unhandledRejections.splice(i);
  1338. i--;
  1339. }
  1340. }
  1341. if (this.unhandledRejections.length) {
  1342. this.scheduleRejectionCheck();
  1343. }
  1344. }.bind(this), REJECTION_TIMEOUT);
  1345. }
  1346. };
  1347. var Promise = function Promise(resolver) {
  1348. this._status = STATUS_PENDING;
  1349. this._handlers = [];
  1350. try {
  1351. resolver.call(this, this._resolve.bind(this), this._reject.bind(this));
  1352. } catch (e) {
  1353. this._reject(e);
  1354. }
  1355. };
  1356. Promise.all = function Promise_all(promises) {
  1357. var resolveAll, rejectAll;
  1358. var deferred = new Promise(function (resolve, reject) {
  1359. resolveAll = resolve;
  1360. rejectAll = reject;
  1361. });
  1362. var unresolved = promises.length;
  1363. var results = [];
  1364. if (unresolved === 0) {
  1365. resolveAll(results);
  1366. return deferred;
  1367. }
  1368. function reject(reason) {
  1369. if (deferred._status === STATUS_REJECTED) {
  1370. return;
  1371. }
  1372. results = [];
  1373. rejectAll(reason);
  1374. }
  1375. for (var i = 0, ii = promises.length; i < ii; ++i) {
  1376. var promise = promises[i];
  1377. var resolve = function (i) {
  1378. return function (value) {
  1379. if (deferred._status === STATUS_REJECTED) {
  1380. return;
  1381. }
  1382. results[i] = value;
  1383. unresolved--;
  1384. if (unresolved === 0) {
  1385. resolveAll(results);
  1386. }
  1387. };
  1388. }(i);
  1389. if (Promise.isPromise(promise)) {
  1390. promise.then(resolve, reject);
  1391. } else {
  1392. resolve(promise);
  1393. }
  1394. }
  1395. return deferred;
  1396. };
  1397. Promise.isPromise = function Promise_isPromise(value) {
  1398. return value && typeof value.then === 'function';
  1399. };
  1400. Promise.resolve = function Promise_resolve(value) {
  1401. return new Promise(function (resolve) {
  1402. resolve(value);
  1403. });
  1404. };
  1405. Promise.reject = function Promise_reject(reason) {
  1406. return new Promise(function (resolve, reject) {
  1407. reject(reason);
  1408. });
  1409. };
  1410. Promise.prototype = {
  1411. _status: null,
  1412. _value: null,
  1413. _handlers: null,
  1414. _unhandledRejection: null,
  1415. _updateStatus: function Promise__updateStatus(status, value) {
  1416. if (this._status === STATUS_RESOLVED || this._status === STATUS_REJECTED) {
  1417. return;
  1418. }
  1419. if (status === STATUS_RESOLVED && Promise.isPromise(value)) {
  1420. value.then(this._updateStatus.bind(this, STATUS_RESOLVED), this._updateStatus.bind(this, STATUS_REJECTED));
  1421. return;
  1422. }
  1423. this._status = status;
  1424. this._value = value;
  1425. if (status === STATUS_REJECTED && this._handlers.length === 0) {
  1426. this._unhandledRejection = true;
  1427. HandlerManager.addUnhandledRejection(this);
  1428. }
  1429. HandlerManager.scheduleHandlers(this);
  1430. },
  1431. _resolve: function Promise_resolve(value) {
  1432. this._updateStatus(STATUS_RESOLVED, value);
  1433. },
  1434. _reject: function Promise_reject(reason) {
  1435. this._updateStatus(STATUS_REJECTED, reason);
  1436. },
  1437. then: function Promise_then(onResolve, onReject) {
  1438. var nextPromise = new Promise(function (resolve, reject) {
  1439. this.resolve = resolve;
  1440. this.reject = reject;
  1441. });
  1442. this._handlers.push({
  1443. thisPromise: this,
  1444. onResolve: onResolve,
  1445. onReject: onReject,
  1446. nextPromise: nextPromise
  1447. });
  1448. HandlerManager.scheduleHandlers(this);
  1449. return nextPromise;
  1450. },
  1451. catch: function Promise_catch(onReject) {
  1452. return this.then(undefined, onReject);
  1453. }
  1454. };
  1455. globalScope.Promise = Promise;
  1456. }());
  1457. (function WeakMapClosure() {
  1458. if (globalScope.WeakMap) {
  1459. return;
  1460. }
  1461. var id = 0;
  1462. function WeakMap() {
  1463. this.id = '$weakmap' + id++;
  1464. }
  1465. WeakMap.prototype = {
  1466. has: function (obj) {
  1467. return !!Object.getOwnPropertyDescriptor(obj, this.id);
  1468. },
  1469. get: function (obj, defaultValue) {
  1470. return this.has(obj) ? obj[this.id] : defaultValue;
  1471. },
  1472. set: function (obj, value) {
  1473. Object.defineProperty(obj, this.id, {
  1474. value: value,
  1475. enumerable: false,
  1476. configurable: true
  1477. });
  1478. },
  1479. delete: function (obj) {
  1480. delete obj[this.id];
  1481. }
  1482. };
  1483. globalScope.WeakMap = WeakMap;
  1484. }());
  1485. var StatTimer = function StatTimerClosure() {
  1486. function rpad(str, pad, length) {
  1487. while (str.length < length) {
  1488. str += pad;
  1489. }
  1490. return str;
  1491. }
  1492. function StatTimer() {
  1493. this.started = Object.create(null);
  1494. this.times = [];
  1495. this.enabled = true;
  1496. }
  1497. StatTimer.prototype = {
  1498. time: function StatTimer_time(name) {
  1499. if (!this.enabled) {
  1500. return;
  1501. }
  1502. if (name in this.started) {
  1503. warn('Timer is already running for ' + name);
  1504. }
  1505. this.started[name] = Date.now();
  1506. },
  1507. timeEnd: function StatTimer_timeEnd(name) {
  1508. if (!this.enabled) {
  1509. return;
  1510. }
  1511. if (!(name in this.started)) {
  1512. warn('Timer has not been started for ' + name);
  1513. }
  1514. this.times.push({
  1515. 'name': name,
  1516. 'start': this.started[name],
  1517. 'end': Date.now()
  1518. });
  1519. delete this.started[name];
  1520. },
  1521. toString: function StatTimer_toString() {
  1522. var i, ii;
  1523. var times = this.times;
  1524. var out = '';
  1525. var longest = 0;
  1526. for (i = 0, ii = times.length; i < ii; ++i) {
  1527. var name = times[i]['name'];
  1528. if (name.length > longest) {
  1529. longest = name.length;
  1530. }
  1531. }
  1532. for (i = 0, ii = times.length; i < ii; ++i) {
  1533. var span = times[i];
  1534. var duration = span.end - span.start;
  1535. out += rpad(span['name'], ' ', longest) + ' ' + duration + 'ms\n';
  1536. }
  1537. return out;
  1538. }
  1539. };
  1540. return StatTimer;
  1541. }();
  1542. var createBlob = function createBlob(data, contentType) {
  1543. if (typeof Blob !== 'undefined') {
  1544. return new Blob([data], { type: contentType });
  1545. }
  1546. warn('The "Blob" constructor is not supported.');
  1547. };
  1548. var createObjectURL = function createObjectURLClosure() {
  1549. var digits = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=';
  1550. return function createObjectURL(data, contentType, forceDataSchema) {
  1551. if (!forceDataSchema && typeof URL !== 'undefined' && URL.createObjectURL) {
  1552. var blob = createBlob(data, contentType);
  1553. return URL.createObjectURL(blob);
  1554. }
  1555. var buffer = 'data:' + contentType + ';base64,';
  1556. for (var i = 0, ii = data.length; i < ii; i += 3) {
  1557. var b1 = data[i] & 0xFF;
  1558. var b2 = data[i + 1] & 0xFF;
  1559. var b3 = data[i + 2] & 0xFF;
  1560. var d1 = b1 >> 2, d2 = (b1 & 3) << 4 | b2 >> 4;
  1561. var d3 = i + 1 < ii ? (b2 & 0xF) << 2 | b3 >> 6 : 64;
  1562. var d4 = i + 2 < ii ? b3 & 0x3F : 64;
  1563. buffer += digits[d1] + digits[d2] + digits[d3] + digits[d4];
  1564. }
  1565. return buffer;
  1566. };
  1567. }();
  1568. function MessageHandler(sourceName, targetName, comObj) {
  1569. this.sourceName = sourceName;
  1570. this.targetName = targetName;
  1571. this.comObj = comObj;
  1572. this.callbackIndex = 1;
  1573. this.postMessageTransfers = true;
  1574. var callbacksCapabilities = this.callbacksCapabilities = Object.create(null);
  1575. var ah = this.actionHandler = Object.create(null);
  1576. this._onComObjOnMessage = function messageHandlerComObjOnMessage(event) {
  1577. var data = event.data;
  1578. if (data.targetName !== this.sourceName) {
  1579. return;
  1580. }
  1581. if (data.isReply) {
  1582. var callbackId = data.callbackId;
  1583. if (data.callbackId in callbacksCapabilities) {
  1584. var callback = callbacksCapabilities[callbackId];
  1585. delete callbacksCapabilities[callbackId];
  1586. if ('error' in data) {
  1587. callback.reject(data.error);
  1588. } else {
  1589. callback.resolve(data.data);
  1590. }
  1591. } else {
  1592. error('Cannot resolve callback ' + callbackId);
  1593. }
  1594. } else if (data.action in ah) {
  1595. var action = ah[data.action];
  1596. if (data.callbackId) {
  1597. var sourceName = this.sourceName;
  1598. var targetName = data.sourceName;
  1599. Promise.resolve().then(function () {
  1600. return action[0].call(action[1], data.data);
  1601. }).then(function (result) {
  1602. comObj.postMessage({
  1603. sourceName: sourceName,
  1604. targetName: targetName,
  1605. isReply: true,
  1606. callbackId: data.callbackId,
  1607. data: result
  1608. });
  1609. }, function (reason) {
  1610. if (reason instanceof Error) {
  1611. reason = reason + '';
  1612. }
  1613. comObj.postMessage({
  1614. sourceName: sourceName,
  1615. targetName: targetName,
  1616. isReply: true,
  1617. callbackId: data.callbackId,
  1618. error: reason
  1619. });
  1620. });
  1621. } else {
  1622. action[0].call(action[1], data.data);
  1623. }
  1624. } else {
  1625. error('Unknown action from worker: ' + data.action);
  1626. }
  1627. }.bind(this);
  1628. comObj.addEventListener('message', this._onComObjOnMessage);
  1629. }
  1630. MessageHandler.prototype = {
  1631. on: function messageHandlerOn(actionName, handler, scope) {
  1632. var ah = this.actionHandler;
  1633. if (ah[actionName]) {
  1634. error('There is already an actionName called "' + actionName + '"');
  1635. }
  1636. ah[actionName] = [
  1637. handler,
  1638. scope
  1639. ];
  1640. },
  1641. send: function messageHandlerSend(actionName, data, transfers) {
  1642. var message = {
  1643. sourceName: this.sourceName,
  1644. targetName: this.targetName,
  1645. action: actionName,
  1646. data: data
  1647. };
  1648. this.postMessage(message, transfers);
  1649. },
  1650. sendWithPromise: function messageHandlerSendWithPromise(actionName, data, transfers) {
  1651. var callbackId = this.callbackIndex++;
  1652. var message = {
  1653. sourceName: this.sourceName,
  1654. targetName: this.targetName,
  1655. action: actionName,
  1656. data: data,
  1657. callbackId: callbackId
  1658. };
  1659. var capability = createPromiseCapability();
  1660. this.callbacksCapabilities[callbackId] = capability;
  1661. try {
  1662. this.postMessage(message, transfers);
  1663. } catch (e) {
  1664. capability.reject(e);
  1665. }
  1666. return capability.promise;
  1667. },
  1668. postMessage: function (message, transfers) {
  1669. if (transfers && this.postMessageTransfers) {
  1670. this.comObj.postMessage(message, transfers);
  1671. } else {
  1672. this.comObj.postMessage(message);
  1673. }
  1674. },
  1675. destroy: function () {
  1676. this.comObj.removeEventListener('message', this._onComObjOnMessage);
  1677. }
  1678. };
  1679. function loadJpegStream(id, imageUrl, objs) {
  1680. var img = new Image();
  1681. img.onload = function loadJpegStream_onloadClosure() {
  1682. objs.resolve(id, img);
  1683. };
  1684. img.onerror = function loadJpegStream_onerrorClosure() {
  1685. objs.resolve(id, null);
  1686. warn('Error during JPEG image loading');
  1687. };
  1688. img.src = imageUrl;
  1689. }
  1690. (function checkURLConstructor(scope) {
  1691. var hasWorkingUrl = false;
  1692. try {
  1693. if (typeof URL === 'function' && typeof URL.prototype === 'object' && 'origin' in URL.prototype) {
  1694. var u = new URL('b', 'http://a');
  1695. u.pathname = 'c%20d';
  1696. hasWorkingUrl = u.href === 'http://a/c%20d';
  1697. }
  1698. } catch (e) {
  1699. }
  1700. if (hasWorkingUrl) {
  1701. return;
  1702. }
  1703. var relative = Object.create(null);
  1704. relative['ftp'] = 21;
  1705. relative['file'] = 0;
  1706. relative['gopher'] = 70;
  1707. relative['http'] = 80;
  1708. relative['https'] = 443;
  1709. relative['ws'] = 80;
  1710. relative['wss'] = 443;
  1711. var relativePathDotMapping = Object.create(null);
  1712. relativePathDotMapping['%2e'] = '.';
  1713. relativePathDotMapping['.%2e'] = '..';
  1714. relativePathDotMapping['%2e.'] = '..';
  1715. relativePathDotMapping['%2e%2e'] = '..';
  1716. function isRelativeScheme(scheme) {
  1717. return relative[scheme] !== undefined;
  1718. }
  1719. function invalid() {
  1720. clear.call(this);
  1721. this._isInvalid = true;
  1722. }
  1723. function IDNAToASCII(h) {
  1724. if (h === '') {
  1725. invalid.call(this);
  1726. }
  1727. return h.toLowerCase();
  1728. }
  1729. function percentEscape(c) {
  1730. var unicode = c.charCodeAt(0);
  1731. if (unicode > 0x20 && unicode < 0x7F && [
  1732. 0x22,
  1733. 0x23,
  1734. 0x3C,
  1735. 0x3E,
  1736. 0x3F,
  1737. 0x60
  1738. ].indexOf(unicode) === -1) {
  1739. return c;
  1740. }
  1741. return encodeURIComponent(c);
  1742. }
  1743. function percentEscapeQuery(c) {
  1744. var unicode = c.charCodeAt(0);
  1745. if (unicode > 0x20 && unicode < 0x7F && [
  1746. 0x22,
  1747. 0x23,
  1748. 0x3C,
  1749. 0x3E,
  1750. 0x60
  1751. ].indexOf(unicode) === -1) {
  1752. return c;
  1753. }
  1754. return encodeURIComponent(c);
  1755. }
  1756. var EOF, ALPHA = /[a-zA-Z]/, ALPHANUMERIC = /[a-zA-Z0-9\+\-\.]/;
  1757. function parse(input, stateOverride, base) {
  1758. function err(message) {
  1759. errors.push(message);
  1760. }
  1761. var state = stateOverride || 'scheme start', cursor = 0, buffer = '', seenAt = false, seenBracket = false, errors = [];
  1762. loop:
  1763. while ((input[cursor - 1] !== EOF || cursor === 0) && !this._isInvalid) {
  1764. var c = input[cursor];
  1765. switch (state) {
  1766. case 'scheme start':
  1767. if (c && ALPHA.test(c)) {
  1768. buffer += c.toLowerCase();
  1769. state = 'scheme';
  1770. } else if (!stateOverride) {
  1771. buffer = '';
  1772. state = 'no scheme';
  1773. continue;
  1774. } else {
  1775. err('Invalid scheme.');
  1776. break loop;
  1777. }
  1778. break;
  1779. case 'scheme':
  1780. if (c && ALPHANUMERIC.test(c)) {
  1781. buffer += c.toLowerCase();
  1782. } else if (c === ':') {
  1783. this._scheme = buffer;
  1784. buffer = '';
  1785. if (stateOverride) {
  1786. break loop;
  1787. }
  1788. if (isRelativeScheme(this._scheme)) {
  1789. this._isRelative = true;
  1790. }
  1791. if (this._scheme === 'file') {
  1792. state = 'relative';
  1793. } else if (this._isRelative && base && base._scheme === this._scheme) {
  1794. state = 'relative or authority';
  1795. } else if (this._isRelative) {
  1796. state = 'authority first slash';
  1797. } else {
  1798. state = 'scheme data';
  1799. }
  1800. } else if (!stateOverride) {
  1801. buffer = '';
  1802. cursor = 0;
  1803. state = 'no scheme';
  1804. continue;
  1805. } else if (EOF === c) {
  1806. break loop;
  1807. } else {
  1808. err('Code point not allowed in scheme: ' + c);
  1809. break loop;
  1810. }
  1811. break;
  1812. case 'scheme data':
  1813. if (c === '?') {
  1814. this._query = '?';
  1815. state = 'query';
  1816. } else if (c === '#') {
  1817. this._fragment = '#';
  1818. state = 'fragment';
  1819. } else {
  1820. if (EOF !== c && '\t' !== c && '\n' !== c && '\r' !== c) {
  1821. this._schemeData += percentEscape(c);
  1822. }
  1823. }
  1824. break;
  1825. case 'no scheme':
  1826. if (!base || !isRelativeScheme(base._scheme)) {
  1827. err('Missing scheme.');
  1828. invalid.call(this);
  1829. } else {
  1830. state = 'relative';
  1831. continue;
  1832. }
  1833. break;
  1834. case 'relative or authority':
  1835. if (c === '/' && input[cursor + 1] === '/') {
  1836. state = 'authority ignore slashes';
  1837. } else {
  1838. err('Expected /, got: ' + c);
  1839. state = 'relative';
  1840. continue;
  1841. }
  1842. break;
  1843. case 'relative':
  1844. this._isRelative = true;
  1845. if ('file' !== this._scheme) {
  1846. this._scheme = base._scheme;
  1847. }
  1848. if (EOF === c) {
  1849. this._host = base._host;
  1850. this._port = base._port;
  1851. this._path = base._path.slice();
  1852. this._query = base._query;
  1853. this._username = base._username;
  1854. this._password = base._password;
  1855. break loop;
  1856. } else if (c === '/' || c === '\\') {
  1857. if (c === '\\') {
  1858. err('\\ is an invalid code point.');
  1859. }
  1860. state = 'relative slash';
  1861. } else if (c === '?') {
  1862. this._host = base._host;
  1863. this._port = base._port;
  1864. this._path = base._path.slice();
  1865. this._query = '?';
  1866. this._username = base._username;
  1867. this._password = base._password;
  1868. state = 'query';
  1869. } else if (c === '#') {
  1870. this._host = base._host;
  1871. this._port = base._port;
  1872. this._path = base._path.slice();
  1873. this._query = base._query;
  1874. this._fragment = '#';
  1875. this._username = base._username;
  1876. this._password = base._password;
  1877. state = 'fragment';
  1878. } else {
  1879. var nextC = input[cursor + 1];
  1880. var nextNextC = input[cursor + 2];
  1881. if ('file' !== this._scheme || !ALPHA.test(c) || nextC !== ':' && nextC !== '|' || EOF !== nextNextC && '/' !== nextNextC && '\\' !== nextNextC && '?' !== nextNextC && '#' !== nextNextC) {
  1882. this._host = base._host;
  1883. this._port = base._port;
  1884. this._username = base._username;
  1885. this._password = base._password;
  1886. this._path = base._path.slice();
  1887. this._path.pop();
  1888. }
  1889. state = 'relative path';
  1890. continue;
  1891. }
  1892. break;
  1893. case 'relative slash':
  1894. if (c === '/' || c === '\\') {
  1895. if (c === '\\') {
  1896. err('\\ is an invalid code point.');
  1897. }
  1898. if (this._scheme === 'file') {
  1899. state = 'file host';
  1900. } else {
  1901. state = 'authority ignore slashes';
  1902. }
  1903. } else {
  1904. if ('file' !== this._scheme) {
  1905. this._host = base._host;
  1906. this._port = base._port;
  1907. this._username = base._username;
  1908. this._password = base._password;
  1909. }
  1910. state = 'relative path';
  1911. continue;
  1912. }
  1913. break;
  1914. case 'authority first slash':
  1915. if (c === '/') {
  1916. state = 'authority second slash';
  1917. } else {
  1918. err('Expected \'/\', got: ' + c);
  1919. state = 'authority ignore slashes';
  1920. continue;
  1921. }
  1922. break;
  1923. case 'authority second slash':
  1924. state = 'authority ignore slashes';
  1925. if ('/' !== c) {
  1926. err('Expected \'/\', got: ' + c);
  1927. continue;
  1928. }
  1929. break;
  1930. case 'authority ignore slashes':
  1931. if ('/' !== c && '\\' !== c) {
  1932. state = 'authority';
  1933. continue;
  1934. } else {
  1935. err('Expected authority, got: ' + c);
  1936. }
  1937. break;
  1938. case 'authority':
  1939. if (c === '@') {
  1940. if (seenAt) {
  1941. err('@ already seen.');
  1942. buffer += '%40';
  1943. }
  1944. seenAt = true;
  1945. for (var i = 0; i < buffer.length; i++) {
  1946. var cp = buffer[i];
  1947. if (cp === '\t' || cp === '\n' || cp === '\r') {
  1948. err('Invalid whitespace in authority.');
  1949. continue;
  1950. }
  1951. if (cp === ':' && this._password === null) {
  1952. this._password = '';
  1953. continue;
  1954. }
  1955. var tempC = percentEscape(cp);
  1956. if (null !== this._password) {
  1957. this._password += tempC;
  1958. } else {
  1959. this._username += tempC;
  1960. }
  1961. }
  1962. buffer = '';
  1963. } else if (c === EOF || c === '/' || c === '\\' || c === '?' || c === '#') {
  1964. cursor -= buffer.length;
  1965. buffer = '';
  1966. state = 'host';
  1967. continue;
  1968. } else {
  1969. buffer += c;
  1970. }
  1971. break;
  1972. case 'file host':
  1973. if (c === EOF || c === '/' || c === '\\' || c === '?' || c === '#') {
  1974. if (buffer.length === 2 && ALPHA.test(buffer[0]) && (buffer[1] === ':' || buffer[1] === '|')) {
  1975. state = 'relative path';
  1976. } else if (buffer.length === 0) {
  1977. state = 'relative path start';
  1978. } else {
  1979. this._host = IDNAToASCII.call(this, buffer);
  1980. buffer = '';
  1981. state = 'relative path start';
  1982. }
  1983. continue;
  1984. } else if (c === '\t' || c === '\n' || c === '\r') {
  1985. err('Invalid whitespace in file host.');
  1986. } else {
  1987. buffer += c;
  1988. }
  1989. break;
  1990. case 'host':
  1991. case 'hostname':
  1992. if (c === ':' && !seenBracket) {
  1993. this._host = IDNAToASCII.call(this, buffer);
  1994. buffer = '';
  1995. state = 'port';
  1996. if (stateOverride === 'hostname') {
  1997. break loop;
  1998. }
  1999. } else if (c === EOF || c === '/' || c === '\\' || c === '?' || c === '#') {
  2000. this._host = IDNAToASCII.call(this, buffer);
  2001. buffer = '';
  2002. state = 'relative path start';
  2003. if (stateOverride) {
  2004. break loop;
  2005. }
  2006. continue;
  2007. } else if ('\t' !== c && '\n' !== c && '\r' !== c) {
  2008. if (c === '[') {
  2009. seenBracket = true;
  2010. } else if (c === ']') {
  2011. seenBracket = false;
  2012. }
  2013. buffer += c;
  2014. } else {
  2015. err('Invalid code point in host/hostname: ' + c);
  2016. }
  2017. break;
  2018. case 'port':
  2019. if (/[0-9]/.test(c)) {
  2020. buffer += c;
  2021. } else if (c === EOF || c === '/' || c === '\\' || c === '?' || c === '#' || stateOverride) {
  2022. if ('' !== buffer) {
  2023. var temp = parseInt(buffer, 10);
  2024. if (temp !== relative[this._scheme]) {
  2025. this._port = temp + '';
  2026. }
  2027. buffer = '';
  2028. }
  2029. if (stateOverride) {
  2030. break loop;
  2031. }
  2032. state = 'relative path start';
  2033. continue;
  2034. } else if (c === '\t' || c === '\n' || c === '\r') {
  2035. err('Invalid code point in port: ' + c);
  2036. } else {
  2037. invalid.call(this);
  2038. }
  2039. break;
  2040. case 'relative path start':
  2041. if (c === '\\') {
  2042. err('\'\\\' not allowed in path.');
  2043. }
  2044. state = 'relative path';
  2045. if ('/' !== c && '\\' !== c) {
  2046. continue;
  2047. }
  2048. break;
  2049. case 'relative path':
  2050. if (c === EOF || c === '/' || c === '\\' || !stateOverride && (c === '?' || c === '#')) {
  2051. if (c === '\\') {
  2052. err('\\ not allowed in relative path.');
  2053. }
  2054. var tmp;
  2055. if (tmp = relativePathDotMapping[buffer.toLowerCase()]) {
  2056. buffer = tmp;
  2057. }
  2058. if (buffer === '..') {
  2059. this._path.pop();
  2060. if ('/' !== c && '\\' !== c) {
  2061. this._path.push('');
  2062. }
  2063. } else if (buffer === '.' && '/' !== c && '\\' !== c) {
  2064. this._path.push('');
  2065. } else if ('.' !== buffer) {
  2066. if (this._scheme === 'file' && this._path.length === 0 && buffer.length === 2 && ALPHA.test(buffer[0]) && buffer[1] === '|') {
  2067. buffer = buffer[0] + ':';
  2068. }
  2069. this._path.push(buffer);
  2070. }
  2071. buffer = '';
  2072. if (c === '?') {
  2073. this._query = '?';
  2074. state = 'query';
  2075. } else if (c === '#') {
  2076. this._fragment = '#';
  2077. state = 'fragment';
  2078. }
  2079. } else if ('\t' !== c && '\n' !== c && '\r' !== c) {
  2080. buffer += percentEscape(c);
  2081. }
  2082. break;
  2083. case 'query':
  2084. if (!stateOverride && c === '#') {
  2085. this._fragment = '#';
  2086. state = 'fragment';
  2087. } else if (EOF !== c && '\t' !== c && '\n' !== c && '\r' !== c) {
  2088. this._query += percentEscapeQuery(c);
  2089. }
  2090. break;
  2091. case 'fragment':
  2092. if (EOF !== c && '\t' !== c && '\n' !== c && '\r' !== c) {
  2093. this._fragment += c;
  2094. }
  2095. break;
  2096. }
  2097. cursor++;
  2098. }
  2099. }
  2100. function clear() {
  2101. this._scheme = '';
  2102. this._schemeData = '';
  2103. this._username = '';
  2104. this._password = null;
  2105. this._host = '';
  2106. this._port = '';
  2107. this._path = [];
  2108. this._query = '';
  2109. this._fragment = '';
  2110. this._isInvalid = false;
  2111. this._isRelative = false;
  2112. }
  2113. function JURL(url, base) {
  2114. if (base !== undefined && !(base instanceof JURL)) {
  2115. base = new JURL(String(base));
  2116. }
  2117. this._url = url;
  2118. clear.call(this);
  2119. var input = url.replace(/^[ \t\r\n\f]+|[ \t\r\n\f]+$/g, '');
  2120. parse.call(this, input, null, base);
  2121. }
  2122. JURL.prototype = {
  2123. toString: function () {
  2124. return this.href;
  2125. },
  2126. get href() {
  2127. if (this._isInvalid) {
  2128. return this._url;
  2129. }
  2130. var authority = '';
  2131. if ('' !== this._username || null !== this._password) {
  2132. authority = this._username + (null !== this._password ? ':' + this._password : '') + '@';
  2133. }
  2134. return this.protocol + (this._isRelative ? '//' + authority + this.host : '') + this.pathname + this._query + this._fragment;
  2135. },
  2136. set href(href) {
  2137. clear.call(this);
  2138. parse.call(this, href);
  2139. },
  2140. get protocol() {
  2141. return this._scheme + ':';
  2142. },
  2143. set protocol(protocol) {
  2144. if (this._isInvalid) {
  2145. return;
  2146. }
  2147. parse.call(this, protocol + ':', 'scheme start');
  2148. },
  2149. get host() {
  2150. return this._isInvalid ? '' : this._port ? this._host + ':' + this._port : this._host;
  2151. },
  2152. set host(host) {
  2153. if (this._isInvalid || !this._isRelative) {
  2154. return;
  2155. }
  2156. parse.call(this, host, 'host');
  2157. },
  2158. get hostname() {
  2159. return this._host;
  2160. },
  2161. set hostname(hostname) {
  2162. if (this._isInvalid || !this._isRelative) {
  2163. return;
  2164. }
  2165. parse.call(this, hostname, 'hostname');
  2166. },
  2167. get port() {
  2168. return this._port;
  2169. },
  2170. set port(port) {
  2171. if (this._isInvalid || !this._isRelative) {
  2172. return;
  2173. }
  2174. parse.call(this, port, 'port');
  2175. },
  2176. get pathname() {
  2177. return this._isInvalid ? '' : this._isRelative ? '/' + this._path.join('/') : this._schemeData;
  2178. },
  2179. set pathname(pathname) {
  2180. if (this._isInvalid || !this._isRelative) {
  2181. return;
  2182. }
  2183. this._path = [];
  2184. parse.call(this, pathname, 'relative path start');
  2185. },
  2186. get search() {
  2187. return this._isInvalid || !this._query || this._query === '?' ? '' : this._query;
  2188. },
  2189. set search(search) {
  2190. if (this._isInvalid || !this._isRelative) {
  2191. return;
  2192. }
  2193. this._query = '?';
  2194. if (search[0] === '?') {
  2195. search = search.slice(1);
  2196. }
  2197. parse.call(this, search, 'query');
  2198. },
  2199. get hash() {
  2200. return this._isInvalid || !this._fragment || this._fragment === '#' ? '' : this._fragment;
  2201. },
  2202. set hash(hash) {
  2203. if (this._isInvalid) {
  2204. return;
  2205. }
  2206. this._fragment = '#';
  2207. if (hash[0] === '#') {
  2208. hash = hash.slice(1);
  2209. }
  2210. parse.call(this, hash, 'fragment');
  2211. },
  2212. get origin() {
  2213. var host;
  2214. if (this._isInvalid || !this._scheme) {
  2215. return '';
  2216. }
  2217. switch (this._scheme) {
  2218. case 'data':
  2219. case 'file':
  2220. case 'javascript':
  2221. case 'mailto':
  2222. return 'null';
  2223. }
  2224. host = this.host;
  2225. if (!host) {
  2226. return '';
  2227. }
  2228. return this._scheme + '://' + host;
  2229. }
  2230. };
  2231. var OriginalURL = scope.URL;
  2232. if (OriginalURL) {
  2233. JURL.createObjectURL = function (blob) {
  2234. return OriginalURL.createObjectURL.apply(OriginalURL, arguments);
  2235. };
  2236. JURL.revokeObjectURL = function (url) {
  2237. OriginalURL.revokeObjectURL(url);
  2238. };
  2239. }
  2240. scope.URL = JURL;
  2241. }(globalScope));
  2242. exports.FONT_IDENTITY_MATRIX = FONT_IDENTITY_MATRIX;
  2243. exports.IDENTITY_MATRIX = IDENTITY_MATRIX;
  2244. exports.OPS = OPS;
  2245. exports.VERBOSITY_LEVELS = VERBOSITY_LEVELS;
  2246. exports.UNSUPPORTED_FEATURES = UNSUPPORTED_FEATURES;
  2247. exports.AnnotationBorderStyleType = AnnotationBorderStyleType;
  2248. exports.AnnotationFieldFlag = AnnotationFieldFlag;
  2249. exports.AnnotationFlag = AnnotationFlag;
  2250. exports.AnnotationType = AnnotationType;
  2251. exports.FontType = FontType;
  2252. exports.ImageKind = ImageKind;
  2253. exports.CMapCompressionType = CMapCompressionType;
  2254. exports.InvalidPDFException = InvalidPDFException;
  2255. exports.MessageHandler = MessageHandler;
  2256. exports.MissingDataException = MissingDataException;
  2257. exports.MissingPDFException = MissingPDFException;
  2258. exports.NotImplementedException = NotImplementedException;
  2259. exports.PageViewport = PageViewport;
  2260. exports.PasswordException = PasswordException;
  2261. exports.PasswordResponses = PasswordResponses;
  2262. exports.StatTimer = StatTimer;
  2263. exports.StreamType = StreamType;
  2264. exports.TextRenderingMode = TextRenderingMode;
  2265. exports.UnexpectedResponseException = UnexpectedResponseException;
  2266. exports.UnknownErrorException = UnknownErrorException;
  2267. exports.Util = Util;
  2268. exports.XRefParseException = XRefParseException;
  2269. exports.arrayByteLength = arrayByteLength;
  2270. exports.arraysToBytes = arraysToBytes;
  2271. exports.assert = assert;
  2272. exports.bytesToString = bytesToString;
  2273. exports.createBlob = createBlob;
  2274. exports.createPromiseCapability = createPromiseCapability;
  2275. exports.createObjectURL = createObjectURL;
  2276. exports.deprecated = deprecated;
  2277. exports.error = error;
  2278. exports.getLookupTableFactory = getLookupTableFactory;
  2279. exports.getVerbosityLevel = getVerbosityLevel;
  2280. exports.globalScope = globalScope;
  2281. exports.info = info;
  2282. exports.isArray = isArray;
  2283. exports.isArrayBuffer = isArrayBuffer;
  2284. exports.isBool = isBool;
  2285. exports.isEmptyObj = isEmptyObj;
  2286. exports.isInt = isInt;
  2287. exports.isNum = isNum;
  2288. exports.isString = isString;
  2289. exports.isSpace = isSpace;
  2290. exports.isNodeJS = isNodeJS;
  2291. exports.isSameOrigin = isSameOrigin;
  2292. exports.createValidAbsoluteUrl = createValidAbsoluteUrl;
  2293. exports.isLittleEndian = isLittleEndian;
  2294. exports.isEvalSupported = isEvalSupported;
  2295. exports.loadJpegStream = loadJpegStream;
  2296. exports.log2 = log2;
  2297. exports.readInt8 = readInt8;
  2298. exports.readUint16 = readUint16;
  2299. exports.readUint32 = readUint32;
  2300. exports.removeNullCharacters = removeNullCharacters;
  2301. exports.setVerbosityLevel = setVerbosityLevel;
  2302. exports.shadow = shadow;
  2303. exports.string32 = string32;
  2304. exports.stringToBytes = stringToBytes;
  2305. exports.stringToPDFString = stringToPDFString;
  2306. exports.stringToUTF8String = stringToUTF8String;
  2307. exports.utf8StringToString = utf8StringToString;
  2308. exports.warn = warn;
  2309. /* WEBPACK VAR INJECTION */}.call(exports, __w_pdfjs_require__(19)))
  2310. /***/ }),
  2311. /* 1 */
  2312. /***/ (function(module, exports, __w_pdfjs_require__) {
  2313. "use strict";
  2314. var sharedUtil = __w_pdfjs_require__(0);
  2315. var isArray = sharedUtil.isArray;
  2316. var EOF = {};
  2317. var Name = function NameClosure() {
  2318. function Name(name) {
  2319. this.name = name;
  2320. }
  2321. Name.prototype = {};
  2322. var nameCache = Object.create(null);
  2323. Name.get = function Name_get(name) {
  2324. var nameValue = nameCache[name];
  2325. return nameValue ? nameValue : nameCache[name] = new Name(name);
  2326. };
  2327. return Name;
  2328. }();
  2329. var Cmd = function CmdClosure() {
  2330. function Cmd(cmd) {
  2331. this.cmd = cmd;
  2332. }
  2333. Cmd.prototype = {};
  2334. var cmdCache = Object.create(null);
  2335. Cmd.get = function Cmd_get(cmd) {
  2336. var cmdValue = cmdCache[cmd];
  2337. return cmdValue ? cmdValue : cmdCache[cmd] = new Cmd(cmd);
  2338. };
  2339. return Cmd;
  2340. }();
  2341. var Dict = function DictClosure() {
  2342. var nonSerializable = function nonSerializableClosure() {
  2343. return nonSerializable;
  2344. };
  2345. function Dict(xref) {
  2346. this.map = Object.create(null);
  2347. this.xref = xref;
  2348. this.objId = null;
  2349. this.suppressEncryption = false;
  2350. this.__nonSerializable__ = nonSerializable;
  2351. }
  2352. Dict.prototype = {
  2353. assignXref: function Dict_assignXref(newXref) {
  2354. this.xref = newXref;
  2355. },
  2356. get: function Dict_get(key1, key2, key3) {
  2357. var value;
  2358. var xref = this.xref, suppressEncryption = this.suppressEncryption;
  2359. if (typeof (value = this.map[key1]) !== 'undefined' || key1 in this.map || typeof key2 === 'undefined') {
  2360. return xref ? xref.fetchIfRef(value, suppressEncryption) : value;
  2361. }
  2362. if (typeof (value = this.map[key2]) !== 'undefined' || key2 in this.map || typeof key3 === 'undefined') {
  2363. return xref ? xref.fetchIfRef(value, suppressEncryption) : value;
  2364. }
  2365. value = this.map[key3] || null;
  2366. return xref ? xref.fetchIfRef(value, suppressEncryption) : value;
  2367. },
  2368. getAsync: function Dict_getAsync(key1, key2, key3) {
  2369. var value;
  2370. var xref = this.xref, suppressEncryption = this.suppressEncryption;
  2371. if (typeof (value = this.map[key1]) !== 'undefined' || key1 in this.map || typeof key2 === 'undefined') {
  2372. if (xref) {
  2373. return xref.fetchIfRefAsync(value, suppressEncryption);
  2374. }
  2375. return Promise.resolve(value);
  2376. }
  2377. if (typeof (value = this.map[key2]) !== 'undefined' || key2 in this.map || typeof key3 === 'undefined') {
  2378. if (xref) {
  2379. return xref.fetchIfRefAsync(value, suppressEncryption);
  2380. }
  2381. return Promise.resolve(value);
  2382. }
  2383. value = this.map[key3] || null;
  2384. if (xref) {
  2385. return xref.fetchIfRefAsync(value, suppressEncryption);
  2386. }
  2387. return Promise.resolve(value);
  2388. },
  2389. getArray: function Dict_getArray(key1, key2, key3) {
  2390. var value = this.get(key1, key2, key3);
  2391. var xref = this.xref, suppressEncryption = this.suppressEncryption;
  2392. if (!isArray(value) || !xref) {
  2393. return value;
  2394. }
  2395. value = value.slice();
  2396. for (var i = 0, ii = value.length; i < ii; i++) {
  2397. if (!isRef(value[i])) {
  2398. continue;
  2399. }
  2400. value[i] = xref.fetch(value[i], suppressEncryption);
  2401. }
  2402. return value;
  2403. },
  2404. getRaw: function Dict_getRaw(key) {
  2405. return this.map[key];
  2406. },
  2407. getKeys: function Dict_getKeys() {
  2408. return Object.keys(this.map);
  2409. },
  2410. set: function Dict_set(key, value) {
  2411. this.map[key] = value;
  2412. },
  2413. has: function Dict_has(key) {
  2414. return key in this.map;
  2415. },
  2416. forEach: function Dict_forEach(callback) {
  2417. for (var key in this.map) {
  2418. callback(key, this.get(key));
  2419. }
  2420. }
  2421. };
  2422. Dict.empty = new Dict(null);
  2423. Dict.merge = function Dict_merge(xref, dictArray) {
  2424. var mergedDict = new Dict(xref);
  2425. for (var i = 0, ii = dictArray.length; i < ii; i++) {
  2426. var dict = dictArray[i];
  2427. if (!isDict(dict)) {
  2428. continue;
  2429. }
  2430. for (var keyName in dict.map) {
  2431. if (mergedDict.map[keyName]) {
  2432. continue;
  2433. }
  2434. mergedDict.map[keyName] = dict.map[keyName];
  2435. }
  2436. }
  2437. return mergedDict;
  2438. };
  2439. return Dict;
  2440. }();
  2441. var Ref = function RefClosure() {
  2442. function Ref(num, gen) {
  2443. this.num = num;
  2444. this.gen = gen;
  2445. }
  2446. Ref.prototype = {
  2447. toString: function Ref_toString() {
  2448. var str = this.num + 'R';
  2449. if (this.gen !== 0) {
  2450. str += this.gen;
  2451. }
  2452. return str;
  2453. }
  2454. };
  2455. return Ref;
  2456. }();
  2457. var RefSet = function RefSetClosure() {
  2458. function RefSet() {
  2459. this.dict = Object.create(null);
  2460. }
  2461. RefSet.prototype = {
  2462. has: function RefSet_has(ref) {
  2463. return ref.toString() in this.dict;
  2464. },
  2465. put: function RefSet_put(ref) {
  2466. this.dict[ref.toString()] = true;
  2467. },
  2468. remove: function RefSet_remove(ref) {
  2469. delete this.dict[ref.toString()];
  2470. }
  2471. };
  2472. return RefSet;
  2473. }();
  2474. var RefSetCache = function RefSetCacheClosure() {
  2475. function RefSetCache() {
  2476. this.dict = Object.create(null);
  2477. }
  2478. RefSetCache.prototype = {
  2479. get: function RefSetCache_get(ref) {
  2480. return this.dict[ref.toString()];
  2481. },
  2482. has: function RefSetCache_has(ref) {
  2483. return ref.toString() in this.dict;
  2484. },
  2485. put: function RefSetCache_put(ref, obj) {
  2486. this.dict[ref.toString()] = obj;
  2487. },
  2488. putAlias: function RefSetCache_putAlias(ref, aliasRef) {
  2489. this.dict[ref.toString()] = this.get(aliasRef);
  2490. },
  2491. forEach: function RefSetCache_forEach(fn, thisArg) {
  2492. for (var i in this.dict) {
  2493. fn.call(thisArg, this.dict[i]);
  2494. }
  2495. },
  2496. clear: function RefSetCache_clear() {
  2497. this.dict = Object.create(null);
  2498. }
  2499. };
  2500. return RefSetCache;
  2501. }();
  2502. function isEOF(v) {
  2503. return v === EOF;
  2504. }
  2505. function isName(v, name) {
  2506. return v instanceof Name && (name === undefined || v.name === name);
  2507. }
  2508. function isCmd(v, cmd) {
  2509. return v instanceof Cmd && (cmd === undefined || v.cmd === cmd);
  2510. }
  2511. function isDict(v, type) {
  2512. return v instanceof Dict && (type === undefined || isName(v.get('Type'), type));
  2513. }
  2514. function isRef(v) {
  2515. return v instanceof Ref;
  2516. }
  2517. function isRefsEqual(v1, v2) {
  2518. return v1.num === v2.num && v1.gen === v2.gen;
  2519. }
  2520. function isStream(v) {
  2521. return typeof v === 'object' && v !== null && v.getBytes !== undefined;
  2522. }
  2523. exports.EOF = EOF;
  2524. exports.Cmd = Cmd;
  2525. exports.Dict = Dict;
  2526. exports.Name = Name;
  2527. exports.Ref = Ref;
  2528. exports.RefSet = RefSet;
  2529. exports.RefSetCache = RefSetCache;
  2530. exports.isEOF = isEOF;
  2531. exports.isCmd = isCmd;
  2532. exports.isDict = isDict;
  2533. exports.isName = isName;
  2534. exports.isRef = isRef;
  2535. exports.isRefsEqual = isRefsEqual;
  2536. exports.isStream = isStream;
  2537. /***/ }),
  2538. /* 2 */
  2539. /***/ (function(module, exports, __w_pdfjs_require__) {
  2540. "use strict";
  2541. var sharedUtil = __w_pdfjs_require__(0);
  2542. var corePrimitives = __w_pdfjs_require__(1);
  2543. var coreJbig2 = __w_pdfjs_require__(28);
  2544. var coreJpg = __w_pdfjs_require__(29);
  2545. var coreJpx = __w_pdfjs_require__(14);
  2546. var Util = sharedUtil.Util;
  2547. var error = sharedUtil.error;
  2548. var info = sharedUtil.info;
  2549. var isInt = sharedUtil.isInt;
  2550. var isArray = sharedUtil.isArray;
  2551. var createObjectURL = sharedUtil.createObjectURL;
  2552. var shadow = sharedUtil.shadow;
  2553. var isSpace = sharedUtil.isSpace;
  2554. var Dict = corePrimitives.Dict;
  2555. var isDict = corePrimitives.isDict;
  2556. var isStream = corePrimitives.isStream;
  2557. var Jbig2Image = coreJbig2.Jbig2Image;
  2558. var JpegImage = coreJpg.JpegImage;
  2559. var JpxImage = coreJpx.JpxImage;
  2560. var Stream = function StreamClosure() {
  2561. function Stream(arrayBuffer, start, length, dict) {
  2562. this.bytes = arrayBuffer instanceof Uint8Array ? arrayBuffer : new Uint8Array(arrayBuffer);
  2563. this.start = start || 0;
  2564. this.pos = this.start;
  2565. this.end = start + length || this.bytes.length;
  2566. this.dict = dict;
  2567. }
  2568. Stream.prototype = {
  2569. get length() {
  2570. return this.end - this.start;
  2571. },
  2572. get isEmpty() {
  2573. return this.length === 0;
  2574. },
  2575. getByte: function Stream_getByte() {
  2576. if (this.pos >= this.end) {
  2577. return -1;
  2578. }
  2579. return this.bytes[this.pos++];
  2580. },
  2581. getUint16: function Stream_getUint16() {
  2582. var b0 = this.getByte();
  2583. var b1 = this.getByte();
  2584. if (b0 === -1 || b1 === -1) {
  2585. return -1;
  2586. }
  2587. return (b0 << 8) + b1;
  2588. },
  2589. getInt32: function Stream_getInt32() {
  2590. var b0 = this.getByte();
  2591. var b1 = this.getByte();
  2592. var b2 = this.getByte();
  2593. var b3 = this.getByte();
  2594. return (b0 << 24) + (b1 << 16) + (b2 << 8) + b3;
  2595. },
  2596. getBytes: function Stream_getBytes(length) {
  2597. var bytes = this.bytes;
  2598. var pos = this.pos;
  2599. var strEnd = this.end;
  2600. if (!length) {
  2601. return bytes.subarray(pos, strEnd);
  2602. }
  2603. var end = pos + length;
  2604. if (end > strEnd) {
  2605. end = strEnd;
  2606. }
  2607. this.pos = end;
  2608. return bytes.subarray(pos, end);
  2609. },
  2610. peekByte: function Stream_peekByte() {
  2611. var peekedByte = this.getByte();
  2612. this.pos--;
  2613. return peekedByte;
  2614. },
  2615. peekBytes: function Stream_peekBytes(length) {
  2616. var bytes = this.getBytes(length);
  2617. this.pos -= bytes.length;
  2618. return bytes;
  2619. },
  2620. skip: function Stream_skip(n) {
  2621. if (!n) {
  2622. n = 1;
  2623. }
  2624. this.pos += n;
  2625. },
  2626. reset: function Stream_reset() {
  2627. this.pos = this.start;
  2628. },
  2629. moveStart: function Stream_moveStart() {
  2630. this.start = this.pos;
  2631. },
  2632. makeSubStream: function Stream_makeSubStream(start, length, dict) {
  2633. return new Stream(this.bytes.buffer, start, length, dict);
  2634. }
  2635. };
  2636. return Stream;
  2637. }();
  2638. var StringStream = function StringStreamClosure() {
  2639. function StringStream(str) {
  2640. var length = str.length;
  2641. var bytes = new Uint8Array(length);
  2642. for (var n = 0; n < length; ++n) {
  2643. bytes[n] = str.charCodeAt(n);
  2644. }
  2645. Stream.call(this, bytes);
  2646. }
  2647. StringStream.prototype = Stream.prototype;
  2648. return StringStream;
  2649. }();
  2650. var DecodeStream = function DecodeStreamClosure() {
  2651. var emptyBuffer = new Uint8Array(0);
  2652. function DecodeStream(maybeMinBufferLength) {
  2653. this.pos = 0;
  2654. this.bufferLength = 0;
  2655. this.eof = false;
  2656. this.buffer = emptyBuffer;
  2657. this.minBufferLength = 512;
  2658. if (maybeMinBufferLength) {
  2659. while (this.minBufferLength < maybeMinBufferLength) {
  2660. this.minBufferLength *= 2;
  2661. }
  2662. }
  2663. }
  2664. DecodeStream.prototype = {
  2665. get isEmpty() {
  2666. while (!this.eof && this.bufferLength === 0) {
  2667. this.readBlock();
  2668. }
  2669. return this.bufferLength === 0;
  2670. },
  2671. ensureBuffer: function DecodeStream_ensureBuffer(requested) {
  2672. var buffer = this.buffer;
  2673. if (requested <= buffer.byteLength) {
  2674. return buffer;
  2675. }
  2676. var size = this.minBufferLength;
  2677. while (size < requested) {
  2678. size *= 2;
  2679. }
  2680. var buffer2 = new Uint8Array(size);
  2681. buffer2.set(buffer);
  2682. return this.buffer = buffer2;
  2683. },
  2684. getByte: function DecodeStream_getByte() {
  2685. var pos = this.pos;
  2686. while (this.bufferLength <= pos) {
  2687. if (this.eof) {
  2688. return -1;
  2689. }
  2690. this.readBlock();
  2691. }
  2692. return this.buffer[this.pos++];
  2693. },
  2694. getUint16: function DecodeStream_getUint16() {
  2695. var b0 = this.getByte();
  2696. var b1 = this.getByte();
  2697. if (b0 === -1 || b1 === -1) {
  2698. return -1;
  2699. }
  2700. return (b0 << 8) + b1;
  2701. },
  2702. getInt32: function DecodeStream_getInt32() {
  2703. var b0 = this.getByte();
  2704. var b1 = this.getByte();
  2705. var b2 = this.getByte();
  2706. var b3 = this.getByte();
  2707. return (b0 << 24) + (b1 << 16) + (b2 << 8) + b3;
  2708. },
  2709. getBytes: function DecodeStream_getBytes(length) {
  2710. var end, pos = this.pos;
  2711. if (length) {
  2712. this.ensureBuffer(pos + length);
  2713. end = pos + length;
  2714. while (!this.eof && this.bufferLength < end) {
  2715. this.readBlock();
  2716. }
  2717. var bufEnd = this.bufferLength;
  2718. if (end > bufEnd) {
  2719. end = bufEnd;
  2720. }
  2721. } else {
  2722. while (!this.eof) {
  2723. this.readBlock();
  2724. }
  2725. end = this.bufferLength;
  2726. }
  2727. this.pos = end;
  2728. return this.buffer.subarray(pos, end);
  2729. },
  2730. peekByte: function DecodeStream_peekByte() {
  2731. var peekedByte = this.getByte();
  2732. this.pos--;
  2733. return peekedByte;
  2734. },
  2735. peekBytes: function DecodeStream_peekBytes(length) {
  2736. var bytes = this.getBytes(length);
  2737. this.pos -= bytes.length;
  2738. return bytes;
  2739. },
  2740. makeSubStream: function DecodeStream_makeSubStream(start, length, dict) {
  2741. var end = start + length;
  2742. while (this.bufferLength <= end && !this.eof) {
  2743. this.readBlock();
  2744. }
  2745. return new Stream(this.buffer, start, length, dict);
  2746. },
  2747. skip: function DecodeStream_skip(n) {
  2748. if (!n) {
  2749. n = 1;
  2750. }
  2751. this.pos += n;
  2752. },
  2753. reset: function DecodeStream_reset() {
  2754. this.pos = 0;
  2755. },
  2756. getBaseStreams: function DecodeStream_getBaseStreams() {
  2757. if (this.str && this.str.getBaseStreams) {
  2758. return this.str.getBaseStreams();
  2759. }
  2760. return [];
  2761. }
  2762. };
  2763. return DecodeStream;
  2764. }();
  2765. var StreamsSequenceStream = function StreamsSequenceStreamClosure() {
  2766. function StreamsSequenceStream(streams) {
  2767. this.streams = streams;
  2768. DecodeStream.call(this, null);
  2769. }
  2770. StreamsSequenceStream.prototype = Object.create(DecodeStream.prototype);
  2771. StreamsSequenceStream.prototype.readBlock = function streamSequenceStreamReadBlock() {
  2772. var streams = this.streams;
  2773. if (streams.length === 0) {
  2774. this.eof = true;
  2775. return;
  2776. }
  2777. var stream = streams.shift();
  2778. var chunk = stream.getBytes();
  2779. var bufferLength = this.bufferLength;
  2780. var newLength = bufferLength + chunk.length;
  2781. var buffer = this.ensureBuffer(newLength);
  2782. buffer.set(chunk, bufferLength);
  2783. this.bufferLength = newLength;
  2784. };
  2785. StreamsSequenceStream.prototype.getBaseStreams = function StreamsSequenceStream_getBaseStreams() {
  2786. var baseStreams = [];
  2787. for (var i = 0, ii = this.streams.length; i < ii; i++) {
  2788. var stream = this.streams[i];
  2789. if (stream.getBaseStreams) {
  2790. Util.appendToArray(baseStreams, stream.getBaseStreams());
  2791. }
  2792. }
  2793. return baseStreams;
  2794. };
  2795. return StreamsSequenceStream;
  2796. }();
  2797. var FlateStream = function FlateStreamClosure() {
  2798. var codeLenCodeMap = new Int32Array([
  2799. 16,
  2800. 17,
  2801. 18,
  2802. 0,
  2803. 8,
  2804. 7,
  2805. 9,
  2806. 6,
  2807. 10,
  2808. 5,
  2809. 11,
  2810. 4,
  2811. 12,
  2812. 3,
  2813. 13,
  2814. 2,
  2815. 14,
  2816. 1,
  2817. 15
  2818. ]);
  2819. var lengthDecode = new Int32Array([
  2820. 0x00003,
  2821. 0x00004,
  2822. 0x00005,
  2823. 0x00006,
  2824. 0x00007,
  2825. 0x00008,
  2826. 0x00009,
  2827. 0x0000a,
  2828. 0x1000b,
  2829. 0x1000d,
  2830. 0x1000f,
  2831. 0x10011,
  2832. 0x20013,
  2833. 0x20017,
  2834. 0x2001b,
  2835. 0x2001f,
  2836. 0x30023,
  2837. 0x3002b,
  2838. 0x30033,
  2839. 0x3003b,
  2840. 0x40043,
  2841. 0x40053,
  2842. 0x40063,
  2843. 0x40073,
  2844. 0x50083,
  2845. 0x500a3,
  2846. 0x500c3,
  2847. 0x500e3,
  2848. 0x00102,
  2849. 0x00102,
  2850. 0x00102
  2851. ]);
  2852. var distDecode = new Int32Array([
  2853. 0x00001,
  2854. 0x00002,
  2855. 0x00003,
  2856. 0x00004,
  2857. 0x10005,
  2858. 0x10007,
  2859. 0x20009,
  2860. 0x2000d,
  2861. 0x30011,
  2862. 0x30019,
  2863. 0x40021,
  2864. 0x40031,
  2865. 0x50041,
  2866. 0x50061,
  2867. 0x60081,
  2868. 0x600c1,
  2869. 0x70101,
  2870. 0x70181,
  2871. 0x80201,
  2872. 0x80301,
  2873. 0x90401,
  2874. 0x90601,
  2875. 0xa0801,
  2876. 0xa0c01,
  2877. 0xb1001,
  2878. 0xb1801,
  2879. 0xc2001,
  2880. 0xc3001,
  2881. 0xd4001,
  2882. 0xd6001
  2883. ]);
  2884. var fixedLitCodeTab = [
  2885. new Int32Array([
  2886. 0x70100,
  2887. 0x80050,
  2888. 0x80010,
  2889. 0x80118,
  2890. 0x70110,
  2891. 0x80070,
  2892. 0x80030,
  2893. 0x900c0,
  2894. 0x70108,
  2895. 0x80060,
  2896. 0x80020,
  2897. 0x900a0,
  2898. 0x80000,
  2899. 0x80080,
  2900. 0x80040,
  2901. 0x900e0,
  2902. 0x70104,
  2903. 0x80058,
  2904. 0x80018,
  2905. 0x90090,
  2906. 0x70114,
  2907. 0x80078,
  2908. 0x80038,
  2909. 0x900d0,
  2910. 0x7010c,
  2911. 0x80068,
  2912. 0x80028,
  2913. 0x900b0,
  2914. 0x80008,
  2915. 0x80088,
  2916. 0x80048,
  2917. 0x900f0,
  2918. 0x70102,
  2919. 0x80054,
  2920. 0x80014,
  2921. 0x8011c,
  2922. 0x70112,
  2923. 0x80074,
  2924. 0x80034,
  2925. 0x900c8,
  2926. 0x7010a,
  2927. 0x80064,
  2928. 0x80024,
  2929. 0x900a8,
  2930. 0x80004,
  2931. 0x80084,
  2932. 0x80044,
  2933. 0x900e8,
  2934. 0x70106,
  2935. 0x8005c,
  2936. 0x8001c,
  2937. 0x90098,
  2938. 0x70116,
  2939. 0x8007c,
  2940. 0x8003c,
  2941. 0x900d8,
  2942. 0x7010e,
  2943. 0x8006c,
  2944. 0x8002c,
  2945. 0x900b8,
  2946. 0x8000c,
  2947. 0x8008c,
  2948. 0x8004c,
  2949. 0x900f8,
  2950. 0x70101,
  2951. 0x80052,
  2952. 0x80012,
  2953. 0x8011a,
  2954. 0x70111,
  2955. 0x80072,
  2956. 0x80032,
  2957. 0x900c4,
  2958. 0x70109,
  2959. 0x80062,
  2960. 0x80022,
  2961. 0x900a4,
  2962. 0x80002,
  2963. 0x80082,
  2964. 0x80042,
  2965. 0x900e4,
  2966. 0x70105,
  2967. 0x8005a,
  2968. 0x8001a,
  2969. 0x90094,
  2970. 0x70115,
  2971. 0x8007a,
  2972. 0x8003a,
  2973. 0x900d4,
  2974. 0x7010d,
  2975. 0x8006a,
  2976. 0x8002a,
  2977. 0x900b4,
  2978. 0x8000a,
  2979. 0x8008a,
  2980. 0x8004a,
  2981. 0x900f4,
  2982. 0x70103,
  2983. 0x80056,
  2984. 0x80016,
  2985. 0x8011e,
  2986. 0x70113,
  2987. 0x80076,
  2988. 0x80036,
  2989. 0x900cc,
  2990. 0x7010b,
  2991. 0x80066,
  2992. 0x80026,
  2993. 0x900ac,
  2994. 0x80006,
  2995. 0x80086,
  2996. 0x80046,
  2997. 0x900ec,
  2998. 0x70107,
  2999. 0x8005e,
  3000. 0x8001e,
  3001. 0x9009c,
  3002. 0x70117,
  3003. 0x8007e,
  3004. 0x8003e,
  3005. 0x900dc,
  3006. 0x7010f,
  3007. 0x8006e,
  3008. 0x8002e,
  3009. 0x900bc,
  3010. 0x8000e,
  3011. 0x8008e,
  3012. 0x8004e,
  3013. 0x900fc,
  3014. 0x70100,
  3015. 0x80051,
  3016. 0x80011,
  3017. 0x80119,
  3018. 0x70110,
  3019. 0x80071,
  3020. 0x80031,
  3021. 0x900c2,
  3022. 0x70108,
  3023. 0x80061,
  3024. 0x80021,
  3025. 0x900a2,
  3026. 0x80001,
  3027. 0x80081,
  3028. 0x80041,
  3029. 0x900e2,
  3030. 0x70104,
  3031. 0x80059,
  3032. 0x80019,
  3033. 0x90092,
  3034. 0x70114,
  3035. 0x80079,
  3036. 0x80039,
  3037. 0x900d2,
  3038. 0x7010c,
  3039. 0x80069,
  3040. 0x80029,
  3041. 0x900b2,
  3042. 0x80009,
  3043. 0x80089,
  3044. 0x80049,
  3045. 0x900f2,
  3046. 0x70102,
  3047. 0x80055,
  3048. 0x80015,
  3049. 0x8011d,
  3050. 0x70112,
  3051. 0x80075,
  3052. 0x80035,
  3053. 0x900ca,
  3054. 0x7010a,
  3055. 0x80065,
  3056. 0x80025,
  3057. 0x900aa,
  3058. 0x80005,
  3059. 0x80085,
  3060. 0x80045,
  3061. 0x900ea,
  3062. 0x70106,
  3063. 0x8005d,
  3064. 0x8001d,
  3065. 0x9009a,
  3066. 0x70116,
  3067. 0x8007d,
  3068. 0x8003d,
  3069. 0x900da,
  3070. 0x7010e,
  3071. 0x8006d,
  3072. 0x8002d,
  3073. 0x900ba,
  3074. 0x8000d,
  3075. 0x8008d,
  3076. 0x8004d,
  3077. 0x900fa,
  3078. 0x70101,
  3079. 0x80053,
  3080. 0x80013,
  3081. 0x8011b,
  3082. 0x70111,
  3083. 0x80073,
  3084. 0x80033,
  3085. 0x900c6,
  3086. 0x70109,
  3087. 0x80063,
  3088. 0x80023,
  3089. 0x900a6,
  3090. 0x80003,
  3091. 0x80083,
  3092. 0x80043,
  3093. 0x900e6,
  3094. 0x70105,
  3095. 0x8005b,
  3096. 0x8001b,
  3097. 0x90096,
  3098. 0x70115,
  3099. 0x8007b,
  3100. 0x8003b,
  3101. 0x900d6,
  3102. 0x7010d,
  3103. 0x8006b,
  3104. 0x8002b,
  3105. 0x900b6,
  3106. 0x8000b,
  3107. 0x8008b,
  3108. 0x8004b,
  3109. 0x900f6,
  3110. 0x70103,
  3111. 0x80057,
  3112. 0x80017,
  3113. 0x8011f,
  3114. 0x70113,
  3115. 0x80077,
  3116. 0x80037,
  3117. 0x900ce,
  3118. 0x7010b,
  3119. 0x80067,
  3120. 0x80027,
  3121. 0x900ae,
  3122. 0x80007,
  3123. 0x80087,
  3124. 0x80047,
  3125. 0x900ee,
  3126. 0x70107,
  3127. 0x8005f,
  3128. 0x8001f,
  3129. 0x9009e,
  3130. 0x70117,
  3131. 0x8007f,
  3132. 0x8003f,
  3133. 0x900de,
  3134. 0x7010f,
  3135. 0x8006f,
  3136. 0x8002f,
  3137. 0x900be,
  3138. 0x8000f,
  3139. 0x8008f,
  3140. 0x8004f,
  3141. 0x900fe,
  3142. 0x70100,
  3143. 0x80050,
  3144. 0x80010,
  3145. 0x80118,
  3146. 0x70110,
  3147. 0x80070,
  3148. 0x80030,
  3149. 0x900c1,
  3150. 0x70108,
  3151. 0x80060,
  3152. 0x80020,
  3153. 0x900a1,
  3154. 0x80000,
  3155. 0x80080,
  3156. 0x80040,
  3157. 0x900e1,
  3158. 0x70104,
  3159. 0x80058,
  3160. 0x80018,
  3161. 0x90091,
  3162. 0x70114,
  3163. 0x80078,
  3164. 0x80038,
  3165. 0x900d1,
  3166. 0x7010c,
  3167. 0x80068,
  3168. 0x80028,
  3169. 0x900b1,
  3170. 0x80008,
  3171. 0x80088,
  3172. 0x80048,
  3173. 0x900f1,
  3174. 0x70102,
  3175. 0x80054,
  3176. 0x80014,
  3177. 0x8011c,
  3178. 0x70112,
  3179. 0x80074,
  3180. 0x80034,
  3181. 0x900c9,
  3182. 0x7010a,
  3183. 0x80064,
  3184. 0x80024,
  3185. 0x900a9,
  3186. 0x80004,
  3187. 0x80084,
  3188. 0x80044,
  3189. 0x900e9,
  3190. 0x70106,
  3191. 0x8005c,
  3192. 0x8001c,
  3193. 0x90099,
  3194. 0x70116,
  3195. 0x8007c,
  3196. 0x8003c,
  3197. 0x900d9,
  3198. 0x7010e,
  3199. 0x8006c,
  3200. 0x8002c,
  3201. 0x900b9,
  3202. 0x8000c,
  3203. 0x8008c,
  3204. 0x8004c,
  3205. 0x900f9,
  3206. 0x70101,
  3207. 0x80052,
  3208. 0x80012,
  3209. 0x8011a,
  3210. 0x70111,
  3211. 0x80072,
  3212. 0x80032,
  3213. 0x900c5,
  3214. 0x70109,
  3215. 0x80062,
  3216. 0x80022,
  3217. 0x900a5,
  3218. 0x80002,
  3219. 0x80082,
  3220. 0x80042,
  3221. 0x900e5,
  3222. 0x70105,
  3223. 0x8005a,
  3224. 0x8001a,
  3225. 0x90095,
  3226. 0x70115,
  3227. 0x8007a,
  3228. 0x8003a,
  3229. 0x900d5,
  3230. 0x7010d,
  3231. 0x8006a,
  3232. 0x8002a,
  3233. 0x900b5,
  3234. 0x8000a,
  3235. 0x8008a,
  3236. 0x8004a,
  3237. 0x900f5,
  3238. 0x70103,
  3239. 0x80056,
  3240. 0x80016,
  3241. 0x8011e,
  3242. 0x70113,
  3243. 0x80076,
  3244. 0x80036,
  3245. 0x900cd,
  3246. 0x7010b,
  3247. 0x80066,
  3248. 0x80026,
  3249. 0x900ad,
  3250. 0x80006,
  3251. 0x80086,
  3252. 0x80046,
  3253. 0x900ed,
  3254. 0x70107,
  3255. 0x8005e,
  3256. 0x8001e,
  3257. 0x9009d,
  3258. 0x70117,
  3259. 0x8007e,
  3260. 0x8003e,
  3261. 0x900dd,
  3262. 0x7010f,
  3263. 0x8006e,
  3264. 0x8002e,
  3265. 0x900bd,
  3266. 0x8000e,
  3267. 0x8008e,
  3268. 0x8004e,
  3269. 0x900fd,
  3270. 0x70100,
  3271. 0x80051,
  3272. 0x80011,
  3273. 0x80119,
  3274. 0x70110,
  3275. 0x80071,
  3276. 0x80031,
  3277. 0x900c3,
  3278. 0x70108,
  3279. 0x80061,
  3280. 0x80021,
  3281. 0x900a3,
  3282. 0x80001,
  3283. 0x80081,
  3284. 0x80041,
  3285. 0x900e3,
  3286. 0x70104,
  3287. 0x80059,
  3288. 0x80019,
  3289. 0x90093,
  3290. 0x70114,
  3291. 0x80079,
  3292. 0x80039,
  3293. 0x900d3,
  3294. 0x7010c,
  3295. 0x80069,
  3296. 0x80029,
  3297. 0x900b3,
  3298. 0x80009,
  3299. 0x80089,
  3300. 0x80049,
  3301. 0x900f3,
  3302. 0x70102,
  3303. 0x80055,
  3304. 0x80015,
  3305. 0x8011d,
  3306. 0x70112,
  3307. 0x80075,
  3308. 0x80035,
  3309. 0x900cb,
  3310. 0x7010a,
  3311. 0x80065,
  3312. 0x80025,
  3313. 0x900ab,
  3314. 0x80005,
  3315. 0x80085,
  3316. 0x80045,
  3317. 0x900eb,
  3318. 0x70106,
  3319. 0x8005d,
  3320. 0x8001d,
  3321. 0x9009b,
  3322. 0x70116,
  3323. 0x8007d,
  3324. 0x8003d,
  3325. 0x900db,
  3326. 0x7010e,
  3327. 0x8006d,
  3328. 0x8002d,
  3329. 0x900bb,
  3330. 0x8000d,
  3331. 0x8008d,
  3332. 0x8004d,
  3333. 0x900fb,
  3334. 0x70101,
  3335. 0x80053,
  3336. 0x80013,
  3337. 0x8011b,
  3338. 0x70111,
  3339. 0x80073,
  3340. 0x80033,
  3341. 0x900c7,
  3342. 0x70109,
  3343. 0x80063,
  3344. 0x80023,
  3345. 0x900a7,
  3346. 0x80003,
  3347. 0x80083,
  3348. 0x80043,
  3349. 0x900e7,
  3350. 0x70105,
  3351. 0x8005b,
  3352. 0x8001b,
  3353. 0x90097,
  3354. 0x70115,
  3355. 0x8007b,
  3356. 0x8003b,
  3357. 0x900d7,
  3358. 0x7010d,
  3359. 0x8006b,
  3360. 0x8002b,
  3361. 0x900b7,
  3362. 0x8000b,
  3363. 0x8008b,
  3364. 0x8004b,
  3365. 0x900f7,
  3366. 0x70103,
  3367. 0x80057,
  3368. 0x80017,
  3369. 0x8011f,
  3370. 0x70113,
  3371. 0x80077,
  3372. 0x80037,
  3373. 0x900cf,
  3374. 0x7010b,
  3375. 0x80067,
  3376. 0x80027,
  3377. 0x900af,
  3378. 0x80007,
  3379. 0x80087,
  3380. 0x80047,
  3381. 0x900ef,
  3382. 0x70107,
  3383. 0x8005f,
  3384. 0x8001f,
  3385. 0x9009f,
  3386. 0x70117,
  3387. 0x8007f,
  3388. 0x8003f,
  3389. 0x900df,
  3390. 0x7010f,
  3391. 0x8006f,
  3392. 0x8002f,
  3393. 0x900bf,
  3394. 0x8000f,
  3395. 0x8008f,
  3396. 0x8004f,
  3397. 0x900ff
  3398. ]),
  3399. 9
  3400. ];
  3401. var fixedDistCodeTab = [
  3402. new Int32Array([
  3403. 0x50000,
  3404. 0x50010,
  3405. 0x50008,
  3406. 0x50018,
  3407. 0x50004,
  3408. 0x50014,
  3409. 0x5000c,
  3410. 0x5001c,
  3411. 0x50002,
  3412. 0x50012,
  3413. 0x5000a,
  3414. 0x5001a,
  3415. 0x50006,
  3416. 0x50016,
  3417. 0x5000e,
  3418. 0x00000,
  3419. 0x50001,
  3420. 0x50011,
  3421. 0x50009,
  3422. 0x50019,
  3423. 0x50005,
  3424. 0x50015,
  3425. 0x5000d,
  3426. 0x5001d,
  3427. 0x50003,
  3428. 0x50013,
  3429. 0x5000b,
  3430. 0x5001b,
  3431. 0x50007,
  3432. 0x50017,
  3433. 0x5000f,
  3434. 0x00000
  3435. ]),
  3436. 5
  3437. ];
  3438. function FlateStream(str, maybeLength) {
  3439. this.str = str;
  3440. this.dict = str.dict;
  3441. var cmf = str.getByte();
  3442. var flg = str.getByte();
  3443. if (cmf === -1 || flg === -1) {
  3444. error('Invalid header in flate stream: ' + cmf + ', ' + flg);
  3445. }
  3446. if ((cmf & 0x0f) !== 0x08) {
  3447. error('Unknown compression method in flate stream: ' + cmf + ', ' + flg);
  3448. }
  3449. if (((cmf << 8) + flg) % 31 !== 0) {
  3450. error('Bad FCHECK in flate stream: ' + cmf + ', ' + flg);
  3451. }
  3452. if (flg & 0x20) {
  3453. error('FDICT bit set in flate stream: ' + cmf + ', ' + flg);
  3454. }
  3455. this.codeSize = 0;
  3456. this.codeBuf = 0;
  3457. DecodeStream.call(this, maybeLength);
  3458. }
  3459. FlateStream.prototype = Object.create(DecodeStream.prototype);
  3460. FlateStream.prototype.getBits = function FlateStream_getBits(bits) {
  3461. var str = this.str;
  3462. var codeSize = this.codeSize;
  3463. var codeBuf = this.codeBuf;
  3464. var b;
  3465. while (codeSize < bits) {
  3466. if ((b = str.getByte()) === -1) {
  3467. error('Bad encoding in flate stream');
  3468. }
  3469. codeBuf |= b << codeSize;
  3470. codeSize += 8;
  3471. }
  3472. b = codeBuf & (1 << bits) - 1;
  3473. this.codeBuf = codeBuf >> bits;
  3474. this.codeSize = codeSize -= bits;
  3475. return b;
  3476. };
  3477. FlateStream.prototype.getCode = function FlateStream_getCode(table) {
  3478. var str = this.str;
  3479. var codes = table[0];
  3480. var maxLen = table[1];
  3481. var codeSize = this.codeSize;
  3482. var codeBuf = this.codeBuf;
  3483. var b;
  3484. while (codeSize < maxLen) {
  3485. if ((b = str.getByte()) === -1) {
  3486. break;
  3487. }
  3488. codeBuf |= b << codeSize;
  3489. codeSize += 8;
  3490. }
  3491. var code = codes[codeBuf & (1 << maxLen) - 1];
  3492. var codeLen = code >> 16;
  3493. var codeVal = code & 0xffff;
  3494. if (codeLen < 1 || codeSize < codeLen) {
  3495. error('Bad encoding in flate stream');
  3496. }
  3497. this.codeBuf = codeBuf >> codeLen;
  3498. this.codeSize = codeSize - codeLen;
  3499. return codeVal;
  3500. };
  3501. FlateStream.prototype.generateHuffmanTable = function flateStreamGenerateHuffmanTable(lengths) {
  3502. var n = lengths.length;
  3503. var maxLen = 0;
  3504. var i;
  3505. for (i = 0; i < n; ++i) {
  3506. if (lengths[i] > maxLen) {
  3507. maxLen = lengths[i];
  3508. }
  3509. }
  3510. var size = 1 << maxLen;
  3511. var codes = new Int32Array(size);
  3512. for (var len = 1, code = 0, skip = 2; len <= maxLen; ++len, code <<= 1, skip <<= 1) {
  3513. for (var val = 0; val < n; ++val) {
  3514. if (lengths[val] === len) {
  3515. var code2 = 0;
  3516. var t = code;
  3517. for (i = 0; i < len; ++i) {
  3518. code2 = code2 << 1 | t & 1;
  3519. t >>= 1;
  3520. }
  3521. for (i = code2; i < size; i += skip) {
  3522. codes[i] = len << 16 | val;
  3523. }
  3524. ++code;
  3525. }
  3526. }
  3527. }
  3528. return [
  3529. codes,
  3530. maxLen
  3531. ];
  3532. };
  3533. FlateStream.prototype.readBlock = function FlateStream_readBlock() {
  3534. var buffer, len;
  3535. var str = this.str;
  3536. var hdr = this.getBits(3);
  3537. if (hdr & 1) {
  3538. this.eof = true;
  3539. }
  3540. hdr >>= 1;
  3541. if (hdr === 0) {
  3542. var b;
  3543. if ((b = str.getByte()) === -1) {
  3544. error('Bad block header in flate stream');
  3545. }
  3546. var blockLen = b;
  3547. if ((b = str.getByte()) === -1) {
  3548. error('Bad block header in flate stream');
  3549. }
  3550. blockLen |= b << 8;
  3551. if ((b = str.getByte()) === -1) {
  3552. error('Bad block header in flate stream');
  3553. }
  3554. var check = b;
  3555. if ((b = str.getByte()) === -1) {
  3556. error('Bad block header in flate stream');
  3557. }
  3558. check |= b << 8;
  3559. if (check !== (~blockLen & 0xffff) && (blockLen !== 0 || check !== 0)) {
  3560. error('Bad uncompressed block length in flate stream');
  3561. }
  3562. this.codeBuf = 0;
  3563. this.codeSize = 0;
  3564. var bufferLength = this.bufferLength;
  3565. buffer = this.ensureBuffer(bufferLength + blockLen);
  3566. var end = bufferLength + blockLen;
  3567. this.bufferLength = end;
  3568. if (blockLen === 0) {
  3569. if (str.peekByte() === -1) {
  3570. this.eof = true;
  3571. }
  3572. } else {
  3573. for (var n = bufferLength; n < end; ++n) {
  3574. if ((b = str.getByte()) === -1) {
  3575. this.eof = true;
  3576. break;
  3577. }
  3578. buffer[n] = b;
  3579. }
  3580. }
  3581. return;
  3582. }
  3583. var litCodeTable;
  3584. var distCodeTable;
  3585. if (hdr === 1) {
  3586. litCodeTable = fixedLitCodeTab;
  3587. distCodeTable = fixedDistCodeTab;
  3588. } else if (hdr === 2) {
  3589. var numLitCodes = this.getBits(5) + 257;
  3590. var numDistCodes = this.getBits(5) + 1;
  3591. var numCodeLenCodes = this.getBits(4) + 4;
  3592. var codeLenCodeLengths = new Uint8Array(codeLenCodeMap.length);
  3593. var i;
  3594. for (i = 0; i < numCodeLenCodes; ++i) {
  3595. codeLenCodeLengths[codeLenCodeMap[i]] = this.getBits(3);
  3596. }
  3597. var codeLenCodeTab = this.generateHuffmanTable(codeLenCodeLengths);
  3598. len = 0;
  3599. i = 0;
  3600. var codes = numLitCodes + numDistCodes;
  3601. var codeLengths = new Uint8Array(codes);
  3602. var bitsLength, bitsOffset, what;
  3603. while (i < codes) {
  3604. var code = this.getCode(codeLenCodeTab);
  3605. if (code === 16) {
  3606. bitsLength = 2;
  3607. bitsOffset = 3;
  3608. what = len;
  3609. } else if (code === 17) {
  3610. bitsLength = 3;
  3611. bitsOffset = 3;
  3612. what = len = 0;
  3613. } else if (code === 18) {
  3614. bitsLength = 7;
  3615. bitsOffset = 11;
  3616. what = len = 0;
  3617. } else {
  3618. codeLengths[i++] = len = code;
  3619. continue;
  3620. }
  3621. var repeatLength = this.getBits(bitsLength) + bitsOffset;
  3622. while (repeatLength-- > 0) {
  3623. codeLengths[i++] = what;
  3624. }
  3625. }
  3626. litCodeTable = this.generateHuffmanTable(codeLengths.subarray(0, numLitCodes));
  3627. distCodeTable = this.generateHuffmanTable(codeLengths.subarray(numLitCodes, codes));
  3628. } else {
  3629. error('Unknown block type in flate stream');
  3630. }
  3631. buffer = this.buffer;
  3632. var limit = buffer ? buffer.length : 0;
  3633. var pos = this.bufferLength;
  3634. while (true) {
  3635. var code1 = this.getCode(litCodeTable);
  3636. if (code1 < 256) {
  3637. if (pos + 1 >= limit) {
  3638. buffer = this.ensureBuffer(pos + 1);
  3639. limit = buffer.length;
  3640. }
  3641. buffer[pos++] = code1;
  3642. continue;
  3643. }
  3644. if (code1 === 256) {
  3645. this.bufferLength = pos;
  3646. return;
  3647. }
  3648. code1 -= 257;
  3649. code1 = lengthDecode[code1];
  3650. var code2 = code1 >> 16;
  3651. if (code2 > 0) {
  3652. code2 = this.getBits(code2);
  3653. }
  3654. len = (code1 & 0xffff) + code2;
  3655. code1 = this.getCode(distCodeTable);
  3656. code1 = distDecode[code1];
  3657. code2 = code1 >> 16;
  3658. if (code2 > 0) {
  3659. code2 = this.getBits(code2);
  3660. }
  3661. var dist = (code1 & 0xffff) + code2;
  3662. if (pos + len >= limit) {
  3663. buffer = this.ensureBuffer(pos + len);
  3664. limit = buffer.length;
  3665. }
  3666. for (var k = 0; k < len; ++k, ++pos) {
  3667. buffer[pos] = buffer[pos - dist];
  3668. }
  3669. }
  3670. };
  3671. return FlateStream;
  3672. }();
  3673. var PredictorStream = function PredictorStreamClosure() {
  3674. function PredictorStream(str, maybeLength, params) {
  3675. if (!isDict(params)) {
  3676. return str;
  3677. }
  3678. var predictor = this.predictor = params.get('Predictor') || 1;
  3679. if (predictor <= 1) {
  3680. return str;
  3681. }
  3682. if (predictor !== 2 && (predictor < 10 || predictor > 15)) {
  3683. error('Unsupported predictor: ' + predictor);
  3684. }
  3685. if (predictor === 2) {
  3686. this.readBlock = this.readBlockTiff;
  3687. } else {
  3688. this.readBlock = this.readBlockPng;
  3689. }
  3690. this.str = str;
  3691. this.dict = str.dict;
  3692. var colors = this.colors = params.get('Colors') || 1;
  3693. var bits = this.bits = params.get('BitsPerComponent') || 8;
  3694. var columns = this.columns = params.get('Columns') || 1;
  3695. this.pixBytes = colors * bits + 7 >> 3;
  3696. this.rowBytes = columns * colors * bits + 7 >> 3;
  3697. DecodeStream.call(this, maybeLength);
  3698. return this;
  3699. }
  3700. PredictorStream.prototype = Object.create(DecodeStream.prototype);
  3701. PredictorStream.prototype.readBlockTiff = function predictorStreamReadBlockTiff() {
  3702. var rowBytes = this.rowBytes;
  3703. var bufferLength = this.bufferLength;
  3704. var buffer = this.ensureBuffer(bufferLength + rowBytes);
  3705. var bits = this.bits;
  3706. var colors = this.colors;
  3707. var rawBytes = this.str.getBytes(rowBytes);
  3708. this.eof = !rawBytes.length;
  3709. if (this.eof) {
  3710. return;
  3711. }
  3712. var inbuf = 0, outbuf = 0;
  3713. var inbits = 0, outbits = 0;
  3714. var pos = bufferLength;
  3715. var i;
  3716. if (bits === 1 && colors === 1) {
  3717. for (i = 0; i < rowBytes; ++i) {
  3718. var c = rawBytes[i] ^ inbuf;
  3719. c ^= c >> 1;
  3720. c ^= c >> 2;
  3721. c ^= c >> 4;
  3722. inbuf = (c & 1) << 7;
  3723. buffer[pos++] = c;
  3724. }
  3725. } else if (bits === 8) {
  3726. for (i = 0; i < colors; ++i) {
  3727. buffer[pos++] = rawBytes[i];
  3728. }
  3729. for (; i < rowBytes; ++i) {
  3730. buffer[pos] = buffer[pos - colors] + rawBytes[i];
  3731. pos++;
  3732. }
  3733. } else {
  3734. var compArray = new Uint8Array(colors + 1);
  3735. var bitMask = (1 << bits) - 1;
  3736. var j = 0, k = bufferLength;
  3737. var columns = this.columns;
  3738. for (i = 0; i < columns; ++i) {
  3739. for (var kk = 0; kk < colors; ++kk) {
  3740. if (inbits < bits) {
  3741. inbuf = inbuf << 8 | rawBytes[j++] & 0xFF;
  3742. inbits += 8;
  3743. }
  3744. compArray[kk] = compArray[kk] + (inbuf >> inbits - bits) & bitMask;
  3745. inbits -= bits;
  3746. outbuf = outbuf << bits | compArray[kk];
  3747. outbits += bits;
  3748. if (outbits >= 8) {
  3749. buffer[k++] = outbuf >> outbits - 8 & 0xFF;
  3750. outbits -= 8;
  3751. }
  3752. }
  3753. }
  3754. if (outbits > 0) {
  3755. buffer[k++] = (outbuf << 8 - outbits) + (inbuf & (1 << 8 - outbits) - 1);
  3756. }
  3757. }
  3758. this.bufferLength += rowBytes;
  3759. };
  3760. PredictorStream.prototype.readBlockPng = function predictorStreamReadBlockPng() {
  3761. var rowBytes = this.rowBytes;
  3762. var pixBytes = this.pixBytes;
  3763. var predictor = this.str.getByte();
  3764. var rawBytes = this.str.getBytes(rowBytes);
  3765. this.eof = !rawBytes.length;
  3766. if (this.eof) {
  3767. return;
  3768. }
  3769. var bufferLength = this.bufferLength;
  3770. var buffer = this.ensureBuffer(bufferLength + rowBytes);
  3771. var prevRow = buffer.subarray(bufferLength - rowBytes, bufferLength);
  3772. if (prevRow.length === 0) {
  3773. prevRow = new Uint8Array(rowBytes);
  3774. }
  3775. var i, j = bufferLength, up, c;
  3776. switch (predictor) {
  3777. case 0:
  3778. for (i = 0; i < rowBytes; ++i) {
  3779. buffer[j++] = rawBytes[i];
  3780. }
  3781. break;
  3782. case 1:
  3783. for (i = 0; i < pixBytes; ++i) {
  3784. buffer[j++] = rawBytes[i];
  3785. }
  3786. for (; i < rowBytes; ++i) {
  3787. buffer[j] = buffer[j - pixBytes] + rawBytes[i] & 0xFF;
  3788. j++;
  3789. }
  3790. break;
  3791. case 2:
  3792. for (i = 0; i < rowBytes; ++i) {
  3793. buffer[j++] = prevRow[i] + rawBytes[i] & 0xFF;
  3794. }
  3795. break;
  3796. case 3:
  3797. for (i = 0; i < pixBytes; ++i) {
  3798. buffer[j++] = (prevRow[i] >> 1) + rawBytes[i];
  3799. }
  3800. for (; i < rowBytes; ++i) {
  3801. buffer[j] = (prevRow[i] + buffer[j - pixBytes] >> 1) + rawBytes[i] & 0xFF;
  3802. j++;
  3803. }
  3804. break;
  3805. case 4:
  3806. for (i = 0; i < pixBytes; ++i) {
  3807. up = prevRow[i];
  3808. c = rawBytes[i];
  3809. buffer[j++] = up + c;
  3810. }
  3811. for (; i < rowBytes; ++i) {
  3812. up = prevRow[i];
  3813. var upLeft = prevRow[i - pixBytes];
  3814. var left = buffer[j - pixBytes];
  3815. var p = left + up - upLeft;
  3816. var pa = p - left;
  3817. if (pa < 0) {
  3818. pa = -pa;
  3819. }
  3820. var pb = p - up;
  3821. if (pb < 0) {
  3822. pb = -pb;
  3823. }
  3824. var pc = p - upLeft;
  3825. if (pc < 0) {
  3826. pc = -pc;
  3827. }
  3828. c = rawBytes[i];
  3829. if (pa <= pb && pa <= pc) {
  3830. buffer[j++] = left + c;
  3831. } else if (pb <= pc) {
  3832. buffer[j++] = up + c;
  3833. } else {
  3834. buffer[j++] = upLeft + c;
  3835. }
  3836. }
  3837. break;
  3838. default:
  3839. error('Unsupported predictor: ' + predictor);
  3840. }
  3841. this.bufferLength += rowBytes;
  3842. };
  3843. return PredictorStream;
  3844. }();
  3845. var JpegStream = function JpegStreamClosure() {
  3846. function JpegStream(stream, maybeLength, dict, params) {
  3847. var ch;
  3848. while ((ch = stream.getByte()) !== -1) {
  3849. if (ch === 0xFF) {
  3850. stream.skip(-1);
  3851. break;
  3852. }
  3853. }
  3854. this.stream = stream;
  3855. this.maybeLength = maybeLength;
  3856. this.dict = dict;
  3857. this.params = params;
  3858. DecodeStream.call(this, maybeLength);
  3859. }
  3860. JpegStream.prototype = Object.create(DecodeStream.prototype);
  3861. Object.defineProperty(JpegStream.prototype, 'bytes', {
  3862. get: function JpegStream_bytes() {
  3863. return shadow(this, 'bytes', this.stream.getBytes(this.maybeLength));
  3864. },
  3865. configurable: true
  3866. });
  3867. JpegStream.prototype.ensureBuffer = function JpegStream_ensureBuffer(req) {
  3868. if (this.bufferLength) {
  3869. return;
  3870. }
  3871. var jpegImage = new JpegImage();
  3872. var decodeArr = this.dict.getArray('Decode', 'D');
  3873. if (this.forceRGB && isArray(decodeArr)) {
  3874. var bitsPerComponent = this.dict.get('BitsPerComponent') || 8;
  3875. var decodeArrLength = decodeArr.length;
  3876. var transform = new Int32Array(decodeArrLength);
  3877. var transformNeeded = false;
  3878. var maxValue = (1 << bitsPerComponent) - 1;
  3879. for (var i = 0; i < decodeArrLength; i += 2) {
  3880. transform[i] = (decodeArr[i + 1] - decodeArr[i]) * 256 | 0;
  3881. transform[i + 1] = decodeArr[i] * maxValue | 0;
  3882. if (transform[i] !== 256 || transform[i + 1] !== 0) {
  3883. transformNeeded = true;
  3884. }
  3885. }
  3886. if (transformNeeded) {
  3887. jpegImage.decodeTransform = transform;
  3888. }
  3889. }
  3890. if (isDict(this.params)) {
  3891. var colorTransform = this.params.get('ColorTransform');
  3892. if (isInt(colorTransform)) {
  3893. jpegImage.colorTransform = colorTransform;
  3894. }
  3895. }
  3896. jpegImage.parse(this.bytes);
  3897. var data = jpegImage.getData(this.drawWidth, this.drawHeight, this.forceRGB);
  3898. this.buffer = data;
  3899. this.bufferLength = data.length;
  3900. this.eof = true;
  3901. };
  3902. JpegStream.prototype.getBytes = function JpegStream_getBytes(length) {
  3903. this.ensureBuffer();
  3904. return this.buffer;
  3905. };
  3906. JpegStream.prototype.getIR = function JpegStream_getIR(forceDataSchema) {
  3907. return createObjectURL(this.bytes, 'image/jpeg', forceDataSchema);
  3908. };
  3909. return JpegStream;
  3910. }();
  3911. var JpxStream = function JpxStreamClosure() {
  3912. function JpxStream(stream, maybeLength, dict, params) {
  3913. this.stream = stream;
  3914. this.maybeLength = maybeLength;
  3915. this.dict = dict;
  3916. this.params = params;
  3917. DecodeStream.call(this, maybeLength);
  3918. }
  3919. JpxStream.prototype = Object.create(DecodeStream.prototype);
  3920. Object.defineProperty(JpxStream.prototype, 'bytes', {
  3921. get: function JpxStream_bytes() {
  3922. return shadow(this, 'bytes', this.stream.getBytes(this.maybeLength));
  3923. },
  3924. configurable: true
  3925. });
  3926. JpxStream.prototype.ensureBuffer = function JpxStream_ensureBuffer(req) {
  3927. if (this.bufferLength) {
  3928. return;
  3929. }
  3930. var jpxImage = new JpxImage();
  3931. jpxImage.parse(this.bytes);
  3932. var width = jpxImage.width;
  3933. var height = jpxImage.height;
  3934. var componentsCount = jpxImage.componentsCount;
  3935. var tileCount = jpxImage.tiles.length;
  3936. if (tileCount === 1) {
  3937. this.buffer = jpxImage.tiles[0].items;
  3938. } else {
  3939. var data = new Uint8Array(width * height * componentsCount);
  3940. for (var k = 0; k < tileCount; k++) {
  3941. var tileComponents = jpxImage.tiles[k];
  3942. var tileWidth = tileComponents.width;
  3943. var tileHeight = tileComponents.height;
  3944. var tileLeft = tileComponents.left;
  3945. var tileTop = tileComponents.top;
  3946. var src = tileComponents.items;
  3947. var srcPosition = 0;
  3948. var dataPosition = (width * tileTop + tileLeft) * componentsCount;
  3949. var imgRowSize = width * componentsCount;
  3950. var tileRowSize = tileWidth * componentsCount;
  3951. for (var j = 0; j < tileHeight; j++) {
  3952. var rowBytes = src.subarray(srcPosition, srcPosition + tileRowSize);
  3953. data.set(rowBytes, dataPosition);
  3954. srcPosition += tileRowSize;
  3955. dataPosition += imgRowSize;
  3956. }
  3957. }
  3958. this.buffer = data;
  3959. }
  3960. this.bufferLength = this.buffer.length;
  3961. this.eof = true;
  3962. };
  3963. return JpxStream;
  3964. }();
  3965. var Jbig2Stream = function Jbig2StreamClosure() {
  3966. function Jbig2Stream(stream, maybeLength, dict, params) {
  3967. this.stream = stream;
  3968. this.maybeLength = maybeLength;
  3969. this.dict = dict;
  3970. this.params = params;
  3971. DecodeStream.call(this, maybeLength);
  3972. }
  3973. Jbig2Stream.prototype = Object.create(DecodeStream.prototype);
  3974. Object.defineProperty(Jbig2Stream.prototype, 'bytes', {
  3975. get: function Jbig2Stream_bytes() {
  3976. return shadow(this, 'bytes', this.stream.getBytes(this.maybeLength));
  3977. },
  3978. configurable: true
  3979. });
  3980. Jbig2Stream.prototype.ensureBuffer = function Jbig2Stream_ensureBuffer(req) {
  3981. if (this.bufferLength) {
  3982. return;
  3983. }
  3984. var jbig2Image = new Jbig2Image();
  3985. var chunks = [];
  3986. if (isDict(this.params)) {
  3987. var globalsStream = this.params.get('JBIG2Globals');
  3988. if (isStream(globalsStream)) {
  3989. var globals = globalsStream.getBytes();
  3990. chunks.push({
  3991. data: globals,
  3992. start: 0,
  3993. end: globals.length
  3994. });
  3995. }
  3996. }
  3997. chunks.push({
  3998. data: this.bytes,
  3999. start: 0,
  4000. end: this.bytes.length
  4001. });
  4002. var data = jbig2Image.parseChunks(chunks);
  4003. var dataLength = data.length;
  4004. for (var i = 0; i < dataLength; i++) {
  4005. data[i] ^= 0xFF;
  4006. }
  4007. this.buffer = data;
  4008. this.bufferLength = dataLength;
  4009. this.eof = true;
  4010. };
  4011. return Jbig2Stream;
  4012. }();
  4013. var DecryptStream = function DecryptStreamClosure() {
  4014. function DecryptStream(str, maybeLength, decrypt) {
  4015. this.str = str;
  4016. this.dict = str.dict;
  4017. this.decrypt = decrypt;
  4018. this.nextChunk = null;
  4019. this.initialized = false;
  4020. DecodeStream.call(this, maybeLength);
  4021. }
  4022. var chunkSize = 512;
  4023. DecryptStream.prototype = Object.create(DecodeStream.prototype);
  4024. DecryptStream.prototype.readBlock = function DecryptStream_readBlock() {
  4025. var chunk;
  4026. if (this.initialized) {
  4027. chunk = this.nextChunk;
  4028. } else {
  4029. chunk = this.str.getBytes(chunkSize);
  4030. this.initialized = true;
  4031. }
  4032. if (!chunk || chunk.length === 0) {
  4033. this.eof = true;
  4034. return;
  4035. }
  4036. this.nextChunk = this.str.getBytes(chunkSize);
  4037. var hasMoreData = this.nextChunk && this.nextChunk.length > 0;
  4038. var decrypt = this.decrypt;
  4039. chunk = decrypt(chunk, !hasMoreData);
  4040. var bufferLength = this.bufferLength;
  4041. var i, n = chunk.length;
  4042. var buffer = this.ensureBuffer(bufferLength + n);
  4043. for (i = 0; i < n; i++) {
  4044. buffer[bufferLength++] = chunk[i];
  4045. }
  4046. this.bufferLength = bufferLength;
  4047. };
  4048. return DecryptStream;
  4049. }();
  4050. var Ascii85Stream = function Ascii85StreamClosure() {
  4051. function Ascii85Stream(str, maybeLength) {
  4052. this.str = str;
  4053. this.dict = str.dict;
  4054. this.input = new Uint8Array(5);
  4055. if (maybeLength) {
  4056. maybeLength = 0.8 * maybeLength;
  4057. }
  4058. DecodeStream.call(this, maybeLength);
  4059. }
  4060. Ascii85Stream.prototype = Object.create(DecodeStream.prototype);
  4061. Ascii85Stream.prototype.readBlock = function Ascii85Stream_readBlock() {
  4062. var TILDA_CHAR = 0x7E;
  4063. var Z_LOWER_CHAR = 0x7A;
  4064. var EOF = -1;
  4065. var str = this.str;
  4066. var c = str.getByte();
  4067. while (isSpace(c)) {
  4068. c = str.getByte();
  4069. }
  4070. if (c === EOF || c === TILDA_CHAR) {
  4071. this.eof = true;
  4072. return;
  4073. }
  4074. var bufferLength = this.bufferLength, buffer;
  4075. var i;
  4076. if (c === Z_LOWER_CHAR) {
  4077. buffer = this.ensureBuffer(bufferLength + 4);
  4078. for (i = 0; i < 4; ++i) {
  4079. buffer[bufferLength + i] = 0;
  4080. }
  4081. this.bufferLength += 4;
  4082. } else {
  4083. var input = this.input;
  4084. input[0] = c;
  4085. for (i = 1; i < 5; ++i) {
  4086. c = str.getByte();
  4087. while (isSpace(c)) {
  4088. c = str.getByte();
  4089. }
  4090. input[i] = c;
  4091. if (c === EOF || c === TILDA_CHAR) {
  4092. break;
  4093. }
  4094. }
  4095. buffer = this.ensureBuffer(bufferLength + i - 1);
  4096. this.bufferLength += i - 1;
  4097. if (i < 5) {
  4098. for (; i < 5; ++i) {
  4099. input[i] = 0x21 + 84;
  4100. }
  4101. this.eof = true;
  4102. }
  4103. var t = 0;
  4104. for (i = 0; i < 5; ++i) {
  4105. t = t * 85 + (input[i] - 0x21);
  4106. }
  4107. for (i = 3; i >= 0; --i) {
  4108. buffer[bufferLength + i] = t & 0xFF;
  4109. t >>= 8;
  4110. }
  4111. }
  4112. };
  4113. return Ascii85Stream;
  4114. }();
  4115. var AsciiHexStream = function AsciiHexStreamClosure() {
  4116. function AsciiHexStream(str, maybeLength) {
  4117. this.str = str;
  4118. this.dict = str.dict;
  4119. this.firstDigit = -1;
  4120. if (maybeLength) {
  4121. maybeLength = 0.5 * maybeLength;
  4122. }
  4123. DecodeStream.call(this, maybeLength);
  4124. }
  4125. AsciiHexStream.prototype = Object.create(DecodeStream.prototype);
  4126. AsciiHexStream.prototype.readBlock = function AsciiHexStream_readBlock() {
  4127. var UPSTREAM_BLOCK_SIZE = 8000;
  4128. var bytes = this.str.getBytes(UPSTREAM_BLOCK_SIZE);
  4129. if (!bytes.length) {
  4130. this.eof = true;
  4131. return;
  4132. }
  4133. var maxDecodeLength = bytes.length + 1 >> 1;
  4134. var buffer = this.ensureBuffer(this.bufferLength + maxDecodeLength);
  4135. var bufferLength = this.bufferLength;
  4136. var firstDigit = this.firstDigit;
  4137. for (var i = 0, ii = bytes.length; i < ii; i++) {
  4138. var ch = bytes[i], digit;
  4139. if (ch >= 0x30 && ch <= 0x39) {
  4140. digit = ch & 0x0F;
  4141. } else if (ch >= 0x41 && ch <= 0x46 || ch >= 0x61 && ch <= 0x66) {
  4142. digit = (ch & 0x0F) + 9;
  4143. } else if (ch === 0x3E) {
  4144. this.eof = true;
  4145. break;
  4146. } else {
  4147. continue;
  4148. }
  4149. if (firstDigit < 0) {
  4150. firstDigit = digit;
  4151. } else {
  4152. buffer[bufferLength++] = firstDigit << 4 | digit;
  4153. firstDigit = -1;
  4154. }
  4155. }
  4156. if (firstDigit >= 0 && this.eof) {
  4157. buffer[bufferLength++] = firstDigit << 4;
  4158. firstDigit = -1;
  4159. }
  4160. this.firstDigit = firstDigit;
  4161. this.bufferLength = bufferLength;
  4162. };
  4163. return AsciiHexStream;
  4164. }();
  4165. var RunLengthStream = function RunLengthStreamClosure() {
  4166. function RunLengthStream(str, maybeLength) {
  4167. this.str = str;
  4168. this.dict = str.dict;
  4169. DecodeStream.call(this, maybeLength);
  4170. }
  4171. RunLengthStream.prototype = Object.create(DecodeStream.prototype);
  4172. RunLengthStream.prototype.readBlock = function RunLengthStream_readBlock() {
  4173. var repeatHeader = this.str.getBytes(2);
  4174. if (!repeatHeader || repeatHeader.length < 2 || repeatHeader[0] === 128) {
  4175. this.eof = true;
  4176. return;
  4177. }
  4178. var buffer;
  4179. var bufferLength = this.bufferLength;
  4180. var n = repeatHeader[0];
  4181. if (n < 128) {
  4182. buffer = this.ensureBuffer(bufferLength + n + 1);
  4183. buffer[bufferLength++] = repeatHeader[1];
  4184. if (n > 0) {
  4185. var source = this.str.getBytes(n);
  4186. buffer.set(source, bufferLength);
  4187. bufferLength += n;
  4188. }
  4189. } else {
  4190. n = 257 - n;
  4191. var b = repeatHeader[1];
  4192. buffer = this.ensureBuffer(bufferLength + n + 1);
  4193. for (var i = 0; i < n; i++) {
  4194. buffer[bufferLength++] = b;
  4195. }
  4196. }
  4197. this.bufferLength = bufferLength;
  4198. };
  4199. return RunLengthStream;
  4200. }();
  4201. var CCITTFaxStream = function CCITTFaxStreamClosure() {
  4202. var ccittEOL = -2;
  4203. var ccittEOF = -1;
  4204. var twoDimPass = 0;
  4205. var twoDimHoriz = 1;
  4206. var twoDimVert0 = 2;
  4207. var twoDimVertR1 = 3;
  4208. var twoDimVertL1 = 4;
  4209. var twoDimVertR2 = 5;
  4210. var twoDimVertL2 = 6;
  4211. var twoDimVertR3 = 7;
  4212. var twoDimVertL3 = 8;
  4213. var twoDimTable = [
  4214. [
  4215. -1,
  4216. -1
  4217. ],
  4218. [
  4219. -1,
  4220. -1
  4221. ],
  4222. [
  4223. 7,
  4224. twoDimVertL3
  4225. ],
  4226. [
  4227. 7,
  4228. twoDimVertR3
  4229. ],
  4230. [
  4231. 6,
  4232. twoDimVertL2
  4233. ],
  4234. [
  4235. 6,
  4236. twoDimVertL2
  4237. ],
  4238. [
  4239. 6,
  4240. twoDimVertR2
  4241. ],
  4242. [
  4243. 6,
  4244. twoDimVertR2
  4245. ],
  4246. [
  4247. 4,
  4248. twoDimPass
  4249. ],
  4250. [
  4251. 4,
  4252. twoDimPass
  4253. ],
  4254. [
  4255. 4,
  4256. twoDimPass
  4257. ],
  4258. [
  4259. 4,
  4260. twoDimPass
  4261. ],
  4262. [
  4263. 4,
  4264. twoDimPass
  4265. ],
  4266. [
  4267. 4,
  4268. twoDimPass
  4269. ],
  4270. [
  4271. 4,
  4272. twoDimPass
  4273. ],
  4274. [
  4275. 4,
  4276. twoDimPass
  4277. ],
  4278. [
  4279. 3,
  4280. twoDimHoriz
  4281. ],
  4282. [
  4283. 3,
  4284. twoDimHoriz
  4285. ],
  4286. [
  4287. 3,
  4288. twoDimHoriz
  4289. ],
  4290. [
  4291. 3,
  4292. twoDimHoriz
  4293. ],
  4294. [
  4295. 3,
  4296. twoDimHoriz
  4297. ],
  4298. [
  4299. 3,
  4300. twoDimHoriz
  4301. ],
  4302. [
  4303. 3,
  4304. twoDimHoriz
  4305. ],
  4306. [
  4307. 3,
  4308. twoDimHoriz
  4309. ],
  4310. [
  4311. 3,
  4312. twoDimHoriz
  4313. ],
  4314. [
  4315. 3,
  4316. twoDimHoriz
  4317. ],
  4318. [
  4319. 3,
  4320. twoDimHoriz
  4321. ],
  4322. [
  4323. 3,
  4324. twoDimHoriz
  4325. ],
  4326. [
  4327. 3,
  4328. twoDimHoriz
  4329. ],
  4330. [
  4331. 3,
  4332. twoDimHoriz
  4333. ],
  4334. [
  4335. 3,
  4336. twoDimHoriz
  4337. ],
  4338. [
  4339. 3,
  4340. twoDimHoriz
  4341. ],
  4342. [
  4343. 3,
  4344. twoDimVertL1
  4345. ],
  4346. [
  4347. 3,
  4348. twoDimVertL1
  4349. ],
  4350. [
  4351. 3,
  4352. twoDimVertL1
  4353. ],
  4354. [
  4355. 3,
  4356. twoDimVertL1
  4357. ],
  4358. [
  4359. 3,
  4360. twoDimVertL1
  4361. ],
  4362. [
  4363. 3,
  4364. twoDimVertL1
  4365. ],
  4366. [
  4367. 3,
  4368. twoDimVertL1
  4369. ],
  4370. [
  4371. 3,
  4372. twoDimVertL1
  4373. ],
  4374. [
  4375. 3,
  4376. twoDimVertL1
  4377. ],
  4378. [
  4379. 3,
  4380. twoDimVertL1
  4381. ],
  4382. [
  4383. 3,
  4384. twoDimVertL1
  4385. ],
  4386. [
  4387. 3,
  4388. twoDimVertL1
  4389. ],
  4390. [
  4391. 3,
  4392. twoDimVertL1
  4393. ],
  4394. [
  4395. 3,
  4396. twoDimVertL1
  4397. ],
  4398. [
  4399. 3,
  4400. twoDimVertL1
  4401. ],
  4402. [
  4403. 3,
  4404. twoDimVertL1
  4405. ],
  4406. [
  4407. 3,
  4408. twoDimVertR1
  4409. ],
  4410. [
  4411. 3,
  4412. twoDimVertR1
  4413. ],
  4414. [
  4415. 3,
  4416. twoDimVertR1
  4417. ],
  4418. [
  4419. 3,
  4420. twoDimVertR1
  4421. ],
  4422. [
  4423. 3,
  4424. twoDimVertR1
  4425. ],
  4426. [
  4427. 3,
  4428. twoDimVertR1
  4429. ],
  4430. [
  4431. 3,
  4432. twoDimVertR1
  4433. ],
  4434. [
  4435. 3,
  4436. twoDimVertR1
  4437. ],
  4438. [
  4439. 3,
  4440. twoDimVertR1
  4441. ],
  4442. [
  4443. 3,
  4444. twoDimVertR1
  4445. ],
  4446. [
  4447. 3,
  4448. twoDimVertR1
  4449. ],
  4450. [
  4451. 3,
  4452. twoDimVertR1
  4453. ],
  4454. [
  4455. 3,
  4456. twoDimVertR1
  4457. ],
  4458. [
  4459. 3,
  4460. twoDimVertR1
  4461. ],
  4462. [
  4463. 3,
  4464. twoDimVertR1
  4465. ],
  4466. [
  4467. 3,
  4468. twoDimVertR1
  4469. ],
  4470. [
  4471. 1,
  4472. twoDimVert0
  4473. ],
  4474. [
  4475. 1,
  4476. twoDimVert0
  4477. ],
  4478. [
  4479. 1,
  4480. twoDimVert0
  4481. ],
  4482. [
  4483. 1,
  4484. twoDimVert0
  4485. ],
  4486. [
  4487. 1,
  4488. twoDimVert0
  4489. ],
  4490. [
  4491. 1,
  4492. twoDimVert0
  4493. ],
  4494. [
  4495. 1,
  4496. twoDimVert0
  4497. ],
  4498. [
  4499. 1,
  4500. twoDimVert0
  4501. ],
  4502. [
  4503. 1,
  4504. twoDimVert0
  4505. ],
  4506. [
  4507. 1,
  4508. twoDimVert0
  4509. ],
  4510. [
  4511. 1,
  4512. twoDimVert0
  4513. ],
  4514. [
  4515. 1,
  4516. twoDimVert0
  4517. ],
  4518. [
  4519. 1,
  4520. twoDimVert0
  4521. ],
  4522. [
  4523. 1,
  4524. twoDimVert0
  4525. ],
  4526. [
  4527. 1,
  4528. twoDimVert0
  4529. ],
  4530. [
  4531. 1,
  4532. twoDimVert0
  4533. ],
  4534. [
  4535. 1,
  4536. twoDimVert0
  4537. ],
  4538. [
  4539. 1,
  4540. twoDimVert0
  4541. ],
  4542. [
  4543. 1,
  4544. twoDimVert0
  4545. ],
  4546. [
  4547. 1,
  4548. twoDimVert0
  4549. ],
  4550. [
  4551. 1,
  4552. twoDimVert0
  4553. ],
  4554. [
  4555. 1,
  4556. twoDimVert0
  4557. ],
  4558. [
  4559. 1,
  4560. twoDimVert0
  4561. ],
  4562. [
  4563. 1,
  4564. twoDimVert0
  4565. ],
  4566. [
  4567. 1,
  4568. twoDimVert0
  4569. ],
  4570. [
  4571. 1,
  4572. twoDimVert0
  4573. ],
  4574. [
  4575. 1,
  4576. twoDimVert0
  4577. ],
  4578. [
  4579. 1,
  4580. twoDimVert0
  4581. ],
  4582. [
  4583. 1,
  4584. twoDimVert0
  4585. ],
  4586. [
  4587. 1,
  4588. twoDimVert0
  4589. ],
  4590. [
  4591. 1,
  4592. twoDimVert0
  4593. ],
  4594. [
  4595. 1,
  4596. twoDimVert0
  4597. ],
  4598. [
  4599. 1,
  4600. twoDimVert0
  4601. ],
  4602. [
  4603. 1,
  4604. twoDimVert0
  4605. ],
  4606. [
  4607. 1,
  4608. twoDimVert0
  4609. ],
  4610. [
  4611. 1,
  4612. twoDimVert0
  4613. ],
  4614. [
  4615. 1,
  4616. twoDimVert0
  4617. ],
  4618. [
  4619. 1,
  4620. twoDimVert0
  4621. ],
  4622. [
  4623. 1,
  4624. twoDimVert0
  4625. ],
  4626. [
  4627. 1,
  4628. twoDimVert0
  4629. ],
  4630. [
  4631. 1,
  4632. twoDimVert0
  4633. ],
  4634. [
  4635. 1,
  4636. twoDimVert0
  4637. ],
  4638. [
  4639. 1,
  4640. twoDimVert0
  4641. ],
  4642. [
  4643. 1,
  4644. twoDimVert0
  4645. ],
  4646. [
  4647. 1,
  4648. twoDimVert0
  4649. ],
  4650. [
  4651. 1,
  4652. twoDimVert0
  4653. ],
  4654. [
  4655. 1,
  4656. twoDimVert0
  4657. ],
  4658. [
  4659. 1,
  4660. twoDimVert0
  4661. ],
  4662. [
  4663. 1,
  4664. twoDimVert0
  4665. ],
  4666. [
  4667. 1,
  4668. twoDimVert0
  4669. ],
  4670. [
  4671. 1,
  4672. twoDimVert0
  4673. ],
  4674. [
  4675. 1,
  4676. twoDimVert0
  4677. ],
  4678. [
  4679. 1,
  4680. twoDimVert0
  4681. ],
  4682. [
  4683. 1,
  4684. twoDimVert0
  4685. ],
  4686. [
  4687. 1,
  4688. twoDimVert0
  4689. ],
  4690. [
  4691. 1,
  4692. twoDimVert0
  4693. ],
  4694. [
  4695. 1,
  4696. twoDimVert0
  4697. ],
  4698. [
  4699. 1,
  4700. twoDimVert0
  4701. ],
  4702. [
  4703. 1,
  4704. twoDimVert0
  4705. ],
  4706. [
  4707. 1,
  4708. twoDimVert0
  4709. ],
  4710. [
  4711. 1,
  4712. twoDimVert0
  4713. ],
  4714. [
  4715. 1,
  4716. twoDimVert0
  4717. ],
  4718. [
  4719. 1,
  4720. twoDimVert0
  4721. ],
  4722. [
  4723. 1,
  4724. twoDimVert0
  4725. ]
  4726. ];
  4727. var whiteTable1 = [
  4728. [
  4729. -1,
  4730. -1
  4731. ],
  4732. [
  4733. 12,
  4734. ccittEOL
  4735. ],
  4736. [
  4737. -1,
  4738. -1
  4739. ],
  4740. [
  4741. -1,
  4742. -1
  4743. ],
  4744. [
  4745. -1,
  4746. -1
  4747. ],
  4748. [
  4749. -1,
  4750. -1
  4751. ],
  4752. [
  4753. -1,
  4754. -1
  4755. ],
  4756. [
  4757. -1,
  4758. -1
  4759. ],
  4760. [
  4761. -1,
  4762. -1
  4763. ],
  4764. [
  4765. -1,
  4766. -1
  4767. ],
  4768. [
  4769. -1,
  4770. -1
  4771. ],
  4772. [
  4773. -1,
  4774. -1
  4775. ],
  4776. [
  4777. -1,
  4778. -1
  4779. ],
  4780. [
  4781. -1,
  4782. -1
  4783. ],
  4784. [
  4785. -1,
  4786. -1
  4787. ],
  4788. [
  4789. -1,
  4790. -1
  4791. ],
  4792. [
  4793. 11,
  4794. 1792
  4795. ],
  4796. [
  4797. 11,
  4798. 1792
  4799. ],
  4800. [
  4801. 12,
  4802. 1984
  4803. ],
  4804. [
  4805. 12,
  4806. 2048
  4807. ],
  4808. [
  4809. 12,
  4810. 2112
  4811. ],
  4812. [
  4813. 12,
  4814. 2176
  4815. ],
  4816. [
  4817. 12,
  4818. 2240
  4819. ],
  4820. [
  4821. 12,
  4822. 2304
  4823. ],
  4824. [
  4825. 11,
  4826. 1856
  4827. ],
  4828. [
  4829. 11,
  4830. 1856
  4831. ],
  4832. [
  4833. 11,
  4834. 1920
  4835. ],
  4836. [
  4837. 11,
  4838. 1920
  4839. ],
  4840. [
  4841. 12,
  4842. 2368
  4843. ],
  4844. [
  4845. 12,
  4846. 2432
  4847. ],
  4848. [
  4849. 12,
  4850. 2496
  4851. ],
  4852. [
  4853. 12,
  4854. 2560
  4855. ]
  4856. ];
  4857. var whiteTable2 = [
  4858. [
  4859. -1,
  4860. -1
  4861. ],
  4862. [
  4863. -1,
  4864. -1
  4865. ],
  4866. [
  4867. -1,
  4868. -1
  4869. ],
  4870. [
  4871. -1,
  4872. -1
  4873. ],
  4874. [
  4875. 8,
  4876. 29
  4877. ],
  4878. [
  4879. 8,
  4880. 29
  4881. ],
  4882. [
  4883. 8,
  4884. 30
  4885. ],
  4886. [
  4887. 8,
  4888. 30
  4889. ],
  4890. [
  4891. 8,
  4892. 45
  4893. ],
  4894. [
  4895. 8,
  4896. 45
  4897. ],
  4898. [
  4899. 8,
  4900. 46
  4901. ],
  4902. [
  4903. 8,
  4904. 46
  4905. ],
  4906. [
  4907. 7,
  4908. 22
  4909. ],
  4910. [
  4911. 7,
  4912. 22
  4913. ],
  4914. [
  4915. 7,
  4916. 22
  4917. ],
  4918. [
  4919. 7,
  4920. 22
  4921. ],
  4922. [
  4923. 7,
  4924. 23
  4925. ],
  4926. [
  4927. 7,
  4928. 23
  4929. ],
  4930. [
  4931. 7,
  4932. 23
  4933. ],
  4934. [
  4935. 7,
  4936. 23
  4937. ],
  4938. [
  4939. 8,
  4940. 47
  4941. ],
  4942. [
  4943. 8,
  4944. 47
  4945. ],
  4946. [
  4947. 8,
  4948. 48
  4949. ],
  4950. [
  4951. 8,
  4952. 48
  4953. ],
  4954. [
  4955. 6,
  4956. 13
  4957. ],
  4958. [
  4959. 6,
  4960. 13
  4961. ],
  4962. [
  4963. 6,
  4964. 13
  4965. ],
  4966. [
  4967. 6,
  4968. 13
  4969. ],
  4970. [
  4971. 6,
  4972. 13
  4973. ],
  4974. [
  4975. 6,
  4976. 13
  4977. ],
  4978. [
  4979. 6,
  4980. 13
  4981. ],
  4982. [
  4983. 6,
  4984. 13
  4985. ],
  4986. [
  4987. 7,
  4988. 20
  4989. ],
  4990. [
  4991. 7,
  4992. 20
  4993. ],
  4994. [
  4995. 7,
  4996. 20
  4997. ],
  4998. [
  4999. 7,
  5000. 20
  5001. ],
  5002. [
  5003. 8,
  5004. 33
  5005. ],
  5006. [
  5007. 8,
  5008. 33
  5009. ],
  5010. [
  5011. 8,
  5012. 34
  5013. ],
  5014. [
  5015. 8,
  5016. 34
  5017. ],
  5018. [
  5019. 8,
  5020. 35
  5021. ],
  5022. [
  5023. 8,
  5024. 35
  5025. ],
  5026. [
  5027. 8,
  5028. 36
  5029. ],
  5030. [
  5031. 8,
  5032. 36
  5033. ],
  5034. [
  5035. 8,
  5036. 37
  5037. ],
  5038. [
  5039. 8,
  5040. 37
  5041. ],
  5042. [
  5043. 8,
  5044. 38
  5045. ],
  5046. [
  5047. 8,
  5048. 38
  5049. ],
  5050. [
  5051. 7,
  5052. 19
  5053. ],
  5054. [
  5055. 7,
  5056. 19
  5057. ],
  5058. [
  5059. 7,
  5060. 19
  5061. ],
  5062. [
  5063. 7,
  5064. 19
  5065. ],
  5066. [
  5067. 8,
  5068. 31
  5069. ],
  5070. [
  5071. 8,
  5072. 31
  5073. ],
  5074. [
  5075. 8,
  5076. 32
  5077. ],
  5078. [
  5079. 8,
  5080. 32
  5081. ],
  5082. [
  5083. 6,
  5084. 1
  5085. ],
  5086. [
  5087. 6,
  5088. 1
  5089. ],
  5090. [
  5091. 6,
  5092. 1
  5093. ],
  5094. [
  5095. 6,
  5096. 1
  5097. ],
  5098. [
  5099. 6,
  5100. 1
  5101. ],
  5102. [
  5103. 6,
  5104. 1
  5105. ],
  5106. [
  5107. 6,
  5108. 1
  5109. ],
  5110. [
  5111. 6,
  5112. 1
  5113. ],
  5114. [
  5115. 6,
  5116. 12
  5117. ],
  5118. [
  5119. 6,
  5120. 12
  5121. ],
  5122. [
  5123. 6,
  5124. 12
  5125. ],
  5126. [
  5127. 6,
  5128. 12
  5129. ],
  5130. [
  5131. 6,
  5132. 12
  5133. ],
  5134. [
  5135. 6,
  5136. 12
  5137. ],
  5138. [
  5139. 6,
  5140. 12
  5141. ],
  5142. [
  5143. 6,
  5144. 12
  5145. ],
  5146. [
  5147. 8,
  5148. 53
  5149. ],
  5150. [
  5151. 8,
  5152. 53
  5153. ],
  5154. [
  5155. 8,
  5156. 54
  5157. ],
  5158. [
  5159. 8,
  5160. 54
  5161. ],
  5162. [
  5163. 7,
  5164. 26
  5165. ],
  5166. [
  5167. 7,
  5168. 26
  5169. ],
  5170. [
  5171. 7,
  5172. 26
  5173. ],
  5174. [
  5175. 7,
  5176. 26
  5177. ],
  5178. [
  5179. 8,
  5180. 39
  5181. ],
  5182. [
  5183. 8,
  5184. 39
  5185. ],
  5186. [
  5187. 8,
  5188. 40
  5189. ],
  5190. [
  5191. 8,
  5192. 40
  5193. ],
  5194. [
  5195. 8,
  5196. 41
  5197. ],
  5198. [
  5199. 8,
  5200. 41
  5201. ],
  5202. [
  5203. 8,
  5204. 42
  5205. ],
  5206. [
  5207. 8,
  5208. 42
  5209. ],
  5210. [
  5211. 8,
  5212. 43
  5213. ],
  5214. [
  5215. 8,
  5216. 43
  5217. ],
  5218. [
  5219. 8,
  5220. 44
  5221. ],
  5222. [
  5223. 8,
  5224. 44
  5225. ],
  5226. [
  5227. 7,
  5228. 21
  5229. ],
  5230. [
  5231. 7,
  5232. 21
  5233. ],
  5234. [
  5235. 7,
  5236. 21
  5237. ],
  5238. [
  5239. 7,
  5240. 21
  5241. ],
  5242. [
  5243. 7,
  5244. 28
  5245. ],
  5246. [
  5247. 7,
  5248. 28
  5249. ],
  5250. [
  5251. 7,
  5252. 28
  5253. ],
  5254. [
  5255. 7,
  5256. 28
  5257. ],
  5258. [
  5259. 8,
  5260. 61
  5261. ],
  5262. [
  5263. 8,
  5264. 61
  5265. ],
  5266. [
  5267. 8,
  5268. 62
  5269. ],
  5270. [
  5271. 8,
  5272. 62
  5273. ],
  5274. [
  5275. 8,
  5276. 63
  5277. ],
  5278. [
  5279. 8,
  5280. 63
  5281. ],
  5282. [
  5283. 8,
  5284. 0
  5285. ],
  5286. [
  5287. 8,
  5288. 0
  5289. ],
  5290. [
  5291. 8,
  5292. 320
  5293. ],
  5294. [
  5295. 8,
  5296. 320
  5297. ],
  5298. [
  5299. 8,
  5300. 384
  5301. ],
  5302. [
  5303. 8,
  5304. 384
  5305. ],
  5306. [
  5307. 5,
  5308. 10
  5309. ],
  5310. [
  5311. 5,
  5312. 10
  5313. ],
  5314. [
  5315. 5,
  5316. 10
  5317. ],
  5318. [
  5319. 5,
  5320. 10
  5321. ],
  5322. [
  5323. 5,
  5324. 10
  5325. ],
  5326. [
  5327. 5,
  5328. 10
  5329. ],
  5330. [
  5331. 5,
  5332. 10
  5333. ],
  5334. [
  5335. 5,
  5336. 10
  5337. ],
  5338. [
  5339. 5,
  5340. 10
  5341. ],
  5342. [
  5343. 5,
  5344. 10
  5345. ],
  5346. [
  5347. 5,
  5348. 10
  5349. ],
  5350. [
  5351. 5,
  5352. 10
  5353. ],
  5354. [
  5355. 5,
  5356. 10
  5357. ],
  5358. [
  5359. 5,
  5360. 10
  5361. ],
  5362. [
  5363. 5,
  5364. 10
  5365. ],
  5366. [
  5367. 5,
  5368. 10
  5369. ],
  5370. [
  5371. 5,
  5372. 11
  5373. ],
  5374. [
  5375. 5,
  5376. 11
  5377. ],
  5378. [
  5379. 5,
  5380. 11
  5381. ],
  5382. [
  5383. 5,
  5384. 11
  5385. ],
  5386. [
  5387. 5,
  5388. 11
  5389. ],
  5390. [
  5391. 5,
  5392. 11
  5393. ],
  5394. [
  5395. 5,
  5396. 11
  5397. ],
  5398. [
  5399. 5,
  5400. 11
  5401. ],
  5402. [
  5403. 5,
  5404. 11
  5405. ],
  5406. [
  5407. 5,
  5408. 11
  5409. ],
  5410. [
  5411. 5,
  5412. 11
  5413. ],
  5414. [
  5415. 5,
  5416. 11
  5417. ],
  5418. [
  5419. 5,
  5420. 11
  5421. ],
  5422. [
  5423. 5,
  5424. 11
  5425. ],
  5426. [
  5427. 5,
  5428. 11
  5429. ],
  5430. [
  5431. 5,
  5432. 11
  5433. ],
  5434. [
  5435. 7,
  5436. 27
  5437. ],
  5438. [
  5439. 7,
  5440. 27
  5441. ],
  5442. [
  5443. 7,
  5444. 27
  5445. ],
  5446. [
  5447. 7,
  5448. 27
  5449. ],
  5450. [
  5451. 8,
  5452. 59
  5453. ],
  5454. [
  5455. 8,
  5456. 59
  5457. ],
  5458. [
  5459. 8,
  5460. 60
  5461. ],
  5462. [
  5463. 8,
  5464. 60
  5465. ],
  5466. [
  5467. 9,
  5468. 1472
  5469. ],
  5470. [
  5471. 9,
  5472. 1536
  5473. ],
  5474. [
  5475. 9,
  5476. 1600
  5477. ],
  5478. [
  5479. 9,
  5480. 1728
  5481. ],
  5482. [
  5483. 7,
  5484. 18
  5485. ],
  5486. [
  5487. 7,
  5488. 18
  5489. ],
  5490. [
  5491. 7,
  5492. 18
  5493. ],
  5494. [
  5495. 7,
  5496. 18
  5497. ],
  5498. [
  5499. 7,
  5500. 24
  5501. ],
  5502. [
  5503. 7,
  5504. 24
  5505. ],
  5506. [
  5507. 7,
  5508. 24
  5509. ],
  5510. [
  5511. 7,
  5512. 24
  5513. ],
  5514. [
  5515. 8,
  5516. 49
  5517. ],
  5518. [
  5519. 8,
  5520. 49
  5521. ],
  5522. [
  5523. 8,
  5524. 50
  5525. ],
  5526. [
  5527. 8,
  5528. 50
  5529. ],
  5530. [
  5531. 8,
  5532. 51
  5533. ],
  5534. [
  5535. 8,
  5536. 51
  5537. ],
  5538. [
  5539. 8,
  5540. 52
  5541. ],
  5542. [
  5543. 8,
  5544. 52
  5545. ],
  5546. [
  5547. 7,
  5548. 25
  5549. ],
  5550. [
  5551. 7,
  5552. 25
  5553. ],
  5554. [
  5555. 7,
  5556. 25
  5557. ],
  5558. [
  5559. 7,
  5560. 25
  5561. ],
  5562. [
  5563. 8,
  5564. 55
  5565. ],
  5566. [
  5567. 8,
  5568. 55
  5569. ],
  5570. [
  5571. 8,
  5572. 56
  5573. ],
  5574. [
  5575. 8,
  5576. 56
  5577. ],
  5578. [
  5579. 8,
  5580. 57
  5581. ],
  5582. [
  5583. 8,
  5584. 57
  5585. ],
  5586. [
  5587. 8,
  5588. 58
  5589. ],
  5590. [
  5591. 8,
  5592. 58
  5593. ],
  5594. [
  5595. 6,
  5596. 192
  5597. ],
  5598. [
  5599. 6,
  5600. 192
  5601. ],
  5602. [
  5603. 6,
  5604. 192
  5605. ],
  5606. [
  5607. 6,
  5608. 192
  5609. ],
  5610. [
  5611. 6,
  5612. 192
  5613. ],
  5614. [
  5615. 6,
  5616. 192
  5617. ],
  5618. [
  5619. 6,
  5620. 192
  5621. ],
  5622. [
  5623. 6,
  5624. 192
  5625. ],
  5626. [
  5627. 6,
  5628. 1664
  5629. ],
  5630. [
  5631. 6,
  5632. 1664
  5633. ],
  5634. [
  5635. 6,
  5636. 1664
  5637. ],
  5638. [
  5639. 6,
  5640. 1664
  5641. ],
  5642. [
  5643. 6,
  5644. 1664
  5645. ],
  5646. [
  5647. 6,
  5648. 1664
  5649. ],
  5650. [
  5651. 6,
  5652. 1664
  5653. ],
  5654. [
  5655. 6,
  5656. 1664
  5657. ],
  5658. [
  5659. 8,
  5660. 448
  5661. ],
  5662. [
  5663. 8,
  5664. 448
  5665. ],
  5666. [
  5667. 8,
  5668. 512
  5669. ],
  5670. [
  5671. 8,
  5672. 512
  5673. ],
  5674. [
  5675. 9,
  5676. 704
  5677. ],
  5678. [
  5679. 9,
  5680. 768
  5681. ],
  5682. [
  5683. 8,
  5684. 640
  5685. ],
  5686. [
  5687. 8,
  5688. 640
  5689. ],
  5690. [
  5691. 8,
  5692. 576
  5693. ],
  5694. [
  5695. 8,
  5696. 576
  5697. ],
  5698. [
  5699. 9,
  5700. 832
  5701. ],
  5702. [
  5703. 9,
  5704. 896
  5705. ],
  5706. [
  5707. 9,
  5708. 960
  5709. ],
  5710. [
  5711. 9,
  5712. 1024
  5713. ],
  5714. [
  5715. 9,
  5716. 1088
  5717. ],
  5718. [
  5719. 9,
  5720. 1152
  5721. ],
  5722. [
  5723. 9,
  5724. 1216
  5725. ],
  5726. [
  5727. 9,
  5728. 1280
  5729. ],
  5730. [
  5731. 9,
  5732. 1344
  5733. ],
  5734. [
  5735. 9,
  5736. 1408
  5737. ],
  5738. [
  5739. 7,
  5740. 256
  5741. ],
  5742. [
  5743. 7,
  5744. 256
  5745. ],
  5746. [
  5747. 7,
  5748. 256
  5749. ],
  5750. [
  5751. 7,
  5752. 256
  5753. ],
  5754. [
  5755. 4,
  5756. 2
  5757. ],
  5758. [
  5759. 4,
  5760. 2
  5761. ],
  5762. [
  5763. 4,
  5764. 2
  5765. ],
  5766. [
  5767. 4,
  5768. 2
  5769. ],
  5770. [
  5771. 4,
  5772. 2
  5773. ],
  5774. [
  5775. 4,
  5776. 2
  5777. ],
  5778. [
  5779. 4,
  5780. 2
  5781. ],
  5782. [
  5783. 4,
  5784. 2
  5785. ],
  5786. [
  5787. 4,
  5788. 2
  5789. ],
  5790. [
  5791. 4,
  5792. 2
  5793. ],
  5794. [
  5795. 4,
  5796. 2
  5797. ],
  5798. [
  5799. 4,
  5800. 2
  5801. ],
  5802. [
  5803. 4,
  5804. 2
  5805. ],
  5806. [
  5807. 4,
  5808. 2
  5809. ],
  5810. [
  5811. 4,
  5812. 2
  5813. ],
  5814. [
  5815. 4,
  5816. 2
  5817. ],
  5818. [
  5819. 4,
  5820. 2
  5821. ],
  5822. [
  5823. 4,
  5824. 2
  5825. ],
  5826. [
  5827. 4,
  5828. 2
  5829. ],
  5830. [
  5831. 4,
  5832. 2
  5833. ],
  5834. [
  5835. 4,
  5836. 2
  5837. ],
  5838. [
  5839. 4,
  5840. 2
  5841. ],
  5842. [
  5843. 4,
  5844. 2
  5845. ],
  5846. [
  5847. 4,
  5848. 2
  5849. ],
  5850. [
  5851. 4,
  5852. 2
  5853. ],
  5854. [
  5855. 4,
  5856. 2
  5857. ],
  5858. [
  5859. 4,
  5860. 2
  5861. ],
  5862. [
  5863. 4,
  5864. 2
  5865. ],
  5866. [
  5867. 4,
  5868. 2
  5869. ],
  5870. [
  5871. 4,
  5872. 2
  5873. ],
  5874. [
  5875. 4,
  5876. 2
  5877. ],
  5878. [
  5879. 4,
  5880. 2
  5881. ],
  5882. [
  5883. 4,
  5884. 3
  5885. ],
  5886. [
  5887. 4,
  5888. 3
  5889. ],
  5890. [
  5891. 4,
  5892. 3
  5893. ],
  5894. [
  5895. 4,
  5896. 3
  5897. ],
  5898. [
  5899. 4,
  5900. 3
  5901. ],
  5902. [
  5903. 4,
  5904. 3
  5905. ],
  5906. [
  5907. 4,
  5908. 3
  5909. ],
  5910. [
  5911. 4,
  5912. 3
  5913. ],
  5914. [
  5915. 4,
  5916. 3
  5917. ],
  5918. [
  5919. 4,
  5920. 3
  5921. ],
  5922. [
  5923. 4,
  5924. 3
  5925. ],
  5926. [
  5927. 4,
  5928. 3
  5929. ],
  5930. [
  5931. 4,
  5932. 3
  5933. ],
  5934. [
  5935. 4,
  5936. 3
  5937. ],
  5938. [
  5939. 4,
  5940. 3
  5941. ],
  5942. [
  5943. 4,
  5944. 3
  5945. ],
  5946. [
  5947. 4,
  5948. 3
  5949. ],
  5950. [
  5951. 4,
  5952. 3
  5953. ],
  5954. [
  5955. 4,
  5956. 3
  5957. ],
  5958. [
  5959. 4,
  5960. 3
  5961. ],
  5962. [
  5963. 4,
  5964. 3
  5965. ],
  5966. [
  5967. 4,
  5968. 3
  5969. ],
  5970. [
  5971. 4,
  5972. 3
  5973. ],
  5974. [
  5975. 4,
  5976. 3
  5977. ],
  5978. [
  5979. 4,
  5980. 3
  5981. ],
  5982. [
  5983. 4,
  5984. 3
  5985. ],
  5986. [
  5987. 4,
  5988. 3
  5989. ],
  5990. [
  5991. 4,
  5992. 3
  5993. ],
  5994. [
  5995. 4,
  5996. 3
  5997. ],
  5998. [
  5999. 4,
  6000. 3
  6001. ],
  6002. [
  6003. 4,
  6004. 3
  6005. ],
  6006. [
  6007. 4,
  6008. 3
  6009. ],
  6010. [
  6011. 5,
  6012. 128
  6013. ],
  6014. [
  6015. 5,
  6016. 128
  6017. ],
  6018. [
  6019. 5,
  6020. 128
  6021. ],
  6022. [
  6023. 5,
  6024. 128
  6025. ],
  6026. [
  6027. 5,
  6028. 128
  6029. ],
  6030. [
  6031. 5,
  6032. 128
  6033. ],
  6034. [
  6035. 5,
  6036. 128
  6037. ],
  6038. [
  6039. 5,
  6040. 128
  6041. ],
  6042. [
  6043. 5,
  6044. 128
  6045. ],
  6046. [
  6047. 5,
  6048. 128
  6049. ],
  6050. [
  6051. 5,
  6052. 128
  6053. ],
  6054. [
  6055. 5,
  6056. 128
  6057. ],
  6058. [
  6059. 5,
  6060. 128
  6061. ],
  6062. [
  6063. 5,
  6064. 128
  6065. ],
  6066. [
  6067. 5,
  6068. 128
  6069. ],
  6070. [
  6071. 5,
  6072. 128
  6073. ],
  6074. [
  6075. 5,
  6076. 8
  6077. ],
  6078. [
  6079. 5,
  6080. 8
  6081. ],
  6082. [
  6083. 5,
  6084. 8
  6085. ],
  6086. [
  6087. 5,
  6088. 8
  6089. ],
  6090. [
  6091. 5,
  6092. 8
  6093. ],
  6094. [
  6095. 5,
  6096. 8
  6097. ],
  6098. [
  6099. 5,
  6100. 8
  6101. ],
  6102. [
  6103. 5,
  6104. 8
  6105. ],
  6106. [
  6107. 5,
  6108. 8
  6109. ],
  6110. [
  6111. 5,
  6112. 8
  6113. ],
  6114. [
  6115. 5,
  6116. 8
  6117. ],
  6118. [
  6119. 5,
  6120. 8
  6121. ],
  6122. [
  6123. 5,
  6124. 8
  6125. ],
  6126. [
  6127. 5,
  6128. 8
  6129. ],
  6130. [
  6131. 5,
  6132. 8
  6133. ],
  6134. [
  6135. 5,
  6136. 8
  6137. ],
  6138. [
  6139. 5,
  6140. 9
  6141. ],
  6142. [
  6143. 5,
  6144. 9
  6145. ],
  6146. [
  6147. 5,
  6148. 9
  6149. ],
  6150. [
  6151. 5,
  6152. 9
  6153. ],
  6154. [
  6155. 5,
  6156. 9
  6157. ],
  6158. [
  6159. 5,
  6160. 9
  6161. ],
  6162. [
  6163. 5,
  6164. 9
  6165. ],
  6166. [
  6167. 5,
  6168. 9
  6169. ],
  6170. [
  6171. 5,
  6172. 9
  6173. ],
  6174. [
  6175. 5,
  6176. 9
  6177. ],
  6178. [
  6179. 5,
  6180. 9
  6181. ],
  6182. [
  6183. 5,
  6184. 9
  6185. ],
  6186. [
  6187. 5,
  6188. 9
  6189. ],
  6190. [
  6191. 5,
  6192. 9
  6193. ],
  6194. [
  6195. 5,
  6196. 9
  6197. ],
  6198. [
  6199. 5,
  6200. 9
  6201. ],
  6202. [
  6203. 6,
  6204. 16
  6205. ],
  6206. [
  6207. 6,
  6208. 16
  6209. ],
  6210. [
  6211. 6,
  6212. 16
  6213. ],
  6214. [
  6215. 6,
  6216. 16
  6217. ],
  6218. [
  6219. 6,
  6220. 16
  6221. ],
  6222. [
  6223. 6,
  6224. 16
  6225. ],
  6226. [
  6227. 6,
  6228. 16
  6229. ],
  6230. [
  6231. 6,
  6232. 16
  6233. ],
  6234. [
  6235. 6,
  6236. 17
  6237. ],
  6238. [
  6239. 6,
  6240. 17
  6241. ],
  6242. [
  6243. 6,
  6244. 17
  6245. ],
  6246. [
  6247. 6,
  6248. 17
  6249. ],
  6250. [
  6251. 6,
  6252. 17
  6253. ],
  6254. [
  6255. 6,
  6256. 17
  6257. ],
  6258. [
  6259. 6,
  6260. 17
  6261. ],
  6262. [
  6263. 6,
  6264. 17
  6265. ],
  6266. [
  6267. 4,
  6268. 4
  6269. ],
  6270. [
  6271. 4,
  6272. 4
  6273. ],
  6274. [
  6275. 4,
  6276. 4
  6277. ],
  6278. [
  6279. 4,
  6280. 4
  6281. ],
  6282. [
  6283. 4,
  6284. 4
  6285. ],
  6286. [
  6287. 4,
  6288. 4
  6289. ],
  6290. [
  6291. 4,
  6292. 4
  6293. ],
  6294. [
  6295. 4,
  6296. 4
  6297. ],
  6298. [
  6299. 4,
  6300. 4
  6301. ],
  6302. [
  6303. 4,
  6304. 4
  6305. ],
  6306. [
  6307. 4,
  6308. 4
  6309. ],
  6310. [
  6311. 4,
  6312. 4
  6313. ],
  6314. [
  6315. 4,
  6316. 4
  6317. ],
  6318. [
  6319. 4,
  6320. 4
  6321. ],
  6322. [
  6323. 4,
  6324. 4
  6325. ],
  6326. [
  6327. 4,
  6328. 4
  6329. ],
  6330. [
  6331. 4,
  6332. 4
  6333. ],
  6334. [
  6335. 4,
  6336. 4
  6337. ],
  6338. [
  6339. 4,
  6340. 4
  6341. ],
  6342. [
  6343. 4,
  6344. 4
  6345. ],
  6346. [
  6347. 4,
  6348. 4
  6349. ],
  6350. [
  6351. 4,
  6352. 4
  6353. ],
  6354. [
  6355. 4,
  6356. 4
  6357. ],
  6358. [
  6359. 4,
  6360. 4
  6361. ],
  6362. [
  6363. 4,
  6364. 4
  6365. ],
  6366. [
  6367. 4,
  6368. 4
  6369. ],
  6370. [
  6371. 4,
  6372. 4
  6373. ],
  6374. [
  6375. 4,
  6376. 4
  6377. ],
  6378. [
  6379. 4,
  6380. 4
  6381. ],
  6382. [
  6383. 4,
  6384. 4
  6385. ],
  6386. [
  6387. 4,
  6388. 4
  6389. ],
  6390. [
  6391. 4,
  6392. 4
  6393. ],
  6394. [
  6395. 4,
  6396. 5
  6397. ],
  6398. [
  6399. 4,
  6400. 5
  6401. ],
  6402. [
  6403. 4,
  6404. 5
  6405. ],
  6406. [
  6407. 4,
  6408. 5
  6409. ],
  6410. [
  6411. 4,
  6412. 5
  6413. ],
  6414. [
  6415. 4,
  6416. 5
  6417. ],
  6418. [
  6419. 4,
  6420. 5
  6421. ],
  6422. [
  6423. 4,
  6424. 5
  6425. ],
  6426. [
  6427. 4,
  6428. 5
  6429. ],
  6430. [
  6431. 4,
  6432. 5
  6433. ],
  6434. [
  6435. 4,
  6436. 5
  6437. ],
  6438. [
  6439. 4,
  6440. 5
  6441. ],
  6442. [
  6443. 4,
  6444. 5
  6445. ],
  6446. [
  6447. 4,
  6448. 5
  6449. ],
  6450. [
  6451. 4,
  6452. 5
  6453. ],
  6454. [
  6455. 4,
  6456. 5
  6457. ],
  6458. [
  6459. 4,
  6460. 5
  6461. ],
  6462. [
  6463. 4,
  6464. 5
  6465. ],
  6466. [
  6467. 4,
  6468. 5
  6469. ],
  6470. [
  6471. 4,
  6472. 5
  6473. ],
  6474. [
  6475. 4,
  6476. 5
  6477. ],
  6478. [
  6479. 4,
  6480. 5
  6481. ],
  6482. [
  6483. 4,
  6484. 5
  6485. ],
  6486. [
  6487. 4,
  6488. 5
  6489. ],
  6490. [
  6491. 4,
  6492. 5
  6493. ],
  6494. [
  6495. 4,
  6496. 5
  6497. ],
  6498. [
  6499. 4,
  6500. 5
  6501. ],
  6502. [
  6503. 4,
  6504. 5
  6505. ],
  6506. [
  6507. 4,
  6508. 5
  6509. ],
  6510. [
  6511. 4,
  6512. 5
  6513. ],
  6514. [
  6515. 4,
  6516. 5
  6517. ],
  6518. [
  6519. 4,
  6520. 5
  6521. ],
  6522. [
  6523. 6,
  6524. 14
  6525. ],
  6526. [
  6527. 6,
  6528. 14
  6529. ],
  6530. [
  6531. 6,
  6532. 14
  6533. ],
  6534. [
  6535. 6,
  6536. 14
  6537. ],
  6538. [
  6539. 6,
  6540. 14
  6541. ],
  6542. [
  6543. 6,
  6544. 14
  6545. ],
  6546. [
  6547. 6,
  6548. 14
  6549. ],
  6550. [
  6551. 6,
  6552. 14
  6553. ],
  6554. [
  6555. 6,
  6556. 15
  6557. ],
  6558. [
  6559. 6,
  6560. 15
  6561. ],
  6562. [
  6563. 6,
  6564. 15
  6565. ],
  6566. [
  6567. 6,
  6568. 15
  6569. ],
  6570. [
  6571. 6,
  6572. 15
  6573. ],
  6574. [
  6575. 6,
  6576. 15
  6577. ],
  6578. [
  6579. 6,
  6580. 15
  6581. ],
  6582. [
  6583. 6,
  6584. 15
  6585. ],
  6586. [
  6587. 5,
  6588. 64
  6589. ],
  6590. [
  6591. 5,
  6592. 64
  6593. ],
  6594. [
  6595. 5,
  6596. 64
  6597. ],
  6598. [
  6599. 5,
  6600. 64
  6601. ],
  6602. [
  6603. 5,
  6604. 64
  6605. ],
  6606. [
  6607. 5,
  6608. 64
  6609. ],
  6610. [
  6611. 5,
  6612. 64
  6613. ],
  6614. [
  6615. 5,
  6616. 64
  6617. ],
  6618. [
  6619. 5,
  6620. 64
  6621. ],
  6622. [
  6623. 5,
  6624. 64
  6625. ],
  6626. [
  6627. 5,
  6628. 64
  6629. ],
  6630. [
  6631. 5,
  6632. 64
  6633. ],
  6634. [
  6635. 5,
  6636. 64
  6637. ],
  6638. [
  6639. 5,
  6640. 64
  6641. ],
  6642. [
  6643. 5,
  6644. 64
  6645. ],
  6646. [
  6647. 5,
  6648. 64
  6649. ],
  6650. [
  6651. 4,
  6652. 6
  6653. ],
  6654. [
  6655. 4,
  6656. 6
  6657. ],
  6658. [
  6659. 4,
  6660. 6
  6661. ],
  6662. [
  6663. 4,
  6664. 6
  6665. ],
  6666. [
  6667. 4,
  6668. 6
  6669. ],
  6670. [
  6671. 4,
  6672. 6
  6673. ],
  6674. [
  6675. 4,
  6676. 6
  6677. ],
  6678. [
  6679. 4,
  6680. 6
  6681. ],
  6682. [
  6683. 4,
  6684. 6
  6685. ],
  6686. [
  6687. 4,
  6688. 6
  6689. ],
  6690. [
  6691. 4,
  6692. 6
  6693. ],
  6694. [
  6695. 4,
  6696. 6
  6697. ],
  6698. [
  6699. 4,
  6700. 6
  6701. ],
  6702. [
  6703. 4,
  6704. 6
  6705. ],
  6706. [
  6707. 4,
  6708. 6
  6709. ],
  6710. [
  6711. 4,
  6712. 6
  6713. ],
  6714. [
  6715. 4,
  6716. 6
  6717. ],
  6718. [
  6719. 4,
  6720. 6
  6721. ],
  6722. [
  6723. 4,
  6724. 6
  6725. ],
  6726. [
  6727. 4,
  6728. 6
  6729. ],
  6730. [
  6731. 4,
  6732. 6
  6733. ],
  6734. [
  6735. 4,
  6736. 6
  6737. ],
  6738. [
  6739. 4,
  6740. 6
  6741. ],
  6742. [
  6743. 4,
  6744. 6
  6745. ],
  6746. [
  6747. 4,
  6748. 6
  6749. ],
  6750. [
  6751. 4,
  6752. 6
  6753. ],
  6754. [
  6755. 4,
  6756. 6
  6757. ],
  6758. [
  6759. 4,
  6760. 6
  6761. ],
  6762. [
  6763. 4,
  6764. 6
  6765. ],
  6766. [
  6767. 4,
  6768. 6
  6769. ],
  6770. [
  6771. 4,
  6772. 6
  6773. ],
  6774. [
  6775. 4,
  6776. 6
  6777. ],
  6778. [
  6779. 4,
  6780. 7
  6781. ],
  6782. [
  6783. 4,
  6784. 7
  6785. ],
  6786. [
  6787. 4,
  6788. 7
  6789. ],
  6790. [
  6791. 4,
  6792. 7
  6793. ],
  6794. [
  6795. 4,
  6796. 7
  6797. ],
  6798. [
  6799. 4,
  6800. 7
  6801. ],
  6802. [
  6803. 4,
  6804. 7
  6805. ],
  6806. [
  6807. 4,
  6808. 7
  6809. ],
  6810. [
  6811. 4,
  6812. 7
  6813. ],
  6814. [
  6815. 4,
  6816. 7
  6817. ],
  6818. [
  6819. 4,
  6820. 7
  6821. ],
  6822. [
  6823. 4,
  6824. 7
  6825. ],
  6826. [
  6827. 4,
  6828. 7
  6829. ],
  6830. [
  6831. 4,
  6832. 7
  6833. ],
  6834. [
  6835. 4,
  6836. 7
  6837. ],
  6838. [
  6839. 4,
  6840. 7
  6841. ],
  6842. [
  6843. 4,
  6844. 7
  6845. ],
  6846. [
  6847. 4,
  6848. 7
  6849. ],
  6850. [
  6851. 4,
  6852. 7
  6853. ],
  6854. [
  6855. 4,
  6856. 7
  6857. ],
  6858. [
  6859. 4,
  6860. 7
  6861. ],
  6862. [
  6863. 4,
  6864. 7
  6865. ],
  6866. [
  6867. 4,
  6868. 7
  6869. ],
  6870. [
  6871. 4,
  6872. 7
  6873. ],
  6874. [
  6875. 4,
  6876. 7
  6877. ],
  6878. [
  6879. 4,
  6880. 7
  6881. ],
  6882. [
  6883. 4,
  6884. 7
  6885. ],
  6886. [
  6887. 4,
  6888. 7
  6889. ],
  6890. [
  6891. 4,
  6892. 7
  6893. ],
  6894. [
  6895. 4,
  6896. 7
  6897. ],
  6898. [
  6899. 4,
  6900. 7
  6901. ],
  6902. [
  6903. 4,
  6904. 7
  6905. ]
  6906. ];
  6907. var blackTable1 = [
  6908. [
  6909. -1,
  6910. -1
  6911. ],
  6912. [
  6913. -1,
  6914. -1
  6915. ],
  6916. [
  6917. 12,
  6918. ccittEOL
  6919. ],
  6920. [
  6921. 12,
  6922. ccittEOL
  6923. ],
  6924. [
  6925. -1,
  6926. -1
  6927. ],
  6928. [
  6929. -1,
  6930. -1
  6931. ],
  6932. [
  6933. -1,
  6934. -1
  6935. ],
  6936. [
  6937. -1,
  6938. -1
  6939. ],
  6940. [
  6941. -1,
  6942. -1
  6943. ],
  6944. [
  6945. -1,
  6946. -1
  6947. ],
  6948. [
  6949. -1,
  6950. -1
  6951. ],
  6952. [
  6953. -1,
  6954. -1
  6955. ],
  6956. [
  6957. -1,
  6958. -1
  6959. ],
  6960. [
  6961. -1,
  6962. -1
  6963. ],
  6964. [
  6965. -1,
  6966. -1
  6967. ],
  6968. [
  6969. -1,
  6970. -1
  6971. ],
  6972. [
  6973. -1,
  6974. -1
  6975. ],
  6976. [
  6977. -1,
  6978. -1
  6979. ],
  6980. [
  6981. -1,
  6982. -1
  6983. ],
  6984. [
  6985. -1,
  6986. -1
  6987. ],
  6988. [
  6989. -1,
  6990. -1
  6991. ],
  6992. [
  6993. -1,
  6994. -1
  6995. ],
  6996. [
  6997. -1,
  6998. -1
  6999. ],
  7000. [
  7001. -1,
  7002. -1
  7003. ],
  7004. [
  7005. -1,
  7006. -1
  7007. ],
  7008. [
  7009. -1,
  7010. -1
  7011. ],
  7012. [
  7013. -1,
  7014. -1
  7015. ],
  7016. [
  7017. -1,
  7018. -1
  7019. ],
  7020. [
  7021. -1,
  7022. -1
  7023. ],
  7024. [
  7025. -1,
  7026. -1
  7027. ],
  7028. [
  7029. -1,
  7030. -1
  7031. ],
  7032. [
  7033. -1,
  7034. -1
  7035. ],
  7036. [
  7037. 11,
  7038. 1792
  7039. ],
  7040. [
  7041. 11,
  7042. 1792
  7043. ],
  7044. [
  7045. 11,
  7046. 1792
  7047. ],
  7048. [
  7049. 11,
  7050. 1792
  7051. ],
  7052. [
  7053. 12,
  7054. 1984
  7055. ],
  7056. [
  7057. 12,
  7058. 1984
  7059. ],
  7060. [
  7061. 12,
  7062. 2048
  7063. ],
  7064. [
  7065. 12,
  7066. 2048
  7067. ],
  7068. [
  7069. 12,
  7070. 2112
  7071. ],
  7072. [
  7073. 12,
  7074. 2112
  7075. ],
  7076. [
  7077. 12,
  7078. 2176
  7079. ],
  7080. [
  7081. 12,
  7082. 2176
  7083. ],
  7084. [
  7085. 12,
  7086. 2240
  7087. ],
  7088. [
  7089. 12,
  7090. 2240
  7091. ],
  7092. [
  7093. 12,
  7094. 2304
  7095. ],
  7096. [
  7097. 12,
  7098. 2304
  7099. ],
  7100. [
  7101. 11,
  7102. 1856
  7103. ],
  7104. [
  7105. 11,
  7106. 1856
  7107. ],
  7108. [
  7109. 11,
  7110. 1856
  7111. ],
  7112. [
  7113. 11,
  7114. 1856
  7115. ],
  7116. [
  7117. 11,
  7118. 1920
  7119. ],
  7120. [
  7121. 11,
  7122. 1920
  7123. ],
  7124. [
  7125. 11,
  7126. 1920
  7127. ],
  7128. [
  7129. 11,
  7130. 1920
  7131. ],
  7132. [
  7133. 12,
  7134. 2368
  7135. ],
  7136. [
  7137. 12,
  7138. 2368
  7139. ],
  7140. [
  7141. 12,
  7142. 2432
  7143. ],
  7144. [
  7145. 12,
  7146. 2432
  7147. ],
  7148. [
  7149. 12,
  7150. 2496
  7151. ],
  7152. [
  7153. 12,
  7154. 2496
  7155. ],
  7156. [
  7157. 12,
  7158. 2560
  7159. ],
  7160. [
  7161. 12,
  7162. 2560
  7163. ],
  7164. [
  7165. 10,
  7166. 18
  7167. ],
  7168. [
  7169. 10,
  7170. 18
  7171. ],
  7172. [
  7173. 10,
  7174. 18
  7175. ],
  7176. [
  7177. 10,
  7178. 18
  7179. ],
  7180. [
  7181. 10,
  7182. 18
  7183. ],
  7184. [
  7185. 10,
  7186. 18
  7187. ],
  7188. [
  7189. 10,
  7190. 18
  7191. ],
  7192. [
  7193. 10,
  7194. 18
  7195. ],
  7196. [
  7197. 12,
  7198. 52
  7199. ],
  7200. [
  7201. 12,
  7202. 52
  7203. ],
  7204. [
  7205. 13,
  7206. 640
  7207. ],
  7208. [
  7209. 13,
  7210. 704
  7211. ],
  7212. [
  7213. 13,
  7214. 768
  7215. ],
  7216. [
  7217. 13,
  7218. 832
  7219. ],
  7220. [
  7221. 12,
  7222. 55
  7223. ],
  7224. [
  7225. 12,
  7226. 55
  7227. ],
  7228. [
  7229. 12,
  7230. 56
  7231. ],
  7232. [
  7233. 12,
  7234. 56
  7235. ],
  7236. [
  7237. 13,
  7238. 1280
  7239. ],
  7240. [
  7241. 13,
  7242. 1344
  7243. ],
  7244. [
  7245. 13,
  7246. 1408
  7247. ],
  7248. [
  7249. 13,
  7250. 1472
  7251. ],
  7252. [
  7253. 12,
  7254. 59
  7255. ],
  7256. [
  7257. 12,
  7258. 59
  7259. ],
  7260. [
  7261. 12,
  7262. 60
  7263. ],
  7264. [
  7265. 12,
  7266. 60
  7267. ],
  7268. [
  7269. 13,
  7270. 1536
  7271. ],
  7272. [
  7273. 13,
  7274. 1600
  7275. ],
  7276. [
  7277. 11,
  7278. 24
  7279. ],
  7280. [
  7281. 11,
  7282. 24
  7283. ],
  7284. [
  7285. 11,
  7286. 24
  7287. ],
  7288. [
  7289. 11,
  7290. 24
  7291. ],
  7292. [
  7293. 11,
  7294. 25
  7295. ],
  7296. [
  7297. 11,
  7298. 25
  7299. ],
  7300. [
  7301. 11,
  7302. 25
  7303. ],
  7304. [
  7305. 11,
  7306. 25
  7307. ],
  7308. [
  7309. 13,
  7310. 1664
  7311. ],
  7312. [
  7313. 13,
  7314. 1728
  7315. ],
  7316. [
  7317. 12,
  7318. 320
  7319. ],
  7320. [
  7321. 12,
  7322. 320
  7323. ],
  7324. [
  7325. 12,
  7326. 384
  7327. ],
  7328. [
  7329. 12,
  7330. 384
  7331. ],
  7332. [
  7333. 12,
  7334. 448
  7335. ],
  7336. [
  7337. 12,
  7338. 448
  7339. ],
  7340. [
  7341. 13,
  7342. 512
  7343. ],
  7344. [
  7345. 13,
  7346. 576
  7347. ],
  7348. [
  7349. 12,
  7350. 53
  7351. ],
  7352. [
  7353. 12,
  7354. 53
  7355. ],
  7356. [
  7357. 12,
  7358. 54
  7359. ],
  7360. [
  7361. 12,
  7362. 54
  7363. ],
  7364. [
  7365. 13,
  7366. 896
  7367. ],
  7368. [
  7369. 13,
  7370. 960
  7371. ],
  7372. [
  7373. 13,
  7374. 1024
  7375. ],
  7376. [
  7377. 13,
  7378. 1088
  7379. ],
  7380. [
  7381. 13,
  7382. 1152
  7383. ],
  7384. [
  7385. 13,
  7386. 1216
  7387. ],
  7388. [
  7389. 10,
  7390. 64
  7391. ],
  7392. [
  7393. 10,
  7394. 64
  7395. ],
  7396. [
  7397. 10,
  7398. 64
  7399. ],
  7400. [
  7401. 10,
  7402. 64
  7403. ],
  7404. [
  7405. 10,
  7406. 64
  7407. ],
  7408. [
  7409. 10,
  7410. 64
  7411. ],
  7412. [
  7413. 10,
  7414. 64
  7415. ],
  7416. [
  7417. 10,
  7418. 64
  7419. ]
  7420. ];
  7421. var blackTable2 = [
  7422. [
  7423. 8,
  7424. 13
  7425. ],
  7426. [
  7427. 8,
  7428. 13
  7429. ],
  7430. [
  7431. 8,
  7432. 13
  7433. ],
  7434. [
  7435. 8,
  7436. 13
  7437. ],
  7438. [
  7439. 8,
  7440. 13
  7441. ],
  7442. [
  7443. 8,
  7444. 13
  7445. ],
  7446. [
  7447. 8,
  7448. 13
  7449. ],
  7450. [
  7451. 8,
  7452. 13
  7453. ],
  7454. [
  7455. 8,
  7456. 13
  7457. ],
  7458. [
  7459. 8,
  7460. 13
  7461. ],
  7462. [
  7463. 8,
  7464. 13
  7465. ],
  7466. [
  7467. 8,
  7468. 13
  7469. ],
  7470. [
  7471. 8,
  7472. 13
  7473. ],
  7474. [
  7475. 8,
  7476. 13
  7477. ],
  7478. [
  7479. 8,
  7480. 13
  7481. ],
  7482. [
  7483. 8,
  7484. 13
  7485. ],
  7486. [
  7487. 11,
  7488. 23
  7489. ],
  7490. [
  7491. 11,
  7492. 23
  7493. ],
  7494. [
  7495. 12,
  7496. 50
  7497. ],
  7498. [
  7499. 12,
  7500. 51
  7501. ],
  7502. [
  7503. 12,
  7504. 44
  7505. ],
  7506. [
  7507. 12,
  7508. 45
  7509. ],
  7510. [
  7511. 12,
  7512. 46
  7513. ],
  7514. [
  7515. 12,
  7516. 47
  7517. ],
  7518. [
  7519. 12,
  7520. 57
  7521. ],
  7522. [
  7523. 12,
  7524. 58
  7525. ],
  7526. [
  7527. 12,
  7528. 61
  7529. ],
  7530. [
  7531. 12,
  7532. 256
  7533. ],
  7534. [
  7535. 10,
  7536. 16
  7537. ],
  7538. [
  7539. 10,
  7540. 16
  7541. ],
  7542. [
  7543. 10,
  7544. 16
  7545. ],
  7546. [
  7547. 10,
  7548. 16
  7549. ],
  7550. [
  7551. 10,
  7552. 17
  7553. ],
  7554. [
  7555. 10,
  7556. 17
  7557. ],
  7558. [
  7559. 10,
  7560. 17
  7561. ],
  7562. [
  7563. 10,
  7564. 17
  7565. ],
  7566. [
  7567. 12,
  7568. 48
  7569. ],
  7570. [
  7571. 12,
  7572. 49
  7573. ],
  7574. [
  7575. 12,
  7576. 62
  7577. ],
  7578. [
  7579. 12,
  7580. 63
  7581. ],
  7582. [
  7583. 12,
  7584. 30
  7585. ],
  7586. [
  7587. 12,
  7588. 31
  7589. ],
  7590. [
  7591. 12,
  7592. 32
  7593. ],
  7594. [
  7595. 12,
  7596. 33
  7597. ],
  7598. [
  7599. 12,
  7600. 40
  7601. ],
  7602. [
  7603. 12,
  7604. 41
  7605. ],
  7606. [
  7607. 11,
  7608. 22
  7609. ],
  7610. [
  7611. 11,
  7612. 22
  7613. ],
  7614. [
  7615. 8,
  7616. 14
  7617. ],
  7618. [
  7619. 8,
  7620. 14
  7621. ],
  7622. [
  7623. 8,
  7624. 14
  7625. ],
  7626. [
  7627. 8,
  7628. 14
  7629. ],
  7630. [
  7631. 8,
  7632. 14
  7633. ],
  7634. [
  7635. 8,
  7636. 14
  7637. ],
  7638. [
  7639. 8,
  7640. 14
  7641. ],
  7642. [
  7643. 8,
  7644. 14
  7645. ],
  7646. [
  7647. 8,
  7648. 14
  7649. ],
  7650. [
  7651. 8,
  7652. 14
  7653. ],
  7654. [
  7655. 8,
  7656. 14
  7657. ],
  7658. [
  7659. 8,
  7660. 14
  7661. ],
  7662. [
  7663. 8,
  7664. 14
  7665. ],
  7666. [
  7667. 8,
  7668. 14
  7669. ],
  7670. [
  7671. 8,
  7672. 14
  7673. ],
  7674. [
  7675. 8,
  7676. 14
  7677. ],
  7678. [
  7679. 7,
  7680. 10
  7681. ],
  7682. [
  7683. 7,
  7684. 10
  7685. ],
  7686. [
  7687. 7,
  7688. 10
  7689. ],
  7690. [
  7691. 7,
  7692. 10
  7693. ],
  7694. [
  7695. 7,
  7696. 10
  7697. ],
  7698. [
  7699. 7,
  7700. 10
  7701. ],
  7702. [
  7703. 7,
  7704. 10
  7705. ],
  7706. [
  7707. 7,
  7708. 10
  7709. ],
  7710. [
  7711. 7,
  7712. 10
  7713. ],
  7714. [
  7715. 7,
  7716. 10
  7717. ],
  7718. [
  7719. 7,
  7720. 10
  7721. ],
  7722. [
  7723. 7,
  7724. 10
  7725. ],
  7726. [
  7727. 7,
  7728. 10
  7729. ],
  7730. [
  7731. 7,
  7732. 10
  7733. ],
  7734. [
  7735. 7,
  7736. 10
  7737. ],
  7738. [
  7739. 7,
  7740. 10
  7741. ],
  7742. [
  7743. 7,
  7744. 10
  7745. ],
  7746. [
  7747. 7,
  7748. 10
  7749. ],
  7750. [
  7751. 7,
  7752. 10
  7753. ],
  7754. [
  7755. 7,
  7756. 10
  7757. ],
  7758. [
  7759. 7,
  7760. 10
  7761. ],
  7762. [
  7763. 7,
  7764. 10
  7765. ],
  7766. [
  7767. 7,
  7768. 10
  7769. ],
  7770. [
  7771. 7,
  7772. 10
  7773. ],
  7774. [
  7775. 7,
  7776. 10
  7777. ],
  7778. [
  7779. 7,
  7780. 10
  7781. ],
  7782. [
  7783. 7,
  7784. 10
  7785. ],
  7786. [
  7787. 7,
  7788. 10
  7789. ],
  7790. [
  7791. 7,
  7792. 10
  7793. ],
  7794. [
  7795. 7,
  7796. 10
  7797. ],
  7798. [
  7799. 7,
  7800. 10
  7801. ],
  7802. [
  7803. 7,
  7804. 10
  7805. ],
  7806. [
  7807. 7,
  7808. 11
  7809. ],
  7810. [
  7811. 7,
  7812. 11
  7813. ],
  7814. [
  7815. 7,
  7816. 11
  7817. ],
  7818. [
  7819. 7,
  7820. 11
  7821. ],
  7822. [
  7823. 7,
  7824. 11
  7825. ],
  7826. [
  7827. 7,
  7828. 11
  7829. ],
  7830. [
  7831. 7,
  7832. 11
  7833. ],
  7834. [
  7835. 7,
  7836. 11
  7837. ],
  7838. [
  7839. 7,
  7840. 11
  7841. ],
  7842. [
  7843. 7,
  7844. 11
  7845. ],
  7846. [
  7847. 7,
  7848. 11
  7849. ],
  7850. [
  7851. 7,
  7852. 11
  7853. ],
  7854. [
  7855. 7,
  7856. 11
  7857. ],
  7858. [
  7859. 7,
  7860. 11
  7861. ],
  7862. [
  7863. 7,
  7864. 11
  7865. ],
  7866. [
  7867. 7,
  7868. 11
  7869. ],
  7870. [
  7871. 7,
  7872. 11
  7873. ],
  7874. [
  7875. 7,
  7876. 11
  7877. ],
  7878. [
  7879. 7,
  7880. 11
  7881. ],
  7882. [
  7883. 7,
  7884. 11
  7885. ],
  7886. [
  7887. 7,
  7888. 11
  7889. ],
  7890. [
  7891. 7,
  7892. 11
  7893. ],
  7894. [
  7895. 7,
  7896. 11
  7897. ],
  7898. [
  7899. 7,
  7900. 11
  7901. ],
  7902. [
  7903. 7,
  7904. 11
  7905. ],
  7906. [
  7907. 7,
  7908. 11
  7909. ],
  7910. [
  7911. 7,
  7912. 11
  7913. ],
  7914. [
  7915. 7,
  7916. 11
  7917. ],
  7918. [
  7919. 7,
  7920. 11
  7921. ],
  7922. [
  7923. 7,
  7924. 11
  7925. ],
  7926. [
  7927. 7,
  7928. 11
  7929. ],
  7930. [
  7931. 7,
  7932. 11
  7933. ],
  7934. [
  7935. 9,
  7936. 15
  7937. ],
  7938. [
  7939. 9,
  7940. 15
  7941. ],
  7942. [
  7943. 9,
  7944. 15
  7945. ],
  7946. [
  7947. 9,
  7948. 15
  7949. ],
  7950. [
  7951. 9,
  7952. 15
  7953. ],
  7954. [
  7955. 9,
  7956. 15
  7957. ],
  7958. [
  7959. 9,
  7960. 15
  7961. ],
  7962. [
  7963. 9,
  7964. 15
  7965. ],
  7966. [
  7967. 12,
  7968. 128
  7969. ],
  7970. [
  7971. 12,
  7972. 192
  7973. ],
  7974. [
  7975. 12,
  7976. 26
  7977. ],
  7978. [
  7979. 12,
  7980. 27
  7981. ],
  7982. [
  7983. 12,
  7984. 28
  7985. ],
  7986. [
  7987. 12,
  7988. 29
  7989. ],
  7990. [
  7991. 11,
  7992. 19
  7993. ],
  7994. [
  7995. 11,
  7996. 19
  7997. ],
  7998. [
  7999. 11,
  8000. 20
  8001. ],
  8002. [
  8003. 11,
  8004. 20
  8005. ],
  8006. [
  8007. 12,
  8008. 34
  8009. ],
  8010. [
  8011. 12,
  8012. 35
  8013. ],
  8014. [
  8015. 12,
  8016. 36
  8017. ],
  8018. [
  8019. 12,
  8020. 37
  8021. ],
  8022. [
  8023. 12,
  8024. 38
  8025. ],
  8026. [
  8027. 12,
  8028. 39
  8029. ],
  8030. [
  8031. 11,
  8032. 21
  8033. ],
  8034. [
  8035. 11,
  8036. 21
  8037. ],
  8038. [
  8039. 12,
  8040. 42
  8041. ],
  8042. [
  8043. 12,
  8044. 43
  8045. ],
  8046. [
  8047. 10,
  8048. 0
  8049. ],
  8050. [
  8051. 10,
  8052. 0
  8053. ],
  8054. [
  8055. 10,
  8056. 0
  8057. ],
  8058. [
  8059. 10,
  8060. 0
  8061. ],
  8062. [
  8063. 7,
  8064. 12
  8065. ],
  8066. [
  8067. 7,
  8068. 12
  8069. ],
  8070. [
  8071. 7,
  8072. 12
  8073. ],
  8074. [
  8075. 7,
  8076. 12
  8077. ],
  8078. [
  8079. 7,
  8080. 12
  8081. ],
  8082. [
  8083. 7,
  8084. 12
  8085. ],
  8086. [
  8087. 7,
  8088. 12
  8089. ],
  8090. [
  8091. 7,
  8092. 12
  8093. ],
  8094. [
  8095. 7,
  8096. 12
  8097. ],
  8098. [
  8099. 7,
  8100. 12
  8101. ],
  8102. [
  8103. 7,
  8104. 12
  8105. ],
  8106. [
  8107. 7,
  8108. 12
  8109. ],
  8110. [
  8111. 7,
  8112. 12
  8113. ],
  8114. [
  8115. 7,
  8116. 12
  8117. ],
  8118. [
  8119. 7,
  8120. 12
  8121. ],
  8122. [
  8123. 7,
  8124. 12
  8125. ],
  8126. [
  8127. 7,
  8128. 12
  8129. ],
  8130. [
  8131. 7,
  8132. 12
  8133. ],
  8134. [
  8135. 7,
  8136. 12
  8137. ],
  8138. [
  8139. 7,
  8140. 12
  8141. ],
  8142. [
  8143. 7,
  8144. 12
  8145. ],
  8146. [
  8147. 7,
  8148. 12
  8149. ],
  8150. [
  8151. 7,
  8152. 12
  8153. ],
  8154. [
  8155. 7,
  8156. 12
  8157. ],
  8158. [
  8159. 7,
  8160. 12
  8161. ],
  8162. [
  8163. 7,
  8164. 12
  8165. ],
  8166. [
  8167. 7,
  8168. 12
  8169. ],
  8170. [
  8171. 7,
  8172. 12
  8173. ],
  8174. [
  8175. 7,
  8176. 12
  8177. ],
  8178. [
  8179. 7,
  8180. 12
  8181. ],
  8182. [
  8183. 7,
  8184. 12
  8185. ],
  8186. [
  8187. 7,
  8188. 12
  8189. ]
  8190. ];
  8191. var blackTable3 = [
  8192. [
  8193. -1,
  8194. -1
  8195. ],
  8196. [
  8197. -1,
  8198. -1
  8199. ],
  8200. [
  8201. -1,
  8202. -1
  8203. ],
  8204. [
  8205. -1,
  8206. -1
  8207. ],
  8208. [
  8209. 6,
  8210. 9
  8211. ],
  8212. [
  8213. 6,
  8214. 8
  8215. ],
  8216. [
  8217. 5,
  8218. 7
  8219. ],
  8220. [
  8221. 5,
  8222. 7
  8223. ],
  8224. [
  8225. 4,
  8226. 6
  8227. ],
  8228. [
  8229. 4,
  8230. 6
  8231. ],
  8232. [
  8233. 4,
  8234. 6
  8235. ],
  8236. [
  8237. 4,
  8238. 6
  8239. ],
  8240. [
  8241. 4,
  8242. 5
  8243. ],
  8244. [
  8245. 4,
  8246. 5
  8247. ],
  8248. [
  8249. 4,
  8250. 5
  8251. ],
  8252. [
  8253. 4,
  8254. 5
  8255. ],
  8256. [
  8257. 3,
  8258. 1
  8259. ],
  8260. [
  8261. 3,
  8262. 1
  8263. ],
  8264. [
  8265. 3,
  8266. 1
  8267. ],
  8268. [
  8269. 3,
  8270. 1
  8271. ],
  8272. [
  8273. 3,
  8274. 1
  8275. ],
  8276. [
  8277. 3,
  8278. 1
  8279. ],
  8280. [
  8281. 3,
  8282. 1
  8283. ],
  8284. [
  8285. 3,
  8286. 1
  8287. ],
  8288. [
  8289. 3,
  8290. 4
  8291. ],
  8292. [
  8293. 3,
  8294. 4
  8295. ],
  8296. [
  8297. 3,
  8298. 4
  8299. ],
  8300. [
  8301. 3,
  8302. 4
  8303. ],
  8304. [
  8305. 3,
  8306. 4
  8307. ],
  8308. [
  8309. 3,
  8310. 4
  8311. ],
  8312. [
  8313. 3,
  8314. 4
  8315. ],
  8316. [
  8317. 3,
  8318. 4
  8319. ],
  8320. [
  8321. 2,
  8322. 3
  8323. ],
  8324. [
  8325. 2,
  8326. 3
  8327. ],
  8328. [
  8329. 2,
  8330. 3
  8331. ],
  8332. [
  8333. 2,
  8334. 3
  8335. ],
  8336. [
  8337. 2,
  8338. 3
  8339. ],
  8340. [
  8341. 2,
  8342. 3
  8343. ],
  8344. [
  8345. 2,
  8346. 3
  8347. ],
  8348. [
  8349. 2,
  8350. 3
  8351. ],
  8352. [
  8353. 2,
  8354. 3
  8355. ],
  8356. [
  8357. 2,
  8358. 3
  8359. ],
  8360. [
  8361. 2,
  8362. 3
  8363. ],
  8364. [
  8365. 2,
  8366. 3
  8367. ],
  8368. [
  8369. 2,
  8370. 3
  8371. ],
  8372. [
  8373. 2,
  8374. 3
  8375. ],
  8376. [
  8377. 2,
  8378. 3
  8379. ],
  8380. [
  8381. 2,
  8382. 3
  8383. ],
  8384. [
  8385. 2,
  8386. 2
  8387. ],
  8388. [
  8389. 2,
  8390. 2
  8391. ],
  8392. [
  8393. 2,
  8394. 2
  8395. ],
  8396. [
  8397. 2,
  8398. 2
  8399. ],
  8400. [
  8401. 2,
  8402. 2
  8403. ],
  8404. [
  8405. 2,
  8406. 2
  8407. ],
  8408. [
  8409. 2,
  8410. 2
  8411. ],
  8412. [
  8413. 2,
  8414. 2
  8415. ],
  8416. [
  8417. 2,
  8418. 2
  8419. ],
  8420. [
  8421. 2,
  8422. 2
  8423. ],
  8424. [
  8425. 2,
  8426. 2
  8427. ],
  8428. [
  8429. 2,
  8430. 2
  8431. ],
  8432. [
  8433. 2,
  8434. 2
  8435. ],
  8436. [
  8437. 2,
  8438. 2
  8439. ],
  8440. [
  8441. 2,
  8442. 2
  8443. ],
  8444. [
  8445. 2,
  8446. 2
  8447. ]
  8448. ];
  8449. function CCITTFaxStream(str, maybeLength, params) {
  8450. this.str = str;
  8451. this.dict = str.dict;
  8452. params = params || Dict.empty;
  8453. this.encoding = params.get('K') || 0;
  8454. this.eoline = params.get('EndOfLine') || false;
  8455. this.byteAlign = params.get('EncodedByteAlign') || false;
  8456. this.columns = params.get('Columns') || 1728;
  8457. this.rows = params.get('Rows') || 0;
  8458. var eoblock = params.get('EndOfBlock');
  8459. if (eoblock === null || eoblock === undefined) {
  8460. eoblock = true;
  8461. }
  8462. this.eoblock = eoblock;
  8463. this.black = params.get('BlackIs1') || false;
  8464. this.codingLine = new Uint32Array(this.columns + 1);
  8465. this.refLine = new Uint32Array(this.columns + 2);
  8466. this.codingLine[0] = this.columns;
  8467. this.codingPos = 0;
  8468. this.row = 0;
  8469. this.nextLine2D = this.encoding < 0;
  8470. this.inputBits = 0;
  8471. this.inputBuf = 0;
  8472. this.outputBits = 0;
  8473. var code1;
  8474. while ((code1 = this.lookBits(12)) === 0) {
  8475. this.eatBits(1);
  8476. }
  8477. if (code1 === 1) {
  8478. this.eatBits(12);
  8479. }
  8480. if (this.encoding > 0) {
  8481. this.nextLine2D = !this.lookBits(1);
  8482. this.eatBits(1);
  8483. }
  8484. DecodeStream.call(this, maybeLength);
  8485. }
  8486. CCITTFaxStream.prototype = Object.create(DecodeStream.prototype);
  8487. CCITTFaxStream.prototype.readBlock = function CCITTFaxStream_readBlock() {
  8488. while (!this.eof) {
  8489. var c = this.lookChar();
  8490. this.ensureBuffer(this.bufferLength + 1);
  8491. this.buffer[this.bufferLength++] = c;
  8492. }
  8493. };
  8494. CCITTFaxStream.prototype.addPixels = function ccittFaxStreamAddPixels(a1, blackPixels) {
  8495. var codingLine = this.codingLine;
  8496. var codingPos = this.codingPos;
  8497. if (a1 > codingLine[codingPos]) {
  8498. if (a1 > this.columns) {
  8499. info('row is wrong length');
  8500. this.err = true;
  8501. a1 = this.columns;
  8502. }
  8503. if (codingPos & 1 ^ blackPixels) {
  8504. ++codingPos;
  8505. }
  8506. codingLine[codingPos] = a1;
  8507. }
  8508. this.codingPos = codingPos;
  8509. };
  8510. CCITTFaxStream.prototype.addPixelsNeg = function ccittFaxStreamAddPixelsNeg(a1, blackPixels) {
  8511. var codingLine = this.codingLine;
  8512. var codingPos = this.codingPos;
  8513. if (a1 > codingLine[codingPos]) {
  8514. if (a1 > this.columns) {
  8515. info('row is wrong length');
  8516. this.err = true;
  8517. a1 = this.columns;
  8518. }
  8519. if (codingPos & 1 ^ blackPixels) {
  8520. ++codingPos;
  8521. }
  8522. codingLine[codingPos] = a1;
  8523. } else if (a1 < codingLine[codingPos]) {
  8524. if (a1 < 0) {
  8525. info('invalid code');
  8526. this.err = true;
  8527. a1 = 0;
  8528. }
  8529. while (codingPos > 0 && a1 < codingLine[codingPos - 1]) {
  8530. --codingPos;
  8531. }
  8532. codingLine[codingPos] = a1;
  8533. }
  8534. this.codingPos = codingPos;
  8535. };
  8536. CCITTFaxStream.prototype.lookChar = function CCITTFaxStream_lookChar() {
  8537. var refLine = this.refLine;
  8538. var codingLine = this.codingLine;
  8539. var columns = this.columns;
  8540. var refPos, blackPixels, bits, i;
  8541. if (this.outputBits === 0) {
  8542. if (this.eof) {
  8543. return null;
  8544. }
  8545. this.err = false;
  8546. var code1, code2, code3;
  8547. if (this.nextLine2D) {
  8548. for (i = 0; codingLine[i] < columns; ++i) {
  8549. refLine[i] = codingLine[i];
  8550. }
  8551. refLine[i++] = columns;
  8552. refLine[i] = columns;
  8553. codingLine[0] = 0;
  8554. this.codingPos = 0;
  8555. refPos = 0;
  8556. blackPixels = 0;
  8557. while (codingLine[this.codingPos] < columns) {
  8558. code1 = this.getTwoDimCode();
  8559. switch (code1) {
  8560. case twoDimPass:
  8561. this.addPixels(refLine[refPos + 1], blackPixels);
  8562. if (refLine[refPos + 1] < columns) {
  8563. refPos += 2;
  8564. }
  8565. break;
  8566. case twoDimHoriz:
  8567. code1 = code2 = 0;
  8568. if (blackPixels) {
  8569. do {
  8570. code1 += code3 = this.getBlackCode();
  8571. } while (code3 >= 64);
  8572. do {
  8573. code2 += code3 = this.getWhiteCode();
  8574. } while (code3 >= 64);
  8575. } else {
  8576. do {
  8577. code1 += code3 = this.getWhiteCode();
  8578. } while (code3 >= 64);
  8579. do {
  8580. code2 += code3 = this.getBlackCode();
  8581. } while (code3 >= 64);
  8582. }
  8583. this.addPixels(codingLine[this.codingPos] + code1, blackPixels);
  8584. if (codingLine[this.codingPos] < columns) {
  8585. this.addPixels(codingLine[this.codingPos] + code2, blackPixels ^ 1);
  8586. }
  8587. while (refLine[refPos] <= codingLine[this.codingPos] && refLine[refPos] < columns) {
  8588. refPos += 2;
  8589. }
  8590. break;
  8591. case twoDimVertR3:
  8592. this.addPixels(refLine[refPos] + 3, blackPixels);
  8593. blackPixels ^= 1;
  8594. if (codingLine[this.codingPos] < columns) {
  8595. ++refPos;
  8596. while (refLine[refPos] <= codingLine[this.codingPos] && refLine[refPos] < columns) {
  8597. refPos += 2;
  8598. }
  8599. }
  8600. break;
  8601. case twoDimVertR2:
  8602. this.addPixels(refLine[refPos] + 2, blackPixels);
  8603. blackPixels ^= 1;
  8604. if (codingLine[this.codingPos] < columns) {
  8605. ++refPos;
  8606. while (refLine[refPos] <= codingLine[this.codingPos] && refLine[refPos] < columns) {
  8607. refPos += 2;
  8608. }
  8609. }
  8610. break;
  8611. case twoDimVertR1:
  8612. this.addPixels(refLine[refPos] + 1, blackPixels);
  8613. blackPixels ^= 1;
  8614. if (codingLine[this.codingPos] < columns) {
  8615. ++refPos;
  8616. while (refLine[refPos] <= codingLine[this.codingPos] && refLine[refPos] < columns) {
  8617. refPos += 2;
  8618. }
  8619. }
  8620. break;
  8621. case twoDimVert0:
  8622. this.addPixels(refLine[refPos], blackPixels);
  8623. blackPixels ^= 1;
  8624. if (codingLine[this.codingPos] < columns) {
  8625. ++refPos;
  8626. while (refLine[refPos] <= codingLine[this.codingPos] && refLine[refPos] < columns) {
  8627. refPos += 2;
  8628. }
  8629. }
  8630. break;
  8631. case twoDimVertL3:
  8632. this.addPixelsNeg(refLine[refPos] - 3, blackPixels);
  8633. blackPixels ^= 1;
  8634. if (codingLine[this.codingPos] < columns) {
  8635. if (refPos > 0) {
  8636. --refPos;
  8637. } else {
  8638. ++refPos;
  8639. }
  8640. while (refLine[refPos] <= codingLine[this.codingPos] && refLine[refPos] < columns) {
  8641. refPos += 2;
  8642. }
  8643. }
  8644. break;
  8645. case twoDimVertL2:
  8646. this.addPixelsNeg(refLine[refPos] - 2, blackPixels);
  8647. blackPixels ^= 1;
  8648. if (codingLine[this.codingPos] < columns) {
  8649. if (refPos > 0) {
  8650. --refPos;
  8651. } else {
  8652. ++refPos;
  8653. }
  8654. while (refLine[refPos] <= codingLine[this.codingPos] && refLine[refPos] < columns) {
  8655. refPos += 2;
  8656. }
  8657. }
  8658. break;
  8659. case twoDimVertL1:
  8660. this.addPixelsNeg(refLine[refPos] - 1, blackPixels);
  8661. blackPixels ^= 1;
  8662. if (codingLine[this.codingPos] < columns) {
  8663. if (refPos > 0) {
  8664. --refPos;
  8665. } else {
  8666. ++refPos;
  8667. }
  8668. while (refLine[refPos] <= codingLine[this.codingPos] && refLine[refPos] < columns) {
  8669. refPos += 2;
  8670. }
  8671. }
  8672. break;
  8673. case ccittEOF:
  8674. this.addPixels(columns, 0);
  8675. this.eof = true;
  8676. break;
  8677. default:
  8678. info('bad 2d code');
  8679. this.addPixels(columns, 0);
  8680. this.err = true;
  8681. }
  8682. }
  8683. } else {
  8684. codingLine[0] = 0;
  8685. this.codingPos = 0;
  8686. blackPixels = 0;
  8687. while (codingLine[this.codingPos] < columns) {
  8688. code1 = 0;
  8689. if (blackPixels) {
  8690. do {
  8691. code1 += code3 = this.getBlackCode();
  8692. } while (code3 >= 64);
  8693. } else {
  8694. do {
  8695. code1 += code3 = this.getWhiteCode();
  8696. } while (code3 >= 64);
  8697. }
  8698. this.addPixels(codingLine[this.codingPos] + code1, blackPixels);
  8699. blackPixels ^= 1;
  8700. }
  8701. }
  8702. var gotEOL = false;
  8703. if (this.byteAlign) {
  8704. this.inputBits &= ~7;
  8705. }
  8706. if (!this.eoblock && this.row === this.rows - 1) {
  8707. this.eof = true;
  8708. } else {
  8709. code1 = this.lookBits(12);
  8710. if (this.eoline) {
  8711. while (code1 !== ccittEOF && code1 !== 1) {
  8712. this.eatBits(1);
  8713. code1 = this.lookBits(12);
  8714. }
  8715. } else {
  8716. while (code1 === 0) {
  8717. this.eatBits(1);
  8718. code1 = this.lookBits(12);
  8719. }
  8720. }
  8721. if (code1 === 1) {
  8722. this.eatBits(12);
  8723. gotEOL = true;
  8724. } else if (code1 === ccittEOF) {
  8725. this.eof = true;
  8726. }
  8727. }
  8728. if (!this.eof && this.encoding > 0) {
  8729. this.nextLine2D = !this.lookBits(1);
  8730. this.eatBits(1);
  8731. }
  8732. if (this.eoblock && gotEOL && this.byteAlign) {
  8733. code1 = this.lookBits(12);
  8734. if (code1 === 1) {
  8735. this.eatBits(12);
  8736. if (this.encoding > 0) {
  8737. this.lookBits(1);
  8738. this.eatBits(1);
  8739. }
  8740. if (this.encoding >= 0) {
  8741. for (i = 0; i < 4; ++i) {
  8742. code1 = this.lookBits(12);
  8743. if (code1 !== 1) {
  8744. info('bad rtc code: ' + code1);
  8745. }
  8746. this.eatBits(12);
  8747. if (this.encoding > 0) {
  8748. this.lookBits(1);
  8749. this.eatBits(1);
  8750. }
  8751. }
  8752. }
  8753. this.eof = true;
  8754. }
  8755. } else if (this.err && this.eoline) {
  8756. while (true) {
  8757. code1 = this.lookBits(13);
  8758. if (code1 === ccittEOF) {
  8759. this.eof = true;
  8760. return null;
  8761. }
  8762. if (code1 >> 1 === 1) {
  8763. break;
  8764. }
  8765. this.eatBits(1);
  8766. }
  8767. this.eatBits(12);
  8768. if (this.encoding > 0) {
  8769. this.eatBits(1);
  8770. this.nextLine2D = !(code1 & 1);
  8771. }
  8772. }
  8773. if (codingLine[0] > 0) {
  8774. this.outputBits = codingLine[this.codingPos = 0];
  8775. } else {
  8776. this.outputBits = codingLine[this.codingPos = 1];
  8777. }
  8778. this.row++;
  8779. }
  8780. var c;
  8781. if (this.outputBits >= 8) {
  8782. c = this.codingPos & 1 ? 0 : 0xFF;
  8783. this.outputBits -= 8;
  8784. if (this.outputBits === 0 && codingLine[this.codingPos] < columns) {
  8785. this.codingPos++;
  8786. this.outputBits = codingLine[this.codingPos] - codingLine[this.codingPos - 1];
  8787. }
  8788. } else {
  8789. bits = 8;
  8790. c = 0;
  8791. do {
  8792. if (this.outputBits > bits) {
  8793. c <<= bits;
  8794. if (!(this.codingPos & 1)) {
  8795. c |= 0xFF >> 8 - bits;
  8796. }
  8797. this.outputBits -= bits;
  8798. bits = 0;
  8799. } else {
  8800. c <<= this.outputBits;
  8801. if (!(this.codingPos & 1)) {
  8802. c |= 0xFF >> 8 - this.outputBits;
  8803. }
  8804. bits -= this.outputBits;
  8805. this.outputBits = 0;
  8806. if (codingLine[this.codingPos] < columns) {
  8807. this.codingPos++;
  8808. this.outputBits = codingLine[this.codingPos] - codingLine[this.codingPos - 1];
  8809. } else if (bits > 0) {
  8810. c <<= bits;
  8811. bits = 0;
  8812. }
  8813. }
  8814. } while (bits);
  8815. }
  8816. if (this.black) {
  8817. c ^= 0xFF;
  8818. }
  8819. return c;
  8820. };
  8821. CCITTFaxStream.prototype.findTableCode = function ccittFaxStreamFindTableCode(start, end, table, limit) {
  8822. var limitValue = limit || 0;
  8823. for (var i = start; i <= end; ++i) {
  8824. var code = this.lookBits(i);
  8825. if (code === ccittEOF) {
  8826. return [
  8827. true,
  8828. 1,
  8829. false
  8830. ];
  8831. }
  8832. if (i < end) {
  8833. code <<= end - i;
  8834. }
  8835. if (!limitValue || code >= limitValue) {
  8836. var p = table[code - limitValue];
  8837. if (p[0] === i) {
  8838. this.eatBits(i);
  8839. return [
  8840. true,
  8841. p[1],
  8842. true
  8843. ];
  8844. }
  8845. }
  8846. }
  8847. return [
  8848. false,
  8849. 0,
  8850. false
  8851. ];
  8852. };
  8853. CCITTFaxStream.prototype.getTwoDimCode = function ccittFaxStreamGetTwoDimCode() {
  8854. var code = 0;
  8855. var p;
  8856. if (this.eoblock) {
  8857. code = this.lookBits(7);
  8858. p = twoDimTable[code];
  8859. if (p && p[0] > 0) {
  8860. this.eatBits(p[0]);
  8861. return p[1];
  8862. }
  8863. } else {
  8864. var result = this.findTableCode(1, 7, twoDimTable);
  8865. if (result[0] && result[2]) {
  8866. return result[1];
  8867. }
  8868. }
  8869. info('Bad two dim code');
  8870. return ccittEOF;
  8871. };
  8872. CCITTFaxStream.prototype.getWhiteCode = function ccittFaxStreamGetWhiteCode() {
  8873. var code = 0;
  8874. var p;
  8875. if (this.eoblock) {
  8876. code = this.lookBits(12);
  8877. if (code === ccittEOF) {
  8878. return 1;
  8879. }
  8880. if (code >> 5 === 0) {
  8881. p = whiteTable1[code];
  8882. } else {
  8883. p = whiteTable2[code >> 3];
  8884. }
  8885. if (p[0] > 0) {
  8886. this.eatBits(p[0]);
  8887. return p[1];
  8888. }
  8889. } else {
  8890. var result = this.findTableCode(1, 9, whiteTable2);
  8891. if (result[0]) {
  8892. return result[1];
  8893. }
  8894. result = this.findTableCode(11, 12, whiteTable1);
  8895. if (result[0]) {
  8896. return result[1];
  8897. }
  8898. }
  8899. info('bad white code');
  8900. this.eatBits(1);
  8901. return 1;
  8902. };
  8903. CCITTFaxStream.prototype.getBlackCode = function ccittFaxStreamGetBlackCode() {
  8904. var code, p;
  8905. if (this.eoblock) {
  8906. code = this.lookBits(13);
  8907. if (code === ccittEOF) {
  8908. return 1;
  8909. }
  8910. if (code >> 7 === 0) {
  8911. p = blackTable1[code];
  8912. } else if (code >> 9 === 0 && code >> 7 !== 0) {
  8913. p = blackTable2[(code >> 1) - 64];
  8914. } else {
  8915. p = blackTable3[code >> 7];
  8916. }
  8917. if (p[0] > 0) {
  8918. this.eatBits(p[0]);
  8919. return p[1];
  8920. }
  8921. } else {
  8922. var result = this.findTableCode(2, 6, blackTable3);
  8923. if (result[0]) {
  8924. return result[1];
  8925. }
  8926. result = this.findTableCode(7, 12, blackTable2, 64);
  8927. if (result[0]) {
  8928. return result[1];
  8929. }
  8930. result = this.findTableCode(10, 13, blackTable1);
  8931. if (result[0]) {
  8932. return result[1];
  8933. }
  8934. }
  8935. info('bad black code');
  8936. this.eatBits(1);
  8937. return 1;
  8938. };
  8939. CCITTFaxStream.prototype.lookBits = function CCITTFaxStream_lookBits(n) {
  8940. var c;
  8941. while (this.inputBits < n) {
  8942. if ((c = this.str.getByte()) === -1) {
  8943. if (this.inputBits === 0) {
  8944. return ccittEOF;
  8945. }
  8946. return this.inputBuf << n - this.inputBits & 0xFFFF >> 16 - n;
  8947. }
  8948. this.inputBuf = this.inputBuf << 8 | c;
  8949. this.inputBits += 8;
  8950. }
  8951. return this.inputBuf >> this.inputBits - n & 0xFFFF >> 16 - n;
  8952. };
  8953. CCITTFaxStream.prototype.eatBits = function CCITTFaxStream_eatBits(n) {
  8954. if ((this.inputBits -= n) < 0) {
  8955. this.inputBits = 0;
  8956. }
  8957. };
  8958. return CCITTFaxStream;
  8959. }();
  8960. var LZWStream = function LZWStreamClosure() {
  8961. function LZWStream(str, maybeLength, earlyChange) {
  8962. this.str = str;
  8963. this.dict = str.dict;
  8964. this.cachedData = 0;
  8965. this.bitsCached = 0;
  8966. var maxLzwDictionarySize = 4096;
  8967. var lzwState = {
  8968. earlyChange: earlyChange,
  8969. codeLength: 9,
  8970. nextCode: 258,
  8971. dictionaryValues: new Uint8Array(maxLzwDictionarySize),
  8972. dictionaryLengths: new Uint16Array(maxLzwDictionarySize),
  8973. dictionaryPrevCodes: new Uint16Array(maxLzwDictionarySize),
  8974. currentSequence: new Uint8Array(maxLzwDictionarySize),
  8975. currentSequenceLength: 0
  8976. };
  8977. for (var i = 0; i < 256; ++i) {
  8978. lzwState.dictionaryValues[i] = i;
  8979. lzwState.dictionaryLengths[i] = 1;
  8980. }
  8981. this.lzwState = lzwState;
  8982. DecodeStream.call(this, maybeLength);
  8983. }
  8984. LZWStream.prototype = Object.create(DecodeStream.prototype);
  8985. LZWStream.prototype.readBits = function LZWStream_readBits(n) {
  8986. var bitsCached = this.bitsCached;
  8987. var cachedData = this.cachedData;
  8988. while (bitsCached < n) {
  8989. var c = this.str.getByte();
  8990. if (c === -1) {
  8991. this.eof = true;
  8992. return null;
  8993. }
  8994. cachedData = cachedData << 8 | c;
  8995. bitsCached += 8;
  8996. }
  8997. this.bitsCached = bitsCached -= n;
  8998. this.cachedData = cachedData;
  8999. this.lastCode = null;
  9000. return cachedData >>> bitsCached & (1 << n) - 1;
  9001. };
  9002. LZWStream.prototype.readBlock = function LZWStream_readBlock() {
  9003. var blockSize = 512;
  9004. var estimatedDecodedSize = blockSize * 2, decodedSizeDelta = blockSize;
  9005. var i, j, q;
  9006. var lzwState = this.lzwState;
  9007. if (!lzwState) {
  9008. return;
  9009. }
  9010. var earlyChange = lzwState.earlyChange;
  9011. var nextCode = lzwState.nextCode;
  9012. var dictionaryValues = lzwState.dictionaryValues;
  9013. var dictionaryLengths = lzwState.dictionaryLengths;
  9014. var dictionaryPrevCodes = lzwState.dictionaryPrevCodes;
  9015. var codeLength = lzwState.codeLength;
  9016. var prevCode = lzwState.prevCode;
  9017. var currentSequence = lzwState.currentSequence;
  9018. var currentSequenceLength = lzwState.currentSequenceLength;
  9019. var decodedLength = 0;
  9020. var currentBufferLength = this.bufferLength;
  9021. var buffer = this.ensureBuffer(this.bufferLength + estimatedDecodedSize);
  9022. for (i = 0; i < blockSize; i++) {
  9023. var code = this.readBits(codeLength);
  9024. var hasPrev = currentSequenceLength > 0;
  9025. if (code < 256) {
  9026. currentSequence[0] = code;
  9027. currentSequenceLength = 1;
  9028. } else if (code >= 258) {
  9029. if (code < nextCode) {
  9030. currentSequenceLength = dictionaryLengths[code];
  9031. for (j = currentSequenceLength - 1, q = code; j >= 0; j--) {
  9032. currentSequence[j] = dictionaryValues[q];
  9033. q = dictionaryPrevCodes[q];
  9034. }
  9035. } else {
  9036. currentSequence[currentSequenceLength++] = currentSequence[0];
  9037. }
  9038. } else if (code === 256) {
  9039. codeLength = 9;
  9040. nextCode = 258;
  9041. currentSequenceLength = 0;
  9042. continue;
  9043. } else {
  9044. this.eof = true;
  9045. delete this.lzwState;
  9046. break;
  9047. }
  9048. if (hasPrev) {
  9049. dictionaryPrevCodes[nextCode] = prevCode;
  9050. dictionaryLengths[nextCode] = dictionaryLengths[prevCode] + 1;
  9051. dictionaryValues[nextCode] = currentSequence[0];
  9052. nextCode++;
  9053. codeLength = nextCode + earlyChange & nextCode + earlyChange - 1 ? codeLength : Math.min(Math.log(nextCode + earlyChange) / 0.6931471805599453 + 1, 12) | 0;
  9054. }
  9055. prevCode = code;
  9056. decodedLength += currentSequenceLength;
  9057. if (estimatedDecodedSize < decodedLength) {
  9058. do {
  9059. estimatedDecodedSize += decodedSizeDelta;
  9060. } while (estimatedDecodedSize < decodedLength);
  9061. buffer = this.ensureBuffer(this.bufferLength + estimatedDecodedSize);
  9062. }
  9063. for (j = 0; j < currentSequenceLength; j++) {
  9064. buffer[currentBufferLength++] = currentSequence[j];
  9065. }
  9066. }
  9067. lzwState.nextCode = nextCode;
  9068. lzwState.codeLength = codeLength;
  9069. lzwState.prevCode = prevCode;
  9070. lzwState.currentSequenceLength = currentSequenceLength;
  9071. this.bufferLength = currentBufferLength;
  9072. };
  9073. return LZWStream;
  9074. }();
  9075. var NullStream = function NullStreamClosure() {
  9076. function NullStream() {
  9077. Stream.call(this, new Uint8Array(0));
  9078. }
  9079. NullStream.prototype = Stream.prototype;
  9080. return NullStream;
  9081. }();
  9082. exports.Ascii85Stream = Ascii85Stream;
  9083. exports.AsciiHexStream = AsciiHexStream;
  9084. exports.CCITTFaxStream = CCITTFaxStream;
  9085. exports.DecryptStream = DecryptStream;
  9086. exports.DecodeStream = DecodeStream;
  9087. exports.FlateStream = FlateStream;
  9088. exports.Jbig2Stream = Jbig2Stream;
  9089. exports.JpegStream = JpegStream;
  9090. exports.JpxStream = JpxStream;
  9091. exports.NullStream = NullStream;
  9092. exports.PredictorStream = PredictorStream;
  9093. exports.RunLengthStream = RunLengthStream;
  9094. exports.Stream = Stream;
  9095. exports.StreamsSequenceStream = StreamsSequenceStream;
  9096. exports.StringStream = StringStream;
  9097. exports.LZWStream = LZWStream;
  9098. /***/ }),
  9099. /* 3 */
  9100. /***/ (function(module, exports, __w_pdfjs_require__) {
  9101. "use strict";
  9102. var sharedUtil = __w_pdfjs_require__(0);
  9103. var corePrimitives = __w_pdfjs_require__(1);
  9104. var coreFunction = __w_pdfjs_require__(6);
  9105. var error = sharedUtil.error;
  9106. var info = sharedUtil.info;
  9107. var isArray = sharedUtil.isArray;
  9108. var isString = sharedUtil.isString;
  9109. var shadow = sharedUtil.shadow;
  9110. var warn = sharedUtil.warn;
  9111. var isDict = corePrimitives.isDict;
  9112. var isName = corePrimitives.isName;
  9113. var isStream = corePrimitives.isStream;
  9114. var PDFFunction = coreFunction.PDFFunction;
  9115. var ColorSpace = function ColorSpaceClosure() {
  9116. function resizeRgbImage(src, bpc, w1, h1, w2, h2, alpha01, dest) {
  9117. var COMPONENTS = 3;
  9118. alpha01 = alpha01 !== 1 ? 0 : alpha01;
  9119. var xRatio = w1 / w2;
  9120. var yRatio = h1 / h2;
  9121. var i, j, py, newIndex = 0, oldIndex;
  9122. var xScaled = new Uint16Array(w2);
  9123. var w1Scanline = w1 * COMPONENTS;
  9124. for (i = 0; i < w2; i++) {
  9125. xScaled[i] = Math.floor(i * xRatio) * COMPONENTS;
  9126. }
  9127. for (i = 0; i < h2; i++) {
  9128. py = Math.floor(i * yRatio) * w1Scanline;
  9129. for (j = 0; j < w2; j++) {
  9130. oldIndex = py + xScaled[j];
  9131. dest[newIndex++] = src[oldIndex++];
  9132. dest[newIndex++] = src[oldIndex++];
  9133. dest[newIndex++] = src[oldIndex++];
  9134. newIndex += alpha01;
  9135. }
  9136. }
  9137. }
  9138. function ColorSpace() {
  9139. error('should not call ColorSpace constructor');
  9140. }
  9141. ColorSpace.prototype = {
  9142. getRgb: function ColorSpace_getRgb(src, srcOffset) {
  9143. var rgb = new Uint8Array(3);
  9144. this.getRgbItem(src, srcOffset, rgb, 0);
  9145. return rgb;
  9146. },
  9147. getRgbItem: function ColorSpace_getRgbItem(src, srcOffset, dest, destOffset) {
  9148. error('Should not call ColorSpace.getRgbItem');
  9149. },
  9150. getRgbBuffer: function ColorSpace_getRgbBuffer(src, srcOffset, count, dest, destOffset, bits, alpha01) {
  9151. error('Should not call ColorSpace.getRgbBuffer');
  9152. },
  9153. getOutputLength: function ColorSpace_getOutputLength(inputLength, alpha01) {
  9154. error('Should not call ColorSpace.getOutputLength');
  9155. },
  9156. isPassthrough: function ColorSpace_isPassthrough(bits) {
  9157. return false;
  9158. },
  9159. fillRgb: function ColorSpace_fillRgb(dest, originalWidth, originalHeight, width, height, actualHeight, bpc, comps, alpha01) {
  9160. var count = originalWidth * originalHeight;
  9161. var rgbBuf = null;
  9162. var numComponentColors = 1 << bpc;
  9163. var needsResizing = originalHeight !== height || originalWidth !== width;
  9164. var i, ii;
  9165. if (this.isPassthrough(bpc)) {
  9166. rgbBuf = comps;
  9167. } else if (this.numComps === 1 && count > numComponentColors && this.name !== 'DeviceGray' && this.name !== 'DeviceRGB') {
  9168. var allColors = bpc <= 8 ? new Uint8Array(numComponentColors) : new Uint16Array(numComponentColors);
  9169. var key;
  9170. for (i = 0; i < numComponentColors; i++) {
  9171. allColors[i] = i;
  9172. }
  9173. var colorMap = new Uint8Array(numComponentColors * 3);
  9174. this.getRgbBuffer(allColors, 0, numComponentColors, colorMap, 0, bpc, 0);
  9175. var destPos, rgbPos;
  9176. if (!needsResizing) {
  9177. destPos = 0;
  9178. for (i = 0; i < count; ++i) {
  9179. key = comps[i] * 3;
  9180. dest[destPos++] = colorMap[key];
  9181. dest[destPos++] = colorMap[key + 1];
  9182. dest[destPos++] = colorMap[key + 2];
  9183. destPos += alpha01;
  9184. }
  9185. } else {
  9186. rgbBuf = new Uint8Array(count * 3);
  9187. rgbPos = 0;
  9188. for (i = 0; i < count; ++i) {
  9189. key = comps[i] * 3;
  9190. rgbBuf[rgbPos++] = colorMap[key];
  9191. rgbBuf[rgbPos++] = colorMap[key + 1];
  9192. rgbBuf[rgbPos++] = colorMap[key + 2];
  9193. }
  9194. }
  9195. } else {
  9196. if (!needsResizing) {
  9197. this.getRgbBuffer(comps, 0, width * actualHeight, dest, 0, bpc, alpha01);
  9198. } else {
  9199. rgbBuf = new Uint8Array(count * 3);
  9200. this.getRgbBuffer(comps, 0, count, rgbBuf, 0, bpc, 0);
  9201. }
  9202. }
  9203. if (rgbBuf) {
  9204. if (needsResizing) {
  9205. resizeRgbImage(rgbBuf, bpc, originalWidth, originalHeight, width, height, alpha01, dest);
  9206. } else {
  9207. rgbPos = 0;
  9208. destPos = 0;
  9209. for (i = 0, ii = width * actualHeight; i < ii; i++) {
  9210. dest[destPos++] = rgbBuf[rgbPos++];
  9211. dest[destPos++] = rgbBuf[rgbPos++];
  9212. dest[destPos++] = rgbBuf[rgbPos++];
  9213. destPos += alpha01;
  9214. }
  9215. }
  9216. }
  9217. },
  9218. usesZeroToOneRange: true
  9219. };
  9220. ColorSpace.parse = function ColorSpace_parse(cs, xref, res) {
  9221. var IR = ColorSpace.parseToIR(cs, xref, res);
  9222. if (IR instanceof AlternateCS) {
  9223. return IR;
  9224. }
  9225. return ColorSpace.fromIR(IR);
  9226. };
  9227. ColorSpace.fromIR = function ColorSpace_fromIR(IR) {
  9228. var name = isArray(IR) ? IR[0] : IR;
  9229. var whitePoint, blackPoint, gamma;
  9230. switch (name) {
  9231. case 'DeviceGrayCS':
  9232. return this.singletons.gray;
  9233. case 'DeviceRgbCS':
  9234. return this.singletons.rgb;
  9235. case 'DeviceCmykCS':
  9236. return this.singletons.cmyk;
  9237. case 'CalGrayCS':
  9238. whitePoint = IR[1];
  9239. blackPoint = IR[2];
  9240. gamma = IR[3];
  9241. return new CalGrayCS(whitePoint, blackPoint, gamma);
  9242. case 'CalRGBCS':
  9243. whitePoint = IR[1];
  9244. blackPoint = IR[2];
  9245. gamma = IR[3];
  9246. var matrix = IR[4];
  9247. return new CalRGBCS(whitePoint, blackPoint, gamma, matrix);
  9248. case 'PatternCS':
  9249. var basePatternCS = IR[1];
  9250. if (basePatternCS) {
  9251. basePatternCS = ColorSpace.fromIR(basePatternCS);
  9252. }
  9253. return new PatternCS(basePatternCS);
  9254. case 'IndexedCS':
  9255. var baseIndexedCS = IR[1];
  9256. var hiVal = IR[2];
  9257. var lookup = IR[3];
  9258. return new IndexedCS(ColorSpace.fromIR(baseIndexedCS), hiVal, lookup);
  9259. case 'AlternateCS':
  9260. var numComps = IR[1];
  9261. var alt = IR[2];
  9262. var tintFnIR = IR[3];
  9263. return new AlternateCS(numComps, ColorSpace.fromIR(alt), PDFFunction.fromIR(tintFnIR));
  9264. case 'LabCS':
  9265. whitePoint = IR[1];
  9266. blackPoint = IR[2];
  9267. var range = IR[3];
  9268. return new LabCS(whitePoint, blackPoint, range);
  9269. default:
  9270. error('Unknown name ' + name);
  9271. }
  9272. return null;
  9273. };
  9274. ColorSpace.parseToIR = function ColorSpace_parseToIR(cs, xref, res) {
  9275. if (isName(cs)) {
  9276. var colorSpaces = res.get('ColorSpace');
  9277. if (isDict(colorSpaces)) {
  9278. var refcs = colorSpaces.get(cs.name);
  9279. if (refcs) {
  9280. cs = refcs;
  9281. }
  9282. }
  9283. }
  9284. cs = xref.fetchIfRef(cs);
  9285. if (isName(cs)) {
  9286. switch (cs.name) {
  9287. case 'DeviceGray':
  9288. case 'G':
  9289. return 'DeviceGrayCS';
  9290. case 'DeviceRGB':
  9291. case 'RGB':
  9292. return 'DeviceRgbCS';
  9293. case 'DeviceCMYK':
  9294. case 'CMYK':
  9295. return 'DeviceCmykCS';
  9296. case 'Pattern':
  9297. return [
  9298. 'PatternCS',
  9299. null
  9300. ];
  9301. default:
  9302. error('unrecognized colorspace ' + cs.name);
  9303. }
  9304. } else if (isArray(cs)) {
  9305. var mode = xref.fetchIfRef(cs[0]).name;
  9306. var numComps, params, alt, whitePoint, blackPoint, gamma;
  9307. switch (mode) {
  9308. case 'DeviceGray':
  9309. case 'G':
  9310. return 'DeviceGrayCS';
  9311. case 'DeviceRGB':
  9312. case 'RGB':
  9313. return 'DeviceRgbCS';
  9314. case 'DeviceCMYK':
  9315. case 'CMYK':
  9316. return 'DeviceCmykCS';
  9317. case 'CalGray':
  9318. params = xref.fetchIfRef(cs[1]);
  9319. whitePoint = params.getArray('WhitePoint');
  9320. blackPoint = params.getArray('BlackPoint');
  9321. gamma = params.get('Gamma');
  9322. return [
  9323. 'CalGrayCS',
  9324. whitePoint,
  9325. blackPoint,
  9326. gamma
  9327. ];
  9328. case 'CalRGB':
  9329. params = xref.fetchIfRef(cs[1]);
  9330. whitePoint = params.getArray('WhitePoint');
  9331. blackPoint = params.getArray('BlackPoint');
  9332. gamma = params.getArray('Gamma');
  9333. var matrix = params.getArray('Matrix');
  9334. return [
  9335. 'CalRGBCS',
  9336. whitePoint,
  9337. blackPoint,
  9338. gamma,
  9339. matrix
  9340. ];
  9341. case 'ICCBased':
  9342. var stream = xref.fetchIfRef(cs[1]);
  9343. var dict = stream.dict;
  9344. numComps = dict.get('N');
  9345. alt = dict.get('Alternate');
  9346. if (alt) {
  9347. var altIR = ColorSpace.parseToIR(alt, xref, res);
  9348. var altCS = ColorSpace.fromIR(altIR);
  9349. if (altCS.numComps === numComps) {
  9350. return altIR;
  9351. }
  9352. warn('ICCBased color space: Ignoring incorrect /Alternate entry.');
  9353. }
  9354. if (numComps === 1) {
  9355. return 'DeviceGrayCS';
  9356. } else if (numComps === 3) {
  9357. return 'DeviceRgbCS';
  9358. } else if (numComps === 4) {
  9359. return 'DeviceCmykCS';
  9360. }
  9361. break;
  9362. case 'Pattern':
  9363. var basePatternCS = cs[1] || null;
  9364. if (basePatternCS) {
  9365. basePatternCS = ColorSpace.parseToIR(basePatternCS, xref, res);
  9366. }
  9367. return [
  9368. 'PatternCS',
  9369. basePatternCS
  9370. ];
  9371. case 'Indexed':
  9372. case 'I':
  9373. var baseIndexedCS = ColorSpace.parseToIR(cs[1], xref, res);
  9374. var hiVal = xref.fetchIfRef(cs[2]) + 1;
  9375. var lookup = xref.fetchIfRef(cs[3]);
  9376. if (isStream(lookup)) {
  9377. lookup = lookup.getBytes();
  9378. }
  9379. return [
  9380. 'IndexedCS',
  9381. baseIndexedCS,
  9382. hiVal,
  9383. lookup
  9384. ];
  9385. case 'Separation':
  9386. case 'DeviceN':
  9387. var name = xref.fetchIfRef(cs[1]);
  9388. numComps = isArray(name) ? name.length : 1;
  9389. alt = ColorSpace.parseToIR(cs[2], xref, res);
  9390. var tintFnIR = PDFFunction.getIR(xref, xref.fetchIfRef(cs[3]));
  9391. return [
  9392. 'AlternateCS',
  9393. numComps,
  9394. alt,
  9395. tintFnIR
  9396. ];
  9397. case 'Lab':
  9398. params = xref.fetchIfRef(cs[1]);
  9399. whitePoint = params.getArray('WhitePoint');
  9400. blackPoint = params.getArray('BlackPoint');
  9401. var range = params.getArray('Range');
  9402. return [
  9403. 'LabCS',
  9404. whitePoint,
  9405. blackPoint,
  9406. range
  9407. ];
  9408. default:
  9409. error('unimplemented color space object "' + mode + '"');
  9410. }
  9411. } else {
  9412. error('unrecognized color space object: "' + cs + '"');
  9413. }
  9414. return null;
  9415. };
  9416. ColorSpace.isDefaultDecode = function ColorSpace_isDefaultDecode(decode, n) {
  9417. if (!isArray(decode)) {
  9418. return true;
  9419. }
  9420. if (n * 2 !== decode.length) {
  9421. warn('The decode map is not the correct length');
  9422. return true;
  9423. }
  9424. for (var i = 0, ii = decode.length; i < ii; i += 2) {
  9425. if (decode[i] !== 0 || decode[i + 1] !== 1) {
  9426. return false;
  9427. }
  9428. }
  9429. return true;
  9430. };
  9431. ColorSpace.singletons = {
  9432. get gray() {
  9433. return shadow(this, 'gray', new DeviceGrayCS());
  9434. },
  9435. get rgb() {
  9436. return shadow(this, 'rgb', new DeviceRgbCS());
  9437. },
  9438. get cmyk() {
  9439. return shadow(this, 'cmyk', new DeviceCmykCS());
  9440. }
  9441. };
  9442. return ColorSpace;
  9443. }();
  9444. var AlternateCS = function AlternateCSClosure() {
  9445. function AlternateCS(numComps, base, tintFn) {
  9446. this.name = 'Alternate';
  9447. this.numComps = numComps;
  9448. this.defaultColor = new Float32Array(numComps);
  9449. for (var i = 0; i < numComps; ++i) {
  9450. this.defaultColor[i] = 1;
  9451. }
  9452. this.base = base;
  9453. this.tintFn = tintFn;
  9454. this.tmpBuf = new Float32Array(base.numComps);
  9455. }
  9456. AlternateCS.prototype = {
  9457. getRgb: ColorSpace.prototype.getRgb,
  9458. getRgbItem: function AlternateCS_getRgbItem(src, srcOffset, dest, destOffset) {
  9459. var tmpBuf = this.tmpBuf;
  9460. this.tintFn(src, srcOffset, tmpBuf, 0);
  9461. this.base.getRgbItem(tmpBuf, 0, dest, destOffset);
  9462. },
  9463. getRgbBuffer: function AlternateCS_getRgbBuffer(src, srcOffset, count, dest, destOffset, bits, alpha01) {
  9464. var tintFn = this.tintFn;
  9465. var base = this.base;
  9466. var scale = 1 / ((1 << bits) - 1);
  9467. var baseNumComps = base.numComps;
  9468. var usesZeroToOneRange = base.usesZeroToOneRange;
  9469. var isPassthrough = (base.isPassthrough(8) || !usesZeroToOneRange) && alpha01 === 0;
  9470. var pos = isPassthrough ? destOffset : 0;
  9471. var baseBuf = isPassthrough ? dest : new Uint8Array(baseNumComps * count);
  9472. var numComps = this.numComps;
  9473. var scaled = new Float32Array(numComps);
  9474. var tinted = new Float32Array(baseNumComps);
  9475. var i, j;
  9476. for (i = 0; i < count; i++) {
  9477. for (j = 0; j < numComps; j++) {
  9478. scaled[j] = src[srcOffset++] * scale;
  9479. }
  9480. tintFn(scaled, 0, tinted, 0);
  9481. if (usesZeroToOneRange) {
  9482. for (j = 0; j < baseNumComps; j++) {
  9483. baseBuf[pos++] = tinted[j] * 255;
  9484. }
  9485. } else {
  9486. base.getRgbItem(tinted, 0, baseBuf, pos);
  9487. pos += baseNumComps;
  9488. }
  9489. }
  9490. if (!isPassthrough) {
  9491. base.getRgbBuffer(baseBuf, 0, count, dest, destOffset, 8, alpha01);
  9492. }
  9493. },
  9494. getOutputLength: function AlternateCS_getOutputLength(inputLength, alpha01) {
  9495. return this.base.getOutputLength(inputLength * this.base.numComps / this.numComps, alpha01);
  9496. },
  9497. isPassthrough: ColorSpace.prototype.isPassthrough,
  9498. fillRgb: ColorSpace.prototype.fillRgb,
  9499. isDefaultDecode: function AlternateCS_isDefaultDecode(decodeMap) {
  9500. return ColorSpace.isDefaultDecode(decodeMap, this.numComps);
  9501. },
  9502. usesZeroToOneRange: true
  9503. };
  9504. return AlternateCS;
  9505. }();
  9506. var PatternCS = function PatternCSClosure() {
  9507. function PatternCS(baseCS) {
  9508. this.name = 'Pattern';
  9509. this.base = baseCS;
  9510. }
  9511. PatternCS.prototype = {};
  9512. return PatternCS;
  9513. }();
  9514. var IndexedCS = function IndexedCSClosure() {
  9515. function IndexedCS(base, highVal, lookup) {
  9516. this.name = 'Indexed';
  9517. this.numComps = 1;
  9518. this.defaultColor = new Uint8Array(this.numComps);
  9519. this.base = base;
  9520. this.highVal = highVal;
  9521. var baseNumComps = base.numComps;
  9522. var length = baseNumComps * highVal;
  9523. if (isStream(lookup)) {
  9524. this.lookup = new Uint8Array(length);
  9525. var bytes = lookup.getBytes(length);
  9526. this.lookup.set(bytes);
  9527. } else if (isString(lookup)) {
  9528. this.lookup = new Uint8Array(length);
  9529. for (var i = 0; i < length; ++i) {
  9530. this.lookup[i] = lookup.charCodeAt(i);
  9531. }
  9532. } else if (lookup instanceof Uint8Array || lookup instanceof Array) {
  9533. this.lookup = lookup;
  9534. } else {
  9535. error('Unrecognized lookup table: ' + lookup);
  9536. }
  9537. }
  9538. IndexedCS.prototype = {
  9539. getRgb: ColorSpace.prototype.getRgb,
  9540. getRgbItem: function IndexedCS_getRgbItem(src, srcOffset, dest, destOffset) {
  9541. var numComps = this.base.numComps;
  9542. var start = src[srcOffset] * numComps;
  9543. this.base.getRgbItem(this.lookup, start, dest, destOffset);
  9544. },
  9545. getRgbBuffer: function IndexedCS_getRgbBuffer(src, srcOffset, count, dest, destOffset, bits, alpha01) {
  9546. var base = this.base;
  9547. var numComps = base.numComps;
  9548. var outputDelta = base.getOutputLength(numComps, alpha01);
  9549. var lookup = this.lookup;
  9550. for (var i = 0; i < count; ++i) {
  9551. var lookupPos = src[srcOffset++] * numComps;
  9552. base.getRgbBuffer(lookup, lookupPos, 1, dest, destOffset, 8, alpha01);
  9553. destOffset += outputDelta;
  9554. }
  9555. },
  9556. getOutputLength: function IndexedCS_getOutputLength(inputLength, alpha01) {
  9557. return this.base.getOutputLength(inputLength * this.base.numComps, alpha01);
  9558. },
  9559. isPassthrough: ColorSpace.prototype.isPassthrough,
  9560. fillRgb: ColorSpace.prototype.fillRgb,
  9561. isDefaultDecode: function IndexedCS_isDefaultDecode(decodeMap) {
  9562. return true;
  9563. },
  9564. usesZeroToOneRange: true
  9565. };
  9566. return IndexedCS;
  9567. }();
  9568. var DeviceGrayCS = function DeviceGrayCSClosure() {
  9569. function DeviceGrayCS() {
  9570. this.name = 'DeviceGray';
  9571. this.numComps = 1;
  9572. this.defaultColor = new Float32Array(this.numComps);
  9573. }
  9574. DeviceGrayCS.prototype = {
  9575. getRgb: ColorSpace.prototype.getRgb,
  9576. getRgbItem: function DeviceGrayCS_getRgbItem(src, srcOffset, dest, destOffset) {
  9577. var c = src[srcOffset] * 255 | 0;
  9578. c = c < 0 ? 0 : c > 255 ? 255 : c;
  9579. dest[destOffset] = dest[destOffset + 1] = dest[destOffset + 2] = c;
  9580. },
  9581. getRgbBuffer: function DeviceGrayCS_getRgbBuffer(src, srcOffset, count, dest, destOffset, bits, alpha01) {
  9582. var scale = 255 / ((1 << bits) - 1);
  9583. var j = srcOffset, q = destOffset;
  9584. for (var i = 0; i < count; ++i) {
  9585. var c = scale * src[j++] | 0;
  9586. dest[q++] = c;
  9587. dest[q++] = c;
  9588. dest[q++] = c;
  9589. q += alpha01;
  9590. }
  9591. },
  9592. getOutputLength: function DeviceGrayCS_getOutputLength(inputLength, alpha01) {
  9593. return inputLength * (3 + alpha01);
  9594. },
  9595. isPassthrough: ColorSpace.prototype.isPassthrough,
  9596. fillRgb: ColorSpace.prototype.fillRgb,
  9597. isDefaultDecode: function DeviceGrayCS_isDefaultDecode(decodeMap) {
  9598. return ColorSpace.isDefaultDecode(decodeMap, this.numComps);
  9599. },
  9600. usesZeroToOneRange: true
  9601. };
  9602. return DeviceGrayCS;
  9603. }();
  9604. var DeviceRgbCS = function DeviceRgbCSClosure() {
  9605. function DeviceRgbCS() {
  9606. this.name = 'DeviceRGB';
  9607. this.numComps = 3;
  9608. this.defaultColor = new Float32Array(this.numComps);
  9609. }
  9610. DeviceRgbCS.prototype = {
  9611. getRgb: ColorSpace.prototype.getRgb,
  9612. getRgbItem: function DeviceRgbCS_getRgbItem(src, srcOffset, dest, destOffset) {
  9613. var r = src[srcOffset] * 255 | 0;
  9614. var g = src[srcOffset + 1] * 255 | 0;
  9615. var b = src[srcOffset + 2] * 255 | 0;
  9616. dest[destOffset] = r < 0 ? 0 : r > 255 ? 255 : r;
  9617. dest[destOffset + 1] = g < 0 ? 0 : g > 255 ? 255 : g;
  9618. dest[destOffset + 2] = b < 0 ? 0 : b > 255 ? 255 : b;
  9619. },
  9620. getRgbBuffer: function DeviceRgbCS_getRgbBuffer(src, srcOffset, count, dest, destOffset, bits, alpha01) {
  9621. if (bits === 8 && alpha01 === 0) {
  9622. dest.set(src.subarray(srcOffset, srcOffset + count * 3), destOffset);
  9623. return;
  9624. }
  9625. var scale = 255 / ((1 << bits) - 1);
  9626. var j = srcOffset, q = destOffset;
  9627. for (var i = 0; i < count; ++i) {
  9628. dest[q++] = scale * src[j++] | 0;
  9629. dest[q++] = scale * src[j++] | 0;
  9630. dest[q++] = scale * src[j++] | 0;
  9631. q += alpha01;
  9632. }
  9633. },
  9634. getOutputLength: function DeviceRgbCS_getOutputLength(inputLength, alpha01) {
  9635. return inputLength * (3 + alpha01) / 3 | 0;
  9636. },
  9637. isPassthrough: function DeviceRgbCS_isPassthrough(bits) {
  9638. return bits === 8;
  9639. },
  9640. fillRgb: ColorSpace.prototype.fillRgb,
  9641. isDefaultDecode: function DeviceRgbCS_isDefaultDecode(decodeMap) {
  9642. return ColorSpace.isDefaultDecode(decodeMap, this.numComps);
  9643. },
  9644. usesZeroToOneRange: true
  9645. };
  9646. return DeviceRgbCS;
  9647. }();
  9648. var DeviceCmykCS = function DeviceCmykCSClosure() {
  9649. function convertToRgb(src, srcOffset, srcScale, dest, destOffset) {
  9650. var c = src[srcOffset + 0] * srcScale;
  9651. var m = src[srcOffset + 1] * srcScale;
  9652. var y = src[srcOffset + 2] * srcScale;
  9653. var k = src[srcOffset + 3] * srcScale;
  9654. var r = 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) + 255 | 0;
  9655. var g = 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) + 255 | 0;
  9656. var b = 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) + 255 | 0;
  9657. dest[destOffset] = r > 255 ? 255 : r < 0 ? 0 : r;
  9658. dest[destOffset + 1] = g > 255 ? 255 : g < 0 ? 0 : g;
  9659. dest[destOffset + 2] = b > 255 ? 255 : b < 0 ? 0 : b;
  9660. }
  9661. function DeviceCmykCS() {
  9662. this.name = 'DeviceCMYK';
  9663. this.numComps = 4;
  9664. this.defaultColor = new Float32Array(this.numComps);
  9665. this.defaultColor[3] = 1;
  9666. }
  9667. DeviceCmykCS.prototype = {
  9668. getRgb: ColorSpace.prototype.getRgb,
  9669. getRgbItem: function DeviceCmykCS_getRgbItem(src, srcOffset, dest, destOffset) {
  9670. convertToRgb(src, srcOffset, 1, dest, destOffset);
  9671. },
  9672. getRgbBuffer: function DeviceCmykCS_getRgbBuffer(src, srcOffset, count, dest, destOffset, bits, alpha01) {
  9673. var scale = 1 / ((1 << bits) - 1);
  9674. for (var i = 0; i < count; i++) {
  9675. convertToRgb(src, srcOffset, scale, dest, destOffset);
  9676. srcOffset += 4;
  9677. destOffset += 3 + alpha01;
  9678. }
  9679. },
  9680. getOutputLength: function DeviceCmykCS_getOutputLength(inputLength, alpha01) {
  9681. return inputLength / 4 * (3 + alpha01) | 0;
  9682. },
  9683. isPassthrough: ColorSpace.prototype.isPassthrough,
  9684. fillRgb: ColorSpace.prototype.fillRgb,
  9685. isDefaultDecode: function DeviceCmykCS_isDefaultDecode(decodeMap) {
  9686. return ColorSpace.isDefaultDecode(decodeMap, this.numComps);
  9687. },
  9688. usesZeroToOneRange: true
  9689. };
  9690. return DeviceCmykCS;
  9691. }();
  9692. var CalGrayCS = function CalGrayCSClosure() {
  9693. function CalGrayCS(whitePoint, blackPoint, gamma) {
  9694. this.name = 'CalGray';
  9695. this.numComps = 1;
  9696. this.defaultColor = new Float32Array(this.numComps);
  9697. if (!whitePoint) {
  9698. error('WhitePoint missing - required for color space CalGray');
  9699. }
  9700. blackPoint = blackPoint || [
  9701. 0,
  9702. 0,
  9703. 0
  9704. ];
  9705. gamma = gamma || 1;
  9706. this.XW = whitePoint[0];
  9707. this.YW = whitePoint[1];
  9708. this.ZW = whitePoint[2];
  9709. this.XB = blackPoint[0];
  9710. this.YB = blackPoint[1];
  9711. this.ZB = blackPoint[2];
  9712. this.G = gamma;
  9713. if (this.XW < 0 || this.ZW < 0 || this.YW !== 1) {
  9714. error('Invalid WhitePoint components for ' + this.name + ', no fallback available');
  9715. }
  9716. if (this.XB < 0 || this.YB < 0 || this.ZB < 0) {
  9717. info('Invalid BlackPoint for ' + this.name + ', falling back to default');
  9718. this.XB = this.YB = this.ZB = 0;
  9719. }
  9720. if (this.XB !== 0 || this.YB !== 0 || this.ZB !== 0) {
  9721. warn(this.name + ', BlackPoint: XB: ' + this.XB + ', YB: ' + this.YB + ', ZB: ' + this.ZB + ', only default values are supported.');
  9722. }
  9723. if (this.G < 1) {
  9724. info('Invalid Gamma: ' + this.G + ' for ' + this.name + ', falling back to default');
  9725. this.G = 1;
  9726. }
  9727. }
  9728. function convertToRgb(cs, src, srcOffset, dest, destOffset, scale) {
  9729. var A = src[srcOffset] * scale;
  9730. var AG = Math.pow(A, cs.G);
  9731. var L = cs.YW * AG;
  9732. var val = Math.max(295.8 * Math.pow(L, 0.333333333333333333) - 40.8, 0) | 0;
  9733. dest[destOffset] = val;
  9734. dest[destOffset + 1] = val;
  9735. dest[destOffset + 2] = val;
  9736. }
  9737. CalGrayCS.prototype = {
  9738. getRgb: ColorSpace.prototype.getRgb,
  9739. getRgbItem: function CalGrayCS_getRgbItem(src, srcOffset, dest, destOffset) {
  9740. convertToRgb(this, src, srcOffset, dest, destOffset, 1);
  9741. },
  9742. getRgbBuffer: function CalGrayCS_getRgbBuffer(src, srcOffset, count, dest, destOffset, bits, alpha01) {
  9743. var scale = 1 / ((1 << bits) - 1);
  9744. for (var i = 0; i < count; ++i) {
  9745. convertToRgb(this, src, srcOffset, dest, destOffset, scale);
  9746. srcOffset += 1;
  9747. destOffset += 3 + alpha01;
  9748. }
  9749. },
  9750. getOutputLength: function CalGrayCS_getOutputLength(inputLength, alpha01) {
  9751. return inputLength * (3 + alpha01);
  9752. },
  9753. isPassthrough: ColorSpace.prototype.isPassthrough,
  9754. fillRgb: ColorSpace.prototype.fillRgb,
  9755. isDefaultDecode: function CalGrayCS_isDefaultDecode(decodeMap) {
  9756. return ColorSpace.isDefaultDecode(decodeMap, this.numComps);
  9757. },
  9758. usesZeroToOneRange: true
  9759. };
  9760. return CalGrayCS;
  9761. }();
  9762. var CalRGBCS = function CalRGBCSClosure() {
  9763. var BRADFORD_SCALE_MATRIX = new Float32Array([
  9764. 0.8951,
  9765. 0.2664,
  9766. -0.1614,
  9767. -0.7502,
  9768. 1.7135,
  9769. 0.0367,
  9770. 0.0389,
  9771. -0.0685,
  9772. 1.0296
  9773. ]);
  9774. var BRADFORD_SCALE_INVERSE_MATRIX = new Float32Array([
  9775. 0.9869929,
  9776. -0.1470543,
  9777. 0.1599627,
  9778. 0.4323053,
  9779. 0.5183603,
  9780. 0.0492912,
  9781. -0.0085287,
  9782. 0.0400428,
  9783. 0.9684867
  9784. ]);
  9785. var SRGB_D65_XYZ_TO_RGB_MATRIX = new Float32Array([
  9786. 3.2404542,
  9787. -1.5371385,
  9788. -0.4985314,
  9789. -0.9692660,
  9790. 1.8760108,
  9791. 0.0415560,
  9792. 0.0556434,
  9793. -0.2040259,
  9794. 1.0572252
  9795. ]);
  9796. var FLAT_WHITEPOINT_MATRIX = new Float32Array([
  9797. 1,
  9798. 1,
  9799. 1
  9800. ]);
  9801. var tempNormalizeMatrix = new Float32Array(3);
  9802. var tempConvertMatrix1 = new Float32Array(3);
  9803. var tempConvertMatrix2 = new Float32Array(3);
  9804. var DECODE_L_CONSTANT = Math.pow((8 + 16) / 116, 3) / 8.0;
  9805. function CalRGBCS(whitePoint, blackPoint, gamma, matrix) {
  9806. this.name = 'CalRGB';
  9807. this.numComps = 3;
  9808. this.defaultColor = new Float32Array(this.numComps);
  9809. if (!whitePoint) {
  9810. error('WhitePoint missing - required for color space CalRGB');
  9811. }
  9812. blackPoint = blackPoint || new Float32Array(3);
  9813. gamma = gamma || new Float32Array([
  9814. 1,
  9815. 1,
  9816. 1
  9817. ]);
  9818. matrix = matrix || new Float32Array([
  9819. 1,
  9820. 0,
  9821. 0,
  9822. 0,
  9823. 1,
  9824. 0,
  9825. 0,
  9826. 0,
  9827. 1
  9828. ]);
  9829. var XW = whitePoint[0];
  9830. var YW = whitePoint[1];
  9831. var ZW = whitePoint[2];
  9832. this.whitePoint = whitePoint;
  9833. var XB = blackPoint[0];
  9834. var YB = blackPoint[1];
  9835. var ZB = blackPoint[2];
  9836. this.blackPoint = blackPoint;
  9837. this.GR = gamma[0];
  9838. this.GG = gamma[1];
  9839. this.GB = gamma[2];
  9840. this.MXA = matrix[0];
  9841. this.MYA = matrix[1];
  9842. this.MZA = matrix[2];
  9843. this.MXB = matrix[3];
  9844. this.MYB = matrix[4];
  9845. this.MZB = matrix[5];
  9846. this.MXC = matrix[6];
  9847. this.MYC = matrix[7];
  9848. this.MZC = matrix[8];
  9849. if (XW < 0 || ZW < 0 || YW !== 1) {
  9850. error('Invalid WhitePoint components for ' + this.name + ', no fallback available');
  9851. }
  9852. if (XB < 0 || YB < 0 || ZB < 0) {
  9853. info('Invalid BlackPoint for ' + this.name + ' [' + XB + ', ' + YB + ', ' + ZB + '], falling back to default');
  9854. this.blackPoint = new Float32Array(3);
  9855. }
  9856. if (this.GR < 0 || this.GG < 0 || this.GB < 0) {
  9857. info('Invalid Gamma [' + this.GR + ', ' + this.GG + ', ' + this.GB + '] for ' + this.name + ', falling back to default');
  9858. this.GR = this.GG = this.GB = 1;
  9859. }
  9860. if (this.MXA < 0 || this.MYA < 0 || this.MZA < 0 || this.MXB < 0 || this.MYB < 0 || this.MZB < 0 || this.MXC < 0 || this.MYC < 0 || this.MZC < 0) {
  9861. info('Invalid Matrix for ' + this.name + ' [' + this.MXA + ', ' + this.MYA + ', ' + this.MZA + this.MXB + ', ' + this.MYB + ', ' + this.MZB + this.MXC + ', ' + this.MYC + ', ' + this.MZC + '], falling back to default');
  9862. this.MXA = this.MYB = this.MZC = 1;
  9863. this.MXB = this.MYA = this.MZA = this.MXC = this.MYC = this.MZB = 0;
  9864. }
  9865. }
  9866. function matrixProduct(a, b, result) {
  9867. result[0] = a[0] * b[0] + a[1] * b[1] + a[2] * b[2];
  9868. result[1] = a[3] * b[0] + a[4] * b[1] + a[5] * b[2];
  9869. result[2] = a[6] * b[0] + a[7] * b[1] + a[8] * b[2];
  9870. }
  9871. function convertToFlat(sourceWhitePoint, LMS, result) {
  9872. result[0] = LMS[0] * 1 / sourceWhitePoint[0];
  9873. result[1] = LMS[1] * 1 / sourceWhitePoint[1];
  9874. result[2] = LMS[2] * 1 / sourceWhitePoint[2];
  9875. }
  9876. function convertToD65(sourceWhitePoint, LMS, result) {
  9877. var D65X = 0.95047;
  9878. var D65Y = 1;
  9879. var D65Z = 1.08883;
  9880. result[0] = LMS[0] * D65X / sourceWhitePoint[0];
  9881. result[1] = LMS[1] * D65Y / sourceWhitePoint[1];
  9882. result[2] = LMS[2] * D65Z / sourceWhitePoint[2];
  9883. }
  9884. function sRGBTransferFunction(color) {
  9885. if (color <= 0.0031308) {
  9886. return adjustToRange(0, 1, 12.92 * color);
  9887. }
  9888. return adjustToRange(0, 1, (1 + 0.055) * Math.pow(color, 1 / 2.4) - 0.055);
  9889. }
  9890. function adjustToRange(min, max, value) {
  9891. return Math.max(min, Math.min(max, value));
  9892. }
  9893. function decodeL(L) {
  9894. if (L < 0) {
  9895. return -decodeL(-L);
  9896. }
  9897. if (L > 8.0) {
  9898. return Math.pow((L + 16) / 116, 3);
  9899. }
  9900. return L * DECODE_L_CONSTANT;
  9901. }
  9902. function compensateBlackPoint(sourceBlackPoint, XYZ_Flat, result) {
  9903. if (sourceBlackPoint[0] === 0 && sourceBlackPoint[1] === 0 && sourceBlackPoint[2] === 0) {
  9904. result[0] = XYZ_Flat[0];
  9905. result[1] = XYZ_Flat[1];
  9906. result[2] = XYZ_Flat[2];
  9907. return;
  9908. }
  9909. var zeroDecodeL = decodeL(0);
  9910. var X_DST = zeroDecodeL;
  9911. var X_SRC = decodeL(sourceBlackPoint[0]);
  9912. var Y_DST = zeroDecodeL;
  9913. var Y_SRC = decodeL(sourceBlackPoint[1]);
  9914. var Z_DST = zeroDecodeL;
  9915. var Z_SRC = decodeL(sourceBlackPoint[2]);
  9916. var X_Scale = (1 - X_DST) / (1 - X_SRC);
  9917. var X_Offset = 1 - X_Scale;
  9918. var Y_Scale = (1 - Y_DST) / (1 - Y_SRC);
  9919. var Y_Offset = 1 - Y_Scale;
  9920. var Z_Scale = (1 - Z_DST) / (1 - Z_SRC);
  9921. var Z_Offset = 1 - Z_Scale;
  9922. result[0] = XYZ_Flat[0] * X_Scale + X_Offset;
  9923. result[1] = XYZ_Flat[1] * Y_Scale + Y_Offset;
  9924. result[2] = XYZ_Flat[2] * Z_Scale + Z_Offset;
  9925. }
  9926. function normalizeWhitePointToFlat(sourceWhitePoint, XYZ_In, result) {
  9927. if (sourceWhitePoint[0] === 1 && sourceWhitePoint[2] === 1) {
  9928. result[0] = XYZ_In[0];
  9929. result[1] = XYZ_In[1];
  9930. result[2] = XYZ_In[2];
  9931. return;
  9932. }
  9933. var LMS = result;
  9934. matrixProduct(BRADFORD_SCALE_MATRIX, XYZ_In, LMS);
  9935. var LMS_Flat = tempNormalizeMatrix;
  9936. convertToFlat(sourceWhitePoint, LMS, LMS_Flat);
  9937. matrixProduct(BRADFORD_SCALE_INVERSE_MATRIX, LMS_Flat, result);
  9938. }
  9939. function normalizeWhitePointToD65(sourceWhitePoint, XYZ_In, result) {
  9940. var LMS = result;
  9941. matrixProduct(BRADFORD_SCALE_MATRIX, XYZ_In, LMS);
  9942. var LMS_D65 = tempNormalizeMatrix;
  9943. convertToD65(sourceWhitePoint, LMS, LMS_D65);
  9944. matrixProduct(BRADFORD_SCALE_INVERSE_MATRIX, LMS_D65, result);
  9945. }
  9946. function convertToRgb(cs, src, srcOffset, dest, destOffset, scale) {
  9947. var A = adjustToRange(0, 1, src[srcOffset] * scale);
  9948. var B = adjustToRange(0, 1, src[srcOffset + 1] * scale);
  9949. var C = adjustToRange(0, 1, src[srcOffset + 2] * scale);
  9950. var AGR = Math.pow(A, cs.GR);
  9951. var BGG = Math.pow(B, cs.GG);
  9952. var CGB = Math.pow(C, cs.GB);
  9953. var X = cs.MXA * AGR + cs.MXB * BGG + cs.MXC * CGB;
  9954. var Y = cs.MYA * AGR + cs.MYB * BGG + cs.MYC * CGB;
  9955. var Z = cs.MZA * AGR + cs.MZB * BGG + cs.MZC * CGB;
  9956. var XYZ = tempConvertMatrix1;
  9957. XYZ[0] = X;
  9958. XYZ[1] = Y;
  9959. XYZ[2] = Z;
  9960. var XYZ_Flat = tempConvertMatrix2;
  9961. normalizeWhitePointToFlat(cs.whitePoint, XYZ, XYZ_Flat);
  9962. var XYZ_Black = tempConvertMatrix1;
  9963. compensateBlackPoint(cs.blackPoint, XYZ_Flat, XYZ_Black);
  9964. var XYZ_D65 = tempConvertMatrix2;
  9965. normalizeWhitePointToD65(FLAT_WHITEPOINT_MATRIX, XYZ_Black, XYZ_D65);
  9966. var SRGB = tempConvertMatrix1;
  9967. matrixProduct(SRGB_D65_XYZ_TO_RGB_MATRIX, XYZ_D65, SRGB);
  9968. var sR = sRGBTransferFunction(SRGB[0]);
  9969. var sG = sRGBTransferFunction(SRGB[1]);
  9970. var sB = sRGBTransferFunction(SRGB[2]);
  9971. dest[destOffset] = Math.round(sR * 255);
  9972. dest[destOffset + 1] = Math.round(sG * 255);
  9973. dest[destOffset + 2] = Math.round(sB * 255);
  9974. }
  9975. CalRGBCS.prototype = {
  9976. getRgb: function CalRGBCS_getRgb(src, srcOffset) {
  9977. var rgb = new Uint8Array(3);
  9978. this.getRgbItem(src, srcOffset, rgb, 0);
  9979. return rgb;
  9980. },
  9981. getRgbItem: function CalRGBCS_getRgbItem(src, srcOffset, dest, destOffset) {
  9982. convertToRgb(this, src, srcOffset, dest, destOffset, 1);
  9983. },
  9984. getRgbBuffer: function CalRGBCS_getRgbBuffer(src, srcOffset, count, dest, destOffset, bits, alpha01) {
  9985. var scale = 1 / ((1 << bits) - 1);
  9986. for (var i = 0; i < count; ++i) {
  9987. convertToRgb(this, src, srcOffset, dest, destOffset, scale);
  9988. srcOffset += 3;
  9989. destOffset += 3 + alpha01;
  9990. }
  9991. },
  9992. getOutputLength: function CalRGBCS_getOutputLength(inputLength, alpha01) {
  9993. return inputLength * (3 + alpha01) / 3 | 0;
  9994. },
  9995. isPassthrough: ColorSpace.prototype.isPassthrough,
  9996. fillRgb: ColorSpace.prototype.fillRgb,
  9997. isDefaultDecode: function CalRGBCS_isDefaultDecode(decodeMap) {
  9998. return ColorSpace.isDefaultDecode(decodeMap, this.numComps);
  9999. },
  10000. usesZeroToOneRange: true
  10001. };
  10002. return CalRGBCS;
  10003. }();
  10004. var LabCS = function LabCSClosure() {
  10005. function LabCS(whitePoint, blackPoint, range) {
  10006. this.name = 'Lab';
  10007. this.numComps = 3;
  10008. this.defaultColor = new Float32Array(this.numComps);
  10009. if (!whitePoint) {
  10010. error('WhitePoint missing - required for color space Lab');
  10011. }
  10012. blackPoint = blackPoint || [
  10013. 0,
  10014. 0,
  10015. 0
  10016. ];
  10017. range = range || [
  10018. -100,
  10019. 100,
  10020. -100,
  10021. 100
  10022. ];
  10023. this.XW = whitePoint[0];
  10024. this.YW = whitePoint[1];
  10025. this.ZW = whitePoint[2];
  10026. this.amin = range[0];
  10027. this.amax = range[1];
  10028. this.bmin = range[2];
  10029. this.bmax = range[3];
  10030. this.XB = blackPoint[0];
  10031. this.YB = blackPoint[1];
  10032. this.ZB = blackPoint[2];
  10033. if (this.XW < 0 || this.ZW < 0 || this.YW !== 1) {
  10034. error('Invalid WhitePoint components, no fallback available');
  10035. }
  10036. if (this.XB < 0 || this.YB < 0 || this.ZB < 0) {
  10037. info('Invalid BlackPoint, falling back to default');
  10038. this.XB = this.YB = this.ZB = 0;
  10039. }
  10040. if (this.amin > this.amax || this.bmin > this.bmax) {
  10041. info('Invalid Range, falling back to defaults');
  10042. this.amin = -100;
  10043. this.amax = 100;
  10044. this.bmin = -100;
  10045. this.bmax = 100;
  10046. }
  10047. }
  10048. function fn_g(x) {
  10049. var result;
  10050. if (x >= 6 / 29) {
  10051. result = x * x * x;
  10052. } else {
  10053. result = 108 / 841 * (x - 4 / 29);
  10054. }
  10055. return result;
  10056. }
  10057. function decode(value, high1, low2, high2) {
  10058. return low2 + value * (high2 - low2) / high1;
  10059. }
  10060. function convertToRgb(cs, src, srcOffset, maxVal, dest, destOffset) {
  10061. var Ls = src[srcOffset];
  10062. var as = src[srcOffset + 1];
  10063. var bs = src[srcOffset + 2];
  10064. if (maxVal !== false) {
  10065. Ls = decode(Ls, maxVal, 0, 100);
  10066. as = decode(as, maxVal, cs.amin, cs.amax);
  10067. bs = decode(bs, maxVal, cs.bmin, cs.bmax);
  10068. }
  10069. as = as > cs.amax ? cs.amax : as < cs.amin ? cs.amin : as;
  10070. bs = bs > cs.bmax ? cs.bmax : bs < cs.bmin ? cs.bmin : bs;
  10071. var M = (Ls + 16) / 116;
  10072. var L = M + as / 500;
  10073. var N = M - bs / 200;
  10074. var X = cs.XW * fn_g(L);
  10075. var Y = cs.YW * fn_g(M);
  10076. var Z = cs.ZW * fn_g(N);
  10077. var r, g, b;
  10078. if (cs.ZW < 1) {
  10079. r = X * 3.1339 + Y * -1.6170 + Z * -0.4906;
  10080. g = X * -0.9785 + Y * 1.9160 + Z * 0.0333;
  10081. b = X * 0.0720 + Y * -0.2290 + Z * 1.4057;
  10082. } else {
  10083. r = X * 3.2406 + Y * -1.5372 + Z * -0.4986;
  10084. g = X * -0.9689 + Y * 1.8758 + Z * 0.0415;
  10085. b = X * 0.0557 + Y * -0.2040 + Z * 1.0570;
  10086. }
  10087. dest[destOffset] = r <= 0 ? 0 : r >= 1 ? 255 : Math.sqrt(r) * 255 | 0;
  10088. dest[destOffset + 1] = g <= 0 ? 0 : g >= 1 ? 255 : Math.sqrt(g) * 255 | 0;
  10089. dest[destOffset + 2] = b <= 0 ? 0 : b >= 1 ? 255 : Math.sqrt(b) * 255 | 0;
  10090. }
  10091. LabCS.prototype = {
  10092. getRgb: ColorSpace.prototype.getRgb,
  10093. getRgbItem: function LabCS_getRgbItem(src, srcOffset, dest, destOffset) {
  10094. convertToRgb(this, src, srcOffset, false, dest, destOffset);
  10095. },
  10096. getRgbBuffer: function LabCS_getRgbBuffer(src, srcOffset, count, dest, destOffset, bits, alpha01) {
  10097. var maxVal = (1 << bits) - 1;
  10098. for (var i = 0; i < count; i++) {
  10099. convertToRgb(this, src, srcOffset, maxVal, dest, destOffset);
  10100. srcOffset += 3;
  10101. destOffset += 3 + alpha01;
  10102. }
  10103. },
  10104. getOutputLength: function LabCS_getOutputLength(inputLength, alpha01) {
  10105. return inputLength * (3 + alpha01) / 3 | 0;
  10106. },
  10107. isPassthrough: ColorSpace.prototype.isPassthrough,
  10108. fillRgb: ColorSpace.prototype.fillRgb,
  10109. isDefaultDecode: function LabCS_isDefaultDecode(decodeMap) {
  10110. return true;
  10111. },
  10112. usesZeroToOneRange: false
  10113. };
  10114. return LabCS;
  10115. }();
  10116. exports.ColorSpace = ColorSpace;
  10117. /***/ }),
  10118. /* 4 */
  10119. /***/ (function(module, exports, __w_pdfjs_require__) {
  10120. "use strict";
  10121. var ExpertEncoding = [
  10122. '',
  10123. '',
  10124. '',
  10125. '',
  10126. '',
  10127. '',
  10128. '',
  10129. '',
  10130. '',
  10131. '',
  10132. '',
  10133. '',
  10134. '',
  10135. '',
  10136. '',
  10137. '',
  10138. '',
  10139. '',
  10140. '',
  10141. '',
  10142. '',
  10143. '',
  10144. '',
  10145. '',
  10146. '',
  10147. '',
  10148. '',
  10149. '',
  10150. '',
  10151. '',
  10152. '',
  10153. '',
  10154. 'space',
  10155. 'exclamsmall',
  10156. 'Hungarumlautsmall',
  10157. '',
  10158. 'dollaroldstyle',
  10159. 'dollarsuperior',
  10160. 'ampersandsmall',
  10161. 'Acutesmall',
  10162. 'parenleftsuperior',
  10163. 'parenrightsuperior',
  10164. 'twodotenleader',
  10165. 'onedotenleader',
  10166. 'comma',
  10167. 'hyphen',
  10168. 'period',
  10169. 'fraction',
  10170. 'zerooldstyle',
  10171. 'oneoldstyle',
  10172. 'twooldstyle',
  10173. 'threeoldstyle',
  10174. 'fouroldstyle',
  10175. 'fiveoldstyle',
  10176. 'sixoldstyle',
  10177. 'sevenoldstyle',
  10178. 'eightoldstyle',
  10179. 'nineoldstyle',
  10180. 'colon',
  10181. 'semicolon',
  10182. 'commasuperior',
  10183. 'threequartersemdash',
  10184. 'periodsuperior',
  10185. 'questionsmall',
  10186. '',
  10187. 'asuperior',
  10188. 'bsuperior',
  10189. 'centsuperior',
  10190. 'dsuperior',
  10191. 'esuperior',
  10192. '',
  10193. '',
  10194. 'isuperior',
  10195. '',
  10196. '',
  10197. 'lsuperior',
  10198. 'msuperior',
  10199. 'nsuperior',
  10200. 'osuperior',
  10201. '',
  10202. '',
  10203. 'rsuperior',
  10204. 'ssuperior',
  10205. 'tsuperior',
  10206. '',
  10207. 'ff',
  10208. 'fi',
  10209. 'fl',
  10210. 'ffi',
  10211. 'ffl',
  10212. 'parenleftinferior',
  10213. '',
  10214. 'parenrightinferior',
  10215. 'Circumflexsmall',
  10216. 'hyphensuperior',
  10217. 'Gravesmall',
  10218. 'Asmall',
  10219. 'Bsmall',
  10220. 'Csmall',
  10221. 'Dsmall',
  10222. 'Esmall',
  10223. 'Fsmall',
  10224. 'Gsmall',
  10225. 'Hsmall',
  10226. 'Ismall',
  10227. 'Jsmall',
  10228. 'Ksmall',
  10229. 'Lsmall',
  10230. 'Msmall',
  10231. 'Nsmall',
  10232. 'Osmall',
  10233. 'Psmall',
  10234. 'Qsmall',
  10235. 'Rsmall',
  10236. 'Ssmall',
  10237. 'Tsmall',
  10238. 'Usmall',
  10239. 'Vsmall',
  10240. 'Wsmall',
  10241. 'Xsmall',
  10242. 'Ysmall',
  10243. 'Zsmall',
  10244. 'colonmonetary',
  10245. 'onefitted',
  10246. 'rupiah',
  10247. 'Tildesmall',
  10248. '',
  10249. '',
  10250. '',
  10251. '',
  10252. '',
  10253. '',
  10254. '',
  10255. '',
  10256. '',
  10257. '',
  10258. '',
  10259. '',
  10260. '',
  10261. '',
  10262. '',
  10263. '',
  10264. '',
  10265. '',
  10266. '',
  10267. '',
  10268. '',
  10269. '',
  10270. '',
  10271. '',
  10272. '',
  10273. '',
  10274. '',
  10275. '',
  10276. '',
  10277. '',
  10278. '',
  10279. '',
  10280. '',
  10281. '',
  10282. 'exclamdownsmall',
  10283. 'centoldstyle',
  10284. 'Lslashsmall',
  10285. '',
  10286. '',
  10287. 'Scaronsmall',
  10288. 'Zcaronsmall',
  10289. 'Dieresissmall',
  10290. 'Brevesmall',
  10291. 'Caronsmall',
  10292. '',
  10293. 'Dotaccentsmall',
  10294. '',
  10295. '',
  10296. 'Macronsmall',
  10297. '',
  10298. '',
  10299. 'figuredash',
  10300. 'hypheninferior',
  10301. '',
  10302. '',
  10303. 'Ogoneksmall',
  10304. 'Ringsmall',
  10305. 'Cedillasmall',
  10306. '',
  10307. '',
  10308. '',
  10309. 'onequarter',
  10310. 'onehalf',
  10311. 'threequarters',
  10312. 'questiondownsmall',
  10313. 'oneeighth',
  10314. 'threeeighths',
  10315. 'fiveeighths',
  10316. 'seveneighths',
  10317. 'onethird',
  10318. 'twothirds',
  10319. '',
  10320. '',
  10321. 'zerosuperior',
  10322. 'onesuperior',
  10323. 'twosuperior',
  10324. 'threesuperior',
  10325. 'foursuperior',
  10326. 'fivesuperior',
  10327. 'sixsuperior',
  10328. 'sevensuperior',
  10329. 'eightsuperior',
  10330. 'ninesuperior',
  10331. 'zeroinferior',
  10332. 'oneinferior',
  10333. 'twoinferior',
  10334. 'threeinferior',
  10335. 'fourinferior',
  10336. 'fiveinferior',
  10337. 'sixinferior',
  10338. 'seveninferior',
  10339. 'eightinferior',
  10340. 'nineinferior',
  10341. 'centinferior',
  10342. 'dollarinferior',
  10343. 'periodinferior',
  10344. 'commainferior',
  10345. 'Agravesmall',
  10346. 'Aacutesmall',
  10347. 'Acircumflexsmall',
  10348. 'Atildesmall',
  10349. 'Adieresissmall',
  10350. 'Aringsmall',
  10351. 'AEsmall',
  10352. 'Ccedillasmall',
  10353. 'Egravesmall',
  10354. 'Eacutesmall',
  10355. 'Ecircumflexsmall',
  10356. 'Edieresissmall',
  10357. 'Igravesmall',
  10358. 'Iacutesmall',
  10359. 'Icircumflexsmall',
  10360. 'Idieresissmall',
  10361. 'Ethsmall',
  10362. 'Ntildesmall',
  10363. 'Ogravesmall',
  10364. 'Oacutesmall',
  10365. 'Ocircumflexsmall',
  10366. 'Otildesmall',
  10367. 'Odieresissmall',
  10368. 'OEsmall',
  10369. 'Oslashsmall',
  10370. 'Ugravesmall',
  10371. 'Uacutesmall',
  10372. 'Ucircumflexsmall',
  10373. 'Udieresissmall',
  10374. 'Yacutesmall',
  10375. 'Thornsmall',
  10376. 'Ydieresissmall'
  10377. ];
  10378. var MacExpertEncoding = [
  10379. '',
  10380. '',
  10381. '',
  10382. '',
  10383. '',
  10384. '',
  10385. '',
  10386. '',
  10387. '',
  10388. '',
  10389. '',
  10390. '',
  10391. '',
  10392. '',
  10393. '',
  10394. '',
  10395. '',
  10396. '',
  10397. '',
  10398. '',
  10399. '',
  10400. '',
  10401. '',
  10402. '',
  10403. '',
  10404. '',
  10405. '',
  10406. '',
  10407. '',
  10408. '',
  10409. '',
  10410. '',
  10411. 'space',
  10412. 'exclamsmall',
  10413. 'Hungarumlautsmall',
  10414. 'centoldstyle',
  10415. 'dollaroldstyle',
  10416. 'dollarsuperior',
  10417. 'ampersandsmall',
  10418. 'Acutesmall',
  10419. 'parenleftsuperior',
  10420. 'parenrightsuperior',
  10421. 'twodotenleader',
  10422. 'onedotenleader',
  10423. 'comma',
  10424. 'hyphen',
  10425. 'period',
  10426. 'fraction',
  10427. 'zerooldstyle',
  10428. 'oneoldstyle',
  10429. 'twooldstyle',
  10430. 'threeoldstyle',
  10431. 'fouroldstyle',
  10432. 'fiveoldstyle',
  10433. 'sixoldstyle',
  10434. 'sevenoldstyle',
  10435. 'eightoldstyle',
  10436. 'nineoldstyle',
  10437. 'colon',
  10438. 'semicolon',
  10439. '',
  10440. 'threequartersemdash',
  10441. '',
  10442. 'questionsmall',
  10443. '',
  10444. '',
  10445. '',
  10446. '',
  10447. 'Ethsmall',
  10448. '',
  10449. '',
  10450. 'onequarter',
  10451. 'onehalf',
  10452. 'threequarters',
  10453. 'oneeighth',
  10454. 'threeeighths',
  10455. 'fiveeighths',
  10456. 'seveneighths',
  10457. 'onethird',
  10458. 'twothirds',
  10459. '',
  10460. '',
  10461. '',
  10462. '',
  10463. '',
  10464. '',
  10465. 'ff',
  10466. 'fi',
  10467. 'fl',
  10468. 'ffi',
  10469. 'ffl',
  10470. 'parenleftinferior',
  10471. '',
  10472. 'parenrightinferior',
  10473. 'Circumflexsmall',
  10474. 'hypheninferior',
  10475. 'Gravesmall',
  10476. 'Asmall',
  10477. 'Bsmall',
  10478. 'Csmall',
  10479. 'Dsmall',
  10480. 'Esmall',
  10481. 'Fsmall',
  10482. 'Gsmall',
  10483. 'Hsmall',
  10484. 'Ismall',
  10485. 'Jsmall',
  10486. 'Ksmall',
  10487. 'Lsmall',
  10488. 'Msmall',
  10489. 'Nsmall',
  10490. 'Osmall',
  10491. 'Psmall',
  10492. 'Qsmall',
  10493. 'Rsmall',
  10494. 'Ssmall',
  10495. 'Tsmall',
  10496. 'Usmall',
  10497. 'Vsmall',
  10498. 'Wsmall',
  10499. 'Xsmall',
  10500. 'Ysmall',
  10501. 'Zsmall',
  10502. 'colonmonetary',
  10503. 'onefitted',
  10504. 'rupiah',
  10505. 'Tildesmall',
  10506. '',
  10507. '',
  10508. 'asuperior',
  10509. 'centsuperior',
  10510. '',
  10511. '',
  10512. '',
  10513. '',
  10514. 'Aacutesmall',
  10515. 'Agravesmall',
  10516. 'Acircumflexsmall',
  10517. 'Adieresissmall',
  10518. 'Atildesmall',
  10519. 'Aringsmall',
  10520. 'Ccedillasmall',
  10521. 'Eacutesmall',
  10522. 'Egravesmall',
  10523. 'Ecircumflexsmall',
  10524. 'Edieresissmall',
  10525. 'Iacutesmall',
  10526. 'Igravesmall',
  10527. 'Icircumflexsmall',
  10528. 'Idieresissmall',
  10529. 'Ntildesmall',
  10530. 'Oacutesmall',
  10531. 'Ogravesmall',
  10532. 'Ocircumflexsmall',
  10533. 'Odieresissmall',
  10534. 'Otildesmall',
  10535. 'Uacutesmall',
  10536. 'Ugravesmall',
  10537. 'Ucircumflexsmall',
  10538. 'Udieresissmall',
  10539. '',
  10540. 'eightsuperior',
  10541. 'fourinferior',
  10542. 'threeinferior',
  10543. 'sixinferior',
  10544. 'eightinferior',
  10545. 'seveninferior',
  10546. 'Scaronsmall',
  10547. '',
  10548. 'centinferior',
  10549. 'twoinferior',
  10550. '',
  10551. 'Dieresissmall',
  10552. '',
  10553. 'Caronsmall',
  10554. 'osuperior',
  10555. 'fiveinferior',
  10556. '',
  10557. 'commainferior',
  10558. 'periodinferior',
  10559. 'Yacutesmall',
  10560. '',
  10561. 'dollarinferior',
  10562. '',
  10563. 'Thornsmall',
  10564. '',
  10565. 'nineinferior',
  10566. 'zeroinferior',
  10567. 'Zcaronsmall',
  10568. 'AEsmall',
  10569. 'Oslashsmall',
  10570. 'questiondownsmall',
  10571. 'oneinferior',
  10572. 'Lslashsmall',
  10573. '',
  10574. '',
  10575. '',
  10576. '',
  10577. '',
  10578. '',
  10579. 'Cedillasmall',
  10580. '',
  10581. '',
  10582. '',
  10583. '',
  10584. '',
  10585. 'OEsmall',
  10586. 'figuredash',
  10587. 'hyphensuperior',
  10588. '',
  10589. '',
  10590. '',
  10591. '',
  10592. 'exclamdownsmall',
  10593. '',
  10594. 'Ydieresissmall',
  10595. '',
  10596. 'onesuperior',
  10597. 'twosuperior',
  10598. 'threesuperior',
  10599. 'foursuperior',
  10600. 'fivesuperior',
  10601. 'sixsuperior',
  10602. 'sevensuperior',
  10603. 'ninesuperior',
  10604. 'zerosuperior',
  10605. '',
  10606. 'esuperior',
  10607. 'rsuperior',
  10608. 'tsuperior',
  10609. '',
  10610. '',
  10611. 'isuperior',
  10612. 'ssuperior',
  10613. 'dsuperior',
  10614. '',
  10615. '',
  10616. '',
  10617. '',
  10618. '',
  10619. 'lsuperior',
  10620. 'Ogoneksmall',
  10621. 'Brevesmall',
  10622. 'Macronsmall',
  10623. 'bsuperior',
  10624. 'nsuperior',
  10625. 'msuperior',
  10626. 'commasuperior',
  10627. 'periodsuperior',
  10628. 'Dotaccentsmall',
  10629. 'Ringsmall'
  10630. ];
  10631. var MacRomanEncoding = [
  10632. '',
  10633. '',
  10634. '',
  10635. '',
  10636. '',
  10637. '',
  10638. '',
  10639. '',
  10640. '',
  10641. '',
  10642. '',
  10643. '',
  10644. '',
  10645. '',
  10646. '',
  10647. '',
  10648. '',
  10649. '',
  10650. '',
  10651. '',
  10652. '',
  10653. '',
  10654. '',
  10655. '',
  10656. '',
  10657. '',
  10658. '',
  10659. '',
  10660. '',
  10661. '',
  10662. '',
  10663. '',
  10664. 'space',
  10665. 'exclam',
  10666. 'quotedbl',
  10667. 'numbersign',
  10668. 'dollar',
  10669. 'percent',
  10670. 'ampersand',
  10671. 'quotesingle',
  10672. 'parenleft',
  10673. 'parenright',
  10674. 'asterisk',
  10675. 'plus',
  10676. 'comma',
  10677. 'hyphen',
  10678. 'period',
  10679. 'slash',
  10680. 'zero',
  10681. 'one',
  10682. 'two',
  10683. 'three',
  10684. 'four',
  10685. 'five',
  10686. 'six',
  10687. 'seven',
  10688. 'eight',
  10689. 'nine',
  10690. 'colon',
  10691. 'semicolon',
  10692. 'less',
  10693. 'equal',
  10694. 'greater',
  10695. 'question',
  10696. 'at',
  10697. 'A',
  10698. 'B',
  10699. 'C',
  10700. 'D',
  10701. 'E',
  10702. 'F',
  10703. 'G',
  10704. 'H',
  10705. 'I',
  10706. 'J',
  10707. 'K',
  10708. 'L',
  10709. 'M',
  10710. 'N',
  10711. 'O',
  10712. 'P',
  10713. 'Q',
  10714. 'R',
  10715. 'S',
  10716. 'T',
  10717. 'U',
  10718. 'V',
  10719. 'W',
  10720. 'X',
  10721. 'Y',
  10722. 'Z',
  10723. 'bracketleft',
  10724. 'backslash',
  10725. 'bracketright',
  10726. 'asciicircum',
  10727. 'underscore',
  10728. 'grave',
  10729. 'a',
  10730. 'b',
  10731. 'c',
  10732. 'd',
  10733. 'e',
  10734. 'f',
  10735. 'g',
  10736. 'h',
  10737. 'i',
  10738. 'j',
  10739. 'k',
  10740. 'l',
  10741. 'm',
  10742. 'n',
  10743. 'o',
  10744. 'p',
  10745. 'q',
  10746. 'r',
  10747. 's',
  10748. 't',
  10749. 'u',
  10750. 'v',
  10751. 'w',
  10752. 'x',
  10753. 'y',
  10754. 'z',
  10755. 'braceleft',
  10756. 'bar',
  10757. 'braceright',
  10758. 'asciitilde',
  10759. '',
  10760. 'Adieresis',
  10761. 'Aring',
  10762. 'Ccedilla',
  10763. 'Eacute',
  10764. 'Ntilde',
  10765. 'Odieresis',
  10766. 'Udieresis',
  10767. 'aacute',
  10768. 'agrave',
  10769. 'acircumflex',
  10770. 'adieresis',
  10771. 'atilde',
  10772. 'aring',
  10773. 'ccedilla',
  10774. 'eacute',
  10775. 'egrave',
  10776. 'ecircumflex',
  10777. 'edieresis',
  10778. 'iacute',
  10779. 'igrave',
  10780. 'icircumflex',
  10781. 'idieresis',
  10782. 'ntilde',
  10783. 'oacute',
  10784. 'ograve',
  10785. 'ocircumflex',
  10786. 'odieresis',
  10787. 'otilde',
  10788. 'uacute',
  10789. 'ugrave',
  10790. 'ucircumflex',
  10791. 'udieresis',
  10792. 'dagger',
  10793. 'degree',
  10794. 'cent',
  10795. 'sterling',
  10796. 'section',
  10797. 'bullet',
  10798. 'paragraph',
  10799. 'germandbls',
  10800. 'registered',
  10801. 'copyright',
  10802. 'trademark',
  10803. 'acute',
  10804. 'dieresis',
  10805. 'notequal',
  10806. 'AE',
  10807. 'Oslash',
  10808. 'infinity',
  10809. 'plusminus',
  10810. 'lessequal',
  10811. 'greaterequal',
  10812. 'yen',
  10813. 'mu',
  10814. 'partialdiff',
  10815. 'summation',
  10816. 'product',
  10817. 'pi',
  10818. 'integral',
  10819. 'ordfeminine',
  10820. 'ordmasculine',
  10821. 'Omega',
  10822. 'ae',
  10823. 'oslash',
  10824. 'questiondown',
  10825. 'exclamdown',
  10826. 'logicalnot',
  10827. 'radical',
  10828. 'florin',
  10829. 'approxequal',
  10830. 'Delta',
  10831. 'guillemotleft',
  10832. 'guillemotright',
  10833. 'ellipsis',
  10834. 'space',
  10835. 'Agrave',
  10836. 'Atilde',
  10837. 'Otilde',
  10838. 'OE',
  10839. 'oe',
  10840. 'endash',
  10841. 'emdash',
  10842. 'quotedblleft',
  10843. 'quotedblright',
  10844. 'quoteleft',
  10845. 'quoteright',
  10846. 'divide',
  10847. 'lozenge',
  10848. 'ydieresis',
  10849. 'Ydieresis',
  10850. 'fraction',
  10851. 'currency',
  10852. 'guilsinglleft',
  10853. 'guilsinglright',
  10854. 'fi',
  10855. 'fl',
  10856. 'daggerdbl',
  10857. 'periodcentered',
  10858. 'quotesinglbase',
  10859. 'quotedblbase',
  10860. 'perthousand',
  10861. 'Acircumflex',
  10862. 'Ecircumflex',
  10863. 'Aacute',
  10864. 'Edieresis',
  10865. 'Egrave',
  10866. 'Iacute',
  10867. 'Icircumflex',
  10868. 'Idieresis',
  10869. 'Igrave',
  10870. 'Oacute',
  10871. 'Ocircumflex',
  10872. 'apple',
  10873. 'Ograve',
  10874. 'Uacute',
  10875. 'Ucircumflex',
  10876. 'Ugrave',
  10877. 'dotlessi',
  10878. 'circumflex',
  10879. 'tilde',
  10880. 'macron',
  10881. 'breve',
  10882. 'dotaccent',
  10883. 'ring',
  10884. 'cedilla',
  10885. 'hungarumlaut',
  10886. 'ogonek',
  10887. 'caron'
  10888. ];
  10889. var StandardEncoding = [
  10890. '',
  10891. '',
  10892. '',
  10893. '',
  10894. '',
  10895. '',
  10896. '',
  10897. '',
  10898. '',
  10899. '',
  10900. '',
  10901. '',
  10902. '',
  10903. '',
  10904. '',
  10905. '',
  10906. '',
  10907. '',
  10908. '',
  10909. '',
  10910. '',
  10911. '',
  10912. '',
  10913. '',
  10914. '',
  10915. '',
  10916. '',
  10917. '',
  10918. '',
  10919. '',
  10920. '',
  10921. '',
  10922. 'space',
  10923. 'exclam',
  10924. 'quotedbl',
  10925. 'numbersign',
  10926. 'dollar',
  10927. 'percent',
  10928. 'ampersand',
  10929. 'quoteright',
  10930. 'parenleft',
  10931. 'parenright',
  10932. 'asterisk',
  10933. 'plus',
  10934. 'comma',
  10935. 'hyphen',
  10936. 'period',
  10937. 'slash',
  10938. 'zero',
  10939. 'one',
  10940. 'two',
  10941. 'three',
  10942. 'four',
  10943. 'five',
  10944. 'six',
  10945. 'seven',
  10946. 'eight',
  10947. 'nine',
  10948. 'colon',
  10949. 'semicolon',
  10950. 'less',
  10951. 'equal',
  10952. 'greater',
  10953. 'question',
  10954. 'at',
  10955. 'A',
  10956. 'B',
  10957. 'C',
  10958. 'D',
  10959. 'E',
  10960. 'F',
  10961. 'G',
  10962. 'H',
  10963. 'I',
  10964. 'J',
  10965. 'K',
  10966. 'L',
  10967. 'M',
  10968. 'N',
  10969. 'O',
  10970. 'P',
  10971. 'Q',
  10972. 'R',
  10973. 'S',
  10974. 'T',
  10975. 'U',
  10976. 'V',
  10977. 'W',
  10978. 'X',
  10979. 'Y',
  10980. 'Z',
  10981. 'bracketleft',
  10982. 'backslash',
  10983. 'bracketright',
  10984. 'asciicircum',
  10985. 'underscore',
  10986. 'quoteleft',
  10987. 'a',
  10988. 'b',
  10989. 'c',
  10990. 'd',
  10991. 'e',
  10992. 'f',
  10993. 'g',
  10994. 'h',
  10995. 'i',
  10996. 'j',
  10997. 'k',
  10998. 'l',
  10999. 'm',
  11000. 'n',
  11001. 'o',
  11002. 'p',
  11003. 'q',
  11004. 'r',
  11005. 's',
  11006. 't',
  11007. 'u',
  11008. 'v',
  11009. 'w',
  11010. 'x',
  11011. 'y',
  11012. 'z',
  11013. 'braceleft',
  11014. 'bar',
  11015. 'braceright',
  11016. 'asciitilde',
  11017. '',
  11018. '',
  11019. '',
  11020. '',
  11021. '',
  11022. '',
  11023. '',
  11024. '',
  11025. '',
  11026. '',
  11027. '',
  11028. '',
  11029. '',
  11030. '',
  11031. '',
  11032. '',
  11033. '',
  11034. '',
  11035. '',
  11036. '',
  11037. '',
  11038. '',
  11039. '',
  11040. '',
  11041. '',
  11042. '',
  11043. '',
  11044. '',
  11045. '',
  11046. '',
  11047. '',
  11048. '',
  11049. '',
  11050. '',
  11051. 'exclamdown',
  11052. 'cent',
  11053. 'sterling',
  11054. 'fraction',
  11055. 'yen',
  11056. 'florin',
  11057. 'section',
  11058. 'currency',
  11059. 'quotesingle',
  11060. 'quotedblleft',
  11061. 'guillemotleft',
  11062. 'guilsinglleft',
  11063. 'guilsinglright',
  11064. 'fi',
  11065. 'fl',
  11066. '',
  11067. 'endash',
  11068. 'dagger',
  11069. 'daggerdbl',
  11070. 'periodcentered',
  11071. '',
  11072. 'paragraph',
  11073. 'bullet',
  11074. 'quotesinglbase',
  11075. 'quotedblbase',
  11076. 'quotedblright',
  11077. 'guillemotright',
  11078. 'ellipsis',
  11079. 'perthousand',
  11080. '',
  11081. 'questiondown',
  11082. '',
  11083. 'grave',
  11084. 'acute',
  11085. 'circumflex',
  11086. 'tilde',
  11087. 'macron',
  11088. 'breve',
  11089. 'dotaccent',
  11090. 'dieresis',
  11091. '',
  11092. 'ring',
  11093. 'cedilla',
  11094. '',
  11095. 'hungarumlaut',
  11096. 'ogonek',
  11097. 'caron',
  11098. 'emdash',
  11099. '',
  11100. '',
  11101. '',
  11102. '',
  11103. '',
  11104. '',
  11105. '',
  11106. '',
  11107. '',
  11108. '',
  11109. '',
  11110. '',
  11111. '',
  11112. '',
  11113. '',
  11114. '',
  11115. 'AE',
  11116. '',
  11117. 'ordfeminine',
  11118. '',
  11119. '',
  11120. '',
  11121. '',
  11122. 'Lslash',
  11123. 'Oslash',
  11124. 'OE',
  11125. 'ordmasculine',
  11126. '',
  11127. '',
  11128. '',
  11129. '',
  11130. '',
  11131. 'ae',
  11132. '',
  11133. '',
  11134. '',
  11135. 'dotlessi',
  11136. '',
  11137. '',
  11138. 'lslash',
  11139. 'oslash',
  11140. 'oe',
  11141. 'germandbls'
  11142. ];
  11143. var WinAnsiEncoding = [
  11144. '',
  11145. '',
  11146. '',
  11147. '',
  11148. '',
  11149. '',
  11150. '',
  11151. '',
  11152. '',
  11153. '',
  11154. '',
  11155. '',
  11156. '',
  11157. '',
  11158. '',
  11159. '',
  11160. '',
  11161. '',
  11162. '',
  11163. '',
  11164. '',
  11165. '',
  11166. '',
  11167. '',
  11168. '',
  11169. '',
  11170. '',
  11171. '',
  11172. '',
  11173. '',
  11174. '',
  11175. '',
  11176. 'space',
  11177. 'exclam',
  11178. 'quotedbl',
  11179. 'numbersign',
  11180. 'dollar',
  11181. 'percent',
  11182. 'ampersand',
  11183. 'quotesingle',
  11184. 'parenleft',
  11185. 'parenright',
  11186. 'asterisk',
  11187. 'plus',
  11188. 'comma',
  11189. 'hyphen',
  11190. 'period',
  11191. 'slash',
  11192. 'zero',
  11193. 'one',
  11194. 'two',
  11195. 'three',
  11196. 'four',
  11197. 'five',
  11198. 'six',
  11199. 'seven',
  11200. 'eight',
  11201. 'nine',
  11202. 'colon',
  11203. 'semicolon',
  11204. 'less',
  11205. 'equal',
  11206. 'greater',
  11207. 'question',
  11208. 'at',
  11209. 'A',
  11210. 'B',
  11211. 'C',
  11212. 'D',
  11213. 'E',
  11214. 'F',
  11215. 'G',
  11216. 'H',
  11217. 'I',
  11218. 'J',
  11219. 'K',
  11220. 'L',
  11221. 'M',
  11222. 'N',
  11223. 'O',
  11224. 'P',
  11225. 'Q',
  11226. 'R',
  11227. 'S',
  11228. 'T',
  11229. 'U',
  11230. 'V',
  11231. 'W',
  11232. 'X',
  11233. 'Y',
  11234. 'Z',
  11235. 'bracketleft',
  11236. 'backslash',
  11237. 'bracketright',
  11238. 'asciicircum',
  11239. 'underscore',
  11240. 'grave',
  11241. 'a',
  11242. 'b',
  11243. 'c',
  11244. 'd',
  11245. 'e',
  11246. 'f',
  11247. 'g',
  11248. 'h',
  11249. 'i',
  11250. 'j',
  11251. 'k',
  11252. 'l',
  11253. 'm',
  11254. 'n',
  11255. 'o',
  11256. 'p',
  11257. 'q',
  11258. 'r',
  11259. 's',
  11260. 't',
  11261. 'u',
  11262. 'v',
  11263. 'w',
  11264. 'x',
  11265. 'y',
  11266. 'z',
  11267. 'braceleft',
  11268. 'bar',
  11269. 'braceright',
  11270. 'asciitilde',
  11271. 'bullet',
  11272. 'Euro',
  11273. 'bullet',
  11274. 'quotesinglbase',
  11275. 'florin',
  11276. 'quotedblbase',
  11277. 'ellipsis',
  11278. 'dagger',
  11279. 'daggerdbl',
  11280. 'circumflex',
  11281. 'perthousand',
  11282. 'Scaron',
  11283. 'guilsinglleft',
  11284. 'OE',
  11285. 'bullet',
  11286. 'Zcaron',
  11287. 'bullet',
  11288. 'bullet',
  11289. 'quoteleft',
  11290. 'quoteright',
  11291. 'quotedblleft',
  11292. 'quotedblright',
  11293. 'bullet',
  11294. 'endash',
  11295. 'emdash',
  11296. 'tilde',
  11297. 'trademark',
  11298. 'scaron',
  11299. 'guilsinglright',
  11300. 'oe',
  11301. 'bullet',
  11302. 'zcaron',
  11303. 'Ydieresis',
  11304. 'space',
  11305. 'exclamdown',
  11306. 'cent',
  11307. 'sterling',
  11308. 'currency',
  11309. 'yen',
  11310. 'brokenbar',
  11311. 'section',
  11312. 'dieresis',
  11313. 'copyright',
  11314. 'ordfeminine',
  11315. 'guillemotleft',
  11316. 'logicalnot',
  11317. 'hyphen',
  11318. 'registered',
  11319. 'macron',
  11320. 'degree',
  11321. 'plusminus',
  11322. 'twosuperior',
  11323. 'threesuperior',
  11324. 'acute',
  11325. 'mu',
  11326. 'paragraph',
  11327. 'periodcentered',
  11328. 'cedilla',
  11329. 'onesuperior',
  11330. 'ordmasculine',
  11331. 'guillemotright',
  11332. 'onequarter',
  11333. 'onehalf',
  11334. 'threequarters',
  11335. 'questiondown',
  11336. 'Agrave',
  11337. 'Aacute',
  11338. 'Acircumflex',
  11339. 'Atilde',
  11340. 'Adieresis',
  11341. 'Aring',
  11342. 'AE',
  11343. 'Ccedilla',
  11344. 'Egrave',
  11345. 'Eacute',
  11346. 'Ecircumflex',
  11347. 'Edieresis',
  11348. 'Igrave',
  11349. 'Iacute',
  11350. 'Icircumflex',
  11351. 'Idieresis',
  11352. 'Eth',
  11353. 'Ntilde',
  11354. 'Ograve',
  11355. 'Oacute',
  11356. 'Ocircumflex',
  11357. 'Otilde',
  11358. 'Odieresis',
  11359. 'multiply',
  11360. 'Oslash',
  11361. 'Ugrave',
  11362. 'Uacute',
  11363. 'Ucircumflex',
  11364. 'Udieresis',
  11365. 'Yacute',
  11366. 'Thorn',
  11367. 'germandbls',
  11368. 'agrave',
  11369. 'aacute',
  11370. 'acircumflex',
  11371. 'atilde',
  11372. 'adieresis',
  11373. 'aring',
  11374. 'ae',
  11375. 'ccedilla',
  11376. 'egrave',
  11377. 'eacute',
  11378. 'ecircumflex',
  11379. 'edieresis',
  11380. 'igrave',
  11381. 'iacute',
  11382. 'icircumflex',
  11383. 'idieresis',
  11384. 'eth',
  11385. 'ntilde',
  11386. 'ograve',
  11387. 'oacute',
  11388. 'ocircumflex',
  11389. 'otilde',
  11390. 'odieresis',
  11391. 'divide',
  11392. 'oslash',
  11393. 'ugrave',
  11394. 'uacute',
  11395. 'ucircumflex',
  11396. 'udieresis',
  11397. 'yacute',
  11398. 'thorn',
  11399. 'ydieresis'
  11400. ];
  11401. var SymbolSetEncoding = [
  11402. '',
  11403. '',
  11404. '',
  11405. '',
  11406. '',
  11407. '',
  11408. '',
  11409. '',
  11410. '',
  11411. '',
  11412. '',
  11413. '',
  11414. '',
  11415. '',
  11416. '',
  11417. '',
  11418. '',
  11419. '',
  11420. '',
  11421. '',
  11422. '',
  11423. '',
  11424. '',
  11425. '',
  11426. '',
  11427. '',
  11428. '',
  11429. '',
  11430. '',
  11431. '',
  11432. '',
  11433. '',
  11434. 'space',
  11435. 'exclam',
  11436. 'universal',
  11437. 'numbersign',
  11438. 'existential',
  11439. 'percent',
  11440. 'ampersand',
  11441. 'suchthat',
  11442. 'parenleft',
  11443. 'parenright',
  11444. 'asteriskmath',
  11445. 'plus',
  11446. 'comma',
  11447. 'minus',
  11448. 'period',
  11449. 'slash',
  11450. 'zero',
  11451. 'one',
  11452. 'two',
  11453. 'three',
  11454. 'four',
  11455. 'five',
  11456. 'six',
  11457. 'seven',
  11458. 'eight',
  11459. 'nine',
  11460. 'colon',
  11461. 'semicolon',
  11462. 'less',
  11463. 'equal',
  11464. 'greater',
  11465. 'question',
  11466. 'congruent',
  11467. 'Alpha',
  11468. 'Beta',
  11469. 'Chi',
  11470. 'Delta',
  11471. 'Epsilon',
  11472. 'Phi',
  11473. 'Gamma',
  11474. 'Eta',
  11475. 'Iota',
  11476. 'theta1',
  11477. 'Kappa',
  11478. 'Lambda',
  11479. 'Mu',
  11480. 'Nu',
  11481. 'Omicron',
  11482. 'Pi',
  11483. 'Theta',
  11484. 'Rho',
  11485. 'Sigma',
  11486. 'Tau',
  11487. 'Upsilon',
  11488. 'sigma1',
  11489. 'Omega',
  11490. 'Xi',
  11491. 'Psi',
  11492. 'Zeta',
  11493. 'bracketleft',
  11494. 'therefore',
  11495. 'bracketright',
  11496. 'perpendicular',
  11497. 'underscore',
  11498. 'radicalex',
  11499. 'alpha',
  11500. 'beta',
  11501. 'chi',
  11502. 'delta',
  11503. 'epsilon',
  11504. 'phi',
  11505. 'gamma',
  11506. 'eta',
  11507. 'iota',
  11508. 'phi1',
  11509. 'kappa',
  11510. 'lambda',
  11511. 'mu',
  11512. 'nu',
  11513. 'omicron',
  11514. 'pi',
  11515. 'theta',
  11516. 'rho',
  11517. 'sigma',
  11518. 'tau',
  11519. 'upsilon',
  11520. 'omega1',
  11521. 'omega',
  11522. 'xi',
  11523. 'psi',
  11524. 'zeta',
  11525. 'braceleft',
  11526. 'bar',
  11527. 'braceright',
  11528. 'similar',
  11529. '',
  11530. '',
  11531. '',
  11532. '',
  11533. '',
  11534. '',
  11535. '',
  11536. '',
  11537. '',
  11538. '',
  11539. '',
  11540. '',
  11541. '',
  11542. '',
  11543. '',
  11544. '',
  11545. '',
  11546. '',
  11547. '',
  11548. '',
  11549. '',
  11550. '',
  11551. '',
  11552. '',
  11553. '',
  11554. '',
  11555. '',
  11556. '',
  11557. '',
  11558. '',
  11559. '',
  11560. '',
  11561. '',
  11562. 'Euro',
  11563. 'Upsilon1',
  11564. 'minute',
  11565. 'lessequal',
  11566. 'fraction',
  11567. 'infinity',
  11568. 'florin',
  11569. 'club',
  11570. 'diamond',
  11571. 'heart',
  11572. 'spade',
  11573. 'arrowboth',
  11574. 'arrowleft',
  11575. 'arrowup',
  11576. 'arrowright',
  11577. 'arrowdown',
  11578. 'degree',
  11579. 'plusminus',
  11580. 'second',
  11581. 'greaterequal',
  11582. 'multiply',
  11583. 'proportional',
  11584. 'partialdiff',
  11585. 'bullet',
  11586. 'divide',
  11587. 'notequal',
  11588. 'equivalence',
  11589. 'approxequal',
  11590. 'ellipsis',
  11591. 'arrowvertex',
  11592. 'arrowhorizex',
  11593. 'carriagereturn',
  11594. 'aleph',
  11595. 'Ifraktur',
  11596. 'Rfraktur',
  11597. 'weierstrass',
  11598. 'circlemultiply',
  11599. 'circleplus',
  11600. 'emptyset',
  11601. 'intersection',
  11602. 'union',
  11603. 'propersuperset',
  11604. 'reflexsuperset',
  11605. 'notsubset',
  11606. 'propersubset',
  11607. 'reflexsubset',
  11608. 'element',
  11609. 'notelement',
  11610. 'angle',
  11611. 'gradient',
  11612. 'registerserif',
  11613. 'copyrightserif',
  11614. 'trademarkserif',
  11615. 'product',
  11616. 'radical',
  11617. 'dotmath',
  11618. 'logicalnot',
  11619. 'logicaland',
  11620. 'logicalor',
  11621. 'arrowdblboth',
  11622. 'arrowdblleft',
  11623. 'arrowdblup',
  11624. 'arrowdblright',
  11625. 'arrowdbldown',
  11626. 'lozenge',
  11627. 'angleleft',
  11628. 'registersans',
  11629. 'copyrightsans',
  11630. 'trademarksans',
  11631. 'summation',
  11632. 'parenlefttp',
  11633. 'parenleftex',
  11634. 'parenleftbt',
  11635. 'bracketlefttp',
  11636. 'bracketleftex',
  11637. 'bracketleftbt',
  11638. 'bracelefttp',
  11639. 'braceleftmid',
  11640. 'braceleftbt',
  11641. 'braceex',
  11642. '',
  11643. 'angleright',
  11644. 'integral',
  11645. 'integraltp',
  11646. 'integralex',
  11647. 'integralbt',
  11648. 'parenrighttp',
  11649. 'parenrightex',
  11650. 'parenrightbt',
  11651. 'bracketrighttp',
  11652. 'bracketrightex',
  11653. 'bracketrightbt',
  11654. 'bracerighttp',
  11655. 'bracerightmid',
  11656. 'bracerightbt'
  11657. ];
  11658. var ZapfDingbatsEncoding = [
  11659. '',
  11660. '',
  11661. '',
  11662. '',
  11663. '',
  11664. '',
  11665. '',
  11666. '',
  11667. '',
  11668. '',
  11669. '',
  11670. '',
  11671. '',
  11672. '',
  11673. '',
  11674. '',
  11675. '',
  11676. '',
  11677. '',
  11678. '',
  11679. '',
  11680. '',
  11681. '',
  11682. '',
  11683. '',
  11684. '',
  11685. '',
  11686. '',
  11687. '',
  11688. '',
  11689. '',
  11690. '',
  11691. 'space',
  11692. 'a1',
  11693. 'a2',
  11694. 'a202',
  11695. 'a3',
  11696. 'a4',
  11697. 'a5',
  11698. 'a119',
  11699. 'a118',
  11700. 'a117',
  11701. 'a11',
  11702. 'a12',
  11703. 'a13',
  11704. 'a14',
  11705. 'a15',
  11706. 'a16',
  11707. 'a105',
  11708. 'a17',
  11709. 'a18',
  11710. 'a19',
  11711. 'a20',
  11712. 'a21',
  11713. 'a22',
  11714. 'a23',
  11715. 'a24',
  11716. 'a25',
  11717. 'a26',
  11718. 'a27',
  11719. 'a28',
  11720. 'a6',
  11721. 'a7',
  11722. 'a8',
  11723. 'a9',
  11724. 'a10',
  11725. 'a29',
  11726. 'a30',
  11727. 'a31',
  11728. 'a32',
  11729. 'a33',
  11730. 'a34',
  11731. 'a35',
  11732. 'a36',
  11733. 'a37',
  11734. 'a38',
  11735. 'a39',
  11736. 'a40',
  11737. 'a41',
  11738. 'a42',
  11739. 'a43',
  11740. 'a44',
  11741. 'a45',
  11742. 'a46',
  11743. 'a47',
  11744. 'a48',
  11745. 'a49',
  11746. 'a50',
  11747. 'a51',
  11748. 'a52',
  11749. 'a53',
  11750. 'a54',
  11751. 'a55',
  11752. 'a56',
  11753. 'a57',
  11754. 'a58',
  11755. 'a59',
  11756. 'a60',
  11757. 'a61',
  11758. 'a62',
  11759. 'a63',
  11760. 'a64',
  11761. 'a65',
  11762. 'a66',
  11763. 'a67',
  11764. 'a68',
  11765. 'a69',
  11766. 'a70',
  11767. 'a71',
  11768. 'a72',
  11769. 'a73',
  11770. 'a74',
  11771. 'a203',
  11772. 'a75',
  11773. 'a204',
  11774. 'a76',
  11775. 'a77',
  11776. 'a78',
  11777. 'a79',
  11778. 'a81',
  11779. 'a82',
  11780. 'a83',
  11781. 'a84',
  11782. 'a97',
  11783. 'a98',
  11784. 'a99',
  11785. 'a100',
  11786. '',
  11787. 'a89',
  11788. 'a90',
  11789. 'a93',
  11790. 'a94',
  11791. 'a91',
  11792. 'a92',
  11793. 'a205',
  11794. 'a85',
  11795. 'a206',
  11796. 'a86',
  11797. 'a87',
  11798. 'a88',
  11799. 'a95',
  11800. 'a96',
  11801. '',
  11802. '',
  11803. '',
  11804. '',
  11805. '',
  11806. '',
  11807. '',
  11808. '',
  11809. '',
  11810. '',
  11811. '',
  11812. '',
  11813. '',
  11814. '',
  11815. '',
  11816. '',
  11817. '',
  11818. '',
  11819. '',
  11820. 'a101',
  11821. 'a102',
  11822. 'a103',
  11823. 'a104',
  11824. 'a106',
  11825. 'a107',
  11826. 'a108',
  11827. 'a112',
  11828. 'a111',
  11829. 'a110',
  11830. 'a109',
  11831. 'a120',
  11832. 'a121',
  11833. 'a122',
  11834. 'a123',
  11835. 'a124',
  11836. 'a125',
  11837. 'a126',
  11838. 'a127',
  11839. 'a128',
  11840. 'a129',
  11841. 'a130',
  11842. 'a131',
  11843. 'a132',
  11844. 'a133',
  11845. 'a134',
  11846. 'a135',
  11847. 'a136',
  11848. 'a137',
  11849. 'a138',
  11850. 'a139',
  11851. 'a140',
  11852. 'a141',
  11853. 'a142',
  11854. 'a143',
  11855. 'a144',
  11856. 'a145',
  11857. 'a146',
  11858. 'a147',
  11859. 'a148',
  11860. 'a149',
  11861. 'a150',
  11862. 'a151',
  11863. 'a152',
  11864. 'a153',
  11865. 'a154',
  11866. 'a155',
  11867. 'a156',
  11868. 'a157',
  11869. 'a158',
  11870. 'a159',
  11871. 'a160',
  11872. 'a161',
  11873. 'a163',
  11874. 'a164',
  11875. 'a196',
  11876. 'a165',
  11877. 'a192',
  11878. 'a166',
  11879. 'a167',
  11880. 'a168',
  11881. 'a169',
  11882. 'a170',
  11883. 'a171',
  11884. 'a172',
  11885. 'a173',
  11886. 'a162',
  11887. 'a174',
  11888. 'a175',
  11889. 'a176',
  11890. 'a177',
  11891. 'a178',
  11892. 'a179',
  11893. 'a193',
  11894. 'a180',
  11895. 'a199',
  11896. 'a181',
  11897. 'a200',
  11898. 'a182',
  11899. '',
  11900. 'a201',
  11901. 'a183',
  11902. 'a184',
  11903. 'a197',
  11904. 'a185',
  11905. 'a194',
  11906. 'a198',
  11907. 'a186',
  11908. 'a195',
  11909. 'a187',
  11910. 'a188',
  11911. 'a189',
  11912. 'a190',
  11913. 'a191'
  11914. ];
  11915. function getEncoding(encodingName) {
  11916. switch (encodingName) {
  11917. case 'WinAnsiEncoding':
  11918. return WinAnsiEncoding;
  11919. case 'StandardEncoding':
  11920. return StandardEncoding;
  11921. case 'MacRomanEncoding':
  11922. return MacRomanEncoding;
  11923. case 'SymbolSetEncoding':
  11924. return SymbolSetEncoding;
  11925. case 'ZapfDingbatsEncoding':
  11926. return ZapfDingbatsEncoding;
  11927. case 'ExpertEncoding':
  11928. return ExpertEncoding;
  11929. case 'MacExpertEncoding':
  11930. return MacExpertEncoding;
  11931. default:
  11932. return null;
  11933. }
  11934. }
  11935. exports.WinAnsiEncoding = WinAnsiEncoding;
  11936. exports.StandardEncoding = StandardEncoding;
  11937. exports.MacRomanEncoding = MacRomanEncoding;
  11938. exports.SymbolSetEncoding = SymbolSetEncoding;
  11939. exports.ZapfDingbatsEncoding = ZapfDingbatsEncoding;
  11940. exports.ExpertEncoding = ExpertEncoding;
  11941. exports.getEncoding = getEncoding;
  11942. /***/ }),
  11943. /* 5 */
  11944. /***/ (function(module, exports, __w_pdfjs_require__) {
  11945. "use strict";
  11946. var sharedUtil = __w_pdfjs_require__(0);
  11947. var corePrimitives = __w_pdfjs_require__(1);
  11948. var coreStream = __w_pdfjs_require__(2);
  11949. var MissingDataException = sharedUtil.MissingDataException;
  11950. var StreamType = sharedUtil.StreamType;
  11951. var assert = sharedUtil.assert;
  11952. var error = sharedUtil.error;
  11953. var info = sharedUtil.info;
  11954. var isArray = sharedUtil.isArray;
  11955. var isInt = sharedUtil.isInt;
  11956. var isNum = sharedUtil.isNum;
  11957. var isString = sharedUtil.isString;
  11958. var warn = sharedUtil.warn;
  11959. var EOF = corePrimitives.EOF;
  11960. var Cmd = corePrimitives.Cmd;
  11961. var Dict = corePrimitives.Dict;
  11962. var Name = corePrimitives.Name;
  11963. var Ref = corePrimitives.Ref;
  11964. var isEOF = corePrimitives.isEOF;
  11965. var isCmd = corePrimitives.isCmd;
  11966. var isDict = corePrimitives.isDict;
  11967. var isName = corePrimitives.isName;
  11968. var Ascii85Stream = coreStream.Ascii85Stream;
  11969. var AsciiHexStream = coreStream.AsciiHexStream;
  11970. var CCITTFaxStream = coreStream.CCITTFaxStream;
  11971. var FlateStream = coreStream.FlateStream;
  11972. var Jbig2Stream = coreStream.Jbig2Stream;
  11973. var JpegStream = coreStream.JpegStream;
  11974. var JpxStream = coreStream.JpxStream;
  11975. var LZWStream = coreStream.LZWStream;
  11976. var NullStream = coreStream.NullStream;
  11977. var PredictorStream = coreStream.PredictorStream;
  11978. var RunLengthStream = coreStream.RunLengthStream;
  11979. var MAX_LENGTH_TO_CACHE = 1000;
  11980. var Parser = function ParserClosure() {
  11981. function Parser(lexer, allowStreams, xref, recoveryMode) {
  11982. this.lexer = lexer;
  11983. this.allowStreams = allowStreams;
  11984. this.xref = xref;
  11985. this.recoveryMode = recoveryMode || false;
  11986. this.imageCache = Object.create(null);
  11987. this.refill();
  11988. }
  11989. Parser.prototype = {
  11990. refill: function Parser_refill() {
  11991. this.buf1 = this.lexer.getObj();
  11992. this.buf2 = this.lexer.getObj();
  11993. },
  11994. shift: function Parser_shift() {
  11995. if (isCmd(this.buf2, 'ID')) {
  11996. this.buf1 = this.buf2;
  11997. this.buf2 = null;
  11998. } else {
  11999. this.buf1 = this.buf2;
  12000. this.buf2 = this.lexer.getObj();
  12001. }
  12002. },
  12003. tryShift: function Parser_tryShift() {
  12004. try {
  12005. this.shift();
  12006. return true;
  12007. } catch (e) {
  12008. if (e instanceof MissingDataException) {
  12009. throw e;
  12010. }
  12011. return false;
  12012. }
  12013. },
  12014. getObj: function Parser_getObj(cipherTransform) {
  12015. var buf1 = this.buf1;
  12016. this.shift();
  12017. if (buf1 instanceof Cmd) {
  12018. switch (buf1.cmd) {
  12019. case 'BI':
  12020. return this.makeInlineImage(cipherTransform);
  12021. case '[':
  12022. var array = [];
  12023. while (!isCmd(this.buf1, ']') && !isEOF(this.buf1)) {
  12024. array.push(this.getObj(cipherTransform));
  12025. }
  12026. if (isEOF(this.buf1)) {
  12027. if (!this.recoveryMode) {
  12028. error('End of file inside array');
  12029. }
  12030. return array;
  12031. }
  12032. this.shift();
  12033. return array;
  12034. case '<<':
  12035. var dict = new Dict(this.xref);
  12036. while (!isCmd(this.buf1, '>>') && !isEOF(this.buf1)) {
  12037. if (!isName(this.buf1)) {
  12038. info('Malformed dictionary: key must be a name object');
  12039. this.shift();
  12040. continue;
  12041. }
  12042. var key = this.buf1.name;
  12043. this.shift();
  12044. if (isEOF(this.buf1)) {
  12045. break;
  12046. }
  12047. dict.set(key, this.getObj(cipherTransform));
  12048. }
  12049. if (isEOF(this.buf1)) {
  12050. if (!this.recoveryMode) {
  12051. error('End of file inside dictionary');
  12052. }
  12053. return dict;
  12054. }
  12055. if (isCmd(this.buf2, 'stream')) {
  12056. return this.allowStreams ? this.makeStream(dict, cipherTransform) : dict;
  12057. }
  12058. this.shift();
  12059. return dict;
  12060. default:
  12061. return buf1;
  12062. }
  12063. }
  12064. if (isInt(buf1)) {
  12065. var num = buf1;
  12066. if (isInt(this.buf1) && isCmd(this.buf2, 'R')) {
  12067. var ref = new Ref(num, this.buf1);
  12068. this.shift();
  12069. this.shift();
  12070. return ref;
  12071. }
  12072. return num;
  12073. }
  12074. if (isString(buf1)) {
  12075. var str = buf1;
  12076. if (cipherTransform) {
  12077. str = cipherTransform.decryptString(str);
  12078. }
  12079. return str;
  12080. }
  12081. return buf1;
  12082. },
  12083. findDefaultInlineStreamEnd: function Parser_findDefaultInlineStreamEnd(stream) {
  12084. var E = 0x45, I = 0x49, SPACE = 0x20, LF = 0xA, CR = 0xD;
  12085. var startPos = stream.pos, state = 0, ch, i, n, followingBytes;
  12086. while ((ch = stream.getByte()) !== -1) {
  12087. if (state === 0) {
  12088. state = ch === E ? 1 : 0;
  12089. } else if (state === 1) {
  12090. state = ch === I ? 2 : 0;
  12091. } else {
  12092. assert(state === 2);
  12093. if (ch === SPACE || ch === LF || ch === CR) {
  12094. n = 5;
  12095. followingBytes = stream.peekBytes(n);
  12096. for (i = 0; i < n; i++) {
  12097. ch = followingBytes[i];
  12098. if (ch !== LF && ch !== CR && (ch < SPACE || ch > 0x7F)) {
  12099. state = 0;
  12100. break;
  12101. }
  12102. }
  12103. if (state === 2) {
  12104. break;
  12105. }
  12106. } else {
  12107. state = 0;
  12108. }
  12109. }
  12110. }
  12111. return stream.pos - 4 - startPos;
  12112. },
  12113. findDCTDecodeInlineStreamEnd: function Parser_findDCTDecodeInlineStreamEnd(stream) {
  12114. var startPos = stream.pos, foundEOI = false, b, markerLength, length;
  12115. while ((b = stream.getByte()) !== -1) {
  12116. if (b !== 0xFF) {
  12117. continue;
  12118. }
  12119. switch (stream.getByte()) {
  12120. case 0x00:
  12121. break;
  12122. case 0xFF:
  12123. stream.skip(-1);
  12124. break;
  12125. case 0xD9:
  12126. foundEOI = true;
  12127. break;
  12128. case 0xC0:
  12129. case 0xC1:
  12130. case 0xC2:
  12131. case 0xC3:
  12132. case 0xC5:
  12133. case 0xC6:
  12134. case 0xC7:
  12135. case 0xC9:
  12136. case 0xCA:
  12137. case 0xCB:
  12138. case 0xCD:
  12139. case 0xCE:
  12140. case 0xCF:
  12141. case 0xC4:
  12142. case 0xCC:
  12143. case 0xDA:
  12144. case 0xDB:
  12145. case 0xDC:
  12146. case 0xDD:
  12147. case 0xDE:
  12148. case 0xDF:
  12149. case 0xE0:
  12150. case 0xE1:
  12151. case 0xE2:
  12152. case 0xE3:
  12153. case 0xE4:
  12154. case 0xE5:
  12155. case 0xE6:
  12156. case 0xE7:
  12157. case 0xE8:
  12158. case 0xE9:
  12159. case 0xEA:
  12160. case 0xEB:
  12161. case 0xEC:
  12162. case 0xED:
  12163. case 0xEE:
  12164. case 0xEF:
  12165. case 0xFE:
  12166. markerLength = stream.getUint16();
  12167. if (markerLength > 2) {
  12168. stream.skip(markerLength - 2);
  12169. } else {
  12170. stream.skip(-2);
  12171. }
  12172. break;
  12173. }
  12174. if (foundEOI) {
  12175. break;
  12176. }
  12177. }
  12178. length = stream.pos - startPos;
  12179. if (b === -1) {
  12180. warn('Inline DCTDecode image stream: ' + 'EOI marker not found, searching for /EI/ instead.');
  12181. stream.skip(-length);
  12182. return this.findDefaultInlineStreamEnd(stream);
  12183. }
  12184. this.inlineStreamSkipEI(stream);
  12185. return length;
  12186. },
  12187. findASCII85DecodeInlineStreamEnd: function Parser_findASCII85DecodeInlineStreamEnd(stream) {
  12188. var TILDE = 0x7E, GT = 0x3E;
  12189. var startPos = stream.pos, ch, length;
  12190. while ((ch = stream.getByte()) !== -1) {
  12191. if (ch === TILDE && stream.peekByte() === GT) {
  12192. stream.skip();
  12193. break;
  12194. }
  12195. }
  12196. length = stream.pos - startPos;
  12197. if (ch === -1) {
  12198. warn('Inline ASCII85Decode image stream: ' + 'EOD marker not found, searching for /EI/ instead.');
  12199. stream.skip(-length);
  12200. return this.findDefaultInlineStreamEnd(stream);
  12201. }
  12202. this.inlineStreamSkipEI(stream);
  12203. return length;
  12204. },
  12205. findASCIIHexDecodeInlineStreamEnd: function Parser_findASCIIHexDecodeInlineStreamEnd(stream) {
  12206. var GT = 0x3E;
  12207. var startPos = stream.pos, ch, length;
  12208. while ((ch = stream.getByte()) !== -1) {
  12209. if (ch === GT) {
  12210. break;
  12211. }
  12212. }
  12213. length = stream.pos - startPos;
  12214. if (ch === -1) {
  12215. warn('Inline ASCIIHexDecode image stream: ' + 'EOD marker not found, searching for /EI/ instead.');
  12216. stream.skip(-length);
  12217. return this.findDefaultInlineStreamEnd(stream);
  12218. }
  12219. this.inlineStreamSkipEI(stream);
  12220. return length;
  12221. },
  12222. inlineStreamSkipEI: function Parser_inlineStreamSkipEI(stream) {
  12223. var E = 0x45, I = 0x49;
  12224. var state = 0, ch;
  12225. while ((ch = stream.getByte()) !== -1) {
  12226. if (state === 0) {
  12227. state = ch === E ? 1 : 0;
  12228. } else if (state === 1) {
  12229. state = ch === I ? 2 : 0;
  12230. } else if (state === 2) {
  12231. break;
  12232. }
  12233. }
  12234. },
  12235. makeInlineImage: function Parser_makeInlineImage(cipherTransform) {
  12236. var lexer = this.lexer;
  12237. var stream = lexer.stream;
  12238. var dict = new Dict(this.xref);
  12239. while (!isCmd(this.buf1, 'ID') && !isEOF(this.buf1)) {
  12240. if (!isName(this.buf1)) {
  12241. error('Dictionary key must be a name object');
  12242. }
  12243. var key = this.buf1.name;
  12244. this.shift();
  12245. if (isEOF(this.buf1)) {
  12246. break;
  12247. }
  12248. dict.set(key, this.getObj(cipherTransform));
  12249. }
  12250. var filter = dict.get('Filter', 'F'), filterName;
  12251. if (isName(filter)) {
  12252. filterName = filter.name;
  12253. } else if (isArray(filter)) {
  12254. var filterZero = this.xref.fetchIfRef(filter[0]);
  12255. if (isName(filterZero)) {
  12256. filterName = filterZero.name;
  12257. }
  12258. }
  12259. var startPos = stream.pos, length, i, ii;
  12260. if (filterName === 'DCTDecode' || filterName === 'DCT') {
  12261. length = this.findDCTDecodeInlineStreamEnd(stream);
  12262. } else if (filterName === 'ASCII85Decide' || filterName === 'A85') {
  12263. length = this.findASCII85DecodeInlineStreamEnd(stream);
  12264. } else if (filterName === 'ASCIIHexDecode' || filterName === 'AHx') {
  12265. length = this.findASCIIHexDecodeInlineStreamEnd(stream);
  12266. } else {
  12267. length = this.findDefaultInlineStreamEnd(stream);
  12268. }
  12269. var imageStream = stream.makeSubStream(startPos, length, dict);
  12270. var adler32;
  12271. if (length < MAX_LENGTH_TO_CACHE) {
  12272. var imageBytes = imageStream.getBytes();
  12273. imageStream.reset();
  12274. var a = 1;
  12275. var b = 0;
  12276. for (i = 0, ii = imageBytes.length; i < ii; ++i) {
  12277. a += imageBytes[i] & 0xff;
  12278. b += a;
  12279. }
  12280. adler32 = b % 65521 << 16 | a % 65521;
  12281. if (this.imageCache.adler32 === adler32) {
  12282. this.buf2 = Cmd.get('EI');
  12283. this.shift();
  12284. this.imageCache[adler32].reset();
  12285. return this.imageCache[adler32];
  12286. }
  12287. }
  12288. if (cipherTransform) {
  12289. imageStream = cipherTransform.createStream(imageStream, length);
  12290. }
  12291. imageStream = this.filter(imageStream, dict, length);
  12292. imageStream.dict = dict;
  12293. if (adler32 !== undefined) {
  12294. imageStream.cacheKey = 'inline_' + length + '_' + adler32;
  12295. this.imageCache[adler32] = imageStream;
  12296. }
  12297. this.buf2 = Cmd.get('EI');
  12298. this.shift();
  12299. return imageStream;
  12300. },
  12301. makeStream: function Parser_makeStream(dict, cipherTransform) {
  12302. var lexer = this.lexer;
  12303. var stream = lexer.stream;
  12304. lexer.skipToNextLine();
  12305. var pos = stream.pos - 1;
  12306. var length = dict.get('Length');
  12307. if (!isInt(length)) {
  12308. info('Bad ' + length + ' attribute in stream');
  12309. length = 0;
  12310. }
  12311. stream.pos = pos + length;
  12312. lexer.nextChar();
  12313. if (this.tryShift() && isCmd(this.buf2, 'endstream')) {
  12314. this.shift();
  12315. } else {
  12316. stream.pos = pos;
  12317. var SCAN_BLOCK_SIZE = 2048;
  12318. var ENDSTREAM_SIGNATURE_LENGTH = 9;
  12319. var ENDSTREAM_SIGNATURE = [
  12320. 0x65,
  12321. 0x6E,
  12322. 0x64,
  12323. 0x73,
  12324. 0x74,
  12325. 0x72,
  12326. 0x65,
  12327. 0x61,
  12328. 0x6D
  12329. ];
  12330. var skipped = 0, found = false, i, j;
  12331. while (stream.pos < stream.end) {
  12332. var scanBytes = stream.peekBytes(SCAN_BLOCK_SIZE);
  12333. var scanLength = scanBytes.length - ENDSTREAM_SIGNATURE_LENGTH;
  12334. if (scanLength <= 0) {
  12335. break;
  12336. }
  12337. found = false;
  12338. i = 0;
  12339. while (i < scanLength) {
  12340. j = 0;
  12341. while (j < ENDSTREAM_SIGNATURE_LENGTH && scanBytes[i + j] === ENDSTREAM_SIGNATURE[j]) {
  12342. j++;
  12343. }
  12344. if (j >= ENDSTREAM_SIGNATURE_LENGTH) {
  12345. found = true;
  12346. break;
  12347. }
  12348. i++;
  12349. }
  12350. if (found) {
  12351. skipped += i;
  12352. stream.pos += i;
  12353. break;
  12354. }
  12355. skipped += scanLength;
  12356. stream.pos += scanLength;
  12357. }
  12358. if (!found) {
  12359. error('Missing endstream');
  12360. }
  12361. length = skipped;
  12362. lexer.nextChar();
  12363. this.shift();
  12364. this.shift();
  12365. }
  12366. this.shift();
  12367. stream = stream.makeSubStream(pos, length, dict);
  12368. if (cipherTransform) {
  12369. stream = cipherTransform.createStream(stream, length);
  12370. }
  12371. stream = this.filter(stream, dict, length);
  12372. stream.dict = dict;
  12373. return stream;
  12374. },
  12375. filter: function Parser_filter(stream, dict, length) {
  12376. var filter = dict.get('Filter', 'F');
  12377. var params = dict.get('DecodeParms', 'DP');
  12378. if (isName(filter)) {
  12379. if (isArray(params)) {
  12380. params = this.xref.fetchIfRef(params[0]);
  12381. }
  12382. return this.makeFilter(stream, filter.name, length, params);
  12383. }
  12384. var maybeLength = length;
  12385. if (isArray(filter)) {
  12386. var filterArray = filter;
  12387. var paramsArray = params;
  12388. for (var i = 0, ii = filterArray.length; i < ii; ++i) {
  12389. filter = this.xref.fetchIfRef(filterArray[i]);
  12390. if (!isName(filter)) {
  12391. error('Bad filter name: ' + filter);
  12392. }
  12393. params = null;
  12394. if (isArray(paramsArray) && i in paramsArray) {
  12395. params = this.xref.fetchIfRef(paramsArray[i]);
  12396. }
  12397. stream = this.makeFilter(stream, filter.name, maybeLength, params);
  12398. maybeLength = null;
  12399. }
  12400. }
  12401. return stream;
  12402. },
  12403. makeFilter: function Parser_makeFilter(stream, name, maybeLength, params) {
  12404. if (maybeLength === 0) {
  12405. warn('Empty "' + name + '" stream.');
  12406. return new NullStream(stream);
  12407. }
  12408. try {
  12409. var xrefStreamStats = this.xref.stats.streamTypes;
  12410. if (name === 'FlateDecode' || name === 'Fl') {
  12411. xrefStreamStats[StreamType.FLATE] = true;
  12412. if (params) {
  12413. return new PredictorStream(new FlateStream(stream, maybeLength), maybeLength, params);
  12414. }
  12415. return new FlateStream(stream, maybeLength);
  12416. }
  12417. if (name === 'LZWDecode' || name === 'LZW') {
  12418. xrefStreamStats[StreamType.LZW] = true;
  12419. var earlyChange = 1;
  12420. if (params) {
  12421. if (params.has('EarlyChange')) {
  12422. earlyChange = params.get('EarlyChange');
  12423. }
  12424. return new PredictorStream(new LZWStream(stream, maybeLength, earlyChange), maybeLength, params);
  12425. }
  12426. return new LZWStream(stream, maybeLength, earlyChange);
  12427. }
  12428. if (name === 'DCTDecode' || name === 'DCT') {
  12429. xrefStreamStats[StreamType.DCT] = true;
  12430. return new JpegStream(stream, maybeLength, stream.dict, params);
  12431. }
  12432. if (name === 'JPXDecode' || name === 'JPX') {
  12433. xrefStreamStats[StreamType.JPX] = true;
  12434. return new JpxStream(stream, maybeLength, stream.dict, params);
  12435. }
  12436. if (name === 'ASCII85Decode' || name === 'A85') {
  12437. xrefStreamStats[StreamType.A85] = true;
  12438. return new Ascii85Stream(stream, maybeLength);
  12439. }
  12440. if (name === 'ASCIIHexDecode' || name === 'AHx') {
  12441. xrefStreamStats[StreamType.AHX] = true;
  12442. return new AsciiHexStream(stream, maybeLength);
  12443. }
  12444. if (name === 'CCITTFaxDecode' || name === 'CCF') {
  12445. xrefStreamStats[StreamType.CCF] = true;
  12446. return new CCITTFaxStream(stream, maybeLength, params);
  12447. }
  12448. if (name === 'RunLengthDecode' || name === 'RL') {
  12449. xrefStreamStats[StreamType.RL] = true;
  12450. return new RunLengthStream(stream, maybeLength);
  12451. }
  12452. if (name === 'JBIG2Decode') {
  12453. xrefStreamStats[StreamType.JBIG] = true;
  12454. return new Jbig2Stream(stream, maybeLength, stream.dict, params);
  12455. }
  12456. warn('filter "' + name + '" not supported yet');
  12457. return stream;
  12458. } catch (ex) {
  12459. if (ex instanceof MissingDataException) {
  12460. throw ex;
  12461. }
  12462. warn('Invalid stream: \"' + ex + '\"');
  12463. return new NullStream(stream);
  12464. }
  12465. }
  12466. };
  12467. return Parser;
  12468. }();
  12469. var Lexer = function LexerClosure() {
  12470. function Lexer(stream, knownCommands) {
  12471. this.stream = stream;
  12472. this.nextChar();
  12473. this.strBuf = [];
  12474. this.knownCommands = knownCommands;
  12475. }
  12476. var specialChars = [
  12477. 1,
  12478. 0,
  12479. 0,
  12480. 0,
  12481. 0,
  12482. 0,
  12483. 0,
  12484. 0,
  12485. 0,
  12486. 1,
  12487. 1,
  12488. 0,
  12489. 1,
  12490. 1,
  12491. 0,
  12492. 0,
  12493. 0,
  12494. 0,
  12495. 0,
  12496. 0,
  12497. 0,
  12498. 0,
  12499. 0,
  12500. 0,
  12501. 0,
  12502. 0,
  12503. 0,
  12504. 0,
  12505. 0,
  12506. 0,
  12507. 0,
  12508. 0,
  12509. 1,
  12510. 0,
  12511. 0,
  12512. 0,
  12513. 0,
  12514. 2,
  12515. 0,
  12516. 0,
  12517. 2,
  12518. 2,
  12519. 0,
  12520. 0,
  12521. 0,
  12522. 0,
  12523. 0,
  12524. 2,
  12525. 0,
  12526. 0,
  12527. 0,
  12528. 0,
  12529. 0,
  12530. 0,
  12531. 0,
  12532. 0,
  12533. 0,
  12534. 0,
  12535. 0,
  12536. 0,
  12537. 2,
  12538. 0,
  12539. 2,
  12540. 0,
  12541. 0,
  12542. 0,
  12543. 0,
  12544. 0,
  12545. 0,
  12546. 0,
  12547. 0,
  12548. 0,
  12549. 0,
  12550. 0,
  12551. 0,
  12552. 0,
  12553. 0,
  12554. 0,
  12555. 0,
  12556. 0,
  12557. 0,
  12558. 0,
  12559. 0,
  12560. 0,
  12561. 0,
  12562. 0,
  12563. 0,
  12564. 0,
  12565. 0,
  12566. 0,
  12567. 0,
  12568. 2,
  12569. 0,
  12570. 2,
  12571. 0,
  12572. 0,
  12573. 0,
  12574. 0,
  12575. 0,
  12576. 0,
  12577. 0,
  12578. 0,
  12579. 0,
  12580. 0,
  12581. 0,
  12582. 0,
  12583. 0,
  12584. 0,
  12585. 0,
  12586. 0,
  12587. 0,
  12588. 0,
  12589. 0,
  12590. 0,
  12591. 0,
  12592. 0,
  12593. 0,
  12594. 0,
  12595. 0,
  12596. 0,
  12597. 0,
  12598. 0,
  12599. 0,
  12600. 2,
  12601. 0,
  12602. 2,
  12603. 0,
  12604. 0,
  12605. 0,
  12606. 0,
  12607. 0,
  12608. 0,
  12609. 0,
  12610. 0,
  12611. 0,
  12612. 0,
  12613. 0,
  12614. 0,
  12615. 0,
  12616. 0,
  12617. 0,
  12618. 0,
  12619. 0,
  12620. 0,
  12621. 0,
  12622. 0,
  12623. 0,
  12624. 0,
  12625. 0,
  12626. 0,
  12627. 0,
  12628. 0,
  12629. 0,
  12630. 0,
  12631. 0,
  12632. 0,
  12633. 0,
  12634. 0,
  12635. 0,
  12636. 0,
  12637. 0,
  12638. 0,
  12639. 0,
  12640. 0,
  12641. 0,
  12642. 0,
  12643. 0,
  12644. 0,
  12645. 0,
  12646. 0,
  12647. 0,
  12648. 0,
  12649. 0,
  12650. 0,
  12651. 0,
  12652. 0,
  12653. 0,
  12654. 0,
  12655. 0,
  12656. 0,
  12657. 0,
  12658. 0,
  12659. 0,
  12660. 0,
  12661. 0,
  12662. 0,
  12663. 0,
  12664. 0,
  12665. 0,
  12666. 0,
  12667. 0,
  12668. 0,
  12669. 0,
  12670. 0,
  12671. 0,
  12672. 0,
  12673. 0,
  12674. 0,
  12675. 0,
  12676. 0,
  12677. 0,
  12678. 0,
  12679. 0,
  12680. 0,
  12681. 0,
  12682. 0,
  12683. 0,
  12684. 0,
  12685. 0,
  12686. 0,
  12687. 0,
  12688. 0,
  12689. 0,
  12690. 0,
  12691. 0,
  12692. 0,
  12693. 0,
  12694. 0,
  12695. 0,
  12696. 0,
  12697. 0,
  12698. 0,
  12699. 0,
  12700. 0,
  12701. 0,
  12702. 0,
  12703. 0,
  12704. 0,
  12705. 0,
  12706. 0,
  12707. 0,
  12708. 0,
  12709. 0,
  12710. 0,
  12711. 0,
  12712. 0,
  12713. 0,
  12714. 0,
  12715. 0,
  12716. 0,
  12717. 0,
  12718. 0,
  12719. 0,
  12720. 0,
  12721. 0,
  12722. 0,
  12723. 0,
  12724. 0,
  12725. 0,
  12726. 0,
  12727. 0,
  12728. 0,
  12729. 0,
  12730. 0,
  12731. 0,
  12732. 0
  12733. ];
  12734. function toHexDigit(ch) {
  12735. if (ch >= 0x30 && ch <= 0x39) {
  12736. return ch & 0x0F;
  12737. }
  12738. if (ch >= 0x41 && ch <= 0x46 || ch >= 0x61 && ch <= 0x66) {
  12739. return (ch & 0x0F) + 9;
  12740. }
  12741. return -1;
  12742. }
  12743. Lexer.prototype = {
  12744. nextChar: function Lexer_nextChar() {
  12745. return this.currentChar = this.stream.getByte();
  12746. },
  12747. peekChar: function Lexer_peekChar() {
  12748. return this.stream.peekByte();
  12749. },
  12750. getNumber: function Lexer_getNumber() {
  12751. var ch = this.currentChar;
  12752. var eNotation = false;
  12753. var divideBy = 0;
  12754. var sign = 1;
  12755. if (ch === 0x2D) {
  12756. sign = -1;
  12757. ch = this.nextChar();
  12758. if (ch === 0x2D) {
  12759. ch = this.nextChar();
  12760. }
  12761. } else if (ch === 0x2B) {
  12762. ch = this.nextChar();
  12763. }
  12764. if (ch === 0x2E) {
  12765. divideBy = 10;
  12766. ch = this.nextChar();
  12767. }
  12768. if (ch < 0x30 || ch > 0x39) {
  12769. error('Invalid number: ' + String.fromCharCode(ch));
  12770. return 0;
  12771. }
  12772. var baseValue = ch - 0x30;
  12773. var powerValue = 0;
  12774. var powerValueSign = 1;
  12775. while ((ch = this.nextChar()) >= 0) {
  12776. if (0x30 <= ch && ch <= 0x39) {
  12777. var currentDigit = ch - 0x30;
  12778. if (eNotation) {
  12779. powerValue = powerValue * 10 + currentDigit;
  12780. } else {
  12781. if (divideBy !== 0) {
  12782. divideBy *= 10;
  12783. }
  12784. baseValue = baseValue * 10 + currentDigit;
  12785. }
  12786. } else if (ch === 0x2E) {
  12787. if (divideBy === 0) {
  12788. divideBy = 1;
  12789. } else {
  12790. break;
  12791. }
  12792. } else if (ch === 0x2D) {
  12793. warn('Badly formatted number');
  12794. } else if (ch === 0x45 || ch === 0x65) {
  12795. ch = this.peekChar();
  12796. if (ch === 0x2B || ch === 0x2D) {
  12797. powerValueSign = ch === 0x2D ? -1 : 1;
  12798. this.nextChar();
  12799. } else if (ch < 0x30 || ch > 0x39) {
  12800. break;
  12801. }
  12802. eNotation = true;
  12803. } else {
  12804. break;
  12805. }
  12806. }
  12807. if (divideBy !== 0) {
  12808. baseValue /= divideBy;
  12809. }
  12810. if (eNotation) {
  12811. baseValue *= Math.pow(10, powerValueSign * powerValue);
  12812. }
  12813. return sign * baseValue;
  12814. },
  12815. getString: function Lexer_getString() {
  12816. var numParen = 1;
  12817. var done = false;
  12818. var strBuf = this.strBuf;
  12819. strBuf.length = 0;
  12820. var ch = this.nextChar();
  12821. while (true) {
  12822. var charBuffered = false;
  12823. switch (ch | 0) {
  12824. case -1:
  12825. warn('Unterminated string');
  12826. done = true;
  12827. break;
  12828. case 0x28:
  12829. ++numParen;
  12830. strBuf.push('(');
  12831. break;
  12832. case 0x29:
  12833. if (--numParen === 0) {
  12834. this.nextChar();
  12835. done = true;
  12836. } else {
  12837. strBuf.push(')');
  12838. }
  12839. break;
  12840. case 0x5C:
  12841. ch = this.nextChar();
  12842. switch (ch) {
  12843. case -1:
  12844. warn('Unterminated string');
  12845. done = true;
  12846. break;
  12847. case 0x6E:
  12848. strBuf.push('\n');
  12849. break;
  12850. case 0x72:
  12851. strBuf.push('\r');
  12852. break;
  12853. case 0x74:
  12854. strBuf.push('\t');
  12855. break;
  12856. case 0x62:
  12857. strBuf.push('\b');
  12858. break;
  12859. case 0x66:
  12860. strBuf.push('\f');
  12861. break;
  12862. case 0x5C:
  12863. case 0x28:
  12864. case 0x29:
  12865. strBuf.push(String.fromCharCode(ch));
  12866. break;
  12867. case 0x30:
  12868. case 0x31:
  12869. case 0x32:
  12870. case 0x33:
  12871. case 0x34:
  12872. case 0x35:
  12873. case 0x36:
  12874. case 0x37:
  12875. var x = ch & 0x0F;
  12876. ch = this.nextChar();
  12877. charBuffered = true;
  12878. if (ch >= 0x30 && ch <= 0x37) {
  12879. x = (x << 3) + (ch & 0x0F);
  12880. ch = this.nextChar();
  12881. if (ch >= 0x30 && ch <= 0x37) {
  12882. charBuffered = false;
  12883. x = (x << 3) + (ch & 0x0F);
  12884. }
  12885. }
  12886. strBuf.push(String.fromCharCode(x));
  12887. break;
  12888. case 0x0D:
  12889. if (this.peekChar() === 0x0A) {
  12890. this.nextChar();
  12891. }
  12892. break;
  12893. case 0x0A:
  12894. break;
  12895. default:
  12896. strBuf.push(String.fromCharCode(ch));
  12897. break;
  12898. }
  12899. break;
  12900. default:
  12901. strBuf.push(String.fromCharCode(ch));
  12902. break;
  12903. }
  12904. if (done) {
  12905. break;
  12906. }
  12907. if (!charBuffered) {
  12908. ch = this.nextChar();
  12909. }
  12910. }
  12911. return strBuf.join('');
  12912. },
  12913. getName: function Lexer_getName() {
  12914. var ch, previousCh;
  12915. var strBuf = this.strBuf;
  12916. strBuf.length = 0;
  12917. while ((ch = this.nextChar()) >= 0 && !specialChars[ch]) {
  12918. if (ch === 0x23) {
  12919. ch = this.nextChar();
  12920. if (specialChars[ch]) {
  12921. warn('Lexer_getName: ' + 'NUMBER SIGN (#) should be followed by a hexadecimal number.');
  12922. strBuf.push('#');
  12923. break;
  12924. }
  12925. var x = toHexDigit(ch);
  12926. if (x !== -1) {
  12927. previousCh = ch;
  12928. ch = this.nextChar();
  12929. var x2 = toHexDigit(ch);
  12930. if (x2 === -1) {
  12931. warn('Lexer_getName: Illegal digit (' + String.fromCharCode(ch) + ') in hexadecimal number.');
  12932. strBuf.push('#', String.fromCharCode(previousCh));
  12933. if (specialChars[ch]) {
  12934. break;
  12935. }
  12936. strBuf.push(String.fromCharCode(ch));
  12937. continue;
  12938. }
  12939. strBuf.push(String.fromCharCode(x << 4 | x2));
  12940. } else {
  12941. strBuf.push('#', String.fromCharCode(ch));
  12942. }
  12943. } else {
  12944. strBuf.push(String.fromCharCode(ch));
  12945. }
  12946. }
  12947. if (strBuf.length > 127) {
  12948. warn('name token is longer than allowed by the spec: ' + strBuf.length);
  12949. }
  12950. return Name.get(strBuf.join(''));
  12951. },
  12952. getHexString: function Lexer_getHexString() {
  12953. var strBuf = this.strBuf;
  12954. strBuf.length = 0;
  12955. var ch = this.currentChar;
  12956. var isFirstHex = true;
  12957. var firstDigit;
  12958. var secondDigit;
  12959. while (true) {
  12960. if (ch < 0) {
  12961. warn('Unterminated hex string');
  12962. break;
  12963. } else if (ch === 0x3E) {
  12964. this.nextChar();
  12965. break;
  12966. } else if (specialChars[ch] === 1) {
  12967. ch = this.nextChar();
  12968. continue;
  12969. } else {
  12970. if (isFirstHex) {
  12971. firstDigit = toHexDigit(ch);
  12972. if (firstDigit === -1) {
  12973. warn('Ignoring invalid character "' + ch + '" in hex string');
  12974. ch = this.nextChar();
  12975. continue;
  12976. }
  12977. } else {
  12978. secondDigit = toHexDigit(ch);
  12979. if (secondDigit === -1) {
  12980. warn('Ignoring invalid character "' + ch + '" in hex string');
  12981. ch = this.nextChar();
  12982. continue;
  12983. }
  12984. strBuf.push(String.fromCharCode(firstDigit << 4 | secondDigit));
  12985. }
  12986. isFirstHex = !isFirstHex;
  12987. ch = this.nextChar();
  12988. }
  12989. }
  12990. return strBuf.join('');
  12991. },
  12992. getObj: function Lexer_getObj() {
  12993. var comment = false;
  12994. var ch = this.currentChar;
  12995. while (true) {
  12996. if (ch < 0) {
  12997. return EOF;
  12998. }
  12999. if (comment) {
  13000. if (ch === 0x0A || ch === 0x0D) {
  13001. comment = false;
  13002. }
  13003. } else if (ch === 0x25) {
  13004. comment = true;
  13005. } else if (specialChars[ch] !== 1) {
  13006. break;
  13007. }
  13008. ch = this.nextChar();
  13009. }
  13010. switch (ch | 0) {
  13011. case 0x30:
  13012. case 0x31:
  13013. case 0x32:
  13014. case 0x33:
  13015. case 0x34:
  13016. case 0x35:
  13017. case 0x36:
  13018. case 0x37:
  13019. case 0x38:
  13020. case 0x39:
  13021. case 0x2B:
  13022. case 0x2D:
  13023. case 0x2E:
  13024. return this.getNumber();
  13025. case 0x28:
  13026. return this.getString();
  13027. case 0x2F:
  13028. return this.getName();
  13029. case 0x5B:
  13030. this.nextChar();
  13031. return Cmd.get('[');
  13032. case 0x5D:
  13033. this.nextChar();
  13034. return Cmd.get(']');
  13035. case 0x3C:
  13036. ch = this.nextChar();
  13037. if (ch === 0x3C) {
  13038. this.nextChar();
  13039. return Cmd.get('<<');
  13040. }
  13041. return this.getHexString();
  13042. case 0x3E:
  13043. ch = this.nextChar();
  13044. if (ch === 0x3E) {
  13045. this.nextChar();
  13046. return Cmd.get('>>');
  13047. }
  13048. return Cmd.get('>');
  13049. case 0x7B:
  13050. this.nextChar();
  13051. return Cmd.get('{');
  13052. case 0x7D:
  13053. this.nextChar();
  13054. return Cmd.get('}');
  13055. case 0x29:
  13056. this.nextChar();
  13057. error('Illegal character: ' + ch);
  13058. break;
  13059. }
  13060. var str = String.fromCharCode(ch);
  13061. var knownCommands = this.knownCommands;
  13062. var knownCommandFound = knownCommands && knownCommands[str] !== undefined;
  13063. while ((ch = this.nextChar()) >= 0 && !specialChars[ch]) {
  13064. var possibleCommand = str + String.fromCharCode(ch);
  13065. if (knownCommandFound && knownCommands[possibleCommand] === undefined) {
  13066. break;
  13067. }
  13068. if (str.length === 128) {
  13069. error('Command token too long: ' + str.length);
  13070. }
  13071. str = possibleCommand;
  13072. knownCommandFound = knownCommands && knownCommands[str] !== undefined;
  13073. }
  13074. if (str === 'true') {
  13075. return true;
  13076. }
  13077. if (str === 'false') {
  13078. return false;
  13079. }
  13080. if (str === 'null') {
  13081. return null;
  13082. }
  13083. return Cmd.get(str);
  13084. },
  13085. skipToNextLine: function Lexer_skipToNextLine() {
  13086. var ch = this.currentChar;
  13087. while (ch >= 0) {
  13088. if (ch === 0x0D) {
  13089. ch = this.nextChar();
  13090. if (ch === 0x0A) {
  13091. this.nextChar();
  13092. }
  13093. break;
  13094. } else if (ch === 0x0A) {
  13095. this.nextChar();
  13096. break;
  13097. }
  13098. ch = this.nextChar();
  13099. }
  13100. }
  13101. };
  13102. return Lexer;
  13103. }();
  13104. var Linearization = {
  13105. create: function LinearizationCreate(stream) {
  13106. function getInt(name, allowZeroValue) {
  13107. var obj = linDict.get(name);
  13108. if (isInt(obj) && (allowZeroValue ? obj >= 0 : obj > 0)) {
  13109. return obj;
  13110. }
  13111. throw new Error('The "' + name + '" parameter in the linearization ' + 'dictionary is invalid.');
  13112. }
  13113. function getHints() {
  13114. var hints = linDict.get('H'), hintsLength, item;
  13115. if (isArray(hints) && ((hintsLength = hints.length) === 2 || hintsLength === 4)) {
  13116. for (var index = 0; index < hintsLength; index++) {
  13117. if (!(isInt(item = hints[index]) && item > 0)) {
  13118. throw new Error('Hint (' + index + ') in the linearization dictionary is invalid.');
  13119. }
  13120. }
  13121. return hints;
  13122. }
  13123. throw new Error('Hint array in the linearization dictionary is invalid.');
  13124. }
  13125. var parser = new Parser(new Lexer(stream), false, null);
  13126. var obj1 = parser.getObj();
  13127. var obj2 = parser.getObj();
  13128. var obj3 = parser.getObj();
  13129. var linDict = parser.getObj();
  13130. var obj, length;
  13131. if (!(isInt(obj1) && isInt(obj2) && isCmd(obj3, 'obj') && isDict(linDict) && isNum(obj = linDict.get('Linearized')) && obj > 0)) {
  13132. return null;
  13133. } else if ((length = getInt('L')) !== stream.length) {
  13134. throw new Error('The "L" parameter in the linearization dictionary ' + 'does not equal the stream length.');
  13135. }
  13136. return {
  13137. length: length,
  13138. hints: getHints(),
  13139. objectNumberFirst: getInt('O'),
  13140. endFirst: getInt('E'),
  13141. numPages: getInt('N'),
  13142. mainXRefEntriesOffset: getInt('T'),
  13143. pageFirst: linDict.has('P') ? getInt('P', true) : 0
  13144. };
  13145. }
  13146. };
  13147. exports.Lexer = Lexer;
  13148. exports.Linearization = Linearization;
  13149. exports.Parser = Parser;
  13150. /***/ }),
  13151. /* 6 */
  13152. /***/ (function(module, exports, __w_pdfjs_require__) {
  13153. "use strict";
  13154. var sharedUtil = __w_pdfjs_require__(0);
  13155. var corePrimitives = __w_pdfjs_require__(1);
  13156. var corePsParser = __w_pdfjs_require__(34);
  13157. var error = sharedUtil.error;
  13158. var info = sharedUtil.info;
  13159. var isArray = sharedUtil.isArray;
  13160. var isBool = sharedUtil.isBool;
  13161. var isDict = corePrimitives.isDict;
  13162. var isStream = corePrimitives.isStream;
  13163. var PostScriptLexer = corePsParser.PostScriptLexer;
  13164. var PostScriptParser = corePsParser.PostScriptParser;
  13165. var PDFFunction = function PDFFunctionClosure() {
  13166. var CONSTRUCT_SAMPLED = 0;
  13167. var CONSTRUCT_INTERPOLATED = 2;
  13168. var CONSTRUCT_STICHED = 3;
  13169. var CONSTRUCT_POSTSCRIPT = 4;
  13170. return {
  13171. getSampleArray: function PDFFunction_getSampleArray(size, outputSize, bps, str) {
  13172. var i, ii;
  13173. var length = 1;
  13174. for (i = 0, ii = size.length; i < ii; i++) {
  13175. length *= size[i];
  13176. }
  13177. length *= outputSize;
  13178. var array = new Array(length);
  13179. var codeSize = 0;
  13180. var codeBuf = 0;
  13181. var sampleMul = 1.0 / (Math.pow(2.0, bps) - 1);
  13182. var strBytes = str.getBytes((length * bps + 7) / 8);
  13183. var strIdx = 0;
  13184. for (i = 0; i < length; i++) {
  13185. while (codeSize < bps) {
  13186. codeBuf <<= 8;
  13187. codeBuf |= strBytes[strIdx++];
  13188. codeSize += 8;
  13189. }
  13190. codeSize -= bps;
  13191. array[i] = (codeBuf >> codeSize) * sampleMul;
  13192. codeBuf &= (1 << codeSize) - 1;
  13193. }
  13194. return array;
  13195. },
  13196. getIR: function PDFFunction_getIR(xref, fn) {
  13197. var dict = fn.dict;
  13198. if (!dict) {
  13199. dict = fn;
  13200. }
  13201. var types = [
  13202. this.constructSampled,
  13203. null,
  13204. this.constructInterpolated,
  13205. this.constructStiched,
  13206. this.constructPostScript
  13207. ];
  13208. var typeNum = dict.get('FunctionType');
  13209. var typeFn = types[typeNum];
  13210. if (!typeFn) {
  13211. error('Unknown type of function');
  13212. }
  13213. return typeFn.call(this, fn, dict, xref);
  13214. },
  13215. fromIR: function PDFFunction_fromIR(IR) {
  13216. var type = IR[0];
  13217. switch (type) {
  13218. case CONSTRUCT_SAMPLED:
  13219. return this.constructSampledFromIR(IR);
  13220. case CONSTRUCT_INTERPOLATED:
  13221. return this.constructInterpolatedFromIR(IR);
  13222. case CONSTRUCT_STICHED:
  13223. return this.constructStichedFromIR(IR);
  13224. default:
  13225. return this.constructPostScriptFromIR(IR);
  13226. }
  13227. },
  13228. parse: function PDFFunction_parse(xref, fn) {
  13229. var IR = this.getIR(xref, fn);
  13230. return this.fromIR(IR);
  13231. },
  13232. parseArray: function PDFFunction_parseArray(xref, fnObj) {
  13233. if (!isArray(fnObj)) {
  13234. return this.parse(xref, fnObj);
  13235. }
  13236. var fnArray = [];
  13237. for (var j = 0, jj = fnObj.length; j < jj; j++) {
  13238. var obj = xref.fetchIfRef(fnObj[j]);
  13239. fnArray.push(PDFFunction.parse(xref, obj));
  13240. }
  13241. return function (src, srcOffset, dest, destOffset) {
  13242. for (var i = 0, ii = fnArray.length; i < ii; i++) {
  13243. fnArray[i](src, srcOffset, dest, destOffset + i);
  13244. }
  13245. };
  13246. },
  13247. constructSampled: function PDFFunction_constructSampled(str, dict) {
  13248. function toMultiArray(arr) {
  13249. var inputLength = arr.length;
  13250. var out = [];
  13251. var index = 0;
  13252. for (var i = 0; i < inputLength; i += 2) {
  13253. out[index] = [
  13254. arr[i],
  13255. arr[i + 1]
  13256. ];
  13257. ++index;
  13258. }
  13259. return out;
  13260. }
  13261. var domain = dict.getArray('Domain');
  13262. var range = dict.getArray('Range');
  13263. if (!domain || !range) {
  13264. error('No domain or range');
  13265. }
  13266. var inputSize = domain.length / 2;
  13267. var outputSize = range.length / 2;
  13268. domain = toMultiArray(domain);
  13269. range = toMultiArray(range);
  13270. var size = dict.get('Size');
  13271. var bps = dict.get('BitsPerSample');
  13272. var order = dict.get('Order') || 1;
  13273. if (order !== 1) {
  13274. info('No support for cubic spline interpolation: ' + order);
  13275. }
  13276. var encode = dict.getArray('Encode');
  13277. if (!encode) {
  13278. encode = [];
  13279. for (var i = 0; i < inputSize; ++i) {
  13280. encode.push(0);
  13281. encode.push(size[i] - 1);
  13282. }
  13283. }
  13284. encode = toMultiArray(encode);
  13285. var decode = dict.getArray('Decode');
  13286. if (!decode) {
  13287. decode = range;
  13288. } else {
  13289. decode = toMultiArray(decode);
  13290. }
  13291. var samples = this.getSampleArray(size, outputSize, bps, str);
  13292. return [
  13293. CONSTRUCT_SAMPLED,
  13294. inputSize,
  13295. domain,
  13296. encode,
  13297. decode,
  13298. samples,
  13299. size,
  13300. outputSize,
  13301. Math.pow(2, bps) - 1,
  13302. range
  13303. ];
  13304. },
  13305. constructSampledFromIR: function PDFFunction_constructSampledFromIR(IR) {
  13306. function interpolate(x, xmin, xmax, ymin, ymax) {
  13307. return ymin + (x - xmin) * ((ymax - ymin) / (xmax - xmin));
  13308. }
  13309. return function constructSampledFromIRResult(src, srcOffset, dest, destOffset) {
  13310. var m = IR[1];
  13311. var domain = IR[2];
  13312. var encode = IR[3];
  13313. var decode = IR[4];
  13314. var samples = IR[5];
  13315. var size = IR[6];
  13316. var n = IR[7];
  13317. var range = IR[9];
  13318. var cubeVertices = 1 << m;
  13319. var cubeN = new Float64Array(cubeVertices);
  13320. var cubeVertex = new Uint32Array(cubeVertices);
  13321. var i, j;
  13322. for (j = 0; j < cubeVertices; j++) {
  13323. cubeN[j] = 1;
  13324. }
  13325. var k = n, pos = 1;
  13326. for (i = 0; i < m; ++i) {
  13327. var domain_2i = domain[i][0];
  13328. var domain_2i_1 = domain[i][1];
  13329. var xi = Math.min(Math.max(src[srcOffset + i], domain_2i), domain_2i_1);
  13330. var e = interpolate(xi, domain_2i, domain_2i_1, encode[i][0], encode[i][1]);
  13331. var size_i = size[i];
  13332. e = Math.min(Math.max(e, 0), size_i - 1);
  13333. var e0 = e < size_i - 1 ? Math.floor(e) : e - 1;
  13334. var n0 = e0 + 1 - e;
  13335. var n1 = e - e0;
  13336. var offset0 = e0 * k;
  13337. var offset1 = offset0 + k;
  13338. for (j = 0; j < cubeVertices; j++) {
  13339. if (j & pos) {
  13340. cubeN[j] *= n1;
  13341. cubeVertex[j] += offset1;
  13342. } else {
  13343. cubeN[j] *= n0;
  13344. cubeVertex[j] += offset0;
  13345. }
  13346. }
  13347. k *= size_i;
  13348. pos <<= 1;
  13349. }
  13350. for (j = 0; j < n; ++j) {
  13351. var rj = 0;
  13352. for (i = 0; i < cubeVertices; i++) {
  13353. rj += samples[cubeVertex[i] + j] * cubeN[i];
  13354. }
  13355. rj = interpolate(rj, 0, 1, decode[j][0], decode[j][1]);
  13356. dest[destOffset + j] = Math.min(Math.max(rj, range[j][0]), range[j][1]);
  13357. }
  13358. };
  13359. },
  13360. constructInterpolated: function PDFFunction_constructInterpolated(str, dict) {
  13361. var c0 = dict.getArray('C0') || [0];
  13362. var c1 = dict.getArray('C1') || [1];
  13363. var n = dict.get('N');
  13364. if (!isArray(c0) || !isArray(c1)) {
  13365. error('Illegal dictionary for interpolated function');
  13366. }
  13367. var length = c0.length;
  13368. var diff = [];
  13369. for (var i = 0; i < length; ++i) {
  13370. diff.push(c1[i] - c0[i]);
  13371. }
  13372. return [
  13373. CONSTRUCT_INTERPOLATED,
  13374. c0,
  13375. diff,
  13376. n
  13377. ];
  13378. },
  13379. constructInterpolatedFromIR: function PDFFunction_constructInterpolatedFromIR(IR) {
  13380. var c0 = IR[1];
  13381. var diff = IR[2];
  13382. var n = IR[3];
  13383. var length = diff.length;
  13384. return function constructInterpolatedFromIRResult(src, srcOffset, dest, destOffset) {
  13385. var x = n === 1 ? src[srcOffset] : Math.pow(src[srcOffset], n);
  13386. for (var j = 0; j < length; ++j) {
  13387. dest[destOffset + j] = c0[j] + x * diff[j];
  13388. }
  13389. };
  13390. },
  13391. constructStiched: function PDFFunction_constructStiched(fn, dict, xref) {
  13392. var domain = dict.getArray('Domain');
  13393. if (!domain) {
  13394. error('No domain');
  13395. }
  13396. var inputSize = domain.length / 2;
  13397. if (inputSize !== 1) {
  13398. error('Bad domain for stiched function');
  13399. }
  13400. var fnRefs = dict.get('Functions');
  13401. var fns = [];
  13402. for (var i = 0, ii = fnRefs.length; i < ii; ++i) {
  13403. fns.push(PDFFunction.getIR(xref, xref.fetchIfRef(fnRefs[i])));
  13404. }
  13405. var bounds = dict.getArray('Bounds');
  13406. var encode = dict.getArray('Encode');
  13407. return [
  13408. CONSTRUCT_STICHED,
  13409. domain,
  13410. bounds,
  13411. encode,
  13412. fns
  13413. ];
  13414. },
  13415. constructStichedFromIR: function PDFFunction_constructStichedFromIR(IR) {
  13416. var domain = IR[1];
  13417. var bounds = IR[2];
  13418. var encode = IR[3];
  13419. var fnsIR = IR[4];
  13420. var fns = [];
  13421. var tmpBuf = new Float32Array(1);
  13422. for (var i = 0, ii = fnsIR.length; i < ii; i++) {
  13423. fns.push(PDFFunction.fromIR(fnsIR[i]));
  13424. }
  13425. return function constructStichedFromIRResult(src, srcOffset, dest, destOffset) {
  13426. var clip = function constructStichedFromIRClip(v, min, max) {
  13427. if (v > max) {
  13428. v = max;
  13429. } else if (v < min) {
  13430. v = min;
  13431. }
  13432. return v;
  13433. };
  13434. var v = clip(src[srcOffset], domain[0], domain[1]);
  13435. for (var i = 0, ii = bounds.length; i < ii; ++i) {
  13436. if (v < bounds[i]) {
  13437. break;
  13438. }
  13439. }
  13440. var dmin = domain[0];
  13441. if (i > 0) {
  13442. dmin = bounds[i - 1];
  13443. }
  13444. var dmax = domain[1];
  13445. if (i < bounds.length) {
  13446. dmax = bounds[i];
  13447. }
  13448. var rmin = encode[2 * i];
  13449. var rmax = encode[2 * i + 1];
  13450. tmpBuf[0] = dmin === dmax ? rmin : rmin + (v - dmin) * (rmax - rmin) / (dmax - dmin);
  13451. fns[i](tmpBuf, 0, dest, destOffset);
  13452. };
  13453. },
  13454. constructPostScript: function PDFFunction_constructPostScript(fn, dict, xref) {
  13455. var domain = dict.getArray('Domain');
  13456. var range = dict.getArray('Range');
  13457. if (!domain) {
  13458. error('No domain.');
  13459. }
  13460. if (!range) {
  13461. error('No range.');
  13462. }
  13463. var lexer = new PostScriptLexer(fn);
  13464. var parser = new PostScriptParser(lexer);
  13465. var code = parser.parse();
  13466. return [
  13467. CONSTRUCT_POSTSCRIPT,
  13468. domain,
  13469. range,
  13470. code
  13471. ];
  13472. },
  13473. constructPostScriptFromIR: function PDFFunction_constructPostScriptFromIR(IR) {
  13474. var domain = IR[1];
  13475. var range = IR[2];
  13476. var code = IR[3];
  13477. var compiled = new PostScriptCompiler().compile(code, domain, range);
  13478. if (compiled) {
  13479. return new Function('src', 'srcOffset', 'dest', 'destOffset', compiled);
  13480. }
  13481. info('Unable to compile PS function');
  13482. var numOutputs = range.length >> 1;
  13483. var numInputs = domain.length >> 1;
  13484. var evaluator = new PostScriptEvaluator(code);
  13485. var cache = Object.create(null);
  13486. var MAX_CACHE_SIZE = 2048 * 4;
  13487. var cache_available = MAX_CACHE_SIZE;
  13488. var tmpBuf = new Float32Array(numInputs);
  13489. return function constructPostScriptFromIRResult(src, srcOffset, dest, destOffset) {
  13490. var i, value;
  13491. var key = '';
  13492. var input = tmpBuf;
  13493. for (i = 0; i < numInputs; i++) {
  13494. value = src[srcOffset + i];
  13495. input[i] = value;
  13496. key += value + '_';
  13497. }
  13498. var cachedValue = cache[key];
  13499. if (cachedValue !== undefined) {
  13500. dest.set(cachedValue, destOffset);
  13501. return;
  13502. }
  13503. var output = new Float32Array(numOutputs);
  13504. var stack = evaluator.execute(input);
  13505. var stackIndex = stack.length - numOutputs;
  13506. for (i = 0; i < numOutputs; i++) {
  13507. value = stack[stackIndex + i];
  13508. var bound = range[i * 2];
  13509. if (value < bound) {
  13510. value = bound;
  13511. } else {
  13512. bound = range[i * 2 + 1];
  13513. if (value > bound) {
  13514. value = bound;
  13515. }
  13516. }
  13517. output[i] = value;
  13518. }
  13519. if (cache_available > 0) {
  13520. cache_available--;
  13521. cache[key] = output;
  13522. }
  13523. dest.set(output, destOffset);
  13524. };
  13525. }
  13526. };
  13527. }();
  13528. function isPDFFunction(v) {
  13529. var fnDict;
  13530. if (typeof v !== 'object') {
  13531. return false;
  13532. } else if (isDict(v)) {
  13533. fnDict = v;
  13534. } else if (isStream(v)) {
  13535. fnDict = v.dict;
  13536. } else {
  13537. return false;
  13538. }
  13539. return fnDict.has('FunctionType');
  13540. }
  13541. var PostScriptStack = function PostScriptStackClosure() {
  13542. var MAX_STACK_SIZE = 100;
  13543. function PostScriptStack(initialStack) {
  13544. this.stack = !initialStack ? [] : Array.prototype.slice.call(initialStack, 0);
  13545. }
  13546. PostScriptStack.prototype = {
  13547. push: function PostScriptStack_push(value) {
  13548. if (this.stack.length >= MAX_STACK_SIZE) {
  13549. error('PostScript function stack overflow.');
  13550. }
  13551. this.stack.push(value);
  13552. },
  13553. pop: function PostScriptStack_pop() {
  13554. if (this.stack.length <= 0) {
  13555. error('PostScript function stack underflow.');
  13556. }
  13557. return this.stack.pop();
  13558. },
  13559. copy: function PostScriptStack_copy(n) {
  13560. if (this.stack.length + n >= MAX_STACK_SIZE) {
  13561. error('PostScript function stack overflow.');
  13562. }
  13563. var stack = this.stack;
  13564. for (var i = stack.length - n, j = n - 1; j >= 0; j--, i++) {
  13565. stack.push(stack[i]);
  13566. }
  13567. },
  13568. index: function PostScriptStack_index(n) {
  13569. this.push(this.stack[this.stack.length - n - 1]);
  13570. },
  13571. roll: function PostScriptStack_roll(n, p) {
  13572. var stack = this.stack;
  13573. var l = stack.length - n;
  13574. var r = stack.length - 1, c = l + (p - Math.floor(p / n) * n), i, j, t;
  13575. for (i = l, j = r; i < j; i++, j--) {
  13576. t = stack[i];
  13577. stack[i] = stack[j];
  13578. stack[j] = t;
  13579. }
  13580. for (i = l, j = c - 1; i < j; i++, j--) {
  13581. t = stack[i];
  13582. stack[i] = stack[j];
  13583. stack[j] = t;
  13584. }
  13585. for (i = c, j = r; i < j; i++, j--) {
  13586. t = stack[i];
  13587. stack[i] = stack[j];
  13588. stack[j] = t;
  13589. }
  13590. }
  13591. };
  13592. return PostScriptStack;
  13593. }();
  13594. var PostScriptEvaluator = function PostScriptEvaluatorClosure() {
  13595. function PostScriptEvaluator(operators) {
  13596. this.operators = operators;
  13597. }
  13598. PostScriptEvaluator.prototype = {
  13599. execute: function PostScriptEvaluator_execute(initialStack) {
  13600. var stack = new PostScriptStack(initialStack);
  13601. var counter = 0;
  13602. var operators = this.operators;
  13603. var length = operators.length;
  13604. var operator, a, b;
  13605. while (counter < length) {
  13606. operator = operators[counter++];
  13607. if (typeof operator === 'number') {
  13608. stack.push(operator);
  13609. continue;
  13610. }
  13611. switch (operator) {
  13612. case 'jz':
  13613. b = stack.pop();
  13614. a = stack.pop();
  13615. if (!a) {
  13616. counter = b;
  13617. }
  13618. break;
  13619. case 'j':
  13620. a = stack.pop();
  13621. counter = a;
  13622. break;
  13623. case 'abs':
  13624. a = stack.pop();
  13625. stack.push(Math.abs(a));
  13626. break;
  13627. case 'add':
  13628. b = stack.pop();
  13629. a = stack.pop();
  13630. stack.push(a + b);
  13631. break;
  13632. case 'and':
  13633. b = stack.pop();
  13634. a = stack.pop();
  13635. if (isBool(a) && isBool(b)) {
  13636. stack.push(a && b);
  13637. } else {
  13638. stack.push(a & b);
  13639. }
  13640. break;
  13641. case 'atan':
  13642. a = stack.pop();
  13643. stack.push(Math.atan(a));
  13644. break;
  13645. case 'bitshift':
  13646. b = stack.pop();
  13647. a = stack.pop();
  13648. if (a > 0) {
  13649. stack.push(a << b);
  13650. } else {
  13651. stack.push(a >> b);
  13652. }
  13653. break;
  13654. case 'ceiling':
  13655. a = stack.pop();
  13656. stack.push(Math.ceil(a));
  13657. break;
  13658. case 'copy':
  13659. a = stack.pop();
  13660. stack.copy(a);
  13661. break;
  13662. case 'cos':
  13663. a = stack.pop();
  13664. stack.push(Math.cos(a));
  13665. break;
  13666. case 'cvi':
  13667. a = stack.pop() | 0;
  13668. stack.push(a);
  13669. break;
  13670. case 'cvr':
  13671. break;
  13672. case 'div':
  13673. b = stack.pop();
  13674. a = stack.pop();
  13675. stack.push(a / b);
  13676. break;
  13677. case 'dup':
  13678. stack.copy(1);
  13679. break;
  13680. case 'eq':
  13681. b = stack.pop();
  13682. a = stack.pop();
  13683. stack.push(a === b);
  13684. break;
  13685. case 'exch':
  13686. stack.roll(2, 1);
  13687. break;
  13688. case 'exp':
  13689. b = stack.pop();
  13690. a = stack.pop();
  13691. stack.push(Math.pow(a, b));
  13692. break;
  13693. case 'false':
  13694. stack.push(false);
  13695. break;
  13696. case 'floor':
  13697. a = stack.pop();
  13698. stack.push(Math.floor(a));
  13699. break;
  13700. case 'ge':
  13701. b = stack.pop();
  13702. a = stack.pop();
  13703. stack.push(a >= b);
  13704. break;
  13705. case 'gt':
  13706. b = stack.pop();
  13707. a = stack.pop();
  13708. stack.push(a > b);
  13709. break;
  13710. case 'idiv':
  13711. b = stack.pop();
  13712. a = stack.pop();
  13713. stack.push(a / b | 0);
  13714. break;
  13715. case 'index':
  13716. a = stack.pop();
  13717. stack.index(a);
  13718. break;
  13719. case 'le':
  13720. b = stack.pop();
  13721. a = stack.pop();
  13722. stack.push(a <= b);
  13723. break;
  13724. case 'ln':
  13725. a = stack.pop();
  13726. stack.push(Math.log(a));
  13727. break;
  13728. case 'log':
  13729. a = stack.pop();
  13730. stack.push(Math.log(a) / Math.LN10);
  13731. break;
  13732. case 'lt':
  13733. b = stack.pop();
  13734. a = stack.pop();
  13735. stack.push(a < b);
  13736. break;
  13737. case 'mod':
  13738. b = stack.pop();
  13739. a = stack.pop();
  13740. stack.push(a % b);
  13741. break;
  13742. case 'mul':
  13743. b = stack.pop();
  13744. a = stack.pop();
  13745. stack.push(a * b);
  13746. break;
  13747. case 'ne':
  13748. b = stack.pop();
  13749. a = stack.pop();
  13750. stack.push(a !== b);
  13751. break;
  13752. case 'neg':
  13753. a = stack.pop();
  13754. stack.push(-a);
  13755. break;
  13756. case 'not':
  13757. a = stack.pop();
  13758. if (isBool(a)) {
  13759. stack.push(!a);
  13760. } else {
  13761. stack.push(~a);
  13762. }
  13763. break;
  13764. case 'or':
  13765. b = stack.pop();
  13766. a = stack.pop();
  13767. if (isBool(a) && isBool(b)) {
  13768. stack.push(a || b);
  13769. } else {
  13770. stack.push(a | b);
  13771. }
  13772. break;
  13773. case 'pop':
  13774. stack.pop();
  13775. break;
  13776. case 'roll':
  13777. b = stack.pop();
  13778. a = stack.pop();
  13779. stack.roll(a, b);
  13780. break;
  13781. case 'round':
  13782. a = stack.pop();
  13783. stack.push(Math.round(a));
  13784. break;
  13785. case 'sin':
  13786. a = stack.pop();
  13787. stack.push(Math.sin(a));
  13788. break;
  13789. case 'sqrt':
  13790. a = stack.pop();
  13791. stack.push(Math.sqrt(a));
  13792. break;
  13793. case 'sub':
  13794. b = stack.pop();
  13795. a = stack.pop();
  13796. stack.push(a - b);
  13797. break;
  13798. case 'true':
  13799. stack.push(true);
  13800. break;
  13801. case 'truncate':
  13802. a = stack.pop();
  13803. a = a < 0 ? Math.ceil(a) : Math.floor(a);
  13804. stack.push(a);
  13805. break;
  13806. case 'xor':
  13807. b = stack.pop();
  13808. a = stack.pop();
  13809. if (isBool(a) && isBool(b)) {
  13810. stack.push(a !== b);
  13811. } else {
  13812. stack.push(a ^ b);
  13813. }
  13814. break;
  13815. default:
  13816. error('Unknown operator ' + operator);
  13817. break;
  13818. }
  13819. }
  13820. return stack.stack;
  13821. }
  13822. };
  13823. return PostScriptEvaluator;
  13824. }();
  13825. var PostScriptCompiler = function PostScriptCompilerClosure() {
  13826. function AstNode(type) {
  13827. this.type = type;
  13828. }
  13829. AstNode.prototype.visit = function (visitor) {
  13830. throw new Error('abstract method');
  13831. };
  13832. function AstArgument(index, min, max) {
  13833. AstNode.call(this, 'args');
  13834. this.index = index;
  13835. this.min = min;
  13836. this.max = max;
  13837. }
  13838. AstArgument.prototype = Object.create(AstNode.prototype);
  13839. AstArgument.prototype.visit = function (visitor) {
  13840. visitor.visitArgument(this);
  13841. };
  13842. function AstLiteral(number) {
  13843. AstNode.call(this, 'literal');
  13844. this.number = number;
  13845. this.min = number;
  13846. this.max = number;
  13847. }
  13848. AstLiteral.prototype = Object.create(AstNode.prototype);
  13849. AstLiteral.prototype.visit = function (visitor) {
  13850. visitor.visitLiteral(this);
  13851. };
  13852. function AstBinaryOperation(op, arg1, arg2, min, max) {
  13853. AstNode.call(this, 'binary');
  13854. this.op = op;
  13855. this.arg1 = arg1;
  13856. this.arg2 = arg2;
  13857. this.min = min;
  13858. this.max = max;
  13859. }
  13860. AstBinaryOperation.prototype = Object.create(AstNode.prototype);
  13861. AstBinaryOperation.prototype.visit = function (visitor) {
  13862. visitor.visitBinaryOperation(this);
  13863. };
  13864. function AstMin(arg, max) {
  13865. AstNode.call(this, 'max');
  13866. this.arg = arg;
  13867. this.min = arg.min;
  13868. this.max = max;
  13869. }
  13870. AstMin.prototype = Object.create(AstNode.prototype);
  13871. AstMin.prototype.visit = function (visitor) {
  13872. visitor.visitMin(this);
  13873. };
  13874. function AstVariable(index, min, max) {
  13875. AstNode.call(this, 'var');
  13876. this.index = index;
  13877. this.min = min;
  13878. this.max = max;
  13879. }
  13880. AstVariable.prototype = Object.create(AstNode.prototype);
  13881. AstVariable.prototype.visit = function (visitor) {
  13882. visitor.visitVariable(this);
  13883. };
  13884. function AstVariableDefinition(variable, arg) {
  13885. AstNode.call(this, 'definition');
  13886. this.variable = variable;
  13887. this.arg = arg;
  13888. }
  13889. AstVariableDefinition.prototype = Object.create(AstNode.prototype);
  13890. AstVariableDefinition.prototype.visit = function (visitor) {
  13891. visitor.visitVariableDefinition(this);
  13892. };
  13893. function ExpressionBuilderVisitor() {
  13894. this.parts = [];
  13895. }
  13896. ExpressionBuilderVisitor.prototype = {
  13897. visitArgument: function (arg) {
  13898. this.parts.push('Math.max(', arg.min, ', Math.min(', arg.max, ', src[srcOffset + ', arg.index, ']))');
  13899. },
  13900. visitVariable: function (variable) {
  13901. this.parts.push('v', variable.index);
  13902. },
  13903. visitLiteral: function (literal) {
  13904. this.parts.push(literal.number);
  13905. },
  13906. visitBinaryOperation: function (operation) {
  13907. this.parts.push('(');
  13908. operation.arg1.visit(this);
  13909. this.parts.push(' ', operation.op, ' ');
  13910. operation.arg2.visit(this);
  13911. this.parts.push(')');
  13912. },
  13913. visitVariableDefinition: function (definition) {
  13914. this.parts.push('var ');
  13915. definition.variable.visit(this);
  13916. this.parts.push(' = ');
  13917. definition.arg.visit(this);
  13918. this.parts.push(';');
  13919. },
  13920. visitMin: function (max) {
  13921. this.parts.push('Math.min(');
  13922. max.arg.visit(this);
  13923. this.parts.push(', ', max.max, ')');
  13924. },
  13925. toString: function () {
  13926. return this.parts.join('');
  13927. }
  13928. };
  13929. function buildAddOperation(num1, num2) {
  13930. if (num2.type === 'literal' && num2.number === 0) {
  13931. return num1;
  13932. }
  13933. if (num1.type === 'literal' && num1.number === 0) {
  13934. return num2;
  13935. }
  13936. if (num2.type === 'literal' && num1.type === 'literal') {
  13937. return new AstLiteral(num1.number + num2.number);
  13938. }
  13939. return new AstBinaryOperation('+', num1, num2, num1.min + num2.min, num1.max + num2.max);
  13940. }
  13941. function buildMulOperation(num1, num2) {
  13942. if (num2.type === 'literal') {
  13943. if (num2.number === 0) {
  13944. return new AstLiteral(0);
  13945. } else if (num2.number === 1) {
  13946. return num1;
  13947. } else if (num1.type === 'literal') {
  13948. return new AstLiteral(num1.number * num2.number);
  13949. }
  13950. }
  13951. if (num1.type === 'literal') {
  13952. if (num1.number === 0) {
  13953. return new AstLiteral(0);
  13954. } else if (num1.number === 1) {
  13955. return num2;
  13956. }
  13957. }
  13958. var min = Math.min(num1.min * num2.min, num1.min * num2.max, num1.max * num2.min, num1.max * num2.max);
  13959. var max = Math.max(num1.min * num2.min, num1.min * num2.max, num1.max * num2.min, num1.max * num2.max);
  13960. return new AstBinaryOperation('*', num1, num2, min, max);
  13961. }
  13962. function buildSubOperation(num1, num2) {
  13963. if (num2.type === 'literal') {
  13964. if (num2.number === 0) {
  13965. return num1;
  13966. } else if (num1.type === 'literal') {
  13967. return new AstLiteral(num1.number - num2.number);
  13968. }
  13969. }
  13970. if (num2.type === 'binary' && num2.op === '-' && num1.type === 'literal' && num1.number === 1 && num2.arg1.type === 'literal' && num2.arg1.number === 1) {
  13971. return num2.arg2;
  13972. }
  13973. return new AstBinaryOperation('-', num1, num2, num1.min - num2.max, num1.max - num2.min);
  13974. }
  13975. function buildMinOperation(num1, max) {
  13976. if (num1.min >= max) {
  13977. return new AstLiteral(max);
  13978. } else if (num1.max <= max) {
  13979. return num1;
  13980. }
  13981. return new AstMin(num1, max);
  13982. }
  13983. function PostScriptCompiler() {
  13984. }
  13985. PostScriptCompiler.prototype = {
  13986. compile: function PostScriptCompiler_compile(code, domain, range) {
  13987. var stack = [];
  13988. var i, ii;
  13989. var instructions = [];
  13990. var inputSize = domain.length >> 1, outputSize = range.length >> 1;
  13991. var lastRegister = 0;
  13992. var n, j;
  13993. var num1, num2, ast1, ast2, tmpVar, item;
  13994. for (i = 0; i < inputSize; i++) {
  13995. stack.push(new AstArgument(i, domain[i * 2], domain[i * 2 + 1]));
  13996. }
  13997. for (i = 0, ii = code.length; i < ii; i++) {
  13998. item = code[i];
  13999. if (typeof item === 'number') {
  14000. stack.push(new AstLiteral(item));
  14001. continue;
  14002. }
  14003. switch (item) {
  14004. case 'add':
  14005. if (stack.length < 2) {
  14006. return null;
  14007. }
  14008. num2 = stack.pop();
  14009. num1 = stack.pop();
  14010. stack.push(buildAddOperation(num1, num2));
  14011. break;
  14012. case 'cvr':
  14013. if (stack.length < 1) {
  14014. return null;
  14015. }
  14016. break;
  14017. case 'mul':
  14018. if (stack.length < 2) {
  14019. return null;
  14020. }
  14021. num2 = stack.pop();
  14022. num1 = stack.pop();
  14023. stack.push(buildMulOperation(num1, num2));
  14024. break;
  14025. case 'sub':
  14026. if (stack.length < 2) {
  14027. return null;
  14028. }
  14029. num2 = stack.pop();
  14030. num1 = stack.pop();
  14031. stack.push(buildSubOperation(num1, num2));
  14032. break;
  14033. case 'exch':
  14034. if (stack.length < 2) {
  14035. return null;
  14036. }
  14037. ast1 = stack.pop();
  14038. ast2 = stack.pop();
  14039. stack.push(ast1, ast2);
  14040. break;
  14041. case 'pop':
  14042. if (stack.length < 1) {
  14043. return null;
  14044. }
  14045. stack.pop();
  14046. break;
  14047. case 'index':
  14048. if (stack.length < 1) {
  14049. return null;
  14050. }
  14051. num1 = stack.pop();
  14052. if (num1.type !== 'literal') {
  14053. return null;
  14054. }
  14055. n = num1.number;
  14056. if (n < 0 || (n | 0) !== n || stack.length < n) {
  14057. return null;
  14058. }
  14059. ast1 = stack[stack.length - n - 1];
  14060. if (ast1.type === 'literal' || ast1.type === 'var') {
  14061. stack.push(ast1);
  14062. break;
  14063. }
  14064. tmpVar = new AstVariable(lastRegister++, ast1.min, ast1.max);
  14065. stack[stack.length - n - 1] = tmpVar;
  14066. stack.push(tmpVar);
  14067. instructions.push(new AstVariableDefinition(tmpVar, ast1));
  14068. break;
  14069. case 'dup':
  14070. if (stack.length < 1) {
  14071. return null;
  14072. }
  14073. 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]) {
  14074. num1 = stack.pop();
  14075. stack.push(buildMinOperation(num1, code[i + 1]));
  14076. i += 6;
  14077. break;
  14078. }
  14079. ast1 = stack[stack.length - 1];
  14080. if (ast1.type === 'literal' || ast1.type === 'var') {
  14081. stack.push(ast1);
  14082. break;
  14083. }
  14084. tmpVar = new AstVariable(lastRegister++, ast1.min, ast1.max);
  14085. stack[stack.length - 1] = tmpVar;
  14086. stack.push(tmpVar);
  14087. instructions.push(new AstVariableDefinition(tmpVar, ast1));
  14088. break;
  14089. case 'roll':
  14090. if (stack.length < 2) {
  14091. return null;
  14092. }
  14093. num2 = stack.pop();
  14094. num1 = stack.pop();
  14095. if (num2.type !== 'literal' || num1.type !== 'literal') {
  14096. return null;
  14097. }
  14098. j = num2.number;
  14099. n = num1.number;
  14100. if (n <= 0 || (n | 0) !== n || (j | 0) !== j || stack.length < n) {
  14101. return null;
  14102. }
  14103. j = (j % n + n) % n;
  14104. if (j === 0) {
  14105. break;
  14106. }
  14107. Array.prototype.push.apply(stack, stack.splice(stack.length - n, n - j));
  14108. break;
  14109. default:
  14110. return null;
  14111. }
  14112. }
  14113. if (stack.length !== outputSize) {
  14114. return null;
  14115. }
  14116. var result = [];
  14117. instructions.forEach(function (instruction) {
  14118. var statementBuilder = new ExpressionBuilderVisitor();
  14119. instruction.visit(statementBuilder);
  14120. result.push(statementBuilder.toString());
  14121. });
  14122. stack.forEach(function (expr, i) {
  14123. var statementBuilder = new ExpressionBuilderVisitor();
  14124. expr.visit(statementBuilder);
  14125. var min = range[i * 2], max = range[i * 2 + 1];
  14126. var out = [statementBuilder.toString()];
  14127. if (min > expr.min) {
  14128. out.unshift('Math.max(', min, ', ');
  14129. out.push(')');
  14130. }
  14131. if (max < expr.max) {
  14132. out.unshift('Math.min(', max, ', ');
  14133. out.push(')');
  14134. }
  14135. out.unshift('dest[destOffset + ', i, '] = ');
  14136. out.push(';');
  14137. result.push(out.join(''));
  14138. });
  14139. return result.join('\n');
  14140. }
  14141. };
  14142. return PostScriptCompiler;
  14143. }();
  14144. exports.isPDFFunction = isPDFFunction;
  14145. exports.PDFFunction = PDFFunction;
  14146. exports.PostScriptEvaluator = PostScriptEvaluator;
  14147. exports.PostScriptCompiler = PostScriptCompiler;
  14148. /***/ }),
  14149. /* 7 */
  14150. /***/ (function(module, exports, __w_pdfjs_require__) {
  14151. "use strict";
  14152. var sharedUtil = __w_pdfjs_require__(0);
  14153. var getLookupTableFactory = sharedUtil.getLookupTableFactory;
  14154. var getGlyphsUnicode = getLookupTableFactory(function (t) {
  14155. t['A'] = 0x0041;
  14156. t['AE'] = 0x00C6;
  14157. t['AEacute'] = 0x01FC;
  14158. t['AEmacron'] = 0x01E2;
  14159. t['AEsmall'] = 0xF7E6;
  14160. t['Aacute'] = 0x00C1;
  14161. t['Aacutesmall'] = 0xF7E1;
  14162. t['Abreve'] = 0x0102;
  14163. t['Abreveacute'] = 0x1EAE;
  14164. t['Abrevecyrillic'] = 0x04D0;
  14165. t['Abrevedotbelow'] = 0x1EB6;
  14166. t['Abrevegrave'] = 0x1EB0;
  14167. t['Abrevehookabove'] = 0x1EB2;
  14168. t['Abrevetilde'] = 0x1EB4;
  14169. t['Acaron'] = 0x01CD;
  14170. t['Acircle'] = 0x24B6;
  14171. t['Acircumflex'] = 0x00C2;
  14172. t['Acircumflexacute'] = 0x1EA4;
  14173. t['Acircumflexdotbelow'] = 0x1EAC;
  14174. t['Acircumflexgrave'] = 0x1EA6;
  14175. t['Acircumflexhookabove'] = 0x1EA8;
  14176. t['Acircumflexsmall'] = 0xF7E2;
  14177. t['Acircumflextilde'] = 0x1EAA;
  14178. t['Acute'] = 0xF6C9;
  14179. t['Acutesmall'] = 0xF7B4;
  14180. t['Acyrillic'] = 0x0410;
  14181. t['Adblgrave'] = 0x0200;
  14182. t['Adieresis'] = 0x00C4;
  14183. t['Adieresiscyrillic'] = 0x04D2;
  14184. t['Adieresismacron'] = 0x01DE;
  14185. t['Adieresissmall'] = 0xF7E4;
  14186. t['Adotbelow'] = 0x1EA0;
  14187. t['Adotmacron'] = 0x01E0;
  14188. t['Agrave'] = 0x00C0;
  14189. t['Agravesmall'] = 0xF7E0;
  14190. t['Ahookabove'] = 0x1EA2;
  14191. t['Aiecyrillic'] = 0x04D4;
  14192. t['Ainvertedbreve'] = 0x0202;
  14193. t['Alpha'] = 0x0391;
  14194. t['Alphatonos'] = 0x0386;
  14195. t['Amacron'] = 0x0100;
  14196. t['Amonospace'] = 0xFF21;
  14197. t['Aogonek'] = 0x0104;
  14198. t['Aring'] = 0x00C5;
  14199. t['Aringacute'] = 0x01FA;
  14200. t['Aringbelow'] = 0x1E00;
  14201. t['Aringsmall'] = 0xF7E5;
  14202. t['Asmall'] = 0xF761;
  14203. t['Atilde'] = 0x00C3;
  14204. t['Atildesmall'] = 0xF7E3;
  14205. t['Aybarmenian'] = 0x0531;
  14206. t['B'] = 0x0042;
  14207. t['Bcircle'] = 0x24B7;
  14208. t['Bdotaccent'] = 0x1E02;
  14209. t['Bdotbelow'] = 0x1E04;
  14210. t['Becyrillic'] = 0x0411;
  14211. t['Benarmenian'] = 0x0532;
  14212. t['Beta'] = 0x0392;
  14213. t['Bhook'] = 0x0181;
  14214. t['Blinebelow'] = 0x1E06;
  14215. t['Bmonospace'] = 0xFF22;
  14216. t['Brevesmall'] = 0xF6F4;
  14217. t['Bsmall'] = 0xF762;
  14218. t['Btopbar'] = 0x0182;
  14219. t['C'] = 0x0043;
  14220. t['Caarmenian'] = 0x053E;
  14221. t['Cacute'] = 0x0106;
  14222. t['Caron'] = 0xF6CA;
  14223. t['Caronsmall'] = 0xF6F5;
  14224. t['Ccaron'] = 0x010C;
  14225. t['Ccedilla'] = 0x00C7;
  14226. t['Ccedillaacute'] = 0x1E08;
  14227. t['Ccedillasmall'] = 0xF7E7;
  14228. t['Ccircle'] = 0x24B8;
  14229. t['Ccircumflex'] = 0x0108;
  14230. t['Cdot'] = 0x010A;
  14231. t['Cdotaccent'] = 0x010A;
  14232. t['Cedillasmall'] = 0xF7B8;
  14233. t['Chaarmenian'] = 0x0549;
  14234. t['Cheabkhasiancyrillic'] = 0x04BC;
  14235. t['Checyrillic'] = 0x0427;
  14236. t['Chedescenderabkhasiancyrillic'] = 0x04BE;
  14237. t['Chedescendercyrillic'] = 0x04B6;
  14238. t['Chedieresiscyrillic'] = 0x04F4;
  14239. t['Cheharmenian'] = 0x0543;
  14240. t['Chekhakassiancyrillic'] = 0x04CB;
  14241. t['Cheverticalstrokecyrillic'] = 0x04B8;
  14242. t['Chi'] = 0x03A7;
  14243. t['Chook'] = 0x0187;
  14244. t['Circumflexsmall'] = 0xF6F6;
  14245. t['Cmonospace'] = 0xFF23;
  14246. t['Coarmenian'] = 0x0551;
  14247. t['Csmall'] = 0xF763;
  14248. t['D'] = 0x0044;
  14249. t['DZ'] = 0x01F1;
  14250. t['DZcaron'] = 0x01C4;
  14251. t['Daarmenian'] = 0x0534;
  14252. t['Dafrican'] = 0x0189;
  14253. t['Dcaron'] = 0x010E;
  14254. t['Dcedilla'] = 0x1E10;
  14255. t['Dcircle'] = 0x24B9;
  14256. t['Dcircumflexbelow'] = 0x1E12;
  14257. t['Dcroat'] = 0x0110;
  14258. t['Ddotaccent'] = 0x1E0A;
  14259. t['Ddotbelow'] = 0x1E0C;
  14260. t['Decyrillic'] = 0x0414;
  14261. t['Deicoptic'] = 0x03EE;
  14262. t['Delta'] = 0x2206;
  14263. t['Deltagreek'] = 0x0394;
  14264. t['Dhook'] = 0x018A;
  14265. t['Dieresis'] = 0xF6CB;
  14266. t['DieresisAcute'] = 0xF6CC;
  14267. t['DieresisGrave'] = 0xF6CD;
  14268. t['Dieresissmall'] = 0xF7A8;
  14269. t['Digammagreek'] = 0x03DC;
  14270. t['Djecyrillic'] = 0x0402;
  14271. t['Dlinebelow'] = 0x1E0E;
  14272. t['Dmonospace'] = 0xFF24;
  14273. t['Dotaccentsmall'] = 0xF6F7;
  14274. t['Dslash'] = 0x0110;
  14275. t['Dsmall'] = 0xF764;
  14276. t['Dtopbar'] = 0x018B;
  14277. t['Dz'] = 0x01F2;
  14278. t['Dzcaron'] = 0x01C5;
  14279. t['Dzeabkhasiancyrillic'] = 0x04E0;
  14280. t['Dzecyrillic'] = 0x0405;
  14281. t['Dzhecyrillic'] = 0x040F;
  14282. t['E'] = 0x0045;
  14283. t['Eacute'] = 0x00C9;
  14284. t['Eacutesmall'] = 0xF7E9;
  14285. t['Ebreve'] = 0x0114;
  14286. t['Ecaron'] = 0x011A;
  14287. t['Ecedillabreve'] = 0x1E1C;
  14288. t['Echarmenian'] = 0x0535;
  14289. t['Ecircle'] = 0x24BA;
  14290. t['Ecircumflex'] = 0x00CA;
  14291. t['Ecircumflexacute'] = 0x1EBE;
  14292. t['Ecircumflexbelow'] = 0x1E18;
  14293. t['Ecircumflexdotbelow'] = 0x1EC6;
  14294. t['Ecircumflexgrave'] = 0x1EC0;
  14295. t['Ecircumflexhookabove'] = 0x1EC2;
  14296. t['Ecircumflexsmall'] = 0xF7EA;
  14297. t['Ecircumflextilde'] = 0x1EC4;
  14298. t['Ecyrillic'] = 0x0404;
  14299. t['Edblgrave'] = 0x0204;
  14300. t['Edieresis'] = 0x00CB;
  14301. t['Edieresissmall'] = 0xF7EB;
  14302. t['Edot'] = 0x0116;
  14303. t['Edotaccent'] = 0x0116;
  14304. t['Edotbelow'] = 0x1EB8;
  14305. t['Efcyrillic'] = 0x0424;
  14306. t['Egrave'] = 0x00C8;
  14307. t['Egravesmall'] = 0xF7E8;
  14308. t['Eharmenian'] = 0x0537;
  14309. t['Ehookabove'] = 0x1EBA;
  14310. t['Eightroman'] = 0x2167;
  14311. t['Einvertedbreve'] = 0x0206;
  14312. t['Eiotifiedcyrillic'] = 0x0464;
  14313. t['Elcyrillic'] = 0x041B;
  14314. t['Elevenroman'] = 0x216A;
  14315. t['Emacron'] = 0x0112;
  14316. t['Emacronacute'] = 0x1E16;
  14317. t['Emacrongrave'] = 0x1E14;
  14318. t['Emcyrillic'] = 0x041C;
  14319. t['Emonospace'] = 0xFF25;
  14320. t['Encyrillic'] = 0x041D;
  14321. t['Endescendercyrillic'] = 0x04A2;
  14322. t['Eng'] = 0x014A;
  14323. t['Enghecyrillic'] = 0x04A4;
  14324. t['Enhookcyrillic'] = 0x04C7;
  14325. t['Eogonek'] = 0x0118;
  14326. t['Eopen'] = 0x0190;
  14327. t['Epsilon'] = 0x0395;
  14328. t['Epsilontonos'] = 0x0388;
  14329. t['Ercyrillic'] = 0x0420;
  14330. t['Ereversed'] = 0x018E;
  14331. t['Ereversedcyrillic'] = 0x042D;
  14332. t['Escyrillic'] = 0x0421;
  14333. t['Esdescendercyrillic'] = 0x04AA;
  14334. t['Esh'] = 0x01A9;
  14335. t['Esmall'] = 0xF765;
  14336. t['Eta'] = 0x0397;
  14337. t['Etarmenian'] = 0x0538;
  14338. t['Etatonos'] = 0x0389;
  14339. t['Eth'] = 0x00D0;
  14340. t['Ethsmall'] = 0xF7F0;
  14341. t['Etilde'] = 0x1EBC;
  14342. t['Etildebelow'] = 0x1E1A;
  14343. t['Euro'] = 0x20AC;
  14344. t['Ezh'] = 0x01B7;
  14345. t['Ezhcaron'] = 0x01EE;
  14346. t['Ezhreversed'] = 0x01B8;
  14347. t['F'] = 0x0046;
  14348. t['Fcircle'] = 0x24BB;
  14349. t['Fdotaccent'] = 0x1E1E;
  14350. t['Feharmenian'] = 0x0556;
  14351. t['Feicoptic'] = 0x03E4;
  14352. t['Fhook'] = 0x0191;
  14353. t['Fitacyrillic'] = 0x0472;
  14354. t['Fiveroman'] = 0x2164;
  14355. t['Fmonospace'] = 0xFF26;
  14356. t['Fourroman'] = 0x2163;
  14357. t['Fsmall'] = 0xF766;
  14358. t['G'] = 0x0047;
  14359. t['GBsquare'] = 0x3387;
  14360. t['Gacute'] = 0x01F4;
  14361. t['Gamma'] = 0x0393;
  14362. t['Gammaafrican'] = 0x0194;
  14363. t['Gangiacoptic'] = 0x03EA;
  14364. t['Gbreve'] = 0x011E;
  14365. t['Gcaron'] = 0x01E6;
  14366. t['Gcedilla'] = 0x0122;
  14367. t['Gcircle'] = 0x24BC;
  14368. t['Gcircumflex'] = 0x011C;
  14369. t['Gcommaaccent'] = 0x0122;
  14370. t['Gdot'] = 0x0120;
  14371. t['Gdotaccent'] = 0x0120;
  14372. t['Gecyrillic'] = 0x0413;
  14373. t['Ghadarmenian'] = 0x0542;
  14374. t['Ghemiddlehookcyrillic'] = 0x0494;
  14375. t['Ghestrokecyrillic'] = 0x0492;
  14376. t['Gheupturncyrillic'] = 0x0490;
  14377. t['Ghook'] = 0x0193;
  14378. t['Gimarmenian'] = 0x0533;
  14379. t['Gjecyrillic'] = 0x0403;
  14380. t['Gmacron'] = 0x1E20;
  14381. t['Gmonospace'] = 0xFF27;
  14382. t['Grave'] = 0xF6CE;
  14383. t['Gravesmall'] = 0xF760;
  14384. t['Gsmall'] = 0xF767;
  14385. t['Gsmallhook'] = 0x029B;
  14386. t['Gstroke'] = 0x01E4;
  14387. t['H'] = 0x0048;
  14388. t['H18533'] = 0x25CF;
  14389. t['H18543'] = 0x25AA;
  14390. t['H18551'] = 0x25AB;
  14391. t['H22073'] = 0x25A1;
  14392. t['HPsquare'] = 0x33CB;
  14393. t['Haabkhasiancyrillic'] = 0x04A8;
  14394. t['Hadescendercyrillic'] = 0x04B2;
  14395. t['Hardsigncyrillic'] = 0x042A;
  14396. t['Hbar'] = 0x0126;
  14397. t['Hbrevebelow'] = 0x1E2A;
  14398. t['Hcedilla'] = 0x1E28;
  14399. t['Hcircle'] = 0x24BD;
  14400. t['Hcircumflex'] = 0x0124;
  14401. t['Hdieresis'] = 0x1E26;
  14402. t['Hdotaccent'] = 0x1E22;
  14403. t['Hdotbelow'] = 0x1E24;
  14404. t['Hmonospace'] = 0xFF28;
  14405. t['Hoarmenian'] = 0x0540;
  14406. t['Horicoptic'] = 0x03E8;
  14407. t['Hsmall'] = 0xF768;
  14408. t['Hungarumlaut'] = 0xF6CF;
  14409. t['Hungarumlautsmall'] = 0xF6F8;
  14410. t['Hzsquare'] = 0x3390;
  14411. t['I'] = 0x0049;
  14412. t['IAcyrillic'] = 0x042F;
  14413. t['IJ'] = 0x0132;
  14414. t['IUcyrillic'] = 0x042E;
  14415. t['Iacute'] = 0x00CD;
  14416. t['Iacutesmall'] = 0xF7ED;
  14417. t['Ibreve'] = 0x012C;
  14418. t['Icaron'] = 0x01CF;
  14419. t['Icircle'] = 0x24BE;
  14420. t['Icircumflex'] = 0x00CE;
  14421. t['Icircumflexsmall'] = 0xF7EE;
  14422. t['Icyrillic'] = 0x0406;
  14423. t['Idblgrave'] = 0x0208;
  14424. t['Idieresis'] = 0x00CF;
  14425. t['Idieresisacute'] = 0x1E2E;
  14426. t['Idieresiscyrillic'] = 0x04E4;
  14427. t['Idieresissmall'] = 0xF7EF;
  14428. t['Idot'] = 0x0130;
  14429. t['Idotaccent'] = 0x0130;
  14430. t['Idotbelow'] = 0x1ECA;
  14431. t['Iebrevecyrillic'] = 0x04D6;
  14432. t['Iecyrillic'] = 0x0415;
  14433. t['Ifraktur'] = 0x2111;
  14434. t['Igrave'] = 0x00CC;
  14435. t['Igravesmall'] = 0xF7EC;
  14436. t['Ihookabove'] = 0x1EC8;
  14437. t['Iicyrillic'] = 0x0418;
  14438. t['Iinvertedbreve'] = 0x020A;
  14439. t['Iishortcyrillic'] = 0x0419;
  14440. t['Imacron'] = 0x012A;
  14441. t['Imacroncyrillic'] = 0x04E2;
  14442. t['Imonospace'] = 0xFF29;
  14443. t['Iniarmenian'] = 0x053B;
  14444. t['Iocyrillic'] = 0x0401;
  14445. t['Iogonek'] = 0x012E;
  14446. t['Iota'] = 0x0399;
  14447. t['Iotaafrican'] = 0x0196;
  14448. t['Iotadieresis'] = 0x03AA;
  14449. t['Iotatonos'] = 0x038A;
  14450. t['Ismall'] = 0xF769;
  14451. t['Istroke'] = 0x0197;
  14452. t['Itilde'] = 0x0128;
  14453. t['Itildebelow'] = 0x1E2C;
  14454. t['Izhitsacyrillic'] = 0x0474;
  14455. t['Izhitsadblgravecyrillic'] = 0x0476;
  14456. t['J'] = 0x004A;
  14457. t['Jaarmenian'] = 0x0541;
  14458. t['Jcircle'] = 0x24BF;
  14459. t['Jcircumflex'] = 0x0134;
  14460. t['Jecyrillic'] = 0x0408;
  14461. t['Jheharmenian'] = 0x054B;
  14462. t['Jmonospace'] = 0xFF2A;
  14463. t['Jsmall'] = 0xF76A;
  14464. t['K'] = 0x004B;
  14465. t['KBsquare'] = 0x3385;
  14466. t['KKsquare'] = 0x33CD;
  14467. t['Kabashkircyrillic'] = 0x04A0;
  14468. t['Kacute'] = 0x1E30;
  14469. t['Kacyrillic'] = 0x041A;
  14470. t['Kadescendercyrillic'] = 0x049A;
  14471. t['Kahookcyrillic'] = 0x04C3;
  14472. t['Kappa'] = 0x039A;
  14473. t['Kastrokecyrillic'] = 0x049E;
  14474. t['Kaverticalstrokecyrillic'] = 0x049C;
  14475. t['Kcaron'] = 0x01E8;
  14476. t['Kcedilla'] = 0x0136;
  14477. t['Kcircle'] = 0x24C0;
  14478. t['Kcommaaccent'] = 0x0136;
  14479. t['Kdotbelow'] = 0x1E32;
  14480. t['Keharmenian'] = 0x0554;
  14481. t['Kenarmenian'] = 0x053F;
  14482. t['Khacyrillic'] = 0x0425;
  14483. t['Kheicoptic'] = 0x03E6;
  14484. t['Khook'] = 0x0198;
  14485. t['Kjecyrillic'] = 0x040C;
  14486. t['Klinebelow'] = 0x1E34;
  14487. t['Kmonospace'] = 0xFF2B;
  14488. t['Koppacyrillic'] = 0x0480;
  14489. t['Koppagreek'] = 0x03DE;
  14490. t['Ksicyrillic'] = 0x046E;
  14491. t['Ksmall'] = 0xF76B;
  14492. t['L'] = 0x004C;
  14493. t['LJ'] = 0x01C7;
  14494. t['LL'] = 0xF6BF;
  14495. t['Lacute'] = 0x0139;
  14496. t['Lambda'] = 0x039B;
  14497. t['Lcaron'] = 0x013D;
  14498. t['Lcedilla'] = 0x013B;
  14499. t['Lcircle'] = 0x24C1;
  14500. t['Lcircumflexbelow'] = 0x1E3C;
  14501. t['Lcommaaccent'] = 0x013B;
  14502. t['Ldot'] = 0x013F;
  14503. t['Ldotaccent'] = 0x013F;
  14504. t['Ldotbelow'] = 0x1E36;
  14505. t['Ldotbelowmacron'] = 0x1E38;
  14506. t['Liwnarmenian'] = 0x053C;
  14507. t['Lj'] = 0x01C8;
  14508. t['Ljecyrillic'] = 0x0409;
  14509. t['Llinebelow'] = 0x1E3A;
  14510. t['Lmonospace'] = 0xFF2C;
  14511. t['Lslash'] = 0x0141;
  14512. t['Lslashsmall'] = 0xF6F9;
  14513. t['Lsmall'] = 0xF76C;
  14514. t['M'] = 0x004D;
  14515. t['MBsquare'] = 0x3386;
  14516. t['Macron'] = 0xF6D0;
  14517. t['Macronsmall'] = 0xF7AF;
  14518. t['Macute'] = 0x1E3E;
  14519. t['Mcircle'] = 0x24C2;
  14520. t['Mdotaccent'] = 0x1E40;
  14521. t['Mdotbelow'] = 0x1E42;
  14522. t['Menarmenian'] = 0x0544;
  14523. t['Mmonospace'] = 0xFF2D;
  14524. t['Msmall'] = 0xF76D;
  14525. t['Mturned'] = 0x019C;
  14526. t['Mu'] = 0x039C;
  14527. t['N'] = 0x004E;
  14528. t['NJ'] = 0x01CA;
  14529. t['Nacute'] = 0x0143;
  14530. t['Ncaron'] = 0x0147;
  14531. t['Ncedilla'] = 0x0145;
  14532. t['Ncircle'] = 0x24C3;
  14533. t['Ncircumflexbelow'] = 0x1E4A;
  14534. t['Ncommaaccent'] = 0x0145;
  14535. t['Ndotaccent'] = 0x1E44;
  14536. t['Ndotbelow'] = 0x1E46;
  14537. t['Nhookleft'] = 0x019D;
  14538. t['Nineroman'] = 0x2168;
  14539. t['Nj'] = 0x01CB;
  14540. t['Njecyrillic'] = 0x040A;
  14541. t['Nlinebelow'] = 0x1E48;
  14542. t['Nmonospace'] = 0xFF2E;
  14543. t['Nowarmenian'] = 0x0546;
  14544. t['Nsmall'] = 0xF76E;
  14545. t['Ntilde'] = 0x00D1;
  14546. t['Ntildesmall'] = 0xF7F1;
  14547. t['Nu'] = 0x039D;
  14548. t['O'] = 0x004F;
  14549. t['OE'] = 0x0152;
  14550. t['OEsmall'] = 0xF6FA;
  14551. t['Oacute'] = 0x00D3;
  14552. t['Oacutesmall'] = 0xF7F3;
  14553. t['Obarredcyrillic'] = 0x04E8;
  14554. t['Obarreddieresiscyrillic'] = 0x04EA;
  14555. t['Obreve'] = 0x014E;
  14556. t['Ocaron'] = 0x01D1;
  14557. t['Ocenteredtilde'] = 0x019F;
  14558. t['Ocircle'] = 0x24C4;
  14559. t['Ocircumflex'] = 0x00D4;
  14560. t['Ocircumflexacute'] = 0x1ED0;
  14561. t['Ocircumflexdotbelow'] = 0x1ED8;
  14562. t['Ocircumflexgrave'] = 0x1ED2;
  14563. t['Ocircumflexhookabove'] = 0x1ED4;
  14564. t['Ocircumflexsmall'] = 0xF7F4;
  14565. t['Ocircumflextilde'] = 0x1ED6;
  14566. t['Ocyrillic'] = 0x041E;
  14567. t['Odblacute'] = 0x0150;
  14568. t['Odblgrave'] = 0x020C;
  14569. t['Odieresis'] = 0x00D6;
  14570. t['Odieresiscyrillic'] = 0x04E6;
  14571. t['Odieresissmall'] = 0xF7F6;
  14572. t['Odotbelow'] = 0x1ECC;
  14573. t['Ogoneksmall'] = 0xF6FB;
  14574. t['Ograve'] = 0x00D2;
  14575. t['Ogravesmall'] = 0xF7F2;
  14576. t['Oharmenian'] = 0x0555;
  14577. t['Ohm'] = 0x2126;
  14578. t['Ohookabove'] = 0x1ECE;
  14579. t['Ohorn'] = 0x01A0;
  14580. t['Ohornacute'] = 0x1EDA;
  14581. t['Ohorndotbelow'] = 0x1EE2;
  14582. t['Ohorngrave'] = 0x1EDC;
  14583. t['Ohornhookabove'] = 0x1EDE;
  14584. t['Ohorntilde'] = 0x1EE0;
  14585. t['Ohungarumlaut'] = 0x0150;
  14586. t['Oi'] = 0x01A2;
  14587. t['Oinvertedbreve'] = 0x020E;
  14588. t['Omacron'] = 0x014C;
  14589. t['Omacronacute'] = 0x1E52;
  14590. t['Omacrongrave'] = 0x1E50;
  14591. t['Omega'] = 0x2126;
  14592. t['Omegacyrillic'] = 0x0460;
  14593. t['Omegagreek'] = 0x03A9;
  14594. t['Omegaroundcyrillic'] = 0x047A;
  14595. t['Omegatitlocyrillic'] = 0x047C;
  14596. t['Omegatonos'] = 0x038F;
  14597. t['Omicron'] = 0x039F;
  14598. t['Omicrontonos'] = 0x038C;
  14599. t['Omonospace'] = 0xFF2F;
  14600. t['Oneroman'] = 0x2160;
  14601. t['Oogonek'] = 0x01EA;
  14602. t['Oogonekmacron'] = 0x01EC;
  14603. t['Oopen'] = 0x0186;
  14604. t['Oslash'] = 0x00D8;
  14605. t['Oslashacute'] = 0x01FE;
  14606. t['Oslashsmall'] = 0xF7F8;
  14607. t['Osmall'] = 0xF76F;
  14608. t['Ostrokeacute'] = 0x01FE;
  14609. t['Otcyrillic'] = 0x047E;
  14610. t['Otilde'] = 0x00D5;
  14611. t['Otildeacute'] = 0x1E4C;
  14612. t['Otildedieresis'] = 0x1E4E;
  14613. t['Otildesmall'] = 0xF7F5;
  14614. t['P'] = 0x0050;
  14615. t['Pacute'] = 0x1E54;
  14616. t['Pcircle'] = 0x24C5;
  14617. t['Pdotaccent'] = 0x1E56;
  14618. t['Pecyrillic'] = 0x041F;
  14619. t['Peharmenian'] = 0x054A;
  14620. t['Pemiddlehookcyrillic'] = 0x04A6;
  14621. t['Phi'] = 0x03A6;
  14622. t['Phook'] = 0x01A4;
  14623. t['Pi'] = 0x03A0;
  14624. t['Piwrarmenian'] = 0x0553;
  14625. t['Pmonospace'] = 0xFF30;
  14626. t['Psi'] = 0x03A8;
  14627. t['Psicyrillic'] = 0x0470;
  14628. t['Psmall'] = 0xF770;
  14629. t['Q'] = 0x0051;
  14630. t['Qcircle'] = 0x24C6;
  14631. t['Qmonospace'] = 0xFF31;
  14632. t['Qsmall'] = 0xF771;
  14633. t['R'] = 0x0052;
  14634. t['Raarmenian'] = 0x054C;
  14635. t['Racute'] = 0x0154;
  14636. t['Rcaron'] = 0x0158;
  14637. t['Rcedilla'] = 0x0156;
  14638. t['Rcircle'] = 0x24C7;
  14639. t['Rcommaaccent'] = 0x0156;
  14640. t['Rdblgrave'] = 0x0210;
  14641. t['Rdotaccent'] = 0x1E58;
  14642. t['Rdotbelow'] = 0x1E5A;
  14643. t['Rdotbelowmacron'] = 0x1E5C;
  14644. t['Reharmenian'] = 0x0550;
  14645. t['Rfraktur'] = 0x211C;
  14646. t['Rho'] = 0x03A1;
  14647. t['Ringsmall'] = 0xF6FC;
  14648. t['Rinvertedbreve'] = 0x0212;
  14649. t['Rlinebelow'] = 0x1E5E;
  14650. t['Rmonospace'] = 0xFF32;
  14651. t['Rsmall'] = 0xF772;
  14652. t['Rsmallinverted'] = 0x0281;
  14653. t['Rsmallinvertedsuperior'] = 0x02B6;
  14654. t['S'] = 0x0053;
  14655. t['SF010000'] = 0x250C;
  14656. t['SF020000'] = 0x2514;
  14657. t['SF030000'] = 0x2510;
  14658. t['SF040000'] = 0x2518;
  14659. t['SF050000'] = 0x253C;
  14660. t['SF060000'] = 0x252C;
  14661. t['SF070000'] = 0x2534;
  14662. t['SF080000'] = 0x251C;
  14663. t['SF090000'] = 0x2524;
  14664. t['SF100000'] = 0x2500;
  14665. t['SF110000'] = 0x2502;
  14666. t['SF190000'] = 0x2561;
  14667. t['SF200000'] = 0x2562;
  14668. t['SF210000'] = 0x2556;
  14669. t['SF220000'] = 0x2555;
  14670. t['SF230000'] = 0x2563;
  14671. t['SF240000'] = 0x2551;
  14672. t['SF250000'] = 0x2557;
  14673. t['SF260000'] = 0x255D;
  14674. t['SF270000'] = 0x255C;
  14675. t['SF280000'] = 0x255B;
  14676. t['SF360000'] = 0x255E;
  14677. t['SF370000'] = 0x255F;
  14678. t['SF380000'] = 0x255A;
  14679. t['SF390000'] = 0x2554;
  14680. t['SF400000'] = 0x2569;
  14681. t['SF410000'] = 0x2566;
  14682. t['SF420000'] = 0x2560;
  14683. t['SF430000'] = 0x2550;
  14684. t['SF440000'] = 0x256C;
  14685. t['SF450000'] = 0x2567;
  14686. t['SF460000'] = 0x2568;
  14687. t['SF470000'] = 0x2564;
  14688. t['SF480000'] = 0x2565;
  14689. t['SF490000'] = 0x2559;
  14690. t['SF500000'] = 0x2558;
  14691. t['SF510000'] = 0x2552;
  14692. t['SF520000'] = 0x2553;
  14693. t['SF530000'] = 0x256B;
  14694. t['SF540000'] = 0x256A;
  14695. t['Sacute'] = 0x015A;
  14696. t['Sacutedotaccent'] = 0x1E64;
  14697. t['Sampigreek'] = 0x03E0;
  14698. t['Scaron'] = 0x0160;
  14699. t['Scarondotaccent'] = 0x1E66;
  14700. t['Scaronsmall'] = 0xF6FD;
  14701. t['Scedilla'] = 0x015E;
  14702. t['Schwa'] = 0x018F;
  14703. t['Schwacyrillic'] = 0x04D8;
  14704. t['Schwadieresiscyrillic'] = 0x04DA;
  14705. t['Scircle'] = 0x24C8;
  14706. t['Scircumflex'] = 0x015C;
  14707. t['Scommaaccent'] = 0x0218;
  14708. t['Sdotaccent'] = 0x1E60;
  14709. t['Sdotbelow'] = 0x1E62;
  14710. t['Sdotbelowdotaccent'] = 0x1E68;
  14711. t['Seharmenian'] = 0x054D;
  14712. t['Sevenroman'] = 0x2166;
  14713. t['Shaarmenian'] = 0x0547;
  14714. t['Shacyrillic'] = 0x0428;
  14715. t['Shchacyrillic'] = 0x0429;
  14716. t['Sheicoptic'] = 0x03E2;
  14717. t['Shhacyrillic'] = 0x04BA;
  14718. t['Shimacoptic'] = 0x03EC;
  14719. t['Sigma'] = 0x03A3;
  14720. t['Sixroman'] = 0x2165;
  14721. t['Smonospace'] = 0xFF33;
  14722. t['Softsigncyrillic'] = 0x042C;
  14723. t['Ssmall'] = 0xF773;
  14724. t['Stigmagreek'] = 0x03DA;
  14725. t['T'] = 0x0054;
  14726. t['Tau'] = 0x03A4;
  14727. t['Tbar'] = 0x0166;
  14728. t['Tcaron'] = 0x0164;
  14729. t['Tcedilla'] = 0x0162;
  14730. t['Tcircle'] = 0x24C9;
  14731. t['Tcircumflexbelow'] = 0x1E70;
  14732. t['Tcommaaccent'] = 0x0162;
  14733. t['Tdotaccent'] = 0x1E6A;
  14734. t['Tdotbelow'] = 0x1E6C;
  14735. t['Tecyrillic'] = 0x0422;
  14736. t['Tedescendercyrillic'] = 0x04AC;
  14737. t['Tenroman'] = 0x2169;
  14738. t['Tetsecyrillic'] = 0x04B4;
  14739. t['Theta'] = 0x0398;
  14740. t['Thook'] = 0x01AC;
  14741. t['Thorn'] = 0x00DE;
  14742. t['Thornsmall'] = 0xF7FE;
  14743. t['Threeroman'] = 0x2162;
  14744. t['Tildesmall'] = 0xF6FE;
  14745. t['Tiwnarmenian'] = 0x054F;
  14746. t['Tlinebelow'] = 0x1E6E;
  14747. t['Tmonospace'] = 0xFF34;
  14748. t['Toarmenian'] = 0x0539;
  14749. t['Tonefive'] = 0x01BC;
  14750. t['Tonesix'] = 0x0184;
  14751. t['Tonetwo'] = 0x01A7;
  14752. t['Tretroflexhook'] = 0x01AE;
  14753. t['Tsecyrillic'] = 0x0426;
  14754. t['Tshecyrillic'] = 0x040B;
  14755. t['Tsmall'] = 0xF774;
  14756. t['Twelveroman'] = 0x216B;
  14757. t['Tworoman'] = 0x2161;
  14758. t['U'] = 0x0055;
  14759. t['Uacute'] = 0x00DA;
  14760. t['Uacutesmall'] = 0xF7FA;
  14761. t['Ubreve'] = 0x016C;
  14762. t['Ucaron'] = 0x01D3;
  14763. t['Ucircle'] = 0x24CA;
  14764. t['Ucircumflex'] = 0x00DB;
  14765. t['Ucircumflexbelow'] = 0x1E76;
  14766. t['Ucircumflexsmall'] = 0xF7FB;
  14767. t['Ucyrillic'] = 0x0423;
  14768. t['Udblacute'] = 0x0170;
  14769. t['Udblgrave'] = 0x0214;
  14770. t['Udieresis'] = 0x00DC;
  14771. t['Udieresisacute'] = 0x01D7;
  14772. t['Udieresisbelow'] = 0x1E72;
  14773. t['Udieresiscaron'] = 0x01D9;
  14774. t['Udieresiscyrillic'] = 0x04F0;
  14775. t['Udieresisgrave'] = 0x01DB;
  14776. t['Udieresismacron'] = 0x01D5;
  14777. t['Udieresissmall'] = 0xF7FC;
  14778. t['Udotbelow'] = 0x1EE4;
  14779. t['Ugrave'] = 0x00D9;
  14780. t['Ugravesmall'] = 0xF7F9;
  14781. t['Uhookabove'] = 0x1EE6;
  14782. t['Uhorn'] = 0x01AF;
  14783. t['Uhornacute'] = 0x1EE8;
  14784. t['Uhorndotbelow'] = 0x1EF0;
  14785. t['Uhorngrave'] = 0x1EEA;
  14786. t['Uhornhookabove'] = 0x1EEC;
  14787. t['Uhorntilde'] = 0x1EEE;
  14788. t['Uhungarumlaut'] = 0x0170;
  14789. t['Uhungarumlautcyrillic'] = 0x04F2;
  14790. t['Uinvertedbreve'] = 0x0216;
  14791. t['Ukcyrillic'] = 0x0478;
  14792. t['Umacron'] = 0x016A;
  14793. t['Umacroncyrillic'] = 0x04EE;
  14794. t['Umacrondieresis'] = 0x1E7A;
  14795. t['Umonospace'] = 0xFF35;
  14796. t['Uogonek'] = 0x0172;
  14797. t['Upsilon'] = 0x03A5;
  14798. t['Upsilon1'] = 0x03D2;
  14799. t['Upsilonacutehooksymbolgreek'] = 0x03D3;
  14800. t['Upsilonafrican'] = 0x01B1;
  14801. t['Upsilondieresis'] = 0x03AB;
  14802. t['Upsilondieresishooksymbolgreek'] = 0x03D4;
  14803. t['Upsilonhooksymbol'] = 0x03D2;
  14804. t['Upsilontonos'] = 0x038E;
  14805. t['Uring'] = 0x016E;
  14806. t['Ushortcyrillic'] = 0x040E;
  14807. t['Usmall'] = 0xF775;
  14808. t['Ustraightcyrillic'] = 0x04AE;
  14809. t['Ustraightstrokecyrillic'] = 0x04B0;
  14810. t['Utilde'] = 0x0168;
  14811. t['Utildeacute'] = 0x1E78;
  14812. t['Utildebelow'] = 0x1E74;
  14813. t['V'] = 0x0056;
  14814. t['Vcircle'] = 0x24CB;
  14815. t['Vdotbelow'] = 0x1E7E;
  14816. t['Vecyrillic'] = 0x0412;
  14817. t['Vewarmenian'] = 0x054E;
  14818. t['Vhook'] = 0x01B2;
  14819. t['Vmonospace'] = 0xFF36;
  14820. t['Voarmenian'] = 0x0548;
  14821. t['Vsmall'] = 0xF776;
  14822. t['Vtilde'] = 0x1E7C;
  14823. t['W'] = 0x0057;
  14824. t['Wacute'] = 0x1E82;
  14825. t['Wcircle'] = 0x24CC;
  14826. t['Wcircumflex'] = 0x0174;
  14827. t['Wdieresis'] = 0x1E84;
  14828. t['Wdotaccent'] = 0x1E86;
  14829. t['Wdotbelow'] = 0x1E88;
  14830. t['Wgrave'] = 0x1E80;
  14831. t['Wmonospace'] = 0xFF37;
  14832. t['Wsmall'] = 0xF777;
  14833. t['X'] = 0x0058;
  14834. t['Xcircle'] = 0x24CD;
  14835. t['Xdieresis'] = 0x1E8C;
  14836. t['Xdotaccent'] = 0x1E8A;
  14837. t['Xeharmenian'] = 0x053D;
  14838. t['Xi'] = 0x039E;
  14839. t['Xmonospace'] = 0xFF38;
  14840. t['Xsmall'] = 0xF778;
  14841. t['Y'] = 0x0059;
  14842. t['Yacute'] = 0x00DD;
  14843. t['Yacutesmall'] = 0xF7FD;
  14844. t['Yatcyrillic'] = 0x0462;
  14845. t['Ycircle'] = 0x24CE;
  14846. t['Ycircumflex'] = 0x0176;
  14847. t['Ydieresis'] = 0x0178;
  14848. t['Ydieresissmall'] = 0xF7FF;
  14849. t['Ydotaccent'] = 0x1E8E;
  14850. t['Ydotbelow'] = 0x1EF4;
  14851. t['Yericyrillic'] = 0x042B;
  14852. t['Yerudieresiscyrillic'] = 0x04F8;
  14853. t['Ygrave'] = 0x1EF2;
  14854. t['Yhook'] = 0x01B3;
  14855. t['Yhookabove'] = 0x1EF6;
  14856. t['Yiarmenian'] = 0x0545;
  14857. t['Yicyrillic'] = 0x0407;
  14858. t['Yiwnarmenian'] = 0x0552;
  14859. t['Ymonospace'] = 0xFF39;
  14860. t['Ysmall'] = 0xF779;
  14861. t['Ytilde'] = 0x1EF8;
  14862. t['Yusbigcyrillic'] = 0x046A;
  14863. t['Yusbigiotifiedcyrillic'] = 0x046C;
  14864. t['Yuslittlecyrillic'] = 0x0466;
  14865. t['Yuslittleiotifiedcyrillic'] = 0x0468;
  14866. t['Z'] = 0x005A;
  14867. t['Zaarmenian'] = 0x0536;
  14868. t['Zacute'] = 0x0179;
  14869. t['Zcaron'] = 0x017D;
  14870. t['Zcaronsmall'] = 0xF6FF;
  14871. t['Zcircle'] = 0x24CF;
  14872. t['Zcircumflex'] = 0x1E90;
  14873. t['Zdot'] = 0x017B;
  14874. t['Zdotaccent'] = 0x017B;
  14875. t['Zdotbelow'] = 0x1E92;
  14876. t['Zecyrillic'] = 0x0417;
  14877. t['Zedescendercyrillic'] = 0x0498;
  14878. t['Zedieresiscyrillic'] = 0x04DE;
  14879. t['Zeta'] = 0x0396;
  14880. t['Zhearmenian'] = 0x053A;
  14881. t['Zhebrevecyrillic'] = 0x04C1;
  14882. t['Zhecyrillic'] = 0x0416;
  14883. t['Zhedescendercyrillic'] = 0x0496;
  14884. t['Zhedieresiscyrillic'] = 0x04DC;
  14885. t['Zlinebelow'] = 0x1E94;
  14886. t['Zmonospace'] = 0xFF3A;
  14887. t['Zsmall'] = 0xF77A;
  14888. t['Zstroke'] = 0x01B5;
  14889. t['a'] = 0x0061;
  14890. t['aabengali'] = 0x0986;
  14891. t['aacute'] = 0x00E1;
  14892. t['aadeva'] = 0x0906;
  14893. t['aagujarati'] = 0x0A86;
  14894. t['aagurmukhi'] = 0x0A06;
  14895. t['aamatragurmukhi'] = 0x0A3E;
  14896. t['aarusquare'] = 0x3303;
  14897. t['aavowelsignbengali'] = 0x09BE;
  14898. t['aavowelsigndeva'] = 0x093E;
  14899. t['aavowelsigngujarati'] = 0x0ABE;
  14900. t['abbreviationmarkarmenian'] = 0x055F;
  14901. t['abbreviationsigndeva'] = 0x0970;
  14902. t['abengali'] = 0x0985;
  14903. t['abopomofo'] = 0x311A;
  14904. t['abreve'] = 0x0103;
  14905. t['abreveacute'] = 0x1EAF;
  14906. t['abrevecyrillic'] = 0x04D1;
  14907. t['abrevedotbelow'] = 0x1EB7;
  14908. t['abrevegrave'] = 0x1EB1;
  14909. t['abrevehookabove'] = 0x1EB3;
  14910. t['abrevetilde'] = 0x1EB5;
  14911. t['acaron'] = 0x01CE;
  14912. t['acircle'] = 0x24D0;
  14913. t['acircumflex'] = 0x00E2;
  14914. t['acircumflexacute'] = 0x1EA5;
  14915. t['acircumflexdotbelow'] = 0x1EAD;
  14916. t['acircumflexgrave'] = 0x1EA7;
  14917. t['acircumflexhookabove'] = 0x1EA9;
  14918. t['acircumflextilde'] = 0x1EAB;
  14919. t['acute'] = 0x00B4;
  14920. t['acutebelowcmb'] = 0x0317;
  14921. t['acutecmb'] = 0x0301;
  14922. t['acutecomb'] = 0x0301;
  14923. t['acutedeva'] = 0x0954;
  14924. t['acutelowmod'] = 0x02CF;
  14925. t['acutetonecmb'] = 0x0341;
  14926. t['acyrillic'] = 0x0430;
  14927. t['adblgrave'] = 0x0201;
  14928. t['addakgurmukhi'] = 0x0A71;
  14929. t['adeva'] = 0x0905;
  14930. t['adieresis'] = 0x00E4;
  14931. t['adieresiscyrillic'] = 0x04D3;
  14932. t['adieresismacron'] = 0x01DF;
  14933. t['adotbelow'] = 0x1EA1;
  14934. t['adotmacron'] = 0x01E1;
  14935. t['ae'] = 0x00E6;
  14936. t['aeacute'] = 0x01FD;
  14937. t['aekorean'] = 0x3150;
  14938. t['aemacron'] = 0x01E3;
  14939. t['afii00208'] = 0x2015;
  14940. t['afii08941'] = 0x20A4;
  14941. t['afii10017'] = 0x0410;
  14942. t['afii10018'] = 0x0411;
  14943. t['afii10019'] = 0x0412;
  14944. t['afii10020'] = 0x0413;
  14945. t['afii10021'] = 0x0414;
  14946. t['afii10022'] = 0x0415;
  14947. t['afii10023'] = 0x0401;
  14948. t['afii10024'] = 0x0416;
  14949. t['afii10025'] = 0x0417;
  14950. t['afii10026'] = 0x0418;
  14951. t['afii10027'] = 0x0419;
  14952. t['afii10028'] = 0x041A;
  14953. t['afii10029'] = 0x041B;
  14954. t['afii10030'] = 0x041C;
  14955. t['afii10031'] = 0x041D;
  14956. t['afii10032'] = 0x041E;
  14957. t['afii10033'] = 0x041F;
  14958. t['afii10034'] = 0x0420;
  14959. t['afii10035'] = 0x0421;
  14960. t['afii10036'] = 0x0422;
  14961. t['afii10037'] = 0x0423;
  14962. t['afii10038'] = 0x0424;
  14963. t['afii10039'] = 0x0425;
  14964. t['afii10040'] = 0x0426;
  14965. t['afii10041'] = 0x0427;
  14966. t['afii10042'] = 0x0428;
  14967. t['afii10043'] = 0x0429;
  14968. t['afii10044'] = 0x042A;
  14969. t['afii10045'] = 0x042B;
  14970. t['afii10046'] = 0x042C;
  14971. t['afii10047'] = 0x042D;
  14972. t['afii10048'] = 0x042E;
  14973. t['afii10049'] = 0x042F;
  14974. t['afii10050'] = 0x0490;
  14975. t['afii10051'] = 0x0402;
  14976. t['afii10052'] = 0x0403;
  14977. t['afii10053'] = 0x0404;
  14978. t['afii10054'] = 0x0405;
  14979. t['afii10055'] = 0x0406;
  14980. t['afii10056'] = 0x0407;
  14981. t['afii10057'] = 0x0408;
  14982. t['afii10058'] = 0x0409;
  14983. t['afii10059'] = 0x040A;
  14984. t['afii10060'] = 0x040B;
  14985. t['afii10061'] = 0x040C;
  14986. t['afii10062'] = 0x040E;
  14987. t['afii10063'] = 0xF6C4;
  14988. t['afii10064'] = 0xF6C5;
  14989. t['afii10065'] = 0x0430;
  14990. t['afii10066'] = 0x0431;
  14991. t['afii10067'] = 0x0432;
  14992. t['afii10068'] = 0x0433;
  14993. t['afii10069'] = 0x0434;
  14994. t['afii10070'] = 0x0435;
  14995. t['afii10071'] = 0x0451;
  14996. t['afii10072'] = 0x0436;
  14997. t['afii10073'] = 0x0437;
  14998. t['afii10074'] = 0x0438;
  14999. t['afii10075'] = 0x0439;
  15000. t['afii10076'] = 0x043A;
  15001. t['afii10077'] = 0x043B;
  15002. t['afii10078'] = 0x043C;
  15003. t['afii10079'] = 0x043D;
  15004. t['afii10080'] = 0x043E;
  15005. t['afii10081'] = 0x043F;
  15006. t['afii10082'] = 0x0440;
  15007. t['afii10083'] = 0x0441;
  15008. t['afii10084'] = 0x0442;
  15009. t['afii10085'] = 0x0443;
  15010. t['afii10086'] = 0x0444;
  15011. t['afii10087'] = 0x0445;
  15012. t['afii10088'] = 0x0446;
  15013. t['afii10089'] = 0x0447;
  15014. t['afii10090'] = 0x0448;
  15015. t['afii10091'] = 0x0449;
  15016. t['afii10092'] = 0x044A;
  15017. t['afii10093'] = 0x044B;
  15018. t['afii10094'] = 0x044C;
  15019. t['afii10095'] = 0x044D;
  15020. t['afii10096'] = 0x044E;
  15021. t['afii10097'] = 0x044F;
  15022. t['afii10098'] = 0x0491;
  15023. t['afii10099'] = 0x0452;
  15024. t['afii10100'] = 0x0453;
  15025. t['afii10101'] = 0x0454;
  15026. t['afii10102'] = 0x0455;
  15027. t['afii10103'] = 0x0456;
  15028. t['afii10104'] = 0x0457;
  15029. t['afii10105'] = 0x0458;
  15030. t['afii10106'] = 0x0459;
  15031. t['afii10107'] = 0x045A;
  15032. t['afii10108'] = 0x045B;
  15033. t['afii10109'] = 0x045C;
  15034. t['afii10110'] = 0x045E;
  15035. t['afii10145'] = 0x040F;
  15036. t['afii10146'] = 0x0462;
  15037. t['afii10147'] = 0x0472;
  15038. t['afii10148'] = 0x0474;
  15039. t['afii10192'] = 0xF6C6;
  15040. t['afii10193'] = 0x045F;
  15041. t['afii10194'] = 0x0463;
  15042. t['afii10195'] = 0x0473;
  15043. t['afii10196'] = 0x0475;
  15044. t['afii10831'] = 0xF6C7;
  15045. t['afii10832'] = 0xF6C8;
  15046. t['afii10846'] = 0x04D9;
  15047. t['afii299'] = 0x200E;
  15048. t['afii300'] = 0x200F;
  15049. t['afii301'] = 0x200D;
  15050. t['afii57381'] = 0x066A;
  15051. t['afii57388'] = 0x060C;
  15052. t['afii57392'] = 0x0660;
  15053. t['afii57393'] = 0x0661;
  15054. t['afii57394'] = 0x0662;
  15055. t['afii57395'] = 0x0663;
  15056. t['afii57396'] = 0x0664;
  15057. t['afii57397'] = 0x0665;
  15058. t['afii57398'] = 0x0666;
  15059. t['afii57399'] = 0x0667;
  15060. t['afii57400'] = 0x0668;
  15061. t['afii57401'] = 0x0669;
  15062. t['afii57403'] = 0x061B;
  15063. t['afii57407'] = 0x061F;
  15064. t['afii57409'] = 0x0621;
  15065. t['afii57410'] = 0x0622;
  15066. t['afii57411'] = 0x0623;
  15067. t['afii57412'] = 0x0624;
  15068. t['afii57413'] = 0x0625;
  15069. t['afii57414'] = 0x0626;
  15070. t['afii57415'] = 0x0627;
  15071. t['afii57416'] = 0x0628;
  15072. t['afii57417'] = 0x0629;
  15073. t['afii57418'] = 0x062A;
  15074. t['afii57419'] = 0x062B;
  15075. t['afii57420'] = 0x062C;
  15076. t['afii57421'] = 0x062D;
  15077. t['afii57422'] = 0x062E;
  15078. t['afii57423'] = 0x062F;
  15079. t['afii57424'] = 0x0630;
  15080. t['afii57425'] = 0x0631;
  15081. t['afii57426'] = 0x0632;
  15082. t['afii57427'] = 0x0633;
  15083. t['afii57428'] = 0x0634;
  15084. t['afii57429'] = 0x0635;
  15085. t['afii57430'] = 0x0636;
  15086. t['afii57431'] = 0x0637;
  15087. t['afii57432'] = 0x0638;
  15088. t['afii57433'] = 0x0639;
  15089. t['afii57434'] = 0x063A;
  15090. t['afii57440'] = 0x0640;
  15091. t['afii57441'] = 0x0641;
  15092. t['afii57442'] = 0x0642;
  15093. t['afii57443'] = 0x0643;
  15094. t['afii57444'] = 0x0644;
  15095. t['afii57445'] = 0x0645;
  15096. t['afii57446'] = 0x0646;
  15097. t['afii57448'] = 0x0648;
  15098. t['afii57449'] = 0x0649;
  15099. t['afii57450'] = 0x064A;
  15100. t['afii57451'] = 0x064B;
  15101. t['afii57452'] = 0x064C;
  15102. t['afii57453'] = 0x064D;
  15103. t['afii57454'] = 0x064E;
  15104. t['afii57455'] = 0x064F;
  15105. t['afii57456'] = 0x0650;
  15106. t['afii57457'] = 0x0651;
  15107. t['afii57458'] = 0x0652;
  15108. t['afii57470'] = 0x0647;
  15109. t['afii57505'] = 0x06A4;
  15110. t['afii57506'] = 0x067E;
  15111. t['afii57507'] = 0x0686;
  15112. t['afii57508'] = 0x0698;
  15113. t['afii57509'] = 0x06AF;
  15114. t['afii57511'] = 0x0679;
  15115. t['afii57512'] = 0x0688;
  15116. t['afii57513'] = 0x0691;
  15117. t['afii57514'] = 0x06BA;
  15118. t['afii57519'] = 0x06D2;
  15119. t['afii57534'] = 0x06D5;
  15120. t['afii57636'] = 0x20AA;
  15121. t['afii57645'] = 0x05BE;
  15122. t['afii57658'] = 0x05C3;
  15123. t['afii57664'] = 0x05D0;
  15124. t['afii57665'] = 0x05D1;
  15125. t['afii57666'] = 0x05D2;
  15126. t['afii57667'] = 0x05D3;
  15127. t['afii57668'] = 0x05D4;
  15128. t['afii57669'] = 0x05D5;
  15129. t['afii57670'] = 0x05D6;
  15130. t['afii57671'] = 0x05D7;
  15131. t['afii57672'] = 0x05D8;
  15132. t['afii57673'] = 0x05D9;
  15133. t['afii57674'] = 0x05DA;
  15134. t['afii57675'] = 0x05DB;
  15135. t['afii57676'] = 0x05DC;
  15136. t['afii57677'] = 0x05DD;
  15137. t['afii57678'] = 0x05DE;
  15138. t['afii57679'] = 0x05DF;
  15139. t['afii57680'] = 0x05E0;
  15140. t['afii57681'] = 0x05E1;
  15141. t['afii57682'] = 0x05E2;
  15142. t['afii57683'] = 0x05E3;
  15143. t['afii57684'] = 0x05E4;
  15144. t['afii57685'] = 0x05E5;
  15145. t['afii57686'] = 0x05E6;
  15146. t['afii57687'] = 0x05E7;
  15147. t['afii57688'] = 0x05E8;
  15148. t['afii57689'] = 0x05E9;
  15149. t['afii57690'] = 0x05EA;
  15150. t['afii57694'] = 0xFB2A;
  15151. t['afii57695'] = 0xFB2B;
  15152. t['afii57700'] = 0xFB4B;
  15153. t['afii57705'] = 0xFB1F;
  15154. t['afii57716'] = 0x05F0;
  15155. t['afii57717'] = 0x05F1;
  15156. t['afii57718'] = 0x05F2;
  15157. t['afii57723'] = 0xFB35;
  15158. t['afii57793'] = 0x05B4;
  15159. t['afii57794'] = 0x05B5;
  15160. t['afii57795'] = 0x05B6;
  15161. t['afii57796'] = 0x05BB;
  15162. t['afii57797'] = 0x05B8;
  15163. t['afii57798'] = 0x05B7;
  15164. t['afii57799'] = 0x05B0;
  15165. t['afii57800'] = 0x05B2;
  15166. t['afii57801'] = 0x05B1;
  15167. t['afii57802'] = 0x05B3;
  15168. t['afii57803'] = 0x05C2;
  15169. t['afii57804'] = 0x05C1;
  15170. t['afii57806'] = 0x05B9;
  15171. t['afii57807'] = 0x05BC;
  15172. t['afii57839'] = 0x05BD;
  15173. t['afii57841'] = 0x05BF;
  15174. t['afii57842'] = 0x05C0;
  15175. t['afii57929'] = 0x02BC;
  15176. t['afii61248'] = 0x2105;
  15177. t['afii61289'] = 0x2113;
  15178. t['afii61352'] = 0x2116;
  15179. t['afii61573'] = 0x202C;
  15180. t['afii61574'] = 0x202D;
  15181. t['afii61575'] = 0x202E;
  15182. t['afii61664'] = 0x200C;
  15183. t['afii63167'] = 0x066D;
  15184. t['afii64937'] = 0x02BD;
  15185. t['agrave'] = 0x00E0;
  15186. t['agujarati'] = 0x0A85;
  15187. t['agurmukhi'] = 0x0A05;
  15188. t['ahiragana'] = 0x3042;
  15189. t['ahookabove'] = 0x1EA3;
  15190. t['aibengali'] = 0x0990;
  15191. t['aibopomofo'] = 0x311E;
  15192. t['aideva'] = 0x0910;
  15193. t['aiecyrillic'] = 0x04D5;
  15194. t['aigujarati'] = 0x0A90;
  15195. t['aigurmukhi'] = 0x0A10;
  15196. t['aimatragurmukhi'] = 0x0A48;
  15197. t['ainarabic'] = 0x0639;
  15198. t['ainfinalarabic'] = 0xFECA;
  15199. t['aininitialarabic'] = 0xFECB;
  15200. t['ainmedialarabic'] = 0xFECC;
  15201. t['ainvertedbreve'] = 0x0203;
  15202. t['aivowelsignbengali'] = 0x09C8;
  15203. t['aivowelsigndeva'] = 0x0948;
  15204. t['aivowelsigngujarati'] = 0x0AC8;
  15205. t['akatakana'] = 0x30A2;
  15206. t['akatakanahalfwidth'] = 0xFF71;
  15207. t['akorean'] = 0x314F;
  15208. t['alef'] = 0x05D0;
  15209. t['alefarabic'] = 0x0627;
  15210. t['alefdageshhebrew'] = 0xFB30;
  15211. t['aleffinalarabic'] = 0xFE8E;
  15212. t['alefhamzaabovearabic'] = 0x0623;
  15213. t['alefhamzaabovefinalarabic'] = 0xFE84;
  15214. t['alefhamzabelowarabic'] = 0x0625;
  15215. t['alefhamzabelowfinalarabic'] = 0xFE88;
  15216. t['alefhebrew'] = 0x05D0;
  15217. t['aleflamedhebrew'] = 0xFB4F;
  15218. t['alefmaddaabovearabic'] = 0x0622;
  15219. t['alefmaddaabovefinalarabic'] = 0xFE82;
  15220. t['alefmaksuraarabic'] = 0x0649;
  15221. t['alefmaksurafinalarabic'] = 0xFEF0;
  15222. t['alefmaksurainitialarabic'] = 0xFEF3;
  15223. t['alefmaksuramedialarabic'] = 0xFEF4;
  15224. t['alefpatahhebrew'] = 0xFB2E;
  15225. t['alefqamatshebrew'] = 0xFB2F;
  15226. t['aleph'] = 0x2135;
  15227. t['allequal'] = 0x224C;
  15228. t['alpha'] = 0x03B1;
  15229. t['alphatonos'] = 0x03AC;
  15230. t['amacron'] = 0x0101;
  15231. t['amonospace'] = 0xFF41;
  15232. t['ampersand'] = 0x0026;
  15233. t['ampersandmonospace'] = 0xFF06;
  15234. t['ampersandsmall'] = 0xF726;
  15235. t['amsquare'] = 0x33C2;
  15236. t['anbopomofo'] = 0x3122;
  15237. t['angbopomofo'] = 0x3124;
  15238. t['angbracketleft'] = 0x3008;
  15239. t['angbracketright'] = 0x3009;
  15240. t['angkhankhuthai'] = 0x0E5A;
  15241. t['angle'] = 0x2220;
  15242. t['anglebracketleft'] = 0x3008;
  15243. t['anglebracketleftvertical'] = 0xFE3F;
  15244. t['anglebracketright'] = 0x3009;
  15245. t['anglebracketrightvertical'] = 0xFE40;
  15246. t['angleleft'] = 0x2329;
  15247. t['angleright'] = 0x232A;
  15248. t['angstrom'] = 0x212B;
  15249. t['anoteleia'] = 0x0387;
  15250. t['anudattadeva'] = 0x0952;
  15251. t['anusvarabengali'] = 0x0982;
  15252. t['anusvaradeva'] = 0x0902;
  15253. t['anusvaragujarati'] = 0x0A82;
  15254. t['aogonek'] = 0x0105;
  15255. t['apaatosquare'] = 0x3300;
  15256. t['aparen'] = 0x249C;
  15257. t['apostrophearmenian'] = 0x055A;
  15258. t['apostrophemod'] = 0x02BC;
  15259. t['apple'] = 0xF8FF;
  15260. t['approaches'] = 0x2250;
  15261. t['approxequal'] = 0x2248;
  15262. t['approxequalorimage'] = 0x2252;
  15263. t['approximatelyequal'] = 0x2245;
  15264. t['araeaekorean'] = 0x318E;
  15265. t['araeakorean'] = 0x318D;
  15266. t['arc'] = 0x2312;
  15267. t['arighthalfring'] = 0x1E9A;
  15268. t['aring'] = 0x00E5;
  15269. t['aringacute'] = 0x01FB;
  15270. t['aringbelow'] = 0x1E01;
  15271. t['arrowboth'] = 0x2194;
  15272. t['arrowdashdown'] = 0x21E3;
  15273. t['arrowdashleft'] = 0x21E0;
  15274. t['arrowdashright'] = 0x21E2;
  15275. t['arrowdashup'] = 0x21E1;
  15276. t['arrowdblboth'] = 0x21D4;
  15277. t['arrowdbldown'] = 0x21D3;
  15278. t['arrowdblleft'] = 0x21D0;
  15279. t['arrowdblright'] = 0x21D2;
  15280. t['arrowdblup'] = 0x21D1;
  15281. t['arrowdown'] = 0x2193;
  15282. t['arrowdownleft'] = 0x2199;
  15283. t['arrowdownright'] = 0x2198;
  15284. t['arrowdownwhite'] = 0x21E9;
  15285. t['arrowheaddownmod'] = 0x02C5;
  15286. t['arrowheadleftmod'] = 0x02C2;
  15287. t['arrowheadrightmod'] = 0x02C3;
  15288. t['arrowheadupmod'] = 0x02C4;
  15289. t['arrowhorizex'] = 0xF8E7;
  15290. t['arrowleft'] = 0x2190;
  15291. t['arrowleftdbl'] = 0x21D0;
  15292. t['arrowleftdblstroke'] = 0x21CD;
  15293. t['arrowleftoverright'] = 0x21C6;
  15294. t['arrowleftwhite'] = 0x21E6;
  15295. t['arrowright'] = 0x2192;
  15296. t['arrowrightdblstroke'] = 0x21CF;
  15297. t['arrowrightheavy'] = 0x279E;
  15298. t['arrowrightoverleft'] = 0x21C4;
  15299. t['arrowrightwhite'] = 0x21E8;
  15300. t['arrowtableft'] = 0x21E4;
  15301. t['arrowtabright'] = 0x21E5;
  15302. t['arrowup'] = 0x2191;
  15303. t['arrowupdn'] = 0x2195;
  15304. t['arrowupdnbse'] = 0x21A8;
  15305. t['arrowupdownbase'] = 0x21A8;
  15306. t['arrowupleft'] = 0x2196;
  15307. t['arrowupleftofdown'] = 0x21C5;
  15308. t['arrowupright'] = 0x2197;
  15309. t['arrowupwhite'] = 0x21E7;
  15310. t['arrowvertex'] = 0xF8E6;
  15311. t['asciicircum'] = 0x005E;
  15312. t['asciicircummonospace'] = 0xFF3E;
  15313. t['asciitilde'] = 0x007E;
  15314. t['asciitildemonospace'] = 0xFF5E;
  15315. t['ascript'] = 0x0251;
  15316. t['ascriptturned'] = 0x0252;
  15317. t['asmallhiragana'] = 0x3041;
  15318. t['asmallkatakana'] = 0x30A1;
  15319. t['asmallkatakanahalfwidth'] = 0xFF67;
  15320. t['asterisk'] = 0x002A;
  15321. t['asteriskaltonearabic'] = 0x066D;
  15322. t['asteriskarabic'] = 0x066D;
  15323. t['asteriskmath'] = 0x2217;
  15324. t['asteriskmonospace'] = 0xFF0A;
  15325. t['asterisksmall'] = 0xFE61;
  15326. t['asterism'] = 0x2042;
  15327. t['asuperior'] = 0xF6E9;
  15328. t['asymptoticallyequal'] = 0x2243;
  15329. t['at'] = 0x0040;
  15330. t['atilde'] = 0x00E3;
  15331. t['atmonospace'] = 0xFF20;
  15332. t['atsmall'] = 0xFE6B;
  15333. t['aturned'] = 0x0250;
  15334. t['aubengali'] = 0x0994;
  15335. t['aubopomofo'] = 0x3120;
  15336. t['audeva'] = 0x0914;
  15337. t['augujarati'] = 0x0A94;
  15338. t['augurmukhi'] = 0x0A14;
  15339. t['aulengthmarkbengali'] = 0x09D7;
  15340. t['aumatragurmukhi'] = 0x0A4C;
  15341. t['auvowelsignbengali'] = 0x09CC;
  15342. t['auvowelsigndeva'] = 0x094C;
  15343. t['auvowelsigngujarati'] = 0x0ACC;
  15344. t['avagrahadeva'] = 0x093D;
  15345. t['aybarmenian'] = 0x0561;
  15346. t['ayin'] = 0x05E2;
  15347. t['ayinaltonehebrew'] = 0xFB20;
  15348. t['ayinhebrew'] = 0x05E2;
  15349. t['b'] = 0x0062;
  15350. t['babengali'] = 0x09AC;
  15351. t['backslash'] = 0x005C;
  15352. t['backslashmonospace'] = 0xFF3C;
  15353. t['badeva'] = 0x092C;
  15354. t['bagujarati'] = 0x0AAC;
  15355. t['bagurmukhi'] = 0x0A2C;
  15356. t['bahiragana'] = 0x3070;
  15357. t['bahtthai'] = 0x0E3F;
  15358. t['bakatakana'] = 0x30D0;
  15359. t['bar'] = 0x007C;
  15360. t['barmonospace'] = 0xFF5C;
  15361. t['bbopomofo'] = 0x3105;
  15362. t['bcircle'] = 0x24D1;
  15363. t['bdotaccent'] = 0x1E03;
  15364. t['bdotbelow'] = 0x1E05;
  15365. t['beamedsixteenthnotes'] = 0x266C;
  15366. t['because'] = 0x2235;
  15367. t['becyrillic'] = 0x0431;
  15368. t['beharabic'] = 0x0628;
  15369. t['behfinalarabic'] = 0xFE90;
  15370. t['behinitialarabic'] = 0xFE91;
  15371. t['behiragana'] = 0x3079;
  15372. t['behmedialarabic'] = 0xFE92;
  15373. t['behmeeminitialarabic'] = 0xFC9F;
  15374. t['behmeemisolatedarabic'] = 0xFC08;
  15375. t['behnoonfinalarabic'] = 0xFC6D;
  15376. t['bekatakana'] = 0x30D9;
  15377. t['benarmenian'] = 0x0562;
  15378. t['bet'] = 0x05D1;
  15379. t['beta'] = 0x03B2;
  15380. t['betasymbolgreek'] = 0x03D0;
  15381. t['betdagesh'] = 0xFB31;
  15382. t['betdageshhebrew'] = 0xFB31;
  15383. t['bethebrew'] = 0x05D1;
  15384. t['betrafehebrew'] = 0xFB4C;
  15385. t['bhabengali'] = 0x09AD;
  15386. t['bhadeva'] = 0x092D;
  15387. t['bhagujarati'] = 0x0AAD;
  15388. t['bhagurmukhi'] = 0x0A2D;
  15389. t['bhook'] = 0x0253;
  15390. t['bihiragana'] = 0x3073;
  15391. t['bikatakana'] = 0x30D3;
  15392. t['bilabialclick'] = 0x0298;
  15393. t['bindigurmukhi'] = 0x0A02;
  15394. t['birusquare'] = 0x3331;
  15395. t['blackcircle'] = 0x25CF;
  15396. t['blackdiamond'] = 0x25C6;
  15397. t['blackdownpointingtriangle'] = 0x25BC;
  15398. t['blackleftpointingpointer'] = 0x25C4;
  15399. t['blackleftpointingtriangle'] = 0x25C0;
  15400. t['blacklenticularbracketleft'] = 0x3010;
  15401. t['blacklenticularbracketleftvertical'] = 0xFE3B;
  15402. t['blacklenticularbracketright'] = 0x3011;
  15403. t['blacklenticularbracketrightvertical'] = 0xFE3C;
  15404. t['blacklowerlefttriangle'] = 0x25E3;
  15405. t['blacklowerrighttriangle'] = 0x25E2;
  15406. t['blackrectangle'] = 0x25AC;
  15407. t['blackrightpointingpointer'] = 0x25BA;
  15408. t['blackrightpointingtriangle'] = 0x25B6;
  15409. t['blacksmallsquare'] = 0x25AA;
  15410. t['blacksmilingface'] = 0x263B;
  15411. t['blacksquare'] = 0x25A0;
  15412. t['blackstar'] = 0x2605;
  15413. t['blackupperlefttriangle'] = 0x25E4;
  15414. t['blackupperrighttriangle'] = 0x25E5;
  15415. t['blackuppointingsmalltriangle'] = 0x25B4;
  15416. t['blackuppointingtriangle'] = 0x25B2;
  15417. t['blank'] = 0x2423;
  15418. t['blinebelow'] = 0x1E07;
  15419. t['block'] = 0x2588;
  15420. t['bmonospace'] = 0xFF42;
  15421. t['bobaimaithai'] = 0x0E1A;
  15422. t['bohiragana'] = 0x307C;
  15423. t['bokatakana'] = 0x30DC;
  15424. t['bparen'] = 0x249D;
  15425. t['bqsquare'] = 0x33C3;
  15426. t['braceex'] = 0xF8F4;
  15427. t['braceleft'] = 0x007B;
  15428. t['braceleftbt'] = 0xF8F3;
  15429. t['braceleftmid'] = 0xF8F2;
  15430. t['braceleftmonospace'] = 0xFF5B;
  15431. t['braceleftsmall'] = 0xFE5B;
  15432. t['bracelefttp'] = 0xF8F1;
  15433. t['braceleftvertical'] = 0xFE37;
  15434. t['braceright'] = 0x007D;
  15435. t['bracerightbt'] = 0xF8FE;
  15436. t['bracerightmid'] = 0xF8FD;
  15437. t['bracerightmonospace'] = 0xFF5D;
  15438. t['bracerightsmall'] = 0xFE5C;
  15439. t['bracerighttp'] = 0xF8FC;
  15440. t['bracerightvertical'] = 0xFE38;
  15441. t['bracketleft'] = 0x005B;
  15442. t['bracketleftbt'] = 0xF8F0;
  15443. t['bracketleftex'] = 0xF8EF;
  15444. t['bracketleftmonospace'] = 0xFF3B;
  15445. t['bracketlefttp'] = 0xF8EE;
  15446. t['bracketright'] = 0x005D;
  15447. t['bracketrightbt'] = 0xF8FB;
  15448. t['bracketrightex'] = 0xF8FA;
  15449. t['bracketrightmonospace'] = 0xFF3D;
  15450. t['bracketrighttp'] = 0xF8F9;
  15451. t['breve'] = 0x02D8;
  15452. t['brevebelowcmb'] = 0x032E;
  15453. t['brevecmb'] = 0x0306;
  15454. t['breveinvertedbelowcmb'] = 0x032F;
  15455. t['breveinvertedcmb'] = 0x0311;
  15456. t['breveinverteddoublecmb'] = 0x0361;
  15457. t['bridgebelowcmb'] = 0x032A;
  15458. t['bridgeinvertedbelowcmb'] = 0x033A;
  15459. t['brokenbar'] = 0x00A6;
  15460. t['bstroke'] = 0x0180;
  15461. t['bsuperior'] = 0xF6EA;
  15462. t['btopbar'] = 0x0183;
  15463. t['buhiragana'] = 0x3076;
  15464. t['bukatakana'] = 0x30D6;
  15465. t['bullet'] = 0x2022;
  15466. t['bulletinverse'] = 0x25D8;
  15467. t['bulletoperator'] = 0x2219;
  15468. t['bullseye'] = 0x25CE;
  15469. t['c'] = 0x0063;
  15470. t['caarmenian'] = 0x056E;
  15471. t['cabengali'] = 0x099A;
  15472. t['cacute'] = 0x0107;
  15473. t['cadeva'] = 0x091A;
  15474. t['cagujarati'] = 0x0A9A;
  15475. t['cagurmukhi'] = 0x0A1A;
  15476. t['calsquare'] = 0x3388;
  15477. t['candrabindubengali'] = 0x0981;
  15478. t['candrabinducmb'] = 0x0310;
  15479. t['candrabindudeva'] = 0x0901;
  15480. t['candrabindugujarati'] = 0x0A81;
  15481. t['capslock'] = 0x21EA;
  15482. t['careof'] = 0x2105;
  15483. t['caron'] = 0x02C7;
  15484. t['caronbelowcmb'] = 0x032C;
  15485. t['caroncmb'] = 0x030C;
  15486. t['carriagereturn'] = 0x21B5;
  15487. t['cbopomofo'] = 0x3118;
  15488. t['ccaron'] = 0x010D;
  15489. t['ccedilla'] = 0x00E7;
  15490. t['ccedillaacute'] = 0x1E09;
  15491. t['ccircle'] = 0x24D2;
  15492. t['ccircumflex'] = 0x0109;
  15493. t['ccurl'] = 0x0255;
  15494. t['cdot'] = 0x010B;
  15495. t['cdotaccent'] = 0x010B;
  15496. t['cdsquare'] = 0x33C5;
  15497. t['cedilla'] = 0x00B8;
  15498. t['cedillacmb'] = 0x0327;
  15499. t['cent'] = 0x00A2;
  15500. t['centigrade'] = 0x2103;
  15501. t['centinferior'] = 0xF6DF;
  15502. t['centmonospace'] = 0xFFE0;
  15503. t['centoldstyle'] = 0xF7A2;
  15504. t['centsuperior'] = 0xF6E0;
  15505. t['chaarmenian'] = 0x0579;
  15506. t['chabengali'] = 0x099B;
  15507. t['chadeva'] = 0x091B;
  15508. t['chagujarati'] = 0x0A9B;
  15509. t['chagurmukhi'] = 0x0A1B;
  15510. t['chbopomofo'] = 0x3114;
  15511. t['cheabkhasiancyrillic'] = 0x04BD;
  15512. t['checkmark'] = 0x2713;
  15513. t['checyrillic'] = 0x0447;
  15514. t['chedescenderabkhasiancyrillic'] = 0x04BF;
  15515. t['chedescendercyrillic'] = 0x04B7;
  15516. t['chedieresiscyrillic'] = 0x04F5;
  15517. t['cheharmenian'] = 0x0573;
  15518. t['chekhakassiancyrillic'] = 0x04CC;
  15519. t['cheverticalstrokecyrillic'] = 0x04B9;
  15520. t['chi'] = 0x03C7;
  15521. t['chieuchacirclekorean'] = 0x3277;
  15522. t['chieuchaparenkorean'] = 0x3217;
  15523. t['chieuchcirclekorean'] = 0x3269;
  15524. t['chieuchkorean'] = 0x314A;
  15525. t['chieuchparenkorean'] = 0x3209;
  15526. t['chochangthai'] = 0x0E0A;
  15527. t['chochanthai'] = 0x0E08;
  15528. t['chochingthai'] = 0x0E09;
  15529. t['chochoethai'] = 0x0E0C;
  15530. t['chook'] = 0x0188;
  15531. t['cieucacirclekorean'] = 0x3276;
  15532. t['cieucaparenkorean'] = 0x3216;
  15533. t['cieuccirclekorean'] = 0x3268;
  15534. t['cieuckorean'] = 0x3148;
  15535. t['cieucparenkorean'] = 0x3208;
  15536. t['cieucuparenkorean'] = 0x321C;
  15537. t['circle'] = 0x25CB;
  15538. t['circlecopyrt'] = 0x00A9;
  15539. t['circlemultiply'] = 0x2297;
  15540. t['circleot'] = 0x2299;
  15541. t['circleplus'] = 0x2295;
  15542. t['circlepostalmark'] = 0x3036;
  15543. t['circlewithlefthalfblack'] = 0x25D0;
  15544. t['circlewithrighthalfblack'] = 0x25D1;
  15545. t['circumflex'] = 0x02C6;
  15546. t['circumflexbelowcmb'] = 0x032D;
  15547. t['circumflexcmb'] = 0x0302;
  15548. t['clear'] = 0x2327;
  15549. t['clickalveolar'] = 0x01C2;
  15550. t['clickdental'] = 0x01C0;
  15551. t['clicklateral'] = 0x01C1;
  15552. t['clickretroflex'] = 0x01C3;
  15553. t['club'] = 0x2663;
  15554. t['clubsuitblack'] = 0x2663;
  15555. t['clubsuitwhite'] = 0x2667;
  15556. t['cmcubedsquare'] = 0x33A4;
  15557. t['cmonospace'] = 0xFF43;
  15558. t['cmsquaredsquare'] = 0x33A0;
  15559. t['coarmenian'] = 0x0581;
  15560. t['colon'] = 0x003A;
  15561. t['colonmonetary'] = 0x20A1;
  15562. t['colonmonospace'] = 0xFF1A;
  15563. t['colonsign'] = 0x20A1;
  15564. t['colonsmall'] = 0xFE55;
  15565. t['colontriangularhalfmod'] = 0x02D1;
  15566. t['colontriangularmod'] = 0x02D0;
  15567. t['comma'] = 0x002C;
  15568. t['commaabovecmb'] = 0x0313;
  15569. t['commaaboverightcmb'] = 0x0315;
  15570. t['commaaccent'] = 0xF6C3;
  15571. t['commaarabic'] = 0x060C;
  15572. t['commaarmenian'] = 0x055D;
  15573. t['commainferior'] = 0xF6E1;
  15574. t['commamonospace'] = 0xFF0C;
  15575. t['commareversedabovecmb'] = 0x0314;
  15576. t['commareversedmod'] = 0x02BD;
  15577. t['commasmall'] = 0xFE50;
  15578. t['commasuperior'] = 0xF6E2;
  15579. t['commaturnedabovecmb'] = 0x0312;
  15580. t['commaturnedmod'] = 0x02BB;
  15581. t['compass'] = 0x263C;
  15582. t['congruent'] = 0x2245;
  15583. t['contourintegral'] = 0x222E;
  15584. t['control'] = 0x2303;
  15585. t['controlACK'] = 0x0006;
  15586. t['controlBEL'] = 0x0007;
  15587. t['controlBS'] = 0x0008;
  15588. t['controlCAN'] = 0x0018;
  15589. t['controlCR'] = 0x000D;
  15590. t['controlDC1'] = 0x0011;
  15591. t['controlDC2'] = 0x0012;
  15592. t['controlDC3'] = 0x0013;
  15593. t['controlDC4'] = 0x0014;
  15594. t['controlDEL'] = 0x007F;
  15595. t['controlDLE'] = 0x0010;
  15596. t['controlEM'] = 0x0019;
  15597. t['controlENQ'] = 0x0005;
  15598. t['controlEOT'] = 0x0004;
  15599. t['controlESC'] = 0x001B;
  15600. t['controlETB'] = 0x0017;
  15601. t['controlETX'] = 0x0003;
  15602. t['controlFF'] = 0x000C;
  15603. t['controlFS'] = 0x001C;
  15604. t['controlGS'] = 0x001D;
  15605. t['controlHT'] = 0x0009;
  15606. t['controlLF'] = 0x000A;
  15607. t['controlNAK'] = 0x0015;
  15608. t['controlNULL'] = 0x0000;
  15609. t['controlRS'] = 0x001E;
  15610. t['controlSI'] = 0x000F;
  15611. t['controlSO'] = 0x000E;
  15612. t['controlSOT'] = 0x0002;
  15613. t['controlSTX'] = 0x0001;
  15614. t['controlSUB'] = 0x001A;
  15615. t['controlSYN'] = 0x0016;
  15616. t['controlUS'] = 0x001F;
  15617. t['controlVT'] = 0x000B;
  15618. t['copyright'] = 0x00A9;
  15619. t['copyrightsans'] = 0xF8E9;
  15620. t['copyrightserif'] = 0xF6D9;
  15621. t['cornerbracketleft'] = 0x300C;
  15622. t['cornerbracketlefthalfwidth'] = 0xFF62;
  15623. t['cornerbracketleftvertical'] = 0xFE41;
  15624. t['cornerbracketright'] = 0x300D;
  15625. t['cornerbracketrighthalfwidth'] = 0xFF63;
  15626. t['cornerbracketrightvertical'] = 0xFE42;
  15627. t['corporationsquare'] = 0x337F;
  15628. t['cosquare'] = 0x33C7;
  15629. t['coverkgsquare'] = 0x33C6;
  15630. t['cparen'] = 0x249E;
  15631. t['cruzeiro'] = 0x20A2;
  15632. t['cstretched'] = 0x0297;
  15633. t['curlyand'] = 0x22CF;
  15634. t['curlyor'] = 0x22CE;
  15635. t['currency'] = 0x00A4;
  15636. t['cyrBreve'] = 0xF6D1;
  15637. t['cyrFlex'] = 0xF6D2;
  15638. t['cyrbreve'] = 0xF6D4;
  15639. t['cyrflex'] = 0xF6D5;
  15640. t['d'] = 0x0064;
  15641. t['daarmenian'] = 0x0564;
  15642. t['dabengali'] = 0x09A6;
  15643. t['dadarabic'] = 0x0636;
  15644. t['dadeva'] = 0x0926;
  15645. t['dadfinalarabic'] = 0xFEBE;
  15646. t['dadinitialarabic'] = 0xFEBF;
  15647. t['dadmedialarabic'] = 0xFEC0;
  15648. t['dagesh'] = 0x05BC;
  15649. t['dageshhebrew'] = 0x05BC;
  15650. t['dagger'] = 0x2020;
  15651. t['daggerdbl'] = 0x2021;
  15652. t['dagujarati'] = 0x0AA6;
  15653. t['dagurmukhi'] = 0x0A26;
  15654. t['dahiragana'] = 0x3060;
  15655. t['dakatakana'] = 0x30C0;
  15656. t['dalarabic'] = 0x062F;
  15657. t['dalet'] = 0x05D3;
  15658. t['daletdagesh'] = 0xFB33;
  15659. t['daletdageshhebrew'] = 0xFB33;
  15660. t['dalethebrew'] = 0x05D3;
  15661. t['dalfinalarabic'] = 0xFEAA;
  15662. t['dammaarabic'] = 0x064F;
  15663. t['dammalowarabic'] = 0x064F;
  15664. t['dammatanaltonearabic'] = 0x064C;
  15665. t['dammatanarabic'] = 0x064C;
  15666. t['danda'] = 0x0964;
  15667. t['dargahebrew'] = 0x05A7;
  15668. t['dargalefthebrew'] = 0x05A7;
  15669. t['dasiapneumatacyrilliccmb'] = 0x0485;
  15670. t['dblGrave'] = 0xF6D3;
  15671. t['dblanglebracketleft'] = 0x300A;
  15672. t['dblanglebracketleftvertical'] = 0xFE3D;
  15673. t['dblanglebracketright'] = 0x300B;
  15674. t['dblanglebracketrightvertical'] = 0xFE3E;
  15675. t['dblarchinvertedbelowcmb'] = 0x032B;
  15676. t['dblarrowleft'] = 0x21D4;
  15677. t['dblarrowright'] = 0x21D2;
  15678. t['dbldanda'] = 0x0965;
  15679. t['dblgrave'] = 0xF6D6;
  15680. t['dblgravecmb'] = 0x030F;
  15681. t['dblintegral'] = 0x222C;
  15682. t['dbllowline'] = 0x2017;
  15683. t['dbllowlinecmb'] = 0x0333;
  15684. t['dbloverlinecmb'] = 0x033F;
  15685. t['dblprimemod'] = 0x02BA;
  15686. t['dblverticalbar'] = 0x2016;
  15687. t['dblverticallineabovecmb'] = 0x030E;
  15688. t['dbopomofo'] = 0x3109;
  15689. t['dbsquare'] = 0x33C8;
  15690. t['dcaron'] = 0x010F;
  15691. t['dcedilla'] = 0x1E11;
  15692. t['dcircle'] = 0x24D3;
  15693. t['dcircumflexbelow'] = 0x1E13;
  15694. t['dcroat'] = 0x0111;
  15695. t['ddabengali'] = 0x09A1;
  15696. t['ddadeva'] = 0x0921;
  15697. t['ddagujarati'] = 0x0AA1;
  15698. t['ddagurmukhi'] = 0x0A21;
  15699. t['ddalarabic'] = 0x0688;
  15700. t['ddalfinalarabic'] = 0xFB89;
  15701. t['dddhadeva'] = 0x095C;
  15702. t['ddhabengali'] = 0x09A2;
  15703. t['ddhadeva'] = 0x0922;
  15704. t['ddhagujarati'] = 0x0AA2;
  15705. t['ddhagurmukhi'] = 0x0A22;
  15706. t['ddotaccent'] = 0x1E0B;
  15707. t['ddotbelow'] = 0x1E0D;
  15708. t['decimalseparatorarabic'] = 0x066B;
  15709. t['decimalseparatorpersian'] = 0x066B;
  15710. t['decyrillic'] = 0x0434;
  15711. t['degree'] = 0x00B0;
  15712. t['dehihebrew'] = 0x05AD;
  15713. t['dehiragana'] = 0x3067;
  15714. t['deicoptic'] = 0x03EF;
  15715. t['dekatakana'] = 0x30C7;
  15716. t['deleteleft'] = 0x232B;
  15717. t['deleteright'] = 0x2326;
  15718. t['delta'] = 0x03B4;
  15719. t['deltaturned'] = 0x018D;
  15720. t['denominatorminusonenumeratorbengali'] = 0x09F8;
  15721. t['dezh'] = 0x02A4;
  15722. t['dhabengali'] = 0x09A7;
  15723. t['dhadeva'] = 0x0927;
  15724. t['dhagujarati'] = 0x0AA7;
  15725. t['dhagurmukhi'] = 0x0A27;
  15726. t['dhook'] = 0x0257;
  15727. t['dialytikatonos'] = 0x0385;
  15728. t['dialytikatonoscmb'] = 0x0344;
  15729. t['diamond'] = 0x2666;
  15730. t['diamondsuitwhite'] = 0x2662;
  15731. t['dieresis'] = 0x00A8;
  15732. t['dieresisacute'] = 0xF6D7;
  15733. t['dieresisbelowcmb'] = 0x0324;
  15734. t['dieresiscmb'] = 0x0308;
  15735. t['dieresisgrave'] = 0xF6D8;
  15736. t['dieresistonos'] = 0x0385;
  15737. t['dihiragana'] = 0x3062;
  15738. t['dikatakana'] = 0x30C2;
  15739. t['dittomark'] = 0x3003;
  15740. t['divide'] = 0x00F7;
  15741. t['divides'] = 0x2223;
  15742. t['divisionslash'] = 0x2215;
  15743. t['djecyrillic'] = 0x0452;
  15744. t['dkshade'] = 0x2593;
  15745. t['dlinebelow'] = 0x1E0F;
  15746. t['dlsquare'] = 0x3397;
  15747. t['dmacron'] = 0x0111;
  15748. t['dmonospace'] = 0xFF44;
  15749. t['dnblock'] = 0x2584;
  15750. t['dochadathai'] = 0x0E0E;
  15751. t['dodekthai'] = 0x0E14;
  15752. t['dohiragana'] = 0x3069;
  15753. t['dokatakana'] = 0x30C9;
  15754. t['dollar'] = 0x0024;
  15755. t['dollarinferior'] = 0xF6E3;
  15756. t['dollarmonospace'] = 0xFF04;
  15757. t['dollaroldstyle'] = 0xF724;
  15758. t['dollarsmall'] = 0xFE69;
  15759. t['dollarsuperior'] = 0xF6E4;
  15760. t['dong'] = 0x20AB;
  15761. t['dorusquare'] = 0x3326;
  15762. t['dotaccent'] = 0x02D9;
  15763. t['dotaccentcmb'] = 0x0307;
  15764. t['dotbelowcmb'] = 0x0323;
  15765. t['dotbelowcomb'] = 0x0323;
  15766. t['dotkatakana'] = 0x30FB;
  15767. t['dotlessi'] = 0x0131;
  15768. t['dotlessj'] = 0xF6BE;
  15769. t['dotlessjstrokehook'] = 0x0284;
  15770. t['dotmath'] = 0x22C5;
  15771. t['dottedcircle'] = 0x25CC;
  15772. t['doubleyodpatah'] = 0xFB1F;
  15773. t['doubleyodpatahhebrew'] = 0xFB1F;
  15774. t['downtackbelowcmb'] = 0x031E;
  15775. t['downtackmod'] = 0x02D5;
  15776. t['dparen'] = 0x249F;
  15777. t['dsuperior'] = 0xF6EB;
  15778. t['dtail'] = 0x0256;
  15779. t['dtopbar'] = 0x018C;
  15780. t['duhiragana'] = 0x3065;
  15781. t['dukatakana'] = 0x30C5;
  15782. t['dz'] = 0x01F3;
  15783. t['dzaltone'] = 0x02A3;
  15784. t['dzcaron'] = 0x01C6;
  15785. t['dzcurl'] = 0x02A5;
  15786. t['dzeabkhasiancyrillic'] = 0x04E1;
  15787. t['dzecyrillic'] = 0x0455;
  15788. t['dzhecyrillic'] = 0x045F;
  15789. t['e'] = 0x0065;
  15790. t['eacute'] = 0x00E9;
  15791. t['earth'] = 0x2641;
  15792. t['ebengali'] = 0x098F;
  15793. t['ebopomofo'] = 0x311C;
  15794. t['ebreve'] = 0x0115;
  15795. t['ecandradeva'] = 0x090D;
  15796. t['ecandragujarati'] = 0x0A8D;
  15797. t['ecandravowelsigndeva'] = 0x0945;
  15798. t['ecandravowelsigngujarati'] = 0x0AC5;
  15799. t['ecaron'] = 0x011B;
  15800. t['ecedillabreve'] = 0x1E1D;
  15801. t['echarmenian'] = 0x0565;
  15802. t['echyiwnarmenian'] = 0x0587;
  15803. t['ecircle'] = 0x24D4;
  15804. t['ecircumflex'] = 0x00EA;
  15805. t['ecircumflexacute'] = 0x1EBF;
  15806. t['ecircumflexbelow'] = 0x1E19;
  15807. t['ecircumflexdotbelow'] = 0x1EC7;
  15808. t['ecircumflexgrave'] = 0x1EC1;
  15809. t['ecircumflexhookabove'] = 0x1EC3;
  15810. t['ecircumflextilde'] = 0x1EC5;
  15811. t['ecyrillic'] = 0x0454;
  15812. t['edblgrave'] = 0x0205;
  15813. t['edeva'] = 0x090F;
  15814. t['edieresis'] = 0x00EB;
  15815. t['edot'] = 0x0117;
  15816. t['edotaccent'] = 0x0117;
  15817. t['edotbelow'] = 0x1EB9;
  15818. t['eegurmukhi'] = 0x0A0F;
  15819. t['eematragurmukhi'] = 0x0A47;
  15820. t['efcyrillic'] = 0x0444;
  15821. t['egrave'] = 0x00E8;
  15822. t['egujarati'] = 0x0A8F;
  15823. t['eharmenian'] = 0x0567;
  15824. t['ehbopomofo'] = 0x311D;
  15825. t['ehiragana'] = 0x3048;
  15826. t['ehookabove'] = 0x1EBB;
  15827. t['eibopomofo'] = 0x311F;
  15828. t['eight'] = 0x0038;
  15829. t['eightarabic'] = 0x0668;
  15830. t['eightbengali'] = 0x09EE;
  15831. t['eightcircle'] = 0x2467;
  15832. t['eightcircleinversesansserif'] = 0x2791;
  15833. t['eightdeva'] = 0x096E;
  15834. t['eighteencircle'] = 0x2471;
  15835. t['eighteenparen'] = 0x2485;
  15836. t['eighteenperiod'] = 0x2499;
  15837. t['eightgujarati'] = 0x0AEE;
  15838. t['eightgurmukhi'] = 0x0A6E;
  15839. t['eighthackarabic'] = 0x0668;
  15840. t['eighthangzhou'] = 0x3028;
  15841. t['eighthnotebeamed'] = 0x266B;
  15842. t['eightideographicparen'] = 0x3227;
  15843. t['eightinferior'] = 0x2088;
  15844. t['eightmonospace'] = 0xFF18;
  15845. t['eightoldstyle'] = 0xF738;
  15846. t['eightparen'] = 0x247B;
  15847. t['eightperiod'] = 0x248F;
  15848. t['eightpersian'] = 0x06F8;
  15849. t['eightroman'] = 0x2177;
  15850. t['eightsuperior'] = 0x2078;
  15851. t['eightthai'] = 0x0E58;
  15852. t['einvertedbreve'] = 0x0207;
  15853. t['eiotifiedcyrillic'] = 0x0465;
  15854. t['ekatakana'] = 0x30A8;
  15855. t['ekatakanahalfwidth'] = 0xFF74;
  15856. t['ekonkargurmukhi'] = 0x0A74;
  15857. t['ekorean'] = 0x3154;
  15858. t['elcyrillic'] = 0x043B;
  15859. t['element'] = 0x2208;
  15860. t['elevencircle'] = 0x246A;
  15861. t['elevenparen'] = 0x247E;
  15862. t['elevenperiod'] = 0x2492;
  15863. t['elevenroman'] = 0x217A;
  15864. t['ellipsis'] = 0x2026;
  15865. t['ellipsisvertical'] = 0x22EE;
  15866. t['emacron'] = 0x0113;
  15867. t['emacronacute'] = 0x1E17;
  15868. t['emacrongrave'] = 0x1E15;
  15869. t['emcyrillic'] = 0x043C;
  15870. t['emdash'] = 0x2014;
  15871. t['emdashvertical'] = 0xFE31;
  15872. t['emonospace'] = 0xFF45;
  15873. t['emphasismarkarmenian'] = 0x055B;
  15874. t['emptyset'] = 0x2205;
  15875. t['enbopomofo'] = 0x3123;
  15876. t['encyrillic'] = 0x043D;
  15877. t['endash'] = 0x2013;
  15878. t['endashvertical'] = 0xFE32;
  15879. t['endescendercyrillic'] = 0x04A3;
  15880. t['eng'] = 0x014B;
  15881. t['engbopomofo'] = 0x3125;
  15882. t['enghecyrillic'] = 0x04A5;
  15883. t['enhookcyrillic'] = 0x04C8;
  15884. t['enspace'] = 0x2002;
  15885. t['eogonek'] = 0x0119;
  15886. t['eokorean'] = 0x3153;
  15887. t['eopen'] = 0x025B;
  15888. t['eopenclosed'] = 0x029A;
  15889. t['eopenreversed'] = 0x025C;
  15890. t['eopenreversedclosed'] = 0x025E;
  15891. t['eopenreversedhook'] = 0x025D;
  15892. t['eparen'] = 0x24A0;
  15893. t['epsilon'] = 0x03B5;
  15894. t['epsilontonos'] = 0x03AD;
  15895. t['equal'] = 0x003D;
  15896. t['equalmonospace'] = 0xFF1D;
  15897. t['equalsmall'] = 0xFE66;
  15898. t['equalsuperior'] = 0x207C;
  15899. t['equivalence'] = 0x2261;
  15900. t['erbopomofo'] = 0x3126;
  15901. t['ercyrillic'] = 0x0440;
  15902. t['ereversed'] = 0x0258;
  15903. t['ereversedcyrillic'] = 0x044D;
  15904. t['escyrillic'] = 0x0441;
  15905. t['esdescendercyrillic'] = 0x04AB;
  15906. t['esh'] = 0x0283;
  15907. t['eshcurl'] = 0x0286;
  15908. t['eshortdeva'] = 0x090E;
  15909. t['eshortvowelsigndeva'] = 0x0946;
  15910. t['eshreversedloop'] = 0x01AA;
  15911. t['eshsquatreversed'] = 0x0285;
  15912. t['esmallhiragana'] = 0x3047;
  15913. t['esmallkatakana'] = 0x30A7;
  15914. t['esmallkatakanahalfwidth'] = 0xFF6A;
  15915. t['estimated'] = 0x212E;
  15916. t['esuperior'] = 0xF6EC;
  15917. t['eta'] = 0x03B7;
  15918. t['etarmenian'] = 0x0568;
  15919. t['etatonos'] = 0x03AE;
  15920. t['eth'] = 0x00F0;
  15921. t['etilde'] = 0x1EBD;
  15922. t['etildebelow'] = 0x1E1B;
  15923. t['etnahtafoukhhebrew'] = 0x0591;
  15924. t['etnahtafoukhlefthebrew'] = 0x0591;
  15925. t['etnahtahebrew'] = 0x0591;
  15926. t['etnahtalefthebrew'] = 0x0591;
  15927. t['eturned'] = 0x01DD;
  15928. t['eukorean'] = 0x3161;
  15929. t['euro'] = 0x20AC;
  15930. t['evowelsignbengali'] = 0x09C7;
  15931. t['evowelsigndeva'] = 0x0947;
  15932. t['evowelsigngujarati'] = 0x0AC7;
  15933. t['exclam'] = 0x0021;
  15934. t['exclamarmenian'] = 0x055C;
  15935. t['exclamdbl'] = 0x203C;
  15936. t['exclamdown'] = 0x00A1;
  15937. t['exclamdownsmall'] = 0xF7A1;
  15938. t['exclammonospace'] = 0xFF01;
  15939. t['exclamsmall'] = 0xF721;
  15940. t['existential'] = 0x2203;
  15941. t['ezh'] = 0x0292;
  15942. t['ezhcaron'] = 0x01EF;
  15943. t['ezhcurl'] = 0x0293;
  15944. t['ezhreversed'] = 0x01B9;
  15945. t['ezhtail'] = 0x01BA;
  15946. t['f'] = 0x0066;
  15947. t['fadeva'] = 0x095E;
  15948. t['fagurmukhi'] = 0x0A5E;
  15949. t['fahrenheit'] = 0x2109;
  15950. t['fathaarabic'] = 0x064E;
  15951. t['fathalowarabic'] = 0x064E;
  15952. t['fathatanarabic'] = 0x064B;
  15953. t['fbopomofo'] = 0x3108;
  15954. t['fcircle'] = 0x24D5;
  15955. t['fdotaccent'] = 0x1E1F;
  15956. t['feharabic'] = 0x0641;
  15957. t['feharmenian'] = 0x0586;
  15958. t['fehfinalarabic'] = 0xFED2;
  15959. t['fehinitialarabic'] = 0xFED3;
  15960. t['fehmedialarabic'] = 0xFED4;
  15961. t['feicoptic'] = 0x03E5;
  15962. t['female'] = 0x2640;
  15963. t['ff'] = 0xFB00;
  15964. t['ffi'] = 0xFB03;
  15965. t['ffl'] = 0xFB04;
  15966. t['fi'] = 0xFB01;
  15967. t['fifteencircle'] = 0x246E;
  15968. t['fifteenparen'] = 0x2482;
  15969. t['fifteenperiod'] = 0x2496;
  15970. t['figuredash'] = 0x2012;
  15971. t['filledbox'] = 0x25A0;
  15972. t['filledrect'] = 0x25AC;
  15973. t['finalkaf'] = 0x05DA;
  15974. t['finalkafdagesh'] = 0xFB3A;
  15975. t['finalkafdageshhebrew'] = 0xFB3A;
  15976. t['finalkafhebrew'] = 0x05DA;
  15977. t['finalmem'] = 0x05DD;
  15978. t['finalmemhebrew'] = 0x05DD;
  15979. t['finalnun'] = 0x05DF;
  15980. t['finalnunhebrew'] = 0x05DF;
  15981. t['finalpe'] = 0x05E3;
  15982. t['finalpehebrew'] = 0x05E3;
  15983. t['finaltsadi'] = 0x05E5;
  15984. t['finaltsadihebrew'] = 0x05E5;
  15985. t['firsttonechinese'] = 0x02C9;
  15986. t['fisheye'] = 0x25C9;
  15987. t['fitacyrillic'] = 0x0473;
  15988. t['five'] = 0x0035;
  15989. t['fivearabic'] = 0x0665;
  15990. t['fivebengali'] = 0x09EB;
  15991. t['fivecircle'] = 0x2464;
  15992. t['fivecircleinversesansserif'] = 0x278E;
  15993. t['fivedeva'] = 0x096B;
  15994. t['fiveeighths'] = 0x215D;
  15995. t['fivegujarati'] = 0x0AEB;
  15996. t['fivegurmukhi'] = 0x0A6B;
  15997. t['fivehackarabic'] = 0x0665;
  15998. t['fivehangzhou'] = 0x3025;
  15999. t['fiveideographicparen'] = 0x3224;
  16000. t['fiveinferior'] = 0x2085;
  16001. t['fivemonospace'] = 0xFF15;
  16002. t['fiveoldstyle'] = 0xF735;
  16003. t['fiveparen'] = 0x2478;
  16004. t['fiveperiod'] = 0x248C;
  16005. t['fivepersian'] = 0x06F5;
  16006. t['fiveroman'] = 0x2174;
  16007. t['fivesuperior'] = 0x2075;
  16008. t['fivethai'] = 0x0E55;
  16009. t['fl'] = 0xFB02;
  16010. t['florin'] = 0x0192;
  16011. t['fmonospace'] = 0xFF46;
  16012. t['fmsquare'] = 0x3399;
  16013. t['fofanthai'] = 0x0E1F;
  16014. t['fofathai'] = 0x0E1D;
  16015. t['fongmanthai'] = 0x0E4F;
  16016. t['forall'] = 0x2200;
  16017. t['four'] = 0x0034;
  16018. t['fourarabic'] = 0x0664;
  16019. t['fourbengali'] = 0x09EA;
  16020. t['fourcircle'] = 0x2463;
  16021. t['fourcircleinversesansserif'] = 0x278D;
  16022. t['fourdeva'] = 0x096A;
  16023. t['fourgujarati'] = 0x0AEA;
  16024. t['fourgurmukhi'] = 0x0A6A;
  16025. t['fourhackarabic'] = 0x0664;
  16026. t['fourhangzhou'] = 0x3024;
  16027. t['fourideographicparen'] = 0x3223;
  16028. t['fourinferior'] = 0x2084;
  16029. t['fourmonospace'] = 0xFF14;
  16030. t['fournumeratorbengali'] = 0x09F7;
  16031. t['fouroldstyle'] = 0xF734;
  16032. t['fourparen'] = 0x2477;
  16033. t['fourperiod'] = 0x248B;
  16034. t['fourpersian'] = 0x06F4;
  16035. t['fourroman'] = 0x2173;
  16036. t['foursuperior'] = 0x2074;
  16037. t['fourteencircle'] = 0x246D;
  16038. t['fourteenparen'] = 0x2481;
  16039. t['fourteenperiod'] = 0x2495;
  16040. t['fourthai'] = 0x0E54;
  16041. t['fourthtonechinese'] = 0x02CB;
  16042. t['fparen'] = 0x24A1;
  16043. t['fraction'] = 0x2044;
  16044. t['franc'] = 0x20A3;
  16045. t['g'] = 0x0067;
  16046. t['gabengali'] = 0x0997;
  16047. t['gacute'] = 0x01F5;
  16048. t['gadeva'] = 0x0917;
  16049. t['gafarabic'] = 0x06AF;
  16050. t['gaffinalarabic'] = 0xFB93;
  16051. t['gafinitialarabic'] = 0xFB94;
  16052. t['gafmedialarabic'] = 0xFB95;
  16053. t['gagujarati'] = 0x0A97;
  16054. t['gagurmukhi'] = 0x0A17;
  16055. t['gahiragana'] = 0x304C;
  16056. t['gakatakana'] = 0x30AC;
  16057. t['gamma'] = 0x03B3;
  16058. t['gammalatinsmall'] = 0x0263;
  16059. t['gammasuperior'] = 0x02E0;
  16060. t['gangiacoptic'] = 0x03EB;
  16061. t['gbopomofo'] = 0x310D;
  16062. t['gbreve'] = 0x011F;
  16063. t['gcaron'] = 0x01E7;
  16064. t['gcedilla'] = 0x0123;
  16065. t['gcircle'] = 0x24D6;
  16066. t['gcircumflex'] = 0x011D;
  16067. t['gcommaaccent'] = 0x0123;
  16068. t['gdot'] = 0x0121;
  16069. t['gdotaccent'] = 0x0121;
  16070. t['gecyrillic'] = 0x0433;
  16071. t['gehiragana'] = 0x3052;
  16072. t['gekatakana'] = 0x30B2;
  16073. t['geometricallyequal'] = 0x2251;
  16074. t['gereshaccenthebrew'] = 0x059C;
  16075. t['gereshhebrew'] = 0x05F3;
  16076. t['gereshmuqdamhebrew'] = 0x059D;
  16077. t['germandbls'] = 0x00DF;
  16078. t['gershayimaccenthebrew'] = 0x059E;
  16079. t['gershayimhebrew'] = 0x05F4;
  16080. t['getamark'] = 0x3013;
  16081. t['ghabengali'] = 0x0998;
  16082. t['ghadarmenian'] = 0x0572;
  16083. t['ghadeva'] = 0x0918;
  16084. t['ghagujarati'] = 0x0A98;
  16085. t['ghagurmukhi'] = 0x0A18;
  16086. t['ghainarabic'] = 0x063A;
  16087. t['ghainfinalarabic'] = 0xFECE;
  16088. t['ghaininitialarabic'] = 0xFECF;
  16089. t['ghainmedialarabic'] = 0xFED0;
  16090. t['ghemiddlehookcyrillic'] = 0x0495;
  16091. t['ghestrokecyrillic'] = 0x0493;
  16092. t['gheupturncyrillic'] = 0x0491;
  16093. t['ghhadeva'] = 0x095A;
  16094. t['ghhagurmukhi'] = 0x0A5A;
  16095. t['ghook'] = 0x0260;
  16096. t['ghzsquare'] = 0x3393;
  16097. t['gihiragana'] = 0x304E;
  16098. t['gikatakana'] = 0x30AE;
  16099. t['gimarmenian'] = 0x0563;
  16100. t['gimel'] = 0x05D2;
  16101. t['gimeldagesh'] = 0xFB32;
  16102. t['gimeldageshhebrew'] = 0xFB32;
  16103. t['gimelhebrew'] = 0x05D2;
  16104. t['gjecyrillic'] = 0x0453;
  16105. t['glottalinvertedstroke'] = 0x01BE;
  16106. t['glottalstop'] = 0x0294;
  16107. t['glottalstopinverted'] = 0x0296;
  16108. t['glottalstopmod'] = 0x02C0;
  16109. t['glottalstopreversed'] = 0x0295;
  16110. t['glottalstopreversedmod'] = 0x02C1;
  16111. t['glottalstopreversedsuperior'] = 0x02E4;
  16112. t['glottalstopstroke'] = 0x02A1;
  16113. t['glottalstopstrokereversed'] = 0x02A2;
  16114. t['gmacron'] = 0x1E21;
  16115. t['gmonospace'] = 0xFF47;
  16116. t['gohiragana'] = 0x3054;
  16117. t['gokatakana'] = 0x30B4;
  16118. t['gparen'] = 0x24A2;
  16119. t['gpasquare'] = 0x33AC;
  16120. t['gradient'] = 0x2207;
  16121. t['grave'] = 0x0060;
  16122. t['gravebelowcmb'] = 0x0316;
  16123. t['gravecmb'] = 0x0300;
  16124. t['gravecomb'] = 0x0300;
  16125. t['gravedeva'] = 0x0953;
  16126. t['gravelowmod'] = 0x02CE;
  16127. t['gravemonospace'] = 0xFF40;
  16128. t['gravetonecmb'] = 0x0340;
  16129. t['greater'] = 0x003E;
  16130. t['greaterequal'] = 0x2265;
  16131. t['greaterequalorless'] = 0x22DB;
  16132. t['greatermonospace'] = 0xFF1E;
  16133. t['greaterorequivalent'] = 0x2273;
  16134. t['greaterorless'] = 0x2277;
  16135. t['greateroverequal'] = 0x2267;
  16136. t['greatersmall'] = 0xFE65;
  16137. t['gscript'] = 0x0261;
  16138. t['gstroke'] = 0x01E5;
  16139. t['guhiragana'] = 0x3050;
  16140. t['guillemotleft'] = 0x00AB;
  16141. t['guillemotright'] = 0x00BB;
  16142. t['guilsinglleft'] = 0x2039;
  16143. t['guilsinglright'] = 0x203A;
  16144. t['gukatakana'] = 0x30B0;
  16145. t['guramusquare'] = 0x3318;
  16146. t['gysquare'] = 0x33C9;
  16147. t['h'] = 0x0068;
  16148. t['haabkhasiancyrillic'] = 0x04A9;
  16149. t['haaltonearabic'] = 0x06C1;
  16150. t['habengali'] = 0x09B9;
  16151. t['hadescendercyrillic'] = 0x04B3;
  16152. t['hadeva'] = 0x0939;
  16153. t['hagujarati'] = 0x0AB9;
  16154. t['hagurmukhi'] = 0x0A39;
  16155. t['haharabic'] = 0x062D;
  16156. t['hahfinalarabic'] = 0xFEA2;
  16157. t['hahinitialarabic'] = 0xFEA3;
  16158. t['hahiragana'] = 0x306F;
  16159. t['hahmedialarabic'] = 0xFEA4;
  16160. t['haitusquare'] = 0x332A;
  16161. t['hakatakana'] = 0x30CF;
  16162. t['hakatakanahalfwidth'] = 0xFF8A;
  16163. t['halantgurmukhi'] = 0x0A4D;
  16164. t['hamzaarabic'] = 0x0621;
  16165. t['hamzalowarabic'] = 0x0621;
  16166. t['hangulfiller'] = 0x3164;
  16167. t['hardsigncyrillic'] = 0x044A;
  16168. t['harpoonleftbarbup'] = 0x21BC;
  16169. t['harpoonrightbarbup'] = 0x21C0;
  16170. t['hasquare'] = 0x33CA;
  16171. t['hatafpatah'] = 0x05B2;
  16172. t['hatafpatah16'] = 0x05B2;
  16173. t['hatafpatah23'] = 0x05B2;
  16174. t['hatafpatah2f'] = 0x05B2;
  16175. t['hatafpatahhebrew'] = 0x05B2;
  16176. t['hatafpatahnarrowhebrew'] = 0x05B2;
  16177. t['hatafpatahquarterhebrew'] = 0x05B2;
  16178. t['hatafpatahwidehebrew'] = 0x05B2;
  16179. t['hatafqamats'] = 0x05B3;
  16180. t['hatafqamats1b'] = 0x05B3;
  16181. t['hatafqamats28'] = 0x05B3;
  16182. t['hatafqamats34'] = 0x05B3;
  16183. t['hatafqamatshebrew'] = 0x05B3;
  16184. t['hatafqamatsnarrowhebrew'] = 0x05B3;
  16185. t['hatafqamatsquarterhebrew'] = 0x05B3;
  16186. t['hatafqamatswidehebrew'] = 0x05B3;
  16187. t['hatafsegol'] = 0x05B1;
  16188. t['hatafsegol17'] = 0x05B1;
  16189. t['hatafsegol24'] = 0x05B1;
  16190. t['hatafsegol30'] = 0x05B1;
  16191. t['hatafsegolhebrew'] = 0x05B1;
  16192. t['hatafsegolnarrowhebrew'] = 0x05B1;
  16193. t['hatafsegolquarterhebrew'] = 0x05B1;
  16194. t['hatafsegolwidehebrew'] = 0x05B1;
  16195. t['hbar'] = 0x0127;
  16196. t['hbopomofo'] = 0x310F;
  16197. t['hbrevebelow'] = 0x1E2B;
  16198. t['hcedilla'] = 0x1E29;
  16199. t['hcircle'] = 0x24D7;
  16200. t['hcircumflex'] = 0x0125;
  16201. t['hdieresis'] = 0x1E27;
  16202. t['hdotaccent'] = 0x1E23;
  16203. t['hdotbelow'] = 0x1E25;
  16204. t['he'] = 0x05D4;
  16205. t['heart'] = 0x2665;
  16206. t['heartsuitblack'] = 0x2665;
  16207. t['heartsuitwhite'] = 0x2661;
  16208. t['hedagesh'] = 0xFB34;
  16209. t['hedageshhebrew'] = 0xFB34;
  16210. t['hehaltonearabic'] = 0x06C1;
  16211. t['heharabic'] = 0x0647;
  16212. t['hehebrew'] = 0x05D4;
  16213. t['hehfinalaltonearabic'] = 0xFBA7;
  16214. t['hehfinalalttwoarabic'] = 0xFEEA;
  16215. t['hehfinalarabic'] = 0xFEEA;
  16216. t['hehhamzaabovefinalarabic'] = 0xFBA5;
  16217. t['hehhamzaaboveisolatedarabic'] = 0xFBA4;
  16218. t['hehinitialaltonearabic'] = 0xFBA8;
  16219. t['hehinitialarabic'] = 0xFEEB;
  16220. t['hehiragana'] = 0x3078;
  16221. t['hehmedialaltonearabic'] = 0xFBA9;
  16222. t['hehmedialarabic'] = 0xFEEC;
  16223. t['heiseierasquare'] = 0x337B;
  16224. t['hekatakana'] = 0x30D8;
  16225. t['hekatakanahalfwidth'] = 0xFF8D;
  16226. t['hekutaarusquare'] = 0x3336;
  16227. t['henghook'] = 0x0267;
  16228. t['herutusquare'] = 0x3339;
  16229. t['het'] = 0x05D7;
  16230. t['hethebrew'] = 0x05D7;
  16231. t['hhook'] = 0x0266;
  16232. t['hhooksuperior'] = 0x02B1;
  16233. t['hieuhacirclekorean'] = 0x327B;
  16234. t['hieuhaparenkorean'] = 0x321B;
  16235. t['hieuhcirclekorean'] = 0x326D;
  16236. t['hieuhkorean'] = 0x314E;
  16237. t['hieuhparenkorean'] = 0x320D;
  16238. t['hihiragana'] = 0x3072;
  16239. t['hikatakana'] = 0x30D2;
  16240. t['hikatakanahalfwidth'] = 0xFF8B;
  16241. t['hiriq'] = 0x05B4;
  16242. t['hiriq14'] = 0x05B4;
  16243. t['hiriq21'] = 0x05B4;
  16244. t['hiriq2d'] = 0x05B4;
  16245. t['hiriqhebrew'] = 0x05B4;
  16246. t['hiriqnarrowhebrew'] = 0x05B4;
  16247. t['hiriqquarterhebrew'] = 0x05B4;
  16248. t['hiriqwidehebrew'] = 0x05B4;
  16249. t['hlinebelow'] = 0x1E96;
  16250. t['hmonospace'] = 0xFF48;
  16251. t['hoarmenian'] = 0x0570;
  16252. t['hohipthai'] = 0x0E2B;
  16253. t['hohiragana'] = 0x307B;
  16254. t['hokatakana'] = 0x30DB;
  16255. t['hokatakanahalfwidth'] = 0xFF8E;
  16256. t['holam'] = 0x05B9;
  16257. t['holam19'] = 0x05B9;
  16258. t['holam26'] = 0x05B9;
  16259. t['holam32'] = 0x05B9;
  16260. t['holamhebrew'] = 0x05B9;
  16261. t['holamnarrowhebrew'] = 0x05B9;
  16262. t['holamquarterhebrew'] = 0x05B9;
  16263. t['holamwidehebrew'] = 0x05B9;
  16264. t['honokhukthai'] = 0x0E2E;
  16265. t['hookabovecomb'] = 0x0309;
  16266. t['hookcmb'] = 0x0309;
  16267. t['hookpalatalizedbelowcmb'] = 0x0321;
  16268. t['hookretroflexbelowcmb'] = 0x0322;
  16269. t['hoonsquare'] = 0x3342;
  16270. t['horicoptic'] = 0x03E9;
  16271. t['horizontalbar'] = 0x2015;
  16272. t['horncmb'] = 0x031B;
  16273. t['hotsprings'] = 0x2668;
  16274. t['house'] = 0x2302;
  16275. t['hparen'] = 0x24A3;
  16276. t['hsuperior'] = 0x02B0;
  16277. t['hturned'] = 0x0265;
  16278. t['huhiragana'] = 0x3075;
  16279. t['huiitosquare'] = 0x3333;
  16280. t['hukatakana'] = 0x30D5;
  16281. t['hukatakanahalfwidth'] = 0xFF8C;
  16282. t['hungarumlaut'] = 0x02DD;
  16283. t['hungarumlautcmb'] = 0x030B;
  16284. t['hv'] = 0x0195;
  16285. t['hyphen'] = 0x002D;
  16286. t['hypheninferior'] = 0xF6E5;
  16287. t['hyphenmonospace'] = 0xFF0D;
  16288. t['hyphensmall'] = 0xFE63;
  16289. t['hyphensuperior'] = 0xF6E6;
  16290. t['hyphentwo'] = 0x2010;
  16291. t['i'] = 0x0069;
  16292. t['iacute'] = 0x00ED;
  16293. t['iacyrillic'] = 0x044F;
  16294. t['ibengali'] = 0x0987;
  16295. t['ibopomofo'] = 0x3127;
  16296. t['ibreve'] = 0x012D;
  16297. t['icaron'] = 0x01D0;
  16298. t['icircle'] = 0x24D8;
  16299. t['icircumflex'] = 0x00EE;
  16300. t['icyrillic'] = 0x0456;
  16301. t['idblgrave'] = 0x0209;
  16302. t['ideographearthcircle'] = 0x328F;
  16303. t['ideographfirecircle'] = 0x328B;
  16304. t['ideographicallianceparen'] = 0x323F;
  16305. t['ideographiccallparen'] = 0x323A;
  16306. t['ideographiccentrecircle'] = 0x32A5;
  16307. t['ideographicclose'] = 0x3006;
  16308. t['ideographiccomma'] = 0x3001;
  16309. t['ideographiccommaleft'] = 0xFF64;
  16310. t['ideographiccongratulationparen'] = 0x3237;
  16311. t['ideographiccorrectcircle'] = 0x32A3;
  16312. t['ideographicearthparen'] = 0x322F;
  16313. t['ideographicenterpriseparen'] = 0x323D;
  16314. t['ideographicexcellentcircle'] = 0x329D;
  16315. t['ideographicfestivalparen'] = 0x3240;
  16316. t['ideographicfinancialcircle'] = 0x3296;
  16317. t['ideographicfinancialparen'] = 0x3236;
  16318. t['ideographicfireparen'] = 0x322B;
  16319. t['ideographichaveparen'] = 0x3232;
  16320. t['ideographichighcircle'] = 0x32A4;
  16321. t['ideographiciterationmark'] = 0x3005;
  16322. t['ideographiclaborcircle'] = 0x3298;
  16323. t['ideographiclaborparen'] = 0x3238;
  16324. t['ideographicleftcircle'] = 0x32A7;
  16325. t['ideographiclowcircle'] = 0x32A6;
  16326. t['ideographicmedicinecircle'] = 0x32A9;
  16327. t['ideographicmetalparen'] = 0x322E;
  16328. t['ideographicmoonparen'] = 0x322A;
  16329. t['ideographicnameparen'] = 0x3234;
  16330. t['ideographicperiod'] = 0x3002;
  16331. t['ideographicprintcircle'] = 0x329E;
  16332. t['ideographicreachparen'] = 0x3243;
  16333. t['ideographicrepresentparen'] = 0x3239;
  16334. t['ideographicresourceparen'] = 0x323E;
  16335. t['ideographicrightcircle'] = 0x32A8;
  16336. t['ideographicsecretcircle'] = 0x3299;
  16337. t['ideographicselfparen'] = 0x3242;
  16338. t['ideographicsocietyparen'] = 0x3233;
  16339. t['ideographicspace'] = 0x3000;
  16340. t['ideographicspecialparen'] = 0x3235;
  16341. t['ideographicstockparen'] = 0x3231;
  16342. t['ideographicstudyparen'] = 0x323B;
  16343. t['ideographicsunparen'] = 0x3230;
  16344. t['ideographicsuperviseparen'] = 0x323C;
  16345. t['ideographicwaterparen'] = 0x322C;
  16346. t['ideographicwoodparen'] = 0x322D;
  16347. t['ideographiczero'] = 0x3007;
  16348. t['ideographmetalcircle'] = 0x328E;
  16349. t['ideographmooncircle'] = 0x328A;
  16350. t['ideographnamecircle'] = 0x3294;
  16351. t['ideographsuncircle'] = 0x3290;
  16352. t['ideographwatercircle'] = 0x328C;
  16353. t['ideographwoodcircle'] = 0x328D;
  16354. t['ideva'] = 0x0907;
  16355. t['idieresis'] = 0x00EF;
  16356. t['idieresisacute'] = 0x1E2F;
  16357. t['idieresiscyrillic'] = 0x04E5;
  16358. t['idotbelow'] = 0x1ECB;
  16359. t['iebrevecyrillic'] = 0x04D7;
  16360. t['iecyrillic'] = 0x0435;
  16361. t['ieungacirclekorean'] = 0x3275;
  16362. t['ieungaparenkorean'] = 0x3215;
  16363. t['ieungcirclekorean'] = 0x3267;
  16364. t['ieungkorean'] = 0x3147;
  16365. t['ieungparenkorean'] = 0x3207;
  16366. t['igrave'] = 0x00EC;
  16367. t['igujarati'] = 0x0A87;
  16368. t['igurmukhi'] = 0x0A07;
  16369. t['ihiragana'] = 0x3044;
  16370. t['ihookabove'] = 0x1EC9;
  16371. t['iibengali'] = 0x0988;
  16372. t['iicyrillic'] = 0x0438;
  16373. t['iideva'] = 0x0908;
  16374. t['iigujarati'] = 0x0A88;
  16375. t['iigurmukhi'] = 0x0A08;
  16376. t['iimatragurmukhi'] = 0x0A40;
  16377. t['iinvertedbreve'] = 0x020B;
  16378. t['iishortcyrillic'] = 0x0439;
  16379. t['iivowelsignbengali'] = 0x09C0;
  16380. t['iivowelsigndeva'] = 0x0940;
  16381. t['iivowelsigngujarati'] = 0x0AC0;
  16382. t['ij'] = 0x0133;
  16383. t['ikatakana'] = 0x30A4;
  16384. t['ikatakanahalfwidth'] = 0xFF72;
  16385. t['ikorean'] = 0x3163;
  16386. t['ilde'] = 0x02DC;
  16387. t['iluyhebrew'] = 0x05AC;
  16388. t['imacron'] = 0x012B;
  16389. t['imacroncyrillic'] = 0x04E3;
  16390. t['imageorapproximatelyequal'] = 0x2253;
  16391. t['imatragurmukhi'] = 0x0A3F;
  16392. t['imonospace'] = 0xFF49;
  16393. t['increment'] = 0x2206;
  16394. t['infinity'] = 0x221E;
  16395. t['iniarmenian'] = 0x056B;
  16396. t['integral'] = 0x222B;
  16397. t['integralbottom'] = 0x2321;
  16398. t['integralbt'] = 0x2321;
  16399. t['integralex'] = 0xF8F5;
  16400. t['integraltop'] = 0x2320;
  16401. t['integraltp'] = 0x2320;
  16402. t['intersection'] = 0x2229;
  16403. t['intisquare'] = 0x3305;
  16404. t['invbullet'] = 0x25D8;
  16405. t['invcircle'] = 0x25D9;
  16406. t['invsmileface'] = 0x263B;
  16407. t['iocyrillic'] = 0x0451;
  16408. t['iogonek'] = 0x012F;
  16409. t['iota'] = 0x03B9;
  16410. t['iotadieresis'] = 0x03CA;
  16411. t['iotadieresistonos'] = 0x0390;
  16412. t['iotalatin'] = 0x0269;
  16413. t['iotatonos'] = 0x03AF;
  16414. t['iparen'] = 0x24A4;
  16415. t['irigurmukhi'] = 0x0A72;
  16416. t['ismallhiragana'] = 0x3043;
  16417. t['ismallkatakana'] = 0x30A3;
  16418. t['ismallkatakanahalfwidth'] = 0xFF68;
  16419. t['issharbengali'] = 0x09FA;
  16420. t['istroke'] = 0x0268;
  16421. t['isuperior'] = 0xF6ED;
  16422. t['iterationhiragana'] = 0x309D;
  16423. t['iterationkatakana'] = 0x30FD;
  16424. t['itilde'] = 0x0129;
  16425. t['itildebelow'] = 0x1E2D;
  16426. t['iubopomofo'] = 0x3129;
  16427. t['iucyrillic'] = 0x044E;
  16428. t['ivowelsignbengali'] = 0x09BF;
  16429. t['ivowelsigndeva'] = 0x093F;
  16430. t['ivowelsigngujarati'] = 0x0ABF;
  16431. t['izhitsacyrillic'] = 0x0475;
  16432. t['izhitsadblgravecyrillic'] = 0x0477;
  16433. t['j'] = 0x006A;
  16434. t['jaarmenian'] = 0x0571;
  16435. t['jabengali'] = 0x099C;
  16436. t['jadeva'] = 0x091C;
  16437. t['jagujarati'] = 0x0A9C;
  16438. t['jagurmukhi'] = 0x0A1C;
  16439. t['jbopomofo'] = 0x3110;
  16440. t['jcaron'] = 0x01F0;
  16441. t['jcircle'] = 0x24D9;
  16442. t['jcircumflex'] = 0x0135;
  16443. t['jcrossedtail'] = 0x029D;
  16444. t['jdotlessstroke'] = 0x025F;
  16445. t['jecyrillic'] = 0x0458;
  16446. t['jeemarabic'] = 0x062C;
  16447. t['jeemfinalarabic'] = 0xFE9E;
  16448. t['jeeminitialarabic'] = 0xFE9F;
  16449. t['jeemmedialarabic'] = 0xFEA0;
  16450. t['jeharabic'] = 0x0698;
  16451. t['jehfinalarabic'] = 0xFB8B;
  16452. t['jhabengali'] = 0x099D;
  16453. t['jhadeva'] = 0x091D;
  16454. t['jhagujarati'] = 0x0A9D;
  16455. t['jhagurmukhi'] = 0x0A1D;
  16456. t['jheharmenian'] = 0x057B;
  16457. t['jis'] = 0x3004;
  16458. t['jmonospace'] = 0xFF4A;
  16459. t['jparen'] = 0x24A5;
  16460. t['jsuperior'] = 0x02B2;
  16461. t['k'] = 0x006B;
  16462. t['kabashkircyrillic'] = 0x04A1;
  16463. t['kabengali'] = 0x0995;
  16464. t['kacute'] = 0x1E31;
  16465. t['kacyrillic'] = 0x043A;
  16466. t['kadescendercyrillic'] = 0x049B;
  16467. t['kadeva'] = 0x0915;
  16468. t['kaf'] = 0x05DB;
  16469. t['kafarabic'] = 0x0643;
  16470. t['kafdagesh'] = 0xFB3B;
  16471. t['kafdageshhebrew'] = 0xFB3B;
  16472. t['kaffinalarabic'] = 0xFEDA;
  16473. t['kafhebrew'] = 0x05DB;
  16474. t['kafinitialarabic'] = 0xFEDB;
  16475. t['kafmedialarabic'] = 0xFEDC;
  16476. t['kafrafehebrew'] = 0xFB4D;
  16477. t['kagujarati'] = 0x0A95;
  16478. t['kagurmukhi'] = 0x0A15;
  16479. t['kahiragana'] = 0x304B;
  16480. t['kahookcyrillic'] = 0x04C4;
  16481. t['kakatakana'] = 0x30AB;
  16482. t['kakatakanahalfwidth'] = 0xFF76;
  16483. t['kappa'] = 0x03BA;
  16484. t['kappasymbolgreek'] = 0x03F0;
  16485. t['kapyeounmieumkorean'] = 0x3171;
  16486. t['kapyeounphieuphkorean'] = 0x3184;
  16487. t['kapyeounpieupkorean'] = 0x3178;
  16488. t['kapyeounssangpieupkorean'] = 0x3179;
  16489. t['karoriisquare'] = 0x330D;
  16490. t['kashidaautoarabic'] = 0x0640;
  16491. t['kashidaautonosidebearingarabic'] = 0x0640;
  16492. t['kasmallkatakana'] = 0x30F5;
  16493. t['kasquare'] = 0x3384;
  16494. t['kasraarabic'] = 0x0650;
  16495. t['kasratanarabic'] = 0x064D;
  16496. t['kastrokecyrillic'] = 0x049F;
  16497. t['katahiraprolongmarkhalfwidth'] = 0xFF70;
  16498. t['kaverticalstrokecyrillic'] = 0x049D;
  16499. t['kbopomofo'] = 0x310E;
  16500. t['kcalsquare'] = 0x3389;
  16501. t['kcaron'] = 0x01E9;
  16502. t['kcedilla'] = 0x0137;
  16503. t['kcircle'] = 0x24DA;
  16504. t['kcommaaccent'] = 0x0137;
  16505. t['kdotbelow'] = 0x1E33;
  16506. t['keharmenian'] = 0x0584;
  16507. t['kehiragana'] = 0x3051;
  16508. t['kekatakana'] = 0x30B1;
  16509. t['kekatakanahalfwidth'] = 0xFF79;
  16510. t['kenarmenian'] = 0x056F;
  16511. t['kesmallkatakana'] = 0x30F6;
  16512. t['kgreenlandic'] = 0x0138;
  16513. t['khabengali'] = 0x0996;
  16514. t['khacyrillic'] = 0x0445;
  16515. t['khadeva'] = 0x0916;
  16516. t['khagujarati'] = 0x0A96;
  16517. t['khagurmukhi'] = 0x0A16;
  16518. t['khaharabic'] = 0x062E;
  16519. t['khahfinalarabic'] = 0xFEA6;
  16520. t['khahinitialarabic'] = 0xFEA7;
  16521. t['khahmedialarabic'] = 0xFEA8;
  16522. t['kheicoptic'] = 0x03E7;
  16523. t['khhadeva'] = 0x0959;
  16524. t['khhagurmukhi'] = 0x0A59;
  16525. t['khieukhacirclekorean'] = 0x3278;
  16526. t['khieukhaparenkorean'] = 0x3218;
  16527. t['khieukhcirclekorean'] = 0x326A;
  16528. t['khieukhkorean'] = 0x314B;
  16529. t['khieukhparenkorean'] = 0x320A;
  16530. t['khokhaithai'] = 0x0E02;
  16531. t['khokhonthai'] = 0x0E05;
  16532. t['khokhuatthai'] = 0x0E03;
  16533. t['khokhwaithai'] = 0x0E04;
  16534. t['khomutthai'] = 0x0E5B;
  16535. t['khook'] = 0x0199;
  16536. t['khorakhangthai'] = 0x0E06;
  16537. t['khzsquare'] = 0x3391;
  16538. t['kihiragana'] = 0x304D;
  16539. t['kikatakana'] = 0x30AD;
  16540. t['kikatakanahalfwidth'] = 0xFF77;
  16541. t['kiroguramusquare'] = 0x3315;
  16542. t['kiromeetorusquare'] = 0x3316;
  16543. t['kirosquare'] = 0x3314;
  16544. t['kiyeokacirclekorean'] = 0x326E;
  16545. t['kiyeokaparenkorean'] = 0x320E;
  16546. t['kiyeokcirclekorean'] = 0x3260;
  16547. t['kiyeokkorean'] = 0x3131;
  16548. t['kiyeokparenkorean'] = 0x3200;
  16549. t['kiyeoksioskorean'] = 0x3133;
  16550. t['kjecyrillic'] = 0x045C;
  16551. t['klinebelow'] = 0x1E35;
  16552. t['klsquare'] = 0x3398;
  16553. t['kmcubedsquare'] = 0x33A6;
  16554. t['kmonospace'] = 0xFF4B;
  16555. t['kmsquaredsquare'] = 0x33A2;
  16556. t['kohiragana'] = 0x3053;
  16557. t['kohmsquare'] = 0x33C0;
  16558. t['kokaithai'] = 0x0E01;
  16559. t['kokatakana'] = 0x30B3;
  16560. t['kokatakanahalfwidth'] = 0xFF7A;
  16561. t['kooposquare'] = 0x331E;
  16562. t['koppacyrillic'] = 0x0481;
  16563. t['koreanstandardsymbol'] = 0x327F;
  16564. t['koroniscmb'] = 0x0343;
  16565. t['kparen'] = 0x24A6;
  16566. t['kpasquare'] = 0x33AA;
  16567. t['ksicyrillic'] = 0x046F;
  16568. t['ktsquare'] = 0x33CF;
  16569. t['kturned'] = 0x029E;
  16570. t['kuhiragana'] = 0x304F;
  16571. t['kukatakana'] = 0x30AF;
  16572. t['kukatakanahalfwidth'] = 0xFF78;
  16573. t['kvsquare'] = 0x33B8;
  16574. t['kwsquare'] = 0x33BE;
  16575. t['l'] = 0x006C;
  16576. t['labengali'] = 0x09B2;
  16577. t['lacute'] = 0x013A;
  16578. t['ladeva'] = 0x0932;
  16579. t['lagujarati'] = 0x0AB2;
  16580. t['lagurmukhi'] = 0x0A32;
  16581. t['lakkhangyaothai'] = 0x0E45;
  16582. t['lamaleffinalarabic'] = 0xFEFC;
  16583. t['lamalefhamzaabovefinalarabic'] = 0xFEF8;
  16584. t['lamalefhamzaaboveisolatedarabic'] = 0xFEF7;
  16585. t['lamalefhamzabelowfinalarabic'] = 0xFEFA;
  16586. t['lamalefhamzabelowisolatedarabic'] = 0xFEF9;
  16587. t['lamalefisolatedarabic'] = 0xFEFB;
  16588. t['lamalefmaddaabovefinalarabic'] = 0xFEF6;
  16589. t['lamalefmaddaaboveisolatedarabic'] = 0xFEF5;
  16590. t['lamarabic'] = 0x0644;
  16591. t['lambda'] = 0x03BB;
  16592. t['lambdastroke'] = 0x019B;
  16593. t['lamed'] = 0x05DC;
  16594. t['lameddagesh'] = 0xFB3C;
  16595. t['lameddageshhebrew'] = 0xFB3C;
  16596. t['lamedhebrew'] = 0x05DC;
  16597. t['lamfinalarabic'] = 0xFEDE;
  16598. t['lamhahinitialarabic'] = 0xFCCA;
  16599. t['laminitialarabic'] = 0xFEDF;
  16600. t['lamjeeminitialarabic'] = 0xFCC9;
  16601. t['lamkhahinitialarabic'] = 0xFCCB;
  16602. t['lamlamhehisolatedarabic'] = 0xFDF2;
  16603. t['lammedialarabic'] = 0xFEE0;
  16604. t['lammeemhahinitialarabic'] = 0xFD88;
  16605. t['lammeeminitialarabic'] = 0xFCCC;
  16606. t['largecircle'] = 0x25EF;
  16607. t['lbar'] = 0x019A;
  16608. t['lbelt'] = 0x026C;
  16609. t['lbopomofo'] = 0x310C;
  16610. t['lcaron'] = 0x013E;
  16611. t['lcedilla'] = 0x013C;
  16612. t['lcircle'] = 0x24DB;
  16613. t['lcircumflexbelow'] = 0x1E3D;
  16614. t['lcommaaccent'] = 0x013C;
  16615. t['ldot'] = 0x0140;
  16616. t['ldotaccent'] = 0x0140;
  16617. t['ldotbelow'] = 0x1E37;
  16618. t['ldotbelowmacron'] = 0x1E39;
  16619. t['leftangleabovecmb'] = 0x031A;
  16620. t['lefttackbelowcmb'] = 0x0318;
  16621. t['less'] = 0x003C;
  16622. t['lessequal'] = 0x2264;
  16623. t['lessequalorgreater'] = 0x22DA;
  16624. t['lessmonospace'] = 0xFF1C;
  16625. t['lessorequivalent'] = 0x2272;
  16626. t['lessorgreater'] = 0x2276;
  16627. t['lessoverequal'] = 0x2266;
  16628. t['lesssmall'] = 0xFE64;
  16629. t['lezh'] = 0x026E;
  16630. t['lfblock'] = 0x258C;
  16631. t['lhookretroflex'] = 0x026D;
  16632. t['lira'] = 0x20A4;
  16633. t['liwnarmenian'] = 0x056C;
  16634. t['lj'] = 0x01C9;
  16635. t['ljecyrillic'] = 0x0459;
  16636. t['ll'] = 0xF6C0;
  16637. t['lladeva'] = 0x0933;
  16638. t['llagujarati'] = 0x0AB3;
  16639. t['llinebelow'] = 0x1E3B;
  16640. t['llladeva'] = 0x0934;
  16641. t['llvocalicbengali'] = 0x09E1;
  16642. t['llvocalicdeva'] = 0x0961;
  16643. t['llvocalicvowelsignbengali'] = 0x09E3;
  16644. t['llvocalicvowelsigndeva'] = 0x0963;
  16645. t['lmiddletilde'] = 0x026B;
  16646. t['lmonospace'] = 0xFF4C;
  16647. t['lmsquare'] = 0x33D0;
  16648. t['lochulathai'] = 0x0E2C;
  16649. t['logicaland'] = 0x2227;
  16650. t['logicalnot'] = 0x00AC;
  16651. t['logicalnotreversed'] = 0x2310;
  16652. t['logicalor'] = 0x2228;
  16653. t['lolingthai'] = 0x0E25;
  16654. t['longs'] = 0x017F;
  16655. t['lowlinecenterline'] = 0xFE4E;
  16656. t['lowlinecmb'] = 0x0332;
  16657. t['lowlinedashed'] = 0xFE4D;
  16658. t['lozenge'] = 0x25CA;
  16659. t['lparen'] = 0x24A7;
  16660. t['lslash'] = 0x0142;
  16661. t['lsquare'] = 0x2113;
  16662. t['lsuperior'] = 0xF6EE;
  16663. t['ltshade'] = 0x2591;
  16664. t['luthai'] = 0x0E26;
  16665. t['lvocalicbengali'] = 0x098C;
  16666. t['lvocalicdeva'] = 0x090C;
  16667. t['lvocalicvowelsignbengali'] = 0x09E2;
  16668. t['lvocalicvowelsigndeva'] = 0x0962;
  16669. t['lxsquare'] = 0x33D3;
  16670. t['m'] = 0x006D;
  16671. t['mabengali'] = 0x09AE;
  16672. t['macron'] = 0x00AF;
  16673. t['macronbelowcmb'] = 0x0331;
  16674. t['macroncmb'] = 0x0304;
  16675. t['macronlowmod'] = 0x02CD;
  16676. t['macronmonospace'] = 0xFFE3;
  16677. t['macute'] = 0x1E3F;
  16678. t['madeva'] = 0x092E;
  16679. t['magujarati'] = 0x0AAE;
  16680. t['magurmukhi'] = 0x0A2E;
  16681. t['mahapakhhebrew'] = 0x05A4;
  16682. t['mahapakhlefthebrew'] = 0x05A4;
  16683. t['mahiragana'] = 0x307E;
  16684. t['maichattawalowleftthai'] = 0xF895;
  16685. t['maichattawalowrightthai'] = 0xF894;
  16686. t['maichattawathai'] = 0x0E4B;
  16687. t['maichattawaupperleftthai'] = 0xF893;
  16688. t['maieklowleftthai'] = 0xF88C;
  16689. t['maieklowrightthai'] = 0xF88B;
  16690. t['maiekthai'] = 0x0E48;
  16691. t['maiekupperleftthai'] = 0xF88A;
  16692. t['maihanakatleftthai'] = 0xF884;
  16693. t['maihanakatthai'] = 0x0E31;
  16694. t['maitaikhuleftthai'] = 0xF889;
  16695. t['maitaikhuthai'] = 0x0E47;
  16696. t['maitholowleftthai'] = 0xF88F;
  16697. t['maitholowrightthai'] = 0xF88E;
  16698. t['maithothai'] = 0x0E49;
  16699. t['maithoupperleftthai'] = 0xF88D;
  16700. t['maitrilowleftthai'] = 0xF892;
  16701. t['maitrilowrightthai'] = 0xF891;
  16702. t['maitrithai'] = 0x0E4A;
  16703. t['maitriupperleftthai'] = 0xF890;
  16704. t['maiyamokthai'] = 0x0E46;
  16705. t['makatakana'] = 0x30DE;
  16706. t['makatakanahalfwidth'] = 0xFF8F;
  16707. t['male'] = 0x2642;
  16708. t['mansyonsquare'] = 0x3347;
  16709. t['maqafhebrew'] = 0x05BE;
  16710. t['mars'] = 0x2642;
  16711. t['masoracirclehebrew'] = 0x05AF;
  16712. t['masquare'] = 0x3383;
  16713. t['mbopomofo'] = 0x3107;
  16714. t['mbsquare'] = 0x33D4;
  16715. t['mcircle'] = 0x24DC;
  16716. t['mcubedsquare'] = 0x33A5;
  16717. t['mdotaccent'] = 0x1E41;
  16718. t['mdotbelow'] = 0x1E43;
  16719. t['meemarabic'] = 0x0645;
  16720. t['meemfinalarabic'] = 0xFEE2;
  16721. t['meeminitialarabic'] = 0xFEE3;
  16722. t['meemmedialarabic'] = 0xFEE4;
  16723. t['meemmeeminitialarabic'] = 0xFCD1;
  16724. t['meemmeemisolatedarabic'] = 0xFC48;
  16725. t['meetorusquare'] = 0x334D;
  16726. t['mehiragana'] = 0x3081;
  16727. t['meizierasquare'] = 0x337E;
  16728. t['mekatakana'] = 0x30E1;
  16729. t['mekatakanahalfwidth'] = 0xFF92;
  16730. t['mem'] = 0x05DE;
  16731. t['memdagesh'] = 0xFB3E;
  16732. t['memdageshhebrew'] = 0xFB3E;
  16733. t['memhebrew'] = 0x05DE;
  16734. t['menarmenian'] = 0x0574;
  16735. t['merkhahebrew'] = 0x05A5;
  16736. t['merkhakefulahebrew'] = 0x05A6;
  16737. t['merkhakefulalefthebrew'] = 0x05A6;
  16738. t['merkhalefthebrew'] = 0x05A5;
  16739. t['mhook'] = 0x0271;
  16740. t['mhzsquare'] = 0x3392;
  16741. t['middledotkatakanahalfwidth'] = 0xFF65;
  16742. t['middot'] = 0x00B7;
  16743. t['mieumacirclekorean'] = 0x3272;
  16744. t['mieumaparenkorean'] = 0x3212;
  16745. t['mieumcirclekorean'] = 0x3264;
  16746. t['mieumkorean'] = 0x3141;
  16747. t['mieumpansioskorean'] = 0x3170;
  16748. t['mieumparenkorean'] = 0x3204;
  16749. t['mieumpieupkorean'] = 0x316E;
  16750. t['mieumsioskorean'] = 0x316F;
  16751. t['mihiragana'] = 0x307F;
  16752. t['mikatakana'] = 0x30DF;
  16753. t['mikatakanahalfwidth'] = 0xFF90;
  16754. t['minus'] = 0x2212;
  16755. t['minusbelowcmb'] = 0x0320;
  16756. t['minuscircle'] = 0x2296;
  16757. t['minusmod'] = 0x02D7;
  16758. t['minusplus'] = 0x2213;
  16759. t['minute'] = 0x2032;
  16760. t['miribaarusquare'] = 0x334A;
  16761. t['mirisquare'] = 0x3349;
  16762. t['mlonglegturned'] = 0x0270;
  16763. t['mlsquare'] = 0x3396;
  16764. t['mmcubedsquare'] = 0x33A3;
  16765. t['mmonospace'] = 0xFF4D;
  16766. t['mmsquaredsquare'] = 0x339F;
  16767. t['mohiragana'] = 0x3082;
  16768. t['mohmsquare'] = 0x33C1;
  16769. t['mokatakana'] = 0x30E2;
  16770. t['mokatakanahalfwidth'] = 0xFF93;
  16771. t['molsquare'] = 0x33D6;
  16772. t['momathai'] = 0x0E21;
  16773. t['moverssquare'] = 0x33A7;
  16774. t['moverssquaredsquare'] = 0x33A8;
  16775. t['mparen'] = 0x24A8;
  16776. t['mpasquare'] = 0x33AB;
  16777. t['mssquare'] = 0x33B3;
  16778. t['msuperior'] = 0xF6EF;
  16779. t['mturned'] = 0x026F;
  16780. t['mu'] = 0x00B5;
  16781. t['mu1'] = 0x00B5;
  16782. t['muasquare'] = 0x3382;
  16783. t['muchgreater'] = 0x226B;
  16784. t['muchless'] = 0x226A;
  16785. t['mufsquare'] = 0x338C;
  16786. t['mugreek'] = 0x03BC;
  16787. t['mugsquare'] = 0x338D;
  16788. t['muhiragana'] = 0x3080;
  16789. t['mukatakana'] = 0x30E0;
  16790. t['mukatakanahalfwidth'] = 0xFF91;
  16791. t['mulsquare'] = 0x3395;
  16792. t['multiply'] = 0x00D7;
  16793. t['mumsquare'] = 0x339B;
  16794. t['munahhebrew'] = 0x05A3;
  16795. t['munahlefthebrew'] = 0x05A3;
  16796. t['musicalnote'] = 0x266A;
  16797. t['musicalnotedbl'] = 0x266B;
  16798. t['musicflatsign'] = 0x266D;
  16799. t['musicsharpsign'] = 0x266F;
  16800. t['mussquare'] = 0x33B2;
  16801. t['muvsquare'] = 0x33B6;
  16802. t['muwsquare'] = 0x33BC;
  16803. t['mvmegasquare'] = 0x33B9;
  16804. t['mvsquare'] = 0x33B7;
  16805. t['mwmegasquare'] = 0x33BF;
  16806. t['mwsquare'] = 0x33BD;
  16807. t['n'] = 0x006E;
  16808. t['nabengali'] = 0x09A8;
  16809. t['nabla'] = 0x2207;
  16810. t['nacute'] = 0x0144;
  16811. t['nadeva'] = 0x0928;
  16812. t['nagujarati'] = 0x0AA8;
  16813. t['nagurmukhi'] = 0x0A28;
  16814. t['nahiragana'] = 0x306A;
  16815. t['nakatakana'] = 0x30CA;
  16816. t['nakatakanahalfwidth'] = 0xFF85;
  16817. t['napostrophe'] = 0x0149;
  16818. t['nasquare'] = 0x3381;
  16819. t['nbopomofo'] = 0x310B;
  16820. t['nbspace'] = 0x00A0;
  16821. t['ncaron'] = 0x0148;
  16822. t['ncedilla'] = 0x0146;
  16823. t['ncircle'] = 0x24DD;
  16824. t['ncircumflexbelow'] = 0x1E4B;
  16825. t['ncommaaccent'] = 0x0146;
  16826. t['ndotaccent'] = 0x1E45;
  16827. t['ndotbelow'] = 0x1E47;
  16828. t['nehiragana'] = 0x306D;
  16829. t['nekatakana'] = 0x30CD;
  16830. t['nekatakanahalfwidth'] = 0xFF88;
  16831. t['newsheqelsign'] = 0x20AA;
  16832. t['nfsquare'] = 0x338B;
  16833. t['ngabengali'] = 0x0999;
  16834. t['ngadeva'] = 0x0919;
  16835. t['ngagujarati'] = 0x0A99;
  16836. t['ngagurmukhi'] = 0x0A19;
  16837. t['ngonguthai'] = 0x0E07;
  16838. t['nhiragana'] = 0x3093;
  16839. t['nhookleft'] = 0x0272;
  16840. t['nhookretroflex'] = 0x0273;
  16841. t['nieunacirclekorean'] = 0x326F;
  16842. t['nieunaparenkorean'] = 0x320F;
  16843. t['nieuncieuckorean'] = 0x3135;
  16844. t['nieuncirclekorean'] = 0x3261;
  16845. t['nieunhieuhkorean'] = 0x3136;
  16846. t['nieunkorean'] = 0x3134;
  16847. t['nieunpansioskorean'] = 0x3168;
  16848. t['nieunparenkorean'] = 0x3201;
  16849. t['nieunsioskorean'] = 0x3167;
  16850. t['nieuntikeutkorean'] = 0x3166;
  16851. t['nihiragana'] = 0x306B;
  16852. t['nikatakana'] = 0x30CB;
  16853. t['nikatakanahalfwidth'] = 0xFF86;
  16854. t['nikhahitleftthai'] = 0xF899;
  16855. t['nikhahitthai'] = 0x0E4D;
  16856. t['nine'] = 0x0039;
  16857. t['ninearabic'] = 0x0669;
  16858. t['ninebengali'] = 0x09EF;
  16859. t['ninecircle'] = 0x2468;
  16860. t['ninecircleinversesansserif'] = 0x2792;
  16861. t['ninedeva'] = 0x096F;
  16862. t['ninegujarati'] = 0x0AEF;
  16863. t['ninegurmukhi'] = 0x0A6F;
  16864. t['ninehackarabic'] = 0x0669;
  16865. t['ninehangzhou'] = 0x3029;
  16866. t['nineideographicparen'] = 0x3228;
  16867. t['nineinferior'] = 0x2089;
  16868. t['ninemonospace'] = 0xFF19;
  16869. t['nineoldstyle'] = 0xF739;
  16870. t['nineparen'] = 0x247C;
  16871. t['nineperiod'] = 0x2490;
  16872. t['ninepersian'] = 0x06F9;
  16873. t['nineroman'] = 0x2178;
  16874. t['ninesuperior'] = 0x2079;
  16875. t['nineteencircle'] = 0x2472;
  16876. t['nineteenparen'] = 0x2486;
  16877. t['nineteenperiod'] = 0x249A;
  16878. t['ninethai'] = 0x0E59;
  16879. t['nj'] = 0x01CC;
  16880. t['njecyrillic'] = 0x045A;
  16881. t['nkatakana'] = 0x30F3;
  16882. t['nkatakanahalfwidth'] = 0xFF9D;
  16883. t['nlegrightlong'] = 0x019E;
  16884. t['nlinebelow'] = 0x1E49;
  16885. t['nmonospace'] = 0xFF4E;
  16886. t['nmsquare'] = 0x339A;
  16887. t['nnabengali'] = 0x09A3;
  16888. t['nnadeva'] = 0x0923;
  16889. t['nnagujarati'] = 0x0AA3;
  16890. t['nnagurmukhi'] = 0x0A23;
  16891. t['nnnadeva'] = 0x0929;
  16892. t['nohiragana'] = 0x306E;
  16893. t['nokatakana'] = 0x30CE;
  16894. t['nokatakanahalfwidth'] = 0xFF89;
  16895. t['nonbreakingspace'] = 0x00A0;
  16896. t['nonenthai'] = 0x0E13;
  16897. t['nonuthai'] = 0x0E19;
  16898. t['noonarabic'] = 0x0646;
  16899. t['noonfinalarabic'] = 0xFEE6;
  16900. t['noonghunnaarabic'] = 0x06BA;
  16901. t['noonghunnafinalarabic'] = 0xFB9F;
  16902. t['nooninitialarabic'] = 0xFEE7;
  16903. t['noonjeeminitialarabic'] = 0xFCD2;
  16904. t['noonjeemisolatedarabic'] = 0xFC4B;
  16905. t['noonmedialarabic'] = 0xFEE8;
  16906. t['noonmeeminitialarabic'] = 0xFCD5;
  16907. t['noonmeemisolatedarabic'] = 0xFC4E;
  16908. t['noonnoonfinalarabic'] = 0xFC8D;
  16909. t['notcontains'] = 0x220C;
  16910. t['notelement'] = 0x2209;
  16911. t['notelementof'] = 0x2209;
  16912. t['notequal'] = 0x2260;
  16913. t['notgreater'] = 0x226F;
  16914. t['notgreaternorequal'] = 0x2271;
  16915. t['notgreaternorless'] = 0x2279;
  16916. t['notidentical'] = 0x2262;
  16917. t['notless'] = 0x226E;
  16918. t['notlessnorequal'] = 0x2270;
  16919. t['notparallel'] = 0x2226;
  16920. t['notprecedes'] = 0x2280;
  16921. t['notsubset'] = 0x2284;
  16922. t['notsucceeds'] = 0x2281;
  16923. t['notsuperset'] = 0x2285;
  16924. t['nowarmenian'] = 0x0576;
  16925. t['nparen'] = 0x24A9;
  16926. t['nssquare'] = 0x33B1;
  16927. t['nsuperior'] = 0x207F;
  16928. t['ntilde'] = 0x00F1;
  16929. t['nu'] = 0x03BD;
  16930. t['nuhiragana'] = 0x306C;
  16931. t['nukatakana'] = 0x30CC;
  16932. t['nukatakanahalfwidth'] = 0xFF87;
  16933. t['nuktabengali'] = 0x09BC;
  16934. t['nuktadeva'] = 0x093C;
  16935. t['nuktagujarati'] = 0x0ABC;
  16936. t['nuktagurmukhi'] = 0x0A3C;
  16937. t['numbersign'] = 0x0023;
  16938. t['numbersignmonospace'] = 0xFF03;
  16939. t['numbersignsmall'] = 0xFE5F;
  16940. t['numeralsigngreek'] = 0x0374;
  16941. t['numeralsignlowergreek'] = 0x0375;
  16942. t['numero'] = 0x2116;
  16943. t['nun'] = 0x05E0;
  16944. t['nundagesh'] = 0xFB40;
  16945. t['nundageshhebrew'] = 0xFB40;
  16946. t['nunhebrew'] = 0x05E0;
  16947. t['nvsquare'] = 0x33B5;
  16948. t['nwsquare'] = 0x33BB;
  16949. t['nyabengali'] = 0x099E;
  16950. t['nyadeva'] = 0x091E;
  16951. t['nyagujarati'] = 0x0A9E;
  16952. t['nyagurmukhi'] = 0x0A1E;
  16953. t['o'] = 0x006F;
  16954. t['oacute'] = 0x00F3;
  16955. t['oangthai'] = 0x0E2D;
  16956. t['obarred'] = 0x0275;
  16957. t['obarredcyrillic'] = 0x04E9;
  16958. t['obarreddieresiscyrillic'] = 0x04EB;
  16959. t['obengali'] = 0x0993;
  16960. t['obopomofo'] = 0x311B;
  16961. t['obreve'] = 0x014F;
  16962. t['ocandradeva'] = 0x0911;
  16963. t['ocandragujarati'] = 0x0A91;
  16964. t['ocandravowelsigndeva'] = 0x0949;
  16965. t['ocandravowelsigngujarati'] = 0x0AC9;
  16966. t['ocaron'] = 0x01D2;
  16967. t['ocircle'] = 0x24DE;
  16968. t['ocircumflex'] = 0x00F4;
  16969. t['ocircumflexacute'] = 0x1ED1;
  16970. t['ocircumflexdotbelow'] = 0x1ED9;
  16971. t['ocircumflexgrave'] = 0x1ED3;
  16972. t['ocircumflexhookabove'] = 0x1ED5;
  16973. t['ocircumflextilde'] = 0x1ED7;
  16974. t['ocyrillic'] = 0x043E;
  16975. t['odblacute'] = 0x0151;
  16976. t['odblgrave'] = 0x020D;
  16977. t['odeva'] = 0x0913;
  16978. t['odieresis'] = 0x00F6;
  16979. t['odieresiscyrillic'] = 0x04E7;
  16980. t['odotbelow'] = 0x1ECD;
  16981. t['oe'] = 0x0153;
  16982. t['oekorean'] = 0x315A;
  16983. t['ogonek'] = 0x02DB;
  16984. t['ogonekcmb'] = 0x0328;
  16985. t['ograve'] = 0x00F2;
  16986. t['ogujarati'] = 0x0A93;
  16987. t['oharmenian'] = 0x0585;
  16988. t['ohiragana'] = 0x304A;
  16989. t['ohookabove'] = 0x1ECF;
  16990. t['ohorn'] = 0x01A1;
  16991. t['ohornacute'] = 0x1EDB;
  16992. t['ohorndotbelow'] = 0x1EE3;
  16993. t['ohorngrave'] = 0x1EDD;
  16994. t['ohornhookabove'] = 0x1EDF;
  16995. t['ohorntilde'] = 0x1EE1;
  16996. t['ohungarumlaut'] = 0x0151;
  16997. t['oi'] = 0x01A3;
  16998. t['oinvertedbreve'] = 0x020F;
  16999. t['okatakana'] = 0x30AA;
  17000. t['okatakanahalfwidth'] = 0xFF75;
  17001. t['okorean'] = 0x3157;
  17002. t['olehebrew'] = 0x05AB;
  17003. t['omacron'] = 0x014D;
  17004. t['omacronacute'] = 0x1E53;
  17005. t['omacrongrave'] = 0x1E51;
  17006. t['omdeva'] = 0x0950;
  17007. t['omega'] = 0x03C9;
  17008. t['omega1'] = 0x03D6;
  17009. t['omegacyrillic'] = 0x0461;
  17010. t['omegalatinclosed'] = 0x0277;
  17011. t['omegaroundcyrillic'] = 0x047B;
  17012. t['omegatitlocyrillic'] = 0x047D;
  17013. t['omegatonos'] = 0x03CE;
  17014. t['omgujarati'] = 0x0AD0;
  17015. t['omicron'] = 0x03BF;
  17016. t['omicrontonos'] = 0x03CC;
  17017. t['omonospace'] = 0xFF4F;
  17018. t['one'] = 0x0031;
  17019. t['onearabic'] = 0x0661;
  17020. t['onebengali'] = 0x09E7;
  17021. t['onecircle'] = 0x2460;
  17022. t['onecircleinversesansserif'] = 0x278A;
  17023. t['onedeva'] = 0x0967;
  17024. t['onedotenleader'] = 0x2024;
  17025. t['oneeighth'] = 0x215B;
  17026. t['onefitted'] = 0xF6DC;
  17027. t['onegujarati'] = 0x0AE7;
  17028. t['onegurmukhi'] = 0x0A67;
  17029. t['onehackarabic'] = 0x0661;
  17030. t['onehalf'] = 0x00BD;
  17031. t['onehangzhou'] = 0x3021;
  17032. t['oneideographicparen'] = 0x3220;
  17033. t['oneinferior'] = 0x2081;
  17034. t['onemonospace'] = 0xFF11;
  17035. t['onenumeratorbengali'] = 0x09F4;
  17036. t['oneoldstyle'] = 0xF731;
  17037. t['oneparen'] = 0x2474;
  17038. t['oneperiod'] = 0x2488;
  17039. t['onepersian'] = 0x06F1;
  17040. t['onequarter'] = 0x00BC;
  17041. t['oneroman'] = 0x2170;
  17042. t['onesuperior'] = 0x00B9;
  17043. t['onethai'] = 0x0E51;
  17044. t['onethird'] = 0x2153;
  17045. t['oogonek'] = 0x01EB;
  17046. t['oogonekmacron'] = 0x01ED;
  17047. t['oogurmukhi'] = 0x0A13;
  17048. t['oomatragurmukhi'] = 0x0A4B;
  17049. t['oopen'] = 0x0254;
  17050. t['oparen'] = 0x24AA;
  17051. t['openbullet'] = 0x25E6;
  17052. t['option'] = 0x2325;
  17053. t['ordfeminine'] = 0x00AA;
  17054. t['ordmasculine'] = 0x00BA;
  17055. t['orthogonal'] = 0x221F;
  17056. t['oshortdeva'] = 0x0912;
  17057. t['oshortvowelsigndeva'] = 0x094A;
  17058. t['oslash'] = 0x00F8;
  17059. t['oslashacute'] = 0x01FF;
  17060. t['osmallhiragana'] = 0x3049;
  17061. t['osmallkatakana'] = 0x30A9;
  17062. t['osmallkatakanahalfwidth'] = 0xFF6B;
  17063. t['ostrokeacute'] = 0x01FF;
  17064. t['osuperior'] = 0xF6F0;
  17065. t['otcyrillic'] = 0x047F;
  17066. t['otilde'] = 0x00F5;
  17067. t['otildeacute'] = 0x1E4D;
  17068. t['otildedieresis'] = 0x1E4F;
  17069. t['oubopomofo'] = 0x3121;
  17070. t['overline'] = 0x203E;
  17071. t['overlinecenterline'] = 0xFE4A;
  17072. t['overlinecmb'] = 0x0305;
  17073. t['overlinedashed'] = 0xFE49;
  17074. t['overlinedblwavy'] = 0xFE4C;
  17075. t['overlinewavy'] = 0xFE4B;
  17076. t['overscore'] = 0x00AF;
  17077. t['ovowelsignbengali'] = 0x09CB;
  17078. t['ovowelsigndeva'] = 0x094B;
  17079. t['ovowelsigngujarati'] = 0x0ACB;
  17080. t['p'] = 0x0070;
  17081. t['paampssquare'] = 0x3380;
  17082. t['paasentosquare'] = 0x332B;
  17083. t['pabengali'] = 0x09AA;
  17084. t['pacute'] = 0x1E55;
  17085. t['padeva'] = 0x092A;
  17086. t['pagedown'] = 0x21DF;
  17087. t['pageup'] = 0x21DE;
  17088. t['pagujarati'] = 0x0AAA;
  17089. t['pagurmukhi'] = 0x0A2A;
  17090. t['pahiragana'] = 0x3071;
  17091. t['paiyannoithai'] = 0x0E2F;
  17092. t['pakatakana'] = 0x30D1;
  17093. t['palatalizationcyrilliccmb'] = 0x0484;
  17094. t['palochkacyrillic'] = 0x04C0;
  17095. t['pansioskorean'] = 0x317F;
  17096. t['paragraph'] = 0x00B6;
  17097. t['parallel'] = 0x2225;
  17098. t['parenleft'] = 0x0028;
  17099. t['parenleftaltonearabic'] = 0xFD3E;
  17100. t['parenleftbt'] = 0xF8ED;
  17101. t['parenleftex'] = 0xF8EC;
  17102. t['parenleftinferior'] = 0x208D;
  17103. t['parenleftmonospace'] = 0xFF08;
  17104. t['parenleftsmall'] = 0xFE59;
  17105. t['parenleftsuperior'] = 0x207D;
  17106. t['parenlefttp'] = 0xF8EB;
  17107. t['parenleftvertical'] = 0xFE35;
  17108. t['parenright'] = 0x0029;
  17109. t['parenrightaltonearabic'] = 0xFD3F;
  17110. t['parenrightbt'] = 0xF8F8;
  17111. t['parenrightex'] = 0xF8F7;
  17112. t['parenrightinferior'] = 0x208E;
  17113. t['parenrightmonospace'] = 0xFF09;
  17114. t['parenrightsmall'] = 0xFE5A;
  17115. t['parenrightsuperior'] = 0x207E;
  17116. t['parenrighttp'] = 0xF8F6;
  17117. t['parenrightvertical'] = 0xFE36;
  17118. t['partialdiff'] = 0x2202;
  17119. t['paseqhebrew'] = 0x05C0;
  17120. t['pashtahebrew'] = 0x0599;
  17121. t['pasquare'] = 0x33A9;
  17122. t['patah'] = 0x05B7;
  17123. t['patah11'] = 0x05B7;
  17124. t['patah1d'] = 0x05B7;
  17125. t['patah2a'] = 0x05B7;
  17126. t['patahhebrew'] = 0x05B7;
  17127. t['patahnarrowhebrew'] = 0x05B7;
  17128. t['patahquarterhebrew'] = 0x05B7;
  17129. t['patahwidehebrew'] = 0x05B7;
  17130. t['pazerhebrew'] = 0x05A1;
  17131. t['pbopomofo'] = 0x3106;
  17132. t['pcircle'] = 0x24DF;
  17133. t['pdotaccent'] = 0x1E57;
  17134. t['pe'] = 0x05E4;
  17135. t['pecyrillic'] = 0x043F;
  17136. t['pedagesh'] = 0xFB44;
  17137. t['pedageshhebrew'] = 0xFB44;
  17138. t['peezisquare'] = 0x333B;
  17139. t['pefinaldageshhebrew'] = 0xFB43;
  17140. t['peharabic'] = 0x067E;
  17141. t['peharmenian'] = 0x057A;
  17142. t['pehebrew'] = 0x05E4;
  17143. t['pehfinalarabic'] = 0xFB57;
  17144. t['pehinitialarabic'] = 0xFB58;
  17145. t['pehiragana'] = 0x307A;
  17146. t['pehmedialarabic'] = 0xFB59;
  17147. t['pekatakana'] = 0x30DA;
  17148. t['pemiddlehookcyrillic'] = 0x04A7;
  17149. t['perafehebrew'] = 0xFB4E;
  17150. t['percent'] = 0x0025;
  17151. t['percentarabic'] = 0x066A;
  17152. t['percentmonospace'] = 0xFF05;
  17153. t['percentsmall'] = 0xFE6A;
  17154. t['period'] = 0x002E;
  17155. t['periodarmenian'] = 0x0589;
  17156. t['periodcentered'] = 0x00B7;
  17157. t['periodhalfwidth'] = 0xFF61;
  17158. t['periodinferior'] = 0xF6E7;
  17159. t['periodmonospace'] = 0xFF0E;
  17160. t['periodsmall'] = 0xFE52;
  17161. t['periodsuperior'] = 0xF6E8;
  17162. t['perispomenigreekcmb'] = 0x0342;
  17163. t['perpendicular'] = 0x22A5;
  17164. t['perthousand'] = 0x2030;
  17165. t['peseta'] = 0x20A7;
  17166. t['pfsquare'] = 0x338A;
  17167. t['phabengali'] = 0x09AB;
  17168. t['phadeva'] = 0x092B;
  17169. t['phagujarati'] = 0x0AAB;
  17170. t['phagurmukhi'] = 0x0A2B;
  17171. t['phi'] = 0x03C6;
  17172. t['phi1'] = 0x03D5;
  17173. t['phieuphacirclekorean'] = 0x327A;
  17174. t['phieuphaparenkorean'] = 0x321A;
  17175. t['phieuphcirclekorean'] = 0x326C;
  17176. t['phieuphkorean'] = 0x314D;
  17177. t['phieuphparenkorean'] = 0x320C;
  17178. t['philatin'] = 0x0278;
  17179. t['phinthuthai'] = 0x0E3A;
  17180. t['phisymbolgreek'] = 0x03D5;
  17181. t['phook'] = 0x01A5;
  17182. t['phophanthai'] = 0x0E1E;
  17183. t['phophungthai'] = 0x0E1C;
  17184. t['phosamphaothai'] = 0x0E20;
  17185. t['pi'] = 0x03C0;
  17186. t['pieupacirclekorean'] = 0x3273;
  17187. t['pieupaparenkorean'] = 0x3213;
  17188. t['pieupcieuckorean'] = 0x3176;
  17189. t['pieupcirclekorean'] = 0x3265;
  17190. t['pieupkiyeokkorean'] = 0x3172;
  17191. t['pieupkorean'] = 0x3142;
  17192. t['pieupparenkorean'] = 0x3205;
  17193. t['pieupsioskiyeokkorean'] = 0x3174;
  17194. t['pieupsioskorean'] = 0x3144;
  17195. t['pieupsiostikeutkorean'] = 0x3175;
  17196. t['pieupthieuthkorean'] = 0x3177;
  17197. t['pieuptikeutkorean'] = 0x3173;
  17198. t['pihiragana'] = 0x3074;
  17199. t['pikatakana'] = 0x30D4;
  17200. t['pisymbolgreek'] = 0x03D6;
  17201. t['piwrarmenian'] = 0x0583;
  17202. t['plus'] = 0x002B;
  17203. t['plusbelowcmb'] = 0x031F;
  17204. t['pluscircle'] = 0x2295;
  17205. t['plusminus'] = 0x00B1;
  17206. t['plusmod'] = 0x02D6;
  17207. t['plusmonospace'] = 0xFF0B;
  17208. t['plussmall'] = 0xFE62;
  17209. t['plussuperior'] = 0x207A;
  17210. t['pmonospace'] = 0xFF50;
  17211. t['pmsquare'] = 0x33D8;
  17212. t['pohiragana'] = 0x307D;
  17213. t['pointingindexdownwhite'] = 0x261F;
  17214. t['pointingindexleftwhite'] = 0x261C;
  17215. t['pointingindexrightwhite'] = 0x261E;
  17216. t['pointingindexupwhite'] = 0x261D;
  17217. t['pokatakana'] = 0x30DD;
  17218. t['poplathai'] = 0x0E1B;
  17219. t['postalmark'] = 0x3012;
  17220. t['postalmarkface'] = 0x3020;
  17221. t['pparen'] = 0x24AB;
  17222. t['precedes'] = 0x227A;
  17223. t['prescription'] = 0x211E;
  17224. t['primemod'] = 0x02B9;
  17225. t['primereversed'] = 0x2035;
  17226. t['product'] = 0x220F;
  17227. t['projective'] = 0x2305;
  17228. t['prolongedkana'] = 0x30FC;
  17229. t['propellor'] = 0x2318;
  17230. t['propersubset'] = 0x2282;
  17231. t['propersuperset'] = 0x2283;
  17232. t['proportion'] = 0x2237;
  17233. t['proportional'] = 0x221D;
  17234. t['psi'] = 0x03C8;
  17235. t['psicyrillic'] = 0x0471;
  17236. t['psilipneumatacyrilliccmb'] = 0x0486;
  17237. t['pssquare'] = 0x33B0;
  17238. t['puhiragana'] = 0x3077;
  17239. t['pukatakana'] = 0x30D7;
  17240. t['pvsquare'] = 0x33B4;
  17241. t['pwsquare'] = 0x33BA;
  17242. t['q'] = 0x0071;
  17243. t['qadeva'] = 0x0958;
  17244. t['qadmahebrew'] = 0x05A8;
  17245. t['qafarabic'] = 0x0642;
  17246. t['qaffinalarabic'] = 0xFED6;
  17247. t['qafinitialarabic'] = 0xFED7;
  17248. t['qafmedialarabic'] = 0xFED8;
  17249. t['qamats'] = 0x05B8;
  17250. t['qamats10'] = 0x05B8;
  17251. t['qamats1a'] = 0x05B8;
  17252. t['qamats1c'] = 0x05B8;
  17253. t['qamats27'] = 0x05B8;
  17254. t['qamats29'] = 0x05B8;
  17255. t['qamats33'] = 0x05B8;
  17256. t['qamatsde'] = 0x05B8;
  17257. t['qamatshebrew'] = 0x05B8;
  17258. t['qamatsnarrowhebrew'] = 0x05B8;
  17259. t['qamatsqatanhebrew'] = 0x05B8;
  17260. t['qamatsqatannarrowhebrew'] = 0x05B8;
  17261. t['qamatsqatanquarterhebrew'] = 0x05B8;
  17262. t['qamatsqatanwidehebrew'] = 0x05B8;
  17263. t['qamatsquarterhebrew'] = 0x05B8;
  17264. t['qamatswidehebrew'] = 0x05B8;
  17265. t['qarneyparahebrew'] = 0x059F;
  17266. t['qbopomofo'] = 0x3111;
  17267. t['qcircle'] = 0x24E0;
  17268. t['qhook'] = 0x02A0;
  17269. t['qmonospace'] = 0xFF51;
  17270. t['qof'] = 0x05E7;
  17271. t['qofdagesh'] = 0xFB47;
  17272. t['qofdageshhebrew'] = 0xFB47;
  17273. t['qofhebrew'] = 0x05E7;
  17274. t['qparen'] = 0x24AC;
  17275. t['quarternote'] = 0x2669;
  17276. t['qubuts'] = 0x05BB;
  17277. t['qubuts18'] = 0x05BB;
  17278. t['qubuts25'] = 0x05BB;
  17279. t['qubuts31'] = 0x05BB;
  17280. t['qubutshebrew'] = 0x05BB;
  17281. t['qubutsnarrowhebrew'] = 0x05BB;
  17282. t['qubutsquarterhebrew'] = 0x05BB;
  17283. t['qubutswidehebrew'] = 0x05BB;
  17284. t['question'] = 0x003F;
  17285. t['questionarabic'] = 0x061F;
  17286. t['questionarmenian'] = 0x055E;
  17287. t['questiondown'] = 0x00BF;
  17288. t['questiondownsmall'] = 0xF7BF;
  17289. t['questiongreek'] = 0x037E;
  17290. t['questionmonospace'] = 0xFF1F;
  17291. t['questionsmall'] = 0xF73F;
  17292. t['quotedbl'] = 0x0022;
  17293. t['quotedblbase'] = 0x201E;
  17294. t['quotedblleft'] = 0x201C;
  17295. t['quotedblmonospace'] = 0xFF02;
  17296. t['quotedblprime'] = 0x301E;
  17297. t['quotedblprimereversed'] = 0x301D;
  17298. t['quotedblright'] = 0x201D;
  17299. t['quoteleft'] = 0x2018;
  17300. t['quoteleftreversed'] = 0x201B;
  17301. t['quotereversed'] = 0x201B;
  17302. t['quoteright'] = 0x2019;
  17303. t['quoterightn'] = 0x0149;
  17304. t['quotesinglbase'] = 0x201A;
  17305. t['quotesingle'] = 0x0027;
  17306. t['quotesinglemonospace'] = 0xFF07;
  17307. t['r'] = 0x0072;
  17308. t['raarmenian'] = 0x057C;
  17309. t['rabengali'] = 0x09B0;
  17310. t['racute'] = 0x0155;
  17311. t['radeva'] = 0x0930;
  17312. t['radical'] = 0x221A;
  17313. t['radicalex'] = 0xF8E5;
  17314. t['radoverssquare'] = 0x33AE;
  17315. t['radoverssquaredsquare'] = 0x33AF;
  17316. t['radsquare'] = 0x33AD;
  17317. t['rafe'] = 0x05BF;
  17318. t['rafehebrew'] = 0x05BF;
  17319. t['ragujarati'] = 0x0AB0;
  17320. t['ragurmukhi'] = 0x0A30;
  17321. t['rahiragana'] = 0x3089;
  17322. t['rakatakana'] = 0x30E9;
  17323. t['rakatakanahalfwidth'] = 0xFF97;
  17324. t['ralowerdiagonalbengali'] = 0x09F1;
  17325. t['ramiddlediagonalbengali'] = 0x09F0;
  17326. t['ramshorn'] = 0x0264;
  17327. t['ratio'] = 0x2236;
  17328. t['rbopomofo'] = 0x3116;
  17329. t['rcaron'] = 0x0159;
  17330. t['rcedilla'] = 0x0157;
  17331. t['rcircle'] = 0x24E1;
  17332. t['rcommaaccent'] = 0x0157;
  17333. t['rdblgrave'] = 0x0211;
  17334. t['rdotaccent'] = 0x1E59;
  17335. t['rdotbelow'] = 0x1E5B;
  17336. t['rdotbelowmacron'] = 0x1E5D;
  17337. t['referencemark'] = 0x203B;
  17338. t['reflexsubset'] = 0x2286;
  17339. t['reflexsuperset'] = 0x2287;
  17340. t['registered'] = 0x00AE;
  17341. t['registersans'] = 0xF8E8;
  17342. t['registerserif'] = 0xF6DA;
  17343. t['reharabic'] = 0x0631;
  17344. t['reharmenian'] = 0x0580;
  17345. t['rehfinalarabic'] = 0xFEAE;
  17346. t['rehiragana'] = 0x308C;
  17347. t['rekatakana'] = 0x30EC;
  17348. t['rekatakanahalfwidth'] = 0xFF9A;
  17349. t['resh'] = 0x05E8;
  17350. t['reshdageshhebrew'] = 0xFB48;
  17351. t['reshhebrew'] = 0x05E8;
  17352. t['reversedtilde'] = 0x223D;
  17353. t['reviahebrew'] = 0x0597;
  17354. t['reviamugrashhebrew'] = 0x0597;
  17355. t['revlogicalnot'] = 0x2310;
  17356. t['rfishhook'] = 0x027E;
  17357. t['rfishhookreversed'] = 0x027F;
  17358. t['rhabengali'] = 0x09DD;
  17359. t['rhadeva'] = 0x095D;
  17360. t['rho'] = 0x03C1;
  17361. t['rhook'] = 0x027D;
  17362. t['rhookturned'] = 0x027B;
  17363. t['rhookturnedsuperior'] = 0x02B5;
  17364. t['rhosymbolgreek'] = 0x03F1;
  17365. t['rhotichookmod'] = 0x02DE;
  17366. t['rieulacirclekorean'] = 0x3271;
  17367. t['rieulaparenkorean'] = 0x3211;
  17368. t['rieulcirclekorean'] = 0x3263;
  17369. t['rieulhieuhkorean'] = 0x3140;
  17370. t['rieulkiyeokkorean'] = 0x313A;
  17371. t['rieulkiyeoksioskorean'] = 0x3169;
  17372. t['rieulkorean'] = 0x3139;
  17373. t['rieulmieumkorean'] = 0x313B;
  17374. t['rieulpansioskorean'] = 0x316C;
  17375. t['rieulparenkorean'] = 0x3203;
  17376. t['rieulphieuphkorean'] = 0x313F;
  17377. t['rieulpieupkorean'] = 0x313C;
  17378. t['rieulpieupsioskorean'] = 0x316B;
  17379. t['rieulsioskorean'] = 0x313D;
  17380. t['rieulthieuthkorean'] = 0x313E;
  17381. t['rieultikeutkorean'] = 0x316A;
  17382. t['rieulyeorinhieuhkorean'] = 0x316D;
  17383. t['rightangle'] = 0x221F;
  17384. t['righttackbelowcmb'] = 0x0319;
  17385. t['righttriangle'] = 0x22BF;
  17386. t['rihiragana'] = 0x308A;
  17387. t['rikatakana'] = 0x30EA;
  17388. t['rikatakanahalfwidth'] = 0xFF98;
  17389. t['ring'] = 0x02DA;
  17390. t['ringbelowcmb'] = 0x0325;
  17391. t['ringcmb'] = 0x030A;
  17392. t['ringhalfleft'] = 0x02BF;
  17393. t['ringhalfleftarmenian'] = 0x0559;
  17394. t['ringhalfleftbelowcmb'] = 0x031C;
  17395. t['ringhalfleftcentered'] = 0x02D3;
  17396. t['ringhalfright'] = 0x02BE;
  17397. t['ringhalfrightbelowcmb'] = 0x0339;
  17398. t['ringhalfrightcentered'] = 0x02D2;
  17399. t['rinvertedbreve'] = 0x0213;
  17400. t['rittorusquare'] = 0x3351;
  17401. t['rlinebelow'] = 0x1E5F;
  17402. t['rlongleg'] = 0x027C;
  17403. t['rlonglegturned'] = 0x027A;
  17404. t['rmonospace'] = 0xFF52;
  17405. t['rohiragana'] = 0x308D;
  17406. t['rokatakana'] = 0x30ED;
  17407. t['rokatakanahalfwidth'] = 0xFF9B;
  17408. t['roruathai'] = 0x0E23;
  17409. t['rparen'] = 0x24AD;
  17410. t['rrabengali'] = 0x09DC;
  17411. t['rradeva'] = 0x0931;
  17412. t['rragurmukhi'] = 0x0A5C;
  17413. t['rreharabic'] = 0x0691;
  17414. t['rrehfinalarabic'] = 0xFB8D;
  17415. t['rrvocalicbengali'] = 0x09E0;
  17416. t['rrvocalicdeva'] = 0x0960;
  17417. t['rrvocalicgujarati'] = 0x0AE0;
  17418. t['rrvocalicvowelsignbengali'] = 0x09C4;
  17419. t['rrvocalicvowelsigndeva'] = 0x0944;
  17420. t['rrvocalicvowelsigngujarati'] = 0x0AC4;
  17421. t['rsuperior'] = 0xF6F1;
  17422. t['rtblock'] = 0x2590;
  17423. t['rturned'] = 0x0279;
  17424. t['rturnedsuperior'] = 0x02B4;
  17425. t['ruhiragana'] = 0x308B;
  17426. t['rukatakana'] = 0x30EB;
  17427. t['rukatakanahalfwidth'] = 0xFF99;
  17428. t['rupeemarkbengali'] = 0x09F2;
  17429. t['rupeesignbengali'] = 0x09F3;
  17430. t['rupiah'] = 0xF6DD;
  17431. t['ruthai'] = 0x0E24;
  17432. t['rvocalicbengali'] = 0x098B;
  17433. t['rvocalicdeva'] = 0x090B;
  17434. t['rvocalicgujarati'] = 0x0A8B;
  17435. t['rvocalicvowelsignbengali'] = 0x09C3;
  17436. t['rvocalicvowelsigndeva'] = 0x0943;
  17437. t['rvocalicvowelsigngujarati'] = 0x0AC3;
  17438. t['s'] = 0x0073;
  17439. t['sabengali'] = 0x09B8;
  17440. t['sacute'] = 0x015B;
  17441. t['sacutedotaccent'] = 0x1E65;
  17442. t['sadarabic'] = 0x0635;
  17443. t['sadeva'] = 0x0938;
  17444. t['sadfinalarabic'] = 0xFEBA;
  17445. t['sadinitialarabic'] = 0xFEBB;
  17446. t['sadmedialarabic'] = 0xFEBC;
  17447. t['sagujarati'] = 0x0AB8;
  17448. t['sagurmukhi'] = 0x0A38;
  17449. t['sahiragana'] = 0x3055;
  17450. t['sakatakana'] = 0x30B5;
  17451. t['sakatakanahalfwidth'] = 0xFF7B;
  17452. t['sallallahoualayhewasallamarabic'] = 0xFDFA;
  17453. t['samekh'] = 0x05E1;
  17454. t['samekhdagesh'] = 0xFB41;
  17455. t['samekhdageshhebrew'] = 0xFB41;
  17456. t['samekhhebrew'] = 0x05E1;
  17457. t['saraaathai'] = 0x0E32;
  17458. t['saraaethai'] = 0x0E41;
  17459. t['saraaimaimalaithai'] = 0x0E44;
  17460. t['saraaimaimuanthai'] = 0x0E43;
  17461. t['saraamthai'] = 0x0E33;
  17462. t['saraathai'] = 0x0E30;
  17463. t['saraethai'] = 0x0E40;
  17464. t['saraiileftthai'] = 0xF886;
  17465. t['saraiithai'] = 0x0E35;
  17466. t['saraileftthai'] = 0xF885;
  17467. t['saraithai'] = 0x0E34;
  17468. t['saraothai'] = 0x0E42;
  17469. t['saraueeleftthai'] = 0xF888;
  17470. t['saraueethai'] = 0x0E37;
  17471. t['saraueleftthai'] = 0xF887;
  17472. t['sarauethai'] = 0x0E36;
  17473. t['sarauthai'] = 0x0E38;
  17474. t['sarauuthai'] = 0x0E39;
  17475. t['sbopomofo'] = 0x3119;
  17476. t['scaron'] = 0x0161;
  17477. t['scarondotaccent'] = 0x1E67;
  17478. t['scedilla'] = 0x015F;
  17479. t['schwa'] = 0x0259;
  17480. t['schwacyrillic'] = 0x04D9;
  17481. t['schwadieresiscyrillic'] = 0x04DB;
  17482. t['schwahook'] = 0x025A;
  17483. t['scircle'] = 0x24E2;
  17484. t['scircumflex'] = 0x015D;
  17485. t['scommaaccent'] = 0x0219;
  17486. t['sdotaccent'] = 0x1E61;
  17487. t['sdotbelow'] = 0x1E63;
  17488. t['sdotbelowdotaccent'] = 0x1E69;
  17489. t['seagullbelowcmb'] = 0x033C;
  17490. t['second'] = 0x2033;
  17491. t['secondtonechinese'] = 0x02CA;
  17492. t['section'] = 0x00A7;
  17493. t['seenarabic'] = 0x0633;
  17494. t['seenfinalarabic'] = 0xFEB2;
  17495. t['seeninitialarabic'] = 0xFEB3;
  17496. t['seenmedialarabic'] = 0xFEB4;
  17497. t['segol'] = 0x05B6;
  17498. t['segol13'] = 0x05B6;
  17499. t['segol1f'] = 0x05B6;
  17500. t['segol2c'] = 0x05B6;
  17501. t['segolhebrew'] = 0x05B6;
  17502. t['segolnarrowhebrew'] = 0x05B6;
  17503. t['segolquarterhebrew'] = 0x05B6;
  17504. t['segoltahebrew'] = 0x0592;
  17505. t['segolwidehebrew'] = 0x05B6;
  17506. t['seharmenian'] = 0x057D;
  17507. t['sehiragana'] = 0x305B;
  17508. t['sekatakana'] = 0x30BB;
  17509. t['sekatakanahalfwidth'] = 0xFF7E;
  17510. t['semicolon'] = 0x003B;
  17511. t['semicolonarabic'] = 0x061B;
  17512. t['semicolonmonospace'] = 0xFF1B;
  17513. t['semicolonsmall'] = 0xFE54;
  17514. t['semivoicedmarkkana'] = 0x309C;
  17515. t['semivoicedmarkkanahalfwidth'] = 0xFF9F;
  17516. t['sentisquare'] = 0x3322;
  17517. t['sentosquare'] = 0x3323;
  17518. t['seven'] = 0x0037;
  17519. t['sevenarabic'] = 0x0667;
  17520. t['sevenbengali'] = 0x09ED;
  17521. t['sevencircle'] = 0x2466;
  17522. t['sevencircleinversesansserif'] = 0x2790;
  17523. t['sevendeva'] = 0x096D;
  17524. t['seveneighths'] = 0x215E;
  17525. t['sevengujarati'] = 0x0AED;
  17526. t['sevengurmukhi'] = 0x0A6D;
  17527. t['sevenhackarabic'] = 0x0667;
  17528. t['sevenhangzhou'] = 0x3027;
  17529. t['sevenideographicparen'] = 0x3226;
  17530. t['seveninferior'] = 0x2087;
  17531. t['sevenmonospace'] = 0xFF17;
  17532. t['sevenoldstyle'] = 0xF737;
  17533. t['sevenparen'] = 0x247A;
  17534. t['sevenperiod'] = 0x248E;
  17535. t['sevenpersian'] = 0x06F7;
  17536. t['sevenroman'] = 0x2176;
  17537. t['sevensuperior'] = 0x2077;
  17538. t['seventeencircle'] = 0x2470;
  17539. t['seventeenparen'] = 0x2484;
  17540. t['seventeenperiod'] = 0x2498;
  17541. t['seventhai'] = 0x0E57;
  17542. t['sfthyphen'] = 0x00AD;
  17543. t['shaarmenian'] = 0x0577;
  17544. t['shabengali'] = 0x09B6;
  17545. t['shacyrillic'] = 0x0448;
  17546. t['shaddaarabic'] = 0x0651;
  17547. t['shaddadammaarabic'] = 0xFC61;
  17548. t['shaddadammatanarabic'] = 0xFC5E;
  17549. t['shaddafathaarabic'] = 0xFC60;
  17550. t['shaddakasraarabic'] = 0xFC62;
  17551. t['shaddakasratanarabic'] = 0xFC5F;
  17552. t['shade'] = 0x2592;
  17553. t['shadedark'] = 0x2593;
  17554. t['shadelight'] = 0x2591;
  17555. t['shademedium'] = 0x2592;
  17556. t['shadeva'] = 0x0936;
  17557. t['shagujarati'] = 0x0AB6;
  17558. t['shagurmukhi'] = 0x0A36;
  17559. t['shalshelethebrew'] = 0x0593;
  17560. t['shbopomofo'] = 0x3115;
  17561. t['shchacyrillic'] = 0x0449;
  17562. t['sheenarabic'] = 0x0634;
  17563. t['sheenfinalarabic'] = 0xFEB6;
  17564. t['sheeninitialarabic'] = 0xFEB7;
  17565. t['sheenmedialarabic'] = 0xFEB8;
  17566. t['sheicoptic'] = 0x03E3;
  17567. t['sheqel'] = 0x20AA;
  17568. t['sheqelhebrew'] = 0x20AA;
  17569. t['sheva'] = 0x05B0;
  17570. t['sheva115'] = 0x05B0;
  17571. t['sheva15'] = 0x05B0;
  17572. t['sheva22'] = 0x05B0;
  17573. t['sheva2e'] = 0x05B0;
  17574. t['shevahebrew'] = 0x05B0;
  17575. t['shevanarrowhebrew'] = 0x05B0;
  17576. t['shevaquarterhebrew'] = 0x05B0;
  17577. t['shevawidehebrew'] = 0x05B0;
  17578. t['shhacyrillic'] = 0x04BB;
  17579. t['shimacoptic'] = 0x03ED;
  17580. t['shin'] = 0x05E9;
  17581. t['shindagesh'] = 0xFB49;
  17582. t['shindageshhebrew'] = 0xFB49;
  17583. t['shindageshshindot'] = 0xFB2C;
  17584. t['shindageshshindothebrew'] = 0xFB2C;
  17585. t['shindageshsindot'] = 0xFB2D;
  17586. t['shindageshsindothebrew'] = 0xFB2D;
  17587. t['shindothebrew'] = 0x05C1;
  17588. t['shinhebrew'] = 0x05E9;
  17589. t['shinshindot'] = 0xFB2A;
  17590. t['shinshindothebrew'] = 0xFB2A;
  17591. t['shinsindot'] = 0xFB2B;
  17592. t['shinsindothebrew'] = 0xFB2B;
  17593. t['shook'] = 0x0282;
  17594. t['sigma'] = 0x03C3;
  17595. t['sigma1'] = 0x03C2;
  17596. t['sigmafinal'] = 0x03C2;
  17597. t['sigmalunatesymbolgreek'] = 0x03F2;
  17598. t['sihiragana'] = 0x3057;
  17599. t['sikatakana'] = 0x30B7;
  17600. t['sikatakanahalfwidth'] = 0xFF7C;
  17601. t['siluqhebrew'] = 0x05BD;
  17602. t['siluqlefthebrew'] = 0x05BD;
  17603. t['similar'] = 0x223C;
  17604. t['sindothebrew'] = 0x05C2;
  17605. t['siosacirclekorean'] = 0x3274;
  17606. t['siosaparenkorean'] = 0x3214;
  17607. t['sioscieuckorean'] = 0x317E;
  17608. t['sioscirclekorean'] = 0x3266;
  17609. t['sioskiyeokkorean'] = 0x317A;
  17610. t['sioskorean'] = 0x3145;
  17611. t['siosnieunkorean'] = 0x317B;
  17612. t['siosparenkorean'] = 0x3206;
  17613. t['siospieupkorean'] = 0x317D;
  17614. t['siostikeutkorean'] = 0x317C;
  17615. t['six'] = 0x0036;
  17616. t['sixarabic'] = 0x0666;
  17617. t['sixbengali'] = 0x09EC;
  17618. t['sixcircle'] = 0x2465;
  17619. t['sixcircleinversesansserif'] = 0x278F;
  17620. t['sixdeva'] = 0x096C;
  17621. t['sixgujarati'] = 0x0AEC;
  17622. t['sixgurmukhi'] = 0x0A6C;
  17623. t['sixhackarabic'] = 0x0666;
  17624. t['sixhangzhou'] = 0x3026;
  17625. t['sixideographicparen'] = 0x3225;
  17626. t['sixinferior'] = 0x2086;
  17627. t['sixmonospace'] = 0xFF16;
  17628. t['sixoldstyle'] = 0xF736;
  17629. t['sixparen'] = 0x2479;
  17630. t['sixperiod'] = 0x248D;
  17631. t['sixpersian'] = 0x06F6;
  17632. t['sixroman'] = 0x2175;
  17633. t['sixsuperior'] = 0x2076;
  17634. t['sixteencircle'] = 0x246F;
  17635. t['sixteencurrencydenominatorbengali'] = 0x09F9;
  17636. t['sixteenparen'] = 0x2483;
  17637. t['sixteenperiod'] = 0x2497;
  17638. t['sixthai'] = 0x0E56;
  17639. t['slash'] = 0x002F;
  17640. t['slashmonospace'] = 0xFF0F;
  17641. t['slong'] = 0x017F;
  17642. t['slongdotaccent'] = 0x1E9B;
  17643. t['smileface'] = 0x263A;
  17644. t['smonospace'] = 0xFF53;
  17645. t['sofpasuqhebrew'] = 0x05C3;
  17646. t['softhyphen'] = 0x00AD;
  17647. t['softsigncyrillic'] = 0x044C;
  17648. t['sohiragana'] = 0x305D;
  17649. t['sokatakana'] = 0x30BD;
  17650. t['sokatakanahalfwidth'] = 0xFF7F;
  17651. t['soliduslongoverlaycmb'] = 0x0338;
  17652. t['solidusshortoverlaycmb'] = 0x0337;
  17653. t['sorusithai'] = 0x0E29;
  17654. t['sosalathai'] = 0x0E28;
  17655. t['sosothai'] = 0x0E0B;
  17656. t['sosuathai'] = 0x0E2A;
  17657. t['space'] = 0x0020;
  17658. t['spacehackarabic'] = 0x0020;
  17659. t['spade'] = 0x2660;
  17660. t['spadesuitblack'] = 0x2660;
  17661. t['spadesuitwhite'] = 0x2664;
  17662. t['sparen'] = 0x24AE;
  17663. t['squarebelowcmb'] = 0x033B;
  17664. t['squarecc'] = 0x33C4;
  17665. t['squarecm'] = 0x339D;
  17666. t['squarediagonalcrosshatchfill'] = 0x25A9;
  17667. t['squarehorizontalfill'] = 0x25A4;
  17668. t['squarekg'] = 0x338F;
  17669. t['squarekm'] = 0x339E;
  17670. t['squarekmcapital'] = 0x33CE;
  17671. t['squareln'] = 0x33D1;
  17672. t['squarelog'] = 0x33D2;
  17673. t['squaremg'] = 0x338E;
  17674. t['squaremil'] = 0x33D5;
  17675. t['squaremm'] = 0x339C;
  17676. t['squaremsquared'] = 0x33A1;
  17677. t['squareorthogonalcrosshatchfill'] = 0x25A6;
  17678. t['squareupperlefttolowerrightfill'] = 0x25A7;
  17679. t['squareupperrighttolowerleftfill'] = 0x25A8;
  17680. t['squareverticalfill'] = 0x25A5;
  17681. t['squarewhitewithsmallblack'] = 0x25A3;
  17682. t['srsquare'] = 0x33DB;
  17683. t['ssabengali'] = 0x09B7;
  17684. t['ssadeva'] = 0x0937;
  17685. t['ssagujarati'] = 0x0AB7;
  17686. t['ssangcieuckorean'] = 0x3149;
  17687. t['ssanghieuhkorean'] = 0x3185;
  17688. t['ssangieungkorean'] = 0x3180;
  17689. t['ssangkiyeokkorean'] = 0x3132;
  17690. t['ssangnieunkorean'] = 0x3165;
  17691. t['ssangpieupkorean'] = 0x3143;
  17692. t['ssangsioskorean'] = 0x3146;
  17693. t['ssangtikeutkorean'] = 0x3138;
  17694. t['ssuperior'] = 0xF6F2;
  17695. t['sterling'] = 0x00A3;
  17696. t['sterlingmonospace'] = 0xFFE1;
  17697. t['strokelongoverlaycmb'] = 0x0336;
  17698. t['strokeshortoverlaycmb'] = 0x0335;
  17699. t['subset'] = 0x2282;
  17700. t['subsetnotequal'] = 0x228A;
  17701. t['subsetorequal'] = 0x2286;
  17702. t['succeeds'] = 0x227B;
  17703. t['suchthat'] = 0x220B;
  17704. t['suhiragana'] = 0x3059;
  17705. t['sukatakana'] = 0x30B9;
  17706. t['sukatakanahalfwidth'] = 0xFF7D;
  17707. t['sukunarabic'] = 0x0652;
  17708. t['summation'] = 0x2211;
  17709. t['sun'] = 0x263C;
  17710. t['superset'] = 0x2283;
  17711. t['supersetnotequal'] = 0x228B;
  17712. t['supersetorequal'] = 0x2287;
  17713. t['svsquare'] = 0x33DC;
  17714. t['syouwaerasquare'] = 0x337C;
  17715. t['t'] = 0x0074;
  17716. t['tabengali'] = 0x09A4;
  17717. t['tackdown'] = 0x22A4;
  17718. t['tackleft'] = 0x22A3;
  17719. t['tadeva'] = 0x0924;
  17720. t['tagujarati'] = 0x0AA4;
  17721. t['tagurmukhi'] = 0x0A24;
  17722. t['taharabic'] = 0x0637;
  17723. t['tahfinalarabic'] = 0xFEC2;
  17724. t['tahinitialarabic'] = 0xFEC3;
  17725. t['tahiragana'] = 0x305F;
  17726. t['tahmedialarabic'] = 0xFEC4;
  17727. t['taisyouerasquare'] = 0x337D;
  17728. t['takatakana'] = 0x30BF;
  17729. t['takatakanahalfwidth'] = 0xFF80;
  17730. t['tatweelarabic'] = 0x0640;
  17731. t['tau'] = 0x03C4;
  17732. t['tav'] = 0x05EA;
  17733. t['tavdages'] = 0xFB4A;
  17734. t['tavdagesh'] = 0xFB4A;
  17735. t['tavdageshhebrew'] = 0xFB4A;
  17736. t['tavhebrew'] = 0x05EA;
  17737. t['tbar'] = 0x0167;
  17738. t['tbopomofo'] = 0x310A;
  17739. t['tcaron'] = 0x0165;
  17740. t['tccurl'] = 0x02A8;
  17741. t['tcedilla'] = 0x0163;
  17742. t['tcheharabic'] = 0x0686;
  17743. t['tchehfinalarabic'] = 0xFB7B;
  17744. t['tchehinitialarabic'] = 0xFB7C;
  17745. t['tchehmedialarabic'] = 0xFB7D;
  17746. t['tcircle'] = 0x24E3;
  17747. t['tcircumflexbelow'] = 0x1E71;
  17748. t['tcommaaccent'] = 0x0163;
  17749. t['tdieresis'] = 0x1E97;
  17750. t['tdotaccent'] = 0x1E6B;
  17751. t['tdotbelow'] = 0x1E6D;
  17752. t['tecyrillic'] = 0x0442;
  17753. t['tedescendercyrillic'] = 0x04AD;
  17754. t['teharabic'] = 0x062A;
  17755. t['tehfinalarabic'] = 0xFE96;
  17756. t['tehhahinitialarabic'] = 0xFCA2;
  17757. t['tehhahisolatedarabic'] = 0xFC0C;
  17758. t['tehinitialarabic'] = 0xFE97;
  17759. t['tehiragana'] = 0x3066;
  17760. t['tehjeeminitialarabic'] = 0xFCA1;
  17761. t['tehjeemisolatedarabic'] = 0xFC0B;
  17762. t['tehmarbutaarabic'] = 0x0629;
  17763. t['tehmarbutafinalarabic'] = 0xFE94;
  17764. t['tehmedialarabic'] = 0xFE98;
  17765. t['tehmeeminitialarabic'] = 0xFCA4;
  17766. t['tehmeemisolatedarabic'] = 0xFC0E;
  17767. t['tehnoonfinalarabic'] = 0xFC73;
  17768. t['tekatakana'] = 0x30C6;
  17769. t['tekatakanahalfwidth'] = 0xFF83;
  17770. t['telephone'] = 0x2121;
  17771. t['telephoneblack'] = 0x260E;
  17772. t['telishagedolahebrew'] = 0x05A0;
  17773. t['telishaqetanahebrew'] = 0x05A9;
  17774. t['tencircle'] = 0x2469;
  17775. t['tenideographicparen'] = 0x3229;
  17776. t['tenparen'] = 0x247D;
  17777. t['tenperiod'] = 0x2491;
  17778. t['tenroman'] = 0x2179;
  17779. t['tesh'] = 0x02A7;
  17780. t['tet'] = 0x05D8;
  17781. t['tetdagesh'] = 0xFB38;
  17782. t['tetdageshhebrew'] = 0xFB38;
  17783. t['tethebrew'] = 0x05D8;
  17784. t['tetsecyrillic'] = 0x04B5;
  17785. t['tevirhebrew'] = 0x059B;
  17786. t['tevirlefthebrew'] = 0x059B;
  17787. t['thabengali'] = 0x09A5;
  17788. t['thadeva'] = 0x0925;
  17789. t['thagujarati'] = 0x0AA5;
  17790. t['thagurmukhi'] = 0x0A25;
  17791. t['thalarabic'] = 0x0630;
  17792. t['thalfinalarabic'] = 0xFEAC;
  17793. t['thanthakhatlowleftthai'] = 0xF898;
  17794. t['thanthakhatlowrightthai'] = 0xF897;
  17795. t['thanthakhatthai'] = 0x0E4C;
  17796. t['thanthakhatupperleftthai'] = 0xF896;
  17797. t['theharabic'] = 0x062B;
  17798. t['thehfinalarabic'] = 0xFE9A;
  17799. t['thehinitialarabic'] = 0xFE9B;
  17800. t['thehmedialarabic'] = 0xFE9C;
  17801. t['thereexists'] = 0x2203;
  17802. t['therefore'] = 0x2234;
  17803. t['theta'] = 0x03B8;
  17804. t['theta1'] = 0x03D1;
  17805. t['thetasymbolgreek'] = 0x03D1;
  17806. t['thieuthacirclekorean'] = 0x3279;
  17807. t['thieuthaparenkorean'] = 0x3219;
  17808. t['thieuthcirclekorean'] = 0x326B;
  17809. t['thieuthkorean'] = 0x314C;
  17810. t['thieuthparenkorean'] = 0x320B;
  17811. t['thirteencircle'] = 0x246C;
  17812. t['thirteenparen'] = 0x2480;
  17813. t['thirteenperiod'] = 0x2494;
  17814. t['thonangmonthothai'] = 0x0E11;
  17815. t['thook'] = 0x01AD;
  17816. t['thophuthaothai'] = 0x0E12;
  17817. t['thorn'] = 0x00FE;
  17818. t['thothahanthai'] = 0x0E17;
  17819. t['thothanthai'] = 0x0E10;
  17820. t['thothongthai'] = 0x0E18;
  17821. t['thothungthai'] = 0x0E16;
  17822. t['thousandcyrillic'] = 0x0482;
  17823. t['thousandsseparatorarabic'] = 0x066C;
  17824. t['thousandsseparatorpersian'] = 0x066C;
  17825. t['three'] = 0x0033;
  17826. t['threearabic'] = 0x0663;
  17827. t['threebengali'] = 0x09E9;
  17828. t['threecircle'] = 0x2462;
  17829. t['threecircleinversesansserif'] = 0x278C;
  17830. t['threedeva'] = 0x0969;
  17831. t['threeeighths'] = 0x215C;
  17832. t['threegujarati'] = 0x0AE9;
  17833. t['threegurmukhi'] = 0x0A69;
  17834. t['threehackarabic'] = 0x0663;
  17835. t['threehangzhou'] = 0x3023;
  17836. t['threeideographicparen'] = 0x3222;
  17837. t['threeinferior'] = 0x2083;
  17838. t['threemonospace'] = 0xFF13;
  17839. t['threenumeratorbengali'] = 0x09F6;
  17840. t['threeoldstyle'] = 0xF733;
  17841. t['threeparen'] = 0x2476;
  17842. t['threeperiod'] = 0x248A;
  17843. t['threepersian'] = 0x06F3;
  17844. t['threequarters'] = 0x00BE;
  17845. t['threequartersemdash'] = 0xF6DE;
  17846. t['threeroman'] = 0x2172;
  17847. t['threesuperior'] = 0x00B3;
  17848. t['threethai'] = 0x0E53;
  17849. t['thzsquare'] = 0x3394;
  17850. t['tihiragana'] = 0x3061;
  17851. t['tikatakana'] = 0x30C1;
  17852. t['tikatakanahalfwidth'] = 0xFF81;
  17853. t['tikeutacirclekorean'] = 0x3270;
  17854. t['tikeutaparenkorean'] = 0x3210;
  17855. t['tikeutcirclekorean'] = 0x3262;
  17856. t['tikeutkorean'] = 0x3137;
  17857. t['tikeutparenkorean'] = 0x3202;
  17858. t['tilde'] = 0x02DC;
  17859. t['tildebelowcmb'] = 0x0330;
  17860. t['tildecmb'] = 0x0303;
  17861. t['tildecomb'] = 0x0303;
  17862. t['tildedoublecmb'] = 0x0360;
  17863. t['tildeoperator'] = 0x223C;
  17864. t['tildeoverlaycmb'] = 0x0334;
  17865. t['tildeverticalcmb'] = 0x033E;
  17866. t['timescircle'] = 0x2297;
  17867. t['tipehahebrew'] = 0x0596;
  17868. t['tipehalefthebrew'] = 0x0596;
  17869. t['tippigurmukhi'] = 0x0A70;
  17870. t['titlocyrilliccmb'] = 0x0483;
  17871. t['tiwnarmenian'] = 0x057F;
  17872. t['tlinebelow'] = 0x1E6F;
  17873. t['tmonospace'] = 0xFF54;
  17874. t['toarmenian'] = 0x0569;
  17875. t['tohiragana'] = 0x3068;
  17876. t['tokatakana'] = 0x30C8;
  17877. t['tokatakanahalfwidth'] = 0xFF84;
  17878. t['tonebarextrahighmod'] = 0x02E5;
  17879. t['tonebarextralowmod'] = 0x02E9;
  17880. t['tonebarhighmod'] = 0x02E6;
  17881. t['tonebarlowmod'] = 0x02E8;
  17882. t['tonebarmidmod'] = 0x02E7;
  17883. t['tonefive'] = 0x01BD;
  17884. t['tonesix'] = 0x0185;
  17885. t['tonetwo'] = 0x01A8;
  17886. t['tonos'] = 0x0384;
  17887. t['tonsquare'] = 0x3327;
  17888. t['topatakthai'] = 0x0E0F;
  17889. t['tortoiseshellbracketleft'] = 0x3014;
  17890. t['tortoiseshellbracketleftsmall'] = 0xFE5D;
  17891. t['tortoiseshellbracketleftvertical'] = 0xFE39;
  17892. t['tortoiseshellbracketright'] = 0x3015;
  17893. t['tortoiseshellbracketrightsmall'] = 0xFE5E;
  17894. t['tortoiseshellbracketrightvertical'] = 0xFE3A;
  17895. t['totaothai'] = 0x0E15;
  17896. t['tpalatalhook'] = 0x01AB;
  17897. t['tparen'] = 0x24AF;
  17898. t['trademark'] = 0x2122;
  17899. t['trademarksans'] = 0xF8EA;
  17900. t['trademarkserif'] = 0xF6DB;
  17901. t['tretroflexhook'] = 0x0288;
  17902. t['triagdn'] = 0x25BC;
  17903. t['triaglf'] = 0x25C4;
  17904. t['triagrt'] = 0x25BA;
  17905. t['triagup'] = 0x25B2;
  17906. t['ts'] = 0x02A6;
  17907. t['tsadi'] = 0x05E6;
  17908. t['tsadidagesh'] = 0xFB46;
  17909. t['tsadidageshhebrew'] = 0xFB46;
  17910. t['tsadihebrew'] = 0x05E6;
  17911. t['tsecyrillic'] = 0x0446;
  17912. t['tsere'] = 0x05B5;
  17913. t['tsere12'] = 0x05B5;
  17914. t['tsere1e'] = 0x05B5;
  17915. t['tsere2b'] = 0x05B5;
  17916. t['tserehebrew'] = 0x05B5;
  17917. t['tserenarrowhebrew'] = 0x05B5;
  17918. t['tserequarterhebrew'] = 0x05B5;
  17919. t['tserewidehebrew'] = 0x05B5;
  17920. t['tshecyrillic'] = 0x045B;
  17921. t['tsuperior'] = 0xF6F3;
  17922. t['ttabengali'] = 0x099F;
  17923. t['ttadeva'] = 0x091F;
  17924. t['ttagujarati'] = 0x0A9F;
  17925. t['ttagurmukhi'] = 0x0A1F;
  17926. t['tteharabic'] = 0x0679;
  17927. t['ttehfinalarabic'] = 0xFB67;
  17928. t['ttehinitialarabic'] = 0xFB68;
  17929. t['ttehmedialarabic'] = 0xFB69;
  17930. t['tthabengali'] = 0x09A0;
  17931. t['tthadeva'] = 0x0920;
  17932. t['tthagujarati'] = 0x0AA0;
  17933. t['tthagurmukhi'] = 0x0A20;
  17934. t['tturned'] = 0x0287;
  17935. t['tuhiragana'] = 0x3064;
  17936. t['tukatakana'] = 0x30C4;
  17937. t['tukatakanahalfwidth'] = 0xFF82;
  17938. t['tusmallhiragana'] = 0x3063;
  17939. t['tusmallkatakana'] = 0x30C3;
  17940. t['tusmallkatakanahalfwidth'] = 0xFF6F;
  17941. t['twelvecircle'] = 0x246B;
  17942. t['twelveparen'] = 0x247F;
  17943. t['twelveperiod'] = 0x2493;
  17944. t['twelveroman'] = 0x217B;
  17945. t['twentycircle'] = 0x2473;
  17946. t['twentyhangzhou'] = 0x5344;
  17947. t['twentyparen'] = 0x2487;
  17948. t['twentyperiod'] = 0x249B;
  17949. t['two'] = 0x0032;
  17950. t['twoarabic'] = 0x0662;
  17951. t['twobengali'] = 0x09E8;
  17952. t['twocircle'] = 0x2461;
  17953. t['twocircleinversesansserif'] = 0x278B;
  17954. t['twodeva'] = 0x0968;
  17955. t['twodotenleader'] = 0x2025;
  17956. t['twodotleader'] = 0x2025;
  17957. t['twodotleadervertical'] = 0xFE30;
  17958. t['twogujarati'] = 0x0AE8;
  17959. t['twogurmukhi'] = 0x0A68;
  17960. t['twohackarabic'] = 0x0662;
  17961. t['twohangzhou'] = 0x3022;
  17962. t['twoideographicparen'] = 0x3221;
  17963. t['twoinferior'] = 0x2082;
  17964. t['twomonospace'] = 0xFF12;
  17965. t['twonumeratorbengali'] = 0x09F5;
  17966. t['twooldstyle'] = 0xF732;
  17967. t['twoparen'] = 0x2475;
  17968. t['twoperiod'] = 0x2489;
  17969. t['twopersian'] = 0x06F2;
  17970. t['tworoman'] = 0x2171;
  17971. t['twostroke'] = 0x01BB;
  17972. t['twosuperior'] = 0x00B2;
  17973. t['twothai'] = 0x0E52;
  17974. t['twothirds'] = 0x2154;
  17975. t['u'] = 0x0075;
  17976. t['uacute'] = 0x00FA;
  17977. t['ubar'] = 0x0289;
  17978. t['ubengali'] = 0x0989;
  17979. t['ubopomofo'] = 0x3128;
  17980. t['ubreve'] = 0x016D;
  17981. t['ucaron'] = 0x01D4;
  17982. t['ucircle'] = 0x24E4;
  17983. t['ucircumflex'] = 0x00FB;
  17984. t['ucircumflexbelow'] = 0x1E77;
  17985. t['ucyrillic'] = 0x0443;
  17986. t['udattadeva'] = 0x0951;
  17987. t['udblacute'] = 0x0171;
  17988. t['udblgrave'] = 0x0215;
  17989. t['udeva'] = 0x0909;
  17990. t['udieresis'] = 0x00FC;
  17991. t['udieresisacute'] = 0x01D8;
  17992. t['udieresisbelow'] = 0x1E73;
  17993. t['udieresiscaron'] = 0x01DA;
  17994. t['udieresiscyrillic'] = 0x04F1;
  17995. t['udieresisgrave'] = 0x01DC;
  17996. t['udieresismacron'] = 0x01D6;
  17997. t['udotbelow'] = 0x1EE5;
  17998. t['ugrave'] = 0x00F9;
  17999. t['ugujarati'] = 0x0A89;
  18000. t['ugurmukhi'] = 0x0A09;
  18001. t['uhiragana'] = 0x3046;
  18002. t['uhookabove'] = 0x1EE7;
  18003. t['uhorn'] = 0x01B0;
  18004. t['uhornacute'] = 0x1EE9;
  18005. t['uhorndotbelow'] = 0x1EF1;
  18006. t['uhorngrave'] = 0x1EEB;
  18007. t['uhornhookabove'] = 0x1EED;
  18008. t['uhorntilde'] = 0x1EEF;
  18009. t['uhungarumlaut'] = 0x0171;
  18010. t['uhungarumlautcyrillic'] = 0x04F3;
  18011. t['uinvertedbreve'] = 0x0217;
  18012. t['ukatakana'] = 0x30A6;
  18013. t['ukatakanahalfwidth'] = 0xFF73;
  18014. t['ukcyrillic'] = 0x0479;
  18015. t['ukorean'] = 0x315C;
  18016. t['umacron'] = 0x016B;
  18017. t['umacroncyrillic'] = 0x04EF;
  18018. t['umacrondieresis'] = 0x1E7B;
  18019. t['umatragurmukhi'] = 0x0A41;
  18020. t['umonospace'] = 0xFF55;
  18021. t['underscore'] = 0x005F;
  18022. t['underscoredbl'] = 0x2017;
  18023. t['underscoremonospace'] = 0xFF3F;
  18024. t['underscorevertical'] = 0xFE33;
  18025. t['underscorewavy'] = 0xFE4F;
  18026. t['union'] = 0x222A;
  18027. t['universal'] = 0x2200;
  18028. t['uogonek'] = 0x0173;
  18029. t['uparen'] = 0x24B0;
  18030. t['upblock'] = 0x2580;
  18031. t['upperdothebrew'] = 0x05C4;
  18032. t['upsilon'] = 0x03C5;
  18033. t['upsilondieresis'] = 0x03CB;
  18034. t['upsilondieresistonos'] = 0x03B0;
  18035. t['upsilonlatin'] = 0x028A;
  18036. t['upsilontonos'] = 0x03CD;
  18037. t['uptackbelowcmb'] = 0x031D;
  18038. t['uptackmod'] = 0x02D4;
  18039. t['uragurmukhi'] = 0x0A73;
  18040. t['uring'] = 0x016F;
  18041. t['ushortcyrillic'] = 0x045E;
  18042. t['usmallhiragana'] = 0x3045;
  18043. t['usmallkatakana'] = 0x30A5;
  18044. t['usmallkatakanahalfwidth'] = 0xFF69;
  18045. t['ustraightcyrillic'] = 0x04AF;
  18046. t['ustraightstrokecyrillic'] = 0x04B1;
  18047. t['utilde'] = 0x0169;
  18048. t['utildeacute'] = 0x1E79;
  18049. t['utildebelow'] = 0x1E75;
  18050. t['uubengali'] = 0x098A;
  18051. t['uudeva'] = 0x090A;
  18052. t['uugujarati'] = 0x0A8A;
  18053. t['uugurmukhi'] = 0x0A0A;
  18054. t['uumatragurmukhi'] = 0x0A42;
  18055. t['uuvowelsignbengali'] = 0x09C2;
  18056. t['uuvowelsigndeva'] = 0x0942;
  18057. t['uuvowelsigngujarati'] = 0x0AC2;
  18058. t['uvowelsignbengali'] = 0x09C1;
  18059. t['uvowelsigndeva'] = 0x0941;
  18060. t['uvowelsigngujarati'] = 0x0AC1;
  18061. t['v'] = 0x0076;
  18062. t['vadeva'] = 0x0935;
  18063. t['vagujarati'] = 0x0AB5;
  18064. t['vagurmukhi'] = 0x0A35;
  18065. t['vakatakana'] = 0x30F7;
  18066. t['vav'] = 0x05D5;
  18067. t['vavdagesh'] = 0xFB35;
  18068. t['vavdagesh65'] = 0xFB35;
  18069. t['vavdageshhebrew'] = 0xFB35;
  18070. t['vavhebrew'] = 0x05D5;
  18071. t['vavholam'] = 0xFB4B;
  18072. t['vavholamhebrew'] = 0xFB4B;
  18073. t['vavvavhebrew'] = 0x05F0;
  18074. t['vavyodhebrew'] = 0x05F1;
  18075. t['vcircle'] = 0x24E5;
  18076. t['vdotbelow'] = 0x1E7F;
  18077. t['vecyrillic'] = 0x0432;
  18078. t['veharabic'] = 0x06A4;
  18079. t['vehfinalarabic'] = 0xFB6B;
  18080. t['vehinitialarabic'] = 0xFB6C;
  18081. t['vehmedialarabic'] = 0xFB6D;
  18082. t['vekatakana'] = 0x30F9;
  18083. t['venus'] = 0x2640;
  18084. t['verticalbar'] = 0x007C;
  18085. t['verticallineabovecmb'] = 0x030D;
  18086. t['verticallinebelowcmb'] = 0x0329;
  18087. t['verticallinelowmod'] = 0x02CC;
  18088. t['verticallinemod'] = 0x02C8;
  18089. t['vewarmenian'] = 0x057E;
  18090. t['vhook'] = 0x028B;
  18091. t['vikatakana'] = 0x30F8;
  18092. t['viramabengali'] = 0x09CD;
  18093. t['viramadeva'] = 0x094D;
  18094. t['viramagujarati'] = 0x0ACD;
  18095. t['visargabengali'] = 0x0983;
  18096. t['visargadeva'] = 0x0903;
  18097. t['visargagujarati'] = 0x0A83;
  18098. t['vmonospace'] = 0xFF56;
  18099. t['voarmenian'] = 0x0578;
  18100. t['voicediterationhiragana'] = 0x309E;
  18101. t['voicediterationkatakana'] = 0x30FE;
  18102. t['voicedmarkkana'] = 0x309B;
  18103. t['voicedmarkkanahalfwidth'] = 0xFF9E;
  18104. t['vokatakana'] = 0x30FA;
  18105. t['vparen'] = 0x24B1;
  18106. t['vtilde'] = 0x1E7D;
  18107. t['vturned'] = 0x028C;
  18108. t['vuhiragana'] = 0x3094;
  18109. t['vukatakana'] = 0x30F4;
  18110. t['w'] = 0x0077;
  18111. t['wacute'] = 0x1E83;
  18112. t['waekorean'] = 0x3159;
  18113. t['wahiragana'] = 0x308F;
  18114. t['wakatakana'] = 0x30EF;
  18115. t['wakatakanahalfwidth'] = 0xFF9C;
  18116. t['wakorean'] = 0x3158;
  18117. t['wasmallhiragana'] = 0x308E;
  18118. t['wasmallkatakana'] = 0x30EE;
  18119. t['wattosquare'] = 0x3357;
  18120. t['wavedash'] = 0x301C;
  18121. t['wavyunderscorevertical'] = 0xFE34;
  18122. t['wawarabic'] = 0x0648;
  18123. t['wawfinalarabic'] = 0xFEEE;
  18124. t['wawhamzaabovearabic'] = 0x0624;
  18125. t['wawhamzaabovefinalarabic'] = 0xFE86;
  18126. t['wbsquare'] = 0x33DD;
  18127. t['wcircle'] = 0x24E6;
  18128. t['wcircumflex'] = 0x0175;
  18129. t['wdieresis'] = 0x1E85;
  18130. t['wdotaccent'] = 0x1E87;
  18131. t['wdotbelow'] = 0x1E89;
  18132. t['wehiragana'] = 0x3091;
  18133. t['weierstrass'] = 0x2118;
  18134. t['wekatakana'] = 0x30F1;
  18135. t['wekorean'] = 0x315E;
  18136. t['weokorean'] = 0x315D;
  18137. t['wgrave'] = 0x1E81;
  18138. t['whitebullet'] = 0x25E6;
  18139. t['whitecircle'] = 0x25CB;
  18140. t['whitecircleinverse'] = 0x25D9;
  18141. t['whitecornerbracketleft'] = 0x300E;
  18142. t['whitecornerbracketleftvertical'] = 0xFE43;
  18143. t['whitecornerbracketright'] = 0x300F;
  18144. t['whitecornerbracketrightvertical'] = 0xFE44;
  18145. t['whitediamond'] = 0x25C7;
  18146. t['whitediamondcontainingblacksmalldiamond'] = 0x25C8;
  18147. t['whitedownpointingsmalltriangle'] = 0x25BF;
  18148. t['whitedownpointingtriangle'] = 0x25BD;
  18149. t['whiteleftpointingsmalltriangle'] = 0x25C3;
  18150. t['whiteleftpointingtriangle'] = 0x25C1;
  18151. t['whitelenticularbracketleft'] = 0x3016;
  18152. t['whitelenticularbracketright'] = 0x3017;
  18153. t['whiterightpointingsmalltriangle'] = 0x25B9;
  18154. t['whiterightpointingtriangle'] = 0x25B7;
  18155. t['whitesmallsquare'] = 0x25AB;
  18156. t['whitesmilingface'] = 0x263A;
  18157. t['whitesquare'] = 0x25A1;
  18158. t['whitestar'] = 0x2606;
  18159. t['whitetelephone'] = 0x260F;
  18160. t['whitetortoiseshellbracketleft'] = 0x3018;
  18161. t['whitetortoiseshellbracketright'] = 0x3019;
  18162. t['whiteuppointingsmalltriangle'] = 0x25B5;
  18163. t['whiteuppointingtriangle'] = 0x25B3;
  18164. t['wihiragana'] = 0x3090;
  18165. t['wikatakana'] = 0x30F0;
  18166. t['wikorean'] = 0x315F;
  18167. t['wmonospace'] = 0xFF57;
  18168. t['wohiragana'] = 0x3092;
  18169. t['wokatakana'] = 0x30F2;
  18170. t['wokatakanahalfwidth'] = 0xFF66;
  18171. t['won'] = 0x20A9;
  18172. t['wonmonospace'] = 0xFFE6;
  18173. t['wowaenthai'] = 0x0E27;
  18174. t['wparen'] = 0x24B2;
  18175. t['wring'] = 0x1E98;
  18176. t['wsuperior'] = 0x02B7;
  18177. t['wturned'] = 0x028D;
  18178. t['wynn'] = 0x01BF;
  18179. t['x'] = 0x0078;
  18180. t['xabovecmb'] = 0x033D;
  18181. t['xbopomofo'] = 0x3112;
  18182. t['xcircle'] = 0x24E7;
  18183. t['xdieresis'] = 0x1E8D;
  18184. t['xdotaccent'] = 0x1E8B;
  18185. t['xeharmenian'] = 0x056D;
  18186. t['xi'] = 0x03BE;
  18187. t['xmonospace'] = 0xFF58;
  18188. t['xparen'] = 0x24B3;
  18189. t['xsuperior'] = 0x02E3;
  18190. t['y'] = 0x0079;
  18191. t['yaadosquare'] = 0x334E;
  18192. t['yabengali'] = 0x09AF;
  18193. t['yacute'] = 0x00FD;
  18194. t['yadeva'] = 0x092F;
  18195. t['yaekorean'] = 0x3152;
  18196. t['yagujarati'] = 0x0AAF;
  18197. t['yagurmukhi'] = 0x0A2F;
  18198. t['yahiragana'] = 0x3084;
  18199. t['yakatakana'] = 0x30E4;
  18200. t['yakatakanahalfwidth'] = 0xFF94;
  18201. t['yakorean'] = 0x3151;
  18202. t['yamakkanthai'] = 0x0E4E;
  18203. t['yasmallhiragana'] = 0x3083;
  18204. t['yasmallkatakana'] = 0x30E3;
  18205. t['yasmallkatakanahalfwidth'] = 0xFF6C;
  18206. t['yatcyrillic'] = 0x0463;
  18207. t['ycircle'] = 0x24E8;
  18208. t['ycircumflex'] = 0x0177;
  18209. t['ydieresis'] = 0x00FF;
  18210. t['ydotaccent'] = 0x1E8F;
  18211. t['ydotbelow'] = 0x1EF5;
  18212. t['yeharabic'] = 0x064A;
  18213. t['yehbarreearabic'] = 0x06D2;
  18214. t['yehbarreefinalarabic'] = 0xFBAF;
  18215. t['yehfinalarabic'] = 0xFEF2;
  18216. t['yehhamzaabovearabic'] = 0x0626;
  18217. t['yehhamzaabovefinalarabic'] = 0xFE8A;
  18218. t['yehhamzaaboveinitialarabic'] = 0xFE8B;
  18219. t['yehhamzaabovemedialarabic'] = 0xFE8C;
  18220. t['yehinitialarabic'] = 0xFEF3;
  18221. t['yehmedialarabic'] = 0xFEF4;
  18222. t['yehmeeminitialarabic'] = 0xFCDD;
  18223. t['yehmeemisolatedarabic'] = 0xFC58;
  18224. t['yehnoonfinalarabic'] = 0xFC94;
  18225. t['yehthreedotsbelowarabic'] = 0x06D1;
  18226. t['yekorean'] = 0x3156;
  18227. t['yen'] = 0x00A5;
  18228. t['yenmonospace'] = 0xFFE5;
  18229. t['yeokorean'] = 0x3155;
  18230. t['yeorinhieuhkorean'] = 0x3186;
  18231. t['yerahbenyomohebrew'] = 0x05AA;
  18232. t['yerahbenyomolefthebrew'] = 0x05AA;
  18233. t['yericyrillic'] = 0x044B;
  18234. t['yerudieresiscyrillic'] = 0x04F9;
  18235. t['yesieungkorean'] = 0x3181;
  18236. t['yesieungpansioskorean'] = 0x3183;
  18237. t['yesieungsioskorean'] = 0x3182;
  18238. t['yetivhebrew'] = 0x059A;
  18239. t['ygrave'] = 0x1EF3;
  18240. t['yhook'] = 0x01B4;
  18241. t['yhookabove'] = 0x1EF7;
  18242. t['yiarmenian'] = 0x0575;
  18243. t['yicyrillic'] = 0x0457;
  18244. t['yikorean'] = 0x3162;
  18245. t['yinyang'] = 0x262F;
  18246. t['yiwnarmenian'] = 0x0582;
  18247. t['ymonospace'] = 0xFF59;
  18248. t['yod'] = 0x05D9;
  18249. t['yoddagesh'] = 0xFB39;
  18250. t['yoddageshhebrew'] = 0xFB39;
  18251. t['yodhebrew'] = 0x05D9;
  18252. t['yodyodhebrew'] = 0x05F2;
  18253. t['yodyodpatahhebrew'] = 0xFB1F;
  18254. t['yohiragana'] = 0x3088;
  18255. t['yoikorean'] = 0x3189;
  18256. t['yokatakana'] = 0x30E8;
  18257. t['yokatakanahalfwidth'] = 0xFF96;
  18258. t['yokorean'] = 0x315B;
  18259. t['yosmallhiragana'] = 0x3087;
  18260. t['yosmallkatakana'] = 0x30E7;
  18261. t['yosmallkatakanahalfwidth'] = 0xFF6E;
  18262. t['yotgreek'] = 0x03F3;
  18263. t['yoyaekorean'] = 0x3188;
  18264. t['yoyakorean'] = 0x3187;
  18265. t['yoyakthai'] = 0x0E22;
  18266. t['yoyingthai'] = 0x0E0D;
  18267. t['yparen'] = 0x24B4;
  18268. t['ypogegrammeni'] = 0x037A;
  18269. t['ypogegrammenigreekcmb'] = 0x0345;
  18270. t['yr'] = 0x01A6;
  18271. t['yring'] = 0x1E99;
  18272. t['ysuperior'] = 0x02B8;
  18273. t['ytilde'] = 0x1EF9;
  18274. t['yturned'] = 0x028E;
  18275. t['yuhiragana'] = 0x3086;
  18276. t['yuikorean'] = 0x318C;
  18277. t['yukatakana'] = 0x30E6;
  18278. t['yukatakanahalfwidth'] = 0xFF95;
  18279. t['yukorean'] = 0x3160;
  18280. t['yusbigcyrillic'] = 0x046B;
  18281. t['yusbigiotifiedcyrillic'] = 0x046D;
  18282. t['yuslittlecyrillic'] = 0x0467;
  18283. t['yuslittleiotifiedcyrillic'] = 0x0469;
  18284. t['yusmallhiragana'] = 0x3085;
  18285. t['yusmallkatakana'] = 0x30E5;
  18286. t['yusmallkatakanahalfwidth'] = 0xFF6D;
  18287. t['yuyekorean'] = 0x318B;
  18288. t['yuyeokorean'] = 0x318A;
  18289. t['yyabengali'] = 0x09DF;
  18290. t['yyadeva'] = 0x095F;
  18291. t['z'] = 0x007A;
  18292. t['zaarmenian'] = 0x0566;
  18293. t['zacute'] = 0x017A;
  18294. t['zadeva'] = 0x095B;
  18295. t['zagurmukhi'] = 0x0A5B;
  18296. t['zaharabic'] = 0x0638;
  18297. t['zahfinalarabic'] = 0xFEC6;
  18298. t['zahinitialarabic'] = 0xFEC7;
  18299. t['zahiragana'] = 0x3056;
  18300. t['zahmedialarabic'] = 0xFEC8;
  18301. t['zainarabic'] = 0x0632;
  18302. t['zainfinalarabic'] = 0xFEB0;
  18303. t['zakatakana'] = 0x30B6;
  18304. t['zaqefgadolhebrew'] = 0x0595;
  18305. t['zaqefqatanhebrew'] = 0x0594;
  18306. t['zarqahebrew'] = 0x0598;
  18307. t['zayin'] = 0x05D6;
  18308. t['zayindagesh'] = 0xFB36;
  18309. t['zayindageshhebrew'] = 0xFB36;
  18310. t['zayinhebrew'] = 0x05D6;
  18311. t['zbopomofo'] = 0x3117;
  18312. t['zcaron'] = 0x017E;
  18313. t['zcircle'] = 0x24E9;
  18314. t['zcircumflex'] = 0x1E91;
  18315. t['zcurl'] = 0x0291;
  18316. t['zdot'] = 0x017C;
  18317. t['zdotaccent'] = 0x017C;
  18318. t['zdotbelow'] = 0x1E93;
  18319. t['zecyrillic'] = 0x0437;
  18320. t['zedescendercyrillic'] = 0x0499;
  18321. t['zedieresiscyrillic'] = 0x04DF;
  18322. t['zehiragana'] = 0x305C;
  18323. t['zekatakana'] = 0x30BC;
  18324. t['zero'] = 0x0030;
  18325. t['zeroarabic'] = 0x0660;
  18326. t['zerobengali'] = 0x09E6;
  18327. t['zerodeva'] = 0x0966;
  18328. t['zerogujarati'] = 0x0AE6;
  18329. t['zerogurmukhi'] = 0x0A66;
  18330. t['zerohackarabic'] = 0x0660;
  18331. t['zeroinferior'] = 0x2080;
  18332. t['zeromonospace'] = 0xFF10;
  18333. t['zerooldstyle'] = 0xF730;
  18334. t['zeropersian'] = 0x06F0;
  18335. t['zerosuperior'] = 0x2070;
  18336. t['zerothai'] = 0x0E50;
  18337. t['zerowidthjoiner'] = 0xFEFF;
  18338. t['zerowidthnonjoiner'] = 0x200C;
  18339. t['zerowidthspace'] = 0x200B;
  18340. t['zeta'] = 0x03B6;
  18341. t['zhbopomofo'] = 0x3113;
  18342. t['zhearmenian'] = 0x056A;
  18343. t['zhebrevecyrillic'] = 0x04C2;
  18344. t['zhecyrillic'] = 0x0436;
  18345. t['zhedescendercyrillic'] = 0x0497;
  18346. t['zhedieresiscyrillic'] = 0x04DD;
  18347. t['zihiragana'] = 0x3058;
  18348. t['zikatakana'] = 0x30B8;
  18349. t['zinorhebrew'] = 0x05AE;
  18350. t['zlinebelow'] = 0x1E95;
  18351. t['zmonospace'] = 0xFF5A;
  18352. t['zohiragana'] = 0x305E;
  18353. t['zokatakana'] = 0x30BE;
  18354. t['zparen'] = 0x24B5;
  18355. t['zretroflexhook'] = 0x0290;
  18356. t['zstroke'] = 0x01B6;
  18357. t['zuhiragana'] = 0x305A;
  18358. t['zukatakana'] = 0x30BA;
  18359. t['.notdef'] = 0x0000;
  18360. t['angbracketleftbig'] = 0x2329;
  18361. t['angbracketleftBig'] = 0x2329;
  18362. t['angbracketleftbigg'] = 0x2329;
  18363. t['angbracketleftBigg'] = 0x2329;
  18364. t['angbracketrightBig'] = 0x232A;
  18365. t['angbracketrightbig'] = 0x232A;
  18366. t['angbracketrightBigg'] = 0x232A;
  18367. t['angbracketrightbigg'] = 0x232A;
  18368. t['arrowhookleft'] = 0x21AA;
  18369. t['arrowhookright'] = 0x21A9;
  18370. t['arrowlefttophalf'] = 0x21BC;
  18371. t['arrowleftbothalf'] = 0x21BD;
  18372. t['arrownortheast'] = 0x2197;
  18373. t['arrownorthwest'] = 0x2196;
  18374. t['arrowrighttophalf'] = 0x21C0;
  18375. t['arrowrightbothalf'] = 0x21C1;
  18376. t['arrowsoutheast'] = 0x2198;
  18377. t['arrowsouthwest'] = 0x2199;
  18378. t['backslashbig'] = 0x2216;
  18379. t['backslashBig'] = 0x2216;
  18380. t['backslashBigg'] = 0x2216;
  18381. t['backslashbigg'] = 0x2216;
  18382. t['bardbl'] = 0x2016;
  18383. t['bracehtipdownleft'] = 0xFE37;
  18384. t['bracehtipdownright'] = 0xFE37;
  18385. t['bracehtipupleft'] = 0xFE38;
  18386. t['bracehtipupright'] = 0xFE38;
  18387. t['braceleftBig'] = 0x007B;
  18388. t['braceleftbig'] = 0x007B;
  18389. t['braceleftbigg'] = 0x007B;
  18390. t['braceleftBigg'] = 0x007B;
  18391. t['bracerightBig'] = 0x007D;
  18392. t['bracerightbig'] = 0x007D;
  18393. t['bracerightbigg'] = 0x007D;
  18394. t['bracerightBigg'] = 0x007D;
  18395. t['bracketleftbig'] = 0x005B;
  18396. t['bracketleftBig'] = 0x005B;
  18397. t['bracketleftbigg'] = 0x005B;
  18398. t['bracketleftBigg'] = 0x005B;
  18399. t['bracketrightBig'] = 0x005D;
  18400. t['bracketrightbig'] = 0x005D;
  18401. t['bracketrightbigg'] = 0x005D;
  18402. t['bracketrightBigg'] = 0x005D;
  18403. t['ceilingleftbig'] = 0x2308;
  18404. t['ceilingleftBig'] = 0x2308;
  18405. t['ceilingleftBigg'] = 0x2308;
  18406. t['ceilingleftbigg'] = 0x2308;
  18407. t['ceilingrightbig'] = 0x2309;
  18408. t['ceilingrightBig'] = 0x2309;
  18409. t['ceilingrightbigg'] = 0x2309;
  18410. t['ceilingrightBigg'] = 0x2309;
  18411. t['circledotdisplay'] = 0x2299;
  18412. t['circledottext'] = 0x2299;
  18413. t['circlemultiplydisplay'] = 0x2297;
  18414. t['circlemultiplytext'] = 0x2297;
  18415. t['circleplusdisplay'] = 0x2295;
  18416. t['circleplustext'] = 0x2295;
  18417. t['contintegraldisplay'] = 0x222E;
  18418. t['contintegraltext'] = 0x222E;
  18419. t['coproductdisplay'] = 0x2210;
  18420. t['coproducttext'] = 0x2210;
  18421. t['floorleftBig'] = 0x230A;
  18422. t['floorleftbig'] = 0x230A;
  18423. t['floorleftbigg'] = 0x230A;
  18424. t['floorleftBigg'] = 0x230A;
  18425. t['floorrightbig'] = 0x230B;
  18426. t['floorrightBig'] = 0x230B;
  18427. t['floorrightBigg'] = 0x230B;
  18428. t['floorrightbigg'] = 0x230B;
  18429. t['hatwide'] = 0x0302;
  18430. t['hatwider'] = 0x0302;
  18431. t['hatwidest'] = 0x0302;
  18432. t['intercal'] = 0x1D40;
  18433. t['integraldisplay'] = 0x222B;
  18434. t['integraltext'] = 0x222B;
  18435. t['intersectiondisplay'] = 0x22C2;
  18436. t['intersectiontext'] = 0x22C2;
  18437. t['logicalanddisplay'] = 0x2227;
  18438. t['logicalandtext'] = 0x2227;
  18439. t['logicalordisplay'] = 0x2228;
  18440. t['logicalortext'] = 0x2228;
  18441. t['parenleftBig'] = 0x0028;
  18442. t['parenleftbig'] = 0x0028;
  18443. t['parenleftBigg'] = 0x0028;
  18444. t['parenleftbigg'] = 0x0028;
  18445. t['parenrightBig'] = 0x0029;
  18446. t['parenrightbig'] = 0x0029;
  18447. t['parenrightBigg'] = 0x0029;
  18448. t['parenrightbigg'] = 0x0029;
  18449. t['prime'] = 0x2032;
  18450. t['productdisplay'] = 0x220F;
  18451. t['producttext'] = 0x220F;
  18452. t['radicalbig'] = 0x221A;
  18453. t['radicalBig'] = 0x221A;
  18454. t['radicalBigg'] = 0x221A;
  18455. t['radicalbigg'] = 0x221A;
  18456. t['radicalbt'] = 0x221A;
  18457. t['radicaltp'] = 0x221A;
  18458. t['radicalvertex'] = 0x221A;
  18459. t['slashbig'] = 0x002F;
  18460. t['slashBig'] = 0x002F;
  18461. t['slashBigg'] = 0x002F;
  18462. t['slashbigg'] = 0x002F;
  18463. t['summationdisplay'] = 0x2211;
  18464. t['summationtext'] = 0x2211;
  18465. t['tildewide'] = 0x02DC;
  18466. t['tildewider'] = 0x02DC;
  18467. t['tildewidest'] = 0x02DC;
  18468. t['uniondisplay'] = 0x22C3;
  18469. t['unionmultidisplay'] = 0x228E;
  18470. t['unionmultitext'] = 0x228E;
  18471. t['unionsqdisplay'] = 0x2294;
  18472. t['unionsqtext'] = 0x2294;
  18473. t['uniontext'] = 0x22C3;
  18474. t['vextenddouble'] = 0x2225;
  18475. t['vextendsingle'] = 0x2223;
  18476. });
  18477. var getDingbatsGlyphsUnicode = getLookupTableFactory(function (t) {
  18478. t['space'] = 0x0020;
  18479. t['a1'] = 0x2701;
  18480. t['a2'] = 0x2702;
  18481. t['a202'] = 0x2703;
  18482. t['a3'] = 0x2704;
  18483. t['a4'] = 0x260E;
  18484. t['a5'] = 0x2706;
  18485. t['a119'] = 0x2707;
  18486. t['a118'] = 0x2708;
  18487. t['a117'] = 0x2709;
  18488. t['a11'] = 0x261B;
  18489. t['a12'] = 0x261E;
  18490. t['a13'] = 0x270C;
  18491. t['a14'] = 0x270D;
  18492. t['a15'] = 0x270E;
  18493. t['a16'] = 0x270F;
  18494. t['a105'] = 0x2710;
  18495. t['a17'] = 0x2711;
  18496. t['a18'] = 0x2712;
  18497. t['a19'] = 0x2713;
  18498. t['a20'] = 0x2714;
  18499. t['a21'] = 0x2715;
  18500. t['a22'] = 0x2716;
  18501. t['a23'] = 0x2717;
  18502. t['a24'] = 0x2718;
  18503. t['a25'] = 0x2719;
  18504. t['a26'] = 0x271A;
  18505. t['a27'] = 0x271B;
  18506. t['a28'] = 0x271C;
  18507. t['a6'] = 0x271D;
  18508. t['a7'] = 0x271E;
  18509. t['a8'] = 0x271F;
  18510. t['a9'] = 0x2720;
  18511. t['a10'] = 0x2721;
  18512. t['a29'] = 0x2722;
  18513. t['a30'] = 0x2723;
  18514. t['a31'] = 0x2724;
  18515. t['a32'] = 0x2725;
  18516. t['a33'] = 0x2726;
  18517. t['a34'] = 0x2727;
  18518. t['a35'] = 0x2605;
  18519. t['a36'] = 0x2729;
  18520. t['a37'] = 0x272A;
  18521. t['a38'] = 0x272B;
  18522. t['a39'] = 0x272C;
  18523. t['a40'] = 0x272D;
  18524. t['a41'] = 0x272E;
  18525. t['a42'] = 0x272F;
  18526. t['a43'] = 0x2730;
  18527. t['a44'] = 0x2731;
  18528. t['a45'] = 0x2732;
  18529. t['a46'] = 0x2733;
  18530. t['a47'] = 0x2734;
  18531. t['a48'] = 0x2735;
  18532. t['a49'] = 0x2736;
  18533. t['a50'] = 0x2737;
  18534. t['a51'] = 0x2738;
  18535. t['a52'] = 0x2739;
  18536. t['a53'] = 0x273A;
  18537. t['a54'] = 0x273B;
  18538. t['a55'] = 0x273C;
  18539. t['a56'] = 0x273D;
  18540. t['a57'] = 0x273E;
  18541. t['a58'] = 0x273F;
  18542. t['a59'] = 0x2740;
  18543. t['a60'] = 0x2741;
  18544. t['a61'] = 0x2742;
  18545. t['a62'] = 0x2743;
  18546. t['a63'] = 0x2744;
  18547. t['a64'] = 0x2745;
  18548. t['a65'] = 0x2746;
  18549. t['a66'] = 0x2747;
  18550. t['a67'] = 0x2748;
  18551. t['a68'] = 0x2749;
  18552. t['a69'] = 0x274A;
  18553. t['a70'] = 0x274B;
  18554. t['a71'] = 0x25CF;
  18555. t['a72'] = 0x274D;
  18556. t['a73'] = 0x25A0;
  18557. t['a74'] = 0x274F;
  18558. t['a203'] = 0x2750;
  18559. t['a75'] = 0x2751;
  18560. t['a204'] = 0x2752;
  18561. t['a76'] = 0x25B2;
  18562. t['a77'] = 0x25BC;
  18563. t['a78'] = 0x25C6;
  18564. t['a79'] = 0x2756;
  18565. t['a81'] = 0x25D7;
  18566. t['a82'] = 0x2758;
  18567. t['a83'] = 0x2759;
  18568. t['a84'] = 0x275A;
  18569. t['a97'] = 0x275B;
  18570. t['a98'] = 0x275C;
  18571. t['a99'] = 0x275D;
  18572. t['a100'] = 0x275E;
  18573. t['a101'] = 0x2761;
  18574. t['a102'] = 0x2762;
  18575. t['a103'] = 0x2763;
  18576. t['a104'] = 0x2764;
  18577. t['a106'] = 0x2765;
  18578. t['a107'] = 0x2766;
  18579. t['a108'] = 0x2767;
  18580. t['a112'] = 0x2663;
  18581. t['a111'] = 0x2666;
  18582. t['a110'] = 0x2665;
  18583. t['a109'] = 0x2660;
  18584. t['a120'] = 0x2460;
  18585. t['a121'] = 0x2461;
  18586. t['a122'] = 0x2462;
  18587. t['a123'] = 0x2463;
  18588. t['a124'] = 0x2464;
  18589. t['a125'] = 0x2465;
  18590. t['a126'] = 0x2466;
  18591. t['a127'] = 0x2467;
  18592. t['a128'] = 0x2468;
  18593. t['a129'] = 0x2469;
  18594. t['a130'] = 0x2776;
  18595. t['a131'] = 0x2777;
  18596. t['a132'] = 0x2778;
  18597. t['a133'] = 0x2779;
  18598. t['a134'] = 0x277A;
  18599. t['a135'] = 0x277B;
  18600. t['a136'] = 0x277C;
  18601. t['a137'] = 0x277D;
  18602. t['a138'] = 0x277E;
  18603. t['a139'] = 0x277F;
  18604. t['a140'] = 0x2780;
  18605. t['a141'] = 0x2781;
  18606. t['a142'] = 0x2782;
  18607. t['a143'] = 0x2783;
  18608. t['a144'] = 0x2784;
  18609. t['a145'] = 0x2785;
  18610. t['a146'] = 0x2786;
  18611. t['a147'] = 0x2787;
  18612. t['a148'] = 0x2788;
  18613. t['a149'] = 0x2789;
  18614. t['a150'] = 0x278A;
  18615. t['a151'] = 0x278B;
  18616. t['a152'] = 0x278C;
  18617. t['a153'] = 0x278D;
  18618. t['a154'] = 0x278E;
  18619. t['a155'] = 0x278F;
  18620. t['a156'] = 0x2790;
  18621. t['a157'] = 0x2791;
  18622. t['a158'] = 0x2792;
  18623. t['a159'] = 0x2793;
  18624. t['a160'] = 0x2794;
  18625. t['a161'] = 0x2192;
  18626. t['a163'] = 0x2194;
  18627. t['a164'] = 0x2195;
  18628. t['a196'] = 0x2798;
  18629. t['a165'] = 0x2799;
  18630. t['a192'] = 0x279A;
  18631. t['a166'] = 0x279B;
  18632. t['a167'] = 0x279C;
  18633. t['a168'] = 0x279D;
  18634. t['a169'] = 0x279E;
  18635. t['a170'] = 0x279F;
  18636. t['a171'] = 0x27A0;
  18637. t['a172'] = 0x27A1;
  18638. t['a173'] = 0x27A2;
  18639. t['a162'] = 0x27A3;
  18640. t['a174'] = 0x27A4;
  18641. t['a175'] = 0x27A5;
  18642. t['a176'] = 0x27A6;
  18643. t['a177'] = 0x27A7;
  18644. t['a178'] = 0x27A8;
  18645. t['a179'] = 0x27A9;
  18646. t['a193'] = 0x27AA;
  18647. t['a180'] = 0x27AB;
  18648. t['a199'] = 0x27AC;
  18649. t['a181'] = 0x27AD;
  18650. t['a200'] = 0x27AE;
  18651. t['a182'] = 0x27AF;
  18652. t['a201'] = 0x27B1;
  18653. t['a183'] = 0x27B2;
  18654. t['a184'] = 0x27B3;
  18655. t['a197'] = 0x27B4;
  18656. t['a185'] = 0x27B5;
  18657. t['a194'] = 0x27B6;
  18658. t['a198'] = 0x27B7;
  18659. t['a186'] = 0x27B8;
  18660. t['a195'] = 0x27B9;
  18661. t['a187'] = 0x27BA;
  18662. t['a188'] = 0x27BB;
  18663. t['a189'] = 0x27BC;
  18664. t['a190'] = 0x27BD;
  18665. t['a191'] = 0x27BE;
  18666. t['a89'] = 0x2768;
  18667. t['a90'] = 0x2769;
  18668. t['a93'] = 0x276A;
  18669. t['a94'] = 0x276B;
  18670. t['a91'] = 0x276C;
  18671. t['a92'] = 0x276D;
  18672. t['a205'] = 0x276E;
  18673. t['a85'] = 0x276F;
  18674. t['a206'] = 0x2770;
  18675. t['a86'] = 0x2771;
  18676. t['a87'] = 0x2772;
  18677. t['a88'] = 0x2773;
  18678. t['a95'] = 0x2774;
  18679. t['a96'] = 0x2775;
  18680. t['.notdef'] = 0x0000;
  18681. });
  18682. exports.getGlyphsUnicode = getGlyphsUnicode;
  18683. exports.getDingbatsGlyphsUnicode = getDingbatsGlyphsUnicode;
  18684. /***/ }),
  18685. /* 8 */
  18686. /***/ (function(module, exports, __w_pdfjs_require__) {
  18687. "use strict";
  18688. var sharedUtil = __w_pdfjs_require__(0);
  18689. var corePrimitives = __w_pdfjs_require__(1);
  18690. var corePdfManager = __w_pdfjs_require__(33);
  18691. var UNSUPPORTED_FEATURES = sharedUtil.UNSUPPORTED_FEATURES;
  18692. var InvalidPDFException = sharedUtil.InvalidPDFException;
  18693. var MessageHandler = sharedUtil.MessageHandler;
  18694. var MissingPDFException = sharedUtil.MissingPDFException;
  18695. var UnexpectedResponseException = sharedUtil.UnexpectedResponseException;
  18696. var PasswordException = sharedUtil.PasswordException;
  18697. var UnknownErrorException = sharedUtil.UnknownErrorException;
  18698. var XRefParseException = sharedUtil.XRefParseException;
  18699. var arrayByteLength = sharedUtil.arrayByteLength;
  18700. var arraysToBytes = sharedUtil.arraysToBytes;
  18701. var assert = sharedUtil.assert;
  18702. var createPromiseCapability = sharedUtil.createPromiseCapability;
  18703. var error = sharedUtil.error;
  18704. var info = sharedUtil.info;
  18705. var warn = sharedUtil.warn;
  18706. var setVerbosityLevel = sharedUtil.setVerbosityLevel;
  18707. var isNodeJS = sharedUtil.isNodeJS;
  18708. var Ref = corePrimitives.Ref;
  18709. var LocalPdfManager = corePdfManager.LocalPdfManager;
  18710. var NetworkPdfManager = corePdfManager.NetworkPdfManager;
  18711. var globalScope = sharedUtil.globalScope;
  18712. var WorkerTask = function WorkerTaskClosure() {
  18713. function WorkerTask(name) {
  18714. this.name = name;
  18715. this.terminated = false;
  18716. this._capability = createPromiseCapability();
  18717. }
  18718. WorkerTask.prototype = {
  18719. get finished() {
  18720. return this._capability.promise;
  18721. },
  18722. finish: function () {
  18723. this._capability.resolve();
  18724. },
  18725. terminate: function () {
  18726. this.terminated = true;
  18727. },
  18728. ensureNotTerminated: function () {
  18729. if (this.terminated) {
  18730. throw new Error('Worker task was terminated');
  18731. }
  18732. }
  18733. };
  18734. return WorkerTask;
  18735. }();
  18736. var PDFWorkerStream = function PDFWorkerStreamClosure() {
  18737. function PDFWorkerStream(params, msgHandler) {
  18738. this._queuedChunks = [];
  18739. var initialData = params.initialData;
  18740. if (initialData && initialData.length > 0) {
  18741. this._queuedChunks.push(initialData);
  18742. }
  18743. this._msgHandler = msgHandler;
  18744. this._isRangeSupported = !params.disableRange;
  18745. this._isStreamingSupported = !params.disableStream;
  18746. this._contentLength = params.length;
  18747. this._fullRequestReader = null;
  18748. this._rangeReaders = [];
  18749. msgHandler.on('OnDataRange', this._onReceiveData.bind(this));
  18750. msgHandler.on('OnDataProgress', this._onProgress.bind(this));
  18751. }
  18752. PDFWorkerStream.prototype = {
  18753. _onReceiveData: function PDFWorkerStream_onReceiveData(args) {
  18754. if (args.begin === undefined) {
  18755. if (this._fullRequestReader) {
  18756. this._fullRequestReader._enqueue(args.chunk);
  18757. } else {
  18758. this._queuedChunks.push(args.chunk);
  18759. }
  18760. } else {
  18761. var found = this._rangeReaders.some(function (rangeReader) {
  18762. if (rangeReader._begin !== args.begin) {
  18763. return false;
  18764. }
  18765. rangeReader._enqueue(args.chunk);
  18766. return true;
  18767. });
  18768. assert(found);
  18769. }
  18770. },
  18771. _onProgress: function PDFWorkerStream_onProgress(evt) {
  18772. if (this._rangeReaders.length > 0) {
  18773. var firstReader = this._rangeReaders[0];
  18774. if (firstReader.onProgress) {
  18775. firstReader.onProgress({ loaded: evt.loaded });
  18776. }
  18777. }
  18778. },
  18779. _removeRangeReader: function PDFWorkerStream_removeRangeReader(reader) {
  18780. var i = this._rangeReaders.indexOf(reader);
  18781. if (i >= 0) {
  18782. this._rangeReaders.splice(i, 1);
  18783. }
  18784. },
  18785. getFullReader: function PDFWorkerStream_getFullReader() {
  18786. assert(!this._fullRequestReader);
  18787. var queuedChunks = this._queuedChunks;
  18788. this._queuedChunks = null;
  18789. return new PDFWorkerStreamReader(this, queuedChunks);
  18790. },
  18791. getRangeReader: function PDFWorkerStream_getRangeReader(begin, end) {
  18792. var reader = new PDFWorkerStreamRangeReader(this, begin, end);
  18793. this._msgHandler.send('RequestDataRange', {
  18794. begin: begin,
  18795. end: end
  18796. });
  18797. this._rangeReaders.push(reader);
  18798. return reader;
  18799. },
  18800. cancelAllRequests: function PDFWorkerStream_cancelAllRequests(reason) {
  18801. if (this._fullRequestReader) {
  18802. this._fullRequestReader.cancel(reason);
  18803. }
  18804. var readers = this._rangeReaders.slice(0);
  18805. readers.forEach(function (rangeReader) {
  18806. rangeReader.cancel(reason);
  18807. });
  18808. }
  18809. };
  18810. function PDFWorkerStreamReader(stream, queuedChunks) {
  18811. this._stream = stream;
  18812. this._done = false;
  18813. this._queuedChunks = queuedChunks || [];
  18814. this._requests = [];
  18815. this._headersReady = Promise.resolve();
  18816. stream._fullRequestReader = this;
  18817. this.onProgress = null;
  18818. }
  18819. PDFWorkerStreamReader.prototype = {
  18820. _enqueue: function PDFWorkerStreamReader_enqueue(chunk) {
  18821. if (this._done) {
  18822. return;
  18823. }
  18824. if (this._requests.length > 0) {
  18825. var requestCapability = this._requests.shift();
  18826. requestCapability.resolve({
  18827. value: chunk,
  18828. done: false
  18829. });
  18830. return;
  18831. }
  18832. this._queuedChunks.push(chunk);
  18833. },
  18834. get headersReady() {
  18835. return this._headersReady;
  18836. },
  18837. get isRangeSupported() {
  18838. return this._stream._isRangeSupported;
  18839. },
  18840. get isStreamingSupported() {
  18841. return this._stream._isStreamingSupported;
  18842. },
  18843. get contentLength() {
  18844. return this._stream._contentLength;
  18845. },
  18846. read: function PDFWorkerStreamReader_read() {
  18847. if (this._queuedChunks.length > 0) {
  18848. var chunk = this._queuedChunks.shift();
  18849. return Promise.resolve({
  18850. value: chunk,
  18851. done: false
  18852. });
  18853. }
  18854. if (this._done) {
  18855. return Promise.resolve({
  18856. value: undefined,
  18857. done: true
  18858. });
  18859. }
  18860. var requestCapability = createPromiseCapability();
  18861. this._requests.push(requestCapability);
  18862. return requestCapability.promise;
  18863. },
  18864. cancel: function PDFWorkerStreamReader_cancel(reason) {
  18865. this._done = true;
  18866. this._requests.forEach(function (requestCapability) {
  18867. requestCapability.resolve({
  18868. value: undefined,
  18869. done: true
  18870. });
  18871. });
  18872. this._requests = [];
  18873. }
  18874. };
  18875. function PDFWorkerStreamRangeReader(stream, begin, end) {
  18876. this._stream = stream;
  18877. this._begin = begin;
  18878. this._end = end;
  18879. this._queuedChunk = null;
  18880. this._requests = [];
  18881. this._done = false;
  18882. this.onProgress = null;
  18883. }
  18884. PDFWorkerStreamRangeReader.prototype = {
  18885. _enqueue: function PDFWorkerStreamRangeReader_enqueue(chunk) {
  18886. if (this._done) {
  18887. return;
  18888. }
  18889. if (this._requests.length === 0) {
  18890. this._queuedChunk = chunk;
  18891. } else {
  18892. var requestsCapability = this._requests.shift();
  18893. requestsCapability.resolve({
  18894. value: chunk,
  18895. done: false
  18896. });
  18897. this._requests.forEach(function (requestCapability) {
  18898. requestCapability.resolve({
  18899. value: undefined,
  18900. done: true
  18901. });
  18902. });
  18903. this._requests = [];
  18904. }
  18905. this._done = true;
  18906. this._stream._removeRangeReader(this);
  18907. },
  18908. get isStreamingSupported() {
  18909. return false;
  18910. },
  18911. read: function PDFWorkerStreamRangeReader_read() {
  18912. if (this._queuedChunk) {
  18913. return Promise.resolve({
  18914. value: this._queuedChunk,
  18915. done: false
  18916. });
  18917. }
  18918. if (this._done) {
  18919. return Promise.resolve({
  18920. value: undefined,
  18921. done: true
  18922. });
  18923. }
  18924. var requestCapability = createPromiseCapability();
  18925. this._requests.push(requestCapability);
  18926. return requestCapability.promise;
  18927. },
  18928. cancel: function PDFWorkerStreamRangeReader_cancel(reason) {
  18929. this._done = true;
  18930. this._requests.forEach(function (requestCapability) {
  18931. requestCapability.resolve({
  18932. value: undefined,
  18933. done: true
  18934. });
  18935. });
  18936. this._requests = [];
  18937. this._stream._removeRangeReader(this);
  18938. }
  18939. };
  18940. return PDFWorkerStream;
  18941. }();
  18942. var PDFNetworkStream;
  18943. function setPDFNetworkStreamClass(cls) {
  18944. PDFNetworkStream = cls;
  18945. }
  18946. var WorkerMessageHandler = {
  18947. setup: function wphSetup(handler, port) {
  18948. var testMessageProcessed = false;
  18949. handler.on('test', function wphSetupTest(data) {
  18950. if (testMessageProcessed) {
  18951. return;
  18952. }
  18953. testMessageProcessed = true;
  18954. if (!(data instanceof Uint8Array)) {
  18955. handler.send('test', 'main', false);
  18956. return;
  18957. }
  18958. var supportTransfers = data[0] === 255;
  18959. handler.postMessageTransfers = supportTransfers;
  18960. var xhr = new XMLHttpRequest();
  18961. var responseExists = 'response' in xhr;
  18962. try {
  18963. xhr.responseType;
  18964. } catch (e) {
  18965. responseExists = false;
  18966. }
  18967. if (!responseExists) {
  18968. handler.send('test', false);
  18969. return;
  18970. }
  18971. handler.send('test', {
  18972. supportTypedArray: true,
  18973. supportTransfers: supportTransfers
  18974. });
  18975. });
  18976. handler.on('configure', function wphConfigure(data) {
  18977. setVerbosityLevel(data.verbosity);
  18978. });
  18979. handler.on('GetDocRequest', function wphSetupDoc(data) {
  18980. return WorkerMessageHandler.createDocumentHandler(data, port);
  18981. });
  18982. },
  18983. createDocumentHandler: function wphCreateDocumentHandler(docParams, port) {
  18984. var pdfManager;
  18985. var terminated = false;
  18986. var cancelXHRs = null;
  18987. var WorkerTasks = [];
  18988. var docId = docParams.docId;
  18989. var docBaseUrl = docParams.docBaseUrl;
  18990. var workerHandlerName = docParams.docId + '_worker';
  18991. var handler = new MessageHandler(workerHandlerName, docId, port);
  18992. handler.postMessageTransfers = docParams.postMessageTransfers;
  18993. function ensureNotTerminated() {
  18994. if (terminated) {
  18995. throw new Error('Worker was terminated');
  18996. }
  18997. }
  18998. function startWorkerTask(task) {
  18999. WorkerTasks.push(task);
  19000. }
  19001. function finishWorkerTask(task) {
  19002. task.finish();
  19003. var i = WorkerTasks.indexOf(task);
  19004. WorkerTasks.splice(i, 1);
  19005. }
  19006. function loadDocument(recoveryMode) {
  19007. var loadDocumentCapability = createPromiseCapability();
  19008. var parseSuccess = function parseSuccess() {
  19009. var numPagesPromise = pdfManager.ensureDoc('numPages');
  19010. var fingerprintPromise = pdfManager.ensureDoc('fingerprint');
  19011. var encryptedPromise = pdfManager.ensureXRef('encrypt');
  19012. Promise.all([
  19013. numPagesPromise,
  19014. fingerprintPromise,
  19015. encryptedPromise
  19016. ]).then(function onDocReady(results) {
  19017. var doc = {
  19018. numPages: results[0],
  19019. fingerprint: results[1],
  19020. encrypted: !!results[2]
  19021. };
  19022. loadDocumentCapability.resolve(doc);
  19023. }, parseFailure);
  19024. };
  19025. var parseFailure = function parseFailure(e) {
  19026. loadDocumentCapability.reject(e);
  19027. };
  19028. pdfManager.ensureDoc('checkHeader', []).then(function () {
  19029. pdfManager.ensureDoc('parseStartXRef', []).then(function () {
  19030. pdfManager.ensureDoc('parse', [recoveryMode]).then(parseSuccess, parseFailure);
  19031. }, parseFailure);
  19032. }, parseFailure);
  19033. return loadDocumentCapability.promise;
  19034. }
  19035. function getPdfManager(data, evaluatorOptions) {
  19036. var pdfManagerCapability = createPromiseCapability();
  19037. var pdfManager;
  19038. var source = data.source;
  19039. if (source.data) {
  19040. try {
  19041. pdfManager = new LocalPdfManager(docId, source.data, source.password, evaluatorOptions, docBaseUrl);
  19042. pdfManagerCapability.resolve(pdfManager);
  19043. } catch (ex) {
  19044. pdfManagerCapability.reject(ex);
  19045. }
  19046. return pdfManagerCapability.promise;
  19047. }
  19048. var pdfStream;
  19049. try {
  19050. if (source.chunkedViewerLoading) {
  19051. pdfStream = new PDFWorkerStream(source, handler);
  19052. } else {
  19053. assert(PDFNetworkStream, 'pdfjs/core/network module is not loaded');
  19054. pdfStream = new PDFNetworkStream(data);
  19055. }
  19056. } catch (ex) {
  19057. pdfManagerCapability.reject(ex);
  19058. return pdfManagerCapability.promise;
  19059. }
  19060. var fullRequest = pdfStream.getFullReader();
  19061. fullRequest.headersReady.then(function () {
  19062. if (!fullRequest.isStreamingSupported || !fullRequest.isRangeSupported) {
  19063. fullRequest.onProgress = function (evt) {
  19064. handler.send('DocProgress', {
  19065. loaded: evt.loaded,
  19066. total: evt.total
  19067. });
  19068. };
  19069. }
  19070. if (!fullRequest.isRangeSupported) {
  19071. return;
  19072. }
  19073. var disableAutoFetch = source.disableAutoFetch || fullRequest.isStreamingSupported;
  19074. pdfManager = new NetworkPdfManager(docId, pdfStream, {
  19075. msgHandler: handler,
  19076. url: source.url,
  19077. password: source.password,
  19078. length: fullRequest.contentLength,
  19079. disableAutoFetch: disableAutoFetch,
  19080. rangeChunkSize: source.rangeChunkSize
  19081. }, evaluatorOptions, docBaseUrl);
  19082. pdfManagerCapability.resolve(pdfManager);
  19083. cancelXHRs = null;
  19084. }).catch(function (reason) {
  19085. pdfManagerCapability.reject(reason);
  19086. cancelXHRs = null;
  19087. });
  19088. var cachedChunks = [], loaded = 0;
  19089. var flushChunks = function () {
  19090. var pdfFile = arraysToBytes(cachedChunks);
  19091. if (source.length && pdfFile.length !== source.length) {
  19092. warn('reported HTTP length is different from actual');
  19093. }
  19094. try {
  19095. pdfManager = new LocalPdfManager(docId, pdfFile, source.password, evaluatorOptions, docBaseUrl);
  19096. pdfManagerCapability.resolve(pdfManager);
  19097. } catch (ex) {
  19098. pdfManagerCapability.reject(ex);
  19099. }
  19100. cachedChunks = [];
  19101. };
  19102. var readPromise = new Promise(function (resolve, reject) {
  19103. var readChunk = function (chunk) {
  19104. try {
  19105. ensureNotTerminated();
  19106. if (chunk.done) {
  19107. if (!pdfManager) {
  19108. flushChunks();
  19109. }
  19110. cancelXHRs = null;
  19111. return;
  19112. }
  19113. var data = chunk.value;
  19114. loaded += arrayByteLength(data);
  19115. if (!fullRequest.isStreamingSupported) {
  19116. handler.send('DocProgress', {
  19117. loaded: loaded,
  19118. total: Math.max(loaded, fullRequest.contentLength || 0)
  19119. });
  19120. }
  19121. if (pdfManager) {
  19122. pdfManager.sendProgressiveData(data);
  19123. } else {
  19124. cachedChunks.push(data);
  19125. }
  19126. fullRequest.read().then(readChunk, reject);
  19127. } catch (e) {
  19128. reject(e);
  19129. }
  19130. };
  19131. fullRequest.read().then(readChunk, reject);
  19132. });
  19133. readPromise.catch(function (e) {
  19134. pdfManagerCapability.reject(e);
  19135. cancelXHRs = null;
  19136. });
  19137. cancelXHRs = function () {
  19138. pdfStream.cancelAllRequests('abort');
  19139. };
  19140. return pdfManagerCapability.promise;
  19141. }
  19142. function setupDoc(data) {
  19143. function onSuccess(doc) {
  19144. ensureNotTerminated();
  19145. handler.send('GetDoc', { pdfInfo: doc });
  19146. }
  19147. function onFailure(e) {
  19148. if (e instanceof PasswordException) {
  19149. var task = new WorkerTask('PasswordException: response ' + e.code);
  19150. startWorkerTask(task);
  19151. handler.sendWithPromise('PasswordRequest', e).then(function (data) {
  19152. finishWorkerTask(task);
  19153. pdfManager.updatePassword(data.password);
  19154. pdfManagerReady();
  19155. }).catch(function (ex) {
  19156. finishWorkerTask(task);
  19157. handler.send('PasswordException', ex);
  19158. }.bind(null, e));
  19159. } else if (e instanceof InvalidPDFException) {
  19160. handler.send('InvalidPDF', e);
  19161. } else if (e instanceof MissingPDFException) {
  19162. handler.send('MissingPDF', e);
  19163. } else if (e instanceof UnexpectedResponseException) {
  19164. handler.send('UnexpectedResponse', e);
  19165. } else {
  19166. handler.send('UnknownError', new UnknownErrorException(e.message, e.toString()));
  19167. }
  19168. }
  19169. function pdfManagerReady() {
  19170. ensureNotTerminated();
  19171. loadDocument(false).then(onSuccess, function loadFailure(ex) {
  19172. ensureNotTerminated();
  19173. if (!(ex instanceof XRefParseException)) {
  19174. onFailure(ex);
  19175. return;
  19176. }
  19177. pdfManager.requestLoadedStream();
  19178. pdfManager.onLoadedStream().then(function () {
  19179. ensureNotTerminated();
  19180. loadDocument(true).then(onSuccess, onFailure);
  19181. });
  19182. }, onFailure);
  19183. }
  19184. ensureNotTerminated();
  19185. var evaluatorOptions = {
  19186. forceDataSchema: data.disableCreateObjectURL,
  19187. maxImageSize: data.maxImageSize === undefined ? -1 : data.maxImageSize,
  19188. disableFontFace: data.disableFontFace,
  19189. disableNativeImageDecoder: data.disableNativeImageDecoder
  19190. };
  19191. getPdfManager(data, evaluatorOptions).then(function (newPdfManager) {
  19192. if (terminated) {
  19193. newPdfManager.terminate();
  19194. throw new Error('Worker was terminated');
  19195. }
  19196. pdfManager = newPdfManager;
  19197. handler.send('PDFManagerReady', null);
  19198. pdfManager.onLoadedStream().then(function (stream) {
  19199. handler.send('DataLoaded', { length: stream.bytes.byteLength });
  19200. });
  19201. }).then(pdfManagerReady, onFailure);
  19202. }
  19203. handler.on('GetPage', function wphSetupGetPage(data) {
  19204. return pdfManager.getPage(data.pageIndex).then(function (page) {
  19205. var rotatePromise = pdfManager.ensure(page, 'rotate');
  19206. var refPromise = pdfManager.ensure(page, 'ref');
  19207. var userUnitPromise = pdfManager.ensure(page, 'userUnit');
  19208. var viewPromise = pdfManager.ensure(page, 'view');
  19209. return Promise.all([
  19210. rotatePromise,
  19211. refPromise,
  19212. userUnitPromise,
  19213. viewPromise
  19214. ]).then(function (results) {
  19215. return {
  19216. rotate: results[0],
  19217. ref: results[1],
  19218. userUnit: results[2],
  19219. view: results[3]
  19220. };
  19221. });
  19222. });
  19223. });
  19224. handler.on('GetPageIndex', function wphSetupGetPageIndex(data) {
  19225. var ref = new Ref(data.ref.num, data.ref.gen);
  19226. var catalog = pdfManager.pdfDocument.catalog;
  19227. return catalog.getPageIndex(ref);
  19228. });
  19229. handler.on('GetDestinations', function wphSetupGetDestinations(data) {
  19230. return pdfManager.ensureCatalog('destinations');
  19231. });
  19232. handler.on('GetDestination', function wphSetupGetDestination(data) {
  19233. return pdfManager.ensureCatalog('getDestination', [data.id]);
  19234. });
  19235. handler.on('GetPageLabels', function wphSetupGetPageLabels(data) {
  19236. return pdfManager.ensureCatalog('pageLabels');
  19237. });
  19238. handler.on('GetAttachments', function wphSetupGetAttachments(data) {
  19239. return pdfManager.ensureCatalog('attachments');
  19240. });
  19241. handler.on('GetJavaScript', function wphSetupGetJavaScript(data) {
  19242. return pdfManager.ensureCatalog('javaScript');
  19243. });
  19244. handler.on('GetOutline', function wphSetupGetOutline(data) {
  19245. return pdfManager.ensureCatalog('documentOutline');
  19246. });
  19247. handler.on('GetMetadata', function wphSetupGetMetadata(data) {
  19248. return Promise.all([
  19249. pdfManager.ensureDoc('documentInfo'),
  19250. pdfManager.ensureCatalog('metadata')
  19251. ]);
  19252. });
  19253. handler.on('GetData', function wphSetupGetData(data) {
  19254. pdfManager.requestLoadedStream();
  19255. return pdfManager.onLoadedStream().then(function (stream) {
  19256. return stream.bytes;
  19257. });
  19258. });
  19259. handler.on('GetStats', function wphSetupGetStats(data) {
  19260. return pdfManager.pdfDocument.xref.stats;
  19261. });
  19262. handler.on('GetAnnotations', function wphSetupGetAnnotations(data) {
  19263. return pdfManager.getPage(data.pageIndex).then(function (page) {
  19264. return pdfManager.ensure(page, 'getAnnotationsData', [data.intent]);
  19265. });
  19266. });
  19267. handler.on('RenderPageRequest', function wphSetupRenderPage(data) {
  19268. var pageIndex = data.pageIndex;
  19269. pdfManager.getPage(pageIndex).then(function (page) {
  19270. var task = new WorkerTask('RenderPageRequest: page ' + pageIndex);
  19271. startWorkerTask(task);
  19272. var pageNum = pageIndex + 1;
  19273. var start = Date.now();
  19274. page.getOperatorList(handler, task, data.intent, data.renderInteractiveForms).then(function (operatorList) {
  19275. finishWorkerTask(task);
  19276. info('page=' + pageNum + ' - getOperatorList: time=' + (Date.now() - start) + 'ms, len=' + operatorList.totalLength);
  19277. }, function (e) {
  19278. finishWorkerTask(task);
  19279. if (task.terminated) {
  19280. return;
  19281. }
  19282. handler.send('UnsupportedFeature', { featureId: UNSUPPORTED_FEATURES.unknown });
  19283. var minimumStackMessage = 'worker.js: while trying to getPage() and getOperatorList()';
  19284. var wrappedException;
  19285. if (typeof e === 'string') {
  19286. wrappedException = {
  19287. message: e,
  19288. stack: minimumStackMessage
  19289. };
  19290. } else if (typeof e === 'object') {
  19291. wrappedException = {
  19292. message: e.message || e.toString(),
  19293. stack: e.stack || minimumStackMessage
  19294. };
  19295. } else {
  19296. wrappedException = {
  19297. message: 'Unknown exception type: ' + typeof e,
  19298. stack: minimumStackMessage
  19299. };
  19300. }
  19301. handler.send('PageError', {
  19302. pageNum: pageNum,
  19303. error: wrappedException,
  19304. intent: data.intent
  19305. });
  19306. });
  19307. });
  19308. }, this);
  19309. handler.on('GetTextContent', function wphExtractText(data) {
  19310. var pageIndex = data.pageIndex;
  19311. var normalizeWhitespace = data.normalizeWhitespace;
  19312. var combineTextItems = data.combineTextItems;
  19313. return pdfManager.getPage(pageIndex).then(function (page) {
  19314. var task = new WorkerTask('GetTextContent: page ' + pageIndex);
  19315. startWorkerTask(task);
  19316. var pageNum = pageIndex + 1;
  19317. var start = Date.now();
  19318. return page.extractTextContent(task, normalizeWhitespace, combineTextItems).then(function (textContent) {
  19319. finishWorkerTask(task);
  19320. info('text indexing: page=' + pageNum + ' - time=' + (Date.now() - start) + 'ms');
  19321. return textContent;
  19322. }, function (reason) {
  19323. finishWorkerTask(task);
  19324. if (task.terminated) {
  19325. return;
  19326. }
  19327. throw reason;
  19328. });
  19329. });
  19330. });
  19331. handler.on('Cleanup', function wphCleanup(data) {
  19332. return pdfManager.cleanup();
  19333. });
  19334. handler.on('Terminate', function wphTerminate(data) {
  19335. terminated = true;
  19336. if (pdfManager) {
  19337. pdfManager.terminate();
  19338. pdfManager = null;
  19339. }
  19340. if (cancelXHRs) {
  19341. cancelXHRs();
  19342. }
  19343. var waitOn = [];
  19344. WorkerTasks.forEach(function (task) {
  19345. waitOn.push(task.finished);
  19346. task.terminate();
  19347. });
  19348. return Promise.all(waitOn).then(function () {
  19349. handler.destroy();
  19350. handler = null;
  19351. });
  19352. });
  19353. handler.on('Ready', function wphReady(data) {
  19354. setupDoc(docParams);
  19355. docParams = null;
  19356. });
  19357. return workerHandlerName;
  19358. }
  19359. };
  19360. function initializeWorker() {
  19361. if (!('console' in globalScope)) {
  19362. var consoleTimer = {};
  19363. var workerConsole = {
  19364. log: function log() {
  19365. var args = Array.prototype.slice.call(arguments);
  19366. globalScope.postMessage({
  19367. targetName: 'main',
  19368. action: 'console_log',
  19369. data: args
  19370. });
  19371. },
  19372. error: function error() {
  19373. var args = Array.prototype.slice.call(arguments);
  19374. globalScope.postMessage({
  19375. targetName: 'main',
  19376. action: 'console_error',
  19377. data: args
  19378. });
  19379. throw 'pdf.js execution error';
  19380. },
  19381. time: function time(name) {
  19382. consoleTimer[name] = Date.now();
  19383. },
  19384. timeEnd: function timeEnd(name) {
  19385. var time = consoleTimer[name];
  19386. if (!time) {
  19387. error('Unknown timer name ' + name);
  19388. }
  19389. this.log('Timer:', name, Date.now() - time);
  19390. }
  19391. };
  19392. globalScope.console = workerConsole;
  19393. }
  19394. var handler = new MessageHandler('worker', 'main', self);
  19395. WorkerMessageHandler.setup(handler, self);
  19396. handler.send('ready', null);
  19397. }
  19398. if (typeof window === 'undefined' && !isNodeJS()) {
  19399. initializeWorker();
  19400. }
  19401. exports.setPDFNetworkStreamClass = setPDFNetworkStreamClass;
  19402. exports.WorkerTask = WorkerTask;
  19403. exports.WorkerMessageHandler = WorkerMessageHandler;
  19404. /***/ }),
  19405. /* 9 */
  19406. /***/ (function(module, exports, __w_pdfjs_require__) {
  19407. "use strict";
  19408. var ArithmeticDecoder = function ArithmeticDecoderClosure() {
  19409. var QeTable = [
  19410. {
  19411. qe: 0x5601,
  19412. nmps: 1,
  19413. nlps: 1,
  19414. switchFlag: 1
  19415. },
  19416. {
  19417. qe: 0x3401,
  19418. nmps: 2,
  19419. nlps: 6,
  19420. switchFlag: 0
  19421. },
  19422. {
  19423. qe: 0x1801,
  19424. nmps: 3,
  19425. nlps: 9,
  19426. switchFlag: 0
  19427. },
  19428. {
  19429. qe: 0x0AC1,
  19430. nmps: 4,
  19431. nlps: 12,
  19432. switchFlag: 0
  19433. },
  19434. {
  19435. qe: 0x0521,
  19436. nmps: 5,
  19437. nlps: 29,
  19438. switchFlag: 0
  19439. },
  19440. {
  19441. qe: 0x0221,
  19442. nmps: 38,
  19443. nlps: 33,
  19444. switchFlag: 0
  19445. },
  19446. {
  19447. qe: 0x5601,
  19448. nmps: 7,
  19449. nlps: 6,
  19450. switchFlag: 1
  19451. },
  19452. {
  19453. qe: 0x5401,
  19454. nmps: 8,
  19455. nlps: 14,
  19456. switchFlag: 0
  19457. },
  19458. {
  19459. qe: 0x4801,
  19460. nmps: 9,
  19461. nlps: 14,
  19462. switchFlag: 0
  19463. },
  19464. {
  19465. qe: 0x3801,
  19466. nmps: 10,
  19467. nlps: 14,
  19468. switchFlag: 0
  19469. },
  19470. {
  19471. qe: 0x3001,
  19472. nmps: 11,
  19473. nlps: 17,
  19474. switchFlag: 0
  19475. },
  19476. {
  19477. qe: 0x2401,
  19478. nmps: 12,
  19479. nlps: 18,
  19480. switchFlag: 0
  19481. },
  19482. {
  19483. qe: 0x1C01,
  19484. nmps: 13,
  19485. nlps: 20,
  19486. switchFlag: 0
  19487. },
  19488. {
  19489. qe: 0x1601,
  19490. nmps: 29,
  19491. nlps: 21,
  19492. switchFlag: 0
  19493. },
  19494. {
  19495. qe: 0x5601,
  19496. nmps: 15,
  19497. nlps: 14,
  19498. switchFlag: 1
  19499. },
  19500. {
  19501. qe: 0x5401,
  19502. nmps: 16,
  19503. nlps: 14,
  19504. switchFlag: 0
  19505. },
  19506. {
  19507. qe: 0x5101,
  19508. nmps: 17,
  19509. nlps: 15,
  19510. switchFlag: 0
  19511. },
  19512. {
  19513. qe: 0x4801,
  19514. nmps: 18,
  19515. nlps: 16,
  19516. switchFlag: 0
  19517. },
  19518. {
  19519. qe: 0x3801,
  19520. nmps: 19,
  19521. nlps: 17,
  19522. switchFlag: 0
  19523. },
  19524. {
  19525. qe: 0x3401,
  19526. nmps: 20,
  19527. nlps: 18,
  19528. switchFlag: 0
  19529. },
  19530. {
  19531. qe: 0x3001,
  19532. nmps: 21,
  19533. nlps: 19,
  19534. switchFlag: 0
  19535. },
  19536. {
  19537. qe: 0x2801,
  19538. nmps: 22,
  19539. nlps: 19,
  19540. switchFlag: 0
  19541. },
  19542. {
  19543. qe: 0x2401,
  19544. nmps: 23,
  19545. nlps: 20,
  19546. switchFlag: 0
  19547. },
  19548. {
  19549. qe: 0x2201,
  19550. nmps: 24,
  19551. nlps: 21,
  19552. switchFlag: 0
  19553. },
  19554. {
  19555. qe: 0x1C01,
  19556. nmps: 25,
  19557. nlps: 22,
  19558. switchFlag: 0
  19559. },
  19560. {
  19561. qe: 0x1801,
  19562. nmps: 26,
  19563. nlps: 23,
  19564. switchFlag: 0
  19565. },
  19566. {
  19567. qe: 0x1601,
  19568. nmps: 27,
  19569. nlps: 24,
  19570. switchFlag: 0
  19571. },
  19572. {
  19573. qe: 0x1401,
  19574. nmps: 28,
  19575. nlps: 25,
  19576. switchFlag: 0
  19577. },
  19578. {
  19579. qe: 0x1201,
  19580. nmps: 29,
  19581. nlps: 26,
  19582. switchFlag: 0
  19583. },
  19584. {
  19585. qe: 0x1101,
  19586. nmps: 30,
  19587. nlps: 27,
  19588. switchFlag: 0
  19589. },
  19590. {
  19591. qe: 0x0AC1,
  19592. nmps: 31,
  19593. nlps: 28,
  19594. switchFlag: 0
  19595. },
  19596. {
  19597. qe: 0x09C1,
  19598. nmps: 32,
  19599. nlps: 29,
  19600. switchFlag: 0
  19601. },
  19602. {
  19603. qe: 0x08A1,
  19604. nmps: 33,
  19605. nlps: 30,
  19606. switchFlag: 0
  19607. },
  19608. {
  19609. qe: 0x0521,
  19610. nmps: 34,
  19611. nlps: 31,
  19612. switchFlag: 0
  19613. },
  19614. {
  19615. qe: 0x0441,
  19616. nmps: 35,
  19617. nlps: 32,
  19618. switchFlag: 0
  19619. },
  19620. {
  19621. qe: 0x02A1,
  19622. nmps: 36,
  19623. nlps: 33,
  19624. switchFlag: 0
  19625. },
  19626. {
  19627. qe: 0x0221,
  19628. nmps: 37,
  19629. nlps: 34,
  19630. switchFlag: 0
  19631. },
  19632. {
  19633. qe: 0x0141,
  19634. nmps: 38,
  19635. nlps: 35,
  19636. switchFlag: 0
  19637. },
  19638. {
  19639. qe: 0x0111,
  19640. nmps: 39,
  19641. nlps: 36,
  19642. switchFlag: 0
  19643. },
  19644. {
  19645. qe: 0x0085,
  19646. nmps: 40,
  19647. nlps: 37,
  19648. switchFlag: 0
  19649. },
  19650. {
  19651. qe: 0x0049,
  19652. nmps: 41,
  19653. nlps: 38,
  19654. switchFlag: 0
  19655. },
  19656. {
  19657. qe: 0x0025,
  19658. nmps: 42,
  19659. nlps: 39,
  19660. switchFlag: 0
  19661. },
  19662. {
  19663. qe: 0x0015,
  19664. nmps: 43,
  19665. nlps: 40,
  19666. switchFlag: 0
  19667. },
  19668. {
  19669. qe: 0x0009,
  19670. nmps: 44,
  19671. nlps: 41,
  19672. switchFlag: 0
  19673. },
  19674. {
  19675. qe: 0x0005,
  19676. nmps: 45,
  19677. nlps: 42,
  19678. switchFlag: 0
  19679. },
  19680. {
  19681. qe: 0x0001,
  19682. nmps: 45,
  19683. nlps: 43,
  19684. switchFlag: 0
  19685. },
  19686. {
  19687. qe: 0x5601,
  19688. nmps: 46,
  19689. nlps: 46,
  19690. switchFlag: 0
  19691. }
  19692. ];
  19693. function ArithmeticDecoder(data, start, end) {
  19694. this.data = data;
  19695. this.bp = start;
  19696. this.dataEnd = end;
  19697. this.chigh = data[start];
  19698. this.clow = 0;
  19699. this.byteIn();
  19700. this.chigh = this.chigh << 7 & 0xFFFF | this.clow >> 9 & 0x7F;
  19701. this.clow = this.clow << 7 & 0xFFFF;
  19702. this.ct -= 7;
  19703. this.a = 0x8000;
  19704. }
  19705. ArithmeticDecoder.prototype = {
  19706. byteIn: function ArithmeticDecoder_byteIn() {
  19707. var data = this.data;
  19708. var bp = this.bp;
  19709. if (data[bp] === 0xFF) {
  19710. var b1 = data[bp + 1];
  19711. if (b1 > 0x8F) {
  19712. this.clow += 0xFF00;
  19713. this.ct = 8;
  19714. } else {
  19715. bp++;
  19716. this.clow += data[bp] << 9;
  19717. this.ct = 7;
  19718. this.bp = bp;
  19719. }
  19720. } else {
  19721. bp++;
  19722. this.clow += bp < this.dataEnd ? data[bp] << 8 : 0xFF00;
  19723. this.ct = 8;
  19724. this.bp = bp;
  19725. }
  19726. if (this.clow > 0xFFFF) {
  19727. this.chigh += this.clow >> 16;
  19728. this.clow &= 0xFFFF;
  19729. }
  19730. },
  19731. readBit: function ArithmeticDecoder_readBit(contexts, pos) {
  19732. var cx_index = contexts[pos] >> 1, cx_mps = contexts[pos] & 1;
  19733. var qeTableIcx = QeTable[cx_index];
  19734. var qeIcx = qeTableIcx.qe;
  19735. var d;
  19736. var a = this.a - qeIcx;
  19737. if (this.chigh < qeIcx) {
  19738. if (a < qeIcx) {
  19739. a = qeIcx;
  19740. d = cx_mps;
  19741. cx_index = qeTableIcx.nmps;
  19742. } else {
  19743. a = qeIcx;
  19744. d = 1 ^ cx_mps;
  19745. if (qeTableIcx.switchFlag === 1) {
  19746. cx_mps = d;
  19747. }
  19748. cx_index = qeTableIcx.nlps;
  19749. }
  19750. } else {
  19751. this.chigh -= qeIcx;
  19752. if ((a & 0x8000) !== 0) {
  19753. this.a = a;
  19754. return cx_mps;
  19755. }
  19756. if (a < qeIcx) {
  19757. d = 1 ^ cx_mps;
  19758. if (qeTableIcx.switchFlag === 1) {
  19759. cx_mps = d;
  19760. }
  19761. cx_index = qeTableIcx.nlps;
  19762. } else {
  19763. d = cx_mps;
  19764. cx_index = qeTableIcx.nmps;
  19765. }
  19766. }
  19767. do {
  19768. if (this.ct === 0) {
  19769. this.byteIn();
  19770. }
  19771. a <<= 1;
  19772. this.chigh = this.chigh << 1 & 0xFFFF | this.clow >> 15 & 1;
  19773. this.clow = this.clow << 1 & 0xFFFF;
  19774. this.ct--;
  19775. } while ((a & 0x8000) === 0);
  19776. this.a = a;
  19777. contexts[pos] = cx_index << 1 | cx_mps;
  19778. return d;
  19779. }
  19780. };
  19781. return ArithmeticDecoder;
  19782. }();
  19783. exports.ArithmeticDecoder = ArithmeticDecoder;
  19784. /***/ }),
  19785. /* 10 */
  19786. /***/ (function(module, exports, __w_pdfjs_require__) {
  19787. "use strict";
  19788. var sharedUtil = __w_pdfjs_require__(0);
  19789. var coreCharsets = __w_pdfjs_require__(22);
  19790. var coreEncodings = __w_pdfjs_require__(4);
  19791. var error = sharedUtil.error;
  19792. var info = sharedUtil.info;
  19793. var bytesToString = sharedUtil.bytesToString;
  19794. var warn = sharedUtil.warn;
  19795. var isArray = sharedUtil.isArray;
  19796. var Util = sharedUtil.Util;
  19797. var stringToBytes = sharedUtil.stringToBytes;
  19798. var assert = sharedUtil.assert;
  19799. var ISOAdobeCharset = coreCharsets.ISOAdobeCharset;
  19800. var ExpertCharset = coreCharsets.ExpertCharset;
  19801. var ExpertSubsetCharset = coreCharsets.ExpertSubsetCharset;
  19802. var StandardEncoding = coreEncodings.StandardEncoding;
  19803. var ExpertEncoding = coreEncodings.ExpertEncoding;
  19804. var MAX_SUBR_NESTING = 10;
  19805. var CFFStandardStrings = [
  19806. '.notdef',
  19807. 'space',
  19808. 'exclam',
  19809. 'quotedbl',
  19810. 'numbersign',
  19811. 'dollar',
  19812. 'percent',
  19813. 'ampersand',
  19814. 'quoteright',
  19815. 'parenleft',
  19816. 'parenright',
  19817. 'asterisk',
  19818. 'plus',
  19819. 'comma',
  19820. 'hyphen',
  19821. 'period',
  19822. 'slash',
  19823. 'zero',
  19824. 'one',
  19825. 'two',
  19826. 'three',
  19827. 'four',
  19828. 'five',
  19829. 'six',
  19830. 'seven',
  19831. 'eight',
  19832. 'nine',
  19833. 'colon',
  19834. 'semicolon',
  19835. 'less',
  19836. 'equal',
  19837. 'greater',
  19838. 'question',
  19839. 'at',
  19840. 'A',
  19841. 'B',
  19842. 'C',
  19843. 'D',
  19844. 'E',
  19845. 'F',
  19846. 'G',
  19847. 'H',
  19848. 'I',
  19849. 'J',
  19850. 'K',
  19851. 'L',
  19852. 'M',
  19853. 'N',
  19854. 'O',
  19855. 'P',
  19856. 'Q',
  19857. 'R',
  19858. 'S',
  19859. 'T',
  19860. 'U',
  19861. 'V',
  19862. 'W',
  19863. 'X',
  19864. 'Y',
  19865. 'Z',
  19866. 'bracketleft',
  19867. 'backslash',
  19868. 'bracketright',
  19869. 'asciicircum',
  19870. 'underscore',
  19871. 'quoteleft',
  19872. 'a',
  19873. 'b',
  19874. 'c',
  19875. 'd',
  19876. 'e',
  19877. 'f',
  19878. 'g',
  19879. 'h',
  19880. 'i',
  19881. 'j',
  19882. 'k',
  19883. 'l',
  19884. 'm',
  19885. 'n',
  19886. 'o',
  19887. 'p',
  19888. 'q',
  19889. 'r',
  19890. 's',
  19891. 't',
  19892. 'u',
  19893. 'v',
  19894. 'w',
  19895. 'x',
  19896. 'y',
  19897. 'z',
  19898. 'braceleft',
  19899. 'bar',
  19900. 'braceright',
  19901. 'asciitilde',
  19902. 'exclamdown',
  19903. 'cent',
  19904. 'sterling',
  19905. 'fraction',
  19906. 'yen',
  19907. 'florin',
  19908. 'section',
  19909. 'currency',
  19910. 'quotesingle',
  19911. 'quotedblleft',
  19912. 'guillemotleft',
  19913. 'guilsinglleft',
  19914. 'guilsinglright',
  19915. 'fi',
  19916. 'fl',
  19917. 'endash',
  19918. 'dagger',
  19919. 'daggerdbl',
  19920. 'periodcentered',
  19921. 'paragraph',
  19922. 'bullet',
  19923. 'quotesinglbase',
  19924. 'quotedblbase',
  19925. 'quotedblright',
  19926. 'guillemotright',
  19927. 'ellipsis',
  19928. 'perthousand',
  19929. 'questiondown',
  19930. 'grave',
  19931. 'acute',
  19932. 'circumflex',
  19933. 'tilde',
  19934. 'macron',
  19935. 'breve',
  19936. 'dotaccent',
  19937. 'dieresis',
  19938. 'ring',
  19939. 'cedilla',
  19940. 'hungarumlaut',
  19941. 'ogonek',
  19942. 'caron',
  19943. 'emdash',
  19944. 'AE',
  19945. 'ordfeminine',
  19946. 'Lslash',
  19947. 'Oslash',
  19948. 'OE',
  19949. 'ordmasculine',
  19950. 'ae',
  19951. 'dotlessi',
  19952. 'lslash',
  19953. 'oslash',
  19954. 'oe',
  19955. 'germandbls',
  19956. 'onesuperior',
  19957. 'logicalnot',
  19958. 'mu',
  19959. 'trademark',
  19960. 'Eth',
  19961. 'onehalf',
  19962. 'plusminus',
  19963. 'Thorn',
  19964. 'onequarter',
  19965. 'divide',
  19966. 'brokenbar',
  19967. 'degree',
  19968. 'thorn',
  19969. 'threequarters',
  19970. 'twosuperior',
  19971. 'registered',
  19972. 'minus',
  19973. 'eth',
  19974. 'multiply',
  19975. 'threesuperior',
  19976. 'copyright',
  19977. 'Aacute',
  19978. 'Acircumflex',
  19979. 'Adieresis',
  19980. 'Agrave',
  19981. 'Aring',
  19982. 'Atilde',
  19983. 'Ccedilla',
  19984. 'Eacute',
  19985. 'Ecircumflex',
  19986. 'Edieresis',
  19987. 'Egrave',
  19988. 'Iacute',
  19989. 'Icircumflex',
  19990. 'Idieresis',
  19991. 'Igrave',
  19992. 'Ntilde',
  19993. 'Oacute',
  19994. 'Ocircumflex',
  19995. 'Odieresis',
  19996. 'Ograve',
  19997. 'Otilde',
  19998. 'Scaron',
  19999. 'Uacute',
  20000. 'Ucircumflex',
  20001. 'Udieresis',
  20002. 'Ugrave',
  20003. 'Yacute',
  20004. 'Ydieresis',
  20005. 'Zcaron',
  20006. 'aacute',
  20007. 'acircumflex',
  20008. 'adieresis',
  20009. 'agrave',
  20010. 'aring',
  20011. 'atilde',
  20012. 'ccedilla',
  20013. 'eacute',
  20014. 'ecircumflex',
  20015. 'edieresis',
  20016. 'egrave',
  20017. 'iacute',
  20018. 'icircumflex',
  20019. 'idieresis',
  20020. 'igrave',
  20021. 'ntilde',
  20022. 'oacute',
  20023. 'ocircumflex',
  20024. 'odieresis',
  20025. 'ograve',
  20026. 'otilde',
  20027. 'scaron',
  20028. 'uacute',
  20029. 'ucircumflex',
  20030. 'udieresis',
  20031. 'ugrave',
  20032. 'yacute',
  20033. 'ydieresis',
  20034. 'zcaron',
  20035. 'exclamsmall',
  20036. 'Hungarumlautsmall',
  20037. 'dollaroldstyle',
  20038. 'dollarsuperior',
  20039. 'ampersandsmall',
  20040. 'Acutesmall',
  20041. 'parenleftsuperior',
  20042. 'parenrightsuperior',
  20043. 'twodotenleader',
  20044. 'onedotenleader',
  20045. 'zerooldstyle',
  20046. 'oneoldstyle',
  20047. 'twooldstyle',
  20048. 'threeoldstyle',
  20049. 'fouroldstyle',
  20050. 'fiveoldstyle',
  20051. 'sixoldstyle',
  20052. 'sevenoldstyle',
  20053. 'eightoldstyle',
  20054. 'nineoldstyle',
  20055. 'commasuperior',
  20056. 'threequartersemdash',
  20057. 'periodsuperior',
  20058. 'questionsmall',
  20059. 'asuperior',
  20060. 'bsuperior',
  20061. 'centsuperior',
  20062. 'dsuperior',
  20063. 'esuperior',
  20064. 'isuperior',
  20065. 'lsuperior',
  20066. 'msuperior',
  20067. 'nsuperior',
  20068. 'osuperior',
  20069. 'rsuperior',
  20070. 'ssuperior',
  20071. 'tsuperior',
  20072. 'ff',
  20073. 'ffi',
  20074. 'ffl',
  20075. 'parenleftinferior',
  20076. 'parenrightinferior',
  20077. 'Circumflexsmall',
  20078. 'hyphensuperior',
  20079. 'Gravesmall',
  20080. 'Asmall',
  20081. 'Bsmall',
  20082. 'Csmall',
  20083. 'Dsmall',
  20084. 'Esmall',
  20085. 'Fsmall',
  20086. 'Gsmall',
  20087. 'Hsmall',
  20088. 'Ismall',
  20089. 'Jsmall',
  20090. 'Ksmall',
  20091. 'Lsmall',
  20092. 'Msmall',
  20093. 'Nsmall',
  20094. 'Osmall',
  20095. 'Psmall',
  20096. 'Qsmall',
  20097. 'Rsmall',
  20098. 'Ssmall',
  20099. 'Tsmall',
  20100. 'Usmall',
  20101. 'Vsmall',
  20102. 'Wsmall',
  20103. 'Xsmall',
  20104. 'Ysmall',
  20105. 'Zsmall',
  20106. 'colonmonetary',
  20107. 'onefitted',
  20108. 'rupiah',
  20109. 'Tildesmall',
  20110. 'exclamdownsmall',
  20111. 'centoldstyle',
  20112. 'Lslashsmall',
  20113. 'Scaronsmall',
  20114. 'Zcaronsmall',
  20115. 'Dieresissmall',
  20116. 'Brevesmall',
  20117. 'Caronsmall',
  20118. 'Dotaccentsmall',
  20119. 'Macronsmall',
  20120. 'figuredash',
  20121. 'hypheninferior',
  20122. 'Ogoneksmall',
  20123. 'Ringsmall',
  20124. 'Cedillasmall',
  20125. 'questiondownsmall',
  20126. 'oneeighth',
  20127. 'threeeighths',
  20128. 'fiveeighths',
  20129. 'seveneighths',
  20130. 'onethird',
  20131. 'twothirds',
  20132. 'zerosuperior',
  20133. 'foursuperior',
  20134. 'fivesuperior',
  20135. 'sixsuperior',
  20136. 'sevensuperior',
  20137. 'eightsuperior',
  20138. 'ninesuperior',
  20139. 'zeroinferior',
  20140. 'oneinferior',
  20141. 'twoinferior',
  20142. 'threeinferior',
  20143. 'fourinferior',
  20144. 'fiveinferior',
  20145. 'sixinferior',
  20146. 'seveninferior',
  20147. 'eightinferior',
  20148. 'nineinferior',
  20149. 'centinferior',
  20150. 'dollarinferior',
  20151. 'periodinferior',
  20152. 'commainferior',
  20153. 'Agravesmall',
  20154. 'Aacutesmall',
  20155. 'Acircumflexsmall',
  20156. 'Atildesmall',
  20157. 'Adieresissmall',
  20158. 'Aringsmall',
  20159. 'AEsmall',
  20160. 'Ccedillasmall',
  20161. 'Egravesmall',
  20162. 'Eacutesmall',
  20163. 'Ecircumflexsmall',
  20164. 'Edieresissmall',
  20165. 'Igravesmall',
  20166. 'Iacutesmall',
  20167. 'Icircumflexsmall',
  20168. 'Idieresissmall',
  20169. 'Ethsmall',
  20170. 'Ntildesmall',
  20171. 'Ogravesmall',
  20172. 'Oacutesmall',
  20173. 'Ocircumflexsmall',
  20174. 'Otildesmall',
  20175. 'Odieresissmall',
  20176. 'OEsmall',
  20177. 'Oslashsmall',
  20178. 'Ugravesmall',
  20179. 'Uacutesmall',
  20180. 'Ucircumflexsmall',
  20181. 'Udieresissmall',
  20182. 'Yacutesmall',
  20183. 'Thornsmall',
  20184. 'Ydieresissmall',
  20185. '001.000',
  20186. '001.001',
  20187. '001.002',
  20188. '001.003',
  20189. 'Black',
  20190. 'Bold',
  20191. 'Book',
  20192. 'Light',
  20193. 'Medium',
  20194. 'Regular',
  20195. 'Roman',
  20196. 'Semibold'
  20197. ];
  20198. var CFFParser = function CFFParserClosure() {
  20199. var CharstringValidationData = [
  20200. null,
  20201. {
  20202. id: 'hstem',
  20203. min: 2,
  20204. stackClearing: true,
  20205. stem: true
  20206. },
  20207. null,
  20208. {
  20209. id: 'vstem',
  20210. min: 2,
  20211. stackClearing: true,
  20212. stem: true
  20213. },
  20214. {
  20215. id: 'vmoveto',
  20216. min: 1,
  20217. stackClearing: true
  20218. },
  20219. {
  20220. id: 'rlineto',
  20221. min: 2,
  20222. resetStack: true
  20223. },
  20224. {
  20225. id: 'hlineto',
  20226. min: 1,
  20227. resetStack: true
  20228. },
  20229. {
  20230. id: 'vlineto',
  20231. min: 1,
  20232. resetStack: true
  20233. },
  20234. {
  20235. id: 'rrcurveto',
  20236. min: 6,
  20237. resetStack: true
  20238. },
  20239. null,
  20240. {
  20241. id: 'callsubr',
  20242. min: 1,
  20243. undefStack: true
  20244. },
  20245. {
  20246. id: 'return',
  20247. min: 0,
  20248. undefStack: true
  20249. },
  20250. null,
  20251. null,
  20252. {
  20253. id: 'endchar',
  20254. min: 0,
  20255. stackClearing: true
  20256. },
  20257. null,
  20258. null,
  20259. null,
  20260. {
  20261. id: 'hstemhm',
  20262. min: 2,
  20263. stackClearing: true,
  20264. stem: true
  20265. },
  20266. {
  20267. id: 'hintmask',
  20268. min: 0,
  20269. stackClearing: true
  20270. },
  20271. {
  20272. id: 'cntrmask',
  20273. min: 0,
  20274. stackClearing: true
  20275. },
  20276. {
  20277. id: 'rmoveto',
  20278. min: 2,
  20279. stackClearing: true
  20280. },
  20281. {
  20282. id: 'hmoveto',
  20283. min: 1,
  20284. stackClearing: true
  20285. },
  20286. {
  20287. id: 'vstemhm',
  20288. min: 2,
  20289. stackClearing: true,
  20290. stem: true
  20291. },
  20292. {
  20293. id: 'rcurveline',
  20294. min: 8,
  20295. resetStack: true
  20296. },
  20297. {
  20298. id: 'rlinecurve',
  20299. min: 8,
  20300. resetStack: true
  20301. },
  20302. {
  20303. id: 'vvcurveto',
  20304. min: 4,
  20305. resetStack: true
  20306. },
  20307. {
  20308. id: 'hhcurveto',
  20309. min: 4,
  20310. resetStack: true
  20311. },
  20312. null,
  20313. {
  20314. id: 'callgsubr',
  20315. min: 1,
  20316. undefStack: true
  20317. },
  20318. {
  20319. id: 'vhcurveto',
  20320. min: 4,
  20321. resetStack: true
  20322. },
  20323. {
  20324. id: 'hvcurveto',
  20325. min: 4,
  20326. resetStack: true
  20327. }
  20328. ];
  20329. var CharstringValidationData12 = [
  20330. null,
  20331. null,
  20332. null,
  20333. {
  20334. id: 'and',
  20335. min: 2,
  20336. stackDelta: -1
  20337. },
  20338. {
  20339. id: 'or',
  20340. min: 2,
  20341. stackDelta: -1
  20342. },
  20343. {
  20344. id: 'not',
  20345. min: 1,
  20346. stackDelta: 0
  20347. },
  20348. null,
  20349. null,
  20350. null,
  20351. {
  20352. id: 'abs',
  20353. min: 1,
  20354. stackDelta: 0
  20355. },
  20356. {
  20357. id: 'add',
  20358. min: 2,
  20359. stackDelta: -1,
  20360. stackFn: function stack_div(stack, index) {
  20361. stack[index - 2] = stack[index - 2] + stack[index - 1];
  20362. }
  20363. },
  20364. {
  20365. id: 'sub',
  20366. min: 2,
  20367. stackDelta: -1,
  20368. stackFn: function stack_div(stack, index) {
  20369. stack[index - 2] = stack[index - 2] - stack[index - 1];
  20370. }
  20371. },
  20372. {
  20373. id: 'div',
  20374. min: 2,
  20375. stackDelta: -1,
  20376. stackFn: function stack_div(stack, index) {
  20377. stack[index - 2] = stack[index - 2] / stack[index - 1];
  20378. }
  20379. },
  20380. null,
  20381. {
  20382. id: 'neg',
  20383. min: 1,
  20384. stackDelta: 0,
  20385. stackFn: function stack_div(stack, index) {
  20386. stack[index - 1] = -stack[index - 1];
  20387. }
  20388. },
  20389. {
  20390. id: 'eq',
  20391. min: 2,
  20392. stackDelta: -1
  20393. },
  20394. null,
  20395. null,
  20396. {
  20397. id: 'drop',
  20398. min: 1,
  20399. stackDelta: -1
  20400. },
  20401. null,
  20402. {
  20403. id: 'put',
  20404. min: 2,
  20405. stackDelta: -2
  20406. },
  20407. {
  20408. id: 'get',
  20409. min: 1,
  20410. stackDelta: 0
  20411. },
  20412. {
  20413. id: 'ifelse',
  20414. min: 4,
  20415. stackDelta: -3
  20416. },
  20417. {
  20418. id: 'random',
  20419. min: 0,
  20420. stackDelta: 1
  20421. },
  20422. {
  20423. id: 'mul',
  20424. min: 2,
  20425. stackDelta: -1,
  20426. stackFn: function stack_div(stack, index) {
  20427. stack[index - 2] = stack[index - 2] * stack[index - 1];
  20428. }
  20429. },
  20430. null,
  20431. {
  20432. id: 'sqrt',
  20433. min: 1,
  20434. stackDelta: 0
  20435. },
  20436. {
  20437. id: 'dup',
  20438. min: 1,
  20439. stackDelta: 1
  20440. },
  20441. {
  20442. id: 'exch',
  20443. min: 2,
  20444. stackDelta: 0
  20445. },
  20446. {
  20447. id: 'index',
  20448. min: 2,
  20449. stackDelta: 0
  20450. },
  20451. {
  20452. id: 'roll',
  20453. min: 3,
  20454. stackDelta: -2
  20455. },
  20456. null,
  20457. null,
  20458. null,
  20459. {
  20460. id: 'hflex',
  20461. min: 7,
  20462. resetStack: true
  20463. },
  20464. {
  20465. id: 'flex',
  20466. min: 13,
  20467. resetStack: true
  20468. },
  20469. {
  20470. id: 'hflex1',
  20471. min: 9,
  20472. resetStack: true
  20473. },
  20474. {
  20475. id: 'flex1',
  20476. min: 11,
  20477. resetStack: true
  20478. }
  20479. ];
  20480. function CFFParser(file, properties, seacAnalysisEnabled) {
  20481. this.bytes = file.getBytes();
  20482. this.properties = properties;
  20483. this.seacAnalysisEnabled = !!seacAnalysisEnabled;
  20484. }
  20485. CFFParser.prototype = {
  20486. parse: function CFFParser_parse() {
  20487. var properties = this.properties;
  20488. var cff = new CFF();
  20489. this.cff = cff;
  20490. var header = this.parseHeader();
  20491. var nameIndex = this.parseIndex(header.endPos);
  20492. var topDictIndex = this.parseIndex(nameIndex.endPos);
  20493. var stringIndex = this.parseIndex(topDictIndex.endPos);
  20494. var globalSubrIndex = this.parseIndex(stringIndex.endPos);
  20495. var topDictParsed = this.parseDict(topDictIndex.obj.get(0));
  20496. var topDict = this.createDict(CFFTopDict, topDictParsed, cff.strings);
  20497. cff.header = header.obj;
  20498. cff.names = this.parseNameIndex(nameIndex.obj);
  20499. cff.strings = this.parseStringIndex(stringIndex.obj);
  20500. cff.topDict = topDict;
  20501. cff.globalSubrIndex = globalSubrIndex.obj;
  20502. this.parsePrivateDict(cff.topDict);
  20503. cff.isCIDFont = topDict.hasName('ROS');
  20504. var charStringOffset = topDict.getByName('CharStrings');
  20505. var charStringIndex = this.parseIndex(charStringOffset).obj;
  20506. var fontMatrix = topDict.getByName('FontMatrix');
  20507. if (fontMatrix) {
  20508. properties.fontMatrix = fontMatrix;
  20509. }
  20510. var fontBBox = topDict.getByName('FontBBox');
  20511. if (fontBBox) {
  20512. properties.ascent = Math.max(fontBBox[3], fontBBox[1]);
  20513. properties.descent = Math.min(fontBBox[1], fontBBox[3]);
  20514. properties.ascentScaled = true;
  20515. }
  20516. var charset, encoding;
  20517. if (cff.isCIDFont) {
  20518. var fdArrayIndex = this.parseIndex(topDict.getByName('FDArray')).obj;
  20519. for (var i = 0, ii = fdArrayIndex.count; i < ii; ++i) {
  20520. var dictRaw = fdArrayIndex.get(i);
  20521. var fontDict = this.createDict(CFFTopDict, this.parseDict(dictRaw), cff.strings);
  20522. this.parsePrivateDict(fontDict);
  20523. cff.fdArray.push(fontDict);
  20524. }
  20525. encoding = null;
  20526. charset = this.parseCharsets(topDict.getByName('charset'), charStringIndex.count, cff.strings, true);
  20527. cff.fdSelect = this.parseFDSelect(topDict.getByName('FDSelect'), charStringIndex.count);
  20528. } else {
  20529. charset = this.parseCharsets(topDict.getByName('charset'), charStringIndex.count, cff.strings, false);
  20530. encoding = this.parseEncoding(topDict.getByName('Encoding'), properties, cff.strings, charset.charset);
  20531. }
  20532. cff.charset = charset;
  20533. cff.encoding = encoding;
  20534. var charStringsAndSeacs = this.parseCharStrings(charStringIndex, topDict.privateDict.subrsIndex, globalSubrIndex.obj, cff.fdSelect, cff.fdArray);
  20535. cff.charStrings = charStringsAndSeacs.charStrings;
  20536. cff.seacs = charStringsAndSeacs.seacs;
  20537. cff.widths = charStringsAndSeacs.widths;
  20538. return cff;
  20539. },
  20540. parseHeader: function CFFParser_parseHeader() {
  20541. var bytes = this.bytes;
  20542. var bytesLength = bytes.length;
  20543. var offset = 0;
  20544. while (offset < bytesLength && bytes[offset] !== 1) {
  20545. ++offset;
  20546. }
  20547. if (offset >= bytesLength) {
  20548. error('Invalid CFF header');
  20549. } else if (offset !== 0) {
  20550. info('cff data is shifted');
  20551. bytes = bytes.subarray(offset);
  20552. this.bytes = bytes;
  20553. }
  20554. var major = bytes[0];
  20555. var minor = bytes[1];
  20556. var hdrSize = bytes[2];
  20557. var offSize = bytes[3];
  20558. var header = new CFFHeader(major, minor, hdrSize, offSize);
  20559. return {
  20560. obj: header,
  20561. endPos: hdrSize
  20562. };
  20563. },
  20564. parseDict: function CFFParser_parseDict(dict) {
  20565. var pos = 0;
  20566. function parseOperand() {
  20567. var value = dict[pos++];
  20568. if (value === 30) {
  20569. return parseFloatOperand();
  20570. } else if (value === 28) {
  20571. value = dict[pos++];
  20572. value = (value << 24 | dict[pos++] << 16) >> 16;
  20573. return value;
  20574. } else if (value === 29) {
  20575. value = dict[pos++];
  20576. value = value << 8 | dict[pos++];
  20577. value = value << 8 | dict[pos++];
  20578. value = value << 8 | dict[pos++];
  20579. return value;
  20580. } else if (value >= 32 && value <= 246) {
  20581. return value - 139;
  20582. } else if (value >= 247 && value <= 250) {
  20583. return (value - 247) * 256 + dict[pos++] + 108;
  20584. } else if (value >= 251 && value <= 254) {
  20585. return -((value - 251) * 256) - dict[pos++] - 108;
  20586. }
  20587. warn('CFFParser_parseDict: "' + value + '" is a reserved command.');
  20588. return NaN;
  20589. }
  20590. function parseFloatOperand() {
  20591. var str = '';
  20592. var eof = 15;
  20593. var lookup = [
  20594. '0',
  20595. '1',
  20596. '2',
  20597. '3',
  20598. '4',
  20599. '5',
  20600. '6',
  20601. '7',
  20602. '8',
  20603. '9',
  20604. '.',
  20605. 'E',
  20606. 'E-',
  20607. null,
  20608. '-'
  20609. ];
  20610. var length = dict.length;
  20611. while (pos < length) {
  20612. var b = dict[pos++];
  20613. var b1 = b >> 4;
  20614. var b2 = b & 15;
  20615. if (b1 === eof) {
  20616. break;
  20617. }
  20618. str += lookup[b1];
  20619. if (b2 === eof) {
  20620. break;
  20621. }
  20622. str += lookup[b2];
  20623. }
  20624. return parseFloat(str);
  20625. }
  20626. var operands = [];
  20627. var entries = [];
  20628. pos = 0;
  20629. var end = dict.length;
  20630. while (pos < end) {
  20631. var b = dict[pos];
  20632. if (b <= 21) {
  20633. if (b === 12) {
  20634. b = b << 8 | dict[++pos];
  20635. }
  20636. entries.push([
  20637. b,
  20638. operands
  20639. ]);
  20640. operands = [];
  20641. ++pos;
  20642. } else {
  20643. operands.push(parseOperand());
  20644. }
  20645. }
  20646. return entries;
  20647. },
  20648. parseIndex: function CFFParser_parseIndex(pos) {
  20649. var cffIndex = new CFFIndex();
  20650. var bytes = this.bytes;
  20651. var count = bytes[pos++] << 8 | bytes[pos++];
  20652. var offsets = [];
  20653. var end = pos;
  20654. var i, ii;
  20655. if (count !== 0) {
  20656. var offsetSize = bytes[pos++];
  20657. var startPos = pos + (count + 1) * offsetSize - 1;
  20658. for (i = 0, ii = count + 1; i < ii; ++i) {
  20659. var offset = 0;
  20660. for (var j = 0; j < offsetSize; ++j) {
  20661. offset <<= 8;
  20662. offset += bytes[pos++];
  20663. }
  20664. offsets.push(startPos + offset);
  20665. }
  20666. end = offsets[count];
  20667. }
  20668. for (i = 0, ii = offsets.length - 1; i < ii; ++i) {
  20669. var offsetStart = offsets[i];
  20670. var offsetEnd = offsets[i + 1];
  20671. cffIndex.add(bytes.subarray(offsetStart, offsetEnd));
  20672. }
  20673. return {
  20674. obj: cffIndex,
  20675. endPos: end
  20676. };
  20677. },
  20678. parseNameIndex: function CFFParser_parseNameIndex(index) {
  20679. var names = [];
  20680. for (var i = 0, ii = index.count; i < ii; ++i) {
  20681. var name = index.get(i);
  20682. var length = Math.min(name.length, 127);
  20683. var data = [];
  20684. for (var j = 0; j < length; ++j) {
  20685. var c = name[j];
  20686. if (j === 0 && c === 0) {
  20687. data[j] = c;
  20688. continue;
  20689. }
  20690. if (c < 33 || c > 126 || c === 91 || c === 93 || c === 40 || c === 41 || c === 123 || c === 125 || c === 60 || c === 62 || c === 47 || c === 37 || c === 35) {
  20691. data[j] = 95;
  20692. continue;
  20693. }
  20694. data[j] = c;
  20695. }
  20696. names.push(bytesToString(data));
  20697. }
  20698. return names;
  20699. },
  20700. parseStringIndex: function CFFParser_parseStringIndex(index) {
  20701. var strings = new CFFStrings();
  20702. for (var i = 0, ii = index.count; i < ii; ++i) {
  20703. var data = index.get(i);
  20704. strings.add(bytesToString(data));
  20705. }
  20706. return strings;
  20707. },
  20708. createDict: function CFFParser_createDict(Type, dict, strings) {
  20709. var cffDict = new Type(strings);
  20710. for (var i = 0, ii = dict.length; i < ii; ++i) {
  20711. var pair = dict[i];
  20712. var key = pair[0];
  20713. var value = pair[1];
  20714. cffDict.setByKey(key, value);
  20715. }
  20716. return cffDict;
  20717. },
  20718. parseCharString: function CFFParser_parseCharString(state, data, localSubrIndex, globalSubrIndex) {
  20719. if (state.callDepth > MAX_SUBR_NESTING) {
  20720. return false;
  20721. }
  20722. var stackSize = state.stackSize;
  20723. var stack = state.stack;
  20724. var length = data.length;
  20725. for (var j = 0; j < length;) {
  20726. var value = data[j++];
  20727. var validationCommand = null;
  20728. if (value === 12) {
  20729. var q = data[j++];
  20730. if (q === 0) {
  20731. data[j - 2] = 139;
  20732. data[j - 1] = 22;
  20733. stackSize = 0;
  20734. } else {
  20735. validationCommand = CharstringValidationData12[q];
  20736. }
  20737. } else if (value === 28) {
  20738. stack[stackSize] = (data[j] << 24 | data[j + 1] << 16) >> 16;
  20739. j += 2;
  20740. stackSize++;
  20741. } else if (value === 14) {
  20742. if (stackSize >= 4) {
  20743. stackSize -= 4;
  20744. if (this.seacAnalysisEnabled) {
  20745. state.seac = stack.slice(stackSize, stackSize + 4);
  20746. return false;
  20747. }
  20748. }
  20749. validationCommand = CharstringValidationData[value];
  20750. } else if (value >= 32 && value <= 246) {
  20751. stack[stackSize] = value - 139;
  20752. stackSize++;
  20753. } else if (value >= 247 && value <= 254) {
  20754. stack[stackSize] = value < 251 ? (value - 247 << 8) + data[j] + 108 : -(value - 251 << 8) - data[j] - 108;
  20755. j++;
  20756. stackSize++;
  20757. } else if (value === 255) {
  20758. stack[stackSize] = (data[j] << 24 | data[j + 1] << 16 | data[j + 2] << 8 | data[j + 3]) / 65536;
  20759. j += 4;
  20760. stackSize++;
  20761. } else if (value === 19 || value === 20) {
  20762. state.hints += stackSize >> 1;
  20763. j += state.hints + 7 >> 3;
  20764. stackSize %= 2;
  20765. validationCommand = CharstringValidationData[value];
  20766. } else if (value === 10 || value === 29) {
  20767. var subrsIndex;
  20768. if (value === 10) {
  20769. subrsIndex = localSubrIndex;
  20770. } else {
  20771. subrsIndex = globalSubrIndex;
  20772. }
  20773. if (!subrsIndex) {
  20774. validationCommand = CharstringValidationData[value];
  20775. warn('Missing subrsIndex for ' + validationCommand.id);
  20776. return false;
  20777. }
  20778. var bias = 32768;
  20779. if (subrsIndex.count < 1240) {
  20780. bias = 107;
  20781. } else if (subrsIndex.count < 33900) {
  20782. bias = 1131;
  20783. }
  20784. var subrNumber = stack[--stackSize] + bias;
  20785. if (subrNumber < 0 || subrNumber >= subrsIndex.count) {
  20786. validationCommand = CharstringValidationData[value];
  20787. warn('Out of bounds subrIndex for ' + validationCommand.id);
  20788. return false;
  20789. }
  20790. state.stackSize = stackSize;
  20791. state.callDepth++;
  20792. var valid = this.parseCharString(state, subrsIndex.get(subrNumber), localSubrIndex, globalSubrIndex);
  20793. if (!valid) {
  20794. return false;
  20795. }
  20796. state.callDepth--;
  20797. stackSize = state.stackSize;
  20798. continue;
  20799. } else if (value === 11) {
  20800. state.stackSize = stackSize;
  20801. return true;
  20802. } else {
  20803. validationCommand = CharstringValidationData[value];
  20804. }
  20805. if (validationCommand) {
  20806. if (validationCommand.stem) {
  20807. state.hints += stackSize >> 1;
  20808. }
  20809. if ('min' in validationCommand) {
  20810. if (!state.undefStack && stackSize < validationCommand.min) {
  20811. warn('Not enough parameters for ' + validationCommand.id + '; actual: ' + stackSize + ', expected: ' + validationCommand.min);
  20812. return false;
  20813. }
  20814. }
  20815. if (state.firstStackClearing && validationCommand.stackClearing) {
  20816. state.firstStackClearing = false;
  20817. stackSize -= validationCommand.min;
  20818. if (stackSize >= 2 && validationCommand.stem) {
  20819. stackSize %= 2;
  20820. } else if (stackSize > 1) {
  20821. warn('Found too many parameters for stack-clearing command');
  20822. }
  20823. if (stackSize > 0 && stack[stackSize - 1] >= 0) {
  20824. state.width = stack[stackSize - 1];
  20825. }
  20826. }
  20827. if ('stackDelta' in validationCommand) {
  20828. if ('stackFn' in validationCommand) {
  20829. validationCommand.stackFn(stack, stackSize);
  20830. }
  20831. stackSize += validationCommand.stackDelta;
  20832. } else if (validationCommand.stackClearing) {
  20833. stackSize = 0;
  20834. } else if (validationCommand.resetStack) {
  20835. stackSize = 0;
  20836. state.undefStack = false;
  20837. } else if (validationCommand.undefStack) {
  20838. stackSize = 0;
  20839. state.undefStack = true;
  20840. state.firstStackClearing = false;
  20841. }
  20842. }
  20843. }
  20844. state.stackSize = stackSize;
  20845. return true;
  20846. },
  20847. parseCharStrings: function CFFParser_parseCharStrings(charStrings, localSubrIndex, globalSubrIndex, fdSelect, fdArray) {
  20848. var seacs = [];
  20849. var widths = [];
  20850. var count = charStrings.count;
  20851. for (var i = 0; i < count; i++) {
  20852. var charstring = charStrings.get(i);
  20853. var state = {
  20854. callDepth: 0,
  20855. stackSize: 0,
  20856. stack: [],
  20857. undefStack: true,
  20858. hints: 0,
  20859. firstStackClearing: true,
  20860. seac: null,
  20861. width: null
  20862. };
  20863. var valid = true;
  20864. var localSubrToUse = null;
  20865. if (fdSelect && fdArray.length) {
  20866. var fdIndex = fdSelect.getFDIndex(i);
  20867. if (fdIndex === -1) {
  20868. warn('Glyph index is not in fd select.');
  20869. valid = false;
  20870. }
  20871. if (fdIndex >= fdArray.length) {
  20872. warn('Invalid fd index for glyph index.');
  20873. valid = false;
  20874. }
  20875. if (valid) {
  20876. localSubrToUse = fdArray[fdIndex].privateDict.subrsIndex;
  20877. }
  20878. } else if (localSubrIndex) {
  20879. localSubrToUse = localSubrIndex;
  20880. }
  20881. if (valid) {
  20882. valid = this.parseCharString(state, charstring, localSubrToUse, globalSubrIndex);
  20883. }
  20884. if (state.width !== null) {
  20885. widths[i] = state.width;
  20886. }
  20887. if (state.seac !== null) {
  20888. seacs[i] = state.seac;
  20889. }
  20890. if (!valid) {
  20891. charStrings.set(i, new Uint8Array([14]));
  20892. }
  20893. }
  20894. return {
  20895. charStrings: charStrings,
  20896. seacs: seacs,
  20897. widths: widths
  20898. };
  20899. },
  20900. emptyPrivateDictionary: function CFFParser_emptyPrivateDictionary(parentDict) {
  20901. var privateDict = this.createDict(CFFPrivateDict, [], parentDict.strings);
  20902. parentDict.setByKey(18, [
  20903. 0,
  20904. 0
  20905. ]);
  20906. parentDict.privateDict = privateDict;
  20907. },
  20908. parsePrivateDict: function CFFParser_parsePrivateDict(parentDict) {
  20909. if (!parentDict.hasName('Private')) {
  20910. this.emptyPrivateDictionary(parentDict);
  20911. return;
  20912. }
  20913. var privateOffset = parentDict.getByName('Private');
  20914. if (!isArray(privateOffset) || privateOffset.length !== 2) {
  20915. parentDict.removeByName('Private');
  20916. return;
  20917. }
  20918. var size = privateOffset[0];
  20919. var offset = privateOffset[1];
  20920. if (size === 0 || offset >= this.bytes.length) {
  20921. this.emptyPrivateDictionary(parentDict);
  20922. return;
  20923. }
  20924. var privateDictEnd = offset + size;
  20925. var dictData = this.bytes.subarray(offset, privateDictEnd);
  20926. var dict = this.parseDict(dictData);
  20927. var privateDict = this.createDict(CFFPrivateDict, dict, parentDict.strings);
  20928. parentDict.privateDict = privateDict;
  20929. if (!privateDict.getByName('Subrs')) {
  20930. return;
  20931. }
  20932. var subrsOffset = privateDict.getByName('Subrs');
  20933. var relativeOffset = offset + subrsOffset;
  20934. if (subrsOffset === 0 || relativeOffset >= this.bytes.length) {
  20935. this.emptyPrivateDictionary(parentDict);
  20936. return;
  20937. }
  20938. var subrsIndex = this.parseIndex(relativeOffset);
  20939. privateDict.subrsIndex = subrsIndex.obj;
  20940. },
  20941. parseCharsets: function CFFParser_parseCharsets(pos, length, strings, cid) {
  20942. if (pos === 0) {
  20943. return new CFFCharset(true, CFFCharsetPredefinedTypes.ISO_ADOBE, ISOAdobeCharset);
  20944. } else if (pos === 1) {
  20945. return new CFFCharset(true, CFFCharsetPredefinedTypes.EXPERT, ExpertCharset);
  20946. } else if (pos === 2) {
  20947. return new CFFCharset(true, CFFCharsetPredefinedTypes.EXPERT_SUBSET, ExpertSubsetCharset);
  20948. }
  20949. var bytes = this.bytes;
  20950. var start = pos;
  20951. var format = bytes[pos++];
  20952. var charset = ['.notdef'];
  20953. var id, count, i;
  20954. length -= 1;
  20955. switch (format) {
  20956. case 0:
  20957. for (i = 0; i < length; i++) {
  20958. id = bytes[pos++] << 8 | bytes[pos++];
  20959. charset.push(cid ? id : strings.get(id));
  20960. }
  20961. break;
  20962. case 1:
  20963. while (charset.length <= length) {
  20964. id = bytes[pos++] << 8 | bytes[pos++];
  20965. count = bytes[pos++];
  20966. for (i = 0; i <= count; i++) {
  20967. charset.push(cid ? id++ : strings.get(id++));
  20968. }
  20969. }
  20970. break;
  20971. case 2:
  20972. while (charset.length <= length) {
  20973. id = bytes[pos++] << 8 | bytes[pos++];
  20974. count = bytes[pos++] << 8 | bytes[pos++];
  20975. for (i = 0; i <= count; i++) {
  20976. charset.push(cid ? id++ : strings.get(id++));
  20977. }
  20978. }
  20979. break;
  20980. default:
  20981. error('Unknown charset format');
  20982. }
  20983. var end = pos;
  20984. var raw = bytes.subarray(start, end);
  20985. return new CFFCharset(false, format, charset, raw);
  20986. },
  20987. parseEncoding: function CFFParser_parseEncoding(pos, properties, strings, charset) {
  20988. var encoding = Object.create(null);
  20989. var bytes = this.bytes;
  20990. var predefined = false;
  20991. var format, i, ii;
  20992. var raw = null;
  20993. function readSupplement() {
  20994. var supplementsCount = bytes[pos++];
  20995. for (i = 0; i < supplementsCount; i++) {
  20996. var code = bytes[pos++];
  20997. var sid = (bytes[pos++] << 8) + (bytes[pos++] & 0xff);
  20998. encoding[code] = charset.indexOf(strings.get(sid));
  20999. }
  21000. }
  21001. if (pos === 0 || pos === 1) {
  21002. predefined = true;
  21003. format = pos;
  21004. var baseEncoding = pos ? ExpertEncoding : StandardEncoding;
  21005. for (i = 0, ii = charset.length; i < ii; i++) {
  21006. var index = baseEncoding.indexOf(charset[i]);
  21007. if (index !== -1) {
  21008. encoding[index] = i;
  21009. }
  21010. }
  21011. } else {
  21012. var dataStart = pos;
  21013. format = bytes[pos++];
  21014. switch (format & 0x7f) {
  21015. case 0:
  21016. var glyphsCount = bytes[pos++];
  21017. for (i = 1; i <= glyphsCount; i++) {
  21018. encoding[bytes[pos++]] = i;
  21019. }
  21020. break;
  21021. case 1:
  21022. var rangesCount = bytes[pos++];
  21023. var gid = 1;
  21024. for (i = 0; i < rangesCount; i++) {
  21025. var start = bytes[pos++];
  21026. var left = bytes[pos++];
  21027. for (var j = start; j <= start + left; j++) {
  21028. encoding[j] = gid++;
  21029. }
  21030. }
  21031. break;
  21032. default:
  21033. error('Unknown encoding format: ' + format + ' in CFF');
  21034. break;
  21035. }
  21036. var dataEnd = pos;
  21037. if (format & 0x80) {
  21038. bytes[dataStart] &= 0x7f;
  21039. readSupplement();
  21040. }
  21041. raw = bytes.subarray(dataStart, dataEnd);
  21042. }
  21043. format = format & 0x7f;
  21044. return new CFFEncoding(predefined, format, encoding, raw);
  21045. },
  21046. parseFDSelect: function CFFParser_parseFDSelect(pos, length) {
  21047. var start = pos;
  21048. var bytes = this.bytes;
  21049. var format = bytes[pos++];
  21050. var fdSelect = [], rawBytes;
  21051. var i, invalidFirstGID = false;
  21052. switch (format) {
  21053. case 0:
  21054. for (i = 0; i < length; ++i) {
  21055. var id = bytes[pos++];
  21056. fdSelect.push(id);
  21057. }
  21058. rawBytes = bytes.subarray(start, pos);
  21059. break;
  21060. case 3:
  21061. var rangesCount = bytes[pos++] << 8 | bytes[pos++];
  21062. for (i = 0; i < rangesCount; ++i) {
  21063. var first = bytes[pos++] << 8 | bytes[pos++];
  21064. if (i === 0 && first !== 0) {
  21065. warn('parseFDSelect: The first range must have a first GID of 0' + ' -- trying to recover.');
  21066. invalidFirstGID = true;
  21067. first = 0;
  21068. }
  21069. var fdIndex = bytes[pos++];
  21070. var next = bytes[pos] << 8 | bytes[pos + 1];
  21071. for (var j = first; j < next; ++j) {
  21072. fdSelect.push(fdIndex);
  21073. }
  21074. }
  21075. pos += 2;
  21076. rawBytes = bytes.subarray(start, pos);
  21077. if (invalidFirstGID) {
  21078. rawBytes[3] = rawBytes[4] = 0;
  21079. }
  21080. break;
  21081. default:
  21082. error('parseFDSelect: Unknown format "' + format + '".');
  21083. break;
  21084. }
  21085. assert(fdSelect.length === length, 'parseFDSelect: Invalid font data.');
  21086. return new CFFFDSelect(fdSelect, rawBytes);
  21087. }
  21088. };
  21089. return CFFParser;
  21090. }();
  21091. var CFF = function CFFClosure() {
  21092. function CFF() {
  21093. this.header = null;
  21094. this.names = [];
  21095. this.topDict = null;
  21096. this.strings = new CFFStrings();
  21097. this.globalSubrIndex = null;
  21098. this.encoding = null;
  21099. this.charset = null;
  21100. this.charStrings = null;
  21101. this.fdArray = [];
  21102. this.fdSelect = null;
  21103. this.isCIDFont = false;
  21104. }
  21105. return CFF;
  21106. }();
  21107. var CFFHeader = function CFFHeaderClosure() {
  21108. function CFFHeader(major, minor, hdrSize, offSize) {
  21109. this.major = major;
  21110. this.minor = minor;
  21111. this.hdrSize = hdrSize;
  21112. this.offSize = offSize;
  21113. }
  21114. return CFFHeader;
  21115. }();
  21116. var CFFStrings = function CFFStringsClosure() {
  21117. function CFFStrings() {
  21118. this.strings = [];
  21119. }
  21120. CFFStrings.prototype = {
  21121. get: function CFFStrings_get(index) {
  21122. if (index >= 0 && index <= 390) {
  21123. return CFFStandardStrings[index];
  21124. }
  21125. if (index - 391 <= this.strings.length) {
  21126. return this.strings[index - 391];
  21127. }
  21128. return CFFStandardStrings[0];
  21129. },
  21130. add: function CFFStrings_add(value) {
  21131. this.strings.push(value);
  21132. },
  21133. get count() {
  21134. return this.strings.length;
  21135. }
  21136. };
  21137. return CFFStrings;
  21138. }();
  21139. var CFFIndex = function CFFIndexClosure() {
  21140. function CFFIndex() {
  21141. this.objects = [];
  21142. this.length = 0;
  21143. }
  21144. CFFIndex.prototype = {
  21145. add: function CFFIndex_add(data) {
  21146. this.length += data.length;
  21147. this.objects.push(data);
  21148. },
  21149. set: function CFFIndex_set(index, data) {
  21150. this.length += data.length - this.objects[index].length;
  21151. this.objects[index] = data;
  21152. },
  21153. get: function CFFIndex_get(index) {
  21154. return this.objects[index];
  21155. },
  21156. get count() {
  21157. return this.objects.length;
  21158. }
  21159. };
  21160. return CFFIndex;
  21161. }();
  21162. var CFFDict = function CFFDictClosure() {
  21163. function CFFDict(tables, strings) {
  21164. this.keyToNameMap = tables.keyToNameMap;
  21165. this.nameToKeyMap = tables.nameToKeyMap;
  21166. this.defaults = tables.defaults;
  21167. this.types = tables.types;
  21168. this.opcodes = tables.opcodes;
  21169. this.order = tables.order;
  21170. this.strings = strings;
  21171. this.values = Object.create(null);
  21172. }
  21173. CFFDict.prototype = {
  21174. setByKey: function CFFDict_setByKey(key, value) {
  21175. if (!(key in this.keyToNameMap)) {
  21176. return false;
  21177. }
  21178. var valueLength = value.length;
  21179. if (valueLength === 0) {
  21180. return true;
  21181. }
  21182. for (var i = 0; i < valueLength; i++) {
  21183. if (isNaN(value[i])) {
  21184. warn('Invalid CFFDict value: "' + value + '" for key "' + key + '".');
  21185. return true;
  21186. }
  21187. }
  21188. var type = this.types[key];
  21189. if (type === 'num' || type === 'sid' || type === 'offset') {
  21190. value = value[0];
  21191. }
  21192. this.values[key] = value;
  21193. return true;
  21194. },
  21195. setByName: function CFFDict_setByName(name, value) {
  21196. if (!(name in this.nameToKeyMap)) {
  21197. error('Invalid dictionary name "' + name + '"');
  21198. }
  21199. this.values[this.nameToKeyMap[name]] = value;
  21200. },
  21201. hasName: function CFFDict_hasName(name) {
  21202. return this.nameToKeyMap[name] in this.values;
  21203. },
  21204. getByName: function CFFDict_getByName(name) {
  21205. if (!(name in this.nameToKeyMap)) {
  21206. error('Invalid dictionary name "' + name + '"');
  21207. }
  21208. var key = this.nameToKeyMap[name];
  21209. if (!(key in this.values)) {
  21210. return this.defaults[key];
  21211. }
  21212. return this.values[key];
  21213. },
  21214. removeByName: function CFFDict_removeByName(name) {
  21215. delete this.values[this.nameToKeyMap[name]];
  21216. }
  21217. };
  21218. CFFDict.createTables = function CFFDict_createTables(layout) {
  21219. var tables = {
  21220. keyToNameMap: {},
  21221. nameToKeyMap: {},
  21222. defaults: {},
  21223. types: {},
  21224. opcodes: {},
  21225. order: []
  21226. };
  21227. for (var i = 0, ii = layout.length; i < ii; ++i) {
  21228. var entry = layout[i];
  21229. var key = isArray(entry[0]) ? (entry[0][0] << 8) + entry[0][1] : entry[0];
  21230. tables.keyToNameMap[key] = entry[1];
  21231. tables.nameToKeyMap[entry[1]] = key;
  21232. tables.types[key] = entry[2];
  21233. tables.defaults[key] = entry[3];
  21234. tables.opcodes[key] = isArray(entry[0]) ? entry[0] : [entry[0]];
  21235. tables.order.push(key);
  21236. }
  21237. return tables;
  21238. };
  21239. return CFFDict;
  21240. }();
  21241. var CFFTopDict = function CFFTopDictClosure() {
  21242. var layout = [
  21243. [
  21244. [
  21245. 12,
  21246. 30
  21247. ],
  21248. 'ROS',
  21249. [
  21250. 'sid',
  21251. 'sid',
  21252. 'num'
  21253. ],
  21254. null
  21255. ],
  21256. [
  21257. [
  21258. 12,
  21259. 20
  21260. ],
  21261. 'SyntheticBase',
  21262. 'num',
  21263. null
  21264. ],
  21265. [
  21266. 0,
  21267. 'version',
  21268. 'sid',
  21269. null
  21270. ],
  21271. [
  21272. 1,
  21273. 'Notice',
  21274. 'sid',
  21275. null
  21276. ],
  21277. [
  21278. [
  21279. 12,
  21280. 0
  21281. ],
  21282. 'Copyright',
  21283. 'sid',
  21284. null
  21285. ],
  21286. [
  21287. 2,
  21288. 'FullName',
  21289. 'sid',
  21290. null
  21291. ],
  21292. [
  21293. 3,
  21294. 'FamilyName',
  21295. 'sid',
  21296. null
  21297. ],
  21298. [
  21299. 4,
  21300. 'Weight',
  21301. 'sid',
  21302. null
  21303. ],
  21304. [
  21305. [
  21306. 12,
  21307. 1
  21308. ],
  21309. 'isFixedPitch',
  21310. 'num',
  21311. 0
  21312. ],
  21313. [
  21314. [
  21315. 12,
  21316. 2
  21317. ],
  21318. 'ItalicAngle',
  21319. 'num',
  21320. 0
  21321. ],
  21322. [
  21323. [
  21324. 12,
  21325. 3
  21326. ],
  21327. 'UnderlinePosition',
  21328. 'num',
  21329. -100
  21330. ],
  21331. [
  21332. [
  21333. 12,
  21334. 4
  21335. ],
  21336. 'UnderlineThickness',
  21337. 'num',
  21338. 50
  21339. ],
  21340. [
  21341. [
  21342. 12,
  21343. 5
  21344. ],
  21345. 'PaintType',
  21346. 'num',
  21347. 0
  21348. ],
  21349. [
  21350. [
  21351. 12,
  21352. 6
  21353. ],
  21354. 'CharstringType',
  21355. 'num',
  21356. 2
  21357. ],
  21358. [
  21359. [
  21360. 12,
  21361. 7
  21362. ],
  21363. 'FontMatrix',
  21364. [
  21365. 'num',
  21366. 'num',
  21367. 'num',
  21368. 'num',
  21369. 'num',
  21370. 'num'
  21371. ],
  21372. [
  21373. 0.001,
  21374. 0,
  21375. 0,
  21376. 0.001,
  21377. 0,
  21378. 0
  21379. ]
  21380. ],
  21381. [
  21382. 13,
  21383. 'UniqueID',
  21384. 'num',
  21385. null
  21386. ],
  21387. [
  21388. 5,
  21389. 'FontBBox',
  21390. [
  21391. 'num',
  21392. 'num',
  21393. 'num',
  21394. 'num'
  21395. ],
  21396. [
  21397. 0,
  21398. 0,
  21399. 0,
  21400. 0
  21401. ]
  21402. ],
  21403. [
  21404. [
  21405. 12,
  21406. 8
  21407. ],
  21408. 'StrokeWidth',
  21409. 'num',
  21410. 0
  21411. ],
  21412. [
  21413. 14,
  21414. 'XUID',
  21415. 'array',
  21416. null
  21417. ],
  21418. [
  21419. 15,
  21420. 'charset',
  21421. 'offset',
  21422. 0
  21423. ],
  21424. [
  21425. 16,
  21426. 'Encoding',
  21427. 'offset',
  21428. 0
  21429. ],
  21430. [
  21431. 17,
  21432. 'CharStrings',
  21433. 'offset',
  21434. 0
  21435. ],
  21436. [
  21437. 18,
  21438. 'Private',
  21439. [
  21440. 'offset',
  21441. 'offset'
  21442. ],
  21443. null
  21444. ],
  21445. [
  21446. [
  21447. 12,
  21448. 21
  21449. ],
  21450. 'PostScript',
  21451. 'sid',
  21452. null
  21453. ],
  21454. [
  21455. [
  21456. 12,
  21457. 22
  21458. ],
  21459. 'BaseFontName',
  21460. 'sid',
  21461. null
  21462. ],
  21463. [
  21464. [
  21465. 12,
  21466. 23
  21467. ],
  21468. 'BaseFontBlend',
  21469. 'delta',
  21470. null
  21471. ],
  21472. [
  21473. [
  21474. 12,
  21475. 31
  21476. ],
  21477. 'CIDFontVersion',
  21478. 'num',
  21479. 0
  21480. ],
  21481. [
  21482. [
  21483. 12,
  21484. 32
  21485. ],
  21486. 'CIDFontRevision',
  21487. 'num',
  21488. 0
  21489. ],
  21490. [
  21491. [
  21492. 12,
  21493. 33
  21494. ],
  21495. 'CIDFontType',
  21496. 'num',
  21497. 0
  21498. ],
  21499. [
  21500. [
  21501. 12,
  21502. 34
  21503. ],
  21504. 'CIDCount',
  21505. 'num',
  21506. 8720
  21507. ],
  21508. [
  21509. [
  21510. 12,
  21511. 35
  21512. ],
  21513. 'UIDBase',
  21514. 'num',
  21515. null
  21516. ],
  21517. [
  21518. [
  21519. 12,
  21520. 37
  21521. ],
  21522. 'FDSelect',
  21523. 'offset',
  21524. null
  21525. ],
  21526. [
  21527. [
  21528. 12,
  21529. 36
  21530. ],
  21531. 'FDArray',
  21532. 'offset',
  21533. null
  21534. ],
  21535. [
  21536. [
  21537. 12,
  21538. 38
  21539. ],
  21540. 'FontName',
  21541. 'sid',
  21542. null
  21543. ]
  21544. ];
  21545. var tables = null;
  21546. function CFFTopDict(strings) {
  21547. if (tables === null) {
  21548. tables = CFFDict.createTables(layout);
  21549. }
  21550. CFFDict.call(this, tables, strings);
  21551. this.privateDict = null;
  21552. }
  21553. CFFTopDict.prototype = Object.create(CFFDict.prototype);
  21554. return CFFTopDict;
  21555. }();
  21556. var CFFPrivateDict = function CFFPrivateDictClosure() {
  21557. var layout = [
  21558. [
  21559. 6,
  21560. 'BlueValues',
  21561. 'delta',
  21562. null
  21563. ],
  21564. [
  21565. 7,
  21566. 'OtherBlues',
  21567. 'delta',
  21568. null
  21569. ],
  21570. [
  21571. 8,
  21572. 'FamilyBlues',
  21573. 'delta',
  21574. null
  21575. ],
  21576. [
  21577. 9,
  21578. 'FamilyOtherBlues',
  21579. 'delta',
  21580. null
  21581. ],
  21582. [
  21583. [
  21584. 12,
  21585. 9
  21586. ],
  21587. 'BlueScale',
  21588. 'num',
  21589. 0.039625
  21590. ],
  21591. [
  21592. [
  21593. 12,
  21594. 10
  21595. ],
  21596. 'BlueShift',
  21597. 'num',
  21598. 7
  21599. ],
  21600. [
  21601. [
  21602. 12,
  21603. 11
  21604. ],
  21605. 'BlueFuzz',
  21606. 'num',
  21607. 1
  21608. ],
  21609. [
  21610. 10,
  21611. 'StdHW',
  21612. 'num',
  21613. null
  21614. ],
  21615. [
  21616. 11,
  21617. 'StdVW',
  21618. 'num',
  21619. null
  21620. ],
  21621. [
  21622. [
  21623. 12,
  21624. 12
  21625. ],
  21626. 'StemSnapH',
  21627. 'delta',
  21628. null
  21629. ],
  21630. [
  21631. [
  21632. 12,
  21633. 13
  21634. ],
  21635. 'StemSnapV',
  21636. 'delta',
  21637. null
  21638. ],
  21639. [
  21640. [
  21641. 12,
  21642. 14
  21643. ],
  21644. 'ForceBold',
  21645. 'num',
  21646. 0
  21647. ],
  21648. [
  21649. [
  21650. 12,
  21651. 17
  21652. ],
  21653. 'LanguageGroup',
  21654. 'num',
  21655. 0
  21656. ],
  21657. [
  21658. [
  21659. 12,
  21660. 18
  21661. ],
  21662. 'ExpansionFactor',
  21663. 'num',
  21664. 0.06
  21665. ],
  21666. [
  21667. [
  21668. 12,
  21669. 19
  21670. ],
  21671. 'initialRandomSeed',
  21672. 'num',
  21673. 0
  21674. ],
  21675. [
  21676. 20,
  21677. 'defaultWidthX',
  21678. 'num',
  21679. 0
  21680. ],
  21681. [
  21682. 21,
  21683. 'nominalWidthX',
  21684. 'num',
  21685. 0
  21686. ],
  21687. [
  21688. 19,
  21689. 'Subrs',
  21690. 'offset',
  21691. null
  21692. ]
  21693. ];
  21694. var tables = null;
  21695. function CFFPrivateDict(strings) {
  21696. if (tables === null) {
  21697. tables = CFFDict.createTables(layout);
  21698. }
  21699. CFFDict.call(this, tables, strings);
  21700. this.subrsIndex = null;
  21701. }
  21702. CFFPrivateDict.prototype = Object.create(CFFDict.prototype);
  21703. return CFFPrivateDict;
  21704. }();
  21705. var CFFCharsetPredefinedTypes = {
  21706. ISO_ADOBE: 0,
  21707. EXPERT: 1,
  21708. EXPERT_SUBSET: 2
  21709. };
  21710. var CFFCharset = function CFFCharsetClosure() {
  21711. function CFFCharset(predefined, format, charset, raw) {
  21712. this.predefined = predefined;
  21713. this.format = format;
  21714. this.charset = charset;
  21715. this.raw = raw;
  21716. }
  21717. return CFFCharset;
  21718. }();
  21719. var CFFEncoding = function CFFEncodingClosure() {
  21720. function CFFEncoding(predefined, format, encoding, raw) {
  21721. this.predefined = predefined;
  21722. this.format = format;
  21723. this.encoding = encoding;
  21724. this.raw = raw;
  21725. }
  21726. return CFFEncoding;
  21727. }();
  21728. var CFFFDSelect = function CFFFDSelectClosure() {
  21729. function CFFFDSelect(fdSelect, raw) {
  21730. this.fdSelect = fdSelect;
  21731. this.raw = raw;
  21732. }
  21733. CFFFDSelect.prototype = {
  21734. getFDIndex: function CFFFDSelect_get(glyphIndex) {
  21735. if (glyphIndex < 0 || glyphIndex >= this.fdSelect.length) {
  21736. return -1;
  21737. }
  21738. return this.fdSelect[glyphIndex];
  21739. }
  21740. };
  21741. return CFFFDSelect;
  21742. }();
  21743. var CFFOffsetTracker = function CFFOffsetTrackerClosure() {
  21744. function CFFOffsetTracker() {
  21745. this.offsets = Object.create(null);
  21746. }
  21747. CFFOffsetTracker.prototype = {
  21748. isTracking: function CFFOffsetTracker_isTracking(key) {
  21749. return key in this.offsets;
  21750. },
  21751. track: function CFFOffsetTracker_track(key, location) {
  21752. if (key in this.offsets) {
  21753. error('Already tracking location of ' + key);
  21754. }
  21755. this.offsets[key] = location;
  21756. },
  21757. offset: function CFFOffsetTracker_offset(value) {
  21758. for (var key in this.offsets) {
  21759. this.offsets[key] += value;
  21760. }
  21761. },
  21762. setEntryLocation: function CFFOffsetTracker_setEntryLocation(key, values, output) {
  21763. if (!(key in this.offsets)) {
  21764. error('Not tracking location of ' + key);
  21765. }
  21766. var data = output.data;
  21767. var dataOffset = this.offsets[key];
  21768. var size = 5;
  21769. for (var i = 0, ii = values.length; i < ii; ++i) {
  21770. var offset0 = i * size + dataOffset;
  21771. var offset1 = offset0 + 1;
  21772. var offset2 = offset0 + 2;
  21773. var offset3 = offset0 + 3;
  21774. var offset4 = offset0 + 4;
  21775. if (data[offset0] !== 0x1d || data[offset1] !== 0 || data[offset2] !== 0 || data[offset3] !== 0 || data[offset4] !== 0) {
  21776. error('writing to an offset that is not empty');
  21777. }
  21778. var value = values[i];
  21779. data[offset0] = 0x1d;
  21780. data[offset1] = value >> 24 & 0xFF;
  21781. data[offset2] = value >> 16 & 0xFF;
  21782. data[offset3] = value >> 8 & 0xFF;
  21783. data[offset4] = value & 0xFF;
  21784. }
  21785. }
  21786. };
  21787. return CFFOffsetTracker;
  21788. }();
  21789. var CFFCompiler = function CFFCompilerClosure() {
  21790. function CFFCompiler(cff) {
  21791. this.cff = cff;
  21792. }
  21793. CFFCompiler.prototype = {
  21794. compile: function CFFCompiler_compile() {
  21795. var cff = this.cff;
  21796. var output = {
  21797. data: [],
  21798. length: 0,
  21799. add: function CFFCompiler_add(data) {
  21800. this.data = this.data.concat(data);
  21801. this.length = this.data.length;
  21802. }
  21803. };
  21804. var header = this.compileHeader(cff.header);
  21805. output.add(header);
  21806. var nameIndex = this.compileNameIndex(cff.names);
  21807. output.add(nameIndex);
  21808. if (cff.isCIDFont) {
  21809. if (cff.topDict.hasName('FontMatrix')) {
  21810. var base = cff.topDict.getByName('FontMatrix');
  21811. cff.topDict.removeByName('FontMatrix');
  21812. for (var i = 0, ii = cff.fdArray.length; i < ii; i++) {
  21813. var subDict = cff.fdArray[i];
  21814. var matrix = base.slice(0);
  21815. if (subDict.hasName('FontMatrix')) {
  21816. matrix = Util.transform(matrix, subDict.getByName('FontMatrix'));
  21817. }
  21818. subDict.setByName('FontMatrix', matrix);
  21819. }
  21820. }
  21821. }
  21822. var compiled = this.compileTopDicts([cff.topDict], output.length, cff.isCIDFont);
  21823. output.add(compiled.output);
  21824. var topDictTracker = compiled.trackers[0];
  21825. var stringIndex = this.compileStringIndex(cff.strings.strings);
  21826. output.add(stringIndex);
  21827. var globalSubrIndex = this.compileIndex(cff.globalSubrIndex);
  21828. output.add(globalSubrIndex);
  21829. if (cff.encoding && cff.topDict.hasName('Encoding')) {
  21830. if (cff.encoding.predefined) {
  21831. topDictTracker.setEntryLocation('Encoding', [cff.encoding.format], output);
  21832. } else {
  21833. var encoding = this.compileEncoding(cff.encoding);
  21834. topDictTracker.setEntryLocation('Encoding', [output.length], output);
  21835. output.add(encoding);
  21836. }
  21837. }
  21838. if (cff.charset && cff.topDict.hasName('charset')) {
  21839. if (cff.charset.predefined) {
  21840. topDictTracker.setEntryLocation('charset', [cff.charset.format], output);
  21841. } else {
  21842. var charset = this.compileCharset(cff.charset);
  21843. topDictTracker.setEntryLocation('charset', [output.length], output);
  21844. output.add(charset);
  21845. }
  21846. }
  21847. var charStrings = this.compileCharStrings(cff.charStrings);
  21848. topDictTracker.setEntryLocation('CharStrings', [output.length], output);
  21849. output.add(charStrings);
  21850. if (cff.isCIDFont) {
  21851. topDictTracker.setEntryLocation('FDSelect', [output.length], output);
  21852. var fdSelect = this.compileFDSelect(cff.fdSelect.raw);
  21853. output.add(fdSelect);
  21854. compiled = this.compileTopDicts(cff.fdArray, output.length, true);
  21855. topDictTracker.setEntryLocation('FDArray', [output.length], output);
  21856. output.add(compiled.output);
  21857. var fontDictTrackers = compiled.trackers;
  21858. this.compilePrivateDicts(cff.fdArray, fontDictTrackers, output);
  21859. }
  21860. this.compilePrivateDicts([cff.topDict], [topDictTracker], output);
  21861. output.add([0]);
  21862. return output.data;
  21863. },
  21864. encodeNumber: function CFFCompiler_encodeNumber(value) {
  21865. if (parseFloat(value) === parseInt(value, 10) && !isNaN(value)) {
  21866. return this.encodeInteger(value);
  21867. }
  21868. return this.encodeFloat(value);
  21869. },
  21870. encodeFloat: function CFFCompiler_encodeFloat(num) {
  21871. var value = num.toString();
  21872. var m = /\.(\d*?)(?:9{5,20}|0{5,20})\d{0,2}(?:e(.+)|$)/.exec(value);
  21873. if (m) {
  21874. var epsilon = parseFloat('1e' + ((m[2] ? +m[2] : 0) + m[1].length));
  21875. value = (Math.round(num * epsilon) / epsilon).toString();
  21876. }
  21877. var nibbles = '';
  21878. var i, ii;
  21879. for (i = 0, ii = value.length; i < ii; ++i) {
  21880. var a = value[i];
  21881. if (a === 'e') {
  21882. nibbles += value[++i] === '-' ? 'c' : 'b';
  21883. } else if (a === '.') {
  21884. nibbles += 'a';
  21885. } else if (a === '-') {
  21886. nibbles += 'e';
  21887. } else {
  21888. nibbles += a;
  21889. }
  21890. }
  21891. nibbles += nibbles.length & 1 ? 'f' : 'ff';
  21892. var out = [30];
  21893. for (i = 0, ii = nibbles.length; i < ii; i += 2) {
  21894. out.push(parseInt(nibbles.substr(i, 2), 16));
  21895. }
  21896. return out;
  21897. },
  21898. encodeInteger: function CFFCompiler_encodeInteger(value) {
  21899. var code;
  21900. if (value >= -107 && value <= 107) {
  21901. code = [value + 139];
  21902. } else if (value >= 108 && value <= 1131) {
  21903. value = value - 108;
  21904. code = [
  21905. (value >> 8) + 247,
  21906. value & 0xFF
  21907. ];
  21908. } else if (value >= -1131 && value <= -108) {
  21909. value = -value - 108;
  21910. code = [
  21911. (value >> 8) + 251,
  21912. value & 0xFF
  21913. ];
  21914. } else if (value >= -32768 && value <= 32767) {
  21915. code = [
  21916. 0x1c,
  21917. value >> 8 & 0xFF,
  21918. value & 0xFF
  21919. ];
  21920. } else {
  21921. code = [
  21922. 0x1d,
  21923. value >> 24 & 0xFF,
  21924. value >> 16 & 0xFF,
  21925. value >> 8 & 0xFF,
  21926. value & 0xFF
  21927. ];
  21928. }
  21929. return code;
  21930. },
  21931. compileHeader: function CFFCompiler_compileHeader(header) {
  21932. return [
  21933. header.major,
  21934. header.minor,
  21935. header.hdrSize,
  21936. header.offSize
  21937. ];
  21938. },
  21939. compileNameIndex: function CFFCompiler_compileNameIndex(names) {
  21940. var nameIndex = new CFFIndex();
  21941. for (var i = 0, ii = names.length; i < ii; ++i) {
  21942. nameIndex.add(stringToBytes(names[i]));
  21943. }
  21944. return this.compileIndex(nameIndex);
  21945. },
  21946. compileTopDicts: function CFFCompiler_compileTopDicts(dicts, length, removeCidKeys) {
  21947. var fontDictTrackers = [];
  21948. var fdArrayIndex = new CFFIndex();
  21949. for (var i = 0, ii = dicts.length; i < ii; ++i) {
  21950. var fontDict = dicts[i];
  21951. if (removeCidKeys) {
  21952. fontDict.removeByName('CIDFontVersion');
  21953. fontDict.removeByName('CIDFontRevision');
  21954. fontDict.removeByName('CIDFontType');
  21955. fontDict.removeByName('CIDCount');
  21956. fontDict.removeByName('UIDBase');
  21957. }
  21958. var fontDictTracker = new CFFOffsetTracker();
  21959. var fontDictData = this.compileDict(fontDict, fontDictTracker);
  21960. fontDictTrackers.push(fontDictTracker);
  21961. fdArrayIndex.add(fontDictData);
  21962. fontDictTracker.offset(length);
  21963. }
  21964. fdArrayIndex = this.compileIndex(fdArrayIndex, fontDictTrackers);
  21965. return {
  21966. trackers: fontDictTrackers,
  21967. output: fdArrayIndex
  21968. };
  21969. },
  21970. compilePrivateDicts: function CFFCompiler_compilePrivateDicts(dicts, trackers, output) {
  21971. for (var i = 0, ii = dicts.length; i < ii; ++i) {
  21972. var fontDict = dicts[i];
  21973. assert(fontDict.privateDict && fontDict.hasName('Private'), 'There must be an private dictionary.');
  21974. var privateDict = fontDict.privateDict;
  21975. var privateDictTracker = new CFFOffsetTracker();
  21976. var privateDictData = this.compileDict(privateDict, privateDictTracker);
  21977. var outputLength = output.length;
  21978. privateDictTracker.offset(outputLength);
  21979. if (!privateDictData.length) {
  21980. outputLength = 0;
  21981. }
  21982. trackers[i].setEntryLocation('Private', [
  21983. privateDictData.length,
  21984. outputLength
  21985. ], output);
  21986. output.add(privateDictData);
  21987. if (privateDict.subrsIndex && privateDict.hasName('Subrs')) {
  21988. var subrs = this.compileIndex(privateDict.subrsIndex);
  21989. privateDictTracker.setEntryLocation('Subrs', [privateDictData.length], output);
  21990. output.add(subrs);
  21991. }
  21992. }
  21993. },
  21994. compileDict: function CFFCompiler_compileDict(dict, offsetTracker) {
  21995. var out = [];
  21996. var order = dict.order;
  21997. for (var i = 0; i < order.length; ++i) {
  21998. var key = order[i];
  21999. if (!(key in dict.values)) {
  22000. continue;
  22001. }
  22002. var values = dict.values[key];
  22003. var types = dict.types[key];
  22004. if (!isArray(types)) {
  22005. types = [types];
  22006. }
  22007. if (!isArray(values)) {
  22008. values = [values];
  22009. }
  22010. if (values.length === 0) {
  22011. continue;
  22012. }
  22013. for (var j = 0, jj = types.length; j < jj; ++j) {
  22014. var type = types[j];
  22015. var value = values[j];
  22016. switch (type) {
  22017. case 'num':
  22018. case 'sid':
  22019. out = out.concat(this.encodeNumber(value));
  22020. break;
  22021. case 'offset':
  22022. var name = dict.keyToNameMap[key];
  22023. if (!offsetTracker.isTracking(name)) {
  22024. offsetTracker.track(name, out.length);
  22025. }
  22026. out = out.concat([
  22027. 0x1d,
  22028. 0,
  22029. 0,
  22030. 0,
  22031. 0
  22032. ]);
  22033. break;
  22034. case 'array':
  22035. case 'delta':
  22036. out = out.concat(this.encodeNumber(value));
  22037. for (var k = 1, kk = values.length; k < kk; ++k) {
  22038. out = out.concat(this.encodeNumber(values[k]));
  22039. }
  22040. break;
  22041. default:
  22042. error('Unknown data type of ' + type);
  22043. break;
  22044. }
  22045. }
  22046. out = out.concat(dict.opcodes[key]);
  22047. }
  22048. return out;
  22049. },
  22050. compileStringIndex: function CFFCompiler_compileStringIndex(strings) {
  22051. var stringIndex = new CFFIndex();
  22052. for (var i = 0, ii = strings.length; i < ii; ++i) {
  22053. stringIndex.add(stringToBytes(strings[i]));
  22054. }
  22055. return this.compileIndex(stringIndex);
  22056. },
  22057. compileGlobalSubrIndex: function CFFCompiler_compileGlobalSubrIndex() {
  22058. var globalSubrIndex = this.cff.globalSubrIndex;
  22059. this.out.writeByteArray(this.compileIndex(globalSubrIndex));
  22060. },
  22061. compileCharStrings: function CFFCompiler_compileCharStrings(charStrings) {
  22062. return this.compileIndex(charStrings);
  22063. },
  22064. compileCharset: function CFFCompiler_compileCharset(charset) {
  22065. return this.compileTypedArray(charset.raw);
  22066. },
  22067. compileEncoding: function CFFCompiler_compileEncoding(encoding) {
  22068. return this.compileTypedArray(encoding.raw);
  22069. },
  22070. compileFDSelect: function CFFCompiler_compileFDSelect(fdSelect) {
  22071. return this.compileTypedArray(fdSelect);
  22072. },
  22073. compileTypedArray: function CFFCompiler_compileTypedArray(data) {
  22074. var out = [];
  22075. for (var i = 0, ii = data.length; i < ii; ++i) {
  22076. out[i] = data[i];
  22077. }
  22078. return out;
  22079. },
  22080. compileIndex: function CFFCompiler_compileIndex(index, trackers) {
  22081. trackers = trackers || [];
  22082. var objects = index.objects;
  22083. var count = objects.length;
  22084. if (count === 0) {
  22085. return [
  22086. 0,
  22087. 0,
  22088. 0
  22089. ];
  22090. }
  22091. var data = [
  22092. count >> 8 & 0xFF,
  22093. count & 0xff
  22094. ];
  22095. var lastOffset = 1, i;
  22096. for (i = 0; i < count; ++i) {
  22097. lastOffset += objects[i].length;
  22098. }
  22099. var offsetSize;
  22100. if (lastOffset < 0x100) {
  22101. offsetSize = 1;
  22102. } else if (lastOffset < 0x10000) {
  22103. offsetSize = 2;
  22104. } else if (lastOffset < 0x1000000) {
  22105. offsetSize = 3;
  22106. } else {
  22107. offsetSize = 4;
  22108. }
  22109. data.push(offsetSize);
  22110. var relativeOffset = 1;
  22111. for (i = 0; i < count + 1; i++) {
  22112. if (offsetSize === 1) {
  22113. data.push(relativeOffset & 0xFF);
  22114. } else if (offsetSize === 2) {
  22115. data.push(relativeOffset >> 8 & 0xFF, relativeOffset & 0xFF);
  22116. } else if (offsetSize === 3) {
  22117. data.push(relativeOffset >> 16 & 0xFF, relativeOffset >> 8 & 0xFF, relativeOffset & 0xFF);
  22118. } else {
  22119. data.push(relativeOffset >>> 24 & 0xFF, relativeOffset >> 16 & 0xFF, relativeOffset >> 8 & 0xFF, relativeOffset & 0xFF);
  22120. }
  22121. if (objects[i]) {
  22122. relativeOffset += objects[i].length;
  22123. }
  22124. }
  22125. for (i = 0; i < count; i++) {
  22126. if (trackers[i]) {
  22127. trackers[i].offset(data.length);
  22128. }
  22129. for (var j = 0, jj = objects[i].length; j < jj; j++) {
  22130. data.push(objects[i][j]);
  22131. }
  22132. }
  22133. return data;
  22134. }
  22135. };
  22136. return CFFCompiler;
  22137. }();
  22138. exports.CFFStandardStrings = CFFStandardStrings;
  22139. exports.CFFParser = CFFParser;
  22140. exports.CFF = CFF;
  22141. exports.CFFHeader = CFFHeader;
  22142. exports.CFFStrings = CFFStrings;
  22143. exports.CFFIndex = CFFIndex;
  22144. exports.CFFCharset = CFFCharset;
  22145. exports.CFFTopDict = CFFTopDict;
  22146. exports.CFFPrivateDict = CFFPrivateDict;
  22147. exports.CFFCompiler = CFFCompiler;
  22148. /***/ }),
  22149. /* 11 */
  22150. /***/ (function(module, exports, __w_pdfjs_require__) {
  22151. "use strict";
  22152. var sharedUtil = __w_pdfjs_require__(0);
  22153. var MissingDataException = sharedUtil.MissingDataException;
  22154. var arrayByteLength = sharedUtil.arrayByteLength;
  22155. var arraysToBytes = sharedUtil.arraysToBytes;
  22156. var assert = sharedUtil.assert;
  22157. var createPromiseCapability = sharedUtil.createPromiseCapability;
  22158. var isInt = sharedUtil.isInt;
  22159. var isEmptyObj = sharedUtil.isEmptyObj;
  22160. var ChunkedStream = function ChunkedStreamClosure() {
  22161. function ChunkedStream(length, chunkSize, manager) {
  22162. this.bytes = new Uint8Array(length);
  22163. this.start = 0;
  22164. this.pos = 0;
  22165. this.end = length;
  22166. this.chunkSize = chunkSize;
  22167. this.loadedChunks = [];
  22168. this.numChunksLoaded = 0;
  22169. this.numChunks = Math.ceil(length / chunkSize);
  22170. this.manager = manager;
  22171. this.progressiveDataLength = 0;
  22172. this.lastSuccessfulEnsureByteChunk = -1;
  22173. }
  22174. ChunkedStream.prototype = {
  22175. getMissingChunks: function ChunkedStream_getMissingChunks() {
  22176. var chunks = [];
  22177. for (var chunk = 0, n = this.numChunks; chunk < n; ++chunk) {
  22178. if (!this.loadedChunks[chunk]) {
  22179. chunks.push(chunk);
  22180. }
  22181. }
  22182. return chunks;
  22183. },
  22184. getBaseStreams: function ChunkedStream_getBaseStreams() {
  22185. return [this];
  22186. },
  22187. allChunksLoaded: function ChunkedStream_allChunksLoaded() {
  22188. return this.numChunksLoaded === this.numChunks;
  22189. },
  22190. onReceiveData: function ChunkedStream_onReceiveData(begin, chunk) {
  22191. var end = begin + chunk.byteLength;
  22192. assert(begin % this.chunkSize === 0, 'Bad begin offset: ' + begin);
  22193. var length = this.bytes.length;
  22194. assert(end % this.chunkSize === 0 || end === length, 'Bad end offset: ' + end);
  22195. this.bytes.set(new Uint8Array(chunk), begin);
  22196. var chunkSize = this.chunkSize;
  22197. var beginChunk = Math.floor(begin / chunkSize);
  22198. var endChunk = Math.floor((end - 1) / chunkSize) + 1;
  22199. var curChunk;
  22200. for (curChunk = beginChunk; curChunk < endChunk; ++curChunk) {
  22201. if (!this.loadedChunks[curChunk]) {
  22202. this.loadedChunks[curChunk] = true;
  22203. ++this.numChunksLoaded;
  22204. }
  22205. }
  22206. },
  22207. onReceiveProgressiveData: function ChunkedStream_onReceiveProgressiveData(data) {
  22208. var position = this.progressiveDataLength;
  22209. var beginChunk = Math.floor(position / this.chunkSize);
  22210. this.bytes.set(new Uint8Array(data), position);
  22211. position += data.byteLength;
  22212. this.progressiveDataLength = position;
  22213. var endChunk = position >= this.end ? this.numChunks : Math.floor(position / this.chunkSize);
  22214. var curChunk;
  22215. for (curChunk = beginChunk; curChunk < endChunk; ++curChunk) {
  22216. if (!this.loadedChunks[curChunk]) {
  22217. this.loadedChunks[curChunk] = true;
  22218. ++this.numChunksLoaded;
  22219. }
  22220. }
  22221. },
  22222. ensureByte: function ChunkedStream_ensureByte(pos) {
  22223. var chunk = Math.floor(pos / this.chunkSize);
  22224. if (chunk === this.lastSuccessfulEnsureByteChunk) {
  22225. return;
  22226. }
  22227. if (!this.loadedChunks[chunk]) {
  22228. throw new MissingDataException(pos, pos + 1);
  22229. }
  22230. this.lastSuccessfulEnsureByteChunk = chunk;
  22231. },
  22232. ensureRange: function ChunkedStream_ensureRange(begin, end) {
  22233. if (begin >= end) {
  22234. return;
  22235. }
  22236. if (end <= this.progressiveDataLength) {
  22237. return;
  22238. }
  22239. var chunkSize = this.chunkSize;
  22240. var beginChunk = Math.floor(begin / chunkSize);
  22241. var endChunk = Math.floor((end - 1) / chunkSize) + 1;
  22242. for (var chunk = beginChunk; chunk < endChunk; ++chunk) {
  22243. if (!this.loadedChunks[chunk]) {
  22244. throw new MissingDataException(begin, end);
  22245. }
  22246. }
  22247. },
  22248. nextEmptyChunk: function ChunkedStream_nextEmptyChunk(beginChunk) {
  22249. var chunk, numChunks = this.numChunks;
  22250. for (var i = 0; i < numChunks; ++i) {
  22251. chunk = (beginChunk + i) % numChunks;
  22252. if (!this.loadedChunks[chunk]) {
  22253. return chunk;
  22254. }
  22255. }
  22256. return null;
  22257. },
  22258. hasChunk: function ChunkedStream_hasChunk(chunk) {
  22259. return !!this.loadedChunks[chunk];
  22260. },
  22261. get length() {
  22262. return this.end - this.start;
  22263. },
  22264. get isEmpty() {
  22265. return this.length === 0;
  22266. },
  22267. getByte: function ChunkedStream_getByte() {
  22268. var pos = this.pos;
  22269. if (pos >= this.end) {
  22270. return -1;
  22271. }
  22272. this.ensureByte(pos);
  22273. return this.bytes[this.pos++];
  22274. },
  22275. getUint16: function ChunkedStream_getUint16() {
  22276. var b0 = this.getByte();
  22277. var b1 = this.getByte();
  22278. if (b0 === -1 || b1 === -1) {
  22279. return -1;
  22280. }
  22281. return (b0 << 8) + b1;
  22282. },
  22283. getInt32: function ChunkedStream_getInt32() {
  22284. var b0 = this.getByte();
  22285. var b1 = this.getByte();
  22286. var b2 = this.getByte();
  22287. var b3 = this.getByte();
  22288. return (b0 << 24) + (b1 << 16) + (b2 << 8) + b3;
  22289. },
  22290. getBytes: function ChunkedStream_getBytes(length) {
  22291. var bytes = this.bytes;
  22292. var pos = this.pos;
  22293. var strEnd = this.end;
  22294. if (!length) {
  22295. this.ensureRange(pos, strEnd);
  22296. return bytes.subarray(pos, strEnd);
  22297. }
  22298. var end = pos + length;
  22299. if (end > strEnd) {
  22300. end = strEnd;
  22301. }
  22302. this.ensureRange(pos, end);
  22303. this.pos = end;
  22304. return bytes.subarray(pos, end);
  22305. },
  22306. peekByte: function ChunkedStream_peekByte() {
  22307. var peekedByte = this.getByte();
  22308. this.pos--;
  22309. return peekedByte;
  22310. },
  22311. peekBytes: function ChunkedStream_peekBytes(length) {
  22312. var bytes = this.getBytes(length);
  22313. this.pos -= bytes.length;
  22314. return bytes;
  22315. },
  22316. getByteRange: function ChunkedStream_getBytes(begin, end) {
  22317. this.ensureRange(begin, end);
  22318. return this.bytes.subarray(begin, end);
  22319. },
  22320. skip: function ChunkedStream_skip(n) {
  22321. if (!n) {
  22322. n = 1;
  22323. }
  22324. this.pos += n;
  22325. },
  22326. reset: function ChunkedStream_reset() {
  22327. this.pos = this.start;
  22328. },
  22329. moveStart: function ChunkedStream_moveStart() {
  22330. this.start = this.pos;
  22331. },
  22332. makeSubStream: function ChunkedStream_makeSubStream(start, length, dict) {
  22333. this.ensureRange(start, start + length);
  22334. function ChunkedStreamSubstream() {
  22335. }
  22336. ChunkedStreamSubstream.prototype = Object.create(this);
  22337. ChunkedStreamSubstream.prototype.getMissingChunks = function () {
  22338. var chunkSize = this.chunkSize;
  22339. var beginChunk = Math.floor(this.start / chunkSize);
  22340. var endChunk = Math.floor((this.end - 1) / chunkSize) + 1;
  22341. var missingChunks = [];
  22342. for (var chunk = beginChunk; chunk < endChunk; ++chunk) {
  22343. if (!this.loadedChunks[chunk]) {
  22344. missingChunks.push(chunk);
  22345. }
  22346. }
  22347. return missingChunks;
  22348. };
  22349. var subStream = new ChunkedStreamSubstream();
  22350. subStream.pos = subStream.start = start;
  22351. subStream.end = start + length || this.end;
  22352. subStream.dict = dict;
  22353. return subStream;
  22354. }
  22355. };
  22356. return ChunkedStream;
  22357. }();
  22358. var ChunkedStreamManager = function ChunkedStreamManagerClosure() {
  22359. function ChunkedStreamManager(pdfNetworkStream, args) {
  22360. var chunkSize = args.rangeChunkSize;
  22361. var length = args.length;
  22362. this.stream = new ChunkedStream(length, chunkSize, this);
  22363. this.length = length;
  22364. this.chunkSize = chunkSize;
  22365. this.pdfNetworkStream = pdfNetworkStream;
  22366. this.url = args.url;
  22367. this.disableAutoFetch = args.disableAutoFetch;
  22368. this.msgHandler = args.msgHandler;
  22369. this.currRequestId = 0;
  22370. this.chunksNeededByRequest = Object.create(null);
  22371. this.requestsByChunk = Object.create(null);
  22372. this.promisesByRequest = Object.create(null);
  22373. this.progressiveDataLength = 0;
  22374. this.aborted = false;
  22375. this._loadedStreamCapability = createPromiseCapability();
  22376. }
  22377. ChunkedStreamManager.prototype = {
  22378. onLoadedStream: function ChunkedStreamManager_getLoadedStream() {
  22379. return this._loadedStreamCapability.promise;
  22380. },
  22381. sendRequest: function ChunkedStreamManager_sendRequest(begin, end) {
  22382. var rangeReader = this.pdfNetworkStream.getRangeReader(begin, end);
  22383. if (!rangeReader.isStreamingSupported) {
  22384. rangeReader.onProgress = this.onProgress.bind(this);
  22385. }
  22386. var chunks = [], loaded = 0;
  22387. var manager = this;
  22388. var promise = new Promise(function (resolve, reject) {
  22389. var readChunk = function (chunk) {
  22390. try {
  22391. if (!chunk.done) {
  22392. var data = chunk.value;
  22393. chunks.push(data);
  22394. loaded += arrayByteLength(data);
  22395. if (rangeReader.isStreamingSupported) {
  22396. manager.onProgress({ loaded: loaded });
  22397. }
  22398. rangeReader.read().then(readChunk, reject);
  22399. return;
  22400. }
  22401. var chunkData = arraysToBytes(chunks);
  22402. chunks = null;
  22403. resolve(chunkData);
  22404. } catch (e) {
  22405. reject(e);
  22406. }
  22407. };
  22408. rangeReader.read().then(readChunk, reject);
  22409. });
  22410. promise.then(function (data) {
  22411. if (this.aborted) {
  22412. return;
  22413. }
  22414. this.onReceiveData({
  22415. chunk: data,
  22416. begin: begin
  22417. });
  22418. }.bind(this));
  22419. },
  22420. requestAllChunks: function ChunkedStreamManager_requestAllChunks() {
  22421. var missingChunks = this.stream.getMissingChunks();
  22422. this._requestChunks(missingChunks);
  22423. return this._loadedStreamCapability.promise;
  22424. },
  22425. _requestChunks: function ChunkedStreamManager_requestChunks(chunks) {
  22426. var requestId = this.currRequestId++;
  22427. var i, ii;
  22428. var chunksNeeded = Object.create(null);
  22429. this.chunksNeededByRequest[requestId] = chunksNeeded;
  22430. for (i = 0, ii = chunks.length; i < ii; i++) {
  22431. if (!this.stream.hasChunk(chunks[i])) {
  22432. chunksNeeded[chunks[i]] = true;
  22433. }
  22434. }
  22435. if (isEmptyObj(chunksNeeded)) {
  22436. return Promise.resolve();
  22437. }
  22438. var capability = createPromiseCapability();
  22439. this.promisesByRequest[requestId] = capability;
  22440. var chunksToRequest = [];
  22441. for (var chunk in chunksNeeded) {
  22442. chunk = chunk | 0;
  22443. if (!(chunk in this.requestsByChunk)) {
  22444. this.requestsByChunk[chunk] = [];
  22445. chunksToRequest.push(chunk);
  22446. }
  22447. this.requestsByChunk[chunk].push(requestId);
  22448. }
  22449. if (!chunksToRequest.length) {
  22450. return capability.promise;
  22451. }
  22452. var groupedChunksToRequest = this.groupChunks(chunksToRequest);
  22453. for (i = 0; i < groupedChunksToRequest.length; ++i) {
  22454. var groupedChunk = groupedChunksToRequest[i];
  22455. var begin = groupedChunk.beginChunk * this.chunkSize;
  22456. var end = Math.min(groupedChunk.endChunk * this.chunkSize, this.length);
  22457. this.sendRequest(begin, end);
  22458. }
  22459. return capability.promise;
  22460. },
  22461. getStream: function ChunkedStreamManager_getStream() {
  22462. return this.stream;
  22463. },
  22464. requestRange: function ChunkedStreamManager_requestRange(begin, end) {
  22465. end = Math.min(end, this.length);
  22466. var beginChunk = this.getBeginChunk(begin);
  22467. var endChunk = this.getEndChunk(end);
  22468. var chunks = [];
  22469. for (var chunk = beginChunk; chunk < endChunk; ++chunk) {
  22470. chunks.push(chunk);
  22471. }
  22472. return this._requestChunks(chunks);
  22473. },
  22474. requestRanges: function ChunkedStreamManager_requestRanges(ranges) {
  22475. ranges = ranges || [];
  22476. var chunksToRequest = [];
  22477. for (var i = 0; i < ranges.length; i++) {
  22478. var beginChunk = this.getBeginChunk(ranges[i].begin);
  22479. var endChunk = this.getEndChunk(ranges[i].end);
  22480. for (var chunk = beginChunk; chunk < endChunk; ++chunk) {
  22481. if (chunksToRequest.indexOf(chunk) < 0) {
  22482. chunksToRequest.push(chunk);
  22483. }
  22484. }
  22485. }
  22486. chunksToRequest.sort(function (a, b) {
  22487. return a - b;
  22488. });
  22489. return this._requestChunks(chunksToRequest);
  22490. },
  22491. groupChunks: function ChunkedStreamManager_groupChunks(chunks) {
  22492. var groupedChunks = [];
  22493. var beginChunk = -1;
  22494. var prevChunk = -1;
  22495. for (var i = 0; i < chunks.length; ++i) {
  22496. var chunk = chunks[i];
  22497. if (beginChunk < 0) {
  22498. beginChunk = chunk;
  22499. }
  22500. if (prevChunk >= 0 && prevChunk + 1 !== chunk) {
  22501. groupedChunks.push({
  22502. beginChunk: beginChunk,
  22503. endChunk: prevChunk + 1
  22504. });
  22505. beginChunk = chunk;
  22506. }
  22507. if (i + 1 === chunks.length) {
  22508. groupedChunks.push({
  22509. beginChunk: beginChunk,
  22510. endChunk: chunk + 1
  22511. });
  22512. }
  22513. prevChunk = chunk;
  22514. }
  22515. return groupedChunks;
  22516. },
  22517. onProgress: function ChunkedStreamManager_onProgress(args) {
  22518. var bytesLoaded = this.stream.numChunksLoaded * this.chunkSize + args.loaded;
  22519. this.msgHandler.send('DocProgress', {
  22520. loaded: bytesLoaded,
  22521. total: this.length
  22522. });
  22523. },
  22524. onReceiveData: function ChunkedStreamManager_onReceiveData(args) {
  22525. var chunk = args.chunk;
  22526. var isProgressive = args.begin === undefined;
  22527. var begin = isProgressive ? this.progressiveDataLength : args.begin;
  22528. var end = begin + chunk.byteLength;
  22529. var beginChunk = Math.floor(begin / this.chunkSize);
  22530. var endChunk = end < this.length ? Math.floor(end / this.chunkSize) : Math.ceil(end / this.chunkSize);
  22531. if (isProgressive) {
  22532. this.stream.onReceiveProgressiveData(chunk);
  22533. this.progressiveDataLength = end;
  22534. } else {
  22535. this.stream.onReceiveData(begin, chunk);
  22536. }
  22537. if (this.stream.allChunksLoaded()) {
  22538. this._loadedStreamCapability.resolve(this.stream);
  22539. }
  22540. var loadedRequests = [];
  22541. var i, requestId;
  22542. for (chunk = beginChunk; chunk < endChunk; ++chunk) {
  22543. var requestIds = this.requestsByChunk[chunk] || [];
  22544. delete this.requestsByChunk[chunk];
  22545. for (i = 0; i < requestIds.length; ++i) {
  22546. requestId = requestIds[i];
  22547. var chunksNeeded = this.chunksNeededByRequest[requestId];
  22548. if (chunk in chunksNeeded) {
  22549. delete chunksNeeded[chunk];
  22550. }
  22551. if (!isEmptyObj(chunksNeeded)) {
  22552. continue;
  22553. }
  22554. loadedRequests.push(requestId);
  22555. }
  22556. }
  22557. if (!this.disableAutoFetch && isEmptyObj(this.requestsByChunk)) {
  22558. var nextEmptyChunk;
  22559. if (this.stream.numChunksLoaded === 1) {
  22560. var lastChunk = this.stream.numChunks - 1;
  22561. if (!this.stream.hasChunk(lastChunk)) {
  22562. nextEmptyChunk = lastChunk;
  22563. }
  22564. } else {
  22565. nextEmptyChunk = this.stream.nextEmptyChunk(endChunk);
  22566. }
  22567. if (isInt(nextEmptyChunk)) {
  22568. this._requestChunks([nextEmptyChunk]);
  22569. }
  22570. }
  22571. for (i = 0; i < loadedRequests.length; ++i) {
  22572. requestId = loadedRequests[i];
  22573. var capability = this.promisesByRequest[requestId];
  22574. delete this.promisesByRequest[requestId];
  22575. capability.resolve();
  22576. }
  22577. this.msgHandler.send('DocProgress', {
  22578. loaded: this.stream.numChunksLoaded * this.chunkSize,
  22579. total: this.length
  22580. });
  22581. },
  22582. onError: function ChunkedStreamManager_onError(err) {
  22583. this._loadedStreamCapability.reject(err);
  22584. },
  22585. getBeginChunk: function ChunkedStreamManager_getBeginChunk(begin) {
  22586. var chunk = Math.floor(begin / this.chunkSize);
  22587. return chunk;
  22588. },
  22589. getEndChunk: function ChunkedStreamManager_getEndChunk(end) {
  22590. var chunk = Math.floor((end - 1) / this.chunkSize) + 1;
  22591. return chunk;
  22592. },
  22593. abort: function ChunkedStreamManager_abort() {
  22594. this.aborted = true;
  22595. if (this.pdfNetworkStream) {
  22596. this.pdfNetworkStream.cancelAllRequests('abort');
  22597. }
  22598. for (var requestId in this.promisesByRequest) {
  22599. var capability = this.promisesByRequest[requestId];
  22600. capability.reject(new Error('Request was aborted'));
  22601. }
  22602. }
  22603. };
  22604. return ChunkedStreamManager;
  22605. }();
  22606. exports.ChunkedStream = ChunkedStream;
  22607. exports.ChunkedStreamManager = ChunkedStreamManager;
  22608. /***/ }),
  22609. /* 12 */
  22610. /***/ (function(module, exports, __w_pdfjs_require__) {
  22611. "use strict";
  22612. var sharedUtil = __w_pdfjs_require__(0);
  22613. var corePrimitives = __w_pdfjs_require__(1);
  22614. var coreStream = __w_pdfjs_require__(2);
  22615. var PasswordException = sharedUtil.PasswordException;
  22616. var PasswordResponses = sharedUtil.PasswordResponses;
  22617. var bytesToString = sharedUtil.bytesToString;
  22618. var warn = sharedUtil.warn;
  22619. var error = sharedUtil.error;
  22620. var assert = sharedUtil.assert;
  22621. var isInt = sharedUtil.isInt;
  22622. var stringToBytes = sharedUtil.stringToBytes;
  22623. var utf8StringToString = sharedUtil.utf8StringToString;
  22624. var Name = corePrimitives.Name;
  22625. var isName = corePrimitives.isName;
  22626. var isDict = corePrimitives.isDict;
  22627. var DecryptStream = coreStream.DecryptStream;
  22628. var ARCFourCipher = function ARCFourCipherClosure() {
  22629. function ARCFourCipher(key) {
  22630. this.a = 0;
  22631. this.b = 0;
  22632. var s = new Uint8Array(256);
  22633. var i, j = 0, tmp, keyLength = key.length;
  22634. for (i = 0; i < 256; ++i) {
  22635. s[i] = i;
  22636. }
  22637. for (i = 0; i < 256; ++i) {
  22638. tmp = s[i];
  22639. j = j + tmp + key[i % keyLength] & 0xFF;
  22640. s[i] = s[j];
  22641. s[j] = tmp;
  22642. }
  22643. this.s = s;
  22644. }
  22645. ARCFourCipher.prototype = {
  22646. encryptBlock: function ARCFourCipher_encryptBlock(data) {
  22647. var i, n = data.length, tmp, tmp2;
  22648. var a = this.a, b = this.b, s = this.s;
  22649. var output = new Uint8Array(n);
  22650. for (i = 0; i < n; ++i) {
  22651. a = a + 1 & 0xFF;
  22652. tmp = s[a];
  22653. b = b + tmp & 0xFF;
  22654. tmp2 = s[b];
  22655. s[a] = tmp2;
  22656. s[b] = tmp;
  22657. output[i] = data[i] ^ s[tmp + tmp2 & 0xFF];
  22658. }
  22659. this.a = a;
  22660. this.b = b;
  22661. return output;
  22662. }
  22663. };
  22664. ARCFourCipher.prototype.decryptBlock = ARCFourCipher.prototype.encryptBlock;
  22665. return ARCFourCipher;
  22666. }();
  22667. var calculateMD5 = function calculateMD5Closure() {
  22668. var r = new Uint8Array([
  22669. 7,
  22670. 12,
  22671. 17,
  22672. 22,
  22673. 7,
  22674. 12,
  22675. 17,
  22676. 22,
  22677. 7,
  22678. 12,
  22679. 17,
  22680. 22,
  22681. 7,
  22682. 12,
  22683. 17,
  22684. 22,
  22685. 5,
  22686. 9,
  22687. 14,
  22688. 20,
  22689. 5,
  22690. 9,
  22691. 14,
  22692. 20,
  22693. 5,
  22694. 9,
  22695. 14,
  22696. 20,
  22697. 5,
  22698. 9,
  22699. 14,
  22700. 20,
  22701. 4,
  22702. 11,
  22703. 16,
  22704. 23,
  22705. 4,
  22706. 11,
  22707. 16,
  22708. 23,
  22709. 4,
  22710. 11,
  22711. 16,
  22712. 23,
  22713. 4,
  22714. 11,
  22715. 16,
  22716. 23,
  22717. 6,
  22718. 10,
  22719. 15,
  22720. 21,
  22721. 6,
  22722. 10,
  22723. 15,
  22724. 21,
  22725. 6,
  22726. 10,
  22727. 15,
  22728. 21,
  22729. 6,
  22730. 10,
  22731. 15,
  22732. 21
  22733. ]);
  22734. var k = new Int32Array([
  22735. -680876936,
  22736. -389564586,
  22737. 606105819,
  22738. -1044525330,
  22739. -176418897,
  22740. 1200080426,
  22741. -1473231341,
  22742. -45705983,
  22743. 1770035416,
  22744. -1958414417,
  22745. -42063,
  22746. -1990404162,
  22747. 1804603682,
  22748. -40341101,
  22749. -1502002290,
  22750. 1236535329,
  22751. -165796510,
  22752. -1069501632,
  22753. 643717713,
  22754. -373897302,
  22755. -701558691,
  22756. 38016083,
  22757. -660478335,
  22758. -405537848,
  22759. 568446438,
  22760. -1019803690,
  22761. -187363961,
  22762. 1163531501,
  22763. -1444681467,
  22764. -51403784,
  22765. 1735328473,
  22766. -1926607734,
  22767. -378558,
  22768. -2022574463,
  22769. 1839030562,
  22770. -35309556,
  22771. -1530992060,
  22772. 1272893353,
  22773. -155497632,
  22774. -1094730640,
  22775. 681279174,
  22776. -358537222,
  22777. -722521979,
  22778. 76029189,
  22779. -640364487,
  22780. -421815835,
  22781. 530742520,
  22782. -995338651,
  22783. -198630844,
  22784. 1126891415,
  22785. -1416354905,
  22786. -57434055,
  22787. 1700485571,
  22788. -1894986606,
  22789. -1051523,
  22790. -2054922799,
  22791. 1873313359,
  22792. -30611744,
  22793. -1560198380,
  22794. 1309151649,
  22795. -145523070,
  22796. -1120210379,
  22797. 718787259,
  22798. -343485551
  22799. ]);
  22800. function hash(data, offset, length) {
  22801. var h0 = 1732584193, h1 = -271733879, h2 = -1732584194, h3 = 271733878;
  22802. var paddedLength = length + 72 & ~63;
  22803. var padded = new Uint8Array(paddedLength);
  22804. var i, j, n;
  22805. for (i = 0; i < length; ++i) {
  22806. padded[i] = data[offset++];
  22807. }
  22808. padded[i++] = 0x80;
  22809. n = paddedLength - 8;
  22810. while (i < n) {
  22811. padded[i++] = 0;
  22812. }
  22813. padded[i++] = length << 3 & 0xFF;
  22814. padded[i++] = length >> 5 & 0xFF;
  22815. padded[i++] = length >> 13 & 0xFF;
  22816. padded[i++] = length >> 21 & 0xFF;
  22817. padded[i++] = length >>> 29 & 0xFF;
  22818. padded[i++] = 0;
  22819. padded[i++] = 0;
  22820. padded[i++] = 0;
  22821. var w = new Int32Array(16);
  22822. for (i = 0; i < paddedLength;) {
  22823. for (j = 0; j < 16; ++j, i += 4) {
  22824. w[j] = padded[i] | padded[i + 1] << 8 | padded[i + 2] << 16 | padded[i + 3] << 24;
  22825. }
  22826. var a = h0, b = h1, c = h2, d = h3, f, g;
  22827. for (j = 0; j < 64; ++j) {
  22828. if (j < 16) {
  22829. f = b & c | ~b & d;
  22830. g = j;
  22831. } else if (j < 32) {
  22832. f = d & b | ~d & c;
  22833. g = 5 * j + 1 & 15;
  22834. } else if (j < 48) {
  22835. f = b ^ c ^ d;
  22836. g = 3 * j + 5 & 15;
  22837. } else {
  22838. f = c ^ (b | ~d);
  22839. g = 7 * j & 15;
  22840. }
  22841. var tmp = d, rotateArg = a + f + k[j] + w[g] | 0, rotate = r[j];
  22842. d = c;
  22843. c = b;
  22844. b = b + (rotateArg << rotate | rotateArg >>> 32 - rotate) | 0;
  22845. a = tmp;
  22846. }
  22847. h0 = h0 + a | 0;
  22848. h1 = h1 + b | 0;
  22849. h2 = h2 + c | 0;
  22850. h3 = h3 + d | 0;
  22851. }
  22852. return new Uint8Array([
  22853. h0 & 0xFF,
  22854. h0 >> 8 & 0xFF,
  22855. h0 >> 16 & 0xFF,
  22856. h0 >>> 24 & 0xFF,
  22857. h1 & 0xFF,
  22858. h1 >> 8 & 0xFF,
  22859. h1 >> 16 & 0xFF,
  22860. h1 >>> 24 & 0xFF,
  22861. h2 & 0xFF,
  22862. h2 >> 8 & 0xFF,
  22863. h2 >> 16 & 0xFF,
  22864. h2 >>> 24 & 0xFF,
  22865. h3 & 0xFF,
  22866. h3 >> 8 & 0xFF,
  22867. h3 >> 16 & 0xFF,
  22868. h3 >>> 24 & 0xFF
  22869. ]);
  22870. }
  22871. return hash;
  22872. }();
  22873. var Word64 = function Word64Closure() {
  22874. function Word64(highInteger, lowInteger) {
  22875. this.high = highInteger | 0;
  22876. this.low = lowInteger | 0;
  22877. }
  22878. Word64.prototype = {
  22879. and: function Word64_and(word) {
  22880. this.high &= word.high;
  22881. this.low &= word.low;
  22882. },
  22883. xor: function Word64_xor(word) {
  22884. this.high ^= word.high;
  22885. this.low ^= word.low;
  22886. },
  22887. or: function Word64_or(word) {
  22888. this.high |= word.high;
  22889. this.low |= word.low;
  22890. },
  22891. shiftRight: function Word64_shiftRight(places) {
  22892. if (places >= 32) {
  22893. this.low = this.high >>> places - 32 | 0;
  22894. this.high = 0;
  22895. } else {
  22896. this.low = this.low >>> places | this.high << 32 - places;
  22897. this.high = this.high >>> places | 0;
  22898. }
  22899. },
  22900. shiftLeft: function Word64_shiftLeft(places) {
  22901. if (places >= 32) {
  22902. this.high = this.low << places - 32;
  22903. this.low = 0;
  22904. } else {
  22905. this.high = this.high << places | this.low >>> 32 - places;
  22906. this.low = this.low << places;
  22907. }
  22908. },
  22909. rotateRight: function Word64_rotateRight(places) {
  22910. var low, high;
  22911. if (places & 32) {
  22912. high = this.low;
  22913. low = this.high;
  22914. } else {
  22915. low = this.low;
  22916. high = this.high;
  22917. }
  22918. places &= 31;
  22919. this.low = low >>> places | high << 32 - places;
  22920. this.high = high >>> places | low << 32 - places;
  22921. },
  22922. not: function Word64_not() {
  22923. this.high = ~this.high;
  22924. this.low = ~this.low;
  22925. },
  22926. add: function Word64_add(word) {
  22927. var lowAdd = (this.low >>> 0) + (word.low >>> 0);
  22928. var highAdd = (this.high >>> 0) + (word.high >>> 0);
  22929. if (lowAdd > 0xFFFFFFFF) {
  22930. highAdd += 1;
  22931. }
  22932. this.low = lowAdd | 0;
  22933. this.high = highAdd | 0;
  22934. },
  22935. copyTo: function Word64_copyTo(bytes, offset) {
  22936. bytes[offset] = this.high >>> 24 & 0xFF;
  22937. bytes[offset + 1] = this.high >> 16 & 0xFF;
  22938. bytes[offset + 2] = this.high >> 8 & 0xFF;
  22939. bytes[offset + 3] = this.high & 0xFF;
  22940. bytes[offset + 4] = this.low >>> 24 & 0xFF;
  22941. bytes[offset + 5] = this.low >> 16 & 0xFF;
  22942. bytes[offset + 6] = this.low >> 8 & 0xFF;
  22943. bytes[offset + 7] = this.low & 0xFF;
  22944. },
  22945. assign: function Word64_assign(word) {
  22946. this.high = word.high;
  22947. this.low = word.low;
  22948. }
  22949. };
  22950. return Word64;
  22951. }();
  22952. var calculateSHA256 = function calculateSHA256Closure() {
  22953. function rotr(x, n) {
  22954. return x >>> n | x << 32 - n;
  22955. }
  22956. function ch(x, y, z) {
  22957. return x & y ^ ~x & z;
  22958. }
  22959. function maj(x, y, z) {
  22960. return x & y ^ x & z ^ y & z;
  22961. }
  22962. function sigma(x) {
  22963. return rotr(x, 2) ^ rotr(x, 13) ^ rotr(x, 22);
  22964. }
  22965. function sigmaPrime(x) {
  22966. return rotr(x, 6) ^ rotr(x, 11) ^ rotr(x, 25);
  22967. }
  22968. function littleSigma(x) {
  22969. return rotr(x, 7) ^ rotr(x, 18) ^ x >>> 3;
  22970. }
  22971. function littleSigmaPrime(x) {
  22972. return rotr(x, 17) ^ rotr(x, 19) ^ x >>> 10;
  22973. }
  22974. var k = [
  22975. 0x428a2f98,
  22976. 0x71374491,
  22977. 0xb5c0fbcf,
  22978. 0xe9b5dba5,
  22979. 0x3956c25b,
  22980. 0x59f111f1,
  22981. 0x923f82a4,
  22982. 0xab1c5ed5,
  22983. 0xd807aa98,
  22984. 0x12835b01,
  22985. 0x243185be,
  22986. 0x550c7dc3,
  22987. 0x72be5d74,
  22988. 0x80deb1fe,
  22989. 0x9bdc06a7,
  22990. 0xc19bf174,
  22991. 0xe49b69c1,
  22992. 0xefbe4786,
  22993. 0x0fc19dc6,
  22994. 0x240ca1cc,
  22995. 0x2de92c6f,
  22996. 0x4a7484aa,
  22997. 0x5cb0a9dc,
  22998. 0x76f988da,
  22999. 0x983e5152,
  23000. 0xa831c66d,
  23001. 0xb00327c8,
  23002. 0xbf597fc7,
  23003. 0xc6e00bf3,
  23004. 0xd5a79147,
  23005. 0x06ca6351,
  23006. 0x14292967,
  23007. 0x27b70a85,
  23008. 0x2e1b2138,
  23009. 0x4d2c6dfc,
  23010. 0x53380d13,
  23011. 0x650a7354,
  23012. 0x766a0abb,
  23013. 0x81c2c92e,
  23014. 0x92722c85,
  23015. 0xa2bfe8a1,
  23016. 0xa81a664b,
  23017. 0xc24b8b70,
  23018. 0xc76c51a3,
  23019. 0xd192e819,
  23020. 0xd6990624,
  23021. 0xf40e3585,
  23022. 0x106aa070,
  23023. 0x19a4c116,
  23024. 0x1e376c08,
  23025. 0x2748774c,
  23026. 0x34b0bcb5,
  23027. 0x391c0cb3,
  23028. 0x4ed8aa4a,
  23029. 0x5b9cca4f,
  23030. 0x682e6ff3,
  23031. 0x748f82ee,
  23032. 0x78a5636f,
  23033. 0x84c87814,
  23034. 0x8cc70208,
  23035. 0x90befffa,
  23036. 0xa4506ceb,
  23037. 0xbef9a3f7,
  23038. 0xc67178f2
  23039. ];
  23040. function hash(data, offset, length) {
  23041. var h0 = 0x6a09e667, h1 = 0xbb67ae85, h2 = 0x3c6ef372, h3 = 0xa54ff53a, h4 = 0x510e527f, h5 = 0x9b05688c, h6 = 0x1f83d9ab, h7 = 0x5be0cd19;
  23042. var paddedLength = Math.ceil((length + 9) / 64) * 64;
  23043. var padded = new Uint8Array(paddedLength);
  23044. var i, j, n;
  23045. for (i = 0; i < length; ++i) {
  23046. padded[i] = data[offset++];
  23047. }
  23048. padded[i++] = 0x80;
  23049. n = paddedLength - 8;
  23050. while (i < n) {
  23051. padded[i++] = 0;
  23052. }
  23053. padded[i++] = 0;
  23054. padded[i++] = 0;
  23055. padded[i++] = 0;
  23056. padded[i++] = length >>> 29 & 0xFF;
  23057. padded[i++] = length >> 21 & 0xFF;
  23058. padded[i++] = length >> 13 & 0xFF;
  23059. padded[i++] = length >> 5 & 0xFF;
  23060. padded[i++] = length << 3 & 0xFF;
  23061. var w = new Uint32Array(64);
  23062. for (i = 0; i < paddedLength;) {
  23063. for (j = 0; j < 16; ++j) {
  23064. w[j] = padded[i] << 24 | padded[i + 1] << 16 | padded[i + 2] << 8 | padded[i + 3];
  23065. i += 4;
  23066. }
  23067. for (j = 16; j < 64; ++j) {
  23068. w[j] = littleSigmaPrime(w[j - 2]) + w[j - 7] + littleSigma(w[j - 15]) + w[j - 16] | 0;
  23069. }
  23070. var a = h0, b = h1, c = h2, d = h3, e = h4, f = h5, g = h6, h = h7, t1, t2;
  23071. for (j = 0; j < 64; ++j) {
  23072. t1 = h + sigmaPrime(e) + ch(e, f, g) + k[j] + w[j];
  23073. t2 = sigma(a) + maj(a, b, c);
  23074. h = g;
  23075. g = f;
  23076. f = e;
  23077. e = d + t1 | 0;
  23078. d = c;
  23079. c = b;
  23080. b = a;
  23081. a = t1 + t2 | 0;
  23082. }
  23083. h0 = h0 + a | 0;
  23084. h1 = h1 + b | 0;
  23085. h2 = h2 + c | 0;
  23086. h3 = h3 + d | 0;
  23087. h4 = h4 + e | 0;
  23088. h5 = h5 + f | 0;
  23089. h6 = h6 + g | 0;
  23090. h7 = h7 + h | 0;
  23091. }
  23092. return new Uint8Array([
  23093. h0 >> 24 & 0xFF,
  23094. h0 >> 16 & 0xFF,
  23095. h0 >> 8 & 0xFF,
  23096. h0 & 0xFF,
  23097. h1 >> 24 & 0xFF,
  23098. h1 >> 16 & 0xFF,
  23099. h1 >> 8 & 0xFF,
  23100. h1 & 0xFF,
  23101. h2 >> 24 & 0xFF,
  23102. h2 >> 16 & 0xFF,
  23103. h2 >> 8 & 0xFF,
  23104. h2 & 0xFF,
  23105. h3 >> 24 & 0xFF,
  23106. h3 >> 16 & 0xFF,
  23107. h3 >> 8 & 0xFF,
  23108. h3 & 0xFF,
  23109. h4 >> 24 & 0xFF,
  23110. h4 >> 16 & 0xFF,
  23111. h4 >> 8 & 0xFF,
  23112. h4 & 0xFF,
  23113. h5 >> 24 & 0xFF,
  23114. h5 >> 16 & 0xFF,
  23115. h5 >> 8 & 0xFF,
  23116. h5 & 0xFF,
  23117. h6 >> 24 & 0xFF,
  23118. h6 >> 16 & 0xFF,
  23119. h6 >> 8 & 0xFF,
  23120. h6 & 0xFF,
  23121. h7 >> 24 & 0xFF,
  23122. h7 >> 16 & 0xFF,
  23123. h7 >> 8 & 0xFF,
  23124. h7 & 0xFF
  23125. ]);
  23126. }
  23127. return hash;
  23128. }();
  23129. var calculateSHA512 = function calculateSHA512Closure() {
  23130. function ch(result, x, y, z, tmp) {
  23131. result.assign(x);
  23132. result.and(y);
  23133. tmp.assign(x);
  23134. tmp.not();
  23135. tmp.and(z);
  23136. result.xor(tmp);
  23137. }
  23138. function maj(result, x, y, z, tmp) {
  23139. result.assign(x);
  23140. result.and(y);
  23141. tmp.assign(x);
  23142. tmp.and(z);
  23143. result.xor(tmp);
  23144. tmp.assign(y);
  23145. tmp.and(z);
  23146. result.xor(tmp);
  23147. }
  23148. function sigma(result, x, tmp) {
  23149. result.assign(x);
  23150. result.rotateRight(28);
  23151. tmp.assign(x);
  23152. tmp.rotateRight(34);
  23153. result.xor(tmp);
  23154. tmp.assign(x);
  23155. tmp.rotateRight(39);
  23156. result.xor(tmp);
  23157. }
  23158. function sigmaPrime(result, x, tmp) {
  23159. result.assign(x);
  23160. result.rotateRight(14);
  23161. tmp.assign(x);
  23162. tmp.rotateRight(18);
  23163. result.xor(tmp);
  23164. tmp.assign(x);
  23165. tmp.rotateRight(41);
  23166. result.xor(tmp);
  23167. }
  23168. function littleSigma(result, x, tmp) {
  23169. result.assign(x);
  23170. result.rotateRight(1);
  23171. tmp.assign(x);
  23172. tmp.rotateRight(8);
  23173. result.xor(tmp);
  23174. tmp.assign(x);
  23175. tmp.shiftRight(7);
  23176. result.xor(tmp);
  23177. }
  23178. function littleSigmaPrime(result, x, tmp) {
  23179. result.assign(x);
  23180. result.rotateRight(19);
  23181. tmp.assign(x);
  23182. tmp.rotateRight(61);
  23183. result.xor(tmp);
  23184. tmp.assign(x);
  23185. tmp.shiftRight(6);
  23186. result.xor(tmp);
  23187. }
  23188. var k = [
  23189. new Word64(0x428a2f98, 0xd728ae22),
  23190. new Word64(0x71374491, 0x23ef65cd),
  23191. new Word64(0xb5c0fbcf, 0xec4d3b2f),
  23192. new Word64(0xe9b5dba5, 0x8189dbbc),
  23193. new Word64(0x3956c25b, 0xf348b538),
  23194. new Word64(0x59f111f1, 0xb605d019),
  23195. new Word64(0x923f82a4, 0xaf194f9b),
  23196. new Word64(0xab1c5ed5, 0xda6d8118),
  23197. new Word64(0xd807aa98, 0xa3030242),
  23198. new Word64(0x12835b01, 0x45706fbe),
  23199. new Word64(0x243185be, 0x4ee4b28c),
  23200. new Word64(0x550c7dc3, 0xd5ffb4e2),
  23201. new Word64(0x72be5d74, 0xf27b896f),
  23202. new Word64(0x80deb1fe, 0x3b1696b1),
  23203. new Word64(0x9bdc06a7, 0x25c71235),
  23204. new Word64(0xc19bf174, 0xcf692694),
  23205. new Word64(0xe49b69c1, 0x9ef14ad2),
  23206. new Word64(0xefbe4786, 0x384f25e3),
  23207. new Word64(0x0fc19dc6, 0x8b8cd5b5),
  23208. new Word64(0x240ca1cc, 0x77ac9c65),
  23209. new Word64(0x2de92c6f, 0x592b0275),
  23210. new Word64(0x4a7484aa, 0x6ea6e483),
  23211. new Word64(0x5cb0a9dc, 0xbd41fbd4),
  23212. new Word64(0x76f988da, 0x831153b5),
  23213. new Word64(0x983e5152, 0xee66dfab),
  23214. new Word64(0xa831c66d, 0x2db43210),
  23215. new Word64(0xb00327c8, 0x98fb213f),
  23216. new Word64(0xbf597fc7, 0xbeef0ee4),
  23217. new Word64(0xc6e00bf3, 0x3da88fc2),
  23218. new Word64(0xd5a79147, 0x930aa725),
  23219. new Word64(0x06ca6351, 0xe003826f),
  23220. new Word64(0x14292967, 0x0a0e6e70),
  23221. new Word64(0x27b70a85, 0x46d22ffc),
  23222. new Word64(0x2e1b2138, 0x5c26c926),
  23223. new Word64(0x4d2c6dfc, 0x5ac42aed),
  23224. new Word64(0x53380d13, 0x9d95b3df),
  23225. new Word64(0x650a7354, 0x8baf63de),
  23226. new Word64(0x766a0abb, 0x3c77b2a8),
  23227. new Word64(0x81c2c92e, 0x47edaee6),
  23228. new Word64(0x92722c85, 0x1482353b),
  23229. new Word64(0xa2bfe8a1, 0x4cf10364),
  23230. new Word64(0xa81a664b, 0xbc423001),
  23231. new Word64(0xc24b8b70, 0xd0f89791),
  23232. new Word64(0xc76c51a3, 0x0654be30),
  23233. new Word64(0xd192e819, 0xd6ef5218),
  23234. new Word64(0xd6990624, 0x5565a910),
  23235. new Word64(0xf40e3585, 0x5771202a),
  23236. new Word64(0x106aa070, 0x32bbd1b8),
  23237. new Word64(0x19a4c116, 0xb8d2d0c8),
  23238. new Word64(0x1e376c08, 0x5141ab53),
  23239. new Word64(0x2748774c, 0xdf8eeb99),
  23240. new Word64(0x34b0bcb5, 0xe19b48a8),
  23241. new Word64(0x391c0cb3, 0xc5c95a63),
  23242. new Word64(0x4ed8aa4a, 0xe3418acb),
  23243. new Word64(0x5b9cca4f, 0x7763e373),
  23244. new Word64(0x682e6ff3, 0xd6b2b8a3),
  23245. new Word64(0x748f82ee, 0x5defb2fc),
  23246. new Word64(0x78a5636f, 0x43172f60),
  23247. new Word64(0x84c87814, 0xa1f0ab72),
  23248. new Word64(0x8cc70208, 0x1a6439ec),
  23249. new Word64(0x90befffa, 0x23631e28),
  23250. new Word64(0xa4506ceb, 0xde82bde9),
  23251. new Word64(0xbef9a3f7, 0xb2c67915),
  23252. new Word64(0xc67178f2, 0xe372532b),
  23253. new Word64(0xca273ece, 0xea26619c),
  23254. new Word64(0xd186b8c7, 0x21c0c207),
  23255. new Word64(0xeada7dd6, 0xcde0eb1e),
  23256. new Word64(0xf57d4f7f, 0xee6ed178),
  23257. new Word64(0x06f067aa, 0x72176fba),
  23258. new Word64(0x0a637dc5, 0xa2c898a6),
  23259. new Word64(0x113f9804, 0xbef90dae),
  23260. new Word64(0x1b710b35, 0x131c471b),
  23261. new Word64(0x28db77f5, 0x23047d84),
  23262. new Word64(0x32caab7b, 0x40c72493),
  23263. new Word64(0x3c9ebe0a, 0x15c9bebc),
  23264. new Word64(0x431d67c4, 0x9c100d4c),
  23265. new Word64(0x4cc5d4be, 0xcb3e42b6),
  23266. new Word64(0x597f299c, 0xfc657e2a),
  23267. new Word64(0x5fcb6fab, 0x3ad6faec),
  23268. new Word64(0x6c44198c, 0x4a475817)
  23269. ];
  23270. function hash(data, offset, length, mode384) {
  23271. mode384 = !!mode384;
  23272. var h0, h1, h2, h3, h4, h5, h6, h7;
  23273. if (!mode384) {
  23274. h0 = new Word64(0x6a09e667, 0xf3bcc908);
  23275. h1 = new Word64(0xbb67ae85, 0x84caa73b);
  23276. h2 = new Word64(0x3c6ef372, 0xfe94f82b);
  23277. h3 = new Word64(0xa54ff53a, 0x5f1d36f1);
  23278. h4 = new Word64(0x510e527f, 0xade682d1);
  23279. h5 = new Word64(0x9b05688c, 0x2b3e6c1f);
  23280. h6 = new Word64(0x1f83d9ab, 0xfb41bd6b);
  23281. h7 = new Word64(0x5be0cd19, 0x137e2179);
  23282. } else {
  23283. h0 = new Word64(0xcbbb9d5d, 0xc1059ed8);
  23284. h1 = new Word64(0x629a292a, 0x367cd507);
  23285. h2 = new Word64(0x9159015a, 0x3070dd17);
  23286. h3 = new Word64(0x152fecd8, 0xf70e5939);
  23287. h4 = new Word64(0x67332667, 0xffc00b31);
  23288. h5 = new Word64(0x8eb44a87, 0x68581511);
  23289. h6 = new Word64(0xdb0c2e0d, 0x64f98fa7);
  23290. h7 = new Word64(0x47b5481d, 0xbefa4fa4);
  23291. }
  23292. var paddedLength = Math.ceil((length + 17) / 128) * 128;
  23293. var padded = new Uint8Array(paddedLength);
  23294. var i, j, n;
  23295. for (i = 0; i < length; ++i) {
  23296. padded[i] = data[offset++];
  23297. }
  23298. padded[i++] = 0x80;
  23299. n = paddedLength - 16;
  23300. while (i < n) {
  23301. padded[i++] = 0;
  23302. }
  23303. padded[i++] = 0;
  23304. padded[i++] = 0;
  23305. padded[i++] = 0;
  23306. padded[i++] = 0;
  23307. padded[i++] = 0;
  23308. padded[i++] = 0;
  23309. padded[i++] = 0;
  23310. padded[i++] = 0;
  23311. padded[i++] = 0;
  23312. padded[i++] = 0;
  23313. padded[i++] = 0;
  23314. padded[i++] = length >>> 29 & 0xFF;
  23315. padded[i++] = length >> 21 & 0xFF;
  23316. padded[i++] = length >> 13 & 0xFF;
  23317. padded[i++] = length >> 5 & 0xFF;
  23318. padded[i++] = length << 3 & 0xFF;
  23319. var w = new Array(80);
  23320. for (i = 0; i < 80; i++) {
  23321. w[i] = new Word64(0, 0);
  23322. }
  23323. var a = new Word64(0, 0), b = new Word64(0, 0), c = new Word64(0, 0);
  23324. var d = new Word64(0, 0), e = new Word64(0, 0), f = new Word64(0, 0);
  23325. var g = new Word64(0, 0), h = new Word64(0, 0);
  23326. var t1 = new Word64(0, 0), t2 = new Word64(0, 0);
  23327. var tmp1 = new Word64(0, 0), tmp2 = new Word64(0, 0), tmp3;
  23328. for (i = 0; i < paddedLength;) {
  23329. for (j = 0; j < 16; ++j) {
  23330. w[j].high = padded[i] << 24 | padded[i + 1] << 16 | padded[i + 2] << 8 | padded[i + 3];
  23331. w[j].low = padded[i + 4] << 24 | padded[i + 5] << 16 | padded[i + 6] << 8 | padded[i + 7];
  23332. i += 8;
  23333. }
  23334. for (j = 16; j < 80; ++j) {
  23335. tmp3 = w[j];
  23336. littleSigmaPrime(tmp3, w[j - 2], tmp2);
  23337. tmp3.add(w[j - 7]);
  23338. littleSigma(tmp1, w[j - 15], tmp2);
  23339. tmp3.add(tmp1);
  23340. tmp3.add(w[j - 16]);
  23341. }
  23342. a.assign(h0);
  23343. b.assign(h1);
  23344. c.assign(h2);
  23345. d.assign(h3);
  23346. e.assign(h4);
  23347. f.assign(h5);
  23348. g.assign(h6);
  23349. h.assign(h7);
  23350. for (j = 0; j < 80; ++j) {
  23351. t1.assign(h);
  23352. sigmaPrime(tmp1, e, tmp2);
  23353. t1.add(tmp1);
  23354. ch(tmp1, e, f, g, tmp2);
  23355. t1.add(tmp1);
  23356. t1.add(k[j]);
  23357. t1.add(w[j]);
  23358. sigma(t2, a, tmp2);
  23359. maj(tmp1, a, b, c, tmp2);
  23360. t2.add(tmp1);
  23361. tmp3 = h;
  23362. h = g;
  23363. g = f;
  23364. f = e;
  23365. d.add(t1);
  23366. e = d;
  23367. d = c;
  23368. c = b;
  23369. b = a;
  23370. tmp3.assign(t1);
  23371. tmp3.add(t2);
  23372. a = tmp3;
  23373. }
  23374. h0.add(a);
  23375. h1.add(b);
  23376. h2.add(c);
  23377. h3.add(d);
  23378. h4.add(e);
  23379. h5.add(f);
  23380. h6.add(g);
  23381. h7.add(h);
  23382. }
  23383. var result;
  23384. if (!mode384) {
  23385. result = new Uint8Array(64);
  23386. h0.copyTo(result, 0);
  23387. h1.copyTo(result, 8);
  23388. h2.copyTo(result, 16);
  23389. h3.copyTo(result, 24);
  23390. h4.copyTo(result, 32);
  23391. h5.copyTo(result, 40);
  23392. h6.copyTo(result, 48);
  23393. h7.copyTo(result, 56);
  23394. } else {
  23395. result = new Uint8Array(48);
  23396. h0.copyTo(result, 0);
  23397. h1.copyTo(result, 8);
  23398. h2.copyTo(result, 16);
  23399. h3.copyTo(result, 24);
  23400. h4.copyTo(result, 32);
  23401. h5.copyTo(result, 40);
  23402. }
  23403. return result;
  23404. }
  23405. return hash;
  23406. }();
  23407. var calculateSHA384 = function calculateSHA384Closure() {
  23408. function hash(data, offset, length) {
  23409. return calculateSHA512(data, offset, length, true);
  23410. }
  23411. return hash;
  23412. }();
  23413. var NullCipher = function NullCipherClosure() {
  23414. function NullCipher() {
  23415. }
  23416. NullCipher.prototype = {
  23417. decryptBlock: function NullCipher_decryptBlock(data) {
  23418. return data;
  23419. }
  23420. };
  23421. return NullCipher;
  23422. }();
  23423. var AES128Cipher = function AES128CipherClosure() {
  23424. var rcon = new Uint8Array([
  23425. 0x8d,
  23426. 0x01,
  23427. 0x02,
  23428. 0x04,
  23429. 0x08,
  23430. 0x10,
  23431. 0x20,
  23432. 0x40,
  23433. 0x80,
  23434. 0x1b,
  23435. 0x36,
  23436. 0x6c,
  23437. 0xd8,
  23438. 0xab,
  23439. 0x4d,
  23440. 0x9a,
  23441. 0x2f,
  23442. 0x5e,
  23443. 0xbc,
  23444. 0x63,
  23445. 0xc6,
  23446. 0x97,
  23447. 0x35,
  23448. 0x6a,
  23449. 0xd4,
  23450. 0xb3,
  23451. 0x7d,
  23452. 0xfa,
  23453. 0xef,
  23454. 0xc5,
  23455. 0x91,
  23456. 0x39,
  23457. 0x72,
  23458. 0xe4,
  23459. 0xd3,
  23460. 0xbd,
  23461. 0x61,
  23462. 0xc2,
  23463. 0x9f,
  23464. 0x25,
  23465. 0x4a,
  23466. 0x94,
  23467. 0x33,
  23468. 0x66,
  23469. 0xcc,
  23470. 0x83,
  23471. 0x1d,
  23472. 0x3a,
  23473. 0x74,
  23474. 0xe8,
  23475. 0xcb,
  23476. 0x8d,
  23477. 0x01,
  23478. 0x02,
  23479. 0x04,
  23480. 0x08,
  23481. 0x10,
  23482. 0x20,
  23483. 0x40,
  23484. 0x80,
  23485. 0x1b,
  23486. 0x36,
  23487. 0x6c,
  23488. 0xd8,
  23489. 0xab,
  23490. 0x4d,
  23491. 0x9a,
  23492. 0x2f,
  23493. 0x5e,
  23494. 0xbc,
  23495. 0x63,
  23496. 0xc6,
  23497. 0x97,
  23498. 0x35,
  23499. 0x6a,
  23500. 0xd4,
  23501. 0xb3,
  23502. 0x7d,
  23503. 0xfa,
  23504. 0xef,
  23505. 0xc5,
  23506. 0x91,
  23507. 0x39,
  23508. 0x72,
  23509. 0xe4,
  23510. 0xd3,
  23511. 0xbd,
  23512. 0x61,
  23513. 0xc2,
  23514. 0x9f,
  23515. 0x25,
  23516. 0x4a,
  23517. 0x94,
  23518. 0x33,
  23519. 0x66,
  23520. 0xcc,
  23521. 0x83,
  23522. 0x1d,
  23523. 0x3a,
  23524. 0x74,
  23525. 0xe8,
  23526. 0xcb,
  23527. 0x8d,
  23528. 0x01,
  23529. 0x02,
  23530. 0x04,
  23531. 0x08,
  23532. 0x10,
  23533. 0x20,
  23534. 0x40,
  23535. 0x80,
  23536. 0x1b,
  23537. 0x36,
  23538. 0x6c,
  23539. 0xd8,
  23540. 0xab,
  23541. 0x4d,
  23542. 0x9a,
  23543. 0x2f,
  23544. 0x5e,
  23545. 0xbc,
  23546. 0x63,
  23547. 0xc6,
  23548. 0x97,
  23549. 0x35,
  23550. 0x6a,
  23551. 0xd4,
  23552. 0xb3,
  23553. 0x7d,
  23554. 0xfa,
  23555. 0xef,
  23556. 0xc5,
  23557. 0x91,
  23558. 0x39,
  23559. 0x72,
  23560. 0xe4,
  23561. 0xd3,
  23562. 0xbd,
  23563. 0x61,
  23564. 0xc2,
  23565. 0x9f,
  23566. 0x25,
  23567. 0x4a,
  23568. 0x94,
  23569. 0x33,
  23570. 0x66,
  23571. 0xcc,
  23572. 0x83,
  23573. 0x1d,
  23574. 0x3a,
  23575. 0x74,
  23576. 0xe8,
  23577. 0xcb,
  23578. 0x8d,
  23579. 0x01,
  23580. 0x02,
  23581. 0x04,
  23582. 0x08,
  23583. 0x10,
  23584. 0x20,
  23585. 0x40,
  23586. 0x80,
  23587. 0x1b,
  23588. 0x36,
  23589. 0x6c,
  23590. 0xd8,
  23591. 0xab,
  23592. 0x4d,
  23593. 0x9a,
  23594. 0x2f,
  23595. 0x5e,
  23596. 0xbc,
  23597. 0x63,
  23598. 0xc6,
  23599. 0x97,
  23600. 0x35,
  23601. 0x6a,
  23602. 0xd4,
  23603. 0xb3,
  23604. 0x7d,
  23605. 0xfa,
  23606. 0xef,
  23607. 0xc5,
  23608. 0x91,
  23609. 0x39,
  23610. 0x72,
  23611. 0xe4,
  23612. 0xd3,
  23613. 0xbd,
  23614. 0x61,
  23615. 0xc2,
  23616. 0x9f,
  23617. 0x25,
  23618. 0x4a,
  23619. 0x94,
  23620. 0x33,
  23621. 0x66,
  23622. 0xcc,
  23623. 0x83,
  23624. 0x1d,
  23625. 0x3a,
  23626. 0x74,
  23627. 0xe8,
  23628. 0xcb,
  23629. 0x8d,
  23630. 0x01,
  23631. 0x02,
  23632. 0x04,
  23633. 0x08,
  23634. 0x10,
  23635. 0x20,
  23636. 0x40,
  23637. 0x80,
  23638. 0x1b,
  23639. 0x36,
  23640. 0x6c,
  23641. 0xd8,
  23642. 0xab,
  23643. 0x4d,
  23644. 0x9a,
  23645. 0x2f,
  23646. 0x5e,
  23647. 0xbc,
  23648. 0x63,
  23649. 0xc6,
  23650. 0x97,
  23651. 0x35,
  23652. 0x6a,
  23653. 0xd4,
  23654. 0xb3,
  23655. 0x7d,
  23656. 0xfa,
  23657. 0xef,
  23658. 0xc5,
  23659. 0x91,
  23660. 0x39,
  23661. 0x72,
  23662. 0xe4,
  23663. 0xd3,
  23664. 0xbd,
  23665. 0x61,
  23666. 0xc2,
  23667. 0x9f,
  23668. 0x25,
  23669. 0x4a,
  23670. 0x94,
  23671. 0x33,
  23672. 0x66,
  23673. 0xcc,
  23674. 0x83,
  23675. 0x1d,
  23676. 0x3a,
  23677. 0x74,
  23678. 0xe8,
  23679. 0xcb,
  23680. 0x8d
  23681. ]);
  23682. var s = new Uint8Array([
  23683. 0x63,
  23684. 0x7c,
  23685. 0x77,
  23686. 0x7b,
  23687. 0xf2,
  23688. 0x6b,
  23689. 0x6f,
  23690. 0xc5,
  23691. 0x30,
  23692. 0x01,
  23693. 0x67,
  23694. 0x2b,
  23695. 0xfe,
  23696. 0xd7,
  23697. 0xab,
  23698. 0x76,
  23699. 0xca,
  23700. 0x82,
  23701. 0xc9,
  23702. 0x7d,
  23703. 0xfa,
  23704. 0x59,
  23705. 0x47,
  23706. 0xf0,
  23707. 0xad,
  23708. 0xd4,
  23709. 0xa2,
  23710. 0xaf,
  23711. 0x9c,
  23712. 0xa4,
  23713. 0x72,
  23714. 0xc0,
  23715. 0xb7,
  23716. 0xfd,
  23717. 0x93,
  23718. 0x26,
  23719. 0x36,
  23720. 0x3f,
  23721. 0xf7,
  23722. 0xcc,
  23723. 0x34,
  23724. 0xa5,
  23725. 0xe5,
  23726. 0xf1,
  23727. 0x71,
  23728. 0xd8,
  23729. 0x31,
  23730. 0x15,
  23731. 0x04,
  23732. 0xc7,
  23733. 0x23,
  23734. 0xc3,
  23735. 0x18,
  23736. 0x96,
  23737. 0x05,
  23738. 0x9a,
  23739. 0x07,
  23740. 0x12,
  23741. 0x80,
  23742. 0xe2,
  23743. 0xeb,
  23744. 0x27,
  23745. 0xb2,
  23746. 0x75,
  23747. 0x09,
  23748. 0x83,
  23749. 0x2c,
  23750. 0x1a,
  23751. 0x1b,
  23752. 0x6e,
  23753. 0x5a,
  23754. 0xa0,
  23755. 0x52,
  23756. 0x3b,
  23757. 0xd6,
  23758. 0xb3,
  23759. 0x29,
  23760. 0xe3,
  23761. 0x2f,
  23762. 0x84,
  23763. 0x53,
  23764. 0xd1,
  23765. 0x00,
  23766. 0xed,
  23767. 0x20,
  23768. 0xfc,
  23769. 0xb1,
  23770. 0x5b,
  23771. 0x6a,
  23772. 0xcb,
  23773. 0xbe,
  23774. 0x39,
  23775. 0x4a,
  23776. 0x4c,
  23777. 0x58,
  23778. 0xcf,
  23779. 0xd0,
  23780. 0xef,
  23781. 0xaa,
  23782. 0xfb,
  23783. 0x43,
  23784. 0x4d,
  23785. 0x33,
  23786. 0x85,
  23787. 0x45,
  23788. 0xf9,
  23789. 0x02,
  23790. 0x7f,
  23791. 0x50,
  23792. 0x3c,
  23793. 0x9f,
  23794. 0xa8,
  23795. 0x51,
  23796. 0xa3,
  23797. 0x40,
  23798. 0x8f,
  23799. 0x92,
  23800. 0x9d,
  23801. 0x38,
  23802. 0xf5,
  23803. 0xbc,
  23804. 0xb6,
  23805. 0xda,
  23806. 0x21,
  23807. 0x10,
  23808. 0xff,
  23809. 0xf3,
  23810. 0xd2,
  23811. 0xcd,
  23812. 0x0c,
  23813. 0x13,
  23814. 0xec,
  23815. 0x5f,
  23816. 0x97,
  23817. 0x44,
  23818. 0x17,
  23819. 0xc4,
  23820. 0xa7,
  23821. 0x7e,
  23822. 0x3d,
  23823. 0x64,
  23824. 0x5d,
  23825. 0x19,
  23826. 0x73,
  23827. 0x60,
  23828. 0x81,
  23829. 0x4f,
  23830. 0xdc,
  23831. 0x22,
  23832. 0x2a,
  23833. 0x90,
  23834. 0x88,
  23835. 0x46,
  23836. 0xee,
  23837. 0xb8,
  23838. 0x14,
  23839. 0xde,
  23840. 0x5e,
  23841. 0x0b,
  23842. 0xdb,
  23843. 0xe0,
  23844. 0x32,
  23845. 0x3a,
  23846. 0x0a,
  23847. 0x49,
  23848. 0x06,
  23849. 0x24,
  23850. 0x5c,
  23851. 0xc2,
  23852. 0xd3,
  23853. 0xac,
  23854. 0x62,
  23855. 0x91,
  23856. 0x95,
  23857. 0xe4,
  23858. 0x79,
  23859. 0xe7,
  23860. 0xc8,
  23861. 0x37,
  23862. 0x6d,
  23863. 0x8d,
  23864. 0xd5,
  23865. 0x4e,
  23866. 0xa9,
  23867. 0x6c,
  23868. 0x56,
  23869. 0xf4,
  23870. 0xea,
  23871. 0x65,
  23872. 0x7a,
  23873. 0xae,
  23874. 0x08,
  23875. 0xba,
  23876. 0x78,
  23877. 0x25,
  23878. 0x2e,
  23879. 0x1c,
  23880. 0xa6,
  23881. 0xb4,
  23882. 0xc6,
  23883. 0xe8,
  23884. 0xdd,
  23885. 0x74,
  23886. 0x1f,
  23887. 0x4b,
  23888. 0xbd,
  23889. 0x8b,
  23890. 0x8a,
  23891. 0x70,
  23892. 0x3e,
  23893. 0xb5,
  23894. 0x66,
  23895. 0x48,
  23896. 0x03,
  23897. 0xf6,
  23898. 0x0e,
  23899. 0x61,
  23900. 0x35,
  23901. 0x57,
  23902. 0xb9,
  23903. 0x86,
  23904. 0xc1,
  23905. 0x1d,
  23906. 0x9e,
  23907. 0xe1,
  23908. 0xf8,
  23909. 0x98,
  23910. 0x11,
  23911. 0x69,
  23912. 0xd9,
  23913. 0x8e,
  23914. 0x94,
  23915. 0x9b,
  23916. 0x1e,
  23917. 0x87,
  23918. 0xe9,
  23919. 0xce,
  23920. 0x55,
  23921. 0x28,
  23922. 0xdf,
  23923. 0x8c,
  23924. 0xa1,
  23925. 0x89,
  23926. 0x0d,
  23927. 0xbf,
  23928. 0xe6,
  23929. 0x42,
  23930. 0x68,
  23931. 0x41,
  23932. 0x99,
  23933. 0x2d,
  23934. 0x0f,
  23935. 0xb0,
  23936. 0x54,
  23937. 0xbb,
  23938. 0x16
  23939. ]);
  23940. var inv_s = new Uint8Array([
  23941. 0x52,
  23942. 0x09,
  23943. 0x6a,
  23944. 0xd5,
  23945. 0x30,
  23946. 0x36,
  23947. 0xa5,
  23948. 0x38,
  23949. 0xbf,
  23950. 0x40,
  23951. 0xa3,
  23952. 0x9e,
  23953. 0x81,
  23954. 0xf3,
  23955. 0xd7,
  23956. 0xfb,
  23957. 0x7c,
  23958. 0xe3,
  23959. 0x39,
  23960. 0x82,
  23961. 0x9b,
  23962. 0x2f,
  23963. 0xff,
  23964. 0x87,
  23965. 0x34,
  23966. 0x8e,
  23967. 0x43,
  23968. 0x44,
  23969. 0xc4,
  23970. 0xde,
  23971. 0xe9,
  23972. 0xcb,
  23973. 0x54,
  23974. 0x7b,
  23975. 0x94,
  23976. 0x32,
  23977. 0xa6,
  23978. 0xc2,
  23979. 0x23,
  23980. 0x3d,
  23981. 0xee,
  23982. 0x4c,
  23983. 0x95,
  23984. 0x0b,
  23985. 0x42,
  23986. 0xfa,
  23987. 0xc3,
  23988. 0x4e,
  23989. 0x08,
  23990. 0x2e,
  23991. 0xa1,
  23992. 0x66,
  23993. 0x28,
  23994. 0xd9,
  23995. 0x24,
  23996. 0xb2,
  23997. 0x76,
  23998. 0x5b,
  23999. 0xa2,
  24000. 0x49,
  24001. 0x6d,
  24002. 0x8b,
  24003. 0xd1,
  24004. 0x25,
  24005. 0x72,
  24006. 0xf8,
  24007. 0xf6,
  24008. 0x64,
  24009. 0x86,
  24010. 0x68,
  24011. 0x98,
  24012. 0x16,
  24013. 0xd4,
  24014. 0xa4,
  24015. 0x5c,
  24016. 0xcc,
  24017. 0x5d,
  24018. 0x65,
  24019. 0xb6,
  24020. 0x92,
  24021. 0x6c,
  24022. 0x70,
  24023. 0x48,
  24024. 0x50,
  24025. 0xfd,
  24026. 0xed,
  24027. 0xb9,
  24028. 0xda,
  24029. 0x5e,
  24030. 0x15,
  24031. 0x46,
  24032. 0x57,
  24033. 0xa7,
  24034. 0x8d,
  24035. 0x9d,
  24036. 0x84,
  24037. 0x90,
  24038. 0xd8,
  24039. 0xab,
  24040. 0x00,
  24041. 0x8c,
  24042. 0xbc,
  24043. 0xd3,
  24044. 0x0a,
  24045. 0xf7,
  24046. 0xe4,
  24047. 0x58,
  24048. 0x05,
  24049. 0xb8,
  24050. 0xb3,
  24051. 0x45,
  24052. 0x06,
  24053. 0xd0,
  24054. 0x2c,
  24055. 0x1e,
  24056. 0x8f,
  24057. 0xca,
  24058. 0x3f,
  24059. 0x0f,
  24060. 0x02,
  24061. 0xc1,
  24062. 0xaf,
  24063. 0xbd,
  24064. 0x03,
  24065. 0x01,
  24066. 0x13,
  24067. 0x8a,
  24068. 0x6b,
  24069. 0x3a,
  24070. 0x91,
  24071. 0x11,
  24072. 0x41,
  24073. 0x4f,
  24074. 0x67,
  24075. 0xdc,
  24076. 0xea,
  24077. 0x97,
  24078. 0xf2,
  24079. 0xcf,
  24080. 0xce,
  24081. 0xf0,
  24082. 0xb4,
  24083. 0xe6,
  24084. 0x73,
  24085. 0x96,
  24086. 0xac,
  24087. 0x74,
  24088. 0x22,
  24089. 0xe7,
  24090. 0xad,
  24091. 0x35,
  24092. 0x85,
  24093. 0xe2,
  24094. 0xf9,
  24095. 0x37,
  24096. 0xe8,
  24097. 0x1c,
  24098. 0x75,
  24099. 0xdf,
  24100. 0x6e,
  24101. 0x47,
  24102. 0xf1,
  24103. 0x1a,
  24104. 0x71,
  24105. 0x1d,
  24106. 0x29,
  24107. 0xc5,
  24108. 0x89,
  24109. 0x6f,
  24110. 0xb7,
  24111. 0x62,
  24112. 0x0e,
  24113. 0xaa,
  24114. 0x18,
  24115. 0xbe,
  24116. 0x1b,
  24117. 0xfc,
  24118. 0x56,
  24119. 0x3e,
  24120. 0x4b,
  24121. 0xc6,
  24122. 0xd2,
  24123. 0x79,
  24124. 0x20,
  24125. 0x9a,
  24126. 0xdb,
  24127. 0xc0,
  24128. 0xfe,
  24129. 0x78,
  24130. 0xcd,
  24131. 0x5a,
  24132. 0xf4,
  24133. 0x1f,
  24134. 0xdd,
  24135. 0xa8,
  24136. 0x33,
  24137. 0x88,
  24138. 0x07,
  24139. 0xc7,
  24140. 0x31,
  24141. 0xb1,
  24142. 0x12,
  24143. 0x10,
  24144. 0x59,
  24145. 0x27,
  24146. 0x80,
  24147. 0xec,
  24148. 0x5f,
  24149. 0x60,
  24150. 0x51,
  24151. 0x7f,
  24152. 0xa9,
  24153. 0x19,
  24154. 0xb5,
  24155. 0x4a,
  24156. 0x0d,
  24157. 0x2d,
  24158. 0xe5,
  24159. 0x7a,
  24160. 0x9f,
  24161. 0x93,
  24162. 0xc9,
  24163. 0x9c,
  24164. 0xef,
  24165. 0xa0,
  24166. 0xe0,
  24167. 0x3b,
  24168. 0x4d,
  24169. 0xae,
  24170. 0x2a,
  24171. 0xf5,
  24172. 0xb0,
  24173. 0xc8,
  24174. 0xeb,
  24175. 0xbb,
  24176. 0x3c,
  24177. 0x83,
  24178. 0x53,
  24179. 0x99,
  24180. 0x61,
  24181. 0x17,
  24182. 0x2b,
  24183. 0x04,
  24184. 0x7e,
  24185. 0xba,
  24186. 0x77,
  24187. 0xd6,
  24188. 0x26,
  24189. 0xe1,
  24190. 0x69,
  24191. 0x14,
  24192. 0x63,
  24193. 0x55,
  24194. 0x21,
  24195. 0x0c,
  24196. 0x7d
  24197. ]);
  24198. var mixCol = new Uint8Array(256);
  24199. for (var i = 0; i < 256; i++) {
  24200. if (i < 128) {
  24201. mixCol[i] = i << 1;
  24202. } else {
  24203. mixCol[i] = i << 1 ^ 0x1b;
  24204. }
  24205. }
  24206. var mix = new Uint32Array([
  24207. 0x00000000,
  24208. 0x0e090d0b,
  24209. 0x1c121a16,
  24210. 0x121b171d,
  24211. 0x3824342c,
  24212. 0x362d3927,
  24213. 0x24362e3a,
  24214. 0x2a3f2331,
  24215. 0x70486858,
  24216. 0x7e416553,
  24217. 0x6c5a724e,
  24218. 0x62537f45,
  24219. 0x486c5c74,
  24220. 0x4665517f,
  24221. 0x547e4662,
  24222. 0x5a774b69,
  24223. 0xe090d0b0,
  24224. 0xee99ddbb,
  24225. 0xfc82caa6,
  24226. 0xf28bc7ad,
  24227. 0xd8b4e49c,
  24228. 0xd6bde997,
  24229. 0xc4a6fe8a,
  24230. 0xcaaff381,
  24231. 0x90d8b8e8,
  24232. 0x9ed1b5e3,
  24233. 0x8ccaa2fe,
  24234. 0x82c3aff5,
  24235. 0xa8fc8cc4,
  24236. 0xa6f581cf,
  24237. 0xb4ee96d2,
  24238. 0xbae79bd9,
  24239. 0xdb3bbb7b,
  24240. 0xd532b670,
  24241. 0xc729a16d,
  24242. 0xc920ac66,
  24243. 0xe31f8f57,
  24244. 0xed16825c,
  24245. 0xff0d9541,
  24246. 0xf104984a,
  24247. 0xab73d323,
  24248. 0xa57ade28,
  24249. 0xb761c935,
  24250. 0xb968c43e,
  24251. 0x9357e70f,
  24252. 0x9d5eea04,
  24253. 0x8f45fd19,
  24254. 0x814cf012,
  24255. 0x3bab6bcb,
  24256. 0x35a266c0,
  24257. 0x27b971dd,
  24258. 0x29b07cd6,
  24259. 0x038f5fe7,
  24260. 0x0d8652ec,
  24261. 0x1f9d45f1,
  24262. 0x119448fa,
  24263. 0x4be30393,
  24264. 0x45ea0e98,
  24265. 0x57f11985,
  24266. 0x59f8148e,
  24267. 0x73c737bf,
  24268. 0x7dce3ab4,
  24269. 0x6fd52da9,
  24270. 0x61dc20a2,
  24271. 0xad766df6,
  24272. 0xa37f60fd,
  24273. 0xb16477e0,
  24274. 0xbf6d7aeb,
  24275. 0x955259da,
  24276. 0x9b5b54d1,
  24277. 0x894043cc,
  24278. 0x87494ec7,
  24279. 0xdd3e05ae,
  24280. 0xd33708a5,
  24281. 0xc12c1fb8,
  24282. 0xcf2512b3,
  24283. 0xe51a3182,
  24284. 0xeb133c89,
  24285. 0xf9082b94,
  24286. 0xf701269f,
  24287. 0x4de6bd46,
  24288. 0x43efb04d,
  24289. 0x51f4a750,
  24290. 0x5ffdaa5b,
  24291. 0x75c2896a,
  24292. 0x7bcb8461,
  24293. 0x69d0937c,
  24294. 0x67d99e77,
  24295. 0x3daed51e,
  24296. 0x33a7d815,
  24297. 0x21bccf08,
  24298. 0x2fb5c203,
  24299. 0x058ae132,
  24300. 0x0b83ec39,
  24301. 0x1998fb24,
  24302. 0x1791f62f,
  24303. 0x764dd68d,
  24304. 0x7844db86,
  24305. 0x6a5fcc9b,
  24306. 0x6456c190,
  24307. 0x4e69e2a1,
  24308. 0x4060efaa,
  24309. 0x527bf8b7,
  24310. 0x5c72f5bc,
  24311. 0x0605bed5,
  24312. 0x080cb3de,
  24313. 0x1a17a4c3,
  24314. 0x141ea9c8,
  24315. 0x3e218af9,
  24316. 0x302887f2,
  24317. 0x223390ef,
  24318. 0x2c3a9de4,
  24319. 0x96dd063d,
  24320. 0x98d40b36,
  24321. 0x8acf1c2b,
  24322. 0x84c61120,
  24323. 0xaef93211,
  24324. 0xa0f03f1a,
  24325. 0xb2eb2807,
  24326. 0xbce2250c,
  24327. 0xe6956e65,
  24328. 0xe89c636e,
  24329. 0xfa877473,
  24330. 0xf48e7978,
  24331. 0xdeb15a49,
  24332. 0xd0b85742,
  24333. 0xc2a3405f,
  24334. 0xccaa4d54,
  24335. 0x41ecdaf7,
  24336. 0x4fe5d7fc,
  24337. 0x5dfec0e1,
  24338. 0x53f7cdea,
  24339. 0x79c8eedb,
  24340. 0x77c1e3d0,
  24341. 0x65daf4cd,
  24342. 0x6bd3f9c6,
  24343. 0x31a4b2af,
  24344. 0x3fadbfa4,
  24345. 0x2db6a8b9,
  24346. 0x23bfa5b2,
  24347. 0x09808683,
  24348. 0x07898b88,
  24349. 0x15929c95,
  24350. 0x1b9b919e,
  24351. 0xa17c0a47,
  24352. 0xaf75074c,
  24353. 0xbd6e1051,
  24354. 0xb3671d5a,
  24355. 0x99583e6b,
  24356. 0x97513360,
  24357. 0x854a247d,
  24358. 0x8b432976,
  24359. 0xd134621f,
  24360. 0xdf3d6f14,
  24361. 0xcd267809,
  24362. 0xc32f7502,
  24363. 0xe9105633,
  24364. 0xe7195b38,
  24365. 0xf5024c25,
  24366. 0xfb0b412e,
  24367. 0x9ad7618c,
  24368. 0x94de6c87,
  24369. 0x86c57b9a,
  24370. 0x88cc7691,
  24371. 0xa2f355a0,
  24372. 0xacfa58ab,
  24373. 0xbee14fb6,
  24374. 0xb0e842bd,
  24375. 0xea9f09d4,
  24376. 0xe49604df,
  24377. 0xf68d13c2,
  24378. 0xf8841ec9,
  24379. 0xd2bb3df8,
  24380. 0xdcb230f3,
  24381. 0xcea927ee,
  24382. 0xc0a02ae5,
  24383. 0x7a47b13c,
  24384. 0x744ebc37,
  24385. 0x6655ab2a,
  24386. 0x685ca621,
  24387. 0x42638510,
  24388. 0x4c6a881b,
  24389. 0x5e719f06,
  24390. 0x5078920d,
  24391. 0x0a0fd964,
  24392. 0x0406d46f,
  24393. 0x161dc372,
  24394. 0x1814ce79,
  24395. 0x322bed48,
  24396. 0x3c22e043,
  24397. 0x2e39f75e,
  24398. 0x2030fa55,
  24399. 0xec9ab701,
  24400. 0xe293ba0a,
  24401. 0xf088ad17,
  24402. 0xfe81a01c,
  24403. 0xd4be832d,
  24404. 0xdab78e26,
  24405. 0xc8ac993b,
  24406. 0xc6a59430,
  24407. 0x9cd2df59,
  24408. 0x92dbd252,
  24409. 0x80c0c54f,
  24410. 0x8ec9c844,
  24411. 0xa4f6eb75,
  24412. 0xaaffe67e,
  24413. 0xb8e4f163,
  24414. 0xb6edfc68,
  24415. 0x0c0a67b1,
  24416. 0x02036aba,
  24417. 0x10187da7,
  24418. 0x1e1170ac,
  24419. 0x342e539d,
  24420. 0x3a275e96,
  24421. 0x283c498b,
  24422. 0x26354480,
  24423. 0x7c420fe9,
  24424. 0x724b02e2,
  24425. 0x605015ff,
  24426. 0x6e5918f4,
  24427. 0x44663bc5,
  24428. 0x4a6f36ce,
  24429. 0x587421d3,
  24430. 0x567d2cd8,
  24431. 0x37a10c7a,
  24432. 0x39a80171,
  24433. 0x2bb3166c,
  24434. 0x25ba1b67,
  24435. 0x0f853856,
  24436. 0x018c355d,
  24437. 0x13972240,
  24438. 0x1d9e2f4b,
  24439. 0x47e96422,
  24440. 0x49e06929,
  24441. 0x5bfb7e34,
  24442. 0x55f2733f,
  24443. 0x7fcd500e,
  24444. 0x71c45d05,
  24445. 0x63df4a18,
  24446. 0x6dd64713,
  24447. 0xd731dcca,
  24448. 0xd938d1c1,
  24449. 0xcb23c6dc,
  24450. 0xc52acbd7,
  24451. 0xef15e8e6,
  24452. 0xe11ce5ed,
  24453. 0xf307f2f0,
  24454. 0xfd0efffb,
  24455. 0xa779b492,
  24456. 0xa970b999,
  24457. 0xbb6bae84,
  24458. 0xb562a38f,
  24459. 0x9f5d80be,
  24460. 0x91548db5,
  24461. 0x834f9aa8,
  24462. 0x8d4697a3
  24463. ]);
  24464. function expandKey128(cipherKey) {
  24465. var b = 176, result = new Uint8Array(b);
  24466. result.set(cipherKey);
  24467. for (var j = 16, i = 1; j < b; ++i) {
  24468. var t1 = result[j - 3], t2 = result[j - 2], t3 = result[j - 1], t4 = result[j - 4];
  24469. t1 = s[t1];
  24470. t2 = s[t2];
  24471. t3 = s[t3];
  24472. t4 = s[t4];
  24473. t1 = t1 ^ rcon[i];
  24474. for (var n = 0; n < 4; ++n) {
  24475. result[j] = t1 ^= result[j - 16];
  24476. j++;
  24477. result[j] = t2 ^= result[j - 16];
  24478. j++;
  24479. result[j] = t3 ^= result[j - 16];
  24480. j++;
  24481. result[j] = t4 ^= result[j - 16];
  24482. j++;
  24483. }
  24484. }
  24485. return result;
  24486. }
  24487. function decrypt128(input, key) {
  24488. var state = new Uint8Array(16);
  24489. state.set(input);
  24490. var i, j, k;
  24491. var t, u, v;
  24492. for (j = 0, k = 160; j < 16; ++j, ++k) {
  24493. state[j] ^= key[k];
  24494. }
  24495. for (i = 9; i >= 1; --i) {
  24496. t = state[13];
  24497. state[13] = state[9];
  24498. state[9] = state[5];
  24499. state[5] = state[1];
  24500. state[1] = t;
  24501. t = state[14];
  24502. u = state[10];
  24503. state[14] = state[6];
  24504. state[10] = state[2];
  24505. state[6] = t;
  24506. state[2] = u;
  24507. t = state[15];
  24508. u = state[11];
  24509. v = state[7];
  24510. state[15] = state[3];
  24511. state[11] = t;
  24512. state[7] = u;
  24513. state[3] = v;
  24514. for (j = 0; j < 16; ++j) {
  24515. state[j] = inv_s[state[j]];
  24516. }
  24517. for (j = 0, k = i * 16; j < 16; ++j, ++k) {
  24518. state[j] ^= key[k];
  24519. }
  24520. for (j = 0; j < 16; j += 4) {
  24521. var s0 = mix[state[j]], s1 = mix[state[j + 1]], s2 = mix[state[j + 2]], s3 = mix[state[j + 3]];
  24522. t = s0 ^ s1 >>> 8 ^ s1 << 24 ^ s2 >>> 16 ^ s2 << 16 ^ s3 >>> 24 ^ s3 << 8;
  24523. state[j] = t >>> 24 & 0xFF;
  24524. state[j + 1] = t >> 16 & 0xFF;
  24525. state[j + 2] = t >> 8 & 0xFF;
  24526. state[j + 3] = t & 0xFF;
  24527. }
  24528. }
  24529. t = state[13];
  24530. state[13] = state[9];
  24531. state[9] = state[5];
  24532. state[5] = state[1];
  24533. state[1] = t;
  24534. t = state[14];
  24535. u = state[10];
  24536. state[14] = state[6];
  24537. state[10] = state[2];
  24538. state[6] = t;
  24539. state[2] = u;
  24540. t = state[15];
  24541. u = state[11];
  24542. v = state[7];
  24543. state[15] = state[3];
  24544. state[11] = t;
  24545. state[7] = u;
  24546. state[3] = v;
  24547. for (j = 0; j < 16; ++j) {
  24548. state[j] = inv_s[state[j]];
  24549. state[j] ^= key[j];
  24550. }
  24551. return state;
  24552. }
  24553. function encrypt128(input, key) {
  24554. var t, u, v, k;
  24555. var state = new Uint8Array(16);
  24556. state.set(input);
  24557. for (j = 0; j < 16; ++j) {
  24558. state[j] ^= key[j];
  24559. }
  24560. for (i = 1; i < 10; i++) {
  24561. for (j = 0; j < 16; ++j) {
  24562. state[j] = s[state[j]];
  24563. }
  24564. v = state[1];
  24565. state[1] = state[5];
  24566. state[5] = state[9];
  24567. state[9] = state[13];
  24568. state[13] = v;
  24569. v = state[2];
  24570. u = state[6];
  24571. state[2] = state[10];
  24572. state[6] = state[14];
  24573. state[10] = v;
  24574. state[14] = u;
  24575. v = state[3];
  24576. u = state[7];
  24577. t = state[11];
  24578. state[3] = state[15];
  24579. state[7] = v;
  24580. state[11] = u;
  24581. state[15] = t;
  24582. for (var j = 0; j < 16; j += 4) {
  24583. var s0 = state[j + 0], s1 = state[j + 1];
  24584. var s2 = state[j + 2], s3 = state[j + 3];
  24585. t = s0 ^ s1 ^ s2 ^ s3;
  24586. state[j + 0] ^= t ^ mixCol[s0 ^ s1];
  24587. state[j + 1] ^= t ^ mixCol[s1 ^ s2];
  24588. state[j + 2] ^= t ^ mixCol[s2 ^ s3];
  24589. state[j + 3] ^= t ^ mixCol[s3 ^ s0];
  24590. }
  24591. for (j = 0, k = i * 16; j < 16; ++j, ++k) {
  24592. state[j] ^= key[k];
  24593. }
  24594. }
  24595. for (j = 0; j < 16; ++j) {
  24596. state[j] = s[state[j]];
  24597. }
  24598. v = state[1];
  24599. state[1] = state[5];
  24600. state[5] = state[9];
  24601. state[9] = state[13];
  24602. state[13] = v;
  24603. v = state[2];
  24604. u = state[6];
  24605. state[2] = state[10];
  24606. state[6] = state[14];
  24607. state[10] = v;
  24608. state[14] = u;
  24609. v = state[3];
  24610. u = state[7];
  24611. t = state[11];
  24612. state[3] = state[15];
  24613. state[7] = v;
  24614. state[11] = u;
  24615. state[15] = t;
  24616. for (j = 0, k = 160; j < 16; ++j, ++k) {
  24617. state[j] ^= key[k];
  24618. }
  24619. return state;
  24620. }
  24621. function AES128Cipher(key) {
  24622. this.key = expandKey128(key);
  24623. this.buffer = new Uint8Array(16);
  24624. this.bufferPosition = 0;
  24625. }
  24626. function decryptBlock2(data, finalize) {
  24627. var i, j, ii, sourceLength = data.length, buffer = this.buffer, bufferLength = this.bufferPosition, result = [], iv = this.iv;
  24628. for (i = 0; i < sourceLength; ++i) {
  24629. buffer[bufferLength] = data[i];
  24630. ++bufferLength;
  24631. if (bufferLength < 16) {
  24632. continue;
  24633. }
  24634. var plain = decrypt128(buffer, this.key);
  24635. for (j = 0; j < 16; ++j) {
  24636. plain[j] ^= iv[j];
  24637. }
  24638. iv = buffer;
  24639. result.push(plain);
  24640. buffer = new Uint8Array(16);
  24641. bufferLength = 0;
  24642. }
  24643. this.buffer = buffer;
  24644. this.bufferLength = bufferLength;
  24645. this.iv = iv;
  24646. if (result.length === 0) {
  24647. return new Uint8Array([]);
  24648. }
  24649. var outputLength = 16 * result.length;
  24650. if (finalize) {
  24651. var lastBlock = result[result.length - 1];
  24652. var psLen = lastBlock[15];
  24653. if (psLen <= 16) {
  24654. for (i = 15, ii = 16 - psLen; i >= ii; --i) {
  24655. if (lastBlock[i] !== psLen) {
  24656. psLen = 0;
  24657. break;
  24658. }
  24659. }
  24660. outputLength -= psLen;
  24661. result[result.length - 1] = lastBlock.subarray(0, 16 - psLen);
  24662. }
  24663. }
  24664. var output = new Uint8Array(outputLength);
  24665. for (i = 0, j = 0, ii = result.length; i < ii; ++i, j += 16) {
  24666. output.set(result[i], j);
  24667. }
  24668. return output;
  24669. }
  24670. AES128Cipher.prototype = {
  24671. decryptBlock: function AES128Cipher_decryptBlock(data, finalize) {
  24672. var i, sourceLength = data.length;
  24673. var buffer = this.buffer, bufferLength = this.bufferPosition;
  24674. for (i = 0; bufferLength < 16 && i < sourceLength; ++i, ++bufferLength) {
  24675. buffer[bufferLength] = data[i];
  24676. }
  24677. if (bufferLength < 16) {
  24678. this.bufferLength = bufferLength;
  24679. return new Uint8Array([]);
  24680. }
  24681. this.iv = buffer;
  24682. this.buffer = new Uint8Array(16);
  24683. this.bufferLength = 0;
  24684. this.decryptBlock = decryptBlock2;
  24685. return this.decryptBlock(data.subarray(16), finalize);
  24686. },
  24687. encrypt: function AES128Cipher_encrypt(data, iv) {
  24688. var i, j, ii, sourceLength = data.length, buffer = this.buffer, bufferLength = this.bufferPosition, result = [];
  24689. if (!iv) {
  24690. iv = new Uint8Array(16);
  24691. }
  24692. for (i = 0; i < sourceLength; ++i) {
  24693. buffer[bufferLength] = data[i];
  24694. ++bufferLength;
  24695. if (bufferLength < 16) {
  24696. continue;
  24697. }
  24698. for (j = 0; j < 16; ++j) {
  24699. buffer[j] ^= iv[j];
  24700. }
  24701. var cipher = encrypt128(buffer, this.key);
  24702. iv = cipher;
  24703. result.push(cipher);
  24704. buffer = new Uint8Array(16);
  24705. bufferLength = 0;
  24706. }
  24707. this.buffer = buffer;
  24708. this.bufferLength = bufferLength;
  24709. this.iv = iv;
  24710. if (result.length === 0) {
  24711. return new Uint8Array([]);
  24712. }
  24713. var outputLength = 16 * result.length;
  24714. var output = new Uint8Array(outputLength);
  24715. for (i = 0, j = 0, ii = result.length; i < ii; ++i, j += 16) {
  24716. output.set(result[i], j);
  24717. }
  24718. return output;
  24719. }
  24720. };
  24721. return AES128Cipher;
  24722. }();
  24723. var AES256Cipher = function AES256CipherClosure() {
  24724. var s = new Uint8Array([
  24725. 0x63,
  24726. 0x7c,
  24727. 0x77,
  24728. 0x7b,
  24729. 0xf2,
  24730. 0x6b,
  24731. 0x6f,
  24732. 0xc5,
  24733. 0x30,
  24734. 0x01,
  24735. 0x67,
  24736. 0x2b,
  24737. 0xfe,
  24738. 0xd7,
  24739. 0xab,
  24740. 0x76,
  24741. 0xca,
  24742. 0x82,
  24743. 0xc9,
  24744. 0x7d,
  24745. 0xfa,
  24746. 0x59,
  24747. 0x47,
  24748. 0xf0,
  24749. 0xad,
  24750. 0xd4,
  24751. 0xa2,
  24752. 0xaf,
  24753. 0x9c,
  24754. 0xa4,
  24755. 0x72,
  24756. 0xc0,
  24757. 0xb7,
  24758. 0xfd,
  24759. 0x93,
  24760. 0x26,
  24761. 0x36,
  24762. 0x3f,
  24763. 0xf7,
  24764. 0xcc,
  24765. 0x34,
  24766. 0xa5,
  24767. 0xe5,
  24768. 0xf1,
  24769. 0x71,
  24770. 0xd8,
  24771. 0x31,
  24772. 0x15,
  24773. 0x04,
  24774. 0xc7,
  24775. 0x23,
  24776. 0xc3,
  24777. 0x18,
  24778. 0x96,
  24779. 0x05,
  24780. 0x9a,
  24781. 0x07,
  24782. 0x12,
  24783. 0x80,
  24784. 0xe2,
  24785. 0xeb,
  24786. 0x27,
  24787. 0xb2,
  24788. 0x75,
  24789. 0x09,
  24790. 0x83,
  24791. 0x2c,
  24792. 0x1a,
  24793. 0x1b,
  24794. 0x6e,
  24795. 0x5a,
  24796. 0xa0,
  24797. 0x52,
  24798. 0x3b,
  24799. 0xd6,
  24800. 0xb3,
  24801. 0x29,
  24802. 0xe3,
  24803. 0x2f,
  24804. 0x84,
  24805. 0x53,
  24806. 0xd1,
  24807. 0x00,
  24808. 0xed,
  24809. 0x20,
  24810. 0xfc,
  24811. 0xb1,
  24812. 0x5b,
  24813. 0x6a,
  24814. 0xcb,
  24815. 0xbe,
  24816. 0x39,
  24817. 0x4a,
  24818. 0x4c,
  24819. 0x58,
  24820. 0xcf,
  24821. 0xd0,
  24822. 0xef,
  24823. 0xaa,
  24824. 0xfb,
  24825. 0x43,
  24826. 0x4d,
  24827. 0x33,
  24828. 0x85,
  24829. 0x45,
  24830. 0xf9,
  24831. 0x02,
  24832. 0x7f,
  24833. 0x50,
  24834. 0x3c,
  24835. 0x9f,
  24836. 0xa8,
  24837. 0x51,
  24838. 0xa3,
  24839. 0x40,
  24840. 0x8f,
  24841. 0x92,
  24842. 0x9d,
  24843. 0x38,
  24844. 0xf5,
  24845. 0xbc,
  24846. 0xb6,
  24847. 0xda,
  24848. 0x21,
  24849. 0x10,
  24850. 0xff,
  24851. 0xf3,
  24852. 0xd2,
  24853. 0xcd,
  24854. 0x0c,
  24855. 0x13,
  24856. 0xec,
  24857. 0x5f,
  24858. 0x97,
  24859. 0x44,
  24860. 0x17,
  24861. 0xc4,
  24862. 0xa7,
  24863. 0x7e,
  24864. 0x3d,
  24865. 0x64,
  24866. 0x5d,
  24867. 0x19,
  24868. 0x73,
  24869. 0x60,
  24870. 0x81,
  24871. 0x4f,
  24872. 0xdc,
  24873. 0x22,
  24874. 0x2a,
  24875. 0x90,
  24876. 0x88,
  24877. 0x46,
  24878. 0xee,
  24879. 0xb8,
  24880. 0x14,
  24881. 0xde,
  24882. 0x5e,
  24883. 0x0b,
  24884. 0xdb,
  24885. 0xe0,
  24886. 0x32,
  24887. 0x3a,
  24888. 0x0a,
  24889. 0x49,
  24890. 0x06,
  24891. 0x24,
  24892. 0x5c,
  24893. 0xc2,
  24894. 0xd3,
  24895. 0xac,
  24896. 0x62,
  24897. 0x91,
  24898. 0x95,
  24899. 0xe4,
  24900. 0x79,
  24901. 0xe7,
  24902. 0xc8,
  24903. 0x37,
  24904. 0x6d,
  24905. 0x8d,
  24906. 0xd5,
  24907. 0x4e,
  24908. 0xa9,
  24909. 0x6c,
  24910. 0x56,
  24911. 0xf4,
  24912. 0xea,
  24913. 0x65,
  24914. 0x7a,
  24915. 0xae,
  24916. 0x08,
  24917. 0xba,
  24918. 0x78,
  24919. 0x25,
  24920. 0x2e,
  24921. 0x1c,
  24922. 0xa6,
  24923. 0xb4,
  24924. 0xc6,
  24925. 0xe8,
  24926. 0xdd,
  24927. 0x74,
  24928. 0x1f,
  24929. 0x4b,
  24930. 0xbd,
  24931. 0x8b,
  24932. 0x8a,
  24933. 0x70,
  24934. 0x3e,
  24935. 0xb5,
  24936. 0x66,
  24937. 0x48,
  24938. 0x03,
  24939. 0xf6,
  24940. 0x0e,
  24941. 0x61,
  24942. 0x35,
  24943. 0x57,
  24944. 0xb9,
  24945. 0x86,
  24946. 0xc1,
  24947. 0x1d,
  24948. 0x9e,
  24949. 0xe1,
  24950. 0xf8,
  24951. 0x98,
  24952. 0x11,
  24953. 0x69,
  24954. 0xd9,
  24955. 0x8e,
  24956. 0x94,
  24957. 0x9b,
  24958. 0x1e,
  24959. 0x87,
  24960. 0xe9,
  24961. 0xce,
  24962. 0x55,
  24963. 0x28,
  24964. 0xdf,
  24965. 0x8c,
  24966. 0xa1,
  24967. 0x89,
  24968. 0x0d,
  24969. 0xbf,
  24970. 0xe6,
  24971. 0x42,
  24972. 0x68,
  24973. 0x41,
  24974. 0x99,
  24975. 0x2d,
  24976. 0x0f,
  24977. 0xb0,
  24978. 0x54,
  24979. 0xbb,
  24980. 0x16
  24981. ]);
  24982. var inv_s = new Uint8Array([
  24983. 0x52,
  24984. 0x09,
  24985. 0x6a,
  24986. 0xd5,
  24987. 0x30,
  24988. 0x36,
  24989. 0xa5,
  24990. 0x38,
  24991. 0xbf,
  24992. 0x40,
  24993. 0xa3,
  24994. 0x9e,
  24995. 0x81,
  24996. 0xf3,
  24997. 0xd7,
  24998. 0xfb,
  24999. 0x7c,
  25000. 0xe3,
  25001. 0x39,
  25002. 0x82,
  25003. 0x9b,
  25004. 0x2f,
  25005. 0xff,
  25006. 0x87,
  25007. 0x34,
  25008. 0x8e,
  25009. 0x43,
  25010. 0x44,
  25011. 0xc4,
  25012. 0xde,
  25013. 0xe9,
  25014. 0xcb,
  25015. 0x54,
  25016. 0x7b,
  25017. 0x94,
  25018. 0x32,
  25019. 0xa6,
  25020. 0xc2,
  25021. 0x23,
  25022. 0x3d,
  25023. 0xee,
  25024. 0x4c,
  25025. 0x95,
  25026. 0x0b,
  25027. 0x42,
  25028. 0xfa,
  25029. 0xc3,
  25030. 0x4e,
  25031. 0x08,
  25032. 0x2e,
  25033. 0xa1,
  25034. 0x66,
  25035. 0x28,
  25036. 0xd9,
  25037. 0x24,
  25038. 0xb2,
  25039. 0x76,
  25040. 0x5b,
  25041. 0xa2,
  25042. 0x49,
  25043. 0x6d,
  25044. 0x8b,
  25045. 0xd1,
  25046. 0x25,
  25047. 0x72,
  25048. 0xf8,
  25049. 0xf6,
  25050. 0x64,
  25051. 0x86,
  25052. 0x68,
  25053. 0x98,
  25054. 0x16,
  25055. 0xd4,
  25056. 0xa4,
  25057. 0x5c,
  25058. 0xcc,
  25059. 0x5d,
  25060. 0x65,
  25061. 0xb6,
  25062. 0x92,
  25063. 0x6c,
  25064. 0x70,
  25065. 0x48,
  25066. 0x50,
  25067. 0xfd,
  25068. 0xed,
  25069. 0xb9,
  25070. 0xda,
  25071. 0x5e,
  25072. 0x15,
  25073. 0x46,
  25074. 0x57,
  25075. 0xa7,
  25076. 0x8d,
  25077. 0x9d,
  25078. 0x84,
  25079. 0x90,
  25080. 0xd8,
  25081. 0xab,
  25082. 0x00,
  25083. 0x8c,
  25084. 0xbc,
  25085. 0xd3,
  25086. 0x0a,
  25087. 0xf7,
  25088. 0xe4,
  25089. 0x58,
  25090. 0x05,
  25091. 0xb8,
  25092. 0xb3,
  25093. 0x45,
  25094. 0x06,
  25095. 0xd0,
  25096. 0x2c,
  25097. 0x1e,
  25098. 0x8f,
  25099. 0xca,
  25100. 0x3f,
  25101. 0x0f,
  25102. 0x02,
  25103. 0xc1,
  25104. 0xaf,
  25105. 0xbd,
  25106. 0x03,
  25107. 0x01,
  25108. 0x13,
  25109. 0x8a,
  25110. 0x6b,
  25111. 0x3a,
  25112. 0x91,
  25113. 0x11,
  25114. 0x41,
  25115. 0x4f,
  25116. 0x67,
  25117. 0xdc,
  25118. 0xea,
  25119. 0x97,
  25120. 0xf2,
  25121. 0xcf,
  25122. 0xce,
  25123. 0xf0,
  25124. 0xb4,
  25125. 0xe6,
  25126. 0x73,
  25127. 0x96,
  25128. 0xac,
  25129. 0x74,
  25130. 0x22,
  25131. 0xe7,
  25132. 0xad,
  25133. 0x35,
  25134. 0x85,
  25135. 0xe2,
  25136. 0xf9,
  25137. 0x37,
  25138. 0xe8,
  25139. 0x1c,
  25140. 0x75,
  25141. 0xdf,
  25142. 0x6e,
  25143. 0x47,
  25144. 0xf1,
  25145. 0x1a,
  25146. 0x71,
  25147. 0x1d,
  25148. 0x29,
  25149. 0xc5,
  25150. 0x89,
  25151. 0x6f,
  25152. 0xb7,
  25153. 0x62,
  25154. 0x0e,
  25155. 0xaa,
  25156. 0x18,
  25157. 0xbe,
  25158. 0x1b,
  25159. 0xfc,
  25160. 0x56,
  25161. 0x3e,
  25162. 0x4b,
  25163. 0xc6,
  25164. 0xd2,
  25165. 0x79,
  25166. 0x20,
  25167. 0x9a,
  25168. 0xdb,
  25169. 0xc0,
  25170. 0xfe,
  25171. 0x78,
  25172. 0xcd,
  25173. 0x5a,
  25174. 0xf4,
  25175. 0x1f,
  25176. 0xdd,
  25177. 0xa8,
  25178. 0x33,
  25179. 0x88,
  25180. 0x07,
  25181. 0xc7,
  25182. 0x31,
  25183. 0xb1,
  25184. 0x12,
  25185. 0x10,
  25186. 0x59,
  25187. 0x27,
  25188. 0x80,
  25189. 0xec,
  25190. 0x5f,
  25191. 0x60,
  25192. 0x51,
  25193. 0x7f,
  25194. 0xa9,
  25195. 0x19,
  25196. 0xb5,
  25197. 0x4a,
  25198. 0x0d,
  25199. 0x2d,
  25200. 0xe5,
  25201. 0x7a,
  25202. 0x9f,
  25203. 0x93,
  25204. 0xc9,
  25205. 0x9c,
  25206. 0xef,
  25207. 0xa0,
  25208. 0xe0,
  25209. 0x3b,
  25210. 0x4d,
  25211. 0xae,
  25212. 0x2a,
  25213. 0xf5,
  25214. 0xb0,
  25215. 0xc8,
  25216. 0xeb,
  25217. 0xbb,
  25218. 0x3c,
  25219. 0x83,
  25220. 0x53,
  25221. 0x99,
  25222. 0x61,
  25223. 0x17,
  25224. 0x2b,
  25225. 0x04,
  25226. 0x7e,
  25227. 0xba,
  25228. 0x77,
  25229. 0xd6,
  25230. 0x26,
  25231. 0xe1,
  25232. 0x69,
  25233. 0x14,
  25234. 0x63,
  25235. 0x55,
  25236. 0x21,
  25237. 0x0c,
  25238. 0x7d
  25239. ]);
  25240. var mixCol = new Uint8Array(256);
  25241. for (var i = 0; i < 256; i++) {
  25242. if (i < 128) {
  25243. mixCol[i] = i << 1;
  25244. } else {
  25245. mixCol[i] = i << 1 ^ 0x1b;
  25246. }
  25247. }
  25248. var mix = new Uint32Array([
  25249. 0x00000000,
  25250. 0x0e090d0b,
  25251. 0x1c121a16,
  25252. 0x121b171d,
  25253. 0x3824342c,
  25254. 0x362d3927,
  25255. 0x24362e3a,
  25256. 0x2a3f2331,
  25257. 0x70486858,
  25258. 0x7e416553,
  25259. 0x6c5a724e,
  25260. 0x62537f45,
  25261. 0x486c5c74,
  25262. 0x4665517f,
  25263. 0x547e4662,
  25264. 0x5a774b69,
  25265. 0xe090d0b0,
  25266. 0xee99ddbb,
  25267. 0xfc82caa6,
  25268. 0xf28bc7ad,
  25269. 0xd8b4e49c,
  25270. 0xd6bde997,
  25271. 0xc4a6fe8a,
  25272. 0xcaaff381,
  25273. 0x90d8b8e8,
  25274. 0x9ed1b5e3,
  25275. 0x8ccaa2fe,
  25276. 0x82c3aff5,
  25277. 0xa8fc8cc4,
  25278. 0xa6f581cf,
  25279. 0xb4ee96d2,
  25280. 0xbae79bd9,
  25281. 0xdb3bbb7b,
  25282. 0xd532b670,
  25283. 0xc729a16d,
  25284. 0xc920ac66,
  25285. 0xe31f8f57,
  25286. 0xed16825c,
  25287. 0xff0d9541,
  25288. 0xf104984a,
  25289. 0xab73d323,
  25290. 0xa57ade28,
  25291. 0xb761c935,
  25292. 0xb968c43e,
  25293. 0x9357e70f,
  25294. 0x9d5eea04,
  25295. 0x8f45fd19,
  25296. 0x814cf012,
  25297. 0x3bab6bcb,
  25298. 0x35a266c0,
  25299. 0x27b971dd,
  25300. 0x29b07cd6,
  25301. 0x038f5fe7,
  25302. 0x0d8652ec,
  25303. 0x1f9d45f1,
  25304. 0x119448fa,
  25305. 0x4be30393,
  25306. 0x45ea0e98,
  25307. 0x57f11985,
  25308. 0x59f8148e,
  25309. 0x73c737bf,
  25310. 0x7dce3ab4,
  25311. 0x6fd52da9,
  25312. 0x61dc20a2,
  25313. 0xad766df6,
  25314. 0xa37f60fd,
  25315. 0xb16477e0,
  25316. 0xbf6d7aeb,
  25317. 0x955259da,
  25318. 0x9b5b54d1,
  25319. 0x894043cc,
  25320. 0x87494ec7,
  25321. 0xdd3e05ae,
  25322. 0xd33708a5,
  25323. 0xc12c1fb8,
  25324. 0xcf2512b3,
  25325. 0xe51a3182,
  25326. 0xeb133c89,
  25327. 0xf9082b94,
  25328. 0xf701269f,
  25329. 0x4de6bd46,
  25330. 0x43efb04d,
  25331. 0x51f4a750,
  25332. 0x5ffdaa5b,
  25333. 0x75c2896a,
  25334. 0x7bcb8461,
  25335. 0x69d0937c,
  25336. 0x67d99e77,
  25337. 0x3daed51e,
  25338. 0x33a7d815,
  25339. 0x21bccf08,
  25340. 0x2fb5c203,
  25341. 0x058ae132,
  25342. 0x0b83ec39,
  25343. 0x1998fb24,
  25344. 0x1791f62f,
  25345. 0x764dd68d,
  25346. 0x7844db86,
  25347. 0x6a5fcc9b,
  25348. 0x6456c190,
  25349. 0x4e69e2a1,
  25350. 0x4060efaa,
  25351. 0x527bf8b7,
  25352. 0x5c72f5bc,
  25353. 0x0605bed5,
  25354. 0x080cb3de,
  25355. 0x1a17a4c3,
  25356. 0x141ea9c8,
  25357. 0x3e218af9,
  25358. 0x302887f2,
  25359. 0x223390ef,
  25360. 0x2c3a9de4,
  25361. 0x96dd063d,
  25362. 0x98d40b36,
  25363. 0x8acf1c2b,
  25364. 0x84c61120,
  25365. 0xaef93211,
  25366. 0xa0f03f1a,
  25367. 0xb2eb2807,
  25368. 0xbce2250c,
  25369. 0xe6956e65,
  25370. 0xe89c636e,
  25371. 0xfa877473,
  25372. 0xf48e7978,
  25373. 0xdeb15a49,
  25374. 0xd0b85742,
  25375. 0xc2a3405f,
  25376. 0xccaa4d54,
  25377. 0x41ecdaf7,
  25378. 0x4fe5d7fc,
  25379. 0x5dfec0e1,
  25380. 0x53f7cdea,
  25381. 0x79c8eedb,
  25382. 0x77c1e3d0,
  25383. 0x65daf4cd,
  25384. 0x6bd3f9c6,
  25385. 0x31a4b2af,
  25386. 0x3fadbfa4,
  25387. 0x2db6a8b9,
  25388. 0x23bfa5b2,
  25389. 0x09808683,
  25390. 0x07898b88,
  25391. 0x15929c95,
  25392. 0x1b9b919e,
  25393. 0xa17c0a47,
  25394. 0xaf75074c,
  25395. 0xbd6e1051,
  25396. 0xb3671d5a,
  25397. 0x99583e6b,
  25398. 0x97513360,
  25399. 0x854a247d,
  25400. 0x8b432976,
  25401. 0xd134621f,
  25402. 0xdf3d6f14,
  25403. 0xcd267809,
  25404. 0xc32f7502,
  25405. 0xe9105633,
  25406. 0xe7195b38,
  25407. 0xf5024c25,
  25408. 0xfb0b412e,
  25409. 0x9ad7618c,
  25410. 0x94de6c87,
  25411. 0x86c57b9a,
  25412. 0x88cc7691,
  25413. 0xa2f355a0,
  25414. 0xacfa58ab,
  25415. 0xbee14fb6,
  25416. 0xb0e842bd,
  25417. 0xea9f09d4,
  25418. 0xe49604df,
  25419. 0xf68d13c2,
  25420. 0xf8841ec9,
  25421. 0xd2bb3df8,
  25422. 0xdcb230f3,
  25423. 0xcea927ee,
  25424. 0xc0a02ae5,
  25425. 0x7a47b13c,
  25426. 0x744ebc37,
  25427. 0x6655ab2a,
  25428. 0x685ca621,
  25429. 0x42638510,
  25430. 0x4c6a881b,
  25431. 0x5e719f06,
  25432. 0x5078920d,
  25433. 0x0a0fd964,
  25434. 0x0406d46f,
  25435. 0x161dc372,
  25436. 0x1814ce79,
  25437. 0x322bed48,
  25438. 0x3c22e043,
  25439. 0x2e39f75e,
  25440. 0x2030fa55,
  25441. 0xec9ab701,
  25442. 0xe293ba0a,
  25443. 0xf088ad17,
  25444. 0xfe81a01c,
  25445. 0xd4be832d,
  25446. 0xdab78e26,
  25447. 0xc8ac993b,
  25448. 0xc6a59430,
  25449. 0x9cd2df59,
  25450. 0x92dbd252,
  25451. 0x80c0c54f,
  25452. 0x8ec9c844,
  25453. 0xa4f6eb75,
  25454. 0xaaffe67e,
  25455. 0xb8e4f163,
  25456. 0xb6edfc68,
  25457. 0x0c0a67b1,
  25458. 0x02036aba,
  25459. 0x10187da7,
  25460. 0x1e1170ac,
  25461. 0x342e539d,
  25462. 0x3a275e96,
  25463. 0x283c498b,
  25464. 0x26354480,
  25465. 0x7c420fe9,
  25466. 0x724b02e2,
  25467. 0x605015ff,
  25468. 0x6e5918f4,
  25469. 0x44663bc5,
  25470. 0x4a6f36ce,
  25471. 0x587421d3,
  25472. 0x567d2cd8,
  25473. 0x37a10c7a,
  25474. 0x39a80171,
  25475. 0x2bb3166c,
  25476. 0x25ba1b67,
  25477. 0x0f853856,
  25478. 0x018c355d,
  25479. 0x13972240,
  25480. 0x1d9e2f4b,
  25481. 0x47e96422,
  25482. 0x49e06929,
  25483. 0x5bfb7e34,
  25484. 0x55f2733f,
  25485. 0x7fcd500e,
  25486. 0x71c45d05,
  25487. 0x63df4a18,
  25488. 0x6dd64713,
  25489. 0xd731dcca,
  25490. 0xd938d1c1,
  25491. 0xcb23c6dc,
  25492. 0xc52acbd7,
  25493. 0xef15e8e6,
  25494. 0xe11ce5ed,
  25495. 0xf307f2f0,
  25496. 0xfd0efffb,
  25497. 0xa779b492,
  25498. 0xa970b999,
  25499. 0xbb6bae84,
  25500. 0xb562a38f,
  25501. 0x9f5d80be,
  25502. 0x91548db5,
  25503. 0x834f9aa8,
  25504. 0x8d4697a3
  25505. ]);
  25506. function expandKey256(cipherKey) {
  25507. var b = 240, result = new Uint8Array(b);
  25508. var r = 1;
  25509. result.set(cipherKey);
  25510. for (var j = 32, i = 1; j < b; ++i) {
  25511. if (j % 32 === 16) {
  25512. t1 = s[t1];
  25513. t2 = s[t2];
  25514. t3 = s[t3];
  25515. t4 = s[t4];
  25516. } else if (j % 32 === 0) {
  25517. var t1 = result[j - 3], t2 = result[j - 2], t3 = result[j - 1], t4 = result[j - 4];
  25518. t1 = s[t1];
  25519. t2 = s[t2];
  25520. t3 = s[t3];
  25521. t4 = s[t4];
  25522. t1 = t1 ^ r;
  25523. if ((r <<= 1) >= 256) {
  25524. r = (r ^ 0x1b) & 0xFF;
  25525. }
  25526. }
  25527. for (var n = 0; n < 4; ++n) {
  25528. result[j] = t1 ^= result[j - 32];
  25529. j++;
  25530. result[j] = t2 ^= result[j - 32];
  25531. j++;
  25532. result[j] = t3 ^= result[j - 32];
  25533. j++;
  25534. result[j] = t4 ^= result[j - 32];
  25535. j++;
  25536. }
  25537. }
  25538. return result;
  25539. }
  25540. function decrypt256(input, key) {
  25541. var state = new Uint8Array(16);
  25542. state.set(input);
  25543. var i, j, k;
  25544. var t, u, v;
  25545. for (j = 0, k = 224; j < 16; ++j, ++k) {
  25546. state[j] ^= key[k];
  25547. }
  25548. for (i = 13; i >= 1; --i) {
  25549. t = state[13];
  25550. state[13] = state[9];
  25551. state[9] = state[5];
  25552. state[5] = state[1];
  25553. state[1] = t;
  25554. t = state[14];
  25555. u = state[10];
  25556. state[14] = state[6];
  25557. state[10] = state[2];
  25558. state[6] = t;
  25559. state[2] = u;
  25560. t = state[15];
  25561. u = state[11];
  25562. v = state[7];
  25563. state[15] = state[3];
  25564. state[11] = t;
  25565. state[7] = u;
  25566. state[3] = v;
  25567. for (j = 0; j < 16; ++j) {
  25568. state[j] = inv_s[state[j]];
  25569. }
  25570. for (j = 0, k = i * 16; j < 16; ++j, ++k) {
  25571. state[j] ^= key[k];
  25572. }
  25573. for (j = 0; j < 16; j += 4) {
  25574. var s0 = mix[state[j]], s1 = mix[state[j + 1]], s2 = mix[state[j + 2]], s3 = mix[state[j + 3]];
  25575. t = s0 ^ s1 >>> 8 ^ s1 << 24 ^ s2 >>> 16 ^ s2 << 16 ^ s3 >>> 24 ^ s3 << 8;
  25576. state[j] = t >>> 24 & 0xFF;
  25577. state[j + 1] = t >> 16 & 0xFF;
  25578. state[j + 2] = t >> 8 & 0xFF;
  25579. state[j + 3] = t & 0xFF;
  25580. }
  25581. }
  25582. t = state[13];
  25583. state[13] = state[9];
  25584. state[9] = state[5];
  25585. state[5] = state[1];
  25586. state[1] = t;
  25587. t = state[14];
  25588. u = state[10];
  25589. state[14] = state[6];
  25590. state[10] = state[2];
  25591. state[6] = t;
  25592. state[2] = u;
  25593. t = state[15];
  25594. u = state[11];
  25595. v = state[7];
  25596. state[15] = state[3];
  25597. state[11] = t;
  25598. state[7] = u;
  25599. state[3] = v;
  25600. for (j = 0; j < 16; ++j) {
  25601. state[j] = inv_s[state[j]];
  25602. state[j] ^= key[j];
  25603. }
  25604. return state;
  25605. }
  25606. function encrypt256(input, key) {
  25607. var t, u, v, k;
  25608. var state = new Uint8Array(16);
  25609. state.set(input);
  25610. for (j = 0; j < 16; ++j) {
  25611. state[j] ^= key[j];
  25612. }
  25613. for (i = 1; i < 14; i++) {
  25614. for (j = 0; j < 16; ++j) {
  25615. state[j] = s[state[j]];
  25616. }
  25617. v = state[1];
  25618. state[1] = state[5];
  25619. state[5] = state[9];
  25620. state[9] = state[13];
  25621. state[13] = v;
  25622. v = state[2];
  25623. u = state[6];
  25624. state[2] = state[10];
  25625. state[6] = state[14];
  25626. state[10] = v;
  25627. state[14] = u;
  25628. v = state[3];
  25629. u = state[7];
  25630. t = state[11];
  25631. state[3] = state[15];
  25632. state[7] = v;
  25633. state[11] = u;
  25634. state[15] = t;
  25635. for (var j = 0; j < 16; j += 4) {
  25636. var s0 = state[j + 0], s1 = state[j + 1];
  25637. var s2 = state[j + 2], s3 = state[j + 3];
  25638. t = s0 ^ s1 ^ s2 ^ s3;
  25639. state[j + 0] ^= t ^ mixCol[s0 ^ s1];
  25640. state[j + 1] ^= t ^ mixCol[s1 ^ s2];
  25641. state[j + 2] ^= t ^ mixCol[s2 ^ s3];
  25642. state[j + 3] ^= t ^ mixCol[s3 ^ s0];
  25643. }
  25644. for (j = 0, k = i * 16; j < 16; ++j, ++k) {
  25645. state[j] ^= key[k];
  25646. }
  25647. }
  25648. for (j = 0; j < 16; ++j) {
  25649. state[j] = s[state[j]];
  25650. }
  25651. v = state[1];
  25652. state[1] = state[5];
  25653. state[5] = state[9];
  25654. state[9] = state[13];
  25655. state[13] = v;
  25656. v = state[2];
  25657. u = state[6];
  25658. state[2] = state[10];
  25659. state[6] = state[14];
  25660. state[10] = v;
  25661. state[14] = u;
  25662. v = state[3];
  25663. u = state[7];
  25664. t = state[11];
  25665. state[3] = state[15];
  25666. state[7] = v;
  25667. state[11] = u;
  25668. state[15] = t;
  25669. for (j = 0, k = 224; j < 16; ++j, ++k) {
  25670. state[j] ^= key[k];
  25671. }
  25672. return state;
  25673. }
  25674. function AES256Cipher(key) {
  25675. this.key = expandKey256(key);
  25676. this.buffer = new Uint8Array(16);
  25677. this.bufferPosition = 0;
  25678. }
  25679. function decryptBlock2(data, finalize) {
  25680. var i, j, ii, sourceLength = data.length, buffer = this.buffer, bufferLength = this.bufferPosition, result = [], iv = this.iv;
  25681. for (i = 0; i < sourceLength; ++i) {
  25682. buffer[bufferLength] = data[i];
  25683. ++bufferLength;
  25684. if (bufferLength < 16) {
  25685. continue;
  25686. }
  25687. var plain = decrypt256(buffer, this.key);
  25688. for (j = 0; j < 16; ++j) {
  25689. plain[j] ^= iv[j];
  25690. }
  25691. iv = buffer;
  25692. result.push(plain);
  25693. buffer = new Uint8Array(16);
  25694. bufferLength = 0;
  25695. }
  25696. this.buffer = buffer;
  25697. this.bufferLength = bufferLength;
  25698. this.iv = iv;
  25699. if (result.length === 0) {
  25700. return new Uint8Array([]);
  25701. }
  25702. var outputLength = 16 * result.length;
  25703. if (finalize) {
  25704. var lastBlock = result[result.length - 1];
  25705. var psLen = lastBlock[15];
  25706. if (psLen <= 16) {
  25707. for (i = 15, ii = 16 - psLen; i >= ii; --i) {
  25708. if (lastBlock[i] !== psLen) {
  25709. psLen = 0;
  25710. break;
  25711. }
  25712. }
  25713. outputLength -= psLen;
  25714. result[result.length - 1] = lastBlock.subarray(0, 16 - psLen);
  25715. }
  25716. }
  25717. var output = new Uint8Array(outputLength);
  25718. for (i = 0, j = 0, ii = result.length; i < ii; ++i, j += 16) {
  25719. output.set(result[i], j);
  25720. }
  25721. return output;
  25722. }
  25723. AES256Cipher.prototype = {
  25724. decryptBlock: function AES256Cipher_decryptBlock(data, finalize, iv) {
  25725. var i, sourceLength = data.length;
  25726. var buffer = this.buffer, bufferLength = this.bufferPosition;
  25727. if (iv) {
  25728. this.iv = iv;
  25729. } else {
  25730. for (i = 0; bufferLength < 16 && i < sourceLength; ++i, ++bufferLength) {
  25731. buffer[bufferLength] = data[i];
  25732. }
  25733. if (bufferLength < 16) {
  25734. this.bufferLength = bufferLength;
  25735. return new Uint8Array([]);
  25736. }
  25737. this.iv = buffer;
  25738. data = data.subarray(16);
  25739. }
  25740. this.buffer = new Uint8Array(16);
  25741. this.bufferLength = 0;
  25742. this.decryptBlock = decryptBlock2;
  25743. return this.decryptBlock(data, finalize);
  25744. },
  25745. encrypt: function AES256Cipher_encrypt(data, iv) {
  25746. var i, j, ii, sourceLength = data.length, buffer = this.buffer, bufferLength = this.bufferPosition, result = [];
  25747. if (!iv) {
  25748. iv = new Uint8Array(16);
  25749. }
  25750. for (i = 0; i < sourceLength; ++i) {
  25751. buffer[bufferLength] = data[i];
  25752. ++bufferLength;
  25753. if (bufferLength < 16) {
  25754. continue;
  25755. }
  25756. for (j = 0; j < 16; ++j) {
  25757. buffer[j] ^= iv[j];
  25758. }
  25759. var cipher = encrypt256(buffer, this.key);
  25760. this.iv = cipher;
  25761. result.push(cipher);
  25762. buffer = new Uint8Array(16);
  25763. bufferLength = 0;
  25764. }
  25765. this.buffer = buffer;
  25766. this.bufferLength = bufferLength;
  25767. this.iv = iv;
  25768. if (result.length === 0) {
  25769. return new Uint8Array([]);
  25770. }
  25771. var outputLength = 16 * result.length;
  25772. var output = new Uint8Array(outputLength);
  25773. for (i = 0, j = 0, ii = result.length; i < ii; ++i, j += 16) {
  25774. output.set(result[i], j);
  25775. }
  25776. return output;
  25777. }
  25778. };
  25779. return AES256Cipher;
  25780. }();
  25781. var PDF17 = function PDF17Closure() {
  25782. function compareByteArrays(array1, array2) {
  25783. if (array1.length !== array2.length) {
  25784. return false;
  25785. }
  25786. for (var i = 0; i < array1.length; i++) {
  25787. if (array1[i] !== array2[i]) {
  25788. return false;
  25789. }
  25790. }
  25791. return true;
  25792. }
  25793. function PDF17() {
  25794. }
  25795. PDF17.prototype = {
  25796. checkOwnerPassword: function PDF17_checkOwnerPassword(password, ownerValidationSalt, userBytes, ownerPassword) {
  25797. var hashData = new Uint8Array(password.length + 56);
  25798. hashData.set(password, 0);
  25799. hashData.set(ownerValidationSalt, password.length);
  25800. hashData.set(userBytes, password.length + ownerValidationSalt.length);
  25801. var result = calculateSHA256(hashData, 0, hashData.length);
  25802. return compareByteArrays(result, ownerPassword);
  25803. },
  25804. checkUserPassword: function PDF17_checkUserPassword(password, userValidationSalt, userPassword) {
  25805. var hashData = new Uint8Array(password.length + 8);
  25806. hashData.set(password, 0);
  25807. hashData.set(userValidationSalt, password.length);
  25808. var result = calculateSHA256(hashData, 0, hashData.length);
  25809. return compareByteArrays(result, userPassword);
  25810. },
  25811. getOwnerKey: function PDF17_getOwnerKey(password, ownerKeySalt, userBytes, ownerEncryption) {
  25812. var hashData = new Uint8Array(password.length + 56);
  25813. hashData.set(password, 0);
  25814. hashData.set(ownerKeySalt, password.length);
  25815. hashData.set(userBytes, password.length + ownerKeySalt.length);
  25816. var key = calculateSHA256(hashData, 0, hashData.length);
  25817. var cipher = new AES256Cipher(key);
  25818. return cipher.decryptBlock(ownerEncryption, false, new Uint8Array(16));
  25819. },
  25820. getUserKey: function PDF17_getUserKey(password, userKeySalt, userEncryption) {
  25821. var hashData = new Uint8Array(password.length + 8);
  25822. hashData.set(password, 0);
  25823. hashData.set(userKeySalt, password.length);
  25824. var key = calculateSHA256(hashData, 0, hashData.length);
  25825. var cipher = new AES256Cipher(key);
  25826. return cipher.decryptBlock(userEncryption, false, new Uint8Array(16));
  25827. }
  25828. };
  25829. return PDF17;
  25830. }();
  25831. var PDF20 = function PDF20Closure() {
  25832. function concatArrays(array1, array2) {
  25833. var t = new Uint8Array(array1.length + array2.length);
  25834. t.set(array1, 0);
  25835. t.set(array2, array1.length);
  25836. return t;
  25837. }
  25838. function calculatePDF20Hash(password, input, userBytes) {
  25839. var k = calculateSHA256(input, 0, input.length).subarray(0, 32);
  25840. var e = [0];
  25841. var i = 0;
  25842. while (i < 64 || e[e.length - 1] > i - 32) {
  25843. var arrayLength = password.length + k.length + userBytes.length;
  25844. var k1 = new Uint8Array(arrayLength * 64);
  25845. var array = concatArrays(password, k);
  25846. array = concatArrays(array, userBytes);
  25847. for (var j = 0, pos = 0; j < 64; j++, pos += arrayLength) {
  25848. k1.set(array, pos);
  25849. }
  25850. var cipher = new AES128Cipher(k.subarray(0, 16));
  25851. e = cipher.encrypt(k1, k.subarray(16, 32));
  25852. var remainder = 0;
  25853. for (var z = 0; z < 16; z++) {
  25854. remainder *= 256 % 3;
  25855. remainder %= 3;
  25856. remainder += (e[z] >>> 0) % 3;
  25857. remainder %= 3;
  25858. }
  25859. if (remainder === 0) {
  25860. k = calculateSHA256(e, 0, e.length);
  25861. } else if (remainder === 1) {
  25862. k = calculateSHA384(e, 0, e.length);
  25863. } else if (remainder === 2) {
  25864. k = calculateSHA512(e, 0, e.length);
  25865. }
  25866. i++;
  25867. }
  25868. return k.subarray(0, 32);
  25869. }
  25870. function PDF20() {
  25871. }
  25872. function compareByteArrays(array1, array2) {
  25873. if (array1.length !== array2.length) {
  25874. return false;
  25875. }
  25876. for (var i = 0; i < array1.length; i++) {
  25877. if (array1[i] !== array2[i]) {
  25878. return false;
  25879. }
  25880. }
  25881. return true;
  25882. }
  25883. PDF20.prototype = {
  25884. hash: function PDF20_hash(password, concatBytes, userBytes) {
  25885. return calculatePDF20Hash(password, concatBytes, userBytes);
  25886. },
  25887. checkOwnerPassword: function PDF20_checkOwnerPassword(password, ownerValidationSalt, userBytes, ownerPassword) {
  25888. var hashData = new Uint8Array(password.length + 56);
  25889. hashData.set(password, 0);
  25890. hashData.set(ownerValidationSalt, password.length);
  25891. hashData.set(userBytes, password.length + ownerValidationSalt.length);
  25892. var result = calculatePDF20Hash(password, hashData, userBytes);
  25893. return compareByteArrays(result, ownerPassword);
  25894. },
  25895. checkUserPassword: function PDF20_checkUserPassword(password, userValidationSalt, userPassword) {
  25896. var hashData = new Uint8Array(password.length + 8);
  25897. hashData.set(password, 0);
  25898. hashData.set(userValidationSalt, password.length);
  25899. var result = calculatePDF20Hash(password, hashData, []);
  25900. return compareByteArrays(result, userPassword);
  25901. },
  25902. getOwnerKey: function PDF20_getOwnerKey(password, ownerKeySalt, userBytes, ownerEncryption) {
  25903. var hashData = new Uint8Array(password.length + 56);
  25904. hashData.set(password, 0);
  25905. hashData.set(ownerKeySalt, password.length);
  25906. hashData.set(userBytes, password.length + ownerKeySalt.length);
  25907. var key = calculatePDF20Hash(password, hashData, userBytes);
  25908. var cipher = new AES256Cipher(key);
  25909. return cipher.decryptBlock(ownerEncryption, false, new Uint8Array(16));
  25910. },
  25911. getUserKey: function PDF20_getUserKey(password, userKeySalt, userEncryption) {
  25912. var hashData = new Uint8Array(password.length + 8);
  25913. hashData.set(password, 0);
  25914. hashData.set(userKeySalt, password.length);
  25915. var key = calculatePDF20Hash(password, hashData, []);
  25916. var cipher = new AES256Cipher(key);
  25917. return cipher.decryptBlock(userEncryption, false, new Uint8Array(16));
  25918. }
  25919. };
  25920. return PDF20;
  25921. }();
  25922. var CipherTransform = function CipherTransformClosure() {
  25923. function CipherTransform(stringCipherConstructor, streamCipherConstructor) {
  25924. this.StringCipherConstructor = stringCipherConstructor;
  25925. this.StreamCipherConstructor = streamCipherConstructor;
  25926. }
  25927. CipherTransform.prototype = {
  25928. createStream: function CipherTransform_createStream(stream, length) {
  25929. var cipher = new this.StreamCipherConstructor();
  25930. return new DecryptStream(stream, length, function cipherTransformDecryptStream(data, finalize) {
  25931. return cipher.decryptBlock(data, finalize);
  25932. });
  25933. },
  25934. decryptString: function CipherTransform_decryptString(s) {
  25935. var cipher = new this.StringCipherConstructor();
  25936. var data = stringToBytes(s);
  25937. data = cipher.decryptBlock(data, true);
  25938. return bytesToString(data);
  25939. }
  25940. };
  25941. return CipherTransform;
  25942. }();
  25943. var CipherTransformFactory = function CipherTransformFactoryClosure() {
  25944. var defaultPasswordBytes = new Uint8Array([
  25945. 0x28,
  25946. 0xBF,
  25947. 0x4E,
  25948. 0x5E,
  25949. 0x4E,
  25950. 0x75,
  25951. 0x8A,
  25952. 0x41,
  25953. 0x64,
  25954. 0x00,
  25955. 0x4E,
  25956. 0x56,
  25957. 0xFF,
  25958. 0xFA,
  25959. 0x01,
  25960. 0x08,
  25961. 0x2E,
  25962. 0x2E,
  25963. 0x00,
  25964. 0xB6,
  25965. 0xD0,
  25966. 0x68,
  25967. 0x3E,
  25968. 0x80,
  25969. 0x2F,
  25970. 0x0C,
  25971. 0xA9,
  25972. 0xFE,
  25973. 0x64,
  25974. 0x53,
  25975. 0x69,
  25976. 0x7A
  25977. ]);
  25978. function createEncryptionKey20(revision, password, ownerPassword, ownerValidationSalt, ownerKeySalt, uBytes, userPassword, userValidationSalt, userKeySalt, ownerEncryption, userEncryption, perms) {
  25979. if (password) {
  25980. var passwordLength = Math.min(127, password.length);
  25981. password = password.subarray(0, passwordLength);
  25982. } else {
  25983. password = [];
  25984. }
  25985. var pdfAlgorithm;
  25986. if (revision === 6) {
  25987. pdfAlgorithm = new PDF20();
  25988. } else {
  25989. pdfAlgorithm = new PDF17();
  25990. }
  25991. if (pdfAlgorithm.checkUserPassword(password, userValidationSalt, userPassword)) {
  25992. return pdfAlgorithm.getUserKey(password, userKeySalt, userEncryption);
  25993. } else if (password.length && pdfAlgorithm.checkOwnerPassword(password, ownerValidationSalt, uBytes, ownerPassword)) {
  25994. return pdfAlgorithm.getOwnerKey(password, ownerKeySalt, uBytes, ownerEncryption);
  25995. }
  25996. return null;
  25997. }
  25998. function prepareKeyData(fileId, password, ownerPassword, userPassword, flags, revision, keyLength, encryptMetadata) {
  25999. var hashDataSize = 40 + ownerPassword.length + fileId.length;
  26000. var hashData = new Uint8Array(hashDataSize), i = 0, j, n;
  26001. if (password) {
  26002. n = Math.min(32, password.length);
  26003. for (; i < n; ++i) {
  26004. hashData[i] = password[i];
  26005. }
  26006. }
  26007. j = 0;
  26008. while (i < 32) {
  26009. hashData[i++] = defaultPasswordBytes[j++];
  26010. }
  26011. for (j = 0, n = ownerPassword.length; j < n; ++j) {
  26012. hashData[i++] = ownerPassword[j];
  26013. }
  26014. hashData[i++] = flags & 0xFF;
  26015. hashData[i++] = flags >> 8 & 0xFF;
  26016. hashData[i++] = flags >> 16 & 0xFF;
  26017. hashData[i++] = flags >>> 24 & 0xFF;
  26018. for (j = 0, n = fileId.length; j < n; ++j) {
  26019. hashData[i++] = fileId[j];
  26020. }
  26021. if (revision >= 4 && !encryptMetadata) {
  26022. hashData[i++] = 0xFF;
  26023. hashData[i++] = 0xFF;
  26024. hashData[i++] = 0xFF;
  26025. hashData[i++] = 0xFF;
  26026. }
  26027. var hash = calculateMD5(hashData, 0, i);
  26028. var keyLengthInBytes = keyLength >> 3;
  26029. if (revision >= 3) {
  26030. for (j = 0; j < 50; ++j) {
  26031. hash = calculateMD5(hash, 0, keyLengthInBytes);
  26032. }
  26033. }
  26034. var encryptionKey = hash.subarray(0, keyLengthInBytes);
  26035. var cipher, checkData;
  26036. if (revision >= 3) {
  26037. for (i = 0; i < 32; ++i) {
  26038. hashData[i] = defaultPasswordBytes[i];
  26039. }
  26040. for (j = 0, n = fileId.length; j < n; ++j) {
  26041. hashData[i++] = fileId[j];
  26042. }
  26043. cipher = new ARCFourCipher(encryptionKey);
  26044. checkData = cipher.encryptBlock(calculateMD5(hashData, 0, i));
  26045. n = encryptionKey.length;
  26046. var derivedKey = new Uint8Array(n), k;
  26047. for (j = 1; j <= 19; ++j) {
  26048. for (k = 0; k < n; ++k) {
  26049. derivedKey[k] = encryptionKey[k] ^ j;
  26050. }
  26051. cipher = new ARCFourCipher(derivedKey);
  26052. checkData = cipher.encryptBlock(checkData);
  26053. }
  26054. for (j = 0, n = checkData.length; j < n; ++j) {
  26055. if (userPassword[j] !== checkData[j]) {
  26056. return null;
  26057. }
  26058. }
  26059. } else {
  26060. cipher = new ARCFourCipher(encryptionKey);
  26061. checkData = cipher.encryptBlock(defaultPasswordBytes);
  26062. for (j = 0, n = checkData.length; j < n; ++j) {
  26063. if (userPassword[j] !== checkData[j]) {
  26064. return null;
  26065. }
  26066. }
  26067. }
  26068. return encryptionKey;
  26069. }
  26070. function decodeUserPassword(password, ownerPassword, revision, keyLength) {
  26071. var hashData = new Uint8Array(32), i = 0, j, n;
  26072. n = Math.min(32, password.length);
  26073. for (; i < n; ++i) {
  26074. hashData[i] = password[i];
  26075. }
  26076. j = 0;
  26077. while (i < 32) {
  26078. hashData[i++] = defaultPasswordBytes[j++];
  26079. }
  26080. var hash = calculateMD5(hashData, 0, i);
  26081. var keyLengthInBytes = keyLength >> 3;
  26082. if (revision >= 3) {
  26083. for (j = 0; j < 50; ++j) {
  26084. hash = calculateMD5(hash, 0, hash.length);
  26085. }
  26086. }
  26087. var cipher, userPassword;
  26088. if (revision >= 3) {
  26089. userPassword = ownerPassword;
  26090. var derivedKey = new Uint8Array(keyLengthInBytes), k;
  26091. for (j = 19; j >= 0; j--) {
  26092. for (k = 0; k < keyLengthInBytes; ++k) {
  26093. derivedKey[k] = hash[k] ^ j;
  26094. }
  26095. cipher = new ARCFourCipher(derivedKey);
  26096. userPassword = cipher.encryptBlock(userPassword);
  26097. }
  26098. } else {
  26099. cipher = new ARCFourCipher(hash.subarray(0, keyLengthInBytes));
  26100. userPassword = cipher.encryptBlock(ownerPassword);
  26101. }
  26102. return userPassword;
  26103. }
  26104. var identityName = Name.get('Identity');
  26105. function CipherTransformFactory(dict, fileId, password) {
  26106. var filter = dict.get('Filter');
  26107. if (!isName(filter, 'Standard')) {
  26108. error('unknown encryption method');
  26109. }
  26110. this.dict = dict;
  26111. var algorithm = dict.get('V');
  26112. if (!isInt(algorithm) || algorithm !== 1 && algorithm !== 2 && algorithm !== 4 && algorithm !== 5) {
  26113. error('unsupported encryption algorithm');
  26114. }
  26115. this.algorithm = algorithm;
  26116. var keyLength = dict.get('Length');
  26117. if (!keyLength) {
  26118. if (algorithm <= 3) {
  26119. keyLength = 40;
  26120. } else {
  26121. var cfDict = dict.get('CF');
  26122. var streamCryptoName = dict.get('StmF');
  26123. if (isDict(cfDict) && isName(streamCryptoName)) {
  26124. cfDict.suppressEncryption = true;
  26125. var handlerDict = cfDict.get(streamCryptoName.name);
  26126. keyLength = handlerDict && handlerDict.get('Length') || 128;
  26127. if (keyLength < 40) {
  26128. keyLength <<= 3;
  26129. }
  26130. }
  26131. }
  26132. }
  26133. if (!isInt(keyLength) || keyLength < 40 || keyLength % 8 !== 0) {
  26134. error('invalid key length');
  26135. }
  26136. var ownerPassword = stringToBytes(dict.get('O')).subarray(0, 32);
  26137. var userPassword = stringToBytes(dict.get('U')).subarray(0, 32);
  26138. var flags = dict.get('P');
  26139. var revision = dict.get('R');
  26140. var encryptMetadata = (algorithm === 4 || algorithm === 5) && dict.get('EncryptMetadata') !== false;
  26141. this.encryptMetadata = encryptMetadata;
  26142. var fileIdBytes = stringToBytes(fileId);
  26143. var passwordBytes;
  26144. if (password) {
  26145. if (revision === 6) {
  26146. try {
  26147. password = utf8StringToString(password);
  26148. } catch (ex) {
  26149. warn('CipherTransformFactory: ' + 'Unable to convert UTF8 encoded password.');
  26150. }
  26151. }
  26152. passwordBytes = stringToBytes(password);
  26153. }
  26154. var encryptionKey;
  26155. if (algorithm !== 5) {
  26156. encryptionKey = prepareKeyData(fileIdBytes, passwordBytes, ownerPassword, userPassword, flags, revision, keyLength, encryptMetadata);
  26157. } else {
  26158. var ownerValidationSalt = stringToBytes(dict.get('O')).subarray(32, 40);
  26159. var ownerKeySalt = stringToBytes(dict.get('O')).subarray(40, 48);
  26160. var uBytes = stringToBytes(dict.get('U')).subarray(0, 48);
  26161. var userValidationSalt = stringToBytes(dict.get('U')).subarray(32, 40);
  26162. var userKeySalt = stringToBytes(dict.get('U')).subarray(40, 48);
  26163. var ownerEncryption = stringToBytes(dict.get('OE'));
  26164. var userEncryption = stringToBytes(dict.get('UE'));
  26165. var perms = stringToBytes(dict.get('Perms'));
  26166. encryptionKey = createEncryptionKey20(revision, passwordBytes, ownerPassword, ownerValidationSalt, ownerKeySalt, uBytes, userPassword, userValidationSalt, userKeySalt, ownerEncryption, userEncryption, perms);
  26167. }
  26168. if (!encryptionKey && !password) {
  26169. throw new PasswordException('No password given', PasswordResponses.NEED_PASSWORD);
  26170. } else if (!encryptionKey && password) {
  26171. var decodedPassword = decodeUserPassword(passwordBytes, ownerPassword, revision, keyLength);
  26172. encryptionKey = prepareKeyData(fileIdBytes, decodedPassword, ownerPassword, userPassword, flags, revision, keyLength, encryptMetadata);
  26173. }
  26174. if (!encryptionKey) {
  26175. throw new PasswordException('Incorrect Password', PasswordResponses.INCORRECT_PASSWORD);
  26176. }
  26177. this.encryptionKey = encryptionKey;
  26178. if (algorithm >= 4) {
  26179. var cf = dict.get('CF');
  26180. if (isDict(cf)) {
  26181. cf.suppressEncryption = true;
  26182. }
  26183. this.cf = cf;
  26184. this.stmf = dict.get('StmF') || identityName;
  26185. this.strf = dict.get('StrF') || identityName;
  26186. this.eff = dict.get('EFF') || this.stmf;
  26187. }
  26188. }
  26189. function buildObjectKey(num, gen, encryptionKey, isAes) {
  26190. var key = new Uint8Array(encryptionKey.length + 9), i, n;
  26191. for (i = 0, n = encryptionKey.length; i < n; ++i) {
  26192. key[i] = encryptionKey[i];
  26193. }
  26194. key[i++] = num & 0xFF;
  26195. key[i++] = num >> 8 & 0xFF;
  26196. key[i++] = num >> 16 & 0xFF;
  26197. key[i++] = gen & 0xFF;
  26198. key[i++] = gen >> 8 & 0xFF;
  26199. if (isAes) {
  26200. key[i++] = 0x73;
  26201. key[i++] = 0x41;
  26202. key[i++] = 0x6C;
  26203. key[i++] = 0x54;
  26204. }
  26205. var hash = calculateMD5(key, 0, i);
  26206. return hash.subarray(0, Math.min(encryptionKey.length + 5, 16));
  26207. }
  26208. function buildCipherConstructor(cf, name, num, gen, key) {
  26209. assert(isName(name), 'Invalid crypt filter name.');
  26210. var cryptFilter = cf.get(name.name);
  26211. var cfm;
  26212. if (cryptFilter !== null && cryptFilter !== undefined) {
  26213. cfm = cryptFilter.get('CFM');
  26214. }
  26215. if (!cfm || cfm.name === 'None') {
  26216. return function cipherTransformFactoryBuildCipherConstructorNone() {
  26217. return new NullCipher();
  26218. };
  26219. }
  26220. if (cfm.name === 'V2') {
  26221. return function cipherTransformFactoryBuildCipherConstructorV2() {
  26222. return new ARCFourCipher(buildObjectKey(num, gen, key, false));
  26223. };
  26224. }
  26225. if (cfm.name === 'AESV2') {
  26226. return function cipherTransformFactoryBuildCipherConstructorAESV2() {
  26227. return new AES128Cipher(buildObjectKey(num, gen, key, true));
  26228. };
  26229. }
  26230. if (cfm.name === 'AESV3') {
  26231. return function cipherTransformFactoryBuildCipherConstructorAESV3() {
  26232. return new AES256Cipher(key);
  26233. };
  26234. }
  26235. error('Unknown crypto method');
  26236. }
  26237. CipherTransformFactory.prototype = {
  26238. createCipherTransform: function CipherTransformFactory_createCipherTransform(num, gen) {
  26239. if (this.algorithm === 4 || this.algorithm === 5) {
  26240. return new CipherTransform(buildCipherConstructor(this.cf, this.stmf, num, gen, this.encryptionKey), buildCipherConstructor(this.cf, this.strf, num, gen, this.encryptionKey));
  26241. }
  26242. var key = buildObjectKey(num, gen, this.encryptionKey, false);
  26243. var cipherConstructor = function buildCipherCipherConstructor() {
  26244. return new ARCFourCipher(key);
  26245. };
  26246. return new CipherTransform(cipherConstructor, cipherConstructor);
  26247. }
  26248. };
  26249. return CipherTransformFactory;
  26250. }();
  26251. exports.AES128Cipher = AES128Cipher;
  26252. exports.AES256Cipher = AES256Cipher;
  26253. exports.ARCFourCipher = ARCFourCipher;
  26254. exports.CipherTransformFactory = CipherTransformFactory;
  26255. exports.PDF17 = PDF17;
  26256. exports.PDF20 = PDF20;
  26257. exports.calculateMD5 = calculateMD5;
  26258. exports.calculateSHA256 = calculateSHA256;
  26259. exports.calculateSHA384 = calculateSHA384;
  26260. exports.calculateSHA512 = calculateSHA512;
  26261. /***/ }),
  26262. /* 13 */
  26263. /***/ (function(module, exports, __w_pdfjs_require__) {
  26264. "use strict";
  26265. var sharedUtil = __w_pdfjs_require__(0);
  26266. var corePrimitives = __w_pdfjs_require__(1);
  26267. var coreStream = __w_pdfjs_require__(2);
  26268. var coreParser = __w_pdfjs_require__(5);
  26269. var coreImage = __w_pdfjs_require__(27);
  26270. var coreColorSpace = __w_pdfjs_require__(3);
  26271. var coreMurmurHash3 = __w_pdfjs_require__(31);
  26272. var coreFonts = __w_pdfjs_require__(26);
  26273. var coreFunction = __w_pdfjs_require__(6);
  26274. var corePattern = __w_pdfjs_require__(32);
  26275. var coreCMap = __w_pdfjs_require__(23);
  26276. var coreMetrics = __w_pdfjs_require__(30);
  26277. var coreBidi = __w_pdfjs_require__(21);
  26278. var coreEncodings = __w_pdfjs_require__(4);
  26279. var coreStandardFonts = __w_pdfjs_require__(16);
  26280. var coreUnicode = __w_pdfjs_require__(17);
  26281. var coreGlyphList = __w_pdfjs_require__(7);
  26282. var FONT_IDENTITY_MATRIX = sharedUtil.FONT_IDENTITY_MATRIX;
  26283. var IDENTITY_MATRIX = sharedUtil.IDENTITY_MATRIX;
  26284. var UNSUPPORTED_FEATURES = sharedUtil.UNSUPPORTED_FEATURES;
  26285. var ImageKind = sharedUtil.ImageKind;
  26286. var OPS = sharedUtil.OPS;
  26287. var TextRenderingMode = sharedUtil.TextRenderingMode;
  26288. var CMapCompressionType = sharedUtil.CMapCompressionType;
  26289. var Util = sharedUtil.Util;
  26290. var assert = sharedUtil.assert;
  26291. var createPromiseCapability = sharedUtil.createPromiseCapability;
  26292. var error = sharedUtil.error;
  26293. var info = sharedUtil.info;
  26294. var isArray = sharedUtil.isArray;
  26295. var isNum = sharedUtil.isNum;
  26296. var isString = sharedUtil.isString;
  26297. var getLookupTableFactory = sharedUtil.getLookupTableFactory;
  26298. var warn = sharedUtil.warn;
  26299. var Dict = corePrimitives.Dict;
  26300. var Name = corePrimitives.Name;
  26301. var isEOF = corePrimitives.isEOF;
  26302. var isCmd = corePrimitives.isCmd;
  26303. var isDict = corePrimitives.isDict;
  26304. var isName = corePrimitives.isName;
  26305. var isRef = corePrimitives.isRef;
  26306. var isStream = corePrimitives.isStream;
  26307. var DecodeStream = coreStream.DecodeStream;
  26308. var JpegStream = coreStream.JpegStream;
  26309. var Stream = coreStream.Stream;
  26310. var Lexer = coreParser.Lexer;
  26311. var Parser = coreParser.Parser;
  26312. var PDFImage = coreImage.PDFImage;
  26313. var ColorSpace = coreColorSpace.ColorSpace;
  26314. var MurmurHash3_64 = coreMurmurHash3.MurmurHash3_64;
  26315. var ErrorFont = coreFonts.ErrorFont;
  26316. var FontFlags = coreFonts.FontFlags;
  26317. var Font = coreFonts.Font;
  26318. var IdentityToUnicodeMap = coreFonts.IdentityToUnicodeMap;
  26319. var ToUnicodeMap = coreFonts.ToUnicodeMap;
  26320. var getFontType = coreFonts.getFontType;
  26321. var isPDFFunction = coreFunction.isPDFFunction;
  26322. var PDFFunction = coreFunction.PDFFunction;
  26323. var Pattern = corePattern.Pattern;
  26324. var getTilingPatternIR = corePattern.getTilingPatternIR;
  26325. var CMapFactory = coreCMap.CMapFactory;
  26326. var IdentityCMap = coreCMap.IdentityCMap;
  26327. var getMetrics = coreMetrics.getMetrics;
  26328. var bidi = coreBidi.bidi;
  26329. var WinAnsiEncoding = coreEncodings.WinAnsiEncoding;
  26330. var StandardEncoding = coreEncodings.StandardEncoding;
  26331. var MacRomanEncoding = coreEncodings.MacRomanEncoding;
  26332. var SymbolSetEncoding = coreEncodings.SymbolSetEncoding;
  26333. var ZapfDingbatsEncoding = coreEncodings.ZapfDingbatsEncoding;
  26334. var getEncoding = coreEncodings.getEncoding;
  26335. var getStdFontMap = coreStandardFonts.getStdFontMap;
  26336. var getSerifFonts = coreStandardFonts.getSerifFonts;
  26337. var getSymbolsFonts = coreStandardFonts.getSymbolsFonts;
  26338. var getNormalizedUnicodes = coreUnicode.getNormalizedUnicodes;
  26339. var reverseIfRtl = coreUnicode.reverseIfRtl;
  26340. var getUnicodeForGlyph = coreUnicode.getUnicodeForGlyph;
  26341. var getGlyphsUnicode = coreGlyphList.getGlyphsUnicode;
  26342. var PartialEvaluator = function PartialEvaluatorClosure() {
  26343. var DefaultPartialEvaluatorOptions = {
  26344. forceDataSchema: false,
  26345. maxImageSize: -1,
  26346. disableFontFace: false,
  26347. disableNativeImageDecoder: false
  26348. };
  26349. function NativeImageDecoder(xref, resources, handler, forceDataSchema) {
  26350. this.xref = xref;
  26351. this.resources = resources;
  26352. this.handler = handler;
  26353. this.forceDataSchema = forceDataSchema;
  26354. }
  26355. NativeImageDecoder.prototype = {
  26356. canDecode: function (image) {
  26357. return image instanceof JpegStream && NativeImageDecoder.isDecodable(image, this.xref, this.resources);
  26358. },
  26359. decode: function (image) {
  26360. var dict = image.dict;
  26361. var colorSpace = dict.get('ColorSpace', 'CS');
  26362. colorSpace = ColorSpace.parse(colorSpace, this.xref, this.resources);
  26363. var numComps = colorSpace.numComps;
  26364. var decodePromise = this.handler.sendWithPromise('JpegDecode', [
  26365. image.getIR(this.forceDataSchema),
  26366. numComps
  26367. ]);
  26368. return decodePromise.then(function (message) {
  26369. var data = message.data;
  26370. return new Stream(data, 0, data.length, image.dict);
  26371. });
  26372. }
  26373. };
  26374. NativeImageDecoder.isSupported = function NativeImageDecoder_isSupported(image, xref, res) {
  26375. var dict = image.dict;
  26376. if (dict.has('DecodeParms') || dict.has('DP')) {
  26377. return false;
  26378. }
  26379. var cs = ColorSpace.parse(dict.get('ColorSpace', 'CS'), xref, res);
  26380. return (cs.name === 'DeviceGray' || cs.name === 'DeviceRGB') && cs.isDefaultDecode(dict.getArray('Decode', 'D'));
  26381. };
  26382. NativeImageDecoder.isDecodable = function NativeImageDecoder_isDecodable(image, xref, res) {
  26383. var dict = image.dict;
  26384. if (dict.has('DecodeParms') || dict.has('DP')) {
  26385. return false;
  26386. }
  26387. var cs = ColorSpace.parse(dict.get('ColorSpace', 'CS'), xref, res);
  26388. return (cs.numComps === 1 || cs.numComps === 3) && cs.isDefaultDecode(dict.getArray('Decode', 'D'));
  26389. };
  26390. function PartialEvaluator(pdfManager, xref, handler, pageIndex, idFactory, fontCache, builtInCMapCache, options) {
  26391. this.pdfManager = pdfManager;
  26392. this.xref = xref;
  26393. this.handler = handler;
  26394. this.pageIndex = pageIndex;
  26395. this.idFactory = idFactory;
  26396. this.fontCache = fontCache;
  26397. this.builtInCMapCache = builtInCMapCache;
  26398. this.options = options || DefaultPartialEvaluatorOptions;
  26399. this.fetchBuiltInCMap = function (name) {
  26400. var cachedCMap = builtInCMapCache[name];
  26401. if (cachedCMap) {
  26402. return Promise.resolve(cachedCMap);
  26403. }
  26404. return handler.sendWithPromise('FetchBuiltInCMap', { name: name }).then(function (data) {
  26405. if (data.compressionType !== CMapCompressionType.NONE) {
  26406. builtInCMapCache[name] = data;
  26407. }
  26408. return data;
  26409. });
  26410. };
  26411. }
  26412. var TIME_SLOT_DURATION_MS = 20;
  26413. var CHECK_TIME_EVERY = 100;
  26414. function TimeSlotManager() {
  26415. this.reset();
  26416. }
  26417. TimeSlotManager.prototype = {
  26418. check: function TimeSlotManager_check() {
  26419. if (++this.checked < CHECK_TIME_EVERY) {
  26420. return false;
  26421. }
  26422. this.checked = 0;
  26423. return this.endTime <= Date.now();
  26424. },
  26425. reset: function TimeSlotManager_reset() {
  26426. this.endTime = Date.now() + TIME_SLOT_DURATION_MS;
  26427. this.checked = 0;
  26428. }
  26429. };
  26430. var deferred = Promise.resolve();
  26431. var TILING_PATTERN = 1, SHADING_PATTERN = 2;
  26432. PartialEvaluator.prototype = {
  26433. hasBlendModes: function PartialEvaluator_hasBlendModes(resources) {
  26434. if (!isDict(resources)) {
  26435. return false;
  26436. }
  26437. var processed = Object.create(null);
  26438. if (resources.objId) {
  26439. processed[resources.objId] = true;
  26440. }
  26441. var nodes = [resources], xref = this.xref;
  26442. while (nodes.length) {
  26443. var key, i, ii;
  26444. var node = nodes.shift();
  26445. var graphicStates = node.get('ExtGState');
  26446. if (isDict(graphicStates)) {
  26447. var graphicStatesKeys = graphicStates.getKeys();
  26448. for (i = 0, ii = graphicStatesKeys.length; i < ii; i++) {
  26449. key = graphicStatesKeys[i];
  26450. var graphicState = graphicStates.get(key);
  26451. var bm = graphicState.get('BM');
  26452. if (isName(bm) && bm.name !== 'Normal') {
  26453. return true;
  26454. }
  26455. }
  26456. }
  26457. var xObjects = node.get('XObject');
  26458. if (!isDict(xObjects)) {
  26459. continue;
  26460. }
  26461. var xObjectsKeys = xObjects.getKeys();
  26462. for (i = 0, ii = xObjectsKeys.length; i < ii; i++) {
  26463. key = xObjectsKeys[i];
  26464. var xObject = xObjects.getRaw(key);
  26465. if (isRef(xObject)) {
  26466. if (processed[xObject.toString()]) {
  26467. continue;
  26468. }
  26469. xObject = xref.fetch(xObject);
  26470. }
  26471. if (!isStream(xObject)) {
  26472. continue;
  26473. }
  26474. if (xObject.dict.objId) {
  26475. if (processed[xObject.dict.objId]) {
  26476. continue;
  26477. }
  26478. processed[xObject.dict.objId] = true;
  26479. }
  26480. var xResources = xObject.dict.get('Resources');
  26481. if (isDict(xResources) && (!xResources.objId || !processed[xResources.objId])) {
  26482. nodes.push(xResources);
  26483. if (xResources.objId) {
  26484. processed[xResources.objId] = true;
  26485. }
  26486. }
  26487. }
  26488. }
  26489. return false;
  26490. },
  26491. buildFormXObject: function PartialEvaluator_buildFormXObject(resources, xobj, smask, operatorList, task, initialState) {
  26492. var matrix = xobj.dict.getArray('Matrix');
  26493. var bbox = xobj.dict.getArray('BBox');
  26494. var group = xobj.dict.get('Group');
  26495. if (group) {
  26496. var groupOptions = {
  26497. matrix: matrix,
  26498. bbox: bbox,
  26499. smask: smask,
  26500. isolated: false,
  26501. knockout: false
  26502. };
  26503. var groupSubtype = group.get('S');
  26504. var colorSpace;
  26505. if (isName(groupSubtype, 'Transparency')) {
  26506. groupOptions.isolated = group.get('I') || false;
  26507. groupOptions.knockout = group.get('K') || false;
  26508. colorSpace = group.has('CS') ? ColorSpace.parse(group.get('CS'), this.xref, resources) : null;
  26509. }
  26510. if (smask && smask.backdrop) {
  26511. colorSpace = colorSpace || ColorSpace.singletons.rgb;
  26512. smask.backdrop = colorSpace.getRgb(smask.backdrop, 0);
  26513. }
  26514. operatorList.addOp(OPS.beginGroup, [groupOptions]);
  26515. }
  26516. operatorList.addOp(OPS.paintFormXObjectBegin, [
  26517. matrix,
  26518. bbox
  26519. ]);
  26520. return this.getOperatorList(xobj, task, xobj.dict.get('Resources') || resources, operatorList, initialState).then(function () {
  26521. operatorList.addOp(OPS.paintFormXObjectEnd, []);
  26522. if (group) {
  26523. operatorList.addOp(OPS.endGroup, [groupOptions]);
  26524. }
  26525. });
  26526. },
  26527. buildPaintImageXObject: function PartialEvaluator_buildPaintImageXObject(resources, image, inline, operatorList, cacheKey, imageCache) {
  26528. var self = this;
  26529. var dict = image.dict;
  26530. var w = dict.get('Width', 'W');
  26531. var h = dict.get('Height', 'H');
  26532. if (!(w && isNum(w)) || !(h && isNum(h))) {
  26533. warn('Image dimensions are missing, or not numbers.');
  26534. return;
  26535. }
  26536. var maxImageSize = this.options.maxImageSize;
  26537. if (maxImageSize !== -1 && w * h > maxImageSize) {
  26538. warn('Image exceeded maximum allowed size and was removed.');
  26539. return;
  26540. }
  26541. var imageMask = dict.get('ImageMask', 'IM') || false;
  26542. var imgData, args;
  26543. if (imageMask) {
  26544. var width = dict.get('Width', 'W');
  26545. var height = dict.get('Height', 'H');
  26546. var bitStrideLength = width + 7 >> 3;
  26547. var imgArray = image.getBytes(bitStrideLength * height);
  26548. var decode = dict.getArray('Decode', 'D');
  26549. var inverseDecode = !!decode && decode[0] > 0;
  26550. imgData = PDFImage.createMask(imgArray, width, height, image instanceof DecodeStream, inverseDecode);
  26551. imgData.cached = true;
  26552. args = [imgData];
  26553. operatorList.addOp(OPS.paintImageMaskXObject, args);
  26554. if (cacheKey) {
  26555. imageCache[cacheKey] = {
  26556. fn: OPS.paintImageMaskXObject,
  26557. args: args
  26558. };
  26559. }
  26560. return;
  26561. }
  26562. var softMask = dict.get('SMask', 'SM') || false;
  26563. var mask = dict.get('Mask') || false;
  26564. var SMALL_IMAGE_DIMENSIONS = 200;
  26565. if (inline && !softMask && !mask && !(image instanceof JpegStream) && w + h < SMALL_IMAGE_DIMENSIONS) {
  26566. var imageObj = new PDFImage(this.xref, resources, image, inline, null, null);
  26567. imgData = imageObj.createImageData(true);
  26568. operatorList.addOp(OPS.paintInlineImageXObject, [imgData]);
  26569. return;
  26570. }
  26571. var useNativeImageDecoder = !this.options.disableNativeImageDecoder;
  26572. var objId = 'img_' + this.idFactory.createObjId();
  26573. operatorList.addDependency(objId);
  26574. args = [
  26575. objId,
  26576. w,
  26577. h
  26578. ];
  26579. if (useNativeImageDecoder && !softMask && !mask && image instanceof JpegStream && NativeImageDecoder.isSupported(image, this.xref, resources)) {
  26580. operatorList.addOp(OPS.paintJpegXObject, args);
  26581. this.handler.send('obj', [
  26582. objId,
  26583. this.pageIndex,
  26584. 'JpegStream',
  26585. image.getIR(this.options.forceDataSchema)
  26586. ]);
  26587. return;
  26588. }
  26589. var nativeImageDecoder = null;
  26590. if (useNativeImageDecoder && (image instanceof JpegStream || mask instanceof JpegStream || softMask instanceof JpegStream)) {
  26591. nativeImageDecoder = new NativeImageDecoder(self.xref, resources, self.handler, self.options.forceDataSchema);
  26592. }
  26593. PDFImage.buildImage(self.handler, self.xref, resources, image, inline, nativeImageDecoder).then(function (imageObj) {
  26594. var imgData = imageObj.createImageData(false);
  26595. self.handler.send('obj', [
  26596. objId,
  26597. self.pageIndex,
  26598. 'Image',
  26599. imgData
  26600. ], [imgData.data.buffer]);
  26601. }).then(undefined, function (reason) {
  26602. warn('Unable to decode image: ' + reason);
  26603. self.handler.send('obj', [
  26604. objId,
  26605. self.pageIndex,
  26606. 'Image',
  26607. null
  26608. ]);
  26609. });
  26610. operatorList.addOp(OPS.paintImageXObject, args);
  26611. if (cacheKey) {
  26612. imageCache[cacheKey] = {
  26613. fn: OPS.paintImageXObject,
  26614. args: args
  26615. };
  26616. }
  26617. },
  26618. handleSMask: function PartialEvaluator_handleSmask(smask, resources, operatorList, task, stateManager) {
  26619. var smaskContent = smask.get('G');
  26620. var smaskOptions = {
  26621. subtype: smask.get('S').name,
  26622. backdrop: smask.get('BC')
  26623. };
  26624. var transferObj = smask.get('TR');
  26625. if (isPDFFunction(transferObj)) {
  26626. var transferFn = PDFFunction.parse(this.xref, transferObj);
  26627. var transferMap = new Uint8Array(256);
  26628. var tmp = new Float32Array(1);
  26629. for (var i = 0; i < 256; i++) {
  26630. tmp[0] = i / 255;
  26631. transferFn(tmp, 0, tmp, 0);
  26632. transferMap[i] = tmp[0] * 255 | 0;
  26633. }
  26634. smaskOptions.transferMap = transferMap;
  26635. }
  26636. return this.buildFormXObject(resources, smaskContent, smaskOptions, operatorList, task, stateManager.state.clone());
  26637. },
  26638. handleTilingType: function PartialEvaluator_handleTilingType(fn, args, resources, pattern, patternDict, operatorList, task) {
  26639. var tilingOpList = new OperatorList();
  26640. var resourcesArray = [
  26641. patternDict.get('Resources'),
  26642. resources
  26643. ];
  26644. var patternResources = Dict.merge(this.xref, resourcesArray);
  26645. return this.getOperatorList(pattern, task, patternResources, tilingOpList).then(function () {
  26646. operatorList.addDependencies(tilingOpList.dependencies);
  26647. operatorList.addOp(fn, getTilingPatternIR({
  26648. fnArray: tilingOpList.fnArray,
  26649. argsArray: tilingOpList.argsArray
  26650. }, patternDict, args));
  26651. });
  26652. },
  26653. handleSetFont: function PartialEvaluator_handleSetFont(resources, fontArgs, fontRef, operatorList, task, state) {
  26654. var fontName;
  26655. if (fontArgs) {
  26656. fontArgs = fontArgs.slice();
  26657. fontName = fontArgs[0].name;
  26658. }
  26659. var self = this;
  26660. return this.loadFont(fontName, fontRef, this.xref, resources).then(function (translated) {
  26661. if (!translated.font.isType3Font) {
  26662. return translated;
  26663. }
  26664. return translated.loadType3Data(self, resources, operatorList, task).then(function () {
  26665. return translated;
  26666. }, function (reason) {
  26667. self.handler.send('UnsupportedFeature', { featureId: UNSUPPORTED_FEATURES.font });
  26668. return new TranslatedFont('g_font_error', new ErrorFont('Type3 font load error: ' + reason), translated.font);
  26669. });
  26670. }).then(function (translated) {
  26671. state.font = translated.font;
  26672. translated.send(self.handler);
  26673. return translated.loadedName;
  26674. });
  26675. },
  26676. handleText: function PartialEvaluator_handleText(chars, state) {
  26677. var font = state.font;
  26678. var glyphs = font.charsToGlyphs(chars);
  26679. var isAddToPathSet = !!(state.textRenderingMode & TextRenderingMode.ADD_TO_PATH_FLAG);
  26680. if (font.data && (isAddToPathSet || this.options.disableFontFace)) {
  26681. var buildPath = function (fontChar) {
  26682. if (!font.renderer.hasBuiltPath(fontChar)) {
  26683. var path = font.renderer.getPathJs(fontChar);
  26684. this.handler.send('commonobj', [
  26685. font.loadedName + '_path_' + fontChar,
  26686. 'FontPath',
  26687. path
  26688. ]);
  26689. }
  26690. }.bind(this);
  26691. for (var i = 0, ii = glyphs.length; i < ii; i++) {
  26692. var glyph = glyphs[i];
  26693. buildPath(glyph.fontChar);
  26694. var accent = glyph.accent;
  26695. if (accent && accent.fontChar) {
  26696. buildPath(accent.fontChar);
  26697. }
  26698. }
  26699. }
  26700. return glyphs;
  26701. },
  26702. setGState: function PartialEvaluator_setGState(resources, gState, operatorList, task, xref, stateManager) {
  26703. var gStateObj = [];
  26704. var gStateKeys = gState.getKeys();
  26705. var self = this;
  26706. var promise = Promise.resolve();
  26707. for (var i = 0, ii = gStateKeys.length; i < ii; i++) {
  26708. var key = gStateKeys[i];
  26709. var value = gState.get(key);
  26710. switch (key) {
  26711. case 'Type':
  26712. break;
  26713. case 'LW':
  26714. case 'LC':
  26715. case 'LJ':
  26716. case 'ML':
  26717. case 'D':
  26718. case 'RI':
  26719. case 'FL':
  26720. case 'CA':
  26721. case 'ca':
  26722. gStateObj.push([
  26723. key,
  26724. value
  26725. ]);
  26726. break;
  26727. case 'Font':
  26728. promise = promise.then(function () {
  26729. return self.handleSetFont(resources, null, value[0], operatorList, task, stateManager.state).then(function (loadedName) {
  26730. operatorList.addDependency(loadedName);
  26731. gStateObj.push([
  26732. key,
  26733. [
  26734. loadedName,
  26735. value[1]
  26736. ]
  26737. ]);
  26738. });
  26739. });
  26740. break;
  26741. case 'BM':
  26742. gStateObj.push([
  26743. key,
  26744. value
  26745. ]);
  26746. break;
  26747. case 'SMask':
  26748. if (isName(value, 'None')) {
  26749. gStateObj.push([
  26750. key,
  26751. false
  26752. ]);
  26753. break;
  26754. }
  26755. if (isDict(value)) {
  26756. promise = promise.then(function (dict) {
  26757. return self.handleSMask(dict, resources, operatorList, task, stateManager);
  26758. }.bind(this, value));
  26759. gStateObj.push([
  26760. key,
  26761. true
  26762. ]);
  26763. } else {
  26764. warn('Unsupported SMask type');
  26765. }
  26766. break;
  26767. case 'OP':
  26768. case 'op':
  26769. case 'OPM':
  26770. case 'BG':
  26771. case 'BG2':
  26772. case 'UCR':
  26773. case 'UCR2':
  26774. case 'TR':
  26775. case 'TR2':
  26776. case 'HT':
  26777. case 'SM':
  26778. case 'SA':
  26779. case 'AIS':
  26780. case 'TK':
  26781. info('graphic state operator ' + key);
  26782. break;
  26783. default:
  26784. info('Unknown graphic state operator ' + key);
  26785. break;
  26786. }
  26787. }
  26788. return promise.then(function () {
  26789. if (gStateObj.length > 0) {
  26790. operatorList.addOp(OPS.setGState, [gStateObj]);
  26791. }
  26792. });
  26793. },
  26794. loadFont: function PartialEvaluator_loadFont(fontName, font, xref, resources) {
  26795. function errorFont() {
  26796. return Promise.resolve(new TranslatedFont('g_font_error', new ErrorFont('Font ' + fontName + ' is not available'), font));
  26797. }
  26798. var fontRef;
  26799. if (font) {
  26800. assert(isRef(font));
  26801. fontRef = font;
  26802. } else {
  26803. var fontRes = resources.get('Font');
  26804. if (fontRes) {
  26805. fontRef = fontRes.getRaw(fontName);
  26806. } else {
  26807. warn('fontRes not available');
  26808. return errorFont();
  26809. }
  26810. }
  26811. if (!fontRef) {
  26812. warn('fontRef not available');
  26813. return errorFont();
  26814. }
  26815. if (this.fontCache.has(fontRef)) {
  26816. return this.fontCache.get(fontRef);
  26817. }
  26818. font = xref.fetchIfRef(fontRef);
  26819. if (!isDict(font)) {
  26820. return errorFont();
  26821. }
  26822. if (font.translated) {
  26823. return font.translated;
  26824. }
  26825. var fontCapability = createPromiseCapability();
  26826. var preEvaluatedFont = this.preEvaluateFont(font, xref);
  26827. var descriptor = preEvaluatedFont.descriptor;
  26828. var fontRefIsRef = isRef(fontRef), fontID;
  26829. if (fontRefIsRef) {
  26830. fontID = fontRef.toString();
  26831. }
  26832. if (isDict(descriptor)) {
  26833. if (!descriptor.fontAliases) {
  26834. descriptor.fontAliases = Object.create(null);
  26835. }
  26836. var fontAliases = descriptor.fontAliases;
  26837. var hash = preEvaluatedFont.hash;
  26838. if (fontAliases[hash]) {
  26839. var aliasFontRef = fontAliases[hash].aliasRef;
  26840. if (fontRefIsRef && aliasFontRef && this.fontCache.has(aliasFontRef)) {
  26841. this.fontCache.putAlias(fontRef, aliasFontRef);
  26842. return this.fontCache.get(fontRef);
  26843. }
  26844. } else {
  26845. fontAliases[hash] = { fontID: Font.getFontID() };
  26846. }
  26847. if (fontRefIsRef) {
  26848. fontAliases[hash].aliasRef = fontRef;
  26849. }
  26850. fontID = fontAliases[hash].fontID;
  26851. }
  26852. if (fontRefIsRef) {
  26853. this.fontCache.put(fontRef, fontCapability.promise);
  26854. } else {
  26855. if (!fontID) {
  26856. fontID = this.idFactory.createObjId();
  26857. }
  26858. this.fontCache.put('id_' + fontID, fontCapability.promise);
  26859. }
  26860. assert(fontID, 'The "fontID" must be defined.');
  26861. font.loadedName = 'g_' + this.pdfManager.docId + '_f' + fontID;
  26862. font.translated = fontCapability.promise;
  26863. var translatedPromise;
  26864. try {
  26865. translatedPromise = this.translateFont(preEvaluatedFont, xref);
  26866. } catch (e) {
  26867. translatedPromise = Promise.reject(e);
  26868. }
  26869. var self = this;
  26870. translatedPromise.then(function (translatedFont) {
  26871. if (translatedFont.fontType !== undefined) {
  26872. var xrefFontStats = xref.stats.fontTypes;
  26873. xrefFontStats[translatedFont.fontType] = true;
  26874. }
  26875. fontCapability.resolve(new TranslatedFont(font.loadedName, translatedFont, font));
  26876. }, function (reason) {
  26877. self.handler.send('UnsupportedFeature', { featureId: UNSUPPORTED_FEATURES.font });
  26878. try {
  26879. var descriptor = preEvaluatedFont.descriptor;
  26880. var fontFile3 = descriptor && descriptor.get('FontFile3');
  26881. var subtype = fontFile3 && fontFile3.get('Subtype');
  26882. var fontType = getFontType(preEvaluatedFont.type, subtype && subtype.name);
  26883. var xrefFontStats = xref.stats.fontTypes;
  26884. xrefFontStats[fontType] = true;
  26885. } catch (ex) {
  26886. }
  26887. fontCapability.resolve(new TranslatedFont(font.loadedName, new ErrorFont(reason instanceof Error ? reason.message : reason), font));
  26888. });
  26889. return fontCapability.promise;
  26890. },
  26891. buildPath: function PartialEvaluator_buildPath(operatorList, fn, args) {
  26892. var lastIndex = operatorList.length - 1;
  26893. if (!args) {
  26894. args = [];
  26895. }
  26896. if (lastIndex < 0 || operatorList.fnArray[lastIndex] !== OPS.constructPath) {
  26897. operatorList.addOp(OPS.constructPath, [
  26898. [fn],
  26899. args
  26900. ]);
  26901. } else {
  26902. var opArgs = operatorList.argsArray[lastIndex];
  26903. opArgs[0].push(fn);
  26904. Array.prototype.push.apply(opArgs[1], args);
  26905. }
  26906. },
  26907. handleColorN: function PartialEvaluator_handleColorN(operatorList, fn, args, cs, patterns, resources, task, xref) {
  26908. var patternName = args[args.length - 1];
  26909. var pattern;
  26910. if (isName(patternName) && (pattern = patterns.get(patternName.name))) {
  26911. var dict = isStream(pattern) ? pattern.dict : pattern;
  26912. var typeNum = dict.get('PatternType');
  26913. if (typeNum === TILING_PATTERN) {
  26914. var color = cs.base ? cs.base.getRgb(args, 0) : null;
  26915. return this.handleTilingType(fn, color, resources, pattern, dict, operatorList, task);
  26916. } else if (typeNum === SHADING_PATTERN) {
  26917. var shading = dict.get('Shading');
  26918. var matrix = dict.getArray('Matrix');
  26919. pattern = Pattern.parseShading(shading, matrix, xref, resources, this.handler);
  26920. operatorList.addOp(fn, pattern.getIR());
  26921. return Promise.resolve();
  26922. }
  26923. return Promise.reject('Unknown PatternType: ' + typeNum);
  26924. }
  26925. operatorList.addOp(fn, args);
  26926. return Promise.resolve();
  26927. },
  26928. getOperatorList: function PartialEvaluator_getOperatorList(stream, task, resources, operatorList, initialState) {
  26929. var self = this;
  26930. var xref = this.xref;
  26931. var imageCache = Object.create(null);
  26932. assert(operatorList);
  26933. resources = resources || Dict.empty;
  26934. var xobjs = resources.get('XObject') || Dict.empty;
  26935. var patterns = resources.get('Pattern') || Dict.empty;
  26936. var stateManager = new StateManager(initialState || new EvalState());
  26937. var preprocessor = new EvaluatorPreprocessor(stream, xref, stateManager);
  26938. var timeSlotManager = new TimeSlotManager();
  26939. return new Promise(function promiseBody(resolve, reject) {
  26940. var next = function (promise) {
  26941. promise.then(function () {
  26942. try {
  26943. promiseBody(resolve, reject);
  26944. } catch (ex) {
  26945. reject(ex);
  26946. }
  26947. }, reject);
  26948. };
  26949. task.ensureNotTerminated();
  26950. timeSlotManager.reset();
  26951. var stop, operation = {}, i, ii, cs;
  26952. while (!(stop = timeSlotManager.check())) {
  26953. operation.args = null;
  26954. if (!preprocessor.read(operation)) {
  26955. break;
  26956. }
  26957. var args = operation.args;
  26958. var fn = operation.fn;
  26959. switch (fn | 0) {
  26960. case OPS.paintXObject:
  26961. if (args[0].code) {
  26962. break;
  26963. }
  26964. var name = args[0].name;
  26965. if (!name) {
  26966. warn('XObject must be referred to by name.');
  26967. continue;
  26968. }
  26969. if (imageCache[name] !== undefined) {
  26970. operatorList.addOp(imageCache[name].fn, imageCache[name].args);
  26971. args = null;
  26972. continue;
  26973. }
  26974. var xobj = xobjs.get(name);
  26975. if (xobj) {
  26976. assert(isStream(xobj), 'XObject should be a stream');
  26977. var type = xobj.dict.get('Subtype');
  26978. assert(isName(type), 'XObject should have a Name subtype');
  26979. if (type.name === 'Form') {
  26980. stateManager.save();
  26981. next(self.buildFormXObject(resources, xobj, null, operatorList, task, stateManager.state.clone()).then(function () {
  26982. stateManager.restore();
  26983. }));
  26984. return;
  26985. } else if (type.name === 'Image') {
  26986. self.buildPaintImageXObject(resources, xobj, false, operatorList, name, imageCache);
  26987. args = null;
  26988. continue;
  26989. } else if (type.name === 'PS') {
  26990. info('Ignored XObject subtype PS');
  26991. continue;
  26992. } else {
  26993. error('Unhandled XObject subtype ' + type.name);
  26994. }
  26995. }
  26996. break;
  26997. case OPS.setFont:
  26998. var fontSize = args[1];
  26999. next(self.handleSetFont(resources, args, null, operatorList, task, stateManager.state).then(function (loadedName) {
  27000. operatorList.addDependency(loadedName);
  27001. operatorList.addOp(OPS.setFont, [
  27002. loadedName,
  27003. fontSize
  27004. ]);
  27005. }));
  27006. return;
  27007. case OPS.endInlineImage:
  27008. var cacheKey = args[0].cacheKey;
  27009. if (cacheKey) {
  27010. var cacheEntry = imageCache[cacheKey];
  27011. if (cacheEntry !== undefined) {
  27012. operatorList.addOp(cacheEntry.fn, cacheEntry.args);
  27013. args = null;
  27014. continue;
  27015. }
  27016. }
  27017. self.buildPaintImageXObject(resources, args[0], true, operatorList, cacheKey, imageCache);
  27018. args = null;
  27019. continue;
  27020. case OPS.showText:
  27021. args[0] = self.handleText(args[0], stateManager.state);
  27022. break;
  27023. case OPS.showSpacedText:
  27024. var arr = args[0];
  27025. var combinedGlyphs = [];
  27026. var arrLength = arr.length;
  27027. var state = stateManager.state;
  27028. for (i = 0; i < arrLength; ++i) {
  27029. var arrItem = arr[i];
  27030. if (isString(arrItem)) {
  27031. Array.prototype.push.apply(combinedGlyphs, self.handleText(arrItem, state));
  27032. } else if (isNum(arrItem)) {
  27033. combinedGlyphs.push(arrItem);
  27034. }
  27035. }
  27036. args[0] = combinedGlyphs;
  27037. fn = OPS.showText;
  27038. break;
  27039. case OPS.nextLineShowText:
  27040. operatorList.addOp(OPS.nextLine);
  27041. args[0] = self.handleText(args[0], stateManager.state);
  27042. fn = OPS.showText;
  27043. break;
  27044. case OPS.nextLineSetSpacingShowText:
  27045. operatorList.addOp(OPS.nextLine);
  27046. operatorList.addOp(OPS.setWordSpacing, [args.shift()]);
  27047. operatorList.addOp(OPS.setCharSpacing, [args.shift()]);
  27048. args[0] = self.handleText(args[0], stateManager.state);
  27049. fn = OPS.showText;
  27050. break;
  27051. case OPS.setTextRenderingMode:
  27052. stateManager.state.textRenderingMode = args[0];
  27053. break;
  27054. case OPS.setFillColorSpace:
  27055. stateManager.state.fillColorSpace = ColorSpace.parse(args[0], xref, resources);
  27056. continue;
  27057. case OPS.setStrokeColorSpace:
  27058. stateManager.state.strokeColorSpace = ColorSpace.parse(args[0], xref, resources);
  27059. continue;
  27060. case OPS.setFillColor:
  27061. cs = stateManager.state.fillColorSpace;
  27062. args = cs.getRgb(args, 0);
  27063. fn = OPS.setFillRGBColor;
  27064. break;
  27065. case OPS.setStrokeColor:
  27066. cs = stateManager.state.strokeColorSpace;
  27067. args = cs.getRgb(args, 0);
  27068. fn = OPS.setStrokeRGBColor;
  27069. break;
  27070. case OPS.setFillGray:
  27071. stateManager.state.fillColorSpace = ColorSpace.singletons.gray;
  27072. args = ColorSpace.singletons.gray.getRgb(args, 0);
  27073. fn = OPS.setFillRGBColor;
  27074. break;
  27075. case OPS.setStrokeGray:
  27076. stateManager.state.strokeColorSpace = ColorSpace.singletons.gray;
  27077. args = ColorSpace.singletons.gray.getRgb(args, 0);
  27078. fn = OPS.setStrokeRGBColor;
  27079. break;
  27080. case OPS.setFillCMYKColor:
  27081. stateManager.state.fillColorSpace = ColorSpace.singletons.cmyk;
  27082. args = ColorSpace.singletons.cmyk.getRgb(args, 0);
  27083. fn = OPS.setFillRGBColor;
  27084. break;
  27085. case OPS.setStrokeCMYKColor:
  27086. stateManager.state.strokeColorSpace = ColorSpace.singletons.cmyk;
  27087. args = ColorSpace.singletons.cmyk.getRgb(args, 0);
  27088. fn = OPS.setStrokeRGBColor;
  27089. break;
  27090. case OPS.setFillRGBColor:
  27091. stateManager.state.fillColorSpace = ColorSpace.singletons.rgb;
  27092. args = ColorSpace.singletons.rgb.getRgb(args, 0);
  27093. break;
  27094. case OPS.setStrokeRGBColor:
  27095. stateManager.state.strokeColorSpace = ColorSpace.singletons.rgb;
  27096. args = ColorSpace.singletons.rgb.getRgb(args, 0);
  27097. break;
  27098. case OPS.setFillColorN:
  27099. cs = stateManager.state.fillColorSpace;
  27100. if (cs.name === 'Pattern') {
  27101. next(self.handleColorN(operatorList, OPS.setFillColorN, args, cs, patterns, resources, task, xref));
  27102. return;
  27103. }
  27104. args = cs.getRgb(args, 0);
  27105. fn = OPS.setFillRGBColor;
  27106. break;
  27107. case OPS.setStrokeColorN:
  27108. cs = stateManager.state.strokeColorSpace;
  27109. if (cs.name === 'Pattern') {
  27110. next(self.handleColorN(operatorList, OPS.setStrokeColorN, args, cs, patterns, resources, task, xref));
  27111. return;
  27112. }
  27113. args = cs.getRgb(args, 0);
  27114. fn = OPS.setStrokeRGBColor;
  27115. break;
  27116. case OPS.shadingFill:
  27117. var shadingRes = resources.get('Shading');
  27118. if (!shadingRes) {
  27119. error('No shading resource found');
  27120. }
  27121. var shading = shadingRes.get(args[0].name);
  27122. if (!shading) {
  27123. error('No shading object found');
  27124. }
  27125. var shadingFill = Pattern.parseShading(shading, null, xref, resources, self.handler);
  27126. var patternIR = shadingFill.getIR();
  27127. args = [patternIR];
  27128. fn = OPS.shadingFill;
  27129. break;
  27130. case OPS.setGState:
  27131. var dictName = args[0];
  27132. var extGState = resources.get('ExtGState');
  27133. if (!isDict(extGState) || !extGState.has(dictName.name)) {
  27134. break;
  27135. }
  27136. var gState = extGState.get(dictName.name);
  27137. next(self.setGState(resources, gState, operatorList, task, xref, stateManager));
  27138. return;
  27139. case OPS.moveTo:
  27140. case OPS.lineTo:
  27141. case OPS.curveTo:
  27142. case OPS.curveTo2:
  27143. case OPS.curveTo3:
  27144. case OPS.closePath:
  27145. self.buildPath(operatorList, fn, args);
  27146. continue;
  27147. case OPS.rectangle:
  27148. self.buildPath(operatorList, fn, args);
  27149. continue;
  27150. case OPS.markPoint:
  27151. case OPS.markPointProps:
  27152. case OPS.beginMarkedContent:
  27153. case OPS.beginMarkedContentProps:
  27154. case OPS.endMarkedContent:
  27155. case OPS.beginCompat:
  27156. case OPS.endCompat:
  27157. continue;
  27158. default:
  27159. if (args !== null) {
  27160. for (i = 0, ii = args.length; i < ii; i++) {
  27161. if (args[i] instanceof Dict) {
  27162. break;
  27163. }
  27164. }
  27165. if (i < ii) {
  27166. warn('getOperatorList - ignoring operator: ' + fn);
  27167. continue;
  27168. }
  27169. }
  27170. }
  27171. operatorList.addOp(fn, args);
  27172. }
  27173. if (stop) {
  27174. next(deferred);
  27175. return;
  27176. }
  27177. for (i = 0, ii = preprocessor.savedStatesDepth; i < ii; i++) {
  27178. operatorList.addOp(OPS.restore, []);
  27179. }
  27180. resolve();
  27181. });
  27182. },
  27183. getTextContent: function PartialEvaluator_getTextContent(stream, task, resources, stateManager, normalizeWhitespace, combineTextItems) {
  27184. stateManager = stateManager || new StateManager(new TextState());
  27185. var WhitespaceRegexp = /\s/g;
  27186. var textContent = {
  27187. items: [],
  27188. styles: Object.create(null)
  27189. };
  27190. var textContentItem = {
  27191. initialized: false,
  27192. str: [],
  27193. width: 0,
  27194. height: 0,
  27195. vertical: false,
  27196. lastAdvanceWidth: 0,
  27197. lastAdvanceHeight: 0,
  27198. textAdvanceScale: 0,
  27199. spaceWidth: 0,
  27200. fakeSpaceMin: Infinity,
  27201. fakeMultiSpaceMin: Infinity,
  27202. fakeMultiSpaceMax: -0,
  27203. textRunBreakAllowed: false,
  27204. transform: null,
  27205. fontName: null
  27206. };
  27207. var SPACE_FACTOR = 0.3;
  27208. var MULTI_SPACE_FACTOR = 1.5;
  27209. var MULTI_SPACE_FACTOR_MAX = 4;
  27210. var self = this;
  27211. var xref = this.xref;
  27212. resources = xref.fetchIfRef(resources) || Dict.empty;
  27213. var xobjs = null;
  27214. var xobjsCache = Object.create(null);
  27215. var preprocessor = new EvaluatorPreprocessor(stream, xref, stateManager);
  27216. var textState;
  27217. function ensureTextContentItem() {
  27218. if (textContentItem.initialized) {
  27219. return textContentItem;
  27220. }
  27221. var font = textState.font;
  27222. if (!(font.loadedName in textContent.styles)) {
  27223. textContent.styles[font.loadedName] = {
  27224. fontFamily: font.fallbackName,
  27225. ascent: font.ascent,
  27226. descent: font.descent,
  27227. vertical: font.vertical
  27228. };
  27229. }
  27230. textContentItem.fontName = font.loadedName;
  27231. var tsm = [
  27232. textState.fontSize * textState.textHScale,
  27233. 0,
  27234. 0,
  27235. textState.fontSize,
  27236. 0,
  27237. textState.textRise
  27238. ];
  27239. if (font.isType3Font && textState.fontMatrix !== FONT_IDENTITY_MATRIX && textState.fontSize === 1) {
  27240. var glyphHeight = font.bbox[3] - font.bbox[1];
  27241. if (glyphHeight > 0) {
  27242. glyphHeight = glyphHeight * textState.fontMatrix[3];
  27243. tsm[3] *= glyphHeight;
  27244. }
  27245. }
  27246. var trm = Util.transform(textState.ctm, Util.transform(textState.textMatrix, tsm));
  27247. textContentItem.transform = trm;
  27248. if (!font.vertical) {
  27249. textContentItem.width = 0;
  27250. textContentItem.height = Math.sqrt(trm[2] * trm[2] + trm[3] * trm[3]);
  27251. textContentItem.vertical = false;
  27252. } else {
  27253. textContentItem.width = Math.sqrt(trm[0] * trm[0] + trm[1] * trm[1]);
  27254. textContentItem.height = 0;
  27255. textContentItem.vertical = true;
  27256. }
  27257. var a = textState.textLineMatrix[0];
  27258. var b = textState.textLineMatrix[1];
  27259. var scaleLineX = Math.sqrt(a * a + b * b);
  27260. a = textState.ctm[0];
  27261. b = textState.ctm[1];
  27262. var scaleCtmX = Math.sqrt(a * a + b * b);
  27263. textContentItem.textAdvanceScale = scaleCtmX * scaleLineX;
  27264. textContentItem.lastAdvanceWidth = 0;
  27265. textContentItem.lastAdvanceHeight = 0;
  27266. var spaceWidth = font.spaceWidth / 1000 * textState.fontSize;
  27267. if (spaceWidth) {
  27268. textContentItem.spaceWidth = spaceWidth;
  27269. textContentItem.fakeSpaceMin = spaceWidth * SPACE_FACTOR;
  27270. textContentItem.fakeMultiSpaceMin = spaceWidth * MULTI_SPACE_FACTOR;
  27271. textContentItem.fakeMultiSpaceMax = spaceWidth * MULTI_SPACE_FACTOR_MAX;
  27272. textContentItem.textRunBreakAllowed = !font.isMonospace;
  27273. } else {
  27274. textContentItem.spaceWidth = 0;
  27275. textContentItem.fakeSpaceMin = Infinity;
  27276. textContentItem.fakeMultiSpaceMin = Infinity;
  27277. textContentItem.fakeMultiSpaceMax = 0;
  27278. textContentItem.textRunBreakAllowed = false;
  27279. }
  27280. textContentItem.initialized = true;
  27281. return textContentItem;
  27282. }
  27283. function replaceWhitespace(str) {
  27284. var i = 0, ii = str.length, code;
  27285. while (i < ii && (code = str.charCodeAt(i)) >= 0x20 && code <= 0x7F) {
  27286. i++;
  27287. }
  27288. return i < ii ? str.replace(WhitespaceRegexp, ' ') : str;
  27289. }
  27290. function runBidiTransform(textChunk) {
  27291. var str = textChunk.str.join('');
  27292. var bidiResult = bidi(str, -1, textChunk.vertical);
  27293. return {
  27294. str: normalizeWhitespace ? replaceWhitespace(bidiResult.str) : bidiResult.str,
  27295. dir: bidiResult.dir,
  27296. width: textChunk.width,
  27297. height: textChunk.height,
  27298. transform: textChunk.transform,
  27299. fontName: textChunk.fontName
  27300. };
  27301. }
  27302. function handleSetFont(fontName, fontRef) {
  27303. return self.loadFont(fontName, fontRef, xref, resources).then(function (translated) {
  27304. textState.font = translated.font;
  27305. textState.fontMatrix = translated.font.fontMatrix || FONT_IDENTITY_MATRIX;
  27306. });
  27307. }
  27308. function buildTextContentItem(chars) {
  27309. var font = textState.font;
  27310. var textChunk = ensureTextContentItem();
  27311. var width = 0;
  27312. var height = 0;
  27313. var glyphs = font.charsToGlyphs(chars);
  27314. for (var i = 0; i < glyphs.length; i++) {
  27315. var glyph = glyphs[i];
  27316. var glyphWidth = null;
  27317. if (font.vertical && glyph.vmetric) {
  27318. glyphWidth = glyph.vmetric[0];
  27319. } else {
  27320. glyphWidth = glyph.width;
  27321. }
  27322. var glyphUnicode = glyph.unicode;
  27323. var NormalizedUnicodes = getNormalizedUnicodes();
  27324. if (NormalizedUnicodes[glyphUnicode] !== undefined) {
  27325. glyphUnicode = NormalizedUnicodes[glyphUnicode];
  27326. }
  27327. glyphUnicode = reverseIfRtl(glyphUnicode);
  27328. var charSpacing = textState.charSpacing;
  27329. if (glyph.isSpace) {
  27330. var wordSpacing = textState.wordSpacing;
  27331. charSpacing += wordSpacing;
  27332. if (wordSpacing > 0) {
  27333. addFakeSpaces(wordSpacing, textChunk.str);
  27334. }
  27335. }
  27336. var tx = 0;
  27337. var ty = 0;
  27338. if (!font.vertical) {
  27339. var w0 = glyphWidth * textState.fontMatrix[0];
  27340. tx = (w0 * textState.fontSize + charSpacing) * textState.textHScale;
  27341. width += tx;
  27342. } else {
  27343. var w1 = glyphWidth * textState.fontMatrix[0];
  27344. ty = w1 * textState.fontSize + charSpacing;
  27345. height += ty;
  27346. }
  27347. textState.translateTextMatrix(tx, ty);
  27348. textChunk.str.push(glyphUnicode);
  27349. }
  27350. if (!font.vertical) {
  27351. textChunk.lastAdvanceWidth = width;
  27352. textChunk.width += width;
  27353. } else {
  27354. textChunk.lastAdvanceHeight = height;
  27355. textChunk.height += Math.abs(height);
  27356. }
  27357. return textChunk;
  27358. }
  27359. function addFakeSpaces(width, strBuf) {
  27360. if (width < textContentItem.fakeSpaceMin) {
  27361. return;
  27362. }
  27363. if (width < textContentItem.fakeMultiSpaceMin) {
  27364. strBuf.push(' ');
  27365. return;
  27366. }
  27367. var fakeSpaces = Math.round(width / textContentItem.spaceWidth);
  27368. while (fakeSpaces-- > 0) {
  27369. strBuf.push(' ');
  27370. }
  27371. }
  27372. function flushTextContentItem() {
  27373. if (!textContentItem.initialized) {
  27374. return;
  27375. }
  27376. textContentItem.width *= textContentItem.textAdvanceScale;
  27377. textContentItem.height *= textContentItem.textAdvanceScale;
  27378. textContent.items.push(runBidiTransform(textContentItem));
  27379. textContentItem.initialized = false;
  27380. textContentItem.str.length = 0;
  27381. }
  27382. var timeSlotManager = new TimeSlotManager();
  27383. return new Promise(function promiseBody(resolve, reject) {
  27384. var next = function (promise) {
  27385. promise.then(function () {
  27386. try {
  27387. promiseBody(resolve, reject);
  27388. } catch (ex) {
  27389. reject(ex);
  27390. }
  27391. }, reject);
  27392. };
  27393. task.ensureNotTerminated();
  27394. timeSlotManager.reset();
  27395. var stop, operation = {}, args = [];
  27396. while (!(stop = timeSlotManager.check())) {
  27397. args.length = 0;
  27398. operation.args = args;
  27399. if (!preprocessor.read(operation)) {
  27400. break;
  27401. }
  27402. textState = stateManager.state;
  27403. var fn = operation.fn;
  27404. args = operation.args;
  27405. var advance, diff;
  27406. switch (fn | 0) {
  27407. case OPS.setFont:
  27408. var fontNameArg = args[0].name, fontSizeArg = args[1];
  27409. if (textState.font && fontNameArg === textState.fontName && fontSizeArg === textState.fontSize) {
  27410. break;
  27411. }
  27412. flushTextContentItem();
  27413. textState.fontName = fontNameArg;
  27414. textState.fontSize = fontSizeArg;
  27415. next(handleSetFont(fontNameArg, null));
  27416. return;
  27417. case OPS.setTextRise:
  27418. flushTextContentItem();
  27419. textState.textRise = args[0];
  27420. break;
  27421. case OPS.setHScale:
  27422. flushTextContentItem();
  27423. textState.textHScale = args[0] / 100;
  27424. break;
  27425. case OPS.setLeading:
  27426. flushTextContentItem();
  27427. textState.leading = args[0];
  27428. break;
  27429. case OPS.moveText:
  27430. var isSameTextLine = !textState.font ? false : (textState.font.vertical ? args[0] : args[1]) === 0;
  27431. advance = args[0] - args[1];
  27432. if (combineTextItems && isSameTextLine && textContentItem.initialized && advance > 0 && advance <= textContentItem.fakeMultiSpaceMax) {
  27433. textState.translateTextLineMatrix(args[0], args[1]);
  27434. textContentItem.width += args[0] - textContentItem.lastAdvanceWidth;
  27435. textContentItem.height += args[1] - textContentItem.lastAdvanceHeight;
  27436. diff = args[0] - textContentItem.lastAdvanceWidth - (args[1] - textContentItem.lastAdvanceHeight);
  27437. addFakeSpaces(diff, textContentItem.str);
  27438. break;
  27439. }
  27440. flushTextContentItem();
  27441. textState.translateTextLineMatrix(args[0], args[1]);
  27442. textState.textMatrix = textState.textLineMatrix.slice();
  27443. break;
  27444. case OPS.setLeadingMoveText:
  27445. flushTextContentItem();
  27446. textState.leading = -args[1];
  27447. textState.translateTextLineMatrix(args[0], args[1]);
  27448. textState.textMatrix = textState.textLineMatrix.slice();
  27449. break;
  27450. case OPS.nextLine:
  27451. flushTextContentItem();
  27452. textState.carriageReturn();
  27453. break;
  27454. case OPS.setTextMatrix:
  27455. advance = textState.calcTextLineMatrixAdvance(args[0], args[1], args[2], args[3], args[4], args[5]);
  27456. if (combineTextItems && advance !== null && textContentItem.initialized && advance.value > 0 && advance.value <= textContentItem.fakeMultiSpaceMax) {
  27457. textState.translateTextLineMatrix(advance.width, advance.height);
  27458. textContentItem.width += advance.width - textContentItem.lastAdvanceWidth;
  27459. textContentItem.height += advance.height - textContentItem.lastAdvanceHeight;
  27460. diff = advance.width - textContentItem.lastAdvanceWidth - (advance.height - textContentItem.lastAdvanceHeight);
  27461. addFakeSpaces(diff, textContentItem.str);
  27462. break;
  27463. }
  27464. flushTextContentItem();
  27465. textState.setTextMatrix(args[0], args[1], args[2], args[3], args[4], args[5]);
  27466. textState.setTextLineMatrix(args[0], args[1], args[2], args[3], args[4], args[5]);
  27467. break;
  27468. case OPS.setCharSpacing:
  27469. textState.charSpacing = args[0];
  27470. break;
  27471. case OPS.setWordSpacing:
  27472. textState.wordSpacing = args[0];
  27473. break;
  27474. case OPS.beginText:
  27475. flushTextContentItem();
  27476. textState.textMatrix = IDENTITY_MATRIX.slice();
  27477. textState.textLineMatrix = IDENTITY_MATRIX.slice();
  27478. break;
  27479. case OPS.showSpacedText:
  27480. var items = args[0];
  27481. var offset;
  27482. for (var j = 0, jj = items.length; j < jj; j++) {
  27483. if (typeof items[j] === 'string') {
  27484. buildTextContentItem(items[j]);
  27485. } else if (isNum(items[j])) {
  27486. ensureTextContentItem();
  27487. advance = items[j] * textState.fontSize / 1000;
  27488. var breakTextRun = false;
  27489. if (textState.font.vertical) {
  27490. offset = advance;
  27491. textState.translateTextMatrix(0, offset);
  27492. breakTextRun = textContentItem.textRunBreakAllowed && advance > textContentItem.fakeMultiSpaceMax;
  27493. if (!breakTextRun) {
  27494. textContentItem.height += offset;
  27495. }
  27496. } else {
  27497. advance = -advance;
  27498. offset = advance * textState.textHScale;
  27499. textState.translateTextMatrix(offset, 0);
  27500. breakTextRun = textContentItem.textRunBreakAllowed && advance > textContentItem.fakeMultiSpaceMax;
  27501. if (!breakTextRun) {
  27502. textContentItem.width += offset;
  27503. }
  27504. }
  27505. if (breakTextRun) {
  27506. flushTextContentItem();
  27507. } else if (advance > 0) {
  27508. addFakeSpaces(advance, textContentItem.str);
  27509. }
  27510. }
  27511. }
  27512. break;
  27513. case OPS.showText:
  27514. buildTextContentItem(args[0]);
  27515. break;
  27516. case OPS.nextLineShowText:
  27517. flushTextContentItem();
  27518. textState.carriageReturn();
  27519. buildTextContentItem(args[0]);
  27520. break;
  27521. case OPS.nextLineSetSpacingShowText:
  27522. flushTextContentItem();
  27523. textState.wordSpacing = args[0];
  27524. textState.charSpacing = args[1];
  27525. textState.carriageReturn();
  27526. buildTextContentItem(args[2]);
  27527. break;
  27528. case OPS.paintXObject:
  27529. flushTextContentItem();
  27530. if (args[0].code) {
  27531. break;
  27532. }
  27533. if (!xobjs) {
  27534. xobjs = resources.get('XObject') || Dict.empty;
  27535. }
  27536. var name = args[0].name;
  27537. if (xobjsCache.key === name) {
  27538. if (xobjsCache.texts) {
  27539. Util.appendToArray(textContent.items, xobjsCache.texts.items);
  27540. Util.extendObj(textContent.styles, xobjsCache.texts.styles);
  27541. }
  27542. break;
  27543. }
  27544. var xobj = xobjs.get(name);
  27545. if (!xobj) {
  27546. break;
  27547. }
  27548. assert(isStream(xobj), 'XObject should be a stream');
  27549. var type = xobj.dict.get('Subtype');
  27550. assert(isName(type), 'XObject should have a Name subtype');
  27551. if ('Form' !== type.name) {
  27552. xobjsCache.key = name;
  27553. xobjsCache.texts = null;
  27554. break;
  27555. }
  27556. stateManager.save();
  27557. var matrix = xobj.dict.getArray('Matrix');
  27558. if (isArray(matrix) && matrix.length === 6) {
  27559. stateManager.transform(matrix);
  27560. }
  27561. next(self.getTextContent(xobj, task, xobj.dict.get('Resources') || resources, stateManager, normalizeWhitespace, combineTextItems).then(function (formTextContent) {
  27562. Util.appendToArray(textContent.items, formTextContent.items);
  27563. Util.extendObj(textContent.styles, formTextContent.styles);
  27564. stateManager.restore();
  27565. xobjsCache.key = name;
  27566. xobjsCache.texts = formTextContent;
  27567. }));
  27568. return;
  27569. case OPS.setGState:
  27570. flushTextContentItem();
  27571. var dictName = args[0];
  27572. var extGState = resources.get('ExtGState');
  27573. if (!isDict(extGState) || !isName(dictName)) {
  27574. break;
  27575. }
  27576. var gState = extGState.get(dictName.name);
  27577. if (!isDict(gState)) {
  27578. break;
  27579. }
  27580. var gStateFont = gState.get('Font');
  27581. if (gStateFont) {
  27582. textState.fontName = null;
  27583. textState.fontSize = gStateFont[1];
  27584. next(handleSetFont(null, gStateFont[0]));
  27585. return;
  27586. }
  27587. break;
  27588. }
  27589. }
  27590. if (stop) {
  27591. next(deferred);
  27592. return;
  27593. }
  27594. flushTextContentItem();
  27595. resolve(textContent);
  27596. });
  27597. },
  27598. extractDataStructures: function PartialEvaluator_extractDataStructures(dict, baseDict, xref, properties) {
  27599. var toUnicode = dict.get('ToUnicode') || baseDict.get('ToUnicode');
  27600. var toUnicodePromise = toUnicode ? this.readToUnicode(toUnicode) : Promise.resolve(undefined);
  27601. if (properties.composite) {
  27602. var cidSystemInfo = dict.get('CIDSystemInfo');
  27603. if (isDict(cidSystemInfo)) {
  27604. properties.cidSystemInfo = {
  27605. registry: cidSystemInfo.get('Registry'),
  27606. ordering: cidSystemInfo.get('Ordering'),
  27607. supplement: cidSystemInfo.get('Supplement')
  27608. };
  27609. }
  27610. var cidToGidMap = dict.get('CIDToGIDMap');
  27611. if (isStream(cidToGidMap)) {
  27612. properties.cidToGidMap = this.readCidToGidMap(cidToGidMap);
  27613. }
  27614. }
  27615. var differences = [];
  27616. var baseEncodingName = null;
  27617. var encoding;
  27618. if (dict.has('Encoding')) {
  27619. encoding = dict.get('Encoding');
  27620. if (isDict(encoding)) {
  27621. baseEncodingName = encoding.get('BaseEncoding');
  27622. baseEncodingName = isName(baseEncodingName) ? baseEncodingName.name : null;
  27623. if (encoding.has('Differences')) {
  27624. var diffEncoding = encoding.get('Differences');
  27625. var index = 0;
  27626. for (var j = 0, jj = diffEncoding.length; j < jj; j++) {
  27627. var data = xref.fetchIfRef(diffEncoding[j]);
  27628. if (isNum(data)) {
  27629. index = data;
  27630. } else if (isName(data)) {
  27631. differences[index++] = data.name;
  27632. } else {
  27633. error('Invalid entry in \'Differences\' array: ' + data);
  27634. }
  27635. }
  27636. }
  27637. } else if (isName(encoding)) {
  27638. baseEncodingName = encoding.name;
  27639. } else {
  27640. error('Encoding is not a Name nor a Dict');
  27641. }
  27642. if (baseEncodingName !== 'MacRomanEncoding' && baseEncodingName !== 'MacExpertEncoding' && baseEncodingName !== 'WinAnsiEncoding') {
  27643. baseEncodingName = null;
  27644. }
  27645. }
  27646. if (baseEncodingName) {
  27647. properties.defaultEncoding = getEncoding(baseEncodingName).slice();
  27648. } else {
  27649. var isSymbolicFont = !!(properties.flags & FontFlags.Symbolic);
  27650. var isNonsymbolicFont = !!(properties.flags & FontFlags.Nonsymbolic);
  27651. encoding = StandardEncoding;
  27652. if (properties.type === 'TrueType' && !isNonsymbolicFont) {
  27653. encoding = WinAnsiEncoding;
  27654. }
  27655. if (isSymbolicFont) {
  27656. encoding = MacRomanEncoding;
  27657. if (!properties.file) {
  27658. if (/Symbol/i.test(properties.name)) {
  27659. encoding = SymbolSetEncoding;
  27660. } else if (/Dingbats/i.test(properties.name)) {
  27661. encoding = ZapfDingbatsEncoding;
  27662. }
  27663. }
  27664. }
  27665. properties.defaultEncoding = encoding;
  27666. }
  27667. properties.differences = differences;
  27668. properties.baseEncodingName = baseEncodingName;
  27669. properties.hasEncoding = !!baseEncodingName || differences.length > 0;
  27670. properties.dict = dict;
  27671. return toUnicodePromise.then(function (toUnicode) {
  27672. properties.toUnicode = toUnicode;
  27673. return this.buildToUnicode(properties);
  27674. }.bind(this)).then(function (toUnicode) {
  27675. properties.toUnicode = toUnicode;
  27676. return properties;
  27677. });
  27678. },
  27679. buildToUnicode: function PartialEvaluator_buildToUnicode(properties) {
  27680. properties.hasIncludedToUnicodeMap = !!properties.toUnicode && properties.toUnicode.length > 0;
  27681. if (properties.hasIncludedToUnicodeMap) {
  27682. return Promise.resolve(properties.toUnicode);
  27683. }
  27684. var toUnicode, charcode, glyphName;
  27685. if (!properties.composite) {
  27686. toUnicode = [];
  27687. var encoding = properties.defaultEncoding.slice();
  27688. var baseEncodingName = properties.baseEncodingName;
  27689. var differences = properties.differences;
  27690. for (charcode in differences) {
  27691. glyphName = differences[charcode];
  27692. if (glyphName === '.notdef') {
  27693. continue;
  27694. }
  27695. encoding[charcode] = glyphName;
  27696. }
  27697. var glyphsUnicodeMap = getGlyphsUnicode();
  27698. for (charcode in encoding) {
  27699. glyphName = encoding[charcode];
  27700. if (glyphName === '') {
  27701. continue;
  27702. } else if (glyphsUnicodeMap[glyphName] === undefined) {
  27703. var code = 0;
  27704. switch (glyphName[0]) {
  27705. case 'G':
  27706. if (glyphName.length === 3) {
  27707. code = parseInt(glyphName.substr(1), 16);
  27708. }
  27709. break;
  27710. case 'g':
  27711. if (glyphName.length === 5) {
  27712. code = parseInt(glyphName.substr(1), 16);
  27713. }
  27714. break;
  27715. case 'C':
  27716. case 'c':
  27717. if (glyphName.length >= 3) {
  27718. code = +glyphName.substr(1);
  27719. }
  27720. break;
  27721. default:
  27722. var unicode = getUnicodeForGlyph(glyphName, glyphsUnicodeMap);
  27723. if (unicode !== -1) {
  27724. code = unicode;
  27725. }
  27726. }
  27727. if (code) {
  27728. if (baseEncodingName && code === +charcode) {
  27729. var baseEncoding = getEncoding(baseEncodingName);
  27730. if (baseEncoding && (glyphName = baseEncoding[charcode])) {
  27731. toUnicode[charcode] = String.fromCharCode(glyphsUnicodeMap[glyphName]);
  27732. continue;
  27733. }
  27734. }
  27735. toUnicode[charcode] = String.fromCharCode(code);
  27736. }
  27737. continue;
  27738. }
  27739. toUnicode[charcode] = String.fromCharCode(glyphsUnicodeMap[glyphName]);
  27740. }
  27741. return Promise.resolve(new ToUnicodeMap(toUnicode));
  27742. }
  27743. if (properties.composite && (properties.cMap.builtInCMap && !(properties.cMap instanceof IdentityCMap) || properties.cidSystemInfo.registry === 'Adobe' && (properties.cidSystemInfo.ordering === 'GB1' || properties.cidSystemInfo.ordering === 'CNS1' || properties.cidSystemInfo.ordering === 'Japan1' || properties.cidSystemInfo.ordering === 'Korea1'))) {
  27744. var registry = properties.cidSystemInfo.registry;
  27745. var ordering = properties.cidSystemInfo.ordering;
  27746. var ucs2CMapName = Name.get(registry + '-' + ordering + '-UCS2');
  27747. return CMapFactory.create({
  27748. encoding: ucs2CMapName,
  27749. fetchBuiltInCMap: this.fetchBuiltInCMap,
  27750. useCMap: null
  27751. }).then(function (ucs2CMap) {
  27752. var cMap = properties.cMap;
  27753. toUnicode = [];
  27754. cMap.forEach(function (charcode, cid) {
  27755. assert(cid <= 0xffff, 'Max size of CID is 65,535');
  27756. var ucs2 = ucs2CMap.lookup(cid);
  27757. if (ucs2) {
  27758. toUnicode[charcode] = String.fromCharCode((ucs2.charCodeAt(0) << 8) + ucs2.charCodeAt(1));
  27759. }
  27760. });
  27761. return new ToUnicodeMap(toUnicode);
  27762. });
  27763. }
  27764. return Promise.resolve(new IdentityToUnicodeMap(properties.firstChar, properties.lastChar));
  27765. },
  27766. readToUnicode: function PartialEvaluator_readToUnicode(toUnicode) {
  27767. var cmapObj = toUnicode;
  27768. if (isName(cmapObj)) {
  27769. return CMapFactory.create({
  27770. encoding: cmapObj,
  27771. fetchBuiltInCMap: this.fetchBuiltInCMap,
  27772. useCMap: null
  27773. }).then(function (cmap) {
  27774. if (cmap instanceof IdentityCMap) {
  27775. return new IdentityToUnicodeMap(0, 0xFFFF);
  27776. }
  27777. return new ToUnicodeMap(cmap.getMap());
  27778. });
  27779. } else if (isStream(cmapObj)) {
  27780. return CMapFactory.create({
  27781. encoding: cmapObj,
  27782. fetchBuiltInCMap: this.fetchBuiltInCMap,
  27783. useCMap: null
  27784. }).then(function (cmap) {
  27785. if (cmap instanceof IdentityCMap) {
  27786. return new IdentityToUnicodeMap(0, 0xFFFF);
  27787. }
  27788. var map = new Array(cmap.length);
  27789. cmap.forEach(function (charCode, token) {
  27790. var str = [];
  27791. for (var k = 0; k < token.length; k += 2) {
  27792. var w1 = token.charCodeAt(k) << 8 | token.charCodeAt(k + 1);
  27793. if ((w1 & 0xF800) !== 0xD800) {
  27794. str.push(w1);
  27795. continue;
  27796. }
  27797. k += 2;
  27798. var w2 = token.charCodeAt(k) << 8 | token.charCodeAt(k + 1);
  27799. str.push(((w1 & 0x3ff) << 10) + (w2 & 0x3ff) + 0x10000);
  27800. }
  27801. map[charCode] = String.fromCharCode.apply(String, str);
  27802. });
  27803. return new ToUnicodeMap(map);
  27804. });
  27805. }
  27806. return Promise.resolve(null);
  27807. },
  27808. readCidToGidMap: function PartialEvaluator_readCidToGidMap(cidToGidStream) {
  27809. var glyphsData = cidToGidStream.getBytes();
  27810. var result = [];
  27811. for (var j = 0, jj = glyphsData.length; j < jj; j++) {
  27812. var glyphID = glyphsData[j++] << 8 | glyphsData[j];
  27813. if (glyphID === 0) {
  27814. continue;
  27815. }
  27816. var code = j >> 1;
  27817. result[code] = glyphID;
  27818. }
  27819. return result;
  27820. },
  27821. extractWidths: function PartialEvaluator_extractWidths(dict, xref, descriptor, properties) {
  27822. var glyphsWidths = [];
  27823. var defaultWidth = 0;
  27824. var glyphsVMetrics = [];
  27825. var defaultVMetrics;
  27826. var i, ii, j, jj, start, code, widths;
  27827. if (properties.composite) {
  27828. defaultWidth = dict.get('DW') || 1000;
  27829. widths = dict.get('W');
  27830. if (widths) {
  27831. for (i = 0, ii = widths.length; i < ii; i++) {
  27832. start = xref.fetchIfRef(widths[i++]);
  27833. code = xref.fetchIfRef(widths[i]);
  27834. if (isArray(code)) {
  27835. for (j = 0, jj = code.length; j < jj; j++) {
  27836. glyphsWidths[start++] = xref.fetchIfRef(code[j]);
  27837. }
  27838. } else {
  27839. var width = xref.fetchIfRef(widths[++i]);
  27840. for (j = start; j <= code; j++) {
  27841. glyphsWidths[j] = width;
  27842. }
  27843. }
  27844. }
  27845. }
  27846. if (properties.vertical) {
  27847. var vmetrics = dict.getArray('DW2') || [
  27848. 880,
  27849. -1000
  27850. ];
  27851. defaultVMetrics = [
  27852. vmetrics[1],
  27853. defaultWidth * 0.5,
  27854. vmetrics[0]
  27855. ];
  27856. vmetrics = dict.get('W2');
  27857. if (vmetrics) {
  27858. for (i = 0, ii = vmetrics.length; i < ii; i++) {
  27859. start = xref.fetchIfRef(vmetrics[i++]);
  27860. code = xref.fetchIfRef(vmetrics[i]);
  27861. if (isArray(code)) {
  27862. for (j = 0, jj = code.length; j < jj; j++) {
  27863. glyphsVMetrics[start++] = [
  27864. xref.fetchIfRef(code[j++]),
  27865. xref.fetchIfRef(code[j++]),
  27866. xref.fetchIfRef(code[j])
  27867. ];
  27868. }
  27869. } else {
  27870. var vmetric = [
  27871. xref.fetchIfRef(vmetrics[++i]),
  27872. xref.fetchIfRef(vmetrics[++i]),
  27873. xref.fetchIfRef(vmetrics[++i])
  27874. ];
  27875. for (j = start; j <= code; j++) {
  27876. glyphsVMetrics[j] = vmetric;
  27877. }
  27878. }
  27879. }
  27880. }
  27881. }
  27882. } else {
  27883. var firstChar = properties.firstChar;
  27884. widths = dict.get('Widths');
  27885. if (widths) {
  27886. j = firstChar;
  27887. for (i = 0, ii = widths.length; i < ii; i++) {
  27888. glyphsWidths[j++] = xref.fetchIfRef(widths[i]);
  27889. }
  27890. defaultWidth = parseFloat(descriptor.get('MissingWidth')) || 0;
  27891. } else {
  27892. var baseFontName = dict.get('BaseFont');
  27893. if (isName(baseFontName)) {
  27894. var metrics = this.getBaseFontMetrics(baseFontName.name);
  27895. glyphsWidths = this.buildCharCodeToWidth(metrics.widths, properties);
  27896. defaultWidth = metrics.defaultWidth;
  27897. }
  27898. }
  27899. }
  27900. var isMonospace = true;
  27901. var firstWidth = defaultWidth;
  27902. for (var glyph in glyphsWidths) {
  27903. var glyphWidth = glyphsWidths[glyph];
  27904. if (!glyphWidth) {
  27905. continue;
  27906. }
  27907. if (!firstWidth) {
  27908. firstWidth = glyphWidth;
  27909. continue;
  27910. }
  27911. if (firstWidth !== glyphWidth) {
  27912. isMonospace = false;
  27913. break;
  27914. }
  27915. }
  27916. if (isMonospace) {
  27917. properties.flags |= FontFlags.FixedPitch;
  27918. }
  27919. properties.defaultWidth = defaultWidth;
  27920. properties.widths = glyphsWidths;
  27921. properties.defaultVMetrics = defaultVMetrics;
  27922. properties.vmetrics = glyphsVMetrics;
  27923. },
  27924. isSerifFont: function PartialEvaluator_isSerifFont(baseFontName) {
  27925. var fontNameWoStyle = baseFontName.split('-')[0];
  27926. return fontNameWoStyle in getSerifFonts() || fontNameWoStyle.search(/serif/gi) !== -1;
  27927. },
  27928. getBaseFontMetrics: function PartialEvaluator_getBaseFontMetrics(name) {
  27929. var defaultWidth = 0;
  27930. var widths = [];
  27931. var monospace = false;
  27932. var stdFontMap = getStdFontMap();
  27933. var lookupName = stdFontMap[name] || name;
  27934. var Metrics = getMetrics();
  27935. if (!(lookupName in Metrics)) {
  27936. if (this.isSerifFont(name)) {
  27937. lookupName = 'Times-Roman';
  27938. } else {
  27939. lookupName = 'Helvetica';
  27940. }
  27941. }
  27942. var glyphWidths = Metrics[lookupName];
  27943. if (isNum(glyphWidths)) {
  27944. defaultWidth = glyphWidths;
  27945. monospace = true;
  27946. } else {
  27947. widths = glyphWidths();
  27948. }
  27949. return {
  27950. defaultWidth: defaultWidth,
  27951. monospace: monospace,
  27952. widths: widths
  27953. };
  27954. },
  27955. buildCharCodeToWidth: function PartialEvaluator_bulildCharCodeToWidth(widthsByGlyphName, properties) {
  27956. var widths = Object.create(null);
  27957. var differences = properties.differences;
  27958. var encoding = properties.defaultEncoding;
  27959. for (var charCode = 0; charCode < 256; charCode++) {
  27960. if (charCode in differences && widthsByGlyphName[differences[charCode]]) {
  27961. widths[charCode] = widthsByGlyphName[differences[charCode]];
  27962. continue;
  27963. }
  27964. if (charCode in encoding && widthsByGlyphName[encoding[charCode]]) {
  27965. widths[charCode] = widthsByGlyphName[encoding[charCode]];
  27966. continue;
  27967. }
  27968. }
  27969. return widths;
  27970. },
  27971. preEvaluateFont: function PartialEvaluator_preEvaluateFont(dict, xref) {
  27972. var baseDict = dict;
  27973. var type = dict.get('Subtype');
  27974. assert(isName(type), 'invalid font Subtype');
  27975. var composite = false;
  27976. var uint8array;
  27977. if (type.name === 'Type0') {
  27978. var df = dict.get('DescendantFonts');
  27979. if (!df) {
  27980. error('Descendant fonts are not specified');
  27981. }
  27982. dict = isArray(df) ? xref.fetchIfRef(df[0]) : df;
  27983. type = dict.get('Subtype');
  27984. assert(isName(type), 'invalid font Subtype');
  27985. composite = true;
  27986. }
  27987. var descriptor = dict.get('FontDescriptor');
  27988. if (descriptor) {
  27989. var hash = new MurmurHash3_64();
  27990. var encoding = baseDict.getRaw('Encoding');
  27991. if (isName(encoding)) {
  27992. hash.update(encoding.name);
  27993. } else if (isRef(encoding)) {
  27994. hash.update(encoding.toString());
  27995. } else if (isDict(encoding)) {
  27996. var keys = encoding.getKeys();
  27997. for (var i = 0, ii = keys.length; i < ii; i++) {
  27998. var entry = encoding.getRaw(keys[i]);
  27999. if (isName(entry)) {
  28000. hash.update(entry.name);
  28001. } else if (isRef(entry)) {
  28002. hash.update(entry.toString());
  28003. } else if (isArray(entry)) {
  28004. var diffLength = entry.length, diffBuf = new Array(diffLength);
  28005. for (var j = 0; j < diffLength; j++) {
  28006. var diffEntry = entry[j];
  28007. if (isName(diffEntry)) {
  28008. diffBuf[j] = diffEntry.name;
  28009. } else if (isNum(diffEntry) || isRef(diffEntry)) {
  28010. diffBuf[j] = diffEntry.toString();
  28011. }
  28012. }
  28013. hash.update(diffBuf.join());
  28014. }
  28015. }
  28016. }
  28017. var toUnicode = dict.get('ToUnicode') || baseDict.get('ToUnicode');
  28018. if (isStream(toUnicode)) {
  28019. var stream = toUnicode.str || toUnicode;
  28020. uint8array = stream.buffer ? new Uint8Array(stream.buffer.buffer, 0, stream.bufferLength) : new Uint8Array(stream.bytes.buffer, stream.start, stream.end - stream.start);
  28021. hash.update(uint8array);
  28022. } else if (isName(toUnicode)) {
  28023. hash.update(toUnicode.name);
  28024. }
  28025. var widths = dict.get('Widths') || baseDict.get('Widths');
  28026. if (widths) {
  28027. uint8array = new Uint8Array(new Uint32Array(widths).buffer);
  28028. hash.update(uint8array);
  28029. }
  28030. }
  28031. return {
  28032. descriptor: descriptor,
  28033. dict: dict,
  28034. baseDict: baseDict,
  28035. composite: composite,
  28036. type: type.name,
  28037. hash: hash ? hash.hexdigest() : ''
  28038. };
  28039. },
  28040. translateFont: function PartialEvaluator_translateFont(preEvaluatedFont, xref) {
  28041. var baseDict = preEvaluatedFont.baseDict;
  28042. var dict = preEvaluatedFont.dict;
  28043. var composite = preEvaluatedFont.composite;
  28044. var descriptor = preEvaluatedFont.descriptor;
  28045. var type = preEvaluatedFont.type;
  28046. var maxCharIndex = composite ? 0xFFFF : 0xFF;
  28047. var properties;
  28048. if (!descriptor) {
  28049. if (type === 'Type3') {
  28050. descriptor = new Dict(null);
  28051. descriptor.set('FontName', Name.get(type));
  28052. descriptor.set('FontBBox', dict.getArray('FontBBox'));
  28053. } else {
  28054. var baseFontName = dict.get('BaseFont');
  28055. if (!isName(baseFontName)) {
  28056. error('Base font is not specified');
  28057. }
  28058. baseFontName = baseFontName.name.replace(/[,_]/g, '-');
  28059. var metrics = this.getBaseFontMetrics(baseFontName);
  28060. var fontNameWoStyle = baseFontName.split('-')[0];
  28061. var flags = (this.isSerifFont(fontNameWoStyle) ? FontFlags.Serif : 0) | (metrics.monospace ? FontFlags.FixedPitch : 0) | (getSymbolsFonts()[fontNameWoStyle] ? FontFlags.Symbolic : FontFlags.Nonsymbolic);
  28062. properties = {
  28063. type: type,
  28064. name: baseFontName,
  28065. widths: metrics.widths,
  28066. defaultWidth: metrics.defaultWidth,
  28067. flags: flags,
  28068. firstChar: 0,
  28069. lastChar: maxCharIndex
  28070. };
  28071. return this.extractDataStructures(dict, dict, xref, properties).then(function (properties) {
  28072. properties.widths = this.buildCharCodeToWidth(metrics.widths, properties);
  28073. return new Font(baseFontName, null, properties);
  28074. }.bind(this));
  28075. }
  28076. }
  28077. var firstChar = dict.get('FirstChar') || 0;
  28078. var lastChar = dict.get('LastChar') || maxCharIndex;
  28079. var fontName = descriptor.get('FontName');
  28080. var baseFont = dict.get('BaseFont');
  28081. if (isString(fontName)) {
  28082. fontName = Name.get(fontName);
  28083. }
  28084. if (isString(baseFont)) {
  28085. baseFont = Name.get(baseFont);
  28086. }
  28087. if (type !== 'Type3') {
  28088. var fontNameStr = fontName && fontName.name;
  28089. var baseFontStr = baseFont && baseFont.name;
  28090. if (fontNameStr !== baseFontStr) {
  28091. info('The FontDescriptor\'s FontName is "' + fontNameStr + '" but should be the same as the Font\'s BaseFont "' + baseFontStr + '"');
  28092. if (fontNameStr && baseFontStr && baseFontStr.indexOf(fontNameStr) === 0) {
  28093. fontName = baseFont;
  28094. }
  28095. }
  28096. }
  28097. fontName = fontName || baseFont;
  28098. assert(isName(fontName), 'invalid font name');
  28099. var fontFile = descriptor.get('FontFile', 'FontFile2', 'FontFile3');
  28100. if (fontFile) {
  28101. if (fontFile.dict) {
  28102. var subtype = fontFile.dict.get('Subtype');
  28103. if (subtype) {
  28104. subtype = subtype.name;
  28105. }
  28106. var length1 = fontFile.dict.get('Length1');
  28107. var length2 = fontFile.dict.get('Length2');
  28108. var length3 = fontFile.dict.get('Length3');
  28109. }
  28110. }
  28111. properties = {
  28112. type: type,
  28113. name: fontName.name,
  28114. subtype: subtype,
  28115. file: fontFile,
  28116. length1: length1,
  28117. length2: length2,
  28118. length3: length3,
  28119. loadedName: baseDict.loadedName,
  28120. composite: composite,
  28121. wideChars: composite,
  28122. fixedPitch: false,
  28123. fontMatrix: dict.getArray('FontMatrix') || FONT_IDENTITY_MATRIX,
  28124. firstChar: firstChar || 0,
  28125. lastChar: lastChar || maxCharIndex,
  28126. bbox: descriptor.getArray('FontBBox'),
  28127. ascent: descriptor.get('Ascent'),
  28128. descent: descriptor.get('Descent'),
  28129. xHeight: descriptor.get('XHeight'),
  28130. capHeight: descriptor.get('CapHeight'),
  28131. flags: descriptor.get('Flags'),
  28132. italicAngle: descriptor.get('ItalicAngle'),
  28133. coded: false
  28134. };
  28135. var cMapPromise;
  28136. if (composite) {
  28137. var cidEncoding = baseDict.get('Encoding');
  28138. if (isName(cidEncoding)) {
  28139. properties.cidEncoding = cidEncoding.name;
  28140. }
  28141. cMapPromise = CMapFactory.create({
  28142. encoding: cidEncoding,
  28143. fetchBuiltInCMap: this.fetchBuiltInCMap,
  28144. useCMap: null
  28145. }).then(function (cMap) {
  28146. properties.cMap = cMap;
  28147. properties.vertical = properties.cMap.vertical;
  28148. });
  28149. } else {
  28150. cMapPromise = Promise.resolve(undefined);
  28151. }
  28152. return cMapPromise.then(function () {
  28153. return this.extractDataStructures(dict, baseDict, xref, properties);
  28154. }.bind(this)).then(function (properties) {
  28155. this.extractWidths(dict, xref, descriptor, properties);
  28156. if (type === 'Type3') {
  28157. properties.isType3Font = true;
  28158. }
  28159. return new Font(fontName.name, fontFile, properties);
  28160. }.bind(this));
  28161. }
  28162. };
  28163. return PartialEvaluator;
  28164. }();
  28165. var TranslatedFont = function TranslatedFontClosure() {
  28166. function TranslatedFont(loadedName, font, dict) {
  28167. this.loadedName = loadedName;
  28168. this.font = font;
  28169. this.dict = dict;
  28170. this.type3Loaded = null;
  28171. this.sent = false;
  28172. }
  28173. TranslatedFont.prototype = {
  28174. send: function (handler) {
  28175. if (this.sent) {
  28176. return;
  28177. }
  28178. var fontData = this.font.exportData();
  28179. handler.send('commonobj', [
  28180. this.loadedName,
  28181. 'Font',
  28182. fontData
  28183. ]);
  28184. this.sent = true;
  28185. },
  28186. loadType3Data: function (evaluator, resources, parentOperatorList, task) {
  28187. assert(this.font.isType3Font);
  28188. if (this.type3Loaded) {
  28189. return this.type3Loaded;
  28190. }
  28191. var translatedFont = this.font;
  28192. var loadCharProcsPromise = Promise.resolve();
  28193. var charProcs = this.dict.get('CharProcs');
  28194. var fontResources = this.dict.get('Resources') || resources;
  28195. var charProcKeys = charProcs.getKeys();
  28196. var charProcOperatorList = Object.create(null);
  28197. for (var i = 0, n = charProcKeys.length; i < n; ++i) {
  28198. loadCharProcsPromise = loadCharProcsPromise.then(function (key) {
  28199. var glyphStream = charProcs.get(key);
  28200. var operatorList = new OperatorList();
  28201. return evaluator.getOperatorList(glyphStream, task, fontResources, operatorList).then(function () {
  28202. charProcOperatorList[key] = operatorList.getIR();
  28203. parentOperatorList.addDependencies(operatorList.dependencies);
  28204. }, function (reason) {
  28205. warn('Type3 font resource \"' + key + '\" is not available');
  28206. var operatorList = new OperatorList();
  28207. charProcOperatorList[key] = operatorList.getIR();
  28208. });
  28209. }.bind(this, charProcKeys[i]));
  28210. }
  28211. this.type3Loaded = loadCharProcsPromise.then(function () {
  28212. translatedFont.charProcOperatorList = charProcOperatorList;
  28213. });
  28214. return this.type3Loaded;
  28215. }
  28216. };
  28217. return TranslatedFont;
  28218. }();
  28219. var OperatorList = function OperatorListClosure() {
  28220. var CHUNK_SIZE = 1000;
  28221. var CHUNK_SIZE_ABOUT = CHUNK_SIZE - 5;
  28222. function getTransfers(queue) {
  28223. var transfers = [];
  28224. var fnArray = queue.fnArray, argsArray = queue.argsArray;
  28225. for (var i = 0, ii = queue.length; i < ii; i++) {
  28226. switch (fnArray[i]) {
  28227. case OPS.paintInlineImageXObject:
  28228. case OPS.paintInlineImageXObjectGroup:
  28229. case OPS.paintImageMaskXObject:
  28230. var arg = argsArray[i][0];
  28231. if (!arg.cached) {
  28232. transfers.push(arg.data.buffer);
  28233. }
  28234. break;
  28235. }
  28236. }
  28237. return transfers;
  28238. }
  28239. function OperatorList(intent, messageHandler, pageIndex) {
  28240. this.messageHandler = messageHandler;
  28241. this.fnArray = [];
  28242. this.argsArray = [];
  28243. this.dependencies = Object.create(null);
  28244. this._totalLength = 0;
  28245. this.pageIndex = pageIndex;
  28246. this.intent = intent;
  28247. }
  28248. OperatorList.prototype = {
  28249. get length() {
  28250. return this.argsArray.length;
  28251. },
  28252. get totalLength() {
  28253. return this._totalLength + this.length;
  28254. },
  28255. addOp: function (fn, args) {
  28256. this.fnArray.push(fn);
  28257. this.argsArray.push(args);
  28258. if (this.messageHandler) {
  28259. if (this.fnArray.length >= CHUNK_SIZE) {
  28260. this.flush();
  28261. } else if (this.fnArray.length >= CHUNK_SIZE_ABOUT && (fn === OPS.restore || fn === OPS.endText)) {
  28262. this.flush();
  28263. }
  28264. }
  28265. },
  28266. addDependency: function (dependency) {
  28267. if (dependency in this.dependencies) {
  28268. return;
  28269. }
  28270. this.dependencies[dependency] = true;
  28271. this.addOp(OPS.dependency, [dependency]);
  28272. },
  28273. addDependencies: function (dependencies) {
  28274. for (var key in dependencies) {
  28275. this.addDependency(key);
  28276. }
  28277. },
  28278. addOpList: function (opList) {
  28279. Util.extendObj(this.dependencies, opList.dependencies);
  28280. for (var i = 0, ii = opList.length; i < ii; i++) {
  28281. this.addOp(opList.fnArray[i], opList.argsArray[i]);
  28282. }
  28283. },
  28284. getIR: function () {
  28285. return {
  28286. fnArray: this.fnArray,
  28287. argsArray: this.argsArray,
  28288. length: this.length
  28289. };
  28290. },
  28291. flush: function (lastChunk) {
  28292. if (this.intent !== 'oplist') {
  28293. new QueueOptimizer().optimize(this);
  28294. }
  28295. var transfers = getTransfers(this);
  28296. var length = this.length;
  28297. this._totalLength += length;
  28298. this.messageHandler.send('RenderPageChunk', {
  28299. operatorList: {
  28300. fnArray: this.fnArray,
  28301. argsArray: this.argsArray,
  28302. lastChunk: lastChunk,
  28303. length: length
  28304. },
  28305. pageIndex: this.pageIndex,
  28306. intent: this.intent
  28307. }, transfers);
  28308. this.dependencies = Object.create(null);
  28309. this.fnArray.length = 0;
  28310. this.argsArray.length = 0;
  28311. }
  28312. };
  28313. return OperatorList;
  28314. }();
  28315. var StateManager = function StateManagerClosure() {
  28316. function StateManager(initialState) {
  28317. this.state = initialState;
  28318. this.stateStack = [];
  28319. }
  28320. StateManager.prototype = {
  28321. save: function () {
  28322. var old = this.state;
  28323. this.stateStack.push(this.state);
  28324. this.state = old.clone();
  28325. },
  28326. restore: function () {
  28327. var prev = this.stateStack.pop();
  28328. if (prev) {
  28329. this.state = prev;
  28330. }
  28331. },
  28332. transform: function (args) {
  28333. this.state.ctm = Util.transform(this.state.ctm, args);
  28334. }
  28335. };
  28336. return StateManager;
  28337. }();
  28338. var TextState = function TextStateClosure() {
  28339. function TextState() {
  28340. this.ctm = new Float32Array(IDENTITY_MATRIX);
  28341. this.fontName = null;
  28342. this.fontSize = 0;
  28343. this.font = null;
  28344. this.fontMatrix = FONT_IDENTITY_MATRIX;
  28345. this.textMatrix = IDENTITY_MATRIX.slice();
  28346. this.textLineMatrix = IDENTITY_MATRIX.slice();
  28347. this.charSpacing = 0;
  28348. this.wordSpacing = 0;
  28349. this.leading = 0;
  28350. this.textHScale = 1;
  28351. this.textRise = 0;
  28352. }
  28353. TextState.prototype = {
  28354. setTextMatrix: function TextState_setTextMatrix(a, b, c, d, e, f) {
  28355. var m = this.textMatrix;
  28356. m[0] = a;
  28357. m[1] = b;
  28358. m[2] = c;
  28359. m[3] = d;
  28360. m[4] = e;
  28361. m[5] = f;
  28362. },
  28363. setTextLineMatrix: function TextState_setTextMatrix(a, b, c, d, e, f) {
  28364. var m = this.textLineMatrix;
  28365. m[0] = a;
  28366. m[1] = b;
  28367. m[2] = c;
  28368. m[3] = d;
  28369. m[4] = e;
  28370. m[5] = f;
  28371. },
  28372. translateTextMatrix: function TextState_translateTextMatrix(x, y) {
  28373. var m = this.textMatrix;
  28374. m[4] = m[0] * x + m[2] * y + m[4];
  28375. m[5] = m[1] * x + m[3] * y + m[5];
  28376. },
  28377. translateTextLineMatrix: function TextState_translateTextMatrix(x, y) {
  28378. var m = this.textLineMatrix;
  28379. m[4] = m[0] * x + m[2] * y + m[4];
  28380. m[5] = m[1] * x + m[3] * y + m[5];
  28381. },
  28382. calcTextLineMatrixAdvance: function TextState_calcTextLineMatrixAdvance(a, b, c, d, e, f) {
  28383. var font = this.font;
  28384. if (!font) {
  28385. return null;
  28386. }
  28387. var m = this.textLineMatrix;
  28388. if (!(a === m[0] && b === m[1] && c === m[2] && d === m[3])) {
  28389. return null;
  28390. }
  28391. var txDiff = e - m[4], tyDiff = f - m[5];
  28392. if (font.vertical && txDiff !== 0 || !font.vertical && tyDiff !== 0) {
  28393. return null;
  28394. }
  28395. var tx, ty, denominator = a * d - b * c;
  28396. if (font.vertical) {
  28397. tx = -tyDiff * c / denominator;
  28398. ty = tyDiff * a / denominator;
  28399. } else {
  28400. tx = txDiff * d / denominator;
  28401. ty = -txDiff * b / denominator;
  28402. }
  28403. return {
  28404. width: tx,
  28405. height: ty,
  28406. value: font.vertical ? ty : tx
  28407. };
  28408. },
  28409. calcRenderMatrix: function TextState_calcRendeMatrix(ctm) {
  28410. var tsm = [
  28411. this.fontSize * this.textHScale,
  28412. 0,
  28413. 0,
  28414. this.fontSize,
  28415. 0,
  28416. this.textRise
  28417. ];
  28418. return Util.transform(ctm, Util.transform(this.textMatrix, tsm));
  28419. },
  28420. carriageReturn: function TextState_carriageReturn() {
  28421. this.translateTextLineMatrix(0, -this.leading);
  28422. this.textMatrix = this.textLineMatrix.slice();
  28423. },
  28424. clone: function TextState_clone() {
  28425. var clone = Object.create(this);
  28426. clone.textMatrix = this.textMatrix.slice();
  28427. clone.textLineMatrix = this.textLineMatrix.slice();
  28428. clone.fontMatrix = this.fontMatrix.slice();
  28429. return clone;
  28430. }
  28431. };
  28432. return TextState;
  28433. }();
  28434. var EvalState = function EvalStateClosure() {
  28435. function EvalState() {
  28436. this.ctm = new Float32Array(IDENTITY_MATRIX);
  28437. this.font = null;
  28438. this.textRenderingMode = TextRenderingMode.FILL;
  28439. this.fillColorSpace = ColorSpace.singletons.gray;
  28440. this.strokeColorSpace = ColorSpace.singletons.gray;
  28441. }
  28442. EvalState.prototype = {
  28443. clone: function CanvasExtraState_clone() {
  28444. return Object.create(this);
  28445. }
  28446. };
  28447. return EvalState;
  28448. }();
  28449. var EvaluatorPreprocessor = function EvaluatorPreprocessorClosure() {
  28450. var getOPMap = getLookupTableFactory(function (t) {
  28451. t['w'] = {
  28452. id: OPS.setLineWidth,
  28453. numArgs: 1,
  28454. variableArgs: false
  28455. };
  28456. t['J'] = {
  28457. id: OPS.setLineCap,
  28458. numArgs: 1,
  28459. variableArgs: false
  28460. };
  28461. t['j'] = {
  28462. id: OPS.setLineJoin,
  28463. numArgs: 1,
  28464. variableArgs: false
  28465. };
  28466. t['M'] = {
  28467. id: OPS.setMiterLimit,
  28468. numArgs: 1,
  28469. variableArgs: false
  28470. };
  28471. t['d'] = {
  28472. id: OPS.setDash,
  28473. numArgs: 2,
  28474. variableArgs: false
  28475. };
  28476. t['ri'] = {
  28477. id: OPS.setRenderingIntent,
  28478. numArgs: 1,
  28479. variableArgs: false
  28480. };
  28481. t['i'] = {
  28482. id: OPS.setFlatness,
  28483. numArgs: 1,
  28484. variableArgs: false
  28485. };
  28486. t['gs'] = {
  28487. id: OPS.setGState,
  28488. numArgs: 1,
  28489. variableArgs: false
  28490. };
  28491. t['q'] = {
  28492. id: OPS.save,
  28493. numArgs: 0,
  28494. variableArgs: false
  28495. };
  28496. t['Q'] = {
  28497. id: OPS.restore,
  28498. numArgs: 0,
  28499. variableArgs: false
  28500. };
  28501. t['cm'] = {
  28502. id: OPS.transform,
  28503. numArgs: 6,
  28504. variableArgs: false
  28505. };
  28506. t['m'] = {
  28507. id: OPS.moveTo,
  28508. numArgs: 2,
  28509. variableArgs: false
  28510. };
  28511. t['l'] = {
  28512. id: OPS.lineTo,
  28513. numArgs: 2,
  28514. variableArgs: false
  28515. };
  28516. t['c'] = {
  28517. id: OPS.curveTo,
  28518. numArgs: 6,
  28519. variableArgs: false
  28520. };
  28521. t['v'] = {
  28522. id: OPS.curveTo2,
  28523. numArgs: 4,
  28524. variableArgs: false
  28525. };
  28526. t['y'] = {
  28527. id: OPS.curveTo3,
  28528. numArgs: 4,
  28529. variableArgs: false
  28530. };
  28531. t['h'] = {
  28532. id: OPS.closePath,
  28533. numArgs: 0,
  28534. variableArgs: false
  28535. };
  28536. t['re'] = {
  28537. id: OPS.rectangle,
  28538. numArgs: 4,
  28539. variableArgs: false
  28540. };
  28541. t['S'] = {
  28542. id: OPS.stroke,
  28543. numArgs: 0,
  28544. variableArgs: false
  28545. };
  28546. t['s'] = {
  28547. id: OPS.closeStroke,
  28548. numArgs: 0,
  28549. variableArgs: false
  28550. };
  28551. t['f'] = {
  28552. id: OPS.fill,
  28553. numArgs: 0,
  28554. variableArgs: false
  28555. };
  28556. t['F'] = {
  28557. id: OPS.fill,
  28558. numArgs: 0,
  28559. variableArgs: false
  28560. };
  28561. t['f*'] = {
  28562. id: OPS.eoFill,
  28563. numArgs: 0,
  28564. variableArgs: false
  28565. };
  28566. t['B'] = {
  28567. id: OPS.fillStroke,
  28568. numArgs: 0,
  28569. variableArgs: false
  28570. };
  28571. t['B*'] = {
  28572. id: OPS.eoFillStroke,
  28573. numArgs: 0,
  28574. variableArgs: false
  28575. };
  28576. t['b'] = {
  28577. id: OPS.closeFillStroke,
  28578. numArgs: 0,
  28579. variableArgs: false
  28580. };
  28581. t['b*'] = {
  28582. id: OPS.closeEOFillStroke,
  28583. numArgs: 0,
  28584. variableArgs: false
  28585. };
  28586. t['n'] = {
  28587. id: OPS.endPath,
  28588. numArgs: 0,
  28589. variableArgs: false
  28590. };
  28591. t['W'] = {
  28592. id: OPS.clip,
  28593. numArgs: 0,
  28594. variableArgs: false
  28595. };
  28596. t['W*'] = {
  28597. id: OPS.eoClip,
  28598. numArgs: 0,
  28599. variableArgs: false
  28600. };
  28601. t['BT'] = {
  28602. id: OPS.beginText,
  28603. numArgs: 0,
  28604. variableArgs: false
  28605. };
  28606. t['ET'] = {
  28607. id: OPS.endText,
  28608. numArgs: 0,
  28609. variableArgs: false
  28610. };
  28611. t['Tc'] = {
  28612. id: OPS.setCharSpacing,
  28613. numArgs: 1,
  28614. variableArgs: false
  28615. };
  28616. t['Tw'] = {
  28617. id: OPS.setWordSpacing,
  28618. numArgs: 1,
  28619. variableArgs: false
  28620. };
  28621. t['Tz'] = {
  28622. id: OPS.setHScale,
  28623. numArgs: 1,
  28624. variableArgs: false
  28625. };
  28626. t['TL'] = {
  28627. id: OPS.setLeading,
  28628. numArgs: 1,
  28629. variableArgs: false
  28630. };
  28631. t['Tf'] = {
  28632. id: OPS.setFont,
  28633. numArgs: 2,
  28634. variableArgs: false
  28635. };
  28636. t['Tr'] = {
  28637. id: OPS.setTextRenderingMode,
  28638. numArgs: 1,
  28639. variableArgs: false
  28640. };
  28641. t['Ts'] = {
  28642. id: OPS.setTextRise,
  28643. numArgs: 1,
  28644. variableArgs: false
  28645. };
  28646. t['Td'] = {
  28647. id: OPS.moveText,
  28648. numArgs: 2,
  28649. variableArgs: false
  28650. };
  28651. t['TD'] = {
  28652. id: OPS.setLeadingMoveText,
  28653. numArgs: 2,
  28654. variableArgs: false
  28655. };
  28656. t['Tm'] = {
  28657. id: OPS.setTextMatrix,
  28658. numArgs: 6,
  28659. variableArgs: false
  28660. };
  28661. t['T*'] = {
  28662. id: OPS.nextLine,
  28663. numArgs: 0,
  28664. variableArgs: false
  28665. };
  28666. t['Tj'] = {
  28667. id: OPS.showText,
  28668. numArgs: 1,
  28669. variableArgs: false
  28670. };
  28671. t['TJ'] = {
  28672. id: OPS.showSpacedText,
  28673. numArgs: 1,
  28674. variableArgs: false
  28675. };
  28676. t['\''] = {
  28677. id: OPS.nextLineShowText,
  28678. numArgs: 1,
  28679. variableArgs: false
  28680. };
  28681. t['"'] = {
  28682. id: OPS.nextLineSetSpacingShowText,
  28683. numArgs: 3,
  28684. variableArgs: false
  28685. };
  28686. t['d0'] = {
  28687. id: OPS.setCharWidth,
  28688. numArgs: 2,
  28689. variableArgs: false
  28690. };
  28691. t['d1'] = {
  28692. id: OPS.setCharWidthAndBounds,
  28693. numArgs: 6,
  28694. variableArgs: false
  28695. };
  28696. t['CS'] = {
  28697. id: OPS.setStrokeColorSpace,
  28698. numArgs: 1,
  28699. variableArgs: false
  28700. };
  28701. t['cs'] = {
  28702. id: OPS.setFillColorSpace,
  28703. numArgs: 1,
  28704. variableArgs: false
  28705. };
  28706. t['SC'] = {
  28707. id: OPS.setStrokeColor,
  28708. numArgs: 4,
  28709. variableArgs: true
  28710. };
  28711. t['SCN'] = {
  28712. id: OPS.setStrokeColorN,
  28713. numArgs: 33,
  28714. variableArgs: true
  28715. };
  28716. t['sc'] = {
  28717. id: OPS.setFillColor,
  28718. numArgs: 4,
  28719. variableArgs: true
  28720. };
  28721. t['scn'] = {
  28722. id: OPS.setFillColorN,
  28723. numArgs: 33,
  28724. variableArgs: true
  28725. };
  28726. t['G'] = {
  28727. id: OPS.setStrokeGray,
  28728. numArgs: 1,
  28729. variableArgs: false
  28730. };
  28731. t['g'] = {
  28732. id: OPS.setFillGray,
  28733. numArgs: 1,
  28734. variableArgs: false
  28735. };
  28736. t['RG'] = {
  28737. id: OPS.setStrokeRGBColor,
  28738. numArgs: 3,
  28739. variableArgs: false
  28740. };
  28741. t['rg'] = {
  28742. id: OPS.setFillRGBColor,
  28743. numArgs: 3,
  28744. variableArgs: false
  28745. };
  28746. t['K'] = {
  28747. id: OPS.setStrokeCMYKColor,
  28748. numArgs: 4,
  28749. variableArgs: false
  28750. };
  28751. t['k'] = {
  28752. id: OPS.setFillCMYKColor,
  28753. numArgs: 4,
  28754. variableArgs: false
  28755. };
  28756. t['sh'] = {
  28757. id: OPS.shadingFill,
  28758. numArgs: 1,
  28759. variableArgs: false
  28760. };
  28761. t['BI'] = {
  28762. id: OPS.beginInlineImage,
  28763. numArgs: 0,
  28764. variableArgs: false
  28765. };
  28766. t['ID'] = {
  28767. id: OPS.beginImageData,
  28768. numArgs: 0,
  28769. variableArgs: false
  28770. };
  28771. t['EI'] = {
  28772. id: OPS.endInlineImage,
  28773. numArgs: 1,
  28774. variableArgs: false
  28775. };
  28776. t['Do'] = {
  28777. id: OPS.paintXObject,
  28778. numArgs: 1,
  28779. variableArgs: false
  28780. };
  28781. t['MP'] = {
  28782. id: OPS.markPoint,
  28783. numArgs: 1,
  28784. variableArgs: false
  28785. };
  28786. t['DP'] = {
  28787. id: OPS.markPointProps,
  28788. numArgs: 2,
  28789. variableArgs: false
  28790. };
  28791. t['BMC'] = {
  28792. id: OPS.beginMarkedContent,
  28793. numArgs: 1,
  28794. variableArgs: false
  28795. };
  28796. t['BDC'] = {
  28797. id: OPS.beginMarkedContentProps,
  28798. numArgs: 2,
  28799. variableArgs: false
  28800. };
  28801. t['EMC'] = {
  28802. id: OPS.endMarkedContent,
  28803. numArgs: 0,
  28804. variableArgs: false
  28805. };
  28806. t['BX'] = {
  28807. id: OPS.beginCompat,
  28808. numArgs: 0,
  28809. variableArgs: false
  28810. };
  28811. t['EX'] = {
  28812. id: OPS.endCompat,
  28813. numArgs: 0,
  28814. variableArgs: false
  28815. };
  28816. t['BM'] = null;
  28817. t['BD'] = null;
  28818. t['true'] = null;
  28819. t['fa'] = null;
  28820. t['fal'] = null;
  28821. t['fals'] = null;
  28822. t['false'] = null;
  28823. t['nu'] = null;
  28824. t['nul'] = null;
  28825. t['null'] = null;
  28826. });
  28827. function EvaluatorPreprocessor(stream, xref, stateManager) {
  28828. this.opMap = getOPMap();
  28829. this.parser = new Parser(new Lexer(stream, this.opMap), false, xref);
  28830. this.stateManager = stateManager;
  28831. this.nonProcessedArgs = [];
  28832. }
  28833. EvaluatorPreprocessor.prototype = {
  28834. get savedStatesDepth() {
  28835. return this.stateManager.stateStack.length;
  28836. },
  28837. read: function EvaluatorPreprocessor_read(operation) {
  28838. var args = operation.args;
  28839. while (true) {
  28840. var obj = this.parser.getObj();
  28841. if (isCmd(obj)) {
  28842. var cmd = obj.cmd;
  28843. var opSpec = this.opMap[cmd];
  28844. if (!opSpec) {
  28845. warn('Unknown command "' + cmd + '"');
  28846. continue;
  28847. }
  28848. var fn = opSpec.id;
  28849. var numArgs = opSpec.numArgs;
  28850. var argsLength = args !== null ? args.length : 0;
  28851. if (!opSpec.variableArgs) {
  28852. if (argsLength !== numArgs) {
  28853. var nonProcessedArgs = this.nonProcessedArgs;
  28854. while (argsLength > numArgs) {
  28855. nonProcessedArgs.push(args.shift());
  28856. argsLength--;
  28857. }
  28858. while (argsLength < numArgs && nonProcessedArgs.length !== 0) {
  28859. if (args === null) {
  28860. args = [];
  28861. }
  28862. args.unshift(nonProcessedArgs.pop());
  28863. argsLength++;
  28864. }
  28865. }
  28866. if (argsLength < numArgs) {
  28867. warn('Skipping command ' + fn + ': expected ' + numArgs + ' args, but received ' + argsLength + ' args.');
  28868. if (args !== null) {
  28869. args.length = 0;
  28870. }
  28871. continue;
  28872. }
  28873. } else if (argsLength > numArgs) {
  28874. info('Command ' + fn + ': expected [0,' + numArgs + '] args, but received ' + argsLength + ' args.');
  28875. }
  28876. this.preprocessCommand(fn, args);
  28877. operation.fn = fn;
  28878. operation.args = args;
  28879. return true;
  28880. }
  28881. if (isEOF(obj)) {
  28882. return false;
  28883. }
  28884. if (obj !== null) {
  28885. if (args === null) {
  28886. args = [];
  28887. }
  28888. args.push(obj);
  28889. assert(args.length <= 33, 'Too many arguments');
  28890. }
  28891. }
  28892. },
  28893. preprocessCommand: function EvaluatorPreprocessor_preprocessCommand(fn, args) {
  28894. switch (fn | 0) {
  28895. case OPS.save:
  28896. this.stateManager.save();
  28897. break;
  28898. case OPS.restore:
  28899. this.stateManager.restore();
  28900. break;
  28901. case OPS.transform:
  28902. this.stateManager.transform(args);
  28903. break;
  28904. }
  28905. }
  28906. };
  28907. return EvaluatorPreprocessor;
  28908. }();
  28909. var QueueOptimizer = function QueueOptimizerClosure() {
  28910. function addState(parentState, pattern, fn) {
  28911. var state = parentState;
  28912. for (var i = 0, ii = pattern.length - 1; i < ii; i++) {
  28913. var item = pattern[i];
  28914. state = state[item] || (state[item] = []);
  28915. }
  28916. state[pattern[pattern.length - 1]] = fn;
  28917. }
  28918. function handlePaintSolidColorImageMask(iFirstSave, count, fnArray, argsArray) {
  28919. var iFirstPIMXO = iFirstSave + 2;
  28920. for (var i = 0; i < count; i++) {
  28921. var arg = argsArray[iFirstPIMXO + 4 * i];
  28922. var imageMask = arg.length === 1 && arg[0];
  28923. if (imageMask && imageMask.width === 1 && imageMask.height === 1 && (!imageMask.data.length || imageMask.data.length === 1 && imageMask.data[0] === 0)) {
  28924. fnArray[iFirstPIMXO + 4 * i] = OPS.paintSolidColorImageMask;
  28925. continue;
  28926. }
  28927. break;
  28928. }
  28929. return count - i;
  28930. }
  28931. var InitialState = [];
  28932. addState(InitialState, [
  28933. OPS.save,
  28934. OPS.transform,
  28935. OPS.paintInlineImageXObject,
  28936. OPS.restore
  28937. ], function foundInlineImageGroup(context) {
  28938. var MIN_IMAGES_IN_INLINE_IMAGES_BLOCK = 10;
  28939. var MAX_IMAGES_IN_INLINE_IMAGES_BLOCK = 200;
  28940. var MAX_WIDTH = 1000;
  28941. var IMAGE_PADDING = 1;
  28942. var fnArray = context.fnArray, argsArray = context.argsArray;
  28943. var curr = context.iCurr;
  28944. var iFirstSave = curr - 3;
  28945. var iFirstTransform = curr - 2;
  28946. var iFirstPIIXO = curr - 1;
  28947. var i = iFirstSave + 4;
  28948. var ii = fnArray.length;
  28949. while (i + 3 < ii) {
  28950. if (fnArray[i] !== OPS.save || fnArray[i + 1] !== OPS.transform || fnArray[i + 2] !== OPS.paintInlineImageXObject || fnArray[i + 3] !== OPS.restore) {
  28951. break;
  28952. }
  28953. i += 4;
  28954. }
  28955. var count = Math.min((i - iFirstSave) / 4, MAX_IMAGES_IN_INLINE_IMAGES_BLOCK);
  28956. if (count < MIN_IMAGES_IN_INLINE_IMAGES_BLOCK) {
  28957. return i;
  28958. }
  28959. var maxX = 0;
  28960. var map = [], maxLineHeight = 0;
  28961. var currentX = IMAGE_PADDING, currentY = IMAGE_PADDING;
  28962. var q;
  28963. for (q = 0; q < count; q++) {
  28964. var transform = argsArray[iFirstTransform + (q << 2)];
  28965. var img = argsArray[iFirstPIIXO + (q << 2)][0];
  28966. if (currentX + img.width > MAX_WIDTH) {
  28967. maxX = Math.max(maxX, currentX);
  28968. currentY += maxLineHeight + 2 * IMAGE_PADDING;
  28969. currentX = 0;
  28970. maxLineHeight = 0;
  28971. }
  28972. map.push({
  28973. transform: transform,
  28974. x: currentX,
  28975. y: currentY,
  28976. w: img.width,
  28977. h: img.height
  28978. });
  28979. currentX += img.width + 2 * IMAGE_PADDING;
  28980. maxLineHeight = Math.max(maxLineHeight, img.height);
  28981. }
  28982. var imgWidth = Math.max(maxX, currentX) + IMAGE_PADDING;
  28983. var imgHeight = currentY + maxLineHeight + IMAGE_PADDING;
  28984. var imgData = new Uint8Array(imgWidth * imgHeight * 4);
  28985. var imgRowSize = imgWidth << 2;
  28986. for (q = 0; q < count; q++) {
  28987. var data = argsArray[iFirstPIIXO + (q << 2)][0].data;
  28988. var rowSize = map[q].w << 2;
  28989. var dataOffset = 0;
  28990. var offset = map[q].x + map[q].y * imgWidth << 2;
  28991. imgData.set(data.subarray(0, rowSize), offset - imgRowSize);
  28992. for (var k = 0, kk = map[q].h; k < kk; k++) {
  28993. imgData.set(data.subarray(dataOffset, dataOffset + rowSize), offset);
  28994. dataOffset += rowSize;
  28995. offset += imgRowSize;
  28996. }
  28997. imgData.set(data.subarray(dataOffset - rowSize, dataOffset), offset);
  28998. while (offset >= 0) {
  28999. data[offset - 4] = data[offset];
  29000. data[offset - 3] = data[offset + 1];
  29001. data[offset - 2] = data[offset + 2];
  29002. data[offset - 1] = data[offset + 3];
  29003. data[offset + rowSize] = data[offset + rowSize - 4];
  29004. data[offset + rowSize + 1] = data[offset + rowSize - 3];
  29005. data[offset + rowSize + 2] = data[offset + rowSize - 2];
  29006. data[offset + rowSize + 3] = data[offset + rowSize - 1];
  29007. offset -= imgRowSize;
  29008. }
  29009. }
  29010. fnArray.splice(iFirstSave, count * 4, OPS.paintInlineImageXObjectGroup);
  29011. argsArray.splice(iFirstSave, count * 4, [
  29012. {
  29013. width: imgWidth,
  29014. height: imgHeight,
  29015. kind: ImageKind.RGBA_32BPP,
  29016. data: imgData
  29017. },
  29018. map
  29019. ]);
  29020. return iFirstSave + 1;
  29021. });
  29022. addState(InitialState, [
  29023. OPS.save,
  29024. OPS.transform,
  29025. OPS.paintImageMaskXObject,
  29026. OPS.restore
  29027. ], function foundImageMaskGroup(context) {
  29028. var MIN_IMAGES_IN_MASKS_BLOCK = 10;
  29029. var MAX_IMAGES_IN_MASKS_BLOCK = 100;
  29030. var MAX_SAME_IMAGES_IN_MASKS_BLOCK = 1000;
  29031. var fnArray = context.fnArray, argsArray = context.argsArray;
  29032. var curr = context.iCurr;
  29033. var iFirstSave = curr - 3;
  29034. var iFirstTransform = curr - 2;
  29035. var iFirstPIMXO = curr - 1;
  29036. var i = iFirstSave + 4;
  29037. var ii = fnArray.length;
  29038. while (i + 3 < ii) {
  29039. if (fnArray[i] !== OPS.save || fnArray[i + 1] !== OPS.transform || fnArray[i + 2] !== OPS.paintImageMaskXObject || fnArray[i + 3] !== OPS.restore) {
  29040. break;
  29041. }
  29042. i += 4;
  29043. }
  29044. var count = (i - iFirstSave) / 4;
  29045. count = handlePaintSolidColorImageMask(iFirstSave, count, fnArray, argsArray);
  29046. if (count < MIN_IMAGES_IN_MASKS_BLOCK) {
  29047. return i;
  29048. }
  29049. var q;
  29050. var isSameImage = false;
  29051. var iTransform, transformArgs;
  29052. var firstPIMXOArg0 = argsArray[iFirstPIMXO][0];
  29053. if (argsArray[iFirstTransform][1] === 0 && argsArray[iFirstTransform][2] === 0) {
  29054. isSameImage = true;
  29055. var firstTransformArg0 = argsArray[iFirstTransform][0];
  29056. var firstTransformArg3 = argsArray[iFirstTransform][3];
  29057. iTransform = iFirstTransform + 4;
  29058. var iPIMXO = iFirstPIMXO + 4;
  29059. for (q = 1; q < count; q++, iTransform += 4, iPIMXO += 4) {
  29060. transformArgs = argsArray[iTransform];
  29061. if (argsArray[iPIMXO][0] !== firstPIMXOArg0 || transformArgs[0] !== firstTransformArg0 || transformArgs[1] !== 0 || transformArgs[2] !== 0 || transformArgs[3] !== firstTransformArg3) {
  29062. if (q < MIN_IMAGES_IN_MASKS_BLOCK) {
  29063. isSameImage = false;
  29064. } else {
  29065. count = q;
  29066. }
  29067. break;
  29068. }
  29069. }
  29070. }
  29071. if (isSameImage) {
  29072. count = Math.min(count, MAX_SAME_IMAGES_IN_MASKS_BLOCK);
  29073. var positions = new Float32Array(count * 2);
  29074. iTransform = iFirstTransform;
  29075. for (q = 0; q < count; q++, iTransform += 4) {
  29076. transformArgs = argsArray[iTransform];
  29077. positions[q << 1] = transformArgs[4];
  29078. positions[(q << 1) + 1] = transformArgs[5];
  29079. }
  29080. fnArray.splice(iFirstSave, count * 4, OPS.paintImageMaskXObjectRepeat);
  29081. argsArray.splice(iFirstSave, count * 4, [
  29082. firstPIMXOArg0,
  29083. firstTransformArg0,
  29084. firstTransformArg3,
  29085. positions
  29086. ]);
  29087. } else {
  29088. count = Math.min(count, MAX_IMAGES_IN_MASKS_BLOCK);
  29089. var images = [];
  29090. for (q = 0; q < count; q++) {
  29091. transformArgs = argsArray[iFirstTransform + (q << 2)];
  29092. var maskParams = argsArray[iFirstPIMXO + (q << 2)][0];
  29093. images.push({
  29094. data: maskParams.data,
  29095. width: maskParams.width,
  29096. height: maskParams.height,
  29097. transform: transformArgs
  29098. });
  29099. }
  29100. fnArray.splice(iFirstSave, count * 4, OPS.paintImageMaskXObjectGroup);
  29101. argsArray.splice(iFirstSave, count * 4, [images]);
  29102. }
  29103. return iFirstSave + 1;
  29104. });
  29105. addState(InitialState, [
  29106. OPS.save,
  29107. OPS.transform,
  29108. OPS.paintImageXObject,
  29109. OPS.restore
  29110. ], function (context) {
  29111. var MIN_IMAGES_IN_BLOCK = 3;
  29112. var MAX_IMAGES_IN_BLOCK = 1000;
  29113. var fnArray = context.fnArray, argsArray = context.argsArray;
  29114. var curr = context.iCurr;
  29115. var iFirstSave = curr - 3;
  29116. var iFirstTransform = curr - 2;
  29117. var iFirstPIXO = curr - 1;
  29118. var iFirstRestore = curr;
  29119. if (argsArray[iFirstTransform][1] !== 0 || argsArray[iFirstTransform][2] !== 0) {
  29120. return iFirstRestore + 1;
  29121. }
  29122. var firstPIXOArg0 = argsArray[iFirstPIXO][0];
  29123. var firstTransformArg0 = argsArray[iFirstTransform][0];
  29124. var firstTransformArg3 = argsArray[iFirstTransform][3];
  29125. var i = iFirstSave + 4;
  29126. var ii = fnArray.length;
  29127. while (i + 3 < ii) {
  29128. if (fnArray[i] !== OPS.save || fnArray[i + 1] !== OPS.transform || fnArray[i + 2] !== OPS.paintImageXObject || fnArray[i + 3] !== OPS.restore) {
  29129. break;
  29130. }
  29131. if (argsArray[i + 1][0] !== firstTransformArg0 || argsArray[i + 1][1] !== 0 || argsArray[i + 1][2] !== 0 || argsArray[i + 1][3] !== firstTransformArg3) {
  29132. break;
  29133. }
  29134. if (argsArray[i + 2][0] !== firstPIXOArg0) {
  29135. break;
  29136. }
  29137. i += 4;
  29138. }
  29139. var count = Math.min((i - iFirstSave) / 4, MAX_IMAGES_IN_BLOCK);
  29140. if (count < MIN_IMAGES_IN_BLOCK) {
  29141. return i;
  29142. }
  29143. var positions = new Float32Array(count * 2);
  29144. var iTransform = iFirstTransform;
  29145. for (var q = 0; q < count; q++, iTransform += 4) {
  29146. var transformArgs = argsArray[iTransform];
  29147. positions[q << 1] = transformArgs[4];
  29148. positions[(q << 1) + 1] = transformArgs[5];
  29149. }
  29150. var args = [
  29151. firstPIXOArg0,
  29152. firstTransformArg0,
  29153. firstTransformArg3,
  29154. positions
  29155. ];
  29156. fnArray.splice(iFirstSave, count * 4, OPS.paintImageXObjectRepeat);
  29157. argsArray.splice(iFirstSave, count * 4, args);
  29158. return iFirstSave + 1;
  29159. });
  29160. addState(InitialState, [
  29161. OPS.beginText,
  29162. OPS.setFont,
  29163. OPS.setTextMatrix,
  29164. OPS.showText,
  29165. OPS.endText
  29166. ], function (context) {
  29167. var MIN_CHARS_IN_BLOCK = 3;
  29168. var MAX_CHARS_IN_BLOCK = 1000;
  29169. var fnArray = context.fnArray, argsArray = context.argsArray;
  29170. var curr = context.iCurr;
  29171. var iFirstBeginText = curr - 4;
  29172. var iFirstSetFont = curr - 3;
  29173. var iFirstSetTextMatrix = curr - 2;
  29174. var iFirstShowText = curr - 1;
  29175. var iFirstEndText = curr;
  29176. var firstSetFontArg0 = argsArray[iFirstSetFont][0];
  29177. var firstSetFontArg1 = argsArray[iFirstSetFont][1];
  29178. var i = iFirstBeginText + 5;
  29179. var ii = fnArray.length;
  29180. while (i + 4 < ii) {
  29181. if (fnArray[i] !== OPS.beginText || fnArray[i + 1] !== OPS.setFont || fnArray[i + 2] !== OPS.setTextMatrix || fnArray[i + 3] !== OPS.showText || fnArray[i + 4] !== OPS.endText) {
  29182. break;
  29183. }
  29184. if (argsArray[i + 1][0] !== firstSetFontArg0 || argsArray[i + 1][1] !== firstSetFontArg1) {
  29185. break;
  29186. }
  29187. i += 5;
  29188. }
  29189. var count = Math.min((i - iFirstBeginText) / 5, MAX_CHARS_IN_BLOCK);
  29190. if (count < MIN_CHARS_IN_BLOCK) {
  29191. return i;
  29192. }
  29193. var iFirst = iFirstBeginText;
  29194. 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) {
  29195. count++;
  29196. iFirst -= 5;
  29197. }
  29198. var iEndText = iFirst + 4;
  29199. for (var q = 1; q < count; q++) {
  29200. fnArray.splice(iEndText, 3);
  29201. argsArray.splice(iEndText, 3);
  29202. iEndText += 2;
  29203. }
  29204. return iEndText + 1;
  29205. });
  29206. function QueueOptimizer() {
  29207. }
  29208. QueueOptimizer.prototype = {
  29209. optimize: function QueueOptimizer_optimize(queue) {
  29210. var fnArray = queue.fnArray, argsArray = queue.argsArray;
  29211. var context = {
  29212. iCurr: 0,
  29213. fnArray: fnArray,
  29214. argsArray: argsArray
  29215. };
  29216. var state;
  29217. var i = 0, ii = fnArray.length;
  29218. while (i < ii) {
  29219. state = (state || InitialState)[fnArray[i]];
  29220. if (typeof state === 'function') {
  29221. context.iCurr = i;
  29222. i = state(context);
  29223. state = undefined;
  29224. ii = context.fnArray.length;
  29225. } else {
  29226. i++;
  29227. }
  29228. }
  29229. }
  29230. };
  29231. return QueueOptimizer;
  29232. }();
  29233. exports.OperatorList = OperatorList;
  29234. exports.PartialEvaluator = PartialEvaluator;
  29235. /***/ }),
  29236. /* 14 */
  29237. /***/ (function(module, exports, __w_pdfjs_require__) {
  29238. "use strict";
  29239. var sharedUtil = __w_pdfjs_require__(0);
  29240. var coreArithmeticDecoder = __w_pdfjs_require__(9);
  29241. var info = sharedUtil.info;
  29242. var warn = sharedUtil.warn;
  29243. var error = sharedUtil.error;
  29244. var log2 = sharedUtil.log2;
  29245. var readUint16 = sharedUtil.readUint16;
  29246. var readUint32 = sharedUtil.readUint32;
  29247. var ArithmeticDecoder = coreArithmeticDecoder.ArithmeticDecoder;
  29248. var JpxImage = function JpxImageClosure() {
  29249. var SubbandsGainLog2 = {
  29250. 'LL': 0,
  29251. 'LH': 1,
  29252. 'HL': 1,
  29253. 'HH': 2
  29254. };
  29255. function JpxImage() {
  29256. this.failOnCorruptedImage = false;
  29257. }
  29258. JpxImage.prototype = {
  29259. parse: function JpxImage_parse(data) {
  29260. var head = readUint16(data, 0);
  29261. if (head === 0xFF4F) {
  29262. this.parseCodestream(data, 0, data.length);
  29263. return;
  29264. }
  29265. var position = 0, length = data.length;
  29266. while (position < length) {
  29267. var headerSize = 8;
  29268. var lbox = readUint32(data, position);
  29269. var tbox = readUint32(data, position + 4);
  29270. position += headerSize;
  29271. if (lbox === 1) {
  29272. lbox = readUint32(data, position) * 4294967296 + readUint32(data, position + 4);
  29273. position += 8;
  29274. headerSize += 8;
  29275. }
  29276. if (lbox === 0) {
  29277. lbox = length - position + headerSize;
  29278. }
  29279. if (lbox < headerSize) {
  29280. error('JPX Error: Invalid box field size');
  29281. }
  29282. var dataLength = lbox - headerSize;
  29283. var jumpDataLength = true;
  29284. switch (tbox) {
  29285. case 0x6A703268:
  29286. jumpDataLength = false;
  29287. break;
  29288. case 0x636F6C72:
  29289. var method = data[position];
  29290. if (method === 1) {
  29291. var colorspace = readUint32(data, position + 3);
  29292. switch (colorspace) {
  29293. case 16:
  29294. case 17:
  29295. case 18:
  29296. break;
  29297. default:
  29298. warn('Unknown colorspace ' + colorspace);
  29299. break;
  29300. }
  29301. } else if (method === 2) {
  29302. info('ICC profile not supported');
  29303. }
  29304. break;
  29305. case 0x6A703263:
  29306. this.parseCodestream(data, position, position + dataLength);
  29307. break;
  29308. case 0x6A502020:
  29309. if (0x0d0a870a !== readUint32(data, position)) {
  29310. warn('Invalid JP2 signature');
  29311. }
  29312. break;
  29313. case 0x6A501A1A:
  29314. case 0x66747970:
  29315. case 0x72726571:
  29316. case 0x72657320:
  29317. case 0x69686472:
  29318. break;
  29319. default:
  29320. var headerType = String.fromCharCode(tbox >> 24 & 0xFF, tbox >> 16 & 0xFF, tbox >> 8 & 0xFF, tbox & 0xFF);
  29321. warn('Unsupported header type ' + tbox + ' (' + headerType + ')');
  29322. break;
  29323. }
  29324. if (jumpDataLength) {
  29325. position += dataLength;
  29326. }
  29327. }
  29328. },
  29329. parseImageProperties: function JpxImage_parseImageProperties(stream) {
  29330. var newByte = stream.getByte();
  29331. while (newByte >= 0) {
  29332. var oldByte = newByte;
  29333. newByte = stream.getByte();
  29334. var code = oldByte << 8 | newByte;
  29335. if (code === 0xFF51) {
  29336. stream.skip(4);
  29337. var Xsiz = stream.getInt32() >>> 0;
  29338. var Ysiz = stream.getInt32() >>> 0;
  29339. var XOsiz = stream.getInt32() >>> 0;
  29340. var YOsiz = stream.getInt32() >>> 0;
  29341. stream.skip(16);
  29342. var Csiz = stream.getUint16();
  29343. this.width = Xsiz - XOsiz;
  29344. this.height = Ysiz - YOsiz;
  29345. this.componentsCount = Csiz;
  29346. this.bitsPerComponent = 8;
  29347. return;
  29348. }
  29349. }
  29350. error('JPX Error: No size marker found in JPX stream');
  29351. },
  29352. parseCodestream: function JpxImage_parseCodestream(data, start, end) {
  29353. var context = {};
  29354. var doNotRecover = false;
  29355. try {
  29356. var position = start;
  29357. while (position + 1 < end) {
  29358. var code = readUint16(data, position);
  29359. position += 2;
  29360. var length = 0, j, sqcd, spqcds, spqcdSize, scalarExpounded, tile;
  29361. switch (code) {
  29362. case 0xFF4F:
  29363. context.mainHeader = true;
  29364. break;
  29365. case 0xFFD9:
  29366. break;
  29367. case 0xFF51:
  29368. length = readUint16(data, position);
  29369. var siz = {};
  29370. siz.Xsiz = readUint32(data, position + 4);
  29371. siz.Ysiz = readUint32(data, position + 8);
  29372. siz.XOsiz = readUint32(data, position + 12);
  29373. siz.YOsiz = readUint32(data, position + 16);
  29374. siz.XTsiz = readUint32(data, position + 20);
  29375. siz.YTsiz = readUint32(data, position + 24);
  29376. siz.XTOsiz = readUint32(data, position + 28);
  29377. siz.YTOsiz = readUint32(data, position + 32);
  29378. var componentsCount = readUint16(data, position + 36);
  29379. siz.Csiz = componentsCount;
  29380. var components = [];
  29381. j = position + 38;
  29382. for (var i = 0; i < componentsCount; i++) {
  29383. var component = {
  29384. precision: (data[j] & 0x7F) + 1,
  29385. isSigned: !!(data[j] & 0x80),
  29386. XRsiz: data[j + 1],
  29387. YRsiz: data[j + 1]
  29388. };
  29389. calculateComponentDimensions(component, siz);
  29390. components.push(component);
  29391. }
  29392. context.SIZ = siz;
  29393. context.components = components;
  29394. calculateTileGrids(context, components);
  29395. context.QCC = [];
  29396. context.COC = [];
  29397. break;
  29398. case 0xFF5C:
  29399. length = readUint16(data, position);
  29400. var qcd = {};
  29401. j = position + 2;
  29402. sqcd = data[j++];
  29403. switch (sqcd & 0x1F) {
  29404. case 0:
  29405. spqcdSize = 8;
  29406. scalarExpounded = true;
  29407. break;
  29408. case 1:
  29409. spqcdSize = 16;
  29410. scalarExpounded = false;
  29411. break;
  29412. case 2:
  29413. spqcdSize = 16;
  29414. scalarExpounded = true;
  29415. break;
  29416. default:
  29417. throw new Error('Invalid SQcd value ' + sqcd);
  29418. }
  29419. qcd.noQuantization = spqcdSize === 8;
  29420. qcd.scalarExpounded = scalarExpounded;
  29421. qcd.guardBits = sqcd >> 5;
  29422. spqcds = [];
  29423. while (j < length + position) {
  29424. var spqcd = {};
  29425. if (spqcdSize === 8) {
  29426. spqcd.epsilon = data[j++] >> 3;
  29427. spqcd.mu = 0;
  29428. } else {
  29429. spqcd.epsilon = data[j] >> 3;
  29430. spqcd.mu = (data[j] & 0x7) << 8 | data[j + 1];
  29431. j += 2;
  29432. }
  29433. spqcds.push(spqcd);
  29434. }
  29435. qcd.SPqcds = spqcds;
  29436. if (context.mainHeader) {
  29437. context.QCD = qcd;
  29438. } else {
  29439. context.currentTile.QCD = qcd;
  29440. context.currentTile.QCC = [];
  29441. }
  29442. break;
  29443. case 0xFF5D:
  29444. length = readUint16(data, position);
  29445. var qcc = {};
  29446. j = position + 2;
  29447. var cqcc;
  29448. if (context.SIZ.Csiz < 257) {
  29449. cqcc = data[j++];
  29450. } else {
  29451. cqcc = readUint16(data, j);
  29452. j += 2;
  29453. }
  29454. sqcd = data[j++];
  29455. switch (sqcd & 0x1F) {
  29456. case 0:
  29457. spqcdSize = 8;
  29458. scalarExpounded = true;
  29459. break;
  29460. case 1:
  29461. spqcdSize = 16;
  29462. scalarExpounded = false;
  29463. break;
  29464. case 2:
  29465. spqcdSize = 16;
  29466. scalarExpounded = true;
  29467. break;
  29468. default:
  29469. throw new Error('Invalid SQcd value ' + sqcd);
  29470. }
  29471. qcc.noQuantization = spqcdSize === 8;
  29472. qcc.scalarExpounded = scalarExpounded;
  29473. qcc.guardBits = sqcd >> 5;
  29474. spqcds = [];
  29475. while (j < length + position) {
  29476. spqcd = {};
  29477. if (spqcdSize === 8) {
  29478. spqcd.epsilon = data[j++] >> 3;
  29479. spqcd.mu = 0;
  29480. } else {
  29481. spqcd.epsilon = data[j] >> 3;
  29482. spqcd.mu = (data[j] & 0x7) << 8 | data[j + 1];
  29483. j += 2;
  29484. }
  29485. spqcds.push(spqcd);
  29486. }
  29487. qcc.SPqcds = spqcds;
  29488. if (context.mainHeader) {
  29489. context.QCC[cqcc] = qcc;
  29490. } else {
  29491. context.currentTile.QCC[cqcc] = qcc;
  29492. }
  29493. break;
  29494. case 0xFF52:
  29495. length = readUint16(data, position);
  29496. var cod = {};
  29497. j = position + 2;
  29498. var scod = data[j++];
  29499. cod.entropyCoderWithCustomPrecincts = !!(scod & 1);
  29500. cod.sopMarkerUsed = !!(scod & 2);
  29501. cod.ephMarkerUsed = !!(scod & 4);
  29502. cod.progressionOrder = data[j++];
  29503. cod.layersCount = readUint16(data, j);
  29504. j += 2;
  29505. cod.multipleComponentTransform = data[j++];
  29506. cod.decompositionLevelsCount = data[j++];
  29507. cod.xcb = (data[j++] & 0xF) + 2;
  29508. cod.ycb = (data[j++] & 0xF) + 2;
  29509. var blockStyle = data[j++];
  29510. cod.selectiveArithmeticCodingBypass = !!(blockStyle & 1);
  29511. cod.resetContextProbabilities = !!(blockStyle & 2);
  29512. cod.terminationOnEachCodingPass = !!(blockStyle & 4);
  29513. cod.verticalyStripe = !!(blockStyle & 8);
  29514. cod.predictableTermination = !!(blockStyle & 16);
  29515. cod.segmentationSymbolUsed = !!(blockStyle & 32);
  29516. cod.reversibleTransformation = data[j++];
  29517. if (cod.entropyCoderWithCustomPrecincts) {
  29518. var precinctsSizes = [];
  29519. while (j < length + position) {
  29520. var precinctsSize = data[j++];
  29521. precinctsSizes.push({
  29522. PPx: precinctsSize & 0xF,
  29523. PPy: precinctsSize >> 4
  29524. });
  29525. }
  29526. cod.precinctsSizes = precinctsSizes;
  29527. }
  29528. var unsupported = [];
  29529. if (cod.selectiveArithmeticCodingBypass) {
  29530. unsupported.push('selectiveArithmeticCodingBypass');
  29531. }
  29532. if (cod.resetContextProbabilities) {
  29533. unsupported.push('resetContextProbabilities');
  29534. }
  29535. if (cod.terminationOnEachCodingPass) {
  29536. unsupported.push('terminationOnEachCodingPass');
  29537. }
  29538. if (cod.verticalyStripe) {
  29539. unsupported.push('verticalyStripe');
  29540. }
  29541. if (cod.predictableTermination) {
  29542. unsupported.push('predictableTermination');
  29543. }
  29544. if (unsupported.length > 0) {
  29545. doNotRecover = true;
  29546. throw new Error('Unsupported COD options (' + unsupported.join(', ') + ')');
  29547. }
  29548. if (context.mainHeader) {
  29549. context.COD = cod;
  29550. } else {
  29551. context.currentTile.COD = cod;
  29552. context.currentTile.COC = [];
  29553. }
  29554. break;
  29555. case 0xFF90:
  29556. length = readUint16(data, position);
  29557. tile = {};
  29558. tile.index = readUint16(data, position + 2);
  29559. tile.length = readUint32(data, position + 4);
  29560. tile.dataEnd = tile.length + position - 2;
  29561. tile.partIndex = data[position + 8];
  29562. tile.partsCount = data[position + 9];
  29563. context.mainHeader = false;
  29564. if (tile.partIndex === 0) {
  29565. tile.COD = context.COD;
  29566. tile.COC = context.COC.slice(0);
  29567. tile.QCD = context.QCD;
  29568. tile.QCC = context.QCC.slice(0);
  29569. }
  29570. context.currentTile = tile;
  29571. break;
  29572. case 0xFF93:
  29573. tile = context.currentTile;
  29574. if (tile.partIndex === 0) {
  29575. initializeTile(context, tile.index);
  29576. buildPackets(context);
  29577. }
  29578. length = tile.dataEnd - position;
  29579. parseTilePackets(context, data, position, length);
  29580. break;
  29581. case 0xFF55:
  29582. case 0xFF57:
  29583. case 0xFF58:
  29584. case 0xFF64:
  29585. length = readUint16(data, position);
  29586. break;
  29587. case 0xFF53:
  29588. throw new Error('Codestream code 0xFF53 (COC) is ' + 'not implemented');
  29589. default:
  29590. throw new Error('Unknown codestream code: ' + code.toString(16));
  29591. }
  29592. position += length;
  29593. }
  29594. } catch (e) {
  29595. if (doNotRecover || this.failOnCorruptedImage) {
  29596. error('JPX Error: ' + e.message);
  29597. } else {
  29598. warn('JPX: Trying to recover from: ' + e.message);
  29599. }
  29600. }
  29601. this.tiles = transformComponents(context);
  29602. this.width = context.SIZ.Xsiz - context.SIZ.XOsiz;
  29603. this.height = context.SIZ.Ysiz - context.SIZ.YOsiz;
  29604. this.componentsCount = context.SIZ.Csiz;
  29605. }
  29606. };
  29607. function calculateComponentDimensions(component, siz) {
  29608. component.x0 = Math.ceil(siz.XOsiz / component.XRsiz);
  29609. component.x1 = Math.ceil(siz.Xsiz / component.XRsiz);
  29610. component.y0 = Math.ceil(siz.YOsiz / component.YRsiz);
  29611. component.y1 = Math.ceil(siz.Ysiz / component.YRsiz);
  29612. component.width = component.x1 - component.x0;
  29613. component.height = component.y1 - component.y0;
  29614. }
  29615. function calculateTileGrids(context, components) {
  29616. var siz = context.SIZ;
  29617. var tile, tiles = [];
  29618. var numXtiles = Math.ceil((siz.Xsiz - siz.XTOsiz) / siz.XTsiz);
  29619. var numYtiles = Math.ceil((siz.Ysiz - siz.YTOsiz) / siz.YTsiz);
  29620. for (var q = 0; q < numYtiles; q++) {
  29621. for (var p = 0; p < numXtiles; p++) {
  29622. tile = {};
  29623. tile.tx0 = Math.max(siz.XTOsiz + p * siz.XTsiz, siz.XOsiz);
  29624. tile.ty0 = Math.max(siz.YTOsiz + q * siz.YTsiz, siz.YOsiz);
  29625. tile.tx1 = Math.min(siz.XTOsiz + (p + 1) * siz.XTsiz, siz.Xsiz);
  29626. tile.ty1 = Math.min(siz.YTOsiz + (q + 1) * siz.YTsiz, siz.Ysiz);
  29627. tile.width = tile.tx1 - tile.tx0;
  29628. tile.height = tile.ty1 - tile.ty0;
  29629. tile.components = [];
  29630. tiles.push(tile);
  29631. }
  29632. }
  29633. context.tiles = tiles;
  29634. var componentsCount = siz.Csiz;
  29635. for (var i = 0, ii = componentsCount; i < ii; i++) {
  29636. var component = components[i];
  29637. for (var j = 0, jj = tiles.length; j < jj; j++) {
  29638. var tileComponent = {};
  29639. tile = tiles[j];
  29640. tileComponent.tcx0 = Math.ceil(tile.tx0 / component.XRsiz);
  29641. tileComponent.tcy0 = Math.ceil(tile.ty0 / component.YRsiz);
  29642. tileComponent.tcx1 = Math.ceil(tile.tx1 / component.XRsiz);
  29643. tileComponent.tcy1 = Math.ceil(tile.ty1 / component.YRsiz);
  29644. tileComponent.width = tileComponent.tcx1 - tileComponent.tcx0;
  29645. tileComponent.height = tileComponent.tcy1 - tileComponent.tcy0;
  29646. tile.components[i] = tileComponent;
  29647. }
  29648. }
  29649. }
  29650. function getBlocksDimensions(context, component, r) {
  29651. var codOrCoc = component.codingStyleParameters;
  29652. var result = {};
  29653. if (!codOrCoc.entropyCoderWithCustomPrecincts) {
  29654. result.PPx = 15;
  29655. result.PPy = 15;
  29656. } else {
  29657. result.PPx = codOrCoc.precinctsSizes[r].PPx;
  29658. result.PPy = codOrCoc.precinctsSizes[r].PPy;
  29659. }
  29660. result.xcb_ = r > 0 ? Math.min(codOrCoc.xcb, result.PPx - 1) : Math.min(codOrCoc.xcb, result.PPx);
  29661. result.ycb_ = r > 0 ? Math.min(codOrCoc.ycb, result.PPy - 1) : Math.min(codOrCoc.ycb, result.PPy);
  29662. return result;
  29663. }
  29664. function buildPrecincts(context, resolution, dimensions) {
  29665. var precinctWidth = 1 << dimensions.PPx;
  29666. var precinctHeight = 1 << dimensions.PPy;
  29667. var isZeroRes = resolution.resLevel === 0;
  29668. var precinctWidthInSubband = 1 << dimensions.PPx + (isZeroRes ? 0 : -1);
  29669. var precinctHeightInSubband = 1 << dimensions.PPy + (isZeroRes ? 0 : -1);
  29670. var numprecinctswide = resolution.trx1 > resolution.trx0 ? Math.ceil(resolution.trx1 / precinctWidth) - Math.floor(resolution.trx0 / precinctWidth) : 0;
  29671. var numprecinctshigh = resolution.try1 > resolution.try0 ? Math.ceil(resolution.try1 / precinctHeight) - Math.floor(resolution.try0 / precinctHeight) : 0;
  29672. var numprecincts = numprecinctswide * numprecinctshigh;
  29673. resolution.precinctParameters = {
  29674. precinctWidth: precinctWidth,
  29675. precinctHeight: precinctHeight,
  29676. numprecinctswide: numprecinctswide,
  29677. numprecinctshigh: numprecinctshigh,
  29678. numprecincts: numprecincts,
  29679. precinctWidthInSubband: precinctWidthInSubband,
  29680. precinctHeightInSubband: precinctHeightInSubband
  29681. };
  29682. }
  29683. function buildCodeblocks(context, subband, dimensions) {
  29684. var xcb_ = dimensions.xcb_;
  29685. var ycb_ = dimensions.ycb_;
  29686. var codeblockWidth = 1 << xcb_;
  29687. var codeblockHeight = 1 << ycb_;
  29688. var cbx0 = subband.tbx0 >> xcb_;
  29689. var cby0 = subband.tby0 >> ycb_;
  29690. var cbx1 = subband.tbx1 + codeblockWidth - 1 >> xcb_;
  29691. var cby1 = subband.tby1 + codeblockHeight - 1 >> ycb_;
  29692. var precinctParameters = subband.resolution.precinctParameters;
  29693. var codeblocks = [];
  29694. var precincts = [];
  29695. var i, j, codeblock, precinctNumber;
  29696. for (j = cby0; j < cby1; j++) {
  29697. for (i = cbx0; i < cbx1; i++) {
  29698. codeblock = {
  29699. cbx: i,
  29700. cby: j,
  29701. tbx0: codeblockWidth * i,
  29702. tby0: codeblockHeight * j,
  29703. tbx1: codeblockWidth * (i + 1),
  29704. tby1: codeblockHeight * (j + 1)
  29705. };
  29706. codeblock.tbx0_ = Math.max(subband.tbx0, codeblock.tbx0);
  29707. codeblock.tby0_ = Math.max(subband.tby0, codeblock.tby0);
  29708. codeblock.tbx1_ = Math.min(subband.tbx1, codeblock.tbx1);
  29709. codeblock.tby1_ = Math.min(subband.tby1, codeblock.tby1);
  29710. var pi = Math.floor((codeblock.tbx0_ - subband.tbx0) / precinctParameters.precinctWidthInSubband);
  29711. var pj = Math.floor((codeblock.tby0_ - subband.tby0) / precinctParameters.precinctHeightInSubband);
  29712. precinctNumber = pi + pj * precinctParameters.numprecinctswide;
  29713. codeblock.precinctNumber = precinctNumber;
  29714. codeblock.subbandType = subband.type;
  29715. codeblock.Lblock = 3;
  29716. if (codeblock.tbx1_ <= codeblock.tbx0_ || codeblock.tby1_ <= codeblock.tby0_) {
  29717. continue;
  29718. }
  29719. codeblocks.push(codeblock);
  29720. var precinct = precincts[precinctNumber];
  29721. if (precinct !== undefined) {
  29722. if (i < precinct.cbxMin) {
  29723. precinct.cbxMin = i;
  29724. } else if (i > precinct.cbxMax) {
  29725. precinct.cbxMax = i;
  29726. }
  29727. if (j < precinct.cbyMin) {
  29728. precinct.cbxMin = j;
  29729. } else if (j > precinct.cbyMax) {
  29730. precinct.cbyMax = j;
  29731. }
  29732. } else {
  29733. precincts[precinctNumber] = precinct = {
  29734. cbxMin: i,
  29735. cbyMin: j,
  29736. cbxMax: i,
  29737. cbyMax: j
  29738. };
  29739. }
  29740. codeblock.precinct = precinct;
  29741. }
  29742. }
  29743. subband.codeblockParameters = {
  29744. codeblockWidth: xcb_,
  29745. codeblockHeight: ycb_,
  29746. numcodeblockwide: cbx1 - cbx0 + 1,
  29747. numcodeblockhigh: cby1 - cby0 + 1
  29748. };
  29749. subband.codeblocks = codeblocks;
  29750. subband.precincts = precincts;
  29751. }
  29752. function createPacket(resolution, precinctNumber, layerNumber) {
  29753. var precinctCodeblocks = [];
  29754. var subbands = resolution.subbands;
  29755. for (var i = 0, ii = subbands.length; i < ii; i++) {
  29756. var subband = subbands[i];
  29757. var codeblocks = subband.codeblocks;
  29758. for (var j = 0, jj = codeblocks.length; j < jj; j++) {
  29759. var codeblock = codeblocks[j];
  29760. if (codeblock.precinctNumber !== precinctNumber) {
  29761. continue;
  29762. }
  29763. precinctCodeblocks.push(codeblock);
  29764. }
  29765. }
  29766. return {
  29767. layerNumber: layerNumber,
  29768. codeblocks: precinctCodeblocks
  29769. };
  29770. }
  29771. function LayerResolutionComponentPositionIterator(context) {
  29772. var siz = context.SIZ;
  29773. var tileIndex = context.currentTile.index;
  29774. var tile = context.tiles[tileIndex];
  29775. var layersCount = tile.codingStyleDefaultParameters.layersCount;
  29776. var componentsCount = siz.Csiz;
  29777. var maxDecompositionLevelsCount = 0;
  29778. for (var q = 0; q < componentsCount; q++) {
  29779. maxDecompositionLevelsCount = Math.max(maxDecompositionLevelsCount, tile.components[q].codingStyleParameters.decompositionLevelsCount);
  29780. }
  29781. var l = 0, r = 0, i = 0, k = 0;
  29782. this.nextPacket = function JpxImage_nextPacket() {
  29783. for (; l < layersCount; l++) {
  29784. for (; r <= maxDecompositionLevelsCount; r++) {
  29785. for (; i < componentsCount; i++) {
  29786. var component = tile.components[i];
  29787. if (r > component.codingStyleParameters.decompositionLevelsCount) {
  29788. continue;
  29789. }
  29790. var resolution = component.resolutions[r];
  29791. var numprecincts = resolution.precinctParameters.numprecincts;
  29792. for (; k < numprecincts;) {
  29793. var packet = createPacket(resolution, k, l);
  29794. k++;
  29795. return packet;
  29796. }
  29797. k = 0;
  29798. }
  29799. i = 0;
  29800. }
  29801. r = 0;
  29802. }
  29803. error('JPX Error: Out of packets');
  29804. };
  29805. }
  29806. function ResolutionLayerComponentPositionIterator(context) {
  29807. var siz = context.SIZ;
  29808. var tileIndex = context.currentTile.index;
  29809. var tile = context.tiles[tileIndex];
  29810. var layersCount = tile.codingStyleDefaultParameters.layersCount;
  29811. var componentsCount = siz.Csiz;
  29812. var maxDecompositionLevelsCount = 0;
  29813. for (var q = 0; q < componentsCount; q++) {
  29814. maxDecompositionLevelsCount = Math.max(maxDecompositionLevelsCount, tile.components[q].codingStyleParameters.decompositionLevelsCount);
  29815. }
  29816. var r = 0, l = 0, i = 0, k = 0;
  29817. this.nextPacket = function JpxImage_nextPacket() {
  29818. for (; r <= maxDecompositionLevelsCount; r++) {
  29819. for (; l < layersCount; l++) {
  29820. for (; i < componentsCount; i++) {
  29821. var component = tile.components[i];
  29822. if (r > component.codingStyleParameters.decompositionLevelsCount) {
  29823. continue;
  29824. }
  29825. var resolution = component.resolutions[r];
  29826. var numprecincts = resolution.precinctParameters.numprecincts;
  29827. for (; k < numprecincts;) {
  29828. var packet = createPacket(resolution, k, l);
  29829. k++;
  29830. return packet;
  29831. }
  29832. k = 0;
  29833. }
  29834. i = 0;
  29835. }
  29836. l = 0;
  29837. }
  29838. error('JPX Error: Out of packets');
  29839. };
  29840. }
  29841. function ResolutionPositionComponentLayerIterator(context) {
  29842. var siz = context.SIZ;
  29843. var tileIndex = context.currentTile.index;
  29844. var tile = context.tiles[tileIndex];
  29845. var layersCount = tile.codingStyleDefaultParameters.layersCount;
  29846. var componentsCount = siz.Csiz;
  29847. var l, r, c, p;
  29848. var maxDecompositionLevelsCount = 0;
  29849. for (c = 0; c < componentsCount; c++) {
  29850. var component = tile.components[c];
  29851. maxDecompositionLevelsCount = Math.max(maxDecompositionLevelsCount, component.codingStyleParameters.decompositionLevelsCount);
  29852. }
  29853. var maxNumPrecinctsInLevel = new Int32Array(maxDecompositionLevelsCount + 1);
  29854. for (r = 0; r <= maxDecompositionLevelsCount; ++r) {
  29855. var maxNumPrecincts = 0;
  29856. for (c = 0; c < componentsCount; ++c) {
  29857. var resolutions = tile.components[c].resolutions;
  29858. if (r < resolutions.length) {
  29859. maxNumPrecincts = Math.max(maxNumPrecincts, resolutions[r].precinctParameters.numprecincts);
  29860. }
  29861. }
  29862. maxNumPrecinctsInLevel[r] = maxNumPrecincts;
  29863. }
  29864. l = 0;
  29865. r = 0;
  29866. c = 0;
  29867. p = 0;
  29868. this.nextPacket = function JpxImage_nextPacket() {
  29869. for (; r <= maxDecompositionLevelsCount; r++) {
  29870. for (; p < maxNumPrecinctsInLevel[r]; p++) {
  29871. for (; c < componentsCount; c++) {
  29872. var component = tile.components[c];
  29873. if (r > component.codingStyleParameters.decompositionLevelsCount) {
  29874. continue;
  29875. }
  29876. var resolution = component.resolutions[r];
  29877. var numprecincts = resolution.precinctParameters.numprecincts;
  29878. if (p >= numprecincts) {
  29879. continue;
  29880. }
  29881. for (; l < layersCount;) {
  29882. var packet = createPacket(resolution, p, l);
  29883. l++;
  29884. return packet;
  29885. }
  29886. l = 0;
  29887. }
  29888. c = 0;
  29889. }
  29890. p = 0;
  29891. }
  29892. error('JPX Error: Out of packets');
  29893. };
  29894. }
  29895. function PositionComponentResolutionLayerIterator(context) {
  29896. var siz = context.SIZ;
  29897. var tileIndex = context.currentTile.index;
  29898. var tile = context.tiles[tileIndex];
  29899. var layersCount = tile.codingStyleDefaultParameters.layersCount;
  29900. var componentsCount = siz.Csiz;
  29901. var precinctsSizes = getPrecinctSizesInImageScale(tile);
  29902. var precinctsIterationSizes = precinctsSizes;
  29903. var l = 0, r = 0, c = 0, px = 0, py = 0;
  29904. this.nextPacket = function JpxImage_nextPacket() {
  29905. for (; py < precinctsIterationSizes.maxNumHigh; py++) {
  29906. for (; px < precinctsIterationSizes.maxNumWide; px++) {
  29907. for (; c < componentsCount; c++) {
  29908. var component = tile.components[c];
  29909. var decompositionLevelsCount = component.codingStyleParameters.decompositionLevelsCount;
  29910. for (; r <= decompositionLevelsCount; r++) {
  29911. var resolution = component.resolutions[r];
  29912. var sizeInImageScale = precinctsSizes.components[c].resolutions[r];
  29913. var k = getPrecinctIndexIfExist(px, py, sizeInImageScale, precinctsIterationSizes, resolution);
  29914. if (k === null) {
  29915. continue;
  29916. }
  29917. for (; l < layersCount;) {
  29918. var packet = createPacket(resolution, k, l);
  29919. l++;
  29920. return packet;
  29921. }
  29922. l = 0;
  29923. }
  29924. r = 0;
  29925. }
  29926. c = 0;
  29927. }
  29928. px = 0;
  29929. }
  29930. error('JPX Error: Out of packets');
  29931. };
  29932. }
  29933. function ComponentPositionResolutionLayerIterator(context) {
  29934. var siz = context.SIZ;
  29935. var tileIndex = context.currentTile.index;
  29936. var tile = context.tiles[tileIndex];
  29937. var layersCount = tile.codingStyleDefaultParameters.layersCount;
  29938. var componentsCount = siz.Csiz;
  29939. var precinctsSizes = getPrecinctSizesInImageScale(tile);
  29940. var l = 0, r = 0, c = 0, px = 0, py = 0;
  29941. this.nextPacket = function JpxImage_nextPacket() {
  29942. for (; c < componentsCount; ++c) {
  29943. var component = tile.components[c];
  29944. var precinctsIterationSizes = precinctsSizes.components[c];
  29945. var decompositionLevelsCount = component.codingStyleParameters.decompositionLevelsCount;
  29946. for (; py < precinctsIterationSizes.maxNumHigh; py++) {
  29947. for (; px < precinctsIterationSizes.maxNumWide; px++) {
  29948. for (; r <= decompositionLevelsCount; r++) {
  29949. var resolution = component.resolutions[r];
  29950. var sizeInImageScale = precinctsIterationSizes.resolutions[r];
  29951. var k = getPrecinctIndexIfExist(px, py, sizeInImageScale, precinctsIterationSizes, resolution);
  29952. if (k === null) {
  29953. continue;
  29954. }
  29955. for (; l < layersCount;) {
  29956. var packet = createPacket(resolution, k, l);
  29957. l++;
  29958. return packet;
  29959. }
  29960. l = 0;
  29961. }
  29962. r = 0;
  29963. }
  29964. px = 0;
  29965. }
  29966. py = 0;
  29967. }
  29968. error('JPX Error: Out of packets');
  29969. };
  29970. }
  29971. function getPrecinctIndexIfExist(pxIndex, pyIndex, sizeInImageScale, precinctIterationSizes, resolution) {
  29972. var posX = pxIndex * precinctIterationSizes.minWidth;
  29973. var posY = pyIndex * precinctIterationSizes.minHeight;
  29974. if (posX % sizeInImageScale.width !== 0 || posY % sizeInImageScale.height !== 0) {
  29975. return null;
  29976. }
  29977. var startPrecinctRowIndex = posY / sizeInImageScale.width * resolution.precinctParameters.numprecinctswide;
  29978. return posX / sizeInImageScale.height + startPrecinctRowIndex;
  29979. }
  29980. function getPrecinctSizesInImageScale(tile) {
  29981. var componentsCount = tile.components.length;
  29982. var minWidth = Number.MAX_VALUE;
  29983. var minHeight = Number.MAX_VALUE;
  29984. var maxNumWide = 0;
  29985. var maxNumHigh = 0;
  29986. var sizePerComponent = new Array(componentsCount);
  29987. for (var c = 0; c < componentsCount; c++) {
  29988. var component = tile.components[c];
  29989. var decompositionLevelsCount = component.codingStyleParameters.decompositionLevelsCount;
  29990. var sizePerResolution = new Array(decompositionLevelsCount + 1);
  29991. var minWidthCurrentComponent = Number.MAX_VALUE;
  29992. var minHeightCurrentComponent = Number.MAX_VALUE;
  29993. var maxNumWideCurrentComponent = 0;
  29994. var maxNumHighCurrentComponent = 0;
  29995. var scale = 1;
  29996. for (var r = decompositionLevelsCount; r >= 0; --r) {
  29997. var resolution = component.resolutions[r];
  29998. var widthCurrentResolution = scale * resolution.precinctParameters.precinctWidth;
  29999. var heightCurrentResolution = scale * resolution.precinctParameters.precinctHeight;
  30000. minWidthCurrentComponent = Math.min(minWidthCurrentComponent, widthCurrentResolution);
  30001. minHeightCurrentComponent = Math.min(minHeightCurrentComponent, heightCurrentResolution);
  30002. maxNumWideCurrentComponent = Math.max(maxNumWideCurrentComponent, resolution.precinctParameters.numprecinctswide);
  30003. maxNumHighCurrentComponent = Math.max(maxNumHighCurrentComponent, resolution.precinctParameters.numprecinctshigh);
  30004. sizePerResolution[r] = {
  30005. width: widthCurrentResolution,
  30006. height: heightCurrentResolution
  30007. };
  30008. scale <<= 1;
  30009. }
  30010. minWidth = Math.min(minWidth, minWidthCurrentComponent);
  30011. minHeight = Math.min(minHeight, minHeightCurrentComponent);
  30012. maxNumWide = Math.max(maxNumWide, maxNumWideCurrentComponent);
  30013. maxNumHigh = Math.max(maxNumHigh, maxNumHighCurrentComponent);
  30014. sizePerComponent[c] = {
  30015. resolutions: sizePerResolution,
  30016. minWidth: minWidthCurrentComponent,
  30017. minHeight: minHeightCurrentComponent,
  30018. maxNumWide: maxNumWideCurrentComponent,
  30019. maxNumHigh: maxNumHighCurrentComponent
  30020. };
  30021. }
  30022. return {
  30023. components: sizePerComponent,
  30024. minWidth: minWidth,
  30025. minHeight: minHeight,
  30026. maxNumWide: maxNumWide,
  30027. maxNumHigh: maxNumHigh
  30028. };
  30029. }
  30030. function buildPackets(context) {
  30031. var siz = context.SIZ;
  30032. var tileIndex = context.currentTile.index;
  30033. var tile = context.tiles[tileIndex];
  30034. var componentsCount = siz.Csiz;
  30035. for (var c = 0; c < componentsCount; c++) {
  30036. var component = tile.components[c];
  30037. var decompositionLevelsCount = component.codingStyleParameters.decompositionLevelsCount;
  30038. var resolutions = [];
  30039. var subbands = [];
  30040. for (var r = 0; r <= decompositionLevelsCount; r++) {
  30041. var blocksDimensions = getBlocksDimensions(context, component, r);
  30042. var resolution = {};
  30043. var scale = 1 << decompositionLevelsCount - r;
  30044. resolution.trx0 = Math.ceil(component.tcx0 / scale);
  30045. resolution.try0 = Math.ceil(component.tcy0 / scale);
  30046. resolution.trx1 = Math.ceil(component.tcx1 / scale);
  30047. resolution.try1 = Math.ceil(component.tcy1 / scale);
  30048. resolution.resLevel = r;
  30049. buildPrecincts(context, resolution, blocksDimensions);
  30050. resolutions.push(resolution);
  30051. var subband;
  30052. if (r === 0) {
  30053. subband = {};
  30054. subband.type = 'LL';
  30055. subband.tbx0 = Math.ceil(component.tcx0 / scale);
  30056. subband.tby0 = Math.ceil(component.tcy0 / scale);
  30057. subband.tbx1 = Math.ceil(component.tcx1 / scale);
  30058. subband.tby1 = Math.ceil(component.tcy1 / scale);
  30059. subband.resolution = resolution;
  30060. buildCodeblocks(context, subband, blocksDimensions);
  30061. subbands.push(subband);
  30062. resolution.subbands = [subband];
  30063. } else {
  30064. var bscale = 1 << decompositionLevelsCount - r + 1;
  30065. var resolutionSubbands = [];
  30066. subband = {};
  30067. subband.type = 'HL';
  30068. subband.tbx0 = Math.ceil(component.tcx0 / bscale - 0.5);
  30069. subband.tby0 = Math.ceil(component.tcy0 / bscale);
  30070. subband.tbx1 = Math.ceil(component.tcx1 / bscale - 0.5);
  30071. subband.tby1 = Math.ceil(component.tcy1 / bscale);
  30072. subband.resolution = resolution;
  30073. buildCodeblocks(context, subband, blocksDimensions);
  30074. subbands.push(subband);
  30075. resolutionSubbands.push(subband);
  30076. subband = {};
  30077. subband.type = 'LH';
  30078. subband.tbx0 = Math.ceil(component.tcx0 / bscale);
  30079. subband.tby0 = Math.ceil(component.tcy0 / bscale - 0.5);
  30080. subband.tbx1 = Math.ceil(component.tcx1 / bscale);
  30081. subband.tby1 = Math.ceil(component.tcy1 / bscale - 0.5);
  30082. subband.resolution = resolution;
  30083. buildCodeblocks(context, subband, blocksDimensions);
  30084. subbands.push(subband);
  30085. resolutionSubbands.push(subband);
  30086. subband = {};
  30087. subband.type = 'HH';
  30088. subband.tbx0 = Math.ceil(component.tcx0 / bscale - 0.5);
  30089. subband.tby0 = Math.ceil(component.tcy0 / bscale - 0.5);
  30090. subband.tbx1 = Math.ceil(component.tcx1 / bscale - 0.5);
  30091. subband.tby1 = Math.ceil(component.tcy1 / bscale - 0.5);
  30092. subband.resolution = resolution;
  30093. buildCodeblocks(context, subband, blocksDimensions);
  30094. subbands.push(subband);
  30095. resolutionSubbands.push(subband);
  30096. resolution.subbands = resolutionSubbands;
  30097. }
  30098. }
  30099. component.resolutions = resolutions;
  30100. component.subbands = subbands;
  30101. }
  30102. var progressionOrder = tile.codingStyleDefaultParameters.progressionOrder;
  30103. switch (progressionOrder) {
  30104. case 0:
  30105. tile.packetsIterator = new LayerResolutionComponentPositionIterator(context);
  30106. break;
  30107. case 1:
  30108. tile.packetsIterator = new ResolutionLayerComponentPositionIterator(context);
  30109. break;
  30110. case 2:
  30111. tile.packetsIterator = new ResolutionPositionComponentLayerIterator(context);
  30112. break;
  30113. case 3:
  30114. tile.packetsIterator = new PositionComponentResolutionLayerIterator(context);
  30115. break;
  30116. case 4:
  30117. tile.packetsIterator = new ComponentPositionResolutionLayerIterator(context);
  30118. break;
  30119. default:
  30120. error('JPX Error: Unsupported progression order ' + progressionOrder);
  30121. }
  30122. }
  30123. function parseTilePackets(context, data, offset, dataLength) {
  30124. var position = 0;
  30125. var buffer, bufferSize = 0, skipNextBit = false;
  30126. function readBits(count) {
  30127. while (bufferSize < count) {
  30128. var b = data[offset + position];
  30129. position++;
  30130. if (skipNextBit) {
  30131. buffer = buffer << 7 | b;
  30132. bufferSize += 7;
  30133. skipNextBit = false;
  30134. } else {
  30135. buffer = buffer << 8 | b;
  30136. bufferSize += 8;
  30137. }
  30138. if (b === 0xFF) {
  30139. skipNextBit = true;
  30140. }
  30141. }
  30142. bufferSize -= count;
  30143. return buffer >>> bufferSize & (1 << count) - 1;
  30144. }
  30145. function skipMarkerIfEqual(value) {
  30146. if (data[offset + position - 1] === 0xFF && data[offset + position] === value) {
  30147. skipBytes(1);
  30148. return true;
  30149. } else if (data[offset + position] === 0xFF && data[offset + position + 1] === value) {
  30150. skipBytes(2);
  30151. return true;
  30152. }
  30153. return false;
  30154. }
  30155. function skipBytes(count) {
  30156. position += count;
  30157. }
  30158. function alignToByte() {
  30159. bufferSize = 0;
  30160. if (skipNextBit) {
  30161. position++;
  30162. skipNextBit = false;
  30163. }
  30164. }
  30165. function readCodingpasses() {
  30166. if (readBits(1) === 0) {
  30167. return 1;
  30168. }
  30169. if (readBits(1) === 0) {
  30170. return 2;
  30171. }
  30172. var value = readBits(2);
  30173. if (value < 3) {
  30174. return value + 3;
  30175. }
  30176. value = readBits(5);
  30177. if (value < 31) {
  30178. return value + 6;
  30179. }
  30180. value = readBits(7);
  30181. return value + 37;
  30182. }
  30183. var tileIndex = context.currentTile.index;
  30184. var tile = context.tiles[tileIndex];
  30185. var sopMarkerUsed = context.COD.sopMarkerUsed;
  30186. var ephMarkerUsed = context.COD.ephMarkerUsed;
  30187. var packetsIterator = tile.packetsIterator;
  30188. while (position < dataLength) {
  30189. alignToByte();
  30190. if (sopMarkerUsed && skipMarkerIfEqual(0x91)) {
  30191. skipBytes(4);
  30192. }
  30193. var packet = packetsIterator.nextPacket();
  30194. if (!readBits(1)) {
  30195. continue;
  30196. }
  30197. var layerNumber = packet.layerNumber;
  30198. var queue = [], codeblock;
  30199. for (var i = 0, ii = packet.codeblocks.length; i < ii; i++) {
  30200. codeblock = packet.codeblocks[i];
  30201. var precinct = codeblock.precinct;
  30202. var codeblockColumn = codeblock.cbx - precinct.cbxMin;
  30203. var codeblockRow = codeblock.cby - precinct.cbyMin;
  30204. var codeblockIncluded = false;
  30205. var firstTimeInclusion = false;
  30206. var valueReady;
  30207. if (codeblock['included'] !== undefined) {
  30208. codeblockIncluded = !!readBits(1);
  30209. } else {
  30210. precinct = codeblock.precinct;
  30211. var inclusionTree, zeroBitPlanesTree;
  30212. if (precinct['inclusionTree'] !== undefined) {
  30213. inclusionTree = precinct.inclusionTree;
  30214. } else {
  30215. var width = precinct.cbxMax - precinct.cbxMin + 1;
  30216. var height = precinct.cbyMax - precinct.cbyMin + 1;
  30217. inclusionTree = new InclusionTree(width, height, layerNumber);
  30218. zeroBitPlanesTree = new TagTree(width, height);
  30219. precinct.inclusionTree = inclusionTree;
  30220. precinct.zeroBitPlanesTree = zeroBitPlanesTree;
  30221. }
  30222. if (inclusionTree.reset(codeblockColumn, codeblockRow, layerNumber)) {
  30223. while (true) {
  30224. if (readBits(1)) {
  30225. valueReady = !inclusionTree.nextLevel();
  30226. if (valueReady) {
  30227. codeblock.included = true;
  30228. codeblockIncluded = firstTimeInclusion = true;
  30229. break;
  30230. }
  30231. } else {
  30232. inclusionTree.incrementValue(layerNumber);
  30233. break;
  30234. }
  30235. }
  30236. }
  30237. }
  30238. if (!codeblockIncluded) {
  30239. continue;
  30240. }
  30241. if (firstTimeInclusion) {
  30242. zeroBitPlanesTree = precinct.zeroBitPlanesTree;
  30243. zeroBitPlanesTree.reset(codeblockColumn, codeblockRow);
  30244. while (true) {
  30245. if (readBits(1)) {
  30246. valueReady = !zeroBitPlanesTree.nextLevel();
  30247. if (valueReady) {
  30248. break;
  30249. }
  30250. } else {
  30251. zeroBitPlanesTree.incrementValue();
  30252. }
  30253. }
  30254. codeblock.zeroBitPlanes = zeroBitPlanesTree.value;
  30255. }
  30256. var codingpasses = readCodingpasses();
  30257. while (readBits(1)) {
  30258. codeblock.Lblock++;
  30259. }
  30260. var codingpassesLog2 = log2(codingpasses);
  30261. var bits = (codingpasses < 1 << codingpassesLog2 ? codingpassesLog2 - 1 : codingpassesLog2) + codeblock.Lblock;
  30262. var codedDataLength = readBits(bits);
  30263. queue.push({
  30264. codeblock: codeblock,
  30265. codingpasses: codingpasses,
  30266. dataLength: codedDataLength
  30267. });
  30268. }
  30269. alignToByte();
  30270. if (ephMarkerUsed) {
  30271. skipMarkerIfEqual(0x92);
  30272. }
  30273. while (queue.length > 0) {
  30274. var packetItem = queue.shift();
  30275. codeblock = packetItem.codeblock;
  30276. if (codeblock['data'] === undefined) {
  30277. codeblock.data = [];
  30278. }
  30279. codeblock.data.push({
  30280. data: data,
  30281. start: offset + position,
  30282. end: offset + position + packetItem.dataLength,
  30283. codingpasses: packetItem.codingpasses
  30284. });
  30285. position += packetItem.dataLength;
  30286. }
  30287. }
  30288. return position;
  30289. }
  30290. function copyCoefficients(coefficients, levelWidth, levelHeight, subband, delta, mb, reversible, segmentationSymbolUsed) {
  30291. var x0 = subband.tbx0;
  30292. var y0 = subband.tby0;
  30293. var width = subband.tbx1 - subband.tbx0;
  30294. var codeblocks = subband.codeblocks;
  30295. var right = subband.type.charAt(0) === 'H' ? 1 : 0;
  30296. var bottom = subband.type.charAt(1) === 'H' ? levelWidth : 0;
  30297. for (var i = 0, ii = codeblocks.length; i < ii; ++i) {
  30298. var codeblock = codeblocks[i];
  30299. var blockWidth = codeblock.tbx1_ - codeblock.tbx0_;
  30300. var blockHeight = codeblock.tby1_ - codeblock.tby0_;
  30301. if (blockWidth === 0 || blockHeight === 0) {
  30302. continue;
  30303. }
  30304. if (codeblock['data'] === undefined) {
  30305. continue;
  30306. }
  30307. var bitModel, currentCodingpassType;
  30308. bitModel = new BitModel(blockWidth, blockHeight, codeblock.subbandType, codeblock.zeroBitPlanes, mb);
  30309. currentCodingpassType = 2;
  30310. var data = codeblock.data, totalLength = 0, codingpasses = 0;
  30311. var j, jj, dataItem;
  30312. for (j = 0, jj = data.length; j < jj; j++) {
  30313. dataItem = data[j];
  30314. totalLength += dataItem.end - dataItem.start;
  30315. codingpasses += dataItem.codingpasses;
  30316. }
  30317. var encodedData = new Uint8Array(totalLength);
  30318. var position = 0;
  30319. for (j = 0, jj = data.length; j < jj; j++) {
  30320. dataItem = data[j];
  30321. var chunk = dataItem.data.subarray(dataItem.start, dataItem.end);
  30322. encodedData.set(chunk, position);
  30323. position += chunk.length;
  30324. }
  30325. var decoder = new ArithmeticDecoder(encodedData, 0, totalLength);
  30326. bitModel.setDecoder(decoder);
  30327. for (j = 0; j < codingpasses; j++) {
  30328. switch (currentCodingpassType) {
  30329. case 0:
  30330. bitModel.runSignificancePropagationPass();
  30331. break;
  30332. case 1:
  30333. bitModel.runMagnitudeRefinementPass();
  30334. break;
  30335. case 2:
  30336. bitModel.runCleanupPass();
  30337. if (segmentationSymbolUsed) {
  30338. bitModel.checkSegmentationSymbol();
  30339. }
  30340. break;
  30341. }
  30342. currentCodingpassType = (currentCodingpassType + 1) % 3;
  30343. }
  30344. var offset = codeblock.tbx0_ - x0 + (codeblock.tby0_ - y0) * width;
  30345. var sign = bitModel.coefficentsSign;
  30346. var magnitude = bitModel.coefficentsMagnitude;
  30347. var bitsDecoded = bitModel.bitsDecoded;
  30348. var magnitudeCorrection = reversible ? 0 : 0.5;
  30349. var k, n, nb;
  30350. position = 0;
  30351. var interleave = subband.type !== 'LL';
  30352. for (j = 0; j < blockHeight; j++) {
  30353. var row = offset / width | 0;
  30354. var levelOffset = 2 * row * (levelWidth - width) + right + bottom;
  30355. for (k = 0; k < blockWidth; k++) {
  30356. n = magnitude[position];
  30357. if (n !== 0) {
  30358. n = (n + magnitudeCorrection) * delta;
  30359. if (sign[position] !== 0) {
  30360. n = -n;
  30361. }
  30362. nb = bitsDecoded[position];
  30363. var pos = interleave ? levelOffset + (offset << 1) : offset;
  30364. if (reversible && nb >= mb) {
  30365. coefficients[pos] = n;
  30366. } else {
  30367. coefficients[pos] = n * (1 << mb - nb);
  30368. }
  30369. }
  30370. offset++;
  30371. position++;
  30372. }
  30373. offset += width - blockWidth;
  30374. }
  30375. }
  30376. }
  30377. function transformTile(context, tile, c) {
  30378. var component = tile.components[c];
  30379. var codingStyleParameters = component.codingStyleParameters;
  30380. var quantizationParameters = component.quantizationParameters;
  30381. var decompositionLevelsCount = codingStyleParameters.decompositionLevelsCount;
  30382. var spqcds = quantizationParameters.SPqcds;
  30383. var scalarExpounded = quantizationParameters.scalarExpounded;
  30384. var guardBits = quantizationParameters.guardBits;
  30385. var segmentationSymbolUsed = codingStyleParameters.segmentationSymbolUsed;
  30386. var precision = context.components[c].precision;
  30387. var reversible = codingStyleParameters.reversibleTransformation;
  30388. var transform = reversible ? new ReversibleTransform() : new IrreversibleTransform();
  30389. var subbandCoefficients = [];
  30390. var b = 0;
  30391. for (var i = 0; i <= decompositionLevelsCount; i++) {
  30392. var resolution = component.resolutions[i];
  30393. var width = resolution.trx1 - resolution.trx0;
  30394. var height = resolution.try1 - resolution.try0;
  30395. var coefficients = new Float32Array(width * height);
  30396. for (var j = 0, jj = resolution.subbands.length; j < jj; j++) {
  30397. var mu, epsilon;
  30398. if (!scalarExpounded) {
  30399. mu = spqcds[0].mu;
  30400. epsilon = spqcds[0].epsilon + (i > 0 ? 1 - i : 0);
  30401. } else {
  30402. mu = spqcds[b].mu;
  30403. epsilon = spqcds[b].epsilon;
  30404. b++;
  30405. }
  30406. var subband = resolution.subbands[j];
  30407. var gainLog2 = SubbandsGainLog2[subband.type];
  30408. var delta = reversible ? 1 : Math.pow(2, precision + gainLog2 - epsilon) * (1 + mu / 2048);
  30409. var mb = guardBits + epsilon - 1;
  30410. copyCoefficients(coefficients, width, height, subband, delta, mb, reversible, segmentationSymbolUsed);
  30411. }
  30412. subbandCoefficients.push({
  30413. width: width,
  30414. height: height,
  30415. items: coefficients
  30416. });
  30417. }
  30418. var result = transform.calculate(subbandCoefficients, component.tcx0, component.tcy0);
  30419. return {
  30420. left: component.tcx0,
  30421. top: component.tcy0,
  30422. width: result.width,
  30423. height: result.height,
  30424. items: result.items
  30425. };
  30426. }
  30427. function transformComponents(context) {
  30428. var siz = context.SIZ;
  30429. var components = context.components;
  30430. var componentsCount = siz.Csiz;
  30431. var resultImages = [];
  30432. for (var i = 0, ii = context.tiles.length; i < ii; i++) {
  30433. var tile = context.tiles[i];
  30434. var transformedTiles = [];
  30435. var c;
  30436. for (c = 0; c < componentsCount; c++) {
  30437. transformedTiles[c] = transformTile(context, tile, c);
  30438. }
  30439. var tile0 = transformedTiles[0];
  30440. var out = new Uint8Array(tile0.items.length * componentsCount);
  30441. var result = {
  30442. left: tile0.left,
  30443. top: tile0.top,
  30444. width: tile0.width,
  30445. height: tile0.height,
  30446. items: out
  30447. };
  30448. var shift, offset, max, min, maxK;
  30449. var pos = 0, j, jj, y0, y1, y2, r, g, b, k, val;
  30450. if (tile.codingStyleDefaultParameters.multipleComponentTransform) {
  30451. var fourComponents = componentsCount === 4;
  30452. var y0items = transformedTiles[0].items;
  30453. var y1items = transformedTiles[1].items;
  30454. var y2items = transformedTiles[2].items;
  30455. var y3items = fourComponents ? transformedTiles[3].items : null;
  30456. shift = components[0].precision - 8;
  30457. offset = (128 << shift) + 0.5;
  30458. max = 255 * (1 << shift);
  30459. maxK = max * 0.5;
  30460. min = -maxK;
  30461. var component0 = tile.components[0];
  30462. var alpha01 = componentsCount - 3;
  30463. jj = y0items.length;
  30464. if (!component0.codingStyleParameters.reversibleTransformation) {
  30465. for (j = 0; j < jj; j++, pos += alpha01) {
  30466. y0 = y0items[j] + offset;
  30467. y1 = y1items[j];
  30468. y2 = y2items[j];
  30469. r = y0 + 1.402 * y2;
  30470. g = y0 - 0.34413 * y1 - 0.71414 * y2;
  30471. b = y0 + 1.772 * y1;
  30472. out[pos++] = r <= 0 ? 0 : r >= max ? 255 : r >> shift;
  30473. out[pos++] = g <= 0 ? 0 : g >= max ? 255 : g >> shift;
  30474. out[pos++] = b <= 0 ? 0 : b >= max ? 255 : b >> shift;
  30475. }
  30476. } else {
  30477. for (j = 0; j < jj; j++, pos += alpha01) {
  30478. y0 = y0items[j] + offset;
  30479. y1 = y1items[j];
  30480. y2 = y2items[j];
  30481. g = y0 - (y2 + y1 >> 2);
  30482. r = g + y2;
  30483. b = g + y1;
  30484. out[pos++] = r <= 0 ? 0 : r >= max ? 255 : r >> shift;
  30485. out[pos++] = g <= 0 ? 0 : g >= max ? 255 : g >> shift;
  30486. out[pos++] = b <= 0 ? 0 : b >= max ? 255 : b >> shift;
  30487. }
  30488. }
  30489. if (fourComponents) {
  30490. for (j = 0, pos = 3; j < jj; j++, pos += 4) {
  30491. k = y3items[j];
  30492. out[pos] = k <= min ? 0 : k >= maxK ? 255 : k + offset >> shift;
  30493. }
  30494. }
  30495. } else {
  30496. for (c = 0; c < componentsCount; c++) {
  30497. var items = transformedTiles[c].items;
  30498. shift = components[c].precision - 8;
  30499. offset = (128 << shift) + 0.5;
  30500. max = 127.5 * (1 << shift);
  30501. min = -max;
  30502. for (pos = c, j = 0, jj = items.length; j < jj; j++) {
  30503. val = items[j];
  30504. out[pos] = val <= min ? 0 : val >= max ? 255 : val + offset >> shift;
  30505. pos += componentsCount;
  30506. }
  30507. }
  30508. }
  30509. resultImages.push(result);
  30510. }
  30511. return resultImages;
  30512. }
  30513. function initializeTile(context, tileIndex) {
  30514. var siz = context.SIZ;
  30515. var componentsCount = siz.Csiz;
  30516. var tile = context.tiles[tileIndex];
  30517. for (var c = 0; c < componentsCount; c++) {
  30518. var component = tile.components[c];
  30519. var qcdOrQcc = context.currentTile.QCC[c] !== undefined ? context.currentTile.QCC[c] : context.currentTile.QCD;
  30520. component.quantizationParameters = qcdOrQcc;
  30521. var codOrCoc = context.currentTile.COC[c] !== undefined ? context.currentTile.COC[c] : context.currentTile.COD;
  30522. component.codingStyleParameters = codOrCoc;
  30523. }
  30524. tile.codingStyleDefaultParameters = context.currentTile.COD;
  30525. }
  30526. var TagTree = function TagTreeClosure() {
  30527. function TagTree(width, height) {
  30528. var levelsLength = log2(Math.max(width, height)) + 1;
  30529. this.levels = [];
  30530. for (var i = 0; i < levelsLength; i++) {
  30531. var level = {
  30532. width: width,
  30533. height: height,
  30534. items: []
  30535. };
  30536. this.levels.push(level);
  30537. width = Math.ceil(width / 2);
  30538. height = Math.ceil(height / 2);
  30539. }
  30540. }
  30541. TagTree.prototype = {
  30542. reset: function TagTree_reset(i, j) {
  30543. var currentLevel = 0, value = 0, level;
  30544. while (currentLevel < this.levels.length) {
  30545. level = this.levels[currentLevel];
  30546. var index = i + j * level.width;
  30547. if (level.items[index] !== undefined) {
  30548. value = level.items[index];
  30549. break;
  30550. }
  30551. level.index = index;
  30552. i >>= 1;
  30553. j >>= 1;
  30554. currentLevel++;
  30555. }
  30556. currentLevel--;
  30557. level = this.levels[currentLevel];
  30558. level.items[level.index] = value;
  30559. this.currentLevel = currentLevel;
  30560. delete this.value;
  30561. },
  30562. incrementValue: function TagTree_incrementValue() {
  30563. var level = this.levels[this.currentLevel];
  30564. level.items[level.index]++;
  30565. },
  30566. nextLevel: function TagTree_nextLevel() {
  30567. var currentLevel = this.currentLevel;
  30568. var level = this.levels[currentLevel];
  30569. var value = level.items[level.index];
  30570. currentLevel--;
  30571. if (currentLevel < 0) {
  30572. this.value = value;
  30573. return false;
  30574. }
  30575. this.currentLevel = currentLevel;
  30576. level = this.levels[currentLevel];
  30577. level.items[level.index] = value;
  30578. return true;
  30579. }
  30580. };
  30581. return TagTree;
  30582. }();
  30583. var InclusionTree = function InclusionTreeClosure() {
  30584. function InclusionTree(width, height, defaultValue) {
  30585. var levelsLength = log2(Math.max(width, height)) + 1;
  30586. this.levels = [];
  30587. for (var i = 0; i < levelsLength; i++) {
  30588. var items = new Uint8Array(width * height);
  30589. for (var j = 0, jj = items.length; j < jj; j++) {
  30590. items[j] = defaultValue;
  30591. }
  30592. var level = {
  30593. width: width,
  30594. height: height,
  30595. items: items
  30596. };
  30597. this.levels.push(level);
  30598. width = Math.ceil(width / 2);
  30599. height = Math.ceil(height / 2);
  30600. }
  30601. }
  30602. InclusionTree.prototype = {
  30603. reset: function InclusionTree_reset(i, j, stopValue) {
  30604. var currentLevel = 0;
  30605. while (currentLevel < this.levels.length) {
  30606. var level = this.levels[currentLevel];
  30607. var index = i + j * level.width;
  30608. level.index = index;
  30609. var value = level.items[index];
  30610. if (value === 0xFF) {
  30611. break;
  30612. }
  30613. if (value > stopValue) {
  30614. this.currentLevel = currentLevel;
  30615. this.propagateValues();
  30616. return false;
  30617. }
  30618. i >>= 1;
  30619. j >>= 1;
  30620. currentLevel++;
  30621. }
  30622. this.currentLevel = currentLevel - 1;
  30623. return true;
  30624. },
  30625. incrementValue: function InclusionTree_incrementValue(stopValue) {
  30626. var level = this.levels[this.currentLevel];
  30627. level.items[level.index] = stopValue + 1;
  30628. this.propagateValues();
  30629. },
  30630. propagateValues: function InclusionTree_propagateValues() {
  30631. var levelIndex = this.currentLevel;
  30632. var level = this.levels[levelIndex];
  30633. var currentValue = level.items[level.index];
  30634. while (--levelIndex >= 0) {
  30635. level = this.levels[levelIndex];
  30636. level.items[level.index] = currentValue;
  30637. }
  30638. },
  30639. nextLevel: function InclusionTree_nextLevel() {
  30640. var currentLevel = this.currentLevel;
  30641. var level = this.levels[currentLevel];
  30642. var value = level.items[level.index];
  30643. level.items[level.index] = 0xFF;
  30644. currentLevel--;
  30645. if (currentLevel < 0) {
  30646. return false;
  30647. }
  30648. this.currentLevel = currentLevel;
  30649. level = this.levels[currentLevel];
  30650. level.items[level.index] = value;
  30651. return true;
  30652. }
  30653. };
  30654. return InclusionTree;
  30655. }();
  30656. var BitModel = function BitModelClosure() {
  30657. var UNIFORM_CONTEXT = 17;
  30658. var RUNLENGTH_CONTEXT = 18;
  30659. var LLAndLHContextsLabel = new Uint8Array([
  30660. 0,
  30661. 5,
  30662. 8,
  30663. 0,
  30664. 3,
  30665. 7,
  30666. 8,
  30667. 0,
  30668. 4,
  30669. 7,
  30670. 8,
  30671. 0,
  30672. 0,
  30673. 0,
  30674. 0,
  30675. 0,
  30676. 1,
  30677. 6,
  30678. 8,
  30679. 0,
  30680. 3,
  30681. 7,
  30682. 8,
  30683. 0,
  30684. 4,
  30685. 7,
  30686. 8,
  30687. 0,
  30688. 0,
  30689. 0,
  30690. 0,
  30691. 0,
  30692. 2,
  30693. 6,
  30694. 8,
  30695. 0,
  30696. 3,
  30697. 7,
  30698. 8,
  30699. 0,
  30700. 4,
  30701. 7,
  30702. 8,
  30703. 0,
  30704. 0,
  30705. 0,
  30706. 0,
  30707. 0,
  30708. 2,
  30709. 6,
  30710. 8,
  30711. 0,
  30712. 3,
  30713. 7,
  30714. 8,
  30715. 0,
  30716. 4,
  30717. 7,
  30718. 8,
  30719. 0,
  30720. 0,
  30721. 0,
  30722. 0,
  30723. 0,
  30724. 2,
  30725. 6,
  30726. 8,
  30727. 0,
  30728. 3,
  30729. 7,
  30730. 8,
  30731. 0,
  30732. 4,
  30733. 7,
  30734. 8
  30735. ]);
  30736. var HLContextLabel = new Uint8Array([
  30737. 0,
  30738. 3,
  30739. 4,
  30740. 0,
  30741. 5,
  30742. 7,
  30743. 7,
  30744. 0,
  30745. 8,
  30746. 8,
  30747. 8,
  30748. 0,
  30749. 0,
  30750. 0,
  30751. 0,
  30752. 0,
  30753. 1,
  30754. 3,
  30755. 4,
  30756. 0,
  30757. 6,
  30758. 7,
  30759. 7,
  30760. 0,
  30761. 8,
  30762. 8,
  30763. 8,
  30764. 0,
  30765. 0,
  30766. 0,
  30767. 0,
  30768. 0,
  30769. 2,
  30770. 3,
  30771. 4,
  30772. 0,
  30773. 6,
  30774. 7,
  30775. 7,
  30776. 0,
  30777. 8,
  30778. 8,
  30779. 8,
  30780. 0,
  30781. 0,
  30782. 0,
  30783. 0,
  30784. 0,
  30785. 2,
  30786. 3,
  30787. 4,
  30788. 0,
  30789. 6,
  30790. 7,
  30791. 7,
  30792. 0,
  30793. 8,
  30794. 8,
  30795. 8,
  30796. 0,
  30797. 0,
  30798. 0,
  30799. 0,
  30800. 0,
  30801. 2,
  30802. 3,
  30803. 4,
  30804. 0,
  30805. 6,
  30806. 7,
  30807. 7,
  30808. 0,
  30809. 8,
  30810. 8,
  30811. 8
  30812. ]);
  30813. var HHContextLabel = new Uint8Array([
  30814. 0,
  30815. 1,
  30816. 2,
  30817. 0,
  30818. 1,
  30819. 2,
  30820. 2,
  30821. 0,
  30822. 2,
  30823. 2,
  30824. 2,
  30825. 0,
  30826. 0,
  30827. 0,
  30828. 0,
  30829. 0,
  30830. 3,
  30831. 4,
  30832. 5,
  30833. 0,
  30834. 4,
  30835. 5,
  30836. 5,
  30837. 0,
  30838. 5,
  30839. 5,
  30840. 5,
  30841. 0,
  30842. 0,
  30843. 0,
  30844. 0,
  30845. 0,
  30846. 6,
  30847. 7,
  30848. 7,
  30849. 0,
  30850. 7,
  30851. 7,
  30852. 7,
  30853. 0,
  30854. 7,
  30855. 7,
  30856. 7,
  30857. 0,
  30858. 0,
  30859. 0,
  30860. 0,
  30861. 0,
  30862. 8,
  30863. 8,
  30864. 8,
  30865. 0,
  30866. 8,
  30867. 8,
  30868. 8,
  30869. 0,
  30870. 8,
  30871. 8,
  30872. 8,
  30873. 0,
  30874. 0,
  30875. 0,
  30876. 0,
  30877. 0,
  30878. 8,
  30879. 8,
  30880. 8,
  30881. 0,
  30882. 8,
  30883. 8,
  30884. 8,
  30885. 0,
  30886. 8,
  30887. 8,
  30888. 8
  30889. ]);
  30890. function BitModel(width, height, subband, zeroBitPlanes, mb) {
  30891. this.width = width;
  30892. this.height = height;
  30893. this.contextLabelTable = subband === 'HH' ? HHContextLabel : subband === 'HL' ? HLContextLabel : LLAndLHContextsLabel;
  30894. var coefficientCount = width * height;
  30895. this.neighborsSignificance = new Uint8Array(coefficientCount);
  30896. this.coefficentsSign = new Uint8Array(coefficientCount);
  30897. this.coefficentsMagnitude = mb > 14 ? new Uint32Array(coefficientCount) : mb > 6 ? new Uint16Array(coefficientCount) : new Uint8Array(coefficientCount);
  30898. this.processingFlags = new Uint8Array(coefficientCount);
  30899. var bitsDecoded = new Uint8Array(coefficientCount);
  30900. if (zeroBitPlanes !== 0) {
  30901. for (var i = 0; i < coefficientCount; i++) {
  30902. bitsDecoded[i] = zeroBitPlanes;
  30903. }
  30904. }
  30905. this.bitsDecoded = bitsDecoded;
  30906. this.reset();
  30907. }
  30908. BitModel.prototype = {
  30909. setDecoder: function BitModel_setDecoder(decoder) {
  30910. this.decoder = decoder;
  30911. },
  30912. reset: function BitModel_reset() {
  30913. this.contexts = new Int8Array(19);
  30914. this.contexts[0] = 4 << 1 | 0;
  30915. this.contexts[UNIFORM_CONTEXT] = 46 << 1 | 0;
  30916. this.contexts[RUNLENGTH_CONTEXT] = 3 << 1 | 0;
  30917. },
  30918. setNeighborsSignificance: function BitModel_setNeighborsSignificance(row, column, index) {
  30919. var neighborsSignificance = this.neighborsSignificance;
  30920. var width = this.width, height = this.height;
  30921. var left = column > 0;
  30922. var right = column + 1 < width;
  30923. var i;
  30924. if (row > 0) {
  30925. i = index - width;
  30926. if (left) {
  30927. neighborsSignificance[i - 1] += 0x10;
  30928. }
  30929. if (right) {
  30930. neighborsSignificance[i + 1] += 0x10;
  30931. }
  30932. neighborsSignificance[i] += 0x04;
  30933. }
  30934. if (row + 1 < height) {
  30935. i = index + width;
  30936. if (left) {
  30937. neighborsSignificance[i - 1] += 0x10;
  30938. }
  30939. if (right) {
  30940. neighborsSignificance[i + 1] += 0x10;
  30941. }
  30942. neighborsSignificance[i] += 0x04;
  30943. }
  30944. if (left) {
  30945. neighborsSignificance[index - 1] += 0x01;
  30946. }
  30947. if (right) {
  30948. neighborsSignificance[index + 1] += 0x01;
  30949. }
  30950. neighborsSignificance[index] |= 0x80;
  30951. },
  30952. runSignificancePropagationPass: function BitModel_runSignificancePropagationPass() {
  30953. var decoder = this.decoder;
  30954. var width = this.width, height = this.height;
  30955. var coefficentsMagnitude = this.coefficentsMagnitude;
  30956. var coefficentsSign = this.coefficentsSign;
  30957. var neighborsSignificance = this.neighborsSignificance;
  30958. var processingFlags = this.processingFlags;
  30959. var contexts = this.contexts;
  30960. var labels = this.contextLabelTable;
  30961. var bitsDecoded = this.bitsDecoded;
  30962. var processedInverseMask = ~1;
  30963. var processedMask = 1;
  30964. var firstMagnitudeBitMask = 2;
  30965. for (var i0 = 0; i0 < height; i0 += 4) {
  30966. for (var j = 0; j < width; j++) {
  30967. var index = i0 * width + j;
  30968. for (var i1 = 0; i1 < 4; i1++, index += width) {
  30969. var i = i0 + i1;
  30970. if (i >= height) {
  30971. break;
  30972. }
  30973. processingFlags[index] &= processedInverseMask;
  30974. if (coefficentsMagnitude[index] || !neighborsSignificance[index]) {
  30975. continue;
  30976. }
  30977. var contextLabel = labels[neighborsSignificance[index]];
  30978. var decision = decoder.readBit(contexts, contextLabel);
  30979. if (decision) {
  30980. var sign = this.decodeSignBit(i, j, index);
  30981. coefficentsSign[index] = sign;
  30982. coefficentsMagnitude[index] = 1;
  30983. this.setNeighborsSignificance(i, j, index);
  30984. processingFlags[index] |= firstMagnitudeBitMask;
  30985. }
  30986. bitsDecoded[index]++;
  30987. processingFlags[index] |= processedMask;
  30988. }
  30989. }
  30990. }
  30991. },
  30992. decodeSignBit: function BitModel_decodeSignBit(row, column, index) {
  30993. var width = this.width, height = this.height;
  30994. var coefficentsMagnitude = this.coefficentsMagnitude;
  30995. var coefficentsSign = this.coefficentsSign;
  30996. var contribution, sign0, sign1, significance1;
  30997. var contextLabel, decoded;
  30998. significance1 = column > 0 && coefficentsMagnitude[index - 1] !== 0;
  30999. if (column + 1 < width && coefficentsMagnitude[index + 1] !== 0) {
  31000. sign1 = coefficentsSign[index + 1];
  31001. if (significance1) {
  31002. sign0 = coefficentsSign[index - 1];
  31003. contribution = 1 - sign1 - sign0;
  31004. } else {
  31005. contribution = 1 - sign1 - sign1;
  31006. }
  31007. } else if (significance1) {
  31008. sign0 = coefficentsSign[index - 1];
  31009. contribution = 1 - sign0 - sign0;
  31010. } else {
  31011. contribution = 0;
  31012. }
  31013. var horizontalContribution = 3 * contribution;
  31014. significance1 = row > 0 && coefficentsMagnitude[index - width] !== 0;
  31015. if (row + 1 < height && coefficentsMagnitude[index + width] !== 0) {
  31016. sign1 = coefficentsSign[index + width];
  31017. if (significance1) {
  31018. sign0 = coefficentsSign[index - width];
  31019. contribution = 1 - sign1 - sign0 + horizontalContribution;
  31020. } else {
  31021. contribution = 1 - sign1 - sign1 + horizontalContribution;
  31022. }
  31023. } else if (significance1) {
  31024. sign0 = coefficentsSign[index - width];
  31025. contribution = 1 - sign0 - sign0 + horizontalContribution;
  31026. } else {
  31027. contribution = horizontalContribution;
  31028. }
  31029. if (contribution >= 0) {
  31030. contextLabel = 9 + contribution;
  31031. decoded = this.decoder.readBit(this.contexts, contextLabel);
  31032. } else {
  31033. contextLabel = 9 - contribution;
  31034. decoded = this.decoder.readBit(this.contexts, contextLabel) ^ 1;
  31035. }
  31036. return decoded;
  31037. },
  31038. runMagnitudeRefinementPass: function BitModel_runMagnitudeRefinementPass() {
  31039. var decoder = this.decoder;
  31040. var width = this.width, height = this.height;
  31041. var coefficentsMagnitude = this.coefficentsMagnitude;
  31042. var neighborsSignificance = this.neighborsSignificance;
  31043. var contexts = this.contexts;
  31044. var bitsDecoded = this.bitsDecoded;
  31045. var processingFlags = this.processingFlags;
  31046. var processedMask = 1;
  31047. var firstMagnitudeBitMask = 2;
  31048. var length = width * height;
  31049. var width4 = width * 4;
  31050. for (var index0 = 0, indexNext; index0 < length; index0 = indexNext) {
  31051. indexNext = Math.min(length, index0 + width4);
  31052. for (var j = 0; j < width; j++) {
  31053. for (var index = index0 + j; index < indexNext; index += width) {
  31054. if (!coefficentsMagnitude[index] || (processingFlags[index] & processedMask) !== 0) {
  31055. continue;
  31056. }
  31057. var contextLabel = 16;
  31058. if ((processingFlags[index] & firstMagnitudeBitMask) !== 0) {
  31059. processingFlags[index] ^= firstMagnitudeBitMask;
  31060. var significance = neighborsSignificance[index] & 127;
  31061. contextLabel = significance === 0 ? 15 : 14;
  31062. }
  31063. var bit = decoder.readBit(contexts, contextLabel);
  31064. coefficentsMagnitude[index] = coefficentsMagnitude[index] << 1 | bit;
  31065. bitsDecoded[index]++;
  31066. processingFlags[index] |= processedMask;
  31067. }
  31068. }
  31069. }
  31070. },
  31071. runCleanupPass: function BitModel_runCleanupPass() {
  31072. var decoder = this.decoder;
  31073. var width = this.width, height = this.height;
  31074. var neighborsSignificance = this.neighborsSignificance;
  31075. var coefficentsMagnitude = this.coefficentsMagnitude;
  31076. var coefficentsSign = this.coefficentsSign;
  31077. var contexts = this.contexts;
  31078. var labels = this.contextLabelTable;
  31079. var bitsDecoded = this.bitsDecoded;
  31080. var processingFlags = this.processingFlags;
  31081. var processedMask = 1;
  31082. var firstMagnitudeBitMask = 2;
  31083. var oneRowDown = width;
  31084. var twoRowsDown = width * 2;
  31085. var threeRowsDown = width * 3;
  31086. var iNext;
  31087. for (var i0 = 0; i0 < height; i0 = iNext) {
  31088. iNext = Math.min(i0 + 4, height);
  31089. var indexBase = i0 * width;
  31090. var checkAllEmpty = i0 + 3 < height;
  31091. for (var j = 0; j < width; j++) {
  31092. var index0 = indexBase + j;
  31093. 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;
  31094. var i1 = 0, index = index0;
  31095. var i = i0, sign;
  31096. if (allEmpty) {
  31097. var hasSignificantCoefficent = decoder.readBit(contexts, RUNLENGTH_CONTEXT);
  31098. if (!hasSignificantCoefficent) {
  31099. bitsDecoded[index0]++;
  31100. bitsDecoded[index0 + oneRowDown]++;
  31101. bitsDecoded[index0 + twoRowsDown]++;
  31102. bitsDecoded[index0 + threeRowsDown]++;
  31103. continue;
  31104. }
  31105. i1 = decoder.readBit(contexts, UNIFORM_CONTEXT) << 1 | decoder.readBit(contexts, UNIFORM_CONTEXT);
  31106. if (i1 !== 0) {
  31107. i = i0 + i1;
  31108. index += i1 * width;
  31109. }
  31110. sign = this.decodeSignBit(i, j, index);
  31111. coefficentsSign[index] = sign;
  31112. coefficentsMagnitude[index] = 1;
  31113. this.setNeighborsSignificance(i, j, index);
  31114. processingFlags[index] |= firstMagnitudeBitMask;
  31115. index = index0;
  31116. for (var i2 = i0; i2 <= i; i2++, index += width) {
  31117. bitsDecoded[index]++;
  31118. }
  31119. i1++;
  31120. }
  31121. for (i = i0 + i1; i < iNext; i++, index += width) {
  31122. if (coefficentsMagnitude[index] || (processingFlags[index] & processedMask) !== 0) {
  31123. continue;
  31124. }
  31125. var contextLabel = labels[neighborsSignificance[index]];
  31126. var decision = decoder.readBit(contexts, contextLabel);
  31127. if (decision === 1) {
  31128. sign = this.decodeSignBit(i, j, index);
  31129. coefficentsSign[index] = sign;
  31130. coefficentsMagnitude[index] = 1;
  31131. this.setNeighborsSignificance(i, j, index);
  31132. processingFlags[index] |= firstMagnitudeBitMask;
  31133. }
  31134. bitsDecoded[index]++;
  31135. }
  31136. }
  31137. }
  31138. },
  31139. checkSegmentationSymbol: function BitModel_checkSegmentationSymbol() {
  31140. var decoder = this.decoder;
  31141. var contexts = this.contexts;
  31142. 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);
  31143. if (symbol !== 0xA) {
  31144. error('JPX Error: Invalid segmentation symbol');
  31145. }
  31146. }
  31147. };
  31148. return BitModel;
  31149. }();
  31150. var Transform = function TransformClosure() {
  31151. function Transform() {
  31152. }
  31153. Transform.prototype.calculate = function transformCalculate(subbands, u0, v0) {
  31154. var ll = subbands[0];
  31155. for (var i = 1, ii = subbands.length; i < ii; i++) {
  31156. ll = this.iterate(ll, subbands[i], u0, v0);
  31157. }
  31158. return ll;
  31159. };
  31160. Transform.prototype.extend = function extend(buffer, offset, size) {
  31161. var i1 = offset - 1, j1 = offset + 1;
  31162. var i2 = offset + size - 2, j2 = offset + size;
  31163. buffer[i1--] = buffer[j1++];
  31164. buffer[j2++] = buffer[i2--];
  31165. buffer[i1--] = buffer[j1++];
  31166. buffer[j2++] = buffer[i2--];
  31167. buffer[i1--] = buffer[j1++];
  31168. buffer[j2++] = buffer[i2--];
  31169. buffer[i1] = buffer[j1];
  31170. buffer[j2] = buffer[i2];
  31171. };
  31172. Transform.prototype.iterate = function Transform_iterate(ll, hl_lh_hh, u0, v0) {
  31173. var llWidth = ll.width, llHeight = ll.height, llItems = ll.items;
  31174. var width = hl_lh_hh.width;
  31175. var height = hl_lh_hh.height;
  31176. var items = hl_lh_hh.items;
  31177. var i, j, k, l, u, v;
  31178. for (k = 0, i = 0; i < llHeight; i++) {
  31179. l = i * 2 * width;
  31180. for (j = 0; j < llWidth; j++, k++, l += 2) {
  31181. items[l] = llItems[k];
  31182. }
  31183. }
  31184. llItems = ll.items = null;
  31185. var bufferPadding = 4;
  31186. var rowBuffer = new Float32Array(width + 2 * bufferPadding);
  31187. if (width === 1) {
  31188. if ((u0 & 1) !== 0) {
  31189. for (v = 0, k = 0; v < height; v++, k += width) {
  31190. items[k] *= 0.5;
  31191. }
  31192. }
  31193. } else {
  31194. for (v = 0, k = 0; v < height; v++, k += width) {
  31195. rowBuffer.set(items.subarray(k, k + width), bufferPadding);
  31196. this.extend(rowBuffer, bufferPadding, width);
  31197. this.filter(rowBuffer, bufferPadding, width);
  31198. items.set(rowBuffer.subarray(bufferPadding, bufferPadding + width), k);
  31199. }
  31200. }
  31201. var numBuffers = 16;
  31202. var colBuffers = [];
  31203. for (i = 0; i < numBuffers; i++) {
  31204. colBuffers.push(new Float32Array(height + 2 * bufferPadding));
  31205. }
  31206. var b, currentBuffer = 0;
  31207. ll = bufferPadding + height;
  31208. if (height === 1) {
  31209. if ((v0 & 1) !== 0) {
  31210. for (u = 0; u < width; u++) {
  31211. items[u] *= 0.5;
  31212. }
  31213. }
  31214. } else {
  31215. for (u = 0; u < width; u++) {
  31216. if (currentBuffer === 0) {
  31217. numBuffers = Math.min(width - u, numBuffers);
  31218. for (k = u, l = bufferPadding; l < ll; k += width, l++) {
  31219. for (b = 0; b < numBuffers; b++) {
  31220. colBuffers[b][l] = items[k + b];
  31221. }
  31222. }
  31223. currentBuffer = numBuffers;
  31224. }
  31225. currentBuffer--;
  31226. var buffer = colBuffers[currentBuffer];
  31227. this.extend(buffer, bufferPadding, height);
  31228. this.filter(buffer, bufferPadding, height);
  31229. if (currentBuffer === 0) {
  31230. k = u - numBuffers + 1;
  31231. for (l = bufferPadding; l < ll; k += width, l++) {
  31232. for (b = 0; b < numBuffers; b++) {
  31233. items[k + b] = colBuffers[b][l];
  31234. }
  31235. }
  31236. }
  31237. }
  31238. }
  31239. return {
  31240. width: width,
  31241. height: height,
  31242. items: items
  31243. };
  31244. };
  31245. return Transform;
  31246. }();
  31247. var IrreversibleTransform = function IrreversibleTransformClosure() {
  31248. function IrreversibleTransform() {
  31249. Transform.call(this);
  31250. }
  31251. IrreversibleTransform.prototype = Object.create(Transform.prototype);
  31252. IrreversibleTransform.prototype.filter = function irreversibleTransformFilter(x, offset, length) {
  31253. var len = length >> 1;
  31254. offset = offset | 0;
  31255. var j, n, current, next;
  31256. var alpha = -1.586134342059924;
  31257. var beta = -0.052980118572961;
  31258. var gamma = 0.882911075530934;
  31259. var delta = 0.443506852043971;
  31260. var K = 1.230174104914001;
  31261. var K_ = 1 / K;
  31262. j = offset - 3;
  31263. for (n = len + 4; n--; j += 2) {
  31264. x[j] *= K_;
  31265. }
  31266. j = offset - 2;
  31267. current = delta * x[j - 1];
  31268. for (n = len + 3; n--; j += 2) {
  31269. next = delta * x[j + 1];
  31270. x[j] = K * x[j] - current - next;
  31271. if (n--) {
  31272. j += 2;
  31273. current = delta * x[j + 1];
  31274. x[j] = K * x[j] - current - next;
  31275. } else {
  31276. break;
  31277. }
  31278. }
  31279. j = offset - 1;
  31280. current = gamma * x[j - 1];
  31281. for (n = len + 2; n--; j += 2) {
  31282. next = gamma * x[j + 1];
  31283. x[j] -= current + next;
  31284. if (n--) {
  31285. j += 2;
  31286. current = gamma * x[j + 1];
  31287. x[j] -= current + next;
  31288. } else {
  31289. break;
  31290. }
  31291. }
  31292. j = offset;
  31293. current = beta * x[j - 1];
  31294. for (n = len + 1; n--; j += 2) {
  31295. next = beta * x[j + 1];
  31296. x[j] -= current + next;
  31297. if (n--) {
  31298. j += 2;
  31299. current = beta * x[j + 1];
  31300. x[j] -= current + next;
  31301. } else {
  31302. break;
  31303. }
  31304. }
  31305. if (len !== 0) {
  31306. j = offset + 1;
  31307. current = alpha * x[j - 1];
  31308. for (n = len; n--; j += 2) {
  31309. next = alpha * x[j + 1];
  31310. x[j] -= current + next;
  31311. if (n--) {
  31312. j += 2;
  31313. current = alpha * x[j + 1];
  31314. x[j] -= current + next;
  31315. } else {
  31316. break;
  31317. }
  31318. }
  31319. }
  31320. };
  31321. return IrreversibleTransform;
  31322. }();
  31323. var ReversibleTransform = function ReversibleTransformClosure() {
  31324. function ReversibleTransform() {
  31325. Transform.call(this);
  31326. }
  31327. ReversibleTransform.prototype = Object.create(Transform.prototype);
  31328. ReversibleTransform.prototype.filter = function reversibleTransformFilter(x, offset, length) {
  31329. var len = length >> 1;
  31330. offset = offset | 0;
  31331. var j, n;
  31332. for (j = offset, n = len + 1; n--; j += 2) {
  31333. x[j] -= x[j - 1] + x[j + 1] + 2 >> 2;
  31334. }
  31335. for (j = offset + 1, n = len; n--; j += 2) {
  31336. x[j] += x[j - 1] + x[j + 1] >> 1;
  31337. }
  31338. };
  31339. return ReversibleTransform;
  31340. }();
  31341. return JpxImage;
  31342. }();
  31343. exports.JpxImage = JpxImage;
  31344. /***/ }),
  31345. /* 15 */
  31346. /***/ (function(module, exports, __w_pdfjs_require__) {
  31347. "use strict";
  31348. var sharedUtil = __w_pdfjs_require__(0);
  31349. var corePrimitives = __w_pdfjs_require__(1);
  31350. var coreCrypto = __w_pdfjs_require__(12);
  31351. var coreParser = __w_pdfjs_require__(5);
  31352. var coreChunkedStream = __w_pdfjs_require__(11);
  31353. var coreColorSpace = __w_pdfjs_require__(3);
  31354. var InvalidPDFException = sharedUtil.InvalidPDFException;
  31355. var MissingDataException = sharedUtil.MissingDataException;
  31356. var XRefParseException = sharedUtil.XRefParseException;
  31357. var assert = sharedUtil.assert;
  31358. var bytesToString = sharedUtil.bytesToString;
  31359. var createPromiseCapability = sharedUtil.createPromiseCapability;
  31360. var error = sharedUtil.error;
  31361. var info = sharedUtil.info;
  31362. var isArray = sharedUtil.isArray;
  31363. var isBool = sharedUtil.isBool;
  31364. var isInt = sharedUtil.isInt;
  31365. var isString = sharedUtil.isString;
  31366. var shadow = sharedUtil.shadow;
  31367. var stringToPDFString = sharedUtil.stringToPDFString;
  31368. var stringToUTF8String = sharedUtil.stringToUTF8String;
  31369. var warn = sharedUtil.warn;
  31370. var createValidAbsoluteUrl = sharedUtil.createValidAbsoluteUrl;
  31371. var Util = sharedUtil.Util;
  31372. var Ref = corePrimitives.Ref;
  31373. var RefSet = corePrimitives.RefSet;
  31374. var RefSetCache = corePrimitives.RefSetCache;
  31375. var isName = corePrimitives.isName;
  31376. var isCmd = corePrimitives.isCmd;
  31377. var isDict = corePrimitives.isDict;
  31378. var isRef = corePrimitives.isRef;
  31379. var isRefsEqual = corePrimitives.isRefsEqual;
  31380. var isStream = corePrimitives.isStream;
  31381. var CipherTransformFactory = coreCrypto.CipherTransformFactory;
  31382. var Lexer = coreParser.Lexer;
  31383. var Parser = coreParser.Parser;
  31384. var ChunkedStream = coreChunkedStream.ChunkedStream;
  31385. var ColorSpace = coreColorSpace.ColorSpace;
  31386. var Catalog = function CatalogClosure() {
  31387. function Catalog(pdfManager, xref, pageFactory) {
  31388. this.pdfManager = pdfManager;
  31389. this.xref = xref;
  31390. this.catDict = xref.getCatalogObj();
  31391. this.fontCache = new RefSetCache();
  31392. this.builtInCMapCache = Object.create(null);
  31393. assert(isDict(this.catDict), 'catalog object is not a dictionary');
  31394. this.pageFactory = pageFactory;
  31395. this.pagePromises = [];
  31396. }
  31397. Catalog.prototype = {
  31398. get metadata() {
  31399. var streamRef = this.catDict.getRaw('Metadata');
  31400. if (!isRef(streamRef)) {
  31401. return shadow(this, 'metadata', null);
  31402. }
  31403. var encryptMetadata = !this.xref.encrypt ? false : this.xref.encrypt.encryptMetadata;
  31404. var stream = this.xref.fetch(streamRef, !encryptMetadata);
  31405. var metadata;
  31406. if (stream && isDict(stream.dict)) {
  31407. var type = stream.dict.get('Type');
  31408. var subtype = stream.dict.get('Subtype');
  31409. if (isName(type, 'Metadata') && isName(subtype, 'XML')) {
  31410. try {
  31411. metadata = stringToUTF8String(bytesToString(stream.getBytes()));
  31412. } catch (e) {
  31413. info('Skipping invalid metadata.');
  31414. }
  31415. }
  31416. }
  31417. return shadow(this, 'metadata', metadata);
  31418. },
  31419. get toplevelPagesDict() {
  31420. var pagesObj = this.catDict.get('Pages');
  31421. assert(isDict(pagesObj), 'invalid top-level pages dictionary');
  31422. return shadow(this, 'toplevelPagesDict', pagesObj);
  31423. },
  31424. get documentOutline() {
  31425. var obj = null;
  31426. try {
  31427. obj = this.readDocumentOutline();
  31428. } catch (ex) {
  31429. if (ex instanceof MissingDataException) {
  31430. throw ex;
  31431. }
  31432. warn('Unable to read document outline');
  31433. }
  31434. return shadow(this, 'documentOutline', obj);
  31435. },
  31436. readDocumentOutline: function Catalog_readDocumentOutline() {
  31437. var obj = this.catDict.get('Outlines');
  31438. if (!isDict(obj)) {
  31439. return null;
  31440. }
  31441. obj = obj.getRaw('First');
  31442. if (!isRef(obj)) {
  31443. return null;
  31444. }
  31445. var root = { items: [] };
  31446. var queue = [{
  31447. obj: obj,
  31448. parent: root
  31449. }];
  31450. var processed = new RefSet();
  31451. processed.put(obj);
  31452. var xref = this.xref, blackColor = new Uint8Array(3);
  31453. while (queue.length > 0) {
  31454. var i = queue.shift();
  31455. var outlineDict = xref.fetchIfRef(i.obj);
  31456. if (outlineDict === null) {
  31457. continue;
  31458. }
  31459. assert(outlineDict.has('Title'), 'Invalid outline item');
  31460. var data = {
  31461. url: null,
  31462. dest: null
  31463. };
  31464. Catalog.parseDestDictionary({
  31465. destDict: outlineDict,
  31466. resultObj: data,
  31467. docBaseUrl: this.pdfManager.docBaseUrl
  31468. });
  31469. var title = outlineDict.get('Title');
  31470. var flags = outlineDict.get('F') || 0;
  31471. var color = outlineDict.getArray('C'), rgbColor = blackColor;
  31472. if (isArray(color) && color.length === 3 && (color[0] !== 0 || color[1] !== 0 || color[2] !== 0)) {
  31473. rgbColor = ColorSpace.singletons.rgb.getRgb(color, 0);
  31474. }
  31475. var outlineItem = {
  31476. dest: data.dest,
  31477. url: data.url,
  31478. unsafeUrl: data.unsafeUrl,
  31479. newWindow: data.newWindow,
  31480. title: stringToPDFString(title),
  31481. color: rgbColor,
  31482. count: outlineDict.get('Count'),
  31483. bold: !!(flags & 2),
  31484. italic: !!(flags & 1),
  31485. items: []
  31486. };
  31487. i.parent.items.push(outlineItem);
  31488. obj = outlineDict.getRaw('First');
  31489. if (isRef(obj) && !processed.has(obj)) {
  31490. queue.push({
  31491. obj: obj,
  31492. parent: outlineItem
  31493. });
  31494. processed.put(obj);
  31495. }
  31496. obj = outlineDict.getRaw('Next');
  31497. if (isRef(obj) && !processed.has(obj)) {
  31498. queue.push({
  31499. obj: obj,
  31500. parent: i.parent
  31501. });
  31502. processed.put(obj);
  31503. }
  31504. }
  31505. return root.items.length > 0 ? root.items : null;
  31506. },
  31507. get numPages() {
  31508. var obj = this.toplevelPagesDict.get('Count');
  31509. assert(isInt(obj), 'page count in top level pages object is not an integer');
  31510. return shadow(this, 'num', obj);
  31511. },
  31512. get destinations() {
  31513. function fetchDestination(dest) {
  31514. return isDict(dest) ? dest.get('D') : dest;
  31515. }
  31516. var xref = this.xref;
  31517. var dests = {}, nameTreeRef, nameDictionaryRef;
  31518. var obj = this.catDict.get('Names');
  31519. if (obj && obj.has('Dests')) {
  31520. nameTreeRef = obj.getRaw('Dests');
  31521. } else if (this.catDict.has('Dests')) {
  31522. nameDictionaryRef = this.catDict.get('Dests');
  31523. }
  31524. if (nameDictionaryRef) {
  31525. obj = nameDictionaryRef;
  31526. obj.forEach(function catalogForEach(key, value) {
  31527. if (!value) {
  31528. return;
  31529. }
  31530. dests[key] = fetchDestination(value);
  31531. });
  31532. }
  31533. if (nameTreeRef) {
  31534. var nameTree = new NameTree(nameTreeRef, xref);
  31535. var names = nameTree.getAll();
  31536. for (var name in names) {
  31537. dests[name] = fetchDestination(names[name]);
  31538. }
  31539. }
  31540. return shadow(this, 'destinations', dests);
  31541. },
  31542. getDestination: function Catalog_getDestination(destinationId) {
  31543. function fetchDestination(dest) {
  31544. return isDict(dest) ? dest.get('D') : dest;
  31545. }
  31546. var xref = this.xref;
  31547. var dest = null, nameTreeRef, nameDictionaryRef;
  31548. var obj = this.catDict.get('Names');
  31549. if (obj && obj.has('Dests')) {
  31550. nameTreeRef = obj.getRaw('Dests');
  31551. } else if (this.catDict.has('Dests')) {
  31552. nameDictionaryRef = this.catDict.get('Dests');
  31553. }
  31554. if (nameDictionaryRef) {
  31555. var value = nameDictionaryRef.get(destinationId);
  31556. if (value) {
  31557. dest = fetchDestination(value);
  31558. }
  31559. }
  31560. if (nameTreeRef) {
  31561. var nameTree = new NameTree(nameTreeRef, xref);
  31562. dest = fetchDestination(nameTree.get(destinationId));
  31563. }
  31564. return dest;
  31565. },
  31566. get pageLabels() {
  31567. var obj = null;
  31568. try {
  31569. obj = this.readPageLabels();
  31570. } catch (ex) {
  31571. if (ex instanceof MissingDataException) {
  31572. throw ex;
  31573. }
  31574. warn('Unable to read page labels.');
  31575. }
  31576. return shadow(this, 'pageLabels', obj);
  31577. },
  31578. readPageLabels: function Catalog_readPageLabels() {
  31579. var obj = this.catDict.getRaw('PageLabels');
  31580. if (!obj) {
  31581. return null;
  31582. }
  31583. var pageLabels = new Array(this.numPages);
  31584. var style = null;
  31585. var prefix = '';
  31586. var numberTree = new NumberTree(obj, this.xref);
  31587. var nums = numberTree.getAll();
  31588. var currentLabel = '', currentIndex = 1;
  31589. for (var i = 0, ii = this.numPages; i < ii; i++) {
  31590. if (i in nums) {
  31591. var labelDict = nums[i];
  31592. assert(isDict(labelDict), 'The PageLabel is not a dictionary.');
  31593. var type = labelDict.get('Type');
  31594. assert(!type || isName(type, 'PageLabel'), 'Invalid type in PageLabel dictionary.');
  31595. var s = labelDict.get('S');
  31596. assert(!s || isName(s), 'Invalid style in PageLabel dictionary.');
  31597. style = s ? s.name : null;
  31598. var p = labelDict.get('P');
  31599. assert(!p || isString(p), 'Invalid prefix in PageLabel dictionary.');
  31600. prefix = p ? stringToPDFString(p) : '';
  31601. var st = labelDict.get('St');
  31602. assert(!st || isInt(st) && st >= 1, 'Invalid start in PageLabel dictionary.');
  31603. currentIndex = st || 1;
  31604. }
  31605. switch (style) {
  31606. case 'D':
  31607. currentLabel = currentIndex;
  31608. break;
  31609. case 'R':
  31610. case 'r':
  31611. currentLabel = Util.toRoman(currentIndex, style === 'r');
  31612. break;
  31613. case 'A':
  31614. case 'a':
  31615. var LIMIT = 26;
  31616. var A_UPPER_CASE = 0x41, A_LOWER_CASE = 0x61;
  31617. var baseCharCode = style === 'a' ? A_LOWER_CASE : A_UPPER_CASE;
  31618. var letterIndex = currentIndex - 1;
  31619. var character = String.fromCharCode(baseCharCode + letterIndex % LIMIT);
  31620. var charBuf = [];
  31621. for (var j = 0, jj = letterIndex / LIMIT | 0; j <= jj; j++) {
  31622. charBuf.push(character);
  31623. }
  31624. currentLabel = charBuf.join('');
  31625. break;
  31626. default:
  31627. assert(!style, 'Invalid style "' + style + '" in PageLabel dictionary.');
  31628. }
  31629. pageLabels[i] = prefix + currentLabel;
  31630. currentLabel = '';
  31631. currentIndex++;
  31632. }
  31633. return pageLabels;
  31634. },
  31635. get attachments() {
  31636. var xref = this.xref;
  31637. var attachments = null, nameTreeRef;
  31638. var obj = this.catDict.get('Names');
  31639. if (obj) {
  31640. nameTreeRef = obj.getRaw('EmbeddedFiles');
  31641. }
  31642. if (nameTreeRef) {
  31643. var nameTree = new NameTree(nameTreeRef, xref);
  31644. var names = nameTree.getAll();
  31645. for (var name in names) {
  31646. var fs = new FileSpec(names[name], xref);
  31647. if (!attachments) {
  31648. attachments = Object.create(null);
  31649. }
  31650. attachments[stringToPDFString(name)] = fs.serializable;
  31651. }
  31652. }
  31653. return shadow(this, 'attachments', attachments);
  31654. },
  31655. get javaScript() {
  31656. var xref = this.xref;
  31657. var obj = this.catDict.get('Names');
  31658. var javaScript = [];
  31659. function appendIfJavaScriptDict(jsDict) {
  31660. var type = jsDict.get('S');
  31661. if (!isName(type, 'JavaScript')) {
  31662. return;
  31663. }
  31664. var js = jsDict.get('JS');
  31665. if (isStream(js)) {
  31666. js = bytesToString(js.getBytes());
  31667. } else if (!isString(js)) {
  31668. return;
  31669. }
  31670. javaScript.push(stringToPDFString(js));
  31671. }
  31672. if (obj && obj.has('JavaScript')) {
  31673. var nameTree = new NameTree(obj.getRaw('JavaScript'), xref);
  31674. var names = nameTree.getAll();
  31675. for (var name in names) {
  31676. var jsDict = names[name];
  31677. if (isDict(jsDict)) {
  31678. appendIfJavaScriptDict(jsDict);
  31679. }
  31680. }
  31681. }
  31682. var openactionDict = this.catDict.get('OpenAction');
  31683. if (isDict(openactionDict, 'Action')) {
  31684. var actionType = openactionDict.get('S');
  31685. if (isName(actionType, 'Named')) {
  31686. var action = openactionDict.get('N');
  31687. if (isName(action, 'Print')) {
  31688. javaScript.push('print({});');
  31689. }
  31690. } else {
  31691. appendIfJavaScriptDict(openactionDict);
  31692. }
  31693. }
  31694. return shadow(this, 'javaScript', javaScript);
  31695. },
  31696. cleanup: function Catalog_cleanup() {
  31697. var promises = [];
  31698. this.fontCache.forEach(function (promise) {
  31699. promises.push(promise);
  31700. });
  31701. return Promise.all(promises).then(function (translatedFonts) {
  31702. for (var i = 0, ii = translatedFonts.length; i < ii; i++) {
  31703. var font = translatedFonts[i].dict;
  31704. delete font.translated;
  31705. }
  31706. this.fontCache.clear();
  31707. this.builtInCMapCache = Object.create(null);
  31708. }.bind(this));
  31709. },
  31710. getPage: function Catalog_getPage(pageIndex) {
  31711. if (!(pageIndex in this.pagePromises)) {
  31712. this.pagePromises[pageIndex] = this.getPageDict(pageIndex).then(function (a) {
  31713. var dict = a[0];
  31714. var ref = a[1];
  31715. return this.pageFactory.createPage(pageIndex, dict, ref, this.fontCache, this.builtInCMapCache);
  31716. }.bind(this));
  31717. }
  31718. return this.pagePromises[pageIndex];
  31719. },
  31720. getPageDict: function Catalog_getPageDict(pageIndex) {
  31721. var capability = createPromiseCapability();
  31722. var nodesToVisit = [this.catDict.getRaw('Pages')];
  31723. var currentPageIndex = 0;
  31724. var xref = this.xref;
  31725. var checkAllKids = false;
  31726. function next() {
  31727. while (nodesToVisit.length) {
  31728. var currentNode = nodesToVisit.pop();
  31729. if (isRef(currentNode)) {
  31730. xref.fetchAsync(currentNode).then(function (obj) {
  31731. if (isDict(obj, 'Page') || isDict(obj) && !obj.has('Kids')) {
  31732. if (pageIndex === currentPageIndex) {
  31733. capability.resolve([
  31734. obj,
  31735. currentNode
  31736. ]);
  31737. } else {
  31738. currentPageIndex++;
  31739. next();
  31740. }
  31741. return;
  31742. }
  31743. nodesToVisit.push(obj);
  31744. next();
  31745. }, capability.reject);
  31746. return;
  31747. }
  31748. assert(isDict(currentNode), 'page dictionary kid reference points to wrong type of object');
  31749. var count = currentNode.get('Count');
  31750. if (count === 0) {
  31751. checkAllKids = true;
  31752. }
  31753. if (currentPageIndex + count <= pageIndex) {
  31754. currentPageIndex += count;
  31755. continue;
  31756. }
  31757. var kids = currentNode.get('Kids');
  31758. assert(isArray(kids), 'page dictionary kids object is not an array');
  31759. if (!checkAllKids && count === kids.length) {
  31760. nodesToVisit = [kids[pageIndex - currentPageIndex]];
  31761. currentPageIndex = pageIndex;
  31762. continue;
  31763. } else {
  31764. for (var last = kids.length - 1; last >= 0; last--) {
  31765. nodesToVisit.push(kids[last]);
  31766. }
  31767. }
  31768. }
  31769. capability.reject('Page index ' + pageIndex + ' not found.');
  31770. }
  31771. next();
  31772. return capability.promise;
  31773. },
  31774. getPageIndex: function Catalog_getPageIndex(pageRef) {
  31775. var xref = this.xref;
  31776. function pagesBeforeRef(kidRef) {
  31777. var total = 0;
  31778. var parentRef;
  31779. return xref.fetchAsync(kidRef).then(function (node) {
  31780. if (isRefsEqual(kidRef, pageRef) && !isDict(node, 'Page') && !(isDict(node) && !node.has('Type') && node.has('Contents'))) {
  31781. throw new Error('The reference does not point to a /Page Dict.');
  31782. }
  31783. if (!node) {
  31784. return null;
  31785. }
  31786. assert(isDict(node), 'node must be a Dict.');
  31787. parentRef = node.getRaw('Parent');
  31788. return node.getAsync('Parent');
  31789. }).then(function (parent) {
  31790. if (!parent) {
  31791. return null;
  31792. }
  31793. assert(isDict(parent), 'parent must be a Dict.');
  31794. return parent.getAsync('Kids');
  31795. }).then(function (kids) {
  31796. if (!kids) {
  31797. return null;
  31798. }
  31799. var kidPromises = [];
  31800. var found = false;
  31801. for (var i = 0; i < kids.length; i++) {
  31802. var kid = kids[i];
  31803. assert(isRef(kid), 'kid must be a Ref.');
  31804. if (kid.num === kidRef.num) {
  31805. found = true;
  31806. break;
  31807. }
  31808. kidPromises.push(xref.fetchAsync(kid).then(function (kid) {
  31809. if (kid.has('Count')) {
  31810. var count = kid.get('Count');
  31811. total += count;
  31812. } else {
  31813. total++;
  31814. }
  31815. }));
  31816. }
  31817. if (!found) {
  31818. error('kid ref not found in parents kids');
  31819. }
  31820. return Promise.all(kidPromises).then(function () {
  31821. return [
  31822. total,
  31823. parentRef
  31824. ];
  31825. });
  31826. });
  31827. }
  31828. var total = 0;
  31829. function next(ref) {
  31830. return pagesBeforeRef(ref).then(function (args) {
  31831. if (!args) {
  31832. return total;
  31833. }
  31834. var count = args[0];
  31835. var parentRef = args[1];
  31836. total += count;
  31837. return next(parentRef);
  31838. });
  31839. }
  31840. return next(pageRef);
  31841. }
  31842. };
  31843. Catalog.parseDestDictionary = function Catalog_parseDestDictionary(params) {
  31844. function addDefaultProtocolToUrl(url) {
  31845. if (url.indexOf('www.') === 0) {
  31846. return 'http://' + url;
  31847. }
  31848. return url;
  31849. }
  31850. function tryConvertUrlEncoding(url) {
  31851. try {
  31852. return stringToUTF8String(url);
  31853. } catch (e) {
  31854. return url;
  31855. }
  31856. }
  31857. var destDict = params.destDict;
  31858. if (!isDict(destDict)) {
  31859. warn('Catalog_parseDestDictionary: "destDict" must be a dictionary.');
  31860. return;
  31861. }
  31862. var resultObj = params.resultObj;
  31863. if (typeof resultObj !== 'object') {
  31864. warn('Catalog_parseDestDictionary: "resultObj" must be an object.');
  31865. return;
  31866. }
  31867. var docBaseUrl = params.docBaseUrl || null;
  31868. var action = destDict.get('A'), url, dest;
  31869. if (isDict(action)) {
  31870. var linkType = action.get('S').name;
  31871. switch (linkType) {
  31872. case 'URI':
  31873. url = action.get('URI');
  31874. if (isName(url)) {
  31875. url = '/' + url.name;
  31876. } else if (isString(url)) {
  31877. url = addDefaultProtocolToUrl(url);
  31878. }
  31879. break;
  31880. case 'GoTo':
  31881. dest = action.get('D');
  31882. break;
  31883. case 'Launch':
  31884. case 'GoToR':
  31885. var urlDict = action.get('F');
  31886. if (isDict(urlDict)) {
  31887. url = urlDict.get('F') || null;
  31888. } else if (isString(urlDict)) {
  31889. url = urlDict;
  31890. }
  31891. var remoteDest = action.get('D');
  31892. if (remoteDest) {
  31893. if (isName(remoteDest)) {
  31894. remoteDest = remoteDest.name;
  31895. }
  31896. if (isString(url)) {
  31897. var baseUrl = url.split('#')[0];
  31898. if (isString(remoteDest)) {
  31899. url = baseUrl + '#' + (/^\d+$/.test(remoteDest) ? 'nameddest=' : '') + remoteDest;
  31900. } else if (isArray(remoteDest)) {
  31901. url = baseUrl + '#' + JSON.stringify(remoteDest);
  31902. }
  31903. }
  31904. }
  31905. var newWindow = action.get('NewWindow');
  31906. if (isBool(newWindow)) {
  31907. resultObj.newWindow = newWindow;
  31908. }
  31909. break;
  31910. case 'Named':
  31911. var namedAction = action.get('N');
  31912. if (isName(namedAction)) {
  31913. resultObj.action = namedAction.name;
  31914. }
  31915. break;
  31916. case 'JavaScript':
  31917. var jsAction = action.get('JS'), js;
  31918. if (isStream(jsAction)) {
  31919. js = bytesToString(jsAction.getBytes());
  31920. } else if (isString(jsAction)) {
  31921. js = jsAction;
  31922. }
  31923. if (js) {
  31924. var URL_OPEN_METHODS = [
  31925. 'app.launchURL',
  31926. 'window.open'
  31927. ];
  31928. var regex = new RegExp('^(?:' + URL_OPEN_METHODS.join('|') + ')' + '\\((?:\'|\")(\\S+)(?:\'|\")(?:,|\\))');
  31929. var jsUrl = regex.exec(stringToPDFString(js), 'i');
  31930. if (jsUrl && jsUrl[1]) {
  31931. url = jsUrl[1];
  31932. break;
  31933. }
  31934. }
  31935. default:
  31936. warn('Catalog_parseDestDictionary: Unrecognized link type "' + linkType + '".');
  31937. break;
  31938. }
  31939. } else if (destDict.has('Dest')) {
  31940. dest = destDict.get('Dest');
  31941. }
  31942. if (isString(url)) {
  31943. url = tryConvertUrlEncoding(url);
  31944. var absoluteUrl = createValidAbsoluteUrl(url, docBaseUrl);
  31945. if (absoluteUrl) {
  31946. resultObj.url = absoluteUrl.href;
  31947. }
  31948. resultObj.unsafeUrl = url;
  31949. }
  31950. if (dest) {
  31951. if (isName(dest)) {
  31952. dest = dest.name;
  31953. }
  31954. if (isString(dest) || isArray(dest)) {
  31955. resultObj.dest = dest;
  31956. }
  31957. }
  31958. };
  31959. return Catalog;
  31960. }();
  31961. var XRef = function XRefClosure() {
  31962. function XRef(stream, pdfManager) {
  31963. this.stream = stream;
  31964. this.pdfManager = pdfManager;
  31965. this.entries = [];
  31966. this.xrefstms = Object.create(null);
  31967. this.cache = [];
  31968. this.stats = {
  31969. streamTypes: [],
  31970. fontTypes: []
  31971. };
  31972. }
  31973. XRef.prototype = {
  31974. setStartXRef: function XRef_setStartXRef(startXRef) {
  31975. this.startXRefQueue = [startXRef];
  31976. },
  31977. parse: function XRef_parse(recoveryMode) {
  31978. var trailerDict;
  31979. if (!recoveryMode) {
  31980. trailerDict = this.readXRef();
  31981. } else {
  31982. warn('Indexing all PDF objects');
  31983. trailerDict = this.indexObjects();
  31984. }
  31985. trailerDict.assignXref(this);
  31986. this.trailer = trailerDict;
  31987. var encrypt = trailerDict.get('Encrypt');
  31988. if (isDict(encrypt)) {
  31989. var ids = trailerDict.get('ID');
  31990. var fileId = ids && ids.length ? ids[0] : '';
  31991. encrypt.suppressEncryption = true;
  31992. this.encrypt = new CipherTransformFactory(encrypt, fileId, this.pdfManager.password);
  31993. }
  31994. if (!(this.root = trailerDict.get('Root'))) {
  31995. error('Invalid root reference');
  31996. }
  31997. },
  31998. processXRefTable: function XRef_processXRefTable(parser) {
  31999. if (!('tableState' in this)) {
  32000. this.tableState = {
  32001. entryNum: 0,
  32002. streamPos: parser.lexer.stream.pos,
  32003. parserBuf1: parser.buf1,
  32004. parserBuf2: parser.buf2
  32005. };
  32006. }
  32007. var obj = this.readXRefTable(parser);
  32008. if (!isCmd(obj, 'trailer')) {
  32009. error('Invalid XRef table: could not find trailer dictionary');
  32010. }
  32011. var dict = parser.getObj();
  32012. if (!isDict(dict) && dict.dict) {
  32013. dict = dict.dict;
  32014. }
  32015. if (!isDict(dict)) {
  32016. error('Invalid XRef table: could not parse trailer dictionary');
  32017. }
  32018. delete this.tableState;
  32019. return dict;
  32020. },
  32021. readXRefTable: function XRef_readXRefTable(parser) {
  32022. var stream = parser.lexer.stream;
  32023. var tableState = this.tableState;
  32024. stream.pos = tableState.streamPos;
  32025. parser.buf1 = tableState.parserBuf1;
  32026. parser.buf2 = tableState.parserBuf2;
  32027. var obj;
  32028. while (true) {
  32029. if (!('firstEntryNum' in tableState) || !('entryCount' in tableState)) {
  32030. if (isCmd(obj = parser.getObj(), 'trailer')) {
  32031. break;
  32032. }
  32033. tableState.firstEntryNum = obj;
  32034. tableState.entryCount = parser.getObj();
  32035. }
  32036. var first = tableState.firstEntryNum;
  32037. var count = tableState.entryCount;
  32038. if (!isInt(first) || !isInt(count)) {
  32039. error('Invalid XRef table: wrong types in subsection header');
  32040. }
  32041. for (var i = tableState.entryNum; i < count; i++) {
  32042. tableState.streamPos = stream.pos;
  32043. tableState.entryNum = i;
  32044. tableState.parserBuf1 = parser.buf1;
  32045. tableState.parserBuf2 = parser.buf2;
  32046. var entry = {};
  32047. entry.offset = parser.getObj();
  32048. entry.gen = parser.getObj();
  32049. var type = parser.getObj();
  32050. if (isCmd(type, 'f')) {
  32051. entry.free = true;
  32052. } else if (isCmd(type, 'n')) {
  32053. entry.uncompressed = true;
  32054. }
  32055. if (!isInt(entry.offset) || !isInt(entry.gen) || !(entry.free || entry.uncompressed)) {
  32056. error('Invalid entry in XRef subsection: ' + first + ', ' + count);
  32057. }
  32058. if (i === 0 && entry.free && first === 1) {
  32059. first = 0;
  32060. }
  32061. if (!this.entries[i + first]) {
  32062. this.entries[i + first] = entry;
  32063. }
  32064. }
  32065. tableState.entryNum = 0;
  32066. tableState.streamPos = stream.pos;
  32067. tableState.parserBuf1 = parser.buf1;
  32068. tableState.parserBuf2 = parser.buf2;
  32069. delete tableState.firstEntryNum;
  32070. delete tableState.entryCount;
  32071. }
  32072. if (this.entries[0] && !this.entries[0].free) {
  32073. error('Invalid XRef table: unexpected first object');
  32074. }
  32075. return obj;
  32076. },
  32077. processXRefStream: function XRef_processXRefStream(stream) {
  32078. if (!('streamState' in this)) {
  32079. var streamParameters = stream.dict;
  32080. var byteWidths = streamParameters.get('W');
  32081. var range = streamParameters.get('Index');
  32082. if (!range) {
  32083. range = [
  32084. 0,
  32085. streamParameters.get('Size')
  32086. ];
  32087. }
  32088. this.streamState = {
  32089. entryRanges: range,
  32090. byteWidths: byteWidths,
  32091. entryNum: 0,
  32092. streamPos: stream.pos
  32093. };
  32094. }
  32095. this.readXRefStream(stream);
  32096. delete this.streamState;
  32097. return stream.dict;
  32098. },
  32099. readXRefStream: function XRef_readXRefStream(stream) {
  32100. var i, j;
  32101. var streamState = this.streamState;
  32102. stream.pos = streamState.streamPos;
  32103. var byteWidths = streamState.byteWidths;
  32104. var typeFieldWidth = byteWidths[0];
  32105. var offsetFieldWidth = byteWidths[1];
  32106. var generationFieldWidth = byteWidths[2];
  32107. var entryRanges = streamState.entryRanges;
  32108. while (entryRanges.length > 0) {
  32109. var first = entryRanges[0];
  32110. var n = entryRanges[1];
  32111. if (!isInt(first) || !isInt(n)) {
  32112. error('Invalid XRef range fields: ' + first + ', ' + n);
  32113. }
  32114. if (!isInt(typeFieldWidth) || !isInt(offsetFieldWidth) || !isInt(generationFieldWidth)) {
  32115. error('Invalid XRef entry fields length: ' + first + ', ' + n);
  32116. }
  32117. for (i = streamState.entryNum; i < n; ++i) {
  32118. streamState.entryNum = i;
  32119. streamState.streamPos = stream.pos;
  32120. var type = 0, offset = 0, generation = 0;
  32121. for (j = 0; j < typeFieldWidth; ++j) {
  32122. type = type << 8 | stream.getByte();
  32123. }
  32124. if (typeFieldWidth === 0) {
  32125. type = 1;
  32126. }
  32127. for (j = 0; j < offsetFieldWidth; ++j) {
  32128. offset = offset << 8 | stream.getByte();
  32129. }
  32130. for (j = 0; j < generationFieldWidth; ++j) {
  32131. generation = generation << 8 | stream.getByte();
  32132. }
  32133. var entry = {};
  32134. entry.offset = offset;
  32135. entry.gen = generation;
  32136. switch (type) {
  32137. case 0:
  32138. entry.free = true;
  32139. break;
  32140. case 1:
  32141. entry.uncompressed = true;
  32142. break;
  32143. case 2:
  32144. break;
  32145. default:
  32146. error('Invalid XRef entry type: ' + type);
  32147. }
  32148. if (!this.entries[first + i]) {
  32149. this.entries[first + i] = entry;
  32150. }
  32151. }
  32152. streamState.entryNum = 0;
  32153. streamState.streamPos = stream.pos;
  32154. entryRanges.splice(0, 2);
  32155. }
  32156. },
  32157. indexObjects: function XRef_indexObjects() {
  32158. var TAB = 0x9, LF = 0xA, CR = 0xD, SPACE = 0x20;
  32159. var PERCENT = 0x25, LT = 0x3C;
  32160. function readToken(data, offset) {
  32161. var token = '', ch = data[offset];
  32162. while (ch !== LF && ch !== CR && ch !== LT) {
  32163. if (++offset >= data.length) {
  32164. break;
  32165. }
  32166. token += String.fromCharCode(ch);
  32167. ch = data[offset];
  32168. }
  32169. return token;
  32170. }
  32171. function skipUntil(data, offset, what) {
  32172. var length = what.length, dataLength = data.length;
  32173. var skipped = 0;
  32174. while (offset < dataLength) {
  32175. var i = 0;
  32176. while (i < length && data[offset + i] === what[i]) {
  32177. ++i;
  32178. }
  32179. if (i >= length) {
  32180. break;
  32181. }
  32182. offset++;
  32183. skipped++;
  32184. }
  32185. return skipped;
  32186. }
  32187. var objRegExp = /^(\d+)\s+(\d+)\s+obj\b/;
  32188. var trailerBytes = new Uint8Array([
  32189. 116,
  32190. 114,
  32191. 97,
  32192. 105,
  32193. 108,
  32194. 101,
  32195. 114
  32196. ]);
  32197. var startxrefBytes = new Uint8Array([
  32198. 115,
  32199. 116,
  32200. 97,
  32201. 114,
  32202. 116,
  32203. 120,
  32204. 114,
  32205. 101,
  32206. 102
  32207. ]);
  32208. var endobjBytes = new Uint8Array([
  32209. 101,
  32210. 110,
  32211. 100,
  32212. 111,
  32213. 98,
  32214. 106
  32215. ]);
  32216. var xrefBytes = new Uint8Array([
  32217. 47,
  32218. 88,
  32219. 82,
  32220. 101,
  32221. 102
  32222. ]);
  32223. this.entries.length = 0;
  32224. var stream = this.stream;
  32225. stream.pos = 0;
  32226. var buffer = stream.getBytes();
  32227. var position = stream.start, length = buffer.length;
  32228. var trailers = [], xrefStms = [];
  32229. while (position < length) {
  32230. var ch = buffer[position];
  32231. if (ch === TAB || ch === LF || ch === CR || ch === SPACE) {
  32232. ++position;
  32233. continue;
  32234. }
  32235. if (ch === PERCENT) {
  32236. do {
  32237. ++position;
  32238. if (position >= length) {
  32239. break;
  32240. }
  32241. ch = buffer[position];
  32242. } while (ch !== LF && ch !== CR);
  32243. continue;
  32244. }
  32245. var token = readToken(buffer, position);
  32246. var m;
  32247. if (token.indexOf('xref') === 0 && (token.length === 4 || /\s/.test(token[4]))) {
  32248. position += skipUntil(buffer, position, trailerBytes);
  32249. trailers.push(position);
  32250. position += skipUntil(buffer, position, startxrefBytes);
  32251. } else if (m = objRegExp.exec(token)) {
  32252. if (typeof this.entries[m[1]] === 'undefined') {
  32253. this.entries[m[1]] = {
  32254. offset: position - stream.start,
  32255. gen: m[2] | 0,
  32256. uncompressed: true
  32257. };
  32258. }
  32259. var contentLength = skipUntil(buffer, position, endobjBytes) + 7;
  32260. var content = buffer.subarray(position, position + contentLength);
  32261. var xrefTagOffset = skipUntil(content, 0, xrefBytes);
  32262. if (xrefTagOffset < contentLength && content[xrefTagOffset + 5] < 64) {
  32263. xrefStms.push(position - stream.start);
  32264. this.xrefstms[position - stream.start] = 1;
  32265. }
  32266. position += contentLength;
  32267. } else if (token.indexOf('trailer') === 0 && (token.length === 7 || /\s/.test(token[7]))) {
  32268. trailers.push(position);
  32269. position += skipUntil(buffer, position, startxrefBytes);
  32270. } else {
  32271. position += token.length + 1;
  32272. }
  32273. }
  32274. var i, ii;
  32275. for (i = 0, ii = xrefStms.length; i < ii; ++i) {
  32276. this.startXRefQueue.push(xrefStms[i]);
  32277. this.readXRef(true);
  32278. }
  32279. var dict;
  32280. for (i = 0, ii = trailers.length; i < ii; ++i) {
  32281. stream.pos = trailers[i];
  32282. var parser = new Parser(new Lexer(stream), true, this, true);
  32283. var obj = parser.getObj();
  32284. if (!isCmd(obj, 'trailer')) {
  32285. continue;
  32286. }
  32287. dict = parser.getObj();
  32288. if (!isDict(dict)) {
  32289. continue;
  32290. }
  32291. if (dict.has('ID')) {
  32292. return dict;
  32293. }
  32294. }
  32295. if (dict) {
  32296. return dict;
  32297. }
  32298. throw new InvalidPDFException('Invalid PDF structure');
  32299. },
  32300. readXRef: function XRef_readXRef(recoveryMode) {
  32301. var stream = this.stream;
  32302. try {
  32303. while (this.startXRefQueue.length) {
  32304. var startXRef = this.startXRefQueue[0];
  32305. stream.pos = startXRef + stream.start;
  32306. var parser = new Parser(new Lexer(stream), true, this);
  32307. var obj = parser.getObj();
  32308. var dict;
  32309. if (isCmd(obj, 'xref')) {
  32310. dict = this.processXRefTable(parser);
  32311. if (!this.topDict) {
  32312. this.topDict = dict;
  32313. }
  32314. obj = dict.get('XRefStm');
  32315. if (isInt(obj)) {
  32316. var pos = obj;
  32317. if (!(pos in this.xrefstms)) {
  32318. this.xrefstms[pos] = 1;
  32319. this.startXRefQueue.push(pos);
  32320. }
  32321. }
  32322. } else if (isInt(obj)) {
  32323. if (!isInt(parser.getObj()) || !isCmd(parser.getObj(), 'obj') || !isStream(obj = parser.getObj())) {
  32324. error('Invalid XRef stream');
  32325. }
  32326. dict = this.processXRefStream(obj);
  32327. if (!this.topDict) {
  32328. this.topDict = dict;
  32329. }
  32330. if (!dict) {
  32331. error('Failed to read XRef stream');
  32332. }
  32333. } else {
  32334. error('Invalid XRef stream header');
  32335. }
  32336. obj = dict.get('Prev');
  32337. if (isInt(obj)) {
  32338. this.startXRefQueue.push(obj);
  32339. } else if (isRef(obj)) {
  32340. this.startXRefQueue.push(obj.num);
  32341. }
  32342. this.startXRefQueue.shift();
  32343. }
  32344. return this.topDict;
  32345. } catch (e) {
  32346. if (e instanceof MissingDataException) {
  32347. throw e;
  32348. }
  32349. info('(while reading XRef): ' + e);
  32350. }
  32351. if (recoveryMode) {
  32352. return;
  32353. }
  32354. throw new XRefParseException();
  32355. },
  32356. getEntry: function XRef_getEntry(i) {
  32357. var xrefEntry = this.entries[i];
  32358. if (xrefEntry && !xrefEntry.free && xrefEntry.offset) {
  32359. return xrefEntry;
  32360. }
  32361. return null;
  32362. },
  32363. fetchIfRef: function XRef_fetchIfRef(obj, suppressEncryption) {
  32364. if (!isRef(obj)) {
  32365. return obj;
  32366. }
  32367. return this.fetch(obj, suppressEncryption);
  32368. },
  32369. fetch: function XRef_fetch(ref, suppressEncryption) {
  32370. assert(isRef(ref), 'ref object is not a reference');
  32371. var num = ref.num;
  32372. if (num in this.cache) {
  32373. var cacheEntry = this.cache[num];
  32374. return cacheEntry;
  32375. }
  32376. var xrefEntry = this.getEntry(num);
  32377. if (xrefEntry === null) {
  32378. return this.cache[num] = null;
  32379. }
  32380. if (xrefEntry.uncompressed) {
  32381. xrefEntry = this.fetchUncompressed(ref, xrefEntry, suppressEncryption);
  32382. } else {
  32383. xrefEntry = this.fetchCompressed(xrefEntry, suppressEncryption);
  32384. }
  32385. if (isDict(xrefEntry)) {
  32386. xrefEntry.objId = ref.toString();
  32387. } else if (isStream(xrefEntry)) {
  32388. xrefEntry.dict.objId = ref.toString();
  32389. }
  32390. return xrefEntry;
  32391. },
  32392. fetchUncompressed: function XRef_fetchUncompressed(ref, xrefEntry, suppressEncryption) {
  32393. var gen = ref.gen;
  32394. var num = ref.num;
  32395. if (xrefEntry.gen !== gen) {
  32396. error('inconsistent generation in XRef');
  32397. }
  32398. var stream = this.stream.makeSubStream(xrefEntry.offset + this.stream.start);
  32399. var parser = new Parser(new Lexer(stream), true, this);
  32400. var obj1 = parser.getObj();
  32401. var obj2 = parser.getObj();
  32402. var obj3 = parser.getObj();
  32403. if (!isInt(obj1) || parseInt(obj1, 10) !== num || !isInt(obj2) || parseInt(obj2, 10) !== gen || !isCmd(obj3)) {
  32404. error('bad XRef entry');
  32405. }
  32406. if (!isCmd(obj3, 'obj')) {
  32407. if (obj3.cmd.indexOf('obj') === 0) {
  32408. num = parseInt(obj3.cmd.substring(3), 10);
  32409. if (!isNaN(num)) {
  32410. return num;
  32411. }
  32412. }
  32413. error('bad XRef entry');
  32414. }
  32415. if (this.encrypt && !suppressEncryption) {
  32416. xrefEntry = parser.getObj(this.encrypt.createCipherTransform(num, gen));
  32417. } else {
  32418. xrefEntry = parser.getObj();
  32419. }
  32420. if (!isStream(xrefEntry)) {
  32421. this.cache[num] = xrefEntry;
  32422. }
  32423. return xrefEntry;
  32424. },
  32425. fetchCompressed: function XRef_fetchCompressed(xrefEntry, suppressEncryption) {
  32426. var tableOffset = xrefEntry.offset;
  32427. var stream = this.fetch(new Ref(tableOffset, 0));
  32428. if (!isStream(stream)) {
  32429. error('bad ObjStm stream');
  32430. }
  32431. var first = stream.dict.get('First');
  32432. var n = stream.dict.get('N');
  32433. if (!isInt(first) || !isInt(n)) {
  32434. error('invalid first and n parameters for ObjStm stream');
  32435. }
  32436. var parser = new Parser(new Lexer(stream), false, this);
  32437. parser.allowStreams = true;
  32438. var i, entries = [], num, nums = [];
  32439. for (i = 0; i < n; ++i) {
  32440. num = parser.getObj();
  32441. if (!isInt(num)) {
  32442. error('invalid object number in the ObjStm stream: ' + num);
  32443. }
  32444. nums.push(num);
  32445. var offset = parser.getObj();
  32446. if (!isInt(offset)) {
  32447. error('invalid object offset in the ObjStm stream: ' + offset);
  32448. }
  32449. }
  32450. for (i = 0; i < n; ++i) {
  32451. entries.push(parser.getObj());
  32452. if (isCmd(parser.buf1, 'endobj')) {
  32453. parser.shift();
  32454. }
  32455. num = nums[i];
  32456. var entry = this.entries[num];
  32457. if (entry && entry.offset === tableOffset && entry.gen === i) {
  32458. this.cache[num] = entries[i];
  32459. }
  32460. }
  32461. xrefEntry = entries[xrefEntry.gen];
  32462. if (xrefEntry === undefined) {
  32463. error('bad XRef entry for compressed object');
  32464. }
  32465. return xrefEntry;
  32466. },
  32467. fetchIfRefAsync: function XRef_fetchIfRefAsync(obj, suppressEncryption) {
  32468. if (!isRef(obj)) {
  32469. return Promise.resolve(obj);
  32470. }
  32471. return this.fetchAsync(obj, suppressEncryption);
  32472. },
  32473. fetchAsync: function XRef_fetchAsync(ref, suppressEncryption) {
  32474. var streamManager = this.stream.manager;
  32475. var xref = this;
  32476. return new Promise(function tryFetch(resolve, reject) {
  32477. try {
  32478. resolve(xref.fetch(ref, suppressEncryption));
  32479. } catch (e) {
  32480. if (e instanceof MissingDataException) {
  32481. streamManager.requestRange(e.begin, e.end).then(function () {
  32482. tryFetch(resolve, reject);
  32483. }, reject);
  32484. return;
  32485. }
  32486. reject(e);
  32487. }
  32488. });
  32489. },
  32490. getCatalogObj: function XRef_getCatalogObj() {
  32491. return this.root;
  32492. }
  32493. };
  32494. return XRef;
  32495. }();
  32496. var NameOrNumberTree = function NameOrNumberTreeClosure() {
  32497. function NameOrNumberTree(root, xref) {
  32498. throw new Error('Cannot initialize NameOrNumberTree.');
  32499. }
  32500. NameOrNumberTree.prototype = {
  32501. getAll: function NameOrNumberTree_getAll() {
  32502. var dict = Object.create(null);
  32503. if (!this.root) {
  32504. return dict;
  32505. }
  32506. var xref = this.xref;
  32507. var processed = new RefSet();
  32508. processed.put(this.root);
  32509. var queue = [this.root];
  32510. while (queue.length > 0) {
  32511. var i, n;
  32512. var obj = xref.fetchIfRef(queue.shift());
  32513. if (!isDict(obj)) {
  32514. continue;
  32515. }
  32516. if (obj.has('Kids')) {
  32517. var kids = obj.get('Kids');
  32518. for (i = 0, n = kids.length; i < n; i++) {
  32519. var kid = kids[i];
  32520. assert(!processed.has(kid), 'Duplicate entry in "' + this._type + '" tree.');
  32521. queue.push(kid);
  32522. processed.put(kid);
  32523. }
  32524. continue;
  32525. }
  32526. var entries = obj.get(this._type);
  32527. if (isArray(entries)) {
  32528. for (i = 0, n = entries.length; i < n; i += 2) {
  32529. dict[xref.fetchIfRef(entries[i])] = xref.fetchIfRef(entries[i + 1]);
  32530. }
  32531. }
  32532. }
  32533. return dict;
  32534. },
  32535. get: function NameOrNumberTree_get(key) {
  32536. if (!this.root) {
  32537. return null;
  32538. }
  32539. var xref = this.xref;
  32540. var kidsOrEntries = xref.fetchIfRef(this.root);
  32541. var loopCount = 0;
  32542. var MAX_LEVELS = 10;
  32543. var l, r, m;
  32544. while (kidsOrEntries.has('Kids')) {
  32545. if (++loopCount > MAX_LEVELS) {
  32546. warn('Search depth limit reached for "' + this._type + '" tree.');
  32547. return null;
  32548. }
  32549. var kids = kidsOrEntries.get('Kids');
  32550. if (!isArray(kids)) {
  32551. return null;
  32552. }
  32553. l = 0;
  32554. r = kids.length - 1;
  32555. while (l <= r) {
  32556. m = l + r >> 1;
  32557. var kid = xref.fetchIfRef(kids[m]);
  32558. var limits = kid.get('Limits');
  32559. if (key < xref.fetchIfRef(limits[0])) {
  32560. r = m - 1;
  32561. } else if (key > xref.fetchIfRef(limits[1])) {
  32562. l = m + 1;
  32563. } else {
  32564. kidsOrEntries = xref.fetchIfRef(kids[m]);
  32565. break;
  32566. }
  32567. }
  32568. if (l > r) {
  32569. return null;
  32570. }
  32571. }
  32572. var entries = kidsOrEntries.get(this._type);
  32573. if (isArray(entries)) {
  32574. l = 0;
  32575. r = entries.length - 2;
  32576. while (l <= r) {
  32577. m = l + r & ~1;
  32578. var currentKey = xref.fetchIfRef(entries[m]);
  32579. if (key < currentKey) {
  32580. r = m - 2;
  32581. } else if (key > currentKey) {
  32582. l = m + 2;
  32583. } else {
  32584. return xref.fetchIfRef(entries[m + 1]);
  32585. }
  32586. }
  32587. }
  32588. return null;
  32589. }
  32590. };
  32591. return NameOrNumberTree;
  32592. }();
  32593. var NameTree = function NameTreeClosure() {
  32594. function NameTree(root, xref) {
  32595. this.root = root;
  32596. this.xref = xref;
  32597. this._type = 'Names';
  32598. }
  32599. Util.inherit(NameTree, NameOrNumberTree, {});
  32600. return NameTree;
  32601. }();
  32602. var NumberTree = function NumberTreeClosure() {
  32603. function NumberTree(root, xref) {
  32604. this.root = root;
  32605. this.xref = xref;
  32606. this._type = 'Nums';
  32607. }
  32608. Util.inherit(NumberTree, NameOrNumberTree, {});
  32609. return NumberTree;
  32610. }();
  32611. var FileSpec = function FileSpecClosure() {
  32612. function FileSpec(root, xref) {
  32613. if (!root || !isDict(root)) {
  32614. return;
  32615. }
  32616. this.xref = xref;
  32617. this.root = root;
  32618. if (root.has('FS')) {
  32619. this.fs = root.get('FS');
  32620. }
  32621. this.description = root.has('Desc') ? stringToPDFString(root.get('Desc')) : '';
  32622. if (root.has('RF')) {
  32623. warn('Related file specifications are not supported');
  32624. }
  32625. this.contentAvailable = true;
  32626. if (!root.has('EF')) {
  32627. this.contentAvailable = false;
  32628. warn('Non-embedded file specifications are not supported');
  32629. }
  32630. }
  32631. function pickPlatformItem(dict) {
  32632. if (dict.has('UF')) {
  32633. return dict.get('UF');
  32634. } else if (dict.has('F')) {
  32635. return dict.get('F');
  32636. } else if (dict.has('Unix')) {
  32637. return dict.get('Unix');
  32638. } else if (dict.has('Mac')) {
  32639. return dict.get('Mac');
  32640. } else if (dict.has('DOS')) {
  32641. return dict.get('DOS');
  32642. }
  32643. return null;
  32644. }
  32645. FileSpec.prototype = {
  32646. get filename() {
  32647. if (!this._filename && this.root) {
  32648. var filename = pickPlatformItem(this.root) || 'unnamed';
  32649. this._filename = stringToPDFString(filename).replace(/\\\\/g, '\\').replace(/\\\//g, '/').replace(/\\/g, '/');
  32650. }
  32651. return this._filename;
  32652. },
  32653. get content() {
  32654. if (!this.contentAvailable) {
  32655. return null;
  32656. }
  32657. if (!this.contentRef && this.root) {
  32658. this.contentRef = pickPlatformItem(this.root.get('EF'));
  32659. }
  32660. var content = null;
  32661. if (this.contentRef) {
  32662. var xref = this.xref;
  32663. var fileObj = xref.fetchIfRef(this.contentRef);
  32664. if (fileObj && isStream(fileObj)) {
  32665. content = fileObj.getBytes();
  32666. } else {
  32667. warn('Embedded file specification points to non-existing/invalid ' + 'content');
  32668. }
  32669. } else {
  32670. warn('Embedded file specification does not have a content');
  32671. }
  32672. return content;
  32673. },
  32674. get serializable() {
  32675. return {
  32676. filename: this.filename,
  32677. content: this.content
  32678. };
  32679. }
  32680. };
  32681. return FileSpec;
  32682. }();
  32683. var ObjectLoader = function () {
  32684. function mayHaveChildren(value) {
  32685. return isRef(value) || isDict(value) || isArray(value) || isStream(value);
  32686. }
  32687. function addChildren(node, nodesToVisit) {
  32688. var value;
  32689. if (isDict(node) || isStream(node)) {
  32690. var map;
  32691. if (isDict(node)) {
  32692. map = node.map;
  32693. } else {
  32694. map = node.dict.map;
  32695. }
  32696. for (var key in map) {
  32697. value = map[key];
  32698. if (mayHaveChildren(value)) {
  32699. nodesToVisit.push(value);
  32700. }
  32701. }
  32702. } else if (isArray(node)) {
  32703. for (var i = 0, ii = node.length; i < ii; i++) {
  32704. value = node[i];
  32705. if (mayHaveChildren(value)) {
  32706. nodesToVisit.push(value);
  32707. }
  32708. }
  32709. }
  32710. }
  32711. function ObjectLoader(obj, keys, xref) {
  32712. this.obj = obj;
  32713. this.keys = keys;
  32714. this.xref = xref;
  32715. this.refSet = null;
  32716. this.capability = null;
  32717. }
  32718. ObjectLoader.prototype = {
  32719. load: function ObjectLoader_load() {
  32720. var keys = this.keys;
  32721. this.capability = createPromiseCapability();
  32722. if (!(this.xref.stream instanceof ChunkedStream) || this.xref.stream.getMissingChunks().length === 0) {
  32723. this.capability.resolve();
  32724. return this.capability.promise;
  32725. }
  32726. this.refSet = new RefSet();
  32727. var nodesToVisit = [];
  32728. for (var i = 0; i < keys.length; i++) {
  32729. nodesToVisit.push(this.obj[keys[i]]);
  32730. }
  32731. this._walk(nodesToVisit);
  32732. return this.capability.promise;
  32733. },
  32734. _walk: function ObjectLoader_walk(nodesToVisit) {
  32735. var nodesToRevisit = [];
  32736. var pendingRequests = [];
  32737. while (nodesToVisit.length) {
  32738. var currentNode = nodesToVisit.pop();
  32739. if (isRef(currentNode)) {
  32740. if (this.refSet.has(currentNode)) {
  32741. continue;
  32742. }
  32743. try {
  32744. var ref = currentNode;
  32745. this.refSet.put(ref);
  32746. currentNode = this.xref.fetch(currentNode);
  32747. } catch (e) {
  32748. if (!(e instanceof MissingDataException)) {
  32749. throw e;
  32750. }
  32751. nodesToRevisit.push(currentNode);
  32752. pendingRequests.push({
  32753. begin: e.begin,
  32754. end: e.end
  32755. });
  32756. }
  32757. }
  32758. if (currentNode && currentNode.getBaseStreams) {
  32759. var baseStreams = currentNode.getBaseStreams();
  32760. var foundMissingData = false;
  32761. for (var i = 0; i < baseStreams.length; i++) {
  32762. var stream = baseStreams[i];
  32763. if (stream.getMissingChunks && stream.getMissingChunks().length) {
  32764. foundMissingData = true;
  32765. pendingRequests.push({
  32766. begin: stream.start,
  32767. end: stream.end
  32768. });
  32769. }
  32770. }
  32771. if (foundMissingData) {
  32772. nodesToRevisit.push(currentNode);
  32773. }
  32774. }
  32775. addChildren(currentNode, nodesToVisit);
  32776. }
  32777. if (pendingRequests.length) {
  32778. this.xref.stream.manager.requestRanges(pendingRequests).then(function pendingRequestCallback() {
  32779. nodesToVisit = nodesToRevisit;
  32780. for (var i = 0; i < nodesToRevisit.length; i++) {
  32781. var node = nodesToRevisit[i];
  32782. if (isRef(node)) {
  32783. this.refSet.remove(node);
  32784. }
  32785. }
  32786. this._walk(nodesToVisit);
  32787. }.bind(this), this.capability.reject);
  32788. return;
  32789. }
  32790. this.refSet = null;
  32791. this.capability.resolve();
  32792. }
  32793. };
  32794. return ObjectLoader;
  32795. }();
  32796. exports.Catalog = Catalog;
  32797. exports.ObjectLoader = ObjectLoader;
  32798. exports.XRef = XRef;
  32799. exports.FileSpec = FileSpec;
  32800. /***/ }),
  32801. /* 16 */
  32802. /***/ (function(module, exports, __w_pdfjs_require__) {
  32803. "use strict";
  32804. var sharedUtil = __w_pdfjs_require__(0);
  32805. var getLookupTableFactory = sharedUtil.getLookupTableFactory;
  32806. var getStdFontMap = getLookupTableFactory(function (t) {
  32807. t['ArialNarrow'] = 'Helvetica';
  32808. t['ArialNarrow-Bold'] = 'Helvetica-Bold';
  32809. t['ArialNarrow-BoldItalic'] = 'Helvetica-BoldOblique';
  32810. t['ArialNarrow-Italic'] = 'Helvetica-Oblique';
  32811. t['ArialBlack'] = 'Helvetica';
  32812. t['ArialBlack-Bold'] = 'Helvetica-Bold';
  32813. t['ArialBlack-BoldItalic'] = 'Helvetica-BoldOblique';
  32814. t['ArialBlack-Italic'] = 'Helvetica-Oblique';
  32815. t['Arial-Black'] = 'Helvetica';
  32816. t['Arial-Black-Bold'] = 'Helvetica-Bold';
  32817. t['Arial-Black-BoldItalic'] = 'Helvetica-BoldOblique';
  32818. t['Arial-Black-Italic'] = 'Helvetica-Oblique';
  32819. t['Arial'] = 'Helvetica';
  32820. t['Arial-Bold'] = 'Helvetica-Bold';
  32821. t['Arial-BoldItalic'] = 'Helvetica-BoldOblique';
  32822. t['Arial-Italic'] = 'Helvetica-Oblique';
  32823. t['Arial-BoldItalicMT'] = 'Helvetica-BoldOblique';
  32824. t['Arial-BoldMT'] = 'Helvetica-Bold';
  32825. t['Arial-ItalicMT'] = 'Helvetica-Oblique';
  32826. t['ArialMT'] = 'Helvetica';
  32827. t['Courier-Bold'] = 'Courier-Bold';
  32828. t['Courier-BoldItalic'] = 'Courier-BoldOblique';
  32829. t['Courier-Italic'] = 'Courier-Oblique';
  32830. t['CourierNew'] = 'Courier';
  32831. t['CourierNew-Bold'] = 'Courier-Bold';
  32832. t['CourierNew-BoldItalic'] = 'Courier-BoldOblique';
  32833. t['CourierNew-Italic'] = 'Courier-Oblique';
  32834. t['CourierNewPS-BoldItalicMT'] = 'Courier-BoldOblique';
  32835. t['CourierNewPS-BoldMT'] = 'Courier-Bold';
  32836. t['CourierNewPS-ItalicMT'] = 'Courier-Oblique';
  32837. t['CourierNewPSMT'] = 'Courier';
  32838. t['Helvetica'] = 'Helvetica';
  32839. t['Helvetica-Bold'] = 'Helvetica-Bold';
  32840. t['Helvetica-BoldItalic'] = 'Helvetica-BoldOblique';
  32841. t['Helvetica-BoldOblique'] = 'Helvetica-BoldOblique';
  32842. t['Helvetica-Italic'] = 'Helvetica-Oblique';
  32843. t['Helvetica-Oblique'] = 'Helvetica-Oblique';
  32844. t['Symbol-Bold'] = 'Symbol';
  32845. t['Symbol-BoldItalic'] = 'Symbol';
  32846. t['Symbol-Italic'] = 'Symbol';
  32847. t['TimesNewRoman'] = 'Times-Roman';
  32848. t['TimesNewRoman-Bold'] = 'Times-Bold';
  32849. t['TimesNewRoman-BoldItalic'] = 'Times-BoldItalic';
  32850. t['TimesNewRoman-Italic'] = 'Times-Italic';
  32851. t['TimesNewRomanPS'] = 'Times-Roman';
  32852. t['TimesNewRomanPS-Bold'] = 'Times-Bold';
  32853. t['TimesNewRomanPS-BoldItalic'] = 'Times-BoldItalic';
  32854. t['TimesNewRomanPS-BoldItalicMT'] = 'Times-BoldItalic';
  32855. t['TimesNewRomanPS-BoldMT'] = 'Times-Bold';
  32856. t['TimesNewRomanPS-Italic'] = 'Times-Italic';
  32857. t['TimesNewRomanPS-ItalicMT'] = 'Times-Italic';
  32858. t['TimesNewRomanPSMT'] = 'Times-Roman';
  32859. t['TimesNewRomanPSMT-Bold'] = 'Times-Bold';
  32860. t['TimesNewRomanPSMT-BoldItalic'] = 'Times-BoldItalic';
  32861. t['TimesNewRomanPSMT-Italic'] = 'Times-Italic';
  32862. });
  32863. var getNonStdFontMap = getLookupTableFactory(function (t) {
  32864. t['CenturyGothic'] = 'Helvetica';
  32865. t['CenturyGothic-Bold'] = 'Helvetica-Bold';
  32866. t['CenturyGothic-BoldItalic'] = 'Helvetica-BoldOblique';
  32867. t['CenturyGothic-Italic'] = 'Helvetica-Oblique';
  32868. t['ComicSansMS'] = 'Comic Sans MS';
  32869. t['ComicSansMS-Bold'] = 'Comic Sans MS-Bold';
  32870. t['ComicSansMS-BoldItalic'] = 'Comic Sans MS-BoldItalic';
  32871. t['ComicSansMS-Italic'] = 'Comic Sans MS-Italic';
  32872. t['LucidaConsole'] = 'Courier';
  32873. t['LucidaConsole-Bold'] = 'Courier-Bold';
  32874. t['LucidaConsole-BoldItalic'] = 'Courier-BoldOblique';
  32875. t['LucidaConsole-Italic'] = 'Courier-Oblique';
  32876. t['MS-Gothic'] = 'MS Gothic';
  32877. t['MS-Gothic-Bold'] = 'MS Gothic-Bold';
  32878. t['MS-Gothic-BoldItalic'] = 'MS Gothic-BoldItalic';
  32879. t['MS-Gothic-Italic'] = 'MS Gothic-Italic';
  32880. t['MS-Mincho'] = 'MS Mincho';
  32881. t['MS-Mincho-Bold'] = 'MS Mincho-Bold';
  32882. t['MS-Mincho-BoldItalic'] = 'MS Mincho-BoldItalic';
  32883. t['MS-Mincho-Italic'] = 'MS Mincho-Italic';
  32884. t['MS-PGothic'] = 'MS PGothic';
  32885. t['MS-PGothic-Bold'] = 'MS PGothic-Bold';
  32886. t['MS-PGothic-BoldItalic'] = 'MS PGothic-BoldItalic';
  32887. t['MS-PGothic-Italic'] = 'MS PGothic-Italic';
  32888. t['MS-PMincho'] = 'MS PMincho';
  32889. t['MS-PMincho-Bold'] = 'MS PMincho-Bold';
  32890. t['MS-PMincho-BoldItalic'] = 'MS PMincho-BoldItalic';
  32891. t['MS-PMincho-Italic'] = 'MS PMincho-Italic';
  32892. t['NuptialScript'] = 'Times-Italic';
  32893. t['Wingdings'] = 'ZapfDingbats';
  32894. });
  32895. var getSerifFonts = getLookupTableFactory(function (t) {
  32896. t['Adobe Jenson'] = true;
  32897. t['Adobe Text'] = true;
  32898. t['Albertus'] = true;
  32899. t['Aldus'] = true;
  32900. t['Alexandria'] = true;
  32901. t['Algerian'] = true;
  32902. t['American Typewriter'] = true;
  32903. t['Antiqua'] = true;
  32904. t['Apex'] = true;
  32905. t['Arno'] = true;
  32906. t['Aster'] = true;
  32907. t['Aurora'] = true;
  32908. t['Baskerville'] = true;
  32909. t['Bell'] = true;
  32910. t['Bembo'] = true;
  32911. t['Bembo Schoolbook'] = true;
  32912. t['Benguiat'] = true;
  32913. t['Berkeley Old Style'] = true;
  32914. t['Bernhard Modern'] = true;
  32915. t['Berthold City'] = true;
  32916. t['Bodoni'] = true;
  32917. t['Bauer Bodoni'] = true;
  32918. t['Book Antiqua'] = true;
  32919. t['Bookman'] = true;
  32920. t['Bordeaux Roman'] = true;
  32921. t['Californian FB'] = true;
  32922. t['Calisto'] = true;
  32923. t['Calvert'] = true;
  32924. t['Capitals'] = true;
  32925. t['Cambria'] = true;
  32926. t['Cartier'] = true;
  32927. t['Caslon'] = true;
  32928. t['Catull'] = true;
  32929. t['Centaur'] = true;
  32930. t['Century Old Style'] = true;
  32931. t['Century Schoolbook'] = true;
  32932. t['Chaparral'] = true;
  32933. t['Charis SIL'] = true;
  32934. t['Cheltenham'] = true;
  32935. t['Cholla Slab'] = true;
  32936. t['Clarendon'] = true;
  32937. t['Clearface'] = true;
  32938. t['Cochin'] = true;
  32939. t['Colonna'] = true;
  32940. t['Computer Modern'] = true;
  32941. t['Concrete Roman'] = true;
  32942. t['Constantia'] = true;
  32943. t['Cooper Black'] = true;
  32944. t['Corona'] = true;
  32945. t['Ecotype'] = true;
  32946. t['Egyptienne'] = true;
  32947. t['Elephant'] = true;
  32948. t['Excelsior'] = true;
  32949. t['Fairfield'] = true;
  32950. t['FF Scala'] = true;
  32951. t['Folkard'] = true;
  32952. t['Footlight'] = true;
  32953. t['FreeSerif'] = true;
  32954. t['Friz Quadrata'] = true;
  32955. t['Garamond'] = true;
  32956. t['Gentium'] = true;
  32957. t['Georgia'] = true;
  32958. t['Gloucester'] = true;
  32959. t['Goudy Old Style'] = true;
  32960. t['Goudy Schoolbook'] = true;
  32961. t['Goudy Pro Font'] = true;
  32962. t['Granjon'] = true;
  32963. t['Guardian Egyptian'] = true;
  32964. t['Heather'] = true;
  32965. t['Hercules'] = true;
  32966. t['High Tower Text'] = true;
  32967. t['Hiroshige'] = true;
  32968. t['Hoefler Text'] = true;
  32969. t['Humana Serif'] = true;
  32970. t['Imprint'] = true;
  32971. t['Ionic No. 5'] = true;
  32972. t['Janson'] = true;
  32973. t['Joanna'] = true;
  32974. t['Korinna'] = true;
  32975. t['Lexicon'] = true;
  32976. t['Liberation Serif'] = true;
  32977. t['Linux Libertine'] = true;
  32978. t['Literaturnaya'] = true;
  32979. t['Lucida'] = true;
  32980. t['Lucida Bright'] = true;
  32981. t['Melior'] = true;
  32982. t['Memphis'] = true;
  32983. t['Miller'] = true;
  32984. t['Minion'] = true;
  32985. t['Modern'] = true;
  32986. t['Mona Lisa'] = true;
  32987. t['Mrs Eaves'] = true;
  32988. t['MS Serif'] = true;
  32989. t['Museo Slab'] = true;
  32990. t['New York'] = true;
  32991. t['Nimbus Roman'] = true;
  32992. t['NPS Rawlinson Roadway'] = true;
  32993. t['NuptialScript'] = true;
  32994. t['Palatino'] = true;
  32995. t['Perpetua'] = true;
  32996. t['Plantin'] = true;
  32997. t['Plantin Schoolbook'] = true;
  32998. t['Playbill'] = true;
  32999. t['Poor Richard'] = true;
  33000. t['Rawlinson Roadway'] = true;
  33001. t['Renault'] = true;
  33002. t['Requiem'] = true;
  33003. t['Rockwell'] = true;
  33004. t['Roman'] = true;
  33005. t['Rotis Serif'] = true;
  33006. t['Sabon'] = true;
  33007. t['Scala'] = true;
  33008. t['Seagull'] = true;
  33009. t['Sistina'] = true;
  33010. t['Souvenir'] = true;
  33011. t['STIX'] = true;
  33012. t['Stone Informal'] = true;
  33013. t['Stone Serif'] = true;
  33014. t['Sylfaen'] = true;
  33015. t['Times'] = true;
  33016. t['Trajan'] = true;
  33017. t['Trinité'] = true;
  33018. t['Trump Mediaeval'] = true;
  33019. t['Utopia'] = true;
  33020. t['Vale Type'] = true;
  33021. t['Bitstream Vera'] = true;
  33022. t['Vera Serif'] = true;
  33023. t['Versailles'] = true;
  33024. t['Wanted'] = true;
  33025. t['Weiss'] = true;
  33026. t['Wide Latin'] = true;
  33027. t['Windsor'] = true;
  33028. t['XITS'] = true;
  33029. });
  33030. var getSymbolsFonts = getLookupTableFactory(function (t) {
  33031. t['Dingbats'] = true;
  33032. t['Symbol'] = true;
  33033. t['ZapfDingbats'] = true;
  33034. });
  33035. var getGlyphMapForStandardFonts = getLookupTableFactory(function (t) {
  33036. t[2] = 10;
  33037. t[3] = 32;
  33038. t[4] = 33;
  33039. t[5] = 34;
  33040. t[6] = 35;
  33041. t[7] = 36;
  33042. t[8] = 37;
  33043. t[9] = 38;
  33044. t[10] = 39;
  33045. t[11] = 40;
  33046. t[12] = 41;
  33047. t[13] = 42;
  33048. t[14] = 43;
  33049. t[15] = 44;
  33050. t[16] = 45;
  33051. t[17] = 46;
  33052. t[18] = 47;
  33053. t[19] = 48;
  33054. t[20] = 49;
  33055. t[21] = 50;
  33056. t[22] = 51;
  33057. t[23] = 52;
  33058. t[24] = 53;
  33059. t[25] = 54;
  33060. t[26] = 55;
  33061. t[27] = 56;
  33062. t[28] = 57;
  33063. t[29] = 58;
  33064. t[30] = 894;
  33065. t[31] = 60;
  33066. t[32] = 61;
  33067. t[33] = 62;
  33068. t[34] = 63;
  33069. t[35] = 64;
  33070. t[36] = 65;
  33071. t[37] = 66;
  33072. t[38] = 67;
  33073. t[39] = 68;
  33074. t[40] = 69;
  33075. t[41] = 70;
  33076. t[42] = 71;
  33077. t[43] = 72;
  33078. t[44] = 73;
  33079. t[45] = 74;
  33080. t[46] = 75;
  33081. t[47] = 76;
  33082. t[48] = 77;
  33083. t[49] = 78;
  33084. t[50] = 79;
  33085. t[51] = 80;
  33086. t[52] = 81;
  33087. t[53] = 82;
  33088. t[54] = 83;
  33089. t[55] = 84;
  33090. t[56] = 85;
  33091. t[57] = 86;
  33092. t[58] = 87;
  33093. t[59] = 88;
  33094. t[60] = 89;
  33095. t[61] = 90;
  33096. t[62] = 91;
  33097. t[63] = 92;
  33098. t[64] = 93;
  33099. t[65] = 94;
  33100. t[66] = 95;
  33101. t[67] = 96;
  33102. t[68] = 97;
  33103. t[69] = 98;
  33104. t[70] = 99;
  33105. t[71] = 100;
  33106. t[72] = 101;
  33107. t[73] = 102;
  33108. t[74] = 103;
  33109. t[75] = 104;
  33110. t[76] = 105;
  33111. t[77] = 106;
  33112. t[78] = 107;
  33113. t[79] = 108;
  33114. t[80] = 109;
  33115. t[81] = 110;
  33116. t[82] = 111;
  33117. t[83] = 112;
  33118. t[84] = 113;
  33119. t[85] = 114;
  33120. t[86] = 115;
  33121. t[87] = 116;
  33122. t[88] = 117;
  33123. t[89] = 118;
  33124. t[90] = 119;
  33125. t[91] = 120;
  33126. t[92] = 121;
  33127. t[93] = 122;
  33128. t[94] = 123;
  33129. t[95] = 124;
  33130. t[96] = 125;
  33131. t[97] = 126;
  33132. t[98] = 196;
  33133. t[99] = 197;
  33134. t[100] = 199;
  33135. t[101] = 201;
  33136. t[102] = 209;
  33137. t[103] = 214;
  33138. t[104] = 220;
  33139. t[105] = 225;
  33140. t[106] = 224;
  33141. t[107] = 226;
  33142. t[108] = 228;
  33143. t[109] = 227;
  33144. t[110] = 229;
  33145. t[111] = 231;
  33146. t[112] = 233;
  33147. t[113] = 232;
  33148. t[114] = 234;
  33149. t[115] = 235;
  33150. t[116] = 237;
  33151. t[117] = 236;
  33152. t[118] = 238;
  33153. t[119] = 239;
  33154. t[120] = 241;
  33155. t[121] = 243;
  33156. t[122] = 242;
  33157. t[123] = 244;
  33158. t[124] = 246;
  33159. t[125] = 245;
  33160. t[126] = 250;
  33161. t[127] = 249;
  33162. t[128] = 251;
  33163. t[129] = 252;
  33164. t[130] = 8224;
  33165. t[131] = 176;
  33166. t[132] = 162;
  33167. t[133] = 163;
  33168. t[134] = 167;
  33169. t[135] = 8226;
  33170. t[136] = 182;
  33171. t[137] = 223;
  33172. t[138] = 174;
  33173. t[139] = 169;
  33174. t[140] = 8482;
  33175. t[141] = 180;
  33176. t[142] = 168;
  33177. t[143] = 8800;
  33178. t[144] = 198;
  33179. t[145] = 216;
  33180. t[146] = 8734;
  33181. t[147] = 177;
  33182. t[148] = 8804;
  33183. t[149] = 8805;
  33184. t[150] = 165;
  33185. t[151] = 181;
  33186. t[152] = 8706;
  33187. t[153] = 8721;
  33188. t[154] = 8719;
  33189. t[156] = 8747;
  33190. t[157] = 170;
  33191. t[158] = 186;
  33192. t[159] = 8486;
  33193. t[160] = 230;
  33194. t[161] = 248;
  33195. t[162] = 191;
  33196. t[163] = 161;
  33197. t[164] = 172;
  33198. t[165] = 8730;
  33199. t[166] = 402;
  33200. t[167] = 8776;
  33201. t[168] = 8710;
  33202. t[169] = 171;
  33203. t[170] = 187;
  33204. t[171] = 8230;
  33205. t[210] = 218;
  33206. t[223] = 711;
  33207. t[224] = 321;
  33208. t[225] = 322;
  33209. t[227] = 353;
  33210. t[229] = 382;
  33211. t[234] = 253;
  33212. t[252] = 263;
  33213. t[253] = 268;
  33214. t[254] = 269;
  33215. t[258] = 258;
  33216. t[260] = 260;
  33217. t[261] = 261;
  33218. t[265] = 280;
  33219. t[266] = 281;
  33220. t[268] = 283;
  33221. t[269] = 313;
  33222. t[275] = 323;
  33223. t[276] = 324;
  33224. t[278] = 328;
  33225. t[284] = 345;
  33226. t[285] = 346;
  33227. t[286] = 347;
  33228. t[292] = 367;
  33229. t[295] = 377;
  33230. t[296] = 378;
  33231. t[298] = 380;
  33232. t[305] = 963;
  33233. t[306] = 964;
  33234. t[307] = 966;
  33235. t[308] = 8215;
  33236. t[309] = 8252;
  33237. t[310] = 8319;
  33238. t[311] = 8359;
  33239. t[312] = 8592;
  33240. t[313] = 8593;
  33241. t[337] = 9552;
  33242. t[493] = 1039;
  33243. t[494] = 1040;
  33244. t[705] = 1524;
  33245. t[706] = 8362;
  33246. t[710] = 64288;
  33247. t[711] = 64298;
  33248. t[759] = 1617;
  33249. t[761] = 1776;
  33250. t[763] = 1778;
  33251. t[775] = 1652;
  33252. t[777] = 1764;
  33253. t[778] = 1780;
  33254. t[779] = 1781;
  33255. t[780] = 1782;
  33256. t[782] = 771;
  33257. t[783] = 64726;
  33258. t[786] = 8363;
  33259. t[788] = 8532;
  33260. t[790] = 768;
  33261. t[791] = 769;
  33262. t[792] = 768;
  33263. t[795] = 803;
  33264. t[797] = 64336;
  33265. t[798] = 64337;
  33266. t[799] = 64342;
  33267. t[800] = 64343;
  33268. t[801] = 64344;
  33269. t[802] = 64345;
  33270. t[803] = 64362;
  33271. t[804] = 64363;
  33272. t[805] = 64364;
  33273. t[2424] = 7821;
  33274. t[2425] = 7822;
  33275. t[2426] = 7823;
  33276. t[2427] = 7824;
  33277. t[2428] = 7825;
  33278. t[2429] = 7826;
  33279. t[2430] = 7827;
  33280. t[2433] = 7682;
  33281. t[2678] = 8045;
  33282. t[2679] = 8046;
  33283. t[2830] = 1552;
  33284. t[2838] = 686;
  33285. t[2840] = 751;
  33286. t[2842] = 753;
  33287. t[2843] = 754;
  33288. t[2844] = 755;
  33289. t[2846] = 757;
  33290. t[2856] = 767;
  33291. t[2857] = 848;
  33292. t[2858] = 849;
  33293. t[2862] = 853;
  33294. t[2863] = 854;
  33295. t[2864] = 855;
  33296. t[2865] = 861;
  33297. t[2866] = 862;
  33298. t[2906] = 7460;
  33299. t[2908] = 7462;
  33300. t[2909] = 7463;
  33301. t[2910] = 7464;
  33302. t[2912] = 7466;
  33303. t[2913] = 7467;
  33304. t[2914] = 7468;
  33305. t[2916] = 7470;
  33306. t[2917] = 7471;
  33307. t[2918] = 7472;
  33308. t[2920] = 7474;
  33309. t[2921] = 7475;
  33310. t[2922] = 7476;
  33311. t[2924] = 7478;
  33312. t[2925] = 7479;
  33313. t[2926] = 7480;
  33314. t[2928] = 7482;
  33315. t[2929] = 7483;
  33316. t[2930] = 7484;
  33317. t[2932] = 7486;
  33318. t[2933] = 7487;
  33319. t[2934] = 7488;
  33320. t[2936] = 7490;
  33321. t[2937] = 7491;
  33322. t[2938] = 7492;
  33323. t[2940] = 7494;
  33324. t[2941] = 7495;
  33325. t[2942] = 7496;
  33326. t[2944] = 7498;
  33327. t[2946] = 7500;
  33328. t[2948] = 7502;
  33329. t[2950] = 7504;
  33330. t[2951] = 7505;
  33331. t[2952] = 7506;
  33332. t[2954] = 7508;
  33333. t[2955] = 7509;
  33334. t[2956] = 7510;
  33335. t[2958] = 7512;
  33336. t[2959] = 7513;
  33337. t[2960] = 7514;
  33338. t[2962] = 7516;
  33339. t[2963] = 7517;
  33340. t[2964] = 7518;
  33341. t[2966] = 7520;
  33342. t[2967] = 7521;
  33343. t[2968] = 7522;
  33344. t[2970] = 7524;
  33345. t[2971] = 7525;
  33346. t[2972] = 7526;
  33347. t[2974] = 7528;
  33348. t[2975] = 7529;
  33349. t[2976] = 7530;
  33350. t[2978] = 1537;
  33351. t[2979] = 1538;
  33352. t[2980] = 1539;
  33353. t[2982] = 1549;
  33354. t[2983] = 1551;
  33355. t[2984] = 1552;
  33356. t[2986] = 1554;
  33357. t[2987] = 1555;
  33358. t[2988] = 1556;
  33359. t[2990] = 1623;
  33360. t[2991] = 1624;
  33361. t[2995] = 1775;
  33362. t[2999] = 1791;
  33363. t[3002] = 64290;
  33364. t[3003] = 64291;
  33365. t[3004] = 64292;
  33366. t[3006] = 64294;
  33367. t[3007] = 64295;
  33368. t[3008] = 64296;
  33369. t[3011] = 1900;
  33370. t[3014] = 8223;
  33371. t[3015] = 8244;
  33372. t[3017] = 7532;
  33373. t[3018] = 7533;
  33374. t[3019] = 7534;
  33375. t[3075] = 7590;
  33376. t[3076] = 7591;
  33377. t[3079] = 7594;
  33378. t[3080] = 7595;
  33379. t[3083] = 7598;
  33380. t[3084] = 7599;
  33381. t[3087] = 7602;
  33382. t[3088] = 7603;
  33383. t[3091] = 7606;
  33384. t[3092] = 7607;
  33385. t[3095] = 7610;
  33386. t[3096] = 7611;
  33387. t[3099] = 7614;
  33388. t[3100] = 7615;
  33389. t[3103] = 7618;
  33390. t[3104] = 7619;
  33391. t[3107] = 8337;
  33392. t[3108] = 8338;
  33393. t[3116] = 1884;
  33394. t[3119] = 1885;
  33395. t[3120] = 1885;
  33396. t[3123] = 1886;
  33397. t[3124] = 1886;
  33398. t[3127] = 1887;
  33399. t[3128] = 1887;
  33400. t[3131] = 1888;
  33401. t[3132] = 1888;
  33402. t[3135] = 1889;
  33403. t[3136] = 1889;
  33404. t[3139] = 1890;
  33405. t[3140] = 1890;
  33406. t[3143] = 1891;
  33407. t[3144] = 1891;
  33408. t[3147] = 1892;
  33409. t[3148] = 1892;
  33410. t[3153] = 580;
  33411. t[3154] = 581;
  33412. t[3157] = 584;
  33413. t[3158] = 585;
  33414. t[3161] = 588;
  33415. t[3162] = 589;
  33416. t[3165] = 891;
  33417. t[3166] = 892;
  33418. t[3169] = 1274;
  33419. t[3170] = 1275;
  33420. t[3173] = 1278;
  33421. t[3174] = 1279;
  33422. t[3181] = 7622;
  33423. t[3182] = 7623;
  33424. t[3282] = 11799;
  33425. t[3316] = 578;
  33426. t[3379] = 42785;
  33427. t[3393] = 1159;
  33428. t[3416] = 8377;
  33429. });
  33430. var getSupplementalGlyphMapForArialBlack = getLookupTableFactory(function (t) {
  33431. t[227] = 322;
  33432. t[264] = 261;
  33433. t[291] = 346;
  33434. });
  33435. exports.getStdFontMap = getStdFontMap;
  33436. exports.getNonStdFontMap = getNonStdFontMap;
  33437. exports.getSerifFonts = getSerifFonts;
  33438. exports.getSymbolsFonts = getSymbolsFonts;
  33439. exports.getGlyphMapForStandardFonts = getGlyphMapForStandardFonts;
  33440. exports.getSupplementalGlyphMapForArialBlack = getSupplementalGlyphMapForArialBlack;
  33441. /***/ }),
  33442. /* 17 */
  33443. /***/ (function(module, exports, __w_pdfjs_require__) {
  33444. "use strict";
  33445. var sharedUtil = __w_pdfjs_require__(0);
  33446. var getLookupTableFactory = sharedUtil.getLookupTableFactory;
  33447. var getSpecialPUASymbols = getLookupTableFactory(function (t) {
  33448. t[63721] = 0x00A9;
  33449. t[63193] = 0x00A9;
  33450. t[63720] = 0x00AE;
  33451. t[63194] = 0x00AE;
  33452. t[63722] = 0x2122;
  33453. t[63195] = 0x2122;
  33454. t[63729] = 0x23A7;
  33455. t[63730] = 0x23A8;
  33456. t[63731] = 0x23A9;
  33457. t[63740] = 0x23AB;
  33458. t[63741] = 0x23AC;
  33459. t[63742] = 0x23AD;
  33460. t[63726] = 0x23A1;
  33461. t[63727] = 0x23A2;
  33462. t[63728] = 0x23A3;
  33463. t[63737] = 0x23A4;
  33464. t[63738] = 0x23A5;
  33465. t[63739] = 0x23A6;
  33466. t[63723] = 0x239B;
  33467. t[63724] = 0x239C;
  33468. t[63725] = 0x239D;
  33469. t[63734] = 0x239E;
  33470. t[63735] = 0x239F;
  33471. t[63736] = 0x23A0;
  33472. });
  33473. function mapSpecialUnicodeValues(code) {
  33474. if (code >= 0xFFF0 && code <= 0xFFFF) {
  33475. return 0;
  33476. } else if (code >= 0xF600 && code <= 0xF8FF) {
  33477. return getSpecialPUASymbols()[code] || code;
  33478. }
  33479. return code;
  33480. }
  33481. function getUnicodeForGlyph(name, glyphsUnicodeMap) {
  33482. var unicode = glyphsUnicodeMap[name];
  33483. if (unicode !== undefined) {
  33484. return unicode;
  33485. }
  33486. if (!name) {
  33487. return -1;
  33488. }
  33489. if (name[0] === 'u') {
  33490. var nameLen = name.length, hexStr;
  33491. if (nameLen === 7 && name[1] === 'n' && name[2] === 'i') {
  33492. hexStr = name.substr(3);
  33493. } else if (nameLen >= 5 && nameLen <= 7) {
  33494. hexStr = name.substr(1);
  33495. } else {
  33496. return -1;
  33497. }
  33498. if (hexStr === hexStr.toUpperCase()) {
  33499. unicode = parseInt(hexStr, 16);
  33500. if (unicode >= 0) {
  33501. return unicode;
  33502. }
  33503. }
  33504. }
  33505. return -1;
  33506. }
  33507. var UnicodeRanges = [
  33508. {
  33509. 'begin': 0x0000,
  33510. 'end': 0x007F
  33511. },
  33512. {
  33513. 'begin': 0x0080,
  33514. 'end': 0x00FF
  33515. },
  33516. {
  33517. 'begin': 0x0100,
  33518. 'end': 0x017F
  33519. },
  33520. {
  33521. 'begin': 0x0180,
  33522. 'end': 0x024F
  33523. },
  33524. {
  33525. 'begin': 0x0250,
  33526. 'end': 0x02AF
  33527. },
  33528. {
  33529. 'begin': 0x02B0,
  33530. 'end': 0x02FF
  33531. },
  33532. {
  33533. 'begin': 0x0300,
  33534. 'end': 0x036F
  33535. },
  33536. {
  33537. 'begin': 0x0370,
  33538. 'end': 0x03FF
  33539. },
  33540. {
  33541. 'begin': 0x2C80,
  33542. 'end': 0x2CFF
  33543. },
  33544. {
  33545. 'begin': 0x0400,
  33546. 'end': 0x04FF
  33547. },
  33548. {
  33549. 'begin': 0x0530,
  33550. 'end': 0x058F
  33551. },
  33552. {
  33553. 'begin': 0x0590,
  33554. 'end': 0x05FF
  33555. },
  33556. {
  33557. 'begin': 0xA500,
  33558. 'end': 0xA63F
  33559. },
  33560. {
  33561. 'begin': 0x0600,
  33562. 'end': 0x06FF
  33563. },
  33564. {
  33565. 'begin': 0x07C0,
  33566. 'end': 0x07FF
  33567. },
  33568. {
  33569. 'begin': 0x0900,
  33570. 'end': 0x097F
  33571. },
  33572. {
  33573. 'begin': 0x0980,
  33574. 'end': 0x09FF
  33575. },
  33576. {
  33577. 'begin': 0x0A00,
  33578. 'end': 0x0A7F
  33579. },
  33580. {
  33581. 'begin': 0x0A80,
  33582. 'end': 0x0AFF
  33583. },
  33584. {
  33585. 'begin': 0x0B00,
  33586. 'end': 0x0B7F
  33587. },
  33588. {
  33589. 'begin': 0x0B80,
  33590. 'end': 0x0BFF
  33591. },
  33592. {
  33593. 'begin': 0x0C00,
  33594. 'end': 0x0C7F
  33595. },
  33596. {
  33597. 'begin': 0x0C80,
  33598. 'end': 0x0CFF
  33599. },
  33600. {
  33601. 'begin': 0x0D00,
  33602. 'end': 0x0D7F
  33603. },
  33604. {
  33605. 'begin': 0x0E00,
  33606. 'end': 0x0E7F
  33607. },
  33608. {
  33609. 'begin': 0x0E80,
  33610. 'end': 0x0EFF
  33611. },
  33612. {
  33613. 'begin': 0x10A0,
  33614. 'end': 0x10FF
  33615. },
  33616. {
  33617. 'begin': 0x1B00,
  33618. 'end': 0x1B7F
  33619. },
  33620. {
  33621. 'begin': 0x1100,
  33622. 'end': 0x11FF
  33623. },
  33624. {
  33625. 'begin': 0x1E00,
  33626. 'end': 0x1EFF
  33627. },
  33628. {
  33629. 'begin': 0x1F00,
  33630. 'end': 0x1FFF
  33631. },
  33632. {
  33633. 'begin': 0x2000,
  33634. 'end': 0x206F
  33635. },
  33636. {
  33637. 'begin': 0x2070,
  33638. 'end': 0x209F
  33639. },
  33640. {
  33641. 'begin': 0x20A0,
  33642. 'end': 0x20CF
  33643. },
  33644. {
  33645. 'begin': 0x20D0,
  33646. 'end': 0x20FF
  33647. },
  33648. {
  33649. 'begin': 0x2100,
  33650. 'end': 0x214F
  33651. },
  33652. {
  33653. 'begin': 0x2150,
  33654. 'end': 0x218F
  33655. },
  33656. {
  33657. 'begin': 0x2190,
  33658. 'end': 0x21FF
  33659. },
  33660. {
  33661. 'begin': 0x2200,
  33662. 'end': 0x22FF
  33663. },
  33664. {
  33665. 'begin': 0x2300,
  33666. 'end': 0x23FF
  33667. },
  33668. {
  33669. 'begin': 0x2400,
  33670. 'end': 0x243F
  33671. },
  33672. {
  33673. 'begin': 0x2440,
  33674. 'end': 0x245F
  33675. },
  33676. {
  33677. 'begin': 0x2460,
  33678. 'end': 0x24FF
  33679. },
  33680. {
  33681. 'begin': 0x2500,
  33682. 'end': 0x257F
  33683. },
  33684. {
  33685. 'begin': 0x2580,
  33686. 'end': 0x259F
  33687. },
  33688. {
  33689. 'begin': 0x25A0,
  33690. 'end': 0x25FF
  33691. },
  33692. {
  33693. 'begin': 0x2600,
  33694. 'end': 0x26FF
  33695. },
  33696. {
  33697. 'begin': 0x2700,
  33698. 'end': 0x27BF
  33699. },
  33700. {
  33701. 'begin': 0x3000,
  33702. 'end': 0x303F
  33703. },
  33704. {
  33705. 'begin': 0x3040,
  33706. 'end': 0x309F
  33707. },
  33708. {
  33709. 'begin': 0x30A0,
  33710. 'end': 0x30FF
  33711. },
  33712. {
  33713. 'begin': 0x3100,
  33714. 'end': 0x312F
  33715. },
  33716. {
  33717. 'begin': 0x3130,
  33718. 'end': 0x318F
  33719. },
  33720. {
  33721. 'begin': 0xA840,
  33722. 'end': 0xA87F
  33723. },
  33724. {
  33725. 'begin': 0x3200,
  33726. 'end': 0x32FF
  33727. },
  33728. {
  33729. 'begin': 0x3300,
  33730. 'end': 0x33FF
  33731. },
  33732. {
  33733. 'begin': 0xAC00,
  33734. 'end': 0xD7AF
  33735. },
  33736. {
  33737. 'begin': 0xD800,
  33738. 'end': 0xDFFF
  33739. },
  33740. {
  33741. 'begin': 0x10900,
  33742. 'end': 0x1091F
  33743. },
  33744. {
  33745. 'begin': 0x4E00,
  33746. 'end': 0x9FFF
  33747. },
  33748. {
  33749. 'begin': 0xE000,
  33750. 'end': 0xF8FF
  33751. },
  33752. {
  33753. 'begin': 0x31C0,
  33754. 'end': 0x31EF
  33755. },
  33756. {
  33757. 'begin': 0xFB00,
  33758. 'end': 0xFB4F
  33759. },
  33760. {
  33761. 'begin': 0xFB50,
  33762. 'end': 0xFDFF
  33763. },
  33764. {
  33765. 'begin': 0xFE20,
  33766. 'end': 0xFE2F
  33767. },
  33768. {
  33769. 'begin': 0xFE10,
  33770. 'end': 0xFE1F
  33771. },
  33772. {
  33773. 'begin': 0xFE50,
  33774. 'end': 0xFE6F
  33775. },
  33776. {
  33777. 'begin': 0xFE70,
  33778. 'end': 0xFEFF
  33779. },
  33780. {
  33781. 'begin': 0xFF00,
  33782. 'end': 0xFFEF
  33783. },
  33784. {
  33785. 'begin': 0xFFF0,
  33786. 'end': 0xFFFF
  33787. },
  33788. {
  33789. 'begin': 0x0F00,
  33790. 'end': 0x0FFF
  33791. },
  33792. {
  33793. 'begin': 0x0700,
  33794. 'end': 0x074F
  33795. },
  33796. {
  33797. 'begin': 0x0780,
  33798. 'end': 0x07BF
  33799. },
  33800. {
  33801. 'begin': 0x0D80,
  33802. 'end': 0x0DFF
  33803. },
  33804. {
  33805. 'begin': 0x1000,
  33806. 'end': 0x109F
  33807. },
  33808. {
  33809. 'begin': 0x1200,
  33810. 'end': 0x137F
  33811. },
  33812. {
  33813. 'begin': 0x13A0,
  33814. 'end': 0x13FF
  33815. },
  33816. {
  33817. 'begin': 0x1400,
  33818. 'end': 0x167F
  33819. },
  33820. {
  33821. 'begin': 0x1680,
  33822. 'end': 0x169F
  33823. },
  33824. {
  33825. 'begin': 0x16A0,
  33826. 'end': 0x16FF
  33827. },
  33828. {
  33829. 'begin': 0x1780,
  33830. 'end': 0x17FF
  33831. },
  33832. {
  33833. 'begin': 0x1800,
  33834. 'end': 0x18AF
  33835. },
  33836. {
  33837. 'begin': 0x2800,
  33838. 'end': 0x28FF
  33839. },
  33840. {
  33841. 'begin': 0xA000,
  33842. 'end': 0xA48F
  33843. },
  33844. {
  33845. 'begin': 0x1700,
  33846. 'end': 0x171F
  33847. },
  33848. {
  33849. 'begin': 0x10300,
  33850. 'end': 0x1032F
  33851. },
  33852. {
  33853. 'begin': 0x10330,
  33854. 'end': 0x1034F
  33855. },
  33856. {
  33857. 'begin': 0x10400,
  33858. 'end': 0x1044F
  33859. },
  33860. {
  33861. 'begin': 0x1D000,
  33862. 'end': 0x1D0FF
  33863. },
  33864. {
  33865. 'begin': 0x1D400,
  33866. 'end': 0x1D7FF
  33867. },
  33868. {
  33869. 'begin': 0xFF000,
  33870. 'end': 0xFFFFD
  33871. },
  33872. {
  33873. 'begin': 0xFE00,
  33874. 'end': 0xFE0F
  33875. },
  33876. {
  33877. 'begin': 0xE0000,
  33878. 'end': 0xE007F
  33879. },
  33880. {
  33881. 'begin': 0x1900,
  33882. 'end': 0x194F
  33883. },
  33884. {
  33885. 'begin': 0x1950,
  33886. 'end': 0x197F
  33887. },
  33888. {
  33889. 'begin': 0x1980,
  33890. 'end': 0x19DF
  33891. },
  33892. {
  33893. 'begin': 0x1A00,
  33894. 'end': 0x1A1F
  33895. },
  33896. {
  33897. 'begin': 0x2C00,
  33898. 'end': 0x2C5F
  33899. },
  33900. {
  33901. 'begin': 0x2D30,
  33902. 'end': 0x2D7F
  33903. },
  33904. {
  33905. 'begin': 0x4DC0,
  33906. 'end': 0x4DFF
  33907. },
  33908. {
  33909. 'begin': 0xA800,
  33910. 'end': 0xA82F
  33911. },
  33912. {
  33913. 'begin': 0x10000,
  33914. 'end': 0x1007F
  33915. },
  33916. {
  33917. 'begin': 0x10140,
  33918. 'end': 0x1018F
  33919. },
  33920. {
  33921. 'begin': 0x10380,
  33922. 'end': 0x1039F
  33923. },
  33924. {
  33925. 'begin': 0x103A0,
  33926. 'end': 0x103DF
  33927. },
  33928. {
  33929. 'begin': 0x10450,
  33930. 'end': 0x1047F
  33931. },
  33932. {
  33933. 'begin': 0x10480,
  33934. 'end': 0x104AF
  33935. },
  33936. {
  33937. 'begin': 0x10800,
  33938. 'end': 0x1083F
  33939. },
  33940. {
  33941. 'begin': 0x10A00,
  33942. 'end': 0x10A5F
  33943. },
  33944. {
  33945. 'begin': 0x1D300,
  33946. 'end': 0x1D35F
  33947. },
  33948. {
  33949. 'begin': 0x12000,
  33950. 'end': 0x123FF
  33951. },
  33952. {
  33953. 'begin': 0x1D360,
  33954. 'end': 0x1D37F
  33955. },
  33956. {
  33957. 'begin': 0x1B80,
  33958. 'end': 0x1BBF
  33959. },
  33960. {
  33961. 'begin': 0x1C00,
  33962. 'end': 0x1C4F
  33963. },
  33964. {
  33965. 'begin': 0x1C50,
  33966. 'end': 0x1C7F
  33967. },
  33968. {
  33969. 'begin': 0xA880,
  33970. 'end': 0xA8DF
  33971. },
  33972. {
  33973. 'begin': 0xA900,
  33974. 'end': 0xA92F
  33975. },
  33976. {
  33977. 'begin': 0xA930,
  33978. 'end': 0xA95F
  33979. },
  33980. {
  33981. 'begin': 0xAA00,
  33982. 'end': 0xAA5F
  33983. },
  33984. {
  33985. 'begin': 0x10190,
  33986. 'end': 0x101CF
  33987. },
  33988. {
  33989. 'begin': 0x101D0,
  33990. 'end': 0x101FF
  33991. },
  33992. {
  33993. 'begin': 0x102A0,
  33994. 'end': 0x102DF
  33995. },
  33996. {
  33997. 'begin': 0x1F030,
  33998. 'end': 0x1F09F
  33999. }
  34000. ];
  34001. function getUnicodeRangeFor(value) {
  34002. for (var i = 0, ii = UnicodeRanges.length; i < ii; i++) {
  34003. var range = UnicodeRanges[i];
  34004. if (value >= range.begin && value < range.end) {
  34005. return i;
  34006. }
  34007. }
  34008. return -1;
  34009. }
  34010. function isRTLRangeFor(value) {
  34011. var range = UnicodeRanges[13];
  34012. if (value >= range.begin && value < range.end) {
  34013. return true;
  34014. }
  34015. range = UnicodeRanges[11];
  34016. if (value >= range.begin && value < range.end) {
  34017. return true;
  34018. }
  34019. return false;
  34020. }
  34021. var getNormalizedUnicodes = getLookupTableFactory(function (t) {
  34022. t['\u00A8'] = '\u0020\u0308';
  34023. t['\u00AF'] = '\u0020\u0304';
  34024. t['\u00B4'] = '\u0020\u0301';
  34025. t['\u00B5'] = '\u03BC';
  34026. t['\u00B8'] = '\u0020\u0327';
  34027. t['\u0132'] = '\u0049\u004A';
  34028. t['\u0133'] = '\u0069\u006A';
  34029. t['\u013F'] = '\u004C\u00B7';
  34030. t['\u0140'] = '\u006C\u00B7';
  34031. t['\u0149'] = '\u02BC\u006E';
  34032. t['\u017F'] = '\u0073';
  34033. t['\u01C4'] = '\u0044\u017D';
  34034. t['\u01C5'] = '\u0044\u017E';
  34035. t['\u01C6'] = '\u0064\u017E';
  34036. t['\u01C7'] = '\u004C\u004A';
  34037. t['\u01C8'] = '\u004C\u006A';
  34038. t['\u01C9'] = '\u006C\u006A';
  34039. t['\u01CA'] = '\u004E\u004A';
  34040. t['\u01CB'] = '\u004E\u006A';
  34041. t['\u01CC'] = '\u006E\u006A';
  34042. t['\u01F1'] = '\u0044\u005A';
  34043. t['\u01F2'] = '\u0044\u007A';
  34044. t['\u01F3'] = '\u0064\u007A';
  34045. t['\u02D8'] = '\u0020\u0306';
  34046. t['\u02D9'] = '\u0020\u0307';
  34047. t['\u02DA'] = '\u0020\u030A';
  34048. t['\u02DB'] = '\u0020\u0328';
  34049. t['\u02DC'] = '\u0020\u0303';
  34050. t['\u02DD'] = '\u0020\u030B';
  34051. t['\u037A'] = '\u0020\u0345';
  34052. t['\u0384'] = '\u0020\u0301';
  34053. t['\u03D0'] = '\u03B2';
  34054. t['\u03D1'] = '\u03B8';
  34055. t['\u03D2'] = '\u03A5';
  34056. t['\u03D5'] = '\u03C6';
  34057. t['\u03D6'] = '\u03C0';
  34058. t['\u03F0'] = '\u03BA';
  34059. t['\u03F1'] = '\u03C1';
  34060. t['\u03F2'] = '\u03C2';
  34061. t['\u03F4'] = '\u0398';
  34062. t['\u03F5'] = '\u03B5';
  34063. t['\u03F9'] = '\u03A3';
  34064. t['\u0587'] = '\u0565\u0582';
  34065. t['\u0675'] = '\u0627\u0674';
  34066. t['\u0676'] = '\u0648\u0674';
  34067. t['\u0677'] = '\u06C7\u0674';
  34068. t['\u0678'] = '\u064A\u0674';
  34069. t['\u0E33'] = '\u0E4D\u0E32';
  34070. t['\u0EB3'] = '\u0ECD\u0EB2';
  34071. t['\u0EDC'] = '\u0EAB\u0E99';
  34072. t['\u0EDD'] = '\u0EAB\u0EA1';
  34073. t['\u0F77'] = '\u0FB2\u0F81';
  34074. t['\u0F79'] = '\u0FB3\u0F81';
  34075. t['\u1E9A'] = '\u0061\u02BE';
  34076. t['\u1FBD'] = '\u0020\u0313';
  34077. t['\u1FBF'] = '\u0020\u0313';
  34078. t['\u1FC0'] = '\u0020\u0342';
  34079. t['\u1FFE'] = '\u0020\u0314';
  34080. t['\u2002'] = '\u0020';
  34081. t['\u2003'] = '\u0020';
  34082. t['\u2004'] = '\u0020';
  34083. t['\u2005'] = '\u0020';
  34084. t['\u2006'] = '\u0020';
  34085. t['\u2008'] = '\u0020';
  34086. t['\u2009'] = '\u0020';
  34087. t['\u200A'] = '\u0020';
  34088. t['\u2017'] = '\u0020\u0333';
  34089. t['\u2024'] = '\u002E';
  34090. t['\u2025'] = '\u002E\u002E';
  34091. t['\u2026'] = '\u002E\u002E\u002E';
  34092. t['\u2033'] = '\u2032\u2032';
  34093. t['\u2034'] = '\u2032\u2032\u2032';
  34094. t['\u2036'] = '\u2035\u2035';
  34095. t['\u2037'] = '\u2035\u2035\u2035';
  34096. t['\u203C'] = '\u0021\u0021';
  34097. t['\u203E'] = '\u0020\u0305';
  34098. t['\u2047'] = '\u003F\u003F';
  34099. t['\u2048'] = '\u003F\u0021';
  34100. t['\u2049'] = '\u0021\u003F';
  34101. t['\u2057'] = '\u2032\u2032\u2032\u2032';
  34102. t['\u205F'] = '\u0020';
  34103. t['\u20A8'] = '\u0052\u0073';
  34104. t['\u2100'] = '\u0061\u002F\u0063';
  34105. t['\u2101'] = '\u0061\u002F\u0073';
  34106. t['\u2103'] = '\u00B0\u0043';
  34107. t['\u2105'] = '\u0063\u002F\u006F';
  34108. t['\u2106'] = '\u0063\u002F\u0075';
  34109. t['\u2107'] = '\u0190';
  34110. t['\u2109'] = '\u00B0\u0046';
  34111. t['\u2116'] = '\u004E\u006F';
  34112. t['\u2121'] = '\u0054\u0045\u004C';
  34113. t['\u2135'] = '\u05D0';
  34114. t['\u2136'] = '\u05D1';
  34115. t['\u2137'] = '\u05D2';
  34116. t['\u2138'] = '\u05D3';
  34117. t['\u213B'] = '\u0046\u0041\u0058';
  34118. t['\u2160'] = '\u0049';
  34119. t['\u2161'] = '\u0049\u0049';
  34120. t['\u2162'] = '\u0049\u0049\u0049';
  34121. t['\u2163'] = '\u0049\u0056';
  34122. t['\u2164'] = '\u0056';
  34123. t['\u2165'] = '\u0056\u0049';
  34124. t['\u2166'] = '\u0056\u0049\u0049';
  34125. t['\u2167'] = '\u0056\u0049\u0049\u0049';
  34126. t['\u2168'] = '\u0049\u0058';
  34127. t['\u2169'] = '\u0058';
  34128. t['\u216A'] = '\u0058\u0049';
  34129. t['\u216B'] = '\u0058\u0049\u0049';
  34130. t['\u216C'] = '\u004C';
  34131. t['\u216D'] = '\u0043';
  34132. t['\u216E'] = '\u0044';
  34133. t['\u216F'] = '\u004D';
  34134. t['\u2170'] = '\u0069';
  34135. t['\u2171'] = '\u0069\u0069';
  34136. t['\u2172'] = '\u0069\u0069\u0069';
  34137. t['\u2173'] = '\u0069\u0076';
  34138. t['\u2174'] = '\u0076';
  34139. t['\u2175'] = '\u0076\u0069';
  34140. t['\u2176'] = '\u0076\u0069\u0069';
  34141. t['\u2177'] = '\u0076\u0069\u0069\u0069';
  34142. t['\u2178'] = '\u0069\u0078';
  34143. t['\u2179'] = '\u0078';
  34144. t['\u217A'] = '\u0078\u0069';
  34145. t['\u217B'] = '\u0078\u0069\u0069';
  34146. t['\u217C'] = '\u006C';
  34147. t['\u217D'] = '\u0063';
  34148. t['\u217E'] = '\u0064';
  34149. t['\u217F'] = '\u006D';
  34150. t['\u222C'] = '\u222B\u222B';
  34151. t['\u222D'] = '\u222B\u222B\u222B';
  34152. t['\u222F'] = '\u222E\u222E';
  34153. t['\u2230'] = '\u222E\u222E\u222E';
  34154. t['\u2474'] = '\u0028\u0031\u0029';
  34155. t['\u2475'] = '\u0028\u0032\u0029';
  34156. t['\u2476'] = '\u0028\u0033\u0029';
  34157. t['\u2477'] = '\u0028\u0034\u0029';
  34158. t['\u2478'] = '\u0028\u0035\u0029';
  34159. t['\u2479'] = '\u0028\u0036\u0029';
  34160. t['\u247A'] = '\u0028\u0037\u0029';
  34161. t['\u247B'] = '\u0028\u0038\u0029';
  34162. t['\u247C'] = '\u0028\u0039\u0029';
  34163. t['\u247D'] = '\u0028\u0031\u0030\u0029';
  34164. t['\u247E'] = '\u0028\u0031\u0031\u0029';
  34165. t['\u247F'] = '\u0028\u0031\u0032\u0029';
  34166. t['\u2480'] = '\u0028\u0031\u0033\u0029';
  34167. t['\u2481'] = '\u0028\u0031\u0034\u0029';
  34168. t['\u2482'] = '\u0028\u0031\u0035\u0029';
  34169. t['\u2483'] = '\u0028\u0031\u0036\u0029';
  34170. t['\u2484'] = '\u0028\u0031\u0037\u0029';
  34171. t['\u2485'] = '\u0028\u0031\u0038\u0029';
  34172. t['\u2486'] = '\u0028\u0031\u0039\u0029';
  34173. t['\u2487'] = '\u0028\u0032\u0030\u0029';
  34174. t['\u2488'] = '\u0031\u002E';
  34175. t['\u2489'] = '\u0032\u002E';
  34176. t['\u248A'] = '\u0033\u002E';
  34177. t['\u248B'] = '\u0034\u002E';
  34178. t['\u248C'] = '\u0035\u002E';
  34179. t['\u248D'] = '\u0036\u002E';
  34180. t['\u248E'] = '\u0037\u002E';
  34181. t['\u248F'] = '\u0038\u002E';
  34182. t['\u2490'] = '\u0039\u002E';
  34183. t['\u2491'] = '\u0031\u0030\u002E';
  34184. t['\u2492'] = '\u0031\u0031\u002E';
  34185. t['\u2493'] = '\u0031\u0032\u002E';
  34186. t['\u2494'] = '\u0031\u0033\u002E';
  34187. t['\u2495'] = '\u0031\u0034\u002E';
  34188. t['\u2496'] = '\u0031\u0035\u002E';
  34189. t['\u2497'] = '\u0031\u0036\u002E';
  34190. t['\u2498'] = '\u0031\u0037\u002E';
  34191. t['\u2499'] = '\u0031\u0038\u002E';
  34192. t['\u249A'] = '\u0031\u0039\u002E';
  34193. t['\u249B'] = '\u0032\u0030\u002E';
  34194. t['\u249C'] = '\u0028\u0061\u0029';
  34195. t['\u249D'] = '\u0028\u0062\u0029';
  34196. t['\u249E'] = '\u0028\u0063\u0029';
  34197. t['\u249F'] = '\u0028\u0064\u0029';
  34198. t['\u24A0'] = '\u0028\u0065\u0029';
  34199. t['\u24A1'] = '\u0028\u0066\u0029';
  34200. t['\u24A2'] = '\u0028\u0067\u0029';
  34201. t['\u24A3'] = '\u0028\u0068\u0029';
  34202. t['\u24A4'] = '\u0028\u0069\u0029';
  34203. t['\u24A5'] = '\u0028\u006A\u0029';
  34204. t['\u24A6'] = '\u0028\u006B\u0029';
  34205. t['\u24A7'] = '\u0028\u006C\u0029';
  34206. t['\u24A8'] = '\u0028\u006D\u0029';
  34207. t['\u24A9'] = '\u0028\u006E\u0029';
  34208. t['\u24AA'] = '\u0028\u006F\u0029';
  34209. t['\u24AB'] = '\u0028\u0070\u0029';
  34210. t['\u24AC'] = '\u0028\u0071\u0029';
  34211. t['\u24AD'] = '\u0028\u0072\u0029';
  34212. t['\u24AE'] = '\u0028\u0073\u0029';
  34213. t['\u24AF'] = '\u0028\u0074\u0029';
  34214. t['\u24B0'] = '\u0028\u0075\u0029';
  34215. t['\u24B1'] = '\u0028\u0076\u0029';
  34216. t['\u24B2'] = '\u0028\u0077\u0029';
  34217. t['\u24B3'] = '\u0028\u0078\u0029';
  34218. t['\u24B4'] = '\u0028\u0079\u0029';
  34219. t['\u24B5'] = '\u0028\u007A\u0029';
  34220. t['\u2A0C'] = '\u222B\u222B\u222B\u222B';
  34221. t['\u2A74'] = '\u003A\u003A\u003D';
  34222. t['\u2A75'] = '\u003D\u003D';
  34223. t['\u2A76'] = '\u003D\u003D\u003D';
  34224. t['\u2E9F'] = '\u6BCD';
  34225. t['\u2EF3'] = '\u9F9F';
  34226. t['\u2F00'] = '\u4E00';
  34227. t['\u2F01'] = '\u4E28';
  34228. t['\u2F02'] = '\u4E36';
  34229. t['\u2F03'] = '\u4E3F';
  34230. t['\u2F04'] = '\u4E59';
  34231. t['\u2F05'] = '\u4E85';
  34232. t['\u2F06'] = '\u4E8C';
  34233. t['\u2F07'] = '\u4EA0';
  34234. t['\u2F08'] = '\u4EBA';
  34235. t['\u2F09'] = '\u513F';
  34236. t['\u2F0A'] = '\u5165';
  34237. t['\u2F0B'] = '\u516B';
  34238. t['\u2F0C'] = '\u5182';
  34239. t['\u2F0D'] = '\u5196';
  34240. t['\u2F0E'] = '\u51AB';
  34241. t['\u2F0F'] = '\u51E0';
  34242. t['\u2F10'] = '\u51F5';
  34243. t['\u2F11'] = '\u5200';
  34244. t['\u2F12'] = '\u529B';
  34245. t['\u2F13'] = '\u52F9';
  34246. t['\u2F14'] = '\u5315';
  34247. t['\u2F15'] = '\u531A';
  34248. t['\u2F16'] = '\u5338';
  34249. t['\u2F17'] = '\u5341';
  34250. t['\u2F18'] = '\u535C';
  34251. t['\u2F19'] = '\u5369';
  34252. t['\u2F1A'] = '\u5382';
  34253. t['\u2F1B'] = '\u53B6';
  34254. t['\u2F1C'] = '\u53C8';
  34255. t['\u2F1D'] = '\u53E3';
  34256. t['\u2F1E'] = '\u56D7';
  34257. t['\u2F1F'] = '\u571F';
  34258. t['\u2F20'] = '\u58EB';
  34259. t['\u2F21'] = '\u5902';
  34260. t['\u2F22'] = '\u590A';
  34261. t['\u2F23'] = '\u5915';
  34262. t['\u2F24'] = '\u5927';
  34263. t['\u2F25'] = '\u5973';
  34264. t['\u2F26'] = '\u5B50';
  34265. t['\u2F27'] = '\u5B80';
  34266. t['\u2F28'] = '\u5BF8';
  34267. t['\u2F29'] = '\u5C0F';
  34268. t['\u2F2A'] = '\u5C22';
  34269. t['\u2F2B'] = '\u5C38';
  34270. t['\u2F2C'] = '\u5C6E';
  34271. t['\u2F2D'] = '\u5C71';
  34272. t['\u2F2E'] = '\u5DDB';
  34273. t['\u2F2F'] = '\u5DE5';
  34274. t['\u2F30'] = '\u5DF1';
  34275. t['\u2F31'] = '\u5DFE';
  34276. t['\u2F32'] = '\u5E72';
  34277. t['\u2F33'] = '\u5E7A';
  34278. t['\u2F34'] = '\u5E7F';
  34279. t['\u2F35'] = '\u5EF4';
  34280. t['\u2F36'] = '\u5EFE';
  34281. t['\u2F37'] = '\u5F0B';
  34282. t['\u2F38'] = '\u5F13';
  34283. t['\u2F39'] = '\u5F50';
  34284. t['\u2F3A'] = '\u5F61';
  34285. t['\u2F3B'] = '\u5F73';
  34286. t['\u2F3C'] = '\u5FC3';
  34287. t['\u2F3D'] = '\u6208';
  34288. t['\u2F3E'] = '\u6236';
  34289. t['\u2F3F'] = '\u624B';
  34290. t['\u2F40'] = '\u652F';
  34291. t['\u2F41'] = '\u6534';
  34292. t['\u2F42'] = '\u6587';
  34293. t['\u2F43'] = '\u6597';
  34294. t['\u2F44'] = '\u65A4';
  34295. t['\u2F45'] = '\u65B9';
  34296. t['\u2F46'] = '\u65E0';
  34297. t['\u2F47'] = '\u65E5';
  34298. t['\u2F48'] = '\u66F0';
  34299. t['\u2F49'] = '\u6708';
  34300. t['\u2F4A'] = '\u6728';
  34301. t['\u2F4B'] = '\u6B20';
  34302. t['\u2F4C'] = '\u6B62';
  34303. t['\u2F4D'] = '\u6B79';
  34304. t['\u2F4E'] = '\u6BB3';
  34305. t['\u2F4F'] = '\u6BCB';
  34306. t['\u2F50'] = '\u6BD4';
  34307. t['\u2F51'] = '\u6BDB';
  34308. t['\u2F52'] = '\u6C0F';
  34309. t['\u2F53'] = '\u6C14';
  34310. t['\u2F54'] = '\u6C34';
  34311. t['\u2F55'] = '\u706B';
  34312. t['\u2F56'] = '\u722A';
  34313. t['\u2F57'] = '\u7236';
  34314. t['\u2F58'] = '\u723B';
  34315. t['\u2F59'] = '\u723F';
  34316. t['\u2F5A'] = '\u7247';
  34317. t['\u2F5B'] = '\u7259';
  34318. t['\u2F5C'] = '\u725B';
  34319. t['\u2F5D'] = '\u72AC';
  34320. t['\u2F5E'] = '\u7384';
  34321. t['\u2F5F'] = '\u7389';
  34322. t['\u2F60'] = '\u74DC';
  34323. t['\u2F61'] = '\u74E6';
  34324. t['\u2F62'] = '\u7518';
  34325. t['\u2F63'] = '\u751F';
  34326. t['\u2F64'] = '\u7528';
  34327. t['\u2F65'] = '\u7530';
  34328. t['\u2F66'] = '\u758B';
  34329. t['\u2F67'] = '\u7592';
  34330. t['\u2F68'] = '\u7676';
  34331. t['\u2F69'] = '\u767D';
  34332. t['\u2F6A'] = '\u76AE';
  34333. t['\u2F6B'] = '\u76BF';
  34334. t['\u2F6C'] = '\u76EE';
  34335. t['\u2F6D'] = '\u77DB';
  34336. t['\u2F6E'] = '\u77E2';
  34337. t['\u2F6F'] = '\u77F3';
  34338. t['\u2F70'] = '\u793A';
  34339. t['\u2F71'] = '\u79B8';
  34340. t['\u2F72'] = '\u79BE';
  34341. t['\u2F73'] = '\u7A74';
  34342. t['\u2F74'] = '\u7ACB';
  34343. t['\u2F75'] = '\u7AF9';
  34344. t['\u2F76'] = '\u7C73';
  34345. t['\u2F77'] = '\u7CF8';
  34346. t['\u2F78'] = '\u7F36';
  34347. t['\u2F79'] = '\u7F51';
  34348. t['\u2F7A'] = '\u7F8A';
  34349. t['\u2F7B'] = '\u7FBD';
  34350. t['\u2F7C'] = '\u8001';
  34351. t['\u2F7D'] = '\u800C';
  34352. t['\u2F7E'] = '\u8012';
  34353. t['\u2F7F'] = '\u8033';
  34354. t['\u2F80'] = '\u807F';
  34355. t['\u2F81'] = '\u8089';
  34356. t['\u2F82'] = '\u81E3';
  34357. t['\u2F83'] = '\u81EA';
  34358. t['\u2F84'] = '\u81F3';
  34359. t['\u2F85'] = '\u81FC';
  34360. t['\u2F86'] = '\u820C';
  34361. t['\u2F87'] = '\u821B';
  34362. t['\u2F88'] = '\u821F';
  34363. t['\u2F89'] = '\u826E';
  34364. t['\u2F8A'] = '\u8272';
  34365. t['\u2F8B'] = '\u8278';
  34366. t['\u2F8C'] = '\u864D';
  34367. t['\u2F8D'] = '\u866B';
  34368. t['\u2F8E'] = '\u8840';
  34369. t['\u2F8F'] = '\u884C';
  34370. t['\u2F90'] = '\u8863';
  34371. t['\u2F91'] = '\u897E';
  34372. t['\u2F92'] = '\u898B';
  34373. t['\u2F93'] = '\u89D2';
  34374. t['\u2F94'] = '\u8A00';
  34375. t['\u2F95'] = '\u8C37';
  34376. t['\u2F96'] = '\u8C46';
  34377. t['\u2F97'] = '\u8C55';
  34378. t['\u2F98'] = '\u8C78';
  34379. t['\u2F99'] = '\u8C9D';
  34380. t['\u2F9A'] = '\u8D64';
  34381. t['\u2F9B'] = '\u8D70';
  34382. t['\u2F9C'] = '\u8DB3';
  34383. t['\u2F9D'] = '\u8EAB';
  34384. t['\u2F9E'] = '\u8ECA';
  34385. t['\u2F9F'] = '\u8F9B';
  34386. t['\u2FA0'] = '\u8FB0';
  34387. t['\u2FA1'] = '\u8FB5';
  34388. t['\u2FA2'] = '\u9091';
  34389. t['\u2FA3'] = '\u9149';
  34390. t['\u2FA4'] = '\u91C6';
  34391. t['\u2FA5'] = '\u91CC';
  34392. t['\u2FA6'] = '\u91D1';
  34393. t['\u2FA7'] = '\u9577';
  34394. t['\u2FA8'] = '\u9580';
  34395. t['\u2FA9'] = '\u961C';
  34396. t['\u2FAA'] = '\u96B6';
  34397. t['\u2FAB'] = '\u96B9';
  34398. t['\u2FAC'] = '\u96E8';
  34399. t['\u2FAD'] = '\u9751';
  34400. t['\u2FAE'] = '\u975E';
  34401. t['\u2FAF'] = '\u9762';
  34402. t['\u2FB0'] = '\u9769';
  34403. t['\u2FB1'] = '\u97CB';
  34404. t['\u2FB2'] = '\u97ED';
  34405. t['\u2FB3'] = '\u97F3';
  34406. t['\u2FB4'] = '\u9801';
  34407. t['\u2FB5'] = '\u98A8';
  34408. t['\u2FB6'] = '\u98DB';
  34409. t['\u2FB7'] = '\u98DF';
  34410. t['\u2FB8'] = '\u9996';
  34411. t['\u2FB9'] = '\u9999';
  34412. t['\u2FBA'] = '\u99AC';
  34413. t['\u2FBB'] = '\u9AA8';
  34414. t['\u2FBC'] = '\u9AD8';
  34415. t['\u2FBD'] = '\u9ADF';
  34416. t['\u2FBE'] = '\u9B25';
  34417. t['\u2FBF'] = '\u9B2F';
  34418. t['\u2FC0'] = '\u9B32';
  34419. t['\u2FC1'] = '\u9B3C';
  34420. t['\u2FC2'] = '\u9B5A';
  34421. t['\u2FC3'] = '\u9CE5';
  34422. t['\u2FC4'] = '\u9E75';
  34423. t['\u2FC5'] = '\u9E7F';
  34424. t['\u2FC6'] = '\u9EA5';
  34425. t['\u2FC7'] = '\u9EBB';
  34426. t['\u2FC8'] = '\u9EC3';
  34427. t['\u2FC9'] = '\u9ECD';
  34428. t['\u2FCA'] = '\u9ED1';
  34429. t['\u2FCB'] = '\u9EF9';
  34430. t['\u2FCC'] = '\u9EFD';
  34431. t['\u2FCD'] = '\u9F0E';
  34432. t['\u2FCE'] = '\u9F13';
  34433. t['\u2FCF'] = '\u9F20';
  34434. t['\u2FD0'] = '\u9F3B';
  34435. t['\u2FD1'] = '\u9F4A';
  34436. t['\u2FD2'] = '\u9F52';
  34437. t['\u2FD3'] = '\u9F8D';
  34438. t['\u2FD4'] = '\u9F9C';
  34439. t['\u2FD5'] = '\u9FA0';
  34440. t['\u3036'] = '\u3012';
  34441. t['\u3038'] = '\u5341';
  34442. t['\u3039'] = '\u5344';
  34443. t['\u303A'] = '\u5345';
  34444. t['\u309B'] = '\u0020\u3099';
  34445. t['\u309C'] = '\u0020\u309A';
  34446. t['\u3131'] = '\u1100';
  34447. t['\u3132'] = '\u1101';
  34448. t['\u3133'] = '\u11AA';
  34449. t['\u3134'] = '\u1102';
  34450. t['\u3135'] = '\u11AC';
  34451. t['\u3136'] = '\u11AD';
  34452. t['\u3137'] = '\u1103';
  34453. t['\u3138'] = '\u1104';
  34454. t['\u3139'] = '\u1105';
  34455. t['\u313A'] = '\u11B0';
  34456. t['\u313B'] = '\u11B1';
  34457. t['\u313C'] = '\u11B2';
  34458. t['\u313D'] = '\u11B3';
  34459. t['\u313E'] = '\u11B4';
  34460. t['\u313F'] = '\u11B5';
  34461. t['\u3140'] = '\u111A';
  34462. t['\u3141'] = '\u1106';
  34463. t['\u3142'] = '\u1107';
  34464. t['\u3143'] = '\u1108';
  34465. t['\u3144'] = '\u1121';
  34466. t['\u3145'] = '\u1109';
  34467. t['\u3146'] = '\u110A';
  34468. t['\u3147'] = '\u110B';
  34469. t['\u3148'] = '\u110C';
  34470. t['\u3149'] = '\u110D';
  34471. t['\u314A'] = '\u110E';
  34472. t['\u314B'] = '\u110F';
  34473. t['\u314C'] = '\u1110';
  34474. t['\u314D'] = '\u1111';
  34475. t['\u314E'] = '\u1112';
  34476. t['\u314F'] = '\u1161';
  34477. t['\u3150'] = '\u1162';
  34478. t['\u3151'] = '\u1163';
  34479. t['\u3152'] = '\u1164';
  34480. t['\u3153'] = '\u1165';
  34481. t['\u3154'] = '\u1166';
  34482. t['\u3155'] = '\u1167';
  34483. t['\u3156'] = '\u1168';
  34484. t['\u3157'] = '\u1169';
  34485. t['\u3158'] = '\u116A';
  34486. t['\u3159'] = '\u116B';
  34487. t['\u315A'] = '\u116C';
  34488. t['\u315B'] = '\u116D';
  34489. t['\u315C'] = '\u116E';
  34490. t['\u315D'] = '\u116F';
  34491. t['\u315E'] = '\u1170';
  34492. t['\u315F'] = '\u1171';
  34493. t['\u3160'] = '\u1172';
  34494. t['\u3161'] = '\u1173';
  34495. t['\u3162'] = '\u1174';
  34496. t['\u3163'] = '\u1175';
  34497. t['\u3164'] = '\u1160';
  34498. t['\u3165'] = '\u1114';
  34499. t['\u3166'] = '\u1115';
  34500. t['\u3167'] = '\u11C7';
  34501. t['\u3168'] = '\u11C8';
  34502. t['\u3169'] = '\u11CC';
  34503. t['\u316A'] = '\u11CE';
  34504. t['\u316B'] = '\u11D3';
  34505. t['\u316C'] = '\u11D7';
  34506. t['\u316D'] = '\u11D9';
  34507. t['\u316E'] = '\u111C';
  34508. t['\u316F'] = '\u11DD';
  34509. t['\u3170'] = '\u11DF';
  34510. t['\u3171'] = '\u111D';
  34511. t['\u3172'] = '\u111E';
  34512. t['\u3173'] = '\u1120';
  34513. t['\u3174'] = '\u1122';
  34514. t['\u3175'] = '\u1123';
  34515. t['\u3176'] = '\u1127';
  34516. t['\u3177'] = '\u1129';
  34517. t['\u3178'] = '\u112B';
  34518. t['\u3179'] = '\u112C';
  34519. t['\u317A'] = '\u112D';
  34520. t['\u317B'] = '\u112E';
  34521. t['\u317C'] = '\u112F';
  34522. t['\u317D'] = '\u1132';
  34523. t['\u317E'] = '\u1136';
  34524. t['\u317F'] = '\u1140';
  34525. t['\u3180'] = '\u1147';
  34526. t['\u3181'] = '\u114C';
  34527. t['\u3182'] = '\u11F1';
  34528. t['\u3183'] = '\u11F2';
  34529. t['\u3184'] = '\u1157';
  34530. t['\u3185'] = '\u1158';
  34531. t['\u3186'] = '\u1159';
  34532. t['\u3187'] = '\u1184';
  34533. t['\u3188'] = '\u1185';
  34534. t['\u3189'] = '\u1188';
  34535. t['\u318A'] = '\u1191';
  34536. t['\u318B'] = '\u1192';
  34537. t['\u318C'] = '\u1194';
  34538. t['\u318D'] = '\u119E';
  34539. t['\u318E'] = '\u11A1';
  34540. t['\u3200'] = '\u0028\u1100\u0029';
  34541. t['\u3201'] = '\u0028\u1102\u0029';
  34542. t['\u3202'] = '\u0028\u1103\u0029';
  34543. t['\u3203'] = '\u0028\u1105\u0029';
  34544. t['\u3204'] = '\u0028\u1106\u0029';
  34545. t['\u3205'] = '\u0028\u1107\u0029';
  34546. t['\u3206'] = '\u0028\u1109\u0029';
  34547. t['\u3207'] = '\u0028\u110B\u0029';
  34548. t['\u3208'] = '\u0028\u110C\u0029';
  34549. t['\u3209'] = '\u0028\u110E\u0029';
  34550. t['\u320A'] = '\u0028\u110F\u0029';
  34551. t['\u320B'] = '\u0028\u1110\u0029';
  34552. t['\u320C'] = '\u0028\u1111\u0029';
  34553. t['\u320D'] = '\u0028\u1112\u0029';
  34554. t['\u320E'] = '\u0028\u1100\u1161\u0029';
  34555. t['\u320F'] = '\u0028\u1102\u1161\u0029';
  34556. t['\u3210'] = '\u0028\u1103\u1161\u0029';
  34557. t['\u3211'] = '\u0028\u1105\u1161\u0029';
  34558. t['\u3212'] = '\u0028\u1106\u1161\u0029';
  34559. t['\u3213'] = '\u0028\u1107\u1161\u0029';
  34560. t['\u3214'] = '\u0028\u1109\u1161\u0029';
  34561. t['\u3215'] = '\u0028\u110B\u1161\u0029';
  34562. t['\u3216'] = '\u0028\u110C\u1161\u0029';
  34563. t['\u3217'] = '\u0028\u110E\u1161\u0029';
  34564. t['\u3218'] = '\u0028\u110F\u1161\u0029';
  34565. t['\u3219'] = '\u0028\u1110\u1161\u0029';
  34566. t['\u321A'] = '\u0028\u1111\u1161\u0029';
  34567. t['\u321B'] = '\u0028\u1112\u1161\u0029';
  34568. t['\u321C'] = '\u0028\u110C\u116E\u0029';
  34569. t['\u321D'] = '\u0028\u110B\u1169\u110C\u1165\u11AB\u0029';
  34570. t['\u321E'] = '\u0028\u110B\u1169\u1112\u116E\u0029';
  34571. t['\u3220'] = '\u0028\u4E00\u0029';
  34572. t['\u3221'] = '\u0028\u4E8C\u0029';
  34573. t['\u3222'] = '\u0028\u4E09\u0029';
  34574. t['\u3223'] = '\u0028\u56DB\u0029';
  34575. t['\u3224'] = '\u0028\u4E94\u0029';
  34576. t['\u3225'] = '\u0028\u516D\u0029';
  34577. t['\u3226'] = '\u0028\u4E03\u0029';
  34578. t['\u3227'] = '\u0028\u516B\u0029';
  34579. t['\u3228'] = '\u0028\u4E5D\u0029';
  34580. t['\u3229'] = '\u0028\u5341\u0029';
  34581. t['\u322A'] = '\u0028\u6708\u0029';
  34582. t['\u322B'] = '\u0028\u706B\u0029';
  34583. t['\u322C'] = '\u0028\u6C34\u0029';
  34584. t['\u322D'] = '\u0028\u6728\u0029';
  34585. t['\u322E'] = '\u0028\u91D1\u0029';
  34586. t['\u322F'] = '\u0028\u571F\u0029';
  34587. t['\u3230'] = '\u0028\u65E5\u0029';
  34588. t['\u3231'] = '\u0028\u682A\u0029';
  34589. t['\u3232'] = '\u0028\u6709\u0029';
  34590. t['\u3233'] = '\u0028\u793E\u0029';
  34591. t['\u3234'] = '\u0028\u540D\u0029';
  34592. t['\u3235'] = '\u0028\u7279\u0029';
  34593. t['\u3236'] = '\u0028\u8CA1\u0029';
  34594. t['\u3237'] = '\u0028\u795D\u0029';
  34595. t['\u3238'] = '\u0028\u52B4\u0029';
  34596. t['\u3239'] = '\u0028\u4EE3\u0029';
  34597. t['\u323A'] = '\u0028\u547C\u0029';
  34598. t['\u323B'] = '\u0028\u5B66\u0029';
  34599. t['\u323C'] = '\u0028\u76E3\u0029';
  34600. t['\u323D'] = '\u0028\u4F01\u0029';
  34601. t['\u323E'] = '\u0028\u8CC7\u0029';
  34602. t['\u323F'] = '\u0028\u5354\u0029';
  34603. t['\u3240'] = '\u0028\u796D\u0029';
  34604. t['\u3241'] = '\u0028\u4F11\u0029';
  34605. t['\u3242'] = '\u0028\u81EA\u0029';
  34606. t['\u3243'] = '\u0028\u81F3\u0029';
  34607. t['\u32C0'] = '\u0031\u6708';
  34608. t['\u32C1'] = '\u0032\u6708';
  34609. t['\u32C2'] = '\u0033\u6708';
  34610. t['\u32C3'] = '\u0034\u6708';
  34611. t['\u32C4'] = '\u0035\u6708';
  34612. t['\u32C5'] = '\u0036\u6708';
  34613. t['\u32C6'] = '\u0037\u6708';
  34614. t['\u32C7'] = '\u0038\u6708';
  34615. t['\u32C8'] = '\u0039\u6708';
  34616. t['\u32C9'] = '\u0031\u0030\u6708';
  34617. t['\u32CA'] = '\u0031\u0031\u6708';
  34618. t['\u32CB'] = '\u0031\u0032\u6708';
  34619. t['\u3358'] = '\u0030\u70B9';
  34620. t['\u3359'] = '\u0031\u70B9';
  34621. t['\u335A'] = '\u0032\u70B9';
  34622. t['\u335B'] = '\u0033\u70B9';
  34623. t['\u335C'] = '\u0034\u70B9';
  34624. t['\u335D'] = '\u0035\u70B9';
  34625. t['\u335E'] = '\u0036\u70B9';
  34626. t['\u335F'] = '\u0037\u70B9';
  34627. t['\u3360'] = '\u0038\u70B9';
  34628. t['\u3361'] = '\u0039\u70B9';
  34629. t['\u3362'] = '\u0031\u0030\u70B9';
  34630. t['\u3363'] = '\u0031\u0031\u70B9';
  34631. t['\u3364'] = '\u0031\u0032\u70B9';
  34632. t['\u3365'] = '\u0031\u0033\u70B9';
  34633. t['\u3366'] = '\u0031\u0034\u70B9';
  34634. t['\u3367'] = '\u0031\u0035\u70B9';
  34635. t['\u3368'] = '\u0031\u0036\u70B9';
  34636. t['\u3369'] = '\u0031\u0037\u70B9';
  34637. t['\u336A'] = '\u0031\u0038\u70B9';
  34638. t['\u336B'] = '\u0031\u0039\u70B9';
  34639. t['\u336C'] = '\u0032\u0030\u70B9';
  34640. t['\u336D'] = '\u0032\u0031\u70B9';
  34641. t['\u336E'] = '\u0032\u0032\u70B9';
  34642. t['\u336F'] = '\u0032\u0033\u70B9';
  34643. t['\u3370'] = '\u0032\u0034\u70B9';
  34644. t['\u33E0'] = '\u0031\u65E5';
  34645. t['\u33E1'] = '\u0032\u65E5';
  34646. t['\u33E2'] = '\u0033\u65E5';
  34647. t['\u33E3'] = '\u0034\u65E5';
  34648. t['\u33E4'] = '\u0035\u65E5';
  34649. t['\u33E5'] = '\u0036\u65E5';
  34650. t['\u33E6'] = '\u0037\u65E5';
  34651. t['\u33E7'] = '\u0038\u65E5';
  34652. t['\u33E8'] = '\u0039\u65E5';
  34653. t['\u33E9'] = '\u0031\u0030\u65E5';
  34654. t['\u33EA'] = '\u0031\u0031\u65E5';
  34655. t['\u33EB'] = '\u0031\u0032\u65E5';
  34656. t['\u33EC'] = '\u0031\u0033\u65E5';
  34657. t['\u33ED'] = '\u0031\u0034\u65E5';
  34658. t['\u33EE'] = '\u0031\u0035\u65E5';
  34659. t['\u33EF'] = '\u0031\u0036\u65E5';
  34660. t['\u33F0'] = '\u0031\u0037\u65E5';
  34661. t['\u33F1'] = '\u0031\u0038\u65E5';
  34662. t['\u33F2'] = '\u0031\u0039\u65E5';
  34663. t['\u33F3'] = '\u0032\u0030\u65E5';
  34664. t['\u33F4'] = '\u0032\u0031\u65E5';
  34665. t['\u33F5'] = '\u0032\u0032\u65E5';
  34666. t['\u33F6'] = '\u0032\u0033\u65E5';
  34667. t['\u33F7'] = '\u0032\u0034\u65E5';
  34668. t['\u33F8'] = '\u0032\u0035\u65E5';
  34669. t['\u33F9'] = '\u0032\u0036\u65E5';
  34670. t['\u33FA'] = '\u0032\u0037\u65E5';
  34671. t['\u33FB'] = '\u0032\u0038\u65E5';
  34672. t['\u33FC'] = '\u0032\u0039\u65E5';
  34673. t['\u33FD'] = '\u0033\u0030\u65E5';
  34674. t['\u33FE'] = '\u0033\u0031\u65E5';
  34675. t['\uFB00'] = '\u0066\u0066';
  34676. t['\uFB01'] = '\u0066\u0069';
  34677. t['\uFB02'] = '\u0066\u006C';
  34678. t['\uFB03'] = '\u0066\u0066\u0069';
  34679. t['\uFB04'] = '\u0066\u0066\u006C';
  34680. t['\uFB05'] = '\u017F\u0074';
  34681. t['\uFB06'] = '\u0073\u0074';
  34682. t['\uFB13'] = '\u0574\u0576';
  34683. t['\uFB14'] = '\u0574\u0565';
  34684. t['\uFB15'] = '\u0574\u056B';
  34685. t['\uFB16'] = '\u057E\u0576';
  34686. t['\uFB17'] = '\u0574\u056D';
  34687. t['\uFB4F'] = '\u05D0\u05DC';
  34688. t['\uFB50'] = '\u0671';
  34689. t['\uFB51'] = '\u0671';
  34690. t['\uFB52'] = '\u067B';
  34691. t['\uFB53'] = '\u067B';
  34692. t['\uFB54'] = '\u067B';
  34693. t['\uFB55'] = '\u067B';
  34694. t['\uFB56'] = '\u067E';
  34695. t['\uFB57'] = '\u067E';
  34696. t['\uFB58'] = '\u067E';
  34697. t['\uFB59'] = '\u067E';
  34698. t['\uFB5A'] = '\u0680';
  34699. t['\uFB5B'] = '\u0680';
  34700. t['\uFB5C'] = '\u0680';
  34701. t['\uFB5D'] = '\u0680';
  34702. t['\uFB5E'] = '\u067A';
  34703. t['\uFB5F'] = '\u067A';
  34704. t['\uFB60'] = '\u067A';
  34705. t['\uFB61'] = '\u067A';
  34706. t['\uFB62'] = '\u067F';
  34707. t['\uFB63'] = '\u067F';
  34708. t['\uFB64'] = '\u067F';
  34709. t['\uFB65'] = '\u067F';
  34710. t['\uFB66'] = '\u0679';
  34711. t['\uFB67'] = '\u0679';
  34712. t['\uFB68'] = '\u0679';
  34713. t['\uFB69'] = '\u0679';
  34714. t['\uFB6A'] = '\u06A4';
  34715. t['\uFB6B'] = '\u06A4';
  34716. t['\uFB6C'] = '\u06A4';
  34717. t['\uFB6D'] = '\u06A4';
  34718. t['\uFB6E'] = '\u06A6';
  34719. t['\uFB6F'] = '\u06A6';
  34720. t['\uFB70'] = '\u06A6';
  34721. t['\uFB71'] = '\u06A6';
  34722. t['\uFB72'] = '\u0684';
  34723. t['\uFB73'] = '\u0684';
  34724. t['\uFB74'] = '\u0684';
  34725. t['\uFB75'] = '\u0684';
  34726. t['\uFB76'] = '\u0683';
  34727. t['\uFB77'] = '\u0683';
  34728. t['\uFB78'] = '\u0683';
  34729. t['\uFB79'] = '\u0683';
  34730. t['\uFB7A'] = '\u0686';
  34731. t['\uFB7B'] = '\u0686';
  34732. t['\uFB7C'] = '\u0686';
  34733. t['\uFB7D'] = '\u0686';
  34734. t['\uFB7E'] = '\u0687';
  34735. t['\uFB7F'] = '\u0687';
  34736. t['\uFB80'] = '\u0687';
  34737. t['\uFB81'] = '\u0687';
  34738. t['\uFB82'] = '\u068D';
  34739. t['\uFB83'] = '\u068D';
  34740. t['\uFB84'] = '\u068C';
  34741. t['\uFB85'] = '\u068C';
  34742. t['\uFB86'] = '\u068E';
  34743. t['\uFB87'] = '\u068E';
  34744. t['\uFB88'] = '\u0688';
  34745. t['\uFB89'] = '\u0688';
  34746. t['\uFB8A'] = '\u0698';
  34747. t['\uFB8B'] = '\u0698';
  34748. t['\uFB8C'] = '\u0691';
  34749. t['\uFB8D'] = '\u0691';
  34750. t['\uFB8E'] = '\u06A9';
  34751. t['\uFB8F'] = '\u06A9';
  34752. t['\uFB90'] = '\u06A9';
  34753. t['\uFB91'] = '\u06A9';
  34754. t['\uFB92'] = '\u06AF';
  34755. t['\uFB93'] = '\u06AF';
  34756. t['\uFB94'] = '\u06AF';
  34757. t['\uFB95'] = '\u06AF';
  34758. t['\uFB96'] = '\u06B3';
  34759. t['\uFB97'] = '\u06B3';
  34760. t['\uFB98'] = '\u06B3';
  34761. t['\uFB99'] = '\u06B3';
  34762. t['\uFB9A'] = '\u06B1';
  34763. t['\uFB9B'] = '\u06B1';
  34764. t['\uFB9C'] = '\u06B1';
  34765. t['\uFB9D'] = '\u06B1';
  34766. t['\uFB9E'] = '\u06BA';
  34767. t['\uFB9F'] = '\u06BA';
  34768. t['\uFBA0'] = '\u06BB';
  34769. t['\uFBA1'] = '\u06BB';
  34770. t['\uFBA2'] = '\u06BB';
  34771. t['\uFBA3'] = '\u06BB';
  34772. t['\uFBA4'] = '\u06C0';
  34773. t['\uFBA5'] = '\u06C0';
  34774. t['\uFBA6'] = '\u06C1';
  34775. t['\uFBA7'] = '\u06C1';
  34776. t['\uFBA8'] = '\u06C1';
  34777. t['\uFBA9'] = '\u06C1';
  34778. t['\uFBAA'] = '\u06BE';
  34779. t['\uFBAB'] = '\u06BE';
  34780. t['\uFBAC'] = '\u06BE';
  34781. t['\uFBAD'] = '\u06BE';
  34782. t['\uFBAE'] = '\u06D2';
  34783. t['\uFBAF'] = '\u06D2';
  34784. t['\uFBB0'] = '\u06D3';
  34785. t['\uFBB1'] = '\u06D3';
  34786. t['\uFBD3'] = '\u06AD';
  34787. t['\uFBD4'] = '\u06AD';
  34788. t['\uFBD5'] = '\u06AD';
  34789. t['\uFBD6'] = '\u06AD';
  34790. t['\uFBD7'] = '\u06C7';
  34791. t['\uFBD8'] = '\u06C7';
  34792. t['\uFBD9'] = '\u06C6';
  34793. t['\uFBDA'] = '\u06C6';
  34794. t['\uFBDB'] = '\u06C8';
  34795. t['\uFBDC'] = '\u06C8';
  34796. t['\uFBDD'] = '\u0677';
  34797. t['\uFBDE'] = '\u06CB';
  34798. t['\uFBDF'] = '\u06CB';
  34799. t['\uFBE0'] = '\u06C5';
  34800. t['\uFBE1'] = '\u06C5';
  34801. t['\uFBE2'] = '\u06C9';
  34802. t['\uFBE3'] = '\u06C9';
  34803. t['\uFBE4'] = '\u06D0';
  34804. t['\uFBE5'] = '\u06D0';
  34805. t['\uFBE6'] = '\u06D0';
  34806. t['\uFBE7'] = '\u06D0';
  34807. t['\uFBE8'] = '\u0649';
  34808. t['\uFBE9'] = '\u0649';
  34809. t['\uFBEA'] = '\u0626\u0627';
  34810. t['\uFBEB'] = '\u0626\u0627';
  34811. t['\uFBEC'] = '\u0626\u06D5';
  34812. t['\uFBED'] = '\u0626\u06D5';
  34813. t['\uFBEE'] = '\u0626\u0648';
  34814. t['\uFBEF'] = '\u0626\u0648';
  34815. t['\uFBF0'] = '\u0626\u06C7';
  34816. t['\uFBF1'] = '\u0626\u06C7';
  34817. t['\uFBF2'] = '\u0626\u06C6';
  34818. t['\uFBF3'] = '\u0626\u06C6';
  34819. t['\uFBF4'] = '\u0626\u06C8';
  34820. t['\uFBF5'] = '\u0626\u06C8';
  34821. t['\uFBF6'] = '\u0626\u06D0';
  34822. t['\uFBF7'] = '\u0626\u06D0';
  34823. t['\uFBF8'] = '\u0626\u06D0';
  34824. t['\uFBF9'] = '\u0626\u0649';
  34825. t['\uFBFA'] = '\u0626\u0649';
  34826. t['\uFBFB'] = '\u0626\u0649';
  34827. t['\uFBFC'] = '\u06CC';
  34828. t['\uFBFD'] = '\u06CC';
  34829. t['\uFBFE'] = '\u06CC';
  34830. t['\uFBFF'] = '\u06CC';
  34831. t['\uFC00'] = '\u0626\u062C';
  34832. t['\uFC01'] = '\u0626\u062D';
  34833. t['\uFC02'] = '\u0626\u0645';
  34834. t['\uFC03'] = '\u0626\u0649';
  34835. t['\uFC04'] = '\u0626\u064A';
  34836. t['\uFC05'] = '\u0628\u062C';
  34837. t['\uFC06'] = '\u0628\u062D';
  34838. t['\uFC07'] = '\u0628\u062E';
  34839. t['\uFC08'] = '\u0628\u0645';
  34840. t['\uFC09'] = '\u0628\u0649';
  34841. t['\uFC0A'] = '\u0628\u064A';
  34842. t['\uFC0B'] = '\u062A\u062C';
  34843. t['\uFC0C'] = '\u062A\u062D';
  34844. t['\uFC0D'] = '\u062A\u062E';
  34845. t['\uFC0E'] = '\u062A\u0645';
  34846. t['\uFC0F'] = '\u062A\u0649';
  34847. t['\uFC10'] = '\u062A\u064A';
  34848. t['\uFC11'] = '\u062B\u062C';
  34849. t['\uFC12'] = '\u062B\u0645';
  34850. t['\uFC13'] = '\u062B\u0649';
  34851. t['\uFC14'] = '\u062B\u064A';
  34852. t['\uFC15'] = '\u062C\u062D';
  34853. t['\uFC16'] = '\u062C\u0645';
  34854. t['\uFC17'] = '\u062D\u062C';
  34855. t['\uFC18'] = '\u062D\u0645';
  34856. t['\uFC19'] = '\u062E\u062C';
  34857. t['\uFC1A'] = '\u062E\u062D';
  34858. t['\uFC1B'] = '\u062E\u0645';
  34859. t['\uFC1C'] = '\u0633\u062C';
  34860. t['\uFC1D'] = '\u0633\u062D';
  34861. t['\uFC1E'] = '\u0633\u062E';
  34862. t['\uFC1F'] = '\u0633\u0645';
  34863. t['\uFC20'] = '\u0635\u062D';
  34864. t['\uFC21'] = '\u0635\u0645';
  34865. t['\uFC22'] = '\u0636\u062C';
  34866. t['\uFC23'] = '\u0636\u062D';
  34867. t['\uFC24'] = '\u0636\u062E';
  34868. t['\uFC25'] = '\u0636\u0645';
  34869. t['\uFC26'] = '\u0637\u062D';
  34870. t['\uFC27'] = '\u0637\u0645';
  34871. t['\uFC28'] = '\u0638\u0645';
  34872. t['\uFC29'] = '\u0639\u062C';
  34873. t['\uFC2A'] = '\u0639\u0645';
  34874. t['\uFC2B'] = '\u063A\u062C';
  34875. t['\uFC2C'] = '\u063A\u0645';
  34876. t['\uFC2D'] = '\u0641\u062C';
  34877. t['\uFC2E'] = '\u0641\u062D';
  34878. t['\uFC2F'] = '\u0641\u062E';
  34879. t['\uFC30'] = '\u0641\u0645';
  34880. t['\uFC31'] = '\u0641\u0649';
  34881. t['\uFC32'] = '\u0641\u064A';
  34882. t['\uFC33'] = '\u0642\u062D';
  34883. t['\uFC34'] = '\u0642\u0645';
  34884. t['\uFC35'] = '\u0642\u0649';
  34885. t['\uFC36'] = '\u0642\u064A';
  34886. t['\uFC37'] = '\u0643\u0627';
  34887. t['\uFC38'] = '\u0643\u062C';
  34888. t['\uFC39'] = '\u0643\u062D';
  34889. t['\uFC3A'] = '\u0643\u062E';
  34890. t['\uFC3B'] = '\u0643\u0644';
  34891. t['\uFC3C'] = '\u0643\u0645';
  34892. t['\uFC3D'] = '\u0643\u0649';
  34893. t['\uFC3E'] = '\u0643\u064A';
  34894. t['\uFC3F'] = '\u0644\u062C';
  34895. t['\uFC40'] = '\u0644\u062D';
  34896. t['\uFC41'] = '\u0644\u062E';
  34897. t['\uFC42'] = '\u0644\u0645';
  34898. t['\uFC43'] = '\u0644\u0649';
  34899. t['\uFC44'] = '\u0644\u064A';
  34900. t['\uFC45'] = '\u0645\u062C';
  34901. t['\uFC46'] = '\u0645\u062D';
  34902. t['\uFC47'] = '\u0645\u062E';
  34903. t['\uFC48'] = '\u0645\u0645';
  34904. t['\uFC49'] = '\u0645\u0649';
  34905. t['\uFC4A'] = '\u0645\u064A';
  34906. t['\uFC4B'] = '\u0646\u062C';
  34907. t['\uFC4C'] = '\u0646\u062D';
  34908. t['\uFC4D'] = '\u0646\u062E';
  34909. t['\uFC4E'] = '\u0646\u0645';
  34910. t['\uFC4F'] = '\u0646\u0649';
  34911. t['\uFC50'] = '\u0646\u064A';
  34912. t['\uFC51'] = '\u0647\u062C';
  34913. t['\uFC52'] = '\u0647\u0645';
  34914. t['\uFC53'] = '\u0647\u0649';
  34915. t['\uFC54'] = '\u0647\u064A';
  34916. t['\uFC55'] = '\u064A\u062C';
  34917. t['\uFC56'] = '\u064A\u062D';
  34918. t['\uFC57'] = '\u064A\u062E';
  34919. t['\uFC58'] = '\u064A\u0645';
  34920. t['\uFC59'] = '\u064A\u0649';
  34921. t['\uFC5A'] = '\u064A\u064A';
  34922. t['\uFC5B'] = '\u0630\u0670';
  34923. t['\uFC5C'] = '\u0631\u0670';
  34924. t['\uFC5D'] = '\u0649\u0670';
  34925. t['\uFC5E'] = '\u0020\u064C\u0651';
  34926. t['\uFC5F'] = '\u0020\u064D\u0651';
  34927. t['\uFC60'] = '\u0020\u064E\u0651';
  34928. t['\uFC61'] = '\u0020\u064F\u0651';
  34929. t['\uFC62'] = '\u0020\u0650\u0651';
  34930. t['\uFC63'] = '\u0020\u0651\u0670';
  34931. t['\uFC64'] = '\u0626\u0631';
  34932. t['\uFC65'] = '\u0626\u0632';
  34933. t['\uFC66'] = '\u0626\u0645';
  34934. t['\uFC67'] = '\u0626\u0646';
  34935. t['\uFC68'] = '\u0626\u0649';
  34936. t['\uFC69'] = '\u0626\u064A';
  34937. t['\uFC6A'] = '\u0628\u0631';
  34938. t['\uFC6B'] = '\u0628\u0632';
  34939. t['\uFC6C'] = '\u0628\u0645';
  34940. t['\uFC6D'] = '\u0628\u0646';
  34941. t['\uFC6E'] = '\u0628\u0649';
  34942. t['\uFC6F'] = '\u0628\u064A';
  34943. t['\uFC70'] = '\u062A\u0631';
  34944. t['\uFC71'] = '\u062A\u0632';
  34945. t['\uFC72'] = '\u062A\u0645';
  34946. t['\uFC73'] = '\u062A\u0646';
  34947. t['\uFC74'] = '\u062A\u0649';
  34948. t['\uFC75'] = '\u062A\u064A';
  34949. t['\uFC76'] = '\u062B\u0631';
  34950. t['\uFC77'] = '\u062B\u0632';
  34951. t['\uFC78'] = '\u062B\u0645';
  34952. t['\uFC79'] = '\u062B\u0646';
  34953. t['\uFC7A'] = '\u062B\u0649';
  34954. t['\uFC7B'] = '\u062B\u064A';
  34955. t['\uFC7C'] = '\u0641\u0649';
  34956. t['\uFC7D'] = '\u0641\u064A';
  34957. t['\uFC7E'] = '\u0642\u0649';
  34958. t['\uFC7F'] = '\u0642\u064A';
  34959. t['\uFC80'] = '\u0643\u0627';
  34960. t['\uFC81'] = '\u0643\u0644';
  34961. t['\uFC82'] = '\u0643\u0645';
  34962. t['\uFC83'] = '\u0643\u0649';
  34963. t['\uFC84'] = '\u0643\u064A';
  34964. t['\uFC85'] = '\u0644\u0645';
  34965. t['\uFC86'] = '\u0644\u0649';
  34966. t['\uFC87'] = '\u0644\u064A';
  34967. t['\uFC88'] = '\u0645\u0627';
  34968. t['\uFC89'] = '\u0645\u0645';
  34969. t['\uFC8A'] = '\u0646\u0631';
  34970. t['\uFC8B'] = '\u0646\u0632';
  34971. t['\uFC8C'] = '\u0646\u0645';
  34972. t['\uFC8D'] = '\u0646\u0646';
  34973. t['\uFC8E'] = '\u0646\u0649';
  34974. t['\uFC8F'] = '\u0646\u064A';
  34975. t['\uFC90'] = '\u0649\u0670';
  34976. t['\uFC91'] = '\u064A\u0631';
  34977. t['\uFC92'] = '\u064A\u0632';
  34978. t['\uFC93'] = '\u064A\u0645';
  34979. t['\uFC94'] = '\u064A\u0646';
  34980. t['\uFC95'] = '\u064A\u0649';
  34981. t['\uFC96'] = '\u064A\u064A';
  34982. t['\uFC97'] = '\u0626\u062C';
  34983. t['\uFC98'] = '\u0626\u062D';
  34984. t['\uFC99'] = '\u0626\u062E';
  34985. t['\uFC9A'] = '\u0626\u0645';
  34986. t['\uFC9B'] = '\u0626\u0647';
  34987. t['\uFC9C'] = '\u0628\u062C';
  34988. t['\uFC9D'] = '\u0628\u062D';
  34989. t['\uFC9E'] = '\u0628\u062E';
  34990. t['\uFC9F'] = '\u0628\u0645';
  34991. t['\uFCA0'] = '\u0628\u0647';
  34992. t['\uFCA1'] = '\u062A\u062C';
  34993. t['\uFCA2'] = '\u062A\u062D';
  34994. t['\uFCA3'] = '\u062A\u062E';
  34995. t['\uFCA4'] = '\u062A\u0645';
  34996. t['\uFCA5'] = '\u062A\u0647';
  34997. t['\uFCA6'] = '\u062B\u0645';
  34998. t['\uFCA7'] = '\u062C\u062D';
  34999. t['\uFCA8'] = '\u062C\u0645';
  35000. t['\uFCA9'] = '\u062D\u062C';
  35001. t['\uFCAA'] = '\u062D\u0645';
  35002. t['\uFCAB'] = '\u062E\u062C';
  35003. t['\uFCAC'] = '\u062E\u0645';
  35004. t['\uFCAD'] = '\u0633\u062C';
  35005. t['\uFCAE'] = '\u0633\u062D';
  35006. t['\uFCAF'] = '\u0633\u062E';
  35007. t['\uFCB0'] = '\u0633\u0645';
  35008. t['\uFCB1'] = '\u0635\u062D';
  35009. t['\uFCB2'] = '\u0635\u062E';
  35010. t['\uFCB3'] = '\u0635\u0645';
  35011. t['\uFCB4'] = '\u0636\u062C';
  35012. t['\uFCB5'] = '\u0636\u062D';
  35013. t['\uFCB6'] = '\u0636\u062E';
  35014. t['\uFCB7'] = '\u0636\u0645';
  35015. t['\uFCB8'] = '\u0637\u062D';
  35016. t['\uFCB9'] = '\u0638\u0645';
  35017. t['\uFCBA'] = '\u0639\u062C';
  35018. t['\uFCBB'] = '\u0639\u0645';
  35019. t['\uFCBC'] = '\u063A\u062C';
  35020. t['\uFCBD'] = '\u063A\u0645';
  35021. t['\uFCBE'] = '\u0641\u062C';
  35022. t['\uFCBF'] = '\u0641\u062D';
  35023. t['\uFCC0'] = '\u0641\u062E';
  35024. t['\uFCC1'] = '\u0641\u0645';
  35025. t['\uFCC2'] = '\u0642\u062D';
  35026. t['\uFCC3'] = '\u0642\u0645';
  35027. t['\uFCC4'] = '\u0643\u062C';
  35028. t['\uFCC5'] = '\u0643\u062D';
  35029. t['\uFCC6'] = '\u0643\u062E';
  35030. t['\uFCC7'] = '\u0643\u0644';
  35031. t['\uFCC8'] = '\u0643\u0645';
  35032. t['\uFCC9'] = '\u0644\u062C';
  35033. t['\uFCCA'] = '\u0644\u062D';
  35034. t['\uFCCB'] = '\u0644\u062E';
  35035. t['\uFCCC'] = '\u0644\u0645';
  35036. t['\uFCCD'] = '\u0644\u0647';
  35037. t['\uFCCE'] = '\u0645\u062C';
  35038. t['\uFCCF'] = '\u0645\u062D';
  35039. t['\uFCD0'] = '\u0645\u062E';
  35040. t['\uFCD1'] = '\u0645\u0645';
  35041. t['\uFCD2'] = '\u0646\u062C';
  35042. t['\uFCD3'] = '\u0646\u062D';
  35043. t['\uFCD4'] = '\u0646\u062E';
  35044. t['\uFCD5'] = '\u0646\u0645';
  35045. t['\uFCD6'] = '\u0646\u0647';
  35046. t['\uFCD7'] = '\u0647\u062C';
  35047. t['\uFCD8'] = '\u0647\u0645';
  35048. t['\uFCD9'] = '\u0647\u0670';
  35049. t['\uFCDA'] = '\u064A\u062C';
  35050. t['\uFCDB'] = '\u064A\u062D';
  35051. t['\uFCDC'] = '\u064A\u062E';
  35052. t['\uFCDD'] = '\u064A\u0645';
  35053. t['\uFCDE'] = '\u064A\u0647';
  35054. t['\uFCDF'] = '\u0626\u0645';
  35055. t['\uFCE0'] = '\u0626\u0647';
  35056. t['\uFCE1'] = '\u0628\u0645';
  35057. t['\uFCE2'] = '\u0628\u0647';
  35058. t['\uFCE3'] = '\u062A\u0645';
  35059. t['\uFCE4'] = '\u062A\u0647';
  35060. t['\uFCE5'] = '\u062B\u0645';
  35061. t['\uFCE6'] = '\u062B\u0647';
  35062. t['\uFCE7'] = '\u0633\u0645';
  35063. t['\uFCE8'] = '\u0633\u0647';
  35064. t['\uFCE9'] = '\u0634\u0645';
  35065. t['\uFCEA'] = '\u0634\u0647';
  35066. t['\uFCEB'] = '\u0643\u0644';
  35067. t['\uFCEC'] = '\u0643\u0645';
  35068. t['\uFCED'] = '\u0644\u0645';
  35069. t['\uFCEE'] = '\u0646\u0645';
  35070. t['\uFCEF'] = '\u0646\u0647';
  35071. t['\uFCF0'] = '\u064A\u0645';
  35072. t['\uFCF1'] = '\u064A\u0647';
  35073. t['\uFCF2'] = '\u0640\u064E\u0651';
  35074. t['\uFCF3'] = '\u0640\u064F\u0651';
  35075. t['\uFCF4'] = '\u0640\u0650\u0651';
  35076. t['\uFCF5'] = '\u0637\u0649';
  35077. t['\uFCF6'] = '\u0637\u064A';
  35078. t['\uFCF7'] = '\u0639\u0649';
  35079. t['\uFCF8'] = '\u0639\u064A';
  35080. t['\uFCF9'] = '\u063A\u0649';
  35081. t['\uFCFA'] = '\u063A\u064A';
  35082. t['\uFCFB'] = '\u0633\u0649';
  35083. t['\uFCFC'] = '\u0633\u064A';
  35084. t['\uFCFD'] = '\u0634\u0649';
  35085. t['\uFCFE'] = '\u0634\u064A';
  35086. t['\uFCFF'] = '\u062D\u0649';
  35087. t['\uFD00'] = '\u062D\u064A';
  35088. t['\uFD01'] = '\u062C\u0649';
  35089. t['\uFD02'] = '\u062C\u064A';
  35090. t['\uFD03'] = '\u062E\u0649';
  35091. t['\uFD04'] = '\u062E\u064A';
  35092. t['\uFD05'] = '\u0635\u0649';
  35093. t['\uFD06'] = '\u0635\u064A';
  35094. t['\uFD07'] = '\u0636\u0649';
  35095. t['\uFD08'] = '\u0636\u064A';
  35096. t['\uFD09'] = '\u0634\u062C';
  35097. t['\uFD0A'] = '\u0634\u062D';
  35098. t['\uFD0B'] = '\u0634\u062E';
  35099. t['\uFD0C'] = '\u0634\u0645';
  35100. t['\uFD0D'] = '\u0634\u0631';
  35101. t['\uFD0E'] = '\u0633\u0631';
  35102. t['\uFD0F'] = '\u0635\u0631';
  35103. t['\uFD10'] = '\u0636\u0631';
  35104. t['\uFD11'] = '\u0637\u0649';
  35105. t['\uFD12'] = '\u0637\u064A';
  35106. t['\uFD13'] = '\u0639\u0649';
  35107. t['\uFD14'] = '\u0639\u064A';
  35108. t['\uFD15'] = '\u063A\u0649';
  35109. t['\uFD16'] = '\u063A\u064A';
  35110. t['\uFD17'] = '\u0633\u0649';
  35111. t['\uFD18'] = '\u0633\u064A';
  35112. t['\uFD19'] = '\u0634\u0649';
  35113. t['\uFD1A'] = '\u0634\u064A';
  35114. t['\uFD1B'] = '\u062D\u0649';
  35115. t['\uFD1C'] = '\u062D\u064A';
  35116. t['\uFD1D'] = '\u062C\u0649';
  35117. t['\uFD1E'] = '\u062C\u064A';
  35118. t['\uFD1F'] = '\u062E\u0649';
  35119. t['\uFD20'] = '\u062E\u064A';
  35120. t['\uFD21'] = '\u0635\u0649';
  35121. t['\uFD22'] = '\u0635\u064A';
  35122. t['\uFD23'] = '\u0636\u0649';
  35123. t['\uFD24'] = '\u0636\u064A';
  35124. t['\uFD25'] = '\u0634\u062C';
  35125. t['\uFD26'] = '\u0634\u062D';
  35126. t['\uFD27'] = '\u0634\u062E';
  35127. t['\uFD28'] = '\u0634\u0645';
  35128. t['\uFD29'] = '\u0634\u0631';
  35129. t['\uFD2A'] = '\u0633\u0631';
  35130. t['\uFD2B'] = '\u0635\u0631';
  35131. t['\uFD2C'] = '\u0636\u0631';
  35132. t['\uFD2D'] = '\u0634\u062C';
  35133. t['\uFD2E'] = '\u0634\u062D';
  35134. t['\uFD2F'] = '\u0634\u062E';
  35135. t['\uFD30'] = '\u0634\u0645';
  35136. t['\uFD31'] = '\u0633\u0647';
  35137. t['\uFD32'] = '\u0634\u0647';
  35138. t['\uFD33'] = '\u0637\u0645';
  35139. t['\uFD34'] = '\u0633\u062C';
  35140. t['\uFD35'] = '\u0633\u062D';
  35141. t['\uFD36'] = '\u0633\u062E';
  35142. t['\uFD37'] = '\u0634\u062C';
  35143. t['\uFD38'] = '\u0634\u062D';
  35144. t['\uFD39'] = '\u0634\u062E';
  35145. t['\uFD3A'] = '\u0637\u0645';
  35146. t['\uFD3B'] = '\u0638\u0645';
  35147. t['\uFD3C'] = '\u0627\u064B';
  35148. t['\uFD3D'] = '\u0627\u064B';
  35149. t['\uFD50'] = '\u062A\u062C\u0645';
  35150. t['\uFD51'] = '\u062A\u062D\u062C';
  35151. t['\uFD52'] = '\u062A\u062D\u062C';
  35152. t['\uFD53'] = '\u062A\u062D\u0645';
  35153. t['\uFD54'] = '\u062A\u062E\u0645';
  35154. t['\uFD55'] = '\u062A\u0645\u062C';
  35155. t['\uFD56'] = '\u062A\u0645\u062D';
  35156. t['\uFD57'] = '\u062A\u0645\u062E';
  35157. t['\uFD58'] = '\u062C\u0645\u062D';
  35158. t['\uFD59'] = '\u062C\u0645\u062D';
  35159. t['\uFD5A'] = '\u062D\u0645\u064A';
  35160. t['\uFD5B'] = '\u062D\u0645\u0649';
  35161. t['\uFD5C'] = '\u0633\u062D\u062C';
  35162. t['\uFD5D'] = '\u0633\u062C\u062D';
  35163. t['\uFD5E'] = '\u0633\u062C\u0649';
  35164. t['\uFD5F'] = '\u0633\u0645\u062D';
  35165. t['\uFD60'] = '\u0633\u0645\u062D';
  35166. t['\uFD61'] = '\u0633\u0645\u062C';
  35167. t['\uFD62'] = '\u0633\u0645\u0645';
  35168. t['\uFD63'] = '\u0633\u0645\u0645';
  35169. t['\uFD64'] = '\u0635\u062D\u062D';
  35170. t['\uFD65'] = '\u0635\u062D\u062D';
  35171. t['\uFD66'] = '\u0635\u0645\u0645';
  35172. t['\uFD67'] = '\u0634\u062D\u0645';
  35173. t['\uFD68'] = '\u0634\u062D\u0645';
  35174. t['\uFD69'] = '\u0634\u062C\u064A';
  35175. t['\uFD6A'] = '\u0634\u0645\u062E';
  35176. t['\uFD6B'] = '\u0634\u0645\u062E';
  35177. t['\uFD6C'] = '\u0634\u0645\u0645';
  35178. t['\uFD6D'] = '\u0634\u0645\u0645';
  35179. t['\uFD6E'] = '\u0636\u062D\u0649';
  35180. t['\uFD6F'] = '\u0636\u062E\u0645';
  35181. t['\uFD70'] = '\u0636\u062E\u0645';
  35182. t['\uFD71'] = '\u0637\u0645\u062D';
  35183. t['\uFD72'] = '\u0637\u0645\u062D';
  35184. t['\uFD73'] = '\u0637\u0645\u0645';
  35185. t['\uFD74'] = '\u0637\u0645\u064A';
  35186. t['\uFD75'] = '\u0639\u062C\u0645';
  35187. t['\uFD76'] = '\u0639\u0645\u0645';
  35188. t['\uFD77'] = '\u0639\u0645\u0645';
  35189. t['\uFD78'] = '\u0639\u0645\u0649';
  35190. t['\uFD79'] = '\u063A\u0645\u0645';
  35191. t['\uFD7A'] = '\u063A\u0645\u064A';
  35192. t['\uFD7B'] = '\u063A\u0645\u0649';
  35193. t['\uFD7C'] = '\u0641\u062E\u0645';
  35194. t['\uFD7D'] = '\u0641\u062E\u0645';
  35195. t['\uFD7E'] = '\u0642\u0645\u062D';
  35196. t['\uFD7F'] = '\u0642\u0645\u0645';
  35197. t['\uFD80'] = '\u0644\u062D\u0645';
  35198. t['\uFD81'] = '\u0644\u062D\u064A';
  35199. t['\uFD82'] = '\u0644\u062D\u0649';
  35200. t['\uFD83'] = '\u0644\u062C\u062C';
  35201. t['\uFD84'] = '\u0644\u062C\u062C';
  35202. t['\uFD85'] = '\u0644\u062E\u0645';
  35203. t['\uFD86'] = '\u0644\u062E\u0645';
  35204. t['\uFD87'] = '\u0644\u0645\u062D';
  35205. t['\uFD88'] = '\u0644\u0645\u062D';
  35206. t['\uFD89'] = '\u0645\u062D\u062C';
  35207. t['\uFD8A'] = '\u0645\u062D\u0645';
  35208. t['\uFD8B'] = '\u0645\u062D\u064A';
  35209. t['\uFD8C'] = '\u0645\u062C\u062D';
  35210. t['\uFD8D'] = '\u0645\u062C\u0645';
  35211. t['\uFD8E'] = '\u0645\u062E\u062C';
  35212. t['\uFD8F'] = '\u0645\u062E\u0645';
  35213. t['\uFD92'] = '\u0645\u062C\u062E';
  35214. t['\uFD93'] = '\u0647\u0645\u062C';
  35215. t['\uFD94'] = '\u0647\u0645\u0645';
  35216. t['\uFD95'] = '\u0646\u062D\u0645';
  35217. t['\uFD96'] = '\u0646\u062D\u0649';
  35218. t['\uFD97'] = '\u0646\u062C\u0645';
  35219. t['\uFD98'] = '\u0646\u062C\u0645';
  35220. t['\uFD99'] = '\u0646\u062C\u0649';
  35221. t['\uFD9A'] = '\u0646\u0645\u064A';
  35222. t['\uFD9B'] = '\u0646\u0645\u0649';
  35223. t['\uFD9C'] = '\u064A\u0645\u0645';
  35224. t['\uFD9D'] = '\u064A\u0645\u0645';
  35225. t['\uFD9E'] = '\u0628\u062E\u064A';
  35226. t['\uFD9F'] = '\u062A\u062C\u064A';
  35227. t['\uFDA0'] = '\u062A\u062C\u0649';
  35228. t['\uFDA1'] = '\u062A\u062E\u064A';
  35229. t['\uFDA2'] = '\u062A\u062E\u0649';
  35230. t['\uFDA3'] = '\u062A\u0645\u064A';
  35231. t['\uFDA4'] = '\u062A\u0645\u0649';
  35232. t['\uFDA5'] = '\u062C\u0645\u064A';
  35233. t['\uFDA6'] = '\u062C\u062D\u0649';
  35234. t['\uFDA7'] = '\u062C\u0645\u0649';
  35235. t['\uFDA8'] = '\u0633\u062E\u0649';
  35236. t['\uFDA9'] = '\u0635\u062D\u064A';
  35237. t['\uFDAA'] = '\u0634\u062D\u064A';
  35238. t['\uFDAB'] = '\u0636\u062D\u064A';
  35239. t['\uFDAC'] = '\u0644\u062C\u064A';
  35240. t['\uFDAD'] = '\u0644\u0645\u064A';
  35241. t['\uFDAE'] = '\u064A\u062D\u064A';
  35242. t['\uFDAF'] = '\u064A\u062C\u064A';
  35243. t['\uFDB0'] = '\u064A\u0645\u064A';
  35244. t['\uFDB1'] = '\u0645\u0645\u064A';
  35245. t['\uFDB2'] = '\u0642\u0645\u064A';
  35246. t['\uFDB3'] = '\u0646\u062D\u064A';
  35247. t['\uFDB4'] = '\u0642\u0645\u062D';
  35248. t['\uFDB5'] = '\u0644\u062D\u0645';
  35249. t['\uFDB6'] = '\u0639\u0645\u064A';
  35250. t['\uFDB7'] = '\u0643\u0645\u064A';
  35251. t['\uFDB8'] = '\u0646\u062C\u062D';
  35252. t['\uFDB9'] = '\u0645\u062E\u064A';
  35253. t['\uFDBA'] = '\u0644\u062C\u0645';
  35254. t['\uFDBB'] = '\u0643\u0645\u0645';
  35255. t['\uFDBC'] = '\u0644\u062C\u0645';
  35256. t['\uFDBD'] = '\u0646\u062C\u062D';
  35257. t['\uFDBE'] = '\u062C\u062D\u064A';
  35258. t['\uFDBF'] = '\u062D\u062C\u064A';
  35259. t['\uFDC0'] = '\u0645\u062C\u064A';
  35260. t['\uFDC1'] = '\u0641\u0645\u064A';
  35261. t['\uFDC2'] = '\u0628\u062D\u064A';
  35262. t['\uFDC3'] = '\u0643\u0645\u0645';
  35263. t['\uFDC4'] = '\u0639\u062C\u0645';
  35264. t['\uFDC5'] = '\u0635\u0645\u0645';
  35265. t['\uFDC6'] = '\u0633\u062E\u064A';
  35266. t['\uFDC7'] = '\u0646\u062C\u064A';
  35267. t['\uFE49'] = '\u203E';
  35268. t['\uFE4A'] = '\u203E';
  35269. t['\uFE4B'] = '\u203E';
  35270. t['\uFE4C'] = '\u203E';
  35271. t['\uFE4D'] = '\u005F';
  35272. t['\uFE4E'] = '\u005F';
  35273. t['\uFE4F'] = '\u005F';
  35274. t['\uFE80'] = '\u0621';
  35275. t['\uFE81'] = '\u0622';
  35276. t['\uFE82'] = '\u0622';
  35277. t['\uFE83'] = '\u0623';
  35278. t['\uFE84'] = '\u0623';
  35279. t['\uFE85'] = '\u0624';
  35280. t['\uFE86'] = '\u0624';
  35281. t['\uFE87'] = '\u0625';
  35282. t['\uFE88'] = '\u0625';
  35283. t['\uFE89'] = '\u0626';
  35284. t['\uFE8A'] = '\u0626';
  35285. t['\uFE8B'] = '\u0626';
  35286. t['\uFE8C'] = '\u0626';
  35287. t['\uFE8D'] = '\u0627';
  35288. t['\uFE8E'] = '\u0627';
  35289. t['\uFE8F'] = '\u0628';
  35290. t['\uFE90'] = '\u0628';
  35291. t['\uFE91'] = '\u0628';
  35292. t['\uFE92'] = '\u0628';
  35293. t['\uFE93'] = '\u0629';
  35294. t['\uFE94'] = '\u0629';
  35295. t['\uFE95'] = '\u062A';
  35296. t['\uFE96'] = '\u062A';
  35297. t['\uFE97'] = '\u062A';
  35298. t['\uFE98'] = '\u062A';
  35299. t['\uFE99'] = '\u062B';
  35300. t['\uFE9A'] = '\u062B';
  35301. t['\uFE9B'] = '\u062B';
  35302. t['\uFE9C'] = '\u062B';
  35303. t['\uFE9D'] = '\u062C';
  35304. t['\uFE9E'] = '\u062C';
  35305. t['\uFE9F'] = '\u062C';
  35306. t['\uFEA0'] = '\u062C';
  35307. t['\uFEA1'] = '\u062D';
  35308. t['\uFEA2'] = '\u062D';
  35309. t['\uFEA3'] = '\u062D';
  35310. t['\uFEA4'] = '\u062D';
  35311. t['\uFEA5'] = '\u062E';
  35312. t['\uFEA6'] = '\u062E';
  35313. t['\uFEA7'] = '\u062E';
  35314. t['\uFEA8'] = '\u062E';
  35315. t['\uFEA9'] = '\u062F';
  35316. t['\uFEAA'] = '\u062F';
  35317. t['\uFEAB'] = '\u0630';
  35318. t['\uFEAC'] = '\u0630';
  35319. t['\uFEAD'] = '\u0631';
  35320. t['\uFEAE'] = '\u0631';
  35321. t['\uFEAF'] = '\u0632';
  35322. t['\uFEB0'] = '\u0632';
  35323. t['\uFEB1'] = '\u0633';
  35324. t['\uFEB2'] = '\u0633';
  35325. t['\uFEB3'] = '\u0633';
  35326. t['\uFEB4'] = '\u0633';
  35327. t['\uFEB5'] = '\u0634';
  35328. t['\uFEB6'] = '\u0634';
  35329. t['\uFEB7'] = '\u0634';
  35330. t['\uFEB8'] = '\u0634';
  35331. t['\uFEB9'] = '\u0635';
  35332. t['\uFEBA'] = '\u0635';
  35333. t['\uFEBB'] = '\u0635';
  35334. t['\uFEBC'] = '\u0635';
  35335. t['\uFEBD'] = '\u0636';
  35336. t['\uFEBE'] = '\u0636';
  35337. t['\uFEBF'] = '\u0636';
  35338. t['\uFEC0'] = '\u0636';
  35339. t['\uFEC1'] = '\u0637';
  35340. t['\uFEC2'] = '\u0637';
  35341. t['\uFEC3'] = '\u0637';
  35342. t['\uFEC4'] = '\u0637';
  35343. t['\uFEC5'] = '\u0638';
  35344. t['\uFEC6'] = '\u0638';
  35345. t['\uFEC7'] = '\u0638';
  35346. t['\uFEC8'] = '\u0638';
  35347. t['\uFEC9'] = '\u0639';
  35348. t['\uFECA'] = '\u0639';
  35349. t['\uFECB'] = '\u0639';
  35350. t['\uFECC'] = '\u0639';
  35351. t['\uFECD'] = '\u063A';
  35352. t['\uFECE'] = '\u063A';
  35353. t['\uFECF'] = '\u063A';
  35354. t['\uFED0'] = '\u063A';
  35355. t['\uFED1'] = '\u0641';
  35356. t['\uFED2'] = '\u0641';
  35357. t['\uFED3'] = '\u0641';
  35358. t['\uFED4'] = '\u0641';
  35359. t['\uFED5'] = '\u0642';
  35360. t['\uFED6'] = '\u0642';
  35361. t['\uFED7'] = '\u0642';
  35362. t['\uFED8'] = '\u0642';
  35363. t['\uFED9'] = '\u0643';
  35364. t['\uFEDA'] = '\u0643';
  35365. t['\uFEDB'] = '\u0643';
  35366. t['\uFEDC'] = '\u0643';
  35367. t['\uFEDD'] = '\u0644';
  35368. t['\uFEDE'] = '\u0644';
  35369. t['\uFEDF'] = '\u0644';
  35370. t['\uFEE0'] = '\u0644';
  35371. t['\uFEE1'] = '\u0645';
  35372. t['\uFEE2'] = '\u0645';
  35373. t['\uFEE3'] = '\u0645';
  35374. t['\uFEE4'] = '\u0645';
  35375. t['\uFEE5'] = '\u0646';
  35376. t['\uFEE6'] = '\u0646';
  35377. t['\uFEE7'] = '\u0646';
  35378. t['\uFEE8'] = '\u0646';
  35379. t['\uFEE9'] = '\u0647';
  35380. t['\uFEEA'] = '\u0647';
  35381. t['\uFEEB'] = '\u0647';
  35382. t['\uFEEC'] = '\u0647';
  35383. t['\uFEED'] = '\u0648';
  35384. t['\uFEEE'] = '\u0648';
  35385. t['\uFEEF'] = '\u0649';
  35386. t['\uFEF0'] = '\u0649';
  35387. t['\uFEF1'] = '\u064A';
  35388. t['\uFEF2'] = '\u064A';
  35389. t['\uFEF3'] = '\u064A';
  35390. t['\uFEF4'] = '\u064A';
  35391. t['\uFEF5'] = '\u0644\u0622';
  35392. t['\uFEF6'] = '\u0644\u0622';
  35393. t['\uFEF7'] = '\u0644\u0623';
  35394. t['\uFEF8'] = '\u0644\u0623';
  35395. t['\uFEF9'] = '\u0644\u0625';
  35396. t['\uFEFA'] = '\u0644\u0625';
  35397. t['\uFEFB'] = '\u0644\u0627';
  35398. t['\uFEFC'] = '\u0644\u0627';
  35399. });
  35400. function reverseIfRtl(chars) {
  35401. var charsLength = chars.length;
  35402. if (charsLength <= 1 || !isRTLRangeFor(chars.charCodeAt(0))) {
  35403. return chars;
  35404. }
  35405. var s = '';
  35406. for (var ii = charsLength - 1; ii >= 0; ii--) {
  35407. s += chars[ii];
  35408. }
  35409. return s;
  35410. }
  35411. exports.mapSpecialUnicodeValues = mapSpecialUnicodeValues;
  35412. exports.reverseIfRtl = reverseIfRtl;
  35413. exports.getUnicodeRangeFor = getUnicodeRangeFor;
  35414. exports.getNormalizedUnicodes = getNormalizedUnicodes;
  35415. exports.getUnicodeForGlyph = getUnicodeForGlyph;
  35416. /***/ }),
  35417. /* 18 */
  35418. /***/ (function(module, exports, __w_pdfjs_require__) {
  35419. "use strict";
  35420. var sharedUtil = __w_pdfjs_require__(0);
  35421. var coreWorker = __w_pdfjs_require__(8);
  35422. var OK_RESPONSE = 200;
  35423. var PARTIAL_CONTENT_RESPONSE = 206;
  35424. function NetworkManager(url, args) {
  35425. this.url = url;
  35426. args = args || {};
  35427. this.isHttp = /^https?:/i.test(url);
  35428. this.httpHeaders = this.isHttp && args.httpHeaders || {};
  35429. this.withCredentials = args.withCredentials || false;
  35430. this.getXhr = args.getXhr || function NetworkManager_getXhr() {
  35431. return new XMLHttpRequest();
  35432. };
  35433. this.currXhrId = 0;
  35434. this.pendingRequests = Object.create(null);
  35435. this.loadedRequests = Object.create(null);
  35436. }
  35437. function getArrayBuffer(xhr) {
  35438. var data = xhr.response;
  35439. if (typeof data !== 'string') {
  35440. return data;
  35441. }
  35442. var length = data.length;
  35443. var array = new Uint8Array(length);
  35444. for (var i = 0; i < length; i++) {
  35445. array[i] = data.charCodeAt(i) & 0xFF;
  35446. }
  35447. return array.buffer;
  35448. }
  35449. var supportsMozChunked = function supportsMozChunkedClosure() {
  35450. try {
  35451. var x = new XMLHttpRequest();
  35452. x.open('GET', 'https://example.com');
  35453. x.responseType = 'moz-chunked-arraybuffer';
  35454. return x.responseType === 'moz-chunked-arraybuffer';
  35455. } catch (e) {
  35456. return false;
  35457. }
  35458. }();
  35459. NetworkManager.prototype = {
  35460. requestRange: function NetworkManager_requestRange(begin, end, listeners) {
  35461. var args = {
  35462. begin: begin,
  35463. end: end
  35464. };
  35465. for (var prop in listeners) {
  35466. args[prop] = listeners[prop];
  35467. }
  35468. return this.request(args);
  35469. },
  35470. requestFull: function NetworkManager_requestFull(listeners) {
  35471. return this.request(listeners);
  35472. },
  35473. request: function NetworkManager_request(args) {
  35474. var xhr = this.getXhr();
  35475. var xhrId = this.currXhrId++;
  35476. var pendingRequest = this.pendingRequests[xhrId] = { xhr: xhr };
  35477. xhr.open('GET', this.url);
  35478. xhr.withCredentials = this.withCredentials;
  35479. for (var property in this.httpHeaders) {
  35480. var value = this.httpHeaders[property];
  35481. if (typeof value === 'undefined') {
  35482. continue;
  35483. }
  35484. xhr.setRequestHeader(property, value);
  35485. }
  35486. if (this.isHttp && 'begin' in args && 'end' in args) {
  35487. var rangeStr = args.begin + '-' + (args.end - 1);
  35488. xhr.setRequestHeader('Range', 'bytes=' + rangeStr);
  35489. pendingRequest.expectedStatus = 206;
  35490. } else {
  35491. pendingRequest.expectedStatus = 200;
  35492. }
  35493. var useMozChunkedLoading = supportsMozChunked && !!args.onProgressiveData;
  35494. if (useMozChunkedLoading) {
  35495. xhr.responseType = 'moz-chunked-arraybuffer';
  35496. pendingRequest.onProgressiveData = args.onProgressiveData;
  35497. pendingRequest.mozChunked = true;
  35498. } else {
  35499. xhr.responseType = 'arraybuffer';
  35500. }
  35501. if (args.onError) {
  35502. xhr.onerror = function (evt) {
  35503. args.onError(xhr.status);
  35504. };
  35505. }
  35506. xhr.onreadystatechange = this.onStateChange.bind(this, xhrId);
  35507. xhr.onprogress = this.onProgress.bind(this, xhrId);
  35508. pendingRequest.onHeadersReceived = args.onHeadersReceived;
  35509. pendingRequest.onDone = args.onDone;
  35510. pendingRequest.onError = args.onError;
  35511. pendingRequest.onProgress = args.onProgress;
  35512. xhr.send(null);
  35513. return xhrId;
  35514. },
  35515. onProgress: function NetworkManager_onProgress(xhrId, evt) {
  35516. var pendingRequest = this.pendingRequests[xhrId];
  35517. if (!pendingRequest) {
  35518. return;
  35519. }
  35520. if (pendingRequest.mozChunked) {
  35521. var chunk = getArrayBuffer(pendingRequest.xhr);
  35522. pendingRequest.onProgressiveData(chunk);
  35523. }
  35524. var onProgress = pendingRequest.onProgress;
  35525. if (onProgress) {
  35526. onProgress(evt);
  35527. }
  35528. },
  35529. onStateChange: function NetworkManager_onStateChange(xhrId, evt) {
  35530. var pendingRequest = this.pendingRequests[xhrId];
  35531. if (!pendingRequest) {
  35532. return;
  35533. }
  35534. var xhr = pendingRequest.xhr;
  35535. if (xhr.readyState >= 2 && pendingRequest.onHeadersReceived) {
  35536. pendingRequest.onHeadersReceived();
  35537. delete pendingRequest.onHeadersReceived;
  35538. }
  35539. if (xhr.readyState !== 4) {
  35540. return;
  35541. }
  35542. if (!(xhrId in this.pendingRequests)) {
  35543. return;
  35544. }
  35545. delete this.pendingRequests[xhrId];
  35546. if (xhr.status === 0 && this.isHttp) {
  35547. if (pendingRequest.onError) {
  35548. pendingRequest.onError(xhr.status);
  35549. }
  35550. return;
  35551. }
  35552. var xhrStatus = xhr.status || OK_RESPONSE;
  35553. var ok_response_on_range_request = xhrStatus === OK_RESPONSE && pendingRequest.expectedStatus === PARTIAL_CONTENT_RESPONSE;
  35554. if (!ok_response_on_range_request && xhrStatus !== pendingRequest.expectedStatus) {
  35555. if (pendingRequest.onError) {
  35556. pendingRequest.onError(xhr.status);
  35557. }
  35558. return;
  35559. }
  35560. this.loadedRequests[xhrId] = true;
  35561. var chunk = getArrayBuffer(xhr);
  35562. if (xhrStatus === PARTIAL_CONTENT_RESPONSE) {
  35563. var rangeHeader = xhr.getResponseHeader('Content-Range');
  35564. var matches = /bytes (\d+)-(\d+)\/(\d+)/.exec(rangeHeader);
  35565. var begin = parseInt(matches[1], 10);
  35566. pendingRequest.onDone({
  35567. begin: begin,
  35568. chunk: chunk
  35569. });
  35570. } else if (pendingRequest.onProgressiveData) {
  35571. pendingRequest.onDone(null);
  35572. } else if (chunk) {
  35573. pendingRequest.onDone({
  35574. begin: 0,
  35575. chunk: chunk
  35576. });
  35577. } else if (pendingRequest.onError) {
  35578. pendingRequest.onError(xhr.status);
  35579. }
  35580. },
  35581. hasPendingRequests: function NetworkManager_hasPendingRequests() {
  35582. for (var xhrId in this.pendingRequests) {
  35583. return true;
  35584. }
  35585. return false;
  35586. },
  35587. getRequestXhr: function NetworkManager_getXhr(xhrId) {
  35588. return this.pendingRequests[xhrId].xhr;
  35589. },
  35590. isStreamingRequest: function NetworkManager_isStreamingRequest(xhrId) {
  35591. return !!this.pendingRequests[xhrId].onProgressiveData;
  35592. },
  35593. isPendingRequest: function NetworkManager_isPendingRequest(xhrId) {
  35594. return xhrId in this.pendingRequests;
  35595. },
  35596. isLoadedRequest: function NetworkManager_isLoadedRequest(xhrId) {
  35597. return xhrId in this.loadedRequests;
  35598. },
  35599. abortAllRequests: function NetworkManager_abortAllRequests() {
  35600. for (var xhrId in this.pendingRequests) {
  35601. this.abortRequest(xhrId | 0);
  35602. }
  35603. },
  35604. abortRequest: function NetworkManager_abortRequest(xhrId) {
  35605. var xhr = this.pendingRequests[xhrId].xhr;
  35606. delete this.pendingRequests[xhrId];
  35607. xhr.abort();
  35608. }
  35609. };
  35610. var assert = sharedUtil.assert;
  35611. var createPromiseCapability = sharedUtil.createPromiseCapability;
  35612. var isInt = sharedUtil.isInt;
  35613. var MissingPDFException = sharedUtil.MissingPDFException;
  35614. var UnexpectedResponseException = sharedUtil.UnexpectedResponseException;
  35615. function PDFNetworkStream(options) {
  35616. this._options = options;
  35617. var source = options.source;
  35618. this._manager = new NetworkManager(source.url, {
  35619. httpHeaders: source.httpHeaders,
  35620. withCredentials: source.withCredentials
  35621. });
  35622. this._rangeChunkSize = source.rangeChunkSize;
  35623. this._fullRequestReader = null;
  35624. this._rangeRequestReaders = [];
  35625. }
  35626. PDFNetworkStream.prototype = {
  35627. _onRangeRequestReaderClosed: function PDFNetworkStream_onRangeRequestReaderClosed(reader) {
  35628. var i = this._rangeRequestReaders.indexOf(reader);
  35629. if (i >= 0) {
  35630. this._rangeRequestReaders.splice(i, 1);
  35631. }
  35632. },
  35633. getFullReader: function PDFNetworkStream_getFullReader() {
  35634. assert(!this._fullRequestReader);
  35635. this._fullRequestReader = new PDFNetworkStreamFullRequestReader(this._manager, this._options);
  35636. return this._fullRequestReader;
  35637. },
  35638. getRangeReader: function PDFNetworkStream_getRangeReader(begin, end) {
  35639. var reader = new PDFNetworkStreamRangeRequestReader(this._manager, begin, end);
  35640. reader.onClosed = this._onRangeRequestReaderClosed.bind(this);
  35641. this._rangeRequestReaders.push(reader);
  35642. return reader;
  35643. },
  35644. cancelAllRequests: function PDFNetworkStream_cancelAllRequests(reason) {
  35645. if (this._fullRequestReader) {
  35646. this._fullRequestReader.cancel(reason);
  35647. }
  35648. var readers = this._rangeRequestReaders.slice(0);
  35649. readers.forEach(function (reader) {
  35650. reader.cancel(reason);
  35651. });
  35652. }
  35653. };
  35654. function PDFNetworkStreamFullRequestReader(manager, options) {
  35655. this._manager = manager;
  35656. var source = options.source;
  35657. var args = {
  35658. onHeadersReceived: this._onHeadersReceived.bind(this),
  35659. onProgressiveData: source.disableStream ? null : this._onProgressiveData.bind(this),
  35660. onDone: this._onDone.bind(this),
  35661. onError: this._onError.bind(this),
  35662. onProgress: this._onProgress.bind(this)
  35663. };
  35664. this._url = source.url;
  35665. this._fullRequestId = manager.requestFull(args);
  35666. this._headersReceivedCapability = createPromiseCapability();
  35667. this._disableRange = options.disableRange || false;
  35668. this._contentLength = source.length;
  35669. this._rangeChunkSize = source.rangeChunkSize;
  35670. if (!this._rangeChunkSize && !this._disableRange) {
  35671. this._disableRange = true;
  35672. }
  35673. this._isStreamingSupported = false;
  35674. this._isRangeSupported = false;
  35675. this._cachedChunks = [];
  35676. this._requests = [];
  35677. this._done = false;
  35678. this._storedError = undefined;
  35679. this.onProgress = null;
  35680. }
  35681. PDFNetworkStreamFullRequestReader.prototype = {
  35682. _validateRangeRequestCapabilities: function PDFNetworkStreamFullRequestReader_validateRangeRequestCapabilities() {
  35683. if (this._disableRange) {
  35684. return false;
  35685. }
  35686. var networkManager = this._manager;
  35687. if (!networkManager.isHttp) {
  35688. return false;
  35689. }
  35690. var fullRequestXhrId = this._fullRequestId;
  35691. var fullRequestXhr = networkManager.getRequestXhr(fullRequestXhrId);
  35692. if (fullRequestXhr.getResponseHeader('Accept-Ranges') !== 'bytes') {
  35693. return false;
  35694. }
  35695. var contentEncoding = fullRequestXhr.getResponseHeader('Content-Encoding') || 'identity';
  35696. if (contentEncoding !== 'identity') {
  35697. return false;
  35698. }
  35699. var length = fullRequestXhr.getResponseHeader('Content-Length');
  35700. length = parseInt(length, 10);
  35701. if (!isInt(length)) {
  35702. return false;
  35703. }
  35704. this._contentLength = length;
  35705. if (length <= 2 * this._rangeChunkSize) {
  35706. return false;
  35707. }
  35708. return true;
  35709. },
  35710. _onHeadersReceived: function PDFNetworkStreamFullRequestReader_onHeadersReceived() {
  35711. if (this._validateRangeRequestCapabilities()) {
  35712. this._isRangeSupported = true;
  35713. }
  35714. var networkManager = this._manager;
  35715. var fullRequestXhrId = this._fullRequestId;
  35716. if (networkManager.isStreamingRequest(fullRequestXhrId)) {
  35717. this._isStreamingSupported = true;
  35718. } else if (this._isRangeSupported) {
  35719. networkManager.abortRequest(fullRequestXhrId);
  35720. }
  35721. this._headersReceivedCapability.resolve();
  35722. },
  35723. _onProgressiveData: function PDFNetworkStreamFullRequestReader_onProgressiveData(chunk) {
  35724. if (this._requests.length > 0) {
  35725. var requestCapability = this._requests.shift();
  35726. requestCapability.resolve({
  35727. value: chunk,
  35728. done: false
  35729. });
  35730. } else {
  35731. this._cachedChunks.push(chunk);
  35732. }
  35733. },
  35734. _onDone: function PDFNetworkStreamFullRequestReader_onDone(args) {
  35735. if (args) {
  35736. this._onProgressiveData(args.chunk);
  35737. }
  35738. this._done = true;
  35739. if (this._cachedChunks.length > 0) {
  35740. return;
  35741. }
  35742. this._requests.forEach(function (requestCapability) {
  35743. requestCapability.resolve({
  35744. value: undefined,
  35745. done: true
  35746. });
  35747. });
  35748. this._requests = [];
  35749. },
  35750. _onError: function PDFNetworkStreamFullRequestReader_onError(status) {
  35751. var url = this._url;
  35752. var exception;
  35753. if (status === 404 || status === 0 && /^file:/.test(url)) {
  35754. exception = new MissingPDFException('Missing PDF "' + url + '".');
  35755. } else {
  35756. exception = new UnexpectedResponseException('Unexpected server response (' + status + ') while retrieving PDF "' + url + '".', status);
  35757. }
  35758. this._storedError = exception;
  35759. this._headersReceivedCapability.reject(exception);
  35760. this._requests.forEach(function (requestCapability) {
  35761. requestCapability.reject(exception);
  35762. });
  35763. this._requests = [];
  35764. this._cachedChunks = [];
  35765. },
  35766. _onProgress: function PDFNetworkStreamFullRequestReader_onProgress(data) {
  35767. if (this.onProgress) {
  35768. this.onProgress({
  35769. loaded: data.loaded,
  35770. total: data.lengthComputable ? data.total : this._contentLength
  35771. });
  35772. }
  35773. },
  35774. get isRangeSupported() {
  35775. return this._isRangeSupported;
  35776. },
  35777. get isStreamingSupported() {
  35778. return this._isStreamingSupported;
  35779. },
  35780. get contentLength() {
  35781. return this._contentLength;
  35782. },
  35783. get headersReady() {
  35784. return this._headersReceivedCapability.promise;
  35785. },
  35786. read: function PDFNetworkStreamFullRequestReader_read() {
  35787. if (this._storedError) {
  35788. return Promise.reject(this._storedError);
  35789. }
  35790. if (this._cachedChunks.length > 0) {
  35791. var chunk = this._cachedChunks.shift();
  35792. return Promise.resolve(chunk);
  35793. }
  35794. if (this._done) {
  35795. return Promise.resolve({
  35796. value: undefined,
  35797. done: true
  35798. });
  35799. }
  35800. var requestCapability = createPromiseCapability();
  35801. this._requests.push(requestCapability);
  35802. return requestCapability.promise;
  35803. },
  35804. cancel: function PDFNetworkStreamFullRequestReader_cancel(reason) {
  35805. this._done = true;
  35806. this._headersReceivedCapability.reject(reason);
  35807. this._requests.forEach(function (requestCapability) {
  35808. requestCapability.resolve({
  35809. value: undefined,
  35810. done: true
  35811. });
  35812. });
  35813. this._requests = [];
  35814. if (this._manager.isPendingRequest(this._fullRequestId)) {
  35815. this._manager.abortRequest(this._fullRequestId);
  35816. }
  35817. this._fullRequestReader = null;
  35818. }
  35819. };
  35820. function PDFNetworkStreamRangeRequestReader(manager, begin, end) {
  35821. this._manager = manager;
  35822. var args = {
  35823. onDone: this._onDone.bind(this),
  35824. onProgress: this._onProgress.bind(this)
  35825. };
  35826. this._requestId = manager.requestRange(begin, end, args);
  35827. this._requests = [];
  35828. this._queuedChunk = null;
  35829. this._done = false;
  35830. this.onProgress = null;
  35831. this.onClosed = null;
  35832. }
  35833. PDFNetworkStreamRangeRequestReader.prototype = {
  35834. _close: function PDFNetworkStreamRangeRequestReader_close() {
  35835. if (this.onClosed) {
  35836. this.onClosed(this);
  35837. }
  35838. },
  35839. _onDone: function PDFNetworkStreamRangeRequestReader_onDone(data) {
  35840. var chunk = data.chunk;
  35841. if (this._requests.length > 0) {
  35842. var requestCapability = this._requests.shift();
  35843. requestCapability.resolve({
  35844. value: chunk,
  35845. done: false
  35846. });
  35847. } else {
  35848. this._queuedChunk = chunk;
  35849. }
  35850. this._done = true;
  35851. this._requests.forEach(function (requestCapability) {
  35852. requestCapability.resolve({
  35853. value: undefined,
  35854. done: true
  35855. });
  35856. });
  35857. this._requests = [];
  35858. this._close();
  35859. },
  35860. _onProgress: function PDFNetworkStreamRangeRequestReader_onProgress(evt) {
  35861. if (!this.isStreamingSupported && this.onProgress) {
  35862. this.onProgress({ loaded: evt.loaded });
  35863. }
  35864. },
  35865. get isStreamingSupported() {
  35866. return false;
  35867. },
  35868. read: function PDFNetworkStreamRangeRequestReader_read() {
  35869. if (this._queuedChunk !== null) {
  35870. var chunk = this._queuedChunk;
  35871. this._queuedChunk = null;
  35872. return Promise.resolve({
  35873. value: chunk,
  35874. done: false
  35875. });
  35876. }
  35877. if (this._done) {
  35878. return Promise.resolve({
  35879. value: undefined,
  35880. done: true
  35881. });
  35882. }
  35883. var requestCapability = createPromiseCapability();
  35884. this._requests.push(requestCapability);
  35885. return requestCapability.promise;
  35886. },
  35887. cancel: function PDFNetworkStreamRangeRequestReader_cancel(reason) {
  35888. this._done = true;
  35889. this._requests.forEach(function (requestCapability) {
  35890. requestCapability.resolve({
  35891. value: undefined,
  35892. done: true
  35893. });
  35894. });
  35895. this._requests = [];
  35896. if (this._manager.isPendingRequest(this._requestId)) {
  35897. this._manager.abortRequest(this._requestId);
  35898. }
  35899. this._close();
  35900. }
  35901. };
  35902. coreWorker.setPDFNetworkStreamClass(PDFNetworkStream);
  35903. exports.PDFNetworkStream = PDFNetworkStream;
  35904. exports.NetworkManager = NetworkManager;
  35905. /***/ }),
  35906. /* 19 */
  35907. /***/ (function(module, exports) {
  35908. var g;
  35909. g = function () {
  35910. return this;
  35911. }();
  35912. try {
  35913. g = g || Function("return this")() || (1, eval)("this");
  35914. } catch (e) {
  35915. if (typeof window === "object")
  35916. g = window;
  35917. }
  35918. module.exports = g;
  35919. /***/ }),
  35920. /* 20 */
  35921. /***/ (function(module, exports, __w_pdfjs_require__) {
  35922. "use strict";
  35923. var sharedUtil = __w_pdfjs_require__(0);
  35924. var corePrimitives = __w_pdfjs_require__(1);
  35925. var coreStream = __w_pdfjs_require__(2);
  35926. var coreColorSpace = __w_pdfjs_require__(3);
  35927. var coreObj = __w_pdfjs_require__(15);
  35928. var coreEvaluator = __w_pdfjs_require__(13);
  35929. var AnnotationBorderStyleType = sharedUtil.AnnotationBorderStyleType;
  35930. var AnnotationFieldFlag = sharedUtil.AnnotationFieldFlag;
  35931. var AnnotationFlag = sharedUtil.AnnotationFlag;
  35932. var AnnotationType = sharedUtil.AnnotationType;
  35933. var OPS = sharedUtil.OPS;
  35934. var Util = sharedUtil.Util;
  35935. var isArray = sharedUtil.isArray;
  35936. var isInt = sharedUtil.isInt;
  35937. var stringToBytes = sharedUtil.stringToBytes;
  35938. var stringToPDFString = sharedUtil.stringToPDFString;
  35939. var warn = sharedUtil.warn;
  35940. var Dict = corePrimitives.Dict;
  35941. var isDict = corePrimitives.isDict;
  35942. var isName = corePrimitives.isName;
  35943. var isRef = corePrimitives.isRef;
  35944. var isStream = corePrimitives.isStream;
  35945. var Stream = coreStream.Stream;
  35946. var ColorSpace = coreColorSpace.ColorSpace;
  35947. var Catalog = coreObj.Catalog;
  35948. var ObjectLoader = coreObj.ObjectLoader;
  35949. var FileSpec = coreObj.FileSpec;
  35950. var OperatorList = coreEvaluator.OperatorList;
  35951. function AnnotationFactory() {
  35952. }
  35953. AnnotationFactory.prototype = {
  35954. create: function AnnotationFactory_create(xref, ref, pdfManager, idFactory) {
  35955. var dict = xref.fetchIfRef(ref);
  35956. if (!isDict(dict)) {
  35957. return;
  35958. }
  35959. var id = isRef(ref) ? ref.toString() : 'annot_' + idFactory.createObjId();
  35960. var subtype = dict.get('Subtype');
  35961. subtype = isName(subtype) ? subtype.name : null;
  35962. var parameters = {
  35963. xref: xref,
  35964. dict: dict,
  35965. ref: isRef(ref) ? ref : null,
  35966. subtype: subtype,
  35967. id: id,
  35968. pdfManager: pdfManager
  35969. };
  35970. switch (subtype) {
  35971. case 'Link':
  35972. return new LinkAnnotation(parameters);
  35973. case 'Text':
  35974. return new TextAnnotation(parameters);
  35975. case 'Widget':
  35976. var fieldType = Util.getInheritableProperty(dict, 'FT');
  35977. fieldType = isName(fieldType) ? fieldType.name : null;
  35978. switch (fieldType) {
  35979. case 'Tx':
  35980. return new TextWidgetAnnotation(parameters);
  35981. case 'Btn':
  35982. return new ButtonWidgetAnnotation(parameters);
  35983. case 'Ch':
  35984. return new ChoiceWidgetAnnotation(parameters);
  35985. }
  35986. warn('Unimplemented widget field type "' + fieldType + '", ' + 'falling back to base field type.');
  35987. return new WidgetAnnotation(parameters);
  35988. case 'Popup':
  35989. return new PopupAnnotation(parameters);
  35990. case 'Highlight':
  35991. return new HighlightAnnotation(parameters);
  35992. case 'Underline':
  35993. return new UnderlineAnnotation(parameters);
  35994. case 'Squiggly':
  35995. return new SquigglyAnnotation(parameters);
  35996. case 'StrikeOut':
  35997. return new StrikeOutAnnotation(parameters);
  35998. case 'FileAttachment':
  35999. return new FileAttachmentAnnotation(parameters);
  36000. default:
  36001. if (!subtype) {
  36002. warn('Annotation is missing the required /Subtype.');
  36003. } else {
  36004. warn('Unimplemented annotation type "' + subtype + '", ' + 'falling back to base annotation.');
  36005. }
  36006. return new Annotation(parameters);
  36007. }
  36008. }
  36009. };
  36010. var Annotation = function AnnotationClosure() {
  36011. function getTransformMatrix(rect, bbox, matrix) {
  36012. var bounds = Util.getAxialAlignedBoundingBox(bbox, matrix);
  36013. var minX = bounds[0];
  36014. var minY = bounds[1];
  36015. var maxX = bounds[2];
  36016. var maxY = bounds[3];
  36017. if (minX === maxX || minY === maxY) {
  36018. return [
  36019. 1,
  36020. 0,
  36021. 0,
  36022. 1,
  36023. rect[0],
  36024. rect[1]
  36025. ];
  36026. }
  36027. var xRatio = (rect[2] - rect[0]) / (maxX - minX);
  36028. var yRatio = (rect[3] - rect[1]) / (maxY - minY);
  36029. return [
  36030. xRatio,
  36031. 0,
  36032. 0,
  36033. yRatio,
  36034. rect[0] - minX * xRatio,
  36035. rect[1] - minY * yRatio
  36036. ];
  36037. }
  36038. function Annotation(params) {
  36039. var dict = params.dict;
  36040. this.setFlags(dict.get('F'));
  36041. this.setRectangle(dict.getArray('Rect'));
  36042. this.setColor(dict.getArray('C'));
  36043. this.setBorderStyle(dict);
  36044. this.setAppearance(dict);
  36045. this.data = {};
  36046. this.data.id = params.id;
  36047. this.data.subtype = params.subtype;
  36048. this.data.annotationFlags = this.flags;
  36049. this.data.rect = this.rectangle;
  36050. this.data.color = this.color;
  36051. this.data.borderStyle = this.borderStyle;
  36052. this.data.hasAppearance = !!this.appearance;
  36053. }
  36054. Annotation.prototype = {
  36055. _hasFlag: function Annotation_hasFlag(flags, flag) {
  36056. return !!(flags & flag);
  36057. },
  36058. _isViewable: function Annotation_isViewable(flags) {
  36059. return !this._hasFlag(flags, AnnotationFlag.INVISIBLE) && !this._hasFlag(flags, AnnotationFlag.HIDDEN) && !this._hasFlag(flags, AnnotationFlag.NOVIEW);
  36060. },
  36061. _isPrintable: function AnnotationFlag_isPrintable(flags) {
  36062. return this._hasFlag(flags, AnnotationFlag.PRINT) && !this._hasFlag(flags, AnnotationFlag.INVISIBLE) && !this._hasFlag(flags, AnnotationFlag.HIDDEN);
  36063. },
  36064. get viewable() {
  36065. if (this.flags === 0) {
  36066. return true;
  36067. }
  36068. return this._isViewable(this.flags);
  36069. },
  36070. get printable() {
  36071. if (this.flags === 0) {
  36072. return false;
  36073. }
  36074. return this._isPrintable(this.flags);
  36075. },
  36076. setFlags: function Annotation_setFlags(flags) {
  36077. this.flags = isInt(flags) && flags > 0 ? flags : 0;
  36078. },
  36079. hasFlag: function Annotation_hasFlag(flag) {
  36080. return this._hasFlag(this.flags, flag);
  36081. },
  36082. setRectangle: function Annotation_setRectangle(rectangle) {
  36083. if (isArray(rectangle) && rectangle.length === 4) {
  36084. this.rectangle = Util.normalizeRect(rectangle);
  36085. } else {
  36086. this.rectangle = [
  36087. 0,
  36088. 0,
  36089. 0,
  36090. 0
  36091. ];
  36092. }
  36093. },
  36094. setColor: function Annotation_setColor(color) {
  36095. var rgbColor = new Uint8Array(3);
  36096. if (!isArray(color)) {
  36097. this.color = rgbColor;
  36098. return;
  36099. }
  36100. switch (color.length) {
  36101. case 0:
  36102. this.color = null;
  36103. break;
  36104. case 1:
  36105. ColorSpace.singletons.gray.getRgbItem(color, 0, rgbColor, 0);
  36106. this.color = rgbColor;
  36107. break;
  36108. case 3:
  36109. ColorSpace.singletons.rgb.getRgbItem(color, 0, rgbColor, 0);
  36110. this.color = rgbColor;
  36111. break;
  36112. case 4:
  36113. ColorSpace.singletons.cmyk.getRgbItem(color, 0, rgbColor, 0);
  36114. this.color = rgbColor;
  36115. break;
  36116. default:
  36117. this.color = rgbColor;
  36118. break;
  36119. }
  36120. },
  36121. setBorderStyle: function Annotation_setBorderStyle(borderStyle) {
  36122. this.borderStyle = new AnnotationBorderStyle();
  36123. if (!isDict(borderStyle)) {
  36124. return;
  36125. }
  36126. if (borderStyle.has('BS')) {
  36127. var dict = borderStyle.get('BS');
  36128. var dictType = dict.get('Type');
  36129. if (!dictType || isName(dictType, 'Border')) {
  36130. this.borderStyle.setWidth(dict.get('W'));
  36131. this.borderStyle.setStyle(dict.get('S'));
  36132. this.borderStyle.setDashArray(dict.getArray('D'));
  36133. }
  36134. } else if (borderStyle.has('Border')) {
  36135. var array = borderStyle.getArray('Border');
  36136. if (isArray(array) && array.length >= 3) {
  36137. this.borderStyle.setHorizontalCornerRadius(array[0]);
  36138. this.borderStyle.setVerticalCornerRadius(array[1]);
  36139. this.borderStyle.setWidth(array[2]);
  36140. if (array.length === 4) {
  36141. this.borderStyle.setDashArray(array[3]);
  36142. }
  36143. }
  36144. } else {
  36145. this.borderStyle.setWidth(0);
  36146. }
  36147. },
  36148. setAppearance: function Annotation_setAppearance(dict) {
  36149. this.appearance = null;
  36150. var appearanceStates = dict.get('AP');
  36151. if (!isDict(appearanceStates)) {
  36152. return;
  36153. }
  36154. var normalAppearanceState = appearanceStates.get('N');
  36155. if (isStream(normalAppearanceState)) {
  36156. this.appearance = normalAppearanceState;
  36157. return;
  36158. }
  36159. if (!isDict(normalAppearanceState)) {
  36160. return;
  36161. }
  36162. var as = dict.get('AS');
  36163. if (!isName(as) || !normalAppearanceState.has(as.name)) {
  36164. return;
  36165. }
  36166. this.appearance = normalAppearanceState.get(as.name);
  36167. },
  36168. _preparePopup: function Annotation_preparePopup(dict) {
  36169. if (!dict.has('C')) {
  36170. this.data.color = null;
  36171. }
  36172. this.data.hasPopup = dict.has('Popup');
  36173. this.data.title = stringToPDFString(dict.get('T') || '');
  36174. this.data.contents = stringToPDFString(dict.get('Contents') || '');
  36175. },
  36176. loadResources: function Annotation_loadResources(keys) {
  36177. return new Promise(function (resolve, reject) {
  36178. this.appearance.dict.getAsync('Resources').then(function (resources) {
  36179. if (!resources) {
  36180. resolve();
  36181. return;
  36182. }
  36183. var objectLoader = new ObjectLoader(resources.map, keys, resources.xref);
  36184. objectLoader.load().then(function () {
  36185. resolve(resources);
  36186. }, reject);
  36187. }, reject);
  36188. }.bind(this));
  36189. },
  36190. getOperatorList: function Annotation_getOperatorList(evaluator, task, renderForms) {
  36191. if (!this.appearance) {
  36192. return Promise.resolve(new OperatorList());
  36193. }
  36194. var data = this.data;
  36195. var appearanceDict = this.appearance.dict;
  36196. var resourcesPromise = this.loadResources([
  36197. 'ExtGState',
  36198. 'ColorSpace',
  36199. 'Pattern',
  36200. 'Shading',
  36201. 'XObject',
  36202. 'Font'
  36203. ]);
  36204. var bbox = appearanceDict.getArray('BBox') || [
  36205. 0,
  36206. 0,
  36207. 1,
  36208. 1
  36209. ];
  36210. var matrix = appearanceDict.getArray('Matrix') || [
  36211. 1,
  36212. 0,
  36213. 0,
  36214. 1,
  36215. 0,
  36216. 0
  36217. ];
  36218. var transform = getTransformMatrix(data.rect, bbox, matrix);
  36219. var self = this;
  36220. return resourcesPromise.then(function (resources) {
  36221. var opList = new OperatorList();
  36222. opList.addOp(OPS.beginAnnotation, [
  36223. data.rect,
  36224. transform,
  36225. matrix
  36226. ]);
  36227. return evaluator.getOperatorList(self.appearance, task, resources, opList).then(function () {
  36228. opList.addOp(OPS.endAnnotation, []);
  36229. self.appearance.reset();
  36230. return opList;
  36231. });
  36232. });
  36233. }
  36234. };
  36235. Annotation.appendToOperatorList = function Annotation_appendToOperatorList(annotations, opList, partialEvaluator, task, intent, renderForms) {
  36236. var annotationPromises = [];
  36237. for (var i = 0, n = annotations.length; i < n; ++i) {
  36238. if (intent === 'display' && annotations[i].viewable || intent === 'print' && annotations[i].printable) {
  36239. annotationPromises.push(annotations[i].getOperatorList(partialEvaluator, task, renderForms));
  36240. }
  36241. }
  36242. return Promise.all(annotationPromises).then(function (operatorLists) {
  36243. opList.addOp(OPS.beginAnnotations, []);
  36244. for (var i = 0, n = operatorLists.length; i < n; ++i) {
  36245. opList.addOpList(operatorLists[i]);
  36246. }
  36247. opList.addOp(OPS.endAnnotations, []);
  36248. });
  36249. };
  36250. return Annotation;
  36251. }();
  36252. var AnnotationBorderStyle = function AnnotationBorderStyleClosure() {
  36253. function AnnotationBorderStyle() {
  36254. this.width = 1;
  36255. this.style = AnnotationBorderStyleType.SOLID;
  36256. this.dashArray = [3];
  36257. this.horizontalCornerRadius = 0;
  36258. this.verticalCornerRadius = 0;
  36259. }
  36260. AnnotationBorderStyle.prototype = {
  36261. setWidth: function AnnotationBorderStyle_setWidth(width) {
  36262. if (width === (width | 0)) {
  36263. this.width = width;
  36264. }
  36265. },
  36266. setStyle: function AnnotationBorderStyle_setStyle(style) {
  36267. if (!style) {
  36268. return;
  36269. }
  36270. switch (style.name) {
  36271. case 'S':
  36272. this.style = AnnotationBorderStyleType.SOLID;
  36273. break;
  36274. case 'D':
  36275. this.style = AnnotationBorderStyleType.DASHED;
  36276. break;
  36277. case 'B':
  36278. this.style = AnnotationBorderStyleType.BEVELED;
  36279. break;
  36280. case 'I':
  36281. this.style = AnnotationBorderStyleType.INSET;
  36282. break;
  36283. case 'U':
  36284. this.style = AnnotationBorderStyleType.UNDERLINE;
  36285. break;
  36286. default:
  36287. break;
  36288. }
  36289. },
  36290. setDashArray: function AnnotationBorderStyle_setDashArray(dashArray) {
  36291. if (isArray(dashArray) && dashArray.length > 0) {
  36292. var isValid = true;
  36293. var allZeros = true;
  36294. for (var i = 0, len = dashArray.length; i < len; i++) {
  36295. var element = dashArray[i];
  36296. var validNumber = +element >= 0;
  36297. if (!validNumber) {
  36298. isValid = false;
  36299. break;
  36300. } else if (element > 0) {
  36301. allZeros = false;
  36302. }
  36303. }
  36304. if (isValid && !allZeros) {
  36305. this.dashArray = dashArray;
  36306. } else {
  36307. this.width = 0;
  36308. }
  36309. } else if (dashArray) {
  36310. this.width = 0;
  36311. }
  36312. },
  36313. setHorizontalCornerRadius: function AnnotationBorderStyle_setHorizontalCornerRadius(radius) {
  36314. if (radius === (radius | 0)) {
  36315. this.horizontalCornerRadius = radius;
  36316. }
  36317. },
  36318. setVerticalCornerRadius: function AnnotationBorderStyle_setVerticalCornerRadius(radius) {
  36319. if (radius === (radius | 0)) {
  36320. this.verticalCornerRadius = radius;
  36321. }
  36322. }
  36323. };
  36324. return AnnotationBorderStyle;
  36325. }();
  36326. var WidgetAnnotation = function WidgetAnnotationClosure() {
  36327. function WidgetAnnotation(params) {
  36328. Annotation.call(this, params);
  36329. var dict = params.dict;
  36330. var data = this.data;
  36331. data.annotationType = AnnotationType.WIDGET;
  36332. data.fieldName = this._constructFieldName(dict);
  36333. data.fieldValue = Util.getInheritableProperty(dict, 'V', true);
  36334. data.alternativeText = stringToPDFString(dict.get('TU') || '');
  36335. data.defaultAppearance = Util.getInheritableProperty(dict, 'DA') || '';
  36336. var fieldType = Util.getInheritableProperty(dict, 'FT');
  36337. data.fieldType = isName(fieldType) ? fieldType.name : null;
  36338. this.fieldResources = Util.getInheritableProperty(dict, 'DR') || Dict.empty;
  36339. data.fieldFlags = Util.getInheritableProperty(dict, 'Ff');
  36340. if (!isInt(data.fieldFlags) || data.fieldFlags < 0) {
  36341. data.fieldFlags = 0;
  36342. }
  36343. data.readOnly = this.hasFieldFlag(AnnotationFieldFlag.READONLY);
  36344. if (data.fieldType === 'Sig') {
  36345. this.setFlags(AnnotationFlag.HIDDEN);
  36346. }
  36347. }
  36348. Util.inherit(WidgetAnnotation, Annotation, {
  36349. _constructFieldName: function WidgetAnnotation_constructFieldName(dict) {
  36350. if (!dict.has('T') && !dict.has('Parent')) {
  36351. warn('Unknown field name, falling back to empty field name.');
  36352. return '';
  36353. }
  36354. if (!dict.has('Parent')) {
  36355. return stringToPDFString(dict.get('T'));
  36356. }
  36357. var fieldName = [];
  36358. if (dict.has('T')) {
  36359. fieldName.unshift(stringToPDFString(dict.get('T')));
  36360. }
  36361. var loopDict = dict;
  36362. while (loopDict.has('Parent')) {
  36363. loopDict = loopDict.get('Parent');
  36364. if (loopDict.has('T')) {
  36365. fieldName.unshift(stringToPDFString(loopDict.get('T')));
  36366. }
  36367. }
  36368. return fieldName.join('.');
  36369. },
  36370. hasFieldFlag: function WidgetAnnotation_hasFieldFlag(flag) {
  36371. return !!(this.data.fieldFlags & flag);
  36372. }
  36373. });
  36374. return WidgetAnnotation;
  36375. }();
  36376. var TextWidgetAnnotation = function TextWidgetAnnotationClosure() {
  36377. function TextWidgetAnnotation(params) {
  36378. WidgetAnnotation.call(this, params);
  36379. this.data.fieldValue = stringToPDFString(this.data.fieldValue || '');
  36380. var alignment = Util.getInheritableProperty(params.dict, 'Q');
  36381. if (!isInt(alignment) || alignment < 0 || alignment > 2) {
  36382. alignment = null;
  36383. }
  36384. this.data.textAlignment = alignment;
  36385. var maximumLength = Util.getInheritableProperty(params.dict, 'MaxLen');
  36386. if (!isInt(maximumLength) || maximumLength < 0) {
  36387. maximumLength = null;
  36388. }
  36389. this.data.maxLen = maximumLength;
  36390. this.data.multiLine = this.hasFieldFlag(AnnotationFieldFlag.MULTILINE);
  36391. this.data.comb = this.hasFieldFlag(AnnotationFieldFlag.COMB) && !this.hasFieldFlag(AnnotationFieldFlag.MULTILINE) && !this.hasFieldFlag(AnnotationFieldFlag.PASSWORD) && !this.hasFieldFlag(AnnotationFieldFlag.FILESELECT) && this.data.maxLen !== null;
  36392. }
  36393. Util.inherit(TextWidgetAnnotation, WidgetAnnotation, {
  36394. getOperatorList: function TextWidgetAnnotation_getOperatorList(evaluator, task, renderForms) {
  36395. var operatorList = new OperatorList();
  36396. if (renderForms) {
  36397. return Promise.resolve(operatorList);
  36398. }
  36399. if (this.appearance) {
  36400. return Annotation.prototype.getOperatorList.call(this, evaluator, task, renderForms);
  36401. }
  36402. if (!this.data.defaultAppearance) {
  36403. return Promise.resolve(operatorList);
  36404. }
  36405. var stream = new Stream(stringToBytes(this.data.defaultAppearance));
  36406. return evaluator.getOperatorList(stream, task, this.fieldResources, operatorList).then(function () {
  36407. return operatorList;
  36408. });
  36409. }
  36410. });
  36411. return TextWidgetAnnotation;
  36412. }();
  36413. var ButtonWidgetAnnotation = function ButtonWidgetAnnotationClosure() {
  36414. function ButtonWidgetAnnotation(params) {
  36415. WidgetAnnotation.call(this, params);
  36416. this.data.checkBox = !this.hasFieldFlag(AnnotationFieldFlag.RADIO) && !this.hasFieldFlag(AnnotationFieldFlag.PUSHBUTTON);
  36417. if (this.data.checkBox) {
  36418. if (!isName(this.data.fieldValue)) {
  36419. return;
  36420. }
  36421. this.data.fieldValue = this.data.fieldValue.name;
  36422. }
  36423. this.data.radioButton = this.hasFieldFlag(AnnotationFieldFlag.RADIO) && !this.hasFieldFlag(AnnotationFieldFlag.PUSHBUTTON);
  36424. if (this.data.radioButton) {
  36425. this.data.fieldValue = this.data.buttonValue = null;
  36426. var fieldParent = params.dict.get('Parent');
  36427. if (isDict(fieldParent) && fieldParent.has('V')) {
  36428. var fieldParentValue = fieldParent.get('V');
  36429. if (isName(fieldParentValue)) {
  36430. this.data.fieldValue = fieldParentValue.name;
  36431. }
  36432. }
  36433. var appearanceStates = params.dict.get('AP');
  36434. if (!isDict(appearanceStates)) {
  36435. return;
  36436. }
  36437. var normalAppearanceState = appearanceStates.get('N');
  36438. if (!isDict(normalAppearanceState)) {
  36439. return;
  36440. }
  36441. var keys = normalAppearanceState.getKeys();
  36442. for (var i = 0, ii = keys.length; i < ii; i++) {
  36443. if (keys[i] !== 'Off') {
  36444. this.data.buttonValue = keys[i];
  36445. break;
  36446. }
  36447. }
  36448. }
  36449. }
  36450. Util.inherit(ButtonWidgetAnnotation, WidgetAnnotation, {
  36451. getOperatorList: function ButtonWidgetAnnotation_getOperatorList(evaluator, task, renderForms) {
  36452. var operatorList = new OperatorList();
  36453. if (renderForms) {
  36454. return Promise.resolve(operatorList);
  36455. }
  36456. if (this.appearance) {
  36457. return Annotation.prototype.getOperatorList.call(this, evaluator, task, renderForms);
  36458. }
  36459. return Promise.resolve(operatorList);
  36460. }
  36461. });
  36462. return ButtonWidgetAnnotation;
  36463. }();
  36464. var ChoiceWidgetAnnotation = function ChoiceWidgetAnnotationClosure() {
  36465. function ChoiceWidgetAnnotation(params) {
  36466. WidgetAnnotation.call(this, params);
  36467. this.data.options = [];
  36468. var options = params.dict.get('Opt');
  36469. if (isArray(options)) {
  36470. var xref = params.xref;
  36471. for (var i = 0, ii = options.length; i < ii; i++) {
  36472. var option = xref.fetchIfRef(options[i]);
  36473. var isOptionArray = isArray(option);
  36474. this.data.options[i] = {
  36475. exportValue: isOptionArray ? xref.fetchIfRef(option[0]) : option,
  36476. displayValue: isOptionArray ? xref.fetchIfRef(option[1]) : option
  36477. };
  36478. }
  36479. }
  36480. if (!isArray(this.data.fieldValue)) {
  36481. this.data.fieldValue = [this.data.fieldValue];
  36482. }
  36483. this.data.combo = this.hasFieldFlag(AnnotationFieldFlag.COMBO);
  36484. this.data.multiSelect = this.hasFieldFlag(AnnotationFieldFlag.MULTISELECT);
  36485. }
  36486. Util.inherit(ChoiceWidgetAnnotation, WidgetAnnotation, {
  36487. getOperatorList: function ChoiceWidgetAnnotation_getOperatorList(evaluator, task, renderForms) {
  36488. var operatorList = new OperatorList();
  36489. if (renderForms) {
  36490. return Promise.resolve(operatorList);
  36491. }
  36492. return Annotation.prototype.getOperatorList.call(this, evaluator, task, renderForms);
  36493. }
  36494. });
  36495. return ChoiceWidgetAnnotation;
  36496. }();
  36497. var TextAnnotation = function TextAnnotationClosure() {
  36498. var DEFAULT_ICON_SIZE = 22;
  36499. function TextAnnotation(parameters) {
  36500. Annotation.call(this, parameters);
  36501. this.data.annotationType = AnnotationType.TEXT;
  36502. if (this.data.hasAppearance) {
  36503. this.data.name = 'NoIcon';
  36504. } else {
  36505. this.data.rect[1] = this.data.rect[3] - DEFAULT_ICON_SIZE;
  36506. this.data.rect[2] = this.data.rect[0] + DEFAULT_ICON_SIZE;
  36507. this.data.name = parameters.dict.has('Name') ? parameters.dict.get('Name').name : 'Note';
  36508. }
  36509. this._preparePopup(parameters.dict);
  36510. }
  36511. Util.inherit(TextAnnotation, Annotation, {});
  36512. return TextAnnotation;
  36513. }();
  36514. var LinkAnnotation = function LinkAnnotationClosure() {
  36515. function LinkAnnotation(params) {
  36516. Annotation.call(this, params);
  36517. var data = this.data;
  36518. data.annotationType = AnnotationType.LINK;
  36519. Catalog.parseDestDictionary({
  36520. destDict: params.dict,
  36521. resultObj: data,
  36522. docBaseUrl: params.pdfManager.docBaseUrl
  36523. });
  36524. }
  36525. Util.inherit(LinkAnnotation, Annotation, {});
  36526. return LinkAnnotation;
  36527. }();
  36528. var PopupAnnotation = function PopupAnnotationClosure() {
  36529. function PopupAnnotation(parameters) {
  36530. Annotation.call(this, parameters);
  36531. this.data.annotationType = AnnotationType.POPUP;
  36532. var dict = parameters.dict;
  36533. var parentItem = dict.get('Parent');
  36534. if (!parentItem) {
  36535. warn('Popup annotation has a missing or invalid parent annotation.');
  36536. return;
  36537. }
  36538. this.data.parentId = dict.getRaw('Parent').toString();
  36539. this.data.title = stringToPDFString(parentItem.get('T') || '');
  36540. this.data.contents = stringToPDFString(parentItem.get('Contents') || '');
  36541. if (!parentItem.has('C')) {
  36542. this.data.color = null;
  36543. } else {
  36544. this.setColor(parentItem.getArray('C'));
  36545. this.data.color = this.color;
  36546. }
  36547. if (!this.viewable) {
  36548. var parentFlags = parentItem.get('F');
  36549. if (this._isViewable(parentFlags)) {
  36550. this.setFlags(parentFlags);
  36551. }
  36552. }
  36553. }
  36554. Util.inherit(PopupAnnotation, Annotation, {});
  36555. return PopupAnnotation;
  36556. }();
  36557. var HighlightAnnotation = function HighlightAnnotationClosure() {
  36558. function HighlightAnnotation(parameters) {
  36559. Annotation.call(this, parameters);
  36560. this.data.annotationType = AnnotationType.HIGHLIGHT;
  36561. this._preparePopup(parameters.dict);
  36562. this.data.borderStyle.setWidth(0);
  36563. }
  36564. Util.inherit(HighlightAnnotation, Annotation, {});
  36565. return HighlightAnnotation;
  36566. }();
  36567. var UnderlineAnnotation = function UnderlineAnnotationClosure() {
  36568. function UnderlineAnnotation(parameters) {
  36569. Annotation.call(this, parameters);
  36570. this.data.annotationType = AnnotationType.UNDERLINE;
  36571. this._preparePopup(parameters.dict);
  36572. this.data.borderStyle.setWidth(0);
  36573. }
  36574. Util.inherit(UnderlineAnnotation, Annotation, {});
  36575. return UnderlineAnnotation;
  36576. }();
  36577. var SquigglyAnnotation = function SquigglyAnnotationClosure() {
  36578. function SquigglyAnnotation(parameters) {
  36579. Annotation.call(this, parameters);
  36580. this.data.annotationType = AnnotationType.SQUIGGLY;
  36581. this._preparePopup(parameters.dict);
  36582. this.data.borderStyle.setWidth(0);
  36583. }
  36584. Util.inherit(SquigglyAnnotation, Annotation, {});
  36585. return SquigglyAnnotation;
  36586. }();
  36587. var StrikeOutAnnotation = function StrikeOutAnnotationClosure() {
  36588. function StrikeOutAnnotation(parameters) {
  36589. Annotation.call(this, parameters);
  36590. this.data.annotationType = AnnotationType.STRIKEOUT;
  36591. this._preparePopup(parameters.dict);
  36592. this.data.borderStyle.setWidth(0);
  36593. }
  36594. Util.inherit(StrikeOutAnnotation, Annotation, {});
  36595. return StrikeOutAnnotation;
  36596. }();
  36597. var FileAttachmentAnnotation = function FileAttachmentAnnotationClosure() {
  36598. function FileAttachmentAnnotation(parameters) {
  36599. Annotation.call(this, parameters);
  36600. var file = new FileSpec(parameters.dict.get('FS'), parameters.xref);
  36601. this.data.annotationType = AnnotationType.FILEATTACHMENT;
  36602. this.data.file = file.serializable;
  36603. this._preparePopup(parameters.dict);
  36604. }
  36605. Util.inherit(FileAttachmentAnnotation, Annotation, {});
  36606. return FileAttachmentAnnotation;
  36607. }();
  36608. exports.Annotation = Annotation;
  36609. exports.AnnotationBorderStyle = AnnotationBorderStyle;
  36610. exports.AnnotationFactory = AnnotationFactory;
  36611. /***/ }),
  36612. /* 21 */
  36613. /***/ (function(module, exports, __w_pdfjs_require__) {
  36614. "use strict";
  36615. var sharedUtil = __w_pdfjs_require__(0);
  36616. var warn = sharedUtil.warn;
  36617. var baseTypes = [
  36618. 'BN',
  36619. 'BN',
  36620. 'BN',
  36621. 'BN',
  36622. 'BN',
  36623. 'BN',
  36624. 'BN',
  36625. 'BN',
  36626. 'BN',
  36627. 'S',
  36628. 'B',
  36629. 'S',
  36630. 'WS',
  36631. 'B',
  36632. 'BN',
  36633. 'BN',
  36634. 'BN',
  36635. 'BN',
  36636. 'BN',
  36637. 'BN',
  36638. 'BN',
  36639. 'BN',
  36640. 'BN',
  36641. 'BN',
  36642. 'BN',
  36643. 'BN',
  36644. 'BN',
  36645. 'BN',
  36646. 'B',
  36647. 'B',
  36648. 'B',
  36649. 'S',
  36650. 'WS',
  36651. 'ON',
  36652. 'ON',
  36653. 'ET',
  36654. 'ET',
  36655. 'ET',
  36656. 'ON',
  36657. 'ON',
  36658. 'ON',
  36659. 'ON',
  36660. 'ON',
  36661. 'ES',
  36662. 'CS',
  36663. 'ES',
  36664. 'CS',
  36665. 'CS',
  36666. 'EN',
  36667. 'EN',
  36668. 'EN',
  36669. 'EN',
  36670. 'EN',
  36671. 'EN',
  36672. 'EN',
  36673. 'EN',
  36674. 'EN',
  36675. 'EN',
  36676. 'CS',
  36677. 'ON',
  36678. 'ON',
  36679. 'ON',
  36680. 'ON',
  36681. 'ON',
  36682. 'ON',
  36683. 'L',
  36684. 'L',
  36685. 'L',
  36686. 'L',
  36687. 'L',
  36688. 'L',
  36689. 'L',
  36690. 'L',
  36691. 'L',
  36692. 'L',
  36693. 'L',
  36694. 'L',
  36695. 'L',
  36696. 'L',
  36697. 'L',
  36698. 'L',
  36699. 'L',
  36700. 'L',
  36701. 'L',
  36702. 'L',
  36703. 'L',
  36704. 'L',
  36705. 'L',
  36706. 'L',
  36707. 'L',
  36708. 'L',
  36709. 'ON',
  36710. 'ON',
  36711. 'ON',
  36712. 'ON',
  36713. 'ON',
  36714. 'ON',
  36715. 'L',
  36716. 'L',
  36717. 'L',
  36718. 'L',
  36719. 'L',
  36720. 'L',
  36721. 'L',
  36722. 'L',
  36723. 'L',
  36724. 'L',
  36725. 'L',
  36726. 'L',
  36727. 'L',
  36728. 'L',
  36729. 'L',
  36730. 'L',
  36731. 'L',
  36732. 'L',
  36733. 'L',
  36734. 'L',
  36735. 'L',
  36736. 'L',
  36737. 'L',
  36738. 'L',
  36739. 'L',
  36740. 'L',
  36741. 'ON',
  36742. 'ON',
  36743. 'ON',
  36744. 'ON',
  36745. 'BN',
  36746. 'BN',
  36747. 'BN',
  36748. 'BN',
  36749. 'BN',
  36750. 'BN',
  36751. 'B',
  36752. 'BN',
  36753. 'BN',
  36754. 'BN',
  36755. 'BN',
  36756. 'BN',
  36757. 'BN',
  36758. 'BN',
  36759. 'BN',
  36760. 'BN',
  36761. 'BN',
  36762. 'BN',
  36763. 'BN',
  36764. 'BN',
  36765. 'BN',
  36766. 'BN',
  36767. 'BN',
  36768. 'BN',
  36769. 'BN',
  36770. 'BN',
  36771. 'BN',
  36772. 'BN',
  36773. 'BN',
  36774. 'BN',
  36775. 'BN',
  36776. 'BN',
  36777. 'BN',
  36778. 'CS',
  36779. 'ON',
  36780. 'ET',
  36781. 'ET',
  36782. 'ET',
  36783. 'ET',
  36784. 'ON',
  36785. 'ON',
  36786. 'ON',
  36787. 'ON',
  36788. 'L',
  36789. 'ON',
  36790. 'ON',
  36791. 'BN',
  36792. 'ON',
  36793. 'ON',
  36794. 'ET',
  36795. 'ET',
  36796. 'EN',
  36797. 'EN',
  36798. 'ON',
  36799. 'L',
  36800. 'ON',
  36801. 'ON',
  36802. 'ON',
  36803. 'EN',
  36804. 'L',
  36805. 'ON',
  36806. 'ON',
  36807. 'ON',
  36808. 'ON',
  36809. 'ON',
  36810. 'L',
  36811. 'L',
  36812. 'L',
  36813. 'L',
  36814. 'L',
  36815. 'L',
  36816. 'L',
  36817. 'L',
  36818. 'L',
  36819. 'L',
  36820. 'L',
  36821. 'L',
  36822. 'L',
  36823. 'L',
  36824. 'L',
  36825. 'L',
  36826. 'L',
  36827. 'L',
  36828. 'L',
  36829. 'L',
  36830. 'L',
  36831. 'L',
  36832. 'L',
  36833. 'ON',
  36834. 'L',
  36835. 'L',
  36836. 'L',
  36837. 'L',
  36838. 'L',
  36839. 'L',
  36840. 'L',
  36841. 'L',
  36842. 'L',
  36843. 'L',
  36844. 'L',
  36845. 'L',
  36846. 'L',
  36847. 'L',
  36848. 'L',
  36849. 'L',
  36850. 'L',
  36851. 'L',
  36852. 'L',
  36853. 'L',
  36854. 'L',
  36855. 'L',
  36856. 'L',
  36857. 'L',
  36858. 'L',
  36859. 'L',
  36860. 'L',
  36861. 'L',
  36862. 'L',
  36863. 'L',
  36864. 'L',
  36865. 'ON',
  36866. 'L',
  36867. 'L',
  36868. 'L',
  36869. 'L',
  36870. 'L',
  36871. 'L',
  36872. 'L',
  36873. 'L'
  36874. ];
  36875. var arabicTypes = [
  36876. 'AN',
  36877. 'AN',
  36878. 'AN',
  36879. 'AN',
  36880. 'AN',
  36881. 'AN',
  36882. 'ON',
  36883. 'ON',
  36884. 'AL',
  36885. 'ET',
  36886. 'ET',
  36887. 'AL',
  36888. 'CS',
  36889. 'AL',
  36890. 'ON',
  36891. 'ON',
  36892. 'NSM',
  36893. 'NSM',
  36894. 'NSM',
  36895. 'NSM',
  36896. 'NSM',
  36897. 'NSM',
  36898. 'NSM',
  36899. 'NSM',
  36900. 'NSM',
  36901. 'NSM',
  36902. 'NSM',
  36903. 'AL',
  36904. 'AL',
  36905. '',
  36906. 'AL',
  36907. 'AL',
  36908. 'AL',
  36909. 'AL',
  36910. 'AL',
  36911. 'AL',
  36912. 'AL',
  36913. 'AL',
  36914. 'AL',
  36915. 'AL',
  36916. 'AL',
  36917. 'AL',
  36918. 'AL',
  36919. 'AL',
  36920. 'AL',
  36921. 'AL',
  36922. 'AL',
  36923. 'AL',
  36924. 'AL',
  36925. 'AL',
  36926. 'AL',
  36927. 'AL',
  36928. 'AL',
  36929. 'AL',
  36930. 'AL',
  36931. 'AL',
  36932. 'AL',
  36933. 'AL',
  36934. 'AL',
  36935. 'AL',
  36936. 'AL',
  36937. 'AL',
  36938. 'AL',
  36939. 'AL',
  36940. 'AL',
  36941. 'AL',
  36942. 'AL',
  36943. 'AL',
  36944. 'AL',
  36945. 'AL',
  36946. 'AL',
  36947. 'AL',
  36948. 'AL',
  36949. 'AL',
  36950. 'AL',
  36951. 'NSM',
  36952. 'NSM',
  36953. 'NSM',
  36954. 'NSM',
  36955. 'NSM',
  36956. 'NSM',
  36957. 'NSM',
  36958. 'NSM',
  36959. 'NSM',
  36960. 'NSM',
  36961. 'NSM',
  36962. 'NSM',
  36963. 'NSM',
  36964. 'NSM',
  36965. 'NSM',
  36966. 'NSM',
  36967. 'NSM',
  36968. 'NSM',
  36969. 'NSM',
  36970. 'NSM',
  36971. 'NSM',
  36972. 'AN',
  36973. 'AN',
  36974. 'AN',
  36975. 'AN',
  36976. 'AN',
  36977. 'AN',
  36978. 'AN',
  36979. 'AN',
  36980. 'AN',
  36981. 'AN',
  36982. 'ET',
  36983. 'AN',
  36984. 'AN',
  36985. 'AL',
  36986. 'AL',
  36987. 'AL',
  36988. 'NSM',
  36989. 'AL',
  36990. 'AL',
  36991. 'AL',
  36992. 'AL',
  36993. 'AL',
  36994. 'AL',
  36995. 'AL',
  36996. 'AL',
  36997. 'AL',
  36998. 'AL',
  36999. 'AL',
  37000. 'AL',
  37001. 'AL',
  37002. 'AL',
  37003. 'AL',
  37004. 'AL',
  37005. 'AL',
  37006. 'AL',
  37007. 'AL',
  37008. 'AL',
  37009. 'AL',
  37010. 'AL',
  37011. 'AL',
  37012. 'AL',
  37013. 'AL',
  37014. 'AL',
  37015. 'AL',
  37016. 'AL',
  37017. 'AL',
  37018. 'AL',
  37019. 'AL',
  37020. 'AL',
  37021. 'AL',
  37022. 'AL',
  37023. 'AL',
  37024. 'AL',
  37025. 'AL',
  37026. 'AL',
  37027. 'AL',
  37028. 'AL',
  37029. 'AL',
  37030. 'AL',
  37031. 'AL',
  37032. 'AL',
  37033. 'AL',
  37034. 'AL',
  37035. 'AL',
  37036. 'AL',
  37037. 'AL',
  37038. 'AL',
  37039. 'AL',
  37040. 'AL',
  37041. 'AL',
  37042. 'AL',
  37043. 'AL',
  37044. 'AL',
  37045. 'AL',
  37046. 'AL',
  37047. 'AL',
  37048. 'AL',
  37049. 'AL',
  37050. 'AL',
  37051. 'AL',
  37052. 'AL',
  37053. 'AL',
  37054. 'AL',
  37055. 'AL',
  37056. 'AL',
  37057. 'AL',
  37058. 'AL',
  37059. 'AL',
  37060. 'AL',
  37061. 'AL',
  37062. 'AL',
  37063. 'AL',
  37064. 'AL',
  37065. 'AL',
  37066. 'AL',
  37067. 'AL',
  37068. 'AL',
  37069. 'AL',
  37070. 'AL',
  37071. 'AL',
  37072. 'AL',
  37073. 'AL',
  37074. 'AL',
  37075. 'AL',
  37076. 'AL',
  37077. 'AL',
  37078. 'AL',
  37079. 'AL',
  37080. 'AL',
  37081. 'AL',
  37082. 'AL',
  37083. 'AL',
  37084. 'AL',
  37085. 'AL',
  37086. 'AL',
  37087. 'AL',
  37088. 'AL',
  37089. 'AL',
  37090. 'NSM',
  37091. 'NSM',
  37092. 'NSM',
  37093. 'NSM',
  37094. 'NSM',
  37095. 'NSM',
  37096. 'NSM',
  37097. 'AN',
  37098. 'ON',
  37099. 'NSM',
  37100. 'NSM',
  37101. 'NSM',
  37102. 'NSM',
  37103. 'NSM',
  37104. 'NSM',
  37105. 'AL',
  37106. 'AL',
  37107. 'NSM',
  37108. 'NSM',
  37109. 'ON',
  37110. 'NSM',
  37111. 'NSM',
  37112. 'NSM',
  37113. 'NSM',
  37114. 'AL',
  37115. 'AL',
  37116. 'EN',
  37117. 'EN',
  37118. 'EN',
  37119. 'EN',
  37120. 'EN',
  37121. 'EN',
  37122. 'EN',
  37123. 'EN',
  37124. 'EN',
  37125. 'EN',
  37126. 'AL',
  37127. 'AL',
  37128. 'AL',
  37129. 'AL',
  37130. 'AL',
  37131. 'AL'
  37132. ];
  37133. function isOdd(i) {
  37134. return (i & 1) !== 0;
  37135. }
  37136. function isEven(i) {
  37137. return (i & 1) === 0;
  37138. }
  37139. function findUnequal(arr, start, value) {
  37140. for (var j = start, jj = arr.length; j < jj; ++j) {
  37141. if (arr[j] !== value) {
  37142. return j;
  37143. }
  37144. }
  37145. return j;
  37146. }
  37147. function setValues(arr, start, end, value) {
  37148. for (var j = start; j < end; ++j) {
  37149. arr[j] = value;
  37150. }
  37151. }
  37152. function reverseValues(arr, start, end) {
  37153. for (var i = start, j = end - 1; i < j; ++i, --j) {
  37154. var temp = arr[i];
  37155. arr[i] = arr[j];
  37156. arr[j] = temp;
  37157. }
  37158. }
  37159. function createBidiText(str, isLTR, vertical) {
  37160. return {
  37161. str: str,
  37162. dir: vertical ? 'ttb' : isLTR ? 'ltr' : 'rtl'
  37163. };
  37164. }
  37165. var chars = [];
  37166. var types = [];
  37167. function bidi(str, startLevel, vertical) {
  37168. var isLTR = true;
  37169. var strLength = str.length;
  37170. if (strLength === 0 || vertical) {
  37171. return createBidiText(str, isLTR, vertical);
  37172. }
  37173. chars.length = strLength;
  37174. types.length = strLength;
  37175. var numBidi = 0;
  37176. var i, ii;
  37177. for (i = 0; i < strLength; ++i) {
  37178. chars[i] = str.charAt(i);
  37179. var charCode = str.charCodeAt(i);
  37180. var charType = 'L';
  37181. if (charCode <= 0x00ff) {
  37182. charType = baseTypes[charCode];
  37183. } else if (0x0590 <= charCode && charCode <= 0x05f4) {
  37184. charType = 'R';
  37185. } else if (0x0600 <= charCode && charCode <= 0x06ff) {
  37186. charType = arabicTypes[charCode & 0xff];
  37187. if (!charType) {
  37188. warn('Bidi: invalid Unicode character ' + charCode.toString(16));
  37189. }
  37190. } else if (0x0700 <= charCode && charCode <= 0x08AC) {
  37191. charType = 'AL';
  37192. }
  37193. if (charType === 'R' || charType === 'AL' || charType === 'AN') {
  37194. numBidi++;
  37195. }
  37196. types[i] = charType;
  37197. }
  37198. if (numBidi === 0) {
  37199. isLTR = true;
  37200. return createBidiText(str, isLTR);
  37201. }
  37202. if (startLevel === -1) {
  37203. if (numBidi / strLength < 0.3) {
  37204. isLTR = true;
  37205. startLevel = 0;
  37206. } else {
  37207. isLTR = false;
  37208. startLevel = 1;
  37209. }
  37210. }
  37211. var levels = [];
  37212. for (i = 0; i < strLength; ++i) {
  37213. levels[i] = startLevel;
  37214. }
  37215. var e = isOdd(startLevel) ? 'R' : 'L';
  37216. var sor = e;
  37217. var eor = sor;
  37218. var lastType = sor;
  37219. for (i = 0; i < strLength; ++i) {
  37220. if (types[i] === 'NSM') {
  37221. types[i] = lastType;
  37222. } else {
  37223. lastType = types[i];
  37224. }
  37225. }
  37226. lastType = sor;
  37227. var t;
  37228. for (i = 0; i < strLength; ++i) {
  37229. t = types[i];
  37230. if (t === 'EN') {
  37231. types[i] = lastType === 'AL' ? 'AN' : 'EN';
  37232. } else if (t === 'R' || t === 'L' || t === 'AL') {
  37233. lastType = t;
  37234. }
  37235. }
  37236. for (i = 0; i < strLength; ++i) {
  37237. t = types[i];
  37238. if (t === 'AL') {
  37239. types[i] = 'R';
  37240. }
  37241. }
  37242. for (i = 1; i < strLength - 1; ++i) {
  37243. if (types[i] === 'ES' && types[i - 1] === 'EN' && types[i + 1] === 'EN') {
  37244. types[i] = 'EN';
  37245. }
  37246. if (types[i] === 'CS' && (types[i - 1] === 'EN' || types[i - 1] === 'AN') && types[i + 1] === types[i - 1]) {
  37247. types[i] = types[i - 1];
  37248. }
  37249. }
  37250. for (i = 0; i < strLength; ++i) {
  37251. if (types[i] === 'EN') {
  37252. var j;
  37253. for (j = i - 1; j >= 0; --j) {
  37254. if (types[j] !== 'ET') {
  37255. break;
  37256. }
  37257. types[j] = 'EN';
  37258. }
  37259. for (j = i + 1; j < strLength; ++j) {
  37260. if (types[j] !== 'ET') {
  37261. break;
  37262. }
  37263. types[j] = 'EN';
  37264. }
  37265. }
  37266. }
  37267. for (i = 0; i < strLength; ++i) {
  37268. t = types[i];
  37269. if (t === 'WS' || t === 'ES' || t === 'ET' || t === 'CS') {
  37270. types[i] = 'ON';
  37271. }
  37272. }
  37273. lastType = sor;
  37274. for (i = 0; i < strLength; ++i) {
  37275. t = types[i];
  37276. if (t === 'EN') {
  37277. types[i] = lastType === 'L' ? 'L' : 'EN';
  37278. } else if (t === 'R' || t === 'L') {
  37279. lastType = t;
  37280. }
  37281. }
  37282. for (i = 0; i < strLength; ++i) {
  37283. if (types[i] === 'ON') {
  37284. var end = findUnequal(types, i + 1, 'ON');
  37285. var before = sor;
  37286. if (i > 0) {
  37287. before = types[i - 1];
  37288. }
  37289. var after = eor;
  37290. if (end + 1 < strLength) {
  37291. after = types[end + 1];
  37292. }
  37293. if (before !== 'L') {
  37294. before = 'R';
  37295. }
  37296. if (after !== 'L') {
  37297. after = 'R';
  37298. }
  37299. if (before === after) {
  37300. setValues(types, i, end, before);
  37301. }
  37302. i = end - 1;
  37303. }
  37304. }
  37305. for (i = 0; i < strLength; ++i) {
  37306. if (types[i] === 'ON') {
  37307. types[i] = e;
  37308. }
  37309. }
  37310. for (i = 0; i < strLength; ++i) {
  37311. t = types[i];
  37312. if (isEven(levels[i])) {
  37313. if (t === 'R') {
  37314. levels[i] += 1;
  37315. } else if (t === 'AN' || t === 'EN') {
  37316. levels[i] += 2;
  37317. }
  37318. } else {
  37319. if (t === 'L' || t === 'AN' || t === 'EN') {
  37320. levels[i] += 1;
  37321. }
  37322. }
  37323. }
  37324. var highestLevel = -1;
  37325. var lowestOddLevel = 99;
  37326. var level;
  37327. for (i = 0, ii = levels.length; i < ii; ++i) {
  37328. level = levels[i];
  37329. if (highestLevel < level) {
  37330. highestLevel = level;
  37331. }
  37332. if (lowestOddLevel > level && isOdd(level)) {
  37333. lowestOddLevel = level;
  37334. }
  37335. }
  37336. for (level = highestLevel; level >= lowestOddLevel; --level) {
  37337. var start = -1;
  37338. for (i = 0, ii = levels.length; i < ii; ++i) {
  37339. if (levels[i] < level) {
  37340. if (start >= 0) {
  37341. reverseValues(chars, start, i);
  37342. start = -1;
  37343. }
  37344. } else if (start < 0) {
  37345. start = i;
  37346. }
  37347. }
  37348. if (start >= 0) {
  37349. reverseValues(chars, start, levels.length);
  37350. }
  37351. }
  37352. for (i = 0, ii = chars.length; i < ii; ++i) {
  37353. var ch = chars[i];
  37354. if (ch === '<' || ch === '>') {
  37355. chars[i] = '';
  37356. }
  37357. }
  37358. return createBidiText(chars.join(''), isLTR);
  37359. }
  37360. exports.bidi = bidi;
  37361. /***/ }),
  37362. /* 22 */
  37363. /***/ (function(module, exports, __w_pdfjs_require__) {
  37364. "use strict";
  37365. var ISOAdobeCharset = [
  37366. '.notdef',
  37367. 'space',
  37368. 'exclam',
  37369. 'quotedbl',
  37370. 'numbersign',
  37371. 'dollar',
  37372. 'percent',
  37373. 'ampersand',
  37374. 'quoteright',
  37375. 'parenleft',
  37376. 'parenright',
  37377. 'asterisk',
  37378. 'plus',
  37379. 'comma',
  37380. 'hyphen',
  37381. 'period',
  37382. 'slash',
  37383. 'zero',
  37384. 'one',
  37385. 'two',
  37386. 'three',
  37387. 'four',
  37388. 'five',
  37389. 'six',
  37390. 'seven',
  37391. 'eight',
  37392. 'nine',
  37393. 'colon',
  37394. 'semicolon',
  37395. 'less',
  37396. 'equal',
  37397. 'greater',
  37398. 'question',
  37399. 'at',
  37400. 'A',
  37401. 'B',
  37402. 'C',
  37403. 'D',
  37404. 'E',
  37405. 'F',
  37406. 'G',
  37407. 'H',
  37408. 'I',
  37409. 'J',
  37410. 'K',
  37411. 'L',
  37412. 'M',
  37413. 'N',
  37414. 'O',
  37415. 'P',
  37416. 'Q',
  37417. 'R',
  37418. 'S',
  37419. 'T',
  37420. 'U',
  37421. 'V',
  37422. 'W',
  37423. 'X',
  37424. 'Y',
  37425. 'Z',
  37426. 'bracketleft',
  37427. 'backslash',
  37428. 'bracketright',
  37429. 'asciicircum',
  37430. 'underscore',
  37431. 'quoteleft',
  37432. 'a',
  37433. 'b',
  37434. 'c',
  37435. 'd',
  37436. 'e',
  37437. 'f',
  37438. 'g',
  37439. 'h',
  37440. 'i',
  37441. 'j',
  37442. 'k',
  37443. 'l',
  37444. 'm',
  37445. 'n',
  37446. 'o',
  37447. 'p',
  37448. 'q',
  37449. 'r',
  37450. 's',
  37451. 't',
  37452. 'u',
  37453. 'v',
  37454. 'w',
  37455. 'x',
  37456. 'y',
  37457. 'z',
  37458. 'braceleft',
  37459. 'bar',
  37460. 'braceright',
  37461. 'asciitilde',
  37462. 'exclamdown',
  37463. 'cent',
  37464. 'sterling',
  37465. 'fraction',
  37466. 'yen',
  37467. 'florin',
  37468. 'section',
  37469. 'currency',
  37470. 'quotesingle',
  37471. 'quotedblleft',
  37472. 'guillemotleft',
  37473. 'guilsinglleft',
  37474. 'guilsinglright',
  37475. 'fi',
  37476. 'fl',
  37477. 'endash',
  37478. 'dagger',
  37479. 'daggerdbl',
  37480. 'periodcentered',
  37481. 'paragraph',
  37482. 'bullet',
  37483. 'quotesinglbase',
  37484. 'quotedblbase',
  37485. 'quotedblright',
  37486. 'guillemotright',
  37487. 'ellipsis',
  37488. 'perthousand',
  37489. 'questiondown',
  37490. 'grave',
  37491. 'acute',
  37492. 'circumflex',
  37493. 'tilde',
  37494. 'macron',
  37495. 'breve',
  37496. 'dotaccent',
  37497. 'dieresis',
  37498. 'ring',
  37499. 'cedilla',
  37500. 'hungarumlaut',
  37501. 'ogonek',
  37502. 'caron',
  37503. 'emdash',
  37504. 'AE',
  37505. 'ordfeminine',
  37506. 'Lslash',
  37507. 'Oslash',
  37508. 'OE',
  37509. 'ordmasculine',
  37510. 'ae',
  37511. 'dotlessi',
  37512. 'lslash',
  37513. 'oslash',
  37514. 'oe',
  37515. 'germandbls',
  37516. 'onesuperior',
  37517. 'logicalnot',
  37518. 'mu',
  37519. 'trademark',
  37520. 'Eth',
  37521. 'onehalf',
  37522. 'plusminus',
  37523. 'Thorn',
  37524. 'onequarter',
  37525. 'divide',
  37526. 'brokenbar',
  37527. 'degree',
  37528. 'thorn',
  37529. 'threequarters',
  37530. 'twosuperior',
  37531. 'registered',
  37532. 'minus',
  37533. 'eth',
  37534. 'multiply',
  37535. 'threesuperior',
  37536. 'copyright',
  37537. 'Aacute',
  37538. 'Acircumflex',
  37539. 'Adieresis',
  37540. 'Agrave',
  37541. 'Aring',
  37542. 'Atilde',
  37543. 'Ccedilla',
  37544. 'Eacute',
  37545. 'Ecircumflex',
  37546. 'Edieresis',
  37547. 'Egrave',
  37548. 'Iacute',
  37549. 'Icircumflex',
  37550. 'Idieresis',
  37551. 'Igrave',
  37552. 'Ntilde',
  37553. 'Oacute',
  37554. 'Ocircumflex',
  37555. 'Odieresis',
  37556. 'Ograve',
  37557. 'Otilde',
  37558. 'Scaron',
  37559. 'Uacute',
  37560. 'Ucircumflex',
  37561. 'Udieresis',
  37562. 'Ugrave',
  37563. 'Yacute',
  37564. 'Ydieresis',
  37565. 'Zcaron',
  37566. 'aacute',
  37567. 'acircumflex',
  37568. 'adieresis',
  37569. 'agrave',
  37570. 'aring',
  37571. 'atilde',
  37572. 'ccedilla',
  37573. 'eacute',
  37574. 'ecircumflex',
  37575. 'edieresis',
  37576. 'egrave',
  37577. 'iacute',
  37578. 'icircumflex',
  37579. 'idieresis',
  37580. 'igrave',
  37581. 'ntilde',
  37582. 'oacute',
  37583. 'ocircumflex',
  37584. 'odieresis',
  37585. 'ograve',
  37586. 'otilde',
  37587. 'scaron',
  37588. 'uacute',
  37589. 'ucircumflex',
  37590. 'udieresis',
  37591. 'ugrave',
  37592. 'yacute',
  37593. 'ydieresis',
  37594. 'zcaron'
  37595. ];
  37596. var ExpertCharset = [
  37597. '.notdef',
  37598. 'space',
  37599. 'exclamsmall',
  37600. 'Hungarumlautsmall',
  37601. 'dollaroldstyle',
  37602. 'dollarsuperior',
  37603. 'ampersandsmall',
  37604. 'Acutesmall',
  37605. 'parenleftsuperior',
  37606. 'parenrightsuperior',
  37607. 'twodotenleader',
  37608. 'onedotenleader',
  37609. 'comma',
  37610. 'hyphen',
  37611. 'period',
  37612. 'fraction',
  37613. 'zerooldstyle',
  37614. 'oneoldstyle',
  37615. 'twooldstyle',
  37616. 'threeoldstyle',
  37617. 'fouroldstyle',
  37618. 'fiveoldstyle',
  37619. 'sixoldstyle',
  37620. 'sevenoldstyle',
  37621. 'eightoldstyle',
  37622. 'nineoldstyle',
  37623. 'colon',
  37624. 'semicolon',
  37625. 'commasuperior',
  37626. 'threequartersemdash',
  37627. 'periodsuperior',
  37628. 'questionsmall',
  37629. 'asuperior',
  37630. 'bsuperior',
  37631. 'centsuperior',
  37632. 'dsuperior',
  37633. 'esuperior',
  37634. 'isuperior',
  37635. 'lsuperior',
  37636. 'msuperior',
  37637. 'nsuperior',
  37638. 'osuperior',
  37639. 'rsuperior',
  37640. 'ssuperior',
  37641. 'tsuperior',
  37642. 'ff',
  37643. 'fi',
  37644. 'fl',
  37645. 'ffi',
  37646. 'ffl',
  37647. 'parenleftinferior',
  37648. 'parenrightinferior',
  37649. 'Circumflexsmall',
  37650. 'hyphensuperior',
  37651. 'Gravesmall',
  37652. 'Asmall',
  37653. 'Bsmall',
  37654. 'Csmall',
  37655. 'Dsmall',
  37656. 'Esmall',
  37657. 'Fsmall',
  37658. 'Gsmall',
  37659. 'Hsmall',
  37660. 'Ismall',
  37661. 'Jsmall',
  37662. 'Ksmall',
  37663. 'Lsmall',
  37664. 'Msmall',
  37665. 'Nsmall',
  37666. 'Osmall',
  37667. 'Psmall',
  37668. 'Qsmall',
  37669. 'Rsmall',
  37670. 'Ssmall',
  37671. 'Tsmall',
  37672. 'Usmall',
  37673. 'Vsmall',
  37674. 'Wsmall',
  37675. 'Xsmall',
  37676. 'Ysmall',
  37677. 'Zsmall',
  37678. 'colonmonetary',
  37679. 'onefitted',
  37680. 'rupiah',
  37681. 'Tildesmall',
  37682. 'exclamdownsmall',
  37683. 'centoldstyle',
  37684. 'Lslashsmall',
  37685. 'Scaronsmall',
  37686. 'Zcaronsmall',
  37687. 'Dieresissmall',
  37688. 'Brevesmall',
  37689. 'Caronsmall',
  37690. 'Dotaccentsmall',
  37691. 'Macronsmall',
  37692. 'figuredash',
  37693. 'hypheninferior',
  37694. 'Ogoneksmall',
  37695. 'Ringsmall',
  37696. 'Cedillasmall',
  37697. 'onequarter',
  37698. 'onehalf',
  37699. 'threequarters',
  37700. 'questiondownsmall',
  37701. 'oneeighth',
  37702. 'threeeighths',
  37703. 'fiveeighths',
  37704. 'seveneighths',
  37705. 'onethird',
  37706. 'twothirds',
  37707. 'zerosuperior',
  37708. 'onesuperior',
  37709. 'twosuperior',
  37710. 'threesuperior',
  37711. 'foursuperior',
  37712. 'fivesuperior',
  37713. 'sixsuperior',
  37714. 'sevensuperior',
  37715. 'eightsuperior',
  37716. 'ninesuperior',
  37717. 'zeroinferior',
  37718. 'oneinferior',
  37719. 'twoinferior',
  37720. 'threeinferior',
  37721. 'fourinferior',
  37722. 'fiveinferior',
  37723. 'sixinferior',
  37724. 'seveninferior',
  37725. 'eightinferior',
  37726. 'nineinferior',
  37727. 'centinferior',
  37728. 'dollarinferior',
  37729. 'periodinferior',
  37730. 'commainferior',
  37731. 'Agravesmall',
  37732. 'Aacutesmall',
  37733. 'Acircumflexsmall',
  37734. 'Atildesmall',
  37735. 'Adieresissmall',
  37736. 'Aringsmall',
  37737. 'AEsmall',
  37738. 'Ccedillasmall',
  37739. 'Egravesmall',
  37740. 'Eacutesmall',
  37741. 'Ecircumflexsmall',
  37742. 'Edieresissmall',
  37743. 'Igravesmall',
  37744. 'Iacutesmall',
  37745. 'Icircumflexsmall',
  37746. 'Idieresissmall',
  37747. 'Ethsmall',
  37748. 'Ntildesmall',
  37749. 'Ogravesmall',
  37750. 'Oacutesmall',
  37751. 'Ocircumflexsmall',
  37752. 'Otildesmall',
  37753. 'Odieresissmall',
  37754. 'OEsmall',
  37755. 'Oslashsmall',
  37756. 'Ugravesmall',
  37757. 'Uacutesmall',
  37758. 'Ucircumflexsmall',
  37759. 'Udieresissmall',
  37760. 'Yacutesmall',
  37761. 'Thornsmall',
  37762. 'Ydieresissmall'
  37763. ];
  37764. var ExpertSubsetCharset = [
  37765. '.notdef',
  37766. 'space',
  37767. 'dollaroldstyle',
  37768. 'dollarsuperior',
  37769. 'parenleftsuperior',
  37770. 'parenrightsuperior',
  37771. 'twodotenleader',
  37772. 'onedotenleader',
  37773. 'comma',
  37774. 'hyphen',
  37775. 'period',
  37776. 'fraction',
  37777. 'zerooldstyle',
  37778. 'oneoldstyle',
  37779. 'twooldstyle',
  37780. 'threeoldstyle',
  37781. 'fouroldstyle',
  37782. 'fiveoldstyle',
  37783. 'sixoldstyle',
  37784. 'sevenoldstyle',
  37785. 'eightoldstyle',
  37786. 'nineoldstyle',
  37787. 'colon',
  37788. 'semicolon',
  37789. 'commasuperior',
  37790. 'threequartersemdash',
  37791. 'periodsuperior',
  37792. 'asuperior',
  37793. 'bsuperior',
  37794. 'centsuperior',
  37795. 'dsuperior',
  37796. 'esuperior',
  37797. 'isuperior',
  37798. 'lsuperior',
  37799. 'msuperior',
  37800. 'nsuperior',
  37801. 'osuperior',
  37802. 'rsuperior',
  37803. 'ssuperior',
  37804. 'tsuperior',
  37805. 'ff',
  37806. 'fi',
  37807. 'fl',
  37808. 'ffi',
  37809. 'ffl',
  37810. 'parenleftinferior',
  37811. 'parenrightinferior',
  37812. 'hyphensuperior',
  37813. 'colonmonetary',
  37814. 'onefitted',
  37815. 'rupiah',
  37816. 'centoldstyle',
  37817. 'figuredash',
  37818. 'hypheninferior',
  37819. 'onequarter',
  37820. 'onehalf',
  37821. 'threequarters',
  37822. 'oneeighth',
  37823. 'threeeighths',
  37824. 'fiveeighths',
  37825. 'seveneighths',
  37826. 'onethird',
  37827. 'twothirds',
  37828. 'zerosuperior',
  37829. 'onesuperior',
  37830. 'twosuperior',
  37831. 'threesuperior',
  37832. 'foursuperior',
  37833. 'fivesuperior',
  37834. 'sixsuperior',
  37835. 'sevensuperior',
  37836. 'eightsuperior',
  37837. 'ninesuperior',
  37838. 'zeroinferior',
  37839. 'oneinferior',
  37840. 'twoinferior',
  37841. 'threeinferior',
  37842. 'fourinferior',
  37843. 'fiveinferior',
  37844. 'sixinferior',
  37845. 'seveninferior',
  37846. 'eightinferior',
  37847. 'nineinferior',
  37848. 'centinferior',
  37849. 'dollarinferior',
  37850. 'periodinferior',
  37851. 'commainferior'
  37852. ];
  37853. exports.ISOAdobeCharset = ISOAdobeCharset;
  37854. exports.ExpertCharset = ExpertCharset;
  37855. exports.ExpertSubsetCharset = ExpertSubsetCharset;
  37856. /***/ }),
  37857. /* 23 */
  37858. /***/ (function(module, exports, __w_pdfjs_require__) {
  37859. "use strict";
  37860. var sharedUtil = __w_pdfjs_require__(0);
  37861. var corePrimitives = __w_pdfjs_require__(1);
  37862. var coreStream = __w_pdfjs_require__(2);
  37863. var coreParser = __w_pdfjs_require__(5);
  37864. var Util = sharedUtil.Util;
  37865. var assert = sharedUtil.assert;
  37866. var warn = sharedUtil.warn;
  37867. var error = sharedUtil.error;
  37868. var isInt = sharedUtil.isInt;
  37869. var isString = sharedUtil.isString;
  37870. var MissingDataException = sharedUtil.MissingDataException;
  37871. var CMapCompressionType = sharedUtil.CMapCompressionType;
  37872. var isEOF = corePrimitives.isEOF;
  37873. var isName = corePrimitives.isName;
  37874. var isCmd = corePrimitives.isCmd;
  37875. var isStream = corePrimitives.isStream;
  37876. var Stream = coreStream.Stream;
  37877. var Lexer = coreParser.Lexer;
  37878. var BUILT_IN_CMAPS = [
  37879. 'Adobe-GB1-UCS2',
  37880. 'Adobe-CNS1-UCS2',
  37881. 'Adobe-Japan1-UCS2',
  37882. 'Adobe-Korea1-UCS2',
  37883. '78-EUC-H',
  37884. '78-EUC-V',
  37885. '78-H',
  37886. '78-RKSJ-H',
  37887. '78-RKSJ-V',
  37888. '78-V',
  37889. '78ms-RKSJ-H',
  37890. '78ms-RKSJ-V',
  37891. '83pv-RKSJ-H',
  37892. '90ms-RKSJ-H',
  37893. '90ms-RKSJ-V',
  37894. '90msp-RKSJ-H',
  37895. '90msp-RKSJ-V',
  37896. '90pv-RKSJ-H',
  37897. '90pv-RKSJ-V',
  37898. 'Add-H',
  37899. 'Add-RKSJ-H',
  37900. 'Add-RKSJ-V',
  37901. 'Add-V',
  37902. 'Adobe-CNS1-0',
  37903. 'Adobe-CNS1-1',
  37904. 'Adobe-CNS1-2',
  37905. 'Adobe-CNS1-3',
  37906. 'Adobe-CNS1-4',
  37907. 'Adobe-CNS1-5',
  37908. 'Adobe-CNS1-6',
  37909. 'Adobe-GB1-0',
  37910. 'Adobe-GB1-1',
  37911. 'Adobe-GB1-2',
  37912. 'Adobe-GB1-3',
  37913. 'Adobe-GB1-4',
  37914. 'Adobe-GB1-5',
  37915. 'Adobe-Japan1-0',
  37916. 'Adobe-Japan1-1',
  37917. 'Adobe-Japan1-2',
  37918. 'Adobe-Japan1-3',
  37919. 'Adobe-Japan1-4',
  37920. 'Adobe-Japan1-5',
  37921. 'Adobe-Japan1-6',
  37922. 'Adobe-Korea1-0',
  37923. 'Adobe-Korea1-1',
  37924. 'Adobe-Korea1-2',
  37925. 'B5-H',
  37926. 'B5-V',
  37927. 'B5pc-H',
  37928. 'B5pc-V',
  37929. 'CNS-EUC-H',
  37930. 'CNS-EUC-V',
  37931. 'CNS1-H',
  37932. 'CNS1-V',
  37933. 'CNS2-H',
  37934. 'CNS2-V',
  37935. 'ETHK-B5-H',
  37936. 'ETHK-B5-V',
  37937. 'ETen-B5-H',
  37938. 'ETen-B5-V',
  37939. 'ETenms-B5-H',
  37940. 'ETenms-B5-V',
  37941. 'EUC-H',
  37942. 'EUC-V',
  37943. 'Ext-H',
  37944. 'Ext-RKSJ-H',
  37945. 'Ext-RKSJ-V',
  37946. 'Ext-V',
  37947. 'GB-EUC-H',
  37948. 'GB-EUC-V',
  37949. 'GB-H',
  37950. 'GB-V',
  37951. 'GBK-EUC-H',
  37952. 'GBK-EUC-V',
  37953. 'GBK2K-H',
  37954. 'GBK2K-V',
  37955. 'GBKp-EUC-H',
  37956. 'GBKp-EUC-V',
  37957. 'GBT-EUC-H',
  37958. 'GBT-EUC-V',
  37959. 'GBT-H',
  37960. 'GBT-V',
  37961. 'GBTpc-EUC-H',
  37962. 'GBTpc-EUC-V',
  37963. 'GBpc-EUC-H',
  37964. 'GBpc-EUC-V',
  37965. 'H',
  37966. 'HKdla-B5-H',
  37967. 'HKdla-B5-V',
  37968. 'HKdlb-B5-H',
  37969. 'HKdlb-B5-V',
  37970. 'HKgccs-B5-H',
  37971. 'HKgccs-B5-V',
  37972. 'HKm314-B5-H',
  37973. 'HKm314-B5-V',
  37974. 'HKm471-B5-H',
  37975. 'HKm471-B5-V',
  37976. 'HKscs-B5-H',
  37977. 'HKscs-B5-V',
  37978. 'Hankaku',
  37979. 'Hiragana',
  37980. 'KSC-EUC-H',
  37981. 'KSC-EUC-V',
  37982. 'KSC-H',
  37983. 'KSC-Johab-H',
  37984. 'KSC-Johab-V',
  37985. 'KSC-V',
  37986. 'KSCms-UHC-H',
  37987. 'KSCms-UHC-HW-H',
  37988. 'KSCms-UHC-HW-V',
  37989. 'KSCms-UHC-V',
  37990. 'KSCpc-EUC-H',
  37991. 'KSCpc-EUC-V',
  37992. 'Katakana',
  37993. 'NWP-H',
  37994. 'NWP-V',
  37995. 'RKSJ-H',
  37996. 'RKSJ-V',
  37997. 'Roman',
  37998. 'UniCNS-UCS2-H',
  37999. 'UniCNS-UCS2-V',
  38000. 'UniCNS-UTF16-H',
  38001. 'UniCNS-UTF16-V',
  38002. 'UniCNS-UTF32-H',
  38003. 'UniCNS-UTF32-V',
  38004. 'UniCNS-UTF8-H',
  38005. 'UniCNS-UTF8-V',
  38006. 'UniGB-UCS2-H',
  38007. 'UniGB-UCS2-V',
  38008. 'UniGB-UTF16-H',
  38009. 'UniGB-UTF16-V',
  38010. 'UniGB-UTF32-H',
  38011. 'UniGB-UTF32-V',
  38012. 'UniGB-UTF8-H',
  38013. 'UniGB-UTF8-V',
  38014. 'UniJIS-UCS2-H',
  38015. 'UniJIS-UCS2-HW-H',
  38016. 'UniJIS-UCS2-HW-V',
  38017. 'UniJIS-UCS2-V',
  38018. 'UniJIS-UTF16-H',
  38019. 'UniJIS-UTF16-V',
  38020. 'UniJIS-UTF32-H',
  38021. 'UniJIS-UTF32-V',
  38022. 'UniJIS-UTF8-H',
  38023. 'UniJIS-UTF8-V',
  38024. 'UniJIS2004-UTF16-H',
  38025. 'UniJIS2004-UTF16-V',
  38026. 'UniJIS2004-UTF32-H',
  38027. 'UniJIS2004-UTF32-V',
  38028. 'UniJIS2004-UTF8-H',
  38029. 'UniJIS2004-UTF8-V',
  38030. 'UniJISPro-UCS2-HW-V',
  38031. 'UniJISPro-UCS2-V',
  38032. 'UniJISPro-UTF8-V',
  38033. 'UniJISX0213-UTF32-H',
  38034. 'UniJISX0213-UTF32-V',
  38035. 'UniJISX02132004-UTF32-H',
  38036. 'UniJISX02132004-UTF32-V',
  38037. 'UniKS-UCS2-H',
  38038. 'UniKS-UCS2-V',
  38039. 'UniKS-UTF16-H',
  38040. 'UniKS-UTF16-V',
  38041. 'UniKS-UTF32-H',
  38042. 'UniKS-UTF32-V',
  38043. 'UniKS-UTF8-H',
  38044. 'UniKS-UTF8-V',
  38045. 'V',
  38046. 'WP-Symbol'
  38047. ];
  38048. var CMap = function CMapClosure() {
  38049. function CMap(builtInCMap) {
  38050. this.codespaceRanges = [
  38051. [],
  38052. [],
  38053. [],
  38054. []
  38055. ];
  38056. this.numCodespaceRanges = 0;
  38057. this._map = [];
  38058. this.name = '';
  38059. this.vertical = false;
  38060. this.useCMap = null;
  38061. this.builtInCMap = builtInCMap;
  38062. }
  38063. CMap.prototype = {
  38064. addCodespaceRange: function (n, low, high) {
  38065. this.codespaceRanges[n - 1].push(low, high);
  38066. this.numCodespaceRanges++;
  38067. },
  38068. mapCidRange: function (low, high, dstLow) {
  38069. while (low <= high) {
  38070. this._map[low++] = dstLow++;
  38071. }
  38072. },
  38073. mapBfRange: function (low, high, dstLow) {
  38074. var lastByte = dstLow.length - 1;
  38075. while (low <= high) {
  38076. this._map[low++] = dstLow;
  38077. dstLow = dstLow.substr(0, lastByte) + String.fromCharCode(dstLow.charCodeAt(lastByte) + 1);
  38078. }
  38079. },
  38080. mapBfRangeToArray: function (low, high, array) {
  38081. var i = 0, ii = array.length;
  38082. while (low <= high && i < ii) {
  38083. this._map[low] = array[i++];
  38084. ++low;
  38085. }
  38086. },
  38087. mapOne: function (src, dst) {
  38088. this._map[src] = dst;
  38089. },
  38090. lookup: function (code) {
  38091. return this._map[code];
  38092. },
  38093. contains: function (code) {
  38094. return this._map[code] !== undefined;
  38095. },
  38096. forEach: function (callback) {
  38097. var map = this._map;
  38098. var length = map.length;
  38099. var i;
  38100. if (length <= 0x10000) {
  38101. for (i = 0; i < length; i++) {
  38102. if (map[i] !== undefined) {
  38103. callback(i, map[i]);
  38104. }
  38105. }
  38106. } else {
  38107. for (i in this._map) {
  38108. callback(i, map[i]);
  38109. }
  38110. }
  38111. },
  38112. charCodeOf: function (value) {
  38113. return this._map.indexOf(value);
  38114. },
  38115. getMap: function () {
  38116. return this._map;
  38117. },
  38118. readCharCode: function (str, offset, out) {
  38119. var c = 0;
  38120. var codespaceRanges = this.codespaceRanges;
  38121. var codespaceRangesLen = this.codespaceRanges.length;
  38122. for (var n = 0; n < codespaceRangesLen; n++) {
  38123. c = (c << 8 | str.charCodeAt(offset + n)) >>> 0;
  38124. var codespaceRange = codespaceRanges[n];
  38125. for (var k = 0, kk = codespaceRange.length; k < kk;) {
  38126. var low = codespaceRange[k++];
  38127. var high = codespaceRange[k++];
  38128. if (c >= low && c <= high) {
  38129. out.charcode = c;
  38130. out.length = n + 1;
  38131. return;
  38132. }
  38133. }
  38134. }
  38135. out.charcode = 0;
  38136. out.length = 1;
  38137. },
  38138. get length() {
  38139. return this._map.length;
  38140. },
  38141. get isIdentityCMap() {
  38142. if (!(this.name === 'Identity-H' || this.name === 'Identity-V')) {
  38143. return false;
  38144. }
  38145. if (this._map.length !== 0x10000) {
  38146. return false;
  38147. }
  38148. for (var i = 0; i < 0x10000; i++) {
  38149. if (this._map[i] !== i) {
  38150. return false;
  38151. }
  38152. }
  38153. return true;
  38154. }
  38155. };
  38156. return CMap;
  38157. }();
  38158. var IdentityCMap = function IdentityCMapClosure() {
  38159. function IdentityCMap(vertical, n) {
  38160. CMap.call(this);
  38161. this.vertical = vertical;
  38162. this.addCodespaceRange(n, 0, 0xffff);
  38163. }
  38164. Util.inherit(IdentityCMap, CMap, {});
  38165. IdentityCMap.prototype = {
  38166. addCodespaceRange: CMap.prototype.addCodespaceRange,
  38167. mapCidRange: function (low, high, dstLow) {
  38168. error('should not call mapCidRange');
  38169. },
  38170. mapBfRange: function (low, high, dstLow) {
  38171. error('should not call mapBfRange');
  38172. },
  38173. mapBfRangeToArray: function (low, high, array) {
  38174. error('should not call mapBfRangeToArray');
  38175. },
  38176. mapOne: function (src, dst) {
  38177. error('should not call mapCidOne');
  38178. },
  38179. lookup: function (code) {
  38180. return isInt(code) && code <= 0xffff ? code : undefined;
  38181. },
  38182. contains: function (code) {
  38183. return isInt(code) && code <= 0xffff;
  38184. },
  38185. forEach: function (callback) {
  38186. for (var i = 0; i <= 0xffff; i++) {
  38187. callback(i, i);
  38188. }
  38189. },
  38190. charCodeOf: function (value) {
  38191. return isInt(value) && value <= 0xffff ? value : -1;
  38192. },
  38193. getMap: function () {
  38194. var map = new Array(0x10000);
  38195. for (var i = 0; i <= 0xffff; i++) {
  38196. map[i] = i;
  38197. }
  38198. return map;
  38199. },
  38200. readCharCode: CMap.prototype.readCharCode,
  38201. get length() {
  38202. return 0x10000;
  38203. },
  38204. get isIdentityCMap() {
  38205. error('should not access .isIdentityCMap');
  38206. }
  38207. };
  38208. return IdentityCMap;
  38209. }();
  38210. var BinaryCMapReader = function BinaryCMapReaderClosure() {
  38211. function hexToInt(a, size) {
  38212. var n = 0;
  38213. for (var i = 0; i <= size; i++) {
  38214. n = n << 8 | a[i];
  38215. }
  38216. return n >>> 0;
  38217. }
  38218. function hexToStr(a, size) {
  38219. if (size === 1) {
  38220. return String.fromCharCode(a[0], a[1]);
  38221. }
  38222. if (size === 3) {
  38223. return String.fromCharCode(a[0], a[1], a[2], a[3]);
  38224. }
  38225. return String.fromCharCode.apply(null, a.subarray(0, size + 1));
  38226. }
  38227. function addHex(a, b, size) {
  38228. var c = 0;
  38229. for (var i = size; i >= 0; i--) {
  38230. c += a[i] + b[i];
  38231. a[i] = c & 255;
  38232. c >>= 8;
  38233. }
  38234. }
  38235. function incHex(a, size) {
  38236. var c = 1;
  38237. for (var i = size; i >= 0 && c > 0; i--) {
  38238. c += a[i];
  38239. a[i] = c & 255;
  38240. c >>= 8;
  38241. }
  38242. }
  38243. var MAX_NUM_SIZE = 16;
  38244. var MAX_ENCODED_NUM_SIZE = 19;
  38245. function BinaryCMapStream(data) {
  38246. this.buffer = data;
  38247. this.pos = 0;
  38248. this.end = data.length;
  38249. this.tmpBuf = new Uint8Array(MAX_ENCODED_NUM_SIZE);
  38250. }
  38251. BinaryCMapStream.prototype = {
  38252. readByte: function () {
  38253. if (this.pos >= this.end) {
  38254. return -1;
  38255. }
  38256. return this.buffer[this.pos++];
  38257. },
  38258. readNumber: function () {
  38259. var n = 0;
  38260. var last;
  38261. do {
  38262. var b = this.readByte();
  38263. if (b < 0) {
  38264. error('unexpected EOF in bcmap');
  38265. }
  38266. last = !(b & 0x80);
  38267. n = n << 7 | b & 0x7F;
  38268. } while (!last);
  38269. return n;
  38270. },
  38271. readSigned: function () {
  38272. var n = this.readNumber();
  38273. return n & 1 ? ~(n >>> 1) : n >>> 1;
  38274. },
  38275. readHex: function (num, size) {
  38276. num.set(this.buffer.subarray(this.pos, this.pos + size + 1));
  38277. this.pos += size + 1;
  38278. },
  38279. readHexNumber: function (num, size) {
  38280. var last;
  38281. var stack = this.tmpBuf, sp = 0;
  38282. do {
  38283. var b = this.readByte();
  38284. if (b < 0) {
  38285. error('unexpected EOF in bcmap');
  38286. }
  38287. last = !(b & 0x80);
  38288. stack[sp++] = b & 0x7F;
  38289. } while (!last);
  38290. var i = size, buffer = 0, bufferSize = 0;
  38291. while (i >= 0) {
  38292. while (bufferSize < 8 && stack.length > 0) {
  38293. buffer = stack[--sp] << bufferSize | buffer;
  38294. bufferSize += 7;
  38295. }
  38296. num[i] = buffer & 255;
  38297. i--;
  38298. buffer >>= 8;
  38299. bufferSize -= 8;
  38300. }
  38301. },
  38302. readHexSigned: function (num, size) {
  38303. this.readHexNumber(num, size);
  38304. var sign = num[size] & 1 ? 255 : 0;
  38305. var c = 0;
  38306. for (var i = 0; i <= size; i++) {
  38307. c = (c & 1) << 8 | num[i];
  38308. num[i] = c >> 1 ^ sign;
  38309. }
  38310. },
  38311. readString: function () {
  38312. var len = this.readNumber();
  38313. var s = '';
  38314. for (var i = 0; i < len; i++) {
  38315. s += String.fromCharCode(this.readNumber());
  38316. }
  38317. return s;
  38318. }
  38319. };
  38320. function processBinaryCMap(data, cMap, extend) {
  38321. return new Promise(function (resolve, reject) {
  38322. var stream = new BinaryCMapStream(data);
  38323. var header = stream.readByte();
  38324. cMap.vertical = !!(header & 1);
  38325. var useCMap = null;
  38326. var start = new Uint8Array(MAX_NUM_SIZE);
  38327. var end = new Uint8Array(MAX_NUM_SIZE);
  38328. var char = new Uint8Array(MAX_NUM_SIZE);
  38329. var charCode = new Uint8Array(MAX_NUM_SIZE);
  38330. var tmp = new Uint8Array(MAX_NUM_SIZE);
  38331. var code;
  38332. var b;
  38333. while ((b = stream.readByte()) >= 0) {
  38334. var type = b >> 5;
  38335. if (type === 7) {
  38336. switch (b & 0x1F) {
  38337. case 0:
  38338. stream.readString();
  38339. break;
  38340. case 1:
  38341. useCMap = stream.readString();
  38342. break;
  38343. }
  38344. continue;
  38345. }
  38346. var sequence = !!(b & 0x10);
  38347. var dataSize = b & 15;
  38348. assert(dataSize + 1 <= MAX_NUM_SIZE);
  38349. var ucs2DataSize = 1;
  38350. var subitemsCount = stream.readNumber();
  38351. var i;
  38352. switch (type) {
  38353. case 0:
  38354. stream.readHex(start, dataSize);
  38355. stream.readHexNumber(end, dataSize);
  38356. addHex(end, start, dataSize);
  38357. cMap.addCodespaceRange(dataSize + 1, hexToInt(start, dataSize), hexToInt(end, dataSize));
  38358. for (i = 1; i < subitemsCount; i++) {
  38359. incHex(end, dataSize);
  38360. stream.readHexNumber(start, dataSize);
  38361. addHex(start, end, dataSize);
  38362. stream.readHexNumber(end, dataSize);
  38363. addHex(end, start, dataSize);
  38364. cMap.addCodespaceRange(dataSize + 1, hexToInt(start, dataSize), hexToInt(end, dataSize));
  38365. }
  38366. break;
  38367. case 1:
  38368. stream.readHex(start, dataSize);
  38369. stream.readHexNumber(end, dataSize);
  38370. addHex(end, start, dataSize);
  38371. code = stream.readNumber();
  38372. for (i = 1; i < subitemsCount; i++) {
  38373. incHex(end, dataSize);
  38374. stream.readHexNumber(start, dataSize);
  38375. addHex(start, end, dataSize);
  38376. stream.readHexNumber(end, dataSize);
  38377. addHex(end, start, dataSize);
  38378. code = stream.readNumber();
  38379. }
  38380. break;
  38381. case 2:
  38382. stream.readHex(char, dataSize);
  38383. code = stream.readNumber();
  38384. cMap.mapOne(hexToInt(char, dataSize), code);
  38385. for (i = 1; i < subitemsCount; i++) {
  38386. incHex(char, dataSize);
  38387. if (!sequence) {
  38388. stream.readHexNumber(tmp, dataSize);
  38389. addHex(char, tmp, dataSize);
  38390. }
  38391. code = stream.readSigned() + (code + 1);
  38392. cMap.mapOne(hexToInt(char, dataSize), code);
  38393. }
  38394. break;
  38395. case 3:
  38396. stream.readHex(start, dataSize);
  38397. stream.readHexNumber(end, dataSize);
  38398. addHex(end, start, dataSize);
  38399. code = stream.readNumber();
  38400. cMap.mapCidRange(hexToInt(start, dataSize), hexToInt(end, dataSize), code);
  38401. for (i = 1; i < subitemsCount; i++) {
  38402. incHex(end, dataSize);
  38403. if (!sequence) {
  38404. stream.readHexNumber(start, dataSize);
  38405. addHex(start, end, dataSize);
  38406. } else {
  38407. start.set(end);
  38408. }
  38409. stream.readHexNumber(end, dataSize);
  38410. addHex(end, start, dataSize);
  38411. code = stream.readNumber();
  38412. cMap.mapCidRange(hexToInt(start, dataSize), hexToInt(end, dataSize), code);
  38413. }
  38414. break;
  38415. case 4:
  38416. stream.readHex(char, ucs2DataSize);
  38417. stream.readHex(charCode, dataSize);
  38418. cMap.mapOne(hexToInt(char, ucs2DataSize), hexToStr(charCode, dataSize));
  38419. for (i = 1; i < subitemsCount; i++) {
  38420. incHex(char, ucs2DataSize);
  38421. if (!sequence) {
  38422. stream.readHexNumber(tmp, ucs2DataSize);
  38423. addHex(char, tmp, ucs2DataSize);
  38424. }
  38425. incHex(charCode, dataSize);
  38426. stream.readHexSigned(tmp, dataSize);
  38427. addHex(charCode, tmp, dataSize);
  38428. cMap.mapOne(hexToInt(char, ucs2DataSize), hexToStr(charCode, dataSize));
  38429. }
  38430. break;
  38431. case 5:
  38432. stream.readHex(start, ucs2DataSize);
  38433. stream.readHexNumber(end, ucs2DataSize);
  38434. addHex(end, start, ucs2DataSize);
  38435. stream.readHex(charCode, dataSize);
  38436. cMap.mapBfRange(hexToInt(start, ucs2DataSize), hexToInt(end, ucs2DataSize), hexToStr(charCode, dataSize));
  38437. for (i = 1; i < subitemsCount; i++) {
  38438. incHex(end, ucs2DataSize);
  38439. if (!sequence) {
  38440. stream.readHexNumber(start, ucs2DataSize);
  38441. addHex(start, end, ucs2DataSize);
  38442. } else {
  38443. start.set(end);
  38444. }
  38445. stream.readHexNumber(end, ucs2DataSize);
  38446. addHex(end, start, ucs2DataSize);
  38447. stream.readHex(charCode, dataSize);
  38448. cMap.mapBfRange(hexToInt(start, ucs2DataSize), hexToInt(end, ucs2DataSize), hexToStr(charCode, dataSize));
  38449. }
  38450. break;
  38451. default:
  38452. reject(new Error('processBinaryCMap: Unknown type: ' + type));
  38453. return;
  38454. }
  38455. }
  38456. if (useCMap) {
  38457. resolve(extend(useCMap));
  38458. return;
  38459. }
  38460. resolve(cMap);
  38461. });
  38462. }
  38463. function BinaryCMapReader() {
  38464. }
  38465. BinaryCMapReader.prototype = { process: processBinaryCMap };
  38466. return BinaryCMapReader;
  38467. }();
  38468. var CMapFactory = function CMapFactoryClosure() {
  38469. function strToInt(str) {
  38470. var a = 0;
  38471. for (var i = 0; i < str.length; i++) {
  38472. a = a << 8 | str.charCodeAt(i);
  38473. }
  38474. return a >>> 0;
  38475. }
  38476. function expectString(obj) {
  38477. if (!isString(obj)) {
  38478. error('Malformed CMap: expected string.');
  38479. }
  38480. }
  38481. function expectInt(obj) {
  38482. if (!isInt(obj)) {
  38483. error('Malformed CMap: expected int.');
  38484. }
  38485. }
  38486. function parseBfChar(cMap, lexer) {
  38487. while (true) {
  38488. var obj = lexer.getObj();
  38489. if (isEOF(obj)) {
  38490. break;
  38491. }
  38492. if (isCmd(obj, 'endbfchar')) {
  38493. return;
  38494. }
  38495. expectString(obj);
  38496. var src = strToInt(obj);
  38497. obj = lexer.getObj();
  38498. expectString(obj);
  38499. var dst = obj;
  38500. cMap.mapOne(src, dst);
  38501. }
  38502. }
  38503. function parseBfRange(cMap, lexer) {
  38504. while (true) {
  38505. var obj = lexer.getObj();
  38506. if (isEOF(obj)) {
  38507. break;
  38508. }
  38509. if (isCmd(obj, 'endbfrange')) {
  38510. return;
  38511. }
  38512. expectString(obj);
  38513. var low = strToInt(obj);
  38514. obj = lexer.getObj();
  38515. expectString(obj);
  38516. var high = strToInt(obj);
  38517. obj = lexer.getObj();
  38518. if (isInt(obj) || isString(obj)) {
  38519. var dstLow = isInt(obj) ? String.fromCharCode(obj) : obj;
  38520. cMap.mapBfRange(low, high, dstLow);
  38521. } else if (isCmd(obj, '[')) {
  38522. obj = lexer.getObj();
  38523. var array = [];
  38524. while (!isCmd(obj, ']') && !isEOF(obj)) {
  38525. array.push(obj);
  38526. obj = lexer.getObj();
  38527. }
  38528. cMap.mapBfRangeToArray(low, high, array);
  38529. } else {
  38530. break;
  38531. }
  38532. }
  38533. error('Invalid bf range.');
  38534. }
  38535. function parseCidChar(cMap, lexer) {
  38536. while (true) {
  38537. var obj = lexer.getObj();
  38538. if (isEOF(obj)) {
  38539. break;
  38540. }
  38541. if (isCmd(obj, 'endcidchar')) {
  38542. return;
  38543. }
  38544. expectString(obj);
  38545. var src = strToInt(obj);
  38546. obj = lexer.getObj();
  38547. expectInt(obj);
  38548. var dst = obj;
  38549. cMap.mapOne(src, dst);
  38550. }
  38551. }
  38552. function parseCidRange(cMap, lexer) {
  38553. while (true) {
  38554. var obj = lexer.getObj();
  38555. if (isEOF(obj)) {
  38556. break;
  38557. }
  38558. if (isCmd(obj, 'endcidrange')) {
  38559. return;
  38560. }
  38561. expectString(obj);
  38562. var low = strToInt(obj);
  38563. obj = lexer.getObj();
  38564. expectString(obj);
  38565. var high = strToInt(obj);
  38566. obj = lexer.getObj();
  38567. expectInt(obj);
  38568. var dstLow = obj;
  38569. cMap.mapCidRange(low, high, dstLow);
  38570. }
  38571. }
  38572. function parseCodespaceRange(cMap, lexer) {
  38573. while (true) {
  38574. var obj = lexer.getObj();
  38575. if (isEOF(obj)) {
  38576. break;
  38577. }
  38578. if (isCmd(obj, 'endcodespacerange')) {
  38579. return;
  38580. }
  38581. if (!isString(obj)) {
  38582. break;
  38583. }
  38584. var low = strToInt(obj);
  38585. obj = lexer.getObj();
  38586. if (!isString(obj)) {
  38587. break;
  38588. }
  38589. var high = strToInt(obj);
  38590. cMap.addCodespaceRange(obj.length, low, high);
  38591. }
  38592. error('Invalid codespace range.');
  38593. }
  38594. function parseWMode(cMap, lexer) {
  38595. var obj = lexer.getObj();
  38596. if (isInt(obj)) {
  38597. cMap.vertical = !!obj;
  38598. }
  38599. }
  38600. function parseCMapName(cMap, lexer) {
  38601. var obj = lexer.getObj();
  38602. if (isName(obj) && isString(obj.name)) {
  38603. cMap.name = obj.name;
  38604. }
  38605. }
  38606. function parseCMap(cMap, lexer, fetchBuiltInCMap, useCMap) {
  38607. var previous;
  38608. var embededUseCMap;
  38609. objLoop:
  38610. while (true) {
  38611. try {
  38612. var obj = lexer.getObj();
  38613. if (isEOF(obj)) {
  38614. break;
  38615. } else if (isName(obj)) {
  38616. if (obj.name === 'WMode') {
  38617. parseWMode(cMap, lexer);
  38618. } else if (obj.name === 'CMapName') {
  38619. parseCMapName(cMap, lexer);
  38620. }
  38621. previous = obj;
  38622. } else if (isCmd(obj)) {
  38623. switch (obj.cmd) {
  38624. case 'endcmap':
  38625. break objLoop;
  38626. case 'usecmap':
  38627. if (isName(previous)) {
  38628. embededUseCMap = previous.name;
  38629. }
  38630. break;
  38631. case 'begincodespacerange':
  38632. parseCodespaceRange(cMap, lexer);
  38633. break;
  38634. case 'beginbfchar':
  38635. parseBfChar(cMap, lexer);
  38636. break;
  38637. case 'begincidchar':
  38638. parseCidChar(cMap, lexer);
  38639. break;
  38640. case 'beginbfrange':
  38641. parseBfRange(cMap, lexer);
  38642. break;
  38643. case 'begincidrange':
  38644. parseCidRange(cMap, lexer);
  38645. break;
  38646. }
  38647. }
  38648. } catch (ex) {
  38649. if (ex instanceof MissingDataException) {
  38650. throw ex;
  38651. }
  38652. warn('Invalid cMap data: ' + ex);
  38653. continue;
  38654. }
  38655. }
  38656. if (!useCMap && embededUseCMap) {
  38657. useCMap = embededUseCMap;
  38658. }
  38659. if (useCMap) {
  38660. return extendCMap(cMap, fetchBuiltInCMap, useCMap);
  38661. }
  38662. return Promise.resolve(cMap);
  38663. }
  38664. function extendCMap(cMap, fetchBuiltInCMap, useCMap) {
  38665. return createBuiltInCMap(useCMap, fetchBuiltInCMap).then(function (newCMap) {
  38666. cMap.useCMap = newCMap;
  38667. if (cMap.numCodespaceRanges === 0) {
  38668. var useCodespaceRanges = cMap.useCMap.codespaceRanges;
  38669. for (var i = 0; i < useCodespaceRanges.length; i++) {
  38670. cMap.codespaceRanges[i] = useCodespaceRanges[i].slice();
  38671. }
  38672. cMap.numCodespaceRanges = cMap.useCMap.numCodespaceRanges;
  38673. }
  38674. cMap.useCMap.forEach(function (key, value) {
  38675. if (!cMap.contains(key)) {
  38676. cMap.mapOne(key, cMap.useCMap.lookup(key));
  38677. }
  38678. });
  38679. return cMap;
  38680. });
  38681. }
  38682. function createBuiltInCMap(name, fetchBuiltInCMap) {
  38683. if (name === 'Identity-H') {
  38684. return Promise.resolve(new IdentityCMap(false, 2));
  38685. } else if (name === 'Identity-V') {
  38686. return Promise.resolve(new IdentityCMap(true, 2));
  38687. }
  38688. if (BUILT_IN_CMAPS.indexOf(name) === -1) {
  38689. return Promise.reject(new Error('Unknown cMap name: ' + name));
  38690. }
  38691. assert(fetchBuiltInCMap, 'Built-in CMap parameters are not provided.');
  38692. return fetchBuiltInCMap(name).then(function (data) {
  38693. var cMapData = data.cMapData, compressionType = data.compressionType;
  38694. var cMap = new CMap(true);
  38695. if (compressionType === CMapCompressionType.BINARY) {
  38696. return new BinaryCMapReader().process(cMapData, cMap, function (useCMap) {
  38697. return extendCMap(cMap, fetchBuiltInCMap, useCMap);
  38698. });
  38699. }
  38700. assert(compressionType === CMapCompressionType.NONE, 'TODO: Only BINARY/NONE CMap compression is currently supported.');
  38701. var lexer = new Lexer(new Stream(cMapData));
  38702. return parseCMap(cMap, lexer, fetchBuiltInCMap, null);
  38703. });
  38704. }
  38705. return {
  38706. create: function (params) {
  38707. var encoding = params.encoding;
  38708. var fetchBuiltInCMap = params.fetchBuiltInCMap;
  38709. var useCMap = params.useCMap;
  38710. if (isName(encoding)) {
  38711. return createBuiltInCMap(encoding.name, fetchBuiltInCMap);
  38712. } else if (isStream(encoding)) {
  38713. var cMap = new CMap();
  38714. var lexer = new Lexer(encoding);
  38715. return parseCMap(cMap, lexer, fetchBuiltInCMap, useCMap).then(function (parsedCMap) {
  38716. if (parsedCMap.isIdentityCMap) {
  38717. return createBuiltInCMap(parsedCMap.name, fetchBuiltInCMap);
  38718. }
  38719. return parsedCMap;
  38720. });
  38721. }
  38722. return Promise.reject(new Error('Encoding required.'));
  38723. }
  38724. };
  38725. }();
  38726. exports.CMap = CMap;
  38727. exports.CMapFactory = CMapFactory;
  38728. exports.IdentityCMap = IdentityCMap;
  38729. /***/ }),
  38730. /* 24 */
  38731. /***/ (function(module, exports, __w_pdfjs_require__) {
  38732. "use strict";
  38733. var sharedUtil = __w_pdfjs_require__(0);
  38734. var corePrimitives = __w_pdfjs_require__(1);
  38735. var coreStream = __w_pdfjs_require__(2);
  38736. var coreObj = __w_pdfjs_require__(15);
  38737. var coreParser = __w_pdfjs_require__(5);
  38738. var coreCrypto = __w_pdfjs_require__(12);
  38739. var coreEvaluator = __w_pdfjs_require__(13);
  38740. var coreAnnotation = __w_pdfjs_require__(20);
  38741. var MissingDataException = sharedUtil.MissingDataException;
  38742. var Util = sharedUtil.Util;
  38743. var assert = sharedUtil.assert;
  38744. var error = sharedUtil.error;
  38745. var info = sharedUtil.info;
  38746. var isArray = sharedUtil.isArray;
  38747. var isArrayBuffer = sharedUtil.isArrayBuffer;
  38748. var isNum = sharedUtil.isNum;
  38749. var isString = sharedUtil.isString;
  38750. var shadow = sharedUtil.shadow;
  38751. var stringToBytes = sharedUtil.stringToBytes;
  38752. var stringToPDFString = sharedUtil.stringToPDFString;
  38753. var warn = sharedUtil.warn;
  38754. var isSpace = sharedUtil.isSpace;
  38755. var Dict = corePrimitives.Dict;
  38756. var isDict = corePrimitives.isDict;
  38757. var isName = corePrimitives.isName;
  38758. var isStream = corePrimitives.isStream;
  38759. var NullStream = coreStream.NullStream;
  38760. var Stream = coreStream.Stream;
  38761. var StreamsSequenceStream = coreStream.StreamsSequenceStream;
  38762. var Catalog = coreObj.Catalog;
  38763. var ObjectLoader = coreObj.ObjectLoader;
  38764. var XRef = coreObj.XRef;
  38765. var Linearization = coreParser.Linearization;
  38766. var calculateMD5 = coreCrypto.calculateMD5;
  38767. var OperatorList = coreEvaluator.OperatorList;
  38768. var PartialEvaluator = coreEvaluator.PartialEvaluator;
  38769. var Annotation = coreAnnotation.Annotation;
  38770. var AnnotationFactory = coreAnnotation.AnnotationFactory;
  38771. var Page = function PageClosure() {
  38772. var DEFAULT_USER_UNIT = 1.0;
  38773. var LETTER_SIZE_MEDIABOX = [
  38774. 0,
  38775. 0,
  38776. 612,
  38777. 792
  38778. ];
  38779. function Page(pdfManager, xref, pageIndex, pageDict, ref, fontCache, builtInCMapCache) {
  38780. this.pdfManager = pdfManager;
  38781. this.pageIndex = pageIndex;
  38782. this.pageDict = pageDict;
  38783. this.xref = xref;
  38784. this.ref = ref;
  38785. this.fontCache = fontCache;
  38786. this.builtInCMapCache = builtInCMapCache;
  38787. this.evaluatorOptions = pdfManager.evaluatorOptions;
  38788. this.resourcesPromise = null;
  38789. var uniquePrefix = 'p' + this.pageIndex + '_';
  38790. var idCounters = { obj: 0 };
  38791. this.idFactory = {
  38792. createObjId: function () {
  38793. return uniquePrefix + ++idCounters.obj;
  38794. }
  38795. };
  38796. }
  38797. Page.prototype = {
  38798. getPageProp: function Page_getPageProp(key) {
  38799. return this.pageDict.get(key);
  38800. },
  38801. getInheritedPageProp: function Page_getInheritedPageProp(key, getArray) {
  38802. var dict = this.pageDict, valueArray = null, loopCount = 0;
  38803. var MAX_LOOP_COUNT = 100;
  38804. getArray = getArray || false;
  38805. while (dict) {
  38806. var value = getArray ? dict.getArray(key) : dict.get(key);
  38807. if (value) {
  38808. if (!valueArray) {
  38809. valueArray = [];
  38810. }
  38811. valueArray.push(value);
  38812. }
  38813. if (++loopCount > MAX_LOOP_COUNT) {
  38814. warn('Page_getInheritedPageProp: maximum loop count exceeded.');
  38815. break;
  38816. }
  38817. dict = dict.get('Parent');
  38818. }
  38819. if (!valueArray) {
  38820. return Dict.empty;
  38821. }
  38822. if (valueArray.length === 1 || !isDict(valueArray[0]) || loopCount > MAX_LOOP_COUNT) {
  38823. return valueArray[0];
  38824. }
  38825. return Dict.merge(this.xref, valueArray);
  38826. },
  38827. get content() {
  38828. return this.getPageProp('Contents');
  38829. },
  38830. get resources() {
  38831. return shadow(this, 'resources', this.getInheritedPageProp('Resources'));
  38832. },
  38833. get mediaBox() {
  38834. var mediaBox = this.getInheritedPageProp('MediaBox', true);
  38835. if (!isArray(mediaBox) || mediaBox.length !== 4) {
  38836. return shadow(this, 'mediaBox', LETTER_SIZE_MEDIABOX);
  38837. }
  38838. return shadow(this, 'mediaBox', mediaBox);
  38839. },
  38840. get cropBox() {
  38841. var cropBox = this.getInheritedPageProp('CropBox', true);
  38842. if (!isArray(cropBox) || cropBox.length !== 4) {
  38843. return shadow(this, 'cropBox', this.mediaBox);
  38844. }
  38845. return shadow(this, 'cropBox', cropBox);
  38846. },
  38847. get userUnit() {
  38848. var obj = this.getPageProp('UserUnit');
  38849. if (!isNum(obj) || obj <= 0) {
  38850. obj = DEFAULT_USER_UNIT;
  38851. }
  38852. return shadow(this, 'userUnit', obj);
  38853. },
  38854. get view() {
  38855. var mediaBox = this.mediaBox, cropBox = this.cropBox;
  38856. if (mediaBox === cropBox) {
  38857. return shadow(this, 'view', mediaBox);
  38858. }
  38859. var intersection = Util.intersect(cropBox, mediaBox);
  38860. return shadow(this, 'view', intersection || mediaBox);
  38861. },
  38862. get rotate() {
  38863. var rotate = this.getInheritedPageProp('Rotate') || 0;
  38864. if (rotate % 90 !== 0) {
  38865. rotate = 0;
  38866. } else if (rotate >= 360) {
  38867. rotate = rotate % 360;
  38868. } else if (rotate < 0) {
  38869. rotate = (rotate % 360 + 360) % 360;
  38870. }
  38871. return shadow(this, 'rotate', rotate);
  38872. },
  38873. getContentStream: function Page_getContentStream() {
  38874. var content = this.content;
  38875. var stream;
  38876. if (isArray(content)) {
  38877. var xref = this.xref;
  38878. var i, n = content.length;
  38879. var streams = [];
  38880. for (i = 0; i < n; ++i) {
  38881. streams.push(xref.fetchIfRef(content[i]));
  38882. }
  38883. stream = new StreamsSequenceStream(streams);
  38884. } else if (isStream(content)) {
  38885. stream = content;
  38886. } else {
  38887. stream = new NullStream();
  38888. }
  38889. return stream;
  38890. },
  38891. loadResources: function Page_loadResources(keys) {
  38892. if (!this.resourcesPromise) {
  38893. this.resourcesPromise = this.pdfManager.ensure(this, 'resources');
  38894. }
  38895. return this.resourcesPromise.then(function resourceSuccess() {
  38896. var objectLoader = new ObjectLoader(this.resources.map, keys, this.xref);
  38897. return objectLoader.load();
  38898. }.bind(this));
  38899. },
  38900. getOperatorList: function Page_getOperatorList(handler, task, intent, renderInteractiveForms) {
  38901. var self = this;
  38902. var pdfManager = this.pdfManager;
  38903. var contentStreamPromise = pdfManager.ensure(this, 'getContentStream', []);
  38904. var resourcesPromise = this.loadResources([
  38905. 'ExtGState',
  38906. 'ColorSpace',
  38907. 'Pattern',
  38908. 'Shading',
  38909. 'XObject',
  38910. 'Font'
  38911. ]);
  38912. var partialEvaluator = new PartialEvaluator(pdfManager, this.xref, handler, this.pageIndex, this.idFactory, this.fontCache, this.builtInCMapCache, this.evaluatorOptions);
  38913. var dataPromises = Promise.all([
  38914. contentStreamPromise,
  38915. resourcesPromise
  38916. ]);
  38917. var pageListPromise = dataPromises.then(function (data) {
  38918. var contentStream = data[0];
  38919. var opList = new OperatorList(intent, handler, self.pageIndex);
  38920. handler.send('StartRenderPage', {
  38921. transparency: partialEvaluator.hasBlendModes(self.resources),
  38922. pageIndex: self.pageIndex,
  38923. intent: intent
  38924. });
  38925. return partialEvaluator.getOperatorList(contentStream, task, self.resources, opList).then(function () {
  38926. return opList;
  38927. });
  38928. });
  38929. var annotationsPromise = pdfManager.ensure(this, 'annotations');
  38930. return Promise.all([
  38931. pageListPromise,
  38932. annotationsPromise
  38933. ]).then(function (datas) {
  38934. var pageOpList = datas[0];
  38935. var annotations = datas[1];
  38936. if (annotations.length === 0) {
  38937. pageOpList.flush(true);
  38938. return pageOpList;
  38939. }
  38940. var annotationsReadyPromise = Annotation.appendToOperatorList(annotations, pageOpList, partialEvaluator, task, intent, renderInteractiveForms);
  38941. return annotationsReadyPromise.then(function () {
  38942. pageOpList.flush(true);
  38943. return pageOpList;
  38944. });
  38945. });
  38946. },
  38947. extractTextContent: function Page_extractTextContent(task, normalizeWhitespace, combineTextItems) {
  38948. var handler = {
  38949. on: function nullHandlerOn() {
  38950. },
  38951. send: function nullHandlerSend() {
  38952. }
  38953. };
  38954. var self = this;
  38955. var pdfManager = this.pdfManager;
  38956. var contentStreamPromise = pdfManager.ensure(this, 'getContentStream', []);
  38957. var resourcesPromise = this.loadResources([
  38958. 'ExtGState',
  38959. 'XObject',
  38960. 'Font'
  38961. ]);
  38962. var dataPromises = Promise.all([
  38963. contentStreamPromise,
  38964. resourcesPromise
  38965. ]);
  38966. return dataPromises.then(function (data) {
  38967. var contentStream = data[0];
  38968. var partialEvaluator = new PartialEvaluator(pdfManager, self.xref, handler, self.pageIndex, self.idFactory, self.fontCache, self.builtInCMapCache, self.evaluatorOptions);
  38969. return partialEvaluator.getTextContent(contentStream, task, self.resources, null, normalizeWhitespace, combineTextItems);
  38970. });
  38971. },
  38972. getAnnotationsData: function Page_getAnnotationsData(intent) {
  38973. var annotations = this.annotations;
  38974. var annotationsData = [];
  38975. for (var i = 0, n = annotations.length; i < n; ++i) {
  38976. if (intent) {
  38977. if (!(intent === 'display' && annotations[i].viewable) && !(intent === 'print' && annotations[i].printable)) {
  38978. continue;
  38979. }
  38980. }
  38981. annotationsData.push(annotations[i].data);
  38982. }
  38983. return annotationsData;
  38984. },
  38985. get annotations() {
  38986. var annotations = [];
  38987. var annotationRefs = this.getInheritedPageProp('Annots') || [];
  38988. var annotationFactory = new AnnotationFactory();
  38989. for (var i = 0, n = annotationRefs.length; i < n; ++i) {
  38990. var annotationRef = annotationRefs[i];
  38991. var annotation = annotationFactory.create(this.xref, annotationRef, this.pdfManager, this.idFactory);
  38992. if (annotation) {
  38993. annotations.push(annotation);
  38994. }
  38995. }
  38996. return shadow(this, 'annotations', annotations);
  38997. }
  38998. };
  38999. return Page;
  39000. }();
  39001. var PDFDocument = function PDFDocumentClosure() {
  39002. var FINGERPRINT_FIRST_BYTES = 1024;
  39003. var EMPTY_FINGERPRINT = '\x00\x00\x00\x00\x00\x00\x00' + '\x00\x00\x00\x00\x00\x00\x00\x00\x00';
  39004. function PDFDocument(pdfManager, arg) {
  39005. var stream;
  39006. if (isStream(arg)) {
  39007. stream = arg;
  39008. } else if (isArrayBuffer(arg)) {
  39009. stream = new Stream(arg);
  39010. } else {
  39011. error('PDFDocument: Unknown argument type');
  39012. }
  39013. assert(stream.length > 0, 'stream must have data');
  39014. this.pdfManager = pdfManager;
  39015. this.stream = stream;
  39016. this.xref = new XRef(stream, pdfManager);
  39017. }
  39018. function find(stream, needle, limit, backwards) {
  39019. var pos = stream.pos;
  39020. var end = stream.end;
  39021. var strBuf = [];
  39022. if (pos + limit > end) {
  39023. limit = end - pos;
  39024. }
  39025. for (var n = 0; n < limit; ++n) {
  39026. strBuf.push(String.fromCharCode(stream.getByte()));
  39027. }
  39028. var str = strBuf.join('');
  39029. stream.pos = pos;
  39030. var index = backwards ? str.lastIndexOf(needle) : str.indexOf(needle);
  39031. if (index === -1) {
  39032. return false;
  39033. }
  39034. stream.pos += index;
  39035. return true;
  39036. }
  39037. var DocumentInfoValidators = {
  39038. get entries() {
  39039. return shadow(this, 'entries', {
  39040. Title: isString,
  39041. Author: isString,
  39042. Subject: isString,
  39043. Keywords: isString,
  39044. Creator: isString,
  39045. Producer: isString,
  39046. CreationDate: isString,
  39047. ModDate: isString,
  39048. Trapped: isName
  39049. });
  39050. }
  39051. };
  39052. PDFDocument.prototype = {
  39053. parse: function PDFDocument_parse(recoveryMode) {
  39054. this.setup(recoveryMode);
  39055. var version = this.catalog.catDict.get('Version');
  39056. if (isName(version)) {
  39057. this.pdfFormatVersion = version.name;
  39058. }
  39059. try {
  39060. this.acroForm = this.catalog.catDict.get('AcroForm');
  39061. if (this.acroForm) {
  39062. this.xfa = this.acroForm.get('XFA');
  39063. var fields = this.acroForm.get('Fields');
  39064. if ((!fields || !isArray(fields) || fields.length === 0) && !this.xfa) {
  39065. this.acroForm = null;
  39066. }
  39067. }
  39068. } catch (ex) {
  39069. info('Something wrong with AcroForm entry');
  39070. this.acroForm = null;
  39071. }
  39072. },
  39073. get linearization() {
  39074. var linearization = null;
  39075. if (this.stream.length) {
  39076. try {
  39077. linearization = Linearization.create(this.stream);
  39078. } catch (err) {
  39079. if (err instanceof MissingDataException) {
  39080. throw err;
  39081. }
  39082. info(err);
  39083. }
  39084. }
  39085. return shadow(this, 'linearization', linearization);
  39086. },
  39087. get startXRef() {
  39088. var stream = this.stream;
  39089. var startXRef = 0;
  39090. var linearization = this.linearization;
  39091. if (linearization) {
  39092. stream.reset();
  39093. if (find(stream, 'endobj', 1024)) {
  39094. startXRef = stream.pos + 6;
  39095. }
  39096. } else {
  39097. var step = 1024;
  39098. var found = false, pos = stream.end;
  39099. while (!found && pos > 0) {
  39100. pos -= step - 'startxref'.length;
  39101. if (pos < 0) {
  39102. pos = 0;
  39103. }
  39104. stream.pos = pos;
  39105. found = find(stream, 'startxref', step, true);
  39106. }
  39107. if (found) {
  39108. stream.skip(9);
  39109. var ch;
  39110. do {
  39111. ch = stream.getByte();
  39112. } while (isSpace(ch));
  39113. var str = '';
  39114. while (ch >= 0x20 && ch <= 0x39) {
  39115. str += String.fromCharCode(ch);
  39116. ch = stream.getByte();
  39117. }
  39118. startXRef = parseInt(str, 10);
  39119. if (isNaN(startXRef)) {
  39120. startXRef = 0;
  39121. }
  39122. }
  39123. }
  39124. return shadow(this, 'startXRef', startXRef);
  39125. },
  39126. get mainXRefEntriesOffset() {
  39127. var mainXRefEntriesOffset = 0;
  39128. var linearization = this.linearization;
  39129. if (linearization) {
  39130. mainXRefEntriesOffset = linearization.mainXRefEntriesOffset;
  39131. }
  39132. return shadow(this, 'mainXRefEntriesOffset', mainXRefEntriesOffset);
  39133. },
  39134. checkHeader: function PDFDocument_checkHeader() {
  39135. var stream = this.stream;
  39136. stream.reset();
  39137. if (find(stream, '%PDF-', 1024)) {
  39138. stream.moveStart();
  39139. var MAX_VERSION_LENGTH = 12;
  39140. var version = '', ch;
  39141. while ((ch = stream.getByte()) > 0x20) {
  39142. if (version.length >= MAX_VERSION_LENGTH) {
  39143. break;
  39144. }
  39145. version += String.fromCharCode(ch);
  39146. }
  39147. if (!this.pdfFormatVersion) {
  39148. this.pdfFormatVersion = version.substring(5);
  39149. }
  39150. return;
  39151. }
  39152. },
  39153. parseStartXRef: function PDFDocument_parseStartXRef() {
  39154. var startXRef = this.startXRef;
  39155. this.xref.setStartXRef(startXRef);
  39156. },
  39157. setup: function PDFDocument_setup(recoveryMode) {
  39158. this.xref.parse(recoveryMode);
  39159. var self = this;
  39160. var pageFactory = {
  39161. createPage: function (pageIndex, dict, ref, fontCache, builtInCMapCache) {
  39162. return new Page(self.pdfManager, self.xref, pageIndex, dict, ref, fontCache, builtInCMapCache);
  39163. }
  39164. };
  39165. this.catalog = new Catalog(this.pdfManager, this.xref, pageFactory);
  39166. },
  39167. get numPages() {
  39168. var linearization = this.linearization;
  39169. var num = linearization ? linearization.numPages : this.catalog.numPages;
  39170. return shadow(this, 'numPages', num);
  39171. },
  39172. get documentInfo() {
  39173. var docInfo = {
  39174. PDFFormatVersion: this.pdfFormatVersion,
  39175. IsAcroFormPresent: !!this.acroForm,
  39176. IsXFAPresent: !!this.xfa
  39177. };
  39178. var infoDict;
  39179. try {
  39180. infoDict = this.xref.trailer.get('Info');
  39181. } catch (err) {
  39182. info('The document information dictionary is invalid.');
  39183. }
  39184. if (infoDict) {
  39185. var validEntries = DocumentInfoValidators.entries;
  39186. for (var key in validEntries) {
  39187. if (infoDict.has(key)) {
  39188. var value = infoDict.get(key);
  39189. if (validEntries[key](value)) {
  39190. docInfo[key] = typeof value !== 'string' ? value : stringToPDFString(value);
  39191. } else {
  39192. info('Bad value in document info for "' + key + '"');
  39193. }
  39194. }
  39195. }
  39196. }
  39197. return shadow(this, 'documentInfo', docInfo);
  39198. },
  39199. get fingerprint() {
  39200. var xref = this.xref, hash, fileID = '';
  39201. var idArray = xref.trailer.get('ID');
  39202. if (idArray && isArray(idArray) && idArray[0] && isString(idArray[0]) && idArray[0] !== EMPTY_FINGERPRINT) {
  39203. hash = stringToBytes(idArray[0]);
  39204. } else {
  39205. if (this.stream.ensureRange) {
  39206. this.stream.ensureRange(0, Math.min(FINGERPRINT_FIRST_BYTES, this.stream.end));
  39207. }
  39208. hash = calculateMD5(this.stream.bytes.subarray(0, FINGERPRINT_FIRST_BYTES), 0, FINGERPRINT_FIRST_BYTES);
  39209. }
  39210. for (var i = 0, n = hash.length; i < n; i++) {
  39211. var hex = hash[i].toString(16);
  39212. fileID += hex.length === 1 ? '0' + hex : hex;
  39213. }
  39214. return shadow(this, 'fingerprint', fileID);
  39215. },
  39216. getPage: function PDFDocument_getPage(pageIndex) {
  39217. return this.catalog.getPage(pageIndex);
  39218. },
  39219. cleanup: function PDFDocument_cleanup() {
  39220. return this.catalog.cleanup();
  39221. }
  39222. };
  39223. return PDFDocument;
  39224. }();
  39225. exports.Page = Page;
  39226. exports.PDFDocument = PDFDocument;
  39227. /***/ }),
  39228. /* 25 */
  39229. /***/ (function(module, exports, __w_pdfjs_require__) {
  39230. "use strict";
  39231. var sharedUtil = __w_pdfjs_require__(0);
  39232. var coreStream = __w_pdfjs_require__(2);
  39233. var coreGlyphList = __w_pdfjs_require__(7);
  39234. var coreEncodings = __w_pdfjs_require__(4);
  39235. var coreCFFParser = __w_pdfjs_require__(10);
  39236. var Util = sharedUtil.Util;
  39237. var bytesToString = sharedUtil.bytesToString;
  39238. var error = sharedUtil.error;
  39239. var Stream = coreStream.Stream;
  39240. var getGlyphsUnicode = coreGlyphList.getGlyphsUnicode;
  39241. var StandardEncoding = coreEncodings.StandardEncoding;
  39242. var CFFParser = coreCFFParser.CFFParser;
  39243. var FontRendererFactory = function FontRendererFactoryClosure() {
  39244. function getLong(data, offset) {
  39245. return data[offset] << 24 | data[offset + 1] << 16 | data[offset + 2] << 8 | data[offset + 3];
  39246. }
  39247. function getUshort(data, offset) {
  39248. return data[offset] << 8 | data[offset + 1];
  39249. }
  39250. function parseCmap(data, start, end) {
  39251. var offset = getUshort(data, start + 2) === 1 ? getLong(data, start + 8) : getLong(data, start + 16);
  39252. var format = getUshort(data, start + offset);
  39253. var ranges, p, i;
  39254. if (format === 4) {
  39255. getUshort(data, start + offset + 2);
  39256. var segCount = getUshort(data, start + offset + 6) >> 1;
  39257. p = start + offset + 14;
  39258. ranges = [];
  39259. for (i = 0; i < segCount; i++, p += 2) {
  39260. ranges[i] = { end: getUshort(data, p) };
  39261. }
  39262. p += 2;
  39263. for (i = 0; i < segCount; i++, p += 2) {
  39264. ranges[i].start = getUshort(data, p);
  39265. }
  39266. for (i = 0; i < segCount; i++, p += 2) {
  39267. ranges[i].idDelta = getUshort(data, p);
  39268. }
  39269. for (i = 0; i < segCount; i++, p += 2) {
  39270. var idOffset = getUshort(data, p);
  39271. if (idOffset === 0) {
  39272. continue;
  39273. }
  39274. ranges[i].ids = [];
  39275. for (var j = 0, jj = ranges[i].end - ranges[i].start + 1; j < jj; j++) {
  39276. ranges[i].ids[j] = getUshort(data, p + idOffset);
  39277. idOffset += 2;
  39278. }
  39279. }
  39280. return ranges;
  39281. } else if (format === 12) {
  39282. getLong(data, start + offset + 4);
  39283. var groups = getLong(data, start + offset + 12);
  39284. p = start + offset + 16;
  39285. ranges = [];
  39286. for (i = 0; i < groups; i++) {
  39287. ranges.push({
  39288. start: getLong(data, p),
  39289. end: getLong(data, p + 4),
  39290. idDelta: getLong(data, p + 8) - getLong(data, p)
  39291. });
  39292. p += 12;
  39293. }
  39294. return ranges;
  39295. }
  39296. error('not supported cmap: ' + format);
  39297. }
  39298. function parseCff(data, start, end, seacAnalysisEnabled) {
  39299. var properties = {};
  39300. var parser = new CFFParser(new Stream(data, start, end - start), properties, seacAnalysisEnabled);
  39301. var cff = parser.parse();
  39302. return {
  39303. glyphs: cff.charStrings.objects,
  39304. subrs: cff.topDict.privateDict && cff.topDict.privateDict.subrsIndex && cff.topDict.privateDict.subrsIndex.objects,
  39305. gsubrs: cff.globalSubrIndex && cff.globalSubrIndex.objects
  39306. };
  39307. }
  39308. function parseGlyfTable(glyf, loca, isGlyphLocationsLong) {
  39309. var itemSize, itemDecode;
  39310. if (isGlyphLocationsLong) {
  39311. itemSize = 4;
  39312. itemDecode = function fontItemDecodeLong(data, offset) {
  39313. return data[offset] << 24 | data[offset + 1] << 16 | data[offset + 2] << 8 | data[offset + 3];
  39314. };
  39315. } else {
  39316. itemSize = 2;
  39317. itemDecode = function fontItemDecode(data, offset) {
  39318. return data[offset] << 9 | data[offset + 1] << 1;
  39319. };
  39320. }
  39321. var glyphs = [];
  39322. var startOffset = itemDecode(loca, 0);
  39323. for (var j = itemSize; j < loca.length; j += itemSize) {
  39324. var endOffset = itemDecode(loca, j);
  39325. glyphs.push(glyf.subarray(startOffset, endOffset));
  39326. startOffset = endOffset;
  39327. }
  39328. return glyphs;
  39329. }
  39330. function lookupCmap(ranges, unicode) {
  39331. var code = unicode.charCodeAt(0), gid = 0;
  39332. var l = 0, r = ranges.length - 1;
  39333. while (l < r) {
  39334. var c = l + r + 1 >> 1;
  39335. if (code < ranges[c].start) {
  39336. r = c - 1;
  39337. } else {
  39338. l = c;
  39339. }
  39340. }
  39341. if (ranges[l].start <= code && code <= ranges[l].end) {
  39342. gid = ranges[l].idDelta + (ranges[l].ids ? ranges[l].ids[code - ranges[l].start] : code) & 0xFFFF;
  39343. }
  39344. return {
  39345. charCode: code,
  39346. glyphId: gid
  39347. };
  39348. }
  39349. function compileGlyf(code, cmds, font) {
  39350. function moveTo(x, y) {
  39351. cmds.push({
  39352. cmd: 'moveTo',
  39353. args: [
  39354. x,
  39355. y
  39356. ]
  39357. });
  39358. }
  39359. function lineTo(x, y) {
  39360. cmds.push({
  39361. cmd: 'lineTo',
  39362. args: [
  39363. x,
  39364. y
  39365. ]
  39366. });
  39367. }
  39368. function quadraticCurveTo(xa, ya, x, y) {
  39369. cmds.push({
  39370. cmd: 'quadraticCurveTo',
  39371. args: [
  39372. xa,
  39373. ya,
  39374. x,
  39375. y
  39376. ]
  39377. });
  39378. }
  39379. var i = 0;
  39380. var numberOfContours = (code[i] << 24 | code[i + 1] << 16) >> 16;
  39381. var flags;
  39382. var x = 0, y = 0;
  39383. i += 10;
  39384. if (numberOfContours < 0) {
  39385. do {
  39386. flags = code[i] << 8 | code[i + 1];
  39387. var glyphIndex = code[i + 2] << 8 | code[i + 3];
  39388. i += 4;
  39389. var arg1, arg2;
  39390. if (flags & 0x01) {
  39391. arg1 = (code[i] << 24 | code[i + 1] << 16) >> 16;
  39392. arg2 = (code[i + 2] << 24 | code[i + 3] << 16) >> 16;
  39393. i += 4;
  39394. } else {
  39395. arg1 = code[i++];
  39396. arg2 = code[i++];
  39397. }
  39398. if (flags & 0x02) {
  39399. x = arg1;
  39400. y = arg2;
  39401. } else {
  39402. x = 0;
  39403. y = 0;
  39404. }
  39405. var scaleX = 1, scaleY = 1, scale01 = 0, scale10 = 0;
  39406. if (flags & 0x08) {
  39407. scaleX = scaleY = (code[i] << 24 | code[i + 1] << 16) / 1073741824;
  39408. i += 2;
  39409. } else if (flags & 0x40) {
  39410. scaleX = (code[i] << 24 | code[i + 1] << 16) / 1073741824;
  39411. scaleY = (code[i + 2] << 24 | code[i + 3] << 16) / 1073741824;
  39412. i += 4;
  39413. } else if (flags & 0x80) {
  39414. scaleX = (code[i] << 24 | code[i + 1] << 16) / 1073741824;
  39415. scale01 = (code[i + 2] << 24 | code[i + 3] << 16) / 1073741824;
  39416. scale10 = (code[i + 4] << 24 | code[i + 5] << 16) / 1073741824;
  39417. scaleY = (code[i + 6] << 24 | code[i + 7] << 16) / 1073741824;
  39418. i += 8;
  39419. }
  39420. var subglyph = font.glyphs[glyphIndex];
  39421. if (subglyph) {
  39422. cmds.push({ cmd: 'save' });
  39423. cmds.push({
  39424. cmd: 'transform',
  39425. args: [
  39426. scaleX,
  39427. scale01,
  39428. scale10,
  39429. scaleY,
  39430. x,
  39431. y
  39432. ]
  39433. });
  39434. compileGlyf(subglyph, cmds, font);
  39435. cmds.push({ cmd: 'restore' });
  39436. }
  39437. } while (flags & 0x20);
  39438. } else {
  39439. var endPtsOfContours = [];
  39440. var j, jj;
  39441. for (j = 0; j < numberOfContours; j++) {
  39442. endPtsOfContours.push(code[i] << 8 | code[i + 1]);
  39443. i += 2;
  39444. }
  39445. var instructionLength = code[i] << 8 | code[i + 1];
  39446. i += 2 + instructionLength;
  39447. var numberOfPoints = endPtsOfContours[endPtsOfContours.length - 1] + 1;
  39448. var points = [];
  39449. while (points.length < numberOfPoints) {
  39450. flags = code[i++];
  39451. var repeat = 1;
  39452. if (flags & 0x08) {
  39453. repeat += code[i++];
  39454. }
  39455. while (repeat-- > 0) {
  39456. points.push({ flags: flags });
  39457. }
  39458. }
  39459. for (j = 0; j < numberOfPoints; j++) {
  39460. switch (points[j].flags & 0x12) {
  39461. case 0x00:
  39462. x += (code[i] << 24 | code[i + 1] << 16) >> 16;
  39463. i += 2;
  39464. break;
  39465. case 0x02:
  39466. x -= code[i++];
  39467. break;
  39468. case 0x12:
  39469. x += code[i++];
  39470. break;
  39471. }
  39472. points[j].x = x;
  39473. }
  39474. for (j = 0; j < numberOfPoints; j++) {
  39475. switch (points[j].flags & 0x24) {
  39476. case 0x00:
  39477. y += (code[i] << 24 | code[i + 1] << 16) >> 16;
  39478. i += 2;
  39479. break;
  39480. case 0x04:
  39481. y -= code[i++];
  39482. break;
  39483. case 0x24:
  39484. y += code[i++];
  39485. break;
  39486. }
  39487. points[j].y = y;
  39488. }
  39489. var startPoint = 0;
  39490. for (i = 0; i < numberOfContours; i++) {
  39491. var endPoint = endPtsOfContours[i];
  39492. var contour = points.slice(startPoint, endPoint + 1);
  39493. if (contour[0].flags & 1) {
  39494. contour.push(contour[0]);
  39495. } else if (contour[contour.length - 1].flags & 1) {
  39496. contour.unshift(contour[contour.length - 1]);
  39497. } else {
  39498. var p = {
  39499. flags: 1,
  39500. x: (contour[0].x + contour[contour.length - 1].x) / 2,
  39501. y: (contour[0].y + contour[contour.length - 1].y) / 2
  39502. };
  39503. contour.unshift(p);
  39504. contour.push(p);
  39505. }
  39506. moveTo(contour[0].x, contour[0].y);
  39507. for (j = 1, jj = contour.length; j < jj; j++) {
  39508. if (contour[j].flags & 1) {
  39509. lineTo(contour[j].x, contour[j].y);
  39510. } else if (contour[j + 1].flags & 1) {
  39511. quadraticCurveTo(contour[j].x, contour[j].y, contour[j + 1].x, contour[j + 1].y);
  39512. j++;
  39513. } else {
  39514. quadraticCurveTo(contour[j].x, contour[j].y, (contour[j].x + contour[j + 1].x) / 2, (contour[j].y + contour[j + 1].y) / 2);
  39515. }
  39516. }
  39517. startPoint = endPoint + 1;
  39518. }
  39519. }
  39520. }
  39521. function compileCharString(code, cmds, font) {
  39522. var stack = [];
  39523. var x = 0, y = 0;
  39524. var stems = 0;
  39525. function moveTo(x, y) {
  39526. cmds.push({
  39527. cmd: 'moveTo',
  39528. args: [
  39529. x,
  39530. y
  39531. ]
  39532. });
  39533. }
  39534. function lineTo(x, y) {
  39535. cmds.push({
  39536. cmd: 'lineTo',
  39537. args: [
  39538. x,
  39539. y
  39540. ]
  39541. });
  39542. }
  39543. function bezierCurveTo(x1, y1, x2, y2, x, y) {
  39544. cmds.push({
  39545. cmd: 'bezierCurveTo',
  39546. args: [
  39547. x1,
  39548. y1,
  39549. x2,
  39550. y2,
  39551. x,
  39552. y
  39553. ]
  39554. });
  39555. }
  39556. function parse(code) {
  39557. var i = 0;
  39558. while (i < code.length) {
  39559. var stackClean = false;
  39560. var v = code[i++];
  39561. var xa, xb, ya, yb, y1, y2, y3, n, subrCode;
  39562. switch (v) {
  39563. case 1:
  39564. stems += stack.length >> 1;
  39565. stackClean = true;
  39566. break;
  39567. case 3:
  39568. stems += stack.length >> 1;
  39569. stackClean = true;
  39570. break;
  39571. case 4:
  39572. y += stack.pop();
  39573. moveTo(x, y);
  39574. stackClean = true;
  39575. break;
  39576. case 5:
  39577. while (stack.length > 0) {
  39578. x += stack.shift();
  39579. y += stack.shift();
  39580. lineTo(x, y);
  39581. }
  39582. break;
  39583. case 6:
  39584. while (stack.length > 0) {
  39585. x += stack.shift();
  39586. lineTo(x, y);
  39587. if (stack.length === 0) {
  39588. break;
  39589. }
  39590. y += stack.shift();
  39591. lineTo(x, y);
  39592. }
  39593. break;
  39594. case 7:
  39595. while (stack.length > 0) {
  39596. y += stack.shift();
  39597. lineTo(x, y);
  39598. if (stack.length === 0) {
  39599. break;
  39600. }
  39601. x += stack.shift();
  39602. lineTo(x, y);
  39603. }
  39604. break;
  39605. case 8:
  39606. while (stack.length > 0) {
  39607. xa = x + stack.shift();
  39608. ya = y + stack.shift();
  39609. xb = xa + stack.shift();
  39610. yb = ya + stack.shift();
  39611. x = xb + stack.shift();
  39612. y = yb + stack.shift();
  39613. bezierCurveTo(xa, ya, xb, yb, x, y);
  39614. }
  39615. break;
  39616. case 10:
  39617. n = stack.pop() + font.subrsBias;
  39618. subrCode = font.subrs[n];
  39619. if (subrCode) {
  39620. parse(subrCode);
  39621. }
  39622. break;
  39623. case 11:
  39624. return;
  39625. case 12:
  39626. v = code[i++];
  39627. switch (v) {
  39628. case 34:
  39629. xa = x + stack.shift();
  39630. xb = xa + stack.shift();
  39631. y1 = y + stack.shift();
  39632. x = xb + stack.shift();
  39633. bezierCurveTo(xa, y, xb, y1, x, y1);
  39634. xa = x + stack.shift();
  39635. xb = xa + stack.shift();
  39636. x = xb + stack.shift();
  39637. bezierCurveTo(xa, y1, xb, y, x, y);
  39638. break;
  39639. case 35:
  39640. xa = x + stack.shift();
  39641. ya = y + stack.shift();
  39642. xb = xa + stack.shift();
  39643. yb = ya + stack.shift();
  39644. x = xb + stack.shift();
  39645. y = yb + stack.shift();
  39646. bezierCurveTo(xa, ya, xb, yb, x, y);
  39647. xa = x + stack.shift();
  39648. ya = y + stack.shift();
  39649. xb = xa + stack.shift();
  39650. yb = ya + stack.shift();
  39651. x = xb + stack.shift();
  39652. y = yb + stack.shift();
  39653. bezierCurveTo(xa, ya, xb, yb, x, y);
  39654. stack.pop();
  39655. break;
  39656. case 36:
  39657. xa = x + stack.shift();
  39658. y1 = y + stack.shift();
  39659. xb = xa + stack.shift();
  39660. y2 = y1 + stack.shift();
  39661. x = xb + stack.shift();
  39662. bezierCurveTo(xa, y1, xb, y2, x, y2);
  39663. xa = x + stack.shift();
  39664. xb = xa + stack.shift();
  39665. y3 = y2 + stack.shift();
  39666. x = xb + stack.shift();
  39667. bezierCurveTo(xa, y2, xb, y3, x, y);
  39668. break;
  39669. case 37:
  39670. var x0 = x, y0 = y;
  39671. xa = x + stack.shift();
  39672. ya = y + stack.shift();
  39673. xb = xa + stack.shift();
  39674. yb = ya + stack.shift();
  39675. x = xb + stack.shift();
  39676. y = yb + stack.shift();
  39677. bezierCurveTo(xa, ya, xb, yb, x, y);
  39678. xa = x + stack.shift();
  39679. ya = y + stack.shift();
  39680. xb = xa + stack.shift();
  39681. yb = ya + stack.shift();
  39682. x = xb;
  39683. y = yb;
  39684. if (Math.abs(x - x0) > Math.abs(y - y0)) {
  39685. x += stack.shift();
  39686. } else {
  39687. y += stack.shift();
  39688. }
  39689. bezierCurveTo(xa, ya, xb, yb, x, y);
  39690. break;
  39691. default:
  39692. error('unknown operator: 12 ' + v);
  39693. }
  39694. break;
  39695. case 14:
  39696. if (stack.length >= 4) {
  39697. var achar = stack.pop();
  39698. var bchar = stack.pop();
  39699. y = stack.pop();
  39700. x = stack.pop();
  39701. cmds.push({ cmd: 'save' });
  39702. cmds.push({
  39703. cmd: 'translate',
  39704. args: [
  39705. x,
  39706. y
  39707. ]
  39708. });
  39709. var cmap = lookupCmap(font.cmap, String.fromCharCode(font.glyphNameMap[StandardEncoding[achar]]));
  39710. compileCharString(font.glyphs[cmap.glyphId], cmds, font);
  39711. cmds.push({ cmd: 'restore' });
  39712. cmap = lookupCmap(font.cmap, String.fromCharCode(font.glyphNameMap[StandardEncoding[bchar]]));
  39713. compileCharString(font.glyphs[cmap.glyphId], cmds, font);
  39714. }
  39715. return;
  39716. case 18:
  39717. stems += stack.length >> 1;
  39718. stackClean = true;
  39719. break;
  39720. case 19:
  39721. stems += stack.length >> 1;
  39722. i += stems + 7 >> 3;
  39723. stackClean = true;
  39724. break;
  39725. case 20:
  39726. stems += stack.length >> 1;
  39727. i += stems + 7 >> 3;
  39728. stackClean = true;
  39729. break;
  39730. case 21:
  39731. y += stack.pop();
  39732. x += stack.pop();
  39733. moveTo(x, y);
  39734. stackClean = true;
  39735. break;
  39736. case 22:
  39737. x += stack.pop();
  39738. moveTo(x, y);
  39739. stackClean = true;
  39740. break;
  39741. case 23:
  39742. stems += stack.length >> 1;
  39743. stackClean = true;
  39744. break;
  39745. case 24:
  39746. while (stack.length > 2) {
  39747. xa = x + stack.shift();
  39748. ya = y + stack.shift();
  39749. xb = xa + stack.shift();
  39750. yb = ya + stack.shift();
  39751. x = xb + stack.shift();
  39752. y = yb + stack.shift();
  39753. bezierCurveTo(xa, ya, xb, yb, x, y);
  39754. }
  39755. x += stack.shift();
  39756. y += stack.shift();
  39757. lineTo(x, y);
  39758. break;
  39759. case 25:
  39760. while (stack.length > 6) {
  39761. x += stack.shift();
  39762. y += stack.shift();
  39763. lineTo(x, y);
  39764. }
  39765. xa = x + stack.shift();
  39766. ya = y + stack.shift();
  39767. xb = xa + stack.shift();
  39768. yb = ya + stack.shift();
  39769. x = xb + stack.shift();
  39770. y = yb + stack.shift();
  39771. bezierCurveTo(xa, ya, xb, yb, x, y);
  39772. break;
  39773. case 26:
  39774. if (stack.length % 2) {
  39775. x += stack.shift();
  39776. }
  39777. while (stack.length > 0) {
  39778. xa = x;
  39779. ya = y + stack.shift();
  39780. xb = xa + stack.shift();
  39781. yb = ya + stack.shift();
  39782. x = xb;
  39783. y = yb + stack.shift();
  39784. bezierCurveTo(xa, ya, xb, yb, x, y);
  39785. }
  39786. break;
  39787. case 27:
  39788. if (stack.length % 2) {
  39789. y += stack.shift();
  39790. }
  39791. while (stack.length > 0) {
  39792. xa = x + stack.shift();
  39793. ya = y;
  39794. xb = xa + stack.shift();
  39795. yb = ya + stack.shift();
  39796. x = xb + stack.shift();
  39797. y = yb;
  39798. bezierCurveTo(xa, ya, xb, yb, x, y);
  39799. }
  39800. break;
  39801. case 28:
  39802. stack.push((code[i] << 24 | code[i + 1] << 16) >> 16);
  39803. i += 2;
  39804. break;
  39805. case 29:
  39806. n = stack.pop() + font.gsubrsBias;
  39807. subrCode = font.gsubrs[n];
  39808. if (subrCode) {
  39809. parse(subrCode);
  39810. }
  39811. break;
  39812. case 30:
  39813. while (stack.length > 0) {
  39814. xa = x;
  39815. ya = y + stack.shift();
  39816. xb = xa + stack.shift();
  39817. yb = ya + stack.shift();
  39818. x = xb + stack.shift();
  39819. y = yb + (stack.length === 1 ? stack.shift() : 0);
  39820. bezierCurveTo(xa, ya, xb, yb, x, y);
  39821. if (stack.length === 0) {
  39822. break;
  39823. }
  39824. xa = x + stack.shift();
  39825. ya = y;
  39826. xb = xa + stack.shift();
  39827. yb = ya + stack.shift();
  39828. y = yb + stack.shift();
  39829. x = xb + (stack.length === 1 ? stack.shift() : 0);
  39830. bezierCurveTo(xa, ya, xb, yb, x, y);
  39831. }
  39832. break;
  39833. case 31:
  39834. while (stack.length > 0) {
  39835. xa = x + stack.shift();
  39836. ya = y;
  39837. xb = xa + stack.shift();
  39838. yb = ya + stack.shift();
  39839. y = yb + stack.shift();
  39840. x = xb + (stack.length === 1 ? stack.shift() : 0);
  39841. bezierCurveTo(xa, ya, xb, yb, x, y);
  39842. if (stack.length === 0) {
  39843. break;
  39844. }
  39845. xa = x;
  39846. ya = y + stack.shift();
  39847. xb = xa + stack.shift();
  39848. yb = ya + stack.shift();
  39849. x = xb + stack.shift();
  39850. y = yb + (stack.length === 1 ? stack.shift() : 0);
  39851. bezierCurveTo(xa, ya, xb, yb, x, y);
  39852. }
  39853. break;
  39854. default:
  39855. if (v < 32) {
  39856. error('unknown operator: ' + v);
  39857. }
  39858. if (v < 247) {
  39859. stack.push(v - 139);
  39860. } else if (v < 251) {
  39861. stack.push((v - 247) * 256 + code[i++] + 108);
  39862. } else if (v < 255) {
  39863. stack.push(-(v - 251) * 256 - code[i++] - 108);
  39864. } else {
  39865. stack.push((code[i] << 24 | code[i + 1] << 16 | code[i + 2] << 8 | code[i + 3]) / 65536);
  39866. i += 4;
  39867. }
  39868. break;
  39869. }
  39870. if (stackClean) {
  39871. stack.length = 0;
  39872. }
  39873. }
  39874. }
  39875. parse(code);
  39876. }
  39877. var noop = '';
  39878. function CompiledFont(fontMatrix) {
  39879. this.compiledGlyphs = Object.create(null);
  39880. this.compiledCharCodeToGlyphId = Object.create(null);
  39881. this.fontMatrix = fontMatrix;
  39882. }
  39883. CompiledFont.prototype = {
  39884. getPathJs: function (unicode) {
  39885. var cmap = lookupCmap(this.cmap, unicode);
  39886. var fn = this.compiledGlyphs[cmap.glyphId];
  39887. if (!fn) {
  39888. fn = this.compileGlyph(this.glyphs[cmap.glyphId]);
  39889. this.compiledGlyphs[cmap.glyphId] = fn;
  39890. }
  39891. if (this.compiledCharCodeToGlyphId[cmap.charCode] === undefined) {
  39892. this.compiledCharCodeToGlyphId[cmap.charCode] = cmap.glyphId;
  39893. }
  39894. return fn;
  39895. },
  39896. compileGlyph: function (code) {
  39897. if (!code || code.length === 0 || code[0] === 14) {
  39898. return noop;
  39899. }
  39900. var cmds = [];
  39901. cmds.push({ cmd: 'save' });
  39902. cmds.push({
  39903. cmd: 'transform',
  39904. args: this.fontMatrix.slice()
  39905. });
  39906. cmds.push({
  39907. cmd: 'scale',
  39908. args: [
  39909. 'size',
  39910. '-size'
  39911. ]
  39912. });
  39913. this.compileGlyphImpl(code, cmds);
  39914. cmds.push({ cmd: 'restore' });
  39915. return cmds;
  39916. },
  39917. compileGlyphImpl: function () {
  39918. error('Children classes should implement this.');
  39919. },
  39920. hasBuiltPath: function (unicode) {
  39921. var cmap = lookupCmap(this.cmap, unicode);
  39922. return this.compiledGlyphs[cmap.glyphId] !== undefined && this.compiledCharCodeToGlyphId[cmap.charCode] !== undefined;
  39923. }
  39924. };
  39925. function TrueTypeCompiled(glyphs, cmap, fontMatrix) {
  39926. fontMatrix = fontMatrix || [
  39927. 0.000488,
  39928. 0,
  39929. 0,
  39930. 0.000488,
  39931. 0,
  39932. 0
  39933. ];
  39934. CompiledFont.call(this, fontMatrix);
  39935. this.glyphs = glyphs;
  39936. this.cmap = cmap;
  39937. }
  39938. Util.inherit(TrueTypeCompiled, CompiledFont, {
  39939. compileGlyphImpl: function (code, cmds) {
  39940. compileGlyf(code, cmds, this);
  39941. }
  39942. });
  39943. function Type2Compiled(cffInfo, cmap, fontMatrix, glyphNameMap) {
  39944. fontMatrix = fontMatrix || [
  39945. 0.001,
  39946. 0,
  39947. 0,
  39948. 0.001,
  39949. 0,
  39950. 0
  39951. ];
  39952. CompiledFont.call(this, fontMatrix);
  39953. this.glyphs = cffInfo.glyphs;
  39954. this.gsubrs = cffInfo.gsubrs || [];
  39955. this.subrs = cffInfo.subrs || [];
  39956. this.cmap = cmap;
  39957. this.glyphNameMap = glyphNameMap || getGlyphsUnicode();
  39958. this.gsubrsBias = this.gsubrs.length < 1240 ? 107 : this.gsubrs.length < 33900 ? 1131 : 32768;
  39959. this.subrsBias = this.subrs.length < 1240 ? 107 : this.subrs.length < 33900 ? 1131 : 32768;
  39960. }
  39961. Util.inherit(Type2Compiled, CompiledFont, {
  39962. compileGlyphImpl: function (code, cmds) {
  39963. compileCharString(code, cmds, this);
  39964. }
  39965. });
  39966. return {
  39967. create: function FontRendererFactory_create(font, seacAnalysisEnabled) {
  39968. var data = new Uint8Array(font.data);
  39969. var cmap, glyf, loca, cff, indexToLocFormat, unitsPerEm;
  39970. var numTables = getUshort(data, 4);
  39971. for (var i = 0, p = 12; i < numTables; i++, p += 16) {
  39972. var tag = bytesToString(data.subarray(p, p + 4));
  39973. var offset = getLong(data, p + 8);
  39974. var length = getLong(data, p + 12);
  39975. switch (tag) {
  39976. case 'cmap':
  39977. cmap = parseCmap(data, offset, offset + length);
  39978. break;
  39979. case 'glyf':
  39980. glyf = data.subarray(offset, offset + length);
  39981. break;
  39982. case 'loca':
  39983. loca = data.subarray(offset, offset + length);
  39984. break;
  39985. case 'head':
  39986. unitsPerEm = getUshort(data, offset + 18);
  39987. indexToLocFormat = getUshort(data, offset + 50);
  39988. break;
  39989. case 'CFF ':
  39990. cff = parseCff(data, offset, offset + length, seacAnalysisEnabled);
  39991. break;
  39992. }
  39993. }
  39994. if (glyf) {
  39995. var fontMatrix = !unitsPerEm ? font.fontMatrix : [
  39996. 1 / unitsPerEm,
  39997. 0,
  39998. 0,
  39999. 1 / unitsPerEm,
  40000. 0,
  40001. 0
  40002. ];
  40003. return new TrueTypeCompiled(parseGlyfTable(glyf, loca, indexToLocFormat), cmap, fontMatrix);
  40004. }
  40005. return new Type2Compiled(cff, cmap, font.fontMatrix, font.glyphNameMap);
  40006. }
  40007. };
  40008. }();
  40009. exports.FontRendererFactory = FontRendererFactory;
  40010. /***/ }),
  40011. /* 26 */
  40012. /***/ (function(module, exports, __w_pdfjs_require__) {
  40013. "use strict";
  40014. var sharedUtil = __w_pdfjs_require__(0);
  40015. var corePrimitives = __w_pdfjs_require__(1);
  40016. var coreStream = __w_pdfjs_require__(2);
  40017. var coreGlyphList = __w_pdfjs_require__(7);
  40018. var coreFontRenderer = __w_pdfjs_require__(25);
  40019. var coreEncodings = __w_pdfjs_require__(4);
  40020. var coreStandardFonts = __w_pdfjs_require__(16);
  40021. var coreUnicode = __w_pdfjs_require__(17);
  40022. var coreType1Parser = __w_pdfjs_require__(35);
  40023. var coreCFFParser = __w_pdfjs_require__(10);
  40024. var FONT_IDENTITY_MATRIX = sharedUtil.FONT_IDENTITY_MATRIX;
  40025. var FontType = sharedUtil.FontType;
  40026. var assert = sharedUtil.assert;
  40027. var bytesToString = sharedUtil.bytesToString;
  40028. var error = sharedUtil.error;
  40029. var info = sharedUtil.info;
  40030. var isArray = sharedUtil.isArray;
  40031. var isInt = sharedUtil.isInt;
  40032. var isNum = sharedUtil.isNum;
  40033. var readUint32 = sharedUtil.readUint32;
  40034. var shadow = sharedUtil.shadow;
  40035. var string32 = sharedUtil.string32;
  40036. var warn = sharedUtil.warn;
  40037. var MissingDataException = sharedUtil.MissingDataException;
  40038. var isSpace = sharedUtil.isSpace;
  40039. var Stream = coreStream.Stream;
  40040. var getGlyphsUnicode = coreGlyphList.getGlyphsUnicode;
  40041. var getDingbatsGlyphsUnicode = coreGlyphList.getDingbatsGlyphsUnicode;
  40042. var FontRendererFactory = coreFontRenderer.FontRendererFactory;
  40043. var StandardEncoding = coreEncodings.StandardEncoding;
  40044. var MacRomanEncoding = coreEncodings.MacRomanEncoding;
  40045. var SymbolSetEncoding = coreEncodings.SymbolSetEncoding;
  40046. var ZapfDingbatsEncoding = coreEncodings.ZapfDingbatsEncoding;
  40047. var getEncoding = coreEncodings.getEncoding;
  40048. var getStdFontMap = coreStandardFonts.getStdFontMap;
  40049. var getNonStdFontMap = coreStandardFonts.getNonStdFontMap;
  40050. var getGlyphMapForStandardFonts = coreStandardFonts.getGlyphMapForStandardFonts;
  40051. var getSupplementalGlyphMapForArialBlack = coreStandardFonts.getSupplementalGlyphMapForArialBlack;
  40052. var getUnicodeRangeFor = coreUnicode.getUnicodeRangeFor;
  40053. var mapSpecialUnicodeValues = coreUnicode.mapSpecialUnicodeValues;
  40054. var getUnicodeForGlyph = coreUnicode.getUnicodeForGlyph;
  40055. var Type1Parser = coreType1Parser.Type1Parser;
  40056. var CFFStandardStrings = coreCFFParser.CFFStandardStrings;
  40057. var CFFParser = coreCFFParser.CFFParser;
  40058. var CFFCompiler = coreCFFParser.CFFCompiler;
  40059. var CFF = coreCFFParser.CFF;
  40060. var CFFHeader = coreCFFParser.CFFHeader;
  40061. var CFFTopDict = coreCFFParser.CFFTopDict;
  40062. var CFFPrivateDict = coreCFFParser.CFFPrivateDict;
  40063. var CFFStrings = coreCFFParser.CFFStrings;
  40064. var CFFIndex = coreCFFParser.CFFIndex;
  40065. var CFFCharset = coreCFFParser.CFFCharset;
  40066. var PRIVATE_USE_OFFSET_START = 0xE000;
  40067. var PRIVATE_USE_OFFSET_END = 0xF8FF;
  40068. var SKIP_PRIVATE_USE_RANGE_F000_TO_F01F = false;
  40069. var PDF_GLYPH_SPACE_UNITS = 1000;
  40070. var SEAC_ANALYSIS_ENABLED = false;
  40071. var FontFlags = {
  40072. FixedPitch: 1,
  40073. Serif: 2,
  40074. Symbolic: 4,
  40075. Script: 8,
  40076. Nonsymbolic: 32,
  40077. Italic: 64,
  40078. AllCap: 65536,
  40079. SmallCap: 131072,
  40080. ForceBold: 262144
  40081. };
  40082. var MacStandardGlyphOrdering = [
  40083. '.notdef',
  40084. '.null',
  40085. 'nonmarkingreturn',
  40086. 'space',
  40087. 'exclam',
  40088. 'quotedbl',
  40089. 'numbersign',
  40090. 'dollar',
  40091. 'percent',
  40092. 'ampersand',
  40093. 'quotesingle',
  40094. 'parenleft',
  40095. 'parenright',
  40096. 'asterisk',
  40097. 'plus',
  40098. 'comma',
  40099. 'hyphen',
  40100. 'period',
  40101. 'slash',
  40102. 'zero',
  40103. 'one',
  40104. 'two',
  40105. 'three',
  40106. 'four',
  40107. 'five',
  40108. 'six',
  40109. 'seven',
  40110. 'eight',
  40111. 'nine',
  40112. 'colon',
  40113. 'semicolon',
  40114. 'less',
  40115. 'equal',
  40116. 'greater',
  40117. 'question',
  40118. 'at',
  40119. 'A',
  40120. 'B',
  40121. 'C',
  40122. 'D',
  40123. 'E',
  40124. 'F',
  40125. 'G',
  40126. 'H',
  40127. 'I',
  40128. 'J',
  40129. 'K',
  40130. 'L',
  40131. 'M',
  40132. 'N',
  40133. 'O',
  40134. 'P',
  40135. 'Q',
  40136. 'R',
  40137. 'S',
  40138. 'T',
  40139. 'U',
  40140. 'V',
  40141. 'W',
  40142. 'X',
  40143. 'Y',
  40144. 'Z',
  40145. 'bracketleft',
  40146. 'backslash',
  40147. 'bracketright',
  40148. 'asciicircum',
  40149. 'underscore',
  40150. 'grave',
  40151. 'a',
  40152. 'b',
  40153. 'c',
  40154. 'd',
  40155. 'e',
  40156. 'f',
  40157. 'g',
  40158. 'h',
  40159. 'i',
  40160. 'j',
  40161. 'k',
  40162. 'l',
  40163. 'm',
  40164. 'n',
  40165. 'o',
  40166. 'p',
  40167. 'q',
  40168. 'r',
  40169. 's',
  40170. 't',
  40171. 'u',
  40172. 'v',
  40173. 'w',
  40174. 'x',
  40175. 'y',
  40176. 'z',
  40177. 'braceleft',
  40178. 'bar',
  40179. 'braceright',
  40180. 'asciitilde',
  40181. 'Adieresis',
  40182. 'Aring',
  40183. 'Ccedilla',
  40184. 'Eacute',
  40185. 'Ntilde',
  40186. 'Odieresis',
  40187. 'Udieresis',
  40188. 'aacute',
  40189. 'agrave',
  40190. 'acircumflex',
  40191. 'adieresis',
  40192. 'atilde',
  40193. 'aring',
  40194. 'ccedilla',
  40195. 'eacute',
  40196. 'egrave',
  40197. 'ecircumflex',
  40198. 'edieresis',
  40199. 'iacute',
  40200. 'igrave',
  40201. 'icircumflex',
  40202. 'idieresis',
  40203. 'ntilde',
  40204. 'oacute',
  40205. 'ograve',
  40206. 'ocircumflex',
  40207. 'odieresis',
  40208. 'otilde',
  40209. 'uacute',
  40210. 'ugrave',
  40211. 'ucircumflex',
  40212. 'udieresis',
  40213. 'dagger',
  40214. 'degree',
  40215. 'cent',
  40216. 'sterling',
  40217. 'section',
  40218. 'bullet',
  40219. 'paragraph',
  40220. 'germandbls',
  40221. 'registered',
  40222. 'copyright',
  40223. 'trademark',
  40224. 'acute',
  40225. 'dieresis',
  40226. 'notequal',
  40227. 'AE',
  40228. 'Oslash',
  40229. 'infinity',
  40230. 'plusminus',
  40231. 'lessequal',
  40232. 'greaterequal',
  40233. 'yen',
  40234. 'mu',
  40235. 'partialdiff',
  40236. 'summation',
  40237. 'product',
  40238. 'pi',
  40239. 'integral',
  40240. 'ordfeminine',
  40241. 'ordmasculine',
  40242. 'Omega',
  40243. 'ae',
  40244. 'oslash',
  40245. 'questiondown',
  40246. 'exclamdown',
  40247. 'logicalnot',
  40248. 'radical',
  40249. 'florin',
  40250. 'approxequal',
  40251. 'Delta',
  40252. 'guillemotleft',
  40253. 'guillemotright',
  40254. 'ellipsis',
  40255. 'nonbreakingspace',
  40256. 'Agrave',
  40257. 'Atilde',
  40258. 'Otilde',
  40259. 'OE',
  40260. 'oe',
  40261. 'endash',
  40262. 'emdash',
  40263. 'quotedblleft',
  40264. 'quotedblright',
  40265. 'quoteleft',
  40266. 'quoteright',
  40267. 'divide',
  40268. 'lozenge',
  40269. 'ydieresis',
  40270. 'Ydieresis',
  40271. 'fraction',
  40272. 'currency',
  40273. 'guilsinglleft',
  40274. 'guilsinglright',
  40275. 'fi',
  40276. 'fl',
  40277. 'daggerdbl',
  40278. 'periodcentered',
  40279. 'quotesinglbase',
  40280. 'quotedblbase',
  40281. 'perthousand',
  40282. 'Acircumflex',
  40283. 'Ecircumflex',
  40284. 'Aacute',
  40285. 'Edieresis',
  40286. 'Egrave',
  40287. 'Iacute',
  40288. 'Icircumflex',
  40289. 'Idieresis',
  40290. 'Igrave',
  40291. 'Oacute',
  40292. 'Ocircumflex',
  40293. 'apple',
  40294. 'Ograve',
  40295. 'Uacute',
  40296. 'Ucircumflex',
  40297. 'Ugrave',
  40298. 'dotlessi',
  40299. 'circumflex',
  40300. 'tilde',
  40301. 'macron',
  40302. 'breve',
  40303. 'dotaccent',
  40304. 'ring',
  40305. 'cedilla',
  40306. 'hungarumlaut',
  40307. 'ogonek',
  40308. 'caron',
  40309. 'Lslash',
  40310. 'lslash',
  40311. 'Scaron',
  40312. 'scaron',
  40313. 'Zcaron',
  40314. 'zcaron',
  40315. 'brokenbar',
  40316. 'Eth',
  40317. 'eth',
  40318. 'Yacute',
  40319. 'yacute',
  40320. 'Thorn',
  40321. 'thorn',
  40322. 'minus',
  40323. 'multiply',
  40324. 'onesuperior',
  40325. 'twosuperior',
  40326. 'threesuperior',
  40327. 'onehalf',
  40328. 'onequarter',
  40329. 'threequarters',
  40330. 'franc',
  40331. 'Gbreve',
  40332. 'gbreve',
  40333. 'Idotaccent',
  40334. 'Scedilla',
  40335. 'scedilla',
  40336. 'Cacute',
  40337. 'cacute',
  40338. 'Ccaron',
  40339. 'ccaron',
  40340. 'dcroat'
  40341. ];
  40342. function adjustWidths(properties) {
  40343. if (!properties.fontMatrix) {
  40344. return;
  40345. }
  40346. if (properties.fontMatrix[0] === FONT_IDENTITY_MATRIX[0]) {
  40347. return;
  40348. }
  40349. var scale = 0.001 / properties.fontMatrix[0];
  40350. var glyphsWidths = properties.widths;
  40351. for (var glyph in glyphsWidths) {
  40352. glyphsWidths[glyph] *= scale;
  40353. }
  40354. properties.defaultWidth *= scale;
  40355. }
  40356. function adjustToUnicode(properties, builtInEncoding) {
  40357. if (properties.hasIncludedToUnicodeMap) {
  40358. return;
  40359. }
  40360. if (properties.hasEncoding) {
  40361. return;
  40362. }
  40363. if (builtInEncoding === properties.defaultEncoding) {
  40364. return;
  40365. }
  40366. if (properties.toUnicode instanceof IdentityToUnicodeMap) {
  40367. return;
  40368. }
  40369. var toUnicode = [], glyphsUnicodeMap = getGlyphsUnicode();
  40370. for (var charCode in builtInEncoding) {
  40371. var glyphName = builtInEncoding[charCode];
  40372. var unicode = getUnicodeForGlyph(glyphName, glyphsUnicodeMap);
  40373. if (unicode !== -1) {
  40374. toUnicode[charCode] = String.fromCharCode(unicode);
  40375. }
  40376. }
  40377. properties.toUnicode.amend(toUnicode);
  40378. }
  40379. function getFontType(type, subtype) {
  40380. switch (type) {
  40381. case 'Type1':
  40382. return subtype === 'Type1C' ? FontType.TYPE1C : FontType.TYPE1;
  40383. case 'CIDFontType0':
  40384. return subtype === 'CIDFontType0C' ? FontType.CIDFONTTYPE0C : FontType.CIDFONTTYPE0;
  40385. case 'OpenType':
  40386. return FontType.OPENTYPE;
  40387. case 'TrueType':
  40388. return FontType.TRUETYPE;
  40389. case 'CIDFontType2':
  40390. return FontType.CIDFONTTYPE2;
  40391. case 'MMType1':
  40392. return FontType.MMTYPE1;
  40393. case 'Type0':
  40394. return FontType.TYPE0;
  40395. default:
  40396. return FontType.UNKNOWN;
  40397. }
  40398. }
  40399. function recoverGlyphName(name, glyphsUnicodeMap) {
  40400. if (glyphsUnicodeMap[name] !== undefined) {
  40401. return name;
  40402. }
  40403. var unicode = getUnicodeForGlyph(name, glyphsUnicodeMap);
  40404. if (unicode !== -1) {
  40405. for (var key in glyphsUnicodeMap) {
  40406. if (glyphsUnicodeMap[key] === unicode) {
  40407. return key;
  40408. }
  40409. }
  40410. }
  40411. info('Unable to recover a standard glyph name for: ' + name);
  40412. return name;
  40413. }
  40414. var Glyph = function GlyphClosure() {
  40415. function Glyph(fontChar, unicode, accent, width, vmetric, operatorListId, isSpace, isInFont) {
  40416. this.fontChar = fontChar;
  40417. this.unicode = unicode;
  40418. this.accent = accent;
  40419. this.width = width;
  40420. this.vmetric = vmetric;
  40421. this.operatorListId = operatorListId;
  40422. this.isSpace = isSpace;
  40423. this.isInFont = isInFont;
  40424. }
  40425. Glyph.prototype.matchesForCache = function (fontChar, unicode, accent, width, vmetric, operatorListId, isSpace, isInFont) {
  40426. 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;
  40427. };
  40428. return Glyph;
  40429. }();
  40430. var ToUnicodeMap = function ToUnicodeMapClosure() {
  40431. function ToUnicodeMap(cmap) {
  40432. this._map = cmap;
  40433. }
  40434. ToUnicodeMap.prototype = {
  40435. get length() {
  40436. return this._map.length;
  40437. },
  40438. forEach: function (callback) {
  40439. for (var charCode in this._map) {
  40440. callback(charCode, this._map[charCode].charCodeAt(0));
  40441. }
  40442. },
  40443. has: function (i) {
  40444. return this._map[i] !== undefined;
  40445. },
  40446. get: function (i) {
  40447. return this._map[i];
  40448. },
  40449. charCodeOf: function (v) {
  40450. return this._map.indexOf(v);
  40451. },
  40452. amend: function (map) {
  40453. for (var charCode in map) {
  40454. this._map[charCode] = map[charCode];
  40455. }
  40456. }
  40457. };
  40458. return ToUnicodeMap;
  40459. }();
  40460. var IdentityToUnicodeMap = function IdentityToUnicodeMapClosure() {
  40461. function IdentityToUnicodeMap(firstChar, lastChar) {
  40462. this.firstChar = firstChar;
  40463. this.lastChar = lastChar;
  40464. }
  40465. IdentityToUnicodeMap.prototype = {
  40466. get length() {
  40467. return this.lastChar + 1 - this.firstChar;
  40468. },
  40469. forEach: function (callback) {
  40470. for (var i = this.firstChar, ii = this.lastChar; i <= ii; i++) {
  40471. callback(i, i);
  40472. }
  40473. },
  40474. has: function (i) {
  40475. return this.firstChar <= i && i <= this.lastChar;
  40476. },
  40477. get: function (i) {
  40478. if (this.firstChar <= i && i <= this.lastChar) {
  40479. return String.fromCharCode(i);
  40480. }
  40481. return undefined;
  40482. },
  40483. charCodeOf: function (v) {
  40484. return isInt(v) && v >= this.firstChar && v <= this.lastChar ? v : -1;
  40485. },
  40486. amend: function (map) {
  40487. error('Should not call amend()');
  40488. }
  40489. };
  40490. return IdentityToUnicodeMap;
  40491. }();
  40492. var OpenTypeFileBuilder = function OpenTypeFileBuilderClosure() {
  40493. function writeInt16(dest, offset, num) {
  40494. dest[offset] = num >> 8 & 0xFF;
  40495. dest[offset + 1] = num & 0xFF;
  40496. }
  40497. function writeInt32(dest, offset, num) {
  40498. dest[offset] = num >> 24 & 0xFF;
  40499. dest[offset + 1] = num >> 16 & 0xFF;
  40500. dest[offset + 2] = num >> 8 & 0xFF;
  40501. dest[offset + 3] = num & 0xFF;
  40502. }
  40503. function writeData(dest, offset, data) {
  40504. var i, ii;
  40505. if (data instanceof Uint8Array) {
  40506. dest.set(data, offset);
  40507. } else if (typeof data === 'string') {
  40508. for (i = 0, ii = data.length; i < ii; i++) {
  40509. dest[offset++] = data.charCodeAt(i) & 0xFF;
  40510. }
  40511. } else {
  40512. for (i = 0, ii = data.length; i < ii; i++) {
  40513. dest[offset++] = data[i] & 0xFF;
  40514. }
  40515. }
  40516. }
  40517. function OpenTypeFileBuilder(sfnt) {
  40518. this.sfnt = sfnt;
  40519. this.tables = Object.create(null);
  40520. }
  40521. OpenTypeFileBuilder.getSearchParams = function OpenTypeFileBuilder_getSearchParams(entriesCount, entrySize) {
  40522. var maxPower2 = 1, log2 = 0;
  40523. while ((maxPower2 ^ entriesCount) > maxPower2) {
  40524. maxPower2 <<= 1;
  40525. log2++;
  40526. }
  40527. var searchRange = maxPower2 * entrySize;
  40528. return {
  40529. range: searchRange,
  40530. entry: log2,
  40531. rangeShift: entrySize * entriesCount - searchRange
  40532. };
  40533. };
  40534. var OTF_HEADER_SIZE = 12;
  40535. var OTF_TABLE_ENTRY_SIZE = 16;
  40536. OpenTypeFileBuilder.prototype = {
  40537. toArray: function OpenTypeFileBuilder_toArray() {
  40538. var sfnt = this.sfnt;
  40539. var tables = this.tables;
  40540. var tablesNames = Object.keys(tables);
  40541. tablesNames.sort();
  40542. var numTables = tablesNames.length;
  40543. var i, j, jj, table, tableName;
  40544. var offset = OTF_HEADER_SIZE + numTables * OTF_TABLE_ENTRY_SIZE;
  40545. var tableOffsets = [offset];
  40546. for (i = 0; i < numTables; i++) {
  40547. table = tables[tablesNames[i]];
  40548. var paddedLength = (table.length + 3 & ~3) >>> 0;
  40549. offset += paddedLength;
  40550. tableOffsets.push(offset);
  40551. }
  40552. var file = new Uint8Array(offset);
  40553. for (i = 0; i < numTables; i++) {
  40554. table = tables[tablesNames[i]];
  40555. writeData(file, tableOffsets[i], table);
  40556. }
  40557. if (sfnt === 'true') {
  40558. sfnt = string32(0x00010000);
  40559. }
  40560. file[0] = sfnt.charCodeAt(0) & 0xFF;
  40561. file[1] = sfnt.charCodeAt(1) & 0xFF;
  40562. file[2] = sfnt.charCodeAt(2) & 0xFF;
  40563. file[3] = sfnt.charCodeAt(3) & 0xFF;
  40564. writeInt16(file, 4, numTables);
  40565. var searchParams = OpenTypeFileBuilder.getSearchParams(numTables, 16);
  40566. writeInt16(file, 6, searchParams.range);
  40567. writeInt16(file, 8, searchParams.entry);
  40568. writeInt16(file, 10, searchParams.rangeShift);
  40569. offset = OTF_HEADER_SIZE;
  40570. for (i = 0; i < numTables; i++) {
  40571. tableName = tablesNames[i];
  40572. file[offset] = tableName.charCodeAt(0) & 0xFF;
  40573. file[offset + 1] = tableName.charCodeAt(1) & 0xFF;
  40574. file[offset + 2] = tableName.charCodeAt(2) & 0xFF;
  40575. file[offset + 3] = tableName.charCodeAt(3) & 0xFF;
  40576. var checksum = 0;
  40577. for (j = tableOffsets[i], jj = tableOffsets[i + 1]; j < jj; j += 4) {
  40578. var quad = readUint32(file, j);
  40579. checksum = checksum + quad >>> 0;
  40580. }
  40581. writeInt32(file, offset + 4, checksum);
  40582. writeInt32(file, offset + 8, tableOffsets[i]);
  40583. writeInt32(file, offset + 12, tables[tableName].length);
  40584. offset += OTF_TABLE_ENTRY_SIZE;
  40585. }
  40586. return file;
  40587. },
  40588. addTable: function OpenTypeFileBuilder_addTable(tag, data) {
  40589. if (tag in this.tables) {
  40590. throw new Error('Table ' + tag + ' already exists');
  40591. }
  40592. this.tables[tag] = data;
  40593. }
  40594. };
  40595. return OpenTypeFileBuilder;
  40596. }();
  40597. var ProblematicCharRanges = new Int32Array([
  40598. 0x0000,
  40599. 0x0020,
  40600. 0x007F,
  40601. 0x00A1,
  40602. 0x00AD,
  40603. 0x00AE,
  40604. 0x0600,
  40605. 0x0780,
  40606. 0x08A0,
  40607. 0x10A0,
  40608. 0x1780,
  40609. 0x1800,
  40610. 0x1C00,
  40611. 0x1C50,
  40612. 0x2000,
  40613. 0x2010,
  40614. 0x2011,
  40615. 0x2012,
  40616. 0x2028,
  40617. 0x2030,
  40618. 0x205F,
  40619. 0x2070,
  40620. 0x25CC,
  40621. 0x25CD,
  40622. 0x3000,
  40623. 0x3001,
  40624. 0xAA60,
  40625. 0xAA80,
  40626. 0xFFF0,
  40627. 0x10000
  40628. ]);
  40629. var Font = function FontClosure() {
  40630. function Font(name, file, properties) {
  40631. var charCode, glyphName, unicode;
  40632. this.name = name;
  40633. this.loadedName = properties.loadedName;
  40634. this.isType3Font = properties.isType3Font;
  40635. this.sizes = [];
  40636. this.missingFile = false;
  40637. this.glyphCache = Object.create(null);
  40638. this.isSerifFont = !!(properties.flags & FontFlags.Serif);
  40639. this.isSymbolicFont = !!(properties.flags & FontFlags.Symbolic);
  40640. this.isMonospace = !!(properties.flags & FontFlags.FixedPitch);
  40641. var type = properties.type;
  40642. var subtype = properties.subtype;
  40643. this.type = type;
  40644. this.fallbackName = this.isMonospace ? 'monospace' : this.isSerifFont ? 'serif' : 'sans-serif';
  40645. this.differences = properties.differences;
  40646. this.widths = properties.widths;
  40647. this.defaultWidth = properties.defaultWidth;
  40648. this.composite = properties.composite;
  40649. this.wideChars = properties.wideChars;
  40650. this.cMap = properties.cMap;
  40651. this.ascent = properties.ascent / PDF_GLYPH_SPACE_UNITS;
  40652. this.descent = properties.descent / PDF_GLYPH_SPACE_UNITS;
  40653. this.fontMatrix = properties.fontMatrix;
  40654. this.bbox = properties.bbox;
  40655. this.toUnicode = properties.toUnicode;
  40656. this.toFontChar = [];
  40657. if (properties.type === 'Type3') {
  40658. for (charCode = 0; charCode < 256; charCode++) {
  40659. this.toFontChar[charCode] = this.differences[charCode] || properties.defaultEncoding[charCode];
  40660. }
  40661. this.fontType = FontType.TYPE3;
  40662. return;
  40663. }
  40664. this.cidEncoding = properties.cidEncoding;
  40665. this.vertical = properties.vertical;
  40666. if (this.vertical) {
  40667. this.vmetrics = properties.vmetrics;
  40668. this.defaultVMetrics = properties.defaultVMetrics;
  40669. }
  40670. var glyphsUnicodeMap;
  40671. if (!file || file.isEmpty) {
  40672. if (file) {
  40673. warn('Font file is empty in "' + name + '" (' + this.loadedName + ')');
  40674. }
  40675. this.missingFile = true;
  40676. var fontName = name.replace(/[,_]/g, '-');
  40677. var stdFontMap = getStdFontMap(), nonStdFontMap = getNonStdFontMap();
  40678. var isStandardFont = !!stdFontMap[fontName] || !!(nonStdFontMap[fontName] && stdFontMap[nonStdFontMap[fontName]]);
  40679. fontName = stdFontMap[fontName] || nonStdFontMap[fontName] || fontName;
  40680. this.bold = fontName.search(/bold/gi) !== -1;
  40681. this.italic = fontName.search(/oblique/gi) !== -1 || fontName.search(/italic/gi) !== -1;
  40682. this.black = name.search(/Black/g) !== -1;
  40683. this.remeasure = Object.keys(this.widths).length > 0;
  40684. if (isStandardFont && type === 'CIDFontType2' && properties.cidEncoding.indexOf('Identity-') === 0) {
  40685. var GlyphMapForStandardFonts = getGlyphMapForStandardFonts();
  40686. var map = [];
  40687. for (charCode in GlyphMapForStandardFonts) {
  40688. map[+charCode] = GlyphMapForStandardFonts[charCode];
  40689. }
  40690. if (/Arial-?Black/i.test(name)) {
  40691. var SupplementalGlyphMapForArialBlack = getSupplementalGlyphMapForArialBlack();
  40692. for (charCode in SupplementalGlyphMapForArialBlack) {
  40693. map[+charCode] = SupplementalGlyphMapForArialBlack[charCode];
  40694. }
  40695. }
  40696. var isIdentityUnicode = this.toUnicode instanceof IdentityToUnicodeMap;
  40697. if (!isIdentityUnicode) {
  40698. this.toUnicode.forEach(function (charCode, unicodeCharCode) {
  40699. map[+charCode] = unicodeCharCode;
  40700. });
  40701. }
  40702. this.toFontChar = map;
  40703. this.toUnicode = new ToUnicodeMap(map);
  40704. } else if (/Symbol/i.test(fontName)) {
  40705. this.toFontChar = buildToFontChar(SymbolSetEncoding, getGlyphsUnicode(), properties.differences);
  40706. } else if (/Dingbats/i.test(fontName)) {
  40707. if (/Wingdings/i.test(name)) {
  40708. warn('Non-embedded Wingdings font, falling back to ZapfDingbats.');
  40709. }
  40710. this.toFontChar = buildToFontChar(ZapfDingbatsEncoding, getDingbatsGlyphsUnicode(), properties.differences);
  40711. } else if (isStandardFont) {
  40712. this.toFontChar = buildToFontChar(properties.defaultEncoding, getGlyphsUnicode(), properties.differences);
  40713. } else {
  40714. glyphsUnicodeMap = getGlyphsUnicode();
  40715. this.toUnicode.forEach(function (charCode, unicodeCharCode) {
  40716. if (!this.composite) {
  40717. glyphName = properties.differences[charCode] || properties.defaultEncoding[charCode];
  40718. unicode = getUnicodeForGlyph(glyphName, glyphsUnicodeMap);
  40719. if (unicode !== -1) {
  40720. unicodeCharCode = unicode;
  40721. }
  40722. }
  40723. this.toFontChar[charCode] = unicodeCharCode;
  40724. }.bind(this));
  40725. }
  40726. this.loadedName = fontName.split('-')[0];
  40727. this.loading = false;
  40728. this.fontType = getFontType(type, subtype);
  40729. return;
  40730. }
  40731. if (subtype === 'Type1C') {
  40732. if (type !== 'Type1' && type !== 'MMType1') {
  40733. if (isTrueTypeFile(file)) {
  40734. subtype = 'TrueType';
  40735. } else {
  40736. type = 'Type1';
  40737. }
  40738. } else if (isOpenTypeFile(file)) {
  40739. type = subtype = 'OpenType';
  40740. }
  40741. }
  40742. if (subtype === 'CIDFontType0C' && type !== 'CIDFontType0') {
  40743. type = 'CIDFontType0';
  40744. }
  40745. if (subtype === 'OpenType') {
  40746. type = 'OpenType';
  40747. }
  40748. if (type === 'CIDFontType0') {
  40749. if (isType1File(file)) {
  40750. subtype = 'CIDFontType0';
  40751. } else if (isOpenTypeFile(file)) {
  40752. type = subtype = 'OpenType';
  40753. } else {
  40754. subtype = 'CIDFontType0C';
  40755. }
  40756. }
  40757. var data;
  40758. switch (type) {
  40759. case 'MMType1':
  40760. info('MMType1 font (' + name + '), falling back to Type1.');
  40761. case 'Type1':
  40762. case 'CIDFontType0':
  40763. this.mimetype = 'font/opentype';
  40764. var cff = subtype === 'Type1C' || subtype === 'CIDFontType0C' ? new CFFFont(file, properties) : new Type1Font(name, file, properties);
  40765. adjustWidths(properties);
  40766. data = this.convert(name, cff, properties);
  40767. break;
  40768. case 'OpenType':
  40769. case 'TrueType':
  40770. case 'CIDFontType2':
  40771. this.mimetype = 'font/opentype';
  40772. data = this.checkAndRepair(name, file, properties);
  40773. if (this.isOpenType) {
  40774. adjustWidths(properties);
  40775. type = 'OpenType';
  40776. }
  40777. break;
  40778. default:
  40779. error('Font ' + type + ' is not supported');
  40780. break;
  40781. }
  40782. this.data = data;
  40783. this.fontType = getFontType(type, subtype);
  40784. this.fontMatrix = properties.fontMatrix;
  40785. this.widths = properties.widths;
  40786. this.defaultWidth = properties.defaultWidth;
  40787. this.toUnicode = properties.toUnicode;
  40788. this.encoding = properties.baseEncoding;
  40789. this.seacMap = properties.seacMap;
  40790. this.loading = true;
  40791. }
  40792. Font.getFontID = function () {
  40793. var ID = 1;
  40794. return function Font_getFontID() {
  40795. return String(ID++);
  40796. };
  40797. }();
  40798. function int16(b0, b1) {
  40799. return (b0 << 8) + b1;
  40800. }
  40801. function signedInt16(b0, b1) {
  40802. var value = (b0 << 8) + b1;
  40803. return value & 1 << 15 ? value - 0x10000 : value;
  40804. }
  40805. function int32(b0, b1, b2, b3) {
  40806. return (b0 << 24) + (b1 << 16) + (b2 << 8) + b3;
  40807. }
  40808. function string16(value) {
  40809. return String.fromCharCode(value >> 8 & 0xff, value & 0xff);
  40810. }
  40811. function safeString16(value) {
  40812. value = value > 0x7FFF ? 0x7FFF : value < -0x8000 ? -0x8000 : value;
  40813. return String.fromCharCode(value >> 8 & 0xff, value & 0xff);
  40814. }
  40815. function isTrueTypeFile(file) {
  40816. var header = file.peekBytes(4);
  40817. return readUint32(header, 0) === 0x00010000;
  40818. }
  40819. function isOpenTypeFile(file) {
  40820. var header = file.peekBytes(4);
  40821. return bytesToString(header) === 'OTTO';
  40822. }
  40823. function isType1File(file) {
  40824. var header = file.peekBytes(2);
  40825. if (header[0] === 0x25 && header[1] === 0x21) {
  40826. return true;
  40827. }
  40828. if (header[0] === 0x80 && header[1] === 0x01) {
  40829. return true;
  40830. }
  40831. return false;
  40832. }
  40833. function buildToFontChar(encoding, glyphsUnicodeMap, differences) {
  40834. var toFontChar = [], unicode;
  40835. for (var i = 0, ii = encoding.length; i < ii; i++) {
  40836. unicode = getUnicodeForGlyph(encoding[i], glyphsUnicodeMap);
  40837. if (unicode !== -1) {
  40838. toFontChar[i] = unicode;
  40839. }
  40840. }
  40841. for (var charCode in differences) {
  40842. unicode = getUnicodeForGlyph(differences[charCode], glyphsUnicodeMap);
  40843. if (unicode !== -1) {
  40844. toFontChar[+charCode] = unicode;
  40845. }
  40846. }
  40847. return toFontChar;
  40848. }
  40849. function isProblematicUnicodeLocation(code) {
  40850. var i = 0, j = ProblematicCharRanges.length - 1;
  40851. while (i < j) {
  40852. var c = i + j + 1 >> 1;
  40853. if (code < ProblematicCharRanges[c]) {
  40854. j = c - 1;
  40855. } else {
  40856. i = c;
  40857. }
  40858. }
  40859. return !(i & 1);
  40860. }
  40861. function adjustMapping(charCodeToGlyphId, properties) {
  40862. var toUnicode = properties.toUnicode;
  40863. var isSymbolic = !!(properties.flags & FontFlags.Symbolic);
  40864. var isIdentityUnicode = properties.toUnicode instanceof IdentityToUnicodeMap;
  40865. var newMap = Object.create(null);
  40866. var toFontChar = [];
  40867. var usedFontCharCodes = [];
  40868. var nextAvailableFontCharCode = PRIVATE_USE_OFFSET_START;
  40869. for (var originalCharCode in charCodeToGlyphId) {
  40870. originalCharCode |= 0;
  40871. var glyphId = charCodeToGlyphId[originalCharCode];
  40872. var fontCharCode = originalCharCode;
  40873. var hasUnicodeValue = false;
  40874. if (!isIdentityUnicode && toUnicode.has(originalCharCode)) {
  40875. hasUnicodeValue = true;
  40876. var unicode = toUnicode.get(fontCharCode);
  40877. if (unicode.length === 1) {
  40878. fontCharCode = unicode.charCodeAt(0);
  40879. }
  40880. }
  40881. if ((usedFontCharCodes[fontCharCode] !== undefined || isProblematicUnicodeLocation(fontCharCode) || isSymbolic && !hasUnicodeValue) && nextAvailableFontCharCode <= PRIVATE_USE_OFFSET_END) {
  40882. do {
  40883. fontCharCode = nextAvailableFontCharCode++;
  40884. if (SKIP_PRIVATE_USE_RANGE_F000_TO_F01F && fontCharCode === 0xF000) {
  40885. fontCharCode = 0xF020;
  40886. nextAvailableFontCharCode = fontCharCode + 1;
  40887. }
  40888. } while (usedFontCharCodes[fontCharCode] !== undefined && nextAvailableFontCharCode <= PRIVATE_USE_OFFSET_END);
  40889. }
  40890. newMap[fontCharCode] = glyphId;
  40891. toFontChar[originalCharCode] = fontCharCode;
  40892. usedFontCharCodes[fontCharCode] = true;
  40893. }
  40894. return {
  40895. toFontChar: toFontChar,
  40896. charCodeToGlyphId: newMap,
  40897. nextAvailableFontCharCode: nextAvailableFontCharCode
  40898. };
  40899. }
  40900. function getRanges(glyphs, numGlyphs) {
  40901. var codes = [];
  40902. for (var charCode in glyphs) {
  40903. if (glyphs[charCode] >= numGlyphs) {
  40904. continue;
  40905. }
  40906. codes.push({
  40907. fontCharCode: charCode | 0,
  40908. glyphId: glyphs[charCode]
  40909. });
  40910. }
  40911. codes.sort(function fontGetRangesSort(a, b) {
  40912. return a.fontCharCode - b.fontCharCode;
  40913. });
  40914. var ranges = [];
  40915. var length = codes.length;
  40916. for (var n = 0; n < length;) {
  40917. var start = codes[n].fontCharCode;
  40918. var codeIndices = [codes[n].glyphId];
  40919. ++n;
  40920. var end = start;
  40921. while (n < length && end + 1 === codes[n].fontCharCode) {
  40922. codeIndices.push(codes[n].glyphId);
  40923. ++end;
  40924. ++n;
  40925. if (end === 0xFFFF) {
  40926. break;
  40927. }
  40928. }
  40929. ranges.push([
  40930. start,
  40931. end,
  40932. codeIndices
  40933. ]);
  40934. }
  40935. return ranges;
  40936. }
  40937. function createCmapTable(glyphs, numGlyphs) {
  40938. var ranges = getRanges(glyphs, numGlyphs);
  40939. var numTables = ranges[ranges.length - 1][1] > 0xFFFF ? 2 : 1;
  40940. var cmap = '\x00\x00' + string16(numTables) + '\x00\x03' + '\x00\x01' + string32(4 + numTables * 8);
  40941. var i, ii, j, jj;
  40942. for (i = ranges.length - 1; i >= 0; --i) {
  40943. if (ranges[i][0] <= 0xFFFF) {
  40944. break;
  40945. }
  40946. }
  40947. var bmpLength = i + 1;
  40948. if (ranges[i][0] < 0xFFFF && ranges[i][1] === 0xFFFF) {
  40949. ranges[i][1] = 0xFFFE;
  40950. }
  40951. var trailingRangesCount = ranges[i][1] < 0xFFFF ? 1 : 0;
  40952. var segCount = bmpLength + trailingRangesCount;
  40953. var searchParams = OpenTypeFileBuilder.getSearchParams(segCount, 2);
  40954. var startCount = '';
  40955. var endCount = '';
  40956. var idDeltas = '';
  40957. var idRangeOffsets = '';
  40958. var glyphsIds = '';
  40959. var bias = 0;
  40960. var range, start, end, codes;
  40961. for (i = 0, ii = bmpLength; i < ii; i++) {
  40962. range = ranges[i];
  40963. start = range[0];
  40964. end = range[1];
  40965. startCount += string16(start);
  40966. endCount += string16(end);
  40967. codes = range[2];
  40968. var contiguous = true;
  40969. for (j = 1, jj = codes.length; j < jj; ++j) {
  40970. if (codes[j] !== codes[j - 1] + 1) {
  40971. contiguous = false;
  40972. break;
  40973. }
  40974. }
  40975. if (!contiguous) {
  40976. var offset = (segCount - i) * 2 + bias * 2;
  40977. bias += end - start + 1;
  40978. idDeltas += string16(0);
  40979. idRangeOffsets += string16(offset);
  40980. for (j = 0, jj = codes.length; j < jj; ++j) {
  40981. glyphsIds += string16(codes[j]);
  40982. }
  40983. } else {
  40984. var startCode = codes[0];
  40985. idDeltas += string16(startCode - start & 0xFFFF);
  40986. idRangeOffsets += string16(0);
  40987. }
  40988. }
  40989. if (trailingRangesCount > 0) {
  40990. endCount += '\xFF\xFF';
  40991. startCount += '\xFF\xFF';
  40992. idDeltas += '\x00\x01';
  40993. idRangeOffsets += '\x00\x00';
  40994. }
  40995. var format314 = '\x00\x00' + string16(2 * segCount) + string16(searchParams.range) + string16(searchParams.entry) + string16(searchParams.rangeShift) + endCount + '\x00\x00' + startCount + idDeltas + idRangeOffsets + glyphsIds;
  40996. var format31012 = '';
  40997. var header31012 = '';
  40998. if (numTables > 1) {
  40999. cmap += '\x00\x03' + '\x00\x0A' + string32(4 + numTables * 8 + 4 + format314.length);
  41000. format31012 = '';
  41001. for (i = 0, ii = ranges.length; i < ii; i++) {
  41002. range = ranges[i];
  41003. start = range[0];
  41004. codes = range[2];
  41005. var code = codes[0];
  41006. for (j = 1, jj = codes.length; j < jj; ++j) {
  41007. if (codes[j] !== codes[j - 1] + 1) {
  41008. end = range[0] + j - 1;
  41009. format31012 += string32(start) + string32(end) + string32(code);
  41010. start = end + 1;
  41011. code = codes[j];
  41012. }
  41013. }
  41014. format31012 += string32(start) + string32(range[1]) + string32(code);
  41015. }
  41016. header31012 = '\x00\x0C' + '\x00\x00' + string32(format31012.length + 16) + '\x00\x00\x00\x00' + string32(format31012.length / 12);
  41017. }
  41018. return cmap + '\x00\x04' + string16(format314.length + 4) + format314 + header31012 + format31012;
  41019. }
  41020. function validateOS2Table(os2) {
  41021. var stream = new Stream(os2.data);
  41022. var version = stream.getUint16();
  41023. stream.getBytes(60);
  41024. var selection = stream.getUint16();
  41025. if (version < 4 && selection & 0x0300) {
  41026. return false;
  41027. }
  41028. var firstChar = stream.getUint16();
  41029. var lastChar = stream.getUint16();
  41030. if (firstChar > lastChar) {
  41031. return false;
  41032. }
  41033. stream.getBytes(6);
  41034. var usWinAscent = stream.getUint16();
  41035. if (usWinAscent === 0) {
  41036. return false;
  41037. }
  41038. os2.data[8] = os2.data[9] = 0;
  41039. return true;
  41040. }
  41041. function createOS2Table(properties, charstrings, override) {
  41042. override = override || {
  41043. unitsPerEm: 0,
  41044. yMax: 0,
  41045. yMin: 0,
  41046. ascent: 0,
  41047. descent: 0
  41048. };
  41049. var ulUnicodeRange1 = 0;
  41050. var ulUnicodeRange2 = 0;
  41051. var ulUnicodeRange3 = 0;
  41052. var ulUnicodeRange4 = 0;
  41053. var firstCharIndex = null;
  41054. var lastCharIndex = 0;
  41055. if (charstrings) {
  41056. for (var code in charstrings) {
  41057. code |= 0;
  41058. if (firstCharIndex > code || !firstCharIndex) {
  41059. firstCharIndex = code;
  41060. }
  41061. if (lastCharIndex < code) {
  41062. lastCharIndex = code;
  41063. }
  41064. var position = getUnicodeRangeFor(code);
  41065. if (position < 32) {
  41066. ulUnicodeRange1 |= 1 << position;
  41067. } else if (position < 64) {
  41068. ulUnicodeRange2 |= 1 << position - 32;
  41069. } else if (position < 96) {
  41070. ulUnicodeRange3 |= 1 << position - 64;
  41071. } else if (position < 123) {
  41072. ulUnicodeRange4 |= 1 << position - 96;
  41073. } else {
  41074. error('Unicode ranges Bits > 123 are reserved for internal usage');
  41075. }
  41076. }
  41077. } else {
  41078. firstCharIndex = 0;
  41079. lastCharIndex = 255;
  41080. }
  41081. var bbox = properties.bbox || [
  41082. 0,
  41083. 0,
  41084. 0,
  41085. 0
  41086. ];
  41087. var unitsPerEm = override.unitsPerEm || 1 / (properties.fontMatrix || FONT_IDENTITY_MATRIX)[0];
  41088. var scale = properties.ascentScaled ? 1.0 : unitsPerEm / PDF_GLYPH_SPACE_UNITS;
  41089. var typoAscent = override.ascent || Math.round(scale * (properties.ascent || bbox[3]));
  41090. var typoDescent = override.descent || Math.round(scale * (properties.descent || bbox[1]));
  41091. if (typoDescent > 0 && properties.descent > 0 && bbox[1] < 0) {
  41092. typoDescent = -typoDescent;
  41093. }
  41094. var winAscent = override.yMax || typoAscent;
  41095. var winDescent = -override.yMin || -typoDescent;
  41096. 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' + string32(ulUnicodeRange1) + string32(ulUnicodeRange2) + string32(ulUnicodeRange3) + 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';
  41097. }
  41098. function createPostTable(properties) {
  41099. var angle = Math.floor(properties.italicAngle * Math.pow(2, 16));
  41100. return '\x00\x03\x00\x00' + string32(angle) + '\x00\x00' + '\x00\x00' + string32(properties.fixedPitch) + '\x00\x00\x00\x00' + '\x00\x00\x00\x00' + '\x00\x00\x00\x00' + '\x00\x00\x00\x00';
  41101. }
  41102. function createNameTable(name, proto) {
  41103. if (!proto) {
  41104. proto = [
  41105. [],
  41106. []
  41107. ];
  41108. }
  41109. var strings = [
  41110. proto[0][0] || 'Original licence',
  41111. proto[0][1] || name,
  41112. proto[0][2] || 'Unknown',
  41113. proto[0][3] || 'uniqueID',
  41114. proto[0][4] || name,
  41115. proto[0][5] || 'Version 0.11',
  41116. proto[0][6] || '',
  41117. proto[0][7] || 'Unknown',
  41118. proto[0][8] || 'Unknown',
  41119. proto[0][9] || 'Unknown'
  41120. ];
  41121. var stringsUnicode = [];
  41122. var i, ii, j, jj, str;
  41123. for (i = 0, ii = strings.length; i < ii; i++) {
  41124. str = proto[1][i] || strings[i];
  41125. var strBufUnicode = [];
  41126. for (j = 0, jj = str.length; j < jj; j++) {
  41127. strBufUnicode.push(string16(str.charCodeAt(j)));
  41128. }
  41129. stringsUnicode.push(strBufUnicode.join(''));
  41130. }
  41131. var names = [
  41132. strings,
  41133. stringsUnicode
  41134. ];
  41135. var platforms = [
  41136. '\x00\x01',
  41137. '\x00\x03'
  41138. ];
  41139. var encodings = [
  41140. '\x00\x00',
  41141. '\x00\x01'
  41142. ];
  41143. var languages = [
  41144. '\x00\x00',
  41145. '\x04\x09'
  41146. ];
  41147. var namesRecordCount = strings.length * platforms.length;
  41148. var nameTable = '\x00\x00' + string16(namesRecordCount) + string16(namesRecordCount * 12 + 6);
  41149. var strOffset = 0;
  41150. for (i = 0, ii = platforms.length; i < ii; i++) {
  41151. var strs = names[i];
  41152. for (j = 0, jj = strs.length; j < jj; j++) {
  41153. str = strs[j];
  41154. var nameRecord = platforms[i] + encodings[i] + languages[i] + string16(j) + string16(str.length) + string16(strOffset);
  41155. nameTable += nameRecord;
  41156. strOffset += str.length;
  41157. }
  41158. }
  41159. nameTable += strings.join('') + stringsUnicode.join('');
  41160. return nameTable;
  41161. }
  41162. Font.prototype = {
  41163. name: null,
  41164. font: null,
  41165. mimetype: null,
  41166. encoding: null,
  41167. get renderer() {
  41168. var renderer = FontRendererFactory.create(this, SEAC_ANALYSIS_ENABLED);
  41169. return shadow(this, 'renderer', renderer);
  41170. },
  41171. exportData: function Font_exportData() {
  41172. var data = {};
  41173. for (var i in this) {
  41174. if (this.hasOwnProperty(i)) {
  41175. data[i] = this[i];
  41176. }
  41177. }
  41178. return data;
  41179. },
  41180. checkAndRepair: function Font_checkAndRepair(name, font, properties) {
  41181. function readTableEntry(file) {
  41182. var tag = bytesToString(file.getBytes(4));
  41183. var checksum = file.getInt32() >>> 0;
  41184. var offset = file.getInt32() >>> 0;
  41185. var length = file.getInt32() >>> 0;
  41186. var previousPosition = file.pos;
  41187. file.pos = file.start ? file.start : 0;
  41188. file.skip(offset);
  41189. var data = file.getBytes(length);
  41190. file.pos = previousPosition;
  41191. if (tag === 'head') {
  41192. data[8] = data[9] = data[10] = data[11] = 0;
  41193. data[17] |= 0x20;
  41194. }
  41195. return {
  41196. tag: tag,
  41197. checksum: checksum,
  41198. length: length,
  41199. offset: offset,
  41200. data: data
  41201. };
  41202. }
  41203. function readOpenTypeHeader(ttf) {
  41204. return {
  41205. version: bytesToString(ttf.getBytes(4)),
  41206. numTables: ttf.getUint16(),
  41207. searchRange: ttf.getUint16(),
  41208. entrySelector: ttf.getUint16(),
  41209. rangeShift: ttf.getUint16()
  41210. };
  41211. }
  41212. function readCmapTable(cmap, font, isSymbolicFont, hasEncoding) {
  41213. if (!cmap) {
  41214. warn('No cmap table available.');
  41215. return {
  41216. platformId: -1,
  41217. encodingId: -1,
  41218. mappings: [],
  41219. hasShortCmap: false
  41220. };
  41221. }
  41222. var segment;
  41223. var start = (font.start ? font.start : 0) + cmap.offset;
  41224. font.pos = start;
  41225. font.getUint16();
  41226. var numTables = font.getUint16();
  41227. var potentialTable;
  41228. var canBreak = false;
  41229. for (var i = 0; i < numTables; i++) {
  41230. var platformId = font.getUint16();
  41231. var encodingId = font.getUint16();
  41232. var offset = font.getInt32() >>> 0;
  41233. var useTable = false;
  41234. if (platformId === 0 && encodingId === 0) {
  41235. useTable = true;
  41236. } else if (platformId === 1 && encodingId === 0) {
  41237. useTable = true;
  41238. } else if (platformId === 3 && encodingId === 1 && (hasEncoding || !potentialTable)) {
  41239. useTable = true;
  41240. if (!isSymbolicFont) {
  41241. canBreak = true;
  41242. }
  41243. } else if (isSymbolicFont && platformId === 3 && encodingId === 0) {
  41244. useTable = true;
  41245. canBreak = true;
  41246. }
  41247. if (useTable) {
  41248. potentialTable = {
  41249. platformId: platformId,
  41250. encodingId: encodingId,
  41251. offset: offset
  41252. };
  41253. }
  41254. if (canBreak) {
  41255. break;
  41256. }
  41257. }
  41258. if (potentialTable) {
  41259. font.pos = start + potentialTable.offset;
  41260. }
  41261. if (!potentialTable || font.peekByte() === -1) {
  41262. warn('Could not find a preferred cmap table.');
  41263. return {
  41264. platformId: -1,
  41265. encodingId: -1,
  41266. mappings: [],
  41267. hasShortCmap: false
  41268. };
  41269. }
  41270. var format = font.getUint16();
  41271. font.getUint16();
  41272. font.getUint16();
  41273. var hasShortCmap = false;
  41274. var mappings = [];
  41275. var j, glyphId;
  41276. if (format === 0) {
  41277. for (j = 0; j < 256; j++) {
  41278. var index = font.getByte();
  41279. if (!index) {
  41280. continue;
  41281. }
  41282. mappings.push({
  41283. charCode: j,
  41284. glyphId: index
  41285. });
  41286. }
  41287. hasShortCmap = true;
  41288. } else if (format === 4) {
  41289. var segCount = font.getUint16() >> 1;
  41290. font.getBytes(6);
  41291. var segIndex, segments = [];
  41292. for (segIndex = 0; segIndex < segCount; segIndex++) {
  41293. segments.push({ end: font.getUint16() });
  41294. }
  41295. font.getUint16();
  41296. for (segIndex = 0; segIndex < segCount; segIndex++) {
  41297. segments[segIndex].start = font.getUint16();
  41298. }
  41299. for (segIndex = 0; segIndex < segCount; segIndex++) {
  41300. segments[segIndex].delta = font.getUint16();
  41301. }
  41302. var offsetsCount = 0;
  41303. for (segIndex = 0; segIndex < segCount; segIndex++) {
  41304. segment = segments[segIndex];
  41305. var rangeOffset = font.getUint16();
  41306. if (!rangeOffset) {
  41307. segment.offsetIndex = -1;
  41308. continue;
  41309. }
  41310. var offsetIndex = (rangeOffset >> 1) - (segCount - segIndex);
  41311. segment.offsetIndex = offsetIndex;
  41312. offsetsCount = Math.max(offsetsCount, offsetIndex + segment.end - segment.start + 1);
  41313. }
  41314. var offsets = [];
  41315. for (j = 0; j < offsetsCount; j++) {
  41316. offsets.push(font.getUint16());
  41317. }
  41318. for (segIndex = 0; segIndex < segCount; segIndex++) {
  41319. segment = segments[segIndex];
  41320. start = segment.start;
  41321. var end = segment.end;
  41322. var delta = segment.delta;
  41323. offsetIndex = segment.offsetIndex;
  41324. for (j = start; j <= end; j++) {
  41325. if (j === 0xFFFF) {
  41326. continue;
  41327. }
  41328. glyphId = offsetIndex < 0 ? j : offsets[offsetIndex + j - start];
  41329. glyphId = glyphId + delta & 0xFFFF;
  41330. if (glyphId === 0) {
  41331. continue;
  41332. }
  41333. mappings.push({
  41334. charCode: j,
  41335. glyphId: glyphId
  41336. });
  41337. }
  41338. }
  41339. } else if (format === 6) {
  41340. var firstCode = font.getUint16();
  41341. var entryCount = font.getUint16();
  41342. for (j = 0; j < entryCount; j++) {
  41343. glyphId = font.getUint16();
  41344. var charCode = firstCode + j;
  41345. mappings.push({
  41346. charCode: charCode,
  41347. glyphId: glyphId
  41348. });
  41349. }
  41350. } else {
  41351. warn('cmap table has unsupported format: ' + format);
  41352. return {
  41353. platformId: -1,
  41354. encodingId: -1,
  41355. mappings: [],
  41356. hasShortCmap: false
  41357. };
  41358. }
  41359. mappings.sort(function (a, b) {
  41360. return a.charCode - b.charCode;
  41361. });
  41362. for (i = 1; i < mappings.length; i++) {
  41363. if (mappings[i - 1].charCode === mappings[i].charCode) {
  41364. mappings.splice(i, 1);
  41365. i--;
  41366. }
  41367. }
  41368. return {
  41369. platformId: potentialTable.platformId,
  41370. encodingId: potentialTable.encodingId,
  41371. mappings: mappings,
  41372. hasShortCmap: hasShortCmap
  41373. };
  41374. }
  41375. function sanitizeMetrics(font, header, metrics, numGlyphs) {
  41376. if (!header) {
  41377. if (metrics) {
  41378. metrics.data = null;
  41379. }
  41380. return;
  41381. }
  41382. font.pos = (font.start ? font.start : 0) + header.offset;
  41383. font.pos += header.length - 2;
  41384. var numOfMetrics = font.getUint16();
  41385. if (numOfMetrics > numGlyphs) {
  41386. info('The numOfMetrics (' + numOfMetrics + ') should not be ' + 'greater than the numGlyphs (' + numGlyphs + ')');
  41387. numOfMetrics = numGlyphs;
  41388. header.data[34] = (numOfMetrics & 0xff00) >> 8;
  41389. header.data[35] = numOfMetrics & 0x00ff;
  41390. }
  41391. var numOfSidebearings = numGlyphs - numOfMetrics;
  41392. var numMissing = numOfSidebearings - (metrics.length - numOfMetrics * 4 >> 1);
  41393. if (numMissing > 0) {
  41394. var entries = new Uint8Array(metrics.length + numMissing * 2);
  41395. entries.set(metrics.data);
  41396. metrics.data = entries;
  41397. }
  41398. }
  41399. function sanitizeGlyph(source, sourceStart, sourceEnd, dest, destStart, hintsValid) {
  41400. if (sourceEnd - sourceStart <= 12) {
  41401. return 0;
  41402. }
  41403. var glyf = source.subarray(sourceStart, sourceEnd);
  41404. var contoursCount = glyf[0] << 8 | glyf[1];
  41405. if (contoursCount & 0x8000) {
  41406. dest.set(glyf, destStart);
  41407. return glyf.length;
  41408. }
  41409. var i, j = 10, flagsCount = 0;
  41410. for (i = 0; i < contoursCount; i++) {
  41411. var endPoint = glyf[j] << 8 | glyf[j + 1];
  41412. flagsCount = endPoint + 1;
  41413. j += 2;
  41414. }
  41415. var instructionsStart = j;
  41416. var instructionsLength = glyf[j] << 8 | glyf[j + 1];
  41417. j += 2 + instructionsLength;
  41418. var instructionsEnd = j;
  41419. var coordinatesLength = 0;
  41420. for (i = 0; i < flagsCount; i++) {
  41421. var flag = glyf[j++];
  41422. if (flag & 0xC0) {
  41423. glyf[j - 1] = flag & 0x3F;
  41424. }
  41425. var xyLength = (flag & 2 ? 1 : flag & 16 ? 0 : 2) + (flag & 4 ? 1 : flag & 32 ? 0 : 2);
  41426. coordinatesLength += xyLength;
  41427. if (flag & 8) {
  41428. var repeat = glyf[j++];
  41429. i += repeat;
  41430. coordinatesLength += repeat * xyLength;
  41431. }
  41432. }
  41433. if (coordinatesLength === 0) {
  41434. return 0;
  41435. }
  41436. var glyphDataLength = j + coordinatesLength;
  41437. if (glyphDataLength > glyf.length) {
  41438. return 0;
  41439. }
  41440. if (!hintsValid && instructionsLength > 0) {
  41441. dest.set(glyf.subarray(0, instructionsStart), destStart);
  41442. dest.set([
  41443. 0,
  41444. 0
  41445. ], destStart + instructionsStart);
  41446. dest.set(glyf.subarray(instructionsEnd, glyphDataLength), destStart + instructionsStart + 2);
  41447. glyphDataLength -= instructionsLength;
  41448. if (glyf.length - glyphDataLength > 3) {
  41449. glyphDataLength = glyphDataLength + 3 & ~3;
  41450. }
  41451. return glyphDataLength;
  41452. }
  41453. if (glyf.length - glyphDataLength > 3) {
  41454. glyphDataLength = glyphDataLength + 3 & ~3;
  41455. dest.set(glyf.subarray(0, glyphDataLength), destStart);
  41456. return glyphDataLength;
  41457. }
  41458. dest.set(glyf, destStart);
  41459. return glyf.length;
  41460. }
  41461. function sanitizeHead(head, numGlyphs, locaLength) {
  41462. var data = head.data;
  41463. var version = int32(data[0], data[1], data[2], data[3]);
  41464. if (version >> 16 !== 1) {
  41465. info('Attempting to fix invalid version in head table: ' + version);
  41466. data[0] = 0;
  41467. data[1] = 1;
  41468. data[2] = 0;
  41469. data[3] = 0;
  41470. }
  41471. var indexToLocFormat = int16(data[50], data[51]);
  41472. if (indexToLocFormat < 0 || indexToLocFormat > 1) {
  41473. info('Attempting to fix invalid indexToLocFormat in head table: ' + indexToLocFormat);
  41474. var numGlyphsPlusOne = numGlyphs + 1;
  41475. if (locaLength === numGlyphsPlusOne << 1) {
  41476. data[50] = 0;
  41477. data[51] = 0;
  41478. } else if (locaLength === numGlyphsPlusOne << 2) {
  41479. data[50] = 0;
  41480. data[51] = 1;
  41481. } else {
  41482. warn('Could not fix indexToLocFormat: ' + indexToLocFormat);
  41483. }
  41484. }
  41485. }
  41486. function sanitizeGlyphLocations(loca, glyf, numGlyphs, isGlyphLocationsLong, hintsValid, dupFirstEntry) {
  41487. var itemSize, itemDecode, itemEncode;
  41488. if (isGlyphLocationsLong) {
  41489. itemSize = 4;
  41490. itemDecode = function fontItemDecodeLong(data, offset) {
  41491. return data[offset] << 24 | data[offset + 1] << 16 | data[offset + 2] << 8 | data[offset + 3];
  41492. };
  41493. itemEncode = function fontItemEncodeLong(data, offset, value) {
  41494. data[offset] = value >>> 24 & 0xFF;
  41495. data[offset + 1] = value >> 16 & 0xFF;
  41496. data[offset + 2] = value >> 8 & 0xFF;
  41497. data[offset + 3] = value & 0xFF;
  41498. };
  41499. } else {
  41500. itemSize = 2;
  41501. itemDecode = function fontItemDecode(data, offset) {
  41502. return data[offset] << 9 | data[offset + 1] << 1;
  41503. };
  41504. itemEncode = function fontItemEncode(data, offset, value) {
  41505. data[offset] = value >> 9 & 0xFF;
  41506. data[offset + 1] = value >> 1 & 0xFF;
  41507. };
  41508. }
  41509. var locaData = loca.data;
  41510. var locaDataSize = itemSize * (1 + numGlyphs);
  41511. if (locaData.length !== locaDataSize) {
  41512. locaData = new Uint8Array(locaDataSize);
  41513. locaData.set(loca.data.subarray(0, locaDataSize));
  41514. loca.data = locaData;
  41515. }
  41516. var oldGlyfData = glyf.data;
  41517. var oldGlyfDataLength = oldGlyfData.length;
  41518. var newGlyfData = new Uint8Array(oldGlyfDataLength);
  41519. var startOffset = itemDecode(locaData, 0);
  41520. var writeOffset = 0;
  41521. var missingGlyphData = Object.create(null);
  41522. itemEncode(locaData, 0, writeOffset);
  41523. var i, j;
  41524. for (i = 0, j = itemSize; i < numGlyphs; i++, j += itemSize) {
  41525. var endOffset = itemDecode(locaData, j);
  41526. if (endOffset > oldGlyfDataLength && (oldGlyfDataLength + 3 & ~3) === endOffset) {
  41527. endOffset = oldGlyfDataLength;
  41528. }
  41529. if (endOffset > oldGlyfDataLength) {
  41530. itemEncode(locaData, j, writeOffset);
  41531. startOffset = endOffset;
  41532. continue;
  41533. }
  41534. if (startOffset === endOffset) {
  41535. missingGlyphData[i] = true;
  41536. }
  41537. var newLength = sanitizeGlyph(oldGlyfData, startOffset, endOffset, newGlyfData, writeOffset, hintsValid);
  41538. writeOffset += newLength;
  41539. itemEncode(locaData, j, writeOffset);
  41540. startOffset = endOffset;
  41541. }
  41542. if (writeOffset === 0) {
  41543. var simpleGlyph = new Uint8Array([
  41544. 0,
  41545. 1,
  41546. 0,
  41547. 0,
  41548. 0,
  41549. 0,
  41550. 0,
  41551. 0,
  41552. 0,
  41553. 0,
  41554. 0,
  41555. 0,
  41556. 0,
  41557. 0,
  41558. 49,
  41559. 0
  41560. ]);
  41561. for (i = 0, j = itemSize; i < numGlyphs; i++, j += itemSize) {
  41562. itemEncode(locaData, j, simpleGlyph.length);
  41563. }
  41564. glyf.data = simpleGlyph;
  41565. return missingGlyphData;
  41566. }
  41567. if (dupFirstEntry) {
  41568. var firstEntryLength = itemDecode(locaData, itemSize);
  41569. if (newGlyfData.length > firstEntryLength + writeOffset) {
  41570. glyf.data = newGlyfData.subarray(0, firstEntryLength + writeOffset);
  41571. } else {
  41572. glyf.data = new Uint8Array(firstEntryLength + writeOffset);
  41573. glyf.data.set(newGlyfData.subarray(0, writeOffset));
  41574. }
  41575. glyf.data.set(newGlyfData.subarray(0, firstEntryLength), writeOffset);
  41576. itemEncode(loca.data, locaData.length - itemSize, writeOffset + firstEntryLength);
  41577. } else {
  41578. glyf.data = newGlyfData.subarray(0, writeOffset);
  41579. }
  41580. return missingGlyphData;
  41581. }
  41582. function readPostScriptTable(post, properties, maxpNumGlyphs) {
  41583. var start = (font.start ? font.start : 0) + post.offset;
  41584. font.pos = start;
  41585. var length = post.length, end = start + length;
  41586. var version = font.getInt32();
  41587. font.getBytes(28);
  41588. var glyphNames;
  41589. var valid = true;
  41590. var i;
  41591. switch (version) {
  41592. case 0x00010000:
  41593. glyphNames = MacStandardGlyphOrdering;
  41594. break;
  41595. case 0x00020000:
  41596. var numGlyphs = font.getUint16();
  41597. if (numGlyphs !== maxpNumGlyphs) {
  41598. valid = false;
  41599. break;
  41600. }
  41601. var glyphNameIndexes = [];
  41602. for (i = 0; i < numGlyphs; ++i) {
  41603. var index = font.getUint16();
  41604. if (index >= 32768) {
  41605. valid = false;
  41606. break;
  41607. }
  41608. glyphNameIndexes.push(index);
  41609. }
  41610. if (!valid) {
  41611. break;
  41612. }
  41613. var customNames = [];
  41614. var strBuf = [];
  41615. while (font.pos < end) {
  41616. var stringLength = font.getByte();
  41617. strBuf.length = stringLength;
  41618. for (i = 0; i < stringLength; ++i) {
  41619. strBuf[i] = String.fromCharCode(font.getByte());
  41620. }
  41621. customNames.push(strBuf.join(''));
  41622. }
  41623. glyphNames = [];
  41624. for (i = 0; i < numGlyphs; ++i) {
  41625. var j = glyphNameIndexes[i];
  41626. if (j < 258) {
  41627. glyphNames.push(MacStandardGlyphOrdering[j]);
  41628. continue;
  41629. }
  41630. glyphNames.push(customNames[j - 258]);
  41631. }
  41632. break;
  41633. case 0x00030000:
  41634. break;
  41635. default:
  41636. warn('Unknown/unsupported post table version ' + version);
  41637. valid = false;
  41638. if (properties.defaultEncoding) {
  41639. glyphNames = properties.defaultEncoding;
  41640. }
  41641. break;
  41642. }
  41643. properties.glyphNames = glyphNames;
  41644. return valid;
  41645. }
  41646. function readNameTable(nameTable) {
  41647. var start = (font.start ? font.start : 0) + nameTable.offset;
  41648. font.pos = start;
  41649. var names = [
  41650. [],
  41651. []
  41652. ];
  41653. var length = nameTable.length, end = start + length;
  41654. var format = font.getUint16();
  41655. var FORMAT_0_HEADER_LENGTH = 6;
  41656. if (format !== 0 || length < FORMAT_0_HEADER_LENGTH) {
  41657. return names;
  41658. }
  41659. var numRecords = font.getUint16();
  41660. var stringsStart = font.getUint16();
  41661. var records = [];
  41662. var NAME_RECORD_LENGTH = 12;
  41663. var i, ii;
  41664. for (i = 0; i < numRecords && font.pos + NAME_RECORD_LENGTH <= end; i++) {
  41665. var r = {
  41666. platform: font.getUint16(),
  41667. encoding: font.getUint16(),
  41668. language: font.getUint16(),
  41669. name: font.getUint16(),
  41670. length: font.getUint16(),
  41671. offset: font.getUint16()
  41672. };
  41673. if (r.platform === 1 && r.encoding === 0 && r.language === 0 || r.platform === 3 && r.encoding === 1 && r.language === 0x409) {
  41674. records.push(r);
  41675. }
  41676. }
  41677. for (i = 0, ii = records.length; i < ii; i++) {
  41678. var record = records[i];
  41679. if (record.length <= 0) {
  41680. continue;
  41681. }
  41682. var pos = start + stringsStart + record.offset;
  41683. if (pos + record.length > end) {
  41684. continue;
  41685. }
  41686. font.pos = pos;
  41687. var nameIndex = record.name;
  41688. if (record.encoding) {
  41689. var str = '';
  41690. for (var j = 0, jj = record.length; j < jj; j += 2) {
  41691. str += String.fromCharCode(font.getUint16());
  41692. }
  41693. names[1][nameIndex] = str;
  41694. } else {
  41695. names[0][nameIndex] = bytesToString(font.getBytes(record.length));
  41696. }
  41697. }
  41698. return names;
  41699. }
  41700. var TTOpsStackDeltas = [
  41701. 0,
  41702. 0,
  41703. 0,
  41704. 0,
  41705. 0,
  41706. 0,
  41707. 0,
  41708. 0,
  41709. -2,
  41710. -2,
  41711. -2,
  41712. -2,
  41713. 0,
  41714. 0,
  41715. -2,
  41716. -5,
  41717. -1,
  41718. -1,
  41719. -1,
  41720. -1,
  41721. -1,
  41722. -1,
  41723. -1,
  41724. -1,
  41725. 0,
  41726. 0,
  41727. -1,
  41728. 0,
  41729. -1,
  41730. -1,
  41731. -1,
  41732. -1,
  41733. 1,
  41734. -1,
  41735. -999,
  41736. 0,
  41737. 1,
  41738. 0,
  41739. -1,
  41740. -2,
  41741. 0,
  41742. -1,
  41743. -2,
  41744. -1,
  41745. -1,
  41746. 0,
  41747. -1,
  41748. -1,
  41749. 0,
  41750. 0,
  41751. -999,
  41752. -999,
  41753. -1,
  41754. -1,
  41755. -1,
  41756. -1,
  41757. -2,
  41758. -999,
  41759. -2,
  41760. -2,
  41761. -999,
  41762. 0,
  41763. -2,
  41764. -2,
  41765. 0,
  41766. 0,
  41767. -2,
  41768. 0,
  41769. -2,
  41770. 0,
  41771. 0,
  41772. 0,
  41773. -2,
  41774. -1,
  41775. -1,
  41776. 1,
  41777. 1,
  41778. 0,
  41779. 0,
  41780. -1,
  41781. -1,
  41782. -1,
  41783. -1,
  41784. -1,
  41785. -1,
  41786. -1,
  41787. 0,
  41788. 0,
  41789. -1,
  41790. 0,
  41791. -1,
  41792. -1,
  41793. 0,
  41794. -999,
  41795. -1,
  41796. -1,
  41797. -1,
  41798. -1,
  41799. -1,
  41800. -1,
  41801. 0,
  41802. 0,
  41803. 0,
  41804. 0,
  41805. 0,
  41806. 0,
  41807. 0,
  41808. 0,
  41809. 0,
  41810. 0,
  41811. 0,
  41812. 0,
  41813. -2,
  41814. -999,
  41815. -999,
  41816. -999,
  41817. -999,
  41818. -999,
  41819. -1,
  41820. -1,
  41821. -2,
  41822. -2,
  41823. 0,
  41824. 0,
  41825. 0,
  41826. 0,
  41827. -1,
  41828. -1,
  41829. -999,
  41830. -2,
  41831. -2,
  41832. 0,
  41833. 0,
  41834. -1,
  41835. -2,
  41836. -2,
  41837. 0,
  41838. 0,
  41839. 0,
  41840. -1,
  41841. -1,
  41842. -1,
  41843. -2
  41844. ];
  41845. function sanitizeTTProgram(table, ttContext) {
  41846. var data = table.data;
  41847. var i = 0, j, n, b, funcId, pc, lastEndf = 0, lastDeff = 0;
  41848. var stack = [];
  41849. var callstack = [];
  41850. var functionsCalled = [];
  41851. var tooComplexToFollowFunctions = ttContext.tooComplexToFollowFunctions;
  41852. var inFDEF = false, ifLevel = 0, inELSE = 0;
  41853. for (var ii = data.length; i < ii;) {
  41854. var op = data[i++];
  41855. if (op === 0x40) {
  41856. n = data[i++];
  41857. if (inFDEF || inELSE) {
  41858. i += n;
  41859. } else {
  41860. for (j = 0; j < n; j++) {
  41861. stack.push(data[i++]);
  41862. }
  41863. }
  41864. } else if (op === 0x41) {
  41865. n = data[i++];
  41866. if (inFDEF || inELSE) {
  41867. i += n * 2;
  41868. } else {
  41869. for (j = 0; j < n; j++) {
  41870. b = data[i++];
  41871. stack.push(b << 8 | data[i++]);
  41872. }
  41873. }
  41874. } else if ((op & 0xF8) === 0xB0) {
  41875. n = op - 0xB0 + 1;
  41876. if (inFDEF || inELSE) {
  41877. i += n;
  41878. } else {
  41879. for (j = 0; j < n; j++) {
  41880. stack.push(data[i++]);
  41881. }
  41882. }
  41883. } else if ((op & 0xF8) === 0xB8) {
  41884. n = op - 0xB8 + 1;
  41885. if (inFDEF || inELSE) {
  41886. i += n * 2;
  41887. } else {
  41888. for (j = 0; j < n; j++) {
  41889. b = data[i++];
  41890. stack.push(b << 8 | data[i++]);
  41891. }
  41892. }
  41893. } else if (op === 0x2B && !tooComplexToFollowFunctions) {
  41894. if (!inFDEF && !inELSE) {
  41895. funcId = stack[stack.length - 1];
  41896. ttContext.functionsUsed[funcId] = true;
  41897. if (funcId in ttContext.functionsStackDeltas) {
  41898. stack.length += ttContext.functionsStackDeltas[funcId];
  41899. } else if (funcId in ttContext.functionsDefined && functionsCalled.indexOf(funcId) < 0) {
  41900. callstack.push({
  41901. data: data,
  41902. i: i,
  41903. stackTop: stack.length - 1
  41904. });
  41905. functionsCalled.push(funcId);
  41906. pc = ttContext.functionsDefined[funcId];
  41907. if (!pc) {
  41908. warn('TT: CALL non-existent function');
  41909. ttContext.hintsValid = false;
  41910. return;
  41911. }
  41912. data = pc.data;
  41913. i = pc.i;
  41914. }
  41915. }
  41916. } else if (op === 0x2C && !tooComplexToFollowFunctions) {
  41917. if (inFDEF || inELSE) {
  41918. warn('TT: nested FDEFs not allowed');
  41919. tooComplexToFollowFunctions = true;
  41920. }
  41921. inFDEF = true;
  41922. lastDeff = i;
  41923. funcId = stack.pop();
  41924. ttContext.functionsDefined[funcId] = {
  41925. data: data,
  41926. i: i
  41927. };
  41928. } else if (op === 0x2D) {
  41929. if (inFDEF) {
  41930. inFDEF = false;
  41931. lastEndf = i;
  41932. } else {
  41933. pc = callstack.pop();
  41934. if (!pc) {
  41935. warn('TT: ENDF bad stack');
  41936. ttContext.hintsValid = false;
  41937. return;
  41938. }
  41939. funcId = functionsCalled.pop();
  41940. data = pc.data;
  41941. i = pc.i;
  41942. ttContext.functionsStackDeltas[funcId] = stack.length - pc.stackTop;
  41943. }
  41944. } else if (op === 0x89) {
  41945. if (inFDEF || inELSE) {
  41946. warn('TT: nested IDEFs not allowed');
  41947. tooComplexToFollowFunctions = true;
  41948. }
  41949. inFDEF = true;
  41950. lastDeff = i;
  41951. } else if (op === 0x58) {
  41952. ++ifLevel;
  41953. } else if (op === 0x1B) {
  41954. inELSE = ifLevel;
  41955. } else if (op === 0x59) {
  41956. if (inELSE === ifLevel) {
  41957. inELSE = 0;
  41958. }
  41959. --ifLevel;
  41960. } else if (op === 0x1C) {
  41961. if (!inFDEF && !inELSE) {
  41962. var offset = stack[stack.length - 1];
  41963. if (offset > 0) {
  41964. i += offset - 1;
  41965. }
  41966. }
  41967. }
  41968. if (!inFDEF && !inELSE) {
  41969. var stackDelta = op <= 0x8E ? TTOpsStackDeltas[op] : op >= 0xC0 && op <= 0xDF ? -1 : op >= 0xE0 ? -2 : 0;
  41970. if (op >= 0x71 && op <= 0x75) {
  41971. n = stack.pop();
  41972. if (!isNaN(n)) {
  41973. stackDelta = -n * 2;
  41974. }
  41975. }
  41976. while (stackDelta < 0 && stack.length > 0) {
  41977. stack.pop();
  41978. stackDelta++;
  41979. }
  41980. while (stackDelta > 0) {
  41981. stack.push(NaN);
  41982. stackDelta--;
  41983. }
  41984. }
  41985. }
  41986. ttContext.tooComplexToFollowFunctions = tooComplexToFollowFunctions;
  41987. var content = [data];
  41988. if (i > data.length) {
  41989. content.push(new Uint8Array(i - data.length));
  41990. }
  41991. if (lastDeff > lastEndf) {
  41992. warn('TT: complementing a missing function tail');
  41993. content.push(new Uint8Array([
  41994. 0x22,
  41995. 0x2D
  41996. ]));
  41997. }
  41998. foldTTTable(table, content);
  41999. }
  42000. function checkInvalidFunctions(ttContext, maxFunctionDefs) {
  42001. if (ttContext.tooComplexToFollowFunctions) {
  42002. return;
  42003. }
  42004. if (ttContext.functionsDefined.length > maxFunctionDefs) {
  42005. warn('TT: more functions defined than expected');
  42006. ttContext.hintsValid = false;
  42007. return;
  42008. }
  42009. for (var j = 0, jj = ttContext.functionsUsed.length; j < jj; j++) {
  42010. if (j > maxFunctionDefs) {
  42011. warn('TT: invalid function id: ' + j);
  42012. ttContext.hintsValid = false;
  42013. return;
  42014. }
  42015. if (ttContext.functionsUsed[j] && !ttContext.functionsDefined[j]) {
  42016. warn('TT: undefined function: ' + j);
  42017. ttContext.hintsValid = false;
  42018. return;
  42019. }
  42020. }
  42021. }
  42022. function foldTTTable(table, content) {
  42023. if (content.length > 1) {
  42024. var newLength = 0;
  42025. var j, jj;
  42026. for (j = 0, jj = content.length; j < jj; j++) {
  42027. newLength += content[j].length;
  42028. }
  42029. newLength = newLength + 3 & ~3;
  42030. var result = new Uint8Array(newLength);
  42031. var pos = 0;
  42032. for (j = 0, jj = content.length; j < jj; j++) {
  42033. result.set(content[j], pos);
  42034. pos += content[j].length;
  42035. }
  42036. table.data = result;
  42037. table.length = newLength;
  42038. }
  42039. }
  42040. function sanitizeTTPrograms(fpgm, prep, cvt, maxFunctionDefs) {
  42041. var ttContext = {
  42042. functionsDefined: [],
  42043. functionsUsed: [],
  42044. functionsStackDeltas: [],
  42045. tooComplexToFollowFunctions: false,
  42046. hintsValid: true
  42047. };
  42048. if (fpgm) {
  42049. sanitizeTTProgram(fpgm, ttContext);
  42050. }
  42051. if (prep) {
  42052. sanitizeTTProgram(prep, ttContext);
  42053. }
  42054. if (fpgm) {
  42055. checkInvalidFunctions(ttContext, maxFunctionDefs);
  42056. }
  42057. if (cvt && cvt.length & 1) {
  42058. var cvtData = new Uint8Array(cvt.length + 1);
  42059. cvtData.set(cvt.data);
  42060. cvt.data = cvtData;
  42061. }
  42062. return ttContext.hintsValid;
  42063. }
  42064. font = new Stream(new Uint8Array(font.getBytes()));
  42065. var VALID_TABLES = [
  42066. 'OS/2',
  42067. 'cmap',
  42068. 'head',
  42069. 'hhea',
  42070. 'hmtx',
  42071. 'maxp',
  42072. 'name',
  42073. 'post',
  42074. 'loca',
  42075. 'glyf',
  42076. 'fpgm',
  42077. 'prep',
  42078. 'cvt ',
  42079. 'CFF '
  42080. ];
  42081. var header = readOpenTypeHeader(font);
  42082. var numTables = header.numTables;
  42083. var cff, cffFile;
  42084. var tables = Object.create(null);
  42085. tables['OS/2'] = null;
  42086. tables['cmap'] = null;
  42087. tables['head'] = null;
  42088. tables['hhea'] = null;
  42089. tables['hmtx'] = null;
  42090. tables['maxp'] = null;
  42091. tables['name'] = null;
  42092. tables['post'] = null;
  42093. var table;
  42094. for (var i = 0; i < numTables; i++) {
  42095. table = readTableEntry(font);
  42096. if (VALID_TABLES.indexOf(table.tag) < 0) {
  42097. continue;
  42098. }
  42099. if (table.length === 0) {
  42100. continue;
  42101. }
  42102. tables[table.tag] = table;
  42103. }
  42104. var isTrueType = !tables['CFF '];
  42105. if (!isTrueType) {
  42106. if (header.version === 'OTTO' && !properties.composite || !tables['head'] || !tables['hhea'] || !tables['maxp'] || !tables['post']) {
  42107. cffFile = new Stream(tables['CFF '].data);
  42108. cff = new CFFFont(cffFile, properties);
  42109. adjustWidths(properties);
  42110. return this.convert(name, cff, properties);
  42111. }
  42112. delete tables['glyf'];
  42113. delete tables['loca'];
  42114. delete tables['fpgm'];
  42115. delete tables['prep'];
  42116. delete tables['cvt '];
  42117. this.isOpenType = true;
  42118. } else {
  42119. if (!tables['loca']) {
  42120. error('Required "loca" table is not found');
  42121. }
  42122. if (!tables['glyf']) {
  42123. warn('Required "glyf" table is not found -- trying to recover.');
  42124. tables['glyf'] = {
  42125. tag: 'glyf',
  42126. data: new Uint8Array(0)
  42127. };
  42128. }
  42129. this.isOpenType = false;
  42130. }
  42131. if (!tables['maxp']) {
  42132. error('Required "maxp" table is not found');
  42133. }
  42134. font.pos = (font.start || 0) + tables['maxp'].offset;
  42135. var version = font.getInt32();
  42136. var numGlyphs = font.getUint16();
  42137. var maxFunctionDefs = 0;
  42138. if (version >= 0x00010000 && tables['maxp'].length >= 22) {
  42139. font.pos += 8;
  42140. var maxZones = font.getUint16();
  42141. if (maxZones > 2) {
  42142. tables['maxp'].data[14] = 0;
  42143. tables['maxp'].data[15] = 2;
  42144. }
  42145. font.pos += 4;
  42146. maxFunctionDefs = font.getUint16();
  42147. }
  42148. var dupFirstEntry = false;
  42149. if (properties.type === 'CIDFontType2' && properties.toUnicode && properties.toUnicode.get(0) > '\u0000') {
  42150. dupFirstEntry = true;
  42151. numGlyphs++;
  42152. tables['maxp'].data[4] = numGlyphs >> 8;
  42153. tables['maxp'].data[5] = numGlyphs & 255;
  42154. }
  42155. var hintsValid = sanitizeTTPrograms(tables['fpgm'], tables['prep'], tables['cvt '], maxFunctionDefs);
  42156. if (!hintsValid) {
  42157. delete tables['fpgm'];
  42158. delete tables['prep'];
  42159. delete tables['cvt '];
  42160. }
  42161. sanitizeMetrics(font, tables['hhea'], tables['hmtx'], numGlyphs);
  42162. if (!tables['head']) {
  42163. error('Required "head" table is not found');
  42164. }
  42165. sanitizeHead(tables['head'], numGlyphs, isTrueType ? tables['loca'].length : 0);
  42166. var missingGlyphs = Object.create(null);
  42167. if (isTrueType) {
  42168. var isGlyphLocationsLong = int16(tables['head'].data[50], tables['head'].data[51]);
  42169. missingGlyphs = sanitizeGlyphLocations(tables['loca'], tables['glyf'], numGlyphs, isGlyphLocationsLong, hintsValid, dupFirstEntry);
  42170. }
  42171. if (!tables['hhea']) {
  42172. error('Required "hhea" table is not found');
  42173. }
  42174. if (tables['hhea'].data[10] === 0 && tables['hhea'].data[11] === 0) {
  42175. tables['hhea'].data[10] = 0xFF;
  42176. tables['hhea'].data[11] = 0xFF;
  42177. }
  42178. var metricsOverride = {
  42179. unitsPerEm: int16(tables['head'].data[18], tables['head'].data[19]),
  42180. yMax: int16(tables['head'].data[42], tables['head'].data[43]),
  42181. yMin: signedInt16(tables['head'].data[38], tables['head'].data[39]),
  42182. ascent: int16(tables['hhea'].data[4], tables['hhea'].data[5]),
  42183. descent: signedInt16(tables['hhea'].data[6], tables['hhea'].data[7])
  42184. };
  42185. this.ascent = metricsOverride.ascent / metricsOverride.unitsPerEm;
  42186. this.descent = metricsOverride.descent / metricsOverride.unitsPerEm;
  42187. if (tables['post']) {
  42188. var valid = readPostScriptTable(tables['post'], properties, numGlyphs);
  42189. if (!valid) {
  42190. tables['post'] = null;
  42191. }
  42192. }
  42193. var charCodeToGlyphId = [], charCode;
  42194. var toUnicode = properties.toUnicode, widths = properties.widths;
  42195. var skipToUnicode = toUnicode instanceof IdentityToUnicodeMap || toUnicode.length === 0x10000;
  42196. function hasGlyph(glyphId, charCode, widthCode) {
  42197. if (!missingGlyphs[glyphId]) {
  42198. return true;
  42199. }
  42200. if (!skipToUnicode && charCode >= 0 && toUnicode.has(charCode)) {
  42201. return true;
  42202. }
  42203. if (widths && widthCode >= 0 && isNum(widths[widthCode])) {
  42204. return true;
  42205. }
  42206. return false;
  42207. }
  42208. if (properties.composite) {
  42209. var cidToGidMap = properties.cidToGidMap || [];
  42210. var isCidToGidMapEmpty = cidToGidMap.length === 0;
  42211. properties.cMap.forEach(function (charCode, cid) {
  42212. assert(cid <= 0xffff, 'Max size of CID is 65,535');
  42213. var glyphId = -1;
  42214. if (isCidToGidMapEmpty) {
  42215. glyphId = cid;
  42216. } else if (cidToGidMap[cid] !== undefined) {
  42217. glyphId = cidToGidMap[cid];
  42218. }
  42219. if (glyphId >= 0 && glyphId < numGlyphs && hasGlyph(glyphId, charCode, cid)) {
  42220. charCodeToGlyphId[charCode] = glyphId;
  42221. }
  42222. });
  42223. if (dupFirstEntry && (isCidToGidMapEmpty || !charCodeToGlyphId[0])) {
  42224. charCodeToGlyphId[0] = numGlyphs - 1;
  42225. }
  42226. } else {
  42227. var cmapTable = readCmapTable(tables['cmap'], font, this.isSymbolicFont, properties.hasEncoding);
  42228. var cmapPlatformId = cmapTable.platformId;
  42229. var cmapEncodingId = cmapTable.encodingId;
  42230. var cmapMappings = cmapTable.mappings;
  42231. var cmapMappingsLength = cmapMappings.length;
  42232. if (properties.hasEncoding && (cmapPlatformId === 3 && cmapEncodingId === 1 || cmapPlatformId === 1 && cmapEncodingId === 0) || cmapPlatformId === -1 && cmapEncodingId === -1 && !!getEncoding(properties.baseEncodingName)) {
  42233. var baseEncoding = [];
  42234. if (properties.baseEncodingName === 'MacRomanEncoding' || properties.baseEncodingName === 'WinAnsiEncoding') {
  42235. baseEncoding = getEncoding(properties.baseEncodingName);
  42236. }
  42237. var glyphsUnicodeMap = getGlyphsUnicode();
  42238. for (charCode = 0; charCode < 256; charCode++) {
  42239. var glyphName, standardGlyphName;
  42240. if (this.differences && charCode in this.differences) {
  42241. glyphName = this.differences[charCode];
  42242. } else if (charCode in baseEncoding && baseEncoding[charCode] !== '') {
  42243. glyphName = baseEncoding[charCode];
  42244. } else {
  42245. glyphName = StandardEncoding[charCode];
  42246. }
  42247. if (!glyphName) {
  42248. continue;
  42249. }
  42250. standardGlyphName = recoverGlyphName(glyphName, glyphsUnicodeMap);
  42251. var unicodeOrCharCode, isUnicode = false;
  42252. if (cmapPlatformId === 3 && cmapEncodingId === 1) {
  42253. unicodeOrCharCode = glyphsUnicodeMap[standardGlyphName];
  42254. isUnicode = true;
  42255. } else if (cmapPlatformId === 1 && cmapEncodingId === 0) {
  42256. unicodeOrCharCode = MacRomanEncoding.indexOf(standardGlyphName);
  42257. }
  42258. var found = false;
  42259. for (i = 0; i < cmapMappingsLength; ++i) {
  42260. if (cmapMappings[i].charCode !== unicodeOrCharCode) {
  42261. continue;
  42262. }
  42263. var code = isUnicode ? charCode : unicodeOrCharCode;
  42264. if (hasGlyph(cmapMappings[i].glyphId, code, -1)) {
  42265. charCodeToGlyphId[charCode] = cmapMappings[i].glyphId;
  42266. found = true;
  42267. break;
  42268. }
  42269. }
  42270. if (!found && properties.glyphNames) {
  42271. var glyphId = properties.glyphNames.indexOf(glyphName);
  42272. if (glyphId === -1 && standardGlyphName !== glyphName) {
  42273. glyphId = properties.glyphNames.indexOf(standardGlyphName);
  42274. }
  42275. if (glyphId > 0 && hasGlyph(glyphId, -1, -1)) {
  42276. charCodeToGlyphId[charCode] = glyphId;
  42277. found = true;
  42278. }
  42279. }
  42280. if (!found) {
  42281. charCodeToGlyphId[charCode] = 0;
  42282. }
  42283. }
  42284. } else if (cmapPlatformId === 0 && cmapEncodingId === 0) {
  42285. for (i = 0; i < cmapMappingsLength; ++i) {
  42286. charCodeToGlyphId[cmapMappings[i].charCode] = cmapMappings[i].glyphId;
  42287. }
  42288. } else {
  42289. for (i = 0; i < cmapMappingsLength; ++i) {
  42290. charCode = cmapMappings[i].charCode & 0xFF;
  42291. charCodeToGlyphId[charCode] = cmapMappings[i].glyphId;
  42292. }
  42293. }
  42294. }
  42295. if (charCodeToGlyphId.length === 0) {
  42296. charCodeToGlyphId[0] = 0;
  42297. }
  42298. var newMapping = adjustMapping(charCodeToGlyphId, properties);
  42299. this.toFontChar = newMapping.toFontChar;
  42300. tables['cmap'] = {
  42301. tag: 'cmap',
  42302. data: createCmapTable(newMapping.charCodeToGlyphId, numGlyphs)
  42303. };
  42304. if (!tables['OS/2'] || !validateOS2Table(tables['OS/2'])) {
  42305. tables['OS/2'] = {
  42306. tag: 'OS/2',
  42307. data: createOS2Table(properties, newMapping.charCodeToGlyphId, metricsOverride)
  42308. };
  42309. }
  42310. if (!tables['post']) {
  42311. tables['post'] = {
  42312. tag: 'post',
  42313. data: createPostTable(properties)
  42314. };
  42315. }
  42316. if (!isTrueType) {
  42317. try {
  42318. cffFile = new Stream(tables['CFF '].data);
  42319. var parser = new CFFParser(cffFile, properties, SEAC_ANALYSIS_ENABLED);
  42320. cff = parser.parse();
  42321. var compiler = new CFFCompiler(cff);
  42322. tables['CFF '].data = compiler.compile();
  42323. } catch (e) {
  42324. warn('Failed to compile font ' + properties.loadedName);
  42325. }
  42326. }
  42327. if (!tables['name']) {
  42328. tables['name'] = {
  42329. tag: 'name',
  42330. data: createNameTable(this.name)
  42331. };
  42332. } else {
  42333. var namePrototype = readNameTable(tables['name']);
  42334. tables['name'].data = createNameTable(name, namePrototype);
  42335. }
  42336. var builder = new OpenTypeFileBuilder(header.version);
  42337. for (var tableTag in tables) {
  42338. builder.addTable(tableTag, tables[tableTag].data);
  42339. }
  42340. return builder.toArray();
  42341. },
  42342. convert: function Font_convert(fontName, font, properties) {
  42343. properties.fixedPitch = false;
  42344. if (properties.builtInEncoding) {
  42345. adjustToUnicode(properties, properties.builtInEncoding);
  42346. }
  42347. var mapping = font.getGlyphMapping(properties);
  42348. var newMapping = adjustMapping(mapping, properties);
  42349. this.toFontChar = newMapping.toFontChar;
  42350. var numGlyphs = font.numGlyphs;
  42351. function getCharCodes(charCodeToGlyphId, glyphId) {
  42352. var charCodes = null;
  42353. for (var charCode in charCodeToGlyphId) {
  42354. if (glyphId === charCodeToGlyphId[charCode]) {
  42355. if (!charCodes) {
  42356. charCodes = [];
  42357. }
  42358. charCodes.push(charCode | 0);
  42359. }
  42360. }
  42361. return charCodes;
  42362. }
  42363. function createCharCode(charCodeToGlyphId, glyphId) {
  42364. for (var charCode in charCodeToGlyphId) {
  42365. if (glyphId === charCodeToGlyphId[charCode]) {
  42366. return charCode | 0;
  42367. }
  42368. }
  42369. newMapping.charCodeToGlyphId[newMapping.nextAvailableFontCharCode] = glyphId;
  42370. return newMapping.nextAvailableFontCharCode++;
  42371. }
  42372. var seacs = font.seacs;
  42373. if (SEAC_ANALYSIS_ENABLED && seacs && seacs.length) {
  42374. var matrix = properties.fontMatrix || FONT_IDENTITY_MATRIX;
  42375. var charset = font.getCharset();
  42376. var seacMap = Object.create(null);
  42377. for (var glyphId in seacs) {
  42378. glyphId |= 0;
  42379. var seac = seacs[glyphId];
  42380. var baseGlyphName = StandardEncoding[seac[2]];
  42381. var accentGlyphName = StandardEncoding[seac[3]];
  42382. var baseGlyphId = charset.indexOf(baseGlyphName);
  42383. var accentGlyphId = charset.indexOf(accentGlyphName);
  42384. if (baseGlyphId < 0 || accentGlyphId < 0) {
  42385. continue;
  42386. }
  42387. var accentOffset = {
  42388. x: seac[0] * matrix[0] + seac[1] * matrix[2] + matrix[4],
  42389. y: seac[0] * matrix[1] + seac[1] * matrix[3] + matrix[5]
  42390. };
  42391. var charCodes = getCharCodes(mapping, glyphId);
  42392. if (!charCodes) {
  42393. continue;
  42394. }
  42395. for (var i = 0, ii = charCodes.length; i < ii; i++) {
  42396. var charCode = charCodes[i];
  42397. var charCodeToGlyphId = newMapping.charCodeToGlyphId;
  42398. var baseFontCharCode = createCharCode(charCodeToGlyphId, baseGlyphId);
  42399. var accentFontCharCode = createCharCode(charCodeToGlyphId, accentGlyphId);
  42400. seacMap[charCode] = {
  42401. baseFontCharCode: baseFontCharCode,
  42402. accentFontCharCode: accentFontCharCode,
  42403. accentOffset: accentOffset
  42404. };
  42405. }
  42406. }
  42407. properties.seacMap = seacMap;
  42408. }
  42409. var unitsPerEm = 1 / (properties.fontMatrix || FONT_IDENTITY_MATRIX)[0];
  42410. var builder = new OpenTypeFileBuilder('\x4F\x54\x54\x4F');
  42411. builder.addTable('CFF ', font.data);
  42412. builder.addTable('OS/2', createOS2Table(properties, newMapping.charCodeToGlyphId));
  42413. builder.addTable('cmap', createCmapTable(newMapping.charCodeToGlyphId, numGlyphs));
  42414. 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');
  42415. 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));
  42416. builder.addTable('hmtx', function fontFieldsHmtx() {
  42417. var charstrings = font.charstrings;
  42418. var cffWidths = font.cff ? font.cff.widths : null;
  42419. var hmtx = '\x00\x00\x00\x00';
  42420. for (var i = 1, ii = numGlyphs; i < ii; i++) {
  42421. var width = 0;
  42422. if (charstrings) {
  42423. var charstring = charstrings[i - 1];
  42424. width = 'width' in charstring ? charstring.width : 0;
  42425. } else if (cffWidths) {
  42426. width = Math.ceil(cffWidths[i] || 0);
  42427. }
  42428. hmtx += string16(width) + string16(0);
  42429. }
  42430. return hmtx;
  42431. }());
  42432. builder.addTable('maxp', '\x00\x00\x50\x00' + string16(numGlyphs));
  42433. builder.addTable('name', createNameTable(fontName));
  42434. builder.addTable('post', createPostTable(properties));
  42435. return builder.toArray();
  42436. },
  42437. get spaceWidth() {
  42438. if ('_shadowWidth' in this) {
  42439. return this._shadowWidth;
  42440. }
  42441. var possibleSpaceReplacements = [
  42442. 'space',
  42443. 'minus',
  42444. 'one',
  42445. 'i',
  42446. 'I'
  42447. ];
  42448. var width;
  42449. for (var i = 0, ii = possibleSpaceReplacements.length; i < ii; i++) {
  42450. var glyphName = possibleSpaceReplacements[i];
  42451. if (glyphName in this.widths) {
  42452. width = this.widths[glyphName];
  42453. break;
  42454. }
  42455. var glyphsUnicodeMap = getGlyphsUnicode();
  42456. var glyphUnicode = glyphsUnicodeMap[glyphName];
  42457. var charcode = 0;
  42458. if (this.composite) {
  42459. if (this.cMap.contains(glyphUnicode)) {
  42460. charcode = this.cMap.lookup(glyphUnicode);
  42461. }
  42462. }
  42463. if (!charcode && this.toUnicode) {
  42464. charcode = this.toUnicode.charCodeOf(glyphUnicode);
  42465. }
  42466. if (charcode <= 0) {
  42467. charcode = glyphUnicode;
  42468. }
  42469. width = this.widths[charcode];
  42470. if (width) {
  42471. break;
  42472. }
  42473. }
  42474. width = width || this.defaultWidth;
  42475. this._shadowWidth = width;
  42476. return width;
  42477. },
  42478. charToGlyph: function Font_charToGlyph(charcode, isSpace) {
  42479. var fontCharCode, width, operatorListId;
  42480. var widthCode = charcode;
  42481. if (this.cMap && this.cMap.contains(charcode)) {
  42482. widthCode = this.cMap.lookup(charcode);
  42483. }
  42484. width = this.widths[widthCode];
  42485. width = isNum(width) ? width : this.defaultWidth;
  42486. var vmetric = this.vmetrics && this.vmetrics[widthCode];
  42487. var unicode = this.toUnicode.get(charcode) || charcode;
  42488. if (typeof unicode === 'number') {
  42489. unicode = String.fromCharCode(unicode);
  42490. }
  42491. var isInFont = charcode in this.toFontChar;
  42492. fontCharCode = this.toFontChar[charcode] || charcode;
  42493. if (this.missingFile) {
  42494. fontCharCode = mapSpecialUnicodeValues(fontCharCode);
  42495. }
  42496. if (this.isType3Font) {
  42497. operatorListId = fontCharCode;
  42498. }
  42499. var accent = null;
  42500. if (this.seacMap && this.seacMap[charcode]) {
  42501. isInFont = true;
  42502. var seac = this.seacMap[charcode];
  42503. fontCharCode = seac.baseFontCharCode;
  42504. accent = {
  42505. fontChar: String.fromCharCode(seac.accentFontCharCode),
  42506. offset: seac.accentOffset
  42507. };
  42508. }
  42509. var fontChar = String.fromCharCode(fontCharCode);
  42510. var glyph = this.glyphCache[charcode];
  42511. if (!glyph || !glyph.matchesForCache(fontChar, unicode, accent, width, vmetric, operatorListId, isSpace, isInFont)) {
  42512. glyph = new Glyph(fontChar, unicode, accent, width, vmetric, operatorListId, isSpace, isInFont);
  42513. this.glyphCache[charcode] = glyph;
  42514. }
  42515. return glyph;
  42516. },
  42517. charsToGlyphs: function Font_charsToGlyphs(chars) {
  42518. var charsCache = this.charsCache;
  42519. var glyphs, glyph, charcode;
  42520. if (charsCache) {
  42521. glyphs = charsCache[chars];
  42522. if (glyphs) {
  42523. return glyphs;
  42524. }
  42525. }
  42526. if (!charsCache) {
  42527. charsCache = this.charsCache = Object.create(null);
  42528. }
  42529. glyphs = [];
  42530. var charsCacheKey = chars;
  42531. var i = 0, ii;
  42532. if (this.cMap) {
  42533. var c = Object.create(null);
  42534. while (i < chars.length) {
  42535. this.cMap.readCharCode(chars, i, c);
  42536. charcode = c.charcode;
  42537. var length = c.length;
  42538. i += length;
  42539. var isSpace = length === 1 && chars.charCodeAt(i - 1) === 0x20;
  42540. glyph = this.charToGlyph(charcode, isSpace);
  42541. glyphs.push(glyph);
  42542. }
  42543. } else {
  42544. for (i = 0, ii = chars.length; i < ii; ++i) {
  42545. charcode = chars.charCodeAt(i);
  42546. glyph = this.charToGlyph(charcode, charcode === 0x20);
  42547. glyphs.push(glyph);
  42548. }
  42549. }
  42550. return charsCache[charsCacheKey] = glyphs;
  42551. }
  42552. };
  42553. return Font;
  42554. }();
  42555. var ErrorFont = function ErrorFontClosure() {
  42556. function ErrorFont(error) {
  42557. this.error = error;
  42558. this.loadedName = 'g_font_error';
  42559. this.loading = false;
  42560. }
  42561. ErrorFont.prototype = {
  42562. charsToGlyphs: function ErrorFont_charsToGlyphs() {
  42563. return [];
  42564. },
  42565. exportData: function ErrorFont_exportData() {
  42566. return { error: this.error };
  42567. }
  42568. };
  42569. return ErrorFont;
  42570. }();
  42571. function type1FontGlyphMapping(properties, builtInEncoding, glyphNames) {
  42572. var charCodeToGlyphId = Object.create(null);
  42573. var glyphId, charCode, baseEncoding;
  42574. var isSymbolicFont = !!(properties.flags & FontFlags.Symbolic);
  42575. if (properties.baseEncodingName) {
  42576. baseEncoding = getEncoding(properties.baseEncodingName);
  42577. for (charCode = 0; charCode < baseEncoding.length; charCode++) {
  42578. glyphId = glyphNames.indexOf(baseEncoding[charCode]);
  42579. if (glyphId >= 0) {
  42580. charCodeToGlyphId[charCode] = glyphId;
  42581. } else {
  42582. charCodeToGlyphId[charCode] = 0;
  42583. }
  42584. }
  42585. } else if (isSymbolicFont) {
  42586. for (charCode in builtInEncoding) {
  42587. charCodeToGlyphId[charCode] = builtInEncoding[charCode];
  42588. }
  42589. } else {
  42590. baseEncoding = StandardEncoding;
  42591. for (charCode = 0; charCode < baseEncoding.length; charCode++) {
  42592. glyphId = glyphNames.indexOf(baseEncoding[charCode]);
  42593. if (glyphId >= 0) {
  42594. charCodeToGlyphId[charCode] = glyphId;
  42595. } else {
  42596. charCodeToGlyphId[charCode] = 0;
  42597. }
  42598. }
  42599. }
  42600. var differences = properties.differences, glyphsUnicodeMap;
  42601. if (differences) {
  42602. for (charCode in differences) {
  42603. var glyphName = differences[charCode];
  42604. glyphId = glyphNames.indexOf(glyphName);
  42605. if (glyphId === -1) {
  42606. if (!glyphsUnicodeMap) {
  42607. glyphsUnicodeMap = getGlyphsUnicode();
  42608. }
  42609. var standardGlyphName = recoverGlyphName(glyphName, glyphsUnicodeMap);
  42610. if (standardGlyphName !== glyphName) {
  42611. glyphId = glyphNames.indexOf(standardGlyphName);
  42612. }
  42613. }
  42614. if (glyphId >= 0) {
  42615. charCodeToGlyphId[charCode] = glyphId;
  42616. } else {
  42617. charCodeToGlyphId[charCode] = 0;
  42618. }
  42619. }
  42620. }
  42621. return charCodeToGlyphId;
  42622. }
  42623. var Type1Font = function Type1FontClosure() {
  42624. function findBlock(streamBytes, signature, startIndex) {
  42625. var streamBytesLength = streamBytes.length;
  42626. var signatureLength = signature.length;
  42627. var scanLength = streamBytesLength - signatureLength;
  42628. var i = startIndex, j, found = false;
  42629. while (i < scanLength) {
  42630. j = 0;
  42631. while (j < signatureLength && streamBytes[i + j] === signature[j]) {
  42632. j++;
  42633. }
  42634. if (j >= signatureLength) {
  42635. i += j;
  42636. while (i < streamBytesLength && isSpace(streamBytes[i])) {
  42637. i++;
  42638. }
  42639. found = true;
  42640. break;
  42641. }
  42642. i++;
  42643. }
  42644. return {
  42645. found: found,
  42646. length: i
  42647. };
  42648. }
  42649. function getHeaderBlock(stream, suggestedLength) {
  42650. var EEXEC_SIGNATURE = [
  42651. 0x65,
  42652. 0x65,
  42653. 0x78,
  42654. 0x65,
  42655. 0x63
  42656. ];
  42657. var streamStartPos = stream.pos;
  42658. var headerBytes, headerBytesLength, block;
  42659. try {
  42660. headerBytes = stream.getBytes(suggestedLength);
  42661. headerBytesLength = headerBytes.length;
  42662. } catch (ex) {
  42663. if (ex instanceof MissingDataException) {
  42664. throw ex;
  42665. }
  42666. }
  42667. if (headerBytesLength === suggestedLength) {
  42668. block = findBlock(headerBytes, EEXEC_SIGNATURE, suggestedLength - 2 * EEXEC_SIGNATURE.length);
  42669. if (block.found && block.length === suggestedLength) {
  42670. return {
  42671. stream: new Stream(headerBytes),
  42672. length: suggestedLength
  42673. };
  42674. }
  42675. }
  42676. warn('Invalid "Length1" property in Type1 font -- trying to recover.');
  42677. stream.pos = streamStartPos;
  42678. var SCAN_BLOCK_LENGTH = 2048;
  42679. var actualLength;
  42680. while (true) {
  42681. var scanBytes = stream.peekBytes(SCAN_BLOCK_LENGTH);
  42682. block = findBlock(scanBytes, EEXEC_SIGNATURE, 0);
  42683. if (block.length === 0) {
  42684. break;
  42685. }
  42686. stream.pos += block.length;
  42687. if (block.found) {
  42688. actualLength = stream.pos - streamStartPos;
  42689. break;
  42690. }
  42691. }
  42692. stream.pos = streamStartPos;
  42693. if (actualLength) {
  42694. return {
  42695. stream: new Stream(stream.getBytes(actualLength)),
  42696. length: actualLength
  42697. };
  42698. }
  42699. warn('Unable to recover "Length1" property in Type1 font -- using as is.');
  42700. return {
  42701. stream: new Stream(stream.getBytes(suggestedLength)),
  42702. length: suggestedLength
  42703. };
  42704. }
  42705. function getEexecBlock(stream, suggestedLength) {
  42706. var eexecBytes = stream.getBytes();
  42707. return {
  42708. stream: new Stream(eexecBytes),
  42709. length: eexecBytes.length
  42710. };
  42711. }
  42712. function Type1Font(name, file, properties) {
  42713. var PFB_HEADER_SIZE = 6;
  42714. var headerBlockLength = properties.length1;
  42715. var eexecBlockLength = properties.length2;
  42716. var pfbHeader = file.peekBytes(PFB_HEADER_SIZE);
  42717. var pfbHeaderPresent = pfbHeader[0] === 0x80 && pfbHeader[1] === 0x01;
  42718. if (pfbHeaderPresent) {
  42719. file.skip(PFB_HEADER_SIZE);
  42720. headerBlockLength = pfbHeader[5] << 24 | pfbHeader[4] << 16 | pfbHeader[3] << 8 | pfbHeader[2];
  42721. }
  42722. var headerBlock = getHeaderBlock(file, headerBlockLength);
  42723. headerBlockLength = headerBlock.length;
  42724. var headerBlockParser = new Type1Parser(headerBlock.stream, false, SEAC_ANALYSIS_ENABLED);
  42725. headerBlockParser.extractFontHeader(properties);
  42726. if (pfbHeaderPresent) {
  42727. pfbHeader = file.getBytes(PFB_HEADER_SIZE);
  42728. eexecBlockLength = pfbHeader[5] << 24 | pfbHeader[4] << 16 | pfbHeader[3] << 8 | pfbHeader[2];
  42729. }
  42730. var eexecBlock = getEexecBlock(file, eexecBlockLength);
  42731. eexecBlockLength = eexecBlock.length;
  42732. var eexecBlockParser = new Type1Parser(eexecBlock.stream, true, SEAC_ANALYSIS_ENABLED);
  42733. var data = eexecBlockParser.extractFontProgram();
  42734. for (var info in data.properties) {
  42735. properties[info] = data.properties[info];
  42736. }
  42737. var charstrings = data.charstrings;
  42738. var type2Charstrings = this.getType2Charstrings(charstrings);
  42739. var subrs = this.getType2Subrs(data.subrs);
  42740. this.charstrings = charstrings;
  42741. this.data = this.wrap(name, type2Charstrings, this.charstrings, subrs, properties);
  42742. this.seacs = this.getSeacs(data.charstrings);
  42743. }
  42744. Type1Font.prototype = {
  42745. get numGlyphs() {
  42746. return this.charstrings.length + 1;
  42747. },
  42748. getCharset: function Type1Font_getCharset() {
  42749. var charset = ['.notdef'];
  42750. var charstrings = this.charstrings;
  42751. for (var glyphId = 0; glyphId < charstrings.length; glyphId++) {
  42752. charset.push(charstrings[glyphId].glyphName);
  42753. }
  42754. return charset;
  42755. },
  42756. getGlyphMapping: function Type1Font_getGlyphMapping(properties) {
  42757. var charstrings = this.charstrings;
  42758. var glyphNames = ['.notdef'], glyphId;
  42759. for (glyphId = 0; glyphId < charstrings.length; glyphId++) {
  42760. glyphNames.push(charstrings[glyphId].glyphName);
  42761. }
  42762. var encoding = properties.builtInEncoding;
  42763. if (encoding) {
  42764. var builtInEncoding = Object.create(null);
  42765. for (var charCode in encoding) {
  42766. glyphId = glyphNames.indexOf(encoding[charCode]);
  42767. if (glyphId >= 0) {
  42768. builtInEncoding[charCode] = glyphId;
  42769. }
  42770. }
  42771. }
  42772. return type1FontGlyphMapping(properties, builtInEncoding, glyphNames);
  42773. },
  42774. getSeacs: function Type1Font_getSeacs(charstrings) {
  42775. var i, ii;
  42776. var seacMap = [];
  42777. for (i = 0, ii = charstrings.length; i < ii; i++) {
  42778. var charstring = charstrings[i];
  42779. if (charstring.seac) {
  42780. seacMap[i + 1] = charstring.seac;
  42781. }
  42782. }
  42783. return seacMap;
  42784. },
  42785. getType2Charstrings: function Type1Font_getType2Charstrings(type1Charstrings) {
  42786. var type2Charstrings = [];
  42787. for (var i = 0, ii = type1Charstrings.length; i < ii; i++) {
  42788. type2Charstrings.push(type1Charstrings[i].charstring);
  42789. }
  42790. return type2Charstrings;
  42791. },
  42792. getType2Subrs: function Type1Font_getType2Subrs(type1Subrs) {
  42793. var bias = 0;
  42794. var count = type1Subrs.length;
  42795. if (count < 1133) {
  42796. bias = 107;
  42797. } else if (count < 33769) {
  42798. bias = 1131;
  42799. } else {
  42800. bias = 32768;
  42801. }
  42802. var type2Subrs = [];
  42803. var i;
  42804. for (i = 0; i < bias; i++) {
  42805. type2Subrs.push([0x0B]);
  42806. }
  42807. for (i = 0; i < count; i++) {
  42808. type2Subrs.push(type1Subrs[i]);
  42809. }
  42810. return type2Subrs;
  42811. },
  42812. wrap: function Type1Font_wrap(name, glyphs, charstrings, subrs, properties) {
  42813. var cff = new CFF();
  42814. cff.header = new CFFHeader(1, 0, 4, 4);
  42815. cff.names = [name];
  42816. var topDict = new CFFTopDict();
  42817. topDict.setByName('version', 391);
  42818. topDict.setByName('Notice', 392);
  42819. topDict.setByName('FullName', 393);
  42820. topDict.setByName('FamilyName', 394);
  42821. topDict.setByName('Weight', 395);
  42822. topDict.setByName('Encoding', null);
  42823. topDict.setByName('FontMatrix', properties.fontMatrix);
  42824. topDict.setByName('FontBBox', properties.bbox);
  42825. topDict.setByName('charset', null);
  42826. topDict.setByName('CharStrings', null);
  42827. topDict.setByName('Private', null);
  42828. cff.topDict = topDict;
  42829. var strings = new CFFStrings();
  42830. strings.add('Version 0.11');
  42831. strings.add('See original notice');
  42832. strings.add(name);
  42833. strings.add(name);
  42834. strings.add('Medium');
  42835. cff.strings = strings;
  42836. cff.globalSubrIndex = new CFFIndex();
  42837. var count = glyphs.length;
  42838. var charsetArray = [0];
  42839. var i, ii;
  42840. for (i = 0; i < count; i++) {
  42841. var index = CFFStandardStrings.indexOf(charstrings[i].glyphName);
  42842. if (index === -1) {
  42843. index = 0;
  42844. }
  42845. charsetArray.push(index >> 8 & 0xff, index & 0xff);
  42846. }
  42847. cff.charset = new CFFCharset(false, 0, [], charsetArray);
  42848. var charStringsIndex = new CFFIndex();
  42849. charStringsIndex.add([
  42850. 0x8B,
  42851. 0x0E
  42852. ]);
  42853. for (i = 0; i < count; i++) {
  42854. var glyph = glyphs[i];
  42855. if (glyph.length === 0) {
  42856. charStringsIndex.add([
  42857. 0x8B,
  42858. 0x0E
  42859. ]);
  42860. continue;
  42861. }
  42862. charStringsIndex.add(glyph);
  42863. }
  42864. cff.charStrings = charStringsIndex;
  42865. var privateDict = new CFFPrivateDict();
  42866. privateDict.setByName('Subrs', null);
  42867. var fields = [
  42868. 'BlueValues',
  42869. 'OtherBlues',
  42870. 'FamilyBlues',
  42871. 'FamilyOtherBlues',
  42872. 'StemSnapH',
  42873. 'StemSnapV',
  42874. 'BlueShift',
  42875. 'BlueFuzz',
  42876. 'BlueScale',
  42877. 'LanguageGroup',
  42878. 'ExpansionFactor',
  42879. 'ForceBold',
  42880. 'StdHW',
  42881. 'StdVW'
  42882. ];
  42883. for (i = 0, ii = fields.length; i < ii; i++) {
  42884. var field = fields[i];
  42885. if (!(field in properties.privateData)) {
  42886. continue;
  42887. }
  42888. var value = properties.privateData[field];
  42889. if (isArray(value)) {
  42890. for (var j = value.length - 1; j > 0; j--) {
  42891. value[j] -= value[j - 1];
  42892. }
  42893. }
  42894. privateDict.setByName(field, value);
  42895. }
  42896. cff.topDict.privateDict = privateDict;
  42897. var subrIndex = new CFFIndex();
  42898. for (i = 0, ii = subrs.length; i < ii; i++) {
  42899. subrIndex.add(subrs[i]);
  42900. }
  42901. privateDict.subrsIndex = subrIndex;
  42902. var compiler = new CFFCompiler(cff);
  42903. return compiler.compile();
  42904. }
  42905. };
  42906. return Type1Font;
  42907. }();
  42908. var CFFFont = function CFFFontClosure() {
  42909. function CFFFont(file, properties) {
  42910. this.properties = properties;
  42911. var parser = new CFFParser(file, properties, SEAC_ANALYSIS_ENABLED);
  42912. this.cff = parser.parse();
  42913. var compiler = new CFFCompiler(this.cff);
  42914. this.seacs = this.cff.seacs;
  42915. try {
  42916. this.data = compiler.compile();
  42917. } catch (e) {
  42918. warn('Failed to compile font ' + properties.loadedName);
  42919. this.data = file;
  42920. }
  42921. }
  42922. CFFFont.prototype = {
  42923. get numGlyphs() {
  42924. return this.cff.charStrings.count;
  42925. },
  42926. getCharset: function CFFFont_getCharset() {
  42927. return this.cff.charset.charset;
  42928. },
  42929. getGlyphMapping: function CFFFont_getGlyphMapping() {
  42930. var cff = this.cff;
  42931. var properties = this.properties;
  42932. var charsets = cff.charset.charset;
  42933. var charCodeToGlyphId;
  42934. var glyphId;
  42935. if (properties.composite) {
  42936. charCodeToGlyphId = Object.create(null);
  42937. if (cff.isCIDFont) {
  42938. for (glyphId = 0; glyphId < charsets.length; glyphId++) {
  42939. var cid = charsets[glyphId];
  42940. var charCode = properties.cMap.charCodeOf(cid);
  42941. charCodeToGlyphId[charCode] = glyphId;
  42942. }
  42943. } else {
  42944. for (glyphId = 0; glyphId < cff.charStrings.count; glyphId++) {
  42945. charCodeToGlyphId[glyphId] = glyphId;
  42946. }
  42947. }
  42948. return charCodeToGlyphId;
  42949. }
  42950. var encoding = cff.encoding ? cff.encoding.encoding : null;
  42951. charCodeToGlyphId = type1FontGlyphMapping(properties, encoding, charsets);
  42952. return charCodeToGlyphId;
  42953. }
  42954. };
  42955. return CFFFont;
  42956. }();
  42957. (function checkSeacSupport() {
  42958. if (typeof navigator !== 'undefined' && /Windows/.test(navigator.userAgent)) {
  42959. SEAC_ANALYSIS_ENABLED = true;
  42960. }
  42961. }());
  42962. (function checkChromeWindows() {
  42963. if (typeof navigator !== 'undefined' && /Windows.*Chrome/.test(navigator.userAgent)) {
  42964. SKIP_PRIVATE_USE_RANGE_F000_TO_F01F = true;
  42965. }
  42966. }());
  42967. exports.ErrorFont = ErrorFont;
  42968. exports.Font = Font;
  42969. exports.FontFlags = FontFlags;
  42970. exports.IdentityToUnicodeMap = IdentityToUnicodeMap;
  42971. exports.ToUnicodeMap = ToUnicodeMap;
  42972. exports.getFontType = getFontType;
  42973. /***/ }),
  42974. /* 27 */
  42975. /***/ (function(module, exports, __w_pdfjs_require__) {
  42976. "use strict";
  42977. var sharedUtil = __w_pdfjs_require__(0);
  42978. var corePrimitives = __w_pdfjs_require__(1);
  42979. var coreColorSpace = __w_pdfjs_require__(3);
  42980. var coreStream = __w_pdfjs_require__(2);
  42981. var coreJpx = __w_pdfjs_require__(14);
  42982. var ImageKind = sharedUtil.ImageKind;
  42983. var assert = sharedUtil.assert;
  42984. var error = sharedUtil.error;
  42985. var info = sharedUtil.info;
  42986. var isArray = sharedUtil.isArray;
  42987. var warn = sharedUtil.warn;
  42988. var Name = corePrimitives.Name;
  42989. var isStream = corePrimitives.isStream;
  42990. var ColorSpace = coreColorSpace.ColorSpace;
  42991. var DecodeStream = coreStream.DecodeStream;
  42992. var JpegStream = coreStream.JpegStream;
  42993. var JpxImage = coreJpx.JpxImage;
  42994. var PDFImage = function PDFImageClosure() {
  42995. function handleImageData(image, nativeDecoder) {
  42996. if (nativeDecoder && nativeDecoder.canDecode(image)) {
  42997. return nativeDecoder.decode(image);
  42998. }
  42999. return Promise.resolve(image);
  43000. }
  43001. function decodeAndClamp(value, addend, coefficient, max) {
  43002. value = addend + value * coefficient;
  43003. return value < 0 ? 0 : value > max ? max : value;
  43004. }
  43005. function resizeImageMask(src, bpc, w1, h1, w2, h2) {
  43006. var length = w2 * h2;
  43007. var dest = bpc <= 8 ? new Uint8Array(length) : bpc <= 16 ? new Uint16Array(length) : new Uint32Array(length);
  43008. var xRatio = w1 / w2;
  43009. var yRatio = h1 / h2;
  43010. var i, j, py, newIndex = 0, oldIndex;
  43011. var xScaled = new Uint16Array(w2);
  43012. var w1Scanline = w1;
  43013. for (i = 0; i < w2; i++) {
  43014. xScaled[i] = Math.floor(i * xRatio);
  43015. }
  43016. for (i = 0; i < h2; i++) {
  43017. py = Math.floor(i * yRatio) * w1Scanline;
  43018. for (j = 0; j < w2; j++) {
  43019. oldIndex = py + xScaled[j];
  43020. dest[newIndex++] = src[oldIndex];
  43021. }
  43022. }
  43023. return dest;
  43024. }
  43025. function PDFImage(xref, res, image, inline, smask, mask, isMask) {
  43026. this.image = image;
  43027. var dict = image.dict;
  43028. if (dict.has('Filter')) {
  43029. var filter = dict.get('Filter').name;
  43030. if (filter === 'JPXDecode') {
  43031. var jpxImage = new JpxImage();
  43032. jpxImage.parseImageProperties(image.stream);
  43033. image.stream.reset();
  43034. image.bitsPerComponent = jpxImage.bitsPerComponent;
  43035. image.numComps = jpxImage.componentsCount;
  43036. } else if (filter === 'JBIG2Decode') {
  43037. image.bitsPerComponent = 1;
  43038. image.numComps = 1;
  43039. }
  43040. }
  43041. this.width = dict.get('Width', 'W');
  43042. this.height = dict.get('Height', 'H');
  43043. if (this.width < 1 || this.height < 1) {
  43044. error('Invalid image width: ' + this.width + ' or height: ' + this.height);
  43045. }
  43046. this.interpolate = dict.get('Interpolate', 'I') || false;
  43047. this.imageMask = dict.get('ImageMask', 'IM') || false;
  43048. this.matte = dict.get('Matte') || false;
  43049. var bitsPerComponent = image.bitsPerComponent;
  43050. if (!bitsPerComponent) {
  43051. bitsPerComponent = dict.get('BitsPerComponent', 'BPC');
  43052. if (!bitsPerComponent) {
  43053. if (this.imageMask) {
  43054. bitsPerComponent = 1;
  43055. } else {
  43056. error('Bits per component missing in image: ' + this.imageMask);
  43057. }
  43058. }
  43059. }
  43060. this.bpc = bitsPerComponent;
  43061. if (!this.imageMask) {
  43062. var colorSpace = dict.get('ColorSpace', 'CS');
  43063. if (!colorSpace) {
  43064. info('JPX images (which do not require color spaces)');
  43065. switch (image.numComps) {
  43066. case 1:
  43067. colorSpace = Name.get('DeviceGray');
  43068. break;
  43069. case 3:
  43070. colorSpace = Name.get('DeviceRGB');
  43071. break;
  43072. case 4:
  43073. colorSpace = Name.get('DeviceCMYK');
  43074. break;
  43075. default:
  43076. error('JPX images with ' + this.numComps + ' color components not supported.');
  43077. }
  43078. }
  43079. this.colorSpace = ColorSpace.parse(colorSpace, xref, res);
  43080. this.numComps = this.colorSpace.numComps;
  43081. }
  43082. this.decode = dict.getArray('Decode', 'D');
  43083. this.needsDecode = false;
  43084. if (this.decode && (this.colorSpace && !this.colorSpace.isDefaultDecode(this.decode) || isMask && !ColorSpace.isDefaultDecode(this.decode, 1))) {
  43085. this.needsDecode = true;
  43086. var max = (1 << bitsPerComponent) - 1;
  43087. this.decodeCoefficients = [];
  43088. this.decodeAddends = [];
  43089. for (var i = 0, j = 0; i < this.decode.length; i += 2, ++j) {
  43090. var dmin = this.decode[i];
  43091. var dmax = this.decode[i + 1];
  43092. this.decodeCoefficients[j] = dmax - dmin;
  43093. this.decodeAddends[j] = max * dmin;
  43094. }
  43095. }
  43096. if (smask) {
  43097. this.smask = new PDFImage(xref, res, smask, false);
  43098. } else if (mask) {
  43099. if (isStream(mask)) {
  43100. var maskDict = mask.dict, imageMask = maskDict.get('ImageMask', 'IM');
  43101. if (!imageMask) {
  43102. warn('Ignoring /Mask in image without /ImageMask.');
  43103. } else {
  43104. this.mask = new PDFImage(xref, res, mask, false, null, null, true);
  43105. }
  43106. } else {
  43107. this.mask = mask;
  43108. }
  43109. }
  43110. }
  43111. PDFImage.buildImage = function PDFImage_buildImage(handler, xref, res, image, inline, nativeDecoder) {
  43112. var imagePromise = handleImageData(image, nativeDecoder);
  43113. var smaskPromise;
  43114. var maskPromise;
  43115. var smask = image.dict.get('SMask');
  43116. var mask = image.dict.get('Mask');
  43117. if (smask) {
  43118. smaskPromise = handleImageData(smask, nativeDecoder);
  43119. maskPromise = Promise.resolve(null);
  43120. } else {
  43121. smaskPromise = Promise.resolve(null);
  43122. if (mask) {
  43123. if (isStream(mask)) {
  43124. maskPromise = handleImageData(mask, nativeDecoder);
  43125. } else if (isArray(mask)) {
  43126. maskPromise = Promise.resolve(mask);
  43127. } else {
  43128. warn('Unsupported mask format.');
  43129. maskPromise = Promise.resolve(null);
  43130. }
  43131. } else {
  43132. maskPromise = Promise.resolve(null);
  43133. }
  43134. }
  43135. return Promise.all([
  43136. imagePromise,
  43137. smaskPromise,
  43138. maskPromise
  43139. ]).then(function (results) {
  43140. var imageData = results[0];
  43141. var smaskData = results[1];
  43142. var maskData = results[2];
  43143. return new PDFImage(xref, res, imageData, inline, smaskData, maskData);
  43144. });
  43145. };
  43146. PDFImage.createMask = function PDFImage_createMask(imgArray, width, height, imageIsFromDecodeStream, inverseDecode) {
  43147. var computedLength = (width + 7 >> 3) * height;
  43148. var actualLength = imgArray.byteLength;
  43149. var haveFullData = computedLength === actualLength;
  43150. var data, i;
  43151. if (imageIsFromDecodeStream && (!inverseDecode || haveFullData)) {
  43152. data = imgArray;
  43153. } else if (!inverseDecode) {
  43154. data = new Uint8Array(actualLength);
  43155. data.set(imgArray);
  43156. } else {
  43157. data = new Uint8Array(computedLength);
  43158. data.set(imgArray);
  43159. for (i = actualLength; i < computedLength; i++) {
  43160. data[i] = 0xff;
  43161. }
  43162. }
  43163. if (inverseDecode) {
  43164. for (i = 0; i < actualLength; i++) {
  43165. data[i] = ~data[i];
  43166. }
  43167. }
  43168. return {
  43169. data: data,
  43170. width: width,
  43171. height: height
  43172. };
  43173. };
  43174. PDFImage.prototype = {
  43175. get drawWidth() {
  43176. return Math.max(this.width, this.smask && this.smask.width || 0, this.mask && this.mask.width || 0);
  43177. },
  43178. get drawHeight() {
  43179. return Math.max(this.height, this.smask && this.smask.height || 0, this.mask && this.mask.height || 0);
  43180. },
  43181. decodeBuffer: function PDFImage_decodeBuffer(buffer) {
  43182. var bpc = this.bpc;
  43183. var numComps = this.numComps;
  43184. var decodeAddends = this.decodeAddends;
  43185. var decodeCoefficients = this.decodeCoefficients;
  43186. var max = (1 << bpc) - 1;
  43187. var i, ii;
  43188. if (bpc === 1) {
  43189. for (i = 0, ii = buffer.length; i < ii; i++) {
  43190. buffer[i] = +!buffer[i];
  43191. }
  43192. return;
  43193. }
  43194. var index = 0;
  43195. for (i = 0, ii = this.width * this.height; i < ii; i++) {
  43196. for (var j = 0; j < numComps; j++) {
  43197. buffer[index] = decodeAndClamp(buffer[index], decodeAddends[j], decodeCoefficients[j], max);
  43198. index++;
  43199. }
  43200. }
  43201. },
  43202. getComponents: function PDFImage_getComponents(buffer) {
  43203. var bpc = this.bpc;
  43204. if (bpc === 8) {
  43205. return buffer;
  43206. }
  43207. var width = this.width;
  43208. var height = this.height;
  43209. var numComps = this.numComps;
  43210. var length = width * height * numComps;
  43211. var bufferPos = 0;
  43212. var output = bpc <= 8 ? new Uint8Array(length) : bpc <= 16 ? new Uint16Array(length) : new Uint32Array(length);
  43213. var rowComps = width * numComps;
  43214. var max = (1 << bpc) - 1;
  43215. var i = 0, ii, buf;
  43216. if (bpc === 1) {
  43217. var mask, loop1End, loop2End;
  43218. for (var j = 0; j < height; j++) {
  43219. loop1End = i + (rowComps & ~7);
  43220. loop2End = i + rowComps;
  43221. while (i < loop1End) {
  43222. buf = buffer[bufferPos++];
  43223. output[i] = buf >> 7 & 1;
  43224. output[i + 1] = buf >> 6 & 1;
  43225. output[i + 2] = buf >> 5 & 1;
  43226. output[i + 3] = buf >> 4 & 1;
  43227. output[i + 4] = buf >> 3 & 1;
  43228. output[i + 5] = buf >> 2 & 1;
  43229. output[i + 6] = buf >> 1 & 1;
  43230. output[i + 7] = buf & 1;
  43231. i += 8;
  43232. }
  43233. if (i < loop2End) {
  43234. buf = buffer[bufferPos++];
  43235. mask = 128;
  43236. while (i < loop2End) {
  43237. output[i++] = +!!(buf & mask);
  43238. mask >>= 1;
  43239. }
  43240. }
  43241. }
  43242. } else {
  43243. var bits = 0;
  43244. buf = 0;
  43245. for (i = 0, ii = length; i < ii; ++i) {
  43246. if (i % rowComps === 0) {
  43247. buf = 0;
  43248. bits = 0;
  43249. }
  43250. while (bits < bpc) {
  43251. buf = buf << 8 | buffer[bufferPos++];
  43252. bits += 8;
  43253. }
  43254. var remainingBits = bits - bpc;
  43255. var value = buf >> remainingBits;
  43256. output[i] = value < 0 ? 0 : value > max ? max : value;
  43257. buf = buf & (1 << remainingBits) - 1;
  43258. bits = remainingBits;
  43259. }
  43260. }
  43261. return output;
  43262. },
  43263. fillOpacity: function PDFImage_fillOpacity(rgbaBuf, width, height, actualHeight, image) {
  43264. var smask = this.smask;
  43265. var mask = this.mask;
  43266. var alphaBuf, sw, sh, i, ii, j;
  43267. if (smask) {
  43268. sw = smask.width;
  43269. sh = smask.height;
  43270. alphaBuf = new Uint8Array(sw * sh);
  43271. smask.fillGrayBuffer(alphaBuf);
  43272. if (sw !== width || sh !== height) {
  43273. alphaBuf = resizeImageMask(alphaBuf, smask.bpc, sw, sh, width, height);
  43274. }
  43275. } else if (mask) {
  43276. if (mask instanceof PDFImage) {
  43277. sw = mask.width;
  43278. sh = mask.height;
  43279. alphaBuf = new Uint8Array(sw * sh);
  43280. mask.numComps = 1;
  43281. mask.fillGrayBuffer(alphaBuf);
  43282. for (i = 0, ii = sw * sh; i < ii; ++i) {
  43283. alphaBuf[i] = 255 - alphaBuf[i];
  43284. }
  43285. if (sw !== width || sh !== height) {
  43286. alphaBuf = resizeImageMask(alphaBuf, mask.bpc, sw, sh, width, height);
  43287. }
  43288. } else if (isArray(mask)) {
  43289. alphaBuf = new Uint8Array(width * height);
  43290. var numComps = this.numComps;
  43291. for (i = 0, ii = width * height; i < ii; ++i) {
  43292. var opacity = 0;
  43293. var imageOffset = i * numComps;
  43294. for (j = 0; j < numComps; ++j) {
  43295. var color = image[imageOffset + j];
  43296. var maskOffset = j * 2;
  43297. if (color < mask[maskOffset] || color > mask[maskOffset + 1]) {
  43298. opacity = 255;
  43299. break;
  43300. }
  43301. }
  43302. alphaBuf[i] = opacity;
  43303. }
  43304. } else {
  43305. error('Unknown mask format.');
  43306. }
  43307. }
  43308. if (alphaBuf) {
  43309. for (i = 0, j = 3, ii = width * actualHeight; i < ii; ++i, j += 4) {
  43310. rgbaBuf[j] = alphaBuf[i];
  43311. }
  43312. } else {
  43313. for (i = 0, j = 3, ii = width * actualHeight; i < ii; ++i, j += 4) {
  43314. rgbaBuf[j] = 255;
  43315. }
  43316. }
  43317. },
  43318. undoPreblend: function PDFImage_undoPreblend(buffer, width, height) {
  43319. var matte = this.smask && this.smask.matte;
  43320. if (!matte) {
  43321. return;
  43322. }
  43323. var matteRgb = this.colorSpace.getRgb(matte, 0);
  43324. var matteR = matteRgb[0];
  43325. var matteG = matteRgb[1];
  43326. var matteB = matteRgb[2];
  43327. var length = width * height * 4;
  43328. var r, g, b;
  43329. for (var i = 0; i < length; i += 4) {
  43330. var alpha = buffer[i + 3];
  43331. if (alpha === 0) {
  43332. buffer[i] = 255;
  43333. buffer[i + 1] = 255;
  43334. buffer[i + 2] = 255;
  43335. continue;
  43336. }
  43337. var k = 255 / alpha;
  43338. r = (buffer[i] - matteR) * k + matteR;
  43339. g = (buffer[i + 1] - matteG) * k + matteG;
  43340. b = (buffer[i + 2] - matteB) * k + matteB;
  43341. buffer[i] = r <= 0 ? 0 : r >= 255 ? 255 : r | 0;
  43342. buffer[i + 1] = g <= 0 ? 0 : g >= 255 ? 255 : g | 0;
  43343. buffer[i + 2] = b <= 0 ? 0 : b >= 255 ? 255 : b | 0;
  43344. }
  43345. },
  43346. createImageData: function PDFImage_createImageData(forceRGBA) {
  43347. var drawWidth = this.drawWidth;
  43348. var drawHeight = this.drawHeight;
  43349. var imgData = {
  43350. width: drawWidth,
  43351. height: drawHeight
  43352. };
  43353. var numComps = this.numComps;
  43354. var originalWidth = this.width;
  43355. var originalHeight = this.height;
  43356. var bpc = this.bpc;
  43357. var rowBytes = originalWidth * numComps * bpc + 7 >> 3;
  43358. var imgArray;
  43359. if (!forceRGBA) {
  43360. var kind;
  43361. if (this.colorSpace.name === 'DeviceGray' && bpc === 1) {
  43362. kind = ImageKind.GRAYSCALE_1BPP;
  43363. } else if (this.colorSpace.name === 'DeviceRGB' && bpc === 8 && !this.needsDecode) {
  43364. kind = ImageKind.RGB_24BPP;
  43365. }
  43366. if (kind && !this.smask && !this.mask && drawWidth === originalWidth && drawHeight === originalHeight) {
  43367. imgData.kind = kind;
  43368. imgArray = this.getImageBytes(originalHeight * rowBytes);
  43369. if (this.image instanceof DecodeStream) {
  43370. imgData.data = imgArray;
  43371. } else {
  43372. var newArray = new Uint8Array(imgArray.length);
  43373. newArray.set(imgArray);
  43374. imgData.data = newArray;
  43375. }
  43376. if (this.needsDecode) {
  43377. assert(kind === ImageKind.GRAYSCALE_1BPP);
  43378. var buffer = imgData.data;
  43379. for (var i = 0, ii = buffer.length; i < ii; i++) {
  43380. buffer[i] ^= 0xff;
  43381. }
  43382. }
  43383. return imgData;
  43384. }
  43385. if (this.image instanceof JpegStream && !this.smask && !this.mask && (this.colorSpace.name === 'DeviceGray' || this.colorSpace.name === 'DeviceRGB' || this.colorSpace.name === 'DeviceCMYK')) {
  43386. imgData.kind = ImageKind.RGB_24BPP;
  43387. imgData.data = this.getImageBytes(originalHeight * rowBytes, drawWidth, drawHeight, true);
  43388. return imgData;
  43389. }
  43390. }
  43391. imgArray = this.getImageBytes(originalHeight * rowBytes);
  43392. var actualHeight = 0 | imgArray.length / rowBytes * drawHeight / originalHeight;
  43393. var comps = this.getComponents(imgArray);
  43394. var alpha01, maybeUndoPreblend;
  43395. if (!forceRGBA && !this.smask && !this.mask) {
  43396. imgData.kind = ImageKind.RGB_24BPP;
  43397. imgData.data = new Uint8Array(drawWidth * drawHeight * 3);
  43398. alpha01 = 0;
  43399. maybeUndoPreblend = false;
  43400. } else {
  43401. imgData.kind = ImageKind.RGBA_32BPP;
  43402. imgData.data = new Uint8Array(drawWidth * drawHeight * 4);
  43403. alpha01 = 1;
  43404. maybeUndoPreblend = true;
  43405. this.fillOpacity(imgData.data, drawWidth, drawHeight, actualHeight, comps);
  43406. }
  43407. if (this.needsDecode) {
  43408. this.decodeBuffer(comps);
  43409. }
  43410. this.colorSpace.fillRgb(imgData.data, originalWidth, originalHeight, drawWidth, drawHeight, actualHeight, bpc, comps, alpha01);
  43411. if (maybeUndoPreblend) {
  43412. this.undoPreblend(imgData.data, drawWidth, actualHeight);
  43413. }
  43414. return imgData;
  43415. },
  43416. fillGrayBuffer: function PDFImage_fillGrayBuffer(buffer) {
  43417. var numComps = this.numComps;
  43418. if (numComps !== 1) {
  43419. error('Reading gray scale from a color image: ' + numComps);
  43420. }
  43421. var width = this.width;
  43422. var height = this.height;
  43423. var bpc = this.bpc;
  43424. var rowBytes = width * numComps * bpc + 7 >> 3;
  43425. var imgArray = this.getImageBytes(height * rowBytes);
  43426. var comps = this.getComponents(imgArray);
  43427. var i, length;
  43428. if (bpc === 1) {
  43429. length = width * height;
  43430. if (this.needsDecode) {
  43431. for (i = 0; i < length; ++i) {
  43432. buffer[i] = comps[i] - 1 & 255;
  43433. }
  43434. } else {
  43435. for (i = 0; i < length; ++i) {
  43436. buffer[i] = -comps[i] & 255;
  43437. }
  43438. }
  43439. return;
  43440. }
  43441. if (this.needsDecode) {
  43442. this.decodeBuffer(comps);
  43443. }
  43444. length = width * height;
  43445. var scale = 255 / ((1 << bpc) - 1);
  43446. for (i = 0; i < length; ++i) {
  43447. buffer[i] = scale * comps[i] | 0;
  43448. }
  43449. },
  43450. getImageBytes: function PDFImage_getImageBytes(length, drawWidth, drawHeight, forceRGB) {
  43451. this.image.reset();
  43452. this.image.drawWidth = drawWidth || this.width;
  43453. this.image.drawHeight = drawHeight || this.height;
  43454. this.image.forceRGB = !!forceRGB;
  43455. return this.image.getBytes(length);
  43456. }
  43457. };
  43458. return PDFImage;
  43459. }();
  43460. exports.PDFImage = PDFImage;
  43461. /***/ }),
  43462. /* 28 */
  43463. /***/ (function(module, exports, __w_pdfjs_require__) {
  43464. "use strict";
  43465. var sharedUtil = __w_pdfjs_require__(0);
  43466. var coreArithmeticDecoder = __w_pdfjs_require__(9);
  43467. var error = sharedUtil.error;
  43468. var log2 = sharedUtil.log2;
  43469. var readInt8 = sharedUtil.readInt8;
  43470. var readUint16 = sharedUtil.readUint16;
  43471. var readUint32 = sharedUtil.readUint32;
  43472. var shadow = sharedUtil.shadow;
  43473. var ArithmeticDecoder = coreArithmeticDecoder.ArithmeticDecoder;
  43474. var Jbig2Image = function Jbig2ImageClosure() {
  43475. function ContextCache() {
  43476. }
  43477. ContextCache.prototype = {
  43478. getContexts: function (id) {
  43479. if (id in this) {
  43480. return this[id];
  43481. }
  43482. return this[id] = new Int8Array(1 << 16);
  43483. }
  43484. };
  43485. function DecodingContext(data, start, end) {
  43486. this.data = data;
  43487. this.start = start;
  43488. this.end = end;
  43489. }
  43490. DecodingContext.prototype = {
  43491. get decoder() {
  43492. var decoder = new ArithmeticDecoder(this.data, this.start, this.end);
  43493. return shadow(this, 'decoder', decoder);
  43494. },
  43495. get contextCache() {
  43496. var cache = new ContextCache();
  43497. return shadow(this, 'contextCache', cache);
  43498. }
  43499. };
  43500. function decodeInteger(contextCache, procedure, decoder) {
  43501. var contexts = contextCache.getContexts(procedure);
  43502. var prev = 1;
  43503. function readBits(length) {
  43504. var v = 0;
  43505. for (var i = 0; i < length; i++) {
  43506. var bit = decoder.readBit(contexts, prev);
  43507. prev = prev < 256 ? prev << 1 | bit : (prev << 1 | bit) & 511 | 256;
  43508. v = v << 1 | bit;
  43509. }
  43510. return v >>> 0;
  43511. }
  43512. var sign = readBits(1);
  43513. 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);
  43514. return sign === 0 ? value : value > 0 ? -value : null;
  43515. }
  43516. function decodeIAID(contextCache, decoder, codeLength) {
  43517. var contexts = contextCache.getContexts('IAID');
  43518. var prev = 1;
  43519. for (var i = 0; i < codeLength; i++) {
  43520. var bit = decoder.readBit(contexts, prev);
  43521. prev = prev << 1 | bit;
  43522. }
  43523. if (codeLength < 31) {
  43524. return prev & (1 << codeLength) - 1;
  43525. }
  43526. return prev & 0x7FFFFFFF;
  43527. }
  43528. var SegmentTypes = [
  43529. 'SymbolDictionary',
  43530. null,
  43531. null,
  43532. null,
  43533. 'IntermediateTextRegion',
  43534. null,
  43535. 'ImmediateTextRegion',
  43536. 'ImmediateLosslessTextRegion',
  43537. null,
  43538. null,
  43539. null,
  43540. null,
  43541. null,
  43542. null,
  43543. null,
  43544. null,
  43545. 'patternDictionary',
  43546. null,
  43547. null,
  43548. null,
  43549. 'IntermediateHalftoneRegion',
  43550. null,
  43551. 'ImmediateHalftoneRegion',
  43552. 'ImmediateLosslessHalftoneRegion',
  43553. null,
  43554. null,
  43555. null,
  43556. null,
  43557. null,
  43558. null,
  43559. null,
  43560. null,
  43561. null,
  43562. null,
  43563. null,
  43564. null,
  43565. 'IntermediateGenericRegion',
  43566. null,
  43567. 'ImmediateGenericRegion',
  43568. 'ImmediateLosslessGenericRegion',
  43569. 'IntermediateGenericRefinementRegion',
  43570. null,
  43571. 'ImmediateGenericRefinementRegion',
  43572. 'ImmediateLosslessGenericRefinementRegion',
  43573. null,
  43574. null,
  43575. null,
  43576. null,
  43577. 'PageInformation',
  43578. 'EndOfPage',
  43579. 'EndOfStripe',
  43580. 'EndOfFile',
  43581. 'Profiles',
  43582. 'Tables',
  43583. null,
  43584. null,
  43585. null,
  43586. null,
  43587. null,
  43588. null,
  43589. null,
  43590. null,
  43591. 'Extension'
  43592. ];
  43593. var CodingTemplates = [
  43594. [
  43595. {
  43596. x: -1,
  43597. y: -2
  43598. },
  43599. {
  43600. x: 0,
  43601. y: -2
  43602. },
  43603. {
  43604. x: 1,
  43605. y: -2
  43606. },
  43607. {
  43608. x: -2,
  43609. y: -1
  43610. },
  43611. {
  43612. x: -1,
  43613. y: -1
  43614. },
  43615. {
  43616. x: 0,
  43617. y: -1
  43618. },
  43619. {
  43620. x: 1,
  43621. y: -1
  43622. },
  43623. {
  43624. x: 2,
  43625. y: -1
  43626. },
  43627. {
  43628. x: -4,
  43629. y: 0
  43630. },
  43631. {
  43632. x: -3,
  43633. y: 0
  43634. },
  43635. {
  43636. x: -2,
  43637. y: 0
  43638. },
  43639. {
  43640. x: -1,
  43641. y: 0
  43642. }
  43643. ],
  43644. [
  43645. {
  43646. x: -1,
  43647. y: -2
  43648. },
  43649. {
  43650. x: 0,
  43651. y: -2
  43652. },
  43653. {
  43654. x: 1,
  43655. y: -2
  43656. },
  43657. {
  43658. x: 2,
  43659. y: -2
  43660. },
  43661. {
  43662. x: -2,
  43663. y: -1
  43664. },
  43665. {
  43666. x: -1,
  43667. y: -1
  43668. },
  43669. {
  43670. x: 0,
  43671. y: -1
  43672. },
  43673. {
  43674. x: 1,
  43675. y: -1
  43676. },
  43677. {
  43678. x: 2,
  43679. y: -1
  43680. },
  43681. {
  43682. x: -3,
  43683. y: 0
  43684. },
  43685. {
  43686. x: -2,
  43687. y: 0
  43688. },
  43689. {
  43690. x: -1,
  43691. y: 0
  43692. }
  43693. ],
  43694. [
  43695. {
  43696. x: -1,
  43697. y: -2
  43698. },
  43699. {
  43700. x: 0,
  43701. y: -2
  43702. },
  43703. {
  43704. x: 1,
  43705. y: -2
  43706. },
  43707. {
  43708. x: -2,
  43709. y: -1
  43710. },
  43711. {
  43712. x: -1,
  43713. y: -1
  43714. },
  43715. {
  43716. x: 0,
  43717. y: -1
  43718. },
  43719. {
  43720. x: 1,
  43721. y: -1
  43722. },
  43723. {
  43724. x: -2,
  43725. y: 0
  43726. },
  43727. {
  43728. x: -1,
  43729. y: 0
  43730. }
  43731. ],
  43732. [
  43733. {
  43734. x: -3,
  43735. y: -1
  43736. },
  43737. {
  43738. x: -2,
  43739. y: -1
  43740. },
  43741. {
  43742. x: -1,
  43743. y: -1
  43744. },
  43745. {
  43746. x: 0,
  43747. y: -1
  43748. },
  43749. {
  43750. x: 1,
  43751. y: -1
  43752. },
  43753. {
  43754. x: -4,
  43755. y: 0
  43756. },
  43757. {
  43758. x: -3,
  43759. y: 0
  43760. },
  43761. {
  43762. x: -2,
  43763. y: 0
  43764. },
  43765. {
  43766. x: -1,
  43767. y: 0
  43768. }
  43769. ]
  43770. ];
  43771. var RefinementTemplates = [
  43772. {
  43773. coding: [
  43774. {
  43775. x: 0,
  43776. y: -1
  43777. },
  43778. {
  43779. x: 1,
  43780. y: -1
  43781. },
  43782. {
  43783. x: -1,
  43784. y: 0
  43785. }
  43786. ],
  43787. reference: [
  43788. {
  43789. x: 0,
  43790. y: -1
  43791. },
  43792. {
  43793. x: 1,
  43794. y: -1
  43795. },
  43796. {
  43797. x: -1,
  43798. y: 0
  43799. },
  43800. {
  43801. x: 0,
  43802. y: 0
  43803. },
  43804. {
  43805. x: 1,
  43806. y: 0
  43807. },
  43808. {
  43809. x: -1,
  43810. y: 1
  43811. },
  43812. {
  43813. x: 0,
  43814. y: 1
  43815. },
  43816. {
  43817. x: 1,
  43818. y: 1
  43819. }
  43820. ]
  43821. },
  43822. {
  43823. coding: [
  43824. {
  43825. x: -1,
  43826. y: -1
  43827. },
  43828. {
  43829. x: 0,
  43830. y: -1
  43831. },
  43832. {
  43833. x: 1,
  43834. y: -1
  43835. },
  43836. {
  43837. x: -1,
  43838. y: 0
  43839. }
  43840. ],
  43841. reference: [
  43842. {
  43843. x: 0,
  43844. y: -1
  43845. },
  43846. {
  43847. x: -1,
  43848. y: 0
  43849. },
  43850. {
  43851. x: 0,
  43852. y: 0
  43853. },
  43854. {
  43855. x: 1,
  43856. y: 0
  43857. },
  43858. {
  43859. x: 0,
  43860. y: 1
  43861. },
  43862. {
  43863. x: 1,
  43864. y: 1
  43865. }
  43866. ]
  43867. }
  43868. ];
  43869. var ReusedContexts = [
  43870. 0x9B25,
  43871. 0x0795,
  43872. 0x00E5,
  43873. 0x0195
  43874. ];
  43875. var RefinementReusedContexts = [
  43876. 0x0020,
  43877. 0x0008
  43878. ];
  43879. function decodeBitmapTemplate0(width, height, decodingContext) {
  43880. var decoder = decodingContext.decoder;
  43881. var contexts = decodingContext.contextCache.getContexts('GB');
  43882. var contextLabel, i, j, pixel, row, row1, row2, bitmap = [];
  43883. var OLD_PIXEL_MASK = 0x7BF7;
  43884. for (i = 0; i < height; i++) {
  43885. row = bitmap[i] = new Uint8Array(width);
  43886. row1 = i < 1 ? row : bitmap[i - 1];
  43887. row2 = i < 2 ? row : bitmap[i - 2];
  43888. contextLabel = row2[0] << 13 | row2[1] << 12 | row2[2] << 11 | row1[0] << 7 | row1[1] << 6 | row1[2] << 5 | row1[3] << 4;
  43889. for (j = 0; j < width; j++) {
  43890. row[j] = pixel = decoder.readBit(contexts, contextLabel);
  43891. contextLabel = (contextLabel & OLD_PIXEL_MASK) << 1 | (j + 3 < width ? row2[j + 3] << 11 : 0) | (j + 4 < width ? row1[j + 4] << 4 : 0) | pixel;
  43892. }
  43893. }
  43894. return bitmap;
  43895. }
  43896. function decodeBitmap(mmr, width, height, templateIndex, prediction, skip, at, decodingContext) {
  43897. if (mmr) {
  43898. error('JBIG2 error: MMR encoding is not supported');
  43899. }
  43900. 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) {
  43901. return decodeBitmapTemplate0(width, height, decodingContext);
  43902. }
  43903. var useskip = !!skip;
  43904. var template = CodingTemplates[templateIndex].concat(at);
  43905. template.sort(function (a, b) {
  43906. return a.y - b.y || a.x - b.x;
  43907. });
  43908. var templateLength = template.length;
  43909. var templateX = new Int8Array(templateLength);
  43910. var templateY = new Int8Array(templateLength);
  43911. var changingTemplateEntries = [];
  43912. var reuseMask = 0, minX = 0, maxX = 0, minY = 0;
  43913. var c, k;
  43914. for (k = 0; k < templateLength; k++) {
  43915. templateX[k] = template[k].x;
  43916. templateY[k] = template[k].y;
  43917. minX = Math.min(minX, template[k].x);
  43918. maxX = Math.max(maxX, template[k].x);
  43919. minY = Math.min(minY, template[k].y);
  43920. if (k < templateLength - 1 && template[k].y === template[k + 1].y && template[k].x === template[k + 1].x - 1) {
  43921. reuseMask |= 1 << templateLength - 1 - k;
  43922. } else {
  43923. changingTemplateEntries.push(k);
  43924. }
  43925. }
  43926. var changingEntriesLength = changingTemplateEntries.length;
  43927. var changingTemplateX = new Int8Array(changingEntriesLength);
  43928. var changingTemplateY = new Int8Array(changingEntriesLength);
  43929. var changingTemplateBit = new Uint16Array(changingEntriesLength);
  43930. for (c = 0; c < changingEntriesLength; c++) {
  43931. k = changingTemplateEntries[c];
  43932. changingTemplateX[c] = template[k].x;
  43933. changingTemplateY[c] = template[k].y;
  43934. changingTemplateBit[c] = 1 << templateLength - 1 - k;
  43935. }
  43936. var sbb_left = -minX;
  43937. var sbb_top = -minY;
  43938. var sbb_right = width - maxX;
  43939. var pseudoPixelContext = ReusedContexts[templateIndex];
  43940. var row = new Uint8Array(width);
  43941. var bitmap = [];
  43942. var decoder = decodingContext.decoder;
  43943. var contexts = decodingContext.contextCache.getContexts('GB');
  43944. var ltp = 0, j, i0, j0, contextLabel = 0, bit, shift;
  43945. for (var i = 0; i < height; i++) {
  43946. if (prediction) {
  43947. var sltp = decoder.readBit(contexts, pseudoPixelContext);
  43948. ltp ^= sltp;
  43949. if (ltp) {
  43950. bitmap.push(row);
  43951. continue;
  43952. }
  43953. }
  43954. row = new Uint8Array(row);
  43955. bitmap.push(row);
  43956. for (j = 0; j < width; j++) {
  43957. if (useskip && skip[i][j]) {
  43958. row[j] = 0;
  43959. continue;
  43960. }
  43961. if (j >= sbb_left && j < sbb_right && i >= sbb_top) {
  43962. contextLabel = contextLabel << 1 & reuseMask;
  43963. for (k = 0; k < changingEntriesLength; k++) {
  43964. i0 = i + changingTemplateY[k];
  43965. j0 = j + changingTemplateX[k];
  43966. bit = bitmap[i0][j0];
  43967. if (bit) {
  43968. bit = changingTemplateBit[k];
  43969. contextLabel |= bit;
  43970. }
  43971. }
  43972. } else {
  43973. contextLabel = 0;
  43974. shift = templateLength - 1;
  43975. for (k = 0; k < templateLength; k++, shift--) {
  43976. j0 = j + templateX[k];
  43977. if (j0 >= 0 && j0 < width) {
  43978. i0 = i + templateY[k];
  43979. if (i0 >= 0) {
  43980. bit = bitmap[i0][j0];
  43981. if (bit) {
  43982. contextLabel |= bit << shift;
  43983. }
  43984. }
  43985. }
  43986. }
  43987. }
  43988. var pixel = decoder.readBit(contexts, contextLabel);
  43989. row[j] = pixel;
  43990. }
  43991. }
  43992. return bitmap;
  43993. }
  43994. function decodeRefinement(width, height, templateIndex, referenceBitmap, offsetX, offsetY, prediction, at, decodingContext) {
  43995. var codingTemplate = RefinementTemplates[templateIndex].coding;
  43996. if (templateIndex === 0) {
  43997. codingTemplate = codingTemplate.concat([at[0]]);
  43998. }
  43999. var codingTemplateLength = codingTemplate.length;
  44000. var codingTemplateX = new Int32Array(codingTemplateLength);
  44001. var codingTemplateY = new Int32Array(codingTemplateLength);
  44002. var k;
  44003. for (k = 0; k < codingTemplateLength; k++) {
  44004. codingTemplateX[k] = codingTemplate[k].x;
  44005. codingTemplateY[k] = codingTemplate[k].y;
  44006. }
  44007. var referenceTemplate = RefinementTemplates[templateIndex].reference;
  44008. if (templateIndex === 0) {
  44009. referenceTemplate = referenceTemplate.concat([at[1]]);
  44010. }
  44011. var referenceTemplateLength = referenceTemplate.length;
  44012. var referenceTemplateX = new Int32Array(referenceTemplateLength);
  44013. var referenceTemplateY = new Int32Array(referenceTemplateLength);
  44014. for (k = 0; k < referenceTemplateLength; k++) {
  44015. referenceTemplateX[k] = referenceTemplate[k].x;
  44016. referenceTemplateY[k] = referenceTemplate[k].y;
  44017. }
  44018. var referenceWidth = referenceBitmap[0].length;
  44019. var referenceHeight = referenceBitmap.length;
  44020. var pseudoPixelContext = RefinementReusedContexts[templateIndex];
  44021. var bitmap = [];
  44022. var decoder = decodingContext.decoder;
  44023. var contexts = decodingContext.contextCache.getContexts('GR');
  44024. var ltp = 0;
  44025. for (var i = 0; i < height; i++) {
  44026. if (prediction) {
  44027. var sltp = decoder.readBit(contexts, pseudoPixelContext);
  44028. ltp ^= sltp;
  44029. if (ltp) {
  44030. error('JBIG2 error: prediction is not supported');
  44031. }
  44032. }
  44033. var row = new Uint8Array(width);
  44034. bitmap.push(row);
  44035. for (var j = 0; j < width; j++) {
  44036. var i0, j0;
  44037. var contextLabel = 0;
  44038. for (k = 0; k < codingTemplateLength; k++) {
  44039. i0 = i + codingTemplateY[k];
  44040. j0 = j + codingTemplateX[k];
  44041. if (i0 < 0 || j0 < 0 || j0 >= width) {
  44042. contextLabel <<= 1;
  44043. } else {
  44044. contextLabel = contextLabel << 1 | bitmap[i0][j0];
  44045. }
  44046. }
  44047. for (k = 0; k < referenceTemplateLength; k++) {
  44048. i0 = i + referenceTemplateY[k] + offsetY;
  44049. j0 = j + referenceTemplateX[k] + offsetX;
  44050. if (i0 < 0 || i0 >= referenceHeight || j0 < 0 || j0 >= referenceWidth) {
  44051. contextLabel <<= 1;
  44052. } else {
  44053. contextLabel = contextLabel << 1 | referenceBitmap[i0][j0];
  44054. }
  44055. }
  44056. var pixel = decoder.readBit(contexts, contextLabel);
  44057. row[j] = pixel;
  44058. }
  44059. }
  44060. return bitmap;
  44061. }
  44062. function decodeSymbolDictionary(huffman, refinement, symbols, numberOfNewSymbols, numberOfExportedSymbols, huffmanTables, templateIndex, at, refinementTemplateIndex, refinementAt, decodingContext) {
  44063. if (huffman) {
  44064. error('JBIG2 error: huffman is not supported');
  44065. }
  44066. var newSymbols = [];
  44067. var currentHeight = 0;
  44068. var symbolCodeLength = log2(symbols.length + numberOfNewSymbols);
  44069. var decoder = decodingContext.decoder;
  44070. var contextCache = decodingContext.contextCache;
  44071. while (newSymbols.length < numberOfNewSymbols) {
  44072. var deltaHeight = decodeInteger(contextCache, 'IADH', decoder);
  44073. currentHeight += deltaHeight;
  44074. var currentWidth = 0;
  44075. while (true) {
  44076. var deltaWidth = decodeInteger(contextCache, 'IADW', decoder);
  44077. if (deltaWidth === null) {
  44078. break;
  44079. }
  44080. currentWidth += deltaWidth;
  44081. var bitmap;
  44082. if (refinement) {
  44083. var numberOfInstances = decodeInteger(contextCache, 'IAAI', decoder);
  44084. if (numberOfInstances > 1) {
  44085. bitmap = decodeTextRegion(huffman, refinement, currentWidth, currentHeight, 0, numberOfInstances, 1, symbols.concat(newSymbols), symbolCodeLength, 0, 0, 1, 0, huffmanTables, refinementTemplateIndex, refinementAt, decodingContext);
  44086. } else {
  44087. var symbolId = decodeIAID(contextCache, decoder, symbolCodeLength);
  44088. var rdx = decodeInteger(contextCache, 'IARDX', decoder);
  44089. var rdy = decodeInteger(contextCache, 'IARDY', decoder);
  44090. var symbol = symbolId < symbols.length ? symbols[symbolId] : newSymbols[symbolId - symbols.length];
  44091. bitmap = decodeRefinement(currentWidth, currentHeight, refinementTemplateIndex, symbol, rdx, rdy, false, refinementAt, decodingContext);
  44092. }
  44093. } else {
  44094. bitmap = decodeBitmap(false, currentWidth, currentHeight, templateIndex, false, null, at, decodingContext);
  44095. }
  44096. newSymbols.push(bitmap);
  44097. }
  44098. }
  44099. var exportedSymbols = [];
  44100. var flags = [], currentFlag = false;
  44101. var totalSymbolsLength = symbols.length + numberOfNewSymbols;
  44102. while (flags.length < totalSymbolsLength) {
  44103. var runLength = decodeInteger(contextCache, 'IAEX', decoder);
  44104. while (runLength--) {
  44105. flags.push(currentFlag);
  44106. }
  44107. currentFlag = !currentFlag;
  44108. }
  44109. for (var i = 0, ii = symbols.length; i < ii; i++) {
  44110. if (flags[i]) {
  44111. exportedSymbols.push(symbols[i]);
  44112. }
  44113. }
  44114. for (var j = 0; j < numberOfNewSymbols; i++, j++) {
  44115. if (flags[i]) {
  44116. exportedSymbols.push(newSymbols[j]);
  44117. }
  44118. }
  44119. return exportedSymbols;
  44120. }
  44121. function decodeTextRegion(huffman, refinement, width, height, defaultPixelValue, numberOfSymbolInstances, stripSize, inputSymbols, symbolCodeLength, transposed, dsOffset, referenceCorner, combinationOperator, huffmanTables, refinementTemplateIndex, refinementAt, decodingContext) {
  44122. if (huffman) {
  44123. error('JBIG2 error: huffman is not supported');
  44124. }
  44125. var bitmap = [];
  44126. var i, row;
  44127. for (i = 0; i < height; i++) {
  44128. row = new Uint8Array(width);
  44129. if (defaultPixelValue) {
  44130. for (var j = 0; j < width; j++) {
  44131. row[j] = defaultPixelValue;
  44132. }
  44133. }
  44134. bitmap.push(row);
  44135. }
  44136. var decoder = decodingContext.decoder;
  44137. var contextCache = decodingContext.contextCache;
  44138. var stripT = -decodeInteger(contextCache, 'IADT', decoder);
  44139. var firstS = 0;
  44140. i = 0;
  44141. while (i < numberOfSymbolInstances) {
  44142. var deltaT = decodeInteger(contextCache, 'IADT', decoder);
  44143. stripT += deltaT;
  44144. var deltaFirstS = decodeInteger(contextCache, 'IAFS', decoder);
  44145. firstS += deltaFirstS;
  44146. var currentS = firstS;
  44147. do {
  44148. var currentT = stripSize === 1 ? 0 : decodeInteger(contextCache, 'IAIT', decoder);
  44149. var t = stripSize * stripT + currentT;
  44150. var symbolId = decodeIAID(contextCache, decoder, symbolCodeLength);
  44151. var applyRefinement = refinement && decodeInteger(contextCache, 'IARI', decoder);
  44152. var symbolBitmap = inputSymbols[symbolId];
  44153. var symbolWidth = symbolBitmap[0].length;
  44154. var symbolHeight = symbolBitmap.length;
  44155. if (applyRefinement) {
  44156. var rdw = decodeInteger(contextCache, 'IARDW', decoder);
  44157. var rdh = decodeInteger(contextCache, 'IARDH', decoder);
  44158. var rdx = decodeInteger(contextCache, 'IARDX', decoder);
  44159. var rdy = decodeInteger(contextCache, 'IARDY', decoder);
  44160. symbolWidth += rdw;
  44161. symbolHeight += rdh;
  44162. symbolBitmap = decodeRefinement(symbolWidth, symbolHeight, refinementTemplateIndex, symbolBitmap, (rdw >> 1) + rdx, (rdh >> 1) + rdy, false, refinementAt, decodingContext);
  44163. }
  44164. var offsetT = t - (referenceCorner & 1 ? 0 : symbolHeight);
  44165. var offsetS = currentS - (referenceCorner & 2 ? symbolWidth : 0);
  44166. var s2, t2, symbolRow;
  44167. if (transposed) {
  44168. for (s2 = 0; s2 < symbolHeight; s2++) {
  44169. row = bitmap[offsetS + s2];
  44170. if (!row) {
  44171. continue;
  44172. }
  44173. symbolRow = symbolBitmap[s2];
  44174. var maxWidth = Math.min(width - offsetT, symbolWidth);
  44175. switch (combinationOperator) {
  44176. case 0:
  44177. for (t2 = 0; t2 < maxWidth; t2++) {
  44178. row[offsetT + t2] |= symbolRow[t2];
  44179. }
  44180. break;
  44181. case 2:
  44182. for (t2 = 0; t2 < maxWidth; t2++) {
  44183. row[offsetT + t2] ^= symbolRow[t2];
  44184. }
  44185. break;
  44186. default:
  44187. error('JBIG2 error: operator ' + combinationOperator + ' is not supported');
  44188. }
  44189. }
  44190. currentS += symbolHeight - 1;
  44191. } else {
  44192. for (t2 = 0; t2 < symbolHeight; t2++) {
  44193. row = bitmap[offsetT + t2];
  44194. if (!row) {
  44195. continue;
  44196. }
  44197. symbolRow = symbolBitmap[t2];
  44198. switch (combinationOperator) {
  44199. case 0:
  44200. for (s2 = 0; s2 < symbolWidth; s2++) {
  44201. row[offsetS + s2] |= symbolRow[s2];
  44202. }
  44203. break;
  44204. case 2:
  44205. for (s2 = 0; s2 < symbolWidth; s2++) {
  44206. row[offsetS + s2] ^= symbolRow[s2];
  44207. }
  44208. break;
  44209. default:
  44210. error('JBIG2 error: operator ' + combinationOperator + ' is not supported');
  44211. }
  44212. }
  44213. currentS += symbolWidth - 1;
  44214. }
  44215. i++;
  44216. var deltaS = decodeInteger(contextCache, 'IADS', decoder);
  44217. if (deltaS === null) {
  44218. break;
  44219. }
  44220. currentS += deltaS + dsOffset;
  44221. } while (true);
  44222. }
  44223. return bitmap;
  44224. }
  44225. function readSegmentHeader(data, start) {
  44226. var segmentHeader = {};
  44227. segmentHeader.number = readUint32(data, start);
  44228. var flags = data[start + 4];
  44229. var segmentType = flags & 0x3F;
  44230. if (!SegmentTypes[segmentType]) {
  44231. error('JBIG2 error: invalid segment type: ' + segmentType);
  44232. }
  44233. segmentHeader.type = segmentType;
  44234. segmentHeader.typeName = SegmentTypes[segmentType];
  44235. segmentHeader.deferredNonRetain = !!(flags & 0x80);
  44236. var pageAssociationFieldSize = !!(flags & 0x40);
  44237. var referredFlags = data[start + 5];
  44238. var referredToCount = referredFlags >> 5 & 7;
  44239. var retainBits = [referredFlags & 31];
  44240. var position = start + 6;
  44241. if (referredFlags === 7) {
  44242. referredToCount = readUint32(data, position - 1) & 0x1FFFFFFF;
  44243. position += 3;
  44244. var bytes = referredToCount + 7 >> 3;
  44245. retainBits[0] = data[position++];
  44246. while (--bytes > 0) {
  44247. retainBits.push(data[position++]);
  44248. }
  44249. } else if (referredFlags === 5 || referredFlags === 6) {
  44250. error('JBIG2 error: invalid referred-to flags');
  44251. }
  44252. segmentHeader.retainBits = retainBits;
  44253. var referredToSegmentNumberSize = segmentHeader.number <= 256 ? 1 : segmentHeader.number <= 65536 ? 2 : 4;
  44254. var referredTo = [];
  44255. var i, ii;
  44256. for (i = 0; i < referredToCount; i++) {
  44257. var number = referredToSegmentNumberSize === 1 ? data[position] : referredToSegmentNumberSize === 2 ? readUint16(data, position) : readUint32(data, position);
  44258. referredTo.push(number);
  44259. position += referredToSegmentNumberSize;
  44260. }
  44261. segmentHeader.referredTo = referredTo;
  44262. if (!pageAssociationFieldSize) {
  44263. segmentHeader.pageAssociation = data[position++];
  44264. } else {
  44265. segmentHeader.pageAssociation = readUint32(data, position);
  44266. position += 4;
  44267. }
  44268. segmentHeader.length = readUint32(data, position);
  44269. position += 4;
  44270. if (segmentHeader.length === 0xFFFFFFFF) {
  44271. if (segmentType === 38) {
  44272. var genericRegionInfo = readRegionSegmentInformation(data, position);
  44273. var genericRegionSegmentFlags = data[position + RegionSegmentInformationFieldLength];
  44274. var genericRegionMmr = !!(genericRegionSegmentFlags & 1);
  44275. var searchPatternLength = 6;
  44276. var searchPattern = new Uint8Array(searchPatternLength);
  44277. if (!genericRegionMmr) {
  44278. searchPattern[0] = 0xFF;
  44279. searchPattern[1] = 0xAC;
  44280. }
  44281. searchPattern[2] = genericRegionInfo.height >>> 24 & 0xFF;
  44282. searchPattern[3] = genericRegionInfo.height >> 16 & 0xFF;
  44283. searchPattern[4] = genericRegionInfo.height >> 8 & 0xFF;
  44284. searchPattern[5] = genericRegionInfo.height & 0xFF;
  44285. for (i = position, ii = data.length; i < ii; i++) {
  44286. var j = 0;
  44287. while (j < searchPatternLength && searchPattern[j] === data[i + j]) {
  44288. j++;
  44289. }
  44290. if (j === searchPatternLength) {
  44291. segmentHeader.length = i + searchPatternLength;
  44292. break;
  44293. }
  44294. }
  44295. if (segmentHeader.length === 0xFFFFFFFF) {
  44296. error('JBIG2 error: segment end was not found');
  44297. }
  44298. } else {
  44299. error('JBIG2 error: invalid unknown segment length');
  44300. }
  44301. }
  44302. segmentHeader.headerEnd = position;
  44303. return segmentHeader;
  44304. }
  44305. function readSegments(header, data, start, end) {
  44306. var segments = [];
  44307. var position = start;
  44308. while (position < end) {
  44309. var segmentHeader = readSegmentHeader(data, position);
  44310. position = segmentHeader.headerEnd;
  44311. var segment = {
  44312. header: segmentHeader,
  44313. data: data
  44314. };
  44315. if (!header.randomAccess) {
  44316. segment.start = position;
  44317. position += segmentHeader.length;
  44318. segment.end = position;
  44319. }
  44320. segments.push(segment);
  44321. if (segmentHeader.type === 51) {
  44322. break;
  44323. }
  44324. }
  44325. if (header.randomAccess) {
  44326. for (var i = 0, ii = segments.length; i < ii; i++) {
  44327. segments[i].start = position;
  44328. position += segments[i].header.length;
  44329. segments[i].end = position;
  44330. }
  44331. }
  44332. return segments;
  44333. }
  44334. function readRegionSegmentInformation(data, start) {
  44335. return {
  44336. width: readUint32(data, start),
  44337. height: readUint32(data, start + 4),
  44338. x: readUint32(data, start + 8),
  44339. y: readUint32(data, start + 12),
  44340. combinationOperator: data[start + 16] & 7
  44341. };
  44342. }
  44343. var RegionSegmentInformationFieldLength = 17;
  44344. function processSegment(segment, visitor) {
  44345. var header = segment.header;
  44346. var data = segment.data, position = segment.start, end = segment.end;
  44347. var args, at, i, atLength;
  44348. switch (header.type) {
  44349. case 0:
  44350. var dictionary = {};
  44351. var dictionaryFlags = readUint16(data, position);
  44352. dictionary.huffman = !!(dictionaryFlags & 1);
  44353. dictionary.refinement = !!(dictionaryFlags & 2);
  44354. dictionary.huffmanDHSelector = dictionaryFlags >> 2 & 3;
  44355. dictionary.huffmanDWSelector = dictionaryFlags >> 4 & 3;
  44356. dictionary.bitmapSizeSelector = dictionaryFlags >> 6 & 1;
  44357. dictionary.aggregationInstancesSelector = dictionaryFlags >> 7 & 1;
  44358. dictionary.bitmapCodingContextUsed = !!(dictionaryFlags & 256);
  44359. dictionary.bitmapCodingContextRetained = !!(dictionaryFlags & 512);
  44360. dictionary.template = dictionaryFlags >> 10 & 3;
  44361. dictionary.refinementTemplate = dictionaryFlags >> 12 & 1;
  44362. position += 2;
  44363. if (!dictionary.huffman) {
  44364. atLength = dictionary.template === 0 ? 4 : 1;
  44365. at = [];
  44366. for (i = 0; i < atLength; i++) {
  44367. at.push({
  44368. x: readInt8(data, position),
  44369. y: readInt8(data, position + 1)
  44370. });
  44371. position += 2;
  44372. }
  44373. dictionary.at = at;
  44374. }
  44375. if (dictionary.refinement && !dictionary.refinementTemplate) {
  44376. at = [];
  44377. for (i = 0; i < 2; i++) {
  44378. at.push({
  44379. x: readInt8(data, position),
  44380. y: readInt8(data, position + 1)
  44381. });
  44382. position += 2;
  44383. }
  44384. dictionary.refinementAt = at;
  44385. }
  44386. dictionary.numberOfExportedSymbols = readUint32(data, position);
  44387. position += 4;
  44388. dictionary.numberOfNewSymbols = readUint32(data, position);
  44389. position += 4;
  44390. args = [
  44391. dictionary,
  44392. header.number,
  44393. header.referredTo,
  44394. data,
  44395. position,
  44396. end
  44397. ];
  44398. break;
  44399. case 6:
  44400. case 7:
  44401. var textRegion = {};
  44402. textRegion.info = readRegionSegmentInformation(data, position);
  44403. position += RegionSegmentInformationFieldLength;
  44404. var textRegionSegmentFlags = readUint16(data, position);
  44405. position += 2;
  44406. textRegion.huffman = !!(textRegionSegmentFlags & 1);
  44407. textRegion.refinement = !!(textRegionSegmentFlags & 2);
  44408. textRegion.stripSize = 1 << (textRegionSegmentFlags >> 2 & 3);
  44409. textRegion.referenceCorner = textRegionSegmentFlags >> 4 & 3;
  44410. textRegion.transposed = !!(textRegionSegmentFlags & 64);
  44411. textRegion.combinationOperator = textRegionSegmentFlags >> 7 & 3;
  44412. textRegion.defaultPixelValue = textRegionSegmentFlags >> 9 & 1;
  44413. textRegion.dsOffset = textRegionSegmentFlags << 17 >> 27;
  44414. textRegion.refinementTemplate = textRegionSegmentFlags >> 15 & 1;
  44415. if (textRegion.huffman) {
  44416. var textRegionHuffmanFlags = readUint16(data, position);
  44417. position += 2;
  44418. textRegion.huffmanFS = textRegionHuffmanFlags & 3;
  44419. textRegion.huffmanDS = textRegionHuffmanFlags >> 2 & 3;
  44420. textRegion.huffmanDT = textRegionHuffmanFlags >> 4 & 3;
  44421. textRegion.huffmanRefinementDW = textRegionHuffmanFlags >> 6 & 3;
  44422. textRegion.huffmanRefinementDH = textRegionHuffmanFlags >> 8 & 3;
  44423. textRegion.huffmanRefinementDX = textRegionHuffmanFlags >> 10 & 3;
  44424. textRegion.huffmanRefinementDY = textRegionHuffmanFlags >> 12 & 3;
  44425. textRegion.huffmanRefinementSizeSelector = !!(textRegionHuffmanFlags & 14);
  44426. }
  44427. if (textRegion.refinement && !textRegion.refinementTemplate) {
  44428. at = [];
  44429. for (i = 0; i < 2; i++) {
  44430. at.push({
  44431. x: readInt8(data, position),
  44432. y: readInt8(data, position + 1)
  44433. });
  44434. position += 2;
  44435. }
  44436. textRegion.refinementAt = at;
  44437. }
  44438. textRegion.numberOfSymbolInstances = readUint32(data, position);
  44439. position += 4;
  44440. if (textRegion.huffman) {
  44441. error('JBIG2 error: huffman is not supported');
  44442. }
  44443. args = [
  44444. textRegion,
  44445. header.referredTo,
  44446. data,
  44447. position,
  44448. end
  44449. ];
  44450. break;
  44451. case 38:
  44452. case 39:
  44453. var genericRegion = {};
  44454. genericRegion.info = readRegionSegmentInformation(data, position);
  44455. position += RegionSegmentInformationFieldLength;
  44456. var genericRegionSegmentFlags = data[position++];
  44457. genericRegion.mmr = !!(genericRegionSegmentFlags & 1);
  44458. genericRegion.template = genericRegionSegmentFlags >> 1 & 3;
  44459. genericRegion.prediction = !!(genericRegionSegmentFlags & 8);
  44460. if (!genericRegion.mmr) {
  44461. atLength = genericRegion.template === 0 ? 4 : 1;
  44462. at = [];
  44463. for (i = 0; i < atLength; i++) {
  44464. at.push({
  44465. x: readInt8(data, position),
  44466. y: readInt8(data, position + 1)
  44467. });
  44468. position += 2;
  44469. }
  44470. genericRegion.at = at;
  44471. }
  44472. args = [
  44473. genericRegion,
  44474. data,
  44475. position,
  44476. end
  44477. ];
  44478. break;
  44479. case 48:
  44480. var pageInfo = {
  44481. width: readUint32(data, position),
  44482. height: readUint32(data, position + 4),
  44483. resolutionX: readUint32(data, position + 8),
  44484. resolutionY: readUint32(data, position + 12)
  44485. };
  44486. if (pageInfo.height === 0xFFFFFFFF) {
  44487. delete pageInfo.height;
  44488. }
  44489. var pageSegmentFlags = data[position + 16];
  44490. readUint16(data, position + 17);
  44491. pageInfo.lossless = !!(pageSegmentFlags & 1);
  44492. pageInfo.refinement = !!(pageSegmentFlags & 2);
  44493. pageInfo.defaultPixelValue = pageSegmentFlags >> 2 & 1;
  44494. pageInfo.combinationOperator = pageSegmentFlags >> 3 & 3;
  44495. pageInfo.requiresBuffer = !!(pageSegmentFlags & 32);
  44496. pageInfo.combinationOperatorOverride = !!(pageSegmentFlags & 64);
  44497. args = [pageInfo];
  44498. break;
  44499. case 49:
  44500. break;
  44501. case 50:
  44502. break;
  44503. case 51:
  44504. break;
  44505. case 62:
  44506. break;
  44507. default:
  44508. error('JBIG2 error: segment type ' + header.typeName + '(' + header.type + ') is not implemented');
  44509. }
  44510. var callbackName = 'on' + header.typeName;
  44511. if (callbackName in visitor) {
  44512. visitor[callbackName].apply(visitor, args);
  44513. }
  44514. }
  44515. function processSegments(segments, visitor) {
  44516. for (var i = 0, ii = segments.length; i < ii; i++) {
  44517. processSegment(segments[i], visitor);
  44518. }
  44519. }
  44520. function parseJbig2(data, start, end) {
  44521. var position = start;
  44522. 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) {
  44523. error('JBIG2 error: invalid header');
  44524. }
  44525. var header = {};
  44526. position += 8;
  44527. var flags = data[position++];
  44528. header.randomAccess = !(flags & 1);
  44529. if (!(flags & 2)) {
  44530. header.numberOfPages = readUint32(data, position);
  44531. position += 4;
  44532. }
  44533. readSegments(header, data, position, end);
  44534. error('Not implemented');
  44535. }
  44536. function parseJbig2Chunks(chunks) {
  44537. var visitor = new SimpleSegmentVisitor();
  44538. for (var i = 0, ii = chunks.length; i < ii; i++) {
  44539. var chunk = chunks[i];
  44540. var segments = readSegments({}, chunk.data, chunk.start, chunk.end);
  44541. processSegments(segments, visitor);
  44542. }
  44543. return visitor.buffer;
  44544. }
  44545. function SimpleSegmentVisitor() {
  44546. }
  44547. SimpleSegmentVisitor.prototype = {
  44548. onPageInformation: function SimpleSegmentVisitor_onPageInformation(info) {
  44549. this.currentPageInfo = info;
  44550. var rowSize = info.width + 7 >> 3;
  44551. var buffer = new Uint8Array(rowSize * info.height);
  44552. if (info.defaultPixelValue) {
  44553. for (var i = 0, ii = buffer.length; i < ii; i++) {
  44554. buffer[i] = 0xFF;
  44555. }
  44556. }
  44557. this.buffer = buffer;
  44558. },
  44559. drawBitmap: function SimpleSegmentVisitor_drawBitmap(regionInfo, bitmap) {
  44560. var pageInfo = this.currentPageInfo;
  44561. var width = regionInfo.width, height = regionInfo.height;
  44562. var rowSize = pageInfo.width + 7 >> 3;
  44563. var combinationOperator = pageInfo.combinationOperatorOverride ? regionInfo.combinationOperator : pageInfo.combinationOperator;
  44564. var buffer = this.buffer;
  44565. var mask0 = 128 >> (regionInfo.x & 7);
  44566. var offset0 = regionInfo.y * rowSize + (regionInfo.x >> 3);
  44567. var i, j, mask, offset;
  44568. switch (combinationOperator) {
  44569. case 0:
  44570. for (i = 0; i < height; i++) {
  44571. mask = mask0;
  44572. offset = offset0;
  44573. for (j = 0; j < width; j++) {
  44574. if (bitmap[i][j]) {
  44575. buffer[offset] |= mask;
  44576. }
  44577. mask >>= 1;
  44578. if (!mask) {
  44579. mask = 128;
  44580. offset++;
  44581. }
  44582. }
  44583. offset0 += rowSize;
  44584. }
  44585. break;
  44586. case 2:
  44587. for (i = 0; i < height; i++) {
  44588. mask = mask0;
  44589. offset = offset0;
  44590. for (j = 0; j < width; j++) {
  44591. if (bitmap[i][j]) {
  44592. buffer[offset] ^= mask;
  44593. }
  44594. mask >>= 1;
  44595. if (!mask) {
  44596. mask = 128;
  44597. offset++;
  44598. }
  44599. }
  44600. offset0 += rowSize;
  44601. }
  44602. break;
  44603. default:
  44604. error('JBIG2 error: operator ' + combinationOperator + ' is not supported');
  44605. }
  44606. },
  44607. onImmediateGenericRegion: function SimpleSegmentVisitor_onImmediateGenericRegion(region, data, start, end) {
  44608. var regionInfo = region.info;
  44609. var decodingContext = new DecodingContext(data, start, end);
  44610. var bitmap = decodeBitmap(region.mmr, regionInfo.width, regionInfo.height, region.template, region.prediction, null, region.at, decodingContext);
  44611. this.drawBitmap(regionInfo, bitmap);
  44612. },
  44613. onImmediateLosslessGenericRegion: function SimpleSegmentVisitor_onImmediateLosslessGenericRegion() {
  44614. this.onImmediateGenericRegion.apply(this, arguments);
  44615. },
  44616. onSymbolDictionary: function SimpleSegmentVisitor_onSymbolDictionary(dictionary, currentSegment, referredSegments, data, start, end) {
  44617. var huffmanTables;
  44618. if (dictionary.huffman) {
  44619. error('JBIG2 error: huffman is not supported');
  44620. }
  44621. var symbols = this.symbols;
  44622. if (!symbols) {
  44623. this.symbols = symbols = {};
  44624. }
  44625. var inputSymbols = [];
  44626. for (var i = 0, ii = referredSegments.length; i < ii; i++) {
  44627. inputSymbols = inputSymbols.concat(symbols[referredSegments[i]]);
  44628. }
  44629. var decodingContext = new DecodingContext(data, start, end);
  44630. symbols[currentSegment] = decodeSymbolDictionary(dictionary.huffman, dictionary.refinement, inputSymbols, dictionary.numberOfNewSymbols, dictionary.numberOfExportedSymbols, huffmanTables, dictionary.template, dictionary.at, dictionary.refinementTemplate, dictionary.refinementAt, decodingContext);
  44631. },
  44632. onImmediateTextRegion: function SimpleSegmentVisitor_onImmediateTextRegion(region, referredSegments, data, start, end) {
  44633. var regionInfo = region.info;
  44634. var huffmanTables;
  44635. var symbols = this.symbols;
  44636. var inputSymbols = [];
  44637. for (var i = 0, ii = referredSegments.length; i < ii; i++) {
  44638. inputSymbols = inputSymbols.concat(symbols[referredSegments[i]]);
  44639. }
  44640. var symbolCodeLength = log2(inputSymbols.length);
  44641. var decodingContext = new DecodingContext(data, start, end);
  44642. 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);
  44643. this.drawBitmap(regionInfo, bitmap);
  44644. },
  44645. onImmediateLosslessTextRegion: function SimpleSegmentVisitor_onImmediateLosslessTextRegion() {
  44646. this.onImmediateTextRegion.apply(this, arguments);
  44647. }
  44648. };
  44649. function Jbig2Image() {
  44650. }
  44651. Jbig2Image.prototype = {
  44652. parseChunks: function Jbig2Image_parseChunks(chunks) {
  44653. return parseJbig2Chunks(chunks);
  44654. }
  44655. };
  44656. return Jbig2Image;
  44657. }();
  44658. exports.Jbig2Image = Jbig2Image;
  44659. /***/ }),
  44660. /* 29 */
  44661. /***/ (function(module, exports, __w_pdfjs_require__) {
  44662. "use strict";
  44663. var sharedUtil = __w_pdfjs_require__(0);
  44664. var error = sharedUtil.error;
  44665. var JpegImage = function JpegImageClosure() {
  44666. var dctZigZag = new Uint8Array([
  44667. 0,
  44668. 1,
  44669. 8,
  44670. 16,
  44671. 9,
  44672. 2,
  44673. 3,
  44674. 10,
  44675. 17,
  44676. 24,
  44677. 32,
  44678. 25,
  44679. 18,
  44680. 11,
  44681. 4,
  44682. 5,
  44683. 12,
  44684. 19,
  44685. 26,
  44686. 33,
  44687. 40,
  44688. 48,
  44689. 41,
  44690. 34,
  44691. 27,
  44692. 20,
  44693. 13,
  44694. 6,
  44695. 7,
  44696. 14,
  44697. 21,
  44698. 28,
  44699. 35,
  44700. 42,
  44701. 49,
  44702. 56,
  44703. 57,
  44704. 50,
  44705. 43,
  44706. 36,
  44707. 29,
  44708. 22,
  44709. 15,
  44710. 23,
  44711. 30,
  44712. 37,
  44713. 44,
  44714. 51,
  44715. 58,
  44716. 59,
  44717. 52,
  44718. 45,
  44719. 38,
  44720. 31,
  44721. 39,
  44722. 46,
  44723. 53,
  44724. 60,
  44725. 61,
  44726. 54,
  44727. 47,
  44728. 55,
  44729. 62,
  44730. 63
  44731. ]);
  44732. var dctCos1 = 4017;
  44733. var dctSin1 = 799;
  44734. var dctCos3 = 3406;
  44735. var dctSin3 = 2276;
  44736. var dctCos6 = 1567;
  44737. var dctSin6 = 3784;
  44738. var dctSqrt2 = 5793;
  44739. var dctSqrt1d2 = 2896;
  44740. function JpegImage() {
  44741. this.decodeTransform = null;
  44742. this.colorTransform = -1;
  44743. }
  44744. function buildHuffmanTable(codeLengths, values) {
  44745. var k = 0, code = [], i, j, length = 16;
  44746. while (length > 0 && !codeLengths[length - 1]) {
  44747. length--;
  44748. }
  44749. code.push({
  44750. children: [],
  44751. index: 0
  44752. });
  44753. var p = code[0], q;
  44754. for (i = 0; i < length; i++) {
  44755. for (j = 0; j < codeLengths[i]; j++) {
  44756. p = code.pop();
  44757. p.children[p.index] = values[k];
  44758. while (p.index > 0) {
  44759. p = code.pop();
  44760. }
  44761. p.index++;
  44762. code.push(p);
  44763. while (code.length <= i) {
  44764. code.push(q = {
  44765. children: [],
  44766. index: 0
  44767. });
  44768. p.children[p.index] = q.children;
  44769. p = q;
  44770. }
  44771. k++;
  44772. }
  44773. if (i + 1 < length) {
  44774. code.push(q = {
  44775. children: [],
  44776. index: 0
  44777. });
  44778. p.children[p.index] = q.children;
  44779. p = q;
  44780. }
  44781. }
  44782. return code[0].children;
  44783. }
  44784. function getBlockBufferOffset(component, row, col) {
  44785. return 64 * ((component.blocksPerLine + 1) * row + col);
  44786. }
  44787. function decodeScan(data, offset, frame, components, resetInterval, spectralStart, spectralEnd, successivePrev, successive) {
  44788. var mcusPerLine = frame.mcusPerLine;
  44789. var progressive = frame.progressive;
  44790. var startOffset = offset, bitsData = 0, bitsCount = 0;
  44791. function readBit() {
  44792. if (bitsCount > 0) {
  44793. bitsCount--;
  44794. return bitsData >> bitsCount & 1;
  44795. }
  44796. bitsData = data[offset++];
  44797. if (bitsData === 0xFF) {
  44798. var nextByte = data[offset++];
  44799. if (nextByte) {
  44800. error('JPEG error: unexpected marker ' + (bitsData << 8 | nextByte).toString(16));
  44801. }
  44802. }
  44803. bitsCount = 7;
  44804. return bitsData >>> 7;
  44805. }
  44806. function decodeHuffman(tree) {
  44807. var node = tree;
  44808. while (true) {
  44809. node = node[readBit()];
  44810. if (typeof node === 'number') {
  44811. return node;
  44812. }
  44813. if (typeof node !== 'object') {
  44814. error('JPEG error: invalid huffman sequence');
  44815. }
  44816. }
  44817. }
  44818. function receive(length) {
  44819. var n = 0;
  44820. while (length > 0) {
  44821. n = n << 1 | readBit();
  44822. length--;
  44823. }
  44824. return n;
  44825. }
  44826. function receiveAndExtend(length) {
  44827. if (length === 1) {
  44828. return readBit() === 1 ? 1 : -1;
  44829. }
  44830. var n = receive(length);
  44831. if (n >= 1 << length - 1) {
  44832. return n;
  44833. }
  44834. return n + (-1 << length) + 1;
  44835. }
  44836. function decodeBaseline(component, offset) {
  44837. var t = decodeHuffman(component.huffmanTableDC);
  44838. var diff = t === 0 ? 0 : receiveAndExtend(t);
  44839. component.blockData[offset] = component.pred += diff;
  44840. var k = 1;
  44841. while (k < 64) {
  44842. var rs = decodeHuffman(component.huffmanTableAC);
  44843. var s = rs & 15, r = rs >> 4;
  44844. if (s === 0) {
  44845. if (r < 15) {
  44846. break;
  44847. }
  44848. k += 16;
  44849. continue;
  44850. }
  44851. k += r;
  44852. var z = dctZigZag[k];
  44853. component.blockData[offset + z] = receiveAndExtend(s);
  44854. k++;
  44855. }
  44856. }
  44857. function decodeDCFirst(component, offset) {
  44858. var t = decodeHuffman(component.huffmanTableDC);
  44859. var diff = t === 0 ? 0 : receiveAndExtend(t) << successive;
  44860. component.blockData[offset] = component.pred += diff;
  44861. }
  44862. function decodeDCSuccessive(component, offset) {
  44863. component.blockData[offset] |= readBit() << successive;
  44864. }
  44865. var eobrun = 0;
  44866. function decodeACFirst(component, offset) {
  44867. if (eobrun > 0) {
  44868. eobrun--;
  44869. return;
  44870. }
  44871. var k = spectralStart, e = spectralEnd;
  44872. while (k <= e) {
  44873. var rs = decodeHuffman(component.huffmanTableAC);
  44874. var s = rs & 15, r = rs >> 4;
  44875. if (s === 0) {
  44876. if (r < 15) {
  44877. eobrun = receive(r) + (1 << r) - 1;
  44878. break;
  44879. }
  44880. k += 16;
  44881. continue;
  44882. }
  44883. k += r;
  44884. var z = dctZigZag[k];
  44885. component.blockData[offset + z] = receiveAndExtend(s) * (1 << successive);
  44886. k++;
  44887. }
  44888. }
  44889. var successiveACState = 0, successiveACNextValue;
  44890. function decodeACSuccessive(component, offset) {
  44891. var k = spectralStart;
  44892. var e = spectralEnd;
  44893. var r = 0;
  44894. var s;
  44895. var rs;
  44896. while (k <= e) {
  44897. var z = dctZigZag[k];
  44898. switch (successiveACState) {
  44899. case 0:
  44900. rs = decodeHuffman(component.huffmanTableAC);
  44901. s = rs & 15;
  44902. r = rs >> 4;
  44903. if (s === 0) {
  44904. if (r < 15) {
  44905. eobrun = receive(r) + (1 << r);
  44906. successiveACState = 4;
  44907. } else {
  44908. r = 16;
  44909. successiveACState = 1;
  44910. }
  44911. } else {
  44912. if (s !== 1) {
  44913. error('JPEG error: invalid ACn encoding');
  44914. }
  44915. successiveACNextValue = receiveAndExtend(s);
  44916. successiveACState = r ? 2 : 3;
  44917. }
  44918. continue;
  44919. case 1:
  44920. case 2:
  44921. if (component.blockData[offset + z]) {
  44922. component.blockData[offset + z] += readBit() << successive;
  44923. } else {
  44924. r--;
  44925. if (r === 0) {
  44926. successiveACState = successiveACState === 2 ? 3 : 0;
  44927. }
  44928. }
  44929. break;
  44930. case 3:
  44931. if (component.blockData[offset + z]) {
  44932. component.blockData[offset + z] += readBit() << successive;
  44933. } else {
  44934. component.blockData[offset + z] = successiveACNextValue << successive;
  44935. successiveACState = 0;
  44936. }
  44937. break;
  44938. case 4:
  44939. if (component.blockData[offset + z]) {
  44940. component.blockData[offset + z] += readBit() << successive;
  44941. }
  44942. break;
  44943. }
  44944. k++;
  44945. }
  44946. if (successiveACState === 4) {
  44947. eobrun--;
  44948. if (eobrun === 0) {
  44949. successiveACState = 0;
  44950. }
  44951. }
  44952. }
  44953. function decodeMcu(component, decode, mcu, row, col) {
  44954. var mcuRow = mcu / mcusPerLine | 0;
  44955. var mcuCol = mcu % mcusPerLine;
  44956. var blockRow = mcuRow * component.v + row;
  44957. var blockCol = mcuCol * component.h + col;
  44958. var offset = getBlockBufferOffset(component, blockRow, blockCol);
  44959. decode(component, offset);
  44960. }
  44961. function decodeBlock(component, decode, mcu) {
  44962. var blockRow = mcu / component.blocksPerLine | 0;
  44963. var blockCol = mcu % component.blocksPerLine;
  44964. var offset = getBlockBufferOffset(component, blockRow, blockCol);
  44965. decode(component, offset);
  44966. }
  44967. var componentsLength = components.length;
  44968. var component, i, j, k, n;
  44969. var decodeFn;
  44970. if (progressive) {
  44971. if (spectralStart === 0) {
  44972. decodeFn = successivePrev === 0 ? decodeDCFirst : decodeDCSuccessive;
  44973. } else {
  44974. decodeFn = successivePrev === 0 ? decodeACFirst : decodeACSuccessive;
  44975. }
  44976. } else {
  44977. decodeFn = decodeBaseline;
  44978. }
  44979. var mcu = 0, marker;
  44980. var mcuExpected;
  44981. if (componentsLength === 1) {
  44982. mcuExpected = components[0].blocksPerLine * components[0].blocksPerColumn;
  44983. } else {
  44984. mcuExpected = mcusPerLine * frame.mcusPerColumn;
  44985. }
  44986. if (!resetInterval) {
  44987. resetInterval = mcuExpected;
  44988. }
  44989. var h, v;
  44990. while (mcu < mcuExpected) {
  44991. for (i = 0; i < componentsLength; i++) {
  44992. components[i].pred = 0;
  44993. }
  44994. eobrun = 0;
  44995. if (componentsLength === 1) {
  44996. component = components[0];
  44997. for (n = 0; n < resetInterval; n++) {
  44998. decodeBlock(component, decodeFn, mcu);
  44999. mcu++;
  45000. }
  45001. } else {
  45002. for (n = 0; n < resetInterval; n++) {
  45003. for (i = 0; i < componentsLength; i++) {
  45004. component = components[i];
  45005. h = component.h;
  45006. v = component.v;
  45007. for (j = 0; j < v; j++) {
  45008. for (k = 0; k < h; k++) {
  45009. decodeMcu(component, decodeFn, mcu, j, k);
  45010. }
  45011. }
  45012. }
  45013. mcu++;
  45014. }
  45015. }
  45016. bitsCount = 0;
  45017. marker = data[offset] << 8 | data[offset + 1];
  45018. while (data[offset] === 0x00 && offset < data.length - 1) {
  45019. offset++;
  45020. marker = data[offset] << 8 | data[offset + 1];
  45021. }
  45022. if (marker <= 0xFF00) {
  45023. error('JPEG error: marker was not found');
  45024. }
  45025. if (marker >= 0xFFD0 && marker <= 0xFFD7) {
  45026. offset += 2;
  45027. } else {
  45028. break;
  45029. }
  45030. }
  45031. return offset - startOffset;
  45032. }
  45033. function quantizeAndInverse(component, blockBufferOffset, p) {
  45034. var qt = component.quantizationTable, blockData = component.blockData;
  45035. var v0, v1, v2, v3, v4, v5, v6, v7;
  45036. var p0, p1, p2, p3, p4, p5, p6, p7;
  45037. var t;
  45038. if (!qt) {
  45039. error('JPEG error: missing required Quantization Table.');
  45040. }
  45041. for (var row = 0; row < 64; row += 8) {
  45042. p0 = blockData[blockBufferOffset + row];
  45043. p1 = blockData[blockBufferOffset + row + 1];
  45044. p2 = blockData[blockBufferOffset + row + 2];
  45045. p3 = blockData[blockBufferOffset + row + 3];
  45046. p4 = blockData[blockBufferOffset + row + 4];
  45047. p5 = blockData[blockBufferOffset + row + 5];
  45048. p6 = blockData[blockBufferOffset + row + 6];
  45049. p7 = blockData[blockBufferOffset + row + 7];
  45050. p0 *= qt[row];
  45051. if ((p1 | p2 | p3 | p4 | p5 | p6 | p7) === 0) {
  45052. t = dctSqrt2 * p0 + 512 >> 10;
  45053. p[row] = t;
  45054. p[row + 1] = t;
  45055. p[row + 2] = t;
  45056. p[row + 3] = t;
  45057. p[row + 4] = t;
  45058. p[row + 5] = t;
  45059. p[row + 6] = t;
  45060. p[row + 7] = t;
  45061. continue;
  45062. }
  45063. p1 *= qt[row + 1];
  45064. p2 *= qt[row + 2];
  45065. p3 *= qt[row + 3];
  45066. p4 *= qt[row + 4];
  45067. p5 *= qt[row + 5];
  45068. p6 *= qt[row + 6];
  45069. p7 *= qt[row + 7];
  45070. v0 = dctSqrt2 * p0 + 128 >> 8;
  45071. v1 = dctSqrt2 * p4 + 128 >> 8;
  45072. v2 = p2;
  45073. v3 = p6;
  45074. v4 = dctSqrt1d2 * (p1 - p7) + 128 >> 8;
  45075. v7 = dctSqrt1d2 * (p1 + p7) + 128 >> 8;
  45076. v5 = p3 << 4;
  45077. v6 = p5 << 4;
  45078. v0 = v0 + v1 + 1 >> 1;
  45079. v1 = v0 - v1;
  45080. t = v2 * dctSin6 + v3 * dctCos6 + 128 >> 8;
  45081. v2 = v2 * dctCos6 - v3 * dctSin6 + 128 >> 8;
  45082. v3 = t;
  45083. v4 = v4 + v6 + 1 >> 1;
  45084. v6 = v4 - v6;
  45085. v7 = v7 + v5 + 1 >> 1;
  45086. v5 = v7 - v5;
  45087. v0 = v0 + v3 + 1 >> 1;
  45088. v3 = v0 - v3;
  45089. v1 = v1 + v2 + 1 >> 1;
  45090. v2 = v1 - v2;
  45091. t = v4 * dctSin3 + v7 * dctCos3 + 2048 >> 12;
  45092. v4 = v4 * dctCos3 - v7 * dctSin3 + 2048 >> 12;
  45093. v7 = t;
  45094. t = v5 * dctSin1 + v6 * dctCos1 + 2048 >> 12;
  45095. v5 = v5 * dctCos1 - v6 * dctSin1 + 2048 >> 12;
  45096. v6 = t;
  45097. p[row] = v0 + v7;
  45098. p[row + 7] = v0 - v7;
  45099. p[row + 1] = v1 + v6;
  45100. p[row + 6] = v1 - v6;
  45101. p[row + 2] = v2 + v5;
  45102. p[row + 5] = v2 - v5;
  45103. p[row + 3] = v3 + v4;
  45104. p[row + 4] = v3 - v4;
  45105. }
  45106. for (var col = 0; col < 8; ++col) {
  45107. p0 = p[col];
  45108. p1 = p[col + 8];
  45109. p2 = p[col + 16];
  45110. p3 = p[col + 24];
  45111. p4 = p[col + 32];
  45112. p5 = p[col + 40];
  45113. p6 = p[col + 48];
  45114. p7 = p[col + 56];
  45115. if ((p1 | p2 | p3 | p4 | p5 | p6 | p7) === 0) {
  45116. t = dctSqrt2 * p0 + 8192 >> 14;
  45117. t = t < -2040 ? 0 : t >= 2024 ? 255 : t + 2056 >> 4;
  45118. blockData[blockBufferOffset + col] = t;
  45119. blockData[blockBufferOffset + col + 8] = t;
  45120. blockData[blockBufferOffset + col + 16] = t;
  45121. blockData[blockBufferOffset + col + 24] = t;
  45122. blockData[blockBufferOffset + col + 32] = t;
  45123. blockData[blockBufferOffset + col + 40] = t;
  45124. blockData[blockBufferOffset + col + 48] = t;
  45125. blockData[blockBufferOffset + col + 56] = t;
  45126. continue;
  45127. }
  45128. v0 = dctSqrt2 * p0 + 2048 >> 12;
  45129. v1 = dctSqrt2 * p4 + 2048 >> 12;
  45130. v2 = p2;
  45131. v3 = p6;
  45132. v4 = dctSqrt1d2 * (p1 - p7) + 2048 >> 12;
  45133. v7 = dctSqrt1d2 * (p1 + p7) + 2048 >> 12;
  45134. v5 = p3;
  45135. v6 = p5;
  45136. v0 = (v0 + v1 + 1 >> 1) + 4112;
  45137. v1 = v0 - v1;
  45138. t = v2 * dctSin6 + v3 * dctCos6 + 2048 >> 12;
  45139. v2 = v2 * dctCos6 - v3 * dctSin6 + 2048 >> 12;
  45140. v3 = t;
  45141. v4 = v4 + v6 + 1 >> 1;
  45142. v6 = v4 - v6;
  45143. v7 = v7 + v5 + 1 >> 1;
  45144. v5 = v7 - v5;
  45145. v0 = v0 + v3 + 1 >> 1;
  45146. v3 = v0 - v3;
  45147. v1 = v1 + v2 + 1 >> 1;
  45148. v2 = v1 - v2;
  45149. t = v4 * dctSin3 + v7 * dctCos3 + 2048 >> 12;
  45150. v4 = v4 * dctCos3 - v7 * dctSin3 + 2048 >> 12;
  45151. v7 = t;
  45152. t = v5 * dctSin1 + v6 * dctCos1 + 2048 >> 12;
  45153. v5 = v5 * dctCos1 - v6 * dctSin1 + 2048 >> 12;
  45154. v6 = t;
  45155. p0 = v0 + v7;
  45156. p7 = v0 - v7;
  45157. p1 = v1 + v6;
  45158. p6 = v1 - v6;
  45159. p2 = v2 + v5;
  45160. p5 = v2 - v5;
  45161. p3 = v3 + v4;
  45162. p4 = v3 - v4;
  45163. p0 = p0 < 16 ? 0 : p0 >= 4080 ? 255 : p0 >> 4;
  45164. p1 = p1 < 16 ? 0 : p1 >= 4080 ? 255 : p1 >> 4;
  45165. p2 = p2 < 16 ? 0 : p2 >= 4080 ? 255 : p2 >> 4;
  45166. p3 = p3 < 16 ? 0 : p3 >= 4080 ? 255 : p3 >> 4;
  45167. p4 = p4 < 16 ? 0 : p4 >= 4080 ? 255 : p4 >> 4;
  45168. p5 = p5 < 16 ? 0 : p5 >= 4080 ? 255 : p5 >> 4;
  45169. p6 = p6 < 16 ? 0 : p6 >= 4080 ? 255 : p6 >> 4;
  45170. p7 = p7 < 16 ? 0 : p7 >= 4080 ? 255 : p7 >> 4;
  45171. blockData[blockBufferOffset + col] = p0;
  45172. blockData[blockBufferOffset + col + 8] = p1;
  45173. blockData[blockBufferOffset + col + 16] = p2;
  45174. blockData[blockBufferOffset + col + 24] = p3;
  45175. blockData[blockBufferOffset + col + 32] = p4;
  45176. blockData[blockBufferOffset + col + 40] = p5;
  45177. blockData[blockBufferOffset + col + 48] = p6;
  45178. blockData[blockBufferOffset + col + 56] = p7;
  45179. }
  45180. }
  45181. function buildComponentData(frame, component) {
  45182. var blocksPerLine = component.blocksPerLine;
  45183. var blocksPerColumn = component.blocksPerColumn;
  45184. var computationBuffer = new Int16Array(64);
  45185. for (var blockRow = 0; blockRow < blocksPerColumn; blockRow++) {
  45186. for (var blockCol = 0; blockCol < blocksPerLine; blockCol++) {
  45187. var offset = getBlockBufferOffset(component, blockRow, blockCol);
  45188. quantizeAndInverse(component, offset, computationBuffer);
  45189. }
  45190. }
  45191. return component.blockData;
  45192. }
  45193. function clamp0to255(a) {
  45194. return a <= 0 ? 0 : a >= 255 ? 255 : a;
  45195. }
  45196. JpegImage.prototype = {
  45197. parse: function parse(data) {
  45198. function readUint16() {
  45199. var value = data[offset] << 8 | data[offset + 1];
  45200. offset += 2;
  45201. return value;
  45202. }
  45203. function readDataBlock() {
  45204. var length = readUint16();
  45205. var array = data.subarray(offset, offset + length - 2);
  45206. offset += array.length;
  45207. return array;
  45208. }
  45209. function prepareComponents(frame) {
  45210. var mcusPerLine = Math.ceil(frame.samplesPerLine / 8 / frame.maxH);
  45211. var mcusPerColumn = Math.ceil(frame.scanLines / 8 / frame.maxV);
  45212. for (var i = 0; i < frame.components.length; i++) {
  45213. component = frame.components[i];
  45214. var blocksPerLine = Math.ceil(Math.ceil(frame.samplesPerLine / 8) * component.h / frame.maxH);
  45215. var blocksPerColumn = Math.ceil(Math.ceil(frame.scanLines / 8) * component.v / frame.maxV);
  45216. var blocksPerLineForMcu = mcusPerLine * component.h;
  45217. var blocksPerColumnForMcu = mcusPerColumn * component.v;
  45218. var blocksBufferSize = 64 * blocksPerColumnForMcu * (blocksPerLineForMcu + 1);
  45219. component.blockData = new Int16Array(blocksBufferSize);
  45220. component.blocksPerLine = blocksPerLine;
  45221. component.blocksPerColumn = blocksPerColumn;
  45222. }
  45223. frame.mcusPerLine = mcusPerLine;
  45224. frame.mcusPerColumn = mcusPerColumn;
  45225. }
  45226. var offset = 0;
  45227. var jfif = null;
  45228. var adobe = null;
  45229. var frame, resetInterval;
  45230. var quantizationTables = [];
  45231. var huffmanTablesAC = [], huffmanTablesDC = [];
  45232. var fileMarker = readUint16();
  45233. if (fileMarker !== 0xFFD8) {
  45234. error('JPEG error: SOI not found');
  45235. }
  45236. fileMarker = readUint16();
  45237. while (fileMarker !== 0xFFD9) {
  45238. var i, j, l;
  45239. switch (fileMarker) {
  45240. case 0xFFE0:
  45241. case 0xFFE1:
  45242. case 0xFFE2:
  45243. case 0xFFE3:
  45244. case 0xFFE4:
  45245. case 0xFFE5:
  45246. case 0xFFE6:
  45247. case 0xFFE7:
  45248. case 0xFFE8:
  45249. case 0xFFE9:
  45250. case 0xFFEA:
  45251. case 0xFFEB:
  45252. case 0xFFEC:
  45253. case 0xFFED:
  45254. case 0xFFEE:
  45255. case 0xFFEF:
  45256. case 0xFFFE:
  45257. var appData = readDataBlock();
  45258. if (fileMarker === 0xFFE0) {
  45259. if (appData[0] === 0x4A && appData[1] === 0x46 && appData[2] === 0x49 && appData[3] === 0x46 && appData[4] === 0) {
  45260. jfif = {
  45261. version: {
  45262. major: appData[5],
  45263. minor: appData[6]
  45264. },
  45265. densityUnits: appData[7],
  45266. xDensity: appData[8] << 8 | appData[9],
  45267. yDensity: appData[10] << 8 | appData[11],
  45268. thumbWidth: appData[12],
  45269. thumbHeight: appData[13],
  45270. thumbData: appData.subarray(14, 14 + 3 * appData[12] * appData[13])
  45271. };
  45272. }
  45273. }
  45274. if (fileMarker === 0xFFEE) {
  45275. if (appData[0] === 0x41 && appData[1] === 0x64 && appData[2] === 0x6F && appData[3] === 0x62 && appData[4] === 0x65) {
  45276. adobe = {
  45277. version: appData[5] << 8 | appData[6],
  45278. flags0: appData[7] << 8 | appData[8],
  45279. flags1: appData[9] << 8 | appData[10],
  45280. transformCode: appData[11]
  45281. };
  45282. }
  45283. }
  45284. break;
  45285. case 0xFFDB:
  45286. var quantizationTablesLength = readUint16();
  45287. var quantizationTablesEnd = quantizationTablesLength + offset - 2;
  45288. var z;
  45289. while (offset < quantizationTablesEnd) {
  45290. var quantizationTableSpec = data[offset++];
  45291. var tableData = new Uint16Array(64);
  45292. if (quantizationTableSpec >> 4 === 0) {
  45293. for (j = 0; j < 64; j++) {
  45294. z = dctZigZag[j];
  45295. tableData[z] = data[offset++];
  45296. }
  45297. } else if (quantizationTableSpec >> 4 === 1) {
  45298. for (j = 0; j < 64; j++) {
  45299. z = dctZigZag[j];
  45300. tableData[z] = readUint16();
  45301. }
  45302. } else {
  45303. error('JPEG error: DQT - invalid table spec');
  45304. }
  45305. quantizationTables[quantizationTableSpec & 15] = tableData;
  45306. }
  45307. break;
  45308. case 0xFFC0:
  45309. case 0xFFC1:
  45310. case 0xFFC2:
  45311. if (frame) {
  45312. error('JPEG error: Only single frame JPEGs supported');
  45313. }
  45314. readUint16();
  45315. frame = {};
  45316. frame.extended = fileMarker === 0xFFC1;
  45317. frame.progressive = fileMarker === 0xFFC2;
  45318. frame.precision = data[offset++];
  45319. frame.scanLines = readUint16();
  45320. frame.samplesPerLine = readUint16();
  45321. frame.components = [];
  45322. frame.componentIds = {};
  45323. var componentsCount = data[offset++], componentId;
  45324. var maxH = 0, maxV = 0;
  45325. for (i = 0; i < componentsCount; i++) {
  45326. componentId = data[offset];
  45327. var h = data[offset + 1] >> 4;
  45328. var v = data[offset + 1] & 15;
  45329. if (maxH < h) {
  45330. maxH = h;
  45331. }
  45332. if (maxV < v) {
  45333. maxV = v;
  45334. }
  45335. var qId = data[offset + 2];
  45336. l = frame.components.push({
  45337. h: h,
  45338. v: v,
  45339. quantizationId: qId,
  45340. quantizationTable: null
  45341. });
  45342. frame.componentIds[componentId] = l - 1;
  45343. offset += 3;
  45344. }
  45345. frame.maxH = maxH;
  45346. frame.maxV = maxV;
  45347. prepareComponents(frame);
  45348. break;
  45349. case 0xFFC4:
  45350. var huffmanLength = readUint16();
  45351. for (i = 2; i < huffmanLength;) {
  45352. var huffmanTableSpec = data[offset++];
  45353. var codeLengths = new Uint8Array(16);
  45354. var codeLengthSum = 0;
  45355. for (j = 0; j < 16; j++, offset++) {
  45356. codeLengthSum += codeLengths[j] = data[offset];
  45357. }
  45358. var huffmanValues = new Uint8Array(codeLengthSum);
  45359. for (j = 0; j < codeLengthSum; j++, offset++) {
  45360. huffmanValues[j] = data[offset];
  45361. }
  45362. i += 17 + codeLengthSum;
  45363. (huffmanTableSpec >> 4 === 0 ? huffmanTablesDC : huffmanTablesAC)[huffmanTableSpec & 15] = buildHuffmanTable(codeLengths, huffmanValues);
  45364. }
  45365. break;
  45366. case 0xFFDD:
  45367. readUint16();
  45368. resetInterval = readUint16();
  45369. break;
  45370. case 0xFFDA:
  45371. readUint16();
  45372. var selectorsCount = data[offset++];
  45373. var components = [], component;
  45374. for (i = 0; i < selectorsCount; i++) {
  45375. var componentIndex = frame.componentIds[data[offset++]];
  45376. component = frame.components[componentIndex];
  45377. var tableSpec = data[offset++];
  45378. component.huffmanTableDC = huffmanTablesDC[tableSpec >> 4];
  45379. component.huffmanTableAC = huffmanTablesAC[tableSpec & 15];
  45380. components.push(component);
  45381. }
  45382. var spectralStart = data[offset++];
  45383. var spectralEnd = data[offset++];
  45384. var successiveApproximation = data[offset++];
  45385. var processed = decodeScan(data, offset, frame, components, resetInterval, spectralStart, spectralEnd, successiveApproximation >> 4, successiveApproximation & 15);
  45386. offset += processed;
  45387. break;
  45388. case 0xFFFF:
  45389. if (data[offset] !== 0xFF) {
  45390. offset--;
  45391. }
  45392. break;
  45393. default:
  45394. if (data[offset - 3] === 0xFF && data[offset - 2] >= 0xC0 && data[offset - 2] <= 0xFE) {
  45395. offset -= 3;
  45396. break;
  45397. }
  45398. error('JPEG error: unknown marker ' + fileMarker.toString(16));
  45399. }
  45400. fileMarker = readUint16();
  45401. }
  45402. this.width = frame.samplesPerLine;
  45403. this.height = frame.scanLines;
  45404. this.jfif = jfif;
  45405. this.adobe = adobe;
  45406. this.components = [];
  45407. for (i = 0; i < frame.components.length; i++) {
  45408. component = frame.components[i];
  45409. var quantizationTable = quantizationTables[component.quantizationId];
  45410. if (quantizationTable) {
  45411. component.quantizationTable = quantizationTable;
  45412. }
  45413. this.components.push({
  45414. output: buildComponentData(frame, component),
  45415. scaleX: component.h / frame.maxH,
  45416. scaleY: component.v / frame.maxV,
  45417. blocksPerLine: component.blocksPerLine,
  45418. blocksPerColumn: component.blocksPerColumn
  45419. });
  45420. }
  45421. this.numComponents = this.components.length;
  45422. },
  45423. _getLinearizedBlockData: function getLinearizedBlockData(width, height) {
  45424. var scaleX = this.width / width, scaleY = this.height / height;
  45425. var component, componentScaleX, componentScaleY, blocksPerScanline;
  45426. var x, y, i, j, k;
  45427. var index;
  45428. var offset = 0;
  45429. var output;
  45430. var numComponents = this.components.length;
  45431. var dataLength = width * height * numComponents;
  45432. var data = new Uint8Array(dataLength);
  45433. var xScaleBlockOffset = new Uint32Array(width);
  45434. var mask3LSB = 0xfffffff8;
  45435. for (i = 0; i < numComponents; i++) {
  45436. component = this.components[i];
  45437. componentScaleX = component.scaleX * scaleX;
  45438. componentScaleY = component.scaleY * scaleY;
  45439. offset = i;
  45440. output = component.output;
  45441. blocksPerScanline = component.blocksPerLine + 1 << 3;
  45442. for (x = 0; x < width; x++) {
  45443. j = 0 | x * componentScaleX;
  45444. xScaleBlockOffset[x] = (j & mask3LSB) << 3 | j & 7;
  45445. }
  45446. for (y = 0; y < height; y++) {
  45447. j = 0 | y * componentScaleY;
  45448. index = blocksPerScanline * (j & mask3LSB) | (j & 7) << 3;
  45449. for (x = 0; x < width; x++) {
  45450. data[offset] = output[index + xScaleBlockOffset[x]];
  45451. offset += numComponents;
  45452. }
  45453. }
  45454. }
  45455. var transform = this.decodeTransform;
  45456. if (transform) {
  45457. for (i = 0; i < dataLength;) {
  45458. for (j = 0, k = 0; j < numComponents; j++, i++, k += 2) {
  45459. data[i] = (data[i] * transform[k] >> 8) + transform[k + 1];
  45460. }
  45461. }
  45462. }
  45463. return data;
  45464. },
  45465. _isColorConversionNeeded: function isColorConversionNeeded() {
  45466. if (this.adobe && this.adobe.transformCode) {
  45467. return true;
  45468. } else if (this.numComponents === 3) {
  45469. if (!this.adobe && this.colorTransform === 0) {
  45470. return false;
  45471. }
  45472. return true;
  45473. }
  45474. if (!this.adobe && this.colorTransform === 1) {
  45475. return true;
  45476. }
  45477. return false;
  45478. },
  45479. _convertYccToRgb: function convertYccToRgb(data) {
  45480. var Y, Cb, Cr;
  45481. for (var i = 0, length = data.length; i < length; i += 3) {
  45482. Y = data[i];
  45483. Cb = data[i + 1];
  45484. Cr = data[i + 2];
  45485. data[i] = clamp0to255(Y - 179.456 + 1.402 * Cr);
  45486. data[i + 1] = clamp0to255(Y + 135.459 - 0.344 * Cb - 0.714 * Cr);
  45487. data[i + 2] = clamp0to255(Y - 226.816 + 1.772 * Cb);
  45488. }
  45489. return data;
  45490. },
  45491. _convertYcckToRgb: function convertYcckToRgb(data) {
  45492. var Y, Cb, Cr, k;
  45493. var offset = 0;
  45494. for (var i = 0, length = data.length; i < length; i += 4) {
  45495. Y = data[i];
  45496. Cb = data[i + 1];
  45497. Cr = data[i + 2];
  45498. k = data[i + 3];
  45499. var r = -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);
  45500. var g = 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);
  45501. var b = -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);
  45502. data[offset++] = clamp0to255(r);
  45503. data[offset++] = clamp0to255(g);
  45504. data[offset++] = clamp0to255(b);
  45505. }
  45506. return data;
  45507. },
  45508. _convertYcckToCmyk: function convertYcckToCmyk(data) {
  45509. var Y, Cb, Cr;
  45510. for (var i = 0, length = data.length; i < length; i += 4) {
  45511. Y = data[i];
  45512. Cb = data[i + 1];
  45513. Cr = data[i + 2];
  45514. data[i] = clamp0to255(434.456 - Y - 1.402 * Cr);
  45515. data[i + 1] = clamp0to255(119.541 - Y + 0.344 * Cb + 0.714 * Cr);
  45516. data[i + 2] = clamp0to255(481.816 - Y - 1.772 * Cb);
  45517. }
  45518. return data;
  45519. },
  45520. _convertCmykToRgb: function convertCmykToRgb(data) {
  45521. var c, m, y, k;
  45522. var offset = 0;
  45523. var min = -255 * 255 * 255;
  45524. var scale = 1 / 255 / 255;
  45525. for (var i = 0, length = data.length; i < length; i += 4) {
  45526. c = data[i];
  45527. m = data[i + 1];
  45528. y = data[i + 2];
  45529. k = data[i + 3];
  45530. var r = c * (-4.387332384609988 * c + 54.48615194189176 * m + 18.82290502165302 * y + 212.25662451639585 * k - 72734.4411664936) + m * (1.7149763477362134 * m - 5.6096736904047315 * y - 17.873870861415444 * k - 1401.7366389350734) + y * (-2.5217340131683033 * y - 21.248923337353073 * k + 4465.541406466231) - k * (21.86122147463605 * k + 48317.86113160301);
  45531. var g = c * (8.841041422036149 * c + 60.118027045597366 * m + 6.871425592049007 * y + 31.159100130055922 * k - 20220.756542821975) + m * (-15.310361306967817 * m + 17.575251261109482 * y + 131.35250912493976 * k - 48691.05921601825) + y * (4.444339102852739 * y + 9.8632861493405 * k - 6341.191035517494) - k * (20.737325471181034 * k + 47890.15695978492);
  45532. var b = c * (0.8842522430003296 * c + 8.078677503112928 * m + 30.89978309703729 * y - 0.23883238689178934 * k - 3616.812083916688) + m * (10.49593273432072 * m + 63.02378494754052 * y + 50.606957656360734 * k - 28620.90484698408) + y * (0.03296041114873217 * y + 115.60384449646641 * k - 49363.43385999684) - k * (22.33816807309886 * k + 45932.16563550634);
  45533. data[offset++] = r >= 0 ? 255 : r <= min ? 0 : 255 + r * scale | 0;
  45534. data[offset++] = g >= 0 ? 255 : g <= min ? 0 : 255 + g * scale | 0;
  45535. data[offset++] = b >= 0 ? 255 : b <= min ? 0 : 255 + b * scale | 0;
  45536. }
  45537. return data;
  45538. },
  45539. getData: function getData(width, height, forceRGBoutput) {
  45540. if (this.numComponents > 4) {
  45541. error('JPEG error: Unsupported color mode');
  45542. }
  45543. var data = this._getLinearizedBlockData(width, height);
  45544. if (this.numComponents === 1 && forceRGBoutput) {
  45545. var dataLength = data.length;
  45546. var rgbData = new Uint8Array(dataLength * 3);
  45547. var offset = 0;
  45548. for (var i = 0; i < dataLength; i++) {
  45549. var grayColor = data[i];
  45550. rgbData[offset++] = grayColor;
  45551. rgbData[offset++] = grayColor;
  45552. rgbData[offset++] = grayColor;
  45553. }
  45554. return rgbData;
  45555. } else if (this.numComponents === 3 && this._isColorConversionNeeded()) {
  45556. return this._convertYccToRgb(data);
  45557. } else if (this.numComponents === 4) {
  45558. if (this._isColorConversionNeeded()) {
  45559. if (forceRGBoutput) {
  45560. return this._convertYcckToRgb(data);
  45561. }
  45562. return this._convertYcckToCmyk(data);
  45563. } else if (forceRGBoutput) {
  45564. return this._convertCmykToRgb(data);
  45565. }
  45566. }
  45567. return data;
  45568. }
  45569. };
  45570. return JpegImage;
  45571. }();
  45572. exports.JpegImage = JpegImage;
  45573. /***/ }),
  45574. /* 30 */
  45575. /***/ (function(module, exports, __w_pdfjs_require__) {
  45576. "use strict";
  45577. var sharedUtil = __w_pdfjs_require__(0);
  45578. var getLookupTableFactory = sharedUtil.getLookupTableFactory;
  45579. var getMetrics = getLookupTableFactory(function (t) {
  45580. t['Courier'] = 600;
  45581. t['Courier-Bold'] = 600;
  45582. t['Courier-BoldOblique'] = 600;
  45583. t['Courier-Oblique'] = 600;
  45584. t['Helvetica'] = getLookupTableFactory(function (t) {
  45585. t['space'] = 278;
  45586. t['exclam'] = 278;
  45587. t['quotedbl'] = 355;
  45588. t['numbersign'] = 556;
  45589. t['dollar'] = 556;
  45590. t['percent'] = 889;
  45591. t['ampersand'] = 667;
  45592. t['quoteright'] = 222;
  45593. t['parenleft'] = 333;
  45594. t['parenright'] = 333;
  45595. t['asterisk'] = 389;
  45596. t['plus'] = 584;
  45597. t['comma'] = 278;
  45598. t['hyphen'] = 333;
  45599. t['period'] = 278;
  45600. t['slash'] = 278;
  45601. t['zero'] = 556;
  45602. t['one'] = 556;
  45603. t['two'] = 556;
  45604. t['three'] = 556;
  45605. t['four'] = 556;
  45606. t['five'] = 556;
  45607. t['six'] = 556;
  45608. t['seven'] = 556;
  45609. t['eight'] = 556;
  45610. t['nine'] = 556;
  45611. t['colon'] = 278;
  45612. t['semicolon'] = 278;
  45613. t['less'] = 584;
  45614. t['equal'] = 584;
  45615. t['greater'] = 584;
  45616. t['question'] = 556;
  45617. t['at'] = 1015;
  45618. t['A'] = 667;
  45619. t['B'] = 667;
  45620. t['C'] = 722;
  45621. t['D'] = 722;
  45622. t['E'] = 667;
  45623. t['F'] = 611;
  45624. t['G'] = 778;
  45625. t['H'] = 722;
  45626. t['I'] = 278;
  45627. t['J'] = 500;
  45628. t['K'] = 667;
  45629. t['L'] = 556;
  45630. t['M'] = 833;
  45631. t['N'] = 722;
  45632. t['O'] = 778;
  45633. t['P'] = 667;
  45634. t['Q'] = 778;
  45635. t['R'] = 722;
  45636. t['S'] = 667;
  45637. t['T'] = 611;
  45638. t['U'] = 722;
  45639. t['V'] = 667;
  45640. t['W'] = 944;
  45641. t['X'] = 667;
  45642. t['Y'] = 667;
  45643. t['Z'] = 611;
  45644. t['bracketleft'] = 278;
  45645. t['backslash'] = 278;
  45646. t['bracketright'] = 278;
  45647. t['asciicircum'] = 469;
  45648. t['underscore'] = 556;
  45649. t['quoteleft'] = 222;
  45650. t['a'] = 556;
  45651. t['b'] = 556;
  45652. t['c'] = 500;
  45653. t['d'] = 556;
  45654. t['e'] = 556;
  45655. t['f'] = 278;
  45656. t['g'] = 556;
  45657. t['h'] = 556;
  45658. t['i'] = 222;
  45659. t['j'] = 222;
  45660. t['k'] = 500;
  45661. t['l'] = 222;
  45662. t['m'] = 833;
  45663. t['n'] = 556;
  45664. t['o'] = 556;
  45665. t['p'] = 556;
  45666. t['q'] = 556;
  45667. t['r'] = 333;
  45668. t['s'] = 500;
  45669. t['t'] = 278;
  45670. t['u'] = 556;
  45671. t['v'] = 500;
  45672. t['w'] = 722;
  45673. t['x'] = 500;
  45674. t['y'] = 500;
  45675. t['z'] = 500;
  45676. t['braceleft'] = 334;
  45677. t['bar'] = 260;
  45678. t['braceright'] = 334;
  45679. t['asciitilde'] = 584;
  45680. t['exclamdown'] = 333;
  45681. t['cent'] = 556;
  45682. t['sterling'] = 556;
  45683. t['fraction'] = 167;
  45684. t['yen'] = 556;
  45685. t['florin'] = 556;
  45686. t['section'] = 556;
  45687. t['currency'] = 556;
  45688. t['quotesingle'] = 191;
  45689. t['quotedblleft'] = 333;
  45690. t['guillemotleft'] = 556;
  45691. t['guilsinglleft'] = 333;
  45692. t['guilsinglright'] = 333;
  45693. t['fi'] = 500;
  45694. t['fl'] = 500;
  45695. t['endash'] = 556;
  45696. t['dagger'] = 556;
  45697. t['daggerdbl'] = 556;
  45698. t['periodcentered'] = 278;
  45699. t['paragraph'] = 537;
  45700. t['bullet'] = 350;
  45701. t['quotesinglbase'] = 222;
  45702. t['quotedblbase'] = 333;
  45703. t['quotedblright'] = 333;
  45704. t['guillemotright'] = 556;
  45705. t['ellipsis'] = 1000;
  45706. t['perthousand'] = 1000;
  45707. t['questiondown'] = 611;
  45708. t['grave'] = 333;
  45709. t['acute'] = 333;
  45710. t['circumflex'] = 333;
  45711. t['tilde'] = 333;
  45712. t['macron'] = 333;
  45713. t['breve'] = 333;
  45714. t['dotaccent'] = 333;
  45715. t['dieresis'] = 333;
  45716. t['ring'] = 333;
  45717. t['cedilla'] = 333;
  45718. t['hungarumlaut'] = 333;
  45719. t['ogonek'] = 333;
  45720. t['caron'] = 333;
  45721. t['emdash'] = 1000;
  45722. t['AE'] = 1000;
  45723. t['ordfeminine'] = 370;
  45724. t['Lslash'] = 556;
  45725. t['Oslash'] = 778;
  45726. t['OE'] = 1000;
  45727. t['ordmasculine'] = 365;
  45728. t['ae'] = 889;
  45729. t['dotlessi'] = 278;
  45730. t['lslash'] = 222;
  45731. t['oslash'] = 611;
  45732. t['oe'] = 944;
  45733. t['germandbls'] = 611;
  45734. t['Idieresis'] = 278;
  45735. t['eacute'] = 556;
  45736. t['abreve'] = 556;
  45737. t['uhungarumlaut'] = 556;
  45738. t['ecaron'] = 556;
  45739. t['Ydieresis'] = 667;
  45740. t['divide'] = 584;
  45741. t['Yacute'] = 667;
  45742. t['Acircumflex'] = 667;
  45743. t['aacute'] = 556;
  45744. t['Ucircumflex'] = 722;
  45745. t['yacute'] = 500;
  45746. t['scommaaccent'] = 500;
  45747. t['ecircumflex'] = 556;
  45748. t['Uring'] = 722;
  45749. t['Udieresis'] = 722;
  45750. t['aogonek'] = 556;
  45751. t['Uacute'] = 722;
  45752. t['uogonek'] = 556;
  45753. t['Edieresis'] = 667;
  45754. t['Dcroat'] = 722;
  45755. t['commaaccent'] = 250;
  45756. t['copyright'] = 737;
  45757. t['Emacron'] = 667;
  45758. t['ccaron'] = 500;
  45759. t['aring'] = 556;
  45760. t['Ncommaaccent'] = 722;
  45761. t['lacute'] = 222;
  45762. t['agrave'] = 556;
  45763. t['Tcommaaccent'] = 611;
  45764. t['Cacute'] = 722;
  45765. t['atilde'] = 556;
  45766. t['Edotaccent'] = 667;
  45767. t['scaron'] = 500;
  45768. t['scedilla'] = 500;
  45769. t['iacute'] = 278;
  45770. t['lozenge'] = 471;
  45771. t['Rcaron'] = 722;
  45772. t['Gcommaaccent'] = 778;
  45773. t['ucircumflex'] = 556;
  45774. t['acircumflex'] = 556;
  45775. t['Amacron'] = 667;
  45776. t['rcaron'] = 333;
  45777. t['ccedilla'] = 500;
  45778. t['Zdotaccent'] = 611;
  45779. t['Thorn'] = 667;
  45780. t['Omacron'] = 778;
  45781. t['Racute'] = 722;
  45782. t['Sacute'] = 667;
  45783. t['dcaron'] = 643;
  45784. t['Umacron'] = 722;
  45785. t['uring'] = 556;
  45786. t['threesuperior'] = 333;
  45787. t['Ograve'] = 778;
  45788. t['Agrave'] = 667;
  45789. t['Abreve'] = 667;
  45790. t['multiply'] = 584;
  45791. t['uacute'] = 556;
  45792. t['Tcaron'] = 611;
  45793. t['partialdiff'] = 476;
  45794. t['ydieresis'] = 500;
  45795. t['Nacute'] = 722;
  45796. t['icircumflex'] = 278;
  45797. t['Ecircumflex'] = 667;
  45798. t['adieresis'] = 556;
  45799. t['edieresis'] = 556;
  45800. t['cacute'] = 500;
  45801. t['nacute'] = 556;
  45802. t['umacron'] = 556;
  45803. t['Ncaron'] = 722;
  45804. t['Iacute'] = 278;
  45805. t['plusminus'] = 584;
  45806. t['brokenbar'] = 260;
  45807. t['registered'] = 737;
  45808. t['Gbreve'] = 778;
  45809. t['Idotaccent'] = 278;
  45810. t['summation'] = 600;
  45811. t['Egrave'] = 667;
  45812. t['racute'] = 333;
  45813. t['omacron'] = 556;
  45814. t['Zacute'] = 611;
  45815. t['Zcaron'] = 611;
  45816. t['greaterequal'] = 549;
  45817. t['Eth'] = 722;
  45818. t['Ccedilla'] = 722;
  45819. t['lcommaaccent'] = 222;
  45820. t['tcaron'] = 317;
  45821. t['eogonek'] = 556;
  45822. t['Uogonek'] = 722;
  45823. t['Aacute'] = 667;
  45824. t['Adieresis'] = 667;
  45825. t['egrave'] = 556;
  45826. t['zacute'] = 500;
  45827. t['iogonek'] = 222;
  45828. t['Oacute'] = 778;
  45829. t['oacute'] = 556;
  45830. t['amacron'] = 556;
  45831. t['sacute'] = 500;
  45832. t['idieresis'] = 278;
  45833. t['Ocircumflex'] = 778;
  45834. t['Ugrave'] = 722;
  45835. t['Delta'] = 612;
  45836. t['thorn'] = 556;
  45837. t['twosuperior'] = 333;
  45838. t['Odieresis'] = 778;
  45839. t['mu'] = 556;
  45840. t['igrave'] = 278;
  45841. t['ohungarumlaut'] = 556;
  45842. t['Eogonek'] = 667;
  45843. t['dcroat'] = 556;
  45844. t['threequarters'] = 834;
  45845. t['Scedilla'] = 667;
  45846. t['lcaron'] = 299;
  45847. t['Kcommaaccent'] = 667;
  45848. t['Lacute'] = 556;
  45849. t['trademark'] = 1000;
  45850. t['edotaccent'] = 556;
  45851. t['Igrave'] = 278;
  45852. t['Imacron'] = 278;
  45853. t['Lcaron'] = 556;
  45854. t['onehalf'] = 834;
  45855. t['lessequal'] = 549;
  45856. t['ocircumflex'] = 556;
  45857. t['ntilde'] = 556;
  45858. t['Uhungarumlaut'] = 722;
  45859. t['Eacute'] = 667;
  45860. t['emacron'] = 556;
  45861. t['gbreve'] = 556;
  45862. t['onequarter'] = 834;
  45863. t['Scaron'] = 667;
  45864. t['Scommaaccent'] = 667;
  45865. t['Ohungarumlaut'] = 778;
  45866. t['degree'] = 400;
  45867. t['ograve'] = 556;
  45868. t['Ccaron'] = 722;
  45869. t['ugrave'] = 556;
  45870. t['radical'] = 453;
  45871. t['Dcaron'] = 722;
  45872. t['rcommaaccent'] = 333;
  45873. t['Ntilde'] = 722;
  45874. t['otilde'] = 556;
  45875. t['Rcommaaccent'] = 722;
  45876. t['Lcommaaccent'] = 556;
  45877. t['Atilde'] = 667;
  45878. t['Aogonek'] = 667;
  45879. t['Aring'] = 667;
  45880. t['Otilde'] = 778;
  45881. t['zdotaccent'] = 500;
  45882. t['Ecaron'] = 667;
  45883. t['Iogonek'] = 278;
  45884. t['kcommaaccent'] = 500;
  45885. t['minus'] = 584;
  45886. t['Icircumflex'] = 278;
  45887. t['ncaron'] = 556;
  45888. t['tcommaaccent'] = 278;
  45889. t['logicalnot'] = 584;
  45890. t['odieresis'] = 556;
  45891. t['udieresis'] = 556;
  45892. t['notequal'] = 549;
  45893. t['gcommaaccent'] = 556;
  45894. t['eth'] = 556;
  45895. t['zcaron'] = 500;
  45896. t['ncommaaccent'] = 556;
  45897. t['onesuperior'] = 333;
  45898. t['imacron'] = 278;
  45899. t['Euro'] = 556;
  45900. });
  45901. t['Helvetica-Bold'] = getLookupTableFactory(function (t) {
  45902. t['space'] = 278;
  45903. t['exclam'] = 333;
  45904. t['quotedbl'] = 474;
  45905. t['numbersign'] = 556;
  45906. t['dollar'] = 556;
  45907. t['percent'] = 889;
  45908. t['ampersand'] = 722;
  45909. t['quoteright'] = 278;
  45910. t['parenleft'] = 333;
  45911. t['parenright'] = 333;
  45912. t['asterisk'] = 389;
  45913. t['plus'] = 584;
  45914. t['comma'] = 278;
  45915. t['hyphen'] = 333;
  45916. t['period'] = 278;
  45917. t['slash'] = 278;
  45918. t['zero'] = 556;
  45919. t['one'] = 556;
  45920. t['two'] = 556;
  45921. t['three'] = 556;
  45922. t['four'] = 556;
  45923. t['five'] = 556;
  45924. t['six'] = 556;
  45925. t['seven'] = 556;
  45926. t['eight'] = 556;
  45927. t['nine'] = 556;
  45928. t['colon'] = 333;
  45929. t['semicolon'] = 333;
  45930. t['less'] = 584;
  45931. t['equal'] = 584;
  45932. t['greater'] = 584;
  45933. t['question'] = 611;
  45934. t['at'] = 975;
  45935. t['A'] = 722;
  45936. t['B'] = 722;
  45937. t['C'] = 722;
  45938. t['D'] = 722;
  45939. t['E'] = 667;
  45940. t['F'] = 611;
  45941. t['G'] = 778;
  45942. t['H'] = 722;
  45943. t['I'] = 278;
  45944. t['J'] = 556;
  45945. t['K'] = 722;
  45946. t['L'] = 611;
  45947. t['M'] = 833;
  45948. t['N'] = 722;
  45949. t['O'] = 778;
  45950. t['P'] = 667;
  45951. t['Q'] = 778;
  45952. t['R'] = 722;
  45953. t['S'] = 667;
  45954. t['T'] = 611;
  45955. t['U'] = 722;
  45956. t['V'] = 667;
  45957. t['W'] = 944;
  45958. t['X'] = 667;
  45959. t['Y'] = 667;
  45960. t['Z'] = 611;
  45961. t['bracketleft'] = 333;
  45962. t['backslash'] = 278;
  45963. t['bracketright'] = 333;
  45964. t['asciicircum'] = 584;
  45965. t['underscore'] = 556;
  45966. t['quoteleft'] = 278;
  45967. t['a'] = 556;
  45968. t['b'] = 611;
  45969. t['c'] = 556;
  45970. t['d'] = 611;
  45971. t['e'] = 556;
  45972. t['f'] = 333;
  45973. t['g'] = 611;
  45974. t['h'] = 611;
  45975. t['i'] = 278;
  45976. t['j'] = 278;
  45977. t['k'] = 556;
  45978. t['l'] = 278;
  45979. t['m'] = 889;
  45980. t['n'] = 611;
  45981. t['o'] = 611;
  45982. t['p'] = 611;
  45983. t['q'] = 611;
  45984. t['r'] = 389;
  45985. t['s'] = 556;
  45986. t['t'] = 333;
  45987. t['u'] = 611;
  45988. t['v'] = 556;
  45989. t['w'] = 778;
  45990. t['x'] = 556;
  45991. t['y'] = 556;
  45992. t['z'] = 500;
  45993. t['braceleft'] = 389;
  45994. t['bar'] = 280;
  45995. t['braceright'] = 389;
  45996. t['asciitilde'] = 584;
  45997. t['exclamdown'] = 333;
  45998. t['cent'] = 556;
  45999. t['sterling'] = 556;
  46000. t['fraction'] = 167;
  46001. t['yen'] = 556;
  46002. t['florin'] = 556;
  46003. t['section'] = 556;
  46004. t['currency'] = 556;
  46005. t['quotesingle'] = 238;
  46006. t['quotedblleft'] = 500;
  46007. t['guillemotleft'] = 556;
  46008. t['guilsinglleft'] = 333;
  46009. t['guilsinglright'] = 333;
  46010. t['fi'] = 611;
  46011. t['fl'] = 611;
  46012. t['endash'] = 556;
  46013. t['dagger'] = 556;
  46014. t['daggerdbl'] = 556;
  46015. t['periodcentered'] = 278;
  46016. t['paragraph'] = 556;
  46017. t['bullet'] = 350;
  46018. t['quotesinglbase'] = 278;
  46019. t['quotedblbase'] = 500;
  46020. t['quotedblright'] = 500;
  46021. t['guillemotright'] = 556;
  46022. t['ellipsis'] = 1000;
  46023. t['perthousand'] = 1000;
  46024. t['questiondown'] = 611;
  46025. t['grave'] = 333;
  46026. t['acute'] = 333;
  46027. t['circumflex'] = 333;
  46028. t['tilde'] = 333;
  46029. t['macron'] = 333;
  46030. t['breve'] = 333;
  46031. t['dotaccent'] = 333;
  46032. t['dieresis'] = 333;
  46033. t['ring'] = 333;
  46034. t['cedilla'] = 333;
  46035. t['hungarumlaut'] = 333;
  46036. t['ogonek'] = 333;
  46037. t['caron'] = 333;
  46038. t['emdash'] = 1000;
  46039. t['AE'] = 1000;
  46040. t['ordfeminine'] = 370;
  46041. t['Lslash'] = 611;
  46042. t['Oslash'] = 778;
  46043. t['OE'] = 1000;
  46044. t['ordmasculine'] = 365;
  46045. t['ae'] = 889;
  46046. t['dotlessi'] = 278;
  46047. t['lslash'] = 278;
  46048. t['oslash'] = 611;
  46049. t['oe'] = 944;
  46050. t['germandbls'] = 611;
  46051. t['Idieresis'] = 278;
  46052. t['eacute'] = 556;
  46053. t['abreve'] = 556;
  46054. t['uhungarumlaut'] = 611;
  46055. t['ecaron'] = 556;
  46056. t['Ydieresis'] = 667;
  46057. t['divide'] = 584;
  46058. t['Yacute'] = 667;
  46059. t['Acircumflex'] = 722;
  46060. t['aacute'] = 556;
  46061. t['Ucircumflex'] = 722;
  46062. t['yacute'] = 556;
  46063. t['scommaaccent'] = 556;
  46064. t['ecircumflex'] = 556;
  46065. t['Uring'] = 722;
  46066. t['Udieresis'] = 722;
  46067. t['aogonek'] = 556;
  46068. t['Uacute'] = 722;
  46069. t['uogonek'] = 611;
  46070. t['Edieresis'] = 667;
  46071. t['Dcroat'] = 722;
  46072. t['commaaccent'] = 250;
  46073. t['copyright'] = 737;
  46074. t['Emacron'] = 667;
  46075. t['ccaron'] = 556;
  46076. t['aring'] = 556;
  46077. t['Ncommaaccent'] = 722;
  46078. t['lacute'] = 278;
  46079. t['agrave'] = 556;
  46080. t['Tcommaaccent'] = 611;
  46081. t['Cacute'] = 722;
  46082. t['atilde'] = 556;
  46083. t['Edotaccent'] = 667;
  46084. t['scaron'] = 556;
  46085. t['scedilla'] = 556;
  46086. t['iacute'] = 278;
  46087. t['lozenge'] = 494;
  46088. t['Rcaron'] = 722;
  46089. t['Gcommaaccent'] = 778;
  46090. t['ucircumflex'] = 611;
  46091. t['acircumflex'] = 556;
  46092. t['Amacron'] = 722;
  46093. t['rcaron'] = 389;
  46094. t['ccedilla'] = 556;
  46095. t['Zdotaccent'] = 611;
  46096. t['Thorn'] = 667;
  46097. t['Omacron'] = 778;
  46098. t['Racute'] = 722;
  46099. t['Sacute'] = 667;
  46100. t['dcaron'] = 743;
  46101. t['Umacron'] = 722;
  46102. t['uring'] = 611;
  46103. t['threesuperior'] = 333;
  46104. t['Ograve'] = 778;
  46105. t['Agrave'] = 722;
  46106. t['Abreve'] = 722;
  46107. t['multiply'] = 584;
  46108. t['uacute'] = 611;
  46109. t['Tcaron'] = 611;
  46110. t['partialdiff'] = 494;
  46111. t['ydieresis'] = 556;
  46112. t['Nacute'] = 722;
  46113. t['icircumflex'] = 278;
  46114. t['Ecircumflex'] = 667;
  46115. t['adieresis'] = 556;
  46116. t['edieresis'] = 556;
  46117. t['cacute'] = 556;
  46118. t['nacute'] = 611;
  46119. t['umacron'] = 611;
  46120. t['Ncaron'] = 722;
  46121. t['Iacute'] = 278;
  46122. t['plusminus'] = 584;
  46123. t['brokenbar'] = 280;
  46124. t['registered'] = 737;
  46125. t['Gbreve'] = 778;
  46126. t['Idotaccent'] = 278;
  46127. t['summation'] = 600;
  46128. t['Egrave'] = 667;
  46129. t['racute'] = 389;
  46130. t['omacron'] = 611;
  46131. t['Zacute'] = 611;
  46132. t['Zcaron'] = 611;
  46133. t['greaterequal'] = 549;
  46134. t['Eth'] = 722;
  46135. t['Ccedilla'] = 722;
  46136. t['lcommaaccent'] = 278;
  46137. t['tcaron'] = 389;
  46138. t['eogonek'] = 556;
  46139. t['Uogonek'] = 722;
  46140. t['Aacute'] = 722;
  46141. t['Adieresis'] = 722;
  46142. t['egrave'] = 556;
  46143. t['zacute'] = 500;
  46144. t['iogonek'] = 278;
  46145. t['Oacute'] = 778;
  46146. t['oacute'] = 611;
  46147. t['amacron'] = 556;
  46148. t['sacute'] = 556;
  46149. t['idieresis'] = 278;
  46150. t['Ocircumflex'] = 778;
  46151. t['Ugrave'] = 722;
  46152. t['Delta'] = 612;
  46153. t['thorn'] = 611;
  46154. t['twosuperior'] = 333;
  46155. t['Odieresis'] = 778;
  46156. t['mu'] = 611;
  46157. t['igrave'] = 278;
  46158. t['ohungarumlaut'] = 611;
  46159. t['Eogonek'] = 667;
  46160. t['dcroat'] = 611;
  46161. t['threequarters'] = 834;
  46162. t['Scedilla'] = 667;
  46163. t['lcaron'] = 400;
  46164. t['Kcommaaccent'] = 722;
  46165. t['Lacute'] = 611;
  46166. t['trademark'] = 1000;
  46167. t['edotaccent'] = 556;
  46168. t['Igrave'] = 278;
  46169. t['Imacron'] = 278;
  46170. t['Lcaron'] = 611;
  46171. t['onehalf'] = 834;
  46172. t['lessequal'] = 549;
  46173. t['ocircumflex'] = 611;
  46174. t['ntilde'] = 611;
  46175. t['Uhungarumlaut'] = 722;
  46176. t['Eacute'] = 667;
  46177. t['emacron'] = 556;
  46178. t['gbreve'] = 611;
  46179. t['onequarter'] = 834;
  46180. t['Scaron'] = 667;
  46181. t['Scommaaccent'] = 667;
  46182. t['Ohungarumlaut'] = 778;
  46183. t['degree'] = 400;
  46184. t['ograve'] = 611;
  46185. t['Ccaron'] = 722;
  46186. t['ugrave'] = 611;
  46187. t['radical'] = 549;
  46188. t['Dcaron'] = 722;
  46189. t['rcommaaccent'] = 389;
  46190. t['Ntilde'] = 722;
  46191. t['otilde'] = 611;
  46192. t['Rcommaaccent'] = 722;
  46193. t['Lcommaaccent'] = 611;
  46194. t['Atilde'] = 722;
  46195. t['Aogonek'] = 722;
  46196. t['Aring'] = 722;
  46197. t['Otilde'] = 778;
  46198. t['zdotaccent'] = 500;
  46199. t['Ecaron'] = 667;
  46200. t['Iogonek'] = 278;
  46201. t['kcommaaccent'] = 556;
  46202. t['minus'] = 584;
  46203. t['Icircumflex'] = 278;
  46204. t['ncaron'] = 611;
  46205. t['tcommaaccent'] = 333;
  46206. t['logicalnot'] = 584;
  46207. t['odieresis'] = 611;
  46208. t['udieresis'] = 611;
  46209. t['notequal'] = 549;
  46210. t['gcommaaccent'] = 611;
  46211. t['eth'] = 611;
  46212. t['zcaron'] = 500;
  46213. t['ncommaaccent'] = 611;
  46214. t['onesuperior'] = 333;
  46215. t['imacron'] = 278;
  46216. t['Euro'] = 556;
  46217. });
  46218. t['Helvetica-BoldOblique'] = getLookupTableFactory(function (t) {
  46219. t['space'] = 278;
  46220. t['exclam'] = 333;
  46221. t['quotedbl'] = 474;
  46222. t['numbersign'] = 556;
  46223. t['dollar'] = 556;
  46224. t['percent'] = 889;
  46225. t['ampersand'] = 722;
  46226. t['quoteright'] = 278;
  46227. t['parenleft'] = 333;
  46228. t['parenright'] = 333;
  46229. t['asterisk'] = 389;
  46230. t['plus'] = 584;
  46231. t['comma'] = 278;
  46232. t['hyphen'] = 333;
  46233. t['period'] = 278;
  46234. t['slash'] = 278;
  46235. t['zero'] = 556;
  46236. t['one'] = 556;
  46237. t['two'] = 556;
  46238. t['three'] = 556;
  46239. t['four'] = 556;
  46240. t['five'] = 556;
  46241. t['six'] = 556;
  46242. t['seven'] = 556;
  46243. t['eight'] = 556;
  46244. t['nine'] = 556;
  46245. t['colon'] = 333;
  46246. t['semicolon'] = 333;
  46247. t['less'] = 584;
  46248. t['equal'] = 584;
  46249. t['greater'] = 584;
  46250. t['question'] = 611;
  46251. t['at'] = 975;
  46252. t['A'] = 722;
  46253. t['B'] = 722;
  46254. t['C'] = 722;
  46255. t['D'] = 722;
  46256. t['E'] = 667;
  46257. t['F'] = 611;
  46258. t['G'] = 778;
  46259. t['H'] = 722;
  46260. t['I'] = 278;
  46261. t['J'] = 556;
  46262. t['K'] = 722;
  46263. t['L'] = 611;
  46264. t['M'] = 833;
  46265. t['N'] = 722;
  46266. t['O'] = 778;
  46267. t['P'] = 667;
  46268. t['Q'] = 778;
  46269. t['R'] = 722;
  46270. t['S'] = 667;
  46271. t['T'] = 611;
  46272. t['U'] = 722;
  46273. t['V'] = 667;
  46274. t['W'] = 944;
  46275. t['X'] = 667;
  46276. t['Y'] = 667;
  46277. t['Z'] = 611;
  46278. t['bracketleft'] = 333;
  46279. t['backslash'] = 278;
  46280. t['bracketright'] = 333;
  46281. t['asciicircum'] = 584;
  46282. t['underscore'] = 556;
  46283. t['quoteleft'] = 278;
  46284. t['a'] = 556;
  46285. t['b'] = 611;
  46286. t['c'] = 556;
  46287. t['d'] = 611;
  46288. t['e'] = 556;
  46289. t['f'] = 333;
  46290. t['g'] = 611;
  46291. t['h'] = 611;
  46292. t['i'] = 278;
  46293. t['j'] = 278;
  46294. t['k'] = 556;
  46295. t['l'] = 278;
  46296. t['m'] = 889;
  46297. t['n'] = 611;
  46298. t['o'] = 611;
  46299. t['p'] = 611;
  46300. t['q'] = 611;
  46301. t['r'] = 389;
  46302. t['s'] = 556;
  46303. t['t'] = 333;
  46304. t['u'] = 611;
  46305. t['v'] = 556;
  46306. t['w'] = 778;
  46307. t['x'] = 556;
  46308. t['y'] = 556;
  46309. t['z'] = 500;
  46310. t['braceleft'] = 389;
  46311. t['bar'] = 280;
  46312. t['braceright'] = 389;
  46313. t['asciitilde'] = 584;
  46314. t['exclamdown'] = 333;
  46315. t['cent'] = 556;
  46316. t['sterling'] = 556;
  46317. t['fraction'] = 167;
  46318. t['yen'] = 556;
  46319. t['florin'] = 556;
  46320. t['section'] = 556;
  46321. t['currency'] = 556;
  46322. t['quotesingle'] = 238;
  46323. t['quotedblleft'] = 500;
  46324. t['guillemotleft'] = 556;
  46325. t['guilsinglleft'] = 333;
  46326. t['guilsinglright'] = 333;
  46327. t['fi'] = 611;
  46328. t['fl'] = 611;
  46329. t['endash'] = 556;
  46330. t['dagger'] = 556;
  46331. t['daggerdbl'] = 556;
  46332. t['periodcentered'] = 278;
  46333. t['paragraph'] = 556;
  46334. t['bullet'] = 350;
  46335. t['quotesinglbase'] = 278;
  46336. t['quotedblbase'] = 500;
  46337. t['quotedblright'] = 500;
  46338. t['guillemotright'] = 556;
  46339. t['ellipsis'] = 1000;
  46340. t['perthousand'] = 1000;
  46341. t['questiondown'] = 611;
  46342. t['grave'] = 333;
  46343. t['acute'] = 333;
  46344. t['circumflex'] = 333;
  46345. t['tilde'] = 333;
  46346. t['macron'] = 333;
  46347. t['breve'] = 333;
  46348. t['dotaccent'] = 333;
  46349. t['dieresis'] = 333;
  46350. t['ring'] = 333;
  46351. t['cedilla'] = 333;
  46352. t['hungarumlaut'] = 333;
  46353. t['ogonek'] = 333;
  46354. t['caron'] = 333;
  46355. t['emdash'] = 1000;
  46356. t['AE'] = 1000;
  46357. t['ordfeminine'] = 370;
  46358. t['Lslash'] = 611;
  46359. t['Oslash'] = 778;
  46360. t['OE'] = 1000;
  46361. t['ordmasculine'] = 365;
  46362. t['ae'] = 889;
  46363. t['dotlessi'] = 278;
  46364. t['lslash'] = 278;
  46365. t['oslash'] = 611;
  46366. t['oe'] = 944;
  46367. t['germandbls'] = 611;
  46368. t['Idieresis'] = 278;
  46369. t['eacute'] = 556;
  46370. t['abreve'] = 556;
  46371. t['uhungarumlaut'] = 611;
  46372. t['ecaron'] = 556;
  46373. t['Ydieresis'] = 667;
  46374. t['divide'] = 584;
  46375. t['Yacute'] = 667;
  46376. t['Acircumflex'] = 722;
  46377. t['aacute'] = 556;
  46378. t['Ucircumflex'] = 722;
  46379. t['yacute'] = 556;
  46380. t['scommaaccent'] = 556;
  46381. t['ecircumflex'] = 556;
  46382. t['Uring'] = 722;
  46383. t['Udieresis'] = 722;
  46384. t['aogonek'] = 556;
  46385. t['Uacute'] = 722;
  46386. t['uogonek'] = 611;
  46387. t['Edieresis'] = 667;
  46388. t['Dcroat'] = 722;
  46389. t['commaaccent'] = 250;
  46390. t['copyright'] = 737;
  46391. t['Emacron'] = 667;
  46392. t['ccaron'] = 556;
  46393. t['aring'] = 556;
  46394. t['Ncommaaccent'] = 722;
  46395. t['lacute'] = 278;
  46396. t['agrave'] = 556;
  46397. t['Tcommaaccent'] = 611;
  46398. t['Cacute'] = 722;
  46399. t['atilde'] = 556;
  46400. t['Edotaccent'] = 667;
  46401. t['scaron'] = 556;
  46402. t['scedilla'] = 556;
  46403. t['iacute'] = 278;
  46404. t['lozenge'] = 494;
  46405. t['Rcaron'] = 722;
  46406. t['Gcommaaccent'] = 778;
  46407. t['ucircumflex'] = 611;
  46408. t['acircumflex'] = 556;
  46409. t['Amacron'] = 722;
  46410. t['rcaron'] = 389;
  46411. t['ccedilla'] = 556;
  46412. t['Zdotaccent'] = 611;
  46413. t['Thorn'] = 667;
  46414. t['Omacron'] = 778;
  46415. t['Racute'] = 722;
  46416. t['Sacute'] = 667;
  46417. t['dcaron'] = 743;
  46418. t['Umacron'] = 722;
  46419. t['uring'] = 611;
  46420. t['threesuperior'] = 333;
  46421. t['Ograve'] = 778;
  46422. t['Agrave'] = 722;
  46423. t['Abreve'] = 722;
  46424. t['multiply'] = 584;
  46425. t['uacute'] = 611;
  46426. t['Tcaron'] = 611;
  46427. t['partialdiff'] = 494;
  46428. t['ydieresis'] = 556;
  46429. t['Nacute'] = 722;
  46430. t['icircumflex'] = 278;
  46431. t['Ecircumflex'] = 667;
  46432. t['adieresis'] = 556;
  46433. t['edieresis'] = 556;
  46434. t['cacute'] = 556;
  46435. t['nacute'] = 611;
  46436. t['umacron'] = 611;
  46437. t['Ncaron'] = 722;
  46438. t['Iacute'] = 278;
  46439. t['plusminus'] = 584;
  46440. t['brokenbar'] = 280;
  46441. t['registered'] = 737;
  46442. t['Gbreve'] = 778;
  46443. t['Idotaccent'] = 278;
  46444. t['summation'] = 600;
  46445. t['Egrave'] = 667;
  46446. t['racute'] = 389;
  46447. t['omacron'] = 611;
  46448. t['Zacute'] = 611;
  46449. t['Zcaron'] = 611;
  46450. t['greaterequal'] = 549;
  46451. t['Eth'] = 722;
  46452. t['Ccedilla'] = 722;
  46453. t['lcommaaccent'] = 278;
  46454. t['tcaron'] = 389;
  46455. t['eogonek'] = 556;
  46456. t['Uogonek'] = 722;
  46457. t['Aacute'] = 722;
  46458. t['Adieresis'] = 722;
  46459. t['egrave'] = 556;
  46460. t['zacute'] = 500;
  46461. t['iogonek'] = 278;
  46462. t['Oacute'] = 778;
  46463. t['oacute'] = 611;
  46464. t['amacron'] = 556;
  46465. t['sacute'] = 556;
  46466. t['idieresis'] = 278;
  46467. t['Ocircumflex'] = 778;
  46468. t['Ugrave'] = 722;
  46469. t['Delta'] = 612;
  46470. t['thorn'] = 611;
  46471. t['twosuperior'] = 333;
  46472. t['Odieresis'] = 778;
  46473. t['mu'] = 611;
  46474. t['igrave'] = 278;
  46475. t['ohungarumlaut'] = 611;
  46476. t['Eogonek'] = 667;
  46477. t['dcroat'] = 611;
  46478. t['threequarters'] = 834;
  46479. t['Scedilla'] = 667;
  46480. t['lcaron'] = 400;
  46481. t['Kcommaaccent'] = 722;
  46482. t['Lacute'] = 611;
  46483. t['trademark'] = 1000;
  46484. t['edotaccent'] = 556;
  46485. t['Igrave'] = 278;
  46486. t['Imacron'] = 278;
  46487. t['Lcaron'] = 611;
  46488. t['onehalf'] = 834;
  46489. t['lessequal'] = 549;
  46490. t['ocircumflex'] = 611;
  46491. t['ntilde'] = 611;
  46492. t['Uhungarumlaut'] = 722;
  46493. t['Eacute'] = 667;
  46494. t['emacron'] = 556;
  46495. t['gbreve'] = 611;
  46496. t['onequarter'] = 834;
  46497. t['Scaron'] = 667;
  46498. t['Scommaaccent'] = 667;
  46499. t['Ohungarumlaut'] = 778;
  46500. t['degree'] = 400;
  46501. t['ograve'] = 611;
  46502. t['Ccaron'] = 722;
  46503. t['ugrave'] = 611;
  46504. t['radical'] = 549;
  46505. t['Dcaron'] = 722;
  46506. t['rcommaaccent'] = 389;
  46507. t['Ntilde'] = 722;
  46508. t['otilde'] = 611;
  46509. t['Rcommaaccent'] = 722;
  46510. t['Lcommaaccent'] = 611;
  46511. t['Atilde'] = 722;
  46512. t['Aogonek'] = 722;
  46513. t['Aring'] = 722;
  46514. t['Otilde'] = 778;
  46515. t['zdotaccent'] = 500;
  46516. t['Ecaron'] = 667;
  46517. t['Iogonek'] = 278;
  46518. t['kcommaaccent'] = 556;
  46519. t['minus'] = 584;
  46520. t['Icircumflex'] = 278;
  46521. t['ncaron'] = 611;
  46522. t['tcommaaccent'] = 333;
  46523. t['logicalnot'] = 584;
  46524. t['odieresis'] = 611;
  46525. t['udieresis'] = 611;
  46526. t['notequal'] = 549;
  46527. t['gcommaaccent'] = 611;
  46528. t['eth'] = 611;
  46529. t['zcaron'] = 500;
  46530. t['ncommaaccent'] = 611;
  46531. t['onesuperior'] = 333;
  46532. t['imacron'] = 278;
  46533. t['Euro'] = 556;
  46534. });
  46535. t['Helvetica-Oblique'] = getLookupTableFactory(function (t) {
  46536. t['space'] = 278;
  46537. t['exclam'] = 278;
  46538. t['quotedbl'] = 355;
  46539. t['numbersign'] = 556;
  46540. t['dollar'] = 556;
  46541. t['percent'] = 889;
  46542. t['ampersand'] = 667;
  46543. t['quoteright'] = 222;
  46544. t['parenleft'] = 333;
  46545. t['parenright'] = 333;
  46546. t['asterisk'] = 389;
  46547. t['plus'] = 584;
  46548. t['comma'] = 278;
  46549. t['hyphen'] = 333;
  46550. t['period'] = 278;
  46551. t['slash'] = 278;
  46552. t['zero'] = 556;
  46553. t['one'] = 556;
  46554. t['two'] = 556;
  46555. t['three'] = 556;
  46556. t['four'] = 556;
  46557. t['five'] = 556;
  46558. t['six'] = 556;
  46559. t['seven'] = 556;
  46560. t['eight'] = 556;
  46561. t['nine'] = 556;
  46562. t['colon'] = 278;
  46563. t['semicolon'] = 278;
  46564. t['less'] = 584;
  46565. t['equal'] = 584;
  46566. t['greater'] = 584;
  46567. t['question'] = 556;
  46568. t['at'] = 1015;
  46569. t['A'] = 667;
  46570. t['B'] = 667;
  46571. t['C'] = 722;
  46572. t['D'] = 722;
  46573. t['E'] = 667;
  46574. t['F'] = 611;
  46575. t['G'] = 778;
  46576. t['H'] = 722;
  46577. t['I'] = 278;
  46578. t['J'] = 500;
  46579. t['K'] = 667;
  46580. t['L'] = 556;
  46581. t['M'] = 833;
  46582. t['N'] = 722;
  46583. t['O'] = 778;
  46584. t['P'] = 667;
  46585. t['Q'] = 778;
  46586. t['R'] = 722;
  46587. t['S'] = 667;
  46588. t['T'] = 611;
  46589. t['U'] = 722;
  46590. t['V'] = 667;
  46591. t['W'] = 944;
  46592. t['X'] = 667;
  46593. t['Y'] = 667;
  46594. t['Z'] = 611;
  46595. t['bracketleft'] = 278;
  46596. t['backslash'] = 278;
  46597. t['bracketright'] = 278;
  46598. t['asciicircum'] = 469;
  46599. t['underscore'] = 556;
  46600. t['quoteleft'] = 222;
  46601. t['a'] = 556;
  46602. t['b'] = 556;
  46603. t['c'] = 500;
  46604. t['d'] = 556;
  46605. t['e'] = 556;
  46606. t['f'] = 278;
  46607. t['g'] = 556;
  46608. t['h'] = 556;
  46609. t['i'] = 222;
  46610. t['j'] = 222;
  46611. t['k'] = 500;
  46612. t['l'] = 222;
  46613. t['m'] = 833;
  46614. t['n'] = 556;
  46615. t['o'] = 556;
  46616. t['p'] = 556;
  46617. t['q'] = 556;
  46618. t['r'] = 333;
  46619. t['s'] = 500;
  46620. t['t'] = 278;
  46621. t['u'] = 556;
  46622. t['v'] = 500;
  46623. t['w'] = 722;
  46624. t['x'] = 500;
  46625. t['y'] = 500;
  46626. t['z'] = 500;
  46627. t['braceleft'] = 334;
  46628. t['bar'] = 260;
  46629. t['braceright'] = 334;
  46630. t['asciitilde'] = 584;
  46631. t['exclamdown'] = 333;
  46632. t['cent'] = 556;
  46633. t['sterling'] = 556;
  46634. t['fraction'] = 167;
  46635. t['yen'] = 556;
  46636. t['florin'] = 556;
  46637. t['section'] = 556;
  46638. t['currency'] = 556;
  46639. t['quotesingle'] = 191;
  46640. t['quotedblleft'] = 333;
  46641. t['guillemotleft'] = 556;
  46642. t['guilsinglleft'] = 333;
  46643. t['guilsinglright'] = 333;
  46644. t['fi'] = 500;
  46645. t['fl'] = 500;
  46646. t['endash'] = 556;
  46647. t['dagger'] = 556;
  46648. t['daggerdbl'] = 556;
  46649. t['periodcentered'] = 278;
  46650. t['paragraph'] = 537;
  46651. t['bullet'] = 350;
  46652. t['quotesinglbase'] = 222;
  46653. t['quotedblbase'] = 333;
  46654. t['quotedblright'] = 333;
  46655. t['guillemotright'] = 556;
  46656. t['ellipsis'] = 1000;
  46657. t['perthousand'] = 1000;
  46658. t['questiondown'] = 611;
  46659. t['grave'] = 333;
  46660. t['acute'] = 333;
  46661. t['circumflex'] = 333;
  46662. t['tilde'] = 333;
  46663. t['macron'] = 333;
  46664. t['breve'] = 333;
  46665. t['dotaccent'] = 333;
  46666. t['dieresis'] = 333;
  46667. t['ring'] = 333;
  46668. t['cedilla'] = 333;
  46669. t['hungarumlaut'] = 333;
  46670. t['ogonek'] = 333;
  46671. t['caron'] = 333;
  46672. t['emdash'] = 1000;
  46673. t['AE'] = 1000;
  46674. t['ordfeminine'] = 370;
  46675. t['Lslash'] = 556;
  46676. t['Oslash'] = 778;
  46677. t['OE'] = 1000;
  46678. t['ordmasculine'] = 365;
  46679. t['ae'] = 889;
  46680. t['dotlessi'] = 278;
  46681. t['lslash'] = 222;
  46682. t['oslash'] = 611;
  46683. t['oe'] = 944;
  46684. t['germandbls'] = 611;
  46685. t['Idieresis'] = 278;
  46686. t['eacute'] = 556;
  46687. t['abreve'] = 556;
  46688. t['uhungarumlaut'] = 556;
  46689. t['ecaron'] = 556;
  46690. t['Ydieresis'] = 667;
  46691. t['divide'] = 584;
  46692. t['Yacute'] = 667;
  46693. t['Acircumflex'] = 667;
  46694. t['aacute'] = 556;
  46695. t['Ucircumflex'] = 722;
  46696. t['yacute'] = 500;
  46697. t['scommaaccent'] = 500;
  46698. t['ecircumflex'] = 556;
  46699. t['Uring'] = 722;
  46700. t['Udieresis'] = 722;
  46701. t['aogonek'] = 556;
  46702. t['Uacute'] = 722;
  46703. t['uogonek'] = 556;
  46704. t['Edieresis'] = 667;
  46705. t['Dcroat'] = 722;
  46706. t['commaaccent'] = 250;
  46707. t['copyright'] = 737;
  46708. t['Emacron'] = 667;
  46709. t['ccaron'] = 500;
  46710. t['aring'] = 556;
  46711. t['Ncommaaccent'] = 722;
  46712. t['lacute'] = 222;
  46713. t['agrave'] = 556;
  46714. t['Tcommaaccent'] = 611;
  46715. t['Cacute'] = 722;
  46716. t['atilde'] = 556;
  46717. t['Edotaccent'] = 667;
  46718. t['scaron'] = 500;
  46719. t['scedilla'] = 500;
  46720. t['iacute'] = 278;
  46721. t['lozenge'] = 471;
  46722. t['Rcaron'] = 722;
  46723. t['Gcommaaccent'] = 778;
  46724. t['ucircumflex'] = 556;
  46725. t['acircumflex'] = 556;
  46726. t['Amacron'] = 667;
  46727. t['rcaron'] = 333;
  46728. t['ccedilla'] = 500;
  46729. t['Zdotaccent'] = 611;
  46730. t['Thorn'] = 667;
  46731. t['Omacron'] = 778;
  46732. t['Racute'] = 722;
  46733. t['Sacute'] = 667;
  46734. t['dcaron'] = 643;
  46735. t['Umacron'] = 722;
  46736. t['uring'] = 556;
  46737. t['threesuperior'] = 333;
  46738. t['Ograve'] = 778;
  46739. t['Agrave'] = 667;
  46740. t['Abreve'] = 667;
  46741. t['multiply'] = 584;
  46742. t['uacute'] = 556;
  46743. t['Tcaron'] = 611;
  46744. t['partialdiff'] = 476;
  46745. t['ydieresis'] = 500;
  46746. t['Nacute'] = 722;
  46747. t['icircumflex'] = 278;
  46748. t['Ecircumflex'] = 667;
  46749. t['adieresis'] = 556;
  46750. t['edieresis'] = 556;
  46751. t['cacute'] = 500;
  46752. t['nacute'] = 556;
  46753. t['umacron'] = 556;
  46754. t['Ncaron'] = 722;
  46755. t['Iacute'] = 278;
  46756. t['plusminus'] = 584;
  46757. t['brokenbar'] = 260;
  46758. t['registered'] = 737;
  46759. t['Gbreve'] = 778;
  46760. t['Idotaccent'] = 278;
  46761. t['summation'] = 600;
  46762. t['Egrave'] = 667;
  46763. t['racute'] = 333;
  46764. t['omacron'] = 556;
  46765. t['Zacute'] = 611;
  46766. t['Zcaron'] = 611;
  46767. t['greaterequal'] = 549;
  46768. t['Eth'] = 722;
  46769. t['Ccedilla'] = 722;
  46770. t['lcommaaccent'] = 222;
  46771. t['tcaron'] = 317;
  46772. t['eogonek'] = 556;
  46773. t['Uogonek'] = 722;
  46774. t['Aacute'] = 667;
  46775. t['Adieresis'] = 667;
  46776. t['egrave'] = 556;
  46777. t['zacute'] = 500;
  46778. t['iogonek'] = 222;
  46779. t['Oacute'] = 778;
  46780. t['oacute'] = 556;
  46781. t['amacron'] = 556;
  46782. t['sacute'] = 500;
  46783. t['idieresis'] = 278;
  46784. t['Ocircumflex'] = 778;
  46785. t['Ugrave'] = 722;
  46786. t['Delta'] = 612;
  46787. t['thorn'] = 556;
  46788. t['twosuperior'] = 333;
  46789. t['Odieresis'] = 778;
  46790. t['mu'] = 556;
  46791. t['igrave'] = 278;
  46792. t['ohungarumlaut'] = 556;
  46793. t['Eogonek'] = 667;
  46794. t['dcroat'] = 556;
  46795. t['threequarters'] = 834;
  46796. t['Scedilla'] = 667;
  46797. t['lcaron'] = 299;
  46798. t['Kcommaaccent'] = 667;
  46799. t['Lacute'] = 556;
  46800. t['trademark'] = 1000;
  46801. t['edotaccent'] = 556;
  46802. t['Igrave'] = 278;
  46803. t['Imacron'] = 278;
  46804. t['Lcaron'] = 556;
  46805. t['onehalf'] = 834;
  46806. t['lessequal'] = 549;
  46807. t['ocircumflex'] = 556;
  46808. t['ntilde'] = 556;
  46809. t['Uhungarumlaut'] = 722;
  46810. t['Eacute'] = 667;
  46811. t['emacron'] = 556;
  46812. t['gbreve'] = 556;
  46813. t['onequarter'] = 834;
  46814. t['Scaron'] = 667;
  46815. t['Scommaaccent'] = 667;
  46816. t['Ohungarumlaut'] = 778;
  46817. t['degree'] = 400;
  46818. t['ograve'] = 556;
  46819. t['Ccaron'] = 722;
  46820. t['ugrave'] = 556;
  46821. t['radical'] = 453;
  46822. t['Dcaron'] = 722;
  46823. t['rcommaaccent'] = 333;
  46824. t['Ntilde'] = 722;
  46825. t['otilde'] = 556;
  46826. t['Rcommaaccent'] = 722;
  46827. t['Lcommaaccent'] = 556;
  46828. t['Atilde'] = 667;
  46829. t['Aogonek'] = 667;
  46830. t['Aring'] = 667;
  46831. t['Otilde'] = 778;
  46832. t['zdotaccent'] = 500;
  46833. t['Ecaron'] = 667;
  46834. t['Iogonek'] = 278;
  46835. t['kcommaaccent'] = 500;
  46836. t['minus'] = 584;
  46837. t['Icircumflex'] = 278;
  46838. t['ncaron'] = 556;
  46839. t['tcommaaccent'] = 278;
  46840. t['logicalnot'] = 584;
  46841. t['odieresis'] = 556;
  46842. t['udieresis'] = 556;
  46843. t['notequal'] = 549;
  46844. t['gcommaaccent'] = 556;
  46845. t['eth'] = 556;
  46846. t['zcaron'] = 500;
  46847. t['ncommaaccent'] = 556;
  46848. t['onesuperior'] = 333;
  46849. t['imacron'] = 278;
  46850. t['Euro'] = 556;
  46851. });
  46852. t['Symbol'] = getLookupTableFactory(function (t) {
  46853. t['space'] = 250;
  46854. t['exclam'] = 333;
  46855. t['universal'] = 713;
  46856. t['numbersign'] = 500;
  46857. t['existential'] = 549;
  46858. t['percent'] = 833;
  46859. t['ampersand'] = 778;
  46860. t['suchthat'] = 439;
  46861. t['parenleft'] = 333;
  46862. t['parenright'] = 333;
  46863. t['asteriskmath'] = 500;
  46864. t['plus'] = 549;
  46865. t['comma'] = 250;
  46866. t['minus'] = 549;
  46867. t['period'] = 250;
  46868. t['slash'] = 278;
  46869. t['zero'] = 500;
  46870. t['one'] = 500;
  46871. t['two'] = 500;
  46872. t['three'] = 500;
  46873. t['four'] = 500;
  46874. t['five'] = 500;
  46875. t['six'] = 500;
  46876. t['seven'] = 500;
  46877. t['eight'] = 500;
  46878. t['nine'] = 500;
  46879. t['colon'] = 278;
  46880. t['semicolon'] = 278;
  46881. t['less'] = 549;
  46882. t['equal'] = 549;
  46883. t['greater'] = 549;
  46884. t['question'] = 444;
  46885. t['congruent'] = 549;
  46886. t['Alpha'] = 722;
  46887. t['Beta'] = 667;
  46888. t['Chi'] = 722;
  46889. t['Delta'] = 612;
  46890. t['Epsilon'] = 611;
  46891. t['Phi'] = 763;
  46892. t['Gamma'] = 603;
  46893. t['Eta'] = 722;
  46894. t['Iota'] = 333;
  46895. t['theta1'] = 631;
  46896. t['Kappa'] = 722;
  46897. t['Lambda'] = 686;
  46898. t['Mu'] = 889;
  46899. t['Nu'] = 722;
  46900. t['Omicron'] = 722;
  46901. t['Pi'] = 768;
  46902. t['Theta'] = 741;
  46903. t['Rho'] = 556;
  46904. t['Sigma'] = 592;
  46905. t['Tau'] = 611;
  46906. t['Upsilon'] = 690;
  46907. t['sigma1'] = 439;
  46908. t['Omega'] = 768;
  46909. t['Xi'] = 645;
  46910. t['Psi'] = 795;
  46911. t['Zeta'] = 611;
  46912. t['bracketleft'] = 333;
  46913. t['therefore'] = 863;
  46914. t['bracketright'] = 333;
  46915. t['perpendicular'] = 658;
  46916. t['underscore'] = 500;
  46917. t['radicalex'] = 500;
  46918. t['alpha'] = 631;
  46919. t['beta'] = 549;
  46920. t['chi'] = 549;
  46921. t['delta'] = 494;
  46922. t['epsilon'] = 439;
  46923. t['phi'] = 521;
  46924. t['gamma'] = 411;
  46925. t['eta'] = 603;
  46926. t['iota'] = 329;
  46927. t['phi1'] = 603;
  46928. t['kappa'] = 549;
  46929. t['lambda'] = 549;
  46930. t['mu'] = 576;
  46931. t['nu'] = 521;
  46932. t['omicron'] = 549;
  46933. t['pi'] = 549;
  46934. t['theta'] = 521;
  46935. t['rho'] = 549;
  46936. t['sigma'] = 603;
  46937. t['tau'] = 439;
  46938. t['upsilon'] = 576;
  46939. t['omega1'] = 713;
  46940. t['omega'] = 686;
  46941. t['xi'] = 493;
  46942. t['psi'] = 686;
  46943. t['zeta'] = 494;
  46944. t['braceleft'] = 480;
  46945. t['bar'] = 200;
  46946. t['braceright'] = 480;
  46947. t['similar'] = 549;
  46948. t['Euro'] = 750;
  46949. t['Upsilon1'] = 620;
  46950. t['minute'] = 247;
  46951. t['lessequal'] = 549;
  46952. t['fraction'] = 167;
  46953. t['infinity'] = 713;
  46954. t['florin'] = 500;
  46955. t['club'] = 753;
  46956. t['diamond'] = 753;
  46957. t['heart'] = 753;
  46958. t['spade'] = 753;
  46959. t['arrowboth'] = 1042;
  46960. t['arrowleft'] = 987;
  46961. t['arrowup'] = 603;
  46962. t['arrowright'] = 987;
  46963. t['arrowdown'] = 603;
  46964. t['degree'] = 400;
  46965. t['plusminus'] = 549;
  46966. t['second'] = 411;
  46967. t['greaterequal'] = 549;
  46968. t['multiply'] = 549;
  46969. t['proportional'] = 713;
  46970. t['partialdiff'] = 494;
  46971. t['bullet'] = 460;
  46972. t['divide'] = 549;
  46973. t['notequal'] = 549;
  46974. t['equivalence'] = 549;
  46975. t['approxequal'] = 549;
  46976. t['ellipsis'] = 1000;
  46977. t['arrowvertex'] = 603;
  46978. t['arrowhorizex'] = 1000;
  46979. t['carriagereturn'] = 658;
  46980. t['aleph'] = 823;
  46981. t['Ifraktur'] = 686;
  46982. t['Rfraktur'] = 795;
  46983. t['weierstrass'] = 987;
  46984. t['circlemultiply'] = 768;
  46985. t['circleplus'] = 768;
  46986. t['emptyset'] = 823;
  46987. t['intersection'] = 768;
  46988. t['union'] = 768;
  46989. t['propersuperset'] = 713;
  46990. t['reflexsuperset'] = 713;
  46991. t['notsubset'] = 713;
  46992. t['propersubset'] = 713;
  46993. t['reflexsubset'] = 713;
  46994. t['element'] = 713;
  46995. t['notelement'] = 713;
  46996. t['angle'] = 768;
  46997. t['gradient'] = 713;
  46998. t['registerserif'] = 790;
  46999. t['copyrightserif'] = 790;
  47000. t['trademarkserif'] = 890;
  47001. t['product'] = 823;
  47002. t['radical'] = 549;
  47003. t['dotmath'] = 250;
  47004. t['logicalnot'] = 713;
  47005. t['logicaland'] = 603;
  47006. t['logicalor'] = 603;
  47007. t['arrowdblboth'] = 1042;
  47008. t['arrowdblleft'] = 987;
  47009. t['arrowdblup'] = 603;
  47010. t['arrowdblright'] = 987;
  47011. t['arrowdbldown'] = 603;
  47012. t['lozenge'] = 494;
  47013. t['angleleft'] = 329;
  47014. t['registersans'] = 790;
  47015. t['copyrightsans'] = 790;
  47016. t['trademarksans'] = 786;
  47017. t['summation'] = 713;
  47018. t['parenlefttp'] = 384;
  47019. t['parenleftex'] = 384;
  47020. t['parenleftbt'] = 384;
  47021. t['bracketlefttp'] = 384;
  47022. t['bracketleftex'] = 384;
  47023. t['bracketleftbt'] = 384;
  47024. t['bracelefttp'] = 494;
  47025. t['braceleftmid'] = 494;
  47026. t['braceleftbt'] = 494;
  47027. t['braceex'] = 494;
  47028. t['angleright'] = 329;
  47029. t['integral'] = 274;
  47030. t['integraltp'] = 686;
  47031. t['integralex'] = 686;
  47032. t['integralbt'] = 686;
  47033. t['parenrighttp'] = 384;
  47034. t['parenrightex'] = 384;
  47035. t['parenrightbt'] = 384;
  47036. t['bracketrighttp'] = 384;
  47037. t['bracketrightex'] = 384;
  47038. t['bracketrightbt'] = 384;
  47039. t['bracerighttp'] = 494;
  47040. t['bracerightmid'] = 494;
  47041. t['bracerightbt'] = 494;
  47042. t['apple'] = 790;
  47043. });
  47044. t['Times-Roman'] = getLookupTableFactory(function (t) {
  47045. t['space'] = 250;
  47046. t['exclam'] = 333;
  47047. t['quotedbl'] = 408;
  47048. t['numbersign'] = 500;
  47049. t['dollar'] = 500;
  47050. t['percent'] = 833;
  47051. t['ampersand'] = 778;
  47052. t['quoteright'] = 333;
  47053. t['parenleft'] = 333;
  47054. t['parenright'] = 333;
  47055. t['asterisk'] = 500;
  47056. t['plus'] = 564;
  47057. t['comma'] = 250;
  47058. t['hyphen'] = 333;
  47059. t['period'] = 250;
  47060. t['slash'] = 278;
  47061. t['zero'] = 500;
  47062. t['one'] = 500;
  47063. t['two'] = 500;
  47064. t['three'] = 500;
  47065. t['four'] = 500;
  47066. t['five'] = 500;
  47067. t['six'] = 500;
  47068. t['seven'] = 500;
  47069. t['eight'] = 500;
  47070. t['nine'] = 500;
  47071. t['colon'] = 278;
  47072. t['semicolon'] = 278;
  47073. t['less'] = 564;
  47074. t['equal'] = 564;
  47075. t['greater'] = 564;
  47076. t['question'] = 444;
  47077. t['at'] = 921;
  47078. t['A'] = 722;
  47079. t['B'] = 667;
  47080. t['C'] = 667;
  47081. t['D'] = 722;
  47082. t['E'] = 611;
  47083. t['F'] = 556;
  47084. t['G'] = 722;
  47085. t['H'] = 722;
  47086. t['I'] = 333;
  47087. t['J'] = 389;
  47088. t['K'] = 722;
  47089. t['L'] = 611;
  47090. t['M'] = 889;
  47091. t['N'] = 722;
  47092. t['O'] = 722;
  47093. t['P'] = 556;
  47094. t['Q'] = 722;
  47095. t['R'] = 667;
  47096. t['S'] = 556;
  47097. t['T'] = 611;
  47098. t['U'] = 722;
  47099. t['V'] = 722;
  47100. t['W'] = 944;
  47101. t['X'] = 722;
  47102. t['Y'] = 722;
  47103. t['Z'] = 611;
  47104. t['bracketleft'] = 333;
  47105. t['backslash'] = 278;
  47106. t['bracketright'] = 333;
  47107. t['asciicircum'] = 469;
  47108. t['underscore'] = 500;
  47109. t['quoteleft'] = 333;
  47110. t['a'] = 444;
  47111. t['b'] = 500;
  47112. t['c'] = 444;
  47113. t['d'] = 500;
  47114. t['e'] = 444;
  47115. t['f'] = 333;
  47116. t['g'] = 500;
  47117. t['h'] = 500;
  47118. t['i'] = 278;
  47119. t['j'] = 278;
  47120. t['k'] = 500;
  47121. t['l'] = 278;
  47122. t['m'] = 778;
  47123. t['n'] = 500;
  47124. t['o'] = 500;
  47125. t['p'] = 500;
  47126. t['q'] = 500;
  47127. t['r'] = 333;
  47128. t['s'] = 389;
  47129. t['t'] = 278;
  47130. t['u'] = 500;
  47131. t['v'] = 500;
  47132. t['w'] = 722;
  47133. t['x'] = 500;
  47134. t['y'] = 500;
  47135. t['z'] = 444;
  47136. t['braceleft'] = 480;
  47137. t['bar'] = 200;
  47138. t['braceright'] = 480;
  47139. t['asciitilde'] = 541;
  47140. t['exclamdown'] = 333;
  47141. t['cent'] = 500;
  47142. t['sterling'] = 500;
  47143. t['fraction'] = 167;
  47144. t['yen'] = 500;
  47145. t['florin'] = 500;
  47146. t['section'] = 500;
  47147. t['currency'] = 500;
  47148. t['quotesingle'] = 180;
  47149. t['quotedblleft'] = 444;
  47150. t['guillemotleft'] = 500;
  47151. t['guilsinglleft'] = 333;
  47152. t['guilsinglright'] = 333;
  47153. t['fi'] = 556;
  47154. t['fl'] = 556;
  47155. t['endash'] = 500;
  47156. t['dagger'] = 500;
  47157. t['daggerdbl'] = 500;
  47158. t['periodcentered'] = 250;
  47159. t['paragraph'] = 453;
  47160. t['bullet'] = 350;
  47161. t['quotesinglbase'] = 333;
  47162. t['quotedblbase'] = 444;
  47163. t['quotedblright'] = 444;
  47164. t['guillemotright'] = 500;
  47165. t['ellipsis'] = 1000;
  47166. t['perthousand'] = 1000;
  47167. t['questiondown'] = 444;
  47168. t['grave'] = 333;
  47169. t['acute'] = 333;
  47170. t['circumflex'] = 333;
  47171. t['tilde'] = 333;
  47172. t['macron'] = 333;
  47173. t['breve'] = 333;
  47174. t['dotaccent'] = 333;
  47175. t['dieresis'] = 333;
  47176. t['ring'] = 333;
  47177. t['cedilla'] = 333;
  47178. t['hungarumlaut'] = 333;
  47179. t['ogonek'] = 333;
  47180. t['caron'] = 333;
  47181. t['emdash'] = 1000;
  47182. t['AE'] = 889;
  47183. t['ordfeminine'] = 276;
  47184. t['Lslash'] = 611;
  47185. t['Oslash'] = 722;
  47186. t['OE'] = 889;
  47187. t['ordmasculine'] = 310;
  47188. t['ae'] = 667;
  47189. t['dotlessi'] = 278;
  47190. t['lslash'] = 278;
  47191. t['oslash'] = 500;
  47192. t['oe'] = 722;
  47193. t['germandbls'] = 500;
  47194. t['Idieresis'] = 333;
  47195. t['eacute'] = 444;
  47196. t['abreve'] = 444;
  47197. t['uhungarumlaut'] = 500;
  47198. t['ecaron'] = 444;
  47199. t['Ydieresis'] = 722;
  47200. t['divide'] = 564;
  47201. t['Yacute'] = 722;
  47202. t['Acircumflex'] = 722;
  47203. t['aacute'] = 444;
  47204. t['Ucircumflex'] = 722;
  47205. t['yacute'] = 500;
  47206. t['scommaaccent'] = 389;
  47207. t['ecircumflex'] = 444;
  47208. t['Uring'] = 722;
  47209. t['Udieresis'] = 722;
  47210. t['aogonek'] = 444;
  47211. t['Uacute'] = 722;
  47212. t['uogonek'] = 500;
  47213. t['Edieresis'] = 611;
  47214. t['Dcroat'] = 722;
  47215. t['commaaccent'] = 250;
  47216. t['copyright'] = 760;
  47217. t['Emacron'] = 611;
  47218. t['ccaron'] = 444;
  47219. t['aring'] = 444;
  47220. t['Ncommaaccent'] = 722;
  47221. t['lacute'] = 278;
  47222. t['agrave'] = 444;
  47223. t['Tcommaaccent'] = 611;
  47224. t['Cacute'] = 667;
  47225. t['atilde'] = 444;
  47226. t['Edotaccent'] = 611;
  47227. t['scaron'] = 389;
  47228. t['scedilla'] = 389;
  47229. t['iacute'] = 278;
  47230. t['lozenge'] = 471;
  47231. t['Rcaron'] = 667;
  47232. t['Gcommaaccent'] = 722;
  47233. t['ucircumflex'] = 500;
  47234. t['acircumflex'] = 444;
  47235. t['Amacron'] = 722;
  47236. t['rcaron'] = 333;
  47237. t['ccedilla'] = 444;
  47238. t['Zdotaccent'] = 611;
  47239. t['Thorn'] = 556;
  47240. t['Omacron'] = 722;
  47241. t['Racute'] = 667;
  47242. t['Sacute'] = 556;
  47243. t['dcaron'] = 588;
  47244. t['Umacron'] = 722;
  47245. t['uring'] = 500;
  47246. t['threesuperior'] = 300;
  47247. t['Ograve'] = 722;
  47248. t['Agrave'] = 722;
  47249. t['Abreve'] = 722;
  47250. t['multiply'] = 564;
  47251. t['uacute'] = 500;
  47252. t['Tcaron'] = 611;
  47253. t['partialdiff'] = 476;
  47254. t['ydieresis'] = 500;
  47255. t['Nacute'] = 722;
  47256. t['icircumflex'] = 278;
  47257. t['Ecircumflex'] = 611;
  47258. t['adieresis'] = 444;
  47259. t['edieresis'] = 444;
  47260. t['cacute'] = 444;
  47261. t['nacute'] = 500;
  47262. t['umacron'] = 500;
  47263. t['Ncaron'] = 722;
  47264. t['Iacute'] = 333;
  47265. t['plusminus'] = 564;
  47266. t['brokenbar'] = 200;
  47267. t['registered'] = 760;
  47268. t['Gbreve'] = 722;
  47269. t['Idotaccent'] = 333;
  47270. t['summation'] = 600;
  47271. t['Egrave'] = 611;
  47272. t['racute'] = 333;
  47273. t['omacron'] = 500;
  47274. t['Zacute'] = 611;
  47275. t['Zcaron'] = 611;
  47276. t['greaterequal'] = 549;
  47277. t['Eth'] = 722;
  47278. t['Ccedilla'] = 667;
  47279. t['lcommaaccent'] = 278;
  47280. t['tcaron'] = 326;
  47281. t['eogonek'] = 444;
  47282. t['Uogonek'] = 722;
  47283. t['Aacute'] = 722;
  47284. t['Adieresis'] = 722;
  47285. t['egrave'] = 444;
  47286. t['zacute'] = 444;
  47287. t['iogonek'] = 278;
  47288. t['Oacute'] = 722;
  47289. t['oacute'] = 500;
  47290. t['amacron'] = 444;
  47291. t['sacute'] = 389;
  47292. t['idieresis'] = 278;
  47293. t['Ocircumflex'] = 722;
  47294. t['Ugrave'] = 722;
  47295. t['Delta'] = 612;
  47296. t['thorn'] = 500;
  47297. t['twosuperior'] = 300;
  47298. t['Odieresis'] = 722;
  47299. t['mu'] = 500;
  47300. t['igrave'] = 278;
  47301. t['ohungarumlaut'] = 500;
  47302. t['Eogonek'] = 611;
  47303. t['dcroat'] = 500;
  47304. t['threequarters'] = 750;
  47305. t['Scedilla'] = 556;
  47306. t['lcaron'] = 344;
  47307. t['Kcommaaccent'] = 722;
  47308. t['Lacute'] = 611;
  47309. t['trademark'] = 980;
  47310. t['edotaccent'] = 444;
  47311. t['Igrave'] = 333;
  47312. t['Imacron'] = 333;
  47313. t['Lcaron'] = 611;
  47314. t['onehalf'] = 750;
  47315. t['lessequal'] = 549;
  47316. t['ocircumflex'] = 500;
  47317. t['ntilde'] = 500;
  47318. t['Uhungarumlaut'] = 722;
  47319. t['Eacute'] = 611;
  47320. t['emacron'] = 444;
  47321. t['gbreve'] = 500;
  47322. t['onequarter'] = 750;
  47323. t['Scaron'] = 556;
  47324. t['Scommaaccent'] = 556;
  47325. t['Ohungarumlaut'] = 722;
  47326. t['degree'] = 400;
  47327. t['ograve'] = 500;
  47328. t['Ccaron'] = 667;
  47329. t['ugrave'] = 500;
  47330. t['radical'] = 453;
  47331. t['Dcaron'] = 722;
  47332. t['rcommaaccent'] = 333;
  47333. t['Ntilde'] = 722;
  47334. t['otilde'] = 500;
  47335. t['Rcommaaccent'] = 667;
  47336. t['Lcommaaccent'] = 611;
  47337. t['Atilde'] = 722;
  47338. t['Aogonek'] = 722;
  47339. t['Aring'] = 722;
  47340. t['Otilde'] = 722;
  47341. t['zdotaccent'] = 444;
  47342. t['Ecaron'] = 611;
  47343. t['Iogonek'] = 333;
  47344. t['kcommaaccent'] = 500;
  47345. t['minus'] = 564;
  47346. t['Icircumflex'] = 333;
  47347. t['ncaron'] = 500;
  47348. t['tcommaaccent'] = 278;
  47349. t['logicalnot'] = 564;
  47350. t['odieresis'] = 500;
  47351. t['udieresis'] = 500;
  47352. t['notequal'] = 549;
  47353. t['gcommaaccent'] = 500;
  47354. t['eth'] = 500;
  47355. t['zcaron'] = 444;
  47356. t['ncommaaccent'] = 500;
  47357. t['onesuperior'] = 300;
  47358. t['imacron'] = 278;
  47359. t['Euro'] = 500;
  47360. });
  47361. t['Times-Bold'] = getLookupTableFactory(function (t) {
  47362. t['space'] = 250;
  47363. t['exclam'] = 333;
  47364. t['quotedbl'] = 555;
  47365. t['numbersign'] = 500;
  47366. t['dollar'] = 500;
  47367. t['percent'] = 1000;
  47368. t['ampersand'] = 833;
  47369. t['quoteright'] = 333;
  47370. t['parenleft'] = 333;
  47371. t['parenright'] = 333;
  47372. t['asterisk'] = 500;
  47373. t['plus'] = 570;
  47374. t['comma'] = 250;
  47375. t['hyphen'] = 333;
  47376. t['period'] = 250;
  47377. t['slash'] = 278;
  47378. t['zero'] = 500;
  47379. t['one'] = 500;
  47380. t['two'] = 500;
  47381. t['three'] = 500;
  47382. t['four'] = 500;
  47383. t['five'] = 500;
  47384. t['six'] = 500;
  47385. t['seven'] = 500;
  47386. t['eight'] = 500;
  47387. t['nine'] = 500;
  47388. t['colon'] = 333;
  47389. t['semicolon'] = 333;
  47390. t['less'] = 570;
  47391. t['equal'] = 570;
  47392. t['greater'] = 570;
  47393. t['question'] = 500;
  47394. t['at'] = 930;
  47395. t['A'] = 722;
  47396. t['B'] = 667;
  47397. t['C'] = 722;
  47398. t['D'] = 722;
  47399. t['E'] = 667;
  47400. t['F'] = 611;
  47401. t['G'] = 778;
  47402. t['H'] = 778;
  47403. t['I'] = 389;
  47404. t['J'] = 500;
  47405. t['K'] = 778;
  47406. t['L'] = 667;
  47407. t['M'] = 944;
  47408. t['N'] = 722;
  47409. t['O'] = 778;
  47410. t['P'] = 611;
  47411. t['Q'] = 778;
  47412. t['R'] = 722;
  47413. t['S'] = 556;
  47414. t['T'] = 667;
  47415. t['U'] = 722;
  47416. t['V'] = 722;
  47417. t['W'] = 1000;
  47418. t['X'] = 722;
  47419. t['Y'] = 722;
  47420. t['Z'] = 667;
  47421. t['bracketleft'] = 333;
  47422. t['backslash'] = 278;
  47423. t['bracketright'] = 333;
  47424. t['asciicircum'] = 581;
  47425. t['underscore'] = 500;
  47426. t['quoteleft'] = 333;
  47427. t['a'] = 500;
  47428. t['b'] = 556;
  47429. t['c'] = 444;
  47430. t['d'] = 556;
  47431. t['e'] = 444;
  47432. t['f'] = 333;
  47433. t['g'] = 500;
  47434. t['h'] = 556;
  47435. t['i'] = 278;
  47436. t['j'] = 333;
  47437. t['k'] = 556;
  47438. t['l'] = 278;
  47439. t['m'] = 833;
  47440. t['n'] = 556;
  47441. t['o'] = 500;
  47442. t['p'] = 556;
  47443. t['q'] = 556;
  47444. t['r'] = 444;
  47445. t['s'] = 389;
  47446. t['t'] = 333;
  47447. t['u'] = 556;
  47448. t['v'] = 500;
  47449. t['w'] = 722;
  47450. t['x'] = 500;
  47451. t['y'] = 500;
  47452. t['z'] = 444;
  47453. t['braceleft'] = 394;
  47454. t['bar'] = 220;
  47455. t['braceright'] = 394;
  47456. t['asciitilde'] = 520;
  47457. t['exclamdown'] = 333;
  47458. t['cent'] = 500;
  47459. t['sterling'] = 500;
  47460. t['fraction'] = 167;
  47461. t['yen'] = 500;
  47462. t['florin'] = 500;
  47463. t['section'] = 500;
  47464. t['currency'] = 500;
  47465. t['quotesingle'] = 278;
  47466. t['quotedblleft'] = 500;
  47467. t['guillemotleft'] = 500;
  47468. t['guilsinglleft'] = 333;
  47469. t['guilsinglright'] = 333;
  47470. t['fi'] = 556;
  47471. t['fl'] = 556;
  47472. t['endash'] = 500;
  47473. t['dagger'] = 500;
  47474. t['daggerdbl'] = 500;
  47475. t['periodcentered'] = 250;
  47476. t['paragraph'] = 540;
  47477. t['bullet'] = 350;
  47478. t['quotesinglbase'] = 333;
  47479. t['quotedblbase'] = 500;
  47480. t['quotedblright'] = 500;
  47481. t['guillemotright'] = 500;
  47482. t['ellipsis'] = 1000;
  47483. t['perthousand'] = 1000;
  47484. t['questiondown'] = 500;
  47485. t['grave'] = 333;
  47486. t['acute'] = 333;
  47487. t['circumflex'] = 333;
  47488. t['tilde'] = 333;
  47489. t['macron'] = 333;
  47490. t['breve'] = 333;
  47491. t['dotaccent'] = 333;
  47492. t['dieresis'] = 333;
  47493. t['ring'] = 333;
  47494. t['cedilla'] = 333;
  47495. t['hungarumlaut'] = 333;
  47496. t['ogonek'] = 333;
  47497. t['caron'] = 333;
  47498. t['emdash'] = 1000;
  47499. t['AE'] = 1000;
  47500. t['ordfeminine'] = 300;
  47501. t['Lslash'] = 667;
  47502. t['Oslash'] = 778;
  47503. t['OE'] = 1000;
  47504. t['ordmasculine'] = 330;
  47505. t['ae'] = 722;
  47506. t['dotlessi'] = 278;
  47507. t['lslash'] = 278;
  47508. t['oslash'] = 500;
  47509. t['oe'] = 722;
  47510. t['germandbls'] = 556;
  47511. t['Idieresis'] = 389;
  47512. t['eacute'] = 444;
  47513. t['abreve'] = 500;
  47514. t['uhungarumlaut'] = 556;
  47515. t['ecaron'] = 444;
  47516. t['Ydieresis'] = 722;
  47517. t['divide'] = 570;
  47518. t['Yacute'] = 722;
  47519. t['Acircumflex'] = 722;
  47520. t['aacute'] = 500;
  47521. t['Ucircumflex'] = 722;
  47522. t['yacute'] = 500;
  47523. t['scommaaccent'] = 389;
  47524. t['ecircumflex'] = 444;
  47525. t['Uring'] = 722;
  47526. t['Udieresis'] = 722;
  47527. t['aogonek'] = 500;
  47528. t['Uacute'] = 722;
  47529. t['uogonek'] = 556;
  47530. t['Edieresis'] = 667;
  47531. t['Dcroat'] = 722;
  47532. t['commaaccent'] = 250;
  47533. t['copyright'] = 747;
  47534. t['Emacron'] = 667;
  47535. t['ccaron'] = 444;
  47536. t['aring'] = 500;
  47537. t['Ncommaaccent'] = 722;
  47538. t['lacute'] = 278;
  47539. t['agrave'] = 500;
  47540. t['Tcommaaccent'] = 667;
  47541. t['Cacute'] = 722;
  47542. t['atilde'] = 500;
  47543. t['Edotaccent'] = 667;
  47544. t['scaron'] = 389;
  47545. t['scedilla'] = 389;
  47546. t['iacute'] = 278;
  47547. t['lozenge'] = 494;
  47548. t['Rcaron'] = 722;
  47549. t['Gcommaaccent'] = 778;
  47550. t['ucircumflex'] = 556;
  47551. t['acircumflex'] = 500;
  47552. t['Amacron'] = 722;
  47553. t['rcaron'] = 444;
  47554. t['ccedilla'] = 444;
  47555. t['Zdotaccent'] = 667;
  47556. t['Thorn'] = 611;
  47557. t['Omacron'] = 778;
  47558. t['Racute'] = 722;
  47559. t['Sacute'] = 556;
  47560. t['dcaron'] = 672;
  47561. t['Umacron'] = 722;
  47562. t['uring'] = 556;
  47563. t['threesuperior'] = 300;
  47564. t['Ograve'] = 778;
  47565. t['Agrave'] = 722;
  47566. t['Abreve'] = 722;
  47567. t['multiply'] = 570;
  47568. t['uacute'] = 556;
  47569. t['Tcaron'] = 667;
  47570. t['partialdiff'] = 494;
  47571. t['ydieresis'] = 500;
  47572. t['Nacute'] = 722;
  47573. t['icircumflex'] = 278;
  47574. t['Ecircumflex'] = 667;
  47575. t['adieresis'] = 500;
  47576. t['edieresis'] = 444;
  47577. t['cacute'] = 444;
  47578. t['nacute'] = 556;
  47579. t['umacron'] = 556;
  47580. t['Ncaron'] = 722;
  47581. t['Iacute'] = 389;
  47582. t['plusminus'] = 570;
  47583. t['brokenbar'] = 220;
  47584. t['registered'] = 747;
  47585. t['Gbreve'] = 778;
  47586. t['Idotaccent'] = 389;
  47587. t['summation'] = 600;
  47588. t['Egrave'] = 667;
  47589. t['racute'] = 444;
  47590. t['omacron'] = 500;
  47591. t['Zacute'] = 667;
  47592. t['Zcaron'] = 667;
  47593. t['greaterequal'] = 549;
  47594. t['Eth'] = 722;
  47595. t['Ccedilla'] = 722;
  47596. t['lcommaaccent'] = 278;
  47597. t['tcaron'] = 416;
  47598. t['eogonek'] = 444;
  47599. t['Uogonek'] = 722;
  47600. t['Aacute'] = 722;
  47601. t['Adieresis'] = 722;
  47602. t['egrave'] = 444;
  47603. t['zacute'] = 444;
  47604. t['iogonek'] = 278;
  47605. t['Oacute'] = 778;
  47606. t['oacute'] = 500;
  47607. t['amacron'] = 500;
  47608. t['sacute'] = 389;
  47609. t['idieresis'] = 278;
  47610. t['Ocircumflex'] = 778;
  47611. t['Ugrave'] = 722;
  47612. t['Delta'] = 612;
  47613. t['thorn'] = 556;
  47614. t['twosuperior'] = 300;
  47615. t['Odieresis'] = 778;
  47616. t['mu'] = 556;
  47617. t['igrave'] = 278;
  47618. t['ohungarumlaut'] = 500;
  47619. t['Eogonek'] = 667;
  47620. t['dcroat'] = 556;
  47621. t['threequarters'] = 750;
  47622. t['Scedilla'] = 556;
  47623. t['lcaron'] = 394;
  47624. t['Kcommaaccent'] = 778;
  47625. t['Lacute'] = 667;
  47626. t['trademark'] = 1000;
  47627. t['edotaccent'] = 444;
  47628. t['Igrave'] = 389;
  47629. t['Imacron'] = 389;
  47630. t['Lcaron'] = 667;
  47631. t['onehalf'] = 750;
  47632. t['lessequal'] = 549;
  47633. t['ocircumflex'] = 500;
  47634. t['ntilde'] = 556;
  47635. t['Uhungarumlaut'] = 722;
  47636. t['Eacute'] = 667;
  47637. t['emacron'] = 444;
  47638. t['gbreve'] = 500;
  47639. t['onequarter'] = 750;
  47640. t['Scaron'] = 556;
  47641. t['Scommaaccent'] = 556;
  47642. t['Ohungarumlaut'] = 778;
  47643. t['degree'] = 400;
  47644. t['ograve'] = 500;
  47645. t['Ccaron'] = 722;
  47646. t['ugrave'] = 556;
  47647. t['radical'] = 549;
  47648. t['Dcaron'] = 722;
  47649. t['rcommaaccent'] = 444;
  47650. t['Ntilde'] = 722;
  47651. t['otilde'] = 500;
  47652. t['Rcommaaccent'] = 722;
  47653. t['Lcommaaccent'] = 667;
  47654. t['Atilde'] = 722;
  47655. t['Aogonek'] = 722;
  47656. t['Aring'] = 722;
  47657. t['Otilde'] = 778;
  47658. t['zdotaccent'] = 444;
  47659. t['Ecaron'] = 667;
  47660. t['Iogonek'] = 389;
  47661. t['kcommaaccent'] = 556;
  47662. t['minus'] = 570;
  47663. t['Icircumflex'] = 389;
  47664. t['ncaron'] = 556;
  47665. t['tcommaaccent'] = 333;
  47666. t['logicalnot'] = 570;
  47667. t['odieresis'] = 500;
  47668. t['udieresis'] = 556;
  47669. t['notequal'] = 549;
  47670. t['gcommaaccent'] = 500;
  47671. t['eth'] = 500;
  47672. t['zcaron'] = 444;
  47673. t['ncommaaccent'] = 556;
  47674. t['onesuperior'] = 300;
  47675. t['imacron'] = 278;
  47676. t['Euro'] = 500;
  47677. });
  47678. t['Times-BoldItalic'] = getLookupTableFactory(function (t) {
  47679. t['space'] = 250;
  47680. t['exclam'] = 389;
  47681. t['quotedbl'] = 555;
  47682. t['numbersign'] = 500;
  47683. t['dollar'] = 500;
  47684. t['percent'] = 833;
  47685. t['ampersand'] = 778;
  47686. t['quoteright'] = 333;
  47687. t['parenleft'] = 333;
  47688. t['parenright'] = 333;
  47689. t['asterisk'] = 500;
  47690. t['plus'] = 570;
  47691. t['comma'] = 250;
  47692. t['hyphen'] = 333;
  47693. t['period'] = 250;
  47694. t['slash'] = 278;
  47695. t['zero'] = 500;
  47696. t['one'] = 500;
  47697. t['two'] = 500;
  47698. t['three'] = 500;
  47699. t['four'] = 500;
  47700. t['five'] = 500;
  47701. t['six'] = 500;
  47702. t['seven'] = 500;
  47703. t['eight'] = 500;
  47704. t['nine'] = 500;
  47705. t['colon'] = 333;
  47706. t['semicolon'] = 333;
  47707. t['less'] = 570;
  47708. t['equal'] = 570;
  47709. t['greater'] = 570;
  47710. t['question'] = 500;
  47711. t['at'] = 832;
  47712. t['A'] = 667;
  47713. t['B'] = 667;
  47714. t['C'] = 667;
  47715. t['D'] = 722;
  47716. t['E'] = 667;
  47717. t['F'] = 667;
  47718. t['G'] = 722;
  47719. t['H'] = 778;
  47720. t['I'] = 389;
  47721. t['J'] = 500;
  47722. t['K'] = 667;
  47723. t['L'] = 611;
  47724. t['M'] = 889;
  47725. t['N'] = 722;
  47726. t['O'] = 722;
  47727. t['P'] = 611;
  47728. t['Q'] = 722;
  47729. t['R'] = 667;
  47730. t['S'] = 556;
  47731. t['T'] = 611;
  47732. t['U'] = 722;
  47733. t['V'] = 667;
  47734. t['W'] = 889;
  47735. t['X'] = 667;
  47736. t['Y'] = 611;
  47737. t['Z'] = 611;
  47738. t['bracketleft'] = 333;
  47739. t['backslash'] = 278;
  47740. t['bracketright'] = 333;
  47741. t['asciicircum'] = 570;
  47742. t['underscore'] = 500;
  47743. t['quoteleft'] = 333;
  47744. t['a'] = 500;
  47745. t['b'] = 500;
  47746. t['c'] = 444;
  47747. t['d'] = 500;
  47748. t['e'] = 444;
  47749. t['f'] = 333;
  47750. t['g'] = 500;
  47751. t['h'] = 556;
  47752. t['i'] = 278;
  47753. t['j'] = 278;
  47754. t['k'] = 500;
  47755. t['l'] = 278;
  47756. t['m'] = 778;
  47757. t['n'] = 556;
  47758. t['o'] = 500;
  47759. t['p'] = 500;
  47760. t['q'] = 500;
  47761. t['r'] = 389;
  47762. t['s'] = 389;
  47763. t['t'] = 278;
  47764. t['u'] = 556;
  47765. t['v'] = 444;
  47766. t['w'] = 667;
  47767. t['x'] = 500;
  47768. t['y'] = 444;
  47769. t['z'] = 389;
  47770. t['braceleft'] = 348;
  47771. t['bar'] = 220;
  47772. t['braceright'] = 348;
  47773. t['asciitilde'] = 570;
  47774. t['exclamdown'] = 389;
  47775. t['cent'] = 500;
  47776. t['sterling'] = 500;
  47777. t['fraction'] = 167;
  47778. t['yen'] = 500;
  47779. t['florin'] = 500;
  47780. t['section'] = 500;
  47781. t['currency'] = 500;
  47782. t['quotesingle'] = 278;
  47783. t['quotedblleft'] = 500;
  47784. t['guillemotleft'] = 500;
  47785. t['guilsinglleft'] = 333;
  47786. t['guilsinglright'] = 333;
  47787. t['fi'] = 556;
  47788. t['fl'] = 556;
  47789. t['endash'] = 500;
  47790. t['dagger'] = 500;
  47791. t['daggerdbl'] = 500;
  47792. t['periodcentered'] = 250;
  47793. t['paragraph'] = 500;
  47794. t['bullet'] = 350;
  47795. t['quotesinglbase'] = 333;
  47796. t['quotedblbase'] = 500;
  47797. t['quotedblright'] = 500;
  47798. t['guillemotright'] = 500;
  47799. t['ellipsis'] = 1000;
  47800. t['perthousand'] = 1000;
  47801. t['questiondown'] = 500;
  47802. t['grave'] = 333;
  47803. t['acute'] = 333;
  47804. t['circumflex'] = 333;
  47805. t['tilde'] = 333;
  47806. t['macron'] = 333;
  47807. t['breve'] = 333;
  47808. t['dotaccent'] = 333;
  47809. t['dieresis'] = 333;
  47810. t['ring'] = 333;
  47811. t['cedilla'] = 333;
  47812. t['hungarumlaut'] = 333;
  47813. t['ogonek'] = 333;
  47814. t['caron'] = 333;
  47815. t['emdash'] = 1000;
  47816. t['AE'] = 944;
  47817. t['ordfeminine'] = 266;
  47818. t['Lslash'] = 611;
  47819. t['Oslash'] = 722;
  47820. t['OE'] = 944;
  47821. t['ordmasculine'] = 300;
  47822. t['ae'] = 722;
  47823. t['dotlessi'] = 278;
  47824. t['lslash'] = 278;
  47825. t['oslash'] = 500;
  47826. t['oe'] = 722;
  47827. t['germandbls'] = 500;
  47828. t['Idieresis'] = 389;
  47829. t['eacute'] = 444;
  47830. t['abreve'] = 500;
  47831. t['uhungarumlaut'] = 556;
  47832. t['ecaron'] = 444;
  47833. t['Ydieresis'] = 611;
  47834. t['divide'] = 570;
  47835. t['Yacute'] = 611;
  47836. t['Acircumflex'] = 667;
  47837. t['aacute'] = 500;
  47838. t['Ucircumflex'] = 722;
  47839. t['yacute'] = 444;
  47840. t['scommaaccent'] = 389;
  47841. t['ecircumflex'] = 444;
  47842. t['Uring'] = 722;
  47843. t['Udieresis'] = 722;
  47844. t['aogonek'] = 500;
  47845. t['Uacute'] = 722;
  47846. t['uogonek'] = 556;
  47847. t['Edieresis'] = 667;
  47848. t['Dcroat'] = 722;
  47849. t['commaaccent'] = 250;
  47850. t['copyright'] = 747;
  47851. t['Emacron'] = 667;
  47852. t['ccaron'] = 444;
  47853. t['aring'] = 500;
  47854. t['Ncommaaccent'] = 722;
  47855. t['lacute'] = 278;
  47856. t['agrave'] = 500;
  47857. t['Tcommaaccent'] = 611;
  47858. t['Cacute'] = 667;
  47859. t['atilde'] = 500;
  47860. t['Edotaccent'] = 667;
  47861. t['scaron'] = 389;
  47862. t['scedilla'] = 389;
  47863. t['iacute'] = 278;
  47864. t['lozenge'] = 494;
  47865. t['Rcaron'] = 667;
  47866. t['Gcommaaccent'] = 722;
  47867. t['ucircumflex'] = 556;
  47868. t['acircumflex'] = 500;
  47869. t['Amacron'] = 667;
  47870. t['rcaron'] = 389;
  47871. t['ccedilla'] = 444;
  47872. t['Zdotaccent'] = 611;
  47873. t['Thorn'] = 611;
  47874. t['Omacron'] = 722;
  47875. t['Racute'] = 667;
  47876. t['Sacute'] = 556;
  47877. t['dcaron'] = 608;
  47878. t['Umacron'] = 722;
  47879. t['uring'] = 556;
  47880. t['threesuperior'] = 300;
  47881. t['Ograve'] = 722;
  47882. t['Agrave'] = 667;
  47883. t['Abreve'] = 667;
  47884. t['multiply'] = 570;
  47885. t['uacute'] = 556;
  47886. t['Tcaron'] = 611;
  47887. t['partialdiff'] = 494;
  47888. t['ydieresis'] = 444;
  47889. t['Nacute'] = 722;
  47890. t['icircumflex'] = 278;
  47891. t['Ecircumflex'] = 667;
  47892. t['adieresis'] = 500;
  47893. t['edieresis'] = 444;
  47894. t['cacute'] = 444;
  47895. t['nacute'] = 556;
  47896. t['umacron'] = 556;
  47897. t['Ncaron'] = 722;
  47898. t['Iacute'] = 389;
  47899. t['plusminus'] = 570;
  47900. t['brokenbar'] = 220;
  47901. t['registered'] = 747;
  47902. t['Gbreve'] = 722;
  47903. t['Idotaccent'] = 389;
  47904. t['summation'] = 600;
  47905. t['Egrave'] = 667;
  47906. t['racute'] = 389;
  47907. t['omacron'] = 500;
  47908. t['Zacute'] = 611;
  47909. t['Zcaron'] = 611;
  47910. t['greaterequal'] = 549;
  47911. t['Eth'] = 722;
  47912. t['Ccedilla'] = 667;
  47913. t['lcommaaccent'] = 278;
  47914. t['tcaron'] = 366;
  47915. t['eogonek'] = 444;
  47916. t['Uogonek'] = 722;
  47917. t['Aacute'] = 667;
  47918. t['Adieresis'] = 667;
  47919. t['egrave'] = 444;
  47920. t['zacute'] = 389;
  47921. t['iogonek'] = 278;
  47922. t['Oacute'] = 722;
  47923. t['oacute'] = 500;
  47924. t['amacron'] = 500;
  47925. t['sacute'] = 389;
  47926. t['idieresis'] = 278;
  47927. t['Ocircumflex'] = 722;
  47928. t['Ugrave'] = 722;
  47929. t['Delta'] = 612;
  47930. t['thorn'] = 500;
  47931. t['twosuperior'] = 300;
  47932. t['Odieresis'] = 722;
  47933. t['mu'] = 576;
  47934. t['igrave'] = 278;
  47935. t['ohungarumlaut'] = 500;
  47936. t['Eogonek'] = 667;
  47937. t['dcroat'] = 500;
  47938. t['threequarters'] = 750;
  47939. t['Scedilla'] = 556;
  47940. t['lcaron'] = 382;
  47941. t['Kcommaaccent'] = 667;
  47942. t['Lacute'] = 611;
  47943. t['trademark'] = 1000;
  47944. t['edotaccent'] = 444;
  47945. t['Igrave'] = 389;
  47946. t['Imacron'] = 389;
  47947. t['Lcaron'] = 611;
  47948. t['onehalf'] = 750;
  47949. t['lessequal'] = 549;
  47950. t['ocircumflex'] = 500;
  47951. t['ntilde'] = 556;
  47952. t['Uhungarumlaut'] = 722;
  47953. t['Eacute'] = 667;
  47954. t['emacron'] = 444;
  47955. t['gbreve'] = 500;
  47956. t['onequarter'] = 750;
  47957. t['Scaron'] = 556;
  47958. t['Scommaaccent'] = 556;
  47959. t['Ohungarumlaut'] = 722;
  47960. t['degree'] = 400;
  47961. t['ograve'] = 500;
  47962. t['Ccaron'] = 667;
  47963. t['ugrave'] = 556;
  47964. t['radical'] = 549;
  47965. t['Dcaron'] = 722;
  47966. t['rcommaaccent'] = 389;
  47967. t['Ntilde'] = 722;
  47968. t['otilde'] = 500;
  47969. t['Rcommaaccent'] = 667;
  47970. t['Lcommaaccent'] = 611;
  47971. t['Atilde'] = 667;
  47972. t['Aogonek'] = 667;
  47973. t['Aring'] = 667;
  47974. t['Otilde'] = 722;
  47975. t['zdotaccent'] = 389;
  47976. t['Ecaron'] = 667;
  47977. t['Iogonek'] = 389;
  47978. t['kcommaaccent'] = 500;
  47979. t['minus'] = 606;
  47980. t['Icircumflex'] = 389;
  47981. t['ncaron'] = 556;
  47982. t['tcommaaccent'] = 278;
  47983. t['logicalnot'] = 606;
  47984. t['odieresis'] = 500;
  47985. t['udieresis'] = 556;
  47986. t['notequal'] = 549;
  47987. t['gcommaaccent'] = 500;
  47988. t['eth'] = 500;
  47989. t['zcaron'] = 389;
  47990. t['ncommaaccent'] = 556;
  47991. t['onesuperior'] = 300;
  47992. t['imacron'] = 278;
  47993. t['Euro'] = 500;
  47994. });
  47995. t['Times-Italic'] = getLookupTableFactory(function (t) {
  47996. t['space'] = 250;
  47997. t['exclam'] = 333;
  47998. t['quotedbl'] = 420;
  47999. t['numbersign'] = 500;
  48000. t['dollar'] = 500;
  48001. t['percent'] = 833;
  48002. t['ampersand'] = 778;
  48003. t['quoteright'] = 333;
  48004. t['parenleft'] = 333;
  48005. t['parenright'] = 333;
  48006. t['asterisk'] = 500;
  48007. t['plus'] = 675;
  48008. t['comma'] = 250;
  48009. t['hyphen'] = 333;
  48010. t['period'] = 250;
  48011. t['slash'] = 278;
  48012. t['zero'] = 500;
  48013. t['one'] = 500;
  48014. t['two'] = 500;
  48015. t['three'] = 500;
  48016. t['four'] = 500;
  48017. t['five'] = 500;
  48018. t['six'] = 500;
  48019. t['seven'] = 500;
  48020. t['eight'] = 500;
  48021. t['nine'] = 500;
  48022. t['colon'] = 333;
  48023. t['semicolon'] = 333;
  48024. t['less'] = 675;
  48025. t['equal'] = 675;
  48026. t['greater'] = 675;
  48027. t['question'] = 500;
  48028. t['at'] = 920;
  48029. t['A'] = 611;
  48030. t['B'] = 611;
  48031. t['C'] = 667;
  48032. t['D'] = 722;
  48033. t['E'] = 611;
  48034. t['F'] = 611;
  48035. t['G'] = 722;
  48036. t['H'] = 722;
  48037. t['I'] = 333;
  48038. t['J'] = 444;
  48039. t['K'] = 667;
  48040. t['L'] = 556;
  48041. t['M'] = 833;
  48042. t['N'] = 667;
  48043. t['O'] = 722;
  48044. t['P'] = 611;
  48045. t['Q'] = 722;
  48046. t['R'] = 611;
  48047. t['S'] = 500;
  48048. t['T'] = 556;
  48049. t['U'] = 722;
  48050. t['V'] = 611;
  48051. t['W'] = 833;
  48052. t['X'] = 611;
  48053. t['Y'] = 556;
  48054. t['Z'] = 556;
  48055. t['bracketleft'] = 389;
  48056. t['backslash'] = 278;
  48057. t['bracketright'] = 389;
  48058. t['asciicircum'] = 422;
  48059. t['underscore'] = 500;
  48060. t['quoteleft'] = 333;
  48061. t['a'] = 500;
  48062. t['b'] = 500;
  48063. t['c'] = 444;
  48064. t['d'] = 500;
  48065. t['e'] = 444;
  48066. t['f'] = 278;
  48067. t['g'] = 500;
  48068. t['h'] = 500;
  48069. t['i'] = 278;
  48070. t['j'] = 278;
  48071. t['k'] = 444;
  48072. t['l'] = 278;
  48073. t['m'] = 722;
  48074. t['n'] = 500;
  48075. t['o'] = 500;
  48076. t['p'] = 500;
  48077. t['q'] = 500;
  48078. t['r'] = 389;
  48079. t['s'] = 389;
  48080. t['t'] = 278;
  48081. t['u'] = 500;
  48082. t['v'] = 444;
  48083. t['w'] = 667;
  48084. t['x'] = 444;
  48085. t['y'] = 444;
  48086. t['z'] = 389;
  48087. t['braceleft'] = 400;
  48088. t['bar'] = 275;
  48089. t['braceright'] = 400;
  48090. t['asciitilde'] = 541;
  48091. t['exclamdown'] = 389;
  48092. t['cent'] = 500;
  48093. t['sterling'] = 500;
  48094. t['fraction'] = 167;
  48095. t['yen'] = 500;
  48096. t['florin'] = 500;
  48097. t['section'] = 500;
  48098. t['currency'] = 500;
  48099. t['quotesingle'] = 214;
  48100. t['quotedblleft'] = 556;
  48101. t['guillemotleft'] = 500;
  48102. t['guilsinglleft'] = 333;
  48103. t['guilsinglright'] = 333;
  48104. t['fi'] = 500;
  48105. t['fl'] = 500;
  48106. t['endash'] = 500;
  48107. t['dagger'] = 500;
  48108. t['daggerdbl'] = 500;
  48109. t['periodcentered'] = 250;
  48110. t['paragraph'] = 523;
  48111. t['bullet'] = 350;
  48112. t['quotesinglbase'] = 333;
  48113. t['quotedblbase'] = 556;
  48114. t['quotedblright'] = 556;
  48115. t['guillemotright'] = 500;
  48116. t['ellipsis'] = 889;
  48117. t['perthousand'] = 1000;
  48118. t['questiondown'] = 500;
  48119. t['grave'] = 333;
  48120. t['acute'] = 333;
  48121. t['circumflex'] = 333;
  48122. t['tilde'] = 333;
  48123. t['macron'] = 333;
  48124. t['breve'] = 333;
  48125. t['dotaccent'] = 333;
  48126. t['dieresis'] = 333;
  48127. t['ring'] = 333;
  48128. t['cedilla'] = 333;
  48129. t['hungarumlaut'] = 333;
  48130. t['ogonek'] = 333;
  48131. t['caron'] = 333;
  48132. t['emdash'] = 889;
  48133. t['AE'] = 889;
  48134. t['ordfeminine'] = 276;
  48135. t['Lslash'] = 556;
  48136. t['Oslash'] = 722;
  48137. t['OE'] = 944;
  48138. t['ordmasculine'] = 310;
  48139. t['ae'] = 667;
  48140. t['dotlessi'] = 278;
  48141. t['lslash'] = 278;
  48142. t['oslash'] = 500;
  48143. t['oe'] = 667;
  48144. t['germandbls'] = 500;
  48145. t['Idieresis'] = 333;
  48146. t['eacute'] = 444;
  48147. t['abreve'] = 500;
  48148. t['uhungarumlaut'] = 500;
  48149. t['ecaron'] = 444;
  48150. t['Ydieresis'] = 556;
  48151. t['divide'] = 675;
  48152. t['Yacute'] = 556;
  48153. t['Acircumflex'] = 611;
  48154. t['aacute'] = 500;
  48155. t['Ucircumflex'] = 722;
  48156. t['yacute'] = 444;
  48157. t['scommaaccent'] = 389;
  48158. t['ecircumflex'] = 444;
  48159. t['Uring'] = 722;
  48160. t['Udieresis'] = 722;
  48161. t['aogonek'] = 500;
  48162. t['Uacute'] = 722;
  48163. t['uogonek'] = 500;
  48164. t['Edieresis'] = 611;
  48165. t['Dcroat'] = 722;
  48166. t['commaaccent'] = 250;
  48167. t['copyright'] = 760;
  48168. t['Emacron'] = 611;
  48169. t['ccaron'] = 444;
  48170. t['aring'] = 500;
  48171. t['Ncommaaccent'] = 667;
  48172. t['lacute'] = 278;
  48173. t['agrave'] = 500;
  48174. t['Tcommaaccent'] = 556;
  48175. t['Cacute'] = 667;
  48176. t['atilde'] = 500;
  48177. t['Edotaccent'] = 611;
  48178. t['scaron'] = 389;
  48179. t['scedilla'] = 389;
  48180. t['iacute'] = 278;
  48181. t['lozenge'] = 471;
  48182. t['Rcaron'] = 611;
  48183. t['Gcommaaccent'] = 722;
  48184. t['ucircumflex'] = 500;
  48185. t['acircumflex'] = 500;
  48186. t['Amacron'] = 611;
  48187. t['rcaron'] = 389;
  48188. t['ccedilla'] = 444;
  48189. t['Zdotaccent'] = 556;
  48190. t['Thorn'] = 611;
  48191. t['Omacron'] = 722;
  48192. t['Racute'] = 611;
  48193. t['Sacute'] = 500;
  48194. t['dcaron'] = 544;
  48195. t['Umacron'] = 722;
  48196. t['uring'] = 500;
  48197. t['threesuperior'] = 300;
  48198. t['Ograve'] = 722;
  48199. t['Agrave'] = 611;
  48200. t['Abreve'] = 611;
  48201. t['multiply'] = 675;
  48202. t['uacute'] = 500;
  48203. t['Tcaron'] = 556;
  48204. t['partialdiff'] = 476;
  48205. t['ydieresis'] = 444;
  48206. t['Nacute'] = 667;
  48207. t['icircumflex'] = 278;
  48208. t['Ecircumflex'] = 611;
  48209. t['adieresis'] = 500;
  48210. t['edieresis'] = 444;
  48211. t['cacute'] = 444;
  48212. t['nacute'] = 500;
  48213. t['umacron'] = 500;
  48214. t['Ncaron'] = 667;
  48215. t['Iacute'] = 333;
  48216. t['plusminus'] = 675;
  48217. t['brokenbar'] = 275;
  48218. t['registered'] = 760;
  48219. t['Gbreve'] = 722;
  48220. t['Idotaccent'] = 333;
  48221. t['summation'] = 600;
  48222. t['Egrave'] = 611;
  48223. t['racute'] = 389;
  48224. t['omacron'] = 500;
  48225. t['Zacute'] = 556;
  48226. t['Zcaron'] = 556;
  48227. t['greaterequal'] = 549;
  48228. t['Eth'] = 722;
  48229. t['Ccedilla'] = 667;
  48230. t['lcommaaccent'] = 278;
  48231. t['tcaron'] = 300;
  48232. t['eogonek'] = 444;
  48233. t['Uogonek'] = 722;
  48234. t['Aacute'] = 611;
  48235. t['Adieresis'] = 611;
  48236. t['egrave'] = 444;
  48237. t['zacute'] = 389;
  48238. t['iogonek'] = 278;
  48239. t['Oacute'] = 722;
  48240. t['oacute'] = 500;
  48241. t['amacron'] = 500;
  48242. t['sacute'] = 389;
  48243. t['idieresis'] = 278;
  48244. t['Ocircumflex'] = 722;
  48245. t['Ugrave'] = 722;
  48246. t['Delta'] = 612;
  48247. t['thorn'] = 500;
  48248. t['twosuperior'] = 300;
  48249. t['Odieresis'] = 722;
  48250. t['mu'] = 500;
  48251. t['igrave'] = 278;
  48252. t['ohungarumlaut'] = 500;
  48253. t['Eogonek'] = 611;
  48254. t['dcroat'] = 500;
  48255. t['threequarters'] = 750;
  48256. t['Scedilla'] = 500;
  48257. t['lcaron'] = 300;
  48258. t['Kcommaaccent'] = 667;
  48259. t['Lacute'] = 556;
  48260. t['trademark'] = 980;
  48261. t['edotaccent'] = 444;
  48262. t['Igrave'] = 333;
  48263. t['Imacron'] = 333;
  48264. t['Lcaron'] = 611;
  48265. t['onehalf'] = 750;
  48266. t['lessequal'] = 549;
  48267. t['ocircumflex'] = 500;
  48268. t['ntilde'] = 500;
  48269. t['Uhungarumlaut'] = 722;
  48270. t['Eacute'] = 611;
  48271. t['emacron'] = 444;
  48272. t['gbreve'] = 500;
  48273. t['onequarter'] = 750;
  48274. t['Scaron'] = 500;
  48275. t['Scommaaccent'] = 500;
  48276. t['Ohungarumlaut'] = 722;
  48277. t['degree'] = 400;
  48278. t['ograve'] = 500;
  48279. t['Ccaron'] = 667;
  48280. t['ugrave'] = 500;
  48281. t['radical'] = 453;
  48282. t['Dcaron'] = 722;
  48283. t['rcommaaccent'] = 389;
  48284. t['Ntilde'] = 667;
  48285. t['otilde'] = 500;
  48286. t['Rcommaaccent'] = 611;
  48287. t['Lcommaaccent'] = 556;
  48288. t['Atilde'] = 611;
  48289. t['Aogonek'] = 611;
  48290. t['Aring'] = 611;
  48291. t['Otilde'] = 722;
  48292. t['zdotaccent'] = 389;
  48293. t['Ecaron'] = 611;
  48294. t['Iogonek'] = 333;
  48295. t['kcommaaccent'] = 444;
  48296. t['minus'] = 675;
  48297. t['Icircumflex'] = 333;
  48298. t['ncaron'] = 500;
  48299. t['tcommaaccent'] = 278;
  48300. t['logicalnot'] = 675;
  48301. t['odieresis'] = 500;
  48302. t['udieresis'] = 500;
  48303. t['notequal'] = 549;
  48304. t['gcommaaccent'] = 500;
  48305. t['eth'] = 500;
  48306. t['zcaron'] = 389;
  48307. t['ncommaaccent'] = 500;
  48308. t['onesuperior'] = 300;
  48309. t['imacron'] = 278;
  48310. t['Euro'] = 500;
  48311. });
  48312. t['ZapfDingbats'] = getLookupTableFactory(function (t) {
  48313. t['space'] = 278;
  48314. t['a1'] = 974;
  48315. t['a2'] = 961;
  48316. t['a202'] = 974;
  48317. t['a3'] = 980;
  48318. t['a4'] = 719;
  48319. t['a5'] = 789;
  48320. t['a119'] = 790;
  48321. t['a118'] = 791;
  48322. t['a117'] = 690;
  48323. t['a11'] = 960;
  48324. t['a12'] = 939;
  48325. t['a13'] = 549;
  48326. t['a14'] = 855;
  48327. t['a15'] = 911;
  48328. t['a16'] = 933;
  48329. t['a105'] = 911;
  48330. t['a17'] = 945;
  48331. t['a18'] = 974;
  48332. t['a19'] = 755;
  48333. t['a20'] = 846;
  48334. t['a21'] = 762;
  48335. t['a22'] = 761;
  48336. t['a23'] = 571;
  48337. t['a24'] = 677;
  48338. t['a25'] = 763;
  48339. t['a26'] = 760;
  48340. t['a27'] = 759;
  48341. t['a28'] = 754;
  48342. t['a6'] = 494;
  48343. t['a7'] = 552;
  48344. t['a8'] = 537;
  48345. t['a9'] = 577;
  48346. t['a10'] = 692;
  48347. t['a29'] = 786;
  48348. t['a30'] = 788;
  48349. t['a31'] = 788;
  48350. t['a32'] = 790;
  48351. t['a33'] = 793;
  48352. t['a34'] = 794;
  48353. t['a35'] = 816;
  48354. t['a36'] = 823;
  48355. t['a37'] = 789;
  48356. t['a38'] = 841;
  48357. t['a39'] = 823;
  48358. t['a40'] = 833;
  48359. t['a41'] = 816;
  48360. t['a42'] = 831;
  48361. t['a43'] = 923;
  48362. t['a44'] = 744;
  48363. t['a45'] = 723;
  48364. t['a46'] = 749;
  48365. t['a47'] = 790;
  48366. t['a48'] = 792;
  48367. t['a49'] = 695;
  48368. t['a50'] = 776;
  48369. t['a51'] = 768;
  48370. t['a52'] = 792;
  48371. t['a53'] = 759;
  48372. t['a54'] = 707;
  48373. t['a55'] = 708;
  48374. t['a56'] = 682;
  48375. t['a57'] = 701;
  48376. t['a58'] = 826;
  48377. t['a59'] = 815;
  48378. t['a60'] = 789;
  48379. t['a61'] = 789;
  48380. t['a62'] = 707;
  48381. t['a63'] = 687;
  48382. t['a64'] = 696;
  48383. t['a65'] = 689;
  48384. t['a66'] = 786;
  48385. t['a67'] = 787;
  48386. t['a68'] = 713;
  48387. t['a69'] = 791;
  48388. t['a70'] = 785;
  48389. t['a71'] = 791;
  48390. t['a72'] = 873;
  48391. t['a73'] = 761;
  48392. t['a74'] = 762;
  48393. t['a203'] = 762;
  48394. t['a75'] = 759;
  48395. t['a204'] = 759;
  48396. t['a76'] = 892;
  48397. t['a77'] = 892;
  48398. t['a78'] = 788;
  48399. t['a79'] = 784;
  48400. t['a81'] = 438;
  48401. t['a82'] = 138;
  48402. t['a83'] = 277;
  48403. t['a84'] = 415;
  48404. t['a97'] = 392;
  48405. t['a98'] = 392;
  48406. t['a99'] = 668;
  48407. t['a100'] = 668;
  48408. t['a89'] = 390;
  48409. t['a90'] = 390;
  48410. t['a93'] = 317;
  48411. t['a94'] = 317;
  48412. t['a91'] = 276;
  48413. t['a92'] = 276;
  48414. t['a205'] = 509;
  48415. t['a85'] = 509;
  48416. t['a206'] = 410;
  48417. t['a86'] = 410;
  48418. t['a87'] = 234;
  48419. t['a88'] = 234;
  48420. t['a95'] = 334;
  48421. t['a96'] = 334;
  48422. t['a101'] = 732;
  48423. t['a102'] = 544;
  48424. t['a103'] = 544;
  48425. t['a104'] = 910;
  48426. t['a106'] = 667;
  48427. t['a107'] = 760;
  48428. t['a108'] = 760;
  48429. t['a112'] = 776;
  48430. t['a111'] = 595;
  48431. t['a110'] = 694;
  48432. t['a109'] = 626;
  48433. t['a120'] = 788;
  48434. t['a121'] = 788;
  48435. t['a122'] = 788;
  48436. t['a123'] = 788;
  48437. t['a124'] = 788;
  48438. t['a125'] = 788;
  48439. t['a126'] = 788;
  48440. t['a127'] = 788;
  48441. t['a128'] = 788;
  48442. t['a129'] = 788;
  48443. t['a130'] = 788;
  48444. t['a131'] = 788;
  48445. t['a132'] = 788;
  48446. t['a133'] = 788;
  48447. t['a134'] = 788;
  48448. t['a135'] = 788;
  48449. t['a136'] = 788;
  48450. t['a137'] = 788;
  48451. t['a138'] = 788;
  48452. t['a139'] = 788;
  48453. t['a140'] = 788;
  48454. t['a141'] = 788;
  48455. t['a142'] = 788;
  48456. t['a143'] = 788;
  48457. t['a144'] = 788;
  48458. t['a145'] = 788;
  48459. t['a146'] = 788;
  48460. t['a147'] = 788;
  48461. t['a148'] = 788;
  48462. t['a149'] = 788;
  48463. t['a150'] = 788;
  48464. t['a151'] = 788;
  48465. t['a152'] = 788;
  48466. t['a153'] = 788;
  48467. t['a154'] = 788;
  48468. t['a155'] = 788;
  48469. t['a156'] = 788;
  48470. t['a157'] = 788;
  48471. t['a158'] = 788;
  48472. t['a159'] = 788;
  48473. t['a160'] = 894;
  48474. t['a161'] = 838;
  48475. t['a163'] = 1016;
  48476. t['a164'] = 458;
  48477. t['a196'] = 748;
  48478. t['a165'] = 924;
  48479. t['a192'] = 748;
  48480. t['a166'] = 918;
  48481. t['a167'] = 927;
  48482. t['a168'] = 928;
  48483. t['a169'] = 928;
  48484. t['a170'] = 834;
  48485. t['a171'] = 873;
  48486. t['a172'] = 828;
  48487. t['a173'] = 924;
  48488. t['a162'] = 924;
  48489. t['a174'] = 917;
  48490. t['a175'] = 930;
  48491. t['a176'] = 931;
  48492. t['a177'] = 463;
  48493. t['a178'] = 883;
  48494. t['a179'] = 836;
  48495. t['a193'] = 836;
  48496. t['a180'] = 867;
  48497. t['a199'] = 867;
  48498. t['a181'] = 696;
  48499. t['a200'] = 696;
  48500. t['a182'] = 874;
  48501. t['a201'] = 874;
  48502. t['a183'] = 760;
  48503. t['a184'] = 946;
  48504. t['a197'] = 771;
  48505. t['a185'] = 865;
  48506. t['a194'] = 771;
  48507. t['a198'] = 888;
  48508. t['a186'] = 967;
  48509. t['a195'] = 888;
  48510. t['a187'] = 831;
  48511. t['a188'] = 873;
  48512. t['a189'] = 927;
  48513. t['a190'] = 970;
  48514. t['a191'] = 918;
  48515. });
  48516. });
  48517. exports.getMetrics = getMetrics;
  48518. /***/ }),
  48519. /* 31 */
  48520. /***/ (function(module, exports, __w_pdfjs_require__) {
  48521. "use strict";
  48522. var sharedUtil = __w_pdfjs_require__(0);
  48523. var Uint32ArrayView = sharedUtil.Uint32ArrayView;
  48524. var MurmurHash3_64 = function MurmurHash3_64Closure(seed) {
  48525. var MASK_HIGH = 0xffff0000;
  48526. var MASK_LOW = 0xffff;
  48527. function MurmurHash3_64(seed) {
  48528. var SEED = 0xc3d2e1f0;
  48529. this.h1 = seed ? seed & 0xffffffff : SEED;
  48530. this.h2 = seed ? seed & 0xffffffff : SEED;
  48531. }
  48532. var alwaysUseUint32ArrayView = false;
  48533. try {
  48534. new Uint32Array(new Uint8Array(5).buffer, 0, 1);
  48535. } catch (e) {
  48536. alwaysUseUint32ArrayView = true;
  48537. }
  48538. MurmurHash3_64.prototype = {
  48539. update: function MurmurHash3_64_update(input) {
  48540. var useUint32ArrayView = alwaysUseUint32ArrayView;
  48541. var i;
  48542. if (typeof input === 'string') {
  48543. var data = new Uint8Array(input.length * 2);
  48544. var length = 0;
  48545. for (i = 0; i < input.length; i++) {
  48546. var code = input.charCodeAt(i);
  48547. if (code <= 0xff) {
  48548. data[length++] = code;
  48549. } else {
  48550. data[length++] = code >>> 8;
  48551. data[length++] = code & 0xff;
  48552. }
  48553. }
  48554. } else if (input instanceof Uint8Array) {
  48555. data = input;
  48556. length = data.length;
  48557. } else if (typeof input === 'object' && 'length' in input) {
  48558. data = input;
  48559. length = data.length;
  48560. useUint32ArrayView = true;
  48561. } else {
  48562. throw new Error('Wrong data format in MurmurHash3_64_update. ' + 'Input must be a string or array.');
  48563. }
  48564. var blockCounts = length >> 2;
  48565. var tailLength = length - blockCounts * 4;
  48566. var dataUint32 = useUint32ArrayView ? new Uint32ArrayView(data, blockCounts) : new Uint32Array(data.buffer, 0, blockCounts);
  48567. var k1 = 0;
  48568. var k2 = 0;
  48569. var h1 = this.h1;
  48570. var h2 = this.h2;
  48571. var C1 = 0xcc9e2d51;
  48572. var C2 = 0x1b873593;
  48573. var C1_LOW = C1 & MASK_LOW;
  48574. var C2_LOW = C2 & MASK_LOW;
  48575. for (i = 0; i < blockCounts; i++) {
  48576. if (i & 1) {
  48577. k1 = dataUint32[i];
  48578. k1 = k1 * C1 & MASK_HIGH | k1 * C1_LOW & MASK_LOW;
  48579. k1 = k1 << 15 | k1 >>> 17;
  48580. k1 = k1 * C2 & MASK_HIGH | k1 * C2_LOW & MASK_LOW;
  48581. h1 ^= k1;
  48582. h1 = h1 << 13 | h1 >>> 19;
  48583. h1 = h1 * 5 + 0xe6546b64;
  48584. } else {
  48585. k2 = dataUint32[i];
  48586. k2 = k2 * C1 & MASK_HIGH | k2 * C1_LOW & MASK_LOW;
  48587. k2 = k2 << 15 | k2 >>> 17;
  48588. k2 = k2 * C2 & MASK_HIGH | k2 * C2_LOW & MASK_LOW;
  48589. h2 ^= k2;
  48590. h2 = h2 << 13 | h2 >>> 19;
  48591. h2 = h2 * 5 + 0xe6546b64;
  48592. }
  48593. }
  48594. k1 = 0;
  48595. switch (tailLength) {
  48596. case 3:
  48597. k1 ^= data[blockCounts * 4 + 2] << 16;
  48598. case 2:
  48599. k1 ^= data[blockCounts * 4 + 1] << 8;
  48600. case 1:
  48601. k1 ^= data[blockCounts * 4];
  48602. k1 = k1 * C1 & MASK_HIGH | k1 * C1_LOW & MASK_LOW;
  48603. k1 = k1 << 15 | k1 >>> 17;
  48604. k1 = k1 * C2 & MASK_HIGH | k1 * C2_LOW & MASK_LOW;
  48605. if (blockCounts & 1) {
  48606. h1 ^= k1;
  48607. } else {
  48608. h2 ^= k1;
  48609. }
  48610. }
  48611. this.h1 = h1;
  48612. this.h2 = h2;
  48613. return this;
  48614. },
  48615. hexdigest: function MurmurHash3_64_hexdigest() {
  48616. var h1 = this.h1;
  48617. var h2 = this.h2;
  48618. h1 ^= h2 >>> 1;
  48619. h1 = h1 * 0xed558ccd & MASK_HIGH | h1 * 0x8ccd & MASK_LOW;
  48620. h2 = h2 * 0xff51afd7 & MASK_HIGH | ((h2 << 16 | h1 >>> 16) * 0xafd7ed55 & MASK_HIGH) >>> 16;
  48621. h1 ^= h2 >>> 1;
  48622. h1 = h1 * 0x1a85ec53 & MASK_HIGH | h1 * 0xec53 & MASK_LOW;
  48623. h2 = h2 * 0xc4ceb9fe & MASK_HIGH | ((h2 << 16 | h1 >>> 16) * 0xb9fe1a85 & MASK_HIGH) >>> 16;
  48624. h1 ^= h2 >>> 1;
  48625. for (var i = 0, arr = [
  48626. h1,
  48627. h2
  48628. ], str = ''; i < arr.length; i++) {
  48629. var hex = (arr[i] >>> 0).toString(16);
  48630. while (hex.length < 8) {
  48631. hex = '0' + hex;
  48632. }
  48633. str += hex;
  48634. }
  48635. return str;
  48636. }
  48637. };
  48638. return MurmurHash3_64;
  48639. }();
  48640. exports.MurmurHash3_64 = MurmurHash3_64;
  48641. /***/ }),
  48642. /* 32 */
  48643. /***/ (function(module, exports, __w_pdfjs_require__) {
  48644. "use strict";
  48645. var sharedUtil = __w_pdfjs_require__(0);
  48646. var corePrimitives = __w_pdfjs_require__(1);
  48647. var coreFunction = __w_pdfjs_require__(6);
  48648. var coreColorSpace = __w_pdfjs_require__(3);
  48649. var UNSUPPORTED_FEATURES = sharedUtil.UNSUPPORTED_FEATURES;
  48650. var MissingDataException = sharedUtil.MissingDataException;
  48651. var Util = sharedUtil.Util;
  48652. var assert = sharedUtil.assert;
  48653. var error = sharedUtil.error;
  48654. var info = sharedUtil.info;
  48655. var warn = sharedUtil.warn;
  48656. var isStream = corePrimitives.isStream;
  48657. var PDFFunction = coreFunction.PDFFunction;
  48658. var ColorSpace = coreColorSpace.ColorSpace;
  48659. var ShadingType = {
  48660. FUNCTION_BASED: 1,
  48661. AXIAL: 2,
  48662. RADIAL: 3,
  48663. FREE_FORM_MESH: 4,
  48664. LATTICE_FORM_MESH: 5,
  48665. COONS_PATCH_MESH: 6,
  48666. TENSOR_PATCH_MESH: 7
  48667. };
  48668. var Pattern = function PatternClosure() {
  48669. function Pattern() {
  48670. error('should not call Pattern constructor');
  48671. }
  48672. Pattern.prototype = {
  48673. getPattern: function Pattern_getPattern(ctx) {
  48674. error('Should not call Pattern.getStyle: ' + ctx);
  48675. }
  48676. };
  48677. Pattern.parseShading = function Pattern_parseShading(shading, matrix, xref, res, handler) {
  48678. var dict = isStream(shading) ? shading.dict : shading;
  48679. var type = dict.get('ShadingType');
  48680. try {
  48681. switch (type) {
  48682. case ShadingType.AXIAL:
  48683. case ShadingType.RADIAL:
  48684. return new Shadings.RadialAxial(dict, matrix, xref, res);
  48685. case ShadingType.FREE_FORM_MESH:
  48686. case ShadingType.LATTICE_FORM_MESH:
  48687. case ShadingType.COONS_PATCH_MESH:
  48688. case ShadingType.TENSOR_PATCH_MESH:
  48689. return new Shadings.Mesh(shading, matrix, xref, res);
  48690. default:
  48691. throw new Error('Unsupported ShadingType: ' + type);
  48692. }
  48693. } catch (ex) {
  48694. if (ex instanceof MissingDataException) {
  48695. throw ex;
  48696. }
  48697. handler.send('UnsupportedFeature', { featureId: UNSUPPORTED_FEATURES.shadingPattern });
  48698. warn(ex);
  48699. return new Shadings.Dummy();
  48700. }
  48701. };
  48702. return Pattern;
  48703. }();
  48704. var Shadings = {};
  48705. Shadings.SMALL_NUMBER = 1e-6;
  48706. Shadings.RadialAxial = function RadialAxialClosure() {
  48707. function RadialAxial(dict, matrix, xref, res) {
  48708. this.matrix = matrix;
  48709. this.coordsArr = dict.getArray('Coords');
  48710. this.shadingType = dict.get('ShadingType');
  48711. this.type = 'Pattern';
  48712. var cs = dict.get('ColorSpace', 'CS');
  48713. cs = ColorSpace.parse(cs, xref, res);
  48714. this.cs = cs;
  48715. var t0 = 0.0, t1 = 1.0;
  48716. if (dict.has('Domain')) {
  48717. var domainArr = dict.getArray('Domain');
  48718. t0 = domainArr[0];
  48719. t1 = domainArr[1];
  48720. }
  48721. var extendStart = false, extendEnd = false;
  48722. if (dict.has('Extend')) {
  48723. var extendArr = dict.getArray('Extend');
  48724. extendStart = extendArr[0];
  48725. extendEnd = extendArr[1];
  48726. }
  48727. if (this.shadingType === ShadingType.RADIAL && (!extendStart || !extendEnd)) {
  48728. var x1 = this.coordsArr[0];
  48729. var y1 = this.coordsArr[1];
  48730. var r1 = this.coordsArr[2];
  48731. var x2 = this.coordsArr[3];
  48732. var y2 = this.coordsArr[4];
  48733. var r2 = this.coordsArr[5];
  48734. var distance = Math.sqrt((x1 - x2) * (x1 - x2) + (y1 - y2) * (y1 - y2));
  48735. if (r1 <= r2 + distance && r2 <= r1 + distance) {
  48736. warn('Unsupported radial gradient.');
  48737. }
  48738. }
  48739. this.extendStart = extendStart;
  48740. this.extendEnd = extendEnd;
  48741. var fnObj = dict.get('Function');
  48742. var fn = PDFFunction.parseArray(xref, fnObj);
  48743. var diff = t1 - t0;
  48744. var step = diff / 10;
  48745. var colorStops = this.colorStops = [];
  48746. if (t0 >= t1 || step <= 0) {
  48747. info('Bad shading domain.');
  48748. return;
  48749. }
  48750. var color = new Float32Array(cs.numComps), ratio = new Float32Array(1);
  48751. var rgbColor;
  48752. for (var i = t0; i <= t1; i += step) {
  48753. ratio[0] = i;
  48754. fn(ratio, 0, color, 0);
  48755. rgbColor = cs.getRgb(color, 0);
  48756. var cssColor = Util.makeCssRgb(rgbColor[0], rgbColor[1], rgbColor[2]);
  48757. colorStops.push([
  48758. (i - t0) / diff,
  48759. cssColor
  48760. ]);
  48761. }
  48762. var background = 'transparent';
  48763. if (dict.has('Background')) {
  48764. rgbColor = cs.getRgb(dict.get('Background'), 0);
  48765. background = Util.makeCssRgb(rgbColor[0], rgbColor[1], rgbColor[2]);
  48766. }
  48767. if (!extendStart) {
  48768. colorStops.unshift([
  48769. 0,
  48770. background
  48771. ]);
  48772. colorStops[1][0] += Shadings.SMALL_NUMBER;
  48773. }
  48774. if (!extendEnd) {
  48775. colorStops[colorStops.length - 1][0] -= Shadings.SMALL_NUMBER;
  48776. colorStops.push([
  48777. 1,
  48778. background
  48779. ]);
  48780. }
  48781. this.colorStops = colorStops;
  48782. }
  48783. RadialAxial.prototype = {
  48784. getIR: function RadialAxial_getIR() {
  48785. var coordsArr = this.coordsArr;
  48786. var shadingType = this.shadingType;
  48787. var type, p0, p1, r0, r1;
  48788. if (shadingType === ShadingType.AXIAL) {
  48789. p0 = [
  48790. coordsArr[0],
  48791. coordsArr[1]
  48792. ];
  48793. p1 = [
  48794. coordsArr[2],
  48795. coordsArr[3]
  48796. ];
  48797. r0 = null;
  48798. r1 = null;
  48799. type = 'axial';
  48800. } else if (shadingType === ShadingType.RADIAL) {
  48801. p0 = [
  48802. coordsArr[0],
  48803. coordsArr[1]
  48804. ];
  48805. p1 = [
  48806. coordsArr[3],
  48807. coordsArr[4]
  48808. ];
  48809. r0 = coordsArr[2];
  48810. r1 = coordsArr[5];
  48811. type = 'radial';
  48812. } else {
  48813. error('getPattern type unknown: ' + shadingType);
  48814. }
  48815. var matrix = this.matrix;
  48816. if (matrix) {
  48817. p0 = Util.applyTransform(p0, matrix);
  48818. p1 = Util.applyTransform(p1, matrix);
  48819. if (shadingType === ShadingType.RADIAL) {
  48820. var scale = Util.singularValueDecompose2dScale(matrix);
  48821. r0 *= scale[0];
  48822. r1 *= scale[1];
  48823. }
  48824. }
  48825. return [
  48826. 'RadialAxial',
  48827. type,
  48828. this.colorStops,
  48829. p0,
  48830. p1,
  48831. r0,
  48832. r1
  48833. ];
  48834. }
  48835. };
  48836. return RadialAxial;
  48837. }();
  48838. Shadings.Mesh = function MeshClosure() {
  48839. function MeshStreamReader(stream, context) {
  48840. this.stream = stream;
  48841. this.context = context;
  48842. this.buffer = 0;
  48843. this.bufferLength = 0;
  48844. var numComps = context.numComps;
  48845. this.tmpCompsBuf = new Float32Array(numComps);
  48846. var csNumComps = context.colorSpace.numComps;
  48847. this.tmpCsCompsBuf = context.colorFn ? new Float32Array(csNumComps) : this.tmpCompsBuf;
  48848. }
  48849. MeshStreamReader.prototype = {
  48850. get hasData() {
  48851. if (this.stream.end) {
  48852. return this.stream.pos < this.stream.end;
  48853. }
  48854. if (this.bufferLength > 0) {
  48855. return true;
  48856. }
  48857. var nextByte = this.stream.getByte();
  48858. if (nextByte < 0) {
  48859. return false;
  48860. }
  48861. this.buffer = nextByte;
  48862. this.bufferLength = 8;
  48863. return true;
  48864. },
  48865. readBits: function MeshStreamReader_readBits(n) {
  48866. var buffer = this.buffer;
  48867. var bufferLength = this.bufferLength;
  48868. if (n === 32) {
  48869. if (bufferLength === 0) {
  48870. return (this.stream.getByte() << 24 | this.stream.getByte() << 16 | this.stream.getByte() << 8 | this.stream.getByte()) >>> 0;
  48871. }
  48872. buffer = buffer << 24 | this.stream.getByte() << 16 | this.stream.getByte() << 8 | this.stream.getByte();
  48873. var nextByte = this.stream.getByte();
  48874. this.buffer = nextByte & (1 << bufferLength) - 1;
  48875. return (buffer << 8 - bufferLength | (nextByte & 0xFF) >> bufferLength) >>> 0;
  48876. }
  48877. if (n === 8 && bufferLength === 0) {
  48878. return this.stream.getByte();
  48879. }
  48880. while (bufferLength < n) {
  48881. buffer = buffer << 8 | this.stream.getByte();
  48882. bufferLength += 8;
  48883. }
  48884. bufferLength -= n;
  48885. this.bufferLength = bufferLength;
  48886. this.buffer = buffer & (1 << bufferLength) - 1;
  48887. return buffer >> bufferLength;
  48888. },
  48889. align: function MeshStreamReader_align() {
  48890. this.buffer = 0;
  48891. this.bufferLength = 0;
  48892. },
  48893. readFlag: function MeshStreamReader_readFlag() {
  48894. return this.readBits(this.context.bitsPerFlag);
  48895. },
  48896. readCoordinate: function MeshStreamReader_readCoordinate() {
  48897. var bitsPerCoordinate = this.context.bitsPerCoordinate;
  48898. var xi = this.readBits(bitsPerCoordinate);
  48899. var yi = this.readBits(bitsPerCoordinate);
  48900. var decode = this.context.decode;
  48901. var scale = bitsPerCoordinate < 32 ? 1 / ((1 << bitsPerCoordinate) - 1) : 2.3283064365386963e-10;
  48902. return [
  48903. xi * scale * (decode[1] - decode[0]) + decode[0],
  48904. yi * scale * (decode[3] - decode[2]) + decode[2]
  48905. ];
  48906. },
  48907. readComponents: function MeshStreamReader_readComponents() {
  48908. var numComps = this.context.numComps;
  48909. var bitsPerComponent = this.context.bitsPerComponent;
  48910. var scale = bitsPerComponent < 32 ? 1 / ((1 << bitsPerComponent) - 1) : 2.3283064365386963e-10;
  48911. var decode = this.context.decode;
  48912. var components = this.tmpCompsBuf;
  48913. for (var i = 0, j = 4; i < numComps; i++, j += 2) {
  48914. var ci = this.readBits(bitsPerComponent);
  48915. components[i] = ci * scale * (decode[j + 1] - decode[j]) + decode[j];
  48916. }
  48917. var color = this.tmpCsCompsBuf;
  48918. if (this.context.colorFn) {
  48919. this.context.colorFn(components, 0, color, 0);
  48920. }
  48921. return this.context.colorSpace.getRgb(color, 0);
  48922. }
  48923. };
  48924. function decodeType4Shading(mesh, reader) {
  48925. var coords = mesh.coords;
  48926. var colors = mesh.colors;
  48927. var operators = [];
  48928. var ps = [];
  48929. var verticesLeft = 0;
  48930. while (reader.hasData) {
  48931. var f = reader.readFlag();
  48932. var coord = reader.readCoordinate();
  48933. var color = reader.readComponents();
  48934. if (verticesLeft === 0) {
  48935. assert(0 <= f && f <= 2, 'Unknown type4 flag');
  48936. switch (f) {
  48937. case 0:
  48938. verticesLeft = 3;
  48939. break;
  48940. case 1:
  48941. ps.push(ps[ps.length - 2], ps[ps.length - 1]);
  48942. verticesLeft = 1;
  48943. break;
  48944. case 2:
  48945. ps.push(ps[ps.length - 3], ps[ps.length - 1]);
  48946. verticesLeft = 1;
  48947. break;
  48948. }
  48949. operators.push(f);
  48950. }
  48951. ps.push(coords.length);
  48952. coords.push(coord);
  48953. colors.push(color);
  48954. verticesLeft--;
  48955. reader.align();
  48956. }
  48957. mesh.figures.push({
  48958. type: 'triangles',
  48959. coords: new Int32Array(ps),
  48960. colors: new Int32Array(ps)
  48961. });
  48962. }
  48963. function decodeType5Shading(mesh, reader, verticesPerRow) {
  48964. var coords = mesh.coords;
  48965. var colors = mesh.colors;
  48966. var ps = [];
  48967. while (reader.hasData) {
  48968. var coord = reader.readCoordinate();
  48969. var color = reader.readComponents();
  48970. ps.push(coords.length);
  48971. coords.push(coord);
  48972. colors.push(color);
  48973. }
  48974. mesh.figures.push({
  48975. type: 'lattice',
  48976. coords: new Int32Array(ps),
  48977. colors: new Int32Array(ps),
  48978. verticesPerRow: verticesPerRow
  48979. });
  48980. }
  48981. var MIN_SPLIT_PATCH_CHUNKS_AMOUNT = 3;
  48982. var MAX_SPLIT_PATCH_CHUNKS_AMOUNT = 20;
  48983. var TRIANGLE_DENSITY = 20;
  48984. var getB = function getBClosure() {
  48985. function buildB(count) {
  48986. var lut = [];
  48987. for (var i = 0; i <= count; i++) {
  48988. var t = i / count, t_ = 1 - t;
  48989. lut.push(new Float32Array([
  48990. t_ * t_ * t_,
  48991. 3 * t * t_ * t_,
  48992. 3 * t * t * t_,
  48993. t * t * t
  48994. ]));
  48995. }
  48996. return lut;
  48997. }
  48998. var cache = [];
  48999. return function getB(count) {
  49000. if (!cache[count]) {
  49001. cache[count] = buildB(count);
  49002. }
  49003. return cache[count];
  49004. };
  49005. }();
  49006. function buildFigureFromPatch(mesh, index) {
  49007. var figure = mesh.figures[index];
  49008. assert(figure.type === 'patch', 'Unexpected patch mesh figure');
  49009. var coords = mesh.coords, colors = mesh.colors;
  49010. var pi = figure.coords;
  49011. var ci = figure.colors;
  49012. var figureMinX = Math.min(coords[pi[0]][0], coords[pi[3]][0], coords[pi[12]][0], coords[pi[15]][0]);
  49013. var figureMinY = Math.min(coords[pi[0]][1], coords[pi[3]][1], coords[pi[12]][1], coords[pi[15]][1]);
  49014. var figureMaxX = Math.max(coords[pi[0]][0], coords[pi[3]][0], coords[pi[12]][0], coords[pi[15]][0]);
  49015. var figureMaxY = Math.max(coords[pi[0]][1], coords[pi[3]][1], coords[pi[12]][1], coords[pi[15]][1]);
  49016. var splitXBy = Math.ceil((figureMaxX - figureMinX) * TRIANGLE_DENSITY / (mesh.bounds[2] - mesh.bounds[0]));
  49017. splitXBy = Math.max(MIN_SPLIT_PATCH_CHUNKS_AMOUNT, Math.min(MAX_SPLIT_PATCH_CHUNKS_AMOUNT, splitXBy));
  49018. var splitYBy = Math.ceil((figureMaxY - figureMinY) * TRIANGLE_DENSITY / (mesh.bounds[3] - mesh.bounds[1]));
  49019. splitYBy = Math.max(MIN_SPLIT_PATCH_CHUNKS_AMOUNT, Math.min(MAX_SPLIT_PATCH_CHUNKS_AMOUNT, splitYBy));
  49020. var verticesPerRow = splitXBy + 1;
  49021. var figureCoords = new Int32Array((splitYBy + 1) * verticesPerRow);
  49022. var figureColors = new Int32Array((splitYBy + 1) * verticesPerRow);
  49023. var k = 0;
  49024. var cl = new Uint8Array(3), cr = new Uint8Array(3);
  49025. var c0 = colors[ci[0]], c1 = colors[ci[1]], c2 = colors[ci[2]], c3 = colors[ci[3]];
  49026. var bRow = getB(splitYBy), bCol = getB(splitXBy);
  49027. for (var row = 0; row <= splitYBy; row++) {
  49028. cl[0] = (c0[0] * (splitYBy - row) + c2[0] * row) / splitYBy | 0;
  49029. cl[1] = (c0[1] * (splitYBy - row) + c2[1] * row) / splitYBy | 0;
  49030. cl[2] = (c0[2] * (splitYBy - row) + c2[2] * row) / splitYBy | 0;
  49031. cr[0] = (c1[0] * (splitYBy - row) + c3[0] * row) / splitYBy | 0;
  49032. cr[1] = (c1[1] * (splitYBy - row) + c3[1] * row) / splitYBy | 0;
  49033. cr[2] = (c1[2] * (splitYBy - row) + c3[2] * row) / splitYBy | 0;
  49034. for (var col = 0; col <= splitXBy; col++, k++) {
  49035. if ((row === 0 || row === splitYBy) && (col === 0 || col === splitXBy)) {
  49036. continue;
  49037. }
  49038. var x = 0, y = 0;
  49039. var q = 0;
  49040. for (var i = 0; i <= 3; i++) {
  49041. for (var j = 0; j <= 3; j++, q++) {
  49042. var m = bRow[row][i] * bCol[col][j];
  49043. x += coords[pi[q]][0] * m;
  49044. y += coords[pi[q]][1] * m;
  49045. }
  49046. }
  49047. figureCoords[k] = coords.length;
  49048. coords.push([
  49049. x,
  49050. y
  49051. ]);
  49052. figureColors[k] = colors.length;
  49053. var newColor = new Uint8Array(3);
  49054. newColor[0] = (cl[0] * (splitXBy - col) + cr[0] * col) / splitXBy | 0;
  49055. newColor[1] = (cl[1] * (splitXBy - col) + cr[1] * col) / splitXBy | 0;
  49056. newColor[2] = (cl[2] * (splitXBy - col) + cr[2] * col) / splitXBy | 0;
  49057. colors.push(newColor);
  49058. }
  49059. }
  49060. figureCoords[0] = pi[0];
  49061. figureColors[0] = ci[0];
  49062. figureCoords[splitXBy] = pi[3];
  49063. figureColors[splitXBy] = ci[1];
  49064. figureCoords[verticesPerRow * splitYBy] = pi[12];
  49065. figureColors[verticesPerRow * splitYBy] = ci[2];
  49066. figureCoords[verticesPerRow * splitYBy + splitXBy] = pi[15];
  49067. figureColors[verticesPerRow * splitYBy + splitXBy] = ci[3];
  49068. mesh.figures[index] = {
  49069. type: 'lattice',
  49070. coords: figureCoords,
  49071. colors: figureColors,
  49072. verticesPerRow: verticesPerRow
  49073. };
  49074. }
  49075. function decodeType6Shading(mesh, reader) {
  49076. var coords = mesh.coords;
  49077. var colors = mesh.colors;
  49078. var ps = new Int32Array(16);
  49079. var cs = new Int32Array(4);
  49080. while (reader.hasData) {
  49081. var f = reader.readFlag();
  49082. assert(0 <= f && f <= 3, 'Unknown type6 flag');
  49083. var i, ii;
  49084. var pi = coords.length;
  49085. for (i = 0, ii = f !== 0 ? 8 : 12; i < ii; i++) {
  49086. coords.push(reader.readCoordinate());
  49087. }
  49088. var ci = colors.length;
  49089. for (i = 0, ii = f !== 0 ? 2 : 4; i < ii; i++) {
  49090. colors.push(reader.readComponents());
  49091. }
  49092. var tmp1, tmp2, tmp3, tmp4;
  49093. switch (f) {
  49094. case 0:
  49095. ps[12] = pi + 3;
  49096. ps[13] = pi + 4;
  49097. ps[14] = pi + 5;
  49098. ps[15] = pi + 6;
  49099. ps[8] = pi + 2;
  49100. ps[11] = pi + 7;
  49101. ps[4] = pi + 1;
  49102. ps[7] = pi + 8;
  49103. ps[0] = pi;
  49104. ps[1] = pi + 11;
  49105. ps[2] = pi + 10;
  49106. ps[3] = pi + 9;
  49107. cs[2] = ci + 1;
  49108. cs[3] = ci + 2;
  49109. cs[0] = ci;
  49110. cs[1] = ci + 3;
  49111. break;
  49112. case 1:
  49113. tmp1 = ps[12];
  49114. tmp2 = ps[13];
  49115. tmp3 = ps[14];
  49116. tmp4 = ps[15];
  49117. ps[12] = tmp4;
  49118. ps[13] = pi + 0;
  49119. ps[14] = pi + 1;
  49120. ps[15] = pi + 2;
  49121. ps[8] = tmp3;
  49122. ps[11] = pi + 3;
  49123. ps[4] = tmp2;
  49124. ps[7] = pi + 4;
  49125. ps[0] = tmp1;
  49126. ps[1] = pi + 7;
  49127. ps[2] = pi + 6;
  49128. ps[3] = pi + 5;
  49129. tmp1 = cs[2];
  49130. tmp2 = cs[3];
  49131. cs[2] = tmp2;
  49132. cs[3] = ci;
  49133. cs[0] = tmp1;
  49134. cs[1] = ci + 1;
  49135. break;
  49136. case 2:
  49137. tmp1 = ps[15];
  49138. tmp2 = ps[11];
  49139. ps[12] = ps[3];
  49140. ps[13] = pi + 0;
  49141. ps[14] = pi + 1;
  49142. ps[15] = pi + 2;
  49143. ps[8] = ps[7];
  49144. ps[11] = pi + 3;
  49145. ps[4] = tmp2;
  49146. ps[7] = pi + 4;
  49147. ps[0] = tmp1;
  49148. ps[1] = pi + 7;
  49149. ps[2] = pi + 6;
  49150. ps[3] = pi + 5;
  49151. tmp1 = cs[3];
  49152. cs[2] = cs[1];
  49153. cs[3] = ci;
  49154. cs[0] = tmp1;
  49155. cs[1] = ci + 1;
  49156. break;
  49157. case 3:
  49158. ps[12] = ps[0];
  49159. ps[13] = pi + 0;
  49160. ps[14] = pi + 1;
  49161. ps[15] = pi + 2;
  49162. ps[8] = ps[1];
  49163. ps[11] = pi + 3;
  49164. ps[4] = ps[2];
  49165. ps[7] = pi + 4;
  49166. ps[0] = ps[3];
  49167. ps[1] = pi + 7;
  49168. ps[2] = pi + 6;
  49169. ps[3] = pi + 5;
  49170. cs[2] = cs[0];
  49171. cs[3] = ci;
  49172. cs[0] = cs[1];
  49173. cs[1] = ci + 1;
  49174. break;
  49175. }
  49176. ps[5] = coords.length;
  49177. coords.push([
  49178. (-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,
  49179. (-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
  49180. ]);
  49181. ps[6] = coords.length;
  49182. coords.push([
  49183. (-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,
  49184. (-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
  49185. ]);
  49186. ps[9] = coords.length;
  49187. coords.push([
  49188. (-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,
  49189. (-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
  49190. ]);
  49191. ps[10] = coords.length;
  49192. coords.push([
  49193. (-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,
  49194. (-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
  49195. ]);
  49196. mesh.figures.push({
  49197. type: 'patch',
  49198. coords: new Int32Array(ps),
  49199. colors: new Int32Array(cs)
  49200. });
  49201. }
  49202. }
  49203. function decodeType7Shading(mesh, reader) {
  49204. var coords = mesh.coords;
  49205. var colors = mesh.colors;
  49206. var ps = new Int32Array(16);
  49207. var cs = new Int32Array(4);
  49208. while (reader.hasData) {
  49209. var f = reader.readFlag();
  49210. assert(0 <= f && f <= 3, 'Unknown type7 flag');
  49211. var i, ii;
  49212. var pi = coords.length;
  49213. for (i = 0, ii = f !== 0 ? 12 : 16; i < ii; i++) {
  49214. coords.push(reader.readCoordinate());
  49215. }
  49216. var ci = colors.length;
  49217. for (i = 0, ii = f !== 0 ? 2 : 4; i < ii; i++) {
  49218. colors.push(reader.readComponents());
  49219. }
  49220. var tmp1, tmp2, tmp3, tmp4;
  49221. switch (f) {
  49222. case 0:
  49223. ps[12] = pi + 3;
  49224. ps[13] = pi + 4;
  49225. ps[14] = pi + 5;
  49226. ps[15] = pi + 6;
  49227. ps[8] = pi + 2;
  49228. ps[9] = pi + 13;
  49229. ps[10] = pi + 14;
  49230. ps[11] = pi + 7;
  49231. ps[4] = pi + 1;
  49232. ps[5] = pi + 12;
  49233. ps[6] = pi + 15;
  49234. ps[7] = pi + 8;
  49235. ps[0] = pi;
  49236. ps[1] = pi + 11;
  49237. ps[2] = pi + 10;
  49238. ps[3] = pi + 9;
  49239. cs[2] = ci + 1;
  49240. cs[3] = ci + 2;
  49241. cs[0] = ci;
  49242. cs[1] = ci + 3;
  49243. break;
  49244. case 1:
  49245. tmp1 = ps[12];
  49246. tmp2 = ps[13];
  49247. tmp3 = ps[14];
  49248. tmp4 = ps[15];
  49249. ps[12] = tmp4;
  49250. ps[13] = pi + 0;
  49251. ps[14] = pi + 1;
  49252. ps[15] = pi + 2;
  49253. ps[8] = tmp3;
  49254. ps[9] = pi + 9;
  49255. ps[10] = pi + 10;
  49256. ps[11] = pi + 3;
  49257. ps[4] = tmp2;
  49258. ps[5] = pi + 8;
  49259. ps[6] = pi + 11;
  49260. ps[7] = pi + 4;
  49261. ps[0] = tmp1;
  49262. ps[1] = pi + 7;
  49263. ps[2] = pi + 6;
  49264. ps[3] = pi + 5;
  49265. tmp1 = cs[2];
  49266. tmp2 = cs[3];
  49267. cs[2] = tmp2;
  49268. cs[3] = ci;
  49269. cs[0] = tmp1;
  49270. cs[1] = ci + 1;
  49271. break;
  49272. case 2:
  49273. tmp1 = ps[15];
  49274. tmp2 = ps[11];
  49275. ps[12] = ps[3];
  49276. ps[13] = pi + 0;
  49277. ps[14] = pi + 1;
  49278. ps[15] = pi + 2;
  49279. ps[8] = ps[7];
  49280. ps[9] = pi + 9;
  49281. ps[10] = pi + 10;
  49282. ps[11] = pi + 3;
  49283. ps[4] = tmp2;
  49284. ps[5] = pi + 8;
  49285. ps[6] = pi + 11;
  49286. ps[7] = pi + 4;
  49287. ps[0] = tmp1;
  49288. ps[1] = pi + 7;
  49289. ps[2] = pi + 6;
  49290. ps[3] = pi + 5;
  49291. tmp1 = cs[3];
  49292. cs[2] = cs[1];
  49293. cs[3] = ci;
  49294. cs[0] = tmp1;
  49295. cs[1] = ci + 1;
  49296. break;
  49297. case 3:
  49298. ps[12] = ps[0];
  49299. ps[13] = pi + 0;
  49300. ps[14] = pi + 1;
  49301. ps[15] = pi + 2;
  49302. ps[8] = ps[1];
  49303. ps[9] = pi + 9;
  49304. ps[10] = pi + 10;
  49305. ps[11] = pi + 3;
  49306. ps[4] = ps[2];
  49307. ps[5] = pi + 8;
  49308. ps[6] = pi + 11;
  49309. ps[7] = pi + 4;
  49310. ps[0] = ps[3];
  49311. ps[1] = pi + 7;
  49312. ps[2] = pi + 6;
  49313. ps[3] = pi + 5;
  49314. cs[2] = cs[0];
  49315. cs[3] = ci;
  49316. cs[0] = cs[1];
  49317. cs[1] = ci + 1;
  49318. break;
  49319. }
  49320. mesh.figures.push({
  49321. type: 'patch',
  49322. coords: new Int32Array(ps),
  49323. colors: new Int32Array(cs)
  49324. });
  49325. }
  49326. }
  49327. function updateBounds(mesh) {
  49328. var minX = mesh.coords[0][0], minY = mesh.coords[0][1], maxX = minX, maxY = minY;
  49329. for (var i = 1, ii = mesh.coords.length; i < ii; i++) {
  49330. var x = mesh.coords[i][0], y = mesh.coords[i][1];
  49331. minX = minX > x ? x : minX;
  49332. minY = minY > y ? y : minY;
  49333. maxX = maxX < x ? x : maxX;
  49334. maxY = maxY < y ? y : maxY;
  49335. }
  49336. mesh.bounds = [
  49337. minX,
  49338. minY,
  49339. maxX,
  49340. maxY
  49341. ];
  49342. }
  49343. function packData(mesh) {
  49344. var i, ii, j, jj;
  49345. var coords = mesh.coords;
  49346. var coordsPacked = new Float32Array(coords.length * 2);
  49347. for (i = 0, j = 0, ii = coords.length; i < ii; i++) {
  49348. var xy = coords[i];
  49349. coordsPacked[j++] = xy[0];
  49350. coordsPacked[j++] = xy[1];
  49351. }
  49352. mesh.coords = coordsPacked;
  49353. var colors = mesh.colors;
  49354. var colorsPacked = new Uint8Array(colors.length * 3);
  49355. for (i = 0, j = 0, ii = colors.length; i < ii; i++) {
  49356. var c = colors[i];
  49357. colorsPacked[j++] = c[0];
  49358. colorsPacked[j++] = c[1];
  49359. colorsPacked[j++] = c[2];
  49360. }
  49361. mesh.colors = colorsPacked;
  49362. var figures = mesh.figures;
  49363. for (i = 0, ii = figures.length; i < ii; i++) {
  49364. var figure = figures[i], ps = figure.coords, cs = figure.colors;
  49365. for (j = 0, jj = ps.length; j < jj; j++) {
  49366. ps[j] *= 2;
  49367. cs[j] *= 3;
  49368. }
  49369. }
  49370. }
  49371. function Mesh(stream, matrix, xref, res) {
  49372. assert(isStream(stream), 'Mesh data is not a stream');
  49373. var dict = stream.dict;
  49374. this.matrix = matrix;
  49375. this.shadingType = dict.get('ShadingType');
  49376. this.type = 'Pattern';
  49377. this.bbox = dict.getArray('BBox');
  49378. var cs = dict.get('ColorSpace', 'CS');
  49379. cs = ColorSpace.parse(cs, xref, res);
  49380. this.cs = cs;
  49381. this.background = dict.has('Background') ? cs.getRgb(dict.get('Background'), 0) : null;
  49382. var fnObj = dict.get('Function');
  49383. var fn = fnObj ? PDFFunction.parseArray(xref, fnObj) : null;
  49384. this.coords = [];
  49385. this.colors = [];
  49386. this.figures = [];
  49387. var decodeContext = {
  49388. bitsPerCoordinate: dict.get('BitsPerCoordinate'),
  49389. bitsPerComponent: dict.get('BitsPerComponent'),
  49390. bitsPerFlag: dict.get('BitsPerFlag'),
  49391. decode: dict.getArray('Decode'),
  49392. colorFn: fn,
  49393. colorSpace: cs,
  49394. numComps: fn ? 1 : cs.numComps
  49395. };
  49396. var reader = new MeshStreamReader(stream, decodeContext);
  49397. var patchMesh = false;
  49398. switch (this.shadingType) {
  49399. case ShadingType.FREE_FORM_MESH:
  49400. decodeType4Shading(this, reader);
  49401. break;
  49402. case ShadingType.LATTICE_FORM_MESH:
  49403. var verticesPerRow = dict.get('VerticesPerRow') | 0;
  49404. assert(verticesPerRow >= 2, 'Invalid VerticesPerRow');
  49405. decodeType5Shading(this, reader, verticesPerRow);
  49406. break;
  49407. case ShadingType.COONS_PATCH_MESH:
  49408. decodeType6Shading(this, reader);
  49409. patchMesh = true;
  49410. break;
  49411. case ShadingType.TENSOR_PATCH_MESH:
  49412. decodeType7Shading(this, reader);
  49413. patchMesh = true;
  49414. break;
  49415. default:
  49416. error('Unsupported mesh type.');
  49417. break;
  49418. }
  49419. if (patchMesh) {
  49420. updateBounds(this);
  49421. for (var i = 0, ii = this.figures.length; i < ii; i++) {
  49422. buildFigureFromPatch(this, i);
  49423. }
  49424. }
  49425. updateBounds(this);
  49426. packData(this);
  49427. }
  49428. Mesh.prototype = {
  49429. getIR: function Mesh_getIR() {
  49430. return [
  49431. 'Mesh',
  49432. this.shadingType,
  49433. this.coords,
  49434. this.colors,
  49435. this.figures,
  49436. this.bounds,
  49437. this.matrix,
  49438. this.bbox,
  49439. this.background
  49440. ];
  49441. }
  49442. };
  49443. return Mesh;
  49444. }();
  49445. Shadings.Dummy = function DummyClosure() {
  49446. function Dummy() {
  49447. this.type = 'Pattern';
  49448. }
  49449. Dummy.prototype = {
  49450. getIR: function Dummy_getIR() {
  49451. return ['Dummy'];
  49452. }
  49453. };
  49454. return Dummy;
  49455. }();
  49456. function getTilingPatternIR(operatorList, dict, args) {
  49457. var matrix = dict.getArray('Matrix');
  49458. var bbox = dict.getArray('BBox');
  49459. var xstep = dict.get('XStep');
  49460. var ystep = dict.get('YStep');
  49461. var paintType = dict.get('PaintType');
  49462. var tilingType = dict.get('TilingType');
  49463. return [
  49464. 'TilingPattern',
  49465. args,
  49466. operatorList,
  49467. matrix,
  49468. bbox,
  49469. xstep,
  49470. ystep,
  49471. paintType,
  49472. tilingType
  49473. ];
  49474. }
  49475. exports.Pattern = Pattern;
  49476. exports.getTilingPatternIR = getTilingPatternIR;
  49477. /***/ }),
  49478. /* 33 */
  49479. /***/ (function(module, exports, __w_pdfjs_require__) {
  49480. "use strict";
  49481. var sharedUtil = __w_pdfjs_require__(0);
  49482. var coreStream = __w_pdfjs_require__(2);
  49483. var coreChunkedStream = __w_pdfjs_require__(11);
  49484. var coreDocument = __w_pdfjs_require__(24);
  49485. var warn = sharedUtil.warn;
  49486. var createValidAbsoluteUrl = sharedUtil.createValidAbsoluteUrl;
  49487. var shadow = sharedUtil.shadow;
  49488. var NotImplementedException = sharedUtil.NotImplementedException;
  49489. var MissingDataException = sharedUtil.MissingDataException;
  49490. var createPromiseCapability = sharedUtil.createPromiseCapability;
  49491. var Util = sharedUtil.Util;
  49492. var Stream = coreStream.Stream;
  49493. var ChunkedStreamManager = coreChunkedStream.ChunkedStreamManager;
  49494. var PDFDocument = coreDocument.PDFDocument;
  49495. var BasePdfManager = function BasePdfManagerClosure() {
  49496. function BasePdfManager() {
  49497. throw new Error('Cannot initialize BaseManagerManager');
  49498. }
  49499. BasePdfManager.prototype = {
  49500. get docId() {
  49501. return this._docId;
  49502. },
  49503. get password() {
  49504. return this._password;
  49505. },
  49506. get docBaseUrl() {
  49507. var docBaseUrl = null;
  49508. if (this._docBaseUrl) {
  49509. var absoluteUrl = createValidAbsoluteUrl(this._docBaseUrl);
  49510. if (absoluteUrl) {
  49511. docBaseUrl = absoluteUrl.href;
  49512. } else {
  49513. warn('Invalid absolute docBaseUrl: "' + this._docBaseUrl + '".');
  49514. }
  49515. }
  49516. return shadow(this, 'docBaseUrl', docBaseUrl);
  49517. },
  49518. onLoadedStream: function BasePdfManager_onLoadedStream() {
  49519. throw new NotImplementedException();
  49520. },
  49521. ensureDoc: function BasePdfManager_ensureDoc(prop, args) {
  49522. return this.ensure(this.pdfDocument, prop, args);
  49523. },
  49524. ensureXRef: function BasePdfManager_ensureXRef(prop, args) {
  49525. return this.ensure(this.pdfDocument.xref, prop, args);
  49526. },
  49527. ensureCatalog: function BasePdfManager_ensureCatalog(prop, args) {
  49528. return this.ensure(this.pdfDocument.catalog, prop, args);
  49529. },
  49530. getPage: function BasePdfManager_getPage(pageIndex) {
  49531. return this.pdfDocument.getPage(pageIndex);
  49532. },
  49533. cleanup: function BasePdfManager_cleanup() {
  49534. return this.pdfDocument.cleanup();
  49535. },
  49536. ensure: function BasePdfManager_ensure(obj, prop, args) {
  49537. return new NotImplementedException();
  49538. },
  49539. requestRange: function BasePdfManager_requestRange(begin, end) {
  49540. return new NotImplementedException();
  49541. },
  49542. requestLoadedStream: function BasePdfManager_requestLoadedStream() {
  49543. return new NotImplementedException();
  49544. },
  49545. sendProgressiveData: function BasePdfManager_sendProgressiveData(chunk) {
  49546. return new NotImplementedException();
  49547. },
  49548. updatePassword: function BasePdfManager_updatePassword(password) {
  49549. this._password = password;
  49550. },
  49551. terminate: function BasePdfManager_terminate() {
  49552. return new NotImplementedException();
  49553. }
  49554. };
  49555. return BasePdfManager;
  49556. }();
  49557. var LocalPdfManager = function LocalPdfManagerClosure() {
  49558. function LocalPdfManager(docId, data, password, evaluatorOptions, docBaseUrl) {
  49559. this._docId = docId;
  49560. this._password = password;
  49561. this._docBaseUrl = docBaseUrl;
  49562. this.evaluatorOptions = evaluatorOptions;
  49563. var stream = new Stream(data);
  49564. this.pdfDocument = new PDFDocument(this, stream);
  49565. this._loadedStreamCapability = createPromiseCapability();
  49566. this._loadedStreamCapability.resolve(stream);
  49567. }
  49568. Util.inherit(LocalPdfManager, BasePdfManager, {
  49569. ensure: function LocalPdfManager_ensure(obj, prop, args) {
  49570. return new Promise(function (resolve, reject) {
  49571. try {
  49572. var value = obj[prop];
  49573. var result;
  49574. if (typeof value === 'function') {
  49575. result = value.apply(obj, args);
  49576. } else {
  49577. result = value;
  49578. }
  49579. resolve(result);
  49580. } catch (e) {
  49581. reject(e);
  49582. }
  49583. });
  49584. },
  49585. requestRange: function LocalPdfManager_requestRange(begin, end) {
  49586. return Promise.resolve();
  49587. },
  49588. requestLoadedStream: function LocalPdfManager_requestLoadedStream() {
  49589. },
  49590. onLoadedStream: function LocalPdfManager_onLoadedStream() {
  49591. return this._loadedStreamCapability.promise;
  49592. },
  49593. terminate: function LocalPdfManager_terminate() {
  49594. }
  49595. });
  49596. return LocalPdfManager;
  49597. }();
  49598. var NetworkPdfManager = function NetworkPdfManagerClosure() {
  49599. function NetworkPdfManager(docId, pdfNetworkStream, args, evaluatorOptions, docBaseUrl) {
  49600. this._docId = docId;
  49601. this._password = args.password;
  49602. this._docBaseUrl = docBaseUrl;
  49603. this.msgHandler = args.msgHandler;
  49604. this.evaluatorOptions = evaluatorOptions;
  49605. var params = {
  49606. msgHandler: args.msgHandler,
  49607. url: args.url,
  49608. length: args.length,
  49609. disableAutoFetch: args.disableAutoFetch,
  49610. rangeChunkSize: args.rangeChunkSize
  49611. };
  49612. this.streamManager = new ChunkedStreamManager(pdfNetworkStream, params);
  49613. this.pdfDocument = new PDFDocument(this, this.streamManager.getStream());
  49614. }
  49615. Util.inherit(NetworkPdfManager, BasePdfManager, {
  49616. ensure: function NetworkPdfManager_ensure(obj, prop, args) {
  49617. var pdfManager = this;
  49618. return new Promise(function (resolve, reject) {
  49619. function ensureHelper() {
  49620. try {
  49621. var result;
  49622. var value = obj[prop];
  49623. if (typeof value === 'function') {
  49624. result = value.apply(obj, args);
  49625. } else {
  49626. result = value;
  49627. }
  49628. resolve(result);
  49629. } catch (e) {
  49630. if (!(e instanceof MissingDataException)) {
  49631. reject(e);
  49632. return;
  49633. }
  49634. pdfManager.streamManager.requestRange(e.begin, e.end).then(ensureHelper, reject);
  49635. }
  49636. }
  49637. ensureHelper();
  49638. });
  49639. },
  49640. requestRange: function NetworkPdfManager_requestRange(begin, end) {
  49641. return this.streamManager.requestRange(begin, end);
  49642. },
  49643. requestLoadedStream: function NetworkPdfManager_requestLoadedStream() {
  49644. this.streamManager.requestAllChunks();
  49645. },
  49646. sendProgressiveData: function NetworkPdfManager_sendProgressiveData(chunk) {
  49647. this.streamManager.onReceiveData({ chunk: chunk });
  49648. },
  49649. onLoadedStream: function NetworkPdfManager_onLoadedStream() {
  49650. return this.streamManager.onLoadedStream();
  49651. },
  49652. terminate: function NetworkPdfManager_terminate() {
  49653. this.streamManager.abort();
  49654. }
  49655. });
  49656. return NetworkPdfManager;
  49657. }();
  49658. exports.LocalPdfManager = LocalPdfManager;
  49659. exports.NetworkPdfManager = NetworkPdfManager;
  49660. /***/ }),
  49661. /* 34 */
  49662. /***/ (function(module, exports, __w_pdfjs_require__) {
  49663. "use strict";
  49664. var sharedUtil = __w_pdfjs_require__(0);
  49665. var corePrimitives = __w_pdfjs_require__(1);
  49666. var error = sharedUtil.error;
  49667. var isSpace = sharedUtil.isSpace;
  49668. var EOF = corePrimitives.EOF;
  49669. var PostScriptParser = function PostScriptParserClosure() {
  49670. function PostScriptParser(lexer) {
  49671. this.lexer = lexer;
  49672. this.operators = [];
  49673. this.token = null;
  49674. this.prev = null;
  49675. }
  49676. PostScriptParser.prototype = {
  49677. nextToken: function PostScriptParser_nextToken() {
  49678. this.prev = this.token;
  49679. this.token = this.lexer.getToken();
  49680. },
  49681. accept: function PostScriptParser_accept(type) {
  49682. if (this.token.type === type) {
  49683. this.nextToken();
  49684. return true;
  49685. }
  49686. return false;
  49687. },
  49688. expect: function PostScriptParser_expect(type) {
  49689. if (this.accept(type)) {
  49690. return true;
  49691. }
  49692. error('Unexpected symbol: found ' + this.token.type + ' expected ' + type + '.');
  49693. },
  49694. parse: function PostScriptParser_parse() {
  49695. this.nextToken();
  49696. this.expect(PostScriptTokenTypes.LBRACE);
  49697. this.parseBlock();
  49698. this.expect(PostScriptTokenTypes.RBRACE);
  49699. return this.operators;
  49700. },
  49701. parseBlock: function PostScriptParser_parseBlock() {
  49702. while (true) {
  49703. if (this.accept(PostScriptTokenTypes.NUMBER)) {
  49704. this.operators.push(this.prev.value);
  49705. } else if (this.accept(PostScriptTokenTypes.OPERATOR)) {
  49706. this.operators.push(this.prev.value);
  49707. } else if (this.accept(PostScriptTokenTypes.LBRACE)) {
  49708. this.parseCondition();
  49709. } else {
  49710. return;
  49711. }
  49712. }
  49713. },
  49714. parseCondition: function PostScriptParser_parseCondition() {
  49715. var conditionLocation = this.operators.length;
  49716. this.operators.push(null, null);
  49717. this.parseBlock();
  49718. this.expect(PostScriptTokenTypes.RBRACE);
  49719. if (this.accept(PostScriptTokenTypes.IF)) {
  49720. this.operators[conditionLocation] = this.operators.length;
  49721. this.operators[conditionLocation + 1] = 'jz';
  49722. } else if (this.accept(PostScriptTokenTypes.LBRACE)) {
  49723. var jumpLocation = this.operators.length;
  49724. this.operators.push(null, null);
  49725. var endOfTrue = this.operators.length;
  49726. this.parseBlock();
  49727. this.expect(PostScriptTokenTypes.RBRACE);
  49728. this.expect(PostScriptTokenTypes.IFELSE);
  49729. this.operators[jumpLocation] = this.operators.length;
  49730. this.operators[jumpLocation + 1] = 'j';
  49731. this.operators[conditionLocation] = endOfTrue;
  49732. this.operators[conditionLocation + 1] = 'jz';
  49733. } else {
  49734. error('PS Function: error parsing conditional.');
  49735. }
  49736. }
  49737. };
  49738. return PostScriptParser;
  49739. }();
  49740. var PostScriptTokenTypes = {
  49741. LBRACE: 0,
  49742. RBRACE: 1,
  49743. NUMBER: 2,
  49744. OPERATOR: 3,
  49745. IF: 4,
  49746. IFELSE: 5
  49747. };
  49748. var PostScriptToken = function PostScriptTokenClosure() {
  49749. function PostScriptToken(type, value) {
  49750. this.type = type;
  49751. this.value = value;
  49752. }
  49753. var opCache = Object.create(null);
  49754. PostScriptToken.getOperator = function PostScriptToken_getOperator(op) {
  49755. var opValue = opCache[op];
  49756. if (opValue) {
  49757. return opValue;
  49758. }
  49759. return opCache[op] = new PostScriptToken(PostScriptTokenTypes.OPERATOR, op);
  49760. };
  49761. PostScriptToken.LBRACE = new PostScriptToken(PostScriptTokenTypes.LBRACE, '{');
  49762. PostScriptToken.RBRACE = new PostScriptToken(PostScriptTokenTypes.RBRACE, '}');
  49763. PostScriptToken.IF = new PostScriptToken(PostScriptTokenTypes.IF, 'IF');
  49764. PostScriptToken.IFELSE = new PostScriptToken(PostScriptTokenTypes.IFELSE, 'IFELSE');
  49765. return PostScriptToken;
  49766. }();
  49767. var PostScriptLexer = function PostScriptLexerClosure() {
  49768. function PostScriptLexer(stream) {
  49769. this.stream = stream;
  49770. this.nextChar();
  49771. this.strBuf = [];
  49772. }
  49773. PostScriptLexer.prototype = {
  49774. nextChar: function PostScriptLexer_nextChar() {
  49775. return this.currentChar = this.stream.getByte();
  49776. },
  49777. getToken: function PostScriptLexer_getToken() {
  49778. var comment = false;
  49779. var ch = this.currentChar;
  49780. while (true) {
  49781. if (ch < 0) {
  49782. return EOF;
  49783. }
  49784. if (comment) {
  49785. if (ch === 0x0A || ch === 0x0D) {
  49786. comment = false;
  49787. }
  49788. } else if (ch === 0x25) {
  49789. comment = true;
  49790. } else if (!isSpace(ch)) {
  49791. break;
  49792. }
  49793. ch = this.nextChar();
  49794. }
  49795. switch (ch | 0) {
  49796. case 0x30:
  49797. case 0x31:
  49798. case 0x32:
  49799. case 0x33:
  49800. case 0x34:
  49801. case 0x35:
  49802. case 0x36:
  49803. case 0x37:
  49804. case 0x38:
  49805. case 0x39:
  49806. case 0x2B:
  49807. case 0x2D:
  49808. case 0x2E:
  49809. return new PostScriptToken(PostScriptTokenTypes.NUMBER, this.getNumber());
  49810. case 0x7B:
  49811. this.nextChar();
  49812. return PostScriptToken.LBRACE;
  49813. case 0x7D:
  49814. this.nextChar();
  49815. return PostScriptToken.RBRACE;
  49816. }
  49817. var strBuf = this.strBuf;
  49818. strBuf.length = 0;
  49819. strBuf[0] = String.fromCharCode(ch);
  49820. while ((ch = this.nextChar()) >= 0 && (ch >= 0x41 && ch <= 0x5A || ch >= 0x61 && ch <= 0x7A)) {
  49821. strBuf.push(String.fromCharCode(ch));
  49822. }
  49823. var str = strBuf.join('');
  49824. switch (str.toLowerCase()) {
  49825. case 'if':
  49826. return PostScriptToken.IF;
  49827. case 'ifelse':
  49828. return PostScriptToken.IFELSE;
  49829. default:
  49830. return PostScriptToken.getOperator(str);
  49831. }
  49832. },
  49833. getNumber: function PostScriptLexer_getNumber() {
  49834. var ch = this.currentChar;
  49835. var strBuf = this.strBuf;
  49836. strBuf.length = 0;
  49837. strBuf[0] = String.fromCharCode(ch);
  49838. while ((ch = this.nextChar()) >= 0) {
  49839. if (ch >= 0x30 && ch <= 0x39 || ch === 0x2D || ch === 0x2E) {
  49840. strBuf.push(String.fromCharCode(ch));
  49841. } else {
  49842. break;
  49843. }
  49844. }
  49845. var value = parseFloat(strBuf.join(''));
  49846. if (isNaN(value)) {
  49847. error('Invalid floating point number: ' + value);
  49848. }
  49849. return value;
  49850. }
  49851. };
  49852. return PostScriptLexer;
  49853. }();
  49854. exports.PostScriptLexer = PostScriptLexer;
  49855. exports.PostScriptParser = PostScriptParser;
  49856. /***/ }),
  49857. /* 35 */
  49858. /***/ (function(module, exports, __w_pdfjs_require__) {
  49859. "use strict";
  49860. var sharedUtil = __w_pdfjs_require__(0);
  49861. var coreStream = __w_pdfjs_require__(2);
  49862. var coreEncodings = __w_pdfjs_require__(4);
  49863. var warn = sharedUtil.warn;
  49864. var isSpace = sharedUtil.isSpace;
  49865. var Stream = coreStream.Stream;
  49866. var getEncoding = coreEncodings.getEncoding;
  49867. var HINTING_ENABLED = false;
  49868. var Type1CharString = function Type1CharStringClosure() {
  49869. var COMMAND_MAP = {
  49870. 'hstem': [1],
  49871. 'vstem': [3],
  49872. 'vmoveto': [4],
  49873. 'rlineto': [5],
  49874. 'hlineto': [6],
  49875. 'vlineto': [7],
  49876. 'rrcurveto': [8],
  49877. 'callsubr': [10],
  49878. 'flex': [
  49879. 12,
  49880. 35
  49881. ],
  49882. 'drop': [
  49883. 12,
  49884. 18
  49885. ],
  49886. 'endchar': [14],
  49887. 'rmoveto': [21],
  49888. 'hmoveto': [22],
  49889. 'vhcurveto': [30],
  49890. 'hvcurveto': [31]
  49891. };
  49892. function Type1CharString() {
  49893. this.width = 0;
  49894. this.lsb = 0;
  49895. this.flexing = false;
  49896. this.output = [];
  49897. this.stack = [];
  49898. }
  49899. Type1CharString.prototype = {
  49900. convert: function Type1CharString_convert(encoded, subrs, seacAnalysisEnabled) {
  49901. var count = encoded.length;
  49902. var error = false;
  49903. var wx, sbx, subrNumber;
  49904. for (var i = 0; i < count; i++) {
  49905. var value = encoded[i];
  49906. if (value < 32) {
  49907. if (value === 12) {
  49908. value = (value << 8) + encoded[++i];
  49909. }
  49910. switch (value) {
  49911. case 1:
  49912. if (!HINTING_ENABLED) {
  49913. this.stack = [];
  49914. break;
  49915. }
  49916. error = this.executeCommand(2, COMMAND_MAP.hstem);
  49917. break;
  49918. case 3:
  49919. if (!HINTING_ENABLED) {
  49920. this.stack = [];
  49921. break;
  49922. }
  49923. error = this.executeCommand(2, COMMAND_MAP.vstem);
  49924. break;
  49925. case 4:
  49926. if (this.flexing) {
  49927. if (this.stack.length < 1) {
  49928. error = true;
  49929. break;
  49930. }
  49931. var dy = this.stack.pop();
  49932. this.stack.push(0, dy);
  49933. break;
  49934. }
  49935. error = this.executeCommand(1, COMMAND_MAP.vmoveto);
  49936. break;
  49937. case 5:
  49938. error = this.executeCommand(2, COMMAND_MAP.rlineto);
  49939. break;
  49940. case 6:
  49941. error = this.executeCommand(1, COMMAND_MAP.hlineto);
  49942. break;
  49943. case 7:
  49944. error = this.executeCommand(1, COMMAND_MAP.vlineto);
  49945. break;
  49946. case 8:
  49947. error = this.executeCommand(6, COMMAND_MAP.rrcurveto);
  49948. break;
  49949. case 9:
  49950. this.stack = [];
  49951. break;
  49952. case 10:
  49953. if (this.stack.length < 1) {
  49954. error = true;
  49955. break;
  49956. }
  49957. subrNumber = this.stack.pop();
  49958. error = this.convert(subrs[subrNumber], subrs, seacAnalysisEnabled);
  49959. break;
  49960. case 11:
  49961. return error;
  49962. case 13:
  49963. if (this.stack.length < 2) {
  49964. error = true;
  49965. break;
  49966. }
  49967. wx = this.stack.pop();
  49968. sbx = this.stack.pop();
  49969. this.lsb = sbx;
  49970. this.width = wx;
  49971. this.stack.push(wx, sbx);
  49972. error = this.executeCommand(2, COMMAND_MAP.hmoveto);
  49973. break;
  49974. case 14:
  49975. this.output.push(COMMAND_MAP.endchar[0]);
  49976. break;
  49977. case 21:
  49978. if (this.flexing) {
  49979. break;
  49980. }
  49981. error = this.executeCommand(2, COMMAND_MAP.rmoveto);
  49982. break;
  49983. case 22:
  49984. if (this.flexing) {
  49985. this.stack.push(0);
  49986. break;
  49987. }
  49988. error = this.executeCommand(1, COMMAND_MAP.hmoveto);
  49989. break;
  49990. case 30:
  49991. error = this.executeCommand(4, COMMAND_MAP.vhcurveto);
  49992. break;
  49993. case 31:
  49994. error = this.executeCommand(4, COMMAND_MAP.hvcurveto);
  49995. break;
  49996. case (12 << 8) + 0:
  49997. this.stack = [];
  49998. break;
  49999. case (12 << 8) + 1:
  50000. if (!HINTING_ENABLED) {
  50001. this.stack = [];
  50002. break;
  50003. }
  50004. error = this.executeCommand(2, COMMAND_MAP.vstem);
  50005. break;
  50006. case (12 << 8) + 2:
  50007. if (!HINTING_ENABLED) {
  50008. this.stack = [];
  50009. break;
  50010. }
  50011. error = this.executeCommand(2, COMMAND_MAP.hstem);
  50012. break;
  50013. case (12 << 8) + 6:
  50014. if (seacAnalysisEnabled) {
  50015. this.seac = this.stack.splice(-4, 4);
  50016. error = this.executeCommand(0, COMMAND_MAP.endchar);
  50017. } else {
  50018. error = this.executeCommand(4, COMMAND_MAP.endchar);
  50019. }
  50020. break;
  50021. case (12 << 8) + 7:
  50022. if (this.stack.length < 4) {
  50023. error = true;
  50024. break;
  50025. }
  50026. this.stack.pop();
  50027. wx = this.stack.pop();
  50028. var sby = this.stack.pop();
  50029. sbx = this.stack.pop();
  50030. this.lsb = sbx;
  50031. this.width = wx;
  50032. this.stack.push(wx, sbx, sby);
  50033. error = this.executeCommand(3, COMMAND_MAP.rmoveto);
  50034. break;
  50035. case (12 << 8) + 12:
  50036. if (this.stack.length < 2) {
  50037. error = true;
  50038. break;
  50039. }
  50040. var num2 = this.stack.pop();
  50041. var num1 = this.stack.pop();
  50042. this.stack.push(num1 / num2);
  50043. break;
  50044. case (12 << 8) + 16:
  50045. if (this.stack.length < 2) {
  50046. error = true;
  50047. break;
  50048. }
  50049. subrNumber = this.stack.pop();
  50050. var numArgs = this.stack.pop();
  50051. if (subrNumber === 0 && numArgs === 3) {
  50052. var flexArgs = this.stack.splice(this.stack.length - 17, 17);
  50053. 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]);
  50054. error = this.executeCommand(13, COMMAND_MAP.flex, true);
  50055. this.flexing = false;
  50056. this.stack.push(flexArgs[15], flexArgs[16]);
  50057. } else if (subrNumber === 1 && numArgs === 0) {
  50058. this.flexing = true;
  50059. }
  50060. break;
  50061. case (12 << 8) + 17:
  50062. break;
  50063. case (12 << 8) + 33:
  50064. this.stack = [];
  50065. break;
  50066. default:
  50067. warn('Unknown type 1 charstring command of "' + value + '"');
  50068. break;
  50069. }
  50070. if (error) {
  50071. break;
  50072. }
  50073. continue;
  50074. } else if (value <= 246) {
  50075. value = value - 139;
  50076. } else if (value <= 250) {
  50077. value = (value - 247) * 256 + encoded[++i] + 108;
  50078. } else if (value <= 254) {
  50079. value = -((value - 251) * 256) - encoded[++i] - 108;
  50080. } else {
  50081. value = (encoded[++i] & 0xff) << 24 | (encoded[++i] & 0xff) << 16 | (encoded[++i] & 0xff) << 8 | (encoded[++i] & 0xff) << 0;
  50082. }
  50083. this.stack.push(value);
  50084. }
  50085. return error;
  50086. },
  50087. executeCommand: function (howManyArgs, command, keepStack) {
  50088. var stackLength = this.stack.length;
  50089. if (howManyArgs > stackLength) {
  50090. return true;
  50091. }
  50092. var start = stackLength - howManyArgs;
  50093. for (var i = start; i < stackLength; i++) {
  50094. var value = this.stack[i];
  50095. if (value === (value | 0)) {
  50096. this.output.push(28, value >> 8 & 0xff, value & 0xff);
  50097. } else {
  50098. value = 65536 * value | 0;
  50099. this.output.push(255, value >> 24 & 0xFF, value >> 16 & 0xFF, value >> 8 & 0xFF, value & 0xFF);
  50100. }
  50101. }
  50102. this.output.push.apply(this.output, command);
  50103. if (keepStack) {
  50104. this.stack.splice(start, howManyArgs);
  50105. } else {
  50106. this.stack.length = 0;
  50107. }
  50108. return false;
  50109. }
  50110. };
  50111. return Type1CharString;
  50112. }();
  50113. var Type1Parser = function Type1ParserClosure() {
  50114. var EEXEC_ENCRYPT_KEY = 55665;
  50115. var CHAR_STRS_ENCRYPT_KEY = 4330;
  50116. function isHexDigit(code) {
  50117. return code >= 48 && code <= 57 || code >= 65 && code <= 70 || code >= 97 && code <= 102;
  50118. }
  50119. function decrypt(data, key, discardNumber) {
  50120. if (discardNumber >= data.length) {
  50121. return new Uint8Array(0);
  50122. }
  50123. var r = key | 0, c1 = 52845, c2 = 22719, i, j;
  50124. for (i = 0; i < discardNumber; i++) {
  50125. r = (data[i] + r) * c1 + c2 & (1 << 16) - 1;
  50126. }
  50127. var count = data.length - discardNumber;
  50128. var decrypted = new Uint8Array(count);
  50129. for (i = discardNumber, j = 0; j < count; i++, j++) {
  50130. var value = data[i];
  50131. decrypted[j] = value ^ r >> 8;
  50132. r = (value + r) * c1 + c2 & (1 << 16) - 1;
  50133. }
  50134. return decrypted;
  50135. }
  50136. function decryptAscii(data, key, discardNumber) {
  50137. var r = key | 0, c1 = 52845, c2 = 22719;
  50138. var count = data.length, maybeLength = count >>> 1;
  50139. var decrypted = new Uint8Array(maybeLength);
  50140. var i, j;
  50141. for (i = 0, j = 0; i < count; i++) {
  50142. var digit1 = data[i];
  50143. if (!isHexDigit(digit1)) {
  50144. continue;
  50145. }
  50146. i++;
  50147. var digit2;
  50148. while (i < count && !isHexDigit(digit2 = data[i])) {
  50149. i++;
  50150. }
  50151. if (i < count) {
  50152. var value = parseInt(String.fromCharCode(digit1, digit2), 16);
  50153. decrypted[j++] = value ^ r >> 8;
  50154. r = (value + r) * c1 + c2 & (1 << 16) - 1;
  50155. }
  50156. }
  50157. return Array.prototype.slice.call(decrypted, discardNumber, j);
  50158. }
  50159. function isSpecial(c) {
  50160. return c === 0x2F || c === 0x5B || c === 0x5D || c === 0x7B || c === 0x7D || c === 0x28 || c === 0x29;
  50161. }
  50162. function Type1Parser(stream, encrypted, seacAnalysisEnabled) {
  50163. if (encrypted) {
  50164. var data = stream.getBytes();
  50165. var isBinary = !(isHexDigit(data[0]) && isHexDigit(data[1]) && isHexDigit(data[2]) && isHexDigit(data[3]));
  50166. stream = new Stream(isBinary ? decrypt(data, EEXEC_ENCRYPT_KEY, 4) : decryptAscii(data, EEXEC_ENCRYPT_KEY, 4));
  50167. }
  50168. this.seacAnalysisEnabled = !!seacAnalysisEnabled;
  50169. this.stream = stream;
  50170. this.nextChar();
  50171. }
  50172. Type1Parser.prototype = {
  50173. readNumberArray: function Type1Parser_readNumberArray() {
  50174. this.getToken();
  50175. var array = [];
  50176. while (true) {
  50177. var token = this.getToken();
  50178. if (token === null || token === ']' || token === '}') {
  50179. break;
  50180. }
  50181. array.push(parseFloat(token || 0));
  50182. }
  50183. return array;
  50184. },
  50185. readNumber: function Type1Parser_readNumber() {
  50186. var token = this.getToken();
  50187. return parseFloat(token || 0);
  50188. },
  50189. readInt: function Type1Parser_readInt() {
  50190. var token = this.getToken();
  50191. return parseInt(token || 0, 10) | 0;
  50192. },
  50193. readBoolean: function Type1Parser_readBoolean() {
  50194. var token = this.getToken();
  50195. return token === 'true' ? 1 : 0;
  50196. },
  50197. nextChar: function Type1_nextChar() {
  50198. return this.currentChar = this.stream.getByte();
  50199. },
  50200. getToken: function Type1Parser_getToken() {
  50201. var comment = false;
  50202. var ch = this.currentChar;
  50203. while (true) {
  50204. if (ch === -1) {
  50205. return null;
  50206. }
  50207. if (comment) {
  50208. if (ch === 0x0A || ch === 0x0D) {
  50209. comment = false;
  50210. }
  50211. } else if (ch === 0x25) {
  50212. comment = true;
  50213. } else if (!isSpace(ch)) {
  50214. break;
  50215. }
  50216. ch = this.nextChar();
  50217. }
  50218. if (isSpecial(ch)) {
  50219. this.nextChar();
  50220. return String.fromCharCode(ch);
  50221. }
  50222. var token = '';
  50223. do {
  50224. token += String.fromCharCode(ch);
  50225. ch = this.nextChar();
  50226. } while (ch >= 0 && !isSpace(ch) && !isSpecial(ch));
  50227. return token;
  50228. },
  50229. extractFontProgram: function Type1Parser_extractFontProgram() {
  50230. var stream = this.stream;
  50231. var subrs = [], charstrings = [];
  50232. var privateData = Object.create(null);
  50233. privateData['lenIV'] = 4;
  50234. var program = {
  50235. subrs: [],
  50236. charstrings: [],
  50237. properties: { 'privateData': privateData }
  50238. };
  50239. var token, length, data, lenIV, encoded;
  50240. while ((token = this.getToken()) !== null) {
  50241. if (token !== '/') {
  50242. continue;
  50243. }
  50244. token = this.getToken();
  50245. switch (token) {
  50246. case 'CharStrings':
  50247. this.getToken();
  50248. this.getToken();
  50249. this.getToken();
  50250. this.getToken();
  50251. while (true) {
  50252. token = this.getToken();
  50253. if (token === null || token === 'end') {
  50254. break;
  50255. }
  50256. if (token !== '/') {
  50257. continue;
  50258. }
  50259. var glyph = this.getToken();
  50260. length = this.readInt();
  50261. this.getToken();
  50262. data = stream.makeSubStream(stream.pos, length);
  50263. lenIV = program.properties.privateData['lenIV'];
  50264. encoded = decrypt(data.getBytes(), CHAR_STRS_ENCRYPT_KEY, lenIV);
  50265. stream.skip(length);
  50266. this.nextChar();
  50267. token = this.getToken();
  50268. if (token === 'noaccess') {
  50269. this.getToken();
  50270. }
  50271. charstrings.push({
  50272. glyph: glyph,
  50273. encoded: encoded
  50274. });
  50275. }
  50276. break;
  50277. case 'Subrs':
  50278. this.readInt();
  50279. this.getToken();
  50280. while ((token = this.getToken()) === 'dup') {
  50281. var index = this.readInt();
  50282. length = this.readInt();
  50283. this.getToken();
  50284. data = stream.makeSubStream(stream.pos, length);
  50285. lenIV = program.properties.privateData['lenIV'];
  50286. encoded = decrypt(data.getBytes(), CHAR_STRS_ENCRYPT_KEY, lenIV);
  50287. stream.skip(length);
  50288. this.nextChar();
  50289. token = this.getToken();
  50290. if (token === 'noaccess') {
  50291. this.getToken();
  50292. }
  50293. subrs[index] = encoded;
  50294. }
  50295. break;
  50296. case 'BlueValues':
  50297. case 'OtherBlues':
  50298. case 'FamilyBlues':
  50299. case 'FamilyOtherBlues':
  50300. var blueArray = this.readNumberArray();
  50301. if (blueArray.length > 0 && blueArray.length % 2 === 0 && HINTING_ENABLED) {
  50302. program.properties.privateData[token] = blueArray;
  50303. }
  50304. break;
  50305. case 'StemSnapH':
  50306. case 'StemSnapV':
  50307. program.properties.privateData[token] = this.readNumberArray();
  50308. break;
  50309. case 'StdHW':
  50310. case 'StdVW':
  50311. program.properties.privateData[token] = this.readNumberArray()[0];
  50312. break;
  50313. case 'BlueShift':
  50314. case 'lenIV':
  50315. case 'BlueFuzz':
  50316. case 'BlueScale':
  50317. case 'LanguageGroup':
  50318. case 'ExpansionFactor':
  50319. program.properties.privateData[token] = this.readNumber();
  50320. break;
  50321. case 'ForceBold':
  50322. program.properties.privateData[token] = this.readBoolean();
  50323. break;
  50324. }
  50325. }
  50326. for (var i = 0; i < charstrings.length; i++) {
  50327. glyph = charstrings[i].glyph;
  50328. encoded = charstrings[i].encoded;
  50329. var charString = new Type1CharString();
  50330. var error = charString.convert(encoded, subrs, this.seacAnalysisEnabled);
  50331. var output = charString.output;
  50332. if (error) {
  50333. output = [14];
  50334. }
  50335. program.charstrings.push({
  50336. glyphName: glyph,
  50337. charstring: output,
  50338. width: charString.width,
  50339. lsb: charString.lsb,
  50340. seac: charString.seac
  50341. });
  50342. }
  50343. return program;
  50344. },
  50345. extractFontHeader: function Type1Parser_extractFontHeader(properties) {
  50346. var token;
  50347. while ((token = this.getToken()) !== null) {
  50348. if (token !== '/') {
  50349. continue;
  50350. }
  50351. token = this.getToken();
  50352. switch (token) {
  50353. case 'FontMatrix':
  50354. var matrix = this.readNumberArray();
  50355. properties.fontMatrix = matrix;
  50356. break;
  50357. case 'Encoding':
  50358. var encodingArg = this.getToken();
  50359. var encoding;
  50360. if (!/^\d+$/.test(encodingArg)) {
  50361. encoding = getEncoding(encodingArg);
  50362. } else {
  50363. encoding = [];
  50364. var size = parseInt(encodingArg, 10) | 0;
  50365. this.getToken();
  50366. for (var j = 0; j < size; j++) {
  50367. token = this.getToken();
  50368. while (token !== 'dup' && token !== 'def') {
  50369. token = this.getToken();
  50370. if (token === null) {
  50371. return;
  50372. }
  50373. }
  50374. if (token === 'def') {
  50375. break;
  50376. }
  50377. var index = this.readInt();
  50378. this.getToken();
  50379. var glyph = this.getToken();
  50380. encoding[index] = glyph;
  50381. this.getToken();
  50382. }
  50383. }
  50384. properties.builtInEncoding = encoding;
  50385. break;
  50386. case 'FontBBox':
  50387. var fontBBox = this.readNumberArray();
  50388. properties.ascent = Math.max(fontBBox[3], fontBBox[1]);
  50389. properties.descent = Math.min(fontBBox[1], fontBBox[3]);
  50390. properties.ascentScaled = true;
  50391. break;
  50392. }
  50393. }
  50394. }
  50395. };
  50396. return Type1Parser;
  50397. }();
  50398. exports.Type1Parser = Type1Parser;
  50399. /***/ }),
  50400. /* 36 */
  50401. /***/ (function(module, exports, __w_pdfjs_require__) {
  50402. "use strict";
  50403. var pdfjsVersion = '1.7.312';
  50404. var pdfjsBuild = 'cada411a';
  50405. var pdfjsCoreWorker = __w_pdfjs_require__(8);
  50406. {
  50407. __w_pdfjs_require__(18);
  50408. }
  50409. exports.WorkerMessageHandler = pdfjsCoreWorker.WorkerMessageHandler;
  50410. /***/ })
  50411. /******/ ]);
  50412. });