pdf.worker.js 1.1 MB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387238823892390239123922393239423952396239723982399240024012402240324042405240624072408240924102411241224132414241524162417241824192420242124222423242424252426242724282429243024312432243324342435243624372438243924402441244224432444244524462447244824492450245124522453245424552456245724582459246024612462246324642465246624672468246924702471247224732474247524762477247824792480248124822483248424852486248724882489249024912492249324942495249624972498249925002501250225032504250525062507250825092510251125122513251425152516251725182519252025212522252325242525252625272528252925302531253225332534253525362537253825392540254125422543254425452546254725482549255025512552255325542555255625572558255925602561256225632564256525662567256825692570257125722573257425752576257725782579258025812582258325842585258625872588258925902591259225932594259525962597259825992600260126022603260426052606260726082609261026112612261326142615261626172618261926202621262226232624262526262627262826292630263126322633263426352636263726382639264026412642264326442645264626472648264926502651265226532654265526562657265826592660266126622663266426652666266726682669267026712672267326742675267626772678267926802681268226832684268526862687268826892690269126922693269426952696269726982699270027012702270327042705270627072708270927102711271227132714271527162717271827192720272127222723272427252726272727282729273027312732273327342735273627372738273927402741274227432744274527462747274827492750275127522753275427552756275727582759276027612762276327642765276627672768276927702771277227732774277527762777277827792780278127822783278427852786278727882789279027912792279327942795279627972798279928002801280228032804280528062807280828092810281128122813281428152816281728182819282028212822282328242825282628272828282928302831283228332834283528362837283828392840284128422843284428452846284728482849285028512852285328542855285628572858285928602861286228632864286528662867286828692870287128722873287428752876287728782879288028812882288328842885288628872888288928902891289228932894289528962897289828992900290129022903290429052906290729082909291029112912291329142915291629172918291929202921292229232924292529262927292829292930293129322933293429352936293729382939294029412942294329442945294629472948294929502951295229532954295529562957295829592960296129622963296429652966296729682969297029712972297329742975297629772978297929802981298229832984298529862987298829892990299129922993299429952996299729982999300030013002300330043005300630073008300930103011301230133014301530163017301830193020302130223023302430253026302730283029303030313032303330343035303630373038303930403041304230433044304530463047304830493050305130523053305430553056305730583059306030613062306330643065306630673068306930703071307230733074307530763077307830793080308130823083308430853086308730883089309030913092309330943095309630973098309931003101310231033104310531063107310831093110311131123113311431153116311731183119312031213122312331243125312631273128312931303131313231333134313531363137313831393140314131423143314431453146314731483149315031513152315331543155315631573158315931603161316231633164316531663167316831693170317131723173317431753176317731783179318031813182318331843185318631873188318931903191319231933194319531963197319831993200320132023203320432053206320732083209321032113212321332143215321632173218321932203221322232233224322532263227322832293230323132323233323432353236323732383239324032413242324332443245324632473248324932503251325232533254325532563257325832593260326132623263326432653266326732683269327032713272327332743275327632773278327932803281328232833284328532863287328832893290329132923293329432953296329732983299330033013302330333043305330633073308330933103311331233133314331533163317331833193320332133223323332433253326332733283329333033313332333333343335333633373338333933403341334233433344334533463347334833493350335133523353335433553356335733583359336033613362336333643365336633673368336933703371337233733374337533763377337833793380338133823383338433853386338733883389339033913392339333943395339633973398339934003401340234033404340534063407340834093410341134123413341434153416341734183419342034213422342334243425342634273428342934303431343234333434343534363437343834393440344134423443344434453446344734483449345034513452345334543455345634573458345934603461346234633464346534663467346834693470347134723473347434753476347734783479348034813482348334843485348634873488348934903491349234933494349534963497349834993500350135023503350435053506350735083509351035113512351335143515351635173518351935203521352235233524352535263527352835293530353135323533353435353536353735383539354035413542354335443545354635473548354935503551355235533554355535563557355835593560356135623563356435653566356735683569357035713572357335743575357635773578357935803581358235833584358535863587358835893590359135923593359435953596359735983599360036013602360336043605360636073608360936103611361236133614361536163617361836193620362136223623362436253626362736283629363036313632363336343635363636373638363936403641364236433644364536463647364836493650365136523653365436553656365736583659366036613662366336643665366636673668366936703671367236733674367536763677367836793680368136823683368436853686368736883689369036913692369336943695369636973698369937003701370237033704370537063707370837093710371137123713371437153716371737183719372037213722372337243725372637273728372937303731373237333734373537363737373837393740374137423743374437453746374737483749375037513752375337543755375637573758375937603761376237633764376537663767376837693770377137723773377437753776377737783779378037813782378337843785378637873788378937903791379237933794379537963797379837993800380138023803380438053806380738083809381038113812381338143815381638173818381938203821382238233824382538263827382838293830383138323833383438353836383738383839384038413842384338443845384638473848384938503851385238533854385538563857385838593860386138623863386438653866386738683869387038713872387338743875387638773878387938803881388238833884388538863887388838893890389138923893389438953896389738983899390039013902390339043905390639073908390939103911391239133914391539163917391839193920392139223923392439253926392739283929393039313932393339343935393639373938393939403941394239433944394539463947394839493950395139523953395439553956395739583959396039613962396339643965396639673968396939703971397239733974397539763977397839793980398139823983398439853986398739883989399039913992399339943995399639973998399940004001400240034004400540064007400840094010401140124013401440154016401740184019402040214022402340244025402640274028402940304031403240334034403540364037403840394040404140424043404440454046404740484049405040514052405340544055405640574058405940604061406240634064406540664067406840694070407140724073407440754076407740784079408040814082408340844085408640874088408940904091409240934094409540964097409840994100410141024103410441054106410741084109411041114112411341144115411641174118411941204121412241234124412541264127412841294130413141324133413441354136413741384139414041414142414341444145414641474148414941504151415241534154415541564157415841594160416141624163416441654166416741684169417041714172417341744175417641774178417941804181418241834184418541864187418841894190419141924193419441954196419741984199420042014202420342044205420642074208420942104211421242134214421542164217421842194220422142224223422442254226422742284229423042314232423342344235423642374238423942404241424242434244424542464247424842494250425142524253425442554256425742584259426042614262426342644265426642674268426942704271427242734274427542764277427842794280428142824283428442854286428742884289429042914292429342944295429642974298429943004301430243034304430543064307430843094310431143124313431443154316431743184319432043214322432343244325432643274328432943304331433243334334433543364337433843394340434143424343434443454346434743484349435043514352435343544355435643574358435943604361436243634364436543664367436843694370437143724373437443754376437743784379438043814382438343844385438643874388438943904391439243934394439543964397439843994400440144024403440444054406440744084409441044114412441344144415441644174418441944204421442244234424442544264427442844294430443144324433443444354436443744384439444044414442444344444445444644474448444944504451445244534454445544564457445844594460446144624463446444654466446744684469447044714472447344744475447644774478447944804481448244834484448544864487448844894490449144924493449444954496449744984499450045014502450345044505450645074508450945104511451245134514451545164517451845194520452145224523452445254526452745284529453045314532453345344535453645374538453945404541454245434544454545464547454845494550455145524553455445554556455745584559456045614562456345644565456645674568456945704571457245734574457545764577457845794580458145824583458445854586458745884589459045914592459345944595459645974598459946004601460246034604460546064607460846094610461146124613461446154616461746184619462046214622462346244625462646274628462946304631463246334634463546364637463846394640464146424643464446454646464746484649465046514652465346544655465646574658465946604661466246634664466546664667466846694670467146724673467446754676467746784679468046814682468346844685468646874688468946904691469246934694469546964697469846994700470147024703470447054706470747084709471047114712471347144715471647174718471947204721472247234724472547264727472847294730473147324733473447354736473747384739474047414742474347444745474647474748474947504751475247534754475547564757475847594760476147624763476447654766476747684769477047714772477347744775477647774778477947804781478247834784478547864787478847894790479147924793479447954796479747984799480048014802480348044805480648074808480948104811481248134814481548164817481848194820482148224823482448254826482748284829483048314832483348344835483648374838483948404841484248434844484548464847484848494850485148524853485448554856485748584859486048614862486348644865486648674868486948704871487248734874487548764877487848794880488148824883488448854886488748884889489048914892489348944895489648974898489949004901490249034904490549064907490849094910491149124913491449154916491749184919492049214922492349244925492649274928492949304931493249334934493549364937493849394940494149424943494449454946494749484949495049514952495349544955495649574958495949604961496249634964496549664967496849694970497149724973497449754976497749784979498049814982498349844985498649874988498949904991499249934994499549964997499849995000500150025003500450055006500750085009501050115012501350145015501650175018501950205021502250235024502550265027502850295030503150325033503450355036503750385039504050415042504350445045504650475048504950505051505250535054505550565057505850595060506150625063506450655066506750685069507050715072507350745075507650775078507950805081508250835084508550865087508850895090509150925093509450955096509750985099510051015102510351045105510651075108510951105111511251135114511551165117511851195120512151225123512451255126512751285129513051315132513351345135513651375138513951405141514251435144514551465147514851495150515151525153515451555156515751585159516051615162516351645165516651675168516951705171517251735174517551765177517851795180518151825183518451855186518751885189519051915192519351945195519651975198519952005201520252035204520552065207520852095210521152125213521452155216521752185219522052215222522352245225522652275228522952305231523252335234523552365237523852395240524152425243524452455246524752485249525052515252525352545255525652575258525952605261526252635264526552665267526852695270527152725273527452755276527752785279528052815282528352845285528652875288528952905291529252935294529552965297529852995300530153025303530453055306530753085309531053115312531353145315531653175318531953205321532253235324532553265327532853295330533153325333533453355336533753385339534053415342534353445345534653475348534953505351535253535354535553565357535853595360536153625363536453655366536753685369537053715372537353745375537653775378537953805381538253835384538553865387538853895390539153925393539453955396539753985399540054015402540354045405540654075408540954105411541254135414541554165417541854195420542154225423542454255426542754285429543054315432543354345435543654375438543954405441544254435444544554465447544854495450545154525453545454555456545754585459546054615462546354645465546654675468546954705471547254735474547554765477547854795480548154825483548454855486548754885489549054915492549354945495549654975498549955005501550255035504550555065507550855095510551155125513551455155516551755185519552055215522552355245525552655275528552955305531553255335534553555365537553855395540554155425543554455455546554755485549555055515552555355545555555655575558555955605561556255635564556555665567556855695570557155725573557455755576557755785579558055815582558355845585558655875588558955905591559255935594559555965597559855995600560156025603560456055606560756085609561056115612561356145615561656175618561956205621562256235624562556265627562856295630563156325633563456355636563756385639564056415642564356445645564656475648564956505651565256535654565556565657565856595660566156625663566456655666566756685669567056715672567356745675567656775678567956805681568256835684568556865687568856895690569156925693569456955696569756985699570057015702570357045705570657075708570957105711571257135714571557165717571857195720572157225723572457255726572757285729573057315732573357345735573657375738573957405741574257435744574557465747574857495750575157525753575457555756575757585759576057615762576357645765576657675768576957705771577257735774577557765777577857795780578157825783578457855786578757885789579057915792579357945795579657975798579958005801580258035804580558065807580858095810581158125813581458155816581758185819582058215822582358245825582658275828582958305831583258335834583558365837583858395840584158425843584458455846584758485849585058515852585358545855585658575858585958605861586258635864586558665867586858695870587158725873587458755876587758785879588058815882588358845885588658875888588958905891589258935894589558965897589858995900590159025903590459055906590759085909591059115912591359145915591659175918591959205921592259235924592559265927592859295930593159325933593459355936593759385939594059415942594359445945594659475948594959505951595259535954595559565957595859595960596159625963596459655966596759685969597059715972597359745975597659775978597959805981598259835984598559865987598859895990599159925993599459955996599759985999600060016002600360046005600660076008600960106011601260136014601560166017601860196020602160226023602460256026602760286029603060316032603360346035603660376038603960406041604260436044604560466047604860496050605160526053605460556056605760586059606060616062606360646065606660676068606960706071607260736074607560766077607860796080608160826083608460856086608760886089609060916092609360946095609660976098609961006101610261036104610561066107610861096110611161126113611461156116611761186119612061216122612361246125612661276128612961306131613261336134613561366137613861396140614161426143614461456146614761486149615061516152615361546155615661576158615961606161616261636164616561666167616861696170617161726173617461756176617761786179618061816182618361846185618661876188618961906191619261936194619561966197619861996200620162026203620462056206620762086209621062116212621362146215621662176218621962206221622262236224622562266227622862296230623162326233623462356236623762386239624062416242624362446245624662476248624962506251625262536254625562566257625862596260626162626263626462656266626762686269627062716272627362746275627662776278627962806281628262836284628562866287628862896290629162926293629462956296629762986299630063016302630363046305630663076308630963106311631263136314631563166317631863196320632163226323632463256326632763286329633063316332633363346335633663376338633963406341634263436344634563466347634863496350635163526353635463556356635763586359636063616362636363646365636663676368636963706371637263736374637563766377637863796380638163826383638463856386638763886389639063916392639363946395639663976398639964006401640264036404640564066407640864096410641164126413641464156416641764186419642064216422642364246425642664276428642964306431643264336434643564366437643864396440644164426443644464456446644764486449645064516452645364546455645664576458645964606461646264636464646564666467646864696470647164726473647464756476647764786479648064816482648364846485648664876488648964906491649264936494649564966497649864996500650165026503650465056506650765086509651065116512651365146515651665176518651965206521652265236524652565266527652865296530653165326533653465356536653765386539654065416542654365446545654665476548654965506551655265536554655565566557655865596560656165626563656465656566656765686569657065716572657365746575657665776578657965806581658265836584658565866587658865896590659165926593659465956596659765986599660066016602660366046605660666076608660966106611661266136614661566166617661866196620662166226623662466256626662766286629663066316632663366346635663666376638663966406641664266436644664566466647664866496650665166526653665466556656665766586659666066616662666366646665666666676668666966706671667266736674667566766677667866796680668166826683668466856686668766886689669066916692669366946695669666976698669967006701670267036704670567066707670867096710671167126713671467156716671767186719672067216722672367246725672667276728672967306731673267336734673567366737673867396740674167426743674467456746674767486749675067516752675367546755675667576758675967606761676267636764676567666767676867696770677167726773677467756776677767786779678067816782678367846785678667876788678967906791679267936794679567966797679867996800680168026803680468056806680768086809681068116812681368146815681668176818681968206821682268236824682568266827682868296830683168326833683468356836683768386839684068416842684368446845684668476848684968506851685268536854685568566857685868596860686168626863686468656866686768686869687068716872687368746875687668776878687968806881688268836884688568866887688868896890689168926893689468956896689768986899690069016902690369046905690669076908690969106911691269136914691569166917691869196920692169226923692469256926692769286929693069316932693369346935693669376938693969406941694269436944694569466947694869496950695169526953695469556956695769586959696069616962696369646965696669676968696969706971697269736974697569766977697869796980698169826983698469856986698769886989699069916992699369946995699669976998699970007001700270037004700570067007700870097010701170127013701470157016701770187019702070217022702370247025702670277028702970307031703270337034703570367037703870397040704170427043704470457046704770487049705070517052705370547055705670577058705970607061706270637064706570667067706870697070707170727073707470757076707770787079708070817082708370847085708670877088708970907091709270937094709570967097709870997100710171027103710471057106710771087109711071117112711371147115711671177118711971207121712271237124712571267127712871297130713171327133713471357136713771387139714071417142714371447145714671477148714971507151715271537154715571567157715871597160716171627163716471657166716771687169717071717172717371747175717671777178717971807181718271837184718571867187718871897190719171927193719471957196719771987199720072017202720372047205720672077208720972107211721272137214721572167217721872197220722172227223722472257226722772287229723072317232723372347235723672377238723972407241724272437244724572467247724872497250725172527253725472557256725772587259726072617262726372647265726672677268726972707271727272737274727572767277727872797280728172827283728472857286728772887289729072917292729372947295729672977298729973007301730273037304730573067307730873097310731173127313731473157316731773187319732073217322732373247325732673277328732973307331733273337334733573367337733873397340734173427343734473457346734773487349735073517352735373547355735673577358735973607361736273637364736573667367736873697370737173727373737473757376737773787379738073817382738373847385738673877388738973907391739273937394739573967397739873997400740174027403740474057406740774087409741074117412741374147415741674177418741974207421742274237424742574267427742874297430743174327433743474357436743774387439744074417442744374447445744674477448744974507451745274537454745574567457745874597460746174627463746474657466746774687469747074717472747374747475747674777478747974807481748274837484748574867487748874897490749174927493749474957496749774987499750075017502750375047505750675077508750975107511751275137514751575167517751875197520752175227523752475257526752775287529753075317532753375347535753675377538753975407541754275437544754575467547754875497550755175527553755475557556755775587559756075617562756375647565756675677568756975707571757275737574757575767577757875797580758175827583758475857586758775887589759075917592759375947595759675977598759976007601760276037604760576067607760876097610761176127613761476157616761776187619762076217622762376247625762676277628762976307631763276337634763576367637763876397640764176427643764476457646764776487649765076517652765376547655765676577658765976607661766276637664766576667667766876697670767176727673767476757676767776787679768076817682768376847685768676877688768976907691769276937694769576967697769876997700770177027703770477057706770777087709771077117712771377147715771677177718771977207721772277237724772577267727772877297730773177327733773477357736773777387739774077417742774377447745774677477748774977507751775277537754775577567757775877597760776177627763776477657766776777687769777077717772777377747775777677777778777977807781778277837784778577867787778877897790779177927793779477957796779777987799780078017802780378047805780678077808780978107811781278137814781578167817781878197820782178227823782478257826782778287829783078317832783378347835783678377838783978407841784278437844784578467847784878497850785178527853785478557856785778587859786078617862786378647865786678677868786978707871787278737874787578767877787878797880788178827883788478857886788778887889789078917892789378947895789678977898789979007901790279037904790579067907790879097910791179127913791479157916791779187919792079217922792379247925792679277928792979307931793279337934793579367937793879397940794179427943794479457946794779487949795079517952795379547955795679577958795979607961796279637964796579667967796879697970797179727973797479757976797779787979798079817982798379847985798679877988798979907991799279937994799579967997799879998000800180028003800480058006800780088009801080118012801380148015801680178018801980208021802280238024802580268027802880298030803180328033803480358036803780388039804080418042804380448045804680478048804980508051805280538054805580568057805880598060806180628063806480658066806780688069807080718072807380748075807680778078807980808081808280838084808580868087808880898090809180928093809480958096809780988099810081018102810381048105810681078108810981108111811281138114811581168117811881198120812181228123812481258126812781288129813081318132813381348135813681378138813981408141814281438144814581468147814881498150815181528153815481558156815781588159816081618162816381648165816681678168816981708171817281738174817581768177817881798180818181828183818481858186818781888189819081918192819381948195819681978198819982008201820282038204820582068207820882098210821182128213821482158216821782188219822082218222822382248225822682278228822982308231823282338234823582368237823882398240824182428243824482458246824782488249825082518252825382548255825682578258825982608261826282638264826582668267826882698270827182728273827482758276827782788279828082818282828382848285828682878288828982908291829282938294829582968297829882998300830183028303830483058306830783088309831083118312831383148315831683178318831983208321832283238324832583268327832883298330833183328333833483358336833783388339834083418342834383448345834683478348834983508351835283538354835583568357835883598360836183628363836483658366836783688369837083718372837383748375837683778378837983808381838283838384838583868387838883898390839183928393839483958396839783988399840084018402840384048405840684078408840984108411841284138414841584168417841884198420842184228423842484258426842784288429843084318432843384348435843684378438843984408441844284438444844584468447844884498450845184528453845484558456845784588459846084618462846384648465846684678468846984708471847284738474847584768477847884798480848184828483848484858486848784888489849084918492849384948495849684978498849985008501850285038504850585068507850885098510851185128513851485158516851785188519852085218522852385248525852685278528852985308531853285338534853585368537853885398540854185428543854485458546854785488549855085518552855385548555855685578558855985608561856285638564856585668567856885698570857185728573857485758576857785788579858085818582858385848585858685878588858985908591859285938594859585968597859885998600860186028603860486058606860786088609861086118612861386148615861686178618861986208621862286238624862586268627862886298630863186328633863486358636863786388639864086418642864386448645864686478648864986508651865286538654865586568657865886598660866186628663866486658666866786688669867086718672867386748675867686778678867986808681868286838684868586868687868886898690869186928693869486958696869786988699870087018702870387048705870687078708870987108711871287138714871587168717871887198720872187228723872487258726872787288729873087318732873387348735873687378738873987408741874287438744874587468747874887498750875187528753875487558756875787588759876087618762876387648765876687678768876987708771877287738774877587768777877887798780878187828783878487858786878787888789879087918792879387948795879687978798879988008801880288038804880588068807880888098810881188128813881488158816881788188819882088218822882388248825882688278828882988308831883288338834883588368837883888398840884188428843884488458846884788488849885088518852885388548855885688578858885988608861886288638864886588668867886888698870887188728873887488758876887788788879888088818882888388848885888688878888888988908891889288938894889588968897889888998900890189028903890489058906890789088909891089118912891389148915891689178918891989208921892289238924892589268927892889298930893189328933893489358936893789388939894089418942894389448945894689478948894989508951895289538954895589568957895889598960896189628963896489658966896789688969897089718972897389748975897689778978897989808981898289838984898589868987898889898990899189928993899489958996899789988999900090019002900390049005900690079008900990109011901290139014901590169017901890199020902190229023902490259026902790289029903090319032903390349035903690379038903990409041904290439044904590469047904890499050905190529053905490559056905790589059906090619062906390649065906690679068906990709071907290739074907590769077907890799080908190829083908490859086908790889089909090919092909390949095909690979098909991009101910291039104910591069107910891099110911191129113911491159116911791189119912091219122912391249125912691279128912991309131913291339134913591369137913891399140914191429143914491459146914791489149915091519152915391549155915691579158915991609161916291639164916591669167916891699170917191729173917491759176917791789179918091819182918391849185918691879188918991909191919291939194919591969197919891999200920192029203920492059206920792089209921092119212921392149215921692179218921992209221922292239224922592269227922892299230923192329233923492359236923792389239924092419242924392449245924692479248924992509251925292539254925592569257925892599260926192629263926492659266926792689269927092719272927392749275927692779278927992809281928292839284928592869287928892899290929192929293929492959296929792989299930093019302930393049305930693079308930993109311931293139314931593169317931893199320932193229323932493259326932793289329933093319332933393349335933693379338933993409341934293439344934593469347934893499350935193529353935493559356935793589359936093619362936393649365936693679368936993709371937293739374937593769377937893799380938193829383938493859386938793889389939093919392939393949395939693979398939994009401940294039404940594069407940894099410941194129413941494159416941794189419942094219422942394249425942694279428942994309431943294339434943594369437943894399440944194429443944494459446944794489449945094519452945394549455945694579458945994609461946294639464946594669467946894699470947194729473947494759476947794789479948094819482948394849485948694879488948994909491949294939494949594969497949894999500950195029503950495059506950795089509951095119512951395149515951695179518951995209521952295239524952595269527952895299530953195329533953495359536953795389539954095419542954395449545954695479548954995509551955295539554955595569557955895599560956195629563956495659566956795689569957095719572957395749575957695779578957995809581958295839584958595869587958895899590959195929593959495959596959795989599960096019602960396049605960696079608960996109611961296139614961596169617961896199620962196229623962496259626962796289629963096319632963396349635963696379638963996409641964296439644964596469647964896499650965196529653965496559656965796589659966096619662966396649665966696679668966996709671967296739674967596769677967896799680968196829683968496859686968796889689969096919692969396949695969696979698969997009701970297039704970597069707970897099710971197129713971497159716971797189719972097219722972397249725972697279728972997309731973297339734973597369737973897399740974197429743974497459746974797489749975097519752975397549755975697579758975997609761976297639764976597669767976897699770977197729773977497759776977797789779978097819782978397849785978697879788978997909791979297939794979597969797979897999800980198029803980498059806980798089809981098119812981398149815981698179818981998209821982298239824982598269827982898299830983198329833983498359836983798389839984098419842984398449845984698479848984998509851985298539854985598569857985898599860986198629863986498659866986798689869987098719872987398749875987698779878987998809881988298839884988598869887988898899890989198929893989498959896989798989899990099019902990399049905990699079908990999109911991299139914991599169917991899199920992199229923992499259926992799289929993099319932993399349935993699379938993999409941994299439944994599469947994899499950995199529953995499559956995799589959996099619962996399649965996699679968996999709971997299739974997599769977997899799980998199829983998499859986998799889989999099919992999399949995999699979998999910000100011000210003100041000510006100071000810009100101001110012100131001410015100161001710018100191002010021100221002310024100251002610027100281002910030100311003210033100341003510036100371003810039100401004110042100431004410045100461004710048100491005010051100521005310054100551005610057100581005910060100611006210063100641006510066100671006810069100701007110072100731007410075100761007710078100791008010081100821008310084100851008610087100881008910090100911009210093100941009510096100971009810099101001010110102101031010410105101061010710108101091011010111101121011310114101151011610117101181011910120101211012210123101241012510126101271012810129101301013110132101331013410135101361013710138101391014010141101421014310144101451014610147101481014910150101511015210153101541015510156101571015810159101601016110162101631016410165101661016710168101691017010171101721017310174101751017610177101781017910180101811018210183101841018510186101871018810189101901019110192101931019410195101961019710198101991020010201102021020310204102051020610207102081020910210102111021210213102141021510216102171021810219102201022110222102231022410225102261022710228102291023010231102321023310234102351023610237102381023910240102411024210243102441024510246102471024810249102501025110252102531025410255102561025710258102591026010261102621026310264102651026610267102681026910270102711027210273102741027510276102771027810279102801028110282102831028410285102861028710288102891029010291102921029310294102951029610297102981029910300103011030210303103041030510306103071030810309103101031110312103131031410315103161031710318103191032010321103221032310324103251032610327103281032910330103311033210333103341033510336103371033810339103401034110342103431034410345103461034710348103491035010351103521035310354103551035610357103581035910360103611036210363103641036510366103671036810369103701037110372103731037410375103761037710378103791038010381103821038310384103851038610387103881038910390103911039210393103941039510396103971039810399104001040110402104031040410405104061040710408104091041010411104121041310414104151041610417104181041910420104211042210423104241042510426104271042810429104301043110432104331043410435104361043710438104391044010441104421044310444104451044610447104481044910450104511045210453104541045510456104571045810459104601046110462104631046410465104661046710468104691047010471104721047310474104751047610477104781047910480104811048210483104841048510486104871048810489104901049110492104931049410495104961049710498104991050010501105021050310504105051050610507105081050910510105111051210513105141051510516105171051810519105201052110522105231052410525105261052710528105291053010531105321053310534105351053610537105381053910540105411054210543105441054510546105471054810549105501055110552105531055410555105561055710558105591056010561105621056310564105651056610567105681056910570105711057210573105741057510576105771057810579105801058110582105831058410585105861058710588105891059010591105921059310594105951059610597105981059910600106011060210603106041060510606106071060810609106101061110612106131061410615106161061710618106191062010621106221062310624106251062610627106281062910630106311063210633106341063510636106371063810639106401064110642106431064410645106461064710648106491065010651106521065310654106551065610657106581065910660106611066210663106641066510666106671066810669106701067110672106731067410675106761067710678106791068010681106821068310684106851068610687106881068910690106911069210693106941069510696106971069810699107001070110702107031070410705107061070710708107091071010711107121071310714107151071610717107181071910720107211072210723107241072510726107271072810729107301073110732107331073410735107361073710738107391074010741107421074310744107451074610747107481074910750107511075210753107541075510756107571075810759107601076110762107631076410765107661076710768107691077010771107721077310774107751077610777107781077910780107811078210783107841078510786107871078810789107901079110792107931079410795107961079710798107991080010801108021080310804108051080610807108081080910810108111081210813108141081510816108171081810819108201082110822108231082410825108261082710828108291083010831108321083310834108351083610837108381083910840108411084210843108441084510846108471084810849108501085110852108531085410855108561085710858108591086010861108621086310864108651086610867108681086910870108711087210873108741087510876108771087810879108801088110882108831088410885108861088710888108891089010891108921089310894108951089610897108981089910900109011090210903109041090510906109071090810909109101091110912109131091410915109161091710918109191092010921109221092310924109251092610927109281092910930109311093210933109341093510936109371093810939109401094110942109431094410945109461094710948109491095010951109521095310954109551095610957109581095910960109611096210963109641096510966109671096810969109701097110972109731097410975109761097710978109791098010981109821098310984109851098610987109881098910990109911099210993109941099510996109971099810999110001100111002110031100411005110061100711008110091101011011110121101311014110151101611017110181101911020110211102211023110241102511026110271102811029110301103111032110331103411035110361103711038110391104011041110421104311044110451104611047110481104911050110511105211053110541105511056110571105811059110601106111062110631106411065110661106711068110691107011071110721107311074110751107611077110781107911080110811108211083110841108511086110871108811089110901109111092110931109411095110961109711098110991110011101111021110311104111051110611107111081110911110111111111211113111141111511116111171111811119111201112111122111231112411125111261112711128111291113011131111321113311134111351113611137111381113911140111411114211143111441114511146111471114811149111501115111152111531115411155111561115711158111591116011161111621116311164111651116611167111681116911170111711117211173111741117511176111771117811179111801118111182111831118411185111861118711188111891119011191111921119311194111951119611197111981119911200112011120211203112041120511206112071120811209112101121111212112131121411215112161121711218112191122011221112221122311224112251122611227112281122911230112311123211233112341123511236112371123811239112401124111242112431124411245112461124711248112491125011251112521125311254112551125611257112581125911260112611126211263112641126511266112671126811269112701127111272112731127411275112761127711278112791128011281112821128311284112851128611287112881128911290112911129211293112941129511296112971129811299113001130111302113031130411305113061130711308113091131011311113121131311314113151131611317113181131911320113211132211323113241132511326113271132811329113301133111332113331133411335113361133711338113391134011341113421134311344113451134611347113481134911350113511135211353113541135511356113571135811359113601136111362113631136411365113661136711368113691137011371113721137311374113751137611377113781137911380113811138211383113841138511386113871138811389113901139111392113931139411395113961139711398113991140011401114021140311404114051140611407114081140911410114111141211413114141141511416114171141811419114201142111422114231142411425114261142711428114291143011431114321143311434114351143611437114381143911440114411144211443114441144511446114471144811449114501145111452114531145411455114561145711458114591146011461114621146311464114651146611467114681146911470114711147211473114741147511476114771147811479114801148111482114831148411485114861148711488114891149011491114921149311494114951149611497114981149911500115011150211503115041150511506115071150811509115101151111512115131151411515115161151711518115191152011521115221152311524115251152611527115281152911530115311153211533115341153511536115371153811539115401154111542115431154411545115461154711548115491155011551115521155311554115551155611557115581155911560115611156211563115641156511566115671156811569115701157111572115731157411575115761157711578115791158011581115821158311584115851158611587115881158911590115911159211593115941159511596115971159811599116001160111602116031160411605116061160711608116091161011611116121161311614116151161611617116181161911620116211162211623116241162511626116271162811629116301163111632116331163411635116361163711638116391164011641116421164311644116451164611647116481164911650116511165211653116541165511656116571165811659116601166111662116631166411665116661166711668116691167011671116721167311674116751167611677116781167911680116811168211683116841168511686116871168811689116901169111692116931169411695116961169711698116991170011701117021170311704117051170611707117081170911710117111171211713117141171511716117171171811719117201172111722117231172411725117261172711728117291173011731117321173311734117351173611737117381173911740117411174211743117441174511746117471174811749117501175111752117531175411755117561175711758117591176011761117621176311764117651176611767117681176911770117711177211773117741177511776117771177811779117801178111782117831178411785117861178711788117891179011791117921179311794117951179611797117981179911800118011180211803118041180511806118071180811809118101181111812118131181411815118161181711818118191182011821118221182311824118251182611827118281182911830118311183211833118341183511836118371183811839118401184111842118431184411845118461184711848118491185011851118521185311854118551185611857118581185911860118611186211863118641186511866118671186811869118701187111872118731187411875118761187711878118791188011881118821188311884118851188611887118881188911890118911189211893118941189511896118971189811899119001190111902119031190411905119061190711908119091191011911119121191311914119151191611917119181191911920119211192211923119241192511926119271192811929119301193111932119331193411935119361193711938119391194011941119421194311944119451194611947119481194911950119511195211953119541195511956119571195811959119601196111962119631196411965119661196711968119691197011971119721197311974119751197611977119781197911980119811198211983119841198511986119871198811989119901199111992119931199411995119961199711998119991200012001120021200312004120051200612007120081200912010120111201212013120141201512016120171201812019120201202112022120231202412025120261202712028120291203012031120321203312034120351203612037120381203912040120411204212043120441204512046120471204812049120501205112052120531205412055120561205712058120591206012061120621206312064120651206612067120681206912070120711207212073120741207512076120771207812079120801208112082120831208412085120861208712088120891209012091120921209312094120951209612097120981209912100121011210212103121041210512106121071210812109121101211112112121131211412115121161211712118121191212012121121221212312124121251212612127121281212912130121311213212133121341213512136121371213812139121401214112142121431214412145121461214712148121491215012151121521215312154121551215612157121581215912160121611216212163121641216512166121671216812169121701217112172121731217412175121761217712178121791218012181121821218312184121851218612187121881218912190121911219212193121941219512196121971219812199122001220112202122031220412205122061220712208122091221012211122121221312214122151221612217122181221912220122211222212223122241222512226122271222812229122301223112232122331223412235122361223712238122391224012241122421224312244122451224612247122481224912250122511225212253122541225512256122571225812259122601226112262122631226412265122661226712268122691227012271122721227312274122751227612277122781227912280122811228212283122841228512286122871228812289122901229112292122931229412295122961229712298122991230012301123021230312304123051230612307123081230912310123111231212313123141231512316123171231812319123201232112322123231232412325123261232712328123291233012331123321233312334123351233612337123381233912340123411234212343123441234512346123471234812349123501235112352123531235412355123561235712358123591236012361123621236312364123651236612367123681236912370123711237212373123741237512376123771237812379123801238112382123831238412385123861238712388123891239012391123921239312394123951239612397123981239912400124011240212403124041240512406124071240812409124101241112412124131241412415124161241712418124191242012421124221242312424124251242612427124281242912430124311243212433124341243512436124371243812439124401244112442124431244412445124461244712448124491245012451124521245312454124551245612457124581245912460124611246212463124641246512466124671246812469124701247112472124731247412475124761247712478124791248012481124821248312484124851248612487124881248912490124911249212493124941249512496124971249812499125001250112502125031250412505125061250712508125091251012511125121251312514125151251612517125181251912520125211252212523125241252512526125271252812529125301253112532125331253412535125361253712538125391254012541125421254312544125451254612547125481254912550125511255212553125541255512556125571255812559125601256112562125631256412565125661256712568125691257012571125721257312574125751257612577125781257912580125811258212583125841258512586125871258812589125901259112592125931259412595125961259712598125991260012601126021260312604126051260612607126081260912610126111261212613126141261512616126171261812619126201262112622126231262412625126261262712628126291263012631126321263312634126351263612637126381263912640126411264212643126441264512646126471264812649126501265112652126531265412655126561265712658126591266012661126621266312664126651266612667126681266912670126711267212673126741267512676126771267812679126801268112682126831268412685126861268712688126891269012691126921269312694126951269612697126981269912700127011270212703127041270512706127071270812709127101271112712127131271412715127161271712718127191272012721127221272312724127251272612727127281272912730127311273212733127341273512736127371273812739127401274112742127431274412745127461274712748127491275012751127521275312754127551275612757127581275912760127611276212763127641276512766127671276812769127701277112772127731277412775127761277712778127791278012781127821278312784127851278612787127881278912790127911279212793127941279512796127971279812799128001280112802128031280412805128061280712808128091281012811128121281312814128151281612817128181281912820128211282212823128241282512826128271282812829128301283112832128331283412835128361283712838128391284012841128421284312844128451284612847128481284912850128511285212853128541285512856128571285812859128601286112862128631286412865128661286712868128691287012871128721287312874128751287612877128781287912880128811288212883128841288512886128871288812889128901289112892128931289412895128961289712898128991290012901129021290312904129051290612907129081290912910129111291212913129141291512916129171291812919129201292112922129231292412925129261292712928129291293012931129321293312934129351293612937129381293912940129411294212943129441294512946129471294812949129501295112952129531295412955129561295712958129591296012961129621296312964129651296612967129681296912970129711297212973129741297512976129771297812979129801298112982129831298412985129861298712988129891299012991129921299312994129951299612997129981299913000130011300213003130041300513006130071300813009130101301113012130131301413015130161301713018130191302013021130221302313024130251302613027130281302913030130311303213033130341303513036130371303813039130401304113042130431304413045130461304713048130491305013051130521305313054130551305613057130581305913060130611306213063130641306513066130671306813069130701307113072130731307413075130761307713078130791308013081130821308313084130851308613087130881308913090130911309213093130941309513096130971309813099131001310113102131031310413105131061310713108131091311013111131121311313114131151311613117131181311913120131211312213123131241312513126131271312813129131301313113132131331313413135131361313713138131391314013141131421314313144131451314613147131481314913150131511315213153131541315513156131571315813159131601316113162131631316413165131661316713168131691317013171131721317313174131751317613177131781317913180131811318213183131841318513186131871318813189131901319113192131931319413195131961319713198131991320013201132021320313204132051320613207132081320913210132111321213213132141321513216132171321813219132201322113222132231322413225132261322713228132291323013231132321323313234132351323613237132381323913240132411324213243132441324513246132471324813249132501325113252132531325413255132561325713258132591326013261132621326313264132651326613267132681326913270132711327213273132741327513276132771327813279132801328113282132831328413285132861328713288132891329013291132921329313294132951329613297132981329913300133011330213303133041330513306133071330813309133101331113312133131331413315133161331713318133191332013321133221332313324133251332613327133281332913330133311333213333133341333513336133371333813339133401334113342133431334413345133461334713348133491335013351133521335313354133551335613357133581335913360133611336213363133641336513366133671336813369133701337113372133731337413375133761337713378133791338013381133821338313384133851338613387133881338913390133911339213393133941339513396133971339813399134001340113402134031340413405134061340713408134091341013411134121341313414134151341613417134181341913420134211342213423134241342513426134271342813429134301343113432134331343413435134361343713438134391344013441134421344313444134451344613447134481344913450134511345213453134541345513456134571345813459134601346113462134631346413465134661346713468134691347013471134721347313474134751347613477134781347913480134811348213483134841348513486134871348813489134901349113492134931349413495134961349713498134991350013501135021350313504135051350613507135081350913510135111351213513135141351513516135171351813519135201352113522135231352413525135261352713528135291353013531135321353313534135351353613537135381353913540135411354213543135441354513546135471354813549135501355113552135531355413555135561355713558135591356013561135621356313564135651356613567135681356913570135711357213573135741357513576135771357813579135801358113582135831358413585135861358713588135891359013591135921359313594135951359613597135981359913600136011360213603136041360513606136071360813609136101361113612136131361413615136161361713618136191362013621136221362313624136251362613627136281362913630136311363213633136341363513636136371363813639136401364113642136431364413645136461364713648136491365013651136521365313654136551365613657136581365913660136611366213663136641366513666136671366813669136701367113672136731367413675136761367713678136791368013681136821368313684136851368613687136881368913690136911369213693136941369513696136971369813699137001370113702137031370413705137061370713708137091371013711137121371313714137151371613717137181371913720137211372213723137241372513726137271372813729137301373113732137331373413735137361373713738137391374013741137421374313744137451374613747137481374913750137511375213753137541375513756137571375813759137601376113762137631376413765137661376713768137691377013771137721377313774137751377613777137781377913780137811378213783137841378513786137871378813789137901379113792137931379413795137961379713798137991380013801138021380313804138051380613807138081380913810138111381213813138141381513816138171381813819138201382113822138231382413825138261382713828138291383013831138321383313834138351383613837138381383913840138411384213843138441384513846138471384813849138501385113852138531385413855138561385713858138591386013861138621386313864138651386613867138681386913870138711387213873138741387513876138771387813879138801388113882138831388413885138861388713888138891389013891138921389313894138951389613897138981389913900139011390213903139041390513906139071390813909139101391113912139131391413915139161391713918139191392013921139221392313924139251392613927139281392913930139311393213933139341393513936139371393813939139401394113942139431394413945139461394713948139491395013951139521395313954139551395613957139581395913960139611396213963139641396513966139671396813969139701397113972139731397413975139761397713978139791398013981139821398313984139851398613987139881398913990139911399213993139941399513996139971399813999140001400114002140031400414005140061400714008140091401014011140121401314014140151401614017140181401914020140211402214023140241402514026140271402814029140301403114032140331403414035140361403714038140391404014041140421404314044140451404614047140481404914050140511405214053140541405514056140571405814059140601406114062140631406414065140661406714068140691407014071140721407314074140751407614077140781407914080140811408214083140841408514086140871408814089140901409114092140931409414095140961409714098140991410014101141021410314104141051410614107141081410914110141111411214113141141411514116141171411814119141201412114122141231412414125141261412714128141291413014131141321413314134141351413614137141381413914140141411414214143141441414514146141471414814149141501415114152141531415414155141561415714158141591416014161141621416314164141651416614167141681416914170141711417214173141741417514176141771417814179141801418114182141831418414185141861418714188141891419014191141921419314194141951419614197141981419914200142011420214203142041420514206142071420814209142101421114212142131421414215142161421714218142191422014221142221422314224142251422614227142281422914230142311423214233142341423514236142371423814239142401424114242142431424414245142461424714248142491425014251142521425314254142551425614257142581425914260142611426214263142641426514266142671426814269142701427114272142731427414275142761427714278142791428014281142821428314284142851428614287142881428914290142911429214293142941429514296142971429814299143001430114302143031430414305143061430714308143091431014311143121431314314143151431614317143181431914320143211432214323143241432514326143271432814329143301433114332143331433414335143361433714338143391434014341143421434314344143451434614347143481434914350143511435214353143541435514356143571435814359143601436114362143631436414365143661436714368143691437014371143721437314374143751437614377143781437914380143811438214383143841438514386143871438814389143901439114392143931439414395143961439714398143991440014401144021440314404144051440614407144081440914410144111441214413144141441514416144171441814419144201442114422144231442414425144261442714428144291443014431144321443314434144351443614437144381443914440144411444214443144441444514446144471444814449144501445114452144531445414455144561445714458144591446014461144621446314464144651446614467144681446914470144711447214473144741447514476144771447814479144801448114482144831448414485144861448714488144891449014491144921449314494144951449614497144981449914500145011450214503145041450514506145071450814509145101451114512145131451414515145161451714518145191452014521145221452314524145251452614527145281452914530145311453214533145341453514536145371453814539145401454114542145431454414545145461454714548145491455014551145521455314554145551455614557145581455914560145611456214563145641456514566145671456814569145701457114572145731457414575145761457714578145791458014581145821458314584145851458614587145881458914590145911459214593145941459514596145971459814599146001460114602146031460414605146061460714608146091461014611146121461314614146151461614617146181461914620146211462214623146241462514626146271462814629146301463114632146331463414635146361463714638146391464014641146421464314644146451464614647146481464914650146511465214653146541465514656146571465814659146601466114662146631466414665146661466714668146691467014671146721467314674146751467614677146781467914680146811468214683146841468514686146871468814689146901469114692146931469414695146961469714698146991470014701147021470314704147051470614707147081470914710147111471214713147141471514716147171471814719147201472114722147231472414725147261472714728147291473014731147321473314734147351473614737147381473914740147411474214743147441474514746147471474814749147501475114752147531475414755147561475714758147591476014761147621476314764147651476614767147681476914770147711477214773147741477514776147771477814779147801478114782147831478414785147861478714788147891479014791147921479314794147951479614797147981479914800148011480214803148041480514806148071480814809148101481114812148131481414815148161481714818148191482014821148221482314824148251482614827148281482914830148311483214833148341483514836148371483814839148401484114842148431484414845148461484714848148491485014851148521485314854148551485614857148581485914860148611486214863148641486514866148671486814869148701487114872148731487414875148761487714878148791488014881148821488314884148851488614887148881488914890148911489214893148941489514896148971489814899149001490114902149031490414905149061490714908149091491014911149121491314914149151491614917149181491914920149211492214923149241492514926149271492814929149301493114932149331493414935149361493714938149391494014941149421494314944149451494614947149481494914950149511495214953149541495514956149571495814959149601496114962149631496414965149661496714968149691497014971149721497314974149751497614977149781497914980149811498214983149841498514986149871498814989149901499114992149931499414995149961499714998149991500015001150021500315004150051500615007150081500915010150111501215013150141501515016150171501815019150201502115022150231502415025150261502715028150291503015031150321503315034150351503615037150381503915040150411504215043150441504515046150471504815049150501505115052150531505415055150561505715058150591506015061150621506315064150651506615067150681506915070150711507215073150741507515076150771507815079150801508115082150831508415085150861508715088150891509015091150921509315094150951509615097150981509915100151011510215103151041510515106151071510815109151101511115112151131511415115151161511715118151191512015121151221512315124151251512615127151281512915130151311513215133151341513515136151371513815139151401514115142151431514415145151461514715148151491515015151151521515315154151551515615157151581515915160151611516215163151641516515166151671516815169151701517115172151731517415175151761517715178151791518015181151821518315184151851518615187151881518915190151911519215193151941519515196151971519815199152001520115202152031520415205152061520715208152091521015211152121521315214152151521615217152181521915220152211522215223152241522515226152271522815229152301523115232152331523415235152361523715238152391524015241152421524315244152451524615247152481524915250152511525215253152541525515256152571525815259152601526115262152631526415265152661526715268152691527015271152721527315274152751527615277152781527915280152811528215283152841528515286152871528815289152901529115292152931529415295152961529715298152991530015301153021530315304153051530615307153081530915310153111531215313153141531515316153171531815319153201532115322153231532415325153261532715328153291533015331153321533315334153351533615337153381533915340153411534215343153441534515346153471534815349153501535115352153531535415355153561535715358153591536015361153621536315364153651536615367153681536915370153711537215373153741537515376153771537815379153801538115382153831538415385153861538715388153891539015391153921539315394153951539615397153981539915400154011540215403154041540515406154071540815409154101541115412154131541415415154161541715418154191542015421154221542315424154251542615427154281542915430154311543215433154341543515436154371543815439154401544115442154431544415445154461544715448154491545015451154521545315454154551545615457154581545915460154611546215463154641546515466154671546815469154701547115472154731547415475154761547715478154791548015481154821548315484154851548615487154881548915490154911549215493154941549515496154971549815499155001550115502155031550415505155061550715508155091551015511155121551315514155151551615517155181551915520155211552215523155241552515526155271552815529155301553115532155331553415535155361553715538155391554015541155421554315544155451554615547155481554915550155511555215553155541555515556155571555815559155601556115562155631556415565155661556715568155691557015571155721557315574155751557615577155781557915580155811558215583155841558515586155871558815589155901559115592155931559415595155961559715598155991560015601156021560315604156051560615607156081560915610156111561215613156141561515616156171561815619156201562115622156231562415625156261562715628156291563015631156321563315634156351563615637156381563915640156411564215643156441564515646156471564815649156501565115652156531565415655156561565715658156591566015661156621566315664156651566615667156681566915670156711567215673156741567515676156771567815679156801568115682156831568415685156861568715688156891569015691156921569315694156951569615697156981569915700157011570215703157041570515706157071570815709157101571115712157131571415715157161571715718157191572015721157221572315724157251572615727157281572915730157311573215733157341573515736157371573815739157401574115742157431574415745157461574715748157491575015751157521575315754157551575615757157581575915760157611576215763157641576515766157671576815769157701577115772157731577415775157761577715778157791578015781157821578315784157851578615787157881578915790157911579215793157941579515796157971579815799158001580115802158031580415805158061580715808158091581015811158121581315814158151581615817158181581915820158211582215823158241582515826158271582815829158301583115832158331583415835158361583715838158391584015841158421584315844158451584615847158481584915850158511585215853158541585515856158571585815859158601586115862158631586415865158661586715868158691587015871158721587315874158751587615877158781587915880158811588215883158841588515886158871588815889158901589115892158931589415895158961589715898158991590015901159021590315904159051590615907159081590915910159111591215913159141591515916159171591815919159201592115922159231592415925159261592715928159291593015931159321593315934159351593615937159381593915940159411594215943159441594515946159471594815949159501595115952159531595415955159561595715958159591596015961159621596315964159651596615967159681596915970159711597215973159741597515976159771597815979159801598115982159831598415985159861598715988159891599015991159921599315994159951599615997159981599916000160011600216003160041600516006160071600816009160101601116012160131601416015160161601716018160191602016021160221602316024160251602616027160281602916030160311603216033160341603516036160371603816039160401604116042160431604416045160461604716048160491605016051160521605316054160551605616057160581605916060160611606216063160641606516066160671606816069160701607116072160731607416075160761607716078160791608016081160821608316084160851608616087160881608916090160911609216093160941609516096160971609816099161001610116102161031610416105161061610716108161091611016111161121611316114161151611616117161181611916120161211612216123161241612516126161271612816129161301613116132161331613416135161361613716138161391614016141161421614316144161451614616147161481614916150161511615216153161541615516156161571615816159161601616116162161631616416165161661616716168161691617016171161721617316174161751617616177161781617916180161811618216183161841618516186161871618816189161901619116192161931619416195161961619716198161991620016201162021620316204162051620616207162081620916210162111621216213162141621516216162171621816219162201622116222162231622416225162261622716228162291623016231162321623316234162351623616237162381623916240162411624216243162441624516246162471624816249162501625116252162531625416255162561625716258162591626016261162621626316264162651626616267162681626916270162711627216273162741627516276162771627816279162801628116282162831628416285162861628716288162891629016291162921629316294162951629616297162981629916300163011630216303163041630516306163071630816309163101631116312163131631416315163161631716318163191632016321163221632316324163251632616327163281632916330163311633216333163341633516336163371633816339163401634116342163431634416345163461634716348163491635016351163521635316354163551635616357163581635916360163611636216363163641636516366163671636816369163701637116372163731637416375163761637716378163791638016381163821638316384163851638616387163881638916390163911639216393163941639516396163971639816399164001640116402164031640416405164061640716408164091641016411164121641316414164151641616417164181641916420164211642216423164241642516426164271642816429164301643116432164331643416435164361643716438164391644016441164421644316444164451644616447164481644916450164511645216453164541645516456164571645816459164601646116462164631646416465164661646716468164691647016471164721647316474164751647616477164781647916480164811648216483164841648516486164871648816489164901649116492164931649416495164961649716498164991650016501165021650316504165051650616507165081650916510165111651216513165141651516516165171651816519165201652116522165231652416525165261652716528165291653016531165321653316534165351653616537165381653916540165411654216543165441654516546165471654816549165501655116552165531655416555165561655716558165591656016561165621656316564165651656616567165681656916570165711657216573165741657516576165771657816579165801658116582165831658416585165861658716588165891659016591165921659316594165951659616597165981659916600166011660216603166041660516606166071660816609166101661116612166131661416615166161661716618166191662016621166221662316624166251662616627166281662916630166311663216633166341663516636166371663816639166401664116642166431664416645166461664716648166491665016651166521665316654166551665616657166581665916660166611666216663166641666516666166671666816669166701667116672166731667416675166761667716678166791668016681166821668316684166851668616687166881668916690166911669216693166941669516696166971669816699167001670116702167031670416705167061670716708167091671016711167121671316714167151671616717167181671916720167211672216723167241672516726167271672816729167301673116732167331673416735167361673716738167391674016741167421674316744167451674616747167481674916750167511675216753167541675516756167571675816759167601676116762167631676416765167661676716768167691677016771167721677316774167751677616777167781677916780167811678216783167841678516786167871678816789167901679116792167931679416795167961679716798167991680016801168021680316804168051680616807168081680916810168111681216813168141681516816168171681816819168201682116822168231682416825168261682716828168291683016831168321683316834168351683616837168381683916840168411684216843168441684516846168471684816849168501685116852168531685416855168561685716858168591686016861168621686316864168651686616867168681686916870168711687216873168741687516876168771687816879168801688116882168831688416885168861688716888168891689016891168921689316894168951689616897168981689916900169011690216903169041690516906169071690816909169101691116912169131691416915169161691716918169191692016921169221692316924169251692616927169281692916930169311693216933169341693516936169371693816939169401694116942169431694416945169461694716948169491695016951169521695316954169551695616957169581695916960169611696216963169641696516966169671696816969169701697116972169731697416975169761697716978169791698016981169821698316984169851698616987169881698916990169911699216993169941699516996169971699816999170001700117002170031700417005170061700717008170091701017011170121701317014170151701617017170181701917020170211702217023170241702517026170271702817029170301703117032170331703417035170361703717038170391704017041170421704317044170451704617047170481704917050170511705217053170541705517056170571705817059170601706117062170631706417065170661706717068170691707017071170721707317074170751707617077170781707917080170811708217083170841708517086170871708817089170901709117092170931709417095170961709717098170991710017101171021710317104171051710617107171081710917110171111711217113171141711517116171171711817119171201712117122171231712417125171261712717128171291713017131171321713317134171351713617137171381713917140171411714217143171441714517146171471714817149171501715117152171531715417155171561715717158171591716017161171621716317164171651716617167171681716917170171711717217173171741717517176171771717817179171801718117182171831718417185171861718717188171891719017191171921719317194171951719617197171981719917200172011720217203172041720517206172071720817209172101721117212172131721417215172161721717218172191722017221172221722317224172251722617227172281722917230172311723217233172341723517236172371723817239172401724117242172431724417245172461724717248172491725017251172521725317254172551725617257172581725917260172611726217263172641726517266172671726817269172701727117272172731727417275172761727717278172791728017281172821728317284172851728617287172881728917290172911729217293172941729517296172971729817299173001730117302173031730417305173061730717308173091731017311173121731317314173151731617317173181731917320173211732217323173241732517326173271732817329173301733117332173331733417335173361733717338173391734017341173421734317344173451734617347173481734917350173511735217353173541735517356173571735817359173601736117362173631736417365173661736717368173691737017371173721737317374173751737617377173781737917380173811738217383173841738517386173871738817389173901739117392173931739417395173961739717398173991740017401174021740317404174051740617407174081740917410174111741217413174141741517416174171741817419174201742117422174231742417425174261742717428174291743017431174321743317434174351743617437174381743917440174411744217443174441744517446174471744817449174501745117452174531745417455174561745717458174591746017461174621746317464174651746617467174681746917470174711747217473174741747517476174771747817479174801748117482174831748417485174861748717488174891749017491174921749317494174951749617497174981749917500175011750217503175041750517506175071750817509175101751117512175131751417515175161751717518175191752017521175221752317524175251752617527175281752917530175311753217533175341753517536175371753817539175401754117542175431754417545175461754717548175491755017551175521755317554175551755617557175581755917560175611756217563175641756517566175671756817569175701757117572175731757417575175761757717578175791758017581175821758317584175851758617587175881758917590175911759217593175941759517596175971759817599176001760117602176031760417605176061760717608176091761017611176121761317614176151761617617176181761917620176211762217623176241762517626176271762817629176301763117632176331763417635176361763717638176391764017641176421764317644176451764617647176481764917650176511765217653176541765517656176571765817659176601766117662176631766417665176661766717668176691767017671176721767317674176751767617677176781767917680176811768217683176841768517686176871768817689176901769117692176931769417695176961769717698176991770017701177021770317704177051770617707177081770917710177111771217713177141771517716177171771817719177201772117722177231772417725177261772717728177291773017731177321773317734177351773617737177381773917740177411774217743177441774517746177471774817749177501775117752177531775417755177561775717758177591776017761177621776317764177651776617767177681776917770177711777217773177741777517776177771777817779177801778117782177831778417785177861778717788177891779017791177921779317794177951779617797177981779917800178011780217803178041780517806178071780817809178101781117812178131781417815178161781717818178191782017821178221782317824178251782617827178281782917830178311783217833178341783517836178371783817839178401784117842178431784417845178461784717848178491785017851178521785317854178551785617857178581785917860178611786217863178641786517866178671786817869178701787117872178731787417875178761787717878178791788017881178821788317884178851788617887178881788917890178911789217893178941789517896178971789817899179001790117902179031790417905179061790717908179091791017911179121791317914179151791617917179181791917920179211792217923179241792517926179271792817929179301793117932179331793417935179361793717938179391794017941179421794317944179451794617947179481794917950179511795217953179541795517956179571795817959179601796117962179631796417965179661796717968179691797017971179721797317974179751797617977179781797917980179811798217983179841798517986179871798817989179901799117992179931799417995179961799717998179991800018001180021800318004180051800618007180081800918010180111801218013180141801518016180171801818019180201802118022180231802418025180261802718028180291803018031180321803318034180351803618037180381803918040180411804218043180441804518046180471804818049180501805118052180531805418055180561805718058180591806018061180621806318064180651806618067180681806918070180711807218073180741807518076180771807818079180801808118082180831808418085180861808718088180891809018091180921809318094180951809618097180981809918100181011810218103181041810518106181071810818109181101811118112181131811418115181161811718118181191812018121181221812318124181251812618127181281812918130181311813218133181341813518136181371813818139181401814118142181431814418145181461814718148181491815018151181521815318154181551815618157181581815918160181611816218163181641816518166181671816818169181701817118172181731817418175181761817718178181791818018181181821818318184181851818618187181881818918190181911819218193181941819518196181971819818199182001820118202182031820418205182061820718208182091821018211182121821318214182151821618217182181821918220182211822218223182241822518226182271822818229182301823118232182331823418235182361823718238182391824018241182421824318244182451824618247182481824918250182511825218253182541825518256182571825818259182601826118262182631826418265182661826718268182691827018271182721827318274182751827618277182781827918280182811828218283182841828518286182871828818289182901829118292182931829418295182961829718298182991830018301183021830318304183051830618307183081830918310183111831218313183141831518316183171831818319183201832118322183231832418325183261832718328183291833018331183321833318334183351833618337183381833918340183411834218343183441834518346183471834818349183501835118352183531835418355183561835718358183591836018361183621836318364183651836618367183681836918370183711837218373183741837518376183771837818379183801838118382183831838418385183861838718388183891839018391183921839318394183951839618397183981839918400184011840218403184041840518406184071840818409184101841118412184131841418415184161841718418184191842018421184221842318424184251842618427184281842918430184311843218433184341843518436184371843818439184401844118442184431844418445184461844718448184491845018451184521845318454184551845618457184581845918460184611846218463184641846518466184671846818469184701847118472184731847418475184761847718478184791848018481184821848318484184851848618487184881848918490184911849218493184941849518496184971849818499185001850118502185031850418505185061850718508185091851018511185121851318514185151851618517185181851918520185211852218523185241852518526185271852818529185301853118532185331853418535185361853718538185391854018541185421854318544185451854618547185481854918550185511855218553185541855518556185571855818559185601856118562185631856418565185661856718568185691857018571185721857318574185751857618577185781857918580185811858218583185841858518586185871858818589185901859118592185931859418595185961859718598185991860018601186021860318604186051860618607186081860918610186111861218613186141861518616186171861818619186201862118622186231862418625186261862718628186291863018631186321863318634186351863618637186381863918640186411864218643186441864518646186471864818649186501865118652186531865418655186561865718658186591866018661186621866318664186651866618667186681866918670186711867218673186741867518676186771867818679186801868118682186831868418685186861868718688186891869018691186921869318694186951869618697186981869918700187011870218703187041870518706187071870818709187101871118712187131871418715187161871718718187191872018721187221872318724187251872618727187281872918730187311873218733187341873518736187371873818739187401874118742187431874418745187461874718748187491875018751187521875318754187551875618757187581875918760187611876218763187641876518766187671876818769187701877118772187731877418775187761877718778187791878018781187821878318784187851878618787187881878918790187911879218793187941879518796187971879818799188001880118802188031880418805188061880718808188091881018811188121881318814188151881618817188181881918820188211882218823188241882518826188271882818829188301883118832188331883418835188361883718838188391884018841188421884318844188451884618847188481884918850188511885218853188541885518856188571885818859188601886118862188631886418865188661886718868188691887018871188721887318874188751887618877188781887918880188811888218883188841888518886188871888818889188901889118892188931889418895188961889718898188991890018901189021890318904189051890618907189081890918910189111891218913189141891518916189171891818919189201892118922189231892418925189261892718928189291893018931189321893318934189351893618937189381893918940189411894218943189441894518946189471894818949189501895118952189531895418955189561895718958189591896018961189621896318964189651896618967189681896918970189711897218973189741897518976189771897818979189801898118982189831898418985189861898718988189891899018991189921899318994189951899618997189981899919000190011900219003190041900519006190071900819009190101901119012190131901419015190161901719018190191902019021190221902319024190251902619027190281902919030190311903219033190341903519036190371903819039190401904119042190431904419045190461904719048190491905019051190521905319054190551905619057190581905919060190611906219063190641906519066190671906819069190701907119072190731907419075190761907719078190791908019081190821908319084190851908619087190881908919090190911909219093190941909519096190971909819099191001910119102191031910419105191061910719108191091911019111191121911319114191151911619117191181911919120191211912219123191241912519126191271912819129191301913119132191331913419135191361913719138191391914019141191421914319144191451914619147191481914919150191511915219153191541915519156191571915819159191601916119162191631916419165191661916719168191691917019171191721917319174191751917619177191781917919180191811918219183191841918519186191871918819189191901919119192191931919419195191961919719198191991920019201192021920319204192051920619207192081920919210192111921219213192141921519216192171921819219192201922119222192231922419225192261922719228192291923019231192321923319234192351923619237192381923919240192411924219243192441924519246192471924819249192501925119252192531925419255192561925719258192591926019261192621926319264192651926619267192681926919270192711927219273192741927519276192771927819279192801928119282192831928419285192861928719288192891929019291192921929319294192951929619297192981929919300193011930219303193041930519306193071930819309193101931119312193131931419315193161931719318193191932019321193221932319324193251932619327193281932919330193311933219333193341933519336193371933819339193401934119342193431934419345193461934719348193491935019351193521935319354193551935619357193581935919360193611936219363193641936519366193671936819369193701937119372193731937419375193761937719378193791938019381193821938319384193851938619387193881938919390193911939219393193941939519396193971939819399194001940119402194031940419405194061940719408194091941019411194121941319414194151941619417194181941919420194211942219423194241942519426194271942819429194301943119432194331943419435194361943719438194391944019441194421944319444194451944619447194481944919450194511945219453194541945519456194571945819459194601946119462194631946419465194661946719468194691947019471194721947319474194751947619477194781947919480194811948219483194841948519486194871948819489194901949119492194931949419495194961949719498194991950019501195021950319504195051950619507195081950919510195111951219513195141951519516195171951819519195201952119522195231952419525195261952719528195291953019531195321953319534195351953619537195381953919540195411954219543195441954519546195471954819549195501955119552195531955419555195561955719558195591956019561195621956319564195651956619567195681956919570195711957219573195741957519576195771957819579195801958119582195831958419585195861958719588195891959019591195921959319594195951959619597195981959919600196011960219603196041960519606196071960819609196101961119612196131961419615196161961719618196191962019621196221962319624196251962619627196281962919630196311963219633196341963519636196371963819639196401964119642196431964419645196461964719648196491965019651196521965319654196551965619657196581965919660196611966219663196641966519666196671966819669196701967119672196731967419675196761967719678196791968019681196821968319684196851968619687196881968919690196911969219693196941969519696196971969819699197001970119702197031970419705197061970719708197091971019711197121971319714197151971619717197181971919720197211972219723197241972519726197271972819729197301973119732197331973419735197361973719738197391974019741197421974319744197451974619747197481974919750197511975219753197541975519756197571975819759197601976119762197631976419765197661976719768197691977019771197721977319774197751977619777197781977919780197811978219783197841978519786197871978819789197901979119792197931979419795197961979719798197991980019801198021980319804198051980619807198081980919810198111981219813198141981519816198171981819819198201982119822198231982419825198261982719828198291983019831198321983319834198351983619837198381983919840198411984219843198441984519846198471984819849198501985119852198531985419855198561985719858198591986019861198621986319864198651986619867198681986919870198711987219873198741987519876198771987819879198801988119882198831988419885198861988719888198891989019891198921989319894198951989619897198981989919900199011990219903199041990519906199071990819909199101991119912199131991419915199161991719918199191992019921199221992319924199251992619927199281992919930199311993219933199341993519936199371993819939199401994119942199431994419945199461994719948199491995019951199521995319954199551995619957199581995919960199611996219963199641996519966199671996819969199701997119972199731997419975199761997719978199791998019981199821998319984199851998619987199881998919990199911999219993199941999519996199971999819999200002000120002200032000420005200062000720008200092001020011200122001320014200152001620017200182001920020200212002220023200242002520026200272002820029200302003120032200332003420035200362003720038200392004020041200422004320044200452004620047200482004920050200512005220053200542005520056200572005820059200602006120062200632006420065200662006720068200692007020071200722007320074200752007620077200782007920080200812008220083200842008520086200872008820089200902009120092200932009420095200962009720098200992010020101201022010320104201052010620107201082010920110201112011220113201142011520116201172011820119201202012120122201232012420125201262012720128201292013020131201322013320134201352013620137201382013920140201412014220143201442014520146201472014820149201502015120152201532015420155201562015720158201592016020161201622016320164201652016620167201682016920170201712017220173201742017520176201772017820179201802018120182201832018420185201862018720188201892019020191201922019320194201952019620197201982019920200202012020220203202042020520206202072020820209202102021120212202132021420215202162021720218202192022020221202222022320224202252022620227202282022920230202312023220233202342023520236202372023820239202402024120242202432024420245202462024720248202492025020251202522025320254202552025620257202582025920260202612026220263202642026520266202672026820269202702027120272202732027420275202762027720278202792028020281202822028320284202852028620287202882028920290202912029220293202942029520296202972029820299203002030120302203032030420305203062030720308203092031020311203122031320314203152031620317203182031920320203212032220323203242032520326203272032820329203302033120332203332033420335203362033720338203392034020341203422034320344203452034620347203482034920350203512035220353203542035520356203572035820359203602036120362203632036420365203662036720368203692037020371203722037320374203752037620377203782037920380203812038220383203842038520386203872038820389203902039120392203932039420395203962039720398203992040020401204022040320404204052040620407204082040920410204112041220413204142041520416204172041820419204202042120422204232042420425204262042720428204292043020431204322043320434204352043620437204382043920440204412044220443204442044520446204472044820449204502045120452204532045420455204562045720458204592046020461204622046320464204652046620467204682046920470204712047220473204742047520476204772047820479204802048120482204832048420485204862048720488204892049020491204922049320494204952049620497204982049920500205012050220503205042050520506205072050820509205102051120512205132051420515205162051720518205192052020521205222052320524205252052620527205282052920530205312053220533205342053520536205372053820539205402054120542205432054420545205462054720548205492055020551205522055320554205552055620557205582055920560205612056220563205642056520566205672056820569205702057120572205732057420575205762057720578205792058020581205822058320584205852058620587205882058920590205912059220593205942059520596205972059820599206002060120602206032060420605206062060720608206092061020611206122061320614206152061620617206182061920620206212062220623206242062520626206272062820629206302063120632206332063420635206362063720638206392064020641206422064320644206452064620647206482064920650206512065220653206542065520656206572065820659206602066120662206632066420665206662066720668206692067020671206722067320674206752067620677206782067920680206812068220683206842068520686206872068820689206902069120692206932069420695206962069720698206992070020701207022070320704207052070620707207082070920710207112071220713207142071520716207172071820719207202072120722207232072420725207262072720728207292073020731207322073320734207352073620737207382073920740207412074220743207442074520746207472074820749207502075120752207532075420755207562075720758207592076020761207622076320764207652076620767207682076920770207712077220773207742077520776207772077820779207802078120782207832078420785207862078720788207892079020791207922079320794207952079620797207982079920800208012080220803208042080520806208072080820809208102081120812208132081420815208162081720818208192082020821208222082320824208252082620827208282082920830208312083220833208342083520836208372083820839208402084120842208432084420845208462084720848208492085020851208522085320854208552085620857208582085920860208612086220863208642086520866208672086820869208702087120872208732087420875208762087720878208792088020881208822088320884208852088620887208882088920890208912089220893208942089520896208972089820899209002090120902209032090420905209062090720908209092091020911209122091320914209152091620917209182091920920209212092220923209242092520926209272092820929209302093120932209332093420935209362093720938209392094020941209422094320944209452094620947209482094920950209512095220953209542095520956209572095820959209602096120962209632096420965209662096720968209692097020971209722097320974209752097620977209782097920980209812098220983209842098520986209872098820989209902099120992209932099420995209962099720998209992100021001210022100321004210052100621007210082100921010210112101221013210142101521016210172101821019210202102121022210232102421025210262102721028210292103021031210322103321034210352103621037210382103921040210412104221043210442104521046210472104821049210502105121052210532105421055210562105721058210592106021061210622106321064210652106621067210682106921070210712107221073210742107521076210772107821079210802108121082210832108421085210862108721088210892109021091210922109321094210952109621097210982109921100211012110221103211042110521106211072110821109211102111121112211132111421115211162111721118211192112021121211222112321124211252112621127211282112921130211312113221133211342113521136211372113821139211402114121142211432114421145211462114721148211492115021151211522115321154211552115621157211582115921160211612116221163211642116521166211672116821169211702117121172211732117421175211762117721178211792118021181211822118321184211852118621187211882118921190211912119221193211942119521196211972119821199212002120121202212032120421205212062120721208212092121021211212122121321214212152121621217212182121921220212212122221223212242122521226212272122821229212302123121232212332123421235212362123721238212392124021241212422124321244212452124621247212482124921250212512125221253212542125521256212572125821259212602126121262212632126421265212662126721268212692127021271212722127321274212752127621277212782127921280212812128221283212842128521286212872128821289212902129121292212932129421295212962129721298212992130021301213022130321304213052130621307213082130921310213112131221313213142131521316213172131821319213202132121322213232132421325213262132721328213292133021331213322133321334213352133621337213382133921340213412134221343213442134521346213472134821349213502135121352213532135421355213562135721358213592136021361213622136321364213652136621367213682136921370213712137221373213742137521376213772137821379213802138121382213832138421385213862138721388213892139021391213922139321394213952139621397213982139921400214012140221403214042140521406214072140821409214102141121412214132141421415214162141721418214192142021421214222142321424214252142621427214282142921430214312143221433214342143521436214372143821439214402144121442214432144421445214462144721448214492145021451214522145321454214552145621457214582145921460214612146221463214642146521466214672146821469214702147121472214732147421475214762147721478214792148021481214822148321484214852148621487214882148921490214912149221493214942149521496214972149821499215002150121502215032150421505215062150721508215092151021511215122151321514215152151621517215182151921520215212152221523215242152521526215272152821529215302153121532215332153421535215362153721538215392154021541215422154321544215452154621547215482154921550215512155221553215542155521556215572155821559215602156121562215632156421565215662156721568215692157021571215722157321574215752157621577215782157921580215812158221583215842158521586215872158821589215902159121592215932159421595215962159721598215992160021601216022160321604216052160621607216082160921610216112161221613216142161521616216172161821619216202162121622216232162421625216262162721628216292163021631216322163321634216352163621637216382163921640216412164221643216442164521646216472164821649216502165121652216532165421655216562165721658216592166021661216622166321664216652166621667216682166921670216712167221673216742167521676216772167821679216802168121682216832168421685216862168721688216892169021691216922169321694216952169621697216982169921700217012170221703217042170521706217072170821709217102171121712217132171421715217162171721718217192172021721217222172321724217252172621727217282172921730217312173221733217342173521736217372173821739217402174121742217432174421745217462174721748217492175021751217522175321754217552175621757217582175921760217612176221763217642176521766217672176821769217702177121772217732177421775217762177721778217792178021781217822178321784217852178621787217882178921790217912179221793217942179521796217972179821799218002180121802218032180421805218062180721808218092181021811218122181321814218152181621817218182181921820218212182221823218242182521826218272182821829218302183121832218332183421835218362183721838218392184021841218422184321844218452184621847218482184921850218512185221853218542185521856218572185821859218602186121862218632186421865218662186721868218692187021871218722187321874218752187621877218782187921880218812188221883218842188521886218872188821889218902189121892218932189421895218962189721898218992190021901219022190321904219052190621907219082190921910219112191221913219142191521916219172191821919219202192121922219232192421925219262192721928219292193021931219322193321934219352193621937219382193921940219412194221943219442194521946219472194821949219502195121952219532195421955219562195721958219592196021961219622196321964219652196621967219682196921970219712197221973219742197521976219772197821979219802198121982219832198421985219862198721988219892199021991219922199321994219952199621997219982199922000220012200222003220042200522006220072200822009220102201122012220132201422015220162201722018220192202022021220222202322024220252202622027220282202922030220312203222033220342203522036220372203822039220402204122042220432204422045220462204722048220492205022051220522205322054220552205622057220582205922060220612206222063220642206522066220672206822069220702207122072220732207422075220762207722078220792208022081220822208322084220852208622087220882208922090220912209222093220942209522096220972209822099221002210122102221032210422105221062210722108221092211022111221122211322114221152211622117221182211922120221212212222123221242212522126221272212822129221302213122132221332213422135221362213722138221392214022141221422214322144221452214622147221482214922150221512215222153221542215522156221572215822159221602216122162221632216422165221662216722168221692217022171221722217322174221752217622177221782217922180221812218222183221842218522186221872218822189221902219122192221932219422195221962219722198221992220022201222022220322204222052220622207222082220922210222112221222213222142221522216222172221822219222202222122222222232222422225222262222722228222292223022231222322223322234222352223622237222382223922240222412224222243222442224522246222472224822249222502225122252222532225422255222562225722258222592226022261222622226322264222652226622267222682226922270222712227222273222742227522276222772227822279222802228122282222832228422285222862228722288222892229022291222922229322294222952229622297222982229922300223012230222303223042230522306223072230822309223102231122312223132231422315223162231722318223192232022321223222232322324223252232622327223282232922330223312233222333223342233522336223372233822339223402234122342223432234422345223462234722348223492235022351223522235322354223552235622357223582235922360223612236222363223642236522366223672236822369223702237122372223732237422375223762237722378223792238022381223822238322384223852238622387223882238922390223912239222393223942239522396223972239822399224002240122402224032240422405224062240722408224092241022411224122241322414224152241622417224182241922420224212242222423224242242522426224272242822429224302243122432224332243422435224362243722438224392244022441224422244322444224452244622447224482244922450224512245222453224542245522456224572245822459224602246122462224632246422465224662246722468224692247022471224722247322474224752247622477224782247922480224812248222483224842248522486224872248822489224902249122492224932249422495224962249722498224992250022501225022250322504225052250622507225082250922510225112251222513225142251522516225172251822519225202252122522225232252422525225262252722528225292253022531225322253322534225352253622537225382253922540225412254222543225442254522546225472254822549225502255122552225532255422555225562255722558225592256022561225622256322564225652256622567225682256922570225712257222573225742257522576225772257822579225802258122582225832258422585225862258722588225892259022591225922259322594225952259622597225982259922600226012260222603226042260522606226072260822609226102261122612226132261422615226162261722618226192262022621226222262322624226252262622627226282262922630226312263222633226342263522636226372263822639226402264122642226432264422645226462264722648226492265022651226522265322654226552265622657226582265922660226612266222663226642266522666226672266822669226702267122672226732267422675226762267722678226792268022681226822268322684226852268622687226882268922690226912269222693226942269522696226972269822699227002270122702227032270422705227062270722708227092271022711227122271322714227152271622717227182271922720227212272222723227242272522726227272272822729227302273122732227332273422735227362273722738227392274022741227422274322744227452274622747227482274922750227512275222753227542275522756227572275822759227602276122762227632276422765227662276722768227692277022771227722277322774227752277622777227782277922780227812278222783227842278522786227872278822789227902279122792227932279422795227962279722798227992280022801228022280322804228052280622807228082280922810228112281222813228142281522816228172281822819228202282122822228232282422825228262282722828228292283022831228322283322834228352283622837228382283922840228412284222843228442284522846228472284822849228502285122852228532285422855228562285722858228592286022861228622286322864228652286622867228682286922870228712287222873228742287522876228772287822879228802288122882228832288422885228862288722888228892289022891228922289322894228952289622897228982289922900229012290222903229042290522906229072290822909229102291122912229132291422915229162291722918229192292022921229222292322924229252292622927229282292922930229312293222933229342293522936229372293822939229402294122942229432294422945229462294722948229492295022951229522295322954229552295622957229582295922960229612296222963229642296522966229672296822969229702297122972229732297422975229762297722978229792298022981229822298322984229852298622987229882298922990229912299222993229942299522996229972299822999230002300123002230032300423005230062300723008230092301023011230122301323014230152301623017230182301923020230212302223023230242302523026230272302823029230302303123032230332303423035230362303723038230392304023041230422304323044230452304623047230482304923050230512305223053230542305523056230572305823059230602306123062230632306423065230662306723068230692307023071230722307323074230752307623077230782307923080230812308223083230842308523086230872308823089230902309123092230932309423095230962309723098230992310023101231022310323104231052310623107231082310923110231112311223113231142311523116231172311823119231202312123122231232312423125231262312723128231292313023131231322313323134231352313623137231382313923140231412314223143231442314523146231472314823149231502315123152231532315423155231562315723158231592316023161231622316323164231652316623167231682316923170231712317223173231742317523176231772317823179231802318123182231832318423185231862318723188231892319023191231922319323194231952319623197231982319923200232012320223203232042320523206232072320823209232102321123212232132321423215232162321723218232192322023221232222322323224232252322623227232282322923230232312323223233232342323523236232372323823239232402324123242232432324423245232462324723248232492325023251232522325323254232552325623257232582325923260232612326223263232642326523266232672326823269232702327123272232732327423275232762327723278232792328023281232822328323284232852328623287232882328923290232912329223293232942329523296232972329823299233002330123302233032330423305233062330723308233092331023311233122331323314233152331623317233182331923320233212332223323233242332523326233272332823329233302333123332233332333423335233362333723338233392334023341233422334323344233452334623347233482334923350233512335223353233542335523356233572335823359233602336123362233632336423365233662336723368233692337023371233722337323374233752337623377233782337923380233812338223383233842338523386233872338823389233902339123392233932339423395233962339723398233992340023401234022340323404234052340623407234082340923410234112341223413234142341523416234172341823419234202342123422234232342423425234262342723428234292343023431234322343323434234352343623437234382343923440234412344223443234442344523446234472344823449234502345123452234532345423455234562345723458234592346023461234622346323464234652346623467234682346923470234712347223473234742347523476234772347823479234802348123482234832348423485234862348723488234892349023491234922349323494234952349623497234982349923500235012350223503235042350523506235072350823509235102351123512235132351423515235162351723518235192352023521235222352323524235252352623527235282352923530235312353223533235342353523536235372353823539235402354123542235432354423545235462354723548235492355023551235522355323554235552355623557235582355923560235612356223563235642356523566235672356823569235702357123572235732357423575235762357723578235792358023581235822358323584235852358623587235882358923590235912359223593235942359523596235972359823599236002360123602236032360423605236062360723608236092361023611236122361323614236152361623617236182361923620236212362223623236242362523626236272362823629236302363123632236332363423635236362363723638236392364023641236422364323644236452364623647236482364923650236512365223653236542365523656236572365823659236602366123662236632366423665236662366723668236692367023671236722367323674236752367623677236782367923680236812368223683236842368523686236872368823689236902369123692236932369423695236962369723698236992370023701237022370323704237052370623707237082370923710237112371223713237142371523716237172371823719237202372123722237232372423725237262372723728237292373023731237322373323734237352373623737237382373923740237412374223743237442374523746237472374823749237502375123752237532375423755237562375723758237592376023761237622376323764237652376623767237682376923770237712377223773237742377523776237772377823779237802378123782237832378423785237862378723788237892379023791237922379323794237952379623797237982379923800238012380223803238042380523806238072380823809238102381123812238132381423815238162381723818238192382023821238222382323824238252382623827238282382923830238312383223833238342383523836238372383823839238402384123842238432384423845238462384723848238492385023851238522385323854238552385623857238582385923860238612386223863238642386523866238672386823869238702387123872238732387423875238762387723878238792388023881238822388323884238852388623887238882388923890238912389223893238942389523896238972389823899239002390123902239032390423905239062390723908239092391023911239122391323914239152391623917239182391923920239212392223923239242392523926239272392823929239302393123932239332393423935239362393723938239392394023941239422394323944239452394623947239482394923950239512395223953239542395523956239572395823959239602396123962239632396423965239662396723968239692397023971239722397323974239752397623977239782397923980239812398223983239842398523986239872398823989239902399123992239932399423995239962399723998239992400024001240022400324004240052400624007240082400924010240112401224013240142401524016240172401824019240202402124022240232402424025240262402724028240292403024031240322403324034240352403624037240382403924040240412404224043240442404524046240472404824049240502405124052240532405424055240562405724058240592406024061240622406324064240652406624067240682406924070240712407224073240742407524076240772407824079240802408124082240832408424085240862408724088240892409024091240922409324094240952409624097240982409924100241012410224103241042410524106241072410824109241102411124112241132411424115241162411724118241192412024121241222412324124241252412624127241282412924130241312413224133241342413524136241372413824139241402414124142241432414424145241462414724148241492415024151241522415324154241552415624157241582415924160241612416224163241642416524166241672416824169241702417124172241732417424175241762417724178241792418024181241822418324184241852418624187241882418924190241912419224193241942419524196241972419824199242002420124202242032420424205242062420724208242092421024211242122421324214242152421624217242182421924220242212422224223242242422524226242272422824229242302423124232242332423424235242362423724238242392424024241242422424324244242452424624247242482424924250242512425224253242542425524256242572425824259242602426124262242632426424265242662426724268242692427024271242722427324274242752427624277242782427924280242812428224283242842428524286242872428824289242902429124292242932429424295242962429724298242992430024301243022430324304243052430624307243082430924310243112431224313243142431524316243172431824319243202432124322243232432424325243262432724328243292433024331243322433324334243352433624337243382433924340243412434224343243442434524346243472434824349243502435124352243532435424355243562435724358243592436024361243622436324364243652436624367243682436924370243712437224373243742437524376243772437824379243802438124382243832438424385243862438724388243892439024391243922439324394243952439624397243982439924400244012440224403244042440524406244072440824409244102441124412244132441424415244162441724418244192442024421244222442324424244252442624427244282442924430244312443224433244342443524436244372443824439244402444124442244432444424445244462444724448244492445024451244522445324454244552445624457244582445924460244612446224463244642446524466244672446824469244702447124472244732447424475244762447724478244792448024481244822448324484244852448624487244882448924490244912449224493244942449524496244972449824499245002450124502245032450424505245062450724508245092451024511245122451324514245152451624517245182451924520245212452224523245242452524526245272452824529245302453124532245332453424535245362453724538245392454024541245422454324544245452454624547245482454924550245512455224553245542455524556245572455824559245602456124562245632456424565245662456724568245692457024571245722457324574245752457624577245782457924580245812458224583245842458524586245872458824589245902459124592245932459424595245962459724598245992460024601246022460324604246052460624607246082460924610246112461224613246142461524616246172461824619246202462124622246232462424625246262462724628246292463024631246322463324634246352463624637246382463924640246412464224643246442464524646246472464824649246502465124652246532465424655246562465724658246592466024661246622466324664246652466624667246682466924670246712467224673246742467524676246772467824679246802468124682246832468424685246862468724688246892469024691246922469324694246952469624697246982469924700247012470224703247042470524706247072470824709247102471124712247132471424715247162471724718247192472024721247222472324724247252472624727247282472924730247312473224733247342473524736247372473824739247402474124742247432474424745247462474724748247492475024751247522475324754247552475624757247582475924760247612476224763247642476524766247672476824769247702477124772247732477424775247762477724778247792478024781247822478324784247852478624787247882478924790247912479224793247942479524796247972479824799248002480124802248032480424805248062480724808248092481024811248122481324814248152481624817248182481924820248212482224823248242482524826248272482824829248302483124832248332483424835248362483724838248392484024841248422484324844248452484624847248482484924850248512485224853248542485524856248572485824859248602486124862248632486424865248662486724868248692487024871248722487324874248752487624877248782487924880248812488224883248842488524886248872488824889248902489124892248932489424895248962489724898248992490024901249022490324904249052490624907249082490924910249112491224913249142491524916249172491824919249202492124922249232492424925249262492724928249292493024931249322493324934249352493624937249382493924940249412494224943249442494524946249472494824949249502495124952249532495424955249562495724958249592496024961249622496324964249652496624967249682496924970249712497224973249742497524976249772497824979249802498124982249832498424985249862498724988249892499024991249922499324994249952499624997249982499925000250012500225003250042500525006250072500825009250102501125012250132501425015250162501725018250192502025021250222502325024250252502625027250282502925030250312503225033250342503525036250372503825039250402504125042250432504425045250462504725048250492505025051250522505325054250552505625057250582505925060250612506225063250642506525066250672506825069250702507125072250732507425075250762507725078250792508025081250822508325084250852508625087250882508925090250912509225093250942509525096250972509825099251002510125102251032510425105251062510725108251092511025111251122511325114251152511625117251182511925120251212512225123251242512525126251272512825129251302513125132251332513425135251362513725138251392514025141251422514325144251452514625147251482514925150251512515225153251542515525156251572515825159251602516125162251632516425165251662516725168251692517025171251722517325174251752517625177251782517925180251812518225183251842518525186251872518825189251902519125192251932519425195251962519725198251992520025201252022520325204252052520625207252082520925210252112521225213252142521525216252172521825219252202522125222252232522425225252262522725228252292523025231252322523325234252352523625237252382523925240252412524225243252442524525246252472524825249252502525125252252532525425255252562525725258252592526025261252622526325264252652526625267252682526925270252712527225273252742527525276252772527825279252802528125282252832528425285252862528725288252892529025291252922529325294252952529625297252982529925300253012530225303253042530525306253072530825309253102531125312253132531425315253162531725318253192532025321253222532325324253252532625327253282532925330253312533225333253342533525336253372533825339253402534125342253432534425345253462534725348253492535025351253522535325354253552535625357253582535925360253612536225363253642536525366253672536825369253702537125372253732537425375253762537725378253792538025381253822538325384253852538625387253882538925390253912539225393253942539525396253972539825399254002540125402254032540425405254062540725408254092541025411254122541325414254152541625417254182541925420254212542225423254242542525426254272542825429254302543125432254332543425435254362543725438254392544025441254422544325444254452544625447254482544925450254512545225453254542545525456254572545825459254602546125462254632546425465254662546725468254692547025471254722547325474254752547625477254782547925480254812548225483254842548525486254872548825489254902549125492254932549425495254962549725498254992550025501255022550325504255052550625507255082550925510255112551225513255142551525516255172551825519255202552125522255232552425525255262552725528255292553025531255322553325534255352553625537255382553925540255412554225543255442554525546255472554825549255502555125552255532555425555255562555725558255592556025561255622556325564255652556625567255682556925570255712557225573255742557525576255772557825579255802558125582255832558425585255862558725588255892559025591255922559325594255952559625597255982559925600256012560225603256042560525606256072560825609256102561125612256132561425615256162561725618256192562025621256222562325624256252562625627256282562925630256312563225633256342563525636256372563825639256402564125642256432564425645256462564725648256492565025651256522565325654256552565625657256582565925660256612566225663256642566525666256672566825669256702567125672256732567425675256762567725678256792568025681256822568325684256852568625687256882568925690256912569225693256942569525696256972569825699257002570125702257032570425705257062570725708257092571025711257122571325714257152571625717257182571925720257212572225723257242572525726257272572825729257302573125732257332573425735257362573725738257392574025741257422574325744257452574625747257482574925750257512575225753257542575525756257572575825759257602576125762257632576425765257662576725768257692577025771257722577325774257752577625777257782577925780257812578225783257842578525786257872578825789257902579125792257932579425795257962579725798257992580025801258022580325804258052580625807258082580925810258112581225813258142581525816258172581825819258202582125822258232582425825258262582725828258292583025831258322583325834258352583625837258382583925840258412584225843258442584525846258472584825849258502585125852258532585425855258562585725858258592586025861258622586325864258652586625867258682586925870258712587225873258742587525876258772587825879258802588125882258832588425885258862588725888258892589025891258922589325894258952589625897258982589925900259012590225903259042590525906259072590825909259102591125912259132591425915259162591725918259192592025921259222592325924259252592625927259282592925930259312593225933259342593525936259372593825939259402594125942259432594425945259462594725948259492595025951259522595325954259552595625957259582595925960259612596225963259642596525966259672596825969259702597125972259732597425975259762597725978259792598025981259822598325984259852598625987259882598925990259912599225993259942599525996259972599825999260002600126002260032600426005260062600726008260092601026011260122601326014260152601626017260182601926020260212602226023260242602526026260272602826029260302603126032260332603426035260362603726038260392604026041260422604326044260452604626047260482604926050260512605226053260542605526056260572605826059260602606126062260632606426065260662606726068260692607026071260722607326074260752607626077260782607926080260812608226083260842608526086260872608826089260902609126092260932609426095260962609726098260992610026101261022610326104261052610626107261082610926110261112611226113261142611526116261172611826119261202612126122261232612426125261262612726128261292613026131261322613326134261352613626137261382613926140261412614226143261442614526146261472614826149261502615126152261532615426155261562615726158261592616026161261622616326164261652616626167261682616926170261712617226173261742617526176261772617826179261802618126182261832618426185261862618726188261892619026191261922619326194261952619626197261982619926200262012620226203262042620526206262072620826209262102621126212262132621426215262162621726218262192622026221262222622326224262252622626227262282622926230262312623226233262342623526236262372623826239262402624126242262432624426245262462624726248262492625026251262522625326254262552625626257262582625926260262612626226263262642626526266262672626826269262702627126272262732627426275262762627726278262792628026281262822628326284262852628626287262882628926290262912629226293262942629526296262972629826299263002630126302263032630426305263062630726308263092631026311263122631326314263152631626317263182631926320263212632226323263242632526326263272632826329263302633126332263332633426335263362633726338263392634026341263422634326344263452634626347263482634926350263512635226353263542635526356263572635826359263602636126362263632636426365263662636726368263692637026371263722637326374263752637626377263782637926380263812638226383263842638526386263872638826389263902639126392263932639426395263962639726398263992640026401264022640326404264052640626407264082640926410264112641226413264142641526416264172641826419264202642126422264232642426425264262642726428264292643026431264322643326434264352643626437264382643926440264412644226443264442644526446264472644826449264502645126452264532645426455264562645726458264592646026461264622646326464264652646626467264682646926470264712647226473264742647526476264772647826479264802648126482264832648426485264862648726488264892649026491264922649326494264952649626497264982649926500265012650226503265042650526506265072650826509265102651126512265132651426515265162651726518265192652026521265222652326524265252652626527265282652926530265312653226533265342653526536265372653826539265402654126542265432654426545265462654726548265492655026551265522655326554265552655626557265582655926560265612656226563265642656526566265672656826569265702657126572265732657426575265762657726578265792658026581265822658326584265852658626587265882658926590265912659226593265942659526596265972659826599266002660126602266032660426605266062660726608266092661026611266122661326614266152661626617266182661926620266212662226623266242662526626266272662826629266302663126632266332663426635266362663726638266392664026641266422664326644266452664626647266482664926650266512665226653266542665526656266572665826659266602666126662266632666426665266662666726668266692667026671266722667326674266752667626677266782667926680266812668226683266842668526686266872668826689266902669126692266932669426695266962669726698266992670026701267022670326704267052670626707267082670926710267112671226713267142671526716267172671826719267202672126722267232672426725267262672726728267292673026731267322673326734267352673626737267382673926740267412674226743267442674526746267472674826749267502675126752267532675426755267562675726758267592676026761267622676326764267652676626767267682676926770267712677226773267742677526776267772677826779267802678126782267832678426785267862678726788267892679026791267922679326794267952679626797267982679926800268012680226803268042680526806268072680826809268102681126812268132681426815268162681726818268192682026821268222682326824268252682626827268282682926830268312683226833268342683526836268372683826839268402684126842268432684426845268462684726848268492685026851268522685326854268552685626857268582685926860268612686226863268642686526866268672686826869268702687126872268732687426875268762687726878268792688026881268822688326884268852688626887268882688926890268912689226893268942689526896268972689826899269002690126902269032690426905269062690726908269092691026911269122691326914269152691626917269182691926920269212692226923269242692526926269272692826929269302693126932269332693426935269362693726938269392694026941269422694326944269452694626947269482694926950269512695226953269542695526956269572695826959269602696126962269632696426965269662696726968269692697026971269722697326974269752697626977269782697926980269812698226983269842698526986269872698826989269902699126992269932699426995269962699726998269992700027001270022700327004270052700627007270082700927010270112701227013270142701527016270172701827019270202702127022270232702427025270262702727028270292703027031270322703327034270352703627037270382703927040270412704227043270442704527046270472704827049270502705127052270532705427055270562705727058270592706027061270622706327064270652706627067270682706927070270712707227073270742707527076270772707827079270802708127082270832708427085270862708727088270892709027091270922709327094270952709627097270982709927100271012710227103271042710527106271072710827109271102711127112271132711427115271162711727118271192712027121271222712327124271252712627127271282712927130271312713227133271342713527136271372713827139271402714127142271432714427145271462714727148271492715027151271522715327154271552715627157271582715927160271612716227163271642716527166271672716827169271702717127172271732717427175271762717727178271792718027181271822718327184271852718627187271882718927190271912719227193271942719527196271972719827199272002720127202272032720427205272062720727208272092721027211272122721327214272152721627217272182721927220272212722227223272242722527226272272722827229272302723127232272332723427235272362723727238272392724027241272422724327244272452724627247272482724927250272512725227253272542725527256272572725827259272602726127262272632726427265272662726727268272692727027271272722727327274272752727627277272782727927280272812728227283272842728527286272872728827289272902729127292272932729427295272962729727298272992730027301273022730327304273052730627307273082730927310273112731227313273142731527316273172731827319273202732127322273232732427325273262732727328273292733027331273322733327334273352733627337273382733927340273412734227343273442734527346273472734827349273502735127352273532735427355273562735727358273592736027361273622736327364273652736627367273682736927370273712737227373273742737527376273772737827379273802738127382273832738427385273862738727388273892739027391273922739327394273952739627397273982739927400274012740227403274042740527406274072740827409274102741127412274132741427415274162741727418274192742027421274222742327424274252742627427274282742927430274312743227433274342743527436274372743827439274402744127442274432744427445274462744727448274492745027451274522745327454274552745627457274582745927460274612746227463274642746527466274672746827469274702747127472274732747427475274762747727478274792748027481274822748327484274852748627487274882748927490274912749227493274942749527496274972749827499275002750127502275032750427505275062750727508275092751027511275122751327514275152751627517275182751927520275212752227523275242752527526275272752827529275302753127532275332753427535275362753727538275392754027541275422754327544275452754627547275482754927550275512755227553275542755527556275572755827559275602756127562275632756427565275662756727568275692757027571275722757327574275752757627577275782757927580275812758227583275842758527586275872758827589275902759127592275932759427595275962759727598275992760027601276022760327604276052760627607276082760927610276112761227613276142761527616276172761827619276202762127622276232762427625276262762727628276292763027631276322763327634276352763627637276382763927640276412764227643276442764527646276472764827649276502765127652276532765427655276562765727658276592766027661276622766327664276652766627667276682766927670276712767227673276742767527676276772767827679276802768127682276832768427685276862768727688276892769027691276922769327694276952769627697276982769927700277012770227703277042770527706277072770827709277102771127712277132771427715277162771727718277192772027721277222772327724277252772627727277282772927730277312773227733277342773527736277372773827739277402774127742277432774427745277462774727748277492775027751277522775327754277552775627757277582775927760277612776227763277642776527766277672776827769277702777127772277732777427775277762777727778277792778027781277822778327784277852778627787277882778927790277912779227793277942779527796277972779827799278002780127802278032780427805278062780727808278092781027811278122781327814278152781627817278182781927820278212782227823278242782527826278272782827829278302783127832278332783427835278362783727838278392784027841278422784327844278452784627847278482784927850278512785227853278542785527856278572785827859278602786127862278632786427865278662786727868278692787027871278722787327874278752787627877278782787927880278812788227883278842788527886278872788827889278902789127892278932789427895278962789727898278992790027901279022790327904279052790627907279082790927910279112791227913279142791527916279172791827919279202792127922279232792427925279262792727928279292793027931279322793327934279352793627937279382793927940279412794227943279442794527946279472794827949279502795127952279532795427955279562795727958279592796027961279622796327964279652796627967279682796927970279712797227973279742797527976279772797827979279802798127982279832798427985279862798727988279892799027991279922799327994279952799627997279982799928000280012800228003280042800528006280072800828009280102801128012280132801428015280162801728018280192802028021280222802328024280252802628027280282802928030280312803228033280342803528036280372803828039280402804128042280432804428045280462804728048280492805028051280522805328054280552805628057280582805928060280612806228063280642806528066280672806828069280702807128072280732807428075280762807728078280792808028081280822808328084280852808628087280882808928090280912809228093280942809528096280972809828099281002810128102281032810428105281062810728108281092811028111281122811328114281152811628117281182811928120281212812228123281242812528126281272812828129281302813128132281332813428135281362813728138281392814028141281422814328144281452814628147281482814928150281512815228153281542815528156281572815828159281602816128162281632816428165281662816728168281692817028171281722817328174281752817628177281782817928180281812818228183281842818528186281872818828189281902819128192281932819428195281962819728198281992820028201282022820328204282052820628207282082820928210282112821228213282142821528216282172821828219282202822128222282232822428225282262822728228282292823028231282322823328234282352823628237282382823928240282412824228243282442824528246282472824828249282502825128252282532825428255282562825728258282592826028261282622826328264282652826628267282682826928270282712827228273282742827528276282772827828279282802828128282282832828428285282862828728288282892829028291282922829328294282952829628297282982829928300283012830228303283042830528306283072830828309283102831128312283132831428315283162831728318283192832028321283222832328324283252832628327283282832928330283312833228333283342833528336283372833828339283402834128342283432834428345283462834728348283492835028351283522835328354283552835628357283582835928360283612836228363283642836528366283672836828369283702837128372283732837428375283762837728378283792838028381283822838328384283852838628387283882838928390283912839228393283942839528396283972839828399284002840128402284032840428405284062840728408284092841028411284122841328414284152841628417284182841928420284212842228423284242842528426284272842828429284302843128432284332843428435284362843728438284392844028441284422844328444284452844628447284482844928450284512845228453284542845528456284572845828459284602846128462284632846428465284662846728468284692847028471284722847328474284752847628477284782847928480284812848228483284842848528486284872848828489284902849128492284932849428495284962849728498284992850028501285022850328504285052850628507285082850928510285112851228513285142851528516285172851828519285202852128522285232852428525285262852728528285292853028531285322853328534285352853628537285382853928540285412854228543285442854528546285472854828549285502855128552285532855428555285562855728558285592856028561285622856328564285652856628567285682856928570285712857228573285742857528576285772857828579285802858128582285832858428585285862858728588285892859028591285922859328594285952859628597285982859928600286012860228603286042860528606286072860828609286102861128612286132861428615286162861728618286192862028621286222862328624286252862628627286282862928630286312863228633286342863528636286372863828639286402864128642286432864428645286462864728648286492865028651286522865328654286552865628657286582865928660286612866228663286642866528666286672866828669286702867128672286732867428675286762867728678286792868028681286822868328684286852868628687286882868928690286912869228693286942869528696286972869828699287002870128702287032870428705287062870728708287092871028711287122871328714287152871628717287182871928720287212872228723287242872528726287272872828729287302873128732287332873428735287362873728738287392874028741287422874328744287452874628747287482874928750287512875228753287542875528756287572875828759287602876128762287632876428765287662876728768287692877028771287722877328774287752877628777287782877928780287812878228783287842878528786287872878828789287902879128792287932879428795287962879728798287992880028801288022880328804288052880628807288082880928810288112881228813288142881528816288172881828819288202882128822288232882428825288262882728828288292883028831288322883328834288352883628837288382883928840288412884228843288442884528846288472884828849288502885128852288532885428855288562885728858288592886028861288622886328864288652886628867288682886928870288712887228873288742887528876288772887828879288802888128882288832888428885288862888728888288892889028891288922889328894288952889628897288982889928900289012890228903289042890528906289072890828909289102891128912289132891428915289162891728918289192892028921289222892328924289252892628927289282892928930289312893228933289342893528936289372893828939289402894128942289432894428945289462894728948289492895028951289522895328954289552895628957289582895928960289612896228963289642896528966289672896828969289702897128972289732897428975289762897728978289792898028981289822898328984289852898628987289882898928990289912899228993289942899528996289972899828999290002900129002290032900429005290062900729008290092901029011290122901329014290152901629017290182901929020290212902229023290242902529026290272902829029290302903129032290332903429035290362903729038290392904029041290422904329044290452904629047290482904929050290512905229053290542905529056290572905829059290602906129062290632906429065290662906729068290692907029071290722907329074290752907629077290782907929080290812908229083290842908529086290872908829089290902909129092290932909429095290962909729098290992910029101291022910329104291052910629107291082910929110291112911229113291142911529116291172911829119291202912129122291232912429125291262912729128291292913029131291322913329134291352913629137291382913929140291412914229143291442914529146291472914829149291502915129152291532915429155291562915729158291592916029161291622916329164291652916629167291682916929170291712917229173291742917529176291772917829179291802918129182291832918429185291862918729188291892919029191291922919329194291952919629197291982919929200292012920229203292042920529206292072920829209292102921129212292132921429215292162921729218292192922029221292222922329224292252922629227292282922929230292312923229233292342923529236292372923829239292402924129242292432924429245292462924729248292492925029251292522925329254292552925629257292582925929260292612926229263292642926529266292672926829269292702927129272292732927429275292762927729278292792928029281292822928329284292852928629287292882928929290292912929229293292942929529296292972929829299293002930129302293032930429305293062930729308293092931029311293122931329314293152931629317293182931929320293212932229323293242932529326293272932829329293302933129332293332933429335293362933729338293392934029341293422934329344293452934629347293482934929350293512935229353293542935529356293572935829359293602936129362293632936429365293662936729368293692937029371293722937329374293752937629377293782937929380293812938229383293842938529386293872938829389293902939129392293932939429395293962939729398293992940029401294022940329404294052940629407294082940929410294112941229413294142941529416294172941829419294202942129422294232942429425294262942729428294292943029431294322943329434294352943629437294382943929440294412944229443294442944529446294472944829449294502945129452294532945429455294562945729458294592946029461294622946329464294652946629467294682946929470294712947229473294742947529476294772947829479294802948129482294832948429485294862948729488294892949029491294922949329494294952949629497294982949929500295012950229503295042950529506295072950829509295102951129512295132951429515295162951729518295192952029521295222952329524295252952629527295282952929530295312953229533295342953529536295372953829539295402954129542295432954429545295462954729548295492955029551295522955329554295552955629557295582955929560295612956229563295642956529566295672956829569295702957129572295732957429575295762957729578295792958029581295822958329584295852958629587295882958929590295912959229593295942959529596295972959829599296002960129602296032960429605296062960729608296092961029611296122961329614296152961629617296182961929620296212962229623296242962529626296272962829629296302963129632296332963429635296362963729638296392964029641296422964329644296452964629647296482964929650296512965229653296542965529656296572965829659296602966129662296632966429665296662966729668296692967029671296722967329674296752967629677296782967929680296812968229683296842968529686296872968829689296902969129692296932969429695296962969729698296992970029701297022970329704297052970629707297082970929710297112971229713297142971529716297172971829719297202972129722297232972429725297262972729728297292973029731297322973329734297352973629737297382973929740297412974229743297442974529746297472974829749297502975129752297532975429755297562975729758297592976029761297622976329764297652976629767297682976929770297712977229773297742977529776297772977829779297802978129782297832978429785297862978729788297892979029791297922979329794297952979629797297982979929800298012980229803298042980529806298072980829809298102981129812298132981429815298162981729818298192982029821298222982329824298252982629827298282982929830298312983229833298342983529836298372983829839298402984129842298432984429845298462984729848298492985029851298522985329854298552985629857298582985929860298612986229863298642986529866298672986829869298702987129872298732987429875298762987729878298792988029881298822988329884298852988629887298882988929890298912989229893298942989529896298972989829899299002990129902299032990429905299062990729908299092991029911299122991329914299152991629917299182991929920299212992229923299242992529926299272992829929299302993129932299332993429935299362993729938299392994029941299422994329944299452994629947299482994929950299512995229953299542995529956299572995829959299602996129962299632996429965299662996729968299692997029971299722997329974299752997629977299782997929980299812998229983299842998529986299872998829989299902999129992299932999429995299962999729998299993000030001300023000330004300053000630007300083000930010300113001230013300143001530016300173001830019300203002130022300233002430025300263002730028300293003030031300323003330034300353003630037300383003930040300413004230043300443004530046300473004830049300503005130052300533005430055300563005730058300593006030061300623006330064300653006630067300683006930070300713007230073300743007530076300773007830079300803008130082300833008430085300863008730088300893009030091300923009330094300953009630097300983009930100301013010230103301043010530106301073010830109301103011130112301133011430115301163011730118301193012030121301223012330124301253012630127301283012930130301313013230133301343013530136301373013830139301403014130142301433014430145301463014730148301493015030151301523015330154301553015630157301583015930160301613016230163301643016530166301673016830169301703017130172301733017430175301763017730178301793018030181301823018330184301853018630187301883018930190301913019230193301943019530196301973019830199302003020130202302033020430205302063020730208302093021030211302123021330214302153021630217302183021930220302213022230223302243022530226302273022830229302303023130232302333023430235302363023730238302393024030241302423024330244302453024630247302483024930250302513025230253302543025530256302573025830259302603026130262302633026430265302663026730268302693027030271302723027330274302753027630277302783027930280302813028230283302843028530286302873028830289302903029130292302933029430295302963029730298302993030030301303023030330304303053030630307303083030930310303113031230313303143031530316303173031830319303203032130322303233032430325303263032730328303293033030331303323033330334303353033630337303383033930340303413034230343303443034530346303473034830349303503035130352303533035430355303563035730358303593036030361303623036330364303653036630367303683036930370303713037230373303743037530376303773037830379303803038130382303833038430385303863038730388303893039030391303923039330394303953039630397303983039930400304013040230403304043040530406304073040830409304103041130412304133041430415304163041730418304193042030421304223042330424304253042630427304283042930430304313043230433304343043530436304373043830439304403044130442304433044430445304463044730448304493045030451304523045330454304553045630457304583045930460304613046230463304643046530466304673046830469304703047130472304733047430475304763047730478304793048030481304823048330484304853048630487304883048930490304913049230493304943049530496304973049830499305003050130502305033050430505305063050730508305093051030511305123051330514305153051630517305183051930520305213052230523305243052530526305273052830529305303053130532305333053430535305363053730538305393054030541305423054330544305453054630547305483054930550305513055230553305543055530556305573055830559305603056130562305633056430565305663056730568305693057030571305723057330574305753057630577305783057930580305813058230583305843058530586305873058830589305903059130592305933059430595305963059730598305993060030601306023060330604306053060630607306083060930610306113061230613306143061530616306173061830619306203062130622306233062430625306263062730628306293063030631306323063330634306353063630637306383063930640306413064230643306443064530646306473064830649306503065130652306533065430655306563065730658306593066030661306623066330664306653066630667306683066930670306713067230673306743067530676306773067830679306803068130682306833068430685306863068730688306893069030691306923069330694306953069630697306983069930700307013070230703307043070530706307073070830709307103071130712307133071430715307163071730718307193072030721307223072330724307253072630727307283072930730307313073230733307343073530736307373073830739307403074130742307433074430745307463074730748307493075030751307523075330754307553075630757307583075930760307613076230763307643076530766307673076830769307703077130772307733077430775307763077730778307793078030781307823078330784307853078630787307883078930790307913079230793307943079530796307973079830799308003080130802308033080430805308063080730808308093081030811308123081330814308153081630817308183081930820308213082230823308243082530826308273082830829308303083130832308333083430835308363083730838308393084030841308423084330844308453084630847308483084930850308513085230853308543085530856308573085830859308603086130862308633086430865308663086730868308693087030871308723087330874308753087630877308783087930880308813088230883308843088530886308873088830889308903089130892308933089430895308963089730898308993090030901309023090330904309053090630907309083090930910309113091230913309143091530916309173091830919309203092130922309233092430925309263092730928309293093030931309323093330934309353093630937309383093930940309413094230943309443094530946309473094830949309503095130952309533095430955309563095730958309593096030961309623096330964309653096630967309683096930970309713097230973309743097530976309773097830979309803098130982309833098430985309863098730988309893099030991309923099330994309953099630997309983099931000310013100231003310043100531006310073100831009310103101131012310133101431015310163101731018310193102031021310223102331024310253102631027310283102931030310313103231033310343103531036310373103831039310403104131042310433104431045310463104731048310493105031051310523105331054310553105631057310583105931060310613106231063310643106531066310673106831069310703107131072310733107431075310763107731078310793108031081310823108331084310853108631087310883108931090310913109231093310943109531096310973109831099311003110131102311033110431105311063110731108311093111031111311123111331114311153111631117311183111931120311213112231123311243112531126311273112831129311303113131132311333113431135311363113731138311393114031141311423114331144311453114631147311483114931150311513115231153311543115531156311573115831159311603116131162311633116431165311663116731168311693117031171311723117331174311753117631177311783117931180311813118231183311843118531186311873118831189311903119131192311933119431195311963119731198311993120031201312023120331204312053120631207312083120931210312113121231213312143121531216312173121831219312203122131222312233122431225312263122731228312293123031231312323123331234312353123631237312383123931240312413124231243312443124531246312473124831249312503125131252312533125431255312563125731258312593126031261312623126331264312653126631267312683126931270312713127231273312743127531276312773127831279312803128131282312833128431285312863128731288312893129031291312923129331294312953129631297312983129931300313013130231303313043130531306313073130831309313103131131312313133131431315313163131731318313193132031321313223132331324313253132631327313283132931330313313133231333313343133531336313373133831339313403134131342313433134431345313463134731348313493135031351313523135331354313553135631357313583135931360313613136231363313643136531366313673136831369313703137131372313733137431375313763137731378313793138031381313823138331384313853138631387313883138931390313913139231393313943139531396313973139831399314003140131402314033140431405314063140731408314093141031411314123141331414314153141631417314183141931420314213142231423314243142531426314273142831429314303143131432314333143431435314363143731438314393144031441314423144331444314453144631447314483144931450314513145231453314543145531456314573145831459314603146131462314633146431465314663146731468314693147031471314723147331474314753147631477314783147931480314813148231483314843148531486314873148831489314903149131492314933149431495314963149731498314993150031501315023150331504315053150631507315083150931510315113151231513315143151531516315173151831519315203152131522315233152431525315263152731528315293153031531315323153331534315353153631537315383153931540315413154231543315443154531546315473154831549315503155131552315533155431555315563155731558315593156031561315623156331564315653156631567315683156931570315713157231573315743157531576315773157831579315803158131582315833158431585315863158731588315893159031591315923159331594315953159631597315983159931600316013160231603316043160531606316073160831609316103161131612316133161431615316163161731618316193162031621316223162331624316253162631627316283162931630316313163231633316343163531636316373163831639316403164131642316433164431645316463164731648316493165031651316523165331654316553165631657316583165931660316613166231663316643166531666316673166831669316703167131672316733167431675316763167731678316793168031681316823168331684316853168631687316883168931690316913169231693316943169531696316973169831699317003170131702317033170431705317063170731708317093171031711317123171331714317153171631717317183171931720317213172231723317243172531726317273172831729317303173131732317333173431735317363173731738317393174031741317423174331744317453174631747317483174931750317513175231753317543175531756317573175831759317603176131762317633176431765317663176731768317693177031771317723177331774317753177631777317783177931780317813178231783317843178531786317873178831789317903179131792317933179431795317963179731798317993180031801318023180331804318053180631807318083180931810318113181231813318143181531816318173181831819318203182131822318233182431825318263182731828318293183031831318323183331834318353183631837318383183931840318413184231843318443184531846318473184831849318503185131852318533185431855318563185731858318593186031861318623186331864318653186631867318683186931870318713187231873318743187531876318773187831879318803188131882318833188431885318863188731888318893189031891318923189331894318953189631897318983189931900319013190231903319043190531906319073190831909319103191131912319133191431915319163191731918319193192031921319223192331924319253192631927319283192931930319313193231933319343193531936319373193831939319403194131942319433194431945319463194731948319493195031951319523195331954319553195631957319583195931960319613196231963319643196531966319673196831969319703197131972319733197431975319763197731978319793198031981319823198331984319853198631987319883198931990319913199231993319943199531996319973199831999320003200132002320033200432005320063200732008320093201032011320123201332014320153201632017320183201932020320213202232023320243202532026320273202832029320303203132032320333203432035320363203732038320393204032041320423204332044320453204632047320483204932050320513205232053320543205532056320573205832059320603206132062320633206432065320663206732068320693207032071320723207332074320753207632077320783207932080320813208232083320843208532086320873208832089320903209132092320933209432095320963209732098320993210032101321023210332104321053210632107321083210932110321113211232113321143211532116321173211832119321203212132122321233212432125321263212732128321293213032131321323213332134321353213632137321383213932140321413214232143321443214532146321473214832149321503215132152321533215432155321563215732158321593216032161321623216332164321653216632167321683216932170321713217232173321743217532176321773217832179321803218132182321833218432185321863218732188321893219032191321923219332194321953219632197321983219932200322013220232203322043220532206322073220832209322103221132212322133221432215322163221732218322193222032221322223222332224322253222632227322283222932230322313223232233322343223532236322373223832239322403224132242322433224432245322463224732248322493225032251322523225332254322553225632257322583225932260322613226232263322643226532266322673226832269322703227132272322733227432275322763227732278322793228032281322823228332284322853228632287322883228932290322913229232293322943229532296322973229832299323003230132302323033230432305323063230732308323093231032311323123231332314323153231632317323183231932320323213232232323323243232532326323273232832329323303233132332323333233432335323363233732338323393234032341323423234332344323453234632347323483234932350323513235232353323543235532356323573235832359323603236132362323633236432365323663236732368323693237032371323723237332374323753237632377323783237932380323813238232383323843238532386323873238832389323903239132392323933239432395323963239732398323993240032401324023240332404324053240632407324083240932410324113241232413324143241532416324173241832419324203242132422324233242432425324263242732428324293243032431324323243332434324353243632437324383243932440324413244232443324443244532446324473244832449324503245132452324533245432455324563245732458324593246032461324623246332464324653246632467324683246932470324713247232473324743247532476324773247832479324803248132482324833248432485324863248732488324893249032491324923249332494324953249632497324983249932500325013250232503325043250532506325073250832509325103251132512325133251432515325163251732518325193252032521325223252332524325253252632527325283252932530325313253232533325343253532536325373253832539325403254132542325433254432545325463254732548325493255032551325523255332554325553255632557325583255932560325613256232563325643256532566325673256832569325703257132572325733257432575325763257732578325793258032581325823258332584325853258632587325883258932590325913259232593325943259532596325973259832599326003260132602326033260432605326063260732608326093261032611326123261332614326153261632617326183261932620326213262232623326243262532626326273262832629326303263132632326333263432635326363263732638326393264032641326423264332644326453264632647326483264932650326513265232653326543265532656326573265832659326603266132662326633266432665326663266732668326693267032671326723267332674326753267632677326783267932680326813268232683326843268532686326873268832689326903269132692326933269432695326963269732698326993270032701327023270332704327053270632707327083270932710327113271232713327143271532716327173271832719327203272132722327233272432725327263272732728327293273032731327323273332734327353273632737327383273932740327413274232743327443274532746327473274832749327503275132752327533275432755327563275732758327593276032761327623276332764327653276632767327683276932770327713277232773327743277532776327773277832779327803278132782327833278432785327863278732788327893279032791327923279332794327953279632797327983279932800328013280232803328043280532806328073280832809328103281132812328133281432815328163281732818328193282032821328223282332824328253282632827328283282932830328313283232833328343283532836328373283832839328403284132842328433284432845328463284732848328493285032851328523285332854328553285632857328583285932860328613286232863328643286532866328673286832869328703287132872328733287432875328763287732878328793288032881328823288332884328853288632887328883288932890328913289232893328943289532896328973289832899329003290132902329033290432905329063290732908329093291032911329123291332914329153291632917329183291932920329213292232923329243292532926329273292832929329303293132932329333293432935329363293732938329393294032941329423294332944329453294632947329483294932950329513295232953329543295532956329573295832959329603296132962329633296432965329663296732968329693297032971329723297332974329753297632977329783297932980329813298232983329843298532986329873298832989329903299132992329933299432995329963299732998329993300033001330023300333004330053300633007330083300933010330113301233013330143301533016330173301833019330203302133022330233302433025330263302733028330293303033031330323303333034330353303633037330383303933040330413304233043330443304533046330473304833049330503305133052330533305433055330563305733058330593306033061330623306333064330653306633067330683306933070330713307233073330743307533076330773307833079330803308133082330833308433085330863308733088330893309033091330923309333094330953309633097330983309933100331013310233103331043310533106331073310833109331103311133112331133311433115331163311733118331193312033121331223312333124331253312633127331283312933130331313313233133331343313533136331373313833139331403314133142331433314433145331463314733148331493315033151331523315333154331553315633157331583315933160331613316233163331643316533166331673316833169331703317133172331733317433175331763317733178331793318033181331823318333184331853318633187331883318933190331913319233193331943319533196331973319833199332003320133202332033320433205332063320733208332093321033211332123321333214332153321633217332183321933220332213322233223332243322533226332273322833229332303323133232332333323433235332363323733238332393324033241332423324333244332453324633247332483324933250332513325233253332543325533256332573325833259332603326133262332633326433265332663326733268332693327033271332723327333274332753327633277332783327933280332813328233283332843328533286332873328833289332903329133292332933329433295332963329733298332993330033301333023330333304333053330633307333083330933310333113331233313333143331533316333173331833319333203332133322333233332433325333263332733328333293333033331333323333333334333353333633337333383333933340333413334233343333443334533346333473334833349333503335133352333533335433355333563335733358333593336033361333623336333364333653336633367333683336933370333713337233373333743337533376333773337833379333803338133382333833338433385333863338733388333893339033391333923339333394333953339633397333983339933400334013340233403334043340533406334073340833409334103341133412334133341433415334163341733418334193342033421334223342333424334253342633427334283342933430334313343233433334343343533436334373343833439334403344133442334433344433445334463344733448334493345033451334523345333454334553345633457334583345933460334613346233463334643346533466334673346833469334703347133472334733347433475334763347733478334793348033481334823348333484334853348633487334883348933490334913349233493334943349533496334973349833499335003350133502335033350433505335063350733508335093351033511335123351333514335153351633517335183351933520335213352233523335243352533526335273352833529335303353133532335333353433535335363353733538335393354033541335423354333544335453354633547335483354933550335513355233553335543355533556335573355833559335603356133562335633356433565335663356733568335693357033571335723357333574335753357633577335783357933580335813358233583335843358533586335873358833589335903359133592335933359433595335963359733598335993360033601336023360333604336053360633607336083360933610336113361233613336143361533616336173361833619336203362133622336233362433625336263362733628336293363033631336323363333634336353363633637336383363933640336413364233643336443364533646336473364833649336503365133652336533365433655336563365733658336593366033661336623366333664336653366633667336683366933670336713367233673336743367533676336773367833679336803368133682336833368433685336863368733688336893369033691336923369333694336953369633697336983369933700337013370233703337043370533706337073370833709337103371133712337133371433715337163371733718337193372033721337223372333724337253372633727337283372933730337313373233733337343373533736337373373833739337403374133742337433374433745337463374733748337493375033751337523375333754337553375633757337583375933760337613376233763337643376533766337673376833769337703377133772337733377433775337763377733778337793378033781337823378333784337853378633787337883378933790337913379233793337943379533796337973379833799338003380133802338033380433805338063380733808338093381033811338123381333814338153381633817338183381933820338213382233823338243382533826338273382833829338303383133832338333383433835338363383733838338393384033841338423384333844338453384633847338483384933850338513385233853338543385533856338573385833859338603386133862338633386433865338663386733868338693387033871338723387333874338753387633877338783387933880338813388233883338843388533886338873388833889338903389133892338933389433895338963389733898338993390033901339023390333904339053390633907339083390933910339113391233913339143391533916339173391833919339203392133922339233392433925339263392733928339293393033931339323393333934339353393633937339383393933940339413394233943339443394533946339473394833949339503395133952339533395433955339563395733958339593396033961339623396333964339653396633967339683396933970339713397233973339743397533976339773397833979339803398133982339833398433985339863398733988339893399033991339923399333994339953399633997339983399934000340013400234003340043400534006340073400834009340103401134012340133401434015340163401734018340193402034021340223402334024340253402634027340283402934030340313403234033340343403534036340373403834039340403404134042340433404434045340463404734048340493405034051340523405334054340553405634057340583405934060340613406234063340643406534066340673406834069340703407134072340733407434075340763407734078340793408034081340823408334084340853408634087340883408934090340913409234093340943409534096340973409834099341003410134102341033410434105341063410734108341093411034111341123411334114341153411634117341183411934120341213412234123341243412534126341273412834129341303413134132341333413434135341363413734138341393414034141341423414334144341453414634147341483414934150341513415234153341543415534156341573415834159341603416134162341633416434165341663416734168341693417034171341723417334174341753417634177341783417934180341813418234183341843418534186341873418834189341903419134192341933419434195341963419734198341993420034201342023420334204342053420634207342083420934210342113421234213342143421534216342173421834219342203422134222342233422434225342263422734228342293423034231342323423334234342353423634237342383423934240342413424234243342443424534246342473424834249342503425134252342533425434255342563425734258342593426034261342623426334264342653426634267342683426934270342713427234273342743427534276342773427834279342803428134282342833428434285342863428734288342893429034291342923429334294342953429634297342983429934300343013430234303343043430534306343073430834309343103431134312343133431434315343163431734318343193432034321343223432334324343253432634327343283432934330343313433234333343343433534336343373433834339343403434134342343433434434345343463434734348343493435034351343523435334354343553435634357343583435934360343613436234363343643436534366343673436834369343703437134372343733437434375343763437734378343793438034381343823438334384343853438634387343883438934390343913439234393343943439534396343973439834399344003440134402344033440434405344063440734408344093441034411344123441334414344153441634417344183441934420344213442234423344243442534426344273442834429344303443134432344333443434435344363443734438344393444034441344423444334444344453444634447344483444934450344513445234453344543445534456344573445834459344603446134462344633446434465344663446734468344693447034471344723447334474344753447634477344783447934480344813448234483344843448534486344873448834489344903449134492344933449434495344963449734498344993450034501345023450334504345053450634507345083450934510345113451234513345143451534516345173451834519345203452134522345233452434525345263452734528345293453034531345323453334534345353453634537345383453934540345413454234543345443454534546345473454834549345503455134552345533455434555345563455734558345593456034561345623456334564345653456634567345683456934570345713457234573345743457534576345773457834579345803458134582345833458434585345863458734588345893459034591345923459334594345953459634597345983459934600346013460234603346043460534606346073460834609346103461134612346133461434615346163461734618346193462034621346223462334624346253462634627346283462934630346313463234633346343463534636346373463834639346403464134642346433464434645346463464734648346493465034651346523465334654346553465634657346583465934660346613466234663346643466534666346673466834669346703467134672346733467434675346763467734678346793468034681346823468334684346853468634687346883468934690346913469234693346943469534696346973469834699347003470134702347033470434705347063470734708347093471034711347123471334714347153471634717347183471934720347213472234723347243472534726347273472834729347303473134732347333473434735347363473734738347393474034741347423474334744347453474634747347483474934750347513475234753347543475534756347573475834759347603476134762347633476434765347663476734768347693477034771347723477334774347753477634777347783477934780347813478234783347843478534786347873478834789347903479134792347933479434795347963479734798347993480034801348023480334804348053480634807348083480934810348113481234813348143481534816348173481834819348203482134822348233482434825348263482734828348293483034831348323483334834348353483634837348383483934840348413484234843348443484534846348473484834849348503485134852348533485434855348563485734858348593486034861348623486334864348653486634867348683486934870348713487234873348743487534876348773487834879348803488134882348833488434885348863488734888348893489034891348923489334894348953489634897348983489934900349013490234903349043490534906349073490834909349103491134912349133491434915349163491734918349193492034921349223492334924349253492634927349283492934930349313493234933349343493534936349373493834939349403494134942349433494434945349463494734948349493495034951349523495334954349553495634957349583495934960349613496234963349643496534966349673496834969349703497134972349733497434975349763497734978349793498034981349823498334984349853498634987349883498934990349913499234993349943499534996349973499834999350003500135002350033500435005350063500735008350093501035011350123501335014350153501635017350183501935020350213502235023350243502535026350273502835029350303503135032350333503435035350363503735038350393504035041350423504335044350453504635047350483504935050350513505235053350543505535056350573505835059350603506135062350633506435065350663506735068350693507035071350723507335074350753507635077350783507935080350813508235083350843508535086350873508835089350903509135092350933509435095350963509735098350993510035101351023510335104351053510635107351083510935110351113511235113351143511535116351173511835119351203512135122351233512435125351263512735128351293513035131351323513335134351353513635137351383513935140351413514235143351443514535146351473514835149351503515135152351533515435155351563515735158351593516035161351623516335164351653516635167351683516935170351713517235173351743517535176351773517835179351803518135182351833518435185351863518735188351893519035191351923519335194351953519635197351983519935200352013520235203352043520535206352073520835209352103521135212352133521435215352163521735218352193522035221352223522335224352253522635227352283522935230352313523235233352343523535236352373523835239352403524135242352433524435245352463524735248352493525035251352523525335254352553525635257352583525935260352613526235263352643526535266352673526835269352703527135272352733527435275352763527735278352793528035281352823528335284352853528635287352883528935290352913529235293352943529535296352973529835299353003530135302353033530435305353063530735308353093531035311353123531335314353153531635317353183531935320353213532235323353243532535326353273532835329353303533135332353333533435335353363533735338353393534035341353423534335344353453534635347353483534935350353513535235353353543535535356353573535835359353603536135362353633536435365353663536735368353693537035371353723537335374353753537635377353783537935380353813538235383353843538535386353873538835389353903539135392353933539435395353963539735398353993540035401354023540335404354053540635407354083540935410354113541235413354143541535416354173541835419354203542135422354233542435425354263542735428354293543035431354323543335434354353543635437354383543935440354413544235443354443544535446354473544835449354503545135452354533545435455354563545735458354593546035461354623546335464354653546635467354683546935470354713547235473354743547535476354773547835479354803548135482354833548435485354863548735488354893549035491354923549335494354953549635497354983549935500355013550235503355043550535506355073550835509355103551135512355133551435515355163551735518355193552035521355223552335524355253552635527355283552935530355313553235533355343553535536355373553835539355403554135542355433554435545355463554735548355493555035551355523555335554355553555635557355583555935560355613556235563355643556535566355673556835569355703557135572355733557435575355763557735578355793558035581355823558335584355853558635587355883558935590355913559235593355943559535596355973559835599356003560135602356033560435605356063560735608356093561035611356123561335614356153561635617356183561935620356213562235623356243562535626356273562835629356303563135632356333563435635356363563735638356393564035641356423564335644356453564635647356483564935650356513565235653356543565535656356573565835659356603566135662356633566435665356663566735668356693567035671356723567335674356753567635677356783567935680356813568235683356843568535686356873568835689356903569135692356933569435695356963569735698356993570035701357023570335704357053570635707357083570935710357113571235713357143571535716357173571835719357203572135722357233572435725357263572735728357293573035731357323573335734357353573635737357383573935740357413574235743357443574535746357473574835749357503575135752357533575435755357563575735758357593576035761357623576335764357653576635767357683576935770357713577235773357743577535776357773577835779357803578135782357833578435785357863578735788357893579035791357923579335794357953579635797357983579935800358013580235803358043580535806358073580835809358103581135812358133581435815358163581735818358193582035821358223582335824358253582635827358283582935830358313583235833358343583535836358373583835839358403584135842358433584435845358463584735848358493585035851358523585335854358553585635857358583585935860358613586235863358643586535866358673586835869358703587135872358733587435875358763587735878358793588035881358823588335884358853588635887358883588935890358913589235893358943589535896358973589835899359003590135902359033590435905359063590735908359093591035911359123591335914359153591635917359183591935920359213592235923359243592535926359273592835929359303593135932359333593435935359363593735938359393594035941359423594335944359453594635947359483594935950359513595235953359543595535956359573595835959359603596135962359633596435965359663596735968359693597035971359723597335974359753597635977359783597935980359813598235983359843598535986359873598835989359903599135992359933599435995359963599735998359993600036001360023600336004360053600636007360083600936010360113601236013360143601536016360173601836019360203602136022360233602436025360263602736028360293603036031360323603336034360353603636037360383603936040360413604236043360443604536046360473604836049360503605136052360533605436055360563605736058360593606036061360623606336064360653606636067360683606936070360713607236073360743607536076360773607836079360803608136082360833608436085360863608736088360893609036091360923609336094360953609636097360983609936100361013610236103361043610536106361073610836109361103611136112361133611436115361163611736118361193612036121361223612336124361253612636127361283612936130361313613236133361343613536136361373613836139361403614136142361433614436145361463614736148361493615036151361523615336154361553615636157361583615936160361613616236163361643616536166361673616836169361703617136172361733617436175361763617736178361793618036181361823618336184361853618636187361883618936190361913619236193361943619536196361973619836199362003620136202362033620436205362063620736208362093621036211362123621336214362153621636217362183621936220362213622236223362243622536226362273622836229362303623136232362333623436235362363623736238362393624036241362423624336244362453624636247362483624936250362513625236253362543625536256362573625836259362603626136262362633626436265362663626736268362693627036271362723627336274362753627636277362783627936280362813628236283362843628536286362873628836289362903629136292362933629436295362963629736298362993630036301363023630336304363053630636307363083630936310363113631236313363143631536316363173631836319363203632136322363233632436325363263632736328363293633036331363323633336334363353633636337363383633936340363413634236343363443634536346363473634836349363503635136352363533635436355363563635736358363593636036361363623636336364363653636636367363683636936370363713637236373363743637536376363773637836379363803638136382363833638436385363863638736388363893639036391363923639336394363953639636397363983639936400364013640236403364043640536406364073640836409364103641136412364133641436415364163641736418364193642036421364223642336424364253642636427364283642936430364313643236433364343643536436364373643836439364403644136442364433644436445364463644736448364493645036451364523645336454364553645636457364583645936460364613646236463364643646536466364673646836469364703647136472364733647436475364763647736478364793648036481364823648336484364853648636487364883648936490364913649236493364943649536496364973649836499365003650136502365033650436505365063650736508365093651036511365123651336514365153651636517365183651936520365213652236523365243652536526365273652836529365303653136532365333653436535365363653736538365393654036541365423654336544365453654636547365483654936550365513655236553365543655536556365573655836559365603656136562365633656436565365663656736568365693657036571365723657336574365753657636577365783657936580365813658236583365843658536586365873658836589365903659136592365933659436595365963659736598365993660036601366023660336604366053660636607366083660936610366113661236613366143661536616366173661836619366203662136622366233662436625366263662736628366293663036631366323663336634366353663636637366383663936640366413664236643366443664536646366473664836649366503665136652366533665436655366563665736658366593666036661366623666336664366653666636667366683666936670366713667236673366743667536676366773667836679366803668136682366833668436685366863668736688366893669036691366923669336694366953669636697366983669936700367013670236703367043670536706367073670836709367103671136712367133671436715367163671736718367193672036721367223672336724367253672636727367283672936730367313673236733367343673536736367373673836739367403674136742367433674436745367463674736748367493675036751367523675336754367553675636757367583675936760367613676236763367643676536766367673676836769367703677136772367733677436775367763677736778367793678036781367823678336784367853678636787367883678936790367913679236793367943679536796367973679836799368003680136802368033680436805368063680736808368093681036811368123681336814368153681636817368183681936820368213682236823368243682536826368273682836829368303683136832368333683436835368363683736838368393684036841368423684336844368453684636847368483684936850368513685236853368543685536856368573685836859368603686136862368633686436865368663686736868368693687036871368723687336874368753687636877368783687936880368813688236883368843688536886368873688836889368903689136892368933689436895368963689736898368993690036901369023690336904369053690636907369083690936910369113691236913369143691536916369173691836919369203692136922369233692436925369263692736928369293693036931369323693336934369353693636937369383693936940369413694236943369443694536946369473694836949369503695136952369533695436955369563695736958369593696036961369623696336964369653696636967369683696936970369713697236973369743697536976369773697836979369803698136982369833698436985369863698736988369893699036991369923699336994369953699636997369983699937000370013700237003370043700537006370073700837009370103701137012370133701437015370163701737018370193702037021370223702337024370253702637027370283702937030370313703237033370343703537036370373703837039370403704137042370433704437045370463704737048370493705037051370523705337054370553705637057370583705937060370613706237063370643706537066370673706837069370703707137072370733707437075370763707737078370793708037081370823708337084370853708637087370883708937090370913709237093370943709537096370973709837099371003710137102371033710437105371063710737108371093711037111371123711337114371153711637117371183711937120371213712237123371243712537126371273712837129371303713137132371333713437135371363713737138371393714037141371423714337144371453714637147371483714937150371513715237153371543715537156371573715837159371603716137162371633716437165371663716737168371693717037171371723717337174371753717637177371783717937180371813718237183371843718537186371873718837189371903719137192371933719437195371963719737198371993720037201372023720337204372053720637207372083720937210372113721237213372143721537216372173721837219372203722137222372233722437225372263722737228372293723037231372323723337234372353723637237372383723937240372413724237243372443724537246372473724837249372503725137252372533725437255372563725737258372593726037261372623726337264372653726637267372683726937270372713727237273372743727537276372773727837279372803728137282372833728437285372863728737288372893729037291372923729337294372953729637297372983729937300373013730237303373043730537306373073730837309373103731137312373133731437315373163731737318373193732037321373223732337324373253732637327373283732937330373313733237333373343733537336373373733837339373403734137342373433734437345373463734737348373493735037351373523735337354373553735637357373583735937360373613736237363373643736537366373673736837369373703737137372373733737437375373763737737378373793738037381373823738337384373853738637387373883738937390373913739237393373943739537396373973739837399374003740137402374033740437405374063740737408374093741037411374123741337414374153741637417374183741937420374213742237423374243742537426374273742837429374303743137432374333743437435374363743737438374393744037441374423744337444374453744637447374483744937450374513745237453374543745537456374573745837459374603746137462374633746437465374663746737468374693747037471374723747337474374753747637477374783747937480374813748237483374843748537486374873748837489374903749137492374933749437495374963749737498374993750037501375023750337504375053750637507375083750937510375113751237513375143751537516375173751837519375203752137522375233752437525375263752737528375293753037531375323753337534375353753637537375383753937540375413754237543375443754537546375473754837549375503755137552375533755437555375563755737558375593756037561375623756337564375653756637567375683756937570375713757237573375743757537576375773757837579375803758137582375833758437585375863758737588375893759037591375923759337594375953759637597375983759937600376013760237603376043760537606376073760837609376103761137612376133761437615376163761737618376193762037621376223762337624376253762637627376283762937630376313763237633376343763537636376373763837639376403764137642376433764437645376463764737648376493765037651376523765337654376553765637657376583765937660376613766237663376643766537666376673766837669376703767137672376733767437675376763767737678376793768037681376823768337684376853768637687376883768937690376913769237693376943769537696376973769837699377003770137702377033770437705377063770737708377093771037711377123771337714377153771637717377183771937720377213772237723377243772537726377273772837729377303773137732377333773437735377363773737738377393774037741377423774337744377453774637747377483774937750377513775237753377543775537756377573775837759377603776137762377633776437765377663776737768377693777037771377723777337774377753777637777377783777937780377813778237783377843778537786377873778837789377903779137792377933779437795377963779737798377993780037801378023780337804378053780637807378083780937810378113781237813378143781537816378173781837819378203782137822378233782437825378263782737828378293783037831378323783337834378353783637837378383783937840378413784237843378443784537846378473784837849378503785137852378533785437855378563785737858378593786037861378623786337864378653786637867378683786937870378713787237873378743787537876378773787837879378803788137882378833788437885378863788737888378893789037891378923789337894378953789637897378983789937900379013790237903379043790537906379073790837909379103791137912379133791437915379163791737918379193792037921379223792337924379253792637927379283792937930379313793237933379343793537936379373793837939379403794137942379433794437945379463794737948379493795037951379523795337954379553795637957379583795937960379613796237963379643796537966379673796837969379703797137972379733797437975379763797737978379793798037981379823798337984379853798637987379883798937990379913799237993379943799537996379973799837999380003800138002380033800438005380063800738008380093801038011380123801338014380153801638017380183801938020380213802238023380243802538026380273802838029380303803138032380333803438035380363803738038380393804038041380423804338044380453804638047380483804938050380513805238053380543805538056380573805838059380603806138062380633806438065380663806738068380693807038071380723807338074380753807638077380783807938080380813808238083380843808538086380873808838089380903809138092380933809438095380963809738098380993810038101381023810338104381053810638107381083810938110381113811238113381143811538116381173811838119381203812138122381233812438125381263812738128381293813038131381323813338134381353813638137381383813938140381413814238143381443814538146381473814838149381503815138152381533815438155381563815738158381593816038161381623816338164381653816638167381683816938170381713817238173381743817538176381773817838179381803818138182381833818438185381863818738188381893819038191381923819338194381953819638197381983819938200382013820238203382043820538206382073820838209382103821138212382133821438215382163821738218382193822038221382223822338224382253822638227382283822938230382313823238233382343823538236382373823838239382403824138242382433824438245382463824738248382493825038251382523825338254382553825638257382583825938260382613826238263382643826538266382673826838269382703827138272382733827438275382763827738278382793828038281382823828338284382853828638287382883828938290382913829238293382943829538296382973829838299383003830138302383033830438305383063830738308383093831038311383123831338314383153831638317383183831938320383213832238323383243832538326383273832838329383303833138332383333833438335383363833738338383393834038341383423834338344383453834638347383483834938350383513835238353383543835538356383573835838359383603836138362383633836438365383663836738368383693837038371383723837338374383753837638377383783837938380383813838238383383843838538386383873838838389383903839138392383933839438395383963839738398383993840038401384023840338404384053840638407384083840938410384113841238413384143841538416384173841838419384203842138422384233842438425384263842738428384293843038431384323843338434384353843638437384383843938440384413844238443384443844538446384473844838449384503845138452384533845438455384563845738458384593846038461384623846338464384653846638467384683846938470384713847238473384743847538476384773847838479384803848138482384833848438485384863848738488384893849038491384923849338494384953849638497384983849938500385013850238503385043850538506385073850838509385103851138512385133851438515385163851738518385193852038521385223852338524385253852638527385283852938530385313853238533385343853538536385373853838539385403854138542385433854438545385463854738548385493855038551385523855338554385553855638557385583855938560385613856238563385643856538566385673856838569385703857138572385733857438575385763857738578385793858038581385823858338584385853858638587385883858938590385913859238593385943859538596385973859838599386003860138602386033860438605386063860738608386093861038611386123861338614386153861638617386183861938620386213862238623386243862538626386273862838629386303863138632386333863438635386363863738638386393864038641386423864338644386453864638647386483864938650386513865238653386543865538656386573865838659386603866138662386633866438665386663866738668386693867038671386723867338674386753867638677386783867938680386813868238683386843868538686386873868838689386903869138692386933869438695386963869738698386993870038701387023870338704387053870638707387083870938710387113871238713387143871538716387173871838719387203872138722387233872438725387263872738728387293873038731387323873338734387353873638737387383873938740387413874238743387443874538746387473874838749387503875138752387533875438755387563875738758387593876038761387623876338764387653876638767387683876938770387713877238773387743877538776387773877838779387803878138782387833878438785387863878738788387893879038791387923879338794387953879638797387983879938800388013880238803388043880538806388073880838809388103881138812388133881438815388163881738818388193882038821388223882338824388253882638827388283882938830388313883238833388343883538836388373883838839388403884138842388433884438845388463884738848388493885038851388523885338854388553885638857388583885938860388613886238863388643886538866388673886838869388703887138872388733887438875388763887738878388793888038881388823888338884388853888638887388883888938890388913889238893388943889538896388973889838899389003890138902389033890438905389063890738908389093891038911389123891338914389153891638917389183891938920389213892238923389243892538926389273892838929389303893138932389333893438935389363893738938389393894038941389423894338944389453894638947389483894938950389513895238953389543895538956389573895838959389603896138962389633896438965389663896738968389693897038971389723897338974389753897638977389783897938980389813898238983389843898538986389873898838989389903899138992389933899438995389963899738998389993900039001390023900339004390053900639007390083900939010390113901239013390143901539016390173901839019390203902139022390233902439025390263902739028390293903039031390323903339034390353903639037390383903939040390413904239043390443904539046390473904839049390503905139052390533905439055390563905739058390593906039061390623906339064390653906639067390683906939070390713907239073390743907539076390773907839079390803908139082390833908439085390863908739088390893909039091390923909339094390953909639097390983909939100391013910239103391043910539106391073910839109391103911139112391133911439115391163911739118391193912039121391223912339124391253912639127391283912939130391313913239133391343913539136391373913839139391403914139142391433914439145391463914739148391493915039151391523915339154391553915639157391583915939160391613916239163391643916539166391673916839169391703917139172391733917439175391763917739178391793918039181391823918339184391853918639187391883918939190391913919239193391943919539196391973919839199392003920139202392033920439205392063920739208392093921039211392123921339214392153921639217392183921939220392213922239223392243922539226392273922839229392303923139232392333923439235392363923739238392393924039241392423924339244392453924639247392483924939250392513925239253392543925539256392573925839259392603926139262392633926439265392663926739268392693927039271392723927339274392753927639277392783927939280392813928239283392843928539286392873928839289392903929139292392933929439295392963929739298392993930039301393023930339304393053930639307393083930939310393113931239313393143931539316393173931839319393203932139322393233932439325393263932739328393293933039331393323933339334393353933639337393383933939340393413934239343393443934539346393473934839349393503935139352393533935439355393563935739358393593936039361393623936339364393653936639367393683936939370393713937239373393743937539376393773937839379393803938139382393833938439385393863938739388393893939039391393923939339394393953939639397393983939939400394013940239403394043940539406394073940839409394103941139412394133941439415394163941739418394193942039421394223942339424394253942639427394283942939430394313943239433394343943539436394373943839439394403944139442394433944439445394463944739448394493945039451394523945339454394553945639457394583945939460394613946239463394643946539466394673946839469394703947139472394733947439475394763947739478394793948039481394823948339484394853948639487394883948939490394913949239493394943949539496394973949839499395003950139502395033950439505395063950739508395093951039511395123951339514395153951639517395183951939520395213952239523395243952539526395273952839529395303953139532395333953439535395363953739538395393954039541395423954339544395453954639547395483954939550395513955239553395543955539556395573955839559395603956139562395633956439565395663956739568395693957039571395723957339574395753957639577395783957939580395813958239583395843958539586395873958839589395903959139592395933959439595395963959739598395993960039601396023960339604396053960639607396083960939610396113961239613396143961539616396173961839619396203962139622396233962439625396263962739628396293963039631396323963339634396353963639637396383963939640396413964239643396443964539646396473964839649396503965139652396533965439655396563965739658396593966039661396623966339664396653966639667396683966939670396713967239673396743967539676396773967839679396803968139682396833968439685396863968739688396893969039691396923969339694396953969639697396983969939700397013970239703397043970539706397073970839709397103971139712397133971439715397163971739718397193972039721397223972339724397253972639727397283972939730397313973239733397343973539736397373973839739397403974139742397433974439745397463974739748397493975039751397523975339754397553975639757397583975939760397613976239763397643976539766397673976839769397703977139772397733977439775397763977739778397793978039781397823978339784397853978639787397883978939790397913979239793397943979539796397973979839799398003980139802398033980439805398063980739808398093981039811398123981339814398153981639817398183981939820398213982239823398243982539826398273982839829398303983139832398333983439835398363983739838398393984039841398423984339844398453984639847398483984939850398513985239853398543985539856398573985839859398603986139862398633986439865398663986739868398693987039871398723987339874398753987639877398783987939880398813988239883398843988539886398873988839889398903989139892398933989439895398963989739898398993990039901399023990339904399053990639907399083990939910399113991239913399143991539916399173991839919399203992139922399233992439925399263992739928399293993039931399323993339934399353993639937399383993939940399413994239943399443994539946399473994839949399503995139952399533995439955399563995739958399593996039961399623996339964399653996639967399683996939970399713997239973399743997539976399773997839979399803998139982399833998439985399863998739988399893999039991399923999339994399953999639997399983999940000400014000240003400044000540006400074000840009400104001140012400134001440015400164001740018400194002040021400224002340024400254002640027400284002940030400314003240033400344003540036400374003840039400404004140042400434004440045400464004740048400494005040051400524005340054400554005640057400584005940060400614006240063400644006540066400674006840069400704007140072400734007440075400764007740078400794008040081400824008340084400854008640087400884008940090400914009240093400944009540096400974009840099401004010140102401034010440105401064010740108401094011040111401124011340114401154011640117401184011940120401214012240123401244012540126401274012840129401304013140132401334013440135401364013740138401394014040141401424014340144401454014640147401484014940150401514015240153401544015540156401574015840159401604016140162401634016440165401664016740168401694017040171401724017340174401754017640177401784017940180401814018240183401844018540186401874018840189401904019140192401934019440195401964019740198401994020040201402024020340204402054020640207402084020940210402114021240213402144021540216402174021840219402204022140222402234022440225402264022740228402294023040231402324023340234402354023640237402384023940240402414024240243402444024540246402474024840249402504025140252402534025440255402564025740258402594026040261402624026340264402654026640267402684026940270402714027240273402744027540276402774027840279402804028140282402834028440285402864028740288402894029040291402924029340294402954029640297402984029940300403014030240303403044030540306403074030840309403104031140312403134031440315403164031740318403194032040321403224032340324403254032640327403284032940330403314033240333403344033540336403374033840339403404034140342403434034440345403464034740348403494035040351403524035340354403554035640357403584035940360403614036240363403644036540366403674036840369403704037140372403734037440375403764037740378403794038040381403824038340384403854038640387403884038940390403914039240393403944039540396403974039840399404004040140402404034040440405404064040740408404094041040411404124041340414404154041640417404184041940420404214042240423404244042540426404274042840429404304043140432404334043440435404364043740438404394044040441404424044340444404454044640447404484044940450404514045240453404544045540456404574045840459404604046140462404634046440465404664046740468404694047040471404724047340474404754047640477404784047940480404814048240483404844048540486404874048840489404904049140492404934049440495404964049740498404994050040501405024050340504405054050640507405084050940510405114051240513405144051540516405174051840519405204052140522405234052440525405264052740528405294053040531405324053340534405354053640537405384053940540405414054240543405444054540546405474054840549405504055140552405534055440555405564055740558405594056040561405624056340564405654056640567405684056940570405714057240573405744057540576405774057840579405804058140582405834058440585405864058740588405894059040591405924059340594405954059640597405984059940600406014060240603406044060540606406074060840609406104061140612406134061440615406164061740618406194062040621406224062340624406254062640627406284062940630406314063240633406344063540636406374063840639406404064140642406434064440645406464064740648406494065040651406524065340654406554065640657406584065940660406614066240663406644066540666406674066840669406704067140672406734067440675406764067740678406794068040681406824068340684406854068640687406884068940690406914069240693406944069540696406974069840699407004070140702407034070440705407064070740708407094071040711407124071340714407154071640717407184071940720407214072240723407244072540726407274072840729407304073140732407334073440735407364073740738407394074040741407424074340744407454074640747407484074940750407514075240753407544075540756407574075840759407604076140762407634076440765407664076740768407694077040771407724077340774407754077640777407784077940780407814078240783407844078540786407874078840789407904079140792407934079440795407964079740798407994080040801408024080340804408054080640807408084080940810408114081240813408144081540816408174081840819408204082140822408234082440825408264082740828408294083040831408324083340834408354083640837408384083940840408414084240843408444084540846408474084840849408504085140852408534085440855408564085740858408594086040861408624086340864408654086640867408684086940870408714087240873408744087540876408774087840879408804088140882408834088440885408864088740888408894089040891408924089340894408954089640897408984089940900409014090240903409044090540906409074090840909409104091140912409134091440915409164091740918409194092040921409224092340924409254092640927409284092940930409314093240933409344093540936409374093840939409404094140942409434094440945409464094740948409494095040951409524095340954409554095640957409584095940960409614096240963409644096540966409674096840969409704097140972409734097440975409764097740978409794098040981409824098340984409854098640987409884098940990409914099240993409944099540996409974099840999410004100141002410034100441005410064100741008410094101041011410124101341014410154101641017410184101941020410214102241023410244102541026410274102841029410304103141032410334103441035410364103741038410394104041041410424104341044410454104641047410484104941050410514105241053410544105541056410574105841059410604106141062410634106441065410664106741068410694107041071410724107341074410754107641077410784107941080410814108241083410844108541086410874108841089410904109141092410934109441095410964109741098410994110041101411024110341104411054110641107411084110941110411114111241113411144111541116411174111841119411204112141122411234112441125411264112741128411294113041131411324113341134411354113641137411384113941140411414114241143411444114541146411474114841149411504115141152411534115441155411564115741158411594116041161411624116341164411654116641167411684116941170411714117241173411744117541176411774117841179411804118141182411834118441185411864118741188411894119041191411924119341194411954119641197411984119941200412014120241203412044120541206412074120841209412104121141212412134121441215412164121741218412194122041221412224122341224412254122641227412284122941230412314123241233412344123541236412374123841239412404124141242412434124441245412464124741248412494125041251412524125341254412554125641257412584125941260412614126241263412644126541266412674126841269412704127141272412734127441275412764127741278412794128041281412824128341284412854128641287412884128941290412914129241293412944129541296412974129841299413004130141302413034130441305413064130741308413094131041311413124131341314413154131641317413184131941320413214132241323413244132541326413274132841329413304133141332413334133441335413364133741338413394134041341413424134341344413454134641347413484134941350413514135241353413544135541356413574135841359413604136141362413634136441365413664136741368413694137041371413724137341374413754137641377413784137941380413814138241383413844138541386413874138841389413904139141392413934139441395413964139741398413994140041401414024140341404414054140641407414084140941410414114141241413414144141541416414174141841419414204142141422414234142441425414264142741428414294143041431414324143341434414354143641437414384143941440414414144241443414444144541446414474144841449414504145141452414534145441455414564145741458414594146041461414624146341464414654146641467414684146941470414714147241473414744147541476414774147841479414804148141482414834148441485414864148741488414894149041491414924149341494414954149641497414984149941500415014150241503415044150541506415074150841509415104151141512415134151441515415164151741518415194152041521415224152341524415254152641527415284152941530415314153241533415344153541536415374153841539415404154141542415434154441545415464154741548415494155041551415524155341554415554155641557415584155941560415614156241563415644156541566415674156841569415704157141572415734157441575415764157741578415794158041581415824158341584415854158641587415884158941590415914159241593415944159541596415974159841599416004160141602416034160441605416064160741608416094161041611416124161341614416154161641617416184161941620416214162241623416244162541626416274162841629416304163141632416334163441635416364163741638416394164041641416424164341644416454164641647416484164941650416514165241653416544165541656416574165841659416604166141662416634166441665416664166741668416694167041671416724167341674416754167641677416784167941680416814168241683416844168541686416874168841689416904169141692416934169441695416964169741698416994170041701417024170341704417054170641707417084170941710417114171241713417144171541716417174171841719417204172141722417234172441725417264172741728417294173041731417324173341734417354173641737417384173941740417414174241743417444174541746417474174841749417504175141752417534175441755417564175741758417594176041761417624176341764417654176641767417684176941770417714177241773417744177541776417774177841779417804178141782417834178441785417864178741788417894179041791417924179341794417954179641797417984179941800418014180241803418044180541806418074180841809418104181141812418134181441815418164181741818418194182041821418224182341824418254182641827418284182941830418314183241833418344183541836418374183841839418404184141842418434184441845418464184741848418494185041851418524185341854418554185641857418584185941860418614186241863418644186541866418674186841869418704187141872418734187441875418764187741878418794188041881418824188341884418854188641887418884188941890418914189241893418944189541896418974189841899419004190141902419034190441905419064190741908419094191041911419124191341914419154191641917419184191941920419214192241923419244192541926419274192841929419304193141932419334193441935419364193741938419394194041941419424194341944419454194641947419484194941950419514195241953419544195541956419574195841959419604196141962419634196441965419664196741968419694197041971419724197341974419754197641977419784197941980419814198241983419844198541986419874198841989419904199141992419934199441995419964199741998419994200042001420024200342004420054200642007420084200942010420114201242013420144201542016420174201842019420204202142022420234202442025420264202742028420294203042031420324203342034420354203642037420384203942040420414204242043420444204542046420474204842049420504205142052420534205442055420564205742058420594206042061420624206342064420654206642067420684206942070420714207242073420744207542076420774207842079420804208142082420834208442085420864208742088420894209042091420924209342094420954209642097420984209942100421014210242103421044210542106421074210842109421104211142112421134211442115421164211742118421194212042121421224212342124421254212642127421284212942130421314213242133421344213542136421374213842139421404214142142421434214442145421464214742148421494215042151421524215342154421554215642157421584215942160421614216242163421644216542166421674216842169421704217142172421734217442175421764217742178421794218042181421824218342184421854218642187421884218942190421914219242193421944219542196421974219842199422004220142202422034220442205422064220742208422094221042211422124221342214422154221642217422184221942220422214222242223422244222542226422274222842229422304223142232422334223442235422364223742238422394224042241422424224342244422454224642247422484224942250422514225242253422544225542256422574225842259422604226142262422634226442265422664226742268422694227042271422724227342274422754227642277422784227942280422814228242283422844228542286422874228842289422904229142292422934229442295422964229742298422994230042301423024230342304423054230642307423084230942310423114231242313423144231542316423174231842319423204232142322423234232442325423264232742328423294233042331423324233342334423354233642337423384233942340423414234242343423444234542346423474234842349423504235142352423534235442355423564235742358423594236042361423624236342364423654236642367423684236942370423714237242373423744237542376423774237842379423804238142382423834238442385423864238742388423894239042391423924239342394423954239642397423984239942400424014240242403424044240542406424074240842409424104241142412424134241442415424164241742418424194242042421424224242342424424254242642427424284242942430424314243242433424344243542436424374243842439424404244142442424434244442445424464244742448424494245042451424524245342454424554245642457424584245942460424614246242463424644246542466424674246842469424704247142472424734247442475424764247742478424794248042481424824248342484424854248642487424884248942490424914249242493424944249542496424974249842499425004250142502425034250442505425064250742508425094251042511425124251342514425154251642517425184251942520425214252242523425244252542526425274252842529425304253142532425334253442535425364253742538425394254042541425424254342544425454254642547425484254942550425514255242553425544255542556425574255842559425604256142562425634256442565425664256742568425694257042571425724257342574425754257642577425784257942580425814258242583425844258542586425874258842589425904259142592425934259442595425964259742598425994260042601426024260342604426054260642607426084260942610426114261242613426144261542616426174261842619426204262142622426234262442625426264262742628426294263042631426324263342634426354263642637426384263942640426414264242643426444264542646426474264842649426504265142652426534265442655426564265742658426594266042661426624266342664426654266642667426684266942670426714267242673426744267542676426774267842679426804268142682426834268442685426864268742688426894269042691426924269342694426954269642697426984269942700427014270242703427044270542706427074270842709427104271142712427134271442715427164271742718427194272042721427224272342724427254272642727427284272942730427314273242733427344273542736427374273842739427404274142742427434274442745427464274742748427494275042751427524275342754427554275642757427584275942760427614276242763427644276542766427674276842769427704277142772427734277442775427764277742778427794278042781427824278342784427854278642787427884278942790427914279242793427944279542796427974279842799428004280142802428034280442805428064280742808428094281042811428124281342814428154281642817428184281942820428214282242823428244282542826428274282842829428304283142832428334283442835428364283742838428394284042841428424284342844428454284642847428484284942850428514285242853428544285542856428574285842859428604286142862428634286442865428664286742868428694287042871428724287342874428754287642877428784287942880428814288242883428844288542886428874288842889428904289142892428934289442895428964289742898428994290042901429024290342904429054290642907429084290942910429114291242913429144291542916429174291842919429204292142922429234292442925429264292742928429294293042931429324293342934429354293642937429384293942940429414294242943429444294542946429474294842949429504295142952429534295442955429564295742958429594296042961429624296342964429654296642967429684296942970429714297242973429744297542976429774297842979429804298142982429834298442985429864298742988429894299042991429924299342994429954299642997429984299943000430014300243003430044300543006430074300843009430104301143012430134301443015430164301743018430194302043021430224302343024430254302643027430284302943030430314303243033430344303543036430374303843039430404304143042430434304443045430464304743048430494305043051430524305343054430554305643057430584305943060430614306243063430644306543066430674306843069430704307143072430734307443075430764307743078430794308043081430824308343084430854308643087430884308943090430914309243093430944309543096430974309843099431004310143102431034310443105431064310743108431094311043111431124311343114431154311643117431184311943120431214312243123431244312543126431274312843129431304313143132431334313443135431364313743138431394314043141431424314343144431454314643147431484314943150431514315243153431544315543156431574315843159431604316143162431634316443165431664316743168431694317043171431724317343174431754317643177431784317943180431814318243183431844318543186431874318843189431904319143192431934319443195431964319743198431994320043201432024320343204432054320643207432084320943210432114321243213432144321543216432174321843219432204322143222432234322443225432264322743228432294323043231432324323343234432354323643237432384323943240432414324243243432444324543246432474324843249432504325143252432534325443255432564325743258432594326043261432624326343264432654326643267432684326943270432714327243273432744327543276432774327843279432804328143282432834328443285432864328743288432894329043291432924329343294432954329643297432984329943300433014330243303433044330543306433074330843309433104331143312433134331443315433164331743318433194332043321433224332343324433254332643327433284332943330433314333243333433344333543336433374333843339433404334143342433434334443345433464334743348433494335043351433524335343354433554335643357433584335943360433614336243363433644336543366433674336843369433704337143372433734337443375433764337743378433794338043381433824338343384433854338643387433884338943390433914339243393433944339543396433974339843399434004340143402434034340443405434064340743408434094341043411434124341343414434154341643417434184341943420434214342243423434244342543426434274342843429434304343143432434334343443435434364343743438434394344043441434424344343444434454344643447434484344943450434514345243453434544345543456434574345843459434604346143462434634346443465434664346743468434694347043471434724347343474434754347643477434784347943480434814348243483434844348543486434874348843489434904349143492434934349443495434964349743498434994350043501435024350343504435054350643507435084350943510435114351243513435144351543516435174351843519435204352143522435234352443525435264352743528435294353043531435324353343534435354353643537435384353943540435414354243543435444354543546435474354843549435504355143552435534355443555435564355743558435594356043561435624356343564435654356643567435684356943570435714357243573435744357543576435774357843579435804358143582435834358443585435864358743588435894359043591435924359343594435954359643597435984359943600436014360243603436044360543606436074360843609436104361143612436134361443615436164361743618436194362043621436224362343624436254362643627436284362943630436314363243633436344363543636436374363843639436404364143642436434364443645436464364743648436494365043651436524365343654436554365643657436584365943660436614366243663436644366543666436674366843669436704367143672436734367443675436764367743678436794368043681436824368343684436854368643687436884368943690436914369243693436944369543696436974369843699437004370143702437034370443705437064370743708437094371043711437124371343714437154371643717437184371943720437214372243723437244372543726437274372843729437304373143732437334373443735437364373743738437394374043741437424374343744437454374643747437484374943750437514375243753437544375543756437574375843759437604376143762437634376443765437664376743768437694377043771437724377343774437754377643777437784377943780437814378243783437844378543786437874378843789437904379143792437934379443795437964379743798437994380043801438024380343804438054380643807438084380943810438114381243813438144381543816438174381843819438204382143822438234382443825438264382743828438294383043831438324383343834438354383643837438384383943840438414384243843438444384543846438474384843849438504385143852438534385443855438564385743858438594386043861438624386343864438654386643867438684386943870438714387243873438744387543876438774387843879438804388143882438834388443885438864388743888438894389043891438924389343894438954389643897438984389943900439014390243903439044390543906439074390843909439104391143912439134391443915439164391743918439194392043921439224392343924439254392643927439284392943930439314393243933439344393543936439374393843939439404394143942439434394443945439464394743948439494395043951439524395343954439554395643957439584395943960439614396243963439644396543966439674396843969439704397143972439734397443975439764397743978439794398043981439824398343984439854398643987439884398943990439914399243993439944399543996439974399843999440004400144002440034400444005440064400744008440094401044011440124401344014440154401644017440184401944020440214402244023440244402544026440274402844029440304403144032440334403444035440364403744038440394404044041440424404344044440454404644047440484404944050440514405244053440544405544056440574405844059440604406144062440634406444065440664406744068440694407044071440724407344074440754407644077440784407944080440814408244083440844408544086440874408844089440904409144092440934409444095440964409744098440994410044101441024410344104441054410644107441084410944110441114411244113441144411544116441174411844119441204412144122441234412444125441264412744128441294413044131441324413344134441354413644137441384413944140441414414244143441444414544146441474414844149441504415144152441534415444155441564415744158441594416044161441624416344164441654416644167441684416944170441714417244173441744417544176441774417844179441804418144182441834418444185441864418744188441894419044191441924419344194441954419644197441984419944200442014420244203442044420544206442074420844209442104421144212442134421444215442164421744218442194422044221442224422344224442254422644227442284422944230442314423244233442344423544236442374423844239442404424144242442434424444245442464424744248442494425044251442524425344254442554425644257442584425944260442614426244263442644426544266442674426844269442704427144272442734427444275442764427744278442794428044281442824428344284442854428644287442884428944290442914429244293442944429544296442974429844299443004430144302443034430444305443064430744308443094431044311443124431344314443154431644317443184431944320443214432244323443244432544326443274432844329443304433144332443334433444335443364433744338443394434044341443424434344344443454434644347443484434944350443514435244353443544435544356443574435844359443604436144362443634436444365443664436744368443694437044371443724437344374443754437644377443784437944380443814438244383443844438544386443874438844389443904439144392443934439444395443964439744398443994440044401444024440344404444054440644407444084440944410444114441244413444144441544416444174441844419444204442144422444234442444425444264442744428444294443044431444324443344434444354443644437444384443944440444414444244443444444444544446444474444844449444504445144452444534445444455444564445744458444594446044461444624446344464444654446644467444684446944470444714447244473444744447544476444774447844479444804448144482444834448444485444864448744488444894449044491444924449344494444954449644497444984449944500445014450244503445044450544506445074450844509445104451144512445134451444515445164451744518445194452044521445224452344524445254452644527445284452944530445314453244533445344453544536445374453844539445404454144542445434454444545445464454744548445494455044551445524455344554445554455644557445584455944560445614456244563445644456544566445674456844569445704457144572445734457444575445764457744578445794458044581445824458344584445854458644587445884458944590445914459244593445944459544596445974459844599446004460144602446034460444605446064460744608446094461044611446124461344614446154461644617446184461944620446214462244623446244462544626446274462844629446304463144632446334463444635446364463744638446394464044641446424464344644446454464644647446484464944650446514465244653446544465544656446574465844659446604466144662446634466444665446664466744668446694467044671446724467344674446754467644677446784467944680446814468244683446844468544686446874468844689446904469144692446934469444695446964469744698446994470044701447024470344704447054470644707447084470944710447114471244713447144471544716447174471844719447204472144722447234472444725447264472744728447294473044731447324473344734447354473644737447384473944740447414474244743447444474544746447474474844749447504475144752447534475444755447564475744758447594476044761447624476344764447654476644767447684476944770447714477244773447744477544776447774477844779447804478144782447834478444785447864478744788447894479044791447924479344794447954479644797447984479944800448014480244803448044480544806448074480844809448104481144812448134481444815448164481744818448194482044821448224482344824448254482644827448284482944830448314483244833448344483544836448374483844839448404484144842448434484444845448464484744848448494485044851448524485344854448554485644857448584485944860448614486244863448644486544866448674486844869448704487144872448734487444875448764487744878448794488044881448824488344884448854488644887448884488944890448914489244893448944489544896448974489844899449004490144902449034490444905449064490744908449094491044911449124491344914449154491644917449184491944920449214492244923449244492544926449274492844929449304493144932449334493444935449364493744938449394494044941449424494344944449454494644947449484494944950449514495244953449544495544956449574495844959449604496144962449634496444965449664496744968449694497044971449724497344974449754497644977449784497944980449814498244983449844498544986449874498844989449904499144992449934499444995449964499744998449994500045001450024500345004450054500645007450084500945010450114501245013450144501545016450174501845019450204502145022450234502445025450264502745028450294503045031450324503345034450354503645037450384503945040450414504245043450444504545046450474504845049450504505145052450534505445055450564505745058450594506045061450624506345064450654506645067450684506945070450714507245073450744507545076450774507845079450804508145082450834508445085450864508745088450894509045091450924509345094450954509645097450984509945100451014510245103451044510545106451074510845109451104511145112451134511445115451164511745118451194512045121451224512345124451254512645127451284512945130451314513245133451344513545136451374513845139451404514145142451434514445145451464514745148451494515045151451524515345154451554515645157451584515945160451614516245163451644516545166451674516845169451704517145172451734517445175451764517745178451794518045181451824518345184451854518645187451884518945190451914519245193451944519545196451974519845199452004520145202452034520445205452064520745208452094521045211452124521345214452154521645217452184521945220452214522245223452244522545226452274522845229452304523145232452334523445235452364523745238452394524045241452424524345244452454524645247452484524945250452514525245253452544525545256452574525845259452604526145262452634526445265452664526745268452694527045271452724527345274452754527645277452784527945280452814528245283452844528545286452874528845289452904529145292452934529445295452964529745298452994530045301453024530345304453054530645307453084530945310453114531245313453144531545316453174531845319453204532145322453234532445325453264532745328453294533045331453324533345334453354533645337453384533945340453414534245343453444534545346453474534845349453504535145352453534535445355453564535745358453594536045361453624536345364453654536645367453684536945370453714537245373453744537545376453774537845379453804538145382453834538445385453864538745388453894539045391453924539345394453954539645397453984539945400454014540245403454044540545406454074540845409454104541145412454134541445415454164541745418454194542045421454224542345424454254542645427454284542945430454314543245433454344543545436454374543845439454404544145442454434544445445454464544745448454494545045451454524545345454454554545645457454584545945460454614546245463454644546545466454674546845469454704547145472454734547445475454764547745478454794548045481454824548345484454854548645487454884548945490454914549245493454944549545496454974549845499455004550145502455034550445505455064550745508455094551045511455124551345514455154551645517455184551945520455214552245523455244552545526455274552845529455304553145532455334553445535455364553745538455394554045541455424554345544455454554645547455484554945550455514555245553455544555545556455574555845559455604556145562455634556445565455664556745568455694557045571455724557345574455754557645577455784557945580455814558245583455844558545586455874558845589455904559145592455934559445595455964559745598455994560045601456024560345604456054560645607456084560945610456114561245613456144561545616456174561845619456204562145622456234562445625456264562745628456294563045631456324563345634456354563645637456384563945640456414564245643456444564545646456474564845649456504565145652456534565445655456564565745658456594566045661456624566345664456654566645667456684566945670456714567245673456744567545676456774567845679456804568145682456834568445685456864568745688456894569045691456924569345694456954569645697456984569945700457014570245703457044570545706457074570845709457104571145712457134571445715457164571745718457194572045721457224572345724457254572645727457284572945730457314573245733457344573545736457374573845739457404574145742457434574445745457464574745748457494575045751457524575345754457554575645757457584575945760457614576245763457644576545766457674576845769457704577145772457734577445775457764577745778457794578045781457824578345784457854578645787457884578945790457914579245793457944579545796457974579845799458004580145802458034580445805458064580745808458094581045811458124581345814458154581645817458184581945820458214582245823458244582545826458274582845829458304583145832458334583445835458364583745838458394584045841458424584345844458454584645847458484584945850458514585245853458544585545856458574585845859458604586145862458634586445865458664586745868458694587045871458724587345874458754587645877458784587945880458814588245883458844588545886458874588845889458904589145892458934589445895458964589745898458994590045901459024590345904459054590645907459084590945910459114591245913459144591545916459174591845919459204592145922459234592445925459264592745928459294593045931459324593345934459354593645937459384593945940459414594245943459444594545946459474594845949459504595145952459534595445955459564595745958459594596045961459624596345964459654596645967459684596945970459714597245973459744597545976459774597845979459804598145982459834598445985459864598745988459894599045991459924599345994459954599645997459984599946000460014600246003460044600546006460074600846009460104601146012460134601446015460164601746018460194602046021460224602346024460254602646027460284602946030460314603246033460344603546036460374603846039460404604146042460434604446045460464604746048460494605046051460524605346054460554605646057460584605946060460614606246063460644606546066460674606846069460704607146072460734607446075460764607746078460794608046081460824608346084460854608646087460884608946090460914609246093460944609546096460974609846099461004610146102461034610446105461064610746108461094611046111461124611346114461154611646117461184611946120461214612246123461244612546126461274612846129461304613146132461334613446135461364613746138461394614046141461424614346144461454614646147461484614946150461514615246153461544615546156461574615846159461604616146162461634616446165461664616746168461694617046171461724617346174461754617646177461784617946180461814618246183461844618546186461874618846189461904619146192461934619446195461964619746198461994620046201462024620346204462054620646207462084620946210462114621246213462144621546216462174621846219462204622146222462234622446225462264622746228462294623046231462324623346234462354623646237462384623946240462414624246243462444624546246462474624846249462504625146252462534625446255462564625746258462594626046261462624626346264462654626646267462684626946270462714627246273462744627546276462774627846279462804628146282462834628446285462864628746288462894629046291462924629346294462954629646297462984629946300463014630246303463044630546306463074630846309463104631146312463134631446315463164631746318463194632046321463224632346324463254632646327463284632946330463314633246333463344633546336463374633846339463404634146342463434634446345463464634746348463494635046351463524635346354463554635646357463584635946360463614636246363463644636546366463674636846369463704637146372463734637446375463764637746378463794638046381463824638346384463854638646387463884638946390463914639246393463944639546396463974639846399464004640146402464034640446405464064640746408464094641046411464124641346414464154641646417464184641946420464214642246423464244642546426464274642846429464304643146432464334643446435464364643746438464394644046441464424644346444464454644646447464484644946450464514645246453464544645546456464574645846459464604646146462464634646446465464664646746468464694647046471464724647346474464754647646477464784647946480464814648246483464844648546486464874648846489464904649146492464934649446495464964649746498464994650046501465024650346504465054650646507465084650946510465114651246513465144651546516465174651846519465204652146522465234652446525465264652746528465294653046531465324653346534465354653646537465384653946540465414654246543465444654546546465474654846549465504655146552465534655446555465564655746558465594656046561465624656346564465654656646567465684656946570465714657246573465744657546576465774657846579465804658146582465834658446585465864658746588465894659046591465924659346594465954659646597465984659946600466014660246603466044660546606466074660846609466104661146612466134661446615466164661746618466194662046621466224662346624466254662646627466284662946630466314663246633466344663546636466374663846639466404664146642466434664446645466464664746648466494665046651466524665346654466554665646657466584665946660466614666246663466644666546666466674666846669466704667146672466734667446675466764667746678466794668046681466824668346684466854668646687466884668946690466914669246693466944669546696466974669846699467004670146702467034670446705467064670746708467094671046711467124671346714467154671646717467184671946720467214672246723467244672546726467274672846729467304673146732467334673446735467364673746738467394674046741467424674346744467454674646747467484674946750467514675246753467544675546756467574675846759467604676146762467634676446765467664676746768467694677046771467724677346774467754677646777467784677946780467814678246783467844678546786467874678846789467904679146792467934679446795467964679746798467994680046801468024680346804468054680646807468084680946810468114681246813468144681546816468174681846819468204682146822468234682446825468264682746828468294683046831468324683346834468354683646837468384683946840468414684246843468444684546846468474684846849468504685146852468534685446855468564685746858468594686046861468624686346864468654686646867468684686946870468714687246873468744687546876468774687846879468804688146882468834688446885468864688746888468894689046891468924689346894468954689646897468984689946900469014690246903469044690546906469074690846909469104691146912469134691446915469164691746918469194692046921469224692346924469254692646927469284692946930469314693246933469344693546936469374693846939469404694146942469434694446945469464694746948469494695046951469524695346954469554695646957469584695946960469614696246963469644696546966469674696846969469704697146972469734697446975469764697746978469794698046981469824698346984469854698646987469884698946990469914699246993469944699546996469974699846999470004700147002470034700447005470064700747008470094701047011470124701347014470154701647017470184701947020470214702247023470244702547026470274702847029470304703147032470334703447035470364703747038470394704047041470424704347044470454704647047470484704947050470514705247053470544705547056470574705847059470604706147062470634706447065470664706747068470694707047071470724707347074470754707647077470784707947080470814708247083470844708547086470874708847089470904709147092470934709447095470964709747098470994710047101471024710347104471054710647107471084710947110471114711247113471144711547116471174711847119471204712147122471234712447125471264712747128471294713047131471324713347134471354713647137471384713947140471414714247143471444714547146471474714847149471504715147152471534715447155471564715747158471594716047161471624716347164471654716647167471684716947170471714717247173471744717547176471774717847179471804718147182471834718447185471864718747188471894719047191471924719347194471954719647197471984719947200472014720247203472044720547206472074720847209472104721147212472134721447215472164721747218472194722047221472224722347224472254722647227472284722947230472314723247233472344723547236472374723847239472404724147242472434724447245472464724747248472494725047251472524725347254472554725647257472584725947260472614726247263472644726547266472674726847269472704727147272472734727447275472764727747278472794728047281472824728347284472854728647287472884728947290472914729247293472944729547296472974729847299473004730147302473034730447305473064730747308473094731047311473124731347314473154731647317473184731947320473214732247323473244732547326473274732847329473304733147332473334733447335473364733747338473394734047341473424734347344473454734647347473484734947350473514735247353473544735547356473574735847359473604736147362473634736447365473664736747368473694737047371473724737347374473754737647377473784737947380473814738247383473844738547386473874738847389473904739147392473934739447395473964739747398473994740047401474024740347404474054740647407474084740947410474114741247413474144741547416474174741847419474204742147422474234742447425474264742747428474294743047431474324743347434474354743647437474384743947440474414744247443474444744547446474474744847449474504745147452474534745447455474564745747458474594746047461474624746347464474654746647467474684746947470474714747247473474744747547476474774747847479474804748147482474834748447485474864748747488474894749047491474924749347494474954749647497474984749947500475014750247503475044750547506475074750847509475104751147512475134751447515475164751747518475194752047521475224752347524475254752647527475284752947530475314753247533475344753547536475374753847539475404754147542475434754447545475464754747548475494755047551475524755347554475554755647557475584755947560475614756247563475644756547566475674756847569475704757147572475734757447575475764757747578475794758047581475824758347584475854758647587475884758947590475914759247593475944759547596475974759847599476004760147602476034760447605476064760747608476094761047611476124761347614476154761647617476184761947620476214762247623476244762547626476274762847629476304763147632476334763447635476364763747638476394764047641476424764347644476454764647647476484764947650476514765247653476544765547656476574765847659476604766147662476634766447665476664766747668476694767047671476724767347674476754767647677476784767947680476814768247683476844768547686476874768847689476904769147692476934769447695476964769747698476994770047701477024770347704477054770647707477084770947710477114771247713477144771547716477174771847719477204772147722477234772447725477264772747728477294773047731477324773347734477354773647737477384773947740477414774247743477444774547746477474774847749477504775147752477534775447755477564775747758477594776047761477624776347764477654776647767477684776947770477714777247773477744777547776477774777847779477804778147782477834778447785477864778747788477894779047791477924779347794477954779647797477984779947800478014780247803478044780547806478074780847809478104781147812478134781447815478164781747818478194782047821478224782347824478254782647827478284782947830478314783247833478344783547836478374783847839478404784147842478434784447845478464784747848478494785047851478524785347854478554785647857478584785947860478614786247863478644786547866478674786847869478704787147872478734787447875478764787747878478794788047881478824788347884478854788647887478884788947890478914789247893478944789547896478974789847899479004790147902479034790447905479064790747908479094791047911479124791347914479154791647917479184791947920479214792247923479244792547926479274792847929479304793147932479334793447935479364793747938479394794047941479424794347944479454794647947479484794947950479514795247953479544795547956479574795847959479604796147962479634796447965479664796747968479694797047971479724797347974479754797647977479784797947980479814798247983479844798547986479874798847989479904799147992479934799447995479964799747998479994800048001480024800348004480054800648007480084800948010480114801248013480144801548016480174801848019480204802148022480234802448025480264802748028480294803048031480324803348034480354803648037480384803948040480414804248043480444804548046480474804848049480504805148052480534805448055480564805748058480594806048061480624806348064480654806648067480684806948070480714807248073480744807548076480774807848079480804808148082480834808448085480864808748088480894809048091480924809348094480954809648097480984809948100481014810248103481044810548106481074810848109481104811148112481134811448115481164811748118481194812048121481224812348124481254812648127481284812948130481314813248133481344813548136481374813848139481404814148142481434814448145481464814748148481494815048151481524815348154481554815648157481584815948160481614816248163481644816548166481674816848169481704817148172481734817448175481764817748178481794818048181481824818348184481854818648187481884818948190481914819248193481944819548196481974819848199482004820148202482034820448205482064820748208482094821048211482124821348214482154821648217482184821948220482214822248223482244822548226482274822848229482304823148232482334823448235482364823748238482394824048241482424824348244482454824648247482484824948250482514825248253482544825548256482574825848259482604826148262482634826448265482664826748268482694827048271482724827348274482754827648277482784827948280482814828248283482844828548286482874828848289482904829148292482934829448295482964829748298482994830048301483024830348304483054830648307483084830948310483114831248313483144831548316483174831848319483204832148322483234832448325483264832748328483294833048331483324833348334483354833648337483384833948340483414834248343483444834548346483474834848349483504835148352483534835448355483564835748358483594836048361483624836348364483654836648367483684836948370483714837248373483744837548376483774837848379483804838148382483834838448385483864838748388483894839048391483924839348394483954839648397483984839948400484014840248403484044840548406484074840848409484104841148412484134841448415484164841748418484194842048421484224842348424484254842648427484284842948430484314843248433484344843548436484374843848439484404844148442484434844448445484464844748448484494845048451484524845348454484554845648457484584845948460484614846248463484644846548466484674846848469484704847148472484734847448475484764847748478484794848048481484824848348484484854848648487484884848948490484914849248493484944849548496484974849848499485004850148502485034850448505485064850748508485094851048511485124851348514485154851648517485184851948520485214852248523485244852548526485274852848529485304853148532485334853448535485364853748538485394854048541485424854348544485454854648547485484854948550485514855248553485544855548556485574855848559485604856148562485634856448565485664856748568485694857048571485724857348574485754857648577485784857948580485814858248583485844858548586485874858848589485904859148592485934859448595485964859748598485994860048601486024860348604486054860648607486084860948610486114861248613486144861548616486174861848619486204862148622486234862448625486264862748628486294863048631486324863348634486354863648637486384863948640486414864248643486444864548646486474864848649486504865148652486534865448655486564865748658486594866048661486624866348664486654866648667486684866948670486714867248673486744867548676486774867848679486804868148682486834868448685486864868748688486894869048691486924869348694486954869648697486984869948700487014870248703487044870548706487074870848709487104871148712487134871448715487164871748718487194872048721487224872348724487254872648727487284872948730487314873248733487344873548736487374873848739487404874148742487434874448745487464874748748487494875048751487524875348754487554875648757487584875948760487614876248763487644876548766487674876848769487704877148772487734877448775487764877748778487794878048781487824878348784487854878648787487884878948790487914879248793487944879548796487974879848799488004880148802488034880448805488064880748808488094881048811488124881348814488154881648817488184881948820488214882248823488244882548826488274882848829488304883148832488334883448835488364883748838488394884048841488424884348844488454884648847488484884948850488514885248853488544885548856488574885848859488604886148862488634886448865488664886748868488694887048871488724887348874488754887648877488784887948880488814888248883488844888548886488874888848889488904889148892488934889448895488964889748898488994890048901489024890348904489054890648907489084890948910489114891248913489144891548916489174891848919489204892148922489234892448925489264892748928489294893048931489324893348934489354893648937489384893948940489414894248943489444894548946489474894848949489504895148952489534895448955489564895748958489594896048961489624896348964489654896648967489684896948970489714897248973489744897548976489774897848979489804898148982489834898448985489864898748988489894899048991489924899348994489954899648997489984899949000490014900249003490044900549006490074900849009490104901149012490134901449015490164901749018490194902049021490224902349024490254902649027490284902949030490314903249033490344903549036490374903849039490404904149042490434904449045490464904749048490494905049051490524905349054490554905649057490584905949060490614906249063490644906549066490674906849069490704907149072490734907449075490764907749078490794908049081490824908349084490854908649087490884908949090490914909249093490944909549096490974909849099491004910149102491034910449105491064910749108491094911049111491124911349114491154911649117491184911949120491214912249123491244912549126491274912849129491304913149132491334913449135491364913749138491394914049141491424914349144491454914649147491484914949150491514915249153491544915549156491574915849159491604916149162491634916449165491664916749168491694917049171491724917349174491754917649177491784917949180491814918249183491844918549186491874918849189491904919149192491934919449195491964919749198491994920049201492024920349204492054920649207492084920949210492114921249213492144921549216492174921849219492204922149222492234922449225492264922749228492294923049231492324923349234492354923649237492384923949240492414924249243492444924549246492474924849249492504925149252492534925449255492564925749258492594926049261492624926349264492654926649267492684926949270492714927249273492744927549276492774927849279492804928149282492834928449285492864928749288492894929049291492924929349294492954929649297492984929949300493014930249303493044930549306493074930849309493104931149312493134931449315493164931749318493194932049321493224932349324493254932649327493284932949330493314933249333493344933549336493374933849339493404934149342493434934449345493464934749348493494935049351493524935349354493554935649357493584935949360493614936249363493644936549366493674936849369493704937149372493734937449375493764937749378493794938049381493824938349384493854938649387493884938949390493914939249393493944939549396493974939849399494004940149402494034940449405494064940749408494094941049411494124941349414494154941649417494184941949420494214942249423494244942549426494274942849429494304943149432494334943449435494364943749438494394944049441494424944349444494454944649447494484944949450494514945249453494544945549456494574945849459494604946149462494634946449465494664946749468494694947049471494724947349474494754947649477494784947949480494814948249483494844948549486494874948849489494904949149492494934949449495494964949749498494994950049501495024950349504495054950649507495084950949510495114951249513495144951549516495174951849519495204952149522495234952449525495264952749528495294953049531495324953349534495354953649537495384953949540495414954249543495444954549546495474954849549495504955149552495534955449555495564955749558495594956049561495624956349564495654956649567495684956949570495714957249573495744957549576495774957849579495804958149582495834958449585495864958749588495894959049591495924959349594495954959649597495984959949600496014960249603496044960549606496074960849609496104961149612496134961449615496164961749618496194962049621496224962349624496254962649627496284962949630496314963249633496344963549636496374963849639496404964149642496434964449645496464964749648496494965049651496524965349654496554965649657496584965949660496614966249663496644966549666496674966849669496704967149672496734967449675496764967749678496794968049681496824968349684496854968649687496884968949690496914969249693496944969549696496974969849699497004970149702497034970449705497064970749708497094971049711497124971349714497154971649717497184971949720497214972249723497244972549726497274972849729497304973149732497334973449735497364973749738497394974049741497424974349744497454974649747497484974949750497514975249753497544975549756497574975849759497604976149762497634976449765497664976749768497694977049771497724977349774497754977649777497784977949780497814978249783497844978549786497874978849789497904979149792497934979449795497964979749798497994980049801498024980349804498054980649807498084980949810498114981249813498144981549816498174981849819498204982149822498234982449825498264982749828498294983049831498324983349834498354983649837498384983949840498414984249843498444984549846498474984849849498504985149852498534985449855498564985749858498594986049861498624986349864498654986649867498684986949870498714987249873498744987549876498774987849879498804988149882498834988449885498864988749888498894989049891498924989349894498954989649897498984989949900499014990249903499044990549906499074990849909499104991149912499134991449915499164991749918499194992049921499224992349924499254992649927499284992949930499314993249933499344993549936499374993849939499404994149942499434994449945499464994749948499494995049951499524995349954499554995649957499584995949960499614996249963499644996549966499674996849969499704997149972499734997449975499764997749978499794998049981499824998349984499854998649987499884998949990499914999249993499944999549996499974999849999500005000150002500035000450005500065000750008500095001050011500125001350014500155001650017500185001950020500215002250023500245002550026500275002850029500305003150032500335003450035500365003750038500395004050041500425004350044500455004650047500485004950050500515005250053500545005550056500575005850059500605006150062500635006450065500665006750068500695007050071500725007350074500755007650077500785007950080500815008250083500845008550086500875008850089500905009150092500935009450095500965009750098500995010050101501025010350104501055010650107501085010950110501115011250113501145011550116501175011850119501205012150122501235012450125501265012750128501295013050131501325013350134501355013650137501385013950140501415014250143501445014550146501475014850149501505015150152501535015450155501565015750158501595016050161501625016350164501655016650167501685016950170501715017250173501745017550176501775017850179501805018150182501835018450185501865018750188501895019050191501925019350194501955019650197501985019950200502015020250203502045020550206502075020850209502105021150212502135021450215502165021750218502195022050221502225022350224502255022650227502285022950230502315023250233502345023550236502375023850239502405024150242502435024450245502465024750248502495025050251502525025350254502555025650257502585025950260502615026250263502645026550266502675026850269502705027150272502735027450275502765027750278502795028050281502825028350284502855028650287502885028950290502915029250293502945029550296502975029850299503005030150302503035030450305503065030750308503095031050311503125031350314503155031650317503185031950320503215032250323503245032550326503275032850329503305033150332503335033450335503365033750338503395034050341503425034350344503455034650347503485034950350503515035250353503545035550356503575035850359503605036150362503635036450365503665036750368503695037050371503725037350374503755037650377503785037950380503815038250383503845038550386503875038850389503905039150392503935039450395503965039750398503995040050401504025040350404504055040650407504085040950410504115041250413504145041550416504175041850419504205042150422504235042450425504265042750428504295043050431504325043350434504355043650437504385043950440504415044250443504445044550446504475044850449504505045150452504535045450455504565045750458504595046050461504625046350464504655046650467504685046950470504715047250473504745047550476504775047850479504805048150482504835048450485504865048750488504895049050491504925049350494504955049650497504985049950500505015050250503505045050550506505075050850509505105051150512505135051450515505165051750518505195052050521505225052350524505255052650527505285052950530505315053250533505345053550536505375053850539505405054150542505435054450545505465054750548505495055050551505525055350554505555055650557505585055950560505615056250563505645056550566505675056850569505705057150572505735057450575505765057750578505795058050581505825058350584505855058650587505885058950590505915059250593505945059550596505975059850599506005060150602506035060450605506065060750608506095061050611506125061350614506155061650617506185061950620506215062250623506245062550626506275062850629506305063150632506335063450635506365063750638506395064050641506425064350644506455064650647506485064950650506515065250653506545065550656506575065850659506605066150662506635066450665506665066750668506695067050671506725067350674506755067650677506785067950680506815068250683506845068550686506875068850689506905069150692506935069450695506965069750698506995070050701507025070350704507055070650707507085070950710507115071250713507145071550716507175071850719507205072150722507235072450725507265072750728507295073050731507325073350734507355073650737507385073950740507415074250743507445074550746507475074850749507505075150752507535075450755507565075750758507595076050761507625076350764507655076650767507685076950770507715077250773507745077550776507775077850779507805078150782507835078450785507865078750788507895079050791507925079350794507955079650797507985079950800508015080250803508045080550806508075080850809508105081150812508135081450815508165081750818508195082050821508225082350824508255082650827508285082950830508315083250833508345083550836508375083850839508405084150842508435084450845508465084750848508495085050851508525085350854508555085650857508585085950860508615086250863508645086550866508675086850869508705087150872508735087450875508765087750878508795088050881508825088350884508855088650887508885088950890508915089250893508945089550896508975089850899509005090150902509035090450905509065090750908509095091050911509125091350914509155091650917509185091950920509215092250923509245092550926509275092850929509305093150932509335093450935509365093750938509395094050941509425094350944509455094650947509485094950950509515095250953509545095550956509575095850959509605096150962509635096450965509665096750968509695097050971509725097350974509755097650977509785097950980509815098250983509845098550986509875098850989509905099150992509935099450995509965099750998509995100051001510025100351004510055100651007510085100951010510115101251013510145101551016510175101851019510205102151022510235102451025510265102751028510295103051031510325103351034510355103651037510385103951040510415104251043510445104551046510475104851049510505105151052510535105451055510565105751058510595106051061510625106351064510655106651067510685106951070510715107251073510745107551076510775107851079510805108151082510835108451085
  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 = 37);
  76. /******/ })
  77. /************************************************************************/
  78. /******/ ([
  79. /* 0 */
  80. /***/ (function(module, exports, __w_pdfjs_require__) {
  81. "use strict";
  82. /* WEBPACK VAR INJECTION */(function(global) {
  83. var compatibility = __w_pdfjs_require__(36);
  84. var globalScope = typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : this;
  85. var FONT_IDENTITY_MATRIX = [
  86. 0.001,
  87. 0,
  88. 0,
  89. 0.001,
  90. 0,
  91. 0
  92. ];
  93. var TextRenderingMode = {
  94. FILL: 0,
  95. STROKE: 1,
  96. FILL_STROKE: 2,
  97. INVISIBLE: 3,
  98. FILL_ADD_TO_PATH: 4,
  99. STROKE_ADD_TO_PATH: 5,
  100. FILL_STROKE_ADD_TO_PATH: 6,
  101. ADD_TO_PATH: 7,
  102. FILL_STROKE_MASK: 3,
  103. ADD_TO_PATH_FLAG: 4
  104. };
  105. var ImageKind = {
  106. GRAYSCALE_1BPP: 1,
  107. RGB_24BPP: 2,
  108. RGBA_32BPP: 3
  109. };
  110. var AnnotationType = {
  111. TEXT: 1,
  112. LINK: 2,
  113. FREETEXT: 3,
  114. LINE: 4,
  115. SQUARE: 5,
  116. CIRCLE: 6,
  117. POLYGON: 7,
  118. POLYLINE: 8,
  119. HIGHLIGHT: 9,
  120. UNDERLINE: 10,
  121. SQUIGGLY: 11,
  122. STRIKEOUT: 12,
  123. STAMP: 13,
  124. CARET: 14,
  125. INK: 15,
  126. POPUP: 16,
  127. FILEATTACHMENT: 17,
  128. SOUND: 18,
  129. MOVIE: 19,
  130. WIDGET: 20,
  131. SCREEN: 21,
  132. PRINTERMARK: 22,
  133. TRAPNET: 23,
  134. WATERMARK: 24,
  135. THREED: 25,
  136. REDACT: 26
  137. };
  138. var AnnotationFlag = {
  139. INVISIBLE: 0x01,
  140. HIDDEN: 0x02,
  141. PRINT: 0x04,
  142. NOZOOM: 0x08,
  143. NOROTATE: 0x10,
  144. NOVIEW: 0x20,
  145. READONLY: 0x40,
  146. LOCKED: 0x80,
  147. TOGGLENOVIEW: 0x100,
  148. LOCKEDCONTENTS: 0x200
  149. };
  150. var AnnotationFieldFlag = {
  151. READONLY: 0x0000001,
  152. REQUIRED: 0x0000002,
  153. NOEXPORT: 0x0000004,
  154. MULTILINE: 0x0001000,
  155. PASSWORD: 0x0002000,
  156. NOTOGGLETOOFF: 0x0004000,
  157. RADIO: 0x0008000,
  158. PUSHBUTTON: 0x0010000,
  159. COMBO: 0x0020000,
  160. EDIT: 0x0040000,
  161. SORT: 0x0080000,
  162. FILESELECT: 0x0100000,
  163. MULTISELECT: 0x0200000,
  164. DONOTSPELLCHECK: 0x0400000,
  165. DONOTSCROLL: 0x0800000,
  166. COMB: 0x1000000,
  167. RICHTEXT: 0x2000000,
  168. RADIOSINUNISON: 0x2000000,
  169. COMMITONSELCHANGE: 0x4000000
  170. };
  171. var AnnotationBorderStyleType = {
  172. SOLID: 1,
  173. DASHED: 2,
  174. BEVELED: 3,
  175. INSET: 4,
  176. UNDERLINE: 5
  177. };
  178. var StreamType = {
  179. UNKNOWN: 0,
  180. FLATE: 1,
  181. LZW: 2,
  182. DCT: 3,
  183. JPX: 4,
  184. JBIG: 5,
  185. A85: 6,
  186. AHX: 7,
  187. CCF: 8,
  188. RL: 9
  189. };
  190. var FontType = {
  191. UNKNOWN: 0,
  192. TYPE1: 1,
  193. TYPE1C: 2,
  194. CIDFONTTYPE0: 3,
  195. CIDFONTTYPE0C: 4,
  196. TRUETYPE: 5,
  197. CIDFONTTYPE2: 6,
  198. TYPE3: 7,
  199. OPENTYPE: 8,
  200. TYPE0: 9,
  201. MMTYPE1: 10
  202. };
  203. var VERBOSITY_LEVELS = {
  204. errors: 0,
  205. warnings: 1,
  206. infos: 5
  207. };
  208. var CMapCompressionType = {
  209. NONE: 0,
  210. BINARY: 1,
  211. STREAM: 2
  212. };
  213. var OPS = {
  214. dependency: 1,
  215. setLineWidth: 2,
  216. setLineCap: 3,
  217. setLineJoin: 4,
  218. setMiterLimit: 5,
  219. setDash: 6,
  220. setRenderingIntent: 7,
  221. setFlatness: 8,
  222. setGState: 9,
  223. save: 10,
  224. restore: 11,
  225. transform: 12,
  226. moveTo: 13,
  227. lineTo: 14,
  228. curveTo: 15,
  229. curveTo2: 16,
  230. curveTo3: 17,
  231. closePath: 18,
  232. rectangle: 19,
  233. stroke: 20,
  234. closeStroke: 21,
  235. fill: 22,
  236. eoFill: 23,
  237. fillStroke: 24,
  238. eoFillStroke: 25,
  239. closeFillStroke: 26,
  240. closeEOFillStroke: 27,
  241. endPath: 28,
  242. clip: 29,
  243. eoClip: 30,
  244. beginText: 31,
  245. endText: 32,
  246. setCharSpacing: 33,
  247. setWordSpacing: 34,
  248. setHScale: 35,
  249. setLeading: 36,
  250. setFont: 37,
  251. setTextRenderingMode: 38,
  252. setTextRise: 39,
  253. moveText: 40,
  254. setLeadingMoveText: 41,
  255. setTextMatrix: 42,
  256. nextLine: 43,
  257. showText: 44,
  258. showSpacedText: 45,
  259. nextLineShowText: 46,
  260. nextLineSetSpacingShowText: 47,
  261. setCharWidth: 48,
  262. setCharWidthAndBounds: 49,
  263. setStrokeColorSpace: 50,
  264. setFillColorSpace: 51,
  265. setStrokeColor: 52,
  266. setStrokeColorN: 53,
  267. setFillColor: 54,
  268. setFillColorN: 55,
  269. setStrokeGray: 56,
  270. setFillGray: 57,
  271. setStrokeRGBColor: 58,
  272. setFillRGBColor: 59,
  273. setStrokeCMYKColor: 60,
  274. setFillCMYKColor: 61,
  275. shadingFill: 62,
  276. beginInlineImage: 63,
  277. beginImageData: 64,
  278. endInlineImage: 65,
  279. paintXObject: 66,
  280. markPoint: 67,
  281. markPointProps: 68,
  282. beginMarkedContent: 69,
  283. beginMarkedContentProps: 70,
  284. endMarkedContent: 71,
  285. beginCompat: 72,
  286. endCompat: 73,
  287. paintFormXObjectBegin: 74,
  288. paintFormXObjectEnd: 75,
  289. beginGroup: 76,
  290. endGroup: 77,
  291. beginAnnotations: 78,
  292. endAnnotations: 79,
  293. beginAnnotation: 80,
  294. endAnnotation: 81,
  295. paintJpegXObject: 82,
  296. paintImageMaskXObject: 83,
  297. paintImageMaskXObjectGroup: 84,
  298. paintImageXObject: 85,
  299. paintInlineImageXObject: 86,
  300. paintInlineImageXObjectGroup: 87,
  301. paintImageXObjectRepeat: 88,
  302. paintImageMaskXObjectRepeat: 89,
  303. paintSolidColorImageMask: 90,
  304. constructPath: 91
  305. };
  306. var verbosity = VERBOSITY_LEVELS.warnings;
  307. function setVerbosityLevel(level) {
  308. verbosity = level;
  309. }
  310. function getVerbosityLevel() {
  311. return verbosity;
  312. }
  313. function info(msg) {
  314. if (verbosity >= VERBOSITY_LEVELS.infos) {
  315. console.log('Info: ' + msg);
  316. }
  317. }
  318. function warn(msg) {
  319. if (verbosity >= VERBOSITY_LEVELS.warnings) {
  320. console.log('Warning: ' + msg);
  321. }
  322. }
  323. function deprecated(details) {
  324. console.log('Deprecated API usage: ' + details);
  325. }
  326. function error(msg) {
  327. if (verbosity >= VERBOSITY_LEVELS.errors) {
  328. console.log('Error: ' + msg);
  329. console.log(backtrace());
  330. }
  331. throw new Error(msg);
  332. }
  333. function backtrace() {
  334. try {
  335. throw new Error();
  336. } catch (e) {
  337. return e.stack ? e.stack.split('\n').slice(2).join('\n') : '';
  338. }
  339. }
  340. function assert(cond, msg) {
  341. if (!cond) {
  342. error(msg);
  343. }
  344. }
  345. var UNSUPPORTED_FEATURES = {
  346. unknown: 'unknown',
  347. forms: 'forms',
  348. javaScript: 'javaScript',
  349. smask: 'smask',
  350. shadingPattern: 'shadingPattern',
  351. font: 'font'
  352. };
  353. function isSameOrigin(baseUrl, otherUrl) {
  354. try {
  355. var base = new URL(baseUrl);
  356. if (!base.origin || base.origin === 'null') {
  357. return false;
  358. }
  359. } catch (e) {
  360. return false;
  361. }
  362. var other = new URL(otherUrl, base);
  363. return base.origin === other.origin;
  364. }
  365. function isValidProtocol(url) {
  366. if (!url) {
  367. return false;
  368. }
  369. switch (url.protocol) {
  370. case 'http:':
  371. case 'https:':
  372. case 'ftp:':
  373. case 'mailto:':
  374. case 'tel:':
  375. return true;
  376. default:
  377. return false;
  378. }
  379. }
  380. function createValidAbsoluteUrl(url, baseUrl) {
  381. if (!url) {
  382. return null;
  383. }
  384. try {
  385. var absoluteUrl = baseUrl ? new URL(url, baseUrl) : new URL(url);
  386. if (isValidProtocol(absoluteUrl)) {
  387. return absoluteUrl;
  388. }
  389. } catch (ex) {
  390. }
  391. return null;
  392. }
  393. function shadow(obj, prop, value) {
  394. Object.defineProperty(obj, prop, {
  395. value: value,
  396. enumerable: true,
  397. configurable: true,
  398. writable: false
  399. });
  400. return value;
  401. }
  402. function getLookupTableFactory(initializer) {
  403. var lookup;
  404. return function () {
  405. if (initializer) {
  406. lookup = Object.create(null);
  407. initializer(lookup);
  408. initializer = null;
  409. }
  410. return lookup;
  411. };
  412. }
  413. var PasswordResponses = {
  414. NEED_PASSWORD: 1,
  415. INCORRECT_PASSWORD: 2
  416. };
  417. var PasswordException = function PasswordExceptionClosure() {
  418. function PasswordException(msg, code) {
  419. this.name = 'PasswordException';
  420. this.message = msg;
  421. this.code = code;
  422. }
  423. PasswordException.prototype = new Error();
  424. PasswordException.constructor = PasswordException;
  425. return PasswordException;
  426. }();
  427. var UnknownErrorException = function UnknownErrorExceptionClosure() {
  428. function UnknownErrorException(msg, details) {
  429. this.name = 'UnknownErrorException';
  430. this.message = msg;
  431. this.details = details;
  432. }
  433. UnknownErrorException.prototype = new Error();
  434. UnknownErrorException.constructor = UnknownErrorException;
  435. return UnknownErrorException;
  436. }();
  437. var InvalidPDFException = function InvalidPDFExceptionClosure() {
  438. function InvalidPDFException(msg) {
  439. this.name = 'InvalidPDFException';
  440. this.message = msg;
  441. }
  442. InvalidPDFException.prototype = new Error();
  443. InvalidPDFException.constructor = InvalidPDFException;
  444. return InvalidPDFException;
  445. }();
  446. var MissingPDFException = function MissingPDFExceptionClosure() {
  447. function MissingPDFException(msg) {
  448. this.name = 'MissingPDFException';
  449. this.message = msg;
  450. }
  451. MissingPDFException.prototype = new Error();
  452. MissingPDFException.constructor = MissingPDFException;
  453. return MissingPDFException;
  454. }();
  455. var UnexpectedResponseException = function UnexpectedResponseExceptionClosure() {
  456. function UnexpectedResponseException(msg, status) {
  457. this.name = 'UnexpectedResponseException';
  458. this.message = msg;
  459. this.status = status;
  460. }
  461. UnexpectedResponseException.prototype = new Error();
  462. UnexpectedResponseException.constructor = UnexpectedResponseException;
  463. return UnexpectedResponseException;
  464. }();
  465. var NotImplementedException = function NotImplementedExceptionClosure() {
  466. function NotImplementedException(msg) {
  467. this.message = msg;
  468. }
  469. NotImplementedException.prototype = new Error();
  470. NotImplementedException.prototype.name = 'NotImplementedException';
  471. NotImplementedException.constructor = NotImplementedException;
  472. return NotImplementedException;
  473. }();
  474. var MissingDataException = function MissingDataExceptionClosure() {
  475. function MissingDataException(begin, end) {
  476. this.begin = begin;
  477. this.end = end;
  478. this.message = 'Missing data [' + begin + ', ' + end + ')';
  479. }
  480. MissingDataException.prototype = new Error();
  481. MissingDataException.prototype.name = 'MissingDataException';
  482. MissingDataException.constructor = MissingDataException;
  483. return MissingDataException;
  484. }();
  485. var XRefParseException = function XRefParseExceptionClosure() {
  486. function XRefParseException(msg) {
  487. this.message = msg;
  488. }
  489. XRefParseException.prototype = new Error();
  490. XRefParseException.prototype.name = 'XRefParseException';
  491. XRefParseException.constructor = XRefParseException;
  492. return XRefParseException;
  493. }();
  494. var NullCharactersRegExp = /\x00/g;
  495. function removeNullCharacters(str) {
  496. if (typeof str !== 'string') {
  497. warn('The argument for removeNullCharacters must be a string.');
  498. return str;
  499. }
  500. return str.replace(NullCharactersRegExp, '');
  501. }
  502. function bytesToString(bytes) {
  503. assert(bytes !== null && typeof bytes === 'object' && bytes.length !== undefined, 'Invalid argument for bytesToString');
  504. var length = bytes.length;
  505. var MAX_ARGUMENT_COUNT = 8192;
  506. if (length < MAX_ARGUMENT_COUNT) {
  507. return String.fromCharCode.apply(null, bytes);
  508. }
  509. var strBuf = [];
  510. for (var i = 0; i < length; i += MAX_ARGUMENT_COUNT) {
  511. var chunkEnd = Math.min(i + MAX_ARGUMENT_COUNT, length);
  512. var chunk = bytes.subarray(i, chunkEnd);
  513. strBuf.push(String.fromCharCode.apply(null, chunk));
  514. }
  515. return strBuf.join('');
  516. }
  517. function stringToBytes(str) {
  518. assert(typeof str === 'string', 'Invalid argument for stringToBytes');
  519. var length = str.length;
  520. var bytes = new Uint8Array(length);
  521. for (var i = 0; i < length; ++i) {
  522. bytes[i] = str.charCodeAt(i) & 0xFF;
  523. }
  524. return bytes;
  525. }
  526. function arrayByteLength(arr) {
  527. if (arr.length !== undefined) {
  528. return arr.length;
  529. }
  530. assert(arr.byteLength !== undefined);
  531. return arr.byteLength;
  532. }
  533. function arraysToBytes(arr) {
  534. if (arr.length === 1 && arr[0] instanceof Uint8Array) {
  535. return arr[0];
  536. }
  537. var resultLength = 0;
  538. var i, ii = arr.length;
  539. var item, itemLength;
  540. for (i = 0; i < ii; i++) {
  541. item = arr[i];
  542. itemLength = arrayByteLength(item);
  543. resultLength += itemLength;
  544. }
  545. var pos = 0;
  546. var data = new Uint8Array(resultLength);
  547. for (i = 0; i < ii; i++) {
  548. item = arr[i];
  549. if (!(item instanceof Uint8Array)) {
  550. if (typeof item === 'string') {
  551. item = stringToBytes(item);
  552. } else {
  553. item = new Uint8Array(item);
  554. }
  555. }
  556. itemLength = item.byteLength;
  557. data.set(item, pos);
  558. pos += itemLength;
  559. }
  560. return data;
  561. }
  562. function string32(value) {
  563. return String.fromCharCode(value >> 24 & 0xff, value >> 16 & 0xff, value >> 8 & 0xff, value & 0xff);
  564. }
  565. function log2(x) {
  566. var n = 1, i = 0;
  567. while (x > n) {
  568. n <<= 1;
  569. i++;
  570. }
  571. return i;
  572. }
  573. function readInt8(data, start) {
  574. return data[start] << 24 >> 24;
  575. }
  576. function readUint16(data, offset) {
  577. return data[offset] << 8 | data[offset + 1];
  578. }
  579. function readUint32(data, offset) {
  580. return (data[offset] << 24 | data[offset + 1] << 16 | data[offset + 2] << 8 | data[offset + 3]) >>> 0;
  581. }
  582. function isLittleEndian() {
  583. var buffer8 = new Uint8Array(2);
  584. buffer8[0] = 1;
  585. var buffer16 = new Uint16Array(buffer8.buffer);
  586. return buffer16[0] === 1;
  587. }
  588. function isEvalSupported() {
  589. try {
  590. new Function('');
  591. return true;
  592. } catch (e) {
  593. return false;
  594. }
  595. }
  596. var Uint32ArrayView = function Uint32ArrayViewClosure() {
  597. function Uint32ArrayView(buffer, length) {
  598. this.buffer = buffer;
  599. this.byteLength = buffer.length;
  600. this.length = length === undefined ? this.byteLength >> 2 : length;
  601. ensureUint32ArrayViewProps(this.length);
  602. }
  603. Uint32ArrayView.prototype = Object.create(null);
  604. var uint32ArrayViewSetters = 0;
  605. function createUint32ArrayProp(index) {
  606. return {
  607. get: function () {
  608. var buffer = this.buffer, offset = index << 2;
  609. return (buffer[offset] | buffer[offset + 1] << 8 | buffer[offset + 2] << 16 | buffer[offset + 3] << 24) >>> 0;
  610. },
  611. set: function (value) {
  612. var buffer = this.buffer, offset = index << 2;
  613. buffer[offset] = value & 255;
  614. buffer[offset + 1] = value >> 8 & 255;
  615. buffer[offset + 2] = value >> 16 & 255;
  616. buffer[offset + 3] = value >>> 24 & 255;
  617. }
  618. };
  619. }
  620. function ensureUint32ArrayViewProps(length) {
  621. while (uint32ArrayViewSetters < length) {
  622. Object.defineProperty(Uint32ArrayView.prototype, uint32ArrayViewSetters, createUint32ArrayProp(uint32ArrayViewSetters));
  623. uint32ArrayViewSetters++;
  624. }
  625. }
  626. return Uint32ArrayView;
  627. }();
  628. exports.Uint32ArrayView = Uint32ArrayView;
  629. var IDENTITY_MATRIX = [
  630. 1,
  631. 0,
  632. 0,
  633. 1,
  634. 0,
  635. 0
  636. ];
  637. var Util = function UtilClosure() {
  638. function Util() {
  639. }
  640. var rgbBuf = [
  641. 'rgb(',
  642. 0,
  643. ',',
  644. 0,
  645. ',',
  646. 0,
  647. ')'
  648. ];
  649. Util.makeCssRgb = function Util_makeCssRgb(r, g, b) {
  650. rgbBuf[1] = r;
  651. rgbBuf[3] = g;
  652. rgbBuf[5] = b;
  653. return rgbBuf.join('');
  654. };
  655. Util.transform = function Util_transform(m1, m2) {
  656. return [
  657. m1[0] * m2[0] + m1[2] * m2[1],
  658. m1[1] * m2[0] + m1[3] * m2[1],
  659. m1[0] * m2[2] + m1[2] * m2[3],
  660. m1[1] * m2[2] + m1[3] * m2[3],
  661. m1[0] * m2[4] + m1[2] * m2[5] + m1[4],
  662. m1[1] * m2[4] + m1[3] * m2[5] + m1[5]
  663. ];
  664. };
  665. Util.applyTransform = function Util_applyTransform(p, m) {
  666. var xt = p[0] * m[0] + p[1] * m[2] + m[4];
  667. var yt = p[0] * m[1] + p[1] * m[3] + m[5];
  668. return [
  669. xt,
  670. yt
  671. ];
  672. };
  673. Util.applyInverseTransform = function Util_applyInverseTransform(p, m) {
  674. var d = m[0] * m[3] - m[1] * m[2];
  675. var xt = (p[0] * m[3] - p[1] * m[2] + m[2] * m[5] - m[4] * m[3]) / d;
  676. var yt = (-p[0] * m[1] + p[1] * m[0] + m[4] * m[1] - m[5] * m[0]) / d;
  677. return [
  678. xt,
  679. yt
  680. ];
  681. };
  682. Util.getAxialAlignedBoundingBox = function Util_getAxialAlignedBoundingBox(r, m) {
  683. var p1 = Util.applyTransform(r, m);
  684. var p2 = Util.applyTransform(r.slice(2, 4), m);
  685. var p3 = Util.applyTransform([
  686. r[0],
  687. r[3]
  688. ], m);
  689. var p4 = Util.applyTransform([
  690. r[2],
  691. r[1]
  692. ], m);
  693. return [
  694. Math.min(p1[0], p2[0], p3[0], p4[0]),
  695. Math.min(p1[1], p2[1], p3[1], p4[1]),
  696. Math.max(p1[0], p2[0], p3[0], p4[0]),
  697. Math.max(p1[1], p2[1], p3[1], p4[1])
  698. ];
  699. };
  700. Util.inverseTransform = function Util_inverseTransform(m) {
  701. var d = m[0] * m[3] - m[1] * m[2];
  702. return [
  703. m[3] / d,
  704. -m[1] / d,
  705. -m[2] / d,
  706. m[0] / d,
  707. (m[2] * m[5] - m[4] * m[3]) / d,
  708. (m[4] * m[1] - m[5] * m[0]) / d
  709. ];
  710. };
  711. Util.apply3dTransform = function Util_apply3dTransform(m, v) {
  712. return [
  713. m[0] * v[0] + m[1] * v[1] + m[2] * v[2],
  714. m[3] * v[0] + m[4] * v[1] + m[5] * v[2],
  715. m[6] * v[0] + m[7] * v[1] + m[8] * v[2]
  716. ];
  717. };
  718. Util.singularValueDecompose2dScale = function Util_singularValueDecompose2dScale(m) {
  719. var transpose = [
  720. m[0],
  721. m[2],
  722. m[1],
  723. m[3]
  724. ];
  725. var a = m[0] * transpose[0] + m[1] * transpose[2];
  726. var b = m[0] * transpose[1] + m[1] * transpose[3];
  727. var c = m[2] * transpose[0] + m[3] * transpose[2];
  728. var d = m[2] * transpose[1] + m[3] * transpose[3];
  729. var first = (a + d) / 2;
  730. var second = Math.sqrt((a + d) * (a + d) - 4 * (a * d - c * b)) / 2;
  731. var sx = first + second || 1;
  732. var sy = first - second || 1;
  733. return [
  734. Math.sqrt(sx),
  735. Math.sqrt(sy)
  736. ];
  737. };
  738. Util.normalizeRect = function Util_normalizeRect(rect) {
  739. var r = rect.slice(0);
  740. if (rect[0] > rect[2]) {
  741. r[0] = rect[2];
  742. r[2] = rect[0];
  743. }
  744. if (rect[1] > rect[3]) {
  745. r[1] = rect[3];
  746. r[3] = rect[1];
  747. }
  748. return r;
  749. };
  750. Util.intersect = function Util_intersect(rect1, rect2) {
  751. function compare(a, b) {
  752. return a - b;
  753. }
  754. var orderedX = [
  755. rect1[0],
  756. rect1[2],
  757. rect2[0],
  758. rect2[2]
  759. ].sort(compare), orderedY = [
  760. rect1[1],
  761. rect1[3],
  762. rect2[1],
  763. rect2[3]
  764. ].sort(compare), result = [];
  765. rect1 = Util.normalizeRect(rect1);
  766. rect2 = Util.normalizeRect(rect2);
  767. if (orderedX[0] === rect1[0] && orderedX[1] === rect2[0] || orderedX[0] === rect2[0] && orderedX[1] === rect1[0]) {
  768. result[0] = orderedX[1];
  769. result[2] = orderedX[2];
  770. } else {
  771. return false;
  772. }
  773. if (orderedY[0] === rect1[1] && orderedY[1] === rect2[1] || orderedY[0] === rect2[1] && orderedY[1] === rect1[1]) {
  774. result[1] = orderedY[1];
  775. result[3] = orderedY[2];
  776. } else {
  777. return false;
  778. }
  779. return result;
  780. };
  781. Util.sign = function Util_sign(num) {
  782. return num < 0 ? -1 : 1;
  783. };
  784. var ROMAN_NUMBER_MAP = [
  785. '',
  786. 'C',
  787. 'CC',
  788. 'CCC',
  789. 'CD',
  790. 'D',
  791. 'DC',
  792. 'DCC',
  793. 'DCCC',
  794. 'CM',
  795. '',
  796. 'X',
  797. 'XX',
  798. 'XXX',
  799. 'XL',
  800. 'L',
  801. 'LX',
  802. 'LXX',
  803. 'LXXX',
  804. 'XC',
  805. '',
  806. 'I',
  807. 'II',
  808. 'III',
  809. 'IV',
  810. 'V',
  811. 'VI',
  812. 'VII',
  813. 'VIII',
  814. 'IX'
  815. ];
  816. Util.toRoman = function Util_toRoman(number, lowerCase) {
  817. assert(isInt(number) && number > 0, 'The number should be a positive integer.');
  818. var pos, romanBuf = [];
  819. while (number >= 1000) {
  820. number -= 1000;
  821. romanBuf.push('M');
  822. }
  823. pos = number / 100 | 0;
  824. number %= 100;
  825. romanBuf.push(ROMAN_NUMBER_MAP[pos]);
  826. pos = number / 10 | 0;
  827. number %= 10;
  828. romanBuf.push(ROMAN_NUMBER_MAP[10 + pos]);
  829. romanBuf.push(ROMAN_NUMBER_MAP[20 + number]);
  830. var romanStr = romanBuf.join('');
  831. return lowerCase ? romanStr.toLowerCase() : romanStr;
  832. };
  833. Util.appendToArray = function Util_appendToArray(arr1, arr2) {
  834. Array.prototype.push.apply(arr1, arr2);
  835. };
  836. Util.prependToArray = function Util_prependToArray(arr1, arr2) {
  837. Array.prototype.unshift.apply(arr1, arr2);
  838. };
  839. Util.extendObj = function extendObj(obj1, obj2) {
  840. for (var key in obj2) {
  841. obj1[key] = obj2[key];
  842. }
  843. };
  844. Util.getInheritableProperty = function Util_getInheritableProperty(dict, name, getArray) {
  845. while (dict && !dict.has(name)) {
  846. dict = dict.get('Parent');
  847. }
  848. if (!dict) {
  849. return null;
  850. }
  851. return getArray ? dict.getArray(name) : dict.get(name);
  852. };
  853. Util.inherit = function Util_inherit(sub, base, prototype) {
  854. sub.prototype = Object.create(base.prototype);
  855. sub.prototype.constructor = sub;
  856. for (var prop in prototype) {
  857. sub.prototype[prop] = prototype[prop];
  858. }
  859. };
  860. Util.loadScript = function Util_loadScript(src, callback) {
  861. var script = document.createElement('script');
  862. var loaded = false;
  863. script.setAttribute('src', src);
  864. if (callback) {
  865. script.onload = function () {
  866. if (!loaded) {
  867. callback();
  868. }
  869. loaded = true;
  870. };
  871. }
  872. document.getElementsByTagName('head')[0].appendChild(script);
  873. };
  874. return Util;
  875. }();
  876. var PageViewport = function PageViewportClosure() {
  877. function PageViewport(viewBox, scale, rotation, offsetX, offsetY, dontFlip) {
  878. this.viewBox = viewBox;
  879. this.scale = scale;
  880. this.rotation = rotation;
  881. this.offsetX = offsetX;
  882. this.offsetY = offsetY;
  883. var centerX = (viewBox[2] + viewBox[0]) / 2;
  884. var centerY = (viewBox[3] + viewBox[1]) / 2;
  885. var rotateA, rotateB, rotateC, rotateD;
  886. rotation = rotation % 360;
  887. rotation = rotation < 0 ? rotation + 360 : rotation;
  888. switch (rotation) {
  889. case 180:
  890. rotateA = -1;
  891. rotateB = 0;
  892. rotateC = 0;
  893. rotateD = 1;
  894. break;
  895. case 90:
  896. rotateA = 0;
  897. rotateB = 1;
  898. rotateC = 1;
  899. rotateD = 0;
  900. break;
  901. case 270:
  902. rotateA = 0;
  903. rotateB = -1;
  904. rotateC = -1;
  905. rotateD = 0;
  906. break;
  907. default:
  908. rotateA = 1;
  909. rotateB = 0;
  910. rotateC = 0;
  911. rotateD = -1;
  912. break;
  913. }
  914. if (dontFlip) {
  915. rotateC = -rotateC;
  916. rotateD = -rotateD;
  917. }
  918. var offsetCanvasX, offsetCanvasY;
  919. var width, height;
  920. if (rotateA === 0) {
  921. offsetCanvasX = Math.abs(centerY - viewBox[1]) * scale + offsetX;
  922. offsetCanvasY = Math.abs(centerX - viewBox[0]) * scale + offsetY;
  923. width = Math.abs(viewBox[3] - viewBox[1]) * scale;
  924. height = Math.abs(viewBox[2] - viewBox[0]) * scale;
  925. } else {
  926. offsetCanvasX = Math.abs(centerX - viewBox[0]) * scale + offsetX;
  927. offsetCanvasY = Math.abs(centerY - viewBox[1]) * scale + offsetY;
  928. width = Math.abs(viewBox[2] - viewBox[0]) * scale;
  929. height = Math.abs(viewBox[3] - viewBox[1]) * scale;
  930. }
  931. this.transform = [
  932. rotateA * scale,
  933. rotateB * scale,
  934. rotateC * scale,
  935. rotateD * scale,
  936. offsetCanvasX - rotateA * scale * centerX - rotateC * scale * centerY,
  937. offsetCanvasY - rotateB * scale * centerX - rotateD * scale * centerY
  938. ];
  939. this.width = width;
  940. this.height = height;
  941. this.fontScale = scale;
  942. }
  943. PageViewport.prototype = {
  944. clone: function PageViewPort_clone(args) {
  945. args = args || {};
  946. var scale = 'scale' in args ? args.scale : this.scale;
  947. var rotation = 'rotation' in args ? args.rotation : this.rotation;
  948. return new PageViewport(this.viewBox.slice(), scale, rotation, this.offsetX, this.offsetY, args.dontFlip);
  949. },
  950. convertToViewportPoint: function PageViewport_convertToViewportPoint(x, y) {
  951. return Util.applyTransform([
  952. x,
  953. y
  954. ], this.transform);
  955. },
  956. convertToViewportRectangle: function PageViewport_convertToViewportRectangle(rect) {
  957. var tl = Util.applyTransform([
  958. rect[0],
  959. rect[1]
  960. ], this.transform);
  961. var br = Util.applyTransform([
  962. rect[2],
  963. rect[3]
  964. ], this.transform);
  965. return [
  966. tl[0],
  967. tl[1],
  968. br[0],
  969. br[1]
  970. ];
  971. },
  972. convertToPdfPoint: function PageViewport_convertToPdfPoint(x, y) {
  973. return Util.applyInverseTransform([
  974. x,
  975. y
  976. ], this.transform);
  977. }
  978. };
  979. return PageViewport;
  980. }();
  981. var PDFStringTranslateTable = [
  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. 0,
  1006. 0x2D8,
  1007. 0x2C7,
  1008. 0x2C6,
  1009. 0x2D9,
  1010. 0x2DD,
  1011. 0x2DB,
  1012. 0x2DA,
  1013. 0x2DC,
  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. 0,
  1110. 0x2022,
  1111. 0x2020,
  1112. 0x2021,
  1113. 0x2026,
  1114. 0x2014,
  1115. 0x2013,
  1116. 0x192,
  1117. 0x2044,
  1118. 0x2039,
  1119. 0x203A,
  1120. 0x2212,
  1121. 0x2030,
  1122. 0x201E,
  1123. 0x201C,
  1124. 0x201D,
  1125. 0x2018,
  1126. 0x2019,
  1127. 0x201A,
  1128. 0x2122,
  1129. 0xFB01,
  1130. 0xFB02,
  1131. 0x141,
  1132. 0x152,
  1133. 0x160,
  1134. 0x178,
  1135. 0x17D,
  1136. 0x131,
  1137. 0x142,
  1138. 0x153,
  1139. 0x161,
  1140. 0x17E,
  1141. 0,
  1142. 0x20AC
  1143. ];
  1144. function stringToPDFString(str) {
  1145. var i, n = str.length, strBuf = [];
  1146. if (str[0] === '\xFE' && str[1] === '\xFF') {
  1147. for (i = 2; i < n; i += 2) {
  1148. strBuf.push(String.fromCharCode(str.charCodeAt(i) << 8 | str.charCodeAt(i + 1)));
  1149. }
  1150. } else {
  1151. for (i = 0; i < n; ++i) {
  1152. var code = PDFStringTranslateTable[str.charCodeAt(i)];
  1153. strBuf.push(code ? String.fromCharCode(code) : str.charAt(i));
  1154. }
  1155. }
  1156. return strBuf.join('');
  1157. }
  1158. function stringToUTF8String(str) {
  1159. return decodeURIComponent(escape(str));
  1160. }
  1161. function utf8StringToString(str) {
  1162. return unescape(encodeURIComponent(str));
  1163. }
  1164. function isEmptyObj(obj) {
  1165. for (var key in obj) {
  1166. return false;
  1167. }
  1168. return true;
  1169. }
  1170. function isBool(v) {
  1171. return typeof v === 'boolean';
  1172. }
  1173. function isInt(v) {
  1174. return typeof v === 'number' && (v | 0) === v;
  1175. }
  1176. function isNum(v) {
  1177. return typeof v === 'number';
  1178. }
  1179. function isString(v) {
  1180. return typeof v === 'string';
  1181. }
  1182. function isArray(v) {
  1183. return v instanceof Array;
  1184. }
  1185. function isArrayBuffer(v) {
  1186. return typeof v === 'object' && v !== null && v.byteLength !== undefined;
  1187. }
  1188. function isSpace(ch) {
  1189. return ch === 0x20 || ch === 0x09 || ch === 0x0D || ch === 0x0A;
  1190. }
  1191. function isNodeJS() {
  1192. if (typeof __pdfjsdev_webpack__ === 'undefined') {
  1193. return typeof process === 'object' && process + '' === '[object process]';
  1194. }
  1195. return false;
  1196. }
  1197. function createPromiseCapability() {
  1198. var capability = {};
  1199. capability.promise = new Promise(function (resolve, reject) {
  1200. capability.resolve = resolve;
  1201. capability.reject = reject;
  1202. });
  1203. return capability;
  1204. }
  1205. var StatTimer = function StatTimerClosure() {
  1206. function rpad(str, pad, length) {
  1207. while (str.length < length) {
  1208. str += pad;
  1209. }
  1210. return str;
  1211. }
  1212. function StatTimer() {
  1213. this.started = Object.create(null);
  1214. this.times = [];
  1215. this.enabled = true;
  1216. }
  1217. StatTimer.prototype = {
  1218. time: function StatTimer_time(name) {
  1219. if (!this.enabled) {
  1220. return;
  1221. }
  1222. if (name in this.started) {
  1223. warn('Timer is already running for ' + name);
  1224. }
  1225. this.started[name] = Date.now();
  1226. },
  1227. timeEnd: function StatTimer_timeEnd(name) {
  1228. if (!this.enabled) {
  1229. return;
  1230. }
  1231. if (!(name in this.started)) {
  1232. warn('Timer has not been started for ' + name);
  1233. }
  1234. this.times.push({
  1235. 'name': name,
  1236. 'start': this.started[name],
  1237. 'end': Date.now()
  1238. });
  1239. delete this.started[name];
  1240. },
  1241. toString: function StatTimer_toString() {
  1242. var i, ii;
  1243. var times = this.times;
  1244. var out = '';
  1245. var longest = 0;
  1246. for (i = 0, ii = times.length; i < ii; ++i) {
  1247. var name = times[i]['name'];
  1248. if (name.length > longest) {
  1249. longest = name.length;
  1250. }
  1251. }
  1252. for (i = 0, ii = times.length; i < ii; ++i) {
  1253. var span = times[i];
  1254. var duration = span.end - span.start;
  1255. out += rpad(span['name'], ' ', longest) + ' ' + duration + 'ms\n';
  1256. }
  1257. return out;
  1258. }
  1259. };
  1260. return StatTimer;
  1261. }();
  1262. var createBlob = function createBlob(data, contentType) {
  1263. if (typeof Blob !== 'undefined') {
  1264. return new Blob([data], { type: contentType });
  1265. }
  1266. warn('The "Blob" constructor is not supported.');
  1267. };
  1268. var createObjectURL = function createObjectURLClosure() {
  1269. var digits = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=';
  1270. return function createObjectURL(data, contentType, forceDataSchema) {
  1271. if (!forceDataSchema && typeof URL !== 'undefined' && URL.createObjectURL) {
  1272. var blob = createBlob(data, contentType);
  1273. return URL.createObjectURL(blob);
  1274. }
  1275. var buffer = 'data:' + contentType + ';base64,';
  1276. for (var i = 0, ii = data.length; i < ii; i += 3) {
  1277. var b1 = data[i] & 0xFF;
  1278. var b2 = data[i + 1] & 0xFF;
  1279. var b3 = data[i + 2] & 0xFF;
  1280. var d1 = b1 >> 2, d2 = (b1 & 3) << 4 | b2 >> 4;
  1281. var d3 = i + 1 < ii ? (b2 & 0xF) << 2 | b3 >> 6 : 64;
  1282. var d4 = i + 2 < ii ? b3 & 0x3F : 64;
  1283. buffer += digits[d1] + digits[d2] + digits[d3] + digits[d4];
  1284. }
  1285. return buffer;
  1286. };
  1287. }();
  1288. function MessageHandler(sourceName, targetName, comObj) {
  1289. this.sourceName = sourceName;
  1290. this.targetName = targetName;
  1291. this.comObj = comObj;
  1292. this.callbackIndex = 1;
  1293. this.postMessageTransfers = true;
  1294. var callbacksCapabilities = this.callbacksCapabilities = Object.create(null);
  1295. var ah = this.actionHandler = Object.create(null);
  1296. this._onComObjOnMessage = function messageHandlerComObjOnMessage(event) {
  1297. var data = event.data;
  1298. if (data.targetName !== this.sourceName) {
  1299. return;
  1300. }
  1301. if (data.isReply) {
  1302. var callbackId = data.callbackId;
  1303. if (data.callbackId in callbacksCapabilities) {
  1304. var callback = callbacksCapabilities[callbackId];
  1305. delete callbacksCapabilities[callbackId];
  1306. if ('error' in data) {
  1307. callback.reject(data.error);
  1308. } else {
  1309. callback.resolve(data.data);
  1310. }
  1311. } else {
  1312. error('Cannot resolve callback ' + callbackId);
  1313. }
  1314. } else if (data.action in ah) {
  1315. var action = ah[data.action];
  1316. if (data.callbackId) {
  1317. var sourceName = this.sourceName;
  1318. var targetName = data.sourceName;
  1319. Promise.resolve().then(function () {
  1320. return action[0].call(action[1], data.data);
  1321. }).then(function (result) {
  1322. comObj.postMessage({
  1323. sourceName: sourceName,
  1324. targetName: targetName,
  1325. isReply: true,
  1326. callbackId: data.callbackId,
  1327. data: result
  1328. });
  1329. }, function (reason) {
  1330. if (reason instanceof Error) {
  1331. reason = reason + '';
  1332. }
  1333. comObj.postMessage({
  1334. sourceName: sourceName,
  1335. targetName: targetName,
  1336. isReply: true,
  1337. callbackId: data.callbackId,
  1338. error: reason
  1339. });
  1340. });
  1341. } else {
  1342. action[0].call(action[1], data.data);
  1343. }
  1344. } else {
  1345. error('Unknown action from worker: ' + data.action);
  1346. }
  1347. }.bind(this);
  1348. comObj.addEventListener('message', this._onComObjOnMessage);
  1349. }
  1350. MessageHandler.prototype = {
  1351. on: function messageHandlerOn(actionName, handler, scope) {
  1352. var ah = this.actionHandler;
  1353. if (ah[actionName]) {
  1354. error('There is already an actionName called "' + actionName + '"');
  1355. }
  1356. ah[actionName] = [
  1357. handler,
  1358. scope
  1359. ];
  1360. },
  1361. send: function messageHandlerSend(actionName, data, transfers) {
  1362. var message = {
  1363. sourceName: this.sourceName,
  1364. targetName: this.targetName,
  1365. action: actionName,
  1366. data: data
  1367. };
  1368. this.postMessage(message, transfers);
  1369. },
  1370. sendWithPromise: function messageHandlerSendWithPromise(actionName, data, transfers) {
  1371. var callbackId = this.callbackIndex++;
  1372. var message = {
  1373. sourceName: this.sourceName,
  1374. targetName: this.targetName,
  1375. action: actionName,
  1376. data: data,
  1377. callbackId: callbackId
  1378. };
  1379. var capability = createPromiseCapability();
  1380. this.callbacksCapabilities[callbackId] = capability;
  1381. try {
  1382. this.postMessage(message, transfers);
  1383. } catch (e) {
  1384. capability.reject(e);
  1385. }
  1386. return capability.promise;
  1387. },
  1388. postMessage: function (message, transfers) {
  1389. if (transfers && this.postMessageTransfers) {
  1390. this.comObj.postMessage(message, transfers);
  1391. } else {
  1392. this.comObj.postMessage(message);
  1393. }
  1394. },
  1395. destroy: function () {
  1396. this.comObj.removeEventListener('message', this._onComObjOnMessage);
  1397. }
  1398. };
  1399. function loadJpegStream(id, imageUrl, objs) {
  1400. var img = new Image();
  1401. img.onload = function loadJpegStream_onloadClosure() {
  1402. objs.resolve(id, img);
  1403. };
  1404. img.onerror = function loadJpegStream_onerrorClosure() {
  1405. objs.resolve(id, null);
  1406. warn('Error during JPEG image loading');
  1407. };
  1408. img.src = imageUrl;
  1409. }
  1410. exports.FONT_IDENTITY_MATRIX = FONT_IDENTITY_MATRIX;
  1411. exports.IDENTITY_MATRIX = IDENTITY_MATRIX;
  1412. exports.OPS = OPS;
  1413. exports.VERBOSITY_LEVELS = VERBOSITY_LEVELS;
  1414. exports.UNSUPPORTED_FEATURES = UNSUPPORTED_FEATURES;
  1415. exports.AnnotationBorderStyleType = AnnotationBorderStyleType;
  1416. exports.AnnotationFieldFlag = AnnotationFieldFlag;
  1417. exports.AnnotationFlag = AnnotationFlag;
  1418. exports.AnnotationType = AnnotationType;
  1419. exports.FontType = FontType;
  1420. exports.ImageKind = ImageKind;
  1421. exports.CMapCompressionType = CMapCompressionType;
  1422. exports.InvalidPDFException = InvalidPDFException;
  1423. exports.MessageHandler = MessageHandler;
  1424. exports.MissingDataException = MissingDataException;
  1425. exports.MissingPDFException = MissingPDFException;
  1426. exports.NotImplementedException = NotImplementedException;
  1427. exports.PageViewport = PageViewport;
  1428. exports.PasswordException = PasswordException;
  1429. exports.PasswordResponses = PasswordResponses;
  1430. exports.StatTimer = StatTimer;
  1431. exports.StreamType = StreamType;
  1432. exports.TextRenderingMode = TextRenderingMode;
  1433. exports.UnexpectedResponseException = UnexpectedResponseException;
  1434. exports.UnknownErrorException = UnknownErrorException;
  1435. exports.Util = Util;
  1436. exports.XRefParseException = XRefParseException;
  1437. exports.arrayByteLength = arrayByteLength;
  1438. exports.arraysToBytes = arraysToBytes;
  1439. exports.assert = assert;
  1440. exports.bytesToString = bytesToString;
  1441. exports.createBlob = createBlob;
  1442. exports.createPromiseCapability = createPromiseCapability;
  1443. exports.createObjectURL = createObjectURL;
  1444. exports.deprecated = deprecated;
  1445. exports.error = error;
  1446. exports.getLookupTableFactory = getLookupTableFactory;
  1447. exports.getVerbosityLevel = getVerbosityLevel;
  1448. exports.globalScope = globalScope;
  1449. exports.info = info;
  1450. exports.isArray = isArray;
  1451. exports.isArrayBuffer = isArrayBuffer;
  1452. exports.isBool = isBool;
  1453. exports.isEmptyObj = isEmptyObj;
  1454. exports.isInt = isInt;
  1455. exports.isNum = isNum;
  1456. exports.isString = isString;
  1457. exports.isSpace = isSpace;
  1458. exports.isNodeJS = isNodeJS;
  1459. exports.isSameOrigin = isSameOrigin;
  1460. exports.createValidAbsoluteUrl = createValidAbsoluteUrl;
  1461. exports.isLittleEndian = isLittleEndian;
  1462. exports.isEvalSupported = isEvalSupported;
  1463. exports.loadJpegStream = loadJpegStream;
  1464. exports.log2 = log2;
  1465. exports.readInt8 = readInt8;
  1466. exports.readUint16 = readUint16;
  1467. exports.readUint32 = readUint32;
  1468. exports.removeNullCharacters = removeNullCharacters;
  1469. exports.setVerbosityLevel = setVerbosityLevel;
  1470. exports.shadow = shadow;
  1471. exports.string32 = string32;
  1472. exports.stringToBytes = stringToBytes;
  1473. exports.stringToPDFString = stringToPDFString;
  1474. exports.stringToUTF8String = stringToUTF8String;
  1475. exports.utf8StringToString = utf8StringToString;
  1476. exports.warn = warn;
  1477. /* WEBPACK VAR INJECTION */}.call(exports, __w_pdfjs_require__(9)))
  1478. /***/ }),
  1479. /* 1 */
  1480. /***/ (function(module, exports, __w_pdfjs_require__) {
  1481. "use strict";
  1482. var sharedUtil = __w_pdfjs_require__(0);
  1483. var isArray = sharedUtil.isArray;
  1484. var EOF = {};
  1485. var Name = function NameClosure() {
  1486. function Name(name) {
  1487. this.name = name;
  1488. }
  1489. Name.prototype = {};
  1490. var nameCache = Object.create(null);
  1491. Name.get = function Name_get(name) {
  1492. var nameValue = nameCache[name];
  1493. return nameValue ? nameValue : nameCache[name] = new Name(name);
  1494. };
  1495. return Name;
  1496. }();
  1497. var Cmd = function CmdClosure() {
  1498. function Cmd(cmd) {
  1499. this.cmd = cmd;
  1500. }
  1501. Cmd.prototype = {};
  1502. var cmdCache = Object.create(null);
  1503. Cmd.get = function Cmd_get(cmd) {
  1504. var cmdValue = cmdCache[cmd];
  1505. return cmdValue ? cmdValue : cmdCache[cmd] = new Cmd(cmd);
  1506. };
  1507. return Cmd;
  1508. }();
  1509. var Dict = function DictClosure() {
  1510. var nonSerializable = function nonSerializableClosure() {
  1511. return nonSerializable;
  1512. };
  1513. function Dict(xref) {
  1514. this.map = Object.create(null);
  1515. this.xref = xref;
  1516. this.objId = null;
  1517. this.suppressEncryption = false;
  1518. this.__nonSerializable__ = nonSerializable;
  1519. }
  1520. Dict.prototype = {
  1521. assignXref: function Dict_assignXref(newXref) {
  1522. this.xref = newXref;
  1523. },
  1524. get: function Dict_get(key1, key2, key3) {
  1525. var value;
  1526. var xref = this.xref, suppressEncryption = this.suppressEncryption;
  1527. if (typeof (value = this.map[key1]) !== 'undefined' || key1 in this.map || typeof key2 === 'undefined') {
  1528. return xref ? xref.fetchIfRef(value, suppressEncryption) : value;
  1529. }
  1530. if (typeof (value = this.map[key2]) !== 'undefined' || key2 in this.map || typeof key3 === 'undefined') {
  1531. return xref ? xref.fetchIfRef(value, suppressEncryption) : value;
  1532. }
  1533. value = this.map[key3] || null;
  1534. return xref ? xref.fetchIfRef(value, suppressEncryption) : value;
  1535. },
  1536. getAsync: function Dict_getAsync(key1, key2, key3) {
  1537. var value;
  1538. var xref = this.xref, suppressEncryption = this.suppressEncryption;
  1539. if (typeof (value = this.map[key1]) !== 'undefined' || key1 in this.map || typeof key2 === 'undefined') {
  1540. if (xref) {
  1541. return xref.fetchIfRefAsync(value, suppressEncryption);
  1542. }
  1543. return Promise.resolve(value);
  1544. }
  1545. if (typeof (value = this.map[key2]) !== 'undefined' || key2 in this.map || typeof key3 === 'undefined') {
  1546. if (xref) {
  1547. return xref.fetchIfRefAsync(value, suppressEncryption);
  1548. }
  1549. return Promise.resolve(value);
  1550. }
  1551. value = this.map[key3] || null;
  1552. if (xref) {
  1553. return xref.fetchIfRefAsync(value, suppressEncryption);
  1554. }
  1555. return Promise.resolve(value);
  1556. },
  1557. getArray: function Dict_getArray(key1, key2, key3) {
  1558. var value = this.get(key1, key2, key3);
  1559. var xref = this.xref, suppressEncryption = this.suppressEncryption;
  1560. if (!isArray(value) || !xref) {
  1561. return value;
  1562. }
  1563. value = value.slice();
  1564. for (var i = 0, ii = value.length; i < ii; i++) {
  1565. if (!isRef(value[i])) {
  1566. continue;
  1567. }
  1568. value[i] = xref.fetch(value[i], suppressEncryption);
  1569. }
  1570. return value;
  1571. },
  1572. getRaw: function Dict_getRaw(key) {
  1573. return this.map[key];
  1574. },
  1575. getKeys: function Dict_getKeys() {
  1576. return Object.keys(this.map);
  1577. },
  1578. set: function Dict_set(key, value) {
  1579. this.map[key] = value;
  1580. },
  1581. has: function Dict_has(key) {
  1582. return key in this.map;
  1583. },
  1584. forEach: function Dict_forEach(callback) {
  1585. for (var key in this.map) {
  1586. callback(key, this.get(key));
  1587. }
  1588. }
  1589. };
  1590. Dict.empty = new Dict(null);
  1591. Dict.merge = function Dict_merge(xref, dictArray) {
  1592. var mergedDict = new Dict(xref);
  1593. for (var i = 0, ii = dictArray.length; i < ii; i++) {
  1594. var dict = dictArray[i];
  1595. if (!isDict(dict)) {
  1596. continue;
  1597. }
  1598. for (var keyName in dict.map) {
  1599. if (mergedDict.map[keyName]) {
  1600. continue;
  1601. }
  1602. mergedDict.map[keyName] = dict.map[keyName];
  1603. }
  1604. }
  1605. return mergedDict;
  1606. };
  1607. return Dict;
  1608. }();
  1609. var Ref = function RefClosure() {
  1610. function Ref(num, gen) {
  1611. this.num = num;
  1612. this.gen = gen;
  1613. }
  1614. Ref.prototype = {
  1615. toString: function Ref_toString() {
  1616. var str = this.num + 'R';
  1617. if (this.gen !== 0) {
  1618. str += this.gen;
  1619. }
  1620. return str;
  1621. }
  1622. };
  1623. return Ref;
  1624. }();
  1625. var RefSet = function RefSetClosure() {
  1626. function RefSet() {
  1627. this.dict = Object.create(null);
  1628. }
  1629. RefSet.prototype = {
  1630. has: function RefSet_has(ref) {
  1631. return ref.toString() in this.dict;
  1632. },
  1633. put: function RefSet_put(ref) {
  1634. this.dict[ref.toString()] = true;
  1635. },
  1636. remove: function RefSet_remove(ref) {
  1637. delete this.dict[ref.toString()];
  1638. }
  1639. };
  1640. return RefSet;
  1641. }();
  1642. var RefSetCache = function RefSetCacheClosure() {
  1643. function RefSetCache() {
  1644. this.dict = Object.create(null);
  1645. }
  1646. RefSetCache.prototype = {
  1647. get: function RefSetCache_get(ref) {
  1648. return this.dict[ref.toString()];
  1649. },
  1650. has: function RefSetCache_has(ref) {
  1651. return ref.toString() in this.dict;
  1652. },
  1653. put: function RefSetCache_put(ref, obj) {
  1654. this.dict[ref.toString()] = obj;
  1655. },
  1656. putAlias: function RefSetCache_putAlias(ref, aliasRef) {
  1657. this.dict[ref.toString()] = this.get(aliasRef);
  1658. },
  1659. forEach: function RefSetCache_forEach(fn, thisArg) {
  1660. for (var i in this.dict) {
  1661. fn.call(thisArg, this.dict[i]);
  1662. }
  1663. },
  1664. clear: function RefSetCache_clear() {
  1665. this.dict = Object.create(null);
  1666. }
  1667. };
  1668. return RefSetCache;
  1669. }();
  1670. function isEOF(v) {
  1671. return v === EOF;
  1672. }
  1673. function isName(v, name) {
  1674. return v instanceof Name && (name === undefined || v.name === name);
  1675. }
  1676. function isCmd(v, cmd) {
  1677. return v instanceof Cmd && (cmd === undefined || v.cmd === cmd);
  1678. }
  1679. function isDict(v, type) {
  1680. return v instanceof Dict && (type === undefined || isName(v.get('Type'), type));
  1681. }
  1682. function isRef(v) {
  1683. return v instanceof Ref;
  1684. }
  1685. function isRefsEqual(v1, v2) {
  1686. return v1.num === v2.num && v1.gen === v2.gen;
  1687. }
  1688. function isStream(v) {
  1689. return typeof v === 'object' && v !== null && v.getBytes !== undefined;
  1690. }
  1691. exports.EOF = EOF;
  1692. exports.Cmd = Cmd;
  1693. exports.Dict = Dict;
  1694. exports.Name = Name;
  1695. exports.Ref = Ref;
  1696. exports.RefSet = RefSet;
  1697. exports.RefSetCache = RefSetCache;
  1698. exports.isEOF = isEOF;
  1699. exports.isCmd = isCmd;
  1700. exports.isDict = isDict;
  1701. exports.isName = isName;
  1702. exports.isRef = isRef;
  1703. exports.isRefsEqual = isRefsEqual;
  1704. exports.isStream = isStream;
  1705. /***/ }),
  1706. /* 2 */
  1707. /***/ (function(module, exports, __w_pdfjs_require__) {
  1708. "use strict";
  1709. var sharedUtil = __w_pdfjs_require__(0);
  1710. var corePrimitives = __w_pdfjs_require__(1);
  1711. var coreJbig2 = __w_pdfjs_require__(28);
  1712. var coreJpg = __w_pdfjs_require__(29);
  1713. var coreJpx = __w_pdfjs_require__(15);
  1714. var Util = sharedUtil.Util;
  1715. var error = sharedUtil.error;
  1716. var info = sharedUtil.info;
  1717. var isInt = sharedUtil.isInt;
  1718. var isArray = sharedUtil.isArray;
  1719. var createObjectURL = sharedUtil.createObjectURL;
  1720. var shadow = sharedUtil.shadow;
  1721. var isSpace = sharedUtil.isSpace;
  1722. var Dict = corePrimitives.Dict;
  1723. var isDict = corePrimitives.isDict;
  1724. var isStream = corePrimitives.isStream;
  1725. var Jbig2Image = coreJbig2.Jbig2Image;
  1726. var JpegImage = coreJpg.JpegImage;
  1727. var JpxImage = coreJpx.JpxImage;
  1728. var Stream = function StreamClosure() {
  1729. function Stream(arrayBuffer, start, length, dict) {
  1730. this.bytes = arrayBuffer instanceof Uint8Array ? arrayBuffer : new Uint8Array(arrayBuffer);
  1731. this.start = start || 0;
  1732. this.pos = this.start;
  1733. this.end = start + length || this.bytes.length;
  1734. this.dict = dict;
  1735. }
  1736. Stream.prototype = {
  1737. get length() {
  1738. return this.end - this.start;
  1739. },
  1740. get isEmpty() {
  1741. return this.length === 0;
  1742. },
  1743. getByte: function Stream_getByte() {
  1744. if (this.pos >= this.end) {
  1745. return -1;
  1746. }
  1747. return this.bytes[this.pos++];
  1748. },
  1749. getUint16: function Stream_getUint16() {
  1750. var b0 = this.getByte();
  1751. var b1 = this.getByte();
  1752. if (b0 === -1 || b1 === -1) {
  1753. return -1;
  1754. }
  1755. return (b0 << 8) + b1;
  1756. },
  1757. getInt32: function Stream_getInt32() {
  1758. var b0 = this.getByte();
  1759. var b1 = this.getByte();
  1760. var b2 = this.getByte();
  1761. var b3 = this.getByte();
  1762. return (b0 << 24) + (b1 << 16) + (b2 << 8) + b3;
  1763. },
  1764. getBytes: function Stream_getBytes(length) {
  1765. var bytes = this.bytes;
  1766. var pos = this.pos;
  1767. var strEnd = this.end;
  1768. if (!length) {
  1769. return bytes.subarray(pos, strEnd);
  1770. }
  1771. var end = pos + length;
  1772. if (end > strEnd) {
  1773. end = strEnd;
  1774. }
  1775. this.pos = end;
  1776. return bytes.subarray(pos, end);
  1777. },
  1778. peekByte: function Stream_peekByte() {
  1779. var peekedByte = this.getByte();
  1780. this.pos--;
  1781. return peekedByte;
  1782. },
  1783. peekBytes: function Stream_peekBytes(length) {
  1784. var bytes = this.getBytes(length);
  1785. this.pos -= bytes.length;
  1786. return bytes;
  1787. },
  1788. skip: function Stream_skip(n) {
  1789. if (!n) {
  1790. n = 1;
  1791. }
  1792. this.pos += n;
  1793. },
  1794. reset: function Stream_reset() {
  1795. this.pos = this.start;
  1796. },
  1797. moveStart: function Stream_moveStart() {
  1798. this.start = this.pos;
  1799. },
  1800. makeSubStream: function Stream_makeSubStream(start, length, dict) {
  1801. return new Stream(this.bytes.buffer, start, length, dict);
  1802. }
  1803. };
  1804. return Stream;
  1805. }();
  1806. var StringStream = function StringStreamClosure() {
  1807. function StringStream(str) {
  1808. var length = str.length;
  1809. var bytes = new Uint8Array(length);
  1810. for (var n = 0; n < length; ++n) {
  1811. bytes[n] = str.charCodeAt(n);
  1812. }
  1813. Stream.call(this, bytes);
  1814. }
  1815. StringStream.prototype = Stream.prototype;
  1816. return StringStream;
  1817. }();
  1818. var DecodeStream = function DecodeStreamClosure() {
  1819. var emptyBuffer = new Uint8Array(0);
  1820. function DecodeStream(maybeMinBufferLength) {
  1821. this.pos = 0;
  1822. this.bufferLength = 0;
  1823. this.eof = false;
  1824. this.buffer = emptyBuffer;
  1825. this.minBufferLength = 512;
  1826. if (maybeMinBufferLength) {
  1827. while (this.minBufferLength < maybeMinBufferLength) {
  1828. this.minBufferLength *= 2;
  1829. }
  1830. }
  1831. }
  1832. DecodeStream.prototype = {
  1833. get isEmpty() {
  1834. while (!this.eof && this.bufferLength === 0) {
  1835. this.readBlock();
  1836. }
  1837. return this.bufferLength === 0;
  1838. },
  1839. ensureBuffer: function DecodeStream_ensureBuffer(requested) {
  1840. var buffer = this.buffer;
  1841. if (requested <= buffer.byteLength) {
  1842. return buffer;
  1843. }
  1844. var size = this.minBufferLength;
  1845. while (size < requested) {
  1846. size *= 2;
  1847. }
  1848. var buffer2 = new Uint8Array(size);
  1849. buffer2.set(buffer);
  1850. return this.buffer = buffer2;
  1851. },
  1852. getByte: function DecodeStream_getByte() {
  1853. var pos = this.pos;
  1854. while (this.bufferLength <= pos) {
  1855. if (this.eof) {
  1856. return -1;
  1857. }
  1858. this.readBlock();
  1859. }
  1860. return this.buffer[this.pos++];
  1861. },
  1862. getUint16: function DecodeStream_getUint16() {
  1863. var b0 = this.getByte();
  1864. var b1 = this.getByte();
  1865. if (b0 === -1 || b1 === -1) {
  1866. return -1;
  1867. }
  1868. return (b0 << 8) + b1;
  1869. },
  1870. getInt32: function DecodeStream_getInt32() {
  1871. var b0 = this.getByte();
  1872. var b1 = this.getByte();
  1873. var b2 = this.getByte();
  1874. var b3 = this.getByte();
  1875. return (b0 << 24) + (b1 << 16) + (b2 << 8) + b3;
  1876. },
  1877. getBytes: function DecodeStream_getBytes(length) {
  1878. var end, pos = this.pos;
  1879. if (length) {
  1880. this.ensureBuffer(pos + length);
  1881. end = pos + length;
  1882. while (!this.eof && this.bufferLength < end) {
  1883. this.readBlock();
  1884. }
  1885. var bufEnd = this.bufferLength;
  1886. if (end > bufEnd) {
  1887. end = bufEnd;
  1888. }
  1889. } else {
  1890. while (!this.eof) {
  1891. this.readBlock();
  1892. }
  1893. end = this.bufferLength;
  1894. }
  1895. this.pos = end;
  1896. return this.buffer.subarray(pos, end);
  1897. },
  1898. peekByte: function DecodeStream_peekByte() {
  1899. var peekedByte = this.getByte();
  1900. this.pos--;
  1901. return peekedByte;
  1902. },
  1903. peekBytes: function DecodeStream_peekBytes(length) {
  1904. var bytes = this.getBytes(length);
  1905. this.pos -= bytes.length;
  1906. return bytes;
  1907. },
  1908. makeSubStream: function DecodeStream_makeSubStream(start, length, dict) {
  1909. var end = start + length;
  1910. while (this.bufferLength <= end && !this.eof) {
  1911. this.readBlock();
  1912. }
  1913. return new Stream(this.buffer, start, length, dict);
  1914. },
  1915. skip: function DecodeStream_skip(n) {
  1916. if (!n) {
  1917. n = 1;
  1918. }
  1919. this.pos += n;
  1920. },
  1921. reset: function DecodeStream_reset() {
  1922. this.pos = 0;
  1923. },
  1924. getBaseStreams: function DecodeStream_getBaseStreams() {
  1925. if (this.str && this.str.getBaseStreams) {
  1926. return this.str.getBaseStreams();
  1927. }
  1928. return [];
  1929. }
  1930. };
  1931. return DecodeStream;
  1932. }();
  1933. var StreamsSequenceStream = function StreamsSequenceStreamClosure() {
  1934. function StreamsSequenceStream(streams) {
  1935. this.streams = streams;
  1936. DecodeStream.call(this, null);
  1937. }
  1938. StreamsSequenceStream.prototype = Object.create(DecodeStream.prototype);
  1939. StreamsSequenceStream.prototype.readBlock = function streamSequenceStreamReadBlock() {
  1940. var streams = this.streams;
  1941. if (streams.length === 0) {
  1942. this.eof = true;
  1943. return;
  1944. }
  1945. var stream = streams.shift();
  1946. var chunk = stream.getBytes();
  1947. var bufferLength = this.bufferLength;
  1948. var newLength = bufferLength + chunk.length;
  1949. var buffer = this.ensureBuffer(newLength);
  1950. buffer.set(chunk, bufferLength);
  1951. this.bufferLength = newLength;
  1952. };
  1953. StreamsSequenceStream.prototype.getBaseStreams = function StreamsSequenceStream_getBaseStreams() {
  1954. var baseStreams = [];
  1955. for (var i = 0, ii = this.streams.length; i < ii; i++) {
  1956. var stream = this.streams[i];
  1957. if (stream.getBaseStreams) {
  1958. Util.appendToArray(baseStreams, stream.getBaseStreams());
  1959. }
  1960. }
  1961. return baseStreams;
  1962. };
  1963. return StreamsSequenceStream;
  1964. }();
  1965. var FlateStream = function FlateStreamClosure() {
  1966. var codeLenCodeMap = new Int32Array([
  1967. 16,
  1968. 17,
  1969. 18,
  1970. 0,
  1971. 8,
  1972. 7,
  1973. 9,
  1974. 6,
  1975. 10,
  1976. 5,
  1977. 11,
  1978. 4,
  1979. 12,
  1980. 3,
  1981. 13,
  1982. 2,
  1983. 14,
  1984. 1,
  1985. 15
  1986. ]);
  1987. var lengthDecode = new Int32Array([
  1988. 0x00003,
  1989. 0x00004,
  1990. 0x00005,
  1991. 0x00006,
  1992. 0x00007,
  1993. 0x00008,
  1994. 0x00009,
  1995. 0x0000a,
  1996. 0x1000b,
  1997. 0x1000d,
  1998. 0x1000f,
  1999. 0x10011,
  2000. 0x20013,
  2001. 0x20017,
  2002. 0x2001b,
  2003. 0x2001f,
  2004. 0x30023,
  2005. 0x3002b,
  2006. 0x30033,
  2007. 0x3003b,
  2008. 0x40043,
  2009. 0x40053,
  2010. 0x40063,
  2011. 0x40073,
  2012. 0x50083,
  2013. 0x500a3,
  2014. 0x500c3,
  2015. 0x500e3,
  2016. 0x00102,
  2017. 0x00102,
  2018. 0x00102
  2019. ]);
  2020. var distDecode = new Int32Array([
  2021. 0x00001,
  2022. 0x00002,
  2023. 0x00003,
  2024. 0x00004,
  2025. 0x10005,
  2026. 0x10007,
  2027. 0x20009,
  2028. 0x2000d,
  2029. 0x30011,
  2030. 0x30019,
  2031. 0x40021,
  2032. 0x40031,
  2033. 0x50041,
  2034. 0x50061,
  2035. 0x60081,
  2036. 0x600c1,
  2037. 0x70101,
  2038. 0x70181,
  2039. 0x80201,
  2040. 0x80301,
  2041. 0x90401,
  2042. 0x90601,
  2043. 0xa0801,
  2044. 0xa0c01,
  2045. 0xb1001,
  2046. 0xb1801,
  2047. 0xc2001,
  2048. 0xc3001,
  2049. 0xd4001,
  2050. 0xd6001
  2051. ]);
  2052. var fixedLitCodeTab = [
  2053. new Int32Array([
  2054. 0x70100,
  2055. 0x80050,
  2056. 0x80010,
  2057. 0x80118,
  2058. 0x70110,
  2059. 0x80070,
  2060. 0x80030,
  2061. 0x900c0,
  2062. 0x70108,
  2063. 0x80060,
  2064. 0x80020,
  2065. 0x900a0,
  2066. 0x80000,
  2067. 0x80080,
  2068. 0x80040,
  2069. 0x900e0,
  2070. 0x70104,
  2071. 0x80058,
  2072. 0x80018,
  2073. 0x90090,
  2074. 0x70114,
  2075. 0x80078,
  2076. 0x80038,
  2077. 0x900d0,
  2078. 0x7010c,
  2079. 0x80068,
  2080. 0x80028,
  2081. 0x900b0,
  2082. 0x80008,
  2083. 0x80088,
  2084. 0x80048,
  2085. 0x900f0,
  2086. 0x70102,
  2087. 0x80054,
  2088. 0x80014,
  2089. 0x8011c,
  2090. 0x70112,
  2091. 0x80074,
  2092. 0x80034,
  2093. 0x900c8,
  2094. 0x7010a,
  2095. 0x80064,
  2096. 0x80024,
  2097. 0x900a8,
  2098. 0x80004,
  2099. 0x80084,
  2100. 0x80044,
  2101. 0x900e8,
  2102. 0x70106,
  2103. 0x8005c,
  2104. 0x8001c,
  2105. 0x90098,
  2106. 0x70116,
  2107. 0x8007c,
  2108. 0x8003c,
  2109. 0x900d8,
  2110. 0x7010e,
  2111. 0x8006c,
  2112. 0x8002c,
  2113. 0x900b8,
  2114. 0x8000c,
  2115. 0x8008c,
  2116. 0x8004c,
  2117. 0x900f8,
  2118. 0x70101,
  2119. 0x80052,
  2120. 0x80012,
  2121. 0x8011a,
  2122. 0x70111,
  2123. 0x80072,
  2124. 0x80032,
  2125. 0x900c4,
  2126. 0x70109,
  2127. 0x80062,
  2128. 0x80022,
  2129. 0x900a4,
  2130. 0x80002,
  2131. 0x80082,
  2132. 0x80042,
  2133. 0x900e4,
  2134. 0x70105,
  2135. 0x8005a,
  2136. 0x8001a,
  2137. 0x90094,
  2138. 0x70115,
  2139. 0x8007a,
  2140. 0x8003a,
  2141. 0x900d4,
  2142. 0x7010d,
  2143. 0x8006a,
  2144. 0x8002a,
  2145. 0x900b4,
  2146. 0x8000a,
  2147. 0x8008a,
  2148. 0x8004a,
  2149. 0x900f4,
  2150. 0x70103,
  2151. 0x80056,
  2152. 0x80016,
  2153. 0x8011e,
  2154. 0x70113,
  2155. 0x80076,
  2156. 0x80036,
  2157. 0x900cc,
  2158. 0x7010b,
  2159. 0x80066,
  2160. 0x80026,
  2161. 0x900ac,
  2162. 0x80006,
  2163. 0x80086,
  2164. 0x80046,
  2165. 0x900ec,
  2166. 0x70107,
  2167. 0x8005e,
  2168. 0x8001e,
  2169. 0x9009c,
  2170. 0x70117,
  2171. 0x8007e,
  2172. 0x8003e,
  2173. 0x900dc,
  2174. 0x7010f,
  2175. 0x8006e,
  2176. 0x8002e,
  2177. 0x900bc,
  2178. 0x8000e,
  2179. 0x8008e,
  2180. 0x8004e,
  2181. 0x900fc,
  2182. 0x70100,
  2183. 0x80051,
  2184. 0x80011,
  2185. 0x80119,
  2186. 0x70110,
  2187. 0x80071,
  2188. 0x80031,
  2189. 0x900c2,
  2190. 0x70108,
  2191. 0x80061,
  2192. 0x80021,
  2193. 0x900a2,
  2194. 0x80001,
  2195. 0x80081,
  2196. 0x80041,
  2197. 0x900e2,
  2198. 0x70104,
  2199. 0x80059,
  2200. 0x80019,
  2201. 0x90092,
  2202. 0x70114,
  2203. 0x80079,
  2204. 0x80039,
  2205. 0x900d2,
  2206. 0x7010c,
  2207. 0x80069,
  2208. 0x80029,
  2209. 0x900b2,
  2210. 0x80009,
  2211. 0x80089,
  2212. 0x80049,
  2213. 0x900f2,
  2214. 0x70102,
  2215. 0x80055,
  2216. 0x80015,
  2217. 0x8011d,
  2218. 0x70112,
  2219. 0x80075,
  2220. 0x80035,
  2221. 0x900ca,
  2222. 0x7010a,
  2223. 0x80065,
  2224. 0x80025,
  2225. 0x900aa,
  2226. 0x80005,
  2227. 0x80085,
  2228. 0x80045,
  2229. 0x900ea,
  2230. 0x70106,
  2231. 0x8005d,
  2232. 0x8001d,
  2233. 0x9009a,
  2234. 0x70116,
  2235. 0x8007d,
  2236. 0x8003d,
  2237. 0x900da,
  2238. 0x7010e,
  2239. 0x8006d,
  2240. 0x8002d,
  2241. 0x900ba,
  2242. 0x8000d,
  2243. 0x8008d,
  2244. 0x8004d,
  2245. 0x900fa,
  2246. 0x70101,
  2247. 0x80053,
  2248. 0x80013,
  2249. 0x8011b,
  2250. 0x70111,
  2251. 0x80073,
  2252. 0x80033,
  2253. 0x900c6,
  2254. 0x70109,
  2255. 0x80063,
  2256. 0x80023,
  2257. 0x900a6,
  2258. 0x80003,
  2259. 0x80083,
  2260. 0x80043,
  2261. 0x900e6,
  2262. 0x70105,
  2263. 0x8005b,
  2264. 0x8001b,
  2265. 0x90096,
  2266. 0x70115,
  2267. 0x8007b,
  2268. 0x8003b,
  2269. 0x900d6,
  2270. 0x7010d,
  2271. 0x8006b,
  2272. 0x8002b,
  2273. 0x900b6,
  2274. 0x8000b,
  2275. 0x8008b,
  2276. 0x8004b,
  2277. 0x900f6,
  2278. 0x70103,
  2279. 0x80057,
  2280. 0x80017,
  2281. 0x8011f,
  2282. 0x70113,
  2283. 0x80077,
  2284. 0x80037,
  2285. 0x900ce,
  2286. 0x7010b,
  2287. 0x80067,
  2288. 0x80027,
  2289. 0x900ae,
  2290. 0x80007,
  2291. 0x80087,
  2292. 0x80047,
  2293. 0x900ee,
  2294. 0x70107,
  2295. 0x8005f,
  2296. 0x8001f,
  2297. 0x9009e,
  2298. 0x70117,
  2299. 0x8007f,
  2300. 0x8003f,
  2301. 0x900de,
  2302. 0x7010f,
  2303. 0x8006f,
  2304. 0x8002f,
  2305. 0x900be,
  2306. 0x8000f,
  2307. 0x8008f,
  2308. 0x8004f,
  2309. 0x900fe,
  2310. 0x70100,
  2311. 0x80050,
  2312. 0x80010,
  2313. 0x80118,
  2314. 0x70110,
  2315. 0x80070,
  2316. 0x80030,
  2317. 0x900c1,
  2318. 0x70108,
  2319. 0x80060,
  2320. 0x80020,
  2321. 0x900a1,
  2322. 0x80000,
  2323. 0x80080,
  2324. 0x80040,
  2325. 0x900e1,
  2326. 0x70104,
  2327. 0x80058,
  2328. 0x80018,
  2329. 0x90091,
  2330. 0x70114,
  2331. 0x80078,
  2332. 0x80038,
  2333. 0x900d1,
  2334. 0x7010c,
  2335. 0x80068,
  2336. 0x80028,
  2337. 0x900b1,
  2338. 0x80008,
  2339. 0x80088,
  2340. 0x80048,
  2341. 0x900f1,
  2342. 0x70102,
  2343. 0x80054,
  2344. 0x80014,
  2345. 0x8011c,
  2346. 0x70112,
  2347. 0x80074,
  2348. 0x80034,
  2349. 0x900c9,
  2350. 0x7010a,
  2351. 0x80064,
  2352. 0x80024,
  2353. 0x900a9,
  2354. 0x80004,
  2355. 0x80084,
  2356. 0x80044,
  2357. 0x900e9,
  2358. 0x70106,
  2359. 0x8005c,
  2360. 0x8001c,
  2361. 0x90099,
  2362. 0x70116,
  2363. 0x8007c,
  2364. 0x8003c,
  2365. 0x900d9,
  2366. 0x7010e,
  2367. 0x8006c,
  2368. 0x8002c,
  2369. 0x900b9,
  2370. 0x8000c,
  2371. 0x8008c,
  2372. 0x8004c,
  2373. 0x900f9,
  2374. 0x70101,
  2375. 0x80052,
  2376. 0x80012,
  2377. 0x8011a,
  2378. 0x70111,
  2379. 0x80072,
  2380. 0x80032,
  2381. 0x900c5,
  2382. 0x70109,
  2383. 0x80062,
  2384. 0x80022,
  2385. 0x900a5,
  2386. 0x80002,
  2387. 0x80082,
  2388. 0x80042,
  2389. 0x900e5,
  2390. 0x70105,
  2391. 0x8005a,
  2392. 0x8001a,
  2393. 0x90095,
  2394. 0x70115,
  2395. 0x8007a,
  2396. 0x8003a,
  2397. 0x900d5,
  2398. 0x7010d,
  2399. 0x8006a,
  2400. 0x8002a,
  2401. 0x900b5,
  2402. 0x8000a,
  2403. 0x8008a,
  2404. 0x8004a,
  2405. 0x900f5,
  2406. 0x70103,
  2407. 0x80056,
  2408. 0x80016,
  2409. 0x8011e,
  2410. 0x70113,
  2411. 0x80076,
  2412. 0x80036,
  2413. 0x900cd,
  2414. 0x7010b,
  2415. 0x80066,
  2416. 0x80026,
  2417. 0x900ad,
  2418. 0x80006,
  2419. 0x80086,
  2420. 0x80046,
  2421. 0x900ed,
  2422. 0x70107,
  2423. 0x8005e,
  2424. 0x8001e,
  2425. 0x9009d,
  2426. 0x70117,
  2427. 0x8007e,
  2428. 0x8003e,
  2429. 0x900dd,
  2430. 0x7010f,
  2431. 0x8006e,
  2432. 0x8002e,
  2433. 0x900bd,
  2434. 0x8000e,
  2435. 0x8008e,
  2436. 0x8004e,
  2437. 0x900fd,
  2438. 0x70100,
  2439. 0x80051,
  2440. 0x80011,
  2441. 0x80119,
  2442. 0x70110,
  2443. 0x80071,
  2444. 0x80031,
  2445. 0x900c3,
  2446. 0x70108,
  2447. 0x80061,
  2448. 0x80021,
  2449. 0x900a3,
  2450. 0x80001,
  2451. 0x80081,
  2452. 0x80041,
  2453. 0x900e3,
  2454. 0x70104,
  2455. 0x80059,
  2456. 0x80019,
  2457. 0x90093,
  2458. 0x70114,
  2459. 0x80079,
  2460. 0x80039,
  2461. 0x900d3,
  2462. 0x7010c,
  2463. 0x80069,
  2464. 0x80029,
  2465. 0x900b3,
  2466. 0x80009,
  2467. 0x80089,
  2468. 0x80049,
  2469. 0x900f3,
  2470. 0x70102,
  2471. 0x80055,
  2472. 0x80015,
  2473. 0x8011d,
  2474. 0x70112,
  2475. 0x80075,
  2476. 0x80035,
  2477. 0x900cb,
  2478. 0x7010a,
  2479. 0x80065,
  2480. 0x80025,
  2481. 0x900ab,
  2482. 0x80005,
  2483. 0x80085,
  2484. 0x80045,
  2485. 0x900eb,
  2486. 0x70106,
  2487. 0x8005d,
  2488. 0x8001d,
  2489. 0x9009b,
  2490. 0x70116,
  2491. 0x8007d,
  2492. 0x8003d,
  2493. 0x900db,
  2494. 0x7010e,
  2495. 0x8006d,
  2496. 0x8002d,
  2497. 0x900bb,
  2498. 0x8000d,
  2499. 0x8008d,
  2500. 0x8004d,
  2501. 0x900fb,
  2502. 0x70101,
  2503. 0x80053,
  2504. 0x80013,
  2505. 0x8011b,
  2506. 0x70111,
  2507. 0x80073,
  2508. 0x80033,
  2509. 0x900c7,
  2510. 0x70109,
  2511. 0x80063,
  2512. 0x80023,
  2513. 0x900a7,
  2514. 0x80003,
  2515. 0x80083,
  2516. 0x80043,
  2517. 0x900e7,
  2518. 0x70105,
  2519. 0x8005b,
  2520. 0x8001b,
  2521. 0x90097,
  2522. 0x70115,
  2523. 0x8007b,
  2524. 0x8003b,
  2525. 0x900d7,
  2526. 0x7010d,
  2527. 0x8006b,
  2528. 0x8002b,
  2529. 0x900b7,
  2530. 0x8000b,
  2531. 0x8008b,
  2532. 0x8004b,
  2533. 0x900f7,
  2534. 0x70103,
  2535. 0x80057,
  2536. 0x80017,
  2537. 0x8011f,
  2538. 0x70113,
  2539. 0x80077,
  2540. 0x80037,
  2541. 0x900cf,
  2542. 0x7010b,
  2543. 0x80067,
  2544. 0x80027,
  2545. 0x900af,
  2546. 0x80007,
  2547. 0x80087,
  2548. 0x80047,
  2549. 0x900ef,
  2550. 0x70107,
  2551. 0x8005f,
  2552. 0x8001f,
  2553. 0x9009f,
  2554. 0x70117,
  2555. 0x8007f,
  2556. 0x8003f,
  2557. 0x900df,
  2558. 0x7010f,
  2559. 0x8006f,
  2560. 0x8002f,
  2561. 0x900bf,
  2562. 0x8000f,
  2563. 0x8008f,
  2564. 0x8004f,
  2565. 0x900ff
  2566. ]),
  2567. 9
  2568. ];
  2569. var fixedDistCodeTab = [
  2570. new Int32Array([
  2571. 0x50000,
  2572. 0x50010,
  2573. 0x50008,
  2574. 0x50018,
  2575. 0x50004,
  2576. 0x50014,
  2577. 0x5000c,
  2578. 0x5001c,
  2579. 0x50002,
  2580. 0x50012,
  2581. 0x5000a,
  2582. 0x5001a,
  2583. 0x50006,
  2584. 0x50016,
  2585. 0x5000e,
  2586. 0x00000,
  2587. 0x50001,
  2588. 0x50011,
  2589. 0x50009,
  2590. 0x50019,
  2591. 0x50005,
  2592. 0x50015,
  2593. 0x5000d,
  2594. 0x5001d,
  2595. 0x50003,
  2596. 0x50013,
  2597. 0x5000b,
  2598. 0x5001b,
  2599. 0x50007,
  2600. 0x50017,
  2601. 0x5000f,
  2602. 0x00000
  2603. ]),
  2604. 5
  2605. ];
  2606. function FlateStream(str, maybeLength) {
  2607. this.str = str;
  2608. this.dict = str.dict;
  2609. var cmf = str.getByte();
  2610. var flg = str.getByte();
  2611. if (cmf === -1 || flg === -1) {
  2612. error('Invalid header in flate stream: ' + cmf + ', ' + flg);
  2613. }
  2614. if ((cmf & 0x0f) !== 0x08) {
  2615. error('Unknown compression method in flate stream: ' + cmf + ', ' + flg);
  2616. }
  2617. if (((cmf << 8) + flg) % 31 !== 0) {
  2618. error('Bad FCHECK in flate stream: ' + cmf + ', ' + flg);
  2619. }
  2620. if (flg & 0x20) {
  2621. error('FDICT bit set in flate stream: ' + cmf + ', ' + flg);
  2622. }
  2623. this.codeSize = 0;
  2624. this.codeBuf = 0;
  2625. DecodeStream.call(this, maybeLength);
  2626. }
  2627. FlateStream.prototype = Object.create(DecodeStream.prototype);
  2628. FlateStream.prototype.getBits = function FlateStream_getBits(bits) {
  2629. var str = this.str;
  2630. var codeSize = this.codeSize;
  2631. var codeBuf = this.codeBuf;
  2632. var b;
  2633. while (codeSize < bits) {
  2634. if ((b = str.getByte()) === -1) {
  2635. error('Bad encoding in flate stream');
  2636. }
  2637. codeBuf |= b << codeSize;
  2638. codeSize += 8;
  2639. }
  2640. b = codeBuf & (1 << bits) - 1;
  2641. this.codeBuf = codeBuf >> bits;
  2642. this.codeSize = codeSize -= bits;
  2643. return b;
  2644. };
  2645. FlateStream.prototype.getCode = function FlateStream_getCode(table) {
  2646. var str = this.str;
  2647. var codes = table[0];
  2648. var maxLen = table[1];
  2649. var codeSize = this.codeSize;
  2650. var codeBuf = this.codeBuf;
  2651. var b;
  2652. while (codeSize < maxLen) {
  2653. if ((b = str.getByte()) === -1) {
  2654. break;
  2655. }
  2656. codeBuf |= b << codeSize;
  2657. codeSize += 8;
  2658. }
  2659. var code = codes[codeBuf & (1 << maxLen) - 1];
  2660. var codeLen = code >> 16;
  2661. var codeVal = code & 0xffff;
  2662. if (codeLen < 1 || codeSize < codeLen) {
  2663. error('Bad encoding in flate stream');
  2664. }
  2665. this.codeBuf = codeBuf >> codeLen;
  2666. this.codeSize = codeSize - codeLen;
  2667. return codeVal;
  2668. };
  2669. FlateStream.prototype.generateHuffmanTable = function flateStreamGenerateHuffmanTable(lengths) {
  2670. var n = lengths.length;
  2671. var maxLen = 0;
  2672. var i;
  2673. for (i = 0; i < n; ++i) {
  2674. if (lengths[i] > maxLen) {
  2675. maxLen = lengths[i];
  2676. }
  2677. }
  2678. var size = 1 << maxLen;
  2679. var codes = new Int32Array(size);
  2680. for (var len = 1, code = 0, skip = 2; len <= maxLen; ++len, code <<= 1, skip <<= 1) {
  2681. for (var val = 0; val < n; ++val) {
  2682. if (lengths[val] === len) {
  2683. var code2 = 0;
  2684. var t = code;
  2685. for (i = 0; i < len; ++i) {
  2686. code2 = code2 << 1 | t & 1;
  2687. t >>= 1;
  2688. }
  2689. for (i = code2; i < size; i += skip) {
  2690. codes[i] = len << 16 | val;
  2691. }
  2692. ++code;
  2693. }
  2694. }
  2695. }
  2696. return [
  2697. codes,
  2698. maxLen
  2699. ];
  2700. };
  2701. FlateStream.prototype.readBlock = function FlateStream_readBlock() {
  2702. var buffer, len;
  2703. var str = this.str;
  2704. var hdr = this.getBits(3);
  2705. if (hdr & 1) {
  2706. this.eof = true;
  2707. }
  2708. hdr >>= 1;
  2709. if (hdr === 0) {
  2710. var b;
  2711. if ((b = str.getByte()) === -1) {
  2712. error('Bad block header in flate stream');
  2713. }
  2714. var blockLen = b;
  2715. if ((b = str.getByte()) === -1) {
  2716. error('Bad block header in flate stream');
  2717. }
  2718. blockLen |= b << 8;
  2719. if ((b = str.getByte()) === -1) {
  2720. error('Bad block header in flate stream');
  2721. }
  2722. var check = b;
  2723. if ((b = str.getByte()) === -1) {
  2724. error('Bad block header in flate stream');
  2725. }
  2726. check |= b << 8;
  2727. if (check !== (~blockLen & 0xffff) && (blockLen !== 0 || check !== 0)) {
  2728. error('Bad uncompressed block length in flate stream');
  2729. }
  2730. this.codeBuf = 0;
  2731. this.codeSize = 0;
  2732. var bufferLength = this.bufferLength;
  2733. buffer = this.ensureBuffer(bufferLength + blockLen);
  2734. var end = bufferLength + blockLen;
  2735. this.bufferLength = end;
  2736. if (blockLen === 0) {
  2737. if (str.peekByte() === -1) {
  2738. this.eof = true;
  2739. }
  2740. } else {
  2741. for (var n = bufferLength; n < end; ++n) {
  2742. if ((b = str.getByte()) === -1) {
  2743. this.eof = true;
  2744. break;
  2745. }
  2746. buffer[n] = b;
  2747. }
  2748. }
  2749. return;
  2750. }
  2751. var litCodeTable;
  2752. var distCodeTable;
  2753. if (hdr === 1) {
  2754. litCodeTable = fixedLitCodeTab;
  2755. distCodeTable = fixedDistCodeTab;
  2756. } else if (hdr === 2) {
  2757. var numLitCodes = this.getBits(5) + 257;
  2758. var numDistCodes = this.getBits(5) + 1;
  2759. var numCodeLenCodes = this.getBits(4) + 4;
  2760. var codeLenCodeLengths = new Uint8Array(codeLenCodeMap.length);
  2761. var i;
  2762. for (i = 0; i < numCodeLenCodes; ++i) {
  2763. codeLenCodeLengths[codeLenCodeMap[i]] = this.getBits(3);
  2764. }
  2765. var codeLenCodeTab = this.generateHuffmanTable(codeLenCodeLengths);
  2766. len = 0;
  2767. i = 0;
  2768. var codes = numLitCodes + numDistCodes;
  2769. var codeLengths = new Uint8Array(codes);
  2770. var bitsLength, bitsOffset, what;
  2771. while (i < codes) {
  2772. var code = this.getCode(codeLenCodeTab);
  2773. if (code === 16) {
  2774. bitsLength = 2;
  2775. bitsOffset = 3;
  2776. what = len;
  2777. } else if (code === 17) {
  2778. bitsLength = 3;
  2779. bitsOffset = 3;
  2780. what = len = 0;
  2781. } else if (code === 18) {
  2782. bitsLength = 7;
  2783. bitsOffset = 11;
  2784. what = len = 0;
  2785. } else {
  2786. codeLengths[i++] = len = code;
  2787. continue;
  2788. }
  2789. var repeatLength = this.getBits(bitsLength) + bitsOffset;
  2790. while (repeatLength-- > 0) {
  2791. codeLengths[i++] = what;
  2792. }
  2793. }
  2794. litCodeTable = this.generateHuffmanTable(codeLengths.subarray(0, numLitCodes));
  2795. distCodeTable = this.generateHuffmanTable(codeLengths.subarray(numLitCodes, codes));
  2796. } else {
  2797. error('Unknown block type in flate stream');
  2798. }
  2799. buffer = this.buffer;
  2800. var limit = buffer ? buffer.length : 0;
  2801. var pos = this.bufferLength;
  2802. while (true) {
  2803. var code1 = this.getCode(litCodeTable);
  2804. if (code1 < 256) {
  2805. if (pos + 1 >= limit) {
  2806. buffer = this.ensureBuffer(pos + 1);
  2807. limit = buffer.length;
  2808. }
  2809. buffer[pos++] = code1;
  2810. continue;
  2811. }
  2812. if (code1 === 256) {
  2813. this.bufferLength = pos;
  2814. return;
  2815. }
  2816. code1 -= 257;
  2817. code1 = lengthDecode[code1];
  2818. var code2 = code1 >> 16;
  2819. if (code2 > 0) {
  2820. code2 = this.getBits(code2);
  2821. }
  2822. len = (code1 & 0xffff) + code2;
  2823. code1 = this.getCode(distCodeTable);
  2824. code1 = distDecode[code1];
  2825. code2 = code1 >> 16;
  2826. if (code2 > 0) {
  2827. code2 = this.getBits(code2);
  2828. }
  2829. var dist = (code1 & 0xffff) + code2;
  2830. if (pos + len >= limit) {
  2831. buffer = this.ensureBuffer(pos + len);
  2832. limit = buffer.length;
  2833. }
  2834. for (var k = 0; k < len; ++k, ++pos) {
  2835. buffer[pos] = buffer[pos - dist];
  2836. }
  2837. }
  2838. };
  2839. return FlateStream;
  2840. }();
  2841. var PredictorStream = function PredictorStreamClosure() {
  2842. function PredictorStream(str, maybeLength, params) {
  2843. if (!isDict(params)) {
  2844. return str;
  2845. }
  2846. var predictor = this.predictor = params.get('Predictor') || 1;
  2847. if (predictor <= 1) {
  2848. return str;
  2849. }
  2850. if (predictor !== 2 && (predictor < 10 || predictor > 15)) {
  2851. error('Unsupported predictor: ' + predictor);
  2852. }
  2853. if (predictor === 2) {
  2854. this.readBlock = this.readBlockTiff;
  2855. } else {
  2856. this.readBlock = this.readBlockPng;
  2857. }
  2858. this.str = str;
  2859. this.dict = str.dict;
  2860. var colors = this.colors = params.get('Colors') || 1;
  2861. var bits = this.bits = params.get('BitsPerComponent') || 8;
  2862. var columns = this.columns = params.get('Columns') || 1;
  2863. this.pixBytes = colors * bits + 7 >> 3;
  2864. this.rowBytes = columns * colors * bits + 7 >> 3;
  2865. DecodeStream.call(this, maybeLength);
  2866. return this;
  2867. }
  2868. PredictorStream.prototype = Object.create(DecodeStream.prototype);
  2869. PredictorStream.prototype.readBlockTiff = function predictorStreamReadBlockTiff() {
  2870. var rowBytes = this.rowBytes;
  2871. var bufferLength = this.bufferLength;
  2872. var buffer = this.ensureBuffer(bufferLength + rowBytes);
  2873. var bits = this.bits;
  2874. var colors = this.colors;
  2875. var rawBytes = this.str.getBytes(rowBytes);
  2876. this.eof = !rawBytes.length;
  2877. if (this.eof) {
  2878. return;
  2879. }
  2880. var inbuf = 0, outbuf = 0;
  2881. var inbits = 0, outbits = 0;
  2882. var pos = bufferLength;
  2883. var i;
  2884. if (bits === 1 && colors === 1) {
  2885. for (i = 0; i < rowBytes; ++i) {
  2886. var c = rawBytes[i] ^ inbuf;
  2887. c ^= c >> 1;
  2888. c ^= c >> 2;
  2889. c ^= c >> 4;
  2890. inbuf = (c & 1) << 7;
  2891. buffer[pos++] = c;
  2892. }
  2893. } else if (bits === 8) {
  2894. for (i = 0; i < colors; ++i) {
  2895. buffer[pos++] = rawBytes[i];
  2896. }
  2897. for (; i < rowBytes; ++i) {
  2898. buffer[pos] = buffer[pos - colors] + rawBytes[i];
  2899. pos++;
  2900. }
  2901. } else {
  2902. var compArray = new Uint8Array(colors + 1);
  2903. var bitMask = (1 << bits) - 1;
  2904. var j = 0, k = bufferLength;
  2905. var columns = this.columns;
  2906. for (i = 0; i < columns; ++i) {
  2907. for (var kk = 0; kk < colors; ++kk) {
  2908. if (inbits < bits) {
  2909. inbuf = inbuf << 8 | rawBytes[j++] & 0xFF;
  2910. inbits += 8;
  2911. }
  2912. compArray[kk] = compArray[kk] + (inbuf >> inbits - bits) & bitMask;
  2913. inbits -= bits;
  2914. outbuf = outbuf << bits | compArray[kk];
  2915. outbits += bits;
  2916. if (outbits >= 8) {
  2917. buffer[k++] = outbuf >> outbits - 8 & 0xFF;
  2918. outbits -= 8;
  2919. }
  2920. }
  2921. }
  2922. if (outbits > 0) {
  2923. buffer[k++] = (outbuf << 8 - outbits) + (inbuf & (1 << 8 - outbits) - 1);
  2924. }
  2925. }
  2926. this.bufferLength += rowBytes;
  2927. };
  2928. PredictorStream.prototype.readBlockPng = function predictorStreamReadBlockPng() {
  2929. var rowBytes = this.rowBytes;
  2930. var pixBytes = this.pixBytes;
  2931. var predictor = this.str.getByte();
  2932. var rawBytes = this.str.getBytes(rowBytes);
  2933. this.eof = !rawBytes.length;
  2934. if (this.eof) {
  2935. return;
  2936. }
  2937. var bufferLength = this.bufferLength;
  2938. var buffer = this.ensureBuffer(bufferLength + rowBytes);
  2939. var prevRow = buffer.subarray(bufferLength - rowBytes, bufferLength);
  2940. if (prevRow.length === 0) {
  2941. prevRow = new Uint8Array(rowBytes);
  2942. }
  2943. var i, j = bufferLength, up, c;
  2944. switch (predictor) {
  2945. case 0:
  2946. for (i = 0; i < rowBytes; ++i) {
  2947. buffer[j++] = rawBytes[i];
  2948. }
  2949. break;
  2950. case 1:
  2951. for (i = 0; i < pixBytes; ++i) {
  2952. buffer[j++] = rawBytes[i];
  2953. }
  2954. for (; i < rowBytes; ++i) {
  2955. buffer[j] = buffer[j - pixBytes] + rawBytes[i] & 0xFF;
  2956. j++;
  2957. }
  2958. break;
  2959. case 2:
  2960. for (i = 0; i < rowBytes; ++i) {
  2961. buffer[j++] = prevRow[i] + rawBytes[i] & 0xFF;
  2962. }
  2963. break;
  2964. case 3:
  2965. for (i = 0; i < pixBytes; ++i) {
  2966. buffer[j++] = (prevRow[i] >> 1) + rawBytes[i];
  2967. }
  2968. for (; i < rowBytes; ++i) {
  2969. buffer[j] = (prevRow[i] + buffer[j - pixBytes] >> 1) + rawBytes[i] & 0xFF;
  2970. j++;
  2971. }
  2972. break;
  2973. case 4:
  2974. for (i = 0; i < pixBytes; ++i) {
  2975. up = prevRow[i];
  2976. c = rawBytes[i];
  2977. buffer[j++] = up + c;
  2978. }
  2979. for (; i < rowBytes; ++i) {
  2980. up = prevRow[i];
  2981. var upLeft = prevRow[i - pixBytes];
  2982. var left = buffer[j - pixBytes];
  2983. var p = left + up - upLeft;
  2984. var pa = p - left;
  2985. if (pa < 0) {
  2986. pa = -pa;
  2987. }
  2988. var pb = p - up;
  2989. if (pb < 0) {
  2990. pb = -pb;
  2991. }
  2992. var pc = p - upLeft;
  2993. if (pc < 0) {
  2994. pc = -pc;
  2995. }
  2996. c = rawBytes[i];
  2997. if (pa <= pb && pa <= pc) {
  2998. buffer[j++] = left + c;
  2999. } else if (pb <= pc) {
  3000. buffer[j++] = up + c;
  3001. } else {
  3002. buffer[j++] = upLeft + c;
  3003. }
  3004. }
  3005. break;
  3006. default:
  3007. error('Unsupported predictor: ' + predictor);
  3008. }
  3009. this.bufferLength += rowBytes;
  3010. };
  3011. return PredictorStream;
  3012. }();
  3013. var JpegStream = function JpegStreamClosure() {
  3014. function JpegStream(stream, maybeLength, dict, params) {
  3015. var ch;
  3016. while ((ch = stream.getByte()) !== -1) {
  3017. if (ch === 0xFF) {
  3018. stream.skip(-1);
  3019. break;
  3020. }
  3021. }
  3022. this.stream = stream;
  3023. this.maybeLength = maybeLength;
  3024. this.dict = dict;
  3025. this.params = params;
  3026. DecodeStream.call(this, maybeLength);
  3027. }
  3028. JpegStream.prototype = Object.create(DecodeStream.prototype);
  3029. Object.defineProperty(JpegStream.prototype, 'bytes', {
  3030. get: function JpegStream_bytes() {
  3031. return shadow(this, 'bytes', this.stream.getBytes(this.maybeLength));
  3032. },
  3033. configurable: true
  3034. });
  3035. JpegStream.prototype.ensureBuffer = function JpegStream_ensureBuffer(req) {
  3036. if (this.bufferLength) {
  3037. return;
  3038. }
  3039. var jpegImage = new JpegImage();
  3040. var decodeArr = this.dict.getArray('Decode', 'D');
  3041. if (this.forceRGB && isArray(decodeArr)) {
  3042. var bitsPerComponent = this.dict.get('BitsPerComponent') || 8;
  3043. var decodeArrLength = decodeArr.length;
  3044. var transform = new Int32Array(decodeArrLength);
  3045. var transformNeeded = false;
  3046. var maxValue = (1 << bitsPerComponent) - 1;
  3047. for (var i = 0; i < decodeArrLength; i += 2) {
  3048. transform[i] = (decodeArr[i + 1] - decodeArr[i]) * 256 | 0;
  3049. transform[i + 1] = decodeArr[i] * maxValue | 0;
  3050. if (transform[i] !== 256 || transform[i + 1] !== 0) {
  3051. transformNeeded = true;
  3052. }
  3053. }
  3054. if (transformNeeded) {
  3055. jpegImage.decodeTransform = transform;
  3056. }
  3057. }
  3058. if (isDict(this.params)) {
  3059. var colorTransform = this.params.get('ColorTransform');
  3060. if (isInt(colorTransform)) {
  3061. jpegImage.colorTransform = colorTransform;
  3062. }
  3063. }
  3064. jpegImage.parse(this.bytes);
  3065. var data = jpegImage.getData(this.drawWidth, this.drawHeight, this.forceRGB);
  3066. this.buffer = data;
  3067. this.bufferLength = data.length;
  3068. this.eof = true;
  3069. };
  3070. JpegStream.prototype.getBytes = function JpegStream_getBytes(length) {
  3071. this.ensureBuffer();
  3072. return this.buffer;
  3073. };
  3074. JpegStream.prototype.getIR = function JpegStream_getIR(forceDataSchema) {
  3075. return createObjectURL(this.bytes, 'image/jpeg', forceDataSchema);
  3076. };
  3077. return JpegStream;
  3078. }();
  3079. var JpxStream = function JpxStreamClosure() {
  3080. function JpxStream(stream, maybeLength, dict, params) {
  3081. this.stream = stream;
  3082. this.maybeLength = maybeLength;
  3083. this.dict = dict;
  3084. this.params = params;
  3085. DecodeStream.call(this, maybeLength);
  3086. }
  3087. JpxStream.prototype = Object.create(DecodeStream.prototype);
  3088. Object.defineProperty(JpxStream.prototype, 'bytes', {
  3089. get: function JpxStream_bytes() {
  3090. return shadow(this, 'bytes', this.stream.getBytes(this.maybeLength));
  3091. },
  3092. configurable: true
  3093. });
  3094. JpxStream.prototype.ensureBuffer = function JpxStream_ensureBuffer(req) {
  3095. if (this.bufferLength) {
  3096. return;
  3097. }
  3098. var jpxImage = new JpxImage();
  3099. jpxImage.parse(this.bytes);
  3100. var width = jpxImage.width;
  3101. var height = jpxImage.height;
  3102. var componentsCount = jpxImage.componentsCount;
  3103. var tileCount = jpxImage.tiles.length;
  3104. if (tileCount === 1) {
  3105. this.buffer = jpxImage.tiles[0].items;
  3106. } else {
  3107. var data = new Uint8Array(width * height * componentsCount);
  3108. for (var k = 0; k < tileCount; k++) {
  3109. var tileComponents = jpxImage.tiles[k];
  3110. var tileWidth = tileComponents.width;
  3111. var tileHeight = tileComponents.height;
  3112. var tileLeft = tileComponents.left;
  3113. var tileTop = tileComponents.top;
  3114. var src = tileComponents.items;
  3115. var srcPosition = 0;
  3116. var dataPosition = (width * tileTop + tileLeft) * componentsCount;
  3117. var imgRowSize = width * componentsCount;
  3118. var tileRowSize = tileWidth * componentsCount;
  3119. for (var j = 0; j < tileHeight; j++) {
  3120. var rowBytes = src.subarray(srcPosition, srcPosition + tileRowSize);
  3121. data.set(rowBytes, dataPosition);
  3122. srcPosition += tileRowSize;
  3123. dataPosition += imgRowSize;
  3124. }
  3125. }
  3126. this.buffer = data;
  3127. }
  3128. this.bufferLength = this.buffer.length;
  3129. this.eof = true;
  3130. };
  3131. return JpxStream;
  3132. }();
  3133. var Jbig2Stream = function Jbig2StreamClosure() {
  3134. function Jbig2Stream(stream, maybeLength, dict, params) {
  3135. this.stream = stream;
  3136. this.maybeLength = maybeLength;
  3137. this.dict = dict;
  3138. this.params = params;
  3139. DecodeStream.call(this, maybeLength);
  3140. }
  3141. Jbig2Stream.prototype = Object.create(DecodeStream.prototype);
  3142. Object.defineProperty(Jbig2Stream.prototype, 'bytes', {
  3143. get: function Jbig2Stream_bytes() {
  3144. return shadow(this, 'bytes', this.stream.getBytes(this.maybeLength));
  3145. },
  3146. configurable: true
  3147. });
  3148. Jbig2Stream.prototype.ensureBuffer = function Jbig2Stream_ensureBuffer(req) {
  3149. if (this.bufferLength) {
  3150. return;
  3151. }
  3152. var jbig2Image = new Jbig2Image();
  3153. var chunks = [];
  3154. if (isDict(this.params)) {
  3155. var globalsStream = this.params.get('JBIG2Globals');
  3156. if (isStream(globalsStream)) {
  3157. var globals = globalsStream.getBytes();
  3158. chunks.push({
  3159. data: globals,
  3160. start: 0,
  3161. end: globals.length
  3162. });
  3163. }
  3164. }
  3165. chunks.push({
  3166. data: this.bytes,
  3167. start: 0,
  3168. end: this.bytes.length
  3169. });
  3170. var data = jbig2Image.parseChunks(chunks);
  3171. var dataLength = data.length;
  3172. for (var i = 0; i < dataLength; i++) {
  3173. data[i] ^= 0xFF;
  3174. }
  3175. this.buffer = data;
  3176. this.bufferLength = dataLength;
  3177. this.eof = true;
  3178. };
  3179. return Jbig2Stream;
  3180. }();
  3181. var DecryptStream = function DecryptStreamClosure() {
  3182. function DecryptStream(str, maybeLength, decrypt) {
  3183. this.str = str;
  3184. this.dict = str.dict;
  3185. this.decrypt = decrypt;
  3186. this.nextChunk = null;
  3187. this.initialized = false;
  3188. DecodeStream.call(this, maybeLength);
  3189. }
  3190. var chunkSize = 512;
  3191. DecryptStream.prototype = Object.create(DecodeStream.prototype);
  3192. DecryptStream.prototype.readBlock = function DecryptStream_readBlock() {
  3193. var chunk;
  3194. if (this.initialized) {
  3195. chunk = this.nextChunk;
  3196. } else {
  3197. chunk = this.str.getBytes(chunkSize);
  3198. this.initialized = true;
  3199. }
  3200. if (!chunk || chunk.length === 0) {
  3201. this.eof = true;
  3202. return;
  3203. }
  3204. this.nextChunk = this.str.getBytes(chunkSize);
  3205. var hasMoreData = this.nextChunk && this.nextChunk.length > 0;
  3206. var decrypt = this.decrypt;
  3207. chunk = decrypt(chunk, !hasMoreData);
  3208. var bufferLength = this.bufferLength;
  3209. var i, n = chunk.length;
  3210. var buffer = this.ensureBuffer(bufferLength + n);
  3211. for (i = 0; i < n; i++) {
  3212. buffer[bufferLength++] = chunk[i];
  3213. }
  3214. this.bufferLength = bufferLength;
  3215. };
  3216. return DecryptStream;
  3217. }();
  3218. var Ascii85Stream = function Ascii85StreamClosure() {
  3219. function Ascii85Stream(str, maybeLength) {
  3220. this.str = str;
  3221. this.dict = str.dict;
  3222. this.input = new Uint8Array(5);
  3223. if (maybeLength) {
  3224. maybeLength = 0.8 * maybeLength;
  3225. }
  3226. DecodeStream.call(this, maybeLength);
  3227. }
  3228. Ascii85Stream.prototype = Object.create(DecodeStream.prototype);
  3229. Ascii85Stream.prototype.readBlock = function Ascii85Stream_readBlock() {
  3230. var TILDA_CHAR = 0x7E;
  3231. var Z_LOWER_CHAR = 0x7A;
  3232. var EOF = -1;
  3233. var str = this.str;
  3234. var c = str.getByte();
  3235. while (isSpace(c)) {
  3236. c = str.getByte();
  3237. }
  3238. if (c === EOF || c === TILDA_CHAR) {
  3239. this.eof = true;
  3240. return;
  3241. }
  3242. var bufferLength = this.bufferLength, buffer;
  3243. var i;
  3244. if (c === Z_LOWER_CHAR) {
  3245. buffer = this.ensureBuffer(bufferLength + 4);
  3246. for (i = 0; i < 4; ++i) {
  3247. buffer[bufferLength + i] = 0;
  3248. }
  3249. this.bufferLength += 4;
  3250. } else {
  3251. var input = this.input;
  3252. input[0] = c;
  3253. for (i = 1; i < 5; ++i) {
  3254. c = str.getByte();
  3255. while (isSpace(c)) {
  3256. c = str.getByte();
  3257. }
  3258. input[i] = c;
  3259. if (c === EOF || c === TILDA_CHAR) {
  3260. break;
  3261. }
  3262. }
  3263. buffer = this.ensureBuffer(bufferLength + i - 1);
  3264. this.bufferLength += i - 1;
  3265. if (i < 5) {
  3266. for (; i < 5; ++i) {
  3267. input[i] = 0x21 + 84;
  3268. }
  3269. this.eof = true;
  3270. }
  3271. var t = 0;
  3272. for (i = 0; i < 5; ++i) {
  3273. t = t * 85 + (input[i] - 0x21);
  3274. }
  3275. for (i = 3; i >= 0; --i) {
  3276. buffer[bufferLength + i] = t & 0xFF;
  3277. t >>= 8;
  3278. }
  3279. }
  3280. };
  3281. return Ascii85Stream;
  3282. }();
  3283. var AsciiHexStream = function AsciiHexStreamClosure() {
  3284. function AsciiHexStream(str, maybeLength) {
  3285. this.str = str;
  3286. this.dict = str.dict;
  3287. this.firstDigit = -1;
  3288. if (maybeLength) {
  3289. maybeLength = 0.5 * maybeLength;
  3290. }
  3291. DecodeStream.call(this, maybeLength);
  3292. }
  3293. AsciiHexStream.prototype = Object.create(DecodeStream.prototype);
  3294. AsciiHexStream.prototype.readBlock = function AsciiHexStream_readBlock() {
  3295. var UPSTREAM_BLOCK_SIZE = 8000;
  3296. var bytes = this.str.getBytes(UPSTREAM_BLOCK_SIZE);
  3297. if (!bytes.length) {
  3298. this.eof = true;
  3299. return;
  3300. }
  3301. var maxDecodeLength = bytes.length + 1 >> 1;
  3302. var buffer = this.ensureBuffer(this.bufferLength + maxDecodeLength);
  3303. var bufferLength = this.bufferLength;
  3304. var firstDigit = this.firstDigit;
  3305. for (var i = 0, ii = bytes.length; i < ii; i++) {
  3306. var ch = bytes[i], digit;
  3307. if (ch >= 0x30 && ch <= 0x39) {
  3308. digit = ch & 0x0F;
  3309. } else if (ch >= 0x41 && ch <= 0x46 || ch >= 0x61 && ch <= 0x66) {
  3310. digit = (ch & 0x0F) + 9;
  3311. } else if (ch === 0x3E) {
  3312. this.eof = true;
  3313. break;
  3314. } else {
  3315. continue;
  3316. }
  3317. if (firstDigit < 0) {
  3318. firstDigit = digit;
  3319. } else {
  3320. buffer[bufferLength++] = firstDigit << 4 | digit;
  3321. firstDigit = -1;
  3322. }
  3323. }
  3324. if (firstDigit >= 0 && this.eof) {
  3325. buffer[bufferLength++] = firstDigit << 4;
  3326. firstDigit = -1;
  3327. }
  3328. this.firstDigit = firstDigit;
  3329. this.bufferLength = bufferLength;
  3330. };
  3331. return AsciiHexStream;
  3332. }();
  3333. var RunLengthStream = function RunLengthStreamClosure() {
  3334. function RunLengthStream(str, maybeLength) {
  3335. this.str = str;
  3336. this.dict = str.dict;
  3337. DecodeStream.call(this, maybeLength);
  3338. }
  3339. RunLengthStream.prototype = Object.create(DecodeStream.prototype);
  3340. RunLengthStream.prototype.readBlock = function RunLengthStream_readBlock() {
  3341. var repeatHeader = this.str.getBytes(2);
  3342. if (!repeatHeader || repeatHeader.length < 2 || repeatHeader[0] === 128) {
  3343. this.eof = true;
  3344. return;
  3345. }
  3346. var buffer;
  3347. var bufferLength = this.bufferLength;
  3348. var n = repeatHeader[0];
  3349. if (n < 128) {
  3350. buffer = this.ensureBuffer(bufferLength + n + 1);
  3351. buffer[bufferLength++] = repeatHeader[1];
  3352. if (n > 0) {
  3353. var source = this.str.getBytes(n);
  3354. buffer.set(source, bufferLength);
  3355. bufferLength += n;
  3356. }
  3357. } else {
  3358. n = 257 - n;
  3359. var b = repeatHeader[1];
  3360. buffer = this.ensureBuffer(bufferLength + n + 1);
  3361. for (var i = 0; i < n; i++) {
  3362. buffer[bufferLength++] = b;
  3363. }
  3364. }
  3365. this.bufferLength = bufferLength;
  3366. };
  3367. return RunLengthStream;
  3368. }();
  3369. var CCITTFaxStream = function CCITTFaxStreamClosure() {
  3370. var ccittEOL = -2;
  3371. var ccittEOF = -1;
  3372. var twoDimPass = 0;
  3373. var twoDimHoriz = 1;
  3374. var twoDimVert0 = 2;
  3375. var twoDimVertR1 = 3;
  3376. var twoDimVertL1 = 4;
  3377. var twoDimVertR2 = 5;
  3378. var twoDimVertL2 = 6;
  3379. var twoDimVertR3 = 7;
  3380. var twoDimVertL3 = 8;
  3381. var twoDimTable = [
  3382. [
  3383. -1,
  3384. -1
  3385. ],
  3386. [
  3387. -1,
  3388. -1
  3389. ],
  3390. [
  3391. 7,
  3392. twoDimVertL3
  3393. ],
  3394. [
  3395. 7,
  3396. twoDimVertR3
  3397. ],
  3398. [
  3399. 6,
  3400. twoDimVertL2
  3401. ],
  3402. [
  3403. 6,
  3404. twoDimVertL2
  3405. ],
  3406. [
  3407. 6,
  3408. twoDimVertR2
  3409. ],
  3410. [
  3411. 6,
  3412. twoDimVertR2
  3413. ],
  3414. [
  3415. 4,
  3416. twoDimPass
  3417. ],
  3418. [
  3419. 4,
  3420. twoDimPass
  3421. ],
  3422. [
  3423. 4,
  3424. twoDimPass
  3425. ],
  3426. [
  3427. 4,
  3428. twoDimPass
  3429. ],
  3430. [
  3431. 4,
  3432. twoDimPass
  3433. ],
  3434. [
  3435. 4,
  3436. twoDimPass
  3437. ],
  3438. [
  3439. 4,
  3440. twoDimPass
  3441. ],
  3442. [
  3443. 4,
  3444. twoDimPass
  3445. ],
  3446. [
  3447. 3,
  3448. twoDimHoriz
  3449. ],
  3450. [
  3451. 3,
  3452. twoDimHoriz
  3453. ],
  3454. [
  3455. 3,
  3456. twoDimHoriz
  3457. ],
  3458. [
  3459. 3,
  3460. twoDimHoriz
  3461. ],
  3462. [
  3463. 3,
  3464. twoDimHoriz
  3465. ],
  3466. [
  3467. 3,
  3468. twoDimHoriz
  3469. ],
  3470. [
  3471. 3,
  3472. twoDimHoriz
  3473. ],
  3474. [
  3475. 3,
  3476. twoDimHoriz
  3477. ],
  3478. [
  3479. 3,
  3480. twoDimHoriz
  3481. ],
  3482. [
  3483. 3,
  3484. twoDimHoriz
  3485. ],
  3486. [
  3487. 3,
  3488. twoDimHoriz
  3489. ],
  3490. [
  3491. 3,
  3492. twoDimHoriz
  3493. ],
  3494. [
  3495. 3,
  3496. twoDimHoriz
  3497. ],
  3498. [
  3499. 3,
  3500. twoDimHoriz
  3501. ],
  3502. [
  3503. 3,
  3504. twoDimHoriz
  3505. ],
  3506. [
  3507. 3,
  3508. twoDimHoriz
  3509. ],
  3510. [
  3511. 3,
  3512. twoDimVertL1
  3513. ],
  3514. [
  3515. 3,
  3516. twoDimVertL1
  3517. ],
  3518. [
  3519. 3,
  3520. twoDimVertL1
  3521. ],
  3522. [
  3523. 3,
  3524. twoDimVertL1
  3525. ],
  3526. [
  3527. 3,
  3528. twoDimVertL1
  3529. ],
  3530. [
  3531. 3,
  3532. twoDimVertL1
  3533. ],
  3534. [
  3535. 3,
  3536. twoDimVertL1
  3537. ],
  3538. [
  3539. 3,
  3540. twoDimVertL1
  3541. ],
  3542. [
  3543. 3,
  3544. twoDimVertL1
  3545. ],
  3546. [
  3547. 3,
  3548. twoDimVertL1
  3549. ],
  3550. [
  3551. 3,
  3552. twoDimVertL1
  3553. ],
  3554. [
  3555. 3,
  3556. twoDimVertL1
  3557. ],
  3558. [
  3559. 3,
  3560. twoDimVertL1
  3561. ],
  3562. [
  3563. 3,
  3564. twoDimVertL1
  3565. ],
  3566. [
  3567. 3,
  3568. twoDimVertL1
  3569. ],
  3570. [
  3571. 3,
  3572. twoDimVertL1
  3573. ],
  3574. [
  3575. 3,
  3576. twoDimVertR1
  3577. ],
  3578. [
  3579. 3,
  3580. twoDimVertR1
  3581. ],
  3582. [
  3583. 3,
  3584. twoDimVertR1
  3585. ],
  3586. [
  3587. 3,
  3588. twoDimVertR1
  3589. ],
  3590. [
  3591. 3,
  3592. twoDimVertR1
  3593. ],
  3594. [
  3595. 3,
  3596. twoDimVertR1
  3597. ],
  3598. [
  3599. 3,
  3600. twoDimVertR1
  3601. ],
  3602. [
  3603. 3,
  3604. twoDimVertR1
  3605. ],
  3606. [
  3607. 3,
  3608. twoDimVertR1
  3609. ],
  3610. [
  3611. 3,
  3612. twoDimVertR1
  3613. ],
  3614. [
  3615. 3,
  3616. twoDimVertR1
  3617. ],
  3618. [
  3619. 3,
  3620. twoDimVertR1
  3621. ],
  3622. [
  3623. 3,
  3624. twoDimVertR1
  3625. ],
  3626. [
  3627. 3,
  3628. twoDimVertR1
  3629. ],
  3630. [
  3631. 3,
  3632. twoDimVertR1
  3633. ],
  3634. [
  3635. 3,
  3636. twoDimVertR1
  3637. ],
  3638. [
  3639. 1,
  3640. twoDimVert0
  3641. ],
  3642. [
  3643. 1,
  3644. twoDimVert0
  3645. ],
  3646. [
  3647. 1,
  3648. twoDimVert0
  3649. ],
  3650. [
  3651. 1,
  3652. twoDimVert0
  3653. ],
  3654. [
  3655. 1,
  3656. twoDimVert0
  3657. ],
  3658. [
  3659. 1,
  3660. twoDimVert0
  3661. ],
  3662. [
  3663. 1,
  3664. twoDimVert0
  3665. ],
  3666. [
  3667. 1,
  3668. twoDimVert0
  3669. ],
  3670. [
  3671. 1,
  3672. twoDimVert0
  3673. ],
  3674. [
  3675. 1,
  3676. twoDimVert0
  3677. ],
  3678. [
  3679. 1,
  3680. twoDimVert0
  3681. ],
  3682. [
  3683. 1,
  3684. twoDimVert0
  3685. ],
  3686. [
  3687. 1,
  3688. twoDimVert0
  3689. ],
  3690. [
  3691. 1,
  3692. twoDimVert0
  3693. ],
  3694. [
  3695. 1,
  3696. twoDimVert0
  3697. ],
  3698. [
  3699. 1,
  3700. twoDimVert0
  3701. ],
  3702. [
  3703. 1,
  3704. twoDimVert0
  3705. ],
  3706. [
  3707. 1,
  3708. twoDimVert0
  3709. ],
  3710. [
  3711. 1,
  3712. twoDimVert0
  3713. ],
  3714. [
  3715. 1,
  3716. twoDimVert0
  3717. ],
  3718. [
  3719. 1,
  3720. twoDimVert0
  3721. ],
  3722. [
  3723. 1,
  3724. twoDimVert0
  3725. ],
  3726. [
  3727. 1,
  3728. twoDimVert0
  3729. ],
  3730. [
  3731. 1,
  3732. twoDimVert0
  3733. ],
  3734. [
  3735. 1,
  3736. twoDimVert0
  3737. ],
  3738. [
  3739. 1,
  3740. twoDimVert0
  3741. ],
  3742. [
  3743. 1,
  3744. twoDimVert0
  3745. ],
  3746. [
  3747. 1,
  3748. twoDimVert0
  3749. ],
  3750. [
  3751. 1,
  3752. twoDimVert0
  3753. ],
  3754. [
  3755. 1,
  3756. twoDimVert0
  3757. ],
  3758. [
  3759. 1,
  3760. twoDimVert0
  3761. ],
  3762. [
  3763. 1,
  3764. twoDimVert0
  3765. ],
  3766. [
  3767. 1,
  3768. twoDimVert0
  3769. ],
  3770. [
  3771. 1,
  3772. twoDimVert0
  3773. ],
  3774. [
  3775. 1,
  3776. twoDimVert0
  3777. ],
  3778. [
  3779. 1,
  3780. twoDimVert0
  3781. ],
  3782. [
  3783. 1,
  3784. twoDimVert0
  3785. ],
  3786. [
  3787. 1,
  3788. twoDimVert0
  3789. ],
  3790. [
  3791. 1,
  3792. twoDimVert0
  3793. ],
  3794. [
  3795. 1,
  3796. twoDimVert0
  3797. ],
  3798. [
  3799. 1,
  3800. twoDimVert0
  3801. ],
  3802. [
  3803. 1,
  3804. twoDimVert0
  3805. ],
  3806. [
  3807. 1,
  3808. twoDimVert0
  3809. ],
  3810. [
  3811. 1,
  3812. twoDimVert0
  3813. ],
  3814. [
  3815. 1,
  3816. twoDimVert0
  3817. ],
  3818. [
  3819. 1,
  3820. twoDimVert0
  3821. ],
  3822. [
  3823. 1,
  3824. twoDimVert0
  3825. ],
  3826. [
  3827. 1,
  3828. twoDimVert0
  3829. ],
  3830. [
  3831. 1,
  3832. twoDimVert0
  3833. ],
  3834. [
  3835. 1,
  3836. twoDimVert0
  3837. ],
  3838. [
  3839. 1,
  3840. twoDimVert0
  3841. ],
  3842. [
  3843. 1,
  3844. twoDimVert0
  3845. ],
  3846. [
  3847. 1,
  3848. twoDimVert0
  3849. ],
  3850. [
  3851. 1,
  3852. twoDimVert0
  3853. ],
  3854. [
  3855. 1,
  3856. twoDimVert0
  3857. ],
  3858. [
  3859. 1,
  3860. twoDimVert0
  3861. ],
  3862. [
  3863. 1,
  3864. twoDimVert0
  3865. ],
  3866. [
  3867. 1,
  3868. twoDimVert0
  3869. ],
  3870. [
  3871. 1,
  3872. twoDimVert0
  3873. ],
  3874. [
  3875. 1,
  3876. twoDimVert0
  3877. ],
  3878. [
  3879. 1,
  3880. twoDimVert0
  3881. ],
  3882. [
  3883. 1,
  3884. twoDimVert0
  3885. ],
  3886. [
  3887. 1,
  3888. twoDimVert0
  3889. ],
  3890. [
  3891. 1,
  3892. twoDimVert0
  3893. ]
  3894. ];
  3895. var whiteTable1 = [
  3896. [
  3897. -1,
  3898. -1
  3899. ],
  3900. [
  3901. 12,
  3902. ccittEOL
  3903. ],
  3904. [
  3905. -1,
  3906. -1
  3907. ],
  3908. [
  3909. -1,
  3910. -1
  3911. ],
  3912. [
  3913. -1,
  3914. -1
  3915. ],
  3916. [
  3917. -1,
  3918. -1
  3919. ],
  3920. [
  3921. -1,
  3922. -1
  3923. ],
  3924. [
  3925. -1,
  3926. -1
  3927. ],
  3928. [
  3929. -1,
  3930. -1
  3931. ],
  3932. [
  3933. -1,
  3934. -1
  3935. ],
  3936. [
  3937. -1,
  3938. -1
  3939. ],
  3940. [
  3941. -1,
  3942. -1
  3943. ],
  3944. [
  3945. -1,
  3946. -1
  3947. ],
  3948. [
  3949. -1,
  3950. -1
  3951. ],
  3952. [
  3953. -1,
  3954. -1
  3955. ],
  3956. [
  3957. -1,
  3958. -1
  3959. ],
  3960. [
  3961. 11,
  3962. 1792
  3963. ],
  3964. [
  3965. 11,
  3966. 1792
  3967. ],
  3968. [
  3969. 12,
  3970. 1984
  3971. ],
  3972. [
  3973. 12,
  3974. 2048
  3975. ],
  3976. [
  3977. 12,
  3978. 2112
  3979. ],
  3980. [
  3981. 12,
  3982. 2176
  3983. ],
  3984. [
  3985. 12,
  3986. 2240
  3987. ],
  3988. [
  3989. 12,
  3990. 2304
  3991. ],
  3992. [
  3993. 11,
  3994. 1856
  3995. ],
  3996. [
  3997. 11,
  3998. 1856
  3999. ],
  4000. [
  4001. 11,
  4002. 1920
  4003. ],
  4004. [
  4005. 11,
  4006. 1920
  4007. ],
  4008. [
  4009. 12,
  4010. 2368
  4011. ],
  4012. [
  4013. 12,
  4014. 2432
  4015. ],
  4016. [
  4017. 12,
  4018. 2496
  4019. ],
  4020. [
  4021. 12,
  4022. 2560
  4023. ]
  4024. ];
  4025. var whiteTable2 = [
  4026. [
  4027. -1,
  4028. -1
  4029. ],
  4030. [
  4031. -1,
  4032. -1
  4033. ],
  4034. [
  4035. -1,
  4036. -1
  4037. ],
  4038. [
  4039. -1,
  4040. -1
  4041. ],
  4042. [
  4043. 8,
  4044. 29
  4045. ],
  4046. [
  4047. 8,
  4048. 29
  4049. ],
  4050. [
  4051. 8,
  4052. 30
  4053. ],
  4054. [
  4055. 8,
  4056. 30
  4057. ],
  4058. [
  4059. 8,
  4060. 45
  4061. ],
  4062. [
  4063. 8,
  4064. 45
  4065. ],
  4066. [
  4067. 8,
  4068. 46
  4069. ],
  4070. [
  4071. 8,
  4072. 46
  4073. ],
  4074. [
  4075. 7,
  4076. 22
  4077. ],
  4078. [
  4079. 7,
  4080. 22
  4081. ],
  4082. [
  4083. 7,
  4084. 22
  4085. ],
  4086. [
  4087. 7,
  4088. 22
  4089. ],
  4090. [
  4091. 7,
  4092. 23
  4093. ],
  4094. [
  4095. 7,
  4096. 23
  4097. ],
  4098. [
  4099. 7,
  4100. 23
  4101. ],
  4102. [
  4103. 7,
  4104. 23
  4105. ],
  4106. [
  4107. 8,
  4108. 47
  4109. ],
  4110. [
  4111. 8,
  4112. 47
  4113. ],
  4114. [
  4115. 8,
  4116. 48
  4117. ],
  4118. [
  4119. 8,
  4120. 48
  4121. ],
  4122. [
  4123. 6,
  4124. 13
  4125. ],
  4126. [
  4127. 6,
  4128. 13
  4129. ],
  4130. [
  4131. 6,
  4132. 13
  4133. ],
  4134. [
  4135. 6,
  4136. 13
  4137. ],
  4138. [
  4139. 6,
  4140. 13
  4141. ],
  4142. [
  4143. 6,
  4144. 13
  4145. ],
  4146. [
  4147. 6,
  4148. 13
  4149. ],
  4150. [
  4151. 6,
  4152. 13
  4153. ],
  4154. [
  4155. 7,
  4156. 20
  4157. ],
  4158. [
  4159. 7,
  4160. 20
  4161. ],
  4162. [
  4163. 7,
  4164. 20
  4165. ],
  4166. [
  4167. 7,
  4168. 20
  4169. ],
  4170. [
  4171. 8,
  4172. 33
  4173. ],
  4174. [
  4175. 8,
  4176. 33
  4177. ],
  4178. [
  4179. 8,
  4180. 34
  4181. ],
  4182. [
  4183. 8,
  4184. 34
  4185. ],
  4186. [
  4187. 8,
  4188. 35
  4189. ],
  4190. [
  4191. 8,
  4192. 35
  4193. ],
  4194. [
  4195. 8,
  4196. 36
  4197. ],
  4198. [
  4199. 8,
  4200. 36
  4201. ],
  4202. [
  4203. 8,
  4204. 37
  4205. ],
  4206. [
  4207. 8,
  4208. 37
  4209. ],
  4210. [
  4211. 8,
  4212. 38
  4213. ],
  4214. [
  4215. 8,
  4216. 38
  4217. ],
  4218. [
  4219. 7,
  4220. 19
  4221. ],
  4222. [
  4223. 7,
  4224. 19
  4225. ],
  4226. [
  4227. 7,
  4228. 19
  4229. ],
  4230. [
  4231. 7,
  4232. 19
  4233. ],
  4234. [
  4235. 8,
  4236. 31
  4237. ],
  4238. [
  4239. 8,
  4240. 31
  4241. ],
  4242. [
  4243. 8,
  4244. 32
  4245. ],
  4246. [
  4247. 8,
  4248. 32
  4249. ],
  4250. [
  4251. 6,
  4252. 1
  4253. ],
  4254. [
  4255. 6,
  4256. 1
  4257. ],
  4258. [
  4259. 6,
  4260. 1
  4261. ],
  4262. [
  4263. 6,
  4264. 1
  4265. ],
  4266. [
  4267. 6,
  4268. 1
  4269. ],
  4270. [
  4271. 6,
  4272. 1
  4273. ],
  4274. [
  4275. 6,
  4276. 1
  4277. ],
  4278. [
  4279. 6,
  4280. 1
  4281. ],
  4282. [
  4283. 6,
  4284. 12
  4285. ],
  4286. [
  4287. 6,
  4288. 12
  4289. ],
  4290. [
  4291. 6,
  4292. 12
  4293. ],
  4294. [
  4295. 6,
  4296. 12
  4297. ],
  4298. [
  4299. 6,
  4300. 12
  4301. ],
  4302. [
  4303. 6,
  4304. 12
  4305. ],
  4306. [
  4307. 6,
  4308. 12
  4309. ],
  4310. [
  4311. 6,
  4312. 12
  4313. ],
  4314. [
  4315. 8,
  4316. 53
  4317. ],
  4318. [
  4319. 8,
  4320. 53
  4321. ],
  4322. [
  4323. 8,
  4324. 54
  4325. ],
  4326. [
  4327. 8,
  4328. 54
  4329. ],
  4330. [
  4331. 7,
  4332. 26
  4333. ],
  4334. [
  4335. 7,
  4336. 26
  4337. ],
  4338. [
  4339. 7,
  4340. 26
  4341. ],
  4342. [
  4343. 7,
  4344. 26
  4345. ],
  4346. [
  4347. 8,
  4348. 39
  4349. ],
  4350. [
  4351. 8,
  4352. 39
  4353. ],
  4354. [
  4355. 8,
  4356. 40
  4357. ],
  4358. [
  4359. 8,
  4360. 40
  4361. ],
  4362. [
  4363. 8,
  4364. 41
  4365. ],
  4366. [
  4367. 8,
  4368. 41
  4369. ],
  4370. [
  4371. 8,
  4372. 42
  4373. ],
  4374. [
  4375. 8,
  4376. 42
  4377. ],
  4378. [
  4379. 8,
  4380. 43
  4381. ],
  4382. [
  4383. 8,
  4384. 43
  4385. ],
  4386. [
  4387. 8,
  4388. 44
  4389. ],
  4390. [
  4391. 8,
  4392. 44
  4393. ],
  4394. [
  4395. 7,
  4396. 21
  4397. ],
  4398. [
  4399. 7,
  4400. 21
  4401. ],
  4402. [
  4403. 7,
  4404. 21
  4405. ],
  4406. [
  4407. 7,
  4408. 21
  4409. ],
  4410. [
  4411. 7,
  4412. 28
  4413. ],
  4414. [
  4415. 7,
  4416. 28
  4417. ],
  4418. [
  4419. 7,
  4420. 28
  4421. ],
  4422. [
  4423. 7,
  4424. 28
  4425. ],
  4426. [
  4427. 8,
  4428. 61
  4429. ],
  4430. [
  4431. 8,
  4432. 61
  4433. ],
  4434. [
  4435. 8,
  4436. 62
  4437. ],
  4438. [
  4439. 8,
  4440. 62
  4441. ],
  4442. [
  4443. 8,
  4444. 63
  4445. ],
  4446. [
  4447. 8,
  4448. 63
  4449. ],
  4450. [
  4451. 8,
  4452. 0
  4453. ],
  4454. [
  4455. 8,
  4456. 0
  4457. ],
  4458. [
  4459. 8,
  4460. 320
  4461. ],
  4462. [
  4463. 8,
  4464. 320
  4465. ],
  4466. [
  4467. 8,
  4468. 384
  4469. ],
  4470. [
  4471. 8,
  4472. 384
  4473. ],
  4474. [
  4475. 5,
  4476. 10
  4477. ],
  4478. [
  4479. 5,
  4480. 10
  4481. ],
  4482. [
  4483. 5,
  4484. 10
  4485. ],
  4486. [
  4487. 5,
  4488. 10
  4489. ],
  4490. [
  4491. 5,
  4492. 10
  4493. ],
  4494. [
  4495. 5,
  4496. 10
  4497. ],
  4498. [
  4499. 5,
  4500. 10
  4501. ],
  4502. [
  4503. 5,
  4504. 10
  4505. ],
  4506. [
  4507. 5,
  4508. 10
  4509. ],
  4510. [
  4511. 5,
  4512. 10
  4513. ],
  4514. [
  4515. 5,
  4516. 10
  4517. ],
  4518. [
  4519. 5,
  4520. 10
  4521. ],
  4522. [
  4523. 5,
  4524. 10
  4525. ],
  4526. [
  4527. 5,
  4528. 10
  4529. ],
  4530. [
  4531. 5,
  4532. 10
  4533. ],
  4534. [
  4535. 5,
  4536. 10
  4537. ],
  4538. [
  4539. 5,
  4540. 11
  4541. ],
  4542. [
  4543. 5,
  4544. 11
  4545. ],
  4546. [
  4547. 5,
  4548. 11
  4549. ],
  4550. [
  4551. 5,
  4552. 11
  4553. ],
  4554. [
  4555. 5,
  4556. 11
  4557. ],
  4558. [
  4559. 5,
  4560. 11
  4561. ],
  4562. [
  4563. 5,
  4564. 11
  4565. ],
  4566. [
  4567. 5,
  4568. 11
  4569. ],
  4570. [
  4571. 5,
  4572. 11
  4573. ],
  4574. [
  4575. 5,
  4576. 11
  4577. ],
  4578. [
  4579. 5,
  4580. 11
  4581. ],
  4582. [
  4583. 5,
  4584. 11
  4585. ],
  4586. [
  4587. 5,
  4588. 11
  4589. ],
  4590. [
  4591. 5,
  4592. 11
  4593. ],
  4594. [
  4595. 5,
  4596. 11
  4597. ],
  4598. [
  4599. 5,
  4600. 11
  4601. ],
  4602. [
  4603. 7,
  4604. 27
  4605. ],
  4606. [
  4607. 7,
  4608. 27
  4609. ],
  4610. [
  4611. 7,
  4612. 27
  4613. ],
  4614. [
  4615. 7,
  4616. 27
  4617. ],
  4618. [
  4619. 8,
  4620. 59
  4621. ],
  4622. [
  4623. 8,
  4624. 59
  4625. ],
  4626. [
  4627. 8,
  4628. 60
  4629. ],
  4630. [
  4631. 8,
  4632. 60
  4633. ],
  4634. [
  4635. 9,
  4636. 1472
  4637. ],
  4638. [
  4639. 9,
  4640. 1536
  4641. ],
  4642. [
  4643. 9,
  4644. 1600
  4645. ],
  4646. [
  4647. 9,
  4648. 1728
  4649. ],
  4650. [
  4651. 7,
  4652. 18
  4653. ],
  4654. [
  4655. 7,
  4656. 18
  4657. ],
  4658. [
  4659. 7,
  4660. 18
  4661. ],
  4662. [
  4663. 7,
  4664. 18
  4665. ],
  4666. [
  4667. 7,
  4668. 24
  4669. ],
  4670. [
  4671. 7,
  4672. 24
  4673. ],
  4674. [
  4675. 7,
  4676. 24
  4677. ],
  4678. [
  4679. 7,
  4680. 24
  4681. ],
  4682. [
  4683. 8,
  4684. 49
  4685. ],
  4686. [
  4687. 8,
  4688. 49
  4689. ],
  4690. [
  4691. 8,
  4692. 50
  4693. ],
  4694. [
  4695. 8,
  4696. 50
  4697. ],
  4698. [
  4699. 8,
  4700. 51
  4701. ],
  4702. [
  4703. 8,
  4704. 51
  4705. ],
  4706. [
  4707. 8,
  4708. 52
  4709. ],
  4710. [
  4711. 8,
  4712. 52
  4713. ],
  4714. [
  4715. 7,
  4716. 25
  4717. ],
  4718. [
  4719. 7,
  4720. 25
  4721. ],
  4722. [
  4723. 7,
  4724. 25
  4725. ],
  4726. [
  4727. 7,
  4728. 25
  4729. ],
  4730. [
  4731. 8,
  4732. 55
  4733. ],
  4734. [
  4735. 8,
  4736. 55
  4737. ],
  4738. [
  4739. 8,
  4740. 56
  4741. ],
  4742. [
  4743. 8,
  4744. 56
  4745. ],
  4746. [
  4747. 8,
  4748. 57
  4749. ],
  4750. [
  4751. 8,
  4752. 57
  4753. ],
  4754. [
  4755. 8,
  4756. 58
  4757. ],
  4758. [
  4759. 8,
  4760. 58
  4761. ],
  4762. [
  4763. 6,
  4764. 192
  4765. ],
  4766. [
  4767. 6,
  4768. 192
  4769. ],
  4770. [
  4771. 6,
  4772. 192
  4773. ],
  4774. [
  4775. 6,
  4776. 192
  4777. ],
  4778. [
  4779. 6,
  4780. 192
  4781. ],
  4782. [
  4783. 6,
  4784. 192
  4785. ],
  4786. [
  4787. 6,
  4788. 192
  4789. ],
  4790. [
  4791. 6,
  4792. 192
  4793. ],
  4794. [
  4795. 6,
  4796. 1664
  4797. ],
  4798. [
  4799. 6,
  4800. 1664
  4801. ],
  4802. [
  4803. 6,
  4804. 1664
  4805. ],
  4806. [
  4807. 6,
  4808. 1664
  4809. ],
  4810. [
  4811. 6,
  4812. 1664
  4813. ],
  4814. [
  4815. 6,
  4816. 1664
  4817. ],
  4818. [
  4819. 6,
  4820. 1664
  4821. ],
  4822. [
  4823. 6,
  4824. 1664
  4825. ],
  4826. [
  4827. 8,
  4828. 448
  4829. ],
  4830. [
  4831. 8,
  4832. 448
  4833. ],
  4834. [
  4835. 8,
  4836. 512
  4837. ],
  4838. [
  4839. 8,
  4840. 512
  4841. ],
  4842. [
  4843. 9,
  4844. 704
  4845. ],
  4846. [
  4847. 9,
  4848. 768
  4849. ],
  4850. [
  4851. 8,
  4852. 640
  4853. ],
  4854. [
  4855. 8,
  4856. 640
  4857. ],
  4858. [
  4859. 8,
  4860. 576
  4861. ],
  4862. [
  4863. 8,
  4864. 576
  4865. ],
  4866. [
  4867. 9,
  4868. 832
  4869. ],
  4870. [
  4871. 9,
  4872. 896
  4873. ],
  4874. [
  4875. 9,
  4876. 960
  4877. ],
  4878. [
  4879. 9,
  4880. 1024
  4881. ],
  4882. [
  4883. 9,
  4884. 1088
  4885. ],
  4886. [
  4887. 9,
  4888. 1152
  4889. ],
  4890. [
  4891. 9,
  4892. 1216
  4893. ],
  4894. [
  4895. 9,
  4896. 1280
  4897. ],
  4898. [
  4899. 9,
  4900. 1344
  4901. ],
  4902. [
  4903. 9,
  4904. 1408
  4905. ],
  4906. [
  4907. 7,
  4908. 256
  4909. ],
  4910. [
  4911. 7,
  4912. 256
  4913. ],
  4914. [
  4915. 7,
  4916. 256
  4917. ],
  4918. [
  4919. 7,
  4920. 256
  4921. ],
  4922. [
  4923. 4,
  4924. 2
  4925. ],
  4926. [
  4927. 4,
  4928. 2
  4929. ],
  4930. [
  4931. 4,
  4932. 2
  4933. ],
  4934. [
  4935. 4,
  4936. 2
  4937. ],
  4938. [
  4939. 4,
  4940. 2
  4941. ],
  4942. [
  4943. 4,
  4944. 2
  4945. ],
  4946. [
  4947. 4,
  4948. 2
  4949. ],
  4950. [
  4951. 4,
  4952. 2
  4953. ],
  4954. [
  4955. 4,
  4956. 2
  4957. ],
  4958. [
  4959. 4,
  4960. 2
  4961. ],
  4962. [
  4963. 4,
  4964. 2
  4965. ],
  4966. [
  4967. 4,
  4968. 2
  4969. ],
  4970. [
  4971. 4,
  4972. 2
  4973. ],
  4974. [
  4975. 4,
  4976. 2
  4977. ],
  4978. [
  4979. 4,
  4980. 2
  4981. ],
  4982. [
  4983. 4,
  4984. 2
  4985. ],
  4986. [
  4987. 4,
  4988. 2
  4989. ],
  4990. [
  4991. 4,
  4992. 2
  4993. ],
  4994. [
  4995. 4,
  4996. 2
  4997. ],
  4998. [
  4999. 4,
  5000. 2
  5001. ],
  5002. [
  5003. 4,
  5004. 2
  5005. ],
  5006. [
  5007. 4,
  5008. 2
  5009. ],
  5010. [
  5011. 4,
  5012. 2
  5013. ],
  5014. [
  5015. 4,
  5016. 2
  5017. ],
  5018. [
  5019. 4,
  5020. 2
  5021. ],
  5022. [
  5023. 4,
  5024. 2
  5025. ],
  5026. [
  5027. 4,
  5028. 2
  5029. ],
  5030. [
  5031. 4,
  5032. 2
  5033. ],
  5034. [
  5035. 4,
  5036. 2
  5037. ],
  5038. [
  5039. 4,
  5040. 2
  5041. ],
  5042. [
  5043. 4,
  5044. 2
  5045. ],
  5046. [
  5047. 4,
  5048. 2
  5049. ],
  5050. [
  5051. 4,
  5052. 3
  5053. ],
  5054. [
  5055. 4,
  5056. 3
  5057. ],
  5058. [
  5059. 4,
  5060. 3
  5061. ],
  5062. [
  5063. 4,
  5064. 3
  5065. ],
  5066. [
  5067. 4,
  5068. 3
  5069. ],
  5070. [
  5071. 4,
  5072. 3
  5073. ],
  5074. [
  5075. 4,
  5076. 3
  5077. ],
  5078. [
  5079. 4,
  5080. 3
  5081. ],
  5082. [
  5083. 4,
  5084. 3
  5085. ],
  5086. [
  5087. 4,
  5088. 3
  5089. ],
  5090. [
  5091. 4,
  5092. 3
  5093. ],
  5094. [
  5095. 4,
  5096. 3
  5097. ],
  5098. [
  5099. 4,
  5100. 3
  5101. ],
  5102. [
  5103. 4,
  5104. 3
  5105. ],
  5106. [
  5107. 4,
  5108. 3
  5109. ],
  5110. [
  5111. 4,
  5112. 3
  5113. ],
  5114. [
  5115. 4,
  5116. 3
  5117. ],
  5118. [
  5119. 4,
  5120. 3
  5121. ],
  5122. [
  5123. 4,
  5124. 3
  5125. ],
  5126. [
  5127. 4,
  5128. 3
  5129. ],
  5130. [
  5131. 4,
  5132. 3
  5133. ],
  5134. [
  5135. 4,
  5136. 3
  5137. ],
  5138. [
  5139. 4,
  5140. 3
  5141. ],
  5142. [
  5143. 4,
  5144. 3
  5145. ],
  5146. [
  5147. 4,
  5148. 3
  5149. ],
  5150. [
  5151. 4,
  5152. 3
  5153. ],
  5154. [
  5155. 4,
  5156. 3
  5157. ],
  5158. [
  5159. 4,
  5160. 3
  5161. ],
  5162. [
  5163. 4,
  5164. 3
  5165. ],
  5166. [
  5167. 4,
  5168. 3
  5169. ],
  5170. [
  5171. 4,
  5172. 3
  5173. ],
  5174. [
  5175. 4,
  5176. 3
  5177. ],
  5178. [
  5179. 5,
  5180. 128
  5181. ],
  5182. [
  5183. 5,
  5184. 128
  5185. ],
  5186. [
  5187. 5,
  5188. 128
  5189. ],
  5190. [
  5191. 5,
  5192. 128
  5193. ],
  5194. [
  5195. 5,
  5196. 128
  5197. ],
  5198. [
  5199. 5,
  5200. 128
  5201. ],
  5202. [
  5203. 5,
  5204. 128
  5205. ],
  5206. [
  5207. 5,
  5208. 128
  5209. ],
  5210. [
  5211. 5,
  5212. 128
  5213. ],
  5214. [
  5215. 5,
  5216. 128
  5217. ],
  5218. [
  5219. 5,
  5220. 128
  5221. ],
  5222. [
  5223. 5,
  5224. 128
  5225. ],
  5226. [
  5227. 5,
  5228. 128
  5229. ],
  5230. [
  5231. 5,
  5232. 128
  5233. ],
  5234. [
  5235. 5,
  5236. 128
  5237. ],
  5238. [
  5239. 5,
  5240. 128
  5241. ],
  5242. [
  5243. 5,
  5244. 8
  5245. ],
  5246. [
  5247. 5,
  5248. 8
  5249. ],
  5250. [
  5251. 5,
  5252. 8
  5253. ],
  5254. [
  5255. 5,
  5256. 8
  5257. ],
  5258. [
  5259. 5,
  5260. 8
  5261. ],
  5262. [
  5263. 5,
  5264. 8
  5265. ],
  5266. [
  5267. 5,
  5268. 8
  5269. ],
  5270. [
  5271. 5,
  5272. 8
  5273. ],
  5274. [
  5275. 5,
  5276. 8
  5277. ],
  5278. [
  5279. 5,
  5280. 8
  5281. ],
  5282. [
  5283. 5,
  5284. 8
  5285. ],
  5286. [
  5287. 5,
  5288. 8
  5289. ],
  5290. [
  5291. 5,
  5292. 8
  5293. ],
  5294. [
  5295. 5,
  5296. 8
  5297. ],
  5298. [
  5299. 5,
  5300. 8
  5301. ],
  5302. [
  5303. 5,
  5304. 8
  5305. ],
  5306. [
  5307. 5,
  5308. 9
  5309. ],
  5310. [
  5311. 5,
  5312. 9
  5313. ],
  5314. [
  5315. 5,
  5316. 9
  5317. ],
  5318. [
  5319. 5,
  5320. 9
  5321. ],
  5322. [
  5323. 5,
  5324. 9
  5325. ],
  5326. [
  5327. 5,
  5328. 9
  5329. ],
  5330. [
  5331. 5,
  5332. 9
  5333. ],
  5334. [
  5335. 5,
  5336. 9
  5337. ],
  5338. [
  5339. 5,
  5340. 9
  5341. ],
  5342. [
  5343. 5,
  5344. 9
  5345. ],
  5346. [
  5347. 5,
  5348. 9
  5349. ],
  5350. [
  5351. 5,
  5352. 9
  5353. ],
  5354. [
  5355. 5,
  5356. 9
  5357. ],
  5358. [
  5359. 5,
  5360. 9
  5361. ],
  5362. [
  5363. 5,
  5364. 9
  5365. ],
  5366. [
  5367. 5,
  5368. 9
  5369. ],
  5370. [
  5371. 6,
  5372. 16
  5373. ],
  5374. [
  5375. 6,
  5376. 16
  5377. ],
  5378. [
  5379. 6,
  5380. 16
  5381. ],
  5382. [
  5383. 6,
  5384. 16
  5385. ],
  5386. [
  5387. 6,
  5388. 16
  5389. ],
  5390. [
  5391. 6,
  5392. 16
  5393. ],
  5394. [
  5395. 6,
  5396. 16
  5397. ],
  5398. [
  5399. 6,
  5400. 16
  5401. ],
  5402. [
  5403. 6,
  5404. 17
  5405. ],
  5406. [
  5407. 6,
  5408. 17
  5409. ],
  5410. [
  5411. 6,
  5412. 17
  5413. ],
  5414. [
  5415. 6,
  5416. 17
  5417. ],
  5418. [
  5419. 6,
  5420. 17
  5421. ],
  5422. [
  5423. 6,
  5424. 17
  5425. ],
  5426. [
  5427. 6,
  5428. 17
  5429. ],
  5430. [
  5431. 6,
  5432. 17
  5433. ],
  5434. [
  5435. 4,
  5436. 4
  5437. ],
  5438. [
  5439. 4,
  5440. 4
  5441. ],
  5442. [
  5443. 4,
  5444. 4
  5445. ],
  5446. [
  5447. 4,
  5448. 4
  5449. ],
  5450. [
  5451. 4,
  5452. 4
  5453. ],
  5454. [
  5455. 4,
  5456. 4
  5457. ],
  5458. [
  5459. 4,
  5460. 4
  5461. ],
  5462. [
  5463. 4,
  5464. 4
  5465. ],
  5466. [
  5467. 4,
  5468. 4
  5469. ],
  5470. [
  5471. 4,
  5472. 4
  5473. ],
  5474. [
  5475. 4,
  5476. 4
  5477. ],
  5478. [
  5479. 4,
  5480. 4
  5481. ],
  5482. [
  5483. 4,
  5484. 4
  5485. ],
  5486. [
  5487. 4,
  5488. 4
  5489. ],
  5490. [
  5491. 4,
  5492. 4
  5493. ],
  5494. [
  5495. 4,
  5496. 4
  5497. ],
  5498. [
  5499. 4,
  5500. 4
  5501. ],
  5502. [
  5503. 4,
  5504. 4
  5505. ],
  5506. [
  5507. 4,
  5508. 4
  5509. ],
  5510. [
  5511. 4,
  5512. 4
  5513. ],
  5514. [
  5515. 4,
  5516. 4
  5517. ],
  5518. [
  5519. 4,
  5520. 4
  5521. ],
  5522. [
  5523. 4,
  5524. 4
  5525. ],
  5526. [
  5527. 4,
  5528. 4
  5529. ],
  5530. [
  5531. 4,
  5532. 4
  5533. ],
  5534. [
  5535. 4,
  5536. 4
  5537. ],
  5538. [
  5539. 4,
  5540. 4
  5541. ],
  5542. [
  5543. 4,
  5544. 4
  5545. ],
  5546. [
  5547. 4,
  5548. 4
  5549. ],
  5550. [
  5551. 4,
  5552. 4
  5553. ],
  5554. [
  5555. 4,
  5556. 4
  5557. ],
  5558. [
  5559. 4,
  5560. 4
  5561. ],
  5562. [
  5563. 4,
  5564. 5
  5565. ],
  5566. [
  5567. 4,
  5568. 5
  5569. ],
  5570. [
  5571. 4,
  5572. 5
  5573. ],
  5574. [
  5575. 4,
  5576. 5
  5577. ],
  5578. [
  5579. 4,
  5580. 5
  5581. ],
  5582. [
  5583. 4,
  5584. 5
  5585. ],
  5586. [
  5587. 4,
  5588. 5
  5589. ],
  5590. [
  5591. 4,
  5592. 5
  5593. ],
  5594. [
  5595. 4,
  5596. 5
  5597. ],
  5598. [
  5599. 4,
  5600. 5
  5601. ],
  5602. [
  5603. 4,
  5604. 5
  5605. ],
  5606. [
  5607. 4,
  5608. 5
  5609. ],
  5610. [
  5611. 4,
  5612. 5
  5613. ],
  5614. [
  5615. 4,
  5616. 5
  5617. ],
  5618. [
  5619. 4,
  5620. 5
  5621. ],
  5622. [
  5623. 4,
  5624. 5
  5625. ],
  5626. [
  5627. 4,
  5628. 5
  5629. ],
  5630. [
  5631. 4,
  5632. 5
  5633. ],
  5634. [
  5635. 4,
  5636. 5
  5637. ],
  5638. [
  5639. 4,
  5640. 5
  5641. ],
  5642. [
  5643. 4,
  5644. 5
  5645. ],
  5646. [
  5647. 4,
  5648. 5
  5649. ],
  5650. [
  5651. 4,
  5652. 5
  5653. ],
  5654. [
  5655. 4,
  5656. 5
  5657. ],
  5658. [
  5659. 4,
  5660. 5
  5661. ],
  5662. [
  5663. 4,
  5664. 5
  5665. ],
  5666. [
  5667. 4,
  5668. 5
  5669. ],
  5670. [
  5671. 4,
  5672. 5
  5673. ],
  5674. [
  5675. 4,
  5676. 5
  5677. ],
  5678. [
  5679. 4,
  5680. 5
  5681. ],
  5682. [
  5683. 4,
  5684. 5
  5685. ],
  5686. [
  5687. 4,
  5688. 5
  5689. ],
  5690. [
  5691. 6,
  5692. 14
  5693. ],
  5694. [
  5695. 6,
  5696. 14
  5697. ],
  5698. [
  5699. 6,
  5700. 14
  5701. ],
  5702. [
  5703. 6,
  5704. 14
  5705. ],
  5706. [
  5707. 6,
  5708. 14
  5709. ],
  5710. [
  5711. 6,
  5712. 14
  5713. ],
  5714. [
  5715. 6,
  5716. 14
  5717. ],
  5718. [
  5719. 6,
  5720. 14
  5721. ],
  5722. [
  5723. 6,
  5724. 15
  5725. ],
  5726. [
  5727. 6,
  5728. 15
  5729. ],
  5730. [
  5731. 6,
  5732. 15
  5733. ],
  5734. [
  5735. 6,
  5736. 15
  5737. ],
  5738. [
  5739. 6,
  5740. 15
  5741. ],
  5742. [
  5743. 6,
  5744. 15
  5745. ],
  5746. [
  5747. 6,
  5748. 15
  5749. ],
  5750. [
  5751. 6,
  5752. 15
  5753. ],
  5754. [
  5755. 5,
  5756. 64
  5757. ],
  5758. [
  5759. 5,
  5760. 64
  5761. ],
  5762. [
  5763. 5,
  5764. 64
  5765. ],
  5766. [
  5767. 5,
  5768. 64
  5769. ],
  5770. [
  5771. 5,
  5772. 64
  5773. ],
  5774. [
  5775. 5,
  5776. 64
  5777. ],
  5778. [
  5779. 5,
  5780. 64
  5781. ],
  5782. [
  5783. 5,
  5784. 64
  5785. ],
  5786. [
  5787. 5,
  5788. 64
  5789. ],
  5790. [
  5791. 5,
  5792. 64
  5793. ],
  5794. [
  5795. 5,
  5796. 64
  5797. ],
  5798. [
  5799. 5,
  5800. 64
  5801. ],
  5802. [
  5803. 5,
  5804. 64
  5805. ],
  5806. [
  5807. 5,
  5808. 64
  5809. ],
  5810. [
  5811. 5,
  5812. 64
  5813. ],
  5814. [
  5815. 5,
  5816. 64
  5817. ],
  5818. [
  5819. 4,
  5820. 6
  5821. ],
  5822. [
  5823. 4,
  5824. 6
  5825. ],
  5826. [
  5827. 4,
  5828. 6
  5829. ],
  5830. [
  5831. 4,
  5832. 6
  5833. ],
  5834. [
  5835. 4,
  5836. 6
  5837. ],
  5838. [
  5839. 4,
  5840. 6
  5841. ],
  5842. [
  5843. 4,
  5844. 6
  5845. ],
  5846. [
  5847. 4,
  5848. 6
  5849. ],
  5850. [
  5851. 4,
  5852. 6
  5853. ],
  5854. [
  5855. 4,
  5856. 6
  5857. ],
  5858. [
  5859. 4,
  5860. 6
  5861. ],
  5862. [
  5863. 4,
  5864. 6
  5865. ],
  5866. [
  5867. 4,
  5868. 6
  5869. ],
  5870. [
  5871. 4,
  5872. 6
  5873. ],
  5874. [
  5875. 4,
  5876. 6
  5877. ],
  5878. [
  5879. 4,
  5880. 6
  5881. ],
  5882. [
  5883. 4,
  5884. 6
  5885. ],
  5886. [
  5887. 4,
  5888. 6
  5889. ],
  5890. [
  5891. 4,
  5892. 6
  5893. ],
  5894. [
  5895. 4,
  5896. 6
  5897. ],
  5898. [
  5899. 4,
  5900. 6
  5901. ],
  5902. [
  5903. 4,
  5904. 6
  5905. ],
  5906. [
  5907. 4,
  5908. 6
  5909. ],
  5910. [
  5911. 4,
  5912. 6
  5913. ],
  5914. [
  5915. 4,
  5916. 6
  5917. ],
  5918. [
  5919. 4,
  5920. 6
  5921. ],
  5922. [
  5923. 4,
  5924. 6
  5925. ],
  5926. [
  5927. 4,
  5928. 6
  5929. ],
  5930. [
  5931. 4,
  5932. 6
  5933. ],
  5934. [
  5935. 4,
  5936. 6
  5937. ],
  5938. [
  5939. 4,
  5940. 6
  5941. ],
  5942. [
  5943. 4,
  5944. 6
  5945. ],
  5946. [
  5947. 4,
  5948. 7
  5949. ],
  5950. [
  5951. 4,
  5952. 7
  5953. ],
  5954. [
  5955. 4,
  5956. 7
  5957. ],
  5958. [
  5959. 4,
  5960. 7
  5961. ],
  5962. [
  5963. 4,
  5964. 7
  5965. ],
  5966. [
  5967. 4,
  5968. 7
  5969. ],
  5970. [
  5971. 4,
  5972. 7
  5973. ],
  5974. [
  5975. 4,
  5976. 7
  5977. ],
  5978. [
  5979. 4,
  5980. 7
  5981. ],
  5982. [
  5983. 4,
  5984. 7
  5985. ],
  5986. [
  5987. 4,
  5988. 7
  5989. ],
  5990. [
  5991. 4,
  5992. 7
  5993. ],
  5994. [
  5995. 4,
  5996. 7
  5997. ],
  5998. [
  5999. 4,
  6000. 7
  6001. ],
  6002. [
  6003. 4,
  6004. 7
  6005. ],
  6006. [
  6007. 4,
  6008. 7
  6009. ],
  6010. [
  6011. 4,
  6012. 7
  6013. ],
  6014. [
  6015. 4,
  6016. 7
  6017. ],
  6018. [
  6019. 4,
  6020. 7
  6021. ],
  6022. [
  6023. 4,
  6024. 7
  6025. ],
  6026. [
  6027. 4,
  6028. 7
  6029. ],
  6030. [
  6031. 4,
  6032. 7
  6033. ],
  6034. [
  6035. 4,
  6036. 7
  6037. ],
  6038. [
  6039. 4,
  6040. 7
  6041. ],
  6042. [
  6043. 4,
  6044. 7
  6045. ],
  6046. [
  6047. 4,
  6048. 7
  6049. ],
  6050. [
  6051. 4,
  6052. 7
  6053. ],
  6054. [
  6055. 4,
  6056. 7
  6057. ],
  6058. [
  6059. 4,
  6060. 7
  6061. ],
  6062. [
  6063. 4,
  6064. 7
  6065. ],
  6066. [
  6067. 4,
  6068. 7
  6069. ],
  6070. [
  6071. 4,
  6072. 7
  6073. ]
  6074. ];
  6075. var blackTable1 = [
  6076. [
  6077. -1,
  6078. -1
  6079. ],
  6080. [
  6081. -1,
  6082. -1
  6083. ],
  6084. [
  6085. 12,
  6086. ccittEOL
  6087. ],
  6088. [
  6089. 12,
  6090. ccittEOL
  6091. ],
  6092. [
  6093. -1,
  6094. -1
  6095. ],
  6096. [
  6097. -1,
  6098. -1
  6099. ],
  6100. [
  6101. -1,
  6102. -1
  6103. ],
  6104. [
  6105. -1,
  6106. -1
  6107. ],
  6108. [
  6109. -1,
  6110. -1
  6111. ],
  6112. [
  6113. -1,
  6114. -1
  6115. ],
  6116. [
  6117. -1,
  6118. -1
  6119. ],
  6120. [
  6121. -1,
  6122. -1
  6123. ],
  6124. [
  6125. -1,
  6126. -1
  6127. ],
  6128. [
  6129. -1,
  6130. -1
  6131. ],
  6132. [
  6133. -1,
  6134. -1
  6135. ],
  6136. [
  6137. -1,
  6138. -1
  6139. ],
  6140. [
  6141. -1,
  6142. -1
  6143. ],
  6144. [
  6145. -1,
  6146. -1
  6147. ],
  6148. [
  6149. -1,
  6150. -1
  6151. ],
  6152. [
  6153. -1,
  6154. -1
  6155. ],
  6156. [
  6157. -1,
  6158. -1
  6159. ],
  6160. [
  6161. -1,
  6162. -1
  6163. ],
  6164. [
  6165. -1,
  6166. -1
  6167. ],
  6168. [
  6169. -1,
  6170. -1
  6171. ],
  6172. [
  6173. -1,
  6174. -1
  6175. ],
  6176. [
  6177. -1,
  6178. -1
  6179. ],
  6180. [
  6181. -1,
  6182. -1
  6183. ],
  6184. [
  6185. -1,
  6186. -1
  6187. ],
  6188. [
  6189. -1,
  6190. -1
  6191. ],
  6192. [
  6193. -1,
  6194. -1
  6195. ],
  6196. [
  6197. -1,
  6198. -1
  6199. ],
  6200. [
  6201. -1,
  6202. -1
  6203. ],
  6204. [
  6205. 11,
  6206. 1792
  6207. ],
  6208. [
  6209. 11,
  6210. 1792
  6211. ],
  6212. [
  6213. 11,
  6214. 1792
  6215. ],
  6216. [
  6217. 11,
  6218. 1792
  6219. ],
  6220. [
  6221. 12,
  6222. 1984
  6223. ],
  6224. [
  6225. 12,
  6226. 1984
  6227. ],
  6228. [
  6229. 12,
  6230. 2048
  6231. ],
  6232. [
  6233. 12,
  6234. 2048
  6235. ],
  6236. [
  6237. 12,
  6238. 2112
  6239. ],
  6240. [
  6241. 12,
  6242. 2112
  6243. ],
  6244. [
  6245. 12,
  6246. 2176
  6247. ],
  6248. [
  6249. 12,
  6250. 2176
  6251. ],
  6252. [
  6253. 12,
  6254. 2240
  6255. ],
  6256. [
  6257. 12,
  6258. 2240
  6259. ],
  6260. [
  6261. 12,
  6262. 2304
  6263. ],
  6264. [
  6265. 12,
  6266. 2304
  6267. ],
  6268. [
  6269. 11,
  6270. 1856
  6271. ],
  6272. [
  6273. 11,
  6274. 1856
  6275. ],
  6276. [
  6277. 11,
  6278. 1856
  6279. ],
  6280. [
  6281. 11,
  6282. 1856
  6283. ],
  6284. [
  6285. 11,
  6286. 1920
  6287. ],
  6288. [
  6289. 11,
  6290. 1920
  6291. ],
  6292. [
  6293. 11,
  6294. 1920
  6295. ],
  6296. [
  6297. 11,
  6298. 1920
  6299. ],
  6300. [
  6301. 12,
  6302. 2368
  6303. ],
  6304. [
  6305. 12,
  6306. 2368
  6307. ],
  6308. [
  6309. 12,
  6310. 2432
  6311. ],
  6312. [
  6313. 12,
  6314. 2432
  6315. ],
  6316. [
  6317. 12,
  6318. 2496
  6319. ],
  6320. [
  6321. 12,
  6322. 2496
  6323. ],
  6324. [
  6325. 12,
  6326. 2560
  6327. ],
  6328. [
  6329. 12,
  6330. 2560
  6331. ],
  6332. [
  6333. 10,
  6334. 18
  6335. ],
  6336. [
  6337. 10,
  6338. 18
  6339. ],
  6340. [
  6341. 10,
  6342. 18
  6343. ],
  6344. [
  6345. 10,
  6346. 18
  6347. ],
  6348. [
  6349. 10,
  6350. 18
  6351. ],
  6352. [
  6353. 10,
  6354. 18
  6355. ],
  6356. [
  6357. 10,
  6358. 18
  6359. ],
  6360. [
  6361. 10,
  6362. 18
  6363. ],
  6364. [
  6365. 12,
  6366. 52
  6367. ],
  6368. [
  6369. 12,
  6370. 52
  6371. ],
  6372. [
  6373. 13,
  6374. 640
  6375. ],
  6376. [
  6377. 13,
  6378. 704
  6379. ],
  6380. [
  6381. 13,
  6382. 768
  6383. ],
  6384. [
  6385. 13,
  6386. 832
  6387. ],
  6388. [
  6389. 12,
  6390. 55
  6391. ],
  6392. [
  6393. 12,
  6394. 55
  6395. ],
  6396. [
  6397. 12,
  6398. 56
  6399. ],
  6400. [
  6401. 12,
  6402. 56
  6403. ],
  6404. [
  6405. 13,
  6406. 1280
  6407. ],
  6408. [
  6409. 13,
  6410. 1344
  6411. ],
  6412. [
  6413. 13,
  6414. 1408
  6415. ],
  6416. [
  6417. 13,
  6418. 1472
  6419. ],
  6420. [
  6421. 12,
  6422. 59
  6423. ],
  6424. [
  6425. 12,
  6426. 59
  6427. ],
  6428. [
  6429. 12,
  6430. 60
  6431. ],
  6432. [
  6433. 12,
  6434. 60
  6435. ],
  6436. [
  6437. 13,
  6438. 1536
  6439. ],
  6440. [
  6441. 13,
  6442. 1600
  6443. ],
  6444. [
  6445. 11,
  6446. 24
  6447. ],
  6448. [
  6449. 11,
  6450. 24
  6451. ],
  6452. [
  6453. 11,
  6454. 24
  6455. ],
  6456. [
  6457. 11,
  6458. 24
  6459. ],
  6460. [
  6461. 11,
  6462. 25
  6463. ],
  6464. [
  6465. 11,
  6466. 25
  6467. ],
  6468. [
  6469. 11,
  6470. 25
  6471. ],
  6472. [
  6473. 11,
  6474. 25
  6475. ],
  6476. [
  6477. 13,
  6478. 1664
  6479. ],
  6480. [
  6481. 13,
  6482. 1728
  6483. ],
  6484. [
  6485. 12,
  6486. 320
  6487. ],
  6488. [
  6489. 12,
  6490. 320
  6491. ],
  6492. [
  6493. 12,
  6494. 384
  6495. ],
  6496. [
  6497. 12,
  6498. 384
  6499. ],
  6500. [
  6501. 12,
  6502. 448
  6503. ],
  6504. [
  6505. 12,
  6506. 448
  6507. ],
  6508. [
  6509. 13,
  6510. 512
  6511. ],
  6512. [
  6513. 13,
  6514. 576
  6515. ],
  6516. [
  6517. 12,
  6518. 53
  6519. ],
  6520. [
  6521. 12,
  6522. 53
  6523. ],
  6524. [
  6525. 12,
  6526. 54
  6527. ],
  6528. [
  6529. 12,
  6530. 54
  6531. ],
  6532. [
  6533. 13,
  6534. 896
  6535. ],
  6536. [
  6537. 13,
  6538. 960
  6539. ],
  6540. [
  6541. 13,
  6542. 1024
  6543. ],
  6544. [
  6545. 13,
  6546. 1088
  6547. ],
  6548. [
  6549. 13,
  6550. 1152
  6551. ],
  6552. [
  6553. 13,
  6554. 1216
  6555. ],
  6556. [
  6557. 10,
  6558. 64
  6559. ],
  6560. [
  6561. 10,
  6562. 64
  6563. ],
  6564. [
  6565. 10,
  6566. 64
  6567. ],
  6568. [
  6569. 10,
  6570. 64
  6571. ],
  6572. [
  6573. 10,
  6574. 64
  6575. ],
  6576. [
  6577. 10,
  6578. 64
  6579. ],
  6580. [
  6581. 10,
  6582. 64
  6583. ],
  6584. [
  6585. 10,
  6586. 64
  6587. ]
  6588. ];
  6589. var blackTable2 = [
  6590. [
  6591. 8,
  6592. 13
  6593. ],
  6594. [
  6595. 8,
  6596. 13
  6597. ],
  6598. [
  6599. 8,
  6600. 13
  6601. ],
  6602. [
  6603. 8,
  6604. 13
  6605. ],
  6606. [
  6607. 8,
  6608. 13
  6609. ],
  6610. [
  6611. 8,
  6612. 13
  6613. ],
  6614. [
  6615. 8,
  6616. 13
  6617. ],
  6618. [
  6619. 8,
  6620. 13
  6621. ],
  6622. [
  6623. 8,
  6624. 13
  6625. ],
  6626. [
  6627. 8,
  6628. 13
  6629. ],
  6630. [
  6631. 8,
  6632. 13
  6633. ],
  6634. [
  6635. 8,
  6636. 13
  6637. ],
  6638. [
  6639. 8,
  6640. 13
  6641. ],
  6642. [
  6643. 8,
  6644. 13
  6645. ],
  6646. [
  6647. 8,
  6648. 13
  6649. ],
  6650. [
  6651. 8,
  6652. 13
  6653. ],
  6654. [
  6655. 11,
  6656. 23
  6657. ],
  6658. [
  6659. 11,
  6660. 23
  6661. ],
  6662. [
  6663. 12,
  6664. 50
  6665. ],
  6666. [
  6667. 12,
  6668. 51
  6669. ],
  6670. [
  6671. 12,
  6672. 44
  6673. ],
  6674. [
  6675. 12,
  6676. 45
  6677. ],
  6678. [
  6679. 12,
  6680. 46
  6681. ],
  6682. [
  6683. 12,
  6684. 47
  6685. ],
  6686. [
  6687. 12,
  6688. 57
  6689. ],
  6690. [
  6691. 12,
  6692. 58
  6693. ],
  6694. [
  6695. 12,
  6696. 61
  6697. ],
  6698. [
  6699. 12,
  6700. 256
  6701. ],
  6702. [
  6703. 10,
  6704. 16
  6705. ],
  6706. [
  6707. 10,
  6708. 16
  6709. ],
  6710. [
  6711. 10,
  6712. 16
  6713. ],
  6714. [
  6715. 10,
  6716. 16
  6717. ],
  6718. [
  6719. 10,
  6720. 17
  6721. ],
  6722. [
  6723. 10,
  6724. 17
  6725. ],
  6726. [
  6727. 10,
  6728. 17
  6729. ],
  6730. [
  6731. 10,
  6732. 17
  6733. ],
  6734. [
  6735. 12,
  6736. 48
  6737. ],
  6738. [
  6739. 12,
  6740. 49
  6741. ],
  6742. [
  6743. 12,
  6744. 62
  6745. ],
  6746. [
  6747. 12,
  6748. 63
  6749. ],
  6750. [
  6751. 12,
  6752. 30
  6753. ],
  6754. [
  6755. 12,
  6756. 31
  6757. ],
  6758. [
  6759. 12,
  6760. 32
  6761. ],
  6762. [
  6763. 12,
  6764. 33
  6765. ],
  6766. [
  6767. 12,
  6768. 40
  6769. ],
  6770. [
  6771. 12,
  6772. 41
  6773. ],
  6774. [
  6775. 11,
  6776. 22
  6777. ],
  6778. [
  6779. 11,
  6780. 22
  6781. ],
  6782. [
  6783. 8,
  6784. 14
  6785. ],
  6786. [
  6787. 8,
  6788. 14
  6789. ],
  6790. [
  6791. 8,
  6792. 14
  6793. ],
  6794. [
  6795. 8,
  6796. 14
  6797. ],
  6798. [
  6799. 8,
  6800. 14
  6801. ],
  6802. [
  6803. 8,
  6804. 14
  6805. ],
  6806. [
  6807. 8,
  6808. 14
  6809. ],
  6810. [
  6811. 8,
  6812. 14
  6813. ],
  6814. [
  6815. 8,
  6816. 14
  6817. ],
  6818. [
  6819. 8,
  6820. 14
  6821. ],
  6822. [
  6823. 8,
  6824. 14
  6825. ],
  6826. [
  6827. 8,
  6828. 14
  6829. ],
  6830. [
  6831. 8,
  6832. 14
  6833. ],
  6834. [
  6835. 8,
  6836. 14
  6837. ],
  6838. [
  6839. 8,
  6840. 14
  6841. ],
  6842. [
  6843. 8,
  6844. 14
  6845. ],
  6846. [
  6847. 7,
  6848. 10
  6849. ],
  6850. [
  6851. 7,
  6852. 10
  6853. ],
  6854. [
  6855. 7,
  6856. 10
  6857. ],
  6858. [
  6859. 7,
  6860. 10
  6861. ],
  6862. [
  6863. 7,
  6864. 10
  6865. ],
  6866. [
  6867. 7,
  6868. 10
  6869. ],
  6870. [
  6871. 7,
  6872. 10
  6873. ],
  6874. [
  6875. 7,
  6876. 10
  6877. ],
  6878. [
  6879. 7,
  6880. 10
  6881. ],
  6882. [
  6883. 7,
  6884. 10
  6885. ],
  6886. [
  6887. 7,
  6888. 10
  6889. ],
  6890. [
  6891. 7,
  6892. 10
  6893. ],
  6894. [
  6895. 7,
  6896. 10
  6897. ],
  6898. [
  6899. 7,
  6900. 10
  6901. ],
  6902. [
  6903. 7,
  6904. 10
  6905. ],
  6906. [
  6907. 7,
  6908. 10
  6909. ],
  6910. [
  6911. 7,
  6912. 10
  6913. ],
  6914. [
  6915. 7,
  6916. 10
  6917. ],
  6918. [
  6919. 7,
  6920. 10
  6921. ],
  6922. [
  6923. 7,
  6924. 10
  6925. ],
  6926. [
  6927. 7,
  6928. 10
  6929. ],
  6930. [
  6931. 7,
  6932. 10
  6933. ],
  6934. [
  6935. 7,
  6936. 10
  6937. ],
  6938. [
  6939. 7,
  6940. 10
  6941. ],
  6942. [
  6943. 7,
  6944. 10
  6945. ],
  6946. [
  6947. 7,
  6948. 10
  6949. ],
  6950. [
  6951. 7,
  6952. 10
  6953. ],
  6954. [
  6955. 7,
  6956. 10
  6957. ],
  6958. [
  6959. 7,
  6960. 10
  6961. ],
  6962. [
  6963. 7,
  6964. 10
  6965. ],
  6966. [
  6967. 7,
  6968. 10
  6969. ],
  6970. [
  6971. 7,
  6972. 10
  6973. ],
  6974. [
  6975. 7,
  6976. 11
  6977. ],
  6978. [
  6979. 7,
  6980. 11
  6981. ],
  6982. [
  6983. 7,
  6984. 11
  6985. ],
  6986. [
  6987. 7,
  6988. 11
  6989. ],
  6990. [
  6991. 7,
  6992. 11
  6993. ],
  6994. [
  6995. 7,
  6996. 11
  6997. ],
  6998. [
  6999. 7,
  7000. 11
  7001. ],
  7002. [
  7003. 7,
  7004. 11
  7005. ],
  7006. [
  7007. 7,
  7008. 11
  7009. ],
  7010. [
  7011. 7,
  7012. 11
  7013. ],
  7014. [
  7015. 7,
  7016. 11
  7017. ],
  7018. [
  7019. 7,
  7020. 11
  7021. ],
  7022. [
  7023. 7,
  7024. 11
  7025. ],
  7026. [
  7027. 7,
  7028. 11
  7029. ],
  7030. [
  7031. 7,
  7032. 11
  7033. ],
  7034. [
  7035. 7,
  7036. 11
  7037. ],
  7038. [
  7039. 7,
  7040. 11
  7041. ],
  7042. [
  7043. 7,
  7044. 11
  7045. ],
  7046. [
  7047. 7,
  7048. 11
  7049. ],
  7050. [
  7051. 7,
  7052. 11
  7053. ],
  7054. [
  7055. 7,
  7056. 11
  7057. ],
  7058. [
  7059. 7,
  7060. 11
  7061. ],
  7062. [
  7063. 7,
  7064. 11
  7065. ],
  7066. [
  7067. 7,
  7068. 11
  7069. ],
  7070. [
  7071. 7,
  7072. 11
  7073. ],
  7074. [
  7075. 7,
  7076. 11
  7077. ],
  7078. [
  7079. 7,
  7080. 11
  7081. ],
  7082. [
  7083. 7,
  7084. 11
  7085. ],
  7086. [
  7087. 7,
  7088. 11
  7089. ],
  7090. [
  7091. 7,
  7092. 11
  7093. ],
  7094. [
  7095. 7,
  7096. 11
  7097. ],
  7098. [
  7099. 7,
  7100. 11
  7101. ],
  7102. [
  7103. 9,
  7104. 15
  7105. ],
  7106. [
  7107. 9,
  7108. 15
  7109. ],
  7110. [
  7111. 9,
  7112. 15
  7113. ],
  7114. [
  7115. 9,
  7116. 15
  7117. ],
  7118. [
  7119. 9,
  7120. 15
  7121. ],
  7122. [
  7123. 9,
  7124. 15
  7125. ],
  7126. [
  7127. 9,
  7128. 15
  7129. ],
  7130. [
  7131. 9,
  7132. 15
  7133. ],
  7134. [
  7135. 12,
  7136. 128
  7137. ],
  7138. [
  7139. 12,
  7140. 192
  7141. ],
  7142. [
  7143. 12,
  7144. 26
  7145. ],
  7146. [
  7147. 12,
  7148. 27
  7149. ],
  7150. [
  7151. 12,
  7152. 28
  7153. ],
  7154. [
  7155. 12,
  7156. 29
  7157. ],
  7158. [
  7159. 11,
  7160. 19
  7161. ],
  7162. [
  7163. 11,
  7164. 19
  7165. ],
  7166. [
  7167. 11,
  7168. 20
  7169. ],
  7170. [
  7171. 11,
  7172. 20
  7173. ],
  7174. [
  7175. 12,
  7176. 34
  7177. ],
  7178. [
  7179. 12,
  7180. 35
  7181. ],
  7182. [
  7183. 12,
  7184. 36
  7185. ],
  7186. [
  7187. 12,
  7188. 37
  7189. ],
  7190. [
  7191. 12,
  7192. 38
  7193. ],
  7194. [
  7195. 12,
  7196. 39
  7197. ],
  7198. [
  7199. 11,
  7200. 21
  7201. ],
  7202. [
  7203. 11,
  7204. 21
  7205. ],
  7206. [
  7207. 12,
  7208. 42
  7209. ],
  7210. [
  7211. 12,
  7212. 43
  7213. ],
  7214. [
  7215. 10,
  7216. 0
  7217. ],
  7218. [
  7219. 10,
  7220. 0
  7221. ],
  7222. [
  7223. 10,
  7224. 0
  7225. ],
  7226. [
  7227. 10,
  7228. 0
  7229. ],
  7230. [
  7231. 7,
  7232. 12
  7233. ],
  7234. [
  7235. 7,
  7236. 12
  7237. ],
  7238. [
  7239. 7,
  7240. 12
  7241. ],
  7242. [
  7243. 7,
  7244. 12
  7245. ],
  7246. [
  7247. 7,
  7248. 12
  7249. ],
  7250. [
  7251. 7,
  7252. 12
  7253. ],
  7254. [
  7255. 7,
  7256. 12
  7257. ],
  7258. [
  7259. 7,
  7260. 12
  7261. ],
  7262. [
  7263. 7,
  7264. 12
  7265. ],
  7266. [
  7267. 7,
  7268. 12
  7269. ],
  7270. [
  7271. 7,
  7272. 12
  7273. ],
  7274. [
  7275. 7,
  7276. 12
  7277. ],
  7278. [
  7279. 7,
  7280. 12
  7281. ],
  7282. [
  7283. 7,
  7284. 12
  7285. ],
  7286. [
  7287. 7,
  7288. 12
  7289. ],
  7290. [
  7291. 7,
  7292. 12
  7293. ],
  7294. [
  7295. 7,
  7296. 12
  7297. ],
  7298. [
  7299. 7,
  7300. 12
  7301. ],
  7302. [
  7303. 7,
  7304. 12
  7305. ],
  7306. [
  7307. 7,
  7308. 12
  7309. ],
  7310. [
  7311. 7,
  7312. 12
  7313. ],
  7314. [
  7315. 7,
  7316. 12
  7317. ],
  7318. [
  7319. 7,
  7320. 12
  7321. ],
  7322. [
  7323. 7,
  7324. 12
  7325. ],
  7326. [
  7327. 7,
  7328. 12
  7329. ],
  7330. [
  7331. 7,
  7332. 12
  7333. ],
  7334. [
  7335. 7,
  7336. 12
  7337. ],
  7338. [
  7339. 7,
  7340. 12
  7341. ],
  7342. [
  7343. 7,
  7344. 12
  7345. ],
  7346. [
  7347. 7,
  7348. 12
  7349. ],
  7350. [
  7351. 7,
  7352. 12
  7353. ],
  7354. [
  7355. 7,
  7356. 12
  7357. ]
  7358. ];
  7359. var blackTable3 = [
  7360. [
  7361. -1,
  7362. -1
  7363. ],
  7364. [
  7365. -1,
  7366. -1
  7367. ],
  7368. [
  7369. -1,
  7370. -1
  7371. ],
  7372. [
  7373. -1,
  7374. -1
  7375. ],
  7376. [
  7377. 6,
  7378. 9
  7379. ],
  7380. [
  7381. 6,
  7382. 8
  7383. ],
  7384. [
  7385. 5,
  7386. 7
  7387. ],
  7388. [
  7389. 5,
  7390. 7
  7391. ],
  7392. [
  7393. 4,
  7394. 6
  7395. ],
  7396. [
  7397. 4,
  7398. 6
  7399. ],
  7400. [
  7401. 4,
  7402. 6
  7403. ],
  7404. [
  7405. 4,
  7406. 6
  7407. ],
  7408. [
  7409. 4,
  7410. 5
  7411. ],
  7412. [
  7413. 4,
  7414. 5
  7415. ],
  7416. [
  7417. 4,
  7418. 5
  7419. ],
  7420. [
  7421. 4,
  7422. 5
  7423. ],
  7424. [
  7425. 3,
  7426. 1
  7427. ],
  7428. [
  7429. 3,
  7430. 1
  7431. ],
  7432. [
  7433. 3,
  7434. 1
  7435. ],
  7436. [
  7437. 3,
  7438. 1
  7439. ],
  7440. [
  7441. 3,
  7442. 1
  7443. ],
  7444. [
  7445. 3,
  7446. 1
  7447. ],
  7448. [
  7449. 3,
  7450. 1
  7451. ],
  7452. [
  7453. 3,
  7454. 1
  7455. ],
  7456. [
  7457. 3,
  7458. 4
  7459. ],
  7460. [
  7461. 3,
  7462. 4
  7463. ],
  7464. [
  7465. 3,
  7466. 4
  7467. ],
  7468. [
  7469. 3,
  7470. 4
  7471. ],
  7472. [
  7473. 3,
  7474. 4
  7475. ],
  7476. [
  7477. 3,
  7478. 4
  7479. ],
  7480. [
  7481. 3,
  7482. 4
  7483. ],
  7484. [
  7485. 3,
  7486. 4
  7487. ],
  7488. [
  7489. 2,
  7490. 3
  7491. ],
  7492. [
  7493. 2,
  7494. 3
  7495. ],
  7496. [
  7497. 2,
  7498. 3
  7499. ],
  7500. [
  7501. 2,
  7502. 3
  7503. ],
  7504. [
  7505. 2,
  7506. 3
  7507. ],
  7508. [
  7509. 2,
  7510. 3
  7511. ],
  7512. [
  7513. 2,
  7514. 3
  7515. ],
  7516. [
  7517. 2,
  7518. 3
  7519. ],
  7520. [
  7521. 2,
  7522. 3
  7523. ],
  7524. [
  7525. 2,
  7526. 3
  7527. ],
  7528. [
  7529. 2,
  7530. 3
  7531. ],
  7532. [
  7533. 2,
  7534. 3
  7535. ],
  7536. [
  7537. 2,
  7538. 3
  7539. ],
  7540. [
  7541. 2,
  7542. 3
  7543. ],
  7544. [
  7545. 2,
  7546. 3
  7547. ],
  7548. [
  7549. 2,
  7550. 3
  7551. ],
  7552. [
  7553. 2,
  7554. 2
  7555. ],
  7556. [
  7557. 2,
  7558. 2
  7559. ],
  7560. [
  7561. 2,
  7562. 2
  7563. ],
  7564. [
  7565. 2,
  7566. 2
  7567. ],
  7568. [
  7569. 2,
  7570. 2
  7571. ],
  7572. [
  7573. 2,
  7574. 2
  7575. ],
  7576. [
  7577. 2,
  7578. 2
  7579. ],
  7580. [
  7581. 2,
  7582. 2
  7583. ],
  7584. [
  7585. 2,
  7586. 2
  7587. ],
  7588. [
  7589. 2,
  7590. 2
  7591. ],
  7592. [
  7593. 2,
  7594. 2
  7595. ],
  7596. [
  7597. 2,
  7598. 2
  7599. ],
  7600. [
  7601. 2,
  7602. 2
  7603. ],
  7604. [
  7605. 2,
  7606. 2
  7607. ],
  7608. [
  7609. 2,
  7610. 2
  7611. ],
  7612. [
  7613. 2,
  7614. 2
  7615. ]
  7616. ];
  7617. function CCITTFaxStream(str, maybeLength, params) {
  7618. this.str = str;
  7619. this.dict = str.dict;
  7620. params = params || Dict.empty;
  7621. this.encoding = params.get('K') || 0;
  7622. this.eoline = params.get('EndOfLine') || false;
  7623. this.byteAlign = params.get('EncodedByteAlign') || false;
  7624. this.columns = params.get('Columns') || 1728;
  7625. this.rows = params.get('Rows') || 0;
  7626. var eoblock = params.get('EndOfBlock');
  7627. if (eoblock === null || eoblock === undefined) {
  7628. eoblock = true;
  7629. }
  7630. this.eoblock = eoblock;
  7631. this.black = params.get('BlackIs1') || false;
  7632. this.codingLine = new Uint32Array(this.columns + 1);
  7633. this.refLine = new Uint32Array(this.columns + 2);
  7634. this.codingLine[0] = this.columns;
  7635. this.codingPos = 0;
  7636. this.row = 0;
  7637. this.nextLine2D = this.encoding < 0;
  7638. this.inputBits = 0;
  7639. this.inputBuf = 0;
  7640. this.outputBits = 0;
  7641. var code1;
  7642. while ((code1 = this.lookBits(12)) === 0) {
  7643. this.eatBits(1);
  7644. }
  7645. if (code1 === 1) {
  7646. this.eatBits(12);
  7647. }
  7648. if (this.encoding > 0) {
  7649. this.nextLine2D = !this.lookBits(1);
  7650. this.eatBits(1);
  7651. }
  7652. DecodeStream.call(this, maybeLength);
  7653. }
  7654. CCITTFaxStream.prototype = Object.create(DecodeStream.prototype);
  7655. CCITTFaxStream.prototype.readBlock = function CCITTFaxStream_readBlock() {
  7656. while (!this.eof) {
  7657. var c = this.lookChar();
  7658. this.ensureBuffer(this.bufferLength + 1);
  7659. this.buffer[this.bufferLength++] = c;
  7660. }
  7661. };
  7662. CCITTFaxStream.prototype.addPixels = function ccittFaxStreamAddPixels(a1, blackPixels) {
  7663. var codingLine = this.codingLine;
  7664. var codingPos = this.codingPos;
  7665. if (a1 > codingLine[codingPos]) {
  7666. if (a1 > this.columns) {
  7667. info('row is wrong length');
  7668. this.err = true;
  7669. a1 = this.columns;
  7670. }
  7671. if (codingPos & 1 ^ blackPixels) {
  7672. ++codingPos;
  7673. }
  7674. codingLine[codingPos] = a1;
  7675. }
  7676. this.codingPos = codingPos;
  7677. };
  7678. CCITTFaxStream.prototype.addPixelsNeg = function ccittFaxStreamAddPixelsNeg(a1, blackPixels) {
  7679. var codingLine = this.codingLine;
  7680. var codingPos = this.codingPos;
  7681. if (a1 > codingLine[codingPos]) {
  7682. if (a1 > this.columns) {
  7683. info('row is wrong length');
  7684. this.err = true;
  7685. a1 = this.columns;
  7686. }
  7687. if (codingPos & 1 ^ blackPixels) {
  7688. ++codingPos;
  7689. }
  7690. codingLine[codingPos] = a1;
  7691. } else if (a1 < codingLine[codingPos]) {
  7692. if (a1 < 0) {
  7693. info('invalid code');
  7694. this.err = true;
  7695. a1 = 0;
  7696. }
  7697. while (codingPos > 0 && a1 < codingLine[codingPos - 1]) {
  7698. --codingPos;
  7699. }
  7700. codingLine[codingPos] = a1;
  7701. }
  7702. this.codingPos = codingPos;
  7703. };
  7704. CCITTFaxStream.prototype.lookChar = function CCITTFaxStream_lookChar() {
  7705. var refLine = this.refLine;
  7706. var codingLine = this.codingLine;
  7707. var columns = this.columns;
  7708. var refPos, blackPixels, bits, i;
  7709. if (this.outputBits === 0) {
  7710. if (this.eof) {
  7711. return null;
  7712. }
  7713. this.err = false;
  7714. var code1, code2, code3;
  7715. if (this.nextLine2D) {
  7716. for (i = 0; codingLine[i] < columns; ++i) {
  7717. refLine[i] = codingLine[i];
  7718. }
  7719. refLine[i++] = columns;
  7720. refLine[i] = columns;
  7721. codingLine[0] = 0;
  7722. this.codingPos = 0;
  7723. refPos = 0;
  7724. blackPixels = 0;
  7725. while (codingLine[this.codingPos] < columns) {
  7726. code1 = this.getTwoDimCode();
  7727. switch (code1) {
  7728. case twoDimPass:
  7729. this.addPixels(refLine[refPos + 1], blackPixels);
  7730. if (refLine[refPos + 1] < columns) {
  7731. refPos += 2;
  7732. }
  7733. break;
  7734. case twoDimHoriz:
  7735. code1 = code2 = 0;
  7736. if (blackPixels) {
  7737. do {
  7738. code1 += code3 = this.getBlackCode();
  7739. } while (code3 >= 64);
  7740. do {
  7741. code2 += code3 = this.getWhiteCode();
  7742. } while (code3 >= 64);
  7743. } else {
  7744. do {
  7745. code1 += code3 = this.getWhiteCode();
  7746. } while (code3 >= 64);
  7747. do {
  7748. code2 += code3 = this.getBlackCode();
  7749. } while (code3 >= 64);
  7750. }
  7751. this.addPixels(codingLine[this.codingPos] + code1, blackPixels);
  7752. if (codingLine[this.codingPos] < columns) {
  7753. this.addPixels(codingLine[this.codingPos] + code2, blackPixels ^ 1);
  7754. }
  7755. while (refLine[refPos] <= codingLine[this.codingPos] && refLine[refPos] < columns) {
  7756. refPos += 2;
  7757. }
  7758. break;
  7759. case twoDimVertR3:
  7760. this.addPixels(refLine[refPos] + 3, blackPixels);
  7761. blackPixels ^= 1;
  7762. if (codingLine[this.codingPos] < columns) {
  7763. ++refPos;
  7764. while (refLine[refPos] <= codingLine[this.codingPos] && refLine[refPos] < columns) {
  7765. refPos += 2;
  7766. }
  7767. }
  7768. break;
  7769. case twoDimVertR2:
  7770. this.addPixels(refLine[refPos] + 2, blackPixels);
  7771. blackPixels ^= 1;
  7772. if (codingLine[this.codingPos] < columns) {
  7773. ++refPos;
  7774. while (refLine[refPos] <= codingLine[this.codingPos] && refLine[refPos] < columns) {
  7775. refPos += 2;
  7776. }
  7777. }
  7778. break;
  7779. case twoDimVertR1:
  7780. this.addPixels(refLine[refPos] + 1, blackPixels);
  7781. blackPixels ^= 1;
  7782. if (codingLine[this.codingPos] < columns) {
  7783. ++refPos;
  7784. while (refLine[refPos] <= codingLine[this.codingPos] && refLine[refPos] < columns) {
  7785. refPos += 2;
  7786. }
  7787. }
  7788. break;
  7789. case twoDimVert0:
  7790. this.addPixels(refLine[refPos], blackPixels);
  7791. blackPixels ^= 1;
  7792. if (codingLine[this.codingPos] < columns) {
  7793. ++refPos;
  7794. while (refLine[refPos] <= codingLine[this.codingPos] && refLine[refPos] < columns) {
  7795. refPos += 2;
  7796. }
  7797. }
  7798. break;
  7799. case twoDimVertL3:
  7800. this.addPixelsNeg(refLine[refPos] - 3, blackPixels);
  7801. blackPixels ^= 1;
  7802. if (codingLine[this.codingPos] < columns) {
  7803. if (refPos > 0) {
  7804. --refPos;
  7805. } else {
  7806. ++refPos;
  7807. }
  7808. while (refLine[refPos] <= codingLine[this.codingPos] && refLine[refPos] < columns) {
  7809. refPos += 2;
  7810. }
  7811. }
  7812. break;
  7813. case twoDimVertL2:
  7814. this.addPixelsNeg(refLine[refPos] - 2, blackPixels);
  7815. blackPixels ^= 1;
  7816. if (codingLine[this.codingPos] < columns) {
  7817. if (refPos > 0) {
  7818. --refPos;
  7819. } else {
  7820. ++refPos;
  7821. }
  7822. while (refLine[refPos] <= codingLine[this.codingPos] && refLine[refPos] < columns) {
  7823. refPos += 2;
  7824. }
  7825. }
  7826. break;
  7827. case twoDimVertL1:
  7828. this.addPixelsNeg(refLine[refPos] - 1, blackPixels);
  7829. blackPixels ^= 1;
  7830. if (codingLine[this.codingPos] < columns) {
  7831. if (refPos > 0) {
  7832. --refPos;
  7833. } else {
  7834. ++refPos;
  7835. }
  7836. while (refLine[refPos] <= codingLine[this.codingPos] && refLine[refPos] < columns) {
  7837. refPos += 2;
  7838. }
  7839. }
  7840. break;
  7841. case ccittEOF:
  7842. this.addPixels(columns, 0);
  7843. this.eof = true;
  7844. break;
  7845. default:
  7846. info('bad 2d code');
  7847. this.addPixels(columns, 0);
  7848. this.err = true;
  7849. }
  7850. }
  7851. } else {
  7852. codingLine[0] = 0;
  7853. this.codingPos = 0;
  7854. blackPixels = 0;
  7855. while (codingLine[this.codingPos] < columns) {
  7856. code1 = 0;
  7857. if (blackPixels) {
  7858. do {
  7859. code1 += code3 = this.getBlackCode();
  7860. } while (code3 >= 64);
  7861. } else {
  7862. do {
  7863. code1 += code3 = this.getWhiteCode();
  7864. } while (code3 >= 64);
  7865. }
  7866. this.addPixels(codingLine[this.codingPos] + code1, blackPixels);
  7867. blackPixels ^= 1;
  7868. }
  7869. }
  7870. var gotEOL = false;
  7871. if (this.byteAlign) {
  7872. this.inputBits &= ~7;
  7873. }
  7874. if (!this.eoblock && this.row === this.rows - 1) {
  7875. this.eof = true;
  7876. } else {
  7877. code1 = this.lookBits(12);
  7878. if (this.eoline) {
  7879. while (code1 !== ccittEOF && code1 !== 1) {
  7880. this.eatBits(1);
  7881. code1 = this.lookBits(12);
  7882. }
  7883. } else {
  7884. while (code1 === 0) {
  7885. this.eatBits(1);
  7886. code1 = this.lookBits(12);
  7887. }
  7888. }
  7889. if (code1 === 1) {
  7890. this.eatBits(12);
  7891. gotEOL = true;
  7892. } else if (code1 === ccittEOF) {
  7893. this.eof = true;
  7894. }
  7895. }
  7896. if (!this.eof && this.encoding > 0) {
  7897. this.nextLine2D = !this.lookBits(1);
  7898. this.eatBits(1);
  7899. }
  7900. if (this.eoblock && gotEOL && this.byteAlign) {
  7901. code1 = this.lookBits(12);
  7902. if (code1 === 1) {
  7903. this.eatBits(12);
  7904. if (this.encoding > 0) {
  7905. this.lookBits(1);
  7906. this.eatBits(1);
  7907. }
  7908. if (this.encoding >= 0) {
  7909. for (i = 0; i < 4; ++i) {
  7910. code1 = this.lookBits(12);
  7911. if (code1 !== 1) {
  7912. info('bad rtc code: ' + code1);
  7913. }
  7914. this.eatBits(12);
  7915. if (this.encoding > 0) {
  7916. this.lookBits(1);
  7917. this.eatBits(1);
  7918. }
  7919. }
  7920. }
  7921. this.eof = true;
  7922. }
  7923. } else if (this.err && this.eoline) {
  7924. while (true) {
  7925. code1 = this.lookBits(13);
  7926. if (code1 === ccittEOF) {
  7927. this.eof = true;
  7928. return null;
  7929. }
  7930. if (code1 >> 1 === 1) {
  7931. break;
  7932. }
  7933. this.eatBits(1);
  7934. }
  7935. this.eatBits(12);
  7936. if (this.encoding > 0) {
  7937. this.eatBits(1);
  7938. this.nextLine2D = !(code1 & 1);
  7939. }
  7940. }
  7941. if (codingLine[0] > 0) {
  7942. this.outputBits = codingLine[this.codingPos = 0];
  7943. } else {
  7944. this.outputBits = codingLine[this.codingPos = 1];
  7945. }
  7946. this.row++;
  7947. }
  7948. var c;
  7949. if (this.outputBits >= 8) {
  7950. c = this.codingPos & 1 ? 0 : 0xFF;
  7951. this.outputBits -= 8;
  7952. if (this.outputBits === 0 && codingLine[this.codingPos] < columns) {
  7953. this.codingPos++;
  7954. this.outputBits = codingLine[this.codingPos] - codingLine[this.codingPos - 1];
  7955. }
  7956. } else {
  7957. bits = 8;
  7958. c = 0;
  7959. do {
  7960. if (this.outputBits > bits) {
  7961. c <<= bits;
  7962. if (!(this.codingPos & 1)) {
  7963. c |= 0xFF >> 8 - bits;
  7964. }
  7965. this.outputBits -= bits;
  7966. bits = 0;
  7967. } else {
  7968. c <<= this.outputBits;
  7969. if (!(this.codingPos & 1)) {
  7970. c |= 0xFF >> 8 - this.outputBits;
  7971. }
  7972. bits -= this.outputBits;
  7973. this.outputBits = 0;
  7974. if (codingLine[this.codingPos] < columns) {
  7975. this.codingPos++;
  7976. this.outputBits = codingLine[this.codingPos] - codingLine[this.codingPos - 1];
  7977. } else if (bits > 0) {
  7978. c <<= bits;
  7979. bits = 0;
  7980. }
  7981. }
  7982. } while (bits);
  7983. }
  7984. if (this.black) {
  7985. c ^= 0xFF;
  7986. }
  7987. return c;
  7988. };
  7989. CCITTFaxStream.prototype.findTableCode = function ccittFaxStreamFindTableCode(start, end, table, limit) {
  7990. var limitValue = limit || 0;
  7991. for (var i = start; i <= end; ++i) {
  7992. var code = this.lookBits(i);
  7993. if (code === ccittEOF) {
  7994. return [
  7995. true,
  7996. 1,
  7997. false
  7998. ];
  7999. }
  8000. if (i < end) {
  8001. code <<= end - i;
  8002. }
  8003. if (!limitValue || code >= limitValue) {
  8004. var p = table[code - limitValue];
  8005. if (p[0] === i) {
  8006. this.eatBits(i);
  8007. return [
  8008. true,
  8009. p[1],
  8010. true
  8011. ];
  8012. }
  8013. }
  8014. }
  8015. return [
  8016. false,
  8017. 0,
  8018. false
  8019. ];
  8020. };
  8021. CCITTFaxStream.prototype.getTwoDimCode = function ccittFaxStreamGetTwoDimCode() {
  8022. var code = 0;
  8023. var p;
  8024. if (this.eoblock) {
  8025. code = this.lookBits(7);
  8026. p = twoDimTable[code];
  8027. if (p && p[0] > 0) {
  8028. this.eatBits(p[0]);
  8029. return p[1];
  8030. }
  8031. } else {
  8032. var result = this.findTableCode(1, 7, twoDimTable);
  8033. if (result[0] && result[2]) {
  8034. return result[1];
  8035. }
  8036. }
  8037. info('Bad two dim code');
  8038. return ccittEOF;
  8039. };
  8040. CCITTFaxStream.prototype.getWhiteCode = function ccittFaxStreamGetWhiteCode() {
  8041. var code = 0;
  8042. var p;
  8043. if (this.eoblock) {
  8044. code = this.lookBits(12);
  8045. if (code === ccittEOF) {
  8046. return 1;
  8047. }
  8048. if (code >> 5 === 0) {
  8049. p = whiteTable1[code];
  8050. } else {
  8051. p = whiteTable2[code >> 3];
  8052. }
  8053. if (p[0] > 0) {
  8054. this.eatBits(p[0]);
  8055. return p[1];
  8056. }
  8057. } else {
  8058. var result = this.findTableCode(1, 9, whiteTable2);
  8059. if (result[0]) {
  8060. return result[1];
  8061. }
  8062. result = this.findTableCode(11, 12, whiteTable1);
  8063. if (result[0]) {
  8064. return result[1];
  8065. }
  8066. }
  8067. info('bad white code');
  8068. this.eatBits(1);
  8069. return 1;
  8070. };
  8071. CCITTFaxStream.prototype.getBlackCode = function ccittFaxStreamGetBlackCode() {
  8072. var code, p;
  8073. if (this.eoblock) {
  8074. code = this.lookBits(13);
  8075. if (code === ccittEOF) {
  8076. return 1;
  8077. }
  8078. if (code >> 7 === 0) {
  8079. p = blackTable1[code];
  8080. } else if (code >> 9 === 0 && code >> 7 !== 0) {
  8081. p = blackTable2[(code >> 1) - 64];
  8082. } else {
  8083. p = blackTable3[code >> 7];
  8084. }
  8085. if (p[0] > 0) {
  8086. this.eatBits(p[0]);
  8087. return p[1];
  8088. }
  8089. } else {
  8090. var result = this.findTableCode(2, 6, blackTable3);
  8091. if (result[0]) {
  8092. return result[1];
  8093. }
  8094. result = this.findTableCode(7, 12, blackTable2, 64);
  8095. if (result[0]) {
  8096. return result[1];
  8097. }
  8098. result = this.findTableCode(10, 13, blackTable1);
  8099. if (result[0]) {
  8100. return result[1];
  8101. }
  8102. }
  8103. info('bad black code');
  8104. this.eatBits(1);
  8105. return 1;
  8106. };
  8107. CCITTFaxStream.prototype.lookBits = function CCITTFaxStream_lookBits(n) {
  8108. var c;
  8109. while (this.inputBits < n) {
  8110. if ((c = this.str.getByte()) === -1) {
  8111. if (this.inputBits === 0) {
  8112. return ccittEOF;
  8113. }
  8114. return this.inputBuf << n - this.inputBits & 0xFFFF >> 16 - n;
  8115. }
  8116. this.inputBuf = this.inputBuf << 8 | c;
  8117. this.inputBits += 8;
  8118. }
  8119. return this.inputBuf >> this.inputBits - n & 0xFFFF >> 16 - n;
  8120. };
  8121. CCITTFaxStream.prototype.eatBits = function CCITTFaxStream_eatBits(n) {
  8122. if ((this.inputBits -= n) < 0) {
  8123. this.inputBits = 0;
  8124. }
  8125. };
  8126. return CCITTFaxStream;
  8127. }();
  8128. var LZWStream = function LZWStreamClosure() {
  8129. function LZWStream(str, maybeLength, earlyChange) {
  8130. this.str = str;
  8131. this.dict = str.dict;
  8132. this.cachedData = 0;
  8133. this.bitsCached = 0;
  8134. var maxLzwDictionarySize = 4096;
  8135. var lzwState = {
  8136. earlyChange: earlyChange,
  8137. codeLength: 9,
  8138. nextCode: 258,
  8139. dictionaryValues: new Uint8Array(maxLzwDictionarySize),
  8140. dictionaryLengths: new Uint16Array(maxLzwDictionarySize),
  8141. dictionaryPrevCodes: new Uint16Array(maxLzwDictionarySize),
  8142. currentSequence: new Uint8Array(maxLzwDictionarySize),
  8143. currentSequenceLength: 0
  8144. };
  8145. for (var i = 0; i < 256; ++i) {
  8146. lzwState.dictionaryValues[i] = i;
  8147. lzwState.dictionaryLengths[i] = 1;
  8148. }
  8149. this.lzwState = lzwState;
  8150. DecodeStream.call(this, maybeLength);
  8151. }
  8152. LZWStream.prototype = Object.create(DecodeStream.prototype);
  8153. LZWStream.prototype.readBits = function LZWStream_readBits(n) {
  8154. var bitsCached = this.bitsCached;
  8155. var cachedData = this.cachedData;
  8156. while (bitsCached < n) {
  8157. var c = this.str.getByte();
  8158. if (c === -1) {
  8159. this.eof = true;
  8160. return null;
  8161. }
  8162. cachedData = cachedData << 8 | c;
  8163. bitsCached += 8;
  8164. }
  8165. this.bitsCached = bitsCached -= n;
  8166. this.cachedData = cachedData;
  8167. this.lastCode = null;
  8168. return cachedData >>> bitsCached & (1 << n) - 1;
  8169. };
  8170. LZWStream.prototype.readBlock = function LZWStream_readBlock() {
  8171. var blockSize = 512;
  8172. var estimatedDecodedSize = blockSize * 2, decodedSizeDelta = blockSize;
  8173. var i, j, q;
  8174. var lzwState = this.lzwState;
  8175. if (!lzwState) {
  8176. return;
  8177. }
  8178. var earlyChange = lzwState.earlyChange;
  8179. var nextCode = lzwState.nextCode;
  8180. var dictionaryValues = lzwState.dictionaryValues;
  8181. var dictionaryLengths = lzwState.dictionaryLengths;
  8182. var dictionaryPrevCodes = lzwState.dictionaryPrevCodes;
  8183. var codeLength = lzwState.codeLength;
  8184. var prevCode = lzwState.prevCode;
  8185. var currentSequence = lzwState.currentSequence;
  8186. var currentSequenceLength = lzwState.currentSequenceLength;
  8187. var decodedLength = 0;
  8188. var currentBufferLength = this.bufferLength;
  8189. var buffer = this.ensureBuffer(this.bufferLength + estimatedDecodedSize);
  8190. for (i = 0; i < blockSize; i++) {
  8191. var code = this.readBits(codeLength);
  8192. var hasPrev = currentSequenceLength > 0;
  8193. if (code < 256) {
  8194. currentSequence[0] = code;
  8195. currentSequenceLength = 1;
  8196. } else if (code >= 258) {
  8197. if (code < nextCode) {
  8198. currentSequenceLength = dictionaryLengths[code];
  8199. for (j = currentSequenceLength - 1, q = code; j >= 0; j--) {
  8200. currentSequence[j] = dictionaryValues[q];
  8201. q = dictionaryPrevCodes[q];
  8202. }
  8203. } else {
  8204. currentSequence[currentSequenceLength++] = currentSequence[0];
  8205. }
  8206. } else if (code === 256) {
  8207. codeLength = 9;
  8208. nextCode = 258;
  8209. currentSequenceLength = 0;
  8210. continue;
  8211. } else {
  8212. this.eof = true;
  8213. delete this.lzwState;
  8214. break;
  8215. }
  8216. if (hasPrev) {
  8217. dictionaryPrevCodes[nextCode] = prevCode;
  8218. dictionaryLengths[nextCode] = dictionaryLengths[prevCode] + 1;
  8219. dictionaryValues[nextCode] = currentSequence[0];
  8220. nextCode++;
  8221. codeLength = nextCode + earlyChange & nextCode + earlyChange - 1 ? codeLength : Math.min(Math.log(nextCode + earlyChange) / 0.6931471805599453 + 1, 12) | 0;
  8222. }
  8223. prevCode = code;
  8224. decodedLength += currentSequenceLength;
  8225. if (estimatedDecodedSize < decodedLength) {
  8226. do {
  8227. estimatedDecodedSize += decodedSizeDelta;
  8228. } while (estimatedDecodedSize < decodedLength);
  8229. buffer = this.ensureBuffer(this.bufferLength + estimatedDecodedSize);
  8230. }
  8231. for (j = 0; j < currentSequenceLength; j++) {
  8232. buffer[currentBufferLength++] = currentSequence[j];
  8233. }
  8234. }
  8235. lzwState.nextCode = nextCode;
  8236. lzwState.codeLength = codeLength;
  8237. lzwState.prevCode = prevCode;
  8238. lzwState.currentSequenceLength = currentSequenceLength;
  8239. this.bufferLength = currentBufferLength;
  8240. };
  8241. return LZWStream;
  8242. }();
  8243. var NullStream = function NullStreamClosure() {
  8244. function NullStream() {
  8245. Stream.call(this, new Uint8Array(0));
  8246. }
  8247. NullStream.prototype = Stream.prototype;
  8248. return NullStream;
  8249. }();
  8250. exports.Ascii85Stream = Ascii85Stream;
  8251. exports.AsciiHexStream = AsciiHexStream;
  8252. exports.CCITTFaxStream = CCITTFaxStream;
  8253. exports.DecryptStream = DecryptStream;
  8254. exports.DecodeStream = DecodeStream;
  8255. exports.FlateStream = FlateStream;
  8256. exports.Jbig2Stream = Jbig2Stream;
  8257. exports.JpegStream = JpegStream;
  8258. exports.JpxStream = JpxStream;
  8259. exports.NullStream = NullStream;
  8260. exports.PredictorStream = PredictorStream;
  8261. exports.RunLengthStream = RunLengthStream;
  8262. exports.Stream = Stream;
  8263. exports.StreamsSequenceStream = StreamsSequenceStream;
  8264. exports.StringStream = StringStream;
  8265. exports.LZWStream = LZWStream;
  8266. /***/ }),
  8267. /* 3 */
  8268. /***/ (function(module, exports, __w_pdfjs_require__) {
  8269. "use strict";
  8270. var sharedUtil = __w_pdfjs_require__(0);
  8271. var corePrimitives = __w_pdfjs_require__(1);
  8272. var coreFunction = __w_pdfjs_require__(6);
  8273. var error = sharedUtil.error;
  8274. var info = sharedUtil.info;
  8275. var isArray = sharedUtil.isArray;
  8276. var isString = sharedUtil.isString;
  8277. var shadow = sharedUtil.shadow;
  8278. var warn = sharedUtil.warn;
  8279. var isDict = corePrimitives.isDict;
  8280. var isName = corePrimitives.isName;
  8281. var isStream = corePrimitives.isStream;
  8282. var PDFFunction = coreFunction.PDFFunction;
  8283. var ColorSpace = function ColorSpaceClosure() {
  8284. function resizeRgbImage(src, bpc, w1, h1, w2, h2, alpha01, dest) {
  8285. var COMPONENTS = 3;
  8286. alpha01 = alpha01 !== 1 ? 0 : alpha01;
  8287. var xRatio = w1 / w2;
  8288. var yRatio = h1 / h2;
  8289. var i, j, py, newIndex = 0, oldIndex;
  8290. var xScaled = new Uint16Array(w2);
  8291. var w1Scanline = w1 * COMPONENTS;
  8292. for (i = 0; i < w2; i++) {
  8293. xScaled[i] = Math.floor(i * xRatio) * COMPONENTS;
  8294. }
  8295. for (i = 0; i < h2; i++) {
  8296. py = Math.floor(i * yRatio) * w1Scanline;
  8297. for (j = 0; j < w2; j++) {
  8298. oldIndex = py + xScaled[j];
  8299. dest[newIndex++] = src[oldIndex++];
  8300. dest[newIndex++] = src[oldIndex++];
  8301. dest[newIndex++] = src[oldIndex++];
  8302. newIndex += alpha01;
  8303. }
  8304. }
  8305. }
  8306. function ColorSpace() {
  8307. error('should not call ColorSpace constructor');
  8308. }
  8309. ColorSpace.prototype = {
  8310. getRgb: function ColorSpace_getRgb(src, srcOffset) {
  8311. var rgb = new Uint8Array(3);
  8312. this.getRgbItem(src, srcOffset, rgb, 0);
  8313. return rgb;
  8314. },
  8315. getRgbItem: function ColorSpace_getRgbItem(src, srcOffset, dest, destOffset) {
  8316. error('Should not call ColorSpace.getRgbItem');
  8317. },
  8318. getRgbBuffer: function ColorSpace_getRgbBuffer(src, srcOffset, count, dest, destOffset, bits, alpha01) {
  8319. error('Should not call ColorSpace.getRgbBuffer');
  8320. },
  8321. getOutputLength: function ColorSpace_getOutputLength(inputLength, alpha01) {
  8322. error('Should not call ColorSpace.getOutputLength');
  8323. },
  8324. isPassthrough: function ColorSpace_isPassthrough(bits) {
  8325. return false;
  8326. },
  8327. fillRgb: function ColorSpace_fillRgb(dest, originalWidth, originalHeight, width, height, actualHeight, bpc, comps, alpha01) {
  8328. var count = originalWidth * originalHeight;
  8329. var rgbBuf = null;
  8330. var numComponentColors = 1 << bpc;
  8331. var needsResizing = originalHeight !== height || originalWidth !== width;
  8332. var i, ii;
  8333. if (this.isPassthrough(bpc)) {
  8334. rgbBuf = comps;
  8335. } else if (this.numComps === 1 && count > numComponentColors && this.name !== 'DeviceGray' && this.name !== 'DeviceRGB') {
  8336. var allColors = bpc <= 8 ? new Uint8Array(numComponentColors) : new Uint16Array(numComponentColors);
  8337. var key;
  8338. for (i = 0; i < numComponentColors; i++) {
  8339. allColors[i] = i;
  8340. }
  8341. var colorMap = new Uint8Array(numComponentColors * 3);
  8342. this.getRgbBuffer(allColors, 0, numComponentColors, colorMap, 0, bpc, 0);
  8343. var destPos, rgbPos;
  8344. if (!needsResizing) {
  8345. destPos = 0;
  8346. for (i = 0; i < count; ++i) {
  8347. key = comps[i] * 3;
  8348. dest[destPos++] = colorMap[key];
  8349. dest[destPos++] = colorMap[key + 1];
  8350. dest[destPos++] = colorMap[key + 2];
  8351. destPos += alpha01;
  8352. }
  8353. } else {
  8354. rgbBuf = new Uint8Array(count * 3);
  8355. rgbPos = 0;
  8356. for (i = 0; i < count; ++i) {
  8357. key = comps[i] * 3;
  8358. rgbBuf[rgbPos++] = colorMap[key];
  8359. rgbBuf[rgbPos++] = colorMap[key + 1];
  8360. rgbBuf[rgbPos++] = colorMap[key + 2];
  8361. }
  8362. }
  8363. } else {
  8364. if (!needsResizing) {
  8365. this.getRgbBuffer(comps, 0, width * actualHeight, dest, 0, bpc, alpha01);
  8366. } else {
  8367. rgbBuf = new Uint8Array(count * 3);
  8368. this.getRgbBuffer(comps, 0, count, rgbBuf, 0, bpc, 0);
  8369. }
  8370. }
  8371. if (rgbBuf) {
  8372. if (needsResizing) {
  8373. resizeRgbImage(rgbBuf, bpc, originalWidth, originalHeight, width, height, alpha01, dest);
  8374. } else {
  8375. rgbPos = 0;
  8376. destPos = 0;
  8377. for (i = 0, ii = width * actualHeight; i < ii; i++) {
  8378. dest[destPos++] = rgbBuf[rgbPos++];
  8379. dest[destPos++] = rgbBuf[rgbPos++];
  8380. dest[destPos++] = rgbBuf[rgbPos++];
  8381. destPos += alpha01;
  8382. }
  8383. }
  8384. }
  8385. },
  8386. usesZeroToOneRange: true
  8387. };
  8388. ColorSpace.parse = function ColorSpace_parse(cs, xref, res) {
  8389. var IR = ColorSpace.parseToIR(cs, xref, res);
  8390. if (IR instanceof AlternateCS) {
  8391. return IR;
  8392. }
  8393. return ColorSpace.fromIR(IR);
  8394. };
  8395. ColorSpace.fromIR = function ColorSpace_fromIR(IR) {
  8396. var name = isArray(IR) ? IR[0] : IR;
  8397. var whitePoint, blackPoint, gamma;
  8398. switch (name) {
  8399. case 'DeviceGrayCS':
  8400. return this.singletons.gray;
  8401. case 'DeviceRgbCS':
  8402. return this.singletons.rgb;
  8403. case 'DeviceCmykCS':
  8404. return this.singletons.cmyk;
  8405. case 'CalGrayCS':
  8406. whitePoint = IR[1];
  8407. blackPoint = IR[2];
  8408. gamma = IR[3];
  8409. return new CalGrayCS(whitePoint, blackPoint, gamma);
  8410. case 'CalRGBCS':
  8411. whitePoint = IR[1];
  8412. blackPoint = IR[2];
  8413. gamma = IR[3];
  8414. var matrix = IR[4];
  8415. return new CalRGBCS(whitePoint, blackPoint, gamma, matrix);
  8416. case 'PatternCS':
  8417. var basePatternCS = IR[1];
  8418. if (basePatternCS) {
  8419. basePatternCS = ColorSpace.fromIR(basePatternCS);
  8420. }
  8421. return new PatternCS(basePatternCS);
  8422. case 'IndexedCS':
  8423. var baseIndexedCS = IR[1];
  8424. var hiVal = IR[2];
  8425. var lookup = IR[3];
  8426. return new IndexedCS(ColorSpace.fromIR(baseIndexedCS), hiVal, lookup);
  8427. case 'AlternateCS':
  8428. var numComps = IR[1];
  8429. var alt = IR[2];
  8430. var tintFnIR = IR[3];
  8431. return new AlternateCS(numComps, ColorSpace.fromIR(alt), PDFFunction.fromIR(tintFnIR));
  8432. case 'LabCS':
  8433. whitePoint = IR[1];
  8434. blackPoint = IR[2];
  8435. var range = IR[3];
  8436. return new LabCS(whitePoint, blackPoint, range);
  8437. default:
  8438. error('Unknown name ' + name);
  8439. }
  8440. return null;
  8441. };
  8442. ColorSpace.parseToIR = function ColorSpace_parseToIR(cs, xref, res) {
  8443. if (isName(cs)) {
  8444. var colorSpaces = res.get('ColorSpace');
  8445. if (isDict(colorSpaces)) {
  8446. var refcs = colorSpaces.get(cs.name);
  8447. if (refcs) {
  8448. cs = refcs;
  8449. }
  8450. }
  8451. }
  8452. cs = xref.fetchIfRef(cs);
  8453. if (isName(cs)) {
  8454. switch (cs.name) {
  8455. case 'DeviceGray':
  8456. case 'G':
  8457. return 'DeviceGrayCS';
  8458. case 'DeviceRGB':
  8459. case 'RGB':
  8460. return 'DeviceRgbCS';
  8461. case 'DeviceCMYK':
  8462. case 'CMYK':
  8463. return 'DeviceCmykCS';
  8464. case 'Pattern':
  8465. return [
  8466. 'PatternCS',
  8467. null
  8468. ];
  8469. default:
  8470. error('unrecognized colorspace ' + cs.name);
  8471. }
  8472. } else if (isArray(cs)) {
  8473. var mode = xref.fetchIfRef(cs[0]).name;
  8474. var numComps, params, alt, whitePoint, blackPoint, gamma;
  8475. switch (mode) {
  8476. case 'DeviceGray':
  8477. case 'G':
  8478. return 'DeviceGrayCS';
  8479. case 'DeviceRGB':
  8480. case 'RGB':
  8481. return 'DeviceRgbCS';
  8482. case 'DeviceCMYK':
  8483. case 'CMYK':
  8484. return 'DeviceCmykCS';
  8485. case 'CalGray':
  8486. params = xref.fetchIfRef(cs[1]);
  8487. whitePoint = params.getArray('WhitePoint');
  8488. blackPoint = params.getArray('BlackPoint');
  8489. gamma = params.get('Gamma');
  8490. return [
  8491. 'CalGrayCS',
  8492. whitePoint,
  8493. blackPoint,
  8494. gamma
  8495. ];
  8496. case 'CalRGB':
  8497. params = xref.fetchIfRef(cs[1]);
  8498. whitePoint = params.getArray('WhitePoint');
  8499. blackPoint = params.getArray('BlackPoint');
  8500. gamma = params.getArray('Gamma');
  8501. var matrix = params.getArray('Matrix');
  8502. return [
  8503. 'CalRGBCS',
  8504. whitePoint,
  8505. blackPoint,
  8506. gamma,
  8507. matrix
  8508. ];
  8509. case 'ICCBased':
  8510. var stream = xref.fetchIfRef(cs[1]);
  8511. var dict = stream.dict;
  8512. numComps = dict.get('N');
  8513. alt = dict.get('Alternate');
  8514. if (alt) {
  8515. var altIR = ColorSpace.parseToIR(alt, xref, res);
  8516. var altCS = ColorSpace.fromIR(altIR);
  8517. if (altCS.numComps === numComps) {
  8518. return altIR;
  8519. }
  8520. warn('ICCBased color space: Ignoring incorrect /Alternate entry.');
  8521. }
  8522. if (numComps === 1) {
  8523. return 'DeviceGrayCS';
  8524. } else if (numComps === 3) {
  8525. return 'DeviceRgbCS';
  8526. } else if (numComps === 4) {
  8527. return 'DeviceCmykCS';
  8528. }
  8529. break;
  8530. case 'Pattern':
  8531. var basePatternCS = cs[1] || null;
  8532. if (basePatternCS) {
  8533. basePatternCS = ColorSpace.parseToIR(basePatternCS, xref, res);
  8534. }
  8535. return [
  8536. 'PatternCS',
  8537. basePatternCS
  8538. ];
  8539. case 'Indexed':
  8540. case 'I':
  8541. var baseIndexedCS = ColorSpace.parseToIR(cs[1], xref, res);
  8542. var hiVal = xref.fetchIfRef(cs[2]) + 1;
  8543. var lookup = xref.fetchIfRef(cs[3]);
  8544. if (isStream(lookup)) {
  8545. lookup = lookup.getBytes();
  8546. }
  8547. return [
  8548. 'IndexedCS',
  8549. baseIndexedCS,
  8550. hiVal,
  8551. lookup
  8552. ];
  8553. case 'Separation':
  8554. case 'DeviceN':
  8555. var name = xref.fetchIfRef(cs[1]);
  8556. numComps = isArray(name) ? name.length : 1;
  8557. alt = ColorSpace.parseToIR(cs[2], xref, res);
  8558. var tintFnIR = PDFFunction.getIR(xref, xref.fetchIfRef(cs[3]));
  8559. return [
  8560. 'AlternateCS',
  8561. numComps,
  8562. alt,
  8563. tintFnIR
  8564. ];
  8565. case 'Lab':
  8566. params = xref.fetchIfRef(cs[1]);
  8567. whitePoint = params.getArray('WhitePoint');
  8568. blackPoint = params.getArray('BlackPoint');
  8569. var range = params.getArray('Range');
  8570. return [
  8571. 'LabCS',
  8572. whitePoint,
  8573. blackPoint,
  8574. range
  8575. ];
  8576. default:
  8577. error('unimplemented color space object "' + mode + '"');
  8578. }
  8579. } else {
  8580. error('unrecognized color space object: "' + cs + '"');
  8581. }
  8582. return null;
  8583. };
  8584. ColorSpace.isDefaultDecode = function ColorSpace_isDefaultDecode(decode, n) {
  8585. if (!isArray(decode)) {
  8586. return true;
  8587. }
  8588. if (n * 2 !== decode.length) {
  8589. warn('The decode map is not the correct length');
  8590. return true;
  8591. }
  8592. for (var i = 0, ii = decode.length; i < ii; i += 2) {
  8593. if (decode[i] !== 0 || decode[i + 1] !== 1) {
  8594. return false;
  8595. }
  8596. }
  8597. return true;
  8598. };
  8599. ColorSpace.singletons = {
  8600. get gray() {
  8601. return shadow(this, 'gray', new DeviceGrayCS());
  8602. },
  8603. get rgb() {
  8604. return shadow(this, 'rgb', new DeviceRgbCS());
  8605. },
  8606. get cmyk() {
  8607. return shadow(this, 'cmyk', new DeviceCmykCS());
  8608. }
  8609. };
  8610. return ColorSpace;
  8611. }();
  8612. var AlternateCS = function AlternateCSClosure() {
  8613. function AlternateCS(numComps, base, tintFn) {
  8614. this.name = 'Alternate';
  8615. this.numComps = numComps;
  8616. this.defaultColor = new Float32Array(numComps);
  8617. for (var i = 0; i < numComps; ++i) {
  8618. this.defaultColor[i] = 1;
  8619. }
  8620. this.base = base;
  8621. this.tintFn = tintFn;
  8622. this.tmpBuf = new Float32Array(base.numComps);
  8623. }
  8624. AlternateCS.prototype = {
  8625. getRgb: ColorSpace.prototype.getRgb,
  8626. getRgbItem: function AlternateCS_getRgbItem(src, srcOffset, dest, destOffset) {
  8627. var tmpBuf = this.tmpBuf;
  8628. this.tintFn(src, srcOffset, tmpBuf, 0);
  8629. this.base.getRgbItem(tmpBuf, 0, dest, destOffset);
  8630. },
  8631. getRgbBuffer: function AlternateCS_getRgbBuffer(src, srcOffset, count, dest, destOffset, bits, alpha01) {
  8632. var tintFn = this.tintFn;
  8633. var base = this.base;
  8634. var scale = 1 / ((1 << bits) - 1);
  8635. var baseNumComps = base.numComps;
  8636. var usesZeroToOneRange = base.usesZeroToOneRange;
  8637. var isPassthrough = (base.isPassthrough(8) || !usesZeroToOneRange) && alpha01 === 0;
  8638. var pos = isPassthrough ? destOffset : 0;
  8639. var baseBuf = isPassthrough ? dest : new Uint8Array(baseNumComps * count);
  8640. var numComps = this.numComps;
  8641. var scaled = new Float32Array(numComps);
  8642. var tinted = new Float32Array(baseNumComps);
  8643. var i, j;
  8644. for (i = 0; i < count; i++) {
  8645. for (j = 0; j < numComps; j++) {
  8646. scaled[j] = src[srcOffset++] * scale;
  8647. }
  8648. tintFn(scaled, 0, tinted, 0);
  8649. if (usesZeroToOneRange) {
  8650. for (j = 0; j < baseNumComps; j++) {
  8651. baseBuf[pos++] = tinted[j] * 255;
  8652. }
  8653. } else {
  8654. base.getRgbItem(tinted, 0, baseBuf, pos);
  8655. pos += baseNumComps;
  8656. }
  8657. }
  8658. if (!isPassthrough) {
  8659. base.getRgbBuffer(baseBuf, 0, count, dest, destOffset, 8, alpha01);
  8660. }
  8661. },
  8662. getOutputLength: function AlternateCS_getOutputLength(inputLength, alpha01) {
  8663. return this.base.getOutputLength(inputLength * this.base.numComps / this.numComps, alpha01);
  8664. },
  8665. isPassthrough: ColorSpace.prototype.isPassthrough,
  8666. fillRgb: ColorSpace.prototype.fillRgb,
  8667. isDefaultDecode: function AlternateCS_isDefaultDecode(decodeMap) {
  8668. return ColorSpace.isDefaultDecode(decodeMap, this.numComps);
  8669. },
  8670. usesZeroToOneRange: true
  8671. };
  8672. return AlternateCS;
  8673. }();
  8674. var PatternCS = function PatternCSClosure() {
  8675. function PatternCS(baseCS) {
  8676. this.name = 'Pattern';
  8677. this.base = baseCS;
  8678. }
  8679. PatternCS.prototype = {};
  8680. return PatternCS;
  8681. }();
  8682. var IndexedCS = function IndexedCSClosure() {
  8683. function IndexedCS(base, highVal, lookup) {
  8684. this.name = 'Indexed';
  8685. this.numComps = 1;
  8686. this.defaultColor = new Uint8Array(this.numComps);
  8687. this.base = base;
  8688. this.highVal = highVal;
  8689. var baseNumComps = base.numComps;
  8690. var length = baseNumComps * highVal;
  8691. if (isStream(lookup)) {
  8692. this.lookup = new Uint8Array(length);
  8693. var bytes = lookup.getBytes(length);
  8694. this.lookup.set(bytes);
  8695. } else if (isString(lookup)) {
  8696. this.lookup = new Uint8Array(length);
  8697. for (var i = 0; i < length; ++i) {
  8698. this.lookup[i] = lookup.charCodeAt(i);
  8699. }
  8700. } else if (lookup instanceof Uint8Array || lookup instanceof Array) {
  8701. this.lookup = lookup;
  8702. } else {
  8703. error('Unrecognized lookup table: ' + lookup);
  8704. }
  8705. }
  8706. IndexedCS.prototype = {
  8707. getRgb: ColorSpace.prototype.getRgb,
  8708. getRgbItem: function IndexedCS_getRgbItem(src, srcOffset, dest, destOffset) {
  8709. var numComps = this.base.numComps;
  8710. var start = src[srcOffset] * numComps;
  8711. this.base.getRgbItem(this.lookup, start, dest, destOffset);
  8712. },
  8713. getRgbBuffer: function IndexedCS_getRgbBuffer(src, srcOffset, count, dest, destOffset, bits, alpha01) {
  8714. var base = this.base;
  8715. var numComps = base.numComps;
  8716. var outputDelta = base.getOutputLength(numComps, alpha01);
  8717. var lookup = this.lookup;
  8718. for (var i = 0; i < count; ++i) {
  8719. var lookupPos = src[srcOffset++] * numComps;
  8720. base.getRgbBuffer(lookup, lookupPos, 1, dest, destOffset, 8, alpha01);
  8721. destOffset += outputDelta;
  8722. }
  8723. },
  8724. getOutputLength: function IndexedCS_getOutputLength(inputLength, alpha01) {
  8725. return this.base.getOutputLength(inputLength * this.base.numComps, alpha01);
  8726. },
  8727. isPassthrough: ColorSpace.prototype.isPassthrough,
  8728. fillRgb: ColorSpace.prototype.fillRgb,
  8729. isDefaultDecode: function IndexedCS_isDefaultDecode(decodeMap) {
  8730. return true;
  8731. },
  8732. usesZeroToOneRange: true
  8733. };
  8734. return IndexedCS;
  8735. }();
  8736. var DeviceGrayCS = function DeviceGrayCSClosure() {
  8737. function DeviceGrayCS() {
  8738. this.name = 'DeviceGray';
  8739. this.numComps = 1;
  8740. this.defaultColor = new Float32Array(this.numComps);
  8741. }
  8742. DeviceGrayCS.prototype = {
  8743. getRgb: ColorSpace.prototype.getRgb,
  8744. getRgbItem: function DeviceGrayCS_getRgbItem(src, srcOffset, dest, destOffset) {
  8745. var c = src[srcOffset] * 255 | 0;
  8746. c = c < 0 ? 0 : c > 255 ? 255 : c;
  8747. dest[destOffset] = dest[destOffset + 1] = dest[destOffset + 2] = c;
  8748. },
  8749. getRgbBuffer: function DeviceGrayCS_getRgbBuffer(src, srcOffset, count, dest, destOffset, bits, alpha01) {
  8750. var scale = 255 / ((1 << bits) - 1);
  8751. var j = srcOffset, q = destOffset;
  8752. for (var i = 0; i < count; ++i) {
  8753. var c = scale * src[j++] | 0;
  8754. dest[q++] = c;
  8755. dest[q++] = c;
  8756. dest[q++] = c;
  8757. q += alpha01;
  8758. }
  8759. },
  8760. getOutputLength: function DeviceGrayCS_getOutputLength(inputLength, alpha01) {
  8761. return inputLength * (3 + alpha01);
  8762. },
  8763. isPassthrough: ColorSpace.prototype.isPassthrough,
  8764. fillRgb: ColorSpace.prototype.fillRgb,
  8765. isDefaultDecode: function DeviceGrayCS_isDefaultDecode(decodeMap) {
  8766. return ColorSpace.isDefaultDecode(decodeMap, this.numComps);
  8767. },
  8768. usesZeroToOneRange: true
  8769. };
  8770. return DeviceGrayCS;
  8771. }();
  8772. var DeviceRgbCS = function DeviceRgbCSClosure() {
  8773. function DeviceRgbCS() {
  8774. this.name = 'DeviceRGB';
  8775. this.numComps = 3;
  8776. this.defaultColor = new Float32Array(this.numComps);
  8777. }
  8778. DeviceRgbCS.prototype = {
  8779. getRgb: ColorSpace.prototype.getRgb,
  8780. getRgbItem: function DeviceRgbCS_getRgbItem(src, srcOffset, dest, destOffset) {
  8781. var r = src[srcOffset] * 255 | 0;
  8782. var g = src[srcOffset + 1] * 255 | 0;
  8783. var b = src[srcOffset + 2] * 255 | 0;
  8784. dest[destOffset] = r < 0 ? 0 : r > 255 ? 255 : r;
  8785. dest[destOffset + 1] = g < 0 ? 0 : g > 255 ? 255 : g;
  8786. dest[destOffset + 2] = b < 0 ? 0 : b > 255 ? 255 : b;
  8787. },
  8788. getRgbBuffer: function DeviceRgbCS_getRgbBuffer(src, srcOffset, count, dest, destOffset, bits, alpha01) {
  8789. if (bits === 8 && alpha01 === 0) {
  8790. dest.set(src.subarray(srcOffset, srcOffset + count * 3), destOffset);
  8791. return;
  8792. }
  8793. var scale = 255 / ((1 << bits) - 1);
  8794. var j = srcOffset, q = destOffset;
  8795. for (var i = 0; i < count; ++i) {
  8796. dest[q++] = scale * src[j++] | 0;
  8797. dest[q++] = scale * src[j++] | 0;
  8798. dest[q++] = scale * src[j++] | 0;
  8799. q += alpha01;
  8800. }
  8801. },
  8802. getOutputLength: function DeviceRgbCS_getOutputLength(inputLength, alpha01) {
  8803. return inputLength * (3 + alpha01) / 3 | 0;
  8804. },
  8805. isPassthrough: function DeviceRgbCS_isPassthrough(bits) {
  8806. return bits === 8;
  8807. },
  8808. fillRgb: ColorSpace.prototype.fillRgb,
  8809. isDefaultDecode: function DeviceRgbCS_isDefaultDecode(decodeMap) {
  8810. return ColorSpace.isDefaultDecode(decodeMap, this.numComps);
  8811. },
  8812. usesZeroToOneRange: true
  8813. };
  8814. return DeviceRgbCS;
  8815. }();
  8816. var DeviceCmykCS = function DeviceCmykCSClosure() {
  8817. function convertToRgb(src, srcOffset, srcScale, dest, destOffset) {
  8818. var c = src[srcOffset + 0] * srcScale;
  8819. var m = src[srcOffset + 1] * srcScale;
  8820. var y = src[srcOffset + 2] * srcScale;
  8821. var k = src[srcOffset + 3] * srcScale;
  8822. 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;
  8823. 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;
  8824. 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;
  8825. dest[destOffset] = r > 255 ? 255 : r < 0 ? 0 : r;
  8826. dest[destOffset + 1] = g > 255 ? 255 : g < 0 ? 0 : g;
  8827. dest[destOffset + 2] = b > 255 ? 255 : b < 0 ? 0 : b;
  8828. }
  8829. function DeviceCmykCS() {
  8830. this.name = 'DeviceCMYK';
  8831. this.numComps = 4;
  8832. this.defaultColor = new Float32Array(this.numComps);
  8833. this.defaultColor[3] = 1;
  8834. }
  8835. DeviceCmykCS.prototype = {
  8836. getRgb: ColorSpace.prototype.getRgb,
  8837. getRgbItem: function DeviceCmykCS_getRgbItem(src, srcOffset, dest, destOffset) {
  8838. convertToRgb(src, srcOffset, 1, dest, destOffset);
  8839. },
  8840. getRgbBuffer: function DeviceCmykCS_getRgbBuffer(src, srcOffset, count, dest, destOffset, bits, alpha01) {
  8841. var scale = 1 / ((1 << bits) - 1);
  8842. for (var i = 0; i < count; i++) {
  8843. convertToRgb(src, srcOffset, scale, dest, destOffset);
  8844. srcOffset += 4;
  8845. destOffset += 3 + alpha01;
  8846. }
  8847. },
  8848. getOutputLength: function DeviceCmykCS_getOutputLength(inputLength, alpha01) {
  8849. return inputLength / 4 * (3 + alpha01) | 0;
  8850. },
  8851. isPassthrough: ColorSpace.prototype.isPassthrough,
  8852. fillRgb: ColorSpace.prototype.fillRgb,
  8853. isDefaultDecode: function DeviceCmykCS_isDefaultDecode(decodeMap) {
  8854. return ColorSpace.isDefaultDecode(decodeMap, this.numComps);
  8855. },
  8856. usesZeroToOneRange: true
  8857. };
  8858. return DeviceCmykCS;
  8859. }();
  8860. var CalGrayCS = function CalGrayCSClosure() {
  8861. function CalGrayCS(whitePoint, blackPoint, gamma) {
  8862. this.name = 'CalGray';
  8863. this.numComps = 1;
  8864. this.defaultColor = new Float32Array(this.numComps);
  8865. if (!whitePoint) {
  8866. error('WhitePoint missing - required for color space CalGray');
  8867. }
  8868. blackPoint = blackPoint || [
  8869. 0,
  8870. 0,
  8871. 0
  8872. ];
  8873. gamma = gamma || 1;
  8874. this.XW = whitePoint[0];
  8875. this.YW = whitePoint[1];
  8876. this.ZW = whitePoint[2];
  8877. this.XB = blackPoint[0];
  8878. this.YB = blackPoint[1];
  8879. this.ZB = blackPoint[2];
  8880. this.G = gamma;
  8881. if (this.XW < 0 || this.ZW < 0 || this.YW !== 1) {
  8882. error('Invalid WhitePoint components for ' + this.name + ', no fallback available');
  8883. }
  8884. if (this.XB < 0 || this.YB < 0 || this.ZB < 0) {
  8885. info('Invalid BlackPoint for ' + this.name + ', falling back to default');
  8886. this.XB = this.YB = this.ZB = 0;
  8887. }
  8888. if (this.XB !== 0 || this.YB !== 0 || this.ZB !== 0) {
  8889. warn(this.name + ', BlackPoint: XB: ' + this.XB + ', YB: ' + this.YB + ', ZB: ' + this.ZB + ', only default values are supported.');
  8890. }
  8891. if (this.G < 1) {
  8892. info('Invalid Gamma: ' + this.G + ' for ' + this.name + ', falling back to default');
  8893. this.G = 1;
  8894. }
  8895. }
  8896. function convertToRgb(cs, src, srcOffset, dest, destOffset, scale) {
  8897. var A = src[srcOffset] * scale;
  8898. var AG = Math.pow(A, cs.G);
  8899. var L = cs.YW * AG;
  8900. var val = Math.max(295.8 * Math.pow(L, 0.333333333333333333) - 40.8, 0) | 0;
  8901. dest[destOffset] = val;
  8902. dest[destOffset + 1] = val;
  8903. dest[destOffset + 2] = val;
  8904. }
  8905. CalGrayCS.prototype = {
  8906. getRgb: ColorSpace.prototype.getRgb,
  8907. getRgbItem: function CalGrayCS_getRgbItem(src, srcOffset, dest, destOffset) {
  8908. convertToRgb(this, src, srcOffset, dest, destOffset, 1);
  8909. },
  8910. getRgbBuffer: function CalGrayCS_getRgbBuffer(src, srcOffset, count, dest, destOffset, bits, alpha01) {
  8911. var scale = 1 / ((1 << bits) - 1);
  8912. for (var i = 0; i < count; ++i) {
  8913. convertToRgb(this, src, srcOffset, dest, destOffset, scale);
  8914. srcOffset += 1;
  8915. destOffset += 3 + alpha01;
  8916. }
  8917. },
  8918. getOutputLength: function CalGrayCS_getOutputLength(inputLength, alpha01) {
  8919. return inputLength * (3 + alpha01);
  8920. },
  8921. isPassthrough: ColorSpace.prototype.isPassthrough,
  8922. fillRgb: ColorSpace.prototype.fillRgb,
  8923. isDefaultDecode: function CalGrayCS_isDefaultDecode(decodeMap) {
  8924. return ColorSpace.isDefaultDecode(decodeMap, this.numComps);
  8925. },
  8926. usesZeroToOneRange: true
  8927. };
  8928. return CalGrayCS;
  8929. }();
  8930. var CalRGBCS = function CalRGBCSClosure() {
  8931. var BRADFORD_SCALE_MATRIX = new Float32Array([
  8932. 0.8951,
  8933. 0.2664,
  8934. -0.1614,
  8935. -0.7502,
  8936. 1.7135,
  8937. 0.0367,
  8938. 0.0389,
  8939. -0.0685,
  8940. 1.0296
  8941. ]);
  8942. var BRADFORD_SCALE_INVERSE_MATRIX = new Float32Array([
  8943. 0.9869929,
  8944. -0.1470543,
  8945. 0.1599627,
  8946. 0.4323053,
  8947. 0.5183603,
  8948. 0.0492912,
  8949. -0.0085287,
  8950. 0.0400428,
  8951. 0.9684867
  8952. ]);
  8953. var SRGB_D65_XYZ_TO_RGB_MATRIX = new Float32Array([
  8954. 3.2404542,
  8955. -1.5371385,
  8956. -0.4985314,
  8957. -0.9692660,
  8958. 1.8760108,
  8959. 0.0415560,
  8960. 0.0556434,
  8961. -0.2040259,
  8962. 1.0572252
  8963. ]);
  8964. var FLAT_WHITEPOINT_MATRIX = new Float32Array([
  8965. 1,
  8966. 1,
  8967. 1
  8968. ]);
  8969. var tempNormalizeMatrix = new Float32Array(3);
  8970. var tempConvertMatrix1 = new Float32Array(3);
  8971. var tempConvertMatrix2 = new Float32Array(3);
  8972. var DECODE_L_CONSTANT = Math.pow((8 + 16) / 116, 3) / 8.0;
  8973. function CalRGBCS(whitePoint, blackPoint, gamma, matrix) {
  8974. this.name = 'CalRGB';
  8975. this.numComps = 3;
  8976. this.defaultColor = new Float32Array(this.numComps);
  8977. if (!whitePoint) {
  8978. error('WhitePoint missing - required for color space CalRGB');
  8979. }
  8980. blackPoint = blackPoint || new Float32Array(3);
  8981. gamma = gamma || new Float32Array([
  8982. 1,
  8983. 1,
  8984. 1
  8985. ]);
  8986. matrix = matrix || new Float32Array([
  8987. 1,
  8988. 0,
  8989. 0,
  8990. 0,
  8991. 1,
  8992. 0,
  8993. 0,
  8994. 0,
  8995. 1
  8996. ]);
  8997. var XW = whitePoint[0];
  8998. var YW = whitePoint[1];
  8999. var ZW = whitePoint[2];
  9000. this.whitePoint = whitePoint;
  9001. var XB = blackPoint[0];
  9002. var YB = blackPoint[1];
  9003. var ZB = blackPoint[2];
  9004. this.blackPoint = blackPoint;
  9005. this.GR = gamma[0];
  9006. this.GG = gamma[1];
  9007. this.GB = gamma[2];
  9008. this.MXA = matrix[0];
  9009. this.MYA = matrix[1];
  9010. this.MZA = matrix[2];
  9011. this.MXB = matrix[3];
  9012. this.MYB = matrix[4];
  9013. this.MZB = matrix[5];
  9014. this.MXC = matrix[6];
  9015. this.MYC = matrix[7];
  9016. this.MZC = matrix[8];
  9017. if (XW < 0 || ZW < 0 || YW !== 1) {
  9018. error('Invalid WhitePoint components for ' + this.name + ', no fallback available');
  9019. }
  9020. if (XB < 0 || YB < 0 || ZB < 0) {
  9021. info('Invalid BlackPoint for ' + this.name + ' [' + XB + ', ' + YB + ', ' + ZB + '], falling back to default');
  9022. this.blackPoint = new Float32Array(3);
  9023. }
  9024. if (this.GR < 0 || this.GG < 0 || this.GB < 0) {
  9025. info('Invalid Gamma [' + this.GR + ', ' + this.GG + ', ' + this.GB + '] for ' + this.name + ', falling back to default');
  9026. this.GR = this.GG = this.GB = 1;
  9027. }
  9028. 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) {
  9029. 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');
  9030. this.MXA = this.MYB = this.MZC = 1;
  9031. this.MXB = this.MYA = this.MZA = this.MXC = this.MYC = this.MZB = 0;
  9032. }
  9033. }
  9034. function matrixProduct(a, b, result) {
  9035. result[0] = a[0] * b[0] + a[1] * b[1] + a[2] * b[2];
  9036. result[1] = a[3] * b[0] + a[4] * b[1] + a[5] * b[2];
  9037. result[2] = a[6] * b[0] + a[7] * b[1] + a[8] * b[2];
  9038. }
  9039. function convertToFlat(sourceWhitePoint, LMS, result) {
  9040. result[0] = LMS[0] * 1 / sourceWhitePoint[0];
  9041. result[1] = LMS[1] * 1 / sourceWhitePoint[1];
  9042. result[2] = LMS[2] * 1 / sourceWhitePoint[2];
  9043. }
  9044. function convertToD65(sourceWhitePoint, LMS, result) {
  9045. var D65X = 0.95047;
  9046. var D65Y = 1;
  9047. var D65Z = 1.08883;
  9048. result[0] = LMS[0] * D65X / sourceWhitePoint[0];
  9049. result[1] = LMS[1] * D65Y / sourceWhitePoint[1];
  9050. result[2] = LMS[2] * D65Z / sourceWhitePoint[2];
  9051. }
  9052. function sRGBTransferFunction(color) {
  9053. if (color <= 0.0031308) {
  9054. return adjustToRange(0, 1, 12.92 * color);
  9055. }
  9056. return adjustToRange(0, 1, (1 + 0.055) * Math.pow(color, 1 / 2.4) - 0.055);
  9057. }
  9058. function adjustToRange(min, max, value) {
  9059. return Math.max(min, Math.min(max, value));
  9060. }
  9061. function decodeL(L) {
  9062. if (L < 0) {
  9063. return -decodeL(-L);
  9064. }
  9065. if (L > 8.0) {
  9066. return Math.pow((L + 16) / 116, 3);
  9067. }
  9068. return L * DECODE_L_CONSTANT;
  9069. }
  9070. function compensateBlackPoint(sourceBlackPoint, XYZ_Flat, result) {
  9071. if (sourceBlackPoint[0] === 0 && sourceBlackPoint[1] === 0 && sourceBlackPoint[2] === 0) {
  9072. result[0] = XYZ_Flat[0];
  9073. result[1] = XYZ_Flat[1];
  9074. result[2] = XYZ_Flat[2];
  9075. return;
  9076. }
  9077. var zeroDecodeL = decodeL(0);
  9078. var X_DST = zeroDecodeL;
  9079. var X_SRC = decodeL(sourceBlackPoint[0]);
  9080. var Y_DST = zeroDecodeL;
  9081. var Y_SRC = decodeL(sourceBlackPoint[1]);
  9082. var Z_DST = zeroDecodeL;
  9083. var Z_SRC = decodeL(sourceBlackPoint[2]);
  9084. var X_Scale = (1 - X_DST) / (1 - X_SRC);
  9085. var X_Offset = 1 - X_Scale;
  9086. var Y_Scale = (1 - Y_DST) / (1 - Y_SRC);
  9087. var Y_Offset = 1 - Y_Scale;
  9088. var Z_Scale = (1 - Z_DST) / (1 - Z_SRC);
  9089. var Z_Offset = 1 - Z_Scale;
  9090. result[0] = XYZ_Flat[0] * X_Scale + X_Offset;
  9091. result[1] = XYZ_Flat[1] * Y_Scale + Y_Offset;
  9092. result[2] = XYZ_Flat[2] * Z_Scale + Z_Offset;
  9093. }
  9094. function normalizeWhitePointToFlat(sourceWhitePoint, XYZ_In, result) {
  9095. if (sourceWhitePoint[0] === 1 && sourceWhitePoint[2] === 1) {
  9096. result[0] = XYZ_In[0];
  9097. result[1] = XYZ_In[1];
  9098. result[2] = XYZ_In[2];
  9099. return;
  9100. }
  9101. var LMS = result;
  9102. matrixProduct(BRADFORD_SCALE_MATRIX, XYZ_In, LMS);
  9103. var LMS_Flat = tempNormalizeMatrix;
  9104. convertToFlat(sourceWhitePoint, LMS, LMS_Flat);
  9105. matrixProduct(BRADFORD_SCALE_INVERSE_MATRIX, LMS_Flat, result);
  9106. }
  9107. function normalizeWhitePointToD65(sourceWhitePoint, XYZ_In, result) {
  9108. var LMS = result;
  9109. matrixProduct(BRADFORD_SCALE_MATRIX, XYZ_In, LMS);
  9110. var LMS_D65 = tempNormalizeMatrix;
  9111. convertToD65(sourceWhitePoint, LMS, LMS_D65);
  9112. matrixProduct(BRADFORD_SCALE_INVERSE_MATRIX, LMS_D65, result);
  9113. }
  9114. function convertToRgb(cs, src, srcOffset, dest, destOffset, scale) {
  9115. var A = adjustToRange(0, 1, src[srcOffset] * scale);
  9116. var B = adjustToRange(0, 1, src[srcOffset + 1] * scale);
  9117. var C = adjustToRange(0, 1, src[srcOffset + 2] * scale);
  9118. var AGR = Math.pow(A, cs.GR);
  9119. var BGG = Math.pow(B, cs.GG);
  9120. var CGB = Math.pow(C, cs.GB);
  9121. var X = cs.MXA * AGR + cs.MXB * BGG + cs.MXC * CGB;
  9122. var Y = cs.MYA * AGR + cs.MYB * BGG + cs.MYC * CGB;
  9123. var Z = cs.MZA * AGR + cs.MZB * BGG + cs.MZC * CGB;
  9124. var XYZ = tempConvertMatrix1;
  9125. XYZ[0] = X;
  9126. XYZ[1] = Y;
  9127. XYZ[2] = Z;
  9128. var XYZ_Flat = tempConvertMatrix2;
  9129. normalizeWhitePointToFlat(cs.whitePoint, XYZ, XYZ_Flat);
  9130. var XYZ_Black = tempConvertMatrix1;
  9131. compensateBlackPoint(cs.blackPoint, XYZ_Flat, XYZ_Black);
  9132. var XYZ_D65 = tempConvertMatrix2;
  9133. normalizeWhitePointToD65(FLAT_WHITEPOINT_MATRIX, XYZ_Black, XYZ_D65);
  9134. var SRGB = tempConvertMatrix1;
  9135. matrixProduct(SRGB_D65_XYZ_TO_RGB_MATRIX, XYZ_D65, SRGB);
  9136. var sR = sRGBTransferFunction(SRGB[0]);
  9137. var sG = sRGBTransferFunction(SRGB[1]);
  9138. var sB = sRGBTransferFunction(SRGB[2]);
  9139. dest[destOffset] = Math.round(sR * 255);
  9140. dest[destOffset + 1] = Math.round(sG * 255);
  9141. dest[destOffset + 2] = Math.round(sB * 255);
  9142. }
  9143. CalRGBCS.prototype = {
  9144. getRgb: function CalRGBCS_getRgb(src, srcOffset) {
  9145. var rgb = new Uint8Array(3);
  9146. this.getRgbItem(src, srcOffset, rgb, 0);
  9147. return rgb;
  9148. },
  9149. getRgbItem: function CalRGBCS_getRgbItem(src, srcOffset, dest, destOffset) {
  9150. convertToRgb(this, src, srcOffset, dest, destOffset, 1);
  9151. },
  9152. getRgbBuffer: function CalRGBCS_getRgbBuffer(src, srcOffset, count, dest, destOffset, bits, alpha01) {
  9153. var scale = 1 / ((1 << bits) - 1);
  9154. for (var i = 0; i < count; ++i) {
  9155. convertToRgb(this, src, srcOffset, dest, destOffset, scale);
  9156. srcOffset += 3;
  9157. destOffset += 3 + alpha01;
  9158. }
  9159. },
  9160. getOutputLength: function CalRGBCS_getOutputLength(inputLength, alpha01) {
  9161. return inputLength * (3 + alpha01) / 3 | 0;
  9162. },
  9163. isPassthrough: ColorSpace.prototype.isPassthrough,
  9164. fillRgb: ColorSpace.prototype.fillRgb,
  9165. isDefaultDecode: function CalRGBCS_isDefaultDecode(decodeMap) {
  9166. return ColorSpace.isDefaultDecode(decodeMap, this.numComps);
  9167. },
  9168. usesZeroToOneRange: true
  9169. };
  9170. return CalRGBCS;
  9171. }();
  9172. var LabCS = function LabCSClosure() {
  9173. function LabCS(whitePoint, blackPoint, range) {
  9174. this.name = 'Lab';
  9175. this.numComps = 3;
  9176. this.defaultColor = new Float32Array(this.numComps);
  9177. if (!whitePoint) {
  9178. error('WhitePoint missing - required for color space Lab');
  9179. }
  9180. blackPoint = blackPoint || [
  9181. 0,
  9182. 0,
  9183. 0
  9184. ];
  9185. range = range || [
  9186. -100,
  9187. 100,
  9188. -100,
  9189. 100
  9190. ];
  9191. this.XW = whitePoint[0];
  9192. this.YW = whitePoint[1];
  9193. this.ZW = whitePoint[2];
  9194. this.amin = range[0];
  9195. this.amax = range[1];
  9196. this.bmin = range[2];
  9197. this.bmax = range[3];
  9198. this.XB = blackPoint[0];
  9199. this.YB = blackPoint[1];
  9200. this.ZB = blackPoint[2];
  9201. if (this.XW < 0 || this.ZW < 0 || this.YW !== 1) {
  9202. error('Invalid WhitePoint components, no fallback available');
  9203. }
  9204. if (this.XB < 0 || this.YB < 0 || this.ZB < 0) {
  9205. info('Invalid BlackPoint, falling back to default');
  9206. this.XB = this.YB = this.ZB = 0;
  9207. }
  9208. if (this.amin > this.amax || this.bmin > this.bmax) {
  9209. info('Invalid Range, falling back to defaults');
  9210. this.amin = -100;
  9211. this.amax = 100;
  9212. this.bmin = -100;
  9213. this.bmax = 100;
  9214. }
  9215. }
  9216. function fn_g(x) {
  9217. var result;
  9218. if (x >= 6 / 29) {
  9219. result = x * x * x;
  9220. } else {
  9221. result = 108 / 841 * (x - 4 / 29);
  9222. }
  9223. return result;
  9224. }
  9225. function decode(value, high1, low2, high2) {
  9226. return low2 + value * (high2 - low2) / high1;
  9227. }
  9228. function convertToRgb(cs, src, srcOffset, maxVal, dest, destOffset) {
  9229. var Ls = src[srcOffset];
  9230. var as = src[srcOffset + 1];
  9231. var bs = src[srcOffset + 2];
  9232. if (maxVal !== false) {
  9233. Ls = decode(Ls, maxVal, 0, 100);
  9234. as = decode(as, maxVal, cs.amin, cs.amax);
  9235. bs = decode(bs, maxVal, cs.bmin, cs.bmax);
  9236. }
  9237. as = as > cs.amax ? cs.amax : as < cs.amin ? cs.amin : as;
  9238. bs = bs > cs.bmax ? cs.bmax : bs < cs.bmin ? cs.bmin : bs;
  9239. var M = (Ls + 16) / 116;
  9240. var L = M + as / 500;
  9241. var N = M - bs / 200;
  9242. var X = cs.XW * fn_g(L);
  9243. var Y = cs.YW * fn_g(M);
  9244. var Z = cs.ZW * fn_g(N);
  9245. var r, g, b;
  9246. if (cs.ZW < 1) {
  9247. r = X * 3.1339 + Y * -1.6170 + Z * -0.4906;
  9248. g = X * -0.9785 + Y * 1.9160 + Z * 0.0333;
  9249. b = X * 0.0720 + Y * -0.2290 + Z * 1.4057;
  9250. } else {
  9251. r = X * 3.2406 + Y * -1.5372 + Z * -0.4986;
  9252. g = X * -0.9689 + Y * 1.8758 + Z * 0.0415;
  9253. b = X * 0.0557 + Y * -0.2040 + Z * 1.0570;
  9254. }
  9255. dest[destOffset] = r <= 0 ? 0 : r >= 1 ? 255 : Math.sqrt(r) * 255 | 0;
  9256. dest[destOffset + 1] = g <= 0 ? 0 : g >= 1 ? 255 : Math.sqrt(g) * 255 | 0;
  9257. dest[destOffset + 2] = b <= 0 ? 0 : b >= 1 ? 255 : Math.sqrt(b) * 255 | 0;
  9258. }
  9259. LabCS.prototype = {
  9260. getRgb: ColorSpace.prototype.getRgb,
  9261. getRgbItem: function LabCS_getRgbItem(src, srcOffset, dest, destOffset) {
  9262. convertToRgb(this, src, srcOffset, false, dest, destOffset);
  9263. },
  9264. getRgbBuffer: function LabCS_getRgbBuffer(src, srcOffset, count, dest, destOffset, bits, alpha01) {
  9265. var maxVal = (1 << bits) - 1;
  9266. for (var i = 0; i < count; i++) {
  9267. convertToRgb(this, src, srcOffset, maxVal, dest, destOffset);
  9268. srcOffset += 3;
  9269. destOffset += 3 + alpha01;
  9270. }
  9271. },
  9272. getOutputLength: function LabCS_getOutputLength(inputLength, alpha01) {
  9273. return inputLength * (3 + alpha01) / 3 | 0;
  9274. },
  9275. isPassthrough: ColorSpace.prototype.isPassthrough,
  9276. fillRgb: ColorSpace.prototype.fillRgb,
  9277. isDefaultDecode: function LabCS_isDefaultDecode(decodeMap) {
  9278. return true;
  9279. },
  9280. usesZeroToOneRange: false
  9281. };
  9282. return LabCS;
  9283. }();
  9284. exports.ColorSpace = ColorSpace;
  9285. /***/ }),
  9286. /* 4 */
  9287. /***/ (function(module, exports, __w_pdfjs_require__) {
  9288. "use strict";
  9289. var ExpertEncoding = [
  9290. '',
  9291. '',
  9292. '',
  9293. '',
  9294. '',
  9295. '',
  9296. '',
  9297. '',
  9298. '',
  9299. '',
  9300. '',
  9301. '',
  9302. '',
  9303. '',
  9304. '',
  9305. '',
  9306. '',
  9307. '',
  9308. '',
  9309. '',
  9310. '',
  9311. '',
  9312. '',
  9313. '',
  9314. '',
  9315. '',
  9316. '',
  9317. '',
  9318. '',
  9319. '',
  9320. '',
  9321. '',
  9322. 'space',
  9323. 'exclamsmall',
  9324. 'Hungarumlautsmall',
  9325. '',
  9326. 'dollaroldstyle',
  9327. 'dollarsuperior',
  9328. 'ampersandsmall',
  9329. 'Acutesmall',
  9330. 'parenleftsuperior',
  9331. 'parenrightsuperior',
  9332. 'twodotenleader',
  9333. 'onedotenleader',
  9334. 'comma',
  9335. 'hyphen',
  9336. 'period',
  9337. 'fraction',
  9338. 'zerooldstyle',
  9339. 'oneoldstyle',
  9340. 'twooldstyle',
  9341. 'threeoldstyle',
  9342. 'fouroldstyle',
  9343. 'fiveoldstyle',
  9344. 'sixoldstyle',
  9345. 'sevenoldstyle',
  9346. 'eightoldstyle',
  9347. 'nineoldstyle',
  9348. 'colon',
  9349. 'semicolon',
  9350. 'commasuperior',
  9351. 'threequartersemdash',
  9352. 'periodsuperior',
  9353. 'questionsmall',
  9354. '',
  9355. 'asuperior',
  9356. 'bsuperior',
  9357. 'centsuperior',
  9358. 'dsuperior',
  9359. 'esuperior',
  9360. '',
  9361. '',
  9362. 'isuperior',
  9363. '',
  9364. '',
  9365. 'lsuperior',
  9366. 'msuperior',
  9367. 'nsuperior',
  9368. 'osuperior',
  9369. '',
  9370. '',
  9371. 'rsuperior',
  9372. 'ssuperior',
  9373. 'tsuperior',
  9374. '',
  9375. 'ff',
  9376. 'fi',
  9377. 'fl',
  9378. 'ffi',
  9379. 'ffl',
  9380. 'parenleftinferior',
  9381. '',
  9382. 'parenrightinferior',
  9383. 'Circumflexsmall',
  9384. 'hyphensuperior',
  9385. 'Gravesmall',
  9386. 'Asmall',
  9387. 'Bsmall',
  9388. 'Csmall',
  9389. 'Dsmall',
  9390. 'Esmall',
  9391. 'Fsmall',
  9392. 'Gsmall',
  9393. 'Hsmall',
  9394. 'Ismall',
  9395. 'Jsmall',
  9396. 'Ksmall',
  9397. 'Lsmall',
  9398. 'Msmall',
  9399. 'Nsmall',
  9400. 'Osmall',
  9401. 'Psmall',
  9402. 'Qsmall',
  9403. 'Rsmall',
  9404. 'Ssmall',
  9405. 'Tsmall',
  9406. 'Usmall',
  9407. 'Vsmall',
  9408. 'Wsmall',
  9409. 'Xsmall',
  9410. 'Ysmall',
  9411. 'Zsmall',
  9412. 'colonmonetary',
  9413. 'onefitted',
  9414. 'rupiah',
  9415. 'Tildesmall',
  9416. '',
  9417. '',
  9418. '',
  9419. '',
  9420. '',
  9421. '',
  9422. '',
  9423. '',
  9424. '',
  9425. '',
  9426. '',
  9427. '',
  9428. '',
  9429. '',
  9430. '',
  9431. '',
  9432. '',
  9433. '',
  9434. '',
  9435. '',
  9436. '',
  9437. '',
  9438. '',
  9439. '',
  9440. '',
  9441. '',
  9442. '',
  9443. '',
  9444. '',
  9445. '',
  9446. '',
  9447. '',
  9448. '',
  9449. '',
  9450. 'exclamdownsmall',
  9451. 'centoldstyle',
  9452. 'Lslashsmall',
  9453. '',
  9454. '',
  9455. 'Scaronsmall',
  9456. 'Zcaronsmall',
  9457. 'Dieresissmall',
  9458. 'Brevesmall',
  9459. 'Caronsmall',
  9460. '',
  9461. 'Dotaccentsmall',
  9462. '',
  9463. '',
  9464. 'Macronsmall',
  9465. '',
  9466. '',
  9467. 'figuredash',
  9468. 'hypheninferior',
  9469. '',
  9470. '',
  9471. 'Ogoneksmall',
  9472. 'Ringsmall',
  9473. 'Cedillasmall',
  9474. '',
  9475. '',
  9476. '',
  9477. 'onequarter',
  9478. 'onehalf',
  9479. 'threequarters',
  9480. 'questiondownsmall',
  9481. 'oneeighth',
  9482. 'threeeighths',
  9483. 'fiveeighths',
  9484. 'seveneighths',
  9485. 'onethird',
  9486. 'twothirds',
  9487. '',
  9488. '',
  9489. 'zerosuperior',
  9490. 'onesuperior',
  9491. 'twosuperior',
  9492. 'threesuperior',
  9493. 'foursuperior',
  9494. 'fivesuperior',
  9495. 'sixsuperior',
  9496. 'sevensuperior',
  9497. 'eightsuperior',
  9498. 'ninesuperior',
  9499. 'zeroinferior',
  9500. 'oneinferior',
  9501. 'twoinferior',
  9502. 'threeinferior',
  9503. 'fourinferior',
  9504. 'fiveinferior',
  9505. 'sixinferior',
  9506. 'seveninferior',
  9507. 'eightinferior',
  9508. 'nineinferior',
  9509. 'centinferior',
  9510. 'dollarinferior',
  9511. 'periodinferior',
  9512. 'commainferior',
  9513. 'Agravesmall',
  9514. 'Aacutesmall',
  9515. 'Acircumflexsmall',
  9516. 'Atildesmall',
  9517. 'Adieresissmall',
  9518. 'Aringsmall',
  9519. 'AEsmall',
  9520. 'Ccedillasmall',
  9521. 'Egravesmall',
  9522. 'Eacutesmall',
  9523. 'Ecircumflexsmall',
  9524. 'Edieresissmall',
  9525. 'Igravesmall',
  9526. 'Iacutesmall',
  9527. 'Icircumflexsmall',
  9528. 'Idieresissmall',
  9529. 'Ethsmall',
  9530. 'Ntildesmall',
  9531. 'Ogravesmall',
  9532. 'Oacutesmall',
  9533. 'Ocircumflexsmall',
  9534. 'Otildesmall',
  9535. 'Odieresissmall',
  9536. 'OEsmall',
  9537. 'Oslashsmall',
  9538. 'Ugravesmall',
  9539. 'Uacutesmall',
  9540. 'Ucircumflexsmall',
  9541. 'Udieresissmall',
  9542. 'Yacutesmall',
  9543. 'Thornsmall',
  9544. 'Ydieresissmall'
  9545. ];
  9546. var MacExpertEncoding = [
  9547. '',
  9548. '',
  9549. '',
  9550. '',
  9551. '',
  9552. '',
  9553. '',
  9554. '',
  9555. '',
  9556. '',
  9557. '',
  9558. '',
  9559. '',
  9560. '',
  9561. '',
  9562. '',
  9563. '',
  9564. '',
  9565. '',
  9566. '',
  9567. '',
  9568. '',
  9569. '',
  9570. '',
  9571. '',
  9572. '',
  9573. '',
  9574. '',
  9575. '',
  9576. '',
  9577. '',
  9578. '',
  9579. 'space',
  9580. 'exclamsmall',
  9581. 'Hungarumlautsmall',
  9582. 'centoldstyle',
  9583. 'dollaroldstyle',
  9584. 'dollarsuperior',
  9585. 'ampersandsmall',
  9586. 'Acutesmall',
  9587. 'parenleftsuperior',
  9588. 'parenrightsuperior',
  9589. 'twodotenleader',
  9590. 'onedotenleader',
  9591. 'comma',
  9592. 'hyphen',
  9593. 'period',
  9594. 'fraction',
  9595. 'zerooldstyle',
  9596. 'oneoldstyle',
  9597. 'twooldstyle',
  9598. 'threeoldstyle',
  9599. 'fouroldstyle',
  9600. 'fiveoldstyle',
  9601. 'sixoldstyle',
  9602. 'sevenoldstyle',
  9603. 'eightoldstyle',
  9604. 'nineoldstyle',
  9605. 'colon',
  9606. 'semicolon',
  9607. '',
  9608. 'threequartersemdash',
  9609. '',
  9610. 'questionsmall',
  9611. '',
  9612. '',
  9613. '',
  9614. '',
  9615. 'Ethsmall',
  9616. '',
  9617. '',
  9618. 'onequarter',
  9619. 'onehalf',
  9620. 'threequarters',
  9621. 'oneeighth',
  9622. 'threeeighths',
  9623. 'fiveeighths',
  9624. 'seveneighths',
  9625. 'onethird',
  9626. 'twothirds',
  9627. '',
  9628. '',
  9629. '',
  9630. '',
  9631. '',
  9632. '',
  9633. 'ff',
  9634. 'fi',
  9635. 'fl',
  9636. 'ffi',
  9637. 'ffl',
  9638. 'parenleftinferior',
  9639. '',
  9640. 'parenrightinferior',
  9641. 'Circumflexsmall',
  9642. 'hypheninferior',
  9643. 'Gravesmall',
  9644. 'Asmall',
  9645. 'Bsmall',
  9646. 'Csmall',
  9647. 'Dsmall',
  9648. 'Esmall',
  9649. 'Fsmall',
  9650. 'Gsmall',
  9651. 'Hsmall',
  9652. 'Ismall',
  9653. 'Jsmall',
  9654. 'Ksmall',
  9655. 'Lsmall',
  9656. 'Msmall',
  9657. 'Nsmall',
  9658. 'Osmall',
  9659. 'Psmall',
  9660. 'Qsmall',
  9661. 'Rsmall',
  9662. 'Ssmall',
  9663. 'Tsmall',
  9664. 'Usmall',
  9665. 'Vsmall',
  9666. 'Wsmall',
  9667. 'Xsmall',
  9668. 'Ysmall',
  9669. 'Zsmall',
  9670. 'colonmonetary',
  9671. 'onefitted',
  9672. 'rupiah',
  9673. 'Tildesmall',
  9674. '',
  9675. '',
  9676. 'asuperior',
  9677. 'centsuperior',
  9678. '',
  9679. '',
  9680. '',
  9681. '',
  9682. 'Aacutesmall',
  9683. 'Agravesmall',
  9684. 'Acircumflexsmall',
  9685. 'Adieresissmall',
  9686. 'Atildesmall',
  9687. 'Aringsmall',
  9688. 'Ccedillasmall',
  9689. 'Eacutesmall',
  9690. 'Egravesmall',
  9691. 'Ecircumflexsmall',
  9692. 'Edieresissmall',
  9693. 'Iacutesmall',
  9694. 'Igravesmall',
  9695. 'Icircumflexsmall',
  9696. 'Idieresissmall',
  9697. 'Ntildesmall',
  9698. 'Oacutesmall',
  9699. 'Ogravesmall',
  9700. 'Ocircumflexsmall',
  9701. 'Odieresissmall',
  9702. 'Otildesmall',
  9703. 'Uacutesmall',
  9704. 'Ugravesmall',
  9705. 'Ucircumflexsmall',
  9706. 'Udieresissmall',
  9707. '',
  9708. 'eightsuperior',
  9709. 'fourinferior',
  9710. 'threeinferior',
  9711. 'sixinferior',
  9712. 'eightinferior',
  9713. 'seveninferior',
  9714. 'Scaronsmall',
  9715. '',
  9716. 'centinferior',
  9717. 'twoinferior',
  9718. '',
  9719. 'Dieresissmall',
  9720. '',
  9721. 'Caronsmall',
  9722. 'osuperior',
  9723. 'fiveinferior',
  9724. '',
  9725. 'commainferior',
  9726. 'periodinferior',
  9727. 'Yacutesmall',
  9728. '',
  9729. 'dollarinferior',
  9730. '',
  9731. 'Thornsmall',
  9732. '',
  9733. 'nineinferior',
  9734. 'zeroinferior',
  9735. 'Zcaronsmall',
  9736. 'AEsmall',
  9737. 'Oslashsmall',
  9738. 'questiondownsmall',
  9739. 'oneinferior',
  9740. 'Lslashsmall',
  9741. '',
  9742. '',
  9743. '',
  9744. '',
  9745. '',
  9746. '',
  9747. 'Cedillasmall',
  9748. '',
  9749. '',
  9750. '',
  9751. '',
  9752. '',
  9753. 'OEsmall',
  9754. 'figuredash',
  9755. 'hyphensuperior',
  9756. '',
  9757. '',
  9758. '',
  9759. '',
  9760. 'exclamdownsmall',
  9761. '',
  9762. 'Ydieresissmall',
  9763. '',
  9764. 'onesuperior',
  9765. 'twosuperior',
  9766. 'threesuperior',
  9767. 'foursuperior',
  9768. 'fivesuperior',
  9769. 'sixsuperior',
  9770. 'sevensuperior',
  9771. 'ninesuperior',
  9772. 'zerosuperior',
  9773. '',
  9774. 'esuperior',
  9775. 'rsuperior',
  9776. 'tsuperior',
  9777. '',
  9778. '',
  9779. 'isuperior',
  9780. 'ssuperior',
  9781. 'dsuperior',
  9782. '',
  9783. '',
  9784. '',
  9785. '',
  9786. '',
  9787. 'lsuperior',
  9788. 'Ogoneksmall',
  9789. 'Brevesmall',
  9790. 'Macronsmall',
  9791. 'bsuperior',
  9792. 'nsuperior',
  9793. 'msuperior',
  9794. 'commasuperior',
  9795. 'periodsuperior',
  9796. 'Dotaccentsmall',
  9797. 'Ringsmall'
  9798. ];
  9799. var MacRomanEncoding = [
  9800. '',
  9801. '',
  9802. '',
  9803. '',
  9804. '',
  9805. '',
  9806. '',
  9807. '',
  9808. '',
  9809. '',
  9810. '',
  9811. '',
  9812. '',
  9813. '',
  9814. '',
  9815. '',
  9816. '',
  9817. '',
  9818. '',
  9819. '',
  9820. '',
  9821. '',
  9822. '',
  9823. '',
  9824. '',
  9825. '',
  9826. '',
  9827. '',
  9828. '',
  9829. '',
  9830. '',
  9831. '',
  9832. 'space',
  9833. 'exclam',
  9834. 'quotedbl',
  9835. 'numbersign',
  9836. 'dollar',
  9837. 'percent',
  9838. 'ampersand',
  9839. 'quotesingle',
  9840. 'parenleft',
  9841. 'parenright',
  9842. 'asterisk',
  9843. 'plus',
  9844. 'comma',
  9845. 'hyphen',
  9846. 'period',
  9847. 'slash',
  9848. 'zero',
  9849. 'one',
  9850. 'two',
  9851. 'three',
  9852. 'four',
  9853. 'five',
  9854. 'six',
  9855. 'seven',
  9856. 'eight',
  9857. 'nine',
  9858. 'colon',
  9859. 'semicolon',
  9860. 'less',
  9861. 'equal',
  9862. 'greater',
  9863. 'question',
  9864. 'at',
  9865. 'A',
  9866. 'B',
  9867. 'C',
  9868. 'D',
  9869. 'E',
  9870. 'F',
  9871. 'G',
  9872. 'H',
  9873. 'I',
  9874. 'J',
  9875. 'K',
  9876. 'L',
  9877. 'M',
  9878. 'N',
  9879. 'O',
  9880. 'P',
  9881. 'Q',
  9882. 'R',
  9883. 'S',
  9884. 'T',
  9885. 'U',
  9886. 'V',
  9887. 'W',
  9888. 'X',
  9889. 'Y',
  9890. 'Z',
  9891. 'bracketleft',
  9892. 'backslash',
  9893. 'bracketright',
  9894. 'asciicircum',
  9895. 'underscore',
  9896. 'grave',
  9897. 'a',
  9898. 'b',
  9899. 'c',
  9900. 'd',
  9901. 'e',
  9902. 'f',
  9903. 'g',
  9904. 'h',
  9905. 'i',
  9906. 'j',
  9907. 'k',
  9908. 'l',
  9909. 'm',
  9910. 'n',
  9911. 'o',
  9912. 'p',
  9913. 'q',
  9914. 'r',
  9915. 's',
  9916. 't',
  9917. 'u',
  9918. 'v',
  9919. 'w',
  9920. 'x',
  9921. 'y',
  9922. 'z',
  9923. 'braceleft',
  9924. 'bar',
  9925. 'braceright',
  9926. 'asciitilde',
  9927. '',
  9928. 'Adieresis',
  9929. 'Aring',
  9930. 'Ccedilla',
  9931. 'Eacute',
  9932. 'Ntilde',
  9933. 'Odieresis',
  9934. 'Udieresis',
  9935. 'aacute',
  9936. 'agrave',
  9937. 'acircumflex',
  9938. 'adieresis',
  9939. 'atilde',
  9940. 'aring',
  9941. 'ccedilla',
  9942. 'eacute',
  9943. 'egrave',
  9944. 'ecircumflex',
  9945. 'edieresis',
  9946. 'iacute',
  9947. 'igrave',
  9948. 'icircumflex',
  9949. 'idieresis',
  9950. 'ntilde',
  9951. 'oacute',
  9952. 'ograve',
  9953. 'ocircumflex',
  9954. 'odieresis',
  9955. 'otilde',
  9956. 'uacute',
  9957. 'ugrave',
  9958. 'ucircumflex',
  9959. 'udieresis',
  9960. 'dagger',
  9961. 'degree',
  9962. 'cent',
  9963. 'sterling',
  9964. 'section',
  9965. 'bullet',
  9966. 'paragraph',
  9967. 'germandbls',
  9968. 'registered',
  9969. 'copyright',
  9970. 'trademark',
  9971. 'acute',
  9972. 'dieresis',
  9973. 'notequal',
  9974. 'AE',
  9975. 'Oslash',
  9976. 'infinity',
  9977. 'plusminus',
  9978. 'lessequal',
  9979. 'greaterequal',
  9980. 'yen',
  9981. 'mu',
  9982. 'partialdiff',
  9983. 'summation',
  9984. 'product',
  9985. 'pi',
  9986. 'integral',
  9987. 'ordfeminine',
  9988. 'ordmasculine',
  9989. 'Omega',
  9990. 'ae',
  9991. 'oslash',
  9992. 'questiondown',
  9993. 'exclamdown',
  9994. 'logicalnot',
  9995. 'radical',
  9996. 'florin',
  9997. 'approxequal',
  9998. 'Delta',
  9999. 'guillemotleft',
  10000. 'guillemotright',
  10001. 'ellipsis',
  10002. 'space',
  10003. 'Agrave',
  10004. 'Atilde',
  10005. 'Otilde',
  10006. 'OE',
  10007. 'oe',
  10008. 'endash',
  10009. 'emdash',
  10010. 'quotedblleft',
  10011. 'quotedblright',
  10012. 'quoteleft',
  10013. 'quoteright',
  10014. 'divide',
  10015. 'lozenge',
  10016. 'ydieresis',
  10017. 'Ydieresis',
  10018. 'fraction',
  10019. 'currency',
  10020. 'guilsinglleft',
  10021. 'guilsinglright',
  10022. 'fi',
  10023. 'fl',
  10024. 'daggerdbl',
  10025. 'periodcentered',
  10026. 'quotesinglbase',
  10027. 'quotedblbase',
  10028. 'perthousand',
  10029. 'Acircumflex',
  10030. 'Ecircumflex',
  10031. 'Aacute',
  10032. 'Edieresis',
  10033. 'Egrave',
  10034. 'Iacute',
  10035. 'Icircumflex',
  10036. 'Idieresis',
  10037. 'Igrave',
  10038. 'Oacute',
  10039. 'Ocircumflex',
  10040. 'apple',
  10041. 'Ograve',
  10042. 'Uacute',
  10043. 'Ucircumflex',
  10044. 'Ugrave',
  10045. 'dotlessi',
  10046. 'circumflex',
  10047. 'tilde',
  10048. 'macron',
  10049. 'breve',
  10050. 'dotaccent',
  10051. 'ring',
  10052. 'cedilla',
  10053. 'hungarumlaut',
  10054. 'ogonek',
  10055. 'caron'
  10056. ];
  10057. var StandardEncoding = [
  10058. '',
  10059. '',
  10060. '',
  10061. '',
  10062. '',
  10063. '',
  10064. '',
  10065. '',
  10066. '',
  10067. '',
  10068. '',
  10069. '',
  10070. '',
  10071. '',
  10072. '',
  10073. '',
  10074. '',
  10075. '',
  10076. '',
  10077. '',
  10078. '',
  10079. '',
  10080. '',
  10081. '',
  10082. '',
  10083. '',
  10084. '',
  10085. '',
  10086. '',
  10087. '',
  10088. '',
  10089. '',
  10090. 'space',
  10091. 'exclam',
  10092. 'quotedbl',
  10093. 'numbersign',
  10094. 'dollar',
  10095. 'percent',
  10096. 'ampersand',
  10097. 'quoteright',
  10098. 'parenleft',
  10099. 'parenright',
  10100. 'asterisk',
  10101. 'plus',
  10102. 'comma',
  10103. 'hyphen',
  10104. 'period',
  10105. 'slash',
  10106. 'zero',
  10107. 'one',
  10108. 'two',
  10109. 'three',
  10110. 'four',
  10111. 'five',
  10112. 'six',
  10113. 'seven',
  10114. 'eight',
  10115. 'nine',
  10116. 'colon',
  10117. 'semicolon',
  10118. 'less',
  10119. 'equal',
  10120. 'greater',
  10121. 'question',
  10122. 'at',
  10123. 'A',
  10124. 'B',
  10125. 'C',
  10126. 'D',
  10127. 'E',
  10128. 'F',
  10129. 'G',
  10130. 'H',
  10131. 'I',
  10132. 'J',
  10133. 'K',
  10134. 'L',
  10135. 'M',
  10136. 'N',
  10137. 'O',
  10138. 'P',
  10139. 'Q',
  10140. 'R',
  10141. 'S',
  10142. 'T',
  10143. 'U',
  10144. 'V',
  10145. 'W',
  10146. 'X',
  10147. 'Y',
  10148. 'Z',
  10149. 'bracketleft',
  10150. 'backslash',
  10151. 'bracketright',
  10152. 'asciicircum',
  10153. 'underscore',
  10154. 'quoteleft',
  10155. 'a',
  10156. 'b',
  10157. 'c',
  10158. 'd',
  10159. 'e',
  10160. 'f',
  10161. 'g',
  10162. 'h',
  10163. 'i',
  10164. 'j',
  10165. 'k',
  10166. 'l',
  10167. 'm',
  10168. 'n',
  10169. 'o',
  10170. 'p',
  10171. 'q',
  10172. 'r',
  10173. 's',
  10174. 't',
  10175. 'u',
  10176. 'v',
  10177. 'w',
  10178. 'x',
  10179. 'y',
  10180. 'z',
  10181. 'braceleft',
  10182. 'bar',
  10183. 'braceright',
  10184. 'asciitilde',
  10185. '',
  10186. '',
  10187. '',
  10188. '',
  10189. '',
  10190. '',
  10191. '',
  10192. '',
  10193. '',
  10194. '',
  10195. '',
  10196. '',
  10197. '',
  10198. '',
  10199. '',
  10200. '',
  10201. '',
  10202. '',
  10203. '',
  10204. '',
  10205. '',
  10206. '',
  10207. '',
  10208. '',
  10209. '',
  10210. '',
  10211. '',
  10212. '',
  10213. '',
  10214. '',
  10215. '',
  10216. '',
  10217. '',
  10218. '',
  10219. 'exclamdown',
  10220. 'cent',
  10221. 'sterling',
  10222. 'fraction',
  10223. 'yen',
  10224. 'florin',
  10225. 'section',
  10226. 'currency',
  10227. 'quotesingle',
  10228. 'quotedblleft',
  10229. 'guillemotleft',
  10230. 'guilsinglleft',
  10231. 'guilsinglright',
  10232. 'fi',
  10233. 'fl',
  10234. '',
  10235. 'endash',
  10236. 'dagger',
  10237. 'daggerdbl',
  10238. 'periodcentered',
  10239. '',
  10240. 'paragraph',
  10241. 'bullet',
  10242. 'quotesinglbase',
  10243. 'quotedblbase',
  10244. 'quotedblright',
  10245. 'guillemotright',
  10246. 'ellipsis',
  10247. 'perthousand',
  10248. '',
  10249. 'questiondown',
  10250. '',
  10251. 'grave',
  10252. 'acute',
  10253. 'circumflex',
  10254. 'tilde',
  10255. 'macron',
  10256. 'breve',
  10257. 'dotaccent',
  10258. 'dieresis',
  10259. '',
  10260. 'ring',
  10261. 'cedilla',
  10262. '',
  10263. 'hungarumlaut',
  10264. 'ogonek',
  10265. 'caron',
  10266. 'emdash',
  10267. '',
  10268. '',
  10269. '',
  10270. '',
  10271. '',
  10272. '',
  10273. '',
  10274. '',
  10275. '',
  10276. '',
  10277. '',
  10278. '',
  10279. '',
  10280. '',
  10281. '',
  10282. '',
  10283. 'AE',
  10284. '',
  10285. 'ordfeminine',
  10286. '',
  10287. '',
  10288. '',
  10289. '',
  10290. 'Lslash',
  10291. 'Oslash',
  10292. 'OE',
  10293. 'ordmasculine',
  10294. '',
  10295. '',
  10296. '',
  10297. '',
  10298. '',
  10299. 'ae',
  10300. '',
  10301. '',
  10302. '',
  10303. 'dotlessi',
  10304. '',
  10305. '',
  10306. 'lslash',
  10307. 'oslash',
  10308. 'oe',
  10309. 'germandbls'
  10310. ];
  10311. var WinAnsiEncoding = [
  10312. '',
  10313. '',
  10314. '',
  10315. '',
  10316. '',
  10317. '',
  10318. '',
  10319. '',
  10320. '',
  10321. '',
  10322. '',
  10323. '',
  10324. '',
  10325. '',
  10326. '',
  10327. '',
  10328. '',
  10329. '',
  10330. '',
  10331. '',
  10332. '',
  10333. '',
  10334. '',
  10335. '',
  10336. '',
  10337. '',
  10338. '',
  10339. '',
  10340. '',
  10341. '',
  10342. '',
  10343. '',
  10344. 'space',
  10345. 'exclam',
  10346. 'quotedbl',
  10347. 'numbersign',
  10348. 'dollar',
  10349. 'percent',
  10350. 'ampersand',
  10351. 'quotesingle',
  10352. 'parenleft',
  10353. 'parenright',
  10354. 'asterisk',
  10355. 'plus',
  10356. 'comma',
  10357. 'hyphen',
  10358. 'period',
  10359. 'slash',
  10360. 'zero',
  10361. 'one',
  10362. 'two',
  10363. 'three',
  10364. 'four',
  10365. 'five',
  10366. 'six',
  10367. 'seven',
  10368. 'eight',
  10369. 'nine',
  10370. 'colon',
  10371. 'semicolon',
  10372. 'less',
  10373. 'equal',
  10374. 'greater',
  10375. 'question',
  10376. 'at',
  10377. 'A',
  10378. 'B',
  10379. 'C',
  10380. 'D',
  10381. 'E',
  10382. 'F',
  10383. 'G',
  10384. 'H',
  10385. 'I',
  10386. 'J',
  10387. 'K',
  10388. 'L',
  10389. 'M',
  10390. 'N',
  10391. 'O',
  10392. 'P',
  10393. 'Q',
  10394. 'R',
  10395. 'S',
  10396. 'T',
  10397. 'U',
  10398. 'V',
  10399. 'W',
  10400. 'X',
  10401. 'Y',
  10402. 'Z',
  10403. 'bracketleft',
  10404. 'backslash',
  10405. 'bracketright',
  10406. 'asciicircum',
  10407. 'underscore',
  10408. 'grave',
  10409. 'a',
  10410. 'b',
  10411. 'c',
  10412. 'd',
  10413. 'e',
  10414. 'f',
  10415. 'g',
  10416. 'h',
  10417. 'i',
  10418. 'j',
  10419. 'k',
  10420. 'l',
  10421. 'm',
  10422. 'n',
  10423. 'o',
  10424. 'p',
  10425. 'q',
  10426. 'r',
  10427. 's',
  10428. 't',
  10429. 'u',
  10430. 'v',
  10431. 'w',
  10432. 'x',
  10433. 'y',
  10434. 'z',
  10435. 'braceleft',
  10436. 'bar',
  10437. 'braceright',
  10438. 'asciitilde',
  10439. 'bullet',
  10440. 'Euro',
  10441. 'bullet',
  10442. 'quotesinglbase',
  10443. 'florin',
  10444. 'quotedblbase',
  10445. 'ellipsis',
  10446. 'dagger',
  10447. 'daggerdbl',
  10448. 'circumflex',
  10449. 'perthousand',
  10450. 'Scaron',
  10451. 'guilsinglleft',
  10452. 'OE',
  10453. 'bullet',
  10454. 'Zcaron',
  10455. 'bullet',
  10456. 'bullet',
  10457. 'quoteleft',
  10458. 'quoteright',
  10459. 'quotedblleft',
  10460. 'quotedblright',
  10461. 'bullet',
  10462. 'endash',
  10463. 'emdash',
  10464. 'tilde',
  10465. 'trademark',
  10466. 'scaron',
  10467. 'guilsinglright',
  10468. 'oe',
  10469. 'bullet',
  10470. 'zcaron',
  10471. 'Ydieresis',
  10472. 'space',
  10473. 'exclamdown',
  10474. 'cent',
  10475. 'sterling',
  10476. 'currency',
  10477. 'yen',
  10478. 'brokenbar',
  10479. 'section',
  10480. 'dieresis',
  10481. 'copyright',
  10482. 'ordfeminine',
  10483. 'guillemotleft',
  10484. 'logicalnot',
  10485. 'hyphen',
  10486. 'registered',
  10487. 'macron',
  10488. 'degree',
  10489. 'plusminus',
  10490. 'twosuperior',
  10491. 'threesuperior',
  10492. 'acute',
  10493. 'mu',
  10494. 'paragraph',
  10495. 'periodcentered',
  10496. 'cedilla',
  10497. 'onesuperior',
  10498. 'ordmasculine',
  10499. 'guillemotright',
  10500. 'onequarter',
  10501. 'onehalf',
  10502. 'threequarters',
  10503. 'questiondown',
  10504. 'Agrave',
  10505. 'Aacute',
  10506. 'Acircumflex',
  10507. 'Atilde',
  10508. 'Adieresis',
  10509. 'Aring',
  10510. 'AE',
  10511. 'Ccedilla',
  10512. 'Egrave',
  10513. 'Eacute',
  10514. 'Ecircumflex',
  10515. 'Edieresis',
  10516. 'Igrave',
  10517. 'Iacute',
  10518. 'Icircumflex',
  10519. 'Idieresis',
  10520. 'Eth',
  10521. 'Ntilde',
  10522. 'Ograve',
  10523. 'Oacute',
  10524. 'Ocircumflex',
  10525. 'Otilde',
  10526. 'Odieresis',
  10527. 'multiply',
  10528. 'Oslash',
  10529. 'Ugrave',
  10530. 'Uacute',
  10531. 'Ucircumflex',
  10532. 'Udieresis',
  10533. 'Yacute',
  10534. 'Thorn',
  10535. 'germandbls',
  10536. 'agrave',
  10537. 'aacute',
  10538. 'acircumflex',
  10539. 'atilde',
  10540. 'adieresis',
  10541. 'aring',
  10542. 'ae',
  10543. 'ccedilla',
  10544. 'egrave',
  10545. 'eacute',
  10546. 'ecircumflex',
  10547. 'edieresis',
  10548. 'igrave',
  10549. 'iacute',
  10550. 'icircumflex',
  10551. 'idieresis',
  10552. 'eth',
  10553. 'ntilde',
  10554. 'ograve',
  10555. 'oacute',
  10556. 'ocircumflex',
  10557. 'otilde',
  10558. 'odieresis',
  10559. 'divide',
  10560. 'oslash',
  10561. 'ugrave',
  10562. 'uacute',
  10563. 'ucircumflex',
  10564. 'udieresis',
  10565. 'yacute',
  10566. 'thorn',
  10567. 'ydieresis'
  10568. ];
  10569. var SymbolSetEncoding = [
  10570. '',
  10571. '',
  10572. '',
  10573. '',
  10574. '',
  10575. '',
  10576. '',
  10577. '',
  10578. '',
  10579. '',
  10580. '',
  10581. '',
  10582. '',
  10583. '',
  10584. '',
  10585. '',
  10586. '',
  10587. '',
  10588. '',
  10589. '',
  10590. '',
  10591. '',
  10592. '',
  10593. '',
  10594. '',
  10595. '',
  10596. '',
  10597. '',
  10598. '',
  10599. '',
  10600. '',
  10601. '',
  10602. 'space',
  10603. 'exclam',
  10604. 'universal',
  10605. 'numbersign',
  10606. 'existential',
  10607. 'percent',
  10608. 'ampersand',
  10609. 'suchthat',
  10610. 'parenleft',
  10611. 'parenright',
  10612. 'asteriskmath',
  10613. 'plus',
  10614. 'comma',
  10615. 'minus',
  10616. 'period',
  10617. 'slash',
  10618. 'zero',
  10619. 'one',
  10620. 'two',
  10621. 'three',
  10622. 'four',
  10623. 'five',
  10624. 'six',
  10625. 'seven',
  10626. 'eight',
  10627. 'nine',
  10628. 'colon',
  10629. 'semicolon',
  10630. 'less',
  10631. 'equal',
  10632. 'greater',
  10633. 'question',
  10634. 'congruent',
  10635. 'Alpha',
  10636. 'Beta',
  10637. 'Chi',
  10638. 'Delta',
  10639. 'Epsilon',
  10640. 'Phi',
  10641. 'Gamma',
  10642. 'Eta',
  10643. 'Iota',
  10644. 'theta1',
  10645. 'Kappa',
  10646. 'Lambda',
  10647. 'Mu',
  10648. 'Nu',
  10649. 'Omicron',
  10650. 'Pi',
  10651. 'Theta',
  10652. 'Rho',
  10653. 'Sigma',
  10654. 'Tau',
  10655. 'Upsilon',
  10656. 'sigma1',
  10657. 'Omega',
  10658. 'Xi',
  10659. 'Psi',
  10660. 'Zeta',
  10661. 'bracketleft',
  10662. 'therefore',
  10663. 'bracketright',
  10664. 'perpendicular',
  10665. 'underscore',
  10666. 'radicalex',
  10667. 'alpha',
  10668. 'beta',
  10669. 'chi',
  10670. 'delta',
  10671. 'epsilon',
  10672. 'phi',
  10673. 'gamma',
  10674. 'eta',
  10675. 'iota',
  10676. 'phi1',
  10677. 'kappa',
  10678. 'lambda',
  10679. 'mu',
  10680. 'nu',
  10681. 'omicron',
  10682. 'pi',
  10683. 'theta',
  10684. 'rho',
  10685. 'sigma',
  10686. 'tau',
  10687. 'upsilon',
  10688. 'omega1',
  10689. 'omega',
  10690. 'xi',
  10691. 'psi',
  10692. 'zeta',
  10693. 'braceleft',
  10694. 'bar',
  10695. 'braceright',
  10696. 'similar',
  10697. '',
  10698. '',
  10699. '',
  10700. '',
  10701. '',
  10702. '',
  10703. '',
  10704. '',
  10705. '',
  10706. '',
  10707. '',
  10708. '',
  10709. '',
  10710. '',
  10711. '',
  10712. '',
  10713. '',
  10714. '',
  10715. '',
  10716. '',
  10717. '',
  10718. '',
  10719. '',
  10720. '',
  10721. '',
  10722. '',
  10723. '',
  10724. '',
  10725. '',
  10726. '',
  10727. '',
  10728. '',
  10729. '',
  10730. 'Euro',
  10731. 'Upsilon1',
  10732. 'minute',
  10733. 'lessequal',
  10734. 'fraction',
  10735. 'infinity',
  10736. 'florin',
  10737. 'club',
  10738. 'diamond',
  10739. 'heart',
  10740. 'spade',
  10741. 'arrowboth',
  10742. 'arrowleft',
  10743. 'arrowup',
  10744. 'arrowright',
  10745. 'arrowdown',
  10746. 'degree',
  10747. 'plusminus',
  10748. 'second',
  10749. 'greaterequal',
  10750. 'multiply',
  10751. 'proportional',
  10752. 'partialdiff',
  10753. 'bullet',
  10754. 'divide',
  10755. 'notequal',
  10756. 'equivalence',
  10757. 'approxequal',
  10758. 'ellipsis',
  10759. 'arrowvertex',
  10760. 'arrowhorizex',
  10761. 'carriagereturn',
  10762. 'aleph',
  10763. 'Ifraktur',
  10764. 'Rfraktur',
  10765. 'weierstrass',
  10766. 'circlemultiply',
  10767. 'circleplus',
  10768. 'emptyset',
  10769. 'intersection',
  10770. 'union',
  10771. 'propersuperset',
  10772. 'reflexsuperset',
  10773. 'notsubset',
  10774. 'propersubset',
  10775. 'reflexsubset',
  10776. 'element',
  10777. 'notelement',
  10778. 'angle',
  10779. 'gradient',
  10780. 'registerserif',
  10781. 'copyrightserif',
  10782. 'trademarkserif',
  10783. 'product',
  10784. 'radical',
  10785. 'dotmath',
  10786. 'logicalnot',
  10787. 'logicaland',
  10788. 'logicalor',
  10789. 'arrowdblboth',
  10790. 'arrowdblleft',
  10791. 'arrowdblup',
  10792. 'arrowdblright',
  10793. 'arrowdbldown',
  10794. 'lozenge',
  10795. 'angleleft',
  10796. 'registersans',
  10797. 'copyrightsans',
  10798. 'trademarksans',
  10799. 'summation',
  10800. 'parenlefttp',
  10801. 'parenleftex',
  10802. 'parenleftbt',
  10803. 'bracketlefttp',
  10804. 'bracketleftex',
  10805. 'bracketleftbt',
  10806. 'bracelefttp',
  10807. 'braceleftmid',
  10808. 'braceleftbt',
  10809. 'braceex',
  10810. '',
  10811. 'angleright',
  10812. 'integral',
  10813. 'integraltp',
  10814. 'integralex',
  10815. 'integralbt',
  10816. 'parenrighttp',
  10817. 'parenrightex',
  10818. 'parenrightbt',
  10819. 'bracketrighttp',
  10820. 'bracketrightex',
  10821. 'bracketrightbt',
  10822. 'bracerighttp',
  10823. 'bracerightmid',
  10824. 'bracerightbt'
  10825. ];
  10826. var ZapfDingbatsEncoding = [
  10827. '',
  10828. '',
  10829. '',
  10830. '',
  10831. '',
  10832. '',
  10833. '',
  10834. '',
  10835. '',
  10836. '',
  10837. '',
  10838. '',
  10839. '',
  10840. '',
  10841. '',
  10842. '',
  10843. '',
  10844. '',
  10845. '',
  10846. '',
  10847. '',
  10848. '',
  10849. '',
  10850. '',
  10851. '',
  10852. '',
  10853. '',
  10854. '',
  10855. '',
  10856. '',
  10857. '',
  10858. '',
  10859. 'space',
  10860. 'a1',
  10861. 'a2',
  10862. 'a202',
  10863. 'a3',
  10864. 'a4',
  10865. 'a5',
  10866. 'a119',
  10867. 'a118',
  10868. 'a117',
  10869. 'a11',
  10870. 'a12',
  10871. 'a13',
  10872. 'a14',
  10873. 'a15',
  10874. 'a16',
  10875. 'a105',
  10876. 'a17',
  10877. 'a18',
  10878. 'a19',
  10879. 'a20',
  10880. 'a21',
  10881. 'a22',
  10882. 'a23',
  10883. 'a24',
  10884. 'a25',
  10885. 'a26',
  10886. 'a27',
  10887. 'a28',
  10888. 'a6',
  10889. 'a7',
  10890. 'a8',
  10891. 'a9',
  10892. 'a10',
  10893. 'a29',
  10894. 'a30',
  10895. 'a31',
  10896. 'a32',
  10897. 'a33',
  10898. 'a34',
  10899. 'a35',
  10900. 'a36',
  10901. 'a37',
  10902. 'a38',
  10903. 'a39',
  10904. 'a40',
  10905. 'a41',
  10906. 'a42',
  10907. 'a43',
  10908. 'a44',
  10909. 'a45',
  10910. 'a46',
  10911. 'a47',
  10912. 'a48',
  10913. 'a49',
  10914. 'a50',
  10915. 'a51',
  10916. 'a52',
  10917. 'a53',
  10918. 'a54',
  10919. 'a55',
  10920. 'a56',
  10921. 'a57',
  10922. 'a58',
  10923. 'a59',
  10924. 'a60',
  10925. 'a61',
  10926. 'a62',
  10927. 'a63',
  10928. 'a64',
  10929. 'a65',
  10930. 'a66',
  10931. 'a67',
  10932. 'a68',
  10933. 'a69',
  10934. 'a70',
  10935. 'a71',
  10936. 'a72',
  10937. 'a73',
  10938. 'a74',
  10939. 'a203',
  10940. 'a75',
  10941. 'a204',
  10942. 'a76',
  10943. 'a77',
  10944. 'a78',
  10945. 'a79',
  10946. 'a81',
  10947. 'a82',
  10948. 'a83',
  10949. 'a84',
  10950. 'a97',
  10951. 'a98',
  10952. 'a99',
  10953. 'a100',
  10954. '',
  10955. 'a89',
  10956. 'a90',
  10957. 'a93',
  10958. 'a94',
  10959. 'a91',
  10960. 'a92',
  10961. 'a205',
  10962. 'a85',
  10963. 'a206',
  10964. 'a86',
  10965. 'a87',
  10966. 'a88',
  10967. 'a95',
  10968. 'a96',
  10969. '',
  10970. '',
  10971. '',
  10972. '',
  10973. '',
  10974. '',
  10975. '',
  10976. '',
  10977. '',
  10978. '',
  10979. '',
  10980. '',
  10981. '',
  10982. '',
  10983. '',
  10984. '',
  10985. '',
  10986. '',
  10987. '',
  10988. 'a101',
  10989. 'a102',
  10990. 'a103',
  10991. 'a104',
  10992. 'a106',
  10993. 'a107',
  10994. 'a108',
  10995. 'a112',
  10996. 'a111',
  10997. 'a110',
  10998. 'a109',
  10999. 'a120',
  11000. 'a121',
  11001. 'a122',
  11002. 'a123',
  11003. 'a124',
  11004. 'a125',
  11005. 'a126',
  11006. 'a127',
  11007. 'a128',
  11008. 'a129',
  11009. 'a130',
  11010. 'a131',
  11011. 'a132',
  11012. 'a133',
  11013. 'a134',
  11014. 'a135',
  11015. 'a136',
  11016. 'a137',
  11017. 'a138',
  11018. 'a139',
  11019. 'a140',
  11020. 'a141',
  11021. 'a142',
  11022. 'a143',
  11023. 'a144',
  11024. 'a145',
  11025. 'a146',
  11026. 'a147',
  11027. 'a148',
  11028. 'a149',
  11029. 'a150',
  11030. 'a151',
  11031. 'a152',
  11032. 'a153',
  11033. 'a154',
  11034. 'a155',
  11035. 'a156',
  11036. 'a157',
  11037. 'a158',
  11038. 'a159',
  11039. 'a160',
  11040. 'a161',
  11041. 'a163',
  11042. 'a164',
  11043. 'a196',
  11044. 'a165',
  11045. 'a192',
  11046. 'a166',
  11047. 'a167',
  11048. 'a168',
  11049. 'a169',
  11050. 'a170',
  11051. 'a171',
  11052. 'a172',
  11053. 'a173',
  11054. 'a162',
  11055. 'a174',
  11056. 'a175',
  11057. 'a176',
  11058. 'a177',
  11059. 'a178',
  11060. 'a179',
  11061. 'a193',
  11062. 'a180',
  11063. 'a199',
  11064. 'a181',
  11065. 'a200',
  11066. 'a182',
  11067. '',
  11068. 'a201',
  11069. 'a183',
  11070. 'a184',
  11071. 'a197',
  11072. 'a185',
  11073. 'a194',
  11074. 'a198',
  11075. 'a186',
  11076. 'a195',
  11077. 'a187',
  11078. 'a188',
  11079. 'a189',
  11080. 'a190',
  11081. 'a191'
  11082. ];
  11083. function getEncoding(encodingName) {
  11084. switch (encodingName) {
  11085. case 'WinAnsiEncoding':
  11086. return WinAnsiEncoding;
  11087. case 'StandardEncoding':
  11088. return StandardEncoding;
  11089. case 'MacRomanEncoding':
  11090. return MacRomanEncoding;
  11091. case 'SymbolSetEncoding':
  11092. return SymbolSetEncoding;
  11093. case 'ZapfDingbatsEncoding':
  11094. return ZapfDingbatsEncoding;
  11095. case 'ExpertEncoding':
  11096. return ExpertEncoding;
  11097. case 'MacExpertEncoding':
  11098. return MacExpertEncoding;
  11099. default:
  11100. return null;
  11101. }
  11102. }
  11103. exports.WinAnsiEncoding = WinAnsiEncoding;
  11104. exports.StandardEncoding = StandardEncoding;
  11105. exports.MacRomanEncoding = MacRomanEncoding;
  11106. exports.SymbolSetEncoding = SymbolSetEncoding;
  11107. exports.ZapfDingbatsEncoding = ZapfDingbatsEncoding;
  11108. exports.ExpertEncoding = ExpertEncoding;
  11109. exports.getEncoding = getEncoding;
  11110. /***/ }),
  11111. /* 5 */
  11112. /***/ (function(module, exports, __w_pdfjs_require__) {
  11113. "use strict";
  11114. var sharedUtil = __w_pdfjs_require__(0);
  11115. var corePrimitives = __w_pdfjs_require__(1);
  11116. var coreStream = __w_pdfjs_require__(2);
  11117. var MissingDataException = sharedUtil.MissingDataException;
  11118. var StreamType = sharedUtil.StreamType;
  11119. var assert = sharedUtil.assert;
  11120. var error = sharedUtil.error;
  11121. var info = sharedUtil.info;
  11122. var isArray = sharedUtil.isArray;
  11123. var isInt = sharedUtil.isInt;
  11124. var isNum = sharedUtil.isNum;
  11125. var isString = sharedUtil.isString;
  11126. var warn = sharedUtil.warn;
  11127. var EOF = corePrimitives.EOF;
  11128. var Cmd = corePrimitives.Cmd;
  11129. var Dict = corePrimitives.Dict;
  11130. var Name = corePrimitives.Name;
  11131. var Ref = corePrimitives.Ref;
  11132. var isEOF = corePrimitives.isEOF;
  11133. var isCmd = corePrimitives.isCmd;
  11134. var isDict = corePrimitives.isDict;
  11135. var isName = corePrimitives.isName;
  11136. var Ascii85Stream = coreStream.Ascii85Stream;
  11137. var AsciiHexStream = coreStream.AsciiHexStream;
  11138. var CCITTFaxStream = coreStream.CCITTFaxStream;
  11139. var FlateStream = coreStream.FlateStream;
  11140. var Jbig2Stream = coreStream.Jbig2Stream;
  11141. var JpegStream = coreStream.JpegStream;
  11142. var JpxStream = coreStream.JpxStream;
  11143. var LZWStream = coreStream.LZWStream;
  11144. var NullStream = coreStream.NullStream;
  11145. var PredictorStream = coreStream.PredictorStream;
  11146. var RunLengthStream = coreStream.RunLengthStream;
  11147. var MAX_LENGTH_TO_CACHE = 1000;
  11148. var Parser = function ParserClosure() {
  11149. function Parser(lexer, allowStreams, xref, recoveryMode) {
  11150. this.lexer = lexer;
  11151. this.allowStreams = allowStreams;
  11152. this.xref = xref;
  11153. this.recoveryMode = recoveryMode || false;
  11154. this.imageCache = Object.create(null);
  11155. this.refill();
  11156. }
  11157. Parser.prototype = {
  11158. refill: function Parser_refill() {
  11159. this.buf1 = this.lexer.getObj();
  11160. this.buf2 = this.lexer.getObj();
  11161. },
  11162. shift: function Parser_shift() {
  11163. if (isCmd(this.buf2, 'ID')) {
  11164. this.buf1 = this.buf2;
  11165. this.buf2 = null;
  11166. } else {
  11167. this.buf1 = this.buf2;
  11168. this.buf2 = this.lexer.getObj();
  11169. }
  11170. },
  11171. tryShift: function Parser_tryShift() {
  11172. try {
  11173. this.shift();
  11174. return true;
  11175. } catch (e) {
  11176. if (e instanceof MissingDataException) {
  11177. throw e;
  11178. }
  11179. return false;
  11180. }
  11181. },
  11182. getObj: function Parser_getObj(cipherTransform) {
  11183. var buf1 = this.buf1;
  11184. this.shift();
  11185. if (buf1 instanceof Cmd) {
  11186. switch (buf1.cmd) {
  11187. case 'BI':
  11188. return this.makeInlineImage(cipherTransform);
  11189. case '[':
  11190. var array = [];
  11191. while (!isCmd(this.buf1, ']') && !isEOF(this.buf1)) {
  11192. array.push(this.getObj(cipherTransform));
  11193. }
  11194. if (isEOF(this.buf1)) {
  11195. if (!this.recoveryMode) {
  11196. error('End of file inside array');
  11197. }
  11198. return array;
  11199. }
  11200. this.shift();
  11201. return array;
  11202. case '<<':
  11203. var dict = new Dict(this.xref);
  11204. while (!isCmd(this.buf1, '>>') && !isEOF(this.buf1)) {
  11205. if (!isName(this.buf1)) {
  11206. info('Malformed dictionary: key must be a name object');
  11207. this.shift();
  11208. continue;
  11209. }
  11210. var key = this.buf1.name;
  11211. this.shift();
  11212. if (isEOF(this.buf1)) {
  11213. break;
  11214. }
  11215. dict.set(key, this.getObj(cipherTransform));
  11216. }
  11217. if (isEOF(this.buf1)) {
  11218. if (!this.recoveryMode) {
  11219. error('End of file inside dictionary');
  11220. }
  11221. return dict;
  11222. }
  11223. if (isCmd(this.buf2, 'stream')) {
  11224. return this.allowStreams ? this.makeStream(dict, cipherTransform) : dict;
  11225. }
  11226. this.shift();
  11227. return dict;
  11228. default:
  11229. return buf1;
  11230. }
  11231. }
  11232. if (isInt(buf1)) {
  11233. var num = buf1;
  11234. if (isInt(this.buf1) && isCmd(this.buf2, 'R')) {
  11235. var ref = new Ref(num, this.buf1);
  11236. this.shift();
  11237. this.shift();
  11238. return ref;
  11239. }
  11240. return num;
  11241. }
  11242. if (isString(buf1)) {
  11243. var str = buf1;
  11244. if (cipherTransform) {
  11245. str = cipherTransform.decryptString(str);
  11246. }
  11247. return str;
  11248. }
  11249. return buf1;
  11250. },
  11251. findDefaultInlineStreamEnd: function Parser_findDefaultInlineStreamEnd(stream) {
  11252. var E = 0x45, I = 0x49, SPACE = 0x20, LF = 0xA, CR = 0xD;
  11253. var startPos = stream.pos, state = 0, ch, i, n, followingBytes;
  11254. while ((ch = stream.getByte()) !== -1) {
  11255. if (state === 0) {
  11256. state = ch === E ? 1 : 0;
  11257. } else if (state === 1) {
  11258. state = ch === I ? 2 : 0;
  11259. } else {
  11260. assert(state === 2);
  11261. if (ch === SPACE || ch === LF || ch === CR) {
  11262. n = 5;
  11263. followingBytes = stream.peekBytes(n);
  11264. for (i = 0; i < n; i++) {
  11265. ch = followingBytes[i];
  11266. if (ch !== LF && ch !== CR && (ch < SPACE || ch > 0x7F)) {
  11267. state = 0;
  11268. break;
  11269. }
  11270. }
  11271. if (state === 2) {
  11272. break;
  11273. }
  11274. } else {
  11275. state = 0;
  11276. }
  11277. }
  11278. }
  11279. return stream.pos - 4 - startPos;
  11280. },
  11281. findDCTDecodeInlineStreamEnd: function Parser_findDCTDecodeInlineStreamEnd(stream) {
  11282. var startPos = stream.pos, foundEOI = false, b, markerLength, length;
  11283. while ((b = stream.getByte()) !== -1) {
  11284. if (b !== 0xFF) {
  11285. continue;
  11286. }
  11287. switch (stream.getByte()) {
  11288. case 0x00:
  11289. break;
  11290. case 0xFF:
  11291. stream.skip(-1);
  11292. break;
  11293. case 0xD9:
  11294. foundEOI = true;
  11295. break;
  11296. case 0xC0:
  11297. case 0xC1:
  11298. case 0xC2:
  11299. case 0xC3:
  11300. case 0xC5:
  11301. case 0xC6:
  11302. case 0xC7:
  11303. case 0xC9:
  11304. case 0xCA:
  11305. case 0xCB:
  11306. case 0xCD:
  11307. case 0xCE:
  11308. case 0xCF:
  11309. case 0xC4:
  11310. case 0xCC:
  11311. case 0xDA:
  11312. case 0xDB:
  11313. case 0xDC:
  11314. case 0xDD:
  11315. case 0xDE:
  11316. case 0xDF:
  11317. case 0xE0:
  11318. case 0xE1:
  11319. case 0xE2:
  11320. case 0xE3:
  11321. case 0xE4:
  11322. case 0xE5:
  11323. case 0xE6:
  11324. case 0xE7:
  11325. case 0xE8:
  11326. case 0xE9:
  11327. case 0xEA:
  11328. case 0xEB:
  11329. case 0xEC:
  11330. case 0xED:
  11331. case 0xEE:
  11332. case 0xEF:
  11333. case 0xFE:
  11334. markerLength = stream.getUint16();
  11335. if (markerLength > 2) {
  11336. stream.skip(markerLength - 2);
  11337. } else {
  11338. stream.skip(-2);
  11339. }
  11340. break;
  11341. }
  11342. if (foundEOI) {
  11343. break;
  11344. }
  11345. }
  11346. length = stream.pos - startPos;
  11347. if (b === -1) {
  11348. warn('Inline DCTDecode image stream: ' + 'EOI marker not found, searching for /EI/ instead.');
  11349. stream.skip(-length);
  11350. return this.findDefaultInlineStreamEnd(stream);
  11351. }
  11352. this.inlineStreamSkipEI(stream);
  11353. return length;
  11354. },
  11355. findASCII85DecodeInlineStreamEnd: function Parser_findASCII85DecodeInlineStreamEnd(stream) {
  11356. var TILDE = 0x7E, GT = 0x3E;
  11357. var startPos = stream.pos, ch, length;
  11358. while ((ch = stream.getByte()) !== -1) {
  11359. if (ch === TILDE && stream.peekByte() === GT) {
  11360. stream.skip();
  11361. break;
  11362. }
  11363. }
  11364. length = stream.pos - startPos;
  11365. if (ch === -1) {
  11366. warn('Inline ASCII85Decode image stream: ' + 'EOD marker not found, searching for /EI/ instead.');
  11367. stream.skip(-length);
  11368. return this.findDefaultInlineStreamEnd(stream);
  11369. }
  11370. this.inlineStreamSkipEI(stream);
  11371. return length;
  11372. },
  11373. findASCIIHexDecodeInlineStreamEnd: function Parser_findASCIIHexDecodeInlineStreamEnd(stream) {
  11374. var GT = 0x3E;
  11375. var startPos = stream.pos, ch, length;
  11376. while ((ch = stream.getByte()) !== -1) {
  11377. if (ch === GT) {
  11378. break;
  11379. }
  11380. }
  11381. length = stream.pos - startPos;
  11382. if (ch === -1) {
  11383. warn('Inline ASCIIHexDecode image stream: ' + 'EOD marker not found, searching for /EI/ instead.');
  11384. stream.skip(-length);
  11385. return this.findDefaultInlineStreamEnd(stream);
  11386. }
  11387. this.inlineStreamSkipEI(stream);
  11388. return length;
  11389. },
  11390. inlineStreamSkipEI: function Parser_inlineStreamSkipEI(stream) {
  11391. var E = 0x45, I = 0x49;
  11392. var state = 0, ch;
  11393. while ((ch = stream.getByte()) !== -1) {
  11394. if (state === 0) {
  11395. state = ch === E ? 1 : 0;
  11396. } else if (state === 1) {
  11397. state = ch === I ? 2 : 0;
  11398. } else if (state === 2) {
  11399. break;
  11400. }
  11401. }
  11402. },
  11403. makeInlineImage: function Parser_makeInlineImage(cipherTransform) {
  11404. var lexer = this.lexer;
  11405. var stream = lexer.stream;
  11406. var dict = new Dict(this.xref);
  11407. while (!isCmd(this.buf1, 'ID') && !isEOF(this.buf1)) {
  11408. if (!isName(this.buf1)) {
  11409. error('Dictionary key must be a name object');
  11410. }
  11411. var key = this.buf1.name;
  11412. this.shift();
  11413. if (isEOF(this.buf1)) {
  11414. break;
  11415. }
  11416. dict.set(key, this.getObj(cipherTransform));
  11417. }
  11418. var filter = dict.get('Filter', 'F'), filterName;
  11419. if (isName(filter)) {
  11420. filterName = filter.name;
  11421. } else if (isArray(filter)) {
  11422. var filterZero = this.xref.fetchIfRef(filter[0]);
  11423. if (isName(filterZero)) {
  11424. filterName = filterZero.name;
  11425. }
  11426. }
  11427. var startPos = stream.pos, length, i, ii;
  11428. if (filterName === 'DCTDecode' || filterName === 'DCT') {
  11429. length = this.findDCTDecodeInlineStreamEnd(stream);
  11430. } else if (filterName === 'ASCII85Decide' || filterName === 'A85') {
  11431. length = this.findASCII85DecodeInlineStreamEnd(stream);
  11432. } else if (filterName === 'ASCIIHexDecode' || filterName === 'AHx') {
  11433. length = this.findASCIIHexDecodeInlineStreamEnd(stream);
  11434. } else {
  11435. length = this.findDefaultInlineStreamEnd(stream);
  11436. }
  11437. var imageStream = stream.makeSubStream(startPos, length, dict);
  11438. var adler32;
  11439. if (length < MAX_LENGTH_TO_CACHE) {
  11440. var imageBytes = imageStream.getBytes();
  11441. imageStream.reset();
  11442. var a = 1;
  11443. var b = 0;
  11444. for (i = 0, ii = imageBytes.length; i < ii; ++i) {
  11445. a += imageBytes[i] & 0xff;
  11446. b += a;
  11447. }
  11448. adler32 = b % 65521 << 16 | a % 65521;
  11449. if (this.imageCache.adler32 === adler32) {
  11450. this.buf2 = Cmd.get('EI');
  11451. this.shift();
  11452. this.imageCache[adler32].reset();
  11453. return this.imageCache[adler32];
  11454. }
  11455. }
  11456. if (cipherTransform) {
  11457. imageStream = cipherTransform.createStream(imageStream, length);
  11458. }
  11459. imageStream = this.filter(imageStream, dict, length);
  11460. imageStream.dict = dict;
  11461. if (adler32 !== undefined) {
  11462. imageStream.cacheKey = 'inline_' + length + '_' + adler32;
  11463. this.imageCache[adler32] = imageStream;
  11464. }
  11465. this.buf2 = Cmd.get('EI');
  11466. this.shift();
  11467. return imageStream;
  11468. },
  11469. makeStream: function Parser_makeStream(dict, cipherTransform) {
  11470. var lexer = this.lexer;
  11471. var stream = lexer.stream;
  11472. lexer.skipToNextLine();
  11473. var pos = stream.pos - 1;
  11474. var length = dict.get('Length');
  11475. if (!isInt(length)) {
  11476. info('Bad ' + length + ' attribute in stream');
  11477. length = 0;
  11478. }
  11479. stream.pos = pos + length;
  11480. lexer.nextChar();
  11481. if (this.tryShift() && isCmd(this.buf2, 'endstream')) {
  11482. this.shift();
  11483. } else {
  11484. stream.pos = pos;
  11485. var SCAN_BLOCK_SIZE = 2048;
  11486. var ENDSTREAM_SIGNATURE_LENGTH = 9;
  11487. var ENDSTREAM_SIGNATURE = [
  11488. 0x65,
  11489. 0x6E,
  11490. 0x64,
  11491. 0x73,
  11492. 0x74,
  11493. 0x72,
  11494. 0x65,
  11495. 0x61,
  11496. 0x6D
  11497. ];
  11498. var skipped = 0, found = false, i, j;
  11499. while (stream.pos < stream.end) {
  11500. var scanBytes = stream.peekBytes(SCAN_BLOCK_SIZE);
  11501. var scanLength = scanBytes.length - ENDSTREAM_SIGNATURE_LENGTH;
  11502. if (scanLength <= 0) {
  11503. break;
  11504. }
  11505. found = false;
  11506. i = 0;
  11507. while (i < scanLength) {
  11508. j = 0;
  11509. while (j < ENDSTREAM_SIGNATURE_LENGTH && scanBytes[i + j] === ENDSTREAM_SIGNATURE[j]) {
  11510. j++;
  11511. }
  11512. if (j >= ENDSTREAM_SIGNATURE_LENGTH) {
  11513. found = true;
  11514. break;
  11515. }
  11516. i++;
  11517. }
  11518. if (found) {
  11519. skipped += i;
  11520. stream.pos += i;
  11521. break;
  11522. }
  11523. skipped += scanLength;
  11524. stream.pos += scanLength;
  11525. }
  11526. if (!found) {
  11527. error('Missing endstream');
  11528. }
  11529. length = skipped;
  11530. lexer.nextChar();
  11531. this.shift();
  11532. this.shift();
  11533. }
  11534. this.shift();
  11535. stream = stream.makeSubStream(pos, length, dict);
  11536. if (cipherTransform) {
  11537. stream = cipherTransform.createStream(stream, length);
  11538. }
  11539. stream = this.filter(stream, dict, length);
  11540. stream.dict = dict;
  11541. return stream;
  11542. },
  11543. filter: function Parser_filter(stream, dict, length) {
  11544. var filter = dict.get('Filter', 'F');
  11545. var params = dict.get('DecodeParms', 'DP');
  11546. if (isName(filter)) {
  11547. if (isArray(params)) {
  11548. params = this.xref.fetchIfRef(params[0]);
  11549. }
  11550. return this.makeFilter(stream, filter.name, length, params);
  11551. }
  11552. var maybeLength = length;
  11553. if (isArray(filter)) {
  11554. var filterArray = filter;
  11555. var paramsArray = params;
  11556. for (var i = 0, ii = filterArray.length; i < ii; ++i) {
  11557. filter = this.xref.fetchIfRef(filterArray[i]);
  11558. if (!isName(filter)) {
  11559. error('Bad filter name: ' + filter);
  11560. }
  11561. params = null;
  11562. if (isArray(paramsArray) && i in paramsArray) {
  11563. params = this.xref.fetchIfRef(paramsArray[i]);
  11564. }
  11565. stream = this.makeFilter(stream, filter.name, maybeLength, params);
  11566. maybeLength = null;
  11567. }
  11568. }
  11569. return stream;
  11570. },
  11571. makeFilter: function Parser_makeFilter(stream, name, maybeLength, params) {
  11572. if (maybeLength === 0) {
  11573. warn('Empty "' + name + '" stream.');
  11574. return new NullStream(stream);
  11575. }
  11576. try {
  11577. var xrefStreamStats = this.xref.stats.streamTypes;
  11578. if (name === 'FlateDecode' || name === 'Fl') {
  11579. xrefStreamStats[StreamType.FLATE] = true;
  11580. if (params) {
  11581. return new PredictorStream(new FlateStream(stream, maybeLength), maybeLength, params);
  11582. }
  11583. return new FlateStream(stream, maybeLength);
  11584. }
  11585. if (name === 'LZWDecode' || name === 'LZW') {
  11586. xrefStreamStats[StreamType.LZW] = true;
  11587. var earlyChange = 1;
  11588. if (params) {
  11589. if (params.has('EarlyChange')) {
  11590. earlyChange = params.get('EarlyChange');
  11591. }
  11592. return new PredictorStream(new LZWStream(stream, maybeLength, earlyChange), maybeLength, params);
  11593. }
  11594. return new LZWStream(stream, maybeLength, earlyChange);
  11595. }
  11596. if (name === 'DCTDecode' || name === 'DCT') {
  11597. xrefStreamStats[StreamType.DCT] = true;
  11598. return new JpegStream(stream, maybeLength, stream.dict, params);
  11599. }
  11600. if (name === 'JPXDecode' || name === 'JPX') {
  11601. xrefStreamStats[StreamType.JPX] = true;
  11602. return new JpxStream(stream, maybeLength, stream.dict, params);
  11603. }
  11604. if (name === 'ASCII85Decode' || name === 'A85') {
  11605. xrefStreamStats[StreamType.A85] = true;
  11606. return new Ascii85Stream(stream, maybeLength);
  11607. }
  11608. if (name === 'ASCIIHexDecode' || name === 'AHx') {
  11609. xrefStreamStats[StreamType.AHX] = true;
  11610. return new AsciiHexStream(stream, maybeLength);
  11611. }
  11612. if (name === 'CCITTFaxDecode' || name === 'CCF') {
  11613. xrefStreamStats[StreamType.CCF] = true;
  11614. return new CCITTFaxStream(stream, maybeLength, params);
  11615. }
  11616. if (name === 'RunLengthDecode' || name === 'RL') {
  11617. xrefStreamStats[StreamType.RL] = true;
  11618. return new RunLengthStream(stream, maybeLength);
  11619. }
  11620. if (name === 'JBIG2Decode') {
  11621. xrefStreamStats[StreamType.JBIG] = true;
  11622. return new Jbig2Stream(stream, maybeLength, stream.dict, params);
  11623. }
  11624. warn('filter "' + name + '" not supported yet');
  11625. return stream;
  11626. } catch (ex) {
  11627. if (ex instanceof MissingDataException) {
  11628. throw ex;
  11629. }
  11630. warn('Invalid stream: \"' + ex + '\"');
  11631. return new NullStream(stream);
  11632. }
  11633. }
  11634. };
  11635. return Parser;
  11636. }();
  11637. var Lexer = function LexerClosure() {
  11638. function Lexer(stream, knownCommands) {
  11639. this.stream = stream;
  11640. this.nextChar();
  11641. this.strBuf = [];
  11642. this.knownCommands = knownCommands;
  11643. }
  11644. var specialChars = [
  11645. 1,
  11646. 0,
  11647. 0,
  11648. 0,
  11649. 0,
  11650. 0,
  11651. 0,
  11652. 0,
  11653. 0,
  11654. 1,
  11655. 1,
  11656. 0,
  11657. 1,
  11658. 1,
  11659. 0,
  11660. 0,
  11661. 0,
  11662. 0,
  11663. 0,
  11664. 0,
  11665. 0,
  11666. 0,
  11667. 0,
  11668. 0,
  11669. 0,
  11670. 0,
  11671. 0,
  11672. 0,
  11673. 0,
  11674. 0,
  11675. 0,
  11676. 0,
  11677. 1,
  11678. 0,
  11679. 0,
  11680. 0,
  11681. 0,
  11682. 2,
  11683. 0,
  11684. 0,
  11685. 2,
  11686. 2,
  11687. 0,
  11688. 0,
  11689. 0,
  11690. 0,
  11691. 0,
  11692. 2,
  11693. 0,
  11694. 0,
  11695. 0,
  11696. 0,
  11697. 0,
  11698. 0,
  11699. 0,
  11700. 0,
  11701. 0,
  11702. 0,
  11703. 0,
  11704. 0,
  11705. 2,
  11706. 0,
  11707. 2,
  11708. 0,
  11709. 0,
  11710. 0,
  11711. 0,
  11712. 0,
  11713. 0,
  11714. 0,
  11715. 0,
  11716. 0,
  11717. 0,
  11718. 0,
  11719. 0,
  11720. 0,
  11721. 0,
  11722. 0,
  11723. 0,
  11724. 0,
  11725. 0,
  11726. 0,
  11727. 0,
  11728. 0,
  11729. 0,
  11730. 0,
  11731. 0,
  11732. 0,
  11733. 0,
  11734. 0,
  11735. 0,
  11736. 2,
  11737. 0,
  11738. 2,
  11739. 0,
  11740. 0,
  11741. 0,
  11742. 0,
  11743. 0,
  11744. 0,
  11745. 0,
  11746. 0,
  11747. 0,
  11748. 0,
  11749. 0,
  11750. 0,
  11751. 0,
  11752. 0,
  11753. 0,
  11754. 0,
  11755. 0,
  11756. 0,
  11757. 0,
  11758. 0,
  11759. 0,
  11760. 0,
  11761. 0,
  11762. 0,
  11763. 0,
  11764. 0,
  11765. 0,
  11766. 0,
  11767. 0,
  11768. 2,
  11769. 0,
  11770. 2,
  11771. 0,
  11772. 0,
  11773. 0,
  11774. 0,
  11775. 0,
  11776. 0,
  11777. 0,
  11778. 0,
  11779. 0,
  11780. 0,
  11781. 0,
  11782. 0,
  11783. 0,
  11784. 0,
  11785. 0,
  11786. 0,
  11787. 0,
  11788. 0,
  11789. 0,
  11790. 0,
  11791. 0,
  11792. 0,
  11793. 0,
  11794. 0,
  11795. 0,
  11796. 0,
  11797. 0,
  11798. 0,
  11799. 0,
  11800. 0,
  11801. 0,
  11802. 0,
  11803. 0,
  11804. 0,
  11805. 0,
  11806. 0,
  11807. 0,
  11808. 0,
  11809. 0,
  11810. 0,
  11811. 0,
  11812. 0,
  11813. 0,
  11814. 0,
  11815. 0,
  11816. 0,
  11817. 0,
  11818. 0,
  11819. 0,
  11820. 0,
  11821. 0,
  11822. 0,
  11823. 0,
  11824. 0,
  11825. 0,
  11826. 0,
  11827. 0,
  11828. 0,
  11829. 0,
  11830. 0,
  11831. 0,
  11832. 0,
  11833. 0,
  11834. 0,
  11835. 0,
  11836. 0,
  11837. 0,
  11838. 0,
  11839. 0,
  11840. 0,
  11841. 0,
  11842. 0,
  11843. 0,
  11844. 0,
  11845. 0,
  11846. 0,
  11847. 0,
  11848. 0,
  11849. 0,
  11850. 0,
  11851. 0,
  11852. 0,
  11853. 0,
  11854. 0,
  11855. 0,
  11856. 0,
  11857. 0,
  11858. 0,
  11859. 0,
  11860. 0,
  11861. 0,
  11862. 0,
  11863. 0,
  11864. 0,
  11865. 0,
  11866. 0,
  11867. 0,
  11868. 0,
  11869. 0,
  11870. 0,
  11871. 0,
  11872. 0,
  11873. 0,
  11874. 0,
  11875. 0,
  11876. 0,
  11877. 0,
  11878. 0,
  11879. 0,
  11880. 0,
  11881. 0,
  11882. 0,
  11883. 0,
  11884. 0,
  11885. 0,
  11886. 0,
  11887. 0,
  11888. 0,
  11889. 0,
  11890. 0,
  11891. 0,
  11892. 0,
  11893. 0,
  11894. 0,
  11895. 0,
  11896. 0,
  11897. 0,
  11898. 0,
  11899. 0,
  11900. 0
  11901. ];
  11902. function toHexDigit(ch) {
  11903. if (ch >= 0x30 && ch <= 0x39) {
  11904. return ch & 0x0F;
  11905. }
  11906. if (ch >= 0x41 && ch <= 0x46 || ch >= 0x61 && ch <= 0x66) {
  11907. return (ch & 0x0F) + 9;
  11908. }
  11909. return -1;
  11910. }
  11911. Lexer.prototype = {
  11912. nextChar: function Lexer_nextChar() {
  11913. return this.currentChar = this.stream.getByte();
  11914. },
  11915. peekChar: function Lexer_peekChar() {
  11916. return this.stream.peekByte();
  11917. },
  11918. getNumber: function Lexer_getNumber() {
  11919. var ch = this.currentChar;
  11920. var eNotation = false;
  11921. var divideBy = 0;
  11922. var sign = 1;
  11923. if (ch === 0x2D) {
  11924. sign = -1;
  11925. ch = this.nextChar();
  11926. if (ch === 0x2D) {
  11927. ch = this.nextChar();
  11928. }
  11929. } else if (ch === 0x2B) {
  11930. ch = this.nextChar();
  11931. }
  11932. if (ch === 0x2E) {
  11933. divideBy = 10;
  11934. ch = this.nextChar();
  11935. }
  11936. if (ch < 0x30 || ch > 0x39) {
  11937. error('Invalid number: ' + String.fromCharCode(ch));
  11938. return 0;
  11939. }
  11940. var baseValue = ch - 0x30;
  11941. var powerValue = 0;
  11942. var powerValueSign = 1;
  11943. while ((ch = this.nextChar()) >= 0) {
  11944. if (0x30 <= ch && ch <= 0x39) {
  11945. var currentDigit = ch - 0x30;
  11946. if (eNotation) {
  11947. powerValue = powerValue * 10 + currentDigit;
  11948. } else {
  11949. if (divideBy !== 0) {
  11950. divideBy *= 10;
  11951. }
  11952. baseValue = baseValue * 10 + currentDigit;
  11953. }
  11954. } else if (ch === 0x2E) {
  11955. if (divideBy === 0) {
  11956. divideBy = 1;
  11957. } else {
  11958. break;
  11959. }
  11960. } else if (ch === 0x2D) {
  11961. warn('Badly formatted number');
  11962. } else if (ch === 0x45 || ch === 0x65) {
  11963. ch = this.peekChar();
  11964. if (ch === 0x2B || ch === 0x2D) {
  11965. powerValueSign = ch === 0x2D ? -1 : 1;
  11966. this.nextChar();
  11967. } else if (ch < 0x30 || ch > 0x39) {
  11968. break;
  11969. }
  11970. eNotation = true;
  11971. } else {
  11972. break;
  11973. }
  11974. }
  11975. if (divideBy !== 0) {
  11976. baseValue /= divideBy;
  11977. }
  11978. if (eNotation) {
  11979. baseValue *= Math.pow(10, powerValueSign * powerValue);
  11980. }
  11981. return sign * baseValue;
  11982. },
  11983. getString: function Lexer_getString() {
  11984. var numParen = 1;
  11985. var done = false;
  11986. var strBuf = this.strBuf;
  11987. strBuf.length = 0;
  11988. var ch = this.nextChar();
  11989. while (true) {
  11990. var charBuffered = false;
  11991. switch (ch | 0) {
  11992. case -1:
  11993. warn('Unterminated string');
  11994. done = true;
  11995. break;
  11996. case 0x28:
  11997. ++numParen;
  11998. strBuf.push('(');
  11999. break;
  12000. case 0x29:
  12001. if (--numParen === 0) {
  12002. this.nextChar();
  12003. done = true;
  12004. } else {
  12005. strBuf.push(')');
  12006. }
  12007. break;
  12008. case 0x5C:
  12009. ch = this.nextChar();
  12010. switch (ch) {
  12011. case -1:
  12012. warn('Unterminated string');
  12013. done = true;
  12014. break;
  12015. case 0x6E:
  12016. strBuf.push('\n');
  12017. break;
  12018. case 0x72:
  12019. strBuf.push('\r');
  12020. break;
  12021. case 0x74:
  12022. strBuf.push('\t');
  12023. break;
  12024. case 0x62:
  12025. strBuf.push('\b');
  12026. break;
  12027. case 0x66:
  12028. strBuf.push('\f');
  12029. break;
  12030. case 0x5C:
  12031. case 0x28:
  12032. case 0x29:
  12033. strBuf.push(String.fromCharCode(ch));
  12034. break;
  12035. case 0x30:
  12036. case 0x31:
  12037. case 0x32:
  12038. case 0x33:
  12039. case 0x34:
  12040. case 0x35:
  12041. case 0x36:
  12042. case 0x37:
  12043. var x = ch & 0x0F;
  12044. ch = this.nextChar();
  12045. charBuffered = true;
  12046. if (ch >= 0x30 && ch <= 0x37) {
  12047. x = (x << 3) + (ch & 0x0F);
  12048. ch = this.nextChar();
  12049. if (ch >= 0x30 && ch <= 0x37) {
  12050. charBuffered = false;
  12051. x = (x << 3) + (ch & 0x0F);
  12052. }
  12053. }
  12054. strBuf.push(String.fromCharCode(x));
  12055. break;
  12056. case 0x0D:
  12057. if (this.peekChar() === 0x0A) {
  12058. this.nextChar();
  12059. }
  12060. break;
  12061. case 0x0A:
  12062. break;
  12063. default:
  12064. strBuf.push(String.fromCharCode(ch));
  12065. break;
  12066. }
  12067. break;
  12068. default:
  12069. strBuf.push(String.fromCharCode(ch));
  12070. break;
  12071. }
  12072. if (done) {
  12073. break;
  12074. }
  12075. if (!charBuffered) {
  12076. ch = this.nextChar();
  12077. }
  12078. }
  12079. return strBuf.join('');
  12080. },
  12081. getName: function Lexer_getName() {
  12082. var ch, previousCh;
  12083. var strBuf = this.strBuf;
  12084. strBuf.length = 0;
  12085. while ((ch = this.nextChar()) >= 0 && !specialChars[ch]) {
  12086. if (ch === 0x23) {
  12087. ch = this.nextChar();
  12088. if (specialChars[ch]) {
  12089. warn('Lexer_getName: ' + 'NUMBER SIGN (#) should be followed by a hexadecimal number.');
  12090. strBuf.push('#');
  12091. break;
  12092. }
  12093. var x = toHexDigit(ch);
  12094. if (x !== -1) {
  12095. previousCh = ch;
  12096. ch = this.nextChar();
  12097. var x2 = toHexDigit(ch);
  12098. if (x2 === -1) {
  12099. warn('Lexer_getName: Illegal digit (' + String.fromCharCode(ch) + ') in hexadecimal number.');
  12100. strBuf.push('#', String.fromCharCode(previousCh));
  12101. if (specialChars[ch]) {
  12102. break;
  12103. }
  12104. strBuf.push(String.fromCharCode(ch));
  12105. continue;
  12106. }
  12107. strBuf.push(String.fromCharCode(x << 4 | x2));
  12108. } else {
  12109. strBuf.push('#', String.fromCharCode(ch));
  12110. }
  12111. } else {
  12112. strBuf.push(String.fromCharCode(ch));
  12113. }
  12114. }
  12115. if (strBuf.length > 127) {
  12116. warn('name token is longer than allowed by the spec: ' + strBuf.length);
  12117. }
  12118. return Name.get(strBuf.join(''));
  12119. },
  12120. getHexString: function Lexer_getHexString() {
  12121. var strBuf = this.strBuf;
  12122. strBuf.length = 0;
  12123. var ch = this.currentChar;
  12124. var isFirstHex = true;
  12125. var firstDigit;
  12126. var secondDigit;
  12127. while (true) {
  12128. if (ch < 0) {
  12129. warn('Unterminated hex string');
  12130. break;
  12131. } else if (ch === 0x3E) {
  12132. this.nextChar();
  12133. break;
  12134. } else if (specialChars[ch] === 1) {
  12135. ch = this.nextChar();
  12136. continue;
  12137. } else {
  12138. if (isFirstHex) {
  12139. firstDigit = toHexDigit(ch);
  12140. if (firstDigit === -1) {
  12141. warn('Ignoring invalid character "' + ch + '" in hex string');
  12142. ch = this.nextChar();
  12143. continue;
  12144. }
  12145. } else {
  12146. secondDigit = toHexDigit(ch);
  12147. if (secondDigit === -1) {
  12148. warn('Ignoring invalid character "' + ch + '" in hex string');
  12149. ch = this.nextChar();
  12150. continue;
  12151. }
  12152. strBuf.push(String.fromCharCode(firstDigit << 4 | secondDigit));
  12153. }
  12154. isFirstHex = !isFirstHex;
  12155. ch = this.nextChar();
  12156. }
  12157. }
  12158. return strBuf.join('');
  12159. },
  12160. getObj: function Lexer_getObj() {
  12161. var comment = false;
  12162. var ch = this.currentChar;
  12163. while (true) {
  12164. if (ch < 0) {
  12165. return EOF;
  12166. }
  12167. if (comment) {
  12168. if (ch === 0x0A || ch === 0x0D) {
  12169. comment = false;
  12170. }
  12171. } else if (ch === 0x25) {
  12172. comment = true;
  12173. } else if (specialChars[ch] !== 1) {
  12174. break;
  12175. }
  12176. ch = this.nextChar();
  12177. }
  12178. switch (ch | 0) {
  12179. case 0x30:
  12180. case 0x31:
  12181. case 0x32:
  12182. case 0x33:
  12183. case 0x34:
  12184. case 0x35:
  12185. case 0x36:
  12186. case 0x37:
  12187. case 0x38:
  12188. case 0x39:
  12189. case 0x2B:
  12190. case 0x2D:
  12191. case 0x2E:
  12192. return this.getNumber();
  12193. case 0x28:
  12194. return this.getString();
  12195. case 0x2F:
  12196. return this.getName();
  12197. case 0x5B:
  12198. this.nextChar();
  12199. return Cmd.get('[');
  12200. case 0x5D:
  12201. this.nextChar();
  12202. return Cmd.get(']');
  12203. case 0x3C:
  12204. ch = this.nextChar();
  12205. if (ch === 0x3C) {
  12206. this.nextChar();
  12207. return Cmd.get('<<');
  12208. }
  12209. return this.getHexString();
  12210. case 0x3E:
  12211. ch = this.nextChar();
  12212. if (ch === 0x3E) {
  12213. this.nextChar();
  12214. return Cmd.get('>>');
  12215. }
  12216. return Cmd.get('>');
  12217. case 0x7B:
  12218. this.nextChar();
  12219. return Cmd.get('{');
  12220. case 0x7D:
  12221. this.nextChar();
  12222. return Cmd.get('}');
  12223. case 0x29:
  12224. this.nextChar();
  12225. error('Illegal character: ' + ch);
  12226. break;
  12227. }
  12228. var str = String.fromCharCode(ch);
  12229. var knownCommands = this.knownCommands;
  12230. var knownCommandFound = knownCommands && knownCommands[str] !== undefined;
  12231. while ((ch = this.nextChar()) >= 0 && !specialChars[ch]) {
  12232. var possibleCommand = str + String.fromCharCode(ch);
  12233. if (knownCommandFound && knownCommands[possibleCommand] === undefined) {
  12234. break;
  12235. }
  12236. if (str.length === 128) {
  12237. error('Command token too long: ' + str.length);
  12238. }
  12239. str = possibleCommand;
  12240. knownCommandFound = knownCommands && knownCommands[str] !== undefined;
  12241. }
  12242. if (str === 'true') {
  12243. return true;
  12244. }
  12245. if (str === 'false') {
  12246. return false;
  12247. }
  12248. if (str === 'null') {
  12249. return null;
  12250. }
  12251. return Cmd.get(str);
  12252. },
  12253. skipToNextLine: function Lexer_skipToNextLine() {
  12254. var ch = this.currentChar;
  12255. while (ch >= 0) {
  12256. if (ch === 0x0D) {
  12257. ch = this.nextChar();
  12258. if (ch === 0x0A) {
  12259. this.nextChar();
  12260. }
  12261. break;
  12262. } else if (ch === 0x0A) {
  12263. this.nextChar();
  12264. break;
  12265. }
  12266. ch = this.nextChar();
  12267. }
  12268. }
  12269. };
  12270. return Lexer;
  12271. }();
  12272. var Linearization = {
  12273. create: function LinearizationCreate(stream) {
  12274. function getInt(name, allowZeroValue) {
  12275. var obj = linDict.get(name);
  12276. if (isInt(obj) && (allowZeroValue ? obj >= 0 : obj > 0)) {
  12277. return obj;
  12278. }
  12279. throw new Error('The "' + name + '" parameter in the linearization ' + 'dictionary is invalid.');
  12280. }
  12281. function getHints() {
  12282. var hints = linDict.get('H'), hintsLength, item;
  12283. if (isArray(hints) && ((hintsLength = hints.length) === 2 || hintsLength === 4)) {
  12284. for (var index = 0; index < hintsLength; index++) {
  12285. if (!(isInt(item = hints[index]) && item > 0)) {
  12286. throw new Error('Hint (' + index + ') in the linearization dictionary is invalid.');
  12287. }
  12288. }
  12289. return hints;
  12290. }
  12291. throw new Error('Hint array in the linearization dictionary is invalid.');
  12292. }
  12293. var parser = new Parser(new Lexer(stream), false, null);
  12294. var obj1 = parser.getObj();
  12295. var obj2 = parser.getObj();
  12296. var obj3 = parser.getObj();
  12297. var linDict = parser.getObj();
  12298. var obj, length;
  12299. if (!(isInt(obj1) && isInt(obj2) && isCmd(obj3, 'obj') && isDict(linDict) && isNum(obj = linDict.get('Linearized')) && obj > 0)) {
  12300. return null;
  12301. } else if ((length = getInt('L')) !== stream.length) {
  12302. throw new Error('The "L" parameter in the linearization dictionary ' + 'does not equal the stream length.');
  12303. }
  12304. return {
  12305. length: length,
  12306. hints: getHints(),
  12307. objectNumberFirst: getInt('O'),
  12308. endFirst: getInt('E'),
  12309. numPages: getInt('N'),
  12310. mainXRefEntriesOffset: getInt('T'),
  12311. pageFirst: linDict.has('P') ? getInt('P', true) : 0
  12312. };
  12313. }
  12314. };
  12315. exports.Lexer = Lexer;
  12316. exports.Linearization = Linearization;
  12317. exports.Parser = Parser;
  12318. /***/ }),
  12319. /* 6 */
  12320. /***/ (function(module, exports, __w_pdfjs_require__) {
  12321. "use strict";
  12322. var sharedUtil = __w_pdfjs_require__(0);
  12323. var corePrimitives = __w_pdfjs_require__(1);
  12324. var corePsParser = __w_pdfjs_require__(34);
  12325. var error = sharedUtil.error;
  12326. var info = sharedUtil.info;
  12327. var isArray = sharedUtil.isArray;
  12328. var isBool = sharedUtil.isBool;
  12329. var isDict = corePrimitives.isDict;
  12330. var isStream = corePrimitives.isStream;
  12331. var PostScriptLexer = corePsParser.PostScriptLexer;
  12332. var PostScriptParser = corePsParser.PostScriptParser;
  12333. var PDFFunction = function PDFFunctionClosure() {
  12334. var CONSTRUCT_SAMPLED = 0;
  12335. var CONSTRUCT_INTERPOLATED = 2;
  12336. var CONSTRUCT_STICHED = 3;
  12337. var CONSTRUCT_POSTSCRIPT = 4;
  12338. return {
  12339. getSampleArray: function PDFFunction_getSampleArray(size, outputSize, bps, str) {
  12340. var i, ii;
  12341. var length = 1;
  12342. for (i = 0, ii = size.length; i < ii; i++) {
  12343. length *= size[i];
  12344. }
  12345. length *= outputSize;
  12346. var array = new Array(length);
  12347. var codeSize = 0;
  12348. var codeBuf = 0;
  12349. var sampleMul = 1.0 / (Math.pow(2.0, bps) - 1);
  12350. var strBytes = str.getBytes((length * bps + 7) / 8);
  12351. var strIdx = 0;
  12352. for (i = 0; i < length; i++) {
  12353. while (codeSize < bps) {
  12354. codeBuf <<= 8;
  12355. codeBuf |= strBytes[strIdx++];
  12356. codeSize += 8;
  12357. }
  12358. codeSize -= bps;
  12359. array[i] = (codeBuf >> codeSize) * sampleMul;
  12360. codeBuf &= (1 << codeSize) - 1;
  12361. }
  12362. return array;
  12363. },
  12364. getIR: function PDFFunction_getIR(xref, fn) {
  12365. var dict = fn.dict;
  12366. if (!dict) {
  12367. dict = fn;
  12368. }
  12369. var types = [
  12370. this.constructSampled,
  12371. null,
  12372. this.constructInterpolated,
  12373. this.constructStiched,
  12374. this.constructPostScript
  12375. ];
  12376. var typeNum = dict.get('FunctionType');
  12377. var typeFn = types[typeNum];
  12378. if (!typeFn) {
  12379. error('Unknown type of function');
  12380. }
  12381. return typeFn.call(this, fn, dict, xref);
  12382. },
  12383. fromIR: function PDFFunction_fromIR(IR) {
  12384. var type = IR[0];
  12385. switch (type) {
  12386. case CONSTRUCT_SAMPLED:
  12387. return this.constructSampledFromIR(IR);
  12388. case CONSTRUCT_INTERPOLATED:
  12389. return this.constructInterpolatedFromIR(IR);
  12390. case CONSTRUCT_STICHED:
  12391. return this.constructStichedFromIR(IR);
  12392. default:
  12393. return this.constructPostScriptFromIR(IR);
  12394. }
  12395. },
  12396. parse: function PDFFunction_parse(xref, fn) {
  12397. var IR = this.getIR(xref, fn);
  12398. return this.fromIR(IR);
  12399. },
  12400. parseArray: function PDFFunction_parseArray(xref, fnObj) {
  12401. if (!isArray(fnObj)) {
  12402. return this.parse(xref, fnObj);
  12403. }
  12404. var fnArray = [];
  12405. for (var j = 0, jj = fnObj.length; j < jj; j++) {
  12406. var obj = xref.fetchIfRef(fnObj[j]);
  12407. fnArray.push(PDFFunction.parse(xref, obj));
  12408. }
  12409. return function (src, srcOffset, dest, destOffset) {
  12410. for (var i = 0, ii = fnArray.length; i < ii; i++) {
  12411. fnArray[i](src, srcOffset, dest, destOffset + i);
  12412. }
  12413. };
  12414. },
  12415. constructSampled: function PDFFunction_constructSampled(str, dict) {
  12416. function toMultiArray(arr) {
  12417. var inputLength = arr.length;
  12418. var out = [];
  12419. var index = 0;
  12420. for (var i = 0; i < inputLength; i += 2) {
  12421. out[index] = [
  12422. arr[i],
  12423. arr[i + 1]
  12424. ];
  12425. ++index;
  12426. }
  12427. return out;
  12428. }
  12429. var domain = dict.getArray('Domain');
  12430. var range = dict.getArray('Range');
  12431. if (!domain || !range) {
  12432. error('No domain or range');
  12433. }
  12434. var inputSize = domain.length / 2;
  12435. var outputSize = range.length / 2;
  12436. domain = toMultiArray(domain);
  12437. range = toMultiArray(range);
  12438. var size = dict.get('Size');
  12439. var bps = dict.get('BitsPerSample');
  12440. var order = dict.get('Order') || 1;
  12441. if (order !== 1) {
  12442. info('No support for cubic spline interpolation: ' + order);
  12443. }
  12444. var encode = dict.getArray('Encode');
  12445. if (!encode) {
  12446. encode = [];
  12447. for (var i = 0; i < inputSize; ++i) {
  12448. encode.push(0);
  12449. encode.push(size[i] - 1);
  12450. }
  12451. }
  12452. encode = toMultiArray(encode);
  12453. var decode = dict.getArray('Decode');
  12454. if (!decode) {
  12455. decode = range;
  12456. } else {
  12457. decode = toMultiArray(decode);
  12458. }
  12459. var samples = this.getSampleArray(size, outputSize, bps, str);
  12460. return [
  12461. CONSTRUCT_SAMPLED,
  12462. inputSize,
  12463. domain,
  12464. encode,
  12465. decode,
  12466. samples,
  12467. size,
  12468. outputSize,
  12469. Math.pow(2, bps) - 1,
  12470. range
  12471. ];
  12472. },
  12473. constructSampledFromIR: function PDFFunction_constructSampledFromIR(IR) {
  12474. function interpolate(x, xmin, xmax, ymin, ymax) {
  12475. return ymin + (x - xmin) * ((ymax - ymin) / (xmax - xmin));
  12476. }
  12477. return function constructSampledFromIRResult(src, srcOffset, dest, destOffset) {
  12478. var m = IR[1];
  12479. var domain = IR[2];
  12480. var encode = IR[3];
  12481. var decode = IR[4];
  12482. var samples = IR[5];
  12483. var size = IR[6];
  12484. var n = IR[7];
  12485. var range = IR[9];
  12486. var cubeVertices = 1 << m;
  12487. var cubeN = new Float64Array(cubeVertices);
  12488. var cubeVertex = new Uint32Array(cubeVertices);
  12489. var i, j;
  12490. for (j = 0; j < cubeVertices; j++) {
  12491. cubeN[j] = 1;
  12492. }
  12493. var k = n, pos = 1;
  12494. for (i = 0; i < m; ++i) {
  12495. var domain_2i = domain[i][0];
  12496. var domain_2i_1 = domain[i][1];
  12497. var xi = Math.min(Math.max(src[srcOffset + i], domain_2i), domain_2i_1);
  12498. var e = interpolate(xi, domain_2i, domain_2i_1, encode[i][0], encode[i][1]);
  12499. var size_i = size[i];
  12500. e = Math.min(Math.max(e, 0), size_i - 1);
  12501. var e0 = e < size_i - 1 ? Math.floor(e) : e - 1;
  12502. var n0 = e0 + 1 - e;
  12503. var n1 = e - e0;
  12504. var offset0 = e0 * k;
  12505. var offset1 = offset0 + k;
  12506. for (j = 0; j < cubeVertices; j++) {
  12507. if (j & pos) {
  12508. cubeN[j] *= n1;
  12509. cubeVertex[j] += offset1;
  12510. } else {
  12511. cubeN[j] *= n0;
  12512. cubeVertex[j] += offset0;
  12513. }
  12514. }
  12515. k *= size_i;
  12516. pos <<= 1;
  12517. }
  12518. for (j = 0; j < n; ++j) {
  12519. var rj = 0;
  12520. for (i = 0; i < cubeVertices; i++) {
  12521. rj += samples[cubeVertex[i] + j] * cubeN[i];
  12522. }
  12523. rj = interpolate(rj, 0, 1, decode[j][0], decode[j][1]);
  12524. dest[destOffset + j] = Math.min(Math.max(rj, range[j][0]), range[j][1]);
  12525. }
  12526. };
  12527. },
  12528. constructInterpolated: function PDFFunction_constructInterpolated(str, dict) {
  12529. var c0 = dict.getArray('C0') || [0];
  12530. var c1 = dict.getArray('C1') || [1];
  12531. var n = dict.get('N');
  12532. if (!isArray(c0) || !isArray(c1)) {
  12533. error('Illegal dictionary for interpolated function');
  12534. }
  12535. var length = c0.length;
  12536. var diff = [];
  12537. for (var i = 0; i < length; ++i) {
  12538. diff.push(c1[i] - c0[i]);
  12539. }
  12540. return [
  12541. CONSTRUCT_INTERPOLATED,
  12542. c0,
  12543. diff,
  12544. n
  12545. ];
  12546. },
  12547. constructInterpolatedFromIR: function PDFFunction_constructInterpolatedFromIR(IR) {
  12548. var c0 = IR[1];
  12549. var diff = IR[2];
  12550. var n = IR[3];
  12551. var length = diff.length;
  12552. return function constructInterpolatedFromIRResult(src, srcOffset, dest, destOffset) {
  12553. var x = n === 1 ? src[srcOffset] : Math.pow(src[srcOffset], n);
  12554. for (var j = 0; j < length; ++j) {
  12555. dest[destOffset + j] = c0[j] + x * diff[j];
  12556. }
  12557. };
  12558. },
  12559. constructStiched: function PDFFunction_constructStiched(fn, dict, xref) {
  12560. var domain = dict.getArray('Domain');
  12561. if (!domain) {
  12562. error('No domain');
  12563. }
  12564. var inputSize = domain.length / 2;
  12565. if (inputSize !== 1) {
  12566. error('Bad domain for stiched function');
  12567. }
  12568. var fnRefs = dict.get('Functions');
  12569. var fns = [];
  12570. for (var i = 0, ii = fnRefs.length; i < ii; ++i) {
  12571. fns.push(PDFFunction.getIR(xref, xref.fetchIfRef(fnRefs[i])));
  12572. }
  12573. var bounds = dict.getArray('Bounds');
  12574. var encode = dict.getArray('Encode');
  12575. return [
  12576. CONSTRUCT_STICHED,
  12577. domain,
  12578. bounds,
  12579. encode,
  12580. fns
  12581. ];
  12582. },
  12583. constructStichedFromIR: function PDFFunction_constructStichedFromIR(IR) {
  12584. var domain = IR[1];
  12585. var bounds = IR[2];
  12586. var encode = IR[3];
  12587. var fnsIR = IR[4];
  12588. var fns = [];
  12589. var tmpBuf = new Float32Array(1);
  12590. for (var i = 0, ii = fnsIR.length; i < ii; i++) {
  12591. fns.push(PDFFunction.fromIR(fnsIR[i]));
  12592. }
  12593. return function constructStichedFromIRResult(src, srcOffset, dest, destOffset) {
  12594. var clip = function constructStichedFromIRClip(v, min, max) {
  12595. if (v > max) {
  12596. v = max;
  12597. } else if (v < min) {
  12598. v = min;
  12599. }
  12600. return v;
  12601. };
  12602. var v = clip(src[srcOffset], domain[0], domain[1]);
  12603. for (var i = 0, ii = bounds.length; i < ii; ++i) {
  12604. if (v < bounds[i]) {
  12605. break;
  12606. }
  12607. }
  12608. var dmin = domain[0];
  12609. if (i > 0) {
  12610. dmin = bounds[i - 1];
  12611. }
  12612. var dmax = domain[1];
  12613. if (i < bounds.length) {
  12614. dmax = bounds[i];
  12615. }
  12616. var rmin = encode[2 * i];
  12617. var rmax = encode[2 * i + 1];
  12618. tmpBuf[0] = dmin === dmax ? rmin : rmin + (v - dmin) * (rmax - rmin) / (dmax - dmin);
  12619. fns[i](tmpBuf, 0, dest, destOffset);
  12620. };
  12621. },
  12622. constructPostScript: function PDFFunction_constructPostScript(fn, dict, xref) {
  12623. var domain = dict.getArray('Domain');
  12624. var range = dict.getArray('Range');
  12625. if (!domain) {
  12626. error('No domain.');
  12627. }
  12628. if (!range) {
  12629. error('No range.');
  12630. }
  12631. var lexer = new PostScriptLexer(fn);
  12632. var parser = new PostScriptParser(lexer);
  12633. var code = parser.parse();
  12634. return [
  12635. CONSTRUCT_POSTSCRIPT,
  12636. domain,
  12637. range,
  12638. code
  12639. ];
  12640. },
  12641. constructPostScriptFromIR: function PDFFunction_constructPostScriptFromIR(IR) {
  12642. var domain = IR[1];
  12643. var range = IR[2];
  12644. var code = IR[3];
  12645. var compiled = new PostScriptCompiler().compile(code, domain, range);
  12646. if (compiled) {
  12647. return new Function('src', 'srcOffset', 'dest', 'destOffset', compiled);
  12648. }
  12649. info('Unable to compile PS function');
  12650. var numOutputs = range.length >> 1;
  12651. var numInputs = domain.length >> 1;
  12652. var evaluator = new PostScriptEvaluator(code);
  12653. var cache = Object.create(null);
  12654. var MAX_CACHE_SIZE = 2048 * 4;
  12655. var cache_available = MAX_CACHE_SIZE;
  12656. var tmpBuf = new Float32Array(numInputs);
  12657. return function constructPostScriptFromIRResult(src, srcOffset, dest, destOffset) {
  12658. var i, value;
  12659. var key = '';
  12660. var input = tmpBuf;
  12661. for (i = 0; i < numInputs; i++) {
  12662. value = src[srcOffset + i];
  12663. input[i] = value;
  12664. key += value + '_';
  12665. }
  12666. var cachedValue = cache[key];
  12667. if (cachedValue !== undefined) {
  12668. dest.set(cachedValue, destOffset);
  12669. return;
  12670. }
  12671. var output = new Float32Array(numOutputs);
  12672. var stack = evaluator.execute(input);
  12673. var stackIndex = stack.length - numOutputs;
  12674. for (i = 0; i < numOutputs; i++) {
  12675. value = stack[stackIndex + i];
  12676. var bound = range[i * 2];
  12677. if (value < bound) {
  12678. value = bound;
  12679. } else {
  12680. bound = range[i * 2 + 1];
  12681. if (value > bound) {
  12682. value = bound;
  12683. }
  12684. }
  12685. output[i] = value;
  12686. }
  12687. if (cache_available > 0) {
  12688. cache_available--;
  12689. cache[key] = output;
  12690. }
  12691. dest.set(output, destOffset);
  12692. };
  12693. }
  12694. };
  12695. }();
  12696. function isPDFFunction(v) {
  12697. var fnDict;
  12698. if (typeof v !== 'object') {
  12699. return false;
  12700. } else if (isDict(v)) {
  12701. fnDict = v;
  12702. } else if (isStream(v)) {
  12703. fnDict = v.dict;
  12704. } else {
  12705. return false;
  12706. }
  12707. return fnDict.has('FunctionType');
  12708. }
  12709. var PostScriptStack = function PostScriptStackClosure() {
  12710. var MAX_STACK_SIZE = 100;
  12711. function PostScriptStack(initialStack) {
  12712. this.stack = !initialStack ? [] : Array.prototype.slice.call(initialStack, 0);
  12713. }
  12714. PostScriptStack.prototype = {
  12715. push: function PostScriptStack_push(value) {
  12716. if (this.stack.length >= MAX_STACK_SIZE) {
  12717. error('PostScript function stack overflow.');
  12718. }
  12719. this.stack.push(value);
  12720. },
  12721. pop: function PostScriptStack_pop() {
  12722. if (this.stack.length <= 0) {
  12723. error('PostScript function stack underflow.');
  12724. }
  12725. return this.stack.pop();
  12726. },
  12727. copy: function PostScriptStack_copy(n) {
  12728. if (this.stack.length + n >= MAX_STACK_SIZE) {
  12729. error('PostScript function stack overflow.');
  12730. }
  12731. var stack = this.stack;
  12732. for (var i = stack.length - n, j = n - 1; j >= 0; j--, i++) {
  12733. stack.push(stack[i]);
  12734. }
  12735. },
  12736. index: function PostScriptStack_index(n) {
  12737. this.push(this.stack[this.stack.length - n - 1]);
  12738. },
  12739. roll: function PostScriptStack_roll(n, p) {
  12740. var stack = this.stack;
  12741. var l = stack.length - n;
  12742. var r = stack.length - 1, c = l + (p - Math.floor(p / n) * n), i, j, t;
  12743. for (i = l, j = r; i < j; i++, j--) {
  12744. t = stack[i];
  12745. stack[i] = stack[j];
  12746. stack[j] = t;
  12747. }
  12748. for (i = l, j = c - 1; i < j; i++, j--) {
  12749. t = stack[i];
  12750. stack[i] = stack[j];
  12751. stack[j] = t;
  12752. }
  12753. for (i = c, j = r; i < j; i++, j--) {
  12754. t = stack[i];
  12755. stack[i] = stack[j];
  12756. stack[j] = t;
  12757. }
  12758. }
  12759. };
  12760. return PostScriptStack;
  12761. }();
  12762. var PostScriptEvaluator = function PostScriptEvaluatorClosure() {
  12763. function PostScriptEvaluator(operators) {
  12764. this.operators = operators;
  12765. }
  12766. PostScriptEvaluator.prototype = {
  12767. execute: function PostScriptEvaluator_execute(initialStack) {
  12768. var stack = new PostScriptStack(initialStack);
  12769. var counter = 0;
  12770. var operators = this.operators;
  12771. var length = operators.length;
  12772. var operator, a, b;
  12773. while (counter < length) {
  12774. operator = operators[counter++];
  12775. if (typeof operator === 'number') {
  12776. stack.push(operator);
  12777. continue;
  12778. }
  12779. switch (operator) {
  12780. case 'jz':
  12781. b = stack.pop();
  12782. a = stack.pop();
  12783. if (!a) {
  12784. counter = b;
  12785. }
  12786. break;
  12787. case 'j':
  12788. a = stack.pop();
  12789. counter = a;
  12790. break;
  12791. case 'abs':
  12792. a = stack.pop();
  12793. stack.push(Math.abs(a));
  12794. break;
  12795. case 'add':
  12796. b = stack.pop();
  12797. a = stack.pop();
  12798. stack.push(a + b);
  12799. break;
  12800. case 'and':
  12801. b = stack.pop();
  12802. a = stack.pop();
  12803. if (isBool(a) && isBool(b)) {
  12804. stack.push(a && b);
  12805. } else {
  12806. stack.push(a & b);
  12807. }
  12808. break;
  12809. case 'atan':
  12810. a = stack.pop();
  12811. stack.push(Math.atan(a));
  12812. break;
  12813. case 'bitshift':
  12814. b = stack.pop();
  12815. a = stack.pop();
  12816. if (a > 0) {
  12817. stack.push(a << b);
  12818. } else {
  12819. stack.push(a >> b);
  12820. }
  12821. break;
  12822. case 'ceiling':
  12823. a = stack.pop();
  12824. stack.push(Math.ceil(a));
  12825. break;
  12826. case 'copy':
  12827. a = stack.pop();
  12828. stack.copy(a);
  12829. break;
  12830. case 'cos':
  12831. a = stack.pop();
  12832. stack.push(Math.cos(a));
  12833. break;
  12834. case 'cvi':
  12835. a = stack.pop() | 0;
  12836. stack.push(a);
  12837. break;
  12838. case 'cvr':
  12839. break;
  12840. case 'div':
  12841. b = stack.pop();
  12842. a = stack.pop();
  12843. stack.push(a / b);
  12844. break;
  12845. case 'dup':
  12846. stack.copy(1);
  12847. break;
  12848. case 'eq':
  12849. b = stack.pop();
  12850. a = stack.pop();
  12851. stack.push(a === b);
  12852. break;
  12853. case 'exch':
  12854. stack.roll(2, 1);
  12855. break;
  12856. case 'exp':
  12857. b = stack.pop();
  12858. a = stack.pop();
  12859. stack.push(Math.pow(a, b));
  12860. break;
  12861. case 'false':
  12862. stack.push(false);
  12863. break;
  12864. case 'floor':
  12865. a = stack.pop();
  12866. stack.push(Math.floor(a));
  12867. break;
  12868. case 'ge':
  12869. b = stack.pop();
  12870. a = stack.pop();
  12871. stack.push(a >= b);
  12872. break;
  12873. case 'gt':
  12874. b = stack.pop();
  12875. a = stack.pop();
  12876. stack.push(a > b);
  12877. break;
  12878. case 'idiv':
  12879. b = stack.pop();
  12880. a = stack.pop();
  12881. stack.push(a / b | 0);
  12882. break;
  12883. case 'index':
  12884. a = stack.pop();
  12885. stack.index(a);
  12886. break;
  12887. case 'le':
  12888. b = stack.pop();
  12889. a = stack.pop();
  12890. stack.push(a <= b);
  12891. break;
  12892. case 'ln':
  12893. a = stack.pop();
  12894. stack.push(Math.log(a));
  12895. break;
  12896. case 'log':
  12897. a = stack.pop();
  12898. stack.push(Math.log(a) / Math.LN10);
  12899. break;
  12900. case 'lt':
  12901. b = stack.pop();
  12902. a = stack.pop();
  12903. stack.push(a < b);
  12904. break;
  12905. case 'mod':
  12906. b = stack.pop();
  12907. a = stack.pop();
  12908. stack.push(a % b);
  12909. break;
  12910. case 'mul':
  12911. b = stack.pop();
  12912. a = stack.pop();
  12913. stack.push(a * b);
  12914. break;
  12915. case 'ne':
  12916. b = stack.pop();
  12917. a = stack.pop();
  12918. stack.push(a !== b);
  12919. break;
  12920. case 'neg':
  12921. a = stack.pop();
  12922. stack.push(-a);
  12923. break;
  12924. case 'not':
  12925. a = stack.pop();
  12926. if (isBool(a)) {
  12927. stack.push(!a);
  12928. } else {
  12929. stack.push(~a);
  12930. }
  12931. break;
  12932. case 'or':
  12933. b = stack.pop();
  12934. a = stack.pop();
  12935. if (isBool(a) && isBool(b)) {
  12936. stack.push(a || b);
  12937. } else {
  12938. stack.push(a | b);
  12939. }
  12940. break;
  12941. case 'pop':
  12942. stack.pop();
  12943. break;
  12944. case 'roll':
  12945. b = stack.pop();
  12946. a = stack.pop();
  12947. stack.roll(a, b);
  12948. break;
  12949. case 'round':
  12950. a = stack.pop();
  12951. stack.push(Math.round(a));
  12952. break;
  12953. case 'sin':
  12954. a = stack.pop();
  12955. stack.push(Math.sin(a));
  12956. break;
  12957. case 'sqrt':
  12958. a = stack.pop();
  12959. stack.push(Math.sqrt(a));
  12960. break;
  12961. case 'sub':
  12962. b = stack.pop();
  12963. a = stack.pop();
  12964. stack.push(a - b);
  12965. break;
  12966. case 'true':
  12967. stack.push(true);
  12968. break;
  12969. case 'truncate':
  12970. a = stack.pop();
  12971. a = a < 0 ? Math.ceil(a) : Math.floor(a);
  12972. stack.push(a);
  12973. break;
  12974. case 'xor':
  12975. b = stack.pop();
  12976. a = stack.pop();
  12977. if (isBool(a) && isBool(b)) {
  12978. stack.push(a !== b);
  12979. } else {
  12980. stack.push(a ^ b);
  12981. }
  12982. break;
  12983. default:
  12984. error('Unknown operator ' + operator);
  12985. break;
  12986. }
  12987. }
  12988. return stack.stack;
  12989. }
  12990. };
  12991. return PostScriptEvaluator;
  12992. }();
  12993. var PostScriptCompiler = function PostScriptCompilerClosure() {
  12994. function AstNode(type) {
  12995. this.type = type;
  12996. }
  12997. AstNode.prototype.visit = function (visitor) {
  12998. throw new Error('abstract method');
  12999. };
  13000. function AstArgument(index, min, max) {
  13001. AstNode.call(this, 'args');
  13002. this.index = index;
  13003. this.min = min;
  13004. this.max = max;
  13005. }
  13006. AstArgument.prototype = Object.create(AstNode.prototype);
  13007. AstArgument.prototype.visit = function (visitor) {
  13008. visitor.visitArgument(this);
  13009. };
  13010. function AstLiteral(number) {
  13011. AstNode.call(this, 'literal');
  13012. this.number = number;
  13013. this.min = number;
  13014. this.max = number;
  13015. }
  13016. AstLiteral.prototype = Object.create(AstNode.prototype);
  13017. AstLiteral.prototype.visit = function (visitor) {
  13018. visitor.visitLiteral(this);
  13019. };
  13020. function AstBinaryOperation(op, arg1, arg2, min, max) {
  13021. AstNode.call(this, 'binary');
  13022. this.op = op;
  13023. this.arg1 = arg1;
  13024. this.arg2 = arg2;
  13025. this.min = min;
  13026. this.max = max;
  13027. }
  13028. AstBinaryOperation.prototype = Object.create(AstNode.prototype);
  13029. AstBinaryOperation.prototype.visit = function (visitor) {
  13030. visitor.visitBinaryOperation(this);
  13031. };
  13032. function AstMin(arg, max) {
  13033. AstNode.call(this, 'max');
  13034. this.arg = arg;
  13035. this.min = arg.min;
  13036. this.max = max;
  13037. }
  13038. AstMin.prototype = Object.create(AstNode.prototype);
  13039. AstMin.prototype.visit = function (visitor) {
  13040. visitor.visitMin(this);
  13041. };
  13042. function AstVariable(index, min, max) {
  13043. AstNode.call(this, 'var');
  13044. this.index = index;
  13045. this.min = min;
  13046. this.max = max;
  13047. }
  13048. AstVariable.prototype = Object.create(AstNode.prototype);
  13049. AstVariable.prototype.visit = function (visitor) {
  13050. visitor.visitVariable(this);
  13051. };
  13052. function AstVariableDefinition(variable, arg) {
  13053. AstNode.call(this, 'definition');
  13054. this.variable = variable;
  13055. this.arg = arg;
  13056. }
  13057. AstVariableDefinition.prototype = Object.create(AstNode.prototype);
  13058. AstVariableDefinition.prototype.visit = function (visitor) {
  13059. visitor.visitVariableDefinition(this);
  13060. };
  13061. function ExpressionBuilderVisitor() {
  13062. this.parts = [];
  13063. }
  13064. ExpressionBuilderVisitor.prototype = {
  13065. visitArgument: function (arg) {
  13066. this.parts.push('Math.max(', arg.min, ', Math.min(', arg.max, ', src[srcOffset + ', arg.index, ']))');
  13067. },
  13068. visitVariable: function (variable) {
  13069. this.parts.push('v', variable.index);
  13070. },
  13071. visitLiteral: function (literal) {
  13072. this.parts.push(literal.number);
  13073. },
  13074. visitBinaryOperation: function (operation) {
  13075. this.parts.push('(');
  13076. operation.arg1.visit(this);
  13077. this.parts.push(' ', operation.op, ' ');
  13078. operation.arg2.visit(this);
  13079. this.parts.push(')');
  13080. },
  13081. visitVariableDefinition: function (definition) {
  13082. this.parts.push('var ');
  13083. definition.variable.visit(this);
  13084. this.parts.push(' = ');
  13085. definition.arg.visit(this);
  13086. this.parts.push(';');
  13087. },
  13088. visitMin: function (max) {
  13089. this.parts.push('Math.min(');
  13090. max.arg.visit(this);
  13091. this.parts.push(', ', max.max, ')');
  13092. },
  13093. toString: function () {
  13094. return this.parts.join('');
  13095. }
  13096. };
  13097. function buildAddOperation(num1, num2) {
  13098. if (num2.type === 'literal' && num2.number === 0) {
  13099. return num1;
  13100. }
  13101. if (num1.type === 'literal' && num1.number === 0) {
  13102. return num2;
  13103. }
  13104. if (num2.type === 'literal' && num1.type === 'literal') {
  13105. return new AstLiteral(num1.number + num2.number);
  13106. }
  13107. return new AstBinaryOperation('+', num1, num2, num1.min + num2.min, num1.max + num2.max);
  13108. }
  13109. function buildMulOperation(num1, num2) {
  13110. if (num2.type === 'literal') {
  13111. if (num2.number === 0) {
  13112. return new AstLiteral(0);
  13113. } else if (num2.number === 1) {
  13114. return num1;
  13115. } else if (num1.type === 'literal') {
  13116. return new AstLiteral(num1.number * num2.number);
  13117. }
  13118. }
  13119. if (num1.type === 'literal') {
  13120. if (num1.number === 0) {
  13121. return new AstLiteral(0);
  13122. } else if (num1.number === 1) {
  13123. return num2;
  13124. }
  13125. }
  13126. var min = Math.min(num1.min * num2.min, num1.min * num2.max, num1.max * num2.min, num1.max * num2.max);
  13127. var max = Math.max(num1.min * num2.min, num1.min * num2.max, num1.max * num2.min, num1.max * num2.max);
  13128. return new AstBinaryOperation('*', num1, num2, min, max);
  13129. }
  13130. function buildSubOperation(num1, num2) {
  13131. if (num2.type === 'literal') {
  13132. if (num2.number === 0) {
  13133. return num1;
  13134. } else if (num1.type === 'literal') {
  13135. return new AstLiteral(num1.number - num2.number);
  13136. }
  13137. }
  13138. if (num2.type === 'binary' && num2.op === '-' && num1.type === 'literal' && num1.number === 1 && num2.arg1.type === 'literal' && num2.arg1.number === 1) {
  13139. return num2.arg2;
  13140. }
  13141. return new AstBinaryOperation('-', num1, num2, num1.min - num2.max, num1.max - num2.min);
  13142. }
  13143. function buildMinOperation(num1, max) {
  13144. if (num1.min >= max) {
  13145. return new AstLiteral(max);
  13146. } else if (num1.max <= max) {
  13147. return num1;
  13148. }
  13149. return new AstMin(num1, max);
  13150. }
  13151. function PostScriptCompiler() {
  13152. }
  13153. PostScriptCompiler.prototype = {
  13154. compile: function PostScriptCompiler_compile(code, domain, range) {
  13155. var stack = [];
  13156. var i, ii;
  13157. var instructions = [];
  13158. var inputSize = domain.length >> 1, outputSize = range.length >> 1;
  13159. var lastRegister = 0;
  13160. var n, j;
  13161. var num1, num2, ast1, ast2, tmpVar, item;
  13162. for (i = 0; i < inputSize; i++) {
  13163. stack.push(new AstArgument(i, domain[i * 2], domain[i * 2 + 1]));
  13164. }
  13165. for (i = 0, ii = code.length; i < ii; i++) {
  13166. item = code[i];
  13167. if (typeof item === 'number') {
  13168. stack.push(new AstLiteral(item));
  13169. continue;
  13170. }
  13171. switch (item) {
  13172. case 'add':
  13173. if (stack.length < 2) {
  13174. return null;
  13175. }
  13176. num2 = stack.pop();
  13177. num1 = stack.pop();
  13178. stack.push(buildAddOperation(num1, num2));
  13179. break;
  13180. case 'cvr':
  13181. if (stack.length < 1) {
  13182. return null;
  13183. }
  13184. break;
  13185. case 'mul':
  13186. if (stack.length < 2) {
  13187. return null;
  13188. }
  13189. num2 = stack.pop();
  13190. num1 = stack.pop();
  13191. stack.push(buildMulOperation(num1, num2));
  13192. break;
  13193. case 'sub':
  13194. if (stack.length < 2) {
  13195. return null;
  13196. }
  13197. num2 = stack.pop();
  13198. num1 = stack.pop();
  13199. stack.push(buildSubOperation(num1, num2));
  13200. break;
  13201. case 'exch':
  13202. if (stack.length < 2) {
  13203. return null;
  13204. }
  13205. ast1 = stack.pop();
  13206. ast2 = stack.pop();
  13207. stack.push(ast1, ast2);
  13208. break;
  13209. case 'pop':
  13210. if (stack.length < 1) {
  13211. return null;
  13212. }
  13213. stack.pop();
  13214. break;
  13215. case 'index':
  13216. if (stack.length < 1) {
  13217. return null;
  13218. }
  13219. num1 = stack.pop();
  13220. if (num1.type !== 'literal') {
  13221. return null;
  13222. }
  13223. n = num1.number;
  13224. if (n < 0 || (n | 0) !== n || stack.length < n) {
  13225. return null;
  13226. }
  13227. ast1 = stack[stack.length - n - 1];
  13228. if (ast1.type === 'literal' || ast1.type === 'var') {
  13229. stack.push(ast1);
  13230. break;
  13231. }
  13232. tmpVar = new AstVariable(lastRegister++, ast1.min, ast1.max);
  13233. stack[stack.length - n - 1] = tmpVar;
  13234. stack.push(tmpVar);
  13235. instructions.push(new AstVariableDefinition(tmpVar, ast1));
  13236. break;
  13237. case 'dup':
  13238. if (stack.length < 1) {
  13239. return null;
  13240. }
  13241. 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]) {
  13242. num1 = stack.pop();
  13243. stack.push(buildMinOperation(num1, code[i + 1]));
  13244. i += 6;
  13245. break;
  13246. }
  13247. ast1 = stack[stack.length - 1];
  13248. if (ast1.type === 'literal' || ast1.type === 'var') {
  13249. stack.push(ast1);
  13250. break;
  13251. }
  13252. tmpVar = new AstVariable(lastRegister++, ast1.min, ast1.max);
  13253. stack[stack.length - 1] = tmpVar;
  13254. stack.push(tmpVar);
  13255. instructions.push(new AstVariableDefinition(tmpVar, ast1));
  13256. break;
  13257. case 'roll':
  13258. if (stack.length < 2) {
  13259. return null;
  13260. }
  13261. num2 = stack.pop();
  13262. num1 = stack.pop();
  13263. if (num2.type !== 'literal' || num1.type !== 'literal') {
  13264. return null;
  13265. }
  13266. j = num2.number;
  13267. n = num1.number;
  13268. if (n <= 0 || (n | 0) !== n || (j | 0) !== j || stack.length < n) {
  13269. return null;
  13270. }
  13271. j = (j % n + n) % n;
  13272. if (j === 0) {
  13273. break;
  13274. }
  13275. Array.prototype.push.apply(stack, stack.splice(stack.length - n, n - j));
  13276. break;
  13277. default:
  13278. return null;
  13279. }
  13280. }
  13281. if (stack.length !== outputSize) {
  13282. return null;
  13283. }
  13284. var result = [];
  13285. instructions.forEach(function (instruction) {
  13286. var statementBuilder = new ExpressionBuilderVisitor();
  13287. instruction.visit(statementBuilder);
  13288. result.push(statementBuilder.toString());
  13289. });
  13290. stack.forEach(function (expr, i) {
  13291. var statementBuilder = new ExpressionBuilderVisitor();
  13292. expr.visit(statementBuilder);
  13293. var min = range[i * 2], max = range[i * 2 + 1];
  13294. var out = [statementBuilder.toString()];
  13295. if (min > expr.min) {
  13296. out.unshift('Math.max(', min, ', ');
  13297. out.push(')');
  13298. }
  13299. if (max < expr.max) {
  13300. out.unshift('Math.min(', max, ', ');
  13301. out.push(')');
  13302. }
  13303. out.unshift('dest[destOffset + ', i, '] = ');
  13304. out.push(';');
  13305. result.push(out.join(''));
  13306. });
  13307. return result.join('\n');
  13308. }
  13309. };
  13310. return PostScriptCompiler;
  13311. }();
  13312. exports.isPDFFunction = isPDFFunction;
  13313. exports.PDFFunction = PDFFunction;
  13314. exports.PostScriptEvaluator = PostScriptEvaluator;
  13315. exports.PostScriptCompiler = PostScriptCompiler;
  13316. /***/ }),
  13317. /* 7 */
  13318. /***/ (function(module, exports, __w_pdfjs_require__) {
  13319. "use strict";
  13320. var sharedUtil = __w_pdfjs_require__(0);
  13321. var getLookupTableFactory = sharedUtil.getLookupTableFactory;
  13322. var getGlyphsUnicode = getLookupTableFactory(function (t) {
  13323. t['A'] = 0x0041;
  13324. t['AE'] = 0x00C6;
  13325. t['AEacute'] = 0x01FC;
  13326. t['AEmacron'] = 0x01E2;
  13327. t['AEsmall'] = 0xF7E6;
  13328. t['Aacute'] = 0x00C1;
  13329. t['Aacutesmall'] = 0xF7E1;
  13330. t['Abreve'] = 0x0102;
  13331. t['Abreveacute'] = 0x1EAE;
  13332. t['Abrevecyrillic'] = 0x04D0;
  13333. t['Abrevedotbelow'] = 0x1EB6;
  13334. t['Abrevegrave'] = 0x1EB0;
  13335. t['Abrevehookabove'] = 0x1EB2;
  13336. t['Abrevetilde'] = 0x1EB4;
  13337. t['Acaron'] = 0x01CD;
  13338. t['Acircle'] = 0x24B6;
  13339. t['Acircumflex'] = 0x00C2;
  13340. t['Acircumflexacute'] = 0x1EA4;
  13341. t['Acircumflexdotbelow'] = 0x1EAC;
  13342. t['Acircumflexgrave'] = 0x1EA6;
  13343. t['Acircumflexhookabove'] = 0x1EA8;
  13344. t['Acircumflexsmall'] = 0xF7E2;
  13345. t['Acircumflextilde'] = 0x1EAA;
  13346. t['Acute'] = 0xF6C9;
  13347. t['Acutesmall'] = 0xF7B4;
  13348. t['Acyrillic'] = 0x0410;
  13349. t['Adblgrave'] = 0x0200;
  13350. t['Adieresis'] = 0x00C4;
  13351. t['Adieresiscyrillic'] = 0x04D2;
  13352. t['Adieresismacron'] = 0x01DE;
  13353. t['Adieresissmall'] = 0xF7E4;
  13354. t['Adotbelow'] = 0x1EA0;
  13355. t['Adotmacron'] = 0x01E0;
  13356. t['Agrave'] = 0x00C0;
  13357. t['Agravesmall'] = 0xF7E0;
  13358. t['Ahookabove'] = 0x1EA2;
  13359. t['Aiecyrillic'] = 0x04D4;
  13360. t['Ainvertedbreve'] = 0x0202;
  13361. t['Alpha'] = 0x0391;
  13362. t['Alphatonos'] = 0x0386;
  13363. t['Amacron'] = 0x0100;
  13364. t['Amonospace'] = 0xFF21;
  13365. t['Aogonek'] = 0x0104;
  13366. t['Aring'] = 0x00C5;
  13367. t['Aringacute'] = 0x01FA;
  13368. t['Aringbelow'] = 0x1E00;
  13369. t['Aringsmall'] = 0xF7E5;
  13370. t['Asmall'] = 0xF761;
  13371. t['Atilde'] = 0x00C3;
  13372. t['Atildesmall'] = 0xF7E3;
  13373. t['Aybarmenian'] = 0x0531;
  13374. t['B'] = 0x0042;
  13375. t['Bcircle'] = 0x24B7;
  13376. t['Bdotaccent'] = 0x1E02;
  13377. t['Bdotbelow'] = 0x1E04;
  13378. t['Becyrillic'] = 0x0411;
  13379. t['Benarmenian'] = 0x0532;
  13380. t['Beta'] = 0x0392;
  13381. t['Bhook'] = 0x0181;
  13382. t['Blinebelow'] = 0x1E06;
  13383. t['Bmonospace'] = 0xFF22;
  13384. t['Brevesmall'] = 0xF6F4;
  13385. t['Bsmall'] = 0xF762;
  13386. t['Btopbar'] = 0x0182;
  13387. t['C'] = 0x0043;
  13388. t['Caarmenian'] = 0x053E;
  13389. t['Cacute'] = 0x0106;
  13390. t['Caron'] = 0xF6CA;
  13391. t['Caronsmall'] = 0xF6F5;
  13392. t['Ccaron'] = 0x010C;
  13393. t['Ccedilla'] = 0x00C7;
  13394. t['Ccedillaacute'] = 0x1E08;
  13395. t['Ccedillasmall'] = 0xF7E7;
  13396. t['Ccircle'] = 0x24B8;
  13397. t['Ccircumflex'] = 0x0108;
  13398. t['Cdot'] = 0x010A;
  13399. t['Cdotaccent'] = 0x010A;
  13400. t['Cedillasmall'] = 0xF7B8;
  13401. t['Chaarmenian'] = 0x0549;
  13402. t['Cheabkhasiancyrillic'] = 0x04BC;
  13403. t['Checyrillic'] = 0x0427;
  13404. t['Chedescenderabkhasiancyrillic'] = 0x04BE;
  13405. t['Chedescendercyrillic'] = 0x04B6;
  13406. t['Chedieresiscyrillic'] = 0x04F4;
  13407. t['Cheharmenian'] = 0x0543;
  13408. t['Chekhakassiancyrillic'] = 0x04CB;
  13409. t['Cheverticalstrokecyrillic'] = 0x04B8;
  13410. t['Chi'] = 0x03A7;
  13411. t['Chook'] = 0x0187;
  13412. t['Circumflexsmall'] = 0xF6F6;
  13413. t['Cmonospace'] = 0xFF23;
  13414. t['Coarmenian'] = 0x0551;
  13415. t['Csmall'] = 0xF763;
  13416. t['D'] = 0x0044;
  13417. t['DZ'] = 0x01F1;
  13418. t['DZcaron'] = 0x01C4;
  13419. t['Daarmenian'] = 0x0534;
  13420. t['Dafrican'] = 0x0189;
  13421. t['Dcaron'] = 0x010E;
  13422. t['Dcedilla'] = 0x1E10;
  13423. t['Dcircle'] = 0x24B9;
  13424. t['Dcircumflexbelow'] = 0x1E12;
  13425. t['Dcroat'] = 0x0110;
  13426. t['Ddotaccent'] = 0x1E0A;
  13427. t['Ddotbelow'] = 0x1E0C;
  13428. t['Decyrillic'] = 0x0414;
  13429. t['Deicoptic'] = 0x03EE;
  13430. t['Delta'] = 0x2206;
  13431. t['Deltagreek'] = 0x0394;
  13432. t['Dhook'] = 0x018A;
  13433. t['Dieresis'] = 0xF6CB;
  13434. t['DieresisAcute'] = 0xF6CC;
  13435. t['DieresisGrave'] = 0xF6CD;
  13436. t['Dieresissmall'] = 0xF7A8;
  13437. t['Digammagreek'] = 0x03DC;
  13438. t['Djecyrillic'] = 0x0402;
  13439. t['Dlinebelow'] = 0x1E0E;
  13440. t['Dmonospace'] = 0xFF24;
  13441. t['Dotaccentsmall'] = 0xF6F7;
  13442. t['Dslash'] = 0x0110;
  13443. t['Dsmall'] = 0xF764;
  13444. t['Dtopbar'] = 0x018B;
  13445. t['Dz'] = 0x01F2;
  13446. t['Dzcaron'] = 0x01C5;
  13447. t['Dzeabkhasiancyrillic'] = 0x04E0;
  13448. t['Dzecyrillic'] = 0x0405;
  13449. t['Dzhecyrillic'] = 0x040F;
  13450. t['E'] = 0x0045;
  13451. t['Eacute'] = 0x00C9;
  13452. t['Eacutesmall'] = 0xF7E9;
  13453. t['Ebreve'] = 0x0114;
  13454. t['Ecaron'] = 0x011A;
  13455. t['Ecedillabreve'] = 0x1E1C;
  13456. t['Echarmenian'] = 0x0535;
  13457. t['Ecircle'] = 0x24BA;
  13458. t['Ecircumflex'] = 0x00CA;
  13459. t['Ecircumflexacute'] = 0x1EBE;
  13460. t['Ecircumflexbelow'] = 0x1E18;
  13461. t['Ecircumflexdotbelow'] = 0x1EC6;
  13462. t['Ecircumflexgrave'] = 0x1EC0;
  13463. t['Ecircumflexhookabove'] = 0x1EC2;
  13464. t['Ecircumflexsmall'] = 0xF7EA;
  13465. t['Ecircumflextilde'] = 0x1EC4;
  13466. t['Ecyrillic'] = 0x0404;
  13467. t['Edblgrave'] = 0x0204;
  13468. t['Edieresis'] = 0x00CB;
  13469. t['Edieresissmall'] = 0xF7EB;
  13470. t['Edot'] = 0x0116;
  13471. t['Edotaccent'] = 0x0116;
  13472. t['Edotbelow'] = 0x1EB8;
  13473. t['Efcyrillic'] = 0x0424;
  13474. t['Egrave'] = 0x00C8;
  13475. t['Egravesmall'] = 0xF7E8;
  13476. t['Eharmenian'] = 0x0537;
  13477. t['Ehookabove'] = 0x1EBA;
  13478. t['Eightroman'] = 0x2167;
  13479. t['Einvertedbreve'] = 0x0206;
  13480. t['Eiotifiedcyrillic'] = 0x0464;
  13481. t['Elcyrillic'] = 0x041B;
  13482. t['Elevenroman'] = 0x216A;
  13483. t['Emacron'] = 0x0112;
  13484. t['Emacronacute'] = 0x1E16;
  13485. t['Emacrongrave'] = 0x1E14;
  13486. t['Emcyrillic'] = 0x041C;
  13487. t['Emonospace'] = 0xFF25;
  13488. t['Encyrillic'] = 0x041D;
  13489. t['Endescendercyrillic'] = 0x04A2;
  13490. t['Eng'] = 0x014A;
  13491. t['Enghecyrillic'] = 0x04A4;
  13492. t['Enhookcyrillic'] = 0x04C7;
  13493. t['Eogonek'] = 0x0118;
  13494. t['Eopen'] = 0x0190;
  13495. t['Epsilon'] = 0x0395;
  13496. t['Epsilontonos'] = 0x0388;
  13497. t['Ercyrillic'] = 0x0420;
  13498. t['Ereversed'] = 0x018E;
  13499. t['Ereversedcyrillic'] = 0x042D;
  13500. t['Escyrillic'] = 0x0421;
  13501. t['Esdescendercyrillic'] = 0x04AA;
  13502. t['Esh'] = 0x01A9;
  13503. t['Esmall'] = 0xF765;
  13504. t['Eta'] = 0x0397;
  13505. t['Etarmenian'] = 0x0538;
  13506. t['Etatonos'] = 0x0389;
  13507. t['Eth'] = 0x00D0;
  13508. t['Ethsmall'] = 0xF7F0;
  13509. t['Etilde'] = 0x1EBC;
  13510. t['Etildebelow'] = 0x1E1A;
  13511. t['Euro'] = 0x20AC;
  13512. t['Ezh'] = 0x01B7;
  13513. t['Ezhcaron'] = 0x01EE;
  13514. t['Ezhreversed'] = 0x01B8;
  13515. t['F'] = 0x0046;
  13516. t['Fcircle'] = 0x24BB;
  13517. t['Fdotaccent'] = 0x1E1E;
  13518. t['Feharmenian'] = 0x0556;
  13519. t['Feicoptic'] = 0x03E4;
  13520. t['Fhook'] = 0x0191;
  13521. t['Fitacyrillic'] = 0x0472;
  13522. t['Fiveroman'] = 0x2164;
  13523. t['Fmonospace'] = 0xFF26;
  13524. t['Fourroman'] = 0x2163;
  13525. t['Fsmall'] = 0xF766;
  13526. t['G'] = 0x0047;
  13527. t['GBsquare'] = 0x3387;
  13528. t['Gacute'] = 0x01F4;
  13529. t['Gamma'] = 0x0393;
  13530. t['Gammaafrican'] = 0x0194;
  13531. t['Gangiacoptic'] = 0x03EA;
  13532. t['Gbreve'] = 0x011E;
  13533. t['Gcaron'] = 0x01E6;
  13534. t['Gcedilla'] = 0x0122;
  13535. t['Gcircle'] = 0x24BC;
  13536. t['Gcircumflex'] = 0x011C;
  13537. t['Gcommaaccent'] = 0x0122;
  13538. t['Gdot'] = 0x0120;
  13539. t['Gdotaccent'] = 0x0120;
  13540. t['Gecyrillic'] = 0x0413;
  13541. t['Ghadarmenian'] = 0x0542;
  13542. t['Ghemiddlehookcyrillic'] = 0x0494;
  13543. t['Ghestrokecyrillic'] = 0x0492;
  13544. t['Gheupturncyrillic'] = 0x0490;
  13545. t['Ghook'] = 0x0193;
  13546. t['Gimarmenian'] = 0x0533;
  13547. t['Gjecyrillic'] = 0x0403;
  13548. t['Gmacron'] = 0x1E20;
  13549. t['Gmonospace'] = 0xFF27;
  13550. t['Grave'] = 0xF6CE;
  13551. t['Gravesmall'] = 0xF760;
  13552. t['Gsmall'] = 0xF767;
  13553. t['Gsmallhook'] = 0x029B;
  13554. t['Gstroke'] = 0x01E4;
  13555. t['H'] = 0x0048;
  13556. t['H18533'] = 0x25CF;
  13557. t['H18543'] = 0x25AA;
  13558. t['H18551'] = 0x25AB;
  13559. t['H22073'] = 0x25A1;
  13560. t['HPsquare'] = 0x33CB;
  13561. t['Haabkhasiancyrillic'] = 0x04A8;
  13562. t['Hadescendercyrillic'] = 0x04B2;
  13563. t['Hardsigncyrillic'] = 0x042A;
  13564. t['Hbar'] = 0x0126;
  13565. t['Hbrevebelow'] = 0x1E2A;
  13566. t['Hcedilla'] = 0x1E28;
  13567. t['Hcircle'] = 0x24BD;
  13568. t['Hcircumflex'] = 0x0124;
  13569. t['Hdieresis'] = 0x1E26;
  13570. t['Hdotaccent'] = 0x1E22;
  13571. t['Hdotbelow'] = 0x1E24;
  13572. t['Hmonospace'] = 0xFF28;
  13573. t['Hoarmenian'] = 0x0540;
  13574. t['Horicoptic'] = 0x03E8;
  13575. t['Hsmall'] = 0xF768;
  13576. t['Hungarumlaut'] = 0xF6CF;
  13577. t['Hungarumlautsmall'] = 0xF6F8;
  13578. t['Hzsquare'] = 0x3390;
  13579. t['I'] = 0x0049;
  13580. t['IAcyrillic'] = 0x042F;
  13581. t['IJ'] = 0x0132;
  13582. t['IUcyrillic'] = 0x042E;
  13583. t['Iacute'] = 0x00CD;
  13584. t['Iacutesmall'] = 0xF7ED;
  13585. t['Ibreve'] = 0x012C;
  13586. t['Icaron'] = 0x01CF;
  13587. t['Icircle'] = 0x24BE;
  13588. t['Icircumflex'] = 0x00CE;
  13589. t['Icircumflexsmall'] = 0xF7EE;
  13590. t['Icyrillic'] = 0x0406;
  13591. t['Idblgrave'] = 0x0208;
  13592. t['Idieresis'] = 0x00CF;
  13593. t['Idieresisacute'] = 0x1E2E;
  13594. t['Idieresiscyrillic'] = 0x04E4;
  13595. t['Idieresissmall'] = 0xF7EF;
  13596. t['Idot'] = 0x0130;
  13597. t['Idotaccent'] = 0x0130;
  13598. t['Idotbelow'] = 0x1ECA;
  13599. t['Iebrevecyrillic'] = 0x04D6;
  13600. t['Iecyrillic'] = 0x0415;
  13601. t['Ifraktur'] = 0x2111;
  13602. t['Igrave'] = 0x00CC;
  13603. t['Igravesmall'] = 0xF7EC;
  13604. t['Ihookabove'] = 0x1EC8;
  13605. t['Iicyrillic'] = 0x0418;
  13606. t['Iinvertedbreve'] = 0x020A;
  13607. t['Iishortcyrillic'] = 0x0419;
  13608. t['Imacron'] = 0x012A;
  13609. t['Imacroncyrillic'] = 0x04E2;
  13610. t['Imonospace'] = 0xFF29;
  13611. t['Iniarmenian'] = 0x053B;
  13612. t['Iocyrillic'] = 0x0401;
  13613. t['Iogonek'] = 0x012E;
  13614. t['Iota'] = 0x0399;
  13615. t['Iotaafrican'] = 0x0196;
  13616. t['Iotadieresis'] = 0x03AA;
  13617. t['Iotatonos'] = 0x038A;
  13618. t['Ismall'] = 0xF769;
  13619. t['Istroke'] = 0x0197;
  13620. t['Itilde'] = 0x0128;
  13621. t['Itildebelow'] = 0x1E2C;
  13622. t['Izhitsacyrillic'] = 0x0474;
  13623. t['Izhitsadblgravecyrillic'] = 0x0476;
  13624. t['J'] = 0x004A;
  13625. t['Jaarmenian'] = 0x0541;
  13626. t['Jcircle'] = 0x24BF;
  13627. t['Jcircumflex'] = 0x0134;
  13628. t['Jecyrillic'] = 0x0408;
  13629. t['Jheharmenian'] = 0x054B;
  13630. t['Jmonospace'] = 0xFF2A;
  13631. t['Jsmall'] = 0xF76A;
  13632. t['K'] = 0x004B;
  13633. t['KBsquare'] = 0x3385;
  13634. t['KKsquare'] = 0x33CD;
  13635. t['Kabashkircyrillic'] = 0x04A0;
  13636. t['Kacute'] = 0x1E30;
  13637. t['Kacyrillic'] = 0x041A;
  13638. t['Kadescendercyrillic'] = 0x049A;
  13639. t['Kahookcyrillic'] = 0x04C3;
  13640. t['Kappa'] = 0x039A;
  13641. t['Kastrokecyrillic'] = 0x049E;
  13642. t['Kaverticalstrokecyrillic'] = 0x049C;
  13643. t['Kcaron'] = 0x01E8;
  13644. t['Kcedilla'] = 0x0136;
  13645. t['Kcircle'] = 0x24C0;
  13646. t['Kcommaaccent'] = 0x0136;
  13647. t['Kdotbelow'] = 0x1E32;
  13648. t['Keharmenian'] = 0x0554;
  13649. t['Kenarmenian'] = 0x053F;
  13650. t['Khacyrillic'] = 0x0425;
  13651. t['Kheicoptic'] = 0x03E6;
  13652. t['Khook'] = 0x0198;
  13653. t['Kjecyrillic'] = 0x040C;
  13654. t['Klinebelow'] = 0x1E34;
  13655. t['Kmonospace'] = 0xFF2B;
  13656. t['Koppacyrillic'] = 0x0480;
  13657. t['Koppagreek'] = 0x03DE;
  13658. t['Ksicyrillic'] = 0x046E;
  13659. t['Ksmall'] = 0xF76B;
  13660. t['L'] = 0x004C;
  13661. t['LJ'] = 0x01C7;
  13662. t['LL'] = 0xF6BF;
  13663. t['Lacute'] = 0x0139;
  13664. t['Lambda'] = 0x039B;
  13665. t['Lcaron'] = 0x013D;
  13666. t['Lcedilla'] = 0x013B;
  13667. t['Lcircle'] = 0x24C1;
  13668. t['Lcircumflexbelow'] = 0x1E3C;
  13669. t['Lcommaaccent'] = 0x013B;
  13670. t['Ldot'] = 0x013F;
  13671. t['Ldotaccent'] = 0x013F;
  13672. t['Ldotbelow'] = 0x1E36;
  13673. t['Ldotbelowmacron'] = 0x1E38;
  13674. t['Liwnarmenian'] = 0x053C;
  13675. t['Lj'] = 0x01C8;
  13676. t['Ljecyrillic'] = 0x0409;
  13677. t['Llinebelow'] = 0x1E3A;
  13678. t['Lmonospace'] = 0xFF2C;
  13679. t['Lslash'] = 0x0141;
  13680. t['Lslashsmall'] = 0xF6F9;
  13681. t['Lsmall'] = 0xF76C;
  13682. t['M'] = 0x004D;
  13683. t['MBsquare'] = 0x3386;
  13684. t['Macron'] = 0xF6D0;
  13685. t['Macronsmall'] = 0xF7AF;
  13686. t['Macute'] = 0x1E3E;
  13687. t['Mcircle'] = 0x24C2;
  13688. t['Mdotaccent'] = 0x1E40;
  13689. t['Mdotbelow'] = 0x1E42;
  13690. t['Menarmenian'] = 0x0544;
  13691. t['Mmonospace'] = 0xFF2D;
  13692. t['Msmall'] = 0xF76D;
  13693. t['Mturned'] = 0x019C;
  13694. t['Mu'] = 0x039C;
  13695. t['N'] = 0x004E;
  13696. t['NJ'] = 0x01CA;
  13697. t['Nacute'] = 0x0143;
  13698. t['Ncaron'] = 0x0147;
  13699. t['Ncedilla'] = 0x0145;
  13700. t['Ncircle'] = 0x24C3;
  13701. t['Ncircumflexbelow'] = 0x1E4A;
  13702. t['Ncommaaccent'] = 0x0145;
  13703. t['Ndotaccent'] = 0x1E44;
  13704. t['Ndotbelow'] = 0x1E46;
  13705. t['Nhookleft'] = 0x019D;
  13706. t['Nineroman'] = 0x2168;
  13707. t['Nj'] = 0x01CB;
  13708. t['Njecyrillic'] = 0x040A;
  13709. t['Nlinebelow'] = 0x1E48;
  13710. t['Nmonospace'] = 0xFF2E;
  13711. t['Nowarmenian'] = 0x0546;
  13712. t['Nsmall'] = 0xF76E;
  13713. t['Ntilde'] = 0x00D1;
  13714. t['Ntildesmall'] = 0xF7F1;
  13715. t['Nu'] = 0x039D;
  13716. t['O'] = 0x004F;
  13717. t['OE'] = 0x0152;
  13718. t['OEsmall'] = 0xF6FA;
  13719. t['Oacute'] = 0x00D3;
  13720. t['Oacutesmall'] = 0xF7F3;
  13721. t['Obarredcyrillic'] = 0x04E8;
  13722. t['Obarreddieresiscyrillic'] = 0x04EA;
  13723. t['Obreve'] = 0x014E;
  13724. t['Ocaron'] = 0x01D1;
  13725. t['Ocenteredtilde'] = 0x019F;
  13726. t['Ocircle'] = 0x24C4;
  13727. t['Ocircumflex'] = 0x00D4;
  13728. t['Ocircumflexacute'] = 0x1ED0;
  13729. t['Ocircumflexdotbelow'] = 0x1ED8;
  13730. t['Ocircumflexgrave'] = 0x1ED2;
  13731. t['Ocircumflexhookabove'] = 0x1ED4;
  13732. t['Ocircumflexsmall'] = 0xF7F4;
  13733. t['Ocircumflextilde'] = 0x1ED6;
  13734. t['Ocyrillic'] = 0x041E;
  13735. t['Odblacute'] = 0x0150;
  13736. t['Odblgrave'] = 0x020C;
  13737. t['Odieresis'] = 0x00D6;
  13738. t['Odieresiscyrillic'] = 0x04E6;
  13739. t['Odieresissmall'] = 0xF7F6;
  13740. t['Odotbelow'] = 0x1ECC;
  13741. t['Ogoneksmall'] = 0xF6FB;
  13742. t['Ograve'] = 0x00D2;
  13743. t['Ogravesmall'] = 0xF7F2;
  13744. t['Oharmenian'] = 0x0555;
  13745. t['Ohm'] = 0x2126;
  13746. t['Ohookabove'] = 0x1ECE;
  13747. t['Ohorn'] = 0x01A0;
  13748. t['Ohornacute'] = 0x1EDA;
  13749. t['Ohorndotbelow'] = 0x1EE2;
  13750. t['Ohorngrave'] = 0x1EDC;
  13751. t['Ohornhookabove'] = 0x1EDE;
  13752. t['Ohorntilde'] = 0x1EE0;
  13753. t['Ohungarumlaut'] = 0x0150;
  13754. t['Oi'] = 0x01A2;
  13755. t['Oinvertedbreve'] = 0x020E;
  13756. t['Omacron'] = 0x014C;
  13757. t['Omacronacute'] = 0x1E52;
  13758. t['Omacrongrave'] = 0x1E50;
  13759. t['Omega'] = 0x2126;
  13760. t['Omegacyrillic'] = 0x0460;
  13761. t['Omegagreek'] = 0x03A9;
  13762. t['Omegaroundcyrillic'] = 0x047A;
  13763. t['Omegatitlocyrillic'] = 0x047C;
  13764. t['Omegatonos'] = 0x038F;
  13765. t['Omicron'] = 0x039F;
  13766. t['Omicrontonos'] = 0x038C;
  13767. t['Omonospace'] = 0xFF2F;
  13768. t['Oneroman'] = 0x2160;
  13769. t['Oogonek'] = 0x01EA;
  13770. t['Oogonekmacron'] = 0x01EC;
  13771. t['Oopen'] = 0x0186;
  13772. t['Oslash'] = 0x00D8;
  13773. t['Oslashacute'] = 0x01FE;
  13774. t['Oslashsmall'] = 0xF7F8;
  13775. t['Osmall'] = 0xF76F;
  13776. t['Ostrokeacute'] = 0x01FE;
  13777. t['Otcyrillic'] = 0x047E;
  13778. t['Otilde'] = 0x00D5;
  13779. t['Otildeacute'] = 0x1E4C;
  13780. t['Otildedieresis'] = 0x1E4E;
  13781. t['Otildesmall'] = 0xF7F5;
  13782. t['P'] = 0x0050;
  13783. t['Pacute'] = 0x1E54;
  13784. t['Pcircle'] = 0x24C5;
  13785. t['Pdotaccent'] = 0x1E56;
  13786. t['Pecyrillic'] = 0x041F;
  13787. t['Peharmenian'] = 0x054A;
  13788. t['Pemiddlehookcyrillic'] = 0x04A6;
  13789. t['Phi'] = 0x03A6;
  13790. t['Phook'] = 0x01A4;
  13791. t['Pi'] = 0x03A0;
  13792. t['Piwrarmenian'] = 0x0553;
  13793. t['Pmonospace'] = 0xFF30;
  13794. t['Psi'] = 0x03A8;
  13795. t['Psicyrillic'] = 0x0470;
  13796. t['Psmall'] = 0xF770;
  13797. t['Q'] = 0x0051;
  13798. t['Qcircle'] = 0x24C6;
  13799. t['Qmonospace'] = 0xFF31;
  13800. t['Qsmall'] = 0xF771;
  13801. t['R'] = 0x0052;
  13802. t['Raarmenian'] = 0x054C;
  13803. t['Racute'] = 0x0154;
  13804. t['Rcaron'] = 0x0158;
  13805. t['Rcedilla'] = 0x0156;
  13806. t['Rcircle'] = 0x24C7;
  13807. t['Rcommaaccent'] = 0x0156;
  13808. t['Rdblgrave'] = 0x0210;
  13809. t['Rdotaccent'] = 0x1E58;
  13810. t['Rdotbelow'] = 0x1E5A;
  13811. t['Rdotbelowmacron'] = 0x1E5C;
  13812. t['Reharmenian'] = 0x0550;
  13813. t['Rfraktur'] = 0x211C;
  13814. t['Rho'] = 0x03A1;
  13815. t['Ringsmall'] = 0xF6FC;
  13816. t['Rinvertedbreve'] = 0x0212;
  13817. t['Rlinebelow'] = 0x1E5E;
  13818. t['Rmonospace'] = 0xFF32;
  13819. t['Rsmall'] = 0xF772;
  13820. t['Rsmallinverted'] = 0x0281;
  13821. t['Rsmallinvertedsuperior'] = 0x02B6;
  13822. t['S'] = 0x0053;
  13823. t['SF010000'] = 0x250C;
  13824. t['SF020000'] = 0x2514;
  13825. t['SF030000'] = 0x2510;
  13826. t['SF040000'] = 0x2518;
  13827. t['SF050000'] = 0x253C;
  13828. t['SF060000'] = 0x252C;
  13829. t['SF070000'] = 0x2534;
  13830. t['SF080000'] = 0x251C;
  13831. t['SF090000'] = 0x2524;
  13832. t['SF100000'] = 0x2500;
  13833. t['SF110000'] = 0x2502;
  13834. t['SF190000'] = 0x2561;
  13835. t['SF200000'] = 0x2562;
  13836. t['SF210000'] = 0x2556;
  13837. t['SF220000'] = 0x2555;
  13838. t['SF230000'] = 0x2563;
  13839. t['SF240000'] = 0x2551;
  13840. t['SF250000'] = 0x2557;
  13841. t['SF260000'] = 0x255D;
  13842. t['SF270000'] = 0x255C;
  13843. t['SF280000'] = 0x255B;
  13844. t['SF360000'] = 0x255E;
  13845. t['SF370000'] = 0x255F;
  13846. t['SF380000'] = 0x255A;
  13847. t['SF390000'] = 0x2554;
  13848. t['SF400000'] = 0x2569;
  13849. t['SF410000'] = 0x2566;
  13850. t['SF420000'] = 0x2560;
  13851. t['SF430000'] = 0x2550;
  13852. t['SF440000'] = 0x256C;
  13853. t['SF450000'] = 0x2567;
  13854. t['SF460000'] = 0x2568;
  13855. t['SF470000'] = 0x2564;
  13856. t['SF480000'] = 0x2565;
  13857. t['SF490000'] = 0x2559;
  13858. t['SF500000'] = 0x2558;
  13859. t['SF510000'] = 0x2552;
  13860. t['SF520000'] = 0x2553;
  13861. t['SF530000'] = 0x256B;
  13862. t['SF540000'] = 0x256A;
  13863. t['Sacute'] = 0x015A;
  13864. t['Sacutedotaccent'] = 0x1E64;
  13865. t['Sampigreek'] = 0x03E0;
  13866. t['Scaron'] = 0x0160;
  13867. t['Scarondotaccent'] = 0x1E66;
  13868. t['Scaronsmall'] = 0xF6FD;
  13869. t['Scedilla'] = 0x015E;
  13870. t['Schwa'] = 0x018F;
  13871. t['Schwacyrillic'] = 0x04D8;
  13872. t['Schwadieresiscyrillic'] = 0x04DA;
  13873. t['Scircle'] = 0x24C8;
  13874. t['Scircumflex'] = 0x015C;
  13875. t['Scommaaccent'] = 0x0218;
  13876. t['Sdotaccent'] = 0x1E60;
  13877. t['Sdotbelow'] = 0x1E62;
  13878. t['Sdotbelowdotaccent'] = 0x1E68;
  13879. t['Seharmenian'] = 0x054D;
  13880. t['Sevenroman'] = 0x2166;
  13881. t['Shaarmenian'] = 0x0547;
  13882. t['Shacyrillic'] = 0x0428;
  13883. t['Shchacyrillic'] = 0x0429;
  13884. t['Sheicoptic'] = 0x03E2;
  13885. t['Shhacyrillic'] = 0x04BA;
  13886. t['Shimacoptic'] = 0x03EC;
  13887. t['Sigma'] = 0x03A3;
  13888. t['Sixroman'] = 0x2165;
  13889. t['Smonospace'] = 0xFF33;
  13890. t['Softsigncyrillic'] = 0x042C;
  13891. t['Ssmall'] = 0xF773;
  13892. t['Stigmagreek'] = 0x03DA;
  13893. t['T'] = 0x0054;
  13894. t['Tau'] = 0x03A4;
  13895. t['Tbar'] = 0x0166;
  13896. t['Tcaron'] = 0x0164;
  13897. t['Tcedilla'] = 0x0162;
  13898. t['Tcircle'] = 0x24C9;
  13899. t['Tcircumflexbelow'] = 0x1E70;
  13900. t['Tcommaaccent'] = 0x0162;
  13901. t['Tdotaccent'] = 0x1E6A;
  13902. t['Tdotbelow'] = 0x1E6C;
  13903. t['Tecyrillic'] = 0x0422;
  13904. t['Tedescendercyrillic'] = 0x04AC;
  13905. t['Tenroman'] = 0x2169;
  13906. t['Tetsecyrillic'] = 0x04B4;
  13907. t['Theta'] = 0x0398;
  13908. t['Thook'] = 0x01AC;
  13909. t['Thorn'] = 0x00DE;
  13910. t['Thornsmall'] = 0xF7FE;
  13911. t['Threeroman'] = 0x2162;
  13912. t['Tildesmall'] = 0xF6FE;
  13913. t['Tiwnarmenian'] = 0x054F;
  13914. t['Tlinebelow'] = 0x1E6E;
  13915. t['Tmonospace'] = 0xFF34;
  13916. t['Toarmenian'] = 0x0539;
  13917. t['Tonefive'] = 0x01BC;
  13918. t['Tonesix'] = 0x0184;
  13919. t['Tonetwo'] = 0x01A7;
  13920. t['Tretroflexhook'] = 0x01AE;
  13921. t['Tsecyrillic'] = 0x0426;
  13922. t['Tshecyrillic'] = 0x040B;
  13923. t['Tsmall'] = 0xF774;
  13924. t['Twelveroman'] = 0x216B;
  13925. t['Tworoman'] = 0x2161;
  13926. t['U'] = 0x0055;
  13927. t['Uacute'] = 0x00DA;
  13928. t['Uacutesmall'] = 0xF7FA;
  13929. t['Ubreve'] = 0x016C;
  13930. t['Ucaron'] = 0x01D3;
  13931. t['Ucircle'] = 0x24CA;
  13932. t['Ucircumflex'] = 0x00DB;
  13933. t['Ucircumflexbelow'] = 0x1E76;
  13934. t['Ucircumflexsmall'] = 0xF7FB;
  13935. t['Ucyrillic'] = 0x0423;
  13936. t['Udblacute'] = 0x0170;
  13937. t['Udblgrave'] = 0x0214;
  13938. t['Udieresis'] = 0x00DC;
  13939. t['Udieresisacute'] = 0x01D7;
  13940. t['Udieresisbelow'] = 0x1E72;
  13941. t['Udieresiscaron'] = 0x01D9;
  13942. t['Udieresiscyrillic'] = 0x04F0;
  13943. t['Udieresisgrave'] = 0x01DB;
  13944. t['Udieresismacron'] = 0x01D5;
  13945. t['Udieresissmall'] = 0xF7FC;
  13946. t['Udotbelow'] = 0x1EE4;
  13947. t['Ugrave'] = 0x00D9;
  13948. t['Ugravesmall'] = 0xF7F9;
  13949. t['Uhookabove'] = 0x1EE6;
  13950. t['Uhorn'] = 0x01AF;
  13951. t['Uhornacute'] = 0x1EE8;
  13952. t['Uhorndotbelow'] = 0x1EF0;
  13953. t['Uhorngrave'] = 0x1EEA;
  13954. t['Uhornhookabove'] = 0x1EEC;
  13955. t['Uhorntilde'] = 0x1EEE;
  13956. t['Uhungarumlaut'] = 0x0170;
  13957. t['Uhungarumlautcyrillic'] = 0x04F2;
  13958. t['Uinvertedbreve'] = 0x0216;
  13959. t['Ukcyrillic'] = 0x0478;
  13960. t['Umacron'] = 0x016A;
  13961. t['Umacroncyrillic'] = 0x04EE;
  13962. t['Umacrondieresis'] = 0x1E7A;
  13963. t['Umonospace'] = 0xFF35;
  13964. t['Uogonek'] = 0x0172;
  13965. t['Upsilon'] = 0x03A5;
  13966. t['Upsilon1'] = 0x03D2;
  13967. t['Upsilonacutehooksymbolgreek'] = 0x03D3;
  13968. t['Upsilonafrican'] = 0x01B1;
  13969. t['Upsilondieresis'] = 0x03AB;
  13970. t['Upsilondieresishooksymbolgreek'] = 0x03D4;
  13971. t['Upsilonhooksymbol'] = 0x03D2;
  13972. t['Upsilontonos'] = 0x038E;
  13973. t['Uring'] = 0x016E;
  13974. t['Ushortcyrillic'] = 0x040E;
  13975. t['Usmall'] = 0xF775;
  13976. t['Ustraightcyrillic'] = 0x04AE;
  13977. t['Ustraightstrokecyrillic'] = 0x04B0;
  13978. t['Utilde'] = 0x0168;
  13979. t['Utildeacute'] = 0x1E78;
  13980. t['Utildebelow'] = 0x1E74;
  13981. t['V'] = 0x0056;
  13982. t['Vcircle'] = 0x24CB;
  13983. t['Vdotbelow'] = 0x1E7E;
  13984. t['Vecyrillic'] = 0x0412;
  13985. t['Vewarmenian'] = 0x054E;
  13986. t['Vhook'] = 0x01B2;
  13987. t['Vmonospace'] = 0xFF36;
  13988. t['Voarmenian'] = 0x0548;
  13989. t['Vsmall'] = 0xF776;
  13990. t['Vtilde'] = 0x1E7C;
  13991. t['W'] = 0x0057;
  13992. t['Wacute'] = 0x1E82;
  13993. t['Wcircle'] = 0x24CC;
  13994. t['Wcircumflex'] = 0x0174;
  13995. t['Wdieresis'] = 0x1E84;
  13996. t['Wdotaccent'] = 0x1E86;
  13997. t['Wdotbelow'] = 0x1E88;
  13998. t['Wgrave'] = 0x1E80;
  13999. t['Wmonospace'] = 0xFF37;
  14000. t['Wsmall'] = 0xF777;
  14001. t['X'] = 0x0058;
  14002. t['Xcircle'] = 0x24CD;
  14003. t['Xdieresis'] = 0x1E8C;
  14004. t['Xdotaccent'] = 0x1E8A;
  14005. t['Xeharmenian'] = 0x053D;
  14006. t['Xi'] = 0x039E;
  14007. t['Xmonospace'] = 0xFF38;
  14008. t['Xsmall'] = 0xF778;
  14009. t['Y'] = 0x0059;
  14010. t['Yacute'] = 0x00DD;
  14011. t['Yacutesmall'] = 0xF7FD;
  14012. t['Yatcyrillic'] = 0x0462;
  14013. t['Ycircle'] = 0x24CE;
  14014. t['Ycircumflex'] = 0x0176;
  14015. t['Ydieresis'] = 0x0178;
  14016. t['Ydieresissmall'] = 0xF7FF;
  14017. t['Ydotaccent'] = 0x1E8E;
  14018. t['Ydotbelow'] = 0x1EF4;
  14019. t['Yericyrillic'] = 0x042B;
  14020. t['Yerudieresiscyrillic'] = 0x04F8;
  14021. t['Ygrave'] = 0x1EF2;
  14022. t['Yhook'] = 0x01B3;
  14023. t['Yhookabove'] = 0x1EF6;
  14024. t['Yiarmenian'] = 0x0545;
  14025. t['Yicyrillic'] = 0x0407;
  14026. t['Yiwnarmenian'] = 0x0552;
  14027. t['Ymonospace'] = 0xFF39;
  14028. t['Ysmall'] = 0xF779;
  14029. t['Ytilde'] = 0x1EF8;
  14030. t['Yusbigcyrillic'] = 0x046A;
  14031. t['Yusbigiotifiedcyrillic'] = 0x046C;
  14032. t['Yuslittlecyrillic'] = 0x0466;
  14033. t['Yuslittleiotifiedcyrillic'] = 0x0468;
  14034. t['Z'] = 0x005A;
  14035. t['Zaarmenian'] = 0x0536;
  14036. t['Zacute'] = 0x0179;
  14037. t['Zcaron'] = 0x017D;
  14038. t['Zcaronsmall'] = 0xF6FF;
  14039. t['Zcircle'] = 0x24CF;
  14040. t['Zcircumflex'] = 0x1E90;
  14041. t['Zdot'] = 0x017B;
  14042. t['Zdotaccent'] = 0x017B;
  14043. t['Zdotbelow'] = 0x1E92;
  14044. t['Zecyrillic'] = 0x0417;
  14045. t['Zedescendercyrillic'] = 0x0498;
  14046. t['Zedieresiscyrillic'] = 0x04DE;
  14047. t['Zeta'] = 0x0396;
  14048. t['Zhearmenian'] = 0x053A;
  14049. t['Zhebrevecyrillic'] = 0x04C1;
  14050. t['Zhecyrillic'] = 0x0416;
  14051. t['Zhedescendercyrillic'] = 0x0496;
  14052. t['Zhedieresiscyrillic'] = 0x04DC;
  14053. t['Zlinebelow'] = 0x1E94;
  14054. t['Zmonospace'] = 0xFF3A;
  14055. t['Zsmall'] = 0xF77A;
  14056. t['Zstroke'] = 0x01B5;
  14057. t['a'] = 0x0061;
  14058. t['aabengali'] = 0x0986;
  14059. t['aacute'] = 0x00E1;
  14060. t['aadeva'] = 0x0906;
  14061. t['aagujarati'] = 0x0A86;
  14062. t['aagurmukhi'] = 0x0A06;
  14063. t['aamatragurmukhi'] = 0x0A3E;
  14064. t['aarusquare'] = 0x3303;
  14065. t['aavowelsignbengali'] = 0x09BE;
  14066. t['aavowelsigndeva'] = 0x093E;
  14067. t['aavowelsigngujarati'] = 0x0ABE;
  14068. t['abbreviationmarkarmenian'] = 0x055F;
  14069. t['abbreviationsigndeva'] = 0x0970;
  14070. t['abengali'] = 0x0985;
  14071. t['abopomofo'] = 0x311A;
  14072. t['abreve'] = 0x0103;
  14073. t['abreveacute'] = 0x1EAF;
  14074. t['abrevecyrillic'] = 0x04D1;
  14075. t['abrevedotbelow'] = 0x1EB7;
  14076. t['abrevegrave'] = 0x1EB1;
  14077. t['abrevehookabove'] = 0x1EB3;
  14078. t['abrevetilde'] = 0x1EB5;
  14079. t['acaron'] = 0x01CE;
  14080. t['acircle'] = 0x24D0;
  14081. t['acircumflex'] = 0x00E2;
  14082. t['acircumflexacute'] = 0x1EA5;
  14083. t['acircumflexdotbelow'] = 0x1EAD;
  14084. t['acircumflexgrave'] = 0x1EA7;
  14085. t['acircumflexhookabove'] = 0x1EA9;
  14086. t['acircumflextilde'] = 0x1EAB;
  14087. t['acute'] = 0x00B4;
  14088. t['acutebelowcmb'] = 0x0317;
  14089. t['acutecmb'] = 0x0301;
  14090. t['acutecomb'] = 0x0301;
  14091. t['acutedeva'] = 0x0954;
  14092. t['acutelowmod'] = 0x02CF;
  14093. t['acutetonecmb'] = 0x0341;
  14094. t['acyrillic'] = 0x0430;
  14095. t['adblgrave'] = 0x0201;
  14096. t['addakgurmukhi'] = 0x0A71;
  14097. t['adeva'] = 0x0905;
  14098. t['adieresis'] = 0x00E4;
  14099. t['adieresiscyrillic'] = 0x04D3;
  14100. t['adieresismacron'] = 0x01DF;
  14101. t['adotbelow'] = 0x1EA1;
  14102. t['adotmacron'] = 0x01E1;
  14103. t['ae'] = 0x00E6;
  14104. t['aeacute'] = 0x01FD;
  14105. t['aekorean'] = 0x3150;
  14106. t['aemacron'] = 0x01E3;
  14107. t['afii00208'] = 0x2015;
  14108. t['afii08941'] = 0x20A4;
  14109. t['afii10017'] = 0x0410;
  14110. t['afii10018'] = 0x0411;
  14111. t['afii10019'] = 0x0412;
  14112. t['afii10020'] = 0x0413;
  14113. t['afii10021'] = 0x0414;
  14114. t['afii10022'] = 0x0415;
  14115. t['afii10023'] = 0x0401;
  14116. t['afii10024'] = 0x0416;
  14117. t['afii10025'] = 0x0417;
  14118. t['afii10026'] = 0x0418;
  14119. t['afii10027'] = 0x0419;
  14120. t['afii10028'] = 0x041A;
  14121. t['afii10029'] = 0x041B;
  14122. t['afii10030'] = 0x041C;
  14123. t['afii10031'] = 0x041D;
  14124. t['afii10032'] = 0x041E;
  14125. t['afii10033'] = 0x041F;
  14126. t['afii10034'] = 0x0420;
  14127. t['afii10035'] = 0x0421;
  14128. t['afii10036'] = 0x0422;
  14129. t['afii10037'] = 0x0423;
  14130. t['afii10038'] = 0x0424;
  14131. t['afii10039'] = 0x0425;
  14132. t['afii10040'] = 0x0426;
  14133. t['afii10041'] = 0x0427;
  14134. t['afii10042'] = 0x0428;
  14135. t['afii10043'] = 0x0429;
  14136. t['afii10044'] = 0x042A;
  14137. t['afii10045'] = 0x042B;
  14138. t['afii10046'] = 0x042C;
  14139. t['afii10047'] = 0x042D;
  14140. t['afii10048'] = 0x042E;
  14141. t['afii10049'] = 0x042F;
  14142. t['afii10050'] = 0x0490;
  14143. t['afii10051'] = 0x0402;
  14144. t['afii10052'] = 0x0403;
  14145. t['afii10053'] = 0x0404;
  14146. t['afii10054'] = 0x0405;
  14147. t['afii10055'] = 0x0406;
  14148. t['afii10056'] = 0x0407;
  14149. t['afii10057'] = 0x0408;
  14150. t['afii10058'] = 0x0409;
  14151. t['afii10059'] = 0x040A;
  14152. t['afii10060'] = 0x040B;
  14153. t['afii10061'] = 0x040C;
  14154. t['afii10062'] = 0x040E;
  14155. t['afii10063'] = 0xF6C4;
  14156. t['afii10064'] = 0xF6C5;
  14157. t['afii10065'] = 0x0430;
  14158. t['afii10066'] = 0x0431;
  14159. t['afii10067'] = 0x0432;
  14160. t['afii10068'] = 0x0433;
  14161. t['afii10069'] = 0x0434;
  14162. t['afii10070'] = 0x0435;
  14163. t['afii10071'] = 0x0451;
  14164. t['afii10072'] = 0x0436;
  14165. t['afii10073'] = 0x0437;
  14166. t['afii10074'] = 0x0438;
  14167. t['afii10075'] = 0x0439;
  14168. t['afii10076'] = 0x043A;
  14169. t['afii10077'] = 0x043B;
  14170. t['afii10078'] = 0x043C;
  14171. t['afii10079'] = 0x043D;
  14172. t['afii10080'] = 0x043E;
  14173. t['afii10081'] = 0x043F;
  14174. t['afii10082'] = 0x0440;
  14175. t['afii10083'] = 0x0441;
  14176. t['afii10084'] = 0x0442;
  14177. t['afii10085'] = 0x0443;
  14178. t['afii10086'] = 0x0444;
  14179. t['afii10087'] = 0x0445;
  14180. t['afii10088'] = 0x0446;
  14181. t['afii10089'] = 0x0447;
  14182. t['afii10090'] = 0x0448;
  14183. t['afii10091'] = 0x0449;
  14184. t['afii10092'] = 0x044A;
  14185. t['afii10093'] = 0x044B;
  14186. t['afii10094'] = 0x044C;
  14187. t['afii10095'] = 0x044D;
  14188. t['afii10096'] = 0x044E;
  14189. t['afii10097'] = 0x044F;
  14190. t['afii10098'] = 0x0491;
  14191. t['afii10099'] = 0x0452;
  14192. t['afii10100'] = 0x0453;
  14193. t['afii10101'] = 0x0454;
  14194. t['afii10102'] = 0x0455;
  14195. t['afii10103'] = 0x0456;
  14196. t['afii10104'] = 0x0457;
  14197. t['afii10105'] = 0x0458;
  14198. t['afii10106'] = 0x0459;
  14199. t['afii10107'] = 0x045A;
  14200. t['afii10108'] = 0x045B;
  14201. t['afii10109'] = 0x045C;
  14202. t['afii10110'] = 0x045E;
  14203. t['afii10145'] = 0x040F;
  14204. t['afii10146'] = 0x0462;
  14205. t['afii10147'] = 0x0472;
  14206. t['afii10148'] = 0x0474;
  14207. t['afii10192'] = 0xF6C6;
  14208. t['afii10193'] = 0x045F;
  14209. t['afii10194'] = 0x0463;
  14210. t['afii10195'] = 0x0473;
  14211. t['afii10196'] = 0x0475;
  14212. t['afii10831'] = 0xF6C7;
  14213. t['afii10832'] = 0xF6C8;
  14214. t['afii10846'] = 0x04D9;
  14215. t['afii299'] = 0x200E;
  14216. t['afii300'] = 0x200F;
  14217. t['afii301'] = 0x200D;
  14218. t['afii57381'] = 0x066A;
  14219. t['afii57388'] = 0x060C;
  14220. t['afii57392'] = 0x0660;
  14221. t['afii57393'] = 0x0661;
  14222. t['afii57394'] = 0x0662;
  14223. t['afii57395'] = 0x0663;
  14224. t['afii57396'] = 0x0664;
  14225. t['afii57397'] = 0x0665;
  14226. t['afii57398'] = 0x0666;
  14227. t['afii57399'] = 0x0667;
  14228. t['afii57400'] = 0x0668;
  14229. t['afii57401'] = 0x0669;
  14230. t['afii57403'] = 0x061B;
  14231. t['afii57407'] = 0x061F;
  14232. t['afii57409'] = 0x0621;
  14233. t['afii57410'] = 0x0622;
  14234. t['afii57411'] = 0x0623;
  14235. t['afii57412'] = 0x0624;
  14236. t['afii57413'] = 0x0625;
  14237. t['afii57414'] = 0x0626;
  14238. t['afii57415'] = 0x0627;
  14239. t['afii57416'] = 0x0628;
  14240. t['afii57417'] = 0x0629;
  14241. t['afii57418'] = 0x062A;
  14242. t['afii57419'] = 0x062B;
  14243. t['afii57420'] = 0x062C;
  14244. t['afii57421'] = 0x062D;
  14245. t['afii57422'] = 0x062E;
  14246. t['afii57423'] = 0x062F;
  14247. t['afii57424'] = 0x0630;
  14248. t['afii57425'] = 0x0631;
  14249. t['afii57426'] = 0x0632;
  14250. t['afii57427'] = 0x0633;
  14251. t['afii57428'] = 0x0634;
  14252. t['afii57429'] = 0x0635;
  14253. t['afii57430'] = 0x0636;
  14254. t['afii57431'] = 0x0637;
  14255. t['afii57432'] = 0x0638;
  14256. t['afii57433'] = 0x0639;
  14257. t['afii57434'] = 0x063A;
  14258. t['afii57440'] = 0x0640;
  14259. t['afii57441'] = 0x0641;
  14260. t['afii57442'] = 0x0642;
  14261. t['afii57443'] = 0x0643;
  14262. t['afii57444'] = 0x0644;
  14263. t['afii57445'] = 0x0645;
  14264. t['afii57446'] = 0x0646;
  14265. t['afii57448'] = 0x0648;
  14266. t['afii57449'] = 0x0649;
  14267. t['afii57450'] = 0x064A;
  14268. t['afii57451'] = 0x064B;
  14269. t['afii57452'] = 0x064C;
  14270. t['afii57453'] = 0x064D;
  14271. t['afii57454'] = 0x064E;
  14272. t['afii57455'] = 0x064F;
  14273. t['afii57456'] = 0x0650;
  14274. t['afii57457'] = 0x0651;
  14275. t['afii57458'] = 0x0652;
  14276. t['afii57470'] = 0x0647;
  14277. t['afii57505'] = 0x06A4;
  14278. t['afii57506'] = 0x067E;
  14279. t['afii57507'] = 0x0686;
  14280. t['afii57508'] = 0x0698;
  14281. t['afii57509'] = 0x06AF;
  14282. t['afii57511'] = 0x0679;
  14283. t['afii57512'] = 0x0688;
  14284. t['afii57513'] = 0x0691;
  14285. t['afii57514'] = 0x06BA;
  14286. t['afii57519'] = 0x06D2;
  14287. t['afii57534'] = 0x06D5;
  14288. t['afii57636'] = 0x20AA;
  14289. t['afii57645'] = 0x05BE;
  14290. t['afii57658'] = 0x05C3;
  14291. t['afii57664'] = 0x05D0;
  14292. t['afii57665'] = 0x05D1;
  14293. t['afii57666'] = 0x05D2;
  14294. t['afii57667'] = 0x05D3;
  14295. t['afii57668'] = 0x05D4;
  14296. t['afii57669'] = 0x05D5;
  14297. t['afii57670'] = 0x05D6;
  14298. t['afii57671'] = 0x05D7;
  14299. t['afii57672'] = 0x05D8;
  14300. t['afii57673'] = 0x05D9;
  14301. t['afii57674'] = 0x05DA;
  14302. t['afii57675'] = 0x05DB;
  14303. t['afii57676'] = 0x05DC;
  14304. t['afii57677'] = 0x05DD;
  14305. t['afii57678'] = 0x05DE;
  14306. t['afii57679'] = 0x05DF;
  14307. t['afii57680'] = 0x05E0;
  14308. t['afii57681'] = 0x05E1;
  14309. t['afii57682'] = 0x05E2;
  14310. t['afii57683'] = 0x05E3;
  14311. t['afii57684'] = 0x05E4;
  14312. t['afii57685'] = 0x05E5;
  14313. t['afii57686'] = 0x05E6;
  14314. t['afii57687'] = 0x05E7;
  14315. t['afii57688'] = 0x05E8;
  14316. t['afii57689'] = 0x05E9;
  14317. t['afii57690'] = 0x05EA;
  14318. t['afii57694'] = 0xFB2A;
  14319. t['afii57695'] = 0xFB2B;
  14320. t['afii57700'] = 0xFB4B;
  14321. t['afii57705'] = 0xFB1F;
  14322. t['afii57716'] = 0x05F0;
  14323. t['afii57717'] = 0x05F1;
  14324. t['afii57718'] = 0x05F2;
  14325. t['afii57723'] = 0xFB35;
  14326. t['afii57793'] = 0x05B4;
  14327. t['afii57794'] = 0x05B5;
  14328. t['afii57795'] = 0x05B6;
  14329. t['afii57796'] = 0x05BB;
  14330. t['afii57797'] = 0x05B8;
  14331. t['afii57798'] = 0x05B7;
  14332. t['afii57799'] = 0x05B0;
  14333. t['afii57800'] = 0x05B2;
  14334. t['afii57801'] = 0x05B1;
  14335. t['afii57802'] = 0x05B3;
  14336. t['afii57803'] = 0x05C2;
  14337. t['afii57804'] = 0x05C1;
  14338. t['afii57806'] = 0x05B9;
  14339. t['afii57807'] = 0x05BC;
  14340. t['afii57839'] = 0x05BD;
  14341. t['afii57841'] = 0x05BF;
  14342. t['afii57842'] = 0x05C0;
  14343. t['afii57929'] = 0x02BC;
  14344. t['afii61248'] = 0x2105;
  14345. t['afii61289'] = 0x2113;
  14346. t['afii61352'] = 0x2116;
  14347. t['afii61573'] = 0x202C;
  14348. t['afii61574'] = 0x202D;
  14349. t['afii61575'] = 0x202E;
  14350. t['afii61664'] = 0x200C;
  14351. t['afii63167'] = 0x066D;
  14352. t['afii64937'] = 0x02BD;
  14353. t['agrave'] = 0x00E0;
  14354. t['agujarati'] = 0x0A85;
  14355. t['agurmukhi'] = 0x0A05;
  14356. t['ahiragana'] = 0x3042;
  14357. t['ahookabove'] = 0x1EA3;
  14358. t['aibengali'] = 0x0990;
  14359. t['aibopomofo'] = 0x311E;
  14360. t['aideva'] = 0x0910;
  14361. t['aiecyrillic'] = 0x04D5;
  14362. t['aigujarati'] = 0x0A90;
  14363. t['aigurmukhi'] = 0x0A10;
  14364. t['aimatragurmukhi'] = 0x0A48;
  14365. t['ainarabic'] = 0x0639;
  14366. t['ainfinalarabic'] = 0xFECA;
  14367. t['aininitialarabic'] = 0xFECB;
  14368. t['ainmedialarabic'] = 0xFECC;
  14369. t['ainvertedbreve'] = 0x0203;
  14370. t['aivowelsignbengali'] = 0x09C8;
  14371. t['aivowelsigndeva'] = 0x0948;
  14372. t['aivowelsigngujarati'] = 0x0AC8;
  14373. t['akatakana'] = 0x30A2;
  14374. t['akatakanahalfwidth'] = 0xFF71;
  14375. t['akorean'] = 0x314F;
  14376. t['alef'] = 0x05D0;
  14377. t['alefarabic'] = 0x0627;
  14378. t['alefdageshhebrew'] = 0xFB30;
  14379. t['aleffinalarabic'] = 0xFE8E;
  14380. t['alefhamzaabovearabic'] = 0x0623;
  14381. t['alefhamzaabovefinalarabic'] = 0xFE84;
  14382. t['alefhamzabelowarabic'] = 0x0625;
  14383. t['alefhamzabelowfinalarabic'] = 0xFE88;
  14384. t['alefhebrew'] = 0x05D0;
  14385. t['aleflamedhebrew'] = 0xFB4F;
  14386. t['alefmaddaabovearabic'] = 0x0622;
  14387. t['alefmaddaabovefinalarabic'] = 0xFE82;
  14388. t['alefmaksuraarabic'] = 0x0649;
  14389. t['alefmaksurafinalarabic'] = 0xFEF0;
  14390. t['alefmaksurainitialarabic'] = 0xFEF3;
  14391. t['alefmaksuramedialarabic'] = 0xFEF4;
  14392. t['alefpatahhebrew'] = 0xFB2E;
  14393. t['alefqamatshebrew'] = 0xFB2F;
  14394. t['aleph'] = 0x2135;
  14395. t['allequal'] = 0x224C;
  14396. t['alpha'] = 0x03B1;
  14397. t['alphatonos'] = 0x03AC;
  14398. t['amacron'] = 0x0101;
  14399. t['amonospace'] = 0xFF41;
  14400. t['ampersand'] = 0x0026;
  14401. t['ampersandmonospace'] = 0xFF06;
  14402. t['ampersandsmall'] = 0xF726;
  14403. t['amsquare'] = 0x33C2;
  14404. t['anbopomofo'] = 0x3122;
  14405. t['angbopomofo'] = 0x3124;
  14406. t['angbracketleft'] = 0x3008;
  14407. t['angbracketright'] = 0x3009;
  14408. t['angkhankhuthai'] = 0x0E5A;
  14409. t['angle'] = 0x2220;
  14410. t['anglebracketleft'] = 0x3008;
  14411. t['anglebracketleftvertical'] = 0xFE3F;
  14412. t['anglebracketright'] = 0x3009;
  14413. t['anglebracketrightvertical'] = 0xFE40;
  14414. t['angleleft'] = 0x2329;
  14415. t['angleright'] = 0x232A;
  14416. t['angstrom'] = 0x212B;
  14417. t['anoteleia'] = 0x0387;
  14418. t['anudattadeva'] = 0x0952;
  14419. t['anusvarabengali'] = 0x0982;
  14420. t['anusvaradeva'] = 0x0902;
  14421. t['anusvaragujarati'] = 0x0A82;
  14422. t['aogonek'] = 0x0105;
  14423. t['apaatosquare'] = 0x3300;
  14424. t['aparen'] = 0x249C;
  14425. t['apostrophearmenian'] = 0x055A;
  14426. t['apostrophemod'] = 0x02BC;
  14427. t['apple'] = 0xF8FF;
  14428. t['approaches'] = 0x2250;
  14429. t['approxequal'] = 0x2248;
  14430. t['approxequalorimage'] = 0x2252;
  14431. t['approximatelyequal'] = 0x2245;
  14432. t['araeaekorean'] = 0x318E;
  14433. t['araeakorean'] = 0x318D;
  14434. t['arc'] = 0x2312;
  14435. t['arighthalfring'] = 0x1E9A;
  14436. t['aring'] = 0x00E5;
  14437. t['aringacute'] = 0x01FB;
  14438. t['aringbelow'] = 0x1E01;
  14439. t['arrowboth'] = 0x2194;
  14440. t['arrowdashdown'] = 0x21E3;
  14441. t['arrowdashleft'] = 0x21E0;
  14442. t['arrowdashright'] = 0x21E2;
  14443. t['arrowdashup'] = 0x21E1;
  14444. t['arrowdblboth'] = 0x21D4;
  14445. t['arrowdbldown'] = 0x21D3;
  14446. t['arrowdblleft'] = 0x21D0;
  14447. t['arrowdblright'] = 0x21D2;
  14448. t['arrowdblup'] = 0x21D1;
  14449. t['arrowdown'] = 0x2193;
  14450. t['arrowdownleft'] = 0x2199;
  14451. t['arrowdownright'] = 0x2198;
  14452. t['arrowdownwhite'] = 0x21E9;
  14453. t['arrowheaddownmod'] = 0x02C5;
  14454. t['arrowheadleftmod'] = 0x02C2;
  14455. t['arrowheadrightmod'] = 0x02C3;
  14456. t['arrowheadupmod'] = 0x02C4;
  14457. t['arrowhorizex'] = 0xF8E7;
  14458. t['arrowleft'] = 0x2190;
  14459. t['arrowleftdbl'] = 0x21D0;
  14460. t['arrowleftdblstroke'] = 0x21CD;
  14461. t['arrowleftoverright'] = 0x21C6;
  14462. t['arrowleftwhite'] = 0x21E6;
  14463. t['arrowright'] = 0x2192;
  14464. t['arrowrightdblstroke'] = 0x21CF;
  14465. t['arrowrightheavy'] = 0x279E;
  14466. t['arrowrightoverleft'] = 0x21C4;
  14467. t['arrowrightwhite'] = 0x21E8;
  14468. t['arrowtableft'] = 0x21E4;
  14469. t['arrowtabright'] = 0x21E5;
  14470. t['arrowup'] = 0x2191;
  14471. t['arrowupdn'] = 0x2195;
  14472. t['arrowupdnbse'] = 0x21A8;
  14473. t['arrowupdownbase'] = 0x21A8;
  14474. t['arrowupleft'] = 0x2196;
  14475. t['arrowupleftofdown'] = 0x21C5;
  14476. t['arrowupright'] = 0x2197;
  14477. t['arrowupwhite'] = 0x21E7;
  14478. t['arrowvertex'] = 0xF8E6;
  14479. t['asciicircum'] = 0x005E;
  14480. t['asciicircummonospace'] = 0xFF3E;
  14481. t['asciitilde'] = 0x007E;
  14482. t['asciitildemonospace'] = 0xFF5E;
  14483. t['ascript'] = 0x0251;
  14484. t['ascriptturned'] = 0x0252;
  14485. t['asmallhiragana'] = 0x3041;
  14486. t['asmallkatakana'] = 0x30A1;
  14487. t['asmallkatakanahalfwidth'] = 0xFF67;
  14488. t['asterisk'] = 0x002A;
  14489. t['asteriskaltonearabic'] = 0x066D;
  14490. t['asteriskarabic'] = 0x066D;
  14491. t['asteriskmath'] = 0x2217;
  14492. t['asteriskmonospace'] = 0xFF0A;
  14493. t['asterisksmall'] = 0xFE61;
  14494. t['asterism'] = 0x2042;
  14495. t['asuperior'] = 0xF6E9;
  14496. t['asymptoticallyequal'] = 0x2243;
  14497. t['at'] = 0x0040;
  14498. t['atilde'] = 0x00E3;
  14499. t['atmonospace'] = 0xFF20;
  14500. t['atsmall'] = 0xFE6B;
  14501. t['aturned'] = 0x0250;
  14502. t['aubengali'] = 0x0994;
  14503. t['aubopomofo'] = 0x3120;
  14504. t['audeva'] = 0x0914;
  14505. t['augujarati'] = 0x0A94;
  14506. t['augurmukhi'] = 0x0A14;
  14507. t['aulengthmarkbengali'] = 0x09D7;
  14508. t['aumatragurmukhi'] = 0x0A4C;
  14509. t['auvowelsignbengali'] = 0x09CC;
  14510. t['auvowelsigndeva'] = 0x094C;
  14511. t['auvowelsigngujarati'] = 0x0ACC;
  14512. t['avagrahadeva'] = 0x093D;
  14513. t['aybarmenian'] = 0x0561;
  14514. t['ayin'] = 0x05E2;
  14515. t['ayinaltonehebrew'] = 0xFB20;
  14516. t['ayinhebrew'] = 0x05E2;
  14517. t['b'] = 0x0062;
  14518. t['babengali'] = 0x09AC;
  14519. t['backslash'] = 0x005C;
  14520. t['backslashmonospace'] = 0xFF3C;
  14521. t['badeva'] = 0x092C;
  14522. t['bagujarati'] = 0x0AAC;
  14523. t['bagurmukhi'] = 0x0A2C;
  14524. t['bahiragana'] = 0x3070;
  14525. t['bahtthai'] = 0x0E3F;
  14526. t['bakatakana'] = 0x30D0;
  14527. t['bar'] = 0x007C;
  14528. t['barmonospace'] = 0xFF5C;
  14529. t['bbopomofo'] = 0x3105;
  14530. t['bcircle'] = 0x24D1;
  14531. t['bdotaccent'] = 0x1E03;
  14532. t['bdotbelow'] = 0x1E05;
  14533. t['beamedsixteenthnotes'] = 0x266C;
  14534. t['because'] = 0x2235;
  14535. t['becyrillic'] = 0x0431;
  14536. t['beharabic'] = 0x0628;
  14537. t['behfinalarabic'] = 0xFE90;
  14538. t['behinitialarabic'] = 0xFE91;
  14539. t['behiragana'] = 0x3079;
  14540. t['behmedialarabic'] = 0xFE92;
  14541. t['behmeeminitialarabic'] = 0xFC9F;
  14542. t['behmeemisolatedarabic'] = 0xFC08;
  14543. t['behnoonfinalarabic'] = 0xFC6D;
  14544. t['bekatakana'] = 0x30D9;
  14545. t['benarmenian'] = 0x0562;
  14546. t['bet'] = 0x05D1;
  14547. t['beta'] = 0x03B2;
  14548. t['betasymbolgreek'] = 0x03D0;
  14549. t['betdagesh'] = 0xFB31;
  14550. t['betdageshhebrew'] = 0xFB31;
  14551. t['bethebrew'] = 0x05D1;
  14552. t['betrafehebrew'] = 0xFB4C;
  14553. t['bhabengali'] = 0x09AD;
  14554. t['bhadeva'] = 0x092D;
  14555. t['bhagujarati'] = 0x0AAD;
  14556. t['bhagurmukhi'] = 0x0A2D;
  14557. t['bhook'] = 0x0253;
  14558. t['bihiragana'] = 0x3073;
  14559. t['bikatakana'] = 0x30D3;
  14560. t['bilabialclick'] = 0x0298;
  14561. t['bindigurmukhi'] = 0x0A02;
  14562. t['birusquare'] = 0x3331;
  14563. t['blackcircle'] = 0x25CF;
  14564. t['blackdiamond'] = 0x25C6;
  14565. t['blackdownpointingtriangle'] = 0x25BC;
  14566. t['blackleftpointingpointer'] = 0x25C4;
  14567. t['blackleftpointingtriangle'] = 0x25C0;
  14568. t['blacklenticularbracketleft'] = 0x3010;
  14569. t['blacklenticularbracketleftvertical'] = 0xFE3B;
  14570. t['blacklenticularbracketright'] = 0x3011;
  14571. t['blacklenticularbracketrightvertical'] = 0xFE3C;
  14572. t['blacklowerlefttriangle'] = 0x25E3;
  14573. t['blacklowerrighttriangle'] = 0x25E2;
  14574. t['blackrectangle'] = 0x25AC;
  14575. t['blackrightpointingpointer'] = 0x25BA;
  14576. t['blackrightpointingtriangle'] = 0x25B6;
  14577. t['blacksmallsquare'] = 0x25AA;
  14578. t['blacksmilingface'] = 0x263B;
  14579. t['blacksquare'] = 0x25A0;
  14580. t['blackstar'] = 0x2605;
  14581. t['blackupperlefttriangle'] = 0x25E4;
  14582. t['blackupperrighttriangle'] = 0x25E5;
  14583. t['blackuppointingsmalltriangle'] = 0x25B4;
  14584. t['blackuppointingtriangle'] = 0x25B2;
  14585. t['blank'] = 0x2423;
  14586. t['blinebelow'] = 0x1E07;
  14587. t['block'] = 0x2588;
  14588. t['bmonospace'] = 0xFF42;
  14589. t['bobaimaithai'] = 0x0E1A;
  14590. t['bohiragana'] = 0x307C;
  14591. t['bokatakana'] = 0x30DC;
  14592. t['bparen'] = 0x249D;
  14593. t['bqsquare'] = 0x33C3;
  14594. t['braceex'] = 0xF8F4;
  14595. t['braceleft'] = 0x007B;
  14596. t['braceleftbt'] = 0xF8F3;
  14597. t['braceleftmid'] = 0xF8F2;
  14598. t['braceleftmonospace'] = 0xFF5B;
  14599. t['braceleftsmall'] = 0xFE5B;
  14600. t['bracelefttp'] = 0xF8F1;
  14601. t['braceleftvertical'] = 0xFE37;
  14602. t['braceright'] = 0x007D;
  14603. t['bracerightbt'] = 0xF8FE;
  14604. t['bracerightmid'] = 0xF8FD;
  14605. t['bracerightmonospace'] = 0xFF5D;
  14606. t['bracerightsmall'] = 0xFE5C;
  14607. t['bracerighttp'] = 0xF8FC;
  14608. t['bracerightvertical'] = 0xFE38;
  14609. t['bracketleft'] = 0x005B;
  14610. t['bracketleftbt'] = 0xF8F0;
  14611. t['bracketleftex'] = 0xF8EF;
  14612. t['bracketleftmonospace'] = 0xFF3B;
  14613. t['bracketlefttp'] = 0xF8EE;
  14614. t['bracketright'] = 0x005D;
  14615. t['bracketrightbt'] = 0xF8FB;
  14616. t['bracketrightex'] = 0xF8FA;
  14617. t['bracketrightmonospace'] = 0xFF3D;
  14618. t['bracketrighttp'] = 0xF8F9;
  14619. t['breve'] = 0x02D8;
  14620. t['brevebelowcmb'] = 0x032E;
  14621. t['brevecmb'] = 0x0306;
  14622. t['breveinvertedbelowcmb'] = 0x032F;
  14623. t['breveinvertedcmb'] = 0x0311;
  14624. t['breveinverteddoublecmb'] = 0x0361;
  14625. t['bridgebelowcmb'] = 0x032A;
  14626. t['bridgeinvertedbelowcmb'] = 0x033A;
  14627. t['brokenbar'] = 0x00A6;
  14628. t['bstroke'] = 0x0180;
  14629. t['bsuperior'] = 0xF6EA;
  14630. t['btopbar'] = 0x0183;
  14631. t['buhiragana'] = 0x3076;
  14632. t['bukatakana'] = 0x30D6;
  14633. t['bullet'] = 0x2022;
  14634. t['bulletinverse'] = 0x25D8;
  14635. t['bulletoperator'] = 0x2219;
  14636. t['bullseye'] = 0x25CE;
  14637. t['c'] = 0x0063;
  14638. t['caarmenian'] = 0x056E;
  14639. t['cabengali'] = 0x099A;
  14640. t['cacute'] = 0x0107;
  14641. t['cadeva'] = 0x091A;
  14642. t['cagujarati'] = 0x0A9A;
  14643. t['cagurmukhi'] = 0x0A1A;
  14644. t['calsquare'] = 0x3388;
  14645. t['candrabindubengali'] = 0x0981;
  14646. t['candrabinducmb'] = 0x0310;
  14647. t['candrabindudeva'] = 0x0901;
  14648. t['candrabindugujarati'] = 0x0A81;
  14649. t['capslock'] = 0x21EA;
  14650. t['careof'] = 0x2105;
  14651. t['caron'] = 0x02C7;
  14652. t['caronbelowcmb'] = 0x032C;
  14653. t['caroncmb'] = 0x030C;
  14654. t['carriagereturn'] = 0x21B5;
  14655. t['cbopomofo'] = 0x3118;
  14656. t['ccaron'] = 0x010D;
  14657. t['ccedilla'] = 0x00E7;
  14658. t['ccedillaacute'] = 0x1E09;
  14659. t['ccircle'] = 0x24D2;
  14660. t['ccircumflex'] = 0x0109;
  14661. t['ccurl'] = 0x0255;
  14662. t['cdot'] = 0x010B;
  14663. t['cdotaccent'] = 0x010B;
  14664. t['cdsquare'] = 0x33C5;
  14665. t['cedilla'] = 0x00B8;
  14666. t['cedillacmb'] = 0x0327;
  14667. t['cent'] = 0x00A2;
  14668. t['centigrade'] = 0x2103;
  14669. t['centinferior'] = 0xF6DF;
  14670. t['centmonospace'] = 0xFFE0;
  14671. t['centoldstyle'] = 0xF7A2;
  14672. t['centsuperior'] = 0xF6E0;
  14673. t['chaarmenian'] = 0x0579;
  14674. t['chabengali'] = 0x099B;
  14675. t['chadeva'] = 0x091B;
  14676. t['chagujarati'] = 0x0A9B;
  14677. t['chagurmukhi'] = 0x0A1B;
  14678. t['chbopomofo'] = 0x3114;
  14679. t['cheabkhasiancyrillic'] = 0x04BD;
  14680. t['checkmark'] = 0x2713;
  14681. t['checyrillic'] = 0x0447;
  14682. t['chedescenderabkhasiancyrillic'] = 0x04BF;
  14683. t['chedescendercyrillic'] = 0x04B7;
  14684. t['chedieresiscyrillic'] = 0x04F5;
  14685. t['cheharmenian'] = 0x0573;
  14686. t['chekhakassiancyrillic'] = 0x04CC;
  14687. t['cheverticalstrokecyrillic'] = 0x04B9;
  14688. t['chi'] = 0x03C7;
  14689. t['chieuchacirclekorean'] = 0x3277;
  14690. t['chieuchaparenkorean'] = 0x3217;
  14691. t['chieuchcirclekorean'] = 0x3269;
  14692. t['chieuchkorean'] = 0x314A;
  14693. t['chieuchparenkorean'] = 0x3209;
  14694. t['chochangthai'] = 0x0E0A;
  14695. t['chochanthai'] = 0x0E08;
  14696. t['chochingthai'] = 0x0E09;
  14697. t['chochoethai'] = 0x0E0C;
  14698. t['chook'] = 0x0188;
  14699. t['cieucacirclekorean'] = 0x3276;
  14700. t['cieucaparenkorean'] = 0x3216;
  14701. t['cieuccirclekorean'] = 0x3268;
  14702. t['cieuckorean'] = 0x3148;
  14703. t['cieucparenkorean'] = 0x3208;
  14704. t['cieucuparenkorean'] = 0x321C;
  14705. t['circle'] = 0x25CB;
  14706. t['circlecopyrt'] = 0x00A9;
  14707. t['circlemultiply'] = 0x2297;
  14708. t['circleot'] = 0x2299;
  14709. t['circleplus'] = 0x2295;
  14710. t['circlepostalmark'] = 0x3036;
  14711. t['circlewithlefthalfblack'] = 0x25D0;
  14712. t['circlewithrighthalfblack'] = 0x25D1;
  14713. t['circumflex'] = 0x02C6;
  14714. t['circumflexbelowcmb'] = 0x032D;
  14715. t['circumflexcmb'] = 0x0302;
  14716. t['clear'] = 0x2327;
  14717. t['clickalveolar'] = 0x01C2;
  14718. t['clickdental'] = 0x01C0;
  14719. t['clicklateral'] = 0x01C1;
  14720. t['clickretroflex'] = 0x01C3;
  14721. t['club'] = 0x2663;
  14722. t['clubsuitblack'] = 0x2663;
  14723. t['clubsuitwhite'] = 0x2667;
  14724. t['cmcubedsquare'] = 0x33A4;
  14725. t['cmonospace'] = 0xFF43;
  14726. t['cmsquaredsquare'] = 0x33A0;
  14727. t['coarmenian'] = 0x0581;
  14728. t['colon'] = 0x003A;
  14729. t['colonmonetary'] = 0x20A1;
  14730. t['colonmonospace'] = 0xFF1A;
  14731. t['colonsign'] = 0x20A1;
  14732. t['colonsmall'] = 0xFE55;
  14733. t['colontriangularhalfmod'] = 0x02D1;
  14734. t['colontriangularmod'] = 0x02D0;
  14735. t['comma'] = 0x002C;
  14736. t['commaabovecmb'] = 0x0313;
  14737. t['commaaboverightcmb'] = 0x0315;
  14738. t['commaaccent'] = 0xF6C3;
  14739. t['commaarabic'] = 0x060C;
  14740. t['commaarmenian'] = 0x055D;
  14741. t['commainferior'] = 0xF6E1;
  14742. t['commamonospace'] = 0xFF0C;
  14743. t['commareversedabovecmb'] = 0x0314;
  14744. t['commareversedmod'] = 0x02BD;
  14745. t['commasmall'] = 0xFE50;
  14746. t['commasuperior'] = 0xF6E2;
  14747. t['commaturnedabovecmb'] = 0x0312;
  14748. t['commaturnedmod'] = 0x02BB;
  14749. t['compass'] = 0x263C;
  14750. t['congruent'] = 0x2245;
  14751. t['contourintegral'] = 0x222E;
  14752. t['control'] = 0x2303;
  14753. t['controlACK'] = 0x0006;
  14754. t['controlBEL'] = 0x0007;
  14755. t['controlBS'] = 0x0008;
  14756. t['controlCAN'] = 0x0018;
  14757. t['controlCR'] = 0x000D;
  14758. t['controlDC1'] = 0x0011;
  14759. t['controlDC2'] = 0x0012;
  14760. t['controlDC3'] = 0x0013;
  14761. t['controlDC4'] = 0x0014;
  14762. t['controlDEL'] = 0x007F;
  14763. t['controlDLE'] = 0x0010;
  14764. t['controlEM'] = 0x0019;
  14765. t['controlENQ'] = 0x0005;
  14766. t['controlEOT'] = 0x0004;
  14767. t['controlESC'] = 0x001B;
  14768. t['controlETB'] = 0x0017;
  14769. t['controlETX'] = 0x0003;
  14770. t['controlFF'] = 0x000C;
  14771. t['controlFS'] = 0x001C;
  14772. t['controlGS'] = 0x001D;
  14773. t['controlHT'] = 0x0009;
  14774. t['controlLF'] = 0x000A;
  14775. t['controlNAK'] = 0x0015;
  14776. t['controlNULL'] = 0x0000;
  14777. t['controlRS'] = 0x001E;
  14778. t['controlSI'] = 0x000F;
  14779. t['controlSO'] = 0x000E;
  14780. t['controlSOT'] = 0x0002;
  14781. t['controlSTX'] = 0x0001;
  14782. t['controlSUB'] = 0x001A;
  14783. t['controlSYN'] = 0x0016;
  14784. t['controlUS'] = 0x001F;
  14785. t['controlVT'] = 0x000B;
  14786. t['copyright'] = 0x00A9;
  14787. t['copyrightsans'] = 0xF8E9;
  14788. t['copyrightserif'] = 0xF6D9;
  14789. t['cornerbracketleft'] = 0x300C;
  14790. t['cornerbracketlefthalfwidth'] = 0xFF62;
  14791. t['cornerbracketleftvertical'] = 0xFE41;
  14792. t['cornerbracketright'] = 0x300D;
  14793. t['cornerbracketrighthalfwidth'] = 0xFF63;
  14794. t['cornerbracketrightvertical'] = 0xFE42;
  14795. t['corporationsquare'] = 0x337F;
  14796. t['cosquare'] = 0x33C7;
  14797. t['coverkgsquare'] = 0x33C6;
  14798. t['cparen'] = 0x249E;
  14799. t['cruzeiro'] = 0x20A2;
  14800. t['cstretched'] = 0x0297;
  14801. t['curlyand'] = 0x22CF;
  14802. t['curlyor'] = 0x22CE;
  14803. t['currency'] = 0x00A4;
  14804. t['cyrBreve'] = 0xF6D1;
  14805. t['cyrFlex'] = 0xF6D2;
  14806. t['cyrbreve'] = 0xF6D4;
  14807. t['cyrflex'] = 0xF6D5;
  14808. t['d'] = 0x0064;
  14809. t['daarmenian'] = 0x0564;
  14810. t['dabengali'] = 0x09A6;
  14811. t['dadarabic'] = 0x0636;
  14812. t['dadeva'] = 0x0926;
  14813. t['dadfinalarabic'] = 0xFEBE;
  14814. t['dadinitialarabic'] = 0xFEBF;
  14815. t['dadmedialarabic'] = 0xFEC0;
  14816. t['dagesh'] = 0x05BC;
  14817. t['dageshhebrew'] = 0x05BC;
  14818. t['dagger'] = 0x2020;
  14819. t['daggerdbl'] = 0x2021;
  14820. t['dagujarati'] = 0x0AA6;
  14821. t['dagurmukhi'] = 0x0A26;
  14822. t['dahiragana'] = 0x3060;
  14823. t['dakatakana'] = 0x30C0;
  14824. t['dalarabic'] = 0x062F;
  14825. t['dalet'] = 0x05D3;
  14826. t['daletdagesh'] = 0xFB33;
  14827. t['daletdageshhebrew'] = 0xFB33;
  14828. t['dalethebrew'] = 0x05D3;
  14829. t['dalfinalarabic'] = 0xFEAA;
  14830. t['dammaarabic'] = 0x064F;
  14831. t['dammalowarabic'] = 0x064F;
  14832. t['dammatanaltonearabic'] = 0x064C;
  14833. t['dammatanarabic'] = 0x064C;
  14834. t['danda'] = 0x0964;
  14835. t['dargahebrew'] = 0x05A7;
  14836. t['dargalefthebrew'] = 0x05A7;
  14837. t['dasiapneumatacyrilliccmb'] = 0x0485;
  14838. t['dblGrave'] = 0xF6D3;
  14839. t['dblanglebracketleft'] = 0x300A;
  14840. t['dblanglebracketleftvertical'] = 0xFE3D;
  14841. t['dblanglebracketright'] = 0x300B;
  14842. t['dblanglebracketrightvertical'] = 0xFE3E;
  14843. t['dblarchinvertedbelowcmb'] = 0x032B;
  14844. t['dblarrowleft'] = 0x21D4;
  14845. t['dblarrowright'] = 0x21D2;
  14846. t['dbldanda'] = 0x0965;
  14847. t['dblgrave'] = 0xF6D6;
  14848. t['dblgravecmb'] = 0x030F;
  14849. t['dblintegral'] = 0x222C;
  14850. t['dbllowline'] = 0x2017;
  14851. t['dbllowlinecmb'] = 0x0333;
  14852. t['dbloverlinecmb'] = 0x033F;
  14853. t['dblprimemod'] = 0x02BA;
  14854. t['dblverticalbar'] = 0x2016;
  14855. t['dblverticallineabovecmb'] = 0x030E;
  14856. t['dbopomofo'] = 0x3109;
  14857. t['dbsquare'] = 0x33C8;
  14858. t['dcaron'] = 0x010F;
  14859. t['dcedilla'] = 0x1E11;
  14860. t['dcircle'] = 0x24D3;
  14861. t['dcircumflexbelow'] = 0x1E13;
  14862. t['dcroat'] = 0x0111;
  14863. t['ddabengali'] = 0x09A1;
  14864. t['ddadeva'] = 0x0921;
  14865. t['ddagujarati'] = 0x0AA1;
  14866. t['ddagurmukhi'] = 0x0A21;
  14867. t['ddalarabic'] = 0x0688;
  14868. t['ddalfinalarabic'] = 0xFB89;
  14869. t['dddhadeva'] = 0x095C;
  14870. t['ddhabengali'] = 0x09A2;
  14871. t['ddhadeva'] = 0x0922;
  14872. t['ddhagujarati'] = 0x0AA2;
  14873. t['ddhagurmukhi'] = 0x0A22;
  14874. t['ddotaccent'] = 0x1E0B;
  14875. t['ddotbelow'] = 0x1E0D;
  14876. t['decimalseparatorarabic'] = 0x066B;
  14877. t['decimalseparatorpersian'] = 0x066B;
  14878. t['decyrillic'] = 0x0434;
  14879. t['degree'] = 0x00B0;
  14880. t['dehihebrew'] = 0x05AD;
  14881. t['dehiragana'] = 0x3067;
  14882. t['deicoptic'] = 0x03EF;
  14883. t['dekatakana'] = 0x30C7;
  14884. t['deleteleft'] = 0x232B;
  14885. t['deleteright'] = 0x2326;
  14886. t['delta'] = 0x03B4;
  14887. t['deltaturned'] = 0x018D;
  14888. t['denominatorminusonenumeratorbengali'] = 0x09F8;
  14889. t['dezh'] = 0x02A4;
  14890. t['dhabengali'] = 0x09A7;
  14891. t['dhadeva'] = 0x0927;
  14892. t['dhagujarati'] = 0x0AA7;
  14893. t['dhagurmukhi'] = 0x0A27;
  14894. t['dhook'] = 0x0257;
  14895. t['dialytikatonos'] = 0x0385;
  14896. t['dialytikatonoscmb'] = 0x0344;
  14897. t['diamond'] = 0x2666;
  14898. t['diamondsuitwhite'] = 0x2662;
  14899. t['dieresis'] = 0x00A8;
  14900. t['dieresisacute'] = 0xF6D7;
  14901. t['dieresisbelowcmb'] = 0x0324;
  14902. t['dieresiscmb'] = 0x0308;
  14903. t['dieresisgrave'] = 0xF6D8;
  14904. t['dieresistonos'] = 0x0385;
  14905. t['dihiragana'] = 0x3062;
  14906. t['dikatakana'] = 0x30C2;
  14907. t['dittomark'] = 0x3003;
  14908. t['divide'] = 0x00F7;
  14909. t['divides'] = 0x2223;
  14910. t['divisionslash'] = 0x2215;
  14911. t['djecyrillic'] = 0x0452;
  14912. t['dkshade'] = 0x2593;
  14913. t['dlinebelow'] = 0x1E0F;
  14914. t['dlsquare'] = 0x3397;
  14915. t['dmacron'] = 0x0111;
  14916. t['dmonospace'] = 0xFF44;
  14917. t['dnblock'] = 0x2584;
  14918. t['dochadathai'] = 0x0E0E;
  14919. t['dodekthai'] = 0x0E14;
  14920. t['dohiragana'] = 0x3069;
  14921. t['dokatakana'] = 0x30C9;
  14922. t['dollar'] = 0x0024;
  14923. t['dollarinferior'] = 0xF6E3;
  14924. t['dollarmonospace'] = 0xFF04;
  14925. t['dollaroldstyle'] = 0xF724;
  14926. t['dollarsmall'] = 0xFE69;
  14927. t['dollarsuperior'] = 0xF6E4;
  14928. t['dong'] = 0x20AB;
  14929. t['dorusquare'] = 0x3326;
  14930. t['dotaccent'] = 0x02D9;
  14931. t['dotaccentcmb'] = 0x0307;
  14932. t['dotbelowcmb'] = 0x0323;
  14933. t['dotbelowcomb'] = 0x0323;
  14934. t['dotkatakana'] = 0x30FB;
  14935. t['dotlessi'] = 0x0131;
  14936. t['dotlessj'] = 0xF6BE;
  14937. t['dotlessjstrokehook'] = 0x0284;
  14938. t['dotmath'] = 0x22C5;
  14939. t['dottedcircle'] = 0x25CC;
  14940. t['doubleyodpatah'] = 0xFB1F;
  14941. t['doubleyodpatahhebrew'] = 0xFB1F;
  14942. t['downtackbelowcmb'] = 0x031E;
  14943. t['downtackmod'] = 0x02D5;
  14944. t['dparen'] = 0x249F;
  14945. t['dsuperior'] = 0xF6EB;
  14946. t['dtail'] = 0x0256;
  14947. t['dtopbar'] = 0x018C;
  14948. t['duhiragana'] = 0x3065;
  14949. t['dukatakana'] = 0x30C5;
  14950. t['dz'] = 0x01F3;
  14951. t['dzaltone'] = 0x02A3;
  14952. t['dzcaron'] = 0x01C6;
  14953. t['dzcurl'] = 0x02A5;
  14954. t['dzeabkhasiancyrillic'] = 0x04E1;
  14955. t['dzecyrillic'] = 0x0455;
  14956. t['dzhecyrillic'] = 0x045F;
  14957. t['e'] = 0x0065;
  14958. t['eacute'] = 0x00E9;
  14959. t['earth'] = 0x2641;
  14960. t['ebengali'] = 0x098F;
  14961. t['ebopomofo'] = 0x311C;
  14962. t['ebreve'] = 0x0115;
  14963. t['ecandradeva'] = 0x090D;
  14964. t['ecandragujarati'] = 0x0A8D;
  14965. t['ecandravowelsigndeva'] = 0x0945;
  14966. t['ecandravowelsigngujarati'] = 0x0AC5;
  14967. t['ecaron'] = 0x011B;
  14968. t['ecedillabreve'] = 0x1E1D;
  14969. t['echarmenian'] = 0x0565;
  14970. t['echyiwnarmenian'] = 0x0587;
  14971. t['ecircle'] = 0x24D4;
  14972. t['ecircumflex'] = 0x00EA;
  14973. t['ecircumflexacute'] = 0x1EBF;
  14974. t['ecircumflexbelow'] = 0x1E19;
  14975. t['ecircumflexdotbelow'] = 0x1EC7;
  14976. t['ecircumflexgrave'] = 0x1EC1;
  14977. t['ecircumflexhookabove'] = 0x1EC3;
  14978. t['ecircumflextilde'] = 0x1EC5;
  14979. t['ecyrillic'] = 0x0454;
  14980. t['edblgrave'] = 0x0205;
  14981. t['edeva'] = 0x090F;
  14982. t['edieresis'] = 0x00EB;
  14983. t['edot'] = 0x0117;
  14984. t['edotaccent'] = 0x0117;
  14985. t['edotbelow'] = 0x1EB9;
  14986. t['eegurmukhi'] = 0x0A0F;
  14987. t['eematragurmukhi'] = 0x0A47;
  14988. t['efcyrillic'] = 0x0444;
  14989. t['egrave'] = 0x00E8;
  14990. t['egujarati'] = 0x0A8F;
  14991. t['eharmenian'] = 0x0567;
  14992. t['ehbopomofo'] = 0x311D;
  14993. t['ehiragana'] = 0x3048;
  14994. t['ehookabove'] = 0x1EBB;
  14995. t['eibopomofo'] = 0x311F;
  14996. t['eight'] = 0x0038;
  14997. t['eightarabic'] = 0x0668;
  14998. t['eightbengali'] = 0x09EE;
  14999. t['eightcircle'] = 0x2467;
  15000. t['eightcircleinversesansserif'] = 0x2791;
  15001. t['eightdeva'] = 0x096E;
  15002. t['eighteencircle'] = 0x2471;
  15003. t['eighteenparen'] = 0x2485;
  15004. t['eighteenperiod'] = 0x2499;
  15005. t['eightgujarati'] = 0x0AEE;
  15006. t['eightgurmukhi'] = 0x0A6E;
  15007. t['eighthackarabic'] = 0x0668;
  15008. t['eighthangzhou'] = 0x3028;
  15009. t['eighthnotebeamed'] = 0x266B;
  15010. t['eightideographicparen'] = 0x3227;
  15011. t['eightinferior'] = 0x2088;
  15012. t['eightmonospace'] = 0xFF18;
  15013. t['eightoldstyle'] = 0xF738;
  15014. t['eightparen'] = 0x247B;
  15015. t['eightperiod'] = 0x248F;
  15016. t['eightpersian'] = 0x06F8;
  15017. t['eightroman'] = 0x2177;
  15018. t['eightsuperior'] = 0x2078;
  15019. t['eightthai'] = 0x0E58;
  15020. t['einvertedbreve'] = 0x0207;
  15021. t['eiotifiedcyrillic'] = 0x0465;
  15022. t['ekatakana'] = 0x30A8;
  15023. t['ekatakanahalfwidth'] = 0xFF74;
  15024. t['ekonkargurmukhi'] = 0x0A74;
  15025. t['ekorean'] = 0x3154;
  15026. t['elcyrillic'] = 0x043B;
  15027. t['element'] = 0x2208;
  15028. t['elevencircle'] = 0x246A;
  15029. t['elevenparen'] = 0x247E;
  15030. t['elevenperiod'] = 0x2492;
  15031. t['elevenroman'] = 0x217A;
  15032. t['ellipsis'] = 0x2026;
  15033. t['ellipsisvertical'] = 0x22EE;
  15034. t['emacron'] = 0x0113;
  15035. t['emacronacute'] = 0x1E17;
  15036. t['emacrongrave'] = 0x1E15;
  15037. t['emcyrillic'] = 0x043C;
  15038. t['emdash'] = 0x2014;
  15039. t['emdashvertical'] = 0xFE31;
  15040. t['emonospace'] = 0xFF45;
  15041. t['emphasismarkarmenian'] = 0x055B;
  15042. t['emptyset'] = 0x2205;
  15043. t['enbopomofo'] = 0x3123;
  15044. t['encyrillic'] = 0x043D;
  15045. t['endash'] = 0x2013;
  15046. t['endashvertical'] = 0xFE32;
  15047. t['endescendercyrillic'] = 0x04A3;
  15048. t['eng'] = 0x014B;
  15049. t['engbopomofo'] = 0x3125;
  15050. t['enghecyrillic'] = 0x04A5;
  15051. t['enhookcyrillic'] = 0x04C8;
  15052. t['enspace'] = 0x2002;
  15053. t['eogonek'] = 0x0119;
  15054. t['eokorean'] = 0x3153;
  15055. t['eopen'] = 0x025B;
  15056. t['eopenclosed'] = 0x029A;
  15057. t['eopenreversed'] = 0x025C;
  15058. t['eopenreversedclosed'] = 0x025E;
  15059. t['eopenreversedhook'] = 0x025D;
  15060. t['eparen'] = 0x24A0;
  15061. t['epsilon'] = 0x03B5;
  15062. t['epsilontonos'] = 0x03AD;
  15063. t['equal'] = 0x003D;
  15064. t['equalmonospace'] = 0xFF1D;
  15065. t['equalsmall'] = 0xFE66;
  15066. t['equalsuperior'] = 0x207C;
  15067. t['equivalence'] = 0x2261;
  15068. t['erbopomofo'] = 0x3126;
  15069. t['ercyrillic'] = 0x0440;
  15070. t['ereversed'] = 0x0258;
  15071. t['ereversedcyrillic'] = 0x044D;
  15072. t['escyrillic'] = 0x0441;
  15073. t['esdescendercyrillic'] = 0x04AB;
  15074. t['esh'] = 0x0283;
  15075. t['eshcurl'] = 0x0286;
  15076. t['eshortdeva'] = 0x090E;
  15077. t['eshortvowelsigndeva'] = 0x0946;
  15078. t['eshreversedloop'] = 0x01AA;
  15079. t['eshsquatreversed'] = 0x0285;
  15080. t['esmallhiragana'] = 0x3047;
  15081. t['esmallkatakana'] = 0x30A7;
  15082. t['esmallkatakanahalfwidth'] = 0xFF6A;
  15083. t['estimated'] = 0x212E;
  15084. t['esuperior'] = 0xF6EC;
  15085. t['eta'] = 0x03B7;
  15086. t['etarmenian'] = 0x0568;
  15087. t['etatonos'] = 0x03AE;
  15088. t['eth'] = 0x00F0;
  15089. t['etilde'] = 0x1EBD;
  15090. t['etildebelow'] = 0x1E1B;
  15091. t['etnahtafoukhhebrew'] = 0x0591;
  15092. t['etnahtafoukhlefthebrew'] = 0x0591;
  15093. t['etnahtahebrew'] = 0x0591;
  15094. t['etnahtalefthebrew'] = 0x0591;
  15095. t['eturned'] = 0x01DD;
  15096. t['eukorean'] = 0x3161;
  15097. t['euro'] = 0x20AC;
  15098. t['evowelsignbengali'] = 0x09C7;
  15099. t['evowelsigndeva'] = 0x0947;
  15100. t['evowelsigngujarati'] = 0x0AC7;
  15101. t['exclam'] = 0x0021;
  15102. t['exclamarmenian'] = 0x055C;
  15103. t['exclamdbl'] = 0x203C;
  15104. t['exclamdown'] = 0x00A1;
  15105. t['exclamdownsmall'] = 0xF7A1;
  15106. t['exclammonospace'] = 0xFF01;
  15107. t['exclamsmall'] = 0xF721;
  15108. t['existential'] = 0x2203;
  15109. t['ezh'] = 0x0292;
  15110. t['ezhcaron'] = 0x01EF;
  15111. t['ezhcurl'] = 0x0293;
  15112. t['ezhreversed'] = 0x01B9;
  15113. t['ezhtail'] = 0x01BA;
  15114. t['f'] = 0x0066;
  15115. t['fadeva'] = 0x095E;
  15116. t['fagurmukhi'] = 0x0A5E;
  15117. t['fahrenheit'] = 0x2109;
  15118. t['fathaarabic'] = 0x064E;
  15119. t['fathalowarabic'] = 0x064E;
  15120. t['fathatanarabic'] = 0x064B;
  15121. t['fbopomofo'] = 0x3108;
  15122. t['fcircle'] = 0x24D5;
  15123. t['fdotaccent'] = 0x1E1F;
  15124. t['feharabic'] = 0x0641;
  15125. t['feharmenian'] = 0x0586;
  15126. t['fehfinalarabic'] = 0xFED2;
  15127. t['fehinitialarabic'] = 0xFED3;
  15128. t['fehmedialarabic'] = 0xFED4;
  15129. t['feicoptic'] = 0x03E5;
  15130. t['female'] = 0x2640;
  15131. t['ff'] = 0xFB00;
  15132. t['ffi'] = 0xFB03;
  15133. t['ffl'] = 0xFB04;
  15134. t['fi'] = 0xFB01;
  15135. t['fifteencircle'] = 0x246E;
  15136. t['fifteenparen'] = 0x2482;
  15137. t['fifteenperiod'] = 0x2496;
  15138. t['figuredash'] = 0x2012;
  15139. t['filledbox'] = 0x25A0;
  15140. t['filledrect'] = 0x25AC;
  15141. t['finalkaf'] = 0x05DA;
  15142. t['finalkafdagesh'] = 0xFB3A;
  15143. t['finalkafdageshhebrew'] = 0xFB3A;
  15144. t['finalkafhebrew'] = 0x05DA;
  15145. t['finalmem'] = 0x05DD;
  15146. t['finalmemhebrew'] = 0x05DD;
  15147. t['finalnun'] = 0x05DF;
  15148. t['finalnunhebrew'] = 0x05DF;
  15149. t['finalpe'] = 0x05E3;
  15150. t['finalpehebrew'] = 0x05E3;
  15151. t['finaltsadi'] = 0x05E5;
  15152. t['finaltsadihebrew'] = 0x05E5;
  15153. t['firsttonechinese'] = 0x02C9;
  15154. t['fisheye'] = 0x25C9;
  15155. t['fitacyrillic'] = 0x0473;
  15156. t['five'] = 0x0035;
  15157. t['fivearabic'] = 0x0665;
  15158. t['fivebengali'] = 0x09EB;
  15159. t['fivecircle'] = 0x2464;
  15160. t['fivecircleinversesansserif'] = 0x278E;
  15161. t['fivedeva'] = 0x096B;
  15162. t['fiveeighths'] = 0x215D;
  15163. t['fivegujarati'] = 0x0AEB;
  15164. t['fivegurmukhi'] = 0x0A6B;
  15165. t['fivehackarabic'] = 0x0665;
  15166. t['fivehangzhou'] = 0x3025;
  15167. t['fiveideographicparen'] = 0x3224;
  15168. t['fiveinferior'] = 0x2085;
  15169. t['fivemonospace'] = 0xFF15;
  15170. t['fiveoldstyle'] = 0xF735;
  15171. t['fiveparen'] = 0x2478;
  15172. t['fiveperiod'] = 0x248C;
  15173. t['fivepersian'] = 0x06F5;
  15174. t['fiveroman'] = 0x2174;
  15175. t['fivesuperior'] = 0x2075;
  15176. t['fivethai'] = 0x0E55;
  15177. t['fl'] = 0xFB02;
  15178. t['florin'] = 0x0192;
  15179. t['fmonospace'] = 0xFF46;
  15180. t['fmsquare'] = 0x3399;
  15181. t['fofanthai'] = 0x0E1F;
  15182. t['fofathai'] = 0x0E1D;
  15183. t['fongmanthai'] = 0x0E4F;
  15184. t['forall'] = 0x2200;
  15185. t['four'] = 0x0034;
  15186. t['fourarabic'] = 0x0664;
  15187. t['fourbengali'] = 0x09EA;
  15188. t['fourcircle'] = 0x2463;
  15189. t['fourcircleinversesansserif'] = 0x278D;
  15190. t['fourdeva'] = 0x096A;
  15191. t['fourgujarati'] = 0x0AEA;
  15192. t['fourgurmukhi'] = 0x0A6A;
  15193. t['fourhackarabic'] = 0x0664;
  15194. t['fourhangzhou'] = 0x3024;
  15195. t['fourideographicparen'] = 0x3223;
  15196. t['fourinferior'] = 0x2084;
  15197. t['fourmonospace'] = 0xFF14;
  15198. t['fournumeratorbengali'] = 0x09F7;
  15199. t['fouroldstyle'] = 0xF734;
  15200. t['fourparen'] = 0x2477;
  15201. t['fourperiod'] = 0x248B;
  15202. t['fourpersian'] = 0x06F4;
  15203. t['fourroman'] = 0x2173;
  15204. t['foursuperior'] = 0x2074;
  15205. t['fourteencircle'] = 0x246D;
  15206. t['fourteenparen'] = 0x2481;
  15207. t['fourteenperiod'] = 0x2495;
  15208. t['fourthai'] = 0x0E54;
  15209. t['fourthtonechinese'] = 0x02CB;
  15210. t['fparen'] = 0x24A1;
  15211. t['fraction'] = 0x2044;
  15212. t['franc'] = 0x20A3;
  15213. t['g'] = 0x0067;
  15214. t['gabengali'] = 0x0997;
  15215. t['gacute'] = 0x01F5;
  15216. t['gadeva'] = 0x0917;
  15217. t['gafarabic'] = 0x06AF;
  15218. t['gaffinalarabic'] = 0xFB93;
  15219. t['gafinitialarabic'] = 0xFB94;
  15220. t['gafmedialarabic'] = 0xFB95;
  15221. t['gagujarati'] = 0x0A97;
  15222. t['gagurmukhi'] = 0x0A17;
  15223. t['gahiragana'] = 0x304C;
  15224. t['gakatakana'] = 0x30AC;
  15225. t['gamma'] = 0x03B3;
  15226. t['gammalatinsmall'] = 0x0263;
  15227. t['gammasuperior'] = 0x02E0;
  15228. t['gangiacoptic'] = 0x03EB;
  15229. t['gbopomofo'] = 0x310D;
  15230. t['gbreve'] = 0x011F;
  15231. t['gcaron'] = 0x01E7;
  15232. t['gcedilla'] = 0x0123;
  15233. t['gcircle'] = 0x24D6;
  15234. t['gcircumflex'] = 0x011D;
  15235. t['gcommaaccent'] = 0x0123;
  15236. t['gdot'] = 0x0121;
  15237. t['gdotaccent'] = 0x0121;
  15238. t['gecyrillic'] = 0x0433;
  15239. t['gehiragana'] = 0x3052;
  15240. t['gekatakana'] = 0x30B2;
  15241. t['geometricallyequal'] = 0x2251;
  15242. t['gereshaccenthebrew'] = 0x059C;
  15243. t['gereshhebrew'] = 0x05F3;
  15244. t['gereshmuqdamhebrew'] = 0x059D;
  15245. t['germandbls'] = 0x00DF;
  15246. t['gershayimaccenthebrew'] = 0x059E;
  15247. t['gershayimhebrew'] = 0x05F4;
  15248. t['getamark'] = 0x3013;
  15249. t['ghabengali'] = 0x0998;
  15250. t['ghadarmenian'] = 0x0572;
  15251. t['ghadeva'] = 0x0918;
  15252. t['ghagujarati'] = 0x0A98;
  15253. t['ghagurmukhi'] = 0x0A18;
  15254. t['ghainarabic'] = 0x063A;
  15255. t['ghainfinalarabic'] = 0xFECE;
  15256. t['ghaininitialarabic'] = 0xFECF;
  15257. t['ghainmedialarabic'] = 0xFED0;
  15258. t['ghemiddlehookcyrillic'] = 0x0495;
  15259. t['ghestrokecyrillic'] = 0x0493;
  15260. t['gheupturncyrillic'] = 0x0491;
  15261. t['ghhadeva'] = 0x095A;
  15262. t['ghhagurmukhi'] = 0x0A5A;
  15263. t['ghook'] = 0x0260;
  15264. t['ghzsquare'] = 0x3393;
  15265. t['gihiragana'] = 0x304E;
  15266. t['gikatakana'] = 0x30AE;
  15267. t['gimarmenian'] = 0x0563;
  15268. t['gimel'] = 0x05D2;
  15269. t['gimeldagesh'] = 0xFB32;
  15270. t['gimeldageshhebrew'] = 0xFB32;
  15271. t['gimelhebrew'] = 0x05D2;
  15272. t['gjecyrillic'] = 0x0453;
  15273. t['glottalinvertedstroke'] = 0x01BE;
  15274. t['glottalstop'] = 0x0294;
  15275. t['glottalstopinverted'] = 0x0296;
  15276. t['glottalstopmod'] = 0x02C0;
  15277. t['glottalstopreversed'] = 0x0295;
  15278. t['glottalstopreversedmod'] = 0x02C1;
  15279. t['glottalstopreversedsuperior'] = 0x02E4;
  15280. t['glottalstopstroke'] = 0x02A1;
  15281. t['glottalstopstrokereversed'] = 0x02A2;
  15282. t['gmacron'] = 0x1E21;
  15283. t['gmonospace'] = 0xFF47;
  15284. t['gohiragana'] = 0x3054;
  15285. t['gokatakana'] = 0x30B4;
  15286. t['gparen'] = 0x24A2;
  15287. t['gpasquare'] = 0x33AC;
  15288. t['gradient'] = 0x2207;
  15289. t['grave'] = 0x0060;
  15290. t['gravebelowcmb'] = 0x0316;
  15291. t['gravecmb'] = 0x0300;
  15292. t['gravecomb'] = 0x0300;
  15293. t['gravedeva'] = 0x0953;
  15294. t['gravelowmod'] = 0x02CE;
  15295. t['gravemonospace'] = 0xFF40;
  15296. t['gravetonecmb'] = 0x0340;
  15297. t['greater'] = 0x003E;
  15298. t['greaterequal'] = 0x2265;
  15299. t['greaterequalorless'] = 0x22DB;
  15300. t['greatermonospace'] = 0xFF1E;
  15301. t['greaterorequivalent'] = 0x2273;
  15302. t['greaterorless'] = 0x2277;
  15303. t['greateroverequal'] = 0x2267;
  15304. t['greatersmall'] = 0xFE65;
  15305. t['gscript'] = 0x0261;
  15306. t['gstroke'] = 0x01E5;
  15307. t['guhiragana'] = 0x3050;
  15308. t['guillemotleft'] = 0x00AB;
  15309. t['guillemotright'] = 0x00BB;
  15310. t['guilsinglleft'] = 0x2039;
  15311. t['guilsinglright'] = 0x203A;
  15312. t['gukatakana'] = 0x30B0;
  15313. t['guramusquare'] = 0x3318;
  15314. t['gysquare'] = 0x33C9;
  15315. t['h'] = 0x0068;
  15316. t['haabkhasiancyrillic'] = 0x04A9;
  15317. t['haaltonearabic'] = 0x06C1;
  15318. t['habengali'] = 0x09B9;
  15319. t['hadescendercyrillic'] = 0x04B3;
  15320. t['hadeva'] = 0x0939;
  15321. t['hagujarati'] = 0x0AB9;
  15322. t['hagurmukhi'] = 0x0A39;
  15323. t['haharabic'] = 0x062D;
  15324. t['hahfinalarabic'] = 0xFEA2;
  15325. t['hahinitialarabic'] = 0xFEA3;
  15326. t['hahiragana'] = 0x306F;
  15327. t['hahmedialarabic'] = 0xFEA4;
  15328. t['haitusquare'] = 0x332A;
  15329. t['hakatakana'] = 0x30CF;
  15330. t['hakatakanahalfwidth'] = 0xFF8A;
  15331. t['halantgurmukhi'] = 0x0A4D;
  15332. t['hamzaarabic'] = 0x0621;
  15333. t['hamzalowarabic'] = 0x0621;
  15334. t['hangulfiller'] = 0x3164;
  15335. t['hardsigncyrillic'] = 0x044A;
  15336. t['harpoonleftbarbup'] = 0x21BC;
  15337. t['harpoonrightbarbup'] = 0x21C0;
  15338. t['hasquare'] = 0x33CA;
  15339. t['hatafpatah'] = 0x05B2;
  15340. t['hatafpatah16'] = 0x05B2;
  15341. t['hatafpatah23'] = 0x05B2;
  15342. t['hatafpatah2f'] = 0x05B2;
  15343. t['hatafpatahhebrew'] = 0x05B2;
  15344. t['hatafpatahnarrowhebrew'] = 0x05B2;
  15345. t['hatafpatahquarterhebrew'] = 0x05B2;
  15346. t['hatafpatahwidehebrew'] = 0x05B2;
  15347. t['hatafqamats'] = 0x05B3;
  15348. t['hatafqamats1b'] = 0x05B3;
  15349. t['hatafqamats28'] = 0x05B3;
  15350. t['hatafqamats34'] = 0x05B3;
  15351. t['hatafqamatshebrew'] = 0x05B3;
  15352. t['hatafqamatsnarrowhebrew'] = 0x05B3;
  15353. t['hatafqamatsquarterhebrew'] = 0x05B3;
  15354. t['hatafqamatswidehebrew'] = 0x05B3;
  15355. t['hatafsegol'] = 0x05B1;
  15356. t['hatafsegol17'] = 0x05B1;
  15357. t['hatafsegol24'] = 0x05B1;
  15358. t['hatafsegol30'] = 0x05B1;
  15359. t['hatafsegolhebrew'] = 0x05B1;
  15360. t['hatafsegolnarrowhebrew'] = 0x05B1;
  15361. t['hatafsegolquarterhebrew'] = 0x05B1;
  15362. t['hatafsegolwidehebrew'] = 0x05B1;
  15363. t['hbar'] = 0x0127;
  15364. t['hbopomofo'] = 0x310F;
  15365. t['hbrevebelow'] = 0x1E2B;
  15366. t['hcedilla'] = 0x1E29;
  15367. t['hcircle'] = 0x24D7;
  15368. t['hcircumflex'] = 0x0125;
  15369. t['hdieresis'] = 0x1E27;
  15370. t['hdotaccent'] = 0x1E23;
  15371. t['hdotbelow'] = 0x1E25;
  15372. t['he'] = 0x05D4;
  15373. t['heart'] = 0x2665;
  15374. t['heartsuitblack'] = 0x2665;
  15375. t['heartsuitwhite'] = 0x2661;
  15376. t['hedagesh'] = 0xFB34;
  15377. t['hedageshhebrew'] = 0xFB34;
  15378. t['hehaltonearabic'] = 0x06C1;
  15379. t['heharabic'] = 0x0647;
  15380. t['hehebrew'] = 0x05D4;
  15381. t['hehfinalaltonearabic'] = 0xFBA7;
  15382. t['hehfinalalttwoarabic'] = 0xFEEA;
  15383. t['hehfinalarabic'] = 0xFEEA;
  15384. t['hehhamzaabovefinalarabic'] = 0xFBA5;
  15385. t['hehhamzaaboveisolatedarabic'] = 0xFBA4;
  15386. t['hehinitialaltonearabic'] = 0xFBA8;
  15387. t['hehinitialarabic'] = 0xFEEB;
  15388. t['hehiragana'] = 0x3078;
  15389. t['hehmedialaltonearabic'] = 0xFBA9;
  15390. t['hehmedialarabic'] = 0xFEEC;
  15391. t['heiseierasquare'] = 0x337B;
  15392. t['hekatakana'] = 0x30D8;
  15393. t['hekatakanahalfwidth'] = 0xFF8D;
  15394. t['hekutaarusquare'] = 0x3336;
  15395. t['henghook'] = 0x0267;
  15396. t['herutusquare'] = 0x3339;
  15397. t['het'] = 0x05D7;
  15398. t['hethebrew'] = 0x05D7;
  15399. t['hhook'] = 0x0266;
  15400. t['hhooksuperior'] = 0x02B1;
  15401. t['hieuhacirclekorean'] = 0x327B;
  15402. t['hieuhaparenkorean'] = 0x321B;
  15403. t['hieuhcirclekorean'] = 0x326D;
  15404. t['hieuhkorean'] = 0x314E;
  15405. t['hieuhparenkorean'] = 0x320D;
  15406. t['hihiragana'] = 0x3072;
  15407. t['hikatakana'] = 0x30D2;
  15408. t['hikatakanahalfwidth'] = 0xFF8B;
  15409. t['hiriq'] = 0x05B4;
  15410. t['hiriq14'] = 0x05B4;
  15411. t['hiriq21'] = 0x05B4;
  15412. t['hiriq2d'] = 0x05B4;
  15413. t['hiriqhebrew'] = 0x05B4;
  15414. t['hiriqnarrowhebrew'] = 0x05B4;
  15415. t['hiriqquarterhebrew'] = 0x05B4;
  15416. t['hiriqwidehebrew'] = 0x05B4;
  15417. t['hlinebelow'] = 0x1E96;
  15418. t['hmonospace'] = 0xFF48;
  15419. t['hoarmenian'] = 0x0570;
  15420. t['hohipthai'] = 0x0E2B;
  15421. t['hohiragana'] = 0x307B;
  15422. t['hokatakana'] = 0x30DB;
  15423. t['hokatakanahalfwidth'] = 0xFF8E;
  15424. t['holam'] = 0x05B9;
  15425. t['holam19'] = 0x05B9;
  15426. t['holam26'] = 0x05B9;
  15427. t['holam32'] = 0x05B9;
  15428. t['holamhebrew'] = 0x05B9;
  15429. t['holamnarrowhebrew'] = 0x05B9;
  15430. t['holamquarterhebrew'] = 0x05B9;
  15431. t['holamwidehebrew'] = 0x05B9;
  15432. t['honokhukthai'] = 0x0E2E;
  15433. t['hookabovecomb'] = 0x0309;
  15434. t['hookcmb'] = 0x0309;
  15435. t['hookpalatalizedbelowcmb'] = 0x0321;
  15436. t['hookretroflexbelowcmb'] = 0x0322;
  15437. t['hoonsquare'] = 0x3342;
  15438. t['horicoptic'] = 0x03E9;
  15439. t['horizontalbar'] = 0x2015;
  15440. t['horncmb'] = 0x031B;
  15441. t['hotsprings'] = 0x2668;
  15442. t['house'] = 0x2302;
  15443. t['hparen'] = 0x24A3;
  15444. t['hsuperior'] = 0x02B0;
  15445. t['hturned'] = 0x0265;
  15446. t['huhiragana'] = 0x3075;
  15447. t['huiitosquare'] = 0x3333;
  15448. t['hukatakana'] = 0x30D5;
  15449. t['hukatakanahalfwidth'] = 0xFF8C;
  15450. t['hungarumlaut'] = 0x02DD;
  15451. t['hungarumlautcmb'] = 0x030B;
  15452. t['hv'] = 0x0195;
  15453. t['hyphen'] = 0x002D;
  15454. t['hypheninferior'] = 0xF6E5;
  15455. t['hyphenmonospace'] = 0xFF0D;
  15456. t['hyphensmall'] = 0xFE63;
  15457. t['hyphensuperior'] = 0xF6E6;
  15458. t['hyphentwo'] = 0x2010;
  15459. t['i'] = 0x0069;
  15460. t['iacute'] = 0x00ED;
  15461. t['iacyrillic'] = 0x044F;
  15462. t['ibengali'] = 0x0987;
  15463. t['ibopomofo'] = 0x3127;
  15464. t['ibreve'] = 0x012D;
  15465. t['icaron'] = 0x01D0;
  15466. t['icircle'] = 0x24D8;
  15467. t['icircumflex'] = 0x00EE;
  15468. t['icyrillic'] = 0x0456;
  15469. t['idblgrave'] = 0x0209;
  15470. t['ideographearthcircle'] = 0x328F;
  15471. t['ideographfirecircle'] = 0x328B;
  15472. t['ideographicallianceparen'] = 0x323F;
  15473. t['ideographiccallparen'] = 0x323A;
  15474. t['ideographiccentrecircle'] = 0x32A5;
  15475. t['ideographicclose'] = 0x3006;
  15476. t['ideographiccomma'] = 0x3001;
  15477. t['ideographiccommaleft'] = 0xFF64;
  15478. t['ideographiccongratulationparen'] = 0x3237;
  15479. t['ideographiccorrectcircle'] = 0x32A3;
  15480. t['ideographicearthparen'] = 0x322F;
  15481. t['ideographicenterpriseparen'] = 0x323D;
  15482. t['ideographicexcellentcircle'] = 0x329D;
  15483. t['ideographicfestivalparen'] = 0x3240;
  15484. t['ideographicfinancialcircle'] = 0x3296;
  15485. t['ideographicfinancialparen'] = 0x3236;
  15486. t['ideographicfireparen'] = 0x322B;
  15487. t['ideographichaveparen'] = 0x3232;
  15488. t['ideographichighcircle'] = 0x32A4;
  15489. t['ideographiciterationmark'] = 0x3005;
  15490. t['ideographiclaborcircle'] = 0x3298;
  15491. t['ideographiclaborparen'] = 0x3238;
  15492. t['ideographicleftcircle'] = 0x32A7;
  15493. t['ideographiclowcircle'] = 0x32A6;
  15494. t['ideographicmedicinecircle'] = 0x32A9;
  15495. t['ideographicmetalparen'] = 0x322E;
  15496. t['ideographicmoonparen'] = 0x322A;
  15497. t['ideographicnameparen'] = 0x3234;
  15498. t['ideographicperiod'] = 0x3002;
  15499. t['ideographicprintcircle'] = 0x329E;
  15500. t['ideographicreachparen'] = 0x3243;
  15501. t['ideographicrepresentparen'] = 0x3239;
  15502. t['ideographicresourceparen'] = 0x323E;
  15503. t['ideographicrightcircle'] = 0x32A8;
  15504. t['ideographicsecretcircle'] = 0x3299;
  15505. t['ideographicselfparen'] = 0x3242;
  15506. t['ideographicsocietyparen'] = 0x3233;
  15507. t['ideographicspace'] = 0x3000;
  15508. t['ideographicspecialparen'] = 0x3235;
  15509. t['ideographicstockparen'] = 0x3231;
  15510. t['ideographicstudyparen'] = 0x323B;
  15511. t['ideographicsunparen'] = 0x3230;
  15512. t['ideographicsuperviseparen'] = 0x323C;
  15513. t['ideographicwaterparen'] = 0x322C;
  15514. t['ideographicwoodparen'] = 0x322D;
  15515. t['ideographiczero'] = 0x3007;
  15516. t['ideographmetalcircle'] = 0x328E;
  15517. t['ideographmooncircle'] = 0x328A;
  15518. t['ideographnamecircle'] = 0x3294;
  15519. t['ideographsuncircle'] = 0x3290;
  15520. t['ideographwatercircle'] = 0x328C;
  15521. t['ideographwoodcircle'] = 0x328D;
  15522. t['ideva'] = 0x0907;
  15523. t['idieresis'] = 0x00EF;
  15524. t['idieresisacute'] = 0x1E2F;
  15525. t['idieresiscyrillic'] = 0x04E5;
  15526. t['idotbelow'] = 0x1ECB;
  15527. t['iebrevecyrillic'] = 0x04D7;
  15528. t['iecyrillic'] = 0x0435;
  15529. t['ieungacirclekorean'] = 0x3275;
  15530. t['ieungaparenkorean'] = 0x3215;
  15531. t['ieungcirclekorean'] = 0x3267;
  15532. t['ieungkorean'] = 0x3147;
  15533. t['ieungparenkorean'] = 0x3207;
  15534. t['igrave'] = 0x00EC;
  15535. t['igujarati'] = 0x0A87;
  15536. t['igurmukhi'] = 0x0A07;
  15537. t['ihiragana'] = 0x3044;
  15538. t['ihookabove'] = 0x1EC9;
  15539. t['iibengali'] = 0x0988;
  15540. t['iicyrillic'] = 0x0438;
  15541. t['iideva'] = 0x0908;
  15542. t['iigujarati'] = 0x0A88;
  15543. t['iigurmukhi'] = 0x0A08;
  15544. t['iimatragurmukhi'] = 0x0A40;
  15545. t['iinvertedbreve'] = 0x020B;
  15546. t['iishortcyrillic'] = 0x0439;
  15547. t['iivowelsignbengali'] = 0x09C0;
  15548. t['iivowelsigndeva'] = 0x0940;
  15549. t['iivowelsigngujarati'] = 0x0AC0;
  15550. t['ij'] = 0x0133;
  15551. t['ikatakana'] = 0x30A4;
  15552. t['ikatakanahalfwidth'] = 0xFF72;
  15553. t['ikorean'] = 0x3163;
  15554. t['ilde'] = 0x02DC;
  15555. t['iluyhebrew'] = 0x05AC;
  15556. t['imacron'] = 0x012B;
  15557. t['imacroncyrillic'] = 0x04E3;
  15558. t['imageorapproximatelyequal'] = 0x2253;
  15559. t['imatragurmukhi'] = 0x0A3F;
  15560. t['imonospace'] = 0xFF49;
  15561. t['increment'] = 0x2206;
  15562. t['infinity'] = 0x221E;
  15563. t['iniarmenian'] = 0x056B;
  15564. t['integral'] = 0x222B;
  15565. t['integralbottom'] = 0x2321;
  15566. t['integralbt'] = 0x2321;
  15567. t['integralex'] = 0xF8F5;
  15568. t['integraltop'] = 0x2320;
  15569. t['integraltp'] = 0x2320;
  15570. t['intersection'] = 0x2229;
  15571. t['intisquare'] = 0x3305;
  15572. t['invbullet'] = 0x25D8;
  15573. t['invcircle'] = 0x25D9;
  15574. t['invsmileface'] = 0x263B;
  15575. t['iocyrillic'] = 0x0451;
  15576. t['iogonek'] = 0x012F;
  15577. t['iota'] = 0x03B9;
  15578. t['iotadieresis'] = 0x03CA;
  15579. t['iotadieresistonos'] = 0x0390;
  15580. t['iotalatin'] = 0x0269;
  15581. t['iotatonos'] = 0x03AF;
  15582. t['iparen'] = 0x24A4;
  15583. t['irigurmukhi'] = 0x0A72;
  15584. t['ismallhiragana'] = 0x3043;
  15585. t['ismallkatakana'] = 0x30A3;
  15586. t['ismallkatakanahalfwidth'] = 0xFF68;
  15587. t['issharbengali'] = 0x09FA;
  15588. t['istroke'] = 0x0268;
  15589. t['isuperior'] = 0xF6ED;
  15590. t['iterationhiragana'] = 0x309D;
  15591. t['iterationkatakana'] = 0x30FD;
  15592. t['itilde'] = 0x0129;
  15593. t['itildebelow'] = 0x1E2D;
  15594. t['iubopomofo'] = 0x3129;
  15595. t['iucyrillic'] = 0x044E;
  15596. t['ivowelsignbengali'] = 0x09BF;
  15597. t['ivowelsigndeva'] = 0x093F;
  15598. t['ivowelsigngujarati'] = 0x0ABF;
  15599. t['izhitsacyrillic'] = 0x0475;
  15600. t['izhitsadblgravecyrillic'] = 0x0477;
  15601. t['j'] = 0x006A;
  15602. t['jaarmenian'] = 0x0571;
  15603. t['jabengali'] = 0x099C;
  15604. t['jadeva'] = 0x091C;
  15605. t['jagujarati'] = 0x0A9C;
  15606. t['jagurmukhi'] = 0x0A1C;
  15607. t['jbopomofo'] = 0x3110;
  15608. t['jcaron'] = 0x01F0;
  15609. t['jcircle'] = 0x24D9;
  15610. t['jcircumflex'] = 0x0135;
  15611. t['jcrossedtail'] = 0x029D;
  15612. t['jdotlessstroke'] = 0x025F;
  15613. t['jecyrillic'] = 0x0458;
  15614. t['jeemarabic'] = 0x062C;
  15615. t['jeemfinalarabic'] = 0xFE9E;
  15616. t['jeeminitialarabic'] = 0xFE9F;
  15617. t['jeemmedialarabic'] = 0xFEA0;
  15618. t['jeharabic'] = 0x0698;
  15619. t['jehfinalarabic'] = 0xFB8B;
  15620. t['jhabengali'] = 0x099D;
  15621. t['jhadeva'] = 0x091D;
  15622. t['jhagujarati'] = 0x0A9D;
  15623. t['jhagurmukhi'] = 0x0A1D;
  15624. t['jheharmenian'] = 0x057B;
  15625. t['jis'] = 0x3004;
  15626. t['jmonospace'] = 0xFF4A;
  15627. t['jparen'] = 0x24A5;
  15628. t['jsuperior'] = 0x02B2;
  15629. t['k'] = 0x006B;
  15630. t['kabashkircyrillic'] = 0x04A1;
  15631. t['kabengali'] = 0x0995;
  15632. t['kacute'] = 0x1E31;
  15633. t['kacyrillic'] = 0x043A;
  15634. t['kadescendercyrillic'] = 0x049B;
  15635. t['kadeva'] = 0x0915;
  15636. t['kaf'] = 0x05DB;
  15637. t['kafarabic'] = 0x0643;
  15638. t['kafdagesh'] = 0xFB3B;
  15639. t['kafdageshhebrew'] = 0xFB3B;
  15640. t['kaffinalarabic'] = 0xFEDA;
  15641. t['kafhebrew'] = 0x05DB;
  15642. t['kafinitialarabic'] = 0xFEDB;
  15643. t['kafmedialarabic'] = 0xFEDC;
  15644. t['kafrafehebrew'] = 0xFB4D;
  15645. t['kagujarati'] = 0x0A95;
  15646. t['kagurmukhi'] = 0x0A15;
  15647. t['kahiragana'] = 0x304B;
  15648. t['kahookcyrillic'] = 0x04C4;
  15649. t['kakatakana'] = 0x30AB;
  15650. t['kakatakanahalfwidth'] = 0xFF76;
  15651. t['kappa'] = 0x03BA;
  15652. t['kappasymbolgreek'] = 0x03F0;
  15653. t['kapyeounmieumkorean'] = 0x3171;
  15654. t['kapyeounphieuphkorean'] = 0x3184;
  15655. t['kapyeounpieupkorean'] = 0x3178;
  15656. t['kapyeounssangpieupkorean'] = 0x3179;
  15657. t['karoriisquare'] = 0x330D;
  15658. t['kashidaautoarabic'] = 0x0640;
  15659. t['kashidaautonosidebearingarabic'] = 0x0640;
  15660. t['kasmallkatakana'] = 0x30F5;
  15661. t['kasquare'] = 0x3384;
  15662. t['kasraarabic'] = 0x0650;
  15663. t['kasratanarabic'] = 0x064D;
  15664. t['kastrokecyrillic'] = 0x049F;
  15665. t['katahiraprolongmarkhalfwidth'] = 0xFF70;
  15666. t['kaverticalstrokecyrillic'] = 0x049D;
  15667. t['kbopomofo'] = 0x310E;
  15668. t['kcalsquare'] = 0x3389;
  15669. t['kcaron'] = 0x01E9;
  15670. t['kcedilla'] = 0x0137;
  15671. t['kcircle'] = 0x24DA;
  15672. t['kcommaaccent'] = 0x0137;
  15673. t['kdotbelow'] = 0x1E33;
  15674. t['keharmenian'] = 0x0584;
  15675. t['kehiragana'] = 0x3051;
  15676. t['kekatakana'] = 0x30B1;
  15677. t['kekatakanahalfwidth'] = 0xFF79;
  15678. t['kenarmenian'] = 0x056F;
  15679. t['kesmallkatakana'] = 0x30F6;
  15680. t['kgreenlandic'] = 0x0138;
  15681. t['khabengali'] = 0x0996;
  15682. t['khacyrillic'] = 0x0445;
  15683. t['khadeva'] = 0x0916;
  15684. t['khagujarati'] = 0x0A96;
  15685. t['khagurmukhi'] = 0x0A16;
  15686. t['khaharabic'] = 0x062E;
  15687. t['khahfinalarabic'] = 0xFEA6;
  15688. t['khahinitialarabic'] = 0xFEA7;
  15689. t['khahmedialarabic'] = 0xFEA8;
  15690. t['kheicoptic'] = 0x03E7;
  15691. t['khhadeva'] = 0x0959;
  15692. t['khhagurmukhi'] = 0x0A59;
  15693. t['khieukhacirclekorean'] = 0x3278;
  15694. t['khieukhaparenkorean'] = 0x3218;
  15695. t['khieukhcirclekorean'] = 0x326A;
  15696. t['khieukhkorean'] = 0x314B;
  15697. t['khieukhparenkorean'] = 0x320A;
  15698. t['khokhaithai'] = 0x0E02;
  15699. t['khokhonthai'] = 0x0E05;
  15700. t['khokhuatthai'] = 0x0E03;
  15701. t['khokhwaithai'] = 0x0E04;
  15702. t['khomutthai'] = 0x0E5B;
  15703. t['khook'] = 0x0199;
  15704. t['khorakhangthai'] = 0x0E06;
  15705. t['khzsquare'] = 0x3391;
  15706. t['kihiragana'] = 0x304D;
  15707. t['kikatakana'] = 0x30AD;
  15708. t['kikatakanahalfwidth'] = 0xFF77;
  15709. t['kiroguramusquare'] = 0x3315;
  15710. t['kiromeetorusquare'] = 0x3316;
  15711. t['kirosquare'] = 0x3314;
  15712. t['kiyeokacirclekorean'] = 0x326E;
  15713. t['kiyeokaparenkorean'] = 0x320E;
  15714. t['kiyeokcirclekorean'] = 0x3260;
  15715. t['kiyeokkorean'] = 0x3131;
  15716. t['kiyeokparenkorean'] = 0x3200;
  15717. t['kiyeoksioskorean'] = 0x3133;
  15718. t['kjecyrillic'] = 0x045C;
  15719. t['klinebelow'] = 0x1E35;
  15720. t['klsquare'] = 0x3398;
  15721. t['kmcubedsquare'] = 0x33A6;
  15722. t['kmonospace'] = 0xFF4B;
  15723. t['kmsquaredsquare'] = 0x33A2;
  15724. t['kohiragana'] = 0x3053;
  15725. t['kohmsquare'] = 0x33C0;
  15726. t['kokaithai'] = 0x0E01;
  15727. t['kokatakana'] = 0x30B3;
  15728. t['kokatakanahalfwidth'] = 0xFF7A;
  15729. t['kooposquare'] = 0x331E;
  15730. t['koppacyrillic'] = 0x0481;
  15731. t['koreanstandardsymbol'] = 0x327F;
  15732. t['koroniscmb'] = 0x0343;
  15733. t['kparen'] = 0x24A6;
  15734. t['kpasquare'] = 0x33AA;
  15735. t['ksicyrillic'] = 0x046F;
  15736. t['ktsquare'] = 0x33CF;
  15737. t['kturned'] = 0x029E;
  15738. t['kuhiragana'] = 0x304F;
  15739. t['kukatakana'] = 0x30AF;
  15740. t['kukatakanahalfwidth'] = 0xFF78;
  15741. t['kvsquare'] = 0x33B8;
  15742. t['kwsquare'] = 0x33BE;
  15743. t['l'] = 0x006C;
  15744. t['labengali'] = 0x09B2;
  15745. t['lacute'] = 0x013A;
  15746. t['ladeva'] = 0x0932;
  15747. t['lagujarati'] = 0x0AB2;
  15748. t['lagurmukhi'] = 0x0A32;
  15749. t['lakkhangyaothai'] = 0x0E45;
  15750. t['lamaleffinalarabic'] = 0xFEFC;
  15751. t['lamalefhamzaabovefinalarabic'] = 0xFEF8;
  15752. t['lamalefhamzaaboveisolatedarabic'] = 0xFEF7;
  15753. t['lamalefhamzabelowfinalarabic'] = 0xFEFA;
  15754. t['lamalefhamzabelowisolatedarabic'] = 0xFEF9;
  15755. t['lamalefisolatedarabic'] = 0xFEFB;
  15756. t['lamalefmaddaabovefinalarabic'] = 0xFEF6;
  15757. t['lamalefmaddaaboveisolatedarabic'] = 0xFEF5;
  15758. t['lamarabic'] = 0x0644;
  15759. t['lambda'] = 0x03BB;
  15760. t['lambdastroke'] = 0x019B;
  15761. t['lamed'] = 0x05DC;
  15762. t['lameddagesh'] = 0xFB3C;
  15763. t['lameddageshhebrew'] = 0xFB3C;
  15764. t['lamedhebrew'] = 0x05DC;
  15765. t['lamfinalarabic'] = 0xFEDE;
  15766. t['lamhahinitialarabic'] = 0xFCCA;
  15767. t['laminitialarabic'] = 0xFEDF;
  15768. t['lamjeeminitialarabic'] = 0xFCC9;
  15769. t['lamkhahinitialarabic'] = 0xFCCB;
  15770. t['lamlamhehisolatedarabic'] = 0xFDF2;
  15771. t['lammedialarabic'] = 0xFEE0;
  15772. t['lammeemhahinitialarabic'] = 0xFD88;
  15773. t['lammeeminitialarabic'] = 0xFCCC;
  15774. t['largecircle'] = 0x25EF;
  15775. t['lbar'] = 0x019A;
  15776. t['lbelt'] = 0x026C;
  15777. t['lbopomofo'] = 0x310C;
  15778. t['lcaron'] = 0x013E;
  15779. t['lcedilla'] = 0x013C;
  15780. t['lcircle'] = 0x24DB;
  15781. t['lcircumflexbelow'] = 0x1E3D;
  15782. t['lcommaaccent'] = 0x013C;
  15783. t['ldot'] = 0x0140;
  15784. t['ldotaccent'] = 0x0140;
  15785. t['ldotbelow'] = 0x1E37;
  15786. t['ldotbelowmacron'] = 0x1E39;
  15787. t['leftangleabovecmb'] = 0x031A;
  15788. t['lefttackbelowcmb'] = 0x0318;
  15789. t['less'] = 0x003C;
  15790. t['lessequal'] = 0x2264;
  15791. t['lessequalorgreater'] = 0x22DA;
  15792. t['lessmonospace'] = 0xFF1C;
  15793. t['lessorequivalent'] = 0x2272;
  15794. t['lessorgreater'] = 0x2276;
  15795. t['lessoverequal'] = 0x2266;
  15796. t['lesssmall'] = 0xFE64;
  15797. t['lezh'] = 0x026E;
  15798. t['lfblock'] = 0x258C;
  15799. t['lhookretroflex'] = 0x026D;
  15800. t['lira'] = 0x20A4;
  15801. t['liwnarmenian'] = 0x056C;
  15802. t['lj'] = 0x01C9;
  15803. t['ljecyrillic'] = 0x0459;
  15804. t['ll'] = 0xF6C0;
  15805. t['lladeva'] = 0x0933;
  15806. t['llagujarati'] = 0x0AB3;
  15807. t['llinebelow'] = 0x1E3B;
  15808. t['llladeva'] = 0x0934;
  15809. t['llvocalicbengali'] = 0x09E1;
  15810. t['llvocalicdeva'] = 0x0961;
  15811. t['llvocalicvowelsignbengali'] = 0x09E3;
  15812. t['llvocalicvowelsigndeva'] = 0x0963;
  15813. t['lmiddletilde'] = 0x026B;
  15814. t['lmonospace'] = 0xFF4C;
  15815. t['lmsquare'] = 0x33D0;
  15816. t['lochulathai'] = 0x0E2C;
  15817. t['logicaland'] = 0x2227;
  15818. t['logicalnot'] = 0x00AC;
  15819. t['logicalnotreversed'] = 0x2310;
  15820. t['logicalor'] = 0x2228;
  15821. t['lolingthai'] = 0x0E25;
  15822. t['longs'] = 0x017F;
  15823. t['lowlinecenterline'] = 0xFE4E;
  15824. t['lowlinecmb'] = 0x0332;
  15825. t['lowlinedashed'] = 0xFE4D;
  15826. t['lozenge'] = 0x25CA;
  15827. t['lparen'] = 0x24A7;
  15828. t['lslash'] = 0x0142;
  15829. t['lsquare'] = 0x2113;
  15830. t['lsuperior'] = 0xF6EE;
  15831. t['ltshade'] = 0x2591;
  15832. t['luthai'] = 0x0E26;
  15833. t['lvocalicbengali'] = 0x098C;
  15834. t['lvocalicdeva'] = 0x090C;
  15835. t['lvocalicvowelsignbengali'] = 0x09E2;
  15836. t['lvocalicvowelsigndeva'] = 0x0962;
  15837. t['lxsquare'] = 0x33D3;
  15838. t['m'] = 0x006D;
  15839. t['mabengali'] = 0x09AE;
  15840. t['macron'] = 0x00AF;
  15841. t['macronbelowcmb'] = 0x0331;
  15842. t['macroncmb'] = 0x0304;
  15843. t['macronlowmod'] = 0x02CD;
  15844. t['macronmonospace'] = 0xFFE3;
  15845. t['macute'] = 0x1E3F;
  15846. t['madeva'] = 0x092E;
  15847. t['magujarati'] = 0x0AAE;
  15848. t['magurmukhi'] = 0x0A2E;
  15849. t['mahapakhhebrew'] = 0x05A4;
  15850. t['mahapakhlefthebrew'] = 0x05A4;
  15851. t['mahiragana'] = 0x307E;
  15852. t['maichattawalowleftthai'] = 0xF895;
  15853. t['maichattawalowrightthai'] = 0xF894;
  15854. t['maichattawathai'] = 0x0E4B;
  15855. t['maichattawaupperleftthai'] = 0xF893;
  15856. t['maieklowleftthai'] = 0xF88C;
  15857. t['maieklowrightthai'] = 0xF88B;
  15858. t['maiekthai'] = 0x0E48;
  15859. t['maiekupperleftthai'] = 0xF88A;
  15860. t['maihanakatleftthai'] = 0xF884;
  15861. t['maihanakatthai'] = 0x0E31;
  15862. t['maitaikhuleftthai'] = 0xF889;
  15863. t['maitaikhuthai'] = 0x0E47;
  15864. t['maitholowleftthai'] = 0xF88F;
  15865. t['maitholowrightthai'] = 0xF88E;
  15866. t['maithothai'] = 0x0E49;
  15867. t['maithoupperleftthai'] = 0xF88D;
  15868. t['maitrilowleftthai'] = 0xF892;
  15869. t['maitrilowrightthai'] = 0xF891;
  15870. t['maitrithai'] = 0x0E4A;
  15871. t['maitriupperleftthai'] = 0xF890;
  15872. t['maiyamokthai'] = 0x0E46;
  15873. t['makatakana'] = 0x30DE;
  15874. t['makatakanahalfwidth'] = 0xFF8F;
  15875. t['male'] = 0x2642;
  15876. t['mansyonsquare'] = 0x3347;
  15877. t['maqafhebrew'] = 0x05BE;
  15878. t['mars'] = 0x2642;
  15879. t['masoracirclehebrew'] = 0x05AF;
  15880. t['masquare'] = 0x3383;
  15881. t['mbopomofo'] = 0x3107;
  15882. t['mbsquare'] = 0x33D4;
  15883. t['mcircle'] = 0x24DC;
  15884. t['mcubedsquare'] = 0x33A5;
  15885. t['mdotaccent'] = 0x1E41;
  15886. t['mdotbelow'] = 0x1E43;
  15887. t['meemarabic'] = 0x0645;
  15888. t['meemfinalarabic'] = 0xFEE2;
  15889. t['meeminitialarabic'] = 0xFEE3;
  15890. t['meemmedialarabic'] = 0xFEE4;
  15891. t['meemmeeminitialarabic'] = 0xFCD1;
  15892. t['meemmeemisolatedarabic'] = 0xFC48;
  15893. t['meetorusquare'] = 0x334D;
  15894. t['mehiragana'] = 0x3081;
  15895. t['meizierasquare'] = 0x337E;
  15896. t['mekatakana'] = 0x30E1;
  15897. t['mekatakanahalfwidth'] = 0xFF92;
  15898. t['mem'] = 0x05DE;
  15899. t['memdagesh'] = 0xFB3E;
  15900. t['memdageshhebrew'] = 0xFB3E;
  15901. t['memhebrew'] = 0x05DE;
  15902. t['menarmenian'] = 0x0574;
  15903. t['merkhahebrew'] = 0x05A5;
  15904. t['merkhakefulahebrew'] = 0x05A6;
  15905. t['merkhakefulalefthebrew'] = 0x05A6;
  15906. t['merkhalefthebrew'] = 0x05A5;
  15907. t['mhook'] = 0x0271;
  15908. t['mhzsquare'] = 0x3392;
  15909. t['middledotkatakanahalfwidth'] = 0xFF65;
  15910. t['middot'] = 0x00B7;
  15911. t['mieumacirclekorean'] = 0x3272;
  15912. t['mieumaparenkorean'] = 0x3212;
  15913. t['mieumcirclekorean'] = 0x3264;
  15914. t['mieumkorean'] = 0x3141;
  15915. t['mieumpansioskorean'] = 0x3170;
  15916. t['mieumparenkorean'] = 0x3204;
  15917. t['mieumpieupkorean'] = 0x316E;
  15918. t['mieumsioskorean'] = 0x316F;
  15919. t['mihiragana'] = 0x307F;
  15920. t['mikatakana'] = 0x30DF;
  15921. t['mikatakanahalfwidth'] = 0xFF90;
  15922. t['minus'] = 0x2212;
  15923. t['minusbelowcmb'] = 0x0320;
  15924. t['minuscircle'] = 0x2296;
  15925. t['minusmod'] = 0x02D7;
  15926. t['minusplus'] = 0x2213;
  15927. t['minute'] = 0x2032;
  15928. t['miribaarusquare'] = 0x334A;
  15929. t['mirisquare'] = 0x3349;
  15930. t['mlonglegturned'] = 0x0270;
  15931. t['mlsquare'] = 0x3396;
  15932. t['mmcubedsquare'] = 0x33A3;
  15933. t['mmonospace'] = 0xFF4D;
  15934. t['mmsquaredsquare'] = 0x339F;
  15935. t['mohiragana'] = 0x3082;
  15936. t['mohmsquare'] = 0x33C1;
  15937. t['mokatakana'] = 0x30E2;
  15938. t['mokatakanahalfwidth'] = 0xFF93;
  15939. t['molsquare'] = 0x33D6;
  15940. t['momathai'] = 0x0E21;
  15941. t['moverssquare'] = 0x33A7;
  15942. t['moverssquaredsquare'] = 0x33A8;
  15943. t['mparen'] = 0x24A8;
  15944. t['mpasquare'] = 0x33AB;
  15945. t['mssquare'] = 0x33B3;
  15946. t['msuperior'] = 0xF6EF;
  15947. t['mturned'] = 0x026F;
  15948. t['mu'] = 0x00B5;
  15949. t['mu1'] = 0x00B5;
  15950. t['muasquare'] = 0x3382;
  15951. t['muchgreater'] = 0x226B;
  15952. t['muchless'] = 0x226A;
  15953. t['mufsquare'] = 0x338C;
  15954. t['mugreek'] = 0x03BC;
  15955. t['mugsquare'] = 0x338D;
  15956. t['muhiragana'] = 0x3080;
  15957. t['mukatakana'] = 0x30E0;
  15958. t['mukatakanahalfwidth'] = 0xFF91;
  15959. t['mulsquare'] = 0x3395;
  15960. t['multiply'] = 0x00D7;
  15961. t['mumsquare'] = 0x339B;
  15962. t['munahhebrew'] = 0x05A3;
  15963. t['munahlefthebrew'] = 0x05A3;
  15964. t['musicalnote'] = 0x266A;
  15965. t['musicalnotedbl'] = 0x266B;
  15966. t['musicflatsign'] = 0x266D;
  15967. t['musicsharpsign'] = 0x266F;
  15968. t['mussquare'] = 0x33B2;
  15969. t['muvsquare'] = 0x33B6;
  15970. t['muwsquare'] = 0x33BC;
  15971. t['mvmegasquare'] = 0x33B9;
  15972. t['mvsquare'] = 0x33B7;
  15973. t['mwmegasquare'] = 0x33BF;
  15974. t['mwsquare'] = 0x33BD;
  15975. t['n'] = 0x006E;
  15976. t['nabengali'] = 0x09A8;
  15977. t['nabla'] = 0x2207;
  15978. t['nacute'] = 0x0144;
  15979. t['nadeva'] = 0x0928;
  15980. t['nagujarati'] = 0x0AA8;
  15981. t['nagurmukhi'] = 0x0A28;
  15982. t['nahiragana'] = 0x306A;
  15983. t['nakatakana'] = 0x30CA;
  15984. t['nakatakanahalfwidth'] = 0xFF85;
  15985. t['napostrophe'] = 0x0149;
  15986. t['nasquare'] = 0x3381;
  15987. t['nbopomofo'] = 0x310B;
  15988. t['nbspace'] = 0x00A0;
  15989. t['ncaron'] = 0x0148;
  15990. t['ncedilla'] = 0x0146;
  15991. t['ncircle'] = 0x24DD;
  15992. t['ncircumflexbelow'] = 0x1E4B;
  15993. t['ncommaaccent'] = 0x0146;
  15994. t['ndotaccent'] = 0x1E45;
  15995. t['ndotbelow'] = 0x1E47;
  15996. t['nehiragana'] = 0x306D;
  15997. t['nekatakana'] = 0x30CD;
  15998. t['nekatakanahalfwidth'] = 0xFF88;
  15999. t['newsheqelsign'] = 0x20AA;
  16000. t['nfsquare'] = 0x338B;
  16001. t['ngabengali'] = 0x0999;
  16002. t['ngadeva'] = 0x0919;
  16003. t['ngagujarati'] = 0x0A99;
  16004. t['ngagurmukhi'] = 0x0A19;
  16005. t['ngonguthai'] = 0x0E07;
  16006. t['nhiragana'] = 0x3093;
  16007. t['nhookleft'] = 0x0272;
  16008. t['nhookretroflex'] = 0x0273;
  16009. t['nieunacirclekorean'] = 0x326F;
  16010. t['nieunaparenkorean'] = 0x320F;
  16011. t['nieuncieuckorean'] = 0x3135;
  16012. t['nieuncirclekorean'] = 0x3261;
  16013. t['nieunhieuhkorean'] = 0x3136;
  16014. t['nieunkorean'] = 0x3134;
  16015. t['nieunpansioskorean'] = 0x3168;
  16016. t['nieunparenkorean'] = 0x3201;
  16017. t['nieunsioskorean'] = 0x3167;
  16018. t['nieuntikeutkorean'] = 0x3166;
  16019. t['nihiragana'] = 0x306B;
  16020. t['nikatakana'] = 0x30CB;
  16021. t['nikatakanahalfwidth'] = 0xFF86;
  16022. t['nikhahitleftthai'] = 0xF899;
  16023. t['nikhahitthai'] = 0x0E4D;
  16024. t['nine'] = 0x0039;
  16025. t['ninearabic'] = 0x0669;
  16026. t['ninebengali'] = 0x09EF;
  16027. t['ninecircle'] = 0x2468;
  16028. t['ninecircleinversesansserif'] = 0x2792;
  16029. t['ninedeva'] = 0x096F;
  16030. t['ninegujarati'] = 0x0AEF;
  16031. t['ninegurmukhi'] = 0x0A6F;
  16032. t['ninehackarabic'] = 0x0669;
  16033. t['ninehangzhou'] = 0x3029;
  16034. t['nineideographicparen'] = 0x3228;
  16035. t['nineinferior'] = 0x2089;
  16036. t['ninemonospace'] = 0xFF19;
  16037. t['nineoldstyle'] = 0xF739;
  16038. t['nineparen'] = 0x247C;
  16039. t['nineperiod'] = 0x2490;
  16040. t['ninepersian'] = 0x06F9;
  16041. t['nineroman'] = 0x2178;
  16042. t['ninesuperior'] = 0x2079;
  16043. t['nineteencircle'] = 0x2472;
  16044. t['nineteenparen'] = 0x2486;
  16045. t['nineteenperiod'] = 0x249A;
  16046. t['ninethai'] = 0x0E59;
  16047. t['nj'] = 0x01CC;
  16048. t['njecyrillic'] = 0x045A;
  16049. t['nkatakana'] = 0x30F3;
  16050. t['nkatakanahalfwidth'] = 0xFF9D;
  16051. t['nlegrightlong'] = 0x019E;
  16052. t['nlinebelow'] = 0x1E49;
  16053. t['nmonospace'] = 0xFF4E;
  16054. t['nmsquare'] = 0x339A;
  16055. t['nnabengali'] = 0x09A3;
  16056. t['nnadeva'] = 0x0923;
  16057. t['nnagujarati'] = 0x0AA3;
  16058. t['nnagurmukhi'] = 0x0A23;
  16059. t['nnnadeva'] = 0x0929;
  16060. t['nohiragana'] = 0x306E;
  16061. t['nokatakana'] = 0x30CE;
  16062. t['nokatakanahalfwidth'] = 0xFF89;
  16063. t['nonbreakingspace'] = 0x00A0;
  16064. t['nonenthai'] = 0x0E13;
  16065. t['nonuthai'] = 0x0E19;
  16066. t['noonarabic'] = 0x0646;
  16067. t['noonfinalarabic'] = 0xFEE6;
  16068. t['noonghunnaarabic'] = 0x06BA;
  16069. t['noonghunnafinalarabic'] = 0xFB9F;
  16070. t['nooninitialarabic'] = 0xFEE7;
  16071. t['noonjeeminitialarabic'] = 0xFCD2;
  16072. t['noonjeemisolatedarabic'] = 0xFC4B;
  16073. t['noonmedialarabic'] = 0xFEE8;
  16074. t['noonmeeminitialarabic'] = 0xFCD5;
  16075. t['noonmeemisolatedarabic'] = 0xFC4E;
  16076. t['noonnoonfinalarabic'] = 0xFC8D;
  16077. t['notcontains'] = 0x220C;
  16078. t['notelement'] = 0x2209;
  16079. t['notelementof'] = 0x2209;
  16080. t['notequal'] = 0x2260;
  16081. t['notgreater'] = 0x226F;
  16082. t['notgreaternorequal'] = 0x2271;
  16083. t['notgreaternorless'] = 0x2279;
  16084. t['notidentical'] = 0x2262;
  16085. t['notless'] = 0x226E;
  16086. t['notlessnorequal'] = 0x2270;
  16087. t['notparallel'] = 0x2226;
  16088. t['notprecedes'] = 0x2280;
  16089. t['notsubset'] = 0x2284;
  16090. t['notsucceeds'] = 0x2281;
  16091. t['notsuperset'] = 0x2285;
  16092. t['nowarmenian'] = 0x0576;
  16093. t['nparen'] = 0x24A9;
  16094. t['nssquare'] = 0x33B1;
  16095. t['nsuperior'] = 0x207F;
  16096. t['ntilde'] = 0x00F1;
  16097. t['nu'] = 0x03BD;
  16098. t['nuhiragana'] = 0x306C;
  16099. t['nukatakana'] = 0x30CC;
  16100. t['nukatakanahalfwidth'] = 0xFF87;
  16101. t['nuktabengali'] = 0x09BC;
  16102. t['nuktadeva'] = 0x093C;
  16103. t['nuktagujarati'] = 0x0ABC;
  16104. t['nuktagurmukhi'] = 0x0A3C;
  16105. t['numbersign'] = 0x0023;
  16106. t['numbersignmonospace'] = 0xFF03;
  16107. t['numbersignsmall'] = 0xFE5F;
  16108. t['numeralsigngreek'] = 0x0374;
  16109. t['numeralsignlowergreek'] = 0x0375;
  16110. t['numero'] = 0x2116;
  16111. t['nun'] = 0x05E0;
  16112. t['nundagesh'] = 0xFB40;
  16113. t['nundageshhebrew'] = 0xFB40;
  16114. t['nunhebrew'] = 0x05E0;
  16115. t['nvsquare'] = 0x33B5;
  16116. t['nwsquare'] = 0x33BB;
  16117. t['nyabengali'] = 0x099E;
  16118. t['nyadeva'] = 0x091E;
  16119. t['nyagujarati'] = 0x0A9E;
  16120. t['nyagurmukhi'] = 0x0A1E;
  16121. t['o'] = 0x006F;
  16122. t['oacute'] = 0x00F3;
  16123. t['oangthai'] = 0x0E2D;
  16124. t['obarred'] = 0x0275;
  16125. t['obarredcyrillic'] = 0x04E9;
  16126. t['obarreddieresiscyrillic'] = 0x04EB;
  16127. t['obengali'] = 0x0993;
  16128. t['obopomofo'] = 0x311B;
  16129. t['obreve'] = 0x014F;
  16130. t['ocandradeva'] = 0x0911;
  16131. t['ocandragujarati'] = 0x0A91;
  16132. t['ocandravowelsigndeva'] = 0x0949;
  16133. t['ocandravowelsigngujarati'] = 0x0AC9;
  16134. t['ocaron'] = 0x01D2;
  16135. t['ocircle'] = 0x24DE;
  16136. t['ocircumflex'] = 0x00F4;
  16137. t['ocircumflexacute'] = 0x1ED1;
  16138. t['ocircumflexdotbelow'] = 0x1ED9;
  16139. t['ocircumflexgrave'] = 0x1ED3;
  16140. t['ocircumflexhookabove'] = 0x1ED5;
  16141. t['ocircumflextilde'] = 0x1ED7;
  16142. t['ocyrillic'] = 0x043E;
  16143. t['odblacute'] = 0x0151;
  16144. t['odblgrave'] = 0x020D;
  16145. t['odeva'] = 0x0913;
  16146. t['odieresis'] = 0x00F6;
  16147. t['odieresiscyrillic'] = 0x04E7;
  16148. t['odotbelow'] = 0x1ECD;
  16149. t['oe'] = 0x0153;
  16150. t['oekorean'] = 0x315A;
  16151. t['ogonek'] = 0x02DB;
  16152. t['ogonekcmb'] = 0x0328;
  16153. t['ograve'] = 0x00F2;
  16154. t['ogujarati'] = 0x0A93;
  16155. t['oharmenian'] = 0x0585;
  16156. t['ohiragana'] = 0x304A;
  16157. t['ohookabove'] = 0x1ECF;
  16158. t['ohorn'] = 0x01A1;
  16159. t['ohornacute'] = 0x1EDB;
  16160. t['ohorndotbelow'] = 0x1EE3;
  16161. t['ohorngrave'] = 0x1EDD;
  16162. t['ohornhookabove'] = 0x1EDF;
  16163. t['ohorntilde'] = 0x1EE1;
  16164. t['ohungarumlaut'] = 0x0151;
  16165. t['oi'] = 0x01A3;
  16166. t['oinvertedbreve'] = 0x020F;
  16167. t['okatakana'] = 0x30AA;
  16168. t['okatakanahalfwidth'] = 0xFF75;
  16169. t['okorean'] = 0x3157;
  16170. t['olehebrew'] = 0x05AB;
  16171. t['omacron'] = 0x014D;
  16172. t['omacronacute'] = 0x1E53;
  16173. t['omacrongrave'] = 0x1E51;
  16174. t['omdeva'] = 0x0950;
  16175. t['omega'] = 0x03C9;
  16176. t['omega1'] = 0x03D6;
  16177. t['omegacyrillic'] = 0x0461;
  16178. t['omegalatinclosed'] = 0x0277;
  16179. t['omegaroundcyrillic'] = 0x047B;
  16180. t['omegatitlocyrillic'] = 0x047D;
  16181. t['omegatonos'] = 0x03CE;
  16182. t['omgujarati'] = 0x0AD0;
  16183. t['omicron'] = 0x03BF;
  16184. t['omicrontonos'] = 0x03CC;
  16185. t['omonospace'] = 0xFF4F;
  16186. t['one'] = 0x0031;
  16187. t['onearabic'] = 0x0661;
  16188. t['onebengali'] = 0x09E7;
  16189. t['onecircle'] = 0x2460;
  16190. t['onecircleinversesansserif'] = 0x278A;
  16191. t['onedeva'] = 0x0967;
  16192. t['onedotenleader'] = 0x2024;
  16193. t['oneeighth'] = 0x215B;
  16194. t['onefitted'] = 0xF6DC;
  16195. t['onegujarati'] = 0x0AE7;
  16196. t['onegurmukhi'] = 0x0A67;
  16197. t['onehackarabic'] = 0x0661;
  16198. t['onehalf'] = 0x00BD;
  16199. t['onehangzhou'] = 0x3021;
  16200. t['oneideographicparen'] = 0x3220;
  16201. t['oneinferior'] = 0x2081;
  16202. t['onemonospace'] = 0xFF11;
  16203. t['onenumeratorbengali'] = 0x09F4;
  16204. t['oneoldstyle'] = 0xF731;
  16205. t['oneparen'] = 0x2474;
  16206. t['oneperiod'] = 0x2488;
  16207. t['onepersian'] = 0x06F1;
  16208. t['onequarter'] = 0x00BC;
  16209. t['oneroman'] = 0x2170;
  16210. t['onesuperior'] = 0x00B9;
  16211. t['onethai'] = 0x0E51;
  16212. t['onethird'] = 0x2153;
  16213. t['oogonek'] = 0x01EB;
  16214. t['oogonekmacron'] = 0x01ED;
  16215. t['oogurmukhi'] = 0x0A13;
  16216. t['oomatragurmukhi'] = 0x0A4B;
  16217. t['oopen'] = 0x0254;
  16218. t['oparen'] = 0x24AA;
  16219. t['openbullet'] = 0x25E6;
  16220. t['option'] = 0x2325;
  16221. t['ordfeminine'] = 0x00AA;
  16222. t['ordmasculine'] = 0x00BA;
  16223. t['orthogonal'] = 0x221F;
  16224. t['oshortdeva'] = 0x0912;
  16225. t['oshortvowelsigndeva'] = 0x094A;
  16226. t['oslash'] = 0x00F8;
  16227. t['oslashacute'] = 0x01FF;
  16228. t['osmallhiragana'] = 0x3049;
  16229. t['osmallkatakana'] = 0x30A9;
  16230. t['osmallkatakanahalfwidth'] = 0xFF6B;
  16231. t['ostrokeacute'] = 0x01FF;
  16232. t['osuperior'] = 0xF6F0;
  16233. t['otcyrillic'] = 0x047F;
  16234. t['otilde'] = 0x00F5;
  16235. t['otildeacute'] = 0x1E4D;
  16236. t['otildedieresis'] = 0x1E4F;
  16237. t['oubopomofo'] = 0x3121;
  16238. t['overline'] = 0x203E;
  16239. t['overlinecenterline'] = 0xFE4A;
  16240. t['overlinecmb'] = 0x0305;
  16241. t['overlinedashed'] = 0xFE49;
  16242. t['overlinedblwavy'] = 0xFE4C;
  16243. t['overlinewavy'] = 0xFE4B;
  16244. t['overscore'] = 0x00AF;
  16245. t['ovowelsignbengali'] = 0x09CB;
  16246. t['ovowelsigndeva'] = 0x094B;
  16247. t['ovowelsigngujarati'] = 0x0ACB;
  16248. t['p'] = 0x0070;
  16249. t['paampssquare'] = 0x3380;
  16250. t['paasentosquare'] = 0x332B;
  16251. t['pabengali'] = 0x09AA;
  16252. t['pacute'] = 0x1E55;
  16253. t['padeva'] = 0x092A;
  16254. t['pagedown'] = 0x21DF;
  16255. t['pageup'] = 0x21DE;
  16256. t['pagujarati'] = 0x0AAA;
  16257. t['pagurmukhi'] = 0x0A2A;
  16258. t['pahiragana'] = 0x3071;
  16259. t['paiyannoithai'] = 0x0E2F;
  16260. t['pakatakana'] = 0x30D1;
  16261. t['palatalizationcyrilliccmb'] = 0x0484;
  16262. t['palochkacyrillic'] = 0x04C0;
  16263. t['pansioskorean'] = 0x317F;
  16264. t['paragraph'] = 0x00B6;
  16265. t['parallel'] = 0x2225;
  16266. t['parenleft'] = 0x0028;
  16267. t['parenleftaltonearabic'] = 0xFD3E;
  16268. t['parenleftbt'] = 0xF8ED;
  16269. t['parenleftex'] = 0xF8EC;
  16270. t['parenleftinferior'] = 0x208D;
  16271. t['parenleftmonospace'] = 0xFF08;
  16272. t['parenleftsmall'] = 0xFE59;
  16273. t['parenleftsuperior'] = 0x207D;
  16274. t['parenlefttp'] = 0xF8EB;
  16275. t['parenleftvertical'] = 0xFE35;
  16276. t['parenright'] = 0x0029;
  16277. t['parenrightaltonearabic'] = 0xFD3F;
  16278. t['parenrightbt'] = 0xF8F8;
  16279. t['parenrightex'] = 0xF8F7;
  16280. t['parenrightinferior'] = 0x208E;
  16281. t['parenrightmonospace'] = 0xFF09;
  16282. t['parenrightsmall'] = 0xFE5A;
  16283. t['parenrightsuperior'] = 0x207E;
  16284. t['parenrighttp'] = 0xF8F6;
  16285. t['parenrightvertical'] = 0xFE36;
  16286. t['partialdiff'] = 0x2202;
  16287. t['paseqhebrew'] = 0x05C0;
  16288. t['pashtahebrew'] = 0x0599;
  16289. t['pasquare'] = 0x33A9;
  16290. t['patah'] = 0x05B7;
  16291. t['patah11'] = 0x05B7;
  16292. t['patah1d'] = 0x05B7;
  16293. t['patah2a'] = 0x05B7;
  16294. t['patahhebrew'] = 0x05B7;
  16295. t['patahnarrowhebrew'] = 0x05B7;
  16296. t['patahquarterhebrew'] = 0x05B7;
  16297. t['patahwidehebrew'] = 0x05B7;
  16298. t['pazerhebrew'] = 0x05A1;
  16299. t['pbopomofo'] = 0x3106;
  16300. t['pcircle'] = 0x24DF;
  16301. t['pdotaccent'] = 0x1E57;
  16302. t['pe'] = 0x05E4;
  16303. t['pecyrillic'] = 0x043F;
  16304. t['pedagesh'] = 0xFB44;
  16305. t['pedageshhebrew'] = 0xFB44;
  16306. t['peezisquare'] = 0x333B;
  16307. t['pefinaldageshhebrew'] = 0xFB43;
  16308. t['peharabic'] = 0x067E;
  16309. t['peharmenian'] = 0x057A;
  16310. t['pehebrew'] = 0x05E4;
  16311. t['pehfinalarabic'] = 0xFB57;
  16312. t['pehinitialarabic'] = 0xFB58;
  16313. t['pehiragana'] = 0x307A;
  16314. t['pehmedialarabic'] = 0xFB59;
  16315. t['pekatakana'] = 0x30DA;
  16316. t['pemiddlehookcyrillic'] = 0x04A7;
  16317. t['perafehebrew'] = 0xFB4E;
  16318. t['percent'] = 0x0025;
  16319. t['percentarabic'] = 0x066A;
  16320. t['percentmonospace'] = 0xFF05;
  16321. t['percentsmall'] = 0xFE6A;
  16322. t['period'] = 0x002E;
  16323. t['periodarmenian'] = 0x0589;
  16324. t['periodcentered'] = 0x00B7;
  16325. t['periodhalfwidth'] = 0xFF61;
  16326. t['periodinferior'] = 0xF6E7;
  16327. t['periodmonospace'] = 0xFF0E;
  16328. t['periodsmall'] = 0xFE52;
  16329. t['periodsuperior'] = 0xF6E8;
  16330. t['perispomenigreekcmb'] = 0x0342;
  16331. t['perpendicular'] = 0x22A5;
  16332. t['perthousand'] = 0x2030;
  16333. t['peseta'] = 0x20A7;
  16334. t['pfsquare'] = 0x338A;
  16335. t['phabengali'] = 0x09AB;
  16336. t['phadeva'] = 0x092B;
  16337. t['phagujarati'] = 0x0AAB;
  16338. t['phagurmukhi'] = 0x0A2B;
  16339. t['phi'] = 0x03C6;
  16340. t['phi1'] = 0x03D5;
  16341. t['phieuphacirclekorean'] = 0x327A;
  16342. t['phieuphaparenkorean'] = 0x321A;
  16343. t['phieuphcirclekorean'] = 0x326C;
  16344. t['phieuphkorean'] = 0x314D;
  16345. t['phieuphparenkorean'] = 0x320C;
  16346. t['philatin'] = 0x0278;
  16347. t['phinthuthai'] = 0x0E3A;
  16348. t['phisymbolgreek'] = 0x03D5;
  16349. t['phook'] = 0x01A5;
  16350. t['phophanthai'] = 0x0E1E;
  16351. t['phophungthai'] = 0x0E1C;
  16352. t['phosamphaothai'] = 0x0E20;
  16353. t['pi'] = 0x03C0;
  16354. t['pieupacirclekorean'] = 0x3273;
  16355. t['pieupaparenkorean'] = 0x3213;
  16356. t['pieupcieuckorean'] = 0x3176;
  16357. t['pieupcirclekorean'] = 0x3265;
  16358. t['pieupkiyeokkorean'] = 0x3172;
  16359. t['pieupkorean'] = 0x3142;
  16360. t['pieupparenkorean'] = 0x3205;
  16361. t['pieupsioskiyeokkorean'] = 0x3174;
  16362. t['pieupsioskorean'] = 0x3144;
  16363. t['pieupsiostikeutkorean'] = 0x3175;
  16364. t['pieupthieuthkorean'] = 0x3177;
  16365. t['pieuptikeutkorean'] = 0x3173;
  16366. t['pihiragana'] = 0x3074;
  16367. t['pikatakana'] = 0x30D4;
  16368. t['pisymbolgreek'] = 0x03D6;
  16369. t['piwrarmenian'] = 0x0583;
  16370. t['plus'] = 0x002B;
  16371. t['plusbelowcmb'] = 0x031F;
  16372. t['pluscircle'] = 0x2295;
  16373. t['plusminus'] = 0x00B1;
  16374. t['plusmod'] = 0x02D6;
  16375. t['plusmonospace'] = 0xFF0B;
  16376. t['plussmall'] = 0xFE62;
  16377. t['plussuperior'] = 0x207A;
  16378. t['pmonospace'] = 0xFF50;
  16379. t['pmsquare'] = 0x33D8;
  16380. t['pohiragana'] = 0x307D;
  16381. t['pointingindexdownwhite'] = 0x261F;
  16382. t['pointingindexleftwhite'] = 0x261C;
  16383. t['pointingindexrightwhite'] = 0x261E;
  16384. t['pointingindexupwhite'] = 0x261D;
  16385. t['pokatakana'] = 0x30DD;
  16386. t['poplathai'] = 0x0E1B;
  16387. t['postalmark'] = 0x3012;
  16388. t['postalmarkface'] = 0x3020;
  16389. t['pparen'] = 0x24AB;
  16390. t['precedes'] = 0x227A;
  16391. t['prescription'] = 0x211E;
  16392. t['primemod'] = 0x02B9;
  16393. t['primereversed'] = 0x2035;
  16394. t['product'] = 0x220F;
  16395. t['projective'] = 0x2305;
  16396. t['prolongedkana'] = 0x30FC;
  16397. t['propellor'] = 0x2318;
  16398. t['propersubset'] = 0x2282;
  16399. t['propersuperset'] = 0x2283;
  16400. t['proportion'] = 0x2237;
  16401. t['proportional'] = 0x221D;
  16402. t['psi'] = 0x03C8;
  16403. t['psicyrillic'] = 0x0471;
  16404. t['psilipneumatacyrilliccmb'] = 0x0486;
  16405. t['pssquare'] = 0x33B0;
  16406. t['puhiragana'] = 0x3077;
  16407. t['pukatakana'] = 0x30D7;
  16408. t['pvsquare'] = 0x33B4;
  16409. t['pwsquare'] = 0x33BA;
  16410. t['q'] = 0x0071;
  16411. t['qadeva'] = 0x0958;
  16412. t['qadmahebrew'] = 0x05A8;
  16413. t['qafarabic'] = 0x0642;
  16414. t['qaffinalarabic'] = 0xFED6;
  16415. t['qafinitialarabic'] = 0xFED7;
  16416. t['qafmedialarabic'] = 0xFED8;
  16417. t['qamats'] = 0x05B8;
  16418. t['qamats10'] = 0x05B8;
  16419. t['qamats1a'] = 0x05B8;
  16420. t['qamats1c'] = 0x05B8;
  16421. t['qamats27'] = 0x05B8;
  16422. t['qamats29'] = 0x05B8;
  16423. t['qamats33'] = 0x05B8;
  16424. t['qamatsde'] = 0x05B8;
  16425. t['qamatshebrew'] = 0x05B8;
  16426. t['qamatsnarrowhebrew'] = 0x05B8;
  16427. t['qamatsqatanhebrew'] = 0x05B8;
  16428. t['qamatsqatannarrowhebrew'] = 0x05B8;
  16429. t['qamatsqatanquarterhebrew'] = 0x05B8;
  16430. t['qamatsqatanwidehebrew'] = 0x05B8;
  16431. t['qamatsquarterhebrew'] = 0x05B8;
  16432. t['qamatswidehebrew'] = 0x05B8;
  16433. t['qarneyparahebrew'] = 0x059F;
  16434. t['qbopomofo'] = 0x3111;
  16435. t['qcircle'] = 0x24E0;
  16436. t['qhook'] = 0x02A0;
  16437. t['qmonospace'] = 0xFF51;
  16438. t['qof'] = 0x05E7;
  16439. t['qofdagesh'] = 0xFB47;
  16440. t['qofdageshhebrew'] = 0xFB47;
  16441. t['qofhebrew'] = 0x05E7;
  16442. t['qparen'] = 0x24AC;
  16443. t['quarternote'] = 0x2669;
  16444. t['qubuts'] = 0x05BB;
  16445. t['qubuts18'] = 0x05BB;
  16446. t['qubuts25'] = 0x05BB;
  16447. t['qubuts31'] = 0x05BB;
  16448. t['qubutshebrew'] = 0x05BB;
  16449. t['qubutsnarrowhebrew'] = 0x05BB;
  16450. t['qubutsquarterhebrew'] = 0x05BB;
  16451. t['qubutswidehebrew'] = 0x05BB;
  16452. t['question'] = 0x003F;
  16453. t['questionarabic'] = 0x061F;
  16454. t['questionarmenian'] = 0x055E;
  16455. t['questiondown'] = 0x00BF;
  16456. t['questiondownsmall'] = 0xF7BF;
  16457. t['questiongreek'] = 0x037E;
  16458. t['questionmonospace'] = 0xFF1F;
  16459. t['questionsmall'] = 0xF73F;
  16460. t['quotedbl'] = 0x0022;
  16461. t['quotedblbase'] = 0x201E;
  16462. t['quotedblleft'] = 0x201C;
  16463. t['quotedblmonospace'] = 0xFF02;
  16464. t['quotedblprime'] = 0x301E;
  16465. t['quotedblprimereversed'] = 0x301D;
  16466. t['quotedblright'] = 0x201D;
  16467. t['quoteleft'] = 0x2018;
  16468. t['quoteleftreversed'] = 0x201B;
  16469. t['quotereversed'] = 0x201B;
  16470. t['quoteright'] = 0x2019;
  16471. t['quoterightn'] = 0x0149;
  16472. t['quotesinglbase'] = 0x201A;
  16473. t['quotesingle'] = 0x0027;
  16474. t['quotesinglemonospace'] = 0xFF07;
  16475. t['r'] = 0x0072;
  16476. t['raarmenian'] = 0x057C;
  16477. t['rabengali'] = 0x09B0;
  16478. t['racute'] = 0x0155;
  16479. t['radeva'] = 0x0930;
  16480. t['radical'] = 0x221A;
  16481. t['radicalex'] = 0xF8E5;
  16482. t['radoverssquare'] = 0x33AE;
  16483. t['radoverssquaredsquare'] = 0x33AF;
  16484. t['radsquare'] = 0x33AD;
  16485. t['rafe'] = 0x05BF;
  16486. t['rafehebrew'] = 0x05BF;
  16487. t['ragujarati'] = 0x0AB0;
  16488. t['ragurmukhi'] = 0x0A30;
  16489. t['rahiragana'] = 0x3089;
  16490. t['rakatakana'] = 0x30E9;
  16491. t['rakatakanahalfwidth'] = 0xFF97;
  16492. t['ralowerdiagonalbengali'] = 0x09F1;
  16493. t['ramiddlediagonalbengali'] = 0x09F0;
  16494. t['ramshorn'] = 0x0264;
  16495. t['ratio'] = 0x2236;
  16496. t['rbopomofo'] = 0x3116;
  16497. t['rcaron'] = 0x0159;
  16498. t['rcedilla'] = 0x0157;
  16499. t['rcircle'] = 0x24E1;
  16500. t['rcommaaccent'] = 0x0157;
  16501. t['rdblgrave'] = 0x0211;
  16502. t['rdotaccent'] = 0x1E59;
  16503. t['rdotbelow'] = 0x1E5B;
  16504. t['rdotbelowmacron'] = 0x1E5D;
  16505. t['referencemark'] = 0x203B;
  16506. t['reflexsubset'] = 0x2286;
  16507. t['reflexsuperset'] = 0x2287;
  16508. t['registered'] = 0x00AE;
  16509. t['registersans'] = 0xF8E8;
  16510. t['registerserif'] = 0xF6DA;
  16511. t['reharabic'] = 0x0631;
  16512. t['reharmenian'] = 0x0580;
  16513. t['rehfinalarabic'] = 0xFEAE;
  16514. t['rehiragana'] = 0x308C;
  16515. t['rekatakana'] = 0x30EC;
  16516. t['rekatakanahalfwidth'] = 0xFF9A;
  16517. t['resh'] = 0x05E8;
  16518. t['reshdageshhebrew'] = 0xFB48;
  16519. t['reshhebrew'] = 0x05E8;
  16520. t['reversedtilde'] = 0x223D;
  16521. t['reviahebrew'] = 0x0597;
  16522. t['reviamugrashhebrew'] = 0x0597;
  16523. t['revlogicalnot'] = 0x2310;
  16524. t['rfishhook'] = 0x027E;
  16525. t['rfishhookreversed'] = 0x027F;
  16526. t['rhabengali'] = 0x09DD;
  16527. t['rhadeva'] = 0x095D;
  16528. t['rho'] = 0x03C1;
  16529. t['rhook'] = 0x027D;
  16530. t['rhookturned'] = 0x027B;
  16531. t['rhookturnedsuperior'] = 0x02B5;
  16532. t['rhosymbolgreek'] = 0x03F1;
  16533. t['rhotichookmod'] = 0x02DE;
  16534. t['rieulacirclekorean'] = 0x3271;
  16535. t['rieulaparenkorean'] = 0x3211;
  16536. t['rieulcirclekorean'] = 0x3263;
  16537. t['rieulhieuhkorean'] = 0x3140;
  16538. t['rieulkiyeokkorean'] = 0x313A;
  16539. t['rieulkiyeoksioskorean'] = 0x3169;
  16540. t['rieulkorean'] = 0x3139;
  16541. t['rieulmieumkorean'] = 0x313B;
  16542. t['rieulpansioskorean'] = 0x316C;
  16543. t['rieulparenkorean'] = 0x3203;
  16544. t['rieulphieuphkorean'] = 0x313F;
  16545. t['rieulpieupkorean'] = 0x313C;
  16546. t['rieulpieupsioskorean'] = 0x316B;
  16547. t['rieulsioskorean'] = 0x313D;
  16548. t['rieulthieuthkorean'] = 0x313E;
  16549. t['rieultikeutkorean'] = 0x316A;
  16550. t['rieulyeorinhieuhkorean'] = 0x316D;
  16551. t['rightangle'] = 0x221F;
  16552. t['righttackbelowcmb'] = 0x0319;
  16553. t['righttriangle'] = 0x22BF;
  16554. t['rihiragana'] = 0x308A;
  16555. t['rikatakana'] = 0x30EA;
  16556. t['rikatakanahalfwidth'] = 0xFF98;
  16557. t['ring'] = 0x02DA;
  16558. t['ringbelowcmb'] = 0x0325;
  16559. t['ringcmb'] = 0x030A;
  16560. t['ringhalfleft'] = 0x02BF;
  16561. t['ringhalfleftarmenian'] = 0x0559;
  16562. t['ringhalfleftbelowcmb'] = 0x031C;
  16563. t['ringhalfleftcentered'] = 0x02D3;
  16564. t['ringhalfright'] = 0x02BE;
  16565. t['ringhalfrightbelowcmb'] = 0x0339;
  16566. t['ringhalfrightcentered'] = 0x02D2;
  16567. t['rinvertedbreve'] = 0x0213;
  16568. t['rittorusquare'] = 0x3351;
  16569. t['rlinebelow'] = 0x1E5F;
  16570. t['rlongleg'] = 0x027C;
  16571. t['rlonglegturned'] = 0x027A;
  16572. t['rmonospace'] = 0xFF52;
  16573. t['rohiragana'] = 0x308D;
  16574. t['rokatakana'] = 0x30ED;
  16575. t['rokatakanahalfwidth'] = 0xFF9B;
  16576. t['roruathai'] = 0x0E23;
  16577. t['rparen'] = 0x24AD;
  16578. t['rrabengali'] = 0x09DC;
  16579. t['rradeva'] = 0x0931;
  16580. t['rragurmukhi'] = 0x0A5C;
  16581. t['rreharabic'] = 0x0691;
  16582. t['rrehfinalarabic'] = 0xFB8D;
  16583. t['rrvocalicbengali'] = 0x09E0;
  16584. t['rrvocalicdeva'] = 0x0960;
  16585. t['rrvocalicgujarati'] = 0x0AE0;
  16586. t['rrvocalicvowelsignbengali'] = 0x09C4;
  16587. t['rrvocalicvowelsigndeva'] = 0x0944;
  16588. t['rrvocalicvowelsigngujarati'] = 0x0AC4;
  16589. t['rsuperior'] = 0xF6F1;
  16590. t['rtblock'] = 0x2590;
  16591. t['rturned'] = 0x0279;
  16592. t['rturnedsuperior'] = 0x02B4;
  16593. t['ruhiragana'] = 0x308B;
  16594. t['rukatakana'] = 0x30EB;
  16595. t['rukatakanahalfwidth'] = 0xFF99;
  16596. t['rupeemarkbengali'] = 0x09F2;
  16597. t['rupeesignbengali'] = 0x09F3;
  16598. t['rupiah'] = 0xF6DD;
  16599. t['ruthai'] = 0x0E24;
  16600. t['rvocalicbengali'] = 0x098B;
  16601. t['rvocalicdeva'] = 0x090B;
  16602. t['rvocalicgujarati'] = 0x0A8B;
  16603. t['rvocalicvowelsignbengali'] = 0x09C3;
  16604. t['rvocalicvowelsigndeva'] = 0x0943;
  16605. t['rvocalicvowelsigngujarati'] = 0x0AC3;
  16606. t['s'] = 0x0073;
  16607. t['sabengali'] = 0x09B8;
  16608. t['sacute'] = 0x015B;
  16609. t['sacutedotaccent'] = 0x1E65;
  16610. t['sadarabic'] = 0x0635;
  16611. t['sadeva'] = 0x0938;
  16612. t['sadfinalarabic'] = 0xFEBA;
  16613. t['sadinitialarabic'] = 0xFEBB;
  16614. t['sadmedialarabic'] = 0xFEBC;
  16615. t['sagujarati'] = 0x0AB8;
  16616. t['sagurmukhi'] = 0x0A38;
  16617. t['sahiragana'] = 0x3055;
  16618. t['sakatakana'] = 0x30B5;
  16619. t['sakatakanahalfwidth'] = 0xFF7B;
  16620. t['sallallahoualayhewasallamarabic'] = 0xFDFA;
  16621. t['samekh'] = 0x05E1;
  16622. t['samekhdagesh'] = 0xFB41;
  16623. t['samekhdageshhebrew'] = 0xFB41;
  16624. t['samekhhebrew'] = 0x05E1;
  16625. t['saraaathai'] = 0x0E32;
  16626. t['saraaethai'] = 0x0E41;
  16627. t['saraaimaimalaithai'] = 0x0E44;
  16628. t['saraaimaimuanthai'] = 0x0E43;
  16629. t['saraamthai'] = 0x0E33;
  16630. t['saraathai'] = 0x0E30;
  16631. t['saraethai'] = 0x0E40;
  16632. t['saraiileftthai'] = 0xF886;
  16633. t['saraiithai'] = 0x0E35;
  16634. t['saraileftthai'] = 0xF885;
  16635. t['saraithai'] = 0x0E34;
  16636. t['saraothai'] = 0x0E42;
  16637. t['saraueeleftthai'] = 0xF888;
  16638. t['saraueethai'] = 0x0E37;
  16639. t['saraueleftthai'] = 0xF887;
  16640. t['sarauethai'] = 0x0E36;
  16641. t['sarauthai'] = 0x0E38;
  16642. t['sarauuthai'] = 0x0E39;
  16643. t['sbopomofo'] = 0x3119;
  16644. t['scaron'] = 0x0161;
  16645. t['scarondotaccent'] = 0x1E67;
  16646. t['scedilla'] = 0x015F;
  16647. t['schwa'] = 0x0259;
  16648. t['schwacyrillic'] = 0x04D9;
  16649. t['schwadieresiscyrillic'] = 0x04DB;
  16650. t['schwahook'] = 0x025A;
  16651. t['scircle'] = 0x24E2;
  16652. t['scircumflex'] = 0x015D;
  16653. t['scommaaccent'] = 0x0219;
  16654. t['sdotaccent'] = 0x1E61;
  16655. t['sdotbelow'] = 0x1E63;
  16656. t['sdotbelowdotaccent'] = 0x1E69;
  16657. t['seagullbelowcmb'] = 0x033C;
  16658. t['second'] = 0x2033;
  16659. t['secondtonechinese'] = 0x02CA;
  16660. t['section'] = 0x00A7;
  16661. t['seenarabic'] = 0x0633;
  16662. t['seenfinalarabic'] = 0xFEB2;
  16663. t['seeninitialarabic'] = 0xFEB3;
  16664. t['seenmedialarabic'] = 0xFEB4;
  16665. t['segol'] = 0x05B6;
  16666. t['segol13'] = 0x05B6;
  16667. t['segol1f'] = 0x05B6;
  16668. t['segol2c'] = 0x05B6;
  16669. t['segolhebrew'] = 0x05B6;
  16670. t['segolnarrowhebrew'] = 0x05B6;
  16671. t['segolquarterhebrew'] = 0x05B6;
  16672. t['segoltahebrew'] = 0x0592;
  16673. t['segolwidehebrew'] = 0x05B6;
  16674. t['seharmenian'] = 0x057D;
  16675. t['sehiragana'] = 0x305B;
  16676. t['sekatakana'] = 0x30BB;
  16677. t['sekatakanahalfwidth'] = 0xFF7E;
  16678. t['semicolon'] = 0x003B;
  16679. t['semicolonarabic'] = 0x061B;
  16680. t['semicolonmonospace'] = 0xFF1B;
  16681. t['semicolonsmall'] = 0xFE54;
  16682. t['semivoicedmarkkana'] = 0x309C;
  16683. t['semivoicedmarkkanahalfwidth'] = 0xFF9F;
  16684. t['sentisquare'] = 0x3322;
  16685. t['sentosquare'] = 0x3323;
  16686. t['seven'] = 0x0037;
  16687. t['sevenarabic'] = 0x0667;
  16688. t['sevenbengali'] = 0x09ED;
  16689. t['sevencircle'] = 0x2466;
  16690. t['sevencircleinversesansserif'] = 0x2790;
  16691. t['sevendeva'] = 0x096D;
  16692. t['seveneighths'] = 0x215E;
  16693. t['sevengujarati'] = 0x0AED;
  16694. t['sevengurmukhi'] = 0x0A6D;
  16695. t['sevenhackarabic'] = 0x0667;
  16696. t['sevenhangzhou'] = 0x3027;
  16697. t['sevenideographicparen'] = 0x3226;
  16698. t['seveninferior'] = 0x2087;
  16699. t['sevenmonospace'] = 0xFF17;
  16700. t['sevenoldstyle'] = 0xF737;
  16701. t['sevenparen'] = 0x247A;
  16702. t['sevenperiod'] = 0x248E;
  16703. t['sevenpersian'] = 0x06F7;
  16704. t['sevenroman'] = 0x2176;
  16705. t['sevensuperior'] = 0x2077;
  16706. t['seventeencircle'] = 0x2470;
  16707. t['seventeenparen'] = 0x2484;
  16708. t['seventeenperiod'] = 0x2498;
  16709. t['seventhai'] = 0x0E57;
  16710. t['sfthyphen'] = 0x00AD;
  16711. t['shaarmenian'] = 0x0577;
  16712. t['shabengali'] = 0x09B6;
  16713. t['shacyrillic'] = 0x0448;
  16714. t['shaddaarabic'] = 0x0651;
  16715. t['shaddadammaarabic'] = 0xFC61;
  16716. t['shaddadammatanarabic'] = 0xFC5E;
  16717. t['shaddafathaarabic'] = 0xFC60;
  16718. t['shaddakasraarabic'] = 0xFC62;
  16719. t['shaddakasratanarabic'] = 0xFC5F;
  16720. t['shade'] = 0x2592;
  16721. t['shadedark'] = 0x2593;
  16722. t['shadelight'] = 0x2591;
  16723. t['shademedium'] = 0x2592;
  16724. t['shadeva'] = 0x0936;
  16725. t['shagujarati'] = 0x0AB6;
  16726. t['shagurmukhi'] = 0x0A36;
  16727. t['shalshelethebrew'] = 0x0593;
  16728. t['shbopomofo'] = 0x3115;
  16729. t['shchacyrillic'] = 0x0449;
  16730. t['sheenarabic'] = 0x0634;
  16731. t['sheenfinalarabic'] = 0xFEB6;
  16732. t['sheeninitialarabic'] = 0xFEB7;
  16733. t['sheenmedialarabic'] = 0xFEB8;
  16734. t['sheicoptic'] = 0x03E3;
  16735. t['sheqel'] = 0x20AA;
  16736. t['sheqelhebrew'] = 0x20AA;
  16737. t['sheva'] = 0x05B0;
  16738. t['sheva115'] = 0x05B0;
  16739. t['sheva15'] = 0x05B0;
  16740. t['sheva22'] = 0x05B0;
  16741. t['sheva2e'] = 0x05B0;
  16742. t['shevahebrew'] = 0x05B0;
  16743. t['shevanarrowhebrew'] = 0x05B0;
  16744. t['shevaquarterhebrew'] = 0x05B0;
  16745. t['shevawidehebrew'] = 0x05B0;
  16746. t['shhacyrillic'] = 0x04BB;
  16747. t['shimacoptic'] = 0x03ED;
  16748. t['shin'] = 0x05E9;
  16749. t['shindagesh'] = 0xFB49;
  16750. t['shindageshhebrew'] = 0xFB49;
  16751. t['shindageshshindot'] = 0xFB2C;
  16752. t['shindageshshindothebrew'] = 0xFB2C;
  16753. t['shindageshsindot'] = 0xFB2D;
  16754. t['shindageshsindothebrew'] = 0xFB2D;
  16755. t['shindothebrew'] = 0x05C1;
  16756. t['shinhebrew'] = 0x05E9;
  16757. t['shinshindot'] = 0xFB2A;
  16758. t['shinshindothebrew'] = 0xFB2A;
  16759. t['shinsindot'] = 0xFB2B;
  16760. t['shinsindothebrew'] = 0xFB2B;
  16761. t['shook'] = 0x0282;
  16762. t['sigma'] = 0x03C3;
  16763. t['sigma1'] = 0x03C2;
  16764. t['sigmafinal'] = 0x03C2;
  16765. t['sigmalunatesymbolgreek'] = 0x03F2;
  16766. t['sihiragana'] = 0x3057;
  16767. t['sikatakana'] = 0x30B7;
  16768. t['sikatakanahalfwidth'] = 0xFF7C;
  16769. t['siluqhebrew'] = 0x05BD;
  16770. t['siluqlefthebrew'] = 0x05BD;
  16771. t['similar'] = 0x223C;
  16772. t['sindothebrew'] = 0x05C2;
  16773. t['siosacirclekorean'] = 0x3274;
  16774. t['siosaparenkorean'] = 0x3214;
  16775. t['sioscieuckorean'] = 0x317E;
  16776. t['sioscirclekorean'] = 0x3266;
  16777. t['sioskiyeokkorean'] = 0x317A;
  16778. t['sioskorean'] = 0x3145;
  16779. t['siosnieunkorean'] = 0x317B;
  16780. t['siosparenkorean'] = 0x3206;
  16781. t['siospieupkorean'] = 0x317D;
  16782. t['siostikeutkorean'] = 0x317C;
  16783. t['six'] = 0x0036;
  16784. t['sixarabic'] = 0x0666;
  16785. t['sixbengali'] = 0x09EC;
  16786. t['sixcircle'] = 0x2465;
  16787. t['sixcircleinversesansserif'] = 0x278F;
  16788. t['sixdeva'] = 0x096C;
  16789. t['sixgujarati'] = 0x0AEC;
  16790. t['sixgurmukhi'] = 0x0A6C;
  16791. t['sixhackarabic'] = 0x0666;
  16792. t['sixhangzhou'] = 0x3026;
  16793. t['sixideographicparen'] = 0x3225;
  16794. t['sixinferior'] = 0x2086;
  16795. t['sixmonospace'] = 0xFF16;
  16796. t['sixoldstyle'] = 0xF736;
  16797. t['sixparen'] = 0x2479;
  16798. t['sixperiod'] = 0x248D;
  16799. t['sixpersian'] = 0x06F6;
  16800. t['sixroman'] = 0x2175;
  16801. t['sixsuperior'] = 0x2076;
  16802. t['sixteencircle'] = 0x246F;
  16803. t['sixteencurrencydenominatorbengali'] = 0x09F9;
  16804. t['sixteenparen'] = 0x2483;
  16805. t['sixteenperiod'] = 0x2497;
  16806. t['sixthai'] = 0x0E56;
  16807. t['slash'] = 0x002F;
  16808. t['slashmonospace'] = 0xFF0F;
  16809. t['slong'] = 0x017F;
  16810. t['slongdotaccent'] = 0x1E9B;
  16811. t['smileface'] = 0x263A;
  16812. t['smonospace'] = 0xFF53;
  16813. t['sofpasuqhebrew'] = 0x05C3;
  16814. t['softhyphen'] = 0x00AD;
  16815. t['softsigncyrillic'] = 0x044C;
  16816. t['sohiragana'] = 0x305D;
  16817. t['sokatakana'] = 0x30BD;
  16818. t['sokatakanahalfwidth'] = 0xFF7F;
  16819. t['soliduslongoverlaycmb'] = 0x0338;
  16820. t['solidusshortoverlaycmb'] = 0x0337;
  16821. t['sorusithai'] = 0x0E29;
  16822. t['sosalathai'] = 0x0E28;
  16823. t['sosothai'] = 0x0E0B;
  16824. t['sosuathai'] = 0x0E2A;
  16825. t['space'] = 0x0020;
  16826. t['spacehackarabic'] = 0x0020;
  16827. t['spade'] = 0x2660;
  16828. t['spadesuitblack'] = 0x2660;
  16829. t['spadesuitwhite'] = 0x2664;
  16830. t['sparen'] = 0x24AE;
  16831. t['squarebelowcmb'] = 0x033B;
  16832. t['squarecc'] = 0x33C4;
  16833. t['squarecm'] = 0x339D;
  16834. t['squarediagonalcrosshatchfill'] = 0x25A9;
  16835. t['squarehorizontalfill'] = 0x25A4;
  16836. t['squarekg'] = 0x338F;
  16837. t['squarekm'] = 0x339E;
  16838. t['squarekmcapital'] = 0x33CE;
  16839. t['squareln'] = 0x33D1;
  16840. t['squarelog'] = 0x33D2;
  16841. t['squaremg'] = 0x338E;
  16842. t['squaremil'] = 0x33D5;
  16843. t['squaremm'] = 0x339C;
  16844. t['squaremsquared'] = 0x33A1;
  16845. t['squareorthogonalcrosshatchfill'] = 0x25A6;
  16846. t['squareupperlefttolowerrightfill'] = 0x25A7;
  16847. t['squareupperrighttolowerleftfill'] = 0x25A8;
  16848. t['squareverticalfill'] = 0x25A5;
  16849. t['squarewhitewithsmallblack'] = 0x25A3;
  16850. t['srsquare'] = 0x33DB;
  16851. t['ssabengali'] = 0x09B7;
  16852. t['ssadeva'] = 0x0937;
  16853. t['ssagujarati'] = 0x0AB7;
  16854. t['ssangcieuckorean'] = 0x3149;
  16855. t['ssanghieuhkorean'] = 0x3185;
  16856. t['ssangieungkorean'] = 0x3180;
  16857. t['ssangkiyeokkorean'] = 0x3132;
  16858. t['ssangnieunkorean'] = 0x3165;
  16859. t['ssangpieupkorean'] = 0x3143;
  16860. t['ssangsioskorean'] = 0x3146;
  16861. t['ssangtikeutkorean'] = 0x3138;
  16862. t['ssuperior'] = 0xF6F2;
  16863. t['sterling'] = 0x00A3;
  16864. t['sterlingmonospace'] = 0xFFE1;
  16865. t['strokelongoverlaycmb'] = 0x0336;
  16866. t['strokeshortoverlaycmb'] = 0x0335;
  16867. t['subset'] = 0x2282;
  16868. t['subsetnotequal'] = 0x228A;
  16869. t['subsetorequal'] = 0x2286;
  16870. t['succeeds'] = 0x227B;
  16871. t['suchthat'] = 0x220B;
  16872. t['suhiragana'] = 0x3059;
  16873. t['sukatakana'] = 0x30B9;
  16874. t['sukatakanahalfwidth'] = 0xFF7D;
  16875. t['sukunarabic'] = 0x0652;
  16876. t['summation'] = 0x2211;
  16877. t['sun'] = 0x263C;
  16878. t['superset'] = 0x2283;
  16879. t['supersetnotequal'] = 0x228B;
  16880. t['supersetorequal'] = 0x2287;
  16881. t['svsquare'] = 0x33DC;
  16882. t['syouwaerasquare'] = 0x337C;
  16883. t['t'] = 0x0074;
  16884. t['tabengali'] = 0x09A4;
  16885. t['tackdown'] = 0x22A4;
  16886. t['tackleft'] = 0x22A3;
  16887. t['tadeva'] = 0x0924;
  16888. t['tagujarati'] = 0x0AA4;
  16889. t['tagurmukhi'] = 0x0A24;
  16890. t['taharabic'] = 0x0637;
  16891. t['tahfinalarabic'] = 0xFEC2;
  16892. t['tahinitialarabic'] = 0xFEC3;
  16893. t['tahiragana'] = 0x305F;
  16894. t['tahmedialarabic'] = 0xFEC4;
  16895. t['taisyouerasquare'] = 0x337D;
  16896. t['takatakana'] = 0x30BF;
  16897. t['takatakanahalfwidth'] = 0xFF80;
  16898. t['tatweelarabic'] = 0x0640;
  16899. t['tau'] = 0x03C4;
  16900. t['tav'] = 0x05EA;
  16901. t['tavdages'] = 0xFB4A;
  16902. t['tavdagesh'] = 0xFB4A;
  16903. t['tavdageshhebrew'] = 0xFB4A;
  16904. t['tavhebrew'] = 0x05EA;
  16905. t['tbar'] = 0x0167;
  16906. t['tbopomofo'] = 0x310A;
  16907. t['tcaron'] = 0x0165;
  16908. t['tccurl'] = 0x02A8;
  16909. t['tcedilla'] = 0x0163;
  16910. t['tcheharabic'] = 0x0686;
  16911. t['tchehfinalarabic'] = 0xFB7B;
  16912. t['tchehinitialarabic'] = 0xFB7C;
  16913. t['tchehmedialarabic'] = 0xFB7D;
  16914. t['tcircle'] = 0x24E3;
  16915. t['tcircumflexbelow'] = 0x1E71;
  16916. t['tcommaaccent'] = 0x0163;
  16917. t['tdieresis'] = 0x1E97;
  16918. t['tdotaccent'] = 0x1E6B;
  16919. t['tdotbelow'] = 0x1E6D;
  16920. t['tecyrillic'] = 0x0442;
  16921. t['tedescendercyrillic'] = 0x04AD;
  16922. t['teharabic'] = 0x062A;
  16923. t['tehfinalarabic'] = 0xFE96;
  16924. t['tehhahinitialarabic'] = 0xFCA2;
  16925. t['tehhahisolatedarabic'] = 0xFC0C;
  16926. t['tehinitialarabic'] = 0xFE97;
  16927. t['tehiragana'] = 0x3066;
  16928. t['tehjeeminitialarabic'] = 0xFCA1;
  16929. t['tehjeemisolatedarabic'] = 0xFC0B;
  16930. t['tehmarbutaarabic'] = 0x0629;
  16931. t['tehmarbutafinalarabic'] = 0xFE94;
  16932. t['tehmedialarabic'] = 0xFE98;
  16933. t['tehmeeminitialarabic'] = 0xFCA4;
  16934. t['tehmeemisolatedarabic'] = 0xFC0E;
  16935. t['tehnoonfinalarabic'] = 0xFC73;
  16936. t['tekatakana'] = 0x30C6;
  16937. t['tekatakanahalfwidth'] = 0xFF83;
  16938. t['telephone'] = 0x2121;
  16939. t['telephoneblack'] = 0x260E;
  16940. t['telishagedolahebrew'] = 0x05A0;
  16941. t['telishaqetanahebrew'] = 0x05A9;
  16942. t['tencircle'] = 0x2469;
  16943. t['tenideographicparen'] = 0x3229;
  16944. t['tenparen'] = 0x247D;
  16945. t['tenperiod'] = 0x2491;
  16946. t['tenroman'] = 0x2179;
  16947. t['tesh'] = 0x02A7;
  16948. t['tet'] = 0x05D8;
  16949. t['tetdagesh'] = 0xFB38;
  16950. t['tetdageshhebrew'] = 0xFB38;
  16951. t['tethebrew'] = 0x05D8;
  16952. t['tetsecyrillic'] = 0x04B5;
  16953. t['tevirhebrew'] = 0x059B;
  16954. t['tevirlefthebrew'] = 0x059B;
  16955. t['thabengali'] = 0x09A5;
  16956. t['thadeva'] = 0x0925;
  16957. t['thagujarati'] = 0x0AA5;
  16958. t['thagurmukhi'] = 0x0A25;
  16959. t['thalarabic'] = 0x0630;
  16960. t['thalfinalarabic'] = 0xFEAC;
  16961. t['thanthakhatlowleftthai'] = 0xF898;
  16962. t['thanthakhatlowrightthai'] = 0xF897;
  16963. t['thanthakhatthai'] = 0x0E4C;
  16964. t['thanthakhatupperleftthai'] = 0xF896;
  16965. t['theharabic'] = 0x062B;
  16966. t['thehfinalarabic'] = 0xFE9A;
  16967. t['thehinitialarabic'] = 0xFE9B;
  16968. t['thehmedialarabic'] = 0xFE9C;
  16969. t['thereexists'] = 0x2203;
  16970. t['therefore'] = 0x2234;
  16971. t['theta'] = 0x03B8;
  16972. t['theta1'] = 0x03D1;
  16973. t['thetasymbolgreek'] = 0x03D1;
  16974. t['thieuthacirclekorean'] = 0x3279;
  16975. t['thieuthaparenkorean'] = 0x3219;
  16976. t['thieuthcirclekorean'] = 0x326B;
  16977. t['thieuthkorean'] = 0x314C;
  16978. t['thieuthparenkorean'] = 0x320B;
  16979. t['thirteencircle'] = 0x246C;
  16980. t['thirteenparen'] = 0x2480;
  16981. t['thirteenperiod'] = 0x2494;
  16982. t['thonangmonthothai'] = 0x0E11;
  16983. t['thook'] = 0x01AD;
  16984. t['thophuthaothai'] = 0x0E12;
  16985. t['thorn'] = 0x00FE;
  16986. t['thothahanthai'] = 0x0E17;
  16987. t['thothanthai'] = 0x0E10;
  16988. t['thothongthai'] = 0x0E18;
  16989. t['thothungthai'] = 0x0E16;
  16990. t['thousandcyrillic'] = 0x0482;
  16991. t['thousandsseparatorarabic'] = 0x066C;
  16992. t['thousandsseparatorpersian'] = 0x066C;
  16993. t['three'] = 0x0033;
  16994. t['threearabic'] = 0x0663;
  16995. t['threebengali'] = 0x09E9;
  16996. t['threecircle'] = 0x2462;
  16997. t['threecircleinversesansserif'] = 0x278C;
  16998. t['threedeva'] = 0x0969;
  16999. t['threeeighths'] = 0x215C;
  17000. t['threegujarati'] = 0x0AE9;
  17001. t['threegurmukhi'] = 0x0A69;
  17002. t['threehackarabic'] = 0x0663;
  17003. t['threehangzhou'] = 0x3023;
  17004. t['threeideographicparen'] = 0x3222;
  17005. t['threeinferior'] = 0x2083;
  17006. t['threemonospace'] = 0xFF13;
  17007. t['threenumeratorbengali'] = 0x09F6;
  17008. t['threeoldstyle'] = 0xF733;
  17009. t['threeparen'] = 0x2476;
  17010. t['threeperiod'] = 0x248A;
  17011. t['threepersian'] = 0x06F3;
  17012. t['threequarters'] = 0x00BE;
  17013. t['threequartersemdash'] = 0xF6DE;
  17014. t['threeroman'] = 0x2172;
  17015. t['threesuperior'] = 0x00B3;
  17016. t['threethai'] = 0x0E53;
  17017. t['thzsquare'] = 0x3394;
  17018. t['tihiragana'] = 0x3061;
  17019. t['tikatakana'] = 0x30C1;
  17020. t['tikatakanahalfwidth'] = 0xFF81;
  17021. t['tikeutacirclekorean'] = 0x3270;
  17022. t['tikeutaparenkorean'] = 0x3210;
  17023. t['tikeutcirclekorean'] = 0x3262;
  17024. t['tikeutkorean'] = 0x3137;
  17025. t['tikeutparenkorean'] = 0x3202;
  17026. t['tilde'] = 0x02DC;
  17027. t['tildebelowcmb'] = 0x0330;
  17028. t['tildecmb'] = 0x0303;
  17029. t['tildecomb'] = 0x0303;
  17030. t['tildedoublecmb'] = 0x0360;
  17031. t['tildeoperator'] = 0x223C;
  17032. t['tildeoverlaycmb'] = 0x0334;
  17033. t['tildeverticalcmb'] = 0x033E;
  17034. t['timescircle'] = 0x2297;
  17035. t['tipehahebrew'] = 0x0596;
  17036. t['tipehalefthebrew'] = 0x0596;
  17037. t['tippigurmukhi'] = 0x0A70;
  17038. t['titlocyrilliccmb'] = 0x0483;
  17039. t['tiwnarmenian'] = 0x057F;
  17040. t['tlinebelow'] = 0x1E6F;
  17041. t['tmonospace'] = 0xFF54;
  17042. t['toarmenian'] = 0x0569;
  17043. t['tohiragana'] = 0x3068;
  17044. t['tokatakana'] = 0x30C8;
  17045. t['tokatakanahalfwidth'] = 0xFF84;
  17046. t['tonebarextrahighmod'] = 0x02E5;
  17047. t['tonebarextralowmod'] = 0x02E9;
  17048. t['tonebarhighmod'] = 0x02E6;
  17049. t['tonebarlowmod'] = 0x02E8;
  17050. t['tonebarmidmod'] = 0x02E7;
  17051. t['tonefive'] = 0x01BD;
  17052. t['tonesix'] = 0x0185;
  17053. t['tonetwo'] = 0x01A8;
  17054. t['tonos'] = 0x0384;
  17055. t['tonsquare'] = 0x3327;
  17056. t['topatakthai'] = 0x0E0F;
  17057. t['tortoiseshellbracketleft'] = 0x3014;
  17058. t['tortoiseshellbracketleftsmall'] = 0xFE5D;
  17059. t['tortoiseshellbracketleftvertical'] = 0xFE39;
  17060. t['tortoiseshellbracketright'] = 0x3015;
  17061. t['tortoiseshellbracketrightsmall'] = 0xFE5E;
  17062. t['tortoiseshellbracketrightvertical'] = 0xFE3A;
  17063. t['totaothai'] = 0x0E15;
  17064. t['tpalatalhook'] = 0x01AB;
  17065. t['tparen'] = 0x24AF;
  17066. t['trademark'] = 0x2122;
  17067. t['trademarksans'] = 0xF8EA;
  17068. t['trademarkserif'] = 0xF6DB;
  17069. t['tretroflexhook'] = 0x0288;
  17070. t['triagdn'] = 0x25BC;
  17071. t['triaglf'] = 0x25C4;
  17072. t['triagrt'] = 0x25BA;
  17073. t['triagup'] = 0x25B2;
  17074. t['ts'] = 0x02A6;
  17075. t['tsadi'] = 0x05E6;
  17076. t['tsadidagesh'] = 0xFB46;
  17077. t['tsadidageshhebrew'] = 0xFB46;
  17078. t['tsadihebrew'] = 0x05E6;
  17079. t['tsecyrillic'] = 0x0446;
  17080. t['tsere'] = 0x05B5;
  17081. t['tsere12'] = 0x05B5;
  17082. t['tsere1e'] = 0x05B5;
  17083. t['tsere2b'] = 0x05B5;
  17084. t['tserehebrew'] = 0x05B5;
  17085. t['tserenarrowhebrew'] = 0x05B5;
  17086. t['tserequarterhebrew'] = 0x05B5;
  17087. t['tserewidehebrew'] = 0x05B5;
  17088. t['tshecyrillic'] = 0x045B;
  17089. t['tsuperior'] = 0xF6F3;
  17090. t['ttabengali'] = 0x099F;
  17091. t['ttadeva'] = 0x091F;
  17092. t['ttagujarati'] = 0x0A9F;
  17093. t['ttagurmukhi'] = 0x0A1F;
  17094. t['tteharabic'] = 0x0679;
  17095. t['ttehfinalarabic'] = 0xFB67;
  17096. t['ttehinitialarabic'] = 0xFB68;
  17097. t['ttehmedialarabic'] = 0xFB69;
  17098. t['tthabengali'] = 0x09A0;
  17099. t['tthadeva'] = 0x0920;
  17100. t['tthagujarati'] = 0x0AA0;
  17101. t['tthagurmukhi'] = 0x0A20;
  17102. t['tturned'] = 0x0287;
  17103. t['tuhiragana'] = 0x3064;
  17104. t['tukatakana'] = 0x30C4;
  17105. t['tukatakanahalfwidth'] = 0xFF82;
  17106. t['tusmallhiragana'] = 0x3063;
  17107. t['tusmallkatakana'] = 0x30C3;
  17108. t['tusmallkatakanahalfwidth'] = 0xFF6F;
  17109. t['twelvecircle'] = 0x246B;
  17110. t['twelveparen'] = 0x247F;
  17111. t['twelveperiod'] = 0x2493;
  17112. t['twelveroman'] = 0x217B;
  17113. t['twentycircle'] = 0x2473;
  17114. t['twentyhangzhou'] = 0x5344;
  17115. t['twentyparen'] = 0x2487;
  17116. t['twentyperiod'] = 0x249B;
  17117. t['two'] = 0x0032;
  17118. t['twoarabic'] = 0x0662;
  17119. t['twobengali'] = 0x09E8;
  17120. t['twocircle'] = 0x2461;
  17121. t['twocircleinversesansserif'] = 0x278B;
  17122. t['twodeva'] = 0x0968;
  17123. t['twodotenleader'] = 0x2025;
  17124. t['twodotleader'] = 0x2025;
  17125. t['twodotleadervertical'] = 0xFE30;
  17126. t['twogujarati'] = 0x0AE8;
  17127. t['twogurmukhi'] = 0x0A68;
  17128. t['twohackarabic'] = 0x0662;
  17129. t['twohangzhou'] = 0x3022;
  17130. t['twoideographicparen'] = 0x3221;
  17131. t['twoinferior'] = 0x2082;
  17132. t['twomonospace'] = 0xFF12;
  17133. t['twonumeratorbengali'] = 0x09F5;
  17134. t['twooldstyle'] = 0xF732;
  17135. t['twoparen'] = 0x2475;
  17136. t['twoperiod'] = 0x2489;
  17137. t['twopersian'] = 0x06F2;
  17138. t['tworoman'] = 0x2171;
  17139. t['twostroke'] = 0x01BB;
  17140. t['twosuperior'] = 0x00B2;
  17141. t['twothai'] = 0x0E52;
  17142. t['twothirds'] = 0x2154;
  17143. t['u'] = 0x0075;
  17144. t['uacute'] = 0x00FA;
  17145. t['ubar'] = 0x0289;
  17146. t['ubengali'] = 0x0989;
  17147. t['ubopomofo'] = 0x3128;
  17148. t['ubreve'] = 0x016D;
  17149. t['ucaron'] = 0x01D4;
  17150. t['ucircle'] = 0x24E4;
  17151. t['ucircumflex'] = 0x00FB;
  17152. t['ucircumflexbelow'] = 0x1E77;
  17153. t['ucyrillic'] = 0x0443;
  17154. t['udattadeva'] = 0x0951;
  17155. t['udblacute'] = 0x0171;
  17156. t['udblgrave'] = 0x0215;
  17157. t['udeva'] = 0x0909;
  17158. t['udieresis'] = 0x00FC;
  17159. t['udieresisacute'] = 0x01D8;
  17160. t['udieresisbelow'] = 0x1E73;
  17161. t['udieresiscaron'] = 0x01DA;
  17162. t['udieresiscyrillic'] = 0x04F1;
  17163. t['udieresisgrave'] = 0x01DC;
  17164. t['udieresismacron'] = 0x01D6;
  17165. t['udotbelow'] = 0x1EE5;
  17166. t['ugrave'] = 0x00F9;
  17167. t['ugujarati'] = 0x0A89;
  17168. t['ugurmukhi'] = 0x0A09;
  17169. t['uhiragana'] = 0x3046;
  17170. t['uhookabove'] = 0x1EE7;
  17171. t['uhorn'] = 0x01B0;
  17172. t['uhornacute'] = 0x1EE9;
  17173. t['uhorndotbelow'] = 0x1EF1;
  17174. t['uhorngrave'] = 0x1EEB;
  17175. t['uhornhookabove'] = 0x1EED;
  17176. t['uhorntilde'] = 0x1EEF;
  17177. t['uhungarumlaut'] = 0x0171;
  17178. t['uhungarumlautcyrillic'] = 0x04F3;
  17179. t['uinvertedbreve'] = 0x0217;
  17180. t['ukatakana'] = 0x30A6;
  17181. t['ukatakanahalfwidth'] = 0xFF73;
  17182. t['ukcyrillic'] = 0x0479;
  17183. t['ukorean'] = 0x315C;
  17184. t['umacron'] = 0x016B;
  17185. t['umacroncyrillic'] = 0x04EF;
  17186. t['umacrondieresis'] = 0x1E7B;
  17187. t['umatragurmukhi'] = 0x0A41;
  17188. t['umonospace'] = 0xFF55;
  17189. t['underscore'] = 0x005F;
  17190. t['underscoredbl'] = 0x2017;
  17191. t['underscoremonospace'] = 0xFF3F;
  17192. t['underscorevertical'] = 0xFE33;
  17193. t['underscorewavy'] = 0xFE4F;
  17194. t['union'] = 0x222A;
  17195. t['universal'] = 0x2200;
  17196. t['uogonek'] = 0x0173;
  17197. t['uparen'] = 0x24B0;
  17198. t['upblock'] = 0x2580;
  17199. t['upperdothebrew'] = 0x05C4;
  17200. t['upsilon'] = 0x03C5;
  17201. t['upsilondieresis'] = 0x03CB;
  17202. t['upsilondieresistonos'] = 0x03B0;
  17203. t['upsilonlatin'] = 0x028A;
  17204. t['upsilontonos'] = 0x03CD;
  17205. t['uptackbelowcmb'] = 0x031D;
  17206. t['uptackmod'] = 0x02D4;
  17207. t['uragurmukhi'] = 0x0A73;
  17208. t['uring'] = 0x016F;
  17209. t['ushortcyrillic'] = 0x045E;
  17210. t['usmallhiragana'] = 0x3045;
  17211. t['usmallkatakana'] = 0x30A5;
  17212. t['usmallkatakanahalfwidth'] = 0xFF69;
  17213. t['ustraightcyrillic'] = 0x04AF;
  17214. t['ustraightstrokecyrillic'] = 0x04B1;
  17215. t['utilde'] = 0x0169;
  17216. t['utildeacute'] = 0x1E79;
  17217. t['utildebelow'] = 0x1E75;
  17218. t['uubengali'] = 0x098A;
  17219. t['uudeva'] = 0x090A;
  17220. t['uugujarati'] = 0x0A8A;
  17221. t['uugurmukhi'] = 0x0A0A;
  17222. t['uumatragurmukhi'] = 0x0A42;
  17223. t['uuvowelsignbengali'] = 0x09C2;
  17224. t['uuvowelsigndeva'] = 0x0942;
  17225. t['uuvowelsigngujarati'] = 0x0AC2;
  17226. t['uvowelsignbengali'] = 0x09C1;
  17227. t['uvowelsigndeva'] = 0x0941;
  17228. t['uvowelsigngujarati'] = 0x0AC1;
  17229. t['v'] = 0x0076;
  17230. t['vadeva'] = 0x0935;
  17231. t['vagujarati'] = 0x0AB5;
  17232. t['vagurmukhi'] = 0x0A35;
  17233. t['vakatakana'] = 0x30F7;
  17234. t['vav'] = 0x05D5;
  17235. t['vavdagesh'] = 0xFB35;
  17236. t['vavdagesh65'] = 0xFB35;
  17237. t['vavdageshhebrew'] = 0xFB35;
  17238. t['vavhebrew'] = 0x05D5;
  17239. t['vavholam'] = 0xFB4B;
  17240. t['vavholamhebrew'] = 0xFB4B;
  17241. t['vavvavhebrew'] = 0x05F0;
  17242. t['vavyodhebrew'] = 0x05F1;
  17243. t['vcircle'] = 0x24E5;
  17244. t['vdotbelow'] = 0x1E7F;
  17245. t['vecyrillic'] = 0x0432;
  17246. t['veharabic'] = 0x06A4;
  17247. t['vehfinalarabic'] = 0xFB6B;
  17248. t['vehinitialarabic'] = 0xFB6C;
  17249. t['vehmedialarabic'] = 0xFB6D;
  17250. t['vekatakana'] = 0x30F9;
  17251. t['venus'] = 0x2640;
  17252. t['verticalbar'] = 0x007C;
  17253. t['verticallineabovecmb'] = 0x030D;
  17254. t['verticallinebelowcmb'] = 0x0329;
  17255. t['verticallinelowmod'] = 0x02CC;
  17256. t['verticallinemod'] = 0x02C8;
  17257. t['vewarmenian'] = 0x057E;
  17258. t['vhook'] = 0x028B;
  17259. t['vikatakana'] = 0x30F8;
  17260. t['viramabengali'] = 0x09CD;
  17261. t['viramadeva'] = 0x094D;
  17262. t['viramagujarati'] = 0x0ACD;
  17263. t['visargabengali'] = 0x0983;
  17264. t['visargadeva'] = 0x0903;
  17265. t['visargagujarati'] = 0x0A83;
  17266. t['vmonospace'] = 0xFF56;
  17267. t['voarmenian'] = 0x0578;
  17268. t['voicediterationhiragana'] = 0x309E;
  17269. t['voicediterationkatakana'] = 0x30FE;
  17270. t['voicedmarkkana'] = 0x309B;
  17271. t['voicedmarkkanahalfwidth'] = 0xFF9E;
  17272. t['vokatakana'] = 0x30FA;
  17273. t['vparen'] = 0x24B1;
  17274. t['vtilde'] = 0x1E7D;
  17275. t['vturned'] = 0x028C;
  17276. t['vuhiragana'] = 0x3094;
  17277. t['vukatakana'] = 0x30F4;
  17278. t['w'] = 0x0077;
  17279. t['wacute'] = 0x1E83;
  17280. t['waekorean'] = 0x3159;
  17281. t['wahiragana'] = 0x308F;
  17282. t['wakatakana'] = 0x30EF;
  17283. t['wakatakanahalfwidth'] = 0xFF9C;
  17284. t['wakorean'] = 0x3158;
  17285. t['wasmallhiragana'] = 0x308E;
  17286. t['wasmallkatakana'] = 0x30EE;
  17287. t['wattosquare'] = 0x3357;
  17288. t['wavedash'] = 0x301C;
  17289. t['wavyunderscorevertical'] = 0xFE34;
  17290. t['wawarabic'] = 0x0648;
  17291. t['wawfinalarabic'] = 0xFEEE;
  17292. t['wawhamzaabovearabic'] = 0x0624;
  17293. t['wawhamzaabovefinalarabic'] = 0xFE86;
  17294. t['wbsquare'] = 0x33DD;
  17295. t['wcircle'] = 0x24E6;
  17296. t['wcircumflex'] = 0x0175;
  17297. t['wdieresis'] = 0x1E85;
  17298. t['wdotaccent'] = 0x1E87;
  17299. t['wdotbelow'] = 0x1E89;
  17300. t['wehiragana'] = 0x3091;
  17301. t['weierstrass'] = 0x2118;
  17302. t['wekatakana'] = 0x30F1;
  17303. t['wekorean'] = 0x315E;
  17304. t['weokorean'] = 0x315D;
  17305. t['wgrave'] = 0x1E81;
  17306. t['whitebullet'] = 0x25E6;
  17307. t['whitecircle'] = 0x25CB;
  17308. t['whitecircleinverse'] = 0x25D9;
  17309. t['whitecornerbracketleft'] = 0x300E;
  17310. t['whitecornerbracketleftvertical'] = 0xFE43;
  17311. t['whitecornerbracketright'] = 0x300F;
  17312. t['whitecornerbracketrightvertical'] = 0xFE44;
  17313. t['whitediamond'] = 0x25C7;
  17314. t['whitediamondcontainingblacksmalldiamond'] = 0x25C8;
  17315. t['whitedownpointingsmalltriangle'] = 0x25BF;
  17316. t['whitedownpointingtriangle'] = 0x25BD;
  17317. t['whiteleftpointingsmalltriangle'] = 0x25C3;
  17318. t['whiteleftpointingtriangle'] = 0x25C1;
  17319. t['whitelenticularbracketleft'] = 0x3016;
  17320. t['whitelenticularbracketright'] = 0x3017;
  17321. t['whiterightpointingsmalltriangle'] = 0x25B9;
  17322. t['whiterightpointingtriangle'] = 0x25B7;
  17323. t['whitesmallsquare'] = 0x25AB;
  17324. t['whitesmilingface'] = 0x263A;
  17325. t['whitesquare'] = 0x25A1;
  17326. t['whitestar'] = 0x2606;
  17327. t['whitetelephone'] = 0x260F;
  17328. t['whitetortoiseshellbracketleft'] = 0x3018;
  17329. t['whitetortoiseshellbracketright'] = 0x3019;
  17330. t['whiteuppointingsmalltriangle'] = 0x25B5;
  17331. t['whiteuppointingtriangle'] = 0x25B3;
  17332. t['wihiragana'] = 0x3090;
  17333. t['wikatakana'] = 0x30F0;
  17334. t['wikorean'] = 0x315F;
  17335. t['wmonospace'] = 0xFF57;
  17336. t['wohiragana'] = 0x3092;
  17337. t['wokatakana'] = 0x30F2;
  17338. t['wokatakanahalfwidth'] = 0xFF66;
  17339. t['won'] = 0x20A9;
  17340. t['wonmonospace'] = 0xFFE6;
  17341. t['wowaenthai'] = 0x0E27;
  17342. t['wparen'] = 0x24B2;
  17343. t['wring'] = 0x1E98;
  17344. t['wsuperior'] = 0x02B7;
  17345. t['wturned'] = 0x028D;
  17346. t['wynn'] = 0x01BF;
  17347. t['x'] = 0x0078;
  17348. t['xabovecmb'] = 0x033D;
  17349. t['xbopomofo'] = 0x3112;
  17350. t['xcircle'] = 0x24E7;
  17351. t['xdieresis'] = 0x1E8D;
  17352. t['xdotaccent'] = 0x1E8B;
  17353. t['xeharmenian'] = 0x056D;
  17354. t['xi'] = 0x03BE;
  17355. t['xmonospace'] = 0xFF58;
  17356. t['xparen'] = 0x24B3;
  17357. t['xsuperior'] = 0x02E3;
  17358. t['y'] = 0x0079;
  17359. t['yaadosquare'] = 0x334E;
  17360. t['yabengali'] = 0x09AF;
  17361. t['yacute'] = 0x00FD;
  17362. t['yadeva'] = 0x092F;
  17363. t['yaekorean'] = 0x3152;
  17364. t['yagujarati'] = 0x0AAF;
  17365. t['yagurmukhi'] = 0x0A2F;
  17366. t['yahiragana'] = 0x3084;
  17367. t['yakatakana'] = 0x30E4;
  17368. t['yakatakanahalfwidth'] = 0xFF94;
  17369. t['yakorean'] = 0x3151;
  17370. t['yamakkanthai'] = 0x0E4E;
  17371. t['yasmallhiragana'] = 0x3083;
  17372. t['yasmallkatakana'] = 0x30E3;
  17373. t['yasmallkatakanahalfwidth'] = 0xFF6C;
  17374. t['yatcyrillic'] = 0x0463;
  17375. t['ycircle'] = 0x24E8;
  17376. t['ycircumflex'] = 0x0177;
  17377. t['ydieresis'] = 0x00FF;
  17378. t['ydotaccent'] = 0x1E8F;
  17379. t['ydotbelow'] = 0x1EF5;
  17380. t['yeharabic'] = 0x064A;
  17381. t['yehbarreearabic'] = 0x06D2;
  17382. t['yehbarreefinalarabic'] = 0xFBAF;
  17383. t['yehfinalarabic'] = 0xFEF2;
  17384. t['yehhamzaabovearabic'] = 0x0626;
  17385. t['yehhamzaabovefinalarabic'] = 0xFE8A;
  17386. t['yehhamzaaboveinitialarabic'] = 0xFE8B;
  17387. t['yehhamzaabovemedialarabic'] = 0xFE8C;
  17388. t['yehinitialarabic'] = 0xFEF3;
  17389. t['yehmedialarabic'] = 0xFEF4;
  17390. t['yehmeeminitialarabic'] = 0xFCDD;
  17391. t['yehmeemisolatedarabic'] = 0xFC58;
  17392. t['yehnoonfinalarabic'] = 0xFC94;
  17393. t['yehthreedotsbelowarabic'] = 0x06D1;
  17394. t['yekorean'] = 0x3156;
  17395. t['yen'] = 0x00A5;
  17396. t['yenmonospace'] = 0xFFE5;
  17397. t['yeokorean'] = 0x3155;
  17398. t['yeorinhieuhkorean'] = 0x3186;
  17399. t['yerahbenyomohebrew'] = 0x05AA;
  17400. t['yerahbenyomolefthebrew'] = 0x05AA;
  17401. t['yericyrillic'] = 0x044B;
  17402. t['yerudieresiscyrillic'] = 0x04F9;
  17403. t['yesieungkorean'] = 0x3181;
  17404. t['yesieungpansioskorean'] = 0x3183;
  17405. t['yesieungsioskorean'] = 0x3182;
  17406. t['yetivhebrew'] = 0x059A;
  17407. t['ygrave'] = 0x1EF3;
  17408. t['yhook'] = 0x01B4;
  17409. t['yhookabove'] = 0x1EF7;
  17410. t['yiarmenian'] = 0x0575;
  17411. t['yicyrillic'] = 0x0457;
  17412. t['yikorean'] = 0x3162;
  17413. t['yinyang'] = 0x262F;
  17414. t['yiwnarmenian'] = 0x0582;
  17415. t['ymonospace'] = 0xFF59;
  17416. t['yod'] = 0x05D9;
  17417. t['yoddagesh'] = 0xFB39;
  17418. t['yoddageshhebrew'] = 0xFB39;
  17419. t['yodhebrew'] = 0x05D9;
  17420. t['yodyodhebrew'] = 0x05F2;
  17421. t['yodyodpatahhebrew'] = 0xFB1F;
  17422. t['yohiragana'] = 0x3088;
  17423. t['yoikorean'] = 0x3189;
  17424. t['yokatakana'] = 0x30E8;
  17425. t['yokatakanahalfwidth'] = 0xFF96;
  17426. t['yokorean'] = 0x315B;
  17427. t['yosmallhiragana'] = 0x3087;
  17428. t['yosmallkatakana'] = 0x30E7;
  17429. t['yosmallkatakanahalfwidth'] = 0xFF6E;
  17430. t['yotgreek'] = 0x03F3;
  17431. t['yoyaekorean'] = 0x3188;
  17432. t['yoyakorean'] = 0x3187;
  17433. t['yoyakthai'] = 0x0E22;
  17434. t['yoyingthai'] = 0x0E0D;
  17435. t['yparen'] = 0x24B4;
  17436. t['ypogegrammeni'] = 0x037A;
  17437. t['ypogegrammenigreekcmb'] = 0x0345;
  17438. t['yr'] = 0x01A6;
  17439. t['yring'] = 0x1E99;
  17440. t['ysuperior'] = 0x02B8;
  17441. t['ytilde'] = 0x1EF9;
  17442. t['yturned'] = 0x028E;
  17443. t['yuhiragana'] = 0x3086;
  17444. t['yuikorean'] = 0x318C;
  17445. t['yukatakana'] = 0x30E6;
  17446. t['yukatakanahalfwidth'] = 0xFF95;
  17447. t['yukorean'] = 0x3160;
  17448. t['yusbigcyrillic'] = 0x046B;
  17449. t['yusbigiotifiedcyrillic'] = 0x046D;
  17450. t['yuslittlecyrillic'] = 0x0467;
  17451. t['yuslittleiotifiedcyrillic'] = 0x0469;
  17452. t['yusmallhiragana'] = 0x3085;
  17453. t['yusmallkatakana'] = 0x30E5;
  17454. t['yusmallkatakanahalfwidth'] = 0xFF6D;
  17455. t['yuyekorean'] = 0x318B;
  17456. t['yuyeokorean'] = 0x318A;
  17457. t['yyabengali'] = 0x09DF;
  17458. t['yyadeva'] = 0x095F;
  17459. t['z'] = 0x007A;
  17460. t['zaarmenian'] = 0x0566;
  17461. t['zacute'] = 0x017A;
  17462. t['zadeva'] = 0x095B;
  17463. t['zagurmukhi'] = 0x0A5B;
  17464. t['zaharabic'] = 0x0638;
  17465. t['zahfinalarabic'] = 0xFEC6;
  17466. t['zahinitialarabic'] = 0xFEC7;
  17467. t['zahiragana'] = 0x3056;
  17468. t['zahmedialarabic'] = 0xFEC8;
  17469. t['zainarabic'] = 0x0632;
  17470. t['zainfinalarabic'] = 0xFEB0;
  17471. t['zakatakana'] = 0x30B6;
  17472. t['zaqefgadolhebrew'] = 0x0595;
  17473. t['zaqefqatanhebrew'] = 0x0594;
  17474. t['zarqahebrew'] = 0x0598;
  17475. t['zayin'] = 0x05D6;
  17476. t['zayindagesh'] = 0xFB36;
  17477. t['zayindageshhebrew'] = 0xFB36;
  17478. t['zayinhebrew'] = 0x05D6;
  17479. t['zbopomofo'] = 0x3117;
  17480. t['zcaron'] = 0x017E;
  17481. t['zcircle'] = 0x24E9;
  17482. t['zcircumflex'] = 0x1E91;
  17483. t['zcurl'] = 0x0291;
  17484. t['zdot'] = 0x017C;
  17485. t['zdotaccent'] = 0x017C;
  17486. t['zdotbelow'] = 0x1E93;
  17487. t['zecyrillic'] = 0x0437;
  17488. t['zedescendercyrillic'] = 0x0499;
  17489. t['zedieresiscyrillic'] = 0x04DF;
  17490. t['zehiragana'] = 0x305C;
  17491. t['zekatakana'] = 0x30BC;
  17492. t['zero'] = 0x0030;
  17493. t['zeroarabic'] = 0x0660;
  17494. t['zerobengali'] = 0x09E6;
  17495. t['zerodeva'] = 0x0966;
  17496. t['zerogujarati'] = 0x0AE6;
  17497. t['zerogurmukhi'] = 0x0A66;
  17498. t['zerohackarabic'] = 0x0660;
  17499. t['zeroinferior'] = 0x2080;
  17500. t['zeromonospace'] = 0xFF10;
  17501. t['zerooldstyle'] = 0xF730;
  17502. t['zeropersian'] = 0x06F0;
  17503. t['zerosuperior'] = 0x2070;
  17504. t['zerothai'] = 0x0E50;
  17505. t['zerowidthjoiner'] = 0xFEFF;
  17506. t['zerowidthnonjoiner'] = 0x200C;
  17507. t['zerowidthspace'] = 0x200B;
  17508. t['zeta'] = 0x03B6;
  17509. t['zhbopomofo'] = 0x3113;
  17510. t['zhearmenian'] = 0x056A;
  17511. t['zhebrevecyrillic'] = 0x04C2;
  17512. t['zhecyrillic'] = 0x0436;
  17513. t['zhedescendercyrillic'] = 0x0497;
  17514. t['zhedieresiscyrillic'] = 0x04DD;
  17515. t['zihiragana'] = 0x3058;
  17516. t['zikatakana'] = 0x30B8;
  17517. t['zinorhebrew'] = 0x05AE;
  17518. t['zlinebelow'] = 0x1E95;
  17519. t['zmonospace'] = 0xFF5A;
  17520. t['zohiragana'] = 0x305E;
  17521. t['zokatakana'] = 0x30BE;
  17522. t['zparen'] = 0x24B5;
  17523. t['zretroflexhook'] = 0x0290;
  17524. t['zstroke'] = 0x01B6;
  17525. t['zuhiragana'] = 0x305A;
  17526. t['zukatakana'] = 0x30BA;
  17527. t['.notdef'] = 0x0000;
  17528. t['angbracketleftbig'] = 0x2329;
  17529. t['angbracketleftBig'] = 0x2329;
  17530. t['angbracketleftbigg'] = 0x2329;
  17531. t['angbracketleftBigg'] = 0x2329;
  17532. t['angbracketrightBig'] = 0x232A;
  17533. t['angbracketrightbig'] = 0x232A;
  17534. t['angbracketrightBigg'] = 0x232A;
  17535. t['angbracketrightbigg'] = 0x232A;
  17536. t['arrowhookleft'] = 0x21AA;
  17537. t['arrowhookright'] = 0x21A9;
  17538. t['arrowlefttophalf'] = 0x21BC;
  17539. t['arrowleftbothalf'] = 0x21BD;
  17540. t['arrownortheast'] = 0x2197;
  17541. t['arrownorthwest'] = 0x2196;
  17542. t['arrowrighttophalf'] = 0x21C0;
  17543. t['arrowrightbothalf'] = 0x21C1;
  17544. t['arrowsoutheast'] = 0x2198;
  17545. t['arrowsouthwest'] = 0x2199;
  17546. t['backslashbig'] = 0x2216;
  17547. t['backslashBig'] = 0x2216;
  17548. t['backslashBigg'] = 0x2216;
  17549. t['backslashbigg'] = 0x2216;
  17550. t['bardbl'] = 0x2016;
  17551. t['bracehtipdownleft'] = 0xFE37;
  17552. t['bracehtipdownright'] = 0xFE37;
  17553. t['bracehtipupleft'] = 0xFE38;
  17554. t['bracehtipupright'] = 0xFE38;
  17555. t['braceleftBig'] = 0x007B;
  17556. t['braceleftbig'] = 0x007B;
  17557. t['braceleftbigg'] = 0x007B;
  17558. t['braceleftBigg'] = 0x007B;
  17559. t['bracerightBig'] = 0x007D;
  17560. t['bracerightbig'] = 0x007D;
  17561. t['bracerightbigg'] = 0x007D;
  17562. t['bracerightBigg'] = 0x007D;
  17563. t['bracketleftbig'] = 0x005B;
  17564. t['bracketleftBig'] = 0x005B;
  17565. t['bracketleftbigg'] = 0x005B;
  17566. t['bracketleftBigg'] = 0x005B;
  17567. t['bracketrightBig'] = 0x005D;
  17568. t['bracketrightbig'] = 0x005D;
  17569. t['bracketrightbigg'] = 0x005D;
  17570. t['bracketrightBigg'] = 0x005D;
  17571. t['ceilingleftbig'] = 0x2308;
  17572. t['ceilingleftBig'] = 0x2308;
  17573. t['ceilingleftBigg'] = 0x2308;
  17574. t['ceilingleftbigg'] = 0x2308;
  17575. t['ceilingrightbig'] = 0x2309;
  17576. t['ceilingrightBig'] = 0x2309;
  17577. t['ceilingrightbigg'] = 0x2309;
  17578. t['ceilingrightBigg'] = 0x2309;
  17579. t['circledotdisplay'] = 0x2299;
  17580. t['circledottext'] = 0x2299;
  17581. t['circlemultiplydisplay'] = 0x2297;
  17582. t['circlemultiplytext'] = 0x2297;
  17583. t['circleplusdisplay'] = 0x2295;
  17584. t['circleplustext'] = 0x2295;
  17585. t['contintegraldisplay'] = 0x222E;
  17586. t['contintegraltext'] = 0x222E;
  17587. t['coproductdisplay'] = 0x2210;
  17588. t['coproducttext'] = 0x2210;
  17589. t['floorleftBig'] = 0x230A;
  17590. t['floorleftbig'] = 0x230A;
  17591. t['floorleftbigg'] = 0x230A;
  17592. t['floorleftBigg'] = 0x230A;
  17593. t['floorrightbig'] = 0x230B;
  17594. t['floorrightBig'] = 0x230B;
  17595. t['floorrightBigg'] = 0x230B;
  17596. t['floorrightbigg'] = 0x230B;
  17597. t['hatwide'] = 0x0302;
  17598. t['hatwider'] = 0x0302;
  17599. t['hatwidest'] = 0x0302;
  17600. t['intercal'] = 0x1D40;
  17601. t['integraldisplay'] = 0x222B;
  17602. t['integraltext'] = 0x222B;
  17603. t['intersectiondisplay'] = 0x22C2;
  17604. t['intersectiontext'] = 0x22C2;
  17605. t['logicalanddisplay'] = 0x2227;
  17606. t['logicalandtext'] = 0x2227;
  17607. t['logicalordisplay'] = 0x2228;
  17608. t['logicalortext'] = 0x2228;
  17609. t['parenleftBig'] = 0x0028;
  17610. t['parenleftbig'] = 0x0028;
  17611. t['parenleftBigg'] = 0x0028;
  17612. t['parenleftbigg'] = 0x0028;
  17613. t['parenrightBig'] = 0x0029;
  17614. t['parenrightbig'] = 0x0029;
  17615. t['parenrightBigg'] = 0x0029;
  17616. t['parenrightbigg'] = 0x0029;
  17617. t['prime'] = 0x2032;
  17618. t['productdisplay'] = 0x220F;
  17619. t['producttext'] = 0x220F;
  17620. t['radicalbig'] = 0x221A;
  17621. t['radicalBig'] = 0x221A;
  17622. t['radicalBigg'] = 0x221A;
  17623. t['radicalbigg'] = 0x221A;
  17624. t['radicalbt'] = 0x221A;
  17625. t['radicaltp'] = 0x221A;
  17626. t['radicalvertex'] = 0x221A;
  17627. t['slashbig'] = 0x002F;
  17628. t['slashBig'] = 0x002F;
  17629. t['slashBigg'] = 0x002F;
  17630. t['slashbigg'] = 0x002F;
  17631. t['summationdisplay'] = 0x2211;
  17632. t['summationtext'] = 0x2211;
  17633. t['tildewide'] = 0x02DC;
  17634. t['tildewider'] = 0x02DC;
  17635. t['tildewidest'] = 0x02DC;
  17636. t['uniondisplay'] = 0x22C3;
  17637. t['unionmultidisplay'] = 0x228E;
  17638. t['unionmultitext'] = 0x228E;
  17639. t['unionsqdisplay'] = 0x2294;
  17640. t['unionsqtext'] = 0x2294;
  17641. t['uniontext'] = 0x22C3;
  17642. t['vextenddouble'] = 0x2225;
  17643. t['vextendsingle'] = 0x2223;
  17644. });
  17645. var getDingbatsGlyphsUnicode = getLookupTableFactory(function (t) {
  17646. t['space'] = 0x0020;
  17647. t['a1'] = 0x2701;
  17648. t['a2'] = 0x2702;
  17649. t['a202'] = 0x2703;
  17650. t['a3'] = 0x2704;
  17651. t['a4'] = 0x260E;
  17652. t['a5'] = 0x2706;
  17653. t['a119'] = 0x2707;
  17654. t['a118'] = 0x2708;
  17655. t['a117'] = 0x2709;
  17656. t['a11'] = 0x261B;
  17657. t['a12'] = 0x261E;
  17658. t['a13'] = 0x270C;
  17659. t['a14'] = 0x270D;
  17660. t['a15'] = 0x270E;
  17661. t['a16'] = 0x270F;
  17662. t['a105'] = 0x2710;
  17663. t['a17'] = 0x2711;
  17664. t['a18'] = 0x2712;
  17665. t['a19'] = 0x2713;
  17666. t['a20'] = 0x2714;
  17667. t['a21'] = 0x2715;
  17668. t['a22'] = 0x2716;
  17669. t['a23'] = 0x2717;
  17670. t['a24'] = 0x2718;
  17671. t['a25'] = 0x2719;
  17672. t['a26'] = 0x271A;
  17673. t['a27'] = 0x271B;
  17674. t['a28'] = 0x271C;
  17675. t['a6'] = 0x271D;
  17676. t['a7'] = 0x271E;
  17677. t['a8'] = 0x271F;
  17678. t['a9'] = 0x2720;
  17679. t['a10'] = 0x2721;
  17680. t['a29'] = 0x2722;
  17681. t['a30'] = 0x2723;
  17682. t['a31'] = 0x2724;
  17683. t['a32'] = 0x2725;
  17684. t['a33'] = 0x2726;
  17685. t['a34'] = 0x2727;
  17686. t['a35'] = 0x2605;
  17687. t['a36'] = 0x2729;
  17688. t['a37'] = 0x272A;
  17689. t['a38'] = 0x272B;
  17690. t['a39'] = 0x272C;
  17691. t['a40'] = 0x272D;
  17692. t['a41'] = 0x272E;
  17693. t['a42'] = 0x272F;
  17694. t['a43'] = 0x2730;
  17695. t['a44'] = 0x2731;
  17696. t['a45'] = 0x2732;
  17697. t['a46'] = 0x2733;
  17698. t['a47'] = 0x2734;
  17699. t['a48'] = 0x2735;
  17700. t['a49'] = 0x2736;
  17701. t['a50'] = 0x2737;
  17702. t['a51'] = 0x2738;
  17703. t['a52'] = 0x2739;
  17704. t['a53'] = 0x273A;
  17705. t['a54'] = 0x273B;
  17706. t['a55'] = 0x273C;
  17707. t['a56'] = 0x273D;
  17708. t['a57'] = 0x273E;
  17709. t['a58'] = 0x273F;
  17710. t['a59'] = 0x2740;
  17711. t['a60'] = 0x2741;
  17712. t['a61'] = 0x2742;
  17713. t['a62'] = 0x2743;
  17714. t['a63'] = 0x2744;
  17715. t['a64'] = 0x2745;
  17716. t['a65'] = 0x2746;
  17717. t['a66'] = 0x2747;
  17718. t['a67'] = 0x2748;
  17719. t['a68'] = 0x2749;
  17720. t['a69'] = 0x274A;
  17721. t['a70'] = 0x274B;
  17722. t['a71'] = 0x25CF;
  17723. t['a72'] = 0x274D;
  17724. t['a73'] = 0x25A0;
  17725. t['a74'] = 0x274F;
  17726. t['a203'] = 0x2750;
  17727. t['a75'] = 0x2751;
  17728. t['a204'] = 0x2752;
  17729. t['a76'] = 0x25B2;
  17730. t['a77'] = 0x25BC;
  17731. t['a78'] = 0x25C6;
  17732. t['a79'] = 0x2756;
  17733. t['a81'] = 0x25D7;
  17734. t['a82'] = 0x2758;
  17735. t['a83'] = 0x2759;
  17736. t['a84'] = 0x275A;
  17737. t['a97'] = 0x275B;
  17738. t['a98'] = 0x275C;
  17739. t['a99'] = 0x275D;
  17740. t['a100'] = 0x275E;
  17741. t['a101'] = 0x2761;
  17742. t['a102'] = 0x2762;
  17743. t['a103'] = 0x2763;
  17744. t['a104'] = 0x2764;
  17745. t['a106'] = 0x2765;
  17746. t['a107'] = 0x2766;
  17747. t['a108'] = 0x2767;
  17748. t['a112'] = 0x2663;
  17749. t['a111'] = 0x2666;
  17750. t['a110'] = 0x2665;
  17751. t['a109'] = 0x2660;
  17752. t['a120'] = 0x2460;
  17753. t['a121'] = 0x2461;
  17754. t['a122'] = 0x2462;
  17755. t['a123'] = 0x2463;
  17756. t['a124'] = 0x2464;
  17757. t['a125'] = 0x2465;
  17758. t['a126'] = 0x2466;
  17759. t['a127'] = 0x2467;
  17760. t['a128'] = 0x2468;
  17761. t['a129'] = 0x2469;
  17762. t['a130'] = 0x2776;
  17763. t['a131'] = 0x2777;
  17764. t['a132'] = 0x2778;
  17765. t['a133'] = 0x2779;
  17766. t['a134'] = 0x277A;
  17767. t['a135'] = 0x277B;
  17768. t['a136'] = 0x277C;
  17769. t['a137'] = 0x277D;
  17770. t['a138'] = 0x277E;
  17771. t['a139'] = 0x277F;
  17772. t['a140'] = 0x2780;
  17773. t['a141'] = 0x2781;
  17774. t['a142'] = 0x2782;
  17775. t['a143'] = 0x2783;
  17776. t['a144'] = 0x2784;
  17777. t['a145'] = 0x2785;
  17778. t['a146'] = 0x2786;
  17779. t['a147'] = 0x2787;
  17780. t['a148'] = 0x2788;
  17781. t['a149'] = 0x2789;
  17782. t['a150'] = 0x278A;
  17783. t['a151'] = 0x278B;
  17784. t['a152'] = 0x278C;
  17785. t['a153'] = 0x278D;
  17786. t['a154'] = 0x278E;
  17787. t['a155'] = 0x278F;
  17788. t['a156'] = 0x2790;
  17789. t['a157'] = 0x2791;
  17790. t['a158'] = 0x2792;
  17791. t['a159'] = 0x2793;
  17792. t['a160'] = 0x2794;
  17793. t['a161'] = 0x2192;
  17794. t['a163'] = 0x2194;
  17795. t['a164'] = 0x2195;
  17796. t['a196'] = 0x2798;
  17797. t['a165'] = 0x2799;
  17798. t['a192'] = 0x279A;
  17799. t['a166'] = 0x279B;
  17800. t['a167'] = 0x279C;
  17801. t['a168'] = 0x279D;
  17802. t['a169'] = 0x279E;
  17803. t['a170'] = 0x279F;
  17804. t['a171'] = 0x27A0;
  17805. t['a172'] = 0x27A1;
  17806. t['a173'] = 0x27A2;
  17807. t['a162'] = 0x27A3;
  17808. t['a174'] = 0x27A4;
  17809. t['a175'] = 0x27A5;
  17810. t['a176'] = 0x27A6;
  17811. t['a177'] = 0x27A7;
  17812. t['a178'] = 0x27A8;
  17813. t['a179'] = 0x27A9;
  17814. t['a193'] = 0x27AA;
  17815. t['a180'] = 0x27AB;
  17816. t['a199'] = 0x27AC;
  17817. t['a181'] = 0x27AD;
  17818. t['a200'] = 0x27AE;
  17819. t['a182'] = 0x27AF;
  17820. t['a201'] = 0x27B1;
  17821. t['a183'] = 0x27B2;
  17822. t['a184'] = 0x27B3;
  17823. t['a197'] = 0x27B4;
  17824. t['a185'] = 0x27B5;
  17825. t['a194'] = 0x27B6;
  17826. t['a198'] = 0x27B7;
  17827. t['a186'] = 0x27B8;
  17828. t['a195'] = 0x27B9;
  17829. t['a187'] = 0x27BA;
  17830. t['a188'] = 0x27BB;
  17831. t['a189'] = 0x27BC;
  17832. t['a190'] = 0x27BD;
  17833. t['a191'] = 0x27BE;
  17834. t['a89'] = 0x2768;
  17835. t['a90'] = 0x2769;
  17836. t['a93'] = 0x276A;
  17837. t['a94'] = 0x276B;
  17838. t['a91'] = 0x276C;
  17839. t['a92'] = 0x276D;
  17840. t['a205'] = 0x276E;
  17841. t['a85'] = 0x276F;
  17842. t['a206'] = 0x2770;
  17843. t['a86'] = 0x2771;
  17844. t['a87'] = 0x2772;
  17845. t['a88'] = 0x2773;
  17846. t['a95'] = 0x2774;
  17847. t['a96'] = 0x2775;
  17848. t['.notdef'] = 0x0000;
  17849. });
  17850. exports.getGlyphsUnicode = getGlyphsUnicode;
  17851. exports.getDingbatsGlyphsUnicode = getDingbatsGlyphsUnicode;
  17852. /***/ }),
  17853. /* 8 */
  17854. /***/ (function(module, exports, __w_pdfjs_require__) {
  17855. "use strict";
  17856. var sharedUtil = __w_pdfjs_require__(0);
  17857. var corePrimitives = __w_pdfjs_require__(1);
  17858. var corePdfManager = __w_pdfjs_require__(33);
  17859. var UNSUPPORTED_FEATURES = sharedUtil.UNSUPPORTED_FEATURES;
  17860. var InvalidPDFException = sharedUtil.InvalidPDFException;
  17861. var MessageHandler = sharedUtil.MessageHandler;
  17862. var MissingPDFException = sharedUtil.MissingPDFException;
  17863. var UnexpectedResponseException = sharedUtil.UnexpectedResponseException;
  17864. var PasswordException = sharedUtil.PasswordException;
  17865. var UnknownErrorException = sharedUtil.UnknownErrorException;
  17866. var XRefParseException = sharedUtil.XRefParseException;
  17867. var arrayByteLength = sharedUtil.arrayByteLength;
  17868. var arraysToBytes = sharedUtil.arraysToBytes;
  17869. var assert = sharedUtil.assert;
  17870. var createPromiseCapability = sharedUtil.createPromiseCapability;
  17871. var info = sharedUtil.info;
  17872. var warn = sharedUtil.warn;
  17873. var setVerbosityLevel = sharedUtil.setVerbosityLevel;
  17874. var isNodeJS = sharedUtil.isNodeJS;
  17875. var Ref = corePrimitives.Ref;
  17876. var LocalPdfManager = corePdfManager.LocalPdfManager;
  17877. var NetworkPdfManager = corePdfManager.NetworkPdfManager;
  17878. var WorkerTask = function WorkerTaskClosure() {
  17879. function WorkerTask(name) {
  17880. this.name = name;
  17881. this.terminated = false;
  17882. this._capability = createPromiseCapability();
  17883. }
  17884. WorkerTask.prototype = {
  17885. get finished() {
  17886. return this._capability.promise;
  17887. },
  17888. finish: function () {
  17889. this._capability.resolve();
  17890. },
  17891. terminate: function () {
  17892. this.terminated = true;
  17893. },
  17894. ensureNotTerminated: function () {
  17895. if (this.terminated) {
  17896. throw new Error('Worker task was terminated');
  17897. }
  17898. }
  17899. };
  17900. return WorkerTask;
  17901. }();
  17902. var PDFWorkerStream = function PDFWorkerStreamClosure() {
  17903. function PDFWorkerStream(params, msgHandler) {
  17904. this._queuedChunks = [];
  17905. var initialData = params.initialData;
  17906. if (initialData && initialData.length > 0) {
  17907. this._queuedChunks.push(initialData);
  17908. }
  17909. this._msgHandler = msgHandler;
  17910. this._isRangeSupported = !params.disableRange;
  17911. this._isStreamingSupported = !params.disableStream;
  17912. this._contentLength = params.length;
  17913. this._fullRequestReader = null;
  17914. this._rangeReaders = [];
  17915. msgHandler.on('OnDataRange', this._onReceiveData.bind(this));
  17916. msgHandler.on('OnDataProgress', this._onProgress.bind(this));
  17917. }
  17918. PDFWorkerStream.prototype = {
  17919. _onReceiveData: function PDFWorkerStream_onReceiveData(args) {
  17920. if (args.begin === undefined) {
  17921. if (this._fullRequestReader) {
  17922. this._fullRequestReader._enqueue(args.chunk);
  17923. } else {
  17924. this._queuedChunks.push(args.chunk);
  17925. }
  17926. } else {
  17927. var found = this._rangeReaders.some(function (rangeReader) {
  17928. if (rangeReader._begin !== args.begin) {
  17929. return false;
  17930. }
  17931. rangeReader._enqueue(args.chunk);
  17932. return true;
  17933. });
  17934. assert(found);
  17935. }
  17936. },
  17937. _onProgress: function PDFWorkerStream_onProgress(evt) {
  17938. if (this._rangeReaders.length > 0) {
  17939. var firstReader = this._rangeReaders[0];
  17940. if (firstReader.onProgress) {
  17941. firstReader.onProgress({ loaded: evt.loaded });
  17942. }
  17943. }
  17944. },
  17945. _removeRangeReader: function PDFWorkerStream_removeRangeReader(reader) {
  17946. var i = this._rangeReaders.indexOf(reader);
  17947. if (i >= 0) {
  17948. this._rangeReaders.splice(i, 1);
  17949. }
  17950. },
  17951. getFullReader: function PDFWorkerStream_getFullReader() {
  17952. assert(!this._fullRequestReader);
  17953. var queuedChunks = this._queuedChunks;
  17954. this._queuedChunks = null;
  17955. return new PDFWorkerStreamReader(this, queuedChunks);
  17956. },
  17957. getRangeReader: function PDFWorkerStream_getRangeReader(begin, end) {
  17958. var reader = new PDFWorkerStreamRangeReader(this, begin, end);
  17959. this._msgHandler.send('RequestDataRange', {
  17960. begin: begin,
  17961. end: end
  17962. });
  17963. this._rangeReaders.push(reader);
  17964. return reader;
  17965. },
  17966. cancelAllRequests: function PDFWorkerStream_cancelAllRequests(reason) {
  17967. if (this._fullRequestReader) {
  17968. this._fullRequestReader.cancel(reason);
  17969. }
  17970. var readers = this._rangeReaders.slice(0);
  17971. readers.forEach(function (rangeReader) {
  17972. rangeReader.cancel(reason);
  17973. });
  17974. }
  17975. };
  17976. function PDFWorkerStreamReader(stream, queuedChunks) {
  17977. this._stream = stream;
  17978. this._done = false;
  17979. this._queuedChunks = queuedChunks || [];
  17980. this._requests = [];
  17981. this._headersReady = Promise.resolve();
  17982. stream._fullRequestReader = this;
  17983. this.onProgress = null;
  17984. }
  17985. PDFWorkerStreamReader.prototype = {
  17986. _enqueue: function PDFWorkerStreamReader_enqueue(chunk) {
  17987. if (this._done) {
  17988. return;
  17989. }
  17990. if (this._requests.length > 0) {
  17991. var requestCapability = this._requests.shift();
  17992. requestCapability.resolve({
  17993. value: chunk,
  17994. done: false
  17995. });
  17996. return;
  17997. }
  17998. this._queuedChunks.push(chunk);
  17999. },
  18000. get headersReady() {
  18001. return this._headersReady;
  18002. },
  18003. get isRangeSupported() {
  18004. return this._stream._isRangeSupported;
  18005. },
  18006. get isStreamingSupported() {
  18007. return this._stream._isStreamingSupported;
  18008. },
  18009. get contentLength() {
  18010. return this._stream._contentLength;
  18011. },
  18012. read: function PDFWorkerStreamReader_read() {
  18013. if (this._queuedChunks.length > 0) {
  18014. var chunk = this._queuedChunks.shift();
  18015. return Promise.resolve({
  18016. value: chunk,
  18017. done: false
  18018. });
  18019. }
  18020. if (this._done) {
  18021. return Promise.resolve({
  18022. value: undefined,
  18023. done: true
  18024. });
  18025. }
  18026. var requestCapability = createPromiseCapability();
  18027. this._requests.push(requestCapability);
  18028. return requestCapability.promise;
  18029. },
  18030. cancel: function PDFWorkerStreamReader_cancel(reason) {
  18031. this._done = true;
  18032. this._requests.forEach(function (requestCapability) {
  18033. requestCapability.resolve({
  18034. value: undefined,
  18035. done: true
  18036. });
  18037. });
  18038. this._requests = [];
  18039. }
  18040. };
  18041. function PDFWorkerStreamRangeReader(stream, begin, end) {
  18042. this._stream = stream;
  18043. this._begin = begin;
  18044. this._end = end;
  18045. this._queuedChunk = null;
  18046. this._requests = [];
  18047. this._done = false;
  18048. this.onProgress = null;
  18049. }
  18050. PDFWorkerStreamRangeReader.prototype = {
  18051. _enqueue: function PDFWorkerStreamRangeReader_enqueue(chunk) {
  18052. if (this._done) {
  18053. return;
  18054. }
  18055. if (this._requests.length === 0) {
  18056. this._queuedChunk = chunk;
  18057. } else {
  18058. var requestsCapability = this._requests.shift();
  18059. requestsCapability.resolve({
  18060. value: chunk,
  18061. done: false
  18062. });
  18063. this._requests.forEach(function (requestCapability) {
  18064. requestCapability.resolve({
  18065. value: undefined,
  18066. done: true
  18067. });
  18068. });
  18069. this._requests = [];
  18070. }
  18071. this._done = true;
  18072. this._stream._removeRangeReader(this);
  18073. },
  18074. get isStreamingSupported() {
  18075. return false;
  18076. },
  18077. read: function PDFWorkerStreamRangeReader_read() {
  18078. if (this._queuedChunk) {
  18079. return Promise.resolve({
  18080. value: this._queuedChunk,
  18081. done: false
  18082. });
  18083. }
  18084. if (this._done) {
  18085. return Promise.resolve({
  18086. value: undefined,
  18087. done: true
  18088. });
  18089. }
  18090. var requestCapability = createPromiseCapability();
  18091. this._requests.push(requestCapability);
  18092. return requestCapability.promise;
  18093. },
  18094. cancel: function PDFWorkerStreamRangeReader_cancel(reason) {
  18095. this._done = true;
  18096. this._requests.forEach(function (requestCapability) {
  18097. requestCapability.resolve({
  18098. value: undefined,
  18099. done: true
  18100. });
  18101. });
  18102. this._requests = [];
  18103. this._stream._removeRangeReader(this);
  18104. }
  18105. };
  18106. return PDFWorkerStream;
  18107. }();
  18108. var PDFNetworkStream;
  18109. function setPDFNetworkStreamClass(cls) {
  18110. PDFNetworkStream = cls;
  18111. }
  18112. var WorkerMessageHandler = {
  18113. setup: function wphSetup(handler, port) {
  18114. var testMessageProcessed = false;
  18115. handler.on('test', function wphSetupTest(data) {
  18116. if (testMessageProcessed) {
  18117. return;
  18118. }
  18119. testMessageProcessed = true;
  18120. if (!(data instanceof Uint8Array)) {
  18121. handler.send('test', 'main', false);
  18122. return;
  18123. }
  18124. var supportTransfers = data[0] === 255;
  18125. handler.postMessageTransfers = supportTransfers;
  18126. var xhr = new XMLHttpRequest();
  18127. var responseExists = 'response' in xhr;
  18128. try {
  18129. xhr.responseType;
  18130. } catch (e) {
  18131. responseExists = false;
  18132. }
  18133. if (!responseExists) {
  18134. handler.send('test', false);
  18135. return;
  18136. }
  18137. handler.send('test', {
  18138. supportTypedArray: true,
  18139. supportTransfers: supportTransfers
  18140. });
  18141. });
  18142. handler.on('configure', function wphConfigure(data) {
  18143. setVerbosityLevel(data.verbosity);
  18144. });
  18145. handler.on('GetDocRequest', function wphSetupDoc(data) {
  18146. return WorkerMessageHandler.createDocumentHandler(data, port);
  18147. });
  18148. },
  18149. createDocumentHandler: function wphCreateDocumentHandler(docParams, port) {
  18150. var pdfManager;
  18151. var terminated = false;
  18152. var cancelXHRs = null;
  18153. var WorkerTasks = [];
  18154. var docId = docParams.docId;
  18155. var docBaseUrl = docParams.docBaseUrl;
  18156. var workerHandlerName = docParams.docId + '_worker';
  18157. var handler = new MessageHandler(workerHandlerName, docId, port);
  18158. handler.postMessageTransfers = docParams.postMessageTransfers;
  18159. function ensureNotTerminated() {
  18160. if (terminated) {
  18161. throw new Error('Worker was terminated');
  18162. }
  18163. }
  18164. function startWorkerTask(task) {
  18165. WorkerTasks.push(task);
  18166. }
  18167. function finishWorkerTask(task) {
  18168. task.finish();
  18169. var i = WorkerTasks.indexOf(task);
  18170. WorkerTasks.splice(i, 1);
  18171. }
  18172. function loadDocument(recoveryMode) {
  18173. var loadDocumentCapability = createPromiseCapability();
  18174. var parseSuccess = function parseSuccess() {
  18175. var numPagesPromise = pdfManager.ensureDoc('numPages');
  18176. var fingerprintPromise = pdfManager.ensureDoc('fingerprint');
  18177. var encryptedPromise = pdfManager.ensureXRef('encrypt');
  18178. Promise.all([
  18179. numPagesPromise,
  18180. fingerprintPromise,
  18181. encryptedPromise
  18182. ]).then(function onDocReady(results) {
  18183. var doc = {
  18184. numPages: results[0],
  18185. fingerprint: results[1],
  18186. encrypted: !!results[2]
  18187. };
  18188. loadDocumentCapability.resolve(doc);
  18189. }, parseFailure);
  18190. };
  18191. var parseFailure = function parseFailure(e) {
  18192. loadDocumentCapability.reject(e);
  18193. };
  18194. pdfManager.ensureDoc('checkHeader', []).then(function () {
  18195. pdfManager.ensureDoc('parseStartXRef', []).then(function () {
  18196. pdfManager.ensureDoc('parse', [recoveryMode]).then(parseSuccess, parseFailure);
  18197. }, parseFailure);
  18198. }, parseFailure);
  18199. return loadDocumentCapability.promise;
  18200. }
  18201. function getPdfManager(data, evaluatorOptions) {
  18202. var pdfManagerCapability = createPromiseCapability();
  18203. var pdfManager;
  18204. var source = data.source;
  18205. if (source.data) {
  18206. try {
  18207. pdfManager = new LocalPdfManager(docId, source.data, source.password, evaluatorOptions, docBaseUrl);
  18208. pdfManagerCapability.resolve(pdfManager);
  18209. } catch (ex) {
  18210. pdfManagerCapability.reject(ex);
  18211. }
  18212. return pdfManagerCapability.promise;
  18213. }
  18214. var pdfStream;
  18215. try {
  18216. if (source.chunkedViewerLoading) {
  18217. pdfStream = new PDFWorkerStream(source, handler);
  18218. } else {
  18219. assert(PDFNetworkStream, 'pdfjs/core/network module is not loaded');
  18220. pdfStream = new PDFNetworkStream(data);
  18221. }
  18222. } catch (ex) {
  18223. pdfManagerCapability.reject(ex);
  18224. return pdfManagerCapability.promise;
  18225. }
  18226. var fullRequest = pdfStream.getFullReader();
  18227. fullRequest.headersReady.then(function () {
  18228. if (!fullRequest.isStreamingSupported || !fullRequest.isRangeSupported) {
  18229. fullRequest.onProgress = function (evt) {
  18230. handler.send('DocProgress', {
  18231. loaded: evt.loaded,
  18232. total: evt.total
  18233. });
  18234. };
  18235. }
  18236. if (!fullRequest.isRangeSupported) {
  18237. return;
  18238. }
  18239. var disableAutoFetch = source.disableAutoFetch || fullRequest.isStreamingSupported;
  18240. pdfManager = new NetworkPdfManager(docId, pdfStream, {
  18241. msgHandler: handler,
  18242. url: source.url,
  18243. password: source.password,
  18244. length: fullRequest.contentLength,
  18245. disableAutoFetch: disableAutoFetch,
  18246. rangeChunkSize: source.rangeChunkSize
  18247. }, evaluatorOptions, docBaseUrl);
  18248. pdfManagerCapability.resolve(pdfManager);
  18249. cancelXHRs = null;
  18250. }).catch(function (reason) {
  18251. pdfManagerCapability.reject(reason);
  18252. cancelXHRs = null;
  18253. });
  18254. var cachedChunks = [], loaded = 0;
  18255. var flushChunks = function () {
  18256. var pdfFile = arraysToBytes(cachedChunks);
  18257. if (source.length && pdfFile.length !== source.length) {
  18258. warn('reported HTTP length is different from actual');
  18259. }
  18260. try {
  18261. pdfManager = new LocalPdfManager(docId, pdfFile, source.password, evaluatorOptions, docBaseUrl);
  18262. pdfManagerCapability.resolve(pdfManager);
  18263. } catch (ex) {
  18264. pdfManagerCapability.reject(ex);
  18265. }
  18266. cachedChunks = [];
  18267. };
  18268. var readPromise = new Promise(function (resolve, reject) {
  18269. var readChunk = function (chunk) {
  18270. try {
  18271. ensureNotTerminated();
  18272. if (chunk.done) {
  18273. if (!pdfManager) {
  18274. flushChunks();
  18275. }
  18276. cancelXHRs = null;
  18277. return;
  18278. }
  18279. var data = chunk.value;
  18280. loaded += arrayByteLength(data);
  18281. if (!fullRequest.isStreamingSupported) {
  18282. handler.send('DocProgress', {
  18283. loaded: loaded,
  18284. total: Math.max(loaded, fullRequest.contentLength || 0)
  18285. });
  18286. }
  18287. if (pdfManager) {
  18288. pdfManager.sendProgressiveData(data);
  18289. } else {
  18290. cachedChunks.push(data);
  18291. }
  18292. fullRequest.read().then(readChunk, reject);
  18293. } catch (e) {
  18294. reject(e);
  18295. }
  18296. };
  18297. fullRequest.read().then(readChunk, reject);
  18298. });
  18299. readPromise.catch(function (e) {
  18300. pdfManagerCapability.reject(e);
  18301. cancelXHRs = null;
  18302. });
  18303. cancelXHRs = function () {
  18304. pdfStream.cancelAllRequests('abort');
  18305. };
  18306. return pdfManagerCapability.promise;
  18307. }
  18308. function setupDoc(data) {
  18309. function onSuccess(doc) {
  18310. ensureNotTerminated();
  18311. handler.send('GetDoc', { pdfInfo: doc });
  18312. }
  18313. function onFailure(e) {
  18314. if (e instanceof PasswordException) {
  18315. var task = new WorkerTask('PasswordException: response ' + e.code);
  18316. startWorkerTask(task);
  18317. handler.sendWithPromise('PasswordRequest', e).then(function (data) {
  18318. finishWorkerTask(task);
  18319. pdfManager.updatePassword(data.password);
  18320. pdfManagerReady();
  18321. }).catch(function (ex) {
  18322. finishWorkerTask(task);
  18323. handler.send('PasswordException', ex);
  18324. }.bind(null, e));
  18325. } else if (e instanceof InvalidPDFException) {
  18326. handler.send('InvalidPDF', e);
  18327. } else if (e instanceof MissingPDFException) {
  18328. handler.send('MissingPDF', e);
  18329. } else if (e instanceof UnexpectedResponseException) {
  18330. handler.send('UnexpectedResponse', e);
  18331. } else {
  18332. handler.send('UnknownError', new UnknownErrorException(e.message, e.toString()));
  18333. }
  18334. }
  18335. function pdfManagerReady() {
  18336. ensureNotTerminated();
  18337. loadDocument(false).then(onSuccess, function loadFailure(ex) {
  18338. ensureNotTerminated();
  18339. if (!(ex instanceof XRefParseException)) {
  18340. onFailure(ex);
  18341. return;
  18342. }
  18343. pdfManager.requestLoadedStream();
  18344. pdfManager.onLoadedStream().then(function () {
  18345. ensureNotTerminated();
  18346. loadDocument(true).then(onSuccess, onFailure);
  18347. });
  18348. }, onFailure);
  18349. }
  18350. ensureNotTerminated();
  18351. var evaluatorOptions = {
  18352. forceDataSchema: data.disableCreateObjectURL,
  18353. maxImageSize: data.maxImageSize === undefined ? -1 : data.maxImageSize,
  18354. disableFontFace: data.disableFontFace,
  18355. disableNativeImageDecoder: data.disableNativeImageDecoder
  18356. };
  18357. getPdfManager(data, evaluatorOptions).then(function (newPdfManager) {
  18358. if (terminated) {
  18359. newPdfManager.terminate();
  18360. throw new Error('Worker was terminated');
  18361. }
  18362. pdfManager = newPdfManager;
  18363. handler.send('PDFManagerReady', null);
  18364. pdfManager.onLoadedStream().then(function (stream) {
  18365. handler.send('DataLoaded', { length: stream.bytes.byteLength });
  18366. });
  18367. }).then(pdfManagerReady, onFailure);
  18368. }
  18369. handler.on('GetPage', function wphSetupGetPage(data) {
  18370. return pdfManager.getPage(data.pageIndex).then(function (page) {
  18371. var rotatePromise = pdfManager.ensure(page, 'rotate');
  18372. var refPromise = pdfManager.ensure(page, 'ref');
  18373. var userUnitPromise = pdfManager.ensure(page, 'userUnit');
  18374. var viewPromise = pdfManager.ensure(page, 'view');
  18375. return Promise.all([
  18376. rotatePromise,
  18377. refPromise,
  18378. userUnitPromise,
  18379. viewPromise
  18380. ]).then(function (results) {
  18381. return {
  18382. rotate: results[0],
  18383. ref: results[1],
  18384. userUnit: results[2],
  18385. view: results[3]
  18386. };
  18387. });
  18388. });
  18389. });
  18390. handler.on('GetPageIndex', function wphSetupGetPageIndex(data) {
  18391. var ref = new Ref(data.ref.num, data.ref.gen);
  18392. var catalog = pdfManager.pdfDocument.catalog;
  18393. return catalog.getPageIndex(ref);
  18394. });
  18395. handler.on('GetDestinations', function wphSetupGetDestinations(data) {
  18396. return pdfManager.ensureCatalog('destinations');
  18397. });
  18398. handler.on('GetDestination', function wphSetupGetDestination(data) {
  18399. return pdfManager.ensureCatalog('getDestination', [data.id]);
  18400. });
  18401. handler.on('GetPageLabels', function wphSetupGetPageLabels(data) {
  18402. return pdfManager.ensureCatalog('pageLabels');
  18403. });
  18404. handler.on('GetAttachments', function wphSetupGetAttachments(data) {
  18405. return pdfManager.ensureCatalog('attachments');
  18406. });
  18407. handler.on('GetJavaScript', function wphSetupGetJavaScript(data) {
  18408. return pdfManager.ensureCatalog('javaScript');
  18409. });
  18410. handler.on('GetOutline', function wphSetupGetOutline(data) {
  18411. return pdfManager.ensureCatalog('documentOutline');
  18412. });
  18413. handler.on('GetMetadata', function wphSetupGetMetadata(data) {
  18414. return Promise.all([
  18415. pdfManager.ensureDoc('documentInfo'),
  18416. pdfManager.ensureCatalog('metadata')
  18417. ]);
  18418. });
  18419. handler.on('GetData', function wphSetupGetData(data) {
  18420. pdfManager.requestLoadedStream();
  18421. return pdfManager.onLoadedStream().then(function (stream) {
  18422. return stream.bytes;
  18423. });
  18424. });
  18425. handler.on('GetStats', function wphSetupGetStats(data) {
  18426. return pdfManager.pdfDocument.xref.stats;
  18427. });
  18428. handler.on('GetAnnotations', function wphSetupGetAnnotations(data) {
  18429. return pdfManager.getPage(data.pageIndex).then(function (page) {
  18430. return pdfManager.ensure(page, 'getAnnotationsData', [data.intent]);
  18431. });
  18432. });
  18433. handler.on('RenderPageRequest', function wphSetupRenderPage(data) {
  18434. var pageIndex = data.pageIndex;
  18435. pdfManager.getPage(pageIndex).then(function (page) {
  18436. var task = new WorkerTask('RenderPageRequest: page ' + pageIndex);
  18437. startWorkerTask(task);
  18438. var pageNum = pageIndex + 1;
  18439. var start = Date.now();
  18440. page.getOperatorList(handler, task, data.intent, data.renderInteractiveForms).then(function (operatorList) {
  18441. finishWorkerTask(task);
  18442. info('page=' + pageNum + ' - getOperatorList: time=' + (Date.now() - start) + 'ms, len=' + operatorList.totalLength);
  18443. }, function (e) {
  18444. finishWorkerTask(task);
  18445. if (task.terminated) {
  18446. return;
  18447. }
  18448. handler.send('UnsupportedFeature', { featureId: UNSUPPORTED_FEATURES.unknown });
  18449. var minimumStackMessage = 'worker.js: while trying to getPage() and getOperatorList()';
  18450. var wrappedException;
  18451. if (typeof e === 'string') {
  18452. wrappedException = {
  18453. message: e,
  18454. stack: minimumStackMessage
  18455. };
  18456. } else if (typeof e === 'object') {
  18457. wrappedException = {
  18458. message: e.message || e.toString(),
  18459. stack: e.stack || minimumStackMessage
  18460. };
  18461. } else {
  18462. wrappedException = {
  18463. message: 'Unknown exception type: ' + typeof e,
  18464. stack: minimumStackMessage
  18465. };
  18466. }
  18467. handler.send('PageError', {
  18468. pageNum: pageNum,
  18469. error: wrappedException,
  18470. intent: data.intent
  18471. });
  18472. });
  18473. });
  18474. }, this);
  18475. handler.on('GetTextContent', function wphExtractText(data) {
  18476. var pageIndex = data.pageIndex;
  18477. var normalizeWhitespace = data.normalizeWhitespace;
  18478. var combineTextItems = data.combineTextItems;
  18479. return pdfManager.getPage(pageIndex).then(function (page) {
  18480. var task = new WorkerTask('GetTextContent: page ' + pageIndex);
  18481. startWorkerTask(task);
  18482. var pageNum = pageIndex + 1;
  18483. var start = Date.now();
  18484. return page.extractTextContent(task, normalizeWhitespace, combineTextItems).then(function (textContent) {
  18485. finishWorkerTask(task);
  18486. info('text indexing: page=' + pageNum + ' - time=' + (Date.now() - start) + 'ms');
  18487. return textContent;
  18488. }, function (reason) {
  18489. finishWorkerTask(task);
  18490. if (task.terminated) {
  18491. return;
  18492. }
  18493. throw reason;
  18494. });
  18495. });
  18496. });
  18497. handler.on('Cleanup', function wphCleanup(data) {
  18498. return pdfManager.cleanup();
  18499. });
  18500. handler.on('Terminate', function wphTerminate(data) {
  18501. terminated = true;
  18502. if (pdfManager) {
  18503. pdfManager.terminate();
  18504. pdfManager = null;
  18505. }
  18506. if (cancelXHRs) {
  18507. cancelXHRs();
  18508. }
  18509. var waitOn = [];
  18510. WorkerTasks.forEach(function (task) {
  18511. waitOn.push(task.finished);
  18512. task.terminate();
  18513. });
  18514. return Promise.all(waitOn).then(function () {
  18515. handler.destroy();
  18516. handler = null;
  18517. });
  18518. });
  18519. handler.on('Ready', function wphReady(data) {
  18520. setupDoc(docParams);
  18521. docParams = null;
  18522. });
  18523. return workerHandlerName;
  18524. }
  18525. };
  18526. function initializeWorker() {
  18527. var handler = new MessageHandler('worker', 'main', self);
  18528. WorkerMessageHandler.setup(handler, self);
  18529. handler.send('ready', null);
  18530. }
  18531. if (typeof window === 'undefined' && !isNodeJS()) {
  18532. initializeWorker();
  18533. }
  18534. exports.setPDFNetworkStreamClass = setPDFNetworkStreamClass;
  18535. exports.WorkerTask = WorkerTask;
  18536. exports.WorkerMessageHandler = WorkerMessageHandler;
  18537. /***/ }),
  18538. /* 9 */
  18539. /***/ (function(module, exports) {
  18540. var g;
  18541. g = function () {
  18542. return this;
  18543. }();
  18544. try {
  18545. g = g || Function("return this")() || (1, eval)("this");
  18546. } catch (e) {
  18547. if (typeof window === "object")
  18548. g = window;
  18549. }
  18550. module.exports = g;
  18551. /***/ }),
  18552. /* 10 */
  18553. /***/ (function(module, exports, __w_pdfjs_require__) {
  18554. "use strict";
  18555. var ArithmeticDecoder = function ArithmeticDecoderClosure() {
  18556. var QeTable = [
  18557. {
  18558. qe: 0x5601,
  18559. nmps: 1,
  18560. nlps: 1,
  18561. switchFlag: 1
  18562. },
  18563. {
  18564. qe: 0x3401,
  18565. nmps: 2,
  18566. nlps: 6,
  18567. switchFlag: 0
  18568. },
  18569. {
  18570. qe: 0x1801,
  18571. nmps: 3,
  18572. nlps: 9,
  18573. switchFlag: 0
  18574. },
  18575. {
  18576. qe: 0x0AC1,
  18577. nmps: 4,
  18578. nlps: 12,
  18579. switchFlag: 0
  18580. },
  18581. {
  18582. qe: 0x0521,
  18583. nmps: 5,
  18584. nlps: 29,
  18585. switchFlag: 0
  18586. },
  18587. {
  18588. qe: 0x0221,
  18589. nmps: 38,
  18590. nlps: 33,
  18591. switchFlag: 0
  18592. },
  18593. {
  18594. qe: 0x5601,
  18595. nmps: 7,
  18596. nlps: 6,
  18597. switchFlag: 1
  18598. },
  18599. {
  18600. qe: 0x5401,
  18601. nmps: 8,
  18602. nlps: 14,
  18603. switchFlag: 0
  18604. },
  18605. {
  18606. qe: 0x4801,
  18607. nmps: 9,
  18608. nlps: 14,
  18609. switchFlag: 0
  18610. },
  18611. {
  18612. qe: 0x3801,
  18613. nmps: 10,
  18614. nlps: 14,
  18615. switchFlag: 0
  18616. },
  18617. {
  18618. qe: 0x3001,
  18619. nmps: 11,
  18620. nlps: 17,
  18621. switchFlag: 0
  18622. },
  18623. {
  18624. qe: 0x2401,
  18625. nmps: 12,
  18626. nlps: 18,
  18627. switchFlag: 0
  18628. },
  18629. {
  18630. qe: 0x1C01,
  18631. nmps: 13,
  18632. nlps: 20,
  18633. switchFlag: 0
  18634. },
  18635. {
  18636. qe: 0x1601,
  18637. nmps: 29,
  18638. nlps: 21,
  18639. switchFlag: 0
  18640. },
  18641. {
  18642. qe: 0x5601,
  18643. nmps: 15,
  18644. nlps: 14,
  18645. switchFlag: 1
  18646. },
  18647. {
  18648. qe: 0x5401,
  18649. nmps: 16,
  18650. nlps: 14,
  18651. switchFlag: 0
  18652. },
  18653. {
  18654. qe: 0x5101,
  18655. nmps: 17,
  18656. nlps: 15,
  18657. switchFlag: 0
  18658. },
  18659. {
  18660. qe: 0x4801,
  18661. nmps: 18,
  18662. nlps: 16,
  18663. switchFlag: 0
  18664. },
  18665. {
  18666. qe: 0x3801,
  18667. nmps: 19,
  18668. nlps: 17,
  18669. switchFlag: 0
  18670. },
  18671. {
  18672. qe: 0x3401,
  18673. nmps: 20,
  18674. nlps: 18,
  18675. switchFlag: 0
  18676. },
  18677. {
  18678. qe: 0x3001,
  18679. nmps: 21,
  18680. nlps: 19,
  18681. switchFlag: 0
  18682. },
  18683. {
  18684. qe: 0x2801,
  18685. nmps: 22,
  18686. nlps: 19,
  18687. switchFlag: 0
  18688. },
  18689. {
  18690. qe: 0x2401,
  18691. nmps: 23,
  18692. nlps: 20,
  18693. switchFlag: 0
  18694. },
  18695. {
  18696. qe: 0x2201,
  18697. nmps: 24,
  18698. nlps: 21,
  18699. switchFlag: 0
  18700. },
  18701. {
  18702. qe: 0x1C01,
  18703. nmps: 25,
  18704. nlps: 22,
  18705. switchFlag: 0
  18706. },
  18707. {
  18708. qe: 0x1801,
  18709. nmps: 26,
  18710. nlps: 23,
  18711. switchFlag: 0
  18712. },
  18713. {
  18714. qe: 0x1601,
  18715. nmps: 27,
  18716. nlps: 24,
  18717. switchFlag: 0
  18718. },
  18719. {
  18720. qe: 0x1401,
  18721. nmps: 28,
  18722. nlps: 25,
  18723. switchFlag: 0
  18724. },
  18725. {
  18726. qe: 0x1201,
  18727. nmps: 29,
  18728. nlps: 26,
  18729. switchFlag: 0
  18730. },
  18731. {
  18732. qe: 0x1101,
  18733. nmps: 30,
  18734. nlps: 27,
  18735. switchFlag: 0
  18736. },
  18737. {
  18738. qe: 0x0AC1,
  18739. nmps: 31,
  18740. nlps: 28,
  18741. switchFlag: 0
  18742. },
  18743. {
  18744. qe: 0x09C1,
  18745. nmps: 32,
  18746. nlps: 29,
  18747. switchFlag: 0
  18748. },
  18749. {
  18750. qe: 0x08A1,
  18751. nmps: 33,
  18752. nlps: 30,
  18753. switchFlag: 0
  18754. },
  18755. {
  18756. qe: 0x0521,
  18757. nmps: 34,
  18758. nlps: 31,
  18759. switchFlag: 0
  18760. },
  18761. {
  18762. qe: 0x0441,
  18763. nmps: 35,
  18764. nlps: 32,
  18765. switchFlag: 0
  18766. },
  18767. {
  18768. qe: 0x02A1,
  18769. nmps: 36,
  18770. nlps: 33,
  18771. switchFlag: 0
  18772. },
  18773. {
  18774. qe: 0x0221,
  18775. nmps: 37,
  18776. nlps: 34,
  18777. switchFlag: 0
  18778. },
  18779. {
  18780. qe: 0x0141,
  18781. nmps: 38,
  18782. nlps: 35,
  18783. switchFlag: 0
  18784. },
  18785. {
  18786. qe: 0x0111,
  18787. nmps: 39,
  18788. nlps: 36,
  18789. switchFlag: 0
  18790. },
  18791. {
  18792. qe: 0x0085,
  18793. nmps: 40,
  18794. nlps: 37,
  18795. switchFlag: 0
  18796. },
  18797. {
  18798. qe: 0x0049,
  18799. nmps: 41,
  18800. nlps: 38,
  18801. switchFlag: 0
  18802. },
  18803. {
  18804. qe: 0x0025,
  18805. nmps: 42,
  18806. nlps: 39,
  18807. switchFlag: 0
  18808. },
  18809. {
  18810. qe: 0x0015,
  18811. nmps: 43,
  18812. nlps: 40,
  18813. switchFlag: 0
  18814. },
  18815. {
  18816. qe: 0x0009,
  18817. nmps: 44,
  18818. nlps: 41,
  18819. switchFlag: 0
  18820. },
  18821. {
  18822. qe: 0x0005,
  18823. nmps: 45,
  18824. nlps: 42,
  18825. switchFlag: 0
  18826. },
  18827. {
  18828. qe: 0x0001,
  18829. nmps: 45,
  18830. nlps: 43,
  18831. switchFlag: 0
  18832. },
  18833. {
  18834. qe: 0x5601,
  18835. nmps: 46,
  18836. nlps: 46,
  18837. switchFlag: 0
  18838. }
  18839. ];
  18840. function ArithmeticDecoder(data, start, end) {
  18841. this.data = data;
  18842. this.bp = start;
  18843. this.dataEnd = end;
  18844. this.chigh = data[start];
  18845. this.clow = 0;
  18846. this.byteIn();
  18847. this.chigh = this.chigh << 7 & 0xFFFF | this.clow >> 9 & 0x7F;
  18848. this.clow = this.clow << 7 & 0xFFFF;
  18849. this.ct -= 7;
  18850. this.a = 0x8000;
  18851. }
  18852. ArithmeticDecoder.prototype = {
  18853. byteIn: function ArithmeticDecoder_byteIn() {
  18854. var data = this.data;
  18855. var bp = this.bp;
  18856. if (data[bp] === 0xFF) {
  18857. var b1 = data[bp + 1];
  18858. if (b1 > 0x8F) {
  18859. this.clow += 0xFF00;
  18860. this.ct = 8;
  18861. } else {
  18862. bp++;
  18863. this.clow += data[bp] << 9;
  18864. this.ct = 7;
  18865. this.bp = bp;
  18866. }
  18867. } else {
  18868. bp++;
  18869. this.clow += bp < this.dataEnd ? data[bp] << 8 : 0xFF00;
  18870. this.ct = 8;
  18871. this.bp = bp;
  18872. }
  18873. if (this.clow > 0xFFFF) {
  18874. this.chigh += this.clow >> 16;
  18875. this.clow &= 0xFFFF;
  18876. }
  18877. },
  18878. readBit: function ArithmeticDecoder_readBit(contexts, pos) {
  18879. var cx_index = contexts[pos] >> 1, cx_mps = contexts[pos] & 1;
  18880. var qeTableIcx = QeTable[cx_index];
  18881. var qeIcx = qeTableIcx.qe;
  18882. var d;
  18883. var a = this.a - qeIcx;
  18884. if (this.chigh < qeIcx) {
  18885. if (a < qeIcx) {
  18886. a = qeIcx;
  18887. d = cx_mps;
  18888. cx_index = qeTableIcx.nmps;
  18889. } else {
  18890. a = qeIcx;
  18891. d = 1 ^ cx_mps;
  18892. if (qeTableIcx.switchFlag === 1) {
  18893. cx_mps = d;
  18894. }
  18895. cx_index = qeTableIcx.nlps;
  18896. }
  18897. } else {
  18898. this.chigh -= qeIcx;
  18899. if ((a & 0x8000) !== 0) {
  18900. this.a = a;
  18901. return cx_mps;
  18902. }
  18903. if (a < qeIcx) {
  18904. d = 1 ^ cx_mps;
  18905. if (qeTableIcx.switchFlag === 1) {
  18906. cx_mps = d;
  18907. }
  18908. cx_index = qeTableIcx.nlps;
  18909. } else {
  18910. d = cx_mps;
  18911. cx_index = qeTableIcx.nmps;
  18912. }
  18913. }
  18914. do {
  18915. if (this.ct === 0) {
  18916. this.byteIn();
  18917. }
  18918. a <<= 1;
  18919. this.chigh = this.chigh << 1 & 0xFFFF | this.clow >> 15 & 1;
  18920. this.clow = this.clow << 1 & 0xFFFF;
  18921. this.ct--;
  18922. } while ((a & 0x8000) === 0);
  18923. this.a = a;
  18924. contexts[pos] = cx_index << 1 | cx_mps;
  18925. return d;
  18926. }
  18927. };
  18928. return ArithmeticDecoder;
  18929. }();
  18930. exports.ArithmeticDecoder = ArithmeticDecoder;
  18931. /***/ }),
  18932. /* 11 */
  18933. /***/ (function(module, exports, __w_pdfjs_require__) {
  18934. "use strict";
  18935. var sharedUtil = __w_pdfjs_require__(0);
  18936. var coreCharsets = __w_pdfjs_require__(22);
  18937. var coreEncodings = __w_pdfjs_require__(4);
  18938. var error = sharedUtil.error;
  18939. var info = sharedUtil.info;
  18940. var bytesToString = sharedUtil.bytesToString;
  18941. var warn = sharedUtil.warn;
  18942. var isArray = sharedUtil.isArray;
  18943. var Util = sharedUtil.Util;
  18944. var stringToBytes = sharedUtil.stringToBytes;
  18945. var assert = sharedUtil.assert;
  18946. var ISOAdobeCharset = coreCharsets.ISOAdobeCharset;
  18947. var ExpertCharset = coreCharsets.ExpertCharset;
  18948. var ExpertSubsetCharset = coreCharsets.ExpertSubsetCharset;
  18949. var StandardEncoding = coreEncodings.StandardEncoding;
  18950. var ExpertEncoding = coreEncodings.ExpertEncoding;
  18951. var MAX_SUBR_NESTING = 10;
  18952. var CFFStandardStrings = [
  18953. '.notdef',
  18954. 'space',
  18955. 'exclam',
  18956. 'quotedbl',
  18957. 'numbersign',
  18958. 'dollar',
  18959. 'percent',
  18960. 'ampersand',
  18961. 'quoteright',
  18962. 'parenleft',
  18963. 'parenright',
  18964. 'asterisk',
  18965. 'plus',
  18966. 'comma',
  18967. 'hyphen',
  18968. 'period',
  18969. 'slash',
  18970. 'zero',
  18971. 'one',
  18972. 'two',
  18973. 'three',
  18974. 'four',
  18975. 'five',
  18976. 'six',
  18977. 'seven',
  18978. 'eight',
  18979. 'nine',
  18980. 'colon',
  18981. 'semicolon',
  18982. 'less',
  18983. 'equal',
  18984. 'greater',
  18985. 'question',
  18986. 'at',
  18987. 'A',
  18988. 'B',
  18989. 'C',
  18990. 'D',
  18991. 'E',
  18992. 'F',
  18993. 'G',
  18994. 'H',
  18995. 'I',
  18996. 'J',
  18997. 'K',
  18998. 'L',
  18999. 'M',
  19000. 'N',
  19001. 'O',
  19002. 'P',
  19003. 'Q',
  19004. 'R',
  19005. 'S',
  19006. 'T',
  19007. 'U',
  19008. 'V',
  19009. 'W',
  19010. 'X',
  19011. 'Y',
  19012. 'Z',
  19013. 'bracketleft',
  19014. 'backslash',
  19015. 'bracketright',
  19016. 'asciicircum',
  19017. 'underscore',
  19018. 'quoteleft',
  19019. 'a',
  19020. 'b',
  19021. 'c',
  19022. 'd',
  19023. 'e',
  19024. 'f',
  19025. 'g',
  19026. 'h',
  19027. 'i',
  19028. 'j',
  19029. 'k',
  19030. 'l',
  19031. 'm',
  19032. 'n',
  19033. 'o',
  19034. 'p',
  19035. 'q',
  19036. 'r',
  19037. 's',
  19038. 't',
  19039. 'u',
  19040. 'v',
  19041. 'w',
  19042. 'x',
  19043. 'y',
  19044. 'z',
  19045. 'braceleft',
  19046. 'bar',
  19047. 'braceright',
  19048. 'asciitilde',
  19049. 'exclamdown',
  19050. 'cent',
  19051. 'sterling',
  19052. 'fraction',
  19053. 'yen',
  19054. 'florin',
  19055. 'section',
  19056. 'currency',
  19057. 'quotesingle',
  19058. 'quotedblleft',
  19059. 'guillemotleft',
  19060. 'guilsinglleft',
  19061. 'guilsinglright',
  19062. 'fi',
  19063. 'fl',
  19064. 'endash',
  19065. 'dagger',
  19066. 'daggerdbl',
  19067. 'periodcentered',
  19068. 'paragraph',
  19069. 'bullet',
  19070. 'quotesinglbase',
  19071. 'quotedblbase',
  19072. 'quotedblright',
  19073. 'guillemotright',
  19074. 'ellipsis',
  19075. 'perthousand',
  19076. 'questiondown',
  19077. 'grave',
  19078. 'acute',
  19079. 'circumflex',
  19080. 'tilde',
  19081. 'macron',
  19082. 'breve',
  19083. 'dotaccent',
  19084. 'dieresis',
  19085. 'ring',
  19086. 'cedilla',
  19087. 'hungarumlaut',
  19088. 'ogonek',
  19089. 'caron',
  19090. 'emdash',
  19091. 'AE',
  19092. 'ordfeminine',
  19093. 'Lslash',
  19094. 'Oslash',
  19095. 'OE',
  19096. 'ordmasculine',
  19097. 'ae',
  19098. 'dotlessi',
  19099. 'lslash',
  19100. 'oslash',
  19101. 'oe',
  19102. 'germandbls',
  19103. 'onesuperior',
  19104. 'logicalnot',
  19105. 'mu',
  19106. 'trademark',
  19107. 'Eth',
  19108. 'onehalf',
  19109. 'plusminus',
  19110. 'Thorn',
  19111. 'onequarter',
  19112. 'divide',
  19113. 'brokenbar',
  19114. 'degree',
  19115. 'thorn',
  19116. 'threequarters',
  19117. 'twosuperior',
  19118. 'registered',
  19119. 'minus',
  19120. 'eth',
  19121. 'multiply',
  19122. 'threesuperior',
  19123. 'copyright',
  19124. 'Aacute',
  19125. 'Acircumflex',
  19126. 'Adieresis',
  19127. 'Agrave',
  19128. 'Aring',
  19129. 'Atilde',
  19130. 'Ccedilla',
  19131. 'Eacute',
  19132. 'Ecircumflex',
  19133. 'Edieresis',
  19134. 'Egrave',
  19135. 'Iacute',
  19136. 'Icircumflex',
  19137. 'Idieresis',
  19138. 'Igrave',
  19139. 'Ntilde',
  19140. 'Oacute',
  19141. 'Ocircumflex',
  19142. 'Odieresis',
  19143. 'Ograve',
  19144. 'Otilde',
  19145. 'Scaron',
  19146. 'Uacute',
  19147. 'Ucircumflex',
  19148. 'Udieresis',
  19149. 'Ugrave',
  19150. 'Yacute',
  19151. 'Ydieresis',
  19152. 'Zcaron',
  19153. 'aacute',
  19154. 'acircumflex',
  19155. 'adieresis',
  19156. 'agrave',
  19157. 'aring',
  19158. 'atilde',
  19159. 'ccedilla',
  19160. 'eacute',
  19161. 'ecircumflex',
  19162. 'edieresis',
  19163. 'egrave',
  19164. 'iacute',
  19165. 'icircumflex',
  19166. 'idieresis',
  19167. 'igrave',
  19168. 'ntilde',
  19169. 'oacute',
  19170. 'ocircumflex',
  19171. 'odieresis',
  19172. 'ograve',
  19173. 'otilde',
  19174. 'scaron',
  19175. 'uacute',
  19176. 'ucircumflex',
  19177. 'udieresis',
  19178. 'ugrave',
  19179. 'yacute',
  19180. 'ydieresis',
  19181. 'zcaron',
  19182. 'exclamsmall',
  19183. 'Hungarumlautsmall',
  19184. 'dollaroldstyle',
  19185. 'dollarsuperior',
  19186. 'ampersandsmall',
  19187. 'Acutesmall',
  19188. 'parenleftsuperior',
  19189. 'parenrightsuperior',
  19190. 'twodotenleader',
  19191. 'onedotenleader',
  19192. 'zerooldstyle',
  19193. 'oneoldstyle',
  19194. 'twooldstyle',
  19195. 'threeoldstyle',
  19196. 'fouroldstyle',
  19197. 'fiveoldstyle',
  19198. 'sixoldstyle',
  19199. 'sevenoldstyle',
  19200. 'eightoldstyle',
  19201. 'nineoldstyle',
  19202. 'commasuperior',
  19203. 'threequartersemdash',
  19204. 'periodsuperior',
  19205. 'questionsmall',
  19206. 'asuperior',
  19207. 'bsuperior',
  19208. 'centsuperior',
  19209. 'dsuperior',
  19210. 'esuperior',
  19211. 'isuperior',
  19212. 'lsuperior',
  19213. 'msuperior',
  19214. 'nsuperior',
  19215. 'osuperior',
  19216. 'rsuperior',
  19217. 'ssuperior',
  19218. 'tsuperior',
  19219. 'ff',
  19220. 'ffi',
  19221. 'ffl',
  19222. 'parenleftinferior',
  19223. 'parenrightinferior',
  19224. 'Circumflexsmall',
  19225. 'hyphensuperior',
  19226. 'Gravesmall',
  19227. 'Asmall',
  19228. 'Bsmall',
  19229. 'Csmall',
  19230. 'Dsmall',
  19231. 'Esmall',
  19232. 'Fsmall',
  19233. 'Gsmall',
  19234. 'Hsmall',
  19235. 'Ismall',
  19236. 'Jsmall',
  19237. 'Ksmall',
  19238. 'Lsmall',
  19239. 'Msmall',
  19240. 'Nsmall',
  19241. 'Osmall',
  19242. 'Psmall',
  19243. 'Qsmall',
  19244. 'Rsmall',
  19245. 'Ssmall',
  19246. 'Tsmall',
  19247. 'Usmall',
  19248. 'Vsmall',
  19249. 'Wsmall',
  19250. 'Xsmall',
  19251. 'Ysmall',
  19252. 'Zsmall',
  19253. 'colonmonetary',
  19254. 'onefitted',
  19255. 'rupiah',
  19256. 'Tildesmall',
  19257. 'exclamdownsmall',
  19258. 'centoldstyle',
  19259. 'Lslashsmall',
  19260. 'Scaronsmall',
  19261. 'Zcaronsmall',
  19262. 'Dieresissmall',
  19263. 'Brevesmall',
  19264. 'Caronsmall',
  19265. 'Dotaccentsmall',
  19266. 'Macronsmall',
  19267. 'figuredash',
  19268. 'hypheninferior',
  19269. 'Ogoneksmall',
  19270. 'Ringsmall',
  19271. 'Cedillasmall',
  19272. 'questiondownsmall',
  19273. 'oneeighth',
  19274. 'threeeighths',
  19275. 'fiveeighths',
  19276. 'seveneighths',
  19277. 'onethird',
  19278. 'twothirds',
  19279. 'zerosuperior',
  19280. 'foursuperior',
  19281. 'fivesuperior',
  19282. 'sixsuperior',
  19283. 'sevensuperior',
  19284. 'eightsuperior',
  19285. 'ninesuperior',
  19286. 'zeroinferior',
  19287. 'oneinferior',
  19288. 'twoinferior',
  19289. 'threeinferior',
  19290. 'fourinferior',
  19291. 'fiveinferior',
  19292. 'sixinferior',
  19293. 'seveninferior',
  19294. 'eightinferior',
  19295. 'nineinferior',
  19296. 'centinferior',
  19297. 'dollarinferior',
  19298. 'periodinferior',
  19299. 'commainferior',
  19300. 'Agravesmall',
  19301. 'Aacutesmall',
  19302. 'Acircumflexsmall',
  19303. 'Atildesmall',
  19304. 'Adieresissmall',
  19305. 'Aringsmall',
  19306. 'AEsmall',
  19307. 'Ccedillasmall',
  19308. 'Egravesmall',
  19309. 'Eacutesmall',
  19310. 'Ecircumflexsmall',
  19311. 'Edieresissmall',
  19312. 'Igravesmall',
  19313. 'Iacutesmall',
  19314. 'Icircumflexsmall',
  19315. 'Idieresissmall',
  19316. 'Ethsmall',
  19317. 'Ntildesmall',
  19318. 'Ogravesmall',
  19319. 'Oacutesmall',
  19320. 'Ocircumflexsmall',
  19321. 'Otildesmall',
  19322. 'Odieresissmall',
  19323. 'OEsmall',
  19324. 'Oslashsmall',
  19325. 'Ugravesmall',
  19326. 'Uacutesmall',
  19327. 'Ucircumflexsmall',
  19328. 'Udieresissmall',
  19329. 'Yacutesmall',
  19330. 'Thornsmall',
  19331. 'Ydieresissmall',
  19332. '001.000',
  19333. '001.001',
  19334. '001.002',
  19335. '001.003',
  19336. 'Black',
  19337. 'Bold',
  19338. 'Book',
  19339. 'Light',
  19340. 'Medium',
  19341. 'Regular',
  19342. 'Roman',
  19343. 'Semibold'
  19344. ];
  19345. var CFFParser = function CFFParserClosure() {
  19346. var CharstringValidationData = [
  19347. null,
  19348. {
  19349. id: 'hstem',
  19350. min: 2,
  19351. stackClearing: true,
  19352. stem: true
  19353. },
  19354. null,
  19355. {
  19356. id: 'vstem',
  19357. min: 2,
  19358. stackClearing: true,
  19359. stem: true
  19360. },
  19361. {
  19362. id: 'vmoveto',
  19363. min: 1,
  19364. stackClearing: true
  19365. },
  19366. {
  19367. id: 'rlineto',
  19368. min: 2,
  19369. resetStack: true
  19370. },
  19371. {
  19372. id: 'hlineto',
  19373. min: 1,
  19374. resetStack: true
  19375. },
  19376. {
  19377. id: 'vlineto',
  19378. min: 1,
  19379. resetStack: true
  19380. },
  19381. {
  19382. id: 'rrcurveto',
  19383. min: 6,
  19384. resetStack: true
  19385. },
  19386. null,
  19387. {
  19388. id: 'callsubr',
  19389. min: 1,
  19390. undefStack: true
  19391. },
  19392. {
  19393. id: 'return',
  19394. min: 0,
  19395. undefStack: true
  19396. },
  19397. null,
  19398. null,
  19399. {
  19400. id: 'endchar',
  19401. min: 0,
  19402. stackClearing: true
  19403. },
  19404. null,
  19405. null,
  19406. null,
  19407. {
  19408. id: 'hstemhm',
  19409. min: 2,
  19410. stackClearing: true,
  19411. stem: true
  19412. },
  19413. {
  19414. id: 'hintmask',
  19415. min: 0,
  19416. stackClearing: true
  19417. },
  19418. {
  19419. id: 'cntrmask',
  19420. min: 0,
  19421. stackClearing: true
  19422. },
  19423. {
  19424. id: 'rmoveto',
  19425. min: 2,
  19426. stackClearing: true
  19427. },
  19428. {
  19429. id: 'hmoveto',
  19430. min: 1,
  19431. stackClearing: true
  19432. },
  19433. {
  19434. id: 'vstemhm',
  19435. min: 2,
  19436. stackClearing: true,
  19437. stem: true
  19438. },
  19439. {
  19440. id: 'rcurveline',
  19441. min: 8,
  19442. resetStack: true
  19443. },
  19444. {
  19445. id: 'rlinecurve',
  19446. min: 8,
  19447. resetStack: true
  19448. },
  19449. {
  19450. id: 'vvcurveto',
  19451. min: 4,
  19452. resetStack: true
  19453. },
  19454. {
  19455. id: 'hhcurveto',
  19456. min: 4,
  19457. resetStack: true
  19458. },
  19459. null,
  19460. {
  19461. id: 'callgsubr',
  19462. min: 1,
  19463. undefStack: true
  19464. },
  19465. {
  19466. id: 'vhcurveto',
  19467. min: 4,
  19468. resetStack: true
  19469. },
  19470. {
  19471. id: 'hvcurveto',
  19472. min: 4,
  19473. resetStack: true
  19474. }
  19475. ];
  19476. var CharstringValidationData12 = [
  19477. null,
  19478. null,
  19479. null,
  19480. {
  19481. id: 'and',
  19482. min: 2,
  19483. stackDelta: -1
  19484. },
  19485. {
  19486. id: 'or',
  19487. min: 2,
  19488. stackDelta: -1
  19489. },
  19490. {
  19491. id: 'not',
  19492. min: 1,
  19493. stackDelta: 0
  19494. },
  19495. null,
  19496. null,
  19497. null,
  19498. {
  19499. id: 'abs',
  19500. min: 1,
  19501. stackDelta: 0
  19502. },
  19503. {
  19504. id: 'add',
  19505. min: 2,
  19506. stackDelta: -1,
  19507. stackFn: function stack_div(stack, index) {
  19508. stack[index - 2] = stack[index - 2] + stack[index - 1];
  19509. }
  19510. },
  19511. {
  19512. id: 'sub',
  19513. min: 2,
  19514. stackDelta: -1,
  19515. stackFn: function stack_div(stack, index) {
  19516. stack[index - 2] = stack[index - 2] - stack[index - 1];
  19517. }
  19518. },
  19519. {
  19520. id: 'div',
  19521. min: 2,
  19522. stackDelta: -1,
  19523. stackFn: function stack_div(stack, index) {
  19524. stack[index - 2] = stack[index - 2] / stack[index - 1];
  19525. }
  19526. },
  19527. null,
  19528. {
  19529. id: 'neg',
  19530. min: 1,
  19531. stackDelta: 0,
  19532. stackFn: function stack_div(stack, index) {
  19533. stack[index - 1] = -stack[index - 1];
  19534. }
  19535. },
  19536. {
  19537. id: 'eq',
  19538. min: 2,
  19539. stackDelta: -1
  19540. },
  19541. null,
  19542. null,
  19543. {
  19544. id: 'drop',
  19545. min: 1,
  19546. stackDelta: -1
  19547. },
  19548. null,
  19549. {
  19550. id: 'put',
  19551. min: 2,
  19552. stackDelta: -2
  19553. },
  19554. {
  19555. id: 'get',
  19556. min: 1,
  19557. stackDelta: 0
  19558. },
  19559. {
  19560. id: 'ifelse',
  19561. min: 4,
  19562. stackDelta: -3
  19563. },
  19564. {
  19565. id: 'random',
  19566. min: 0,
  19567. stackDelta: 1
  19568. },
  19569. {
  19570. id: 'mul',
  19571. min: 2,
  19572. stackDelta: -1,
  19573. stackFn: function stack_div(stack, index) {
  19574. stack[index - 2] = stack[index - 2] * stack[index - 1];
  19575. }
  19576. },
  19577. null,
  19578. {
  19579. id: 'sqrt',
  19580. min: 1,
  19581. stackDelta: 0
  19582. },
  19583. {
  19584. id: 'dup',
  19585. min: 1,
  19586. stackDelta: 1
  19587. },
  19588. {
  19589. id: 'exch',
  19590. min: 2,
  19591. stackDelta: 0
  19592. },
  19593. {
  19594. id: 'index',
  19595. min: 2,
  19596. stackDelta: 0
  19597. },
  19598. {
  19599. id: 'roll',
  19600. min: 3,
  19601. stackDelta: -2
  19602. },
  19603. null,
  19604. null,
  19605. null,
  19606. {
  19607. id: 'hflex',
  19608. min: 7,
  19609. resetStack: true
  19610. },
  19611. {
  19612. id: 'flex',
  19613. min: 13,
  19614. resetStack: true
  19615. },
  19616. {
  19617. id: 'hflex1',
  19618. min: 9,
  19619. resetStack: true
  19620. },
  19621. {
  19622. id: 'flex1',
  19623. min: 11,
  19624. resetStack: true
  19625. }
  19626. ];
  19627. function CFFParser(file, properties, seacAnalysisEnabled) {
  19628. this.bytes = file.getBytes();
  19629. this.properties = properties;
  19630. this.seacAnalysisEnabled = !!seacAnalysisEnabled;
  19631. }
  19632. CFFParser.prototype = {
  19633. parse: function CFFParser_parse() {
  19634. var properties = this.properties;
  19635. var cff = new CFF();
  19636. this.cff = cff;
  19637. var header = this.parseHeader();
  19638. var nameIndex = this.parseIndex(header.endPos);
  19639. var topDictIndex = this.parseIndex(nameIndex.endPos);
  19640. var stringIndex = this.parseIndex(topDictIndex.endPos);
  19641. var globalSubrIndex = this.parseIndex(stringIndex.endPos);
  19642. var topDictParsed = this.parseDict(topDictIndex.obj.get(0));
  19643. var topDict = this.createDict(CFFTopDict, topDictParsed, cff.strings);
  19644. cff.header = header.obj;
  19645. cff.names = this.parseNameIndex(nameIndex.obj);
  19646. cff.strings = this.parseStringIndex(stringIndex.obj);
  19647. cff.topDict = topDict;
  19648. cff.globalSubrIndex = globalSubrIndex.obj;
  19649. this.parsePrivateDict(cff.topDict);
  19650. cff.isCIDFont = topDict.hasName('ROS');
  19651. var charStringOffset = topDict.getByName('CharStrings');
  19652. var charStringIndex = this.parseIndex(charStringOffset).obj;
  19653. var fontMatrix = topDict.getByName('FontMatrix');
  19654. if (fontMatrix) {
  19655. properties.fontMatrix = fontMatrix;
  19656. }
  19657. var fontBBox = topDict.getByName('FontBBox');
  19658. if (fontBBox) {
  19659. properties.ascent = Math.max(fontBBox[3], fontBBox[1]);
  19660. properties.descent = Math.min(fontBBox[1], fontBBox[3]);
  19661. properties.ascentScaled = true;
  19662. }
  19663. var charset, encoding;
  19664. if (cff.isCIDFont) {
  19665. var fdArrayIndex = this.parseIndex(topDict.getByName('FDArray')).obj;
  19666. for (var i = 0, ii = fdArrayIndex.count; i < ii; ++i) {
  19667. var dictRaw = fdArrayIndex.get(i);
  19668. var fontDict = this.createDict(CFFTopDict, this.parseDict(dictRaw), cff.strings);
  19669. this.parsePrivateDict(fontDict);
  19670. cff.fdArray.push(fontDict);
  19671. }
  19672. encoding = null;
  19673. charset = this.parseCharsets(topDict.getByName('charset'), charStringIndex.count, cff.strings, true);
  19674. cff.fdSelect = this.parseFDSelect(topDict.getByName('FDSelect'), charStringIndex.count);
  19675. } else {
  19676. charset = this.parseCharsets(topDict.getByName('charset'), charStringIndex.count, cff.strings, false);
  19677. encoding = this.parseEncoding(topDict.getByName('Encoding'), properties, cff.strings, charset.charset);
  19678. }
  19679. cff.charset = charset;
  19680. cff.encoding = encoding;
  19681. var charStringsAndSeacs = this.parseCharStrings(charStringIndex, topDict.privateDict.subrsIndex, globalSubrIndex.obj, cff.fdSelect, cff.fdArray);
  19682. cff.charStrings = charStringsAndSeacs.charStrings;
  19683. cff.seacs = charStringsAndSeacs.seacs;
  19684. cff.widths = charStringsAndSeacs.widths;
  19685. return cff;
  19686. },
  19687. parseHeader: function CFFParser_parseHeader() {
  19688. var bytes = this.bytes;
  19689. var bytesLength = bytes.length;
  19690. var offset = 0;
  19691. while (offset < bytesLength && bytes[offset] !== 1) {
  19692. ++offset;
  19693. }
  19694. if (offset >= bytesLength) {
  19695. error('Invalid CFF header');
  19696. } else if (offset !== 0) {
  19697. info('cff data is shifted');
  19698. bytes = bytes.subarray(offset);
  19699. this.bytes = bytes;
  19700. }
  19701. var major = bytes[0];
  19702. var minor = bytes[1];
  19703. var hdrSize = bytes[2];
  19704. var offSize = bytes[3];
  19705. var header = new CFFHeader(major, minor, hdrSize, offSize);
  19706. return {
  19707. obj: header,
  19708. endPos: hdrSize
  19709. };
  19710. },
  19711. parseDict: function CFFParser_parseDict(dict) {
  19712. var pos = 0;
  19713. function parseOperand() {
  19714. var value = dict[pos++];
  19715. if (value === 30) {
  19716. return parseFloatOperand();
  19717. } else if (value === 28) {
  19718. value = dict[pos++];
  19719. value = (value << 24 | dict[pos++] << 16) >> 16;
  19720. return value;
  19721. } else if (value === 29) {
  19722. value = dict[pos++];
  19723. value = value << 8 | dict[pos++];
  19724. value = value << 8 | dict[pos++];
  19725. value = value << 8 | dict[pos++];
  19726. return value;
  19727. } else if (value >= 32 && value <= 246) {
  19728. return value - 139;
  19729. } else if (value >= 247 && value <= 250) {
  19730. return (value - 247) * 256 + dict[pos++] + 108;
  19731. } else if (value >= 251 && value <= 254) {
  19732. return -((value - 251) * 256) - dict[pos++] - 108;
  19733. }
  19734. warn('CFFParser_parseDict: "' + value + '" is a reserved command.');
  19735. return NaN;
  19736. }
  19737. function parseFloatOperand() {
  19738. var str = '';
  19739. var eof = 15;
  19740. var lookup = [
  19741. '0',
  19742. '1',
  19743. '2',
  19744. '3',
  19745. '4',
  19746. '5',
  19747. '6',
  19748. '7',
  19749. '8',
  19750. '9',
  19751. '.',
  19752. 'E',
  19753. 'E-',
  19754. null,
  19755. '-'
  19756. ];
  19757. var length = dict.length;
  19758. while (pos < length) {
  19759. var b = dict[pos++];
  19760. var b1 = b >> 4;
  19761. var b2 = b & 15;
  19762. if (b1 === eof) {
  19763. break;
  19764. }
  19765. str += lookup[b1];
  19766. if (b2 === eof) {
  19767. break;
  19768. }
  19769. str += lookup[b2];
  19770. }
  19771. return parseFloat(str);
  19772. }
  19773. var operands = [];
  19774. var entries = [];
  19775. pos = 0;
  19776. var end = dict.length;
  19777. while (pos < end) {
  19778. var b = dict[pos];
  19779. if (b <= 21) {
  19780. if (b === 12) {
  19781. b = b << 8 | dict[++pos];
  19782. }
  19783. entries.push([
  19784. b,
  19785. operands
  19786. ]);
  19787. operands = [];
  19788. ++pos;
  19789. } else {
  19790. operands.push(parseOperand());
  19791. }
  19792. }
  19793. return entries;
  19794. },
  19795. parseIndex: function CFFParser_parseIndex(pos) {
  19796. var cffIndex = new CFFIndex();
  19797. var bytes = this.bytes;
  19798. var count = bytes[pos++] << 8 | bytes[pos++];
  19799. var offsets = [];
  19800. var end = pos;
  19801. var i, ii;
  19802. if (count !== 0) {
  19803. var offsetSize = bytes[pos++];
  19804. var startPos = pos + (count + 1) * offsetSize - 1;
  19805. for (i = 0, ii = count + 1; i < ii; ++i) {
  19806. var offset = 0;
  19807. for (var j = 0; j < offsetSize; ++j) {
  19808. offset <<= 8;
  19809. offset += bytes[pos++];
  19810. }
  19811. offsets.push(startPos + offset);
  19812. }
  19813. end = offsets[count];
  19814. }
  19815. for (i = 0, ii = offsets.length - 1; i < ii; ++i) {
  19816. var offsetStart = offsets[i];
  19817. var offsetEnd = offsets[i + 1];
  19818. cffIndex.add(bytes.subarray(offsetStart, offsetEnd));
  19819. }
  19820. return {
  19821. obj: cffIndex,
  19822. endPos: end
  19823. };
  19824. },
  19825. parseNameIndex: function CFFParser_parseNameIndex(index) {
  19826. var names = [];
  19827. for (var i = 0, ii = index.count; i < ii; ++i) {
  19828. var name = index.get(i);
  19829. var length = Math.min(name.length, 127);
  19830. var data = [];
  19831. for (var j = 0; j < length; ++j) {
  19832. var c = name[j];
  19833. if (j === 0 && c === 0) {
  19834. data[j] = c;
  19835. continue;
  19836. }
  19837. 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) {
  19838. data[j] = 95;
  19839. continue;
  19840. }
  19841. data[j] = c;
  19842. }
  19843. names.push(bytesToString(data));
  19844. }
  19845. return names;
  19846. },
  19847. parseStringIndex: function CFFParser_parseStringIndex(index) {
  19848. var strings = new CFFStrings();
  19849. for (var i = 0, ii = index.count; i < ii; ++i) {
  19850. var data = index.get(i);
  19851. strings.add(bytesToString(data));
  19852. }
  19853. return strings;
  19854. },
  19855. createDict: function CFFParser_createDict(Type, dict, strings) {
  19856. var cffDict = new Type(strings);
  19857. for (var i = 0, ii = dict.length; i < ii; ++i) {
  19858. var pair = dict[i];
  19859. var key = pair[0];
  19860. var value = pair[1];
  19861. cffDict.setByKey(key, value);
  19862. }
  19863. return cffDict;
  19864. },
  19865. parseCharString: function CFFParser_parseCharString(state, data, localSubrIndex, globalSubrIndex) {
  19866. if (state.callDepth > MAX_SUBR_NESTING) {
  19867. return false;
  19868. }
  19869. var stackSize = state.stackSize;
  19870. var stack = state.stack;
  19871. var length = data.length;
  19872. for (var j = 0; j < length;) {
  19873. var value = data[j++];
  19874. var validationCommand = null;
  19875. if (value === 12) {
  19876. var q = data[j++];
  19877. if (q === 0) {
  19878. data[j - 2] = 139;
  19879. data[j - 1] = 22;
  19880. stackSize = 0;
  19881. } else {
  19882. validationCommand = CharstringValidationData12[q];
  19883. }
  19884. } else if (value === 28) {
  19885. stack[stackSize] = (data[j] << 24 | data[j + 1] << 16) >> 16;
  19886. j += 2;
  19887. stackSize++;
  19888. } else if (value === 14) {
  19889. if (stackSize >= 4) {
  19890. stackSize -= 4;
  19891. if (this.seacAnalysisEnabled) {
  19892. state.seac = stack.slice(stackSize, stackSize + 4);
  19893. return false;
  19894. }
  19895. }
  19896. validationCommand = CharstringValidationData[value];
  19897. } else if (value >= 32 && value <= 246) {
  19898. stack[stackSize] = value - 139;
  19899. stackSize++;
  19900. } else if (value >= 247 && value <= 254) {
  19901. stack[stackSize] = value < 251 ? (value - 247 << 8) + data[j] + 108 : -(value - 251 << 8) - data[j] - 108;
  19902. j++;
  19903. stackSize++;
  19904. } else if (value === 255) {
  19905. stack[stackSize] = (data[j] << 24 | data[j + 1] << 16 | data[j + 2] << 8 | data[j + 3]) / 65536;
  19906. j += 4;
  19907. stackSize++;
  19908. } else if (value === 19 || value === 20) {
  19909. state.hints += stackSize >> 1;
  19910. j += state.hints + 7 >> 3;
  19911. stackSize %= 2;
  19912. validationCommand = CharstringValidationData[value];
  19913. } else if (value === 10 || value === 29) {
  19914. var subrsIndex;
  19915. if (value === 10) {
  19916. subrsIndex = localSubrIndex;
  19917. } else {
  19918. subrsIndex = globalSubrIndex;
  19919. }
  19920. if (!subrsIndex) {
  19921. validationCommand = CharstringValidationData[value];
  19922. warn('Missing subrsIndex for ' + validationCommand.id);
  19923. return false;
  19924. }
  19925. var bias = 32768;
  19926. if (subrsIndex.count < 1240) {
  19927. bias = 107;
  19928. } else if (subrsIndex.count < 33900) {
  19929. bias = 1131;
  19930. }
  19931. var subrNumber = stack[--stackSize] + bias;
  19932. if (subrNumber < 0 || subrNumber >= subrsIndex.count) {
  19933. validationCommand = CharstringValidationData[value];
  19934. warn('Out of bounds subrIndex for ' + validationCommand.id);
  19935. return false;
  19936. }
  19937. state.stackSize = stackSize;
  19938. state.callDepth++;
  19939. var valid = this.parseCharString(state, subrsIndex.get(subrNumber), localSubrIndex, globalSubrIndex);
  19940. if (!valid) {
  19941. return false;
  19942. }
  19943. state.callDepth--;
  19944. stackSize = state.stackSize;
  19945. continue;
  19946. } else if (value === 11) {
  19947. state.stackSize = stackSize;
  19948. return true;
  19949. } else {
  19950. validationCommand = CharstringValidationData[value];
  19951. }
  19952. if (validationCommand) {
  19953. if (validationCommand.stem) {
  19954. state.hints += stackSize >> 1;
  19955. }
  19956. if ('min' in validationCommand) {
  19957. if (!state.undefStack && stackSize < validationCommand.min) {
  19958. warn('Not enough parameters for ' + validationCommand.id + '; actual: ' + stackSize + ', expected: ' + validationCommand.min);
  19959. return false;
  19960. }
  19961. }
  19962. if (state.firstStackClearing && validationCommand.stackClearing) {
  19963. state.firstStackClearing = false;
  19964. stackSize -= validationCommand.min;
  19965. if (stackSize >= 2 && validationCommand.stem) {
  19966. stackSize %= 2;
  19967. } else if (stackSize > 1) {
  19968. warn('Found too many parameters for stack-clearing command');
  19969. }
  19970. if (stackSize > 0 && stack[stackSize - 1] >= 0) {
  19971. state.width = stack[stackSize - 1];
  19972. }
  19973. }
  19974. if ('stackDelta' in validationCommand) {
  19975. if ('stackFn' in validationCommand) {
  19976. validationCommand.stackFn(stack, stackSize);
  19977. }
  19978. stackSize += validationCommand.stackDelta;
  19979. } else if (validationCommand.stackClearing) {
  19980. stackSize = 0;
  19981. } else if (validationCommand.resetStack) {
  19982. stackSize = 0;
  19983. state.undefStack = false;
  19984. } else if (validationCommand.undefStack) {
  19985. stackSize = 0;
  19986. state.undefStack = true;
  19987. state.firstStackClearing = false;
  19988. }
  19989. }
  19990. }
  19991. state.stackSize = stackSize;
  19992. return true;
  19993. },
  19994. parseCharStrings: function CFFParser_parseCharStrings(charStrings, localSubrIndex, globalSubrIndex, fdSelect, fdArray) {
  19995. var seacs = [];
  19996. var widths = [];
  19997. var count = charStrings.count;
  19998. for (var i = 0; i < count; i++) {
  19999. var charstring = charStrings.get(i);
  20000. var state = {
  20001. callDepth: 0,
  20002. stackSize: 0,
  20003. stack: [],
  20004. undefStack: true,
  20005. hints: 0,
  20006. firstStackClearing: true,
  20007. seac: null,
  20008. width: null
  20009. };
  20010. var valid = true;
  20011. var localSubrToUse = null;
  20012. if (fdSelect && fdArray.length) {
  20013. var fdIndex = fdSelect.getFDIndex(i);
  20014. if (fdIndex === -1) {
  20015. warn('Glyph index is not in fd select.');
  20016. valid = false;
  20017. }
  20018. if (fdIndex >= fdArray.length) {
  20019. warn('Invalid fd index for glyph index.');
  20020. valid = false;
  20021. }
  20022. if (valid) {
  20023. localSubrToUse = fdArray[fdIndex].privateDict.subrsIndex;
  20024. }
  20025. } else if (localSubrIndex) {
  20026. localSubrToUse = localSubrIndex;
  20027. }
  20028. if (valid) {
  20029. valid = this.parseCharString(state, charstring, localSubrToUse, globalSubrIndex);
  20030. }
  20031. if (state.width !== null) {
  20032. widths[i] = state.width;
  20033. }
  20034. if (state.seac !== null) {
  20035. seacs[i] = state.seac;
  20036. }
  20037. if (!valid) {
  20038. charStrings.set(i, new Uint8Array([14]));
  20039. }
  20040. }
  20041. return {
  20042. charStrings: charStrings,
  20043. seacs: seacs,
  20044. widths: widths
  20045. };
  20046. },
  20047. emptyPrivateDictionary: function CFFParser_emptyPrivateDictionary(parentDict) {
  20048. var privateDict = this.createDict(CFFPrivateDict, [], parentDict.strings);
  20049. parentDict.setByKey(18, [
  20050. 0,
  20051. 0
  20052. ]);
  20053. parentDict.privateDict = privateDict;
  20054. },
  20055. parsePrivateDict: function CFFParser_parsePrivateDict(parentDict) {
  20056. if (!parentDict.hasName('Private')) {
  20057. this.emptyPrivateDictionary(parentDict);
  20058. return;
  20059. }
  20060. var privateOffset = parentDict.getByName('Private');
  20061. if (!isArray(privateOffset) || privateOffset.length !== 2) {
  20062. parentDict.removeByName('Private');
  20063. return;
  20064. }
  20065. var size = privateOffset[0];
  20066. var offset = privateOffset[1];
  20067. if (size === 0 || offset >= this.bytes.length) {
  20068. this.emptyPrivateDictionary(parentDict);
  20069. return;
  20070. }
  20071. var privateDictEnd = offset + size;
  20072. var dictData = this.bytes.subarray(offset, privateDictEnd);
  20073. var dict = this.parseDict(dictData);
  20074. var privateDict = this.createDict(CFFPrivateDict, dict, parentDict.strings);
  20075. parentDict.privateDict = privateDict;
  20076. if (!privateDict.getByName('Subrs')) {
  20077. return;
  20078. }
  20079. var subrsOffset = privateDict.getByName('Subrs');
  20080. var relativeOffset = offset + subrsOffset;
  20081. if (subrsOffset === 0 || relativeOffset >= this.bytes.length) {
  20082. this.emptyPrivateDictionary(parentDict);
  20083. return;
  20084. }
  20085. var subrsIndex = this.parseIndex(relativeOffset);
  20086. privateDict.subrsIndex = subrsIndex.obj;
  20087. },
  20088. parseCharsets: function CFFParser_parseCharsets(pos, length, strings, cid) {
  20089. if (pos === 0) {
  20090. return new CFFCharset(true, CFFCharsetPredefinedTypes.ISO_ADOBE, ISOAdobeCharset);
  20091. } else if (pos === 1) {
  20092. return new CFFCharset(true, CFFCharsetPredefinedTypes.EXPERT, ExpertCharset);
  20093. } else if (pos === 2) {
  20094. return new CFFCharset(true, CFFCharsetPredefinedTypes.EXPERT_SUBSET, ExpertSubsetCharset);
  20095. }
  20096. var bytes = this.bytes;
  20097. var start = pos;
  20098. var format = bytes[pos++];
  20099. var charset = ['.notdef'];
  20100. var id, count, i;
  20101. length -= 1;
  20102. switch (format) {
  20103. case 0:
  20104. for (i = 0; i < length; i++) {
  20105. id = bytes[pos++] << 8 | bytes[pos++];
  20106. charset.push(cid ? id : strings.get(id));
  20107. }
  20108. break;
  20109. case 1:
  20110. while (charset.length <= length) {
  20111. id = bytes[pos++] << 8 | bytes[pos++];
  20112. count = bytes[pos++];
  20113. for (i = 0; i <= count; i++) {
  20114. charset.push(cid ? id++ : strings.get(id++));
  20115. }
  20116. }
  20117. break;
  20118. case 2:
  20119. while (charset.length <= length) {
  20120. id = bytes[pos++] << 8 | bytes[pos++];
  20121. count = bytes[pos++] << 8 | bytes[pos++];
  20122. for (i = 0; i <= count; i++) {
  20123. charset.push(cid ? id++ : strings.get(id++));
  20124. }
  20125. }
  20126. break;
  20127. default:
  20128. error('Unknown charset format');
  20129. }
  20130. var end = pos;
  20131. var raw = bytes.subarray(start, end);
  20132. return new CFFCharset(false, format, charset, raw);
  20133. },
  20134. parseEncoding: function CFFParser_parseEncoding(pos, properties, strings, charset) {
  20135. var encoding = Object.create(null);
  20136. var bytes = this.bytes;
  20137. var predefined = false;
  20138. var format, i, ii;
  20139. var raw = null;
  20140. function readSupplement() {
  20141. var supplementsCount = bytes[pos++];
  20142. for (i = 0; i < supplementsCount; i++) {
  20143. var code = bytes[pos++];
  20144. var sid = (bytes[pos++] << 8) + (bytes[pos++] & 0xff);
  20145. encoding[code] = charset.indexOf(strings.get(sid));
  20146. }
  20147. }
  20148. if (pos === 0 || pos === 1) {
  20149. predefined = true;
  20150. format = pos;
  20151. var baseEncoding = pos ? ExpertEncoding : StandardEncoding;
  20152. for (i = 0, ii = charset.length; i < ii; i++) {
  20153. var index = baseEncoding.indexOf(charset[i]);
  20154. if (index !== -1) {
  20155. encoding[index] = i;
  20156. }
  20157. }
  20158. } else {
  20159. var dataStart = pos;
  20160. format = bytes[pos++];
  20161. switch (format & 0x7f) {
  20162. case 0:
  20163. var glyphsCount = bytes[pos++];
  20164. for (i = 1; i <= glyphsCount; i++) {
  20165. encoding[bytes[pos++]] = i;
  20166. }
  20167. break;
  20168. case 1:
  20169. var rangesCount = bytes[pos++];
  20170. var gid = 1;
  20171. for (i = 0; i < rangesCount; i++) {
  20172. var start = bytes[pos++];
  20173. var left = bytes[pos++];
  20174. for (var j = start; j <= start + left; j++) {
  20175. encoding[j] = gid++;
  20176. }
  20177. }
  20178. break;
  20179. default:
  20180. error('Unknown encoding format: ' + format + ' in CFF');
  20181. break;
  20182. }
  20183. var dataEnd = pos;
  20184. if (format & 0x80) {
  20185. bytes[dataStart] &= 0x7f;
  20186. readSupplement();
  20187. }
  20188. raw = bytes.subarray(dataStart, dataEnd);
  20189. }
  20190. format = format & 0x7f;
  20191. return new CFFEncoding(predefined, format, encoding, raw);
  20192. },
  20193. parseFDSelect: function CFFParser_parseFDSelect(pos, length) {
  20194. var start = pos;
  20195. var bytes = this.bytes;
  20196. var format = bytes[pos++];
  20197. var fdSelect = [], rawBytes;
  20198. var i, invalidFirstGID = false;
  20199. switch (format) {
  20200. case 0:
  20201. for (i = 0; i < length; ++i) {
  20202. var id = bytes[pos++];
  20203. fdSelect.push(id);
  20204. }
  20205. rawBytes = bytes.subarray(start, pos);
  20206. break;
  20207. case 3:
  20208. var rangesCount = bytes[pos++] << 8 | bytes[pos++];
  20209. for (i = 0; i < rangesCount; ++i) {
  20210. var first = bytes[pos++] << 8 | bytes[pos++];
  20211. if (i === 0 && first !== 0) {
  20212. warn('parseFDSelect: The first range must have a first GID of 0' + ' -- trying to recover.');
  20213. invalidFirstGID = true;
  20214. first = 0;
  20215. }
  20216. var fdIndex = bytes[pos++];
  20217. var next = bytes[pos] << 8 | bytes[pos + 1];
  20218. for (var j = first; j < next; ++j) {
  20219. fdSelect.push(fdIndex);
  20220. }
  20221. }
  20222. pos += 2;
  20223. rawBytes = bytes.subarray(start, pos);
  20224. if (invalidFirstGID) {
  20225. rawBytes[3] = rawBytes[4] = 0;
  20226. }
  20227. break;
  20228. default:
  20229. error('parseFDSelect: Unknown format "' + format + '".');
  20230. break;
  20231. }
  20232. assert(fdSelect.length === length, 'parseFDSelect: Invalid font data.');
  20233. return new CFFFDSelect(fdSelect, rawBytes);
  20234. }
  20235. };
  20236. return CFFParser;
  20237. }();
  20238. var CFF = function CFFClosure() {
  20239. function CFF() {
  20240. this.header = null;
  20241. this.names = [];
  20242. this.topDict = null;
  20243. this.strings = new CFFStrings();
  20244. this.globalSubrIndex = null;
  20245. this.encoding = null;
  20246. this.charset = null;
  20247. this.charStrings = null;
  20248. this.fdArray = [];
  20249. this.fdSelect = null;
  20250. this.isCIDFont = false;
  20251. }
  20252. return CFF;
  20253. }();
  20254. var CFFHeader = function CFFHeaderClosure() {
  20255. function CFFHeader(major, minor, hdrSize, offSize) {
  20256. this.major = major;
  20257. this.minor = minor;
  20258. this.hdrSize = hdrSize;
  20259. this.offSize = offSize;
  20260. }
  20261. return CFFHeader;
  20262. }();
  20263. var CFFStrings = function CFFStringsClosure() {
  20264. function CFFStrings() {
  20265. this.strings = [];
  20266. }
  20267. CFFStrings.prototype = {
  20268. get: function CFFStrings_get(index) {
  20269. if (index >= 0 && index <= 390) {
  20270. return CFFStandardStrings[index];
  20271. }
  20272. if (index - 391 <= this.strings.length) {
  20273. return this.strings[index - 391];
  20274. }
  20275. return CFFStandardStrings[0];
  20276. },
  20277. add: function CFFStrings_add(value) {
  20278. this.strings.push(value);
  20279. },
  20280. get count() {
  20281. return this.strings.length;
  20282. }
  20283. };
  20284. return CFFStrings;
  20285. }();
  20286. var CFFIndex = function CFFIndexClosure() {
  20287. function CFFIndex() {
  20288. this.objects = [];
  20289. this.length = 0;
  20290. }
  20291. CFFIndex.prototype = {
  20292. add: function CFFIndex_add(data) {
  20293. this.length += data.length;
  20294. this.objects.push(data);
  20295. },
  20296. set: function CFFIndex_set(index, data) {
  20297. this.length += data.length - this.objects[index].length;
  20298. this.objects[index] = data;
  20299. },
  20300. get: function CFFIndex_get(index) {
  20301. return this.objects[index];
  20302. },
  20303. get count() {
  20304. return this.objects.length;
  20305. }
  20306. };
  20307. return CFFIndex;
  20308. }();
  20309. var CFFDict = function CFFDictClosure() {
  20310. function CFFDict(tables, strings) {
  20311. this.keyToNameMap = tables.keyToNameMap;
  20312. this.nameToKeyMap = tables.nameToKeyMap;
  20313. this.defaults = tables.defaults;
  20314. this.types = tables.types;
  20315. this.opcodes = tables.opcodes;
  20316. this.order = tables.order;
  20317. this.strings = strings;
  20318. this.values = Object.create(null);
  20319. }
  20320. CFFDict.prototype = {
  20321. setByKey: function CFFDict_setByKey(key, value) {
  20322. if (!(key in this.keyToNameMap)) {
  20323. return false;
  20324. }
  20325. var valueLength = value.length;
  20326. if (valueLength === 0) {
  20327. return true;
  20328. }
  20329. for (var i = 0; i < valueLength; i++) {
  20330. if (isNaN(value[i])) {
  20331. warn('Invalid CFFDict value: "' + value + '" for key "' + key + '".');
  20332. return true;
  20333. }
  20334. }
  20335. var type = this.types[key];
  20336. if (type === 'num' || type === 'sid' || type === 'offset') {
  20337. value = value[0];
  20338. }
  20339. this.values[key] = value;
  20340. return true;
  20341. },
  20342. setByName: function CFFDict_setByName(name, value) {
  20343. if (!(name in this.nameToKeyMap)) {
  20344. error('Invalid dictionary name "' + name + '"');
  20345. }
  20346. this.values[this.nameToKeyMap[name]] = value;
  20347. },
  20348. hasName: function CFFDict_hasName(name) {
  20349. return this.nameToKeyMap[name] in this.values;
  20350. },
  20351. getByName: function CFFDict_getByName(name) {
  20352. if (!(name in this.nameToKeyMap)) {
  20353. error('Invalid dictionary name "' + name + '"');
  20354. }
  20355. var key = this.nameToKeyMap[name];
  20356. if (!(key in this.values)) {
  20357. return this.defaults[key];
  20358. }
  20359. return this.values[key];
  20360. },
  20361. removeByName: function CFFDict_removeByName(name) {
  20362. delete this.values[this.nameToKeyMap[name]];
  20363. }
  20364. };
  20365. CFFDict.createTables = function CFFDict_createTables(layout) {
  20366. var tables = {
  20367. keyToNameMap: {},
  20368. nameToKeyMap: {},
  20369. defaults: {},
  20370. types: {},
  20371. opcodes: {},
  20372. order: []
  20373. };
  20374. for (var i = 0, ii = layout.length; i < ii; ++i) {
  20375. var entry = layout[i];
  20376. var key = isArray(entry[0]) ? (entry[0][0] << 8) + entry[0][1] : entry[0];
  20377. tables.keyToNameMap[key] = entry[1];
  20378. tables.nameToKeyMap[entry[1]] = key;
  20379. tables.types[key] = entry[2];
  20380. tables.defaults[key] = entry[3];
  20381. tables.opcodes[key] = isArray(entry[0]) ? entry[0] : [entry[0]];
  20382. tables.order.push(key);
  20383. }
  20384. return tables;
  20385. };
  20386. return CFFDict;
  20387. }();
  20388. var CFFTopDict = function CFFTopDictClosure() {
  20389. var layout = [
  20390. [
  20391. [
  20392. 12,
  20393. 30
  20394. ],
  20395. 'ROS',
  20396. [
  20397. 'sid',
  20398. 'sid',
  20399. 'num'
  20400. ],
  20401. null
  20402. ],
  20403. [
  20404. [
  20405. 12,
  20406. 20
  20407. ],
  20408. 'SyntheticBase',
  20409. 'num',
  20410. null
  20411. ],
  20412. [
  20413. 0,
  20414. 'version',
  20415. 'sid',
  20416. null
  20417. ],
  20418. [
  20419. 1,
  20420. 'Notice',
  20421. 'sid',
  20422. null
  20423. ],
  20424. [
  20425. [
  20426. 12,
  20427. 0
  20428. ],
  20429. 'Copyright',
  20430. 'sid',
  20431. null
  20432. ],
  20433. [
  20434. 2,
  20435. 'FullName',
  20436. 'sid',
  20437. null
  20438. ],
  20439. [
  20440. 3,
  20441. 'FamilyName',
  20442. 'sid',
  20443. null
  20444. ],
  20445. [
  20446. 4,
  20447. 'Weight',
  20448. 'sid',
  20449. null
  20450. ],
  20451. [
  20452. [
  20453. 12,
  20454. 1
  20455. ],
  20456. 'isFixedPitch',
  20457. 'num',
  20458. 0
  20459. ],
  20460. [
  20461. [
  20462. 12,
  20463. 2
  20464. ],
  20465. 'ItalicAngle',
  20466. 'num',
  20467. 0
  20468. ],
  20469. [
  20470. [
  20471. 12,
  20472. 3
  20473. ],
  20474. 'UnderlinePosition',
  20475. 'num',
  20476. -100
  20477. ],
  20478. [
  20479. [
  20480. 12,
  20481. 4
  20482. ],
  20483. 'UnderlineThickness',
  20484. 'num',
  20485. 50
  20486. ],
  20487. [
  20488. [
  20489. 12,
  20490. 5
  20491. ],
  20492. 'PaintType',
  20493. 'num',
  20494. 0
  20495. ],
  20496. [
  20497. [
  20498. 12,
  20499. 6
  20500. ],
  20501. 'CharstringType',
  20502. 'num',
  20503. 2
  20504. ],
  20505. [
  20506. [
  20507. 12,
  20508. 7
  20509. ],
  20510. 'FontMatrix',
  20511. [
  20512. 'num',
  20513. 'num',
  20514. 'num',
  20515. 'num',
  20516. 'num',
  20517. 'num'
  20518. ],
  20519. [
  20520. 0.001,
  20521. 0,
  20522. 0,
  20523. 0.001,
  20524. 0,
  20525. 0
  20526. ]
  20527. ],
  20528. [
  20529. 13,
  20530. 'UniqueID',
  20531. 'num',
  20532. null
  20533. ],
  20534. [
  20535. 5,
  20536. 'FontBBox',
  20537. [
  20538. 'num',
  20539. 'num',
  20540. 'num',
  20541. 'num'
  20542. ],
  20543. [
  20544. 0,
  20545. 0,
  20546. 0,
  20547. 0
  20548. ]
  20549. ],
  20550. [
  20551. [
  20552. 12,
  20553. 8
  20554. ],
  20555. 'StrokeWidth',
  20556. 'num',
  20557. 0
  20558. ],
  20559. [
  20560. 14,
  20561. 'XUID',
  20562. 'array',
  20563. null
  20564. ],
  20565. [
  20566. 15,
  20567. 'charset',
  20568. 'offset',
  20569. 0
  20570. ],
  20571. [
  20572. 16,
  20573. 'Encoding',
  20574. 'offset',
  20575. 0
  20576. ],
  20577. [
  20578. 17,
  20579. 'CharStrings',
  20580. 'offset',
  20581. 0
  20582. ],
  20583. [
  20584. 18,
  20585. 'Private',
  20586. [
  20587. 'offset',
  20588. 'offset'
  20589. ],
  20590. null
  20591. ],
  20592. [
  20593. [
  20594. 12,
  20595. 21
  20596. ],
  20597. 'PostScript',
  20598. 'sid',
  20599. null
  20600. ],
  20601. [
  20602. [
  20603. 12,
  20604. 22
  20605. ],
  20606. 'BaseFontName',
  20607. 'sid',
  20608. null
  20609. ],
  20610. [
  20611. [
  20612. 12,
  20613. 23
  20614. ],
  20615. 'BaseFontBlend',
  20616. 'delta',
  20617. null
  20618. ],
  20619. [
  20620. [
  20621. 12,
  20622. 31
  20623. ],
  20624. 'CIDFontVersion',
  20625. 'num',
  20626. 0
  20627. ],
  20628. [
  20629. [
  20630. 12,
  20631. 32
  20632. ],
  20633. 'CIDFontRevision',
  20634. 'num',
  20635. 0
  20636. ],
  20637. [
  20638. [
  20639. 12,
  20640. 33
  20641. ],
  20642. 'CIDFontType',
  20643. 'num',
  20644. 0
  20645. ],
  20646. [
  20647. [
  20648. 12,
  20649. 34
  20650. ],
  20651. 'CIDCount',
  20652. 'num',
  20653. 8720
  20654. ],
  20655. [
  20656. [
  20657. 12,
  20658. 35
  20659. ],
  20660. 'UIDBase',
  20661. 'num',
  20662. null
  20663. ],
  20664. [
  20665. [
  20666. 12,
  20667. 37
  20668. ],
  20669. 'FDSelect',
  20670. 'offset',
  20671. null
  20672. ],
  20673. [
  20674. [
  20675. 12,
  20676. 36
  20677. ],
  20678. 'FDArray',
  20679. 'offset',
  20680. null
  20681. ],
  20682. [
  20683. [
  20684. 12,
  20685. 38
  20686. ],
  20687. 'FontName',
  20688. 'sid',
  20689. null
  20690. ]
  20691. ];
  20692. var tables = null;
  20693. function CFFTopDict(strings) {
  20694. if (tables === null) {
  20695. tables = CFFDict.createTables(layout);
  20696. }
  20697. CFFDict.call(this, tables, strings);
  20698. this.privateDict = null;
  20699. }
  20700. CFFTopDict.prototype = Object.create(CFFDict.prototype);
  20701. return CFFTopDict;
  20702. }();
  20703. var CFFPrivateDict = function CFFPrivateDictClosure() {
  20704. var layout = [
  20705. [
  20706. 6,
  20707. 'BlueValues',
  20708. 'delta',
  20709. null
  20710. ],
  20711. [
  20712. 7,
  20713. 'OtherBlues',
  20714. 'delta',
  20715. null
  20716. ],
  20717. [
  20718. 8,
  20719. 'FamilyBlues',
  20720. 'delta',
  20721. null
  20722. ],
  20723. [
  20724. 9,
  20725. 'FamilyOtherBlues',
  20726. 'delta',
  20727. null
  20728. ],
  20729. [
  20730. [
  20731. 12,
  20732. 9
  20733. ],
  20734. 'BlueScale',
  20735. 'num',
  20736. 0.039625
  20737. ],
  20738. [
  20739. [
  20740. 12,
  20741. 10
  20742. ],
  20743. 'BlueShift',
  20744. 'num',
  20745. 7
  20746. ],
  20747. [
  20748. [
  20749. 12,
  20750. 11
  20751. ],
  20752. 'BlueFuzz',
  20753. 'num',
  20754. 1
  20755. ],
  20756. [
  20757. 10,
  20758. 'StdHW',
  20759. 'num',
  20760. null
  20761. ],
  20762. [
  20763. 11,
  20764. 'StdVW',
  20765. 'num',
  20766. null
  20767. ],
  20768. [
  20769. [
  20770. 12,
  20771. 12
  20772. ],
  20773. 'StemSnapH',
  20774. 'delta',
  20775. null
  20776. ],
  20777. [
  20778. [
  20779. 12,
  20780. 13
  20781. ],
  20782. 'StemSnapV',
  20783. 'delta',
  20784. null
  20785. ],
  20786. [
  20787. [
  20788. 12,
  20789. 14
  20790. ],
  20791. 'ForceBold',
  20792. 'num',
  20793. 0
  20794. ],
  20795. [
  20796. [
  20797. 12,
  20798. 17
  20799. ],
  20800. 'LanguageGroup',
  20801. 'num',
  20802. 0
  20803. ],
  20804. [
  20805. [
  20806. 12,
  20807. 18
  20808. ],
  20809. 'ExpansionFactor',
  20810. 'num',
  20811. 0.06
  20812. ],
  20813. [
  20814. [
  20815. 12,
  20816. 19
  20817. ],
  20818. 'initialRandomSeed',
  20819. 'num',
  20820. 0
  20821. ],
  20822. [
  20823. 20,
  20824. 'defaultWidthX',
  20825. 'num',
  20826. 0
  20827. ],
  20828. [
  20829. 21,
  20830. 'nominalWidthX',
  20831. 'num',
  20832. 0
  20833. ],
  20834. [
  20835. 19,
  20836. 'Subrs',
  20837. 'offset',
  20838. null
  20839. ]
  20840. ];
  20841. var tables = null;
  20842. function CFFPrivateDict(strings) {
  20843. if (tables === null) {
  20844. tables = CFFDict.createTables(layout);
  20845. }
  20846. CFFDict.call(this, tables, strings);
  20847. this.subrsIndex = null;
  20848. }
  20849. CFFPrivateDict.prototype = Object.create(CFFDict.prototype);
  20850. return CFFPrivateDict;
  20851. }();
  20852. var CFFCharsetPredefinedTypes = {
  20853. ISO_ADOBE: 0,
  20854. EXPERT: 1,
  20855. EXPERT_SUBSET: 2
  20856. };
  20857. var CFFCharset = function CFFCharsetClosure() {
  20858. function CFFCharset(predefined, format, charset, raw) {
  20859. this.predefined = predefined;
  20860. this.format = format;
  20861. this.charset = charset;
  20862. this.raw = raw;
  20863. }
  20864. return CFFCharset;
  20865. }();
  20866. var CFFEncoding = function CFFEncodingClosure() {
  20867. function CFFEncoding(predefined, format, encoding, raw) {
  20868. this.predefined = predefined;
  20869. this.format = format;
  20870. this.encoding = encoding;
  20871. this.raw = raw;
  20872. }
  20873. return CFFEncoding;
  20874. }();
  20875. var CFFFDSelect = function CFFFDSelectClosure() {
  20876. function CFFFDSelect(fdSelect, raw) {
  20877. this.fdSelect = fdSelect;
  20878. this.raw = raw;
  20879. }
  20880. CFFFDSelect.prototype = {
  20881. getFDIndex: function CFFFDSelect_get(glyphIndex) {
  20882. if (glyphIndex < 0 || glyphIndex >= this.fdSelect.length) {
  20883. return -1;
  20884. }
  20885. return this.fdSelect[glyphIndex];
  20886. }
  20887. };
  20888. return CFFFDSelect;
  20889. }();
  20890. var CFFOffsetTracker = function CFFOffsetTrackerClosure() {
  20891. function CFFOffsetTracker() {
  20892. this.offsets = Object.create(null);
  20893. }
  20894. CFFOffsetTracker.prototype = {
  20895. isTracking: function CFFOffsetTracker_isTracking(key) {
  20896. return key in this.offsets;
  20897. },
  20898. track: function CFFOffsetTracker_track(key, location) {
  20899. if (key in this.offsets) {
  20900. error('Already tracking location of ' + key);
  20901. }
  20902. this.offsets[key] = location;
  20903. },
  20904. offset: function CFFOffsetTracker_offset(value) {
  20905. for (var key in this.offsets) {
  20906. this.offsets[key] += value;
  20907. }
  20908. },
  20909. setEntryLocation: function CFFOffsetTracker_setEntryLocation(key, values, output) {
  20910. if (!(key in this.offsets)) {
  20911. error('Not tracking location of ' + key);
  20912. }
  20913. var data = output.data;
  20914. var dataOffset = this.offsets[key];
  20915. var size = 5;
  20916. for (var i = 0, ii = values.length; i < ii; ++i) {
  20917. var offset0 = i * size + dataOffset;
  20918. var offset1 = offset0 + 1;
  20919. var offset2 = offset0 + 2;
  20920. var offset3 = offset0 + 3;
  20921. var offset4 = offset0 + 4;
  20922. if (data[offset0] !== 0x1d || data[offset1] !== 0 || data[offset2] !== 0 || data[offset3] !== 0 || data[offset4] !== 0) {
  20923. error('writing to an offset that is not empty');
  20924. }
  20925. var value = values[i];
  20926. data[offset0] = 0x1d;
  20927. data[offset1] = value >> 24 & 0xFF;
  20928. data[offset2] = value >> 16 & 0xFF;
  20929. data[offset3] = value >> 8 & 0xFF;
  20930. data[offset4] = value & 0xFF;
  20931. }
  20932. }
  20933. };
  20934. return CFFOffsetTracker;
  20935. }();
  20936. var CFFCompiler = function CFFCompilerClosure() {
  20937. function CFFCompiler(cff) {
  20938. this.cff = cff;
  20939. }
  20940. CFFCompiler.prototype = {
  20941. compile: function CFFCompiler_compile() {
  20942. var cff = this.cff;
  20943. var output = {
  20944. data: [],
  20945. length: 0,
  20946. add: function CFFCompiler_add(data) {
  20947. this.data = this.data.concat(data);
  20948. this.length = this.data.length;
  20949. }
  20950. };
  20951. var header = this.compileHeader(cff.header);
  20952. output.add(header);
  20953. var nameIndex = this.compileNameIndex(cff.names);
  20954. output.add(nameIndex);
  20955. if (cff.isCIDFont) {
  20956. if (cff.topDict.hasName('FontMatrix')) {
  20957. var base = cff.topDict.getByName('FontMatrix');
  20958. cff.topDict.removeByName('FontMatrix');
  20959. for (var i = 0, ii = cff.fdArray.length; i < ii; i++) {
  20960. var subDict = cff.fdArray[i];
  20961. var matrix = base.slice(0);
  20962. if (subDict.hasName('FontMatrix')) {
  20963. matrix = Util.transform(matrix, subDict.getByName('FontMatrix'));
  20964. }
  20965. subDict.setByName('FontMatrix', matrix);
  20966. }
  20967. }
  20968. }
  20969. var compiled = this.compileTopDicts([cff.topDict], output.length, cff.isCIDFont);
  20970. output.add(compiled.output);
  20971. var topDictTracker = compiled.trackers[0];
  20972. var stringIndex = this.compileStringIndex(cff.strings.strings);
  20973. output.add(stringIndex);
  20974. var globalSubrIndex = this.compileIndex(cff.globalSubrIndex);
  20975. output.add(globalSubrIndex);
  20976. if (cff.encoding && cff.topDict.hasName('Encoding')) {
  20977. if (cff.encoding.predefined) {
  20978. topDictTracker.setEntryLocation('Encoding', [cff.encoding.format], output);
  20979. } else {
  20980. var encoding = this.compileEncoding(cff.encoding);
  20981. topDictTracker.setEntryLocation('Encoding', [output.length], output);
  20982. output.add(encoding);
  20983. }
  20984. }
  20985. if (cff.charset && cff.topDict.hasName('charset')) {
  20986. if (cff.charset.predefined) {
  20987. topDictTracker.setEntryLocation('charset', [cff.charset.format], output);
  20988. } else {
  20989. var charset = this.compileCharset(cff.charset);
  20990. topDictTracker.setEntryLocation('charset', [output.length], output);
  20991. output.add(charset);
  20992. }
  20993. }
  20994. var charStrings = this.compileCharStrings(cff.charStrings);
  20995. topDictTracker.setEntryLocation('CharStrings', [output.length], output);
  20996. output.add(charStrings);
  20997. if (cff.isCIDFont) {
  20998. topDictTracker.setEntryLocation('FDSelect', [output.length], output);
  20999. var fdSelect = this.compileFDSelect(cff.fdSelect.raw);
  21000. output.add(fdSelect);
  21001. compiled = this.compileTopDicts(cff.fdArray, output.length, true);
  21002. topDictTracker.setEntryLocation('FDArray', [output.length], output);
  21003. output.add(compiled.output);
  21004. var fontDictTrackers = compiled.trackers;
  21005. this.compilePrivateDicts(cff.fdArray, fontDictTrackers, output);
  21006. }
  21007. this.compilePrivateDicts([cff.topDict], [topDictTracker], output);
  21008. output.add([0]);
  21009. return output.data;
  21010. },
  21011. encodeNumber: function CFFCompiler_encodeNumber(value) {
  21012. if (parseFloat(value) === parseInt(value, 10) && !isNaN(value)) {
  21013. return this.encodeInteger(value);
  21014. }
  21015. return this.encodeFloat(value);
  21016. },
  21017. encodeFloat: function CFFCompiler_encodeFloat(num) {
  21018. var value = num.toString();
  21019. var m = /\.(\d*?)(?:9{5,20}|0{5,20})\d{0,2}(?:e(.+)|$)/.exec(value);
  21020. if (m) {
  21021. var epsilon = parseFloat('1e' + ((m[2] ? +m[2] : 0) + m[1].length));
  21022. value = (Math.round(num * epsilon) / epsilon).toString();
  21023. }
  21024. var nibbles = '';
  21025. var i, ii;
  21026. for (i = 0, ii = value.length; i < ii; ++i) {
  21027. var a = value[i];
  21028. if (a === 'e') {
  21029. nibbles += value[++i] === '-' ? 'c' : 'b';
  21030. } else if (a === '.') {
  21031. nibbles += 'a';
  21032. } else if (a === '-') {
  21033. nibbles += 'e';
  21034. } else {
  21035. nibbles += a;
  21036. }
  21037. }
  21038. nibbles += nibbles.length & 1 ? 'f' : 'ff';
  21039. var out = [30];
  21040. for (i = 0, ii = nibbles.length; i < ii; i += 2) {
  21041. out.push(parseInt(nibbles.substr(i, 2), 16));
  21042. }
  21043. return out;
  21044. },
  21045. encodeInteger: function CFFCompiler_encodeInteger(value) {
  21046. var code;
  21047. if (value >= -107 && value <= 107) {
  21048. code = [value + 139];
  21049. } else if (value >= 108 && value <= 1131) {
  21050. value = value - 108;
  21051. code = [
  21052. (value >> 8) + 247,
  21053. value & 0xFF
  21054. ];
  21055. } else if (value >= -1131 && value <= -108) {
  21056. value = -value - 108;
  21057. code = [
  21058. (value >> 8) + 251,
  21059. value & 0xFF
  21060. ];
  21061. } else if (value >= -32768 && value <= 32767) {
  21062. code = [
  21063. 0x1c,
  21064. value >> 8 & 0xFF,
  21065. value & 0xFF
  21066. ];
  21067. } else {
  21068. code = [
  21069. 0x1d,
  21070. value >> 24 & 0xFF,
  21071. value >> 16 & 0xFF,
  21072. value >> 8 & 0xFF,
  21073. value & 0xFF
  21074. ];
  21075. }
  21076. return code;
  21077. },
  21078. compileHeader: function CFFCompiler_compileHeader(header) {
  21079. return [
  21080. header.major,
  21081. header.minor,
  21082. header.hdrSize,
  21083. header.offSize
  21084. ];
  21085. },
  21086. compileNameIndex: function CFFCompiler_compileNameIndex(names) {
  21087. var nameIndex = new CFFIndex();
  21088. for (var i = 0, ii = names.length; i < ii; ++i) {
  21089. nameIndex.add(stringToBytes(names[i]));
  21090. }
  21091. return this.compileIndex(nameIndex);
  21092. },
  21093. compileTopDicts: function CFFCompiler_compileTopDicts(dicts, length, removeCidKeys) {
  21094. var fontDictTrackers = [];
  21095. var fdArrayIndex = new CFFIndex();
  21096. for (var i = 0, ii = dicts.length; i < ii; ++i) {
  21097. var fontDict = dicts[i];
  21098. if (removeCidKeys) {
  21099. fontDict.removeByName('CIDFontVersion');
  21100. fontDict.removeByName('CIDFontRevision');
  21101. fontDict.removeByName('CIDFontType');
  21102. fontDict.removeByName('CIDCount');
  21103. fontDict.removeByName('UIDBase');
  21104. }
  21105. var fontDictTracker = new CFFOffsetTracker();
  21106. var fontDictData = this.compileDict(fontDict, fontDictTracker);
  21107. fontDictTrackers.push(fontDictTracker);
  21108. fdArrayIndex.add(fontDictData);
  21109. fontDictTracker.offset(length);
  21110. }
  21111. fdArrayIndex = this.compileIndex(fdArrayIndex, fontDictTrackers);
  21112. return {
  21113. trackers: fontDictTrackers,
  21114. output: fdArrayIndex
  21115. };
  21116. },
  21117. compilePrivateDicts: function CFFCompiler_compilePrivateDicts(dicts, trackers, output) {
  21118. for (var i = 0, ii = dicts.length; i < ii; ++i) {
  21119. var fontDict = dicts[i];
  21120. assert(fontDict.privateDict && fontDict.hasName('Private'), 'There must be an private dictionary.');
  21121. var privateDict = fontDict.privateDict;
  21122. var privateDictTracker = new CFFOffsetTracker();
  21123. var privateDictData = this.compileDict(privateDict, privateDictTracker);
  21124. var outputLength = output.length;
  21125. privateDictTracker.offset(outputLength);
  21126. if (!privateDictData.length) {
  21127. outputLength = 0;
  21128. }
  21129. trackers[i].setEntryLocation('Private', [
  21130. privateDictData.length,
  21131. outputLength
  21132. ], output);
  21133. output.add(privateDictData);
  21134. if (privateDict.subrsIndex && privateDict.hasName('Subrs')) {
  21135. var subrs = this.compileIndex(privateDict.subrsIndex);
  21136. privateDictTracker.setEntryLocation('Subrs', [privateDictData.length], output);
  21137. output.add(subrs);
  21138. }
  21139. }
  21140. },
  21141. compileDict: function CFFCompiler_compileDict(dict, offsetTracker) {
  21142. var out = [];
  21143. var order = dict.order;
  21144. for (var i = 0; i < order.length; ++i) {
  21145. var key = order[i];
  21146. if (!(key in dict.values)) {
  21147. continue;
  21148. }
  21149. var values = dict.values[key];
  21150. var types = dict.types[key];
  21151. if (!isArray(types)) {
  21152. types = [types];
  21153. }
  21154. if (!isArray(values)) {
  21155. values = [values];
  21156. }
  21157. if (values.length === 0) {
  21158. continue;
  21159. }
  21160. for (var j = 0, jj = types.length; j < jj; ++j) {
  21161. var type = types[j];
  21162. var value = values[j];
  21163. switch (type) {
  21164. case 'num':
  21165. case 'sid':
  21166. out = out.concat(this.encodeNumber(value));
  21167. break;
  21168. case 'offset':
  21169. var name = dict.keyToNameMap[key];
  21170. if (!offsetTracker.isTracking(name)) {
  21171. offsetTracker.track(name, out.length);
  21172. }
  21173. out = out.concat([
  21174. 0x1d,
  21175. 0,
  21176. 0,
  21177. 0,
  21178. 0
  21179. ]);
  21180. break;
  21181. case 'array':
  21182. case 'delta':
  21183. out = out.concat(this.encodeNumber(value));
  21184. for (var k = 1, kk = values.length; k < kk; ++k) {
  21185. out = out.concat(this.encodeNumber(values[k]));
  21186. }
  21187. break;
  21188. default:
  21189. error('Unknown data type of ' + type);
  21190. break;
  21191. }
  21192. }
  21193. out = out.concat(dict.opcodes[key]);
  21194. }
  21195. return out;
  21196. },
  21197. compileStringIndex: function CFFCompiler_compileStringIndex(strings) {
  21198. var stringIndex = new CFFIndex();
  21199. for (var i = 0, ii = strings.length; i < ii; ++i) {
  21200. stringIndex.add(stringToBytes(strings[i]));
  21201. }
  21202. return this.compileIndex(stringIndex);
  21203. },
  21204. compileGlobalSubrIndex: function CFFCompiler_compileGlobalSubrIndex() {
  21205. var globalSubrIndex = this.cff.globalSubrIndex;
  21206. this.out.writeByteArray(this.compileIndex(globalSubrIndex));
  21207. },
  21208. compileCharStrings: function CFFCompiler_compileCharStrings(charStrings) {
  21209. return this.compileIndex(charStrings);
  21210. },
  21211. compileCharset: function CFFCompiler_compileCharset(charset) {
  21212. return this.compileTypedArray(charset.raw);
  21213. },
  21214. compileEncoding: function CFFCompiler_compileEncoding(encoding) {
  21215. return this.compileTypedArray(encoding.raw);
  21216. },
  21217. compileFDSelect: function CFFCompiler_compileFDSelect(fdSelect) {
  21218. return this.compileTypedArray(fdSelect);
  21219. },
  21220. compileTypedArray: function CFFCompiler_compileTypedArray(data) {
  21221. var out = [];
  21222. for (var i = 0, ii = data.length; i < ii; ++i) {
  21223. out[i] = data[i];
  21224. }
  21225. return out;
  21226. },
  21227. compileIndex: function CFFCompiler_compileIndex(index, trackers) {
  21228. trackers = trackers || [];
  21229. var objects = index.objects;
  21230. var count = objects.length;
  21231. if (count === 0) {
  21232. return [
  21233. 0,
  21234. 0,
  21235. 0
  21236. ];
  21237. }
  21238. var data = [
  21239. count >> 8 & 0xFF,
  21240. count & 0xff
  21241. ];
  21242. var lastOffset = 1, i;
  21243. for (i = 0; i < count; ++i) {
  21244. lastOffset += objects[i].length;
  21245. }
  21246. var offsetSize;
  21247. if (lastOffset < 0x100) {
  21248. offsetSize = 1;
  21249. } else if (lastOffset < 0x10000) {
  21250. offsetSize = 2;
  21251. } else if (lastOffset < 0x1000000) {
  21252. offsetSize = 3;
  21253. } else {
  21254. offsetSize = 4;
  21255. }
  21256. data.push(offsetSize);
  21257. var relativeOffset = 1;
  21258. for (i = 0; i < count + 1; i++) {
  21259. if (offsetSize === 1) {
  21260. data.push(relativeOffset & 0xFF);
  21261. } else if (offsetSize === 2) {
  21262. data.push(relativeOffset >> 8 & 0xFF, relativeOffset & 0xFF);
  21263. } else if (offsetSize === 3) {
  21264. data.push(relativeOffset >> 16 & 0xFF, relativeOffset >> 8 & 0xFF, relativeOffset & 0xFF);
  21265. } else {
  21266. data.push(relativeOffset >>> 24 & 0xFF, relativeOffset >> 16 & 0xFF, relativeOffset >> 8 & 0xFF, relativeOffset & 0xFF);
  21267. }
  21268. if (objects[i]) {
  21269. relativeOffset += objects[i].length;
  21270. }
  21271. }
  21272. for (i = 0; i < count; i++) {
  21273. if (trackers[i]) {
  21274. trackers[i].offset(data.length);
  21275. }
  21276. for (var j = 0, jj = objects[i].length; j < jj; j++) {
  21277. data.push(objects[i][j]);
  21278. }
  21279. }
  21280. return data;
  21281. }
  21282. };
  21283. return CFFCompiler;
  21284. }();
  21285. exports.CFFStandardStrings = CFFStandardStrings;
  21286. exports.CFFParser = CFFParser;
  21287. exports.CFF = CFF;
  21288. exports.CFFHeader = CFFHeader;
  21289. exports.CFFStrings = CFFStrings;
  21290. exports.CFFIndex = CFFIndex;
  21291. exports.CFFCharset = CFFCharset;
  21292. exports.CFFTopDict = CFFTopDict;
  21293. exports.CFFPrivateDict = CFFPrivateDict;
  21294. exports.CFFCompiler = CFFCompiler;
  21295. /***/ }),
  21296. /* 12 */
  21297. /***/ (function(module, exports, __w_pdfjs_require__) {
  21298. "use strict";
  21299. var sharedUtil = __w_pdfjs_require__(0);
  21300. var MissingDataException = sharedUtil.MissingDataException;
  21301. var arrayByteLength = sharedUtil.arrayByteLength;
  21302. var arraysToBytes = sharedUtil.arraysToBytes;
  21303. var assert = sharedUtil.assert;
  21304. var createPromiseCapability = sharedUtil.createPromiseCapability;
  21305. var isInt = sharedUtil.isInt;
  21306. var isEmptyObj = sharedUtil.isEmptyObj;
  21307. var ChunkedStream = function ChunkedStreamClosure() {
  21308. function ChunkedStream(length, chunkSize, manager) {
  21309. this.bytes = new Uint8Array(length);
  21310. this.start = 0;
  21311. this.pos = 0;
  21312. this.end = length;
  21313. this.chunkSize = chunkSize;
  21314. this.loadedChunks = [];
  21315. this.numChunksLoaded = 0;
  21316. this.numChunks = Math.ceil(length / chunkSize);
  21317. this.manager = manager;
  21318. this.progressiveDataLength = 0;
  21319. this.lastSuccessfulEnsureByteChunk = -1;
  21320. }
  21321. ChunkedStream.prototype = {
  21322. getMissingChunks: function ChunkedStream_getMissingChunks() {
  21323. var chunks = [];
  21324. for (var chunk = 0, n = this.numChunks; chunk < n; ++chunk) {
  21325. if (!this.loadedChunks[chunk]) {
  21326. chunks.push(chunk);
  21327. }
  21328. }
  21329. return chunks;
  21330. },
  21331. getBaseStreams: function ChunkedStream_getBaseStreams() {
  21332. return [this];
  21333. },
  21334. allChunksLoaded: function ChunkedStream_allChunksLoaded() {
  21335. return this.numChunksLoaded === this.numChunks;
  21336. },
  21337. onReceiveData: function ChunkedStream_onReceiveData(begin, chunk) {
  21338. var end = begin + chunk.byteLength;
  21339. assert(begin % this.chunkSize === 0, 'Bad begin offset: ' + begin);
  21340. var length = this.bytes.length;
  21341. assert(end % this.chunkSize === 0 || end === length, 'Bad end offset: ' + end);
  21342. this.bytes.set(new Uint8Array(chunk), begin);
  21343. var chunkSize = this.chunkSize;
  21344. var beginChunk = Math.floor(begin / chunkSize);
  21345. var endChunk = Math.floor((end - 1) / chunkSize) + 1;
  21346. var curChunk;
  21347. for (curChunk = beginChunk; curChunk < endChunk; ++curChunk) {
  21348. if (!this.loadedChunks[curChunk]) {
  21349. this.loadedChunks[curChunk] = true;
  21350. ++this.numChunksLoaded;
  21351. }
  21352. }
  21353. },
  21354. onReceiveProgressiveData: function ChunkedStream_onReceiveProgressiveData(data) {
  21355. var position = this.progressiveDataLength;
  21356. var beginChunk = Math.floor(position / this.chunkSize);
  21357. this.bytes.set(new Uint8Array(data), position);
  21358. position += data.byteLength;
  21359. this.progressiveDataLength = position;
  21360. var endChunk = position >= this.end ? this.numChunks : Math.floor(position / this.chunkSize);
  21361. var curChunk;
  21362. for (curChunk = beginChunk; curChunk < endChunk; ++curChunk) {
  21363. if (!this.loadedChunks[curChunk]) {
  21364. this.loadedChunks[curChunk] = true;
  21365. ++this.numChunksLoaded;
  21366. }
  21367. }
  21368. },
  21369. ensureByte: function ChunkedStream_ensureByte(pos) {
  21370. var chunk = Math.floor(pos / this.chunkSize);
  21371. if (chunk === this.lastSuccessfulEnsureByteChunk) {
  21372. return;
  21373. }
  21374. if (!this.loadedChunks[chunk]) {
  21375. throw new MissingDataException(pos, pos + 1);
  21376. }
  21377. this.lastSuccessfulEnsureByteChunk = chunk;
  21378. },
  21379. ensureRange: function ChunkedStream_ensureRange(begin, end) {
  21380. if (begin >= end) {
  21381. return;
  21382. }
  21383. if (end <= this.progressiveDataLength) {
  21384. return;
  21385. }
  21386. var chunkSize = this.chunkSize;
  21387. var beginChunk = Math.floor(begin / chunkSize);
  21388. var endChunk = Math.floor((end - 1) / chunkSize) + 1;
  21389. for (var chunk = beginChunk; chunk < endChunk; ++chunk) {
  21390. if (!this.loadedChunks[chunk]) {
  21391. throw new MissingDataException(begin, end);
  21392. }
  21393. }
  21394. },
  21395. nextEmptyChunk: function ChunkedStream_nextEmptyChunk(beginChunk) {
  21396. var chunk, numChunks = this.numChunks;
  21397. for (var i = 0; i < numChunks; ++i) {
  21398. chunk = (beginChunk + i) % numChunks;
  21399. if (!this.loadedChunks[chunk]) {
  21400. return chunk;
  21401. }
  21402. }
  21403. return null;
  21404. },
  21405. hasChunk: function ChunkedStream_hasChunk(chunk) {
  21406. return !!this.loadedChunks[chunk];
  21407. },
  21408. get length() {
  21409. return this.end - this.start;
  21410. },
  21411. get isEmpty() {
  21412. return this.length === 0;
  21413. },
  21414. getByte: function ChunkedStream_getByte() {
  21415. var pos = this.pos;
  21416. if (pos >= this.end) {
  21417. return -1;
  21418. }
  21419. this.ensureByte(pos);
  21420. return this.bytes[this.pos++];
  21421. },
  21422. getUint16: function ChunkedStream_getUint16() {
  21423. var b0 = this.getByte();
  21424. var b1 = this.getByte();
  21425. if (b0 === -1 || b1 === -1) {
  21426. return -1;
  21427. }
  21428. return (b0 << 8) + b1;
  21429. },
  21430. getInt32: function ChunkedStream_getInt32() {
  21431. var b0 = this.getByte();
  21432. var b1 = this.getByte();
  21433. var b2 = this.getByte();
  21434. var b3 = this.getByte();
  21435. return (b0 << 24) + (b1 << 16) + (b2 << 8) + b3;
  21436. },
  21437. getBytes: function ChunkedStream_getBytes(length) {
  21438. var bytes = this.bytes;
  21439. var pos = this.pos;
  21440. var strEnd = this.end;
  21441. if (!length) {
  21442. this.ensureRange(pos, strEnd);
  21443. return bytes.subarray(pos, strEnd);
  21444. }
  21445. var end = pos + length;
  21446. if (end > strEnd) {
  21447. end = strEnd;
  21448. }
  21449. this.ensureRange(pos, end);
  21450. this.pos = end;
  21451. return bytes.subarray(pos, end);
  21452. },
  21453. peekByte: function ChunkedStream_peekByte() {
  21454. var peekedByte = this.getByte();
  21455. this.pos--;
  21456. return peekedByte;
  21457. },
  21458. peekBytes: function ChunkedStream_peekBytes(length) {
  21459. var bytes = this.getBytes(length);
  21460. this.pos -= bytes.length;
  21461. return bytes;
  21462. },
  21463. getByteRange: function ChunkedStream_getBytes(begin, end) {
  21464. this.ensureRange(begin, end);
  21465. return this.bytes.subarray(begin, end);
  21466. },
  21467. skip: function ChunkedStream_skip(n) {
  21468. if (!n) {
  21469. n = 1;
  21470. }
  21471. this.pos += n;
  21472. },
  21473. reset: function ChunkedStream_reset() {
  21474. this.pos = this.start;
  21475. },
  21476. moveStart: function ChunkedStream_moveStart() {
  21477. this.start = this.pos;
  21478. },
  21479. makeSubStream: function ChunkedStream_makeSubStream(start, length, dict) {
  21480. this.ensureRange(start, start + length);
  21481. function ChunkedStreamSubstream() {
  21482. }
  21483. ChunkedStreamSubstream.prototype = Object.create(this);
  21484. ChunkedStreamSubstream.prototype.getMissingChunks = function () {
  21485. var chunkSize = this.chunkSize;
  21486. var beginChunk = Math.floor(this.start / chunkSize);
  21487. var endChunk = Math.floor((this.end - 1) / chunkSize) + 1;
  21488. var missingChunks = [];
  21489. for (var chunk = beginChunk; chunk < endChunk; ++chunk) {
  21490. if (!this.loadedChunks[chunk]) {
  21491. missingChunks.push(chunk);
  21492. }
  21493. }
  21494. return missingChunks;
  21495. };
  21496. var subStream = new ChunkedStreamSubstream();
  21497. subStream.pos = subStream.start = start;
  21498. subStream.end = start + length || this.end;
  21499. subStream.dict = dict;
  21500. return subStream;
  21501. }
  21502. };
  21503. return ChunkedStream;
  21504. }();
  21505. var ChunkedStreamManager = function ChunkedStreamManagerClosure() {
  21506. function ChunkedStreamManager(pdfNetworkStream, args) {
  21507. var chunkSize = args.rangeChunkSize;
  21508. var length = args.length;
  21509. this.stream = new ChunkedStream(length, chunkSize, this);
  21510. this.length = length;
  21511. this.chunkSize = chunkSize;
  21512. this.pdfNetworkStream = pdfNetworkStream;
  21513. this.url = args.url;
  21514. this.disableAutoFetch = args.disableAutoFetch;
  21515. this.msgHandler = args.msgHandler;
  21516. this.currRequestId = 0;
  21517. this.chunksNeededByRequest = Object.create(null);
  21518. this.requestsByChunk = Object.create(null);
  21519. this.promisesByRequest = Object.create(null);
  21520. this.progressiveDataLength = 0;
  21521. this.aborted = false;
  21522. this._loadedStreamCapability = createPromiseCapability();
  21523. }
  21524. ChunkedStreamManager.prototype = {
  21525. onLoadedStream: function ChunkedStreamManager_getLoadedStream() {
  21526. return this._loadedStreamCapability.promise;
  21527. },
  21528. sendRequest: function ChunkedStreamManager_sendRequest(begin, end) {
  21529. var rangeReader = this.pdfNetworkStream.getRangeReader(begin, end);
  21530. if (!rangeReader.isStreamingSupported) {
  21531. rangeReader.onProgress = this.onProgress.bind(this);
  21532. }
  21533. var chunks = [], loaded = 0;
  21534. var manager = this;
  21535. var promise = new Promise(function (resolve, reject) {
  21536. var readChunk = function (chunk) {
  21537. try {
  21538. if (!chunk.done) {
  21539. var data = chunk.value;
  21540. chunks.push(data);
  21541. loaded += arrayByteLength(data);
  21542. if (rangeReader.isStreamingSupported) {
  21543. manager.onProgress({ loaded: loaded });
  21544. }
  21545. rangeReader.read().then(readChunk, reject);
  21546. return;
  21547. }
  21548. var chunkData = arraysToBytes(chunks);
  21549. chunks = null;
  21550. resolve(chunkData);
  21551. } catch (e) {
  21552. reject(e);
  21553. }
  21554. };
  21555. rangeReader.read().then(readChunk, reject);
  21556. });
  21557. promise.then(function (data) {
  21558. if (this.aborted) {
  21559. return;
  21560. }
  21561. this.onReceiveData({
  21562. chunk: data,
  21563. begin: begin
  21564. });
  21565. }.bind(this));
  21566. },
  21567. requestAllChunks: function ChunkedStreamManager_requestAllChunks() {
  21568. var missingChunks = this.stream.getMissingChunks();
  21569. this._requestChunks(missingChunks);
  21570. return this._loadedStreamCapability.promise;
  21571. },
  21572. _requestChunks: function ChunkedStreamManager_requestChunks(chunks) {
  21573. var requestId = this.currRequestId++;
  21574. var i, ii;
  21575. var chunksNeeded = Object.create(null);
  21576. this.chunksNeededByRequest[requestId] = chunksNeeded;
  21577. for (i = 0, ii = chunks.length; i < ii; i++) {
  21578. if (!this.stream.hasChunk(chunks[i])) {
  21579. chunksNeeded[chunks[i]] = true;
  21580. }
  21581. }
  21582. if (isEmptyObj(chunksNeeded)) {
  21583. return Promise.resolve();
  21584. }
  21585. var capability = createPromiseCapability();
  21586. this.promisesByRequest[requestId] = capability;
  21587. var chunksToRequest = [];
  21588. for (var chunk in chunksNeeded) {
  21589. chunk = chunk | 0;
  21590. if (!(chunk in this.requestsByChunk)) {
  21591. this.requestsByChunk[chunk] = [];
  21592. chunksToRequest.push(chunk);
  21593. }
  21594. this.requestsByChunk[chunk].push(requestId);
  21595. }
  21596. if (!chunksToRequest.length) {
  21597. return capability.promise;
  21598. }
  21599. var groupedChunksToRequest = this.groupChunks(chunksToRequest);
  21600. for (i = 0; i < groupedChunksToRequest.length; ++i) {
  21601. var groupedChunk = groupedChunksToRequest[i];
  21602. var begin = groupedChunk.beginChunk * this.chunkSize;
  21603. var end = Math.min(groupedChunk.endChunk * this.chunkSize, this.length);
  21604. this.sendRequest(begin, end);
  21605. }
  21606. return capability.promise;
  21607. },
  21608. getStream: function ChunkedStreamManager_getStream() {
  21609. return this.stream;
  21610. },
  21611. requestRange: function ChunkedStreamManager_requestRange(begin, end) {
  21612. end = Math.min(end, this.length);
  21613. var beginChunk = this.getBeginChunk(begin);
  21614. var endChunk = this.getEndChunk(end);
  21615. var chunks = [];
  21616. for (var chunk = beginChunk; chunk < endChunk; ++chunk) {
  21617. chunks.push(chunk);
  21618. }
  21619. return this._requestChunks(chunks);
  21620. },
  21621. requestRanges: function ChunkedStreamManager_requestRanges(ranges) {
  21622. ranges = ranges || [];
  21623. var chunksToRequest = [];
  21624. for (var i = 0; i < ranges.length; i++) {
  21625. var beginChunk = this.getBeginChunk(ranges[i].begin);
  21626. var endChunk = this.getEndChunk(ranges[i].end);
  21627. for (var chunk = beginChunk; chunk < endChunk; ++chunk) {
  21628. if (chunksToRequest.indexOf(chunk) < 0) {
  21629. chunksToRequest.push(chunk);
  21630. }
  21631. }
  21632. }
  21633. chunksToRequest.sort(function (a, b) {
  21634. return a - b;
  21635. });
  21636. return this._requestChunks(chunksToRequest);
  21637. },
  21638. groupChunks: function ChunkedStreamManager_groupChunks(chunks) {
  21639. var groupedChunks = [];
  21640. var beginChunk = -1;
  21641. var prevChunk = -1;
  21642. for (var i = 0; i < chunks.length; ++i) {
  21643. var chunk = chunks[i];
  21644. if (beginChunk < 0) {
  21645. beginChunk = chunk;
  21646. }
  21647. if (prevChunk >= 0 && prevChunk + 1 !== chunk) {
  21648. groupedChunks.push({
  21649. beginChunk: beginChunk,
  21650. endChunk: prevChunk + 1
  21651. });
  21652. beginChunk = chunk;
  21653. }
  21654. if (i + 1 === chunks.length) {
  21655. groupedChunks.push({
  21656. beginChunk: beginChunk,
  21657. endChunk: chunk + 1
  21658. });
  21659. }
  21660. prevChunk = chunk;
  21661. }
  21662. return groupedChunks;
  21663. },
  21664. onProgress: function ChunkedStreamManager_onProgress(args) {
  21665. var bytesLoaded = this.stream.numChunksLoaded * this.chunkSize + args.loaded;
  21666. this.msgHandler.send('DocProgress', {
  21667. loaded: bytesLoaded,
  21668. total: this.length
  21669. });
  21670. },
  21671. onReceiveData: function ChunkedStreamManager_onReceiveData(args) {
  21672. var chunk = args.chunk;
  21673. var isProgressive = args.begin === undefined;
  21674. var begin = isProgressive ? this.progressiveDataLength : args.begin;
  21675. var end = begin + chunk.byteLength;
  21676. var beginChunk = Math.floor(begin / this.chunkSize);
  21677. var endChunk = end < this.length ? Math.floor(end / this.chunkSize) : Math.ceil(end / this.chunkSize);
  21678. if (isProgressive) {
  21679. this.stream.onReceiveProgressiveData(chunk);
  21680. this.progressiveDataLength = end;
  21681. } else {
  21682. this.stream.onReceiveData(begin, chunk);
  21683. }
  21684. if (this.stream.allChunksLoaded()) {
  21685. this._loadedStreamCapability.resolve(this.stream);
  21686. }
  21687. var loadedRequests = [];
  21688. var i, requestId;
  21689. for (chunk = beginChunk; chunk < endChunk; ++chunk) {
  21690. var requestIds = this.requestsByChunk[chunk] || [];
  21691. delete this.requestsByChunk[chunk];
  21692. for (i = 0; i < requestIds.length; ++i) {
  21693. requestId = requestIds[i];
  21694. var chunksNeeded = this.chunksNeededByRequest[requestId];
  21695. if (chunk in chunksNeeded) {
  21696. delete chunksNeeded[chunk];
  21697. }
  21698. if (!isEmptyObj(chunksNeeded)) {
  21699. continue;
  21700. }
  21701. loadedRequests.push(requestId);
  21702. }
  21703. }
  21704. if (!this.disableAutoFetch && isEmptyObj(this.requestsByChunk)) {
  21705. var nextEmptyChunk;
  21706. if (this.stream.numChunksLoaded === 1) {
  21707. var lastChunk = this.stream.numChunks - 1;
  21708. if (!this.stream.hasChunk(lastChunk)) {
  21709. nextEmptyChunk = lastChunk;
  21710. }
  21711. } else {
  21712. nextEmptyChunk = this.stream.nextEmptyChunk(endChunk);
  21713. }
  21714. if (isInt(nextEmptyChunk)) {
  21715. this._requestChunks([nextEmptyChunk]);
  21716. }
  21717. }
  21718. for (i = 0; i < loadedRequests.length; ++i) {
  21719. requestId = loadedRequests[i];
  21720. var capability = this.promisesByRequest[requestId];
  21721. delete this.promisesByRequest[requestId];
  21722. capability.resolve();
  21723. }
  21724. this.msgHandler.send('DocProgress', {
  21725. loaded: this.stream.numChunksLoaded * this.chunkSize,
  21726. total: this.length
  21727. });
  21728. },
  21729. onError: function ChunkedStreamManager_onError(err) {
  21730. this._loadedStreamCapability.reject(err);
  21731. },
  21732. getBeginChunk: function ChunkedStreamManager_getBeginChunk(begin) {
  21733. var chunk = Math.floor(begin / this.chunkSize);
  21734. return chunk;
  21735. },
  21736. getEndChunk: function ChunkedStreamManager_getEndChunk(end) {
  21737. var chunk = Math.floor((end - 1) / this.chunkSize) + 1;
  21738. return chunk;
  21739. },
  21740. abort: function ChunkedStreamManager_abort() {
  21741. this.aborted = true;
  21742. if (this.pdfNetworkStream) {
  21743. this.pdfNetworkStream.cancelAllRequests('abort');
  21744. }
  21745. for (var requestId in this.promisesByRequest) {
  21746. var capability = this.promisesByRequest[requestId];
  21747. capability.reject(new Error('Request was aborted'));
  21748. }
  21749. }
  21750. };
  21751. return ChunkedStreamManager;
  21752. }();
  21753. exports.ChunkedStream = ChunkedStream;
  21754. exports.ChunkedStreamManager = ChunkedStreamManager;
  21755. /***/ }),
  21756. /* 13 */
  21757. /***/ (function(module, exports, __w_pdfjs_require__) {
  21758. "use strict";
  21759. var sharedUtil = __w_pdfjs_require__(0);
  21760. var corePrimitives = __w_pdfjs_require__(1);
  21761. var coreStream = __w_pdfjs_require__(2);
  21762. var PasswordException = sharedUtil.PasswordException;
  21763. var PasswordResponses = sharedUtil.PasswordResponses;
  21764. var bytesToString = sharedUtil.bytesToString;
  21765. var warn = sharedUtil.warn;
  21766. var error = sharedUtil.error;
  21767. var assert = sharedUtil.assert;
  21768. var isInt = sharedUtil.isInt;
  21769. var stringToBytes = sharedUtil.stringToBytes;
  21770. var utf8StringToString = sharedUtil.utf8StringToString;
  21771. var Name = corePrimitives.Name;
  21772. var isName = corePrimitives.isName;
  21773. var isDict = corePrimitives.isDict;
  21774. var DecryptStream = coreStream.DecryptStream;
  21775. var ARCFourCipher = function ARCFourCipherClosure() {
  21776. function ARCFourCipher(key) {
  21777. this.a = 0;
  21778. this.b = 0;
  21779. var s = new Uint8Array(256);
  21780. var i, j = 0, tmp, keyLength = key.length;
  21781. for (i = 0; i < 256; ++i) {
  21782. s[i] = i;
  21783. }
  21784. for (i = 0; i < 256; ++i) {
  21785. tmp = s[i];
  21786. j = j + tmp + key[i % keyLength] & 0xFF;
  21787. s[i] = s[j];
  21788. s[j] = tmp;
  21789. }
  21790. this.s = s;
  21791. }
  21792. ARCFourCipher.prototype = {
  21793. encryptBlock: function ARCFourCipher_encryptBlock(data) {
  21794. var i, n = data.length, tmp, tmp2;
  21795. var a = this.a, b = this.b, s = this.s;
  21796. var output = new Uint8Array(n);
  21797. for (i = 0; i < n; ++i) {
  21798. a = a + 1 & 0xFF;
  21799. tmp = s[a];
  21800. b = b + tmp & 0xFF;
  21801. tmp2 = s[b];
  21802. s[a] = tmp2;
  21803. s[b] = tmp;
  21804. output[i] = data[i] ^ s[tmp + tmp2 & 0xFF];
  21805. }
  21806. this.a = a;
  21807. this.b = b;
  21808. return output;
  21809. }
  21810. };
  21811. ARCFourCipher.prototype.decryptBlock = ARCFourCipher.prototype.encryptBlock;
  21812. return ARCFourCipher;
  21813. }();
  21814. var calculateMD5 = function calculateMD5Closure() {
  21815. var r = new Uint8Array([
  21816. 7,
  21817. 12,
  21818. 17,
  21819. 22,
  21820. 7,
  21821. 12,
  21822. 17,
  21823. 22,
  21824. 7,
  21825. 12,
  21826. 17,
  21827. 22,
  21828. 7,
  21829. 12,
  21830. 17,
  21831. 22,
  21832. 5,
  21833. 9,
  21834. 14,
  21835. 20,
  21836. 5,
  21837. 9,
  21838. 14,
  21839. 20,
  21840. 5,
  21841. 9,
  21842. 14,
  21843. 20,
  21844. 5,
  21845. 9,
  21846. 14,
  21847. 20,
  21848. 4,
  21849. 11,
  21850. 16,
  21851. 23,
  21852. 4,
  21853. 11,
  21854. 16,
  21855. 23,
  21856. 4,
  21857. 11,
  21858. 16,
  21859. 23,
  21860. 4,
  21861. 11,
  21862. 16,
  21863. 23,
  21864. 6,
  21865. 10,
  21866. 15,
  21867. 21,
  21868. 6,
  21869. 10,
  21870. 15,
  21871. 21,
  21872. 6,
  21873. 10,
  21874. 15,
  21875. 21,
  21876. 6,
  21877. 10,
  21878. 15,
  21879. 21
  21880. ]);
  21881. var k = new Int32Array([
  21882. -680876936,
  21883. -389564586,
  21884. 606105819,
  21885. -1044525330,
  21886. -176418897,
  21887. 1200080426,
  21888. -1473231341,
  21889. -45705983,
  21890. 1770035416,
  21891. -1958414417,
  21892. -42063,
  21893. -1990404162,
  21894. 1804603682,
  21895. -40341101,
  21896. -1502002290,
  21897. 1236535329,
  21898. -165796510,
  21899. -1069501632,
  21900. 643717713,
  21901. -373897302,
  21902. -701558691,
  21903. 38016083,
  21904. -660478335,
  21905. -405537848,
  21906. 568446438,
  21907. -1019803690,
  21908. -187363961,
  21909. 1163531501,
  21910. -1444681467,
  21911. -51403784,
  21912. 1735328473,
  21913. -1926607734,
  21914. -378558,
  21915. -2022574463,
  21916. 1839030562,
  21917. -35309556,
  21918. -1530992060,
  21919. 1272893353,
  21920. -155497632,
  21921. -1094730640,
  21922. 681279174,
  21923. -358537222,
  21924. -722521979,
  21925. 76029189,
  21926. -640364487,
  21927. -421815835,
  21928. 530742520,
  21929. -995338651,
  21930. -198630844,
  21931. 1126891415,
  21932. -1416354905,
  21933. -57434055,
  21934. 1700485571,
  21935. -1894986606,
  21936. -1051523,
  21937. -2054922799,
  21938. 1873313359,
  21939. -30611744,
  21940. -1560198380,
  21941. 1309151649,
  21942. -145523070,
  21943. -1120210379,
  21944. 718787259,
  21945. -343485551
  21946. ]);
  21947. function hash(data, offset, length) {
  21948. var h0 = 1732584193, h1 = -271733879, h2 = -1732584194, h3 = 271733878;
  21949. var paddedLength = length + 72 & ~63;
  21950. var padded = new Uint8Array(paddedLength);
  21951. var i, j, n;
  21952. for (i = 0; i < length; ++i) {
  21953. padded[i] = data[offset++];
  21954. }
  21955. padded[i++] = 0x80;
  21956. n = paddedLength - 8;
  21957. while (i < n) {
  21958. padded[i++] = 0;
  21959. }
  21960. padded[i++] = length << 3 & 0xFF;
  21961. padded[i++] = length >> 5 & 0xFF;
  21962. padded[i++] = length >> 13 & 0xFF;
  21963. padded[i++] = length >> 21 & 0xFF;
  21964. padded[i++] = length >>> 29 & 0xFF;
  21965. padded[i++] = 0;
  21966. padded[i++] = 0;
  21967. padded[i++] = 0;
  21968. var w = new Int32Array(16);
  21969. for (i = 0; i < paddedLength;) {
  21970. for (j = 0; j < 16; ++j, i += 4) {
  21971. w[j] = padded[i] | padded[i + 1] << 8 | padded[i + 2] << 16 | padded[i + 3] << 24;
  21972. }
  21973. var a = h0, b = h1, c = h2, d = h3, f, g;
  21974. for (j = 0; j < 64; ++j) {
  21975. if (j < 16) {
  21976. f = b & c | ~b & d;
  21977. g = j;
  21978. } else if (j < 32) {
  21979. f = d & b | ~d & c;
  21980. g = 5 * j + 1 & 15;
  21981. } else if (j < 48) {
  21982. f = b ^ c ^ d;
  21983. g = 3 * j + 5 & 15;
  21984. } else {
  21985. f = c ^ (b | ~d);
  21986. g = 7 * j & 15;
  21987. }
  21988. var tmp = d, rotateArg = a + f + k[j] + w[g] | 0, rotate = r[j];
  21989. d = c;
  21990. c = b;
  21991. b = b + (rotateArg << rotate | rotateArg >>> 32 - rotate) | 0;
  21992. a = tmp;
  21993. }
  21994. h0 = h0 + a | 0;
  21995. h1 = h1 + b | 0;
  21996. h2 = h2 + c | 0;
  21997. h3 = h3 + d | 0;
  21998. }
  21999. return new Uint8Array([
  22000. h0 & 0xFF,
  22001. h0 >> 8 & 0xFF,
  22002. h0 >> 16 & 0xFF,
  22003. h0 >>> 24 & 0xFF,
  22004. h1 & 0xFF,
  22005. h1 >> 8 & 0xFF,
  22006. h1 >> 16 & 0xFF,
  22007. h1 >>> 24 & 0xFF,
  22008. h2 & 0xFF,
  22009. h2 >> 8 & 0xFF,
  22010. h2 >> 16 & 0xFF,
  22011. h2 >>> 24 & 0xFF,
  22012. h3 & 0xFF,
  22013. h3 >> 8 & 0xFF,
  22014. h3 >> 16 & 0xFF,
  22015. h3 >>> 24 & 0xFF
  22016. ]);
  22017. }
  22018. return hash;
  22019. }();
  22020. var Word64 = function Word64Closure() {
  22021. function Word64(highInteger, lowInteger) {
  22022. this.high = highInteger | 0;
  22023. this.low = lowInteger | 0;
  22024. }
  22025. Word64.prototype = {
  22026. and: function Word64_and(word) {
  22027. this.high &= word.high;
  22028. this.low &= word.low;
  22029. },
  22030. xor: function Word64_xor(word) {
  22031. this.high ^= word.high;
  22032. this.low ^= word.low;
  22033. },
  22034. or: function Word64_or(word) {
  22035. this.high |= word.high;
  22036. this.low |= word.low;
  22037. },
  22038. shiftRight: function Word64_shiftRight(places) {
  22039. if (places >= 32) {
  22040. this.low = this.high >>> places - 32 | 0;
  22041. this.high = 0;
  22042. } else {
  22043. this.low = this.low >>> places | this.high << 32 - places;
  22044. this.high = this.high >>> places | 0;
  22045. }
  22046. },
  22047. shiftLeft: function Word64_shiftLeft(places) {
  22048. if (places >= 32) {
  22049. this.high = this.low << places - 32;
  22050. this.low = 0;
  22051. } else {
  22052. this.high = this.high << places | this.low >>> 32 - places;
  22053. this.low = this.low << places;
  22054. }
  22055. },
  22056. rotateRight: function Word64_rotateRight(places) {
  22057. var low, high;
  22058. if (places & 32) {
  22059. high = this.low;
  22060. low = this.high;
  22061. } else {
  22062. low = this.low;
  22063. high = this.high;
  22064. }
  22065. places &= 31;
  22066. this.low = low >>> places | high << 32 - places;
  22067. this.high = high >>> places | low << 32 - places;
  22068. },
  22069. not: function Word64_not() {
  22070. this.high = ~this.high;
  22071. this.low = ~this.low;
  22072. },
  22073. add: function Word64_add(word) {
  22074. var lowAdd = (this.low >>> 0) + (word.low >>> 0);
  22075. var highAdd = (this.high >>> 0) + (word.high >>> 0);
  22076. if (lowAdd > 0xFFFFFFFF) {
  22077. highAdd += 1;
  22078. }
  22079. this.low = lowAdd | 0;
  22080. this.high = highAdd | 0;
  22081. },
  22082. copyTo: function Word64_copyTo(bytes, offset) {
  22083. bytes[offset] = this.high >>> 24 & 0xFF;
  22084. bytes[offset + 1] = this.high >> 16 & 0xFF;
  22085. bytes[offset + 2] = this.high >> 8 & 0xFF;
  22086. bytes[offset + 3] = this.high & 0xFF;
  22087. bytes[offset + 4] = this.low >>> 24 & 0xFF;
  22088. bytes[offset + 5] = this.low >> 16 & 0xFF;
  22089. bytes[offset + 6] = this.low >> 8 & 0xFF;
  22090. bytes[offset + 7] = this.low & 0xFF;
  22091. },
  22092. assign: function Word64_assign(word) {
  22093. this.high = word.high;
  22094. this.low = word.low;
  22095. }
  22096. };
  22097. return Word64;
  22098. }();
  22099. var calculateSHA256 = function calculateSHA256Closure() {
  22100. function rotr(x, n) {
  22101. return x >>> n | x << 32 - n;
  22102. }
  22103. function ch(x, y, z) {
  22104. return x & y ^ ~x & z;
  22105. }
  22106. function maj(x, y, z) {
  22107. return x & y ^ x & z ^ y & z;
  22108. }
  22109. function sigma(x) {
  22110. return rotr(x, 2) ^ rotr(x, 13) ^ rotr(x, 22);
  22111. }
  22112. function sigmaPrime(x) {
  22113. return rotr(x, 6) ^ rotr(x, 11) ^ rotr(x, 25);
  22114. }
  22115. function littleSigma(x) {
  22116. return rotr(x, 7) ^ rotr(x, 18) ^ x >>> 3;
  22117. }
  22118. function littleSigmaPrime(x) {
  22119. return rotr(x, 17) ^ rotr(x, 19) ^ x >>> 10;
  22120. }
  22121. var k = [
  22122. 0x428a2f98,
  22123. 0x71374491,
  22124. 0xb5c0fbcf,
  22125. 0xe9b5dba5,
  22126. 0x3956c25b,
  22127. 0x59f111f1,
  22128. 0x923f82a4,
  22129. 0xab1c5ed5,
  22130. 0xd807aa98,
  22131. 0x12835b01,
  22132. 0x243185be,
  22133. 0x550c7dc3,
  22134. 0x72be5d74,
  22135. 0x80deb1fe,
  22136. 0x9bdc06a7,
  22137. 0xc19bf174,
  22138. 0xe49b69c1,
  22139. 0xefbe4786,
  22140. 0x0fc19dc6,
  22141. 0x240ca1cc,
  22142. 0x2de92c6f,
  22143. 0x4a7484aa,
  22144. 0x5cb0a9dc,
  22145. 0x76f988da,
  22146. 0x983e5152,
  22147. 0xa831c66d,
  22148. 0xb00327c8,
  22149. 0xbf597fc7,
  22150. 0xc6e00bf3,
  22151. 0xd5a79147,
  22152. 0x06ca6351,
  22153. 0x14292967,
  22154. 0x27b70a85,
  22155. 0x2e1b2138,
  22156. 0x4d2c6dfc,
  22157. 0x53380d13,
  22158. 0x650a7354,
  22159. 0x766a0abb,
  22160. 0x81c2c92e,
  22161. 0x92722c85,
  22162. 0xa2bfe8a1,
  22163. 0xa81a664b,
  22164. 0xc24b8b70,
  22165. 0xc76c51a3,
  22166. 0xd192e819,
  22167. 0xd6990624,
  22168. 0xf40e3585,
  22169. 0x106aa070,
  22170. 0x19a4c116,
  22171. 0x1e376c08,
  22172. 0x2748774c,
  22173. 0x34b0bcb5,
  22174. 0x391c0cb3,
  22175. 0x4ed8aa4a,
  22176. 0x5b9cca4f,
  22177. 0x682e6ff3,
  22178. 0x748f82ee,
  22179. 0x78a5636f,
  22180. 0x84c87814,
  22181. 0x8cc70208,
  22182. 0x90befffa,
  22183. 0xa4506ceb,
  22184. 0xbef9a3f7,
  22185. 0xc67178f2
  22186. ];
  22187. function hash(data, offset, length) {
  22188. var h0 = 0x6a09e667, h1 = 0xbb67ae85, h2 = 0x3c6ef372, h3 = 0xa54ff53a, h4 = 0x510e527f, h5 = 0x9b05688c, h6 = 0x1f83d9ab, h7 = 0x5be0cd19;
  22189. var paddedLength = Math.ceil((length + 9) / 64) * 64;
  22190. var padded = new Uint8Array(paddedLength);
  22191. var i, j, n;
  22192. for (i = 0; i < length; ++i) {
  22193. padded[i] = data[offset++];
  22194. }
  22195. padded[i++] = 0x80;
  22196. n = paddedLength - 8;
  22197. while (i < n) {
  22198. padded[i++] = 0;
  22199. }
  22200. padded[i++] = 0;
  22201. padded[i++] = 0;
  22202. padded[i++] = 0;
  22203. padded[i++] = length >>> 29 & 0xFF;
  22204. padded[i++] = length >> 21 & 0xFF;
  22205. padded[i++] = length >> 13 & 0xFF;
  22206. padded[i++] = length >> 5 & 0xFF;
  22207. padded[i++] = length << 3 & 0xFF;
  22208. var w = new Uint32Array(64);
  22209. for (i = 0; i < paddedLength;) {
  22210. for (j = 0; j < 16; ++j) {
  22211. w[j] = padded[i] << 24 | padded[i + 1] << 16 | padded[i + 2] << 8 | padded[i + 3];
  22212. i += 4;
  22213. }
  22214. for (j = 16; j < 64; ++j) {
  22215. w[j] = littleSigmaPrime(w[j - 2]) + w[j - 7] + littleSigma(w[j - 15]) + w[j - 16] | 0;
  22216. }
  22217. var a = h0, b = h1, c = h2, d = h3, e = h4, f = h5, g = h6, h = h7, t1, t2;
  22218. for (j = 0; j < 64; ++j) {
  22219. t1 = h + sigmaPrime(e) + ch(e, f, g) + k[j] + w[j];
  22220. t2 = sigma(a) + maj(a, b, c);
  22221. h = g;
  22222. g = f;
  22223. f = e;
  22224. e = d + t1 | 0;
  22225. d = c;
  22226. c = b;
  22227. b = a;
  22228. a = t1 + t2 | 0;
  22229. }
  22230. h0 = h0 + a | 0;
  22231. h1 = h1 + b | 0;
  22232. h2 = h2 + c | 0;
  22233. h3 = h3 + d | 0;
  22234. h4 = h4 + e | 0;
  22235. h5 = h5 + f | 0;
  22236. h6 = h6 + g | 0;
  22237. h7 = h7 + h | 0;
  22238. }
  22239. return new Uint8Array([
  22240. h0 >> 24 & 0xFF,
  22241. h0 >> 16 & 0xFF,
  22242. h0 >> 8 & 0xFF,
  22243. h0 & 0xFF,
  22244. h1 >> 24 & 0xFF,
  22245. h1 >> 16 & 0xFF,
  22246. h1 >> 8 & 0xFF,
  22247. h1 & 0xFF,
  22248. h2 >> 24 & 0xFF,
  22249. h2 >> 16 & 0xFF,
  22250. h2 >> 8 & 0xFF,
  22251. h2 & 0xFF,
  22252. h3 >> 24 & 0xFF,
  22253. h3 >> 16 & 0xFF,
  22254. h3 >> 8 & 0xFF,
  22255. h3 & 0xFF,
  22256. h4 >> 24 & 0xFF,
  22257. h4 >> 16 & 0xFF,
  22258. h4 >> 8 & 0xFF,
  22259. h4 & 0xFF,
  22260. h5 >> 24 & 0xFF,
  22261. h5 >> 16 & 0xFF,
  22262. h5 >> 8 & 0xFF,
  22263. h5 & 0xFF,
  22264. h6 >> 24 & 0xFF,
  22265. h6 >> 16 & 0xFF,
  22266. h6 >> 8 & 0xFF,
  22267. h6 & 0xFF,
  22268. h7 >> 24 & 0xFF,
  22269. h7 >> 16 & 0xFF,
  22270. h7 >> 8 & 0xFF,
  22271. h7 & 0xFF
  22272. ]);
  22273. }
  22274. return hash;
  22275. }();
  22276. var calculateSHA512 = function calculateSHA512Closure() {
  22277. function ch(result, x, y, z, tmp) {
  22278. result.assign(x);
  22279. result.and(y);
  22280. tmp.assign(x);
  22281. tmp.not();
  22282. tmp.and(z);
  22283. result.xor(tmp);
  22284. }
  22285. function maj(result, x, y, z, tmp) {
  22286. result.assign(x);
  22287. result.and(y);
  22288. tmp.assign(x);
  22289. tmp.and(z);
  22290. result.xor(tmp);
  22291. tmp.assign(y);
  22292. tmp.and(z);
  22293. result.xor(tmp);
  22294. }
  22295. function sigma(result, x, tmp) {
  22296. result.assign(x);
  22297. result.rotateRight(28);
  22298. tmp.assign(x);
  22299. tmp.rotateRight(34);
  22300. result.xor(tmp);
  22301. tmp.assign(x);
  22302. tmp.rotateRight(39);
  22303. result.xor(tmp);
  22304. }
  22305. function sigmaPrime(result, x, tmp) {
  22306. result.assign(x);
  22307. result.rotateRight(14);
  22308. tmp.assign(x);
  22309. tmp.rotateRight(18);
  22310. result.xor(tmp);
  22311. tmp.assign(x);
  22312. tmp.rotateRight(41);
  22313. result.xor(tmp);
  22314. }
  22315. function littleSigma(result, x, tmp) {
  22316. result.assign(x);
  22317. result.rotateRight(1);
  22318. tmp.assign(x);
  22319. tmp.rotateRight(8);
  22320. result.xor(tmp);
  22321. tmp.assign(x);
  22322. tmp.shiftRight(7);
  22323. result.xor(tmp);
  22324. }
  22325. function littleSigmaPrime(result, x, tmp) {
  22326. result.assign(x);
  22327. result.rotateRight(19);
  22328. tmp.assign(x);
  22329. tmp.rotateRight(61);
  22330. result.xor(tmp);
  22331. tmp.assign(x);
  22332. tmp.shiftRight(6);
  22333. result.xor(tmp);
  22334. }
  22335. var k = [
  22336. new Word64(0x428a2f98, 0xd728ae22),
  22337. new Word64(0x71374491, 0x23ef65cd),
  22338. new Word64(0xb5c0fbcf, 0xec4d3b2f),
  22339. new Word64(0xe9b5dba5, 0x8189dbbc),
  22340. new Word64(0x3956c25b, 0xf348b538),
  22341. new Word64(0x59f111f1, 0xb605d019),
  22342. new Word64(0x923f82a4, 0xaf194f9b),
  22343. new Word64(0xab1c5ed5, 0xda6d8118),
  22344. new Word64(0xd807aa98, 0xa3030242),
  22345. new Word64(0x12835b01, 0x45706fbe),
  22346. new Word64(0x243185be, 0x4ee4b28c),
  22347. new Word64(0x550c7dc3, 0xd5ffb4e2),
  22348. new Word64(0x72be5d74, 0xf27b896f),
  22349. new Word64(0x80deb1fe, 0x3b1696b1),
  22350. new Word64(0x9bdc06a7, 0x25c71235),
  22351. new Word64(0xc19bf174, 0xcf692694),
  22352. new Word64(0xe49b69c1, 0x9ef14ad2),
  22353. new Word64(0xefbe4786, 0x384f25e3),
  22354. new Word64(0x0fc19dc6, 0x8b8cd5b5),
  22355. new Word64(0x240ca1cc, 0x77ac9c65),
  22356. new Word64(0x2de92c6f, 0x592b0275),
  22357. new Word64(0x4a7484aa, 0x6ea6e483),
  22358. new Word64(0x5cb0a9dc, 0xbd41fbd4),
  22359. new Word64(0x76f988da, 0x831153b5),
  22360. new Word64(0x983e5152, 0xee66dfab),
  22361. new Word64(0xa831c66d, 0x2db43210),
  22362. new Word64(0xb00327c8, 0x98fb213f),
  22363. new Word64(0xbf597fc7, 0xbeef0ee4),
  22364. new Word64(0xc6e00bf3, 0x3da88fc2),
  22365. new Word64(0xd5a79147, 0x930aa725),
  22366. new Word64(0x06ca6351, 0xe003826f),
  22367. new Word64(0x14292967, 0x0a0e6e70),
  22368. new Word64(0x27b70a85, 0x46d22ffc),
  22369. new Word64(0x2e1b2138, 0x5c26c926),
  22370. new Word64(0x4d2c6dfc, 0x5ac42aed),
  22371. new Word64(0x53380d13, 0x9d95b3df),
  22372. new Word64(0x650a7354, 0x8baf63de),
  22373. new Word64(0x766a0abb, 0x3c77b2a8),
  22374. new Word64(0x81c2c92e, 0x47edaee6),
  22375. new Word64(0x92722c85, 0x1482353b),
  22376. new Word64(0xa2bfe8a1, 0x4cf10364),
  22377. new Word64(0xa81a664b, 0xbc423001),
  22378. new Word64(0xc24b8b70, 0xd0f89791),
  22379. new Word64(0xc76c51a3, 0x0654be30),
  22380. new Word64(0xd192e819, 0xd6ef5218),
  22381. new Word64(0xd6990624, 0x5565a910),
  22382. new Word64(0xf40e3585, 0x5771202a),
  22383. new Word64(0x106aa070, 0x32bbd1b8),
  22384. new Word64(0x19a4c116, 0xb8d2d0c8),
  22385. new Word64(0x1e376c08, 0x5141ab53),
  22386. new Word64(0x2748774c, 0xdf8eeb99),
  22387. new Word64(0x34b0bcb5, 0xe19b48a8),
  22388. new Word64(0x391c0cb3, 0xc5c95a63),
  22389. new Word64(0x4ed8aa4a, 0xe3418acb),
  22390. new Word64(0x5b9cca4f, 0x7763e373),
  22391. new Word64(0x682e6ff3, 0xd6b2b8a3),
  22392. new Word64(0x748f82ee, 0x5defb2fc),
  22393. new Word64(0x78a5636f, 0x43172f60),
  22394. new Word64(0x84c87814, 0xa1f0ab72),
  22395. new Word64(0x8cc70208, 0x1a6439ec),
  22396. new Word64(0x90befffa, 0x23631e28),
  22397. new Word64(0xa4506ceb, 0xde82bde9),
  22398. new Word64(0xbef9a3f7, 0xb2c67915),
  22399. new Word64(0xc67178f2, 0xe372532b),
  22400. new Word64(0xca273ece, 0xea26619c),
  22401. new Word64(0xd186b8c7, 0x21c0c207),
  22402. new Word64(0xeada7dd6, 0xcde0eb1e),
  22403. new Word64(0xf57d4f7f, 0xee6ed178),
  22404. new Word64(0x06f067aa, 0x72176fba),
  22405. new Word64(0x0a637dc5, 0xa2c898a6),
  22406. new Word64(0x113f9804, 0xbef90dae),
  22407. new Word64(0x1b710b35, 0x131c471b),
  22408. new Word64(0x28db77f5, 0x23047d84),
  22409. new Word64(0x32caab7b, 0x40c72493),
  22410. new Word64(0x3c9ebe0a, 0x15c9bebc),
  22411. new Word64(0x431d67c4, 0x9c100d4c),
  22412. new Word64(0x4cc5d4be, 0xcb3e42b6),
  22413. new Word64(0x597f299c, 0xfc657e2a),
  22414. new Word64(0x5fcb6fab, 0x3ad6faec),
  22415. new Word64(0x6c44198c, 0x4a475817)
  22416. ];
  22417. function hash(data, offset, length, mode384) {
  22418. mode384 = !!mode384;
  22419. var h0, h1, h2, h3, h4, h5, h6, h7;
  22420. if (!mode384) {
  22421. h0 = new Word64(0x6a09e667, 0xf3bcc908);
  22422. h1 = new Word64(0xbb67ae85, 0x84caa73b);
  22423. h2 = new Word64(0x3c6ef372, 0xfe94f82b);
  22424. h3 = new Word64(0xa54ff53a, 0x5f1d36f1);
  22425. h4 = new Word64(0x510e527f, 0xade682d1);
  22426. h5 = new Word64(0x9b05688c, 0x2b3e6c1f);
  22427. h6 = new Word64(0x1f83d9ab, 0xfb41bd6b);
  22428. h7 = new Word64(0x5be0cd19, 0x137e2179);
  22429. } else {
  22430. h0 = new Word64(0xcbbb9d5d, 0xc1059ed8);
  22431. h1 = new Word64(0x629a292a, 0x367cd507);
  22432. h2 = new Word64(0x9159015a, 0x3070dd17);
  22433. h3 = new Word64(0x152fecd8, 0xf70e5939);
  22434. h4 = new Word64(0x67332667, 0xffc00b31);
  22435. h5 = new Word64(0x8eb44a87, 0x68581511);
  22436. h6 = new Word64(0xdb0c2e0d, 0x64f98fa7);
  22437. h7 = new Word64(0x47b5481d, 0xbefa4fa4);
  22438. }
  22439. var paddedLength = Math.ceil((length + 17) / 128) * 128;
  22440. var padded = new Uint8Array(paddedLength);
  22441. var i, j, n;
  22442. for (i = 0; i < length; ++i) {
  22443. padded[i] = data[offset++];
  22444. }
  22445. padded[i++] = 0x80;
  22446. n = paddedLength - 16;
  22447. while (i < n) {
  22448. padded[i++] = 0;
  22449. }
  22450. padded[i++] = 0;
  22451. padded[i++] = 0;
  22452. padded[i++] = 0;
  22453. padded[i++] = 0;
  22454. padded[i++] = 0;
  22455. padded[i++] = 0;
  22456. padded[i++] = 0;
  22457. padded[i++] = 0;
  22458. padded[i++] = 0;
  22459. padded[i++] = 0;
  22460. padded[i++] = 0;
  22461. padded[i++] = length >>> 29 & 0xFF;
  22462. padded[i++] = length >> 21 & 0xFF;
  22463. padded[i++] = length >> 13 & 0xFF;
  22464. padded[i++] = length >> 5 & 0xFF;
  22465. padded[i++] = length << 3 & 0xFF;
  22466. var w = new Array(80);
  22467. for (i = 0; i < 80; i++) {
  22468. w[i] = new Word64(0, 0);
  22469. }
  22470. var a = new Word64(0, 0), b = new Word64(0, 0), c = new Word64(0, 0);
  22471. var d = new Word64(0, 0), e = new Word64(0, 0), f = new Word64(0, 0);
  22472. var g = new Word64(0, 0), h = new Word64(0, 0);
  22473. var t1 = new Word64(0, 0), t2 = new Word64(0, 0);
  22474. var tmp1 = new Word64(0, 0), tmp2 = new Word64(0, 0), tmp3;
  22475. for (i = 0; i < paddedLength;) {
  22476. for (j = 0; j < 16; ++j) {
  22477. w[j].high = padded[i] << 24 | padded[i + 1] << 16 | padded[i + 2] << 8 | padded[i + 3];
  22478. w[j].low = padded[i + 4] << 24 | padded[i + 5] << 16 | padded[i + 6] << 8 | padded[i + 7];
  22479. i += 8;
  22480. }
  22481. for (j = 16; j < 80; ++j) {
  22482. tmp3 = w[j];
  22483. littleSigmaPrime(tmp3, w[j - 2], tmp2);
  22484. tmp3.add(w[j - 7]);
  22485. littleSigma(tmp1, w[j - 15], tmp2);
  22486. tmp3.add(tmp1);
  22487. tmp3.add(w[j - 16]);
  22488. }
  22489. a.assign(h0);
  22490. b.assign(h1);
  22491. c.assign(h2);
  22492. d.assign(h3);
  22493. e.assign(h4);
  22494. f.assign(h5);
  22495. g.assign(h6);
  22496. h.assign(h7);
  22497. for (j = 0; j < 80; ++j) {
  22498. t1.assign(h);
  22499. sigmaPrime(tmp1, e, tmp2);
  22500. t1.add(tmp1);
  22501. ch(tmp1, e, f, g, tmp2);
  22502. t1.add(tmp1);
  22503. t1.add(k[j]);
  22504. t1.add(w[j]);
  22505. sigma(t2, a, tmp2);
  22506. maj(tmp1, a, b, c, tmp2);
  22507. t2.add(tmp1);
  22508. tmp3 = h;
  22509. h = g;
  22510. g = f;
  22511. f = e;
  22512. d.add(t1);
  22513. e = d;
  22514. d = c;
  22515. c = b;
  22516. b = a;
  22517. tmp3.assign(t1);
  22518. tmp3.add(t2);
  22519. a = tmp3;
  22520. }
  22521. h0.add(a);
  22522. h1.add(b);
  22523. h2.add(c);
  22524. h3.add(d);
  22525. h4.add(e);
  22526. h5.add(f);
  22527. h6.add(g);
  22528. h7.add(h);
  22529. }
  22530. var result;
  22531. if (!mode384) {
  22532. result = new Uint8Array(64);
  22533. h0.copyTo(result, 0);
  22534. h1.copyTo(result, 8);
  22535. h2.copyTo(result, 16);
  22536. h3.copyTo(result, 24);
  22537. h4.copyTo(result, 32);
  22538. h5.copyTo(result, 40);
  22539. h6.copyTo(result, 48);
  22540. h7.copyTo(result, 56);
  22541. } else {
  22542. result = new Uint8Array(48);
  22543. h0.copyTo(result, 0);
  22544. h1.copyTo(result, 8);
  22545. h2.copyTo(result, 16);
  22546. h3.copyTo(result, 24);
  22547. h4.copyTo(result, 32);
  22548. h5.copyTo(result, 40);
  22549. }
  22550. return result;
  22551. }
  22552. return hash;
  22553. }();
  22554. var calculateSHA384 = function calculateSHA384Closure() {
  22555. function hash(data, offset, length) {
  22556. return calculateSHA512(data, offset, length, true);
  22557. }
  22558. return hash;
  22559. }();
  22560. var NullCipher = function NullCipherClosure() {
  22561. function NullCipher() {
  22562. }
  22563. NullCipher.prototype = {
  22564. decryptBlock: function NullCipher_decryptBlock(data) {
  22565. return data;
  22566. }
  22567. };
  22568. return NullCipher;
  22569. }();
  22570. var AES128Cipher = function AES128CipherClosure() {
  22571. var rcon = new Uint8Array([
  22572. 0x8d,
  22573. 0x01,
  22574. 0x02,
  22575. 0x04,
  22576. 0x08,
  22577. 0x10,
  22578. 0x20,
  22579. 0x40,
  22580. 0x80,
  22581. 0x1b,
  22582. 0x36,
  22583. 0x6c,
  22584. 0xd8,
  22585. 0xab,
  22586. 0x4d,
  22587. 0x9a,
  22588. 0x2f,
  22589. 0x5e,
  22590. 0xbc,
  22591. 0x63,
  22592. 0xc6,
  22593. 0x97,
  22594. 0x35,
  22595. 0x6a,
  22596. 0xd4,
  22597. 0xb3,
  22598. 0x7d,
  22599. 0xfa,
  22600. 0xef,
  22601. 0xc5,
  22602. 0x91,
  22603. 0x39,
  22604. 0x72,
  22605. 0xe4,
  22606. 0xd3,
  22607. 0xbd,
  22608. 0x61,
  22609. 0xc2,
  22610. 0x9f,
  22611. 0x25,
  22612. 0x4a,
  22613. 0x94,
  22614. 0x33,
  22615. 0x66,
  22616. 0xcc,
  22617. 0x83,
  22618. 0x1d,
  22619. 0x3a,
  22620. 0x74,
  22621. 0xe8,
  22622. 0xcb,
  22623. 0x8d,
  22624. 0x01,
  22625. 0x02,
  22626. 0x04,
  22627. 0x08,
  22628. 0x10,
  22629. 0x20,
  22630. 0x40,
  22631. 0x80,
  22632. 0x1b,
  22633. 0x36,
  22634. 0x6c,
  22635. 0xd8,
  22636. 0xab,
  22637. 0x4d,
  22638. 0x9a,
  22639. 0x2f,
  22640. 0x5e,
  22641. 0xbc,
  22642. 0x63,
  22643. 0xc6,
  22644. 0x97,
  22645. 0x35,
  22646. 0x6a,
  22647. 0xd4,
  22648. 0xb3,
  22649. 0x7d,
  22650. 0xfa,
  22651. 0xef,
  22652. 0xc5,
  22653. 0x91,
  22654. 0x39,
  22655. 0x72,
  22656. 0xe4,
  22657. 0xd3,
  22658. 0xbd,
  22659. 0x61,
  22660. 0xc2,
  22661. 0x9f,
  22662. 0x25,
  22663. 0x4a,
  22664. 0x94,
  22665. 0x33,
  22666. 0x66,
  22667. 0xcc,
  22668. 0x83,
  22669. 0x1d,
  22670. 0x3a,
  22671. 0x74,
  22672. 0xe8,
  22673. 0xcb,
  22674. 0x8d,
  22675. 0x01,
  22676. 0x02,
  22677. 0x04,
  22678. 0x08,
  22679. 0x10,
  22680. 0x20,
  22681. 0x40,
  22682. 0x80,
  22683. 0x1b,
  22684. 0x36,
  22685. 0x6c,
  22686. 0xd8,
  22687. 0xab,
  22688. 0x4d,
  22689. 0x9a,
  22690. 0x2f,
  22691. 0x5e,
  22692. 0xbc,
  22693. 0x63,
  22694. 0xc6,
  22695. 0x97,
  22696. 0x35,
  22697. 0x6a,
  22698. 0xd4,
  22699. 0xb3,
  22700. 0x7d,
  22701. 0xfa,
  22702. 0xef,
  22703. 0xc5,
  22704. 0x91,
  22705. 0x39,
  22706. 0x72,
  22707. 0xe4,
  22708. 0xd3,
  22709. 0xbd,
  22710. 0x61,
  22711. 0xc2,
  22712. 0x9f,
  22713. 0x25,
  22714. 0x4a,
  22715. 0x94,
  22716. 0x33,
  22717. 0x66,
  22718. 0xcc,
  22719. 0x83,
  22720. 0x1d,
  22721. 0x3a,
  22722. 0x74,
  22723. 0xe8,
  22724. 0xcb,
  22725. 0x8d,
  22726. 0x01,
  22727. 0x02,
  22728. 0x04,
  22729. 0x08,
  22730. 0x10,
  22731. 0x20,
  22732. 0x40,
  22733. 0x80,
  22734. 0x1b,
  22735. 0x36,
  22736. 0x6c,
  22737. 0xd8,
  22738. 0xab,
  22739. 0x4d,
  22740. 0x9a,
  22741. 0x2f,
  22742. 0x5e,
  22743. 0xbc,
  22744. 0x63,
  22745. 0xc6,
  22746. 0x97,
  22747. 0x35,
  22748. 0x6a,
  22749. 0xd4,
  22750. 0xb3,
  22751. 0x7d,
  22752. 0xfa,
  22753. 0xef,
  22754. 0xc5,
  22755. 0x91,
  22756. 0x39,
  22757. 0x72,
  22758. 0xe4,
  22759. 0xd3,
  22760. 0xbd,
  22761. 0x61,
  22762. 0xc2,
  22763. 0x9f,
  22764. 0x25,
  22765. 0x4a,
  22766. 0x94,
  22767. 0x33,
  22768. 0x66,
  22769. 0xcc,
  22770. 0x83,
  22771. 0x1d,
  22772. 0x3a,
  22773. 0x74,
  22774. 0xe8,
  22775. 0xcb,
  22776. 0x8d,
  22777. 0x01,
  22778. 0x02,
  22779. 0x04,
  22780. 0x08,
  22781. 0x10,
  22782. 0x20,
  22783. 0x40,
  22784. 0x80,
  22785. 0x1b,
  22786. 0x36,
  22787. 0x6c,
  22788. 0xd8,
  22789. 0xab,
  22790. 0x4d,
  22791. 0x9a,
  22792. 0x2f,
  22793. 0x5e,
  22794. 0xbc,
  22795. 0x63,
  22796. 0xc6,
  22797. 0x97,
  22798. 0x35,
  22799. 0x6a,
  22800. 0xd4,
  22801. 0xb3,
  22802. 0x7d,
  22803. 0xfa,
  22804. 0xef,
  22805. 0xc5,
  22806. 0x91,
  22807. 0x39,
  22808. 0x72,
  22809. 0xe4,
  22810. 0xd3,
  22811. 0xbd,
  22812. 0x61,
  22813. 0xc2,
  22814. 0x9f,
  22815. 0x25,
  22816. 0x4a,
  22817. 0x94,
  22818. 0x33,
  22819. 0x66,
  22820. 0xcc,
  22821. 0x83,
  22822. 0x1d,
  22823. 0x3a,
  22824. 0x74,
  22825. 0xe8,
  22826. 0xcb,
  22827. 0x8d
  22828. ]);
  22829. var s = new Uint8Array([
  22830. 0x63,
  22831. 0x7c,
  22832. 0x77,
  22833. 0x7b,
  22834. 0xf2,
  22835. 0x6b,
  22836. 0x6f,
  22837. 0xc5,
  22838. 0x30,
  22839. 0x01,
  22840. 0x67,
  22841. 0x2b,
  22842. 0xfe,
  22843. 0xd7,
  22844. 0xab,
  22845. 0x76,
  22846. 0xca,
  22847. 0x82,
  22848. 0xc9,
  22849. 0x7d,
  22850. 0xfa,
  22851. 0x59,
  22852. 0x47,
  22853. 0xf0,
  22854. 0xad,
  22855. 0xd4,
  22856. 0xa2,
  22857. 0xaf,
  22858. 0x9c,
  22859. 0xa4,
  22860. 0x72,
  22861. 0xc0,
  22862. 0xb7,
  22863. 0xfd,
  22864. 0x93,
  22865. 0x26,
  22866. 0x36,
  22867. 0x3f,
  22868. 0xf7,
  22869. 0xcc,
  22870. 0x34,
  22871. 0xa5,
  22872. 0xe5,
  22873. 0xf1,
  22874. 0x71,
  22875. 0xd8,
  22876. 0x31,
  22877. 0x15,
  22878. 0x04,
  22879. 0xc7,
  22880. 0x23,
  22881. 0xc3,
  22882. 0x18,
  22883. 0x96,
  22884. 0x05,
  22885. 0x9a,
  22886. 0x07,
  22887. 0x12,
  22888. 0x80,
  22889. 0xe2,
  22890. 0xeb,
  22891. 0x27,
  22892. 0xb2,
  22893. 0x75,
  22894. 0x09,
  22895. 0x83,
  22896. 0x2c,
  22897. 0x1a,
  22898. 0x1b,
  22899. 0x6e,
  22900. 0x5a,
  22901. 0xa0,
  22902. 0x52,
  22903. 0x3b,
  22904. 0xd6,
  22905. 0xb3,
  22906. 0x29,
  22907. 0xe3,
  22908. 0x2f,
  22909. 0x84,
  22910. 0x53,
  22911. 0xd1,
  22912. 0x00,
  22913. 0xed,
  22914. 0x20,
  22915. 0xfc,
  22916. 0xb1,
  22917. 0x5b,
  22918. 0x6a,
  22919. 0xcb,
  22920. 0xbe,
  22921. 0x39,
  22922. 0x4a,
  22923. 0x4c,
  22924. 0x58,
  22925. 0xcf,
  22926. 0xd0,
  22927. 0xef,
  22928. 0xaa,
  22929. 0xfb,
  22930. 0x43,
  22931. 0x4d,
  22932. 0x33,
  22933. 0x85,
  22934. 0x45,
  22935. 0xf9,
  22936. 0x02,
  22937. 0x7f,
  22938. 0x50,
  22939. 0x3c,
  22940. 0x9f,
  22941. 0xa8,
  22942. 0x51,
  22943. 0xa3,
  22944. 0x40,
  22945. 0x8f,
  22946. 0x92,
  22947. 0x9d,
  22948. 0x38,
  22949. 0xf5,
  22950. 0xbc,
  22951. 0xb6,
  22952. 0xda,
  22953. 0x21,
  22954. 0x10,
  22955. 0xff,
  22956. 0xf3,
  22957. 0xd2,
  22958. 0xcd,
  22959. 0x0c,
  22960. 0x13,
  22961. 0xec,
  22962. 0x5f,
  22963. 0x97,
  22964. 0x44,
  22965. 0x17,
  22966. 0xc4,
  22967. 0xa7,
  22968. 0x7e,
  22969. 0x3d,
  22970. 0x64,
  22971. 0x5d,
  22972. 0x19,
  22973. 0x73,
  22974. 0x60,
  22975. 0x81,
  22976. 0x4f,
  22977. 0xdc,
  22978. 0x22,
  22979. 0x2a,
  22980. 0x90,
  22981. 0x88,
  22982. 0x46,
  22983. 0xee,
  22984. 0xb8,
  22985. 0x14,
  22986. 0xde,
  22987. 0x5e,
  22988. 0x0b,
  22989. 0xdb,
  22990. 0xe0,
  22991. 0x32,
  22992. 0x3a,
  22993. 0x0a,
  22994. 0x49,
  22995. 0x06,
  22996. 0x24,
  22997. 0x5c,
  22998. 0xc2,
  22999. 0xd3,
  23000. 0xac,
  23001. 0x62,
  23002. 0x91,
  23003. 0x95,
  23004. 0xe4,
  23005. 0x79,
  23006. 0xe7,
  23007. 0xc8,
  23008. 0x37,
  23009. 0x6d,
  23010. 0x8d,
  23011. 0xd5,
  23012. 0x4e,
  23013. 0xa9,
  23014. 0x6c,
  23015. 0x56,
  23016. 0xf4,
  23017. 0xea,
  23018. 0x65,
  23019. 0x7a,
  23020. 0xae,
  23021. 0x08,
  23022. 0xba,
  23023. 0x78,
  23024. 0x25,
  23025. 0x2e,
  23026. 0x1c,
  23027. 0xa6,
  23028. 0xb4,
  23029. 0xc6,
  23030. 0xe8,
  23031. 0xdd,
  23032. 0x74,
  23033. 0x1f,
  23034. 0x4b,
  23035. 0xbd,
  23036. 0x8b,
  23037. 0x8a,
  23038. 0x70,
  23039. 0x3e,
  23040. 0xb5,
  23041. 0x66,
  23042. 0x48,
  23043. 0x03,
  23044. 0xf6,
  23045. 0x0e,
  23046. 0x61,
  23047. 0x35,
  23048. 0x57,
  23049. 0xb9,
  23050. 0x86,
  23051. 0xc1,
  23052. 0x1d,
  23053. 0x9e,
  23054. 0xe1,
  23055. 0xf8,
  23056. 0x98,
  23057. 0x11,
  23058. 0x69,
  23059. 0xd9,
  23060. 0x8e,
  23061. 0x94,
  23062. 0x9b,
  23063. 0x1e,
  23064. 0x87,
  23065. 0xe9,
  23066. 0xce,
  23067. 0x55,
  23068. 0x28,
  23069. 0xdf,
  23070. 0x8c,
  23071. 0xa1,
  23072. 0x89,
  23073. 0x0d,
  23074. 0xbf,
  23075. 0xe6,
  23076. 0x42,
  23077. 0x68,
  23078. 0x41,
  23079. 0x99,
  23080. 0x2d,
  23081. 0x0f,
  23082. 0xb0,
  23083. 0x54,
  23084. 0xbb,
  23085. 0x16
  23086. ]);
  23087. var inv_s = new Uint8Array([
  23088. 0x52,
  23089. 0x09,
  23090. 0x6a,
  23091. 0xd5,
  23092. 0x30,
  23093. 0x36,
  23094. 0xa5,
  23095. 0x38,
  23096. 0xbf,
  23097. 0x40,
  23098. 0xa3,
  23099. 0x9e,
  23100. 0x81,
  23101. 0xf3,
  23102. 0xd7,
  23103. 0xfb,
  23104. 0x7c,
  23105. 0xe3,
  23106. 0x39,
  23107. 0x82,
  23108. 0x9b,
  23109. 0x2f,
  23110. 0xff,
  23111. 0x87,
  23112. 0x34,
  23113. 0x8e,
  23114. 0x43,
  23115. 0x44,
  23116. 0xc4,
  23117. 0xde,
  23118. 0xe9,
  23119. 0xcb,
  23120. 0x54,
  23121. 0x7b,
  23122. 0x94,
  23123. 0x32,
  23124. 0xa6,
  23125. 0xc2,
  23126. 0x23,
  23127. 0x3d,
  23128. 0xee,
  23129. 0x4c,
  23130. 0x95,
  23131. 0x0b,
  23132. 0x42,
  23133. 0xfa,
  23134. 0xc3,
  23135. 0x4e,
  23136. 0x08,
  23137. 0x2e,
  23138. 0xa1,
  23139. 0x66,
  23140. 0x28,
  23141. 0xd9,
  23142. 0x24,
  23143. 0xb2,
  23144. 0x76,
  23145. 0x5b,
  23146. 0xa2,
  23147. 0x49,
  23148. 0x6d,
  23149. 0x8b,
  23150. 0xd1,
  23151. 0x25,
  23152. 0x72,
  23153. 0xf8,
  23154. 0xf6,
  23155. 0x64,
  23156. 0x86,
  23157. 0x68,
  23158. 0x98,
  23159. 0x16,
  23160. 0xd4,
  23161. 0xa4,
  23162. 0x5c,
  23163. 0xcc,
  23164. 0x5d,
  23165. 0x65,
  23166. 0xb6,
  23167. 0x92,
  23168. 0x6c,
  23169. 0x70,
  23170. 0x48,
  23171. 0x50,
  23172. 0xfd,
  23173. 0xed,
  23174. 0xb9,
  23175. 0xda,
  23176. 0x5e,
  23177. 0x15,
  23178. 0x46,
  23179. 0x57,
  23180. 0xa7,
  23181. 0x8d,
  23182. 0x9d,
  23183. 0x84,
  23184. 0x90,
  23185. 0xd8,
  23186. 0xab,
  23187. 0x00,
  23188. 0x8c,
  23189. 0xbc,
  23190. 0xd3,
  23191. 0x0a,
  23192. 0xf7,
  23193. 0xe4,
  23194. 0x58,
  23195. 0x05,
  23196. 0xb8,
  23197. 0xb3,
  23198. 0x45,
  23199. 0x06,
  23200. 0xd0,
  23201. 0x2c,
  23202. 0x1e,
  23203. 0x8f,
  23204. 0xca,
  23205. 0x3f,
  23206. 0x0f,
  23207. 0x02,
  23208. 0xc1,
  23209. 0xaf,
  23210. 0xbd,
  23211. 0x03,
  23212. 0x01,
  23213. 0x13,
  23214. 0x8a,
  23215. 0x6b,
  23216. 0x3a,
  23217. 0x91,
  23218. 0x11,
  23219. 0x41,
  23220. 0x4f,
  23221. 0x67,
  23222. 0xdc,
  23223. 0xea,
  23224. 0x97,
  23225. 0xf2,
  23226. 0xcf,
  23227. 0xce,
  23228. 0xf0,
  23229. 0xb4,
  23230. 0xe6,
  23231. 0x73,
  23232. 0x96,
  23233. 0xac,
  23234. 0x74,
  23235. 0x22,
  23236. 0xe7,
  23237. 0xad,
  23238. 0x35,
  23239. 0x85,
  23240. 0xe2,
  23241. 0xf9,
  23242. 0x37,
  23243. 0xe8,
  23244. 0x1c,
  23245. 0x75,
  23246. 0xdf,
  23247. 0x6e,
  23248. 0x47,
  23249. 0xf1,
  23250. 0x1a,
  23251. 0x71,
  23252. 0x1d,
  23253. 0x29,
  23254. 0xc5,
  23255. 0x89,
  23256. 0x6f,
  23257. 0xb7,
  23258. 0x62,
  23259. 0x0e,
  23260. 0xaa,
  23261. 0x18,
  23262. 0xbe,
  23263. 0x1b,
  23264. 0xfc,
  23265. 0x56,
  23266. 0x3e,
  23267. 0x4b,
  23268. 0xc6,
  23269. 0xd2,
  23270. 0x79,
  23271. 0x20,
  23272. 0x9a,
  23273. 0xdb,
  23274. 0xc0,
  23275. 0xfe,
  23276. 0x78,
  23277. 0xcd,
  23278. 0x5a,
  23279. 0xf4,
  23280. 0x1f,
  23281. 0xdd,
  23282. 0xa8,
  23283. 0x33,
  23284. 0x88,
  23285. 0x07,
  23286. 0xc7,
  23287. 0x31,
  23288. 0xb1,
  23289. 0x12,
  23290. 0x10,
  23291. 0x59,
  23292. 0x27,
  23293. 0x80,
  23294. 0xec,
  23295. 0x5f,
  23296. 0x60,
  23297. 0x51,
  23298. 0x7f,
  23299. 0xa9,
  23300. 0x19,
  23301. 0xb5,
  23302. 0x4a,
  23303. 0x0d,
  23304. 0x2d,
  23305. 0xe5,
  23306. 0x7a,
  23307. 0x9f,
  23308. 0x93,
  23309. 0xc9,
  23310. 0x9c,
  23311. 0xef,
  23312. 0xa0,
  23313. 0xe0,
  23314. 0x3b,
  23315. 0x4d,
  23316. 0xae,
  23317. 0x2a,
  23318. 0xf5,
  23319. 0xb0,
  23320. 0xc8,
  23321. 0xeb,
  23322. 0xbb,
  23323. 0x3c,
  23324. 0x83,
  23325. 0x53,
  23326. 0x99,
  23327. 0x61,
  23328. 0x17,
  23329. 0x2b,
  23330. 0x04,
  23331. 0x7e,
  23332. 0xba,
  23333. 0x77,
  23334. 0xd6,
  23335. 0x26,
  23336. 0xe1,
  23337. 0x69,
  23338. 0x14,
  23339. 0x63,
  23340. 0x55,
  23341. 0x21,
  23342. 0x0c,
  23343. 0x7d
  23344. ]);
  23345. var mixCol = new Uint8Array(256);
  23346. for (var i = 0; i < 256; i++) {
  23347. if (i < 128) {
  23348. mixCol[i] = i << 1;
  23349. } else {
  23350. mixCol[i] = i << 1 ^ 0x1b;
  23351. }
  23352. }
  23353. var mix = new Uint32Array([
  23354. 0x00000000,
  23355. 0x0e090d0b,
  23356. 0x1c121a16,
  23357. 0x121b171d,
  23358. 0x3824342c,
  23359. 0x362d3927,
  23360. 0x24362e3a,
  23361. 0x2a3f2331,
  23362. 0x70486858,
  23363. 0x7e416553,
  23364. 0x6c5a724e,
  23365. 0x62537f45,
  23366. 0x486c5c74,
  23367. 0x4665517f,
  23368. 0x547e4662,
  23369. 0x5a774b69,
  23370. 0xe090d0b0,
  23371. 0xee99ddbb,
  23372. 0xfc82caa6,
  23373. 0xf28bc7ad,
  23374. 0xd8b4e49c,
  23375. 0xd6bde997,
  23376. 0xc4a6fe8a,
  23377. 0xcaaff381,
  23378. 0x90d8b8e8,
  23379. 0x9ed1b5e3,
  23380. 0x8ccaa2fe,
  23381. 0x82c3aff5,
  23382. 0xa8fc8cc4,
  23383. 0xa6f581cf,
  23384. 0xb4ee96d2,
  23385. 0xbae79bd9,
  23386. 0xdb3bbb7b,
  23387. 0xd532b670,
  23388. 0xc729a16d,
  23389. 0xc920ac66,
  23390. 0xe31f8f57,
  23391. 0xed16825c,
  23392. 0xff0d9541,
  23393. 0xf104984a,
  23394. 0xab73d323,
  23395. 0xa57ade28,
  23396. 0xb761c935,
  23397. 0xb968c43e,
  23398. 0x9357e70f,
  23399. 0x9d5eea04,
  23400. 0x8f45fd19,
  23401. 0x814cf012,
  23402. 0x3bab6bcb,
  23403. 0x35a266c0,
  23404. 0x27b971dd,
  23405. 0x29b07cd6,
  23406. 0x038f5fe7,
  23407. 0x0d8652ec,
  23408. 0x1f9d45f1,
  23409. 0x119448fa,
  23410. 0x4be30393,
  23411. 0x45ea0e98,
  23412. 0x57f11985,
  23413. 0x59f8148e,
  23414. 0x73c737bf,
  23415. 0x7dce3ab4,
  23416. 0x6fd52da9,
  23417. 0x61dc20a2,
  23418. 0xad766df6,
  23419. 0xa37f60fd,
  23420. 0xb16477e0,
  23421. 0xbf6d7aeb,
  23422. 0x955259da,
  23423. 0x9b5b54d1,
  23424. 0x894043cc,
  23425. 0x87494ec7,
  23426. 0xdd3e05ae,
  23427. 0xd33708a5,
  23428. 0xc12c1fb8,
  23429. 0xcf2512b3,
  23430. 0xe51a3182,
  23431. 0xeb133c89,
  23432. 0xf9082b94,
  23433. 0xf701269f,
  23434. 0x4de6bd46,
  23435. 0x43efb04d,
  23436. 0x51f4a750,
  23437. 0x5ffdaa5b,
  23438. 0x75c2896a,
  23439. 0x7bcb8461,
  23440. 0x69d0937c,
  23441. 0x67d99e77,
  23442. 0x3daed51e,
  23443. 0x33a7d815,
  23444. 0x21bccf08,
  23445. 0x2fb5c203,
  23446. 0x058ae132,
  23447. 0x0b83ec39,
  23448. 0x1998fb24,
  23449. 0x1791f62f,
  23450. 0x764dd68d,
  23451. 0x7844db86,
  23452. 0x6a5fcc9b,
  23453. 0x6456c190,
  23454. 0x4e69e2a1,
  23455. 0x4060efaa,
  23456. 0x527bf8b7,
  23457. 0x5c72f5bc,
  23458. 0x0605bed5,
  23459. 0x080cb3de,
  23460. 0x1a17a4c3,
  23461. 0x141ea9c8,
  23462. 0x3e218af9,
  23463. 0x302887f2,
  23464. 0x223390ef,
  23465. 0x2c3a9de4,
  23466. 0x96dd063d,
  23467. 0x98d40b36,
  23468. 0x8acf1c2b,
  23469. 0x84c61120,
  23470. 0xaef93211,
  23471. 0xa0f03f1a,
  23472. 0xb2eb2807,
  23473. 0xbce2250c,
  23474. 0xe6956e65,
  23475. 0xe89c636e,
  23476. 0xfa877473,
  23477. 0xf48e7978,
  23478. 0xdeb15a49,
  23479. 0xd0b85742,
  23480. 0xc2a3405f,
  23481. 0xccaa4d54,
  23482. 0x41ecdaf7,
  23483. 0x4fe5d7fc,
  23484. 0x5dfec0e1,
  23485. 0x53f7cdea,
  23486. 0x79c8eedb,
  23487. 0x77c1e3d0,
  23488. 0x65daf4cd,
  23489. 0x6bd3f9c6,
  23490. 0x31a4b2af,
  23491. 0x3fadbfa4,
  23492. 0x2db6a8b9,
  23493. 0x23bfa5b2,
  23494. 0x09808683,
  23495. 0x07898b88,
  23496. 0x15929c95,
  23497. 0x1b9b919e,
  23498. 0xa17c0a47,
  23499. 0xaf75074c,
  23500. 0xbd6e1051,
  23501. 0xb3671d5a,
  23502. 0x99583e6b,
  23503. 0x97513360,
  23504. 0x854a247d,
  23505. 0x8b432976,
  23506. 0xd134621f,
  23507. 0xdf3d6f14,
  23508. 0xcd267809,
  23509. 0xc32f7502,
  23510. 0xe9105633,
  23511. 0xe7195b38,
  23512. 0xf5024c25,
  23513. 0xfb0b412e,
  23514. 0x9ad7618c,
  23515. 0x94de6c87,
  23516. 0x86c57b9a,
  23517. 0x88cc7691,
  23518. 0xa2f355a0,
  23519. 0xacfa58ab,
  23520. 0xbee14fb6,
  23521. 0xb0e842bd,
  23522. 0xea9f09d4,
  23523. 0xe49604df,
  23524. 0xf68d13c2,
  23525. 0xf8841ec9,
  23526. 0xd2bb3df8,
  23527. 0xdcb230f3,
  23528. 0xcea927ee,
  23529. 0xc0a02ae5,
  23530. 0x7a47b13c,
  23531. 0x744ebc37,
  23532. 0x6655ab2a,
  23533. 0x685ca621,
  23534. 0x42638510,
  23535. 0x4c6a881b,
  23536. 0x5e719f06,
  23537. 0x5078920d,
  23538. 0x0a0fd964,
  23539. 0x0406d46f,
  23540. 0x161dc372,
  23541. 0x1814ce79,
  23542. 0x322bed48,
  23543. 0x3c22e043,
  23544. 0x2e39f75e,
  23545. 0x2030fa55,
  23546. 0xec9ab701,
  23547. 0xe293ba0a,
  23548. 0xf088ad17,
  23549. 0xfe81a01c,
  23550. 0xd4be832d,
  23551. 0xdab78e26,
  23552. 0xc8ac993b,
  23553. 0xc6a59430,
  23554. 0x9cd2df59,
  23555. 0x92dbd252,
  23556. 0x80c0c54f,
  23557. 0x8ec9c844,
  23558. 0xa4f6eb75,
  23559. 0xaaffe67e,
  23560. 0xb8e4f163,
  23561. 0xb6edfc68,
  23562. 0x0c0a67b1,
  23563. 0x02036aba,
  23564. 0x10187da7,
  23565. 0x1e1170ac,
  23566. 0x342e539d,
  23567. 0x3a275e96,
  23568. 0x283c498b,
  23569. 0x26354480,
  23570. 0x7c420fe9,
  23571. 0x724b02e2,
  23572. 0x605015ff,
  23573. 0x6e5918f4,
  23574. 0x44663bc5,
  23575. 0x4a6f36ce,
  23576. 0x587421d3,
  23577. 0x567d2cd8,
  23578. 0x37a10c7a,
  23579. 0x39a80171,
  23580. 0x2bb3166c,
  23581. 0x25ba1b67,
  23582. 0x0f853856,
  23583. 0x018c355d,
  23584. 0x13972240,
  23585. 0x1d9e2f4b,
  23586. 0x47e96422,
  23587. 0x49e06929,
  23588. 0x5bfb7e34,
  23589. 0x55f2733f,
  23590. 0x7fcd500e,
  23591. 0x71c45d05,
  23592. 0x63df4a18,
  23593. 0x6dd64713,
  23594. 0xd731dcca,
  23595. 0xd938d1c1,
  23596. 0xcb23c6dc,
  23597. 0xc52acbd7,
  23598. 0xef15e8e6,
  23599. 0xe11ce5ed,
  23600. 0xf307f2f0,
  23601. 0xfd0efffb,
  23602. 0xa779b492,
  23603. 0xa970b999,
  23604. 0xbb6bae84,
  23605. 0xb562a38f,
  23606. 0x9f5d80be,
  23607. 0x91548db5,
  23608. 0x834f9aa8,
  23609. 0x8d4697a3
  23610. ]);
  23611. function expandKey128(cipherKey) {
  23612. var b = 176, result = new Uint8Array(b);
  23613. result.set(cipherKey);
  23614. for (var j = 16, i = 1; j < b; ++i) {
  23615. var t1 = result[j - 3], t2 = result[j - 2], t3 = result[j - 1], t4 = result[j - 4];
  23616. t1 = s[t1];
  23617. t2 = s[t2];
  23618. t3 = s[t3];
  23619. t4 = s[t4];
  23620. t1 = t1 ^ rcon[i];
  23621. for (var n = 0; n < 4; ++n) {
  23622. result[j] = t1 ^= result[j - 16];
  23623. j++;
  23624. result[j] = t2 ^= result[j - 16];
  23625. j++;
  23626. result[j] = t3 ^= result[j - 16];
  23627. j++;
  23628. result[j] = t4 ^= result[j - 16];
  23629. j++;
  23630. }
  23631. }
  23632. return result;
  23633. }
  23634. function decrypt128(input, key) {
  23635. var state = new Uint8Array(16);
  23636. state.set(input);
  23637. var i, j, k;
  23638. var t, u, v;
  23639. for (j = 0, k = 160; j < 16; ++j, ++k) {
  23640. state[j] ^= key[k];
  23641. }
  23642. for (i = 9; i >= 1; --i) {
  23643. t = state[13];
  23644. state[13] = state[9];
  23645. state[9] = state[5];
  23646. state[5] = state[1];
  23647. state[1] = t;
  23648. t = state[14];
  23649. u = state[10];
  23650. state[14] = state[6];
  23651. state[10] = state[2];
  23652. state[6] = t;
  23653. state[2] = u;
  23654. t = state[15];
  23655. u = state[11];
  23656. v = state[7];
  23657. state[15] = state[3];
  23658. state[11] = t;
  23659. state[7] = u;
  23660. state[3] = v;
  23661. for (j = 0; j < 16; ++j) {
  23662. state[j] = inv_s[state[j]];
  23663. }
  23664. for (j = 0, k = i * 16; j < 16; ++j, ++k) {
  23665. state[j] ^= key[k];
  23666. }
  23667. for (j = 0; j < 16; j += 4) {
  23668. var s0 = mix[state[j]], s1 = mix[state[j + 1]], s2 = mix[state[j + 2]], s3 = mix[state[j + 3]];
  23669. t = s0 ^ s1 >>> 8 ^ s1 << 24 ^ s2 >>> 16 ^ s2 << 16 ^ s3 >>> 24 ^ s3 << 8;
  23670. state[j] = t >>> 24 & 0xFF;
  23671. state[j + 1] = t >> 16 & 0xFF;
  23672. state[j + 2] = t >> 8 & 0xFF;
  23673. state[j + 3] = t & 0xFF;
  23674. }
  23675. }
  23676. t = state[13];
  23677. state[13] = state[9];
  23678. state[9] = state[5];
  23679. state[5] = state[1];
  23680. state[1] = t;
  23681. t = state[14];
  23682. u = state[10];
  23683. state[14] = state[6];
  23684. state[10] = state[2];
  23685. state[6] = t;
  23686. state[2] = u;
  23687. t = state[15];
  23688. u = state[11];
  23689. v = state[7];
  23690. state[15] = state[3];
  23691. state[11] = t;
  23692. state[7] = u;
  23693. state[3] = v;
  23694. for (j = 0; j < 16; ++j) {
  23695. state[j] = inv_s[state[j]];
  23696. state[j] ^= key[j];
  23697. }
  23698. return state;
  23699. }
  23700. function encrypt128(input, key) {
  23701. var t, u, v, k;
  23702. var state = new Uint8Array(16);
  23703. state.set(input);
  23704. for (j = 0; j < 16; ++j) {
  23705. state[j] ^= key[j];
  23706. }
  23707. for (i = 1; i < 10; i++) {
  23708. for (j = 0; j < 16; ++j) {
  23709. state[j] = s[state[j]];
  23710. }
  23711. v = state[1];
  23712. state[1] = state[5];
  23713. state[5] = state[9];
  23714. state[9] = state[13];
  23715. state[13] = v;
  23716. v = state[2];
  23717. u = state[6];
  23718. state[2] = state[10];
  23719. state[6] = state[14];
  23720. state[10] = v;
  23721. state[14] = u;
  23722. v = state[3];
  23723. u = state[7];
  23724. t = state[11];
  23725. state[3] = state[15];
  23726. state[7] = v;
  23727. state[11] = u;
  23728. state[15] = t;
  23729. for (var j = 0; j < 16; j += 4) {
  23730. var s0 = state[j + 0], s1 = state[j + 1];
  23731. var s2 = state[j + 2], s3 = state[j + 3];
  23732. t = s0 ^ s1 ^ s2 ^ s3;
  23733. state[j + 0] ^= t ^ mixCol[s0 ^ s1];
  23734. state[j + 1] ^= t ^ mixCol[s1 ^ s2];
  23735. state[j + 2] ^= t ^ mixCol[s2 ^ s3];
  23736. state[j + 3] ^= t ^ mixCol[s3 ^ s0];
  23737. }
  23738. for (j = 0, k = i * 16; j < 16; ++j, ++k) {
  23739. state[j] ^= key[k];
  23740. }
  23741. }
  23742. for (j = 0; j < 16; ++j) {
  23743. state[j] = s[state[j]];
  23744. }
  23745. v = state[1];
  23746. state[1] = state[5];
  23747. state[5] = state[9];
  23748. state[9] = state[13];
  23749. state[13] = v;
  23750. v = state[2];
  23751. u = state[6];
  23752. state[2] = state[10];
  23753. state[6] = state[14];
  23754. state[10] = v;
  23755. state[14] = u;
  23756. v = state[3];
  23757. u = state[7];
  23758. t = state[11];
  23759. state[3] = state[15];
  23760. state[7] = v;
  23761. state[11] = u;
  23762. state[15] = t;
  23763. for (j = 0, k = 160; j < 16; ++j, ++k) {
  23764. state[j] ^= key[k];
  23765. }
  23766. return state;
  23767. }
  23768. function AES128Cipher(key) {
  23769. this.key = expandKey128(key);
  23770. this.buffer = new Uint8Array(16);
  23771. this.bufferPosition = 0;
  23772. }
  23773. function decryptBlock2(data, finalize) {
  23774. var i, j, ii, sourceLength = data.length, buffer = this.buffer, bufferLength = this.bufferPosition, result = [], iv = this.iv;
  23775. for (i = 0; i < sourceLength; ++i) {
  23776. buffer[bufferLength] = data[i];
  23777. ++bufferLength;
  23778. if (bufferLength < 16) {
  23779. continue;
  23780. }
  23781. var plain = decrypt128(buffer, this.key);
  23782. for (j = 0; j < 16; ++j) {
  23783. plain[j] ^= iv[j];
  23784. }
  23785. iv = buffer;
  23786. result.push(plain);
  23787. buffer = new Uint8Array(16);
  23788. bufferLength = 0;
  23789. }
  23790. this.buffer = buffer;
  23791. this.bufferLength = bufferLength;
  23792. this.iv = iv;
  23793. if (result.length === 0) {
  23794. return new Uint8Array([]);
  23795. }
  23796. var outputLength = 16 * result.length;
  23797. if (finalize) {
  23798. var lastBlock = result[result.length - 1];
  23799. var psLen = lastBlock[15];
  23800. if (psLen <= 16) {
  23801. for (i = 15, ii = 16 - psLen; i >= ii; --i) {
  23802. if (lastBlock[i] !== psLen) {
  23803. psLen = 0;
  23804. break;
  23805. }
  23806. }
  23807. outputLength -= psLen;
  23808. result[result.length - 1] = lastBlock.subarray(0, 16 - psLen);
  23809. }
  23810. }
  23811. var output = new Uint8Array(outputLength);
  23812. for (i = 0, j = 0, ii = result.length; i < ii; ++i, j += 16) {
  23813. output.set(result[i], j);
  23814. }
  23815. return output;
  23816. }
  23817. AES128Cipher.prototype = {
  23818. decryptBlock: function AES128Cipher_decryptBlock(data, finalize) {
  23819. var i, sourceLength = data.length;
  23820. var buffer = this.buffer, bufferLength = this.bufferPosition;
  23821. for (i = 0; bufferLength < 16 && i < sourceLength; ++i, ++bufferLength) {
  23822. buffer[bufferLength] = data[i];
  23823. }
  23824. if (bufferLength < 16) {
  23825. this.bufferLength = bufferLength;
  23826. return new Uint8Array([]);
  23827. }
  23828. this.iv = buffer;
  23829. this.buffer = new Uint8Array(16);
  23830. this.bufferLength = 0;
  23831. this.decryptBlock = decryptBlock2;
  23832. return this.decryptBlock(data.subarray(16), finalize);
  23833. },
  23834. encrypt: function AES128Cipher_encrypt(data, iv) {
  23835. var i, j, ii, sourceLength = data.length, buffer = this.buffer, bufferLength = this.bufferPosition, result = [];
  23836. if (!iv) {
  23837. iv = new Uint8Array(16);
  23838. }
  23839. for (i = 0; i < sourceLength; ++i) {
  23840. buffer[bufferLength] = data[i];
  23841. ++bufferLength;
  23842. if (bufferLength < 16) {
  23843. continue;
  23844. }
  23845. for (j = 0; j < 16; ++j) {
  23846. buffer[j] ^= iv[j];
  23847. }
  23848. var cipher = encrypt128(buffer, this.key);
  23849. iv = cipher;
  23850. result.push(cipher);
  23851. buffer = new Uint8Array(16);
  23852. bufferLength = 0;
  23853. }
  23854. this.buffer = buffer;
  23855. this.bufferLength = bufferLength;
  23856. this.iv = iv;
  23857. if (result.length === 0) {
  23858. return new Uint8Array([]);
  23859. }
  23860. var outputLength = 16 * result.length;
  23861. var output = new Uint8Array(outputLength);
  23862. for (i = 0, j = 0, ii = result.length; i < ii; ++i, j += 16) {
  23863. output.set(result[i], j);
  23864. }
  23865. return output;
  23866. }
  23867. };
  23868. return AES128Cipher;
  23869. }();
  23870. var AES256Cipher = function AES256CipherClosure() {
  23871. var s = new Uint8Array([
  23872. 0x63,
  23873. 0x7c,
  23874. 0x77,
  23875. 0x7b,
  23876. 0xf2,
  23877. 0x6b,
  23878. 0x6f,
  23879. 0xc5,
  23880. 0x30,
  23881. 0x01,
  23882. 0x67,
  23883. 0x2b,
  23884. 0xfe,
  23885. 0xd7,
  23886. 0xab,
  23887. 0x76,
  23888. 0xca,
  23889. 0x82,
  23890. 0xc9,
  23891. 0x7d,
  23892. 0xfa,
  23893. 0x59,
  23894. 0x47,
  23895. 0xf0,
  23896. 0xad,
  23897. 0xd4,
  23898. 0xa2,
  23899. 0xaf,
  23900. 0x9c,
  23901. 0xa4,
  23902. 0x72,
  23903. 0xc0,
  23904. 0xb7,
  23905. 0xfd,
  23906. 0x93,
  23907. 0x26,
  23908. 0x36,
  23909. 0x3f,
  23910. 0xf7,
  23911. 0xcc,
  23912. 0x34,
  23913. 0xa5,
  23914. 0xe5,
  23915. 0xf1,
  23916. 0x71,
  23917. 0xd8,
  23918. 0x31,
  23919. 0x15,
  23920. 0x04,
  23921. 0xc7,
  23922. 0x23,
  23923. 0xc3,
  23924. 0x18,
  23925. 0x96,
  23926. 0x05,
  23927. 0x9a,
  23928. 0x07,
  23929. 0x12,
  23930. 0x80,
  23931. 0xe2,
  23932. 0xeb,
  23933. 0x27,
  23934. 0xb2,
  23935. 0x75,
  23936. 0x09,
  23937. 0x83,
  23938. 0x2c,
  23939. 0x1a,
  23940. 0x1b,
  23941. 0x6e,
  23942. 0x5a,
  23943. 0xa0,
  23944. 0x52,
  23945. 0x3b,
  23946. 0xd6,
  23947. 0xb3,
  23948. 0x29,
  23949. 0xe3,
  23950. 0x2f,
  23951. 0x84,
  23952. 0x53,
  23953. 0xd1,
  23954. 0x00,
  23955. 0xed,
  23956. 0x20,
  23957. 0xfc,
  23958. 0xb1,
  23959. 0x5b,
  23960. 0x6a,
  23961. 0xcb,
  23962. 0xbe,
  23963. 0x39,
  23964. 0x4a,
  23965. 0x4c,
  23966. 0x58,
  23967. 0xcf,
  23968. 0xd0,
  23969. 0xef,
  23970. 0xaa,
  23971. 0xfb,
  23972. 0x43,
  23973. 0x4d,
  23974. 0x33,
  23975. 0x85,
  23976. 0x45,
  23977. 0xf9,
  23978. 0x02,
  23979. 0x7f,
  23980. 0x50,
  23981. 0x3c,
  23982. 0x9f,
  23983. 0xa8,
  23984. 0x51,
  23985. 0xa3,
  23986. 0x40,
  23987. 0x8f,
  23988. 0x92,
  23989. 0x9d,
  23990. 0x38,
  23991. 0xf5,
  23992. 0xbc,
  23993. 0xb6,
  23994. 0xda,
  23995. 0x21,
  23996. 0x10,
  23997. 0xff,
  23998. 0xf3,
  23999. 0xd2,
  24000. 0xcd,
  24001. 0x0c,
  24002. 0x13,
  24003. 0xec,
  24004. 0x5f,
  24005. 0x97,
  24006. 0x44,
  24007. 0x17,
  24008. 0xc4,
  24009. 0xa7,
  24010. 0x7e,
  24011. 0x3d,
  24012. 0x64,
  24013. 0x5d,
  24014. 0x19,
  24015. 0x73,
  24016. 0x60,
  24017. 0x81,
  24018. 0x4f,
  24019. 0xdc,
  24020. 0x22,
  24021. 0x2a,
  24022. 0x90,
  24023. 0x88,
  24024. 0x46,
  24025. 0xee,
  24026. 0xb8,
  24027. 0x14,
  24028. 0xde,
  24029. 0x5e,
  24030. 0x0b,
  24031. 0xdb,
  24032. 0xe0,
  24033. 0x32,
  24034. 0x3a,
  24035. 0x0a,
  24036. 0x49,
  24037. 0x06,
  24038. 0x24,
  24039. 0x5c,
  24040. 0xc2,
  24041. 0xd3,
  24042. 0xac,
  24043. 0x62,
  24044. 0x91,
  24045. 0x95,
  24046. 0xe4,
  24047. 0x79,
  24048. 0xe7,
  24049. 0xc8,
  24050. 0x37,
  24051. 0x6d,
  24052. 0x8d,
  24053. 0xd5,
  24054. 0x4e,
  24055. 0xa9,
  24056. 0x6c,
  24057. 0x56,
  24058. 0xf4,
  24059. 0xea,
  24060. 0x65,
  24061. 0x7a,
  24062. 0xae,
  24063. 0x08,
  24064. 0xba,
  24065. 0x78,
  24066. 0x25,
  24067. 0x2e,
  24068. 0x1c,
  24069. 0xa6,
  24070. 0xb4,
  24071. 0xc6,
  24072. 0xe8,
  24073. 0xdd,
  24074. 0x74,
  24075. 0x1f,
  24076. 0x4b,
  24077. 0xbd,
  24078. 0x8b,
  24079. 0x8a,
  24080. 0x70,
  24081. 0x3e,
  24082. 0xb5,
  24083. 0x66,
  24084. 0x48,
  24085. 0x03,
  24086. 0xf6,
  24087. 0x0e,
  24088. 0x61,
  24089. 0x35,
  24090. 0x57,
  24091. 0xb9,
  24092. 0x86,
  24093. 0xc1,
  24094. 0x1d,
  24095. 0x9e,
  24096. 0xe1,
  24097. 0xf8,
  24098. 0x98,
  24099. 0x11,
  24100. 0x69,
  24101. 0xd9,
  24102. 0x8e,
  24103. 0x94,
  24104. 0x9b,
  24105. 0x1e,
  24106. 0x87,
  24107. 0xe9,
  24108. 0xce,
  24109. 0x55,
  24110. 0x28,
  24111. 0xdf,
  24112. 0x8c,
  24113. 0xa1,
  24114. 0x89,
  24115. 0x0d,
  24116. 0xbf,
  24117. 0xe6,
  24118. 0x42,
  24119. 0x68,
  24120. 0x41,
  24121. 0x99,
  24122. 0x2d,
  24123. 0x0f,
  24124. 0xb0,
  24125. 0x54,
  24126. 0xbb,
  24127. 0x16
  24128. ]);
  24129. var inv_s = new Uint8Array([
  24130. 0x52,
  24131. 0x09,
  24132. 0x6a,
  24133. 0xd5,
  24134. 0x30,
  24135. 0x36,
  24136. 0xa5,
  24137. 0x38,
  24138. 0xbf,
  24139. 0x40,
  24140. 0xa3,
  24141. 0x9e,
  24142. 0x81,
  24143. 0xf3,
  24144. 0xd7,
  24145. 0xfb,
  24146. 0x7c,
  24147. 0xe3,
  24148. 0x39,
  24149. 0x82,
  24150. 0x9b,
  24151. 0x2f,
  24152. 0xff,
  24153. 0x87,
  24154. 0x34,
  24155. 0x8e,
  24156. 0x43,
  24157. 0x44,
  24158. 0xc4,
  24159. 0xde,
  24160. 0xe9,
  24161. 0xcb,
  24162. 0x54,
  24163. 0x7b,
  24164. 0x94,
  24165. 0x32,
  24166. 0xa6,
  24167. 0xc2,
  24168. 0x23,
  24169. 0x3d,
  24170. 0xee,
  24171. 0x4c,
  24172. 0x95,
  24173. 0x0b,
  24174. 0x42,
  24175. 0xfa,
  24176. 0xc3,
  24177. 0x4e,
  24178. 0x08,
  24179. 0x2e,
  24180. 0xa1,
  24181. 0x66,
  24182. 0x28,
  24183. 0xd9,
  24184. 0x24,
  24185. 0xb2,
  24186. 0x76,
  24187. 0x5b,
  24188. 0xa2,
  24189. 0x49,
  24190. 0x6d,
  24191. 0x8b,
  24192. 0xd1,
  24193. 0x25,
  24194. 0x72,
  24195. 0xf8,
  24196. 0xf6,
  24197. 0x64,
  24198. 0x86,
  24199. 0x68,
  24200. 0x98,
  24201. 0x16,
  24202. 0xd4,
  24203. 0xa4,
  24204. 0x5c,
  24205. 0xcc,
  24206. 0x5d,
  24207. 0x65,
  24208. 0xb6,
  24209. 0x92,
  24210. 0x6c,
  24211. 0x70,
  24212. 0x48,
  24213. 0x50,
  24214. 0xfd,
  24215. 0xed,
  24216. 0xb9,
  24217. 0xda,
  24218. 0x5e,
  24219. 0x15,
  24220. 0x46,
  24221. 0x57,
  24222. 0xa7,
  24223. 0x8d,
  24224. 0x9d,
  24225. 0x84,
  24226. 0x90,
  24227. 0xd8,
  24228. 0xab,
  24229. 0x00,
  24230. 0x8c,
  24231. 0xbc,
  24232. 0xd3,
  24233. 0x0a,
  24234. 0xf7,
  24235. 0xe4,
  24236. 0x58,
  24237. 0x05,
  24238. 0xb8,
  24239. 0xb3,
  24240. 0x45,
  24241. 0x06,
  24242. 0xd0,
  24243. 0x2c,
  24244. 0x1e,
  24245. 0x8f,
  24246. 0xca,
  24247. 0x3f,
  24248. 0x0f,
  24249. 0x02,
  24250. 0xc1,
  24251. 0xaf,
  24252. 0xbd,
  24253. 0x03,
  24254. 0x01,
  24255. 0x13,
  24256. 0x8a,
  24257. 0x6b,
  24258. 0x3a,
  24259. 0x91,
  24260. 0x11,
  24261. 0x41,
  24262. 0x4f,
  24263. 0x67,
  24264. 0xdc,
  24265. 0xea,
  24266. 0x97,
  24267. 0xf2,
  24268. 0xcf,
  24269. 0xce,
  24270. 0xf0,
  24271. 0xb4,
  24272. 0xe6,
  24273. 0x73,
  24274. 0x96,
  24275. 0xac,
  24276. 0x74,
  24277. 0x22,
  24278. 0xe7,
  24279. 0xad,
  24280. 0x35,
  24281. 0x85,
  24282. 0xe2,
  24283. 0xf9,
  24284. 0x37,
  24285. 0xe8,
  24286. 0x1c,
  24287. 0x75,
  24288. 0xdf,
  24289. 0x6e,
  24290. 0x47,
  24291. 0xf1,
  24292. 0x1a,
  24293. 0x71,
  24294. 0x1d,
  24295. 0x29,
  24296. 0xc5,
  24297. 0x89,
  24298. 0x6f,
  24299. 0xb7,
  24300. 0x62,
  24301. 0x0e,
  24302. 0xaa,
  24303. 0x18,
  24304. 0xbe,
  24305. 0x1b,
  24306. 0xfc,
  24307. 0x56,
  24308. 0x3e,
  24309. 0x4b,
  24310. 0xc6,
  24311. 0xd2,
  24312. 0x79,
  24313. 0x20,
  24314. 0x9a,
  24315. 0xdb,
  24316. 0xc0,
  24317. 0xfe,
  24318. 0x78,
  24319. 0xcd,
  24320. 0x5a,
  24321. 0xf4,
  24322. 0x1f,
  24323. 0xdd,
  24324. 0xa8,
  24325. 0x33,
  24326. 0x88,
  24327. 0x07,
  24328. 0xc7,
  24329. 0x31,
  24330. 0xb1,
  24331. 0x12,
  24332. 0x10,
  24333. 0x59,
  24334. 0x27,
  24335. 0x80,
  24336. 0xec,
  24337. 0x5f,
  24338. 0x60,
  24339. 0x51,
  24340. 0x7f,
  24341. 0xa9,
  24342. 0x19,
  24343. 0xb5,
  24344. 0x4a,
  24345. 0x0d,
  24346. 0x2d,
  24347. 0xe5,
  24348. 0x7a,
  24349. 0x9f,
  24350. 0x93,
  24351. 0xc9,
  24352. 0x9c,
  24353. 0xef,
  24354. 0xa0,
  24355. 0xe0,
  24356. 0x3b,
  24357. 0x4d,
  24358. 0xae,
  24359. 0x2a,
  24360. 0xf5,
  24361. 0xb0,
  24362. 0xc8,
  24363. 0xeb,
  24364. 0xbb,
  24365. 0x3c,
  24366. 0x83,
  24367. 0x53,
  24368. 0x99,
  24369. 0x61,
  24370. 0x17,
  24371. 0x2b,
  24372. 0x04,
  24373. 0x7e,
  24374. 0xba,
  24375. 0x77,
  24376. 0xd6,
  24377. 0x26,
  24378. 0xe1,
  24379. 0x69,
  24380. 0x14,
  24381. 0x63,
  24382. 0x55,
  24383. 0x21,
  24384. 0x0c,
  24385. 0x7d
  24386. ]);
  24387. var mixCol = new Uint8Array(256);
  24388. for (var i = 0; i < 256; i++) {
  24389. if (i < 128) {
  24390. mixCol[i] = i << 1;
  24391. } else {
  24392. mixCol[i] = i << 1 ^ 0x1b;
  24393. }
  24394. }
  24395. var mix = new Uint32Array([
  24396. 0x00000000,
  24397. 0x0e090d0b,
  24398. 0x1c121a16,
  24399. 0x121b171d,
  24400. 0x3824342c,
  24401. 0x362d3927,
  24402. 0x24362e3a,
  24403. 0x2a3f2331,
  24404. 0x70486858,
  24405. 0x7e416553,
  24406. 0x6c5a724e,
  24407. 0x62537f45,
  24408. 0x486c5c74,
  24409. 0x4665517f,
  24410. 0x547e4662,
  24411. 0x5a774b69,
  24412. 0xe090d0b0,
  24413. 0xee99ddbb,
  24414. 0xfc82caa6,
  24415. 0xf28bc7ad,
  24416. 0xd8b4e49c,
  24417. 0xd6bde997,
  24418. 0xc4a6fe8a,
  24419. 0xcaaff381,
  24420. 0x90d8b8e8,
  24421. 0x9ed1b5e3,
  24422. 0x8ccaa2fe,
  24423. 0x82c3aff5,
  24424. 0xa8fc8cc4,
  24425. 0xa6f581cf,
  24426. 0xb4ee96d2,
  24427. 0xbae79bd9,
  24428. 0xdb3bbb7b,
  24429. 0xd532b670,
  24430. 0xc729a16d,
  24431. 0xc920ac66,
  24432. 0xe31f8f57,
  24433. 0xed16825c,
  24434. 0xff0d9541,
  24435. 0xf104984a,
  24436. 0xab73d323,
  24437. 0xa57ade28,
  24438. 0xb761c935,
  24439. 0xb968c43e,
  24440. 0x9357e70f,
  24441. 0x9d5eea04,
  24442. 0x8f45fd19,
  24443. 0x814cf012,
  24444. 0x3bab6bcb,
  24445. 0x35a266c0,
  24446. 0x27b971dd,
  24447. 0x29b07cd6,
  24448. 0x038f5fe7,
  24449. 0x0d8652ec,
  24450. 0x1f9d45f1,
  24451. 0x119448fa,
  24452. 0x4be30393,
  24453. 0x45ea0e98,
  24454. 0x57f11985,
  24455. 0x59f8148e,
  24456. 0x73c737bf,
  24457. 0x7dce3ab4,
  24458. 0x6fd52da9,
  24459. 0x61dc20a2,
  24460. 0xad766df6,
  24461. 0xa37f60fd,
  24462. 0xb16477e0,
  24463. 0xbf6d7aeb,
  24464. 0x955259da,
  24465. 0x9b5b54d1,
  24466. 0x894043cc,
  24467. 0x87494ec7,
  24468. 0xdd3e05ae,
  24469. 0xd33708a5,
  24470. 0xc12c1fb8,
  24471. 0xcf2512b3,
  24472. 0xe51a3182,
  24473. 0xeb133c89,
  24474. 0xf9082b94,
  24475. 0xf701269f,
  24476. 0x4de6bd46,
  24477. 0x43efb04d,
  24478. 0x51f4a750,
  24479. 0x5ffdaa5b,
  24480. 0x75c2896a,
  24481. 0x7bcb8461,
  24482. 0x69d0937c,
  24483. 0x67d99e77,
  24484. 0x3daed51e,
  24485. 0x33a7d815,
  24486. 0x21bccf08,
  24487. 0x2fb5c203,
  24488. 0x058ae132,
  24489. 0x0b83ec39,
  24490. 0x1998fb24,
  24491. 0x1791f62f,
  24492. 0x764dd68d,
  24493. 0x7844db86,
  24494. 0x6a5fcc9b,
  24495. 0x6456c190,
  24496. 0x4e69e2a1,
  24497. 0x4060efaa,
  24498. 0x527bf8b7,
  24499. 0x5c72f5bc,
  24500. 0x0605bed5,
  24501. 0x080cb3de,
  24502. 0x1a17a4c3,
  24503. 0x141ea9c8,
  24504. 0x3e218af9,
  24505. 0x302887f2,
  24506. 0x223390ef,
  24507. 0x2c3a9de4,
  24508. 0x96dd063d,
  24509. 0x98d40b36,
  24510. 0x8acf1c2b,
  24511. 0x84c61120,
  24512. 0xaef93211,
  24513. 0xa0f03f1a,
  24514. 0xb2eb2807,
  24515. 0xbce2250c,
  24516. 0xe6956e65,
  24517. 0xe89c636e,
  24518. 0xfa877473,
  24519. 0xf48e7978,
  24520. 0xdeb15a49,
  24521. 0xd0b85742,
  24522. 0xc2a3405f,
  24523. 0xccaa4d54,
  24524. 0x41ecdaf7,
  24525. 0x4fe5d7fc,
  24526. 0x5dfec0e1,
  24527. 0x53f7cdea,
  24528. 0x79c8eedb,
  24529. 0x77c1e3d0,
  24530. 0x65daf4cd,
  24531. 0x6bd3f9c6,
  24532. 0x31a4b2af,
  24533. 0x3fadbfa4,
  24534. 0x2db6a8b9,
  24535. 0x23bfa5b2,
  24536. 0x09808683,
  24537. 0x07898b88,
  24538. 0x15929c95,
  24539. 0x1b9b919e,
  24540. 0xa17c0a47,
  24541. 0xaf75074c,
  24542. 0xbd6e1051,
  24543. 0xb3671d5a,
  24544. 0x99583e6b,
  24545. 0x97513360,
  24546. 0x854a247d,
  24547. 0x8b432976,
  24548. 0xd134621f,
  24549. 0xdf3d6f14,
  24550. 0xcd267809,
  24551. 0xc32f7502,
  24552. 0xe9105633,
  24553. 0xe7195b38,
  24554. 0xf5024c25,
  24555. 0xfb0b412e,
  24556. 0x9ad7618c,
  24557. 0x94de6c87,
  24558. 0x86c57b9a,
  24559. 0x88cc7691,
  24560. 0xa2f355a0,
  24561. 0xacfa58ab,
  24562. 0xbee14fb6,
  24563. 0xb0e842bd,
  24564. 0xea9f09d4,
  24565. 0xe49604df,
  24566. 0xf68d13c2,
  24567. 0xf8841ec9,
  24568. 0xd2bb3df8,
  24569. 0xdcb230f3,
  24570. 0xcea927ee,
  24571. 0xc0a02ae5,
  24572. 0x7a47b13c,
  24573. 0x744ebc37,
  24574. 0x6655ab2a,
  24575. 0x685ca621,
  24576. 0x42638510,
  24577. 0x4c6a881b,
  24578. 0x5e719f06,
  24579. 0x5078920d,
  24580. 0x0a0fd964,
  24581. 0x0406d46f,
  24582. 0x161dc372,
  24583. 0x1814ce79,
  24584. 0x322bed48,
  24585. 0x3c22e043,
  24586. 0x2e39f75e,
  24587. 0x2030fa55,
  24588. 0xec9ab701,
  24589. 0xe293ba0a,
  24590. 0xf088ad17,
  24591. 0xfe81a01c,
  24592. 0xd4be832d,
  24593. 0xdab78e26,
  24594. 0xc8ac993b,
  24595. 0xc6a59430,
  24596. 0x9cd2df59,
  24597. 0x92dbd252,
  24598. 0x80c0c54f,
  24599. 0x8ec9c844,
  24600. 0xa4f6eb75,
  24601. 0xaaffe67e,
  24602. 0xb8e4f163,
  24603. 0xb6edfc68,
  24604. 0x0c0a67b1,
  24605. 0x02036aba,
  24606. 0x10187da7,
  24607. 0x1e1170ac,
  24608. 0x342e539d,
  24609. 0x3a275e96,
  24610. 0x283c498b,
  24611. 0x26354480,
  24612. 0x7c420fe9,
  24613. 0x724b02e2,
  24614. 0x605015ff,
  24615. 0x6e5918f4,
  24616. 0x44663bc5,
  24617. 0x4a6f36ce,
  24618. 0x587421d3,
  24619. 0x567d2cd8,
  24620. 0x37a10c7a,
  24621. 0x39a80171,
  24622. 0x2bb3166c,
  24623. 0x25ba1b67,
  24624. 0x0f853856,
  24625. 0x018c355d,
  24626. 0x13972240,
  24627. 0x1d9e2f4b,
  24628. 0x47e96422,
  24629. 0x49e06929,
  24630. 0x5bfb7e34,
  24631. 0x55f2733f,
  24632. 0x7fcd500e,
  24633. 0x71c45d05,
  24634. 0x63df4a18,
  24635. 0x6dd64713,
  24636. 0xd731dcca,
  24637. 0xd938d1c1,
  24638. 0xcb23c6dc,
  24639. 0xc52acbd7,
  24640. 0xef15e8e6,
  24641. 0xe11ce5ed,
  24642. 0xf307f2f0,
  24643. 0xfd0efffb,
  24644. 0xa779b492,
  24645. 0xa970b999,
  24646. 0xbb6bae84,
  24647. 0xb562a38f,
  24648. 0x9f5d80be,
  24649. 0x91548db5,
  24650. 0x834f9aa8,
  24651. 0x8d4697a3
  24652. ]);
  24653. function expandKey256(cipherKey) {
  24654. var b = 240, result = new Uint8Array(b);
  24655. var r = 1;
  24656. result.set(cipherKey);
  24657. for (var j = 32, i = 1; j < b; ++i) {
  24658. if (j % 32 === 16) {
  24659. t1 = s[t1];
  24660. t2 = s[t2];
  24661. t3 = s[t3];
  24662. t4 = s[t4];
  24663. } else if (j % 32 === 0) {
  24664. var t1 = result[j - 3], t2 = result[j - 2], t3 = result[j - 1], t4 = result[j - 4];
  24665. t1 = s[t1];
  24666. t2 = s[t2];
  24667. t3 = s[t3];
  24668. t4 = s[t4];
  24669. t1 = t1 ^ r;
  24670. if ((r <<= 1) >= 256) {
  24671. r = (r ^ 0x1b) & 0xFF;
  24672. }
  24673. }
  24674. for (var n = 0; n < 4; ++n) {
  24675. result[j] = t1 ^= result[j - 32];
  24676. j++;
  24677. result[j] = t2 ^= result[j - 32];
  24678. j++;
  24679. result[j] = t3 ^= result[j - 32];
  24680. j++;
  24681. result[j] = t4 ^= result[j - 32];
  24682. j++;
  24683. }
  24684. }
  24685. return result;
  24686. }
  24687. function decrypt256(input, key) {
  24688. var state = new Uint8Array(16);
  24689. state.set(input);
  24690. var i, j, k;
  24691. var t, u, v;
  24692. for (j = 0, k = 224; j < 16; ++j, ++k) {
  24693. state[j] ^= key[k];
  24694. }
  24695. for (i = 13; i >= 1; --i) {
  24696. t = state[13];
  24697. state[13] = state[9];
  24698. state[9] = state[5];
  24699. state[5] = state[1];
  24700. state[1] = t;
  24701. t = state[14];
  24702. u = state[10];
  24703. state[14] = state[6];
  24704. state[10] = state[2];
  24705. state[6] = t;
  24706. state[2] = u;
  24707. t = state[15];
  24708. u = state[11];
  24709. v = state[7];
  24710. state[15] = state[3];
  24711. state[11] = t;
  24712. state[7] = u;
  24713. state[3] = v;
  24714. for (j = 0; j < 16; ++j) {
  24715. state[j] = inv_s[state[j]];
  24716. }
  24717. for (j = 0, k = i * 16; j < 16; ++j, ++k) {
  24718. state[j] ^= key[k];
  24719. }
  24720. for (j = 0; j < 16; j += 4) {
  24721. var s0 = mix[state[j]], s1 = mix[state[j + 1]], s2 = mix[state[j + 2]], s3 = mix[state[j + 3]];
  24722. t = s0 ^ s1 >>> 8 ^ s1 << 24 ^ s2 >>> 16 ^ s2 << 16 ^ s3 >>> 24 ^ s3 << 8;
  24723. state[j] = t >>> 24 & 0xFF;
  24724. state[j + 1] = t >> 16 & 0xFF;
  24725. state[j + 2] = t >> 8 & 0xFF;
  24726. state[j + 3] = t & 0xFF;
  24727. }
  24728. }
  24729. t = state[13];
  24730. state[13] = state[9];
  24731. state[9] = state[5];
  24732. state[5] = state[1];
  24733. state[1] = t;
  24734. t = state[14];
  24735. u = state[10];
  24736. state[14] = state[6];
  24737. state[10] = state[2];
  24738. state[6] = t;
  24739. state[2] = u;
  24740. t = state[15];
  24741. u = state[11];
  24742. v = state[7];
  24743. state[15] = state[3];
  24744. state[11] = t;
  24745. state[7] = u;
  24746. state[3] = v;
  24747. for (j = 0; j < 16; ++j) {
  24748. state[j] = inv_s[state[j]];
  24749. state[j] ^= key[j];
  24750. }
  24751. return state;
  24752. }
  24753. function encrypt256(input, key) {
  24754. var t, u, v, k;
  24755. var state = new Uint8Array(16);
  24756. state.set(input);
  24757. for (j = 0; j < 16; ++j) {
  24758. state[j] ^= key[j];
  24759. }
  24760. for (i = 1; i < 14; i++) {
  24761. for (j = 0; j < 16; ++j) {
  24762. state[j] = s[state[j]];
  24763. }
  24764. v = state[1];
  24765. state[1] = state[5];
  24766. state[5] = state[9];
  24767. state[9] = state[13];
  24768. state[13] = v;
  24769. v = state[2];
  24770. u = state[6];
  24771. state[2] = state[10];
  24772. state[6] = state[14];
  24773. state[10] = v;
  24774. state[14] = u;
  24775. v = state[3];
  24776. u = state[7];
  24777. t = state[11];
  24778. state[3] = state[15];
  24779. state[7] = v;
  24780. state[11] = u;
  24781. state[15] = t;
  24782. for (var j = 0; j < 16; j += 4) {
  24783. var s0 = state[j + 0], s1 = state[j + 1];
  24784. var s2 = state[j + 2], s3 = state[j + 3];
  24785. t = s0 ^ s1 ^ s2 ^ s3;
  24786. state[j + 0] ^= t ^ mixCol[s0 ^ s1];
  24787. state[j + 1] ^= t ^ mixCol[s1 ^ s2];
  24788. state[j + 2] ^= t ^ mixCol[s2 ^ s3];
  24789. state[j + 3] ^= t ^ mixCol[s3 ^ s0];
  24790. }
  24791. for (j = 0, k = i * 16; j < 16; ++j, ++k) {
  24792. state[j] ^= key[k];
  24793. }
  24794. }
  24795. for (j = 0; j < 16; ++j) {
  24796. state[j] = s[state[j]];
  24797. }
  24798. v = state[1];
  24799. state[1] = state[5];
  24800. state[5] = state[9];
  24801. state[9] = state[13];
  24802. state[13] = v;
  24803. v = state[2];
  24804. u = state[6];
  24805. state[2] = state[10];
  24806. state[6] = state[14];
  24807. state[10] = v;
  24808. state[14] = u;
  24809. v = state[3];
  24810. u = state[7];
  24811. t = state[11];
  24812. state[3] = state[15];
  24813. state[7] = v;
  24814. state[11] = u;
  24815. state[15] = t;
  24816. for (j = 0, k = 224; j < 16; ++j, ++k) {
  24817. state[j] ^= key[k];
  24818. }
  24819. return state;
  24820. }
  24821. function AES256Cipher(key) {
  24822. this.key = expandKey256(key);
  24823. this.buffer = new Uint8Array(16);
  24824. this.bufferPosition = 0;
  24825. }
  24826. function decryptBlock2(data, finalize) {
  24827. var i, j, ii, sourceLength = data.length, buffer = this.buffer, bufferLength = this.bufferPosition, result = [], iv = this.iv;
  24828. for (i = 0; i < sourceLength; ++i) {
  24829. buffer[bufferLength] = data[i];
  24830. ++bufferLength;
  24831. if (bufferLength < 16) {
  24832. continue;
  24833. }
  24834. var plain = decrypt256(buffer, this.key);
  24835. for (j = 0; j < 16; ++j) {
  24836. plain[j] ^= iv[j];
  24837. }
  24838. iv = buffer;
  24839. result.push(plain);
  24840. buffer = new Uint8Array(16);
  24841. bufferLength = 0;
  24842. }
  24843. this.buffer = buffer;
  24844. this.bufferLength = bufferLength;
  24845. this.iv = iv;
  24846. if (result.length === 0) {
  24847. return new Uint8Array([]);
  24848. }
  24849. var outputLength = 16 * result.length;
  24850. if (finalize) {
  24851. var lastBlock = result[result.length - 1];
  24852. var psLen = lastBlock[15];
  24853. if (psLen <= 16) {
  24854. for (i = 15, ii = 16 - psLen; i >= ii; --i) {
  24855. if (lastBlock[i] !== psLen) {
  24856. psLen = 0;
  24857. break;
  24858. }
  24859. }
  24860. outputLength -= psLen;
  24861. result[result.length - 1] = lastBlock.subarray(0, 16 - psLen);
  24862. }
  24863. }
  24864. var output = new Uint8Array(outputLength);
  24865. for (i = 0, j = 0, ii = result.length; i < ii; ++i, j += 16) {
  24866. output.set(result[i], j);
  24867. }
  24868. return output;
  24869. }
  24870. AES256Cipher.prototype = {
  24871. decryptBlock: function AES256Cipher_decryptBlock(data, finalize, iv) {
  24872. var i, sourceLength = data.length;
  24873. var buffer = this.buffer, bufferLength = this.bufferPosition;
  24874. if (iv) {
  24875. this.iv = iv;
  24876. } else {
  24877. for (i = 0; bufferLength < 16 && i < sourceLength; ++i, ++bufferLength) {
  24878. buffer[bufferLength] = data[i];
  24879. }
  24880. if (bufferLength < 16) {
  24881. this.bufferLength = bufferLength;
  24882. return new Uint8Array([]);
  24883. }
  24884. this.iv = buffer;
  24885. data = data.subarray(16);
  24886. }
  24887. this.buffer = new Uint8Array(16);
  24888. this.bufferLength = 0;
  24889. this.decryptBlock = decryptBlock2;
  24890. return this.decryptBlock(data, finalize);
  24891. },
  24892. encrypt: function AES256Cipher_encrypt(data, iv) {
  24893. var i, j, ii, sourceLength = data.length, buffer = this.buffer, bufferLength = this.bufferPosition, result = [];
  24894. if (!iv) {
  24895. iv = new Uint8Array(16);
  24896. }
  24897. for (i = 0; i < sourceLength; ++i) {
  24898. buffer[bufferLength] = data[i];
  24899. ++bufferLength;
  24900. if (bufferLength < 16) {
  24901. continue;
  24902. }
  24903. for (j = 0; j < 16; ++j) {
  24904. buffer[j] ^= iv[j];
  24905. }
  24906. var cipher = encrypt256(buffer, this.key);
  24907. this.iv = cipher;
  24908. result.push(cipher);
  24909. buffer = new Uint8Array(16);
  24910. bufferLength = 0;
  24911. }
  24912. this.buffer = buffer;
  24913. this.bufferLength = bufferLength;
  24914. this.iv = iv;
  24915. if (result.length === 0) {
  24916. return new Uint8Array([]);
  24917. }
  24918. var outputLength = 16 * result.length;
  24919. var output = new Uint8Array(outputLength);
  24920. for (i = 0, j = 0, ii = result.length; i < ii; ++i, j += 16) {
  24921. output.set(result[i], j);
  24922. }
  24923. return output;
  24924. }
  24925. };
  24926. return AES256Cipher;
  24927. }();
  24928. var PDF17 = function PDF17Closure() {
  24929. function compareByteArrays(array1, array2) {
  24930. if (array1.length !== array2.length) {
  24931. return false;
  24932. }
  24933. for (var i = 0; i < array1.length; i++) {
  24934. if (array1[i] !== array2[i]) {
  24935. return false;
  24936. }
  24937. }
  24938. return true;
  24939. }
  24940. function PDF17() {
  24941. }
  24942. PDF17.prototype = {
  24943. checkOwnerPassword: function PDF17_checkOwnerPassword(password, ownerValidationSalt, userBytes, ownerPassword) {
  24944. var hashData = new Uint8Array(password.length + 56);
  24945. hashData.set(password, 0);
  24946. hashData.set(ownerValidationSalt, password.length);
  24947. hashData.set(userBytes, password.length + ownerValidationSalt.length);
  24948. var result = calculateSHA256(hashData, 0, hashData.length);
  24949. return compareByteArrays(result, ownerPassword);
  24950. },
  24951. checkUserPassword: function PDF17_checkUserPassword(password, userValidationSalt, userPassword) {
  24952. var hashData = new Uint8Array(password.length + 8);
  24953. hashData.set(password, 0);
  24954. hashData.set(userValidationSalt, password.length);
  24955. var result = calculateSHA256(hashData, 0, hashData.length);
  24956. return compareByteArrays(result, userPassword);
  24957. },
  24958. getOwnerKey: function PDF17_getOwnerKey(password, ownerKeySalt, userBytes, ownerEncryption) {
  24959. var hashData = new Uint8Array(password.length + 56);
  24960. hashData.set(password, 0);
  24961. hashData.set(ownerKeySalt, password.length);
  24962. hashData.set(userBytes, password.length + ownerKeySalt.length);
  24963. var key = calculateSHA256(hashData, 0, hashData.length);
  24964. var cipher = new AES256Cipher(key);
  24965. return cipher.decryptBlock(ownerEncryption, false, new Uint8Array(16));
  24966. },
  24967. getUserKey: function PDF17_getUserKey(password, userKeySalt, userEncryption) {
  24968. var hashData = new Uint8Array(password.length + 8);
  24969. hashData.set(password, 0);
  24970. hashData.set(userKeySalt, password.length);
  24971. var key = calculateSHA256(hashData, 0, hashData.length);
  24972. var cipher = new AES256Cipher(key);
  24973. return cipher.decryptBlock(userEncryption, false, new Uint8Array(16));
  24974. }
  24975. };
  24976. return PDF17;
  24977. }();
  24978. var PDF20 = function PDF20Closure() {
  24979. function concatArrays(array1, array2) {
  24980. var t = new Uint8Array(array1.length + array2.length);
  24981. t.set(array1, 0);
  24982. t.set(array2, array1.length);
  24983. return t;
  24984. }
  24985. function calculatePDF20Hash(password, input, userBytes) {
  24986. var k = calculateSHA256(input, 0, input.length).subarray(0, 32);
  24987. var e = [0];
  24988. var i = 0;
  24989. while (i < 64 || e[e.length - 1] > i - 32) {
  24990. var arrayLength = password.length + k.length + userBytes.length;
  24991. var k1 = new Uint8Array(arrayLength * 64);
  24992. var array = concatArrays(password, k);
  24993. array = concatArrays(array, userBytes);
  24994. for (var j = 0, pos = 0; j < 64; j++, pos += arrayLength) {
  24995. k1.set(array, pos);
  24996. }
  24997. var cipher = new AES128Cipher(k.subarray(0, 16));
  24998. e = cipher.encrypt(k1, k.subarray(16, 32));
  24999. var remainder = 0;
  25000. for (var z = 0; z < 16; z++) {
  25001. remainder *= 256 % 3;
  25002. remainder %= 3;
  25003. remainder += (e[z] >>> 0) % 3;
  25004. remainder %= 3;
  25005. }
  25006. if (remainder === 0) {
  25007. k = calculateSHA256(e, 0, e.length);
  25008. } else if (remainder === 1) {
  25009. k = calculateSHA384(e, 0, e.length);
  25010. } else if (remainder === 2) {
  25011. k = calculateSHA512(e, 0, e.length);
  25012. }
  25013. i++;
  25014. }
  25015. return k.subarray(0, 32);
  25016. }
  25017. function PDF20() {
  25018. }
  25019. function compareByteArrays(array1, array2) {
  25020. if (array1.length !== array2.length) {
  25021. return false;
  25022. }
  25023. for (var i = 0; i < array1.length; i++) {
  25024. if (array1[i] !== array2[i]) {
  25025. return false;
  25026. }
  25027. }
  25028. return true;
  25029. }
  25030. PDF20.prototype = {
  25031. hash: function PDF20_hash(password, concatBytes, userBytes) {
  25032. return calculatePDF20Hash(password, concatBytes, userBytes);
  25033. },
  25034. checkOwnerPassword: function PDF20_checkOwnerPassword(password, ownerValidationSalt, userBytes, ownerPassword) {
  25035. var hashData = new Uint8Array(password.length + 56);
  25036. hashData.set(password, 0);
  25037. hashData.set(ownerValidationSalt, password.length);
  25038. hashData.set(userBytes, password.length + ownerValidationSalt.length);
  25039. var result = calculatePDF20Hash(password, hashData, userBytes);
  25040. return compareByteArrays(result, ownerPassword);
  25041. },
  25042. checkUserPassword: function PDF20_checkUserPassword(password, userValidationSalt, userPassword) {
  25043. var hashData = new Uint8Array(password.length + 8);
  25044. hashData.set(password, 0);
  25045. hashData.set(userValidationSalt, password.length);
  25046. var result = calculatePDF20Hash(password, hashData, []);
  25047. return compareByteArrays(result, userPassword);
  25048. },
  25049. getOwnerKey: function PDF20_getOwnerKey(password, ownerKeySalt, userBytes, ownerEncryption) {
  25050. var hashData = new Uint8Array(password.length + 56);
  25051. hashData.set(password, 0);
  25052. hashData.set(ownerKeySalt, password.length);
  25053. hashData.set(userBytes, password.length + ownerKeySalt.length);
  25054. var key = calculatePDF20Hash(password, hashData, userBytes);
  25055. var cipher = new AES256Cipher(key);
  25056. return cipher.decryptBlock(ownerEncryption, false, new Uint8Array(16));
  25057. },
  25058. getUserKey: function PDF20_getUserKey(password, userKeySalt, userEncryption) {
  25059. var hashData = new Uint8Array(password.length + 8);
  25060. hashData.set(password, 0);
  25061. hashData.set(userKeySalt, password.length);
  25062. var key = calculatePDF20Hash(password, hashData, []);
  25063. var cipher = new AES256Cipher(key);
  25064. return cipher.decryptBlock(userEncryption, false, new Uint8Array(16));
  25065. }
  25066. };
  25067. return PDF20;
  25068. }();
  25069. var CipherTransform = function CipherTransformClosure() {
  25070. function CipherTransform(stringCipherConstructor, streamCipherConstructor) {
  25071. this.StringCipherConstructor = stringCipherConstructor;
  25072. this.StreamCipherConstructor = streamCipherConstructor;
  25073. }
  25074. CipherTransform.prototype = {
  25075. createStream: function CipherTransform_createStream(stream, length) {
  25076. var cipher = new this.StreamCipherConstructor();
  25077. return new DecryptStream(stream, length, function cipherTransformDecryptStream(data, finalize) {
  25078. return cipher.decryptBlock(data, finalize);
  25079. });
  25080. },
  25081. decryptString: function CipherTransform_decryptString(s) {
  25082. var cipher = new this.StringCipherConstructor();
  25083. var data = stringToBytes(s);
  25084. data = cipher.decryptBlock(data, true);
  25085. return bytesToString(data);
  25086. }
  25087. };
  25088. return CipherTransform;
  25089. }();
  25090. var CipherTransformFactory = function CipherTransformFactoryClosure() {
  25091. var defaultPasswordBytes = new Uint8Array([
  25092. 0x28,
  25093. 0xBF,
  25094. 0x4E,
  25095. 0x5E,
  25096. 0x4E,
  25097. 0x75,
  25098. 0x8A,
  25099. 0x41,
  25100. 0x64,
  25101. 0x00,
  25102. 0x4E,
  25103. 0x56,
  25104. 0xFF,
  25105. 0xFA,
  25106. 0x01,
  25107. 0x08,
  25108. 0x2E,
  25109. 0x2E,
  25110. 0x00,
  25111. 0xB6,
  25112. 0xD0,
  25113. 0x68,
  25114. 0x3E,
  25115. 0x80,
  25116. 0x2F,
  25117. 0x0C,
  25118. 0xA9,
  25119. 0xFE,
  25120. 0x64,
  25121. 0x53,
  25122. 0x69,
  25123. 0x7A
  25124. ]);
  25125. function createEncryptionKey20(revision, password, ownerPassword, ownerValidationSalt, ownerKeySalt, uBytes, userPassword, userValidationSalt, userKeySalt, ownerEncryption, userEncryption, perms) {
  25126. if (password) {
  25127. var passwordLength = Math.min(127, password.length);
  25128. password = password.subarray(0, passwordLength);
  25129. } else {
  25130. password = [];
  25131. }
  25132. var pdfAlgorithm;
  25133. if (revision === 6) {
  25134. pdfAlgorithm = new PDF20();
  25135. } else {
  25136. pdfAlgorithm = new PDF17();
  25137. }
  25138. if (pdfAlgorithm.checkUserPassword(password, userValidationSalt, userPassword)) {
  25139. return pdfAlgorithm.getUserKey(password, userKeySalt, userEncryption);
  25140. } else if (password.length && pdfAlgorithm.checkOwnerPassword(password, ownerValidationSalt, uBytes, ownerPassword)) {
  25141. return pdfAlgorithm.getOwnerKey(password, ownerKeySalt, uBytes, ownerEncryption);
  25142. }
  25143. return null;
  25144. }
  25145. function prepareKeyData(fileId, password, ownerPassword, userPassword, flags, revision, keyLength, encryptMetadata) {
  25146. var hashDataSize = 40 + ownerPassword.length + fileId.length;
  25147. var hashData = new Uint8Array(hashDataSize), i = 0, j, n;
  25148. if (password) {
  25149. n = Math.min(32, password.length);
  25150. for (; i < n; ++i) {
  25151. hashData[i] = password[i];
  25152. }
  25153. }
  25154. j = 0;
  25155. while (i < 32) {
  25156. hashData[i++] = defaultPasswordBytes[j++];
  25157. }
  25158. for (j = 0, n = ownerPassword.length; j < n; ++j) {
  25159. hashData[i++] = ownerPassword[j];
  25160. }
  25161. hashData[i++] = flags & 0xFF;
  25162. hashData[i++] = flags >> 8 & 0xFF;
  25163. hashData[i++] = flags >> 16 & 0xFF;
  25164. hashData[i++] = flags >>> 24 & 0xFF;
  25165. for (j = 0, n = fileId.length; j < n; ++j) {
  25166. hashData[i++] = fileId[j];
  25167. }
  25168. if (revision >= 4 && !encryptMetadata) {
  25169. hashData[i++] = 0xFF;
  25170. hashData[i++] = 0xFF;
  25171. hashData[i++] = 0xFF;
  25172. hashData[i++] = 0xFF;
  25173. }
  25174. var hash = calculateMD5(hashData, 0, i);
  25175. var keyLengthInBytes = keyLength >> 3;
  25176. if (revision >= 3) {
  25177. for (j = 0; j < 50; ++j) {
  25178. hash = calculateMD5(hash, 0, keyLengthInBytes);
  25179. }
  25180. }
  25181. var encryptionKey = hash.subarray(0, keyLengthInBytes);
  25182. var cipher, checkData;
  25183. if (revision >= 3) {
  25184. for (i = 0; i < 32; ++i) {
  25185. hashData[i] = defaultPasswordBytes[i];
  25186. }
  25187. for (j = 0, n = fileId.length; j < n; ++j) {
  25188. hashData[i++] = fileId[j];
  25189. }
  25190. cipher = new ARCFourCipher(encryptionKey);
  25191. checkData = cipher.encryptBlock(calculateMD5(hashData, 0, i));
  25192. n = encryptionKey.length;
  25193. var derivedKey = new Uint8Array(n), k;
  25194. for (j = 1; j <= 19; ++j) {
  25195. for (k = 0; k < n; ++k) {
  25196. derivedKey[k] = encryptionKey[k] ^ j;
  25197. }
  25198. cipher = new ARCFourCipher(derivedKey);
  25199. checkData = cipher.encryptBlock(checkData);
  25200. }
  25201. for (j = 0, n = checkData.length; j < n; ++j) {
  25202. if (userPassword[j] !== checkData[j]) {
  25203. return null;
  25204. }
  25205. }
  25206. } else {
  25207. cipher = new ARCFourCipher(encryptionKey);
  25208. checkData = cipher.encryptBlock(defaultPasswordBytes);
  25209. for (j = 0, n = checkData.length; j < n; ++j) {
  25210. if (userPassword[j] !== checkData[j]) {
  25211. return null;
  25212. }
  25213. }
  25214. }
  25215. return encryptionKey;
  25216. }
  25217. function decodeUserPassword(password, ownerPassword, revision, keyLength) {
  25218. var hashData = new Uint8Array(32), i = 0, j, n;
  25219. n = Math.min(32, password.length);
  25220. for (; i < n; ++i) {
  25221. hashData[i] = password[i];
  25222. }
  25223. j = 0;
  25224. while (i < 32) {
  25225. hashData[i++] = defaultPasswordBytes[j++];
  25226. }
  25227. var hash = calculateMD5(hashData, 0, i);
  25228. var keyLengthInBytes = keyLength >> 3;
  25229. if (revision >= 3) {
  25230. for (j = 0; j < 50; ++j) {
  25231. hash = calculateMD5(hash, 0, hash.length);
  25232. }
  25233. }
  25234. var cipher, userPassword;
  25235. if (revision >= 3) {
  25236. userPassword = ownerPassword;
  25237. var derivedKey = new Uint8Array(keyLengthInBytes), k;
  25238. for (j = 19; j >= 0; j--) {
  25239. for (k = 0; k < keyLengthInBytes; ++k) {
  25240. derivedKey[k] = hash[k] ^ j;
  25241. }
  25242. cipher = new ARCFourCipher(derivedKey);
  25243. userPassword = cipher.encryptBlock(userPassword);
  25244. }
  25245. } else {
  25246. cipher = new ARCFourCipher(hash.subarray(0, keyLengthInBytes));
  25247. userPassword = cipher.encryptBlock(ownerPassword);
  25248. }
  25249. return userPassword;
  25250. }
  25251. var identityName = Name.get('Identity');
  25252. function CipherTransformFactory(dict, fileId, password) {
  25253. var filter = dict.get('Filter');
  25254. if (!isName(filter, 'Standard')) {
  25255. error('unknown encryption method');
  25256. }
  25257. this.dict = dict;
  25258. var algorithm = dict.get('V');
  25259. if (!isInt(algorithm) || algorithm !== 1 && algorithm !== 2 && algorithm !== 4 && algorithm !== 5) {
  25260. error('unsupported encryption algorithm');
  25261. }
  25262. this.algorithm = algorithm;
  25263. var keyLength = dict.get('Length');
  25264. if (!keyLength) {
  25265. if (algorithm <= 3) {
  25266. keyLength = 40;
  25267. } else {
  25268. var cfDict = dict.get('CF');
  25269. var streamCryptoName = dict.get('StmF');
  25270. if (isDict(cfDict) && isName(streamCryptoName)) {
  25271. cfDict.suppressEncryption = true;
  25272. var handlerDict = cfDict.get(streamCryptoName.name);
  25273. keyLength = handlerDict && handlerDict.get('Length') || 128;
  25274. if (keyLength < 40) {
  25275. keyLength <<= 3;
  25276. }
  25277. }
  25278. }
  25279. }
  25280. if (!isInt(keyLength) || keyLength < 40 || keyLength % 8 !== 0) {
  25281. error('invalid key length');
  25282. }
  25283. var ownerPassword = stringToBytes(dict.get('O')).subarray(0, 32);
  25284. var userPassword = stringToBytes(dict.get('U')).subarray(0, 32);
  25285. var flags = dict.get('P');
  25286. var revision = dict.get('R');
  25287. var encryptMetadata = (algorithm === 4 || algorithm === 5) && dict.get('EncryptMetadata') !== false;
  25288. this.encryptMetadata = encryptMetadata;
  25289. var fileIdBytes = stringToBytes(fileId);
  25290. var passwordBytes;
  25291. if (password) {
  25292. if (revision === 6) {
  25293. try {
  25294. password = utf8StringToString(password);
  25295. } catch (ex) {
  25296. warn('CipherTransformFactory: ' + 'Unable to convert UTF8 encoded password.');
  25297. }
  25298. }
  25299. passwordBytes = stringToBytes(password);
  25300. }
  25301. var encryptionKey;
  25302. if (algorithm !== 5) {
  25303. encryptionKey = prepareKeyData(fileIdBytes, passwordBytes, ownerPassword, userPassword, flags, revision, keyLength, encryptMetadata);
  25304. } else {
  25305. var ownerValidationSalt = stringToBytes(dict.get('O')).subarray(32, 40);
  25306. var ownerKeySalt = stringToBytes(dict.get('O')).subarray(40, 48);
  25307. var uBytes = stringToBytes(dict.get('U')).subarray(0, 48);
  25308. var userValidationSalt = stringToBytes(dict.get('U')).subarray(32, 40);
  25309. var userKeySalt = stringToBytes(dict.get('U')).subarray(40, 48);
  25310. var ownerEncryption = stringToBytes(dict.get('OE'));
  25311. var userEncryption = stringToBytes(dict.get('UE'));
  25312. var perms = stringToBytes(dict.get('Perms'));
  25313. encryptionKey = createEncryptionKey20(revision, passwordBytes, ownerPassword, ownerValidationSalt, ownerKeySalt, uBytes, userPassword, userValidationSalt, userKeySalt, ownerEncryption, userEncryption, perms);
  25314. }
  25315. if (!encryptionKey && !password) {
  25316. throw new PasswordException('No password given', PasswordResponses.NEED_PASSWORD);
  25317. } else if (!encryptionKey && password) {
  25318. var decodedPassword = decodeUserPassword(passwordBytes, ownerPassword, revision, keyLength);
  25319. encryptionKey = prepareKeyData(fileIdBytes, decodedPassword, ownerPassword, userPassword, flags, revision, keyLength, encryptMetadata);
  25320. }
  25321. if (!encryptionKey) {
  25322. throw new PasswordException('Incorrect Password', PasswordResponses.INCORRECT_PASSWORD);
  25323. }
  25324. this.encryptionKey = encryptionKey;
  25325. if (algorithm >= 4) {
  25326. var cf = dict.get('CF');
  25327. if (isDict(cf)) {
  25328. cf.suppressEncryption = true;
  25329. }
  25330. this.cf = cf;
  25331. this.stmf = dict.get('StmF') || identityName;
  25332. this.strf = dict.get('StrF') || identityName;
  25333. this.eff = dict.get('EFF') || this.stmf;
  25334. }
  25335. }
  25336. function buildObjectKey(num, gen, encryptionKey, isAes) {
  25337. var key = new Uint8Array(encryptionKey.length + 9), i, n;
  25338. for (i = 0, n = encryptionKey.length; i < n; ++i) {
  25339. key[i] = encryptionKey[i];
  25340. }
  25341. key[i++] = num & 0xFF;
  25342. key[i++] = num >> 8 & 0xFF;
  25343. key[i++] = num >> 16 & 0xFF;
  25344. key[i++] = gen & 0xFF;
  25345. key[i++] = gen >> 8 & 0xFF;
  25346. if (isAes) {
  25347. key[i++] = 0x73;
  25348. key[i++] = 0x41;
  25349. key[i++] = 0x6C;
  25350. key[i++] = 0x54;
  25351. }
  25352. var hash = calculateMD5(key, 0, i);
  25353. return hash.subarray(0, Math.min(encryptionKey.length + 5, 16));
  25354. }
  25355. function buildCipherConstructor(cf, name, num, gen, key) {
  25356. assert(isName(name), 'Invalid crypt filter name.');
  25357. var cryptFilter = cf.get(name.name);
  25358. var cfm;
  25359. if (cryptFilter !== null && cryptFilter !== undefined) {
  25360. cfm = cryptFilter.get('CFM');
  25361. }
  25362. if (!cfm || cfm.name === 'None') {
  25363. return function cipherTransformFactoryBuildCipherConstructorNone() {
  25364. return new NullCipher();
  25365. };
  25366. }
  25367. if (cfm.name === 'V2') {
  25368. return function cipherTransformFactoryBuildCipherConstructorV2() {
  25369. return new ARCFourCipher(buildObjectKey(num, gen, key, false));
  25370. };
  25371. }
  25372. if (cfm.name === 'AESV2') {
  25373. return function cipherTransformFactoryBuildCipherConstructorAESV2() {
  25374. return new AES128Cipher(buildObjectKey(num, gen, key, true));
  25375. };
  25376. }
  25377. if (cfm.name === 'AESV3') {
  25378. return function cipherTransformFactoryBuildCipherConstructorAESV3() {
  25379. return new AES256Cipher(key);
  25380. };
  25381. }
  25382. error('Unknown crypto method');
  25383. }
  25384. CipherTransformFactory.prototype = {
  25385. createCipherTransform: function CipherTransformFactory_createCipherTransform(num, gen) {
  25386. if (this.algorithm === 4 || this.algorithm === 5) {
  25387. return new CipherTransform(buildCipherConstructor(this.cf, this.stmf, num, gen, this.encryptionKey), buildCipherConstructor(this.cf, this.strf, num, gen, this.encryptionKey));
  25388. }
  25389. var key = buildObjectKey(num, gen, this.encryptionKey, false);
  25390. var cipherConstructor = function buildCipherCipherConstructor() {
  25391. return new ARCFourCipher(key);
  25392. };
  25393. return new CipherTransform(cipherConstructor, cipherConstructor);
  25394. }
  25395. };
  25396. return CipherTransformFactory;
  25397. }();
  25398. exports.AES128Cipher = AES128Cipher;
  25399. exports.AES256Cipher = AES256Cipher;
  25400. exports.ARCFourCipher = ARCFourCipher;
  25401. exports.CipherTransformFactory = CipherTransformFactory;
  25402. exports.PDF17 = PDF17;
  25403. exports.PDF20 = PDF20;
  25404. exports.calculateMD5 = calculateMD5;
  25405. exports.calculateSHA256 = calculateSHA256;
  25406. exports.calculateSHA384 = calculateSHA384;
  25407. exports.calculateSHA512 = calculateSHA512;
  25408. /***/ }),
  25409. /* 14 */
  25410. /***/ (function(module, exports, __w_pdfjs_require__) {
  25411. "use strict";
  25412. var sharedUtil = __w_pdfjs_require__(0);
  25413. var corePrimitives = __w_pdfjs_require__(1);
  25414. var coreStream = __w_pdfjs_require__(2);
  25415. var coreParser = __w_pdfjs_require__(5);
  25416. var coreImage = __w_pdfjs_require__(27);
  25417. var coreColorSpace = __w_pdfjs_require__(3);
  25418. var coreMurmurHash3 = __w_pdfjs_require__(31);
  25419. var coreFonts = __w_pdfjs_require__(26);
  25420. var coreFunction = __w_pdfjs_require__(6);
  25421. var corePattern = __w_pdfjs_require__(32);
  25422. var coreCMap = __w_pdfjs_require__(23);
  25423. var coreMetrics = __w_pdfjs_require__(30);
  25424. var coreBidi = __w_pdfjs_require__(21);
  25425. var coreEncodings = __w_pdfjs_require__(4);
  25426. var coreStandardFonts = __w_pdfjs_require__(17);
  25427. var coreUnicode = __w_pdfjs_require__(18);
  25428. var coreGlyphList = __w_pdfjs_require__(7);
  25429. var FONT_IDENTITY_MATRIX = sharedUtil.FONT_IDENTITY_MATRIX;
  25430. var IDENTITY_MATRIX = sharedUtil.IDENTITY_MATRIX;
  25431. var UNSUPPORTED_FEATURES = sharedUtil.UNSUPPORTED_FEATURES;
  25432. var ImageKind = sharedUtil.ImageKind;
  25433. var OPS = sharedUtil.OPS;
  25434. var TextRenderingMode = sharedUtil.TextRenderingMode;
  25435. var CMapCompressionType = sharedUtil.CMapCompressionType;
  25436. var Util = sharedUtil.Util;
  25437. var assert = sharedUtil.assert;
  25438. var createPromiseCapability = sharedUtil.createPromiseCapability;
  25439. var error = sharedUtil.error;
  25440. var info = sharedUtil.info;
  25441. var isArray = sharedUtil.isArray;
  25442. var isNum = sharedUtil.isNum;
  25443. var isString = sharedUtil.isString;
  25444. var getLookupTableFactory = sharedUtil.getLookupTableFactory;
  25445. var warn = sharedUtil.warn;
  25446. var Dict = corePrimitives.Dict;
  25447. var Name = corePrimitives.Name;
  25448. var isEOF = corePrimitives.isEOF;
  25449. var isCmd = corePrimitives.isCmd;
  25450. var isDict = corePrimitives.isDict;
  25451. var isName = corePrimitives.isName;
  25452. var isRef = corePrimitives.isRef;
  25453. var isStream = corePrimitives.isStream;
  25454. var DecodeStream = coreStream.DecodeStream;
  25455. var JpegStream = coreStream.JpegStream;
  25456. var Stream = coreStream.Stream;
  25457. var Lexer = coreParser.Lexer;
  25458. var Parser = coreParser.Parser;
  25459. var PDFImage = coreImage.PDFImage;
  25460. var ColorSpace = coreColorSpace.ColorSpace;
  25461. var MurmurHash3_64 = coreMurmurHash3.MurmurHash3_64;
  25462. var ErrorFont = coreFonts.ErrorFont;
  25463. var FontFlags = coreFonts.FontFlags;
  25464. var Font = coreFonts.Font;
  25465. var IdentityToUnicodeMap = coreFonts.IdentityToUnicodeMap;
  25466. var ToUnicodeMap = coreFonts.ToUnicodeMap;
  25467. var getFontType = coreFonts.getFontType;
  25468. var isPDFFunction = coreFunction.isPDFFunction;
  25469. var PDFFunction = coreFunction.PDFFunction;
  25470. var Pattern = corePattern.Pattern;
  25471. var getTilingPatternIR = corePattern.getTilingPatternIR;
  25472. var CMapFactory = coreCMap.CMapFactory;
  25473. var IdentityCMap = coreCMap.IdentityCMap;
  25474. var getMetrics = coreMetrics.getMetrics;
  25475. var bidi = coreBidi.bidi;
  25476. var WinAnsiEncoding = coreEncodings.WinAnsiEncoding;
  25477. var StandardEncoding = coreEncodings.StandardEncoding;
  25478. var MacRomanEncoding = coreEncodings.MacRomanEncoding;
  25479. var SymbolSetEncoding = coreEncodings.SymbolSetEncoding;
  25480. var ZapfDingbatsEncoding = coreEncodings.ZapfDingbatsEncoding;
  25481. var getEncoding = coreEncodings.getEncoding;
  25482. var getStdFontMap = coreStandardFonts.getStdFontMap;
  25483. var getSerifFonts = coreStandardFonts.getSerifFonts;
  25484. var getSymbolsFonts = coreStandardFonts.getSymbolsFonts;
  25485. var getNormalizedUnicodes = coreUnicode.getNormalizedUnicodes;
  25486. var reverseIfRtl = coreUnicode.reverseIfRtl;
  25487. var getUnicodeForGlyph = coreUnicode.getUnicodeForGlyph;
  25488. var getGlyphsUnicode = coreGlyphList.getGlyphsUnicode;
  25489. var PartialEvaluator = function PartialEvaluatorClosure() {
  25490. var DefaultPartialEvaluatorOptions = {
  25491. forceDataSchema: false,
  25492. maxImageSize: -1,
  25493. disableFontFace: false,
  25494. disableNativeImageDecoder: false
  25495. };
  25496. function NativeImageDecoder(xref, resources, handler, forceDataSchema) {
  25497. this.xref = xref;
  25498. this.resources = resources;
  25499. this.handler = handler;
  25500. this.forceDataSchema = forceDataSchema;
  25501. }
  25502. NativeImageDecoder.prototype = {
  25503. canDecode: function (image) {
  25504. return image instanceof JpegStream && NativeImageDecoder.isDecodable(image, this.xref, this.resources);
  25505. },
  25506. decode: function (image) {
  25507. var dict = image.dict;
  25508. var colorSpace = dict.get('ColorSpace', 'CS');
  25509. colorSpace = ColorSpace.parse(colorSpace, this.xref, this.resources);
  25510. var numComps = colorSpace.numComps;
  25511. var decodePromise = this.handler.sendWithPromise('JpegDecode', [
  25512. image.getIR(this.forceDataSchema),
  25513. numComps
  25514. ]);
  25515. return decodePromise.then(function (message) {
  25516. var data = message.data;
  25517. return new Stream(data, 0, data.length, image.dict);
  25518. });
  25519. }
  25520. };
  25521. NativeImageDecoder.isSupported = function NativeImageDecoder_isSupported(image, xref, res) {
  25522. var dict = image.dict;
  25523. if (dict.has('DecodeParms') || dict.has('DP')) {
  25524. return false;
  25525. }
  25526. var cs = ColorSpace.parse(dict.get('ColorSpace', 'CS'), xref, res);
  25527. return (cs.name === 'DeviceGray' || cs.name === 'DeviceRGB') && cs.isDefaultDecode(dict.getArray('Decode', 'D'));
  25528. };
  25529. NativeImageDecoder.isDecodable = function NativeImageDecoder_isDecodable(image, xref, res) {
  25530. var dict = image.dict;
  25531. if (dict.has('DecodeParms') || dict.has('DP')) {
  25532. return false;
  25533. }
  25534. var cs = ColorSpace.parse(dict.get('ColorSpace', 'CS'), xref, res);
  25535. return (cs.numComps === 1 || cs.numComps === 3) && cs.isDefaultDecode(dict.getArray('Decode', 'D'));
  25536. };
  25537. function PartialEvaluator(pdfManager, xref, handler, pageIndex, idFactory, fontCache, builtInCMapCache, options) {
  25538. this.pdfManager = pdfManager;
  25539. this.xref = xref;
  25540. this.handler = handler;
  25541. this.pageIndex = pageIndex;
  25542. this.idFactory = idFactory;
  25543. this.fontCache = fontCache;
  25544. this.builtInCMapCache = builtInCMapCache;
  25545. this.options = options || DefaultPartialEvaluatorOptions;
  25546. this.fetchBuiltInCMap = function (name) {
  25547. var cachedCMap = builtInCMapCache[name];
  25548. if (cachedCMap) {
  25549. return Promise.resolve(cachedCMap);
  25550. }
  25551. return handler.sendWithPromise('FetchBuiltInCMap', { name: name }).then(function (data) {
  25552. if (data.compressionType !== CMapCompressionType.NONE) {
  25553. builtInCMapCache[name] = data;
  25554. }
  25555. return data;
  25556. });
  25557. };
  25558. }
  25559. var TIME_SLOT_DURATION_MS = 20;
  25560. var CHECK_TIME_EVERY = 100;
  25561. function TimeSlotManager() {
  25562. this.reset();
  25563. }
  25564. TimeSlotManager.prototype = {
  25565. check: function TimeSlotManager_check() {
  25566. if (++this.checked < CHECK_TIME_EVERY) {
  25567. return false;
  25568. }
  25569. this.checked = 0;
  25570. return this.endTime <= Date.now();
  25571. },
  25572. reset: function TimeSlotManager_reset() {
  25573. this.endTime = Date.now() + TIME_SLOT_DURATION_MS;
  25574. this.checked = 0;
  25575. }
  25576. };
  25577. var deferred = Promise.resolve();
  25578. var TILING_PATTERN = 1, SHADING_PATTERN = 2;
  25579. PartialEvaluator.prototype = {
  25580. hasBlendModes: function PartialEvaluator_hasBlendModes(resources) {
  25581. if (!isDict(resources)) {
  25582. return false;
  25583. }
  25584. var processed = Object.create(null);
  25585. if (resources.objId) {
  25586. processed[resources.objId] = true;
  25587. }
  25588. var nodes = [resources], xref = this.xref;
  25589. while (nodes.length) {
  25590. var key, i, ii;
  25591. var node = nodes.shift();
  25592. var graphicStates = node.get('ExtGState');
  25593. if (isDict(graphicStates)) {
  25594. var graphicStatesKeys = graphicStates.getKeys();
  25595. for (i = 0, ii = graphicStatesKeys.length; i < ii; i++) {
  25596. key = graphicStatesKeys[i];
  25597. var graphicState = graphicStates.get(key);
  25598. var bm = graphicState.get('BM');
  25599. if (isName(bm) && bm.name !== 'Normal') {
  25600. return true;
  25601. }
  25602. }
  25603. }
  25604. var xObjects = node.get('XObject');
  25605. if (!isDict(xObjects)) {
  25606. continue;
  25607. }
  25608. var xObjectsKeys = xObjects.getKeys();
  25609. for (i = 0, ii = xObjectsKeys.length; i < ii; i++) {
  25610. key = xObjectsKeys[i];
  25611. var xObject = xObjects.getRaw(key);
  25612. if (isRef(xObject)) {
  25613. if (processed[xObject.toString()]) {
  25614. continue;
  25615. }
  25616. xObject = xref.fetch(xObject);
  25617. }
  25618. if (!isStream(xObject)) {
  25619. continue;
  25620. }
  25621. if (xObject.dict.objId) {
  25622. if (processed[xObject.dict.objId]) {
  25623. continue;
  25624. }
  25625. processed[xObject.dict.objId] = true;
  25626. }
  25627. var xResources = xObject.dict.get('Resources');
  25628. if (isDict(xResources) && (!xResources.objId || !processed[xResources.objId])) {
  25629. nodes.push(xResources);
  25630. if (xResources.objId) {
  25631. processed[xResources.objId] = true;
  25632. }
  25633. }
  25634. }
  25635. }
  25636. return false;
  25637. },
  25638. buildFormXObject: function PartialEvaluator_buildFormXObject(resources, xobj, smask, operatorList, task, initialState) {
  25639. var matrix = xobj.dict.getArray('Matrix');
  25640. var bbox = xobj.dict.getArray('BBox');
  25641. var group = xobj.dict.get('Group');
  25642. if (group) {
  25643. var groupOptions = {
  25644. matrix: matrix,
  25645. bbox: bbox,
  25646. smask: smask,
  25647. isolated: false,
  25648. knockout: false
  25649. };
  25650. var groupSubtype = group.get('S');
  25651. var colorSpace;
  25652. if (isName(groupSubtype, 'Transparency')) {
  25653. groupOptions.isolated = group.get('I') || false;
  25654. groupOptions.knockout = group.get('K') || false;
  25655. colorSpace = group.has('CS') ? ColorSpace.parse(group.get('CS'), this.xref, resources) : null;
  25656. }
  25657. if (smask && smask.backdrop) {
  25658. colorSpace = colorSpace || ColorSpace.singletons.rgb;
  25659. smask.backdrop = colorSpace.getRgb(smask.backdrop, 0);
  25660. }
  25661. operatorList.addOp(OPS.beginGroup, [groupOptions]);
  25662. }
  25663. operatorList.addOp(OPS.paintFormXObjectBegin, [
  25664. matrix,
  25665. bbox
  25666. ]);
  25667. return this.getOperatorList(xobj, task, xobj.dict.get('Resources') || resources, operatorList, initialState).then(function () {
  25668. operatorList.addOp(OPS.paintFormXObjectEnd, []);
  25669. if (group) {
  25670. operatorList.addOp(OPS.endGroup, [groupOptions]);
  25671. }
  25672. });
  25673. },
  25674. buildPaintImageXObject: function PartialEvaluator_buildPaintImageXObject(resources, image, inline, operatorList, cacheKey, imageCache) {
  25675. var self = this;
  25676. var dict = image.dict;
  25677. var w = dict.get('Width', 'W');
  25678. var h = dict.get('Height', 'H');
  25679. if (!(w && isNum(w)) || !(h && isNum(h))) {
  25680. warn('Image dimensions are missing, or not numbers.');
  25681. return;
  25682. }
  25683. var maxImageSize = this.options.maxImageSize;
  25684. if (maxImageSize !== -1 && w * h > maxImageSize) {
  25685. warn('Image exceeded maximum allowed size and was removed.');
  25686. return;
  25687. }
  25688. var imageMask = dict.get('ImageMask', 'IM') || false;
  25689. var imgData, args;
  25690. if (imageMask) {
  25691. var width = dict.get('Width', 'W');
  25692. var height = dict.get('Height', 'H');
  25693. var bitStrideLength = width + 7 >> 3;
  25694. var imgArray = image.getBytes(bitStrideLength * height);
  25695. var decode = dict.getArray('Decode', 'D');
  25696. var inverseDecode = !!decode && decode[0] > 0;
  25697. imgData = PDFImage.createMask(imgArray, width, height, image instanceof DecodeStream, inverseDecode);
  25698. imgData.cached = true;
  25699. args = [imgData];
  25700. operatorList.addOp(OPS.paintImageMaskXObject, args);
  25701. if (cacheKey) {
  25702. imageCache[cacheKey] = {
  25703. fn: OPS.paintImageMaskXObject,
  25704. args: args
  25705. };
  25706. }
  25707. return;
  25708. }
  25709. var softMask = dict.get('SMask', 'SM') || false;
  25710. var mask = dict.get('Mask') || false;
  25711. var SMALL_IMAGE_DIMENSIONS = 200;
  25712. if (inline && !softMask && !mask && !(image instanceof JpegStream) && w + h < SMALL_IMAGE_DIMENSIONS) {
  25713. var imageObj = new PDFImage(this.xref, resources, image, inline, null, null);
  25714. imgData = imageObj.createImageData(true);
  25715. operatorList.addOp(OPS.paintInlineImageXObject, [imgData]);
  25716. return;
  25717. }
  25718. var useNativeImageDecoder = !this.options.disableNativeImageDecoder;
  25719. var objId = 'img_' + this.idFactory.createObjId();
  25720. operatorList.addDependency(objId);
  25721. args = [
  25722. objId,
  25723. w,
  25724. h
  25725. ];
  25726. if (useNativeImageDecoder && !softMask && !mask && image instanceof JpegStream && NativeImageDecoder.isSupported(image, this.xref, resources)) {
  25727. operatorList.addOp(OPS.paintJpegXObject, args);
  25728. this.handler.send('obj', [
  25729. objId,
  25730. this.pageIndex,
  25731. 'JpegStream',
  25732. image.getIR(this.options.forceDataSchema)
  25733. ]);
  25734. return;
  25735. }
  25736. var nativeImageDecoder = null;
  25737. if (useNativeImageDecoder && (image instanceof JpegStream || mask instanceof JpegStream || softMask instanceof JpegStream)) {
  25738. nativeImageDecoder = new NativeImageDecoder(self.xref, resources, self.handler, self.options.forceDataSchema);
  25739. }
  25740. PDFImage.buildImage(self.handler, self.xref, resources, image, inline, nativeImageDecoder).then(function (imageObj) {
  25741. var imgData = imageObj.createImageData(false);
  25742. self.handler.send('obj', [
  25743. objId,
  25744. self.pageIndex,
  25745. 'Image',
  25746. imgData
  25747. ], [imgData.data.buffer]);
  25748. }).then(undefined, function (reason) {
  25749. warn('Unable to decode image: ' + reason);
  25750. self.handler.send('obj', [
  25751. objId,
  25752. self.pageIndex,
  25753. 'Image',
  25754. null
  25755. ]);
  25756. });
  25757. operatorList.addOp(OPS.paintImageXObject, args);
  25758. if (cacheKey) {
  25759. imageCache[cacheKey] = {
  25760. fn: OPS.paintImageXObject,
  25761. args: args
  25762. };
  25763. }
  25764. },
  25765. handleSMask: function PartialEvaluator_handleSmask(smask, resources, operatorList, task, stateManager) {
  25766. var smaskContent = smask.get('G');
  25767. var smaskOptions = {
  25768. subtype: smask.get('S').name,
  25769. backdrop: smask.get('BC')
  25770. };
  25771. var transferObj = smask.get('TR');
  25772. if (isPDFFunction(transferObj)) {
  25773. var transferFn = PDFFunction.parse(this.xref, transferObj);
  25774. var transferMap = new Uint8Array(256);
  25775. var tmp = new Float32Array(1);
  25776. for (var i = 0; i < 256; i++) {
  25777. tmp[0] = i / 255;
  25778. transferFn(tmp, 0, tmp, 0);
  25779. transferMap[i] = tmp[0] * 255 | 0;
  25780. }
  25781. smaskOptions.transferMap = transferMap;
  25782. }
  25783. return this.buildFormXObject(resources, smaskContent, smaskOptions, operatorList, task, stateManager.state.clone());
  25784. },
  25785. handleTilingType: function PartialEvaluator_handleTilingType(fn, args, resources, pattern, patternDict, operatorList, task) {
  25786. var tilingOpList = new OperatorList();
  25787. var resourcesArray = [
  25788. patternDict.get('Resources'),
  25789. resources
  25790. ];
  25791. var patternResources = Dict.merge(this.xref, resourcesArray);
  25792. return this.getOperatorList(pattern, task, patternResources, tilingOpList).then(function () {
  25793. operatorList.addDependencies(tilingOpList.dependencies);
  25794. operatorList.addOp(fn, getTilingPatternIR({
  25795. fnArray: tilingOpList.fnArray,
  25796. argsArray: tilingOpList.argsArray
  25797. }, patternDict, args));
  25798. });
  25799. },
  25800. handleSetFont: function PartialEvaluator_handleSetFont(resources, fontArgs, fontRef, operatorList, task, state) {
  25801. var fontName;
  25802. if (fontArgs) {
  25803. fontArgs = fontArgs.slice();
  25804. fontName = fontArgs[0].name;
  25805. }
  25806. var self = this;
  25807. return this.loadFont(fontName, fontRef, this.xref, resources).then(function (translated) {
  25808. if (!translated.font.isType3Font) {
  25809. return translated;
  25810. }
  25811. return translated.loadType3Data(self, resources, operatorList, task).then(function () {
  25812. return translated;
  25813. }, function (reason) {
  25814. self.handler.send('UnsupportedFeature', { featureId: UNSUPPORTED_FEATURES.font });
  25815. return new TranslatedFont('g_font_error', new ErrorFont('Type3 font load error: ' + reason), translated.font);
  25816. });
  25817. }).then(function (translated) {
  25818. state.font = translated.font;
  25819. translated.send(self.handler);
  25820. return translated.loadedName;
  25821. });
  25822. },
  25823. handleText: function PartialEvaluator_handleText(chars, state) {
  25824. var font = state.font;
  25825. var glyphs = font.charsToGlyphs(chars);
  25826. var isAddToPathSet = !!(state.textRenderingMode & TextRenderingMode.ADD_TO_PATH_FLAG);
  25827. if (font.data && (isAddToPathSet || this.options.disableFontFace)) {
  25828. var buildPath = function (fontChar) {
  25829. if (!font.renderer.hasBuiltPath(fontChar)) {
  25830. var path = font.renderer.getPathJs(fontChar);
  25831. this.handler.send('commonobj', [
  25832. font.loadedName + '_path_' + fontChar,
  25833. 'FontPath',
  25834. path
  25835. ]);
  25836. }
  25837. }.bind(this);
  25838. for (var i = 0, ii = glyphs.length; i < ii; i++) {
  25839. var glyph = glyphs[i];
  25840. buildPath(glyph.fontChar);
  25841. var accent = glyph.accent;
  25842. if (accent && accent.fontChar) {
  25843. buildPath(accent.fontChar);
  25844. }
  25845. }
  25846. }
  25847. return glyphs;
  25848. },
  25849. setGState: function PartialEvaluator_setGState(resources, gState, operatorList, task, xref, stateManager) {
  25850. var gStateObj = [];
  25851. var gStateKeys = gState.getKeys();
  25852. var self = this;
  25853. var promise = Promise.resolve();
  25854. for (var i = 0, ii = gStateKeys.length; i < ii; i++) {
  25855. var key = gStateKeys[i];
  25856. var value = gState.get(key);
  25857. switch (key) {
  25858. case 'Type':
  25859. break;
  25860. case 'LW':
  25861. case 'LC':
  25862. case 'LJ':
  25863. case 'ML':
  25864. case 'D':
  25865. case 'RI':
  25866. case 'FL':
  25867. case 'CA':
  25868. case 'ca':
  25869. gStateObj.push([
  25870. key,
  25871. value
  25872. ]);
  25873. break;
  25874. case 'Font':
  25875. promise = promise.then(function () {
  25876. return self.handleSetFont(resources, null, value[0], operatorList, task, stateManager.state).then(function (loadedName) {
  25877. operatorList.addDependency(loadedName);
  25878. gStateObj.push([
  25879. key,
  25880. [
  25881. loadedName,
  25882. value[1]
  25883. ]
  25884. ]);
  25885. });
  25886. });
  25887. break;
  25888. case 'BM':
  25889. gStateObj.push([
  25890. key,
  25891. value
  25892. ]);
  25893. break;
  25894. case 'SMask':
  25895. if (isName(value, 'None')) {
  25896. gStateObj.push([
  25897. key,
  25898. false
  25899. ]);
  25900. break;
  25901. }
  25902. if (isDict(value)) {
  25903. promise = promise.then(function (dict) {
  25904. return self.handleSMask(dict, resources, operatorList, task, stateManager);
  25905. }.bind(this, value));
  25906. gStateObj.push([
  25907. key,
  25908. true
  25909. ]);
  25910. } else {
  25911. warn('Unsupported SMask type');
  25912. }
  25913. break;
  25914. case 'OP':
  25915. case 'op':
  25916. case 'OPM':
  25917. case 'BG':
  25918. case 'BG2':
  25919. case 'UCR':
  25920. case 'UCR2':
  25921. case 'TR':
  25922. case 'TR2':
  25923. case 'HT':
  25924. case 'SM':
  25925. case 'SA':
  25926. case 'AIS':
  25927. case 'TK':
  25928. info('graphic state operator ' + key);
  25929. break;
  25930. default:
  25931. info('Unknown graphic state operator ' + key);
  25932. break;
  25933. }
  25934. }
  25935. return promise.then(function () {
  25936. if (gStateObj.length > 0) {
  25937. operatorList.addOp(OPS.setGState, [gStateObj]);
  25938. }
  25939. });
  25940. },
  25941. loadFont: function PartialEvaluator_loadFont(fontName, font, xref, resources) {
  25942. function errorFont() {
  25943. return Promise.resolve(new TranslatedFont('g_font_error', new ErrorFont('Font ' + fontName + ' is not available'), font));
  25944. }
  25945. var fontRef;
  25946. if (font) {
  25947. assert(isRef(font));
  25948. fontRef = font;
  25949. } else {
  25950. var fontRes = resources.get('Font');
  25951. if (fontRes) {
  25952. fontRef = fontRes.getRaw(fontName);
  25953. } else {
  25954. warn('fontRes not available');
  25955. return errorFont();
  25956. }
  25957. }
  25958. if (!fontRef) {
  25959. warn('fontRef not available');
  25960. return errorFont();
  25961. }
  25962. if (this.fontCache.has(fontRef)) {
  25963. return this.fontCache.get(fontRef);
  25964. }
  25965. font = xref.fetchIfRef(fontRef);
  25966. if (!isDict(font)) {
  25967. return errorFont();
  25968. }
  25969. if (font.translated) {
  25970. return font.translated;
  25971. }
  25972. var fontCapability = createPromiseCapability();
  25973. var preEvaluatedFont = this.preEvaluateFont(font, xref);
  25974. var descriptor = preEvaluatedFont.descriptor;
  25975. var fontRefIsRef = isRef(fontRef), fontID;
  25976. if (fontRefIsRef) {
  25977. fontID = fontRef.toString();
  25978. }
  25979. if (isDict(descriptor)) {
  25980. if (!descriptor.fontAliases) {
  25981. descriptor.fontAliases = Object.create(null);
  25982. }
  25983. var fontAliases = descriptor.fontAliases;
  25984. var hash = preEvaluatedFont.hash;
  25985. if (fontAliases[hash]) {
  25986. var aliasFontRef = fontAliases[hash].aliasRef;
  25987. if (fontRefIsRef && aliasFontRef && this.fontCache.has(aliasFontRef)) {
  25988. this.fontCache.putAlias(fontRef, aliasFontRef);
  25989. return this.fontCache.get(fontRef);
  25990. }
  25991. } else {
  25992. fontAliases[hash] = { fontID: Font.getFontID() };
  25993. }
  25994. if (fontRefIsRef) {
  25995. fontAliases[hash].aliasRef = fontRef;
  25996. }
  25997. fontID = fontAliases[hash].fontID;
  25998. }
  25999. if (fontRefIsRef) {
  26000. this.fontCache.put(fontRef, fontCapability.promise);
  26001. } else {
  26002. if (!fontID) {
  26003. fontID = this.idFactory.createObjId();
  26004. }
  26005. this.fontCache.put('id_' + fontID, fontCapability.promise);
  26006. }
  26007. assert(fontID, 'The "fontID" must be defined.');
  26008. font.loadedName = 'g_' + this.pdfManager.docId + '_f' + fontID;
  26009. font.translated = fontCapability.promise;
  26010. var translatedPromise;
  26011. try {
  26012. translatedPromise = this.translateFont(preEvaluatedFont, xref);
  26013. } catch (e) {
  26014. translatedPromise = Promise.reject(e);
  26015. }
  26016. var self = this;
  26017. translatedPromise.then(function (translatedFont) {
  26018. if (translatedFont.fontType !== undefined) {
  26019. var xrefFontStats = xref.stats.fontTypes;
  26020. xrefFontStats[translatedFont.fontType] = true;
  26021. }
  26022. fontCapability.resolve(new TranslatedFont(font.loadedName, translatedFont, font));
  26023. }, function (reason) {
  26024. self.handler.send('UnsupportedFeature', { featureId: UNSUPPORTED_FEATURES.font });
  26025. try {
  26026. var descriptor = preEvaluatedFont.descriptor;
  26027. var fontFile3 = descriptor && descriptor.get('FontFile3');
  26028. var subtype = fontFile3 && fontFile3.get('Subtype');
  26029. var fontType = getFontType(preEvaluatedFont.type, subtype && subtype.name);
  26030. var xrefFontStats = xref.stats.fontTypes;
  26031. xrefFontStats[fontType] = true;
  26032. } catch (ex) {
  26033. }
  26034. fontCapability.resolve(new TranslatedFont(font.loadedName, new ErrorFont(reason instanceof Error ? reason.message : reason), font));
  26035. });
  26036. return fontCapability.promise;
  26037. },
  26038. buildPath: function PartialEvaluator_buildPath(operatorList, fn, args) {
  26039. var lastIndex = operatorList.length - 1;
  26040. if (!args) {
  26041. args = [];
  26042. }
  26043. if (lastIndex < 0 || operatorList.fnArray[lastIndex] !== OPS.constructPath) {
  26044. operatorList.addOp(OPS.constructPath, [
  26045. [fn],
  26046. args
  26047. ]);
  26048. } else {
  26049. var opArgs = operatorList.argsArray[lastIndex];
  26050. opArgs[0].push(fn);
  26051. Array.prototype.push.apply(opArgs[1], args);
  26052. }
  26053. },
  26054. handleColorN: function PartialEvaluator_handleColorN(operatorList, fn, args, cs, patterns, resources, task, xref) {
  26055. var patternName = args[args.length - 1];
  26056. var pattern;
  26057. if (isName(patternName) && (pattern = patterns.get(patternName.name))) {
  26058. var dict = isStream(pattern) ? pattern.dict : pattern;
  26059. var typeNum = dict.get('PatternType');
  26060. if (typeNum === TILING_PATTERN) {
  26061. var color = cs.base ? cs.base.getRgb(args, 0) : null;
  26062. return this.handleTilingType(fn, color, resources, pattern, dict, operatorList, task);
  26063. } else if (typeNum === SHADING_PATTERN) {
  26064. var shading = dict.get('Shading');
  26065. var matrix = dict.getArray('Matrix');
  26066. pattern = Pattern.parseShading(shading, matrix, xref, resources, this.handler);
  26067. operatorList.addOp(fn, pattern.getIR());
  26068. return Promise.resolve();
  26069. }
  26070. return Promise.reject('Unknown PatternType: ' + typeNum);
  26071. }
  26072. operatorList.addOp(fn, args);
  26073. return Promise.resolve();
  26074. },
  26075. getOperatorList: function PartialEvaluator_getOperatorList(stream, task, resources, operatorList, initialState) {
  26076. var self = this;
  26077. var xref = this.xref;
  26078. var imageCache = Object.create(null);
  26079. assert(operatorList);
  26080. resources = resources || Dict.empty;
  26081. var xobjs = resources.get('XObject') || Dict.empty;
  26082. var patterns = resources.get('Pattern') || Dict.empty;
  26083. var stateManager = new StateManager(initialState || new EvalState());
  26084. var preprocessor = new EvaluatorPreprocessor(stream, xref, stateManager);
  26085. var timeSlotManager = new TimeSlotManager();
  26086. return new Promise(function promiseBody(resolve, reject) {
  26087. var next = function (promise) {
  26088. promise.then(function () {
  26089. try {
  26090. promiseBody(resolve, reject);
  26091. } catch (ex) {
  26092. reject(ex);
  26093. }
  26094. }, reject);
  26095. };
  26096. task.ensureNotTerminated();
  26097. timeSlotManager.reset();
  26098. var stop, operation = {}, i, ii, cs;
  26099. while (!(stop = timeSlotManager.check())) {
  26100. operation.args = null;
  26101. if (!preprocessor.read(operation)) {
  26102. break;
  26103. }
  26104. var args = operation.args;
  26105. var fn = operation.fn;
  26106. switch (fn | 0) {
  26107. case OPS.paintXObject:
  26108. if (args[0].code) {
  26109. break;
  26110. }
  26111. var name = args[0].name;
  26112. if (!name) {
  26113. warn('XObject must be referred to by name.');
  26114. continue;
  26115. }
  26116. if (imageCache[name] !== undefined) {
  26117. operatorList.addOp(imageCache[name].fn, imageCache[name].args);
  26118. args = null;
  26119. continue;
  26120. }
  26121. var xobj = xobjs.get(name);
  26122. if (xobj) {
  26123. assert(isStream(xobj), 'XObject should be a stream');
  26124. var type = xobj.dict.get('Subtype');
  26125. assert(isName(type), 'XObject should have a Name subtype');
  26126. if (type.name === 'Form') {
  26127. stateManager.save();
  26128. next(self.buildFormXObject(resources, xobj, null, operatorList, task, stateManager.state.clone()).then(function () {
  26129. stateManager.restore();
  26130. }));
  26131. return;
  26132. } else if (type.name === 'Image') {
  26133. self.buildPaintImageXObject(resources, xobj, false, operatorList, name, imageCache);
  26134. args = null;
  26135. continue;
  26136. } else if (type.name === 'PS') {
  26137. info('Ignored XObject subtype PS');
  26138. continue;
  26139. } else {
  26140. error('Unhandled XObject subtype ' + type.name);
  26141. }
  26142. }
  26143. break;
  26144. case OPS.setFont:
  26145. var fontSize = args[1];
  26146. next(self.handleSetFont(resources, args, null, operatorList, task, stateManager.state).then(function (loadedName) {
  26147. operatorList.addDependency(loadedName);
  26148. operatorList.addOp(OPS.setFont, [
  26149. loadedName,
  26150. fontSize
  26151. ]);
  26152. }));
  26153. return;
  26154. case OPS.endInlineImage:
  26155. var cacheKey = args[0].cacheKey;
  26156. if (cacheKey) {
  26157. var cacheEntry = imageCache[cacheKey];
  26158. if (cacheEntry !== undefined) {
  26159. operatorList.addOp(cacheEntry.fn, cacheEntry.args);
  26160. args = null;
  26161. continue;
  26162. }
  26163. }
  26164. self.buildPaintImageXObject(resources, args[0], true, operatorList, cacheKey, imageCache);
  26165. args = null;
  26166. continue;
  26167. case OPS.showText:
  26168. args[0] = self.handleText(args[0], stateManager.state);
  26169. break;
  26170. case OPS.showSpacedText:
  26171. var arr = args[0];
  26172. var combinedGlyphs = [];
  26173. var arrLength = arr.length;
  26174. var state = stateManager.state;
  26175. for (i = 0; i < arrLength; ++i) {
  26176. var arrItem = arr[i];
  26177. if (isString(arrItem)) {
  26178. Array.prototype.push.apply(combinedGlyphs, self.handleText(arrItem, state));
  26179. } else if (isNum(arrItem)) {
  26180. combinedGlyphs.push(arrItem);
  26181. }
  26182. }
  26183. args[0] = combinedGlyphs;
  26184. fn = OPS.showText;
  26185. break;
  26186. case OPS.nextLineShowText:
  26187. operatorList.addOp(OPS.nextLine);
  26188. args[0] = self.handleText(args[0], stateManager.state);
  26189. fn = OPS.showText;
  26190. break;
  26191. case OPS.nextLineSetSpacingShowText:
  26192. operatorList.addOp(OPS.nextLine);
  26193. operatorList.addOp(OPS.setWordSpacing, [args.shift()]);
  26194. operatorList.addOp(OPS.setCharSpacing, [args.shift()]);
  26195. args[0] = self.handleText(args[0], stateManager.state);
  26196. fn = OPS.showText;
  26197. break;
  26198. case OPS.setTextRenderingMode:
  26199. stateManager.state.textRenderingMode = args[0];
  26200. break;
  26201. case OPS.setFillColorSpace:
  26202. stateManager.state.fillColorSpace = ColorSpace.parse(args[0], xref, resources);
  26203. continue;
  26204. case OPS.setStrokeColorSpace:
  26205. stateManager.state.strokeColorSpace = ColorSpace.parse(args[0], xref, resources);
  26206. continue;
  26207. case OPS.setFillColor:
  26208. cs = stateManager.state.fillColorSpace;
  26209. args = cs.getRgb(args, 0);
  26210. fn = OPS.setFillRGBColor;
  26211. break;
  26212. case OPS.setStrokeColor:
  26213. cs = stateManager.state.strokeColorSpace;
  26214. args = cs.getRgb(args, 0);
  26215. fn = OPS.setStrokeRGBColor;
  26216. break;
  26217. case OPS.setFillGray:
  26218. stateManager.state.fillColorSpace = ColorSpace.singletons.gray;
  26219. args = ColorSpace.singletons.gray.getRgb(args, 0);
  26220. fn = OPS.setFillRGBColor;
  26221. break;
  26222. case OPS.setStrokeGray:
  26223. stateManager.state.strokeColorSpace = ColorSpace.singletons.gray;
  26224. args = ColorSpace.singletons.gray.getRgb(args, 0);
  26225. fn = OPS.setStrokeRGBColor;
  26226. break;
  26227. case OPS.setFillCMYKColor:
  26228. stateManager.state.fillColorSpace = ColorSpace.singletons.cmyk;
  26229. args = ColorSpace.singletons.cmyk.getRgb(args, 0);
  26230. fn = OPS.setFillRGBColor;
  26231. break;
  26232. case OPS.setStrokeCMYKColor:
  26233. stateManager.state.strokeColorSpace = ColorSpace.singletons.cmyk;
  26234. args = ColorSpace.singletons.cmyk.getRgb(args, 0);
  26235. fn = OPS.setStrokeRGBColor;
  26236. break;
  26237. case OPS.setFillRGBColor:
  26238. stateManager.state.fillColorSpace = ColorSpace.singletons.rgb;
  26239. args = ColorSpace.singletons.rgb.getRgb(args, 0);
  26240. break;
  26241. case OPS.setStrokeRGBColor:
  26242. stateManager.state.strokeColorSpace = ColorSpace.singletons.rgb;
  26243. args = ColorSpace.singletons.rgb.getRgb(args, 0);
  26244. break;
  26245. case OPS.setFillColorN:
  26246. cs = stateManager.state.fillColorSpace;
  26247. if (cs.name === 'Pattern') {
  26248. next(self.handleColorN(operatorList, OPS.setFillColorN, args, cs, patterns, resources, task, xref));
  26249. return;
  26250. }
  26251. args = cs.getRgb(args, 0);
  26252. fn = OPS.setFillRGBColor;
  26253. break;
  26254. case OPS.setStrokeColorN:
  26255. cs = stateManager.state.strokeColorSpace;
  26256. if (cs.name === 'Pattern') {
  26257. next(self.handleColorN(operatorList, OPS.setStrokeColorN, args, cs, patterns, resources, task, xref));
  26258. return;
  26259. }
  26260. args = cs.getRgb(args, 0);
  26261. fn = OPS.setStrokeRGBColor;
  26262. break;
  26263. case OPS.shadingFill:
  26264. var shadingRes = resources.get('Shading');
  26265. if (!shadingRes) {
  26266. error('No shading resource found');
  26267. }
  26268. var shading = shadingRes.get(args[0].name);
  26269. if (!shading) {
  26270. error('No shading object found');
  26271. }
  26272. var shadingFill = Pattern.parseShading(shading, null, xref, resources, self.handler);
  26273. var patternIR = shadingFill.getIR();
  26274. args = [patternIR];
  26275. fn = OPS.shadingFill;
  26276. break;
  26277. case OPS.setGState:
  26278. var dictName = args[0];
  26279. var extGState = resources.get('ExtGState');
  26280. if (!isDict(extGState) || !extGState.has(dictName.name)) {
  26281. break;
  26282. }
  26283. var gState = extGState.get(dictName.name);
  26284. next(self.setGState(resources, gState, operatorList, task, xref, stateManager));
  26285. return;
  26286. case OPS.moveTo:
  26287. case OPS.lineTo:
  26288. case OPS.curveTo:
  26289. case OPS.curveTo2:
  26290. case OPS.curveTo3:
  26291. case OPS.closePath:
  26292. self.buildPath(operatorList, fn, args);
  26293. continue;
  26294. case OPS.rectangle:
  26295. self.buildPath(operatorList, fn, args);
  26296. continue;
  26297. case OPS.markPoint:
  26298. case OPS.markPointProps:
  26299. case OPS.beginMarkedContent:
  26300. case OPS.beginMarkedContentProps:
  26301. case OPS.endMarkedContent:
  26302. case OPS.beginCompat:
  26303. case OPS.endCompat:
  26304. continue;
  26305. default:
  26306. if (args !== null) {
  26307. for (i = 0, ii = args.length; i < ii; i++) {
  26308. if (args[i] instanceof Dict) {
  26309. break;
  26310. }
  26311. }
  26312. if (i < ii) {
  26313. warn('getOperatorList - ignoring operator: ' + fn);
  26314. continue;
  26315. }
  26316. }
  26317. }
  26318. operatorList.addOp(fn, args);
  26319. }
  26320. if (stop) {
  26321. next(deferred);
  26322. return;
  26323. }
  26324. for (i = 0, ii = preprocessor.savedStatesDepth; i < ii; i++) {
  26325. operatorList.addOp(OPS.restore, []);
  26326. }
  26327. resolve();
  26328. });
  26329. },
  26330. getTextContent: function PartialEvaluator_getTextContent(stream, task, resources, stateManager, normalizeWhitespace, combineTextItems) {
  26331. stateManager = stateManager || new StateManager(new TextState());
  26332. var WhitespaceRegexp = /\s/g;
  26333. var textContent = {
  26334. items: [],
  26335. styles: Object.create(null)
  26336. };
  26337. var textContentItem = {
  26338. initialized: false,
  26339. str: [],
  26340. width: 0,
  26341. height: 0,
  26342. vertical: false,
  26343. lastAdvanceWidth: 0,
  26344. lastAdvanceHeight: 0,
  26345. textAdvanceScale: 0,
  26346. spaceWidth: 0,
  26347. fakeSpaceMin: Infinity,
  26348. fakeMultiSpaceMin: Infinity,
  26349. fakeMultiSpaceMax: -0,
  26350. textRunBreakAllowed: false,
  26351. transform: null,
  26352. fontName: null
  26353. };
  26354. var SPACE_FACTOR = 0.3;
  26355. var MULTI_SPACE_FACTOR = 1.5;
  26356. var MULTI_SPACE_FACTOR_MAX = 4;
  26357. var self = this;
  26358. var xref = this.xref;
  26359. resources = xref.fetchIfRef(resources) || Dict.empty;
  26360. var xobjs = null;
  26361. var xobjsCache = Object.create(null);
  26362. var preprocessor = new EvaluatorPreprocessor(stream, xref, stateManager);
  26363. var textState;
  26364. function ensureTextContentItem() {
  26365. if (textContentItem.initialized) {
  26366. return textContentItem;
  26367. }
  26368. var font = textState.font;
  26369. if (!(font.loadedName in textContent.styles)) {
  26370. textContent.styles[font.loadedName] = {
  26371. fontFamily: font.fallbackName,
  26372. ascent: font.ascent,
  26373. descent: font.descent,
  26374. vertical: font.vertical
  26375. };
  26376. }
  26377. textContentItem.fontName = font.loadedName;
  26378. var tsm = [
  26379. textState.fontSize * textState.textHScale,
  26380. 0,
  26381. 0,
  26382. textState.fontSize,
  26383. 0,
  26384. textState.textRise
  26385. ];
  26386. if (font.isType3Font && textState.fontMatrix !== FONT_IDENTITY_MATRIX && textState.fontSize === 1) {
  26387. var glyphHeight = font.bbox[3] - font.bbox[1];
  26388. if (glyphHeight > 0) {
  26389. glyphHeight = glyphHeight * textState.fontMatrix[3];
  26390. tsm[3] *= glyphHeight;
  26391. }
  26392. }
  26393. var trm = Util.transform(textState.ctm, Util.transform(textState.textMatrix, tsm));
  26394. textContentItem.transform = trm;
  26395. if (!font.vertical) {
  26396. textContentItem.width = 0;
  26397. textContentItem.height = Math.sqrt(trm[2] * trm[2] + trm[3] * trm[3]);
  26398. textContentItem.vertical = false;
  26399. } else {
  26400. textContentItem.width = Math.sqrt(trm[0] * trm[0] + trm[1] * trm[1]);
  26401. textContentItem.height = 0;
  26402. textContentItem.vertical = true;
  26403. }
  26404. var a = textState.textLineMatrix[0];
  26405. var b = textState.textLineMatrix[1];
  26406. var scaleLineX = Math.sqrt(a * a + b * b);
  26407. a = textState.ctm[0];
  26408. b = textState.ctm[1];
  26409. var scaleCtmX = Math.sqrt(a * a + b * b);
  26410. textContentItem.textAdvanceScale = scaleCtmX * scaleLineX;
  26411. textContentItem.lastAdvanceWidth = 0;
  26412. textContentItem.lastAdvanceHeight = 0;
  26413. var spaceWidth = font.spaceWidth / 1000 * textState.fontSize;
  26414. if (spaceWidth) {
  26415. textContentItem.spaceWidth = spaceWidth;
  26416. textContentItem.fakeSpaceMin = spaceWidth * SPACE_FACTOR;
  26417. textContentItem.fakeMultiSpaceMin = spaceWidth * MULTI_SPACE_FACTOR;
  26418. textContentItem.fakeMultiSpaceMax = spaceWidth * MULTI_SPACE_FACTOR_MAX;
  26419. textContentItem.textRunBreakAllowed = !font.isMonospace;
  26420. } else {
  26421. textContentItem.spaceWidth = 0;
  26422. textContentItem.fakeSpaceMin = Infinity;
  26423. textContentItem.fakeMultiSpaceMin = Infinity;
  26424. textContentItem.fakeMultiSpaceMax = 0;
  26425. textContentItem.textRunBreakAllowed = false;
  26426. }
  26427. textContentItem.initialized = true;
  26428. return textContentItem;
  26429. }
  26430. function replaceWhitespace(str) {
  26431. var i = 0, ii = str.length, code;
  26432. while (i < ii && (code = str.charCodeAt(i)) >= 0x20 && code <= 0x7F) {
  26433. i++;
  26434. }
  26435. return i < ii ? str.replace(WhitespaceRegexp, ' ') : str;
  26436. }
  26437. function runBidiTransform(textChunk) {
  26438. var str = textChunk.str.join('');
  26439. var bidiResult = bidi(str, -1, textChunk.vertical);
  26440. return {
  26441. str: normalizeWhitespace ? replaceWhitespace(bidiResult.str) : bidiResult.str,
  26442. dir: bidiResult.dir,
  26443. width: textChunk.width,
  26444. height: textChunk.height,
  26445. transform: textChunk.transform,
  26446. fontName: textChunk.fontName
  26447. };
  26448. }
  26449. function handleSetFont(fontName, fontRef) {
  26450. return self.loadFont(fontName, fontRef, xref, resources).then(function (translated) {
  26451. textState.font = translated.font;
  26452. textState.fontMatrix = translated.font.fontMatrix || FONT_IDENTITY_MATRIX;
  26453. });
  26454. }
  26455. function buildTextContentItem(chars) {
  26456. var font = textState.font;
  26457. var textChunk = ensureTextContentItem();
  26458. var width = 0;
  26459. var height = 0;
  26460. var glyphs = font.charsToGlyphs(chars);
  26461. for (var i = 0; i < glyphs.length; i++) {
  26462. var glyph = glyphs[i];
  26463. var glyphWidth = null;
  26464. if (font.vertical && glyph.vmetric) {
  26465. glyphWidth = glyph.vmetric[0];
  26466. } else {
  26467. glyphWidth = glyph.width;
  26468. }
  26469. var glyphUnicode = glyph.unicode;
  26470. var NormalizedUnicodes = getNormalizedUnicodes();
  26471. if (NormalizedUnicodes[glyphUnicode] !== undefined) {
  26472. glyphUnicode = NormalizedUnicodes[glyphUnicode];
  26473. }
  26474. glyphUnicode = reverseIfRtl(glyphUnicode);
  26475. var charSpacing = textState.charSpacing;
  26476. if (glyph.isSpace) {
  26477. var wordSpacing = textState.wordSpacing;
  26478. charSpacing += wordSpacing;
  26479. if (wordSpacing > 0) {
  26480. addFakeSpaces(wordSpacing, textChunk.str);
  26481. }
  26482. }
  26483. var tx = 0;
  26484. var ty = 0;
  26485. if (!font.vertical) {
  26486. var w0 = glyphWidth * textState.fontMatrix[0];
  26487. tx = (w0 * textState.fontSize + charSpacing) * textState.textHScale;
  26488. width += tx;
  26489. } else {
  26490. var w1 = glyphWidth * textState.fontMatrix[0];
  26491. ty = w1 * textState.fontSize + charSpacing;
  26492. height += ty;
  26493. }
  26494. textState.translateTextMatrix(tx, ty);
  26495. textChunk.str.push(glyphUnicode);
  26496. }
  26497. if (!font.vertical) {
  26498. textChunk.lastAdvanceWidth = width;
  26499. textChunk.width += width;
  26500. } else {
  26501. textChunk.lastAdvanceHeight = height;
  26502. textChunk.height += Math.abs(height);
  26503. }
  26504. return textChunk;
  26505. }
  26506. function addFakeSpaces(width, strBuf) {
  26507. if (width < textContentItem.fakeSpaceMin) {
  26508. return;
  26509. }
  26510. if (width < textContentItem.fakeMultiSpaceMin) {
  26511. strBuf.push(' ');
  26512. return;
  26513. }
  26514. var fakeSpaces = Math.round(width / textContentItem.spaceWidth);
  26515. while (fakeSpaces-- > 0) {
  26516. strBuf.push(' ');
  26517. }
  26518. }
  26519. function flushTextContentItem() {
  26520. if (!textContentItem.initialized) {
  26521. return;
  26522. }
  26523. textContentItem.width *= textContentItem.textAdvanceScale;
  26524. textContentItem.height *= textContentItem.textAdvanceScale;
  26525. textContent.items.push(runBidiTransform(textContentItem));
  26526. textContentItem.initialized = false;
  26527. textContentItem.str.length = 0;
  26528. }
  26529. var timeSlotManager = new TimeSlotManager();
  26530. return new Promise(function promiseBody(resolve, reject) {
  26531. var next = function (promise) {
  26532. promise.then(function () {
  26533. try {
  26534. promiseBody(resolve, reject);
  26535. } catch (ex) {
  26536. reject(ex);
  26537. }
  26538. }, reject);
  26539. };
  26540. task.ensureNotTerminated();
  26541. timeSlotManager.reset();
  26542. var stop, operation = {}, args = [];
  26543. while (!(stop = timeSlotManager.check())) {
  26544. args.length = 0;
  26545. operation.args = args;
  26546. if (!preprocessor.read(operation)) {
  26547. break;
  26548. }
  26549. textState = stateManager.state;
  26550. var fn = operation.fn;
  26551. args = operation.args;
  26552. var advance, diff;
  26553. switch (fn | 0) {
  26554. case OPS.setFont:
  26555. var fontNameArg = args[0].name, fontSizeArg = args[1];
  26556. if (textState.font && fontNameArg === textState.fontName && fontSizeArg === textState.fontSize) {
  26557. break;
  26558. }
  26559. flushTextContentItem();
  26560. textState.fontName = fontNameArg;
  26561. textState.fontSize = fontSizeArg;
  26562. next(handleSetFont(fontNameArg, null));
  26563. return;
  26564. case OPS.setTextRise:
  26565. flushTextContentItem();
  26566. textState.textRise = args[0];
  26567. break;
  26568. case OPS.setHScale:
  26569. flushTextContentItem();
  26570. textState.textHScale = args[0] / 100;
  26571. break;
  26572. case OPS.setLeading:
  26573. flushTextContentItem();
  26574. textState.leading = args[0];
  26575. break;
  26576. case OPS.moveText:
  26577. var isSameTextLine = !textState.font ? false : (textState.font.vertical ? args[0] : args[1]) === 0;
  26578. advance = args[0] - args[1];
  26579. if (combineTextItems && isSameTextLine && textContentItem.initialized && advance > 0 && advance <= textContentItem.fakeMultiSpaceMax) {
  26580. textState.translateTextLineMatrix(args[0], args[1]);
  26581. textContentItem.width += args[0] - textContentItem.lastAdvanceWidth;
  26582. textContentItem.height += args[1] - textContentItem.lastAdvanceHeight;
  26583. diff = args[0] - textContentItem.lastAdvanceWidth - (args[1] - textContentItem.lastAdvanceHeight);
  26584. addFakeSpaces(diff, textContentItem.str);
  26585. break;
  26586. }
  26587. flushTextContentItem();
  26588. textState.translateTextLineMatrix(args[0], args[1]);
  26589. textState.textMatrix = textState.textLineMatrix.slice();
  26590. break;
  26591. case OPS.setLeadingMoveText:
  26592. flushTextContentItem();
  26593. textState.leading = -args[1];
  26594. textState.translateTextLineMatrix(args[0], args[1]);
  26595. textState.textMatrix = textState.textLineMatrix.slice();
  26596. break;
  26597. case OPS.nextLine:
  26598. flushTextContentItem();
  26599. textState.carriageReturn();
  26600. break;
  26601. case OPS.setTextMatrix:
  26602. advance = textState.calcTextLineMatrixAdvance(args[0], args[1], args[2], args[3], args[4], args[5]);
  26603. if (combineTextItems && advance !== null && textContentItem.initialized && advance.value > 0 && advance.value <= textContentItem.fakeMultiSpaceMax) {
  26604. textState.translateTextLineMatrix(advance.width, advance.height);
  26605. textContentItem.width += advance.width - textContentItem.lastAdvanceWidth;
  26606. textContentItem.height += advance.height - textContentItem.lastAdvanceHeight;
  26607. diff = advance.width - textContentItem.lastAdvanceWidth - (advance.height - textContentItem.lastAdvanceHeight);
  26608. addFakeSpaces(diff, textContentItem.str);
  26609. break;
  26610. }
  26611. flushTextContentItem();
  26612. textState.setTextMatrix(args[0], args[1], args[2], args[3], args[4], args[5]);
  26613. textState.setTextLineMatrix(args[0], args[1], args[2], args[3], args[4], args[5]);
  26614. break;
  26615. case OPS.setCharSpacing:
  26616. textState.charSpacing = args[0];
  26617. break;
  26618. case OPS.setWordSpacing:
  26619. textState.wordSpacing = args[0];
  26620. break;
  26621. case OPS.beginText:
  26622. flushTextContentItem();
  26623. textState.textMatrix = IDENTITY_MATRIX.slice();
  26624. textState.textLineMatrix = IDENTITY_MATRIX.slice();
  26625. break;
  26626. case OPS.showSpacedText:
  26627. var items = args[0];
  26628. var offset;
  26629. for (var j = 0, jj = items.length; j < jj; j++) {
  26630. if (typeof items[j] === 'string') {
  26631. buildTextContentItem(items[j]);
  26632. } else if (isNum(items[j])) {
  26633. ensureTextContentItem();
  26634. advance = items[j] * textState.fontSize / 1000;
  26635. var breakTextRun = false;
  26636. if (textState.font.vertical) {
  26637. offset = advance;
  26638. textState.translateTextMatrix(0, offset);
  26639. breakTextRun = textContentItem.textRunBreakAllowed && advance > textContentItem.fakeMultiSpaceMax;
  26640. if (!breakTextRun) {
  26641. textContentItem.height += offset;
  26642. }
  26643. } else {
  26644. advance = -advance;
  26645. offset = advance * textState.textHScale;
  26646. textState.translateTextMatrix(offset, 0);
  26647. breakTextRun = textContentItem.textRunBreakAllowed && advance > textContentItem.fakeMultiSpaceMax;
  26648. if (!breakTextRun) {
  26649. textContentItem.width += offset;
  26650. }
  26651. }
  26652. if (breakTextRun) {
  26653. flushTextContentItem();
  26654. } else if (advance > 0) {
  26655. addFakeSpaces(advance, textContentItem.str);
  26656. }
  26657. }
  26658. }
  26659. break;
  26660. case OPS.showText:
  26661. buildTextContentItem(args[0]);
  26662. break;
  26663. case OPS.nextLineShowText:
  26664. flushTextContentItem();
  26665. textState.carriageReturn();
  26666. buildTextContentItem(args[0]);
  26667. break;
  26668. case OPS.nextLineSetSpacingShowText:
  26669. flushTextContentItem();
  26670. textState.wordSpacing = args[0];
  26671. textState.charSpacing = args[1];
  26672. textState.carriageReturn();
  26673. buildTextContentItem(args[2]);
  26674. break;
  26675. case OPS.paintXObject:
  26676. flushTextContentItem();
  26677. if (args[0].code) {
  26678. break;
  26679. }
  26680. if (!xobjs) {
  26681. xobjs = resources.get('XObject') || Dict.empty;
  26682. }
  26683. var name = args[0].name;
  26684. if (xobjsCache.key === name) {
  26685. if (xobjsCache.texts) {
  26686. Util.appendToArray(textContent.items, xobjsCache.texts.items);
  26687. Util.extendObj(textContent.styles, xobjsCache.texts.styles);
  26688. }
  26689. break;
  26690. }
  26691. var xobj = xobjs.get(name);
  26692. if (!xobj) {
  26693. break;
  26694. }
  26695. assert(isStream(xobj), 'XObject should be a stream');
  26696. var type = xobj.dict.get('Subtype');
  26697. assert(isName(type), 'XObject should have a Name subtype');
  26698. if ('Form' !== type.name) {
  26699. xobjsCache.key = name;
  26700. xobjsCache.texts = null;
  26701. break;
  26702. }
  26703. stateManager.save();
  26704. var matrix = xobj.dict.getArray('Matrix');
  26705. if (isArray(matrix) && matrix.length === 6) {
  26706. stateManager.transform(matrix);
  26707. }
  26708. next(self.getTextContent(xobj, task, xobj.dict.get('Resources') || resources, stateManager, normalizeWhitespace, combineTextItems).then(function (formTextContent) {
  26709. Util.appendToArray(textContent.items, formTextContent.items);
  26710. Util.extendObj(textContent.styles, formTextContent.styles);
  26711. stateManager.restore();
  26712. xobjsCache.key = name;
  26713. xobjsCache.texts = formTextContent;
  26714. }));
  26715. return;
  26716. case OPS.setGState:
  26717. flushTextContentItem();
  26718. var dictName = args[0];
  26719. var extGState = resources.get('ExtGState');
  26720. if (!isDict(extGState) || !isName(dictName)) {
  26721. break;
  26722. }
  26723. var gState = extGState.get(dictName.name);
  26724. if (!isDict(gState)) {
  26725. break;
  26726. }
  26727. var gStateFont = gState.get('Font');
  26728. if (gStateFont) {
  26729. textState.fontName = null;
  26730. textState.fontSize = gStateFont[1];
  26731. next(handleSetFont(null, gStateFont[0]));
  26732. return;
  26733. }
  26734. break;
  26735. }
  26736. }
  26737. if (stop) {
  26738. next(deferred);
  26739. return;
  26740. }
  26741. flushTextContentItem();
  26742. resolve(textContent);
  26743. });
  26744. },
  26745. extractDataStructures: function PartialEvaluator_extractDataStructures(dict, baseDict, xref, properties) {
  26746. var toUnicode = dict.get('ToUnicode') || baseDict.get('ToUnicode');
  26747. var toUnicodePromise = toUnicode ? this.readToUnicode(toUnicode) : Promise.resolve(undefined);
  26748. if (properties.composite) {
  26749. var cidSystemInfo = dict.get('CIDSystemInfo');
  26750. if (isDict(cidSystemInfo)) {
  26751. properties.cidSystemInfo = {
  26752. registry: cidSystemInfo.get('Registry'),
  26753. ordering: cidSystemInfo.get('Ordering'),
  26754. supplement: cidSystemInfo.get('Supplement')
  26755. };
  26756. }
  26757. var cidToGidMap = dict.get('CIDToGIDMap');
  26758. if (isStream(cidToGidMap)) {
  26759. properties.cidToGidMap = this.readCidToGidMap(cidToGidMap);
  26760. }
  26761. }
  26762. var differences = [];
  26763. var baseEncodingName = null;
  26764. var encoding;
  26765. if (dict.has('Encoding')) {
  26766. encoding = dict.get('Encoding');
  26767. if (isDict(encoding)) {
  26768. baseEncodingName = encoding.get('BaseEncoding');
  26769. baseEncodingName = isName(baseEncodingName) ? baseEncodingName.name : null;
  26770. if (encoding.has('Differences')) {
  26771. var diffEncoding = encoding.get('Differences');
  26772. var index = 0;
  26773. for (var j = 0, jj = diffEncoding.length; j < jj; j++) {
  26774. var data = xref.fetchIfRef(diffEncoding[j]);
  26775. if (isNum(data)) {
  26776. index = data;
  26777. } else if (isName(data)) {
  26778. differences[index++] = data.name;
  26779. } else {
  26780. error('Invalid entry in \'Differences\' array: ' + data);
  26781. }
  26782. }
  26783. }
  26784. } else if (isName(encoding)) {
  26785. baseEncodingName = encoding.name;
  26786. } else {
  26787. error('Encoding is not a Name nor a Dict');
  26788. }
  26789. if (baseEncodingName !== 'MacRomanEncoding' && baseEncodingName !== 'MacExpertEncoding' && baseEncodingName !== 'WinAnsiEncoding') {
  26790. baseEncodingName = null;
  26791. }
  26792. }
  26793. if (baseEncodingName) {
  26794. properties.defaultEncoding = getEncoding(baseEncodingName).slice();
  26795. } else {
  26796. var isSymbolicFont = !!(properties.flags & FontFlags.Symbolic);
  26797. var isNonsymbolicFont = !!(properties.flags & FontFlags.Nonsymbolic);
  26798. encoding = StandardEncoding;
  26799. if (properties.type === 'TrueType' && !isNonsymbolicFont) {
  26800. encoding = WinAnsiEncoding;
  26801. }
  26802. if (isSymbolicFont) {
  26803. encoding = MacRomanEncoding;
  26804. if (!properties.file) {
  26805. if (/Symbol/i.test(properties.name)) {
  26806. encoding = SymbolSetEncoding;
  26807. } else if (/Dingbats/i.test(properties.name)) {
  26808. encoding = ZapfDingbatsEncoding;
  26809. }
  26810. }
  26811. }
  26812. properties.defaultEncoding = encoding;
  26813. }
  26814. properties.differences = differences;
  26815. properties.baseEncodingName = baseEncodingName;
  26816. properties.hasEncoding = !!baseEncodingName || differences.length > 0;
  26817. properties.dict = dict;
  26818. return toUnicodePromise.then(function (toUnicode) {
  26819. properties.toUnicode = toUnicode;
  26820. return this.buildToUnicode(properties);
  26821. }.bind(this)).then(function (toUnicode) {
  26822. properties.toUnicode = toUnicode;
  26823. return properties;
  26824. });
  26825. },
  26826. buildToUnicode: function PartialEvaluator_buildToUnicode(properties) {
  26827. properties.hasIncludedToUnicodeMap = !!properties.toUnicode && properties.toUnicode.length > 0;
  26828. if (properties.hasIncludedToUnicodeMap) {
  26829. return Promise.resolve(properties.toUnicode);
  26830. }
  26831. var toUnicode, charcode, glyphName;
  26832. if (!properties.composite) {
  26833. toUnicode = [];
  26834. var encoding = properties.defaultEncoding.slice();
  26835. var baseEncodingName = properties.baseEncodingName;
  26836. var differences = properties.differences;
  26837. for (charcode in differences) {
  26838. glyphName = differences[charcode];
  26839. if (glyphName === '.notdef') {
  26840. continue;
  26841. }
  26842. encoding[charcode] = glyphName;
  26843. }
  26844. var glyphsUnicodeMap = getGlyphsUnicode();
  26845. for (charcode in encoding) {
  26846. glyphName = encoding[charcode];
  26847. if (glyphName === '') {
  26848. continue;
  26849. } else if (glyphsUnicodeMap[glyphName] === undefined) {
  26850. var code = 0;
  26851. switch (glyphName[0]) {
  26852. case 'G':
  26853. if (glyphName.length === 3) {
  26854. code = parseInt(glyphName.substr(1), 16);
  26855. }
  26856. break;
  26857. case 'g':
  26858. if (glyphName.length === 5) {
  26859. code = parseInt(glyphName.substr(1), 16);
  26860. }
  26861. break;
  26862. case 'C':
  26863. case 'c':
  26864. if (glyphName.length >= 3) {
  26865. code = +glyphName.substr(1);
  26866. }
  26867. break;
  26868. default:
  26869. var unicode = getUnicodeForGlyph(glyphName, glyphsUnicodeMap);
  26870. if (unicode !== -1) {
  26871. code = unicode;
  26872. }
  26873. }
  26874. if (code) {
  26875. if (baseEncodingName && code === +charcode) {
  26876. var baseEncoding = getEncoding(baseEncodingName);
  26877. if (baseEncoding && (glyphName = baseEncoding[charcode])) {
  26878. toUnicode[charcode] = String.fromCharCode(glyphsUnicodeMap[glyphName]);
  26879. continue;
  26880. }
  26881. }
  26882. toUnicode[charcode] = String.fromCharCode(code);
  26883. }
  26884. continue;
  26885. }
  26886. toUnicode[charcode] = String.fromCharCode(glyphsUnicodeMap[glyphName]);
  26887. }
  26888. return Promise.resolve(new ToUnicodeMap(toUnicode));
  26889. }
  26890. 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'))) {
  26891. var registry = properties.cidSystemInfo.registry;
  26892. var ordering = properties.cidSystemInfo.ordering;
  26893. var ucs2CMapName = Name.get(registry + '-' + ordering + '-UCS2');
  26894. return CMapFactory.create({
  26895. encoding: ucs2CMapName,
  26896. fetchBuiltInCMap: this.fetchBuiltInCMap,
  26897. useCMap: null
  26898. }).then(function (ucs2CMap) {
  26899. var cMap = properties.cMap;
  26900. toUnicode = [];
  26901. cMap.forEach(function (charcode, cid) {
  26902. assert(cid <= 0xffff, 'Max size of CID is 65,535');
  26903. var ucs2 = ucs2CMap.lookup(cid);
  26904. if (ucs2) {
  26905. toUnicode[charcode] = String.fromCharCode((ucs2.charCodeAt(0) << 8) + ucs2.charCodeAt(1));
  26906. }
  26907. });
  26908. return new ToUnicodeMap(toUnicode);
  26909. });
  26910. }
  26911. return Promise.resolve(new IdentityToUnicodeMap(properties.firstChar, properties.lastChar));
  26912. },
  26913. readToUnicode: function PartialEvaluator_readToUnicode(toUnicode) {
  26914. var cmapObj = toUnicode;
  26915. if (isName(cmapObj)) {
  26916. return CMapFactory.create({
  26917. encoding: cmapObj,
  26918. fetchBuiltInCMap: this.fetchBuiltInCMap,
  26919. useCMap: null
  26920. }).then(function (cmap) {
  26921. if (cmap instanceof IdentityCMap) {
  26922. return new IdentityToUnicodeMap(0, 0xFFFF);
  26923. }
  26924. return new ToUnicodeMap(cmap.getMap());
  26925. });
  26926. } else if (isStream(cmapObj)) {
  26927. return CMapFactory.create({
  26928. encoding: cmapObj,
  26929. fetchBuiltInCMap: this.fetchBuiltInCMap,
  26930. useCMap: null
  26931. }).then(function (cmap) {
  26932. if (cmap instanceof IdentityCMap) {
  26933. return new IdentityToUnicodeMap(0, 0xFFFF);
  26934. }
  26935. var map = new Array(cmap.length);
  26936. cmap.forEach(function (charCode, token) {
  26937. var str = [];
  26938. for (var k = 0; k < token.length; k += 2) {
  26939. var w1 = token.charCodeAt(k) << 8 | token.charCodeAt(k + 1);
  26940. if ((w1 & 0xF800) !== 0xD800) {
  26941. str.push(w1);
  26942. continue;
  26943. }
  26944. k += 2;
  26945. var w2 = token.charCodeAt(k) << 8 | token.charCodeAt(k + 1);
  26946. str.push(((w1 & 0x3ff) << 10) + (w2 & 0x3ff) + 0x10000);
  26947. }
  26948. map[charCode] = String.fromCharCode.apply(String, str);
  26949. });
  26950. return new ToUnicodeMap(map);
  26951. });
  26952. }
  26953. return Promise.resolve(null);
  26954. },
  26955. readCidToGidMap: function PartialEvaluator_readCidToGidMap(cidToGidStream) {
  26956. var glyphsData = cidToGidStream.getBytes();
  26957. var result = [];
  26958. for (var j = 0, jj = glyphsData.length; j < jj; j++) {
  26959. var glyphID = glyphsData[j++] << 8 | glyphsData[j];
  26960. if (glyphID === 0) {
  26961. continue;
  26962. }
  26963. var code = j >> 1;
  26964. result[code] = glyphID;
  26965. }
  26966. return result;
  26967. },
  26968. extractWidths: function PartialEvaluator_extractWidths(dict, xref, descriptor, properties) {
  26969. var glyphsWidths = [];
  26970. var defaultWidth = 0;
  26971. var glyphsVMetrics = [];
  26972. var defaultVMetrics;
  26973. var i, ii, j, jj, start, code, widths;
  26974. if (properties.composite) {
  26975. defaultWidth = dict.get('DW') || 1000;
  26976. widths = dict.get('W');
  26977. if (widths) {
  26978. for (i = 0, ii = widths.length; i < ii; i++) {
  26979. start = xref.fetchIfRef(widths[i++]);
  26980. code = xref.fetchIfRef(widths[i]);
  26981. if (isArray(code)) {
  26982. for (j = 0, jj = code.length; j < jj; j++) {
  26983. glyphsWidths[start++] = xref.fetchIfRef(code[j]);
  26984. }
  26985. } else {
  26986. var width = xref.fetchIfRef(widths[++i]);
  26987. for (j = start; j <= code; j++) {
  26988. glyphsWidths[j] = width;
  26989. }
  26990. }
  26991. }
  26992. }
  26993. if (properties.vertical) {
  26994. var vmetrics = dict.getArray('DW2') || [
  26995. 880,
  26996. -1000
  26997. ];
  26998. defaultVMetrics = [
  26999. vmetrics[1],
  27000. defaultWidth * 0.5,
  27001. vmetrics[0]
  27002. ];
  27003. vmetrics = dict.get('W2');
  27004. if (vmetrics) {
  27005. for (i = 0, ii = vmetrics.length; i < ii; i++) {
  27006. start = xref.fetchIfRef(vmetrics[i++]);
  27007. code = xref.fetchIfRef(vmetrics[i]);
  27008. if (isArray(code)) {
  27009. for (j = 0, jj = code.length; j < jj; j++) {
  27010. glyphsVMetrics[start++] = [
  27011. xref.fetchIfRef(code[j++]),
  27012. xref.fetchIfRef(code[j++]),
  27013. xref.fetchIfRef(code[j])
  27014. ];
  27015. }
  27016. } else {
  27017. var vmetric = [
  27018. xref.fetchIfRef(vmetrics[++i]),
  27019. xref.fetchIfRef(vmetrics[++i]),
  27020. xref.fetchIfRef(vmetrics[++i])
  27021. ];
  27022. for (j = start; j <= code; j++) {
  27023. glyphsVMetrics[j] = vmetric;
  27024. }
  27025. }
  27026. }
  27027. }
  27028. }
  27029. } else {
  27030. var firstChar = properties.firstChar;
  27031. widths = dict.get('Widths');
  27032. if (widths) {
  27033. j = firstChar;
  27034. for (i = 0, ii = widths.length; i < ii; i++) {
  27035. glyphsWidths[j++] = xref.fetchIfRef(widths[i]);
  27036. }
  27037. defaultWidth = parseFloat(descriptor.get('MissingWidth')) || 0;
  27038. } else {
  27039. var baseFontName = dict.get('BaseFont');
  27040. if (isName(baseFontName)) {
  27041. var metrics = this.getBaseFontMetrics(baseFontName.name);
  27042. glyphsWidths = this.buildCharCodeToWidth(metrics.widths, properties);
  27043. defaultWidth = metrics.defaultWidth;
  27044. }
  27045. }
  27046. }
  27047. var isMonospace = true;
  27048. var firstWidth = defaultWidth;
  27049. for (var glyph in glyphsWidths) {
  27050. var glyphWidth = glyphsWidths[glyph];
  27051. if (!glyphWidth) {
  27052. continue;
  27053. }
  27054. if (!firstWidth) {
  27055. firstWidth = glyphWidth;
  27056. continue;
  27057. }
  27058. if (firstWidth !== glyphWidth) {
  27059. isMonospace = false;
  27060. break;
  27061. }
  27062. }
  27063. if (isMonospace) {
  27064. properties.flags |= FontFlags.FixedPitch;
  27065. }
  27066. properties.defaultWidth = defaultWidth;
  27067. properties.widths = glyphsWidths;
  27068. properties.defaultVMetrics = defaultVMetrics;
  27069. properties.vmetrics = glyphsVMetrics;
  27070. },
  27071. isSerifFont: function PartialEvaluator_isSerifFont(baseFontName) {
  27072. var fontNameWoStyle = baseFontName.split('-')[0];
  27073. return fontNameWoStyle in getSerifFonts() || fontNameWoStyle.search(/serif/gi) !== -1;
  27074. },
  27075. getBaseFontMetrics: function PartialEvaluator_getBaseFontMetrics(name) {
  27076. var defaultWidth = 0;
  27077. var widths = [];
  27078. var monospace = false;
  27079. var stdFontMap = getStdFontMap();
  27080. var lookupName = stdFontMap[name] || name;
  27081. var Metrics = getMetrics();
  27082. if (!(lookupName in Metrics)) {
  27083. if (this.isSerifFont(name)) {
  27084. lookupName = 'Times-Roman';
  27085. } else {
  27086. lookupName = 'Helvetica';
  27087. }
  27088. }
  27089. var glyphWidths = Metrics[lookupName];
  27090. if (isNum(glyphWidths)) {
  27091. defaultWidth = glyphWidths;
  27092. monospace = true;
  27093. } else {
  27094. widths = glyphWidths();
  27095. }
  27096. return {
  27097. defaultWidth: defaultWidth,
  27098. monospace: monospace,
  27099. widths: widths
  27100. };
  27101. },
  27102. buildCharCodeToWidth: function PartialEvaluator_bulildCharCodeToWidth(widthsByGlyphName, properties) {
  27103. var widths = Object.create(null);
  27104. var differences = properties.differences;
  27105. var encoding = properties.defaultEncoding;
  27106. for (var charCode = 0; charCode < 256; charCode++) {
  27107. if (charCode in differences && widthsByGlyphName[differences[charCode]]) {
  27108. widths[charCode] = widthsByGlyphName[differences[charCode]];
  27109. continue;
  27110. }
  27111. if (charCode in encoding && widthsByGlyphName[encoding[charCode]]) {
  27112. widths[charCode] = widthsByGlyphName[encoding[charCode]];
  27113. continue;
  27114. }
  27115. }
  27116. return widths;
  27117. },
  27118. preEvaluateFont: function PartialEvaluator_preEvaluateFont(dict, xref) {
  27119. var baseDict = dict;
  27120. var type = dict.get('Subtype');
  27121. assert(isName(type), 'invalid font Subtype');
  27122. var composite = false;
  27123. var uint8array;
  27124. if (type.name === 'Type0') {
  27125. var df = dict.get('DescendantFonts');
  27126. if (!df) {
  27127. error('Descendant fonts are not specified');
  27128. }
  27129. dict = isArray(df) ? xref.fetchIfRef(df[0]) : df;
  27130. type = dict.get('Subtype');
  27131. assert(isName(type), 'invalid font Subtype');
  27132. composite = true;
  27133. }
  27134. var descriptor = dict.get('FontDescriptor');
  27135. if (descriptor) {
  27136. var hash = new MurmurHash3_64();
  27137. var encoding = baseDict.getRaw('Encoding');
  27138. if (isName(encoding)) {
  27139. hash.update(encoding.name);
  27140. } else if (isRef(encoding)) {
  27141. hash.update(encoding.toString());
  27142. } else if (isDict(encoding)) {
  27143. var keys = encoding.getKeys();
  27144. for (var i = 0, ii = keys.length; i < ii; i++) {
  27145. var entry = encoding.getRaw(keys[i]);
  27146. if (isName(entry)) {
  27147. hash.update(entry.name);
  27148. } else if (isRef(entry)) {
  27149. hash.update(entry.toString());
  27150. } else if (isArray(entry)) {
  27151. var diffLength = entry.length, diffBuf = new Array(diffLength);
  27152. for (var j = 0; j < diffLength; j++) {
  27153. var diffEntry = entry[j];
  27154. if (isName(diffEntry)) {
  27155. diffBuf[j] = diffEntry.name;
  27156. } else if (isNum(diffEntry) || isRef(diffEntry)) {
  27157. diffBuf[j] = diffEntry.toString();
  27158. }
  27159. }
  27160. hash.update(diffBuf.join());
  27161. }
  27162. }
  27163. }
  27164. var toUnicode = dict.get('ToUnicode') || baseDict.get('ToUnicode');
  27165. if (isStream(toUnicode)) {
  27166. var stream = toUnicode.str || toUnicode;
  27167. uint8array = stream.buffer ? new Uint8Array(stream.buffer.buffer, 0, stream.bufferLength) : new Uint8Array(stream.bytes.buffer, stream.start, stream.end - stream.start);
  27168. hash.update(uint8array);
  27169. } else if (isName(toUnicode)) {
  27170. hash.update(toUnicode.name);
  27171. }
  27172. var widths = dict.get('Widths') || baseDict.get('Widths');
  27173. if (widths) {
  27174. uint8array = new Uint8Array(new Uint32Array(widths).buffer);
  27175. hash.update(uint8array);
  27176. }
  27177. }
  27178. return {
  27179. descriptor: descriptor,
  27180. dict: dict,
  27181. baseDict: baseDict,
  27182. composite: composite,
  27183. type: type.name,
  27184. hash: hash ? hash.hexdigest() : ''
  27185. };
  27186. },
  27187. translateFont: function PartialEvaluator_translateFont(preEvaluatedFont, xref) {
  27188. var baseDict = preEvaluatedFont.baseDict;
  27189. var dict = preEvaluatedFont.dict;
  27190. var composite = preEvaluatedFont.composite;
  27191. var descriptor = preEvaluatedFont.descriptor;
  27192. var type = preEvaluatedFont.type;
  27193. var maxCharIndex = composite ? 0xFFFF : 0xFF;
  27194. var properties;
  27195. if (!descriptor) {
  27196. if (type === 'Type3') {
  27197. descriptor = new Dict(null);
  27198. descriptor.set('FontName', Name.get(type));
  27199. descriptor.set('FontBBox', dict.getArray('FontBBox'));
  27200. } else {
  27201. var baseFontName = dict.get('BaseFont');
  27202. if (!isName(baseFontName)) {
  27203. error('Base font is not specified');
  27204. }
  27205. baseFontName = baseFontName.name.replace(/[,_]/g, '-');
  27206. var metrics = this.getBaseFontMetrics(baseFontName);
  27207. var fontNameWoStyle = baseFontName.split('-')[0];
  27208. var flags = (this.isSerifFont(fontNameWoStyle) ? FontFlags.Serif : 0) | (metrics.monospace ? FontFlags.FixedPitch : 0) | (getSymbolsFonts()[fontNameWoStyle] ? FontFlags.Symbolic : FontFlags.Nonsymbolic);
  27209. properties = {
  27210. type: type,
  27211. name: baseFontName,
  27212. widths: metrics.widths,
  27213. defaultWidth: metrics.defaultWidth,
  27214. flags: flags,
  27215. firstChar: 0,
  27216. lastChar: maxCharIndex
  27217. };
  27218. return this.extractDataStructures(dict, dict, xref, properties).then(function (properties) {
  27219. properties.widths = this.buildCharCodeToWidth(metrics.widths, properties);
  27220. return new Font(baseFontName, null, properties);
  27221. }.bind(this));
  27222. }
  27223. }
  27224. var firstChar = dict.get('FirstChar') || 0;
  27225. var lastChar = dict.get('LastChar') || maxCharIndex;
  27226. var fontName = descriptor.get('FontName');
  27227. var baseFont = dict.get('BaseFont');
  27228. if (isString(fontName)) {
  27229. fontName = Name.get(fontName);
  27230. }
  27231. if (isString(baseFont)) {
  27232. baseFont = Name.get(baseFont);
  27233. }
  27234. if (type !== 'Type3') {
  27235. var fontNameStr = fontName && fontName.name;
  27236. var baseFontStr = baseFont && baseFont.name;
  27237. if (fontNameStr !== baseFontStr) {
  27238. info('The FontDescriptor\'s FontName is "' + fontNameStr + '" but should be the same as the Font\'s BaseFont "' + baseFontStr + '"');
  27239. if (fontNameStr && baseFontStr && baseFontStr.indexOf(fontNameStr) === 0) {
  27240. fontName = baseFont;
  27241. }
  27242. }
  27243. }
  27244. fontName = fontName || baseFont;
  27245. assert(isName(fontName), 'invalid font name');
  27246. var fontFile = descriptor.get('FontFile', 'FontFile2', 'FontFile3');
  27247. if (fontFile) {
  27248. if (fontFile.dict) {
  27249. var subtype = fontFile.dict.get('Subtype');
  27250. if (subtype) {
  27251. subtype = subtype.name;
  27252. }
  27253. var length1 = fontFile.dict.get('Length1');
  27254. var length2 = fontFile.dict.get('Length2');
  27255. var length3 = fontFile.dict.get('Length3');
  27256. }
  27257. }
  27258. properties = {
  27259. type: type,
  27260. name: fontName.name,
  27261. subtype: subtype,
  27262. file: fontFile,
  27263. length1: length1,
  27264. length2: length2,
  27265. length3: length3,
  27266. loadedName: baseDict.loadedName,
  27267. composite: composite,
  27268. wideChars: composite,
  27269. fixedPitch: false,
  27270. fontMatrix: dict.getArray('FontMatrix') || FONT_IDENTITY_MATRIX,
  27271. firstChar: firstChar || 0,
  27272. lastChar: lastChar || maxCharIndex,
  27273. bbox: descriptor.getArray('FontBBox'),
  27274. ascent: descriptor.get('Ascent'),
  27275. descent: descriptor.get('Descent'),
  27276. xHeight: descriptor.get('XHeight'),
  27277. capHeight: descriptor.get('CapHeight'),
  27278. flags: descriptor.get('Flags'),
  27279. italicAngle: descriptor.get('ItalicAngle'),
  27280. coded: false
  27281. };
  27282. var cMapPromise;
  27283. if (composite) {
  27284. var cidEncoding = baseDict.get('Encoding');
  27285. if (isName(cidEncoding)) {
  27286. properties.cidEncoding = cidEncoding.name;
  27287. }
  27288. cMapPromise = CMapFactory.create({
  27289. encoding: cidEncoding,
  27290. fetchBuiltInCMap: this.fetchBuiltInCMap,
  27291. useCMap: null
  27292. }).then(function (cMap) {
  27293. properties.cMap = cMap;
  27294. properties.vertical = properties.cMap.vertical;
  27295. });
  27296. } else {
  27297. cMapPromise = Promise.resolve(undefined);
  27298. }
  27299. return cMapPromise.then(function () {
  27300. return this.extractDataStructures(dict, baseDict, xref, properties);
  27301. }.bind(this)).then(function (properties) {
  27302. this.extractWidths(dict, xref, descriptor, properties);
  27303. if (type === 'Type3') {
  27304. properties.isType3Font = true;
  27305. }
  27306. return new Font(fontName.name, fontFile, properties);
  27307. }.bind(this));
  27308. }
  27309. };
  27310. return PartialEvaluator;
  27311. }();
  27312. var TranslatedFont = function TranslatedFontClosure() {
  27313. function TranslatedFont(loadedName, font, dict) {
  27314. this.loadedName = loadedName;
  27315. this.font = font;
  27316. this.dict = dict;
  27317. this.type3Loaded = null;
  27318. this.sent = false;
  27319. }
  27320. TranslatedFont.prototype = {
  27321. send: function (handler) {
  27322. if (this.sent) {
  27323. return;
  27324. }
  27325. var fontData = this.font.exportData();
  27326. handler.send('commonobj', [
  27327. this.loadedName,
  27328. 'Font',
  27329. fontData
  27330. ]);
  27331. this.sent = true;
  27332. },
  27333. loadType3Data: function (evaluator, resources, parentOperatorList, task) {
  27334. assert(this.font.isType3Font);
  27335. if (this.type3Loaded) {
  27336. return this.type3Loaded;
  27337. }
  27338. var translatedFont = this.font;
  27339. var loadCharProcsPromise = Promise.resolve();
  27340. var charProcs = this.dict.get('CharProcs');
  27341. var fontResources = this.dict.get('Resources') || resources;
  27342. var charProcKeys = charProcs.getKeys();
  27343. var charProcOperatorList = Object.create(null);
  27344. for (var i = 0, n = charProcKeys.length; i < n; ++i) {
  27345. loadCharProcsPromise = loadCharProcsPromise.then(function (key) {
  27346. var glyphStream = charProcs.get(key);
  27347. var operatorList = new OperatorList();
  27348. return evaluator.getOperatorList(glyphStream, task, fontResources, operatorList).then(function () {
  27349. charProcOperatorList[key] = operatorList.getIR();
  27350. parentOperatorList.addDependencies(operatorList.dependencies);
  27351. }, function (reason) {
  27352. warn('Type3 font resource \"' + key + '\" is not available');
  27353. var operatorList = new OperatorList();
  27354. charProcOperatorList[key] = operatorList.getIR();
  27355. });
  27356. }.bind(this, charProcKeys[i]));
  27357. }
  27358. this.type3Loaded = loadCharProcsPromise.then(function () {
  27359. translatedFont.charProcOperatorList = charProcOperatorList;
  27360. });
  27361. return this.type3Loaded;
  27362. }
  27363. };
  27364. return TranslatedFont;
  27365. }();
  27366. var OperatorList = function OperatorListClosure() {
  27367. var CHUNK_SIZE = 1000;
  27368. var CHUNK_SIZE_ABOUT = CHUNK_SIZE - 5;
  27369. function getTransfers(queue) {
  27370. var transfers = [];
  27371. var fnArray = queue.fnArray, argsArray = queue.argsArray;
  27372. for (var i = 0, ii = queue.length; i < ii; i++) {
  27373. switch (fnArray[i]) {
  27374. case OPS.paintInlineImageXObject:
  27375. case OPS.paintInlineImageXObjectGroup:
  27376. case OPS.paintImageMaskXObject:
  27377. var arg = argsArray[i][0];
  27378. if (!arg.cached) {
  27379. transfers.push(arg.data.buffer);
  27380. }
  27381. break;
  27382. }
  27383. }
  27384. return transfers;
  27385. }
  27386. function OperatorList(intent, messageHandler, pageIndex) {
  27387. this.messageHandler = messageHandler;
  27388. this.fnArray = [];
  27389. this.argsArray = [];
  27390. this.dependencies = Object.create(null);
  27391. this._totalLength = 0;
  27392. this.pageIndex = pageIndex;
  27393. this.intent = intent;
  27394. }
  27395. OperatorList.prototype = {
  27396. get length() {
  27397. return this.argsArray.length;
  27398. },
  27399. get totalLength() {
  27400. return this._totalLength + this.length;
  27401. },
  27402. addOp: function (fn, args) {
  27403. this.fnArray.push(fn);
  27404. this.argsArray.push(args);
  27405. if (this.messageHandler) {
  27406. if (this.fnArray.length >= CHUNK_SIZE) {
  27407. this.flush();
  27408. } else if (this.fnArray.length >= CHUNK_SIZE_ABOUT && (fn === OPS.restore || fn === OPS.endText)) {
  27409. this.flush();
  27410. }
  27411. }
  27412. },
  27413. addDependency: function (dependency) {
  27414. if (dependency in this.dependencies) {
  27415. return;
  27416. }
  27417. this.dependencies[dependency] = true;
  27418. this.addOp(OPS.dependency, [dependency]);
  27419. },
  27420. addDependencies: function (dependencies) {
  27421. for (var key in dependencies) {
  27422. this.addDependency(key);
  27423. }
  27424. },
  27425. addOpList: function (opList) {
  27426. Util.extendObj(this.dependencies, opList.dependencies);
  27427. for (var i = 0, ii = opList.length; i < ii; i++) {
  27428. this.addOp(opList.fnArray[i], opList.argsArray[i]);
  27429. }
  27430. },
  27431. getIR: function () {
  27432. return {
  27433. fnArray: this.fnArray,
  27434. argsArray: this.argsArray,
  27435. length: this.length
  27436. };
  27437. },
  27438. flush: function (lastChunk) {
  27439. if (this.intent !== 'oplist') {
  27440. new QueueOptimizer().optimize(this);
  27441. }
  27442. var transfers = getTransfers(this);
  27443. var length = this.length;
  27444. this._totalLength += length;
  27445. this.messageHandler.send('RenderPageChunk', {
  27446. operatorList: {
  27447. fnArray: this.fnArray,
  27448. argsArray: this.argsArray,
  27449. lastChunk: lastChunk,
  27450. length: length
  27451. },
  27452. pageIndex: this.pageIndex,
  27453. intent: this.intent
  27454. }, transfers);
  27455. this.dependencies = Object.create(null);
  27456. this.fnArray.length = 0;
  27457. this.argsArray.length = 0;
  27458. }
  27459. };
  27460. return OperatorList;
  27461. }();
  27462. var StateManager = function StateManagerClosure() {
  27463. function StateManager(initialState) {
  27464. this.state = initialState;
  27465. this.stateStack = [];
  27466. }
  27467. StateManager.prototype = {
  27468. save: function () {
  27469. var old = this.state;
  27470. this.stateStack.push(this.state);
  27471. this.state = old.clone();
  27472. },
  27473. restore: function () {
  27474. var prev = this.stateStack.pop();
  27475. if (prev) {
  27476. this.state = prev;
  27477. }
  27478. },
  27479. transform: function (args) {
  27480. this.state.ctm = Util.transform(this.state.ctm, args);
  27481. }
  27482. };
  27483. return StateManager;
  27484. }();
  27485. var TextState = function TextStateClosure() {
  27486. function TextState() {
  27487. this.ctm = new Float32Array(IDENTITY_MATRIX);
  27488. this.fontName = null;
  27489. this.fontSize = 0;
  27490. this.font = null;
  27491. this.fontMatrix = FONT_IDENTITY_MATRIX;
  27492. this.textMatrix = IDENTITY_MATRIX.slice();
  27493. this.textLineMatrix = IDENTITY_MATRIX.slice();
  27494. this.charSpacing = 0;
  27495. this.wordSpacing = 0;
  27496. this.leading = 0;
  27497. this.textHScale = 1;
  27498. this.textRise = 0;
  27499. }
  27500. TextState.prototype = {
  27501. setTextMatrix: function TextState_setTextMatrix(a, b, c, d, e, f) {
  27502. var m = this.textMatrix;
  27503. m[0] = a;
  27504. m[1] = b;
  27505. m[2] = c;
  27506. m[3] = d;
  27507. m[4] = e;
  27508. m[5] = f;
  27509. },
  27510. setTextLineMatrix: function TextState_setTextMatrix(a, b, c, d, e, f) {
  27511. var m = this.textLineMatrix;
  27512. m[0] = a;
  27513. m[1] = b;
  27514. m[2] = c;
  27515. m[3] = d;
  27516. m[4] = e;
  27517. m[5] = f;
  27518. },
  27519. translateTextMatrix: function TextState_translateTextMatrix(x, y) {
  27520. var m = this.textMatrix;
  27521. m[4] = m[0] * x + m[2] * y + m[4];
  27522. m[5] = m[1] * x + m[3] * y + m[5];
  27523. },
  27524. translateTextLineMatrix: function TextState_translateTextMatrix(x, y) {
  27525. var m = this.textLineMatrix;
  27526. m[4] = m[0] * x + m[2] * y + m[4];
  27527. m[5] = m[1] * x + m[3] * y + m[5];
  27528. },
  27529. calcTextLineMatrixAdvance: function TextState_calcTextLineMatrixAdvance(a, b, c, d, e, f) {
  27530. var font = this.font;
  27531. if (!font) {
  27532. return null;
  27533. }
  27534. var m = this.textLineMatrix;
  27535. if (!(a === m[0] && b === m[1] && c === m[2] && d === m[3])) {
  27536. return null;
  27537. }
  27538. var txDiff = e - m[4], tyDiff = f - m[5];
  27539. if (font.vertical && txDiff !== 0 || !font.vertical && tyDiff !== 0) {
  27540. return null;
  27541. }
  27542. var tx, ty, denominator = a * d - b * c;
  27543. if (font.vertical) {
  27544. tx = -tyDiff * c / denominator;
  27545. ty = tyDiff * a / denominator;
  27546. } else {
  27547. tx = txDiff * d / denominator;
  27548. ty = -txDiff * b / denominator;
  27549. }
  27550. return {
  27551. width: tx,
  27552. height: ty,
  27553. value: font.vertical ? ty : tx
  27554. };
  27555. },
  27556. calcRenderMatrix: function TextState_calcRendeMatrix(ctm) {
  27557. var tsm = [
  27558. this.fontSize * this.textHScale,
  27559. 0,
  27560. 0,
  27561. this.fontSize,
  27562. 0,
  27563. this.textRise
  27564. ];
  27565. return Util.transform(ctm, Util.transform(this.textMatrix, tsm));
  27566. },
  27567. carriageReturn: function TextState_carriageReturn() {
  27568. this.translateTextLineMatrix(0, -this.leading);
  27569. this.textMatrix = this.textLineMatrix.slice();
  27570. },
  27571. clone: function TextState_clone() {
  27572. var clone = Object.create(this);
  27573. clone.textMatrix = this.textMatrix.slice();
  27574. clone.textLineMatrix = this.textLineMatrix.slice();
  27575. clone.fontMatrix = this.fontMatrix.slice();
  27576. return clone;
  27577. }
  27578. };
  27579. return TextState;
  27580. }();
  27581. var EvalState = function EvalStateClosure() {
  27582. function EvalState() {
  27583. this.ctm = new Float32Array(IDENTITY_MATRIX);
  27584. this.font = null;
  27585. this.textRenderingMode = TextRenderingMode.FILL;
  27586. this.fillColorSpace = ColorSpace.singletons.gray;
  27587. this.strokeColorSpace = ColorSpace.singletons.gray;
  27588. }
  27589. EvalState.prototype = {
  27590. clone: function CanvasExtraState_clone() {
  27591. return Object.create(this);
  27592. }
  27593. };
  27594. return EvalState;
  27595. }();
  27596. var EvaluatorPreprocessor = function EvaluatorPreprocessorClosure() {
  27597. var getOPMap = getLookupTableFactory(function (t) {
  27598. t['w'] = {
  27599. id: OPS.setLineWidth,
  27600. numArgs: 1,
  27601. variableArgs: false
  27602. };
  27603. t['J'] = {
  27604. id: OPS.setLineCap,
  27605. numArgs: 1,
  27606. variableArgs: false
  27607. };
  27608. t['j'] = {
  27609. id: OPS.setLineJoin,
  27610. numArgs: 1,
  27611. variableArgs: false
  27612. };
  27613. t['M'] = {
  27614. id: OPS.setMiterLimit,
  27615. numArgs: 1,
  27616. variableArgs: false
  27617. };
  27618. t['d'] = {
  27619. id: OPS.setDash,
  27620. numArgs: 2,
  27621. variableArgs: false
  27622. };
  27623. t['ri'] = {
  27624. id: OPS.setRenderingIntent,
  27625. numArgs: 1,
  27626. variableArgs: false
  27627. };
  27628. t['i'] = {
  27629. id: OPS.setFlatness,
  27630. numArgs: 1,
  27631. variableArgs: false
  27632. };
  27633. t['gs'] = {
  27634. id: OPS.setGState,
  27635. numArgs: 1,
  27636. variableArgs: false
  27637. };
  27638. t['q'] = {
  27639. id: OPS.save,
  27640. numArgs: 0,
  27641. variableArgs: false
  27642. };
  27643. t['Q'] = {
  27644. id: OPS.restore,
  27645. numArgs: 0,
  27646. variableArgs: false
  27647. };
  27648. t['cm'] = {
  27649. id: OPS.transform,
  27650. numArgs: 6,
  27651. variableArgs: false
  27652. };
  27653. t['m'] = {
  27654. id: OPS.moveTo,
  27655. numArgs: 2,
  27656. variableArgs: false
  27657. };
  27658. t['l'] = {
  27659. id: OPS.lineTo,
  27660. numArgs: 2,
  27661. variableArgs: false
  27662. };
  27663. t['c'] = {
  27664. id: OPS.curveTo,
  27665. numArgs: 6,
  27666. variableArgs: false
  27667. };
  27668. t['v'] = {
  27669. id: OPS.curveTo2,
  27670. numArgs: 4,
  27671. variableArgs: false
  27672. };
  27673. t['y'] = {
  27674. id: OPS.curveTo3,
  27675. numArgs: 4,
  27676. variableArgs: false
  27677. };
  27678. t['h'] = {
  27679. id: OPS.closePath,
  27680. numArgs: 0,
  27681. variableArgs: false
  27682. };
  27683. t['re'] = {
  27684. id: OPS.rectangle,
  27685. numArgs: 4,
  27686. variableArgs: false
  27687. };
  27688. t['S'] = {
  27689. id: OPS.stroke,
  27690. numArgs: 0,
  27691. variableArgs: false
  27692. };
  27693. t['s'] = {
  27694. id: OPS.closeStroke,
  27695. numArgs: 0,
  27696. variableArgs: false
  27697. };
  27698. t['f'] = {
  27699. id: OPS.fill,
  27700. numArgs: 0,
  27701. variableArgs: false
  27702. };
  27703. t['F'] = {
  27704. id: OPS.fill,
  27705. numArgs: 0,
  27706. variableArgs: false
  27707. };
  27708. t['f*'] = {
  27709. id: OPS.eoFill,
  27710. numArgs: 0,
  27711. variableArgs: false
  27712. };
  27713. t['B'] = {
  27714. id: OPS.fillStroke,
  27715. numArgs: 0,
  27716. variableArgs: false
  27717. };
  27718. t['B*'] = {
  27719. id: OPS.eoFillStroke,
  27720. numArgs: 0,
  27721. variableArgs: false
  27722. };
  27723. t['b'] = {
  27724. id: OPS.closeFillStroke,
  27725. numArgs: 0,
  27726. variableArgs: false
  27727. };
  27728. t['b*'] = {
  27729. id: OPS.closeEOFillStroke,
  27730. numArgs: 0,
  27731. variableArgs: false
  27732. };
  27733. t['n'] = {
  27734. id: OPS.endPath,
  27735. numArgs: 0,
  27736. variableArgs: false
  27737. };
  27738. t['W'] = {
  27739. id: OPS.clip,
  27740. numArgs: 0,
  27741. variableArgs: false
  27742. };
  27743. t['W*'] = {
  27744. id: OPS.eoClip,
  27745. numArgs: 0,
  27746. variableArgs: false
  27747. };
  27748. t['BT'] = {
  27749. id: OPS.beginText,
  27750. numArgs: 0,
  27751. variableArgs: false
  27752. };
  27753. t['ET'] = {
  27754. id: OPS.endText,
  27755. numArgs: 0,
  27756. variableArgs: false
  27757. };
  27758. t['Tc'] = {
  27759. id: OPS.setCharSpacing,
  27760. numArgs: 1,
  27761. variableArgs: false
  27762. };
  27763. t['Tw'] = {
  27764. id: OPS.setWordSpacing,
  27765. numArgs: 1,
  27766. variableArgs: false
  27767. };
  27768. t['Tz'] = {
  27769. id: OPS.setHScale,
  27770. numArgs: 1,
  27771. variableArgs: false
  27772. };
  27773. t['TL'] = {
  27774. id: OPS.setLeading,
  27775. numArgs: 1,
  27776. variableArgs: false
  27777. };
  27778. t['Tf'] = {
  27779. id: OPS.setFont,
  27780. numArgs: 2,
  27781. variableArgs: false
  27782. };
  27783. t['Tr'] = {
  27784. id: OPS.setTextRenderingMode,
  27785. numArgs: 1,
  27786. variableArgs: false
  27787. };
  27788. t['Ts'] = {
  27789. id: OPS.setTextRise,
  27790. numArgs: 1,
  27791. variableArgs: false
  27792. };
  27793. t['Td'] = {
  27794. id: OPS.moveText,
  27795. numArgs: 2,
  27796. variableArgs: false
  27797. };
  27798. t['TD'] = {
  27799. id: OPS.setLeadingMoveText,
  27800. numArgs: 2,
  27801. variableArgs: false
  27802. };
  27803. t['Tm'] = {
  27804. id: OPS.setTextMatrix,
  27805. numArgs: 6,
  27806. variableArgs: false
  27807. };
  27808. t['T*'] = {
  27809. id: OPS.nextLine,
  27810. numArgs: 0,
  27811. variableArgs: false
  27812. };
  27813. t['Tj'] = {
  27814. id: OPS.showText,
  27815. numArgs: 1,
  27816. variableArgs: false
  27817. };
  27818. t['TJ'] = {
  27819. id: OPS.showSpacedText,
  27820. numArgs: 1,
  27821. variableArgs: false
  27822. };
  27823. t['\''] = {
  27824. id: OPS.nextLineShowText,
  27825. numArgs: 1,
  27826. variableArgs: false
  27827. };
  27828. t['"'] = {
  27829. id: OPS.nextLineSetSpacingShowText,
  27830. numArgs: 3,
  27831. variableArgs: false
  27832. };
  27833. t['d0'] = {
  27834. id: OPS.setCharWidth,
  27835. numArgs: 2,
  27836. variableArgs: false
  27837. };
  27838. t['d1'] = {
  27839. id: OPS.setCharWidthAndBounds,
  27840. numArgs: 6,
  27841. variableArgs: false
  27842. };
  27843. t['CS'] = {
  27844. id: OPS.setStrokeColorSpace,
  27845. numArgs: 1,
  27846. variableArgs: false
  27847. };
  27848. t['cs'] = {
  27849. id: OPS.setFillColorSpace,
  27850. numArgs: 1,
  27851. variableArgs: false
  27852. };
  27853. t['SC'] = {
  27854. id: OPS.setStrokeColor,
  27855. numArgs: 4,
  27856. variableArgs: true
  27857. };
  27858. t['SCN'] = {
  27859. id: OPS.setStrokeColorN,
  27860. numArgs: 33,
  27861. variableArgs: true
  27862. };
  27863. t['sc'] = {
  27864. id: OPS.setFillColor,
  27865. numArgs: 4,
  27866. variableArgs: true
  27867. };
  27868. t['scn'] = {
  27869. id: OPS.setFillColorN,
  27870. numArgs: 33,
  27871. variableArgs: true
  27872. };
  27873. t['G'] = {
  27874. id: OPS.setStrokeGray,
  27875. numArgs: 1,
  27876. variableArgs: false
  27877. };
  27878. t['g'] = {
  27879. id: OPS.setFillGray,
  27880. numArgs: 1,
  27881. variableArgs: false
  27882. };
  27883. t['RG'] = {
  27884. id: OPS.setStrokeRGBColor,
  27885. numArgs: 3,
  27886. variableArgs: false
  27887. };
  27888. t['rg'] = {
  27889. id: OPS.setFillRGBColor,
  27890. numArgs: 3,
  27891. variableArgs: false
  27892. };
  27893. t['K'] = {
  27894. id: OPS.setStrokeCMYKColor,
  27895. numArgs: 4,
  27896. variableArgs: false
  27897. };
  27898. t['k'] = {
  27899. id: OPS.setFillCMYKColor,
  27900. numArgs: 4,
  27901. variableArgs: false
  27902. };
  27903. t['sh'] = {
  27904. id: OPS.shadingFill,
  27905. numArgs: 1,
  27906. variableArgs: false
  27907. };
  27908. t['BI'] = {
  27909. id: OPS.beginInlineImage,
  27910. numArgs: 0,
  27911. variableArgs: false
  27912. };
  27913. t['ID'] = {
  27914. id: OPS.beginImageData,
  27915. numArgs: 0,
  27916. variableArgs: false
  27917. };
  27918. t['EI'] = {
  27919. id: OPS.endInlineImage,
  27920. numArgs: 1,
  27921. variableArgs: false
  27922. };
  27923. t['Do'] = {
  27924. id: OPS.paintXObject,
  27925. numArgs: 1,
  27926. variableArgs: false
  27927. };
  27928. t['MP'] = {
  27929. id: OPS.markPoint,
  27930. numArgs: 1,
  27931. variableArgs: false
  27932. };
  27933. t['DP'] = {
  27934. id: OPS.markPointProps,
  27935. numArgs: 2,
  27936. variableArgs: false
  27937. };
  27938. t['BMC'] = {
  27939. id: OPS.beginMarkedContent,
  27940. numArgs: 1,
  27941. variableArgs: false
  27942. };
  27943. t['BDC'] = {
  27944. id: OPS.beginMarkedContentProps,
  27945. numArgs: 2,
  27946. variableArgs: false
  27947. };
  27948. t['EMC'] = {
  27949. id: OPS.endMarkedContent,
  27950. numArgs: 0,
  27951. variableArgs: false
  27952. };
  27953. t['BX'] = {
  27954. id: OPS.beginCompat,
  27955. numArgs: 0,
  27956. variableArgs: false
  27957. };
  27958. t['EX'] = {
  27959. id: OPS.endCompat,
  27960. numArgs: 0,
  27961. variableArgs: false
  27962. };
  27963. t['BM'] = null;
  27964. t['BD'] = null;
  27965. t['true'] = null;
  27966. t['fa'] = null;
  27967. t['fal'] = null;
  27968. t['fals'] = null;
  27969. t['false'] = null;
  27970. t['nu'] = null;
  27971. t['nul'] = null;
  27972. t['null'] = null;
  27973. });
  27974. function EvaluatorPreprocessor(stream, xref, stateManager) {
  27975. this.opMap = getOPMap();
  27976. this.parser = new Parser(new Lexer(stream, this.opMap), false, xref);
  27977. this.stateManager = stateManager;
  27978. this.nonProcessedArgs = [];
  27979. }
  27980. EvaluatorPreprocessor.prototype = {
  27981. get savedStatesDepth() {
  27982. return this.stateManager.stateStack.length;
  27983. },
  27984. read: function EvaluatorPreprocessor_read(operation) {
  27985. var args = operation.args;
  27986. while (true) {
  27987. var obj = this.parser.getObj();
  27988. if (isCmd(obj)) {
  27989. var cmd = obj.cmd;
  27990. var opSpec = this.opMap[cmd];
  27991. if (!opSpec) {
  27992. warn('Unknown command "' + cmd + '"');
  27993. continue;
  27994. }
  27995. var fn = opSpec.id;
  27996. var numArgs = opSpec.numArgs;
  27997. var argsLength = args !== null ? args.length : 0;
  27998. if (!opSpec.variableArgs) {
  27999. if (argsLength !== numArgs) {
  28000. var nonProcessedArgs = this.nonProcessedArgs;
  28001. while (argsLength > numArgs) {
  28002. nonProcessedArgs.push(args.shift());
  28003. argsLength--;
  28004. }
  28005. while (argsLength < numArgs && nonProcessedArgs.length !== 0) {
  28006. if (args === null) {
  28007. args = [];
  28008. }
  28009. args.unshift(nonProcessedArgs.pop());
  28010. argsLength++;
  28011. }
  28012. }
  28013. if (argsLength < numArgs) {
  28014. warn('Skipping command ' + fn + ': expected ' + numArgs + ' args, but received ' + argsLength + ' args.');
  28015. if (args !== null) {
  28016. args.length = 0;
  28017. }
  28018. continue;
  28019. }
  28020. } else if (argsLength > numArgs) {
  28021. info('Command ' + fn + ': expected [0,' + numArgs + '] args, but received ' + argsLength + ' args.');
  28022. }
  28023. this.preprocessCommand(fn, args);
  28024. operation.fn = fn;
  28025. operation.args = args;
  28026. return true;
  28027. }
  28028. if (isEOF(obj)) {
  28029. return false;
  28030. }
  28031. if (obj !== null) {
  28032. if (args === null) {
  28033. args = [];
  28034. }
  28035. args.push(obj);
  28036. assert(args.length <= 33, 'Too many arguments');
  28037. }
  28038. }
  28039. },
  28040. preprocessCommand: function EvaluatorPreprocessor_preprocessCommand(fn, args) {
  28041. switch (fn | 0) {
  28042. case OPS.save:
  28043. this.stateManager.save();
  28044. break;
  28045. case OPS.restore:
  28046. this.stateManager.restore();
  28047. break;
  28048. case OPS.transform:
  28049. this.stateManager.transform(args);
  28050. break;
  28051. }
  28052. }
  28053. };
  28054. return EvaluatorPreprocessor;
  28055. }();
  28056. var QueueOptimizer = function QueueOptimizerClosure() {
  28057. function addState(parentState, pattern, fn) {
  28058. var state = parentState;
  28059. for (var i = 0, ii = pattern.length - 1; i < ii; i++) {
  28060. var item = pattern[i];
  28061. state = state[item] || (state[item] = []);
  28062. }
  28063. state[pattern[pattern.length - 1]] = fn;
  28064. }
  28065. function handlePaintSolidColorImageMask(iFirstSave, count, fnArray, argsArray) {
  28066. var iFirstPIMXO = iFirstSave + 2;
  28067. for (var i = 0; i < count; i++) {
  28068. var arg = argsArray[iFirstPIMXO + 4 * i];
  28069. var imageMask = arg.length === 1 && arg[0];
  28070. if (imageMask && imageMask.width === 1 && imageMask.height === 1 && (!imageMask.data.length || imageMask.data.length === 1 && imageMask.data[0] === 0)) {
  28071. fnArray[iFirstPIMXO + 4 * i] = OPS.paintSolidColorImageMask;
  28072. continue;
  28073. }
  28074. break;
  28075. }
  28076. return count - i;
  28077. }
  28078. var InitialState = [];
  28079. addState(InitialState, [
  28080. OPS.save,
  28081. OPS.transform,
  28082. OPS.paintInlineImageXObject,
  28083. OPS.restore
  28084. ], function foundInlineImageGroup(context) {
  28085. var MIN_IMAGES_IN_INLINE_IMAGES_BLOCK = 10;
  28086. var MAX_IMAGES_IN_INLINE_IMAGES_BLOCK = 200;
  28087. var MAX_WIDTH = 1000;
  28088. var IMAGE_PADDING = 1;
  28089. var fnArray = context.fnArray, argsArray = context.argsArray;
  28090. var curr = context.iCurr;
  28091. var iFirstSave = curr - 3;
  28092. var iFirstTransform = curr - 2;
  28093. var iFirstPIIXO = curr - 1;
  28094. var i = iFirstSave + 4;
  28095. var ii = fnArray.length;
  28096. while (i + 3 < ii) {
  28097. if (fnArray[i] !== OPS.save || fnArray[i + 1] !== OPS.transform || fnArray[i + 2] !== OPS.paintInlineImageXObject || fnArray[i + 3] !== OPS.restore) {
  28098. break;
  28099. }
  28100. i += 4;
  28101. }
  28102. var count = Math.min((i - iFirstSave) / 4, MAX_IMAGES_IN_INLINE_IMAGES_BLOCK);
  28103. if (count < MIN_IMAGES_IN_INLINE_IMAGES_BLOCK) {
  28104. return i;
  28105. }
  28106. var maxX = 0;
  28107. var map = [], maxLineHeight = 0;
  28108. var currentX = IMAGE_PADDING, currentY = IMAGE_PADDING;
  28109. var q;
  28110. for (q = 0; q < count; q++) {
  28111. var transform = argsArray[iFirstTransform + (q << 2)];
  28112. var img = argsArray[iFirstPIIXO + (q << 2)][0];
  28113. if (currentX + img.width > MAX_WIDTH) {
  28114. maxX = Math.max(maxX, currentX);
  28115. currentY += maxLineHeight + 2 * IMAGE_PADDING;
  28116. currentX = 0;
  28117. maxLineHeight = 0;
  28118. }
  28119. map.push({
  28120. transform: transform,
  28121. x: currentX,
  28122. y: currentY,
  28123. w: img.width,
  28124. h: img.height
  28125. });
  28126. currentX += img.width + 2 * IMAGE_PADDING;
  28127. maxLineHeight = Math.max(maxLineHeight, img.height);
  28128. }
  28129. var imgWidth = Math.max(maxX, currentX) + IMAGE_PADDING;
  28130. var imgHeight = currentY + maxLineHeight + IMAGE_PADDING;
  28131. var imgData = new Uint8Array(imgWidth * imgHeight * 4);
  28132. var imgRowSize = imgWidth << 2;
  28133. for (q = 0; q < count; q++) {
  28134. var data = argsArray[iFirstPIIXO + (q << 2)][0].data;
  28135. var rowSize = map[q].w << 2;
  28136. var dataOffset = 0;
  28137. var offset = map[q].x + map[q].y * imgWidth << 2;
  28138. imgData.set(data.subarray(0, rowSize), offset - imgRowSize);
  28139. for (var k = 0, kk = map[q].h; k < kk; k++) {
  28140. imgData.set(data.subarray(dataOffset, dataOffset + rowSize), offset);
  28141. dataOffset += rowSize;
  28142. offset += imgRowSize;
  28143. }
  28144. imgData.set(data.subarray(dataOffset - rowSize, dataOffset), offset);
  28145. while (offset >= 0) {
  28146. data[offset - 4] = data[offset];
  28147. data[offset - 3] = data[offset + 1];
  28148. data[offset - 2] = data[offset + 2];
  28149. data[offset - 1] = data[offset + 3];
  28150. data[offset + rowSize] = data[offset + rowSize - 4];
  28151. data[offset + rowSize + 1] = data[offset + rowSize - 3];
  28152. data[offset + rowSize + 2] = data[offset + rowSize - 2];
  28153. data[offset + rowSize + 3] = data[offset + rowSize - 1];
  28154. offset -= imgRowSize;
  28155. }
  28156. }
  28157. fnArray.splice(iFirstSave, count * 4, OPS.paintInlineImageXObjectGroup);
  28158. argsArray.splice(iFirstSave, count * 4, [
  28159. {
  28160. width: imgWidth,
  28161. height: imgHeight,
  28162. kind: ImageKind.RGBA_32BPP,
  28163. data: imgData
  28164. },
  28165. map
  28166. ]);
  28167. return iFirstSave + 1;
  28168. });
  28169. addState(InitialState, [
  28170. OPS.save,
  28171. OPS.transform,
  28172. OPS.paintImageMaskXObject,
  28173. OPS.restore
  28174. ], function foundImageMaskGroup(context) {
  28175. var MIN_IMAGES_IN_MASKS_BLOCK = 10;
  28176. var MAX_IMAGES_IN_MASKS_BLOCK = 100;
  28177. var MAX_SAME_IMAGES_IN_MASKS_BLOCK = 1000;
  28178. var fnArray = context.fnArray, argsArray = context.argsArray;
  28179. var curr = context.iCurr;
  28180. var iFirstSave = curr - 3;
  28181. var iFirstTransform = curr - 2;
  28182. var iFirstPIMXO = curr - 1;
  28183. var i = iFirstSave + 4;
  28184. var ii = fnArray.length;
  28185. while (i + 3 < ii) {
  28186. if (fnArray[i] !== OPS.save || fnArray[i + 1] !== OPS.transform || fnArray[i + 2] !== OPS.paintImageMaskXObject || fnArray[i + 3] !== OPS.restore) {
  28187. break;
  28188. }
  28189. i += 4;
  28190. }
  28191. var count = (i - iFirstSave) / 4;
  28192. count = handlePaintSolidColorImageMask(iFirstSave, count, fnArray, argsArray);
  28193. if (count < MIN_IMAGES_IN_MASKS_BLOCK) {
  28194. return i;
  28195. }
  28196. var q;
  28197. var isSameImage = false;
  28198. var iTransform, transformArgs;
  28199. var firstPIMXOArg0 = argsArray[iFirstPIMXO][0];
  28200. if (argsArray[iFirstTransform][1] === 0 && argsArray[iFirstTransform][2] === 0) {
  28201. isSameImage = true;
  28202. var firstTransformArg0 = argsArray[iFirstTransform][0];
  28203. var firstTransformArg3 = argsArray[iFirstTransform][3];
  28204. iTransform = iFirstTransform + 4;
  28205. var iPIMXO = iFirstPIMXO + 4;
  28206. for (q = 1; q < count; q++, iTransform += 4, iPIMXO += 4) {
  28207. transformArgs = argsArray[iTransform];
  28208. if (argsArray[iPIMXO][0] !== firstPIMXOArg0 || transformArgs[0] !== firstTransformArg0 || transformArgs[1] !== 0 || transformArgs[2] !== 0 || transformArgs[3] !== firstTransformArg3) {
  28209. if (q < MIN_IMAGES_IN_MASKS_BLOCK) {
  28210. isSameImage = false;
  28211. } else {
  28212. count = q;
  28213. }
  28214. break;
  28215. }
  28216. }
  28217. }
  28218. if (isSameImage) {
  28219. count = Math.min(count, MAX_SAME_IMAGES_IN_MASKS_BLOCK);
  28220. var positions = new Float32Array(count * 2);
  28221. iTransform = iFirstTransform;
  28222. for (q = 0; q < count; q++, iTransform += 4) {
  28223. transformArgs = argsArray[iTransform];
  28224. positions[q << 1] = transformArgs[4];
  28225. positions[(q << 1) + 1] = transformArgs[5];
  28226. }
  28227. fnArray.splice(iFirstSave, count * 4, OPS.paintImageMaskXObjectRepeat);
  28228. argsArray.splice(iFirstSave, count * 4, [
  28229. firstPIMXOArg0,
  28230. firstTransformArg0,
  28231. firstTransformArg3,
  28232. positions
  28233. ]);
  28234. } else {
  28235. count = Math.min(count, MAX_IMAGES_IN_MASKS_BLOCK);
  28236. var images = [];
  28237. for (q = 0; q < count; q++) {
  28238. transformArgs = argsArray[iFirstTransform + (q << 2)];
  28239. var maskParams = argsArray[iFirstPIMXO + (q << 2)][0];
  28240. images.push({
  28241. data: maskParams.data,
  28242. width: maskParams.width,
  28243. height: maskParams.height,
  28244. transform: transformArgs
  28245. });
  28246. }
  28247. fnArray.splice(iFirstSave, count * 4, OPS.paintImageMaskXObjectGroup);
  28248. argsArray.splice(iFirstSave, count * 4, [images]);
  28249. }
  28250. return iFirstSave + 1;
  28251. });
  28252. addState(InitialState, [
  28253. OPS.save,
  28254. OPS.transform,
  28255. OPS.paintImageXObject,
  28256. OPS.restore
  28257. ], function (context) {
  28258. var MIN_IMAGES_IN_BLOCK = 3;
  28259. var MAX_IMAGES_IN_BLOCK = 1000;
  28260. var fnArray = context.fnArray, argsArray = context.argsArray;
  28261. var curr = context.iCurr;
  28262. var iFirstSave = curr - 3;
  28263. var iFirstTransform = curr - 2;
  28264. var iFirstPIXO = curr - 1;
  28265. var iFirstRestore = curr;
  28266. if (argsArray[iFirstTransform][1] !== 0 || argsArray[iFirstTransform][2] !== 0) {
  28267. return iFirstRestore + 1;
  28268. }
  28269. var firstPIXOArg0 = argsArray[iFirstPIXO][0];
  28270. var firstTransformArg0 = argsArray[iFirstTransform][0];
  28271. var firstTransformArg3 = argsArray[iFirstTransform][3];
  28272. var i = iFirstSave + 4;
  28273. var ii = fnArray.length;
  28274. while (i + 3 < ii) {
  28275. if (fnArray[i] !== OPS.save || fnArray[i + 1] !== OPS.transform || fnArray[i + 2] !== OPS.paintImageXObject || fnArray[i + 3] !== OPS.restore) {
  28276. break;
  28277. }
  28278. if (argsArray[i + 1][0] !== firstTransformArg0 || argsArray[i + 1][1] !== 0 || argsArray[i + 1][2] !== 0 || argsArray[i + 1][3] !== firstTransformArg3) {
  28279. break;
  28280. }
  28281. if (argsArray[i + 2][0] !== firstPIXOArg0) {
  28282. break;
  28283. }
  28284. i += 4;
  28285. }
  28286. var count = Math.min((i - iFirstSave) / 4, MAX_IMAGES_IN_BLOCK);
  28287. if (count < MIN_IMAGES_IN_BLOCK) {
  28288. return i;
  28289. }
  28290. var positions = new Float32Array(count * 2);
  28291. var iTransform = iFirstTransform;
  28292. for (var q = 0; q < count; q++, iTransform += 4) {
  28293. var transformArgs = argsArray[iTransform];
  28294. positions[q << 1] = transformArgs[4];
  28295. positions[(q << 1) + 1] = transformArgs[5];
  28296. }
  28297. var args = [
  28298. firstPIXOArg0,
  28299. firstTransformArg0,
  28300. firstTransformArg3,
  28301. positions
  28302. ];
  28303. fnArray.splice(iFirstSave, count * 4, OPS.paintImageXObjectRepeat);
  28304. argsArray.splice(iFirstSave, count * 4, args);
  28305. return iFirstSave + 1;
  28306. });
  28307. addState(InitialState, [
  28308. OPS.beginText,
  28309. OPS.setFont,
  28310. OPS.setTextMatrix,
  28311. OPS.showText,
  28312. OPS.endText
  28313. ], function (context) {
  28314. var MIN_CHARS_IN_BLOCK = 3;
  28315. var MAX_CHARS_IN_BLOCK = 1000;
  28316. var fnArray = context.fnArray, argsArray = context.argsArray;
  28317. var curr = context.iCurr;
  28318. var iFirstBeginText = curr - 4;
  28319. var iFirstSetFont = curr - 3;
  28320. var iFirstSetTextMatrix = curr - 2;
  28321. var iFirstShowText = curr - 1;
  28322. var iFirstEndText = curr;
  28323. var firstSetFontArg0 = argsArray[iFirstSetFont][0];
  28324. var firstSetFontArg1 = argsArray[iFirstSetFont][1];
  28325. var i = iFirstBeginText + 5;
  28326. var ii = fnArray.length;
  28327. while (i + 4 < ii) {
  28328. 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) {
  28329. break;
  28330. }
  28331. if (argsArray[i + 1][0] !== firstSetFontArg0 || argsArray[i + 1][1] !== firstSetFontArg1) {
  28332. break;
  28333. }
  28334. i += 5;
  28335. }
  28336. var count = Math.min((i - iFirstBeginText) / 5, MAX_CHARS_IN_BLOCK);
  28337. if (count < MIN_CHARS_IN_BLOCK) {
  28338. return i;
  28339. }
  28340. var iFirst = iFirstBeginText;
  28341. 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) {
  28342. count++;
  28343. iFirst -= 5;
  28344. }
  28345. var iEndText = iFirst + 4;
  28346. for (var q = 1; q < count; q++) {
  28347. fnArray.splice(iEndText, 3);
  28348. argsArray.splice(iEndText, 3);
  28349. iEndText += 2;
  28350. }
  28351. return iEndText + 1;
  28352. });
  28353. function QueueOptimizer() {
  28354. }
  28355. QueueOptimizer.prototype = {
  28356. optimize: function QueueOptimizer_optimize(queue) {
  28357. var fnArray = queue.fnArray, argsArray = queue.argsArray;
  28358. var context = {
  28359. iCurr: 0,
  28360. fnArray: fnArray,
  28361. argsArray: argsArray
  28362. };
  28363. var state;
  28364. var i = 0, ii = fnArray.length;
  28365. while (i < ii) {
  28366. state = (state || InitialState)[fnArray[i]];
  28367. if (typeof state === 'function') {
  28368. context.iCurr = i;
  28369. i = state(context);
  28370. state = undefined;
  28371. ii = context.fnArray.length;
  28372. } else {
  28373. i++;
  28374. }
  28375. }
  28376. }
  28377. };
  28378. return QueueOptimizer;
  28379. }();
  28380. exports.OperatorList = OperatorList;
  28381. exports.PartialEvaluator = PartialEvaluator;
  28382. /***/ }),
  28383. /* 15 */
  28384. /***/ (function(module, exports, __w_pdfjs_require__) {
  28385. "use strict";
  28386. var sharedUtil = __w_pdfjs_require__(0);
  28387. var coreArithmeticDecoder = __w_pdfjs_require__(10);
  28388. var info = sharedUtil.info;
  28389. var warn = sharedUtil.warn;
  28390. var error = sharedUtil.error;
  28391. var log2 = sharedUtil.log2;
  28392. var readUint16 = sharedUtil.readUint16;
  28393. var readUint32 = sharedUtil.readUint32;
  28394. var ArithmeticDecoder = coreArithmeticDecoder.ArithmeticDecoder;
  28395. var JpxImage = function JpxImageClosure() {
  28396. var SubbandsGainLog2 = {
  28397. 'LL': 0,
  28398. 'LH': 1,
  28399. 'HL': 1,
  28400. 'HH': 2
  28401. };
  28402. function JpxImage() {
  28403. this.failOnCorruptedImage = false;
  28404. }
  28405. JpxImage.prototype = {
  28406. parse: function JpxImage_parse(data) {
  28407. var head = readUint16(data, 0);
  28408. if (head === 0xFF4F) {
  28409. this.parseCodestream(data, 0, data.length);
  28410. return;
  28411. }
  28412. var position = 0, length = data.length;
  28413. while (position < length) {
  28414. var headerSize = 8;
  28415. var lbox = readUint32(data, position);
  28416. var tbox = readUint32(data, position + 4);
  28417. position += headerSize;
  28418. if (lbox === 1) {
  28419. lbox = readUint32(data, position) * 4294967296 + readUint32(data, position + 4);
  28420. position += 8;
  28421. headerSize += 8;
  28422. }
  28423. if (lbox === 0) {
  28424. lbox = length - position + headerSize;
  28425. }
  28426. if (lbox < headerSize) {
  28427. error('JPX Error: Invalid box field size');
  28428. }
  28429. var dataLength = lbox - headerSize;
  28430. var jumpDataLength = true;
  28431. switch (tbox) {
  28432. case 0x6A703268:
  28433. jumpDataLength = false;
  28434. break;
  28435. case 0x636F6C72:
  28436. var method = data[position];
  28437. if (method === 1) {
  28438. var colorspace = readUint32(data, position + 3);
  28439. switch (colorspace) {
  28440. case 16:
  28441. case 17:
  28442. case 18:
  28443. break;
  28444. default:
  28445. warn('Unknown colorspace ' + colorspace);
  28446. break;
  28447. }
  28448. } else if (method === 2) {
  28449. info('ICC profile not supported');
  28450. }
  28451. break;
  28452. case 0x6A703263:
  28453. this.parseCodestream(data, position, position + dataLength);
  28454. break;
  28455. case 0x6A502020:
  28456. if (0x0d0a870a !== readUint32(data, position)) {
  28457. warn('Invalid JP2 signature');
  28458. }
  28459. break;
  28460. case 0x6A501A1A:
  28461. case 0x66747970:
  28462. case 0x72726571:
  28463. case 0x72657320:
  28464. case 0x69686472:
  28465. break;
  28466. default:
  28467. var headerType = String.fromCharCode(tbox >> 24 & 0xFF, tbox >> 16 & 0xFF, tbox >> 8 & 0xFF, tbox & 0xFF);
  28468. warn('Unsupported header type ' + tbox + ' (' + headerType + ')');
  28469. break;
  28470. }
  28471. if (jumpDataLength) {
  28472. position += dataLength;
  28473. }
  28474. }
  28475. },
  28476. parseImageProperties: function JpxImage_parseImageProperties(stream) {
  28477. var newByte = stream.getByte();
  28478. while (newByte >= 0) {
  28479. var oldByte = newByte;
  28480. newByte = stream.getByte();
  28481. var code = oldByte << 8 | newByte;
  28482. if (code === 0xFF51) {
  28483. stream.skip(4);
  28484. var Xsiz = stream.getInt32() >>> 0;
  28485. var Ysiz = stream.getInt32() >>> 0;
  28486. var XOsiz = stream.getInt32() >>> 0;
  28487. var YOsiz = stream.getInt32() >>> 0;
  28488. stream.skip(16);
  28489. var Csiz = stream.getUint16();
  28490. this.width = Xsiz - XOsiz;
  28491. this.height = Ysiz - YOsiz;
  28492. this.componentsCount = Csiz;
  28493. this.bitsPerComponent = 8;
  28494. return;
  28495. }
  28496. }
  28497. error('JPX Error: No size marker found in JPX stream');
  28498. },
  28499. parseCodestream: function JpxImage_parseCodestream(data, start, end) {
  28500. var context = {};
  28501. var doNotRecover = false;
  28502. try {
  28503. var position = start;
  28504. while (position + 1 < end) {
  28505. var code = readUint16(data, position);
  28506. position += 2;
  28507. var length = 0, j, sqcd, spqcds, spqcdSize, scalarExpounded, tile;
  28508. switch (code) {
  28509. case 0xFF4F:
  28510. context.mainHeader = true;
  28511. break;
  28512. case 0xFFD9:
  28513. break;
  28514. case 0xFF51:
  28515. length = readUint16(data, position);
  28516. var siz = {};
  28517. siz.Xsiz = readUint32(data, position + 4);
  28518. siz.Ysiz = readUint32(data, position + 8);
  28519. siz.XOsiz = readUint32(data, position + 12);
  28520. siz.YOsiz = readUint32(data, position + 16);
  28521. siz.XTsiz = readUint32(data, position + 20);
  28522. siz.YTsiz = readUint32(data, position + 24);
  28523. siz.XTOsiz = readUint32(data, position + 28);
  28524. siz.YTOsiz = readUint32(data, position + 32);
  28525. var componentsCount = readUint16(data, position + 36);
  28526. siz.Csiz = componentsCount;
  28527. var components = [];
  28528. j = position + 38;
  28529. for (var i = 0; i < componentsCount; i++) {
  28530. var component = {
  28531. precision: (data[j] & 0x7F) + 1,
  28532. isSigned: !!(data[j] & 0x80),
  28533. XRsiz: data[j + 1],
  28534. YRsiz: data[j + 1]
  28535. };
  28536. calculateComponentDimensions(component, siz);
  28537. components.push(component);
  28538. }
  28539. context.SIZ = siz;
  28540. context.components = components;
  28541. calculateTileGrids(context, components);
  28542. context.QCC = [];
  28543. context.COC = [];
  28544. break;
  28545. case 0xFF5C:
  28546. length = readUint16(data, position);
  28547. var qcd = {};
  28548. j = position + 2;
  28549. sqcd = data[j++];
  28550. switch (sqcd & 0x1F) {
  28551. case 0:
  28552. spqcdSize = 8;
  28553. scalarExpounded = true;
  28554. break;
  28555. case 1:
  28556. spqcdSize = 16;
  28557. scalarExpounded = false;
  28558. break;
  28559. case 2:
  28560. spqcdSize = 16;
  28561. scalarExpounded = true;
  28562. break;
  28563. default:
  28564. throw new Error('Invalid SQcd value ' + sqcd);
  28565. }
  28566. qcd.noQuantization = spqcdSize === 8;
  28567. qcd.scalarExpounded = scalarExpounded;
  28568. qcd.guardBits = sqcd >> 5;
  28569. spqcds = [];
  28570. while (j < length + position) {
  28571. var spqcd = {};
  28572. if (spqcdSize === 8) {
  28573. spqcd.epsilon = data[j++] >> 3;
  28574. spqcd.mu = 0;
  28575. } else {
  28576. spqcd.epsilon = data[j] >> 3;
  28577. spqcd.mu = (data[j] & 0x7) << 8 | data[j + 1];
  28578. j += 2;
  28579. }
  28580. spqcds.push(spqcd);
  28581. }
  28582. qcd.SPqcds = spqcds;
  28583. if (context.mainHeader) {
  28584. context.QCD = qcd;
  28585. } else {
  28586. context.currentTile.QCD = qcd;
  28587. context.currentTile.QCC = [];
  28588. }
  28589. break;
  28590. case 0xFF5D:
  28591. length = readUint16(data, position);
  28592. var qcc = {};
  28593. j = position + 2;
  28594. var cqcc;
  28595. if (context.SIZ.Csiz < 257) {
  28596. cqcc = data[j++];
  28597. } else {
  28598. cqcc = readUint16(data, j);
  28599. j += 2;
  28600. }
  28601. sqcd = data[j++];
  28602. switch (sqcd & 0x1F) {
  28603. case 0:
  28604. spqcdSize = 8;
  28605. scalarExpounded = true;
  28606. break;
  28607. case 1:
  28608. spqcdSize = 16;
  28609. scalarExpounded = false;
  28610. break;
  28611. case 2:
  28612. spqcdSize = 16;
  28613. scalarExpounded = true;
  28614. break;
  28615. default:
  28616. throw new Error('Invalid SQcd value ' + sqcd);
  28617. }
  28618. qcc.noQuantization = spqcdSize === 8;
  28619. qcc.scalarExpounded = scalarExpounded;
  28620. qcc.guardBits = sqcd >> 5;
  28621. spqcds = [];
  28622. while (j < length + position) {
  28623. spqcd = {};
  28624. if (spqcdSize === 8) {
  28625. spqcd.epsilon = data[j++] >> 3;
  28626. spqcd.mu = 0;
  28627. } else {
  28628. spqcd.epsilon = data[j] >> 3;
  28629. spqcd.mu = (data[j] & 0x7) << 8 | data[j + 1];
  28630. j += 2;
  28631. }
  28632. spqcds.push(spqcd);
  28633. }
  28634. qcc.SPqcds = spqcds;
  28635. if (context.mainHeader) {
  28636. context.QCC[cqcc] = qcc;
  28637. } else {
  28638. context.currentTile.QCC[cqcc] = qcc;
  28639. }
  28640. break;
  28641. case 0xFF52:
  28642. length = readUint16(data, position);
  28643. var cod = {};
  28644. j = position + 2;
  28645. var scod = data[j++];
  28646. cod.entropyCoderWithCustomPrecincts = !!(scod & 1);
  28647. cod.sopMarkerUsed = !!(scod & 2);
  28648. cod.ephMarkerUsed = !!(scod & 4);
  28649. cod.progressionOrder = data[j++];
  28650. cod.layersCount = readUint16(data, j);
  28651. j += 2;
  28652. cod.multipleComponentTransform = data[j++];
  28653. cod.decompositionLevelsCount = data[j++];
  28654. cod.xcb = (data[j++] & 0xF) + 2;
  28655. cod.ycb = (data[j++] & 0xF) + 2;
  28656. var blockStyle = data[j++];
  28657. cod.selectiveArithmeticCodingBypass = !!(blockStyle & 1);
  28658. cod.resetContextProbabilities = !!(blockStyle & 2);
  28659. cod.terminationOnEachCodingPass = !!(blockStyle & 4);
  28660. cod.verticalyStripe = !!(blockStyle & 8);
  28661. cod.predictableTermination = !!(blockStyle & 16);
  28662. cod.segmentationSymbolUsed = !!(blockStyle & 32);
  28663. cod.reversibleTransformation = data[j++];
  28664. if (cod.entropyCoderWithCustomPrecincts) {
  28665. var precinctsSizes = [];
  28666. while (j < length + position) {
  28667. var precinctsSize = data[j++];
  28668. precinctsSizes.push({
  28669. PPx: precinctsSize & 0xF,
  28670. PPy: precinctsSize >> 4
  28671. });
  28672. }
  28673. cod.precinctsSizes = precinctsSizes;
  28674. }
  28675. var unsupported = [];
  28676. if (cod.selectiveArithmeticCodingBypass) {
  28677. unsupported.push('selectiveArithmeticCodingBypass');
  28678. }
  28679. if (cod.resetContextProbabilities) {
  28680. unsupported.push('resetContextProbabilities');
  28681. }
  28682. if (cod.terminationOnEachCodingPass) {
  28683. unsupported.push('terminationOnEachCodingPass');
  28684. }
  28685. if (cod.verticalyStripe) {
  28686. unsupported.push('verticalyStripe');
  28687. }
  28688. if (cod.predictableTermination) {
  28689. unsupported.push('predictableTermination');
  28690. }
  28691. if (unsupported.length > 0) {
  28692. doNotRecover = true;
  28693. throw new Error('Unsupported COD options (' + unsupported.join(', ') + ')');
  28694. }
  28695. if (context.mainHeader) {
  28696. context.COD = cod;
  28697. } else {
  28698. context.currentTile.COD = cod;
  28699. context.currentTile.COC = [];
  28700. }
  28701. break;
  28702. case 0xFF90:
  28703. length = readUint16(data, position);
  28704. tile = {};
  28705. tile.index = readUint16(data, position + 2);
  28706. tile.length = readUint32(data, position + 4);
  28707. tile.dataEnd = tile.length + position - 2;
  28708. tile.partIndex = data[position + 8];
  28709. tile.partsCount = data[position + 9];
  28710. context.mainHeader = false;
  28711. if (tile.partIndex === 0) {
  28712. tile.COD = context.COD;
  28713. tile.COC = context.COC.slice(0);
  28714. tile.QCD = context.QCD;
  28715. tile.QCC = context.QCC.slice(0);
  28716. }
  28717. context.currentTile = tile;
  28718. break;
  28719. case 0xFF93:
  28720. tile = context.currentTile;
  28721. if (tile.partIndex === 0) {
  28722. initializeTile(context, tile.index);
  28723. buildPackets(context);
  28724. }
  28725. length = tile.dataEnd - position;
  28726. parseTilePackets(context, data, position, length);
  28727. break;
  28728. case 0xFF55:
  28729. case 0xFF57:
  28730. case 0xFF58:
  28731. case 0xFF64:
  28732. length = readUint16(data, position);
  28733. break;
  28734. case 0xFF53:
  28735. throw new Error('Codestream code 0xFF53 (COC) is ' + 'not implemented');
  28736. default:
  28737. throw new Error('Unknown codestream code: ' + code.toString(16));
  28738. }
  28739. position += length;
  28740. }
  28741. } catch (e) {
  28742. if (doNotRecover || this.failOnCorruptedImage) {
  28743. error('JPX Error: ' + e.message);
  28744. } else {
  28745. warn('JPX: Trying to recover from: ' + e.message);
  28746. }
  28747. }
  28748. this.tiles = transformComponents(context);
  28749. this.width = context.SIZ.Xsiz - context.SIZ.XOsiz;
  28750. this.height = context.SIZ.Ysiz - context.SIZ.YOsiz;
  28751. this.componentsCount = context.SIZ.Csiz;
  28752. }
  28753. };
  28754. function calculateComponentDimensions(component, siz) {
  28755. component.x0 = Math.ceil(siz.XOsiz / component.XRsiz);
  28756. component.x1 = Math.ceil(siz.Xsiz / component.XRsiz);
  28757. component.y0 = Math.ceil(siz.YOsiz / component.YRsiz);
  28758. component.y1 = Math.ceil(siz.Ysiz / component.YRsiz);
  28759. component.width = component.x1 - component.x0;
  28760. component.height = component.y1 - component.y0;
  28761. }
  28762. function calculateTileGrids(context, components) {
  28763. var siz = context.SIZ;
  28764. var tile, tiles = [];
  28765. var numXtiles = Math.ceil((siz.Xsiz - siz.XTOsiz) / siz.XTsiz);
  28766. var numYtiles = Math.ceil((siz.Ysiz - siz.YTOsiz) / siz.YTsiz);
  28767. for (var q = 0; q < numYtiles; q++) {
  28768. for (var p = 0; p < numXtiles; p++) {
  28769. tile = {};
  28770. tile.tx0 = Math.max(siz.XTOsiz + p * siz.XTsiz, siz.XOsiz);
  28771. tile.ty0 = Math.max(siz.YTOsiz + q * siz.YTsiz, siz.YOsiz);
  28772. tile.tx1 = Math.min(siz.XTOsiz + (p + 1) * siz.XTsiz, siz.Xsiz);
  28773. tile.ty1 = Math.min(siz.YTOsiz + (q + 1) * siz.YTsiz, siz.Ysiz);
  28774. tile.width = tile.tx1 - tile.tx0;
  28775. tile.height = tile.ty1 - tile.ty0;
  28776. tile.components = [];
  28777. tiles.push(tile);
  28778. }
  28779. }
  28780. context.tiles = tiles;
  28781. var componentsCount = siz.Csiz;
  28782. for (var i = 0, ii = componentsCount; i < ii; i++) {
  28783. var component = components[i];
  28784. for (var j = 0, jj = tiles.length; j < jj; j++) {
  28785. var tileComponent = {};
  28786. tile = tiles[j];
  28787. tileComponent.tcx0 = Math.ceil(tile.tx0 / component.XRsiz);
  28788. tileComponent.tcy0 = Math.ceil(tile.ty0 / component.YRsiz);
  28789. tileComponent.tcx1 = Math.ceil(tile.tx1 / component.XRsiz);
  28790. tileComponent.tcy1 = Math.ceil(tile.ty1 / component.YRsiz);
  28791. tileComponent.width = tileComponent.tcx1 - tileComponent.tcx0;
  28792. tileComponent.height = tileComponent.tcy1 - tileComponent.tcy0;
  28793. tile.components[i] = tileComponent;
  28794. }
  28795. }
  28796. }
  28797. function getBlocksDimensions(context, component, r) {
  28798. var codOrCoc = component.codingStyleParameters;
  28799. var result = {};
  28800. if (!codOrCoc.entropyCoderWithCustomPrecincts) {
  28801. result.PPx = 15;
  28802. result.PPy = 15;
  28803. } else {
  28804. result.PPx = codOrCoc.precinctsSizes[r].PPx;
  28805. result.PPy = codOrCoc.precinctsSizes[r].PPy;
  28806. }
  28807. result.xcb_ = r > 0 ? Math.min(codOrCoc.xcb, result.PPx - 1) : Math.min(codOrCoc.xcb, result.PPx);
  28808. result.ycb_ = r > 0 ? Math.min(codOrCoc.ycb, result.PPy - 1) : Math.min(codOrCoc.ycb, result.PPy);
  28809. return result;
  28810. }
  28811. function buildPrecincts(context, resolution, dimensions) {
  28812. var precinctWidth = 1 << dimensions.PPx;
  28813. var precinctHeight = 1 << dimensions.PPy;
  28814. var isZeroRes = resolution.resLevel === 0;
  28815. var precinctWidthInSubband = 1 << dimensions.PPx + (isZeroRes ? 0 : -1);
  28816. var precinctHeightInSubband = 1 << dimensions.PPy + (isZeroRes ? 0 : -1);
  28817. var numprecinctswide = resolution.trx1 > resolution.trx0 ? Math.ceil(resolution.trx1 / precinctWidth) - Math.floor(resolution.trx0 / precinctWidth) : 0;
  28818. var numprecinctshigh = resolution.try1 > resolution.try0 ? Math.ceil(resolution.try1 / precinctHeight) - Math.floor(resolution.try0 / precinctHeight) : 0;
  28819. var numprecincts = numprecinctswide * numprecinctshigh;
  28820. resolution.precinctParameters = {
  28821. precinctWidth: precinctWidth,
  28822. precinctHeight: precinctHeight,
  28823. numprecinctswide: numprecinctswide,
  28824. numprecinctshigh: numprecinctshigh,
  28825. numprecincts: numprecincts,
  28826. precinctWidthInSubband: precinctWidthInSubband,
  28827. precinctHeightInSubband: precinctHeightInSubband
  28828. };
  28829. }
  28830. function buildCodeblocks(context, subband, dimensions) {
  28831. var xcb_ = dimensions.xcb_;
  28832. var ycb_ = dimensions.ycb_;
  28833. var codeblockWidth = 1 << xcb_;
  28834. var codeblockHeight = 1 << ycb_;
  28835. var cbx0 = subband.tbx0 >> xcb_;
  28836. var cby0 = subband.tby0 >> ycb_;
  28837. var cbx1 = subband.tbx1 + codeblockWidth - 1 >> xcb_;
  28838. var cby1 = subband.tby1 + codeblockHeight - 1 >> ycb_;
  28839. var precinctParameters = subband.resolution.precinctParameters;
  28840. var codeblocks = [];
  28841. var precincts = [];
  28842. var i, j, codeblock, precinctNumber;
  28843. for (j = cby0; j < cby1; j++) {
  28844. for (i = cbx0; i < cbx1; i++) {
  28845. codeblock = {
  28846. cbx: i,
  28847. cby: j,
  28848. tbx0: codeblockWidth * i,
  28849. tby0: codeblockHeight * j,
  28850. tbx1: codeblockWidth * (i + 1),
  28851. tby1: codeblockHeight * (j + 1)
  28852. };
  28853. codeblock.tbx0_ = Math.max(subband.tbx0, codeblock.tbx0);
  28854. codeblock.tby0_ = Math.max(subband.tby0, codeblock.tby0);
  28855. codeblock.tbx1_ = Math.min(subband.tbx1, codeblock.tbx1);
  28856. codeblock.tby1_ = Math.min(subband.tby1, codeblock.tby1);
  28857. var pi = Math.floor((codeblock.tbx0_ - subband.tbx0) / precinctParameters.precinctWidthInSubband);
  28858. var pj = Math.floor((codeblock.tby0_ - subband.tby0) / precinctParameters.precinctHeightInSubband);
  28859. precinctNumber = pi + pj * precinctParameters.numprecinctswide;
  28860. codeblock.precinctNumber = precinctNumber;
  28861. codeblock.subbandType = subband.type;
  28862. codeblock.Lblock = 3;
  28863. if (codeblock.tbx1_ <= codeblock.tbx0_ || codeblock.tby1_ <= codeblock.tby0_) {
  28864. continue;
  28865. }
  28866. codeblocks.push(codeblock);
  28867. var precinct = precincts[precinctNumber];
  28868. if (precinct !== undefined) {
  28869. if (i < precinct.cbxMin) {
  28870. precinct.cbxMin = i;
  28871. } else if (i > precinct.cbxMax) {
  28872. precinct.cbxMax = i;
  28873. }
  28874. if (j < precinct.cbyMin) {
  28875. precinct.cbxMin = j;
  28876. } else if (j > precinct.cbyMax) {
  28877. precinct.cbyMax = j;
  28878. }
  28879. } else {
  28880. precincts[precinctNumber] = precinct = {
  28881. cbxMin: i,
  28882. cbyMin: j,
  28883. cbxMax: i,
  28884. cbyMax: j
  28885. };
  28886. }
  28887. codeblock.precinct = precinct;
  28888. }
  28889. }
  28890. subband.codeblockParameters = {
  28891. codeblockWidth: xcb_,
  28892. codeblockHeight: ycb_,
  28893. numcodeblockwide: cbx1 - cbx0 + 1,
  28894. numcodeblockhigh: cby1 - cby0 + 1
  28895. };
  28896. subband.codeblocks = codeblocks;
  28897. subband.precincts = precincts;
  28898. }
  28899. function createPacket(resolution, precinctNumber, layerNumber) {
  28900. var precinctCodeblocks = [];
  28901. var subbands = resolution.subbands;
  28902. for (var i = 0, ii = subbands.length; i < ii; i++) {
  28903. var subband = subbands[i];
  28904. var codeblocks = subband.codeblocks;
  28905. for (var j = 0, jj = codeblocks.length; j < jj; j++) {
  28906. var codeblock = codeblocks[j];
  28907. if (codeblock.precinctNumber !== precinctNumber) {
  28908. continue;
  28909. }
  28910. precinctCodeblocks.push(codeblock);
  28911. }
  28912. }
  28913. return {
  28914. layerNumber: layerNumber,
  28915. codeblocks: precinctCodeblocks
  28916. };
  28917. }
  28918. function LayerResolutionComponentPositionIterator(context) {
  28919. var siz = context.SIZ;
  28920. var tileIndex = context.currentTile.index;
  28921. var tile = context.tiles[tileIndex];
  28922. var layersCount = tile.codingStyleDefaultParameters.layersCount;
  28923. var componentsCount = siz.Csiz;
  28924. var maxDecompositionLevelsCount = 0;
  28925. for (var q = 0; q < componentsCount; q++) {
  28926. maxDecompositionLevelsCount = Math.max(maxDecompositionLevelsCount, tile.components[q].codingStyleParameters.decompositionLevelsCount);
  28927. }
  28928. var l = 0, r = 0, i = 0, k = 0;
  28929. this.nextPacket = function JpxImage_nextPacket() {
  28930. for (; l < layersCount; l++) {
  28931. for (; r <= maxDecompositionLevelsCount; r++) {
  28932. for (; i < componentsCount; i++) {
  28933. var component = tile.components[i];
  28934. if (r > component.codingStyleParameters.decompositionLevelsCount) {
  28935. continue;
  28936. }
  28937. var resolution = component.resolutions[r];
  28938. var numprecincts = resolution.precinctParameters.numprecincts;
  28939. for (; k < numprecincts;) {
  28940. var packet = createPacket(resolution, k, l);
  28941. k++;
  28942. return packet;
  28943. }
  28944. k = 0;
  28945. }
  28946. i = 0;
  28947. }
  28948. r = 0;
  28949. }
  28950. error('JPX Error: Out of packets');
  28951. };
  28952. }
  28953. function ResolutionLayerComponentPositionIterator(context) {
  28954. var siz = context.SIZ;
  28955. var tileIndex = context.currentTile.index;
  28956. var tile = context.tiles[tileIndex];
  28957. var layersCount = tile.codingStyleDefaultParameters.layersCount;
  28958. var componentsCount = siz.Csiz;
  28959. var maxDecompositionLevelsCount = 0;
  28960. for (var q = 0; q < componentsCount; q++) {
  28961. maxDecompositionLevelsCount = Math.max(maxDecompositionLevelsCount, tile.components[q].codingStyleParameters.decompositionLevelsCount);
  28962. }
  28963. var r = 0, l = 0, i = 0, k = 0;
  28964. this.nextPacket = function JpxImage_nextPacket() {
  28965. for (; r <= maxDecompositionLevelsCount; r++) {
  28966. for (; l < layersCount; l++) {
  28967. for (; i < componentsCount; i++) {
  28968. var component = tile.components[i];
  28969. if (r > component.codingStyleParameters.decompositionLevelsCount) {
  28970. continue;
  28971. }
  28972. var resolution = component.resolutions[r];
  28973. var numprecincts = resolution.precinctParameters.numprecincts;
  28974. for (; k < numprecincts;) {
  28975. var packet = createPacket(resolution, k, l);
  28976. k++;
  28977. return packet;
  28978. }
  28979. k = 0;
  28980. }
  28981. i = 0;
  28982. }
  28983. l = 0;
  28984. }
  28985. error('JPX Error: Out of packets');
  28986. };
  28987. }
  28988. function ResolutionPositionComponentLayerIterator(context) {
  28989. var siz = context.SIZ;
  28990. var tileIndex = context.currentTile.index;
  28991. var tile = context.tiles[tileIndex];
  28992. var layersCount = tile.codingStyleDefaultParameters.layersCount;
  28993. var componentsCount = siz.Csiz;
  28994. var l, r, c, p;
  28995. var maxDecompositionLevelsCount = 0;
  28996. for (c = 0; c < componentsCount; c++) {
  28997. var component = tile.components[c];
  28998. maxDecompositionLevelsCount = Math.max(maxDecompositionLevelsCount, component.codingStyleParameters.decompositionLevelsCount);
  28999. }
  29000. var maxNumPrecinctsInLevel = new Int32Array(maxDecompositionLevelsCount + 1);
  29001. for (r = 0; r <= maxDecompositionLevelsCount; ++r) {
  29002. var maxNumPrecincts = 0;
  29003. for (c = 0; c < componentsCount; ++c) {
  29004. var resolutions = tile.components[c].resolutions;
  29005. if (r < resolutions.length) {
  29006. maxNumPrecincts = Math.max(maxNumPrecincts, resolutions[r].precinctParameters.numprecincts);
  29007. }
  29008. }
  29009. maxNumPrecinctsInLevel[r] = maxNumPrecincts;
  29010. }
  29011. l = 0;
  29012. r = 0;
  29013. c = 0;
  29014. p = 0;
  29015. this.nextPacket = function JpxImage_nextPacket() {
  29016. for (; r <= maxDecompositionLevelsCount; r++) {
  29017. for (; p < maxNumPrecinctsInLevel[r]; p++) {
  29018. for (; c < componentsCount; c++) {
  29019. var component = tile.components[c];
  29020. if (r > component.codingStyleParameters.decompositionLevelsCount) {
  29021. continue;
  29022. }
  29023. var resolution = component.resolutions[r];
  29024. var numprecincts = resolution.precinctParameters.numprecincts;
  29025. if (p >= numprecincts) {
  29026. continue;
  29027. }
  29028. for (; l < layersCount;) {
  29029. var packet = createPacket(resolution, p, l);
  29030. l++;
  29031. return packet;
  29032. }
  29033. l = 0;
  29034. }
  29035. c = 0;
  29036. }
  29037. p = 0;
  29038. }
  29039. error('JPX Error: Out of packets');
  29040. };
  29041. }
  29042. function PositionComponentResolutionLayerIterator(context) {
  29043. var siz = context.SIZ;
  29044. var tileIndex = context.currentTile.index;
  29045. var tile = context.tiles[tileIndex];
  29046. var layersCount = tile.codingStyleDefaultParameters.layersCount;
  29047. var componentsCount = siz.Csiz;
  29048. var precinctsSizes = getPrecinctSizesInImageScale(tile);
  29049. var precinctsIterationSizes = precinctsSizes;
  29050. var l = 0, r = 0, c = 0, px = 0, py = 0;
  29051. this.nextPacket = function JpxImage_nextPacket() {
  29052. for (; py < precinctsIterationSizes.maxNumHigh; py++) {
  29053. for (; px < precinctsIterationSizes.maxNumWide; px++) {
  29054. for (; c < componentsCount; c++) {
  29055. var component = tile.components[c];
  29056. var decompositionLevelsCount = component.codingStyleParameters.decompositionLevelsCount;
  29057. for (; r <= decompositionLevelsCount; r++) {
  29058. var resolution = component.resolutions[r];
  29059. var sizeInImageScale = precinctsSizes.components[c].resolutions[r];
  29060. var k = getPrecinctIndexIfExist(px, py, sizeInImageScale, precinctsIterationSizes, resolution);
  29061. if (k === null) {
  29062. continue;
  29063. }
  29064. for (; l < layersCount;) {
  29065. var packet = createPacket(resolution, k, l);
  29066. l++;
  29067. return packet;
  29068. }
  29069. l = 0;
  29070. }
  29071. r = 0;
  29072. }
  29073. c = 0;
  29074. }
  29075. px = 0;
  29076. }
  29077. error('JPX Error: Out of packets');
  29078. };
  29079. }
  29080. function ComponentPositionResolutionLayerIterator(context) {
  29081. var siz = context.SIZ;
  29082. var tileIndex = context.currentTile.index;
  29083. var tile = context.tiles[tileIndex];
  29084. var layersCount = tile.codingStyleDefaultParameters.layersCount;
  29085. var componentsCount = siz.Csiz;
  29086. var precinctsSizes = getPrecinctSizesInImageScale(tile);
  29087. var l = 0, r = 0, c = 0, px = 0, py = 0;
  29088. this.nextPacket = function JpxImage_nextPacket() {
  29089. for (; c < componentsCount; ++c) {
  29090. var component = tile.components[c];
  29091. var precinctsIterationSizes = precinctsSizes.components[c];
  29092. var decompositionLevelsCount = component.codingStyleParameters.decompositionLevelsCount;
  29093. for (; py < precinctsIterationSizes.maxNumHigh; py++) {
  29094. for (; px < precinctsIterationSizes.maxNumWide; px++) {
  29095. for (; r <= decompositionLevelsCount; r++) {
  29096. var resolution = component.resolutions[r];
  29097. var sizeInImageScale = precinctsIterationSizes.resolutions[r];
  29098. var k = getPrecinctIndexIfExist(px, py, sizeInImageScale, precinctsIterationSizes, resolution);
  29099. if (k === null) {
  29100. continue;
  29101. }
  29102. for (; l < layersCount;) {
  29103. var packet = createPacket(resolution, k, l);
  29104. l++;
  29105. return packet;
  29106. }
  29107. l = 0;
  29108. }
  29109. r = 0;
  29110. }
  29111. px = 0;
  29112. }
  29113. py = 0;
  29114. }
  29115. error('JPX Error: Out of packets');
  29116. };
  29117. }
  29118. function getPrecinctIndexIfExist(pxIndex, pyIndex, sizeInImageScale, precinctIterationSizes, resolution) {
  29119. var posX = pxIndex * precinctIterationSizes.minWidth;
  29120. var posY = pyIndex * precinctIterationSizes.minHeight;
  29121. if (posX % sizeInImageScale.width !== 0 || posY % sizeInImageScale.height !== 0) {
  29122. return null;
  29123. }
  29124. var startPrecinctRowIndex = posY / sizeInImageScale.width * resolution.precinctParameters.numprecinctswide;
  29125. return posX / sizeInImageScale.height + startPrecinctRowIndex;
  29126. }
  29127. function getPrecinctSizesInImageScale(tile) {
  29128. var componentsCount = tile.components.length;
  29129. var minWidth = Number.MAX_VALUE;
  29130. var minHeight = Number.MAX_VALUE;
  29131. var maxNumWide = 0;
  29132. var maxNumHigh = 0;
  29133. var sizePerComponent = new Array(componentsCount);
  29134. for (var c = 0; c < componentsCount; c++) {
  29135. var component = tile.components[c];
  29136. var decompositionLevelsCount = component.codingStyleParameters.decompositionLevelsCount;
  29137. var sizePerResolution = new Array(decompositionLevelsCount + 1);
  29138. var minWidthCurrentComponent = Number.MAX_VALUE;
  29139. var minHeightCurrentComponent = Number.MAX_VALUE;
  29140. var maxNumWideCurrentComponent = 0;
  29141. var maxNumHighCurrentComponent = 0;
  29142. var scale = 1;
  29143. for (var r = decompositionLevelsCount; r >= 0; --r) {
  29144. var resolution = component.resolutions[r];
  29145. var widthCurrentResolution = scale * resolution.precinctParameters.precinctWidth;
  29146. var heightCurrentResolution = scale * resolution.precinctParameters.precinctHeight;
  29147. minWidthCurrentComponent = Math.min(minWidthCurrentComponent, widthCurrentResolution);
  29148. minHeightCurrentComponent = Math.min(minHeightCurrentComponent, heightCurrentResolution);
  29149. maxNumWideCurrentComponent = Math.max(maxNumWideCurrentComponent, resolution.precinctParameters.numprecinctswide);
  29150. maxNumHighCurrentComponent = Math.max(maxNumHighCurrentComponent, resolution.precinctParameters.numprecinctshigh);
  29151. sizePerResolution[r] = {
  29152. width: widthCurrentResolution,
  29153. height: heightCurrentResolution
  29154. };
  29155. scale <<= 1;
  29156. }
  29157. minWidth = Math.min(minWidth, minWidthCurrentComponent);
  29158. minHeight = Math.min(minHeight, minHeightCurrentComponent);
  29159. maxNumWide = Math.max(maxNumWide, maxNumWideCurrentComponent);
  29160. maxNumHigh = Math.max(maxNumHigh, maxNumHighCurrentComponent);
  29161. sizePerComponent[c] = {
  29162. resolutions: sizePerResolution,
  29163. minWidth: minWidthCurrentComponent,
  29164. minHeight: minHeightCurrentComponent,
  29165. maxNumWide: maxNumWideCurrentComponent,
  29166. maxNumHigh: maxNumHighCurrentComponent
  29167. };
  29168. }
  29169. return {
  29170. components: sizePerComponent,
  29171. minWidth: minWidth,
  29172. minHeight: minHeight,
  29173. maxNumWide: maxNumWide,
  29174. maxNumHigh: maxNumHigh
  29175. };
  29176. }
  29177. function buildPackets(context) {
  29178. var siz = context.SIZ;
  29179. var tileIndex = context.currentTile.index;
  29180. var tile = context.tiles[tileIndex];
  29181. var componentsCount = siz.Csiz;
  29182. for (var c = 0; c < componentsCount; c++) {
  29183. var component = tile.components[c];
  29184. var decompositionLevelsCount = component.codingStyleParameters.decompositionLevelsCount;
  29185. var resolutions = [];
  29186. var subbands = [];
  29187. for (var r = 0; r <= decompositionLevelsCount; r++) {
  29188. var blocksDimensions = getBlocksDimensions(context, component, r);
  29189. var resolution = {};
  29190. var scale = 1 << decompositionLevelsCount - r;
  29191. resolution.trx0 = Math.ceil(component.tcx0 / scale);
  29192. resolution.try0 = Math.ceil(component.tcy0 / scale);
  29193. resolution.trx1 = Math.ceil(component.tcx1 / scale);
  29194. resolution.try1 = Math.ceil(component.tcy1 / scale);
  29195. resolution.resLevel = r;
  29196. buildPrecincts(context, resolution, blocksDimensions);
  29197. resolutions.push(resolution);
  29198. var subband;
  29199. if (r === 0) {
  29200. subband = {};
  29201. subband.type = 'LL';
  29202. subband.tbx0 = Math.ceil(component.tcx0 / scale);
  29203. subband.tby0 = Math.ceil(component.tcy0 / scale);
  29204. subband.tbx1 = Math.ceil(component.tcx1 / scale);
  29205. subband.tby1 = Math.ceil(component.tcy1 / scale);
  29206. subband.resolution = resolution;
  29207. buildCodeblocks(context, subband, blocksDimensions);
  29208. subbands.push(subband);
  29209. resolution.subbands = [subband];
  29210. } else {
  29211. var bscale = 1 << decompositionLevelsCount - r + 1;
  29212. var resolutionSubbands = [];
  29213. subband = {};
  29214. subband.type = 'HL';
  29215. subband.tbx0 = Math.ceil(component.tcx0 / bscale - 0.5);
  29216. subband.tby0 = Math.ceil(component.tcy0 / bscale);
  29217. subband.tbx1 = Math.ceil(component.tcx1 / bscale - 0.5);
  29218. subband.tby1 = Math.ceil(component.tcy1 / bscale);
  29219. subband.resolution = resolution;
  29220. buildCodeblocks(context, subband, blocksDimensions);
  29221. subbands.push(subband);
  29222. resolutionSubbands.push(subband);
  29223. subband = {};
  29224. subband.type = 'LH';
  29225. subband.tbx0 = Math.ceil(component.tcx0 / bscale);
  29226. subband.tby0 = Math.ceil(component.tcy0 / bscale - 0.5);
  29227. subband.tbx1 = Math.ceil(component.tcx1 / bscale);
  29228. subband.tby1 = Math.ceil(component.tcy1 / bscale - 0.5);
  29229. subband.resolution = resolution;
  29230. buildCodeblocks(context, subband, blocksDimensions);
  29231. subbands.push(subband);
  29232. resolutionSubbands.push(subband);
  29233. subband = {};
  29234. subband.type = 'HH';
  29235. subband.tbx0 = Math.ceil(component.tcx0 / bscale - 0.5);
  29236. subband.tby0 = Math.ceil(component.tcy0 / bscale - 0.5);
  29237. subband.tbx1 = Math.ceil(component.tcx1 / bscale - 0.5);
  29238. subband.tby1 = Math.ceil(component.tcy1 / bscale - 0.5);
  29239. subband.resolution = resolution;
  29240. buildCodeblocks(context, subband, blocksDimensions);
  29241. subbands.push(subband);
  29242. resolutionSubbands.push(subband);
  29243. resolution.subbands = resolutionSubbands;
  29244. }
  29245. }
  29246. component.resolutions = resolutions;
  29247. component.subbands = subbands;
  29248. }
  29249. var progressionOrder = tile.codingStyleDefaultParameters.progressionOrder;
  29250. switch (progressionOrder) {
  29251. case 0:
  29252. tile.packetsIterator = new LayerResolutionComponentPositionIterator(context);
  29253. break;
  29254. case 1:
  29255. tile.packetsIterator = new ResolutionLayerComponentPositionIterator(context);
  29256. break;
  29257. case 2:
  29258. tile.packetsIterator = new ResolutionPositionComponentLayerIterator(context);
  29259. break;
  29260. case 3:
  29261. tile.packetsIterator = new PositionComponentResolutionLayerIterator(context);
  29262. break;
  29263. case 4:
  29264. tile.packetsIterator = new ComponentPositionResolutionLayerIterator(context);
  29265. break;
  29266. default:
  29267. error('JPX Error: Unsupported progression order ' + progressionOrder);
  29268. }
  29269. }
  29270. function parseTilePackets(context, data, offset, dataLength) {
  29271. var position = 0;
  29272. var buffer, bufferSize = 0, skipNextBit = false;
  29273. function readBits(count) {
  29274. while (bufferSize < count) {
  29275. var b = data[offset + position];
  29276. position++;
  29277. if (skipNextBit) {
  29278. buffer = buffer << 7 | b;
  29279. bufferSize += 7;
  29280. skipNextBit = false;
  29281. } else {
  29282. buffer = buffer << 8 | b;
  29283. bufferSize += 8;
  29284. }
  29285. if (b === 0xFF) {
  29286. skipNextBit = true;
  29287. }
  29288. }
  29289. bufferSize -= count;
  29290. return buffer >>> bufferSize & (1 << count) - 1;
  29291. }
  29292. function skipMarkerIfEqual(value) {
  29293. if (data[offset + position - 1] === 0xFF && data[offset + position] === value) {
  29294. skipBytes(1);
  29295. return true;
  29296. } else if (data[offset + position] === 0xFF && data[offset + position + 1] === value) {
  29297. skipBytes(2);
  29298. return true;
  29299. }
  29300. return false;
  29301. }
  29302. function skipBytes(count) {
  29303. position += count;
  29304. }
  29305. function alignToByte() {
  29306. bufferSize = 0;
  29307. if (skipNextBit) {
  29308. position++;
  29309. skipNextBit = false;
  29310. }
  29311. }
  29312. function readCodingpasses() {
  29313. if (readBits(1) === 0) {
  29314. return 1;
  29315. }
  29316. if (readBits(1) === 0) {
  29317. return 2;
  29318. }
  29319. var value = readBits(2);
  29320. if (value < 3) {
  29321. return value + 3;
  29322. }
  29323. value = readBits(5);
  29324. if (value < 31) {
  29325. return value + 6;
  29326. }
  29327. value = readBits(7);
  29328. return value + 37;
  29329. }
  29330. var tileIndex = context.currentTile.index;
  29331. var tile = context.tiles[tileIndex];
  29332. var sopMarkerUsed = context.COD.sopMarkerUsed;
  29333. var ephMarkerUsed = context.COD.ephMarkerUsed;
  29334. var packetsIterator = tile.packetsIterator;
  29335. while (position < dataLength) {
  29336. alignToByte();
  29337. if (sopMarkerUsed && skipMarkerIfEqual(0x91)) {
  29338. skipBytes(4);
  29339. }
  29340. var packet = packetsIterator.nextPacket();
  29341. if (!readBits(1)) {
  29342. continue;
  29343. }
  29344. var layerNumber = packet.layerNumber;
  29345. var queue = [], codeblock;
  29346. for (var i = 0, ii = packet.codeblocks.length; i < ii; i++) {
  29347. codeblock = packet.codeblocks[i];
  29348. var precinct = codeblock.precinct;
  29349. var codeblockColumn = codeblock.cbx - precinct.cbxMin;
  29350. var codeblockRow = codeblock.cby - precinct.cbyMin;
  29351. var codeblockIncluded = false;
  29352. var firstTimeInclusion = false;
  29353. var valueReady;
  29354. if (codeblock['included'] !== undefined) {
  29355. codeblockIncluded = !!readBits(1);
  29356. } else {
  29357. precinct = codeblock.precinct;
  29358. var inclusionTree, zeroBitPlanesTree;
  29359. if (precinct['inclusionTree'] !== undefined) {
  29360. inclusionTree = precinct.inclusionTree;
  29361. } else {
  29362. var width = precinct.cbxMax - precinct.cbxMin + 1;
  29363. var height = precinct.cbyMax - precinct.cbyMin + 1;
  29364. inclusionTree = new InclusionTree(width, height, layerNumber);
  29365. zeroBitPlanesTree = new TagTree(width, height);
  29366. precinct.inclusionTree = inclusionTree;
  29367. precinct.zeroBitPlanesTree = zeroBitPlanesTree;
  29368. }
  29369. if (inclusionTree.reset(codeblockColumn, codeblockRow, layerNumber)) {
  29370. while (true) {
  29371. if (readBits(1)) {
  29372. valueReady = !inclusionTree.nextLevel();
  29373. if (valueReady) {
  29374. codeblock.included = true;
  29375. codeblockIncluded = firstTimeInclusion = true;
  29376. break;
  29377. }
  29378. } else {
  29379. inclusionTree.incrementValue(layerNumber);
  29380. break;
  29381. }
  29382. }
  29383. }
  29384. }
  29385. if (!codeblockIncluded) {
  29386. continue;
  29387. }
  29388. if (firstTimeInclusion) {
  29389. zeroBitPlanesTree = precinct.zeroBitPlanesTree;
  29390. zeroBitPlanesTree.reset(codeblockColumn, codeblockRow);
  29391. while (true) {
  29392. if (readBits(1)) {
  29393. valueReady = !zeroBitPlanesTree.nextLevel();
  29394. if (valueReady) {
  29395. break;
  29396. }
  29397. } else {
  29398. zeroBitPlanesTree.incrementValue();
  29399. }
  29400. }
  29401. codeblock.zeroBitPlanes = zeroBitPlanesTree.value;
  29402. }
  29403. var codingpasses = readCodingpasses();
  29404. while (readBits(1)) {
  29405. codeblock.Lblock++;
  29406. }
  29407. var codingpassesLog2 = log2(codingpasses);
  29408. var bits = (codingpasses < 1 << codingpassesLog2 ? codingpassesLog2 - 1 : codingpassesLog2) + codeblock.Lblock;
  29409. var codedDataLength = readBits(bits);
  29410. queue.push({
  29411. codeblock: codeblock,
  29412. codingpasses: codingpasses,
  29413. dataLength: codedDataLength
  29414. });
  29415. }
  29416. alignToByte();
  29417. if (ephMarkerUsed) {
  29418. skipMarkerIfEqual(0x92);
  29419. }
  29420. while (queue.length > 0) {
  29421. var packetItem = queue.shift();
  29422. codeblock = packetItem.codeblock;
  29423. if (codeblock['data'] === undefined) {
  29424. codeblock.data = [];
  29425. }
  29426. codeblock.data.push({
  29427. data: data,
  29428. start: offset + position,
  29429. end: offset + position + packetItem.dataLength,
  29430. codingpasses: packetItem.codingpasses
  29431. });
  29432. position += packetItem.dataLength;
  29433. }
  29434. }
  29435. return position;
  29436. }
  29437. function copyCoefficients(coefficients, levelWidth, levelHeight, subband, delta, mb, reversible, segmentationSymbolUsed) {
  29438. var x0 = subband.tbx0;
  29439. var y0 = subband.tby0;
  29440. var width = subband.tbx1 - subband.tbx0;
  29441. var codeblocks = subband.codeblocks;
  29442. var right = subband.type.charAt(0) === 'H' ? 1 : 0;
  29443. var bottom = subband.type.charAt(1) === 'H' ? levelWidth : 0;
  29444. for (var i = 0, ii = codeblocks.length; i < ii; ++i) {
  29445. var codeblock = codeblocks[i];
  29446. var blockWidth = codeblock.tbx1_ - codeblock.tbx0_;
  29447. var blockHeight = codeblock.tby1_ - codeblock.tby0_;
  29448. if (blockWidth === 0 || blockHeight === 0) {
  29449. continue;
  29450. }
  29451. if (codeblock['data'] === undefined) {
  29452. continue;
  29453. }
  29454. var bitModel, currentCodingpassType;
  29455. bitModel = new BitModel(blockWidth, blockHeight, codeblock.subbandType, codeblock.zeroBitPlanes, mb);
  29456. currentCodingpassType = 2;
  29457. var data = codeblock.data, totalLength = 0, codingpasses = 0;
  29458. var j, jj, dataItem;
  29459. for (j = 0, jj = data.length; j < jj; j++) {
  29460. dataItem = data[j];
  29461. totalLength += dataItem.end - dataItem.start;
  29462. codingpasses += dataItem.codingpasses;
  29463. }
  29464. var encodedData = new Uint8Array(totalLength);
  29465. var position = 0;
  29466. for (j = 0, jj = data.length; j < jj; j++) {
  29467. dataItem = data[j];
  29468. var chunk = dataItem.data.subarray(dataItem.start, dataItem.end);
  29469. encodedData.set(chunk, position);
  29470. position += chunk.length;
  29471. }
  29472. var decoder = new ArithmeticDecoder(encodedData, 0, totalLength);
  29473. bitModel.setDecoder(decoder);
  29474. for (j = 0; j < codingpasses; j++) {
  29475. switch (currentCodingpassType) {
  29476. case 0:
  29477. bitModel.runSignificancePropagationPass();
  29478. break;
  29479. case 1:
  29480. bitModel.runMagnitudeRefinementPass();
  29481. break;
  29482. case 2:
  29483. bitModel.runCleanupPass();
  29484. if (segmentationSymbolUsed) {
  29485. bitModel.checkSegmentationSymbol();
  29486. }
  29487. break;
  29488. }
  29489. currentCodingpassType = (currentCodingpassType + 1) % 3;
  29490. }
  29491. var offset = codeblock.tbx0_ - x0 + (codeblock.tby0_ - y0) * width;
  29492. var sign = bitModel.coefficentsSign;
  29493. var magnitude = bitModel.coefficentsMagnitude;
  29494. var bitsDecoded = bitModel.bitsDecoded;
  29495. var magnitudeCorrection = reversible ? 0 : 0.5;
  29496. var k, n, nb;
  29497. position = 0;
  29498. var interleave = subband.type !== 'LL';
  29499. for (j = 0; j < blockHeight; j++) {
  29500. var row = offset / width | 0;
  29501. var levelOffset = 2 * row * (levelWidth - width) + right + bottom;
  29502. for (k = 0; k < blockWidth; k++) {
  29503. n = magnitude[position];
  29504. if (n !== 0) {
  29505. n = (n + magnitudeCorrection) * delta;
  29506. if (sign[position] !== 0) {
  29507. n = -n;
  29508. }
  29509. nb = bitsDecoded[position];
  29510. var pos = interleave ? levelOffset + (offset << 1) : offset;
  29511. if (reversible && nb >= mb) {
  29512. coefficients[pos] = n;
  29513. } else {
  29514. coefficients[pos] = n * (1 << mb - nb);
  29515. }
  29516. }
  29517. offset++;
  29518. position++;
  29519. }
  29520. offset += width - blockWidth;
  29521. }
  29522. }
  29523. }
  29524. function transformTile(context, tile, c) {
  29525. var component = tile.components[c];
  29526. var codingStyleParameters = component.codingStyleParameters;
  29527. var quantizationParameters = component.quantizationParameters;
  29528. var decompositionLevelsCount = codingStyleParameters.decompositionLevelsCount;
  29529. var spqcds = quantizationParameters.SPqcds;
  29530. var scalarExpounded = quantizationParameters.scalarExpounded;
  29531. var guardBits = quantizationParameters.guardBits;
  29532. var segmentationSymbolUsed = codingStyleParameters.segmentationSymbolUsed;
  29533. var precision = context.components[c].precision;
  29534. var reversible = codingStyleParameters.reversibleTransformation;
  29535. var transform = reversible ? new ReversibleTransform() : new IrreversibleTransform();
  29536. var subbandCoefficients = [];
  29537. var b = 0;
  29538. for (var i = 0; i <= decompositionLevelsCount; i++) {
  29539. var resolution = component.resolutions[i];
  29540. var width = resolution.trx1 - resolution.trx0;
  29541. var height = resolution.try1 - resolution.try0;
  29542. var coefficients = new Float32Array(width * height);
  29543. for (var j = 0, jj = resolution.subbands.length; j < jj; j++) {
  29544. var mu, epsilon;
  29545. if (!scalarExpounded) {
  29546. mu = spqcds[0].mu;
  29547. epsilon = spqcds[0].epsilon + (i > 0 ? 1 - i : 0);
  29548. } else {
  29549. mu = spqcds[b].mu;
  29550. epsilon = spqcds[b].epsilon;
  29551. b++;
  29552. }
  29553. var subband = resolution.subbands[j];
  29554. var gainLog2 = SubbandsGainLog2[subband.type];
  29555. var delta = reversible ? 1 : Math.pow(2, precision + gainLog2 - epsilon) * (1 + mu / 2048);
  29556. var mb = guardBits + epsilon - 1;
  29557. copyCoefficients(coefficients, width, height, subband, delta, mb, reversible, segmentationSymbolUsed);
  29558. }
  29559. subbandCoefficients.push({
  29560. width: width,
  29561. height: height,
  29562. items: coefficients
  29563. });
  29564. }
  29565. var result = transform.calculate(subbandCoefficients, component.tcx0, component.tcy0);
  29566. return {
  29567. left: component.tcx0,
  29568. top: component.tcy0,
  29569. width: result.width,
  29570. height: result.height,
  29571. items: result.items
  29572. };
  29573. }
  29574. function transformComponents(context) {
  29575. var siz = context.SIZ;
  29576. var components = context.components;
  29577. var componentsCount = siz.Csiz;
  29578. var resultImages = [];
  29579. for (var i = 0, ii = context.tiles.length; i < ii; i++) {
  29580. var tile = context.tiles[i];
  29581. var transformedTiles = [];
  29582. var c;
  29583. for (c = 0; c < componentsCount; c++) {
  29584. transformedTiles[c] = transformTile(context, tile, c);
  29585. }
  29586. var tile0 = transformedTiles[0];
  29587. var out = new Uint8Array(tile0.items.length * componentsCount);
  29588. var result = {
  29589. left: tile0.left,
  29590. top: tile0.top,
  29591. width: tile0.width,
  29592. height: tile0.height,
  29593. items: out
  29594. };
  29595. var shift, offset, max, min, maxK;
  29596. var pos = 0, j, jj, y0, y1, y2, r, g, b, k, val;
  29597. if (tile.codingStyleDefaultParameters.multipleComponentTransform) {
  29598. var fourComponents = componentsCount === 4;
  29599. var y0items = transformedTiles[0].items;
  29600. var y1items = transformedTiles[1].items;
  29601. var y2items = transformedTiles[2].items;
  29602. var y3items = fourComponents ? transformedTiles[3].items : null;
  29603. shift = components[0].precision - 8;
  29604. offset = (128 << shift) + 0.5;
  29605. max = 255 * (1 << shift);
  29606. maxK = max * 0.5;
  29607. min = -maxK;
  29608. var component0 = tile.components[0];
  29609. var alpha01 = componentsCount - 3;
  29610. jj = y0items.length;
  29611. if (!component0.codingStyleParameters.reversibleTransformation) {
  29612. for (j = 0; j < jj; j++, pos += alpha01) {
  29613. y0 = y0items[j] + offset;
  29614. y1 = y1items[j];
  29615. y2 = y2items[j];
  29616. r = y0 + 1.402 * y2;
  29617. g = y0 - 0.34413 * y1 - 0.71414 * y2;
  29618. b = y0 + 1.772 * y1;
  29619. out[pos++] = r <= 0 ? 0 : r >= max ? 255 : r >> shift;
  29620. out[pos++] = g <= 0 ? 0 : g >= max ? 255 : g >> shift;
  29621. out[pos++] = b <= 0 ? 0 : b >= max ? 255 : b >> shift;
  29622. }
  29623. } else {
  29624. for (j = 0; j < jj; j++, pos += alpha01) {
  29625. y0 = y0items[j] + offset;
  29626. y1 = y1items[j];
  29627. y2 = y2items[j];
  29628. g = y0 - (y2 + y1 >> 2);
  29629. r = g + y2;
  29630. b = g + y1;
  29631. out[pos++] = r <= 0 ? 0 : r >= max ? 255 : r >> shift;
  29632. out[pos++] = g <= 0 ? 0 : g >= max ? 255 : g >> shift;
  29633. out[pos++] = b <= 0 ? 0 : b >= max ? 255 : b >> shift;
  29634. }
  29635. }
  29636. if (fourComponents) {
  29637. for (j = 0, pos = 3; j < jj; j++, pos += 4) {
  29638. k = y3items[j];
  29639. out[pos] = k <= min ? 0 : k >= maxK ? 255 : k + offset >> shift;
  29640. }
  29641. }
  29642. } else {
  29643. for (c = 0; c < componentsCount; c++) {
  29644. var items = transformedTiles[c].items;
  29645. shift = components[c].precision - 8;
  29646. offset = (128 << shift) + 0.5;
  29647. max = 127.5 * (1 << shift);
  29648. min = -max;
  29649. for (pos = c, j = 0, jj = items.length; j < jj; j++) {
  29650. val = items[j];
  29651. out[pos] = val <= min ? 0 : val >= max ? 255 : val + offset >> shift;
  29652. pos += componentsCount;
  29653. }
  29654. }
  29655. }
  29656. resultImages.push(result);
  29657. }
  29658. return resultImages;
  29659. }
  29660. function initializeTile(context, tileIndex) {
  29661. var siz = context.SIZ;
  29662. var componentsCount = siz.Csiz;
  29663. var tile = context.tiles[tileIndex];
  29664. for (var c = 0; c < componentsCount; c++) {
  29665. var component = tile.components[c];
  29666. var qcdOrQcc = context.currentTile.QCC[c] !== undefined ? context.currentTile.QCC[c] : context.currentTile.QCD;
  29667. component.quantizationParameters = qcdOrQcc;
  29668. var codOrCoc = context.currentTile.COC[c] !== undefined ? context.currentTile.COC[c] : context.currentTile.COD;
  29669. component.codingStyleParameters = codOrCoc;
  29670. }
  29671. tile.codingStyleDefaultParameters = context.currentTile.COD;
  29672. }
  29673. var TagTree = function TagTreeClosure() {
  29674. function TagTree(width, height) {
  29675. var levelsLength = log2(Math.max(width, height)) + 1;
  29676. this.levels = [];
  29677. for (var i = 0; i < levelsLength; i++) {
  29678. var level = {
  29679. width: width,
  29680. height: height,
  29681. items: []
  29682. };
  29683. this.levels.push(level);
  29684. width = Math.ceil(width / 2);
  29685. height = Math.ceil(height / 2);
  29686. }
  29687. }
  29688. TagTree.prototype = {
  29689. reset: function TagTree_reset(i, j) {
  29690. var currentLevel = 0, value = 0, level;
  29691. while (currentLevel < this.levels.length) {
  29692. level = this.levels[currentLevel];
  29693. var index = i + j * level.width;
  29694. if (level.items[index] !== undefined) {
  29695. value = level.items[index];
  29696. break;
  29697. }
  29698. level.index = index;
  29699. i >>= 1;
  29700. j >>= 1;
  29701. currentLevel++;
  29702. }
  29703. currentLevel--;
  29704. level = this.levels[currentLevel];
  29705. level.items[level.index] = value;
  29706. this.currentLevel = currentLevel;
  29707. delete this.value;
  29708. },
  29709. incrementValue: function TagTree_incrementValue() {
  29710. var level = this.levels[this.currentLevel];
  29711. level.items[level.index]++;
  29712. },
  29713. nextLevel: function TagTree_nextLevel() {
  29714. var currentLevel = this.currentLevel;
  29715. var level = this.levels[currentLevel];
  29716. var value = level.items[level.index];
  29717. currentLevel--;
  29718. if (currentLevel < 0) {
  29719. this.value = value;
  29720. return false;
  29721. }
  29722. this.currentLevel = currentLevel;
  29723. level = this.levels[currentLevel];
  29724. level.items[level.index] = value;
  29725. return true;
  29726. }
  29727. };
  29728. return TagTree;
  29729. }();
  29730. var InclusionTree = function InclusionTreeClosure() {
  29731. function InclusionTree(width, height, defaultValue) {
  29732. var levelsLength = log2(Math.max(width, height)) + 1;
  29733. this.levels = [];
  29734. for (var i = 0; i < levelsLength; i++) {
  29735. var items = new Uint8Array(width * height);
  29736. for (var j = 0, jj = items.length; j < jj; j++) {
  29737. items[j] = defaultValue;
  29738. }
  29739. var level = {
  29740. width: width,
  29741. height: height,
  29742. items: items
  29743. };
  29744. this.levels.push(level);
  29745. width = Math.ceil(width / 2);
  29746. height = Math.ceil(height / 2);
  29747. }
  29748. }
  29749. InclusionTree.prototype = {
  29750. reset: function InclusionTree_reset(i, j, stopValue) {
  29751. var currentLevel = 0;
  29752. while (currentLevel < this.levels.length) {
  29753. var level = this.levels[currentLevel];
  29754. var index = i + j * level.width;
  29755. level.index = index;
  29756. var value = level.items[index];
  29757. if (value === 0xFF) {
  29758. break;
  29759. }
  29760. if (value > stopValue) {
  29761. this.currentLevel = currentLevel;
  29762. this.propagateValues();
  29763. return false;
  29764. }
  29765. i >>= 1;
  29766. j >>= 1;
  29767. currentLevel++;
  29768. }
  29769. this.currentLevel = currentLevel - 1;
  29770. return true;
  29771. },
  29772. incrementValue: function InclusionTree_incrementValue(stopValue) {
  29773. var level = this.levels[this.currentLevel];
  29774. level.items[level.index] = stopValue + 1;
  29775. this.propagateValues();
  29776. },
  29777. propagateValues: function InclusionTree_propagateValues() {
  29778. var levelIndex = this.currentLevel;
  29779. var level = this.levels[levelIndex];
  29780. var currentValue = level.items[level.index];
  29781. while (--levelIndex >= 0) {
  29782. level = this.levels[levelIndex];
  29783. level.items[level.index] = currentValue;
  29784. }
  29785. },
  29786. nextLevel: function InclusionTree_nextLevel() {
  29787. var currentLevel = this.currentLevel;
  29788. var level = this.levels[currentLevel];
  29789. var value = level.items[level.index];
  29790. level.items[level.index] = 0xFF;
  29791. currentLevel--;
  29792. if (currentLevel < 0) {
  29793. return false;
  29794. }
  29795. this.currentLevel = currentLevel;
  29796. level = this.levels[currentLevel];
  29797. level.items[level.index] = value;
  29798. return true;
  29799. }
  29800. };
  29801. return InclusionTree;
  29802. }();
  29803. var BitModel = function BitModelClosure() {
  29804. var UNIFORM_CONTEXT = 17;
  29805. var RUNLENGTH_CONTEXT = 18;
  29806. var LLAndLHContextsLabel = new Uint8Array([
  29807. 0,
  29808. 5,
  29809. 8,
  29810. 0,
  29811. 3,
  29812. 7,
  29813. 8,
  29814. 0,
  29815. 4,
  29816. 7,
  29817. 8,
  29818. 0,
  29819. 0,
  29820. 0,
  29821. 0,
  29822. 0,
  29823. 1,
  29824. 6,
  29825. 8,
  29826. 0,
  29827. 3,
  29828. 7,
  29829. 8,
  29830. 0,
  29831. 4,
  29832. 7,
  29833. 8,
  29834. 0,
  29835. 0,
  29836. 0,
  29837. 0,
  29838. 0,
  29839. 2,
  29840. 6,
  29841. 8,
  29842. 0,
  29843. 3,
  29844. 7,
  29845. 8,
  29846. 0,
  29847. 4,
  29848. 7,
  29849. 8,
  29850. 0,
  29851. 0,
  29852. 0,
  29853. 0,
  29854. 0,
  29855. 2,
  29856. 6,
  29857. 8,
  29858. 0,
  29859. 3,
  29860. 7,
  29861. 8,
  29862. 0,
  29863. 4,
  29864. 7,
  29865. 8,
  29866. 0,
  29867. 0,
  29868. 0,
  29869. 0,
  29870. 0,
  29871. 2,
  29872. 6,
  29873. 8,
  29874. 0,
  29875. 3,
  29876. 7,
  29877. 8,
  29878. 0,
  29879. 4,
  29880. 7,
  29881. 8
  29882. ]);
  29883. var HLContextLabel = new Uint8Array([
  29884. 0,
  29885. 3,
  29886. 4,
  29887. 0,
  29888. 5,
  29889. 7,
  29890. 7,
  29891. 0,
  29892. 8,
  29893. 8,
  29894. 8,
  29895. 0,
  29896. 0,
  29897. 0,
  29898. 0,
  29899. 0,
  29900. 1,
  29901. 3,
  29902. 4,
  29903. 0,
  29904. 6,
  29905. 7,
  29906. 7,
  29907. 0,
  29908. 8,
  29909. 8,
  29910. 8,
  29911. 0,
  29912. 0,
  29913. 0,
  29914. 0,
  29915. 0,
  29916. 2,
  29917. 3,
  29918. 4,
  29919. 0,
  29920. 6,
  29921. 7,
  29922. 7,
  29923. 0,
  29924. 8,
  29925. 8,
  29926. 8,
  29927. 0,
  29928. 0,
  29929. 0,
  29930. 0,
  29931. 0,
  29932. 2,
  29933. 3,
  29934. 4,
  29935. 0,
  29936. 6,
  29937. 7,
  29938. 7,
  29939. 0,
  29940. 8,
  29941. 8,
  29942. 8,
  29943. 0,
  29944. 0,
  29945. 0,
  29946. 0,
  29947. 0,
  29948. 2,
  29949. 3,
  29950. 4,
  29951. 0,
  29952. 6,
  29953. 7,
  29954. 7,
  29955. 0,
  29956. 8,
  29957. 8,
  29958. 8
  29959. ]);
  29960. var HHContextLabel = new Uint8Array([
  29961. 0,
  29962. 1,
  29963. 2,
  29964. 0,
  29965. 1,
  29966. 2,
  29967. 2,
  29968. 0,
  29969. 2,
  29970. 2,
  29971. 2,
  29972. 0,
  29973. 0,
  29974. 0,
  29975. 0,
  29976. 0,
  29977. 3,
  29978. 4,
  29979. 5,
  29980. 0,
  29981. 4,
  29982. 5,
  29983. 5,
  29984. 0,
  29985. 5,
  29986. 5,
  29987. 5,
  29988. 0,
  29989. 0,
  29990. 0,
  29991. 0,
  29992. 0,
  29993. 6,
  29994. 7,
  29995. 7,
  29996. 0,
  29997. 7,
  29998. 7,
  29999. 7,
  30000. 0,
  30001. 7,
  30002. 7,
  30003. 7,
  30004. 0,
  30005. 0,
  30006. 0,
  30007. 0,
  30008. 0,
  30009. 8,
  30010. 8,
  30011. 8,
  30012. 0,
  30013. 8,
  30014. 8,
  30015. 8,
  30016. 0,
  30017. 8,
  30018. 8,
  30019. 8,
  30020. 0,
  30021. 0,
  30022. 0,
  30023. 0,
  30024. 0,
  30025. 8,
  30026. 8,
  30027. 8,
  30028. 0,
  30029. 8,
  30030. 8,
  30031. 8,
  30032. 0,
  30033. 8,
  30034. 8,
  30035. 8
  30036. ]);
  30037. function BitModel(width, height, subband, zeroBitPlanes, mb) {
  30038. this.width = width;
  30039. this.height = height;
  30040. this.contextLabelTable = subband === 'HH' ? HHContextLabel : subband === 'HL' ? HLContextLabel : LLAndLHContextsLabel;
  30041. var coefficientCount = width * height;
  30042. this.neighborsSignificance = new Uint8Array(coefficientCount);
  30043. this.coefficentsSign = new Uint8Array(coefficientCount);
  30044. this.coefficentsMagnitude = mb > 14 ? new Uint32Array(coefficientCount) : mb > 6 ? new Uint16Array(coefficientCount) : new Uint8Array(coefficientCount);
  30045. this.processingFlags = new Uint8Array(coefficientCount);
  30046. var bitsDecoded = new Uint8Array(coefficientCount);
  30047. if (zeroBitPlanes !== 0) {
  30048. for (var i = 0; i < coefficientCount; i++) {
  30049. bitsDecoded[i] = zeroBitPlanes;
  30050. }
  30051. }
  30052. this.bitsDecoded = bitsDecoded;
  30053. this.reset();
  30054. }
  30055. BitModel.prototype = {
  30056. setDecoder: function BitModel_setDecoder(decoder) {
  30057. this.decoder = decoder;
  30058. },
  30059. reset: function BitModel_reset() {
  30060. this.contexts = new Int8Array(19);
  30061. this.contexts[0] = 4 << 1 | 0;
  30062. this.contexts[UNIFORM_CONTEXT] = 46 << 1 | 0;
  30063. this.contexts[RUNLENGTH_CONTEXT] = 3 << 1 | 0;
  30064. },
  30065. setNeighborsSignificance: function BitModel_setNeighborsSignificance(row, column, index) {
  30066. var neighborsSignificance = this.neighborsSignificance;
  30067. var width = this.width, height = this.height;
  30068. var left = column > 0;
  30069. var right = column + 1 < width;
  30070. var i;
  30071. if (row > 0) {
  30072. i = index - width;
  30073. if (left) {
  30074. neighborsSignificance[i - 1] += 0x10;
  30075. }
  30076. if (right) {
  30077. neighborsSignificance[i + 1] += 0x10;
  30078. }
  30079. neighborsSignificance[i] += 0x04;
  30080. }
  30081. if (row + 1 < height) {
  30082. i = index + width;
  30083. if (left) {
  30084. neighborsSignificance[i - 1] += 0x10;
  30085. }
  30086. if (right) {
  30087. neighborsSignificance[i + 1] += 0x10;
  30088. }
  30089. neighborsSignificance[i] += 0x04;
  30090. }
  30091. if (left) {
  30092. neighborsSignificance[index - 1] += 0x01;
  30093. }
  30094. if (right) {
  30095. neighborsSignificance[index + 1] += 0x01;
  30096. }
  30097. neighborsSignificance[index] |= 0x80;
  30098. },
  30099. runSignificancePropagationPass: function BitModel_runSignificancePropagationPass() {
  30100. var decoder = this.decoder;
  30101. var width = this.width, height = this.height;
  30102. var coefficentsMagnitude = this.coefficentsMagnitude;
  30103. var coefficentsSign = this.coefficentsSign;
  30104. var neighborsSignificance = this.neighborsSignificance;
  30105. var processingFlags = this.processingFlags;
  30106. var contexts = this.contexts;
  30107. var labels = this.contextLabelTable;
  30108. var bitsDecoded = this.bitsDecoded;
  30109. var processedInverseMask = ~1;
  30110. var processedMask = 1;
  30111. var firstMagnitudeBitMask = 2;
  30112. for (var i0 = 0; i0 < height; i0 += 4) {
  30113. for (var j = 0; j < width; j++) {
  30114. var index = i0 * width + j;
  30115. for (var i1 = 0; i1 < 4; i1++, index += width) {
  30116. var i = i0 + i1;
  30117. if (i >= height) {
  30118. break;
  30119. }
  30120. processingFlags[index] &= processedInverseMask;
  30121. if (coefficentsMagnitude[index] || !neighborsSignificance[index]) {
  30122. continue;
  30123. }
  30124. var contextLabel = labels[neighborsSignificance[index]];
  30125. var decision = decoder.readBit(contexts, contextLabel);
  30126. if (decision) {
  30127. var sign = this.decodeSignBit(i, j, index);
  30128. coefficentsSign[index] = sign;
  30129. coefficentsMagnitude[index] = 1;
  30130. this.setNeighborsSignificance(i, j, index);
  30131. processingFlags[index] |= firstMagnitudeBitMask;
  30132. }
  30133. bitsDecoded[index]++;
  30134. processingFlags[index] |= processedMask;
  30135. }
  30136. }
  30137. }
  30138. },
  30139. decodeSignBit: function BitModel_decodeSignBit(row, column, index) {
  30140. var width = this.width, height = this.height;
  30141. var coefficentsMagnitude = this.coefficentsMagnitude;
  30142. var coefficentsSign = this.coefficentsSign;
  30143. var contribution, sign0, sign1, significance1;
  30144. var contextLabel, decoded;
  30145. significance1 = column > 0 && coefficentsMagnitude[index - 1] !== 0;
  30146. if (column + 1 < width && coefficentsMagnitude[index + 1] !== 0) {
  30147. sign1 = coefficentsSign[index + 1];
  30148. if (significance1) {
  30149. sign0 = coefficentsSign[index - 1];
  30150. contribution = 1 - sign1 - sign0;
  30151. } else {
  30152. contribution = 1 - sign1 - sign1;
  30153. }
  30154. } else if (significance1) {
  30155. sign0 = coefficentsSign[index - 1];
  30156. contribution = 1 - sign0 - sign0;
  30157. } else {
  30158. contribution = 0;
  30159. }
  30160. var horizontalContribution = 3 * contribution;
  30161. significance1 = row > 0 && coefficentsMagnitude[index - width] !== 0;
  30162. if (row + 1 < height && coefficentsMagnitude[index + width] !== 0) {
  30163. sign1 = coefficentsSign[index + width];
  30164. if (significance1) {
  30165. sign0 = coefficentsSign[index - width];
  30166. contribution = 1 - sign1 - sign0 + horizontalContribution;
  30167. } else {
  30168. contribution = 1 - sign1 - sign1 + horizontalContribution;
  30169. }
  30170. } else if (significance1) {
  30171. sign0 = coefficentsSign[index - width];
  30172. contribution = 1 - sign0 - sign0 + horizontalContribution;
  30173. } else {
  30174. contribution = horizontalContribution;
  30175. }
  30176. if (contribution >= 0) {
  30177. contextLabel = 9 + contribution;
  30178. decoded = this.decoder.readBit(this.contexts, contextLabel);
  30179. } else {
  30180. contextLabel = 9 - contribution;
  30181. decoded = this.decoder.readBit(this.contexts, contextLabel) ^ 1;
  30182. }
  30183. return decoded;
  30184. },
  30185. runMagnitudeRefinementPass: function BitModel_runMagnitudeRefinementPass() {
  30186. var decoder = this.decoder;
  30187. var width = this.width, height = this.height;
  30188. var coefficentsMagnitude = this.coefficentsMagnitude;
  30189. var neighborsSignificance = this.neighborsSignificance;
  30190. var contexts = this.contexts;
  30191. var bitsDecoded = this.bitsDecoded;
  30192. var processingFlags = this.processingFlags;
  30193. var processedMask = 1;
  30194. var firstMagnitudeBitMask = 2;
  30195. var length = width * height;
  30196. var width4 = width * 4;
  30197. for (var index0 = 0, indexNext; index0 < length; index0 = indexNext) {
  30198. indexNext = Math.min(length, index0 + width4);
  30199. for (var j = 0; j < width; j++) {
  30200. for (var index = index0 + j; index < indexNext; index += width) {
  30201. if (!coefficentsMagnitude[index] || (processingFlags[index] & processedMask) !== 0) {
  30202. continue;
  30203. }
  30204. var contextLabel = 16;
  30205. if ((processingFlags[index] & firstMagnitudeBitMask) !== 0) {
  30206. processingFlags[index] ^= firstMagnitudeBitMask;
  30207. var significance = neighborsSignificance[index] & 127;
  30208. contextLabel = significance === 0 ? 15 : 14;
  30209. }
  30210. var bit = decoder.readBit(contexts, contextLabel);
  30211. coefficentsMagnitude[index] = coefficentsMagnitude[index] << 1 | bit;
  30212. bitsDecoded[index]++;
  30213. processingFlags[index] |= processedMask;
  30214. }
  30215. }
  30216. }
  30217. },
  30218. runCleanupPass: function BitModel_runCleanupPass() {
  30219. var decoder = this.decoder;
  30220. var width = this.width, height = this.height;
  30221. var neighborsSignificance = this.neighborsSignificance;
  30222. var coefficentsMagnitude = this.coefficentsMagnitude;
  30223. var coefficentsSign = this.coefficentsSign;
  30224. var contexts = this.contexts;
  30225. var labels = this.contextLabelTable;
  30226. var bitsDecoded = this.bitsDecoded;
  30227. var processingFlags = this.processingFlags;
  30228. var processedMask = 1;
  30229. var firstMagnitudeBitMask = 2;
  30230. var oneRowDown = width;
  30231. var twoRowsDown = width * 2;
  30232. var threeRowsDown = width * 3;
  30233. var iNext;
  30234. for (var i0 = 0; i0 < height; i0 = iNext) {
  30235. iNext = Math.min(i0 + 4, height);
  30236. var indexBase = i0 * width;
  30237. var checkAllEmpty = i0 + 3 < height;
  30238. for (var j = 0; j < width; j++) {
  30239. var index0 = indexBase + j;
  30240. 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;
  30241. var i1 = 0, index = index0;
  30242. var i = i0, sign;
  30243. if (allEmpty) {
  30244. var hasSignificantCoefficent = decoder.readBit(contexts, RUNLENGTH_CONTEXT);
  30245. if (!hasSignificantCoefficent) {
  30246. bitsDecoded[index0]++;
  30247. bitsDecoded[index0 + oneRowDown]++;
  30248. bitsDecoded[index0 + twoRowsDown]++;
  30249. bitsDecoded[index0 + threeRowsDown]++;
  30250. continue;
  30251. }
  30252. i1 = decoder.readBit(contexts, UNIFORM_CONTEXT) << 1 | decoder.readBit(contexts, UNIFORM_CONTEXT);
  30253. if (i1 !== 0) {
  30254. i = i0 + i1;
  30255. index += i1 * width;
  30256. }
  30257. sign = this.decodeSignBit(i, j, index);
  30258. coefficentsSign[index] = sign;
  30259. coefficentsMagnitude[index] = 1;
  30260. this.setNeighborsSignificance(i, j, index);
  30261. processingFlags[index] |= firstMagnitudeBitMask;
  30262. index = index0;
  30263. for (var i2 = i0; i2 <= i; i2++, index += width) {
  30264. bitsDecoded[index]++;
  30265. }
  30266. i1++;
  30267. }
  30268. for (i = i0 + i1; i < iNext; i++, index += width) {
  30269. if (coefficentsMagnitude[index] || (processingFlags[index] & processedMask) !== 0) {
  30270. continue;
  30271. }
  30272. var contextLabel = labels[neighborsSignificance[index]];
  30273. var decision = decoder.readBit(contexts, contextLabel);
  30274. if (decision === 1) {
  30275. sign = this.decodeSignBit(i, j, index);
  30276. coefficentsSign[index] = sign;
  30277. coefficentsMagnitude[index] = 1;
  30278. this.setNeighborsSignificance(i, j, index);
  30279. processingFlags[index] |= firstMagnitudeBitMask;
  30280. }
  30281. bitsDecoded[index]++;
  30282. }
  30283. }
  30284. }
  30285. },
  30286. checkSegmentationSymbol: function BitModel_checkSegmentationSymbol() {
  30287. var decoder = this.decoder;
  30288. var contexts = this.contexts;
  30289. 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);
  30290. if (symbol !== 0xA) {
  30291. error('JPX Error: Invalid segmentation symbol');
  30292. }
  30293. }
  30294. };
  30295. return BitModel;
  30296. }();
  30297. var Transform = function TransformClosure() {
  30298. function Transform() {
  30299. }
  30300. Transform.prototype.calculate = function transformCalculate(subbands, u0, v0) {
  30301. var ll = subbands[0];
  30302. for (var i = 1, ii = subbands.length; i < ii; i++) {
  30303. ll = this.iterate(ll, subbands[i], u0, v0);
  30304. }
  30305. return ll;
  30306. };
  30307. Transform.prototype.extend = function extend(buffer, offset, size) {
  30308. var i1 = offset - 1, j1 = offset + 1;
  30309. var i2 = offset + size - 2, j2 = offset + size;
  30310. buffer[i1--] = buffer[j1++];
  30311. buffer[j2++] = buffer[i2--];
  30312. buffer[i1--] = buffer[j1++];
  30313. buffer[j2++] = buffer[i2--];
  30314. buffer[i1--] = buffer[j1++];
  30315. buffer[j2++] = buffer[i2--];
  30316. buffer[i1] = buffer[j1];
  30317. buffer[j2] = buffer[i2];
  30318. };
  30319. Transform.prototype.iterate = function Transform_iterate(ll, hl_lh_hh, u0, v0) {
  30320. var llWidth = ll.width, llHeight = ll.height, llItems = ll.items;
  30321. var width = hl_lh_hh.width;
  30322. var height = hl_lh_hh.height;
  30323. var items = hl_lh_hh.items;
  30324. var i, j, k, l, u, v;
  30325. for (k = 0, i = 0; i < llHeight; i++) {
  30326. l = i * 2 * width;
  30327. for (j = 0; j < llWidth; j++, k++, l += 2) {
  30328. items[l] = llItems[k];
  30329. }
  30330. }
  30331. llItems = ll.items = null;
  30332. var bufferPadding = 4;
  30333. var rowBuffer = new Float32Array(width + 2 * bufferPadding);
  30334. if (width === 1) {
  30335. if ((u0 & 1) !== 0) {
  30336. for (v = 0, k = 0; v < height; v++, k += width) {
  30337. items[k] *= 0.5;
  30338. }
  30339. }
  30340. } else {
  30341. for (v = 0, k = 0; v < height; v++, k += width) {
  30342. rowBuffer.set(items.subarray(k, k + width), bufferPadding);
  30343. this.extend(rowBuffer, bufferPadding, width);
  30344. this.filter(rowBuffer, bufferPadding, width);
  30345. items.set(rowBuffer.subarray(bufferPadding, bufferPadding + width), k);
  30346. }
  30347. }
  30348. var numBuffers = 16;
  30349. var colBuffers = [];
  30350. for (i = 0; i < numBuffers; i++) {
  30351. colBuffers.push(new Float32Array(height + 2 * bufferPadding));
  30352. }
  30353. var b, currentBuffer = 0;
  30354. ll = bufferPadding + height;
  30355. if (height === 1) {
  30356. if ((v0 & 1) !== 0) {
  30357. for (u = 0; u < width; u++) {
  30358. items[u] *= 0.5;
  30359. }
  30360. }
  30361. } else {
  30362. for (u = 0; u < width; u++) {
  30363. if (currentBuffer === 0) {
  30364. numBuffers = Math.min(width - u, numBuffers);
  30365. for (k = u, l = bufferPadding; l < ll; k += width, l++) {
  30366. for (b = 0; b < numBuffers; b++) {
  30367. colBuffers[b][l] = items[k + b];
  30368. }
  30369. }
  30370. currentBuffer = numBuffers;
  30371. }
  30372. currentBuffer--;
  30373. var buffer = colBuffers[currentBuffer];
  30374. this.extend(buffer, bufferPadding, height);
  30375. this.filter(buffer, bufferPadding, height);
  30376. if (currentBuffer === 0) {
  30377. k = u - numBuffers + 1;
  30378. for (l = bufferPadding; l < ll; k += width, l++) {
  30379. for (b = 0; b < numBuffers; b++) {
  30380. items[k + b] = colBuffers[b][l];
  30381. }
  30382. }
  30383. }
  30384. }
  30385. }
  30386. return {
  30387. width: width,
  30388. height: height,
  30389. items: items
  30390. };
  30391. };
  30392. return Transform;
  30393. }();
  30394. var IrreversibleTransform = function IrreversibleTransformClosure() {
  30395. function IrreversibleTransform() {
  30396. Transform.call(this);
  30397. }
  30398. IrreversibleTransform.prototype = Object.create(Transform.prototype);
  30399. IrreversibleTransform.prototype.filter = function irreversibleTransformFilter(x, offset, length) {
  30400. var len = length >> 1;
  30401. offset = offset | 0;
  30402. var j, n, current, next;
  30403. var alpha = -1.586134342059924;
  30404. var beta = -0.052980118572961;
  30405. var gamma = 0.882911075530934;
  30406. var delta = 0.443506852043971;
  30407. var K = 1.230174104914001;
  30408. var K_ = 1 / K;
  30409. j = offset - 3;
  30410. for (n = len + 4; n--; j += 2) {
  30411. x[j] *= K_;
  30412. }
  30413. j = offset - 2;
  30414. current = delta * x[j - 1];
  30415. for (n = len + 3; n--; j += 2) {
  30416. next = delta * x[j + 1];
  30417. x[j] = K * x[j] - current - next;
  30418. if (n--) {
  30419. j += 2;
  30420. current = delta * x[j + 1];
  30421. x[j] = K * x[j] - current - next;
  30422. } else {
  30423. break;
  30424. }
  30425. }
  30426. j = offset - 1;
  30427. current = gamma * x[j - 1];
  30428. for (n = len + 2; n--; j += 2) {
  30429. next = gamma * x[j + 1];
  30430. x[j] -= current + next;
  30431. if (n--) {
  30432. j += 2;
  30433. current = gamma * x[j + 1];
  30434. x[j] -= current + next;
  30435. } else {
  30436. break;
  30437. }
  30438. }
  30439. j = offset;
  30440. current = beta * x[j - 1];
  30441. for (n = len + 1; n--; j += 2) {
  30442. next = beta * x[j + 1];
  30443. x[j] -= current + next;
  30444. if (n--) {
  30445. j += 2;
  30446. current = beta * x[j + 1];
  30447. x[j] -= current + next;
  30448. } else {
  30449. break;
  30450. }
  30451. }
  30452. if (len !== 0) {
  30453. j = offset + 1;
  30454. current = alpha * x[j - 1];
  30455. for (n = len; n--; j += 2) {
  30456. next = alpha * x[j + 1];
  30457. x[j] -= current + next;
  30458. if (n--) {
  30459. j += 2;
  30460. current = alpha * x[j + 1];
  30461. x[j] -= current + next;
  30462. } else {
  30463. break;
  30464. }
  30465. }
  30466. }
  30467. };
  30468. return IrreversibleTransform;
  30469. }();
  30470. var ReversibleTransform = function ReversibleTransformClosure() {
  30471. function ReversibleTransform() {
  30472. Transform.call(this);
  30473. }
  30474. ReversibleTransform.prototype = Object.create(Transform.prototype);
  30475. ReversibleTransform.prototype.filter = function reversibleTransformFilter(x, offset, length) {
  30476. var len = length >> 1;
  30477. offset = offset | 0;
  30478. var j, n;
  30479. for (j = offset, n = len + 1; n--; j += 2) {
  30480. x[j] -= x[j - 1] + x[j + 1] + 2 >> 2;
  30481. }
  30482. for (j = offset + 1, n = len; n--; j += 2) {
  30483. x[j] += x[j - 1] + x[j + 1] >> 1;
  30484. }
  30485. };
  30486. return ReversibleTransform;
  30487. }();
  30488. return JpxImage;
  30489. }();
  30490. exports.JpxImage = JpxImage;
  30491. /***/ }),
  30492. /* 16 */
  30493. /***/ (function(module, exports, __w_pdfjs_require__) {
  30494. "use strict";
  30495. var sharedUtil = __w_pdfjs_require__(0);
  30496. var corePrimitives = __w_pdfjs_require__(1);
  30497. var coreCrypto = __w_pdfjs_require__(13);
  30498. var coreParser = __w_pdfjs_require__(5);
  30499. var coreChunkedStream = __w_pdfjs_require__(12);
  30500. var coreColorSpace = __w_pdfjs_require__(3);
  30501. var InvalidPDFException = sharedUtil.InvalidPDFException;
  30502. var MissingDataException = sharedUtil.MissingDataException;
  30503. var XRefParseException = sharedUtil.XRefParseException;
  30504. var assert = sharedUtil.assert;
  30505. var bytesToString = sharedUtil.bytesToString;
  30506. var createPromiseCapability = sharedUtil.createPromiseCapability;
  30507. var error = sharedUtil.error;
  30508. var info = sharedUtil.info;
  30509. var isArray = sharedUtil.isArray;
  30510. var isBool = sharedUtil.isBool;
  30511. var isInt = sharedUtil.isInt;
  30512. var isString = sharedUtil.isString;
  30513. var shadow = sharedUtil.shadow;
  30514. var stringToPDFString = sharedUtil.stringToPDFString;
  30515. var stringToUTF8String = sharedUtil.stringToUTF8String;
  30516. var warn = sharedUtil.warn;
  30517. var createValidAbsoluteUrl = sharedUtil.createValidAbsoluteUrl;
  30518. var Util = sharedUtil.Util;
  30519. var Ref = corePrimitives.Ref;
  30520. var RefSet = corePrimitives.RefSet;
  30521. var RefSetCache = corePrimitives.RefSetCache;
  30522. var isName = corePrimitives.isName;
  30523. var isCmd = corePrimitives.isCmd;
  30524. var isDict = corePrimitives.isDict;
  30525. var isRef = corePrimitives.isRef;
  30526. var isRefsEqual = corePrimitives.isRefsEqual;
  30527. var isStream = corePrimitives.isStream;
  30528. var CipherTransformFactory = coreCrypto.CipherTransformFactory;
  30529. var Lexer = coreParser.Lexer;
  30530. var Parser = coreParser.Parser;
  30531. var ChunkedStream = coreChunkedStream.ChunkedStream;
  30532. var ColorSpace = coreColorSpace.ColorSpace;
  30533. var Catalog = function CatalogClosure() {
  30534. function Catalog(pdfManager, xref, pageFactory) {
  30535. this.pdfManager = pdfManager;
  30536. this.xref = xref;
  30537. this.catDict = xref.getCatalogObj();
  30538. this.fontCache = new RefSetCache();
  30539. this.builtInCMapCache = Object.create(null);
  30540. assert(isDict(this.catDict), 'catalog object is not a dictionary');
  30541. this.pageFactory = pageFactory;
  30542. this.pagePromises = [];
  30543. }
  30544. Catalog.prototype = {
  30545. get metadata() {
  30546. var streamRef = this.catDict.getRaw('Metadata');
  30547. if (!isRef(streamRef)) {
  30548. return shadow(this, 'metadata', null);
  30549. }
  30550. var encryptMetadata = !this.xref.encrypt ? false : this.xref.encrypt.encryptMetadata;
  30551. var stream = this.xref.fetch(streamRef, !encryptMetadata);
  30552. var metadata;
  30553. if (stream && isDict(stream.dict)) {
  30554. var type = stream.dict.get('Type');
  30555. var subtype = stream.dict.get('Subtype');
  30556. if (isName(type, 'Metadata') && isName(subtype, 'XML')) {
  30557. try {
  30558. metadata = stringToUTF8String(bytesToString(stream.getBytes()));
  30559. } catch (e) {
  30560. info('Skipping invalid metadata.');
  30561. }
  30562. }
  30563. }
  30564. return shadow(this, 'metadata', metadata);
  30565. },
  30566. get toplevelPagesDict() {
  30567. var pagesObj = this.catDict.get('Pages');
  30568. assert(isDict(pagesObj), 'invalid top-level pages dictionary');
  30569. return shadow(this, 'toplevelPagesDict', pagesObj);
  30570. },
  30571. get documentOutline() {
  30572. var obj = null;
  30573. try {
  30574. obj = this.readDocumentOutline();
  30575. } catch (ex) {
  30576. if (ex instanceof MissingDataException) {
  30577. throw ex;
  30578. }
  30579. warn('Unable to read document outline');
  30580. }
  30581. return shadow(this, 'documentOutline', obj);
  30582. },
  30583. readDocumentOutline: function Catalog_readDocumentOutline() {
  30584. var obj = this.catDict.get('Outlines');
  30585. if (!isDict(obj)) {
  30586. return null;
  30587. }
  30588. obj = obj.getRaw('First');
  30589. if (!isRef(obj)) {
  30590. return null;
  30591. }
  30592. var root = { items: [] };
  30593. var queue = [{
  30594. obj: obj,
  30595. parent: root
  30596. }];
  30597. var processed = new RefSet();
  30598. processed.put(obj);
  30599. var xref = this.xref, blackColor = new Uint8Array(3);
  30600. while (queue.length > 0) {
  30601. var i = queue.shift();
  30602. var outlineDict = xref.fetchIfRef(i.obj);
  30603. if (outlineDict === null) {
  30604. continue;
  30605. }
  30606. assert(outlineDict.has('Title'), 'Invalid outline item');
  30607. var data = {
  30608. url: null,
  30609. dest: null
  30610. };
  30611. Catalog.parseDestDictionary({
  30612. destDict: outlineDict,
  30613. resultObj: data,
  30614. docBaseUrl: this.pdfManager.docBaseUrl
  30615. });
  30616. var title = outlineDict.get('Title');
  30617. var flags = outlineDict.get('F') || 0;
  30618. var color = outlineDict.getArray('C'), rgbColor = blackColor;
  30619. if (isArray(color) && color.length === 3 && (color[0] !== 0 || color[1] !== 0 || color[2] !== 0)) {
  30620. rgbColor = ColorSpace.singletons.rgb.getRgb(color, 0);
  30621. }
  30622. var outlineItem = {
  30623. dest: data.dest,
  30624. url: data.url,
  30625. unsafeUrl: data.unsafeUrl,
  30626. newWindow: data.newWindow,
  30627. title: stringToPDFString(title),
  30628. color: rgbColor,
  30629. count: outlineDict.get('Count'),
  30630. bold: !!(flags & 2),
  30631. italic: !!(flags & 1),
  30632. items: []
  30633. };
  30634. i.parent.items.push(outlineItem);
  30635. obj = outlineDict.getRaw('First');
  30636. if (isRef(obj) && !processed.has(obj)) {
  30637. queue.push({
  30638. obj: obj,
  30639. parent: outlineItem
  30640. });
  30641. processed.put(obj);
  30642. }
  30643. obj = outlineDict.getRaw('Next');
  30644. if (isRef(obj) && !processed.has(obj)) {
  30645. queue.push({
  30646. obj: obj,
  30647. parent: i.parent
  30648. });
  30649. processed.put(obj);
  30650. }
  30651. }
  30652. return root.items.length > 0 ? root.items : null;
  30653. },
  30654. get numPages() {
  30655. var obj = this.toplevelPagesDict.get('Count');
  30656. assert(isInt(obj), 'page count in top level pages object is not an integer');
  30657. return shadow(this, 'num', obj);
  30658. },
  30659. get destinations() {
  30660. function fetchDestination(dest) {
  30661. return isDict(dest) ? dest.get('D') : dest;
  30662. }
  30663. var xref = this.xref;
  30664. var dests = {}, nameTreeRef, nameDictionaryRef;
  30665. var obj = this.catDict.get('Names');
  30666. if (obj && obj.has('Dests')) {
  30667. nameTreeRef = obj.getRaw('Dests');
  30668. } else if (this.catDict.has('Dests')) {
  30669. nameDictionaryRef = this.catDict.get('Dests');
  30670. }
  30671. if (nameDictionaryRef) {
  30672. obj = nameDictionaryRef;
  30673. obj.forEach(function catalogForEach(key, value) {
  30674. if (!value) {
  30675. return;
  30676. }
  30677. dests[key] = fetchDestination(value);
  30678. });
  30679. }
  30680. if (nameTreeRef) {
  30681. var nameTree = new NameTree(nameTreeRef, xref);
  30682. var names = nameTree.getAll();
  30683. for (var name in names) {
  30684. dests[name] = fetchDestination(names[name]);
  30685. }
  30686. }
  30687. return shadow(this, 'destinations', dests);
  30688. },
  30689. getDestination: function Catalog_getDestination(destinationId) {
  30690. function fetchDestination(dest) {
  30691. return isDict(dest) ? dest.get('D') : dest;
  30692. }
  30693. var xref = this.xref;
  30694. var dest = null, nameTreeRef, nameDictionaryRef;
  30695. var obj = this.catDict.get('Names');
  30696. if (obj && obj.has('Dests')) {
  30697. nameTreeRef = obj.getRaw('Dests');
  30698. } else if (this.catDict.has('Dests')) {
  30699. nameDictionaryRef = this.catDict.get('Dests');
  30700. }
  30701. if (nameDictionaryRef) {
  30702. var value = nameDictionaryRef.get(destinationId);
  30703. if (value) {
  30704. dest = fetchDestination(value);
  30705. }
  30706. }
  30707. if (nameTreeRef) {
  30708. var nameTree = new NameTree(nameTreeRef, xref);
  30709. dest = fetchDestination(nameTree.get(destinationId));
  30710. }
  30711. return dest;
  30712. },
  30713. get pageLabels() {
  30714. var obj = null;
  30715. try {
  30716. obj = this.readPageLabels();
  30717. } catch (ex) {
  30718. if (ex instanceof MissingDataException) {
  30719. throw ex;
  30720. }
  30721. warn('Unable to read page labels.');
  30722. }
  30723. return shadow(this, 'pageLabels', obj);
  30724. },
  30725. readPageLabels: function Catalog_readPageLabels() {
  30726. var obj = this.catDict.getRaw('PageLabels');
  30727. if (!obj) {
  30728. return null;
  30729. }
  30730. var pageLabels = new Array(this.numPages);
  30731. var style = null;
  30732. var prefix = '';
  30733. var numberTree = new NumberTree(obj, this.xref);
  30734. var nums = numberTree.getAll();
  30735. var currentLabel = '', currentIndex = 1;
  30736. for (var i = 0, ii = this.numPages; i < ii; i++) {
  30737. if (i in nums) {
  30738. var labelDict = nums[i];
  30739. assert(isDict(labelDict), 'The PageLabel is not a dictionary.');
  30740. var type = labelDict.get('Type');
  30741. assert(!type || isName(type, 'PageLabel'), 'Invalid type in PageLabel dictionary.');
  30742. var s = labelDict.get('S');
  30743. assert(!s || isName(s), 'Invalid style in PageLabel dictionary.');
  30744. style = s ? s.name : null;
  30745. var p = labelDict.get('P');
  30746. assert(!p || isString(p), 'Invalid prefix in PageLabel dictionary.');
  30747. prefix = p ? stringToPDFString(p) : '';
  30748. var st = labelDict.get('St');
  30749. assert(!st || isInt(st) && st >= 1, 'Invalid start in PageLabel dictionary.');
  30750. currentIndex = st || 1;
  30751. }
  30752. switch (style) {
  30753. case 'D':
  30754. currentLabel = currentIndex;
  30755. break;
  30756. case 'R':
  30757. case 'r':
  30758. currentLabel = Util.toRoman(currentIndex, style === 'r');
  30759. break;
  30760. case 'A':
  30761. case 'a':
  30762. var LIMIT = 26;
  30763. var A_UPPER_CASE = 0x41, A_LOWER_CASE = 0x61;
  30764. var baseCharCode = style === 'a' ? A_LOWER_CASE : A_UPPER_CASE;
  30765. var letterIndex = currentIndex - 1;
  30766. var character = String.fromCharCode(baseCharCode + letterIndex % LIMIT);
  30767. var charBuf = [];
  30768. for (var j = 0, jj = letterIndex / LIMIT | 0; j <= jj; j++) {
  30769. charBuf.push(character);
  30770. }
  30771. currentLabel = charBuf.join('');
  30772. break;
  30773. default:
  30774. assert(!style, 'Invalid style "' + style + '" in PageLabel dictionary.');
  30775. }
  30776. pageLabels[i] = prefix + currentLabel;
  30777. currentLabel = '';
  30778. currentIndex++;
  30779. }
  30780. return pageLabels;
  30781. },
  30782. get attachments() {
  30783. var xref = this.xref;
  30784. var attachments = null, nameTreeRef;
  30785. var obj = this.catDict.get('Names');
  30786. if (obj) {
  30787. nameTreeRef = obj.getRaw('EmbeddedFiles');
  30788. }
  30789. if (nameTreeRef) {
  30790. var nameTree = new NameTree(nameTreeRef, xref);
  30791. var names = nameTree.getAll();
  30792. for (var name in names) {
  30793. var fs = new FileSpec(names[name], xref);
  30794. if (!attachments) {
  30795. attachments = Object.create(null);
  30796. }
  30797. attachments[stringToPDFString(name)] = fs.serializable;
  30798. }
  30799. }
  30800. return shadow(this, 'attachments', attachments);
  30801. },
  30802. get javaScript() {
  30803. var xref = this.xref;
  30804. var obj = this.catDict.get('Names');
  30805. var javaScript = [];
  30806. function appendIfJavaScriptDict(jsDict) {
  30807. var type = jsDict.get('S');
  30808. if (!isName(type, 'JavaScript')) {
  30809. return;
  30810. }
  30811. var js = jsDict.get('JS');
  30812. if (isStream(js)) {
  30813. js = bytesToString(js.getBytes());
  30814. } else if (!isString(js)) {
  30815. return;
  30816. }
  30817. javaScript.push(stringToPDFString(js));
  30818. }
  30819. if (obj && obj.has('JavaScript')) {
  30820. var nameTree = new NameTree(obj.getRaw('JavaScript'), xref);
  30821. var names = nameTree.getAll();
  30822. for (var name in names) {
  30823. var jsDict = names[name];
  30824. if (isDict(jsDict)) {
  30825. appendIfJavaScriptDict(jsDict);
  30826. }
  30827. }
  30828. }
  30829. var openactionDict = this.catDict.get('OpenAction');
  30830. if (isDict(openactionDict, 'Action')) {
  30831. var actionType = openactionDict.get('S');
  30832. if (isName(actionType, 'Named')) {
  30833. var action = openactionDict.get('N');
  30834. if (isName(action, 'Print')) {
  30835. javaScript.push('print({});');
  30836. }
  30837. } else {
  30838. appendIfJavaScriptDict(openactionDict);
  30839. }
  30840. }
  30841. return shadow(this, 'javaScript', javaScript);
  30842. },
  30843. cleanup: function Catalog_cleanup() {
  30844. var promises = [];
  30845. this.fontCache.forEach(function (promise) {
  30846. promises.push(promise);
  30847. });
  30848. return Promise.all(promises).then(function (translatedFonts) {
  30849. for (var i = 0, ii = translatedFonts.length; i < ii; i++) {
  30850. var font = translatedFonts[i].dict;
  30851. delete font.translated;
  30852. }
  30853. this.fontCache.clear();
  30854. this.builtInCMapCache = Object.create(null);
  30855. }.bind(this));
  30856. },
  30857. getPage: function Catalog_getPage(pageIndex) {
  30858. if (!(pageIndex in this.pagePromises)) {
  30859. this.pagePromises[pageIndex] = this.getPageDict(pageIndex).then(function (a) {
  30860. var dict = a[0];
  30861. var ref = a[1];
  30862. return this.pageFactory.createPage(pageIndex, dict, ref, this.fontCache, this.builtInCMapCache);
  30863. }.bind(this));
  30864. }
  30865. return this.pagePromises[pageIndex];
  30866. },
  30867. getPageDict: function Catalog_getPageDict(pageIndex) {
  30868. var capability = createPromiseCapability();
  30869. var nodesToVisit = [this.catDict.getRaw('Pages')];
  30870. var currentPageIndex = 0;
  30871. var xref = this.xref;
  30872. function next() {
  30873. while (nodesToVisit.length) {
  30874. var currentNode = nodesToVisit.pop();
  30875. if (isRef(currentNode)) {
  30876. xref.fetchAsync(currentNode).then(function (obj) {
  30877. if (isDict(obj, 'Page') || isDict(obj) && !obj.has('Kids')) {
  30878. if (pageIndex === currentPageIndex) {
  30879. capability.resolve([
  30880. obj,
  30881. currentNode
  30882. ]);
  30883. } else {
  30884. currentPageIndex++;
  30885. next();
  30886. }
  30887. return;
  30888. }
  30889. nodesToVisit.push(obj);
  30890. next();
  30891. }, capability.reject);
  30892. return;
  30893. }
  30894. assert(isDict(currentNode), 'page dictionary kid reference points to wrong type of object');
  30895. var count = currentNode.get('Count');
  30896. if (currentPageIndex + count <= pageIndex) {
  30897. currentPageIndex += count;
  30898. continue;
  30899. }
  30900. var kids = currentNode.get('Kids');
  30901. assert(isArray(kids), 'page dictionary kids object is not an array');
  30902. for (var last = kids.length - 1; last >= 0; last--) {
  30903. nodesToVisit.push(kids[last]);
  30904. }
  30905. }
  30906. capability.reject('Page index ' + pageIndex + ' not found.');
  30907. }
  30908. next();
  30909. return capability.promise;
  30910. },
  30911. getPageIndex: function Catalog_getPageIndex(pageRef) {
  30912. var xref = this.xref;
  30913. function pagesBeforeRef(kidRef) {
  30914. var total = 0;
  30915. var parentRef;
  30916. return xref.fetchAsync(kidRef).then(function (node) {
  30917. if (isRefsEqual(kidRef, pageRef) && !isDict(node, 'Page') && !(isDict(node) && !node.has('Type') && node.has('Contents'))) {
  30918. throw new Error('The reference does not point to a /Page Dict.');
  30919. }
  30920. if (!node) {
  30921. return null;
  30922. }
  30923. assert(isDict(node), 'node must be a Dict.');
  30924. parentRef = node.getRaw('Parent');
  30925. return node.getAsync('Parent');
  30926. }).then(function (parent) {
  30927. if (!parent) {
  30928. return null;
  30929. }
  30930. assert(isDict(parent), 'parent must be a Dict.');
  30931. return parent.getAsync('Kids');
  30932. }).then(function (kids) {
  30933. if (!kids) {
  30934. return null;
  30935. }
  30936. var kidPromises = [];
  30937. var found = false;
  30938. for (var i = 0; i < kids.length; i++) {
  30939. var kid = kids[i];
  30940. assert(isRef(kid), 'kid must be a Ref.');
  30941. if (kid.num === kidRef.num) {
  30942. found = true;
  30943. break;
  30944. }
  30945. kidPromises.push(xref.fetchAsync(kid).then(function (kid) {
  30946. if (kid.has('Count')) {
  30947. var count = kid.get('Count');
  30948. total += count;
  30949. } else {
  30950. total++;
  30951. }
  30952. }));
  30953. }
  30954. if (!found) {
  30955. error('kid ref not found in parents kids');
  30956. }
  30957. return Promise.all(kidPromises).then(function () {
  30958. return [
  30959. total,
  30960. parentRef
  30961. ];
  30962. });
  30963. });
  30964. }
  30965. var total = 0;
  30966. function next(ref) {
  30967. return pagesBeforeRef(ref).then(function (args) {
  30968. if (!args) {
  30969. return total;
  30970. }
  30971. var count = args[0];
  30972. var parentRef = args[1];
  30973. total += count;
  30974. return next(parentRef);
  30975. });
  30976. }
  30977. return next(pageRef);
  30978. }
  30979. };
  30980. Catalog.parseDestDictionary = function Catalog_parseDestDictionary(params) {
  30981. function addDefaultProtocolToUrl(url) {
  30982. if (url.indexOf('www.') === 0) {
  30983. return 'http://' + url;
  30984. }
  30985. return url;
  30986. }
  30987. function tryConvertUrlEncoding(url) {
  30988. try {
  30989. return stringToUTF8String(url);
  30990. } catch (e) {
  30991. return url;
  30992. }
  30993. }
  30994. var destDict = params.destDict;
  30995. if (!isDict(destDict)) {
  30996. warn('Catalog_parseDestDictionary: "destDict" must be a dictionary.');
  30997. return;
  30998. }
  30999. var resultObj = params.resultObj;
  31000. if (typeof resultObj !== 'object') {
  31001. warn('Catalog_parseDestDictionary: "resultObj" must be an object.');
  31002. return;
  31003. }
  31004. var docBaseUrl = params.docBaseUrl || null;
  31005. var action = destDict.get('A'), url, dest;
  31006. if (isDict(action)) {
  31007. var linkType = action.get('S').name;
  31008. switch (linkType) {
  31009. case 'URI':
  31010. url = action.get('URI');
  31011. if (isName(url)) {
  31012. url = '/' + url.name;
  31013. } else if (isString(url)) {
  31014. url = addDefaultProtocolToUrl(url);
  31015. }
  31016. break;
  31017. case 'GoTo':
  31018. dest = action.get('D');
  31019. break;
  31020. case 'Launch':
  31021. case 'GoToR':
  31022. var urlDict = action.get('F');
  31023. if (isDict(urlDict)) {
  31024. url = urlDict.get('F') || null;
  31025. } else if (isString(urlDict)) {
  31026. url = urlDict;
  31027. }
  31028. var remoteDest = action.get('D');
  31029. if (remoteDest) {
  31030. if (isName(remoteDest)) {
  31031. remoteDest = remoteDest.name;
  31032. }
  31033. if (isString(url)) {
  31034. var baseUrl = url.split('#')[0];
  31035. if (isString(remoteDest)) {
  31036. url = baseUrl + '#' + (/^\d+$/.test(remoteDest) ? 'nameddest=' : '') + remoteDest;
  31037. } else if (isArray(remoteDest)) {
  31038. url = baseUrl + '#' + JSON.stringify(remoteDest);
  31039. }
  31040. }
  31041. }
  31042. var newWindow = action.get('NewWindow');
  31043. if (isBool(newWindow)) {
  31044. resultObj.newWindow = newWindow;
  31045. }
  31046. break;
  31047. case 'Named':
  31048. var namedAction = action.get('N');
  31049. if (isName(namedAction)) {
  31050. resultObj.action = namedAction.name;
  31051. }
  31052. break;
  31053. case 'JavaScript':
  31054. var jsAction = action.get('JS'), js;
  31055. if (isStream(jsAction)) {
  31056. js = bytesToString(jsAction.getBytes());
  31057. } else if (isString(jsAction)) {
  31058. js = jsAction;
  31059. }
  31060. if (js) {
  31061. var URL_OPEN_METHODS = [
  31062. 'app.launchURL',
  31063. 'window.open'
  31064. ];
  31065. var regex = new RegExp('^\\s*(' + URL_OPEN_METHODS.join('|').split('.').join('\\.') + ')\\((?:\'|\")([^\'\"]*)(?:\'|\")(?:,\\s*(\\w+)\\)|\\))', 'i');
  31066. var jsUrl = regex.exec(stringToPDFString(js));
  31067. if (jsUrl && jsUrl[2]) {
  31068. url = jsUrl[2];
  31069. if (jsUrl[3] === 'true' && jsUrl[1] === 'app.launchURL') {
  31070. resultObj.newWindow = true;
  31071. }
  31072. break;
  31073. }
  31074. }
  31075. default:
  31076. warn('Catalog_parseDestDictionary: Unrecognized link type "' + linkType + '".');
  31077. break;
  31078. }
  31079. } else if (destDict.has('Dest')) {
  31080. dest = destDict.get('Dest');
  31081. }
  31082. if (isString(url)) {
  31083. url = tryConvertUrlEncoding(url);
  31084. var absoluteUrl = createValidAbsoluteUrl(url, docBaseUrl);
  31085. if (absoluteUrl) {
  31086. resultObj.url = absoluteUrl.href;
  31087. }
  31088. resultObj.unsafeUrl = url;
  31089. }
  31090. if (dest) {
  31091. if (isName(dest)) {
  31092. dest = dest.name;
  31093. }
  31094. if (isString(dest) || isArray(dest)) {
  31095. resultObj.dest = dest;
  31096. }
  31097. }
  31098. };
  31099. return Catalog;
  31100. }();
  31101. var XRef = function XRefClosure() {
  31102. function XRef(stream, pdfManager) {
  31103. this.stream = stream;
  31104. this.pdfManager = pdfManager;
  31105. this.entries = [];
  31106. this.xrefstms = Object.create(null);
  31107. this.cache = [];
  31108. this.stats = {
  31109. streamTypes: [],
  31110. fontTypes: []
  31111. };
  31112. }
  31113. XRef.prototype = {
  31114. setStartXRef: function XRef_setStartXRef(startXRef) {
  31115. this.startXRefQueue = [startXRef];
  31116. },
  31117. parse: function XRef_parse(recoveryMode) {
  31118. var trailerDict;
  31119. if (!recoveryMode) {
  31120. trailerDict = this.readXRef();
  31121. } else {
  31122. warn('Indexing all PDF objects');
  31123. trailerDict = this.indexObjects();
  31124. }
  31125. trailerDict.assignXref(this);
  31126. this.trailer = trailerDict;
  31127. var encrypt = trailerDict.get('Encrypt');
  31128. if (isDict(encrypt)) {
  31129. var ids = trailerDict.get('ID');
  31130. var fileId = ids && ids.length ? ids[0] : '';
  31131. encrypt.suppressEncryption = true;
  31132. this.encrypt = new CipherTransformFactory(encrypt, fileId, this.pdfManager.password);
  31133. }
  31134. if (!(this.root = trailerDict.get('Root'))) {
  31135. error('Invalid root reference');
  31136. }
  31137. },
  31138. processXRefTable: function XRef_processXRefTable(parser) {
  31139. if (!('tableState' in this)) {
  31140. this.tableState = {
  31141. entryNum: 0,
  31142. streamPos: parser.lexer.stream.pos,
  31143. parserBuf1: parser.buf1,
  31144. parserBuf2: parser.buf2
  31145. };
  31146. }
  31147. var obj = this.readXRefTable(parser);
  31148. if (!isCmd(obj, 'trailer')) {
  31149. error('Invalid XRef table: could not find trailer dictionary');
  31150. }
  31151. var dict = parser.getObj();
  31152. if (!isDict(dict) && dict.dict) {
  31153. dict = dict.dict;
  31154. }
  31155. if (!isDict(dict)) {
  31156. error('Invalid XRef table: could not parse trailer dictionary');
  31157. }
  31158. delete this.tableState;
  31159. return dict;
  31160. },
  31161. readXRefTable: function XRef_readXRefTable(parser) {
  31162. var stream = parser.lexer.stream;
  31163. var tableState = this.tableState;
  31164. stream.pos = tableState.streamPos;
  31165. parser.buf1 = tableState.parserBuf1;
  31166. parser.buf2 = tableState.parserBuf2;
  31167. var obj;
  31168. while (true) {
  31169. if (!('firstEntryNum' in tableState) || !('entryCount' in tableState)) {
  31170. if (isCmd(obj = parser.getObj(), 'trailer')) {
  31171. break;
  31172. }
  31173. tableState.firstEntryNum = obj;
  31174. tableState.entryCount = parser.getObj();
  31175. }
  31176. var first = tableState.firstEntryNum;
  31177. var count = tableState.entryCount;
  31178. if (!isInt(first) || !isInt(count)) {
  31179. error('Invalid XRef table: wrong types in subsection header');
  31180. }
  31181. for (var i = tableState.entryNum; i < count; i++) {
  31182. tableState.streamPos = stream.pos;
  31183. tableState.entryNum = i;
  31184. tableState.parserBuf1 = parser.buf1;
  31185. tableState.parserBuf2 = parser.buf2;
  31186. var entry = {};
  31187. entry.offset = parser.getObj();
  31188. entry.gen = parser.getObj();
  31189. var type = parser.getObj();
  31190. if (isCmd(type, 'f')) {
  31191. entry.free = true;
  31192. } else if (isCmd(type, 'n')) {
  31193. entry.uncompressed = true;
  31194. }
  31195. if (!isInt(entry.offset) || !isInt(entry.gen) || !(entry.free || entry.uncompressed)) {
  31196. error('Invalid entry in XRef subsection: ' + first + ', ' + count);
  31197. }
  31198. if (i === 0 && entry.free && first === 1) {
  31199. first = 0;
  31200. }
  31201. if (!this.entries[i + first]) {
  31202. this.entries[i + first] = entry;
  31203. }
  31204. }
  31205. tableState.entryNum = 0;
  31206. tableState.streamPos = stream.pos;
  31207. tableState.parserBuf1 = parser.buf1;
  31208. tableState.parserBuf2 = parser.buf2;
  31209. delete tableState.firstEntryNum;
  31210. delete tableState.entryCount;
  31211. }
  31212. if (this.entries[0] && !this.entries[0].free) {
  31213. error('Invalid XRef table: unexpected first object');
  31214. }
  31215. return obj;
  31216. },
  31217. processXRefStream: function XRef_processXRefStream(stream) {
  31218. if (!('streamState' in this)) {
  31219. var streamParameters = stream.dict;
  31220. var byteWidths = streamParameters.get('W');
  31221. var range = streamParameters.get('Index');
  31222. if (!range) {
  31223. range = [
  31224. 0,
  31225. streamParameters.get('Size')
  31226. ];
  31227. }
  31228. this.streamState = {
  31229. entryRanges: range,
  31230. byteWidths: byteWidths,
  31231. entryNum: 0,
  31232. streamPos: stream.pos
  31233. };
  31234. }
  31235. this.readXRefStream(stream);
  31236. delete this.streamState;
  31237. return stream.dict;
  31238. },
  31239. readXRefStream: function XRef_readXRefStream(stream) {
  31240. var i, j;
  31241. var streamState = this.streamState;
  31242. stream.pos = streamState.streamPos;
  31243. var byteWidths = streamState.byteWidths;
  31244. var typeFieldWidth = byteWidths[0];
  31245. var offsetFieldWidth = byteWidths[1];
  31246. var generationFieldWidth = byteWidths[2];
  31247. var entryRanges = streamState.entryRanges;
  31248. while (entryRanges.length > 0) {
  31249. var first = entryRanges[0];
  31250. var n = entryRanges[1];
  31251. if (!isInt(first) || !isInt(n)) {
  31252. error('Invalid XRef range fields: ' + first + ', ' + n);
  31253. }
  31254. if (!isInt(typeFieldWidth) || !isInt(offsetFieldWidth) || !isInt(generationFieldWidth)) {
  31255. error('Invalid XRef entry fields length: ' + first + ', ' + n);
  31256. }
  31257. for (i = streamState.entryNum; i < n; ++i) {
  31258. streamState.entryNum = i;
  31259. streamState.streamPos = stream.pos;
  31260. var type = 0, offset = 0, generation = 0;
  31261. for (j = 0; j < typeFieldWidth; ++j) {
  31262. type = type << 8 | stream.getByte();
  31263. }
  31264. if (typeFieldWidth === 0) {
  31265. type = 1;
  31266. }
  31267. for (j = 0; j < offsetFieldWidth; ++j) {
  31268. offset = offset << 8 | stream.getByte();
  31269. }
  31270. for (j = 0; j < generationFieldWidth; ++j) {
  31271. generation = generation << 8 | stream.getByte();
  31272. }
  31273. var entry = {};
  31274. entry.offset = offset;
  31275. entry.gen = generation;
  31276. switch (type) {
  31277. case 0:
  31278. entry.free = true;
  31279. break;
  31280. case 1:
  31281. entry.uncompressed = true;
  31282. break;
  31283. case 2:
  31284. break;
  31285. default:
  31286. error('Invalid XRef entry type: ' + type);
  31287. }
  31288. if (!this.entries[first + i]) {
  31289. this.entries[first + i] = entry;
  31290. }
  31291. }
  31292. streamState.entryNum = 0;
  31293. streamState.streamPos = stream.pos;
  31294. entryRanges.splice(0, 2);
  31295. }
  31296. },
  31297. indexObjects: function XRef_indexObjects() {
  31298. var TAB = 0x9, LF = 0xA, CR = 0xD, SPACE = 0x20;
  31299. var PERCENT = 0x25, LT = 0x3C;
  31300. function readToken(data, offset) {
  31301. var token = '', ch = data[offset];
  31302. while (ch !== LF && ch !== CR && ch !== LT) {
  31303. if (++offset >= data.length) {
  31304. break;
  31305. }
  31306. token += String.fromCharCode(ch);
  31307. ch = data[offset];
  31308. }
  31309. return token;
  31310. }
  31311. function skipUntil(data, offset, what) {
  31312. var length = what.length, dataLength = data.length;
  31313. var skipped = 0;
  31314. while (offset < dataLength) {
  31315. var i = 0;
  31316. while (i < length && data[offset + i] === what[i]) {
  31317. ++i;
  31318. }
  31319. if (i >= length) {
  31320. break;
  31321. }
  31322. offset++;
  31323. skipped++;
  31324. }
  31325. return skipped;
  31326. }
  31327. var objRegExp = /^(\d+)\s+(\d+)\s+obj\b/;
  31328. var trailerBytes = new Uint8Array([
  31329. 116,
  31330. 114,
  31331. 97,
  31332. 105,
  31333. 108,
  31334. 101,
  31335. 114
  31336. ]);
  31337. var startxrefBytes = new Uint8Array([
  31338. 115,
  31339. 116,
  31340. 97,
  31341. 114,
  31342. 116,
  31343. 120,
  31344. 114,
  31345. 101,
  31346. 102
  31347. ]);
  31348. var endobjBytes = new Uint8Array([
  31349. 101,
  31350. 110,
  31351. 100,
  31352. 111,
  31353. 98,
  31354. 106
  31355. ]);
  31356. var xrefBytes = new Uint8Array([
  31357. 47,
  31358. 88,
  31359. 82,
  31360. 101,
  31361. 102
  31362. ]);
  31363. this.entries.length = 0;
  31364. var stream = this.stream;
  31365. stream.pos = 0;
  31366. var buffer = stream.getBytes();
  31367. var position = stream.start, length = buffer.length;
  31368. var trailers = [], xrefStms = [];
  31369. while (position < length) {
  31370. var ch = buffer[position];
  31371. if (ch === TAB || ch === LF || ch === CR || ch === SPACE) {
  31372. ++position;
  31373. continue;
  31374. }
  31375. if (ch === PERCENT) {
  31376. do {
  31377. ++position;
  31378. if (position >= length) {
  31379. break;
  31380. }
  31381. ch = buffer[position];
  31382. } while (ch !== LF && ch !== CR);
  31383. continue;
  31384. }
  31385. var token = readToken(buffer, position);
  31386. var m;
  31387. if (token.indexOf('xref') === 0 && (token.length === 4 || /\s/.test(token[4]))) {
  31388. position += skipUntil(buffer, position, trailerBytes);
  31389. trailers.push(position);
  31390. position += skipUntil(buffer, position, startxrefBytes);
  31391. } else if (m = objRegExp.exec(token)) {
  31392. if (typeof this.entries[m[1]] === 'undefined') {
  31393. this.entries[m[1]] = {
  31394. offset: position - stream.start,
  31395. gen: m[2] | 0,
  31396. uncompressed: true
  31397. };
  31398. }
  31399. var contentLength = skipUntil(buffer, position, endobjBytes) + 7;
  31400. var content = buffer.subarray(position, position + contentLength);
  31401. var xrefTagOffset = skipUntil(content, 0, xrefBytes);
  31402. if (xrefTagOffset < contentLength && content[xrefTagOffset + 5] < 64) {
  31403. xrefStms.push(position - stream.start);
  31404. this.xrefstms[position - stream.start] = 1;
  31405. }
  31406. position += contentLength;
  31407. } else if (token.indexOf('trailer') === 0 && (token.length === 7 || /\s/.test(token[7]))) {
  31408. trailers.push(position);
  31409. position += skipUntil(buffer, position, startxrefBytes);
  31410. } else {
  31411. position += token.length + 1;
  31412. }
  31413. }
  31414. var i, ii;
  31415. for (i = 0, ii = xrefStms.length; i < ii; ++i) {
  31416. this.startXRefQueue.push(xrefStms[i]);
  31417. this.readXRef(true);
  31418. }
  31419. var dict;
  31420. for (i = 0, ii = trailers.length; i < ii; ++i) {
  31421. stream.pos = trailers[i];
  31422. var parser = new Parser(new Lexer(stream), true, this, true);
  31423. var obj = parser.getObj();
  31424. if (!isCmd(obj, 'trailer')) {
  31425. continue;
  31426. }
  31427. dict = parser.getObj();
  31428. if (!isDict(dict)) {
  31429. continue;
  31430. }
  31431. if (dict.has('ID')) {
  31432. return dict;
  31433. }
  31434. }
  31435. if (dict) {
  31436. return dict;
  31437. }
  31438. throw new InvalidPDFException('Invalid PDF structure');
  31439. },
  31440. readXRef: function XRef_readXRef(recoveryMode) {
  31441. var stream = this.stream;
  31442. try {
  31443. while (this.startXRefQueue.length) {
  31444. var startXRef = this.startXRefQueue[0];
  31445. stream.pos = startXRef + stream.start;
  31446. var parser = new Parser(new Lexer(stream), true, this);
  31447. var obj = parser.getObj();
  31448. var dict;
  31449. if (isCmd(obj, 'xref')) {
  31450. dict = this.processXRefTable(parser);
  31451. if (!this.topDict) {
  31452. this.topDict = dict;
  31453. }
  31454. obj = dict.get('XRefStm');
  31455. if (isInt(obj)) {
  31456. var pos = obj;
  31457. if (!(pos in this.xrefstms)) {
  31458. this.xrefstms[pos] = 1;
  31459. this.startXRefQueue.push(pos);
  31460. }
  31461. }
  31462. } else if (isInt(obj)) {
  31463. if (!isInt(parser.getObj()) || !isCmd(parser.getObj(), 'obj') || !isStream(obj = parser.getObj())) {
  31464. error('Invalid XRef stream');
  31465. }
  31466. dict = this.processXRefStream(obj);
  31467. if (!this.topDict) {
  31468. this.topDict = dict;
  31469. }
  31470. if (!dict) {
  31471. error('Failed to read XRef stream');
  31472. }
  31473. } else {
  31474. error('Invalid XRef stream header');
  31475. }
  31476. obj = dict.get('Prev');
  31477. if (isInt(obj)) {
  31478. this.startXRefQueue.push(obj);
  31479. } else if (isRef(obj)) {
  31480. this.startXRefQueue.push(obj.num);
  31481. }
  31482. this.startXRefQueue.shift();
  31483. }
  31484. return this.topDict;
  31485. } catch (e) {
  31486. if (e instanceof MissingDataException) {
  31487. throw e;
  31488. }
  31489. info('(while reading XRef): ' + e);
  31490. }
  31491. if (recoveryMode) {
  31492. return;
  31493. }
  31494. throw new XRefParseException();
  31495. },
  31496. getEntry: function XRef_getEntry(i) {
  31497. var xrefEntry = this.entries[i];
  31498. if (xrefEntry && !xrefEntry.free && xrefEntry.offset) {
  31499. return xrefEntry;
  31500. }
  31501. return null;
  31502. },
  31503. fetchIfRef: function XRef_fetchIfRef(obj, suppressEncryption) {
  31504. if (!isRef(obj)) {
  31505. return obj;
  31506. }
  31507. return this.fetch(obj, suppressEncryption);
  31508. },
  31509. fetch: function XRef_fetch(ref, suppressEncryption) {
  31510. assert(isRef(ref), 'ref object is not a reference');
  31511. var num = ref.num;
  31512. if (num in this.cache) {
  31513. var cacheEntry = this.cache[num];
  31514. if (isDict(cacheEntry) && !cacheEntry.objId) {
  31515. cacheEntry.objId = ref.toString();
  31516. }
  31517. return cacheEntry;
  31518. }
  31519. var xrefEntry = this.getEntry(num);
  31520. if (xrefEntry === null) {
  31521. return this.cache[num] = null;
  31522. }
  31523. if (xrefEntry.uncompressed) {
  31524. xrefEntry = this.fetchUncompressed(ref, xrefEntry, suppressEncryption);
  31525. } else {
  31526. xrefEntry = this.fetchCompressed(xrefEntry, suppressEncryption);
  31527. }
  31528. if (isDict(xrefEntry)) {
  31529. xrefEntry.objId = ref.toString();
  31530. } else if (isStream(xrefEntry)) {
  31531. xrefEntry.dict.objId = ref.toString();
  31532. }
  31533. return xrefEntry;
  31534. },
  31535. fetchUncompressed: function XRef_fetchUncompressed(ref, xrefEntry, suppressEncryption) {
  31536. var gen = ref.gen;
  31537. var num = ref.num;
  31538. if (xrefEntry.gen !== gen) {
  31539. error('inconsistent generation in XRef');
  31540. }
  31541. var stream = this.stream.makeSubStream(xrefEntry.offset + this.stream.start);
  31542. var parser = new Parser(new Lexer(stream), true, this);
  31543. var obj1 = parser.getObj();
  31544. var obj2 = parser.getObj();
  31545. var obj3 = parser.getObj();
  31546. if (!isInt(obj1) || parseInt(obj1, 10) !== num || !isInt(obj2) || parseInt(obj2, 10) !== gen || !isCmd(obj3)) {
  31547. error('bad XRef entry');
  31548. }
  31549. if (!isCmd(obj3, 'obj')) {
  31550. if (obj3.cmd.indexOf('obj') === 0) {
  31551. num = parseInt(obj3.cmd.substring(3), 10);
  31552. if (!isNaN(num)) {
  31553. return num;
  31554. }
  31555. }
  31556. error('bad XRef entry');
  31557. }
  31558. if (this.encrypt && !suppressEncryption) {
  31559. xrefEntry = parser.getObj(this.encrypt.createCipherTransform(num, gen));
  31560. } else {
  31561. xrefEntry = parser.getObj();
  31562. }
  31563. if (!isStream(xrefEntry)) {
  31564. this.cache[num] = xrefEntry;
  31565. }
  31566. return xrefEntry;
  31567. },
  31568. fetchCompressed: function XRef_fetchCompressed(xrefEntry, suppressEncryption) {
  31569. var tableOffset = xrefEntry.offset;
  31570. var stream = this.fetch(new Ref(tableOffset, 0));
  31571. if (!isStream(stream)) {
  31572. error('bad ObjStm stream');
  31573. }
  31574. var first = stream.dict.get('First');
  31575. var n = stream.dict.get('N');
  31576. if (!isInt(first) || !isInt(n)) {
  31577. error('invalid first and n parameters for ObjStm stream');
  31578. }
  31579. var parser = new Parser(new Lexer(stream), false, this);
  31580. parser.allowStreams = true;
  31581. var i, entries = [], num, nums = [];
  31582. for (i = 0; i < n; ++i) {
  31583. num = parser.getObj();
  31584. if (!isInt(num)) {
  31585. error('invalid object number in the ObjStm stream: ' + num);
  31586. }
  31587. nums.push(num);
  31588. var offset = parser.getObj();
  31589. if (!isInt(offset)) {
  31590. error('invalid object offset in the ObjStm stream: ' + offset);
  31591. }
  31592. }
  31593. for (i = 0; i < n; ++i) {
  31594. entries.push(parser.getObj());
  31595. if (isCmd(parser.buf1, 'endobj')) {
  31596. parser.shift();
  31597. }
  31598. num = nums[i];
  31599. var entry = this.entries[num];
  31600. if (entry && entry.offset === tableOffset && entry.gen === i) {
  31601. this.cache[num] = entries[i];
  31602. }
  31603. }
  31604. xrefEntry = entries[xrefEntry.gen];
  31605. if (xrefEntry === undefined) {
  31606. error('bad XRef entry for compressed object');
  31607. }
  31608. return xrefEntry;
  31609. },
  31610. fetchIfRefAsync: function XRef_fetchIfRefAsync(obj, suppressEncryption) {
  31611. if (!isRef(obj)) {
  31612. return Promise.resolve(obj);
  31613. }
  31614. return this.fetchAsync(obj, suppressEncryption);
  31615. },
  31616. fetchAsync: function XRef_fetchAsync(ref, suppressEncryption) {
  31617. var streamManager = this.stream.manager;
  31618. var xref = this;
  31619. return new Promise(function tryFetch(resolve, reject) {
  31620. try {
  31621. resolve(xref.fetch(ref, suppressEncryption));
  31622. } catch (e) {
  31623. if (e instanceof MissingDataException) {
  31624. streamManager.requestRange(e.begin, e.end).then(function () {
  31625. tryFetch(resolve, reject);
  31626. }, reject);
  31627. return;
  31628. }
  31629. reject(e);
  31630. }
  31631. });
  31632. },
  31633. getCatalogObj: function XRef_getCatalogObj() {
  31634. return this.root;
  31635. }
  31636. };
  31637. return XRef;
  31638. }();
  31639. var NameOrNumberTree = function NameOrNumberTreeClosure() {
  31640. function NameOrNumberTree(root, xref) {
  31641. throw new Error('Cannot initialize NameOrNumberTree.');
  31642. }
  31643. NameOrNumberTree.prototype = {
  31644. getAll: function NameOrNumberTree_getAll() {
  31645. var dict = Object.create(null);
  31646. if (!this.root) {
  31647. return dict;
  31648. }
  31649. var xref = this.xref;
  31650. var processed = new RefSet();
  31651. processed.put(this.root);
  31652. var queue = [this.root];
  31653. while (queue.length > 0) {
  31654. var i, n;
  31655. var obj = xref.fetchIfRef(queue.shift());
  31656. if (!isDict(obj)) {
  31657. continue;
  31658. }
  31659. if (obj.has('Kids')) {
  31660. var kids = obj.get('Kids');
  31661. for (i = 0, n = kids.length; i < n; i++) {
  31662. var kid = kids[i];
  31663. assert(!processed.has(kid), 'Duplicate entry in "' + this._type + '" tree.');
  31664. queue.push(kid);
  31665. processed.put(kid);
  31666. }
  31667. continue;
  31668. }
  31669. var entries = obj.get(this._type);
  31670. if (isArray(entries)) {
  31671. for (i = 0, n = entries.length; i < n; i += 2) {
  31672. dict[xref.fetchIfRef(entries[i])] = xref.fetchIfRef(entries[i + 1]);
  31673. }
  31674. }
  31675. }
  31676. return dict;
  31677. },
  31678. get: function NameOrNumberTree_get(key) {
  31679. if (!this.root) {
  31680. return null;
  31681. }
  31682. var xref = this.xref;
  31683. var kidsOrEntries = xref.fetchIfRef(this.root);
  31684. var loopCount = 0;
  31685. var MAX_LEVELS = 10;
  31686. var l, r, m;
  31687. while (kidsOrEntries.has('Kids')) {
  31688. if (++loopCount > MAX_LEVELS) {
  31689. warn('Search depth limit reached for "' + this._type + '" tree.');
  31690. return null;
  31691. }
  31692. var kids = kidsOrEntries.get('Kids');
  31693. if (!isArray(kids)) {
  31694. return null;
  31695. }
  31696. l = 0;
  31697. r = kids.length - 1;
  31698. while (l <= r) {
  31699. m = l + r >> 1;
  31700. var kid = xref.fetchIfRef(kids[m]);
  31701. var limits = kid.get('Limits');
  31702. if (key < xref.fetchIfRef(limits[0])) {
  31703. r = m - 1;
  31704. } else if (key > xref.fetchIfRef(limits[1])) {
  31705. l = m + 1;
  31706. } else {
  31707. kidsOrEntries = xref.fetchIfRef(kids[m]);
  31708. break;
  31709. }
  31710. }
  31711. if (l > r) {
  31712. return null;
  31713. }
  31714. }
  31715. var entries = kidsOrEntries.get(this._type);
  31716. if (isArray(entries)) {
  31717. l = 0;
  31718. r = entries.length - 2;
  31719. while (l <= r) {
  31720. m = l + r & ~1;
  31721. var currentKey = xref.fetchIfRef(entries[m]);
  31722. if (key < currentKey) {
  31723. r = m - 2;
  31724. } else if (key > currentKey) {
  31725. l = m + 2;
  31726. } else {
  31727. return xref.fetchIfRef(entries[m + 1]);
  31728. }
  31729. }
  31730. }
  31731. return null;
  31732. }
  31733. };
  31734. return NameOrNumberTree;
  31735. }();
  31736. var NameTree = function NameTreeClosure() {
  31737. function NameTree(root, xref) {
  31738. this.root = root;
  31739. this.xref = xref;
  31740. this._type = 'Names';
  31741. }
  31742. Util.inherit(NameTree, NameOrNumberTree, {});
  31743. return NameTree;
  31744. }();
  31745. var NumberTree = function NumberTreeClosure() {
  31746. function NumberTree(root, xref) {
  31747. this.root = root;
  31748. this.xref = xref;
  31749. this._type = 'Nums';
  31750. }
  31751. Util.inherit(NumberTree, NameOrNumberTree, {});
  31752. return NumberTree;
  31753. }();
  31754. var FileSpec = function FileSpecClosure() {
  31755. function FileSpec(root, xref) {
  31756. if (!root || !isDict(root)) {
  31757. return;
  31758. }
  31759. this.xref = xref;
  31760. this.root = root;
  31761. if (root.has('FS')) {
  31762. this.fs = root.get('FS');
  31763. }
  31764. this.description = root.has('Desc') ? stringToPDFString(root.get('Desc')) : '';
  31765. if (root.has('RF')) {
  31766. warn('Related file specifications are not supported');
  31767. }
  31768. this.contentAvailable = true;
  31769. if (!root.has('EF')) {
  31770. this.contentAvailable = false;
  31771. warn('Non-embedded file specifications are not supported');
  31772. }
  31773. }
  31774. function pickPlatformItem(dict) {
  31775. if (dict.has('UF')) {
  31776. return dict.get('UF');
  31777. } else if (dict.has('F')) {
  31778. return dict.get('F');
  31779. } else if (dict.has('Unix')) {
  31780. return dict.get('Unix');
  31781. } else if (dict.has('Mac')) {
  31782. return dict.get('Mac');
  31783. } else if (dict.has('DOS')) {
  31784. return dict.get('DOS');
  31785. }
  31786. return null;
  31787. }
  31788. FileSpec.prototype = {
  31789. get filename() {
  31790. if (!this._filename && this.root) {
  31791. var filename = pickPlatformItem(this.root) || 'unnamed';
  31792. this._filename = stringToPDFString(filename).replace(/\\\\/g, '\\').replace(/\\\//g, '/').replace(/\\/g, '/');
  31793. }
  31794. return this._filename;
  31795. },
  31796. get content() {
  31797. if (!this.contentAvailable) {
  31798. return null;
  31799. }
  31800. if (!this.contentRef && this.root) {
  31801. this.contentRef = pickPlatformItem(this.root.get('EF'));
  31802. }
  31803. var content = null;
  31804. if (this.contentRef) {
  31805. var xref = this.xref;
  31806. var fileObj = xref.fetchIfRef(this.contentRef);
  31807. if (fileObj && isStream(fileObj)) {
  31808. content = fileObj.getBytes();
  31809. } else {
  31810. warn('Embedded file specification points to non-existing/invalid ' + 'content');
  31811. }
  31812. } else {
  31813. warn('Embedded file specification does not have a content');
  31814. }
  31815. return content;
  31816. },
  31817. get serializable() {
  31818. return {
  31819. filename: this.filename,
  31820. content: this.content
  31821. };
  31822. }
  31823. };
  31824. return FileSpec;
  31825. }();
  31826. var ObjectLoader = function () {
  31827. function mayHaveChildren(value) {
  31828. return isRef(value) || isDict(value) || isArray(value) || isStream(value);
  31829. }
  31830. function addChildren(node, nodesToVisit) {
  31831. var value;
  31832. if (isDict(node) || isStream(node)) {
  31833. var map;
  31834. if (isDict(node)) {
  31835. map = node.map;
  31836. } else {
  31837. map = node.dict.map;
  31838. }
  31839. for (var key in map) {
  31840. value = map[key];
  31841. if (mayHaveChildren(value)) {
  31842. nodesToVisit.push(value);
  31843. }
  31844. }
  31845. } else if (isArray(node)) {
  31846. for (var i = 0, ii = node.length; i < ii; i++) {
  31847. value = node[i];
  31848. if (mayHaveChildren(value)) {
  31849. nodesToVisit.push(value);
  31850. }
  31851. }
  31852. }
  31853. }
  31854. function ObjectLoader(obj, keys, xref) {
  31855. this.obj = obj;
  31856. this.keys = keys;
  31857. this.xref = xref;
  31858. this.refSet = null;
  31859. this.capability = null;
  31860. }
  31861. ObjectLoader.prototype = {
  31862. load: function ObjectLoader_load() {
  31863. var keys = this.keys;
  31864. this.capability = createPromiseCapability();
  31865. if (!(this.xref.stream instanceof ChunkedStream) || this.xref.stream.getMissingChunks().length === 0) {
  31866. this.capability.resolve();
  31867. return this.capability.promise;
  31868. }
  31869. this.refSet = new RefSet();
  31870. var nodesToVisit = [];
  31871. for (var i = 0; i < keys.length; i++) {
  31872. nodesToVisit.push(this.obj[keys[i]]);
  31873. }
  31874. this._walk(nodesToVisit);
  31875. return this.capability.promise;
  31876. },
  31877. _walk: function ObjectLoader_walk(nodesToVisit) {
  31878. var nodesToRevisit = [];
  31879. var pendingRequests = [];
  31880. while (nodesToVisit.length) {
  31881. var currentNode = nodesToVisit.pop();
  31882. if (isRef(currentNode)) {
  31883. if (this.refSet.has(currentNode)) {
  31884. continue;
  31885. }
  31886. try {
  31887. var ref = currentNode;
  31888. this.refSet.put(ref);
  31889. currentNode = this.xref.fetch(currentNode);
  31890. } catch (e) {
  31891. if (!(e instanceof MissingDataException)) {
  31892. throw e;
  31893. }
  31894. nodesToRevisit.push(currentNode);
  31895. pendingRequests.push({
  31896. begin: e.begin,
  31897. end: e.end
  31898. });
  31899. }
  31900. }
  31901. if (currentNode && currentNode.getBaseStreams) {
  31902. var baseStreams = currentNode.getBaseStreams();
  31903. var foundMissingData = false;
  31904. for (var i = 0; i < baseStreams.length; i++) {
  31905. var stream = baseStreams[i];
  31906. if (stream.getMissingChunks && stream.getMissingChunks().length) {
  31907. foundMissingData = true;
  31908. pendingRequests.push({
  31909. begin: stream.start,
  31910. end: stream.end
  31911. });
  31912. }
  31913. }
  31914. if (foundMissingData) {
  31915. nodesToRevisit.push(currentNode);
  31916. }
  31917. }
  31918. addChildren(currentNode, nodesToVisit);
  31919. }
  31920. if (pendingRequests.length) {
  31921. this.xref.stream.manager.requestRanges(pendingRequests).then(function pendingRequestCallback() {
  31922. nodesToVisit = nodesToRevisit;
  31923. for (var i = 0; i < nodesToRevisit.length; i++) {
  31924. var node = nodesToRevisit[i];
  31925. if (isRef(node)) {
  31926. this.refSet.remove(node);
  31927. }
  31928. }
  31929. this._walk(nodesToVisit);
  31930. }.bind(this), this.capability.reject);
  31931. return;
  31932. }
  31933. this.refSet = null;
  31934. this.capability.resolve();
  31935. }
  31936. };
  31937. return ObjectLoader;
  31938. }();
  31939. exports.Catalog = Catalog;
  31940. exports.ObjectLoader = ObjectLoader;
  31941. exports.XRef = XRef;
  31942. exports.FileSpec = FileSpec;
  31943. /***/ }),
  31944. /* 17 */
  31945. /***/ (function(module, exports, __w_pdfjs_require__) {
  31946. "use strict";
  31947. var sharedUtil = __w_pdfjs_require__(0);
  31948. var getLookupTableFactory = sharedUtil.getLookupTableFactory;
  31949. var getStdFontMap = getLookupTableFactory(function (t) {
  31950. t['ArialNarrow'] = 'Helvetica';
  31951. t['ArialNarrow-Bold'] = 'Helvetica-Bold';
  31952. t['ArialNarrow-BoldItalic'] = 'Helvetica-BoldOblique';
  31953. t['ArialNarrow-Italic'] = 'Helvetica-Oblique';
  31954. t['ArialBlack'] = 'Helvetica';
  31955. t['ArialBlack-Bold'] = 'Helvetica-Bold';
  31956. t['ArialBlack-BoldItalic'] = 'Helvetica-BoldOblique';
  31957. t['ArialBlack-Italic'] = 'Helvetica-Oblique';
  31958. t['Arial-Black'] = 'Helvetica';
  31959. t['Arial-Black-Bold'] = 'Helvetica-Bold';
  31960. t['Arial-Black-BoldItalic'] = 'Helvetica-BoldOblique';
  31961. t['Arial-Black-Italic'] = 'Helvetica-Oblique';
  31962. t['Arial'] = 'Helvetica';
  31963. t['Arial-Bold'] = 'Helvetica-Bold';
  31964. t['Arial-BoldItalic'] = 'Helvetica-BoldOblique';
  31965. t['Arial-Italic'] = 'Helvetica-Oblique';
  31966. t['Arial-BoldItalicMT'] = 'Helvetica-BoldOblique';
  31967. t['Arial-BoldMT'] = 'Helvetica-Bold';
  31968. t['Arial-ItalicMT'] = 'Helvetica-Oblique';
  31969. t['ArialMT'] = 'Helvetica';
  31970. t['Courier-Bold'] = 'Courier-Bold';
  31971. t['Courier-BoldItalic'] = 'Courier-BoldOblique';
  31972. t['Courier-Italic'] = 'Courier-Oblique';
  31973. t['CourierNew'] = 'Courier';
  31974. t['CourierNew-Bold'] = 'Courier-Bold';
  31975. t['CourierNew-BoldItalic'] = 'Courier-BoldOblique';
  31976. t['CourierNew-Italic'] = 'Courier-Oblique';
  31977. t['CourierNewPS-BoldItalicMT'] = 'Courier-BoldOblique';
  31978. t['CourierNewPS-BoldMT'] = 'Courier-Bold';
  31979. t['CourierNewPS-ItalicMT'] = 'Courier-Oblique';
  31980. t['CourierNewPSMT'] = 'Courier';
  31981. t['Helvetica'] = 'Helvetica';
  31982. t['Helvetica-Bold'] = 'Helvetica-Bold';
  31983. t['Helvetica-BoldItalic'] = 'Helvetica-BoldOblique';
  31984. t['Helvetica-BoldOblique'] = 'Helvetica-BoldOblique';
  31985. t['Helvetica-Italic'] = 'Helvetica-Oblique';
  31986. t['Helvetica-Oblique'] = 'Helvetica-Oblique';
  31987. t['Symbol-Bold'] = 'Symbol';
  31988. t['Symbol-BoldItalic'] = 'Symbol';
  31989. t['Symbol-Italic'] = 'Symbol';
  31990. t['TimesNewRoman'] = 'Times-Roman';
  31991. t['TimesNewRoman-Bold'] = 'Times-Bold';
  31992. t['TimesNewRoman-BoldItalic'] = 'Times-BoldItalic';
  31993. t['TimesNewRoman-Italic'] = 'Times-Italic';
  31994. t['TimesNewRomanPS'] = 'Times-Roman';
  31995. t['TimesNewRomanPS-Bold'] = 'Times-Bold';
  31996. t['TimesNewRomanPS-BoldItalic'] = 'Times-BoldItalic';
  31997. t['TimesNewRomanPS-BoldItalicMT'] = 'Times-BoldItalic';
  31998. t['TimesNewRomanPS-BoldMT'] = 'Times-Bold';
  31999. t['TimesNewRomanPS-Italic'] = 'Times-Italic';
  32000. t['TimesNewRomanPS-ItalicMT'] = 'Times-Italic';
  32001. t['TimesNewRomanPSMT'] = 'Times-Roman';
  32002. t['TimesNewRomanPSMT-Bold'] = 'Times-Bold';
  32003. t['TimesNewRomanPSMT-BoldItalic'] = 'Times-BoldItalic';
  32004. t['TimesNewRomanPSMT-Italic'] = 'Times-Italic';
  32005. });
  32006. var getNonStdFontMap = getLookupTableFactory(function (t) {
  32007. t['CenturyGothic'] = 'Helvetica';
  32008. t['CenturyGothic-Bold'] = 'Helvetica-Bold';
  32009. t['CenturyGothic-BoldItalic'] = 'Helvetica-BoldOblique';
  32010. t['CenturyGothic-Italic'] = 'Helvetica-Oblique';
  32011. t['ComicSansMS'] = 'Comic Sans MS';
  32012. t['ComicSansMS-Bold'] = 'Comic Sans MS-Bold';
  32013. t['ComicSansMS-BoldItalic'] = 'Comic Sans MS-BoldItalic';
  32014. t['ComicSansMS-Italic'] = 'Comic Sans MS-Italic';
  32015. t['LucidaConsole'] = 'Courier';
  32016. t['LucidaConsole-Bold'] = 'Courier-Bold';
  32017. t['LucidaConsole-BoldItalic'] = 'Courier-BoldOblique';
  32018. t['LucidaConsole-Italic'] = 'Courier-Oblique';
  32019. t['MS-Gothic'] = 'MS Gothic';
  32020. t['MS-Gothic-Bold'] = 'MS Gothic-Bold';
  32021. t['MS-Gothic-BoldItalic'] = 'MS Gothic-BoldItalic';
  32022. t['MS-Gothic-Italic'] = 'MS Gothic-Italic';
  32023. t['MS-Mincho'] = 'MS Mincho';
  32024. t['MS-Mincho-Bold'] = 'MS Mincho-Bold';
  32025. t['MS-Mincho-BoldItalic'] = 'MS Mincho-BoldItalic';
  32026. t['MS-Mincho-Italic'] = 'MS Mincho-Italic';
  32027. t['MS-PGothic'] = 'MS PGothic';
  32028. t['MS-PGothic-Bold'] = 'MS PGothic-Bold';
  32029. t['MS-PGothic-BoldItalic'] = 'MS PGothic-BoldItalic';
  32030. t['MS-PGothic-Italic'] = 'MS PGothic-Italic';
  32031. t['MS-PMincho'] = 'MS PMincho';
  32032. t['MS-PMincho-Bold'] = 'MS PMincho-Bold';
  32033. t['MS-PMincho-BoldItalic'] = 'MS PMincho-BoldItalic';
  32034. t['MS-PMincho-Italic'] = 'MS PMincho-Italic';
  32035. t['NuptialScript'] = 'Times-Italic';
  32036. t['Wingdings'] = 'ZapfDingbats';
  32037. });
  32038. var getSerifFonts = getLookupTableFactory(function (t) {
  32039. t['Adobe Jenson'] = true;
  32040. t['Adobe Text'] = true;
  32041. t['Albertus'] = true;
  32042. t['Aldus'] = true;
  32043. t['Alexandria'] = true;
  32044. t['Algerian'] = true;
  32045. t['American Typewriter'] = true;
  32046. t['Antiqua'] = true;
  32047. t['Apex'] = true;
  32048. t['Arno'] = true;
  32049. t['Aster'] = true;
  32050. t['Aurora'] = true;
  32051. t['Baskerville'] = true;
  32052. t['Bell'] = true;
  32053. t['Bembo'] = true;
  32054. t['Bembo Schoolbook'] = true;
  32055. t['Benguiat'] = true;
  32056. t['Berkeley Old Style'] = true;
  32057. t['Bernhard Modern'] = true;
  32058. t['Berthold City'] = true;
  32059. t['Bodoni'] = true;
  32060. t['Bauer Bodoni'] = true;
  32061. t['Book Antiqua'] = true;
  32062. t['Bookman'] = true;
  32063. t['Bordeaux Roman'] = true;
  32064. t['Californian FB'] = true;
  32065. t['Calisto'] = true;
  32066. t['Calvert'] = true;
  32067. t['Capitals'] = true;
  32068. t['Cambria'] = true;
  32069. t['Cartier'] = true;
  32070. t['Caslon'] = true;
  32071. t['Catull'] = true;
  32072. t['Centaur'] = true;
  32073. t['Century Old Style'] = true;
  32074. t['Century Schoolbook'] = true;
  32075. t['Chaparral'] = true;
  32076. t['Charis SIL'] = true;
  32077. t['Cheltenham'] = true;
  32078. t['Cholla Slab'] = true;
  32079. t['Clarendon'] = true;
  32080. t['Clearface'] = true;
  32081. t['Cochin'] = true;
  32082. t['Colonna'] = true;
  32083. t['Computer Modern'] = true;
  32084. t['Concrete Roman'] = true;
  32085. t['Constantia'] = true;
  32086. t['Cooper Black'] = true;
  32087. t['Corona'] = true;
  32088. t['Ecotype'] = true;
  32089. t['Egyptienne'] = true;
  32090. t['Elephant'] = true;
  32091. t['Excelsior'] = true;
  32092. t['Fairfield'] = true;
  32093. t['FF Scala'] = true;
  32094. t['Folkard'] = true;
  32095. t['Footlight'] = true;
  32096. t['FreeSerif'] = true;
  32097. t['Friz Quadrata'] = true;
  32098. t['Garamond'] = true;
  32099. t['Gentium'] = true;
  32100. t['Georgia'] = true;
  32101. t['Gloucester'] = true;
  32102. t['Goudy Old Style'] = true;
  32103. t['Goudy Schoolbook'] = true;
  32104. t['Goudy Pro Font'] = true;
  32105. t['Granjon'] = true;
  32106. t['Guardian Egyptian'] = true;
  32107. t['Heather'] = true;
  32108. t['Hercules'] = true;
  32109. t['High Tower Text'] = true;
  32110. t['Hiroshige'] = true;
  32111. t['Hoefler Text'] = true;
  32112. t['Humana Serif'] = true;
  32113. t['Imprint'] = true;
  32114. t['Ionic No. 5'] = true;
  32115. t['Janson'] = true;
  32116. t['Joanna'] = true;
  32117. t['Korinna'] = true;
  32118. t['Lexicon'] = true;
  32119. t['Liberation Serif'] = true;
  32120. t['Linux Libertine'] = true;
  32121. t['Literaturnaya'] = true;
  32122. t['Lucida'] = true;
  32123. t['Lucida Bright'] = true;
  32124. t['Melior'] = true;
  32125. t['Memphis'] = true;
  32126. t['Miller'] = true;
  32127. t['Minion'] = true;
  32128. t['Modern'] = true;
  32129. t['Mona Lisa'] = true;
  32130. t['Mrs Eaves'] = true;
  32131. t['MS Serif'] = true;
  32132. t['Museo Slab'] = true;
  32133. t['New York'] = true;
  32134. t['Nimbus Roman'] = true;
  32135. t['NPS Rawlinson Roadway'] = true;
  32136. t['NuptialScript'] = true;
  32137. t['Palatino'] = true;
  32138. t['Perpetua'] = true;
  32139. t['Plantin'] = true;
  32140. t['Plantin Schoolbook'] = true;
  32141. t['Playbill'] = true;
  32142. t['Poor Richard'] = true;
  32143. t['Rawlinson Roadway'] = true;
  32144. t['Renault'] = true;
  32145. t['Requiem'] = true;
  32146. t['Rockwell'] = true;
  32147. t['Roman'] = true;
  32148. t['Rotis Serif'] = true;
  32149. t['Sabon'] = true;
  32150. t['Scala'] = true;
  32151. t['Seagull'] = true;
  32152. t['Sistina'] = true;
  32153. t['Souvenir'] = true;
  32154. t['STIX'] = true;
  32155. t['Stone Informal'] = true;
  32156. t['Stone Serif'] = true;
  32157. t['Sylfaen'] = true;
  32158. t['Times'] = true;
  32159. t['Trajan'] = true;
  32160. t['Trinité'] = true;
  32161. t['Trump Mediaeval'] = true;
  32162. t['Utopia'] = true;
  32163. t['Vale Type'] = true;
  32164. t['Bitstream Vera'] = true;
  32165. t['Vera Serif'] = true;
  32166. t['Versailles'] = true;
  32167. t['Wanted'] = true;
  32168. t['Weiss'] = true;
  32169. t['Wide Latin'] = true;
  32170. t['Windsor'] = true;
  32171. t['XITS'] = true;
  32172. });
  32173. var getSymbolsFonts = getLookupTableFactory(function (t) {
  32174. t['Dingbats'] = true;
  32175. t['Symbol'] = true;
  32176. t['ZapfDingbats'] = true;
  32177. });
  32178. var getGlyphMapForStandardFonts = getLookupTableFactory(function (t) {
  32179. t[2] = 10;
  32180. t[3] = 32;
  32181. t[4] = 33;
  32182. t[5] = 34;
  32183. t[6] = 35;
  32184. t[7] = 36;
  32185. t[8] = 37;
  32186. t[9] = 38;
  32187. t[10] = 39;
  32188. t[11] = 40;
  32189. t[12] = 41;
  32190. t[13] = 42;
  32191. t[14] = 43;
  32192. t[15] = 44;
  32193. t[16] = 45;
  32194. t[17] = 46;
  32195. t[18] = 47;
  32196. t[19] = 48;
  32197. t[20] = 49;
  32198. t[21] = 50;
  32199. t[22] = 51;
  32200. t[23] = 52;
  32201. t[24] = 53;
  32202. t[25] = 54;
  32203. t[26] = 55;
  32204. t[27] = 56;
  32205. t[28] = 57;
  32206. t[29] = 58;
  32207. t[30] = 894;
  32208. t[31] = 60;
  32209. t[32] = 61;
  32210. t[33] = 62;
  32211. t[34] = 63;
  32212. t[35] = 64;
  32213. t[36] = 65;
  32214. t[37] = 66;
  32215. t[38] = 67;
  32216. t[39] = 68;
  32217. t[40] = 69;
  32218. t[41] = 70;
  32219. t[42] = 71;
  32220. t[43] = 72;
  32221. t[44] = 73;
  32222. t[45] = 74;
  32223. t[46] = 75;
  32224. t[47] = 76;
  32225. t[48] = 77;
  32226. t[49] = 78;
  32227. t[50] = 79;
  32228. t[51] = 80;
  32229. t[52] = 81;
  32230. t[53] = 82;
  32231. t[54] = 83;
  32232. t[55] = 84;
  32233. t[56] = 85;
  32234. t[57] = 86;
  32235. t[58] = 87;
  32236. t[59] = 88;
  32237. t[60] = 89;
  32238. t[61] = 90;
  32239. t[62] = 91;
  32240. t[63] = 92;
  32241. t[64] = 93;
  32242. t[65] = 94;
  32243. t[66] = 95;
  32244. t[67] = 96;
  32245. t[68] = 97;
  32246. t[69] = 98;
  32247. t[70] = 99;
  32248. t[71] = 100;
  32249. t[72] = 101;
  32250. t[73] = 102;
  32251. t[74] = 103;
  32252. t[75] = 104;
  32253. t[76] = 105;
  32254. t[77] = 106;
  32255. t[78] = 107;
  32256. t[79] = 108;
  32257. t[80] = 109;
  32258. t[81] = 110;
  32259. t[82] = 111;
  32260. t[83] = 112;
  32261. t[84] = 113;
  32262. t[85] = 114;
  32263. t[86] = 115;
  32264. t[87] = 116;
  32265. t[88] = 117;
  32266. t[89] = 118;
  32267. t[90] = 119;
  32268. t[91] = 120;
  32269. t[92] = 121;
  32270. t[93] = 122;
  32271. t[94] = 123;
  32272. t[95] = 124;
  32273. t[96] = 125;
  32274. t[97] = 126;
  32275. t[98] = 196;
  32276. t[99] = 197;
  32277. t[100] = 199;
  32278. t[101] = 201;
  32279. t[102] = 209;
  32280. t[103] = 214;
  32281. t[104] = 220;
  32282. t[105] = 225;
  32283. t[106] = 224;
  32284. t[107] = 226;
  32285. t[108] = 228;
  32286. t[109] = 227;
  32287. t[110] = 229;
  32288. t[111] = 231;
  32289. t[112] = 233;
  32290. t[113] = 232;
  32291. t[114] = 234;
  32292. t[115] = 235;
  32293. t[116] = 237;
  32294. t[117] = 236;
  32295. t[118] = 238;
  32296. t[119] = 239;
  32297. t[120] = 241;
  32298. t[121] = 243;
  32299. t[122] = 242;
  32300. t[123] = 244;
  32301. t[124] = 246;
  32302. t[125] = 245;
  32303. t[126] = 250;
  32304. t[127] = 249;
  32305. t[128] = 251;
  32306. t[129] = 252;
  32307. t[130] = 8224;
  32308. t[131] = 176;
  32309. t[132] = 162;
  32310. t[133] = 163;
  32311. t[134] = 167;
  32312. t[135] = 8226;
  32313. t[136] = 182;
  32314. t[137] = 223;
  32315. t[138] = 174;
  32316. t[139] = 169;
  32317. t[140] = 8482;
  32318. t[141] = 180;
  32319. t[142] = 168;
  32320. t[143] = 8800;
  32321. t[144] = 198;
  32322. t[145] = 216;
  32323. t[146] = 8734;
  32324. t[147] = 177;
  32325. t[148] = 8804;
  32326. t[149] = 8805;
  32327. t[150] = 165;
  32328. t[151] = 181;
  32329. t[152] = 8706;
  32330. t[153] = 8721;
  32331. t[154] = 8719;
  32332. t[156] = 8747;
  32333. t[157] = 170;
  32334. t[158] = 186;
  32335. t[159] = 8486;
  32336. t[160] = 230;
  32337. t[161] = 248;
  32338. t[162] = 191;
  32339. t[163] = 161;
  32340. t[164] = 172;
  32341. t[165] = 8730;
  32342. t[166] = 402;
  32343. t[167] = 8776;
  32344. t[168] = 8710;
  32345. t[169] = 171;
  32346. t[170] = 187;
  32347. t[171] = 8230;
  32348. t[210] = 218;
  32349. t[223] = 711;
  32350. t[224] = 321;
  32351. t[225] = 322;
  32352. t[227] = 353;
  32353. t[229] = 382;
  32354. t[234] = 253;
  32355. t[252] = 263;
  32356. t[253] = 268;
  32357. t[254] = 269;
  32358. t[258] = 258;
  32359. t[260] = 260;
  32360. t[261] = 261;
  32361. t[265] = 280;
  32362. t[266] = 281;
  32363. t[268] = 283;
  32364. t[269] = 313;
  32365. t[275] = 323;
  32366. t[276] = 324;
  32367. t[278] = 328;
  32368. t[284] = 345;
  32369. t[285] = 346;
  32370. t[286] = 347;
  32371. t[292] = 367;
  32372. t[295] = 377;
  32373. t[296] = 378;
  32374. t[298] = 380;
  32375. t[305] = 963;
  32376. t[306] = 964;
  32377. t[307] = 966;
  32378. t[308] = 8215;
  32379. t[309] = 8252;
  32380. t[310] = 8319;
  32381. t[311] = 8359;
  32382. t[312] = 8592;
  32383. t[313] = 8593;
  32384. t[337] = 9552;
  32385. t[493] = 1039;
  32386. t[494] = 1040;
  32387. t[705] = 1524;
  32388. t[706] = 8362;
  32389. t[710] = 64288;
  32390. t[711] = 64298;
  32391. t[759] = 1617;
  32392. t[761] = 1776;
  32393. t[763] = 1778;
  32394. t[775] = 1652;
  32395. t[777] = 1764;
  32396. t[778] = 1780;
  32397. t[779] = 1781;
  32398. t[780] = 1782;
  32399. t[782] = 771;
  32400. t[783] = 64726;
  32401. t[786] = 8363;
  32402. t[788] = 8532;
  32403. t[790] = 768;
  32404. t[791] = 769;
  32405. t[792] = 768;
  32406. t[795] = 803;
  32407. t[797] = 64336;
  32408. t[798] = 64337;
  32409. t[799] = 64342;
  32410. t[800] = 64343;
  32411. t[801] = 64344;
  32412. t[802] = 64345;
  32413. t[803] = 64362;
  32414. t[804] = 64363;
  32415. t[805] = 64364;
  32416. t[2424] = 7821;
  32417. t[2425] = 7822;
  32418. t[2426] = 7823;
  32419. t[2427] = 7824;
  32420. t[2428] = 7825;
  32421. t[2429] = 7826;
  32422. t[2430] = 7827;
  32423. t[2433] = 7682;
  32424. t[2678] = 8045;
  32425. t[2679] = 8046;
  32426. t[2830] = 1552;
  32427. t[2838] = 686;
  32428. t[2840] = 751;
  32429. t[2842] = 753;
  32430. t[2843] = 754;
  32431. t[2844] = 755;
  32432. t[2846] = 757;
  32433. t[2856] = 767;
  32434. t[2857] = 848;
  32435. t[2858] = 849;
  32436. t[2862] = 853;
  32437. t[2863] = 854;
  32438. t[2864] = 855;
  32439. t[2865] = 861;
  32440. t[2866] = 862;
  32441. t[2906] = 7460;
  32442. t[2908] = 7462;
  32443. t[2909] = 7463;
  32444. t[2910] = 7464;
  32445. t[2912] = 7466;
  32446. t[2913] = 7467;
  32447. t[2914] = 7468;
  32448. t[2916] = 7470;
  32449. t[2917] = 7471;
  32450. t[2918] = 7472;
  32451. t[2920] = 7474;
  32452. t[2921] = 7475;
  32453. t[2922] = 7476;
  32454. t[2924] = 7478;
  32455. t[2925] = 7479;
  32456. t[2926] = 7480;
  32457. t[2928] = 7482;
  32458. t[2929] = 7483;
  32459. t[2930] = 7484;
  32460. t[2932] = 7486;
  32461. t[2933] = 7487;
  32462. t[2934] = 7488;
  32463. t[2936] = 7490;
  32464. t[2937] = 7491;
  32465. t[2938] = 7492;
  32466. t[2940] = 7494;
  32467. t[2941] = 7495;
  32468. t[2942] = 7496;
  32469. t[2944] = 7498;
  32470. t[2946] = 7500;
  32471. t[2948] = 7502;
  32472. t[2950] = 7504;
  32473. t[2951] = 7505;
  32474. t[2952] = 7506;
  32475. t[2954] = 7508;
  32476. t[2955] = 7509;
  32477. t[2956] = 7510;
  32478. t[2958] = 7512;
  32479. t[2959] = 7513;
  32480. t[2960] = 7514;
  32481. t[2962] = 7516;
  32482. t[2963] = 7517;
  32483. t[2964] = 7518;
  32484. t[2966] = 7520;
  32485. t[2967] = 7521;
  32486. t[2968] = 7522;
  32487. t[2970] = 7524;
  32488. t[2971] = 7525;
  32489. t[2972] = 7526;
  32490. t[2974] = 7528;
  32491. t[2975] = 7529;
  32492. t[2976] = 7530;
  32493. t[2978] = 1537;
  32494. t[2979] = 1538;
  32495. t[2980] = 1539;
  32496. t[2982] = 1549;
  32497. t[2983] = 1551;
  32498. t[2984] = 1552;
  32499. t[2986] = 1554;
  32500. t[2987] = 1555;
  32501. t[2988] = 1556;
  32502. t[2990] = 1623;
  32503. t[2991] = 1624;
  32504. t[2995] = 1775;
  32505. t[2999] = 1791;
  32506. t[3002] = 64290;
  32507. t[3003] = 64291;
  32508. t[3004] = 64292;
  32509. t[3006] = 64294;
  32510. t[3007] = 64295;
  32511. t[3008] = 64296;
  32512. t[3011] = 1900;
  32513. t[3014] = 8223;
  32514. t[3015] = 8244;
  32515. t[3017] = 7532;
  32516. t[3018] = 7533;
  32517. t[3019] = 7534;
  32518. t[3075] = 7590;
  32519. t[3076] = 7591;
  32520. t[3079] = 7594;
  32521. t[3080] = 7595;
  32522. t[3083] = 7598;
  32523. t[3084] = 7599;
  32524. t[3087] = 7602;
  32525. t[3088] = 7603;
  32526. t[3091] = 7606;
  32527. t[3092] = 7607;
  32528. t[3095] = 7610;
  32529. t[3096] = 7611;
  32530. t[3099] = 7614;
  32531. t[3100] = 7615;
  32532. t[3103] = 7618;
  32533. t[3104] = 7619;
  32534. t[3107] = 8337;
  32535. t[3108] = 8338;
  32536. t[3116] = 1884;
  32537. t[3119] = 1885;
  32538. t[3120] = 1885;
  32539. t[3123] = 1886;
  32540. t[3124] = 1886;
  32541. t[3127] = 1887;
  32542. t[3128] = 1887;
  32543. t[3131] = 1888;
  32544. t[3132] = 1888;
  32545. t[3135] = 1889;
  32546. t[3136] = 1889;
  32547. t[3139] = 1890;
  32548. t[3140] = 1890;
  32549. t[3143] = 1891;
  32550. t[3144] = 1891;
  32551. t[3147] = 1892;
  32552. t[3148] = 1892;
  32553. t[3153] = 580;
  32554. t[3154] = 581;
  32555. t[3157] = 584;
  32556. t[3158] = 585;
  32557. t[3161] = 588;
  32558. t[3162] = 589;
  32559. t[3165] = 891;
  32560. t[3166] = 892;
  32561. t[3169] = 1274;
  32562. t[3170] = 1275;
  32563. t[3173] = 1278;
  32564. t[3174] = 1279;
  32565. t[3181] = 7622;
  32566. t[3182] = 7623;
  32567. t[3282] = 11799;
  32568. t[3316] = 578;
  32569. t[3379] = 42785;
  32570. t[3393] = 1159;
  32571. t[3416] = 8377;
  32572. });
  32573. var getSupplementalGlyphMapForArialBlack = getLookupTableFactory(function (t) {
  32574. t[227] = 322;
  32575. t[264] = 261;
  32576. t[291] = 346;
  32577. });
  32578. exports.getStdFontMap = getStdFontMap;
  32579. exports.getNonStdFontMap = getNonStdFontMap;
  32580. exports.getSerifFonts = getSerifFonts;
  32581. exports.getSymbolsFonts = getSymbolsFonts;
  32582. exports.getGlyphMapForStandardFonts = getGlyphMapForStandardFonts;
  32583. exports.getSupplementalGlyphMapForArialBlack = getSupplementalGlyphMapForArialBlack;
  32584. /***/ }),
  32585. /* 18 */
  32586. /***/ (function(module, exports, __w_pdfjs_require__) {
  32587. "use strict";
  32588. var sharedUtil = __w_pdfjs_require__(0);
  32589. var getLookupTableFactory = sharedUtil.getLookupTableFactory;
  32590. var getSpecialPUASymbols = getLookupTableFactory(function (t) {
  32591. t[63721] = 0x00A9;
  32592. t[63193] = 0x00A9;
  32593. t[63720] = 0x00AE;
  32594. t[63194] = 0x00AE;
  32595. t[63722] = 0x2122;
  32596. t[63195] = 0x2122;
  32597. t[63729] = 0x23A7;
  32598. t[63730] = 0x23A8;
  32599. t[63731] = 0x23A9;
  32600. t[63740] = 0x23AB;
  32601. t[63741] = 0x23AC;
  32602. t[63742] = 0x23AD;
  32603. t[63726] = 0x23A1;
  32604. t[63727] = 0x23A2;
  32605. t[63728] = 0x23A3;
  32606. t[63737] = 0x23A4;
  32607. t[63738] = 0x23A5;
  32608. t[63739] = 0x23A6;
  32609. t[63723] = 0x239B;
  32610. t[63724] = 0x239C;
  32611. t[63725] = 0x239D;
  32612. t[63734] = 0x239E;
  32613. t[63735] = 0x239F;
  32614. t[63736] = 0x23A0;
  32615. });
  32616. function mapSpecialUnicodeValues(code) {
  32617. if (code >= 0xFFF0 && code <= 0xFFFF) {
  32618. return 0;
  32619. } else if (code >= 0xF600 && code <= 0xF8FF) {
  32620. return getSpecialPUASymbols()[code] || code;
  32621. }
  32622. return code;
  32623. }
  32624. function getUnicodeForGlyph(name, glyphsUnicodeMap) {
  32625. var unicode = glyphsUnicodeMap[name];
  32626. if (unicode !== undefined) {
  32627. return unicode;
  32628. }
  32629. if (!name) {
  32630. return -1;
  32631. }
  32632. if (name[0] === 'u') {
  32633. var nameLen = name.length, hexStr;
  32634. if (nameLen === 7 && name[1] === 'n' && name[2] === 'i') {
  32635. hexStr = name.substr(3);
  32636. } else if (nameLen >= 5 && nameLen <= 7) {
  32637. hexStr = name.substr(1);
  32638. } else {
  32639. return -1;
  32640. }
  32641. if (hexStr === hexStr.toUpperCase()) {
  32642. unicode = parseInt(hexStr, 16);
  32643. if (unicode >= 0) {
  32644. return unicode;
  32645. }
  32646. }
  32647. }
  32648. return -1;
  32649. }
  32650. var UnicodeRanges = [
  32651. {
  32652. 'begin': 0x0000,
  32653. 'end': 0x007F
  32654. },
  32655. {
  32656. 'begin': 0x0080,
  32657. 'end': 0x00FF
  32658. },
  32659. {
  32660. 'begin': 0x0100,
  32661. 'end': 0x017F
  32662. },
  32663. {
  32664. 'begin': 0x0180,
  32665. 'end': 0x024F
  32666. },
  32667. {
  32668. 'begin': 0x0250,
  32669. 'end': 0x02AF
  32670. },
  32671. {
  32672. 'begin': 0x02B0,
  32673. 'end': 0x02FF
  32674. },
  32675. {
  32676. 'begin': 0x0300,
  32677. 'end': 0x036F
  32678. },
  32679. {
  32680. 'begin': 0x0370,
  32681. 'end': 0x03FF
  32682. },
  32683. {
  32684. 'begin': 0x2C80,
  32685. 'end': 0x2CFF
  32686. },
  32687. {
  32688. 'begin': 0x0400,
  32689. 'end': 0x04FF
  32690. },
  32691. {
  32692. 'begin': 0x0530,
  32693. 'end': 0x058F
  32694. },
  32695. {
  32696. 'begin': 0x0590,
  32697. 'end': 0x05FF
  32698. },
  32699. {
  32700. 'begin': 0xA500,
  32701. 'end': 0xA63F
  32702. },
  32703. {
  32704. 'begin': 0x0600,
  32705. 'end': 0x06FF
  32706. },
  32707. {
  32708. 'begin': 0x07C0,
  32709. 'end': 0x07FF
  32710. },
  32711. {
  32712. 'begin': 0x0900,
  32713. 'end': 0x097F
  32714. },
  32715. {
  32716. 'begin': 0x0980,
  32717. 'end': 0x09FF
  32718. },
  32719. {
  32720. 'begin': 0x0A00,
  32721. 'end': 0x0A7F
  32722. },
  32723. {
  32724. 'begin': 0x0A80,
  32725. 'end': 0x0AFF
  32726. },
  32727. {
  32728. 'begin': 0x0B00,
  32729. 'end': 0x0B7F
  32730. },
  32731. {
  32732. 'begin': 0x0B80,
  32733. 'end': 0x0BFF
  32734. },
  32735. {
  32736. 'begin': 0x0C00,
  32737. 'end': 0x0C7F
  32738. },
  32739. {
  32740. 'begin': 0x0C80,
  32741. 'end': 0x0CFF
  32742. },
  32743. {
  32744. 'begin': 0x0D00,
  32745. 'end': 0x0D7F
  32746. },
  32747. {
  32748. 'begin': 0x0E00,
  32749. 'end': 0x0E7F
  32750. },
  32751. {
  32752. 'begin': 0x0E80,
  32753. 'end': 0x0EFF
  32754. },
  32755. {
  32756. 'begin': 0x10A0,
  32757. 'end': 0x10FF
  32758. },
  32759. {
  32760. 'begin': 0x1B00,
  32761. 'end': 0x1B7F
  32762. },
  32763. {
  32764. 'begin': 0x1100,
  32765. 'end': 0x11FF
  32766. },
  32767. {
  32768. 'begin': 0x1E00,
  32769. 'end': 0x1EFF
  32770. },
  32771. {
  32772. 'begin': 0x1F00,
  32773. 'end': 0x1FFF
  32774. },
  32775. {
  32776. 'begin': 0x2000,
  32777. 'end': 0x206F
  32778. },
  32779. {
  32780. 'begin': 0x2070,
  32781. 'end': 0x209F
  32782. },
  32783. {
  32784. 'begin': 0x20A0,
  32785. 'end': 0x20CF
  32786. },
  32787. {
  32788. 'begin': 0x20D0,
  32789. 'end': 0x20FF
  32790. },
  32791. {
  32792. 'begin': 0x2100,
  32793. 'end': 0x214F
  32794. },
  32795. {
  32796. 'begin': 0x2150,
  32797. 'end': 0x218F
  32798. },
  32799. {
  32800. 'begin': 0x2190,
  32801. 'end': 0x21FF
  32802. },
  32803. {
  32804. 'begin': 0x2200,
  32805. 'end': 0x22FF
  32806. },
  32807. {
  32808. 'begin': 0x2300,
  32809. 'end': 0x23FF
  32810. },
  32811. {
  32812. 'begin': 0x2400,
  32813. 'end': 0x243F
  32814. },
  32815. {
  32816. 'begin': 0x2440,
  32817. 'end': 0x245F
  32818. },
  32819. {
  32820. 'begin': 0x2460,
  32821. 'end': 0x24FF
  32822. },
  32823. {
  32824. 'begin': 0x2500,
  32825. 'end': 0x257F
  32826. },
  32827. {
  32828. 'begin': 0x2580,
  32829. 'end': 0x259F
  32830. },
  32831. {
  32832. 'begin': 0x25A0,
  32833. 'end': 0x25FF
  32834. },
  32835. {
  32836. 'begin': 0x2600,
  32837. 'end': 0x26FF
  32838. },
  32839. {
  32840. 'begin': 0x2700,
  32841. 'end': 0x27BF
  32842. },
  32843. {
  32844. 'begin': 0x3000,
  32845. 'end': 0x303F
  32846. },
  32847. {
  32848. 'begin': 0x3040,
  32849. 'end': 0x309F
  32850. },
  32851. {
  32852. 'begin': 0x30A0,
  32853. 'end': 0x30FF
  32854. },
  32855. {
  32856. 'begin': 0x3100,
  32857. 'end': 0x312F
  32858. },
  32859. {
  32860. 'begin': 0x3130,
  32861. 'end': 0x318F
  32862. },
  32863. {
  32864. 'begin': 0xA840,
  32865. 'end': 0xA87F
  32866. },
  32867. {
  32868. 'begin': 0x3200,
  32869. 'end': 0x32FF
  32870. },
  32871. {
  32872. 'begin': 0x3300,
  32873. 'end': 0x33FF
  32874. },
  32875. {
  32876. 'begin': 0xAC00,
  32877. 'end': 0xD7AF
  32878. },
  32879. {
  32880. 'begin': 0xD800,
  32881. 'end': 0xDFFF
  32882. },
  32883. {
  32884. 'begin': 0x10900,
  32885. 'end': 0x1091F
  32886. },
  32887. {
  32888. 'begin': 0x4E00,
  32889. 'end': 0x9FFF
  32890. },
  32891. {
  32892. 'begin': 0xE000,
  32893. 'end': 0xF8FF
  32894. },
  32895. {
  32896. 'begin': 0x31C0,
  32897. 'end': 0x31EF
  32898. },
  32899. {
  32900. 'begin': 0xFB00,
  32901. 'end': 0xFB4F
  32902. },
  32903. {
  32904. 'begin': 0xFB50,
  32905. 'end': 0xFDFF
  32906. },
  32907. {
  32908. 'begin': 0xFE20,
  32909. 'end': 0xFE2F
  32910. },
  32911. {
  32912. 'begin': 0xFE10,
  32913. 'end': 0xFE1F
  32914. },
  32915. {
  32916. 'begin': 0xFE50,
  32917. 'end': 0xFE6F
  32918. },
  32919. {
  32920. 'begin': 0xFE70,
  32921. 'end': 0xFEFF
  32922. },
  32923. {
  32924. 'begin': 0xFF00,
  32925. 'end': 0xFFEF
  32926. },
  32927. {
  32928. 'begin': 0xFFF0,
  32929. 'end': 0xFFFF
  32930. },
  32931. {
  32932. 'begin': 0x0F00,
  32933. 'end': 0x0FFF
  32934. },
  32935. {
  32936. 'begin': 0x0700,
  32937. 'end': 0x074F
  32938. },
  32939. {
  32940. 'begin': 0x0780,
  32941. 'end': 0x07BF
  32942. },
  32943. {
  32944. 'begin': 0x0D80,
  32945. 'end': 0x0DFF
  32946. },
  32947. {
  32948. 'begin': 0x1000,
  32949. 'end': 0x109F
  32950. },
  32951. {
  32952. 'begin': 0x1200,
  32953. 'end': 0x137F
  32954. },
  32955. {
  32956. 'begin': 0x13A0,
  32957. 'end': 0x13FF
  32958. },
  32959. {
  32960. 'begin': 0x1400,
  32961. 'end': 0x167F
  32962. },
  32963. {
  32964. 'begin': 0x1680,
  32965. 'end': 0x169F
  32966. },
  32967. {
  32968. 'begin': 0x16A0,
  32969. 'end': 0x16FF
  32970. },
  32971. {
  32972. 'begin': 0x1780,
  32973. 'end': 0x17FF
  32974. },
  32975. {
  32976. 'begin': 0x1800,
  32977. 'end': 0x18AF
  32978. },
  32979. {
  32980. 'begin': 0x2800,
  32981. 'end': 0x28FF
  32982. },
  32983. {
  32984. 'begin': 0xA000,
  32985. 'end': 0xA48F
  32986. },
  32987. {
  32988. 'begin': 0x1700,
  32989. 'end': 0x171F
  32990. },
  32991. {
  32992. 'begin': 0x10300,
  32993. 'end': 0x1032F
  32994. },
  32995. {
  32996. 'begin': 0x10330,
  32997. 'end': 0x1034F
  32998. },
  32999. {
  33000. 'begin': 0x10400,
  33001. 'end': 0x1044F
  33002. },
  33003. {
  33004. 'begin': 0x1D000,
  33005. 'end': 0x1D0FF
  33006. },
  33007. {
  33008. 'begin': 0x1D400,
  33009. 'end': 0x1D7FF
  33010. },
  33011. {
  33012. 'begin': 0xFF000,
  33013. 'end': 0xFFFFD
  33014. },
  33015. {
  33016. 'begin': 0xFE00,
  33017. 'end': 0xFE0F
  33018. },
  33019. {
  33020. 'begin': 0xE0000,
  33021. 'end': 0xE007F
  33022. },
  33023. {
  33024. 'begin': 0x1900,
  33025. 'end': 0x194F
  33026. },
  33027. {
  33028. 'begin': 0x1950,
  33029. 'end': 0x197F
  33030. },
  33031. {
  33032. 'begin': 0x1980,
  33033. 'end': 0x19DF
  33034. },
  33035. {
  33036. 'begin': 0x1A00,
  33037. 'end': 0x1A1F
  33038. },
  33039. {
  33040. 'begin': 0x2C00,
  33041. 'end': 0x2C5F
  33042. },
  33043. {
  33044. 'begin': 0x2D30,
  33045. 'end': 0x2D7F
  33046. },
  33047. {
  33048. 'begin': 0x4DC0,
  33049. 'end': 0x4DFF
  33050. },
  33051. {
  33052. 'begin': 0xA800,
  33053. 'end': 0xA82F
  33054. },
  33055. {
  33056. 'begin': 0x10000,
  33057. 'end': 0x1007F
  33058. },
  33059. {
  33060. 'begin': 0x10140,
  33061. 'end': 0x1018F
  33062. },
  33063. {
  33064. 'begin': 0x10380,
  33065. 'end': 0x1039F
  33066. },
  33067. {
  33068. 'begin': 0x103A0,
  33069. 'end': 0x103DF
  33070. },
  33071. {
  33072. 'begin': 0x10450,
  33073. 'end': 0x1047F
  33074. },
  33075. {
  33076. 'begin': 0x10480,
  33077. 'end': 0x104AF
  33078. },
  33079. {
  33080. 'begin': 0x10800,
  33081. 'end': 0x1083F
  33082. },
  33083. {
  33084. 'begin': 0x10A00,
  33085. 'end': 0x10A5F
  33086. },
  33087. {
  33088. 'begin': 0x1D300,
  33089. 'end': 0x1D35F
  33090. },
  33091. {
  33092. 'begin': 0x12000,
  33093. 'end': 0x123FF
  33094. },
  33095. {
  33096. 'begin': 0x1D360,
  33097. 'end': 0x1D37F
  33098. },
  33099. {
  33100. 'begin': 0x1B80,
  33101. 'end': 0x1BBF
  33102. },
  33103. {
  33104. 'begin': 0x1C00,
  33105. 'end': 0x1C4F
  33106. },
  33107. {
  33108. 'begin': 0x1C50,
  33109. 'end': 0x1C7F
  33110. },
  33111. {
  33112. 'begin': 0xA880,
  33113. 'end': 0xA8DF
  33114. },
  33115. {
  33116. 'begin': 0xA900,
  33117. 'end': 0xA92F
  33118. },
  33119. {
  33120. 'begin': 0xA930,
  33121. 'end': 0xA95F
  33122. },
  33123. {
  33124. 'begin': 0xAA00,
  33125. 'end': 0xAA5F
  33126. },
  33127. {
  33128. 'begin': 0x10190,
  33129. 'end': 0x101CF
  33130. },
  33131. {
  33132. 'begin': 0x101D0,
  33133. 'end': 0x101FF
  33134. },
  33135. {
  33136. 'begin': 0x102A0,
  33137. 'end': 0x102DF
  33138. },
  33139. {
  33140. 'begin': 0x1F030,
  33141. 'end': 0x1F09F
  33142. }
  33143. ];
  33144. function getUnicodeRangeFor(value) {
  33145. for (var i = 0, ii = UnicodeRanges.length; i < ii; i++) {
  33146. var range = UnicodeRanges[i];
  33147. if (value >= range.begin && value < range.end) {
  33148. return i;
  33149. }
  33150. }
  33151. return -1;
  33152. }
  33153. function isRTLRangeFor(value) {
  33154. var range = UnicodeRanges[13];
  33155. if (value >= range.begin && value < range.end) {
  33156. return true;
  33157. }
  33158. range = UnicodeRanges[11];
  33159. if (value >= range.begin && value < range.end) {
  33160. return true;
  33161. }
  33162. return false;
  33163. }
  33164. var getNormalizedUnicodes = getLookupTableFactory(function (t) {
  33165. t['\u00A8'] = '\u0020\u0308';
  33166. t['\u00AF'] = '\u0020\u0304';
  33167. t['\u00B4'] = '\u0020\u0301';
  33168. t['\u00B5'] = '\u03BC';
  33169. t['\u00B8'] = '\u0020\u0327';
  33170. t['\u0132'] = '\u0049\u004A';
  33171. t['\u0133'] = '\u0069\u006A';
  33172. t['\u013F'] = '\u004C\u00B7';
  33173. t['\u0140'] = '\u006C\u00B7';
  33174. t['\u0149'] = '\u02BC\u006E';
  33175. t['\u017F'] = '\u0073';
  33176. t['\u01C4'] = '\u0044\u017D';
  33177. t['\u01C5'] = '\u0044\u017E';
  33178. t['\u01C6'] = '\u0064\u017E';
  33179. t['\u01C7'] = '\u004C\u004A';
  33180. t['\u01C8'] = '\u004C\u006A';
  33181. t['\u01C9'] = '\u006C\u006A';
  33182. t['\u01CA'] = '\u004E\u004A';
  33183. t['\u01CB'] = '\u004E\u006A';
  33184. t['\u01CC'] = '\u006E\u006A';
  33185. t['\u01F1'] = '\u0044\u005A';
  33186. t['\u01F2'] = '\u0044\u007A';
  33187. t['\u01F3'] = '\u0064\u007A';
  33188. t['\u02D8'] = '\u0020\u0306';
  33189. t['\u02D9'] = '\u0020\u0307';
  33190. t['\u02DA'] = '\u0020\u030A';
  33191. t['\u02DB'] = '\u0020\u0328';
  33192. t['\u02DC'] = '\u0020\u0303';
  33193. t['\u02DD'] = '\u0020\u030B';
  33194. t['\u037A'] = '\u0020\u0345';
  33195. t['\u0384'] = '\u0020\u0301';
  33196. t['\u03D0'] = '\u03B2';
  33197. t['\u03D1'] = '\u03B8';
  33198. t['\u03D2'] = '\u03A5';
  33199. t['\u03D5'] = '\u03C6';
  33200. t['\u03D6'] = '\u03C0';
  33201. t['\u03F0'] = '\u03BA';
  33202. t['\u03F1'] = '\u03C1';
  33203. t['\u03F2'] = '\u03C2';
  33204. t['\u03F4'] = '\u0398';
  33205. t['\u03F5'] = '\u03B5';
  33206. t['\u03F9'] = '\u03A3';
  33207. t['\u0587'] = '\u0565\u0582';
  33208. t['\u0675'] = '\u0627\u0674';
  33209. t['\u0676'] = '\u0648\u0674';
  33210. t['\u0677'] = '\u06C7\u0674';
  33211. t['\u0678'] = '\u064A\u0674';
  33212. t['\u0E33'] = '\u0E4D\u0E32';
  33213. t['\u0EB3'] = '\u0ECD\u0EB2';
  33214. t['\u0EDC'] = '\u0EAB\u0E99';
  33215. t['\u0EDD'] = '\u0EAB\u0EA1';
  33216. t['\u0F77'] = '\u0FB2\u0F81';
  33217. t['\u0F79'] = '\u0FB3\u0F81';
  33218. t['\u1E9A'] = '\u0061\u02BE';
  33219. t['\u1FBD'] = '\u0020\u0313';
  33220. t['\u1FBF'] = '\u0020\u0313';
  33221. t['\u1FC0'] = '\u0020\u0342';
  33222. t['\u1FFE'] = '\u0020\u0314';
  33223. t['\u2002'] = '\u0020';
  33224. t['\u2003'] = '\u0020';
  33225. t['\u2004'] = '\u0020';
  33226. t['\u2005'] = '\u0020';
  33227. t['\u2006'] = '\u0020';
  33228. t['\u2008'] = '\u0020';
  33229. t['\u2009'] = '\u0020';
  33230. t['\u200A'] = '\u0020';
  33231. t['\u2017'] = '\u0020\u0333';
  33232. t['\u2024'] = '\u002E';
  33233. t['\u2025'] = '\u002E\u002E';
  33234. t['\u2026'] = '\u002E\u002E\u002E';
  33235. t['\u2033'] = '\u2032\u2032';
  33236. t['\u2034'] = '\u2032\u2032\u2032';
  33237. t['\u2036'] = '\u2035\u2035';
  33238. t['\u2037'] = '\u2035\u2035\u2035';
  33239. t['\u203C'] = '\u0021\u0021';
  33240. t['\u203E'] = '\u0020\u0305';
  33241. t['\u2047'] = '\u003F\u003F';
  33242. t['\u2048'] = '\u003F\u0021';
  33243. t['\u2049'] = '\u0021\u003F';
  33244. t['\u2057'] = '\u2032\u2032\u2032\u2032';
  33245. t['\u205F'] = '\u0020';
  33246. t['\u20A8'] = '\u0052\u0073';
  33247. t['\u2100'] = '\u0061\u002F\u0063';
  33248. t['\u2101'] = '\u0061\u002F\u0073';
  33249. t['\u2103'] = '\u00B0\u0043';
  33250. t['\u2105'] = '\u0063\u002F\u006F';
  33251. t['\u2106'] = '\u0063\u002F\u0075';
  33252. t['\u2107'] = '\u0190';
  33253. t['\u2109'] = '\u00B0\u0046';
  33254. t['\u2116'] = '\u004E\u006F';
  33255. t['\u2121'] = '\u0054\u0045\u004C';
  33256. t['\u2135'] = '\u05D0';
  33257. t['\u2136'] = '\u05D1';
  33258. t['\u2137'] = '\u05D2';
  33259. t['\u2138'] = '\u05D3';
  33260. t['\u213B'] = '\u0046\u0041\u0058';
  33261. t['\u2160'] = '\u0049';
  33262. t['\u2161'] = '\u0049\u0049';
  33263. t['\u2162'] = '\u0049\u0049\u0049';
  33264. t['\u2163'] = '\u0049\u0056';
  33265. t['\u2164'] = '\u0056';
  33266. t['\u2165'] = '\u0056\u0049';
  33267. t['\u2166'] = '\u0056\u0049\u0049';
  33268. t['\u2167'] = '\u0056\u0049\u0049\u0049';
  33269. t['\u2168'] = '\u0049\u0058';
  33270. t['\u2169'] = '\u0058';
  33271. t['\u216A'] = '\u0058\u0049';
  33272. t['\u216B'] = '\u0058\u0049\u0049';
  33273. t['\u216C'] = '\u004C';
  33274. t['\u216D'] = '\u0043';
  33275. t['\u216E'] = '\u0044';
  33276. t['\u216F'] = '\u004D';
  33277. t['\u2170'] = '\u0069';
  33278. t['\u2171'] = '\u0069\u0069';
  33279. t['\u2172'] = '\u0069\u0069\u0069';
  33280. t['\u2173'] = '\u0069\u0076';
  33281. t['\u2174'] = '\u0076';
  33282. t['\u2175'] = '\u0076\u0069';
  33283. t['\u2176'] = '\u0076\u0069\u0069';
  33284. t['\u2177'] = '\u0076\u0069\u0069\u0069';
  33285. t['\u2178'] = '\u0069\u0078';
  33286. t['\u2179'] = '\u0078';
  33287. t['\u217A'] = '\u0078\u0069';
  33288. t['\u217B'] = '\u0078\u0069\u0069';
  33289. t['\u217C'] = '\u006C';
  33290. t['\u217D'] = '\u0063';
  33291. t['\u217E'] = '\u0064';
  33292. t['\u217F'] = '\u006D';
  33293. t['\u222C'] = '\u222B\u222B';
  33294. t['\u222D'] = '\u222B\u222B\u222B';
  33295. t['\u222F'] = '\u222E\u222E';
  33296. t['\u2230'] = '\u222E\u222E\u222E';
  33297. t['\u2474'] = '\u0028\u0031\u0029';
  33298. t['\u2475'] = '\u0028\u0032\u0029';
  33299. t['\u2476'] = '\u0028\u0033\u0029';
  33300. t['\u2477'] = '\u0028\u0034\u0029';
  33301. t['\u2478'] = '\u0028\u0035\u0029';
  33302. t['\u2479'] = '\u0028\u0036\u0029';
  33303. t['\u247A'] = '\u0028\u0037\u0029';
  33304. t['\u247B'] = '\u0028\u0038\u0029';
  33305. t['\u247C'] = '\u0028\u0039\u0029';
  33306. t['\u247D'] = '\u0028\u0031\u0030\u0029';
  33307. t['\u247E'] = '\u0028\u0031\u0031\u0029';
  33308. t['\u247F'] = '\u0028\u0031\u0032\u0029';
  33309. t['\u2480'] = '\u0028\u0031\u0033\u0029';
  33310. t['\u2481'] = '\u0028\u0031\u0034\u0029';
  33311. t['\u2482'] = '\u0028\u0031\u0035\u0029';
  33312. t['\u2483'] = '\u0028\u0031\u0036\u0029';
  33313. t['\u2484'] = '\u0028\u0031\u0037\u0029';
  33314. t['\u2485'] = '\u0028\u0031\u0038\u0029';
  33315. t['\u2486'] = '\u0028\u0031\u0039\u0029';
  33316. t['\u2487'] = '\u0028\u0032\u0030\u0029';
  33317. t['\u2488'] = '\u0031\u002E';
  33318. t['\u2489'] = '\u0032\u002E';
  33319. t['\u248A'] = '\u0033\u002E';
  33320. t['\u248B'] = '\u0034\u002E';
  33321. t['\u248C'] = '\u0035\u002E';
  33322. t['\u248D'] = '\u0036\u002E';
  33323. t['\u248E'] = '\u0037\u002E';
  33324. t['\u248F'] = '\u0038\u002E';
  33325. t['\u2490'] = '\u0039\u002E';
  33326. t['\u2491'] = '\u0031\u0030\u002E';
  33327. t['\u2492'] = '\u0031\u0031\u002E';
  33328. t['\u2493'] = '\u0031\u0032\u002E';
  33329. t['\u2494'] = '\u0031\u0033\u002E';
  33330. t['\u2495'] = '\u0031\u0034\u002E';
  33331. t['\u2496'] = '\u0031\u0035\u002E';
  33332. t['\u2497'] = '\u0031\u0036\u002E';
  33333. t['\u2498'] = '\u0031\u0037\u002E';
  33334. t['\u2499'] = '\u0031\u0038\u002E';
  33335. t['\u249A'] = '\u0031\u0039\u002E';
  33336. t['\u249B'] = '\u0032\u0030\u002E';
  33337. t['\u249C'] = '\u0028\u0061\u0029';
  33338. t['\u249D'] = '\u0028\u0062\u0029';
  33339. t['\u249E'] = '\u0028\u0063\u0029';
  33340. t['\u249F'] = '\u0028\u0064\u0029';
  33341. t['\u24A0'] = '\u0028\u0065\u0029';
  33342. t['\u24A1'] = '\u0028\u0066\u0029';
  33343. t['\u24A2'] = '\u0028\u0067\u0029';
  33344. t['\u24A3'] = '\u0028\u0068\u0029';
  33345. t['\u24A4'] = '\u0028\u0069\u0029';
  33346. t['\u24A5'] = '\u0028\u006A\u0029';
  33347. t['\u24A6'] = '\u0028\u006B\u0029';
  33348. t['\u24A7'] = '\u0028\u006C\u0029';
  33349. t['\u24A8'] = '\u0028\u006D\u0029';
  33350. t['\u24A9'] = '\u0028\u006E\u0029';
  33351. t['\u24AA'] = '\u0028\u006F\u0029';
  33352. t['\u24AB'] = '\u0028\u0070\u0029';
  33353. t['\u24AC'] = '\u0028\u0071\u0029';
  33354. t['\u24AD'] = '\u0028\u0072\u0029';
  33355. t['\u24AE'] = '\u0028\u0073\u0029';
  33356. t['\u24AF'] = '\u0028\u0074\u0029';
  33357. t['\u24B0'] = '\u0028\u0075\u0029';
  33358. t['\u24B1'] = '\u0028\u0076\u0029';
  33359. t['\u24B2'] = '\u0028\u0077\u0029';
  33360. t['\u24B3'] = '\u0028\u0078\u0029';
  33361. t['\u24B4'] = '\u0028\u0079\u0029';
  33362. t['\u24B5'] = '\u0028\u007A\u0029';
  33363. t['\u2A0C'] = '\u222B\u222B\u222B\u222B';
  33364. t['\u2A74'] = '\u003A\u003A\u003D';
  33365. t['\u2A75'] = '\u003D\u003D';
  33366. t['\u2A76'] = '\u003D\u003D\u003D';
  33367. t['\u2E9F'] = '\u6BCD';
  33368. t['\u2EF3'] = '\u9F9F';
  33369. t['\u2F00'] = '\u4E00';
  33370. t['\u2F01'] = '\u4E28';
  33371. t['\u2F02'] = '\u4E36';
  33372. t['\u2F03'] = '\u4E3F';
  33373. t['\u2F04'] = '\u4E59';
  33374. t['\u2F05'] = '\u4E85';
  33375. t['\u2F06'] = '\u4E8C';
  33376. t['\u2F07'] = '\u4EA0';
  33377. t['\u2F08'] = '\u4EBA';
  33378. t['\u2F09'] = '\u513F';
  33379. t['\u2F0A'] = '\u5165';
  33380. t['\u2F0B'] = '\u516B';
  33381. t['\u2F0C'] = '\u5182';
  33382. t['\u2F0D'] = '\u5196';
  33383. t['\u2F0E'] = '\u51AB';
  33384. t['\u2F0F'] = '\u51E0';
  33385. t['\u2F10'] = '\u51F5';
  33386. t['\u2F11'] = '\u5200';
  33387. t['\u2F12'] = '\u529B';
  33388. t['\u2F13'] = '\u52F9';
  33389. t['\u2F14'] = '\u5315';
  33390. t['\u2F15'] = '\u531A';
  33391. t['\u2F16'] = '\u5338';
  33392. t['\u2F17'] = '\u5341';
  33393. t['\u2F18'] = '\u535C';
  33394. t['\u2F19'] = '\u5369';
  33395. t['\u2F1A'] = '\u5382';
  33396. t['\u2F1B'] = '\u53B6';
  33397. t['\u2F1C'] = '\u53C8';
  33398. t['\u2F1D'] = '\u53E3';
  33399. t['\u2F1E'] = '\u56D7';
  33400. t['\u2F1F'] = '\u571F';
  33401. t['\u2F20'] = '\u58EB';
  33402. t['\u2F21'] = '\u5902';
  33403. t['\u2F22'] = '\u590A';
  33404. t['\u2F23'] = '\u5915';
  33405. t['\u2F24'] = '\u5927';
  33406. t['\u2F25'] = '\u5973';
  33407. t['\u2F26'] = '\u5B50';
  33408. t['\u2F27'] = '\u5B80';
  33409. t['\u2F28'] = '\u5BF8';
  33410. t['\u2F29'] = '\u5C0F';
  33411. t['\u2F2A'] = '\u5C22';
  33412. t['\u2F2B'] = '\u5C38';
  33413. t['\u2F2C'] = '\u5C6E';
  33414. t['\u2F2D'] = '\u5C71';
  33415. t['\u2F2E'] = '\u5DDB';
  33416. t['\u2F2F'] = '\u5DE5';
  33417. t['\u2F30'] = '\u5DF1';
  33418. t['\u2F31'] = '\u5DFE';
  33419. t['\u2F32'] = '\u5E72';
  33420. t['\u2F33'] = '\u5E7A';
  33421. t['\u2F34'] = '\u5E7F';
  33422. t['\u2F35'] = '\u5EF4';
  33423. t['\u2F36'] = '\u5EFE';
  33424. t['\u2F37'] = '\u5F0B';
  33425. t['\u2F38'] = '\u5F13';
  33426. t['\u2F39'] = '\u5F50';
  33427. t['\u2F3A'] = '\u5F61';
  33428. t['\u2F3B'] = '\u5F73';
  33429. t['\u2F3C'] = '\u5FC3';
  33430. t['\u2F3D'] = '\u6208';
  33431. t['\u2F3E'] = '\u6236';
  33432. t['\u2F3F'] = '\u624B';
  33433. t['\u2F40'] = '\u652F';
  33434. t['\u2F41'] = '\u6534';
  33435. t['\u2F42'] = '\u6587';
  33436. t['\u2F43'] = '\u6597';
  33437. t['\u2F44'] = '\u65A4';
  33438. t['\u2F45'] = '\u65B9';
  33439. t['\u2F46'] = '\u65E0';
  33440. t['\u2F47'] = '\u65E5';
  33441. t['\u2F48'] = '\u66F0';
  33442. t['\u2F49'] = '\u6708';
  33443. t['\u2F4A'] = '\u6728';
  33444. t['\u2F4B'] = '\u6B20';
  33445. t['\u2F4C'] = '\u6B62';
  33446. t['\u2F4D'] = '\u6B79';
  33447. t['\u2F4E'] = '\u6BB3';
  33448. t['\u2F4F'] = '\u6BCB';
  33449. t['\u2F50'] = '\u6BD4';
  33450. t['\u2F51'] = '\u6BDB';
  33451. t['\u2F52'] = '\u6C0F';
  33452. t['\u2F53'] = '\u6C14';
  33453. t['\u2F54'] = '\u6C34';
  33454. t['\u2F55'] = '\u706B';
  33455. t['\u2F56'] = '\u722A';
  33456. t['\u2F57'] = '\u7236';
  33457. t['\u2F58'] = '\u723B';
  33458. t['\u2F59'] = '\u723F';
  33459. t['\u2F5A'] = '\u7247';
  33460. t['\u2F5B'] = '\u7259';
  33461. t['\u2F5C'] = '\u725B';
  33462. t['\u2F5D'] = '\u72AC';
  33463. t['\u2F5E'] = '\u7384';
  33464. t['\u2F5F'] = '\u7389';
  33465. t['\u2F60'] = '\u74DC';
  33466. t['\u2F61'] = '\u74E6';
  33467. t['\u2F62'] = '\u7518';
  33468. t['\u2F63'] = '\u751F';
  33469. t['\u2F64'] = '\u7528';
  33470. t['\u2F65'] = '\u7530';
  33471. t['\u2F66'] = '\u758B';
  33472. t['\u2F67'] = '\u7592';
  33473. t['\u2F68'] = '\u7676';
  33474. t['\u2F69'] = '\u767D';
  33475. t['\u2F6A'] = '\u76AE';
  33476. t['\u2F6B'] = '\u76BF';
  33477. t['\u2F6C'] = '\u76EE';
  33478. t['\u2F6D'] = '\u77DB';
  33479. t['\u2F6E'] = '\u77E2';
  33480. t['\u2F6F'] = '\u77F3';
  33481. t['\u2F70'] = '\u793A';
  33482. t['\u2F71'] = '\u79B8';
  33483. t['\u2F72'] = '\u79BE';
  33484. t['\u2F73'] = '\u7A74';
  33485. t['\u2F74'] = '\u7ACB';
  33486. t['\u2F75'] = '\u7AF9';
  33487. t['\u2F76'] = '\u7C73';
  33488. t['\u2F77'] = '\u7CF8';
  33489. t['\u2F78'] = '\u7F36';
  33490. t['\u2F79'] = '\u7F51';
  33491. t['\u2F7A'] = '\u7F8A';
  33492. t['\u2F7B'] = '\u7FBD';
  33493. t['\u2F7C'] = '\u8001';
  33494. t['\u2F7D'] = '\u800C';
  33495. t['\u2F7E'] = '\u8012';
  33496. t['\u2F7F'] = '\u8033';
  33497. t['\u2F80'] = '\u807F';
  33498. t['\u2F81'] = '\u8089';
  33499. t['\u2F82'] = '\u81E3';
  33500. t['\u2F83'] = '\u81EA';
  33501. t['\u2F84'] = '\u81F3';
  33502. t['\u2F85'] = '\u81FC';
  33503. t['\u2F86'] = '\u820C';
  33504. t['\u2F87'] = '\u821B';
  33505. t['\u2F88'] = '\u821F';
  33506. t['\u2F89'] = '\u826E';
  33507. t['\u2F8A'] = '\u8272';
  33508. t['\u2F8B'] = '\u8278';
  33509. t['\u2F8C'] = '\u864D';
  33510. t['\u2F8D'] = '\u866B';
  33511. t['\u2F8E'] = '\u8840';
  33512. t['\u2F8F'] = '\u884C';
  33513. t['\u2F90'] = '\u8863';
  33514. t['\u2F91'] = '\u897E';
  33515. t['\u2F92'] = '\u898B';
  33516. t['\u2F93'] = '\u89D2';
  33517. t['\u2F94'] = '\u8A00';
  33518. t['\u2F95'] = '\u8C37';
  33519. t['\u2F96'] = '\u8C46';
  33520. t['\u2F97'] = '\u8C55';
  33521. t['\u2F98'] = '\u8C78';
  33522. t['\u2F99'] = '\u8C9D';
  33523. t['\u2F9A'] = '\u8D64';
  33524. t['\u2F9B'] = '\u8D70';
  33525. t['\u2F9C'] = '\u8DB3';
  33526. t['\u2F9D'] = '\u8EAB';
  33527. t['\u2F9E'] = '\u8ECA';
  33528. t['\u2F9F'] = '\u8F9B';
  33529. t['\u2FA0'] = '\u8FB0';
  33530. t['\u2FA1'] = '\u8FB5';
  33531. t['\u2FA2'] = '\u9091';
  33532. t['\u2FA3'] = '\u9149';
  33533. t['\u2FA4'] = '\u91C6';
  33534. t['\u2FA5'] = '\u91CC';
  33535. t['\u2FA6'] = '\u91D1';
  33536. t['\u2FA7'] = '\u9577';
  33537. t['\u2FA8'] = '\u9580';
  33538. t['\u2FA9'] = '\u961C';
  33539. t['\u2FAA'] = '\u96B6';
  33540. t['\u2FAB'] = '\u96B9';
  33541. t['\u2FAC'] = '\u96E8';
  33542. t['\u2FAD'] = '\u9751';
  33543. t['\u2FAE'] = '\u975E';
  33544. t['\u2FAF'] = '\u9762';
  33545. t['\u2FB0'] = '\u9769';
  33546. t['\u2FB1'] = '\u97CB';
  33547. t['\u2FB2'] = '\u97ED';
  33548. t['\u2FB3'] = '\u97F3';
  33549. t['\u2FB4'] = '\u9801';
  33550. t['\u2FB5'] = '\u98A8';
  33551. t['\u2FB6'] = '\u98DB';
  33552. t['\u2FB7'] = '\u98DF';
  33553. t['\u2FB8'] = '\u9996';
  33554. t['\u2FB9'] = '\u9999';
  33555. t['\u2FBA'] = '\u99AC';
  33556. t['\u2FBB'] = '\u9AA8';
  33557. t['\u2FBC'] = '\u9AD8';
  33558. t['\u2FBD'] = '\u9ADF';
  33559. t['\u2FBE'] = '\u9B25';
  33560. t['\u2FBF'] = '\u9B2F';
  33561. t['\u2FC0'] = '\u9B32';
  33562. t['\u2FC1'] = '\u9B3C';
  33563. t['\u2FC2'] = '\u9B5A';
  33564. t['\u2FC3'] = '\u9CE5';
  33565. t['\u2FC4'] = '\u9E75';
  33566. t['\u2FC5'] = '\u9E7F';
  33567. t['\u2FC6'] = '\u9EA5';
  33568. t['\u2FC7'] = '\u9EBB';
  33569. t['\u2FC8'] = '\u9EC3';
  33570. t['\u2FC9'] = '\u9ECD';
  33571. t['\u2FCA'] = '\u9ED1';
  33572. t['\u2FCB'] = '\u9EF9';
  33573. t['\u2FCC'] = '\u9EFD';
  33574. t['\u2FCD'] = '\u9F0E';
  33575. t['\u2FCE'] = '\u9F13';
  33576. t['\u2FCF'] = '\u9F20';
  33577. t['\u2FD0'] = '\u9F3B';
  33578. t['\u2FD1'] = '\u9F4A';
  33579. t['\u2FD2'] = '\u9F52';
  33580. t['\u2FD3'] = '\u9F8D';
  33581. t['\u2FD4'] = '\u9F9C';
  33582. t['\u2FD5'] = '\u9FA0';
  33583. t['\u3036'] = '\u3012';
  33584. t['\u3038'] = '\u5341';
  33585. t['\u3039'] = '\u5344';
  33586. t['\u303A'] = '\u5345';
  33587. t['\u309B'] = '\u0020\u3099';
  33588. t['\u309C'] = '\u0020\u309A';
  33589. t['\u3131'] = '\u1100';
  33590. t['\u3132'] = '\u1101';
  33591. t['\u3133'] = '\u11AA';
  33592. t['\u3134'] = '\u1102';
  33593. t['\u3135'] = '\u11AC';
  33594. t['\u3136'] = '\u11AD';
  33595. t['\u3137'] = '\u1103';
  33596. t['\u3138'] = '\u1104';
  33597. t['\u3139'] = '\u1105';
  33598. t['\u313A'] = '\u11B0';
  33599. t['\u313B'] = '\u11B1';
  33600. t['\u313C'] = '\u11B2';
  33601. t['\u313D'] = '\u11B3';
  33602. t['\u313E'] = '\u11B4';
  33603. t['\u313F'] = '\u11B5';
  33604. t['\u3140'] = '\u111A';
  33605. t['\u3141'] = '\u1106';
  33606. t['\u3142'] = '\u1107';
  33607. t['\u3143'] = '\u1108';
  33608. t['\u3144'] = '\u1121';
  33609. t['\u3145'] = '\u1109';
  33610. t['\u3146'] = '\u110A';
  33611. t['\u3147'] = '\u110B';
  33612. t['\u3148'] = '\u110C';
  33613. t['\u3149'] = '\u110D';
  33614. t['\u314A'] = '\u110E';
  33615. t['\u314B'] = '\u110F';
  33616. t['\u314C'] = '\u1110';
  33617. t['\u314D'] = '\u1111';
  33618. t['\u314E'] = '\u1112';
  33619. t['\u314F'] = '\u1161';
  33620. t['\u3150'] = '\u1162';
  33621. t['\u3151'] = '\u1163';
  33622. t['\u3152'] = '\u1164';
  33623. t['\u3153'] = '\u1165';
  33624. t['\u3154'] = '\u1166';
  33625. t['\u3155'] = '\u1167';
  33626. t['\u3156'] = '\u1168';
  33627. t['\u3157'] = '\u1169';
  33628. t['\u3158'] = '\u116A';
  33629. t['\u3159'] = '\u116B';
  33630. t['\u315A'] = '\u116C';
  33631. t['\u315B'] = '\u116D';
  33632. t['\u315C'] = '\u116E';
  33633. t['\u315D'] = '\u116F';
  33634. t['\u315E'] = '\u1170';
  33635. t['\u315F'] = '\u1171';
  33636. t['\u3160'] = '\u1172';
  33637. t['\u3161'] = '\u1173';
  33638. t['\u3162'] = '\u1174';
  33639. t['\u3163'] = '\u1175';
  33640. t['\u3164'] = '\u1160';
  33641. t['\u3165'] = '\u1114';
  33642. t['\u3166'] = '\u1115';
  33643. t['\u3167'] = '\u11C7';
  33644. t['\u3168'] = '\u11C8';
  33645. t['\u3169'] = '\u11CC';
  33646. t['\u316A'] = '\u11CE';
  33647. t['\u316B'] = '\u11D3';
  33648. t['\u316C'] = '\u11D7';
  33649. t['\u316D'] = '\u11D9';
  33650. t['\u316E'] = '\u111C';
  33651. t['\u316F'] = '\u11DD';
  33652. t['\u3170'] = '\u11DF';
  33653. t['\u3171'] = '\u111D';
  33654. t['\u3172'] = '\u111E';
  33655. t['\u3173'] = '\u1120';
  33656. t['\u3174'] = '\u1122';
  33657. t['\u3175'] = '\u1123';
  33658. t['\u3176'] = '\u1127';
  33659. t['\u3177'] = '\u1129';
  33660. t['\u3178'] = '\u112B';
  33661. t['\u3179'] = '\u112C';
  33662. t['\u317A'] = '\u112D';
  33663. t['\u317B'] = '\u112E';
  33664. t['\u317C'] = '\u112F';
  33665. t['\u317D'] = '\u1132';
  33666. t['\u317E'] = '\u1136';
  33667. t['\u317F'] = '\u1140';
  33668. t['\u3180'] = '\u1147';
  33669. t['\u3181'] = '\u114C';
  33670. t['\u3182'] = '\u11F1';
  33671. t['\u3183'] = '\u11F2';
  33672. t['\u3184'] = '\u1157';
  33673. t['\u3185'] = '\u1158';
  33674. t['\u3186'] = '\u1159';
  33675. t['\u3187'] = '\u1184';
  33676. t['\u3188'] = '\u1185';
  33677. t['\u3189'] = '\u1188';
  33678. t['\u318A'] = '\u1191';
  33679. t['\u318B'] = '\u1192';
  33680. t['\u318C'] = '\u1194';
  33681. t['\u318D'] = '\u119E';
  33682. t['\u318E'] = '\u11A1';
  33683. t['\u3200'] = '\u0028\u1100\u0029';
  33684. t['\u3201'] = '\u0028\u1102\u0029';
  33685. t['\u3202'] = '\u0028\u1103\u0029';
  33686. t['\u3203'] = '\u0028\u1105\u0029';
  33687. t['\u3204'] = '\u0028\u1106\u0029';
  33688. t['\u3205'] = '\u0028\u1107\u0029';
  33689. t['\u3206'] = '\u0028\u1109\u0029';
  33690. t['\u3207'] = '\u0028\u110B\u0029';
  33691. t['\u3208'] = '\u0028\u110C\u0029';
  33692. t['\u3209'] = '\u0028\u110E\u0029';
  33693. t['\u320A'] = '\u0028\u110F\u0029';
  33694. t['\u320B'] = '\u0028\u1110\u0029';
  33695. t['\u320C'] = '\u0028\u1111\u0029';
  33696. t['\u320D'] = '\u0028\u1112\u0029';
  33697. t['\u320E'] = '\u0028\u1100\u1161\u0029';
  33698. t['\u320F'] = '\u0028\u1102\u1161\u0029';
  33699. t['\u3210'] = '\u0028\u1103\u1161\u0029';
  33700. t['\u3211'] = '\u0028\u1105\u1161\u0029';
  33701. t['\u3212'] = '\u0028\u1106\u1161\u0029';
  33702. t['\u3213'] = '\u0028\u1107\u1161\u0029';
  33703. t['\u3214'] = '\u0028\u1109\u1161\u0029';
  33704. t['\u3215'] = '\u0028\u110B\u1161\u0029';
  33705. t['\u3216'] = '\u0028\u110C\u1161\u0029';
  33706. t['\u3217'] = '\u0028\u110E\u1161\u0029';
  33707. t['\u3218'] = '\u0028\u110F\u1161\u0029';
  33708. t['\u3219'] = '\u0028\u1110\u1161\u0029';
  33709. t['\u321A'] = '\u0028\u1111\u1161\u0029';
  33710. t['\u321B'] = '\u0028\u1112\u1161\u0029';
  33711. t['\u321C'] = '\u0028\u110C\u116E\u0029';
  33712. t['\u321D'] = '\u0028\u110B\u1169\u110C\u1165\u11AB\u0029';
  33713. t['\u321E'] = '\u0028\u110B\u1169\u1112\u116E\u0029';
  33714. t['\u3220'] = '\u0028\u4E00\u0029';
  33715. t['\u3221'] = '\u0028\u4E8C\u0029';
  33716. t['\u3222'] = '\u0028\u4E09\u0029';
  33717. t['\u3223'] = '\u0028\u56DB\u0029';
  33718. t['\u3224'] = '\u0028\u4E94\u0029';
  33719. t['\u3225'] = '\u0028\u516D\u0029';
  33720. t['\u3226'] = '\u0028\u4E03\u0029';
  33721. t['\u3227'] = '\u0028\u516B\u0029';
  33722. t['\u3228'] = '\u0028\u4E5D\u0029';
  33723. t['\u3229'] = '\u0028\u5341\u0029';
  33724. t['\u322A'] = '\u0028\u6708\u0029';
  33725. t['\u322B'] = '\u0028\u706B\u0029';
  33726. t['\u322C'] = '\u0028\u6C34\u0029';
  33727. t['\u322D'] = '\u0028\u6728\u0029';
  33728. t['\u322E'] = '\u0028\u91D1\u0029';
  33729. t['\u322F'] = '\u0028\u571F\u0029';
  33730. t['\u3230'] = '\u0028\u65E5\u0029';
  33731. t['\u3231'] = '\u0028\u682A\u0029';
  33732. t['\u3232'] = '\u0028\u6709\u0029';
  33733. t['\u3233'] = '\u0028\u793E\u0029';
  33734. t['\u3234'] = '\u0028\u540D\u0029';
  33735. t['\u3235'] = '\u0028\u7279\u0029';
  33736. t['\u3236'] = '\u0028\u8CA1\u0029';
  33737. t['\u3237'] = '\u0028\u795D\u0029';
  33738. t['\u3238'] = '\u0028\u52B4\u0029';
  33739. t['\u3239'] = '\u0028\u4EE3\u0029';
  33740. t['\u323A'] = '\u0028\u547C\u0029';
  33741. t['\u323B'] = '\u0028\u5B66\u0029';
  33742. t['\u323C'] = '\u0028\u76E3\u0029';
  33743. t['\u323D'] = '\u0028\u4F01\u0029';
  33744. t['\u323E'] = '\u0028\u8CC7\u0029';
  33745. t['\u323F'] = '\u0028\u5354\u0029';
  33746. t['\u3240'] = '\u0028\u796D\u0029';
  33747. t['\u3241'] = '\u0028\u4F11\u0029';
  33748. t['\u3242'] = '\u0028\u81EA\u0029';
  33749. t['\u3243'] = '\u0028\u81F3\u0029';
  33750. t['\u32C0'] = '\u0031\u6708';
  33751. t['\u32C1'] = '\u0032\u6708';
  33752. t['\u32C2'] = '\u0033\u6708';
  33753. t['\u32C3'] = '\u0034\u6708';
  33754. t['\u32C4'] = '\u0035\u6708';
  33755. t['\u32C5'] = '\u0036\u6708';
  33756. t['\u32C6'] = '\u0037\u6708';
  33757. t['\u32C7'] = '\u0038\u6708';
  33758. t['\u32C8'] = '\u0039\u6708';
  33759. t['\u32C9'] = '\u0031\u0030\u6708';
  33760. t['\u32CA'] = '\u0031\u0031\u6708';
  33761. t['\u32CB'] = '\u0031\u0032\u6708';
  33762. t['\u3358'] = '\u0030\u70B9';
  33763. t['\u3359'] = '\u0031\u70B9';
  33764. t['\u335A'] = '\u0032\u70B9';
  33765. t['\u335B'] = '\u0033\u70B9';
  33766. t['\u335C'] = '\u0034\u70B9';
  33767. t['\u335D'] = '\u0035\u70B9';
  33768. t['\u335E'] = '\u0036\u70B9';
  33769. t['\u335F'] = '\u0037\u70B9';
  33770. t['\u3360'] = '\u0038\u70B9';
  33771. t['\u3361'] = '\u0039\u70B9';
  33772. t['\u3362'] = '\u0031\u0030\u70B9';
  33773. t['\u3363'] = '\u0031\u0031\u70B9';
  33774. t['\u3364'] = '\u0031\u0032\u70B9';
  33775. t['\u3365'] = '\u0031\u0033\u70B9';
  33776. t['\u3366'] = '\u0031\u0034\u70B9';
  33777. t['\u3367'] = '\u0031\u0035\u70B9';
  33778. t['\u3368'] = '\u0031\u0036\u70B9';
  33779. t['\u3369'] = '\u0031\u0037\u70B9';
  33780. t['\u336A'] = '\u0031\u0038\u70B9';
  33781. t['\u336B'] = '\u0031\u0039\u70B9';
  33782. t['\u336C'] = '\u0032\u0030\u70B9';
  33783. t['\u336D'] = '\u0032\u0031\u70B9';
  33784. t['\u336E'] = '\u0032\u0032\u70B9';
  33785. t['\u336F'] = '\u0032\u0033\u70B9';
  33786. t['\u3370'] = '\u0032\u0034\u70B9';
  33787. t['\u33E0'] = '\u0031\u65E5';
  33788. t['\u33E1'] = '\u0032\u65E5';
  33789. t['\u33E2'] = '\u0033\u65E5';
  33790. t['\u33E3'] = '\u0034\u65E5';
  33791. t['\u33E4'] = '\u0035\u65E5';
  33792. t['\u33E5'] = '\u0036\u65E5';
  33793. t['\u33E6'] = '\u0037\u65E5';
  33794. t['\u33E7'] = '\u0038\u65E5';
  33795. t['\u33E8'] = '\u0039\u65E5';
  33796. t['\u33E9'] = '\u0031\u0030\u65E5';
  33797. t['\u33EA'] = '\u0031\u0031\u65E5';
  33798. t['\u33EB'] = '\u0031\u0032\u65E5';
  33799. t['\u33EC'] = '\u0031\u0033\u65E5';
  33800. t['\u33ED'] = '\u0031\u0034\u65E5';
  33801. t['\u33EE'] = '\u0031\u0035\u65E5';
  33802. t['\u33EF'] = '\u0031\u0036\u65E5';
  33803. t['\u33F0'] = '\u0031\u0037\u65E5';
  33804. t['\u33F1'] = '\u0031\u0038\u65E5';
  33805. t['\u33F2'] = '\u0031\u0039\u65E5';
  33806. t['\u33F3'] = '\u0032\u0030\u65E5';
  33807. t['\u33F4'] = '\u0032\u0031\u65E5';
  33808. t['\u33F5'] = '\u0032\u0032\u65E5';
  33809. t['\u33F6'] = '\u0032\u0033\u65E5';
  33810. t['\u33F7'] = '\u0032\u0034\u65E5';
  33811. t['\u33F8'] = '\u0032\u0035\u65E5';
  33812. t['\u33F9'] = '\u0032\u0036\u65E5';
  33813. t['\u33FA'] = '\u0032\u0037\u65E5';
  33814. t['\u33FB'] = '\u0032\u0038\u65E5';
  33815. t['\u33FC'] = '\u0032\u0039\u65E5';
  33816. t['\u33FD'] = '\u0033\u0030\u65E5';
  33817. t['\u33FE'] = '\u0033\u0031\u65E5';
  33818. t['\uFB00'] = '\u0066\u0066';
  33819. t['\uFB01'] = '\u0066\u0069';
  33820. t['\uFB02'] = '\u0066\u006C';
  33821. t['\uFB03'] = '\u0066\u0066\u0069';
  33822. t['\uFB04'] = '\u0066\u0066\u006C';
  33823. t['\uFB05'] = '\u017F\u0074';
  33824. t['\uFB06'] = '\u0073\u0074';
  33825. t['\uFB13'] = '\u0574\u0576';
  33826. t['\uFB14'] = '\u0574\u0565';
  33827. t['\uFB15'] = '\u0574\u056B';
  33828. t['\uFB16'] = '\u057E\u0576';
  33829. t['\uFB17'] = '\u0574\u056D';
  33830. t['\uFB4F'] = '\u05D0\u05DC';
  33831. t['\uFB50'] = '\u0671';
  33832. t['\uFB51'] = '\u0671';
  33833. t['\uFB52'] = '\u067B';
  33834. t['\uFB53'] = '\u067B';
  33835. t['\uFB54'] = '\u067B';
  33836. t['\uFB55'] = '\u067B';
  33837. t['\uFB56'] = '\u067E';
  33838. t['\uFB57'] = '\u067E';
  33839. t['\uFB58'] = '\u067E';
  33840. t['\uFB59'] = '\u067E';
  33841. t['\uFB5A'] = '\u0680';
  33842. t['\uFB5B'] = '\u0680';
  33843. t['\uFB5C'] = '\u0680';
  33844. t['\uFB5D'] = '\u0680';
  33845. t['\uFB5E'] = '\u067A';
  33846. t['\uFB5F'] = '\u067A';
  33847. t['\uFB60'] = '\u067A';
  33848. t['\uFB61'] = '\u067A';
  33849. t['\uFB62'] = '\u067F';
  33850. t['\uFB63'] = '\u067F';
  33851. t['\uFB64'] = '\u067F';
  33852. t['\uFB65'] = '\u067F';
  33853. t['\uFB66'] = '\u0679';
  33854. t['\uFB67'] = '\u0679';
  33855. t['\uFB68'] = '\u0679';
  33856. t['\uFB69'] = '\u0679';
  33857. t['\uFB6A'] = '\u06A4';
  33858. t['\uFB6B'] = '\u06A4';
  33859. t['\uFB6C'] = '\u06A4';
  33860. t['\uFB6D'] = '\u06A4';
  33861. t['\uFB6E'] = '\u06A6';
  33862. t['\uFB6F'] = '\u06A6';
  33863. t['\uFB70'] = '\u06A6';
  33864. t['\uFB71'] = '\u06A6';
  33865. t['\uFB72'] = '\u0684';
  33866. t['\uFB73'] = '\u0684';
  33867. t['\uFB74'] = '\u0684';
  33868. t['\uFB75'] = '\u0684';
  33869. t['\uFB76'] = '\u0683';
  33870. t['\uFB77'] = '\u0683';
  33871. t['\uFB78'] = '\u0683';
  33872. t['\uFB79'] = '\u0683';
  33873. t['\uFB7A'] = '\u0686';
  33874. t['\uFB7B'] = '\u0686';
  33875. t['\uFB7C'] = '\u0686';
  33876. t['\uFB7D'] = '\u0686';
  33877. t['\uFB7E'] = '\u0687';
  33878. t['\uFB7F'] = '\u0687';
  33879. t['\uFB80'] = '\u0687';
  33880. t['\uFB81'] = '\u0687';
  33881. t['\uFB82'] = '\u068D';
  33882. t['\uFB83'] = '\u068D';
  33883. t['\uFB84'] = '\u068C';
  33884. t['\uFB85'] = '\u068C';
  33885. t['\uFB86'] = '\u068E';
  33886. t['\uFB87'] = '\u068E';
  33887. t['\uFB88'] = '\u0688';
  33888. t['\uFB89'] = '\u0688';
  33889. t['\uFB8A'] = '\u0698';
  33890. t['\uFB8B'] = '\u0698';
  33891. t['\uFB8C'] = '\u0691';
  33892. t['\uFB8D'] = '\u0691';
  33893. t['\uFB8E'] = '\u06A9';
  33894. t['\uFB8F'] = '\u06A9';
  33895. t['\uFB90'] = '\u06A9';
  33896. t['\uFB91'] = '\u06A9';
  33897. t['\uFB92'] = '\u06AF';
  33898. t['\uFB93'] = '\u06AF';
  33899. t['\uFB94'] = '\u06AF';
  33900. t['\uFB95'] = '\u06AF';
  33901. t['\uFB96'] = '\u06B3';
  33902. t['\uFB97'] = '\u06B3';
  33903. t['\uFB98'] = '\u06B3';
  33904. t['\uFB99'] = '\u06B3';
  33905. t['\uFB9A'] = '\u06B1';
  33906. t['\uFB9B'] = '\u06B1';
  33907. t['\uFB9C'] = '\u06B1';
  33908. t['\uFB9D'] = '\u06B1';
  33909. t['\uFB9E'] = '\u06BA';
  33910. t['\uFB9F'] = '\u06BA';
  33911. t['\uFBA0'] = '\u06BB';
  33912. t['\uFBA1'] = '\u06BB';
  33913. t['\uFBA2'] = '\u06BB';
  33914. t['\uFBA3'] = '\u06BB';
  33915. t['\uFBA4'] = '\u06C0';
  33916. t['\uFBA5'] = '\u06C0';
  33917. t['\uFBA6'] = '\u06C1';
  33918. t['\uFBA7'] = '\u06C1';
  33919. t['\uFBA8'] = '\u06C1';
  33920. t['\uFBA9'] = '\u06C1';
  33921. t['\uFBAA'] = '\u06BE';
  33922. t['\uFBAB'] = '\u06BE';
  33923. t['\uFBAC'] = '\u06BE';
  33924. t['\uFBAD'] = '\u06BE';
  33925. t['\uFBAE'] = '\u06D2';
  33926. t['\uFBAF'] = '\u06D2';
  33927. t['\uFBB0'] = '\u06D3';
  33928. t['\uFBB1'] = '\u06D3';
  33929. t['\uFBD3'] = '\u06AD';
  33930. t['\uFBD4'] = '\u06AD';
  33931. t['\uFBD5'] = '\u06AD';
  33932. t['\uFBD6'] = '\u06AD';
  33933. t['\uFBD7'] = '\u06C7';
  33934. t['\uFBD8'] = '\u06C7';
  33935. t['\uFBD9'] = '\u06C6';
  33936. t['\uFBDA'] = '\u06C6';
  33937. t['\uFBDB'] = '\u06C8';
  33938. t['\uFBDC'] = '\u06C8';
  33939. t['\uFBDD'] = '\u0677';
  33940. t['\uFBDE'] = '\u06CB';
  33941. t['\uFBDF'] = '\u06CB';
  33942. t['\uFBE0'] = '\u06C5';
  33943. t['\uFBE1'] = '\u06C5';
  33944. t['\uFBE2'] = '\u06C9';
  33945. t['\uFBE3'] = '\u06C9';
  33946. t['\uFBE4'] = '\u06D0';
  33947. t['\uFBE5'] = '\u06D0';
  33948. t['\uFBE6'] = '\u06D0';
  33949. t['\uFBE7'] = '\u06D0';
  33950. t['\uFBE8'] = '\u0649';
  33951. t['\uFBE9'] = '\u0649';
  33952. t['\uFBEA'] = '\u0626\u0627';
  33953. t['\uFBEB'] = '\u0626\u0627';
  33954. t['\uFBEC'] = '\u0626\u06D5';
  33955. t['\uFBED'] = '\u0626\u06D5';
  33956. t['\uFBEE'] = '\u0626\u0648';
  33957. t['\uFBEF'] = '\u0626\u0648';
  33958. t['\uFBF0'] = '\u0626\u06C7';
  33959. t['\uFBF1'] = '\u0626\u06C7';
  33960. t['\uFBF2'] = '\u0626\u06C6';
  33961. t['\uFBF3'] = '\u0626\u06C6';
  33962. t['\uFBF4'] = '\u0626\u06C8';
  33963. t['\uFBF5'] = '\u0626\u06C8';
  33964. t['\uFBF6'] = '\u0626\u06D0';
  33965. t['\uFBF7'] = '\u0626\u06D0';
  33966. t['\uFBF8'] = '\u0626\u06D0';
  33967. t['\uFBF9'] = '\u0626\u0649';
  33968. t['\uFBFA'] = '\u0626\u0649';
  33969. t['\uFBFB'] = '\u0626\u0649';
  33970. t['\uFBFC'] = '\u06CC';
  33971. t['\uFBFD'] = '\u06CC';
  33972. t['\uFBFE'] = '\u06CC';
  33973. t['\uFBFF'] = '\u06CC';
  33974. t['\uFC00'] = '\u0626\u062C';
  33975. t['\uFC01'] = '\u0626\u062D';
  33976. t['\uFC02'] = '\u0626\u0645';
  33977. t['\uFC03'] = '\u0626\u0649';
  33978. t['\uFC04'] = '\u0626\u064A';
  33979. t['\uFC05'] = '\u0628\u062C';
  33980. t['\uFC06'] = '\u0628\u062D';
  33981. t['\uFC07'] = '\u0628\u062E';
  33982. t['\uFC08'] = '\u0628\u0645';
  33983. t['\uFC09'] = '\u0628\u0649';
  33984. t['\uFC0A'] = '\u0628\u064A';
  33985. t['\uFC0B'] = '\u062A\u062C';
  33986. t['\uFC0C'] = '\u062A\u062D';
  33987. t['\uFC0D'] = '\u062A\u062E';
  33988. t['\uFC0E'] = '\u062A\u0645';
  33989. t['\uFC0F'] = '\u062A\u0649';
  33990. t['\uFC10'] = '\u062A\u064A';
  33991. t['\uFC11'] = '\u062B\u062C';
  33992. t['\uFC12'] = '\u062B\u0645';
  33993. t['\uFC13'] = '\u062B\u0649';
  33994. t['\uFC14'] = '\u062B\u064A';
  33995. t['\uFC15'] = '\u062C\u062D';
  33996. t['\uFC16'] = '\u062C\u0645';
  33997. t['\uFC17'] = '\u062D\u062C';
  33998. t['\uFC18'] = '\u062D\u0645';
  33999. t['\uFC19'] = '\u062E\u062C';
  34000. t['\uFC1A'] = '\u062E\u062D';
  34001. t['\uFC1B'] = '\u062E\u0645';
  34002. t['\uFC1C'] = '\u0633\u062C';
  34003. t['\uFC1D'] = '\u0633\u062D';
  34004. t['\uFC1E'] = '\u0633\u062E';
  34005. t['\uFC1F'] = '\u0633\u0645';
  34006. t['\uFC20'] = '\u0635\u062D';
  34007. t['\uFC21'] = '\u0635\u0645';
  34008. t['\uFC22'] = '\u0636\u062C';
  34009. t['\uFC23'] = '\u0636\u062D';
  34010. t['\uFC24'] = '\u0636\u062E';
  34011. t['\uFC25'] = '\u0636\u0645';
  34012. t['\uFC26'] = '\u0637\u062D';
  34013. t['\uFC27'] = '\u0637\u0645';
  34014. t['\uFC28'] = '\u0638\u0645';
  34015. t['\uFC29'] = '\u0639\u062C';
  34016. t['\uFC2A'] = '\u0639\u0645';
  34017. t['\uFC2B'] = '\u063A\u062C';
  34018. t['\uFC2C'] = '\u063A\u0645';
  34019. t['\uFC2D'] = '\u0641\u062C';
  34020. t['\uFC2E'] = '\u0641\u062D';
  34021. t['\uFC2F'] = '\u0641\u062E';
  34022. t['\uFC30'] = '\u0641\u0645';
  34023. t['\uFC31'] = '\u0641\u0649';
  34024. t['\uFC32'] = '\u0641\u064A';
  34025. t['\uFC33'] = '\u0642\u062D';
  34026. t['\uFC34'] = '\u0642\u0645';
  34027. t['\uFC35'] = '\u0642\u0649';
  34028. t['\uFC36'] = '\u0642\u064A';
  34029. t['\uFC37'] = '\u0643\u0627';
  34030. t['\uFC38'] = '\u0643\u062C';
  34031. t['\uFC39'] = '\u0643\u062D';
  34032. t['\uFC3A'] = '\u0643\u062E';
  34033. t['\uFC3B'] = '\u0643\u0644';
  34034. t['\uFC3C'] = '\u0643\u0645';
  34035. t['\uFC3D'] = '\u0643\u0649';
  34036. t['\uFC3E'] = '\u0643\u064A';
  34037. t['\uFC3F'] = '\u0644\u062C';
  34038. t['\uFC40'] = '\u0644\u062D';
  34039. t['\uFC41'] = '\u0644\u062E';
  34040. t['\uFC42'] = '\u0644\u0645';
  34041. t['\uFC43'] = '\u0644\u0649';
  34042. t['\uFC44'] = '\u0644\u064A';
  34043. t['\uFC45'] = '\u0645\u062C';
  34044. t['\uFC46'] = '\u0645\u062D';
  34045. t['\uFC47'] = '\u0645\u062E';
  34046. t['\uFC48'] = '\u0645\u0645';
  34047. t['\uFC49'] = '\u0645\u0649';
  34048. t['\uFC4A'] = '\u0645\u064A';
  34049. t['\uFC4B'] = '\u0646\u062C';
  34050. t['\uFC4C'] = '\u0646\u062D';
  34051. t['\uFC4D'] = '\u0646\u062E';
  34052. t['\uFC4E'] = '\u0646\u0645';
  34053. t['\uFC4F'] = '\u0646\u0649';
  34054. t['\uFC50'] = '\u0646\u064A';
  34055. t['\uFC51'] = '\u0647\u062C';
  34056. t['\uFC52'] = '\u0647\u0645';
  34057. t['\uFC53'] = '\u0647\u0649';
  34058. t['\uFC54'] = '\u0647\u064A';
  34059. t['\uFC55'] = '\u064A\u062C';
  34060. t['\uFC56'] = '\u064A\u062D';
  34061. t['\uFC57'] = '\u064A\u062E';
  34062. t['\uFC58'] = '\u064A\u0645';
  34063. t['\uFC59'] = '\u064A\u0649';
  34064. t['\uFC5A'] = '\u064A\u064A';
  34065. t['\uFC5B'] = '\u0630\u0670';
  34066. t['\uFC5C'] = '\u0631\u0670';
  34067. t['\uFC5D'] = '\u0649\u0670';
  34068. t['\uFC5E'] = '\u0020\u064C\u0651';
  34069. t['\uFC5F'] = '\u0020\u064D\u0651';
  34070. t['\uFC60'] = '\u0020\u064E\u0651';
  34071. t['\uFC61'] = '\u0020\u064F\u0651';
  34072. t['\uFC62'] = '\u0020\u0650\u0651';
  34073. t['\uFC63'] = '\u0020\u0651\u0670';
  34074. t['\uFC64'] = '\u0626\u0631';
  34075. t['\uFC65'] = '\u0626\u0632';
  34076. t['\uFC66'] = '\u0626\u0645';
  34077. t['\uFC67'] = '\u0626\u0646';
  34078. t['\uFC68'] = '\u0626\u0649';
  34079. t['\uFC69'] = '\u0626\u064A';
  34080. t['\uFC6A'] = '\u0628\u0631';
  34081. t['\uFC6B'] = '\u0628\u0632';
  34082. t['\uFC6C'] = '\u0628\u0645';
  34083. t['\uFC6D'] = '\u0628\u0646';
  34084. t['\uFC6E'] = '\u0628\u0649';
  34085. t['\uFC6F'] = '\u0628\u064A';
  34086. t['\uFC70'] = '\u062A\u0631';
  34087. t['\uFC71'] = '\u062A\u0632';
  34088. t['\uFC72'] = '\u062A\u0645';
  34089. t['\uFC73'] = '\u062A\u0646';
  34090. t['\uFC74'] = '\u062A\u0649';
  34091. t['\uFC75'] = '\u062A\u064A';
  34092. t['\uFC76'] = '\u062B\u0631';
  34093. t['\uFC77'] = '\u062B\u0632';
  34094. t['\uFC78'] = '\u062B\u0645';
  34095. t['\uFC79'] = '\u062B\u0646';
  34096. t['\uFC7A'] = '\u062B\u0649';
  34097. t['\uFC7B'] = '\u062B\u064A';
  34098. t['\uFC7C'] = '\u0641\u0649';
  34099. t['\uFC7D'] = '\u0641\u064A';
  34100. t['\uFC7E'] = '\u0642\u0649';
  34101. t['\uFC7F'] = '\u0642\u064A';
  34102. t['\uFC80'] = '\u0643\u0627';
  34103. t['\uFC81'] = '\u0643\u0644';
  34104. t['\uFC82'] = '\u0643\u0645';
  34105. t['\uFC83'] = '\u0643\u0649';
  34106. t['\uFC84'] = '\u0643\u064A';
  34107. t['\uFC85'] = '\u0644\u0645';
  34108. t['\uFC86'] = '\u0644\u0649';
  34109. t['\uFC87'] = '\u0644\u064A';
  34110. t['\uFC88'] = '\u0645\u0627';
  34111. t['\uFC89'] = '\u0645\u0645';
  34112. t['\uFC8A'] = '\u0646\u0631';
  34113. t['\uFC8B'] = '\u0646\u0632';
  34114. t['\uFC8C'] = '\u0646\u0645';
  34115. t['\uFC8D'] = '\u0646\u0646';
  34116. t['\uFC8E'] = '\u0646\u0649';
  34117. t['\uFC8F'] = '\u0646\u064A';
  34118. t['\uFC90'] = '\u0649\u0670';
  34119. t['\uFC91'] = '\u064A\u0631';
  34120. t['\uFC92'] = '\u064A\u0632';
  34121. t['\uFC93'] = '\u064A\u0645';
  34122. t['\uFC94'] = '\u064A\u0646';
  34123. t['\uFC95'] = '\u064A\u0649';
  34124. t['\uFC96'] = '\u064A\u064A';
  34125. t['\uFC97'] = '\u0626\u062C';
  34126. t['\uFC98'] = '\u0626\u062D';
  34127. t['\uFC99'] = '\u0626\u062E';
  34128. t['\uFC9A'] = '\u0626\u0645';
  34129. t['\uFC9B'] = '\u0626\u0647';
  34130. t['\uFC9C'] = '\u0628\u062C';
  34131. t['\uFC9D'] = '\u0628\u062D';
  34132. t['\uFC9E'] = '\u0628\u062E';
  34133. t['\uFC9F'] = '\u0628\u0645';
  34134. t['\uFCA0'] = '\u0628\u0647';
  34135. t['\uFCA1'] = '\u062A\u062C';
  34136. t['\uFCA2'] = '\u062A\u062D';
  34137. t['\uFCA3'] = '\u062A\u062E';
  34138. t['\uFCA4'] = '\u062A\u0645';
  34139. t['\uFCA5'] = '\u062A\u0647';
  34140. t['\uFCA6'] = '\u062B\u0645';
  34141. t['\uFCA7'] = '\u062C\u062D';
  34142. t['\uFCA8'] = '\u062C\u0645';
  34143. t['\uFCA9'] = '\u062D\u062C';
  34144. t['\uFCAA'] = '\u062D\u0645';
  34145. t['\uFCAB'] = '\u062E\u062C';
  34146. t['\uFCAC'] = '\u062E\u0645';
  34147. t['\uFCAD'] = '\u0633\u062C';
  34148. t['\uFCAE'] = '\u0633\u062D';
  34149. t['\uFCAF'] = '\u0633\u062E';
  34150. t['\uFCB0'] = '\u0633\u0645';
  34151. t['\uFCB1'] = '\u0635\u062D';
  34152. t['\uFCB2'] = '\u0635\u062E';
  34153. t['\uFCB3'] = '\u0635\u0645';
  34154. t['\uFCB4'] = '\u0636\u062C';
  34155. t['\uFCB5'] = '\u0636\u062D';
  34156. t['\uFCB6'] = '\u0636\u062E';
  34157. t['\uFCB7'] = '\u0636\u0645';
  34158. t['\uFCB8'] = '\u0637\u062D';
  34159. t['\uFCB9'] = '\u0638\u0645';
  34160. t['\uFCBA'] = '\u0639\u062C';
  34161. t['\uFCBB'] = '\u0639\u0645';
  34162. t['\uFCBC'] = '\u063A\u062C';
  34163. t['\uFCBD'] = '\u063A\u0645';
  34164. t['\uFCBE'] = '\u0641\u062C';
  34165. t['\uFCBF'] = '\u0641\u062D';
  34166. t['\uFCC0'] = '\u0641\u062E';
  34167. t['\uFCC1'] = '\u0641\u0645';
  34168. t['\uFCC2'] = '\u0642\u062D';
  34169. t['\uFCC3'] = '\u0642\u0645';
  34170. t['\uFCC4'] = '\u0643\u062C';
  34171. t['\uFCC5'] = '\u0643\u062D';
  34172. t['\uFCC6'] = '\u0643\u062E';
  34173. t['\uFCC7'] = '\u0643\u0644';
  34174. t['\uFCC8'] = '\u0643\u0645';
  34175. t['\uFCC9'] = '\u0644\u062C';
  34176. t['\uFCCA'] = '\u0644\u062D';
  34177. t['\uFCCB'] = '\u0644\u062E';
  34178. t['\uFCCC'] = '\u0644\u0645';
  34179. t['\uFCCD'] = '\u0644\u0647';
  34180. t['\uFCCE'] = '\u0645\u062C';
  34181. t['\uFCCF'] = '\u0645\u062D';
  34182. t['\uFCD0'] = '\u0645\u062E';
  34183. t['\uFCD1'] = '\u0645\u0645';
  34184. t['\uFCD2'] = '\u0646\u062C';
  34185. t['\uFCD3'] = '\u0646\u062D';
  34186. t['\uFCD4'] = '\u0646\u062E';
  34187. t['\uFCD5'] = '\u0646\u0645';
  34188. t['\uFCD6'] = '\u0646\u0647';
  34189. t['\uFCD7'] = '\u0647\u062C';
  34190. t['\uFCD8'] = '\u0647\u0645';
  34191. t['\uFCD9'] = '\u0647\u0670';
  34192. t['\uFCDA'] = '\u064A\u062C';
  34193. t['\uFCDB'] = '\u064A\u062D';
  34194. t['\uFCDC'] = '\u064A\u062E';
  34195. t['\uFCDD'] = '\u064A\u0645';
  34196. t['\uFCDE'] = '\u064A\u0647';
  34197. t['\uFCDF'] = '\u0626\u0645';
  34198. t['\uFCE0'] = '\u0626\u0647';
  34199. t['\uFCE1'] = '\u0628\u0645';
  34200. t['\uFCE2'] = '\u0628\u0647';
  34201. t['\uFCE3'] = '\u062A\u0645';
  34202. t['\uFCE4'] = '\u062A\u0647';
  34203. t['\uFCE5'] = '\u062B\u0645';
  34204. t['\uFCE6'] = '\u062B\u0647';
  34205. t['\uFCE7'] = '\u0633\u0645';
  34206. t['\uFCE8'] = '\u0633\u0647';
  34207. t['\uFCE9'] = '\u0634\u0645';
  34208. t['\uFCEA'] = '\u0634\u0647';
  34209. t['\uFCEB'] = '\u0643\u0644';
  34210. t['\uFCEC'] = '\u0643\u0645';
  34211. t['\uFCED'] = '\u0644\u0645';
  34212. t['\uFCEE'] = '\u0646\u0645';
  34213. t['\uFCEF'] = '\u0646\u0647';
  34214. t['\uFCF0'] = '\u064A\u0645';
  34215. t['\uFCF1'] = '\u064A\u0647';
  34216. t['\uFCF2'] = '\u0640\u064E\u0651';
  34217. t['\uFCF3'] = '\u0640\u064F\u0651';
  34218. t['\uFCF4'] = '\u0640\u0650\u0651';
  34219. t['\uFCF5'] = '\u0637\u0649';
  34220. t['\uFCF6'] = '\u0637\u064A';
  34221. t['\uFCF7'] = '\u0639\u0649';
  34222. t['\uFCF8'] = '\u0639\u064A';
  34223. t['\uFCF9'] = '\u063A\u0649';
  34224. t['\uFCFA'] = '\u063A\u064A';
  34225. t['\uFCFB'] = '\u0633\u0649';
  34226. t['\uFCFC'] = '\u0633\u064A';
  34227. t['\uFCFD'] = '\u0634\u0649';
  34228. t['\uFCFE'] = '\u0634\u064A';
  34229. t['\uFCFF'] = '\u062D\u0649';
  34230. t['\uFD00'] = '\u062D\u064A';
  34231. t['\uFD01'] = '\u062C\u0649';
  34232. t['\uFD02'] = '\u062C\u064A';
  34233. t['\uFD03'] = '\u062E\u0649';
  34234. t['\uFD04'] = '\u062E\u064A';
  34235. t['\uFD05'] = '\u0635\u0649';
  34236. t['\uFD06'] = '\u0635\u064A';
  34237. t['\uFD07'] = '\u0636\u0649';
  34238. t['\uFD08'] = '\u0636\u064A';
  34239. t['\uFD09'] = '\u0634\u062C';
  34240. t['\uFD0A'] = '\u0634\u062D';
  34241. t['\uFD0B'] = '\u0634\u062E';
  34242. t['\uFD0C'] = '\u0634\u0645';
  34243. t['\uFD0D'] = '\u0634\u0631';
  34244. t['\uFD0E'] = '\u0633\u0631';
  34245. t['\uFD0F'] = '\u0635\u0631';
  34246. t['\uFD10'] = '\u0636\u0631';
  34247. t['\uFD11'] = '\u0637\u0649';
  34248. t['\uFD12'] = '\u0637\u064A';
  34249. t['\uFD13'] = '\u0639\u0649';
  34250. t['\uFD14'] = '\u0639\u064A';
  34251. t['\uFD15'] = '\u063A\u0649';
  34252. t['\uFD16'] = '\u063A\u064A';
  34253. t['\uFD17'] = '\u0633\u0649';
  34254. t['\uFD18'] = '\u0633\u064A';
  34255. t['\uFD19'] = '\u0634\u0649';
  34256. t['\uFD1A'] = '\u0634\u064A';
  34257. t['\uFD1B'] = '\u062D\u0649';
  34258. t['\uFD1C'] = '\u062D\u064A';
  34259. t['\uFD1D'] = '\u062C\u0649';
  34260. t['\uFD1E'] = '\u062C\u064A';
  34261. t['\uFD1F'] = '\u062E\u0649';
  34262. t['\uFD20'] = '\u062E\u064A';
  34263. t['\uFD21'] = '\u0635\u0649';
  34264. t['\uFD22'] = '\u0635\u064A';
  34265. t['\uFD23'] = '\u0636\u0649';
  34266. t['\uFD24'] = '\u0636\u064A';
  34267. t['\uFD25'] = '\u0634\u062C';
  34268. t['\uFD26'] = '\u0634\u062D';
  34269. t['\uFD27'] = '\u0634\u062E';
  34270. t['\uFD28'] = '\u0634\u0645';
  34271. t['\uFD29'] = '\u0634\u0631';
  34272. t['\uFD2A'] = '\u0633\u0631';
  34273. t['\uFD2B'] = '\u0635\u0631';
  34274. t['\uFD2C'] = '\u0636\u0631';
  34275. t['\uFD2D'] = '\u0634\u062C';
  34276. t['\uFD2E'] = '\u0634\u062D';
  34277. t['\uFD2F'] = '\u0634\u062E';
  34278. t['\uFD30'] = '\u0634\u0645';
  34279. t['\uFD31'] = '\u0633\u0647';
  34280. t['\uFD32'] = '\u0634\u0647';
  34281. t['\uFD33'] = '\u0637\u0645';
  34282. t['\uFD34'] = '\u0633\u062C';
  34283. t['\uFD35'] = '\u0633\u062D';
  34284. t['\uFD36'] = '\u0633\u062E';
  34285. t['\uFD37'] = '\u0634\u062C';
  34286. t['\uFD38'] = '\u0634\u062D';
  34287. t['\uFD39'] = '\u0634\u062E';
  34288. t['\uFD3A'] = '\u0637\u0645';
  34289. t['\uFD3B'] = '\u0638\u0645';
  34290. t['\uFD3C'] = '\u0627\u064B';
  34291. t['\uFD3D'] = '\u0627\u064B';
  34292. t['\uFD50'] = '\u062A\u062C\u0645';
  34293. t['\uFD51'] = '\u062A\u062D\u062C';
  34294. t['\uFD52'] = '\u062A\u062D\u062C';
  34295. t['\uFD53'] = '\u062A\u062D\u0645';
  34296. t['\uFD54'] = '\u062A\u062E\u0645';
  34297. t['\uFD55'] = '\u062A\u0645\u062C';
  34298. t['\uFD56'] = '\u062A\u0645\u062D';
  34299. t['\uFD57'] = '\u062A\u0645\u062E';
  34300. t['\uFD58'] = '\u062C\u0645\u062D';
  34301. t['\uFD59'] = '\u062C\u0645\u062D';
  34302. t['\uFD5A'] = '\u062D\u0645\u064A';
  34303. t['\uFD5B'] = '\u062D\u0645\u0649';
  34304. t['\uFD5C'] = '\u0633\u062D\u062C';
  34305. t['\uFD5D'] = '\u0633\u062C\u062D';
  34306. t['\uFD5E'] = '\u0633\u062C\u0649';
  34307. t['\uFD5F'] = '\u0633\u0645\u062D';
  34308. t['\uFD60'] = '\u0633\u0645\u062D';
  34309. t['\uFD61'] = '\u0633\u0645\u062C';
  34310. t['\uFD62'] = '\u0633\u0645\u0645';
  34311. t['\uFD63'] = '\u0633\u0645\u0645';
  34312. t['\uFD64'] = '\u0635\u062D\u062D';
  34313. t['\uFD65'] = '\u0635\u062D\u062D';
  34314. t['\uFD66'] = '\u0635\u0645\u0645';
  34315. t['\uFD67'] = '\u0634\u062D\u0645';
  34316. t['\uFD68'] = '\u0634\u062D\u0645';
  34317. t['\uFD69'] = '\u0634\u062C\u064A';
  34318. t['\uFD6A'] = '\u0634\u0645\u062E';
  34319. t['\uFD6B'] = '\u0634\u0645\u062E';
  34320. t['\uFD6C'] = '\u0634\u0645\u0645';
  34321. t['\uFD6D'] = '\u0634\u0645\u0645';
  34322. t['\uFD6E'] = '\u0636\u062D\u0649';
  34323. t['\uFD6F'] = '\u0636\u062E\u0645';
  34324. t['\uFD70'] = '\u0636\u062E\u0645';
  34325. t['\uFD71'] = '\u0637\u0645\u062D';
  34326. t['\uFD72'] = '\u0637\u0645\u062D';
  34327. t['\uFD73'] = '\u0637\u0645\u0645';
  34328. t['\uFD74'] = '\u0637\u0645\u064A';
  34329. t['\uFD75'] = '\u0639\u062C\u0645';
  34330. t['\uFD76'] = '\u0639\u0645\u0645';
  34331. t['\uFD77'] = '\u0639\u0645\u0645';
  34332. t['\uFD78'] = '\u0639\u0645\u0649';
  34333. t['\uFD79'] = '\u063A\u0645\u0645';
  34334. t['\uFD7A'] = '\u063A\u0645\u064A';
  34335. t['\uFD7B'] = '\u063A\u0645\u0649';
  34336. t['\uFD7C'] = '\u0641\u062E\u0645';
  34337. t['\uFD7D'] = '\u0641\u062E\u0645';
  34338. t['\uFD7E'] = '\u0642\u0645\u062D';
  34339. t['\uFD7F'] = '\u0642\u0645\u0645';
  34340. t['\uFD80'] = '\u0644\u062D\u0645';
  34341. t['\uFD81'] = '\u0644\u062D\u064A';
  34342. t['\uFD82'] = '\u0644\u062D\u0649';
  34343. t['\uFD83'] = '\u0644\u062C\u062C';
  34344. t['\uFD84'] = '\u0644\u062C\u062C';
  34345. t['\uFD85'] = '\u0644\u062E\u0645';
  34346. t['\uFD86'] = '\u0644\u062E\u0645';
  34347. t['\uFD87'] = '\u0644\u0645\u062D';
  34348. t['\uFD88'] = '\u0644\u0645\u062D';
  34349. t['\uFD89'] = '\u0645\u062D\u062C';
  34350. t['\uFD8A'] = '\u0645\u062D\u0645';
  34351. t['\uFD8B'] = '\u0645\u062D\u064A';
  34352. t['\uFD8C'] = '\u0645\u062C\u062D';
  34353. t['\uFD8D'] = '\u0645\u062C\u0645';
  34354. t['\uFD8E'] = '\u0645\u062E\u062C';
  34355. t['\uFD8F'] = '\u0645\u062E\u0645';
  34356. t['\uFD92'] = '\u0645\u062C\u062E';
  34357. t['\uFD93'] = '\u0647\u0645\u062C';
  34358. t['\uFD94'] = '\u0647\u0645\u0645';
  34359. t['\uFD95'] = '\u0646\u062D\u0645';
  34360. t['\uFD96'] = '\u0646\u062D\u0649';
  34361. t['\uFD97'] = '\u0646\u062C\u0645';
  34362. t['\uFD98'] = '\u0646\u062C\u0645';
  34363. t['\uFD99'] = '\u0646\u062C\u0649';
  34364. t['\uFD9A'] = '\u0646\u0645\u064A';
  34365. t['\uFD9B'] = '\u0646\u0645\u0649';
  34366. t['\uFD9C'] = '\u064A\u0645\u0645';
  34367. t['\uFD9D'] = '\u064A\u0645\u0645';
  34368. t['\uFD9E'] = '\u0628\u062E\u064A';
  34369. t['\uFD9F'] = '\u062A\u062C\u064A';
  34370. t['\uFDA0'] = '\u062A\u062C\u0649';
  34371. t['\uFDA1'] = '\u062A\u062E\u064A';
  34372. t['\uFDA2'] = '\u062A\u062E\u0649';
  34373. t['\uFDA3'] = '\u062A\u0645\u064A';
  34374. t['\uFDA4'] = '\u062A\u0645\u0649';
  34375. t['\uFDA5'] = '\u062C\u0645\u064A';
  34376. t['\uFDA6'] = '\u062C\u062D\u0649';
  34377. t['\uFDA7'] = '\u062C\u0645\u0649';
  34378. t['\uFDA8'] = '\u0633\u062E\u0649';
  34379. t['\uFDA9'] = '\u0635\u062D\u064A';
  34380. t['\uFDAA'] = '\u0634\u062D\u064A';
  34381. t['\uFDAB'] = '\u0636\u062D\u064A';
  34382. t['\uFDAC'] = '\u0644\u062C\u064A';
  34383. t['\uFDAD'] = '\u0644\u0645\u064A';
  34384. t['\uFDAE'] = '\u064A\u062D\u064A';
  34385. t['\uFDAF'] = '\u064A\u062C\u064A';
  34386. t['\uFDB0'] = '\u064A\u0645\u064A';
  34387. t['\uFDB1'] = '\u0645\u0645\u064A';
  34388. t['\uFDB2'] = '\u0642\u0645\u064A';
  34389. t['\uFDB3'] = '\u0646\u062D\u064A';
  34390. t['\uFDB4'] = '\u0642\u0645\u062D';
  34391. t['\uFDB5'] = '\u0644\u062D\u0645';
  34392. t['\uFDB6'] = '\u0639\u0645\u064A';
  34393. t['\uFDB7'] = '\u0643\u0645\u064A';
  34394. t['\uFDB8'] = '\u0646\u062C\u062D';
  34395. t['\uFDB9'] = '\u0645\u062E\u064A';
  34396. t['\uFDBA'] = '\u0644\u062C\u0645';
  34397. t['\uFDBB'] = '\u0643\u0645\u0645';
  34398. t['\uFDBC'] = '\u0644\u062C\u0645';
  34399. t['\uFDBD'] = '\u0646\u062C\u062D';
  34400. t['\uFDBE'] = '\u062C\u062D\u064A';
  34401. t['\uFDBF'] = '\u062D\u062C\u064A';
  34402. t['\uFDC0'] = '\u0645\u062C\u064A';
  34403. t['\uFDC1'] = '\u0641\u0645\u064A';
  34404. t['\uFDC2'] = '\u0628\u062D\u064A';
  34405. t['\uFDC3'] = '\u0643\u0645\u0645';
  34406. t['\uFDC4'] = '\u0639\u062C\u0645';
  34407. t['\uFDC5'] = '\u0635\u0645\u0645';
  34408. t['\uFDC6'] = '\u0633\u062E\u064A';
  34409. t['\uFDC7'] = '\u0646\u062C\u064A';
  34410. t['\uFE49'] = '\u203E';
  34411. t['\uFE4A'] = '\u203E';
  34412. t['\uFE4B'] = '\u203E';
  34413. t['\uFE4C'] = '\u203E';
  34414. t['\uFE4D'] = '\u005F';
  34415. t['\uFE4E'] = '\u005F';
  34416. t['\uFE4F'] = '\u005F';
  34417. t['\uFE80'] = '\u0621';
  34418. t['\uFE81'] = '\u0622';
  34419. t['\uFE82'] = '\u0622';
  34420. t['\uFE83'] = '\u0623';
  34421. t['\uFE84'] = '\u0623';
  34422. t['\uFE85'] = '\u0624';
  34423. t['\uFE86'] = '\u0624';
  34424. t['\uFE87'] = '\u0625';
  34425. t['\uFE88'] = '\u0625';
  34426. t['\uFE89'] = '\u0626';
  34427. t['\uFE8A'] = '\u0626';
  34428. t['\uFE8B'] = '\u0626';
  34429. t['\uFE8C'] = '\u0626';
  34430. t['\uFE8D'] = '\u0627';
  34431. t['\uFE8E'] = '\u0627';
  34432. t['\uFE8F'] = '\u0628';
  34433. t['\uFE90'] = '\u0628';
  34434. t['\uFE91'] = '\u0628';
  34435. t['\uFE92'] = '\u0628';
  34436. t['\uFE93'] = '\u0629';
  34437. t['\uFE94'] = '\u0629';
  34438. t['\uFE95'] = '\u062A';
  34439. t['\uFE96'] = '\u062A';
  34440. t['\uFE97'] = '\u062A';
  34441. t['\uFE98'] = '\u062A';
  34442. t['\uFE99'] = '\u062B';
  34443. t['\uFE9A'] = '\u062B';
  34444. t['\uFE9B'] = '\u062B';
  34445. t['\uFE9C'] = '\u062B';
  34446. t['\uFE9D'] = '\u062C';
  34447. t['\uFE9E'] = '\u062C';
  34448. t['\uFE9F'] = '\u062C';
  34449. t['\uFEA0'] = '\u062C';
  34450. t['\uFEA1'] = '\u062D';
  34451. t['\uFEA2'] = '\u062D';
  34452. t['\uFEA3'] = '\u062D';
  34453. t['\uFEA4'] = '\u062D';
  34454. t['\uFEA5'] = '\u062E';
  34455. t['\uFEA6'] = '\u062E';
  34456. t['\uFEA7'] = '\u062E';
  34457. t['\uFEA8'] = '\u062E';
  34458. t['\uFEA9'] = '\u062F';
  34459. t['\uFEAA'] = '\u062F';
  34460. t['\uFEAB'] = '\u0630';
  34461. t['\uFEAC'] = '\u0630';
  34462. t['\uFEAD'] = '\u0631';
  34463. t['\uFEAE'] = '\u0631';
  34464. t['\uFEAF'] = '\u0632';
  34465. t['\uFEB0'] = '\u0632';
  34466. t['\uFEB1'] = '\u0633';
  34467. t['\uFEB2'] = '\u0633';
  34468. t['\uFEB3'] = '\u0633';
  34469. t['\uFEB4'] = '\u0633';
  34470. t['\uFEB5'] = '\u0634';
  34471. t['\uFEB6'] = '\u0634';
  34472. t['\uFEB7'] = '\u0634';
  34473. t['\uFEB8'] = '\u0634';
  34474. t['\uFEB9'] = '\u0635';
  34475. t['\uFEBA'] = '\u0635';
  34476. t['\uFEBB'] = '\u0635';
  34477. t['\uFEBC'] = '\u0635';
  34478. t['\uFEBD'] = '\u0636';
  34479. t['\uFEBE'] = '\u0636';
  34480. t['\uFEBF'] = '\u0636';
  34481. t['\uFEC0'] = '\u0636';
  34482. t['\uFEC1'] = '\u0637';
  34483. t['\uFEC2'] = '\u0637';
  34484. t['\uFEC3'] = '\u0637';
  34485. t['\uFEC4'] = '\u0637';
  34486. t['\uFEC5'] = '\u0638';
  34487. t['\uFEC6'] = '\u0638';
  34488. t['\uFEC7'] = '\u0638';
  34489. t['\uFEC8'] = '\u0638';
  34490. t['\uFEC9'] = '\u0639';
  34491. t['\uFECA'] = '\u0639';
  34492. t['\uFECB'] = '\u0639';
  34493. t['\uFECC'] = '\u0639';
  34494. t['\uFECD'] = '\u063A';
  34495. t['\uFECE'] = '\u063A';
  34496. t['\uFECF'] = '\u063A';
  34497. t['\uFED0'] = '\u063A';
  34498. t['\uFED1'] = '\u0641';
  34499. t['\uFED2'] = '\u0641';
  34500. t['\uFED3'] = '\u0641';
  34501. t['\uFED4'] = '\u0641';
  34502. t['\uFED5'] = '\u0642';
  34503. t['\uFED6'] = '\u0642';
  34504. t['\uFED7'] = '\u0642';
  34505. t['\uFED8'] = '\u0642';
  34506. t['\uFED9'] = '\u0643';
  34507. t['\uFEDA'] = '\u0643';
  34508. t['\uFEDB'] = '\u0643';
  34509. t['\uFEDC'] = '\u0643';
  34510. t['\uFEDD'] = '\u0644';
  34511. t['\uFEDE'] = '\u0644';
  34512. t['\uFEDF'] = '\u0644';
  34513. t['\uFEE0'] = '\u0644';
  34514. t['\uFEE1'] = '\u0645';
  34515. t['\uFEE2'] = '\u0645';
  34516. t['\uFEE3'] = '\u0645';
  34517. t['\uFEE4'] = '\u0645';
  34518. t['\uFEE5'] = '\u0646';
  34519. t['\uFEE6'] = '\u0646';
  34520. t['\uFEE7'] = '\u0646';
  34521. t['\uFEE8'] = '\u0646';
  34522. t['\uFEE9'] = '\u0647';
  34523. t['\uFEEA'] = '\u0647';
  34524. t['\uFEEB'] = '\u0647';
  34525. t['\uFEEC'] = '\u0647';
  34526. t['\uFEED'] = '\u0648';
  34527. t['\uFEEE'] = '\u0648';
  34528. t['\uFEEF'] = '\u0649';
  34529. t['\uFEF0'] = '\u0649';
  34530. t['\uFEF1'] = '\u064A';
  34531. t['\uFEF2'] = '\u064A';
  34532. t['\uFEF3'] = '\u064A';
  34533. t['\uFEF4'] = '\u064A';
  34534. t['\uFEF5'] = '\u0644\u0622';
  34535. t['\uFEF6'] = '\u0644\u0622';
  34536. t['\uFEF7'] = '\u0644\u0623';
  34537. t['\uFEF8'] = '\u0644\u0623';
  34538. t['\uFEF9'] = '\u0644\u0625';
  34539. t['\uFEFA'] = '\u0644\u0625';
  34540. t['\uFEFB'] = '\u0644\u0627';
  34541. t['\uFEFC'] = '\u0644\u0627';
  34542. });
  34543. function reverseIfRtl(chars) {
  34544. var charsLength = chars.length;
  34545. if (charsLength <= 1 || !isRTLRangeFor(chars.charCodeAt(0))) {
  34546. return chars;
  34547. }
  34548. var s = '';
  34549. for (var ii = charsLength - 1; ii >= 0; ii--) {
  34550. s += chars[ii];
  34551. }
  34552. return s;
  34553. }
  34554. exports.mapSpecialUnicodeValues = mapSpecialUnicodeValues;
  34555. exports.reverseIfRtl = reverseIfRtl;
  34556. exports.getUnicodeRangeFor = getUnicodeRangeFor;
  34557. exports.getNormalizedUnicodes = getNormalizedUnicodes;
  34558. exports.getUnicodeForGlyph = getUnicodeForGlyph;
  34559. /***/ }),
  34560. /* 19 */
  34561. /***/ (function(module, exports, __w_pdfjs_require__) {
  34562. "use strict";
  34563. var sharedUtil = __w_pdfjs_require__(0);
  34564. var coreWorker = __w_pdfjs_require__(8);
  34565. var globalScope = sharedUtil.globalScope;
  34566. var OK_RESPONSE = 200;
  34567. var PARTIAL_CONTENT_RESPONSE = 206;
  34568. function NetworkManager(url, args) {
  34569. this.url = url;
  34570. args = args || {};
  34571. this.isHttp = /^https?:/i.test(url);
  34572. this.httpHeaders = this.isHttp && args.httpHeaders || {};
  34573. this.withCredentials = args.withCredentials || false;
  34574. this.getXhr = args.getXhr || function NetworkManager_getXhr() {
  34575. return new XMLHttpRequest();
  34576. };
  34577. this.currXhrId = 0;
  34578. this.pendingRequests = Object.create(null);
  34579. this.loadedRequests = Object.create(null);
  34580. }
  34581. function getArrayBuffer(xhr) {
  34582. var data = xhr.response;
  34583. if (typeof data !== 'string') {
  34584. return data;
  34585. }
  34586. var length = data.length;
  34587. var array = new Uint8Array(length);
  34588. for (var i = 0; i < length; i++) {
  34589. array[i] = data.charCodeAt(i) & 0xFF;
  34590. }
  34591. return array.buffer;
  34592. }
  34593. var supportsMozChunked = function supportsMozChunkedClosure() {
  34594. try {
  34595. var x = new XMLHttpRequest();
  34596. x.open('GET', globalScope.location.href);
  34597. x.responseType = 'moz-chunked-arraybuffer';
  34598. return x.responseType === 'moz-chunked-arraybuffer';
  34599. } catch (e) {
  34600. return false;
  34601. }
  34602. }();
  34603. NetworkManager.prototype = {
  34604. requestRange: function NetworkManager_requestRange(begin, end, listeners) {
  34605. var args = {
  34606. begin: begin,
  34607. end: end
  34608. };
  34609. for (var prop in listeners) {
  34610. args[prop] = listeners[prop];
  34611. }
  34612. return this.request(args);
  34613. },
  34614. requestFull: function NetworkManager_requestFull(listeners) {
  34615. return this.request(listeners);
  34616. },
  34617. request: function NetworkManager_request(args) {
  34618. var xhr = this.getXhr();
  34619. var xhrId = this.currXhrId++;
  34620. var pendingRequest = this.pendingRequests[xhrId] = { xhr: xhr };
  34621. xhr.open('GET', this.url);
  34622. xhr.withCredentials = this.withCredentials;
  34623. for (var property in this.httpHeaders) {
  34624. var value = this.httpHeaders[property];
  34625. if (typeof value === 'undefined') {
  34626. continue;
  34627. }
  34628. xhr.setRequestHeader(property, value);
  34629. }
  34630. if (this.isHttp && 'begin' in args && 'end' in args) {
  34631. var rangeStr = args.begin + '-' + (args.end - 1);
  34632. xhr.setRequestHeader('Range', 'bytes=' + rangeStr);
  34633. pendingRequest.expectedStatus = 206;
  34634. } else {
  34635. pendingRequest.expectedStatus = 200;
  34636. }
  34637. var useMozChunkedLoading = supportsMozChunked && !!args.onProgressiveData;
  34638. if (useMozChunkedLoading) {
  34639. xhr.responseType = 'moz-chunked-arraybuffer';
  34640. pendingRequest.onProgressiveData = args.onProgressiveData;
  34641. pendingRequest.mozChunked = true;
  34642. } else {
  34643. xhr.responseType = 'arraybuffer';
  34644. }
  34645. if (args.onError) {
  34646. xhr.onerror = function (evt) {
  34647. args.onError(xhr.status);
  34648. };
  34649. }
  34650. xhr.onreadystatechange = this.onStateChange.bind(this, xhrId);
  34651. xhr.onprogress = this.onProgress.bind(this, xhrId);
  34652. pendingRequest.onHeadersReceived = args.onHeadersReceived;
  34653. pendingRequest.onDone = args.onDone;
  34654. pendingRequest.onError = args.onError;
  34655. pendingRequest.onProgress = args.onProgress;
  34656. xhr.send(null);
  34657. return xhrId;
  34658. },
  34659. onProgress: function NetworkManager_onProgress(xhrId, evt) {
  34660. var pendingRequest = this.pendingRequests[xhrId];
  34661. if (!pendingRequest) {
  34662. return;
  34663. }
  34664. if (pendingRequest.mozChunked) {
  34665. var chunk = getArrayBuffer(pendingRequest.xhr);
  34666. pendingRequest.onProgressiveData(chunk);
  34667. }
  34668. var onProgress = pendingRequest.onProgress;
  34669. if (onProgress) {
  34670. onProgress(evt);
  34671. }
  34672. },
  34673. onStateChange: function NetworkManager_onStateChange(xhrId, evt) {
  34674. var pendingRequest = this.pendingRequests[xhrId];
  34675. if (!pendingRequest) {
  34676. return;
  34677. }
  34678. var xhr = pendingRequest.xhr;
  34679. if (xhr.readyState >= 2 && pendingRequest.onHeadersReceived) {
  34680. pendingRequest.onHeadersReceived();
  34681. delete pendingRequest.onHeadersReceived;
  34682. }
  34683. if (xhr.readyState !== 4) {
  34684. return;
  34685. }
  34686. if (!(xhrId in this.pendingRequests)) {
  34687. return;
  34688. }
  34689. delete this.pendingRequests[xhrId];
  34690. if (xhr.status === 0 && this.isHttp) {
  34691. if (pendingRequest.onError) {
  34692. pendingRequest.onError(xhr.status);
  34693. }
  34694. return;
  34695. }
  34696. var xhrStatus = xhr.status || OK_RESPONSE;
  34697. var ok_response_on_range_request = xhrStatus === OK_RESPONSE && pendingRequest.expectedStatus === PARTIAL_CONTENT_RESPONSE;
  34698. if (!ok_response_on_range_request && xhrStatus !== pendingRequest.expectedStatus) {
  34699. if (pendingRequest.onError) {
  34700. pendingRequest.onError(xhr.status);
  34701. }
  34702. return;
  34703. }
  34704. this.loadedRequests[xhrId] = true;
  34705. var chunk = getArrayBuffer(xhr);
  34706. if (xhrStatus === PARTIAL_CONTENT_RESPONSE) {
  34707. var rangeHeader = xhr.getResponseHeader('Content-Range');
  34708. var matches = /bytes (\d+)-(\d+)\/(\d+)/.exec(rangeHeader);
  34709. var begin = parseInt(matches[1], 10);
  34710. pendingRequest.onDone({
  34711. begin: begin,
  34712. chunk: chunk
  34713. });
  34714. } else if (pendingRequest.onProgressiveData) {
  34715. pendingRequest.onDone(null);
  34716. } else if (chunk) {
  34717. pendingRequest.onDone({
  34718. begin: 0,
  34719. chunk: chunk
  34720. });
  34721. } else if (pendingRequest.onError) {
  34722. pendingRequest.onError(xhr.status);
  34723. }
  34724. },
  34725. hasPendingRequests: function NetworkManager_hasPendingRequests() {
  34726. for (var xhrId in this.pendingRequests) {
  34727. return true;
  34728. }
  34729. return false;
  34730. },
  34731. getRequestXhr: function NetworkManager_getXhr(xhrId) {
  34732. return this.pendingRequests[xhrId].xhr;
  34733. },
  34734. isStreamingRequest: function NetworkManager_isStreamingRequest(xhrId) {
  34735. return !!this.pendingRequests[xhrId].onProgressiveData;
  34736. },
  34737. isPendingRequest: function NetworkManager_isPendingRequest(xhrId) {
  34738. return xhrId in this.pendingRequests;
  34739. },
  34740. isLoadedRequest: function NetworkManager_isLoadedRequest(xhrId) {
  34741. return xhrId in this.loadedRequests;
  34742. },
  34743. abortAllRequests: function NetworkManager_abortAllRequests() {
  34744. for (var xhrId in this.pendingRequests) {
  34745. this.abortRequest(xhrId | 0);
  34746. }
  34747. },
  34748. abortRequest: function NetworkManager_abortRequest(xhrId) {
  34749. var xhr = this.pendingRequests[xhrId].xhr;
  34750. delete this.pendingRequests[xhrId];
  34751. xhr.abort();
  34752. }
  34753. };
  34754. var assert = sharedUtil.assert;
  34755. var createPromiseCapability = sharedUtil.createPromiseCapability;
  34756. var isInt = sharedUtil.isInt;
  34757. var MissingPDFException = sharedUtil.MissingPDFException;
  34758. var UnexpectedResponseException = sharedUtil.UnexpectedResponseException;
  34759. function PDFNetworkStream(options) {
  34760. this._options = options;
  34761. var source = options.source;
  34762. this._manager = new NetworkManager(source.url, {
  34763. httpHeaders: source.httpHeaders,
  34764. withCredentials: source.withCredentials
  34765. });
  34766. this._rangeChunkSize = source.rangeChunkSize;
  34767. this._fullRequestReader = null;
  34768. this._rangeRequestReaders = [];
  34769. }
  34770. PDFNetworkStream.prototype = {
  34771. _onRangeRequestReaderClosed: function PDFNetworkStream_onRangeRequestReaderClosed(reader) {
  34772. var i = this._rangeRequestReaders.indexOf(reader);
  34773. if (i >= 0) {
  34774. this._rangeRequestReaders.splice(i, 1);
  34775. }
  34776. },
  34777. getFullReader: function PDFNetworkStream_getFullReader() {
  34778. assert(!this._fullRequestReader);
  34779. this._fullRequestReader = new PDFNetworkStreamFullRequestReader(this._manager, this._options);
  34780. return this._fullRequestReader;
  34781. },
  34782. getRangeReader: function PDFNetworkStream_getRangeReader(begin, end) {
  34783. var reader = new PDFNetworkStreamRangeRequestReader(this._manager, begin, end);
  34784. reader.onClosed = this._onRangeRequestReaderClosed.bind(this);
  34785. this._rangeRequestReaders.push(reader);
  34786. return reader;
  34787. },
  34788. cancelAllRequests: function PDFNetworkStream_cancelAllRequests(reason) {
  34789. if (this._fullRequestReader) {
  34790. this._fullRequestReader.cancel(reason);
  34791. }
  34792. var readers = this._rangeRequestReaders.slice(0);
  34793. readers.forEach(function (reader) {
  34794. reader.cancel(reason);
  34795. });
  34796. }
  34797. };
  34798. function PDFNetworkStreamFullRequestReader(manager, options) {
  34799. this._manager = manager;
  34800. var source = options.source;
  34801. var args = {
  34802. onHeadersReceived: this._onHeadersReceived.bind(this),
  34803. onProgressiveData: source.disableStream ? null : this._onProgressiveData.bind(this),
  34804. onDone: this._onDone.bind(this),
  34805. onError: this._onError.bind(this),
  34806. onProgress: this._onProgress.bind(this)
  34807. };
  34808. this._url = source.url;
  34809. this._fullRequestId = manager.requestFull(args);
  34810. this._headersReceivedCapability = createPromiseCapability();
  34811. this._disableRange = options.disableRange || false;
  34812. this._contentLength = source.length;
  34813. this._rangeChunkSize = source.rangeChunkSize;
  34814. if (!this._rangeChunkSize && !this._disableRange) {
  34815. this._disableRange = true;
  34816. }
  34817. this._isStreamingSupported = false;
  34818. this._isRangeSupported = false;
  34819. this._cachedChunks = [];
  34820. this._requests = [];
  34821. this._done = false;
  34822. this._storedError = undefined;
  34823. this.onProgress = null;
  34824. }
  34825. PDFNetworkStreamFullRequestReader.prototype = {
  34826. _validateRangeRequestCapabilities: function PDFNetworkStreamFullRequestReader_validateRangeRequestCapabilities() {
  34827. if (this._disableRange) {
  34828. return false;
  34829. }
  34830. var networkManager = this._manager;
  34831. if (!networkManager.isHttp) {
  34832. return false;
  34833. }
  34834. var fullRequestXhrId = this._fullRequestId;
  34835. var fullRequestXhr = networkManager.getRequestXhr(fullRequestXhrId);
  34836. if (fullRequestXhr.getResponseHeader('Accept-Ranges') !== 'bytes') {
  34837. return false;
  34838. }
  34839. var contentEncoding = fullRequestXhr.getResponseHeader('Content-Encoding') || 'identity';
  34840. if (contentEncoding !== 'identity') {
  34841. return false;
  34842. }
  34843. var length = fullRequestXhr.getResponseHeader('Content-Length');
  34844. length = parseInt(length, 10);
  34845. if (!isInt(length)) {
  34846. return false;
  34847. }
  34848. this._contentLength = length;
  34849. if (length <= 2 * this._rangeChunkSize) {
  34850. return false;
  34851. }
  34852. return true;
  34853. },
  34854. _onHeadersReceived: function PDFNetworkStreamFullRequestReader_onHeadersReceived() {
  34855. if (this._validateRangeRequestCapabilities()) {
  34856. this._isRangeSupported = true;
  34857. }
  34858. var networkManager = this._manager;
  34859. var fullRequestXhrId = this._fullRequestId;
  34860. if (networkManager.isStreamingRequest(fullRequestXhrId)) {
  34861. this._isStreamingSupported = true;
  34862. } else if (this._isRangeSupported) {
  34863. networkManager.abortRequest(fullRequestXhrId);
  34864. }
  34865. this._headersReceivedCapability.resolve();
  34866. },
  34867. _onProgressiveData: function PDFNetworkStreamFullRequestReader_onProgressiveData(chunk) {
  34868. if (this._requests.length > 0) {
  34869. var requestCapability = this._requests.shift();
  34870. requestCapability.resolve({
  34871. value: chunk,
  34872. done: false
  34873. });
  34874. } else {
  34875. this._cachedChunks.push(chunk);
  34876. }
  34877. },
  34878. _onDone: function PDFNetworkStreamFullRequestReader_onDone(args) {
  34879. if (args) {
  34880. this._onProgressiveData(args.chunk);
  34881. }
  34882. this._done = true;
  34883. if (this._cachedChunks.length > 0) {
  34884. return;
  34885. }
  34886. this._requests.forEach(function (requestCapability) {
  34887. requestCapability.resolve({
  34888. value: undefined,
  34889. done: true
  34890. });
  34891. });
  34892. this._requests = [];
  34893. },
  34894. _onError: function PDFNetworkStreamFullRequestReader_onError(status) {
  34895. var url = this._url;
  34896. var exception;
  34897. if (status === 404 || status === 0 && /^file:/.test(url)) {
  34898. exception = new MissingPDFException('Missing PDF "' + url + '".');
  34899. } else {
  34900. exception = new UnexpectedResponseException('Unexpected server response (' + status + ') while retrieving PDF "' + url + '".', status);
  34901. }
  34902. this._storedError = exception;
  34903. this._headersReceivedCapability.reject(exception);
  34904. this._requests.forEach(function (requestCapability) {
  34905. requestCapability.reject(exception);
  34906. });
  34907. this._requests = [];
  34908. this._cachedChunks = [];
  34909. },
  34910. _onProgress: function PDFNetworkStreamFullRequestReader_onProgress(data) {
  34911. if (this.onProgress) {
  34912. this.onProgress({
  34913. loaded: data.loaded,
  34914. total: data.lengthComputable ? data.total : this._contentLength
  34915. });
  34916. }
  34917. },
  34918. get isRangeSupported() {
  34919. return this._isRangeSupported;
  34920. },
  34921. get isStreamingSupported() {
  34922. return this._isStreamingSupported;
  34923. },
  34924. get contentLength() {
  34925. return this._contentLength;
  34926. },
  34927. get headersReady() {
  34928. return this._headersReceivedCapability.promise;
  34929. },
  34930. read: function PDFNetworkStreamFullRequestReader_read() {
  34931. if (this._storedError) {
  34932. return Promise.reject(this._storedError);
  34933. }
  34934. if (this._cachedChunks.length > 0) {
  34935. var chunk = this._cachedChunks.shift();
  34936. return Promise.resolve(chunk);
  34937. }
  34938. if (this._done) {
  34939. return Promise.resolve({
  34940. value: undefined,
  34941. done: true
  34942. });
  34943. }
  34944. var requestCapability = createPromiseCapability();
  34945. this._requests.push(requestCapability);
  34946. return requestCapability.promise;
  34947. },
  34948. cancel: function PDFNetworkStreamFullRequestReader_cancel(reason) {
  34949. this._done = true;
  34950. this._headersReceivedCapability.reject(reason);
  34951. this._requests.forEach(function (requestCapability) {
  34952. requestCapability.resolve({
  34953. value: undefined,
  34954. done: true
  34955. });
  34956. });
  34957. this._requests = [];
  34958. if (this._manager.isPendingRequest(this._fullRequestId)) {
  34959. this._manager.abortRequest(this._fullRequestId);
  34960. }
  34961. this._fullRequestReader = null;
  34962. }
  34963. };
  34964. function PDFNetworkStreamRangeRequestReader(manager, begin, end) {
  34965. this._manager = manager;
  34966. var args = {
  34967. onDone: this._onDone.bind(this),
  34968. onProgress: this._onProgress.bind(this)
  34969. };
  34970. this._requestId = manager.requestRange(begin, end, args);
  34971. this._requests = [];
  34972. this._queuedChunk = null;
  34973. this._done = false;
  34974. this.onProgress = null;
  34975. this.onClosed = null;
  34976. }
  34977. PDFNetworkStreamRangeRequestReader.prototype = {
  34978. _close: function PDFNetworkStreamRangeRequestReader_close() {
  34979. if (this.onClosed) {
  34980. this.onClosed(this);
  34981. }
  34982. },
  34983. _onDone: function PDFNetworkStreamRangeRequestReader_onDone(data) {
  34984. var chunk = data.chunk;
  34985. if (this._requests.length > 0) {
  34986. var requestCapability = this._requests.shift();
  34987. requestCapability.resolve({
  34988. value: chunk,
  34989. done: false
  34990. });
  34991. } else {
  34992. this._queuedChunk = chunk;
  34993. }
  34994. this._done = true;
  34995. this._requests.forEach(function (requestCapability) {
  34996. requestCapability.resolve({
  34997. value: undefined,
  34998. done: true
  34999. });
  35000. });
  35001. this._requests = [];
  35002. this._close();
  35003. },
  35004. _onProgress: function PDFNetworkStreamRangeRequestReader_onProgress(evt) {
  35005. if (!this.isStreamingSupported && this.onProgress) {
  35006. this.onProgress({ loaded: evt.loaded });
  35007. }
  35008. },
  35009. get isStreamingSupported() {
  35010. return false;
  35011. },
  35012. read: function PDFNetworkStreamRangeRequestReader_read() {
  35013. if (this._queuedChunk !== null) {
  35014. var chunk = this._queuedChunk;
  35015. this._queuedChunk = null;
  35016. return Promise.resolve({
  35017. value: chunk,
  35018. done: false
  35019. });
  35020. }
  35021. if (this._done) {
  35022. return Promise.resolve({
  35023. value: undefined,
  35024. done: true
  35025. });
  35026. }
  35027. var requestCapability = createPromiseCapability();
  35028. this._requests.push(requestCapability);
  35029. return requestCapability.promise;
  35030. },
  35031. cancel: function PDFNetworkStreamRangeRequestReader_cancel(reason) {
  35032. this._done = true;
  35033. this._requests.forEach(function (requestCapability) {
  35034. requestCapability.resolve({
  35035. value: undefined,
  35036. done: true
  35037. });
  35038. });
  35039. this._requests = [];
  35040. if (this._manager.isPendingRequest(this._requestId)) {
  35041. this._manager.abortRequest(this._requestId);
  35042. }
  35043. this._close();
  35044. }
  35045. };
  35046. coreWorker.setPDFNetworkStreamClass(PDFNetworkStream);
  35047. exports.PDFNetworkStream = PDFNetworkStream;
  35048. exports.NetworkManager = NetworkManager;
  35049. /***/ }),
  35050. /* 20 */
  35051. /***/ (function(module, exports, __w_pdfjs_require__) {
  35052. "use strict";
  35053. var sharedUtil = __w_pdfjs_require__(0);
  35054. var corePrimitives = __w_pdfjs_require__(1);
  35055. var coreStream = __w_pdfjs_require__(2);
  35056. var coreColorSpace = __w_pdfjs_require__(3);
  35057. var coreObj = __w_pdfjs_require__(16);
  35058. var coreEvaluator = __w_pdfjs_require__(14);
  35059. var AnnotationBorderStyleType = sharedUtil.AnnotationBorderStyleType;
  35060. var AnnotationFieldFlag = sharedUtil.AnnotationFieldFlag;
  35061. var AnnotationFlag = sharedUtil.AnnotationFlag;
  35062. var AnnotationType = sharedUtil.AnnotationType;
  35063. var OPS = sharedUtil.OPS;
  35064. var Util = sharedUtil.Util;
  35065. var isArray = sharedUtil.isArray;
  35066. var isInt = sharedUtil.isInt;
  35067. var stringToBytes = sharedUtil.stringToBytes;
  35068. var stringToPDFString = sharedUtil.stringToPDFString;
  35069. var warn = sharedUtil.warn;
  35070. var Dict = corePrimitives.Dict;
  35071. var isDict = corePrimitives.isDict;
  35072. var isName = corePrimitives.isName;
  35073. var isRef = corePrimitives.isRef;
  35074. var isStream = corePrimitives.isStream;
  35075. var Stream = coreStream.Stream;
  35076. var ColorSpace = coreColorSpace.ColorSpace;
  35077. var Catalog = coreObj.Catalog;
  35078. var ObjectLoader = coreObj.ObjectLoader;
  35079. var FileSpec = coreObj.FileSpec;
  35080. var OperatorList = coreEvaluator.OperatorList;
  35081. function AnnotationFactory() {
  35082. }
  35083. AnnotationFactory.prototype = {
  35084. create: function AnnotationFactory_create(xref, ref, pdfManager, idFactory) {
  35085. var dict = xref.fetchIfRef(ref);
  35086. if (!isDict(dict)) {
  35087. return;
  35088. }
  35089. var id = isRef(ref) ? ref.toString() : 'annot_' + idFactory.createObjId();
  35090. var subtype = dict.get('Subtype');
  35091. subtype = isName(subtype) ? subtype.name : null;
  35092. var parameters = {
  35093. xref: xref,
  35094. dict: dict,
  35095. ref: isRef(ref) ? ref : null,
  35096. subtype: subtype,
  35097. id: id,
  35098. pdfManager: pdfManager
  35099. };
  35100. switch (subtype) {
  35101. case 'Link':
  35102. return new LinkAnnotation(parameters);
  35103. case 'Text':
  35104. return new TextAnnotation(parameters);
  35105. case 'Widget':
  35106. var fieldType = Util.getInheritableProperty(dict, 'FT');
  35107. fieldType = isName(fieldType) ? fieldType.name : null;
  35108. switch (fieldType) {
  35109. case 'Tx':
  35110. return new TextWidgetAnnotation(parameters);
  35111. case 'Btn':
  35112. return new ButtonWidgetAnnotation(parameters);
  35113. case 'Ch':
  35114. return new ChoiceWidgetAnnotation(parameters);
  35115. }
  35116. warn('Unimplemented widget field type "' + fieldType + '", ' + 'falling back to base field type.');
  35117. return new WidgetAnnotation(parameters);
  35118. case 'Popup':
  35119. return new PopupAnnotation(parameters);
  35120. case 'Highlight':
  35121. return new HighlightAnnotation(parameters);
  35122. case 'Underline':
  35123. return new UnderlineAnnotation(parameters);
  35124. case 'Squiggly':
  35125. return new SquigglyAnnotation(parameters);
  35126. case 'StrikeOut':
  35127. return new StrikeOutAnnotation(parameters);
  35128. case 'FileAttachment':
  35129. return new FileAttachmentAnnotation(parameters);
  35130. default:
  35131. if (!subtype) {
  35132. warn('Annotation is missing the required /Subtype.');
  35133. } else {
  35134. warn('Unimplemented annotation type "' + subtype + '", ' + 'falling back to base annotation.');
  35135. }
  35136. return new Annotation(parameters);
  35137. }
  35138. }
  35139. };
  35140. var Annotation = function AnnotationClosure() {
  35141. function getTransformMatrix(rect, bbox, matrix) {
  35142. var bounds = Util.getAxialAlignedBoundingBox(bbox, matrix);
  35143. var minX = bounds[0];
  35144. var minY = bounds[1];
  35145. var maxX = bounds[2];
  35146. var maxY = bounds[3];
  35147. if (minX === maxX || minY === maxY) {
  35148. return [
  35149. 1,
  35150. 0,
  35151. 0,
  35152. 1,
  35153. rect[0],
  35154. rect[1]
  35155. ];
  35156. }
  35157. var xRatio = (rect[2] - rect[0]) / (maxX - minX);
  35158. var yRatio = (rect[3] - rect[1]) / (maxY - minY);
  35159. return [
  35160. xRatio,
  35161. 0,
  35162. 0,
  35163. yRatio,
  35164. rect[0] - minX * xRatio,
  35165. rect[1] - minY * yRatio
  35166. ];
  35167. }
  35168. function Annotation(params) {
  35169. var dict = params.dict;
  35170. this.setFlags(dict.get('F'));
  35171. this.setRectangle(dict.getArray('Rect'));
  35172. this.setColor(dict.getArray('C'));
  35173. this.setBorderStyle(dict);
  35174. this.setAppearance(dict);
  35175. this.data = {};
  35176. this.data.id = params.id;
  35177. this.data.subtype = params.subtype;
  35178. this.data.annotationFlags = this.flags;
  35179. this.data.rect = this.rectangle;
  35180. this.data.color = this.color;
  35181. this.data.borderStyle = this.borderStyle;
  35182. this.data.hasAppearance = !!this.appearance;
  35183. }
  35184. Annotation.prototype = {
  35185. _hasFlag: function Annotation_hasFlag(flags, flag) {
  35186. return !!(flags & flag);
  35187. },
  35188. _isViewable: function Annotation_isViewable(flags) {
  35189. return !this._hasFlag(flags, AnnotationFlag.INVISIBLE) && !this._hasFlag(flags, AnnotationFlag.HIDDEN) && !this._hasFlag(flags, AnnotationFlag.NOVIEW);
  35190. },
  35191. _isPrintable: function AnnotationFlag_isPrintable(flags) {
  35192. return this._hasFlag(flags, AnnotationFlag.PRINT) && !this._hasFlag(flags, AnnotationFlag.INVISIBLE) && !this._hasFlag(flags, AnnotationFlag.HIDDEN);
  35193. },
  35194. get viewable() {
  35195. if (this.flags === 0) {
  35196. return true;
  35197. }
  35198. return this._isViewable(this.flags);
  35199. },
  35200. get printable() {
  35201. if (this.flags === 0) {
  35202. return false;
  35203. }
  35204. return this._isPrintable(this.flags);
  35205. },
  35206. setFlags: function Annotation_setFlags(flags) {
  35207. this.flags = isInt(flags) && flags > 0 ? flags : 0;
  35208. },
  35209. hasFlag: function Annotation_hasFlag(flag) {
  35210. return this._hasFlag(this.flags, flag);
  35211. },
  35212. setRectangle: function Annotation_setRectangle(rectangle) {
  35213. if (isArray(rectangle) && rectangle.length === 4) {
  35214. this.rectangle = Util.normalizeRect(rectangle);
  35215. } else {
  35216. this.rectangle = [
  35217. 0,
  35218. 0,
  35219. 0,
  35220. 0
  35221. ];
  35222. }
  35223. },
  35224. setColor: function Annotation_setColor(color) {
  35225. var rgbColor = new Uint8Array(3);
  35226. if (!isArray(color)) {
  35227. this.color = rgbColor;
  35228. return;
  35229. }
  35230. switch (color.length) {
  35231. case 0:
  35232. this.color = null;
  35233. break;
  35234. case 1:
  35235. ColorSpace.singletons.gray.getRgbItem(color, 0, rgbColor, 0);
  35236. this.color = rgbColor;
  35237. break;
  35238. case 3:
  35239. ColorSpace.singletons.rgb.getRgbItem(color, 0, rgbColor, 0);
  35240. this.color = rgbColor;
  35241. break;
  35242. case 4:
  35243. ColorSpace.singletons.cmyk.getRgbItem(color, 0, rgbColor, 0);
  35244. this.color = rgbColor;
  35245. break;
  35246. default:
  35247. this.color = rgbColor;
  35248. break;
  35249. }
  35250. },
  35251. setBorderStyle: function Annotation_setBorderStyle(borderStyle) {
  35252. this.borderStyle = new AnnotationBorderStyle();
  35253. if (!isDict(borderStyle)) {
  35254. return;
  35255. }
  35256. if (borderStyle.has('BS')) {
  35257. var dict = borderStyle.get('BS');
  35258. var dictType = dict.get('Type');
  35259. if (!dictType || isName(dictType, 'Border')) {
  35260. this.borderStyle.setWidth(dict.get('W'));
  35261. this.borderStyle.setStyle(dict.get('S'));
  35262. this.borderStyle.setDashArray(dict.getArray('D'));
  35263. }
  35264. } else if (borderStyle.has('Border')) {
  35265. var array = borderStyle.getArray('Border');
  35266. if (isArray(array) && array.length >= 3) {
  35267. this.borderStyle.setHorizontalCornerRadius(array[0]);
  35268. this.borderStyle.setVerticalCornerRadius(array[1]);
  35269. this.borderStyle.setWidth(array[2]);
  35270. if (array.length === 4) {
  35271. this.borderStyle.setDashArray(array[3]);
  35272. }
  35273. }
  35274. } else {
  35275. this.borderStyle.setWidth(0);
  35276. }
  35277. },
  35278. setAppearance: function Annotation_setAppearance(dict) {
  35279. this.appearance = null;
  35280. var appearanceStates = dict.get('AP');
  35281. if (!isDict(appearanceStates)) {
  35282. return;
  35283. }
  35284. var normalAppearanceState = appearanceStates.get('N');
  35285. if (isStream(normalAppearanceState)) {
  35286. this.appearance = normalAppearanceState;
  35287. return;
  35288. }
  35289. if (!isDict(normalAppearanceState)) {
  35290. return;
  35291. }
  35292. var as = dict.get('AS');
  35293. if (!isName(as) || !normalAppearanceState.has(as.name)) {
  35294. return;
  35295. }
  35296. this.appearance = normalAppearanceState.get(as.name);
  35297. },
  35298. _preparePopup: function Annotation_preparePopup(dict) {
  35299. if (!dict.has('C')) {
  35300. this.data.color = null;
  35301. }
  35302. this.data.hasPopup = dict.has('Popup');
  35303. this.data.title = stringToPDFString(dict.get('T') || '');
  35304. this.data.contents = stringToPDFString(dict.get('Contents') || '');
  35305. },
  35306. loadResources: function Annotation_loadResources(keys) {
  35307. return new Promise(function (resolve, reject) {
  35308. this.appearance.dict.getAsync('Resources').then(function (resources) {
  35309. if (!resources) {
  35310. resolve();
  35311. return;
  35312. }
  35313. var objectLoader = new ObjectLoader(resources.map, keys, resources.xref);
  35314. objectLoader.load().then(function () {
  35315. resolve(resources);
  35316. }, reject);
  35317. }, reject);
  35318. }.bind(this));
  35319. },
  35320. getOperatorList: function Annotation_getOperatorList(evaluator, task, renderForms) {
  35321. if (!this.appearance) {
  35322. return Promise.resolve(new OperatorList());
  35323. }
  35324. var data = this.data;
  35325. var appearanceDict = this.appearance.dict;
  35326. var resourcesPromise = this.loadResources([
  35327. 'ExtGState',
  35328. 'ColorSpace',
  35329. 'Pattern',
  35330. 'Shading',
  35331. 'XObject',
  35332. 'Font'
  35333. ]);
  35334. var bbox = appearanceDict.getArray('BBox') || [
  35335. 0,
  35336. 0,
  35337. 1,
  35338. 1
  35339. ];
  35340. var matrix = appearanceDict.getArray('Matrix') || [
  35341. 1,
  35342. 0,
  35343. 0,
  35344. 1,
  35345. 0,
  35346. 0
  35347. ];
  35348. var transform = getTransformMatrix(data.rect, bbox, matrix);
  35349. var self = this;
  35350. return resourcesPromise.then(function (resources) {
  35351. var opList = new OperatorList();
  35352. opList.addOp(OPS.beginAnnotation, [
  35353. data.rect,
  35354. transform,
  35355. matrix
  35356. ]);
  35357. return evaluator.getOperatorList(self.appearance, task, resources, opList).then(function () {
  35358. opList.addOp(OPS.endAnnotation, []);
  35359. self.appearance.reset();
  35360. return opList;
  35361. });
  35362. });
  35363. }
  35364. };
  35365. return Annotation;
  35366. }();
  35367. var AnnotationBorderStyle = function AnnotationBorderStyleClosure() {
  35368. function AnnotationBorderStyle() {
  35369. this.width = 1;
  35370. this.style = AnnotationBorderStyleType.SOLID;
  35371. this.dashArray = [3];
  35372. this.horizontalCornerRadius = 0;
  35373. this.verticalCornerRadius = 0;
  35374. }
  35375. AnnotationBorderStyle.prototype = {
  35376. setWidth: function AnnotationBorderStyle_setWidth(width) {
  35377. if (width === (width | 0)) {
  35378. this.width = width;
  35379. }
  35380. },
  35381. setStyle: function AnnotationBorderStyle_setStyle(style) {
  35382. if (!style) {
  35383. return;
  35384. }
  35385. switch (style.name) {
  35386. case 'S':
  35387. this.style = AnnotationBorderStyleType.SOLID;
  35388. break;
  35389. case 'D':
  35390. this.style = AnnotationBorderStyleType.DASHED;
  35391. break;
  35392. case 'B':
  35393. this.style = AnnotationBorderStyleType.BEVELED;
  35394. break;
  35395. case 'I':
  35396. this.style = AnnotationBorderStyleType.INSET;
  35397. break;
  35398. case 'U':
  35399. this.style = AnnotationBorderStyleType.UNDERLINE;
  35400. break;
  35401. default:
  35402. break;
  35403. }
  35404. },
  35405. setDashArray: function AnnotationBorderStyle_setDashArray(dashArray) {
  35406. if (isArray(dashArray) && dashArray.length > 0) {
  35407. var isValid = true;
  35408. var allZeros = true;
  35409. for (var i = 0, len = dashArray.length; i < len; i++) {
  35410. var element = dashArray[i];
  35411. var validNumber = +element >= 0;
  35412. if (!validNumber) {
  35413. isValid = false;
  35414. break;
  35415. } else if (element > 0) {
  35416. allZeros = false;
  35417. }
  35418. }
  35419. if (isValid && !allZeros) {
  35420. this.dashArray = dashArray;
  35421. } else {
  35422. this.width = 0;
  35423. }
  35424. } else if (dashArray) {
  35425. this.width = 0;
  35426. }
  35427. },
  35428. setHorizontalCornerRadius: function AnnotationBorderStyle_setHorizontalCornerRadius(radius) {
  35429. if (radius === (radius | 0)) {
  35430. this.horizontalCornerRadius = radius;
  35431. }
  35432. },
  35433. setVerticalCornerRadius: function AnnotationBorderStyle_setVerticalCornerRadius(radius) {
  35434. if (radius === (radius | 0)) {
  35435. this.verticalCornerRadius = radius;
  35436. }
  35437. }
  35438. };
  35439. return AnnotationBorderStyle;
  35440. }();
  35441. var WidgetAnnotation = function WidgetAnnotationClosure() {
  35442. function WidgetAnnotation(params) {
  35443. Annotation.call(this, params);
  35444. var dict = params.dict;
  35445. var data = this.data;
  35446. data.annotationType = AnnotationType.WIDGET;
  35447. data.fieldName = this._constructFieldName(dict);
  35448. data.fieldValue = Util.getInheritableProperty(dict, 'V', true);
  35449. data.alternativeText = stringToPDFString(dict.get('TU') || '');
  35450. data.defaultAppearance = Util.getInheritableProperty(dict, 'DA') || '';
  35451. var fieldType = Util.getInheritableProperty(dict, 'FT');
  35452. data.fieldType = isName(fieldType) ? fieldType.name : null;
  35453. this.fieldResources = Util.getInheritableProperty(dict, 'DR') || Dict.empty;
  35454. data.fieldFlags = Util.getInheritableProperty(dict, 'Ff');
  35455. if (!isInt(data.fieldFlags) || data.fieldFlags < 0) {
  35456. data.fieldFlags = 0;
  35457. }
  35458. data.readOnly = this.hasFieldFlag(AnnotationFieldFlag.READONLY);
  35459. if (data.fieldType === 'Sig') {
  35460. this.setFlags(AnnotationFlag.HIDDEN);
  35461. }
  35462. }
  35463. Util.inherit(WidgetAnnotation, Annotation, {
  35464. _constructFieldName: function WidgetAnnotation_constructFieldName(dict) {
  35465. if (!dict.has('T') && !dict.has('Parent')) {
  35466. warn('Unknown field name, falling back to empty field name.');
  35467. return '';
  35468. }
  35469. if (!dict.has('Parent')) {
  35470. return stringToPDFString(dict.get('T'));
  35471. }
  35472. var fieldName = [];
  35473. if (dict.has('T')) {
  35474. fieldName.unshift(stringToPDFString(dict.get('T')));
  35475. }
  35476. var loopDict = dict;
  35477. while (loopDict.has('Parent')) {
  35478. loopDict = loopDict.get('Parent');
  35479. if (loopDict.has('T')) {
  35480. fieldName.unshift(stringToPDFString(loopDict.get('T')));
  35481. }
  35482. }
  35483. return fieldName.join('.');
  35484. },
  35485. hasFieldFlag: function WidgetAnnotation_hasFieldFlag(flag) {
  35486. return !!(this.data.fieldFlags & flag);
  35487. }
  35488. });
  35489. return WidgetAnnotation;
  35490. }();
  35491. var TextWidgetAnnotation = function TextWidgetAnnotationClosure() {
  35492. function TextWidgetAnnotation(params) {
  35493. WidgetAnnotation.call(this, params);
  35494. this.data.fieldValue = stringToPDFString(this.data.fieldValue || '');
  35495. var alignment = Util.getInheritableProperty(params.dict, 'Q');
  35496. if (!isInt(alignment) || alignment < 0 || alignment > 2) {
  35497. alignment = null;
  35498. }
  35499. this.data.textAlignment = alignment;
  35500. var maximumLength = Util.getInheritableProperty(params.dict, 'MaxLen');
  35501. if (!isInt(maximumLength) || maximumLength < 0) {
  35502. maximumLength = null;
  35503. }
  35504. this.data.maxLen = maximumLength;
  35505. this.data.multiLine = this.hasFieldFlag(AnnotationFieldFlag.MULTILINE);
  35506. this.data.comb = this.hasFieldFlag(AnnotationFieldFlag.COMB) && !this.hasFieldFlag(AnnotationFieldFlag.MULTILINE) && !this.hasFieldFlag(AnnotationFieldFlag.PASSWORD) && !this.hasFieldFlag(AnnotationFieldFlag.FILESELECT) && this.data.maxLen !== null;
  35507. }
  35508. Util.inherit(TextWidgetAnnotation, WidgetAnnotation, {
  35509. getOperatorList: function TextWidgetAnnotation_getOperatorList(evaluator, task, renderForms) {
  35510. var operatorList = new OperatorList();
  35511. if (renderForms) {
  35512. return Promise.resolve(operatorList);
  35513. }
  35514. if (this.appearance) {
  35515. return Annotation.prototype.getOperatorList.call(this, evaluator, task, renderForms);
  35516. }
  35517. if (!this.data.defaultAppearance) {
  35518. return Promise.resolve(operatorList);
  35519. }
  35520. var stream = new Stream(stringToBytes(this.data.defaultAppearance));
  35521. return evaluator.getOperatorList(stream, task, this.fieldResources, operatorList).then(function () {
  35522. return operatorList;
  35523. });
  35524. }
  35525. });
  35526. return TextWidgetAnnotation;
  35527. }();
  35528. var ButtonWidgetAnnotation = function ButtonWidgetAnnotationClosure() {
  35529. function ButtonWidgetAnnotation(params) {
  35530. WidgetAnnotation.call(this, params);
  35531. this.data.checkBox = !this.hasFieldFlag(AnnotationFieldFlag.RADIO) && !this.hasFieldFlag(AnnotationFieldFlag.PUSHBUTTON);
  35532. if (this.data.checkBox) {
  35533. if (!isName(this.data.fieldValue)) {
  35534. return;
  35535. }
  35536. this.data.fieldValue = this.data.fieldValue.name;
  35537. }
  35538. this.data.radioButton = this.hasFieldFlag(AnnotationFieldFlag.RADIO) && !this.hasFieldFlag(AnnotationFieldFlag.PUSHBUTTON);
  35539. if (this.data.radioButton) {
  35540. this.data.fieldValue = this.data.buttonValue = null;
  35541. var fieldParent = params.dict.get('Parent');
  35542. if (isDict(fieldParent) && fieldParent.has('V')) {
  35543. var fieldParentValue = fieldParent.get('V');
  35544. if (isName(fieldParentValue)) {
  35545. this.data.fieldValue = fieldParentValue.name;
  35546. }
  35547. }
  35548. var appearanceStates = params.dict.get('AP');
  35549. if (!isDict(appearanceStates)) {
  35550. return;
  35551. }
  35552. var normalAppearanceState = appearanceStates.get('N');
  35553. if (!isDict(normalAppearanceState)) {
  35554. return;
  35555. }
  35556. var keys = normalAppearanceState.getKeys();
  35557. for (var i = 0, ii = keys.length; i < ii; i++) {
  35558. if (keys[i] !== 'Off') {
  35559. this.data.buttonValue = keys[i];
  35560. break;
  35561. }
  35562. }
  35563. }
  35564. }
  35565. Util.inherit(ButtonWidgetAnnotation, WidgetAnnotation, {
  35566. getOperatorList: function ButtonWidgetAnnotation_getOperatorList(evaluator, task, renderForms) {
  35567. var operatorList = new OperatorList();
  35568. if (renderForms) {
  35569. return Promise.resolve(operatorList);
  35570. }
  35571. if (this.appearance) {
  35572. return Annotation.prototype.getOperatorList.call(this, evaluator, task, renderForms);
  35573. }
  35574. return Promise.resolve(operatorList);
  35575. }
  35576. });
  35577. return ButtonWidgetAnnotation;
  35578. }();
  35579. var ChoiceWidgetAnnotation = function ChoiceWidgetAnnotationClosure() {
  35580. function ChoiceWidgetAnnotation(params) {
  35581. WidgetAnnotation.call(this, params);
  35582. this.data.options = [];
  35583. var options = Util.getInheritableProperty(params.dict, 'Opt');
  35584. if (isArray(options)) {
  35585. var xref = params.xref;
  35586. for (var i = 0, ii = options.length; i < ii; i++) {
  35587. var option = xref.fetchIfRef(options[i]);
  35588. var isOptionArray = isArray(option);
  35589. this.data.options[i] = {
  35590. exportValue: isOptionArray ? xref.fetchIfRef(option[0]) : option,
  35591. displayValue: isOptionArray ? xref.fetchIfRef(option[1]) : option
  35592. };
  35593. }
  35594. }
  35595. if (!isArray(this.data.fieldValue)) {
  35596. this.data.fieldValue = [this.data.fieldValue];
  35597. }
  35598. this.data.combo = this.hasFieldFlag(AnnotationFieldFlag.COMBO);
  35599. this.data.multiSelect = this.hasFieldFlag(AnnotationFieldFlag.MULTISELECT);
  35600. }
  35601. Util.inherit(ChoiceWidgetAnnotation, WidgetAnnotation, {
  35602. getOperatorList: function ChoiceWidgetAnnotation_getOperatorList(evaluator, task, renderForms) {
  35603. var operatorList = new OperatorList();
  35604. if (renderForms) {
  35605. return Promise.resolve(operatorList);
  35606. }
  35607. return Annotation.prototype.getOperatorList.call(this, evaluator, task, renderForms);
  35608. }
  35609. });
  35610. return ChoiceWidgetAnnotation;
  35611. }();
  35612. var TextAnnotation = function TextAnnotationClosure() {
  35613. var DEFAULT_ICON_SIZE = 22;
  35614. function TextAnnotation(parameters) {
  35615. Annotation.call(this, parameters);
  35616. this.data.annotationType = AnnotationType.TEXT;
  35617. if (this.data.hasAppearance) {
  35618. this.data.name = 'NoIcon';
  35619. } else {
  35620. this.data.rect[1] = this.data.rect[3] - DEFAULT_ICON_SIZE;
  35621. this.data.rect[2] = this.data.rect[0] + DEFAULT_ICON_SIZE;
  35622. this.data.name = parameters.dict.has('Name') ? parameters.dict.get('Name').name : 'Note';
  35623. }
  35624. this._preparePopup(parameters.dict);
  35625. }
  35626. Util.inherit(TextAnnotation, Annotation, {});
  35627. return TextAnnotation;
  35628. }();
  35629. var LinkAnnotation = function LinkAnnotationClosure() {
  35630. function LinkAnnotation(params) {
  35631. Annotation.call(this, params);
  35632. var data = this.data;
  35633. data.annotationType = AnnotationType.LINK;
  35634. Catalog.parseDestDictionary({
  35635. destDict: params.dict,
  35636. resultObj: data,
  35637. docBaseUrl: params.pdfManager.docBaseUrl
  35638. });
  35639. }
  35640. Util.inherit(LinkAnnotation, Annotation, {});
  35641. return LinkAnnotation;
  35642. }();
  35643. var PopupAnnotation = function PopupAnnotationClosure() {
  35644. function PopupAnnotation(parameters) {
  35645. Annotation.call(this, parameters);
  35646. this.data.annotationType = AnnotationType.POPUP;
  35647. var dict = parameters.dict;
  35648. var parentItem = dict.get('Parent');
  35649. if (!parentItem) {
  35650. warn('Popup annotation has a missing or invalid parent annotation.');
  35651. return;
  35652. }
  35653. this.data.parentId = dict.getRaw('Parent').toString();
  35654. this.data.title = stringToPDFString(parentItem.get('T') || '');
  35655. this.data.contents = stringToPDFString(parentItem.get('Contents') || '');
  35656. if (!parentItem.has('C')) {
  35657. this.data.color = null;
  35658. } else {
  35659. this.setColor(parentItem.getArray('C'));
  35660. this.data.color = this.color;
  35661. }
  35662. if (!this.viewable) {
  35663. var parentFlags = parentItem.get('F');
  35664. if (this._isViewable(parentFlags)) {
  35665. this.setFlags(parentFlags);
  35666. }
  35667. }
  35668. }
  35669. Util.inherit(PopupAnnotation, Annotation, {});
  35670. return PopupAnnotation;
  35671. }();
  35672. var HighlightAnnotation = function HighlightAnnotationClosure() {
  35673. function HighlightAnnotation(parameters) {
  35674. Annotation.call(this, parameters);
  35675. this.data.annotationType = AnnotationType.HIGHLIGHT;
  35676. this._preparePopup(parameters.dict);
  35677. this.data.borderStyle.setWidth(0);
  35678. }
  35679. Util.inherit(HighlightAnnotation, Annotation, {});
  35680. return HighlightAnnotation;
  35681. }();
  35682. var UnderlineAnnotation = function UnderlineAnnotationClosure() {
  35683. function UnderlineAnnotation(parameters) {
  35684. Annotation.call(this, parameters);
  35685. this.data.annotationType = AnnotationType.UNDERLINE;
  35686. this._preparePopup(parameters.dict);
  35687. this.data.borderStyle.setWidth(0);
  35688. }
  35689. Util.inherit(UnderlineAnnotation, Annotation, {});
  35690. return UnderlineAnnotation;
  35691. }();
  35692. var SquigglyAnnotation = function SquigglyAnnotationClosure() {
  35693. function SquigglyAnnotation(parameters) {
  35694. Annotation.call(this, parameters);
  35695. this.data.annotationType = AnnotationType.SQUIGGLY;
  35696. this._preparePopup(parameters.dict);
  35697. this.data.borderStyle.setWidth(0);
  35698. }
  35699. Util.inherit(SquigglyAnnotation, Annotation, {});
  35700. return SquigglyAnnotation;
  35701. }();
  35702. var StrikeOutAnnotation = function StrikeOutAnnotationClosure() {
  35703. function StrikeOutAnnotation(parameters) {
  35704. Annotation.call(this, parameters);
  35705. this.data.annotationType = AnnotationType.STRIKEOUT;
  35706. this._preparePopup(parameters.dict);
  35707. this.data.borderStyle.setWidth(0);
  35708. }
  35709. Util.inherit(StrikeOutAnnotation, Annotation, {});
  35710. return StrikeOutAnnotation;
  35711. }();
  35712. var FileAttachmentAnnotation = function FileAttachmentAnnotationClosure() {
  35713. function FileAttachmentAnnotation(parameters) {
  35714. Annotation.call(this, parameters);
  35715. var file = new FileSpec(parameters.dict.get('FS'), parameters.xref);
  35716. this.data.annotationType = AnnotationType.FILEATTACHMENT;
  35717. this.data.file = file.serializable;
  35718. this._preparePopup(parameters.dict);
  35719. }
  35720. Util.inherit(FileAttachmentAnnotation, Annotation, {});
  35721. return FileAttachmentAnnotation;
  35722. }();
  35723. exports.Annotation = Annotation;
  35724. exports.AnnotationBorderStyle = AnnotationBorderStyle;
  35725. exports.AnnotationFactory = AnnotationFactory;
  35726. /***/ }),
  35727. /* 21 */
  35728. /***/ (function(module, exports, __w_pdfjs_require__) {
  35729. "use strict";
  35730. var sharedUtil = __w_pdfjs_require__(0);
  35731. var warn = sharedUtil.warn;
  35732. var baseTypes = [
  35733. 'BN',
  35734. 'BN',
  35735. 'BN',
  35736. 'BN',
  35737. 'BN',
  35738. 'BN',
  35739. 'BN',
  35740. 'BN',
  35741. 'BN',
  35742. 'S',
  35743. 'B',
  35744. 'S',
  35745. 'WS',
  35746. 'B',
  35747. 'BN',
  35748. 'BN',
  35749. 'BN',
  35750. 'BN',
  35751. 'BN',
  35752. 'BN',
  35753. 'BN',
  35754. 'BN',
  35755. 'BN',
  35756. 'BN',
  35757. 'BN',
  35758. 'BN',
  35759. 'BN',
  35760. 'BN',
  35761. 'B',
  35762. 'B',
  35763. 'B',
  35764. 'S',
  35765. 'WS',
  35766. 'ON',
  35767. 'ON',
  35768. 'ET',
  35769. 'ET',
  35770. 'ET',
  35771. 'ON',
  35772. 'ON',
  35773. 'ON',
  35774. 'ON',
  35775. 'ON',
  35776. 'ES',
  35777. 'CS',
  35778. 'ES',
  35779. 'CS',
  35780. 'CS',
  35781. 'EN',
  35782. 'EN',
  35783. 'EN',
  35784. 'EN',
  35785. 'EN',
  35786. 'EN',
  35787. 'EN',
  35788. 'EN',
  35789. 'EN',
  35790. 'EN',
  35791. 'CS',
  35792. 'ON',
  35793. 'ON',
  35794. 'ON',
  35795. 'ON',
  35796. 'ON',
  35797. 'ON',
  35798. 'L',
  35799. 'L',
  35800. 'L',
  35801. 'L',
  35802. 'L',
  35803. 'L',
  35804. 'L',
  35805. 'L',
  35806. 'L',
  35807. 'L',
  35808. 'L',
  35809. 'L',
  35810. 'L',
  35811. 'L',
  35812. 'L',
  35813. 'L',
  35814. 'L',
  35815. 'L',
  35816. 'L',
  35817. 'L',
  35818. 'L',
  35819. 'L',
  35820. 'L',
  35821. 'L',
  35822. 'L',
  35823. 'L',
  35824. 'ON',
  35825. 'ON',
  35826. 'ON',
  35827. 'ON',
  35828. 'ON',
  35829. 'ON',
  35830. 'L',
  35831. 'L',
  35832. 'L',
  35833. 'L',
  35834. 'L',
  35835. 'L',
  35836. 'L',
  35837. 'L',
  35838. 'L',
  35839. 'L',
  35840. 'L',
  35841. 'L',
  35842. 'L',
  35843. 'L',
  35844. 'L',
  35845. 'L',
  35846. 'L',
  35847. 'L',
  35848. 'L',
  35849. 'L',
  35850. 'L',
  35851. 'L',
  35852. 'L',
  35853. 'L',
  35854. 'L',
  35855. 'L',
  35856. 'ON',
  35857. 'ON',
  35858. 'ON',
  35859. 'ON',
  35860. 'BN',
  35861. 'BN',
  35862. 'BN',
  35863. 'BN',
  35864. 'BN',
  35865. 'BN',
  35866. 'B',
  35867. 'BN',
  35868. 'BN',
  35869. 'BN',
  35870. 'BN',
  35871. 'BN',
  35872. 'BN',
  35873. 'BN',
  35874. 'BN',
  35875. 'BN',
  35876. 'BN',
  35877. 'BN',
  35878. 'BN',
  35879. 'BN',
  35880. 'BN',
  35881. 'BN',
  35882. 'BN',
  35883. 'BN',
  35884. 'BN',
  35885. 'BN',
  35886. 'BN',
  35887. 'BN',
  35888. 'BN',
  35889. 'BN',
  35890. 'BN',
  35891. 'BN',
  35892. 'BN',
  35893. 'CS',
  35894. 'ON',
  35895. 'ET',
  35896. 'ET',
  35897. 'ET',
  35898. 'ET',
  35899. 'ON',
  35900. 'ON',
  35901. 'ON',
  35902. 'ON',
  35903. 'L',
  35904. 'ON',
  35905. 'ON',
  35906. 'BN',
  35907. 'ON',
  35908. 'ON',
  35909. 'ET',
  35910. 'ET',
  35911. 'EN',
  35912. 'EN',
  35913. 'ON',
  35914. 'L',
  35915. 'ON',
  35916. 'ON',
  35917. 'ON',
  35918. 'EN',
  35919. 'L',
  35920. 'ON',
  35921. 'ON',
  35922. 'ON',
  35923. 'ON',
  35924. 'ON',
  35925. 'L',
  35926. 'L',
  35927. 'L',
  35928. 'L',
  35929. 'L',
  35930. 'L',
  35931. 'L',
  35932. 'L',
  35933. 'L',
  35934. 'L',
  35935. 'L',
  35936. 'L',
  35937. 'L',
  35938. 'L',
  35939. 'L',
  35940. 'L',
  35941. 'L',
  35942. 'L',
  35943. 'L',
  35944. 'L',
  35945. 'L',
  35946. 'L',
  35947. 'L',
  35948. 'ON',
  35949. 'L',
  35950. 'L',
  35951. 'L',
  35952. 'L',
  35953. 'L',
  35954. 'L',
  35955. 'L',
  35956. 'L',
  35957. 'L',
  35958. 'L',
  35959. 'L',
  35960. 'L',
  35961. 'L',
  35962. 'L',
  35963. 'L',
  35964. 'L',
  35965. 'L',
  35966. 'L',
  35967. 'L',
  35968. 'L',
  35969. 'L',
  35970. 'L',
  35971. 'L',
  35972. 'L',
  35973. 'L',
  35974. 'L',
  35975. 'L',
  35976. 'L',
  35977. 'L',
  35978. 'L',
  35979. 'L',
  35980. 'ON',
  35981. 'L',
  35982. 'L',
  35983. 'L',
  35984. 'L',
  35985. 'L',
  35986. 'L',
  35987. 'L',
  35988. 'L'
  35989. ];
  35990. var arabicTypes = [
  35991. 'AN',
  35992. 'AN',
  35993. 'AN',
  35994. 'AN',
  35995. 'AN',
  35996. 'AN',
  35997. 'ON',
  35998. 'ON',
  35999. 'AL',
  36000. 'ET',
  36001. 'ET',
  36002. 'AL',
  36003. 'CS',
  36004. 'AL',
  36005. 'ON',
  36006. 'ON',
  36007. 'NSM',
  36008. 'NSM',
  36009. 'NSM',
  36010. 'NSM',
  36011. 'NSM',
  36012. 'NSM',
  36013. 'NSM',
  36014. 'NSM',
  36015. 'NSM',
  36016. 'NSM',
  36017. 'NSM',
  36018. 'AL',
  36019. 'AL',
  36020. '',
  36021. 'AL',
  36022. 'AL',
  36023. 'AL',
  36024. 'AL',
  36025. 'AL',
  36026. 'AL',
  36027. 'AL',
  36028. 'AL',
  36029. 'AL',
  36030. 'AL',
  36031. 'AL',
  36032. 'AL',
  36033. 'AL',
  36034. 'AL',
  36035. 'AL',
  36036. 'AL',
  36037. 'AL',
  36038. 'AL',
  36039. 'AL',
  36040. 'AL',
  36041. 'AL',
  36042. 'AL',
  36043. 'AL',
  36044. 'AL',
  36045. 'AL',
  36046. 'AL',
  36047. 'AL',
  36048. 'AL',
  36049. 'AL',
  36050. 'AL',
  36051. 'AL',
  36052. 'AL',
  36053. 'AL',
  36054. 'AL',
  36055. 'AL',
  36056. 'AL',
  36057. 'AL',
  36058. 'AL',
  36059. 'AL',
  36060. 'AL',
  36061. 'AL',
  36062. 'AL',
  36063. 'AL',
  36064. 'AL',
  36065. 'AL',
  36066. 'NSM',
  36067. 'NSM',
  36068. 'NSM',
  36069. 'NSM',
  36070. 'NSM',
  36071. 'NSM',
  36072. 'NSM',
  36073. 'NSM',
  36074. 'NSM',
  36075. 'NSM',
  36076. 'NSM',
  36077. 'NSM',
  36078. 'NSM',
  36079. 'NSM',
  36080. 'NSM',
  36081. 'NSM',
  36082. 'NSM',
  36083. 'NSM',
  36084. 'NSM',
  36085. 'NSM',
  36086. 'NSM',
  36087. 'AN',
  36088. 'AN',
  36089. 'AN',
  36090. 'AN',
  36091. 'AN',
  36092. 'AN',
  36093. 'AN',
  36094. 'AN',
  36095. 'AN',
  36096. 'AN',
  36097. 'ET',
  36098. 'AN',
  36099. 'AN',
  36100. 'AL',
  36101. 'AL',
  36102. 'AL',
  36103. 'NSM',
  36104. 'AL',
  36105. 'AL',
  36106. 'AL',
  36107. 'AL',
  36108. 'AL',
  36109. 'AL',
  36110. 'AL',
  36111. 'AL',
  36112. 'AL',
  36113. 'AL',
  36114. 'AL',
  36115. 'AL',
  36116. 'AL',
  36117. 'AL',
  36118. 'AL',
  36119. 'AL',
  36120. 'AL',
  36121. 'AL',
  36122. 'AL',
  36123. 'AL',
  36124. 'AL',
  36125. 'AL',
  36126. 'AL',
  36127. 'AL',
  36128. 'AL',
  36129. 'AL',
  36130. 'AL',
  36131. 'AL',
  36132. 'AL',
  36133. 'AL',
  36134. 'AL',
  36135. 'AL',
  36136. 'AL',
  36137. 'AL',
  36138. 'AL',
  36139. 'AL',
  36140. 'AL',
  36141. 'AL',
  36142. 'AL',
  36143. 'AL',
  36144. 'AL',
  36145. 'AL',
  36146. 'AL',
  36147. 'AL',
  36148. 'AL',
  36149. 'AL',
  36150. 'AL',
  36151. 'AL',
  36152. 'AL',
  36153. 'AL',
  36154. 'AL',
  36155. 'AL',
  36156. 'AL',
  36157. 'AL',
  36158. 'AL',
  36159. 'AL',
  36160. 'AL',
  36161. 'AL',
  36162. 'AL',
  36163. 'AL',
  36164. 'AL',
  36165. 'AL',
  36166. 'AL',
  36167. 'AL',
  36168. 'AL',
  36169. 'AL',
  36170. 'AL',
  36171. 'AL',
  36172. 'AL',
  36173. 'AL',
  36174. 'AL',
  36175. 'AL',
  36176. 'AL',
  36177. 'AL',
  36178. 'AL',
  36179. 'AL',
  36180. 'AL',
  36181. 'AL',
  36182. 'AL',
  36183. 'AL',
  36184. 'AL',
  36185. 'AL',
  36186. 'AL',
  36187. 'AL',
  36188. 'AL',
  36189. 'AL',
  36190. 'AL',
  36191. 'AL',
  36192. 'AL',
  36193. 'AL',
  36194. 'AL',
  36195. 'AL',
  36196. 'AL',
  36197. 'AL',
  36198. 'AL',
  36199. 'AL',
  36200. 'AL',
  36201. 'AL',
  36202. 'AL',
  36203. 'AL',
  36204. 'AL',
  36205. 'NSM',
  36206. 'NSM',
  36207. 'NSM',
  36208. 'NSM',
  36209. 'NSM',
  36210. 'NSM',
  36211. 'NSM',
  36212. 'AN',
  36213. 'ON',
  36214. 'NSM',
  36215. 'NSM',
  36216. 'NSM',
  36217. 'NSM',
  36218. 'NSM',
  36219. 'NSM',
  36220. 'AL',
  36221. 'AL',
  36222. 'NSM',
  36223. 'NSM',
  36224. 'ON',
  36225. 'NSM',
  36226. 'NSM',
  36227. 'NSM',
  36228. 'NSM',
  36229. 'AL',
  36230. 'AL',
  36231. 'EN',
  36232. 'EN',
  36233. 'EN',
  36234. 'EN',
  36235. 'EN',
  36236. 'EN',
  36237. 'EN',
  36238. 'EN',
  36239. 'EN',
  36240. 'EN',
  36241. 'AL',
  36242. 'AL',
  36243. 'AL',
  36244. 'AL',
  36245. 'AL',
  36246. 'AL'
  36247. ];
  36248. function isOdd(i) {
  36249. return (i & 1) !== 0;
  36250. }
  36251. function isEven(i) {
  36252. return (i & 1) === 0;
  36253. }
  36254. function findUnequal(arr, start, value) {
  36255. for (var j = start, jj = arr.length; j < jj; ++j) {
  36256. if (arr[j] !== value) {
  36257. return j;
  36258. }
  36259. }
  36260. return j;
  36261. }
  36262. function setValues(arr, start, end, value) {
  36263. for (var j = start; j < end; ++j) {
  36264. arr[j] = value;
  36265. }
  36266. }
  36267. function reverseValues(arr, start, end) {
  36268. for (var i = start, j = end - 1; i < j; ++i, --j) {
  36269. var temp = arr[i];
  36270. arr[i] = arr[j];
  36271. arr[j] = temp;
  36272. }
  36273. }
  36274. function createBidiText(str, isLTR, vertical) {
  36275. return {
  36276. str: str,
  36277. dir: vertical ? 'ttb' : isLTR ? 'ltr' : 'rtl'
  36278. };
  36279. }
  36280. var chars = [];
  36281. var types = [];
  36282. function bidi(str, startLevel, vertical) {
  36283. var isLTR = true;
  36284. var strLength = str.length;
  36285. if (strLength === 0 || vertical) {
  36286. return createBidiText(str, isLTR, vertical);
  36287. }
  36288. chars.length = strLength;
  36289. types.length = strLength;
  36290. var numBidi = 0;
  36291. var i, ii;
  36292. for (i = 0; i < strLength; ++i) {
  36293. chars[i] = str.charAt(i);
  36294. var charCode = str.charCodeAt(i);
  36295. var charType = 'L';
  36296. if (charCode <= 0x00ff) {
  36297. charType = baseTypes[charCode];
  36298. } else if (0x0590 <= charCode && charCode <= 0x05f4) {
  36299. charType = 'R';
  36300. } else if (0x0600 <= charCode && charCode <= 0x06ff) {
  36301. charType = arabicTypes[charCode & 0xff];
  36302. if (!charType) {
  36303. warn('Bidi: invalid Unicode character ' + charCode.toString(16));
  36304. }
  36305. } else if (0x0700 <= charCode && charCode <= 0x08AC) {
  36306. charType = 'AL';
  36307. }
  36308. if (charType === 'R' || charType === 'AL' || charType === 'AN') {
  36309. numBidi++;
  36310. }
  36311. types[i] = charType;
  36312. }
  36313. if (numBidi === 0) {
  36314. isLTR = true;
  36315. return createBidiText(str, isLTR);
  36316. }
  36317. if (startLevel === -1) {
  36318. if (numBidi / strLength < 0.3) {
  36319. isLTR = true;
  36320. startLevel = 0;
  36321. } else {
  36322. isLTR = false;
  36323. startLevel = 1;
  36324. }
  36325. }
  36326. var levels = [];
  36327. for (i = 0; i < strLength; ++i) {
  36328. levels[i] = startLevel;
  36329. }
  36330. var e = isOdd(startLevel) ? 'R' : 'L';
  36331. var sor = e;
  36332. var eor = sor;
  36333. var lastType = sor;
  36334. for (i = 0; i < strLength; ++i) {
  36335. if (types[i] === 'NSM') {
  36336. types[i] = lastType;
  36337. } else {
  36338. lastType = types[i];
  36339. }
  36340. }
  36341. lastType = sor;
  36342. var t;
  36343. for (i = 0; i < strLength; ++i) {
  36344. t = types[i];
  36345. if (t === 'EN') {
  36346. types[i] = lastType === 'AL' ? 'AN' : 'EN';
  36347. } else if (t === 'R' || t === 'L' || t === 'AL') {
  36348. lastType = t;
  36349. }
  36350. }
  36351. for (i = 0; i < strLength; ++i) {
  36352. t = types[i];
  36353. if (t === 'AL') {
  36354. types[i] = 'R';
  36355. }
  36356. }
  36357. for (i = 1; i < strLength - 1; ++i) {
  36358. if (types[i] === 'ES' && types[i - 1] === 'EN' && types[i + 1] === 'EN') {
  36359. types[i] = 'EN';
  36360. }
  36361. if (types[i] === 'CS' && (types[i - 1] === 'EN' || types[i - 1] === 'AN') && types[i + 1] === types[i - 1]) {
  36362. types[i] = types[i - 1];
  36363. }
  36364. }
  36365. for (i = 0; i < strLength; ++i) {
  36366. if (types[i] === 'EN') {
  36367. var j;
  36368. for (j = i - 1; j >= 0; --j) {
  36369. if (types[j] !== 'ET') {
  36370. break;
  36371. }
  36372. types[j] = 'EN';
  36373. }
  36374. for (j = i + 1; j < strLength; ++j) {
  36375. if (types[j] !== 'ET') {
  36376. break;
  36377. }
  36378. types[j] = 'EN';
  36379. }
  36380. }
  36381. }
  36382. for (i = 0; i < strLength; ++i) {
  36383. t = types[i];
  36384. if (t === 'WS' || t === 'ES' || t === 'ET' || t === 'CS') {
  36385. types[i] = 'ON';
  36386. }
  36387. }
  36388. lastType = sor;
  36389. for (i = 0; i < strLength; ++i) {
  36390. t = types[i];
  36391. if (t === 'EN') {
  36392. types[i] = lastType === 'L' ? 'L' : 'EN';
  36393. } else if (t === 'R' || t === 'L') {
  36394. lastType = t;
  36395. }
  36396. }
  36397. for (i = 0; i < strLength; ++i) {
  36398. if (types[i] === 'ON') {
  36399. var end = findUnequal(types, i + 1, 'ON');
  36400. var before = sor;
  36401. if (i > 0) {
  36402. before = types[i - 1];
  36403. }
  36404. var after = eor;
  36405. if (end + 1 < strLength) {
  36406. after = types[end + 1];
  36407. }
  36408. if (before !== 'L') {
  36409. before = 'R';
  36410. }
  36411. if (after !== 'L') {
  36412. after = 'R';
  36413. }
  36414. if (before === after) {
  36415. setValues(types, i, end, before);
  36416. }
  36417. i = end - 1;
  36418. }
  36419. }
  36420. for (i = 0; i < strLength; ++i) {
  36421. if (types[i] === 'ON') {
  36422. types[i] = e;
  36423. }
  36424. }
  36425. for (i = 0; i < strLength; ++i) {
  36426. t = types[i];
  36427. if (isEven(levels[i])) {
  36428. if (t === 'R') {
  36429. levels[i] += 1;
  36430. } else if (t === 'AN' || t === 'EN') {
  36431. levels[i] += 2;
  36432. }
  36433. } else {
  36434. if (t === 'L' || t === 'AN' || t === 'EN') {
  36435. levels[i] += 1;
  36436. }
  36437. }
  36438. }
  36439. var highestLevel = -1;
  36440. var lowestOddLevel = 99;
  36441. var level;
  36442. for (i = 0, ii = levels.length; i < ii; ++i) {
  36443. level = levels[i];
  36444. if (highestLevel < level) {
  36445. highestLevel = level;
  36446. }
  36447. if (lowestOddLevel > level && isOdd(level)) {
  36448. lowestOddLevel = level;
  36449. }
  36450. }
  36451. for (level = highestLevel; level >= lowestOddLevel; --level) {
  36452. var start = -1;
  36453. for (i = 0, ii = levels.length; i < ii; ++i) {
  36454. if (levels[i] < level) {
  36455. if (start >= 0) {
  36456. reverseValues(chars, start, i);
  36457. start = -1;
  36458. }
  36459. } else if (start < 0) {
  36460. start = i;
  36461. }
  36462. }
  36463. if (start >= 0) {
  36464. reverseValues(chars, start, levels.length);
  36465. }
  36466. }
  36467. for (i = 0, ii = chars.length; i < ii; ++i) {
  36468. var ch = chars[i];
  36469. if (ch === '<' || ch === '>') {
  36470. chars[i] = '';
  36471. }
  36472. }
  36473. return createBidiText(chars.join(''), isLTR);
  36474. }
  36475. exports.bidi = bidi;
  36476. /***/ }),
  36477. /* 22 */
  36478. /***/ (function(module, exports, __w_pdfjs_require__) {
  36479. "use strict";
  36480. var ISOAdobeCharset = [
  36481. '.notdef',
  36482. 'space',
  36483. 'exclam',
  36484. 'quotedbl',
  36485. 'numbersign',
  36486. 'dollar',
  36487. 'percent',
  36488. 'ampersand',
  36489. 'quoteright',
  36490. 'parenleft',
  36491. 'parenright',
  36492. 'asterisk',
  36493. 'plus',
  36494. 'comma',
  36495. 'hyphen',
  36496. 'period',
  36497. 'slash',
  36498. 'zero',
  36499. 'one',
  36500. 'two',
  36501. 'three',
  36502. 'four',
  36503. 'five',
  36504. 'six',
  36505. 'seven',
  36506. 'eight',
  36507. 'nine',
  36508. 'colon',
  36509. 'semicolon',
  36510. 'less',
  36511. 'equal',
  36512. 'greater',
  36513. 'question',
  36514. 'at',
  36515. 'A',
  36516. 'B',
  36517. 'C',
  36518. 'D',
  36519. 'E',
  36520. 'F',
  36521. 'G',
  36522. 'H',
  36523. 'I',
  36524. 'J',
  36525. 'K',
  36526. 'L',
  36527. 'M',
  36528. 'N',
  36529. 'O',
  36530. 'P',
  36531. 'Q',
  36532. 'R',
  36533. 'S',
  36534. 'T',
  36535. 'U',
  36536. 'V',
  36537. 'W',
  36538. 'X',
  36539. 'Y',
  36540. 'Z',
  36541. 'bracketleft',
  36542. 'backslash',
  36543. 'bracketright',
  36544. 'asciicircum',
  36545. 'underscore',
  36546. 'quoteleft',
  36547. 'a',
  36548. 'b',
  36549. 'c',
  36550. 'd',
  36551. 'e',
  36552. 'f',
  36553. 'g',
  36554. 'h',
  36555. 'i',
  36556. 'j',
  36557. 'k',
  36558. 'l',
  36559. 'm',
  36560. 'n',
  36561. 'o',
  36562. 'p',
  36563. 'q',
  36564. 'r',
  36565. 's',
  36566. 't',
  36567. 'u',
  36568. 'v',
  36569. 'w',
  36570. 'x',
  36571. 'y',
  36572. 'z',
  36573. 'braceleft',
  36574. 'bar',
  36575. 'braceright',
  36576. 'asciitilde',
  36577. 'exclamdown',
  36578. 'cent',
  36579. 'sterling',
  36580. 'fraction',
  36581. 'yen',
  36582. 'florin',
  36583. 'section',
  36584. 'currency',
  36585. 'quotesingle',
  36586. 'quotedblleft',
  36587. 'guillemotleft',
  36588. 'guilsinglleft',
  36589. 'guilsinglright',
  36590. 'fi',
  36591. 'fl',
  36592. 'endash',
  36593. 'dagger',
  36594. 'daggerdbl',
  36595. 'periodcentered',
  36596. 'paragraph',
  36597. 'bullet',
  36598. 'quotesinglbase',
  36599. 'quotedblbase',
  36600. 'quotedblright',
  36601. 'guillemotright',
  36602. 'ellipsis',
  36603. 'perthousand',
  36604. 'questiondown',
  36605. 'grave',
  36606. 'acute',
  36607. 'circumflex',
  36608. 'tilde',
  36609. 'macron',
  36610. 'breve',
  36611. 'dotaccent',
  36612. 'dieresis',
  36613. 'ring',
  36614. 'cedilla',
  36615. 'hungarumlaut',
  36616. 'ogonek',
  36617. 'caron',
  36618. 'emdash',
  36619. 'AE',
  36620. 'ordfeminine',
  36621. 'Lslash',
  36622. 'Oslash',
  36623. 'OE',
  36624. 'ordmasculine',
  36625. 'ae',
  36626. 'dotlessi',
  36627. 'lslash',
  36628. 'oslash',
  36629. 'oe',
  36630. 'germandbls',
  36631. 'onesuperior',
  36632. 'logicalnot',
  36633. 'mu',
  36634. 'trademark',
  36635. 'Eth',
  36636. 'onehalf',
  36637. 'plusminus',
  36638. 'Thorn',
  36639. 'onequarter',
  36640. 'divide',
  36641. 'brokenbar',
  36642. 'degree',
  36643. 'thorn',
  36644. 'threequarters',
  36645. 'twosuperior',
  36646. 'registered',
  36647. 'minus',
  36648. 'eth',
  36649. 'multiply',
  36650. 'threesuperior',
  36651. 'copyright',
  36652. 'Aacute',
  36653. 'Acircumflex',
  36654. 'Adieresis',
  36655. 'Agrave',
  36656. 'Aring',
  36657. 'Atilde',
  36658. 'Ccedilla',
  36659. 'Eacute',
  36660. 'Ecircumflex',
  36661. 'Edieresis',
  36662. 'Egrave',
  36663. 'Iacute',
  36664. 'Icircumflex',
  36665. 'Idieresis',
  36666. 'Igrave',
  36667. 'Ntilde',
  36668. 'Oacute',
  36669. 'Ocircumflex',
  36670. 'Odieresis',
  36671. 'Ograve',
  36672. 'Otilde',
  36673. 'Scaron',
  36674. 'Uacute',
  36675. 'Ucircumflex',
  36676. 'Udieresis',
  36677. 'Ugrave',
  36678. 'Yacute',
  36679. 'Ydieresis',
  36680. 'Zcaron',
  36681. 'aacute',
  36682. 'acircumflex',
  36683. 'adieresis',
  36684. 'agrave',
  36685. 'aring',
  36686. 'atilde',
  36687. 'ccedilla',
  36688. 'eacute',
  36689. 'ecircumflex',
  36690. 'edieresis',
  36691. 'egrave',
  36692. 'iacute',
  36693. 'icircumflex',
  36694. 'idieresis',
  36695. 'igrave',
  36696. 'ntilde',
  36697. 'oacute',
  36698. 'ocircumflex',
  36699. 'odieresis',
  36700. 'ograve',
  36701. 'otilde',
  36702. 'scaron',
  36703. 'uacute',
  36704. 'ucircumflex',
  36705. 'udieresis',
  36706. 'ugrave',
  36707. 'yacute',
  36708. 'ydieresis',
  36709. 'zcaron'
  36710. ];
  36711. var ExpertCharset = [
  36712. '.notdef',
  36713. 'space',
  36714. 'exclamsmall',
  36715. 'Hungarumlautsmall',
  36716. 'dollaroldstyle',
  36717. 'dollarsuperior',
  36718. 'ampersandsmall',
  36719. 'Acutesmall',
  36720. 'parenleftsuperior',
  36721. 'parenrightsuperior',
  36722. 'twodotenleader',
  36723. 'onedotenleader',
  36724. 'comma',
  36725. 'hyphen',
  36726. 'period',
  36727. 'fraction',
  36728. 'zerooldstyle',
  36729. 'oneoldstyle',
  36730. 'twooldstyle',
  36731. 'threeoldstyle',
  36732. 'fouroldstyle',
  36733. 'fiveoldstyle',
  36734. 'sixoldstyle',
  36735. 'sevenoldstyle',
  36736. 'eightoldstyle',
  36737. 'nineoldstyle',
  36738. 'colon',
  36739. 'semicolon',
  36740. 'commasuperior',
  36741. 'threequartersemdash',
  36742. 'periodsuperior',
  36743. 'questionsmall',
  36744. 'asuperior',
  36745. 'bsuperior',
  36746. 'centsuperior',
  36747. 'dsuperior',
  36748. 'esuperior',
  36749. 'isuperior',
  36750. 'lsuperior',
  36751. 'msuperior',
  36752. 'nsuperior',
  36753. 'osuperior',
  36754. 'rsuperior',
  36755. 'ssuperior',
  36756. 'tsuperior',
  36757. 'ff',
  36758. 'fi',
  36759. 'fl',
  36760. 'ffi',
  36761. 'ffl',
  36762. 'parenleftinferior',
  36763. 'parenrightinferior',
  36764. 'Circumflexsmall',
  36765. 'hyphensuperior',
  36766. 'Gravesmall',
  36767. 'Asmall',
  36768. 'Bsmall',
  36769. 'Csmall',
  36770. 'Dsmall',
  36771. 'Esmall',
  36772. 'Fsmall',
  36773. 'Gsmall',
  36774. 'Hsmall',
  36775. 'Ismall',
  36776. 'Jsmall',
  36777. 'Ksmall',
  36778. 'Lsmall',
  36779. 'Msmall',
  36780. 'Nsmall',
  36781. 'Osmall',
  36782. 'Psmall',
  36783. 'Qsmall',
  36784. 'Rsmall',
  36785. 'Ssmall',
  36786. 'Tsmall',
  36787. 'Usmall',
  36788. 'Vsmall',
  36789. 'Wsmall',
  36790. 'Xsmall',
  36791. 'Ysmall',
  36792. 'Zsmall',
  36793. 'colonmonetary',
  36794. 'onefitted',
  36795. 'rupiah',
  36796. 'Tildesmall',
  36797. 'exclamdownsmall',
  36798. 'centoldstyle',
  36799. 'Lslashsmall',
  36800. 'Scaronsmall',
  36801. 'Zcaronsmall',
  36802. 'Dieresissmall',
  36803. 'Brevesmall',
  36804. 'Caronsmall',
  36805. 'Dotaccentsmall',
  36806. 'Macronsmall',
  36807. 'figuredash',
  36808. 'hypheninferior',
  36809. 'Ogoneksmall',
  36810. 'Ringsmall',
  36811. 'Cedillasmall',
  36812. 'onequarter',
  36813. 'onehalf',
  36814. 'threequarters',
  36815. 'questiondownsmall',
  36816. 'oneeighth',
  36817. 'threeeighths',
  36818. 'fiveeighths',
  36819. 'seveneighths',
  36820. 'onethird',
  36821. 'twothirds',
  36822. 'zerosuperior',
  36823. 'onesuperior',
  36824. 'twosuperior',
  36825. 'threesuperior',
  36826. 'foursuperior',
  36827. 'fivesuperior',
  36828. 'sixsuperior',
  36829. 'sevensuperior',
  36830. 'eightsuperior',
  36831. 'ninesuperior',
  36832. 'zeroinferior',
  36833. 'oneinferior',
  36834. 'twoinferior',
  36835. 'threeinferior',
  36836. 'fourinferior',
  36837. 'fiveinferior',
  36838. 'sixinferior',
  36839. 'seveninferior',
  36840. 'eightinferior',
  36841. 'nineinferior',
  36842. 'centinferior',
  36843. 'dollarinferior',
  36844. 'periodinferior',
  36845. 'commainferior',
  36846. 'Agravesmall',
  36847. 'Aacutesmall',
  36848. 'Acircumflexsmall',
  36849. 'Atildesmall',
  36850. 'Adieresissmall',
  36851. 'Aringsmall',
  36852. 'AEsmall',
  36853. 'Ccedillasmall',
  36854. 'Egravesmall',
  36855. 'Eacutesmall',
  36856. 'Ecircumflexsmall',
  36857. 'Edieresissmall',
  36858. 'Igravesmall',
  36859. 'Iacutesmall',
  36860. 'Icircumflexsmall',
  36861. 'Idieresissmall',
  36862. 'Ethsmall',
  36863. 'Ntildesmall',
  36864. 'Ogravesmall',
  36865. 'Oacutesmall',
  36866. 'Ocircumflexsmall',
  36867. 'Otildesmall',
  36868. 'Odieresissmall',
  36869. 'OEsmall',
  36870. 'Oslashsmall',
  36871. 'Ugravesmall',
  36872. 'Uacutesmall',
  36873. 'Ucircumflexsmall',
  36874. 'Udieresissmall',
  36875. 'Yacutesmall',
  36876. 'Thornsmall',
  36877. 'Ydieresissmall'
  36878. ];
  36879. var ExpertSubsetCharset = [
  36880. '.notdef',
  36881. 'space',
  36882. 'dollaroldstyle',
  36883. 'dollarsuperior',
  36884. 'parenleftsuperior',
  36885. 'parenrightsuperior',
  36886. 'twodotenleader',
  36887. 'onedotenleader',
  36888. 'comma',
  36889. 'hyphen',
  36890. 'period',
  36891. 'fraction',
  36892. 'zerooldstyle',
  36893. 'oneoldstyle',
  36894. 'twooldstyle',
  36895. 'threeoldstyle',
  36896. 'fouroldstyle',
  36897. 'fiveoldstyle',
  36898. 'sixoldstyle',
  36899. 'sevenoldstyle',
  36900. 'eightoldstyle',
  36901. 'nineoldstyle',
  36902. 'colon',
  36903. 'semicolon',
  36904. 'commasuperior',
  36905. 'threequartersemdash',
  36906. 'periodsuperior',
  36907. 'asuperior',
  36908. 'bsuperior',
  36909. 'centsuperior',
  36910. 'dsuperior',
  36911. 'esuperior',
  36912. 'isuperior',
  36913. 'lsuperior',
  36914. 'msuperior',
  36915. 'nsuperior',
  36916. 'osuperior',
  36917. 'rsuperior',
  36918. 'ssuperior',
  36919. 'tsuperior',
  36920. 'ff',
  36921. 'fi',
  36922. 'fl',
  36923. 'ffi',
  36924. 'ffl',
  36925. 'parenleftinferior',
  36926. 'parenrightinferior',
  36927. 'hyphensuperior',
  36928. 'colonmonetary',
  36929. 'onefitted',
  36930. 'rupiah',
  36931. 'centoldstyle',
  36932. 'figuredash',
  36933. 'hypheninferior',
  36934. 'onequarter',
  36935. 'onehalf',
  36936. 'threequarters',
  36937. 'oneeighth',
  36938. 'threeeighths',
  36939. 'fiveeighths',
  36940. 'seveneighths',
  36941. 'onethird',
  36942. 'twothirds',
  36943. 'zerosuperior',
  36944. 'onesuperior',
  36945. 'twosuperior',
  36946. 'threesuperior',
  36947. 'foursuperior',
  36948. 'fivesuperior',
  36949. 'sixsuperior',
  36950. 'sevensuperior',
  36951. 'eightsuperior',
  36952. 'ninesuperior',
  36953. 'zeroinferior',
  36954. 'oneinferior',
  36955. 'twoinferior',
  36956. 'threeinferior',
  36957. 'fourinferior',
  36958. 'fiveinferior',
  36959. 'sixinferior',
  36960. 'seveninferior',
  36961. 'eightinferior',
  36962. 'nineinferior',
  36963. 'centinferior',
  36964. 'dollarinferior',
  36965. 'periodinferior',
  36966. 'commainferior'
  36967. ];
  36968. exports.ISOAdobeCharset = ISOAdobeCharset;
  36969. exports.ExpertCharset = ExpertCharset;
  36970. exports.ExpertSubsetCharset = ExpertSubsetCharset;
  36971. /***/ }),
  36972. /* 23 */
  36973. /***/ (function(module, exports, __w_pdfjs_require__) {
  36974. "use strict";
  36975. var sharedUtil = __w_pdfjs_require__(0);
  36976. var corePrimitives = __w_pdfjs_require__(1);
  36977. var coreStream = __w_pdfjs_require__(2);
  36978. var coreParser = __w_pdfjs_require__(5);
  36979. var Util = sharedUtil.Util;
  36980. var assert = sharedUtil.assert;
  36981. var warn = sharedUtil.warn;
  36982. var error = sharedUtil.error;
  36983. var isInt = sharedUtil.isInt;
  36984. var isString = sharedUtil.isString;
  36985. var MissingDataException = sharedUtil.MissingDataException;
  36986. var CMapCompressionType = sharedUtil.CMapCompressionType;
  36987. var isEOF = corePrimitives.isEOF;
  36988. var isName = corePrimitives.isName;
  36989. var isCmd = corePrimitives.isCmd;
  36990. var isStream = corePrimitives.isStream;
  36991. var Stream = coreStream.Stream;
  36992. var Lexer = coreParser.Lexer;
  36993. var BUILT_IN_CMAPS = [
  36994. 'Adobe-GB1-UCS2',
  36995. 'Adobe-CNS1-UCS2',
  36996. 'Adobe-Japan1-UCS2',
  36997. 'Adobe-Korea1-UCS2',
  36998. '78-EUC-H',
  36999. '78-EUC-V',
  37000. '78-H',
  37001. '78-RKSJ-H',
  37002. '78-RKSJ-V',
  37003. '78-V',
  37004. '78ms-RKSJ-H',
  37005. '78ms-RKSJ-V',
  37006. '83pv-RKSJ-H',
  37007. '90ms-RKSJ-H',
  37008. '90ms-RKSJ-V',
  37009. '90msp-RKSJ-H',
  37010. '90msp-RKSJ-V',
  37011. '90pv-RKSJ-H',
  37012. '90pv-RKSJ-V',
  37013. 'Add-H',
  37014. 'Add-RKSJ-H',
  37015. 'Add-RKSJ-V',
  37016. 'Add-V',
  37017. 'Adobe-CNS1-0',
  37018. 'Adobe-CNS1-1',
  37019. 'Adobe-CNS1-2',
  37020. 'Adobe-CNS1-3',
  37021. 'Adobe-CNS1-4',
  37022. 'Adobe-CNS1-5',
  37023. 'Adobe-CNS1-6',
  37024. 'Adobe-GB1-0',
  37025. 'Adobe-GB1-1',
  37026. 'Adobe-GB1-2',
  37027. 'Adobe-GB1-3',
  37028. 'Adobe-GB1-4',
  37029. 'Adobe-GB1-5',
  37030. 'Adobe-Japan1-0',
  37031. 'Adobe-Japan1-1',
  37032. 'Adobe-Japan1-2',
  37033. 'Adobe-Japan1-3',
  37034. 'Adobe-Japan1-4',
  37035. 'Adobe-Japan1-5',
  37036. 'Adobe-Japan1-6',
  37037. 'Adobe-Korea1-0',
  37038. 'Adobe-Korea1-1',
  37039. 'Adobe-Korea1-2',
  37040. 'B5-H',
  37041. 'B5-V',
  37042. 'B5pc-H',
  37043. 'B5pc-V',
  37044. 'CNS-EUC-H',
  37045. 'CNS-EUC-V',
  37046. 'CNS1-H',
  37047. 'CNS1-V',
  37048. 'CNS2-H',
  37049. 'CNS2-V',
  37050. 'ETHK-B5-H',
  37051. 'ETHK-B5-V',
  37052. 'ETen-B5-H',
  37053. 'ETen-B5-V',
  37054. 'ETenms-B5-H',
  37055. 'ETenms-B5-V',
  37056. 'EUC-H',
  37057. 'EUC-V',
  37058. 'Ext-H',
  37059. 'Ext-RKSJ-H',
  37060. 'Ext-RKSJ-V',
  37061. 'Ext-V',
  37062. 'GB-EUC-H',
  37063. 'GB-EUC-V',
  37064. 'GB-H',
  37065. 'GB-V',
  37066. 'GBK-EUC-H',
  37067. 'GBK-EUC-V',
  37068. 'GBK2K-H',
  37069. 'GBK2K-V',
  37070. 'GBKp-EUC-H',
  37071. 'GBKp-EUC-V',
  37072. 'GBT-EUC-H',
  37073. 'GBT-EUC-V',
  37074. 'GBT-H',
  37075. 'GBT-V',
  37076. 'GBTpc-EUC-H',
  37077. 'GBTpc-EUC-V',
  37078. 'GBpc-EUC-H',
  37079. 'GBpc-EUC-V',
  37080. 'H',
  37081. 'HKdla-B5-H',
  37082. 'HKdla-B5-V',
  37083. 'HKdlb-B5-H',
  37084. 'HKdlb-B5-V',
  37085. 'HKgccs-B5-H',
  37086. 'HKgccs-B5-V',
  37087. 'HKm314-B5-H',
  37088. 'HKm314-B5-V',
  37089. 'HKm471-B5-H',
  37090. 'HKm471-B5-V',
  37091. 'HKscs-B5-H',
  37092. 'HKscs-B5-V',
  37093. 'Hankaku',
  37094. 'Hiragana',
  37095. 'KSC-EUC-H',
  37096. 'KSC-EUC-V',
  37097. 'KSC-H',
  37098. 'KSC-Johab-H',
  37099. 'KSC-Johab-V',
  37100. 'KSC-V',
  37101. 'KSCms-UHC-H',
  37102. 'KSCms-UHC-HW-H',
  37103. 'KSCms-UHC-HW-V',
  37104. 'KSCms-UHC-V',
  37105. 'KSCpc-EUC-H',
  37106. 'KSCpc-EUC-V',
  37107. 'Katakana',
  37108. 'NWP-H',
  37109. 'NWP-V',
  37110. 'RKSJ-H',
  37111. 'RKSJ-V',
  37112. 'Roman',
  37113. 'UniCNS-UCS2-H',
  37114. 'UniCNS-UCS2-V',
  37115. 'UniCNS-UTF16-H',
  37116. 'UniCNS-UTF16-V',
  37117. 'UniCNS-UTF32-H',
  37118. 'UniCNS-UTF32-V',
  37119. 'UniCNS-UTF8-H',
  37120. 'UniCNS-UTF8-V',
  37121. 'UniGB-UCS2-H',
  37122. 'UniGB-UCS2-V',
  37123. 'UniGB-UTF16-H',
  37124. 'UniGB-UTF16-V',
  37125. 'UniGB-UTF32-H',
  37126. 'UniGB-UTF32-V',
  37127. 'UniGB-UTF8-H',
  37128. 'UniGB-UTF8-V',
  37129. 'UniJIS-UCS2-H',
  37130. 'UniJIS-UCS2-HW-H',
  37131. 'UniJIS-UCS2-HW-V',
  37132. 'UniJIS-UCS2-V',
  37133. 'UniJIS-UTF16-H',
  37134. 'UniJIS-UTF16-V',
  37135. 'UniJIS-UTF32-H',
  37136. 'UniJIS-UTF32-V',
  37137. 'UniJIS-UTF8-H',
  37138. 'UniJIS-UTF8-V',
  37139. 'UniJIS2004-UTF16-H',
  37140. 'UniJIS2004-UTF16-V',
  37141. 'UniJIS2004-UTF32-H',
  37142. 'UniJIS2004-UTF32-V',
  37143. 'UniJIS2004-UTF8-H',
  37144. 'UniJIS2004-UTF8-V',
  37145. 'UniJISPro-UCS2-HW-V',
  37146. 'UniJISPro-UCS2-V',
  37147. 'UniJISPro-UTF8-V',
  37148. 'UniJISX0213-UTF32-H',
  37149. 'UniJISX0213-UTF32-V',
  37150. 'UniJISX02132004-UTF32-H',
  37151. 'UniJISX02132004-UTF32-V',
  37152. 'UniKS-UCS2-H',
  37153. 'UniKS-UCS2-V',
  37154. 'UniKS-UTF16-H',
  37155. 'UniKS-UTF16-V',
  37156. 'UniKS-UTF32-H',
  37157. 'UniKS-UTF32-V',
  37158. 'UniKS-UTF8-H',
  37159. 'UniKS-UTF8-V',
  37160. 'V',
  37161. 'WP-Symbol'
  37162. ];
  37163. var CMap = function CMapClosure() {
  37164. function CMap(builtInCMap) {
  37165. this.codespaceRanges = [
  37166. [],
  37167. [],
  37168. [],
  37169. []
  37170. ];
  37171. this.numCodespaceRanges = 0;
  37172. this._map = [];
  37173. this.name = '';
  37174. this.vertical = false;
  37175. this.useCMap = null;
  37176. this.builtInCMap = builtInCMap;
  37177. }
  37178. CMap.prototype = {
  37179. addCodespaceRange: function (n, low, high) {
  37180. this.codespaceRanges[n - 1].push(low, high);
  37181. this.numCodespaceRanges++;
  37182. },
  37183. mapCidRange: function (low, high, dstLow) {
  37184. while (low <= high) {
  37185. this._map[low++] = dstLow++;
  37186. }
  37187. },
  37188. mapBfRange: function (low, high, dstLow) {
  37189. var lastByte = dstLow.length - 1;
  37190. while (low <= high) {
  37191. this._map[low++] = dstLow;
  37192. dstLow = dstLow.substr(0, lastByte) + String.fromCharCode(dstLow.charCodeAt(lastByte) + 1);
  37193. }
  37194. },
  37195. mapBfRangeToArray: function (low, high, array) {
  37196. var i = 0, ii = array.length;
  37197. while (low <= high && i < ii) {
  37198. this._map[low] = array[i++];
  37199. ++low;
  37200. }
  37201. },
  37202. mapOne: function (src, dst) {
  37203. this._map[src] = dst;
  37204. },
  37205. lookup: function (code) {
  37206. return this._map[code];
  37207. },
  37208. contains: function (code) {
  37209. return this._map[code] !== undefined;
  37210. },
  37211. forEach: function (callback) {
  37212. var map = this._map;
  37213. var length = map.length;
  37214. var i;
  37215. if (length <= 0x10000) {
  37216. for (i = 0; i < length; i++) {
  37217. if (map[i] !== undefined) {
  37218. callback(i, map[i]);
  37219. }
  37220. }
  37221. } else {
  37222. for (i in this._map) {
  37223. callback(i, map[i]);
  37224. }
  37225. }
  37226. },
  37227. charCodeOf: function (value) {
  37228. return this._map.indexOf(value);
  37229. },
  37230. getMap: function () {
  37231. return this._map;
  37232. },
  37233. readCharCode: function (str, offset, out) {
  37234. var c = 0;
  37235. var codespaceRanges = this.codespaceRanges;
  37236. var codespaceRangesLen = this.codespaceRanges.length;
  37237. for (var n = 0; n < codespaceRangesLen; n++) {
  37238. c = (c << 8 | str.charCodeAt(offset + n)) >>> 0;
  37239. var codespaceRange = codespaceRanges[n];
  37240. for (var k = 0, kk = codespaceRange.length; k < kk;) {
  37241. var low = codespaceRange[k++];
  37242. var high = codespaceRange[k++];
  37243. if (c >= low && c <= high) {
  37244. out.charcode = c;
  37245. out.length = n + 1;
  37246. return;
  37247. }
  37248. }
  37249. }
  37250. out.charcode = 0;
  37251. out.length = 1;
  37252. },
  37253. get length() {
  37254. return this._map.length;
  37255. },
  37256. get isIdentityCMap() {
  37257. if (!(this.name === 'Identity-H' || this.name === 'Identity-V')) {
  37258. return false;
  37259. }
  37260. if (this._map.length !== 0x10000) {
  37261. return false;
  37262. }
  37263. for (var i = 0; i < 0x10000; i++) {
  37264. if (this._map[i] !== i) {
  37265. return false;
  37266. }
  37267. }
  37268. return true;
  37269. }
  37270. };
  37271. return CMap;
  37272. }();
  37273. var IdentityCMap = function IdentityCMapClosure() {
  37274. function IdentityCMap(vertical, n) {
  37275. CMap.call(this);
  37276. this.vertical = vertical;
  37277. this.addCodespaceRange(n, 0, 0xffff);
  37278. }
  37279. Util.inherit(IdentityCMap, CMap, {});
  37280. IdentityCMap.prototype = {
  37281. addCodespaceRange: CMap.prototype.addCodespaceRange,
  37282. mapCidRange: function (low, high, dstLow) {
  37283. error('should not call mapCidRange');
  37284. },
  37285. mapBfRange: function (low, high, dstLow) {
  37286. error('should not call mapBfRange');
  37287. },
  37288. mapBfRangeToArray: function (low, high, array) {
  37289. error('should not call mapBfRangeToArray');
  37290. },
  37291. mapOne: function (src, dst) {
  37292. error('should not call mapCidOne');
  37293. },
  37294. lookup: function (code) {
  37295. return isInt(code) && code <= 0xffff ? code : undefined;
  37296. },
  37297. contains: function (code) {
  37298. return isInt(code) && code <= 0xffff;
  37299. },
  37300. forEach: function (callback) {
  37301. for (var i = 0; i <= 0xffff; i++) {
  37302. callback(i, i);
  37303. }
  37304. },
  37305. charCodeOf: function (value) {
  37306. return isInt(value) && value <= 0xffff ? value : -1;
  37307. },
  37308. getMap: function () {
  37309. var map = new Array(0x10000);
  37310. for (var i = 0; i <= 0xffff; i++) {
  37311. map[i] = i;
  37312. }
  37313. return map;
  37314. },
  37315. readCharCode: CMap.prototype.readCharCode,
  37316. get length() {
  37317. return 0x10000;
  37318. },
  37319. get isIdentityCMap() {
  37320. error('should not access .isIdentityCMap');
  37321. }
  37322. };
  37323. return IdentityCMap;
  37324. }();
  37325. var BinaryCMapReader = function BinaryCMapReaderClosure() {
  37326. function hexToInt(a, size) {
  37327. var n = 0;
  37328. for (var i = 0; i <= size; i++) {
  37329. n = n << 8 | a[i];
  37330. }
  37331. return n >>> 0;
  37332. }
  37333. function hexToStr(a, size) {
  37334. if (size === 1) {
  37335. return String.fromCharCode(a[0], a[1]);
  37336. }
  37337. if (size === 3) {
  37338. return String.fromCharCode(a[0], a[1], a[2], a[3]);
  37339. }
  37340. return String.fromCharCode.apply(null, a.subarray(0, size + 1));
  37341. }
  37342. function addHex(a, b, size) {
  37343. var c = 0;
  37344. for (var i = size; i >= 0; i--) {
  37345. c += a[i] + b[i];
  37346. a[i] = c & 255;
  37347. c >>= 8;
  37348. }
  37349. }
  37350. function incHex(a, size) {
  37351. var c = 1;
  37352. for (var i = size; i >= 0 && c > 0; i--) {
  37353. c += a[i];
  37354. a[i] = c & 255;
  37355. c >>= 8;
  37356. }
  37357. }
  37358. var MAX_NUM_SIZE = 16;
  37359. var MAX_ENCODED_NUM_SIZE = 19;
  37360. function BinaryCMapStream(data) {
  37361. this.buffer = data;
  37362. this.pos = 0;
  37363. this.end = data.length;
  37364. this.tmpBuf = new Uint8Array(MAX_ENCODED_NUM_SIZE);
  37365. }
  37366. BinaryCMapStream.prototype = {
  37367. readByte: function () {
  37368. if (this.pos >= this.end) {
  37369. return -1;
  37370. }
  37371. return this.buffer[this.pos++];
  37372. },
  37373. readNumber: function () {
  37374. var n = 0;
  37375. var last;
  37376. do {
  37377. var b = this.readByte();
  37378. if (b < 0) {
  37379. error('unexpected EOF in bcmap');
  37380. }
  37381. last = !(b & 0x80);
  37382. n = n << 7 | b & 0x7F;
  37383. } while (!last);
  37384. return n;
  37385. },
  37386. readSigned: function () {
  37387. var n = this.readNumber();
  37388. return n & 1 ? ~(n >>> 1) : n >>> 1;
  37389. },
  37390. readHex: function (num, size) {
  37391. num.set(this.buffer.subarray(this.pos, this.pos + size + 1));
  37392. this.pos += size + 1;
  37393. },
  37394. readHexNumber: function (num, size) {
  37395. var last;
  37396. var stack = this.tmpBuf, sp = 0;
  37397. do {
  37398. var b = this.readByte();
  37399. if (b < 0) {
  37400. error('unexpected EOF in bcmap');
  37401. }
  37402. last = !(b & 0x80);
  37403. stack[sp++] = b & 0x7F;
  37404. } while (!last);
  37405. var i = size, buffer = 0, bufferSize = 0;
  37406. while (i >= 0) {
  37407. while (bufferSize < 8 && stack.length > 0) {
  37408. buffer = stack[--sp] << bufferSize | buffer;
  37409. bufferSize += 7;
  37410. }
  37411. num[i] = buffer & 255;
  37412. i--;
  37413. buffer >>= 8;
  37414. bufferSize -= 8;
  37415. }
  37416. },
  37417. readHexSigned: function (num, size) {
  37418. this.readHexNumber(num, size);
  37419. var sign = num[size] & 1 ? 255 : 0;
  37420. var c = 0;
  37421. for (var i = 0; i <= size; i++) {
  37422. c = (c & 1) << 8 | num[i];
  37423. num[i] = c >> 1 ^ sign;
  37424. }
  37425. },
  37426. readString: function () {
  37427. var len = this.readNumber();
  37428. var s = '';
  37429. for (var i = 0; i < len; i++) {
  37430. s += String.fromCharCode(this.readNumber());
  37431. }
  37432. return s;
  37433. }
  37434. };
  37435. function processBinaryCMap(data, cMap, extend) {
  37436. return new Promise(function (resolve, reject) {
  37437. var stream = new BinaryCMapStream(data);
  37438. var header = stream.readByte();
  37439. cMap.vertical = !!(header & 1);
  37440. var useCMap = null;
  37441. var start = new Uint8Array(MAX_NUM_SIZE);
  37442. var end = new Uint8Array(MAX_NUM_SIZE);
  37443. var char = new Uint8Array(MAX_NUM_SIZE);
  37444. var charCode = new Uint8Array(MAX_NUM_SIZE);
  37445. var tmp = new Uint8Array(MAX_NUM_SIZE);
  37446. var code;
  37447. var b;
  37448. while ((b = stream.readByte()) >= 0) {
  37449. var type = b >> 5;
  37450. if (type === 7) {
  37451. switch (b & 0x1F) {
  37452. case 0:
  37453. stream.readString();
  37454. break;
  37455. case 1:
  37456. useCMap = stream.readString();
  37457. break;
  37458. }
  37459. continue;
  37460. }
  37461. var sequence = !!(b & 0x10);
  37462. var dataSize = b & 15;
  37463. assert(dataSize + 1 <= MAX_NUM_SIZE);
  37464. var ucs2DataSize = 1;
  37465. var subitemsCount = stream.readNumber();
  37466. var i;
  37467. switch (type) {
  37468. case 0:
  37469. stream.readHex(start, dataSize);
  37470. stream.readHexNumber(end, dataSize);
  37471. addHex(end, start, dataSize);
  37472. cMap.addCodespaceRange(dataSize + 1, hexToInt(start, dataSize), hexToInt(end, dataSize));
  37473. for (i = 1; i < subitemsCount; i++) {
  37474. incHex(end, dataSize);
  37475. stream.readHexNumber(start, dataSize);
  37476. addHex(start, end, dataSize);
  37477. stream.readHexNumber(end, dataSize);
  37478. addHex(end, start, dataSize);
  37479. cMap.addCodespaceRange(dataSize + 1, hexToInt(start, dataSize), hexToInt(end, dataSize));
  37480. }
  37481. break;
  37482. case 1:
  37483. stream.readHex(start, dataSize);
  37484. stream.readHexNumber(end, dataSize);
  37485. addHex(end, start, dataSize);
  37486. code = stream.readNumber();
  37487. for (i = 1; i < subitemsCount; i++) {
  37488. incHex(end, dataSize);
  37489. stream.readHexNumber(start, dataSize);
  37490. addHex(start, end, dataSize);
  37491. stream.readHexNumber(end, dataSize);
  37492. addHex(end, start, dataSize);
  37493. code = stream.readNumber();
  37494. }
  37495. break;
  37496. case 2:
  37497. stream.readHex(char, dataSize);
  37498. code = stream.readNumber();
  37499. cMap.mapOne(hexToInt(char, dataSize), code);
  37500. for (i = 1; i < subitemsCount; i++) {
  37501. incHex(char, dataSize);
  37502. if (!sequence) {
  37503. stream.readHexNumber(tmp, dataSize);
  37504. addHex(char, tmp, dataSize);
  37505. }
  37506. code = stream.readSigned() + (code + 1);
  37507. cMap.mapOne(hexToInt(char, dataSize), code);
  37508. }
  37509. break;
  37510. case 3:
  37511. stream.readHex(start, dataSize);
  37512. stream.readHexNumber(end, dataSize);
  37513. addHex(end, start, dataSize);
  37514. code = stream.readNumber();
  37515. cMap.mapCidRange(hexToInt(start, dataSize), hexToInt(end, dataSize), code);
  37516. for (i = 1; i < subitemsCount; i++) {
  37517. incHex(end, dataSize);
  37518. if (!sequence) {
  37519. stream.readHexNumber(start, dataSize);
  37520. addHex(start, end, dataSize);
  37521. } else {
  37522. start.set(end);
  37523. }
  37524. stream.readHexNumber(end, dataSize);
  37525. addHex(end, start, dataSize);
  37526. code = stream.readNumber();
  37527. cMap.mapCidRange(hexToInt(start, dataSize), hexToInt(end, dataSize), code);
  37528. }
  37529. break;
  37530. case 4:
  37531. stream.readHex(char, ucs2DataSize);
  37532. stream.readHex(charCode, dataSize);
  37533. cMap.mapOne(hexToInt(char, ucs2DataSize), hexToStr(charCode, dataSize));
  37534. for (i = 1; i < subitemsCount; i++) {
  37535. incHex(char, ucs2DataSize);
  37536. if (!sequence) {
  37537. stream.readHexNumber(tmp, ucs2DataSize);
  37538. addHex(char, tmp, ucs2DataSize);
  37539. }
  37540. incHex(charCode, dataSize);
  37541. stream.readHexSigned(tmp, dataSize);
  37542. addHex(charCode, tmp, dataSize);
  37543. cMap.mapOne(hexToInt(char, ucs2DataSize), hexToStr(charCode, dataSize));
  37544. }
  37545. break;
  37546. case 5:
  37547. stream.readHex(start, ucs2DataSize);
  37548. stream.readHexNumber(end, ucs2DataSize);
  37549. addHex(end, start, ucs2DataSize);
  37550. stream.readHex(charCode, dataSize);
  37551. cMap.mapBfRange(hexToInt(start, ucs2DataSize), hexToInt(end, ucs2DataSize), hexToStr(charCode, dataSize));
  37552. for (i = 1; i < subitemsCount; i++) {
  37553. incHex(end, ucs2DataSize);
  37554. if (!sequence) {
  37555. stream.readHexNumber(start, ucs2DataSize);
  37556. addHex(start, end, ucs2DataSize);
  37557. } else {
  37558. start.set(end);
  37559. }
  37560. stream.readHexNumber(end, ucs2DataSize);
  37561. addHex(end, start, ucs2DataSize);
  37562. stream.readHex(charCode, dataSize);
  37563. cMap.mapBfRange(hexToInt(start, ucs2DataSize), hexToInt(end, ucs2DataSize), hexToStr(charCode, dataSize));
  37564. }
  37565. break;
  37566. default:
  37567. reject(new Error('processBinaryCMap: Unknown type: ' + type));
  37568. return;
  37569. }
  37570. }
  37571. if (useCMap) {
  37572. resolve(extend(useCMap));
  37573. return;
  37574. }
  37575. resolve(cMap);
  37576. });
  37577. }
  37578. function BinaryCMapReader() {
  37579. }
  37580. BinaryCMapReader.prototype = { process: processBinaryCMap };
  37581. return BinaryCMapReader;
  37582. }();
  37583. var CMapFactory = function CMapFactoryClosure() {
  37584. function strToInt(str) {
  37585. var a = 0;
  37586. for (var i = 0; i < str.length; i++) {
  37587. a = a << 8 | str.charCodeAt(i);
  37588. }
  37589. return a >>> 0;
  37590. }
  37591. function expectString(obj) {
  37592. if (!isString(obj)) {
  37593. error('Malformed CMap: expected string.');
  37594. }
  37595. }
  37596. function expectInt(obj) {
  37597. if (!isInt(obj)) {
  37598. error('Malformed CMap: expected int.');
  37599. }
  37600. }
  37601. function parseBfChar(cMap, lexer) {
  37602. while (true) {
  37603. var obj = lexer.getObj();
  37604. if (isEOF(obj)) {
  37605. break;
  37606. }
  37607. if (isCmd(obj, 'endbfchar')) {
  37608. return;
  37609. }
  37610. expectString(obj);
  37611. var src = strToInt(obj);
  37612. obj = lexer.getObj();
  37613. expectString(obj);
  37614. var dst = obj;
  37615. cMap.mapOne(src, dst);
  37616. }
  37617. }
  37618. function parseBfRange(cMap, lexer) {
  37619. while (true) {
  37620. var obj = lexer.getObj();
  37621. if (isEOF(obj)) {
  37622. break;
  37623. }
  37624. if (isCmd(obj, 'endbfrange')) {
  37625. return;
  37626. }
  37627. expectString(obj);
  37628. var low = strToInt(obj);
  37629. obj = lexer.getObj();
  37630. expectString(obj);
  37631. var high = strToInt(obj);
  37632. obj = lexer.getObj();
  37633. if (isInt(obj) || isString(obj)) {
  37634. var dstLow = isInt(obj) ? String.fromCharCode(obj) : obj;
  37635. cMap.mapBfRange(low, high, dstLow);
  37636. } else if (isCmd(obj, '[')) {
  37637. obj = lexer.getObj();
  37638. var array = [];
  37639. while (!isCmd(obj, ']') && !isEOF(obj)) {
  37640. array.push(obj);
  37641. obj = lexer.getObj();
  37642. }
  37643. cMap.mapBfRangeToArray(low, high, array);
  37644. } else {
  37645. break;
  37646. }
  37647. }
  37648. error('Invalid bf range.');
  37649. }
  37650. function parseCidChar(cMap, lexer) {
  37651. while (true) {
  37652. var obj = lexer.getObj();
  37653. if (isEOF(obj)) {
  37654. break;
  37655. }
  37656. if (isCmd(obj, 'endcidchar')) {
  37657. return;
  37658. }
  37659. expectString(obj);
  37660. var src = strToInt(obj);
  37661. obj = lexer.getObj();
  37662. expectInt(obj);
  37663. var dst = obj;
  37664. cMap.mapOne(src, dst);
  37665. }
  37666. }
  37667. function parseCidRange(cMap, lexer) {
  37668. while (true) {
  37669. var obj = lexer.getObj();
  37670. if (isEOF(obj)) {
  37671. break;
  37672. }
  37673. if (isCmd(obj, 'endcidrange')) {
  37674. return;
  37675. }
  37676. expectString(obj);
  37677. var low = strToInt(obj);
  37678. obj = lexer.getObj();
  37679. expectString(obj);
  37680. var high = strToInt(obj);
  37681. obj = lexer.getObj();
  37682. expectInt(obj);
  37683. var dstLow = obj;
  37684. cMap.mapCidRange(low, high, dstLow);
  37685. }
  37686. }
  37687. function parseCodespaceRange(cMap, lexer) {
  37688. while (true) {
  37689. var obj = lexer.getObj();
  37690. if (isEOF(obj)) {
  37691. break;
  37692. }
  37693. if (isCmd(obj, 'endcodespacerange')) {
  37694. return;
  37695. }
  37696. if (!isString(obj)) {
  37697. break;
  37698. }
  37699. var low = strToInt(obj);
  37700. obj = lexer.getObj();
  37701. if (!isString(obj)) {
  37702. break;
  37703. }
  37704. var high = strToInt(obj);
  37705. cMap.addCodespaceRange(obj.length, low, high);
  37706. }
  37707. error('Invalid codespace range.');
  37708. }
  37709. function parseWMode(cMap, lexer) {
  37710. var obj = lexer.getObj();
  37711. if (isInt(obj)) {
  37712. cMap.vertical = !!obj;
  37713. }
  37714. }
  37715. function parseCMapName(cMap, lexer) {
  37716. var obj = lexer.getObj();
  37717. if (isName(obj) && isString(obj.name)) {
  37718. cMap.name = obj.name;
  37719. }
  37720. }
  37721. function parseCMap(cMap, lexer, fetchBuiltInCMap, useCMap) {
  37722. var previous;
  37723. var embededUseCMap;
  37724. objLoop:
  37725. while (true) {
  37726. try {
  37727. var obj = lexer.getObj();
  37728. if (isEOF(obj)) {
  37729. break;
  37730. } else if (isName(obj)) {
  37731. if (obj.name === 'WMode') {
  37732. parseWMode(cMap, lexer);
  37733. } else if (obj.name === 'CMapName') {
  37734. parseCMapName(cMap, lexer);
  37735. }
  37736. previous = obj;
  37737. } else if (isCmd(obj)) {
  37738. switch (obj.cmd) {
  37739. case 'endcmap':
  37740. break objLoop;
  37741. case 'usecmap':
  37742. if (isName(previous)) {
  37743. embededUseCMap = previous.name;
  37744. }
  37745. break;
  37746. case 'begincodespacerange':
  37747. parseCodespaceRange(cMap, lexer);
  37748. break;
  37749. case 'beginbfchar':
  37750. parseBfChar(cMap, lexer);
  37751. break;
  37752. case 'begincidchar':
  37753. parseCidChar(cMap, lexer);
  37754. break;
  37755. case 'beginbfrange':
  37756. parseBfRange(cMap, lexer);
  37757. break;
  37758. case 'begincidrange':
  37759. parseCidRange(cMap, lexer);
  37760. break;
  37761. }
  37762. }
  37763. } catch (ex) {
  37764. if (ex instanceof MissingDataException) {
  37765. throw ex;
  37766. }
  37767. warn('Invalid cMap data: ' + ex);
  37768. continue;
  37769. }
  37770. }
  37771. if (!useCMap && embededUseCMap) {
  37772. useCMap = embededUseCMap;
  37773. }
  37774. if (useCMap) {
  37775. return extendCMap(cMap, fetchBuiltInCMap, useCMap);
  37776. }
  37777. return Promise.resolve(cMap);
  37778. }
  37779. function extendCMap(cMap, fetchBuiltInCMap, useCMap) {
  37780. return createBuiltInCMap(useCMap, fetchBuiltInCMap).then(function (newCMap) {
  37781. cMap.useCMap = newCMap;
  37782. if (cMap.numCodespaceRanges === 0) {
  37783. var useCodespaceRanges = cMap.useCMap.codespaceRanges;
  37784. for (var i = 0; i < useCodespaceRanges.length; i++) {
  37785. cMap.codespaceRanges[i] = useCodespaceRanges[i].slice();
  37786. }
  37787. cMap.numCodespaceRanges = cMap.useCMap.numCodespaceRanges;
  37788. }
  37789. cMap.useCMap.forEach(function (key, value) {
  37790. if (!cMap.contains(key)) {
  37791. cMap.mapOne(key, cMap.useCMap.lookup(key));
  37792. }
  37793. });
  37794. return cMap;
  37795. });
  37796. }
  37797. function createBuiltInCMap(name, fetchBuiltInCMap) {
  37798. if (name === 'Identity-H') {
  37799. return Promise.resolve(new IdentityCMap(false, 2));
  37800. } else if (name === 'Identity-V') {
  37801. return Promise.resolve(new IdentityCMap(true, 2));
  37802. }
  37803. if (BUILT_IN_CMAPS.indexOf(name) === -1) {
  37804. return Promise.reject(new Error('Unknown cMap name: ' + name));
  37805. }
  37806. assert(fetchBuiltInCMap, 'Built-in CMap parameters are not provided.');
  37807. return fetchBuiltInCMap(name).then(function (data) {
  37808. var cMapData = data.cMapData, compressionType = data.compressionType;
  37809. var cMap = new CMap(true);
  37810. if (compressionType === CMapCompressionType.BINARY) {
  37811. return new BinaryCMapReader().process(cMapData, cMap, function (useCMap) {
  37812. return extendCMap(cMap, fetchBuiltInCMap, useCMap);
  37813. });
  37814. }
  37815. assert(compressionType === CMapCompressionType.NONE, 'TODO: Only BINARY/NONE CMap compression is currently supported.');
  37816. var lexer = new Lexer(new Stream(cMapData));
  37817. return parseCMap(cMap, lexer, fetchBuiltInCMap, null);
  37818. });
  37819. }
  37820. return {
  37821. create: function (params) {
  37822. var encoding = params.encoding;
  37823. var fetchBuiltInCMap = params.fetchBuiltInCMap;
  37824. var useCMap = params.useCMap;
  37825. if (isName(encoding)) {
  37826. return createBuiltInCMap(encoding.name, fetchBuiltInCMap);
  37827. } else if (isStream(encoding)) {
  37828. var cMap = new CMap();
  37829. var lexer = new Lexer(encoding);
  37830. return parseCMap(cMap, lexer, fetchBuiltInCMap, useCMap).then(function (parsedCMap) {
  37831. if (parsedCMap.isIdentityCMap) {
  37832. return createBuiltInCMap(parsedCMap.name, fetchBuiltInCMap);
  37833. }
  37834. return parsedCMap;
  37835. });
  37836. }
  37837. return Promise.reject(new Error('Encoding required.'));
  37838. }
  37839. };
  37840. }();
  37841. exports.CMap = CMap;
  37842. exports.CMapFactory = CMapFactory;
  37843. exports.IdentityCMap = IdentityCMap;
  37844. /***/ }),
  37845. /* 24 */
  37846. /***/ (function(module, exports, __w_pdfjs_require__) {
  37847. "use strict";
  37848. var sharedUtil = __w_pdfjs_require__(0);
  37849. var corePrimitives = __w_pdfjs_require__(1);
  37850. var coreStream = __w_pdfjs_require__(2);
  37851. var coreObj = __w_pdfjs_require__(16);
  37852. var coreParser = __w_pdfjs_require__(5);
  37853. var coreCrypto = __w_pdfjs_require__(13);
  37854. var coreEvaluator = __w_pdfjs_require__(14);
  37855. var coreAnnotation = __w_pdfjs_require__(20);
  37856. var OPS = sharedUtil.OPS;
  37857. var MissingDataException = sharedUtil.MissingDataException;
  37858. var Util = sharedUtil.Util;
  37859. var assert = sharedUtil.assert;
  37860. var error = sharedUtil.error;
  37861. var info = sharedUtil.info;
  37862. var isArray = sharedUtil.isArray;
  37863. var isArrayBuffer = sharedUtil.isArrayBuffer;
  37864. var isNum = sharedUtil.isNum;
  37865. var isString = sharedUtil.isString;
  37866. var shadow = sharedUtil.shadow;
  37867. var stringToBytes = sharedUtil.stringToBytes;
  37868. var stringToPDFString = sharedUtil.stringToPDFString;
  37869. var warn = sharedUtil.warn;
  37870. var isSpace = sharedUtil.isSpace;
  37871. var Dict = corePrimitives.Dict;
  37872. var isDict = corePrimitives.isDict;
  37873. var isName = corePrimitives.isName;
  37874. var isStream = corePrimitives.isStream;
  37875. var NullStream = coreStream.NullStream;
  37876. var Stream = coreStream.Stream;
  37877. var StreamsSequenceStream = coreStream.StreamsSequenceStream;
  37878. var Catalog = coreObj.Catalog;
  37879. var ObjectLoader = coreObj.ObjectLoader;
  37880. var XRef = coreObj.XRef;
  37881. var Linearization = coreParser.Linearization;
  37882. var calculateMD5 = coreCrypto.calculateMD5;
  37883. var OperatorList = coreEvaluator.OperatorList;
  37884. var PartialEvaluator = coreEvaluator.PartialEvaluator;
  37885. var AnnotationFactory = coreAnnotation.AnnotationFactory;
  37886. var Page = function PageClosure() {
  37887. var DEFAULT_USER_UNIT = 1.0;
  37888. var LETTER_SIZE_MEDIABOX = [
  37889. 0,
  37890. 0,
  37891. 612,
  37892. 792
  37893. ];
  37894. function isAnnotationRenderable(annotation, intent) {
  37895. return intent === 'display' && annotation.viewable || intent === 'print' && annotation.printable;
  37896. }
  37897. function Page(pdfManager, xref, pageIndex, pageDict, ref, fontCache, builtInCMapCache) {
  37898. this.pdfManager = pdfManager;
  37899. this.pageIndex = pageIndex;
  37900. this.pageDict = pageDict;
  37901. this.xref = xref;
  37902. this.ref = ref;
  37903. this.fontCache = fontCache;
  37904. this.builtInCMapCache = builtInCMapCache;
  37905. this.evaluatorOptions = pdfManager.evaluatorOptions;
  37906. this.resourcesPromise = null;
  37907. var uniquePrefix = 'p' + this.pageIndex + '_';
  37908. var idCounters = { obj: 0 };
  37909. this.idFactory = {
  37910. createObjId: function () {
  37911. return uniquePrefix + ++idCounters.obj;
  37912. }
  37913. };
  37914. }
  37915. Page.prototype = {
  37916. getPageProp: function Page_getPageProp(key) {
  37917. return this.pageDict.get(key);
  37918. },
  37919. getInheritedPageProp: function Page_getInheritedPageProp(key, getArray) {
  37920. var dict = this.pageDict, valueArray = null, loopCount = 0;
  37921. var MAX_LOOP_COUNT = 100;
  37922. getArray = getArray || false;
  37923. while (dict) {
  37924. var value = getArray ? dict.getArray(key) : dict.get(key);
  37925. if (value !== undefined) {
  37926. if (!valueArray) {
  37927. valueArray = [];
  37928. }
  37929. valueArray.push(value);
  37930. }
  37931. if (++loopCount > MAX_LOOP_COUNT) {
  37932. warn('getInheritedPageProp: maximum loop count exceeded for ' + key);
  37933. return valueArray ? valueArray[0] : undefined;
  37934. }
  37935. dict = dict.get('Parent');
  37936. }
  37937. if (!valueArray) {
  37938. return undefined;
  37939. }
  37940. if (valueArray.length === 1 || !isDict(valueArray[0])) {
  37941. return valueArray[0];
  37942. }
  37943. return Dict.merge(this.xref, valueArray);
  37944. },
  37945. get content() {
  37946. return this.getPageProp('Contents');
  37947. },
  37948. get resources() {
  37949. return shadow(this, 'resources', this.getInheritedPageProp('Resources') || Dict.empty);
  37950. },
  37951. get mediaBox() {
  37952. var mediaBox = this.getInheritedPageProp('MediaBox', true);
  37953. if (!isArray(mediaBox) || mediaBox.length !== 4) {
  37954. return shadow(this, 'mediaBox', LETTER_SIZE_MEDIABOX);
  37955. }
  37956. return shadow(this, 'mediaBox', mediaBox);
  37957. },
  37958. get cropBox() {
  37959. var cropBox = this.getInheritedPageProp('CropBox', true);
  37960. if (!isArray(cropBox) || cropBox.length !== 4) {
  37961. return shadow(this, 'cropBox', this.mediaBox);
  37962. }
  37963. return shadow(this, 'cropBox', cropBox);
  37964. },
  37965. get userUnit() {
  37966. var obj = this.getPageProp('UserUnit');
  37967. if (!isNum(obj) || obj <= 0) {
  37968. obj = DEFAULT_USER_UNIT;
  37969. }
  37970. return shadow(this, 'userUnit', obj);
  37971. },
  37972. get view() {
  37973. var mediaBox = this.mediaBox, cropBox = this.cropBox;
  37974. if (mediaBox === cropBox) {
  37975. return shadow(this, 'view', mediaBox);
  37976. }
  37977. var intersection = Util.intersect(cropBox, mediaBox);
  37978. return shadow(this, 'view', intersection || mediaBox);
  37979. },
  37980. get rotate() {
  37981. var rotate = this.getInheritedPageProp('Rotate') || 0;
  37982. if (rotate % 90 !== 0) {
  37983. rotate = 0;
  37984. } else if (rotate >= 360) {
  37985. rotate = rotate % 360;
  37986. } else if (rotate < 0) {
  37987. rotate = (rotate % 360 + 360) % 360;
  37988. }
  37989. return shadow(this, 'rotate', rotate);
  37990. },
  37991. getContentStream: function Page_getContentStream() {
  37992. var content = this.content;
  37993. var stream;
  37994. if (isArray(content)) {
  37995. var xref = this.xref;
  37996. var i, n = content.length;
  37997. var streams = [];
  37998. for (i = 0; i < n; ++i) {
  37999. streams.push(xref.fetchIfRef(content[i]));
  38000. }
  38001. stream = new StreamsSequenceStream(streams);
  38002. } else if (isStream(content)) {
  38003. stream = content;
  38004. } else {
  38005. stream = new NullStream();
  38006. }
  38007. return stream;
  38008. },
  38009. loadResources: function Page_loadResources(keys) {
  38010. if (!this.resourcesPromise) {
  38011. this.resourcesPromise = this.pdfManager.ensure(this, 'resources');
  38012. }
  38013. return this.resourcesPromise.then(function resourceSuccess() {
  38014. var objectLoader = new ObjectLoader(this.resources.map, keys, this.xref);
  38015. return objectLoader.load();
  38016. }.bind(this));
  38017. },
  38018. getOperatorList: function Page_getOperatorList(handler, task, intent, renderInteractiveForms) {
  38019. var self = this;
  38020. var pdfManager = this.pdfManager;
  38021. var contentStreamPromise = pdfManager.ensure(this, 'getContentStream', []);
  38022. var resourcesPromise = this.loadResources([
  38023. 'ExtGState',
  38024. 'ColorSpace',
  38025. 'Pattern',
  38026. 'Shading',
  38027. 'XObject',
  38028. 'Font'
  38029. ]);
  38030. var partialEvaluator = new PartialEvaluator(pdfManager, this.xref, handler, this.pageIndex, this.idFactory, this.fontCache, this.builtInCMapCache, this.evaluatorOptions);
  38031. var dataPromises = Promise.all([
  38032. contentStreamPromise,
  38033. resourcesPromise
  38034. ]);
  38035. var pageListPromise = dataPromises.then(function (data) {
  38036. var contentStream = data[0];
  38037. var opList = new OperatorList(intent, handler, self.pageIndex);
  38038. handler.send('StartRenderPage', {
  38039. transparency: partialEvaluator.hasBlendModes(self.resources),
  38040. pageIndex: self.pageIndex,
  38041. intent: intent
  38042. });
  38043. return partialEvaluator.getOperatorList(contentStream, task, self.resources, opList).then(function () {
  38044. return opList;
  38045. });
  38046. });
  38047. var annotationsPromise = pdfManager.ensure(this, 'annotations');
  38048. return Promise.all([
  38049. pageListPromise,
  38050. annotationsPromise
  38051. ]).then(function (datas) {
  38052. var pageOpList = datas[0];
  38053. var annotations = datas[1];
  38054. if (annotations.length === 0) {
  38055. pageOpList.flush(true);
  38056. return pageOpList;
  38057. }
  38058. var i, ii, opListPromises = [];
  38059. for (i = 0, ii = annotations.length; i < ii; i++) {
  38060. if (isAnnotationRenderable(annotations[i], intent)) {
  38061. opListPromises.push(annotations[i].getOperatorList(partialEvaluator, task, renderInteractiveForms));
  38062. }
  38063. }
  38064. return Promise.all(opListPromises).then(function (opLists) {
  38065. pageOpList.addOp(OPS.beginAnnotations, []);
  38066. for (i = 0, ii = opLists.length; i < ii; i++) {
  38067. pageOpList.addOpList(opLists[i]);
  38068. }
  38069. pageOpList.addOp(OPS.endAnnotations, []);
  38070. pageOpList.flush(true);
  38071. return pageOpList;
  38072. });
  38073. });
  38074. },
  38075. extractTextContent: function Page_extractTextContent(task, normalizeWhitespace, combineTextItems) {
  38076. var handler = {
  38077. on: function nullHandlerOn() {
  38078. },
  38079. send: function nullHandlerSend() {
  38080. }
  38081. };
  38082. var self = this;
  38083. var pdfManager = this.pdfManager;
  38084. var contentStreamPromise = pdfManager.ensure(this, 'getContentStream', []);
  38085. var resourcesPromise = this.loadResources([
  38086. 'ExtGState',
  38087. 'XObject',
  38088. 'Font'
  38089. ]);
  38090. var dataPromises = Promise.all([
  38091. contentStreamPromise,
  38092. resourcesPromise
  38093. ]);
  38094. return dataPromises.then(function (data) {
  38095. var contentStream = data[0];
  38096. var partialEvaluator = new PartialEvaluator(pdfManager, self.xref, handler, self.pageIndex, self.idFactory, self.fontCache, self.builtInCMapCache, self.evaluatorOptions);
  38097. return partialEvaluator.getTextContent(contentStream, task, self.resources, null, normalizeWhitespace, combineTextItems);
  38098. });
  38099. },
  38100. getAnnotationsData: function Page_getAnnotationsData(intent) {
  38101. var annotations = this.annotations;
  38102. var annotationsData = [];
  38103. for (var i = 0, n = annotations.length; i < n; ++i) {
  38104. if (!intent || isAnnotationRenderable(annotations[i], intent)) {
  38105. annotationsData.push(annotations[i].data);
  38106. }
  38107. }
  38108. return annotationsData;
  38109. },
  38110. get annotations() {
  38111. var annotations = [];
  38112. var annotationRefs = this.getInheritedPageProp('Annots') || [];
  38113. var annotationFactory = new AnnotationFactory();
  38114. for (var i = 0, n = annotationRefs.length; i < n; ++i) {
  38115. var annotationRef = annotationRefs[i];
  38116. var annotation = annotationFactory.create(this.xref, annotationRef, this.pdfManager, this.idFactory);
  38117. if (annotation) {
  38118. annotations.push(annotation);
  38119. }
  38120. }
  38121. return shadow(this, 'annotations', annotations);
  38122. }
  38123. };
  38124. return Page;
  38125. }();
  38126. var PDFDocument = function PDFDocumentClosure() {
  38127. var FINGERPRINT_FIRST_BYTES = 1024;
  38128. var EMPTY_FINGERPRINT = '\x00\x00\x00\x00\x00\x00\x00' + '\x00\x00\x00\x00\x00\x00\x00\x00\x00';
  38129. function PDFDocument(pdfManager, arg) {
  38130. var stream;
  38131. if (isStream(arg)) {
  38132. stream = arg;
  38133. } else if (isArrayBuffer(arg)) {
  38134. stream = new Stream(arg);
  38135. } else {
  38136. error('PDFDocument: Unknown argument type');
  38137. }
  38138. assert(stream.length > 0, 'stream must have data');
  38139. this.pdfManager = pdfManager;
  38140. this.stream = stream;
  38141. this.xref = new XRef(stream, pdfManager);
  38142. }
  38143. function find(stream, needle, limit, backwards) {
  38144. var pos = stream.pos;
  38145. var end = stream.end;
  38146. var strBuf = [];
  38147. if (pos + limit > end) {
  38148. limit = end - pos;
  38149. }
  38150. for (var n = 0; n < limit; ++n) {
  38151. strBuf.push(String.fromCharCode(stream.getByte()));
  38152. }
  38153. var str = strBuf.join('');
  38154. stream.pos = pos;
  38155. var index = backwards ? str.lastIndexOf(needle) : str.indexOf(needle);
  38156. if (index === -1) {
  38157. return false;
  38158. }
  38159. stream.pos += index;
  38160. return true;
  38161. }
  38162. var DocumentInfoValidators = {
  38163. get entries() {
  38164. return shadow(this, 'entries', {
  38165. Title: isString,
  38166. Author: isString,
  38167. Subject: isString,
  38168. Keywords: isString,
  38169. Creator: isString,
  38170. Producer: isString,
  38171. CreationDate: isString,
  38172. ModDate: isString,
  38173. Trapped: isName
  38174. });
  38175. }
  38176. };
  38177. PDFDocument.prototype = {
  38178. parse: function PDFDocument_parse(recoveryMode) {
  38179. this.setup(recoveryMode);
  38180. var version = this.catalog.catDict.get('Version');
  38181. if (isName(version)) {
  38182. this.pdfFormatVersion = version.name;
  38183. }
  38184. try {
  38185. this.acroForm = this.catalog.catDict.get('AcroForm');
  38186. if (this.acroForm) {
  38187. this.xfa = this.acroForm.get('XFA');
  38188. var fields = this.acroForm.get('Fields');
  38189. if ((!fields || !isArray(fields) || fields.length === 0) && !this.xfa) {
  38190. this.acroForm = null;
  38191. }
  38192. }
  38193. } catch (ex) {
  38194. info('Something wrong with AcroForm entry');
  38195. this.acroForm = null;
  38196. }
  38197. },
  38198. get linearization() {
  38199. var linearization = null;
  38200. if (this.stream.length) {
  38201. try {
  38202. linearization = Linearization.create(this.stream);
  38203. } catch (err) {
  38204. if (err instanceof MissingDataException) {
  38205. throw err;
  38206. }
  38207. info(err);
  38208. }
  38209. }
  38210. return shadow(this, 'linearization', linearization);
  38211. },
  38212. get startXRef() {
  38213. var stream = this.stream;
  38214. var startXRef = 0;
  38215. var linearization = this.linearization;
  38216. if (linearization) {
  38217. stream.reset();
  38218. if (find(stream, 'endobj', 1024)) {
  38219. startXRef = stream.pos + 6;
  38220. }
  38221. } else {
  38222. var step = 1024;
  38223. var found = false, pos = stream.end;
  38224. while (!found && pos > 0) {
  38225. pos -= step - 'startxref'.length;
  38226. if (pos < 0) {
  38227. pos = 0;
  38228. }
  38229. stream.pos = pos;
  38230. found = find(stream, 'startxref', step, true);
  38231. }
  38232. if (found) {
  38233. stream.skip(9);
  38234. var ch;
  38235. do {
  38236. ch = stream.getByte();
  38237. } while (isSpace(ch));
  38238. var str = '';
  38239. while (ch >= 0x20 && ch <= 0x39) {
  38240. str += String.fromCharCode(ch);
  38241. ch = stream.getByte();
  38242. }
  38243. startXRef = parseInt(str, 10);
  38244. if (isNaN(startXRef)) {
  38245. startXRef = 0;
  38246. }
  38247. }
  38248. }
  38249. return shadow(this, 'startXRef', startXRef);
  38250. },
  38251. get mainXRefEntriesOffset() {
  38252. var mainXRefEntriesOffset = 0;
  38253. var linearization = this.linearization;
  38254. if (linearization) {
  38255. mainXRefEntriesOffset = linearization.mainXRefEntriesOffset;
  38256. }
  38257. return shadow(this, 'mainXRefEntriesOffset', mainXRefEntriesOffset);
  38258. },
  38259. checkHeader: function PDFDocument_checkHeader() {
  38260. var stream = this.stream;
  38261. stream.reset();
  38262. if (find(stream, '%PDF-', 1024)) {
  38263. stream.moveStart();
  38264. var MAX_VERSION_LENGTH = 12;
  38265. var version = '', ch;
  38266. while ((ch = stream.getByte()) > 0x20) {
  38267. if (version.length >= MAX_VERSION_LENGTH) {
  38268. break;
  38269. }
  38270. version += String.fromCharCode(ch);
  38271. }
  38272. if (!this.pdfFormatVersion) {
  38273. this.pdfFormatVersion = version.substring(5);
  38274. }
  38275. return;
  38276. }
  38277. },
  38278. parseStartXRef: function PDFDocument_parseStartXRef() {
  38279. var startXRef = this.startXRef;
  38280. this.xref.setStartXRef(startXRef);
  38281. },
  38282. setup: function PDFDocument_setup(recoveryMode) {
  38283. this.xref.parse(recoveryMode);
  38284. var self = this;
  38285. var pageFactory = {
  38286. createPage: function (pageIndex, dict, ref, fontCache, builtInCMapCache) {
  38287. return new Page(self.pdfManager, self.xref, pageIndex, dict, ref, fontCache, builtInCMapCache);
  38288. }
  38289. };
  38290. this.catalog = new Catalog(this.pdfManager, this.xref, pageFactory);
  38291. },
  38292. get numPages() {
  38293. var linearization = this.linearization;
  38294. var num = linearization ? linearization.numPages : this.catalog.numPages;
  38295. return shadow(this, 'numPages', num);
  38296. },
  38297. get documentInfo() {
  38298. var docInfo = {
  38299. PDFFormatVersion: this.pdfFormatVersion,
  38300. IsAcroFormPresent: !!this.acroForm,
  38301. IsXFAPresent: !!this.xfa
  38302. };
  38303. var infoDict;
  38304. try {
  38305. infoDict = this.xref.trailer.get('Info');
  38306. } catch (err) {
  38307. info('The document information dictionary is invalid.');
  38308. }
  38309. if (infoDict) {
  38310. var validEntries = DocumentInfoValidators.entries;
  38311. for (var key in validEntries) {
  38312. if (infoDict.has(key)) {
  38313. var value = infoDict.get(key);
  38314. if (validEntries[key](value)) {
  38315. docInfo[key] = typeof value !== 'string' ? value : stringToPDFString(value);
  38316. } else {
  38317. info('Bad value in document info for "' + key + '"');
  38318. }
  38319. }
  38320. }
  38321. }
  38322. return shadow(this, 'documentInfo', docInfo);
  38323. },
  38324. get fingerprint() {
  38325. var xref = this.xref, hash, fileID = '';
  38326. var idArray = xref.trailer.get('ID');
  38327. if (idArray && isArray(idArray) && idArray[0] && isString(idArray[0]) && idArray[0] !== EMPTY_FINGERPRINT) {
  38328. hash = stringToBytes(idArray[0]);
  38329. } else {
  38330. if (this.stream.ensureRange) {
  38331. this.stream.ensureRange(0, Math.min(FINGERPRINT_FIRST_BYTES, this.stream.end));
  38332. }
  38333. hash = calculateMD5(this.stream.bytes.subarray(0, FINGERPRINT_FIRST_BYTES), 0, FINGERPRINT_FIRST_BYTES);
  38334. }
  38335. for (var i = 0, n = hash.length; i < n; i++) {
  38336. var hex = hash[i].toString(16);
  38337. fileID += hex.length === 1 ? '0' + hex : hex;
  38338. }
  38339. return shadow(this, 'fingerprint', fileID);
  38340. },
  38341. getPage: function PDFDocument_getPage(pageIndex) {
  38342. return this.catalog.getPage(pageIndex);
  38343. },
  38344. cleanup: function PDFDocument_cleanup() {
  38345. return this.catalog.cleanup();
  38346. }
  38347. };
  38348. return PDFDocument;
  38349. }();
  38350. exports.Page = Page;
  38351. exports.PDFDocument = PDFDocument;
  38352. /***/ }),
  38353. /* 25 */
  38354. /***/ (function(module, exports, __w_pdfjs_require__) {
  38355. "use strict";
  38356. var sharedUtil = __w_pdfjs_require__(0);
  38357. var coreStream = __w_pdfjs_require__(2);
  38358. var coreGlyphList = __w_pdfjs_require__(7);
  38359. var coreEncodings = __w_pdfjs_require__(4);
  38360. var coreCFFParser = __w_pdfjs_require__(11);
  38361. var Util = sharedUtil.Util;
  38362. var bytesToString = sharedUtil.bytesToString;
  38363. var error = sharedUtil.error;
  38364. var Stream = coreStream.Stream;
  38365. var getGlyphsUnicode = coreGlyphList.getGlyphsUnicode;
  38366. var StandardEncoding = coreEncodings.StandardEncoding;
  38367. var CFFParser = coreCFFParser.CFFParser;
  38368. var FontRendererFactory = function FontRendererFactoryClosure() {
  38369. function getLong(data, offset) {
  38370. return data[offset] << 24 | data[offset + 1] << 16 | data[offset + 2] << 8 | data[offset + 3];
  38371. }
  38372. function getUshort(data, offset) {
  38373. return data[offset] << 8 | data[offset + 1];
  38374. }
  38375. function parseCmap(data, start, end) {
  38376. var offset = getUshort(data, start + 2) === 1 ? getLong(data, start + 8) : getLong(data, start + 16);
  38377. var format = getUshort(data, start + offset);
  38378. var ranges, p, i;
  38379. if (format === 4) {
  38380. getUshort(data, start + offset + 2);
  38381. var segCount = getUshort(data, start + offset + 6) >> 1;
  38382. p = start + offset + 14;
  38383. ranges = [];
  38384. for (i = 0; i < segCount; i++, p += 2) {
  38385. ranges[i] = { end: getUshort(data, p) };
  38386. }
  38387. p += 2;
  38388. for (i = 0; i < segCount; i++, p += 2) {
  38389. ranges[i].start = getUshort(data, p);
  38390. }
  38391. for (i = 0; i < segCount; i++, p += 2) {
  38392. ranges[i].idDelta = getUshort(data, p);
  38393. }
  38394. for (i = 0; i < segCount; i++, p += 2) {
  38395. var idOffset = getUshort(data, p);
  38396. if (idOffset === 0) {
  38397. continue;
  38398. }
  38399. ranges[i].ids = [];
  38400. for (var j = 0, jj = ranges[i].end - ranges[i].start + 1; j < jj; j++) {
  38401. ranges[i].ids[j] = getUshort(data, p + idOffset);
  38402. idOffset += 2;
  38403. }
  38404. }
  38405. return ranges;
  38406. } else if (format === 12) {
  38407. getLong(data, start + offset + 4);
  38408. var groups = getLong(data, start + offset + 12);
  38409. p = start + offset + 16;
  38410. ranges = [];
  38411. for (i = 0; i < groups; i++) {
  38412. ranges.push({
  38413. start: getLong(data, p),
  38414. end: getLong(data, p + 4),
  38415. idDelta: getLong(data, p + 8) - getLong(data, p)
  38416. });
  38417. p += 12;
  38418. }
  38419. return ranges;
  38420. }
  38421. error('not supported cmap: ' + format);
  38422. }
  38423. function parseCff(data, start, end, seacAnalysisEnabled) {
  38424. var properties = {};
  38425. var parser = new CFFParser(new Stream(data, start, end - start), properties, seacAnalysisEnabled);
  38426. var cff = parser.parse();
  38427. return {
  38428. glyphs: cff.charStrings.objects,
  38429. subrs: cff.topDict.privateDict && cff.topDict.privateDict.subrsIndex && cff.topDict.privateDict.subrsIndex.objects,
  38430. gsubrs: cff.globalSubrIndex && cff.globalSubrIndex.objects
  38431. };
  38432. }
  38433. function parseGlyfTable(glyf, loca, isGlyphLocationsLong) {
  38434. var itemSize, itemDecode;
  38435. if (isGlyphLocationsLong) {
  38436. itemSize = 4;
  38437. itemDecode = function fontItemDecodeLong(data, offset) {
  38438. return data[offset] << 24 | data[offset + 1] << 16 | data[offset + 2] << 8 | data[offset + 3];
  38439. };
  38440. } else {
  38441. itemSize = 2;
  38442. itemDecode = function fontItemDecode(data, offset) {
  38443. return data[offset] << 9 | data[offset + 1] << 1;
  38444. };
  38445. }
  38446. var glyphs = [];
  38447. var startOffset = itemDecode(loca, 0);
  38448. for (var j = itemSize; j < loca.length; j += itemSize) {
  38449. var endOffset = itemDecode(loca, j);
  38450. glyphs.push(glyf.subarray(startOffset, endOffset));
  38451. startOffset = endOffset;
  38452. }
  38453. return glyphs;
  38454. }
  38455. function lookupCmap(ranges, unicode) {
  38456. var code = unicode.charCodeAt(0), gid = 0;
  38457. var l = 0, r = ranges.length - 1;
  38458. while (l < r) {
  38459. var c = l + r + 1 >> 1;
  38460. if (code < ranges[c].start) {
  38461. r = c - 1;
  38462. } else {
  38463. l = c;
  38464. }
  38465. }
  38466. if (ranges[l].start <= code && code <= ranges[l].end) {
  38467. gid = ranges[l].idDelta + (ranges[l].ids ? ranges[l].ids[code - ranges[l].start] : code) & 0xFFFF;
  38468. }
  38469. return {
  38470. charCode: code,
  38471. glyphId: gid
  38472. };
  38473. }
  38474. function compileGlyf(code, cmds, font) {
  38475. function moveTo(x, y) {
  38476. cmds.push({
  38477. cmd: 'moveTo',
  38478. args: [
  38479. x,
  38480. y
  38481. ]
  38482. });
  38483. }
  38484. function lineTo(x, y) {
  38485. cmds.push({
  38486. cmd: 'lineTo',
  38487. args: [
  38488. x,
  38489. y
  38490. ]
  38491. });
  38492. }
  38493. function quadraticCurveTo(xa, ya, x, y) {
  38494. cmds.push({
  38495. cmd: 'quadraticCurveTo',
  38496. args: [
  38497. xa,
  38498. ya,
  38499. x,
  38500. y
  38501. ]
  38502. });
  38503. }
  38504. var i = 0;
  38505. var numberOfContours = (code[i] << 24 | code[i + 1] << 16) >> 16;
  38506. var flags;
  38507. var x = 0, y = 0;
  38508. i += 10;
  38509. if (numberOfContours < 0) {
  38510. do {
  38511. flags = code[i] << 8 | code[i + 1];
  38512. var glyphIndex = code[i + 2] << 8 | code[i + 3];
  38513. i += 4;
  38514. var arg1, arg2;
  38515. if (flags & 0x01) {
  38516. arg1 = (code[i] << 24 | code[i + 1] << 16) >> 16;
  38517. arg2 = (code[i + 2] << 24 | code[i + 3] << 16) >> 16;
  38518. i += 4;
  38519. } else {
  38520. arg1 = code[i++];
  38521. arg2 = code[i++];
  38522. }
  38523. if (flags & 0x02) {
  38524. x = arg1;
  38525. y = arg2;
  38526. } else {
  38527. x = 0;
  38528. y = 0;
  38529. }
  38530. var scaleX = 1, scaleY = 1, scale01 = 0, scale10 = 0;
  38531. if (flags & 0x08) {
  38532. scaleX = scaleY = (code[i] << 24 | code[i + 1] << 16) / 1073741824;
  38533. i += 2;
  38534. } else if (flags & 0x40) {
  38535. scaleX = (code[i] << 24 | code[i + 1] << 16) / 1073741824;
  38536. scaleY = (code[i + 2] << 24 | code[i + 3] << 16) / 1073741824;
  38537. i += 4;
  38538. } else if (flags & 0x80) {
  38539. scaleX = (code[i] << 24 | code[i + 1] << 16) / 1073741824;
  38540. scale01 = (code[i + 2] << 24 | code[i + 3] << 16) / 1073741824;
  38541. scale10 = (code[i + 4] << 24 | code[i + 5] << 16) / 1073741824;
  38542. scaleY = (code[i + 6] << 24 | code[i + 7] << 16) / 1073741824;
  38543. i += 8;
  38544. }
  38545. var subglyph = font.glyphs[glyphIndex];
  38546. if (subglyph) {
  38547. cmds.push({ cmd: 'save' });
  38548. cmds.push({
  38549. cmd: 'transform',
  38550. args: [
  38551. scaleX,
  38552. scale01,
  38553. scale10,
  38554. scaleY,
  38555. x,
  38556. y
  38557. ]
  38558. });
  38559. compileGlyf(subglyph, cmds, font);
  38560. cmds.push({ cmd: 'restore' });
  38561. }
  38562. } while (flags & 0x20);
  38563. } else {
  38564. var endPtsOfContours = [];
  38565. var j, jj;
  38566. for (j = 0; j < numberOfContours; j++) {
  38567. endPtsOfContours.push(code[i] << 8 | code[i + 1]);
  38568. i += 2;
  38569. }
  38570. var instructionLength = code[i] << 8 | code[i + 1];
  38571. i += 2 + instructionLength;
  38572. var numberOfPoints = endPtsOfContours[endPtsOfContours.length - 1] + 1;
  38573. var points = [];
  38574. while (points.length < numberOfPoints) {
  38575. flags = code[i++];
  38576. var repeat = 1;
  38577. if (flags & 0x08) {
  38578. repeat += code[i++];
  38579. }
  38580. while (repeat-- > 0) {
  38581. points.push({ flags: flags });
  38582. }
  38583. }
  38584. for (j = 0; j < numberOfPoints; j++) {
  38585. switch (points[j].flags & 0x12) {
  38586. case 0x00:
  38587. x += (code[i] << 24 | code[i + 1] << 16) >> 16;
  38588. i += 2;
  38589. break;
  38590. case 0x02:
  38591. x -= code[i++];
  38592. break;
  38593. case 0x12:
  38594. x += code[i++];
  38595. break;
  38596. }
  38597. points[j].x = x;
  38598. }
  38599. for (j = 0; j < numberOfPoints; j++) {
  38600. switch (points[j].flags & 0x24) {
  38601. case 0x00:
  38602. y += (code[i] << 24 | code[i + 1] << 16) >> 16;
  38603. i += 2;
  38604. break;
  38605. case 0x04:
  38606. y -= code[i++];
  38607. break;
  38608. case 0x24:
  38609. y += code[i++];
  38610. break;
  38611. }
  38612. points[j].y = y;
  38613. }
  38614. var startPoint = 0;
  38615. for (i = 0; i < numberOfContours; i++) {
  38616. var endPoint = endPtsOfContours[i];
  38617. var contour = points.slice(startPoint, endPoint + 1);
  38618. if (contour[0].flags & 1) {
  38619. contour.push(contour[0]);
  38620. } else if (contour[contour.length - 1].flags & 1) {
  38621. contour.unshift(contour[contour.length - 1]);
  38622. } else {
  38623. var p = {
  38624. flags: 1,
  38625. x: (contour[0].x + contour[contour.length - 1].x) / 2,
  38626. y: (contour[0].y + contour[contour.length - 1].y) / 2
  38627. };
  38628. contour.unshift(p);
  38629. contour.push(p);
  38630. }
  38631. moveTo(contour[0].x, contour[0].y);
  38632. for (j = 1, jj = contour.length; j < jj; j++) {
  38633. if (contour[j].flags & 1) {
  38634. lineTo(contour[j].x, contour[j].y);
  38635. } else if (contour[j + 1].flags & 1) {
  38636. quadraticCurveTo(contour[j].x, contour[j].y, contour[j + 1].x, contour[j + 1].y);
  38637. j++;
  38638. } else {
  38639. quadraticCurveTo(contour[j].x, contour[j].y, (contour[j].x + contour[j + 1].x) / 2, (contour[j].y + contour[j + 1].y) / 2);
  38640. }
  38641. }
  38642. startPoint = endPoint + 1;
  38643. }
  38644. }
  38645. }
  38646. function compileCharString(code, cmds, font) {
  38647. var stack = [];
  38648. var x = 0, y = 0;
  38649. var stems = 0;
  38650. function moveTo(x, y) {
  38651. cmds.push({
  38652. cmd: 'moveTo',
  38653. args: [
  38654. x,
  38655. y
  38656. ]
  38657. });
  38658. }
  38659. function lineTo(x, y) {
  38660. cmds.push({
  38661. cmd: 'lineTo',
  38662. args: [
  38663. x,
  38664. y
  38665. ]
  38666. });
  38667. }
  38668. function bezierCurveTo(x1, y1, x2, y2, x, y) {
  38669. cmds.push({
  38670. cmd: 'bezierCurveTo',
  38671. args: [
  38672. x1,
  38673. y1,
  38674. x2,
  38675. y2,
  38676. x,
  38677. y
  38678. ]
  38679. });
  38680. }
  38681. function parse(code) {
  38682. var i = 0;
  38683. while (i < code.length) {
  38684. var stackClean = false;
  38685. var v = code[i++];
  38686. var xa, xb, ya, yb, y1, y2, y3, n, subrCode;
  38687. switch (v) {
  38688. case 1:
  38689. stems += stack.length >> 1;
  38690. stackClean = true;
  38691. break;
  38692. case 3:
  38693. stems += stack.length >> 1;
  38694. stackClean = true;
  38695. break;
  38696. case 4:
  38697. y += stack.pop();
  38698. moveTo(x, y);
  38699. stackClean = true;
  38700. break;
  38701. case 5:
  38702. while (stack.length > 0) {
  38703. x += stack.shift();
  38704. y += stack.shift();
  38705. lineTo(x, y);
  38706. }
  38707. break;
  38708. case 6:
  38709. while (stack.length > 0) {
  38710. x += stack.shift();
  38711. lineTo(x, y);
  38712. if (stack.length === 0) {
  38713. break;
  38714. }
  38715. y += stack.shift();
  38716. lineTo(x, y);
  38717. }
  38718. break;
  38719. case 7:
  38720. while (stack.length > 0) {
  38721. y += stack.shift();
  38722. lineTo(x, y);
  38723. if (stack.length === 0) {
  38724. break;
  38725. }
  38726. x += stack.shift();
  38727. lineTo(x, y);
  38728. }
  38729. break;
  38730. case 8:
  38731. while (stack.length > 0) {
  38732. xa = x + stack.shift();
  38733. ya = y + stack.shift();
  38734. xb = xa + stack.shift();
  38735. yb = ya + stack.shift();
  38736. x = xb + stack.shift();
  38737. y = yb + stack.shift();
  38738. bezierCurveTo(xa, ya, xb, yb, x, y);
  38739. }
  38740. break;
  38741. case 10:
  38742. n = stack.pop() + font.subrsBias;
  38743. subrCode = font.subrs[n];
  38744. if (subrCode) {
  38745. parse(subrCode);
  38746. }
  38747. break;
  38748. case 11:
  38749. return;
  38750. case 12:
  38751. v = code[i++];
  38752. switch (v) {
  38753. case 34:
  38754. xa = x + stack.shift();
  38755. xb = xa + stack.shift();
  38756. y1 = y + stack.shift();
  38757. x = xb + stack.shift();
  38758. bezierCurveTo(xa, y, xb, y1, x, y1);
  38759. xa = x + stack.shift();
  38760. xb = xa + stack.shift();
  38761. x = xb + stack.shift();
  38762. bezierCurveTo(xa, y1, xb, y, x, y);
  38763. break;
  38764. case 35:
  38765. xa = x + stack.shift();
  38766. ya = y + stack.shift();
  38767. xb = xa + stack.shift();
  38768. yb = ya + stack.shift();
  38769. x = xb + stack.shift();
  38770. y = yb + stack.shift();
  38771. bezierCurveTo(xa, ya, xb, yb, x, y);
  38772. xa = x + stack.shift();
  38773. ya = y + stack.shift();
  38774. xb = xa + stack.shift();
  38775. yb = ya + stack.shift();
  38776. x = xb + stack.shift();
  38777. y = yb + stack.shift();
  38778. bezierCurveTo(xa, ya, xb, yb, x, y);
  38779. stack.pop();
  38780. break;
  38781. case 36:
  38782. xa = x + stack.shift();
  38783. y1 = y + stack.shift();
  38784. xb = xa + stack.shift();
  38785. y2 = y1 + stack.shift();
  38786. x = xb + stack.shift();
  38787. bezierCurveTo(xa, y1, xb, y2, x, y2);
  38788. xa = x + stack.shift();
  38789. xb = xa + stack.shift();
  38790. y3 = y2 + stack.shift();
  38791. x = xb + stack.shift();
  38792. bezierCurveTo(xa, y2, xb, y3, x, y);
  38793. break;
  38794. case 37:
  38795. var x0 = x, y0 = y;
  38796. xa = x + stack.shift();
  38797. ya = y + stack.shift();
  38798. xb = xa + stack.shift();
  38799. yb = ya + stack.shift();
  38800. x = xb + stack.shift();
  38801. y = yb + stack.shift();
  38802. bezierCurveTo(xa, ya, xb, yb, x, y);
  38803. xa = x + stack.shift();
  38804. ya = y + stack.shift();
  38805. xb = xa + stack.shift();
  38806. yb = ya + stack.shift();
  38807. x = xb;
  38808. y = yb;
  38809. if (Math.abs(x - x0) > Math.abs(y - y0)) {
  38810. x += stack.shift();
  38811. } else {
  38812. y += stack.shift();
  38813. }
  38814. bezierCurveTo(xa, ya, xb, yb, x, y);
  38815. break;
  38816. default:
  38817. error('unknown operator: 12 ' + v);
  38818. }
  38819. break;
  38820. case 14:
  38821. if (stack.length >= 4) {
  38822. var achar = stack.pop();
  38823. var bchar = stack.pop();
  38824. y = stack.pop();
  38825. x = stack.pop();
  38826. cmds.push({ cmd: 'save' });
  38827. cmds.push({
  38828. cmd: 'translate',
  38829. args: [
  38830. x,
  38831. y
  38832. ]
  38833. });
  38834. var cmap = lookupCmap(font.cmap, String.fromCharCode(font.glyphNameMap[StandardEncoding[achar]]));
  38835. compileCharString(font.glyphs[cmap.glyphId], cmds, font);
  38836. cmds.push({ cmd: 'restore' });
  38837. cmap = lookupCmap(font.cmap, String.fromCharCode(font.glyphNameMap[StandardEncoding[bchar]]));
  38838. compileCharString(font.glyphs[cmap.glyphId], cmds, font);
  38839. }
  38840. return;
  38841. case 18:
  38842. stems += stack.length >> 1;
  38843. stackClean = true;
  38844. break;
  38845. case 19:
  38846. stems += stack.length >> 1;
  38847. i += stems + 7 >> 3;
  38848. stackClean = true;
  38849. break;
  38850. case 20:
  38851. stems += stack.length >> 1;
  38852. i += stems + 7 >> 3;
  38853. stackClean = true;
  38854. break;
  38855. case 21:
  38856. y += stack.pop();
  38857. x += stack.pop();
  38858. moveTo(x, y);
  38859. stackClean = true;
  38860. break;
  38861. case 22:
  38862. x += stack.pop();
  38863. moveTo(x, y);
  38864. stackClean = true;
  38865. break;
  38866. case 23:
  38867. stems += stack.length >> 1;
  38868. stackClean = true;
  38869. break;
  38870. case 24:
  38871. while (stack.length > 2) {
  38872. xa = x + stack.shift();
  38873. ya = y + stack.shift();
  38874. xb = xa + stack.shift();
  38875. yb = ya + stack.shift();
  38876. x = xb + stack.shift();
  38877. y = yb + stack.shift();
  38878. bezierCurveTo(xa, ya, xb, yb, x, y);
  38879. }
  38880. x += stack.shift();
  38881. y += stack.shift();
  38882. lineTo(x, y);
  38883. break;
  38884. case 25:
  38885. while (stack.length > 6) {
  38886. x += stack.shift();
  38887. y += stack.shift();
  38888. lineTo(x, y);
  38889. }
  38890. xa = x + stack.shift();
  38891. ya = y + stack.shift();
  38892. xb = xa + stack.shift();
  38893. yb = ya + stack.shift();
  38894. x = xb + stack.shift();
  38895. y = yb + stack.shift();
  38896. bezierCurveTo(xa, ya, xb, yb, x, y);
  38897. break;
  38898. case 26:
  38899. if (stack.length % 2) {
  38900. x += stack.shift();
  38901. }
  38902. while (stack.length > 0) {
  38903. xa = x;
  38904. ya = y + stack.shift();
  38905. xb = xa + stack.shift();
  38906. yb = ya + stack.shift();
  38907. x = xb;
  38908. y = yb + stack.shift();
  38909. bezierCurveTo(xa, ya, xb, yb, x, y);
  38910. }
  38911. break;
  38912. case 27:
  38913. if (stack.length % 2) {
  38914. y += stack.shift();
  38915. }
  38916. while (stack.length > 0) {
  38917. xa = x + stack.shift();
  38918. ya = y;
  38919. xb = xa + stack.shift();
  38920. yb = ya + stack.shift();
  38921. x = xb + stack.shift();
  38922. y = yb;
  38923. bezierCurveTo(xa, ya, xb, yb, x, y);
  38924. }
  38925. break;
  38926. case 28:
  38927. stack.push((code[i] << 24 | code[i + 1] << 16) >> 16);
  38928. i += 2;
  38929. break;
  38930. case 29:
  38931. n = stack.pop() + font.gsubrsBias;
  38932. subrCode = font.gsubrs[n];
  38933. if (subrCode) {
  38934. parse(subrCode);
  38935. }
  38936. break;
  38937. case 30:
  38938. while (stack.length > 0) {
  38939. xa = x;
  38940. ya = y + stack.shift();
  38941. xb = xa + stack.shift();
  38942. yb = ya + stack.shift();
  38943. x = xb + stack.shift();
  38944. y = yb + (stack.length === 1 ? stack.shift() : 0);
  38945. bezierCurveTo(xa, ya, xb, yb, x, y);
  38946. if (stack.length === 0) {
  38947. break;
  38948. }
  38949. xa = x + stack.shift();
  38950. ya = y;
  38951. xb = xa + stack.shift();
  38952. yb = ya + stack.shift();
  38953. y = yb + stack.shift();
  38954. x = xb + (stack.length === 1 ? stack.shift() : 0);
  38955. bezierCurveTo(xa, ya, xb, yb, x, y);
  38956. }
  38957. break;
  38958. case 31:
  38959. while (stack.length > 0) {
  38960. xa = x + stack.shift();
  38961. ya = y;
  38962. xb = xa + stack.shift();
  38963. yb = ya + stack.shift();
  38964. y = yb + stack.shift();
  38965. x = xb + (stack.length === 1 ? stack.shift() : 0);
  38966. bezierCurveTo(xa, ya, xb, yb, x, y);
  38967. if (stack.length === 0) {
  38968. break;
  38969. }
  38970. xa = x;
  38971. ya = y + stack.shift();
  38972. xb = xa + stack.shift();
  38973. yb = ya + stack.shift();
  38974. x = xb + stack.shift();
  38975. y = yb + (stack.length === 1 ? stack.shift() : 0);
  38976. bezierCurveTo(xa, ya, xb, yb, x, y);
  38977. }
  38978. break;
  38979. default:
  38980. if (v < 32) {
  38981. error('unknown operator: ' + v);
  38982. }
  38983. if (v < 247) {
  38984. stack.push(v - 139);
  38985. } else if (v < 251) {
  38986. stack.push((v - 247) * 256 + code[i++] + 108);
  38987. } else if (v < 255) {
  38988. stack.push(-(v - 251) * 256 - code[i++] - 108);
  38989. } else {
  38990. stack.push((code[i] << 24 | code[i + 1] << 16 | code[i + 2] << 8 | code[i + 3]) / 65536);
  38991. i += 4;
  38992. }
  38993. break;
  38994. }
  38995. if (stackClean) {
  38996. stack.length = 0;
  38997. }
  38998. }
  38999. }
  39000. parse(code);
  39001. }
  39002. var noop = '';
  39003. function CompiledFont(fontMatrix) {
  39004. this.compiledGlyphs = Object.create(null);
  39005. this.compiledCharCodeToGlyphId = Object.create(null);
  39006. this.fontMatrix = fontMatrix;
  39007. }
  39008. CompiledFont.prototype = {
  39009. getPathJs: function (unicode) {
  39010. var cmap = lookupCmap(this.cmap, unicode);
  39011. var fn = this.compiledGlyphs[cmap.glyphId];
  39012. if (!fn) {
  39013. fn = this.compileGlyph(this.glyphs[cmap.glyphId]);
  39014. this.compiledGlyphs[cmap.glyphId] = fn;
  39015. }
  39016. if (this.compiledCharCodeToGlyphId[cmap.charCode] === undefined) {
  39017. this.compiledCharCodeToGlyphId[cmap.charCode] = cmap.glyphId;
  39018. }
  39019. return fn;
  39020. },
  39021. compileGlyph: function (code) {
  39022. if (!code || code.length === 0 || code[0] === 14) {
  39023. return noop;
  39024. }
  39025. var cmds = [];
  39026. cmds.push({ cmd: 'save' });
  39027. cmds.push({
  39028. cmd: 'transform',
  39029. args: this.fontMatrix.slice()
  39030. });
  39031. cmds.push({
  39032. cmd: 'scale',
  39033. args: [
  39034. 'size',
  39035. '-size'
  39036. ]
  39037. });
  39038. this.compileGlyphImpl(code, cmds);
  39039. cmds.push({ cmd: 'restore' });
  39040. return cmds;
  39041. },
  39042. compileGlyphImpl: function () {
  39043. error('Children classes should implement this.');
  39044. },
  39045. hasBuiltPath: function (unicode) {
  39046. var cmap = lookupCmap(this.cmap, unicode);
  39047. return this.compiledGlyphs[cmap.glyphId] !== undefined && this.compiledCharCodeToGlyphId[cmap.charCode] !== undefined;
  39048. }
  39049. };
  39050. function TrueTypeCompiled(glyphs, cmap, fontMatrix) {
  39051. fontMatrix = fontMatrix || [
  39052. 0.000488,
  39053. 0,
  39054. 0,
  39055. 0.000488,
  39056. 0,
  39057. 0
  39058. ];
  39059. CompiledFont.call(this, fontMatrix);
  39060. this.glyphs = glyphs;
  39061. this.cmap = cmap;
  39062. }
  39063. Util.inherit(TrueTypeCompiled, CompiledFont, {
  39064. compileGlyphImpl: function (code, cmds) {
  39065. compileGlyf(code, cmds, this);
  39066. }
  39067. });
  39068. function Type2Compiled(cffInfo, cmap, fontMatrix, glyphNameMap) {
  39069. fontMatrix = fontMatrix || [
  39070. 0.001,
  39071. 0,
  39072. 0,
  39073. 0.001,
  39074. 0,
  39075. 0
  39076. ];
  39077. CompiledFont.call(this, fontMatrix);
  39078. this.glyphs = cffInfo.glyphs;
  39079. this.gsubrs = cffInfo.gsubrs || [];
  39080. this.subrs = cffInfo.subrs || [];
  39081. this.cmap = cmap;
  39082. this.glyphNameMap = glyphNameMap || getGlyphsUnicode();
  39083. this.gsubrsBias = this.gsubrs.length < 1240 ? 107 : this.gsubrs.length < 33900 ? 1131 : 32768;
  39084. this.subrsBias = this.subrs.length < 1240 ? 107 : this.subrs.length < 33900 ? 1131 : 32768;
  39085. }
  39086. Util.inherit(Type2Compiled, CompiledFont, {
  39087. compileGlyphImpl: function (code, cmds) {
  39088. compileCharString(code, cmds, this);
  39089. }
  39090. });
  39091. return {
  39092. create: function FontRendererFactory_create(font, seacAnalysisEnabled) {
  39093. var data = new Uint8Array(font.data);
  39094. var cmap, glyf, loca, cff, indexToLocFormat, unitsPerEm;
  39095. var numTables = getUshort(data, 4);
  39096. for (var i = 0, p = 12; i < numTables; i++, p += 16) {
  39097. var tag = bytesToString(data.subarray(p, p + 4));
  39098. var offset = getLong(data, p + 8);
  39099. var length = getLong(data, p + 12);
  39100. switch (tag) {
  39101. case 'cmap':
  39102. cmap = parseCmap(data, offset, offset + length);
  39103. break;
  39104. case 'glyf':
  39105. glyf = data.subarray(offset, offset + length);
  39106. break;
  39107. case 'loca':
  39108. loca = data.subarray(offset, offset + length);
  39109. break;
  39110. case 'head':
  39111. unitsPerEm = getUshort(data, offset + 18);
  39112. indexToLocFormat = getUshort(data, offset + 50);
  39113. break;
  39114. case 'CFF ':
  39115. cff = parseCff(data, offset, offset + length, seacAnalysisEnabled);
  39116. break;
  39117. }
  39118. }
  39119. if (glyf) {
  39120. var fontMatrix = !unitsPerEm ? font.fontMatrix : [
  39121. 1 / unitsPerEm,
  39122. 0,
  39123. 0,
  39124. 1 / unitsPerEm,
  39125. 0,
  39126. 0
  39127. ];
  39128. return new TrueTypeCompiled(parseGlyfTable(glyf, loca, indexToLocFormat), cmap, fontMatrix);
  39129. }
  39130. return new Type2Compiled(cff, cmap, font.fontMatrix, font.glyphNameMap);
  39131. }
  39132. };
  39133. }();
  39134. exports.FontRendererFactory = FontRendererFactory;
  39135. /***/ }),
  39136. /* 26 */
  39137. /***/ (function(module, exports, __w_pdfjs_require__) {
  39138. "use strict";
  39139. var sharedUtil = __w_pdfjs_require__(0);
  39140. var corePrimitives = __w_pdfjs_require__(1);
  39141. var coreStream = __w_pdfjs_require__(2);
  39142. var coreGlyphList = __w_pdfjs_require__(7);
  39143. var coreFontRenderer = __w_pdfjs_require__(25);
  39144. var coreEncodings = __w_pdfjs_require__(4);
  39145. var coreStandardFonts = __w_pdfjs_require__(17);
  39146. var coreUnicode = __w_pdfjs_require__(18);
  39147. var coreType1Parser = __w_pdfjs_require__(35);
  39148. var coreCFFParser = __w_pdfjs_require__(11);
  39149. var FONT_IDENTITY_MATRIX = sharedUtil.FONT_IDENTITY_MATRIX;
  39150. var FontType = sharedUtil.FontType;
  39151. var assert = sharedUtil.assert;
  39152. var bytesToString = sharedUtil.bytesToString;
  39153. var error = sharedUtil.error;
  39154. var info = sharedUtil.info;
  39155. var isArray = sharedUtil.isArray;
  39156. var isInt = sharedUtil.isInt;
  39157. var isNum = sharedUtil.isNum;
  39158. var readUint32 = sharedUtil.readUint32;
  39159. var shadow = sharedUtil.shadow;
  39160. var string32 = sharedUtil.string32;
  39161. var warn = sharedUtil.warn;
  39162. var MissingDataException = sharedUtil.MissingDataException;
  39163. var isSpace = sharedUtil.isSpace;
  39164. var Stream = coreStream.Stream;
  39165. var getGlyphsUnicode = coreGlyphList.getGlyphsUnicode;
  39166. var getDingbatsGlyphsUnicode = coreGlyphList.getDingbatsGlyphsUnicode;
  39167. var FontRendererFactory = coreFontRenderer.FontRendererFactory;
  39168. var StandardEncoding = coreEncodings.StandardEncoding;
  39169. var MacRomanEncoding = coreEncodings.MacRomanEncoding;
  39170. var SymbolSetEncoding = coreEncodings.SymbolSetEncoding;
  39171. var ZapfDingbatsEncoding = coreEncodings.ZapfDingbatsEncoding;
  39172. var getEncoding = coreEncodings.getEncoding;
  39173. var getStdFontMap = coreStandardFonts.getStdFontMap;
  39174. var getNonStdFontMap = coreStandardFonts.getNonStdFontMap;
  39175. var getGlyphMapForStandardFonts = coreStandardFonts.getGlyphMapForStandardFonts;
  39176. var getSupplementalGlyphMapForArialBlack = coreStandardFonts.getSupplementalGlyphMapForArialBlack;
  39177. var getUnicodeRangeFor = coreUnicode.getUnicodeRangeFor;
  39178. var mapSpecialUnicodeValues = coreUnicode.mapSpecialUnicodeValues;
  39179. var getUnicodeForGlyph = coreUnicode.getUnicodeForGlyph;
  39180. var Type1Parser = coreType1Parser.Type1Parser;
  39181. var CFFStandardStrings = coreCFFParser.CFFStandardStrings;
  39182. var CFFParser = coreCFFParser.CFFParser;
  39183. var CFFCompiler = coreCFFParser.CFFCompiler;
  39184. var CFF = coreCFFParser.CFF;
  39185. var CFFHeader = coreCFFParser.CFFHeader;
  39186. var CFFTopDict = coreCFFParser.CFFTopDict;
  39187. var CFFPrivateDict = coreCFFParser.CFFPrivateDict;
  39188. var CFFStrings = coreCFFParser.CFFStrings;
  39189. var CFFIndex = coreCFFParser.CFFIndex;
  39190. var CFFCharset = coreCFFParser.CFFCharset;
  39191. var PRIVATE_USE_OFFSET_START = 0xE000;
  39192. var PRIVATE_USE_OFFSET_END = 0xF8FF;
  39193. var SKIP_PRIVATE_USE_RANGE_F000_TO_F01F = false;
  39194. var PDF_GLYPH_SPACE_UNITS = 1000;
  39195. var SEAC_ANALYSIS_ENABLED = false;
  39196. var FontFlags = {
  39197. FixedPitch: 1,
  39198. Serif: 2,
  39199. Symbolic: 4,
  39200. Script: 8,
  39201. Nonsymbolic: 32,
  39202. Italic: 64,
  39203. AllCap: 65536,
  39204. SmallCap: 131072,
  39205. ForceBold: 262144
  39206. };
  39207. var MacStandardGlyphOrdering = [
  39208. '.notdef',
  39209. '.null',
  39210. 'nonmarkingreturn',
  39211. 'space',
  39212. 'exclam',
  39213. 'quotedbl',
  39214. 'numbersign',
  39215. 'dollar',
  39216. 'percent',
  39217. 'ampersand',
  39218. 'quotesingle',
  39219. 'parenleft',
  39220. 'parenright',
  39221. 'asterisk',
  39222. 'plus',
  39223. 'comma',
  39224. 'hyphen',
  39225. 'period',
  39226. 'slash',
  39227. 'zero',
  39228. 'one',
  39229. 'two',
  39230. 'three',
  39231. 'four',
  39232. 'five',
  39233. 'six',
  39234. 'seven',
  39235. 'eight',
  39236. 'nine',
  39237. 'colon',
  39238. 'semicolon',
  39239. 'less',
  39240. 'equal',
  39241. 'greater',
  39242. 'question',
  39243. 'at',
  39244. 'A',
  39245. 'B',
  39246. 'C',
  39247. 'D',
  39248. 'E',
  39249. 'F',
  39250. 'G',
  39251. 'H',
  39252. 'I',
  39253. 'J',
  39254. 'K',
  39255. 'L',
  39256. 'M',
  39257. 'N',
  39258. 'O',
  39259. 'P',
  39260. 'Q',
  39261. 'R',
  39262. 'S',
  39263. 'T',
  39264. 'U',
  39265. 'V',
  39266. 'W',
  39267. 'X',
  39268. 'Y',
  39269. 'Z',
  39270. 'bracketleft',
  39271. 'backslash',
  39272. 'bracketright',
  39273. 'asciicircum',
  39274. 'underscore',
  39275. 'grave',
  39276. 'a',
  39277. 'b',
  39278. 'c',
  39279. 'd',
  39280. 'e',
  39281. 'f',
  39282. 'g',
  39283. 'h',
  39284. 'i',
  39285. 'j',
  39286. 'k',
  39287. 'l',
  39288. 'm',
  39289. 'n',
  39290. 'o',
  39291. 'p',
  39292. 'q',
  39293. 'r',
  39294. 's',
  39295. 't',
  39296. 'u',
  39297. 'v',
  39298. 'w',
  39299. 'x',
  39300. 'y',
  39301. 'z',
  39302. 'braceleft',
  39303. 'bar',
  39304. 'braceright',
  39305. 'asciitilde',
  39306. 'Adieresis',
  39307. 'Aring',
  39308. 'Ccedilla',
  39309. 'Eacute',
  39310. 'Ntilde',
  39311. 'Odieresis',
  39312. 'Udieresis',
  39313. 'aacute',
  39314. 'agrave',
  39315. 'acircumflex',
  39316. 'adieresis',
  39317. 'atilde',
  39318. 'aring',
  39319. 'ccedilla',
  39320. 'eacute',
  39321. 'egrave',
  39322. 'ecircumflex',
  39323. 'edieresis',
  39324. 'iacute',
  39325. 'igrave',
  39326. 'icircumflex',
  39327. 'idieresis',
  39328. 'ntilde',
  39329. 'oacute',
  39330. 'ograve',
  39331. 'ocircumflex',
  39332. 'odieresis',
  39333. 'otilde',
  39334. 'uacute',
  39335. 'ugrave',
  39336. 'ucircumflex',
  39337. 'udieresis',
  39338. 'dagger',
  39339. 'degree',
  39340. 'cent',
  39341. 'sterling',
  39342. 'section',
  39343. 'bullet',
  39344. 'paragraph',
  39345. 'germandbls',
  39346. 'registered',
  39347. 'copyright',
  39348. 'trademark',
  39349. 'acute',
  39350. 'dieresis',
  39351. 'notequal',
  39352. 'AE',
  39353. 'Oslash',
  39354. 'infinity',
  39355. 'plusminus',
  39356. 'lessequal',
  39357. 'greaterequal',
  39358. 'yen',
  39359. 'mu',
  39360. 'partialdiff',
  39361. 'summation',
  39362. 'product',
  39363. 'pi',
  39364. 'integral',
  39365. 'ordfeminine',
  39366. 'ordmasculine',
  39367. 'Omega',
  39368. 'ae',
  39369. 'oslash',
  39370. 'questiondown',
  39371. 'exclamdown',
  39372. 'logicalnot',
  39373. 'radical',
  39374. 'florin',
  39375. 'approxequal',
  39376. 'Delta',
  39377. 'guillemotleft',
  39378. 'guillemotright',
  39379. 'ellipsis',
  39380. 'nonbreakingspace',
  39381. 'Agrave',
  39382. 'Atilde',
  39383. 'Otilde',
  39384. 'OE',
  39385. 'oe',
  39386. 'endash',
  39387. 'emdash',
  39388. 'quotedblleft',
  39389. 'quotedblright',
  39390. 'quoteleft',
  39391. 'quoteright',
  39392. 'divide',
  39393. 'lozenge',
  39394. 'ydieresis',
  39395. 'Ydieresis',
  39396. 'fraction',
  39397. 'currency',
  39398. 'guilsinglleft',
  39399. 'guilsinglright',
  39400. 'fi',
  39401. 'fl',
  39402. 'daggerdbl',
  39403. 'periodcentered',
  39404. 'quotesinglbase',
  39405. 'quotedblbase',
  39406. 'perthousand',
  39407. 'Acircumflex',
  39408. 'Ecircumflex',
  39409. 'Aacute',
  39410. 'Edieresis',
  39411. 'Egrave',
  39412. 'Iacute',
  39413. 'Icircumflex',
  39414. 'Idieresis',
  39415. 'Igrave',
  39416. 'Oacute',
  39417. 'Ocircumflex',
  39418. 'apple',
  39419. 'Ograve',
  39420. 'Uacute',
  39421. 'Ucircumflex',
  39422. 'Ugrave',
  39423. 'dotlessi',
  39424. 'circumflex',
  39425. 'tilde',
  39426. 'macron',
  39427. 'breve',
  39428. 'dotaccent',
  39429. 'ring',
  39430. 'cedilla',
  39431. 'hungarumlaut',
  39432. 'ogonek',
  39433. 'caron',
  39434. 'Lslash',
  39435. 'lslash',
  39436. 'Scaron',
  39437. 'scaron',
  39438. 'Zcaron',
  39439. 'zcaron',
  39440. 'brokenbar',
  39441. 'Eth',
  39442. 'eth',
  39443. 'Yacute',
  39444. 'yacute',
  39445. 'Thorn',
  39446. 'thorn',
  39447. 'minus',
  39448. 'multiply',
  39449. 'onesuperior',
  39450. 'twosuperior',
  39451. 'threesuperior',
  39452. 'onehalf',
  39453. 'onequarter',
  39454. 'threequarters',
  39455. 'franc',
  39456. 'Gbreve',
  39457. 'gbreve',
  39458. 'Idotaccent',
  39459. 'Scedilla',
  39460. 'scedilla',
  39461. 'Cacute',
  39462. 'cacute',
  39463. 'Ccaron',
  39464. 'ccaron',
  39465. 'dcroat'
  39466. ];
  39467. function adjustWidths(properties) {
  39468. if (!properties.fontMatrix) {
  39469. return;
  39470. }
  39471. if (properties.fontMatrix[0] === FONT_IDENTITY_MATRIX[0]) {
  39472. return;
  39473. }
  39474. var scale = 0.001 / properties.fontMatrix[0];
  39475. var glyphsWidths = properties.widths;
  39476. for (var glyph in glyphsWidths) {
  39477. glyphsWidths[glyph] *= scale;
  39478. }
  39479. properties.defaultWidth *= scale;
  39480. }
  39481. function adjustToUnicode(properties, builtInEncoding) {
  39482. if (properties.hasIncludedToUnicodeMap) {
  39483. return;
  39484. }
  39485. if (properties.hasEncoding) {
  39486. return;
  39487. }
  39488. if (builtInEncoding === properties.defaultEncoding) {
  39489. return;
  39490. }
  39491. if (properties.toUnicode instanceof IdentityToUnicodeMap) {
  39492. return;
  39493. }
  39494. var toUnicode = [], glyphsUnicodeMap = getGlyphsUnicode();
  39495. for (var charCode in builtInEncoding) {
  39496. var glyphName = builtInEncoding[charCode];
  39497. var unicode = getUnicodeForGlyph(glyphName, glyphsUnicodeMap);
  39498. if (unicode !== -1) {
  39499. toUnicode[charCode] = String.fromCharCode(unicode);
  39500. }
  39501. }
  39502. properties.toUnicode.amend(toUnicode);
  39503. }
  39504. function getFontType(type, subtype) {
  39505. switch (type) {
  39506. case 'Type1':
  39507. return subtype === 'Type1C' ? FontType.TYPE1C : FontType.TYPE1;
  39508. case 'CIDFontType0':
  39509. return subtype === 'CIDFontType0C' ? FontType.CIDFONTTYPE0C : FontType.CIDFONTTYPE0;
  39510. case 'OpenType':
  39511. return FontType.OPENTYPE;
  39512. case 'TrueType':
  39513. return FontType.TRUETYPE;
  39514. case 'CIDFontType2':
  39515. return FontType.CIDFONTTYPE2;
  39516. case 'MMType1':
  39517. return FontType.MMTYPE1;
  39518. case 'Type0':
  39519. return FontType.TYPE0;
  39520. default:
  39521. return FontType.UNKNOWN;
  39522. }
  39523. }
  39524. function recoverGlyphName(name, glyphsUnicodeMap) {
  39525. if (glyphsUnicodeMap[name] !== undefined) {
  39526. return name;
  39527. }
  39528. var unicode = getUnicodeForGlyph(name, glyphsUnicodeMap);
  39529. if (unicode !== -1) {
  39530. for (var key in glyphsUnicodeMap) {
  39531. if (glyphsUnicodeMap[key] === unicode) {
  39532. return key;
  39533. }
  39534. }
  39535. }
  39536. info('Unable to recover a standard glyph name for: ' + name);
  39537. return name;
  39538. }
  39539. var Glyph = function GlyphClosure() {
  39540. function Glyph(fontChar, unicode, accent, width, vmetric, operatorListId, isSpace, isInFont) {
  39541. this.fontChar = fontChar;
  39542. this.unicode = unicode;
  39543. this.accent = accent;
  39544. this.width = width;
  39545. this.vmetric = vmetric;
  39546. this.operatorListId = operatorListId;
  39547. this.isSpace = isSpace;
  39548. this.isInFont = isInFont;
  39549. }
  39550. Glyph.prototype.matchesForCache = function (fontChar, unicode, accent, width, vmetric, operatorListId, isSpace, isInFont) {
  39551. 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;
  39552. };
  39553. return Glyph;
  39554. }();
  39555. var ToUnicodeMap = function ToUnicodeMapClosure() {
  39556. function ToUnicodeMap(cmap) {
  39557. this._map = cmap;
  39558. }
  39559. ToUnicodeMap.prototype = {
  39560. get length() {
  39561. return this._map.length;
  39562. },
  39563. forEach: function (callback) {
  39564. for (var charCode in this._map) {
  39565. callback(charCode, this._map[charCode].charCodeAt(0));
  39566. }
  39567. },
  39568. has: function (i) {
  39569. return this._map[i] !== undefined;
  39570. },
  39571. get: function (i) {
  39572. return this._map[i];
  39573. },
  39574. charCodeOf: function (v) {
  39575. return this._map.indexOf(v);
  39576. },
  39577. amend: function (map) {
  39578. for (var charCode in map) {
  39579. this._map[charCode] = map[charCode];
  39580. }
  39581. }
  39582. };
  39583. return ToUnicodeMap;
  39584. }();
  39585. var IdentityToUnicodeMap = function IdentityToUnicodeMapClosure() {
  39586. function IdentityToUnicodeMap(firstChar, lastChar) {
  39587. this.firstChar = firstChar;
  39588. this.lastChar = lastChar;
  39589. }
  39590. IdentityToUnicodeMap.prototype = {
  39591. get length() {
  39592. return this.lastChar + 1 - this.firstChar;
  39593. },
  39594. forEach: function (callback) {
  39595. for (var i = this.firstChar, ii = this.lastChar; i <= ii; i++) {
  39596. callback(i, i);
  39597. }
  39598. },
  39599. has: function (i) {
  39600. return this.firstChar <= i && i <= this.lastChar;
  39601. },
  39602. get: function (i) {
  39603. if (this.firstChar <= i && i <= this.lastChar) {
  39604. return String.fromCharCode(i);
  39605. }
  39606. return undefined;
  39607. },
  39608. charCodeOf: function (v) {
  39609. return isInt(v) && v >= this.firstChar && v <= this.lastChar ? v : -1;
  39610. },
  39611. amend: function (map) {
  39612. error('Should not call amend()');
  39613. }
  39614. };
  39615. return IdentityToUnicodeMap;
  39616. }();
  39617. var OpenTypeFileBuilder = function OpenTypeFileBuilderClosure() {
  39618. function writeInt16(dest, offset, num) {
  39619. dest[offset] = num >> 8 & 0xFF;
  39620. dest[offset + 1] = num & 0xFF;
  39621. }
  39622. function writeInt32(dest, offset, num) {
  39623. dest[offset] = num >> 24 & 0xFF;
  39624. dest[offset + 1] = num >> 16 & 0xFF;
  39625. dest[offset + 2] = num >> 8 & 0xFF;
  39626. dest[offset + 3] = num & 0xFF;
  39627. }
  39628. function writeData(dest, offset, data) {
  39629. var i, ii;
  39630. if (data instanceof Uint8Array) {
  39631. dest.set(data, offset);
  39632. } else if (typeof data === 'string') {
  39633. for (i = 0, ii = data.length; i < ii; i++) {
  39634. dest[offset++] = data.charCodeAt(i) & 0xFF;
  39635. }
  39636. } else {
  39637. for (i = 0, ii = data.length; i < ii; i++) {
  39638. dest[offset++] = data[i] & 0xFF;
  39639. }
  39640. }
  39641. }
  39642. function OpenTypeFileBuilder(sfnt) {
  39643. this.sfnt = sfnt;
  39644. this.tables = Object.create(null);
  39645. }
  39646. OpenTypeFileBuilder.getSearchParams = function OpenTypeFileBuilder_getSearchParams(entriesCount, entrySize) {
  39647. var maxPower2 = 1, log2 = 0;
  39648. while ((maxPower2 ^ entriesCount) > maxPower2) {
  39649. maxPower2 <<= 1;
  39650. log2++;
  39651. }
  39652. var searchRange = maxPower2 * entrySize;
  39653. return {
  39654. range: searchRange,
  39655. entry: log2,
  39656. rangeShift: entrySize * entriesCount - searchRange
  39657. };
  39658. };
  39659. var OTF_HEADER_SIZE = 12;
  39660. var OTF_TABLE_ENTRY_SIZE = 16;
  39661. OpenTypeFileBuilder.prototype = {
  39662. toArray: function OpenTypeFileBuilder_toArray() {
  39663. var sfnt = this.sfnt;
  39664. var tables = this.tables;
  39665. var tablesNames = Object.keys(tables);
  39666. tablesNames.sort();
  39667. var numTables = tablesNames.length;
  39668. var i, j, jj, table, tableName;
  39669. var offset = OTF_HEADER_SIZE + numTables * OTF_TABLE_ENTRY_SIZE;
  39670. var tableOffsets = [offset];
  39671. for (i = 0; i < numTables; i++) {
  39672. table = tables[tablesNames[i]];
  39673. var paddedLength = (table.length + 3 & ~3) >>> 0;
  39674. offset += paddedLength;
  39675. tableOffsets.push(offset);
  39676. }
  39677. var file = new Uint8Array(offset);
  39678. for (i = 0; i < numTables; i++) {
  39679. table = tables[tablesNames[i]];
  39680. writeData(file, tableOffsets[i], table);
  39681. }
  39682. if (sfnt === 'true') {
  39683. sfnt = string32(0x00010000);
  39684. }
  39685. file[0] = sfnt.charCodeAt(0) & 0xFF;
  39686. file[1] = sfnt.charCodeAt(1) & 0xFF;
  39687. file[2] = sfnt.charCodeAt(2) & 0xFF;
  39688. file[3] = sfnt.charCodeAt(3) & 0xFF;
  39689. writeInt16(file, 4, numTables);
  39690. var searchParams = OpenTypeFileBuilder.getSearchParams(numTables, 16);
  39691. writeInt16(file, 6, searchParams.range);
  39692. writeInt16(file, 8, searchParams.entry);
  39693. writeInt16(file, 10, searchParams.rangeShift);
  39694. offset = OTF_HEADER_SIZE;
  39695. for (i = 0; i < numTables; i++) {
  39696. tableName = tablesNames[i];
  39697. file[offset] = tableName.charCodeAt(0) & 0xFF;
  39698. file[offset + 1] = tableName.charCodeAt(1) & 0xFF;
  39699. file[offset + 2] = tableName.charCodeAt(2) & 0xFF;
  39700. file[offset + 3] = tableName.charCodeAt(3) & 0xFF;
  39701. var checksum = 0;
  39702. for (j = tableOffsets[i], jj = tableOffsets[i + 1]; j < jj; j += 4) {
  39703. var quad = readUint32(file, j);
  39704. checksum = checksum + quad >>> 0;
  39705. }
  39706. writeInt32(file, offset + 4, checksum);
  39707. writeInt32(file, offset + 8, tableOffsets[i]);
  39708. writeInt32(file, offset + 12, tables[tableName].length);
  39709. offset += OTF_TABLE_ENTRY_SIZE;
  39710. }
  39711. return file;
  39712. },
  39713. addTable: function OpenTypeFileBuilder_addTable(tag, data) {
  39714. if (tag in this.tables) {
  39715. throw new Error('Table ' + tag + ' already exists');
  39716. }
  39717. this.tables[tag] = data;
  39718. }
  39719. };
  39720. return OpenTypeFileBuilder;
  39721. }();
  39722. var ProblematicCharRanges = new Int32Array([
  39723. 0x0000,
  39724. 0x0020,
  39725. 0x007F,
  39726. 0x00A1,
  39727. 0x00AD,
  39728. 0x00AE,
  39729. 0x0600,
  39730. 0x0780,
  39731. 0x08A0,
  39732. 0x10A0,
  39733. 0x1780,
  39734. 0x1800,
  39735. 0x1C00,
  39736. 0x1C50,
  39737. 0x2000,
  39738. 0x2010,
  39739. 0x2011,
  39740. 0x2012,
  39741. 0x2028,
  39742. 0x2030,
  39743. 0x205F,
  39744. 0x2070,
  39745. 0x25CC,
  39746. 0x25CD,
  39747. 0x3000,
  39748. 0x3001,
  39749. 0xAA60,
  39750. 0xAA80,
  39751. 0xFFF0,
  39752. 0x10000
  39753. ]);
  39754. var Font = function FontClosure() {
  39755. function Font(name, file, properties) {
  39756. var charCode, glyphName, unicode;
  39757. this.name = name;
  39758. this.loadedName = properties.loadedName;
  39759. this.isType3Font = properties.isType3Font;
  39760. this.sizes = [];
  39761. this.missingFile = false;
  39762. this.glyphCache = Object.create(null);
  39763. this.isSerifFont = !!(properties.flags & FontFlags.Serif);
  39764. this.isSymbolicFont = !!(properties.flags & FontFlags.Symbolic);
  39765. this.isMonospace = !!(properties.flags & FontFlags.FixedPitch);
  39766. var type = properties.type;
  39767. var subtype = properties.subtype;
  39768. this.type = type;
  39769. this.fallbackName = this.isMonospace ? 'monospace' : this.isSerifFont ? 'serif' : 'sans-serif';
  39770. this.differences = properties.differences;
  39771. this.widths = properties.widths;
  39772. this.defaultWidth = properties.defaultWidth;
  39773. this.composite = properties.composite;
  39774. this.wideChars = properties.wideChars;
  39775. this.cMap = properties.cMap;
  39776. this.ascent = properties.ascent / PDF_GLYPH_SPACE_UNITS;
  39777. this.descent = properties.descent / PDF_GLYPH_SPACE_UNITS;
  39778. this.fontMatrix = properties.fontMatrix;
  39779. this.bbox = properties.bbox;
  39780. this.toUnicode = properties.toUnicode;
  39781. this.toFontChar = [];
  39782. if (properties.type === 'Type3') {
  39783. for (charCode = 0; charCode < 256; charCode++) {
  39784. this.toFontChar[charCode] = this.differences[charCode] || properties.defaultEncoding[charCode];
  39785. }
  39786. this.fontType = FontType.TYPE3;
  39787. return;
  39788. }
  39789. this.cidEncoding = properties.cidEncoding;
  39790. this.vertical = properties.vertical;
  39791. if (this.vertical) {
  39792. this.vmetrics = properties.vmetrics;
  39793. this.defaultVMetrics = properties.defaultVMetrics;
  39794. }
  39795. var glyphsUnicodeMap;
  39796. if (!file || file.isEmpty) {
  39797. if (file) {
  39798. warn('Font file is empty in "' + name + '" (' + this.loadedName + ')');
  39799. }
  39800. this.missingFile = true;
  39801. var fontName = name.replace(/[,_]/g, '-');
  39802. var stdFontMap = getStdFontMap(), nonStdFontMap = getNonStdFontMap();
  39803. var isStandardFont = !!stdFontMap[fontName] || !!(nonStdFontMap[fontName] && stdFontMap[nonStdFontMap[fontName]]);
  39804. fontName = stdFontMap[fontName] || nonStdFontMap[fontName] || fontName;
  39805. this.bold = fontName.search(/bold/gi) !== -1;
  39806. this.italic = fontName.search(/oblique/gi) !== -1 || fontName.search(/italic/gi) !== -1;
  39807. this.black = name.search(/Black/g) !== -1;
  39808. this.remeasure = Object.keys(this.widths).length > 0;
  39809. if (isStandardFont && type === 'CIDFontType2' && properties.cidEncoding.indexOf('Identity-') === 0) {
  39810. var GlyphMapForStandardFonts = getGlyphMapForStandardFonts();
  39811. var map = [];
  39812. for (charCode in GlyphMapForStandardFonts) {
  39813. map[+charCode] = GlyphMapForStandardFonts[charCode];
  39814. }
  39815. if (/Arial-?Black/i.test(name)) {
  39816. var SupplementalGlyphMapForArialBlack = getSupplementalGlyphMapForArialBlack();
  39817. for (charCode in SupplementalGlyphMapForArialBlack) {
  39818. map[+charCode] = SupplementalGlyphMapForArialBlack[charCode];
  39819. }
  39820. }
  39821. var isIdentityUnicode = this.toUnicode instanceof IdentityToUnicodeMap;
  39822. if (!isIdentityUnicode) {
  39823. this.toUnicode.forEach(function (charCode, unicodeCharCode) {
  39824. map[+charCode] = unicodeCharCode;
  39825. });
  39826. }
  39827. this.toFontChar = map;
  39828. this.toUnicode = new ToUnicodeMap(map);
  39829. } else if (/Symbol/i.test(fontName)) {
  39830. this.toFontChar = buildToFontChar(SymbolSetEncoding, getGlyphsUnicode(), properties.differences);
  39831. } else if (/Dingbats/i.test(fontName)) {
  39832. if (/Wingdings/i.test(name)) {
  39833. warn('Non-embedded Wingdings font, falling back to ZapfDingbats.');
  39834. }
  39835. this.toFontChar = buildToFontChar(ZapfDingbatsEncoding, getDingbatsGlyphsUnicode(), properties.differences);
  39836. } else if (isStandardFont) {
  39837. this.toFontChar = buildToFontChar(properties.defaultEncoding, getGlyphsUnicode(), properties.differences);
  39838. } else {
  39839. glyphsUnicodeMap = getGlyphsUnicode();
  39840. this.toUnicode.forEach(function (charCode, unicodeCharCode) {
  39841. if (!this.composite) {
  39842. glyphName = properties.differences[charCode] || properties.defaultEncoding[charCode];
  39843. unicode = getUnicodeForGlyph(glyphName, glyphsUnicodeMap);
  39844. if (unicode !== -1) {
  39845. unicodeCharCode = unicode;
  39846. }
  39847. }
  39848. this.toFontChar[charCode] = unicodeCharCode;
  39849. }.bind(this));
  39850. }
  39851. this.loadedName = fontName.split('-')[0];
  39852. this.loading = false;
  39853. this.fontType = getFontType(type, subtype);
  39854. return;
  39855. }
  39856. if (subtype === 'Type1C') {
  39857. if (type !== 'Type1' && type !== 'MMType1') {
  39858. if (isTrueTypeFile(file)) {
  39859. subtype = 'TrueType';
  39860. } else {
  39861. type = 'Type1';
  39862. }
  39863. } else if (isOpenTypeFile(file)) {
  39864. type = subtype = 'OpenType';
  39865. }
  39866. }
  39867. if (subtype === 'CIDFontType0C' && type !== 'CIDFontType0') {
  39868. type = 'CIDFontType0';
  39869. }
  39870. if (subtype === 'OpenType') {
  39871. type = 'OpenType';
  39872. }
  39873. if (type === 'CIDFontType0') {
  39874. if (isType1File(file)) {
  39875. subtype = 'CIDFontType0';
  39876. } else if (isOpenTypeFile(file)) {
  39877. type = subtype = 'OpenType';
  39878. } else {
  39879. subtype = 'CIDFontType0C';
  39880. }
  39881. }
  39882. var data;
  39883. switch (type) {
  39884. case 'MMType1':
  39885. info('MMType1 font (' + name + '), falling back to Type1.');
  39886. case 'Type1':
  39887. case 'CIDFontType0':
  39888. this.mimetype = 'font/opentype';
  39889. var cff = subtype === 'Type1C' || subtype === 'CIDFontType0C' ? new CFFFont(file, properties) : new Type1Font(name, file, properties);
  39890. adjustWidths(properties);
  39891. data = this.convert(name, cff, properties);
  39892. break;
  39893. case 'OpenType':
  39894. case 'TrueType':
  39895. case 'CIDFontType2':
  39896. this.mimetype = 'font/opentype';
  39897. data = this.checkAndRepair(name, file, properties);
  39898. if (this.isOpenType) {
  39899. adjustWidths(properties);
  39900. type = 'OpenType';
  39901. }
  39902. break;
  39903. default:
  39904. error('Font ' + type + ' is not supported');
  39905. break;
  39906. }
  39907. this.data = data;
  39908. this.fontType = getFontType(type, subtype);
  39909. this.fontMatrix = properties.fontMatrix;
  39910. this.widths = properties.widths;
  39911. this.defaultWidth = properties.defaultWidth;
  39912. this.toUnicode = properties.toUnicode;
  39913. this.encoding = properties.baseEncoding;
  39914. this.seacMap = properties.seacMap;
  39915. this.loading = true;
  39916. }
  39917. Font.getFontID = function () {
  39918. var ID = 1;
  39919. return function Font_getFontID() {
  39920. return String(ID++);
  39921. };
  39922. }();
  39923. function int16(b0, b1) {
  39924. return (b0 << 8) + b1;
  39925. }
  39926. function signedInt16(b0, b1) {
  39927. var value = (b0 << 8) + b1;
  39928. return value & 1 << 15 ? value - 0x10000 : value;
  39929. }
  39930. function int32(b0, b1, b2, b3) {
  39931. return (b0 << 24) + (b1 << 16) + (b2 << 8) + b3;
  39932. }
  39933. function string16(value) {
  39934. return String.fromCharCode(value >> 8 & 0xff, value & 0xff);
  39935. }
  39936. function safeString16(value) {
  39937. value = value > 0x7FFF ? 0x7FFF : value < -0x8000 ? -0x8000 : value;
  39938. return String.fromCharCode(value >> 8 & 0xff, value & 0xff);
  39939. }
  39940. function isTrueTypeFile(file) {
  39941. var header = file.peekBytes(4);
  39942. return readUint32(header, 0) === 0x00010000;
  39943. }
  39944. function isOpenTypeFile(file) {
  39945. var header = file.peekBytes(4);
  39946. return bytesToString(header) === 'OTTO';
  39947. }
  39948. function isType1File(file) {
  39949. var header = file.peekBytes(2);
  39950. if (header[0] === 0x25 && header[1] === 0x21) {
  39951. return true;
  39952. }
  39953. if (header[0] === 0x80 && header[1] === 0x01) {
  39954. return true;
  39955. }
  39956. return false;
  39957. }
  39958. function buildToFontChar(encoding, glyphsUnicodeMap, differences) {
  39959. var toFontChar = [], unicode;
  39960. for (var i = 0, ii = encoding.length; i < ii; i++) {
  39961. unicode = getUnicodeForGlyph(encoding[i], glyphsUnicodeMap);
  39962. if (unicode !== -1) {
  39963. toFontChar[i] = unicode;
  39964. }
  39965. }
  39966. for (var charCode in differences) {
  39967. unicode = getUnicodeForGlyph(differences[charCode], glyphsUnicodeMap);
  39968. if (unicode !== -1) {
  39969. toFontChar[+charCode] = unicode;
  39970. }
  39971. }
  39972. return toFontChar;
  39973. }
  39974. function isProblematicUnicodeLocation(code) {
  39975. var i = 0, j = ProblematicCharRanges.length - 1;
  39976. while (i < j) {
  39977. var c = i + j + 1 >> 1;
  39978. if (code < ProblematicCharRanges[c]) {
  39979. j = c - 1;
  39980. } else {
  39981. i = c;
  39982. }
  39983. }
  39984. return !(i & 1);
  39985. }
  39986. function adjustMapping(charCodeToGlyphId, properties) {
  39987. var toUnicode = properties.toUnicode;
  39988. var isSymbolic = !!(properties.flags & FontFlags.Symbolic);
  39989. var isIdentityUnicode = properties.toUnicode instanceof IdentityToUnicodeMap;
  39990. var newMap = Object.create(null);
  39991. var toFontChar = [];
  39992. var usedFontCharCodes = [];
  39993. var nextAvailableFontCharCode = PRIVATE_USE_OFFSET_START;
  39994. for (var originalCharCode in charCodeToGlyphId) {
  39995. originalCharCode |= 0;
  39996. var glyphId = charCodeToGlyphId[originalCharCode];
  39997. var fontCharCode = originalCharCode;
  39998. var hasUnicodeValue = false;
  39999. if (!isIdentityUnicode && toUnicode.has(originalCharCode)) {
  40000. hasUnicodeValue = true;
  40001. var unicode = toUnicode.get(fontCharCode);
  40002. if (unicode.length === 1) {
  40003. fontCharCode = unicode.charCodeAt(0);
  40004. }
  40005. }
  40006. if ((usedFontCharCodes[fontCharCode] !== undefined || isProblematicUnicodeLocation(fontCharCode) || isSymbolic && !hasUnicodeValue) && nextAvailableFontCharCode <= PRIVATE_USE_OFFSET_END) {
  40007. do {
  40008. fontCharCode = nextAvailableFontCharCode++;
  40009. if (SKIP_PRIVATE_USE_RANGE_F000_TO_F01F && fontCharCode === 0xF000) {
  40010. fontCharCode = 0xF020;
  40011. nextAvailableFontCharCode = fontCharCode + 1;
  40012. }
  40013. } while (usedFontCharCodes[fontCharCode] !== undefined && nextAvailableFontCharCode <= PRIVATE_USE_OFFSET_END);
  40014. }
  40015. newMap[fontCharCode] = glyphId;
  40016. toFontChar[originalCharCode] = fontCharCode;
  40017. usedFontCharCodes[fontCharCode] = true;
  40018. }
  40019. return {
  40020. toFontChar: toFontChar,
  40021. charCodeToGlyphId: newMap,
  40022. nextAvailableFontCharCode: nextAvailableFontCharCode
  40023. };
  40024. }
  40025. function getRanges(glyphs, numGlyphs) {
  40026. var codes = [];
  40027. for (var charCode in glyphs) {
  40028. if (glyphs[charCode] >= numGlyphs) {
  40029. continue;
  40030. }
  40031. codes.push({
  40032. fontCharCode: charCode | 0,
  40033. glyphId: glyphs[charCode]
  40034. });
  40035. }
  40036. codes.sort(function fontGetRangesSort(a, b) {
  40037. return a.fontCharCode - b.fontCharCode;
  40038. });
  40039. var ranges = [];
  40040. var length = codes.length;
  40041. for (var n = 0; n < length;) {
  40042. var start = codes[n].fontCharCode;
  40043. var codeIndices = [codes[n].glyphId];
  40044. ++n;
  40045. var end = start;
  40046. while (n < length && end + 1 === codes[n].fontCharCode) {
  40047. codeIndices.push(codes[n].glyphId);
  40048. ++end;
  40049. ++n;
  40050. if (end === 0xFFFF) {
  40051. break;
  40052. }
  40053. }
  40054. ranges.push([
  40055. start,
  40056. end,
  40057. codeIndices
  40058. ]);
  40059. }
  40060. return ranges;
  40061. }
  40062. function createCmapTable(glyphs, numGlyphs) {
  40063. var ranges = getRanges(glyphs, numGlyphs);
  40064. var numTables = ranges[ranges.length - 1][1] > 0xFFFF ? 2 : 1;
  40065. var cmap = '\x00\x00' + string16(numTables) + '\x00\x03' + '\x00\x01' + string32(4 + numTables * 8);
  40066. var i, ii, j, jj;
  40067. for (i = ranges.length - 1; i >= 0; --i) {
  40068. if (ranges[i][0] <= 0xFFFF) {
  40069. break;
  40070. }
  40071. }
  40072. var bmpLength = i + 1;
  40073. if (ranges[i][0] < 0xFFFF && ranges[i][1] === 0xFFFF) {
  40074. ranges[i][1] = 0xFFFE;
  40075. }
  40076. var trailingRangesCount = ranges[i][1] < 0xFFFF ? 1 : 0;
  40077. var segCount = bmpLength + trailingRangesCount;
  40078. var searchParams = OpenTypeFileBuilder.getSearchParams(segCount, 2);
  40079. var startCount = '';
  40080. var endCount = '';
  40081. var idDeltas = '';
  40082. var idRangeOffsets = '';
  40083. var glyphsIds = '';
  40084. var bias = 0;
  40085. var range, start, end, codes;
  40086. for (i = 0, ii = bmpLength; i < ii; i++) {
  40087. range = ranges[i];
  40088. start = range[0];
  40089. end = range[1];
  40090. startCount += string16(start);
  40091. endCount += string16(end);
  40092. codes = range[2];
  40093. var contiguous = true;
  40094. for (j = 1, jj = codes.length; j < jj; ++j) {
  40095. if (codes[j] !== codes[j - 1] + 1) {
  40096. contiguous = false;
  40097. break;
  40098. }
  40099. }
  40100. if (!contiguous) {
  40101. var offset = (segCount - i) * 2 + bias * 2;
  40102. bias += end - start + 1;
  40103. idDeltas += string16(0);
  40104. idRangeOffsets += string16(offset);
  40105. for (j = 0, jj = codes.length; j < jj; ++j) {
  40106. glyphsIds += string16(codes[j]);
  40107. }
  40108. } else {
  40109. var startCode = codes[0];
  40110. idDeltas += string16(startCode - start & 0xFFFF);
  40111. idRangeOffsets += string16(0);
  40112. }
  40113. }
  40114. if (trailingRangesCount > 0) {
  40115. endCount += '\xFF\xFF';
  40116. startCount += '\xFF\xFF';
  40117. idDeltas += '\x00\x01';
  40118. idRangeOffsets += '\x00\x00';
  40119. }
  40120. var format314 = '\x00\x00' + string16(2 * segCount) + string16(searchParams.range) + string16(searchParams.entry) + string16(searchParams.rangeShift) + endCount + '\x00\x00' + startCount + idDeltas + idRangeOffsets + glyphsIds;
  40121. var format31012 = '';
  40122. var header31012 = '';
  40123. if (numTables > 1) {
  40124. cmap += '\x00\x03' + '\x00\x0A' + string32(4 + numTables * 8 + 4 + format314.length);
  40125. format31012 = '';
  40126. for (i = 0, ii = ranges.length; i < ii; i++) {
  40127. range = ranges[i];
  40128. start = range[0];
  40129. codes = range[2];
  40130. var code = codes[0];
  40131. for (j = 1, jj = codes.length; j < jj; ++j) {
  40132. if (codes[j] !== codes[j - 1] + 1) {
  40133. end = range[0] + j - 1;
  40134. format31012 += string32(start) + string32(end) + string32(code);
  40135. start = end + 1;
  40136. code = codes[j];
  40137. }
  40138. }
  40139. format31012 += string32(start) + string32(range[1]) + string32(code);
  40140. }
  40141. header31012 = '\x00\x0C' + '\x00\x00' + string32(format31012.length + 16) + '\x00\x00\x00\x00' + string32(format31012.length / 12);
  40142. }
  40143. return cmap + '\x00\x04' + string16(format314.length + 4) + format314 + header31012 + format31012;
  40144. }
  40145. function validateOS2Table(os2) {
  40146. var stream = new Stream(os2.data);
  40147. var version = stream.getUint16();
  40148. stream.getBytes(60);
  40149. var selection = stream.getUint16();
  40150. if (version < 4 && selection & 0x0300) {
  40151. return false;
  40152. }
  40153. var firstChar = stream.getUint16();
  40154. var lastChar = stream.getUint16();
  40155. if (firstChar > lastChar) {
  40156. return false;
  40157. }
  40158. stream.getBytes(6);
  40159. var usWinAscent = stream.getUint16();
  40160. if (usWinAscent === 0) {
  40161. return false;
  40162. }
  40163. os2.data[8] = os2.data[9] = 0;
  40164. return true;
  40165. }
  40166. function createOS2Table(properties, charstrings, override) {
  40167. override = override || {
  40168. unitsPerEm: 0,
  40169. yMax: 0,
  40170. yMin: 0,
  40171. ascent: 0,
  40172. descent: 0
  40173. };
  40174. var ulUnicodeRange1 = 0;
  40175. var ulUnicodeRange2 = 0;
  40176. var ulUnicodeRange3 = 0;
  40177. var ulUnicodeRange4 = 0;
  40178. var firstCharIndex = null;
  40179. var lastCharIndex = 0;
  40180. if (charstrings) {
  40181. for (var code in charstrings) {
  40182. code |= 0;
  40183. if (firstCharIndex > code || !firstCharIndex) {
  40184. firstCharIndex = code;
  40185. }
  40186. if (lastCharIndex < code) {
  40187. lastCharIndex = code;
  40188. }
  40189. var position = getUnicodeRangeFor(code);
  40190. if (position < 32) {
  40191. ulUnicodeRange1 |= 1 << position;
  40192. } else if (position < 64) {
  40193. ulUnicodeRange2 |= 1 << position - 32;
  40194. } else if (position < 96) {
  40195. ulUnicodeRange3 |= 1 << position - 64;
  40196. } else if (position < 123) {
  40197. ulUnicodeRange4 |= 1 << position - 96;
  40198. } else {
  40199. error('Unicode ranges Bits > 123 are reserved for internal usage');
  40200. }
  40201. }
  40202. } else {
  40203. firstCharIndex = 0;
  40204. lastCharIndex = 255;
  40205. }
  40206. var bbox = properties.bbox || [
  40207. 0,
  40208. 0,
  40209. 0,
  40210. 0
  40211. ];
  40212. var unitsPerEm = override.unitsPerEm || 1 / (properties.fontMatrix || FONT_IDENTITY_MATRIX)[0];
  40213. var scale = properties.ascentScaled ? 1.0 : unitsPerEm / PDF_GLYPH_SPACE_UNITS;
  40214. var typoAscent = override.ascent || Math.round(scale * (properties.ascent || bbox[3]));
  40215. var typoDescent = override.descent || Math.round(scale * (properties.descent || bbox[1]));
  40216. if (typoDescent > 0 && properties.descent > 0 && bbox[1] < 0) {
  40217. typoDescent = -typoDescent;
  40218. }
  40219. var winAscent = override.yMax || typoAscent;
  40220. var winDescent = -override.yMin || -typoDescent;
  40221. 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';
  40222. }
  40223. function createPostTable(properties) {
  40224. var angle = Math.floor(properties.italicAngle * Math.pow(2, 16));
  40225. 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';
  40226. }
  40227. function createNameTable(name, proto) {
  40228. if (!proto) {
  40229. proto = [
  40230. [],
  40231. []
  40232. ];
  40233. }
  40234. var strings = [
  40235. proto[0][0] || 'Original licence',
  40236. proto[0][1] || name,
  40237. proto[0][2] || 'Unknown',
  40238. proto[0][3] || 'uniqueID',
  40239. proto[0][4] || name,
  40240. proto[0][5] || 'Version 0.11',
  40241. proto[0][6] || '',
  40242. proto[0][7] || 'Unknown',
  40243. proto[0][8] || 'Unknown',
  40244. proto[0][9] || 'Unknown'
  40245. ];
  40246. var stringsUnicode = [];
  40247. var i, ii, j, jj, str;
  40248. for (i = 0, ii = strings.length; i < ii; i++) {
  40249. str = proto[1][i] || strings[i];
  40250. var strBufUnicode = [];
  40251. for (j = 0, jj = str.length; j < jj; j++) {
  40252. strBufUnicode.push(string16(str.charCodeAt(j)));
  40253. }
  40254. stringsUnicode.push(strBufUnicode.join(''));
  40255. }
  40256. var names = [
  40257. strings,
  40258. stringsUnicode
  40259. ];
  40260. var platforms = [
  40261. '\x00\x01',
  40262. '\x00\x03'
  40263. ];
  40264. var encodings = [
  40265. '\x00\x00',
  40266. '\x00\x01'
  40267. ];
  40268. var languages = [
  40269. '\x00\x00',
  40270. '\x04\x09'
  40271. ];
  40272. var namesRecordCount = strings.length * platforms.length;
  40273. var nameTable = '\x00\x00' + string16(namesRecordCount) + string16(namesRecordCount * 12 + 6);
  40274. var strOffset = 0;
  40275. for (i = 0, ii = platforms.length; i < ii; i++) {
  40276. var strs = names[i];
  40277. for (j = 0, jj = strs.length; j < jj; j++) {
  40278. str = strs[j];
  40279. var nameRecord = platforms[i] + encodings[i] + languages[i] + string16(j) + string16(str.length) + string16(strOffset);
  40280. nameTable += nameRecord;
  40281. strOffset += str.length;
  40282. }
  40283. }
  40284. nameTable += strings.join('') + stringsUnicode.join('');
  40285. return nameTable;
  40286. }
  40287. Font.prototype = {
  40288. name: null,
  40289. font: null,
  40290. mimetype: null,
  40291. encoding: null,
  40292. get renderer() {
  40293. var renderer = FontRendererFactory.create(this, SEAC_ANALYSIS_ENABLED);
  40294. return shadow(this, 'renderer', renderer);
  40295. },
  40296. exportData: function Font_exportData() {
  40297. var data = {};
  40298. for (var i in this) {
  40299. if (this.hasOwnProperty(i)) {
  40300. data[i] = this[i];
  40301. }
  40302. }
  40303. return data;
  40304. },
  40305. checkAndRepair: function Font_checkAndRepair(name, font, properties) {
  40306. function readTableEntry(file) {
  40307. var tag = bytesToString(file.getBytes(4));
  40308. var checksum = file.getInt32() >>> 0;
  40309. var offset = file.getInt32() >>> 0;
  40310. var length = file.getInt32() >>> 0;
  40311. var previousPosition = file.pos;
  40312. file.pos = file.start ? file.start : 0;
  40313. file.skip(offset);
  40314. var data = file.getBytes(length);
  40315. file.pos = previousPosition;
  40316. if (tag === 'head') {
  40317. data[8] = data[9] = data[10] = data[11] = 0;
  40318. data[17] |= 0x20;
  40319. }
  40320. return {
  40321. tag: tag,
  40322. checksum: checksum,
  40323. length: length,
  40324. offset: offset,
  40325. data: data
  40326. };
  40327. }
  40328. function readOpenTypeHeader(ttf) {
  40329. return {
  40330. version: bytesToString(ttf.getBytes(4)),
  40331. numTables: ttf.getUint16(),
  40332. searchRange: ttf.getUint16(),
  40333. entrySelector: ttf.getUint16(),
  40334. rangeShift: ttf.getUint16()
  40335. };
  40336. }
  40337. function readCmapTable(cmap, font, isSymbolicFont, hasEncoding) {
  40338. if (!cmap) {
  40339. warn('No cmap table available.');
  40340. return {
  40341. platformId: -1,
  40342. encodingId: -1,
  40343. mappings: [],
  40344. hasShortCmap: false
  40345. };
  40346. }
  40347. var segment;
  40348. var start = (font.start ? font.start : 0) + cmap.offset;
  40349. font.pos = start;
  40350. font.getUint16();
  40351. var numTables = font.getUint16();
  40352. var potentialTable;
  40353. var canBreak = false;
  40354. for (var i = 0; i < numTables; i++) {
  40355. var platformId = font.getUint16();
  40356. var encodingId = font.getUint16();
  40357. var offset = font.getInt32() >>> 0;
  40358. var useTable = false;
  40359. if (platformId === 0 && encodingId === 0) {
  40360. useTable = true;
  40361. } else if (platformId === 1 && encodingId === 0) {
  40362. useTable = true;
  40363. } else if (platformId === 3 && encodingId === 1 && (hasEncoding || !potentialTable)) {
  40364. useTable = true;
  40365. if (!isSymbolicFont) {
  40366. canBreak = true;
  40367. }
  40368. } else if (isSymbolicFont && platformId === 3 && encodingId === 0) {
  40369. useTable = true;
  40370. canBreak = true;
  40371. }
  40372. if (useTable) {
  40373. potentialTable = {
  40374. platformId: platformId,
  40375. encodingId: encodingId,
  40376. offset: offset
  40377. };
  40378. }
  40379. if (canBreak) {
  40380. break;
  40381. }
  40382. }
  40383. if (potentialTable) {
  40384. font.pos = start + potentialTable.offset;
  40385. }
  40386. if (!potentialTable || font.peekByte() === -1) {
  40387. warn('Could not find a preferred cmap table.');
  40388. return {
  40389. platformId: -1,
  40390. encodingId: -1,
  40391. mappings: [],
  40392. hasShortCmap: false
  40393. };
  40394. }
  40395. var format = font.getUint16();
  40396. font.getUint16();
  40397. font.getUint16();
  40398. var hasShortCmap = false;
  40399. var mappings = [];
  40400. var j, glyphId;
  40401. if (format === 0) {
  40402. for (j = 0; j < 256; j++) {
  40403. var index = font.getByte();
  40404. if (!index) {
  40405. continue;
  40406. }
  40407. mappings.push({
  40408. charCode: j,
  40409. glyphId: index
  40410. });
  40411. }
  40412. hasShortCmap = true;
  40413. } else if (format === 4) {
  40414. var segCount = font.getUint16() >> 1;
  40415. font.getBytes(6);
  40416. var segIndex, segments = [];
  40417. for (segIndex = 0; segIndex < segCount; segIndex++) {
  40418. segments.push({ end: font.getUint16() });
  40419. }
  40420. font.getUint16();
  40421. for (segIndex = 0; segIndex < segCount; segIndex++) {
  40422. segments[segIndex].start = font.getUint16();
  40423. }
  40424. for (segIndex = 0; segIndex < segCount; segIndex++) {
  40425. segments[segIndex].delta = font.getUint16();
  40426. }
  40427. var offsetsCount = 0;
  40428. for (segIndex = 0; segIndex < segCount; segIndex++) {
  40429. segment = segments[segIndex];
  40430. var rangeOffset = font.getUint16();
  40431. if (!rangeOffset) {
  40432. segment.offsetIndex = -1;
  40433. continue;
  40434. }
  40435. var offsetIndex = (rangeOffset >> 1) - (segCount - segIndex);
  40436. segment.offsetIndex = offsetIndex;
  40437. offsetsCount = Math.max(offsetsCount, offsetIndex + segment.end - segment.start + 1);
  40438. }
  40439. var offsets = [];
  40440. for (j = 0; j < offsetsCount; j++) {
  40441. offsets.push(font.getUint16());
  40442. }
  40443. for (segIndex = 0; segIndex < segCount; segIndex++) {
  40444. segment = segments[segIndex];
  40445. start = segment.start;
  40446. var end = segment.end;
  40447. var delta = segment.delta;
  40448. offsetIndex = segment.offsetIndex;
  40449. for (j = start; j <= end; j++) {
  40450. if (j === 0xFFFF) {
  40451. continue;
  40452. }
  40453. glyphId = offsetIndex < 0 ? j : offsets[offsetIndex + j - start];
  40454. glyphId = glyphId + delta & 0xFFFF;
  40455. if (glyphId === 0) {
  40456. continue;
  40457. }
  40458. mappings.push({
  40459. charCode: j,
  40460. glyphId: glyphId
  40461. });
  40462. }
  40463. }
  40464. } else if (format === 6) {
  40465. var firstCode = font.getUint16();
  40466. var entryCount = font.getUint16();
  40467. for (j = 0; j < entryCount; j++) {
  40468. glyphId = font.getUint16();
  40469. var charCode = firstCode + j;
  40470. mappings.push({
  40471. charCode: charCode,
  40472. glyphId: glyphId
  40473. });
  40474. }
  40475. } else {
  40476. warn('cmap table has unsupported format: ' + format);
  40477. return {
  40478. platformId: -1,
  40479. encodingId: -1,
  40480. mappings: [],
  40481. hasShortCmap: false
  40482. };
  40483. }
  40484. mappings.sort(function (a, b) {
  40485. return a.charCode - b.charCode;
  40486. });
  40487. for (i = 1; i < mappings.length; i++) {
  40488. if (mappings[i - 1].charCode === mappings[i].charCode) {
  40489. mappings.splice(i, 1);
  40490. i--;
  40491. }
  40492. }
  40493. return {
  40494. platformId: potentialTable.platformId,
  40495. encodingId: potentialTable.encodingId,
  40496. mappings: mappings,
  40497. hasShortCmap: hasShortCmap
  40498. };
  40499. }
  40500. function sanitizeMetrics(font, header, metrics, numGlyphs) {
  40501. if (!header) {
  40502. if (metrics) {
  40503. metrics.data = null;
  40504. }
  40505. return;
  40506. }
  40507. font.pos = (font.start ? font.start : 0) + header.offset;
  40508. font.pos += header.length - 2;
  40509. var numOfMetrics = font.getUint16();
  40510. if (numOfMetrics > numGlyphs) {
  40511. info('The numOfMetrics (' + numOfMetrics + ') should not be ' + 'greater than the numGlyphs (' + numGlyphs + ')');
  40512. numOfMetrics = numGlyphs;
  40513. header.data[34] = (numOfMetrics & 0xff00) >> 8;
  40514. header.data[35] = numOfMetrics & 0x00ff;
  40515. }
  40516. var numOfSidebearings = numGlyphs - numOfMetrics;
  40517. var numMissing = numOfSidebearings - (metrics.length - numOfMetrics * 4 >> 1);
  40518. if (numMissing > 0) {
  40519. var entries = new Uint8Array(metrics.length + numMissing * 2);
  40520. entries.set(metrics.data);
  40521. metrics.data = entries;
  40522. }
  40523. }
  40524. function sanitizeGlyph(source, sourceStart, sourceEnd, dest, destStart, hintsValid) {
  40525. if (sourceEnd - sourceStart <= 12) {
  40526. return 0;
  40527. }
  40528. var glyf = source.subarray(sourceStart, sourceEnd);
  40529. var contoursCount = glyf[0] << 8 | glyf[1];
  40530. if (contoursCount & 0x8000) {
  40531. dest.set(glyf, destStart);
  40532. return glyf.length;
  40533. }
  40534. var i, j = 10, flagsCount = 0;
  40535. for (i = 0; i < contoursCount; i++) {
  40536. var endPoint = glyf[j] << 8 | glyf[j + 1];
  40537. flagsCount = endPoint + 1;
  40538. j += 2;
  40539. }
  40540. var instructionsStart = j;
  40541. var instructionsLength = glyf[j] << 8 | glyf[j + 1];
  40542. j += 2 + instructionsLength;
  40543. var instructionsEnd = j;
  40544. var coordinatesLength = 0;
  40545. for (i = 0; i < flagsCount; i++) {
  40546. var flag = glyf[j++];
  40547. if (flag & 0xC0) {
  40548. glyf[j - 1] = flag & 0x3F;
  40549. }
  40550. var xyLength = (flag & 2 ? 1 : flag & 16 ? 0 : 2) + (flag & 4 ? 1 : flag & 32 ? 0 : 2);
  40551. coordinatesLength += xyLength;
  40552. if (flag & 8) {
  40553. var repeat = glyf[j++];
  40554. i += repeat;
  40555. coordinatesLength += repeat * xyLength;
  40556. }
  40557. }
  40558. if (coordinatesLength === 0) {
  40559. return 0;
  40560. }
  40561. var glyphDataLength = j + coordinatesLength;
  40562. if (glyphDataLength > glyf.length) {
  40563. return 0;
  40564. }
  40565. if (!hintsValid && instructionsLength > 0) {
  40566. dest.set(glyf.subarray(0, instructionsStart), destStart);
  40567. dest.set([
  40568. 0,
  40569. 0
  40570. ], destStart + instructionsStart);
  40571. dest.set(glyf.subarray(instructionsEnd, glyphDataLength), destStart + instructionsStart + 2);
  40572. glyphDataLength -= instructionsLength;
  40573. if (glyf.length - glyphDataLength > 3) {
  40574. glyphDataLength = glyphDataLength + 3 & ~3;
  40575. }
  40576. return glyphDataLength;
  40577. }
  40578. if (glyf.length - glyphDataLength > 3) {
  40579. glyphDataLength = glyphDataLength + 3 & ~3;
  40580. dest.set(glyf.subarray(0, glyphDataLength), destStart);
  40581. return glyphDataLength;
  40582. }
  40583. dest.set(glyf, destStart);
  40584. return glyf.length;
  40585. }
  40586. function sanitizeHead(head, numGlyphs, locaLength) {
  40587. var data = head.data;
  40588. var version = int32(data[0], data[1], data[2], data[3]);
  40589. if (version >> 16 !== 1) {
  40590. info('Attempting to fix invalid version in head table: ' + version);
  40591. data[0] = 0;
  40592. data[1] = 1;
  40593. data[2] = 0;
  40594. data[3] = 0;
  40595. }
  40596. var indexToLocFormat = int16(data[50], data[51]);
  40597. if (indexToLocFormat < 0 || indexToLocFormat > 1) {
  40598. info('Attempting to fix invalid indexToLocFormat in head table: ' + indexToLocFormat);
  40599. var numGlyphsPlusOne = numGlyphs + 1;
  40600. if (locaLength === numGlyphsPlusOne << 1) {
  40601. data[50] = 0;
  40602. data[51] = 0;
  40603. } else if (locaLength === numGlyphsPlusOne << 2) {
  40604. data[50] = 0;
  40605. data[51] = 1;
  40606. } else {
  40607. warn('Could not fix indexToLocFormat: ' + indexToLocFormat);
  40608. }
  40609. }
  40610. }
  40611. function sanitizeGlyphLocations(loca, glyf, numGlyphs, isGlyphLocationsLong, hintsValid, dupFirstEntry) {
  40612. var itemSize, itemDecode, itemEncode;
  40613. if (isGlyphLocationsLong) {
  40614. itemSize = 4;
  40615. itemDecode = function fontItemDecodeLong(data, offset) {
  40616. return data[offset] << 24 | data[offset + 1] << 16 | data[offset + 2] << 8 | data[offset + 3];
  40617. };
  40618. itemEncode = function fontItemEncodeLong(data, offset, value) {
  40619. data[offset] = value >>> 24 & 0xFF;
  40620. data[offset + 1] = value >> 16 & 0xFF;
  40621. data[offset + 2] = value >> 8 & 0xFF;
  40622. data[offset + 3] = value & 0xFF;
  40623. };
  40624. } else {
  40625. itemSize = 2;
  40626. itemDecode = function fontItemDecode(data, offset) {
  40627. return data[offset] << 9 | data[offset + 1] << 1;
  40628. };
  40629. itemEncode = function fontItemEncode(data, offset, value) {
  40630. data[offset] = value >> 9 & 0xFF;
  40631. data[offset + 1] = value >> 1 & 0xFF;
  40632. };
  40633. }
  40634. var locaData = loca.data;
  40635. var locaDataSize = itemSize * (1 + numGlyphs);
  40636. if (locaData.length !== locaDataSize) {
  40637. locaData = new Uint8Array(locaDataSize);
  40638. locaData.set(loca.data.subarray(0, locaDataSize));
  40639. loca.data = locaData;
  40640. }
  40641. var oldGlyfData = glyf.data;
  40642. var oldGlyfDataLength = oldGlyfData.length;
  40643. var newGlyfData = new Uint8Array(oldGlyfDataLength);
  40644. var startOffset = itemDecode(locaData, 0);
  40645. var writeOffset = 0;
  40646. var missingGlyphData = Object.create(null);
  40647. itemEncode(locaData, 0, writeOffset);
  40648. var i, j;
  40649. for (i = 0, j = itemSize; i < numGlyphs; i++, j += itemSize) {
  40650. var endOffset = itemDecode(locaData, j);
  40651. if (endOffset > oldGlyfDataLength && (oldGlyfDataLength + 3 & ~3) === endOffset) {
  40652. endOffset = oldGlyfDataLength;
  40653. }
  40654. if (endOffset > oldGlyfDataLength) {
  40655. itemEncode(locaData, j, writeOffset);
  40656. startOffset = endOffset;
  40657. continue;
  40658. }
  40659. if (startOffset === endOffset) {
  40660. missingGlyphData[i] = true;
  40661. }
  40662. var newLength = sanitizeGlyph(oldGlyfData, startOffset, endOffset, newGlyfData, writeOffset, hintsValid);
  40663. writeOffset += newLength;
  40664. itemEncode(locaData, j, writeOffset);
  40665. startOffset = endOffset;
  40666. }
  40667. if (writeOffset === 0) {
  40668. var simpleGlyph = new Uint8Array([
  40669. 0,
  40670. 1,
  40671. 0,
  40672. 0,
  40673. 0,
  40674. 0,
  40675. 0,
  40676. 0,
  40677. 0,
  40678. 0,
  40679. 0,
  40680. 0,
  40681. 0,
  40682. 0,
  40683. 49,
  40684. 0
  40685. ]);
  40686. for (i = 0, j = itemSize; i < numGlyphs; i++, j += itemSize) {
  40687. itemEncode(locaData, j, simpleGlyph.length);
  40688. }
  40689. glyf.data = simpleGlyph;
  40690. return missingGlyphData;
  40691. }
  40692. if (dupFirstEntry) {
  40693. var firstEntryLength = itemDecode(locaData, itemSize);
  40694. if (newGlyfData.length > firstEntryLength + writeOffset) {
  40695. glyf.data = newGlyfData.subarray(0, firstEntryLength + writeOffset);
  40696. } else {
  40697. glyf.data = new Uint8Array(firstEntryLength + writeOffset);
  40698. glyf.data.set(newGlyfData.subarray(0, writeOffset));
  40699. }
  40700. glyf.data.set(newGlyfData.subarray(0, firstEntryLength), writeOffset);
  40701. itemEncode(loca.data, locaData.length - itemSize, writeOffset + firstEntryLength);
  40702. } else {
  40703. glyf.data = newGlyfData.subarray(0, writeOffset);
  40704. }
  40705. return missingGlyphData;
  40706. }
  40707. function readPostScriptTable(post, properties, maxpNumGlyphs) {
  40708. var start = (font.start ? font.start : 0) + post.offset;
  40709. font.pos = start;
  40710. var length = post.length, end = start + length;
  40711. var version = font.getInt32();
  40712. font.getBytes(28);
  40713. var glyphNames;
  40714. var valid = true;
  40715. var i;
  40716. switch (version) {
  40717. case 0x00010000:
  40718. glyphNames = MacStandardGlyphOrdering;
  40719. break;
  40720. case 0x00020000:
  40721. var numGlyphs = font.getUint16();
  40722. if (numGlyphs !== maxpNumGlyphs) {
  40723. valid = false;
  40724. break;
  40725. }
  40726. var glyphNameIndexes = [];
  40727. for (i = 0; i < numGlyphs; ++i) {
  40728. var index = font.getUint16();
  40729. if (index >= 32768) {
  40730. valid = false;
  40731. break;
  40732. }
  40733. glyphNameIndexes.push(index);
  40734. }
  40735. if (!valid) {
  40736. break;
  40737. }
  40738. var customNames = [];
  40739. var strBuf = [];
  40740. while (font.pos < end) {
  40741. var stringLength = font.getByte();
  40742. strBuf.length = stringLength;
  40743. for (i = 0; i < stringLength; ++i) {
  40744. strBuf[i] = String.fromCharCode(font.getByte());
  40745. }
  40746. customNames.push(strBuf.join(''));
  40747. }
  40748. glyphNames = [];
  40749. for (i = 0; i < numGlyphs; ++i) {
  40750. var j = glyphNameIndexes[i];
  40751. if (j < 258) {
  40752. glyphNames.push(MacStandardGlyphOrdering[j]);
  40753. continue;
  40754. }
  40755. glyphNames.push(customNames[j - 258]);
  40756. }
  40757. break;
  40758. case 0x00030000:
  40759. break;
  40760. default:
  40761. warn('Unknown/unsupported post table version ' + version);
  40762. valid = false;
  40763. if (properties.defaultEncoding) {
  40764. glyphNames = properties.defaultEncoding;
  40765. }
  40766. break;
  40767. }
  40768. properties.glyphNames = glyphNames;
  40769. return valid;
  40770. }
  40771. function readNameTable(nameTable) {
  40772. var start = (font.start ? font.start : 0) + nameTable.offset;
  40773. font.pos = start;
  40774. var names = [
  40775. [],
  40776. []
  40777. ];
  40778. var length = nameTable.length, end = start + length;
  40779. var format = font.getUint16();
  40780. var FORMAT_0_HEADER_LENGTH = 6;
  40781. if (format !== 0 || length < FORMAT_0_HEADER_LENGTH) {
  40782. return names;
  40783. }
  40784. var numRecords = font.getUint16();
  40785. var stringsStart = font.getUint16();
  40786. var records = [];
  40787. var NAME_RECORD_LENGTH = 12;
  40788. var i, ii;
  40789. for (i = 0; i < numRecords && font.pos + NAME_RECORD_LENGTH <= end; i++) {
  40790. var r = {
  40791. platform: font.getUint16(),
  40792. encoding: font.getUint16(),
  40793. language: font.getUint16(),
  40794. name: font.getUint16(),
  40795. length: font.getUint16(),
  40796. offset: font.getUint16()
  40797. };
  40798. if (r.platform === 1 && r.encoding === 0 && r.language === 0 || r.platform === 3 && r.encoding === 1 && r.language === 0x409) {
  40799. records.push(r);
  40800. }
  40801. }
  40802. for (i = 0, ii = records.length; i < ii; i++) {
  40803. var record = records[i];
  40804. if (record.length <= 0) {
  40805. continue;
  40806. }
  40807. var pos = start + stringsStart + record.offset;
  40808. if (pos + record.length > end) {
  40809. continue;
  40810. }
  40811. font.pos = pos;
  40812. var nameIndex = record.name;
  40813. if (record.encoding) {
  40814. var str = '';
  40815. for (var j = 0, jj = record.length; j < jj; j += 2) {
  40816. str += String.fromCharCode(font.getUint16());
  40817. }
  40818. names[1][nameIndex] = str;
  40819. } else {
  40820. names[0][nameIndex] = bytesToString(font.getBytes(record.length));
  40821. }
  40822. }
  40823. return names;
  40824. }
  40825. var TTOpsStackDeltas = [
  40826. 0,
  40827. 0,
  40828. 0,
  40829. 0,
  40830. 0,
  40831. 0,
  40832. 0,
  40833. 0,
  40834. -2,
  40835. -2,
  40836. -2,
  40837. -2,
  40838. 0,
  40839. 0,
  40840. -2,
  40841. -5,
  40842. -1,
  40843. -1,
  40844. -1,
  40845. -1,
  40846. -1,
  40847. -1,
  40848. -1,
  40849. -1,
  40850. 0,
  40851. 0,
  40852. -1,
  40853. 0,
  40854. -1,
  40855. -1,
  40856. -1,
  40857. -1,
  40858. 1,
  40859. -1,
  40860. -999,
  40861. 0,
  40862. 1,
  40863. 0,
  40864. -1,
  40865. -2,
  40866. 0,
  40867. -1,
  40868. -2,
  40869. -1,
  40870. -1,
  40871. 0,
  40872. -1,
  40873. -1,
  40874. 0,
  40875. 0,
  40876. -999,
  40877. -999,
  40878. -1,
  40879. -1,
  40880. -1,
  40881. -1,
  40882. -2,
  40883. -999,
  40884. -2,
  40885. -2,
  40886. -999,
  40887. 0,
  40888. -2,
  40889. -2,
  40890. 0,
  40891. 0,
  40892. -2,
  40893. 0,
  40894. -2,
  40895. 0,
  40896. 0,
  40897. 0,
  40898. -2,
  40899. -1,
  40900. -1,
  40901. 1,
  40902. 1,
  40903. 0,
  40904. 0,
  40905. -1,
  40906. -1,
  40907. -1,
  40908. -1,
  40909. -1,
  40910. -1,
  40911. -1,
  40912. 0,
  40913. 0,
  40914. -1,
  40915. 0,
  40916. -1,
  40917. -1,
  40918. 0,
  40919. -999,
  40920. -1,
  40921. -1,
  40922. -1,
  40923. -1,
  40924. -1,
  40925. -1,
  40926. 0,
  40927. 0,
  40928. 0,
  40929. 0,
  40930. 0,
  40931. 0,
  40932. 0,
  40933. 0,
  40934. 0,
  40935. 0,
  40936. 0,
  40937. 0,
  40938. -2,
  40939. -999,
  40940. -999,
  40941. -999,
  40942. -999,
  40943. -999,
  40944. -1,
  40945. -1,
  40946. -2,
  40947. -2,
  40948. 0,
  40949. 0,
  40950. 0,
  40951. 0,
  40952. -1,
  40953. -1,
  40954. -999,
  40955. -2,
  40956. -2,
  40957. 0,
  40958. 0,
  40959. -1,
  40960. -2,
  40961. -2,
  40962. 0,
  40963. 0,
  40964. 0,
  40965. -1,
  40966. -1,
  40967. -1,
  40968. -2
  40969. ];
  40970. function sanitizeTTProgram(table, ttContext) {
  40971. var data = table.data;
  40972. var i = 0, j, n, b, funcId, pc, lastEndf = 0, lastDeff = 0;
  40973. var stack = [];
  40974. var callstack = [];
  40975. var functionsCalled = [];
  40976. var tooComplexToFollowFunctions = ttContext.tooComplexToFollowFunctions;
  40977. var inFDEF = false, ifLevel = 0, inELSE = 0;
  40978. for (var ii = data.length; i < ii;) {
  40979. var op = data[i++];
  40980. if (op === 0x40) {
  40981. n = data[i++];
  40982. if (inFDEF || inELSE) {
  40983. i += n;
  40984. } else {
  40985. for (j = 0; j < n; j++) {
  40986. stack.push(data[i++]);
  40987. }
  40988. }
  40989. } else if (op === 0x41) {
  40990. n = data[i++];
  40991. if (inFDEF || inELSE) {
  40992. i += n * 2;
  40993. } else {
  40994. for (j = 0; j < n; j++) {
  40995. b = data[i++];
  40996. stack.push(b << 8 | data[i++]);
  40997. }
  40998. }
  40999. } else if ((op & 0xF8) === 0xB0) {
  41000. n = op - 0xB0 + 1;
  41001. if (inFDEF || inELSE) {
  41002. i += n;
  41003. } else {
  41004. for (j = 0; j < n; j++) {
  41005. stack.push(data[i++]);
  41006. }
  41007. }
  41008. } else if ((op & 0xF8) === 0xB8) {
  41009. n = op - 0xB8 + 1;
  41010. if (inFDEF || inELSE) {
  41011. i += n * 2;
  41012. } else {
  41013. for (j = 0; j < n; j++) {
  41014. b = data[i++];
  41015. stack.push(b << 8 | data[i++]);
  41016. }
  41017. }
  41018. } else if (op === 0x2B && !tooComplexToFollowFunctions) {
  41019. if (!inFDEF && !inELSE) {
  41020. funcId = stack[stack.length - 1];
  41021. ttContext.functionsUsed[funcId] = true;
  41022. if (funcId in ttContext.functionsStackDeltas) {
  41023. stack.length += ttContext.functionsStackDeltas[funcId];
  41024. } else if (funcId in ttContext.functionsDefined && functionsCalled.indexOf(funcId) < 0) {
  41025. callstack.push({
  41026. data: data,
  41027. i: i,
  41028. stackTop: stack.length - 1
  41029. });
  41030. functionsCalled.push(funcId);
  41031. pc = ttContext.functionsDefined[funcId];
  41032. if (!pc) {
  41033. warn('TT: CALL non-existent function');
  41034. ttContext.hintsValid = false;
  41035. return;
  41036. }
  41037. data = pc.data;
  41038. i = pc.i;
  41039. }
  41040. }
  41041. } else if (op === 0x2C && !tooComplexToFollowFunctions) {
  41042. if (inFDEF || inELSE) {
  41043. warn('TT: nested FDEFs not allowed');
  41044. tooComplexToFollowFunctions = true;
  41045. }
  41046. inFDEF = true;
  41047. lastDeff = i;
  41048. funcId = stack.pop();
  41049. ttContext.functionsDefined[funcId] = {
  41050. data: data,
  41051. i: i
  41052. };
  41053. } else if (op === 0x2D) {
  41054. if (inFDEF) {
  41055. inFDEF = false;
  41056. lastEndf = i;
  41057. } else {
  41058. pc = callstack.pop();
  41059. if (!pc) {
  41060. warn('TT: ENDF bad stack');
  41061. ttContext.hintsValid = false;
  41062. return;
  41063. }
  41064. funcId = functionsCalled.pop();
  41065. data = pc.data;
  41066. i = pc.i;
  41067. ttContext.functionsStackDeltas[funcId] = stack.length - pc.stackTop;
  41068. }
  41069. } else if (op === 0x89) {
  41070. if (inFDEF || inELSE) {
  41071. warn('TT: nested IDEFs not allowed');
  41072. tooComplexToFollowFunctions = true;
  41073. }
  41074. inFDEF = true;
  41075. lastDeff = i;
  41076. } else if (op === 0x58) {
  41077. ++ifLevel;
  41078. } else if (op === 0x1B) {
  41079. inELSE = ifLevel;
  41080. } else if (op === 0x59) {
  41081. if (inELSE === ifLevel) {
  41082. inELSE = 0;
  41083. }
  41084. --ifLevel;
  41085. } else if (op === 0x1C) {
  41086. if (!inFDEF && !inELSE) {
  41087. var offset = stack[stack.length - 1];
  41088. if (offset > 0) {
  41089. i += offset - 1;
  41090. }
  41091. }
  41092. }
  41093. if (!inFDEF && !inELSE) {
  41094. var stackDelta = op <= 0x8E ? TTOpsStackDeltas[op] : op >= 0xC0 && op <= 0xDF ? -1 : op >= 0xE0 ? -2 : 0;
  41095. if (op >= 0x71 && op <= 0x75) {
  41096. n = stack.pop();
  41097. if (!isNaN(n)) {
  41098. stackDelta = -n * 2;
  41099. }
  41100. }
  41101. while (stackDelta < 0 && stack.length > 0) {
  41102. stack.pop();
  41103. stackDelta++;
  41104. }
  41105. while (stackDelta > 0) {
  41106. stack.push(NaN);
  41107. stackDelta--;
  41108. }
  41109. }
  41110. }
  41111. ttContext.tooComplexToFollowFunctions = tooComplexToFollowFunctions;
  41112. var content = [data];
  41113. if (i > data.length) {
  41114. content.push(new Uint8Array(i - data.length));
  41115. }
  41116. if (lastDeff > lastEndf) {
  41117. warn('TT: complementing a missing function tail');
  41118. content.push(new Uint8Array([
  41119. 0x22,
  41120. 0x2D
  41121. ]));
  41122. }
  41123. foldTTTable(table, content);
  41124. }
  41125. function checkInvalidFunctions(ttContext, maxFunctionDefs) {
  41126. if (ttContext.tooComplexToFollowFunctions) {
  41127. return;
  41128. }
  41129. if (ttContext.functionsDefined.length > maxFunctionDefs) {
  41130. warn('TT: more functions defined than expected');
  41131. ttContext.hintsValid = false;
  41132. return;
  41133. }
  41134. for (var j = 0, jj = ttContext.functionsUsed.length; j < jj; j++) {
  41135. if (j > maxFunctionDefs) {
  41136. warn('TT: invalid function id: ' + j);
  41137. ttContext.hintsValid = false;
  41138. return;
  41139. }
  41140. if (ttContext.functionsUsed[j] && !ttContext.functionsDefined[j]) {
  41141. warn('TT: undefined function: ' + j);
  41142. ttContext.hintsValid = false;
  41143. return;
  41144. }
  41145. }
  41146. }
  41147. function foldTTTable(table, content) {
  41148. if (content.length > 1) {
  41149. var newLength = 0;
  41150. var j, jj;
  41151. for (j = 0, jj = content.length; j < jj; j++) {
  41152. newLength += content[j].length;
  41153. }
  41154. newLength = newLength + 3 & ~3;
  41155. var result = new Uint8Array(newLength);
  41156. var pos = 0;
  41157. for (j = 0, jj = content.length; j < jj; j++) {
  41158. result.set(content[j], pos);
  41159. pos += content[j].length;
  41160. }
  41161. table.data = result;
  41162. table.length = newLength;
  41163. }
  41164. }
  41165. function sanitizeTTPrograms(fpgm, prep, cvt, maxFunctionDefs) {
  41166. var ttContext = {
  41167. functionsDefined: [],
  41168. functionsUsed: [],
  41169. functionsStackDeltas: [],
  41170. tooComplexToFollowFunctions: false,
  41171. hintsValid: true
  41172. };
  41173. if (fpgm) {
  41174. sanitizeTTProgram(fpgm, ttContext);
  41175. }
  41176. if (prep) {
  41177. sanitizeTTProgram(prep, ttContext);
  41178. }
  41179. if (fpgm) {
  41180. checkInvalidFunctions(ttContext, maxFunctionDefs);
  41181. }
  41182. if (cvt && cvt.length & 1) {
  41183. var cvtData = new Uint8Array(cvt.length + 1);
  41184. cvtData.set(cvt.data);
  41185. cvt.data = cvtData;
  41186. }
  41187. return ttContext.hintsValid;
  41188. }
  41189. font = new Stream(new Uint8Array(font.getBytes()));
  41190. var VALID_TABLES = [
  41191. 'OS/2',
  41192. 'cmap',
  41193. 'head',
  41194. 'hhea',
  41195. 'hmtx',
  41196. 'maxp',
  41197. 'name',
  41198. 'post',
  41199. 'loca',
  41200. 'glyf',
  41201. 'fpgm',
  41202. 'prep',
  41203. 'cvt ',
  41204. 'CFF '
  41205. ];
  41206. var header = readOpenTypeHeader(font);
  41207. var numTables = header.numTables;
  41208. var cff, cffFile;
  41209. var tables = Object.create(null);
  41210. tables['OS/2'] = null;
  41211. tables['cmap'] = null;
  41212. tables['head'] = null;
  41213. tables['hhea'] = null;
  41214. tables['hmtx'] = null;
  41215. tables['maxp'] = null;
  41216. tables['name'] = null;
  41217. tables['post'] = null;
  41218. var table;
  41219. for (var i = 0; i < numTables; i++) {
  41220. table = readTableEntry(font);
  41221. if (VALID_TABLES.indexOf(table.tag) < 0) {
  41222. continue;
  41223. }
  41224. if (table.length === 0) {
  41225. continue;
  41226. }
  41227. tables[table.tag] = table;
  41228. }
  41229. var isTrueType = !tables['CFF '];
  41230. if (!isTrueType) {
  41231. if (header.version === 'OTTO' && !properties.composite || !tables['head'] || !tables['hhea'] || !tables['maxp'] || !tables['post']) {
  41232. cffFile = new Stream(tables['CFF '].data);
  41233. cff = new CFFFont(cffFile, properties);
  41234. adjustWidths(properties);
  41235. return this.convert(name, cff, properties);
  41236. }
  41237. delete tables['glyf'];
  41238. delete tables['loca'];
  41239. delete tables['fpgm'];
  41240. delete tables['prep'];
  41241. delete tables['cvt '];
  41242. this.isOpenType = true;
  41243. } else {
  41244. if (!tables['loca']) {
  41245. error('Required "loca" table is not found');
  41246. }
  41247. if (!tables['glyf']) {
  41248. warn('Required "glyf" table is not found -- trying to recover.');
  41249. tables['glyf'] = {
  41250. tag: 'glyf',
  41251. data: new Uint8Array(0)
  41252. };
  41253. }
  41254. this.isOpenType = false;
  41255. }
  41256. if (!tables['maxp']) {
  41257. error('Required "maxp" table is not found');
  41258. }
  41259. font.pos = (font.start || 0) + tables['maxp'].offset;
  41260. var version = font.getInt32();
  41261. var numGlyphs = font.getUint16();
  41262. var maxFunctionDefs = 0;
  41263. if (version >= 0x00010000 && tables['maxp'].length >= 22) {
  41264. font.pos += 8;
  41265. var maxZones = font.getUint16();
  41266. if (maxZones > 2) {
  41267. tables['maxp'].data[14] = 0;
  41268. tables['maxp'].data[15] = 2;
  41269. }
  41270. font.pos += 4;
  41271. maxFunctionDefs = font.getUint16();
  41272. }
  41273. var dupFirstEntry = false;
  41274. if (properties.type === 'CIDFontType2' && properties.toUnicode && properties.toUnicode.get(0) > '\u0000') {
  41275. dupFirstEntry = true;
  41276. numGlyphs++;
  41277. tables['maxp'].data[4] = numGlyphs >> 8;
  41278. tables['maxp'].data[5] = numGlyphs & 255;
  41279. }
  41280. var hintsValid = sanitizeTTPrograms(tables['fpgm'], tables['prep'], tables['cvt '], maxFunctionDefs);
  41281. if (!hintsValid) {
  41282. delete tables['fpgm'];
  41283. delete tables['prep'];
  41284. delete tables['cvt '];
  41285. }
  41286. sanitizeMetrics(font, tables['hhea'], tables['hmtx'], numGlyphs);
  41287. if (!tables['head']) {
  41288. error('Required "head" table is not found');
  41289. }
  41290. sanitizeHead(tables['head'], numGlyphs, isTrueType ? tables['loca'].length : 0);
  41291. var missingGlyphs = Object.create(null);
  41292. if (isTrueType) {
  41293. var isGlyphLocationsLong = int16(tables['head'].data[50], tables['head'].data[51]);
  41294. missingGlyphs = sanitizeGlyphLocations(tables['loca'], tables['glyf'], numGlyphs, isGlyphLocationsLong, hintsValid, dupFirstEntry);
  41295. }
  41296. if (!tables['hhea']) {
  41297. error('Required "hhea" table is not found');
  41298. }
  41299. if (tables['hhea'].data[10] === 0 && tables['hhea'].data[11] === 0) {
  41300. tables['hhea'].data[10] = 0xFF;
  41301. tables['hhea'].data[11] = 0xFF;
  41302. }
  41303. var metricsOverride = {
  41304. unitsPerEm: int16(tables['head'].data[18], tables['head'].data[19]),
  41305. yMax: int16(tables['head'].data[42], tables['head'].data[43]),
  41306. yMin: signedInt16(tables['head'].data[38], tables['head'].data[39]),
  41307. ascent: int16(tables['hhea'].data[4], tables['hhea'].data[5]),
  41308. descent: signedInt16(tables['hhea'].data[6], tables['hhea'].data[7])
  41309. };
  41310. this.ascent = metricsOverride.ascent / metricsOverride.unitsPerEm;
  41311. this.descent = metricsOverride.descent / metricsOverride.unitsPerEm;
  41312. if (tables['post']) {
  41313. var valid = readPostScriptTable(tables['post'], properties, numGlyphs);
  41314. if (!valid) {
  41315. tables['post'] = null;
  41316. }
  41317. }
  41318. var charCodeToGlyphId = [], charCode;
  41319. var toUnicode = properties.toUnicode, widths = properties.widths;
  41320. var skipToUnicode = toUnicode instanceof IdentityToUnicodeMap || toUnicode.length === 0x10000;
  41321. function hasGlyph(glyphId, charCode, widthCode) {
  41322. if (!missingGlyphs[glyphId]) {
  41323. return true;
  41324. }
  41325. if (!skipToUnicode && charCode >= 0 && toUnicode.has(charCode)) {
  41326. return true;
  41327. }
  41328. if (widths && widthCode >= 0 && isNum(widths[widthCode])) {
  41329. return true;
  41330. }
  41331. return false;
  41332. }
  41333. if (properties.composite) {
  41334. var cidToGidMap = properties.cidToGidMap || [];
  41335. var isCidToGidMapEmpty = cidToGidMap.length === 0;
  41336. properties.cMap.forEach(function (charCode, cid) {
  41337. assert(cid <= 0xffff, 'Max size of CID is 65,535');
  41338. var glyphId = -1;
  41339. if (isCidToGidMapEmpty) {
  41340. glyphId = cid;
  41341. } else if (cidToGidMap[cid] !== undefined) {
  41342. glyphId = cidToGidMap[cid];
  41343. }
  41344. if (glyphId >= 0 && glyphId < numGlyphs && hasGlyph(glyphId, charCode, cid)) {
  41345. charCodeToGlyphId[charCode] = glyphId;
  41346. }
  41347. });
  41348. if (dupFirstEntry && (isCidToGidMapEmpty || !charCodeToGlyphId[0])) {
  41349. charCodeToGlyphId[0] = numGlyphs - 1;
  41350. }
  41351. } else {
  41352. var cmapTable = readCmapTable(tables['cmap'], font, this.isSymbolicFont, properties.hasEncoding);
  41353. var cmapPlatformId = cmapTable.platformId;
  41354. var cmapEncodingId = cmapTable.encodingId;
  41355. var cmapMappings = cmapTable.mappings;
  41356. var cmapMappingsLength = cmapMappings.length;
  41357. if (properties.hasEncoding && (cmapPlatformId === 3 && cmapEncodingId === 1 || cmapPlatformId === 1 && cmapEncodingId === 0) || cmapPlatformId === -1 && cmapEncodingId === -1 && !!getEncoding(properties.baseEncodingName)) {
  41358. var baseEncoding = [];
  41359. if (properties.baseEncodingName === 'MacRomanEncoding' || properties.baseEncodingName === 'WinAnsiEncoding') {
  41360. baseEncoding = getEncoding(properties.baseEncodingName);
  41361. }
  41362. var glyphsUnicodeMap = getGlyphsUnicode();
  41363. for (charCode = 0; charCode < 256; charCode++) {
  41364. var glyphName, standardGlyphName;
  41365. if (this.differences && charCode in this.differences) {
  41366. glyphName = this.differences[charCode];
  41367. } else if (charCode in baseEncoding && baseEncoding[charCode] !== '') {
  41368. glyphName = baseEncoding[charCode];
  41369. } else {
  41370. glyphName = StandardEncoding[charCode];
  41371. }
  41372. if (!glyphName) {
  41373. continue;
  41374. }
  41375. standardGlyphName = recoverGlyphName(glyphName, glyphsUnicodeMap);
  41376. var unicodeOrCharCode, isUnicode = false;
  41377. if (cmapPlatformId === 3 && cmapEncodingId === 1) {
  41378. unicodeOrCharCode = glyphsUnicodeMap[standardGlyphName];
  41379. isUnicode = true;
  41380. } else if (cmapPlatformId === 1 && cmapEncodingId === 0) {
  41381. unicodeOrCharCode = MacRomanEncoding.indexOf(standardGlyphName);
  41382. }
  41383. var found = false;
  41384. for (i = 0; i < cmapMappingsLength; ++i) {
  41385. if (cmapMappings[i].charCode !== unicodeOrCharCode) {
  41386. continue;
  41387. }
  41388. var code = isUnicode ? charCode : unicodeOrCharCode;
  41389. if (hasGlyph(cmapMappings[i].glyphId, code, -1)) {
  41390. charCodeToGlyphId[charCode] = cmapMappings[i].glyphId;
  41391. found = true;
  41392. break;
  41393. }
  41394. }
  41395. if (!found && properties.glyphNames) {
  41396. var glyphId = properties.glyphNames.indexOf(glyphName);
  41397. if (glyphId === -1 && standardGlyphName !== glyphName) {
  41398. glyphId = properties.glyphNames.indexOf(standardGlyphName);
  41399. }
  41400. if (glyphId > 0 && hasGlyph(glyphId, -1, -1)) {
  41401. charCodeToGlyphId[charCode] = glyphId;
  41402. found = true;
  41403. }
  41404. }
  41405. if (!found) {
  41406. charCodeToGlyphId[charCode] = 0;
  41407. }
  41408. }
  41409. } else if (cmapPlatformId === 0 && cmapEncodingId === 0) {
  41410. for (i = 0; i < cmapMappingsLength; ++i) {
  41411. charCodeToGlyphId[cmapMappings[i].charCode] = cmapMappings[i].glyphId;
  41412. }
  41413. } else {
  41414. for (i = 0; i < cmapMappingsLength; ++i) {
  41415. charCode = cmapMappings[i].charCode & 0xFF;
  41416. charCodeToGlyphId[charCode] = cmapMappings[i].glyphId;
  41417. }
  41418. }
  41419. }
  41420. if (charCodeToGlyphId.length === 0) {
  41421. charCodeToGlyphId[0] = 0;
  41422. }
  41423. var newMapping = adjustMapping(charCodeToGlyphId, properties);
  41424. this.toFontChar = newMapping.toFontChar;
  41425. tables['cmap'] = {
  41426. tag: 'cmap',
  41427. data: createCmapTable(newMapping.charCodeToGlyphId, numGlyphs)
  41428. };
  41429. if (!tables['OS/2'] || !validateOS2Table(tables['OS/2'])) {
  41430. tables['OS/2'] = {
  41431. tag: 'OS/2',
  41432. data: createOS2Table(properties, newMapping.charCodeToGlyphId, metricsOverride)
  41433. };
  41434. }
  41435. if (!tables['post']) {
  41436. tables['post'] = {
  41437. tag: 'post',
  41438. data: createPostTable(properties)
  41439. };
  41440. }
  41441. if (!isTrueType) {
  41442. try {
  41443. cffFile = new Stream(tables['CFF '].data);
  41444. var parser = new CFFParser(cffFile, properties, SEAC_ANALYSIS_ENABLED);
  41445. cff = parser.parse();
  41446. var compiler = new CFFCompiler(cff);
  41447. tables['CFF '].data = compiler.compile();
  41448. } catch (e) {
  41449. warn('Failed to compile font ' + properties.loadedName);
  41450. }
  41451. }
  41452. if (!tables['name']) {
  41453. tables['name'] = {
  41454. tag: 'name',
  41455. data: createNameTable(this.name)
  41456. };
  41457. } else {
  41458. var namePrototype = readNameTable(tables['name']);
  41459. tables['name'].data = createNameTable(name, namePrototype);
  41460. }
  41461. var builder = new OpenTypeFileBuilder(header.version);
  41462. for (var tableTag in tables) {
  41463. builder.addTable(tableTag, tables[tableTag].data);
  41464. }
  41465. return builder.toArray();
  41466. },
  41467. convert: function Font_convert(fontName, font, properties) {
  41468. properties.fixedPitch = false;
  41469. if (properties.builtInEncoding) {
  41470. adjustToUnicode(properties, properties.builtInEncoding);
  41471. }
  41472. var mapping = font.getGlyphMapping(properties);
  41473. var newMapping = adjustMapping(mapping, properties);
  41474. this.toFontChar = newMapping.toFontChar;
  41475. var numGlyphs = font.numGlyphs;
  41476. function getCharCodes(charCodeToGlyphId, glyphId) {
  41477. var charCodes = null;
  41478. for (var charCode in charCodeToGlyphId) {
  41479. if (glyphId === charCodeToGlyphId[charCode]) {
  41480. if (!charCodes) {
  41481. charCodes = [];
  41482. }
  41483. charCodes.push(charCode | 0);
  41484. }
  41485. }
  41486. return charCodes;
  41487. }
  41488. function createCharCode(charCodeToGlyphId, glyphId) {
  41489. for (var charCode in charCodeToGlyphId) {
  41490. if (glyphId === charCodeToGlyphId[charCode]) {
  41491. return charCode | 0;
  41492. }
  41493. }
  41494. newMapping.charCodeToGlyphId[newMapping.nextAvailableFontCharCode] = glyphId;
  41495. return newMapping.nextAvailableFontCharCode++;
  41496. }
  41497. var seacs = font.seacs;
  41498. if (SEAC_ANALYSIS_ENABLED && seacs && seacs.length) {
  41499. var matrix = properties.fontMatrix || FONT_IDENTITY_MATRIX;
  41500. var charset = font.getCharset();
  41501. var seacMap = Object.create(null);
  41502. for (var glyphId in seacs) {
  41503. glyphId |= 0;
  41504. var seac = seacs[glyphId];
  41505. var baseGlyphName = StandardEncoding[seac[2]];
  41506. var accentGlyphName = StandardEncoding[seac[3]];
  41507. var baseGlyphId = charset.indexOf(baseGlyphName);
  41508. var accentGlyphId = charset.indexOf(accentGlyphName);
  41509. if (baseGlyphId < 0 || accentGlyphId < 0) {
  41510. continue;
  41511. }
  41512. var accentOffset = {
  41513. x: seac[0] * matrix[0] + seac[1] * matrix[2] + matrix[4],
  41514. y: seac[0] * matrix[1] + seac[1] * matrix[3] + matrix[5]
  41515. };
  41516. var charCodes = getCharCodes(mapping, glyphId);
  41517. if (!charCodes) {
  41518. continue;
  41519. }
  41520. for (var i = 0, ii = charCodes.length; i < ii; i++) {
  41521. var charCode = charCodes[i];
  41522. var charCodeToGlyphId = newMapping.charCodeToGlyphId;
  41523. var baseFontCharCode = createCharCode(charCodeToGlyphId, baseGlyphId);
  41524. var accentFontCharCode = createCharCode(charCodeToGlyphId, accentGlyphId);
  41525. seacMap[charCode] = {
  41526. baseFontCharCode: baseFontCharCode,
  41527. accentFontCharCode: accentFontCharCode,
  41528. accentOffset: accentOffset
  41529. };
  41530. }
  41531. }
  41532. properties.seacMap = seacMap;
  41533. }
  41534. var unitsPerEm = 1 / (properties.fontMatrix || FONT_IDENTITY_MATRIX)[0];
  41535. var builder = new OpenTypeFileBuilder('\x4F\x54\x54\x4F');
  41536. builder.addTable('CFF ', font.data);
  41537. builder.addTable('OS/2', createOS2Table(properties, newMapping.charCodeToGlyphId));
  41538. builder.addTable('cmap', createCmapTable(newMapping.charCodeToGlyphId, numGlyphs));
  41539. 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');
  41540. 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));
  41541. builder.addTable('hmtx', function fontFieldsHmtx() {
  41542. var charstrings = font.charstrings;
  41543. var cffWidths = font.cff ? font.cff.widths : null;
  41544. var hmtx = '\x00\x00\x00\x00';
  41545. for (var i = 1, ii = numGlyphs; i < ii; i++) {
  41546. var width = 0;
  41547. if (charstrings) {
  41548. var charstring = charstrings[i - 1];
  41549. width = 'width' in charstring ? charstring.width : 0;
  41550. } else if (cffWidths) {
  41551. width = Math.ceil(cffWidths[i] || 0);
  41552. }
  41553. hmtx += string16(width) + string16(0);
  41554. }
  41555. return hmtx;
  41556. }());
  41557. builder.addTable('maxp', '\x00\x00\x50\x00' + string16(numGlyphs));
  41558. builder.addTable('name', createNameTable(fontName));
  41559. builder.addTable('post', createPostTable(properties));
  41560. return builder.toArray();
  41561. },
  41562. get spaceWidth() {
  41563. if ('_shadowWidth' in this) {
  41564. return this._shadowWidth;
  41565. }
  41566. var possibleSpaceReplacements = [
  41567. 'space',
  41568. 'minus',
  41569. 'one',
  41570. 'i',
  41571. 'I'
  41572. ];
  41573. var width;
  41574. for (var i = 0, ii = possibleSpaceReplacements.length; i < ii; i++) {
  41575. var glyphName = possibleSpaceReplacements[i];
  41576. if (glyphName in this.widths) {
  41577. width = this.widths[glyphName];
  41578. break;
  41579. }
  41580. var glyphsUnicodeMap = getGlyphsUnicode();
  41581. var glyphUnicode = glyphsUnicodeMap[glyphName];
  41582. var charcode = 0;
  41583. if (this.composite) {
  41584. if (this.cMap.contains(glyphUnicode)) {
  41585. charcode = this.cMap.lookup(glyphUnicode);
  41586. }
  41587. }
  41588. if (!charcode && this.toUnicode) {
  41589. charcode = this.toUnicode.charCodeOf(glyphUnicode);
  41590. }
  41591. if (charcode <= 0) {
  41592. charcode = glyphUnicode;
  41593. }
  41594. width = this.widths[charcode];
  41595. if (width) {
  41596. break;
  41597. }
  41598. }
  41599. width = width || this.defaultWidth;
  41600. this._shadowWidth = width;
  41601. return width;
  41602. },
  41603. charToGlyph: function Font_charToGlyph(charcode, isSpace) {
  41604. var fontCharCode, width, operatorListId;
  41605. var widthCode = charcode;
  41606. if (this.cMap && this.cMap.contains(charcode)) {
  41607. widthCode = this.cMap.lookup(charcode);
  41608. }
  41609. width = this.widths[widthCode];
  41610. width = isNum(width) ? width : this.defaultWidth;
  41611. var vmetric = this.vmetrics && this.vmetrics[widthCode];
  41612. var unicode = this.toUnicode.get(charcode) || charcode;
  41613. if (typeof unicode === 'number') {
  41614. unicode = String.fromCharCode(unicode);
  41615. }
  41616. var isInFont = charcode in this.toFontChar;
  41617. fontCharCode = this.toFontChar[charcode] || charcode;
  41618. if (this.missingFile) {
  41619. fontCharCode = mapSpecialUnicodeValues(fontCharCode);
  41620. }
  41621. if (this.isType3Font) {
  41622. operatorListId = fontCharCode;
  41623. }
  41624. var accent = null;
  41625. if (this.seacMap && this.seacMap[charcode]) {
  41626. isInFont = true;
  41627. var seac = this.seacMap[charcode];
  41628. fontCharCode = seac.baseFontCharCode;
  41629. accent = {
  41630. fontChar: String.fromCharCode(seac.accentFontCharCode),
  41631. offset: seac.accentOffset
  41632. };
  41633. }
  41634. var fontChar = String.fromCharCode(fontCharCode);
  41635. var glyph = this.glyphCache[charcode];
  41636. if (!glyph || !glyph.matchesForCache(fontChar, unicode, accent, width, vmetric, operatorListId, isSpace, isInFont)) {
  41637. glyph = new Glyph(fontChar, unicode, accent, width, vmetric, operatorListId, isSpace, isInFont);
  41638. this.glyphCache[charcode] = glyph;
  41639. }
  41640. return glyph;
  41641. },
  41642. charsToGlyphs: function Font_charsToGlyphs(chars) {
  41643. var charsCache = this.charsCache;
  41644. var glyphs, glyph, charcode;
  41645. if (charsCache) {
  41646. glyphs = charsCache[chars];
  41647. if (glyphs) {
  41648. return glyphs;
  41649. }
  41650. }
  41651. if (!charsCache) {
  41652. charsCache = this.charsCache = Object.create(null);
  41653. }
  41654. glyphs = [];
  41655. var charsCacheKey = chars;
  41656. var i = 0, ii;
  41657. if (this.cMap) {
  41658. var c = Object.create(null);
  41659. while (i < chars.length) {
  41660. this.cMap.readCharCode(chars, i, c);
  41661. charcode = c.charcode;
  41662. var length = c.length;
  41663. i += length;
  41664. var isSpace = length === 1 && chars.charCodeAt(i - 1) === 0x20;
  41665. glyph = this.charToGlyph(charcode, isSpace);
  41666. glyphs.push(glyph);
  41667. }
  41668. } else {
  41669. for (i = 0, ii = chars.length; i < ii; ++i) {
  41670. charcode = chars.charCodeAt(i);
  41671. glyph = this.charToGlyph(charcode, charcode === 0x20);
  41672. glyphs.push(glyph);
  41673. }
  41674. }
  41675. return charsCache[charsCacheKey] = glyphs;
  41676. }
  41677. };
  41678. return Font;
  41679. }();
  41680. var ErrorFont = function ErrorFontClosure() {
  41681. function ErrorFont(error) {
  41682. this.error = error;
  41683. this.loadedName = 'g_font_error';
  41684. this.loading = false;
  41685. }
  41686. ErrorFont.prototype = {
  41687. charsToGlyphs: function ErrorFont_charsToGlyphs() {
  41688. return [];
  41689. },
  41690. exportData: function ErrorFont_exportData() {
  41691. return { error: this.error };
  41692. }
  41693. };
  41694. return ErrorFont;
  41695. }();
  41696. function type1FontGlyphMapping(properties, builtInEncoding, glyphNames) {
  41697. var charCodeToGlyphId = Object.create(null);
  41698. var glyphId, charCode, baseEncoding;
  41699. var isSymbolicFont = !!(properties.flags & FontFlags.Symbolic);
  41700. if (properties.baseEncodingName) {
  41701. baseEncoding = getEncoding(properties.baseEncodingName);
  41702. for (charCode = 0; charCode < baseEncoding.length; charCode++) {
  41703. glyphId = glyphNames.indexOf(baseEncoding[charCode]);
  41704. if (glyphId >= 0) {
  41705. charCodeToGlyphId[charCode] = glyphId;
  41706. } else {
  41707. charCodeToGlyphId[charCode] = 0;
  41708. }
  41709. }
  41710. } else if (isSymbolicFont) {
  41711. for (charCode in builtInEncoding) {
  41712. charCodeToGlyphId[charCode] = builtInEncoding[charCode];
  41713. }
  41714. } else {
  41715. baseEncoding = StandardEncoding;
  41716. for (charCode = 0; charCode < baseEncoding.length; charCode++) {
  41717. glyphId = glyphNames.indexOf(baseEncoding[charCode]);
  41718. if (glyphId >= 0) {
  41719. charCodeToGlyphId[charCode] = glyphId;
  41720. } else {
  41721. charCodeToGlyphId[charCode] = 0;
  41722. }
  41723. }
  41724. }
  41725. var differences = properties.differences, glyphsUnicodeMap;
  41726. if (differences) {
  41727. for (charCode in differences) {
  41728. var glyphName = differences[charCode];
  41729. glyphId = glyphNames.indexOf(glyphName);
  41730. if (glyphId === -1) {
  41731. if (!glyphsUnicodeMap) {
  41732. glyphsUnicodeMap = getGlyphsUnicode();
  41733. }
  41734. var standardGlyphName = recoverGlyphName(glyphName, glyphsUnicodeMap);
  41735. if (standardGlyphName !== glyphName) {
  41736. glyphId = glyphNames.indexOf(standardGlyphName);
  41737. }
  41738. }
  41739. if (glyphId >= 0) {
  41740. charCodeToGlyphId[charCode] = glyphId;
  41741. } else {
  41742. charCodeToGlyphId[charCode] = 0;
  41743. }
  41744. }
  41745. }
  41746. return charCodeToGlyphId;
  41747. }
  41748. var Type1Font = function Type1FontClosure() {
  41749. function findBlock(streamBytes, signature, startIndex) {
  41750. var streamBytesLength = streamBytes.length;
  41751. var signatureLength = signature.length;
  41752. var scanLength = streamBytesLength - signatureLength;
  41753. var i = startIndex, j, found = false;
  41754. while (i < scanLength) {
  41755. j = 0;
  41756. while (j < signatureLength && streamBytes[i + j] === signature[j]) {
  41757. j++;
  41758. }
  41759. if (j >= signatureLength) {
  41760. i += j;
  41761. while (i < streamBytesLength && isSpace(streamBytes[i])) {
  41762. i++;
  41763. }
  41764. found = true;
  41765. break;
  41766. }
  41767. i++;
  41768. }
  41769. return {
  41770. found: found,
  41771. length: i
  41772. };
  41773. }
  41774. function getHeaderBlock(stream, suggestedLength) {
  41775. var EEXEC_SIGNATURE = [
  41776. 0x65,
  41777. 0x65,
  41778. 0x78,
  41779. 0x65,
  41780. 0x63
  41781. ];
  41782. var streamStartPos = stream.pos;
  41783. var headerBytes, headerBytesLength, block;
  41784. try {
  41785. headerBytes = stream.getBytes(suggestedLength);
  41786. headerBytesLength = headerBytes.length;
  41787. } catch (ex) {
  41788. if (ex instanceof MissingDataException) {
  41789. throw ex;
  41790. }
  41791. }
  41792. if (headerBytesLength === suggestedLength) {
  41793. block = findBlock(headerBytes, EEXEC_SIGNATURE, suggestedLength - 2 * EEXEC_SIGNATURE.length);
  41794. if (block.found && block.length === suggestedLength) {
  41795. return {
  41796. stream: new Stream(headerBytes),
  41797. length: suggestedLength
  41798. };
  41799. }
  41800. }
  41801. warn('Invalid "Length1" property in Type1 font -- trying to recover.');
  41802. stream.pos = streamStartPos;
  41803. var SCAN_BLOCK_LENGTH = 2048;
  41804. var actualLength;
  41805. while (true) {
  41806. var scanBytes = stream.peekBytes(SCAN_BLOCK_LENGTH);
  41807. block = findBlock(scanBytes, EEXEC_SIGNATURE, 0);
  41808. if (block.length === 0) {
  41809. break;
  41810. }
  41811. stream.pos += block.length;
  41812. if (block.found) {
  41813. actualLength = stream.pos - streamStartPos;
  41814. break;
  41815. }
  41816. }
  41817. stream.pos = streamStartPos;
  41818. if (actualLength) {
  41819. return {
  41820. stream: new Stream(stream.getBytes(actualLength)),
  41821. length: actualLength
  41822. };
  41823. }
  41824. warn('Unable to recover "Length1" property in Type1 font -- using as is.');
  41825. return {
  41826. stream: new Stream(stream.getBytes(suggestedLength)),
  41827. length: suggestedLength
  41828. };
  41829. }
  41830. function getEexecBlock(stream, suggestedLength) {
  41831. var eexecBytes = stream.getBytes();
  41832. return {
  41833. stream: new Stream(eexecBytes),
  41834. length: eexecBytes.length
  41835. };
  41836. }
  41837. function Type1Font(name, file, properties) {
  41838. var PFB_HEADER_SIZE = 6;
  41839. var headerBlockLength = properties.length1;
  41840. var eexecBlockLength = properties.length2;
  41841. var pfbHeader = file.peekBytes(PFB_HEADER_SIZE);
  41842. var pfbHeaderPresent = pfbHeader[0] === 0x80 && pfbHeader[1] === 0x01;
  41843. if (pfbHeaderPresent) {
  41844. file.skip(PFB_HEADER_SIZE);
  41845. headerBlockLength = pfbHeader[5] << 24 | pfbHeader[4] << 16 | pfbHeader[3] << 8 | pfbHeader[2];
  41846. }
  41847. var headerBlock = getHeaderBlock(file, headerBlockLength);
  41848. headerBlockLength = headerBlock.length;
  41849. var headerBlockParser = new Type1Parser(headerBlock.stream, false, SEAC_ANALYSIS_ENABLED);
  41850. headerBlockParser.extractFontHeader(properties);
  41851. if (pfbHeaderPresent) {
  41852. pfbHeader = file.getBytes(PFB_HEADER_SIZE);
  41853. eexecBlockLength = pfbHeader[5] << 24 | pfbHeader[4] << 16 | pfbHeader[3] << 8 | pfbHeader[2];
  41854. }
  41855. var eexecBlock = getEexecBlock(file, eexecBlockLength);
  41856. eexecBlockLength = eexecBlock.length;
  41857. var eexecBlockParser = new Type1Parser(eexecBlock.stream, true, SEAC_ANALYSIS_ENABLED);
  41858. var data = eexecBlockParser.extractFontProgram();
  41859. for (var info in data.properties) {
  41860. properties[info] = data.properties[info];
  41861. }
  41862. var charstrings = data.charstrings;
  41863. var type2Charstrings = this.getType2Charstrings(charstrings);
  41864. var subrs = this.getType2Subrs(data.subrs);
  41865. this.charstrings = charstrings;
  41866. this.data = this.wrap(name, type2Charstrings, this.charstrings, subrs, properties);
  41867. this.seacs = this.getSeacs(data.charstrings);
  41868. }
  41869. Type1Font.prototype = {
  41870. get numGlyphs() {
  41871. return this.charstrings.length + 1;
  41872. },
  41873. getCharset: function Type1Font_getCharset() {
  41874. var charset = ['.notdef'];
  41875. var charstrings = this.charstrings;
  41876. for (var glyphId = 0; glyphId < charstrings.length; glyphId++) {
  41877. charset.push(charstrings[glyphId].glyphName);
  41878. }
  41879. return charset;
  41880. },
  41881. getGlyphMapping: function Type1Font_getGlyphMapping(properties) {
  41882. var charstrings = this.charstrings;
  41883. var glyphNames = ['.notdef'], glyphId;
  41884. for (glyphId = 0; glyphId < charstrings.length; glyphId++) {
  41885. glyphNames.push(charstrings[glyphId].glyphName);
  41886. }
  41887. var encoding = properties.builtInEncoding;
  41888. if (encoding) {
  41889. var builtInEncoding = Object.create(null);
  41890. for (var charCode in encoding) {
  41891. glyphId = glyphNames.indexOf(encoding[charCode]);
  41892. if (glyphId >= 0) {
  41893. builtInEncoding[charCode] = glyphId;
  41894. }
  41895. }
  41896. }
  41897. return type1FontGlyphMapping(properties, builtInEncoding, glyphNames);
  41898. },
  41899. getSeacs: function Type1Font_getSeacs(charstrings) {
  41900. var i, ii;
  41901. var seacMap = [];
  41902. for (i = 0, ii = charstrings.length; i < ii; i++) {
  41903. var charstring = charstrings[i];
  41904. if (charstring.seac) {
  41905. seacMap[i + 1] = charstring.seac;
  41906. }
  41907. }
  41908. return seacMap;
  41909. },
  41910. getType2Charstrings: function Type1Font_getType2Charstrings(type1Charstrings) {
  41911. var type2Charstrings = [];
  41912. for (var i = 0, ii = type1Charstrings.length; i < ii; i++) {
  41913. type2Charstrings.push(type1Charstrings[i].charstring);
  41914. }
  41915. return type2Charstrings;
  41916. },
  41917. getType2Subrs: function Type1Font_getType2Subrs(type1Subrs) {
  41918. var bias = 0;
  41919. var count = type1Subrs.length;
  41920. if (count < 1133) {
  41921. bias = 107;
  41922. } else if (count < 33769) {
  41923. bias = 1131;
  41924. } else {
  41925. bias = 32768;
  41926. }
  41927. var type2Subrs = [];
  41928. var i;
  41929. for (i = 0; i < bias; i++) {
  41930. type2Subrs.push([0x0B]);
  41931. }
  41932. for (i = 0; i < count; i++) {
  41933. type2Subrs.push(type1Subrs[i]);
  41934. }
  41935. return type2Subrs;
  41936. },
  41937. wrap: function Type1Font_wrap(name, glyphs, charstrings, subrs, properties) {
  41938. var cff = new CFF();
  41939. cff.header = new CFFHeader(1, 0, 4, 4);
  41940. cff.names = [name];
  41941. var topDict = new CFFTopDict();
  41942. topDict.setByName('version', 391);
  41943. topDict.setByName('Notice', 392);
  41944. topDict.setByName('FullName', 393);
  41945. topDict.setByName('FamilyName', 394);
  41946. topDict.setByName('Weight', 395);
  41947. topDict.setByName('Encoding', null);
  41948. topDict.setByName('FontMatrix', properties.fontMatrix);
  41949. topDict.setByName('FontBBox', properties.bbox);
  41950. topDict.setByName('charset', null);
  41951. topDict.setByName('CharStrings', null);
  41952. topDict.setByName('Private', null);
  41953. cff.topDict = topDict;
  41954. var strings = new CFFStrings();
  41955. strings.add('Version 0.11');
  41956. strings.add('See original notice');
  41957. strings.add(name);
  41958. strings.add(name);
  41959. strings.add('Medium');
  41960. cff.strings = strings;
  41961. cff.globalSubrIndex = new CFFIndex();
  41962. var count = glyphs.length;
  41963. var charsetArray = [0];
  41964. var i, ii;
  41965. for (i = 0; i < count; i++) {
  41966. var index = CFFStandardStrings.indexOf(charstrings[i].glyphName);
  41967. if (index === -1) {
  41968. index = 0;
  41969. }
  41970. charsetArray.push(index >> 8 & 0xff, index & 0xff);
  41971. }
  41972. cff.charset = new CFFCharset(false, 0, [], charsetArray);
  41973. var charStringsIndex = new CFFIndex();
  41974. charStringsIndex.add([
  41975. 0x8B,
  41976. 0x0E
  41977. ]);
  41978. for (i = 0; i < count; i++) {
  41979. var glyph = glyphs[i];
  41980. if (glyph.length === 0) {
  41981. charStringsIndex.add([
  41982. 0x8B,
  41983. 0x0E
  41984. ]);
  41985. continue;
  41986. }
  41987. charStringsIndex.add(glyph);
  41988. }
  41989. cff.charStrings = charStringsIndex;
  41990. var privateDict = new CFFPrivateDict();
  41991. privateDict.setByName('Subrs', null);
  41992. var fields = [
  41993. 'BlueValues',
  41994. 'OtherBlues',
  41995. 'FamilyBlues',
  41996. 'FamilyOtherBlues',
  41997. 'StemSnapH',
  41998. 'StemSnapV',
  41999. 'BlueShift',
  42000. 'BlueFuzz',
  42001. 'BlueScale',
  42002. 'LanguageGroup',
  42003. 'ExpansionFactor',
  42004. 'ForceBold',
  42005. 'StdHW',
  42006. 'StdVW'
  42007. ];
  42008. for (i = 0, ii = fields.length; i < ii; i++) {
  42009. var field = fields[i];
  42010. if (!(field in properties.privateData)) {
  42011. continue;
  42012. }
  42013. var value = properties.privateData[field];
  42014. if (isArray(value)) {
  42015. for (var j = value.length - 1; j > 0; j--) {
  42016. value[j] -= value[j - 1];
  42017. }
  42018. }
  42019. privateDict.setByName(field, value);
  42020. }
  42021. cff.topDict.privateDict = privateDict;
  42022. var subrIndex = new CFFIndex();
  42023. for (i = 0, ii = subrs.length; i < ii; i++) {
  42024. subrIndex.add(subrs[i]);
  42025. }
  42026. privateDict.subrsIndex = subrIndex;
  42027. var compiler = new CFFCompiler(cff);
  42028. return compiler.compile();
  42029. }
  42030. };
  42031. return Type1Font;
  42032. }();
  42033. var CFFFont = function CFFFontClosure() {
  42034. function CFFFont(file, properties) {
  42035. this.properties = properties;
  42036. var parser = new CFFParser(file, properties, SEAC_ANALYSIS_ENABLED);
  42037. this.cff = parser.parse();
  42038. var compiler = new CFFCompiler(this.cff);
  42039. this.seacs = this.cff.seacs;
  42040. try {
  42041. this.data = compiler.compile();
  42042. } catch (e) {
  42043. warn('Failed to compile font ' + properties.loadedName);
  42044. this.data = file;
  42045. }
  42046. }
  42047. CFFFont.prototype = {
  42048. get numGlyphs() {
  42049. return this.cff.charStrings.count;
  42050. },
  42051. getCharset: function CFFFont_getCharset() {
  42052. return this.cff.charset.charset;
  42053. },
  42054. getGlyphMapping: function CFFFont_getGlyphMapping() {
  42055. var cff = this.cff;
  42056. var properties = this.properties;
  42057. var charsets = cff.charset.charset;
  42058. var charCodeToGlyphId;
  42059. var glyphId;
  42060. if (properties.composite) {
  42061. charCodeToGlyphId = Object.create(null);
  42062. if (cff.isCIDFont) {
  42063. for (glyphId = 0; glyphId < charsets.length; glyphId++) {
  42064. var cid = charsets[glyphId];
  42065. var charCode = properties.cMap.charCodeOf(cid);
  42066. charCodeToGlyphId[charCode] = glyphId;
  42067. }
  42068. } else {
  42069. for (glyphId = 0; glyphId < cff.charStrings.count; glyphId++) {
  42070. charCodeToGlyphId[glyphId] = glyphId;
  42071. }
  42072. }
  42073. return charCodeToGlyphId;
  42074. }
  42075. var encoding = cff.encoding ? cff.encoding.encoding : null;
  42076. charCodeToGlyphId = type1FontGlyphMapping(properties, encoding, charsets);
  42077. return charCodeToGlyphId;
  42078. }
  42079. };
  42080. return CFFFont;
  42081. }();
  42082. (function checkSeacSupport() {
  42083. if (typeof navigator !== 'undefined' && /Windows/.test(navigator.userAgent)) {
  42084. SEAC_ANALYSIS_ENABLED = true;
  42085. }
  42086. }());
  42087. (function checkChromeWindows() {
  42088. if (typeof navigator !== 'undefined' && /Windows.*Chrome/.test(navigator.userAgent)) {
  42089. SKIP_PRIVATE_USE_RANGE_F000_TO_F01F = true;
  42090. }
  42091. }());
  42092. exports.SEAC_ANALYSIS_ENABLED = SEAC_ANALYSIS_ENABLED;
  42093. exports.PRIVATE_USE_OFFSET_START = PRIVATE_USE_OFFSET_START;
  42094. exports.PRIVATE_USE_OFFSET_END = PRIVATE_USE_OFFSET_END;
  42095. exports.ErrorFont = ErrorFont;
  42096. exports.Font = Font;
  42097. exports.FontFlags = FontFlags;
  42098. exports.IdentityToUnicodeMap = IdentityToUnicodeMap;
  42099. exports.ProblematicCharRanges = ProblematicCharRanges;
  42100. exports.ToUnicodeMap = ToUnicodeMap;
  42101. exports.getFontType = getFontType;
  42102. /***/ }),
  42103. /* 27 */
  42104. /***/ (function(module, exports, __w_pdfjs_require__) {
  42105. "use strict";
  42106. var sharedUtil = __w_pdfjs_require__(0);
  42107. var corePrimitives = __w_pdfjs_require__(1);
  42108. var coreColorSpace = __w_pdfjs_require__(3);
  42109. var coreStream = __w_pdfjs_require__(2);
  42110. var coreJpx = __w_pdfjs_require__(15);
  42111. var ImageKind = sharedUtil.ImageKind;
  42112. var assert = sharedUtil.assert;
  42113. var error = sharedUtil.error;
  42114. var info = sharedUtil.info;
  42115. var isArray = sharedUtil.isArray;
  42116. var warn = sharedUtil.warn;
  42117. var Name = corePrimitives.Name;
  42118. var isStream = corePrimitives.isStream;
  42119. var ColorSpace = coreColorSpace.ColorSpace;
  42120. var DecodeStream = coreStream.DecodeStream;
  42121. var JpegStream = coreStream.JpegStream;
  42122. var JpxImage = coreJpx.JpxImage;
  42123. var PDFImage = function PDFImageClosure() {
  42124. function handleImageData(image, nativeDecoder) {
  42125. if (nativeDecoder && nativeDecoder.canDecode(image)) {
  42126. return nativeDecoder.decode(image);
  42127. }
  42128. return Promise.resolve(image);
  42129. }
  42130. function decodeAndClamp(value, addend, coefficient, max) {
  42131. value = addend + value * coefficient;
  42132. return value < 0 ? 0 : value > max ? max : value;
  42133. }
  42134. function resizeImageMask(src, bpc, w1, h1, w2, h2) {
  42135. var length = w2 * h2;
  42136. var dest = bpc <= 8 ? new Uint8Array(length) : bpc <= 16 ? new Uint16Array(length) : new Uint32Array(length);
  42137. var xRatio = w1 / w2;
  42138. var yRatio = h1 / h2;
  42139. var i, j, py, newIndex = 0, oldIndex;
  42140. var xScaled = new Uint16Array(w2);
  42141. var w1Scanline = w1;
  42142. for (i = 0; i < w2; i++) {
  42143. xScaled[i] = Math.floor(i * xRatio);
  42144. }
  42145. for (i = 0; i < h2; i++) {
  42146. py = Math.floor(i * yRatio) * w1Scanline;
  42147. for (j = 0; j < w2; j++) {
  42148. oldIndex = py + xScaled[j];
  42149. dest[newIndex++] = src[oldIndex];
  42150. }
  42151. }
  42152. return dest;
  42153. }
  42154. function PDFImage(xref, res, image, inline, smask, mask, isMask) {
  42155. this.image = image;
  42156. var dict = image.dict;
  42157. if (dict.has('Filter')) {
  42158. var filter = dict.get('Filter').name;
  42159. if (filter === 'JPXDecode') {
  42160. var jpxImage = new JpxImage();
  42161. jpxImage.parseImageProperties(image.stream);
  42162. image.stream.reset();
  42163. image.bitsPerComponent = jpxImage.bitsPerComponent;
  42164. image.numComps = jpxImage.componentsCount;
  42165. } else if (filter === 'JBIG2Decode') {
  42166. image.bitsPerComponent = 1;
  42167. image.numComps = 1;
  42168. }
  42169. }
  42170. this.width = dict.get('Width', 'W');
  42171. this.height = dict.get('Height', 'H');
  42172. if (this.width < 1 || this.height < 1) {
  42173. error('Invalid image width: ' + this.width + ' or height: ' + this.height);
  42174. }
  42175. this.interpolate = dict.get('Interpolate', 'I') || false;
  42176. this.imageMask = dict.get('ImageMask', 'IM') || false;
  42177. this.matte = dict.get('Matte') || false;
  42178. var bitsPerComponent = image.bitsPerComponent;
  42179. if (!bitsPerComponent) {
  42180. bitsPerComponent = dict.get('BitsPerComponent', 'BPC');
  42181. if (!bitsPerComponent) {
  42182. if (this.imageMask) {
  42183. bitsPerComponent = 1;
  42184. } else {
  42185. error('Bits per component missing in image: ' + this.imageMask);
  42186. }
  42187. }
  42188. }
  42189. this.bpc = bitsPerComponent;
  42190. if (!this.imageMask) {
  42191. var colorSpace = dict.get('ColorSpace', 'CS');
  42192. if (!colorSpace) {
  42193. info('JPX images (which do not require color spaces)');
  42194. switch (image.numComps) {
  42195. case 1:
  42196. colorSpace = Name.get('DeviceGray');
  42197. break;
  42198. case 3:
  42199. colorSpace = Name.get('DeviceRGB');
  42200. break;
  42201. case 4:
  42202. colorSpace = Name.get('DeviceCMYK');
  42203. break;
  42204. default:
  42205. error('JPX images with ' + this.numComps + ' color components not supported.');
  42206. }
  42207. }
  42208. this.colorSpace = ColorSpace.parse(colorSpace, xref, res);
  42209. this.numComps = this.colorSpace.numComps;
  42210. }
  42211. this.decode = dict.getArray('Decode', 'D');
  42212. this.needsDecode = false;
  42213. if (this.decode && (this.colorSpace && !this.colorSpace.isDefaultDecode(this.decode) || isMask && !ColorSpace.isDefaultDecode(this.decode, 1))) {
  42214. this.needsDecode = true;
  42215. var max = (1 << bitsPerComponent) - 1;
  42216. this.decodeCoefficients = [];
  42217. this.decodeAddends = [];
  42218. for (var i = 0, j = 0; i < this.decode.length; i += 2, ++j) {
  42219. var dmin = this.decode[i];
  42220. var dmax = this.decode[i + 1];
  42221. this.decodeCoefficients[j] = dmax - dmin;
  42222. this.decodeAddends[j] = max * dmin;
  42223. }
  42224. }
  42225. if (smask) {
  42226. this.smask = new PDFImage(xref, res, smask, false);
  42227. } else if (mask) {
  42228. if (isStream(mask)) {
  42229. var maskDict = mask.dict, imageMask = maskDict.get('ImageMask', 'IM');
  42230. if (!imageMask) {
  42231. warn('Ignoring /Mask in image without /ImageMask.');
  42232. } else {
  42233. this.mask = new PDFImage(xref, res, mask, false, null, null, true);
  42234. }
  42235. } else {
  42236. this.mask = mask;
  42237. }
  42238. }
  42239. }
  42240. PDFImage.buildImage = function PDFImage_buildImage(handler, xref, res, image, inline, nativeDecoder) {
  42241. var imagePromise = handleImageData(image, nativeDecoder);
  42242. var smaskPromise;
  42243. var maskPromise;
  42244. var smask = image.dict.get('SMask');
  42245. var mask = image.dict.get('Mask');
  42246. if (smask) {
  42247. smaskPromise = handleImageData(smask, nativeDecoder);
  42248. maskPromise = Promise.resolve(null);
  42249. } else {
  42250. smaskPromise = Promise.resolve(null);
  42251. if (mask) {
  42252. if (isStream(mask)) {
  42253. maskPromise = handleImageData(mask, nativeDecoder);
  42254. } else if (isArray(mask)) {
  42255. maskPromise = Promise.resolve(mask);
  42256. } else {
  42257. warn('Unsupported mask format.');
  42258. maskPromise = Promise.resolve(null);
  42259. }
  42260. } else {
  42261. maskPromise = Promise.resolve(null);
  42262. }
  42263. }
  42264. return Promise.all([
  42265. imagePromise,
  42266. smaskPromise,
  42267. maskPromise
  42268. ]).then(function (results) {
  42269. var imageData = results[0];
  42270. var smaskData = results[1];
  42271. var maskData = results[2];
  42272. return new PDFImage(xref, res, imageData, inline, smaskData, maskData);
  42273. });
  42274. };
  42275. PDFImage.createMask = function PDFImage_createMask(imgArray, width, height, imageIsFromDecodeStream, inverseDecode) {
  42276. var computedLength = (width + 7 >> 3) * height;
  42277. var actualLength = imgArray.byteLength;
  42278. var haveFullData = computedLength === actualLength;
  42279. var data, i;
  42280. if (imageIsFromDecodeStream && (!inverseDecode || haveFullData)) {
  42281. data = imgArray;
  42282. } else if (!inverseDecode) {
  42283. data = new Uint8Array(actualLength);
  42284. data.set(imgArray);
  42285. } else {
  42286. data = new Uint8Array(computedLength);
  42287. data.set(imgArray);
  42288. for (i = actualLength; i < computedLength; i++) {
  42289. data[i] = 0xff;
  42290. }
  42291. }
  42292. if (inverseDecode) {
  42293. for (i = 0; i < actualLength; i++) {
  42294. data[i] = ~data[i];
  42295. }
  42296. }
  42297. return {
  42298. data: data,
  42299. width: width,
  42300. height: height
  42301. };
  42302. };
  42303. PDFImage.prototype = {
  42304. get drawWidth() {
  42305. return Math.max(this.width, this.smask && this.smask.width || 0, this.mask && this.mask.width || 0);
  42306. },
  42307. get drawHeight() {
  42308. return Math.max(this.height, this.smask && this.smask.height || 0, this.mask && this.mask.height || 0);
  42309. },
  42310. decodeBuffer: function PDFImage_decodeBuffer(buffer) {
  42311. var bpc = this.bpc;
  42312. var numComps = this.numComps;
  42313. var decodeAddends = this.decodeAddends;
  42314. var decodeCoefficients = this.decodeCoefficients;
  42315. var max = (1 << bpc) - 1;
  42316. var i, ii;
  42317. if (bpc === 1) {
  42318. for (i = 0, ii = buffer.length; i < ii; i++) {
  42319. buffer[i] = +!buffer[i];
  42320. }
  42321. return;
  42322. }
  42323. var index = 0;
  42324. for (i = 0, ii = this.width * this.height; i < ii; i++) {
  42325. for (var j = 0; j < numComps; j++) {
  42326. buffer[index] = decodeAndClamp(buffer[index], decodeAddends[j], decodeCoefficients[j], max);
  42327. index++;
  42328. }
  42329. }
  42330. },
  42331. getComponents: function PDFImage_getComponents(buffer) {
  42332. var bpc = this.bpc;
  42333. if (bpc === 8) {
  42334. return buffer;
  42335. }
  42336. var width = this.width;
  42337. var height = this.height;
  42338. var numComps = this.numComps;
  42339. var length = width * height * numComps;
  42340. var bufferPos = 0;
  42341. var output = bpc <= 8 ? new Uint8Array(length) : bpc <= 16 ? new Uint16Array(length) : new Uint32Array(length);
  42342. var rowComps = width * numComps;
  42343. var max = (1 << bpc) - 1;
  42344. var i = 0, ii, buf;
  42345. if (bpc === 1) {
  42346. var mask, loop1End, loop2End;
  42347. for (var j = 0; j < height; j++) {
  42348. loop1End = i + (rowComps & ~7);
  42349. loop2End = i + rowComps;
  42350. while (i < loop1End) {
  42351. buf = buffer[bufferPos++];
  42352. output[i] = buf >> 7 & 1;
  42353. output[i + 1] = buf >> 6 & 1;
  42354. output[i + 2] = buf >> 5 & 1;
  42355. output[i + 3] = buf >> 4 & 1;
  42356. output[i + 4] = buf >> 3 & 1;
  42357. output[i + 5] = buf >> 2 & 1;
  42358. output[i + 6] = buf >> 1 & 1;
  42359. output[i + 7] = buf & 1;
  42360. i += 8;
  42361. }
  42362. if (i < loop2End) {
  42363. buf = buffer[bufferPos++];
  42364. mask = 128;
  42365. while (i < loop2End) {
  42366. output[i++] = +!!(buf & mask);
  42367. mask >>= 1;
  42368. }
  42369. }
  42370. }
  42371. } else {
  42372. var bits = 0;
  42373. buf = 0;
  42374. for (i = 0, ii = length; i < ii; ++i) {
  42375. if (i % rowComps === 0) {
  42376. buf = 0;
  42377. bits = 0;
  42378. }
  42379. while (bits < bpc) {
  42380. buf = buf << 8 | buffer[bufferPos++];
  42381. bits += 8;
  42382. }
  42383. var remainingBits = bits - bpc;
  42384. var value = buf >> remainingBits;
  42385. output[i] = value < 0 ? 0 : value > max ? max : value;
  42386. buf = buf & (1 << remainingBits) - 1;
  42387. bits = remainingBits;
  42388. }
  42389. }
  42390. return output;
  42391. },
  42392. fillOpacity: function PDFImage_fillOpacity(rgbaBuf, width, height, actualHeight, image) {
  42393. var smask = this.smask;
  42394. var mask = this.mask;
  42395. var alphaBuf, sw, sh, i, ii, j;
  42396. if (smask) {
  42397. sw = smask.width;
  42398. sh = smask.height;
  42399. alphaBuf = new Uint8Array(sw * sh);
  42400. smask.fillGrayBuffer(alphaBuf);
  42401. if (sw !== width || sh !== height) {
  42402. alphaBuf = resizeImageMask(alphaBuf, smask.bpc, sw, sh, width, height);
  42403. }
  42404. } else if (mask) {
  42405. if (mask instanceof PDFImage) {
  42406. sw = mask.width;
  42407. sh = mask.height;
  42408. alphaBuf = new Uint8Array(sw * sh);
  42409. mask.numComps = 1;
  42410. mask.fillGrayBuffer(alphaBuf);
  42411. for (i = 0, ii = sw * sh; i < ii; ++i) {
  42412. alphaBuf[i] = 255 - alphaBuf[i];
  42413. }
  42414. if (sw !== width || sh !== height) {
  42415. alphaBuf = resizeImageMask(alphaBuf, mask.bpc, sw, sh, width, height);
  42416. }
  42417. } else if (isArray(mask)) {
  42418. alphaBuf = new Uint8Array(width * height);
  42419. var numComps = this.numComps;
  42420. for (i = 0, ii = width * height; i < ii; ++i) {
  42421. var opacity = 0;
  42422. var imageOffset = i * numComps;
  42423. for (j = 0; j < numComps; ++j) {
  42424. var color = image[imageOffset + j];
  42425. var maskOffset = j * 2;
  42426. if (color < mask[maskOffset] || color > mask[maskOffset + 1]) {
  42427. opacity = 255;
  42428. break;
  42429. }
  42430. }
  42431. alphaBuf[i] = opacity;
  42432. }
  42433. } else {
  42434. error('Unknown mask format.');
  42435. }
  42436. }
  42437. if (alphaBuf) {
  42438. for (i = 0, j = 3, ii = width * actualHeight; i < ii; ++i, j += 4) {
  42439. rgbaBuf[j] = alphaBuf[i];
  42440. }
  42441. } else {
  42442. for (i = 0, j = 3, ii = width * actualHeight; i < ii; ++i, j += 4) {
  42443. rgbaBuf[j] = 255;
  42444. }
  42445. }
  42446. },
  42447. undoPreblend: function PDFImage_undoPreblend(buffer, width, height) {
  42448. var matte = this.smask && this.smask.matte;
  42449. if (!matte) {
  42450. return;
  42451. }
  42452. var matteRgb = this.colorSpace.getRgb(matte, 0);
  42453. var matteR = matteRgb[0];
  42454. var matteG = matteRgb[1];
  42455. var matteB = matteRgb[2];
  42456. var length = width * height * 4;
  42457. var r, g, b;
  42458. for (var i = 0; i < length; i += 4) {
  42459. var alpha = buffer[i + 3];
  42460. if (alpha === 0) {
  42461. buffer[i] = 255;
  42462. buffer[i + 1] = 255;
  42463. buffer[i + 2] = 255;
  42464. continue;
  42465. }
  42466. var k = 255 / alpha;
  42467. r = (buffer[i] - matteR) * k + matteR;
  42468. g = (buffer[i + 1] - matteG) * k + matteG;
  42469. b = (buffer[i + 2] - matteB) * k + matteB;
  42470. buffer[i] = r <= 0 ? 0 : r >= 255 ? 255 : r | 0;
  42471. buffer[i + 1] = g <= 0 ? 0 : g >= 255 ? 255 : g | 0;
  42472. buffer[i + 2] = b <= 0 ? 0 : b >= 255 ? 255 : b | 0;
  42473. }
  42474. },
  42475. createImageData: function PDFImage_createImageData(forceRGBA) {
  42476. var drawWidth = this.drawWidth;
  42477. var drawHeight = this.drawHeight;
  42478. var imgData = {
  42479. width: drawWidth,
  42480. height: drawHeight
  42481. };
  42482. var numComps = this.numComps;
  42483. var originalWidth = this.width;
  42484. var originalHeight = this.height;
  42485. var bpc = this.bpc;
  42486. var rowBytes = originalWidth * numComps * bpc + 7 >> 3;
  42487. var imgArray;
  42488. if (!forceRGBA) {
  42489. var kind;
  42490. if (this.colorSpace.name === 'DeviceGray' && bpc === 1) {
  42491. kind = ImageKind.GRAYSCALE_1BPP;
  42492. } else if (this.colorSpace.name === 'DeviceRGB' && bpc === 8 && !this.needsDecode) {
  42493. kind = ImageKind.RGB_24BPP;
  42494. }
  42495. if (kind && !this.smask && !this.mask && drawWidth === originalWidth && drawHeight === originalHeight) {
  42496. imgData.kind = kind;
  42497. imgArray = this.getImageBytes(originalHeight * rowBytes);
  42498. if (this.image instanceof DecodeStream) {
  42499. imgData.data = imgArray;
  42500. } else {
  42501. var newArray = new Uint8Array(imgArray.length);
  42502. newArray.set(imgArray);
  42503. imgData.data = newArray;
  42504. }
  42505. if (this.needsDecode) {
  42506. assert(kind === ImageKind.GRAYSCALE_1BPP);
  42507. var buffer = imgData.data;
  42508. for (var i = 0, ii = buffer.length; i < ii; i++) {
  42509. buffer[i] ^= 0xff;
  42510. }
  42511. }
  42512. return imgData;
  42513. }
  42514. if (this.image instanceof JpegStream && !this.smask && !this.mask && (this.colorSpace.name === 'DeviceGray' || this.colorSpace.name === 'DeviceRGB' || this.colorSpace.name === 'DeviceCMYK')) {
  42515. imgData.kind = ImageKind.RGB_24BPP;
  42516. imgData.data = this.getImageBytes(originalHeight * rowBytes, drawWidth, drawHeight, true);
  42517. return imgData;
  42518. }
  42519. }
  42520. imgArray = this.getImageBytes(originalHeight * rowBytes);
  42521. var actualHeight = 0 | imgArray.length / rowBytes * drawHeight / originalHeight;
  42522. var comps = this.getComponents(imgArray);
  42523. var alpha01, maybeUndoPreblend;
  42524. if (!forceRGBA && !this.smask && !this.mask) {
  42525. imgData.kind = ImageKind.RGB_24BPP;
  42526. imgData.data = new Uint8Array(drawWidth * drawHeight * 3);
  42527. alpha01 = 0;
  42528. maybeUndoPreblend = false;
  42529. } else {
  42530. imgData.kind = ImageKind.RGBA_32BPP;
  42531. imgData.data = new Uint8Array(drawWidth * drawHeight * 4);
  42532. alpha01 = 1;
  42533. maybeUndoPreblend = true;
  42534. this.fillOpacity(imgData.data, drawWidth, drawHeight, actualHeight, comps);
  42535. }
  42536. if (this.needsDecode) {
  42537. this.decodeBuffer(comps);
  42538. }
  42539. this.colorSpace.fillRgb(imgData.data, originalWidth, originalHeight, drawWidth, drawHeight, actualHeight, bpc, comps, alpha01);
  42540. if (maybeUndoPreblend) {
  42541. this.undoPreblend(imgData.data, drawWidth, actualHeight);
  42542. }
  42543. return imgData;
  42544. },
  42545. fillGrayBuffer: function PDFImage_fillGrayBuffer(buffer) {
  42546. var numComps = this.numComps;
  42547. if (numComps !== 1) {
  42548. error('Reading gray scale from a color image: ' + numComps);
  42549. }
  42550. var width = this.width;
  42551. var height = this.height;
  42552. var bpc = this.bpc;
  42553. var rowBytes = width * numComps * bpc + 7 >> 3;
  42554. var imgArray = this.getImageBytes(height * rowBytes);
  42555. var comps = this.getComponents(imgArray);
  42556. var i, length;
  42557. if (bpc === 1) {
  42558. length = width * height;
  42559. if (this.needsDecode) {
  42560. for (i = 0; i < length; ++i) {
  42561. buffer[i] = comps[i] - 1 & 255;
  42562. }
  42563. } else {
  42564. for (i = 0; i < length; ++i) {
  42565. buffer[i] = -comps[i] & 255;
  42566. }
  42567. }
  42568. return;
  42569. }
  42570. if (this.needsDecode) {
  42571. this.decodeBuffer(comps);
  42572. }
  42573. length = width * height;
  42574. var scale = 255 / ((1 << bpc) - 1);
  42575. for (i = 0; i < length; ++i) {
  42576. buffer[i] = scale * comps[i] | 0;
  42577. }
  42578. },
  42579. getImageBytes: function PDFImage_getImageBytes(length, drawWidth, drawHeight, forceRGB) {
  42580. this.image.reset();
  42581. this.image.drawWidth = drawWidth || this.width;
  42582. this.image.drawHeight = drawHeight || this.height;
  42583. this.image.forceRGB = !!forceRGB;
  42584. return this.image.getBytes(length);
  42585. }
  42586. };
  42587. return PDFImage;
  42588. }();
  42589. exports.PDFImage = PDFImage;
  42590. /***/ }),
  42591. /* 28 */
  42592. /***/ (function(module, exports, __w_pdfjs_require__) {
  42593. "use strict";
  42594. var sharedUtil = __w_pdfjs_require__(0);
  42595. var coreArithmeticDecoder = __w_pdfjs_require__(10);
  42596. var error = sharedUtil.error;
  42597. var log2 = sharedUtil.log2;
  42598. var readInt8 = sharedUtil.readInt8;
  42599. var readUint16 = sharedUtil.readUint16;
  42600. var readUint32 = sharedUtil.readUint32;
  42601. var shadow = sharedUtil.shadow;
  42602. var ArithmeticDecoder = coreArithmeticDecoder.ArithmeticDecoder;
  42603. var Jbig2Image = function Jbig2ImageClosure() {
  42604. function ContextCache() {
  42605. }
  42606. ContextCache.prototype = {
  42607. getContexts: function (id) {
  42608. if (id in this) {
  42609. return this[id];
  42610. }
  42611. return this[id] = new Int8Array(1 << 16);
  42612. }
  42613. };
  42614. function DecodingContext(data, start, end) {
  42615. this.data = data;
  42616. this.start = start;
  42617. this.end = end;
  42618. }
  42619. DecodingContext.prototype = {
  42620. get decoder() {
  42621. var decoder = new ArithmeticDecoder(this.data, this.start, this.end);
  42622. return shadow(this, 'decoder', decoder);
  42623. },
  42624. get contextCache() {
  42625. var cache = new ContextCache();
  42626. return shadow(this, 'contextCache', cache);
  42627. }
  42628. };
  42629. function decodeInteger(contextCache, procedure, decoder) {
  42630. var contexts = contextCache.getContexts(procedure);
  42631. var prev = 1;
  42632. function readBits(length) {
  42633. var v = 0;
  42634. for (var i = 0; i < length; i++) {
  42635. var bit = decoder.readBit(contexts, prev);
  42636. prev = prev < 256 ? prev << 1 | bit : (prev << 1 | bit) & 511 | 256;
  42637. v = v << 1 | bit;
  42638. }
  42639. return v >>> 0;
  42640. }
  42641. var sign = readBits(1);
  42642. 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);
  42643. return sign === 0 ? value : value > 0 ? -value : null;
  42644. }
  42645. function decodeIAID(contextCache, decoder, codeLength) {
  42646. var contexts = contextCache.getContexts('IAID');
  42647. var prev = 1;
  42648. for (var i = 0; i < codeLength; i++) {
  42649. var bit = decoder.readBit(contexts, prev);
  42650. prev = prev << 1 | bit;
  42651. }
  42652. if (codeLength < 31) {
  42653. return prev & (1 << codeLength) - 1;
  42654. }
  42655. return prev & 0x7FFFFFFF;
  42656. }
  42657. var SegmentTypes = [
  42658. 'SymbolDictionary',
  42659. null,
  42660. null,
  42661. null,
  42662. 'IntermediateTextRegion',
  42663. null,
  42664. 'ImmediateTextRegion',
  42665. 'ImmediateLosslessTextRegion',
  42666. null,
  42667. null,
  42668. null,
  42669. null,
  42670. null,
  42671. null,
  42672. null,
  42673. null,
  42674. 'patternDictionary',
  42675. null,
  42676. null,
  42677. null,
  42678. 'IntermediateHalftoneRegion',
  42679. null,
  42680. 'ImmediateHalftoneRegion',
  42681. 'ImmediateLosslessHalftoneRegion',
  42682. null,
  42683. null,
  42684. null,
  42685. null,
  42686. null,
  42687. null,
  42688. null,
  42689. null,
  42690. null,
  42691. null,
  42692. null,
  42693. null,
  42694. 'IntermediateGenericRegion',
  42695. null,
  42696. 'ImmediateGenericRegion',
  42697. 'ImmediateLosslessGenericRegion',
  42698. 'IntermediateGenericRefinementRegion',
  42699. null,
  42700. 'ImmediateGenericRefinementRegion',
  42701. 'ImmediateLosslessGenericRefinementRegion',
  42702. null,
  42703. null,
  42704. null,
  42705. null,
  42706. 'PageInformation',
  42707. 'EndOfPage',
  42708. 'EndOfStripe',
  42709. 'EndOfFile',
  42710. 'Profiles',
  42711. 'Tables',
  42712. null,
  42713. null,
  42714. null,
  42715. null,
  42716. null,
  42717. null,
  42718. null,
  42719. null,
  42720. 'Extension'
  42721. ];
  42722. var CodingTemplates = [
  42723. [
  42724. {
  42725. x: -1,
  42726. y: -2
  42727. },
  42728. {
  42729. x: 0,
  42730. y: -2
  42731. },
  42732. {
  42733. x: 1,
  42734. y: -2
  42735. },
  42736. {
  42737. x: -2,
  42738. y: -1
  42739. },
  42740. {
  42741. x: -1,
  42742. y: -1
  42743. },
  42744. {
  42745. x: 0,
  42746. y: -1
  42747. },
  42748. {
  42749. x: 1,
  42750. y: -1
  42751. },
  42752. {
  42753. x: 2,
  42754. y: -1
  42755. },
  42756. {
  42757. x: -4,
  42758. y: 0
  42759. },
  42760. {
  42761. x: -3,
  42762. y: 0
  42763. },
  42764. {
  42765. x: -2,
  42766. y: 0
  42767. },
  42768. {
  42769. x: -1,
  42770. y: 0
  42771. }
  42772. ],
  42773. [
  42774. {
  42775. x: -1,
  42776. y: -2
  42777. },
  42778. {
  42779. x: 0,
  42780. y: -2
  42781. },
  42782. {
  42783. x: 1,
  42784. y: -2
  42785. },
  42786. {
  42787. x: 2,
  42788. y: -2
  42789. },
  42790. {
  42791. x: -2,
  42792. y: -1
  42793. },
  42794. {
  42795. x: -1,
  42796. y: -1
  42797. },
  42798. {
  42799. x: 0,
  42800. y: -1
  42801. },
  42802. {
  42803. x: 1,
  42804. y: -1
  42805. },
  42806. {
  42807. x: 2,
  42808. y: -1
  42809. },
  42810. {
  42811. x: -3,
  42812. y: 0
  42813. },
  42814. {
  42815. x: -2,
  42816. y: 0
  42817. },
  42818. {
  42819. x: -1,
  42820. y: 0
  42821. }
  42822. ],
  42823. [
  42824. {
  42825. x: -1,
  42826. y: -2
  42827. },
  42828. {
  42829. x: 0,
  42830. y: -2
  42831. },
  42832. {
  42833. x: 1,
  42834. y: -2
  42835. },
  42836. {
  42837. x: -2,
  42838. y: -1
  42839. },
  42840. {
  42841. x: -1,
  42842. y: -1
  42843. },
  42844. {
  42845. x: 0,
  42846. y: -1
  42847. },
  42848. {
  42849. x: 1,
  42850. y: -1
  42851. },
  42852. {
  42853. x: -2,
  42854. y: 0
  42855. },
  42856. {
  42857. x: -1,
  42858. y: 0
  42859. }
  42860. ],
  42861. [
  42862. {
  42863. x: -3,
  42864. y: -1
  42865. },
  42866. {
  42867. x: -2,
  42868. y: -1
  42869. },
  42870. {
  42871. x: -1,
  42872. y: -1
  42873. },
  42874. {
  42875. x: 0,
  42876. y: -1
  42877. },
  42878. {
  42879. x: 1,
  42880. y: -1
  42881. },
  42882. {
  42883. x: -4,
  42884. y: 0
  42885. },
  42886. {
  42887. x: -3,
  42888. y: 0
  42889. },
  42890. {
  42891. x: -2,
  42892. y: 0
  42893. },
  42894. {
  42895. x: -1,
  42896. y: 0
  42897. }
  42898. ]
  42899. ];
  42900. var RefinementTemplates = [
  42901. {
  42902. coding: [
  42903. {
  42904. x: 0,
  42905. y: -1
  42906. },
  42907. {
  42908. x: 1,
  42909. y: -1
  42910. },
  42911. {
  42912. x: -1,
  42913. y: 0
  42914. }
  42915. ],
  42916. reference: [
  42917. {
  42918. x: 0,
  42919. y: -1
  42920. },
  42921. {
  42922. x: 1,
  42923. y: -1
  42924. },
  42925. {
  42926. x: -1,
  42927. y: 0
  42928. },
  42929. {
  42930. x: 0,
  42931. y: 0
  42932. },
  42933. {
  42934. x: 1,
  42935. y: 0
  42936. },
  42937. {
  42938. x: -1,
  42939. y: 1
  42940. },
  42941. {
  42942. x: 0,
  42943. y: 1
  42944. },
  42945. {
  42946. x: 1,
  42947. y: 1
  42948. }
  42949. ]
  42950. },
  42951. {
  42952. coding: [
  42953. {
  42954. x: -1,
  42955. y: -1
  42956. },
  42957. {
  42958. x: 0,
  42959. y: -1
  42960. },
  42961. {
  42962. x: 1,
  42963. y: -1
  42964. },
  42965. {
  42966. x: -1,
  42967. y: 0
  42968. }
  42969. ],
  42970. reference: [
  42971. {
  42972. x: 0,
  42973. y: -1
  42974. },
  42975. {
  42976. x: -1,
  42977. y: 0
  42978. },
  42979. {
  42980. x: 0,
  42981. y: 0
  42982. },
  42983. {
  42984. x: 1,
  42985. y: 0
  42986. },
  42987. {
  42988. x: 0,
  42989. y: 1
  42990. },
  42991. {
  42992. x: 1,
  42993. y: 1
  42994. }
  42995. ]
  42996. }
  42997. ];
  42998. var ReusedContexts = [
  42999. 0x9B25,
  43000. 0x0795,
  43001. 0x00E5,
  43002. 0x0195
  43003. ];
  43004. var RefinementReusedContexts = [
  43005. 0x0020,
  43006. 0x0008
  43007. ];
  43008. function decodeBitmapTemplate0(width, height, decodingContext) {
  43009. var decoder = decodingContext.decoder;
  43010. var contexts = decodingContext.contextCache.getContexts('GB');
  43011. var contextLabel, i, j, pixel, row, row1, row2, bitmap = [];
  43012. var OLD_PIXEL_MASK = 0x7BF7;
  43013. for (i = 0; i < height; i++) {
  43014. row = bitmap[i] = new Uint8Array(width);
  43015. row1 = i < 1 ? row : bitmap[i - 1];
  43016. row2 = i < 2 ? row : bitmap[i - 2];
  43017. contextLabel = row2[0] << 13 | row2[1] << 12 | row2[2] << 11 | row1[0] << 7 | row1[1] << 6 | row1[2] << 5 | row1[3] << 4;
  43018. for (j = 0; j < width; j++) {
  43019. row[j] = pixel = decoder.readBit(contexts, contextLabel);
  43020. contextLabel = (contextLabel & OLD_PIXEL_MASK) << 1 | (j + 3 < width ? row2[j + 3] << 11 : 0) | (j + 4 < width ? row1[j + 4] << 4 : 0) | pixel;
  43021. }
  43022. }
  43023. return bitmap;
  43024. }
  43025. function decodeBitmap(mmr, width, height, templateIndex, prediction, skip, at, decodingContext) {
  43026. if (mmr) {
  43027. error('JBIG2 error: MMR encoding is not supported');
  43028. }
  43029. 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) {
  43030. return decodeBitmapTemplate0(width, height, decodingContext);
  43031. }
  43032. var useskip = !!skip;
  43033. var template = CodingTemplates[templateIndex].concat(at);
  43034. template.sort(function (a, b) {
  43035. return a.y - b.y || a.x - b.x;
  43036. });
  43037. var templateLength = template.length;
  43038. var templateX = new Int8Array(templateLength);
  43039. var templateY = new Int8Array(templateLength);
  43040. var changingTemplateEntries = [];
  43041. var reuseMask = 0, minX = 0, maxX = 0, minY = 0;
  43042. var c, k;
  43043. for (k = 0; k < templateLength; k++) {
  43044. templateX[k] = template[k].x;
  43045. templateY[k] = template[k].y;
  43046. minX = Math.min(minX, template[k].x);
  43047. maxX = Math.max(maxX, template[k].x);
  43048. minY = Math.min(minY, template[k].y);
  43049. if (k < templateLength - 1 && template[k].y === template[k + 1].y && template[k].x === template[k + 1].x - 1) {
  43050. reuseMask |= 1 << templateLength - 1 - k;
  43051. } else {
  43052. changingTemplateEntries.push(k);
  43053. }
  43054. }
  43055. var changingEntriesLength = changingTemplateEntries.length;
  43056. var changingTemplateX = new Int8Array(changingEntriesLength);
  43057. var changingTemplateY = new Int8Array(changingEntriesLength);
  43058. var changingTemplateBit = new Uint16Array(changingEntriesLength);
  43059. for (c = 0; c < changingEntriesLength; c++) {
  43060. k = changingTemplateEntries[c];
  43061. changingTemplateX[c] = template[k].x;
  43062. changingTemplateY[c] = template[k].y;
  43063. changingTemplateBit[c] = 1 << templateLength - 1 - k;
  43064. }
  43065. var sbb_left = -minX;
  43066. var sbb_top = -minY;
  43067. var sbb_right = width - maxX;
  43068. var pseudoPixelContext = ReusedContexts[templateIndex];
  43069. var row = new Uint8Array(width);
  43070. var bitmap = [];
  43071. var decoder = decodingContext.decoder;
  43072. var contexts = decodingContext.contextCache.getContexts('GB');
  43073. var ltp = 0, j, i0, j0, contextLabel = 0, bit, shift;
  43074. for (var i = 0; i < height; i++) {
  43075. if (prediction) {
  43076. var sltp = decoder.readBit(contexts, pseudoPixelContext);
  43077. ltp ^= sltp;
  43078. if (ltp) {
  43079. bitmap.push(row);
  43080. continue;
  43081. }
  43082. }
  43083. row = new Uint8Array(row);
  43084. bitmap.push(row);
  43085. for (j = 0; j < width; j++) {
  43086. if (useskip && skip[i][j]) {
  43087. row[j] = 0;
  43088. continue;
  43089. }
  43090. if (j >= sbb_left && j < sbb_right && i >= sbb_top) {
  43091. contextLabel = contextLabel << 1 & reuseMask;
  43092. for (k = 0; k < changingEntriesLength; k++) {
  43093. i0 = i + changingTemplateY[k];
  43094. j0 = j + changingTemplateX[k];
  43095. bit = bitmap[i0][j0];
  43096. if (bit) {
  43097. bit = changingTemplateBit[k];
  43098. contextLabel |= bit;
  43099. }
  43100. }
  43101. } else {
  43102. contextLabel = 0;
  43103. shift = templateLength - 1;
  43104. for (k = 0; k < templateLength; k++, shift--) {
  43105. j0 = j + templateX[k];
  43106. if (j0 >= 0 && j0 < width) {
  43107. i0 = i + templateY[k];
  43108. if (i0 >= 0) {
  43109. bit = bitmap[i0][j0];
  43110. if (bit) {
  43111. contextLabel |= bit << shift;
  43112. }
  43113. }
  43114. }
  43115. }
  43116. }
  43117. var pixel = decoder.readBit(contexts, contextLabel);
  43118. row[j] = pixel;
  43119. }
  43120. }
  43121. return bitmap;
  43122. }
  43123. function decodeRefinement(width, height, templateIndex, referenceBitmap, offsetX, offsetY, prediction, at, decodingContext) {
  43124. var codingTemplate = RefinementTemplates[templateIndex].coding;
  43125. if (templateIndex === 0) {
  43126. codingTemplate = codingTemplate.concat([at[0]]);
  43127. }
  43128. var codingTemplateLength = codingTemplate.length;
  43129. var codingTemplateX = new Int32Array(codingTemplateLength);
  43130. var codingTemplateY = new Int32Array(codingTemplateLength);
  43131. var k;
  43132. for (k = 0; k < codingTemplateLength; k++) {
  43133. codingTemplateX[k] = codingTemplate[k].x;
  43134. codingTemplateY[k] = codingTemplate[k].y;
  43135. }
  43136. var referenceTemplate = RefinementTemplates[templateIndex].reference;
  43137. if (templateIndex === 0) {
  43138. referenceTemplate = referenceTemplate.concat([at[1]]);
  43139. }
  43140. var referenceTemplateLength = referenceTemplate.length;
  43141. var referenceTemplateX = new Int32Array(referenceTemplateLength);
  43142. var referenceTemplateY = new Int32Array(referenceTemplateLength);
  43143. for (k = 0; k < referenceTemplateLength; k++) {
  43144. referenceTemplateX[k] = referenceTemplate[k].x;
  43145. referenceTemplateY[k] = referenceTemplate[k].y;
  43146. }
  43147. var referenceWidth = referenceBitmap[0].length;
  43148. var referenceHeight = referenceBitmap.length;
  43149. var pseudoPixelContext = RefinementReusedContexts[templateIndex];
  43150. var bitmap = [];
  43151. var decoder = decodingContext.decoder;
  43152. var contexts = decodingContext.contextCache.getContexts('GR');
  43153. var ltp = 0;
  43154. for (var i = 0; i < height; i++) {
  43155. if (prediction) {
  43156. var sltp = decoder.readBit(contexts, pseudoPixelContext);
  43157. ltp ^= sltp;
  43158. if (ltp) {
  43159. error('JBIG2 error: prediction is not supported');
  43160. }
  43161. }
  43162. var row = new Uint8Array(width);
  43163. bitmap.push(row);
  43164. for (var j = 0; j < width; j++) {
  43165. var i0, j0;
  43166. var contextLabel = 0;
  43167. for (k = 0; k < codingTemplateLength; k++) {
  43168. i0 = i + codingTemplateY[k];
  43169. j0 = j + codingTemplateX[k];
  43170. if (i0 < 0 || j0 < 0 || j0 >= width) {
  43171. contextLabel <<= 1;
  43172. } else {
  43173. contextLabel = contextLabel << 1 | bitmap[i0][j0];
  43174. }
  43175. }
  43176. for (k = 0; k < referenceTemplateLength; k++) {
  43177. i0 = i + referenceTemplateY[k] + offsetY;
  43178. j0 = j + referenceTemplateX[k] + offsetX;
  43179. if (i0 < 0 || i0 >= referenceHeight || j0 < 0 || j0 >= referenceWidth) {
  43180. contextLabel <<= 1;
  43181. } else {
  43182. contextLabel = contextLabel << 1 | referenceBitmap[i0][j0];
  43183. }
  43184. }
  43185. var pixel = decoder.readBit(contexts, contextLabel);
  43186. row[j] = pixel;
  43187. }
  43188. }
  43189. return bitmap;
  43190. }
  43191. function decodeSymbolDictionary(huffman, refinement, symbols, numberOfNewSymbols, numberOfExportedSymbols, huffmanTables, templateIndex, at, refinementTemplateIndex, refinementAt, decodingContext) {
  43192. if (huffman) {
  43193. error('JBIG2 error: huffman is not supported');
  43194. }
  43195. var newSymbols = [];
  43196. var currentHeight = 0;
  43197. var symbolCodeLength = log2(symbols.length + numberOfNewSymbols);
  43198. var decoder = decodingContext.decoder;
  43199. var contextCache = decodingContext.contextCache;
  43200. while (newSymbols.length < numberOfNewSymbols) {
  43201. var deltaHeight = decodeInteger(contextCache, 'IADH', decoder);
  43202. currentHeight += deltaHeight;
  43203. var currentWidth = 0;
  43204. while (true) {
  43205. var deltaWidth = decodeInteger(contextCache, 'IADW', decoder);
  43206. if (deltaWidth === null) {
  43207. break;
  43208. }
  43209. currentWidth += deltaWidth;
  43210. var bitmap;
  43211. if (refinement) {
  43212. var numberOfInstances = decodeInteger(contextCache, 'IAAI', decoder);
  43213. if (numberOfInstances > 1) {
  43214. bitmap = decodeTextRegion(huffman, refinement, currentWidth, currentHeight, 0, numberOfInstances, 1, symbols.concat(newSymbols), symbolCodeLength, 0, 0, 1, 0, huffmanTables, refinementTemplateIndex, refinementAt, decodingContext);
  43215. } else {
  43216. var symbolId = decodeIAID(contextCache, decoder, symbolCodeLength);
  43217. var rdx = decodeInteger(contextCache, 'IARDX', decoder);
  43218. var rdy = decodeInteger(contextCache, 'IARDY', decoder);
  43219. var symbol = symbolId < symbols.length ? symbols[symbolId] : newSymbols[symbolId - symbols.length];
  43220. bitmap = decodeRefinement(currentWidth, currentHeight, refinementTemplateIndex, symbol, rdx, rdy, false, refinementAt, decodingContext);
  43221. }
  43222. } else {
  43223. bitmap = decodeBitmap(false, currentWidth, currentHeight, templateIndex, false, null, at, decodingContext);
  43224. }
  43225. newSymbols.push(bitmap);
  43226. }
  43227. }
  43228. var exportedSymbols = [];
  43229. var flags = [], currentFlag = false;
  43230. var totalSymbolsLength = symbols.length + numberOfNewSymbols;
  43231. while (flags.length < totalSymbolsLength) {
  43232. var runLength = decodeInteger(contextCache, 'IAEX', decoder);
  43233. while (runLength--) {
  43234. flags.push(currentFlag);
  43235. }
  43236. currentFlag = !currentFlag;
  43237. }
  43238. for (var i = 0, ii = symbols.length; i < ii; i++) {
  43239. if (flags[i]) {
  43240. exportedSymbols.push(symbols[i]);
  43241. }
  43242. }
  43243. for (var j = 0; j < numberOfNewSymbols; i++, j++) {
  43244. if (flags[i]) {
  43245. exportedSymbols.push(newSymbols[j]);
  43246. }
  43247. }
  43248. return exportedSymbols;
  43249. }
  43250. function decodeTextRegion(huffman, refinement, width, height, defaultPixelValue, numberOfSymbolInstances, stripSize, inputSymbols, symbolCodeLength, transposed, dsOffset, referenceCorner, combinationOperator, huffmanTables, refinementTemplateIndex, refinementAt, decodingContext) {
  43251. if (huffman) {
  43252. error('JBIG2 error: huffman is not supported');
  43253. }
  43254. var bitmap = [];
  43255. var i, row;
  43256. for (i = 0; i < height; i++) {
  43257. row = new Uint8Array(width);
  43258. if (defaultPixelValue) {
  43259. for (var j = 0; j < width; j++) {
  43260. row[j] = defaultPixelValue;
  43261. }
  43262. }
  43263. bitmap.push(row);
  43264. }
  43265. var decoder = decodingContext.decoder;
  43266. var contextCache = decodingContext.contextCache;
  43267. var stripT = -decodeInteger(contextCache, 'IADT', decoder);
  43268. var firstS = 0;
  43269. i = 0;
  43270. while (i < numberOfSymbolInstances) {
  43271. var deltaT = decodeInteger(contextCache, 'IADT', decoder);
  43272. stripT += deltaT;
  43273. var deltaFirstS = decodeInteger(contextCache, 'IAFS', decoder);
  43274. firstS += deltaFirstS;
  43275. var currentS = firstS;
  43276. do {
  43277. var currentT = stripSize === 1 ? 0 : decodeInteger(contextCache, 'IAIT', decoder);
  43278. var t = stripSize * stripT + currentT;
  43279. var symbolId = decodeIAID(contextCache, decoder, symbolCodeLength);
  43280. var applyRefinement = refinement && decodeInteger(contextCache, 'IARI', decoder);
  43281. var symbolBitmap = inputSymbols[symbolId];
  43282. var symbolWidth = symbolBitmap[0].length;
  43283. var symbolHeight = symbolBitmap.length;
  43284. if (applyRefinement) {
  43285. var rdw = decodeInteger(contextCache, 'IARDW', decoder);
  43286. var rdh = decodeInteger(contextCache, 'IARDH', decoder);
  43287. var rdx = decodeInteger(contextCache, 'IARDX', decoder);
  43288. var rdy = decodeInteger(contextCache, 'IARDY', decoder);
  43289. symbolWidth += rdw;
  43290. symbolHeight += rdh;
  43291. symbolBitmap = decodeRefinement(symbolWidth, symbolHeight, refinementTemplateIndex, symbolBitmap, (rdw >> 1) + rdx, (rdh >> 1) + rdy, false, refinementAt, decodingContext);
  43292. }
  43293. var offsetT = t - (referenceCorner & 1 ? 0 : symbolHeight);
  43294. var offsetS = currentS - (referenceCorner & 2 ? symbolWidth : 0);
  43295. var s2, t2, symbolRow;
  43296. if (transposed) {
  43297. for (s2 = 0; s2 < symbolHeight; s2++) {
  43298. row = bitmap[offsetS + s2];
  43299. if (!row) {
  43300. continue;
  43301. }
  43302. symbolRow = symbolBitmap[s2];
  43303. var maxWidth = Math.min(width - offsetT, symbolWidth);
  43304. switch (combinationOperator) {
  43305. case 0:
  43306. for (t2 = 0; t2 < maxWidth; t2++) {
  43307. row[offsetT + t2] |= symbolRow[t2];
  43308. }
  43309. break;
  43310. case 2:
  43311. for (t2 = 0; t2 < maxWidth; t2++) {
  43312. row[offsetT + t2] ^= symbolRow[t2];
  43313. }
  43314. break;
  43315. default:
  43316. error('JBIG2 error: operator ' + combinationOperator + ' is not supported');
  43317. }
  43318. }
  43319. currentS += symbolHeight - 1;
  43320. } else {
  43321. for (t2 = 0; t2 < symbolHeight; t2++) {
  43322. row = bitmap[offsetT + t2];
  43323. if (!row) {
  43324. continue;
  43325. }
  43326. symbolRow = symbolBitmap[t2];
  43327. switch (combinationOperator) {
  43328. case 0:
  43329. for (s2 = 0; s2 < symbolWidth; s2++) {
  43330. row[offsetS + s2] |= symbolRow[s2];
  43331. }
  43332. break;
  43333. case 2:
  43334. for (s2 = 0; s2 < symbolWidth; s2++) {
  43335. row[offsetS + s2] ^= symbolRow[s2];
  43336. }
  43337. break;
  43338. default:
  43339. error('JBIG2 error: operator ' + combinationOperator + ' is not supported');
  43340. }
  43341. }
  43342. currentS += symbolWidth - 1;
  43343. }
  43344. i++;
  43345. var deltaS = decodeInteger(contextCache, 'IADS', decoder);
  43346. if (deltaS === null) {
  43347. break;
  43348. }
  43349. currentS += deltaS + dsOffset;
  43350. } while (true);
  43351. }
  43352. return bitmap;
  43353. }
  43354. function readSegmentHeader(data, start) {
  43355. var segmentHeader = {};
  43356. segmentHeader.number = readUint32(data, start);
  43357. var flags = data[start + 4];
  43358. var segmentType = flags & 0x3F;
  43359. if (!SegmentTypes[segmentType]) {
  43360. error('JBIG2 error: invalid segment type: ' + segmentType);
  43361. }
  43362. segmentHeader.type = segmentType;
  43363. segmentHeader.typeName = SegmentTypes[segmentType];
  43364. segmentHeader.deferredNonRetain = !!(flags & 0x80);
  43365. var pageAssociationFieldSize = !!(flags & 0x40);
  43366. var referredFlags = data[start + 5];
  43367. var referredToCount = referredFlags >> 5 & 7;
  43368. var retainBits = [referredFlags & 31];
  43369. var position = start + 6;
  43370. if (referredFlags === 7) {
  43371. referredToCount = readUint32(data, position - 1) & 0x1FFFFFFF;
  43372. position += 3;
  43373. var bytes = referredToCount + 7 >> 3;
  43374. retainBits[0] = data[position++];
  43375. while (--bytes > 0) {
  43376. retainBits.push(data[position++]);
  43377. }
  43378. } else if (referredFlags === 5 || referredFlags === 6) {
  43379. error('JBIG2 error: invalid referred-to flags');
  43380. }
  43381. segmentHeader.retainBits = retainBits;
  43382. var referredToSegmentNumberSize = segmentHeader.number <= 256 ? 1 : segmentHeader.number <= 65536 ? 2 : 4;
  43383. var referredTo = [];
  43384. var i, ii;
  43385. for (i = 0; i < referredToCount; i++) {
  43386. var number = referredToSegmentNumberSize === 1 ? data[position] : referredToSegmentNumberSize === 2 ? readUint16(data, position) : readUint32(data, position);
  43387. referredTo.push(number);
  43388. position += referredToSegmentNumberSize;
  43389. }
  43390. segmentHeader.referredTo = referredTo;
  43391. if (!pageAssociationFieldSize) {
  43392. segmentHeader.pageAssociation = data[position++];
  43393. } else {
  43394. segmentHeader.pageAssociation = readUint32(data, position);
  43395. position += 4;
  43396. }
  43397. segmentHeader.length = readUint32(data, position);
  43398. position += 4;
  43399. if (segmentHeader.length === 0xFFFFFFFF) {
  43400. if (segmentType === 38) {
  43401. var genericRegionInfo = readRegionSegmentInformation(data, position);
  43402. var genericRegionSegmentFlags = data[position + RegionSegmentInformationFieldLength];
  43403. var genericRegionMmr = !!(genericRegionSegmentFlags & 1);
  43404. var searchPatternLength = 6;
  43405. var searchPattern = new Uint8Array(searchPatternLength);
  43406. if (!genericRegionMmr) {
  43407. searchPattern[0] = 0xFF;
  43408. searchPattern[1] = 0xAC;
  43409. }
  43410. searchPattern[2] = genericRegionInfo.height >>> 24 & 0xFF;
  43411. searchPattern[3] = genericRegionInfo.height >> 16 & 0xFF;
  43412. searchPattern[4] = genericRegionInfo.height >> 8 & 0xFF;
  43413. searchPattern[5] = genericRegionInfo.height & 0xFF;
  43414. for (i = position, ii = data.length; i < ii; i++) {
  43415. var j = 0;
  43416. while (j < searchPatternLength && searchPattern[j] === data[i + j]) {
  43417. j++;
  43418. }
  43419. if (j === searchPatternLength) {
  43420. segmentHeader.length = i + searchPatternLength;
  43421. break;
  43422. }
  43423. }
  43424. if (segmentHeader.length === 0xFFFFFFFF) {
  43425. error('JBIG2 error: segment end was not found');
  43426. }
  43427. } else {
  43428. error('JBIG2 error: invalid unknown segment length');
  43429. }
  43430. }
  43431. segmentHeader.headerEnd = position;
  43432. return segmentHeader;
  43433. }
  43434. function readSegments(header, data, start, end) {
  43435. var segments = [];
  43436. var position = start;
  43437. while (position < end) {
  43438. var segmentHeader = readSegmentHeader(data, position);
  43439. position = segmentHeader.headerEnd;
  43440. var segment = {
  43441. header: segmentHeader,
  43442. data: data
  43443. };
  43444. if (!header.randomAccess) {
  43445. segment.start = position;
  43446. position += segmentHeader.length;
  43447. segment.end = position;
  43448. }
  43449. segments.push(segment);
  43450. if (segmentHeader.type === 51) {
  43451. break;
  43452. }
  43453. }
  43454. if (header.randomAccess) {
  43455. for (var i = 0, ii = segments.length; i < ii; i++) {
  43456. segments[i].start = position;
  43457. position += segments[i].header.length;
  43458. segments[i].end = position;
  43459. }
  43460. }
  43461. return segments;
  43462. }
  43463. function readRegionSegmentInformation(data, start) {
  43464. return {
  43465. width: readUint32(data, start),
  43466. height: readUint32(data, start + 4),
  43467. x: readUint32(data, start + 8),
  43468. y: readUint32(data, start + 12),
  43469. combinationOperator: data[start + 16] & 7
  43470. };
  43471. }
  43472. var RegionSegmentInformationFieldLength = 17;
  43473. function processSegment(segment, visitor) {
  43474. var header = segment.header;
  43475. var data = segment.data, position = segment.start, end = segment.end;
  43476. var args, at, i, atLength;
  43477. switch (header.type) {
  43478. case 0:
  43479. var dictionary = {};
  43480. var dictionaryFlags = readUint16(data, position);
  43481. dictionary.huffman = !!(dictionaryFlags & 1);
  43482. dictionary.refinement = !!(dictionaryFlags & 2);
  43483. dictionary.huffmanDHSelector = dictionaryFlags >> 2 & 3;
  43484. dictionary.huffmanDWSelector = dictionaryFlags >> 4 & 3;
  43485. dictionary.bitmapSizeSelector = dictionaryFlags >> 6 & 1;
  43486. dictionary.aggregationInstancesSelector = dictionaryFlags >> 7 & 1;
  43487. dictionary.bitmapCodingContextUsed = !!(dictionaryFlags & 256);
  43488. dictionary.bitmapCodingContextRetained = !!(dictionaryFlags & 512);
  43489. dictionary.template = dictionaryFlags >> 10 & 3;
  43490. dictionary.refinementTemplate = dictionaryFlags >> 12 & 1;
  43491. position += 2;
  43492. if (!dictionary.huffman) {
  43493. atLength = dictionary.template === 0 ? 4 : 1;
  43494. at = [];
  43495. for (i = 0; i < atLength; i++) {
  43496. at.push({
  43497. x: readInt8(data, position),
  43498. y: readInt8(data, position + 1)
  43499. });
  43500. position += 2;
  43501. }
  43502. dictionary.at = at;
  43503. }
  43504. if (dictionary.refinement && !dictionary.refinementTemplate) {
  43505. at = [];
  43506. for (i = 0; i < 2; i++) {
  43507. at.push({
  43508. x: readInt8(data, position),
  43509. y: readInt8(data, position + 1)
  43510. });
  43511. position += 2;
  43512. }
  43513. dictionary.refinementAt = at;
  43514. }
  43515. dictionary.numberOfExportedSymbols = readUint32(data, position);
  43516. position += 4;
  43517. dictionary.numberOfNewSymbols = readUint32(data, position);
  43518. position += 4;
  43519. args = [
  43520. dictionary,
  43521. header.number,
  43522. header.referredTo,
  43523. data,
  43524. position,
  43525. end
  43526. ];
  43527. break;
  43528. case 6:
  43529. case 7:
  43530. var textRegion = {};
  43531. textRegion.info = readRegionSegmentInformation(data, position);
  43532. position += RegionSegmentInformationFieldLength;
  43533. var textRegionSegmentFlags = readUint16(data, position);
  43534. position += 2;
  43535. textRegion.huffman = !!(textRegionSegmentFlags & 1);
  43536. textRegion.refinement = !!(textRegionSegmentFlags & 2);
  43537. textRegion.stripSize = 1 << (textRegionSegmentFlags >> 2 & 3);
  43538. textRegion.referenceCorner = textRegionSegmentFlags >> 4 & 3;
  43539. textRegion.transposed = !!(textRegionSegmentFlags & 64);
  43540. textRegion.combinationOperator = textRegionSegmentFlags >> 7 & 3;
  43541. textRegion.defaultPixelValue = textRegionSegmentFlags >> 9 & 1;
  43542. textRegion.dsOffset = textRegionSegmentFlags << 17 >> 27;
  43543. textRegion.refinementTemplate = textRegionSegmentFlags >> 15 & 1;
  43544. if (textRegion.huffman) {
  43545. var textRegionHuffmanFlags = readUint16(data, position);
  43546. position += 2;
  43547. textRegion.huffmanFS = textRegionHuffmanFlags & 3;
  43548. textRegion.huffmanDS = textRegionHuffmanFlags >> 2 & 3;
  43549. textRegion.huffmanDT = textRegionHuffmanFlags >> 4 & 3;
  43550. textRegion.huffmanRefinementDW = textRegionHuffmanFlags >> 6 & 3;
  43551. textRegion.huffmanRefinementDH = textRegionHuffmanFlags >> 8 & 3;
  43552. textRegion.huffmanRefinementDX = textRegionHuffmanFlags >> 10 & 3;
  43553. textRegion.huffmanRefinementDY = textRegionHuffmanFlags >> 12 & 3;
  43554. textRegion.huffmanRefinementSizeSelector = !!(textRegionHuffmanFlags & 14);
  43555. }
  43556. if (textRegion.refinement && !textRegion.refinementTemplate) {
  43557. at = [];
  43558. for (i = 0; i < 2; i++) {
  43559. at.push({
  43560. x: readInt8(data, position),
  43561. y: readInt8(data, position + 1)
  43562. });
  43563. position += 2;
  43564. }
  43565. textRegion.refinementAt = at;
  43566. }
  43567. textRegion.numberOfSymbolInstances = readUint32(data, position);
  43568. position += 4;
  43569. if (textRegion.huffman) {
  43570. error('JBIG2 error: huffman is not supported');
  43571. }
  43572. args = [
  43573. textRegion,
  43574. header.referredTo,
  43575. data,
  43576. position,
  43577. end
  43578. ];
  43579. break;
  43580. case 38:
  43581. case 39:
  43582. var genericRegion = {};
  43583. genericRegion.info = readRegionSegmentInformation(data, position);
  43584. position += RegionSegmentInformationFieldLength;
  43585. var genericRegionSegmentFlags = data[position++];
  43586. genericRegion.mmr = !!(genericRegionSegmentFlags & 1);
  43587. genericRegion.template = genericRegionSegmentFlags >> 1 & 3;
  43588. genericRegion.prediction = !!(genericRegionSegmentFlags & 8);
  43589. if (!genericRegion.mmr) {
  43590. atLength = genericRegion.template === 0 ? 4 : 1;
  43591. at = [];
  43592. for (i = 0; i < atLength; i++) {
  43593. at.push({
  43594. x: readInt8(data, position),
  43595. y: readInt8(data, position + 1)
  43596. });
  43597. position += 2;
  43598. }
  43599. genericRegion.at = at;
  43600. }
  43601. args = [
  43602. genericRegion,
  43603. data,
  43604. position,
  43605. end
  43606. ];
  43607. break;
  43608. case 48:
  43609. var pageInfo = {
  43610. width: readUint32(data, position),
  43611. height: readUint32(data, position + 4),
  43612. resolutionX: readUint32(data, position + 8),
  43613. resolutionY: readUint32(data, position + 12)
  43614. };
  43615. if (pageInfo.height === 0xFFFFFFFF) {
  43616. delete pageInfo.height;
  43617. }
  43618. var pageSegmentFlags = data[position + 16];
  43619. readUint16(data, position + 17);
  43620. pageInfo.lossless = !!(pageSegmentFlags & 1);
  43621. pageInfo.refinement = !!(pageSegmentFlags & 2);
  43622. pageInfo.defaultPixelValue = pageSegmentFlags >> 2 & 1;
  43623. pageInfo.combinationOperator = pageSegmentFlags >> 3 & 3;
  43624. pageInfo.requiresBuffer = !!(pageSegmentFlags & 32);
  43625. pageInfo.combinationOperatorOverride = !!(pageSegmentFlags & 64);
  43626. args = [pageInfo];
  43627. break;
  43628. case 49:
  43629. break;
  43630. case 50:
  43631. break;
  43632. case 51:
  43633. break;
  43634. case 62:
  43635. break;
  43636. default:
  43637. error('JBIG2 error: segment type ' + header.typeName + '(' + header.type + ') is not implemented');
  43638. }
  43639. var callbackName = 'on' + header.typeName;
  43640. if (callbackName in visitor) {
  43641. visitor[callbackName].apply(visitor, args);
  43642. }
  43643. }
  43644. function processSegments(segments, visitor) {
  43645. for (var i = 0, ii = segments.length; i < ii; i++) {
  43646. processSegment(segments[i], visitor);
  43647. }
  43648. }
  43649. function parseJbig2(data, start, end) {
  43650. var position = start;
  43651. 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) {
  43652. error('JBIG2 error: invalid header');
  43653. }
  43654. var header = {};
  43655. position += 8;
  43656. var flags = data[position++];
  43657. header.randomAccess = !(flags & 1);
  43658. if (!(flags & 2)) {
  43659. header.numberOfPages = readUint32(data, position);
  43660. position += 4;
  43661. }
  43662. readSegments(header, data, position, end);
  43663. error('Not implemented');
  43664. }
  43665. function parseJbig2Chunks(chunks) {
  43666. var visitor = new SimpleSegmentVisitor();
  43667. for (var i = 0, ii = chunks.length; i < ii; i++) {
  43668. var chunk = chunks[i];
  43669. var segments = readSegments({}, chunk.data, chunk.start, chunk.end);
  43670. processSegments(segments, visitor);
  43671. }
  43672. return visitor.buffer;
  43673. }
  43674. function SimpleSegmentVisitor() {
  43675. }
  43676. SimpleSegmentVisitor.prototype = {
  43677. onPageInformation: function SimpleSegmentVisitor_onPageInformation(info) {
  43678. this.currentPageInfo = info;
  43679. var rowSize = info.width + 7 >> 3;
  43680. var buffer = new Uint8Array(rowSize * info.height);
  43681. if (info.defaultPixelValue) {
  43682. for (var i = 0, ii = buffer.length; i < ii; i++) {
  43683. buffer[i] = 0xFF;
  43684. }
  43685. }
  43686. this.buffer = buffer;
  43687. },
  43688. drawBitmap: function SimpleSegmentVisitor_drawBitmap(regionInfo, bitmap) {
  43689. var pageInfo = this.currentPageInfo;
  43690. var width = regionInfo.width, height = regionInfo.height;
  43691. var rowSize = pageInfo.width + 7 >> 3;
  43692. var combinationOperator = pageInfo.combinationOperatorOverride ? regionInfo.combinationOperator : pageInfo.combinationOperator;
  43693. var buffer = this.buffer;
  43694. var mask0 = 128 >> (regionInfo.x & 7);
  43695. var offset0 = regionInfo.y * rowSize + (regionInfo.x >> 3);
  43696. var i, j, mask, offset;
  43697. switch (combinationOperator) {
  43698. case 0:
  43699. for (i = 0; i < height; i++) {
  43700. mask = mask0;
  43701. offset = offset0;
  43702. for (j = 0; j < width; j++) {
  43703. if (bitmap[i][j]) {
  43704. buffer[offset] |= mask;
  43705. }
  43706. mask >>= 1;
  43707. if (!mask) {
  43708. mask = 128;
  43709. offset++;
  43710. }
  43711. }
  43712. offset0 += rowSize;
  43713. }
  43714. break;
  43715. case 2:
  43716. for (i = 0; i < height; i++) {
  43717. mask = mask0;
  43718. offset = offset0;
  43719. for (j = 0; j < width; j++) {
  43720. if (bitmap[i][j]) {
  43721. buffer[offset] ^= mask;
  43722. }
  43723. mask >>= 1;
  43724. if (!mask) {
  43725. mask = 128;
  43726. offset++;
  43727. }
  43728. }
  43729. offset0 += rowSize;
  43730. }
  43731. break;
  43732. default:
  43733. error('JBIG2 error: operator ' + combinationOperator + ' is not supported');
  43734. }
  43735. },
  43736. onImmediateGenericRegion: function SimpleSegmentVisitor_onImmediateGenericRegion(region, data, start, end) {
  43737. var regionInfo = region.info;
  43738. var decodingContext = new DecodingContext(data, start, end);
  43739. var bitmap = decodeBitmap(region.mmr, regionInfo.width, regionInfo.height, region.template, region.prediction, null, region.at, decodingContext);
  43740. this.drawBitmap(regionInfo, bitmap);
  43741. },
  43742. onImmediateLosslessGenericRegion: function SimpleSegmentVisitor_onImmediateLosslessGenericRegion() {
  43743. this.onImmediateGenericRegion.apply(this, arguments);
  43744. },
  43745. onSymbolDictionary: function SimpleSegmentVisitor_onSymbolDictionary(dictionary, currentSegment, referredSegments, data, start, end) {
  43746. var huffmanTables;
  43747. if (dictionary.huffman) {
  43748. error('JBIG2 error: huffman is not supported');
  43749. }
  43750. var symbols = this.symbols;
  43751. if (!symbols) {
  43752. this.symbols = symbols = {};
  43753. }
  43754. var inputSymbols = [];
  43755. for (var i = 0, ii = referredSegments.length; i < ii; i++) {
  43756. inputSymbols = inputSymbols.concat(symbols[referredSegments[i]]);
  43757. }
  43758. var decodingContext = new DecodingContext(data, start, end);
  43759. symbols[currentSegment] = decodeSymbolDictionary(dictionary.huffman, dictionary.refinement, inputSymbols, dictionary.numberOfNewSymbols, dictionary.numberOfExportedSymbols, huffmanTables, dictionary.template, dictionary.at, dictionary.refinementTemplate, dictionary.refinementAt, decodingContext);
  43760. },
  43761. onImmediateTextRegion: function SimpleSegmentVisitor_onImmediateTextRegion(region, referredSegments, data, start, end) {
  43762. var regionInfo = region.info;
  43763. var huffmanTables;
  43764. var symbols = this.symbols;
  43765. var inputSymbols = [];
  43766. for (var i = 0, ii = referredSegments.length; i < ii; i++) {
  43767. inputSymbols = inputSymbols.concat(symbols[referredSegments[i]]);
  43768. }
  43769. var symbolCodeLength = log2(inputSymbols.length);
  43770. var decodingContext = new DecodingContext(data, start, end);
  43771. 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);
  43772. this.drawBitmap(regionInfo, bitmap);
  43773. },
  43774. onImmediateLosslessTextRegion: function SimpleSegmentVisitor_onImmediateLosslessTextRegion() {
  43775. this.onImmediateTextRegion.apply(this, arguments);
  43776. }
  43777. };
  43778. function Jbig2Image() {
  43779. }
  43780. Jbig2Image.prototype = {
  43781. parseChunks: function Jbig2Image_parseChunks(chunks) {
  43782. return parseJbig2Chunks(chunks);
  43783. }
  43784. };
  43785. return Jbig2Image;
  43786. }();
  43787. exports.Jbig2Image = Jbig2Image;
  43788. /***/ }),
  43789. /* 29 */
  43790. /***/ (function(module, exports, __w_pdfjs_require__) {
  43791. "use strict";
  43792. var sharedUtil = __w_pdfjs_require__(0);
  43793. var error = sharedUtil.error;
  43794. var JpegImage = function JpegImageClosure() {
  43795. var dctZigZag = new Uint8Array([
  43796. 0,
  43797. 1,
  43798. 8,
  43799. 16,
  43800. 9,
  43801. 2,
  43802. 3,
  43803. 10,
  43804. 17,
  43805. 24,
  43806. 32,
  43807. 25,
  43808. 18,
  43809. 11,
  43810. 4,
  43811. 5,
  43812. 12,
  43813. 19,
  43814. 26,
  43815. 33,
  43816. 40,
  43817. 48,
  43818. 41,
  43819. 34,
  43820. 27,
  43821. 20,
  43822. 13,
  43823. 6,
  43824. 7,
  43825. 14,
  43826. 21,
  43827. 28,
  43828. 35,
  43829. 42,
  43830. 49,
  43831. 56,
  43832. 57,
  43833. 50,
  43834. 43,
  43835. 36,
  43836. 29,
  43837. 22,
  43838. 15,
  43839. 23,
  43840. 30,
  43841. 37,
  43842. 44,
  43843. 51,
  43844. 58,
  43845. 59,
  43846. 52,
  43847. 45,
  43848. 38,
  43849. 31,
  43850. 39,
  43851. 46,
  43852. 53,
  43853. 60,
  43854. 61,
  43855. 54,
  43856. 47,
  43857. 55,
  43858. 62,
  43859. 63
  43860. ]);
  43861. var dctCos1 = 4017;
  43862. var dctSin1 = 799;
  43863. var dctCos3 = 3406;
  43864. var dctSin3 = 2276;
  43865. var dctCos6 = 1567;
  43866. var dctSin6 = 3784;
  43867. var dctSqrt2 = 5793;
  43868. var dctSqrt1d2 = 2896;
  43869. function JpegImage() {
  43870. this.decodeTransform = null;
  43871. this.colorTransform = -1;
  43872. }
  43873. function buildHuffmanTable(codeLengths, values) {
  43874. var k = 0, code = [], i, j, length = 16;
  43875. while (length > 0 && !codeLengths[length - 1]) {
  43876. length--;
  43877. }
  43878. code.push({
  43879. children: [],
  43880. index: 0
  43881. });
  43882. var p = code[0], q;
  43883. for (i = 0; i < length; i++) {
  43884. for (j = 0; j < codeLengths[i]; j++) {
  43885. p = code.pop();
  43886. p.children[p.index] = values[k];
  43887. while (p.index > 0) {
  43888. p = code.pop();
  43889. }
  43890. p.index++;
  43891. code.push(p);
  43892. while (code.length <= i) {
  43893. code.push(q = {
  43894. children: [],
  43895. index: 0
  43896. });
  43897. p.children[p.index] = q.children;
  43898. p = q;
  43899. }
  43900. k++;
  43901. }
  43902. if (i + 1 < length) {
  43903. code.push(q = {
  43904. children: [],
  43905. index: 0
  43906. });
  43907. p.children[p.index] = q.children;
  43908. p = q;
  43909. }
  43910. }
  43911. return code[0].children;
  43912. }
  43913. function getBlockBufferOffset(component, row, col) {
  43914. return 64 * ((component.blocksPerLine + 1) * row + col);
  43915. }
  43916. function decodeScan(data, offset, frame, components, resetInterval, spectralStart, spectralEnd, successivePrev, successive) {
  43917. var mcusPerLine = frame.mcusPerLine;
  43918. var progressive = frame.progressive;
  43919. var startOffset = offset, bitsData = 0, bitsCount = 0;
  43920. function readBit() {
  43921. if (bitsCount > 0) {
  43922. bitsCount--;
  43923. return bitsData >> bitsCount & 1;
  43924. }
  43925. bitsData = data[offset++];
  43926. if (bitsData === 0xFF) {
  43927. var nextByte = data[offset++];
  43928. if (nextByte) {
  43929. error('JPEG error: unexpected marker ' + (bitsData << 8 | nextByte).toString(16));
  43930. }
  43931. }
  43932. bitsCount = 7;
  43933. return bitsData >>> 7;
  43934. }
  43935. function decodeHuffman(tree) {
  43936. var node = tree;
  43937. while (true) {
  43938. node = node[readBit()];
  43939. if (typeof node === 'number') {
  43940. return node;
  43941. }
  43942. if (typeof node !== 'object') {
  43943. error('JPEG error: invalid huffman sequence');
  43944. }
  43945. }
  43946. }
  43947. function receive(length) {
  43948. var n = 0;
  43949. while (length > 0) {
  43950. n = n << 1 | readBit();
  43951. length--;
  43952. }
  43953. return n;
  43954. }
  43955. function receiveAndExtend(length) {
  43956. if (length === 1) {
  43957. return readBit() === 1 ? 1 : -1;
  43958. }
  43959. var n = receive(length);
  43960. if (n >= 1 << length - 1) {
  43961. return n;
  43962. }
  43963. return n + (-1 << length) + 1;
  43964. }
  43965. function decodeBaseline(component, offset) {
  43966. var t = decodeHuffman(component.huffmanTableDC);
  43967. var diff = t === 0 ? 0 : receiveAndExtend(t);
  43968. component.blockData[offset] = component.pred += diff;
  43969. var k = 1;
  43970. while (k < 64) {
  43971. var rs = decodeHuffman(component.huffmanTableAC);
  43972. var s = rs & 15, r = rs >> 4;
  43973. if (s === 0) {
  43974. if (r < 15) {
  43975. break;
  43976. }
  43977. k += 16;
  43978. continue;
  43979. }
  43980. k += r;
  43981. var z = dctZigZag[k];
  43982. component.blockData[offset + z] = receiveAndExtend(s);
  43983. k++;
  43984. }
  43985. }
  43986. function decodeDCFirst(component, offset) {
  43987. var t = decodeHuffman(component.huffmanTableDC);
  43988. var diff = t === 0 ? 0 : receiveAndExtend(t) << successive;
  43989. component.blockData[offset] = component.pred += diff;
  43990. }
  43991. function decodeDCSuccessive(component, offset) {
  43992. component.blockData[offset] |= readBit() << successive;
  43993. }
  43994. var eobrun = 0;
  43995. function decodeACFirst(component, offset) {
  43996. if (eobrun > 0) {
  43997. eobrun--;
  43998. return;
  43999. }
  44000. var k = spectralStart, e = spectralEnd;
  44001. while (k <= e) {
  44002. var rs = decodeHuffman(component.huffmanTableAC);
  44003. var s = rs & 15, r = rs >> 4;
  44004. if (s === 0) {
  44005. if (r < 15) {
  44006. eobrun = receive(r) + (1 << r) - 1;
  44007. break;
  44008. }
  44009. k += 16;
  44010. continue;
  44011. }
  44012. k += r;
  44013. var z = dctZigZag[k];
  44014. component.blockData[offset + z] = receiveAndExtend(s) * (1 << successive);
  44015. k++;
  44016. }
  44017. }
  44018. var successiveACState = 0, successiveACNextValue;
  44019. function decodeACSuccessive(component, offset) {
  44020. var k = spectralStart;
  44021. var e = spectralEnd;
  44022. var r = 0;
  44023. var s;
  44024. var rs;
  44025. while (k <= e) {
  44026. var z = dctZigZag[k];
  44027. switch (successiveACState) {
  44028. case 0:
  44029. rs = decodeHuffman(component.huffmanTableAC);
  44030. s = rs & 15;
  44031. r = rs >> 4;
  44032. if (s === 0) {
  44033. if (r < 15) {
  44034. eobrun = receive(r) + (1 << r);
  44035. successiveACState = 4;
  44036. } else {
  44037. r = 16;
  44038. successiveACState = 1;
  44039. }
  44040. } else {
  44041. if (s !== 1) {
  44042. error('JPEG error: invalid ACn encoding');
  44043. }
  44044. successiveACNextValue = receiveAndExtend(s);
  44045. successiveACState = r ? 2 : 3;
  44046. }
  44047. continue;
  44048. case 1:
  44049. case 2:
  44050. if (component.blockData[offset + z]) {
  44051. component.blockData[offset + z] += readBit() << successive;
  44052. } else {
  44053. r--;
  44054. if (r === 0) {
  44055. successiveACState = successiveACState === 2 ? 3 : 0;
  44056. }
  44057. }
  44058. break;
  44059. case 3:
  44060. if (component.blockData[offset + z]) {
  44061. component.blockData[offset + z] += readBit() << successive;
  44062. } else {
  44063. component.blockData[offset + z] = successiveACNextValue << successive;
  44064. successiveACState = 0;
  44065. }
  44066. break;
  44067. case 4:
  44068. if (component.blockData[offset + z]) {
  44069. component.blockData[offset + z] += readBit() << successive;
  44070. }
  44071. break;
  44072. }
  44073. k++;
  44074. }
  44075. if (successiveACState === 4) {
  44076. eobrun--;
  44077. if (eobrun === 0) {
  44078. successiveACState = 0;
  44079. }
  44080. }
  44081. }
  44082. function decodeMcu(component, decode, mcu, row, col) {
  44083. var mcuRow = mcu / mcusPerLine | 0;
  44084. var mcuCol = mcu % mcusPerLine;
  44085. var blockRow = mcuRow * component.v + row;
  44086. var blockCol = mcuCol * component.h + col;
  44087. var offset = getBlockBufferOffset(component, blockRow, blockCol);
  44088. decode(component, offset);
  44089. }
  44090. function decodeBlock(component, decode, mcu) {
  44091. var blockRow = mcu / component.blocksPerLine | 0;
  44092. var blockCol = mcu % component.blocksPerLine;
  44093. var offset = getBlockBufferOffset(component, blockRow, blockCol);
  44094. decode(component, offset);
  44095. }
  44096. var componentsLength = components.length;
  44097. var component, i, j, k, n;
  44098. var decodeFn;
  44099. if (progressive) {
  44100. if (spectralStart === 0) {
  44101. decodeFn = successivePrev === 0 ? decodeDCFirst : decodeDCSuccessive;
  44102. } else {
  44103. decodeFn = successivePrev === 0 ? decodeACFirst : decodeACSuccessive;
  44104. }
  44105. } else {
  44106. decodeFn = decodeBaseline;
  44107. }
  44108. var mcu = 0, marker;
  44109. var mcuExpected;
  44110. if (componentsLength === 1) {
  44111. mcuExpected = components[0].blocksPerLine * components[0].blocksPerColumn;
  44112. } else {
  44113. mcuExpected = mcusPerLine * frame.mcusPerColumn;
  44114. }
  44115. if (!resetInterval) {
  44116. resetInterval = mcuExpected;
  44117. }
  44118. var h, v;
  44119. while (mcu < mcuExpected) {
  44120. for (i = 0; i < componentsLength; i++) {
  44121. components[i].pred = 0;
  44122. }
  44123. eobrun = 0;
  44124. if (componentsLength === 1) {
  44125. component = components[0];
  44126. for (n = 0; n < resetInterval; n++) {
  44127. decodeBlock(component, decodeFn, mcu);
  44128. mcu++;
  44129. }
  44130. } else {
  44131. for (n = 0; n < resetInterval; n++) {
  44132. for (i = 0; i < componentsLength; i++) {
  44133. component = components[i];
  44134. h = component.h;
  44135. v = component.v;
  44136. for (j = 0; j < v; j++) {
  44137. for (k = 0; k < h; k++) {
  44138. decodeMcu(component, decodeFn, mcu, j, k);
  44139. }
  44140. }
  44141. }
  44142. mcu++;
  44143. }
  44144. }
  44145. bitsCount = 0;
  44146. marker = data[offset] << 8 | data[offset + 1];
  44147. while (data[offset] === 0x00 && offset < data.length - 1) {
  44148. offset++;
  44149. marker = data[offset] << 8 | data[offset + 1];
  44150. }
  44151. if (marker <= 0xFF00) {
  44152. error('JPEG error: marker was not found');
  44153. }
  44154. if (marker >= 0xFFD0 && marker <= 0xFFD7) {
  44155. offset += 2;
  44156. } else {
  44157. break;
  44158. }
  44159. }
  44160. return offset - startOffset;
  44161. }
  44162. function quantizeAndInverse(component, blockBufferOffset, p) {
  44163. var qt = component.quantizationTable, blockData = component.blockData;
  44164. var v0, v1, v2, v3, v4, v5, v6, v7;
  44165. var p0, p1, p2, p3, p4, p5, p6, p7;
  44166. var t;
  44167. if (!qt) {
  44168. error('JPEG error: missing required Quantization Table.');
  44169. }
  44170. for (var row = 0; row < 64; row += 8) {
  44171. p0 = blockData[blockBufferOffset + row];
  44172. p1 = blockData[blockBufferOffset + row + 1];
  44173. p2 = blockData[blockBufferOffset + row + 2];
  44174. p3 = blockData[blockBufferOffset + row + 3];
  44175. p4 = blockData[blockBufferOffset + row + 4];
  44176. p5 = blockData[blockBufferOffset + row + 5];
  44177. p6 = blockData[blockBufferOffset + row + 6];
  44178. p7 = blockData[blockBufferOffset + row + 7];
  44179. p0 *= qt[row];
  44180. if ((p1 | p2 | p3 | p4 | p5 | p6 | p7) === 0) {
  44181. t = dctSqrt2 * p0 + 512 >> 10;
  44182. p[row] = t;
  44183. p[row + 1] = t;
  44184. p[row + 2] = t;
  44185. p[row + 3] = t;
  44186. p[row + 4] = t;
  44187. p[row + 5] = t;
  44188. p[row + 6] = t;
  44189. p[row + 7] = t;
  44190. continue;
  44191. }
  44192. p1 *= qt[row + 1];
  44193. p2 *= qt[row + 2];
  44194. p3 *= qt[row + 3];
  44195. p4 *= qt[row + 4];
  44196. p5 *= qt[row + 5];
  44197. p6 *= qt[row + 6];
  44198. p7 *= qt[row + 7];
  44199. v0 = dctSqrt2 * p0 + 128 >> 8;
  44200. v1 = dctSqrt2 * p4 + 128 >> 8;
  44201. v2 = p2;
  44202. v3 = p6;
  44203. v4 = dctSqrt1d2 * (p1 - p7) + 128 >> 8;
  44204. v7 = dctSqrt1d2 * (p1 + p7) + 128 >> 8;
  44205. v5 = p3 << 4;
  44206. v6 = p5 << 4;
  44207. v0 = v0 + v1 + 1 >> 1;
  44208. v1 = v0 - v1;
  44209. t = v2 * dctSin6 + v3 * dctCos6 + 128 >> 8;
  44210. v2 = v2 * dctCos6 - v3 * dctSin6 + 128 >> 8;
  44211. v3 = t;
  44212. v4 = v4 + v6 + 1 >> 1;
  44213. v6 = v4 - v6;
  44214. v7 = v7 + v5 + 1 >> 1;
  44215. v5 = v7 - v5;
  44216. v0 = v0 + v3 + 1 >> 1;
  44217. v3 = v0 - v3;
  44218. v1 = v1 + v2 + 1 >> 1;
  44219. v2 = v1 - v2;
  44220. t = v4 * dctSin3 + v7 * dctCos3 + 2048 >> 12;
  44221. v4 = v4 * dctCos3 - v7 * dctSin3 + 2048 >> 12;
  44222. v7 = t;
  44223. t = v5 * dctSin1 + v6 * dctCos1 + 2048 >> 12;
  44224. v5 = v5 * dctCos1 - v6 * dctSin1 + 2048 >> 12;
  44225. v6 = t;
  44226. p[row] = v0 + v7;
  44227. p[row + 7] = v0 - v7;
  44228. p[row + 1] = v1 + v6;
  44229. p[row + 6] = v1 - v6;
  44230. p[row + 2] = v2 + v5;
  44231. p[row + 5] = v2 - v5;
  44232. p[row + 3] = v3 + v4;
  44233. p[row + 4] = v3 - v4;
  44234. }
  44235. for (var col = 0; col < 8; ++col) {
  44236. p0 = p[col];
  44237. p1 = p[col + 8];
  44238. p2 = p[col + 16];
  44239. p3 = p[col + 24];
  44240. p4 = p[col + 32];
  44241. p5 = p[col + 40];
  44242. p6 = p[col + 48];
  44243. p7 = p[col + 56];
  44244. if ((p1 | p2 | p3 | p4 | p5 | p6 | p7) === 0) {
  44245. t = dctSqrt2 * p0 + 8192 >> 14;
  44246. t = t < -2040 ? 0 : t >= 2024 ? 255 : t + 2056 >> 4;
  44247. blockData[blockBufferOffset + col] = t;
  44248. blockData[blockBufferOffset + col + 8] = t;
  44249. blockData[blockBufferOffset + col + 16] = t;
  44250. blockData[blockBufferOffset + col + 24] = t;
  44251. blockData[blockBufferOffset + col + 32] = t;
  44252. blockData[blockBufferOffset + col + 40] = t;
  44253. blockData[blockBufferOffset + col + 48] = t;
  44254. blockData[blockBufferOffset + col + 56] = t;
  44255. continue;
  44256. }
  44257. v0 = dctSqrt2 * p0 + 2048 >> 12;
  44258. v1 = dctSqrt2 * p4 + 2048 >> 12;
  44259. v2 = p2;
  44260. v3 = p6;
  44261. v4 = dctSqrt1d2 * (p1 - p7) + 2048 >> 12;
  44262. v7 = dctSqrt1d2 * (p1 + p7) + 2048 >> 12;
  44263. v5 = p3;
  44264. v6 = p5;
  44265. v0 = (v0 + v1 + 1 >> 1) + 4112;
  44266. v1 = v0 - v1;
  44267. t = v2 * dctSin6 + v3 * dctCos6 + 2048 >> 12;
  44268. v2 = v2 * dctCos6 - v3 * dctSin6 + 2048 >> 12;
  44269. v3 = t;
  44270. v4 = v4 + v6 + 1 >> 1;
  44271. v6 = v4 - v6;
  44272. v7 = v7 + v5 + 1 >> 1;
  44273. v5 = v7 - v5;
  44274. v0 = v0 + v3 + 1 >> 1;
  44275. v3 = v0 - v3;
  44276. v1 = v1 + v2 + 1 >> 1;
  44277. v2 = v1 - v2;
  44278. t = v4 * dctSin3 + v7 * dctCos3 + 2048 >> 12;
  44279. v4 = v4 * dctCos3 - v7 * dctSin3 + 2048 >> 12;
  44280. v7 = t;
  44281. t = v5 * dctSin1 + v6 * dctCos1 + 2048 >> 12;
  44282. v5 = v5 * dctCos1 - v6 * dctSin1 + 2048 >> 12;
  44283. v6 = t;
  44284. p0 = v0 + v7;
  44285. p7 = v0 - v7;
  44286. p1 = v1 + v6;
  44287. p6 = v1 - v6;
  44288. p2 = v2 + v5;
  44289. p5 = v2 - v5;
  44290. p3 = v3 + v4;
  44291. p4 = v3 - v4;
  44292. p0 = p0 < 16 ? 0 : p0 >= 4080 ? 255 : p0 >> 4;
  44293. p1 = p1 < 16 ? 0 : p1 >= 4080 ? 255 : p1 >> 4;
  44294. p2 = p2 < 16 ? 0 : p2 >= 4080 ? 255 : p2 >> 4;
  44295. p3 = p3 < 16 ? 0 : p3 >= 4080 ? 255 : p3 >> 4;
  44296. p4 = p4 < 16 ? 0 : p4 >= 4080 ? 255 : p4 >> 4;
  44297. p5 = p5 < 16 ? 0 : p5 >= 4080 ? 255 : p5 >> 4;
  44298. p6 = p6 < 16 ? 0 : p6 >= 4080 ? 255 : p6 >> 4;
  44299. p7 = p7 < 16 ? 0 : p7 >= 4080 ? 255 : p7 >> 4;
  44300. blockData[blockBufferOffset + col] = p0;
  44301. blockData[blockBufferOffset + col + 8] = p1;
  44302. blockData[blockBufferOffset + col + 16] = p2;
  44303. blockData[blockBufferOffset + col + 24] = p3;
  44304. blockData[blockBufferOffset + col + 32] = p4;
  44305. blockData[blockBufferOffset + col + 40] = p5;
  44306. blockData[blockBufferOffset + col + 48] = p6;
  44307. blockData[blockBufferOffset + col + 56] = p7;
  44308. }
  44309. }
  44310. function buildComponentData(frame, component) {
  44311. var blocksPerLine = component.blocksPerLine;
  44312. var blocksPerColumn = component.blocksPerColumn;
  44313. var computationBuffer = new Int16Array(64);
  44314. for (var blockRow = 0; blockRow < blocksPerColumn; blockRow++) {
  44315. for (var blockCol = 0; blockCol < blocksPerLine; blockCol++) {
  44316. var offset = getBlockBufferOffset(component, blockRow, blockCol);
  44317. quantizeAndInverse(component, offset, computationBuffer);
  44318. }
  44319. }
  44320. return component.blockData;
  44321. }
  44322. function clamp0to255(a) {
  44323. return a <= 0 ? 0 : a >= 255 ? 255 : a;
  44324. }
  44325. JpegImage.prototype = {
  44326. parse: function parse(data) {
  44327. function readUint16() {
  44328. var value = data[offset] << 8 | data[offset + 1];
  44329. offset += 2;
  44330. return value;
  44331. }
  44332. function readDataBlock() {
  44333. var length = readUint16();
  44334. var array = data.subarray(offset, offset + length - 2);
  44335. offset += array.length;
  44336. return array;
  44337. }
  44338. function prepareComponents(frame) {
  44339. var mcusPerLine = Math.ceil(frame.samplesPerLine / 8 / frame.maxH);
  44340. var mcusPerColumn = Math.ceil(frame.scanLines / 8 / frame.maxV);
  44341. for (var i = 0; i < frame.components.length; i++) {
  44342. component = frame.components[i];
  44343. var blocksPerLine = Math.ceil(Math.ceil(frame.samplesPerLine / 8) * component.h / frame.maxH);
  44344. var blocksPerColumn = Math.ceil(Math.ceil(frame.scanLines / 8) * component.v / frame.maxV);
  44345. var blocksPerLineForMcu = mcusPerLine * component.h;
  44346. var blocksPerColumnForMcu = mcusPerColumn * component.v;
  44347. var blocksBufferSize = 64 * blocksPerColumnForMcu * (blocksPerLineForMcu + 1);
  44348. component.blockData = new Int16Array(blocksBufferSize);
  44349. component.blocksPerLine = blocksPerLine;
  44350. component.blocksPerColumn = blocksPerColumn;
  44351. }
  44352. frame.mcusPerLine = mcusPerLine;
  44353. frame.mcusPerColumn = mcusPerColumn;
  44354. }
  44355. var offset = 0;
  44356. var jfif = null;
  44357. var adobe = null;
  44358. var frame, resetInterval;
  44359. var quantizationTables = [];
  44360. var huffmanTablesAC = [], huffmanTablesDC = [];
  44361. var fileMarker = readUint16();
  44362. if (fileMarker !== 0xFFD8) {
  44363. error('JPEG error: SOI not found');
  44364. }
  44365. fileMarker = readUint16();
  44366. while (fileMarker !== 0xFFD9) {
  44367. var i, j, l;
  44368. switch (fileMarker) {
  44369. case 0xFFE0:
  44370. case 0xFFE1:
  44371. case 0xFFE2:
  44372. case 0xFFE3:
  44373. case 0xFFE4:
  44374. case 0xFFE5:
  44375. case 0xFFE6:
  44376. case 0xFFE7:
  44377. case 0xFFE8:
  44378. case 0xFFE9:
  44379. case 0xFFEA:
  44380. case 0xFFEB:
  44381. case 0xFFEC:
  44382. case 0xFFED:
  44383. case 0xFFEE:
  44384. case 0xFFEF:
  44385. case 0xFFFE:
  44386. var appData = readDataBlock();
  44387. if (fileMarker === 0xFFE0) {
  44388. if (appData[0] === 0x4A && appData[1] === 0x46 && appData[2] === 0x49 && appData[3] === 0x46 && appData[4] === 0) {
  44389. jfif = {
  44390. version: {
  44391. major: appData[5],
  44392. minor: appData[6]
  44393. },
  44394. densityUnits: appData[7],
  44395. xDensity: appData[8] << 8 | appData[9],
  44396. yDensity: appData[10] << 8 | appData[11],
  44397. thumbWidth: appData[12],
  44398. thumbHeight: appData[13],
  44399. thumbData: appData.subarray(14, 14 + 3 * appData[12] * appData[13])
  44400. };
  44401. }
  44402. }
  44403. if (fileMarker === 0xFFEE) {
  44404. if (appData[0] === 0x41 && appData[1] === 0x64 && appData[2] === 0x6F && appData[3] === 0x62 && appData[4] === 0x65) {
  44405. adobe = {
  44406. version: appData[5] << 8 | appData[6],
  44407. flags0: appData[7] << 8 | appData[8],
  44408. flags1: appData[9] << 8 | appData[10],
  44409. transformCode: appData[11]
  44410. };
  44411. }
  44412. }
  44413. break;
  44414. case 0xFFDB:
  44415. var quantizationTablesLength = readUint16();
  44416. var quantizationTablesEnd = quantizationTablesLength + offset - 2;
  44417. var z;
  44418. while (offset < quantizationTablesEnd) {
  44419. var quantizationTableSpec = data[offset++];
  44420. var tableData = new Uint16Array(64);
  44421. if (quantizationTableSpec >> 4 === 0) {
  44422. for (j = 0; j < 64; j++) {
  44423. z = dctZigZag[j];
  44424. tableData[z] = data[offset++];
  44425. }
  44426. } else if (quantizationTableSpec >> 4 === 1) {
  44427. for (j = 0; j < 64; j++) {
  44428. z = dctZigZag[j];
  44429. tableData[z] = readUint16();
  44430. }
  44431. } else {
  44432. error('JPEG error: DQT - invalid table spec');
  44433. }
  44434. quantizationTables[quantizationTableSpec & 15] = tableData;
  44435. }
  44436. break;
  44437. case 0xFFC0:
  44438. case 0xFFC1:
  44439. case 0xFFC2:
  44440. if (frame) {
  44441. error('JPEG error: Only single frame JPEGs supported');
  44442. }
  44443. readUint16();
  44444. frame = {};
  44445. frame.extended = fileMarker === 0xFFC1;
  44446. frame.progressive = fileMarker === 0xFFC2;
  44447. frame.precision = data[offset++];
  44448. frame.scanLines = readUint16();
  44449. frame.samplesPerLine = readUint16();
  44450. frame.components = [];
  44451. frame.componentIds = {};
  44452. var componentsCount = data[offset++], componentId;
  44453. var maxH = 0, maxV = 0;
  44454. for (i = 0; i < componentsCount; i++) {
  44455. componentId = data[offset];
  44456. var h = data[offset + 1] >> 4;
  44457. var v = data[offset + 1] & 15;
  44458. if (maxH < h) {
  44459. maxH = h;
  44460. }
  44461. if (maxV < v) {
  44462. maxV = v;
  44463. }
  44464. var qId = data[offset + 2];
  44465. l = frame.components.push({
  44466. h: h,
  44467. v: v,
  44468. quantizationId: qId,
  44469. quantizationTable: null
  44470. });
  44471. frame.componentIds[componentId] = l - 1;
  44472. offset += 3;
  44473. }
  44474. frame.maxH = maxH;
  44475. frame.maxV = maxV;
  44476. prepareComponents(frame);
  44477. break;
  44478. case 0xFFC4:
  44479. var huffmanLength = readUint16();
  44480. for (i = 2; i < huffmanLength;) {
  44481. var huffmanTableSpec = data[offset++];
  44482. var codeLengths = new Uint8Array(16);
  44483. var codeLengthSum = 0;
  44484. for (j = 0; j < 16; j++, offset++) {
  44485. codeLengthSum += codeLengths[j] = data[offset];
  44486. }
  44487. var huffmanValues = new Uint8Array(codeLengthSum);
  44488. for (j = 0; j < codeLengthSum; j++, offset++) {
  44489. huffmanValues[j] = data[offset];
  44490. }
  44491. i += 17 + codeLengthSum;
  44492. (huffmanTableSpec >> 4 === 0 ? huffmanTablesDC : huffmanTablesAC)[huffmanTableSpec & 15] = buildHuffmanTable(codeLengths, huffmanValues);
  44493. }
  44494. break;
  44495. case 0xFFDD:
  44496. readUint16();
  44497. resetInterval = readUint16();
  44498. break;
  44499. case 0xFFDA:
  44500. readUint16();
  44501. var selectorsCount = data[offset++];
  44502. var components = [], component;
  44503. for (i = 0; i < selectorsCount; i++) {
  44504. var componentIndex = frame.componentIds[data[offset++]];
  44505. component = frame.components[componentIndex];
  44506. var tableSpec = data[offset++];
  44507. component.huffmanTableDC = huffmanTablesDC[tableSpec >> 4];
  44508. component.huffmanTableAC = huffmanTablesAC[tableSpec & 15];
  44509. components.push(component);
  44510. }
  44511. var spectralStart = data[offset++];
  44512. var spectralEnd = data[offset++];
  44513. var successiveApproximation = data[offset++];
  44514. var processed = decodeScan(data, offset, frame, components, resetInterval, spectralStart, spectralEnd, successiveApproximation >> 4, successiveApproximation & 15);
  44515. offset += processed;
  44516. break;
  44517. case 0xFFFF:
  44518. if (data[offset] !== 0xFF) {
  44519. offset--;
  44520. }
  44521. break;
  44522. default:
  44523. if (data[offset - 3] === 0xFF && data[offset - 2] >= 0xC0 && data[offset - 2] <= 0xFE) {
  44524. offset -= 3;
  44525. break;
  44526. }
  44527. error('JPEG error: unknown marker ' + fileMarker.toString(16));
  44528. }
  44529. fileMarker = readUint16();
  44530. }
  44531. this.width = frame.samplesPerLine;
  44532. this.height = frame.scanLines;
  44533. this.jfif = jfif;
  44534. this.adobe = adobe;
  44535. this.components = [];
  44536. for (i = 0; i < frame.components.length; i++) {
  44537. component = frame.components[i];
  44538. var quantizationTable = quantizationTables[component.quantizationId];
  44539. if (quantizationTable) {
  44540. component.quantizationTable = quantizationTable;
  44541. }
  44542. this.components.push({
  44543. output: buildComponentData(frame, component),
  44544. scaleX: component.h / frame.maxH,
  44545. scaleY: component.v / frame.maxV,
  44546. blocksPerLine: component.blocksPerLine,
  44547. blocksPerColumn: component.blocksPerColumn
  44548. });
  44549. }
  44550. this.numComponents = this.components.length;
  44551. },
  44552. _getLinearizedBlockData: function getLinearizedBlockData(width, height) {
  44553. var scaleX = this.width / width, scaleY = this.height / height;
  44554. var component, componentScaleX, componentScaleY, blocksPerScanline;
  44555. var x, y, i, j, k;
  44556. var index;
  44557. var offset = 0;
  44558. var output;
  44559. var numComponents = this.components.length;
  44560. var dataLength = width * height * numComponents;
  44561. var data = new Uint8Array(dataLength);
  44562. var xScaleBlockOffset = new Uint32Array(width);
  44563. var mask3LSB = 0xfffffff8;
  44564. for (i = 0; i < numComponents; i++) {
  44565. component = this.components[i];
  44566. componentScaleX = component.scaleX * scaleX;
  44567. componentScaleY = component.scaleY * scaleY;
  44568. offset = i;
  44569. output = component.output;
  44570. blocksPerScanline = component.blocksPerLine + 1 << 3;
  44571. for (x = 0; x < width; x++) {
  44572. j = 0 | x * componentScaleX;
  44573. xScaleBlockOffset[x] = (j & mask3LSB) << 3 | j & 7;
  44574. }
  44575. for (y = 0; y < height; y++) {
  44576. j = 0 | y * componentScaleY;
  44577. index = blocksPerScanline * (j & mask3LSB) | (j & 7) << 3;
  44578. for (x = 0; x < width; x++) {
  44579. data[offset] = output[index + xScaleBlockOffset[x]];
  44580. offset += numComponents;
  44581. }
  44582. }
  44583. }
  44584. var transform = this.decodeTransform;
  44585. if (transform) {
  44586. for (i = 0; i < dataLength;) {
  44587. for (j = 0, k = 0; j < numComponents; j++, i++, k += 2) {
  44588. data[i] = (data[i] * transform[k] >> 8) + transform[k + 1];
  44589. }
  44590. }
  44591. }
  44592. return data;
  44593. },
  44594. _isColorConversionNeeded: function isColorConversionNeeded() {
  44595. if (this.adobe && this.adobe.transformCode) {
  44596. return true;
  44597. } else if (this.numComponents === 3) {
  44598. if (!this.adobe && this.colorTransform === 0) {
  44599. return false;
  44600. }
  44601. return true;
  44602. }
  44603. if (!this.adobe && this.colorTransform === 1) {
  44604. return true;
  44605. }
  44606. return false;
  44607. },
  44608. _convertYccToRgb: function convertYccToRgb(data) {
  44609. var Y, Cb, Cr;
  44610. for (var i = 0, length = data.length; i < length; i += 3) {
  44611. Y = data[i];
  44612. Cb = data[i + 1];
  44613. Cr = data[i + 2];
  44614. data[i] = clamp0to255(Y - 179.456 + 1.402 * Cr);
  44615. data[i + 1] = clamp0to255(Y + 135.459 - 0.344 * Cb - 0.714 * Cr);
  44616. data[i + 2] = clamp0to255(Y - 226.816 + 1.772 * Cb);
  44617. }
  44618. return data;
  44619. },
  44620. _convertYcckToRgb: function convertYcckToRgb(data) {
  44621. var Y, Cb, Cr, k;
  44622. var offset = 0;
  44623. for (var i = 0, length = data.length; i < length; i += 4) {
  44624. Y = data[i];
  44625. Cb = data[i + 1];
  44626. Cr = data[i + 2];
  44627. k = data[i + 3];
  44628. 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);
  44629. 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);
  44630. 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);
  44631. data[offset++] = clamp0to255(r);
  44632. data[offset++] = clamp0to255(g);
  44633. data[offset++] = clamp0to255(b);
  44634. }
  44635. return data;
  44636. },
  44637. _convertYcckToCmyk: function convertYcckToCmyk(data) {
  44638. var Y, Cb, Cr;
  44639. for (var i = 0, length = data.length; i < length; i += 4) {
  44640. Y = data[i];
  44641. Cb = data[i + 1];
  44642. Cr = data[i + 2];
  44643. data[i] = clamp0to255(434.456 - Y - 1.402 * Cr);
  44644. data[i + 1] = clamp0to255(119.541 - Y + 0.344 * Cb + 0.714 * Cr);
  44645. data[i + 2] = clamp0to255(481.816 - Y - 1.772 * Cb);
  44646. }
  44647. return data;
  44648. },
  44649. _convertCmykToRgb: function convertCmykToRgb(data) {
  44650. var c, m, y, k;
  44651. var offset = 0;
  44652. var min = -255 * 255 * 255;
  44653. var scale = 1 / 255 / 255;
  44654. for (var i = 0, length = data.length; i < length; i += 4) {
  44655. c = data[i];
  44656. m = data[i + 1];
  44657. y = data[i + 2];
  44658. k = data[i + 3];
  44659. 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);
  44660. 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);
  44661. 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);
  44662. data[offset++] = r >= 0 ? 255 : r <= min ? 0 : 255 + r * scale | 0;
  44663. data[offset++] = g >= 0 ? 255 : g <= min ? 0 : 255 + g * scale | 0;
  44664. data[offset++] = b >= 0 ? 255 : b <= min ? 0 : 255 + b * scale | 0;
  44665. }
  44666. return data;
  44667. },
  44668. getData: function getData(width, height, forceRGBoutput) {
  44669. if (this.numComponents > 4) {
  44670. error('JPEG error: Unsupported color mode');
  44671. }
  44672. var data = this._getLinearizedBlockData(width, height);
  44673. if (this.numComponents === 1 && forceRGBoutput) {
  44674. var dataLength = data.length;
  44675. var rgbData = new Uint8Array(dataLength * 3);
  44676. var offset = 0;
  44677. for (var i = 0; i < dataLength; i++) {
  44678. var grayColor = data[i];
  44679. rgbData[offset++] = grayColor;
  44680. rgbData[offset++] = grayColor;
  44681. rgbData[offset++] = grayColor;
  44682. }
  44683. return rgbData;
  44684. } else if (this.numComponents === 3 && this._isColorConversionNeeded()) {
  44685. return this._convertYccToRgb(data);
  44686. } else if (this.numComponents === 4) {
  44687. if (this._isColorConversionNeeded()) {
  44688. if (forceRGBoutput) {
  44689. return this._convertYcckToRgb(data);
  44690. }
  44691. return this._convertYcckToCmyk(data);
  44692. } else if (forceRGBoutput) {
  44693. return this._convertCmykToRgb(data);
  44694. }
  44695. }
  44696. return data;
  44697. }
  44698. };
  44699. return JpegImage;
  44700. }();
  44701. exports.JpegImage = JpegImage;
  44702. /***/ }),
  44703. /* 30 */
  44704. /***/ (function(module, exports, __w_pdfjs_require__) {
  44705. "use strict";
  44706. var sharedUtil = __w_pdfjs_require__(0);
  44707. var getLookupTableFactory = sharedUtil.getLookupTableFactory;
  44708. var getMetrics = getLookupTableFactory(function (t) {
  44709. t['Courier'] = 600;
  44710. t['Courier-Bold'] = 600;
  44711. t['Courier-BoldOblique'] = 600;
  44712. t['Courier-Oblique'] = 600;
  44713. t['Helvetica'] = getLookupTableFactory(function (t) {
  44714. t['space'] = 278;
  44715. t['exclam'] = 278;
  44716. t['quotedbl'] = 355;
  44717. t['numbersign'] = 556;
  44718. t['dollar'] = 556;
  44719. t['percent'] = 889;
  44720. t['ampersand'] = 667;
  44721. t['quoteright'] = 222;
  44722. t['parenleft'] = 333;
  44723. t['parenright'] = 333;
  44724. t['asterisk'] = 389;
  44725. t['plus'] = 584;
  44726. t['comma'] = 278;
  44727. t['hyphen'] = 333;
  44728. t['period'] = 278;
  44729. t['slash'] = 278;
  44730. t['zero'] = 556;
  44731. t['one'] = 556;
  44732. t['two'] = 556;
  44733. t['three'] = 556;
  44734. t['four'] = 556;
  44735. t['five'] = 556;
  44736. t['six'] = 556;
  44737. t['seven'] = 556;
  44738. t['eight'] = 556;
  44739. t['nine'] = 556;
  44740. t['colon'] = 278;
  44741. t['semicolon'] = 278;
  44742. t['less'] = 584;
  44743. t['equal'] = 584;
  44744. t['greater'] = 584;
  44745. t['question'] = 556;
  44746. t['at'] = 1015;
  44747. t['A'] = 667;
  44748. t['B'] = 667;
  44749. t['C'] = 722;
  44750. t['D'] = 722;
  44751. t['E'] = 667;
  44752. t['F'] = 611;
  44753. t['G'] = 778;
  44754. t['H'] = 722;
  44755. t['I'] = 278;
  44756. t['J'] = 500;
  44757. t['K'] = 667;
  44758. t['L'] = 556;
  44759. t['M'] = 833;
  44760. t['N'] = 722;
  44761. t['O'] = 778;
  44762. t['P'] = 667;
  44763. t['Q'] = 778;
  44764. t['R'] = 722;
  44765. t['S'] = 667;
  44766. t['T'] = 611;
  44767. t['U'] = 722;
  44768. t['V'] = 667;
  44769. t['W'] = 944;
  44770. t['X'] = 667;
  44771. t['Y'] = 667;
  44772. t['Z'] = 611;
  44773. t['bracketleft'] = 278;
  44774. t['backslash'] = 278;
  44775. t['bracketright'] = 278;
  44776. t['asciicircum'] = 469;
  44777. t['underscore'] = 556;
  44778. t['quoteleft'] = 222;
  44779. t['a'] = 556;
  44780. t['b'] = 556;
  44781. t['c'] = 500;
  44782. t['d'] = 556;
  44783. t['e'] = 556;
  44784. t['f'] = 278;
  44785. t['g'] = 556;
  44786. t['h'] = 556;
  44787. t['i'] = 222;
  44788. t['j'] = 222;
  44789. t['k'] = 500;
  44790. t['l'] = 222;
  44791. t['m'] = 833;
  44792. t['n'] = 556;
  44793. t['o'] = 556;
  44794. t['p'] = 556;
  44795. t['q'] = 556;
  44796. t['r'] = 333;
  44797. t['s'] = 500;
  44798. t['t'] = 278;
  44799. t['u'] = 556;
  44800. t['v'] = 500;
  44801. t['w'] = 722;
  44802. t['x'] = 500;
  44803. t['y'] = 500;
  44804. t['z'] = 500;
  44805. t['braceleft'] = 334;
  44806. t['bar'] = 260;
  44807. t['braceright'] = 334;
  44808. t['asciitilde'] = 584;
  44809. t['exclamdown'] = 333;
  44810. t['cent'] = 556;
  44811. t['sterling'] = 556;
  44812. t['fraction'] = 167;
  44813. t['yen'] = 556;
  44814. t['florin'] = 556;
  44815. t['section'] = 556;
  44816. t['currency'] = 556;
  44817. t['quotesingle'] = 191;
  44818. t['quotedblleft'] = 333;
  44819. t['guillemotleft'] = 556;
  44820. t['guilsinglleft'] = 333;
  44821. t['guilsinglright'] = 333;
  44822. t['fi'] = 500;
  44823. t['fl'] = 500;
  44824. t['endash'] = 556;
  44825. t['dagger'] = 556;
  44826. t['daggerdbl'] = 556;
  44827. t['periodcentered'] = 278;
  44828. t['paragraph'] = 537;
  44829. t['bullet'] = 350;
  44830. t['quotesinglbase'] = 222;
  44831. t['quotedblbase'] = 333;
  44832. t['quotedblright'] = 333;
  44833. t['guillemotright'] = 556;
  44834. t['ellipsis'] = 1000;
  44835. t['perthousand'] = 1000;
  44836. t['questiondown'] = 611;
  44837. t['grave'] = 333;
  44838. t['acute'] = 333;
  44839. t['circumflex'] = 333;
  44840. t['tilde'] = 333;
  44841. t['macron'] = 333;
  44842. t['breve'] = 333;
  44843. t['dotaccent'] = 333;
  44844. t['dieresis'] = 333;
  44845. t['ring'] = 333;
  44846. t['cedilla'] = 333;
  44847. t['hungarumlaut'] = 333;
  44848. t['ogonek'] = 333;
  44849. t['caron'] = 333;
  44850. t['emdash'] = 1000;
  44851. t['AE'] = 1000;
  44852. t['ordfeminine'] = 370;
  44853. t['Lslash'] = 556;
  44854. t['Oslash'] = 778;
  44855. t['OE'] = 1000;
  44856. t['ordmasculine'] = 365;
  44857. t['ae'] = 889;
  44858. t['dotlessi'] = 278;
  44859. t['lslash'] = 222;
  44860. t['oslash'] = 611;
  44861. t['oe'] = 944;
  44862. t['germandbls'] = 611;
  44863. t['Idieresis'] = 278;
  44864. t['eacute'] = 556;
  44865. t['abreve'] = 556;
  44866. t['uhungarumlaut'] = 556;
  44867. t['ecaron'] = 556;
  44868. t['Ydieresis'] = 667;
  44869. t['divide'] = 584;
  44870. t['Yacute'] = 667;
  44871. t['Acircumflex'] = 667;
  44872. t['aacute'] = 556;
  44873. t['Ucircumflex'] = 722;
  44874. t['yacute'] = 500;
  44875. t['scommaaccent'] = 500;
  44876. t['ecircumflex'] = 556;
  44877. t['Uring'] = 722;
  44878. t['Udieresis'] = 722;
  44879. t['aogonek'] = 556;
  44880. t['Uacute'] = 722;
  44881. t['uogonek'] = 556;
  44882. t['Edieresis'] = 667;
  44883. t['Dcroat'] = 722;
  44884. t['commaaccent'] = 250;
  44885. t['copyright'] = 737;
  44886. t['Emacron'] = 667;
  44887. t['ccaron'] = 500;
  44888. t['aring'] = 556;
  44889. t['Ncommaaccent'] = 722;
  44890. t['lacute'] = 222;
  44891. t['agrave'] = 556;
  44892. t['Tcommaaccent'] = 611;
  44893. t['Cacute'] = 722;
  44894. t['atilde'] = 556;
  44895. t['Edotaccent'] = 667;
  44896. t['scaron'] = 500;
  44897. t['scedilla'] = 500;
  44898. t['iacute'] = 278;
  44899. t['lozenge'] = 471;
  44900. t['Rcaron'] = 722;
  44901. t['Gcommaaccent'] = 778;
  44902. t['ucircumflex'] = 556;
  44903. t['acircumflex'] = 556;
  44904. t['Amacron'] = 667;
  44905. t['rcaron'] = 333;
  44906. t['ccedilla'] = 500;
  44907. t['Zdotaccent'] = 611;
  44908. t['Thorn'] = 667;
  44909. t['Omacron'] = 778;
  44910. t['Racute'] = 722;
  44911. t['Sacute'] = 667;
  44912. t['dcaron'] = 643;
  44913. t['Umacron'] = 722;
  44914. t['uring'] = 556;
  44915. t['threesuperior'] = 333;
  44916. t['Ograve'] = 778;
  44917. t['Agrave'] = 667;
  44918. t['Abreve'] = 667;
  44919. t['multiply'] = 584;
  44920. t['uacute'] = 556;
  44921. t['Tcaron'] = 611;
  44922. t['partialdiff'] = 476;
  44923. t['ydieresis'] = 500;
  44924. t['Nacute'] = 722;
  44925. t['icircumflex'] = 278;
  44926. t['Ecircumflex'] = 667;
  44927. t['adieresis'] = 556;
  44928. t['edieresis'] = 556;
  44929. t['cacute'] = 500;
  44930. t['nacute'] = 556;
  44931. t['umacron'] = 556;
  44932. t['Ncaron'] = 722;
  44933. t['Iacute'] = 278;
  44934. t['plusminus'] = 584;
  44935. t['brokenbar'] = 260;
  44936. t['registered'] = 737;
  44937. t['Gbreve'] = 778;
  44938. t['Idotaccent'] = 278;
  44939. t['summation'] = 600;
  44940. t['Egrave'] = 667;
  44941. t['racute'] = 333;
  44942. t['omacron'] = 556;
  44943. t['Zacute'] = 611;
  44944. t['Zcaron'] = 611;
  44945. t['greaterequal'] = 549;
  44946. t['Eth'] = 722;
  44947. t['Ccedilla'] = 722;
  44948. t['lcommaaccent'] = 222;
  44949. t['tcaron'] = 317;
  44950. t['eogonek'] = 556;
  44951. t['Uogonek'] = 722;
  44952. t['Aacute'] = 667;
  44953. t['Adieresis'] = 667;
  44954. t['egrave'] = 556;
  44955. t['zacute'] = 500;
  44956. t['iogonek'] = 222;
  44957. t['Oacute'] = 778;
  44958. t['oacute'] = 556;
  44959. t['amacron'] = 556;
  44960. t['sacute'] = 500;
  44961. t['idieresis'] = 278;
  44962. t['Ocircumflex'] = 778;
  44963. t['Ugrave'] = 722;
  44964. t['Delta'] = 612;
  44965. t['thorn'] = 556;
  44966. t['twosuperior'] = 333;
  44967. t['Odieresis'] = 778;
  44968. t['mu'] = 556;
  44969. t['igrave'] = 278;
  44970. t['ohungarumlaut'] = 556;
  44971. t['Eogonek'] = 667;
  44972. t['dcroat'] = 556;
  44973. t['threequarters'] = 834;
  44974. t['Scedilla'] = 667;
  44975. t['lcaron'] = 299;
  44976. t['Kcommaaccent'] = 667;
  44977. t['Lacute'] = 556;
  44978. t['trademark'] = 1000;
  44979. t['edotaccent'] = 556;
  44980. t['Igrave'] = 278;
  44981. t['Imacron'] = 278;
  44982. t['Lcaron'] = 556;
  44983. t['onehalf'] = 834;
  44984. t['lessequal'] = 549;
  44985. t['ocircumflex'] = 556;
  44986. t['ntilde'] = 556;
  44987. t['Uhungarumlaut'] = 722;
  44988. t['Eacute'] = 667;
  44989. t['emacron'] = 556;
  44990. t['gbreve'] = 556;
  44991. t['onequarter'] = 834;
  44992. t['Scaron'] = 667;
  44993. t['Scommaaccent'] = 667;
  44994. t['Ohungarumlaut'] = 778;
  44995. t['degree'] = 400;
  44996. t['ograve'] = 556;
  44997. t['Ccaron'] = 722;
  44998. t['ugrave'] = 556;
  44999. t['radical'] = 453;
  45000. t['Dcaron'] = 722;
  45001. t['rcommaaccent'] = 333;
  45002. t['Ntilde'] = 722;
  45003. t['otilde'] = 556;
  45004. t['Rcommaaccent'] = 722;
  45005. t['Lcommaaccent'] = 556;
  45006. t['Atilde'] = 667;
  45007. t['Aogonek'] = 667;
  45008. t['Aring'] = 667;
  45009. t['Otilde'] = 778;
  45010. t['zdotaccent'] = 500;
  45011. t['Ecaron'] = 667;
  45012. t['Iogonek'] = 278;
  45013. t['kcommaaccent'] = 500;
  45014. t['minus'] = 584;
  45015. t['Icircumflex'] = 278;
  45016. t['ncaron'] = 556;
  45017. t['tcommaaccent'] = 278;
  45018. t['logicalnot'] = 584;
  45019. t['odieresis'] = 556;
  45020. t['udieresis'] = 556;
  45021. t['notequal'] = 549;
  45022. t['gcommaaccent'] = 556;
  45023. t['eth'] = 556;
  45024. t['zcaron'] = 500;
  45025. t['ncommaaccent'] = 556;
  45026. t['onesuperior'] = 333;
  45027. t['imacron'] = 278;
  45028. t['Euro'] = 556;
  45029. });
  45030. t['Helvetica-Bold'] = getLookupTableFactory(function (t) {
  45031. t['space'] = 278;
  45032. t['exclam'] = 333;
  45033. t['quotedbl'] = 474;
  45034. t['numbersign'] = 556;
  45035. t['dollar'] = 556;
  45036. t['percent'] = 889;
  45037. t['ampersand'] = 722;
  45038. t['quoteright'] = 278;
  45039. t['parenleft'] = 333;
  45040. t['parenright'] = 333;
  45041. t['asterisk'] = 389;
  45042. t['plus'] = 584;
  45043. t['comma'] = 278;
  45044. t['hyphen'] = 333;
  45045. t['period'] = 278;
  45046. t['slash'] = 278;
  45047. t['zero'] = 556;
  45048. t['one'] = 556;
  45049. t['two'] = 556;
  45050. t['three'] = 556;
  45051. t['four'] = 556;
  45052. t['five'] = 556;
  45053. t['six'] = 556;
  45054. t['seven'] = 556;
  45055. t['eight'] = 556;
  45056. t['nine'] = 556;
  45057. t['colon'] = 333;
  45058. t['semicolon'] = 333;
  45059. t['less'] = 584;
  45060. t['equal'] = 584;
  45061. t['greater'] = 584;
  45062. t['question'] = 611;
  45063. t['at'] = 975;
  45064. t['A'] = 722;
  45065. t['B'] = 722;
  45066. t['C'] = 722;
  45067. t['D'] = 722;
  45068. t['E'] = 667;
  45069. t['F'] = 611;
  45070. t['G'] = 778;
  45071. t['H'] = 722;
  45072. t['I'] = 278;
  45073. t['J'] = 556;
  45074. t['K'] = 722;
  45075. t['L'] = 611;
  45076. t['M'] = 833;
  45077. t['N'] = 722;
  45078. t['O'] = 778;
  45079. t['P'] = 667;
  45080. t['Q'] = 778;
  45081. t['R'] = 722;
  45082. t['S'] = 667;
  45083. t['T'] = 611;
  45084. t['U'] = 722;
  45085. t['V'] = 667;
  45086. t['W'] = 944;
  45087. t['X'] = 667;
  45088. t['Y'] = 667;
  45089. t['Z'] = 611;
  45090. t['bracketleft'] = 333;
  45091. t['backslash'] = 278;
  45092. t['bracketright'] = 333;
  45093. t['asciicircum'] = 584;
  45094. t['underscore'] = 556;
  45095. t['quoteleft'] = 278;
  45096. t['a'] = 556;
  45097. t['b'] = 611;
  45098. t['c'] = 556;
  45099. t['d'] = 611;
  45100. t['e'] = 556;
  45101. t['f'] = 333;
  45102. t['g'] = 611;
  45103. t['h'] = 611;
  45104. t['i'] = 278;
  45105. t['j'] = 278;
  45106. t['k'] = 556;
  45107. t['l'] = 278;
  45108. t['m'] = 889;
  45109. t['n'] = 611;
  45110. t['o'] = 611;
  45111. t['p'] = 611;
  45112. t['q'] = 611;
  45113. t['r'] = 389;
  45114. t['s'] = 556;
  45115. t['t'] = 333;
  45116. t['u'] = 611;
  45117. t['v'] = 556;
  45118. t['w'] = 778;
  45119. t['x'] = 556;
  45120. t['y'] = 556;
  45121. t['z'] = 500;
  45122. t['braceleft'] = 389;
  45123. t['bar'] = 280;
  45124. t['braceright'] = 389;
  45125. t['asciitilde'] = 584;
  45126. t['exclamdown'] = 333;
  45127. t['cent'] = 556;
  45128. t['sterling'] = 556;
  45129. t['fraction'] = 167;
  45130. t['yen'] = 556;
  45131. t['florin'] = 556;
  45132. t['section'] = 556;
  45133. t['currency'] = 556;
  45134. t['quotesingle'] = 238;
  45135. t['quotedblleft'] = 500;
  45136. t['guillemotleft'] = 556;
  45137. t['guilsinglleft'] = 333;
  45138. t['guilsinglright'] = 333;
  45139. t['fi'] = 611;
  45140. t['fl'] = 611;
  45141. t['endash'] = 556;
  45142. t['dagger'] = 556;
  45143. t['daggerdbl'] = 556;
  45144. t['periodcentered'] = 278;
  45145. t['paragraph'] = 556;
  45146. t['bullet'] = 350;
  45147. t['quotesinglbase'] = 278;
  45148. t['quotedblbase'] = 500;
  45149. t['quotedblright'] = 500;
  45150. t['guillemotright'] = 556;
  45151. t['ellipsis'] = 1000;
  45152. t['perthousand'] = 1000;
  45153. t['questiondown'] = 611;
  45154. t['grave'] = 333;
  45155. t['acute'] = 333;
  45156. t['circumflex'] = 333;
  45157. t['tilde'] = 333;
  45158. t['macron'] = 333;
  45159. t['breve'] = 333;
  45160. t['dotaccent'] = 333;
  45161. t['dieresis'] = 333;
  45162. t['ring'] = 333;
  45163. t['cedilla'] = 333;
  45164. t['hungarumlaut'] = 333;
  45165. t['ogonek'] = 333;
  45166. t['caron'] = 333;
  45167. t['emdash'] = 1000;
  45168. t['AE'] = 1000;
  45169. t['ordfeminine'] = 370;
  45170. t['Lslash'] = 611;
  45171. t['Oslash'] = 778;
  45172. t['OE'] = 1000;
  45173. t['ordmasculine'] = 365;
  45174. t['ae'] = 889;
  45175. t['dotlessi'] = 278;
  45176. t['lslash'] = 278;
  45177. t['oslash'] = 611;
  45178. t['oe'] = 944;
  45179. t['germandbls'] = 611;
  45180. t['Idieresis'] = 278;
  45181. t['eacute'] = 556;
  45182. t['abreve'] = 556;
  45183. t['uhungarumlaut'] = 611;
  45184. t['ecaron'] = 556;
  45185. t['Ydieresis'] = 667;
  45186. t['divide'] = 584;
  45187. t['Yacute'] = 667;
  45188. t['Acircumflex'] = 722;
  45189. t['aacute'] = 556;
  45190. t['Ucircumflex'] = 722;
  45191. t['yacute'] = 556;
  45192. t['scommaaccent'] = 556;
  45193. t['ecircumflex'] = 556;
  45194. t['Uring'] = 722;
  45195. t['Udieresis'] = 722;
  45196. t['aogonek'] = 556;
  45197. t['Uacute'] = 722;
  45198. t['uogonek'] = 611;
  45199. t['Edieresis'] = 667;
  45200. t['Dcroat'] = 722;
  45201. t['commaaccent'] = 250;
  45202. t['copyright'] = 737;
  45203. t['Emacron'] = 667;
  45204. t['ccaron'] = 556;
  45205. t['aring'] = 556;
  45206. t['Ncommaaccent'] = 722;
  45207. t['lacute'] = 278;
  45208. t['agrave'] = 556;
  45209. t['Tcommaaccent'] = 611;
  45210. t['Cacute'] = 722;
  45211. t['atilde'] = 556;
  45212. t['Edotaccent'] = 667;
  45213. t['scaron'] = 556;
  45214. t['scedilla'] = 556;
  45215. t['iacute'] = 278;
  45216. t['lozenge'] = 494;
  45217. t['Rcaron'] = 722;
  45218. t['Gcommaaccent'] = 778;
  45219. t['ucircumflex'] = 611;
  45220. t['acircumflex'] = 556;
  45221. t['Amacron'] = 722;
  45222. t['rcaron'] = 389;
  45223. t['ccedilla'] = 556;
  45224. t['Zdotaccent'] = 611;
  45225. t['Thorn'] = 667;
  45226. t['Omacron'] = 778;
  45227. t['Racute'] = 722;
  45228. t['Sacute'] = 667;
  45229. t['dcaron'] = 743;
  45230. t['Umacron'] = 722;
  45231. t['uring'] = 611;
  45232. t['threesuperior'] = 333;
  45233. t['Ograve'] = 778;
  45234. t['Agrave'] = 722;
  45235. t['Abreve'] = 722;
  45236. t['multiply'] = 584;
  45237. t['uacute'] = 611;
  45238. t['Tcaron'] = 611;
  45239. t['partialdiff'] = 494;
  45240. t['ydieresis'] = 556;
  45241. t['Nacute'] = 722;
  45242. t['icircumflex'] = 278;
  45243. t['Ecircumflex'] = 667;
  45244. t['adieresis'] = 556;
  45245. t['edieresis'] = 556;
  45246. t['cacute'] = 556;
  45247. t['nacute'] = 611;
  45248. t['umacron'] = 611;
  45249. t['Ncaron'] = 722;
  45250. t['Iacute'] = 278;
  45251. t['plusminus'] = 584;
  45252. t['brokenbar'] = 280;
  45253. t['registered'] = 737;
  45254. t['Gbreve'] = 778;
  45255. t['Idotaccent'] = 278;
  45256. t['summation'] = 600;
  45257. t['Egrave'] = 667;
  45258. t['racute'] = 389;
  45259. t['omacron'] = 611;
  45260. t['Zacute'] = 611;
  45261. t['Zcaron'] = 611;
  45262. t['greaterequal'] = 549;
  45263. t['Eth'] = 722;
  45264. t['Ccedilla'] = 722;
  45265. t['lcommaaccent'] = 278;
  45266. t['tcaron'] = 389;
  45267. t['eogonek'] = 556;
  45268. t['Uogonek'] = 722;
  45269. t['Aacute'] = 722;
  45270. t['Adieresis'] = 722;
  45271. t['egrave'] = 556;
  45272. t['zacute'] = 500;
  45273. t['iogonek'] = 278;
  45274. t['Oacute'] = 778;
  45275. t['oacute'] = 611;
  45276. t['amacron'] = 556;
  45277. t['sacute'] = 556;
  45278. t['idieresis'] = 278;
  45279. t['Ocircumflex'] = 778;
  45280. t['Ugrave'] = 722;
  45281. t['Delta'] = 612;
  45282. t['thorn'] = 611;
  45283. t['twosuperior'] = 333;
  45284. t['Odieresis'] = 778;
  45285. t['mu'] = 611;
  45286. t['igrave'] = 278;
  45287. t['ohungarumlaut'] = 611;
  45288. t['Eogonek'] = 667;
  45289. t['dcroat'] = 611;
  45290. t['threequarters'] = 834;
  45291. t['Scedilla'] = 667;
  45292. t['lcaron'] = 400;
  45293. t['Kcommaaccent'] = 722;
  45294. t['Lacute'] = 611;
  45295. t['trademark'] = 1000;
  45296. t['edotaccent'] = 556;
  45297. t['Igrave'] = 278;
  45298. t['Imacron'] = 278;
  45299. t['Lcaron'] = 611;
  45300. t['onehalf'] = 834;
  45301. t['lessequal'] = 549;
  45302. t['ocircumflex'] = 611;
  45303. t['ntilde'] = 611;
  45304. t['Uhungarumlaut'] = 722;
  45305. t['Eacute'] = 667;
  45306. t['emacron'] = 556;
  45307. t['gbreve'] = 611;
  45308. t['onequarter'] = 834;
  45309. t['Scaron'] = 667;
  45310. t['Scommaaccent'] = 667;
  45311. t['Ohungarumlaut'] = 778;
  45312. t['degree'] = 400;
  45313. t['ograve'] = 611;
  45314. t['Ccaron'] = 722;
  45315. t['ugrave'] = 611;
  45316. t['radical'] = 549;
  45317. t['Dcaron'] = 722;
  45318. t['rcommaaccent'] = 389;
  45319. t['Ntilde'] = 722;
  45320. t['otilde'] = 611;
  45321. t['Rcommaaccent'] = 722;
  45322. t['Lcommaaccent'] = 611;
  45323. t['Atilde'] = 722;
  45324. t['Aogonek'] = 722;
  45325. t['Aring'] = 722;
  45326. t['Otilde'] = 778;
  45327. t['zdotaccent'] = 500;
  45328. t['Ecaron'] = 667;
  45329. t['Iogonek'] = 278;
  45330. t['kcommaaccent'] = 556;
  45331. t['minus'] = 584;
  45332. t['Icircumflex'] = 278;
  45333. t['ncaron'] = 611;
  45334. t['tcommaaccent'] = 333;
  45335. t['logicalnot'] = 584;
  45336. t['odieresis'] = 611;
  45337. t['udieresis'] = 611;
  45338. t['notequal'] = 549;
  45339. t['gcommaaccent'] = 611;
  45340. t['eth'] = 611;
  45341. t['zcaron'] = 500;
  45342. t['ncommaaccent'] = 611;
  45343. t['onesuperior'] = 333;
  45344. t['imacron'] = 278;
  45345. t['Euro'] = 556;
  45346. });
  45347. t['Helvetica-BoldOblique'] = getLookupTableFactory(function (t) {
  45348. t['space'] = 278;
  45349. t['exclam'] = 333;
  45350. t['quotedbl'] = 474;
  45351. t['numbersign'] = 556;
  45352. t['dollar'] = 556;
  45353. t['percent'] = 889;
  45354. t['ampersand'] = 722;
  45355. t['quoteright'] = 278;
  45356. t['parenleft'] = 333;
  45357. t['parenright'] = 333;
  45358. t['asterisk'] = 389;
  45359. t['plus'] = 584;
  45360. t['comma'] = 278;
  45361. t['hyphen'] = 333;
  45362. t['period'] = 278;
  45363. t['slash'] = 278;
  45364. t['zero'] = 556;
  45365. t['one'] = 556;
  45366. t['two'] = 556;
  45367. t['three'] = 556;
  45368. t['four'] = 556;
  45369. t['five'] = 556;
  45370. t['six'] = 556;
  45371. t['seven'] = 556;
  45372. t['eight'] = 556;
  45373. t['nine'] = 556;
  45374. t['colon'] = 333;
  45375. t['semicolon'] = 333;
  45376. t['less'] = 584;
  45377. t['equal'] = 584;
  45378. t['greater'] = 584;
  45379. t['question'] = 611;
  45380. t['at'] = 975;
  45381. t['A'] = 722;
  45382. t['B'] = 722;
  45383. t['C'] = 722;
  45384. t['D'] = 722;
  45385. t['E'] = 667;
  45386. t['F'] = 611;
  45387. t['G'] = 778;
  45388. t['H'] = 722;
  45389. t['I'] = 278;
  45390. t['J'] = 556;
  45391. t['K'] = 722;
  45392. t['L'] = 611;
  45393. t['M'] = 833;
  45394. t['N'] = 722;
  45395. t['O'] = 778;
  45396. t['P'] = 667;
  45397. t['Q'] = 778;
  45398. t['R'] = 722;
  45399. t['S'] = 667;
  45400. t['T'] = 611;
  45401. t['U'] = 722;
  45402. t['V'] = 667;
  45403. t['W'] = 944;
  45404. t['X'] = 667;
  45405. t['Y'] = 667;
  45406. t['Z'] = 611;
  45407. t['bracketleft'] = 333;
  45408. t['backslash'] = 278;
  45409. t['bracketright'] = 333;
  45410. t['asciicircum'] = 584;
  45411. t['underscore'] = 556;
  45412. t['quoteleft'] = 278;
  45413. t['a'] = 556;
  45414. t['b'] = 611;
  45415. t['c'] = 556;
  45416. t['d'] = 611;
  45417. t['e'] = 556;
  45418. t['f'] = 333;
  45419. t['g'] = 611;
  45420. t['h'] = 611;
  45421. t['i'] = 278;
  45422. t['j'] = 278;
  45423. t['k'] = 556;
  45424. t['l'] = 278;
  45425. t['m'] = 889;
  45426. t['n'] = 611;
  45427. t['o'] = 611;
  45428. t['p'] = 611;
  45429. t['q'] = 611;
  45430. t['r'] = 389;
  45431. t['s'] = 556;
  45432. t['t'] = 333;
  45433. t['u'] = 611;
  45434. t['v'] = 556;
  45435. t['w'] = 778;
  45436. t['x'] = 556;
  45437. t['y'] = 556;
  45438. t['z'] = 500;
  45439. t['braceleft'] = 389;
  45440. t['bar'] = 280;
  45441. t['braceright'] = 389;
  45442. t['asciitilde'] = 584;
  45443. t['exclamdown'] = 333;
  45444. t['cent'] = 556;
  45445. t['sterling'] = 556;
  45446. t['fraction'] = 167;
  45447. t['yen'] = 556;
  45448. t['florin'] = 556;
  45449. t['section'] = 556;
  45450. t['currency'] = 556;
  45451. t['quotesingle'] = 238;
  45452. t['quotedblleft'] = 500;
  45453. t['guillemotleft'] = 556;
  45454. t['guilsinglleft'] = 333;
  45455. t['guilsinglright'] = 333;
  45456. t['fi'] = 611;
  45457. t['fl'] = 611;
  45458. t['endash'] = 556;
  45459. t['dagger'] = 556;
  45460. t['daggerdbl'] = 556;
  45461. t['periodcentered'] = 278;
  45462. t['paragraph'] = 556;
  45463. t['bullet'] = 350;
  45464. t['quotesinglbase'] = 278;
  45465. t['quotedblbase'] = 500;
  45466. t['quotedblright'] = 500;
  45467. t['guillemotright'] = 556;
  45468. t['ellipsis'] = 1000;
  45469. t['perthousand'] = 1000;
  45470. t['questiondown'] = 611;
  45471. t['grave'] = 333;
  45472. t['acute'] = 333;
  45473. t['circumflex'] = 333;
  45474. t['tilde'] = 333;
  45475. t['macron'] = 333;
  45476. t['breve'] = 333;
  45477. t['dotaccent'] = 333;
  45478. t['dieresis'] = 333;
  45479. t['ring'] = 333;
  45480. t['cedilla'] = 333;
  45481. t['hungarumlaut'] = 333;
  45482. t['ogonek'] = 333;
  45483. t['caron'] = 333;
  45484. t['emdash'] = 1000;
  45485. t['AE'] = 1000;
  45486. t['ordfeminine'] = 370;
  45487. t['Lslash'] = 611;
  45488. t['Oslash'] = 778;
  45489. t['OE'] = 1000;
  45490. t['ordmasculine'] = 365;
  45491. t['ae'] = 889;
  45492. t['dotlessi'] = 278;
  45493. t['lslash'] = 278;
  45494. t['oslash'] = 611;
  45495. t['oe'] = 944;
  45496. t['germandbls'] = 611;
  45497. t['Idieresis'] = 278;
  45498. t['eacute'] = 556;
  45499. t['abreve'] = 556;
  45500. t['uhungarumlaut'] = 611;
  45501. t['ecaron'] = 556;
  45502. t['Ydieresis'] = 667;
  45503. t['divide'] = 584;
  45504. t['Yacute'] = 667;
  45505. t['Acircumflex'] = 722;
  45506. t['aacute'] = 556;
  45507. t['Ucircumflex'] = 722;
  45508. t['yacute'] = 556;
  45509. t['scommaaccent'] = 556;
  45510. t['ecircumflex'] = 556;
  45511. t['Uring'] = 722;
  45512. t['Udieresis'] = 722;
  45513. t['aogonek'] = 556;
  45514. t['Uacute'] = 722;
  45515. t['uogonek'] = 611;
  45516. t['Edieresis'] = 667;
  45517. t['Dcroat'] = 722;
  45518. t['commaaccent'] = 250;
  45519. t['copyright'] = 737;
  45520. t['Emacron'] = 667;
  45521. t['ccaron'] = 556;
  45522. t['aring'] = 556;
  45523. t['Ncommaaccent'] = 722;
  45524. t['lacute'] = 278;
  45525. t['agrave'] = 556;
  45526. t['Tcommaaccent'] = 611;
  45527. t['Cacute'] = 722;
  45528. t['atilde'] = 556;
  45529. t['Edotaccent'] = 667;
  45530. t['scaron'] = 556;
  45531. t['scedilla'] = 556;
  45532. t['iacute'] = 278;
  45533. t['lozenge'] = 494;
  45534. t['Rcaron'] = 722;
  45535. t['Gcommaaccent'] = 778;
  45536. t['ucircumflex'] = 611;
  45537. t['acircumflex'] = 556;
  45538. t['Amacron'] = 722;
  45539. t['rcaron'] = 389;
  45540. t['ccedilla'] = 556;
  45541. t['Zdotaccent'] = 611;
  45542. t['Thorn'] = 667;
  45543. t['Omacron'] = 778;
  45544. t['Racute'] = 722;
  45545. t['Sacute'] = 667;
  45546. t['dcaron'] = 743;
  45547. t['Umacron'] = 722;
  45548. t['uring'] = 611;
  45549. t['threesuperior'] = 333;
  45550. t['Ograve'] = 778;
  45551. t['Agrave'] = 722;
  45552. t['Abreve'] = 722;
  45553. t['multiply'] = 584;
  45554. t['uacute'] = 611;
  45555. t['Tcaron'] = 611;
  45556. t['partialdiff'] = 494;
  45557. t['ydieresis'] = 556;
  45558. t['Nacute'] = 722;
  45559. t['icircumflex'] = 278;
  45560. t['Ecircumflex'] = 667;
  45561. t['adieresis'] = 556;
  45562. t['edieresis'] = 556;
  45563. t['cacute'] = 556;
  45564. t['nacute'] = 611;
  45565. t['umacron'] = 611;
  45566. t['Ncaron'] = 722;
  45567. t['Iacute'] = 278;
  45568. t['plusminus'] = 584;
  45569. t['brokenbar'] = 280;
  45570. t['registered'] = 737;
  45571. t['Gbreve'] = 778;
  45572. t['Idotaccent'] = 278;
  45573. t['summation'] = 600;
  45574. t['Egrave'] = 667;
  45575. t['racute'] = 389;
  45576. t['omacron'] = 611;
  45577. t['Zacute'] = 611;
  45578. t['Zcaron'] = 611;
  45579. t['greaterequal'] = 549;
  45580. t['Eth'] = 722;
  45581. t['Ccedilla'] = 722;
  45582. t['lcommaaccent'] = 278;
  45583. t['tcaron'] = 389;
  45584. t['eogonek'] = 556;
  45585. t['Uogonek'] = 722;
  45586. t['Aacute'] = 722;
  45587. t['Adieresis'] = 722;
  45588. t['egrave'] = 556;
  45589. t['zacute'] = 500;
  45590. t['iogonek'] = 278;
  45591. t['Oacute'] = 778;
  45592. t['oacute'] = 611;
  45593. t['amacron'] = 556;
  45594. t['sacute'] = 556;
  45595. t['idieresis'] = 278;
  45596. t['Ocircumflex'] = 778;
  45597. t['Ugrave'] = 722;
  45598. t['Delta'] = 612;
  45599. t['thorn'] = 611;
  45600. t['twosuperior'] = 333;
  45601. t['Odieresis'] = 778;
  45602. t['mu'] = 611;
  45603. t['igrave'] = 278;
  45604. t['ohungarumlaut'] = 611;
  45605. t['Eogonek'] = 667;
  45606. t['dcroat'] = 611;
  45607. t['threequarters'] = 834;
  45608. t['Scedilla'] = 667;
  45609. t['lcaron'] = 400;
  45610. t['Kcommaaccent'] = 722;
  45611. t['Lacute'] = 611;
  45612. t['trademark'] = 1000;
  45613. t['edotaccent'] = 556;
  45614. t['Igrave'] = 278;
  45615. t['Imacron'] = 278;
  45616. t['Lcaron'] = 611;
  45617. t['onehalf'] = 834;
  45618. t['lessequal'] = 549;
  45619. t['ocircumflex'] = 611;
  45620. t['ntilde'] = 611;
  45621. t['Uhungarumlaut'] = 722;
  45622. t['Eacute'] = 667;
  45623. t['emacron'] = 556;
  45624. t['gbreve'] = 611;
  45625. t['onequarter'] = 834;
  45626. t['Scaron'] = 667;
  45627. t['Scommaaccent'] = 667;
  45628. t['Ohungarumlaut'] = 778;
  45629. t['degree'] = 400;
  45630. t['ograve'] = 611;
  45631. t['Ccaron'] = 722;
  45632. t['ugrave'] = 611;
  45633. t['radical'] = 549;
  45634. t['Dcaron'] = 722;
  45635. t['rcommaaccent'] = 389;
  45636. t['Ntilde'] = 722;
  45637. t['otilde'] = 611;
  45638. t['Rcommaaccent'] = 722;
  45639. t['Lcommaaccent'] = 611;
  45640. t['Atilde'] = 722;
  45641. t['Aogonek'] = 722;
  45642. t['Aring'] = 722;
  45643. t['Otilde'] = 778;
  45644. t['zdotaccent'] = 500;
  45645. t['Ecaron'] = 667;
  45646. t['Iogonek'] = 278;
  45647. t['kcommaaccent'] = 556;
  45648. t['minus'] = 584;
  45649. t['Icircumflex'] = 278;
  45650. t['ncaron'] = 611;
  45651. t['tcommaaccent'] = 333;
  45652. t['logicalnot'] = 584;
  45653. t['odieresis'] = 611;
  45654. t['udieresis'] = 611;
  45655. t['notequal'] = 549;
  45656. t['gcommaaccent'] = 611;
  45657. t['eth'] = 611;
  45658. t['zcaron'] = 500;
  45659. t['ncommaaccent'] = 611;
  45660. t['onesuperior'] = 333;
  45661. t['imacron'] = 278;
  45662. t['Euro'] = 556;
  45663. });
  45664. t['Helvetica-Oblique'] = getLookupTableFactory(function (t) {
  45665. t['space'] = 278;
  45666. t['exclam'] = 278;
  45667. t['quotedbl'] = 355;
  45668. t['numbersign'] = 556;
  45669. t['dollar'] = 556;
  45670. t['percent'] = 889;
  45671. t['ampersand'] = 667;
  45672. t['quoteright'] = 222;
  45673. t['parenleft'] = 333;
  45674. t['parenright'] = 333;
  45675. t['asterisk'] = 389;
  45676. t['plus'] = 584;
  45677. t['comma'] = 278;
  45678. t['hyphen'] = 333;
  45679. t['period'] = 278;
  45680. t['slash'] = 278;
  45681. t['zero'] = 556;
  45682. t['one'] = 556;
  45683. t['two'] = 556;
  45684. t['three'] = 556;
  45685. t['four'] = 556;
  45686. t['five'] = 556;
  45687. t['six'] = 556;
  45688. t['seven'] = 556;
  45689. t['eight'] = 556;
  45690. t['nine'] = 556;
  45691. t['colon'] = 278;
  45692. t['semicolon'] = 278;
  45693. t['less'] = 584;
  45694. t['equal'] = 584;
  45695. t['greater'] = 584;
  45696. t['question'] = 556;
  45697. t['at'] = 1015;
  45698. t['A'] = 667;
  45699. t['B'] = 667;
  45700. t['C'] = 722;
  45701. t['D'] = 722;
  45702. t['E'] = 667;
  45703. t['F'] = 611;
  45704. t['G'] = 778;
  45705. t['H'] = 722;
  45706. t['I'] = 278;
  45707. t['J'] = 500;
  45708. t['K'] = 667;
  45709. t['L'] = 556;
  45710. t['M'] = 833;
  45711. t['N'] = 722;
  45712. t['O'] = 778;
  45713. t['P'] = 667;
  45714. t['Q'] = 778;
  45715. t['R'] = 722;
  45716. t['S'] = 667;
  45717. t['T'] = 611;
  45718. t['U'] = 722;
  45719. t['V'] = 667;
  45720. t['W'] = 944;
  45721. t['X'] = 667;
  45722. t['Y'] = 667;
  45723. t['Z'] = 611;
  45724. t['bracketleft'] = 278;
  45725. t['backslash'] = 278;
  45726. t['bracketright'] = 278;
  45727. t['asciicircum'] = 469;
  45728. t['underscore'] = 556;
  45729. t['quoteleft'] = 222;
  45730. t['a'] = 556;
  45731. t['b'] = 556;
  45732. t['c'] = 500;
  45733. t['d'] = 556;
  45734. t['e'] = 556;
  45735. t['f'] = 278;
  45736. t['g'] = 556;
  45737. t['h'] = 556;
  45738. t['i'] = 222;
  45739. t['j'] = 222;
  45740. t['k'] = 500;
  45741. t['l'] = 222;
  45742. t['m'] = 833;
  45743. t['n'] = 556;
  45744. t['o'] = 556;
  45745. t['p'] = 556;
  45746. t['q'] = 556;
  45747. t['r'] = 333;
  45748. t['s'] = 500;
  45749. t['t'] = 278;
  45750. t['u'] = 556;
  45751. t['v'] = 500;
  45752. t['w'] = 722;
  45753. t['x'] = 500;
  45754. t['y'] = 500;
  45755. t['z'] = 500;
  45756. t['braceleft'] = 334;
  45757. t['bar'] = 260;
  45758. t['braceright'] = 334;
  45759. t['asciitilde'] = 584;
  45760. t['exclamdown'] = 333;
  45761. t['cent'] = 556;
  45762. t['sterling'] = 556;
  45763. t['fraction'] = 167;
  45764. t['yen'] = 556;
  45765. t['florin'] = 556;
  45766. t['section'] = 556;
  45767. t['currency'] = 556;
  45768. t['quotesingle'] = 191;
  45769. t['quotedblleft'] = 333;
  45770. t['guillemotleft'] = 556;
  45771. t['guilsinglleft'] = 333;
  45772. t['guilsinglright'] = 333;
  45773. t['fi'] = 500;
  45774. t['fl'] = 500;
  45775. t['endash'] = 556;
  45776. t['dagger'] = 556;
  45777. t['daggerdbl'] = 556;
  45778. t['periodcentered'] = 278;
  45779. t['paragraph'] = 537;
  45780. t['bullet'] = 350;
  45781. t['quotesinglbase'] = 222;
  45782. t['quotedblbase'] = 333;
  45783. t['quotedblright'] = 333;
  45784. t['guillemotright'] = 556;
  45785. t['ellipsis'] = 1000;
  45786. t['perthousand'] = 1000;
  45787. t['questiondown'] = 611;
  45788. t['grave'] = 333;
  45789. t['acute'] = 333;
  45790. t['circumflex'] = 333;
  45791. t['tilde'] = 333;
  45792. t['macron'] = 333;
  45793. t['breve'] = 333;
  45794. t['dotaccent'] = 333;
  45795. t['dieresis'] = 333;
  45796. t['ring'] = 333;
  45797. t['cedilla'] = 333;
  45798. t['hungarumlaut'] = 333;
  45799. t['ogonek'] = 333;
  45800. t['caron'] = 333;
  45801. t['emdash'] = 1000;
  45802. t['AE'] = 1000;
  45803. t['ordfeminine'] = 370;
  45804. t['Lslash'] = 556;
  45805. t['Oslash'] = 778;
  45806. t['OE'] = 1000;
  45807. t['ordmasculine'] = 365;
  45808. t['ae'] = 889;
  45809. t['dotlessi'] = 278;
  45810. t['lslash'] = 222;
  45811. t['oslash'] = 611;
  45812. t['oe'] = 944;
  45813. t['germandbls'] = 611;
  45814. t['Idieresis'] = 278;
  45815. t['eacute'] = 556;
  45816. t['abreve'] = 556;
  45817. t['uhungarumlaut'] = 556;
  45818. t['ecaron'] = 556;
  45819. t['Ydieresis'] = 667;
  45820. t['divide'] = 584;
  45821. t['Yacute'] = 667;
  45822. t['Acircumflex'] = 667;
  45823. t['aacute'] = 556;
  45824. t['Ucircumflex'] = 722;
  45825. t['yacute'] = 500;
  45826. t['scommaaccent'] = 500;
  45827. t['ecircumflex'] = 556;
  45828. t['Uring'] = 722;
  45829. t['Udieresis'] = 722;
  45830. t['aogonek'] = 556;
  45831. t['Uacute'] = 722;
  45832. t['uogonek'] = 556;
  45833. t['Edieresis'] = 667;
  45834. t['Dcroat'] = 722;
  45835. t['commaaccent'] = 250;
  45836. t['copyright'] = 737;
  45837. t['Emacron'] = 667;
  45838. t['ccaron'] = 500;
  45839. t['aring'] = 556;
  45840. t['Ncommaaccent'] = 722;
  45841. t['lacute'] = 222;
  45842. t['agrave'] = 556;
  45843. t['Tcommaaccent'] = 611;
  45844. t['Cacute'] = 722;
  45845. t['atilde'] = 556;
  45846. t['Edotaccent'] = 667;
  45847. t['scaron'] = 500;
  45848. t['scedilla'] = 500;
  45849. t['iacute'] = 278;
  45850. t['lozenge'] = 471;
  45851. t['Rcaron'] = 722;
  45852. t['Gcommaaccent'] = 778;
  45853. t['ucircumflex'] = 556;
  45854. t['acircumflex'] = 556;
  45855. t['Amacron'] = 667;
  45856. t['rcaron'] = 333;
  45857. t['ccedilla'] = 500;
  45858. t['Zdotaccent'] = 611;
  45859. t['Thorn'] = 667;
  45860. t['Omacron'] = 778;
  45861. t['Racute'] = 722;
  45862. t['Sacute'] = 667;
  45863. t['dcaron'] = 643;
  45864. t['Umacron'] = 722;
  45865. t['uring'] = 556;
  45866. t['threesuperior'] = 333;
  45867. t['Ograve'] = 778;
  45868. t['Agrave'] = 667;
  45869. t['Abreve'] = 667;
  45870. t['multiply'] = 584;
  45871. t['uacute'] = 556;
  45872. t['Tcaron'] = 611;
  45873. t['partialdiff'] = 476;
  45874. t['ydieresis'] = 500;
  45875. t['Nacute'] = 722;
  45876. t['icircumflex'] = 278;
  45877. t['Ecircumflex'] = 667;
  45878. t['adieresis'] = 556;
  45879. t['edieresis'] = 556;
  45880. t['cacute'] = 500;
  45881. t['nacute'] = 556;
  45882. t['umacron'] = 556;
  45883. t['Ncaron'] = 722;
  45884. t['Iacute'] = 278;
  45885. t['plusminus'] = 584;
  45886. t['brokenbar'] = 260;
  45887. t['registered'] = 737;
  45888. t['Gbreve'] = 778;
  45889. t['Idotaccent'] = 278;
  45890. t['summation'] = 600;
  45891. t['Egrave'] = 667;
  45892. t['racute'] = 333;
  45893. t['omacron'] = 556;
  45894. t['Zacute'] = 611;
  45895. t['Zcaron'] = 611;
  45896. t['greaterequal'] = 549;
  45897. t['Eth'] = 722;
  45898. t['Ccedilla'] = 722;
  45899. t['lcommaaccent'] = 222;
  45900. t['tcaron'] = 317;
  45901. t['eogonek'] = 556;
  45902. t['Uogonek'] = 722;
  45903. t['Aacute'] = 667;
  45904. t['Adieresis'] = 667;
  45905. t['egrave'] = 556;
  45906. t['zacute'] = 500;
  45907. t['iogonek'] = 222;
  45908. t['Oacute'] = 778;
  45909. t['oacute'] = 556;
  45910. t['amacron'] = 556;
  45911. t['sacute'] = 500;
  45912. t['idieresis'] = 278;
  45913. t['Ocircumflex'] = 778;
  45914. t['Ugrave'] = 722;
  45915. t['Delta'] = 612;
  45916. t['thorn'] = 556;
  45917. t['twosuperior'] = 333;
  45918. t['Odieresis'] = 778;
  45919. t['mu'] = 556;
  45920. t['igrave'] = 278;
  45921. t['ohungarumlaut'] = 556;
  45922. t['Eogonek'] = 667;
  45923. t['dcroat'] = 556;
  45924. t['threequarters'] = 834;
  45925. t['Scedilla'] = 667;
  45926. t['lcaron'] = 299;
  45927. t['Kcommaaccent'] = 667;
  45928. t['Lacute'] = 556;
  45929. t['trademark'] = 1000;
  45930. t['edotaccent'] = 556;
  45931. t['Igrave'] = 278;
  45932. t['Imacron'] = 278;
  45933. t['Lcaron'] = 556;
  45934. t['onehalf'] = 834;
  45935. t['lessequal'] = 549;
  45936. t['ocircumflex'] = 556;
  45937. t['ntilde'] = 556;
  45938. t['Uhungarumlaut'] = 722;
  45939. t['Eacute'] = 667;
  45940. t['emacron'] = 556;
  45941. t['gbreve'] = 556;
  45942. t['onequarter'] = 834;
  45943. t['Scaron'] = 667;
  45944. t['Scommaaccent'] = 667;
  45945. t['Ohungarumlaut'] = 778;
  45946. t['degree'] = 400;
  45947. t['ograve'] = 556;
  45948. t['Ccaron'] = 722;
  45949. t['ugrave'] = 556;
  45950. t['radical'] = 453;
  45951. t['Dcaron'] = 722;
  45952. t['rcommaaccent'] = 333;
  45953. t['Ntilde'] = 722;
  45954. t['otilde'] = 556;
  45955. t['Rcommaaccent'] = 722;
  45956. t['Lcommaaccent'] = 556;
  45957. t['Atilde'] = 667;
  45958. t['Aogonek'] = 667;
  45959. t['Aring'] = 667;
  45960. t['Otilde'] = 778;
  45961. t['zdotaccent'] = 500;
  45962. t['Ecaron'] = 667;
  45963. t['Iogonek'] = 278;
  45964. t['kcommaaccent'] = 500;
  45965. t['minus'] = 584;
  45966. t['Icircumflex'] = 278;
  45967. t['ncaron'] = 556;
  45968. t['tcommaaccent'] = 278;
  45969. t['logicalnot'] = 584;
  45970. t['odieresis'] = 556;
  45971. t['udieresis'] = 556;
  45972. t['notequal'] = 549;
  45973. t['gcommaaccent'] = 556;
  45974. t['eth'] = 556;
  45975. t['zcaron'] = 500;
  45976. t['ncommaaccent'] = 556;
  45977. t['onesuperior'] = 333;
  45978. t['imacron'] = 278;
  45979. t['Euro'] = 556;
  45980. });
  45981. t['Symbol'] = getLookupTableFactory(function (t) {
  45982. t['space'] = 250;
  45983. t['exclam'] = 333;
  45984. t['universal'] = 713;
  45985. t['numbersign'] = 500;
  45986. t['existential'] = 549;
  45987. t['percent'] = 833;
  45988. t['ampersand'] = 778;
  45989. t['suchthat'] = 439;
  45990. t['parenleft'] = 333;
  45991. t['parenright'] = 333;
  45992. t['asteriskmath'] = 500;
  45993. t['plus'] = 549;
  45994. t['comma'] = 250;
  45995. t['minus'] = 549;
  45996. t['period'] = 250;
  45997. t['slash'] = 278;
  45998. t['zero'] = 500;
  45999. t['one'] = 500;
  46000. t['two'] = 500;
  46001. t['three'] = 500;
  46002. t['four'] = 500;
  46003. t['five'] = 500;
  46004. t['six'] = 500;
  46005. t['seven'] = 500;
  46006. t['eight'] = 500;
  46007. t['nine'] = 500;
  46008. t['colon'] = 278;
  46009. t['semicolon'] = 278;
  46010. t['less'] = 549;
  46011. t['equal'] = 549;
  46012. t['greater'] = 549;
  46013. t['question'] = 444;
  46014. t['congruent'] = 549;
  46015. t['Alpha'] = 722;
  46016. t['Beta'] = 667;
  46017. t['Chi'] = 722;
  46018. t['Delta'] = 612;
  46019. t['Epsilon'] = 611;
  46020. t['Phi'] = 763;
  46021. t['Gamma'] = 603;
  46022. t['Eta'] = 722;
  46023. t['Iota'] = 333;
  46024. t['theta1'] = 631;
  46025. t['Kappa'] = 722;
  46026. t['Lambda'] = 686;
  46027. t['Mu'] = 889;
  46028. t['Nu'] = 722;
  46029. t['Omicron'] = 722;
  46030. t['Pi'] = 768;
  46031. t['Theta'] = 741;
  46032. t['Rho'] = 556;
  46033. t['Sigma'] = 592;
  46034. t['Tau'] = 611;
  46035. t['Upsilon'] = 690;
  46036. t['sigma1'] = 439;
  46037. t['Omega'] = 768;
  46038. t['Xi'] = 645;
  46039. t['Psi'] = 795;
  46040. t['Zeta'] = 611;
  46041. t['bracketleft'] = 333;
  46042. t['therefore'] = 863;
  46043. t['bracketright'] = 333;
  46044. t['perpendicular'] = 658;
  46045. t['underscore'] = 500;
  46046. t['radicalex'] = 500;
  46047. t['alpha'] = 631;
  46048. t['beta'] = 549;
  46049. t['chi'] = 549;
  46050. t['delta'] = 494;
  46051. t['epsilon'] = 439;
  46052. t['phi'] = 521;
  46053. t['gamma'] = 411;
  46054. t['eta'] = 603;
  46055. t['iota'] = 329;
  46056. t['phi1'] = 603;
  46057. t['kappa'] = 549;
  46058. t['lambda'] = 549;
  46059. t['mu'] = 576;
  46060. t['nu'] = 521;
  46061. t['omicron'] = 549;
  46062. t['pi'] = 549;
  46063. t['theta'] = 521;
  46064. t['rho'] = 549;
  46065. t['sigma'] = 603;
  46066. t['tau'] = 439;
  46067. t['upsilon'] = 576;
  46068. t['omega1'] = 713;
  46069. t['omega'] = 686;
  46070. t['xi'] = 493;
  46071. t['psi'] = 686;
  46072. t['zeta'] = 494;
  46073. t['braceleft'] = 480;
  46074. t['bar'] = 200;
  46075. t['braceright'] = 480;
  46076. t['similar'] = 549;
  46077. t['Euro'] = 750;
  46078. t['Upsilon1'] = 620;
  46079. t['minute'] = 247;
  46080. t['lessequal'] = 549;
  46081. t['fraction'] = 167;
  46082. t['infinity'] = 713;
  46083. t['florin'] = 500;
  46084. t['club'] = 753;
  46085. t['diamond'] = 753;
  46086. t['heart'] = 753;
  46087. t['spade'] = 753;
  46088. t['arrowboth'] = 1042;
  46089. t['arrowleft'] = 987;
  46090. t['arrowup'] = 603;
  46091. t['arrowright'] = 987;
  46092. t['arrowdown'] = 603;
  46093. t['degree'] = 400;
  46094. t['plusminus'] = 549;
  46095. t['second'] = 411;
  46096. t['greaterequal'] = 549;
  46097. t['multiply'] = 549;
  46098. t['proportional'] = 713;
  46099. t['partialdiff'] = 494;
  46100. t['bullet'] = 460;
  46101. t['divide'] = 549;
  46102. t['notequal'] = 549;
  46103. t['equivalence'] = 549;
  46104. t['approxequal'] = 549;
  46105. t['ellipsis'] = 1000;
  46106. t['arrowvertex'] = 603;
  46107. t['arrowhorizex'] = 1000;
  46108. t['carriagereturn'] = 658;
  46109. t['aleph'] = 823;
  46110. t['Ifraktur'] = 686;
  46111. t['Rfraktur'] = 795;
  46112. t['weierstrass'] = 987;
  46113. t['circlemultiply'] = 768;
  46114. t['circleplus'] = 768;
  46115. t['emptyset'] = 823;
  46116. t['intersection'] = 768;
  46117. t['union'] = 768;
  46118. t['propersuperset'] = 713;
  46119. t['reflexsuperset'] = 713;
  46120. t['notsubset'] = 713;
  46121. t['propersubset'] = 713;
  46122. t['reflexsubset'] = 713;
  46123. t['element'] = 713;
  46124. t['notelement'] = 713;
  46125. t['angle'] = 768;
  46126. t['gradient'] = 713;
  46127. t['registerserif'] = 790;
  46128. t['copyrightserif'] = 790;
  46129. t['trademarkserif'] = 890;
  46130. t['product'] = 823;
  46131. t['radical'] = 549;
  46132. t['dotmath'] = 250;
  46133. t['logicalnot'] = 713;
  46134. t['logicaland'] = 603;
  46135. t['logicalor'] = 603;
  46136. t['arrowdblboth'] = 1042;
  46137. t['arrowdblleft'] = 987;
  46138. t['arrowdblup'] = 603;
  46139. t['arrowdblright'] = 987;
  46140. t['arrowdbldown'] = 603;
  46141. t['lozenge'] = 494;
  46142. t['angleleft'] = 329;
  46143. t['registersans'] = 790;
  46144. t['copyrightsans'] = 790;
  46145. t['trademarksans'] = 786;
  46146. t['summation'] = 713;
  46147. t['parenlefttp'] = 384;
  46148. t['parenleftex'] = 384;
  46149. t['parenleftbt'] = 384;
  46150. t['bracketlefttp'] = 384;
  46151. t['bracketleftex'] = 384;
  46152. t['bracketleftbt'] = 384;
  46153. t['bracelefttp'] = 494;
  46154. t['braceleftmid'] = 494;
  46155. t['braceleftbt'] = 494;
  46156. t['braceex'] = 494;
  46157. t['angleright'] = 329;
  46158. t['integral'] = 274;
  46159. t['integraltp'] = 686;
  46160. t['integralex'] = 686;
  46161. t['integralbt'] = 686;
  46162. t['parenrighttp'] = 384;
  46163. t['parenrightex'] = 384;
  46164. t['parenrightbt'] = 384;
  46165. t['bracketrighttp'] = 384;
  46166. t['bracketrightex'] = 384;
  46167. t['bracketrightbt'] = 384;
  46168. t['bracerighttp'] = 494;
  46169. t['bracerightmid'] = 494;
  46170. t['bracerightbt'] = 494;
  46171. t['apple'] = 790;
  46172. });
  46173. t['Times-Roman'] = getLookupTableFactory(function (t) {
  46174. t['space'] = 250;
  46175. t['exclam'] = 333;
  46176. t['quotedbl'] = 408;
  46177. t['numbersign'] = 500;
  46178. t['dollar'] = 500;
  46179. t['percent'] = 833;
  46180. t['ampersand'] = 778;
  46181. t['quoteright'] = 333;
  46182. t['parenleft'] = 333;
  46183. t['parenright'] = 333;
  46184. t['asterisk'] = 500;
  46185. t['plus'] = 564;
  46186. t['comma'] = 250;
  46187. t['hyphen'] = 333;
  46188. t['period'] = 250;
  46189. t['slash'] = 278;
  46190. t['zero'] = 500;
  46191. t['one'] = 500;
  46192. t['two'] = 500;
  46193. t['three'] = 500;
  46194. t['four'] = 500;
  46195. t['five'] = 500;
  46196. t['six'] = 500;
  46197. t['seven'] = 500;
  46198. t['eight'] = 500;
  46199. t['nine'] = 500;
  46200. t['colon'] = 278;
  46201. t['semicolon'] = 278;
  46202. t['less'] = 564;
  46203. t['equal'] = 564;
  46204. t['greater'] = 564;
  46205. t['question'] = 444;
  46206. t['at'] = 921;
  46207. t['A'] = 722;
  46208. t['B'] = 667;
  46209. t['C'] = 667;
  46210. t['D'] = 722;
  46211. t['E'] = 611;
  46212. t['F'] = 556;
  46213. t['G'] = 722;
  46214. t['H'] = 722;
  46215. t['I'] = 333;
  46216. t['J'] = 389;
  46217. t['K'] = 722;
  46218. t['L'] = 611;
  46219. t['M'] = 889;
  46220. t['N'] = 722;
  46221. t['O'] = 722;
  46222. t['P'] = 556;
  46223. t['Q'] = 722;
  46224. t['R'] = 667;
  46225. t['S'] = 556;
  46226. t['T'] = 611;
  46227. t['U'] = 722;
  46228. t['V'] = 722;
  46229. t['W'] = 944;
  46230. t['X'] = 722;
  46231. t['Y'] = 722;
  46232. t['Z'] = 611;
  46233. t['bracketleft'] = 333;
  46234. t['backslash'] = 278;
  46235. t['bracketright'] = 333;
  46236. t['asciicircum'] = 469;
  46237. t['underscore'] = 500;
  46238. t['quoteleft'] = 333;
  46239. t['a'] = 444;
  46240. t['b'] = 500;
  46241. t['c'] = 444;
  46242. t['d'] = 500;
  46243. t['e'] = 444;
  46244. t['f'] = 333;
  46245. t['g'] = 500;
  46246. t['h'] = 500;
  46247. t['i'] = 278;
  46248. t['j'] = 278;
  46249. t['k'] = 500;
  46250. t['l'] = 278;
  46251. t['m'] = 778;
  46252. t['n'] = 500;
  46253. t['o'] = 500;
  46254. t['p'] = 500;
  46255. t['q'] = 500;
  46256. t['r'] = 333;
  46257. t['s'] = 389;
  46258. t['t'] = 278;
  46259. t['u'] = 500;
  46260. t['v'] = 500;
  46261. t['w'] = 722;
  46262. t['x'] = 500;
  46263. t['y'] = 500;
  46264. t['z'] = 444;
  46265. t['braceleft'] = 480;
  46266. t['bar'] = 200;
  46267. t['braceright'] = 480;
  46268. t['asciitilde'] = 541;
  46269. t['exclamdown'] = 333;
  46270. t['cent'] = 500;
  46271. t['sterling'] = 500;
  46272. t['fraction'] = 167;
  46273. t['yen'] = 500;
  46274. t['florin'] = 500;
  46275. t['section'] = 500;
  46276. t['currency'] = 500;
  46277. t['quotesingle'] = 180;
  46278. t['quotedblleft'] = 444;
  46279. t['guillemotleft'] = 500;
  46280. t['guilsinglleft'] = 333;
  46281. t['guilsinglright'] = 333;
  46282. t['fi'] = 556;
  46283. t['fl'] = 556;
  46284. t['endash'] = 500;
  46285. t['dagger'] = 500;
  46286. t['daggerdbl'] = 500;
  46287. t['periodcentered'] = 250;
  46288. t['paragraph'] = 453;
  46289. t['bullet'] = 350;
  46290. t['quotesinglbase'] = 333;
  46291. t['quotedblbase'] = 444;
  46292. t['quotedblright'] = 444;
  46293. t['guillemotright'] = 500;
  46294. t['ellipsis'] = 1000;
  46295. t['perthousand'] = 1000;
  46296. t['questiondown'] = 444;
  46297. t['grave'] = 333;
  46298. t['acute'] = 333;
  46299. t['circumflex'] = 333;
  46300. t['tilde'] = 333;
  46301. t['macron'] = 333;
  46302. t['breve'] = 333;
  46303. t['dotaccent'] = 333;
  46304. t['dieresis'] = 333;
  46305. t['ring'] = 333;
  46306. t['cedilla'] = 333;
  46307. t['hungarumlaut'] = 333;
  46308. t['ogonek'] = 333;
  46309. t['caron'] = 333;
  46310. t['emdash'] = 1000;
  46311. t['AE'] = 889;
  46312. t['ordfeminine'] = 276;
  46313. t['Lslash'] = 611;
  46314. t['Oslash'] = 722;
  46315. t['OE'] = 889;
  46316. t['ordmasculine'] = 310;
  46317. t['ae'] = 667;
  46318. t['dotlessi'] = 278;
  46319. t['lslash'] = 278;
  46320. t['oslash'] = 500;
  46321. t['oe'] = 722;
  46322. t['germandbls'] = 500;
  46323. t['Idieresis'] = 333;
  46324. t['eacute'] = 444;
  46325. t['abreve'] = 444;
  46326. t['uhungarumlaut'] = 500;
  46327. t['ecaron'] = 444;
  46328. t['Ydieresis'] = 722;
  46329. t['divide'] = 564;
  46330. t['Yacute'] = 722;
  46331. t['Acircumflex'] = 722;
  46332. t['aacute'] = 444;
  46333. t['Ucircumflex'] = 722;
  46334. t['yacute'] = 500;
  46335. t['scommaaccent'] = 389;
  46336. t['ecircumflex'] = 444;
  46337. t['Uring'] = 722;
  46338. t['Udieresis'] = 722;
  46339. t['aogonek'] = 444;
  46340. t['Uacute'] = 722;
  46341. t['uogonek'] = 500;
  46342. t['Edieresis'] = 611;
  46343. t['Dcroat'] = 722;
  46344. t['commaaccent'] = 250;
  46345. t['copyright'] = 760;
  46346. t['Emacron'] = 611;
  46347. t['ccaron'] = 444;
  46348. t['aring'] = 444;
  46349. t['Ncommaaccent'] = 722;
  46350. t['lacute'] = 278;
  46351. t['agrave'] = 444;
  46352. t['Tcommaaccent'] = 611;
  46353. t['Cacute'] = 667;
  46354. t['atilde'] = 444;
  46355. t['Edotaccent'] = 611;
  46356. t['scaron'] = 389;
  46357. t['scedilla'] = 389;
  46358. t['iacute'] = 278;
  46359. t['lozenge'] = 471;
  46360. t['Rcaron'] = 667;
  46361. t['Gcommaaccent'] = 722;
  46362. t['ucircumflex'] = 500;
  46363. t['acircumflex'] = 444;
  46364. t['Amacron'] = 722;
  46365. t['rcaron'] = 333;
  46366. t['ccedilla'] = 444;
  46367. t['Zdotaccent'] = 611;
  46368. t['Thorn'] = 556;
  46369. t['Omacron'] = 722;
  46370. t['Racute'] = 667;
  46371. t['Sacute'] = 556;
  46372. t['dcaron'] = 588;
  46373. t['Umacron'] = 722;
  46374. t['uring'] = 500;
  46375. t['threesuperior'] = 300;
  46376. t['Ograve'] = 722;
  46377. t['Agrave'] = 722;
  46378. t['Abreve'] = 722;
  46379. t['multiply'] = 564;
  46380. t['uacute'] = 500;
  46381. t['Tcaron'] = 611;
  46382. t['partialdiff'] = 476;
  46383. t['ydieresis'] = 500;
  46384. t['Nacute'] = 722;
  46385. t['icircumflex'] = 278;
  46386. t['Ecircumflex'] = 611;
  46387. t['adieresis'] = 444;
  46388. t['edieresis'] = 444;
  46389. t['cacute'] = 444;
  46390. t['nacute'] = 500;
  46391. t['umacron'] = 500;
  46392. t['Ncaron'] = 722;
  46393. t['Iacute'] = 333;
  46394. t['plusminus'] = 564;
  46395. t['brokenbar'] = 200;
  46396. t['registered'] = 760;
  46397. t['Gbreve'] = 722;
  46398. t['Idotaccent'] = 333;
  46399. t['summation'] = 600;
  46400. t['Egrave'] = 611;
  46401. t['racute'] = 333;
  46402. t['omacron'] = 500;
  46403. t['Zacute'] = 611;
  46404. t['Zcaron'] = 611;
  46405. t['greaterequal'] = 549;
  46406. t['Eth'] = 722;
  46407. t['Ccedilla'] = 667;
  46408. t['lcommaaccent'] = 278;
  46409. t['tcaron'] = 326;
  46410. t['eogonek'] = 444;
  46411. t['Uogonek'] = 722;
  46412. t['Aacute'] = 722;
  46413. t['Adieresis'] = 722;
  46414. t['egrave'] = 444;
  46415. t['zacute'] = 444;
  46416. t['iogonek'] = 278;
  46417. t['Oacute'] = 722;
  46418. t['oacute'] = 500;
  46419. t['amacron'] = 444;
  46420. t['sacute'] = 389;
  46421. t['idieresis'] = 278;
  46422. t['Ocircumflex'] = 722;
  46423. t['Ugrave'] = 722;
  46424. t['Delta'] = 612;
  46425. t['thorn'] = 500;
  46426. t['twosuperior'] = 300;
  46427. t['Odieresis'] = 722;
  46428. t['mu'] = 500;
  46429. t['igrave'] = 278;
  46430. t['ohungarumlaut'] = 500;
  46431. t['Eogonek'] = 611;
  46432. t['dcroat'] = 500;
  46433. t['threequarters'] = 750;
  46434. t['Scedilla'] = 556;
  46435. t['lcaron'] = 344;
  46436. t['Kcommaaccent'] = 722;
  46437. t['Lacute'] = 611;
  46438. t['trademark'] = 980;
  46439. t['edotaccent'] = 444;
  46440. t['Igrave'] = 333;
  46441. t['Imacron'] = 333;
  46442. t['Lcaron'] = 611;
  46443. t['onehalf'] = 750;
  46444. t['lessequal'] = 549;
  46445. t['ocircumflex'] = 500;
  46446. t['ntilde'] = 500;
  46447. t['Uhungarumlaut'] = 722;
  46448. t['Eacute'] = 611;
  46449. t['emacron'] = 444;
  46450. t['gbreve'] = 500;
  46451. t['onequarter'] = 750;
  46452. t['Scaron'] = 556;
  46453. t['Scommaaccent'] = 556;
  46454. t['Ohungarumlaut'] = 722;
  46455. t['degree'] = 400;
  46456. t['ograve'] = 500;
  46457. t['Ccaron'] = 667;
  46458. t['ugrave'] = 500;
  46459. t['radical'] = 453;
  46460. t['Dcaron'] = 722;
  46461. t['rcommaaccent'] = 333;
  46462. t['Ntilde'] = 722;
  46463. t['otilde'] = 500;
  46464. t['Rcommaaccent'] = 667;
  46465. t['Lcommaaccent'] = 611;
  46466. t['Atilde'] = 722;
  46467. t['Aogonek'] = 722;
  46468. t['Aring'] = 722;
  46469. t['Otilde'] = 722;
  46470. t['zdotaccent'] = 444;
  46471. t['Ecaron'] = 611;
  46472. t['Iogonek'] = 333;
  46473. t['kcommaaccent'] = 500;
  46474. t['minus'] = 564;
  46475. t['Icircumflex'] = 333;
  46476. t['ncaron'] = 500;
  46477. t['tcommaaccent'] = 278;
  46478. t['logicalnot'] = 564;
  46479. t['odieresis'] = 500;
  46480. t['udieresis'] = 500;
  46481. t['notequal'] = 549;
  46482. t['gcommaaccent'] = 500;
  46483. t['eth'] = 500;
  46484. t['zcaron'] = 444;
  46485. t['ncommaaccent'] = 500;
  46486. t['onesuperior'] = 300;
  46487. t['imacron'] = 278;
  46488. t['Euro'] = 500;
  46489. });
  46490. t['Times-Bold'] = getLookupTableFactory(function (t) {
  46491. t['space'] = 250;
  46492. t['exclam'] = 333;
  46493. t['quotedbl'] = 555;
  46494. t['numbersign'] = 500;
  46495. t['dollar'] = 500;
  46496. t['percent'] = 1000;
  46497. t['ampersand'] = 833;
  46498. t['quoteright'] = 333;
  46499. t['parenleft'] = 333;
  46500. t['parenright'] = 333;
  46501. t['asterisk'] = 500;
  46502. t['plus'] = 570;
  46503. t['comma'] = 250;
  46504. t['hyphen'] = 333;
  46505. t['period'] = 250;
  46506. t['slash'] = 278;
  46507. t['zero'] = 500;
  46508. t['one'] = 500;
  46509. t['two'] = 500;
  46510. t['three'] = 500;
  46511. t['four'] = 500;
  46512. t['five'] = 500;
  46513. t['six'] = 500;
  46514. t['seven'] = 500;
  46515. t['eight'] = 500;
  46516. t['nine'] = 500;
  46517. t['colon'] = 333;
  46518. t['semicolon'] = 333;
  46519. t['less'] = 570;
  46520. t['equal'] = 570;
  46521. t['greater'] = 570;
  46522. t['question'] = 500;
  46523. t['at'] = 930;
  46524. t['A'] = 722;
  46525. t['B'] = 667;
  46526. t['C'] = 722;
  46527. t['D'] = 722;
  46528. t['E'] = 667;
  46529. t['F'] = 611;
  46530. t['G'] = 778;
  46531. t['H'] = 778;
  46532. t['I'] = 389;
  46533. t['J'] = 500;
  46534. t['K'] = 778;
  46535. t['L'] = 667;
  46536. t['M'] = 944;
  46537. t['N'] = 722;
  46538. t['O'] = 778;
  46539. t['P'] = 611;
  46540. t['Q'] = 778;
  46541. t['R'] = 722;
  46542. t['S'] = 556;
  46543. t['T'] = 667;
  46544. t['U'] = 722;
  46545. t['V'] = 722;
  46546. t['W'] = 1000;
  46547. t['X'] = 722;
  46548. t['Y'] = 722;
  46549. t['Z'] = 667;
  46550. t['bracketleft'] = 333;
  46551. t['backslash'] = 278;
  46552. t['bracketright'] = 333;
  46553. t['asciicircum'] = 581;
  46554. t['underscore'] = 500;
  46555. t['quoteleft'] = 333;
  46556. t['a'] = 500;
  46557. t['b'] = 556;
  46558. t['c'] = 444;
  46559. t['d'] = 556;
  46560. t['e'] = 444;
  46561. t['f'] = 333;
  46562. t['g'] = 500;
  46563. t['h'] = 556;
  46564. t['i'] = 278;
  46565. t['j'] = 333;
  46566. t['k'] = 556;
  46567. t['l'] = 278;
  46568. t['m'] = 833;
  46569. t['n'] = 556;
  46570. t['o'] = 500;
  46571. t['p'] = 556;
  46572. t['q'] = 556;
  46573. t['r'] = 444;
  46574. t['s'] = 389;
  46575. t['t'] = 333;
  46576. t['u'] = 556;
  46577. t['v'] = 500;
  46578. t['w'] = 722;
  46579. t['x'] = 500;
  46580. t['y'] = 500;
  46581. t['z'] = 444;
  46582. t['braceleft'] = 394;
  46583. t['bar'] = 220;
  46584. t['braceright'] = 394;
  46585. t['asciitilde'] = 520;
  46586. t['exclamdown'] = 333;
  46587. t['cent'] = 500;
  46588. t['sterling'] = 500;
  46589. t['fraction'] = 167;
  46590. t['yen'] = 500;
  46591. t['florin'] = 500;
  46592. t['section'] = 500;
  46593. t['currency'] = 500;
  46594. t['quotesingle'] = 278;
  46595. t['quotedblleft'] = 500;
  46596. t['guillemotleft'] = 500;
  46597. t['guilsinglleft'] = 333;
  46598. t['guilsinglright'] = 333;
  46599. t['fi'] = 556;
  46600. t['fl'] = 556;
  46601. t['endash'] = 500;
  46602. t['dagger'] = 500;
  46603. t['daggerdbl'] = 500;
  46604. t['periodcentered'] = 250;
  46605. t['paragraph'] = 540;
  46606. t['bullet'] = 350;
  46607. t['quotesinglbase'] = 333;
  46608. t['quotedblbase'] = 500;
  46609. t['quotedblright'] = 500;
  46610. t['guillemotright'] = 500;
  46611. t['ellipsis'] = 1000;
  46612. t['perthousand'] = 1000;
  46613. t['questiondown'] = 500;
  46614. t['grave'] = 333;
  46615. t['acute'] = 333;
  46616. t['circumflex'] = 333;
  46617. t['tilde'] = 333;
  46618. t['macron'] = 333;
  46619. t['breve'] = 333;
  46620. t['dotaccent'] = 333;
  46621. t['dieresis'] = 333;
  46622. t['ring'] = 333;
  46623. t['cedilla'] = 333;
  46624. t['hungarumlaut'] = 333;
  46625. t['ogonek'] = 333;
  46626. t['caron'] = 333;
  46627. t['emdash'] = 1000;
  46628. t['AE'] = 1000;
  46629. t['ordfeminine'] = 300;
  46630. t['Lslash'] = 667;
  46631. t['Oslash'] = 778;
  46632. t['OE'] = 1000;
  46633. t['ordmasculine'] = 330;
  46634. t['ae'] = 722;
  46635. t['dotlessi'] = 278;
  46636. t['lslash'] = 278;
  46637. t['oslash'] = 500;
  46638. t['oe'] = 722;
  46639. t['germandbls'] = 556;
  46640. t['Idieresis'] = 389;
  46641. t['eacute'] = 444;
  46642. t['abreve'] = 500;
  46643. t['uhungarumlaut'] = 556;
  46644. t['ecaron'] = 444;
  46645. t['Ydieresis'] = 722;
  46646. t['divide'] = 570;
  46647. t['Yacute'] = 722;
  46648. t['Acircumflex'] = 722;
  46649. t['aacute'] = 500;
  46650. t['Ucircumflex'] = 722;
  46651. t['yacute'] = 500;
  46652. t['scommaaccent'] = 389;
  46653. t['ecircumflex'] = 444;
  46654. t['Uring'] = 722;
  46655. t['Udieresis'] = 722;
  46656. t['aogonek'] = 500;
  46657. t['Uacute'] = 722;
  46658. t['uogonek'] = 556;
  46659. t['Edieresis'] = 667;
  46660. t['Dcroat'] = 722;
  46661. t['commaaccent'] = 250;
  46662. t['copyright'] = 747;
  46663. t['Emacron'] = 667;
  46664. t['ccaron'] = 444;
  46665. t['aring'] = 500;
  46666. t['Ncommaaccent'] = 722;
  46667. t['lacute'] = 278;
  46668. t['agrave'] = 500;
  46669. t['Tcommaaccent'] = 667;
  46670. t['Cacute'] = 722;
  46671. t['atilde'] = 500;
  46672. t['Edotaccent'] = 667;
  46673. t['scaron'] = 389;
  46674. t['scedilla'] = 389;
  46675. t['iacute'] = 278;
  46676. t['lozenge'] = 494;
  46677. t['Rcaron'] = 722;
  46678. t['Gcommaaccent'] = 778;
  46679. t['ucircumflex'] = 556;
  46680. t['acircumflex'] = 500;
  46681. t['Amacron'] = 722;
  46682. t['rcaron'] = 444;
  46683. t['ccedilla'] = 444;
  46684. t['Zdotaccent'] = 667;
  46685. t['Thorn'] = 611;
  46686. t['Omacron'] = 778;
  46687. t['Racute'] = 722;
  46688. t['Sacute'] = 556;
  46689. t['dcaron'] = 672;
  46690. t['Umacron'] = 722;
  46691. t['uring'] = 556;
  46692. t['threesuperior'] = 300;
  46693. t['Ograve'] = 778;
  46694. t['Agrave'] = 722;
  46695. t['Abreve'] = 722;
  46696. t['multiply'] = 570;
  46697. t['uacute'] = 556;
  46698. t['Tcaron'] = 667;
  46699. t['partialdiff'] = 494;
  46700. t['ydieresis'] = 500;
  46701. t['Nacute'] = 722;
  46702. t['icircumflex'] = 278;
  46703. t['Ecircumflex'] = 667;
  46704. t['adieresis'] = 500;
  46705. t['edieresis'] = 444;
  46706. t['cacute'] = 444;
  46707. t['nacute'] = 556;
  46708. t['umacron'] = 556;
  46709. t['Ncaron'] = 722;
  46710. t['Iacute'] = 389;
  46711. t['plusminus'] = 570;
  46712. t['brokenbar'] = 220;
  46713. t['registered'] = 747;
  46714. t['Gbreve'] = 778;
  46715. t['Idotaccent'] = 389;
  46716. t['summation'] = 600;
  46717. t['Egrave'] = 667;
  46718. t['racute'] = 444;
  46719. t['omacron'] = 500;
  46720. t['Zacute'] = 667;
  46721. t['Zcaron'] = 667;
  46722. t['greaterequal'] = 549;
  46723. t['Eth'] = 722;
  46724. t['Ccedilla'] = 722;
  46725. t['lcommaaccent'] = 278;
  46726. t['tcaron'] = 416;
  46727. t['eogonek'] = 444;
  46728. t['Uogonek'] = 722;
  46729. t['Aacute'] = 722;
  46730. t['Adieresis'] = 722;
  46731. t['egrave'] = 444;
  46732. t['zacute'] = 444;
  46733. t['iogonek'] = 278;
  46734. t['Oacute'] = 778;
  46735. t['oacute'] = 500;
  46736. t['amacron'] = 500;
  46737. t['sacute'] = 389;
  46738. t['idieresis'] = 278;
  46739. t['Ocircumflex'] = 778;
  46740. t['Ugrave'] = 722;
  46741. t['Delta'] = 612;
  46742. t['thorn'] = 556;
  46743. t['twosuperior'] = 300;
  46744. t['Odieresis'] = 778;
  46745. t['mu'] = 556;
  46746. t['igrave'] = 278;
  46747. t['ohungarumlaut'] = 500;
  46748. t['Eogonek'] = 667;
  46749. t['dcroat'] = 556;
  46750. t['threequarters'] = 750;
  46751. t['Scedilla'] = 556;
  46752. t['lcaron'] = 394;
  46753. t['Kcommaaccent'] = 778;
  46754. t['Lacute'] = 667;
  46755. t['trademark'] = 1000;
  46756. t['edotaccent'] = 444;
  46757. t['Igrave'] = 389;
  46758. t['Imacron'] = 389;
  46759. t['Lcaron'] = 667;
  46760. t['onehalf'] = 750;
  46761. t['lessequal'] = 549;
  46762. t['ocircumflex'] = 500;
  46763. t['ntilde'] = 556;
  46764. t['Uhungarumlaut'] = 722;
  46765. t['Eacute'] = 667;
  46766. t['emacron'] = 444;
  46767. t['gbreve'] = 500;
  46768. t['onequarter'] = 750;
  46769. t['Scaron'] = 556;
  46770. t['Scommaaccent'] = 556;
  46771. t['Ohungarumlaut'] = 778;
  46772. t['degree'] = 400;
  46773. t['ograve'] = 500;
  46774. t['Ccaron'] = 722;
  46775. t['ugrave'] = 556;
  46776. t['radical'] = 549;
  46777. t['Dcaron'] = 722;
  46778. t['rcommaaccent'] = 444;
  46779. t['Ntilde'] = 722;
  46780. t['otilde'] = 500;
  46781. t['Rcommaaccent'] = 722;
  46782. t['Lcommaaccent'] = 667;
  46783. t['Atilde'] = 722;
  46784. t['Aogonek'] = 722;
  46785. t['Aring'] = 722;
  46786. t['Otilde'] = 778;
  46787. t['zdotaccent'] = 444;
  46788. t['Ecaron'] = 667;
  46789. t['Iogonek'] = 389;
  46790. t['kcommaaccent'] = 556;
  46791. t['minus'] = 570;
  46792. t['Icircumflex'] = 389;
  46793. t['ncaron'] = 556;
  46794. t['tcommaaccent'] = 333;
  46795. t['logicalnot'] = 570;
  46796. t['odieresis'] = 500;
  46797. t['udieresis'] = 556;
  46798. t['notequal'] = 549;
  46799. t['gcommaaccent'] = 500;
  46800. t['eth'] = 500;
  46801. t['zcaron'] = 444;
  46802. t['ncommaaccent'] = 556;
  46803. t['onesuperior'] = 300;
  46804. t['imacron'] = 278;
  46805. t['Euro'] = 500;
  46806. });
  46807. t['Times-BoldItalic'] = getLookupTableFactory(function (t) {
  46808. t['space'] = 250;
  46809. t['exclam'] = 389;
  46810. t['quotedbl'] = 555;
  46811. t['numbersign'] = 500;
  46812. t['dollar'] = 500;
  46813. t['percent'] = 833;
  46814. t['ampersand'] = 778;
  46815. t['quoteright'] = 333;
  46816. t['parenleft'] = 333;
  46817. t['parenright'] = 333;
  46818. t['asterisk'] = 500;
  46819. t['plus'] = 570;
  46820. t['comma'] = 250;
  46821. t['hyphen'] = 333;
  46822. t['period'] = 250;
  46823. t['slash'] = 278;
  46824. t['zero'] = 500;
  46825. t['one'] = 500;
  46826. t['two'] = 500;
  46827. t['three'] = 500;
  46828. t['four'] = 500;
  46829. t['five'] = 500;
  46830. t['six'] = 500;
  46831. t['seven'] = 500;
  46832. t['eight'] = 500;
  46833. t['nine'] = 500;
  46834. t['colon'] = 333;
  46835. t['semicolon'] = 333;
  46836. t['less'] = 570;
  46837. t['equal'] = 570;
  46838. t['greater'] = 570;
  46839. t['question'] = 500;
  46840. t['at'] = 832;
  46841. t['A'] = 667;
  46842. t['B'] = 667;
  46843. t['C'] = 667;
  46844. t['D'] = 722;
  46845. t['E'] = 667;
  46846. t['F'] = 667;
  46847. t['G'] = 722;
  46848. t['H'] = 778;
  46849. t['I'] = 389;
  46850. t['J'] = 500;
  46851. t['K'] = 667;
  46852. t['L'] = 611;
  46853. t['M'] = 889;
  46854. t['N'] = 722;
  46855. t['O'] = 722;
  46856. t['P'] = 611;
  46857. t['Q'] = 722;
  46858. t['R'] = 667;
  46859. t['S'] = 556;
  46860. t['T'] = 611;
  46861. t['U'] = 722;
  46862. t['V'] = 667;
  46863. t['W'] = 889;
  46864. t['X'] = 667;
  46865. t['Y'] = 611;
  46866. t['Z'] = 611;
  46867. t['bracketleft'] = 333;
  46868. t['backslash'] = 278;
  46869. t['bracketright'] = 333;
  46870. t['asciicircum'] = 570;
  46871. t['underscore'] = 500;
  46872. t['quoteleft'] = 333;
  46873. t['a'] = 500;
  46874. t['b'] = 500;
  46875. t['c'] = 444;
  46876. t['d'] = 500;
  46877. t['e'] = 444;
  46878. t['f'] = 333;
  46879. t['g'] = 500;
  46880. t['h'] = 556;
  46881. t['i'] = 278;
  46882. t['j'] = 278;
  46883. t['k'] = 500;
  46884. t['l'] = 278;
  46885. t['m'] = 778;
  46886. t['n'] = 556;
  46887. t['o'] = 500;
  46888. t['p'] = 500;
  46889. t['q'] = 500;
  46890. t['r'] = 389;
  46891. t['s'] = 389;
  46892. t['t'] = 278;
  46893. t['u'] = 556;
  46894. t['v'] = 444;
  46895. t['w'] = 667;
  46896. t['x'] = 500;
  46897. t['y'] = 444;
  46898. t['z'] = 389;
  46899. t['braceleft'] = 348;
  46900. t['bar'] = 220;
  46901. t['braceright'] = 348;
  46902. t['asciitilde'] = 570;
  46903. t['exclamdown'] = 389;
  46904. t['cent'] = 500;
  46905. t['sterling'] = 500;
  46906. t['fraction'] = 167;
  46907. t['yen'] = 500;
  46908. t['florin'] = 500;
  46909. t['section'] = 500;
  46910. t['currency'] = 500;
  46911. t['quotesingle'] = 278;
  46912. t['quotedblleft'] = 500;
  46913. t['guillemotleft'] = 500;
  46914. t['guilsinglleft'] = 333;
  46915. t['guilsinglright'] = 333;
  46916. t['fi'] = 556;
  46917. t['fl'] = 556;
  46918. t['endash'] = 500;
  46919. t['dagger'] = 500;
  46920. t['daggerdbl'] = 500;
  46921. t['periodcentered'] = 250;
  46922. t['paragraph'] = 500;
  46923. t['bullet'] = 350;
  46924. t['quotesinglbase'] = 333;
  46925. t['quotedblbase'] = 500;
  46926. t['quotedblright'] = 500;
  46927. t['guillemotright'] = 500;
  46928. t['ellipsis'] = 1000;
  46929. t['perthousand'] = 1000;
  46930. t['questiondown'] = 500;
  46931. t['grave'] = 333;
  46932. t['acute'] = 333;
  46933. t['circumflex'] = 333;
  46934. t['tilde'] = 333;
  46935. t['macron'] = 333;
  46936. t['breve'] = 333;
  46937. t['dotaccent'] = 333;
  46938. t['dieresis'] = 333;
  46939. t['ring'] = 333;
  46940. t['cedilla'] = 333;
  46941. t['hungarumlaut'] = 333;
  46942. t['ogonek'] = 333;
  46943. t['caron'] = 333;
  46944. t['emdash'] = 1000;
  46945. t['AE'] = 944;
  46946. t['ordfeminine'] = 266;
  46947. t['Lslash'] = 611;
  46948. t['Oslash'] = 722;
  46949. t['OE'] = 944;
  46950. t['ordmasculine'] = 300;
  46951. t['ae'] = 722;
  46952. t['dotlessi'] = 278;
  46953. t['lslash'] = 278;
  46954. t['oslash'] = 500;
  46955. t['oe'] = 722;
  46956. t['germandbls'] = 500;
  46957. t['Idieresis'] = 389;
  46958. t['eacute'] = 444;
  46959. t['abreve'] = 500;
  46960. t['uhungarumlaut'] = 556;
  46961. t['ecaron'] = 444;
  46962. t['Ydieresis'] = 611;
  46963. t['divide'] = 570;
  46964. t['Yacute'] = 611;
  46965. t['Acircumflex'] = 667;
  46966. t['aacute'] = 500;
  46967. t['Ucircumflex'] = 722;
  46968. t['yacute'] = 444;
  46969. t['scommaaccent'] = 389;
  46970. t['ecircumflex'] = 444;
  46971. t['Uring'] = 722;
  46972. t['Udieresis'] = 722;
  46973. t['aogonek'] = 500;
  46974. t['Uacute'] = 722;
  46975. t['uogonek'] = 556;
  46976. t['Edieresis'] = 667;
  46977. t['Dcroat'] = 722;
  46978. t['commaaccent'] = 250;
  46979. t['copyright'] = 747;
  46980. t['Emacron'] = 667;
  46981. t['ccaron'] = 444;
  46982. t['aring'] = 500;
  46983. t['Ncommaaccent'] = 722;
  46984. t['lacute'] = 278;
  46985. t['agrave'] = 500;
  46986. t['Tcommaaccent'] = 611;
  46987. t['Cacute'] = 667;
  46988. t['atilde'] = 500;
  46989. t['Edotaccent'] = 667;
  46990. t['scaron'] = 389;
  46991. t['scedilla'] = 389;
  46992. t['iacute'] = 278;
  46993. t['lozenge'] = 494;
  46994. t['Rcaron'] = 667;
  46995. t['Gcommaaccent'] = 722;
  46996. t['ucircumflex'] = 556;
  46997. t['acircumflex'] = 500;
  46998. t['Amacron'] = 667;
  46999. t['rcaron'] = 389;
  47000. t['ccedilla'] = 444;
  47001. t['Zdotaccent'] = 611;
  47002. t['Thorn'] = 611;
  47003. t['Omacron'] = 722;
  47004. t['Racute'] = 667;
  47005. t['Sacute'] = 556;
  47006. t['dcaron'] = 608;
  47007. t['Umacron'] = 722;
  47008. t['uring'] = 556;
  47009. t['threesuperior'] = 300;
  47010. t['Ograve'] = 722;
  47011. t['Agrave'] = 667;
  47012. t['Abreve'] = 667;
  47013. t['multiply'] = 570;
  47014. t['uacute'] = 556;
  47015. t['Tcaron'] = 611;
  47016. t['partialdiff'] = 494;
  47017. t['ydieresis'] = 444;
  47018. t['Nacute'] = 722;
  47019. t['icircumflex'] = 278;
  47020. t['Ecircumflex'] = 667;
  47021. t['adieresis'] = 500;
  47022. t['edieresis'] = 444;
  47023. t['cacute'] = 444;
  47024. t['nacute'] = 556;
  47025. t['umacron'] = 556;
  47026. t['Ncaron'] = 722;
  47027. t['Iacute'] = 389;
  47028. t['plusminus'] = 570;
  47029. t['brokenbar'] = 220;
  47030. t['registered'] = 747;
  47031. t['Gbreve'] = 722;
  47032. t['Idotaccent'] = 389;
  47033. t['summation'] = 600;
  47034. t['Egrave'] = 667;
  47035. t['racute'] = 389;
  47036. t['omacron'] = 500;
  47037. t['Zacute'] = 611;
  47038. t['Zcaron'] = 611;
  47039. t['greaterequal'] = 549;
  47040. t['Eth'] = 722;
  47041. t['Ccedilla'] = 667;
  47042. t['lcommaaccent'] = 278;
  47043. t['tcaron'] = 366;
  47044. t['eogonek'] = 444;
  47045. t['Uogonek'] = 722;
  47046. t['Aacute'] = 667;
  47047. t['Adieresis'] = 667;
  47048. t['egrave'] = 444;
  47049. t['zacute'] = 389;
  47050. t['iogonek'] = 278;
  47051. t['Oacute'] = 722;
  47052. t['oacute'] = 500;
  47053. t['amacron'] = 500;
  47054. t['sacute'] = 389;
  47055. t['idieresis'] = 278;
  47056. t['Ocircumflex'] = 722;
  47057. t['Ugrave'] = 722;
  47058. t['Delta'] = 612;
  47059. t['thorn'] = 500;
  47060. t['twosuperior'] = 300;
  47061. t['Odieresis'] = 722;
  47062. t['mu'] = 576;
  47063. t['igrave'] = 278;
  47064. t['ohungarumlaut'] = 500;
  47065. t['Eogonek'] = 667;
  47066. t['dcroat'] = 500;
  47067. t['threequarters'] = 750;
  47068. t['Scedilla'] = 556;
  47069. t['lcaron'] = 382;
  47070. t['Kcommaaccent'] = 667;
  47071. t['Lacute'] = 611;
  47072. t['trademark'] = 1000;
  47073. t['edotaccent'] = 444;
  47074. t['Igrave'] = 389;
  47075. t['Imacron'] = 389;
  47076. t['Lcaron'] = 611;
  47077. t['onehalf'] = 750;
  47078. t['lessequal'] = 549;
  47079. t['ocircumflex'] = 500;
  47080. t['ntilde'] = 556;
  47081. t['Uhungarumlaut'] = 722;
  47082. t['Eacute'] = 667;
  47083. t['emacron'] = 444;
  47084. t['gbreve'] = 500;
  47085. t['onequarter'] = 750;
  47086. t['Scaron'] = 556;
  47087. t['Scommaaccent'] = 556;
  47088. t['Ohungarumlaut'] = 722;
  47089. t['degree'] = 400;
  47090. t['ograve'] = 500;
  47091. t['Ccaron'] = 667;
  47092. t['ugrave'] = 556;
  47093. t['radical'] = 549;
  47094. t['Dcaron'] = 722;
  47095. t['rcommaaccent'] = 389;
  47096. t['Ntilde'] = 722;
  47097. t['otilde'] = 500;
  47098. t['Rcommaaccent'] = 667;
  47099. t['Lcommaaccent'] = 611;
  47100. t['Atilde'] = 667;
  47101. t['Aogonek'] = 667;
  47102. t['Aring'] = 667;
  47103. t['Otilde'] = 722;
  47104. t['zdotaccent'] = 389;
  47105. t['Ecaron'] = 667;
  47106. t['Iogonek'] = 389;
  47107. t['kcommaaccent'] = 500;
  47108. t['minus'] = 606;
  47109. t['Icircumflex'] = 389;
  47110. t['ncaron'] = 556;
  47111. t['tcommaaccent'] = 278;
  47112. t['logicalnot'] = 606;
  47113. t['odieresis'] = 500;
  47114. t['udieresis'] = 556;
  47115. t['notequal'] = 549;
  47116. t['gcommaaccent'] = 500;
  47117. t['eth'] = 500;
  47118. t['zcaron'] = 389;
  47119. t['ncommaaccent'] = 556;
  47120. t['onesuperior'] = 300;
  47121. t['imacron'] = 278;
  47122. t['Euro'] = 500;
  47123. });
  47124. t['Times-Italic'] = getLookupTableFactory(function (t) {
  47125. t['space'] = 250;
  47126. t['exclam'] = 333;
  47127. t['quotedbl'] = 420;
  47128. t['numbersign'] = 500;
  47129. t['dollar'] = 500;
  47130. t['percent'] = 833;
  47131. t['ampersand'] = 778;
  47132. t['quoteright'] = 333;
  47133. t['parenleft'] = 333;
  47134. t['parenright'] = 333;
  47135. t['asterisk'] = 500;
  47136. t['plus'] = 675;
  47137. t['comma'] = 250;
  47138. t['hyphen'] = 333;
  47139. t['period'] = 250;
  47140. t['slash'] = 278;
  47141. t['zero'] = 500;
  47142. t['one'] = 500;
  47143. t['two'] = 500;
  47144. t['three'] = 500;
  47145. t['four'] = 500;
  47146. t['five'] = 500;
  47147. t['six'] = 500;
  47148. t['seven'] = 500;
  47149. t['eight'] = 500;
  47150. t['nine'] = 500;
  47151. t['colon'] = 333;
  47152. t['semicolon'] = 333;
  47153. t['less'] = 675;
  47154. t['equal'] = 675;
  47155. t['greater'] = 675;
  47156. t['question'] = 500;
  47157. t['at'] = 920;
  47158. t['A'] = 611;
  47159. t['B'] = 611;
  47160. t['C'] = 667;
  47161. t['D'] = 722;
  47162. t['E'] = 611;
  47163. t['F'] = 611;
  47164. t['G'] = 722;
  47165. t['H'] = 722;
  47166. t['I'] = 333;
  47167. t['J'] = 444;
  47168. t['K'] = 667;
  47169. t['L'] = 556;
  47170. t['M'] = 833;
  47171. t['N'] = 667;
  47172. t['O'] = 722;
  47173. t['P'] = 611;
  47174. t['Q'] = 722;
  47175. t['R'] = 611;
  47176. t['S'] = 500;
  47177. t['T'] = 556;
  47178. t['U'] = 722;
  47179. t['V'] = 611;
  47180. t['W'] = 833;
  47181. t['X'] = 611;
  47182. t['Y'] = 556;
  47183. t['Z'] = 556;
  47184. t['bracketleft'] = 389;
  47185. t['backslash'] = 278;
  47186. t['bracketright'] = 389;
  47187. t['asciicircum'] = 422;
  47188. t['underscore'] = 500;
  47189. t['quoteleft'] = 333;
  47190. t['a'] = 500;
  47191. t['b'] = 500;
  47192. t['c'] = 444;
  47193. t['d'] = 500;
  47194. t['e'] = 444;
  47195. t['f'] = 278;
  47196. t['g'] = 500;
  47197. t['h'] = 500;
  47198. t['i'] = 278;
  47199. t['j'] = 278;
  47200. t['k'] = 444;
  47201. t['l'] = 278;
  47202. t['m'] = 722;
  47203. t['n'] = 500;
  47204. t['o'] = 500;
  47205. t['p'] = 500;
  47206. t['q'] = 500;
  47207. t['r'] = 389;
  47208. t['s'] = 389;
  47209. t['t'] = 278;
  47210. t['u'] = 500;
  47211. t['v'] = 444;
  47212. t['w'] = 667;
  47213. t['x'] = 444;
  47214. t['y'] = 444;
  47215. t['z'] = 389;
  47216. t['braceleft'] = 400;
  47217. t['bar'] = 275;
  47218. t['braceright'] = 400;
  47219. t['asciitilde'] = 541;
  47220. t['exclamdown'] = 389;
  47221. t['cent'] = 500;
  47222. t['sterling'] = 500;
  47223. t['fraction'] = 167;
  47224. t['yen'] = 500;
  47225. t['florin'] = 500;
  47226. t['section'] = 500;
  47227. t['currency'] = 500;
  47228. t['quotesingle'] = 214;
  47229. t['quotedblleft'] = 556;
  47230. t['guillemotleft'] = 500;
  47231. t['guilsinglleft'] = 333;
  47232. t['guilsinglright'] = 333;
  47233. t['fi'] = 500;
  47234. t['fl'] = 500;
  47235. t['endash'] = 500;
  47236. t['dagger'] = 500;
  47237. t['daggerdbl'] = 500;
  47238. t['periodcentered'] = 250;
  47239. t['paragraph'] = 523;
  47240. t['bullet'] = 350;
  47241. t['quotesinglbase'] = 333;
  47242. t['quotedblbase'] = 556;
  47243. t['quotedblright'] = 556;
  47244. t['guillemotright'] = 500;
  47245. t['ellipsis'] = 889;
  47246. t['perthousand'] = 1000;
  47247. t['questiondown'] = 500;
  47248. t['grave'] = 333;
  47249. t['acute'] = 333;
  47250. t['circumflex'] = 333;
  47251. t['tilde'] = 333;
  47252. t['macron'] = 333;
  47253. t['breve'] = 333;
  47254. t['dotaccent'] = 333;
  47255. t['dieresis'] = 333;
  47256. t['ring'] = 333;
  47257. t['cedilla'] = 333;
  47258. t['hungarumlaut'] = 333;
  47259. t['ogonek'] = 333;
  47260. t['caron'] = 333;
  47261. t['emdash'] = 889;
  47262. t['AE'] = 889;
  47263. t['ordfeminine'] = 276;
  47264. t['Lslash'] = 556;
  47265. t['Oslash'] = 722;
  47266. t['OE'] = 944;
  47267. t['ordmasculine'] = 310;
  47268. t['ae'] = 667;
  47269. t['dotlessi'] = 278;
  47270. t['lslash'] = 278;
  47271. t['oslash'] = 500;
  47272. t['oe'] = 667;
  47273. t['germandbls'] = 500;
  47274. t['Idieresis'] = 333;
  47275. t['eacute'] = 444;
  47276. t['abreve'] = 500;
  47277. t['uhungarumlaut'] = 500;
  47278. t['ecaron'] = 444;
  47279. t['Ydieresis'] = 556;
  47280. t['divide'] = 675;
  47281. t['Yacute'] = 556;
  47282. t['Acircumflex'] = 611;
  47283. t['aacute'] = 500;
  47284. t['Ucircumflex'] = 722;
  47285. t['yacute'] = 444;
  47286. t['scommaaccent'] = 389;
  47287. t['ecircumflex'] = 444;
  47288. t['Uring'] = 722;
  47289. t['Udieresis'] = 722;
  47290. t['aogonek'] = 500;
  47291. t['Uacute'] = 722;
  47292. t['uogonek'] = 500;
  47293. t['Edieresis'] = 611;
  47294. t['Dcroat'] = 722;
  47295. t['commaaccent'] = 250;
  47296. t['copyright'] = 760;
  47297. t['Emacron'] = 611;
  47298. t['ccaron'] = 444;
  47299. t['aring'] = 500;
  47300. t['Ncommaaccent'] = 667;
  47301. t['lacute'] = 278;
  47302. t['agrave'] = 500;
  47303. t['Tcommaaccent'] = 556;
  47304. t['Cacute'] = 667;
  47305. t['atilde'] = 500;
  47306. t['Edotaccent'] = 611;
  47307. t['scaron'] = 389;
  47308. t['scedilla'] = 389;
  47309. t['iacute'] = 278;
  47310. t['lozenge'] = 471;
  47311. t['Rcaron'] = 611;
  47312. t['Gcommaaccent'] = 722;
  47313. t['ucircumflex'] = 500;
  47314. t['acircumflex'] = 500;
  47315. t['Amacron'] = 611;
  47316. t['rcaron'] = 389;
  47317. t['ccedilla'] = 444;
  47318. t['Zdotaccent'] = 556;
  47319. t['Thorn'] = 611;
  47320. t['Omacron'] = 722;
  47321. t['Racute'] = 611;
  47322. t['Sacute'] = 500;
  47323. t['dcaron'] = 544;
  47324. t['Umacron'] = 722;
  47325. t['uring'] = 500;
  47326. t['threesuperior'] = 300;
  47327. t['Ograve'] = 722;
  47328. t['Agrave'] = 611;
  47329. t['Abreve'] = 611;
  47330. t['multiply'] = 675;
  47331. t['uacute'] = 500;
  47332. t['Tcaron'] = 556;
  47333. t['partialdiff'] = 476;
  47334. t['ydieresis'] = 444;
  47335. t['Nacute'] = 667;
  47336. t['icircumflex'] = 278;
  47337. t['Ecircumflex'] = 611;
  47338. t['adieresis'] = 500;
  47339. t['edieresis'] = 444;
  47340. t['cacute'] = 444;
  47341. t['nacute'] = 500;
  47342. t['umacron'] = 500;
  47343. t['Ncaron'] = 667;
  47344. t['Iacute'] = 333;
  47345. t['plusminus'] = 675;
  47346. t['brokenbar'] = 275;
  47347. t['registered'] = 760;
  47348. t['Gbreve'] = 722;
  47349. t['Idotaccent'] = 333;
  47350. t['summation'] = 600;
  47351. t['Egrave'] = 611;
  47352. t['racute'] = 389;
  47353. t['omacron'] = 500;
  47354. t['Zacute'] = 556;
  47355. t['Zcaron'] = 556;
  47356. t['greaterequal'] = 549;
  47357. t['Eth'] = 722;
  47358. t['Ccedilla'] = 667;
  47359. t['lcommaaccent'] = 278;
  47360. t['tcaron'] = 300;
  47361. t['eogonek'] = 444;
  47362. t['Uogonek'] = 722;
  47363. t['Aacute'] = 611;
  47364. t['Adieresis'] = 611;
  47365. t['egrave'] = 444;
  47366. t['zacute'] = 389;
  47367. t['iogonek'] = 278;
  47368. t['Oacute'] = 722;
  47369. t['oacute'] = 500;
  47370. t['amacron'] = 500;
  47371. t['sacute'] = 389;
  47372. t['idieresis'] = 278;
  47373. t['Ocircumflex'] = 722;
  47374. t['Ugrave'] = 722;
  47375. t['Delta'] = 612;
  47376. t['thorn'] = 500;
  47377. t['twosuperior'] = 300;
  47378. t['Odieresis'] = 722;
  47379. t['mu'] = 500;
  47380. t['igrave'] = 278;
  47381. t['ohungarumlaut'] = 500;
  47382. t['Eogonek'] = 611;
  47383. t['dcroat'] = 500;
  47384. t['threequarters'] = 750;
  47385. t['Scedilla'] = 500;
  47386. t['lcaron'] = 300;
  47387. t['Kcommaaccent'] = 667;
  47388. t['Lacute'] = 556;
  47389. t['trademark'] = 980;
  47390. t['edotaccent'] = 444;
  47391. t['Igrave'] = 333;
  47392. t['Imacron'] = 333;
  47393. t['Lcaron'] = 611;
  47394. t['onehalf'] = 750;
  47395. t['lessequal'] = 549;
  47396. t['ocircumflex'] = 500;
  47397. t['ntilde'] = 500;
  47398. t['Uhungarumlaut'] = 722;
  47399. t['Eacute'] = 611;
  47400. t['emacron'] = 444;
  47401. t['gbreve'] = 500;
  47402. t['onequarter'] = 750;
  47403. t['Scaron'] = 500;
  47404. t['Scommaaccent'] = 500;
  47405. t['Ohungarumlaut'] = 722;
  47406. t['degree'] = 400;
  47407. t['ograve'] = 500;
  47408. t['Ccaron'] = 667;
  47409. t['ugrave'] = 500;
  47410. t['radical'] = 453;
  47411. t['Dcaron'] = 722;
  47412. t['rcommaaccent'] = 389;
  47413. t['Ntilde'] = 667;
  47414. t['otilde'] = 500;
  47415. t['Rcommaaccent'] = 611;
  47416. t['Lcommaaccent'] = 556;
  47417. t['Atilde'] = 611;
  47418. t['Aogonek'] = 611;
  47419. t['Aring'] = 611;
  47420. t['Otilde'] = 722;
  47421. t['zdotaccent'] = 389;
  47422. t['Ecaron'] = 611;
  47423. t['Iogonek'] = 333;
  47424. t['kcommaaccent'] = 444;
  47425. t['minus'] = 675;
  47426. t['Icircumflex'] = 333;
  47427. t['ncaron'] = 500;
  47428. t['tcommaaccent'] = 278;
  47429. t['logicalnot'] = 675;
  47430. t['odieresis'] = 500;
  47431. t['udieresis'] = 500;
  47432. t['notequal'] = 549;
  47433. t['gcommaaccent'] = 500;
  47434. t['eth'] = 500;
  47435. t['zcaron'] = 389;
  47436. t['ncommaaccent'] = 500;
  47437. t['onesuperior'] = 300;
  47438. t['imacron'] = 278;
  47439. t['Euro'] = 500;
  47440. });
  47441. t['ZapfDingbats'] = getLookupTableFactory(function (t) {
  47442. t['space'] = 278;
  47443. t['a1'] = 974;
  47444. t['a2'] = 961;
  47445. t['a202'] = 974;
  47446. t['a3'] = 980;
  47447. t['a4'] = 719;
  47448. t['a5'] = 789;
  47449. t['a119'] = 790;
  47450. t['a118'] = 791;
  47451. t['a117'] = 690;
  47452. t['a11'] = 960;
  47453. t['a12'] = 939;
  47454. t['a13'] = 549;
  47455. t['a14'] = 855;
  47456. t['a15'] = 911;
  47457. t['a16'] = 933;
  47458. t['a105'] = 911;
  47459. t['a17'] = 945;
  47460. t['a18'] = 974;
  47461. t['a19'] = 755;
  47462. t['a20'] = 846;
  47463. t['a21'] = 762;
  47464. t['a22'] = 761;
  47465. t['a23'] = 571;
  47466. t['a24'] = 677;
  47467. t['a25'] = 763;
  47468. t['a26'] = 760;
  47469. t['a27'] = 759;
  47470. t['a28'] = 754;
  47471. t['a6'] = 494;
  47472. t['a7'] = 552;
  47473. t['a8'] = 537;
  47474. t['a9'] = 577;
  47475. t['a10'] = 692;
  47476. t['a29'] = 786;
  47477. t['a30'] = 788;
  47478. t['a31'] = 788;
  47479. t['a32'] = 790;
  47480. t['a33'] = 793;
  47481. t['a34'] = 794;
  47482. t['a35'] = 816;
  47483. t['a36'] = 823;
  47484. t['a37'] = 789;
  47485. t['a38'] = 841;
  47486. t['a39'] = 823;
  47487. t['a40'] = 833;
  47488. t['a41'] = 816;
  47489. t['a42'] = 831;
  47490. t['a43'] = 923;
  47491. t['a44'] = 744;
  47492. t['a45'] = 723;
  47493. t['a46'] = 749;
  47494. t['a47'] = 790;
  47495. t['a48'] = 792;
  47496. t['a49'] = 695;
  47497. t['a50'] = 776;
  47498. t['a51'] = 768;
  47499. t['a52'] = 792;
  47500. t['a53'] = 759;
  47501. t['a54'] = 707;
  47502. t['a55'] = 708;
  47503. t['a56'] = 682;
  47504. t['a57'] = 701;
  47505. t['a58'] = 826;
  47506. t['a59'] = 815;
  47507. t['a60'] = 789;
  47508. t['a61'] = 789;
  47509. t['a62'] = 707;
  47510. t['a63'] = 687;
  47511. t['a64'] = 696;
  47512. t['a65'] = 689;
  47513. t['a66'] = 786;
  47514. t['a67'] = 787;
  47515. t['a68'] = 713;
  47516. t['a69'] = 791;
  47517. t['a70'] = 785;
  47518. t['a71'] = 791;
  47519. t['a72'] = 873;
  47520. t['a73'] = 761;
  47521. t['a74'] = 762;
  47522. t['a203'] = 762;
  47523. t['a75'] = 759;
  47524. t['a204'] = 759;
  47525. t['a76'] = 892;
  47526. t['a77'] = 892;
  47527. t['a78'] = 788;
  47528. t['a79'] = 784;
  47529. t['a81'] = 438;
  47530. t['a82'] = 138;
  47531. t['a83'] = 277;
  47532. t['a84'] = 415;
  47533. t['a97'] = 392;
  47534. t['a98'] = 392;
  47535. t['a99'] = 668;
  47536. t['a100'] = 668;
  47537. t['a89'] = 390;
  47538. t['a90'] = 390;
  47539. t['a93'] = 317;
  47540. t['a94'] = 317;
  47541. t['a91'] = 276;
  47542. t['a92'] = 276;
  47543. t['a205'] = 509;
  47544. t['a85'] = 509;
  47545. t['a206'] = 410;
  47546. t['a86'] = 410;
  47547. t['a87'] = 234;
  47548. t['a88'] = 234;
  47549. t['a95'] = 334;
  47550. t['a96'] = 334;
  47551. t['a101'] = 732;
  47552. t['a102'] = 544;
  47553. t['a103'] = 544;
  47554. t['a104'] = 910;
  47555. t['a106'] = 667;
  47556. t['a107'] = 760;
  47557. t['a108'] = 760;
  47558. t['a112'] = 776;
  47559. t['a111'] = 595;
  47560. t['a110'] = 694;
  47561. t['a109'] = 626;
  47562. t['a120'] = 788;
  47563. t['a121'] = 788;
  47564. t['a122'] = 788;
  47565. t['a123'] = 788;
  47566. t['a124'] = 788;
  47567. t['a125'] = 788;
  47568. t['a126'] = 788;
  47569. t['a127'] = 788;
  47570. t['a128'] = 788;
  47571. t['a129'] = 788;
  47572. t['a130'] = 788;
  47573. t['a131'] = 788;
  47574. t['a132'] = 788;
  47575. t['a133'] = 788;
  47576. t['a134'] = 788;
  47577. t['a135'] = 788;
  47578. t['a136'] = 788;
  47579. t['a137'] = 788;
  47580. t['a138'] = 788;
  47581. t['a139'] = 788;
  47582. t['a140'] = 788;
  47583. t['a141'] = 788;
  47584. t['a142'] = 788;
  47585. t['a143'] = 788;
  47586. t['a144'] = 788;
  47587. t['a145'] = 788;
  47588. t['a146'] = 788;
  47589. t['a147'] = 788;
  47590. t['a148'] = 788;
  47591. t['a149'] = 788;
  47592. t['a150'] = 788;
  47593. t['a151'] = 788;
  47594. t['a152'] = 788;
  47595. t['a153'] = 788;
  47596. t['a154'] = 788;
  47597. t['a155'] = 788;
  47598. t['a156'] = 788;
  47599. t['a157'] = 788;
  47600. t['a158'] = 788;
  47601. t['a159'] = 788;
  47602. t['a160'] = 894;
  47603. t['a161'] = 838;
  47604. t['a163'] = 1016;
  47605. t['a164'] = 458;
  47606. t['a196'] = 748;
  47607. t['a165'] = 924;
  47608. t['a192'] = 748;
  47609. t['a166'] = 918;
  47610. t['a167'] = 927;
  47611. t['a168'] = 928;
  47612. t['a169'] = 928;
  47613. t['a170'] = 834;
  47614. t['a171'] = 873;
  47615. t['a172'] = 828;
  47616. t['a173'] = 924;
  47617. t['a162'] = 924;
  47618. t['a174'] = 917;
  47619. t['a175'] = 930;
  47620. t['a176'] = 931;
  47621. t['a177'] = 463;
  47622. t['a178'] = 883;
  47623. t['a179'] = 836;
  47624. t['a193'] = 836;
  47625. t['a180'] = 867;
  47626. t['a199'] = 867;
  47627. t['a181'] = 696;
  47628. t['a200'] = 696;
  47629. t['a182'] = 874;
  47630. t['a201'] = 874;
  47631. t['a183'] = 760;
  47632. t['a184'] = 946;
  47633. t['a197'] = 771;
  47634. t['a185'] = 865;
  47635. t['a194'] = 771;
  47636. t['a198'] = 888;
  47637. t['a186'] = 967;
  47638. t['a195'] = 888;
  47639. t['a187'] = 831;
  47640. t['a188'] = 873;
  47641. t['a189'] = 927;
  47642. t['a190'] = 970;
  47643. t['a191'] = 918;
  47644. });
  47645. });
  47646. exports.getMetrics = getMetrics;
  47647. /***/ }),
  47648. /* 31 */
  47649. /***/ (function(module, exports, __w_pdfjs_require__) {
  47650. "use strict";
  47651. var sharedUtil = __w_pdfjs_require__(0);
  47652. var Uint32ArrayView = sharedUtil.Uint32ArrayView;
  47653. var MurmurHash3_64 = function MurmurHash3_64Closure(seed) {
  47654. var MASK_HIGH = 0xffff0000;
  47655. var MASK_LOW = 0xffff;
  47656. function MurmurHash3_64(seed) {
  47657. var SEED = 0xc3d2e1f0;
  47658. this.h1 = seed ? seed & 0xffffffff : SEED;
  47659. this.h2 = seed ? seed & 0xffffffff : SEED;
  47660. }
  47661. var alwaysUseUint32ArrayView = false;
  47662. try {
  47663. new Uint32Array(new Uint8Array(5).buffer, 0, 1);
  47664. } catch (e) {
  47665. alwaysUseUint32ArrayView = true;
  47666. }
  47667. MurmurHash3_64.prototype = {
  47668. update: function MurmurHash3_64_update(input) {
  47669. var useUint32ArrayView = alwaysUseUint32ArrayView;
  47670. var i;
  47671. if (typeof input === 'string') {
  47672. var data = new Uint8Array(input.length * 2);
  47673. var length = 0;
  47674. for (i = 0; i < input.length; i++) {
  47675. var code = input.charCodeAt(i);
  47676. if (code <= 0xff) {
  47677. data[length++] = code;
  47678. } else {
  47679. data[length++] = code >>> 8;
  47680. data[length++] = code & 0xff;
  47681. }
  47682. }
  47683. } else if (input instanceof Uint8Array) {
  47684. data = input;
  47685. length = data.length;
  47686. } else if (typeof input === 'object' && 'length' in input) {
  47687. data = input;
  47688. length = data.length;
  47689. useUint32ArrayView = true;
  47690. } else {
  47691. throw new Error('Wrong data format in MurmurHash3_64_update. ' + 'Input must be a string or array.');
  47692. }
  47693. var blockCounts = length >> 2;
  47694. var tailLength = length - blockCounts * 4;
  47695. var dataUint32 = useUint32ArrayView ? new Uint32ArrayView(data, blockCounts) : new Uint32Array(data.buffer, 0, blockCounts);
  47696. var k1 = 0;
  47697. var k2 = 0;
  47698. var h1 = this.h1;
  47699. var h2 = this.h2;
  47700. var C1 = 0xcc9e2d51;
  47701. var C2 = 0x1b873593;
  47702. var C1_LOW = C1 & MASK_LOW;
  47703. var C2_LOW = C2 & MASK_LOW;
  47704. for (i = 0; i < blockCounts; i++) {
  47705. if (i & 1) {
  47706. k1 = dataUint32[i];
  47707. k1 = k1 * C1 & MASK_HIGH | k1 * C1_LOW & MASK_LOW;
  47708. k1 = k1 << 15 | k1 >>> 17;
  47709. k1 = k1 * C2 & MASK_HIGH | k1 * C2_LOW & MASK_LOW;
  47710. h1 ^= k1;
  47711. h1 = h1 << 13 | h1 >>> 19;
  47712. h1 = h1 * 5 + 0xe6546b64;
  47713. } else {
  47714. k2 = dataUint32[i];
  47715. k2 = k2 * C1 & MASK_HIGH | k2 * C1_LOW & MASK_LOW;
  47716. k2 = k2 << 15 | k2 >>> 17;
  47717. k2 = k2 * C2 & MASK_HIGH | k2 * C2_LOW & MASK_LOW;
  47718. h2 ^= k2;
  47719. h2 = h2 << 13 | h2 >>> 19;
  47720. h2 = h2 * 5 + 0xe6546b64;
  47721. }
  47722. }
  47723. k1 = 0;
  47724. switch (tailLength) {
  47725. case 3:
  47726. k1 ^= data[blockCounts * 4 + 2] << 16;
  47727. case 2:
  47728. k1 ^= data[blockCounts * 4 + 1] << 8;
  47729. case 1:
  47730. k1 ^= data[blockCounts * 4];
  47731. k1 = k1 * C1 & MASK_HIGH | k1 * C1_LOW & MASK_LOW;
  47732. k1 = k1 << 15 | k1 >>> 17;
  47733. k1 = k1 * C2 & MASK_HIGH | k1 * C2_LOW & MASK_LOW;
  47734. if (blockCounts & 1) {
  47735. h1 ^= k1;
  47736. } else {
  47737. h2 ^= k1;
  47738. }
  47739. }
  47740. this.h1 = h1;
  47741. this.h2 = h2;
  47742. return this;
  47743. },
  47744. hexdigest: function MurmurHash3_64_hexdigest() {
  47745. var h1 = this.h1;
  47746. var h2 = this.h2;
  47747. h1 ^= h2 >>> 1;
  47748. h1 = h1 * 0xed558ccd & MASK_HIGH | h1 * 0x8ccd & MASK_LOW;
  47749. h2 = h2 * 0xff51afd7 & MASK_HIGH | ((h2 << 16 | h1 >>> 16) * 0xafd7ed55 & MASK_HIGH) >>> 16;
  47750. h1 ^= h2 >>> 1;
  47751. h1 = h1 * 0x1a85ec53 & MASK_HIGH | h1 * 0xec53 & MASK_LOW;
  47752. h2 = h2 * 0xc4ceb9fe & MASK_HIGH | ((h2 << 16 | h1 >>> 16) * 0xb9fe1a85 & MASK_HIGH) >>> 16;
  47753. h1 ^= h2 >>> 1;
  47754. for (var i = 0, arr = [
  47755. h1,
  47756. h2
  47757. ], str = ''; i < arr.length; i++) {
  47758. var hex = (arr[i] >>> 0).toString(16);
  47759. while (hex.length < 8) {
  47760. hex = '0' + hex;
  47761. }
  47762. str += hex;
  47763. }
  47764. return str;
  47765. }
  47766. };
  47767. return MurmurHash3_64;
  47768. }();
  47769. exports.MurmurHash3_64 = MurmurHash3_64;
  47770. /***/ }),
  47771. /* 32 */
  47772. /***/ (function(module, exports, __w_pdfjs_require__) {
  47773. "use strict";
  47774. var sharedUtil = __w_pdfjs_require__(0);
  47775. var corePrimitives = __w_pdfjs_require__(1);
  47776. var coreFunction = __w_pdfjs_require__(6);
  47777. var coreColorSpace = __w_pdfjs_require__(3);
  47778. var UNSUPPORTED_FEATURES = sharedUtil.UNSUPPORTED_FEATURES;
  47779. var MissingDataException = sharedUtil.MissingDataException;
  47780. var Util = sharedUtil.Util;
  47781. var assert = sharedUtil.assert;
  47782. var error = sharedUtil.error;
  47783. var info = sharedUtil.info;
  47784. var warn = sharedUtil.warn;
  47785. var isStream = corePrimitives.isStream;
  47786. var PDFFunction = coreFunction.PDFFunction;
  47787. var ColorSpace = coreColorSpace.ColorSpace;
  47788. var ShadingType = {
  47789. FUNCTION_BASED: 1,
  47790. AXIAL: 2,
  47791. RADIAL: 3,
  47792. FREE_FORM_MESH: 4,
  47793. LATTICE_FORM_MESH: 5,
  47794. COONS_PATCH_MESH: 6,
  47795. TENSOR_PATCH_MESH: 7
  47796. };
  47797. var Pattern = function PatternClosure() {
  47798. function Pattern() {
  47799. error('should not call Pattern constructor');
  47800. }
  47801. Pattern.prototype = {
  47802. getPattern: function Pattern_getPattern(ctx) {
  47803. error('Should not call Pattern.getStyle: ' + ctx);
  47804. }
  47805. };
  47806. Pattern.parseShading = function Pattern_parseShading(shading, matrix, xref, res, handler) {
  47807. var dict = isStream(shading) ? shading.dict : shading;
  47808. var type = dict.get('ShadingType');
  47809. try {
  47810. switch (type) {
  47811. case ShadingType.AXIAL:
  47812. case ShadingType.RADIAL:
  47813. return new Shadings.RadialAxial(dict, matrix, xref, res);
  47814. case ShadingType.FREE_FORM_MESH:
  47815. case ShadingType.LATTICE_FORM_MESH:
  47816. case ShadingType.COONS_PATCH_MESH:
  47817. case ShadingType.TENSOR_PATCH_MESH:
  47818. return new Shadings.Mesh(shading, matrix, xref, res);
  47819. default:
  47820. throw new Error('Unsupported ShadingType: ' + type);
  47821. }
  47822. } catch (ex) {
  47823. if (ex instanceof MissingDataException) {
  47824. throw ex;
  47825. }
  47826. handler.send('UnsupportedFeature', { featureId: UNSUPPORTED_FEATURES.shadingPattern });
  47827. warn(ex);
  47828. return new Shadings.Dummy();
  47829. }
  47830. };
  47831. return Pattern;
  47832. }();
  47833. var Shadings = {};
  47834. Shadings.SMALL_NUMBER = 1e-6;
  47835. Shadings.RadialAxial = function RadialAxialClosure() {
  47836. function RadialAxial(dict, matrix, xref, res) {
  47837. this.matrix = matrix;
  47838. this.coordsArr = dict.getArray('Coords');
  47839. this.shadingType = dict.get('ShadingType');
  47840. this.type = 'Pattern';
  47841. var cs = dict.get('ColorSpace', 'CS');
  47842. cs = ColorSpace.parse(cs, xref, res);
  47843. this.cs = cs;
  47844. var t0 = 0.0, t1 = 1.0;
  47845. if (dict.has('Domain')) {
  47846. var domainArr = dict.getArray('Domain');
  47847. t0 = domainArr[0];
  47848. t1 = domainArr[1];
  47849. }
  47850. var extendStart = false, extendEnd = false;
  47851. if (dict.has('Extend')) {
  47852. var extendArr = dict.getArray('Extend');
  47853. extendStart = extendArr[0];
  47854. extendEnd = extendArr[1];
  47855. }
  47856. if (this.shadingType === ShadingType.RADIAL && (!extendStart || !extendEnd)) {
  47857. var x1 = this.coordsArr[0];
  47858. var y1 = this.coordsArr[1];
  47859. var r1 = this.coordsArr[2];
  47860. var x2 = this.coordsArr[3];
  47861. var y2 = this.coordsArr[4];
  47862. var r2 = this.coordsArr[5];
  47863. var distance = Math.sqrt((x1 - x2) * (x1 - x2) + (y1 - y2) * (y1 - y2));
  47864. if (r1 <= r2 + distance && r2 <= r1 + distance) {
  47865. warn('Unsupported radial gradient.');
  47866. }
  47867. }
  47868. this.extendStart = extendStart;
  47869. this.extendEnd = extendEnd;
  47870. var fnObj = dict.get('Function');
  47871. var fn = PDFFunction.parseArray(xref, fnObj);
  47872. var diff = t1 - t0;
  47873. var step = diff / 10;
  47874. var colorStops = this.colorStops = [];
  47875. if (t0 >= t1 || step <= 0) {
  47876. info('Bad shading domain.');
  47877. return;
  47878. }
  47879. var color = new Float32Array(cs.numComps), ratio = new Float32Array(1);
  47880. var rgbColor;
  47881. for (var i = t0; i <= t1; i += step) {
  47882. ratio[0] = i;
  47883. fn(ratio, 0, color, 0);
  47884. rgbColor = cs.getRgb(color, 0);
  47885. var cssColor = Util.makeCssRgb(rgbColor[0], rgbColor[1], rgbColor[2]);
  47886. colorStops.push([
  47887. (i - t0) / diff,
  47888. cssColor
  47889. ]);
  47890. }
  47891. var background = 'transparent';
  47892. if (dict.has('Background')) {
  47893. rgbColor = cs.getRgb(dict.get('Background'), 0);
  47894. background = Util.makeCssRgb(rgbColor[0], rgbColor[1], rgbColor[2]);
  47895. }
  47896. if (!extendStart) {
  47897. colorStops.unshift([
  47898. 0,
  47899. background
  47900. ]);
  47901. colorStops[1][0] += Shadings.SMALL_NUMBER;
  47902. }
  47903. if (!extendEnd) {
  47904. colorStops[colorStops.length - 1][0] -= Shadings.SMALL_NUMBER;
  47905. colorStops.push([
  47906. 1,
  47907. background
  47908. ]);
  47909. }
  47910. this.colorStops = colorStops;
  47911. }
  47912. RadialAxial.prototype = {
  47913. getIR: function RadialAxial_getIR() {
  47914. var coordsArr = this.coordsArr;
  47915. var shadingType = this.shadingType;
  47916. var type, p0, p1, r0, r1;
  47917. if (shadingType === ShadingType.AXIAL) {
  47918. p0 = [
  47919. coordsArr[0],
  47920. coordsArr[1]
  47921. ];
  47922. p1 = [
  47923. coordsArr[2],
  47924. coordsArr[3]
  47925. ];
  47926. r0 = null;
  47927. r1 = null;
  47928. type = 'axial';
  47929. } else if (shadingType === ShadingType.RADIAL) {
  47930. p0 = [
  47931. coordsArr[0],
  47932. coordsArr[1]
  47933. ];
  47934. p1 = [
  47935. coordsArr[3],
  47936. coordsArr[4]
  47937. ];
  47938. r0 = coordsArr[2];
  47939. r1 = coordsArr[5];
  47940. type = 'radial';
  47941. } else {
  47942. error('getPattern type unknown: ' + shadingType);
  47943. }
  47944. var matrix = this.matrix;
  47945. if (matrix) {
  47946. p0 = Util.applyTransform(p0, matrix);
  47947. p1 = Util.applyTransform(p1, matrix);
  47948. if (shadingType === ShadingType.RADIAL) {
  47949. var scale = Util.singularValueDecompose2dScale(matrix);
  47950. r0 *= scale[0];
  47951. r1 *= scale[1];
  47952. }
  47953. }
  47954. return [
  47955. 'RadialAxial',
  47956. type,
  47957. this.colorStops,
  47958. p0,
  47959. p1,
  47960. r0,
  47961. r1
  47962. ];
  47963. }
  47964. };
  47965. return RadialAxial;
  47966. }();
  47967. Shadings.Mesh = function MeshClosure() {
  47968. function MeshStreamReader(stream, context) {
  47969. this.stream = stream;
  47970. this.context = context;
  47971. this.buffer = 0;
  47972. this.bufferLength = 0;
  47973. var numComps = context.numComps;
  47974. this.tmpCompsBuf = new Float32Array(numComps);
  47975. var csNumComps = context.colorSpace.numComps;
  47976. this.tmpCsCompsBuf = context.colorFn ? new Float32Array(csNumComps) : this.tmpCompsBuf;
  47977. }
  47978. MeshStreamReader.prototype = {
  47979. get hasData() {
  47980. if (this.stream.end) {
  47981. return this.stream.pos < this.stream.end;
  47982. }
  47983. if (this.bufferLength > 0) {
  47984. return true;
  47985. }
  47986. var nextByte = this.stream.getByte();
  47987. if (nextByte < 0) {
  47988. return false;
  47989. }
  47990. this.buffer = nextByte;
  47991. this.bufferLength = 8;
  47992. return true;
  47993. },
  47994. readBits: function MeshStreamReader_readBits(n) {
  47995. var buffer = this.buffer;
  47996. var bufferLength = this.bufferLength;
  47997. if (n === 32) {
  47998. if (bufferLength === 0) {
  47999. return (this.stream.getByte() << 24 | this.stream.getByte() << 16 | this.stream.getByte() << 8 | this.stream.getByte()) >>> 0;
  48000. }
  48001. buffer = buffer << 24 | this.stream.getByte() << 16 | this.stream.getByte() << 8 | this.stream.getByte();
  48002. var nextByte = this.stream.getByte();
  48003. this.buffer = nextByte & (1 << bufferLength) - 1;
  48004. return (buffer << 8 - bufferLength | (nextByte & 0xFF) >> bufferLength) >>> 0;
  48005. }
  48006. if (n === 8 && bufferLength === 0) {
  48007. return this.stream.getByte();
  48008. }
  48009. while (bufferLength < n) {
  48010. buffer = buffer << 8 | this.stream.getByte();
  48011. bufferLength += 8;
  48012. }
  48013. bufferLength -= n;
  48014. this.bufferLength = bufferLength;
  48015. this.buffer = buffer & (1 << bufferLength) - 1;
  48016. return buffer >> bufferLength;
  48017. },
  48018. align: function MeshStreamReader_align() {
  48019. this.buffer = 0;
  48020. this.bufferLength = 0;
  48021. },
  48022. readFlag: function MeshStreamReader_readFlag() {
  48023. return this.readBits(this.context.bitsPerFlag);
  48024. },
  48025. readCoordinate: function MeshStreamReader_readCoordinate() {
  48026. var bitsPerCoordinate = this.context.bitsPerCoordinate;
  48027. var xi = this.readBits(bitsPerCoordinate);
  48028. var yi = this.readBits(bitsPerCoordinate);
  48029. var decode = this.context.decode;
  48030. var scale = bitsPerCoordinate < 32 ? 1 / ((1 << bitsPerCoordinate) - 1) : 2.3283064365386963e-10;
  48031. return [
  48032. xi * scale * (decode[1] - decode[0]) + decode[0],
  48033. yi * scale * (decode[3] - decode[2]) + decode[2]
  48034. ];
  48035. },
  48036. readComponents: function MeshStreamReader_readComponents() {
  48037. var numComps = this.context.numComps;
  48038. var bitsPerComponent = this.context.bitsPerComponent;
  48039. var scale = bitsPerComponent < 32 ? 1 / ((1 << bitsPerComponent) - 1) : 2.3283064365386963e-10;
  48040. var decode = this.context.decode;
  48041. var components = this.tmpCompsBuf;
  48042. for (var i = 0, j = 4; i < numComps; i++, j += 2) {
  48043. var ci = this.readBits(bitsPerComponent);
  48044. components[i] = ci * scale * (decode[j + 1] - decode[j]) + decode[j];
  48045. }
  48046. var color = this.tmpCsCompsBuf;
  48047. if (this.context.colorFn) {
  48048. this.context.colorFn(components, 0, color, 0);
  48049. }
  48050. return this.context.colorSpace.getRgb(color, 0);
  48051. }
  48052. };
  48053. function decodeType4Shading(mesh, reader) {
  48054. var coords = mesh.coords;
  48055. var colors = mesh.colors;
  48056. var operators = [];
  48057. var ps = [];
  48058. var verticesLeft = 0;
  48059. while (reader.hasData) {
  48060. var f = reader.readFlag();
  48061. var coord = reader.readCoordinate();
  48062. var color = reader.readComponents();
  48063. if (verticesLeft === 0) {
  48064. assert(0 <= f && f <= 2, 'Unknown type4 flag');
  48065. switch (f) {
  48066. case 0:
  48067. verticesLeft = 3;
  48068. break;
  48069. case 1:
  48070. ps.push(ps[ps.length - 2], ps[ps.length - 1]);
  48071. verticesLeft = 1;
  48072. break;
  48073. case 2:
  48074. ps.push(ps[ps.length - 3], ps[ps.length - 1]);
  48075. verticesLeft = 1;
  48076. break;
  48077. }
  48078. operators.push(f);
  48079. }
  48080. ps.push(coords.length);
  48081. coords.push(coord);
  48082. colors.push(color);
  48083. verticesLeft--;
  48084. reader.align();
  48085. }
  48086. mesh.figures.push({
  48087. type: 'triangles',
  48088. coords: new Int32Array(ps),
  48089. colors: new Int32Array(ps)
  48090. });
  48091. }
  48092. function decodeType5Shading(mesh, reader, verticesPerRow) {
  48093. var coords = mesh.coords;
  48094. var colors = mesh.colors;
  48095. var ps = [];
  48096. while (reader.hasData) {
  48097. var coord = reader.readCoordinate();
  48098. var color = reader.readComponents();
  48099. ps.push(coords.length);
  48100. coords.push(coord);
  48101. colors.push(color);
  48102. }
  48103. mesh.figures.push({
  48104. type: 'lattice',
  48105. coords: new Int32Array(ps),
  48106. colors: new Int32Array(ps),
  48107. verticesPerRow: verticesPerRow
  48108. });
  48109. }
  48110. var MIN_SPLIT_PATCH_CHUNKS_AMOUNT = 3;
  48111. var MAX_SPLIT_PATCH_CHUNKS_AMOUNT = 20;
  48112. var TRIANGLE_DENSITY = 20;
  48113. var getB = function getBClosure() {
  48114. function buildB(count) {
  48115. var lut = [];
  48116. for (var i = 0; i <= count; i++) {
  48117. var t = i / count, t_ = 1 - t;
  48118. lut.push(new Float32Array([
  48119. t_ * t_ * t_,
  48120. 3 * t * t_ * t_,
  48121. 3 * t * t * t_,
  48122. t * t * t
  48123. ]));
  48124. }
  48125. return lut;
  48126. }
  48127. var cache = [];
  48128. return function getB(count) {
  48129. if (!cache[count]) {
  48130. cache[count] = buildB(count);
  48131. }
  48132. return cache[count];
  48133. };
  48134. }();
  48135. function buildFigureFromPatch(mesh, index) {
  48136. var figure = mesh.figures[index];
  48137. assert(figure.type === 'patch', 'Unexpected patch mesh figure');
  48138. var coords = mesh.coords, colors = mesh.colors;
  48139. var pi = figure.coords;
  48140. var ci = figure.colors;
  48141. var figureMinX = Math.min(coords[pi[0]][0], coords[pi[3]][0], coords[pi[12]][0], coords[pi[15]][0]);
  48142. var figureMinY = Math.min(coords[pi[0]][1], coords[pi[3]][1], coords[pi[12]][1], coords[pi[15]][1]);
  48143. var figureMaxX = Math.max(coords[pi[0]][0], coords[pi[3]][0], coords[pi[12]][0], coords[pi[15]][0]);
  48144. var figureMaxY = Math.max(coords[pi[0]][1], coords[pi[3]][1], coords[pi[12]][1], coords[pi[15]][1]);
  48145. var splitXBy = Math.ceil((figureMaxX - figureMinX) * TRIANGLE_DENSITY / (mesh.bounds[2] - mesh.bounds[0]));
  48146. splitXBy = Math.max(MIN_SPLIT_PATCH_CHUNKS_AMOUNT, Math.min(MAX_SPLIT_PATCH_CHUNKS_AMOUNT, splitXBy));
  48147. var splitYBy = Math.ceil((figureMaxY - figureMinY) * TRIANGLE_DENSITY / (mesh.bounds[3] - mesh.bounds[1]));
  48148. splitYBy = Math.max(MIN_SPLIT_PATCH_CHUNKS_AMOUNT, Math.min(MAX_SPLIT_PATCH_CHUNKS_AMOUNT, splitYBy));
  48149. var verticesPerRow = splitXBy + 1;
  48150. var figureCoords = new Int32Array((splitYBy + 1) * verticesPerRow);
  48151. var figureColors = new Int32Array((splitYBy + 1) * verticesPerRow);
  48152. var k = 0;
  48153. var cl = new Uint8Array(3), cr = new Uint8Array(3);
  48154. var c0 = colors[ci[0]], c1 = colors[ci[1]], c2 = colors[ci[2]], c3 = colors[ci[3]];
  48155. var bRow = getB(splitYBy), bCol = getB(splitXBy);
  48156. for (var row = 0; row <= splitYBy; row++) {
  48157. cl[0] = (c0[0] * (splitYBy - row) + c2[0] * row) / splitYBy | 0;
  48158. cl[1] = (c0[1] * (splitYBy - row) + c2[1] * row) / splitYBy | 0;
  48159. cl[2] = (c0[2] * (splitYBy - row) + c2[2] * row) / splitYBy | 0;
  48160. cr[0] = (c1[0] * (splitYBy - row) + c3[0] * row) / splitYBy | 0;
  48161. cr[1] = (c1[1] * (splitYBy - row) + c3[1] * row) / splitYBy | 0;
  48162. cr[2] = (c1[2] * (splitYBy - row) + c3[2] * row) / splitYBy | 0;
  48163. for (var col = 0; col <= splitXBy; col++, k++) {
  48164. if ((row === 0 || row === splitYBy) && (col === 0 || col === splitXBy)) {
  48165. continue;
  48166. }
  48167. var x = 0, y = 0;
  48168. var q = 0;
  48169. for (var i = 0; i <= 3; i++) {
  48170. for (var j = 0; j <= 3; j++, q++) {
  48171. var m = bRow[row][i] * bCol[col][j];
  48172. x += coords[pi[q]][0] * m;
  48173. y += coords[pi[q]][1] * m;
  48174. }
  48175. }
  48176. figureCoords[k] = coords.length;
  48177. coords.push([
  48178. x,
  48179. y
  48180. ]);
  48181. figureColors[k] = colors.length;
  48182. var newColor = new Uint8Array(3);
  48183. newColor[0] = (cl[0] * (splitXBy - col) + cr[0] * col) / splitXBy | 0;
  48184. newColor[1] = (cl[1] * (splitXBy - col) + cr[1] * col) / splitXBy | 0;
  48185. newColor[2] = (cl[2] * (splitXBy - col) + cr[2] * col) / splitXBy | 0;
  48186. colors.push(newColor);
  48187. }
  48188. }
  48189. figureCoords[0] = pi[0];
  48190. figureColors[0] = ci[0];
  48191. figureCoords[splitXBy] = pi[3];
  48192. figureColors[splitXBy] = ci[1];
  48193. figureCoords[verticesPerRow * splitYBy] = pi[12];
  48194. figureColors[verticesPerRow * splitYBy] = ci[2];
  48195. figureCoords[verticesPerRow * splitYBy + splitXBy] = pi[15];
  48196. figureColors[verticesPerRow * splitYBy + splitXBy] = ci[3];
  48197. mesh.figures[index] = {
  48198. type: 'lattice',
  48199. coords: figureCoords,
  48200. colors: figureColors,
  48201. verticesPerRow: verticesPerRow
  48202. };
  48203. }
  48204. function decodeType6Shading(mesh, reader) {
  48205. var coords = mesh.coords;
  48206. var colors = mesh.colors;
  48207. var ps = new Int32Array(16);
  48208. var cs = new Int32Array(4);
  48209. while (reader.hasData) {
  48210. var f = reader.readFlag();
  48211. assert(0 <= f && f <= 3, 'Unknown type6 flag');
  48212. var i, ii;
  48213. var pi = coords.length;
  48214. for (i = 0, ii = f !== 0 ? 8 : 12; i < ii; i++) {
  48215. coords.push(reader.readCoordinate());
  48216. }
  48217. var ci = colors.length;
  48218. for (i = 0, ii = f !== 0 ? 2 : 4; i < ii; i++) {
  48219. colors.push(reader.readComponents());
  48220. }
  48221. var tmp1, tmp2, tmp3, tmp4;
  48222. switch (f) {
  48223. case 0:
  48224. ps[12] = pi + 3;
  48225. ps[13] = pi + 4;
  48226. ps[14] = pi + 5;
  48227. ps[15] = pi + 6;
  48228. ps[8] = pi + 2;
  48229. ps[11] = pi + 7;
  48230. ps[4] = pi + 1;
  48231. ps[7] = pi + 8;
  48232. ps[0] = pi;
  48233. ps[1] = pi + 11;
  48234. ps[2] = pi + 10;
  48235. ps[3] = pi + 9;
  48236. cs[2] = ci + 1;
  48237. cs[3] = ci + 2;
  48238. cs[0] = ci;
  48239. cs[1] = ci + 3;
  48240. break;
  48241. case 1:
  48242. tmp1 = ps[12];
  48243. tmp2 = ps[13];
  48244. tmp3 = ps[14];
  48245. tmp4 = ps[15];
  48246. ps[12] = tmp4;
  48247. ps[13] = pi + 0;
  48248. ps[14] = pi + 1;
  48249. ps[15] = pi + 2;
  48250. ps[8] = tmp3;
  48251. ps[11] = pi + 3;
  48252. ps[4] = tmp2;
  48253. ps[7] = pi + 4;
  48254. ps[0] = tmp1;
  48255. ps[1] = pi + 7;
  48256. ps[2] = pi + 6;
  48257. ps[3] = pi + 5;
  48258. tmp1 = cs[2];
  48259. tmp2 = cs[3];
  48260. cs[2] = tmp2;
  48261. cs[3] = ci;
  48262. cs[0] = tmp1;
  48263. cs[1] = ci + 1;
  48264. break;
  48265. case 2:
  48266. tmp1 = ps[15];
  48267. tmp2 = ps[11];
  48268. ps[12] = ps[3];
  48269. ps[13] = pi + 0;
  48270. ps[14] = pi + 1;
  48271. ps[15] = pi + 2;
  48272. ps[8] = ps[7];
  48273. ps[11] = pi + 3;
  48274. ps[4] = tmp2;
  48275. ps[7] = pi + 4;
  48276. ps[0] = tmp1;
  48277. ps[1] = pi + 7;
  48278. ps[2] = pi + 6;
  48279. ps[3] = pi + 5;
  48280. tmp1 = cs[3];
  48281. cs[2] = cs[1];
  48282. cs[3] = ci;
  48283. cs[0] = tmp1;
  48284. cs[1] = ci + 1;
  48285. break;
  48286. case 3:
  48287. ps[12] = ps[0];
  48288. ps[13] = pi + 0;
  48289. ps[14] = pi + 1;
  48290. ps[15] = pi + 2;
  48291. ps[8] = ps[1];
  48292. ps[11] = pi + 3;
  48293. ps[4] = ps[2];
  48294. ps[7] = pi + 4;
  48295. ps[0] = ps[3];
  48296. ps[1] = pi + 7;
  48297. ps[2] = pi + 6;
  48298. ps[3] = pi + 5;
  48299. cs[2] = cs[0];
  48300. cs[3] = ci;
  48301. cs[0] = cs[1];
  48302. cs[1] = ci + 1;
  48303. break;
  48304. }
  48305. ps[5] = coords.length;
  48306. coords.push([
  48307. (-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,
  48308. (-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
  48309. ]);
  48310. ps[6] = coords.length;
  48311. coords.push([
  48312. (-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,
  48313. (-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
  48314. ]);
  48315. ps[9] = coords.length;
  48316. coords.push([
  48317. (-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,
  48318. (-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
  48319. ]);
  48320. ps[10] = coords.length;
  48321. coords.push([
  48322. (-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,
  48323. (-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
  48324. ]);
  48325. mesh.figures.push({
  48326. type: 'patch',
  48327. coords: new Int32Array(ps),
  48328. colors: new Int32Array(cs)
  48329. });
  48330. }
  48331. }
  48332. function decodeType7Shading(mesh, reader) {
  48333. var coords = mesh.coords;
  48334. var colors = mesh.colors;
  48335. var ps = new Int32Array(16);
  48336. var cs = new Int32Array(4);
  48337. while (reader.hasData) {
  48338. var f = reader.readFlag();
  48339. assert(0 <= f && f <= 3, 'Unknown type7 flag');
  48340. var i, ii;
  48341. var pi = coords.length;
  48342. for (i = 0, ii = f !== 0 ? 12 : 16; i < ii; i++) {
  48343. coords.push(reader.readCoordinate());
  48344. }
  48345. var ci = colors.length;
  48346. for (i = 0, ii = f !== 0 ? 2 : 4; i < ii; i++) {
  48347. colors.push(reader.readComponents());
  48348. }
  48349. var tmp1, tmp2, tmp3, tmp4;
  48350. switch (f) {
  48351. case 0:
  48352. ps[12] = pi + 3;
  48353. ps[13] = pi + 4;
  48354. ps[14] = pi + 5;
  48355. ps[15] = pi + 6;
  48356. ps[8] = pi + 2;
  48357. ps[9] = pi + 13;
  48358. ps[10] = pi + 14;
  48359. ps[11] = pi + 7;
  48360. ps[4] = pi + 1;
  48361. ps[5] = pi + 12;
  48362. ps[6] = pi + 15;
  48363. ps[7] = pi + 8;
  48364. ps[0] = pi;
  48365. ps[1] = pi + 11;
  48366. ps[2] = pi + 10;
  48367. ps[3] = pi + 9;
  48368. cs[2] = ci + 1;
  48369. cs[3] = ci + 2;
  48370. cs[0] = ci;
  48371. cs[1] = ci + 3;
  48372. break;
  48373. case 1:
  48374. tmp1 = ps[12];
  48375. tmp2 = ps[13];
  48376. tmp3 = ps[14];
  48377. tmp4 = ps[15];
  48378. ps[12] = tmp4;
  48379. ps[13] = pi + 0;
  48380. ps[14] = pi + 1;
  48381. ps[15] = pi + 2;
  48382. ps[8] = tmp3;
  48383. ps[9] = pi + 9;
  48384. ps[10] = pi + 10;
  48385. ps[11] = pi + 3;
  48386. ps[4] = tmp2;
  48387. ps[5] = pi + 8;
  48388. ps[6] = pi + 11;
  48389. ps[7] = pi + 4;
  48390. ps[0] = tmp1;
  48391. ps[1] = pi + 7;
  48392. ps[2] = pi + 6;
  48393. ps[3] = pi + 5;
  48394. tmp1 = cs[2];
  48395. tmp2 = cs[3];
  48396. cs[2] = tmp2;
  48397. cs[3] = ci;
  48398. cs[0] = tmp1;
  48399. cs[1] = ci + 1;
  48400. break;
  48401. case 2:
  48402. tmp1 = ps[15];
  48403. tmp2 = ps[11];
  48404. ps[12] = ps[3];
  48405. ps[13] = pi + 0;
  48406. ps[14] = pi + 1;
  48407. ps[15] = pi + 2;
  48408. ps[8] = ps[7];
  48409. ps[9] = pi + 9;
  48410. ps[10] = pi + 10;
  48411. ps[11] = pi + 3;
  48412. ps[4] = tmp2;
  48413. ps[5] = pi + 8;
  48414. ps[6] = pi + 11;
  48415. ps[7] = pi + 4;
  48416. ps[0] = tmp1;
  48417. ps[1] = pi + 7;
  48418. ps[2] = pi + 6;
  48419. ps[3] = pi + 5;
  48420. tmp1 = cs[3];
  48421. cs[2] = cs[1];
  48422. cs[3] = ci;
  48423. cs[0] = tmp1;
  48424. cs[1] = ci + 1;
  48425. break;
  48426. case 3:
  48427. ps[12] = ps[0];
  48428. ps[13] = pi + 0;
  48429. ps[14] = pi + 1;
  48430. ps[15] = pi + 2;
  48431. ps[8] = ps[1];
  48432. ps[9] = pi + 9;
  48433. ps[10] = pi + 10;
  48434. ps[11] = pi + 3;
  48435. ps[4] = ps[2];
  48436. ps[5] = pi + 8;
  48437. ps[6] = pi + 11;
  48438. ps[7] = pi + 4;
  48439. ps[0] = ps[3];
  48440. ps[1] = pi + 7;
  48441. ps[2] = pi + 6;
  48442. ps[3] = pi + 5;
  48443. cs[2] = cs[0];
  48444. cs[3] = ci;
  48445. cs[0] = cs[1];
  48446. cs[1] = ci + 1;
  48447. break;
  48448. }
  48449. mesh.figures.push({
  48450. type: 'patch',
  48451. coords: new Int32Array(ps),
  48452. colors: new Int32Array(cs)
  48453. });
  48454. }
  48455. }
  48456. function updateBounds(mesh) {
  48457. var minX = mesh.coords[0][0], minY = mesh.coords[0][1], maxX = minX, maxY = minY;
  48458. for (var i = 1, ii = mesh.coords.length; i < ii; i++) {
  48459. var x = mesh.coords[i][0], y = mesh.coords[i][1];
  48460. minX = minX > x ? x : minX;
  48461. minY = minY > y ? y : minY;
  48462. maxX = maxX < x ? x : maxX;
  48463. maxY = maxY < y ? y : maxY;
  48464. }
  48465. mesh.bounds = [
  48466. minX,
  48467. minY,
  48468. maxX,
  48469. maxY
  48470. ];
  48471. }
  48472. function packData(mesh) {
  48473. var i, ii, j, jj;
  48474. var coords = mesh.coords;
  48475. var coordsPacked = new Float32Array(coords.length * 2);
  48476. for (i = 0, j = 0, ii = coords.length; i < ii; i++) {
  48477. var xy = coords[i];
  48478. coordsPacked[j++] = xy[0];
  48479. coordsPacked[j++] = xy[1];
  48480. }
  48481. mesh.coords = coordsPacked;
  48482. var colors = mesh.colors;
  48483. var colorsPacked = new Uint8Array(colors.length * 3);
  48484. for (i = 0, j = 0, ii = colors.length; i < ii; i++) {
  48485. var c = colors[i];
  48486. colorsPacked[j++] = c[0];
  48487. colorsPacked[j++] = c[1];
  48488. colorsPacked[j++] = c[2];
  48489. }
  48490. mesh.colors = colorsPacked;
  48491. var figures = mesh.figures;
  48492. for (i = 0, ii = figures.length; i < ii; i++) {
  48493. var figure = figures[i], ps = figure.coords, cs = figure.colors;
  48494. for (j = 0, jj = ps.length; j < jj; j++) {
  48495. ps[j] *= 2;
  48496. cs[j] *= 3;
  48497. }
  48498. }
  48499. }
  48500. function Mesh(stream, matrix, xref, res) {
  48501. assert(isStream(stream), 'Mesh data is not a stream');
  48502. var dict = stream.dict;
  48503. this.matrix = matrix;
  48504. this.shadingType = dict.get('ShadingType');
  48505. this.type = 'Pattern';
  48506. this.bbox = dict.getArray('BBox');
  48507. var cs = dict.get('ColorSpace', 'CS');
  48508. cs = ColorSpace.parse(cs, xref, res);
  48509. this.cs = cs;
  48510. this.background = dict.has('Background') ? cs.getRgb(dict.get('Background'), 0) : null;
  48511. var fnObj = dict.get('Function');
  48512. var fn = fnObj ? PDFFunction.parseArray(xref, fnObj) : null;
  48513. this.coords = [];
  48514. this.colors = [];
  48515. this.figures = [];
  48516. var decodeContext = {
  48517. bitsPerCoordinate: dict.get('BitsPerCoordinate'),
  48518. bitsPerComponent: dict.get('BitsPerComponent'),
  48519. bitsPerFlag: dict.get('BitsPerFlag'),
  48520. decode: dict.getArray('Decode'),
  48521. colorFn: fn,
  48522. colorSpace: cs,
  48523. numComps: fn ? 1 : cs.numComps
  48524. };
  48525. var reader = new MeshStreamReader(stream, decodeContext);
  48526. var patchMesh = false;
  48527. switch (this.shadingType) {
  48528. case ShadingType.FREE_FORM_MESH:
  48529. decodeType4Shading(this, reader);
  48530. break;
  48531. case ShadingType.LATTICE_FORM_MESH:
  48532. var verticesPerRow = dict.get('VerticesPerRow') | 0;
  48533. assert(verticesPerRow >= 2, 'Invalid VerticesPerRow');
  48534. decodeType5Shading(this, reader, verticesPerRow);
  48535. break;
  48536. case ShadingType.COONS_PATCH_MESH:
  48537. decodeType6Shading(this, reader);
  48538. patchMesh = true;
  48539. break;
  48540. case ShadingType.TENSOR_PATCH_MESH:
  48541. decodeType7Shading(this, reader);
  48542. patchMesh = true;
  48543. break;
  48544. default:
  48545. error('Unsupported mesh type.');
  48546. break;
  48547. }
  48548. if (patchMesh) {
  48549. updateBounds(this);
  48550. for (var i = 0, ii = this.figures.length; i < ii; i++) {
  48551. buildFigureFromPatch(this, i);
  48552. }
  48553. }
  48554. updateBounds(this);
  48555. packData(this);
  48556. }
  48557. Mesh.prototype = {
  48558. getIR: function Mesh_getIR() {
  48559. return [
  48560. 'Mesh',
  48561. this.shadingType,
  48562. this.coords,
  48563. this.colors,
  48564. this.figures,
  48565. this.bounds,
  48566. this.matrix,
  48567. this.bbox,
  48568. this.background
  48569. ];
  48570. }
  48571. };
  48572. return Mesh;
  48573. }();
  48574. Shadings.Dummy = function DummyClosure() {
  48575. function Dummy() {
  48576. this.type = 'Pattern';
  48577. }
  48578. Dummy.prototype = {
  48579. getIR: function Dummy_getIR() {
  48580. return ['Dummy'];
  48581. }
  48582. };
  48583. return Dummy;
  48584. }();
  48585. function getTilingPatternIR(operatorList, dict, args) {
  48586. var matrix = dict.getArray('Matrix');
  48587. var bbox = dict.getArray('BBox');
  48588. var xstep = dict.get('XStep');
  48589. var ystep = dict.get('YStep');
  48590. var paintType = dict.get('PaintType');
  48591. var tilingType = dict.get('TilingType');
  48592. return [
  48593. 'TilingPattern',
  48594. args,
  48595. operatorList,
  48596. matrix,
  48597. bbox,
  48598. xstep,
  48599. ystep,
  48600. paintType,
  48601. tilingType
  48602. ];
  48603. }
  48604. exports.Pattern = Pattern;
  48605. exports.getTilingPatternIR = getTilingPatternIR;
  48606. /***/ }),
  48607. /* 33 */
  48608. /***/ (function(module, exports, __w_pdfjs_require__) {
  48609. "use strict";
  48610. var sharedUtil = __w_pdfjs_require__(0);
  48611. var coreStream = __w_pdfjs_require__(2);
  48612. var coreChunkedStream = __w_pdfjs_require__(12);
  48613. var coreDocument = __w_pdfjs_require__(24);
  48614. var warn = sharedUtil.warn;
  48615. var createValidAbsoluteUrl = sharedUtil.createValidAbsoluteUrl;
  48616. var shadow = sharedUtil.shadow;
  48617. var NotImplementedException = sharedUtil.NotImplementedException;
  48618. var MissingDataException = sharedUtil.MissingDataException;
  48619. var createPromiseCapability = sharedUtil.createPromiseCapability;
  48620. var Util = sharedUtil.Util;
  48621. var Stream = coreStream.Stream;
  48622. var ChunkedStreamManager = coreChunkedStream.ChunkedStreamManager;
  48623. var PDFDocument = coreDocument.PDFDocument;
  48624. var BasePdfManager = function BasePdfManagerClosure() {
  48625. function BasePdfManager() {
  48626. throw new Error('Cannot initialize BaseManagerManager');
  48627. }
  48628. BasePdfManager.prototype = {
  48629. get docId() {
  48630. return this._docId;
  48631. },
  48632. get password() {
  48633. return this._password;
  48634. },
  48635. get docBaseUrl() {
  48636. var docBaseUrl = null;
  48637. if (this._docBaseUrl) {
  48638. var absoluteUrl = createValidAbsoluteUrl(this._docBaseUrl);
  48639. if (absoluteUrl) {
  48640. docBaseUrl = absoluteUrl.href;
  48641. } else {
  48642. warn('Invalid absolute docBaseUrl: "' + this._docBaseUrl + '".');
  48643. }
  48644. }
  48645. return shadow(this, 'docBaseUrl', docBaseUrl);
  48646. },
  48647. onLoadedStream: function BasePdfManager_onLoadedStream() {
  48648. throw new NotImplementedException();
  48649. },
  48650. ensureDoc: function BasePdfManager_ensureDoc(prop, args) {
  48651. return this.ensure(this.pdfDocument, prop, args);
  48652. },
  48653. ensureXRef: function BasePdfManager_ensureXRef(prop, args) {
  48654. return this.ensure(this.pdfDocument.xref, prop, args);
  48655. },
  48656. ensureCatalog: function BasePdfManager_ensureCatalog(prop, args) {
  48657. return this.ensure(this.pdfDocument.catalog, prop, args);
  48658. },
  48659. getPage: function BasePdfManager_getPage(pageIndex) {
  48660. return this.pdfDocument.getPage(pageIndex);
  48661. },
  48662. cleanup: function BasePdfManager_cleanup() {
  48663. return this.pdfDocument.cleanup();
  48664. },
  48665. ensure: function BasePdfManager_ensure(obj, prop, args) {
  48666. return new NotImplementedException();
  48667. },
  48668. requestRange: function BasePdfManager_requestRange(begin, end) {
  48669. return new NotImplementedException();
  48670. },
  48671. requestLoadedStream: function BasePdfManager_requestLoadedStream() {
  48672. return new NotImplementedException();
  48673. },
  48674. sendProgressiveData: function BasePdfManager_sendProgressiveData(chunk) {
  48675. return new NotImplementedException();
  48676. },
  48677. updatePassword: function BasePdfManager_updatePassword(password) {
  48678. this._password = password;
  48679. },
  48680. terminate: function BasePdfManager_terminate() {
  48681. return new NotImplementedException();
  48682. }
  48683. };
  48684. return BasePdfManager;
  48685. }();
  48686. var LocalPdfManager = function LocalPdfManagerClosure() {
  48687. function LocalPdfManager(docId, data, password, evaluatorOptions, docBaseUrl) {
  48688. this._docId = docId;
  48689. this._password = password;
  48690. this._docBaseUrl = docBaseUrl;
  48691. this.evaluatorOptions = evaluatorOptions;
  48692. var stream = new Stream(data);
  48693. this.pdfDocument = new PDFDocument(this, stream);
  48694. this._loadedStreamCapability = createPromiseCapability();
  48695. this._loadedStreamCapability.resolve(stream);
  48696. }
  48697. Util.inherit(LocalPdfManager, BasePdfManager, {
  48698. ensure: function LocalPdfManager_ensure(obj, prop, args) {
  48699. return new Promise(function (resolve, reject) {
  48700. try {
  48701. var value = obj[prop];
  48702. var result;
  48703. if (typeof value === 'function') {
  48704. result = value.apply(obj, args);
  48705. } else {
  48706. result = value;
  48707. }
  48708. resolve(result);
  48709. } catch (e) {
  48710. reject(e);
  48711. }
  48712. });
  48713. },
  48714. requestRange: function LocalPdfManager_requestRange(begin, end) {
  48715. return Promise.resolve();
  48716. },
  48717. requestLoadedStream: function LocalPdfManager_requestLoadedStream() {
  48718. },
  48719. onLoadedStream: function LocalPdfManager_onLoadedStream() {
  48720. return this._loadedStreamCapability.promise;
  48721. },
  48722. terminate: function LocalPdfManager_terminate() {
  48723. }
  48724. });
  48725. return LocalPdfManager;
  48726. }();
  48727. var NetworkPdfManager = function NetworkPdfManagerClosure() {
  48728. function NetworkPdfManager(docId, pdfNetworkStream, args, evaluatorOptions, docBaseUrl) {
  48729. this._docId = docId;
  48730. this._password = args.password;
  48731. this._docBaseUrl = docBaseUrl;
  48732. this.msgHandler = args.msgHandler;
  48733. this.evaluatorOptions = evaluatorOptions;
  48734. var params = {
  48735. msgHandler: args.msgHandler,
  48736. url: args.url,
  48737. length: args.length,
  48738. disableAutoFetch: args.disableAutoFetch,
  48739. rangeChunkSize: args.rangeChunkSize
  48740. };
  48741. this.streamManager = new ChunkedStreamManager(pdfNetworkStream, params);
  48742. this.pdfDocument = new PDFDocument(this, this.streamManager.getStream());
  48743. }
  48744. Util.inherit(NetworkPdfManager, BasePdfManager, {
  48745. ensure: function NetworkPdfManager_ensure(obj, prop, args) {
  48746. var pdfManager = this;
  48747. return new Promise(function (resolve, reject) {
  48748. function ensureHelper() {
  48749. try {
  48750. var result;
  48751. var value = obj[prop];
  48752. if (typeof value === 'function') {
  48753. result = value.apply(obj, args);
  48754. } else {
  48755. result = value;
  48756. }
  48757. resolve(result);
  48758. } catch (e) {
  48759. if (!(e instanceof MissingDataException)) {
  48760. reject(e);
  48761. return;
  48762. }
  48763. pdfManager.streamManager.requestRange(e.begin, e.end).then(ensureHelper, reject);
  48764. }
  48765. }
  48766. ensureHelper();
  48767. });
  48768. },
  48769. requestRange: function NetworkPdfManager_requestRange(begin, end) {
  48770. return this.streamManager.requestRange(begin, end);
  48771. },
  48772. requestLoadedStream: function NetworkPdfManager_requestLoadedStream() {
  48773. this.streamManager.requestAllChunks();
  48774. },
  48775. sendProgressiveData: function NetworkPdfManager_sendProgressiveData(chunk) {
  48776. this.streamManager.onReceiveData({ chunk: chunk });
  48777. },
  48778. onLoadedStream: function NetworkPdfManager_onLoadedStream() {
  48779. return this.streamManager.onLoadedStream();
  48780. },
  48781. terminate: function NetworkPdfManager_terminate() {
  48782. this.streamManager.abort();
  48783. }
  48784. });
  48785. return NetworkPdfManager;
  48786. }();
  48787. exports.LocalPdfManager = LocalPdfManager;
  48788. exports.NetworkPdfManager = NetworkPdfManager;
  48789. /***/ }),
  48790. /* 34 */
  48791. /***/ (function(module, exports, __w_pdfjs_require__) {
  48792. "use strict";
  48793. var sharedUtil = __w_pdfjs_require__(0);
  48794. var corePrimitives = __w_pdfjs_require__(1);
  48795. var error = sharedUtil.error;
  48796. var isSpace = sharedUtil.isSpace;
  48797. var EOF = corePrimitives.EOF;
  48798. var PostScriptParser = function PostScriptParserClosure() {
  48799. function PostScriptParser(lexer) {
  48800. this.lexer = lexer;
  48801. this.operators = [];
  48802. this.token = null;
  48803. this.prev = null;
  48804. }
  48805. PostScriptParser.prototype = {
  48806. nextToken: function PostScriptParser_nextToken() {
  48807. this.prev = this.token;
  48808. this.token = this.lexer.getToken();
  48809. },
  48810. accept: function PostScriptParser_accept(type) {
  48811. if (this.token.type === type) {
  48812. this.nextToken();
  48813. return true;
  48814. }
  48815. return false;
  48816. },
  48817. expect: function PostScriptParser_expect(type) {
  48818. if (this.accept(type)) {
  48819. return true;
  48820. }
  48821. error('Unexpected symbol: found ' + this.token.type + ' expected ' + type + '.');
  48822. },
  48823. parse: function PostScriptParser_parse() {
  48824. this.nextToken();
  48825. this.expect(PostScriptTokenTypes.LBRACE);
  48826. this.parseBlock();
  48827. this.expect(PostScriptTokenTypes.RBRACE);
  48828. return this.operators;
  48829. },
  48830. parseBlock: function PostScriptParser_parseBlock() {
  48831. while (true) {
  48832. if (this.accept(PostScriptTokenTypes.NUMBER)) {
  48833. this.operators.push(this.prev.value);
  48834. } else if (this.accept(PostScriptTokenTypes.OPERATOR)) {
  48835. this.operators.push(this.prev.value);
  48836. } else if (this.accept(PostScriptTokenTypes.LBRACE)) {
  48837. this.parseCondition();
  48838. } else {
  48839. return;
  48840. }
  48841. }
  48842. },
  48843. parseCondition: function PostScriptParser_parseCondition() {
  48844. var conditionLocation = this.operators.length;
  48845. this.operators.push(null, null);
  48846. this.parseBlock();
  48847. this.expect(PostScriptTokenTypes.RBRACE);
  48848. if (this.accept(PostScriptTokenTypes.IF)) {
  48849. this.operators[conditionLocation] = this.operators.length;
  48850. this.operators[conditionLocation + 1] = 'jz';
  48851. } else if (this.accept(PostScriptTokenTypes.LBRACE)) {
  48852. var jumpLocation = this.operators.length;
  48853. this.operators.push(null, null);
  48854. var endOfTrue = this.operators.length;
  48855. this.parseBlock();
  48856. this.expect(PostScriptTokenTypes.RBRACE);
  48857. this.expect(PostScriptTokenTypes.IFELSE);
  48858. this.operators[jumpLocation] = this.operators.length;
  48859. this.operators[jumpLocation + 1] = 'j';
  48860. this.operators[conditionLocation] = endOfTrue;
  48861. this.operators[conditionLocation + 1] = 'jz';
  48862. } else {
  48863. error('PS Function: error parsing conditional.');
  48864. }
  48865. }
  48866. };
  48867. return PostScriptParser;
  48868. }();
  48869. var PostScriptTokenTypes = {
  48870. LBRACE: 0,
  48871. RBRACE: 1,
  48872. NUMBER: 2,
  48873. OPERATOR: 3,
  48874. IF: 4,
  48875. IFELSE: 5
  48876. };
  48877. var PostScriptToken = function PostScriptTokenClosure() {
  48878. function PostScriptToken(type, value) {
  48879. this.type = type;
  48880. this.value = value;
  48881. }
  48882. var opCache = Object.create(null);
  48883. PostScriptToken.getOperator = function PostScriptToken_getOperator(op) {
  48884. var opValue = opCache[op];
  48885. if (opValue) {
  48886. return opValue;
  48887. }
  48888. return opCache[op] = new PostScriptToken(PostScriptTokenTypes.OPERATOR, op);
  48889. };
  48890. PostScriptToken.LBRACE = new PostScriptToken(PostScriptTokenTypes.LBRACE, '{');
  48891. PostScriptToken.RBRACE = new PostScriptToken(PostScriptTokenTypes.RBRACE, '}');
  48892. PostScriptToken.IF = new PostScriptToken(PostScriptTokenTypes.IF, 'IF');
  48893. PostScriptToken.IFELSE = new PostScriptToken(PostScriptTokenTypes.IFELSE, 'IFELSE');
  48894. return PostScriptToken;
  48895. }();
  48896. var PostScriptLexer = function PostScriptLexerClosure() {
  48897. function PostScriptLexer(stream) {
  48898. this.stream = stream;
  48899. this.nextChar();
  48900. this.strBuf = [];
  48901. }
  48902. PostScriptLexer.prototype = {
  48903. nextChar: function PostScriptLexer_nextChar() {
  48904. return this.currentChar = this.stream.getByte();
  48905. },
  48906. getToken: function PostScriptLexer_getToken() {
  48907. var comment = false;
  48908. var ch = this.currentChar;
  48909. while (true) {
  48910. if (ch < 0) {
  48911. return EOF;
  48912. }
  48913. if (comment) {
  48914. if (ch === 0x0A || ch === 0x0D) {
  48915. comment = false;
  48916. }
  48917. } else if (ch === 0x25) {
  48918. comment = true;
  48919. } else if (!isSpace(ch)) {
  48920. break;
  48921. }
  48922. ch = this.nextChar();
  48923. }
  48924. switch (ch | 0) {
  48925. case 0x30:
  48926. case 0x31:
  48927. case 0x32:
  48928. case 0x33:
  48929. case 0x34:
  48930. case 0x35:
  48931. case 0x36:
  48932. case 0x37:
  48933. case 0x38:
  48934. case 0x39:
  48935. case 0x2B:
  48936. case 0x2D:
  48937. case 0x2E:
  48938. return new PostScriptToken(PostScriptTokenTypes.NUMBER, this.getNumber());
  48939. case 0x7B:
  48940. this.nextChar();
  48941. return PostScriptToken.LBRACE;
  48942. case 0x7D:
  48943. this.nextChar();
  48944. return PostScriptToken.RBRACE;
  48945. }
  48946. var strBuf = this.strBuf;
  48947. strBuf.length = 0;
  48948. strBuf[0] = String.fromCharCode(ch);
  48949. while ((ch = this.nextChar()) >= 0 && (ch >= 0x41 && ch <= 0x5A || ch >= 0x61 && ch <= 0x7A)) {
  48950. strBuf.push(String.fromCharCode(ch));
  48951. }
  48952. var str = strBuf.join('');
  48953. switch (str.toLowerCase()) {
  48954. case 'if':
  48955. return PostScriptToken.IF;
  48956. case 'ifelse':
  48957. return PostScriptToken.IFELSE;
  48958. default:
  48959. return PostScriptToken.getOperator(str);
  48960. }
  48961. },
  48962. getNumber: function PostScriptLexer_getNumber() {
  48963. var ch = this.currentChar;
  48964. var strBuf = this.strBuf;
  48965. strBuf.length = 0;
  48966. strBuf[0] = String.fromCharCode(ch);
  48967. while ((ch = this.nextChar()) >= 0) {
  48968. if (ch >= 0x30 && ch <= 0x39 || ch === 0x2D || ch === 0x2E) {
  48969. strBuf.push(String.fromCharCode(ch));
  48970. } else {
  48971. break;
  48972. }
  48973. }
  48974. var value = parseFloat(strBuf.join(''));
  48975. if (isNaN(value)) {
  48976. error('Invalid floating point number: ' + value);
  48977. }
  48978. return value;
  48979. }
  48980. };
  48981. return PostScriptLexer;
  48982. }();
  48983. exports.PostScriptLexer = PostScriptLexer;
  48984. exports.PostScriptParser = PostScriptParser;
  48985. /***/ }),
  48986. /* 35 */
  48987. /***/ (function(module, exports, __w_pdfjs_require__) {
  48988. "use strict";
  48989. var sharedUtil = __w_pdfjs_require__(0);
  48990. var coreStream = __w_pdfjs_require__(2);
  48991. var coreEncodings = __w_pdfjs_require__(4);
  48992. var warn = sharedUtil.warn;
  48993. var isSpace = sharedUtil.isSpace;
  48994. var Stream = coreStream.Stream;
  48995. var getEncoding = coreEncodings.getEncoding;
  48996. var HINTING_ENABLED = false;
  48997. var Type1CharString = function Type1CharStringClosure() {
  48998. var COMMAND_MAP = {
  48999. 'hstem': [1],
  49000. 'vstem': [3],
  49001. 'vmoveto': [4],
  49002. 'rlineto': [5],
  49003. 'hlineto': [6],
  49004. 'vlineto': [7],
  49005. 'rrcurveto': [8],
  49006. 'callsubr': [10],
  49007. 'flex': [
  49008. 12,
  49009. 35
  49010. ],
  49011. 'drop': [
  49012. 12,
  49013. 18
  49014. ],
  49015. 'endchar': [14],
  49016. 'rmoveto': [21],
  49017. 'hmoveto': [22],
  49018. 'vhcurveto': [30],
  49019. 'hvcurveto': [31]
  49020. };
  49021. function Type1CharString() {
  49022. this.width = 0;
  49023. this.lsb = 0;
  49024. this.flexing = false;
  49025. this.output = [];
  49026. this.stack = [];
  49027. }
  49028. Type1CharString.prototype = {
  49029. convert: function Type1CharString_convert(encoded, subrs, seacAnalysisEnabled) {
  49030. var count = encoded.length;
  49031. var error = false;
  49032. var wx, sbx, subrNumber;
  49033. for (var i = 0; i < count; i++) {
  49034. var value = encoded[i];
  49035. if (value < 32) {
  49036. if (value === 12) {
  49037. value = (value << 8) + encoded[++i];
  49038. }
  49039. switch (value) {
  49040. case 1:
  49041. if (!HINTING_ENABLED) {
  49042. this.stack = [];
  49043. break;
  49044. }
  49045. error = this.executeCommand(2, COMMAND_MAP.hstem);
  49046. break;
  49047. case 3:
  49048. if (!HINTING_ENABLED) {
  49049. this.stack = [];
  49050. break;
  49051. }
  49052. error = this.executeCommand(2, COMMAND_MAP.vstem);
  49053. break;
  49054. case 4:
  49055. if (this.flexing) {
  49056. if (this.stack.length < 1) {
  49057. error = true;
  49058. break;
  49059. }
  49060. var dy = this.stack.pop();
  49061. this.stack.push(0, dy);
  49062. break;
  49063. }
  49064. error = this.executeCommand(1, COMMAND_MAP.vmoveto);
  49065. break;
  49066. case 5:
  49067. error = this.executeCommand(2, COMMAND_MAP.rlineto);
  49068. break;
  49069. case 6:
  49070. error = this.executeCommand(1, COMMAND_MAP.hlineto);
  49071. break;
  49072. case 7:
  49073. error = this.executeCommand(1, COMMAND_MAP.vlineto);
  49074. break;
  49075. case 8:
  49076. error = this.executeCommand(6, COMMAND_MAP.rrcurveto);
  49077. break;
  49078. case 9:
  49079. this.stack = [];
  49080. break;
  49081. case 10:
  49082. if (this.stack.length < 1) {
  49083. error = true;
  49084. break;
  49085. }
  49086. subrNumber = this.stack.pop();
  49087. error = this.convert(subrs[subrNumber], subrs, seacAnalysisEnabled);
  49088. break;
  49089. case 11:
  49090. return error;
  49091. case 13:
  49092. if (this.stack.length < 2) {
  49093. error = true;
  49094. break;
  49095. }
  49096. wx = this.stack.pop();
  49097. sbx = this.stack.pop();
  49098. this.lsb = sbx;
  49099. this.width = wx;
  49100. this.stack.push(wx, sbx);
  49101. error = this.executeCommand(2, COMMAND_MAP.hmoveto);
  49102. break;
  49103. case 14:
  49104. this.output.push(COMMAND_MAP.endchar[0]);
  49105. break;
  49106. case 21:
  49107. if (this.flexing) {
  49108. break;
  49109. }
  49110. error = this.executeCommand(2, COMMAND_MAP.rmoveto);
  49111. break;
  49112. case 22:
  49113. if (this.flexing) {
  49114. this.stack.push(0);
  49115. break;
  49116. }
  49117. error = this.executeCommand(1, COMMAND_MAP.hmoveto);
  49118. break;
  49119. case 30:
  49120. error = this.executeCommand(4, COMMAND_MAP.vhcurveto);
  49121. break;
  49122. case 31:
  49123. error = this.executeCommand(4, COMMAND_MAP.hvcurveto);
  49124. break;
  49125. case (12 << 8) + 0:
  49126. this.stack = [];
  49127. break;
  49128. case (12 << 8) + 1:
  49129. if (!HINTING_ENABLED) {
  49130. this.stack = [];
  49131. break;
  49132. }
  49133. error = this.executeCommand(2, COMMAND_MAP.vstem);
  49134. break;
  49135. case (12 << 8) + 2:
  49136. if (!HINTING_ENABLED) {
  49137. this.stack = [];
  49138. break;
  49139. }
  49140. error = this.executeCommand(2, COMMAND_MAP.hstem);
  49141. break;
  49142. case (12 << 8) + 6:
  49143. if (seacAnalysisEnabled) {
  49144. this.seac = this.stack.splice(-4, 4);
  49145. error = this.executeCommand(0, COMMAND_MAP.endchar);
  49146. } else {
  49147. error = this.executeCommand(4, COMMAND_MAP.endchar);
  49148. }
  49149. break;
  49150. case (12 << 8) + 7:
  49151. if (this.stack.length < 4) {
  49152. error = true;
  49153. break;
  49154. }
  49155. this.stack.pop();
  49156. wx = this.stack.pop();
  49157. var sby = this.stack.pop();
  49158. sbx = this.stack.pop();
  49159. this.lsb = sbx;
  49160. this.width = wx;
  49161. this.stack.push(wx, sbx, sby);
  49162. error = this.executeCommand(3, COMMAND_MAP.rmoveto);
  49163. break;
  49164. case (12 << 8) + 12:
  49165. if (this.stack.length < 2) {
  49166. error = true;
  49167. break;
  49168. }
  49169. var num2 = this.stack.pop();
  49170. var num1 = this.stack.pop();
  49171. this.stack.push(num1 / num2);
  49172. break;
  49173. case (12 << 8) + 16:
  49174. if (this.stack.length < 2) {
  49175. error = true;
  49176. break;
  49177. }
  49178. subrNumber = this.stack.pop();
  49179. var numArgs = this.stack.pop();
  49180. if (subrNumber === 0 && numArgs === 3) {
  49181. var flexArgs = this.stack.splice(this.stack.length - 17, 17);
  49182. 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]);
  49183. error = this.executeCommand(13, COMMAND_MAP.flex, true);
  49184. this.flexing = false;
  49185. this.stack.push(flexArgs[15], flexArgs[16]);
  49186. } else if (subrNumber === 1 && numArgs === 0) {
  49187. this.flexing = true;
  49188. }
  49189. break;
  49190. case (12 << 8) + 17:
  49191. break;
  49192. case (12 << 8) + 33:
  49193. this.stack = [];
  49194. break;
  49195. default:
  49196. warn('Unknown type 1 charstring command of "' + value + '"');
  49197. break;
  49198. }
  49199. if (error) {
  49200. break;
  49201. }
  49202. continue;
  49203. } else if (value <= 246) {
  49204. value = value - 139;
  49205. } else if (value <= 250) {
  49206. value = (value - 247) * 256 + encoded[++i] + 108;
  49207. } else if (value <= 254) {
  49208. value = -((value - 251) * 256) - encoded[++i] - 108;
  49209. } else {
  49210. value = (encoded[++i] & 0xff) << 24 | (encoded[++i] & 0xff) << 16 | (encoded[++i] & 0xff) << 8 | (encoded[++i] & 0xff) << 0;
  49211. }
  49212. this.stack.push(value);
  49213. }
  49214. return error;
  49215. },
  49216. executeCommand: function (howManyArgs, command, keepStack) {
  49217. var stackLength = this.stack.length;
  49218. if (howManyArgs > stackLength) {
  49219. return true;
  49220. }
  49221. var start = stackLength - howManyArgs;
  49222. for (var i = start; i < stackLength; i++) {
  49223. var value = this.stack[i];
  49224. if (value === (value | 0)) {
  49225. this.output.push(28, value >> 8 & 0xff, value & 0xff);
  49226. } else {
  49227. value = 65536 * value | 0;
  49228. this.output.push(255, value >> 24 & 0xFF, value >> 16 & 0xFF, value >> 8 & 0xFF, value & 0xFF);
  49229. }
  49230. }
  49231. this.output.push.apply(this.output, command);
  49232. if (keepStack) {
  49233. this.stack.splice(start, howManyArgs);
  49234. } else {
  49235. this.stack.length = 0;
  49236. }
  49237. return false;
  49238. }
  49239. };
  49240. return Type1CharString;
  49241. }();
  49242. var Type1Parser = function Type1ParserClosure() {
  49243. var EEXEC_ENCRYPT_KEY = 55665;
  49244. var CHAR_STRS_ENCRYPT_KEY = 4330;
  49245. function isHexDigit(code) {
  49246. return code >= 48 && code <= 57 || code >= 65 && code <= 70 || code >= 97 && code <= 102;
  49247. }
  49248. function decrypt(data, key, discardNumber) {
  49249. if (discardNumber >= data.length) {
  49250. return new Uint8Array(0);
  49251. }
  49252. var r = key | 0, c1 = 52845, c2 = 22719, i, j;
  49253. for (i = 0; i < discardNumber; i++) {
  49254. r = (data[i] + r) * c1 + c2 & (1 << 16) - 1;
  49255. }
  49256. var count = data.length - discardNumber;
  49257. var decrypted = new Uint8Array(count);
  49258. for (i = discardNumber, j = 0; j < count; i++, j++) {
  49259. var value = data[i];
  49260. decrypted[j] = value ^ r >> 8;
  49261. r = (value + r) * c1 + c2 & (1 << 16) - 1;
  49262. }
  49263. return decrypted;
  49264. }
  49265. function decryptAscii(data, key, discardNumber) {
  49266. var r = key | 0, c1 = 52845, c2 = 22719;
  49267. var count = data.length, maybeLength = count >>> 1;
  49268. var decrypted = new Uint8Array(maybeLength);
  49269. var i, j;
  49270. for (i = 0, j = 0; i < count; i++) {
  49271. var digit1 = data[i];
  49272. if (!isHexDigit(digit1)) {
  49273. continue;
  49274. }
  49275. i++;
  49276. var digit2;
  49277. while (i < count && !isHexDigit(digit2 = data[i])) {
  49278. i++;
  49279. }
  49280. if (i < count) {
  49281. var value = parseInt(String.fromCharCode(digit1, digit2), 16);
  49282. decrypted[j++] = value ^ r >> 8;
  49283. r = (value + r) * c1 + c2 & (1 << 16) - 1;
  49284. }
  49285. }
  49286. return Array.prototype.slice.call(decrypted, discardNumber, j);
  49287. }
  49288. function isSpecial(c) {
  49289. return c === 0x2F || c === 0x5B || c === 0x5D || c === 0x7B || c === 0x7D || c === 0x28 || c === 0x29;
  49290. }
  49291. function Type1Parser(stream, encrypted, seacAnalysisEnabled) {
  49292. if (encrypted) {
  49293. var data = stream.getBytes();
  49294. var isBinary = !(isHexDigit(data[0]) && isHexDigit(data[1]) && isHexDigit(data[2]) && isHexDigit(data[3]));
  49295. stream = new Stream(isBinary ? decrypt(data, EEXEC_ENCRYPT_KEY, 4) : decryptAscii(data, EEXEC_ENCRYPT_KEY, 4));
  49296. }
  49297. this.seacAnalysisEnabled = !!seacAnalysisEnabled;
  49298. this.stream = stream;
  49299. this.nextChar();
  49300. }
  49301. Type1Parser.prototype = {
  49302. readNumberArray: function Type1Parser_readNumberArray() {
  49303. this.getToken();
  49304. var array = [];
  49305. while (true) {
  49306. var token = this.getToken();
  49307. if (token === null || token === ']' || token === '}') {
  49308. break;
  49309. }
  49310. array.push(parseFloat(token || 0));
  49311. }
  49312. return array;
  49313. },
  49314. readNumber: function Type1Parser_readNumber() {
  49315. var token = this.getToken();
  49316. return parseFloat(token || 0);
  49317. },
  49318. readInt: function Type1Parser_readInt() {
  49319. var token = this.getToken();
  49320. return parseInt(token || 0, 10) | 0;
  49321. },
  49322. readBoolean: function Type1Parser_readBoolean() {
  49323. var token = this.getToken();
  49324. return token === 'true' ? 1 : 0;
  49325. },
  49326. nextChar: function Type1_nextChar() {
  49327. return this.currentChar = this.stream.getByte();
  49328. },
  49329. getToken: function Type1Parser_getToken() {
  49330. var comment = false;
  49331. var ch = this.currentChar;
  49332. while (true) {
  49333. if (ch === -1) {
  49334. return null;
  49335. }
  49336. if (comment) {
  49337. if (ch === 0x0A || ch === 0x0D) {
  49338. comment = false;
  49339. }
  49340. } else if (ch === 0x25) {
  49341. comment = true;
  49342. } else if (!isSpace(ch)) {
  49343. break;
  49344. }
  49345. ch = this.nextChar();
  49346. }
  49347. if (isSpecial(ch)) {
  49348. this.nextChar();
  49349. return String.fromCharCode(ch);
  49350. }
  49351. var token = '';
  49352. do {
  49353. token += String.fromCharCode(ch);
  49354. ch = this.nextChar();
  49355. } while (ch >= 0 && !isSpace(ch) && !isSpecial(ch));
  49356. return token;
  49357. },
  49358. extractFontProgram: function Type1Parser_extractFontProgram() {
  49359. var stream = this.stream;
  49360. var subrs = [], charstrings = [];
  49361. var privateData = Object.create(null);
  49362. privateData['lenIV'] = 4;
  49363. var program = {
  49364. subrs: [],
  49365. charstrings: [],
  49366. properties: { 'privateData': privateData }
  49367. };
  49368. var token, length, data, lenIV, encoded;
  49369. while ((token = this.getToken()) !== null) {
  49370. if (token !== '/') {
  49371. continue;
  49372. }
  49373. token = this.getToken();
  49374. switch (token) {
  49375. case 'CharStrings':
  49376. this.getToken();
  49377. this.getToken();
  49378. this.getToken();
  49379. this.getToken();
  49380. while (true) {
  49381. token = this.getToken();
  49382. if (token === null || token === 'end') {
  49383. break;
  49384. }
  49385. if (token !== '/') {
  49386. continue;
  49387. }
  49388. var glyph = this.getToken();
  49389. length = this.readInt();
  49390. this.getToken();
  49391. data = stream.makeSubStream(stream.pos, length);
  49392. lenIV = program.properties.privateData['lenIV'];
  49393. encoded = decrypt(data.getBytes(), CHAR_STRS_ENCRYPT_KEY, lenIV);
  49394. stream.skip(length);
  49395. this.nextChar();
  49396. token = this.getToken();
  49397. if (token === 'noaccess') {
  49398. this.getToken();
  49399. }
  49400. charstrings.push({
  49401. glyph: glyph,
  49402. encoded: encoded
  49403. });
  49404. }
  49405. break;
  49406. case 'Subrs':
  49407. this.readInt();
  49408. this.getToken();
  49409. while ((token = this.getToken()) === 'dup') {
  49410. var index = this.readInt();
  49411. length = this.readInt();
  49412. this.getToken();
  49413. data = stream.makeSubStream(stream.pos, length);
  49414. lenIV = program.properties.privateData['lenIV'];
  49415. encoded = decrypt(data.getBytes(), CHAR_STRS_ENCRYPT_KEY, lenIV);
  49416. stream.skip(length);
  49417. this.nextChar();
  49418. token = this.getToken();
  49419. if (token === 'noaccess') {
  49420. this.getToken();
  49421. }
  49422. subrs[index] = encoded;
  49423. }
  49424. break;
  49425. case 'BlueValues':
  49426. case 'OtherBlues':
  49427. case 'FamilyBlues':
  49428. case 'FamilyOtherBlues':
  49429. var blueArray = this.readNumberArray();
  49430. if (blueArray.length > 0 && blueArray.length % 2 === 0 && HINTING_ENABLED) {
  49431. program.properties.privateData[token] = blueArray;
  49432. }
  49433. break;
  49434. case 'StemSnapH':
  49435. case 'StemSnapV':
  49436. program.properties.privateData[token] = this.readNumberArray();
  49437. break;
  49438. case 'StdHW':
  49439. case 'StdVW':
  49440. program.properties.privateData[token] = this.readNumberArray()[0];
  49441. break;
  49442. case 'BlueShift':
  49443. case 'lenIV':
  49444. case 'BlueFuzz':
  49445. case 'BlueScale':
  49446. case 'LanguageGroup':
  49447. case 'ExpansionFactor':
  49448. program.properties.privateData[token] = this.readNumber();
  49449. break;
  49450. case 'ForceBold':
  49451. program.properties.privateData[token] = this.readBoolean();
  49452. break;
  49453. }
  49454. }
  49455. for (var i = 0; i < charstrings.length; i++) {
  49456. glyph = charstrings[i].glyph;
  49457. encoded = charstrings[i].encoded;
  49458. var charString = new Type1CharString();
  49459. var error = charString.convert(encoded, subrs, this.seacAnalysisEnabled);
  49460. var output = charString.output;
  49461. if (error) {
  49462. output = [14];
  49463. }
  49464. program.charstrings.push({
  49465. glyphName: glyph,
  49466. charstring: output,
  49467. width: charString.width,
  49468. lsb: charString.lsb,
  49469. seac: charString.seac
  49470. });
  49471. }
  49472. return program;
  49473. },
  49474. extractFontHeader: function Type1Parser_extractFontHeader(properties) {
  49475. var token;
  49476. while ((token = this.getToken()) !== null) {
  49477. if (token !== '/') {
  49478. continue;
  49479. }
  49480. token = this.getToken();
  49481. switch (token) {
  49482. case 'FontMatrix':
  49483. var matrix = this.readNumberArray();
  49484. properties.fontMatrix = matrix;
  49485. break;
  49486. case 'Encoding':
  49487. var encodingArg = this.getToken();
  49488. var encoding;
  49489. if (!/^\d+$/.test(encodingArg)) {
  49490. encoding = getEncoding(encodingArg);
  49491. } else {
  49492. encoding = [];
  49493. var size = parseInt(encodingArg, 10) | 0;
  49494. this.getToken();
  49495. for (var j = 0; j < size; j++) {
  49496. token = this.getToken();
  49497. while (token !== 'dup' && token !== 'def') {
  49498. token = this.getToken();
  49499. if (token === null) {
  49500. return;
  49501. }
  49502. }
  49503. if (token === 'def') {
  49504. break;
  49505. }
  49506. var index = this.readInt();
  49507. this.getToken();
  49508. var glyph = this.getToken();
  49509. encoding[index] = glyph;
  49510. this.getToken();
  49511. }
  49512. }
  49513. properties.builtInEncoding = encoding;
  49514. break;
  49515. case 'FontBBox':
  49516. var fontBBox = this.readNumberArray();
  49517. properties.ascent = Math.max(fontBBox[3], fontBBox[1]);
  49518. properties.descent = Math.min(fontBBox[1], fontBBox[3]);
  49519. properties.ascentScaled = true;
  49520. break;
  49521. }
  49522. }
  49523. }
  49524. };
  49525. return Type1Parser;
  49526. }();
  49527. exports.Type1Parser = Type1Parser;
  49528. /***/ }),
  49529. /* 36 */
  49530. /***/ (function(module, exports, __w_pdfjs_require__) {
  49531. "use strict";
  49532. /* WEBPACK VAR INJECTION */(function(global) {
  49533. if (typeof PDFJS === 'undefined' || !PDFJS.compatibilityChecked) {
  49534. var globalScope = typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : this;
  49535. var userAgent = typeof navigator !== 'undefined' && navigator.userAgent || '';
  49536. var isAndroid = /Android/.test(userAgent);
  49537. var isAndroidPre3 = /Android\s[0-2][^\d]/.test(userAgent);
  49538. var isAndroidPre5 = /Android\s[0-4][^\d]/.test(userAgent);
  49539. var isChrome = userAgent.indexOf('Chrom') >= 0;
  49540. var isChromeWithRangeBug = /Chrome\/(39|40)\./.test(userAgent);
  49541. var isIOSChrome = userAgent.indexOf('CriOS') >= 0;
  49542. var isIE = userAgent.indexOf('Trident') >= 0;
  49543. var isIOS = /\b(iPad|iPhone|iPod)(?=;)/.test(userAgent);
  49544. var isOpera = userAgent.indexOf('Opera') >= 0;
  49545. var isSafari = /Safari\//.test(userAgent) && !/(Chrome\/|Android\s)/.test(userAgent);
  49546. var hasDOM = typeof window === 'object' && typeof document === 'object';
  49547. if (typeof PDFJS === 'undefined') {
  49548. globalScope.PDFJS = {};
  49549. }
  49550. PDFJS.compatibilityChecked = true;
  49551. (function checkTypedArrayCompatibility() {
  49552. if (typeof Uint8Array !== 'undefined') {
  49553. if (typeof Uint8Array.prototype.subarray === 'undefined') {
  49554. Uint8Array.prototype.subarray = function subarray(start, end) {
  49555. return new Uint8Array(this.slice(start, end));
  49556. };
  49557. Float32Array.prototype.subarray = function subarray(start, end) {
  49558. return new Float32Array(this.slice(start, end));
  49559. };
  49560. }
  49561. if (typeof Float64Array === 'undefined') {
  49562. globalScope.Float64Array = Float32Array;
  49563. }
  49564. return;
  49565. }
  49566. function subarray(start, end) {
  49567. return new TypedArray(this.slice(start, end));
  49568. }
  49569. function setArrayOffset(array, offset) {
  49570. if (arguments.length < 2) {
  49571. offset = 0;
  49572. }
  49573. for (var i = 0, n = array.length; i < n; ++i, ++offset) {
  49574. this[offset] = array[i] & 0xFF;
  49575. }
  49576. }
  49577. function TypedArray(arg1) {
  49578. var result, i, n;
  49579. if (typeof arg1 === 'number') {
  49580. result = [];
  49581. for (i = 0; i < arg1; ++i) {
  49582. result[i] = 0;
  49583. }
  49584. } else if ('slice' in arg1) {
  49585. result = arg1.slice(0);
  49586. } else {
  49587. result = [];
  49588. for (i = 0, n = arg1.length; i < n; ++i) {
  49589. result[i] = arg1[i];
  49590. }
  49591. }
  49592. result.subarray = subarray;
  49593. result.buffer = result;
  49594. result.byteLength = result.length;
  49595. result.set = setArrayOffset;
  49596. if (typeof arg1 === 'object' && arg1.buffer) {
  49597. result.buffer = arg1.buffer;
  49598. }
  49599. return result;
  49600. }
  49601. globalScope.Uint8Array = TypedArray;
  49602. globalScope.Int8Array = TypedArray;
  49603. globalScope.Uint32Array = TypedArray;
  49604. globalScope.Int32Array = TypedArray;
  49605. globalScope.Uint16Array = TypedArray;
  49606. globalScope.Float32Array = TypedArray;
  49607. globalScope.Float64Array = TypedArray;
  49608. }());
  49609. (function normalizeURLObject() {
  49610. if (!globalScope.URL) {
  49611. globalScope.URL = globalScope.webkitURL;
  49612. }
  49613. }());
  49614. (function checkObjectDefinePropertyCompatibility() {
  49615. if (typeof Object.defineProperty !== 'undefined') {
  49616. var definePropertyPossible = true;
  49617. try {
  49618. if (hasDOM) {
  49619. Object.defineProperty(new Image(), 'id', { value: 'test' });
  49620. }
  49621. var Test = function Test() {
  49622. };
  49623. Test.prototype = {
  49624. get id() {
  49625. }
  49626. };
  49627. Object.defineProperty(new Test(), 'id', {
  49628. value: '',
  49629. configurable: true,
  49630. enumerable: true,
  49631. writable: false
  49632. });
  49633. } catch (e) {
  49634. definePropertyPossible = false;
  49635. }
  49636. if (definePropertyPossible) {
  49637. return;
  49638. }
  49639. }
  49640. Object.defineProperty = function objectDefineProperty(obj, name, def) {
  49641. delete obj[name];
  49642. if ('get' in def) {
  49643. obj.__defineGetter__(name, def['get']);
  49644. }
  49645. if ('set' in def) {
  49646. obj.__defineSetter__(name, def['set']);
  49647. }
  49648. if ('value' in def) {
  49649. obj.__defineSetter__(name, function objectDefinePropertySetter(value) {
  49650. this.__defineGetter__(name, function objectDefinePropertyGetter() {
  49651. return value;
  49652. });
  49653. return value;
  49654. });
  49655. obj[name] = def.value;
  49656. }
  49657. };
  49658. }());
  49659. (function checkXMLHttpRequestResponseCompatibility() {
  49660. if (typeof XMLHttpRequest === 'undefined') {
  49661. return;
  49662. }
  49663. var xhrPrototype = XMLHttpRequest.prototype;
  49664. var xhr = new XMLHttpRequest();
  49665. if (!('overrideMimeType' in xhr)) {
  49666. Object.defineProperty(xhrPrototype, 'overrideMimeType', {
  49667. value: function xmlHttpRequestOverrideMimeType(mimeType) {
  49668. }
  49669. });
  49670. }
  49671. if ('responseType' in xhr) {
  49672. return;
  49673. }
  49674. Object.defineProperty(xhrPrototype, 'responseType', {
  49675. get: function xmlHttpRequestGetResponseType() {
  49676. return this._responseType || 'text';
  49677. },
  49678. set: function xmlHttpRequestSetResponseType(value) {
  49679. if (value === 'text' || value === 'arraybuffer') {
  49680. this._responseType = value;
  49681. if (value === 'arraybuffer' && typeof this.overrideMimeType === 'function') {
  49682. this.overrideMimeType('text/plain; charset=x-user-defined');
  49683. }
  49684. }
  49685. }
  49686. });
  49687. if (typeof VBArray !== 'undefined') {
  49688. Object.defineProperty(xhrPrototype, 'response', {
  49689. get: function xmlHttpRequestResponseGet() {
  49690. if (this.responseType === 'arraybuffer') {
  49691. return new Uint8Array(new VBArray(this.responseBody).toArray());
  49692. }
  49693. return this.responseText;
  49694. }
  49695. });
  49696. return;
  49697. }
  49698. Object.defineProperty(xhrPrototype, 'response', {
  49699. get: function xmlHttpRequestResponseGet() {
  49700. if (this.responseType !== 'arraybuffer') {
  49701. return this.responseText;
  49702. }
  49703. var text = this.responseText;
  49704. var i, n = text.length;
  49705. var result = new Uint8Array(n);
  49706. for (i = 0; i < n; ++i) {
  49707. result[i] = text.charCodeAt(i) & 0xFF;
  49708. }
  49709. return result.buffer;
  49710. }
  49711. });
  49712. }());
  49713. (function checkWindowBtoaCompatibility() {
  49714. if ('btoa' in globalScope) {
  49715. return;
  49716. }
  49717. var digits = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=';
  49718. globalScope.btoa = function (chars) {
  49719. var buffer = '';
  49720. var i, n;
  49721. for (i = 0, n = chars.length; i < n; i += 3) {
  49722. var b1 = chars.charCodeAt(i) & 0xFF;
  49723. var b2 = chars.charCodeAt(i + 1) & 0xFF;
  49724. var b3 = chars.charCodeAt(i + 2) & 0xFF;
  49725. var d1 = b1 >> 2, d2 = (b1 & 3) << 4 | b2 >> 4;
  49726. var d3 = i + 1 < n ? (b2 & 0xF) << 2 | b3 >> 6 : 64;
  49727. var d4 = i + 2 < n ? b3 & 0x3F : 64;
  49728. buffer += digits.charAt(d1) + digits.charAt(d2) + digits.charAt(d3) + digits.charAt(d4);
  49729. }
  49730. return buffer;
  49731. };
  49732. }());
  49733. (function checkWindowAtobCompatibility() {
  49734. if ('atob' in globalScope) {
  49735. return;
  49736. }
  49737. var digits = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=';
  49738. globalScope.atob = function (input) {
  49739. input = input.replace(/=+$/, '');
  49740. if (input.length % 4 === 1) {
  49741. throw new Error('bad atob input');
  49742. }
  49743. for (var bc = 0, bs, buffer, idx = 0, output = ''; buffer = input.charAt(idx++); ~buffer && (bs = bc % 4 ? bs * 64 + buffer : buffer, bc++ % 4) ? output += String.fromCharCode(255 & bs >> (-2 * bc & 6)) : 0) {
  49744. buffer = digits.indexOf(buffer);
  49745. }
  49746. return output;
  49747. };
  49748. }());
  49749. (function checkFunctionPrototypeBindCompatibility() {
  49750. if (typeof Function.prototype.bind !== 'undefined') {
  49751. return;
  49752. }
  49753. Function.prototype.bind = function functionPrototypeBind(obj) {
  49754. var fn = this, headArgs = Array.prototype.slice.call(arguments, 1);
  49755. var bound = function functionPrototypeBindBound() {
  49756. var args = headArgs.concat(Array.prototype.slice.call(arguments));
  49757. return fn.apply(obj, args);
  49758. };
  49759. return bound;
  49760. };
  49761. }());
  49762. (function checkDatasetProperty() {
  49763. if (!hasDOM) {
  49764. return;
  49765. }
  49766. var div = document.createElement('div');
  49767. if ('dataset' in div) {
  49768. return;
  49769. }
  49770. Object.defineProperty(HTMLElement.prototype, 'dataset', {
  49771. get: function () {
  49772. if (this._dataset) {
  49773. return this._dataset;
  49774. }
  49775. var dataset = {};
  49776. for (var j = 0, jj = this.attributes.length; j < jj; j++) {
  49777. var attribute = this.attributes[j];
  49778. if (attribute.name.substring(0, 5) !== 'data-') {
  49779. continue;
  49780. }
  49781. var key = attribute.name.substring(5).replace(/\-([a-z])/g, function (all, ch) {
  49782. return ch.toUpperCase();
  49783. });
  49784. dataset[key] = attribute.value;
  49785. }
  49786. Object.defineProperty(this, '_dataset', {
  49787. value: dataset,
  49788. writable: false,
  49789. enumerable: false
  49790. });
  49791. return dataset;
  49792. },
  49793. enumerable: true
  49794. });
  49795. }());
  49796. (function checkClassListProperty() {
  49797. function changeList(element, itemName, add, remove) {
  49798. var s = element.className || '';
  49799. var list = s.split(/\s+/g);
  49800. if (list[0] === '') {
  49801. list.shift();
  49802. }
  49803. var index = list.indexOf(itemName);
  49804. if (index < 0 && add) {
  49805. list.push(itemName);
  49806. }
  49807. if (index >= 0 && remove) {
  49808. list.splice(index, 1);
  49809. }
  49810. element.className = list.join(' ');
  49811. return index >= 0;
  49812. }
  49813. if (!hasDOM) {
  49814. return;
  49815. }
  49816. var div = document.createElement('div');
  49817. if ('classList' in div) {
  49818. return;
  49819. }
  49820. var classListPrototype = {
  49821. add: function (name) {
  49822. changeList(this.element, name, true, false);
  49823. },
  49824. contains: function (name) {
  49825. return changeList(this.element, name, false, false);
  49826. },
  49827. remove: function (name) {
  49828. changeList(this.element, name, false, true);
  49829. },
  49830. toggle: function (name) {
  49831. changeList(this.element, name, true, true);
  49832. }
  49833. };
  49834. Object.defineProperty(HTMLElement.prototype, 'classList', {
  49835. get: function () {
  49836. if (this._classList) {
  49837. return this._classList;
  49838. }
  49839. var classList = Object.create(classListPrototype, {
  49840. element: {
  49841. value: this,
  49842. writable: false,
  49843. enumerable: true
  49844. }
  49845. });
  49846. Object.defineProperty(this, '_classList', {
  49847. value: classList,
  49848. writable: false,
  49849. enumerable: false
  49850. });
  49851. return classList;
  49852. },
  49853. enumerable: true
  49854. });
  49855. }());
  49856. (function checkWorkerConsoleCompatibility() {
  49857. if (typeof importScripts === 'undefined' || 'console' in globalScope) {
  49858. return;
  49859. }
  49860. var consoleTimer = {};
  49861. var workerConsole = {
  49862. log: function log() {
  49863. var args = Array.prototype.slice.call(arguments);
  49864. globalScope.postMessage({
  49865. targetName: 'main',
  49866. action: 'console_log',
  49867. data: args
  49868. });
  49869. },
  49870. error: function error() {
  49871. var args = Array.prototype.slice.call(arguments);
  49872. globalScope.postMessage({
  49873. targetName: 'main',
  49874. action: 'console_error',
  49875. data: args
  49876. });
  49877. },
  49878. time: function time(name) {
  49879. consoleTimer[name] = Date.now();
  49880. },
  49881. timeEnd: function timeEnd(name) {
  49882. var time = consoleTimer[name];
  49883. if (!time) {
  49884. throw new Error('Unknown timer name ' + name);
  49885. }
  49886. this.log('Timer:', name, Date.now() - time);
  49887. }
  49888. };
  49889. globalScope.console = workerConsole;
  49890. }());
  49891. (function checkConsoleCompatibility() {
  49892. if (!hasDOM) {
  49893. return;
  49894. }
  49895. if (!('console' in window)) {
  49896. window.console = {
  49897. log: function () {
  49898. },
  49899. error: function () {
  49900. },
  49901. warn: function () {
  49902. }
  49903. };
  49904. return;
  49905. }
  49906. if (!('bind' in console.log)) {
  49907. console.log = function (fn) {
  49908. return function (msg) {
  49909. return fn(msg);
  49910. };
  49911. }(console.log);
  49912. console.error = function (fn) {
  49913. return function (msg) {
  49914. return fn(msg);
  49915. };
  49916. }(console.error);
  49917. console.warn = function (fn) {
  49918. return function (msg) {
  49919. return fn(msg);
  49920. };
  49921. }(console.warn);
  49922. return;
  49923. }
  49924. }());
  49925. (function checkOnClickCompatibility() {
  49926. function ignoreIfTargetDisabled(event) {
  49927. if (isDisabled(event.target)) {
  49928. event.stopPropagation();
  49929. }
  49930. }
  49931. function isDisabled(node) {
  49932. return node.disabled || node.parentNode && isDisabled(node.parentNode);
  49933. }
  49934. if (isOpera) {
  49935. document.addEventListener('click', ignoreIfTargetDisabled, true);
  49936. }
  49937. }());
  49938. (function checkOnBlobSupport() {
  49939. if (isIE || isIOSChrome) {
  49940. PDFJS.disableCreateObjectURL = true;
  49941. }
  49942. }());
  49943. (function checkNavigatorLanguage() {
  49944. if (typeof navigator === 'undefined') {
  49945. return;
  49946. }
  49947. if ('language' in navigator) {
  49948. return;
  49949. }
  49950. PDFJS.locale = navigator.userLanguage || 'en-US';
  49951. }());
  49952. (function checkRangeRequests() {
  49953. if (isSafari || isAndroidPre3 || isChromeWithRangeBug || isIOS) {
  49954. PDFJS.disableRange = true;
  49955. PDFJS.disableStream = true;
  49956. }
  49957. }());
  49958. (function checkHistoryManipulation() {
  49959. if (!hasDOM) {
  49960. return;
  49961. }
  49962. if (!history.pushState || isAndroidPre3) {
  49963. PDFJS.disableHistory = true;
  49964. }
  49965. }());
  49966. (function checkSetPresenceInImageData() {
  49967. if (!hasDOM) {
  49968. return;
  49969. }
  49970. if (window.CanvasPixelArray) {
  49971. if (typeof window.CanvasPixelArray.prototype.set !== 'function') {
  49972. window.CanvasPixelArray.prototype.set = function (arr) {
  49973. for (var i = 0, ii = this.length; i < ii; i++) {
  49974. this[i] = arr[i];
  49975. }
  49976. };
  49977. }
  49978. } else {
  49979. var polyfill = false, versionMatch;
  49980. if (isChrome) {
  49981. versionMatch = userAgent.match(/Chrom(e|ium)\/([0-9]+)\./);
  49982. polyfill = versionMatch && parseInt(versionMatch[2]) < 21;
  49983. } else if (isAndroid) {
  49984. polyfill = isAndroidPre5;
  49985. } else if (isSafari) {
  49986. versionMatch = userAgent.match(/Version\/([0-9]+)\.([0-9]+)\.([0-9]+) Safari\//);
  49987. polyfill = versionMatch && parseInt(versionMatch[1]) < 6;
  49988. }
  49989. if (polyfill) {
  49990. var contextPrototype = window.CanvasRenderingContext2D.prototype;
  49991. var createImageData = contextPrototype.createImageData;
  49992. contextPrototype.createImageData = function (w, h) {
  49993. var imageData = createImageData.call(this, w, h);
  49994. imageData.data.set = function (arr) {
  49995. for (var i = 0, ii = this.length; i < ii; i++) {
  49996. this[i] = arr[i];
  49997. }
  49998. };
  49999. return imageData;
  50000. };
  50001. contextPrototype = null;
  50002. }
  50003. }
  50004. }());
  50005. (function checkRequestAnimationFrame() {
  50006. function fakeRequestAnimationFrame(callback) {
  50007. window.setTimeout(callback, 20);
  50008. }
  50009. if (!hasDOM) {
  50010. return;
  50011. }
  50012. if (isIOS) {
  50013. window.requestAnimationFrame = fakeRequestAnimationFrame;
  50014. return;
  50015. }
  50016. if ('requestAnimationFrame' in window) {
  50017. return;
  50018. }
  50019. window.requestAnimationFrame = window.mozRequestAnimationFrame || window.webkitRequestAnimationFrame || fakeRequestAnimationFrame;
  50020. }());
  50021. (function checkCanvasSizeLimitation() {
  50022. if (isIOS || isAndroid) {
  50023. PDFJS.maxCanvasPixels = 5242880;
  50024. }
  50025. }());
  50026. (function checkFullscreenSupport() {
  50027. if (!hasDOM) {
  50028. return;
  50029. }
  50030. if (isIE && window.parent !== window) {
  50031. PDFJS.disableFullscreen = true;
  50032. }
  50033. }());
  50034. (function checkCurrentScript() {
  50035. if (!hasDOM) {
  50036. return;
  50037. }
  50038. if ('currentScript' in document) {
  50039. return;
  50040. }
  50041. Object.defineProperty(document, 'currentScript', {
  50042. get: function () {
  50043. var scripts = document.getElementsByTagName('script');
  50044. return scripts[scripts.length - 1];
  50045. },
  50046. enumerable: true,
  50047. configurable: true
  50048. });
  50049. }());
  50050. (function checkInputTypeNumberAssign() {
  50051. if (!hasDOM) {
  50052. return;
  50053. }
  50054. var el = document.createElement('input');
  50055. try {
  50056. el.type = 'number';
  50057. } catch (ex) {
  50058. var inputProto = el.constructor.prototype;
  50059. var typeProperty = Object.getOwnPropertyDescriptor(inputProto, 'type');
  50060. Object.defineProperty(inputProto, 'type', {
  50061. get: function () {
  50062. return typeProperty.get.call(this);
  50063. },
  50064. set: function (value) {
  50065. typeProperty.set.call(this, value === 'number' ? 'text' : value);
  50066. },
  50067. enumerable: true,
  50068. configurable: true
  50069. });
  50070. }
  50071. }());
  50072. (function checkDocumentReadyState() {
  50073. if (!hasDOM) {
  50074. return;
  50075. }
  50076. if (!document.attachEvent) {
  50077. return;
  50078. }
  50079. var documentProto = document.constructor.prototype;
  50080. var readyStateProto = Object.getOwnPropertyDescriptor(documentProto, 'readyState');
  50081. Object.defineProperty(documentProto, 'readyState', {
  50082. get: function () {
  50083. var value = readyStateProto.get.call(this);
  50084. return value === 'interactive' ? 'loading' : value;
  50085. },
  50086. set: function (value) {
  50087. readyStateProto.set.call(this, value);
  50088. },
  50089. enumerable: true,
  50090. configurable: true
  50091. });
  50092. }());
  50093. (function checkChildNodeRemove() {
  50094. if (!hasDOM) {
  50095. return;
  50096. }
  50097. if (typeof Element.prototype.remove !== 'undefined') {
  50098. return;
  50099. }
  50100. Element.prototype.remove = function () {
  50101. if (this.parentNode) {
  50102. this.parentNode.removeChild(this);
  50103. }
  50104. };
  50105. }());
  50106. (function checkPromise() {
  50107. if (globalScope.Promise) {
  50108. if (typeof globalScope.Promise.all !== 'function') {
  50109. globalScope.Promise.all = function (iterable) {
  50110. var count = 0, results = [], resolve, reject;
  50111. var promise = new globalScope.Promise(function (resolve_, reject_) {
  50112. resolve = resolve_;
  50113. reject = reject_;
  50114. });
  50115. iterable.forEach(function (p, i) {
  50116. count++;
  50117. p.then(function (result) {
  50118. results[i] = result;
  50119. count--;
  50120. if (count === 0) {
  50121. resolve(results);
  50122. }
  50123. }, reject);
  50124. });
  50125. if (count === 0) {
  50126. resolve(results);
  50127. }
  50128. return promise;
  50129. };
  50130. }
  50131. if (typeof globalScope.Promise.resolve !== 'function') {
  50132. globalScope.Promise.resolve = function (value) {
  50133. return new globalScope.Promise(function (resolve) {
  50134. resolve(value);
  50135. });
  50136. };
  50137. }
  50138. if (typeof globalScope.Promise.reject !== 'function') {
  50139. globalScope.Promise.reject = function (reason) {
  50140. return new globalScope.Promise(function (resolve, reject) {
  50141. reject(reason);
  50142. });
  50143. };
  50144. }
  50145. if (typeof globalScope.Promise.prototype.catch !== 'function') {
  50146. globalScope.Promise.prototype.catch = function (onReject) {
  50147. return globalScope.Promise.prototype.then(undefined, onReject);
  50148. };
  50149. }
  50150. return;
  50151. }
  50152. var STATUS_PENDING = 0;
  50153. var STATUS_RESOLVED = 1;
  50154. var STATUS_REJECTED = 2;
  50155. var REJECTION_TIMEOUT = 500;
  50156. var HandlerManager = {
  50157. handlers: [],
  50158. running: false,
  50159. unhandledRejections: [],
  50160. pendingRejectionCheck: false,
  50161. scheduleHandlers: function scheduleHandlers(promise) {
  50162. if (promise._status === STATUS_PENDING) {
  50163. return;
  50164. }
  50165. this.handlers = this.handlers.concat(promise._handlers);
  50166. promise._handlers = [];
  50167. if (this.running) {
  50168. return;
  50169. }
  50170. this.running = true;
  50171. setTimeout(this.runHandlers.bind(this), 0);
  50172. },
  50173. runHandlers: function runHandlers() {
  50174. var RUN_TIMEOUT = 1;
  50175. var timeoutAt = Date.now() + RUN_TIMEOUT;
  50176. while (this.handlers.length > 0) {
  50177. var handler = this.handlers.shift();
  50178. var nextStatus = handler.thisPromise._status;
  50179. var nextValue = handler.thisPromise._value;
  50180. try {
  50181. if (nextStatus === STATUS_RESOLVED) {
  50182. if (typeof handler.onResolve === 'function') {
  50183. nextValue = handler.onResolve(nextValue);
  50184. }
  50185. } else if (typeof handler.onReject === 'function') {
  50186. nextValue = handler.onReject(nextValue);
  50187. nextStatus = STATUS_RESOLVED;
  50188. if (handler.thisPromise._unhandledRejection) {
  50189. this.removeUnhandeledRejection(handler.thisPromise);
  50190. }
  50191. }
  50192. } catch (ex) {
  50193. nextStatus = STATUS_REJECTED;
  50194. nextValue = ex;
  50195. }
  50196. handler.nextPromise._updateStatus(nextStatus, nextValue);
  50197. if (Date.now() >= timeoutAt) {
  50198. break;
  50199. }
  50200. }
  50201. if (this.handlers.length > 0) {
  50202. setTimeout(this.runHandlers.bind(this), 0);
  50203. return;
  50204. }
  50205. this.running = false;
  50206. },
  50207. addUnhandledRejection: function addUnhandledRejection(promise) {
  50208. this.unhandledRejections.push({
  50209. promise: promise,
  50210. time: Date.now()
  50211. });
  50212. this.scheduleRejectionCheck();
  50213. },
  50214. removeUnhandeledRejection: function removeUnhandeledRejection(promise) {
  50215. promise._unhandledRejection = false;
  50216. for (var i = 0; i < this.unhandledRejections.length; i++) {
  50217. if (this.unhandledRejections[i].promise === promise) {
  50218. this.unhandledRejections.splice(i);
  50219. i--;
  50220. }
  50221. }
  50222. },
  50223. scheduleRejectionCheck: function scheduleRejectionCheck() {
  50224. if (this.pendingRejectionCheck) {
  50225. return;
  50226. }
  50227. this.pendingRejectionCheck = true;
  50228. setTimeout(function rejectionCheck() {
  50229. this.pendingRejectionCheck = false;
  50230. var now = Date.now();
  50231. for (var i = 0; i < this.unhandledRejections.length; i++) {
  50232. if (now - this.unhandledRejections[i].time > REJECTION_TIMEOUT) {
  50233. var unhandled = this.unhandledRejections[i].promise._value;
  50234. var msg = 'Unhandled rejection: ' + unhandled;
  50235. if (unhandled.stack) {
  50236. msg += '\n' + unhandled.stack;
  50237. }
  50238. try {
  50239. throw new Error(msg);
  50240. } catch (_) {
  50241. console.warn(msg);
  50242. }
  50243. this.unhandledRejections.splice(i);
  50244. i--;
  50245. }
  50246. }
  50247. if (this.unhandledRejections.length) {
  50248. this.scheduleRejectionCheck();
  50249. }
  50250. }.bind(this), REJECTION_TIMEOUT);
  50251. }
  50252. };
  50253. var Promise = function Promise(resolver) {
  50254. this._status = STATUS_PENDING;
  50255. this._handlers = [];
  50256. try {
  50257. resolver.call(this, this._resolve.bind(this), this._reject.bind(this));
  50258. } catch (e) {
  50259. this._reject(e);
  50260. }
  50261. };
  50262. Promise.all = function Promise_all(promises) {
  50263. var resolveAll, rejectAll;
  50264. var deferred = new Promise(function (resolve, reject) {
  50265. resolveAll = resolve;
  50266. rejectAll = reject;
  50267. });
  50268. var unresolved = promises.length;
  50269. var results = [];
  50270. if (unresolved === 0) {
  50271. resolveAll(results);
  50272. return deferred;
  50273. }
  50274. function reject(reason) {
  50275. if (deferred._status === STATUS_REJECTED) {
  50276. return;
  50277. }
  50278. results = [];
  50279. rejectAll(reason);
  50280. }
  50281. for (var i = 0, ii = promises.length; i < ii; ++i) {
  50282. var promise = promises[i];
  50283. var resolve = function (i) {
  50284. return function (value) {
  50285. if (deferred._status === STATUS_REJECTED) {
  50286. return;
  50287. }
  50288. results[i] = value;
  50289. unresolved--;
  50290. if (unresolved === 0) {
  50291. resolveAll(results);
  50292. }
  50293. };
  50294. }(i);
  50295. if (Promise.isPromise(promise)) {
  50296. promise.then(resolve, reject);
  50297. } else {
  50298. resolve(promise);
  50299. }
  50300. }
  50301. return deferred;
  50302. };
  50303. Promise.isPromise = function Promise_isPromise(value) {
  50304. return value && typeof value.then === 'function';
  50305. };
  50306. Promise.resolve = function Promise_resolve(value) {
  50307. return new Promise(function (resolve) {
  50308. resolve(value);
  50309. });
  50310. };
  50311. Promise.reject = function Promise_reject(reason) {
  50312. return new Promise(function (resolve, reject) {
  50313. reject(reason);
  50314. });
  50315. };
  50316. Promise.prototype = {
  50317. _status: null,
  50318. _value: null,
  50319. _handlers: null,
  50320. _unhandledRejection: null,
  50321. _updateStatus: function Promise__updateStatus(status, value) {
  50322. if (this._status === STATUS_RESOLVED || this._status === STATUS_REJECTED) {
  50323. return;
  50324. }
  50325. if (status === STATUS_RESOLVED && Promise.isPromise(value)) {
  50326. value.then(this._updateStatus.bind(this, STATUS_RESOLVED), this._updateStatus.bind(this, STATUS_REJECTED));
  50327. return;
  50328. }
  50329. this._status = status;
  50330. this._value = value;
  50331. if (status === STATUS_REJECTED && this._handlers.length === 0) {
  50332. this._unhandledRejection = true;
  50333. HandlerManager.addUnhandledRejection(this);
  50334. }
  50335. HandlerManager.scheduleHandlers(this);
  50336. },
  50337. _resolve: function Promise_resolve(value) {
  50338. this._updateStatus(STATUS_RESOLVED, value);
  50339. },
  50340. _reject: function Promise_reject(reason) {
  50341. this._updateStatus(STATUS_REJECTED, reason);
  50342. },
  50343. then: function Promise_then(onResolve, onReject) {
  50344. var nextPromise = new Promise(function (resolve, reject) {
  50345. this.resolve = resolve;
  50346. this.reject = reject;
  50347. });
  50348. this._handlers.push({
  50349. thisPromise: this,
  50350. onResolve: onResolve,
  50351. onReject: onReject,
  50352. nextPromise: nextPromise
  50353. });
  50354. HandlerManager.scheduleHandlers(this);
  50355. return nextPromise;
  50356. },
  50357. catch: function Promise_catch(onReject) {
  50358. return this.then(undefined, onReject);
  50359. }
  50360. };
  50361. globalScope.Promise = Promise;
  50362. }());
  50363. (function checkWeakMap() {
  50364. if (globalScope.WeakMap) {
  50365. return;
  50366. }
  50367. var id = 0;
  50368. function WeakMap() {
  50369. this.id = '$weakmap' + id++;
  50370. }
  50371. WeakMap.prototype = {
  50372. has: function (obj) {
  50373. return !!Object.getOwnPropertyDescriptor(obj, this.id);
  50374. },
  50375. get: function (obj, defaultValue) {
  50376. return this.has(obj) ? obj[this.id] : defaultValue;
  50377. },
  50378. set: function (obj, value) {
  50379. Object.defineProperty(obj, this.id, {
  50380. value: value,
  50381. enumerable: false,
  50382. configurable: true
  50383. });
  50384. },
  50385. delete: function (obj) {
  50386. delete obj[this.id];
  50387. }
  50388. };
  50389. globalScope.WeakMap = WeakMap;
  50390. }());
  50391. (function checkURLConstructor() {
  50392. var hasWorkingUrl = false;
  50393. try {
  50394. if (typeof URL === 'function' && typeof URL.prototype === 'object' && 'origin' in URL.prototype) {
  50395. var u = new URL('b', 'http://a');
  50396. u.pathname = 'c%20d';
  50397. hasWorkingUrl = u.href === 'http://a/c%20d';
  50398. }
  50399. } catch (e) {
  50400. }
  50401. if (hasWorkingUrl) {
  50402. return;
  50403. }
  50404. var relative = Object.create(null);
  50405. relative['ftp'] = 21;
  50406. relative['file'] = 0;
  50407. relative['gopher'] = 70;
  50408. relative['http'] = 80;
  50409. relative['https'] = 443;
  50410. relative['ws'] = 80;
  50411. relative['wss'] = 443;
  50412. var relativePathDotMapping = Object.create(null);
  50413. relativePathDotMapping['%2e'] = '.';
  50414. relativePathDotMapping['.%2e'] = '..';
  50415. relativePathDotMapping['%2e.'] = '..';
  50416. relativePathDotMapping['%2e%2e'] = '..';
  50417. function isRelativeScheme(scheme) {
  50418. return relative[scheme] !== undefined;
  50419. }
  50420. function invalid() {
  50421. clear.call(this);
  50422. this._isInvalid = true;
  50423. }
  50424. function IDNAToASCII(h) {
  50425. if (h === '') {
  50426. invalid.call(this);
  50427. }
  50428. return h.toLowerCase();
  50429. }
  50430. function percentEscape(c) {
  50431. var unicode = c.charCodeAt(0);
  50432. if (unicode > 0x20 && unicode < 0x7F && [
  50433. 0x22,
  50434. 0x23,
  50435. 0x3C,
  50436. 0x3E,
  50437. 0x3F,
  50438. 0x60
  50439. ].indexOf(unicode) === -1) {
  50440. return c;
  50441. }
  50442. return encodeURIComponent(c);
  50443. }
  50444. function percentEscapeQuery(c) {
  50445. var unicode = c.charCodeAt(0);
  50446. if (unicode > 0x20 && unicode < 0x7F && [
  50447. 0x22,
  50448. 0x23,
  50449. 0x3C,
  50450. 0x3E,
  50451. 0x60
  50452. ].indexOf(unicode) === -1) {
  50453. return c;
  50454. }
  50455. return encodeURIComponent(c);
  50456. }
  50457. var EOF, ALPHA = /[a-zA-Z]/, ALPHANUMERIC = /[a-zA-Z0-9\+\-\.]/;
  50458. function parse(input, stateOverride, base) {
  50459. function err(message) {
  50460. errors.push(message);
  50461. }
  50462. var state = stateOverride || 'scheme start', cursor = 0, buffer = '', seenAt = false, seenBracket = false, errors = [];
  50463. loop:
  50464. while ((input[cursor - 1] !== EOF || cursor === 0) && !this._isInvalid) {
  50465. var c = input[cursor];
  50466. switch (state) {
  50467. case 'scheme start':
  50468. if (c && ALPHA.test(c)) {
  50469. buffer += c.toLowerCase();
  50470. state = 'scheme';
  50471. } else if (!stateOverride) {
  50472. buffer = '';
  50473. state = 'no scheme';
  50474. continue;
  50475. } else {
  50476. err('Invalid scheme.');
  50477. break loop;
  50478. }
  50479. break;
  50480. case 'scheme':
  50481. if (c && ALPHANUMERIC.test(c)) {
  50482. buffer += c.toLowerCase();
  50483. } else if (c === ':') {
  50484. this._scheme = buffer;
  50485. buffer = '';
  50486. if (stateOverride) {
  50487. break loop;
  50488. }
  50489. if (isRelativeScheme(this._scheme)) {
  50490. this._isRelative = true;
  50491. }
  50492. if (this._scheme === 'file') {
  50493. state = 'relative';
  50494. } else if (this._isRelative && base && base._scheme === this._scheme) {
  50495. state = 'relative or authority';
  50496. } else if (this._isRelative) {
  50497. state = 'authority first slash';
  50498. } else {
  50499. state = 'scheme data';
  50500. }
  50501. } else if (!stateOverride) {
  50502. buffer = '';
  50503. cursor = 0;
  50504. state = 'no scheme';
  50505. continue;
  50506. } else if (EOF === c) {
  50507. break loop;
  50508. } else {
  50509. err('Code point not allowed in scheme: ' + c);
  50510. break loop;
  50511. }
  50512. break;
  50513. case 'scheme data':
  50514. if (c === '?') {
  50515. this._query = '?';
  50516. state = 'query';
  50517. } else if (c === '#') {
  50518. this._fragment = '#';
  50519. state = 'fragment';
  50520. } else {
  50521. if (EOF !== c && '\t' !== c && '\n' !== c && '\r' !== c) {
  50522. this._schemeData += percentEscape(c);
  50523. }
  50524. }
  50525. break;
  50526. case 'no scheme':
  50527. if (!base || !isRelativeScheme(base._scheme)) {
  50528. err('Missing scheme.');
  50529. invalid.call(this);
  50530. } else {
  50531. state = 'relative';
  50532. continue;
  50533. }
  50534. break;
  50535. case 'relative or authority':
  50536. if (c === '/' && input[cursor + 1] === '/') {
  50537. state = 'authority ignore slashes';
  50538. } else {
  50539. err('Expected /, got: ' + c);
  50540. state = 'relative';
  50541. continue;
  50542. }
  50543. break;
  50544. case 'relative':
  50545. this._isRelative = true;
  50546. if ('file' !== this._scheme) {
  50547. this._scheme = base._scheme;
  50548. }
  50549. if (EOF === c) {
  50550. this._host = base._host;
  50551. this._port = base._port;
  50552. this._path = base._path.slice();
  50553. this._query = base._query;
  50554. this._username = base._username;
  50555. this._password = base._password;
  50556. break loop;
  50557. } else if (c === '/' || c === '\\') {
  50558. if (c === '\\') {
  50559. err('\\ is an invalid code point.');
  50560. }
  50561. state = 'relative slash';
  50562. } else if (c === '?') {
  50563. this._host = base._host;
  50564. this._port = base._port;
  50565. this._path = base._path.slice();
  50566. this._query = '?';
  50567. this._username = base._username;
  50568. this._password = base._password;
  50569. state = 'query';
  50570. } else if (c === '#') {
  50571. this._host = base._host;
  50572. this._port = base._port;
  50573. this._path = base._path.slice();
  50574. this._query = base._query;
  50575. this._fragment = '#';
  50576. this._username = base._username;
  50577. this._password = base._password;
  50578. state = 'fragment';
  50579. } else {
  50580. var nextC = input[cursor + 1];
  50581. var nextNextC = input[cursor + 2];
  50582. if ('file' !== this._scheme || !ALPHA.test(c) || nextC !== ':' && nextC !== '|' || EOF !== nextNextC && '/' !== nextNextC && '\\' !== nextNextC && '?' !== nextNextC && '#' !== nextNextC) {
  50583. this._host = base._host;
  50584. this._port = base._port;
  50585. this._username = base._username;
  50586. this._password = base._password;
  50587. this._path = base._path.slice();
  50588. this._path.pop();
  50589. }
  50590. state = 'relative path';
  50591. continue;
  50592. }
  50593. break;
  50594. case 'relative slash':
  50595. if (c === '/' || c === '\\') {
  50596. if (c === '\\') {
  50597. err('\\ is an invalid code point.');
  50598. }
  50599. if (this._scheme === 'file') {
  50600. state = 'file host';
  50601. } else {
  50602. state = 'authority ignore slashes';
  50603. }
  50604. } else {
  50605. if ('file' !== this._scheme) {
  50606. this._host = base._host;
  50607. this._port = base._port;
  50608. this._username = base._username;
  50609. this._password = base._password;
  50610. }
  50611. state = 'relative path';
  50612. continue;
  50613. }
  50614. break;
  50615. case 'authority first slash':
  50616. if (c === '/') {
  50617. state = 'authority second slash';
  50618. } else {
  50619. err('Expected \'/\', got: ' + c);
  50620. state = 'authority ignore slashes';
  50621. continue;
  50622. }
  50623. break;
  50624. case 'authority second slash':
  50625. state = 'authority ignore slashes';
  50626. if ('/' !== c) {
  50627. err('Expected \'/\', got: ' + c);
  50628. continue;
  50629. }
  50630. break;
  50631. case 'authority ignore slashes':
  50632. if ('/' !== c && '\\' !== c) {
  50633. state = 'authority';
  50634. continue;
  50635. } else {
  50636. err('Expected authority, got: ' + c);
  50637. }
  50638. break;
  50639. case 'authority':
  50640. if (c === '@') {
  50641. if (seenAt) {
  50642. err('@ already seen.');
  50643. buffer += '%40';
  50644. }
  50645. seenAt = true;
  50646. for (var i = 0; i < buffer.length; i++) {
  50647. var cp = buffer[i];
  50648. if (cp === '\t' || cp === '\n' || cp === '\r') {
  50649. err('Invalid whitespace in authority.');
  50650. continue;
  50651. }
  50652. if (cp === ':' && this._password === null) {
  50653. this._password = '';
  50654. continue;
  50655. }
  50656. var tempC = percentEscape(cp);
  50657. if (null !== this._password) {
  50658. this._password += tempC;
  50659. } else {
  50660. this._username += tempC;
  50661. }
  50662. }
  50663. buffer = '';
  50664. } else if (c === EOF || c === '/' || c === '\\' || c === '?' || c === '#') {
  50665. cursor -= buffer.length;
  50666. buffer = '';
  50667. state = 'host';
  50668. continue;
  50669. } else {
  50670. buffer += c;
  50671. }
  50672. break;
  50673. case 'file host':
  50674. if (c === EOF || c === '/' || c === '\\' || c === '?' || c === '#') {
  50675. if (buffer.length === 2 && ALPHA.test(buffer[0]) && (buffer[1] === ':' || buffer[1] === '|')) {
  50676. state = 'relative path';
  50677. } else if (buffer.length === 0) {
  50678. state = 'relative path start';
  50679. } else {
  50680. this._host = IDNAToASCII.call(this, buffer);
  50681. buffer = '';
  50682. state = 'relative path start';
  50683. }
  50684. continue;
  50685. } else if (c === '\t' || c === '\n' || c === '\r') {
  50686. err('Invalid whitespace in file host.');
  50687. } else {
  50688. buffer += c;
  50689. }
  50690. break;
  50691. case 'host':
  50692. case 'hostname':
  50693. if (c === ':' && !seenBracket) {
  50694. this._host = IDNAToASCII.call(this, buffer);
  50695. buffer = '';
  50696. state = 'port';
  50697. if (stateOverride === 'hostname') {
  50698. break loop;
  50699. }
  50700. } else if (c === EOF || c === '/' || c === '\\' || c === '?' || c === '#') {
  50701. this._host = IDNAToASCII.call(this, buffer);
  50702. buffer = '';
  50703. state = 'relative path start';
  50704. if (stateOverride) {
  50705. break loop;
  50706. }
  50707. continue;
  50708. } else if ('\t' !== c && '\n' !== c && '\r' !== c) {
  50709. if (c === '[') {
  50710. seenBracket = true;
  50711. } else if (c === ']') {
  50712. seenBracket = false;
  50713. }
  50714. buffer += c;
  50715. } else {
  50716. err('Invalid code point in host/hostname: ' + c);
  50717. }
  50718. break;
  50719. case 'port':
  50720. if (/[0-9]/.test(c)) {
  50721. buffer += c;
  50722. } else if (c === EOF || c === '/' || c === '\\' || c === '?' || c === '#' || stateOverride) {
  50723. if ('' !== buffer) {
  50724. var temp = parseInt(buffer, 10);
  50725. if (temp !== relative[this._scheme]) {
  50726. this._port = temp + '';
  50727. }
  50728. buffer = '';
  50729. }
  50730. if (stateOverride) {
  50731. break loop;
  50732. }
  50733. state = 'relative path start';
  50734. continue;
  50735. } else if (c === '\t' || c === '\n' || c === '\r') {
  50736. err('Invalid code point in port: ' + c);
  50737. } else {
  50738. invalid.call(this);
  50739. }
  50740. break;
  50741. case 'relative path start':
  50742. if (c === '\\') {
  50743. err('\'\\\' not allowed in path.');
  50744. }
  50745. state = 'relative path';
  50746. if ('/' !== c && '\\' !== c) {
  50747. continue;
  50748. }
  50749. break;
  50750. case 'relative path':
  50751. if (c === EOF || c === '/' || c === '\\' || !stateOverride && (c === '?' || c === '#')) {
  50752. if (c === '\\') {
  50753. err('\\ not allowed in relative path.');
  50754. }
  50755. var tmp;
  50756. if (tmp = relativePathDotMapping[buffer.toLowerCase()]) {
  50757. buffer = tmp;
  50758. }
  50759. if (buffer === '..') {
  50760. this._path.pop();
  50761. if ('/' !== c && '\\' !== c) {
  50762. this._path.push('');
  50763. }
  50764. } else if (buffer === '.' && '/' !== c && '\\' !== c) {
  50765. this._path.push('');
  50766. } else if ('.' !== buffer) {
  50767. if (this._scheme === 'file' && this._path.length === 0 && buffer.length === 2 && ALPHA.test(buffer[0]) && buffer[1] === '|') {
  50768. buffer = buffer[0] + ':';
  50769. }
  50770. this._path.push(buffer);
  50771. }
  50772. buffer = '';
  50773. if (c === '?') {
  50774. this._query = '?';
  50775. state = 'query';
  50776. } else if (c === '#') {
  50777. this._fragment = '#';
  50778. state = 'fragment';
  50779. }
  50780. } else if ('\t' !== c && '\n' !== c && '\r' !== c) {
  50781. buffer += percentEscape(c);
  50782. }
  50783. break;
  50784. case 'query':
  50785. if (!stateOverride && c === '#') {
  50786. this._fragment = '#';
  50787. state = 'fragment';
  50788. } else if (EOF !== c && '\t' !== c && '\n' !== c && '\r' !== c) {
  50789. this._query += percentEscapeQuery(c);
  50790. }
  50791. break;
  50792. case 'fragment':
  50793. if (EOF !== c && '\t' !== c && '\n' !== c && '\r' !== c) {
  50794. this._fragment += c;
  50795. }
  50796. break;
  50797. }
  50798. cursor++;
  50799. }
  50800. }
  50801. function clear() {
  50802. this._scheme = '';
  50803. this._schemeData = '';
  50804. this._username = '';
  50805. this._password = null;
  50806. this._host = '';
  50807. this._port = '';
  50808. this._path = [];
  50809. this._query = '';
  50810. this._fragment = '';
  50811. this._isInvalid = false;
  50812. this._isRelative = false;
  50813. }
  50814. function JURL(url, base) {
  50815. if (base !== undefined && !(base instanceof JURL)) {
  50816. base = new JURL(String(base));
  50817. }
  50818. this._url = url;
  50819. clear.call(this);
  50820. var input = url.replace(/^[ \t\r\n\f]+|[ \t\r\n\f]+$/g, '');
  50821. parse.call(this, input, null, base);
  50822. }
  50823. JURL.prototype = {
  50824. toString: function () {
  50825. return this.href;
  50826. },
  50827. get href() {
  50828. if (this._isInvalid) {
  50829. return this._url;
  50830. }
  50831. var authority = '';
  50832. if ('' !== this._username || null !== this._password) {
  50833. authority = this._username + (null !== this._password ? ':' + this._password : '') + '@';
  50834. }
  50835. return this.protocol + (this._isRelative ? '//' + authority + this.host : '') + this.pathname + this._query + this._fragment;
  50836. },
  50837. set href(href) {
  50838. clear.call(this);
  50839. parse.call(this, href);
  50840. },
  50841. get protocol() {
  50842. return this._scheme + ':';
  50843. },
  50844. set protocol(protocol) {
  50845. if (this._isInvalid) {
  50846. return;
  50847. }
  50848. parse.call(this, protocol + ':', 'scheme start');
  50849. },
  50850. get host() {
  50851. return this._isInvalid ? '' : this._port ? this._host + ':' + this._port : this._host;
  50852. },
  50853. set host(host) {
  50854. if (this._isInvalid || !this._isRelative) {
  50855. return;
  50856. }
  50857. parse.call(this, host, 'host');
  50858. },
  50859. get hostname() {
  50860. return this._host;
  50861. },
  50862. set hostname(hostname) {
  50863. if (this._isInvalid || !this._isRelative) {
  50864. return;
  50865. }
  50866. parse.call(this, hostname, 'hostname');
  50867. },
  50868. get port() {
  50869. return this._port;
  50870. },
  50871. set port(port) {
  50872. if (this._isInvalid || !this._isRelative) {
  50873. return;
  50874. }
  50875. parse.call(this, port, 'port');
  50876. },
  50877. get pathname() {
  50878. return this._isInvalid ? '' : this._isRelative ? '/' + this._path.join('/') : this._schemeData;
  50879. },
  50880. set pathname(pathname) {
  50881. if (this._isInvalid || !this._isRelative) {
  50882. return;
  50883. }
  50884. this._path = [];
  50885. parse.call(this, pathname, 'relative path start');
  50886. },
  50887. get search() {
  50888. return this._isInvalid || !this._query || this._query === '?' ? '' : this._query;
  50889. },
  50890. set search(search) {
  50891. if (this._isInvalid || !this._isRelative) {
  50892. return;
  50893. }
  50894. this._query = '?';
  50895. if (search[0] === '?') {
  50896. search = search.slice(1);
  50897. }
  50898. parse.call(this, search, 'query');
  50899. },
  50900. get hash() {
  50901. return this._isInvalid || !this._fragment || this._fragment === '#' ? '' : this._fragment;
  50902. },
  50903. set hash(hash) {
  50904. if (this._isInvalid) {
  50905. return;
  50906. }
  50907. this._fragment = '#';
  50908. if (hash[0] === '#') {
  50909. hash = hash.slice(1);
  50910. }
  50911. parse.call(this, hash, 'fragment');
  50912. },
  50913. get origin() {
  50914. var host;
  50915. if (this._isInvalid || !this._scheme) {
  50916. return '';
  50917. }
  50918. switch (this._scheme) {
  50919. case 'data':
  50920. case 'file':
  50921. case 'javascript':
  50922. case 'mailto':
  50923. return 'null';
  50924. }
  50925. host = this.host;
  50926. if (!host) {
  50927. return '';
  50928. }
  50929. return this._scheme + '://' + host;
  50930. }
  50931. };
  50932. var OriginalURL = globalScope.URL;
  50933. if (OriginalURL) {
  50934. JURL.createObjectURL = function (blob) {
  50935. return OriginalURL.createObjectURL.apply(OriginalURL, arguments);
  50936. };
  50937. JURL.revokeObjectURL = function (url) {
  50938. OriginalURL.revokeObjectURL(url);
  50939. };
  50940. }
  50941. globalScope.URL = JURL;
  50942. }());
  50943. }
  50944. /* WEBPACK VAR INJECTION */}.call(exports, __w_pdfjs_require__(9)))
  50945. /***/ }),
  50946. /* 37 */
  50947. /***/ (function(module, exports, __w_pdfjs_require__) {
  50948. "use strict";
  50949. var pdfjsVersion = '1.7.348';
  50950. var pdfjsBuild = '754c4bd0';
  50951. var pdfjsCoreWorker = __w_pdfjs_require__(8);
  50952. {
  50953. __w_pdfjs_require__(19);
  50954. }
  50955. exports.WorkerMessageHandler = pdfjsCoreWorker.WorkerMessageHandler;
  50956. /***/ })
  50957. /******/ ]);
  50958. });