pdf.worker.js 1.1 MB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387238823892390239123922393239423952396239723982399240024012402240324042405240624072408240924102411241224132414241524162417241824192420242124222423242424252426242724282429243024312432243324342435243624372438243924402441244224432444244524462447244824492450245124522453245424552456245724582459246024612462246324642465246624672468246924702471247224732474247524762477247824792480248124822483248424852486248724882489249024912492249324942495249624972498249925002501250225032504250525062507250825092510251125122513251425152516251725182519252025212522252325242525252625272528252925302531253225332534253525362537253825392540254125422543254425452546254725482549255025512552255325542555255625572558255925602561256225632564256525662567256825692570257125722573257425752576257725782579258025812582258325842585258625872588258925902591259225932594259525962597259825992600260126022603260426052606260726082609261026112612261326142615261626172618261926202621262226232624262526262627262826292630263126322633263426352636263726382639264026412642264326442645264626472648264926502651265226532654265526562657265826592660266126622663266426652666266726682669267026712672267326742675267626772678267926802681268226832684268526862687268826892690269126922693269426952696269726982699270027012702270327042705270627072708270927102711271227132714271527162717271827192720272127222723272427252726272727282729273027312732273327342735273627372738273927402741274227432744274527462747274827492750275127522753275427552756275727582759276027612762276327642765276627672768276927702771277227732774277527762777277827792780278127822783278427852786278727882789279027912792279327942795279627972798279928002801280228032804280528062807280828092810281128122813281428152816281728182819282028212822282328242825282628272828282928302831283228332834283528362837283828392840284128422843284428452846284728482849285028512852285328542855285628572858285928602861286228632864286528662867286828692870287128722873287428752876287728782879288028812882288328842885288628872888288928902891289228932894289528962897289828992900290129022903290429052906290729082909291029112912291329142915291629172918291929202921292229232924292529262927292829292930293129322933293429352936293729382939294029412942294329442945294629472948294929502951295229532954295529562957295829592960296129622963296429652966296729682969297029712972297329742975297629772978297929802981298229832984298529862987298829892990299129922993299429952996299729982999300030013002300330043005300630073008300930103011301230133014301530163017301830193020302130223023302430253026302730283029303030313032303330343035303630373038303930403041304230433044304530463047304830493050305130523053305430553056305730583059306030613062306330643065306630673068306930703071307230733074307530763077307830793080308130823083308430853086308730883089309030913092309330943095309630973098309931003101310231033104310531063107310831093110311131123113311431153116311731183119312031213122312331243125312631273128312931303131313231333134313531363137313831393140314131423143314431453146314731483149315031513152315331543155315631573158315931603161316231633164316531663167316831693170317131723173317431753176317731783179318031813182318331843185318631873188318931903191319231933194319531963197319831993200320132023203320432053206320732083209321032113212321332143215321632173218321932203221322232233224322532263227322832293230323132323233323432353236323732383239324032413242324332443245324632473248324932503251325232533254325532563257325832593260326132623263326432653266326732683269327032713272327332743275327632773278327932803281328232833284328532863287328832893290329132923293329432953296329732983299330033013302330333043305330633073308330933103311331233133314331533163317331833193320332133223323332433253326332733283329333033313332333333343335333633373338333933403341334233433344334533463347334833493350335133523353335433553356335733583359336033613362336333643365336633673368336933703371337233733374337533763377337833793380338133823383338433853386338733883389339033913392339333943395339633973398339934003401340234033404340534063407340834093410341134123413341434153416341734183419342034213422342334243425342634273428342934303431343234333434343534363437343834393440344134423443344434453446344734483449345034513452345334543455345634573458345934603461346234633464346534663467346834693470347134723473347434753476347734783479348034813482348334843485348634873488348934903491349234933494349534963497349834993500350135023503350435053506350735083509351035113512351335143515351635173518351935203521352235233524352535263527352835293530353135323533353435353536353735383539354035413542354335443545354635473548354935503551355235533554355535563557355835593560356135623563356435653566356735683569357035713572357335743575357635773578357935803581358235833584358535863587358835893590359135923593359435953596359735983599360036013602360336043605360636073608360936103611361236133614361536163617361836193620362136223623362436253626362736283629363036313632363336343635363636373638363936403641364236433644364536463647364836493650365136523653365436553656365736583659366036613662366336643665366636673668366936703671367236733674367536763677367836793680368136823683368436853686368736883689369036913692369336943695369636973698369937003701370237033704370537063707370837093710371137123713371437153716371737183719372037213722372337243725372637273728372937303731373237333734373537363737373837393740374137423743374437453746374737483749375037513752375337543755375637573758375937603761376237633764376537663767376837693770377137723773377437753776377737783779378037813782378337843785378637873788378937903791379237933794379537963797379837993800380138023803380438053806380738083809381038113812381338143815381638173818381938203821382238233824382538263827382838293830383138323833383438353836383738383839384038413842384338443845384638473848384938503851385238533854385538563857385838593860386138623863386438653866386738683869387038713872387338743875387638773878387938803881388238833884388538863887388838893890389138923893389438953896389738983899390039013902390339043905390639073908390939103911391239133914391539163917391839193920392139223923392439253926392739283929393039313932393339343935393639373938393939403941394239433944394539463947394839493950395139523953395439553956395739583959396039613962396339643965396639673968396939703971397239733974397539763977397839793980398139823983398439853986398739883989399039913992399339943995399639973998399940004001400240034004400540064007400840094010401140124013401440154016401740184019402040214022402340244025402640274028402940304031403240334034403540364037403840394040404140424043404440454046404740484049405040514052405340544055405640574058405940604061406240634064406540664067406840694070407140724073407440754076407740784079408040814082408340844085408640874088408940904091409240934094409540964097409840994100410141024103410441054106410741084109411041114112411341144115411641174118411941204121412241234124412541264127412841294130413141324133413441354136413741384139414041414142414341444145414641474148414941504151415241534154415541564157415841594160416141624163416441654166416741684169417041714172417341744175417641774178417941804181418241834184418541864187418841894190419141924193419441954196419741984199420042014202420342044205420642074208420942104211421242134214421542164217421842194220422142224223422442254226422742284229423042314232423342344235423642374238423942404241424242434244424542464247424842494250425142524253425442554256425742584259426042614262426342644265426642674268426942704271427242734274427542764277427842794280428142824283428442854286428742884289429042914292429342944295429642974298429943004301430243034304430543064307430843094310431143124313431443154316431743184319432043214322432343244325432643274328432943304331433243334334433543364337433843394340434143424343434443454346434743484349435043514352435343544355435643574358435943604361436243634364436543664367436843694370437143724373437443754376437743784379438043814382438343844385438643874388438943904391439243934394439543964397439843994400440144024403440444054406440744084409441044114412441344144415441644174418441944204421442244234424442544264427442844294430443144324433443444354436443744384439444044414442444344444445444644474448444944504451445244534454445544564457445844594460446144624463446444654466446744684469447044714472447344744475447644774478447944804481448244834484448544864487448844894490449144924493449444954496449744984499450045014502450345044505450645074508450945104511451245134514451545164517451845194520452145224523452445254526452745284529453045314532453345344535453645374538453945404541454245434544454545464547454845494550455145524553455445554556455745584559456045614562456345644565456645674568456945704571457245734574457545764577457845794580458145824583458445854586458745884589459045914592459345944595459645974598459946004601460246034604460546064607460846094610461146124613461446154616461746184619462046214622462346244625462646274628462946304631463246334634463546364637463846394640464146424643464446454646464746484649465046514652465346544655465646574658465946604661466246634664466546664667466846694670467146724673467446754676467746784679468046814682468346844685468646874688468946904691469246934694469546964697469846994700470147024703470447054706470747084709471047114712471347144715471647174718471947204721472247234724472547264727472847294730473147324733473447354736473747384739474047414742474347444745474647474748474947504751475247534754475547564757475847594760476147624763476447654766476747684769477047714772477347744775477647774778477947804781478247834784478547864787478847894790479147924793479447954796479747984799480048014802480348044805480648074808480948104811481248134814481548164817481848194820482148224823482448254826482748284829483048314832483348344835483648374838483948404841484248434844484548464847484848494850485148524853485448554856485748584859486048614862486348644865486648674868486948704871487248734874487548764877487848794880488148824883488448854886488748884889489048914892489348944895489648974898489949004901490249034904490549064907490849094910491149124913491449154916491749184919492049214922492349244925492649274928492949304931493249334934493549364937493849394940494149424943494449454946494749484949495049514952495349544955495649574958495949604961496249634964496549664967496849694970497149724973497449754976497749784979498049814982498349844985498649874988498949904991499249934994499549964997499849995000500150025003500450055006500750085009501050115012501350145015501650175018501950205021502250235024502550265027502850295030503150325033503450355036503750385039504050415042504350445045504650475048504950505051505250535054505550565057505850595060506150625063506450655066506750685069507050715072507350745075507650775078507950805081508250835084508550865087508850895090509150925093509450955096509750985099510051015102510351045105510651075108510951105111511251135114511551165117511851195120512151225123512451255126512751285129513051315132513351345135513651375138513951405141514251435144514551465147514851495150515151525153515451555156515751585159516051615162516351645165516651675168516951705171517251735174517551765177517851795180518151825183518451855186518751885189519051915192519351945195519651975198519952005201520252035204520552065207520852095210521152125213521452155216521752185219522052215222522352245225522652275228522952305231523252335234523552365237523852395240524152425243524452455246524752485249525052515252525352545255525652575258525952605261526252635264526552665267526852695270527152725273527452755276527752785279528052815282528352845285528652875288528952905291529252935294529552965297529852995300530153025303530453055306530753085309531053115312531353145315531653175318531953205321532253235324532553265327532853295330533153325333533453355336533753385339534053415342534353445345534653475348534953505351535253535354535553565357535853595360536153625363536453655366536753685369537053715372537353745375537653775378537953805381538253835384538553865387538853895390539153925393539453955396539753985399540054015402540354045405540654075408540954105411541254135414541554165417541854195420542154225423542454255426542754285429543054315432543354345435543654375438543954405441544254435444544554465447544854495450545154525453545454555456545754585459546054615462546354645465546654675468546954705471547254735474547554765477547854795480548154825483548454855486548754885489549054915492549354945495549654975498549955005501550255035504550555065507550855095510551155125513551455155516551755185519552055215522552355245525552655275528552955305531553255335534553555365537553855395540554155425543554455455546554755485549555055515552555355545555555655575558555955605561556255635564556555665567556855695570557155725573557455755576557755785579558055815582558355845585558655875588558955905591559255935594559555965597559855995600560156025603560456055606560756085609561056115612561356145615561656175618561956205621562256235624562556265627562856295630563156325633563456355636563756385639564056415642564356445645564656475648564956505651565256535654565556565657565856595660566156625663566456655666566756685669567056715672567356745675567656775678567956805681568256835684568556865687568856895690569156925693569456955696569756985699570057015702570357045705570657075708570957105711571257135714571557165717571857195720572157225723572457255726572757285729573057315732573357345735573657375738573957405741574257435744574557465747574857495750575157525753575457555756575757585759576057615762576357645765576657675768576957705771577257735774577557765777577857795780578157825783578457855786578757885789579057915792579357945795579657975798579958005801580258035804580558065807580858095810581158125813581458155816581758185819582058215822582358245825582658275828582958305831583258335834583558365837583858395840584158425843584458455846584758485849585058515852585358545855585658575858585958605861586258635864586558665867586858695870587158725873587458755876587758785879588058815882588358845885588658875888588958905891589258935894589558965897589858995900590159025903590459055906590759085909591059115912591359145915591659175918591959205921592259235924592559265927592859295930593159325933593459355936593759385939594059415942594359445945594659475948594959505951595259535954595559565957595859595960596159625963596459655966596759685969597059715972597359745975597659775978597959805981598259835984598559865987598859895990599159925993599459955996599759985999600060016002600360046005600660076008600960106011601260136014601560166017601860196020602160226023602460256026602760286029603060316032603360346035603660376038603960406041604260436044604560466047604860496050605160526053605460556056605760586059606060616062606360646065606660676068606960706071607260736074607560766077607860796080608160826083608460856086608760886089609060916092609360946095609660976098609961006101610261036104610561066107610861096110611161126113611461156116611761186119612061216122612361246125612661276128612961306131613261336134613561366137613861396140614161426143614461456146614761486149615061516152615361546155615661576158615961606161616261636164616561666167616861696170617161726173617461756176617761786179618061816182618361846185618661876188618961906191619261936194619561966197619861996200620162026203620462056206620762086209621062116212621362146215621662176218621962206221622262236224622562266227622862296230623162326233623462356236623762386239624062416242624362446245624662476248624962506251625262536254625562566257625862596260626162626263626462656266626762686269627062716272627362746275627662776278627962806281628262836284628562866287628862896290629162926293629462956296629762986299630063016302630363046305630663076308630963106311631263136314631563166317631863196320632163226323632463256326632763286329633063316332633363346335633663376338633963406341634263436344634563466347634863496350635163526353635463556356635763586359636063616362636363646365636663676368636963706371637263736374637563766377637863796380638163826383638463856386638763886389639063916392639363946395639663976398639964006401640264036404640564066407640864096410641164126413641464156416641764186419642064216422642364246425642664276428642964306431643264336434643564366437643864396440644164426443644464456446644764486449645064516452645364546455645664576458645964606461646264636464646564666467646864696470647164726473647464756476647764786479648064816482648364846485648664876488648964906491649264936494649564966497649864996500650165026503650465056506650765086509651065116512651365146515651665176518651965206521652265236524652565266527652865296530653165326533653465356536653765386539654065416542654365446545654665476548654965506551655265536554655565566557655865596560656165626563656465656566656765686569657065716572657365746575657665776578657965806581658265836584658565866587658865896590659165926593659465956596659765986599660066016602660366046605660666076608660966106611661266136614661566166617661866196620662166226623662466256626662766286629663066316632663366346635663666376638663966406641664266436644664566466647664866496650665166526653665466556656665766586659666066616662666366646665666666676668666966706671667266736674667566766677667866796680668166826683668466856686668766886689669066916692669366946695669666976698669967006701670267036704670567066707670867096710671167126713671467156716671767186719672067216722672367246725672667276728672967306731673267336734673567366737673867396740674167426743674467456746674767486749675067516752675367546755675667576758675967606761676267636764676567666767676867696770677167726773677467756776677767786779678067816782678367846785678667876788678967906791679267936794679567966797679867996800680168026803680468056806680768086809681068116812681368146815681668176818681968206821682268236824682568266827682868296830683168326833683468356836683768386839684068416842684368446845684668476848684968506851685268536854685568566857685868596860686168626863686468656866686768686869687068716872687368746875687668776878687968806881688268836884688568866887688868896890689168926893689468956896689768986899690069016902690369046905690669076908690969106911691269136914691569166917691869196920692169226923692469256926692769286929693069316932693369346935693669376938693969406941694269436944694569466947694869496950695169526953695469556956695769586959696069616962696369646965696669676968696969706971697269736974697569766977697869796980698169826983698469856986698769886989699069916992699369946995699669976998699970007001700270037004700570067007700870097010701170127013701470157016701770187019702070217022702370247025702670277028702970307031703270337034703570367037703870397040704170427043704470457046704770487049705070517052705370547055705670577058705970607061706270637064706570667067706870697070707170727073707470757076707770787079708070817082708370847085708670877088708970907091709270937094709570967097709870997100710171027103710471057106710771087109711071117112711371147115711671177118711971207121712271237124712571267127712871297130713171327133713471357136713771387139714071417142714371447145714671477148714971507151715271537154715571567157715871597160716171627163716471657166716771687169717071717172717371747175717671777178717971807181718271837184718571867187718871897190719171927193719471957196719771987199720072017202720372047205720672077208720972107211721272137214721572167217721872197220722172227223722472257226722772287229723072317232723372347235723672377238723972407241724272437244724572467247724872497250725172527253725472557256725772587259726072617262726372647265726672677268726972707271727272737274727572767277727872797280728172827283728472857286728772887289729072917292729372947295729672977298729973007301730273037304730573067307730873097310731173127313731473157316731773187319732073217322732373247325732673277328732973307331733273337334733573367337733873397340734173427343734473457346734773487349735073517352735373547355735673577358735973607361736273637364736573667367736873697370737173727373737473757376737773787379738073817382738373847385738673877388738973907391739273937394739573967397739873997400740174027403740474057406740774087409741074117412741374147415741674177418741974207421742274237424742574267427742874297430743174327433743474357436743774387439744074417442744374447445744674477448744974507451745274537454745574567457745874597460746174627463746474657466746774687469747074717472747374747475747674777478747974807481748274837484748574867487748874897490749174927493749474957496749774987499750075017502750375047505750675077508750975107511751275137514751575167517751875197520752175227523752475257526752775287529753075317532753375347535753675377538753975407541754275437544754575467547754875497550755175527553755475557556755775587559756075617562756375647565756675677568756975707571757275737574757575767577757875797580758175827583758475857586758775887589759075917592759375947595759675977598759976007601760276037604760576067607760876097610761176127613761476157616761776187619762076217622762376247625762676277628762976307631763276337634763576367637763876397640764176427643764476457646764776487649765076517652765376547655765676577658765976607661766276637664766576667667766876697670767176727673767476757676767776787679768076817682768376847685768676877688768976907691769276937694769576967697769876997700770177027703770477057706770777087709771077117712771377147715771677177718771977207721772277237724772577267727772877297730773177327733773477357736773777387739774077417742774377447745774677477748774977507751775277537754775577567757775877597760776177627763776477657766776777687769777077717772777377747775777677777778777977807781778277837784778577867787778877897790779177927793779477957796779777987799780078017802780378047805780678077808780978107811781278137814781578167817781878197820782178227823782478257826782778287829783078317832783378347835783678377838783978407841784278437844784578467847784878497850785178527853785478557856785778587859786078617862786378647865786678677868786978707871787278737874787578767877787878797880788178827883788478857886788778887889789078917892789378947895789678977898789979007901790279037904790579067907790879097910791179127913791479157916791779187919792079217922792379247925792679277928792979307931793279337934793579367937793879397940794179427943794479457946794779487949795079517952795379547955795679577958795979607961796279637964796579667967796879697970797179727973797479757976797779787979798079817982798379847985798679877988798979907991799279937994799579967997799879998000800180028003800480058006800780088009801080118012801380148015801680178018801980208021802280238024802580268027802880298030803180328033803480358036803780388039804080418042804380448045804680478048804980508051805280538054805580568057805880598060806180628063806480658066806780688069807080718072807380748075807680778078807980808081808280838084808580868087808880898090809180928093809480958096809780988099810081018102810381048105810681078108810981108111811281138114811581168117811881198120812181228123812481258126812781288129813081318132813381348135813681378138813981408141814281438144814581468147814881498150815181528153815481558156815781588159816081618162816381648165816681678168816981708171817281738174817581768177817881798180818181828183818481858186818781888189819081918192819381948195819681978198819982008201820282038204820582068207820882098210821182128213821482158216821782188219822082218222822382248225822682278228822982308231823282338234823582368237823882398240824182428243824482458246824782488249825082518252825382548255825682578258825982608261826282638264826582668267826882698270827182728273827482758276827782788279828082818282828382848285828682878288828982908291829282938294829582968297829882998300830183028303830483058306830783088309831083118312831383148315831683178318831983208321832283238324832583268327832883298330833183328333833483358336833783388339834083418342834383448345834683478348834983508351835283538354835583568357835883598360836183628363836483658366836783688369837083718372837383748375837683778378837983808381838283838384838583868387838883898390839183928393839483958396839783988399840084018402840384048405840684078408840984108411841284138414841584168417841884198420842184228423842484258426842784288429843084318432843384348435843684378438843984408441844284438444844584468447844884498450845184528453845484558456845784588459846084618462846384648465846684678468846984708471847284738474847584768477847884798480848184828483848484858486848784888489849084918492849384948495849684978498849985008501850285038504850585068507850885098510851185128513851485158516851785188519852085218522852385248525852685278528852985308531853285338534853585368537853885398540854185428543854485458546854785488549855085518552855385548555855685578558855985608561856285638564856585668567856885698570857185728573857485758576857785788579858085818582858385848585858685878588858985908591859285938594859585968597859885998600860186028603860486058606860786088609861086118612861386148615861686178618861986208621862286238624862586268627862886298630863186328633863486358636863786388639864086418642864386448645864686478648864986508651865286538654865586568657865886598660866186628663866486658666866786688669867086718672867386748675867686778678867986808681868286838684868586868687868886898690869186928693869486958696869786988699870087018702870387048705870687078708870987108711871287138714871587168717871887198720872187228723872487258726872787288729873087318732873387348735873687378738873987408741874287438744874587468747874887498750875187528753875487558756875787588759876087618762876387648765876687678768876987708771877287738774877587768777877887798780878187828783878487858786878787888789879087918792879387948795879687978798879988008801880288038804880588068807880888098810881188128813881488158816881788188819882088218822882388248825882688278828882988308831883288338834883588368837883888398840884188428843884488458846884788488849885088518852885388548855885688578858885988608861886288638864886588668867886888698870887188728873887488758876887788788879888088818882888388848885888688878888888988908891889288938894889588968897889888998900890189028903890489058906890789088909891089118912891389148915891689178918891989208921892289238924892589268927892889298930893189328933893489358936893789388939894089418942894389448945894689478948894989508951895289538954895589568957895889598960896189628963896489658966896789688969897089718972897389748975897689778978897989808981898289838984898589868987898889898990899189928993899489958996899789988999900090019002900390049005900690079008900990109011901290139014901590169017901890199020902190229023902490259026902790289029903090319032903390349035903690379038903990409041904290439044904590469047904890499050905190529053905490559056905790589059906090619062906390649065906690679068906990709071907290739074907590769077907890799080908190829083908490859086908790889089909090919092909390949095909690979098909991009101910291039104910591069107910891099110911191129113911491159116911791189119912091219122912391249125912691279128912991309131913291339134913591369137913891399140914191429143914491459146914791489149915091519152915391549155915691579158915991609161916291639164916591669167916891699170917191729173917491759176917791789179918091819182918391849185918691879188918991909191919291939194919591969197919891999200920192029203920492059206920792089209921092119212921392149215921692179218921992209221922292239224922592269227922892299230923192329233923492359236923792389239924092419242924392449245924692479248924992509251925292539254925592569257925892599260926192629263926492659266926792689269927092719272927392749275927692779278927992809281928292839284928592869287928892899290929192929293929492959296929792989299930093019302930393049305930693079308930993109311931293139314931593169317931893199320932193229323932493259326932793289329933093319332933393349335933693379338933993409341934293439344934593469347934893499350935193529353935493559356935793589359936093619362936393649365936693679368936993709371937293739374937593769377937893799380938193829383938493859386938793889389939093919392939393949395939693979398939994009401940294039404940594069407940894099410941194129413941494159416941794189419942094219422942394249425942694279428942994309431943294339434943594369437943894399440944194429443944494459446944794489449945094519452945394549455945694579458945994609461946294639464946594669467946894699470947194729473947494759476947794789479948094819482948394849485948694879488948994909491949294939494949594969497949894999500950195029503950495059506950795089509951095119512951395149515951695179518951995209521952295239524952595269527952895299530953195329533953495359536953795389539954095419542954395449545954695479548954995509551955295539554955595569557955895599560956195629563956495659566956795689569957095719572957395749575957695779578957995809581958295839584958595869587958895899590959195929593959495959596959795989599960096019602960396049605960696079608960996109611961296139614961596169617961896199620962196229623962496259626962796289629963096319632963396349635963696379638963996409641964296439644964596469647964896499650965196529653965496559656965796589659966096619662966396649665966696679668966996709671967296739674967596769677967896799680968196829683968496859686968796889689969096919692969396949695969696979698969997009701970297039704970597069707970897099710971197129713971497159716971797189719972097219722972397249725972697279728972997309731973297339734973597369737973897399740974197429743974497459746974797489749975097519752975397549755975697579758975997609761976297639764976597669767976897699770977197729773977497759776977797789779978097819782978397849785978697879788978997909791979297939794979597969797979897999800980198029803980498059806980798089809981098119812981398149815981698179818981998209821982298239824982598269827982898299830983198329833983498359836983798389839984098419842984398449845984698479848984998509851985298539854985598569857985898599860986198629863986498659866986798689869987098719872987398749875987698779878987998809881988298839884988598869887988898899890989198929893989498959896989798989899990099019902990399049905990699079908990999109911991299139914991599169917991899199920992199229923992499259926992799289929993099319932993399349935993699379938993999409941994299439944994599469947994899499950995199529953995499559956995799589959996099619962996399649965996699679968996999709971997299739974997599769977997899799980998199829983998499859986998799889989999099919992999399949995999699979998999910000100011000210003100041000510006100071000810009100101001110012100131001410015100161001710018100191002010021100221002310024100251002610027100281002910030100311003210033100341003510036100371003810039100401004110042100431004410045100461004710048100491005010051100521005310054100551005610057100581005910060100611006210063100641006510066100671006810069100701007110072100731007410075100761007710078100791008010081100821008310084100851008610087100881008910090100911009210093100941009510096100971009810099101001010110102101031010410105101061010710108101091011010111101121011310114101151011610117101181011910120101211012210123101241012510126101271012810129101301013110132101331013410135101361013710138101391014010141101421014310144101451014610147101481014910150101511015210153101541015510156101571015810159101601016110162101631016410165101661016710168101691017010171101721017310174101751017610177101781017910180101811018210183101841018510186101871018810189101901019110192101931019410195101961019710198101991020010201102021020310204102051020610207102081020910210102111021210213102141021510216102171021810219102201022110222102231022410225102261022710228102291023010231102321023310234102351023610237102381023910240102411024210243102441024510246102471024810249102501025110252102531025410255102561025710258102591026010261102621026310264102651026610267102681026910270102711027210273102741027510276102771027810279102801028110282102831028410285102861028710288102891029010291102921029310294102951029610297102981029910300103011030210303103041030510306103071030810309103101031110312103131031410315103161031710318103191032010321103221032310324103251032610327103281032910330103311033210333103341033510336103371033810339103401034110342103431034410345103461034710348103491035010351103521035310354103551035610357103581035910360103611036210363103641036510366103671036810369103701037110372103731037410375103761037710378103791038010381103821038310384103851038610387103881038910390103911039210393103941039510396103971039810399104001040110402104031040410405104061040710408104091041010411104121041310414104151041610417104181041910420104211042210423104241042510426104271042810429104301043110432104331043410435104361043710438104391044010441104421044310444104451044610447104481044910450104511045210453104541045510456104571045810459104601046110462104631046410465104661046710468104691047010471104721047310474104751047610477104781047910480104811048210483104841048510486104871048810489104901049110492104931049410495104961049710498104991050010501105021050310504105051050610507105081050910510105111051210513105141051510516105171051810519105201052110522105231052410525105261052710528105291053010531105321053310534105351053610537105381053910540105411054210543105441054510546105471054810549105501055110552105531055410555105561055710558105591056010561105621056310564105651056610567105681056910570105711057210573105741057510576105771057810579105801058110582105831058410585105861058710588105891059010591105921059310594105951059610597105981059910600106011060210603106041060510606106071060810609106101061110612106131061410615106161061710618106191062010621106221062310624106251062610627106281062910630106311063210633106341063510636106371063810639106401064110642106431064410645106461064710648106491065010651106521065310654106551065610657106581065910660106611066210663106641066510666106671066810669106701067110672106731067410675106761067710678106791068010681106821068310684106851068610687106881068910690106911069210693106941069510696106971069810699107001070110702107031070410705107061070710708107091071010711107121071310714107151071610717107181071910720107211072210723107241072510726107271072810729107301073110732107331073410735107361073710738107391074010741107421074310744107451074610747107481074910750107511075210753107541075510756107571075810759107601076110762107631076410765107661076710768107691077010771107721077310774107751077610777107781077910780107811078210783107841078510786107871078810789107901079110792107931079410795107961079710798107991080010801108021080310804108051080610807108081080910810108111081210813108141081510816108171081810819108201082110822108231082410825108261082710828108291083010831108321083310834108351083610837108381083910840108411084210843108441084510846108471084810849108501085110852108531085410855108561085710858108591086010861108621086310864108651086610867108681086910870108711087210873108741087510876108771087810879108801088110882108831088410885108861088710888108891089010891108921089310894108951089610897108981089910900109011090210903109041090510906109071090810909109101091110912109131091410915109161091710918109191092010921109221092310924109251092610927109281092910930109311093210933109341093510936109371093810939109401094110942109431094410945109461094710948109491095010951109521095310954109551095610957109581095910960109611096210963109641096510966109671096810969109701097110972109731097410975109761097710978109791098010981109821098310984109851098610987109881098910990109911099210993109941099510996109971099810999110001100111002110031100411005110061100711008110091101011011110121101311014110151101611017110181101911020110211102211023110241102511026110271102811029110301103111032110331103411035110361103711038110391104011041110421104311044110451104611047110481104911050110511105211053110541105511056110571105811059110601106111062110631106411065110661106711068110691107011071110721107311074110751107611077110781107911080110811108211083110841108511086110871108811089110901109111092110931109411095110961109711098110991110011101111021110311104111051110611107111081110911110111111111211113111141111511116111171111811119111201112111122111231112411125111261112711128111291113011131111321113311134111351113611137111381113911140111411114211143111441114511146111471114811149111501115111152111531115411155111561115711158111591116011161111621116311164111651116611167111681116911170111711117211173111741117511176111771117811179111801118111182111831118411185111861118711188111891119011191111921119311194111951119611197111981119911200112011120211203112041120511206112071120811209112101121111212112131121411215112161121711218112191122011221112221122311224112251122611227112281122911230112311123211233112341123511236112371123811239112401124111242112431124411245112461124711248112491125011251112521125311254112551125611257112581125911260112611126211263112641126511266112671126811269112701127111272112731127411275112761127711278112791128011281112821128311284112851128611287112881128911290112911129211293112941129511296112971129811299113001130111302113031130411305113061130711308113091131011311113121131311314113151131611317113181131911320113211132211323113241132511326113271132811329113301133111332113331133411335113361133711338113391134011341113421134311344113451134611347113481134911350113511135211353113541135511356113571135811359113601136111362113631136411365113661136711368113691137011371113721137311374113751137611377113781137911380113811138211383113841138511386113871138811389113901139111392113931139411395113961139711398113991140011401114021140311404114051140611407114081140911410114111141211413114141141511416114171141811419114201142111422114231142411425114261142711428114291143011431114321143311434114351143611437114381143911440114411144211443114441144511446114471144811449114501145111452114531145411455114561145711458114591146011461114621146311464114651146611467114681146911470114711147211473114741147511476114771147811479114801148111482114831148411485114861148711488114891149011491114921149311494114951149611497114981149911500115011150211503115041150511506115071150811509115101151111512115131151411515115161151711518115191152011521115221152311524115251152611527115281152911530115311153211533115341153511536115371153811539115401154111542115431154411545115461154711548115491155011551115521155311554115551155611557115581155911560115611156211563115641156511566115671156811569115701157111572115731157411575115761157711578115791158011581115821158311584115851158611587115881158911590115911159211593115941159511596115971159811599116001160111602116031160411605116061160711608116091161011611116121161311614116151161611617116181161911620116211162211623116241162511626116271162811629116301163111632116331163411635116361163711638116391164011641116421164311644116451164611647116481164911650116511165211653116541165511656116571165811659116601166111662116631166411665116661166711668116691167011671116721167311674116751167611677116781167911680116811168211683116841168511686116871168811689116901169111692116931169411695116961169711698116991170011701117021170311704117051170611707117081170911710117111171211713117141171511716117171171811719117201172111722117231172411725117261172711728117291173011731117321173311734117351173611737117381173911740117411174211743117441174511746117471174811749117501175111752117531175411755117561175711758117591176011761117621176311764117651176611767117681176911770117711177211773117741177511776117771177811779117801178111782117831178411785117861178711788117891179011791117921179311794117951179611797117981179911800118011180211803118041180511806118071180811809118101181111812118131181411815118161181711818118191182011821118221182311824118251182611827118281182911830118311183211833118341183511836118371183811839118401184111842118431184411845118461184711848118491185011851118521185311854118551185611857118581185911860118611186211863118641186511866118671186811869118701187111872118731187411875118761187711878118791188011881118821188311884118851188611887118881188911890118911189211893118941189511896118971189811899119001190111902119031190411905119061190711908119091191011911119121191311914119151191611917119181191911920119211192211923119241192511926119271192811929119301193111932119331193411935119361193711938119391194011941119421194311944119451194611947119481194911950119511195211953119541195511956119571195811959119601196111962119631196411965119661196711968119691197011971119721197311974119751197611977119781197911980119811198211983119841198511986119871198811989119901199111992119931199411995119961199711998119991200012001120021200312004120051200612007120081200912010120111201212013120141201512016120171201812019120201202112022120231202412025120261202712028120291203012031120321203312034120351203612037120381203912040120411204212043120441204512046120471204812049120501205112052120531205412055120561205712058120591206012061120621206312064120651206612067120681206912070120711207212073120741207512076120771207812079120801208112082120831208412085120861208712088120891209012091120921209312094120951209612097120981209912100121011210212103121041210512106121071210812109121101211112112121131211412115121161211712118121191212012121121221212312124121251212612127121281212912130121311213212133121341213512136121371213812139121401214112142121431214412145121461214712148121491215012151121521215312154121551215612157121581215912160121611216212163121641216512166121671216812169121701217112172121731217412175121761217712178121791218012181121821218312184121851218612187121881218912190121911219212193121941219512196121971219812199122001220112202122031220412205122061220712208122091221012211122121221312214122151221612217122181221912220122211222212223122241222512226122271222812229122301223112232122331223412235122361223712238122391224012241122421224312244122451224612247122481224912250122511225212253122541225512256122571225812259122601226112262122631226412265122661226712268122691227012271122721227312274122751227612277122781227912280122811228212283122841228512286122871228812289122901229112292122931229412295122961229712298122991230012301123021230312304123051230612307123081230912310123111231212313123141231512316123171231812319123201232112322123231232412325123261232712328123291233012331123321233312334123351233612337123381233912340123411234212343123441234512346123471234812349123501235112352123531235412355123561235712358123591236012361123621236312364123651236612367123681236912370123711237212373123741237512376123771237812379123801238112382123831238412385123861238712388123891239012391123921239312394123951239612397123981239912400124011240212403124041240512406124071240812409124101241112412124131241412415124161241712418124191242012421124221242312424124251242612427124281242912430124311243212433124341243512436124371243812439124401244112442124431244412445124461244712448124491245012451124521245312454124551245612457124581245912460124611246212463124641246512466124671246812469124701247112472124731247412475124761247712478124791248012481124821248312484124851248612487124881248912490124911249212493124941249512496124971249812499125001250112502125031250412505125061250712508125091251012511125121251312514125151251612517125181251912520125211252212523125241252512526125271252812529125301253112532125331253412535125361253712538125391254012541125421254312544125451254612547125481254912550125511255212553125541255512556125571255812559125601256112562125631256412565125661256712568125691257012571125721257312574125751257612577125781257912580125811258212583125841258512586125871258812589125901259112592125931259412595125961259712598125991260012601126021260312604126051260612607126081260912610126111261212613126141261512616126171261812619126201262112622126231262412625126261262712628126291263012631126321263312634126351263612637126381263912640126411264212643126441264512646126471264812649126501265112652126531265412655126561265712658126591266012661126621266312664126651266612667126681266912670126711267212673126741267512676126771267812679126801268112682126831268412685126861268712688126891269012691126921269312694126951269612697126981269912700127011270212703127041270512706127071270812709127101271112712127131271412715127161271712718127191272012721127221272312724127251272612727127281272912730127311273212733127341273512736127371273812739127401274112742127431274412745127461274712748127491275012751127521275312754127551275612757127581275912760127611276212763127641276512766127671276812769127701277112772127731277412775127761277712778127791278012781127821278312784127851278612787127881278912790127911279212793127941279512796127971279812799128001280112802128031280412805128061280712808128091281012811128121281312814128151281612817128181281912820128211282212823128241282512826128271282812829128301283112832128331283412835128361283712838128391284012841128421284312844128451284612847128481284912850128511285212853128541285512856128571285812859128601286112862128631286412865128661286712868128691287012871128721287312874128751287612877128781287912880128811288212883128841288512886128871288812889128901289112892128931289412895128961289712898128991290012901129021290312904129051290612907129081290912910129111291212913129141291512916129171291812919129201292112922129231292412925129261292712928129291293012931129321293312934129351293612937129381293912940129411294212943129441294512946129471294812949129501295112952129531295412955129561295712958129591296012961129621296312964129651296612967129681296912970129711297212973129741297512976129771297812979129801298112982129831298412985129861298712988129891299012991129921299312994129951299612997129981299913000130011300213003130041300513006130071300813009130101301113012130131301413015130161301713018130191302013021130221302313024130251302613027130281302913030130311303213033130341303513036130371303813039130401304113042130431304413045130461304713048130491305013051130521305313054130551305613057130581305913060130611306213063130641306513066130671306813069130701307113072130731307413075130761307713078130791308013081130821308313084130851308613087130881308913090130911309213093130941309513096130971309813099131001310113102131031310413105131061310713108131091311013111131121311313114131151311613117131181311913120131211312213123131241312513126131271312813129131301313113132131331313413135131361313713138131391314013141131421314313144131451314613147131481314913150131511315213153131541315513156131571315813159131601316113162131631316413165131661316713168131691317013171131721317313174131751317613177131781317913180131811318213183131841318513186131871318813189131901319113192131931319413195131961319713198131991320013201132021320313204132051320613207132081320913210132111321213213132141321513216132171321813219132201322113222132231322413225132261322713228132291323013231132321323313234132351323613237132381323913240132411324213243132441324513246132471324813249132501325113252132531325413255132561325713258132591326013261132621326313264132651326613267132681326913270132711327213273132741327513276132771327813279132801328113282132831328413285132861328713288132891329013291132921329313294132951329613297132981329913300133011330213303133041330513306133071330813309133101331113312133131331413315133161331713318133191332013321133221332313324133251332613327133281332913330133311333213333133341333513336133371333813339133401334113342133431334413345133461334713348133491335013351133521335313354133551335613357133581335913360133611336213363133641336513366133671336813369133701337113372133731337413375133761337713378133791338013381133821338313384133851338613387133881338913390133911339213393133941339513396133971339813399134001340113402134031340413405134061340713408134091341013411134121341313414134151341613417134181341913420134211342213423134241342513426134271342813429134301343113432134331343413435134361343713438134391344013441134421344313444134451344613447134481344913450134511345213453134541345513456134571345813459134601346113462134631346413465134661346713468134691347013471134721347313474134751347613477134781347913480134811348213483134841348513486134871348813489134901349113492134931349413495134961349713498134991350013501135021350313504135051350613507135081350913510135111351213513135141351513516135171351813519135201352113522135231352413525135261352713528135291353013531135321353313534135351353613537135381353913540135411354213543135441354513546135471354813549135501355113552135531355413555135561355713558135591356013561135621356313564135651356613567135681356913570135711357213573135741357513576135771357813579135801358113582135831358413585135861358713588135891359013591135921359313594135951359613597135981359913600136011360213603136041360513606136071360813609136101361113612136131361413615136161361713618136191362013621136221362313624136251362613627136281362913630136311363213633136341363513636136371363813639136401364113642136431364413645136461364713648136491365013651136521365313654136551365613657136581365913660136611366213663136641366513666136671366813669136701367113672136731367413675136761367713678136791368013681136821368313684136851368613687136881368913690136911369213693136941369513696136971369813699137001370113702137031370413705137061370713708137091371013711137121371313714137151371613717137181371913720137211372213723137241372513726137271372813729137301373113732137331373413735137361373713738137391374013741137421374313744137451374613747137481374913750137511375213753137541375513756137571375813759137601376113762137631376413765137661376713768137691377013771137721377313774137751377613777137781377913780137811378213783137841378513786137871378813789137901379113792137931379413795137961379713798137991380013801138021380313804138051380613807138081380913810138111381213813138141381513816138171381813819138201382113822138231382413825138261382713828138291383013831138321383313834138351383613837138381383913840138411384213843138441384513846138471384813849138501385113852138531385413855138561385713858138591386013861138621386313864138651386613867138681386913870138711387213873138741387513876138771387813879138801388113882138831388413885138861388713888138891389013891138921389313894138951389613897138981389913900139011390213903139041390513906139071390813909139101391113912139131391413915139161391713918139191392013921139221392313924139251392613927139281392913930139311393213933139341393513936139371393813939139401394113942139431394413945139461394713948139491395013951139521395313954139551395613957139581395913960139611396213963139641396513966139671396813969139701397113972139731397413975139761397713978139791398013981139821398313984139851398613987139881398913990139911399213993139941399513996139971399813999140001400114002140031400414005140061400714008140091401014011140121401314014140151401614017140181401914020140211402214023140241402514026140271402814029140301403114032140331403414035140361403714038140391404014041140421404314044140451404614047140481404914050140511405214053140541405514056140571405814059140601406114062140631406414065140661406714068140691407014071140721407314074140751407614077140781407914080140811408214083140841408514086140871408814089140901409114092140931409414095140961409714098140991410014101141021410314104141051410614107141081410914110141111411214113141141411514116141171411814119141201412114122141231412414125141261412714128141291413014131141321413314134141351413614137141381413914140141411414214143141441414514146141471414814149141501415114152141531415414155141561415714158141591416014161141621416314164141651416614167141681416914170141711417214173141741417514176141771417814179141801418114182141831418414185141861418714188141891419014191141921419314194141951419614197141981419914200142011420214203142041420514206142071420814209142101421114212142131421414215142161421714218142191422014221142221422314224142251422614227142281422914230142311423214233142341423514236142371423814239142401424114242142431424414245142461424714248142491425014251142521425314254142551425614257142581425914260142611426214263142641426514266142671426814269142701427114272142731427414275142761427714278142791428014281142821428314284142851428614287142881428914290142911429214293142941429514296142971429814299143001430114302143031430414305143061430714308143091431014311143121431314314143151431614317143181431914320143211432214323143241432514326143271432814329143301433114332143331433414335143361433714338143391434014341143421434314344143451434614347143481434914350143511435214353143541435514356143571435814359143601436114362143631436414365143661436714368143691437014371143721437314374143751437614377143781437914380143811438214383143841438514386143871438814389143901439114392143931439414395143961439714398143991440014401144021440314404144051440614407144081440914410144111441214413144141441514416144171441814419144201442114422144231442414425144261442714428144291443014431144321443314434144351443614437144381443914440144411444214443144441444514446144471444814449144501445114452144531445414455144561445714458144591446014461144621446314464144651446614467144681446914470144711447214473144741447514476144771447814479144801448114482144831448414485144861448714488144891449014491144921449314494144951449614497144981449914500145011450214503145041450514506145071450814509145101451114512145131451414515145161451714518145191452014521145221452314524145251452614527145281452914530145311453214533145341453514536145371453814539145401454114542145431454414545145461454714548145491455014551145521455314554145551455614557145581455914560145611456214563145641456514566145671456814569145701457114572145731457414575145761457714578145791458014581145821458314584145851458614587145881458914590145911459214593145941459514596145971459814599146001460114602146031460414605146061460714608146091461014611146121461314614146151461614617146181461914620146211462214623146241462514626146271462814629146301463114632146331463414635146361463714638146391464014641146421464314644146451464614647146481464914650146511465214653146541465514656146571465814659146601466114662146631466414665146661466714668146691467014671146721467314674146751467614677146781467914680146811468214683146841468514686146871468814689146901469114692146931469414695146961469714698146991470014701147021470314704147051470614707147081470914710147111471214713147141471514716147171471814719147201472114722147231472414725147261472714728147291473014731147321473314734147351473614737147381473914740147411474214743147441474514746147471474814749147501475114752147531475414755147561475714758147591476014761147621476314764147651476614767147681476914770147711477214773147741477514776147771477814779147801478114782147831478414785147861478714788147891479014791147921479314794147951479614797147981479914800148011480214803148041480514806148071480814809148101481114812148131481414815148161481714818148191482014821148221482314824148251482614827148281482914830148311483214833148341483514836148371483814839148401484114842148431484414845148461484714848148491485014851148521485314854148551485614857148581485914860148611486214863148641486514866148671486814869148701487114872148731487414875148761487714878148791488014881148821488314884148851488614887148881488914890148911489214893148941489514896148971489814899149001490114902149031490414905149061490714908149091491014911149121491314914149151491614917149181491914920149211492214923149241492514926149271492814929149301493114932149331493414935149361493714938149391494014941149421494314944149451494614947149481494914950149511495214953149541495514956149571495814959149601496114962149631496414965149661496714968149691497014971149721497314974149751497614977149781497914980149811498214983149841498514986149871498814989149901499114992149931499414995149961499714998149991500015001150021500315004150051500615007150081500915010150111501215013150141501515016150171501815019150201502115022150231502415025150261502715028150291503015031150321503315034150351503615037150381503915040150411504215043150441504515046150471504815049150501505115052150531505415055150561505715058150591506015061150621506315064150651506615067150681506915070150711507215073150741507515076150771507815079150801508115082150831508415085150861508715088150891509015091150921509315094150951509615097150981509915100151011510215103151041510515106151071510815109151101511115112151131511415115151161511715118151191512015121151221512315124151251512615127151281512915130151311513215133151341513515136151371513815139151401514115142151431514415145151461514715148151491515015151151521515315154151551515615157151581515915160151611516215163151641516515166151671516815169151701517115172151731517415175151761517715178151791518015181151821518315184151851518615187151881518915190151911519215193151941519515196151971519815199152001520115202152031520415205152061520715208152091521015211152121521315214152151521615217152181521915220152211522215223152241522515226152271522815229152301523115232152331523415235152361523715238152391524015241152421524315244152451524615247152481524915250152511525215253152541525515256152571525815259152601526115262152631526415265152661526715268152691527015271152721527315274152751527615277152781527915280152811528215283152841528515286152871528815289152901529115292152931529415295152961529715298152991530015301153021530315304153051530615307153081530915310153111531215313153141531515316153171531815319153201532115322153231532415325153261532715328153291533015331153321533315334153351533615337153381533915340153411534215343153441534515346153471534815349153501535115352153531535415355153561535715358153591536015361153621536315364153651536615367153681536915370153711537215373153741537515376153771537815379153801538115382153831538415385153861538715388153891539015391153921539315394153951539615397153981539915400154011540215403154041540515406154071540815409154101541115412154131541415415154161541715418154191542015421154221542315424154251542615427154281542915430154311543215433154341543515436154371543815439154401544115442154431544415445154461544715448154491545015451154521545315454154551545615457154581545915460154611546215463154641546515466154671546815469154701547115472154731547415475154761547715478154791548015481154821548315484154851548615487154881548915490154911549215493154941549515496154971549815499155001550115502155031550415505155061550715508155091551015511155121551315514155151551615517155181551915520155211552215523155241552515526155271552815529155301553115532155331553415535155361553715538155391554015541155421554315544155451554615547155481554915550155511555215553155541555515556155571555815559155601556115562155631556415565155661556715568155691557015571155721557315574155751557615577155781557915580155811558215583155841558515586155871558815589155901559115592155931559415595155961559715598155991560015601156021560315604156051560615607156081560915610156111561215613156141561515616156171561815619156201562115622156231562415625156261562715628156291563015631156321563315634156351563615637156381563915640156411564215643156441564515646156471564815649156501565115652156531565415655156561565715658156591566015661156621566315664156651566615667156681566915670156711567215673156741567515676156771567815679156801568115682156831568415685156861568715688156891569015691156921569315694156951569615697156981569915700157011570215703157041570515706157071570815709157101571115712157131571415715157161571715718157191572015721157221572315724157251572615727157281572915730157311573215733157341573515736157371573815739157401574115742157431574415745157461574715748157491575015751157521575315754157551575615757157581575915760157611576215763157641576515766157671576815769157701577115772157731577415775157761577715778157791578015781157821578315784157851578615787157881578915790157911579215793157941579515796157971579815799158001580115802158031580415805158061580715808158091581015811158121581315814158151581615817158181581915820158211582215823158241582515826158271582815829158301583115832158331583415835158361583715838158391584015841158421584315844158451584615847158481584915850158511585215853158541585515856158571585815859158601586115862158631586415865158661586715868158691587015871158721587315874158751587615877158781587915880158811588215883158841588515886158871588815889158901589115892158931589415895158961589715898158991590015901159021590315904159051590615907159081590915910159111591215913159141591515916159171591815919159201592115922159231592415925159261592715928159291593015931159321593315934159351593615937159381593915940159411594215943159441594515946159471594815949159501595115952159531595415955159561595715958159591596015961159621596315964159651596615967159681596915970159711597215973159741597515976159771597815979159801598115982159831598415985159861598715988159891599015991159921599315994159951599615997159981599916000160011600216003160041600516006160071600816009160101601116012160131601416015160161601716018160191602016021160221602316024160251602616027160281602916030160311603216033160341603516036160371603816039160401604116042160431604416045160461604716048160491605016051160521605316054160551605616057160581605916060160611606216063160641606516066160671606816069160701607116072160731607416075160761607716078160791608016081160821608316084160851608616087160881608916090160911609216093160941609516096160971609816099161001610116102161031610416105161061610716108161091611016111161121611316114161151611616117161181611916120161211612216123161241612516126161271612816129161301613116132161331613416135161361613716138161391614016141161421614316144161451614616147161481614916150161511615216153161541615516156161571615816159161601616116162161631616416165161661616716168161691617016171161721617316174161751617616177161781617916180161811618216183161841618516186161871618816189161901619116192161931619416195161961619716198161991620016201162021620316204162051620616207162081620916210162111621216213162141621516216162171621816219162201622116222162231622416225162261622716228162291623016231162321623316234162351623616237162381623916240162411624216243162441624516246162471624816249162501625116252162531625416255162561625716258162591626016261162621626316264162651626616267162681626916270162711627216273162741627516276162771627816279162801628116282162831628416285162861628716288162891629016291162921629316294162951629616297162981629916300163011630216303163041630516306163071630816309163101631116312163131631416315163161631716318163191632016321163221632316324163251632616327163281632916330163311633216333163341633516336163371633816339163401634116342163431634416345163461634716348163491635016351163521635316354163551635616357163581635916360163611636216363163641636516366163671636816369163701637116372163731637416375163761637716378163791638016381163821638316384163851638616387163881638916390163911639216393163941639516396163971639816399164001640116402164031640416405164061640716408164091641016411164121641316414164151641616417164181641916420164211642216423164241642516426164271642816429164301643116432164331643416435164361643716438164391644016441164421644316444164451644616447164481644916450164511645216453164541645516456164571645816459164601646116462164631646416465164661646716468164691647016471164721647316474164751647616477164781647916480164811648216483164841648516486164871648816489164901649116492164931649416495164961649716498164991650016501165021650316504165051650616507165081650916510165111651216513165141651516516165171651816519165201652116522165231652416525165261652716528165291653016531165321653316534165351653616537165381653916540165411654216543165441654516546165471654816549165501655116552165531655416555165561655716558165591656016561165621656316564165651656616567165681656916570165711657216573165741657516576165771657816579165801658116582165831658416585165861658716588165891659016591165921659316594165951659616597165981659916600166011660216603166041660516606166071660816609166101661116612166131661416615166161661716618166191662016621166221662316624166251662616627166281662916630166311663216633166341663516636166371663816639166401664116642166431664416645166461664716648166491665016651166521665316654166551665616657166581665916660166611666216663166641666516666166671666816669166701667116672166731667416675166761667716678166791668016681166821668316684166851668616687166881668916690166911669216693166941669516696166971669816699167001670116702167031670416705167061670716708167091671016711167121671316714167151671616717167181671916720167211672216723167241672516726167271672816729167301673116732167331673416735167361673716738167391674016741167421674316744167451674616747167481674916750167511675216753167541675516756167571675816759167601676116762167631676416765167661676716768167691677016771167721677316774167751677616777167781677916780167811678216783167841678516786167871678816789167901679116792167931679416795167961679716798167991680016801168021680316804168051680616807168081680916810168111681216813168141681516816168171681816819168201682116822168231682416825168261682716828168291683016831168321683316834168351683616837168381683916840168411684216843168441684516846168471684816849168501685116852168531685416855168561685716858168591686016861168621686316864168651686616867168681686916870168711687216873168741687516876168771687816879168801688116882168831688416885168861688716888168891689016891168921689316894168951689616897168981689916900169011690216903169041690516906169071690816909169101691116912169131691416915169161691716918169191692016921169221692316924169251692616927169281692916930169311693216933169341693516936169371693816939169401694116942169431694416945169461694716948169491695016951169521695316954169551695616957169581695916960169611696216963169641696516966169671696816969169701697116972169731697416975169761697716978169791698016981169821698316984169851698616987169881698916990169911699216993169941699516996169971699816999170001700117002170031700417005170061700717008170091701017011170121701317014170151701617017170181701917020170211702217023170241702517026170271702817029170301703117032170331703417035170361703717038170391704017041170421704317044170451704617047170481704917050170511705217053170541705517056170571705817059170601706117062170631706417065170661706717068170691707017071170721707317074170751707617077170781707917080170811708217083170841708517086170871708817089170901709117092170931709417095170961709717098170991710017101171021710317104171051710617107171081710917110171111711217113171141711517116171171711817119171201712117122171231712417125171261712717128171291713017131171321713317134171351713617137171381713917140171411714217143171441714517146171471714817149171501715117152171531715417155171561715717158171591716017161171621716317164171651716617167171681716917170171711717217173171741717517176171771717817179171801718117182171831718417185171861718717188171891719017191171921719317194171951719617197171981719917200172011720217203172041720517206172071720817209172101721117212172131721417215172161721717218172191722017221172221722317224172251722617227172281722917230172311723217233172341723517236172371723817239172401724117242172431724417245172461724717248172491725017251172521725317254172551725617257172581725917260172611726217263172641726517266172671726817269172701727117272172731727417275172761727717278172791728017281172821728317284172851728617287172881728917290172911729217293172941729517296172971729817299173001730117302173031730417305173061730717308173091731017311173121731317314173151731617317173181731917320173211732217323173241732517326173271732817329173301733117332173331733417335173361733717338173391734017341173421734317344173451734617347173481734917350173511735217353173541735517356173571735817359173601736117362173631736417365173661736717368173691737017371173721737317374173751737617377173781737917380173811738217383173841738517386173871738817389173901739117392173931739417395173961739717398173991740017401174021740317404174051740617407174081740917410174111741217413174141741517416174171741817419174201742117422174231742417425174261742717428174291743017431174321743317434174351743617437174381743917440174411744217443174441744517446174471744817449174501745117452174531745417455174561745717458174591746017461174621746317464174651746617467174681746917470174711747217473174741747517476174771747817479174801748117482174831748417485174861748717488174891749017491174921749317494174951749617497174981749917500175011750217503175041750517506175071750817509175101751117512175131751417515175161751717518175191752017521175221752317524175251752617527175281752917530175311753217533175341753517536175371753817539175401754117542175431754417545175461754717548175491755017551175521755317554175551755617557175581755917560175611756217563175641756517566175671756817569175701757117572175731757417575175761757717578175791758017581175821758317584175851758617587175881758917590175911759217593175941759517596175971759817599176001760117602176031760417605176061760717608176091761017611176121761317614176151761617617176181761917620176211762217623176241762517626176271762817629176301763117632176331763417635176361763717638176391764017641176421764317644176451764617647176481764917650176511765217653176541765517656176571765817659176601766117662176631766417665176661766717668176691767017671176721767317674176751767617677176781767917680176811768217683176841768517686176871768817689176901769117692176931769417695176961769717698176991770017701177021770317704177051770617707177081770917710177111771217713177141771517716177171771817719177201772117722177231772417725177261772717728177291773017731177321773317734177351773617737177381773917740177411774217743177441774517746177471774817749177501775117752177531775417755177561775717758177591776017761177621776317764177651776617767177681776917770177711777217773177741777517776177771777817779177801778117782177831778417785177861778717788177891779017791177921779317794177951779617797177981779917800178011780217803178041780517806178071780817809178101781117812178131781417815178161781717818178191782017821178221782317824178251782617827178281782917830178311783217833178341783517836178371783817839178401784117842178431784417845178461784717848178491785017851178521785317854178551785617857178581785917860178611786217863178641786517866178671786817869178701787117872178731787417875178761787717878178791788017881178821788317884178851788617887178881788917890178911789217893178941789517896178971789817899179001790117902179031790417905179061790717908179091791017911179121791317914179151791617917179181791917920179211792217923179241792517926179271792817929179301793117932179331793417935179361793717938179391794017941179421794317944179451794617947179481794917950179511795217953179541795517956179571795817959179601796117962179631796417965179661796717968179691797017971179721797317974179751797617977179781797917980179811798217983179841798517986179871798817989179901799117992179931799417995179961799717998179991800018001180021800318004180051800618007180081800918010180111801218013180141801518016180171801818019180201802118022180231802418025180261802718028180291803018031180321803318034180351803618037180381803918040180411804218043180441804518046180471804818049180501805118052180531805418055180561805718058180591806018061180621806318064180651806618067180681806918070180711807218073180741807518076180771807818079180801808118082180831808418085180861808718088180891809018091180921809318094180951809618097180981809918100181011810218103181041810518106181071810818109181101811118112181131811418115181161811718118181191812018121181221812318124181251812618127181281812918130181311813218133181341813518136181371813818139181401814118142181431814418145181461814718148181491815018151181521815318154181551815618157181581815918160181611816218163181641816518166181671816818169181701817118172181731817418175181761817718178181791818018181181821818318184181851818618187181881818918190181911819218193181941819518196181971819818199182001820118202182031820418205182061820718208182091821018211182121821318214182151821618217182181821918220182211822218223182241822518226182271822818229182301823118232182331823418235182361823718238182391824018241182421824318244182451824618247182481824918250182511825218253182541825518256182571825818259182601826118262182631826418265182661826718268182691827018271182721827318274182751827618277182781827918280182811828218283182841828518286182871828818289182901829118292182931829418295182961829718298182991830018301183021830318304183051830618307183081830918310183111831218313183141831518316183171831818319183201832118322183231832418325183261832718328183291833018331183321833318334183351833618337183381833918340183411834218343183441834518346183471834818349183501835118352183531835418355183561835718358183591836018361183621836318364183651836618367183681836918370183711837218373183741837518376183771837818379183801838118382183831838418385183861838718388183891839018391183921839318394183951839618397183981839918400184011840218403184041840518406184071840818409184101841118412184131841418415184161841718418184191842018421184221842318424184251842618427184281842918430184311843218433184341843518436184371843818439184401844118442184431844418445184461844718448184491845018451184521845318454184551845618457184581845918460184611846218463184641846518466184671846818469184701847118472184731847418475184761847718478184791848018481184821848318484184851848618487184881848918490184911849218493184941849518496184971849818499185001850118502185031850418505185061850718508185091851018511185121851318514185151851618517185181851918520185211852218523185241852518526185271852818529185301853118532185331853418535185361853718538185391854018541185421854318544185451854618547185481854918550185511855218553185541855518556185571855818559185601856118562185631856418565185661856718568185691857018571185721857318574185751857618577185781857918580185811858218583185841858518586185871858818589185901859118592185931859418595185961859718598185991860018601186021860318604186051860618607186081860918610186111861218613186141861518616186171861818619186201862118622186231862418625186261862718628186291863018631186321863318634186351863618637186381863918640186411864218643186441864518646186471864818649186501865118652186531865418655186561865718658186591866018661186621866318664186651866618667186681866918670186711867218673186741867518676186771867818679186801868118682186831868418685186861868718688186891869018691186921869318694186951869618697186981869918700187011870218703187041870518706187071870818709187101871118712187131871418715187161871718718187191872018721187221872318724187251872618727187281872918730187311873218733187341873518736187371873818739187401874118742187431874418745187461874718748187491875018751187521875318754187551875618757187581875918760187611876218763187641876518766187671876818769187701877118772187731877418775187761877718778187791878018781187821878318784187851878618787187881878918790187911879218793187941879518796187971879818799188001880118802188031880418805188061880718808188091881018811188121881318814188151881618817188181881918820188211882218823188241882518826188271882818829188301883118832188331883418835188361883718838188391884018841188421884318844188451884618847188481884918850188511885218853188541885518856188571885818859188601886118862188631886418865188661886718868188691887018871188721887318874188751887618877188781887918880188811888218883188841888518886188871888818889188901889118892188931889418895188961889718898188991890018901189021890318904189051890618907189081890918910189111891218913189141891518916189171891818919189201892118922189231892418925189261892718928189291893018931189321893318934189351893618937189381893918940189411894218943189441894518946189471894818949189501895118952189531895418955189561895718958189591896018961189621896318964189651896618967189681896918970189711897218973189741897518976189771897818979189801898118982189831898418985189861898718988189891899018991189921899318994189951899618997189981899919000190011900219003190041900519006190071900819009190101901119012190131901419015190161901719018190191902019021190221902319024190251902619027190281902919030190311903219033190341903519036190371903819039190401904119042190431904419045190461904719048190491905019051190521905319054190551905619057190581905919060190611906219063190641906519066190671906819069190701907119072190731907419075190761907719078190791908019081190821908319084190851908619087190881908919090190911909219093190941909519096190971909819099191001910119102191031910419105191061910719108191091911019111191121911319114191151911619117191181911919120191211912219123191241912519126191271912819129191301913119132191331913419135191361913719138191391914019141191421914319144191451914619147191481914919150191511915219153191541915519156191571915819159191601916119162191631916419165191661916719168191691917019171191721917319174191751917619177191781917919180191811918219183191841918519186191871918819189191901919119192191931919419195191961919719198191991920019201192021920319204192051920619207192081920919210192111921219213192141921519216192171921819219192201922119222192231922419225192261922719228192291923019231192321923319234192351923619237192381923919240192411924219243192441924519246192471924819249192501925119252192531925419255192561925719258192591926019261192621926319264192651926619267192681926919270192711927219273192741927519276192771927819279192801928119282192831928419285192861928719288192891929019291192921929319294192951929619297192981929919300193011930219303193041930519306193071930819309193101931119312193131931419315193161931719318193191932019321193221932319324193251932619327193281932919330193311933219333193341933519336193371933819339193401934119342193431934419345193461934719348193491935019351193521935319354193551935619357193581935919360193611936219363193641936519366193671936819369193701937119372193731937419375193761937719378193791938019381193821938319384193851938619387193881938919390193911939219393193941939519396193971939819399194001940119402194031940419405194061940719408194091941019411194121941319414194151941619417194181941919420194211942219423194241942519426194271942819429194301943119432194331943419435194361943719438194391944019441194421944319444194451944619447194481944919450194511945219453194541945519456194571945819459194601946119462194631946419465194661946719468194691947019471194721947319474194751947619477194781947919480194811948219483194841948519486194871948819489194901949119492194931949419495194961949719498194991950019501195021950319504195051950619507195081950919510195111951219513195141951519516195171951819519195201952119522195231952419525195261952719528195291953019531195321953319534195351953619537195381953919540195411954219543195441954519546195471954819549195501955119552195531955419555195561955719558195591956019561195621956319564195651956619567195681956919570195711957219573195741957519576195771957819579195801958119582195831958419585195861958719588195891959019591195921959319594195951959619597195981959919600196011960219603196041960519606196071960819609196101961119612196131961419615196161961719618196191962019621196221962319624196251962619627196281962919630196311963219633196341963519636196371963819639196401964119642196431964419645196461964719648196491965019651196521965319654196551965619657196581965919660196611966219663196641966519666196671966819669196701967119672196731967419675196761967719678196791968019681196821968319684196851968619687196881968919690196911969219693196941969519696196971969819699197001970119702197031970419705197061970719708197091971019711197121971319714197151971619717197181971919720197211972219723197241972519726197271972819729197301973119732197331973419735197361973719738197391974019741197421974319744197451974619747197481974919750197511975219753197541975519756197571975819759197601976119762197631976419765197661976719768197691977019771197721977319774197751977619777197781977919780197811978219783197841978519786197871978819789197901979119792197931979419795197961979719798197991980019801198021980319804198051980619807198081980919810198111981219813198141981519816198171981819819198201982119822198231982419825198261982719828198291983019831198321983319834198351983619837198381983919840198411984219843198441984519846198471984819849198501985119852198531985419855198561985719858198591986019861198621986319864198651986619867198681986919870198711987219873198741987519876198771987819879198801988119882198831988419885198861988719888198891989019891198921989319894198951989619897198981989919900199011990219903199041990519906199071990819909199101991119912199131991419915199161991719918199191992019921199221992319924199251992619927199281992919930199311993219933199341993519936199371993819939199401994119942199431994419945199461994719948199491995019951199521995319954199551995619957199581995919960199611996219963199641996519966199671996819969199701997119972199731997419975199761997719978199791998019981199821998319984199851998619987199881998919990199911999219993199941999519996199971999819999200002000120002200032000420005200062000720008200092001020011200122001320014200152001620017200182001920020200212002220023200242002520026200272002820029200302003120032200332003420035200362003720038200392004020041200422004320044200452004620047200482004920050200512005220053200542005520056200572005820059200602006120062200632006420065200662006720068200692007020071200722007320074200752007620077200782007920080200812008220083200842008520086200872008820089200902009120092200932009420095200962009720098200992010020101201022010320104201052010620107201082010920110201112011220113201142011520116201172011820119201202012120122201232012420125201262012720128201292013020131201322013320134201352013620137201382013920140201412014220143201442014520146201472014820149201502015120152201532015420155201562015720158201592016020161201622016320164201652016620167201682016920170201712017220173201742017520176201772017820179201802018120182201832018420185201862018720188201892019020191201922019320194201952019620197201982019920200202012020220203202042020520206202072020820209202102021120212202132021420215202162021720218202192022020221202222022320224202252022620227202282022920230202312023220233202342023520236202372023820239202402024120242202432024420245202462024720248202492025020251202522025320254202552025620257202582025920260202612026220263202642026520266202672026820269202702027120272202732027420275202762027720278202792028020281202822028320284202852028620287202882028920290202912029220293202942029520296202972029820299203002030120302203032030420305203062030720308203092031020311203122031320314203152031620317203182031920320203212032220323203242032520326203272032820329203302033120332203332033420335203362033720338203392034020341203422034320344203452034620347203482034920350203512035220353203542035520356203572035820359203602036120362203632036420365203662036720368203692037020371203722037320374203752037620377203782037920380203812038220383203842038520386203872038820389203902039120392203932039420395203962039720398203992040020401204022040320404204052040620407204082040920410204112041220413204142041520416204172041820419204202042120422204232042420425204262042720428204292043020431204322043320434204352043620437204382043920440204412044220443204442044520446204472044820449204502045120452204532045420455204562045720458204592046020461204622046320464204652046620467204682046920470204712047220473204742047520476204772047820479204802048120482204832048420485204862048720488204892049020491204922049320494204952049620497204982049920500205012050220503205042050520506205072050820509205102051120512205132051420515205162051720518205192052020521205222052320524205252052620527205282052920530205312053220533205342053520536205372053820539205402054120542205432054420545205462054720548205492055020551205522055320554205552055620557205582055920560205612056220563205642056520566205672056820569205702057120572205732057420575205762057720578205792058020581205822058320584205852058620587205882058920590205912059220593205942059520596205972059820599206002060120602206032060420605206062060720608206092061020611206122061320614206152061620617206182061920620206212062220623206242062520626206272062820629206302063120632206332063420635206362063720638206392064020641206422064320644206452064620647206482064920650206512065220653206542065520656206572065820659206602066120662206632066420665206662066720668206692067020671206722067320674206752067620677206782067920680206812068220683206842068520686206872068820689206902069120692206932069420695206962069720698206992070020701207022070320704207052070620707207082070920710207112071220713207142071520716207172071820719207202072120722207232072420725207262072720728207292073020731207322073320734207352073620737207382073920740207412074220743207442074520746207472074820749207502075120752207532075420755207562075720758207592076020761207622076320764207652076620767207682076920770207712077220773207742077520776207772077820779207802078120782207832078420785207862078720788207892079020791207922079320794207952079620797207982079920800208012080220803208042080520806208072080820809208102081120812208132081420815208162081720818208192082020821208222082320824208252082620827208282082920830208312083220833208342083520836208372083820839208402084120842208432084420845208462084720848208492085020851208522085320854208552085620857208582085920860208612086220863208642086520866208672086820869208702087120872208732087420875208762087720878208792088020881208822088320884208852088620887208882088920890208912089220893208942089520896208972089820899209002090120902209032090420905209062090720908209092091020911209122091320914209152091620917209182091920920209212092220923209242092520926209272092820929209302093120932209332093420935209362093720938209392094020941209422094320944209452094620947209482094920950209512095220953209542095520956209572095820959209602096120962209632096420965209662096720968209692097020971209722097320974209752097620977209782097920980209812098220983209842098520986209872098820989209902099120992209932099420995209962099720998209992100021001210022100321004210052100621007210082100921010210112101221013210142101521016210172101821019210202102121022210232102421025210262102721028210292103021031210322103321034210352103621037210382103921040210412104221043210442104521046210472104821049210502105121052210532105421055210562105721058210592106021061210622106321064210652106621067210682106921070210712107221073210742107521076210772107821079210802108121082210832108421085210862108721088210892109021091210922109321094210952109621097210982109921100211012110221103211042110521106211072110821109211102111121112211132111421115211162111721118211192112021121211222112321124211252112621127211282112921130211312113221133211342113521136211372113821139211402114121142211432114421145211462114721148211492115021151211522115321154211552115621157211582115921160211612116221163211642116521166211672116821169211702117121172211732117421175211762117721178211792118021181211822118321184211852118621187211882118921190211912119221193211942119521196211972119821199212002120121202212032120421205212062120721208212092121021211212122121321214212152121621217212182121921220212212122221223212242122521226212272122821229212302123121232212332123421235212362123721238212392124021241212422124321244212452124621247212482124921250212512125221253212542125521256212572125821259212602126121262212632126421265212662126721268212692127021271212722127321274212752127621277212782127921280212812128221283212842128521286212872128821289212902129121292212932129421295212962129721298212992130021301213022130321304213052130621307213082130921310213112131221313213142131521316213172131821319213202132121322213232132421325213262132721328213292133021331213322133321334213352133621337213382133921340213412134221343213442134521346213472134821349213502135121352213532135421355213562135721358213592136021361213622136321364213652136621367213682136921370213712137221373213742137521376213772137821379213802138121382213832138421385213862138721388213892139021391213922139321394213952139621397213982139921400214012140221403214042140521406214072140821409214102141121412214132141421415214162141721418214192142021421214222142321424214252142621427214282142921430214312143221433214342143521436214372143821439214402144121442214432144421445214462144721448214492145021451214522145321454214552145621457214582145921460214612146221463214642146521466214672146821469214702147121472214732147421475214762147721478214792148021481214822148321484214852148621487214882148921490214912149221493214942149521496214972149821499215002150121502215032150421505215062150721508215092151021511215122151321514215152151621517215182151921520215212152221523215242152521526215272152821529215302153121532215332153421535215362153721538215392154021541215422154321544215452154621547215482154921550215512155221553215542155521556215572155821559215602156121562215632156421565215662156721568215692157021571215722157321574215752157621577215782157921580215812158221583215842158521586215872158821589215902159121592215932159421595215962159721598215992160021601216022160321604216052160621607216082160921610216112161221613216142161521616216172161821619216202162121622216232162421625216262162721628216292163021631216322163321634216352163621637216382163921640216412164221643216442164521646216472164821649216502165121652216532165421655216562165721658216592166021661216622166321664216652166621667216682166921670216712167221673216742167521676216772167821679216802168121682216832168421685216862168721688216892169021691216922169321694216952169621697216982169921700217012170221703217042170521706217072170821709217102171121712217132171421715217162171721718217192172021721217222172321724217252172621727217282172921730217312173221733217342173521736217372173821739217402174121742217432174421745217462174721748217492175021751217522175321754217552175621757217582175921760217612176221763217642176521766217672176821769217702177121772217732177421775217762177721778217792178021781217822178321784217852178621787217882178921790217912179221793217942179521796217972179821799218002180121802218032180421805218062180721808218092181021811218122181321814218152181621817218182181921820218212182221823218242182521826218272182821829218302183121832218332183421835218362183721838218392184021841218422184321844218452184621847218482184921850218512185221853218542185521856218572185821859218602186121862218632186421865218662186721868218692187021871218722187321874218752187621877218782187921880218812188221883218842188521886218872188821889218902189121892218932189421895218962189721898218992190021901219022190321904219052190621907219082190921910219112191221913219142191521916219172191821919219202192121922219232192421925219262192721928219292193021931219322193321934219352193621937219382193921940219412194221943219442194521946219472194821949219502195121952219532195421955219562195721958219592196021961219622196321964219652196621967219682196921970219712197221973219742197521976219772197821979219802198121982219832198421985219862198721988219892199021991219922199321994219952199621997219982199922000220012200222003220042200522006220072200822009220102201122012220132201422015220162201722018220192202022021220222202322024220252202622027220282202922030220312203222033220342203522036220372203822039220402204122042220432204422045220462204722048220492205022051220522205322054220552205622057220582205922060220612206222063220642206522066220672206822069220702207122072220732207422075220762207722078220792208022081220822208322084220852208622087220882208922090220912209222093220942209522096220972209822099221002210122102221032210422105221062210722108221092211022111221122211322114221152211622117221182211922120221212212222123221242212522126221272212822129221302213122132221332213422135221362213722138221392214022141221422214322144221452214622147221482214922150221512215222153221542215522156221572215822159221602216122162221632216422165221662216722168221692217022171221722217322174221752217622177221782217922180221812218222183221842218522186221872218822189221902219122192221932219422195221962219722198221992220022201222022220322204222052220622207222082220922210222112221222213222142221522216222172221822219222202222122222222232222422225222262222722228222292223022231222322223322234222352223622237222382223922240222412224222243222442224522246222472224822249222502225122252222532225422255222562225722258222592226022261222622226322264222652226622267222682226922270222712227222273222742227522276222772227822279222802228122282222832228422285222862228722288222892229022291222922229322294222952229622297222982229922300223012230222303223042230522306223072230822309223102231122312223132231422315223162231722318223192232022321223222232322324223252232622327223282232922330223312233222333223342233522336223372233822339223402234122342223432234422345223462234722348223492235022351223522235322354223552235622357223582235922360223612236222363223642236522366223672236822369223702237122372223732237422375223762237722378223792238022381223822238322384223852238622387223882238922390223912239222393223942239522396223972239822399224002240122402224032240422405224062240722408224092241022411224122241322414224152241622417224182241922420224212242222423224242242522426224272242822429224302243122432224332243422435224362243722438224392244022441224422244322444224452244622447224482244922450224512245222453224542245522456224572245822459224602246122462224632246422465224662246722468224692247022471224722247322474224752247622477224782247922480224812248222483224842248522486224872248822489224902249122492224932249422495224962249722498224992250022501225022250322504225052250622507225082250922510225112251222513225142251522516225172251822519225202252122522225232252422525225262252722528225292253022531225322253322534225352253622537225382253922540225412254222543225442254522546225472254822549225502255122552225532255422555225562255722558225592256022561225622256322564225652256622567225682256922570225712257222573225742257522576225772257822579225802258122582225832258422585225862258722588225892259022591225922259322594225952259622597225982259922600226012260222603226042260522606226072260822609226102261122612226132261422615226162261722618226192262022621226222262322624226252262622627226282262922630226312263222633226342263522636226372263822639226402264122642226432264422645226462264722648226492265022651226522265322654226552265622657226582265922660226612266222663226642266522666226672266822669226702267122672226732267422675226762267722678226792268022681226822268322684226852268622687226882268922690226912269222693226942269522696226972269822699227002270122702227032270422705227062270722708227092271022711227122271322714227152271622717227182271922720227212272222723227242272522726227272272822729227302273122732227332273422735227362273722738227392274022741227422274322744227452274622747227482274922750227512275222753227542275522756227572275822759227602276122762227632276422765227662276722768227692277022771227722277322774227752277622777227782277922780227812278222783227842278522786227872278822789227902279122792227932279422795227962279722798227992280022801228022280322804228052280622807228082280922810228112281222813228142281522816228172281822819228202282122822228232282422825228262282722828228292283022831228322283322834228352283622837228382283922840228412284222843228442284522846228472284822849228502285122852228532285422855228562285722858228592286022861228622286322864228652286622867228682286922870228712287222873228742287522876228772287822879228802288122882228832288422885228862288722888228892289022891228922289322894228952289622897228982289922900229012290222903229042290522906229072290822909229102291122912229132291422915229162291722918229192292022921229222292322924229252292622927229282292922930229312293222933229342293522936229372293822939229402294122942229432294422945229462294722948229492295022951229522295322954229552295622957229582295922960229612296222963229642296522966229672296822969229702297122972229732297422975229762297722978229792298022981229822298322984229852298622987229882298922990229912299222993229942299522996229972299822999230002300123002230032300423005230062300723008230092301023011230122301323014230152301623017230182301923020230212302223023230242302523026230272302823029230302303123032230332303423035230362303723038230392304023041230422304323044230452304623047230482304923050230512305223053230542305523056230572305823059230602306123062230632306423065230662306723068230692307023071230722307323074230752307623077230782307923080230812308223083230842308523086230872308823089230902309123092230932309423095230962309723098230992310023101231022310323104231052310623107231082310923110231112311223113231142311523116231172311823119231202312123122231232312423125231262312723128231292313023131231322313323134231352313623137231382313923140231412314223143231442314523146231472314823149231502315123152231532315423155231562315723158231592316023161231622316323164231652316623167231682316923170231712317223173231742317523176231772317823179231802318123182231832318423185231862318723188231892319023191231922319323194231952319623197231982319923200232012320223203232042320523206232072320823209232102321123212232132321423215232162321723218232192322023221232222322323224232252322623227232282322923230232312323223233232342323523236232372323823239232402324123242232432324423245232462324723248232492325023251232522325323254232552325623257232582325923260232612326223263232642326523266232672326823269232702327123272232732327423275232762327723278232792328023281232822328323284232852328623287232882328923290232912329223293232942329523296232972329823299233002330123302233032330423305233062330723308233092331023311233122331323314233152331623317233182331923320233212332223323233242332523326233272332823329233302333123332233332333423335233362333723338233392334023341233422334323344233452334623347233482334923350233512335223353233542335523356233572335823359233602336123362233632336423365233662336723368233692337023371233722337323374233752337623377233782337923380233812338223383233842338523386233872338823389233902339123392233932339423395233962339723398233992340023401234022340323404234052340623407234082340923410234112341223413234142341523416234172341823419234202342123422234232342423425234262342723428234292343023431234322343323434234352343623437234382343923440234412344223443234442344523446234472344823449234502345123452234532345423455234562345723458234592346023461234622346323464234652346623467234682346923470234712347223473234742347523476234772347823479234802348123482234832348423485234862348723488234892349023491234922349323494234952349623497234982349923500235012350223503235042350523506235072350823509235102351123512235132351423515235162351723518235192352023521235222352323524235252352623527235282352923530235312353223533235342353523536235372353823539235402354123542235432354423545235462354723548235492355023551235522355323554235552355623557235582355923560235612356223563235642356523566235672356823569235702357123572235732357423575235762357723578235792358023581235822358323584235852358623587235882358923590235912359223593235942359523596235972359823599236002360123602236032360423605236062360723608236092361023611236122361323614236152361623617236182361923620236212362223623236242362523626236272362823629236302363123632236332363423635236362363723638236392364023641236422364323644236452364623647236482364923650236512365223653236542365523656236572365823659236602366123662236632366423665236662366723668236692367023671236722367323674236752367623677236782367923680236812368223683236842368523686236872368823689236902369123692236932369423695236962369723698236992370023701237022370323704237052370623707237082370923710237112371223713237142371523716237172371823719237202372123722237232372423725237262372723728237292373023731237322373323734237352373623737237382373923740237412374223743237442374523746237472374823749237502375123752237532375423755237562375723758237592376023761237622376323764237652376623767237682376923770237712377223773237742377523776237772377823779237802378123782237832378423785237862378723788237892379023791237922379323794237952379623797237982379923800238012380223803238042380523806238072380823809238102381123812238132381423815238162381723818238192382023821238222382323824238252382623827238282382923830238312383223833238342383523836238372383823839238402384123842238432384423845238462384723848238492385023851238522385323854238552385623857238582385923860238612386223863238642386523866238672386823869238702387123872238732387423875238762387723878238792388023881238822388323884238852388623887238882388923890238912389223893238942389523896238972389823899239002390123902239032390423905239062390723908239092391023911239122391323914239152391623917239182391923920239212392223923239242392523926239272392823929239302393123932239332393423935239362393723938239392394023941239422394323944239452394623947239482394923950239512395223953239542395523956239572395823959239602396123962239632396423965239662396723968239692397023971239722397323974239752397623977239782397923980239812398223983239842398523986239872398823989239902399123992239932399423995239962399723998239992400024001240022400324004240052400624007240082400924010240112401224013240142401524016240172401824019240202402124022240232402424025240262402724028240292403024031240322403324034240352403624037240382403924040240412404224043240442404524046240472404824049240502405124052240532405424055240562405724058240592406024061240622406324064240652406624067240682406924070240712407224073240742407524076240772407824079240802408124082240832408424085240862408724088240892409024091240922409324094240952409624097240982409924100241012410224103241042410524106241072410824109241102411124112241132411424115241162411724118241192412024121241222412324124241252412624127241282412924130241312413224133241342413524136241372413824139241402414124142241432414424145241462414724148241492415024151241522415324154241552415624157241582415924160241612416224163241642416524166241672416824169241702417124172241732417424175241762417724178241792418024181241822418324184241852418624187241882418924190241912419224193241942419524196241972419824199242002420124202242032420424205242062420724208242092421024211242122421324214242152421624217242182421924220242212422224223242242422524226242272422824229242302423124232242332423424235242362423724238242392424024241242422424324244242452424624247242482424924250242512425224253242542425524256242572425824259242602426124262242632426424265242662426724268242692427024271242722427324274242752427624277242782427924280242812428224283242842428524286242872428824289242902429124292242932429424295242962429724298242992430024301243022430324304243052430624307243082430924310243112431224313243142431524316243172431824319243202432124322243232432424325243262432724328243292433024331243322433324334243352433624337243382433924340243412434224343243442434524346243472434824349243502435124352243532435424355243562435724358243592436024361243622436324364243652436624367243682436924370243712437224373243742437524376243772437824379243802438124382243832438424385243862438724388243892439024391243922439324394243952439624397243982439924400244012440224403244042440524406244072440824409244102441124412244132441424415244162441724418244192442024421244222442324424244252442624427244282442924430244312443224433244342443524436244372443824439244402444124442244432444424445244462444724448244492445024451244522445324454244552445624457244582445924460244612446224463244642446524466244672446824469244702447124472244732447424475244762447724478244792448024481244822448324484244852448624487244882448924490244912449224493244942449524496244972449824499245002450124502245032450424505245062450724508245092451024511245122451324514245152451624517245182451924520245212452224523245242452524526245272452824529245302453124532245332453424535245362453724538245392454024541245422454324544245452454624547245482454924550245512455224553245542455524556245572455824559245602456124562245632456424565245662456724568245692457024571245722457324574245752457624577245782457924580245812458224583245842458524586245872458824589245902459124592245932459424595245962459724598245992460024601246022460324604246052460624607246082460924610246112461224613246142461524616246172461824619246202462124622246232462424625246262462724628246292463024631246322463324634246352463624637246382463924640246412464224643246442464524646246472464824649246502465124652246532465424655246562465724658246592466024661246622466324664246652466624667246682466924670246712467224673246742467524676246772467824679246802468124682246832468424685246862468724688246892469024691246922469324694246952469624697246982469924700247012470224703247042470524706247072470824709247102471124712247132471424715247162471724718247192472024721247222472324724247252472624727247282472924730247312473224733247342473524736247372473824739247402474124742247432474424745247462474724748247492475024751247522475324754247552475624757247582475924760247612476224763247642476524766247672476824769247702477124772247732477424775247762477724778247792478024781247822478324784247852478624787247882478924790247912479224793247942479524796247972479824799248002480124802248032480424805248062480724808248092481024811248122481324814248152481624817248182481924820248212482224823248242482524826248272482824829248302483124832248332483424835248362483724838248392484024841248422484324844248452484624847248482484924850248512485224853248542485524856248572485824859248602486124862248632486424865248662486724868248692487024871248722487324874248752487624877248782487924880248812488224883248842488524886248872488824889248902489124892248932489424895248962489724898248992490024901249022490324904249052490624907249082490924910249112491224913249142491524916249172491824919249202492124922249232492424925249262492724928249292493024931249322493324934249352493624937249382493924940249412494224943249442494524946249472494824949249502495124952249532495424955249562495724958249592496024961249622496324964249652496624967249682496924970249712497224973249742497524976249772497824979249802498124982249832498424985249862498724988249892499024991249922499324994249952499624997249982499925000250012500225003250042500525006250072500825009250102501125012250132501425015250162501725018250192502025021250222502325024250252502625027250282502925030250312503225033250342503525036250372503825039250402504125042250432504425045250462504725048250492505025051250522505325054250552505625057250582505925060250612506225063250642506525066250672506825069250702507125072250732507425075250762507725078250792508025081250822508325084250852508625087250882508925090250912509225093250942509525096250972509825099251002510125102251032510425105251062510725108251092511025111251122511325114251152511625117251182511925120251212512225123251242512525126251272512825129251302513125132251332513425135251362513725138251392514025141251422514325144251452514625147251482514925150251512515225153251542515525156251572515825159251602516125162251632516425165251662516725168251692517025171251722517325174251752517625177251782517925180251812518225183251842518525186251872518825189251902519125192251932519425195251962519725198251992520025201252022520325204252052520625207252082520925210252112521225213252142521525216252172521825219252202522125222252232522425225252262522725228252292523025231252322523325234252352523625237252382523925240252412524225243252442524525246252472524825249252502525125252252532525425255252562525725258252592526025261252622526325264252652526625267252682526925270252712527225273252742527525276252772527825279252802528125282252832528425285252862528725288252892529025291252922529325294252952529625297252982529925300253012530225303253042530525306253072530825309253102531125312253132531425315253162531725318253192532025321253222532325324253252532625327253282532925330253312533225333253342533525336253372533825339253402534125342253432534425345253462534725348253492535025351253522535325354253552535625357253582535925360253612536225363253642536525366253672536825369253702537125372253732537425375253762537725378253792538025381253822538325384253852538625387253882538925390253912539225393253942539525396253972539825399254002540125402254032540425405254062540725408254092541025411254122541325414254152541625417254182541925420254212542225423254242542525426254272542825429254302543125432254332543425435254362543725438254392544025441254422544325444254452544625447254482544925450254512545225453254542545525456254572545825459254602546125462254632546425465254662546725468254692547025471254722547325474254752547625477254782547925480254812548225483254842548525486254872548825489254902549125492254932549425495254962549725498254992550025501255022550325504255052550625507255082550925510255112551225513255142551525516255172551825519255202552125522255232552425525255262552725528255292553025531255322553325534255352553625537255382553925540255412554225543255442554525546255472554825549255502555125552255532555425555255562555725558255592556025561255622556325564255652556625567255682556925570255712557225573255742557525576255772557825579255802558125582255832558425585255862558725588255892559025591255922559325594255952559625597255982559925600256012560225603256042560525606256072560825609256102561125612256132561425615256162561725618256192562025621256222562325624256252562625627256282562925630256312563225633256342563525636256372563825639256402564125642256432564425645256462564725648256492565025651256522565325654256552565625657256582565925660256612566225663256642566525666256672566825669256702567125672256732567425675256762567725678256792568025681256822568325684256852568625687256882568925690256912569225693256942569525696256972569825699257002570125702257032570425705257062570725708257092571025711257122571325714257152571625717257182571925720257212572225723257242572525726257272572825729257302573125732257332573425735257362573725738257392574025741257422574325744257452574625747257482574925750257512575225753257542575525756257572575825759257602576125762257632576425765257662576725768257692577025771257722577325774257752577625777257782577925780257812578225783257842578525786257872578825789257902579125792257932579425795257962579725798257992580025801258022580325804258052580625807258082580925810258112581225813258142581525816258172581825819258202582125822258232582425825258262582725828258292583025831258322583325834258352583625837258382583925840258412584225843258442584525846258472584825849258502585125852258532585425855258562585725858258592586025861258622586325864258652586625867258682586925870258712587225873258742587525876258772587825879258802588125882258832588425885258862588725888258892589025891258922589325894258952589625897258982589925900259012590225903259042590525906259072590825909259102591125912259132591425915259162591725918259192592025921259222592325924259252592625927259282592925930259312593225933259342593525936259372593825939259402594125942259432594425945259462594725948259492595025951259522595325954259552595625957259582595925960259612596225963259642596525966259672596825969259702597125972259732597425975259762597725978259792598025981259822598325984259852598625987259882598925990259912599225993259942599525996259972599825999260002600126002260032600426005260062600726008260092601026011260122601326014260152601626017260182601926020260212602226023260242602526026260272602826029260302603126032260332603426035260362603726038260392604026041260422604326044260452604626047260482604926050260512605226053260542605526056260572605826059260602606126062260632606426065260662606726068260692607026071260722607326074260752607626077260782607926080260812608226083260842608526086260872608826089260902609126092260932609426095260962609726098260992610026101261022610326104261052610626107261082610926110261112611226113261142611526116261172611826119261202612126122261232612426125261262612726128261292613026131261322613326134261352613626137261382613926140261412614226143261442614526146261472614826149261502615126152261532615426155261562615726158261592616026161261622616326164261652616626167261682616926170261712617226173261742617526176261772617826179261802618126182261832618426185261862618726188261892619026191261922619326194261952619626197261982619926200262012620226203262042620526206262072620826209262102621126212262132621426215262162621726218262192622026221262222622326224262252622626227262282622926230262312623226233262342623526236262372623826239262402624126242262432624426245262462624726248262492625026251262522625326254262552625626257262582625926260262612626226263262642626526266262672626826269262702627126272262732627426275262762627726278262792628026281262822628326284262852628626287262882628926290262912629226293262942629526296262972629826299263002630126302263032630426305263062630726308263092631026311263122631326314263152631626317263182631926320263212632226323263242632526326263272632826329263302633126332263332633426335263362633726338263392634026341263422634326344263452634626347263482634926350263512635226353263542635526356263572635826359263602636126362263632636426365263662636726368263692637026371263722637326374263752637626377263782637926380263812638226383263842638526386263872638826389263902639126392263932639426395263962639726398263992640026401264022640326404264052640626407264082640926410264112641226413264142641526416264172641826419264202642126422264232642426425264262642726428264292643026431264322643326434264352643626437264382643926440264412644226443264442644526446264472644826449264502645126452264532645426455264562645726458264592646026461264622646326464264652646626467264682646926470264712647226473264742647526476264772647826479264802648126482264832648426485264862648726488264892649026491264922649326494264952649626497264982649926500265012650226503265042650526506265072650826509265102651126512265132651426515265162651726518265192652026521265222652326524265252652626527265282652926530265312653226533265342653526536265372653826539265402654126542265432654426545265462654726548265492655026551265522655326554265552655626557265582655926560265612656226563265642656526566265672656826569265702657126572265732657426575265762657726578265792658026581265822658326584265852658626587265882658926590265912659226593265942659526596265972659826599266002660126602266032660426605266062660726608266092661026611266122661326614266152661626617266182661926620266212662226623266242662526626266272662826629266302663126632266332663426635266362663726638266392664026641266422664326644266452664626647266482664926650266512665226653266542665526656266572665826659266602666126662266632666426665266662666726668266692667026671266722667326674266752667626677266782667926680266812668226683266842668526686266872668826689266902669126692266932669426695266962669726698266992670026701267022670326704267052670626707267082670926710267112671226713267142671526716267172671826719267202672126722267232672426725267262672726728267292673026731267322673326734267352673626737267382673926740267412674226743267442674526746267472674826749267502675126752267532675426755267562675726758267592676026761267622676326764267652676626767267682676926770267712677226773267742677526776267772677826779267802678126782267832678426785267862678726788267892679026791267922679326794267952679626797267982679926800268012680226803268042680526806268072680826809268102681126812268132681426815268162681726818268192682026821268222682326824268252682626827268282682926830268312683226833268342683526836268372683826839268402684126842268432684426845268462684726848268492685026851268522685326854268552685626857268582685926860268612686226863268642686526866268672686826869268702687126872268732687426875268762687726878268792688026881268822688326884268852688626887268882688926890268912689226893268942689526896268972689826899269002690126902269032690426905269062690726908269092691026911269122691326914269152691626917269182691926920269212692226923269242692526926269272692826929269302693126932269332693426935269362693726938269392694026941269422694326944269452694626947269482694926950269512695226953269542695526956269572695826959269602696126962269632696426965269662696726968269692697026971269722697326974269752697626977269782697926980269812698226983269842698526986269872698826989269902699126992269932699426995269962699726998269992700027001270022700327004270052700627007270082700927010270112701227013270142701527016270172701827019270202702127022270232702427025270262702727028270292703027031270322703327034270352703627037270382703927040270412704227043270442704527046270472704827049270502705127052270532705427055270562705727058270592706027061270622706327064270652706627067270682706927070270712707227073270742707527076270772707827079270802708127082270832708427085270862708727088270892709027091270922709327094270952709627097270982709927100271012710227103271042710527106271072710827109271102711127112271132711427115271162711727118271192712027121271222712327124271252712627127271282712927130271312713227133271342713527136271372713827139271402714127142271432714427145271462714727148271492715027151271522715327154271552715627157271582715927160271612716227163271642716527166271672716827169271702717127172271732717427175271762717727178271792718027181271822718327184271852718627187271882718927190271912719227193271942719527196271972719827199272002720127202272032720427205272062720727208272092721027211272122721327214272152721627217272182721927220272212722227223272242722527226272272722827229272302723127232272332723427235272362723727238272392724027241272422724327244272452724627247272482724927250272512725227253272542725527256272572725827259272602726127262272632726427265272662726727268272692727027271272722727327274272752727627277272782727927280272812728227283272842728527286272872728827289272902729127292272932729427295272962729727298272992730027301273022730327304273052730627307273082730927310273112731227313273142731527316273172731827319273202732127322273232732427325273262732727328273292733027331273322733327334273352733627337273382733927340273412734227343273442734527346273472734827349273502735127352273532735427355273562735727358273592736027361273622736327364273652736627367273682736927370273712737227373273742737527376273772737827379273802738127382273832738427385273862738727388273892739027391273922739327394273952739627397273982739927400274012740227403274042740527406274072740827409274102741127412274132741427415274162741727418274192742027421274222742327424274252742627427274282742927430274312743227433274342743527436274372743827439274402744127442274432744427445274462744727448274492745027451274522745327454274552745627457274582745927460274612746227463274642746527466274672746827469274702747127472274732747427475274762747727478274792748027481274822748327484274852748627487274882748927490274912749227493274942749527496274972749827499275002750127502275032750427505275062750727508275092751027511275122751327514275152751627517275182751927520275212752227523275242752527526275272752827529275302753127532275332753427535275362753727538275392754027541275422754327544275452754627547275482754927550275512755227553275542755527556275572755827559275602756127562275632756427565275662756727568275692757027571275722757327574275752757627577275782757927580275812758227583275842758527586275872758827589275902759127592275932759427595275962759727598275992760027601276022760327604276052760627607276082760927610276112761227613276142761527616276172761827619276202762127622276232762427625276262762727628276292763027631276322763327634276352763627637276382763927640276412764227643276442764527646276472764827649276502765127652276532765427655276562765727658276592766027661276622766327664276652766627667276682766927670276712767227673276742767527676276772767827679276802768127682276832768427685276862768727688276892769027691276922769327694276952769627697276982769927700277012770227703277042770527706277072770827709277102771127712277132771427715277162771727718277192772027721277222772327724277252772627727277282772927730277312773227733277342773527736277372773827739277402774127742277432774427745277462774727748277492775027751277522775327754277552775627757277582775927760277612776227763277642776527766277672776827769277702777127772277732777427775277762777727778277792778027781277822778327784277852778627787277882778927790277912779227793277942779527796277972779827799278002780127802278032780427805278062780727808278092781027811278122781327814278152781627817278182781927820278212782227823278242782527826278272782827829278302783127832278332783427835278362783727838278392784027841278422784327844278452784627847278482784927850278512785227853278542785527856278572785827859278602786127862278632786427865278662786727868278692787027871278722787327874278752787627877278782787927880278812788227883278842788527886278872788827889278902789127892278932789427895278962789727898278992790027901279022790327904279052790627907279082790927910279112791227913279142791527916279172791827919279202792127922279232792427925279262792727928279292793027931279322793327934279352793627937279382793927940279412794227943279442794527946279472794827949279502795127952279532795427955279562795727958279592796027961279622796327964279652796627967279682796927970279712797227973279742797527976279772797827979279802798127982279832798427985279862798727988279892799027991279922799327994279952799627997279982799928000280012800228003280042800528006280072800828009280102801128012280132801428015280162801728018280192802028021280222802328024280252802628027280282802928030280312803228033280342803528036280372803828039280402804128042280432804428045280462804728048280492805028051280522805328054280552805628057280582805928060280612806228063280642806528066280672806828069280702807128072280732807428075280762807728078280792808028081280822808328084280852808628087280882808928090280912809228093280942809528096280972809828099281002810128102281032810428105281062810728108281092811028111281122811328114281152811628117281182811928120281212812228123281242812528126281272812828129281302813128132281332813428135281362813728138281392814028141281422814328144281452814628147281482814928150281512815228153281542815528156281572815828159281602816128162281632816428165281662816728168281692817028171281722817328174281752817628177281782817928180281812818228183281842818528186281872818828189281902819128192281932819428195281962819728198281992820028201282022820328204282052820628207282082820928210282112821228213282142821528216282172821828219282202822128222282232822428225282262822728228282292823028231282322823328234282352823628237282382823928240282412824228243282442824528246282472824828249282502825128252282532825428255282562825728258282592826028261282622826328264282652826628267282682826928270282712827228273282742827528276282772827828279282802828128282282832828428285282862828728288282892829028291282922829328294282952829628297282982829928300283012830228303283042830528306283072830828309283102831128312283132831428315283162831728318283192832028321283222832328324283252832628327283282832928330283312833228333283342833528336283372833828339283402834128342283432834428345283462834728348283492835028351283522835328354283552835628357283582835928360283612836228363283642836528366283672836828369283702837128372283732837428375283762837728378283792838028381283822838328384283852838628387283882838928390283912839228393283942839528396283972839828399284002840128402284032840428405284062840728408284092841028411284122841328414284152841628417284182841928420284212842228423284242842528426284272842828429284302843128432284332843428435284362843728438284392844028441284422844328444284452844628447284482844928450284512845228453284542845528456284572845828459284602846128462284632846428465284662846728468284692847028471284722847328474284752847628477284782847928480284812848228483284842848528486284872848828489284902849128492284932849428495284962849728498284992850028501285022850328504285052850628507285082850928510285112851228513285142851528516285172851828519285202852128522285232852428525285262852728528285292853028531285322853328534285352853628537285382853928540285412854228543285442854528546285472854828549285502855128552285532855428555285562855728558285592856028561285622856328564285652856628567285682856928570285712857228573285742857528576285772857828579285802858128582285832858428585285862858728588285892859028591285922859328594285952859628597285982859928600286012860228603286042860528606286072860828609286102861128612286132861428615286162861728618286192862028621286222862328624286252862628627286282862928630286312863228633286342863528636286372863828639286402864128642286432864428645286462864728648286492865028651286522865328654286552865628657286582865928660286612866228663286642866528666286672866828669286702867128672286732867428675286762867728678286792868028681286822868328684286852868628687286882868928690286912869228693286942869528696286972869828699287002870128702287032870428705287062870728708287092871028711287122871328714287152871628717287182871928720287212872228723287242872528726287272872828729287302873128732287332873428735287362873728738287392874028741287422874328744287452874628747287482874928750287512875228753287542875528756287572875828759287602876128762287632876428765287662876728768287692877028771287722877328774287752877628777287782877928780287812878228783287842878528786287872878828789287902879128792287932879428795287962879728798287992880028801288022880328804288052880628807288082880928810288112881228813288142881528816288172881828819288202882128822288232882428825288262882728828288292883028831288322883328834288352883628837288382883928840288412884228843288442884528846288472884828849288502885128852288532885428855288562885728858288592886028861288622886328864288652886628867288682886928870288712887228873288742887528876288772887828879288802888128882288832888428885288862888728888288892889028891288922889328894288952889628897288982889928900289012890228903289042890528906289072890828909289102891128912289132891428915289162891728918289192892028921289222892328924289252892628927289282892928930289312893228933289342893528936289372893828939289402894128942289432894428945289462894728948289492895028951289522895328954289552895628957289582895928960289612896228963289642896528966289672896828969289702897128972289732897428975289762897728978289792898028981289822898328984289852898628987289882898928990289912899228993289942899528996289972899828999290002900129002290032900429005290062900729008290092901029011290122901329014290152901629017290182901929020290212902229023290242902529026290272902829029290302903129032290332903429035290362903729038290392904029041290422904329044290452904629047290482904929050290512905229053290542905529056290572905829059290602906129062290632906429065290662906729068290692907029071290722907329074290752907629077290782907929080290812908229083290842908529086290872908829089290902909129092290932909429095290962909729098290992910029101291022910329104291052910629107291082910929110291112911229113291142911529116291172911829119291202912129122291232912429125291262912729128291292913029131291322913329134291352913629137291382913929140291412914229143291442914529146291472914829149291502915129152291532915429155291562915729158291592916029161291622916329164291652916629167291682916929170291712917229173291742917529176291772917829179291802918129182291832918429185291862918729188291892919029191291922919329194291952919629197291982919929200292012920229203292042920529206292072920829209292102921129212292132921429215292162921729218292192922029221292222922329224292252922629227292282922929230292312923229233292342923529236292372923829239292402924129242292432924429245292462924729248292492925029251292522925329254292552925629257292582925929260292612926229263292642926529266292672926829269292702927129272292732927429275292762927729278292792928029281292822928329284292852928629287292882928929290292912929229293292942929529296292972929829299293002930129302293032930429305293062930729308293092931029311293122931329314293152931629317293182931929320293212932229323293242932529326293272932829329293302933129332293332933429335293362933729338293392934029341293422934329344293452934629347293482934929350293512935229353293542935529356293572935829359293602936129362293632936429365293662936729368293692937029371293722937329374293752937629377293782937929380293812938229383293842938529386293872938829389293902939129392293932939429395293962939729398293992940029401294022940329404294052940629407294082940929410294112941229413294142941529416294172941829419294202942129422294232942429425294262942729428294292943029431294322943329434294352943629437294382943929440294412944229443294442944529446294472944829449294502945129452294532945429455294562945729458294592946029461294622946329464294652946629467294682946929470294712947229473294742947529476294772947829479294802948129482294832948429485294862948729488294892949029491294922949329494294952949629497294982949929500295012950229503295042950529506295072950829509295102951129512295132951429515295162951729518295192952029521295222952329524295252952629527295282952929530295312953229533295342953529536295372953829539295402954129542295432954429545295462954729548295492955029551295522955329554295552955629557295582955929560295612956229563295642956529566295672956829569295702957129572295732957429575295762957729578295792958029581295822958329584295852958629587295882958929590295912959229593295942959529596295972959829599296002960129602296032960429605296062960729608296092961029611296122961329614296152961629617296182961929620296212962229623296242962529626296272962829629296302963129632296332963429635296362963729638296392964029641296422964329644296452964629647296482964929650296512965229653296542965529656296572965829659296602966129662296632966429665296662966729668296692967029671296722967329674296752967629677296782967929680296812968229683296842968529686296872968829689296902969129692296932969429695296962969729698296992970029701297022970329704297052970629707297082970929710297112971229713297142971529716297172971829719297202972129722297232972429725297262972729728297292973029731297322973329734297352973629737297382973929740297412974229743297442974529746297472974829749297502975129752297532975429755297562975729758297592976029761297622976329764297652976629767297682976929770297712977229773297742977529776297772977829779297802978129782297832978429785297862978729788297892979029791297922979329794297952979629797297982979929800298012980229803298042980529806298072980829809298102981129812298132981429815298162981729818298192982029821298222982329824298252982629827298282982929830298312983229833298342983529836298372983829839298402984129842298432984429845298462984729848298492985029851298522985329854298552985629857298582985929860298612986229863298642986529866298672986829869298702987129872298732987429875298762987729878298792988029881298822988329884298852988629887298882988929890298912989229893298942989529896298972989829899299002990129902299032990429905299062990729908299092991029911299122991329914299152991629917299182991929920299212992229923299242992529926299272992829929299302993129932299332993429935299362993729938299392994029941299422994329944299452994629947299482994929950299512995229953299542995529956299572995829959299602996129962299632996429965299662996729968299692997029971299722997329974299752997629977299782997929980299812998229983299842998529986299872998829989299902999129992299932999429995299962999729998299993000030001300023000330004300053000630007300083000930010300113001230013300143001530016300173001830019300203002130022300233002430025300263002730028300293003030031300323003330034300353003630037300383003930040300413004230043300443004530046300473004830049300503005130052300533005430055300563005730058300593006030061300623006330064300653006630067300683006930070300713007230073300743007530076300773007830079300803008130082300833008430085300863008730088300893009030091300923009330094300953009630097300983009930100301013010230103301043010530106301073010830109301103011130112301133011430115301163011730118301193012030121301223012330124301253012630127301283012930130301313013230133301343013530136301373013830139301403014130142301433014430145301463014730148301493015030151301523015330154301553015630157301583015930160301613016230163301643016530166301673016830169301703017130172301733017430175301763017730178301793018030181301823018330184301853018630187301883018930190301913019230193301943019530196301973019830199302003020130202302033020430205302063020730208302093021030211302123021330214302153021630217302183021930220302213022230223302243022530226302273022830229302303023130232302333023430235302363023730238302393024030241302423024330244302453024630247302483024930250302513025230253302543025530256302573025830259302603026130262302633026430265302663026730268302693027030271302723027330274302753027630277302783027930280302813028230283302843028530286302873028830289302903029130292302933029430295302963029730298302993030030301303023030330304303053030630307303083030930310303113031230313303143031530316303173031830319303203032130322303233032430325303263032730328303293033030331303323033330334303353033630337303383033930340303413034230343303443034530346303473034830349303503035130352303533035430355303563035730358303593036030361303623036330364303653036630367303683036930370303713037230373303743037530376303773037830379303803038130382303833038430385303863038730388303893039030391303923039330394303953039630397303983039930400304013040230403304043040530406304073040830409304103041130412304133041430415304163041730418304193042030421304223042330424304253042630427304283042930430304313043230433304343043530436304373043830439304403044130442304433044430445304463044730448304493045030451304523045330454304553045630457304583045930460304613046230463304643046530466304673046830469304703047130472304733047430475304763047730478304793048030481304823048330484304853048630487304883048930490304913049230493304943049530496304973049830499305003050130502305033050430505305063050730508305093051030511305123051330514305153051630517305183051930520305213052230523305243052530526305273052830529305303053130532305333053430535305363053730538305393054030541305423054330544305453054630547305483054930550305513055230553305543055530556305573055830559305603056130562305633056430565305663056730568305693057030571305723057330574305753057630577305783057930580305813058230583305843058530586305873058830589305903059130592305933059430595305963059730598305993060030601306023060330604306053060630607306083060930610306113061230613306143061530616306173061830619306203062130622306233062430625306263062730628306293063030631306323063330634306353063630637306383063930640306413064230643306443064530646306473064830649306503065130652306533065430655306563065730658306593066030661306623066330664306653066630667306683066930670306713067230673306743067530676306773067830679306803068130682306833068430685306863068730688306893069030691306923069330694306953069630697306983069930700307013070230703307043070530706307073070830709307103071130712307133071430715307163071730718307193072030721307223072330724307253072630727307283072930730307313073230733307343073530736307373073830739307403074130742307433074430745307463074730748307493075030751307523075330754307553075630757307583075930760307613076230763307643076530766307673076830769307703077130772307733077430775307763077730778307793078030781307823078330784307853078630787307883078930790307913079230793307943079530796307973079830799308003080130802308033080430805308063080730808308093081030811308123081330814308153081630817308183081930820308213082230823308243082530826308273082830829308303083130832308333083430835308363083730838308393084030841308423084330844308453084630847308483084930850308513085230853308543085530856308573085830859308603086130862308633086430865308663086730868308693087030871308723087330874308753087630877308783087930880308813088230883308843088530886308873088830889308903089130892308933089430895308963089730898308993090030901309023090330904309053090630907309083090930910309113091230913309143091530916309173091830919309203092130922309233092430925309263092730928309293093030931309323093330934309353093630937309383093930940309413094230943309443094530946309473094830949309503095130952309533095430955309563095730958309593096030961309623096330964309653096630967309683096930970309713097230973309743097530976309773097830979309803098130982309833098430985309863098730988309893099030991309923099330994309953099630997309983099931000310013100231003310043100531006310073100831009310103101131012310133101431015310163101731018310193102031021310223102331024310253102631027310283102931030310313103231033310343103531036310373103831039310403104131042310433104431045310463104731048310493105031051310523105331054310553105631057310583105931060310613106231063310643106531066310673106831069310703107131072310733107431075310763107731078310793108031081310823108331084310853108631087310883108931090310913109231093310943109531096310973109831099311003110131102311033110431105311063110731108311093111031111311123111331114311153111631117311183111931120311213112231123311243112531126311273112831129311303113131132311333113431135311363113731138311393114031141311423114331144311453114631147311483114931150311513115231153311543115531156311573115831159311603116131162311633116431165311663116731168311693117031171311723117331174311753117631177311783117931180311813118231183311843118531186311873118831189311903119131192311933119431195311963119731198311993120031201312023120331204312053120631207312083120931210312113121231213312143121531216312173121831219312203122131222312233122431225312263122731228312293123031231312323123331234312353123631237312383123931240312413124231243312443124531246312473124831249312503125131252312533125431255312563125731258312593126031261312623126331264312653126631267312683126931270312713127231273312743127531276312773127831279312803128131282312833128431285312863128731288312893129031291312923129331294312953129631297312983129931300313013130231303313043130531306313073130831309313103131131312313133131431315313163131731318313193132031321313223132331324313253132631327313283132931330313313133231333313343133531336313373133831339313403134131342313433134431345313463134731348313493135031351313523135331354313553135631357313583135931360313613136231363313643136531366313673136831369313703137131372313733137431375313763137731378313793138031381313823138331384313853138631387313883138931390313913139231393313943139531396313973139831399314003140131402314033140431405314063140731408314093141031411314123141331414314153141631417314183141931420314213142231423314243142531426314273142831429314303143131432314333143431435314363143731438314393144031441314423144331444314453144631447314483144931450314513145231453314543145531456314573145831459314603146131462314633146431465314663146731468314693147031471314723147331474314753147631477314783147931480314813148231483314843148531486314873148831489314903149131492314933149431495314963149731498314993150031501315023150331504315053150631507315083150931510315113151231513315143151531516315173151831519315203152131522315233152431525315263152731528315293153031531315323153331534315353153631537315383153931540315413154231543315443154531546315473154831549315503155131552315533155431555315563155731558315593156031561315623156331564315653156631567315683156931570315713157231573315743157531576315773157831579315803158131582315833158431585315863158731588315893159031591315923159331594315953159631597315983159931600316013160231603316043160531606316073160831609316103161131612316133161431615316163161731618316193162031621316223162331624316253162631627316283162931630316313163231633316343163531636316373163831639316403164131642316433164431645316463164731648316493165031651316523165331654316553165631657316583165931660316613166231663316643166531666316673166831669316703167131672316733167431675316763167731678316793168031681316823168331684316853168631687316883168931690316913169231693316943169531696316973169831699317003170131702317033170431705317063170731708317093171031711317123171331714317153171631717317183171931720317213172231723317243172531726317273172831729317303173131732317333173431735317363173731738317393174031741317423174331744317453174631747317483174931750317513175231753317543175531756317573175831759317603176131762317633176431765317663176731768317693177031771317723177331774317753177631777317783177931780317813178231783317843178531786317873178831789317903179131792317933179431795317963179731798317993180031801318023180331804318053180631807318083180931810318113181231813318143181531816318173181831819318203182131822318233182431825318263182731828318293183031831318323183331834318353183631837318383183931840318413184231843318443184531846318473184831849318503185131852318533185431855318563185731858318593186031861318623186331864318653186631867318683186931870318713187231873318743187531876318773187831879318803188131882318833188431885318863188731888318893189031891318923189331894318953189631897318983189931900319013190231903319043190531906319073190831909319103191131912319133191431915319163191731918319193192031921319223192331924319253192631927319283192931930319313193231933319343193531936319373193831939319403194131942319433194431945319463194731948319493195031951319523195331954319553195631957319583195931960319613196231963319643196531966319673196831969319703197131972319733197431975319763197731978319793198031981319823198331984319853198631987319883198931990319913199231993319943199531996319973199831999320003200132002320033200432005320063200732008320093201032011320123201332014320153201632017320183201932020320213202232023320243202532026320273202832029320303203132032320333203432035320363203732038320393204032041320423204332044320453204632047320483204932050320513205232053320543205532056320573205832059320603206132062320633206432065320663206732068320693207032071320723207332074320753207632077320783207932080320813208232083320843208532086320873208832089320903209132092320933209432095320963209732098320993210032101321023210332104321053210632107321083210932110321113211232113321143211532116321173211832119321203212132122321233212432125321263212732128321293213032131321323213332134321353213632137321383213932140321413214232143321443214532146321473214832149321503215132152321533215432155321563215732158321593216032161321623216332164321653216632167321683216932170321713217232173321743217532176321773217832179321803218132182321833218432185321863218732188321893219032191321923219332194321953219632197321983219932200322013220232203322043220532206322073220832209322103221132212322133221432215322163221732218322193222032221322223222332224322253222632227322283222932230322313223232233322343223532236322373223832239322403224132242322433224432245322463224732248322493225032251322523225332254322553225632257322583225932260322613226232263322643226532266322673226832269322703227132272322733227432275322763227732278322793228032281322823228332284322853228632287322883228932290322913229232293322943229532296322973229832299323003230132302323033230432305323063230732308323093231032311323123231332314323153231632317323183231932320323213232232323323243232532326323273232832329323303233132332323333233432335323363233732338323393234032341323423234332344323453234632347323483234932350323513235232353323543235532356323573235832359323603236132362323633236432365323663236732368323693237032371323723237332374323753237632377323783237932380323813238232383323843238532386323873238832389323903239132392323933239432395323963239732398323993240032401324023240332404324053240632407324083240932410324113241232413324143241532416324173241832419324203242132422324233242432425324263242732428324293243032431324323243332434324353243632437324383243932440324413244232443324443244532446324473244832449324503245132452324533245432455324563245732458324593246032461324623246332464324653246632467324683246932470324713247232473324743247532476324773247832479324803248132482324833248432485324863248732488324893249032491324923249332494324953249632497324983249932500325013250232503325043250532506325073250832509325103251132512325133251432515325163251732518325193252032521325223252332524325253252632527325283252932530325313253232533325343253532536325373253832539325403254132542325433254432545325463254732548325493255032551325523255332554325553255632557325583255932560325613256232563325643256532566325673256832569325703257132572325733257432575325763257732578325793258032581325823258332584325853258632587325883258932590325913259232593325943259532596325973259832599326003260132602326033260432605326063260732608326093261032611326123261332614326153261632617326183261932620326213262232623326243262532626326273262832629326303263132632326333263432635326363263732638326393264032641326423264332644326453264632647326483264932650326513265232653326543265532656326573265832659326603266132662326633266432665326663266732668326693267032671326723267332674326753267632677326783267932680326813268232683326843268532686326873268832689326903269132692326933269432695326963269732698326993270032701327023270332704327053270632707327083270932710327113271232713327143271532716327173271832719327203272132722327233272432725327263272732728327293273032731327323273332734327353273632737327383273932740327413274232743327443274532746327473274832749327503275132752327533275432755327563275732758327593276032761327623276332764327653276632767327683276932770327713277232773327743277532776327773277832779327803278132782327833278432785327863278732788327893279032791327923279332794327953279632797327983279932800328013280232803328043280532806328073280832809328103281132812328133281432815328163281732818328193282032821328223282332824328253282632827328283282932830328313283232833328343283532836328373283832839328403284132842328433284432845328463284732848328493285032851328523285332854328553285632857328583285932860328613286232863328643286532866328673286832869328703287132872328733287432875328763287732878328793288032881328823288332884328853288632887328883288932890328913289232893328943289532896328973289832899329003290132902329033290432905329063290732908329093291032911329123291332914329153291632917329183291932920329213292232923329243292532926329273292832929329303293132932329333293432935329363293732938329393294032941329423294332944329453294632947329483294932950329513295232953329543295532956329573295832959329603296132962329633296432965329663296732968329693297032971329723297332974329753297632977329783297932980329813298232983329843298532986329873298832989329903299132992329933299432995329963299732998329993300033001330023300333004330053300633007330083300933010330113301233013330143301533016330173301833019330203302133022330233302433025330263302733028330293303033031330323303333034330353303633037330383303933040330413304233043330443304533046330473304833049330503305133052330533305433055330563305733058330593306033061330623306333064330653306633067330683306933070330713307233073330743307533076330773307833079330803308133082330833308433085330863308733088330893309033091330923309333094330953309633097330983309933100331013310233103331043310533106331073310833109331103311133112331133311433115331163311733118331193312033121331223312333124331253312633127331283312933130331313313233133331343313533136331373313833139331403314133142331433314433145331463314733148331493315033151331523315333154331553315633157331583315933160331613316233163331643316533166331673316833169331703317133172331733317433175331763317733178331793318033181331823318333184331853318633187331883318933190331913319233193331943319533196331973319833199332003320133202332033320433205332063320733208332093321033211332123321333214332153321633217332183321933220332213322233223332243322533226332273322833229332303323133232332333323433235332363323733238332393324033241332423324333244332453324633247332483324933250332513325233253332543325533256332573325833259332603326133262332633326433265332663326733268332693327033271332723327333274332753327633277332783327933280332813328233283332843328533286332873328833289332903329133292332933329433295332963329733298332993330033301333023330333304333053330633307333083330933310333113331233313333143331533316333173331833319333203332133322333233332433325333263332733328333293333033331333323333333334333353333633337333383333933340333413334233343333443334533346333473334833349333503335133352333533335433355333563335733358333593336033361333623336333364333653336633367333683336933370333713337233373333743337533376333773337833379333803338133382333833338433385333863338733388333893339033391333923339333394333953339633397333983339933400334013340233403334043340533406334073340833409334103341133412334133341433415334163341733418334193342033421334223342333424334253342633427334283342933430334313343233433334343343533436334373343833439334403344133442334433344433445334463344733448334493345033451334523345333454334553345633457334583345933460334613346233463334643346533466334673346833469334703347133472334733347433475334763347733478334793348033481334823348333484334853348633487334883348933490334913349233493334943349533496334973349833499335003350133502335033350433505335063350733508335093351033511335123351333514335153351633517335183351933520335213352233523335243352533526335273352833529335303353133532335333353433535335363353733538335393354033541335423354333544335453354633547335483354933550335513355233553335543355533556335573355833559335603356133562335633356433565335663356733568335693357033571335723357333574335753357633577335783357933580335813358233583335843358533586335873358833589335903359133592335933359433595335963359733598335993360033601336023360333604336053360633607336083360933610336113361233613336143361533616336173361833619336203362133622336233362433625336263362733628336293363033631336323363333634336353363633637336383363933640336413364233643336443364533646336473364833649336503365133652336533365433655336563365733658336593366033661336623366333664336653366633667336683366933670336713367233673336743367533676336773367833679336803368133682336833368433685336863368733688336893369033691336923369333694336953369633697336983369933700337013370233703337043370533706337073370833709337103371133712337133371433715337163371733718337193372033721337223372333724337253372633727337283372933730337313373233733337343373533736337373373833739337403374133742337433374433745337463374733748337493375033751337523375333754337553375633757337583375933760337613376233763337643376533766337673376833769337703377133772337733377433775337763377733778337793378033781337823378333784337853378633787337883378933790337913379233793337943379533796337973379833799338003380133802338033380433805338063380733808338093381033811338123381333814338153381633817338183381933820338213382233823338243382533826338273382833829338303383133832338333383433835338363383733838338393384033841338423384333844338453384633847338483384933850338513385233853338543385533856338573385833859338603386133862338633386433865338663386733868338693387033871338723387333874338753387633877338783387933880338813388233883338843388533886338873388833889338903389133892338933389433895338963389733898338993390033901339023390333904339053390633907339083390933910339113391233913339143391533916339173391833919339203392133922339233392433925339263392733928339293393033931339323393333934339353393633937339383393933940339413394233943339443394533946339473394833949339503395133952339533395433955339563395733958339593396033961339623396333964339653396633967339683396933970339713397233973339743397533976339773397833979339803398133982339833398433985339863398733988339893399033991339923399333994339953399633997339983399934000340013400234003340043400534006340073400834009340103401134012340133401434015340163401734018340193402034021340223402334024340253402634027340283402934030340313403234033340343403534036340373403834039340403404134042340433404434045340463404734048340493405034051340523405334054340553405634057340583405934060340613406234063340643406534066340673406834069340703407134072340733407434075340763407734078340793408034081340823408334084340853408634087340883408934090340913409234093340943409534096340973409834099341003410134102341033410434105341063410734108341093411034111341123411334114341153411634117341183411934120341213412234123341243412534126341273412834129341303413134132341333413434135341363413734138341393414034141341423414334144341453414634147341483414934150341513415234153341543415534156341573415834159341603416134162341633416434165341663416734168341693417034171341723417334174341753417634177341783417934180341813418234183341843418534186341873418834189341903419134192341933419434195341963419734198341993420034201342023420334204342053420634207342083420934210342113421234213342143421534216342173421834219342203422134222342233422434225342263422734228342293423034231342323423334234342353423634237342383423934240342413424234243342443424534246342473424834249342503425134252342533425434255342563425734258342593426034261342623426334264342653426634267342683426934270342713427234273342743427534276342773427834279342803428134282342833428434285342863428734288342893429034291342923429334294342953429634297342983429934300343013430234303343043430534306343073430834309343103431134312343133431434315343163431734318343193432034321343223432334324343253432634327343283432934330343313433234333343343433534336343373433834339343403434134342343433434434345343463434734348343493435034351343523435334354343553435634357343583435934360343613436234363343643436534366343673436834369343703437134372343733437434375343763437734378343793438034381343823438334384343853438634387343883438934390343913439234393343943439534396343973439834399344003440134402344033440434405344063440734408344093441034411344123441334414344153441634417344183441934420344213442234423344243442534426344273442834429344303443134432344333443434435344363443734438344393444034441344423444334444344453444634447344483444934450344513445234453344543445534456344573445834459344603446134462344633446434465344663446734468344693447034471344723447334474344753447634477344783447934480344813448234483344843448534486344873448834489344903449134492344933449434495344963449734498344993450034501345023450334504345053450634507345083450934510345113451234513345143451534516345173451834519345203452134522345233452434525345263452734528345293453034531345323453334534345353453634537345383453934540345413454234543345443454534546345473454834549345503455134552345533455434555345563455734558345593456034561345623456334564345653456634567345683456934570345713457234573345743457534576345773457834579345803458134582345833458434585345863458734588345893459034591345923459334594345953459634597345983459934600346013460234603346043460534606346073460834609346103461134612346133461434615346163461734618346193462034621346223462334624346253462634627346283462934630346313463234633346343463534636346373463834639346403464134642346433464434645346463464734648346493465034651346523465334654346553465634657346583465934660346613466234663346643466534666346673466834669346703467134672346733467434675346763467734678346793468034681346823468334684346853468634687346883468934690346913469234693346943469534696346973469834699347003470134702347033470434705347063470734708347093471034711347123471334714347153471634717347183471934720347213472234723347243472534726347273472834729347303473134732347333473434735347363473734738347393474034741347423474334744347453474634747347483474934750347513475234753347543475534756347573475834759347603476134762347633476434765347663476734768347693477034771347723477334774347753477634777347783477934780347813478234783347843478534786347873478834789347903479134792347933479434795347963479734798347993480034801348023480334804348053480634807348083480934810348113481234813348143481534816348173481834819348203482134822348233482434825348263482734828348293483034831348323483334834348353483634837348383483934840348413484234843348443484534846348473484834849348503485134852348533485434855348563485734858348593486034861348623486334864348653486634867348683486934870348713487234873348743487534876348773487834879348803488134882348833488434885348863488734888348893489034891348923489334894348953489634897348983489934900349013490234903349043490534906349073490834909349103491134912349133491434915349163491734918349193492034921349223492334924349253492634927349283492934930349313493234933349343493534936349373493834939349403494134942349433494434945349463494734948349493495034951349523495334954349553495634957349583495934960349613496234963349643496534966349673496834969349703497134972349733497434975349763497734978349793498034981349823498334984349853498634987349883498934990349913499234993349943499534996349973499834999350003500135002350033500435005350063500735008350093501035011350123501335014350153501635017350183501935020350213502235023350243502535026350273502835029350303503135032350333503435035350363503735038350393504035041350423504335044350453504635047350483504935050350513505235053350543505535056350573505835059350603506135062350633506435065350663506735068350693507035071350723507335074350753507635077350783507935080350813508235083350843508535086350873508835089350903509135092350933509435095350963509735098350993510035101351023510335104351053510635107351083510935110351113511235113351143511535116351173511835119351203512135122351233512435125351263512735128351293513035131351323513335134351353513635137351383513935140351413514235143351443514535146351473514835149351503515135152351533515435155351563515735158351593516035161351623516335164351653516635167351683516935170351713517235173351743517535176351773517835179351803518135182351833518435185351863518735188351893519035191351923519335194351953519635197351983519935200352013520235203352043520535206352073520835209352103521135212352133521435215352163521735218352193522035221352223522335224352253522635227352283522935230352313523235233352343523535236352373523835239352403524135242352433524435245352463524735248352493525035251352523525335254352553525635257352583525935260352613526235263352643526535266352673526835269352703527135272352733527435275352763527735278352793528035281352823528335284352853528635287352883528935290352913529235293352943529535296352973529835299353003530135302353033530435305353063530735308353093531035311353123531335314353153531635317353183531935320353213532235323353243532535326353273532835329353303533135332353333533435335353363533735338353393534035341353423534335344353453534635347353483534935350353513535235353353543535535356353573535835359353603536135362353633536435365353663536735368353693537035371353723537335374353753537635377353783537935380353813538235383353843538535386353873538835389353903539135392353933539435395353963539735398353993540035401354023540335404354053540635407354083540935410354113541235413354143541535416354173541835419354203542135422354233542435425354263542735428354293543035431354323543335434354353543635437354383543935440354413544235443354443544535446354473544835449354503545135452354533545435455354563545735458354593546035461354623546335464354653546635467354683546935470354713547235473354743547535476354773547835479354803548135482354833548435485354863548735488354893549035491354923549335494354953549635497354983549935500355013550235503355043550535506355073550835509355103551135512355133551435515355163551735518355193552035521355223552335524355253552635527355283552935530355313553235533355343553535536355373553835539355403554135542355433554435545355463554735548355493555035551355523555335554355553555635557355583555935560355613556235563355643556535566355673556835569355703557135572355733557435575355763557735578355793558035581355823558335584355853558635587355883558935590355913559235593355943559535596355973559835599356003560135602356033560435605356063560735608356093561035611356123561335614356153561635617356183561935620356213562235623356243562535626356273562835629356303563135632356333563435635356363563735638356393564035641356423564335644356453564635647356483564935650356513565235653356543565535656356573565835659356603566135662356633566435665356663566735668356693567035671356723567335674356753567635677356783567935680356813568235683356843568535686356873568835689356903569135692356933569435695356963569735698356993570035701357023570335704357053570635707357083570935710357113571235713357143571535716357173571835719357203572135722357233572435725357263572735728357293573035731357323573335734357353573635737357383573935740357413574235743357443574535746357473574835749357503575135752357533575435755357563575735758357593576035761357623576335764357653576635767357683576935770357713577235773357743577535776357773577835779357803578135782357833578435785357863578735788357893579035791357923579335794357953579635797357983579935800358013580235803358043580535806358073580835809358103581135812358133581435815358163581735818358193582035821358223582335824358253582635827358283582935830358313583235833358343583535836358373583835839358403584135842358433584435845358463584735848358493585035851358523585335854358553585635857358583585935860358613586235863358643586535866358673586835869358703587135872358733587435875358763587735878358793588035881358823588335884358853588635887358883588935890358913589235893358943589535896358973589835899359003590135902359033590435905359063590735908359093591035911359123591335914359153591635917359183591935920359213592235923359243592535926359273592835929359303593135932359333593435935359363593735938359393594035941359423594335944359453594635947359483594935950359513595235953359543595535956359573595835959359603596135962359633596435965359663596735968359693597035971359723597335974359753597635977359783597935980359813598235983359843598535986359873598835989359903599135992359933599435995359963599735998359993600036001360023600336004360053600636007360083600936010360113601236013360143601536016360173601836019360203602136022360233602436025360263602736028360293603036031360323603336034360353603636037360383603936040360413604236043360443604536046360473604836049360503605136052360533605436055360563605736058360593606036061360623606336064360653606636067360683606936070360713607236073360743607536076360773607836079360803608136082360833608436085360863608736088360893609036091360923609336094360953609636097360983609936100361013610236103361043610536106361073610836109361103611136112361133611436115361163611736118361193612036121361223612336124361253612636127361283612936130361313613236133361343613536136361373613836139361403614136142361433614436145361463614736148361493615036151361523615336154361553615636157361583615936160361613616236163361643616536166361673616836169361703617136172361733617436175361763617736178361793618036181361823618336184361853618636187361883618936190361913619236193361943619536196361973619836199362003620136202362033620436205362063620736208362093621036211362123621336214362153621636217362183621936220362213622236223362243622536226362273622836229362303623136232362333623436235362363623736238362393624036241362423624336244362453624636247362483624936250362513625236253362543625536256362573625836259362603626136262362633626436265362663626736268362693627036271362723627336274362753627636277362783627936280362813628236283362843628536286362873628836289362903629136292362933629436295362963629736298362993630036301363023630336304363053630636307363083630936310363113631236313363143631536316363173631836319363203632136322363233632436325363263632736328363293633036331363323633336334363353633636337363383633936340363413634236343363443634536346363473634836349363503635136352363533635436355363563635736358363593636036361363623636336364363653636636367363683636936370363713637236373363743637536376363773637836379363803638136382363833638436385363863638736388363893639036391363923639336394363953639636397363983639936400364013640236403364043640536406364073640836409364103641136412364133641436415364163641736418364193642036421364223642336424364253642636427364283642936430364313643236433364343643536436364373643836439364403644136442364433644436445364463644736448364493645036451364523645336454364553645636457364583645936460364613646236463364643646536466364673646836469364703647136472364733647436475364763647736478364793648036481364823648336484364853648636487364883648936490364913649236493364943649536496364973649836499365003650136502365033650436505365063650736508365093651036511365123651336514365153651636517365183651936520365213652236523365243652536526365273652836529365303653136532365333653436535365363653736538365393654036541365423654336544365453654636547365483654936550365513655236553365543655536556365573655836559365603656136562365633656436565365663656736568365693657036571365723657336574365753657636577365783657936580365813658236583365843658536586365873658836589365903659136592365933659436595365963659736598365993660036601366023660336604366053660636607366083660936610366113661236613366143661536616366173661836619366203662136622366233662436625366263662736628366293663036631366323663336634366353663636637366383663936640366413664236643366443664536646366473664836649366503665136652366533665436655366563665736658366593666036661366623666336664366653666636667366683666936670366713667236673366743667536676366773667836679366803668136682366833668436685366863668736688366893669036691366923669336694366953669636697366983669936700367013670236703367043670536706367073670836709367103671136712367133671436715367163671736718367193672036721367223672336724367253672636727367283672936730367313673236733367343673536736367373673836739367403674136742367433674436745367463674736748367493675036751367523675336754367553675636757367583675936760367613676236763367643676536766367673676836769367703677136772367733677436775367763677736778367793678036781367823678336784367853678636787367883678936790367913679236793367943679536796367973679836799368003680136802368033680436805368063680736808368093681036811368123681336814368153681636817368183681936820368213682236823368243682536826368273682836829368303683136832368333683436835368363683736838368393684036841368423684336844368453684636847368483684936850368513685236853368543685536856368573685836859368603686136862368633686436865368663686736868368693687036871368723687336874368753687636877368783687936880368813688236883368843688536886368873688836889368903689136892368933689436895368963689736898368993690036901369023690336904369053690636907369083690936910369113691236913369143691536916369173691836919369203692136922369233692436925369263692736928369293693036931369323693336934369353693636937369383693936940369413694236943369443694536946369473694836949369503695136952369533695436955369563695736958369593696036961369623696336964369653696636967369683696936970369713697236973369743697536976369773697836979369803698136982369833698436985369863698736988369893699036991369923699336994369953699636997369983699937000370013700237003370043700537006370073700837009370103701137012370133701437015370163701737018370193702037021370223702337024370253702637027370283702937030370313703237033370343703537036370373703837039370403704137042370433704437045370463704737048370493705037051370523705337054370553705637057370583705937060370613706237063370643706537066370673706837069370703707137072370733707437075370763707737078370793708037081370823708337084370853708637087370883708937090370913709237093370943709537096370973709837099371003710137102371033710437105371063710737108371093711037111371123711337114371153711637117371183711937120371213712237123371243712537126371273712837129371303713137132371333713437135371363713737138371393714037141371423714337144371453714637147371483714937150371513715237153371543715537156371573715837159371603716137162371633716437165371663716737168371693717037171371723717337174371753717637177371783717937180371813718237183371843718537186371873718837189371903719137192371933719437195371963719737198371993720037201372023720337204372053720637207372083720937210372113721237213372143721537216372173721837219372203722137222372233722437225372263722737228372293723037231372323723337234372353723637237372383723937240372413724237243372443724537246372473724837249372503725137252372533725437255372563725737258372593726037261372623726337264372653726637267372683726937270372713727237273372743727537276372773727837279372803728137282372833728437285372863728737288372893729037291372923729337294372953729637297372983729937300373013730237303373043730537306373073730837309373103731137312373133731437315373163731737318373193732037321373223732337324373253732637327373283732937330373313733237333373343733537336373373733837339373403734137342373433734437345373463734737348373493735037351373523735337354373553735637357373583735937360373613736237363373643736537366373673736837369373703737137372373733737437375373763737737378373793738037381373823738337384373853738637387373883738937390373913739237393373943739537396373973739837399374003740137402374033740437405374063740737408374093741037411374123741337414374153741637417374183741937420374213742237423374243742537426374273742837429374303743137432374333743437435374363743737438374393744037441374423744337444374453744637447374483744937450374513745237453374543745537456374573745837459374603746137462374633746437465374663746737468374693747037471374723747337474374753747637477374783747937480374813748237483374843748537486374873748837489374903749137492374933749437495374963749737498374993750037501375023750337504375053750637507375083750937510375113751237513375143751537516375173751837519375203752137522375233752437525375263752737528375293753037531375323753337534375353753637537375383753937540375413754237543375443754537546375473754837549375503755137552375533755437555375563755737558375593756037561375623756337564375653756637567375683756937570375713757237573375743757537576375773757837579375803758137582375833758437585375863758737588375893759037591375923759337594375953759637597375983759937600376013760237603376043760537606376073760837609376103761137612376133761437615376163761737618376193762037621376223762337624376253762637627376283762937630376313763237633376343763537636376373763837639376403764137642376433764437645376463764737648376493765037651376523765337654376553765637657376583765937660376613766237663376643766537666376673766837669376703767137672376733767437675376763767737678376793768037681376823768337684376853768637687376883768937690376913769237693376943769537696376973769837699377003770137702377033770437705377063770737708377093771037711377123771337714377153771637717377183771937720377213772237723377243772537726377273772837729377303773137732377333773437735377363773737738377393774037741377423774337744377453774637747377483774937750377513775237753377543775537756377573775837759377603776137762377633776437765377663776737768377693777037771377723777337774377753777637777377783777937780377813778237783377843778537786377873778837789377903779137792377933779437795377963779737798377993780037801378023780337804378053780637807378083780937810378113781237813378143781537816378173781837819378203782137822378233782437825378263782737828378293783037831378323783337834378353783637837378383783937840378413784237843378443784537846378473784837849378503785137852378533785437855378563785737858378593786037861378623786337864378653786637867378683786937870378713787237873378743787537876378773787837879378803788137882378833788437885378863788737888378893789037891378923789337894378953789637897378983789937900379013790237903379043790537906379073790837909379103791137912379133791437915379163791737918379193792037921379223792337924379253792637927379283792937930379313793237933379343793537936379373793837939379403794137942379433794437945379463794737948379493795037951379523795337954379553795637957379583795937960379613796237963379643796537966379673796837969379703797137972379733797437975379763797737978379793798037981379823798337984379853798637987379883798937990379913799237993379943799537996379973799837999380003800138002380033800438005380063800738008380093801038011380123801338014380153801638017380183801938020380213802238023380243802538026380273802838029380303803138032380333803438035380363803738038380393804038041380423804338044380453804638047380483804938050380513805238053380543805538056380573805838059380603806138062380633806438065380663806738068380693807038071380723807338074380753807638077380783807938080380813808238083380843808538086380873808838089380903809138092380933809438095380963809738098380993810038101381023810338104381053810638107381083810938110381113811238113381143811538116381173811838119381203812138122381233812438125381263812738128381293813038131381323813338134381353813638137381383813938140381413814238143381443814538146381473814838149381503815138152381533815438155381563815738158381593816038161381623816338164381653816638167381683816938170381713817238173381743817538176381773817838179381803818138182381833818438185381863818738188381893819038191381923819338194381953819638197381983819938200382013820238203382043820538206382073820838209382103821138212382133821438215382163821738218382193822038221382223822338224382253822638227382283822938230382313823238233382343823538236382373823838239382403824138242382433824438245382463824738248382493825038251382523825338254382553825638257382583825938260382613826238263382643826538266382673826838269382703827138272382733827438275382763827738278382793828038281382823828338284382853828638287382883828938290382913829238293382943829538296382973829838299383003830138302383033830438305383063830738308383093831038311383123831338314383153831638317383183831938320383213832238323383243832538326383273832838329383303833138332383333833438335383363833738338383393834038341383423834338344383453834638347383483834938350383513835238353383543835538356383573835838359383603836138362383633836438365383663836738368383693837038371383723837338374383753837638377383783837938380383813838238383383843838538386383873838838389383903839138392383933839438395383963839738398383993840038401384023840338404384053840638407384083840938410384113841238413384143841538416384173841838419384203842138422384233842438425384263842738428384293843038431384323843338434384353843638437384383843938440384413844238443384443844538446384473844838449384503845138452384533845438455384563845738458384593846038461384623846338464384653846638467384683846938470384713847238473384743847538476384773847838479384803848138482384833848438485384863848738488384893849038491384923849338494384953849638497384983849938500385013850238503385043850538506385073850838509385103851138512385133851438515385163851738518385193852038521385223852338524385253852638527385283852938530385313853238533385343853538536385373853838539385403854138542385433854438545385463854738548385493855038551385523855338554385553855638557385583855938560385613856238563385643856538566385673856838569385703857138572385733857438575385763857738578385793858038581385823858338584385853858638587385883858938590385913859238593385943859538596385973859838599386003860138602386033860438605386063860738608386093861038611386123861338614386153861638617386183861938620386213862238623386243862538626386273862838629386303863138632386333863438635386363863738638386393864038641386423864338644386453864638647386483864938650386513865238653386543865538656386573865838659386603866138662386633866438665386663866738668386693867038671386723867338674386753867638677386783867938680386813868238683386843868538686386873868838689386903869138692386933869438695386963869738698386993870038701387023870338704387053870638707387083870938710387113871238713387143871538716387173871838719387203872138722387233872438725387263872738728387293873038731387323873338734387353873638737387383873938740387413874238743387443874538746387473874838749387503875138752387533875438755387563875738758387593876038761387623876338764387653876638767387683876938770387713877238773387743877538776387773877838779387803878138782387833878438785387863878738788387893879038791387923879338794387953879638797387983879938800388013880238803388043880538806388073880838809388103881138812388133881438815388163881738818388193882038821388223882338824388253882638827388283882938830388313883238833388343883538836388373883838839388403884138842388433884438845388463884738848388493885038851388523885338854388553885638857388583885938860388613886238863388643886538866388673886838869388703887138872388733887438875388763887738878388793888038881388823888338884388853888638887388883888938890388913889238893388943889538896388973889838899389003890138902389033890438905389063890738908389093891038911389123891338914389153891638917389183891938920389213892238923389243892538926389273892838929389303893138932389333893438935389363893738938389393894038941389423894338944389453894638947389483894938950389513895238953389543895538956389573895838959389603896138962389633896438965389663896738968389693897038971389723897338974389753897638977389783897938980389813898238983389843898538986389873898838989389903899138992389933899438995389963899738998389993900039001390023900339004390053900639007390083900939010390113901239013390143901539016390173901839019390203902139022390233902439025390263902739028390293903039031390323903339034390353903639037390383903939040390413904239043390443904539046390473904839049390503905139052390533905439055390563905739058390593906039061390623906339064390653906639067390683906939070390713907239073390743907539076390773907839079390803908139082390833908439085390863908739088390893909039091390923909339094390953909639097390983909939100391013910239103391043910539106391073910839109391103911139112391133911439115391163911739118391193912039121391223912339124391253912639127391283912939130391313913239133391343913539136391373913839139391403914139142391433914439145391463914739148391493915039151391523915339154391553915639157391583915939160391613916239163391643916539166391673916839169391703917139172391733917439175391763917739178391793918039181391823918339184391853918639187391883918939190391913919239193391943919539196391973919839199392003920139202392033920439205392063920739208392093921039211392123921339214392153921639217392183921939220392213922239223392243922539226392273922839229392303923139232392333923439235392363923739238392393924039241392423924339244392453924639247392483924939250392513925239253392543925539256392573925839259392603926139262392633926439265392663926739268392693927039271392723927339274392753927639277392783927939280392813928239283392843928539286392873928839289392903929139292392933929439295392963929739298392993930039301393023930339304393053930639307393083930939310393113931239313393143931539316393173931839319393203932139322393233932439325393263932739328393293933039331393323933339334393353933639337393383933939340393413934239343393443934539346393473934839349393503935139352393533935439355393563935739358393593936039361393623936339364393653936639367393683936939370393713937239373393743937539376393773937839379393803938139382393833938439385393863938739388393893939039391393923939339394393953939639397393983939939400394013940239403394043940539406394073940839409394103941139412394133941439415394163941739418394193942039421394223942339424394253942639427394283942939430394313943239433394343943539436394373943839439394403944139442394433944439445394463944739448394493945039451394523945339454394553945639457394583945939460394613946239463394643946539466394673946839469394703947139472394733947439475394763947739478394793948039481394823948339484394853948639487394883948939490394913949239493394943949539496394973949839499395003950139502395033950439505395063950739508395093951039511395123951339514395153951639517395183951939520395213952239523395243952539526395273952839529395303953139532395333953439535395363953739538395393954039541395423954339544395453954639547395483954939550395513955239553395543955539556395573955839559395603956139562395633956439565395663956739568395693957039571395723957339574395753957639577395783957939580395813958239583395843958539586395873958839589395903959139592395933959439595395963959739598395993960039601396023960339604396053960639607396083960939610396113961239613396143961539616396173961839619396203962139622396233962439625396263962739628396293963039631396323963339634396353963639637396383963939640396413964239643396443964539646396473964839649396503965139652396533965439655396563965739658396593966039661396623966339664396653966639667396683966939670396713967239673396743967539676396773967839679396803968139682396833968439685396863968739688396893969039691396923969339694396953969639697396983969939700397013970239703397043970539706397073970839709397103971139712397133971439715397163971739718397193972039721397223972339724397253972639727397283972939730397313973239733397343973539736397373973839739397403974139742397433974439745397463974739748397493975039751397523975339754397553975639757397583975939760397613976239763397643976539766397673976839769397703977139772397733977439775397763977739778397793978039781397823978339784397853978639787397883978939790397913979239793397943979539796397973979839799398003980139802398033980439805398063980739808398093981039811398123981339814398153981639817398183981939820398213982239823398243982539826398273982839829398303983139832398333983439835398363983739838398393984039841398423984339844398453984639847398483984939850398513985239853398543985539856398573985839859398603986139862398633986439865398663986739868398693987039871398723987339874398753987639877398783987939880398813988239883398843988539886398873988839889398903989139892398933989439895398963989739898398993990039901399023990339904399053990639907399083990939910399113991239913399143991539916399173991839919399203992139922399233992439925399263992739928399293993039931399323993339934399353993639937399383993939940399413994239943399443994539946399473994839949399503995139952399533995439955399563995739958399593996039961399623996339964399653996639967399683996939970399713997239973399743997539976399773997839979399803998139982399833998439985399863998739988399893999039991399923999339994399953999639997399983999940000400014000240003400044000540006400074000840009400104001140012400134001440015400164001740018400194002040021400224002340024400254002640027400284002940030400314003240033400344003540036400374003840039400404004140042400434004440045400464004740048400494005040051400524005340054400554005640057400584005940060400614006240063400644006540066400674006840069400704007140072400734007440075400764007740078400794008040081400824008340084400854008640087400884008940090400914009240093400944009540096400974009840099401004010140102401034010440105401064010740108401094011040111401124011340114401154011640117401184011940120401214012240123401244012540126401274012840129401304013140132401334013440135401364013740138401394014040141401424014340144401454014640147401484014940150401514015240153401544015540156401574015840159401604016140162401634016440165401664016740168401694017040171401724017340174401754017640177401784017940180401814018240183401844018540186401874018840189401904019140192401934019440195401964019740198401994020040201402024020340204402054020640207402084020940210402114021240213402144021540216402174021840219402204022140222402234022440225402264022740228402294023040231402324023340234402354023640237402384023940240402414024240243402444024540246402474024840249402504025140252402534025440255402564025740258402594026040261402624026340264402654026640267402684026940270402714027240273402744027540276402774027840279402804028140282402834028440285402864028740288402894029040291402924029340294402954029640297402984029940300403014030240303403044030540306403074030840309403104031140312403134031440315403164031740318403194032040321403224032340324403254032640327403284032940330403314033240333403344033540336403374033840339403404034140342403434034440345403464034740348403494035040351403524035340354403554035640357403584035940360403614036240363403644036540366403674036840369403704037140372403734037440375403764037740378403794038040381403824038340384403854038640387403884038940390403914039240393403944039540396403974039840399404004040140402404034040440405404064040740408404094041040411404124041340414404154041640417404184041940420404214042240423404244042540426404274042840429404304043140432404334043440435404364043740438404394044040441404424044340444404454044640447404484044940450404514045240453404544045540456404574045840459404604046140462404634046440465404664046740468404694047040471404724047340474404754047640477404784047940480404814048240483404844048540486404874048840489404904049140492404934049440495404964049740498404994050040501405024050340504405054050640507405084050940510405114051240513405144051540516405174051840519405204052140522405234052440525405264052740528405294053040531405324053340534405354053640537405384053940540405414054240543405444054540546405474054840549405504055140552405534055440555405564055740558405594056040561405624056340564405654056640567405684056940570405714057240573405744057540576405774057840579405804058140582405834058440585405864058740588405894059040591405924059340594405954059640597405984059940600406014060240603406044060540606406074060840609406104061140612406134061440615406164061740618406194062040621406224062340624406254062640627406284062940630406314063240633406344063540636406374063840639406404064140642406434064440645406464064740648406494065040651406524065340654406554065640657406584065940660406614066240663406644066540666406674066840669406704067140672406734067440675406764067740678406794068040681406824068340684406854068640687406884068940690406914069240693406944069540696406974069840699407004070140702407034070440705407064070740708407094071040711407124071340714407154071640717407184071940720407214072240723407244072540726407274072840729407304073140732407334073440735407364073740738407394074040741407424074340744407454074640747407484074940750407514075240753407544075540756407574075840759407604076140762407634076440765407664076740768407694077040771407724077340774407754077640777407784077940780407814078240783407844078540786407874078840789407904079140792407934079440795407964079740798407994080040801408024080340804408054080640807408084080940810408114081240813408144081540816408174081840819408204082140822408234082440825408264082740828408294083040831408324083340834408354083640837408384083940840408414084240843408444084540846408474084840849408504085140852408534085440855408564085740858408594086040861408624086340864408654086640867408684086940870408714087240873408744087540876408774087840879408804088140882408834088440885408864088740888408894089040891408924089340894408954089640897408984089940900409014090240903409044090540906409074090840909409104091140912409134091440915409164091740918409194092040921409224092340924409254092640927409284092940930409314093240933409344093540936409374093840939409404094140942409434094440945409464094740948409494095040951409524095340954409554095640957409584095940960409614096240963409644096540966409674096840969409704097140972409734097440975409764097740978409794098040981409824098340984409854098640987409884098940990409914099240993409944099540996409974099840999410004100141002410034100441005410064100741008410094101041011410124101341014410154101641017410184101941020410214102241023410244102541026410274102841029410304103141032410334103441035410364103741038410394104041041410424104341044410454104641047410484104941050410514105241053410544105541056410574105841059410604106141062410634106441065410664106741068410694107041071410724107341074410754107641077410784107941080410814108241083410844108541086410874108841089410904109141092410934109441095410964109741098410994110041101411024110341104411054110641107411084110941110411114111241113411144111541116411174111841119411204112141122411234112441125411264112741128411294113041131411324113341134411354113641137411384113941140411414114241143411444114541146411474114841149411504115141152411534115441155411564115741158411594116041161411624116341164411654116641167411684116941170411714117241173411744117541176411774117841179411804118141182411834118441185411864118741188411894119041191411924119341194411954119641197411984119941200412014120241203412044120541206412074120841209412104121141212412134121441215412164121741218412194122041221412224122341224412254122641227412284122941230412314123241233412344123541236412374123841239412404124141242412434124441245412464124741248412494125041251412524125341254412554125641257412584125941260412614126241263412644126541266412674126841269412704127141272412734127441275412764127741278412794128041281412824128341284412854128641287412884128941290412914129241293412944129541296412974129841299413004130141302413034130441305413064130741308413094131041311413124131341314413154131641317413184131941320413214132241323413244132541326413274132841329413304133141332413334133441335413364133741338413394134041341413424134341344413454134641347413484134941350413514135241353413544135541356413574135841359413604136141362413634136441365413664136741368413694137041371413724137341374413754137641377413784137941380413814138241383413844138541386413874138841389413904139141392413934139441395413964139741398413994140041401414024140341404414054140641407414084140941410414114141241413414144141541416414174141841419414204142141422414234142441425414264142741428414294143041431414324143341434414354143641437414384143941440414414144241443414444144541446414474144841449414504145141452414534145441455414564145741458414594146041461414624146341464414654146641467414684146941470414714147241473414744147541476414774147841479414804148141482414834148441485414864148741488414894149041491414924149341494414954149641497414984149941500415014150241503415044150541506415074150841509415104151141512415134151441515415164151741518415194152041521415224152341524415254152641527415284152941530415314153241533415344153541536415374153841539415404154141542415434154441545415464154741548415494155041551415524155341554415554155641557415584155941560415614156241563415644156541566415674156841569415704157141572415734157441575415764157741578415794158041581415824158341584415854158641587415884158941590415914159241593415944159541596415974159841599416004160141602416034160441605416064160741608416094161041611416124161341614416154161641617416184161941620416214162241623416244162541626416274162841629416304163141632416334163441635416364163741638416394164041641416424164341644416454164641647416484164941650416514165241653416544165541656416574165841659416604166141662416634166441665416664166741668416694167041671416724167341674416754167641677416784167941680416814168241683416844168541686416874168841689416904169141692416934169441695416964169741698416994170041701417024170341704417054170641707417084170941710417114171241713417144171541716417174171841719417204172141722417234172441725417264172741728417294173041731417324173341734417354173641737417384173941740417414174241743417444174541746417474174841749417504175141752417534175441755417564175741758417594176041761417624176341764417654176641767417684176941770417714177241773417744177541776417774177841779417804178141782417834178441785417864178741788417894179041791417924179341794417954179641797417984179941800418014180241803418044180541806418074180841809418104181141812418134181441815418164181741818418194182041821418224182341824418254182641827418284182941830418314183241833418344183541836418374183841839418404184141842418434184441845418464184741848418494185041851418524185341854418554185641857418584185941860418614186241863418644186541866418674186841869418704187141872418734187441875418764187741878418794188041881418824188341884418854188641887418884188941890418914189241893418944189541896418974189841899419004190141902419034190441905419064190741908419094191041911419124191341914419154191641917419184191941920419214192241923419244192541926419274192841929419304193141932419334193441935419364193741938419394194041941419424194341944419454194641947419484194941950419514195241953419544195541956419574195841959419604196141962419634196441965419664196741968419694197041971419724197341974419754197641977419784197941980419814198241983419844198541986419874198841989419904199141992419934199441995419964199741998419994200042001420024200342004420054200642007420084200942010420114201242013420144201542016420174201842019420204202142022420234202442025420264202742028420294203042031420324203342034420354203642037420384203942040420414204242043420444204542046420474204842049420504205142052420534205442055420564205742058420594206042061420624206342064420654206642067420684206942070420714207242073420744207542076420774207842079420804208142082420834208442085420864208742088420894209042091420924209342094420954209642097420984209942100421014210242103421044210542106421074210842109421104211142112421134211442115421164211742118421194212042121421224212342124421254212642127421284212942130421314213242133421344213542136421374213842139421404214142142421434214442145421464214742148421494215042151421524215342154421554215642157421584215942160421614216242163421644216542166421674216842169421704217142172421734217442175421764217742178421794218042181421824218342184421854218642187421884218942190421914219242193421944219542196421974219842199422004220142202422034220442205422064220742208422094221042211422124221342214422154221642217422184221942220422214222242223422244222542226422274222842229422304223142232422334223442235422364223742238422394224042241422424224342244422454224642247422484224942250422514225242253422544225542256422574225842259422604226142262422634226442265422664226742268422694227042271422724227342274422754227642277422784227942280422814228242283422844228542286422874228842289422904229142292422934229442295422964229742298422994230042301423024230342304423054230642307423084230942310423114231242313423144231542316423174231842319423204232142322423234232442325423264232742328423294233042331423324233342334423354233642337423384233942340423414234242343423444234542346423474234842349423504235142352423534235442355423564235742358423594236042361423624236342364423654236642367423684236942370423714237242373423744237542376423774237842379423804238142382423834238442385423864238742388423894239042391423924239342394423954239642397423984239942400424014240242403424044240542406424074240842409424104241142412424134241442415424164241742418424194242042421424224242342424424254242642427424284242942430424314243242433424344243542436424374243842439424404244142442424434244442445424464244742448424494245042451424524245342454424554245642457424584245942460424614246242463424644246542466424674246842469424704247142472424734247442475424764247742478424794248042481424824248342484424854248642487424884248942490424914249242493424944249542496424974249842499425004250142502425034250442505425064250742508425094251042511425124251342514425154251642517425184251942520425214252242523425244252542526425274252842529425304253142532425334253442535425364253742538425394254042541425424254342544425454254642547425484254942550425514255242553425544255542556425574255842559425604256142562425634256442565425664256742568425694257042571425724257342574425754257642577425784257942580425814258242583425844258542586425874258842589425904259142592425934259442595425964259742598425994260042601426024260342604426054260642607426084260942610426114261242613426144261542616426174261842619426204262142622426234262442625426264262742628426294263042631426324263342634426354263642637426384263942640426414264242643426444264542646426474264842649426504265142652426534265442655426564265742658426594266042661426624266342664426654266642667426684266942670426714267242673426744267542676426774267842679426804268142682426834268442685426864268742688426894269042691426924269342694426954269642697426984269942700427014270242703427044270542706427074270842709427104271142712427134271442715427164271742718427194272042721427224272342724427254272642727427284272942730427314273242733427344273542736427374273842739427404274142742427434274442745427464274742748427494275042751427524275342754427554275642757427584275942760427614276242763427644276542766427674276842769427704277142772427734277442775427764277742778427794278042781427824278342784427854278642787427884278942790427914279242793427944279542796427974279842799428004280142802428034280442805428064280742808428094281042811428124281342814428154281642817428184281942820428214282242823428244282542826428274282842829428304283142832428334283442835428364283742838428394284042841428424284342844428454284642847428484284942850428514285242853428544285542856428574285842859428604286142862428634286442865428664286742868428694287042871428724287342874428754287642877428784287942880428814288242883428844288542886428874288842889428904289142892428934289442895428964289742898428994290042901429024290342904429054290642907429084290942910429114291242913429144291542916429174291842919429204292142922429234292442925429264292742928429294293042931429324293342934429354293642937429384293942940429414294242943429444294542946429474294842949429504295142952429534295442955429564295742958429594296042961429624296342964429654296642967429684296942970429714297242973429744297542976429774297842979429804298142982429834298442985429864298742988429894299042991429924299342994429954299642997429984299943000430014300243003430044300543006430074300843009430104301143012430134301443015430164301743018430194302043021430224302343024430254302643027430284302943030430314303243033430344303543036430374303843039430404304143042430434304443045430464304743048430494305043051430524305343054430554305643057430584305943060430614306243063430644306543066430674306843069430704307143072430734307443075430764307743078430794308043081430824308343084430854308643087430884308943090430914309243093430944309543096430974309843099431004310143102431034310443105431064310743108431094311043111431124311343114431154311643117431184311943120431214312243123431244312543126431274312843129431304313143132431334313443135431364313743138431394314043141431424314343144431454314643147431484314943150431514315243153431544315543156431574315843159431604316143162431634316443165431664316743168431694317043171431724317343174431754317643177431784317943180431814318243183431844318543186431874318843189431904319143192431934319443195431964319743198431994320043201432024320343204432054320643207432084320943210432114321243213432144321543216432174321843219432204322143222432234322443225432264322743228432294323043231432324323343234432354323643237432384323943240432414324243243432444324543246432474324843249432504325143252432534325443255432564325743258432594326043261432624326343264432654326643267432684326943270432714327243273432744327543276432774327843279432804328143282432834328443285432864328743288432894329043291432924329343294432954329643297432984329943300433014330243303433044330543306433074330843309433104331143312433134331443315433164331743318433194332043321433224332343324433254332643327433284332943330433314333243333433344333543336433374333843339433404334143342433434334443345433464334743348433494335043351433524335343354433554335643357433584335943360433614336243363433644336543366433674336843369433704337143372433734337443375433764337743378433794338043381433824338343384433854338643387433884338943390433914339243393433944339543396433974339843399434004340143402434034340443405434064340743408434094341043411434124341343414434154341643417434184341943420434214342243423434244342543426434274342843429434304343143432434334343443435434364343743438434394344043441434424344343444434454344643447434484344943450434514345243453434544345543456434574345843459434604346143462434634346443465434664346743468434694347043471434724347343474434754347643477434784347943480434814348243483434844348543486434874348843489434904349143492434934349443495434964349743498434994350043501435024350343504435054350643507435084350943510435114351243513435144351543516435174351843519435204352143522435234352443525435264352743528435294353043531435324353343534435354353643537435384353943540435414354243543435444354543546435474354843549435504355143552435534355443555435564355743558435594356043561435624356343564435654356643567435684356943570435714357243573435744357543576435774357843579435804358143582435834358443585435864358743588435894359043591435924359343594435954359643597435984359943600436014360243603436044360543606436074360843609436104361143612436134361443615436164361743618436194362043621436224362343624436254362643627436284362943630436314363243633436344363543636436374363843639436404364143642436434364443645436464364743648436494365043651436524365343654436554365643657436584365943660436614366243663436644366543666436674366843669436704367143672436734367443675436764367743678436794368043681436824368343684436854368643687436884368943690436914369243693436944369543696436974369843699437004370143702437034370443705437064370743708437094371043711437124371343714437154371643717437184371943720437214372243723437244372543726437274372843729437304373143732437334373443735437364373743738437394374043741437424374343744437454374643747437484374943750437514375243753437544375543756437574375843759437604376143762437634376443765437664376743768437694377043771437724377343774437754377643777437784377943780437814378243783437844378543786437874378843789437904379143792437934379443795437964379743798437994380043801438024380343804438054380643807438084380943810438114381243813438144381543816438174381843819438204382143822438234382443825438264382743828438294383043831438324383343834438354383643837438384383943840438414384243843438444384543846438474384843849438504385143852438534385443855438564385743858438594386043861438624386343864438654386643867438684386943870438714387243873438744387543876438774387843879438804388143882438834388443885438864388743888438894389043891438924389343894438954389643897438984389943900439014390243903439044390543906439074390843909439104391143912439134391443915439164391743918439194392043921439224392343924439254392643927439284392943930439314393243933439344393543936439374393843939439404394143942439434394443945439464394743948439494395043951439524395343954439554395643957439584395943960439614396243963439644396543966439674396843969439704397143972439734397443975439764397743978439794398043981439824398343984439854398643987439884398943990439914399243993439944399543996439974399843999440004400144002440034400444005440064400744008440094401044011440124401344014440154401644017440184401944020440214402244023440244402544026440274402844029440304403144032440334403444035440364403744038440394404044041440424404344044440454404644047440484404944050440514405244053440544405544056440574405844059440604406144062440634406444065440664406744068440694407044071440724407344074440754407644077440784407944080440814408244083440844408544086440874408844089440904409144092440934409444095440964409744098440994410044101441024410344104441054410644107441084410944110441114411244113441144411544116441174411844119441204412144122441234412444125441264412744128441294413044131441324413344134441354413644137441384413944140441414414244143441444414544146441474414844149441504415144152441534415444155441564415744158441594416044161441624416344164441654416644167441684416944170441714417244173441744417544176441774417844179441804418144182441834418444185441864418744188441894419044191441924419344194441954419644197441984419944200442014420244203442044420544206442074420844209442104421144212442134421444215442164421744218442194422044221442224422344224442254422644227442284422944230442314423244233442344423544236442374423844239442404424144242442434424444245442464424744248442494425044251442524425344254442554425644257442584425944260442614426244263442644426544266442674426844269442704427144272442734427444275442764427744278442794428044281442824428344284442854428644287442884428944290442914429244293442944429544296442974429844299443004430144302443034430444305443064430744308443094431044311443124431344314443154431644317443184431944320443214432244323443244432544326443274432844329443304433144332443334433444335443364433744338443394434044341443424434344344443454434644347443484434944350443514435244353443544435544356443574435844359443604436144362443634436444365443664436744368443694437044371443724437344374443754437644377443784437944380443814438244383443844438544386443874438844389443904439144392443934439444395443964439744398443994440044401444024440344404444054440644407444084440944410444114441244413444144441544416444174441844419444204442144422444234442444425444264442744428444294443044431444324443344434444354443644437444384443944440444414444244443444444444544446444474444844449444504445144452444534445444455444564445744458444594446044461444624446344464444654446644467444684446944470444714447244473444744447544476444774447844479444804448144482444834448444485444864448744488444894449044491444924449344494444954449644497444984449944500445014450244503445044450544506445074450844509445104451144512445134451444515445164451744518445194452044521445224452344524445254452644527445284452944530445314453244533445344453544536445374453844539445404454144542445434454444545445464454744548445494455044551445524455344554445554455644557445584455944560445614456244563445644456544566445674456844569445704457144572445734457444575445764457744578445794458044581445824458344584445854458644587445884458944590445914459244593445944459544596445974459844599446004460144602446034460444605446064460744608446094461044611446124461344614446154461644617446184461944620446214462244623446244462544626446274462844629446304463144632446334463444635446364463744638446394464044641446424464344644446454464644647446484464944650446514465244653446544465544656446574465844659446604466144662446634466444665446664466744668446694467044671446724467344674446754467644677446784467944680446814468244683446844468544686446874468844689446904469144692446934469444695446964469744698446994470044701447024470344704447054470644707447084470944710447114471244713447144471544716447174471844719447204472144722447234472444725447264472744728447294473044731447324473344734447354473644737447384473944740447414474244743447444474544746447474474844749447504475144752447534475444755447564475744758447594476044761447624476344764447654476644767447684476944770447714477244773447744477544776447774477844779447804478144782447834478444785447864478744788447894479044791447924479344794447954479644797447984479944800448014480244803448044480544806448074480844809448104481144812448134481444815448164481744818448194482044821448224482344824448254482644827448284482944830448314483244833448344483544836448374483844839448404484144842448434484444845448464484744848448494485044851448524485344854448554485644857448584485944860448614486244863448644486544866448674486844869448704487144872448734487444875448764487744878448794488044881448824488344884448854488644887448884488944890448914489244893448944489544896448974489844899449004490144902449034490444905449064490744908449094491044911449124491344914449154491644917449184491944920449214492244923449244492544926449274492844929449304493144932449334493444935449364493744938449394494044941449424494344944449454494644947449484494944950449514495244953449544495544956449574495844959449604496144962449634496444965449664496744968449694497044971449724497344974449754497644977449784497944980449814498244983449844498544986449874498844989449904499144992449934499444995449964499744998449994500045001450024500345004450054500645007450084500945010450114501245013450144501545016450174501845019450204502145022450234502445025450264502745028450294503045031450324503345034450354503645037450384503945040450414504245043450444504545046450474504845049450504505145052450534505445055450564505745058450594506045061450624506345064450654506645067450684506945070450714507245073450744507545076450774507845079450804508145082450834508445085450864508745088450894509045091450924509345094450954509645097450984509945100451014510245103451044510545106451074510845109451104511145112451134511445115451164511745118451194512045121451224512345124451254512645127451284512945130451314513245133451344513545136451374513845139451404514145142451434514445145451464514745148451494515045151451524515345154451554515645157451584515945160451614516245163451644516545166451674516845169451704517145172451734517445175451764517745178451794518045181451824518345184451854518645187451884518945190451914519245193451944519545196451974519845199452004520145202452034520445205452064520745208452094521045211452124521345214452154521645217452184521945220452214522245223452244522545226452274522845229452304523145232452334523445235452364523745238452394524045241452424524345244452454524645247452484524945250452514525245253452544525545256452574525845259452604526145262452634526445265452664526745268452694527045271452724527345274452754527645277452784527945280452814528245283452844528545286452874528845289452904529145292452934529445295452964529745298452994530045301453024530345304453054530645307453084530945310453114531245313453144531545316453174531845319453204532145322453234532445325453264532745328453294533045331453324533345334453354533645337453384533945340453414534245343453444534545346453474534845349453504535145352453534535445355453564535745358453594536045361453624536345364453654536645367453684536945370453714537245373453744537545376453774537845379453804538145382453834538445385453864538745388453894539045391453924539345394453954539645397453984539945400454014540245403454044540545406454074540845409454104541145412454134541445415454164541745418454194542045421454224542345424454254542645427454284542945430454314543245433454344543545436454374543845439454404544145442454434544445445454464544745448454494545045451454524545345454454554545645457454584545945460454614546245463454644546545466454674546845469454704547145472454734547445475454764547745478454794548045481454824548345484454854548645487454884548945490454914549245493454944549545496454974549845499455004550145502455034550445505455064550745508455094551045511455124551345514455154551645517455184551945520455214552245523455244552545526455274552845529455304553145532455334553445535455364553745538455394554045541455424554345544455454554645547455484554945550455514555245553455544555545556455574555845559455604556145562455634556445565455664556745568455694557045571455724557345574455754557645577455784557945580455814558245583455844558545586455874558845589455904559145592455934559445595455964559745598455994560045601456024560345604456054560645607456084560945610456114561245613456144561545616456174561845619456204562145622456234562445625456264562745628456294563045631456324563345634456354563645637456384563945640456414564245643456444564545646456474564845649456504565145652456534565445655456564565745658456594566045661456624566345664456654566645667456684566945670456714567245673456744567545676456774567845679456804568145682456834568445685456864568745688456894569045691456924569345694456954569645697456984569945700457014570245703457044570545706457074570845709457104571145712457134571445715457164571745718457194572045721457224572345724457254572645727457284572945730457314573245733457344573545736457374573845739457404574145742457434574445745457464574745748457494575045751457524575345754457554575645757457584575945760457614576245763457644576545766457674576845769457704577145772457734577445775457764577745778457794578045781457824578345784457854578645787457884578945790457914579245793457944579545796457974579845799458004580145802458034580445805458064580745808458094581045811458124581345814458154581645817458184581945820458214582245823458244582545826458274582845829458304583145832458334583445835458364583745838458394584045841458424584345844458454584645847458484584945850458514585245853458544585545856458574585845859458604586145862458634586445865458664586745868458694587045871458724587345874458754587645877458784587945880458814588245883458844588545886458874588845889458904589145892458934589445895458964589745898458994590045901459024590345904459054590645907459084590945910459114591245913459144591545916459174591845919459204592145922459234592445925459264592745928459294593045931459324593345934459354593645937459384593945940459414594245943459444594545946459474594845949459504595145952459534595445955459564595745958459594596045961459624596345964459654596645967459684596945970459714597245973459744597545976459774597845979459804598145982459834598445985459864598745988459894599045991459924599345994459954599645997459984599946000460014600246003460044600546006460074600846009460104601146012460134601446015460164601746018460194602046021460224602346024460254602646027460284602946030460314603246033460344603546036460374603846039460404604146042460434604446045460464604746048460494605046051460524605346054460554605646057460584605946060460614606246063460644606546066460674606846069460704607146072460734607446075460764607746078460794608046081460824608346084460854608646087460884608946090460914609246093460944609546096460974609846099461004610146102461034610446105461064610746108461094611046111461124611346114461154611646117461184611946120461214612246123461244612546126461274612846129461304613146132461334613446135461364613746138461394614046141461424614346144461454614646147461484614946150461514615246153461544615546156461574615846159461604616146162461634616446165461664616746168461694617046171461724617346174461754617646177461784617946180461814618246183461844618546186461874618846189461904619146192461934619446195461964619746198461994620046201462024620346204462054620646207462084620946210462114621246213462144621546216462174621846219462204622146222462234622446225462264622746228462294623046231462324623346234462354623646237462384623946240462414624246243462444624546246462474624846249462504625146252462534625446255462564625746258462594626046261462624626346264462654626646267462684626946270462714627246273462744627546276462774627846279462804628146282462834628446285462864628746288462894629046291462924629346294462954629646297462984629946300463014630246303463044630546306463074630846309463104631146312463134631446315463164631746318463194632046321463224632346324463254632646327463284632946330463314633246333463344633546336463374633846339463404634146342463434634446345463464634746348463494635046351463524635346354463554635646357463584635946360463614636246363463644636546366463674636846369463704637146372463734637446375463764637746378463794638046381463824638346384463854638646387463884638946390463914639246393463944639546396463974639846399464004640146402464034640446405464064640746408464094641046411464124641346414464154641646417464184641946420464214642246423464244642546426464274642846429464304643146432464334643446435464364643746438464394644046441464424644346444464454644646447464484644946450464514645246453464544645546456464574645846459464604646146462464634646446465464664646746468464694647046471464724647346474464754647646477464784647946480464814648246483464844648546486464874648846489464904649146492464934649446495464964649746498464994650046501465024650346504465054650646507465084650946510465114651246513465144651546516465174651846519465204652146522465234652446525465264652746528465294653046531465324653346534465354653646537465384653946540465414654246543465444654546546465474654846549465504655146552465534655446555465564655746558465594656046561465624656346564465654656646567465684656946570465714657246573465744657546576465774657846579465804658146582465834658446585465864658746588465894659046591465924659346594465954659646597465984659946600466014660246603466044660546606466074660846609466104661146612466134661446615466164661746618466194662046621466224662346624466254662646627466284662946630466314663246633466344663546636466374663846639466404664146642466434664446645466464664746648466494665046651466524665346654466554665646657466584665946660466614666246663466644666546666466674666846669466704667146672466734667446675466764667746678466794668046681466824668346684466854668646687466884668946690466914669246693466944669546696466974669846699467004670146702467034670446705467064670746708467094671046711467124671346714467154671646717467184671946720467214672246723467244672546726467274672846729467304673146732467334673446735467364673746738467394674046741467424674346744467454674646747467484674946750467514675246753467544675546756467574675846759467604676146762467634676446765467664676746768467694677046771467724677346774467754677646777467784677946780467814678246783467844678546786467874678846789467904679146792467934679446795467964679746798467994680046801468024680346804468054680646807468084680946810468114681246813468144681546816468174681846819468204682146822468234682446825468264682746828468294683046831468324683346834468354683646837468384683946840468414684246843468444684546846468474684846849468504685146852468534685446855468564685746858468594686046861468624686346864468654686646867468684686946870468714687246873468744687546876468774687846879468804688146882468834688446885468864688746888468894689046891468924689346894468954689646897468984689946900469014690246903469044690546906469074690846909469104691146912469134691446915469164691746918469194692046921469224692346924469254692646927469284692946930469314693246933469344693546936469374693846939469404694146942469434694446945469464694746948469494695046951469524695346954469554695646957469584695946960469614696246963469644696546966469674696846969469704697146972469734697446975469764697746978469794698046981469824698346984469854698646987469884698946990469914699246993469944699546996469974699846999470004700147002470034700447005470064700747008470094701047011470124701347014470154701647017470184701947020470214702247023470244702547026470274702847029470304703147032470334703447035470364703747038470394704047041470424704347044470454704647047470484704947050470514705247053470544705547056470574705847059470604706147062470634706447065470664706747068470694707047071470724707347074470754707647077470784707947080470814708247083470844708547086470874708847089470904709147092470934709447095470964709747098470994710047101471024710347104471054710647107471084710947110471114711247113471144711547116471174711847119471204712147122471234712447125471264712747128471294713047131471324713347134471354713647137471384713947140471414714247143471444714547146471474714847149471504715147152471534715447155471564715747158471594716047161471624716347164471654716647167471684716947170471714717247173471744717547176471774717847179471804718147182471834718447185471864718747188471894719047191471924719347194471954719647197471984719947200472014720247203472044720547206472074720847209472104721147212472134721447215472164721747218472194722047221472224722347224472254722647227472284722947230472314723247233472344723547236472374723847239472404724147242472434724447245472464724747248472494725047251472524725347254472554725647257472584725947260472614726247263472644726547266472674726847269472704727147272472734727447275472764727747278472794728047281472824728347284472854728647287472884728947290472914729247293472944729547296472974729847299473004730147302473034730447305473064730747308473094731047311473124731347314473154731647317473184731947320473214732247323473244732547326473274732847329473304733147332473334733447335473364733747338473394734047341473424734347344473454734647347473484734947350473514735247353473544735547356473574735847359473604736147362473634736447365473664736747368473694737047371473724737347374473754737647377473784737947380473814738247383473844738547386473874738847389473904739147392473934739447395473964739747398473994740047401474024740347404474054740647407474084740947410474114741247413474144741547416474174741847419474204742147422474234742447425474264742747428474294743047431474324743347434474354743647437474384743947440474414744247443474444744547446474474744847449474504745147452474534745447455474564745747458474594746047461474624746347464474654746647467474684746947470474714747247473474744747547476474774747847479474804748147482474834748447485474864748747488474894749047491474924749347494474954749647497474984749947500475014750247503475044750547506475074750847509475104751147512475134751447515475164751747518475194752047521475224752347524475254752647527475284752947530475314753247533475344753547536475374753847539475404754147542475434754447545475464754747548475494755047551475524755347554475554755647557475584755947560475614756247563475644756547566475674756847569475704757147572475734757447575475764757747578475794758047581475824758347584475854758647587475884758947590475914759247593475944759547596475974759847599476004760147602476034760447605476064760747608476094761047611476124761347614476154761647617476184761947620476214762247623476244762547626476274762847629476304763147632476334763447635476364763747638476394764047641476424764347644476454764647647476484764947650476514765247653476544765547656476574765847659476604766147662476634766447665476664766747668476694767047671476724767347674476754767647677476784767947680476814768247683476844768547686476874768847689476904769147692476934769447695476964769747698476994770047701477024770347704477054770647707477084770947710477114771247713477144771547716477174771847719477204772147722477234772447725477264772747728477294773047731477324773347734477354773647737477384773947740477414774247743477444774547746477474774847749477504775147752477534775447755477564775747758477594776047761477624776347764477654776647767477684776947770477714777247773477744777547776477774777847779477804778147782477834778447785477864778747788477894779047791477924779347794477954779647797477984779947800478014780247803478044780547806478074780847809478104781147812478134781447815478164781747818478194782047821478224782347824478254782647827478284782947830478314783247833478344783547836478374783847839478404784147842478434784447845478464784747848478494785047851478524785347854478554785647857478584785947860478614786247863478644786547866478674786847869478704787147872478734787447875478764787747878478794788047881478824788347884478854788647887478884788947890478914789247893478944789547896478974789847899479004790147902479034790447905479064790747908479094791047911479124791347914479154791647917479184791947920479214792247923479244792547926479274792847929479304793147932479334793447935479364793747938479394794047941479424794347944479454794647947479484794947950479514795247953479544795547956479574795847959479604796147962479634796447965479664796747968479694797047971479724797347974479754797647977479784797947980479814798247983479844798547986479874798847989479904799147992479934799447995479964799747998479994800048001480024800348004480054800648007480084800948010480114801248013480144801548016480174801848019480204802148022480234802448025480264802748028480294803048031480324803348034480354803648037480384803948040480414804248043480444804548046480474804848049480504805148052480534805448055480564805748058480594806048061480624806348064480654806648067480684806948070480714807248073480744807548076480774807848079480804808148082480834808448085480864808748088480894809048091480924809348094480954809648097480984809948100481014810248103481044810548106481074810848109481104811148112481134811448115481164811748118481194812048121481224812348124481254812648127481284812948130481314813248133481344813548136481374813848139481404814148142481434814448145481464814748148481494815048151481524815348154481554815648157481584815948160481614816248163481644816548166481674816848169481704817148172481734817448175481764817748178481794818048181481824818348184481854818648187481884818948190481914819248193481944819548196481974819848199482004820148202482034820448205482064820748208482094821048211482124821348214482154821648217482184821948220482214822248223482244822548226482274822848229482304823148232482334823448235482364823748238482394824048241482424824348244482454824648247482484824948250482514825248253482544825548256482574825848259482604826148262482634826448265482664826748268482694827048271482724827348274482754827648277482784827948280482814828248283482844828548286482874828848289482904829148292482934829448295482964829748298482994830048301483024830348304483054830648307483084830948310483114831248313483144831548316483174831848319483204832148322483234832448325483264832748328483294833048331483324833348334483354833648337483384833948340483414834248343483444834548346483474834848349483504835148352483534835448355483564835748358483594836048361483624836348364483654836648367483684836948370483714837248373483744837548376483774837848379483804838148382483834838448385483864838748388483894839048391483924839348394483954839648397483984839948400484014840248403484044840548406484074840848409484104841148412484134841448415484164841748418484194842048421484224842348424484254842648427484284842948430484314843248433484344843548436484374843848439484404844148442484434844448445484464844748448484494845048451484524845348454484554845648457484584845948460484614846248463484644846548466484674846848469484704847148472484734847448475484764847748478484794848048481484824848348484484854848648487484884848948490484914849248493484944849548496484974849848499485004850148502485034850448505485064850748508485094851048511485124851348514485154851648517485184851948520485214852248523485244852548526485274852848529485304853148532485334853448535485364853748538485394854048541485424854348544485454854648547485484854948550485514855248553485544855548556485574855848559485604856148562485634856448565485664856748568485694857048571485724857348574485754857648577485784857948580485814858248583485844858548586485874858848589485904859148592485934859448595485964859748598485994860048601486024860348604486054860648607486084860948610486114861248613486144861548616486174861848619486204862148622486234862448625486264862748628486294863048631486324863348634486354863648637486384863948640486414864248643486444864548646486474864848649486504865148652486534865448655486564865748658486594866048661486624866348664486654866648667486684866948670486714867248673486744867548676486774867848679486804868148682486834868448685486864868748688486894869048691486924869348694486954869648697486984869948700487014870248703487044870548706487074870848709487104871148712487134871448715487164871748718487194872048721487224872348724487254872648727487284872948730487314873248733487344873548736487374873848739487404874148742487434874448745487464874748748487494875048751487524875348754487554875648757487584875948760487614876248763487644876548766487674876848769487704877148772487734877448775487764877748778487794878048781487824878348784487854878648787487884878948790487914879248793487944879548796487974879848799488004880148802488034880448805488064880748808488094881048811488124881348814488154881648817488184881948820488214882248823488244882548826488274882848829488304883148832488334883448835488364883748838488394884048841488424884348844488454884648847488484884948850488514885248853488544885548856488574885848859488604886148862488634886448865488664886748868488694887048871488724887348874488754887648877488784887948880488814888248883488844888548886488874888848889488904889148892488934889448895488964889748898488994890048901489024890348904489054890648907489084890948910489114891248913489144891548916489174891848919489204892148922489234892448925489264892748928489294893048931489324893348934489354893648937489384893948940489414894248943489444894548946489474894848949489504895148952489534895448955489564895748958489594896048961489624896348964489654896648967489684896948970489714897248973489744897548976489774897848979489804898148982489834898448985489864898748988489894899048991489924899348994489954899648997489984899949000490014900249003490044900549006490074900849009490104901149012490134901449015490164901749018490194902049021490224902349024490254902649027490284902949030490314903249033490344903549036490374903849039490404904149042490434904449045490464904749048490494905049051490524905349054490554905649057490584905949060490614906249063490644906549066490674906849069490704907149072490734907449075490764907749078490794908049081490824908349084490854908649087490884908949090490914909249093490944909549096490974909849099491004910149102491034910449105491064910749108491094911049111491124911349114491154911649117491184911949120491214912249123491244912549126491274912849129491304913149132491334913449135491364913749138491394914049141491424914349144491454914649147491484914949150491514915249153491544915549156491574915849159491604916149162491634916449165491664916749168491694917049171491724917349174491754917649177491784917949180491814918249183491844918549186491874918849189491904919149192491934919449195491964919749198491994920049201492024920349204492054920649207492084920949210492114921249213492144921549216492174921849219492204922149222492234922449225492264922749228492294923049231492324923349234492354923649237492384923949240492414924249243492444924549246492474924849249492504925149252492534925449255492564925749258492594926049261492624926349264492654926649267492684926949270492714927249273492744927549276492774927849279492804928149282492834928449285492864928749288492894929049291492924929349294492954929649297492984929949300493014930249303493044930549306493074930849309493104931149312493134931449315493164931749318493194932049321493224932349324493254932649327493284932949330493314933249333493344933549336493374933849339493404934149342493434934449345493464934749348493494935049351493524935349354493554935649357493584935949360493614936249363493644936549366493674936849369493704937149372493734937449375493764937749378493794938049381493824938349384493854938649387493884938949390493914939249393493944939549396493974939849399494004940149402494034940449405494064940749408494094941049411494124941349414494154941649417494184941949420494214942249423494244942549426494274942849429494304943149432494334943449435494364943749438494394944049441494424944349444494454944649447494484944949450494514945249453494544945549456494574945849459494604946149462494634946449465494664946749468494694947049471494724947349474494754947649477494784947949480494814948249483494844948549486494874948849489494904949149492494934949449495494964949749498494994950049501495024950349504495054950649507495084950949510495114951249513495144951549516495174951849519495204952149522495234952449525495264952749528495294953049531495324953349534495354953649537495384953949540495414954249543495444954549546495474954849549495504955149552495534955449555495564955749558495594956049561495624956349564495654956649567495684956949570495714957249573495744957549576495774957849579495804958149582495834958449585495864958749588495894959049591495924959349594495954959649597495984959949600496014960249603496044960549606496074960849609496104961149612496134961449615496164961749618496194962049621496224962349624496254962649627496284962949630496314963249633496344963549636496374963849639496404964149642496434964449645496464964749648496494965049651496524965349654496554965649657496584965949660496614966249663496644966549666496674966849669496704967149672496734967449675496764967749678496794968049681496824968349684496854968649687496884968949690496914969249693496944969549696496974969849699497004970149702497034970449705497064970749708497094971049711497124971349714497154971649717497184971949720497214972249723497244972549726497274972849729497304973149732497334973449735497364973749738497394974049741497424974349744497454974649747497484974949750497514975249753497544975549756497574975849759497604976149762497634976449765497664976749768497694977049771497724977349774497754977649777497784977949780497814978249783497844978549786497874978849789497904979149792497934979449795497964979749798497994980049801498024980349804498054980649807498084980949810498114981249813498144981549816498174981849819498204982149822498234982449825498264982749828498294983049831498324983349834498354983649837498384983949840498414984249843498444984549846498474984849849498504985149852498534985449855498564985749858498594986049861498624986349864498654986649867498684986949870498714987249873498744987549876498774987849879498804988149882498834988449885498864988749888498894989049891498924989349894498954989649897498984989949900499014990249903499044990549906499074990849909499104991149912499134991449915499164991749918499194992049921499224992349924499254992649927499284992949930499314993249933499344993549936499374993849939499404994149942499434994449945499464994749948499494995049951499524995349954499554995649957499584995949960499614996249963499644996549966499674996849969499704997149972499734997449975499764997749978499794998049981499824998349984499854998649987499884998949990499914999249993499944999549996499974999849999500005000150002500035000450005500065000750008500095001050011500125001350014500155001650017500185001950020500215002250023500245002550026500275002850029500305003150032500335003450035500365003750038500395004050041500425004350044500455004650047500485004950050500515005250053500545005550056500575005850059500605006150062500635006450065500665006750068500695007050071500725007350074500755007650077500785007950080500815008250083500845008550086500875008850089500905009150092500935009450095500965009750098500995010050101501025010350104501055010650107501085010950110501115011250113501145011550116501175011850119501205012150122501235012450125501265012750128501295013050131501325013350134501355013650137501385013950140501415014250143501445014550146501475014850149501505015150152501535015450155501565015750158501595016050161501625016350164501655016650167501685016950170501715017250173501745017550176501775017850179501805018150182501835018450185501865018750188501895019050191501925019350194501955019650197501985019950200502015020250203502045020550206502075020850209502105021150212502135021450215502165021750218502195022050221502225022350224502255022650227502285022950230502315023250233502345023550236502375023850239502405024150242502435024450245502465024750248502495025050251502525025350254502555025650257502585025950260502615026250263502645026550266502675026850269502705027150272502735027450275502765027750278502795028050281502825028350284502855028650287502885028950290502915029250293502945029550296502975029850299503005030150302503035030450305503065030750308503095031050311503125031350314503155031650317503185031950320503215032250323503245032550326503275032850329503305033150332503335033450335503365033750338503395034050341503425034350344503455034650347503485034950350503515035250353503545035550356503575035850359503605036150362503635036450365503665036750368503695037050371503725037350374503755037650377503785037950380503815038250383503845038550386503875038850389503905039150392503935039450395503965039750398503995040050401504025040350404504055040650407504085040950410504115041250413504145041550416504175041850419504205042150422504235042450425504265042750428504295043050431504325043350434504355043650437504385043950440504415044250443504445044550446504475044850449504505045150452504535045450455504565045750458504595046050461504625046350464504655046650467504685046950470504715047250473504745047550476504775047850479504805048150482504835048450485504865048750488504895049050491504925049350494504955049650497504985049950500505015050250503505045050550506505075050850509505105051150512505135051450515505165051750518505195052050521505225052350524505255052650527505285052950530505315053250533505345053550536505375053850539505405054150542505435054450545505465054750548505495055050551505525055350554505555055650557505585055950560505615056250563505645056550566505675056850569505705057150572505735057450575505765057750578505795058050581505825058350584505855058650587505885058950590505915059250593505945059550596505975059850599506005060150602506035060450605506065060750608506095061050611506125061350614506155061650617506185061950620506215062250623506245062550626506275062850629506305063150632506335063450635506365063750638506395064050641506425064350644506455064650647506485064950650506515065250653506545065550656506575065850659506605066150662506635066450665506665066750668506695067050671506725067350674506755067650677506785067950680506815068250683506845068550686506875068850689506905069150692506935069450695506965069750698506995070050701507025070350704507055070650707507085070950710507115071250713507145071550716507175071850719507205072150722507235072450725507265072750728507295073050731507325073350734507355073650737507385073950740507415074250743507445074550746507475074850749507505075150752507535075450755507565075750758507595076050761507625076350764507655076650767507685076950770507715077250773507745077550776507775077850779507805078150782507835078450785507865078750788507895079050791507925079350794507955079650797507985079950800508015080250803508045080550806508075080850809508105081150812508135081450815508165081750818508195082050821508225082350824508255082650827508285082950830508315083250833508345083550836508375083850839508405084150842508435084450845508465084750848508495085050851508525085350854508555085650857508585085950860508615086250863508645086550866508675086850869508705087150872508735087450875508765087750878508795088050881508825088350884508855088650887508885088950890508915089250893508945089550896508975089850899509005090150902509035090450905509065090750908509095091050911509125091350914509155091650917509185091950920509215092250923509245092550926509275092850929509305093150932509335093450935509365093750938509395094050941509425094350944509455094650947509485094950950509515095250953509545095550956509575095850959509605096150962509635096450965509665096750968509695097050971509725097350974509755097650977509785097950980509815098250983509845098550986509875098850989509905099150992509935099450995509965099750998509995100051001510025100351004510055100651007510085100951010510115101251013510145101551016510175101851019510205102151022510235102451025510265102751028510295103051031510325103351034510355103651037510385103951040510415104251043510445104551046510475104851049510505105151052510535105451055510565105751058510595106051061510625106351064510655106651067510685106951070510715107251073510745107551076510775107851079510805108151082510835108451085510865108751088
  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. /******/
  29. /******/ // The require function
  30. /******/ function __w_pdfjs_require__(moduleId) {
  31. /******/
  32. /******/ // Check if module is in cache
  33. /******/ if(installedModules[moduleId])
  34. /******/ return installedModules[moduleId].exports;
  35. /******/
  36. /******/ // Create a new module (and put it into the cache)
  37. /******/ var module = installedModules[moduleId] = {
  38. /******/ i: moduleId,
  39. /******/ l: false,
  40. /******/ exports: {}
  41. /******/ };
  42. /******/
  43. /******/ // Execute the module function
  44. /******/ modules[moduleId].call(module.exports, module, module.exports, __w_pdfjs_require__);
  45. /******/
  46. /******/ // Flag the module as loaded
  47. /******/ module.l = true;
  48. /******/
  49. /******/ // Return the exports of the module
  50. /******/ return module.exports;
  51. /******/ }
  52. /******/
  53. /******/
  54. /******/ // expose the modules object (__webpack_modules__)
  55. /******/ __w_pdfjs_require__.m = modules;
  56. /******/
  57. /******/ // expose the module cache
  58. /******/ __w_pdfjs_require__.c = installedModules;
  59. /******/
  60. /******/ // identity function for calling harmony imports with the correct context
  61. /******/ __w_pdfjs_require__.i = function(value) { return value; };
  62. /******/
  63. /******/ // define getter function for harmony exports
  64. /******/ __w_pdfjs_require__.d = function(exports, name, getter) {
  65. /******/ if(!__w_pdfjs_require__.o(exports, name)) {
  66. /******/ Object.defineProperty(exports, name, {
  67. /******/ configurable: false,
  68. /******/ enumerable: true,
  69. /******/ get: getter
  70. /******/ });
  71. /******/ }
  72. /******/ };
  73. /******/
  74. /******/ // getDefaultExport function for compatibility with non-harmony modules
  75. /******/ __w_pdfjs_require__.n = function(module) {
  76. /******/ var getter = module && module.__esModule ?
  77. /******/ function getDefault() { return module['default']; } :
  78. /******/ function getModuleExports() { return module; };
  79. /******/ __w_pdfjs_require__.d(getter, 'a', getter);
  80. /******/ return getter;
  81. /******/ };
  82. /******/
  83. /******/ // Object.prototype.hasOwnProperty.call
  84. /******/ __w_pdfjs_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };
  85. /******/
  86. /******/ // __webpack_public_path__
  87. /******/ __w_pdfjs_require__.p = "";
  88. /******/
  89. /******/ // Load entry module and return exports
  90. /******/ return __w_pdfjs_require__(__w_pdfjs_require__.s = 37);
  91. /******/ })
  92. /************************************************************************/
  93. /******/ ([
  94. /* 0 */
  95. /***/ (function(module, exports, __w_pdfjs_require__) {
  96. "use strict";
  97. /* WEBPACK VAR INJECTION */(function(global) {
  98. var compatibility = __w_pdfjs_require__(36);
  99. var globalScope = typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : this;
  100. var FONT_IDENTITY_MATRIX = [
  101. 0.001,
  102. 0,
  103. 0,
  104. 0.001,
  105. 0,
  106. 0
  107. ];
  108. var TextRenderingMode = {
  109. FILL: 0,
  110. STROKE: 1,
  111. FILL_STROKE: 2,
  112. INVISIBLE: 3,
  113. FILL_ADD_TO_PATH: 4,
  114. STROKE_ADD_TO_PATH: 5,
  115. FILL_STROKE_ADD_TO_PATH: 6,
  116. ADD_TO_PATH: 7,
  117. FILL_STROKE_MASK: 3,
  118. ADD_TO_PATH_FLAG: 4
  119. };
  120. var ImageKind = {
  121. GRAYSCALE_1BPP: 1,
  122. RGB_24BPP: 2,
  123. RGBA_32BPP: 3
  124. };
  125. var AnnotationType = {
  126. TEXT: 1,
  127. LINK: 2,
  128. FREETEXT: 3,
  129. LINE: 4,
  130. SQUARE: 5,
  131. CIRCLE: 6,
  132. POLYGON: 7,
  133. POLYLINE: 8,
  134. HIGHLIGHT: 9,
  135. UNDERLINE: 10,
  136. SQUIGGLY: 11,
  137. STRIKEOUT: 12,
  138. STAMP: 13,
  139. CARET: 14,
  140. INK: 15,
  141. POPUP: 16,
  142. FILEATTACHMENT: 17,
  143. SOUND: 18,
  144. MOVIE: 19,
  145. WIDGET: 20,
  146. SCREEN: 21,
  147. PRINTERMARK: 22,
  148. TRAPNET: 23,
  149. WATERMARK: 24,
  150. THREED: 25,
  151. REDACT: 26
  152. };
  153. var AnnotationFlag = {
  154. INVISIBLE: 0x01,
  155. HIDDEN: 0x02,
  156. PRINT: 0x04,
  157. NOZOOM: 0x08,
  158. NOROTATE: 0x10,
  159. NOVIEW: 0x20,
  160. READONLY: 0x40,
  161. LOCKED: 0x80,
  162. TOGGLENOVIEW: 0x100,
  163. LOCKEDCONTENTS: 0x200
  164. };
  165. var AnnotationFieldFlag = {
  166. READONLY: 0x0000001,
  167. REQUIRED: 0x0000002,
  168. NOEXPORT: 0x0000004,
  169. MULTILINE: 0x0001000,
  170. PASSWORD: 0x0002000,
  171. NOTOGGLETOOFF: 0x0004000,
  172. RADIO: 0x0008000,
  173. PUSHBUTTON: 0x0010000,
  174. COMBO: 0x0020000,
  175. EDIT: 0x0040000,
  176. SORT: 0x0080000,
  177. FILESELECT: 0x0100000,
  178. MULTISELECT: 0x0200000,
  179. DONOTSPELLCHECK: 0x0400000,
  180. DONOTSCROLL: 0x0800000,
  181. COMB: 0x1000000,
  182. RICHTEXT: 0x2000000,
  183. RADIOSINUNISON: 0x2000000,
  184. COMMITONSELCHANGE: 0x4000000
  185. };
  186. var AnnotationBorderStyleType = {
  187. SOLID: 1,
  188. DASHED: 2,
  189. BEVELED: 3,
  190. INSET: 4,
  191. UNDERLINE: 5
  192. };
  193. var StreamType = {
  194. UNKNOWN: 0,
  195. FLATE: 1,
  196. LZW: 2,
  197. DCT: 3,
  198. JPX: 4,
  199. JBIG: 5,
  200. A85: 6,
  201. AHX: 7,
  202. CCF: 8,
  203. RL: 9
  204. };
  205. var FontType = {
  206. UNKNOWN: 0,
  207. TYPE1: 1,
  208. TYPE1C: 2,
  209. CIDFONTTYPE0: 3,
  210. CIDFONTTYPE0C: 4,
  211. TRUETYPE: 5,
  212. CIDFONTTYPE2: 6,
  213. TYPE3: 7,
  214. OPENTYPE: 8,
  215. TYPE0: 9,
  216. MMTYPE1: 10
  217. };
  218. var VERBOSITY_LEVELS = {
  219. errors: 0,
  220. warnings: 1,
  221. infos: 5
  222. };
  223. var CMapCompressionType = {
  224. NONE: 0,
  225. BINARY: 1,
  226. STREAM: 2
  227. };
  228. var OPS = {
  229. dependency: 1,
  230. setLineWidth: 2,
  231. setLineCap: 3,
  232. setLineJoin: 4,
  233. setMiterLimit: 5,
  234. setDash: 6,
  235. setRenderingIntent: 7,
  236. setFlatness: 8,
  237. setGState: 9,
  238. save: 10,
  239. restore: 11,
  240. transform: 12,
  241. moveTo: 13,
  242. lineTo: 14,
  243. curveTo: 15,
  244. curveTo2: 16,
  245. curveTo3: 17,
  246. closePath: 18,
  247. rectangle: 19,
  248. stroke: 20,
  249. closeStroke: 21,
  250. fill: 22,
  251. eoFill: 23,
  252. fillStroke: 24,
  253. eoFillStroke: 25,
  254. closeFillStroke: 26,
  255. closeEOFillStroke: 27,
  256. endPath: 28,
  257. clip: 29,
  258. eoClip: 30,
  259. beginText: 31,
  260. endText: 32,
  261. setCharSpacing: 33,
  262. setWordSpacing: 34,
  263. setHScale: 35,
  264. setLeading: 36,
  265. setFont: 37,
  266. setTextRenderingMode: 38,
  267. setTextRise: 39,
  268. moveText: 40,
  269. setLeadingMoveText: 41,
  270. setTextMatrix: 42,
  271. nextLine: 43,
  272. showText: 44,
  273. showSpacedText: 45,
  274. nextLineShowText: 46,
  275. nextLineSetSpacingShowText: 47,
  276. setCharWidth: 48,
  277. setCharWidthAndBounds: 49,
  278. setStrokeColorSpace: 50,
  279. setFillColorSpace: 51,
  280. setStrokeColor: 52,
  281. setStrokeColorN: 53,
  282. setFillColor: 54,
  283. setFillColorN: 55,
  284. setStrokeGray: 56,
  285. setFillGray: 57,
  286. setStrokeRGBColor: 58,
  287. setFillRGBColor: 59,
  288. setStrokeCMYKColor: 60,
  289. setFillCMYKColor: 61,
  290. shadingFill: 62,
  291. beginInlineImage: 63,
  292. beginImageData: 64,
  293. endInlineImage: 65,
  294. paintXObject: 66,
  295. markPoint: 67,
  296. markPointProps: 68,
  297. beginMarkedContent: 69,
  298. beginMarkedContentProps: 70,
  299. endMarkedContent: 71,
  300. beginCompat: 72,
  301. endCompat: 73,
  302. paintFormXObjectBegin: 74,
  303. paintFormXObjectEnd: 75,
  304. beginGroup: 76,
  305. endGroup: 77,
  306. beginAnnotations: 78,
  307. endAnnotations: 79,
  308. beginAnnotation: 80,
  309. endAnnotation: 81,
  310. paintJpegXObject: 82,
  311. paintImageMaskXObject: 83,
  312. paintImageMaskXObjectGroup: 84,
  313. paintImageXObject: 85,
  314. paintInlineImageXObject: 86,
  315. paintInlineImageXObjectGroup: 87,
  316. paintImageXObjectRepeat: 88,
  317. paintImageMaskXObjectRepeat: 89,
  318. paintSolidColorImageMask: 90,
  319. constructPath: 91
  320. };
  321. var verbosity = VERBOSITY_LEVELS.warnings;
  322. function setVerbosityLevel(level) {
  323. verbosity = level;
  324. }
  325. function getVerbosityLevel() {
  326. return verbosity;
  327. }
  328. function info(msg) {
  329. if (verbosity >= VERBOSITY_LEVELS.infos) {
  330. console.log('Info: ' + msg);
  331. }
  332. }
  333. function warn(msg) {
  334. if (verbosity >= VERBOSITY_LEVELS.warnings) {
  335. console.log('Warning: ' + msg);
  336. }
  337. }
  338. function deprecated(details) {
  339. console.log('Deprecated API usage: ' + details);
  340. }
  341. function error(msg) {
  342. if (verbosity >= VERBOSITY_LEVELS.errors) {
  343. console.log('Error: ' + msg);
  344. console.log(backtrace());
  345. }
  346. throw new Error(msg);
  347. }
  348. function backtrace() {
  349. try {
  350. throw new Error();
  351. } catch (e) {
  352. return e.stack ? e.stack.split('\n').slice(2).join('\n') : '';
  353. }
  354. }
  355. function assert(cond, msg) {
  356. if (!cond) {
  357. error(msg);
  358. }
  359. }
  360. var UNSUPPORTED_FEATURES = {
  361. unknown: 'unknown',
  362. forms: 'forms',
  363. javaScript: 'javaScript',
  364. smask: 'smask',
  365. shadingPattern: 'shadingPattern',
  366. font: 'font'
  367. };
  368. function isSameOrigin(baseUrl, otherUrl) {
  369. try {
  370. var base = new URL(baseUrl);
  371. if (!base.origin || base.origin === 'null') {
  372. return false;
  373. }
  374. } catch (e) {
  375. return false;
  376. }
  377. var other = new URL(otherUrl, base);
  378. return base.origin === other.origin;
  379. }
  380. function isValidProtocol(url) {
  381. if (!url) {
  382. return false;
  383. }
  384. switch (url.protocol) {
  385. case 'http:':
  386. case 'https:':
  387. case 'ftp:':
  388. case 'mailto:':
  389. case 'tel:':
  390. return true;
  391. default:
  392. return false;
  393. }
  394. }
  395. function createValidAbsoluteUrl(url, baseUrl) {
  396. if (!url) {
  397. return null;
  398. }
  399. try {
  400. var absoluteUrl = baseUrl ? new URL(url, baseUrl) : new URL(url);
  401. if (isValidProtocol(absoluteUrl)) {
  402. return absoluteUrl;
  403. }
  404. } catch (ex) {
  405. }
  406. return null;
  407. }
  408. function shadow(obj, prop, value) {
  409. Object.defineProperty(obj, prop, {
  410. value: value,
  411. enumerable: true,
  412. configurable: true,
  413. writable: false
  414. });
  415. return value;
  416. }
  417. function getLookupTableFactory(initializer) {
  418. var lookup;
  419. return function () {
  420. if (initializer) {
  421. lookup = Object.create(null);
  422. initializer(lookup);
  423. initializer = null;
  424. }
  425. return lookup;
  426. };
  427. }
  428. var PasswordResponses = {
  429. NEED_PASSWORD: 1,
  430. INCORRECT_PASSWORD: 2
  431. };
  432. var PasswordException = function PasswordExceptionClosure() {
  433. function PasswordException(msg, code) {
  434. this.name = 'PasswordException';
  435. this.message = msg;
  436. this.code = code;
  437. }
  438. PasswordException.prototype = new Error();
  439. PasswordException.constructor = PasswordException;
  440. return PasswordException;
  441. }();
  442. var UnknownErrorException = function UnknownErrorExceptionClosure() {
  443. function UnknownErrorException(msg, details) {
  444. this.name = 'UnknownErrorException';
  445. this.message = msg;
  446. this.details = details;
  447. }
  448. UnknownErrorException.prototype = new Error();
  449. UnknownErrorException.constructor = UnknownErrorException;
  450. return UnknownErrorException;
  451. }();
  452. var InvalidPDFException = function InvalidPDFExceptionClosure() {
  453. function InvalidPDFException(msg) {
  454. this.name = 'InvalidPDFException';
  455. this.message = msg;
  456. }
  457. InvalidPDFException.prototype = new Error();
  458. InvalidPDFException.constructor = InvalidPDFException;
  459. return InvalidPDFException;
  460. }();
  461. var MissingPDFException = function MissingPDFExceptionClosure() {
  462. function MissingPDFException(msg) {
  463. this.name = 'MissingPDFException';
  464. this.message = msg;
  465. }
  466. MissingPDFException.prototype = new Error();
  467. MissingPDFException.constructor = MissingPDFException;
  468. return MissingPDFException;
  469. }();
  470. var UnexpectedResponseException = function UnexpectedResponseExceptionClosure() {
  471. function UnexpectedResponseException(msg, status) {
  472. this.name = 'UnexpectedResponseException';
  473. this.message = msg;
  474. this.status = status;
  475. }
  476. UnexpectedResponseException.prototype = new Error();
  477. UnexpectedResponseException.constructor = UnexpectedResponseException;
  478. return UnexpectedResponseException;
  479. }();
  480. var NotImplementedException = function NotImplementedExceptionClosure() {
  481. function NotImplementedException(msg) {
  482. this.message = msg;
  483. }
  484. NotImplementedException.prototype = new Error();
  485. NotImplementedException.prototype.name = 'NotImplementedException';
  486. NotImplementedException.constructor = NotImplementedException;
  487. return NotImplementedException;
  488. }();
  489. var MissingDataException = function MissingDataExceptionClosure() {
  490. function MissingDataException(begin, end) {
  491. this.begin = begin;
  492. this.end = end;
  493. this.message = 'Missing data [' + begin + ', ' + end + ')';
  494. }
  495. MissingDataException.prototype = new Error();
  496. MissingDataException.prototype.name = 'MissingDataException';
  497. MissingDataException.constructor = MissingDataException;
  498. return MissingDataException;
  499. }();
  500. var XRefParseException = function XRefParseExceptionClosure() {
  501. function XRefParseException(msg) {
  502. this.message = msg;
  503. }
  504. XRefParseException.prototype = new Error();
  505. XRefParseException.prototype.name = 'XRefParseException';
  506. XRefParseException.constructor = XRefParseException;
  507. return XRefParseException;
  508. }();
  509. var NullCharactersRegExp = /\x00/g;
  510. function removeNullCharacters(str) {
  511. if (typeof str !== 'string') {
  512. warn('The argument for removeNullCharacters must be a string.');
  513. return str;
  514. }
  515. return str.replace(NullCharactersRegExp, '');
  516. }
  517. function bytesToString(bytes) {
  518. assert(bytes !== null && typeof bytes === 'object' && bytes.length !== undefined, 'Invalid argument for bytesToString');
  519. var length = bytes.length;
  520. var MAX_ARGUMENT_COUNT = 8192;
  521. if (length < MAX_ARGUMENT_COUNT) {
  522. return String.fromCharCode.apply(null, bytes);
  523. }
  524. var strBuf = [];
  525. for (var i = 0; i < length; i += MAX_ARGUMENT_COUNT) {
  526. var chunkEnd = Math.min(i + MAX_ARGUMENT_COUNT, length);
  527. var chunk = bytes.subarray(i, chunkEnd);
  528. strBuf.push(String.fromCharCode.apply(null, chunk));
  529. }
  530. return strBuf.join('');
  531. }
  532. function stringToBytes(str) {
  533. assert(typeof str === 'string', 'Invalid argument for stringToBytes');
  534. var length = str.length;
  535. var bytes = new Uint8Array(length);
  536. for (var i = 0; i < length; ++i) {
  537. bytes[i] = str.charCodeAt(i) & 0xFF;
  538. }
  539. return bytes;
  540. }
  541. function arrayByteLength(arr) {
  542. if (arr.length !== undefined) {
  543. return arr.length;
  544. }
  545. assert(arr.byteLength !== undefined);
  546. return arr.byteLength;
  547. }
  548. function arraysToBytes(arr) {
  549. if (arr.length === 1 && arr[0] instanceof Uint8Array) {
  550. return arr[0];
  551. }
  552. var resultLength = 0;
  553. var i, ii = arr.length;
  554. var item, itemLength;
  555. for (i = 0; i < ii; i++) {
  556. item = arr[i];
  557. itemLength = arrayByteLength(item);
  558. resultLength += itemLength;
  559. }
  560. var pos = 0;
  561. var data = new Uint8Array(resultLength);
  562. for (i = 0; i < ii; i++) {
  563. item = arr[i];
  564. if (!(item instanceof Uint8Array)) {
  565. if (typeof item === 'string') {
  566. item = stringToBytes(item);
  567. } else {
  568. item = new Uint8Array(item);
  569. }
  570. }
  571. itemLength = item.byteLength;
  572. data.set(item, pos);
  573. pos += itemLength;
  574. }
  575. return data;
  576. }
  577. function string32(value) {
  578. return String.fromCharCode(value >> 24 & 0xff, value >> 16 & 0xff, value >> 8 & 0xff, value & 0xff);
  579. }
  580. function log2(x) {
  581. var n = 1, i = 0;
  582. while (x > n) {
  583. n <<= 1;
  584. i++;
  585. }
  586. return i;
  587. }
  588. function readInt8(data, start) {
  589. return data[start] << 24 >> 24;
  590. }
  591. function readUint16(data, offset) {
  592. return data[offset] << 8 | data[offset + 1];
  593. }
  594. function readUint32(data, offset) {
  595. return (data[offset] << 24 | data[offset + 1] << 16 | data[offset + 2] << 8 | data[offset + 3]) >>> 0;
  596. }
  597. function isLittleEndian() {
  598. var buffer8 = new Uint8Array(2);
  599. buffer8[0] = 1;
  600. var buffer16 = new Uint16Array(buffer8.buffer);
  601. return buffer16[0] === 1;
  602. }
  603. function isEvalSupported() {
  604. try {
  605. new Function('');
  606. return true;
  607. } catch (e) {
  608. return false;
  609. }
  610. }
  611. var Uint32ArrayView = function Uint32ArrayViewClosure() {
  612. function Uint32ArrayView(buffer, length) {
  613. this.buffer = buffer;
  614. this.byteLength = buffer.length;
  615. this.length = length === undefined ? this.byteLength >> 2 : length;
  616. ensureUint32ArrayViewProps(this.length);
  617. }
  618. Uint32ArrayView.prototype = Object.create(null);
  619. var uint32ArrayViewSetters = 0;
  620. function createUint32ArrayProp(index) {
  621. return {
  622. get: function () {
  623. var buffer = this.buffer, offset = index << 2;
  624. return (buffer[offset] | buffer[offset + 1] << 8 | buffer[offset + 2] << 16 | buffer[offset + 3] << 24) >>> 0;
  625. },
  626. set: function (value) {
  627. var buffer = this.buffer, offset = index << 2;
  628. buffer[offset] = value & 255;
  629. buffer[offset + 1] = value >> 8 & 255;
  630. buffer[offset + 2] = value >> 16 & 255;
  631. buffer[offset + 3] = value >>> 24 & 255;
  632. }
  633. };
  634. }
  635. function ensureUint32ArrayViewProps(length) {
  636. while (uint32ArrayViewSetters < length) {
  637. Object.defineProperty(Uint32ArrayView.prototype, uint32ArrayViewSetters, createUint32ArrayProp(uint32ArrayViewSetters));
  638. uint32ArrayViewSetters++;
  639. }
  640. }
  641. return Uint32ArrayView;
  642. }();
  643. exports.Uint32ArrayView = Uint32ArrayView;
  644. var IDENTITY_MATRIX = [
  645. 1,
  646. 0,
  647. 0,
  648. 1,
  649. 0,
  650. 0
  651. ];
  652. var Util = function UtilClosure() {
  653. function Util() {
  654. }
  655. var rgbBuf = [
  656. 'rgb(',
  657. 0,
  658. ',',
  659. 0,
  660. ',',
  661. 0,
  662. ')'
  663. ];
  664. Util.makeCssRgb = function Util_makeCssRgb(r, g, b) {
  665. rgbBuf[1] = r;
  666. rgbBuf[3] = g;
  667. rgbBuf[5] = b;
  668. return rgbBuf.join('');
  669. };
  670. Util.transform = function Util_transform(m1, m2) {
  671. return [
  672. m1[0] * m2[0] + m1[2] * m2[1],
  673. m1[1] * m2[0] + m1[3] * m2[1],
  674. m1[0] * m2[2] + m1[2] * m2[3],
  675. m1[1] * m2[2] + m1[3] * m2[3],
  676. m1[0] * m2[4] + m1[2] * m2[5] + m1[4],
  677. m1[1] * m2[4] + m1[3] * m2[5] + m1[5]
  678. ];
  679. };
  680. Util.applyTransform = function Util_applyTransform(p, m) {
  681. var xt = p[0] * m[0] + p[1] * m[2] + m[4];
  682. var yt = p[0] * m[1] + p[1] * m[3] + m[5];
  683. return [
  684. xt,
  685. yt
  686. ];
  687. };
  688. Util.applyInverseTransform = function Util_applyInverseTransform(p, m) {
  689. var d = m[0] * m[3] - m[1] * m[2];
  690. var xt = (p[0] * m[3] - p[1] * m[2] + m[2] * m[5] - m[4] * m[3]) / d;
  691. var yt = (-p[0] * m[1] + p[1] * m[0] + m[4] * m[1] - m[5] * m[0]) / d;
  692. return [
  693. xt,
  694. yt
  695. ];
  696. };
  697. Util.getAxialAlignedBoundingBox = function Util_getAxialAlignedBoundingBox(r, m) {
  698. var p1 = Util.applyTransform(r, m);
  699. var p2 = Util.applyTransform(r.slice(2, 4), m);
  700. var p3 = Util.applyTransform([
  701. r[0],
  702. r[3]
  703. ], m);
  704. var p4 = Util.applyTransform([
  705. r[2],
  706. r[1]
  707. ], m);
  708. return [
  709. Math.min(p1[0], p2[0], p3[0], p4[0]),
  710. Math.min(p1[1], p2[1], p3[1], p4[1]),
  711. Math.max(p1[0], p2[0], p3[0], p4[0]),
  712. Math.max(p1[1], p2[1], p3[1], p4[1])
  713. ];
  714. };
  715. Util.inverseTransform = function Util_inverseTransform(m) {
  716. var d = m[0] * m[3] - m[1] * m[2];
  717. return [
  718. m[3] / d,
  719. -m[1] / d,
  720. -m[2] / d,
  721. m[0] / d,
  722. (m[2] * m[5] - m[4] * m[3]) / d,
  723. (m[4] * m[1] - m[5] * m[0]) / d
  724. ];
  725. };
  726. Util.apply3dTransform = function Util_apply3dTransform(m, v) {
  727. return [
  728. m[0] * v[0] + m[1] * v[1] + m[2] * v[2],
  729. m[3] * v[0] + m[4] * v[1] + m[5] * v[2],
  730. m[6] * v[0] + m[7] * v[1] + m[8] * v[2]
  731. ];
  732. };
  733. Util.singularValueDecompose2dScale = function Util_singularValueDecompose2dScale(m) {
  734. var transpose = [
  735. m[0],
  736. m[2],
  737. m[1],
  738. m[3]
  739. ];
  740. var a = m[0] * transpose[0] + m[1] * transpose[2];
  741. var b = m[0] * transpose[1] + m[1] * transpose[3];
  742. var c = m[2] * transpose[0] + m[3] * transpose[2];
  743. var d = m[2] * transpose[1] + m[3] * transpose[3];
  744. var first = (a + d) / 2;
  745. var second = Math.sqrt((a + d) * (a + d) - 4 * (a * d - c * b)) / 2;
  746. var sx = first + second || 1;
  747. var sy = first - second || 1;
  748. return [
  749. Math.sqrt(sx),
  750. Math.sqrt(sy)
  751. ];
  752. };
  753. Util.normalizeRect = function Util_normalizeRect(rect) {
  754. var r = rect.slice(0);
  755. if (rect[0] > rect[2]) {
  756. r[0] = rect[2];
  757. r[2] = rect[0];
  758. }
  759. if (rect[1] > rect[3]) {
  760. r[1] = rect[3];
  761. r[3] = rect[1];
  762. }
  763. return r;
  764. };
  765. Util.intersect = function Util_intersect(rect1, rect2) {
  766. function compare(a, b) {
  767. return a - b;
  768. }
  769. var orderedX = [
  770. rect1[0],
  771. rect1[2],
  772. rect2[0],
  773. rect2[2]
  774. ].sort(compare), orderedY = [
  775. rect1[1],
  776. rect1[3],
  777. rect2[1],
  778. rect2[3]
  779. ].sort(compare), result = [];
  780. rect1 = Util.normalizeRect(rect1);
  781. rect2 = Util.normalizeRect(rect2);
  782. if (orderedX[0] === rect1[0] && orderedX[1] === rect2[0] || orderedX[0] === rect2[0] && orderedX[1] === rect1[0]) {
  783. result[0] = orderedX[1];
  784. result[2] = orderedX[2];
  785. } else {
  786. return false;
  787. }
  788. if (orderedY[0] === rect1[1] && orderedY[1] === rect2[1] || orderedY[0] === rect2[1] && orderedY[1] === rect1[1]) {
  789. result[1] = orderedY[1];
  790. result[3] = orderedY[2];
  791. } else {
  792. return false;
  793. }
  794. return result;
  795. };
  796. Util.sign = function Util_sign(num) {
  797. return num < 0 ? -1 : 1;
  798. };
  799. var ROMAN_NUMBER_MAP = [
  800. '',
  801. 'C',
  802. 'CC',
  803. 'CCC',
  804. 'CD',
  805. 'D',
  806. 'DC',
  807. 'DCC',
  808. 'DCCC',
  809. 'CM',
  810. '',
  811. 'X',
  812. 'XX',
  813. 'XXX',
  814. 'XL',
  815. 'L',
  816. 'LX',
  817. 'LXX',
  818. 'LXXX',
  819. 'XC',
  820. '',
  821. 'I',
  822. 'II',
  823. 'III',
  824. 'IV',
  825. 'V',
  826. 'VI',
  827. 'VII',
  828. 'VIII',
  829. 'IX'
  830. ];
  831. Util.toRoman = function Util_toRoman(number, lowerCase) {
  832. assert(isInt(number) && number > 0, 'The number should be a positive integer.');
  833. var pos, romanBuf = [];
  834. while (number >= 1000) {
  835. number -= 1000;
  836. romanBuf.push('M');
  837. }
  838. pos = number / 100 | 0;
  839. number %= 100;
  840. romanBuf.push(ROMAN_NUMBER_MAP[pos]);
  841. pos = number / 10 | 0;
  842. number %= 10;
  843. romanBuf.push(ROMAN_NUMBER_MAP[10 + pos]);
  844. romanBuf.push(ROMAN_NUMBER_MAP[20 + number]);
  845. var romanStr = romanBuf.join('');
  846. return lowerCase ? romanStr.toLowerCase() : romanStr;
  847. };
  848. Util.appendToArray = function Util_appendToArray(arr1, arr2) {
  849. Array.prototype.push.apply(arr1, arr2);
  850. };
  851. Util.prependToArray = function Util_prependToArray(arr1, arr2) {
  852. Array.prototype.unshift.apply(arr1, arr2);
  853. };
  854. Util.extendObj = function extendObj(obj1, obj2) {
  855. for (var key in obj2) {
  856. obj1[key] = obj2[key];
  857. }
  858. };
  859. Util.getInheritableProperty = function Util_getInheritableProperty(dict, name, getArray) {
  860. while (dict && !dict.has(name)) {
  861. dict = dict.get('Parent');
  862. }
  863. if (!dict) {
  864. return null;
  865. }
  866. return getArray ? dict.getArray(name) : dict.get(name);
  867. };
  868. Util.inherit = function Util_inherit(sub, base, prototype) {
  869. sub.prototype = Object.create(base.prototype);
  870. sub.prototype.constructor = sub;
  871. for (var prop in prototype) {
  872. sub.prototype[prop] = prototype[prop];
  873. }
  874. };
  875. Util.loadScript = function Util_loadScript(src, callback) {
  876. var script = document.createElement('script');
  877. var loaded = false;
  878. script.setAttribute('src', src);
  879. if (callback) {
  880. script.onload = function () {
  881. if (!loaded) {
  882. callback();
  883. }
  884. loaded = true;
  885. };
  886. }
  887. document.getElementsByTagName('head')[0].appendChild(script);
  888. };
  889. return Util;
  890. }();
  891. var PageViewport = function PageViewportClosure() {
  892. function PageViewport(viewBox, scale, rotation, offsetX, offsetY, dontFlip) {
  893. this.viewBox = viewBox;
  894. this.scale = scale;
  895. this.rotation = rotation;
  896. this.offsetX = offsetX;
  897. this.offsetY = offsetY;
  898. var centerX = (viewBox[2] + viewBox[0]) / 2;
  899. var centerY = (viewBox[3] + viewBox[1]) / 2;
  900. var rotateA, rotateB, rotateC, rotateD;
  901. rotation = rotation % 360;
  902. rotation = rotation < 0 ? rotation + 360 : rotation;
  903. switch (rotation) {
  904. case 180:
  905. rotateA = -1;
  906. rotateB = 0;
  907. rotateC = 0;
  908. rotateD = 1;
  909. break;
  910. case 90:
  911. rotateA = 0;
  912. rotateB = 1;
  913. rotateC = 1;
  914. rotateD = 0;
  915. break;
  916. case 270:
  917. rotateA = 0;
  918. rotateB = -1;
  919. rotateC = -1;
  920. rotateD = 0;
  921. break;
  922. default:
  923. rotateA = 1;
  924. rotateB = 0;
  925. rotateC = 0;
  926. rotateD = -1;
  927. break;
  928. }
  929. if (dontFlip) {
  930. rotateC = -rotateC;
  931. rotateD = -rotateD;
  932. }
  933. var offsetCanvasX, offsetCanvasY;
  934. var width, height;
  935. if (rotateA === 0) {
  936. offsetCanvasX = Math.abs(centerY - viewBox[1]) * scale + offsetX;
  937. offsetCanvasY = Math.abs(centerX - viewBox[0]) * scale + offsetY;
  938. width = Math.abs(viewBox[3] - viewBox[1]) * scale;
  939. height = Math.abs(viewBox[2] - viewBox[0]) * scale;
  940. } else {
  941. offsetCanvasX = Math.abs(centerX - viewBox[0]) * scale + offsetX;
  942. offsetCanvasY = Math.abs(centerY - viewBox[1]) * scale + offsetY;
  943. width = Math.abs(viewBox[2] - viewBox[0]) * scale;
  944. height = Math.abs(viewBox[3] - viewBox[1]) * scale;
  945. }
  946. this.transform = [
  947. rotateA * scale,
  948. rotateB * scale,
  949. rotateC * scale,
  950. rotateD * scale,
  951. offsetCanvasX - rotateA * scale * centerX - rotateC * scale * centerY,
  952. offsetCanvasY - rotateB * scale * centerX - rotateD * scale * centerY
  953. ];
  954. this.width = width;
  955. this.height = height;
  956. this.fontScale = scale;
  957. }
  958. PageViewport.prototype = {
  959. clone: function PageViewPort_clone(args) {
  960. args = args || {};
  961. var scale = 'scale' in args ? args.scale : this.scale;
  962. var rotation = 'rotation' in args ? args.rotation : this.rotation;
  963. return new PageViewport(this.viewBox.slice(), scale, rotation, this.offsetX, this.offsetY, args.dontFlip);
  964. },
  965. convertToViewportPoint: function PageViewport_convertToViewportPoint(x, y) {
  966. return Util.applyTransform([
  967. x,
  968. y
  969. ], this.transform);
  970. },
  971. convertToViewportRectangle: function PageViewport_convertToViewportRectangle(rect) {
  972. var tl = Util.applyTransform([
  973. rect[0],
  974. rect[1]
  975. ], this.transform);
  976. var br = Util.applyTransform([
  977. rect[2],
  978. rect[3]
  979. ], this.transform);
  980. return [
  981. tl[0],
  982. tl[1],
  983. br[0],
  984. br[1]
  985. ];
  986. },
  987. convertToPdfPoint: function PageViewport_convertToPdfPoint(x, y) {
  988. return Util.applyInverseTransform([
  989. x,
  990. y
  991. ], this.transform);
  992. }
  993. };
  994. return PageViewport;
  995. }();
  996. var PDFStringTranslateTable = [
  997. 0,
  998. 0,
  999. 0,
  1000. 0,
  1001. 0,
  1002. 0,
  1003. 0,
  1004. 0,
  1005. 0,
  1006. 0,
  1007. 0,
  1008. 0,
  1009. 0,
  1010. 0,
  1011. 0,
  1012. 0,
  1013. 0,
  1014. 0,
  1015. 0,
  1016. 0,
  1017. 0,
  1018. 0,
  1019. 0,
  1020. 0,
  1021. 0x2D8,
  1022. 0x2C7,
  1023. 0x2C6,
  1024. 0x2D9,
  1025. 0x2DD,
  1026. 0x2DB,
  1027. 0x2DA,
  1028. 0x2DC,
  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. 0,
  1111. 0,
  1112. 0,
  1113. 0,
  1114. 0,
  1115. 0,
  1116. 0,
  1117. 0,
  1118. 0,
  1119. 0,
  1120. 0,
  1121. 0,
  1122. 0,
  1123. 0,
  1124. 0,
  1125. 0x2022,
  1126. 0x2020,
  1127. 0x2021,
  1128. 0x2026,
  1129. 0x2014,
  1130. 0x2013,
  1131. 0x192,
  1132. 0x2044,
  1133. 0x2039,
  1134. 0x203A,
  1135. 0x2212,
  1136. 0x2030,
  1137. 0x201E,
  1138. 0x201C,
  1139. 0x201D,
  1140. 0x2018,
  1141. 0x2019,
  1142. 0x201A,
  1143. 0x2122,
  1144. 0xFB01,
  1145. 0xFB02,
  1146. 0x141,
  1147. 0x152,
  1148. 0x160,
  1149. 0x178,
  1150. 0x17D,
  1151. 0x131,
  1152. 0x142,
  1153. 0x153,
  1154. 0x161,
  1155. 0x17E,
  1156. 0,
  1157. 0x20AC
  1158. ];
  1159. function stringToPDFString(str) {
  1160. var i, n = str.length, strBuf = [];
  1161. if (str[0] === '\xFE' && str[1] === '\xFF') {
  1162. for (i = 2; i < n; i += 2) {
  1163. strBuf.push(String.fromCharCode(str.charCodeAt(i) << 8 | str.charCodeAt(i + 1)));
  1164. }
  1165. } else {
  1166. for (i = 0; i < n; ++i) {
  1167. var code = PDFStringTranslateTable[str.charCodeAt(i)];
  1168. strBuf.push(code ? String.fromCharCode(code) : str.charAt(i));
  1169. }
  1170. }
  1171. return strBuf.join('');
  1172. }
  1173. function stringToUTF8String(str) {
  1174. return decodeURIComponent(escape(str));
  1175. }
  1176. function utf8StringToString(str) {
  1177. return unescape(encodeURIComponent(str));
  1178. }
  1179. function isEmptyObj(obj) {
  1180. for (var key in obj) {
  1181. return false;
  1182. }
  1183. return true;
  1184. }
  1185. function isBool(v) {
  1186. return typeof v === 'boolean';
  1187. }
  1188. function isInt(v) {
  1189. return typeof v === 'number' && (v | 0) === v;
  1190. }
  1191. function isNum(v) {
  1192. return typeof v === 'number';
  1193. }
  1194. function isString(v) {
  1195. return typeof v === 'string';
  1196. }
  1197. function isArray(v) {
  1198. return v instanceof Array;
  1199. }
  1200. function isArrayBuffer(v) {
  1201. return typeof v === 'object' && v !== null && v.byteLength !== undefined;
  1202. }
  1203. function isSpace(ch) {
  1204. return ch === 0x20 || ch === 0x09 || ch === 0x0D || ch === 0x0A;
  1205. }
  1206. function isNodeJS() {
  1207. if (typeof __pdfjsdev_webpack__ === 'undefined') {
  1208. return typeof process === 'object' && process + '' === '[object process]';
  1209. }
  1210. return false;
  1211. }
  1212. function createPromiseCapability() {
  1213. var capability = {};
  1214. capability.promise = new Promise(function (resolve, reject) {
  1215. capability.resolve = resolve;
  1216. capability.reject = reject;
  1217. });
  1218. return capability;
  1219. }
  1220. var StatTimer = function StatTimerClosure() {
  1221. function rpad(str, pad, length) {
  1222. while (str.length < length) {
  1223. str += pad;
  1224. }
  1225. return str;
  1226. }
  1227. function StatTimer() {
  1228. this.started = Object.create(null);
  1229. this.times = [];
  1230. this.enabled = true;
  1231. }
  1232. StatTimer.prototype = {
  1233. time: function StatTimer_time(name) {
  1234. if (!this.enabled) {
  1235. return;
  1236. }
  1237. if (name in this.started) {
  1238. warn('Timer is already running for ' + name);
  1239. }
  1240. this.started[name] = Date.now();
  1241. },
  1242. timeEnd: function StatTimer_timeEnd(name) {
  1243. if (!this.enabled) {
  1244. return;
  1245. }
  1246. if (!(name in this.started)) {
  1247. warn('Timer has not been started for ' + name);
  1248. }
  1249. this.times.push({
  1250. 'name': name,
  1251. 'start': this.started[name],
  1252. 'end': Date.now()
  1253. });
  1254. delete this.started[name];
  1255. },
  1256. toString: function StatTimer_toString() {
  1257. var i, ii;
  1258. var times = this.times;
  1259. var out = '';
  1260. var longest = 0;
  1261. for (i = 0, ii = times.length; i < ii; ++i) {
  1262. var name = times[i]['name'];
  1263. if (name.length > longest) {
  1264. longest = name.length;
  1265. }
  1266. }
  1267. for (i = 0, ii = times.length; i < ii; ++i) {
  1268. var span = times[i];
  1269. var duration = span.end - span.start;
  1270. out += rpad(span['name'], ' ', longest) + ' ' + duration + 'ms\n';
  1271. }
  1272. return out;
  1273. }
  1274. };
  1275. return StatTimer;
  1276. }();
  1277. var createBlob = function createBlob(data, contentType) {
  1278. if (typeof Blob !== 'undefined') {
  1279. return new Blob([data], { type: contentType });
  1280. }
  1281. warn('The "Blob" constructor is not supported.');
  1282. };
  1283. var createObjectURL = function createObjectURLClosure() {
  1284. var digits = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=';
  1285. return function createObjectURL(data, contentType, forceDataSchema) {
  1286. if (!forceDataSchema && typeof URL !== 'undefined' && URL.createObjectURL) {
  1287. var blob = createBlob(data, contentType);
  1288. return URL.createObjectURL(blob);
  1289. }
  1290. var buffer = 'data:' + contentType + ';base64,';
  1291. for (var i = 0, ii = data.length; i < ii; i += 3) {
  1292. var b1 = data[i] & 0xFF;
  1293. var b2 = data[i + 1] & 0xFF;
  1294. var b3 = data[i + 2] & 0xFF;
  1295. var d1 = b1 >> 2, d2 = (b1 & 3) << 4 | b2 >> 4;
  1296. var d3 = i + 1 < ii ? (b2 & 0xF) << 2 | b3 >> 6 : 64;
  1297. var d4 = i + 2 < ii ? b3 & 0x3F : 64;
  1298. buffer += digits[d1] + digits[d2] + digits[d3] + digits[d4];
  1299. }
  1300. return buffer;
  1301. };
  1302. }();
  1303. function MessageHandler(sourceName, targetName, comObj) {
  1304. this.sourceName = sourceName;
  1305. this.targetName = targetName;
  1306. this.comObj = comObj;
  1307. this.callbackIndex = 1;
  1308. this.postMessageTransfers = true;
  1309. var callbacksCapabilities = this.callbacksCapabilities = Object.create(null);
  1310. var ah = this.actionHandler = Object.create(null);
  1311. this._onComObjOnMessage = function messageHandlerComObjOnMessage(event) {
  1312. var data = event.data;
  1313. if (data.targetName !== this.sourceName) {
  1314. return;
  1315. }
  1316. if (data.isReply) {
  1317. var callbackId = data.callbackId;
  1318. if (data.callbackId in callbacksCapabilities) {
  1319. var callback = callbacksCapabilities[callbackId];
  1320. delete callbacksCapabilities[callbackId];
  1321. if ('error' in data) {
  1322. callback.reject(data.error);
  1323. } else {
  1324. callback.resolve(data.data);
  1325. }
  1326. } else {
  1327. error('Cannot resolve callback ' + callbackId);
  1328. }
  1329. } else if (data.action in ah) {
  1330. var action = ah[data.action];
  1331. if (data.callbackId) {
  1332. var sourceName = this.sourceName;
  1333. var targetName = data.sourceName;
  1334. Promise.resolve().then(function () {
  1335. return action[0].call(action[1], data.data);
  1336. }).then(function (result) {
  1337. comObj.postMessage({
  1338. sourceName: sourceName,
  1339. targetName: targetName,
  1340. isReply: true,
  1341. callbackId: data.callbackId,
  1342. data: result
  1343. });
  1344. }, function (reason) {
  1345. if (reason instanceof Error) {
  1346. reason = reason + '';
  1347. }
  1348. comObj.postMessage({
  1349. sourceName: sourceName,
  1350. targetName: targetName,
  1351. isReply: true,
  1352. callbackId: data.callbackId,
  1353. error: reason
  1354. });
  1355. });
  1356. } else {
  1357. action[0].call(action[1], data.data);
  1358. }
  1359. } else {
  1360. error('Unknown action from worker: ' + data.action);
  1361. }
  1362. }.bind(this);
  1363. comObj.addEventListener('message', this._onComObjOnMessage);
  1364. }
  1365. MessageHandler.prototype = {
  1366. on: function messageHandlerOn(actionName, handler, scope) {
  1367. var ah = this.actionHandler;
  1368. if (ah[actionName]) {
  1369. error('There is already an actionName called "' + actionName + '"');
  1370. }
  1371. ah[actionName] = [
  1372. handler,
  1373. scope
  1374. ];
  1375. },
  1376. send: function messageHandlerSend(actionName, data, transfers) {
  1377. var message = {
  1378. sourceName: this.sourceName,
  1379. targetName: this.targetName,
  1380. action: actionName,
  1381. data: data
  1382. };
  1383. this.postMessage(message, transfers);
  1384. },
  1385. sendWithPromise: function messageHandlerSendWithPromise(actionName, data, transfers) {
  1386. var callbackId = this.callbackIndex++;
  1387. var message = {
  1388. sourceName: this.sourceName,
  1389. targetName: this.targetName,
  1390. action: actionName,
  1391. data: data,
  1392. callbackId: callbackId
  1393. };
  1394. var capability = createPromiseCapability();
  1395. this.callbacksCapabilities[callbackId] = capability;
  1396. try {
  1397. this.postMessage(message, transfers);
  1398. } catch (e) {
  1399. capability.reject(e);
  1400. }
  1401. return capability.promise;
  1402. },
  1403. postMessage: function (message, transfers) {
  1404. if (transfers && this.postMessageTransfers) {
  1405. this.comObj.postMessage(message, transfers);
  1406. } else {
  1407. this.comObj.postMessage(message);
  1408. }
  1409. },
  1410. destroy: function () {
  1411. this.comObj.removeEventListener('message', this._onComObjOnMessage);
  1412. }
  1413. };
  1414. function loadJpegStream(id, imageUrl, objs) {
  1415. var img = new Image();
  1416. img.onload = function loadJpegStream_onloadClosure() {
  1417. objs.resolve(id, img);
  1418. };
  1419. img.onerror = function loadJpegStream_onerrorClosure() {
  1420. objs.resolve(id, null);
  1421. warn('Error during JPEG image loading');
  1422. };
  1423. img.src = imageUrl;
  1424. }
  1425. exports.FONT_IDENTITY_MATRIX = FONT_IDENTITY_MATRIX;
  1426. exports.IDENTITY_MATRIX = IDENTITY_MATRIX;
  1427. exports.OPS = OPS;
  1428. exports.VERBOSITY_LEVELS = VERBOSITY_LEVELS;
  1429. exports.UNSUPPORTED_FEATURES = UNSUPPORTED_FEATURES;
  1430. exports.AnnotationBorderStyleType = AnnotationBorderStyleType;
  1431. exports.AnnotationFieldFlag = AnnotationFieldFlag;
  1432. exports.AnnotationFlag = AnnotationFlag;
  1433. exports.AnnotationType = AnnotationType;
  1434. exports.FontType = FontType;
  1435. exports.ImageKind = ImageKind;
  1436. exports.CMapCompressionType = CMapCompressionType;
  1437. exports.InvalidPDFException = InvalidPDFException;
  1438. exports.MessageHandler = MessageHandler;
  1439. exports.MissingDataException = MissingDataException;
  1440. exports.MissingPDFException = MissingPDFException;
  1441. exports.NotImplementedException = NotImplementedException;
  1442. exports.PageViewport = PageViewport;
  1443. exports.PasswordException = PasswordException;
  1444. exports.PasswordResponses = PasswordResponses;
  1445. exports.StatTimer = StatTimer;
  1446. exports.StreamType = StreamType;
  1447. exports.TextRenderingMode = TextRenderingMode;
  1448. exports.UnexpectedResponseException = UnexpectedResponseException;
  1449. exports.UnknownErrorException = UnknownErrorException;
  1450. exports.Util = Util;
  1451. exports.XRefParseException = XRefParseException;
  1452. exports.arrayByteLength = arrayByteLength;
  1453. exports.arraysToBytes = arraysToBytes;
  1454. exports.assert = assert;
  1455. exports.bytesToString = bytesToString;
  1456. exports.createBlob = createBlob;
  1457. exports.createPromiseCapability = createPromiseCapability;
  1458. exports.createObjectURL = createObjectURL;
  1459. exports.deprecated = deprecated;
  1460. exports.error = error;
  1461. exports.getLookupTableFactory = getLookupTableFactory;
  1462. exports.getVerbosityLevel = getVerbosityLevel;
  1463. exports.globalScope = globalScope;
  1464. exports.info = info;
  1465. exports.isArray = isArray;
  1466. exports.isArrayBuffer = isArrayBuffer;
  1467. exports.isBool = isBool;
  1468. exports.isEmptyObj = isEmptyObj;
  1469. exports.isInt = isInt;
  1470. exports.isNum = isNum;
  1471. exports.isString = isString;
  1472. exports.isSpace = isSpace;
  1473. exports.isNodeJS = isNodeJS;
  1474. exports.isSameOrigin = isSameOrigin;
  1475. exports.createValidAbsoluteUrl = createValidAbsoluteUrl;
  1476. exports.isLittleEndian = isLittleEndian;
  1477. exports.isEvalSupported = isEvalSupported;
  1478. exports.loadJpegStream = loadJpegStream;
  1479. exports.log2 = log2;
  1480. exports.readInt8 = readInt8;
  1481. exports.readUint16 = readUint16;
  1482. exports.readUint32 = readUint32;
  1483. exports.removeNullCharacters = removeNullCharacters;
  1484. exports.setVerbosityLevel = setVerbosityLevel;
  1485. exports.shadow = shadow;
  1486. exports.string32 = string32;
  1487. exports.stringToBytes = stringToBytes;
  1488. exports.stringToPDFString = stringToPDFString;
  1489. exports.stringToUTF8String = stringToUTF8String;
  1490. exports.utf8StringToString = utf8StringToString;
  1491. exports.warn = warn;
  1492. /* WEBPACK VAR INJECTION */}.call(exports, __w_pdfjs_require__(9)))
  1493. /***/ }),
  1494. /* 1 */
  1495. /***/ (function(module, exports, __w_pdfjs_require__) {
  1496. "use strict";
  1497. var sharedUtil = __w_pdfjs_require__(0);
  1498. var isArray = sharedUtil.isArray;
  1499. var EOF = {};
  1500. var Name = function NameClosure() {
  1501. function Name(name) {
  1502. this.name = name;
  1503. }
  1504. Name.prototype = {};
  1505. var nameCache = Object.create(null);
  1506. Name.get = function Name_get(name) {
  1507. var nameValue = nameCache[name];
  1508. return nameValue ? nameValue : nameCache[name] = new Name(name);
  1509. };
  1510. return Name;
  1511. }();
  1512. var Cmd = function CmdClosure() {
  1513. function Cmd(cmd) {
  1514. this.cmd = cmd;
  1515. }
  1516. Cmd.prototype = {};
  1517. var cmdCache = Object.create(null);
  1518. Cmd.get = function Cmd_get(cmd) {
  1519. var cmdValue = cmdCache[cmd];
  1520. return cmdValue ? cmdValue : cmdCache[cmd] = new Cmd(cmd);
  1521. };
  1522. return Cmd;
  1523. }();
  1524. var Dict = function DictClosure() {
  1525. var nonSerializable = function nonSerializableClosure() {
  1526. return nonSerializable;
  1527. };
  1528. function Dict(xref) {
  1529. this.map = Object.create(null);
  1530. this.xref = xref;
  1531. this.objId = null;
  1532. this.suppressEncryption = false;
  1533. this.__nonSerializable__ = nonSerializable;
  1534. }
  1535. Dict.prototype = {
  1536. assignXref: function Dict_assignXref(newXref) {
  1537. this.xref = newXref;
  1538. },
  1539. get: function Dict_get(key1, key2, key3) {
  1540. var value;
  1541. var xref = this.xref, suppressEncryption = this.suppressEncryption;
  1542. if (typeof (value = this.map[key1]) !== 'undefined' || key1 in this.map || typeof key2 === 'undefined') {
  1543. return xref ? xref.fetchIfRef(value, suppressEncryption) : value;
  1544. }
  1545. if (typeof (value = this.map[key2]) !== 'undefined' || key2 in this.map || typeof key3 === 'undefined') {
  1546. return xref ? xref.fetchIfRef(value, suppressEncryption) : value;
  1547. }
  1548. value = this.map[key3] || null;
  1549. return xref ? xref.fetchIfRef(value, suppressEncryption) : value;
  1550. },
  1551. getAsync: function Dict_getAsync(key1, key2, key3) {
  1552. var value;
  1553. var xref = this.xref, suppressEncryption = this.suppressEncryption;
  1554. if (typeof (value = this.map[key1]) !== 'undefined' || key1 in this.map || typeof key2 === 'undefined') {
  1555. if (xref) {
  1556. return xref.fetchIfRefAsync(value, suppressEncryption);
  1557. }
  1558. return Promise.resolve(value);
  1559. }
  1560. if (typeof (value = this.map[key2]) !== 'undefined' || key2 in this.map || typeof key3 === 'undefined') {
  1561. if (xref) {
  1562. return xref.fetchIfRefAsync(value, suppressEncryption);
  1563. }
  1564. return Promise.resolve(value);
  1565. }
  1566. value = this.map[key3] || null;
  1567. if (xref) {
  1568. return xref.fetchIfRefAsync(value, suppressEncryption);
  1569. }
  1570. return Promise.resolve(value);
  1571. },
  1572. getArray: function Dict_getArray(key1, key2, key3) {
  1573. var value = this.get(key1, key2, key3);
  1574. var xref = this.xref, suppressEncryption = this.suppressEncryption;
  1575. if (!isArray(value) || !xref) {
  1576. return value;
  1577. }
  1578. value = value.slice();
  1579. for (var i = 0, ii = value.length; i < ii; i++) {
  1580. if (!isRef(value[i])) {
  1581. continue;
  1582. }
  1583. value[i] = xref.fetch(value[i], suppressEncryption);
  1584. }
  1585. return value;
  1586. },
  1587. getRaw: function Dict_getRaw(key) {
  1588. return this.map[key];
  1589. },
  1590. getKeys: function Dict_getKeys() {
  1591. return Object.keys(this.map);
  1592. },
  1593. set: function Dict_set(key, value) {
  1594. this.map[key] = value;
  1595. },
  1596. has: function Dict_has(key) {
  1597. return key in this.map;
  1598. },
  1599. forEach: function Dict_forEach(callback) {
  1600. for (var key in this.map) {
  1601. callback(key, this.get(key));
  1602. }
  1603. }
  1604. };
  1605. Dict.empty = new Dict(null);
  1606. Dict.merge = function Dict_merge(xref, dictArray) {
  1607. var mergedDict = new Dict(xref);
  1608. for (var i = 0, ii = dictArray.length; i < ii; i++) {
  1609. var dict = dictArray[i];
  1610. if (!isDict(dict)) {
  1611. continue;
  1612. }
  1613. for (var keyName in dict.map) {
  1614. if (mergedDict.map[keyName]) {
  1615. continue;
  1616. }
  1617. mergedDict.map[keyName] = dict.map[keyName];
  1618. }
  1619. }
  1620. return mergedDict;
  1621. };
  1622. return Dict;
  1623. }();
  1624. var Ref = function RefClosure() {
  1625. function Ref(num, gen) {
  1626. this.num = num;
  1627. this.gen = gen;
  1628. }
  1629. Ref.prototype = {
  1630. toString: function Ref_toString() {
  1631. var str = this.num + 'R';
  1632. if (this.gen !== 0) {
  1633. str += this.gen;
  1634. }
  1635. return str;
  1636. }
  1637. };
  1638. return Ref;
  1639. }();
  1640. var RefSet = function RefSetClosure() {
  1641. function RefSet() {
  1642. this.dict = Object.create(null);
  1643. }
  1644. RefSet.prototype = {
  1645. has: function RefSet_has(ref) {
  1646. return ref.toString() in this.dict;
  1647. },
  1648. put: function RefSet_put(ref) {
  1649. this.dict[ref.toString()] = true;
  1650. },
  1651. remove: function RefSet_remove(ref) {
  1652. delete this.dict[ref.toString()];
  1653. }
  1654. };
  1655. return RefSet;
  1656. }();
  1657. var RefSetCache = function RefSetCacheClosure() {
  1658. function RefSetCache() {
  1659. this.dict = Object.create(null);
  1660. }
  1661. RefSetCache.prototype = {
  1662. get: function RefSetCache_get(ref) {
  1663. return this.dict[ref.toString()];
  1664. },
  1665. has: function RefSetCache_has(ref) {
  1666. return ref.toString() in this.dict;
  1667. },
  1668. put: function RefSetCache_put(ref, obj) {
  1669. this.dict[ref.toString()] = obj;
  1670. },
  1671. putAlias: function RefSetCache_putAlias(ref, aliasRef) {
  1672. this.dict[ref.toString()] = this.get(aliasRef);
  1673. },
  1674. forEach: function RefSetCache_forEach(fn, thisArg) {
  1675. for (var i in this.dict) {
  1676. fn.call(thisArg, this.dict[i]);
  1677. }
  1678. },
  1679. clear: function RefSetCache_clear() {
  1680. this.dict = Object.create(null);
  1681. }
  1682. };
  1683. return RefSetCache;
  1684. }();
  1685. function isEOF(v) {
  1686. return v === EOF;
  1687. }
  1688. function isName(v, name) {
  1689. return v instanceof Name && (name === undefined || v.name === name);
  1690. }
  1691. function isCmd(v, cmd) {
  1692. return v instanceof Cmd && (cmd === undefined || v.cmd === cmd);
  1693. }
  1694. function isDict(v, type) {
  1695. return v instanceof Dict && (type === undefined || isName(v.get('Type'), type));
  1696. }
  1697. function isRef(v) {
  1698. return v instanceof Ref;
  1699. }
  1700. function isRefsEqual(v1, v2) {
  1701. return v1.num === v2.num && v1.gen === v2.gen;
  1702. }
  1703. function isStream(v) {
  1704. return typeof v === 'object' && v !== null && v.getBytes !== undefined;
  1705. }
  1706. exports.EOF = EOF;
  1707. exports.Cmd = Cmd;
  1708. exports.Dict = Dict;
  1709. exports.Name = Name;
  1710. exports.Ref = Ref;
  1711. exports.RefSet = RefSet;
  1712. exports.RefSetCache = RefSetCache;
  1713. exports.isEOF = isEOF;
  1714. exports.isCmd = isCmd;
  1715. exports.isDict = isDict;
  1716. exports.isName = isName;
  1717. exports.isRef = isRef;
  1718. exports.isRefsEqual = isRefsEqual;
  1719. exports.isStream = isStream;
  1720. /***/ }),
  1721. /* 2 */
  1722. /***/ (function(module, exports, __w_pdfjs_require__) {
  1723. "use strict";
  1724. var sharedUtil = __w_pdfjs_require__(0);
  1725. var corePrimitives = __w_pdfjs_require__(1);
  1726. var coreJbig2 = __w_pdfjs_require__(28);
  1727. var coreJpg = __w_pdfjs_require__(29);
  1728. var coreJpx = __w_pdfjs_require__(15);
  1729. var Util = sharedUtil.Util;
  1730. var error = sharedUtil.error;
  1731. var info = sharedUtil.info;
  1732. var isInt = sharedUtil.isInt;
  1733. var isArray = sharedUtil.isArray;
  1734. var createObjectURL = sharedUtil.createObjectURL;
  1735. var shadow = sharedUtil.shadow;
  1736. var isSpace = sharedUtil.isSpace;
  1737. var Dict = corePrimitives.Dict;
  1738. var isDict = corePrimitives.isDict;
  1739. var isStream = corePrimitives.isStream;
  1740. var Jbig2Image = coreJbig2.Jbig2Image;
  1741. var JpegImage = coreJpg.JpegImage;
  1742. var JpxImage = coreJpx.JpxImage;
  1743. var Stream = function StreamClosure() {
  1744. function Stream(arrayBuffer, start, length, dict) {
  1745. this.bytes = arrayBuffer instanceof Uint8Array ? arrayBuffer : new Uint8Array(arrayBuffer);
  1746. this.start = start || 0;
  1747. this.pos = this.start;
  1748. this.end = start + length || this.bytes.length;
  1749. this.dict = dict;
  1750. }
  1751. Stream.prototype = {
  1752. get length() {
  1753. return this.end - this.start;
  1754. },
  1755. get isEmpty() {
  1756. return this.length === 0;
  1757. },
  1758. getByte: function Stream_getByte() {
  1759. if (this.pos >= this.end) {
  1760. return -1;
  1761. }
  1762. return this.bytes[this.pos++];
  1763. },
  1764. getUint16: function Stream_getUint16() {
  1765. var b0 = this.getByte();
  1766. var b1 = this.getByte();
  1767. if (b0 === -1 || b1 === -1) {
  1768. return -1;
  1769. }
  1770. return (b0 << 8) + b1;
  1771. },
  1772. getInt32: function Stream_getInt32() {
  1773. var b0 = this.getByte();
  1774. var b1 = this.getByte();
  1775. var b2 = this.getByte();
  1776. var b3 = this.getByte();
  1777. return (b0 << 24) + (b1 << 16) + (b2 << 8) + b3;
  1778. },
  1779. getBytes: function Stream_getBytes(length) {
  1780. var bytes = this.bytes;
  1781. var pos = this.pos;
  1782. var strEnd = this.end;
  1783. if (!length) {
  1784. return bytes.subarray(pos, strEnd);
  1785. }
  1786. var end = pos + length;
  1787. if (end > strEnd) {
  1788. end = strEnd;
  1789. }
  1790. this.pos = end;
  1791. return bytes.subarray(pos, end);
  1792. },
  1793. peekByte: function Stream_peekByte() {
  1794. var peekedByte = this.getByte();
  1795. this.pos--;
  1796. return peekedByte;
  1797. },
  1798. peekBytes: function Stream_peekBytes(length) {
  1799. var bytes = this.getBytes(length);
  1800. this.pos -= bytes.length;
  1801. return bytes;
  1802. },
  1803. skip: function Stream_skip(n) {
  1804. if (!n) {
  1805. n = 1;
  1806. }
  1807. this.pos += n;
  1808. },
  1809. reset: function Stream_reset() {
  1810. this.pos = this.start;
  1811. },
  1812. moveStart: function Stream_moveStart() {
  1813. this.start = this.pos;
  1814. },
  1815. makeSubStream: function Stream_makeSubStream(start, length, dict) {
  1816. return new Stream(this.bytes.buffer, start, length, dict);
  1817. }
  1818. };
  1819. return Stream;
  1820. }();
  1821. var StringStream = function StringStreamClosure() {
  1822. function StringStream(str) {
  1823. var length = str.length;
  1824. var bytes = new Uint8Array(length);
  1825. for (var n = 0; n < length; ++n) {
  1826. bytes[n] = str.charCodeAt(n);
  1827. }
  1828. Stream.call(this, bytes);
  1829. }
  1830. StringStream.prototype = Stream.prototype;
  1831. return StringStream;
  1832. }();
  1833. var DecodeStream = function DecodeStreamClosure() {
  1834. var emptyBuffer = new Uint8Array(0);
  1835. function DecodeStream(maybeMinBufferLength) {
  1836. this.pos = 0;
  1837. this.bufferLength = 0;
  1838. this.eof = false;
  1839. this.buffer = emptyBuffer;
  1840. this.minBufferLength = 512;
  1841. if (maybeMinBufferLength) {
  1842. while (this.minBufferLength < maybeMinBufferLength) {
  1843. this.minBufferLength *= 2;
  1844. }
  1845. }
  1846. }
  1847. DecodeStream.prototype = {
  1848. get isEmpty() {
  1849. while (!this.eof && this.bufferLength === 0) {
  1850. this.readBlock();
  1851. }
  1852. return this.bufferLength === 0;
  1853. },
  1854. ensureBuffer: function DecodeStream_ensureBuffer(requested) {
  1855. var buffer = this.buffer;
  1856. if (requested <= buffer.byteLength) {
  1857. return buffer;
  1858. }
  1859. var size = this.minBufferLength;
  1860. while (size < requested) {
  1861. size *= 2;
  1862. }
  1863. var buffer2 = new Uint8Array(size);
  1864. buffer2.set(buffer);
  1865. return this.buffer = buffer2;
  1866. },
  1867. getByte: function DecodeStream_getByte() {
  1868. var pos = this.pos;
  1869. while (this.bufferLength <= pos) {
  1870. if (this.eof) {
  1871. return -1;
  1872. }
  1873. this.readBlock();
  1874. }
  1875. return this.buffer[this.pos++];
  1876. },
  1877. getUint16: function DecodeStream_getUint16() {
  1878. var b0 = this.getByte();
  1879. var b1 = this.getByte();
  1880. if (b0 === -1 || b1 === -1) {
  1881. return -1;
  1882. }
  1883. return (b0 << 8) + b1;
  1884. },
  1885. getInt32: function DecodeStream_getInt32() {
  1886. var b0 = this.getByte();
  1887. var b1 = this.getByte();
  1888. var b2 = this.getByte();
  1889. var b3 = this.getByte();
  1890. return (b0 << 24) + (b1 << 16) + (b2 << 8) + b3;
  1891. },
  1892. getBytes: function DecodeStream_getBytes(length) {
  1893. var end, pos = this.pos;
  1894. if (length) {
  1895. this.ensureBuffer(pos + length);
  1896. end = pos + length;
  1897. while (!this.eof && this.bufferLength < end) {
  1898. this.readBlock();
  1899. }
  1900. var bufEnd = this.bufferLength;
  1901. if (end > bufEnd) {
  1902. end = bufEnd;
  1903. }
  1904. } else {
  1905. while (!this.eof) {
  1906. this.readBlock();
  1907. }
  1908. end = this.bufferLength;
  1909. }
  1910. this.pos = end;
  1911. return this.buffer.subarray(pos, end);
  1912. },
  1913. peekByte: function DecodeStream_peekByte() {
  1914. var peekedByte = this.getByte();
  1915. this.pos--;
  1916. return peekedByte;
  1917. },
  1918. peekBytes: function DecodeStream_peekBytes(length) {
  1919. var bytes = this.getBytes(length);
  1920. this.pos -= bytes.length;
  1921. return bytes;
  1922. },
  1923. makeSubStream: function DecodeStream_makeSubStream(start, length, dict) {
  1924. var end = start + length;
  1925. while (this.bufferLength <= end && !this.eof) {
  1926. this.readBlock();
  1927. }
  1928. return new Stream(this.buffer, start, length, dict);
  1929. },
  1930. skip: function DecodeStream_skip(n) {
  1931. if (!n) {
  1932. n = 1;
  1933. }
  1934. this.pos += n;
  1935. },
  1936. reset: function DecodeStream_reset() {
  1937. this.pos = 0;
  1938. },
  1939. getBaseStreams: function DecodeStream_getBaseStreams() {
  1940. if (this.str && this.str.getBaseStreams) {
  1941. return this.str.getBaseStreams();
  1942. }
  1943. return [];
  1944. }
  1945. };
  1946. return DecodeStream;
  1947. }();
  1948. var StreamsSequenceStream = function StreamsSequenceStreamClosure() {
  1949. function StreamsSequenceStream(streams) {
  1950. this.streams = streams;
  1951. DecodeStream.call(this, null);
  1952. }
  1953. StreamsSequenceStream.prototype = Object.create(DecodeStream.prototype);
  1954. StreamsSequenceStream.prototype.readBlock = function streamSequenceStreamReadBlock() {
  1955. var streams = this.streams;
  1956. if (streams.length === 0) {
  1957. this.eof = true;
  1958. return;
  1959. }
  1960. var stream = streams.shift();
  1961. var chunk = stream.getBytes();
  1962. var bufferLength = this.bufferLength;
  1963. var newLength = bufferLength + chunk.length;
  1964. var buffer = this.ensureBuffer(newLength);
  1965. buffer.set(chunk, bufferLength);
  1966. this.bufferLength = newLength;
  1967. };
  1968. StreamsSequenceStream.prototype.getBaseStreams = function StreamsSequenceStream_getBaseStreams() {
  1969. var baseStreams = [];
  1970. for (var i = 0, ii = this.streams.length; i < ii; i++) {
  1971. var stream = this.streams[i];
  1972. if (stream.getBaseStreams) {
  1973. Util.appendToArray(baseStreams, stream.getBaseStreams());
  1974. }
  1975. }
  1976. return baseStreams;
  1977. };
  1978. return StreamsSequenceStream;
  1979. }();
  1980. var FlateStream = function FlateStreamClosure() {
  1981. var codeLenCodeMap = new Int32Array([
  1982. 16,
  1983. 17,
  1984. 18,
  1985. 0,
  1986. 8,
  1987. 7,
  1988. 9,
  1989. 6,
  1990. 10,
  1991. 5,
  1992. 11,
  1993. 4,
  1994. 12,
  1995. 3,
  1996. 13,
  1997. 2,
  1998. 14,
  1999. 1,
  2000. 15
  2001. ]);
  2002. var lengthDecode = new Int32Array([
  2003. 0x00003,
  2004. 0x00004,
  2005. 0x00005,
  2006. 0x00006,
  2007. 0x00007,
  2008. 0x00008,
  2009. 0x00009,
  2010. 0x0000a,
  2011. 0x1000b,
  2012. 0x1000d,
  2013. 0x1000f,
  2014. 0x10011,
  2015. 0x20013,
  2016. 0x20017,
  2017. 0x2001b,
  2018. 0x2001f,
  2019. 0x30023,
  2020. 0x3002b,
  2021. 0x30033,
  2022. 0x3003b,
  2023. 0x40043,
  2024. 0x40053,
  2025. 0x40063,
  2026. 0x40073,
  2027. 0x50083,
  2028. 0x500a3,
  2029. 0x500c3,
  2030. 0x500e3,
  2031. 0x00102,
  2032. 0x00102,
  2033. 0x00102
  2034. ]);
  2035. var distDecode = new Int32Array([
  2036. 0x00001,
  2037. 0x00002,
  2038. 0x00003,
  2039. 0x00004,
  2040. 0x10005,
  2041. 0x10007,
  2042. 0x20009,
  2043. 0x2000d,
  2044. 0x30011,
  2045. 0x30019,
  2046. 0x40021,
  2047. 0x40031,
  2048. 0x50041,
  2049. 0x50061,
  2050. 0x60081,
  2051. 0x600c1,
  2052. 0x70101,
  2053. 0x70181,
  2054. 0x80201,
  2055. 0x80301,
  2056. 0x90401,
  2057. 0x90601,
  2058. 0xa0801,
  2059. 0xa0c01,
  2060. 0xb1001,
  2061. 0xb1801,
  2062. 0xc2001,
  2063. 0xc3001,
  2064. 0xd4001,
  2065. 0xd6001
  2066. ]);
  2067. var fixedLitCodeTab = [
  2068. new Int32Array([
  2069. 0x70100,
  2070. 0x80050,
  2071. 0x80010,
  2072. 0x80118,
  2073. 0x70110,
  2074. 0x80070,
  2075. 0x80030,
  2076. 0x900c0,
  2077. 0x70108,
  2078. 0x80060,
  2079. 0x80020,
  2080. 0x900a0,
  2081. 0x80000,
  2082. 0x80080,
  2083. 0x80040,
  2084. 0x900e0,
  2085. 0x70104,
  2086. 0x80058,
  2087. 0x80018,
  2088. 0x90090,
  2089. 0x70114,
  2090. 0x80078,
  2091. 0x80038,
  2092. 0x900d0,
  2093. 0x7010c,
  2094. 0x80068,
  2095. 0x80028,
  2096. 0x900b0,
  2097. 0x80008,
  2098. 0x80088,
  2099. 0x80048,
  2100. 0x900f0,
  2101. 0x70102,
  2102. 0x80054,
  2103. 0x80014,
  2104. 0x8011c,
  2105. 0x70112,
  2106. 0x80074,
  2107. 0x80034,
  2108. 0x900c8,
  2109. 0x7010a,
  2110. 0x80064,
  2111. 0x80024,
  2112. 0x900a8,
  2113. 0x80004,
  2114. 0x80084,
  2115. 0x80044,
  2116. 0x900e8,
  2117. 0x70106,
  2118. 0x8005c,
  2119. 0x8001c,
  2120. 0x90098,
  2121. 0x70116,
  2122. 0x8007c,
  2123. 0x8003c,
  2124. 0x900d8,
  2125. 0x7010e,
  2126. 0x8006c,
  2127. 0x8002c,
  2128. 0x900b8,
  2129. 0x8000c,
  2130. 0x8008c,
  2131. 0x8004c,
  2132. 0x900f8,
  2133. 0x70101,
  2134. 0x80052,
  2135. 0x80012,
  2136. 0x8011a,
  2137. 0x70111,
  2138. 0x80072,
  2139. 0x80032,
  2140. 0x900c4,
  2141. 0x70109,
  2142. 0x80062,
  2143. 0x80022,
  2144. 0x900a4,
  2145. 0x80002,
  2146. 0x80082,
  2147. 0x80042,
  2148. 0x900e4,
  2149. 0x70105,
  2150. 0x8005a,
  2151. 0x8001a,
  2152. 0x90094,
  2153. 0x70115,
  2154. 0x8007a,
  2155. 0x8003a,
  2156. 0x900d4,
  2157. 0x7010d,
  2158. 0x8006a,
  2159. 0x8002a,
  2160. 0x900b4,
  2161. 0x8000a,
  2162. 0x8008a,
  2163. 0x8004a,
  2164. 0x900f4,
  2165. 0x70103,
  2166. 0x80056,
  2167. 0x80016,
  2168. 0x8011e,
  2169. 0x70113,
  2170. 0x80076,
  2171. 0x80036,
  2172. 0x900cc,
  2173. 0x7010b,
  2174. 0x80066,
  2175. 0x80026,
  2176. 0x900ac,
  2177. 0x80006,
  2178. 0x80086,
  2179. 0x80046,
  2180. 0x900ec,
  2181. 0x70107,
  2182. 0x8005e,
  2183. 0x8001e,
  2184. 0x9009c,
  2185. 0x70117,
  2186. 0x8007e,
  2187. 0x8003e,
  2188. 0x900dc,
  2189. 0x7010f,
  2190. 0x8006e,
  2191. 0x8002e,
  2192. 0x900bc,
  2193. 0x8000e,
  2194. 0x8008e,
  2195. 0x8004e,
  2196. 0x900fc,
  2197. 0x70100,
  2198. 0x80051,
  2199. 0x80011,
  2200. 0x80119,
  2201. 0x70110,
  2202. 0x80071,
  2203. 0x80031,
  2204. 0x900c2,
  2205. 0x70108,
  2206. 0x80061,
  2207. 0x80021,
  2208. 0x900a2,
  2209. 0x80001,
  2210. 0x80081,
  2211. 0x80041,
  2212. 0x900e2,
  2213. 0x70104,
  2214. 0x80059,
  2215. 0x80019,
  2216. 0x90092,
  2217. 0x70114,
  2218. 0x80079,
  2219. 0x80039,
  2220. 0x900d2,
  2221. 0x7010c,
  2222. 0x80069,
  2223. 0x80029,
  2224. 0x900b2,
  2225. 0x80009,
  2226. 0x80089,
  2227. 0x80049,
  2228. 0x900f2,
  2229. 0x70102,
  2230. 0x80055,
  2231. 0x80015,
  2232. 0x8011d,
  2233. 0x70112,
  2234. 0x80075,
  2235. 0x80035,
  2236. 0x900ca,
  2237. 0x7010a,
  2238. 0x80065,
  2239. 0x80025,
  2240. 0x900aa,
  2241. 0x80005,
  2242. 0x80085,
  2243. 0x80045,
  2244. 0x900ea,
  2245. 0x70106,
  2246. 0x8005d,
  2247. 0x8001d,
  2248. 0x9009a,
  2249. 0x70116,
  2250. 0x8007d,
  2251. 0x8003d,
  2252. 0x900da,
  2253. 0x7010e,
  2254. 0x8006d,
  2255. 0x8002d,
  2256. 0x900ba,
  2257. 0x8000d,
  2258. 0x8008d,
  2259. 0x8004d,
  2260. 0x900fa,
  2261. 0x70101,
  2262. 0x80053,
  2263. 0x80013,
  2264. 0x8011b,
  2265. 0x70111,
  2266. 0x80073,
  2267. 0x80033,
  2268. 0x900c6,
  2269. 0x70109,
  2270. 0x80063,
  2271. 0x80023,
  2272. 0x900a6,
  2273. 0x80003,
  2274. 0x80083,
  2275. 0x80043,
  2276. 0x900e6,
  2277. 0x70105,
  2278. 0x8005b,
  2279. 0x8001b,
  2280. 0x90096,
  2281. 0x70115,
  2282. 0x8007b,
  2283. 0x8003b,
  2284. 0x900d6,
  2285. 0x7010d,
  2286. 0x8006b,
  2287. 0x8002b,
  2288. 0x900b6,
  2289. 0x8000b,
  2290. 0x8008b,
  2291. 0x8004b,
  2292. 0x900f6,
  2293. 0x70103,
  2294. 0x80057,
  2295. 0x80017,
  2296. 0x8011f,
  2297. 0x70113,
  2298. 0x80077,
  2299. 0x80037,
  2300. 0x900ce,
  2301. 0x7010b,
  2302. 0x80067,
  2303. 0x80027,
  2304. 0x900ae,
  2305. 0x80007,
  2306. 0x80087,
  2307. 0x80047,
  2308. 0x900ee,
  2309. 0x70107,
  2310. 0x8005f,
  2311. 0x8001f,
  2312. 0x9009e,
  2313. 0x70117,
  2314. 0x8007f,
  2315. 0x8003f,
  2316. 0x900de,
  2317. 0x7010f,
  2318. 0x8006f,
  2319. 0x8002f,
  2320. 0x900be,
  2321. 0x8000f,
  2322. 0x8008f,
  2323. 0x8004f,
  2324. 0x900fe,
  2325. 0x70100,
  2326. 0x80050,
  2327. 0x80010,
  2328. 0x80118,
  2329. 0x70110,
  2330. 0x80070,
  2331. 0x80030,
  2332. 0x900c1,
  2333. 0x70108,
  2334. 0x80060,
  2335. 0x80020,
  2336. 0x900a1,
  2337. 0x80000,
  2338. 0x80080,
  2339. 0x80040,
  2340. 0x900e1,
  2341. 0x70104,
  2342. 0x80058,
  2343. 0x80018,
  2344. 0x90091,
  2345. 0x70114,
  2346. 0x80078,
  2347. 0x80038,
  2348. 0x900d1,
  2349. 0x7010c,
  2350. 0x80068,
  2351. 0x80028,
  2352. 0x900b1,
  2353. 0x80008,
  2354. 0x80088,
  2355. 0x80048,
  2356. 0x900f1,
  2357. 0x70102,
  2358. 0x80054,
  2359. 0x80014,
  2360. 0x8011c,
  2361. 0x70112,
  2362. 0x80074,
  2363. 0x80034,
  2364. 0x900c9,
  2365. 0x7010a,
  2366. 0x80064,
  2367. 0x80024,
  2368. 0x900a9,
  2369. 0x80004,
  2370. 0x80084,
  2371. 0x80044,
  2372. 0x900e9,
  2373. 0x70106,
  2374. 0x8005c,
  2375. 0x8001c,
  2376. 0x90099,
  2377. 0x70116,
  2378. 0x8007c,
  2379. 0x8003c,
  2380. 0x900d9,
  2381. 0x7010e,
  2382. 0x8006c,
  2383. 0x8002c,
  2384. 0x900b9,
  2385. 0x8000c,
  2386. 0x8008c,
  2387. 0x8004c,
  2388. 0x900f9,
  2389. 0x70101,
  2390. 0x80052,
  2391. 0x80012,
  2392. 0x8011a,
  2393. 0x70111,
  2394. 0x80072,
  2395. 0x80032,
  2396. 0x900c5,
  2397. 0x70109,
  2398. 0x80062,
  2399. 0x80022,
  2400. 0x900a5,
  2401. 0x80002,
  2402. 0x80082,
  2403. 0x80042,
  2404. 0x900e5,
  2405. 0x70105,
  2406. 0x8005a,
  2407. 0x8001a,
  2408. 0x90095,
  2409. 0x70115,
  2410. 0x8007a,
  2411. 0x8003a,
  2412. 0x900d5,
  2413. 0x7010d,
  2414. 0x8006a,
  2415. 0x8002a,
  2416. 0x900b5,
  2417. 0x8000a,
  2418. 0x8008a,
  2419. 0x8004a,
  2420. 0x900f5,
  2421. 0x70103,
  2422. 0x80056,
  2423. 0x80016,
  2424. 0x8011e,
  2425. 0x70113,
  2426. 0x80076,
  2427. 0x80036,
  2428. 0x900cd,
  2429. 0x7010b,
  2430. 0x80066,
  2431. 0x80026,
  2432. 0x900ad,
  2433. 0x80006,
  2434. 0x80086,
  2435. 0x80046,
  2436. 0x900ed,
  2437. 0x70107,
  2438. 0x8005e,
  2439. 0x8001e,
  2440. 0x9009d,
  2441. 0x70117,
  2442. 0x8007e,
  2443. 0x8003e,
  2444. 0x900dd,
  2445. 0x7010f,
  2446. 0x8006e,
  2447. 0x8002e,
  2448. 0x900bd,
  2449. 0x8000e,
  2450. 0x8008e,
  2451. 0x8004e,
  2452. 0x900fd,
  2453. 0x70100,
  2454. 0x80051,
  2455. 0x80011,
  2456. 0x80119,
  2457. 0x70110,
  2458. 0x80071,
  2459. 0x80031,
  2460. 0x900c3,
  2461. 0x70108,
  2462. 0x80061,
  2463. 0x80021,
  2464. 0x900a3,
  2465. 0x80001,
  2466. 0x80081,
  2467. 0x80041,
  2468. 0x900e3,
  2469. 0x70104,
  2470. 0x80059,
  2471. 0x80019,
  2472. 0x90093,
  2473. 0x70114,
  2474. 0x80079,
  2475. 0x80039,
  2476. 0x900d3,
  2477. 0x7010c,
  2478. 0x80069,
  2479. 0x80029,
  2480. 0x900b3,
  2481. 0x80009,
  2482. 0x80089,
  2483. 0x80049,
  2484. 0x900f3,
  2485. 0x70102,
  2486. 0x80055,
  2487. 0x80015,
  2488. 0x8011d,
  2489. 0x70112,
  2490. 0x80075,
  2491. 0x80035,
  2492. 0x900cb,
  2493. 0x7010a,
  2494. 0x80065,
  2495. 0x80025,
  2496. 0x900ab,
  2497. 0x80005,
  2498. 0x80085,
  2499. 0x80045,
  2500. 0x900eb,
  2501. 0x70106,
  2502. 0x8005d,
  2503. 0x8001d,
  2504. 0x9009b,
  2505. 0x70116,
  2506. 0x8007d,
  2507. 0x8003d,
  2508. 0x900db,
  2509. 0x7010e,
  2510. 0x8006d,
  2511. 0x8002d,
  2512. 0x900bb,
  2513. 0x8000d,
  2514. 0x8008d,
  2515. 0x8004d,
  2516. 0x900fb,
  2517. 0x70101,
  2518. 0x80053,
  2519. 0x80013,
  2520. 0x8011b,
  2521. 0x70111,
  2522. 0x80073,
  2523. 0x80033,
  2524. 0x900c7,
  2525. 0x70109,
  2526. 0x80063,
  2527. 0x80023,
  2528. 0x900a7,
  2529. 0x80003,
  2530. 0x80083,
  2531. 0x80043,
  2532. 0x900e7,
  2533. 0x70105,
  2534. 0x8005b,
  2535. 0x8001b,
  2536. 0x90097,
  2537. 0x70115,
  2538. 0x8007b,
  2539. 0x8003b,
  2540. 0x900d7,
  2541. 0x7010d,
  2542. 0x8006b,
  2543. 0x8002b,
  2544. 0x900b7,
  2545. 0x8000b,
  2546. 0x8008b,
  2547. 0x8004b,
  2548. 0x900f7,
  2549. 0x70103,
  2550. 0x80057,
  2551. 0x80017,
  2552. 0x8011f,
  2553. 0x70113,
  2554. 0x80077,
  2555. 0x80037,
  2556. 0x900cf,
  2557. 0x7010b,
  2558. 0x80067,
  2559. 0x80027,
  2560. 0x900af,
  2561. 0x80007,
  2562. 0x80087,
  2563. 0x80047,
  2564. 0x900ef,
  2565. 0x70107,
  2566. 0x8005f,
  2567. 0x8001f,
  2568. 0x9009f,
  2569. 0x70117,
  2570. 0x8007f,
  2571. 0x8003f,
  2572. 0x900df,
  2573. 0x7010f,
  2574. 0x8006f,
  2575. 0x8002f,
  2576. 0x900bf,
  2577. 0x8000f,
  2578. 0x8008f,
  2579. 0x8004f,
  2580. 0x900ff
  2581. ]),
  2582. 9
  2583. ];
  2584. var fixedDistCodeTab = [
  2585. new Int32Array([
  2586. 0x50000,
  2587. 0x50010,
  2588. 0x50008,
  2589. 0x50018,
  2590. 0x50004,
  2591. 0x50014,
  2592. 0x5000c,
  2593. 0x5001c,
  2594. 0x50002,
  2595. 0x50012,
  2596. 0x5000a,
  2597. 0x5001a,
  2598. 0x50006,
  2599. 0x50016,
  2600. 0x5000e,
  2601. 0x00000,
  2602. 0x50001,
  2603. 0x50011,
  2604. 0x50009,
  2605. 0x50019,
  2606. 0x50005,
  2607. 0x50015,
  2608. 0x5000d,
  2609. 0x5001d,
  2610. 0x50003,
  2611. 0x50013,
  2612. 0x5000b,
  2613. 0x5001b,
  2614. 0x50007,
  2615. 0x50017,
  2616. 0x5000f,
  2617. 0x00000
  2618. ]),
  2619. 5
  2620. ];
  2621. function FlateStream(str, maybeLength) {
  2622. this.str = str;
  2623. this.dict = str.dict;
  2624. var cmf = str.getByte();
  2625. var flg = str.getByte();
  2626. if (cmf === -1 || flg === -1) {
  2627. error('Invalid header in flate stream: ' + cmf + ', ' + flg);
  2628. }
  2629. if ((cmf & 0x0f) !== 0x08) {
  2630. error('Unknown compression method in flate stream: ' + cmf + ', ' + flg);
  2631. }
  2632. if (((cmf << 8) + flg) % 31 !== 0) {
  2633. error('Bad FCHECK in flate stream: ' + cmf + ', ' + flg);
  2634. }
  2635. if (flg & 0x20) {
  2636. error('FDICT bit set in flate stream: ' + cmf + ', ' + flg);
  2637. }
  2638. this.codeSize = 0;
  2639. this.codeBuf = 0;
  2640. DecodeStream.call(this, maybeLength);
  2641. }
  2642. FlateStream.prototype = Object.create(DecodeStream.prototype);
  2643. FlateStream.prototype.getBits = function FlateStream_getBits(bits) {
  2644. var str = this.str;
  2645. var codeSize = this.codeSize;
  2646. var codeBuf = this.codeBuf;
  2647. var b;
  2648. while (codeSize < bits) {
  2649. if ((b = str.getByte()) === -1) {
  2650. error('Bad encoding in flate stream');
  2651. }
  2652. codeBuf |= b << codeSize;
  2653. codeSize += 8;
  2654. }
  2655. b = codeBuf & (1 << bits) - 1;
  2656. this.codeBuf = codeBuf >> bits;
  2657. this.codeSize = codeSize -= bits;
  2658. return b;
  2659. };
  2660. FlateStream.prototype.getCode = function FlateStream_getCode(table) {
  2661. var str = this.str;
  2662. var codes = table[0];
  2663. var maxLen = table[1];
  2664. var codeSize = this.codeSize;
  2665. var codeBuf = this.codeBuf;
  2666. var b;
  2667. while (codeSize < maxLen) {
  2668. if ((b = str.getByte()) === -1) {
  2669. break;
  2670. }
  2671. codeBuf |= b << codeSize;
  2672. codeSize += 8;
  2673. }
  2674. var code = codes[codeBuf & (1 << maxLen) - 1];
  2675. var codeLen = code >> 16;
  2676. var codeVal = code & 0xffff;
  2677. if (codeLen < 1 || codeSize < codeLen) {
  2678. error('Bad encoding in flate stream');
  2679. }
  2680. this.codeBuf = codeBuf >> codeLen;
  2681. this.codeSize = codeSize - codeLen;
  2682. return codeVal;
  2683. };
  2684. FlateStream.prototype.generateHuffmanTable = function flateStreamGenerateHuffmanTable(lengths) {
  2685. var n = lengths.length;
  2686. var maxLen = 0;
  2687. var i;
  2688. for (i = 0; i < n; ++i) {
  2689. if (lengths[i] > maxLen) {
  2690. maxLen = lengths[i];
  2691. }
  2692. }
  2693. var size = 1 << maxLen;
  2694. var codes = new Int32Array(size);
  2695. for (var len = 1, code = 0, skip = 2; len <= maxLen; ++len, code <<= 1, skip <<= 1) {
  2696. for (var val = 0; val < n; ++val) {
  2697. if (lengths[val] === len) {
  2698. var code2 = 0;
  2699. var t = code;
  2700. for (i = 0; i < len; ++i) {
  2701. code2 = code2 << 1 | t & 1;
  2702. t >>= 1;
  2703. }
  2704. for (i = code2; i < size; i += skip) {
  2705. codes[i] = len << 16 | val;
  2706. }
  2707. ++code;
  2708. }
  2709. }
  2710. }
  2711. return [
  2712. codes,
  2713. maxLen
  2714. ];
  2715. };
  2716. FlateStream.prototype.readBlock = function FlateStream_readBlock() {
  2717. var buffer, len;
  2718. var str = this.str;
  2719. var hdr = this.getBits(3);
  2720. if (hdr & 1) {
  2721. this.eof = true;
  2722. }
  2723. hdr >>= 1;
  2724. if (hdr === 0) {
  2725. var b;
  2726. if ((b = str.getByte()) === -1) {
  2727. error('Bad block header in flate stream');
  2728. }
  2729. var blockLen = b;
  2730. if ((b = str.getByte()) === -1) {
  2731. error('Bad block header in flate stream');
  2732. }
  2733. blockLen |= b << 8;
  2734. if ((b = str.getByte()) === -1) {
  2735. error('Bad block header in flate stream');
  2736. }
  2737. var check = b;
  2738. if ((b = str.getByte()) === -1) {
  2739. error('Bad block header in flate stream');
  2740. }
  2741. check |= b << 8;
  2742. if (check !== (~blockLen & 0xffff) && (blockLen !== 0 || check !== 0)) {
  2743. error('Bad uncompressed block length in flate stream');
  2744. }
  2745. this.codeBuf = 0;
  2746. this.codeSize = 0;
  2747. var bufferLength = this.bufferLength;
  2748. buffer = this.ensureBuffer(bufferLength + blockLen);
  2749. var end = bufferLength + blockLen;
  2750. this.bufferLength = end;
  2751. if (blockLen === 0) {
  2752. if (str.peekByte() === -1) {
  2753. this.eof = true;
  2754. }
  2755. } else {
  2756. for (var n = bufferLength; n < end; ++n) {
  2757. if ((b = str.getByte()) === -1) {
  2758. this.eof = true;
  2759. break;
  2760. }
  2761. buffer[n] = b;
  2762. }
  2763. }
  2764. return;
  2765. }
  2766. var litCodeTable;
  2767. var distCodeTable;
  2768. if (hdr === 1) {
  2769. litCodeTable = fixedLitCodeTab;
  2770. distCodeTable = fixedDistCodeTab;
  2771. } else if (hdr === 2) {
  2772. var numLitCodes = this.getBits(5) + 257;
  2773. var numDistCodes = this.getBits(5) + 1;
  2774. var numCodeLenCodes = this.getBits(4) + 4;
  2775. var codeLenCodeLengths = new Uint8Array(codeLenCodeMap.length);
  2776. var i;
  2777. for (i = 0; i < numCodeLenCodes; ++i) {
  2778. codeLenCodeLengths[codeLenCodeMap[i]] = this.getBits(3);
  2779. }
  2780. var codeLenCodeTab = this.generateHuffmanTable(codeLenCodeLengths);
  2781. len = 0;
  2782. i = 0;
  2783. var codes = numLitCodes + numDistCodes;
  2784. var codeLengths = new Uint8Array(codes);
  2785. var bitsLength, bitsOffset, what;
  2786. while (i < codes) {
  2787. var code = this.getCode(codeLenCodeTab);
  2788. if (code === 16) {
  2789. bitsLength = 2;
  2790. bitsOffset = 3;
  2791. what = len;
  2792. } else if (code === 17) {
  2793. bitsLength = 3;
  2794. bitsOffset = 3;
  2795. what = len = 0;
  2796. } else if (code === 18) {
  2797. bitsLength = 7;
  2798. bitsOffset = 11;
  2799. what = len = 0;
  2800. } else {
  2801. codeLengths[i++] = len = code;
  2802. continue;
  2803. }
  2804. var repeatLength = this.getBits(bitsLength) + bitsOffset;
  2805. while (repeatLength-- > 0) {
  2806. codeLengths[i++] = what;
  2807. }
  2808. }
  2809. litCodeTable = this.generateHuffmanTable(codeLengths.subarray(0, numLitCodes));
  2810. distCodeTable = this.generateHuffmanTable(codeLengths.subarray(numLitCodes, codes));
  2811. } else {
  2812. error('Unknown block type in flate stream');
  2813. }
  2814. buffer = this.buffer;
  2815. var limit = buffer ? buffer.length : 0;
  2816. var pos = this.bufferLength;
  2817. while (true) {
  2818. var code1 = this.getCode(litCodeTable);
  2819. if (code1 < 256) {
  2820. if (pos + 1 >= limit) {
  2821. buffer = this.ensureBuffer(pos + 1);
  2822. limit = buffer.length;
  2823. }
  2824. buffer[pos++] = code1;
  2825. continue;
  2826. }
  2827. if (code1 === 256) {
  2828. this.bufferLength = pos;
  2829. return;
  2830. }
  2831. code1 -= 257;
  2832. code1 = lengthDecode[code1];
  2833. var code2 = code1 >> 16;
  2834. if (code2 > 0) {
  2835. code2 = this.getBits(code2);
  2836. }
  2837. len = (code1 & 0xffff) + code2;
  2838. code1 = this.getCode(distCodeTable);
  2839. code1 = distDecode[code1];
  2840. code2 = code1 >> 16;
  2841. if (code2 > 0) {
  2842. code2 = this.getBits(code2);
  2843. }
  2844. var dist = (code1 & 0xffff) + code2;
  2845. if (pos + len >= limit) {
  2846. buffer = this.ensureBuffer(pos + len);
  2847. limit = buffer.length;
  2848. }
  2849. for (var k = 0; k < len; ++k, ++pos) {
  2850. buffer[pos] = buffer[pos - dist];
  2851. }
  2852. }
  2853. };
  2854. return FlateStream;
  2855. }();
  2856. var PredictorStream = function PredictorStreamClosure() {
  2857. function PredictorStream(str, maybeLength, params) {
  2858. if (!isDict(params)) {
  2859. return str;
  2860. }
  2861. var predictor = this.predictor = params.get('Predictor') || 1;
  2862. if (predictor <= 1) {
  2863. return str;
  2864. }
  2865. if (predictor !== 2 && (predictor < 10 || predictor > 15)) {
  2866. error('Unsupported predictor: ' + predictor);
  2867. }
  2868. if (predictor === 2) {
  2869. this.readBlock = this.readBlockTiff;
  2870. } else {
  2871. this.readBlock = this.readBlockPng;
  2872. }
  2873. this.str = str;
  2874. this.dict = str.dict;
  2875. var colors = this.colors = params.get('Colors') || 1;
  2876. var bits = this.bits = params.get('BitsPerComponent') || 8;
  2877. var columns = this.columns = params.get('Columns') || 1;
  2878. this.pixBytes = colors * bits + 7 >> 3;
  2879. this.rowBytes = columns * colors * bits + 7 >> 3;
  2880. DecodeStream.call(this, maybeLength);
  2881. return this;
  2882. }
  2883. PredictorStream.prototype = Object.create(DecodeStream.prototype);
  2884. PredictorStream.prototype.readBlockTiff = function predictorStreamReadBlockTiff() {
  2885. var rowBytes = this.rowBytes;
  2886. var bufferLength = this.bufferLength;
  2887. var buffer = this.ensureBuffer(bufferLength + rowBytes);
  2888. var bits = this.bits;
  2889. var colors = this.colors;
  2890. var rawBytes = this.str.getBytes(rowBytes);
  2891. this.eof = !rawBytes.length;
  2892. if (this.eof) {
  2893. return;
  2894. }
  2895. var inbuf = 0, outbuf = 0;
  2896. var inbits = 0, outbits = 0;
  2897. var pos = bufferLength;
  2898. var i;
  2899. if (bits === 1 && colors === 1) {
  2900. for (i = 0; i < rowBytes; ++i) {
  2901. var c = rawBytes[i] ^ inbuf;
  2902. c ^= c >> 1;
  2903. c ^= c >> 2;
  2904. c ^= c >> 4;
  2905. inbuf = (c & 1) << 7;
  2906. buffer[pos++] = c;
  2907. }
  2908. } else if (bits === 8) {
  2909. for (i = 0; i < colors; ++i) {
  2910. buffer[pos++] = rawBytes[i];
  2911. }
  2912. for (; i < rowBytes; ++i) {
  2913. buffer[pos] = buffer[pos - colors] + rawBytes[i];
  2914. pos++;
  2915. }
  2916. } else {
  2917. var compArray = new Uint8Array(colors + 1);
  2918. var bitMask = (1 << bits) - 1;
  2919. var j = 0, k = bufferLength;
  2920. var columns = this.columns;
  2921. for (i = 0; i < columns; ++i) {
  2922. for (var kk = 0; kk < colors; ++kk) {
  2923. if (inbits < bits) {
  2924. inbuf = inbuf << 8 | rawBytes[j++] & 0xFF;
  2925. inbits += 8;
  2926. }
  2927. compArray[kk] = compArray[kk] + (inbuf >> inbits - bits) & bitMask;
  2928. inbits -= bits;
  2929. outbuf = outbuf << bits | compArray[kk];
  2930. outbits += bits;
  2931. if (outbits >= 8) {
  2932. buffer[k++] = outbuf >> outbits - 8 & 0xFF;
  2933. outbits -= 8;
  2934. }
  2935. }
  2936. }
  2937. if (outbits > 0) {
  2938. buffer[k++] = (outbuf << 8 - outbits) + (inbuf & (1 << 8 - outbits) - 1);
  2939. }
  2940. }
  2941. this.bufferLength += rowBytes;
  2942. };
  2943. PredictorStream.prototype.readBlockPng = function predictorStreamReadBlockPng() {
  2944. var rowBytes = this.rowBytes;
  2945. var pixBytes = this.pixBytes;
  2946. var predictor = this.str.getByte();
  2947. var rawBytes = this.str.getBytes(rowBytes);
  2948. this.eof = !rawBytes.length;
  2949. if (this.eof) {
  2950. return;
  2951. }
  2952. var bufferLength = this.bufferLength;
  2953. var buffer = this.ensureBuffer(bufferLength + rowBytes);
  2954. var prevRow = buffer.subarray(bufferLength - rowBytes, bufferLength);
  2955. if (prevRow.length === 0) {
  2956. prevRow = new Uint8Array(rowBytes);
  2957. }
  2958. var i, j = bufferLength, up, c;
  2959. switch (predictor) {
  2960. case 0:
  2961. for (i = 0; i < rowBytes; ++i) {
  2962. buffer[j++] = rawBytes[i];
  2963. }
  2964. break;
  2965. case 1:
  2966. for (i = 0; i < pixBytes; ++i) {
  2967. buffer[j++] = rawBytes[i];
  2968. }
  2969. for (; i < rowBytes; ++i) {
  2970. buffer[j] = buffer[j - pixBytes] + rawBytes[i] & 0xFF;
  2971. j++;
  2972. }
  2973. break;
  2974. case 2:
  2975. for (i = 0; i < rowBytes; ++i) {
  2976. buffer[j++] = prevRow[i] + rawBytes[i] & 0xFF;
  2977. }
  2978. break;
  2979. case 3:
  2980. for (i = 0; i < pixBytes; ++i) {
  2981. buffer[j++] = (prevRow[i] >> 1) + rawBytes[i];
  2982. }
  2983. for (; i < rowBytes; ++i) {
  2984. buffer[j] = (prevRow[i] + buffer[j - pixBytes] >> 1) + rawBytes[i] & 0xFF;
  2985. j++;
  2986. }
  2987. break;
  2988. case 4:
  2989. for (i = 0; i < pixBytes; ++i) {
  2990. up = prevRow[i];
  2991. c = rawBytes[i];
  2992. buffer[j++] = up + c;
  2993. }
  2994. for (; i < rowBytes; ++i) {
  2995. up = prevRow[i];
  2996. var upLeft = prevRow[i - pixBytes];
  2997. var left = buffer[j - pixBytes];
  2998. var p = left + up - upLeft;
  2999. var pa = p - left;
  3000. if (pa < 0) {
  3001. pa = -pa;
  3002. }
  3003. var pb = p - up;
  3004. if (pb < 0) {
  3005. pb = -pb;
  3006. }
  3007. var pc = p - upLeft;
  3008. if (pc < 0) {
  3009. pc = -pc;
  3010. }
  3011. c = rawBytes[i];
  3012. if (pa <= pb && pa <= pc) {
  3013. buffer[j++] = left + c;
  3014. } else if (pb <= pc) {
  3015. buffer[j++] = up + c;
  3016. } else {
  3017. buffer[j++] = upLeft + c;
  3018. }
  3019. }
  3020. break;
  3021. default:
  3022. error('Unsupported predictor: ' + predictor);
  3023. }
  3024. this.bufferLength += rowBytes;
  3025. };
  3026. return PredictorStream;
  3027. }();
  3028. var JpegStream = function JpegStreamClosure() {
  3029. function JpegStream(stream, maybeLength, dict, params) {
  3030. var ch;
  3031. while ((ch = stream.getByte()) !== -1) {
  3032. if (ch === 0xFF) {
  3033. stream.skip(-1);
  3034. break;
  3035. }
  3036. }
  3037. this.stream = stream;
  3038. this.maybeLength = maybeLength;
  3039. this.dict = dict;
  3040. this.params = params;
  3041. DecodeStream.call(this, maybeLength);
  3042. }
  3043. JpegStream.prototype = Object.create(DecodeStream.prototype);
  3044. Object.defineProperty(JpegStream.prototype, 'bytes', {
  3045. get: function JpegStream_bytes() {
  3046. return shadow(this, 'bytes', this.stream.getBytes(this.maybeLength));
  3047. },
  3048. configurable: true
  3049. });
  3050. JpegStream.prototype.ensureBuffer = function JpegStream_ensureBuffer(req) {
  3051. if (this.bufferLength) {
  3052. return;
  3053. }
  3054. var jpegImage = new JpegImage();
  3055. var decodeArr = this.dict.getArray('Decode', 'D');
  3056. if (this.forceRGB && isArray(decodeArr)) {
  3057. var bitsPerComponent = this.dict.get('BitsPerComponent') || 8;
  3058. var decodeArrLength = decodeArr.length;
  3059. var transform = new Int32Array(decodeArrLength);
  3060. var transformNeeded = false;
  3061. var maxValue = (1 << bitsPerComponent) - 1;
  3062. for (var i = 0; i < decodeArrLength; i += 2) {
  3063. transform[i] = (decodeArr[i + 1] - decodeArr[i]) * 256 | 0;
  3064. transform[i + 1] = decodeArr[i] * maxValue | 0;
  3065. if (transform[i] !== 256 || transform[i + 1] !== 0) {
  3066. transformNeeded = true;
  3067. }
  3068. }
  3069. if (transformNeeded) {
  3070. jpegImage.decodeTransform = transform;
  3071. }
  3072. }
  3073. if (isDict(this.params)) {
  3074. var colorTransform = this.params.get('ColorTransform');
  3075. if (isInt(colorTransform)) {
  3076. jpegImage.colorTransform = colorTransform;
  3077. }
  3078. }
  3079. jpegImage.parse(this.bytes);
  3080. var data = jpegImage.getData(this.drawWidth, this.drawHeight, this.forceRGB);
  3081. this.buffer = data;
  3082. this.bufferLength = data.length;
  3083. this.eof = true;
  3084. };
  3085. JpegStream.prototype.getBytes = function JpegStream_getBytes(length) {
  3086. this.ensureBuffer();
  3087. return this.buffer;
  3088. };
  3089. JpegStream.prototype.getIR = function JpegStream_getIR(forceDataSchema) {
  3090. return createObjectURL(this.bytes, 'image/jpeg', forceDataSchema);
  3091. };
  3092. return JpegStream;
  3093. }();
  3094. var JpxStream = function JpxStreamClosure() {
  3095. function JpxStream(stream, maybeLength, dict, params) {
  3096. this.stream = stream;
  3097. this.maybeLength = maybeLength;
  3098. this.dict = dict;
  3099. this.params = params;
  3100. DecodeStream.call(this, maybeLength);
  3101. }
  3102. JpxStream.prototype = Object.create(DecodeStream.prototype);
  3103. Object.defineProperty(JpxStream.prototype, 'bytes', {
  3104. get: function JpxStream_bytes() {
  3105. return shadow(this, 'bytes', this.stream.getBytes(this.maybeLength));
  3106. },
  3107. configurable: true
  3108. });
  3109. JpxStream.prototype.ensureBuffer = function JpxStream_ensureBuffer(req) {
  3110. if (this.bufferLength) {
  3111. return;
  3112. }
  3113. var jpxImage = new JpxImage();
  3114. jpxImage.parse(this.bytes);
  3115. var width = jpxImage.width;
  3116. var height = jpxImage.height;
  3117. var componentsCount = jpxImage.componentsCount;
  3118. var tileCount = jpxImage.tiles.length;
  3119. if (tileCount === 1) {
  3120. this.buffer = jpxImage.tiles[0].items;
  3121. } else {
  3122. var data = new Uint8Array(width * height * componentsCount);
  3123. for (var k = 0; k < tileCount; k++) {
  3124. var tileComponents = jpxImage.tiles[k];
  3125. var tileWidth = tileComponents.width;
  3126. var tileHeight = tileComponents.height;
  3127. var tileLeft = tileComponents.left;
  3128. var tileTop = tileComponents.top;
  3129. var src = tileComponents.items;
  3130. var srcPosition = 0;
  3131. var dataPosition = (width * tileTop + tileLeft) * componentsCount;
  3132. var imgRowSize = width * componentsCount;
  3133. var tileRowSize = tileWidth * componentsCount;
  3134. for (var j = 0; j < tileHeight; j++) {
  3135. var rowBytes = src.subarray(srcPosition, srcPosition + tileRowSize);
  3136. data.set(rowBytes, dataPosition);
  3137. srcPosition += tileRowSize;
  3138. dataPosition += imgRowSize;
  3139. }
  3140. }
  3141. this.buffer = data;
  3142. }
  3143. this.bufferLength = this.buffer.length;
  3144. this.eof = true;
  3145. };
  3146. return JpxStream;
  3147. }();
  3148. var Jbig2Stream = function Jbig2StreamClosure() {
  3149. function Jbig2Stream(stream, maybeLength, dict, params) {
  3150. this.stream = stream;
  3151. this.maybeLength = maybeLength;
  3152. this.dict = dict;
  3153. this.params = params;
  3154. DecodeStream.call(this, maybeLength);
  3155. }
  3156. Jbig2Stream.prototype = Object.create(DecodeStream.prototype);
  3157. Object.defineProperty(Jbig2Stream.prototype, 'bytes', {
  3158. get: function Jbig2Stream_bytes() {
  3159. return shadow(this, 'bytes', this.stream.getBytes(this.maybeLength));
  3160. },
  3161. configurable: true
  3162. });
  3163. Jbig2Stream.prototype.ensureBuffer = function Jbig2Stream_ensureBuffer(req) {
  3164. if (this.bufferLength) {
  3165. return;
  3166. }
  3167. var jbig2Image = new Jbig2Image();
  3168. var chunks = [];
  3169. if (isDict(this.params)) {
  3170. var globalsStream = this.params.get('JBIG2Globals');
  3171. if (isStream(globalsStream)) {
  3172. var globals = globalsStream.getBytes();
  3173. chunks.push({
  3174. data: globals,
  3175. start: 0,
  3176. end: globals.length
  3177. });
  3178. }
  3179. }
  3180. chunks.push({
  3181. data: this.bytes,
  3182. start: 0,
  3183. end: this.bytes.length
  3184. });
  3185. var data = jbig2Image.parseChunks(chunks);
  3186. var dataLength = data.length;
  3187. for (var i = 0; i < dataLength; i++) {
  3188. data[i] ^= 0xFF;
  3189. }
  3190. this.buffer = data;
  3191. this.bufferLength = dataLength;
  3192. this.eof = true;
  3193. };
  3194. return Jbig2Stream;
  3195. }();
  3196. var DecryptStream = function DecryptStreamClosure() {
  3197. function DecryptStream(str, maybeLength, decrypt) {
  3198. this.str = str;
  3199. this.dict = str.dict;
  3200. this.decrypt = decrypt;
  3201. this.nextChunk = null;
  3202. this.initialized = false;
  3203. DecodeStream.call(this, maybeLength);
  3204. }
  3205. var chunkSize = 512;
  3206. DecryptStream.prototype = Object.create(DecodeStream.prototype);
  3207. DecryptStream.prototype.readBlock = function DecryptStream_readBlock() {
  3208. var chunk;
  3209. if (this.initialized) {
  3210. chunk = this.nextChunk;
  3211. } else {
  3212. chunk = this.str.getBytes(chunkSize);
  3213. this.initialized = true;
  3214. }
  3215. if (!chunk || chunk.length === 0) {
  3216. this.eof = true;
  3217. return;
  3218. }
  3219. this.nextChunk = this.str.getBytes(chunkSize);
  3220. var hasMoreData = this.nextChunk && this.nextChunk.length > 0;
  3221. var decrypt = this.decrypt;
  3222. chunk = decrypt(chunk, !hasMoreData);
  3223. var bufferLength = this.bufferLength;
  3224. var i, n = chunk.length;
  3225. var buffer = this.ensureBuffer(bufferLength + n);
  3226. for (i = 0; i < n; i++) {
  3227. buffer[bufferLength++] = chunk[i];
  3228. }
  3229. this.bufferLength = bufferLength;
  3230. };
  3231. return DecryptStream;
  3232. }();
  3233. var Ascii85Stream = function Ascii85StreamClosure() {
  3234. function Ascii85Stream(str, maybeLength) {
  3235. this.str = str;
  3236. this.dict = str.dict;
  3237. this.input = new Uint8Array(5);
  3238. if (maybeLength) {
  3239. maybeLength = 0.8 * maybeLength;
  3240. }
  3241. DecodeStream.call(this, maybeLength);
  3242. }
  3243. Ascii85Stream.prototype = Object.create(DecodeStream.prototype);
  3244. Ascii85Stream.prototype.readBlock = function Ascii85Stream_readBlock() {
  3245. var TILDA_CHAR = 0x7E;
  3246. var Z_LOWER_CHAR = 0x7A;
  3247. var EOF = -1;
  3248. var str = this.str;
  3249. var c = str.getByte();
  3250. while (isSpace(c)) {
  3251. c = str.getByte();
  3252. }
  3253. if (c === EOF || c === TILDA_CHAR) {
  3254. this.eof = true;
  3255. return;
  3256. }
  3257. var bufferLength = this.bufferLength, buffer;
  3258. var i;
  3259. if (c === Z_LOWER_CHAR) {
  3260. buffer = this.ensureBuffer(bufferLength + 4);
  3261. for (i = 0; i < 4; ++i) {
  3262. buffer[bufferLength + i] = 0;
  3263. }
  3264. this.bufferLength += 4;
  3265. } else {
  3266. var input = this.input;
  3267. input[0] = c;
  3268. for (i = 1; i < 5; ++i) {
  3269. c = str.getByte();
  3270. while (isSpace(c)) {
  3271. c = str.getByte();
  3272. }
  3273. input[i] = c;
  3274. if (c === EOF || c === TILDA_CHAR) {
  3275. break;
  3276. }
  3277. }
  3278. buffer = this.ensureBuffer(bufferLength + i - 1);
  3279. this.bufferLength += i - 1;
  3280. if (i < 5) {
  3281. for (; i < 5; ++i) {
  3282. input[i] = 0x21 + 84;
  3283. }
  3284. this.eof = true;
  3285. }
  3286. var t = 0;
  3287. for (i = 0; i < 5; ++i) {
  3288. t = t * 85 + (input[i] - 0x21);
  3289. }
  3290. for (i = 3; i >= 0; --i) {
  3291. buffer[bufferLength + i] = t & 0xFF;
  3292. t >>= 8;
  3293. }
  3294. }
  3295. };
  3296. return Ascii85Stream;
  3297. }();
  3298. var AsciiHexStream = function AsciiHexStreamClosure() {
  3299. function AsciiHexStream(str, maybeLength) {
  3300. this.str = str;
  3301. this.dict = str.dict;
  3302. this.firstDigit = -1;
  3303. if (maybeLength) {
  3304. maybeLength = 0.5 * maybeLength;
  3305. }
  3306. DecodeStream.call(this, maybeLength);
  3307. }
  3308. AsciiHexStream.prototype = Object.create(DecodeStream.prototype);
  3309. AsciiHexStream.prototype.readBlock = function AsciiHexStream_readBlock() {
  3310. var UPSTREAM_BLOCK_SIZE = 8000;
  3311. var bytes = this.str.getBytes(UPSTREAM_BLOCK_SIZE);
  3312. if (!bytes.length) {
  3313. this.eof = true;
  3314. return;
  3315. }
  3316. var maxDecodeLength = bytes.length + 1 >> 1;
  3317. var buffer = this.ensureBuffer(this.bufferLength + maxDecodeLength);
  3318. var bufferLength = this.bufferLength;
  3319. var firstDigit = this.firstDigit;
  3320. for (var i = 0, ii = bytes.length; i < ii; i++) {
  3321. var ch = bytes[i], digit;
  3322. if (ch >= 0x30 && ch <= 0x39) {
  3323. digit = ch & 0x0F;
  3324. } else if (ch >= 0x41 && ch <= 0x46 || ch >= 0x61 && ch <= 0x66) {
  3325. digit = (ch & 0x0F) + 9;
  3326. } else if (ch === 0x3E) {
  3327. this.eof = true;
  3328. break;
  3329. } else {
  3330. continue;
  3331. }
  3332. if (firstDigit < 0) {
  3333. firstDigit = digit;
  3334. } else {
  3335. buffer[bufferLength++] = firstDigit << 4 | digit;
  3336. firstDigit = -1;
  3337. }
  3338. }
  3339. if (firstDigit >= 0 && this.eof) {
  3340. buffer[bufferLength++] = firstDigit << 4;
  3341. firstDigit = -1;
  3342. }
  3343. this.firstDigit = firstDigit;
  3344. this.bufferLength = bufferLength;
  3345. };
  3346. return AsciiHexStream;
  3347. }();
  3348. var RunLengthStream = function RunLengthStreamClosure() {
  3349. function RunLengthStream(str, maybeLength) {
  3350. this.str = str;
  3351. this.dict = str.dict;
  3352. DecodeStream.call(this, maybeLength);
  3353. }
  3354. RunLengthStream.prototype = Object.create(DecodeStream.prototype);
  3355. RunLengthStream.prototype.readBlock = function RunLengthStream_readBlock() {
  3356. var repeatHeader = this.str.getBytes(2);
  3357. if (!repeatHeader || repeatHeader.length < 2 || repeatHeader[0] === 128) {
  3358. this.eof = true;
  3359. return;
  3360. }
  3361. var buffer;
  3362. var bufferLength = this.bufferLength;
  3363. var n = repeatHeader[0];
  3364. if (n < 128) {
  3365. buffer = this.ensureBuffer(bufferLength + n + 1);
  3366. buffer[bufferLength++] = repeatHeader[1];
  3367. if (n > 0) {
  3368. var source = this.str.getBytes(n);
  3369. buffer.set(source, bufferLength);
  3370. bufferLength += n;
  3371. }
  3372. } else {
  3373. n = 257 - n;
  3374. var b = repeatHeader[1];
  3375. buffer = this.ensureBuffer(bufferLength + n + 1);
  3376. for (var i = 0; i < n; i++) {
  3377. buffer[bufferLength++] = b;
  3378. }
  3379. }
  3380. this.bufferLength = bufferLength;
  3381. };
  3382. return RunLengthStream;
  3383. }();
  3384. var CCITTFaxStream = function CCITTFaxStreamClosure() {
  3385. var ccittEOL = -2;
  3386. var ccittEOF = -1;
  3387. var twoDimPass = 0;
  3388. var twoDimHoriz = 1;
  3389. var twoDimVert0 = 2;
  3390. var twoDimVertR1 = 3;
  3391. var twoDimVertL1 = 4;
  3392. var twoDimVertR2 = 5;
  3393. var twoDimVertL2 = 6;
  3394. var twoDimVertR3 = 7;
  3395. var twoDimVertL3 = 8;
  3396. var twoDimTable = [
  3397. [
  3398. -1,
  3399. -1
  3400. ],
  3401. [
  3402. -1,
  3403. -1
  3404. ],
  3405. [
  3406. 7,
  3407. twoDimVertL3
  3408. ],
  3409. [
  3410. 7,
  3411. twoDimVertR3
  3412. ],
  3413. [
  3414. 6,
  3415. twoDimVertL2
  3416. ],
  3417. [
  3418. 6,
  3419. twoDimVertL2
  3420. ],
  3421. [
  3422. 6,
  3423. twoDimVertR2
  3424. ],
  3425. [
  3426. 6,
  3427. twoDimVertR2
  3428. ],
  3429. [
  3430. 4,
  3431. twoDimPass
  3432. ],
  3433. [
  3434. 4,
  3435. twoDimPass
  3436. ],
  3437. [
  3438. 4,
  3439. twoDimPass
  3440. ],
  3441. [
  3442. 4,
  3443. twoDimPass
  3444. ],
  3445. [
  3446. 4,
  3447. twoDimPass
  3448. ],
  3449. [
  3450. 4,
  3451. twoDimPass
  3452. ],
  3453. [
  3454. 4,
  3455. twoDimPass
  3456. ],
  3457. [
  3458. 4,
  3459. twoDimPass
  3460. ],
  3461. [
  3462. 3,
  3463. twoDimHoriz
  3464. ],
  3465. [
  3466. 3,
  3467. twoDimHoriz
  3468. ],
  3469. [
  3470. 3,
  3471. twoDimHoriz
  3472. ],
  3473. [
  3474. 3,
  3475. twoDimHoriz
  3476. ],
  3477. [
  3478. 3,
  3479. twoDimHoriz
  3480. ],
  3481. [
  3482. 3,
  3483. twoDimHoriz
  3484. ],
  3485. [
  3486. 3,
  3487. twoDimHoriz
  3488. ],
  3489. [
  3490. 3,
  3491. twoDimHoriz
  3492. ],
  3493. [
  3494. 3,
  3495. twoDimHoriz
  3496. ],
  3497. [
  3498. 3,
  3499. twoDimHoriz
  3500. ],
  3501. [
  3502. 3,
  3503. twoDimHoriz
  3504. ],
  3505. [
  3506. 3,
  3507. twoDimHoriz
  3508. ],
  3509. [
  3510. 3,
  3511. twoDimHoriz
  3512. ],
  3513. [
  3514. 3,
  3515. twoDimHoriz
  3516. ],
  3517. [
  3518. 3,
  3519. twoDimHoriz
  3520. ],
  3521. [
  3522. 3,
  3523. twoDimHoriz
  3524. ],
  3525. [
  3526. 3,
  3527. twoDimVertL1
  3528. ],
  3529. [
  3530. 3,
  3531. twoDimVertL1
  3532. ],
  3533. [
  3534. 3,
  3535. twoDimVertL1
  3536. ],
  3537. [
  3538. 3,
  3539. twoDimVertL1
  3540. ],
  3541. [
  3542. 3,
  3543. twoDimVertL1
  3544. ],
  3545. [
  3546. 3,
  3547. twoDimVertL1
  3548. ],
  3549. [
  3550. 3,
  3551. twoDimVertL1
  3552. ],
  3553. [
  3554. 3,
  3555. twoDimVertL1
  3556. ],
  3557. [
  3558. 3,
  3559. twoDimVertL1
  3560. ],
  3561. [
  3562. 3,
  3563. twoDimVertL1
  3564. ],
  3565. [
  3566. 3,
  3567. twoDimVertL1
  3568. ],
  3569. [
  3570. 3,
  3571. twoDimVertL1
  3572. ],
  3573. [
  3574. 3,
  3575. twoDimVertL1
  3576. ],
  3577. [
  3578. 3,
  3579. twoDimVertL1
  3580. ],
  3581. [
  3582. 3,
  3583. twoDimVertL1
  3584. ],
  3585. [
  3586. 3,
  3587. twoDimVertL1
  3588. ],
  3589. [
  3590. 3,
  3591. twoDimVertR1
  3592. ],
  3593. [
  3594. 3,
  3595. twoDimVertR1
  3596. ],
  3597. [
  3598. 3,
  3599. twoDimVertR1
  3600. ],
  3601. [
  3602. 3,
  3603. twoDimVertR1
  3604. ],
  3605. [
  3606. 3,
  3607. twoDimVertR1
  3608. ],
  3609. [
  3610. 3,
  3611. twoDimVertR1
  3612. ],
  3613. [
  3614. 3,
  3615. twoDimVertR1
  3616. ],
  3617. [
  3618. 3,
  3619. twoDimVertR1
  3620. ],
  3621. [
  3622. 3,
  3623. twoDimVertR1
  3624. ],
  3625. [
  3626. 3,
  3627. twoDimVertR1
  3628. ],
  3629. [
  3630. 3,
  3631. twoDimVertR1
  3632. ],
  3633. [
  3634. 3,
  3635. twoDimVertR1
  3636. ],
  3637. [
  3638. 3,
  3639. twoDimVertR1
  3640. ],
  3641. [
  3642. 3,
  3643. twoDimVertR1
  3644. ],
  3645. [
  3646. 3,
  3647. twoDimVertR1
  3648. ],
  3649. [
  3650. 3,
  3651. twoDimVertR1
  3652. ],
  3653. [
  3654. 1,
  3655. twoDimVert0
  3656. ],
  3657. [
  3658. 1,
  3659. twoDimVert0
  3660. ],
  3661. [
  3662. 1,
  3663. twoDimVert0
  3664. ],
  3665. [
  3666. 1,
  3667. twoDimVert0
  3668. ],
  3669. [
  3670. 1,
  3671. twoDimVert0
  3672. ],
  3673. [
  3674. 1,
  3675. twoDimVert0
  3676. ],
  3677. [
  3678. 1,
  3679. twoDimVert0
  3680. ],
  3681. [
  3682. 1,
  3683. twoDimVert0
  3684. ],
  3685. [
  3686. 1,
  3687. twoDimVert0
  3688. ],
  3689. [
  3690. 1,
  3691. twoDimVert0
  3692. ],
  3693. [
  3694. 1,
  3695. twoDimVert0
  3696. ],
  3697. [
  3698. 1,
  3699. twoDimVert0
  3700. ],
  3701. [
  3702. 1,
  3703. twoDimVert0
  3704. ],
  3705. [
  3706. 1,
  3707. twoDimVert0
  3708. ],
  3709. [
  3710. 1,
  3711. twoDimVert0
  3712. ],
  3713. [
  3714. 1,
  3715. twoDimVert0
  3716. ],
  3717. [
  3718. 1,
  3719. twoDimVert0
  3720. ],
  3721. [
  3722. 1,
  3723. twoDimVert0
  3724. ],
  3725. [
  3726. 1,
  3727. twoDimVert0
  3728. ],
  3729. [
  3730. 1,
  3731. twoDimVert0
  3732. ],
  3733. [
  3734. 1,
  3735. twoDimVert0
  3736. ],
  3737. [
  3738. 1,
  3739. twoDimVert0
  3740. ],
  3741. [
  3742. 1,
  3743. twoDimVert0
  3744. ],
  3745. [
  3746. 1,
  3747. twoDimVert0
  3748. ],
  3749. [
  3750. 1,
  3751. twoDimVert0
  3752. ],
  3753. [
  3754. 1,
  3755. twoDimVert0
  3756. ],
  3757. [
  3758. 1,
  3759. twoDimVert0
  3760. ],
  3761. [
  3762. 1,
  3763. twoDimVert0
  3764. ],
  3765. [
  3766. 1,
  3767. twoDimVert0
  3768. ],
  3769. [
  3770. 1,
  3771. twoDimVert0
  3772. ],
  3773. [
  3774. 1,
  3775. twoDimVert0
  3776. ],
  3777. [
  3778. 1,
  3779. twoDimVert0
  3780. ],
  3781. [
  3782. 1,
  3783. twoDimVert0
  3784. ],
  3785. [
  3786. 1,
  3787. twoDimVert0
  3788. ],
  3789. [
  3790. 1,
  3791. twoDimVert0
  3792. ],
  3793. [
  3794. 1,
  3795. twoDimVert0
  3796. ],
  3797. [
  3798. 1,
  3799. twoDimVert0
  3800. ],
  3801. [
  3802. 1,
  3803. twoDimVert0
  3804. ],
  3805. [
  3806. 1,
  3807. twoDimVert0
  3808. ],
  3809. [
  3810. 1,
  3811. twoDimVert0
  3812. ],
  3813. [
  3814. 1,
  3815. twoDimVert0
  3816. ],
  3817. [
  3818. 1,
  3819. twoDimVert0
  3820. ],
  3821. [
  3822. 1,
  3823. twoDimVert0
  3824. ],
  3825. [
  3826. 1,
  3827. twoDimVert0
  3828. ],
  3829. [
  3830. 1,
  3831. twoDimVert0
  3832. ],
  3833. [
  3834. 1,
  3835. twoDimVert0
  3836. ],
  3837. [
  3838. 1,
  3839. twoDimVert0
  3840. ],
  3841. [
  3842. 1,
  3843. twoDimVert0
  3844. ],
  3845. [
  3846. 1,
  3847. twoDimVert0
  3848. ],
  3849. [
  3850. 1,
  3851. twoDimVert0
  3852. ],
  3853. [
  3854. 1,
  3855. twoDimVert0
  3856. ],
  3857. [
  3858. 1,
  3859. twoDimVert0
  3860. ],
  3861. [
  3862. 1,
  3863. twoDimVert0
  3864. ],
  3865. [
  3866. 1,
  3867. twoDimVert0
  3868. ],
  3869. [
  3870. 1,
  3871. twoDimVert0
  3872. ],
  3873. [
  3874. 1,
  3875. twoDimVert0
  3876. ],
  3877. [
  3878. 1,
  3879. twoDimVert0
  3880. ],
  3881. [
  3882. 1,
  3883. twoDimVert0
  3884. ],
  3885. [
  3886. 1,
  3887. twoDimVert0
  3888. ],
  3889. [
  3890. 1,
  3891. twoDimVert0
  3892. ],
  3893. [
  3894. 1,
  3895. twoDimVert0
  3896. ],
  3897. [
  3898. 1,
  3899. twoDimVert0
  3900. ],
  3901. [
  3902. 1,
  3903. twoDimVert0
  3904. ],
  3905. [
  3906. 1,
  3907. twoDimVert0
  3908. ]
  3909. ];
  3910. var whiteTable1 = [
  3911. [
  3912. -1,
  3913. -1
  3914. ],
  3915. [
  3916. 12,
  3917. ccittEOL
  3918. ],
  3919. [
  3920. -1,
  3921. -1
  3922. ],
  3923. [
  3924. -1,
  3925. -1
  3926. ],
  3927. [
  3928. -1,
  3929. -1
  3930. ],
  3931. [
  3932. -1,
  3933. -1
  3934. ],
  3935. [
  3936. -1,
  3937. -1
  3938. ],
  3939. [
  3940. -1,
  3941. -1
  3942. ],
  3943. [
  3944. -1,
  3945. -1
  3946. ],
  3947. [
  3948. -1,
  3949. -1
  3950. ],
  3951. [
  3952. -1,
  3953. -1
  3954. ],
  3955. [
  3956. -1,
  3957. -1
  3958. ],
  3959. [
  3960. -1,
  3961. -1
  3962. ],
  3963. [
  3964. -1,
  3965. -1
  3966. ],
  3967. [
  3968. -1,
  3969. -1
  3970. ],
  3971. [
  3972. -1,
  3973. -1
  3974. ],
  3975. [
  3976. 11,
  3977. 1792
  3978. ],
  3979. [
  3980. 11,
  3981. 1792
  3982. ],
  3983. [
  3984. 12,
  3985. 1984
  3986. ],
  3987. [
  3988. 12,
  3989. 2048
  3990. ],
  3991. [
  3992. 12,
  3993. 2112
  3994. ],
  3995. [
  3996. 12,
  3997. 2176
  3998. ],
  3999. [
  4000. 12,
  4001. 2240
  4002. ],
  4003. [
  4004. 12,
  4005. 2304
  4006. ],
  4007. [
  4008. 11,
  4009. 1856
  4010. ],
  4011. [
  4012. 11,
  4013. 1856
  4014. ],
  4015. [
  4016. 11,
  4017. 1920
  4018. ],
  4019. [
  4020. 11,
  4021. 1920
  4022. ],
  4023. [
  4024. 12,
  4025. 2368
  4026. ],
  4027. [
  4028. 12,
  4029. 2432
  4030. ],
  4031. [
  4032. 12,
  4033. 2496
  4034. ],
  4035. [
  4036. 12,
  4037. 2560
  4038. ]
  4039. ];
  4040. var whiteTable2 = [
  4041. [
  4042. -1,
  4043. -1
  4044. ],
  4045. [
  4046. -1,
  4047. -1
  4048. ],
  4049. [
  4050. -1,
  4051. -1
  4052. ],
  4053. [
  4054. -1,
  4055. -1
  4056. ],
  4057. [
  4058. 8,
  4059. 29
  4060. ],
  4061. [
  4062. 8,
  4063. 29
  4064. ],
  4065. [
  4066. 8,
  4067. 30
  4068. ],
  4069. [
  4070. 8,
  4071. 30
  4072. ],
  4073. [
  4074. 8,
  4075. 45
  4076. ],
  4077. [
  4078. 8,
  4079. 45
  4080. ],
  4081. [
  4082. 8,
  4083. 46
  4084. ],
  4085. [
  4086. 8,
  4087. 46
  4088. ],
  4089. [
  4090. 7,
  4091. 22
  4092. ],
  4093. [
  4094. 7,
  4095. 22
  4096. ],
  4097. [
  4098. 7,
  4099. 22
  4100. ],
  4101. [
  4102. 7,
  4103. 22
  4104. ],
  4105. [
  4106. 7,
  4107. 23
  4108. ],
  4109. [
  4110. 7,
  4111. 23
  4112. ],
  4113. [
  4114. 7,
  4115. 23
  4116. ],
  4117. [
  4118. 7,
  4119. 23
  4120. ],
  4121. [
  4122. 8,
  4123. 47
  4124. ],
  4125. [
  4126. 8,
  4127. 47
  4128. ],
  4129. [
  4130. 8,
  4131. 48
  4132. ],
  4133. [
  4134. 8,
  4135. 48
  4136. ],
  4137. [
  4138. 6,
  4139. 13
  4140. ],
  4141. [
  4142. 6,
  4143. 13
  4144. ],
  4145. [
  4146. 6,
  4147. 13
  4148. ],
  4149. [
  4150. 6,
  4151. 13
  4152. ],
  4153. [
  4154. 6,
  4155. 13
  4156. ],
  4157. [
  4158. 6,
  4159. 13
  4160. ],
  4161. [
  4162. 6,
  4163. 13
  4164. ],
  4165. [
  4166. 6,
  4167. 13
  4168. ],
  4169. [
  4170. 7,
  4171. 20
  4172. ],
  4173. [
  4174. 7,
  4175. 20
  4176. ],
  4177. [
  4178. 7,
  4179. 20
  4180. ],
  4181. [
  4182. 7,
  4183. 20
  4184. ],
  4185. [
  4186. 8,
  4187. 33
  4188. ],
  4189. [
  4190. 8,
  4191. 33
  4192. ],
  4193. [
  4194. 8,
  4195. 34
  4196. ],
  4197. [
  4198. 8,
  4199. 34
  4200. ],
  4201. [
  4202. 8,
  4203. 35
  4204. ],
  4205. [
  4206. 8,
  4207. 35
  4208. ],
  4209. [
  4210. 8,
  4211. 36
  4212. ],
  4213. [
  4214. 8,
  4215. 36
  4216. ],
  4217. [
  4218. 8,
  4219. 37
  4220. ],
  4221. [
  4222. 8,
  4223. 37
  4224. ],
  4225. [
  4226. 8,
  4227. 38
  4228. ],
  4229. [
  4230. 8,
  4231. 38
  4232. ],
  4233. [
  4234. 7,
  4235. 19
  4236. ],
  4237. [
  4238. 7,
  4239. 19
  4240. ],
  4241. [
  4242. 7,
  4243. 19
  4244. ],
  4245. [
  4246. 7,
  4247. 19
  4248. ],
  4249. [
  4250. 8,
  4251. 31
  4252. ],
  4253. [
  4254. 8,
  4255. 31
  4256. ],
  4257. [
  4258. 8,
  4259. 32
  4260. ],
  4261. [
  4262. 8,
  4263. 32
  4264. ],
  4265. [
  4266. 6,
  4267. 1
  4268. ],
  4269. [
  4270. 6,
  4271. 1
  4272. ],
  4273. [
  4274. 6,
  4275. 1
  4276. ],
  4277. [
  4278. 6,
  4279. 1
  4280. ],
  4281. [
  4282. 6,
  4283. 1
  4284. ],
  4285. [
  4286. 6,
  4287. 1
  4288. ],
  4289. [
  4290. 6,
  4291. 1
  4292. ],
  4293. [
  4294. 6,
  4295. 1
  4296. ],
  4297. [
  4298. 6,
  4299. 12
  4300. ],
  4301. [
  4302. 6,
  4303. 12
  4304. ],
  4305. [
  4306. 6,
  4307. 12
  4308. ],
  4309. [
  4310. 6,
  4311. 12
  4312. ],
  4313. [
  4314. 6,
  4315. 12
  4316. ],
  4317. [
  4318. 6,
  4319. 12
  4320. ],
  4321. [
  4322. 6,
  4323. 12
  4324. ],
  4325. [
  4326. 6,
  4327. 12
  4328. ],
  4329. [
  4330. 8,
  4331. 53
  4332. ],
  4333. [
  4334. 8,
  4335. 53
  4336. ],
  4337. [
  4338. 8,
  4339. 54
  4340. ],
  4341. [
  4342. 8,
  4343. 54
  4344. ],
  4345. [
  4346. 7,
  4347. 26
  4348. ],
  4349. [
  4350. 7,
  4351. 26
  4352. ],
  4353. [
  4354. 7,
  4355. 26
  4356. ],
  4357. [
  4358. 7,
  4359. 26
  4360. ],
  4361. [
  4362. 8,
  4363. 39
  4364. ],
  4365. [
  4366. 8,
  4367. 39
  4368. ],
  4369. [
  4370. 8,
  4371. 40
  4372. ],
  4373. [
  4374. 8,
  4375. 40
  4376. ],
  4377. [
  4378. 8,
  4379. 41
  4380. ],
  4381. [
  4382. 8,
  4383. 41
  4384. ],
  4385. [
  4386. 8,
  4387. 42
  4388. ],
  4389. [
  4390. 8,
  4391. 42
  4392. ],
  4393. [
  4394. 8,
  4395. 43
  4396. ],
  4397. [
  4398. 8,
  4399. 43
  4400. ],
  4401. [
  4402. 8,
  4403. 44
  4404. ],
  4405. [
  4406. 8,
  4407. 44
  4408. ],
  4409. [
  4410. 7,
  4411. 21
  4412. ],
  4413. [
  4414. 7,
  4415. 21
  4416. ],
  4417. [
  4418. 7,
  4419. 21
  4420. ],
  4421. [
  4422. 7,
  4423. 21
  4424. ],
  4425. [
  4426. 7,
  4427. 28
  4428. ],
  4429. [
  4430. 7,
  4431. 28
  4432. ],
  4433. [
  4434. 7,
  4435. 28
  4436. ],
  4437. [
  4438. 7,
  4439. 28
  4440. ],
  4441. [
  4442. 8,
  4443. 61
  4444. ],
  4445. [
  4446. 8,
  4447. 61
  4448. ],
  4449. [
  4450. 8,
  4451. 62
  4452. ],
  4453. [
  4454. 8,
  4455. 62
  4456. ],
  4457. [
  4458. 8,
  4459. 63
  4460. ],
  4461. [
  4462. 8,
  4463. 63
  4464. ],
  4465. [
  4466. 8,
  4467. 0
  4468. ],
  4469. [
  4470. 8,
  4471. 0
  4472. ],
  4473. [
  4474. 8,
  4475. 320
  4476. ],
  4477. [
  4478. 8,
  4479. 320
  4480. ],
  4481. [
  4482. 8,
  4483. 384
  4484. ],
  4485. [
  4486. 8,
  4487. 384
  4488. ],
  4489. [
  4490. 5,
  4491. 10
  4492. ],
  4493. [
  4494. 5,
  4495. 10
  4496. ],
  4497. [
  4498. 5,
  4499. 10
  4500. ],
  4501. [
  4502. 5,
  4503. 10
  4504. ],
  4505. [
  4506. 5,
  4507. 10
  4508. ],
  4509. [
  4510. 5,
  4511. 10
  4512. ],
  4513. [
  4514. 5,
  4515. 10
  4516. ],
  4517. [
  4518. 5,
  4519. 10
  4520. ],
  4521. [
  4522. 5,
  4523. 10
  4524. ],
  4525. [
  4526. 5,
  4527. 10
  4528. ],
  4529. [
  4530. 5,
  4531. 10
  4532. ],
  4533. [
  4534. 5,
  4535. 10
  4536. ],
  4537. [
  4538. 5,
  4539. 10
  4540. ],
  4541. [
  4542. 5,
  4543. 10
  4544. ],
  4545. [
  4546. 5,
  4547. 10
  4548. ],
  4549. [
  4550. 5,
  4551. 10
  4552. ],
  4553. [
  4554. 5,
  4555. 11
  4556. ],
  4557. [
  4558. 5,
  4559. 11
  4560. ],
  4561. [
  4562. 5,
  4563. 11
  4564. ],
  4565. [
  4566. 5,
  4567. 11
  4568. ],
  4569. [
  4570. 5,
  4571. 11
  4572. ],
  4573. [
  4574. 5,
  4575. 11
  4576. ],
  4577. [
  4578. 5,
  4579. 11
  4580. ],
  4581. [
  4582. 5,
  4583. 11
  4584. ],
  4585. [
  4586. 5,
  4587. 11
  4588. ],
  4589. [
  4590. 5,
  4591. 11
  4592. ],
  4593. [
  4594. 5,
  4595. 11
  4596. ],
  4597. [
  4598. 5,
  4599. 11
  4600. ],
  4601. [
  4602. 5,
  4603. 11
  4604. ],
  4605. [
  4606. 5,
  4607. 11
  4608. ],
  4609. [
  4610. 5,
  4611. 11
  4612. ],
  4613. [
  4614. 5,
  4615. 11
  4616. ],
  4617. [
  4618. 7,
  4619. 27
  4620. ],
  4621. [
  4622. 7,
  4623. 27
  4624. ],
  4625. [
  4626. 7,
  4627. 27
  4628. ],
  4629. [
  4630. 7,
  4631. 27
  4632. ],
  4633. [
  4634. 8,
  4635. 59
  4636. ],
  4637. [
  4638. 8,
  4639. 59
  4640. ],
  4641. [
  4642. 8,
  4643. 60
  4644. ],
  4645. [
  4646. 8,
  4647. 60
  4648. ],
  4649. [
  4650. 9,
  4651. 1472
  4652. ],
  4653. [
  4654. 9,
  4655. 1536
  4656. ],
  4657. [
  4658. 9,
  4659. 1600
  4660. ],
  4661. [
  4662. 9,
  4663. 1728
  4664. ],
  4665. [
  4666. 7,
  4667. 18
  4668. ],
  4669. [
  4670. 7,
  4671. 18
  4672. ],
  4673. [
  4674. 7,
  4675. 18
  4676. ],
  4677. [
  4678. 7,
  4679. 18
  4680. ],
  4681. [
  4682. 7,
  4683. 24
  4684. ],
  4685. [
  4686. 7,
  4687. 24
  4688. ],
  4689. [
  4690. 7,
  4691. 24
  4692. ],
  4693. [
  4694. 7,
  4695. 24
  4696. ],
  4697. [
  4698. 8,
  4699. 49
  4700. ],
  4701. [
  4702. 8,
  4703. 49
  4704. ],
  4705. [
  4706. 8,
  4707. 50
  4708. ],
  4709. [
  4710. 8,
  4711. 50
  4712. ],
  4713. [
  4714. 8,
  4715. 51
  4716. ],
  4717. [
  4718. 8,
  4719. 51
  4720. ],
  4721. [
  4722. 8,
  4723. 52
  4724. ],
  4725. [
  4726. 8,
  4727. 52
  4728. ],
  4729. [
  4730. 7,
  4731. 25
  4732. ],
  4733. [
  4734. 7,
  4735. 25
  4736. ],
  4737. [
  4738. 7,
  4739. 25
  4740. ],
  4741. [
  4742. 7,
  4743. 25
  4744. ],
  4745. [
  4746. 8,
  4747. 55
  4748. ],
  4749. [
  4750. 8,
  4751. 55
  4752. ],
  4753. [
  4754. 8,
  4755. 56
  4756. ],
  4757. [
  4758. 8,
  4759. 56
  4760. ],
  4761. [
  4762. 8,
  4763. 57
  4764. ],
  4765. [
  4766. 8,
  4767. 57
  4768. ],
  4769. [
  4770. 8,
  4771. 58
  4772. ],
  4773. [
  4774. 8,
  4775. 58
  4776. ],
  4777. [
  4778. 6,
  4779. 192
  4780. ],
  4781. [
  4782. 6,
  4783. 192
  4784. ],
  4785. [
  4786. 6,
  4787. 192
  4788. ],
  4789. [
  4790. 6,
  4791. 192
  4792. ],
  4793. [
  4794. 6,
  4795. 192
  4796. ],
  4797. [
  4798. 6,
  4799. 192
  4800. ],
  4801. [
  4802. 6,
  4803. 192
  4804. ],
  4805. [
  4806. 6,
  4807. 192
  4808. ],
  4809. [
  4810. 6,
  4811. 1664
  4812. ],
  4813. [
  4814. 6,
  4815. 1664
  4816. ],
  4817. [
  4818. 6,
  4819. 1664
  4820. ],
  4821. [
  4822. 6,
  4823. 1664
  4824. ],
  4825. [
  4826. 6,
  4827. 1664
  4828. ],
  4829. [
  4830. 6,
  4831. 1664
  4832. ],
  4833. [
  4834. 6,
  4835. 1664
  4836. ],
  4837. [
  4838. 6,
  4839. 1664
  4840. ],
  4841. [
  4842. 8,
  4843. 448
  4844. ],
  4845. [
  4846. 8,
  4847. 448
  4848. ],
  4849. [
  4850. 8,
  4851. 512
  4852. ],
  4853. [
  4854. 8,
  4855. 512
  4856. ],
  4857. [
  4858. 9,
  4859. 704
  4860. ],
  4861. [
  4862. 9,
  4863. 768
  4864. ],
  4865. [
  4866. 8,
  4867. 640
  4868. ],
  4869. [
  4870. 8,
  4871. 640
  4872. ],
  4873. [
  4874. 8,
  4875. 576
  4876. ],
  4877. [
  4878. 8,
  4879. 576
  4880. ],
  4881. [
  4882. 9,
  4883. 832
  4884. ],
  4885. [
  4886. 9,
  4887. 896
  4888. ],
  4889. [
  4890. 9,
  4891. 960
  4892. ],
  4893. [
  4894. 9,
  4895. 1024
  4896. ],
  4897. [
  4898. 9,
  4899. 1088
  4900. ],
  4901. [
  4902. 9,
  4903. 1152
  4904. ],
  4905. [
  4906. 9,
  4907. 1216
  4908. ],
  4909. [
  4910. 9,
  4911. 1280
  4912. ],
  4913. [
  4914. 9,
  4915. 1344
  4916. ],
  4917. [
  4918. 9,
  4919. 1408
  4920. ],
  4921. [
  4922. 7,
  4923. 256
  4924. ],
  4925. [
  4926. 7,
  4927. 256
  4928. ],
  4929. [
  4930. 7,
  4931. 256
  4932. ],
  4933. [
  4934. 7,
  4935. 256
  4936. ],
  4937. [
  4938. 4,
  4939. 2
  4940. ],
  4941. [
  4942. 4,
  4943. 2
  4944. ],
  4945. [
  4946. 4,
  4947. 2
  4948. ],
  4949. [
  4950. 4,
  4951. 2
  4952. ],
  4953. [
  4954. 4,
  4955. 2
  4956. ],
  4957. [
  4958. 4,
  4959. 2
  4960. ],
  4961. [
  4962. 4,
  4963. 2
  4964. ],
  4965. [
  4966. 4,
  4967. 2
  4968. ],
  4969. [
  4970. 4,
  4971. 2
  4972. ],
  4973. [
  4974. 4,
  4975. 2
  4976. ],
  4977. [
  4978. 4,
  4979. 2
  4980. ],
  4981. [
  4982. 4,
  4983. 2
  4984. ],
  4985. [
  4986. 4,
  4987. 2
  4988. ],
  4989. [
  4990. 4,
  4991. 2
  4992. ],
  4993. [
  4994. 4,
  4995. 2
  4996. ],
  4997. [
  4998. 4,
  4999. 2
  5000. ],
  5001. [
  5002. 4,
  5003. 2
  5004. ],
  5005. [
  5006. 4,
  5007. 2
  5008. ],
  5009. [
  5010. 4,
  5011. 2
  5012. ],
  5013. [
  5014. 4,
  5015. 2
  5016. ],
  5017. [
  5018. 4,
  5019. 2
  5020. ],
  5021. [
  5022. 4,
  5023. 2
  5024. ],
  5025. [
  5026. 4,
  5027. 2
  5028. ],
  5029. [
  5030. 4,
  5031. 2
  5032. ],
  5033. [
  5034. 4,
  5035. 2
  5036. ],
  5037. [
  5038. 4,
  5039. 2
  5040. ],
  5041. [
  5042. 4,
  5043. 2
  5044. ],
  5045. [
  5046. 4,
  5047. 2
  5048. ],
  5049. [
  5050. 4,
  5051. 2
  5052. ],
  5053. [
  5054. 4,
  5055. 2
  5056. ],
  5057. [
  5058. 4,
  5059. 2
  5060. ],
  5061. [
  5062. 4,
  5063. 2
  5064. ],
  5065. [
  5066. 4,
  5067. 3
  5068. ],
  5069. [
  5070. 4,
  5071. 3
  5072. ],
  5073. [
  5074. 4,
  5075. 3
  5076. ],
  5077. [
  5078. 4,
  5079. 3
  5080. ],
  5081. [
  5082. 4,
  5083. 3
  5084. ],
  5085. [
  5086. 4,
  5087. 3
  5088. ],
  5089. [
  5090. 4,
  5091. 3
  5092. ],
  5093. [
  5094. 4,
  5095. 3
  5096. ],
  5097. [
  5098. 4,
  5099. 3
  5100. ],
  5101. [
  5102. 4,
  5103. 3
  5104. ],
  5105. [
  5106. 4,
  5107. 3
  5108. ],
  5109. [
  5110. 4,
  5111. 3
  5112. ],
  5113. [
  5114. 4,
  5115. 3
  5116. ],
  5117. [
  5118. 4,
  5119. 3
  5120. ],
  5121. [
  5122. 4,
  5123. 3
  5124. ],
  5125. [
  5126. 4,
  5127. 3
  5128. ],
  5129. [
  5130. 4,
  5131. 3
  5132. ],
  5133. [
  5134. 4,
  5135. 3
  5136. ],
  5137. [
  5138. 4,
  5139. 3
  5140. ],
  5141. [
  5142. 4,
  5143. 3
  5144. ],
  5145. [
  5146. 4,
  5147. 3
  5148. ],
  5149. [
  5150. 4,
  5151. 3
  5152. ],
  5153. [
  5154. 4,
  5155. 3
  5156. ],
  5157. [
  5158. 4,
  5159. 3
  5160. ],
  5161. [
  5162. 4,
  5163. 3
  5164. ],
  5165. [
  5166. 4,
  5167. 3
  5168. ],
  5169. [
  5170. 4,
  5171. 3
  5172. ],
  5173. [
  5174. 4,
  5175. 3
  5176. ],
  5177. [
  5178. 4,
  5179. 3
  5180. ],
  5181. [
  5182. 4,
  5183. 3
  5184. ],
  5185. [
  5186. 4,
  5187. 3
  5188. ],
  5189. [
  5190. 4,
  5191. 3
  5192. ],
  5193. [
  5194. 5,
  5195. 128
  5196. ],
  5197. [
  5198. 5,
  5199. 128
  5200. ],
  5201. [
  5202. 5,
  5203. 128
  5204. ],
  5205. [
  5206. 5,
  5207. 128
  5208. ],
  5209. [
  5210. 5,
  5211. 128
  5212. ],
  5213. [
  5214. 5,
  5215. 128
  5216. ],
  5217. [
  5218. 5,
  5219. 128
  5220. ],
  5221. [
  5222. 5,
  5223. 128
  5224. ],
  5225. [
  5226. 5,
  5227. 128
  5228. ],
  5229. [
  5230. 5,
  5231. 128
  5232. ],
  5233. [
  5234. 5,
  5235. 128
  5236. ],
  5237. [
  5238. 5,
  5239. 128
  5240. ],
  5241. [
  5242. 5,
  5243. 128
  5244. ],
  5245. [
  5246. 5,
  5247. 128
  5248. ],
  5249. [
  5250. 5,
  5251. 128
  5252. ],
  5253. [
  5254. 5,
  5255. 128
  5256. ],
  5257. [
  5258. 5,
  5259. 8
  5260. ],
  5261. [
  5262. 5,
  5263. 8
  5264. ],
  5265. [
  5266. 5,
  5267. 8
  5268. ],
  5269. [
  5270. 5,
  5271. 8
  5272. ],
  5273. [
  5274. 5,
  5275. 8
  5276. ],
  5277. [
  5278. 5,
  5279. 8
  5280. ],
  5281. [
  5282. 5,
  5283. 8
  5284. ],
  5285. [
  5286. 5,
  5287. 8
  5288. ],
  5289. [
  5290. 5,
  5291. 8
  5292. ],
  5293. [
  5294. 5,
  5295. 8
  5296. ],
  5297. [
  5298. 5,
  5299. 8
  5300. ],
  5301. [
  5302. 5,
  5303. 8
  5304. ],
  5305. [
  5306. 5,
  5307. 8
  5308. ],
  5309. [
  5310. 5,
  5311. 8
  5312. ],
  5313. [
  5314. 5,
  5315. 8
  5316. ],
  5317. [
  5318. 5,
  5319. 8
  5320. ],
  5321. [
  5322. 5,
  5323. 9
  5324. ],
  5325. [
  5326. 5,
  5327. 9
  5328. ],
  5329. [
  5330. 5,
  5331. 9
  5332. ],
  5333. [
  5334. 5,
  5335. 9
  5336. ],
  5337. [
  5338. 5,
  5339. 9
  5340. ],
  5341. [
  5342. 5,
  5343. 9
  5344. ],
  5345. [
  5346. 5,
  5347. 9
  5348. ],
  5349. [
  5350. 5,
  5351. 9
  5352. ],
  5353. [
  5354. 5,
  5355. 9
  5356. ],
  5357. [
  5358. 5,
  5359. 9
  5360. ],
  5361. [
  5362. 5,
  5363. 9
  5364. ],
  5365. [
  5366. 5,
  5367. 9
  5368. ],
  5369. [
  5370. 5,
  5371. 9
  5372. ],
  5373. [
  5374. 5,
  5375. 9
  5376. ],
  5377. [
  5378. 5,
  5379. 9
  5380. ],
  5381. [
  5382. 5,
  5383. 9
  5384. ],
  5385. [
  5386. 6,
  5387. 16
  5388. ],
  5389. [
  5390. 6,
  5391. 16
  5392. ],
  5393. [
  5394. 6,
  5395. 16
  5396. ],
  5397. [
  5398. 6,
  5399. 16
  5400. ],
  5401. [
  5402. 6,
  5403. 16
  5404. ],
  5405. [
  5406. 6,
  5407. 16
  5408. ],
  5409. [
  5410. 6,
  5411. 16
  5412. ],
  5413. [
  5414. 6,
  5415. 16
  5416. ],
  5417. [
  5418. 6,
  5419. 17
  5420. ],
  5421. [
  5422. 6,
  5423. 17
  5424. ],
  5425. [
  5426. 6,
  5427. 17
  5428. ],
  5429. [
  5430. 6,
  5431. 17
  5432. ],
  5433. [
  5434. 6,
  5435. 17
  5436. ],
  5437. [
  5438. 6,
  5439. 17
  5440. ],
  5441. [
  5442. 6,
  5443. 17
  5444. ],
  5445. [
  5446. 6,
  5447. 17
  5448. ],
  5449. [
  5450. 4,
  5451. 4
  5452. ],
  5453. [
  5454. 4,
  5455. 4
  5456. ],
  5457. [
  5458. 4,
  5459. 4
  5460. ],
  5461. [
  5462. 4,
  5463. 4
  5464. ],
  5465. [
  5466. 4,
  5467. 4
  5468. ],
  5469. [
  5470. 4,
  5471. 4
  5472. ],
  5473. [
  5474. 4,
  5475. 4
  5476. ],
  5477. [
  5478. 4,
  5479. 4
  5480. ],
  5481. [
  5482. 4,
  5483. 4
  5484. ],
  5485. [
  5486. 4,
  5487. 4
  5488. ],
  5489. [
  5490. 4,
  5491. 4
  5492. ],
  5493. [
  5494. 4,
  5495. 4
  5496. ],
  5497. [
  5498. 4,
  5499. 4
  5500. ],
  5501. [
  5502. 4,
  5503. 4
  5504. ],
  5505. [
  5506. 4,
  5507. 4
  5508. ],
  5509. [
  5510. 4,
  5511. 4
  5512. ],
  5513. [
  5514. 4,
  5515. 4
  5516. ],
  5517. [
  5518. 4,
  5519. 4
  5520. ],
  5521. [
  5522. 4,
  5523. 4
  5524. ],
  5525. [
  5526. 4,
  5527. 4
  5528. ],
  5529. [
  5530. 4,
  5531. 4
  5532. ],
  5533. [
  5534. 4,
  5535. 4
  5536. ],
  5537. [
  5538. 4,
  5539. 4
  5540. ],
  5541. [
  5542. 4,
  5543. 4
  5544. ],
  5545. [
  5546. 4,
  5547. 4
  5548. ],
  5549. [
  5550. 4,
  5551. 4
  5552. ],
  5553. [
  5554. 4,
  5555. 4
  5556. ],
  5557. [
  5558. 4,
  5559. 4
  5560. ],
  5561. [
  5562. 4,
  5563. 4
  5564. ],
  5565. [
  5566. 4,
  5567. 4
  5568. ],
  5569. [
  5570. 4,
  5571. 4
  5572. ],
  5573. [
  5574. 4,
  5575. 4
  5576. ],
  5577. [
  5578. 4,
  5579. 5
  5580. ],
  5581. [
  5582. 4,
  5583. 5
  5584. ],
  5585. [
  5586. 4,
  5587. 5
  5588. ],
  5589. [
  5590. 4,
  5591. 5
  5592. ],
  5593. [
  5594. 4,
  5595. 5
  5596. ],
  5597. [
  5598. 4,
  5599. 5
  5600. ],
  5601. [
  5602. 4,
  5603. 5
  5604. ],
  5605. [
  5606. 4,
  5607. 5
  5608. ],
  5609. [
  5610. 4,
  5611. 5
  5612. ],
  5613. [
  5614. 4,
  5615. 5
  5616. ],
  5617. [
  5618. 4,
  5619. 5
  5620. ],
  5621. [
  5622. 4,
  5623. 5
  5624. ],
  5625. [
  5626. 4,
  5627. 5
  5628. ],
  5629. [
  5630. 4,
  5631. 5
  5632. ],
  5633. [
  5634. 4,
  5635. 5
  5636. ],
  5637. [
  5638. 4,
  5639. 5
  5640. ],
  5641. [
  5642. 4,
  5643. 5
  5644. ],
  5645. [
  5646. 4,
  5647. 5
  5648. ],
  5649. [
  5650. 4,
  5651. 5
  5652. ],
  5653. [
  5654. 4,
  5655. 5
  5656. ],
  5657. [
  5658. 4,
  5659. 5
  5660. ],
  5661. [
  5662. 4,
  5663. 5
  5664. ],
  5665. [
  5666. 4,
  5667. 5
  5668. ],
  5669. [
  5670. 4,
  5671. 5
  5672. ],
  5673. [
  5674. 4,
  5675. 5
  5676. ],
  5677. [
  5678. 4,
  5679. 5
  5680. ],
  5681. [
  5682. 4,
  5683. 5
  5684. ],
  5685. [
  5686. 4,
  5687. 5
  5688. ],
  5689. [
  5690. 4,
  5691. 5
  5692. ],
  5693. [
  5694. 4,
  5695. 5
  5696. ],
  5697. [
  5698. 4,
  5699. 5
  5700. ],
  5701. [
  5702. 4,
  5703. 5
  5704. ],
  5705. [
  5706. 6,
  5707. 14
  5708. ],
  5709. [
  5710. 6,
  5711. 14
  5712. ],
  5713. [
  5714. 6,
  5715. 14
  5716. ],
  5717. [
  5718. 6,
  5719. 14
  5720. ],
  5721. [
  5722. 6,
  5723. 14
  5724. ],
  5725. [
  5726. 6,
  5727. 14
  5728. ],
  5729. [
  5730. 6,
  5731. 14
  5732. ],
  5733. [
  5734. 6,
  5735. 14
  5736. ],
  5737. [
  5738. 6,
  5739. 15
  5740. ],
  5741. [
  5742. 6,
  5743. 15
  5744. ],
  5745. [
  5746. 6,
  5747. 15
  5748. ],
  5749. [
  5750. 6,
  5751. 15
  5752. ],
  5753. [
  5754. 6,
  5755. 15
  5756. ],
  5757. [
  5758. 6,
  5759. 15
  5760. ],
  5761. [
  5762. 6,
  5763. 15
  5764. ],
  5765. [
  5766. 6,
  5767. 15
  5768. ],
  5769. [
  5770. 5,
  5771. 64
  5772. ],
  5773. [
  5774. 5,
  5775. 64
  5776. ],
  5777. [
  5778. 5,
  5779. 64
  5780. ],
  5781. [
  5782. 5,
  5783. 64
  5784. ],
  5785. [
  5786. 5,
  5787. 64
  5788. ],
  5789. [
  5790. 5,
  5791. 64
  5792. ],
  5793. [
  5794. 5,
  5795. 64
  5796. ],
  5797. [
  5798. 5,
  5799. 64
  5800. ],
  5801. [
  5802. 5,
  5803. 64
  5804. ],
  5805. [
  5806. 5,
  5807. 64
  5808. ],
  5809. [
  5810. 5,
  5811. 64
  5812. ],
  5813. [
  5814. 5,
  5815. 64
  5816. ],
  5817. [
  5818. 5,
  5819. 64
  5820. ],
  5821. [
  5822. 5,
  5823. 64
  5824. ],
  5825. [
  5826. 5,
  5827. 64
  5828. ],
  5829. [
  5830. 5,
  5831. 64
  5832. ],
  5833. [
  5834. 4,
  5835. 6
  5836. ],
  5837. [
  5838. 4,
  5839. 6
  5840. ],
  5841. [
  5842. 4,
  5843. 6
  5844. ],
  5845. [
  5846. 4,
  5847. 6
  5848. ],
  5849. [
  5850. 4,
  5851. 6
  5852. ],
  5853. [
  5854. 4,
  5855. 6
  5856. ],
  5857. [
  5858. 4,
  5859. 6
  5860. ],
  5861. [
  5862. 4,
  5863. 6
  5864. ],
  5865. [
  5866. 4,
  5867. 6
  5868. ],
  5869. [
  5870. 4,
  5871. 6
  5872. ],
  5873. [
  5874. 4,
  5875. 6
  5876. ],
  5877. [
  5878. 4,
  5879. 6
  5880. ],
  5881. [
  5882. 4,
  5883. 6
  5884. ],
  5885. [
  5886. 4,
  5887. 6
  5888. ],
  5889. [
  5890. 4,
  5891. 6
  5892. ],
  5893. [
  5894. 4,
  5895. 6
  5896. ],
  5897. [
  5898. 4,
  5899. 6
  5900. ],
  5901. [
  5902. 4,
  5903. 6
  5904. ],
  5905. [
  5906. 4,
  5907. 6
  5908. ],
  5909. [
  5910. 4,
  5911. 6
  5912. ],
  5913. [
  5914. 4,
  5915. 6
  5916. ],
  5917. [
  5918. 4,
  5919. 6
  5920. ],
  5921. [
  5922. 4,
  5923. 6
  5924. ],
  5925. [
  5926. 4,
  5927. 6
  5928. ],
  5929. [
  5930. 4,
  5931. 6
  5932. ],
  5933. [
  5934. 4,
  5935. 6
  5936. ],
  5937. [
  5938. 4,
  5939. 6
  5940. ],
  5941. [
  5942. 4,
  5943. 6
  5944. ],
  5945. [
  5946. 4,
  5947. 6
  5948. ],
  5949. [
  5950. 4,
  5951. 6
  5952. ],
  5953. [
  5954. 4,
  5955. 6
  5956. ],
  5957. [
  5958. 4,
  5959. 6
  5960. ],
  5961. [
  5962. 4,
  5963. 7
  5964. ],
  5965. [
  5966. 4,
  5967. 7
  5968. ],
  5969. [
  5970. 4,
  5971. 7
  5972. ],
  5973. [
  5974. 4,
  5975. 7
  5976. ],
  5977. [
  5978. 4,
  5979. 7
  5980. ],
  5981. [
  5982. 4,
  5983. 7
  5984. ],
  5985. [
  5986. 4,
  5987. 7
  5988. ],
  5989. [
  5990. 4,
  5991. 7
  5992. ],
  5993. [
  5994. 4,
  5995. 7
  5996. ],
  5997. [
  5998. 4,
  5999. 7
  6000. ],
  6001. [
  6002. 4,
  6003. 7
  6004. ],
  6005. [
  6006. 4,
  6007. 7
  6008. ],
  6009. [
  6010. 4,
  6011. 7
  6012. ],
  6013. [
  6014. 4,
  6015. 7
  6016. ],
  6017. [
  6018. 4,
  6019. 7
  6020. ],
  6021. [
  6022. 4,
  6023. 7
  6024. ],
  6025. [
  6026. 4,
  6027. 7
  6028. ],
  6029. [
  6030. 4,
  6031. 7
  6032. ],
  6033. [
  6034. 4,
  6035. 7
  6036. ],
  6037. [
  6038. 4,
  6039. 7
  6040. ],
  6041. [
  6042. 4,
  6043. 7
  6044. ],
  6045. [
  6046. 4,
  6047. 7
  6048. ],
  6049. [
  6050. 4,
  6051. 7
  6052. ],
  6053. [
  6054. 4,
  6055. 7
  6056. ],
  6057. [
  6058. 4,
  6059. 7
  6060. ],
  6061. [
  6062. 4,
  6063. 7
  6064. ],
  6065. [
  6066. 4,
  6067. 7
  6068. ],
  6069. [
  6070. 4,
  6071. 7
  6072. ],
  6073. [
  6074. 4,
  6075. 7
  6076. ],
  6077. [
  6078. 4,
  6079. 7
  6080. ],
  6081. [
  6082. 4,
  6083. 7
  6084. ],
  6085. [
  6086. 4,
  6087. 7
  6088. ]
  6089. ];
  6090. var blackTable1 = [
  6091. [
  6092. -1,
  6093. -1
  6094. ],
  6095. [
  6096. -1,
  6097. -1
  6098. ],
  6099. [
  6100. 12,
  6101. ccittEOL
  6102. ],
  6103. [
  6104. 12,
  6105. ccittEOL
  6106. ],
  6107. [
  6108. -1,
  6109. -1
  6110. ],
  6111. [
  6112. -1,
  6113. -1
  6114. ],
  6115. [
  6116. -1,
  6117. -1
  6118. ],
  6119. [
  6120. -1,
  6121. -1
  6122. ],
  6123. [
  6124. -1,
  6125. -1
  6126. ],
  6127. [
  6128. -1,
  6129. -1
  6130. ],
  6131. [
  6132. -1,
  6133. -1
  6134. ],
  6135. [
  6136. -1,
  6137. -1
  6138. ],
  6139. [
  6140. -1,
  6141. -1
  6142. ],
  6143. [
  6144. -1,
  6145. -1
  6146. ],
  6147. [
  6148. -1,
  6149. -1
  6150. ],
  6151. [
  6152. -1,
  6153. -1
  6154. ],
  6155. [
  6156. -1,
  6157. -1
  6158. ],
  6159. [
  6160. -1,
  6161. -1
  6162. ],
  6163. [
  6164. -1,
  6165. -1
  6166. ],
  6167. [
  6168. -1,
  6169. -1
  6170. ],
  6171. [
  6172. -1,
  6173. -1
  6174. ],
  6175. [
  6176. -1,
  6177. -1
  6178. ],
  6179. [
  6180. -1,
  6181. -1
  6182. ],
  6183. [
  6184. -1,
  6185. -1
  6186. ],
  6187. [
  6188. -1,
  6189. -1
  6190. ],
  6191. [
  6192. -1,
  6193. -1
  6194. ],
  6195. [
  6196. -1,
  6197. -1
  6198. ],
  6199. [
  6200. -1,
  6201. -1
  6202. ],
  6203. [
  6204. -1,
  6205. -1
  6206. ],
  6207. [
  6208. -1,
  6209. -1
  6210. ],
  6211. [
  6212. -1,
  6213. -1
  6214. ],
  6215. [
  6216. -1,
  6217. -1
  6218. ],
  6219. [
  6220. 11,
  6221. 1792
  6222. ],
  6223. [
  6224. 11,
  6225. 1792
  6226. ],
  6227. [
  6228. 11,
  6229. 1792
  6230. ],
  6231. [
  6232. 11,
  6233. 1792
  6234. ],
  6235. [
  6236. 12,
  6237. 1984
  6238. ],
  6239. [
  6240. 12,
  6241. 1984
  6242. ],
  6243. [
  6244. 12,
  6245. 2048
  6246. ],
  6247. [
  6248. 12,
  6249. 2048
  6250. ],
  6251. [
  6252. 12,
  6253. 2112
  6254. ],
  6255. [
  6256. 12,
  6257. 2112
  6258. ],
  6259. [
  6260. 12,
  6261. 2176
  6262. ],
  6263. [
  6264. 12,
  6265. 2176
  6266. ],
  6267. [
  6268. 12,
  6269. 2240
  6270. ],
  6271. [
  6272. 12,
  6273. 2240
  6274. ],
  6275. [
  6276. 12,
  6277. 2304
  6278. ],
  6279. [
  6280. 12,
  6281. 2304
  6282. ],
  6283. [
  6284. 11,
  6285. 1856
  6286. ],
  6287. [
  6288. 11,
  6289. 1856
  6290. ],
  6291. [
  6292. 11,
  6293. 1856
  6294. ],
  6295. [
  6296. 11,
  6297. 1856
  6298. ],
  6299. [
  6300. 11,
  6301. 1920
  6302. ],
  6303. [
  6304. 11,
  6305. 1920
  6306. ],
  6307. [
  6308. 11,
  6309. 1920
  6310. ],
  6311. [
  6312. 11,
  6313. 1920
  6314. ],
  6315. [
  6316. 12,
  6317. 2368
  6318. ],
  6319. [
  6320. 12,
  6321. 2368
  6322. ],
  6323. [
  6324. 12,
  6325. 2432
  6326. ],
  6327. [
  6328. 12,
  6329. 2432
  6330. ],
  6331. [
  6332. 12,
  6333. 2496
  6334. ],
  6335. [
  6336. 12,
  6337. 2496
  6338. ],
  6339. [
  6340. 12,
  6341. 2560
  6342. ],
  6343. [
  6344. 12,
  6345. 2560
  6346. ],
  6347. [
  6348. 10,
  6349. 18
  6350. ],
  6351. [
  6352. 10,
  6353. 18
  6354. ],
  6355. [
  6356. 10,
  6357. 18
  6358. ],
  6359. [
  6360. 10,
  6361. 18
  6362. ],
  6363. [
  6364. 10,
  6365. 18
  6366. ],
  6367. [
  6368. 10,
  6369. 18
  6370. ],
  6371. [
  6372. 10,
  6373. 18
  6374. ],
  6375. [
  6376. 10,
  6377. 18
  6378. ],
  6379. [
  6380. 12,
  6381. 52
  6382. ],
  6383. [
  6384. 12,
  6385. 52
  6386. ],
  6387. [
  6388. 13,
  6389. 640
  6390. ],
  6391. [
  6392. 13,
  6393. 704
  6394. ],
  6395. [
  6396. 13,
  6397. 768
  6398. ],
  6399. [
  6400. 13,
  6401. 832
  6402. ],
  6403. [
  6404. 12,
  6405. 55
  6406. ],
  6407. [
  6408. 12,
  6409. 55
  6410. ],
  6411. [
  6412. 12,
  6413. 56
  6414. ],
  6415. [
  6416. 12,
  6417. 56
  6418. ],
  6419. [
  6420. 13,
  6421. 1280
  6422. ],
  6423. [
  6424. 13,
  6425. 1344
  6426. ],
  6427. [
  6428. 13,
  6429. 1408
  6430. ],
  6431. [
  6432. 13,
  6433. 1472
  6434. ],
  6435. [
  6436. 12,
  6437. 59
  6438. ],
  6439. [
  6440. 12,
  6441. 59
  6442. ],
  6443. [
  6444. 12,
  6445. 60
  6446. ],
  6447. [
  6448. 12,
  6449. 60
  6450. ],
  6451. [
  6452. 13,
  6453. 1536
  6454. ],
  6455. [
  6456. 13,
  6457. 1600
  6458. ],
  6459. [
  6460. 11,
  6461. 24
  6462. ],
  6463. [
  6464. 11,
  6465. 24
  6466. ],
  6467. [
  6468. 11,
  6469. 24
  6470. ],
  6471. [
  6472. 11,
  6473. 24
  6474. ],
  6475. [
  6476. 11,
  6477. 25
  6478. ],
  6479. [
  6480. 11,
  6481. 25
  6482. ],
  6483. [
  6484. 11,
  6485. 25
  6486. ],
  6487. [
  6488. 11,
  6489. 25
  6490. ],
  6491. [
  6492. 13,
  6493. 1664
  6494. ],
  6495. [
  6496. 13,
  6497. 1728
  6498. ],
  6499. [
  6500. 12,
  6501. 320
  6502. ],
  6503. [
  6504. 12,
  6505. 320
  6506. ],
  6507. [
  6508. 12,
  6509. 384
  6510. ],
  6511. [
  6512. 12,
  6513. 384
  6514. ],
  6515. [
  6516. 12,
  6517. 448
  6518. ],
  6519. [
  6520. 12,
  6521. 448
  6522. ],
  6523. [
  6524. 13,
  6525. 512
  6526. ],
  6527. [
  6528. 13,
  6529. 576
  6530. ],
  6531. [
  6532. 12,
  6533. 53
  6534. ],
  6535. [
  6536. 12,
  6537. 53
  6538. ],
  6539. [
  6540. 12,
  6541. 54
  6542. ],
  6543. [
  6544. 12,
  6545. 54
  6546. ],
  6547. [
  6548. 13,
  6549. 896
  6550. ],
  6551. [
  6552. 13,
  6553. 960
  6554. ],
  6555. [
  6556. 13,
  6557. 1024
  6558. ],
  6559. [
  6560. 13,
  6561. 1088
  6562. ],
  6563. [
  6564. 13,
  6565. 1152
  6566. ],
  6567. [
  6568. 13,
  6569. 1216
  6570. ],
  6571. [
  6572. 10,
  6573. 64
  6574. ],
  6575. [
  6576. 10,
  6577. 64
  6578. ],
  6579. [
  6580. 10,
  6581. 64
  6582. ],
  6583. [
  6584. 10,
  6585. 64
  6586. ],
  6587. [
  6588. 10,
  6589. 64
  6590. ],
  6591. [
  6592. 10,
  6593. 64
  6594. ],
  6595. [
  6596. 10,
  6597. 64
  6598. ],
  6599. [
  6600. 10,
  6601. 64
  6602. ]
  6603. ];
  6604. var blackTable2 = [
  6605. [
  6606. 8,
  6607. 13
  6608. ],
  6609. [
  6610. 8,
  6611. 13
  6612. ],
  6613. [
  6614. 8,
  6615. 13
  6616. ],
  6617. [
  6618. 8,
  6619. 13
  6620. ],
  6621. [
  6622. 8,
  6623. 13
  6624. ],
  6625. [
  6626. 8,
  6627. 13
  6628. ],
  6629. [
  6630. 8,
  6631. 13
  6632. ],
  6633. [
  6634. 8,
  6635. 13
  6636. ],
  6637. [
  6638. 8,
  6639. 13
  6640. ],
  6641. [
  6642. 8,
  6643. 13
  6644. ],
  6645. [
  6646. 8,
  6647. 13
  6648. ],
  6649. [
  6650. 8,
  6651. 13
  6652. ],
  6653. [
  6654. 8,
  6655. 13
  6656. ],
  6657. [
  6658. 8,
  6659. 13
  6660. ],
  6661. [
  6662. 8,
  6663. 13
  6664. ],
  6665. [
  6666. 8,
  6667. 13
  6668. ],
  6669. [
  6670. 11,
  6671. 23
  6672. ],
  6673. [
  6674. 11,
  6675. 23
  6676. ],
  6677. [
  6678. 12,
  6679. 50
  6680. ],
  6681. [
  6682. 12,
  6683. 51
  6684. ],
  6685. [
  6686. 12,
  6687. 44
  6688. ],
  6689. [
  6690. 12,
  6691. 45
  6692. ],
  6693. [
  6694. 12,
  6695. 46
  6696. ],
  6697. [
  6698. 12,
  6699. 47
  6700. ],
  6701. [
  6702. 12,
  6703. 57
  6704. ],
  6705. [
  6706. 12,
  6707. 58
  6708. ],
  6709. [
  6710. 12,
  6711. 61
  6712. ],
  6713. [
  6714. 12,
  6715. 256
  6716. ],
  6717. [
  6718. 10,
  6719. 16
  6720. ],
  6721. [
  6722. 10,
  6723. 16
  6724. ],
  6725. [
  6726. 10,
  6727. 16
  6728. ],
  6729. [
  6730. 10,
  6731. 16
  6732. ],
  6733. [
  6734. 10,
  6735. 17
  6736. ],
  6737. [
  6738. 10,
  6739. 17
  6740. ],
  6741. [
  6742. 10,
  6743. 17
  6744. ],
  6745. [
  6746. 10,
  6747. 17
  6748. ],
  6749. [
  6750. 12,
  6751. 48
  6752. ],
  6753. [
  6754. 12,
  6755. 49
  6756. ],
  6757. [
  6758. 12,
  6759. 62
  6760. ],
  6761. [
  6762. 12,
  6763. 63
  6764. ],
  6765. [
  6766. 12,
  6767. 30
  6768. ],
  6769. [
  6770. 12,
  6771. 31
  6772. ],
  6773. [
  6774. 12,
  6775. 32
  6776. ],
  6777. [
  6778. 12,
  6779. 33
  6780. ],
  6781. [
  6782. 12,
  6783. 40
  6784. ],
  6785. [
  6786. 12,
  6787. 41
  6788. ],
  6789. [
  6790. 11,
  6791. 22
  6792. ],
  6793. [
  6794. 11,
  6795. 22
  6796. ],
  6797. [
  6798. 8,
  6799. 14
  6800. ],
  6801. [
  6802. 8,
  6803. 14
  6804. ],
  6805. [
  6806. 8,
  6807. 14
  6808. ],
  6809. [
  6810. 8,
  6811. 14
  6812. ],
  6813. [
  6814. 8,
  6815. 14
  6816. ],
  6817. [
  6818. 8,
  6819. 14
  6820. ],
  6821. [
  6822. 8,
  6823. 14
  6824. ],
  6825. [
  6826. 8,
  6827. 14
  6828. ],
  6829. [
  6830. 8,
  6831. 14
  6832. ],
  6833. [
  6834. 8,
  6835. 14
  6836. ],
  6837. [
  6838. 8,
  6839. 14
  6840. ],
  6841. [
  6842. 8,
  6843. 14
  6844. ],
  6845. [
  6846. 8,
  6847. 14
  6848. ],
  6849. [
  6850. 8,
  6851. 14
  6852. ],
  6853. [
  6854. 8,
  6855. 14
  6856. ],
  6857. [
  6858. 8,
  6859. 14
  6860. ],
  6861. [
  6862. 7,
  6863. 10
  6864. ],
  6865. [
  6866. 7,
  6867. 10
  6868. ],
  6869. [
  6870. 7,
  6871. 10
  6872. ],
  6873. [
  6874. 7,
  6875. 10
  6876. ],
  6877. [
  6878. 7,
  6879. 10
  6880. ],
  6881. [
  6882. 7,
  6883. 10
  6884. ],
  6885. [
  6886. 7,
  6887. 10
  6888. ],
  6889. [
  6890. 7,
  6891. 10
  6892. ],
  6893. [
  6894. 7,
  6895. 10
  6896. ],
  6897. [
  6898. 7,
  6899. 10
  6900. ],
  6901. [
  6902. 7,
  6903. 10
  6904. ],
  6905. [
  6906. 7,
  6907. 10
  6908. ],
  6909. [
  6910. 7,
  6911. 10
  6912. ],
  6913. [
  6914. 7,
  6915. 10
  6916. ],
  6917. [
  6918. 7,
  6919. 10
  6920. ],
  6921. [
  6922. 7,
  6923. 10
  6924. ],
  6925. [
  6926. 7,
  6927. 10
  6928. ],
  6929. [
  6930. 7,
  6931. 10
  6932. ],
  6933. [
  6934. 7,
  6935. 10
  6936. ],
  6937. [
  6938. 7,
  6939. 10
  6940. ],
  6941. [
  6942. 7,
  6943. 10
  6944. ],
  6945. [
  6946. 7,
  6947. 10
  6948. ],
  6949. [
  6950. 7,
  6951. 10
  6952. ],
  6953. [
  6954. 7,
  6955. 10
  6956. ],
  6957. [
  6958. 7,
  6959. 10
  6960. ],
  6961. [
  6962. 7,
  6963. 10
  6964. ],
  6965. [
  6966. 7,
  6967. 10
  6968. ],
  6969. [
  6970. 7,
  6971. 10
  6972. ],
  6973. [
  6974. 7,
  6975. 10
  6976. ],
  6977. [
  6978. 7,
  6979. 10
  6980. ],
  6981. [
  6982. 7,
  6983. 10
  6984. ],
  6985. [
  6986. 7,
  6987. 10
  6988. ],
  6989. [
  6990. 7,
  6991. 11
  6992. ],
  6993. [
  6994. 7,
  6995. 11
  6996. ],
  6997. [
  6998. 7,
  6999. 11
  7000. ],
  7001. [
  7002. 7,
  7003. 11
  7004. ],
  7005. [
  7006. 7,
  7007. 11
  7008. ],
  7009. [
  7010. 7,
  7011. 11
  7012. ],
  7013. [
  7014. 7,
  7015. 11
  7016. ],
  7017. [
  7018. 7,
  7019. 11
  7020. ],
  7021. [
  7022. 7,
  7023. 11
  7024. ],
  7025. [
  7026. 7,
  7027. 11
  7028. ],
  7029. [
  7030. 7,
  7031. 11
  7032. ],
  7033. [
  7034. 7,
  7035. 11
  7036. ],
  7037. [
  7038. 7,
  7039. 11
  7040. ],
  7041. [
  7042. 7,
  7043. 11
  7044. ],
  7045. [
  7046. 7,
  7047. 11
  7048. ],
  7049. [
  7050. 7,
  7051. 11
  7052. ],
  7053. [
  7054. 7,
  7055. 11
  7056. ],
  7057. [
  7058. 7,
  7059. 11
  7060. ],
  7061. [
  7062. 7,
  7063. 11
  7064. ],
  7065. [
  7066. 7,
  7067. 11
  7068. ],
  7069. [
  7070. 7,
  7071. 11
  7072. ],
  7073. [
  7074. 7,
  7075. 11
  7076. ],
  7077. [
  7078. 7,
  7079. 11
  7080. ],
  7081. [
  7082. 7,
  7083. 11
  7084. ],
  7085. [
  7086. 7,
  7087. 11
  7088. ],
  7089. [
  7090. 7,
  7091. 11
  7092. ],
  7093. [
  7094. 7,
  7095. 11
  7096. ],
  7097. [
  7098. 7,
  7099. 11
  7100. ],
  7101. [
  7102. 7,
  7103. 11
  7104. ],
  7105. [
  7106. 7,
  7107. 11
  7108. ],
  7109. [
  7110. 7,
  7111. 11
  7112. ],
  7113. [
  7114. 7,
  7115. 11
  7116. ],
  7117. [
  7118. 9,
  7119. 15
  7120. ],
  7121. [
  7122. 9,
  7123. 15
  7124. ],
  7125. [
  7126. 9,
  7127. 15
  7128. ],
  7129. [
  7130. 9,
  7131. 15
  7132. ],
  7133. [
  7134. 9,
  7135. 15
  7136. ],
  7137. [
  7138. 9,
  7139. 15
  7140. ],
  7141. [
  7142. 9,
  7143. 15
  7144. ],
  7145. [
  7146. 9,
  7147. 15
  7148. ],
  7149. [
  7150. 12,
  7151. 128
  7152. ],
  7153. [
  7154. 12,
  7155. 192
  7156. ],
  7157. [
  7158. 12,
  7159. 26
  7160. ],
  7161. [
  7162. 12,
  7163. 27
  7164. ],
  7165. [
  7166. 12,
  7167. 28
  7168. ],
  7169. [
  7170. 12,
  7171. 29
  7172. ],
  7173. [
  7174. 11,
  7175. 19
  7176. ],
  7177. [
  7178. 11,
  7179. 19
  7180. ],
  7181. [
  7182. 11,
  7183. 20
  7184. ],
  7185. [
  7186. 11,
  7187. 20
  7188. ],
  7189. [
  7190. 12,
  7191. 34
  7192. ],
  7193. [
  7194. 12,
  7195. 35
  7196. ],
  7197. [
  7198. 12,
  7199. 36
  7200. ],
  7201. [
  7202. 12,
  7203. 37
  7204. ],
  7205. [
  7206. 12,
  7207. 38
  7208. ],
  7209. [
  7210. 12,
  7211. 39
  7212. ],
  7213. [
  7214. 11,
  7215. 21
  7216. ],
  7217. [
  7218. 11,
  7219. 21
  7220. ],
  7221. [
  7222. 12,
  7223. 42
  7224. ],
  7225. [
  7226. 12,
  7227. 43
  7228. ],
  7229. [
  7230. 10,
  7231. 0
  7232. ],
  7233. [
  7234. 10,
  7235. 0
  7236. ],
  7237. [
  7238. 10,
  7239. 0
  7240. ],
  7241. [
  7242. 10,
  7243. 0
  7244. ],
  7245. [
  7246. 7,
  7247. 12
  7248. ],
  7249. [
  7250. 7,
  7251. 12
  7252. ],
  7253. [
  7254. 7,
  7255. 12
  7256. ],
  7257. [
  7258. 7,
  7259. 12
  7260. ],
  7261. [
  7262. 7,
  7263. 12
  7264. ],
  7265. [
  7266. 7,
  7267. 12
  7268. ],
  7269. [
  7270. 7,
  7271. 12
  7272. ],
  7273. [
  7274. 7,
  7275. 12
  7276. ],
  7277. [
  7278. 7,
  7279. 12
  7280. ],
  7281. [
  7282. 7,
  7283. 12
  7284. ],
  7285. [
  7286. 7,
  7287. 12
  7288. ],
  7289. [
  7290. 7,
  7291. 12
  7292. ],
  7293. [
  7294. 7,
  7295. 12
  7296. ],
  7297. [
  7298. 7,
  7299. 12
  7300. ],
  7301. [
  7302. 7,
  7303. 12
  7304. ],
  7305. [
  7306. 7,
  7307. 12
  7308. ],
  7309. [
  7310. 7,
  7311. 12
  7312. ],
  7313. [
  7314. 7,
  7315. 12
  7316. ],
  7317. [
  7318. 7,
  7319. 12
  7320. ],
  7321. [
  7322. 7,
  7323. 12
  7324. ],
  7325. [
  7326. 7,
  7327. 12
  7328. ],
  7329. [
  7330. 7,
  7331. 12
  7332. ],
  7333. [
  7334. 7,
  7335. 12
  7336. ],
  7337. [
  7338. 7,
  7339. 12
  7340. ],
  7341. [
  7342. 7,
  7343. 12
  7344. ],
  7345. [
  7346. 7,
  7347. 12
  7348. ],
  7349. [
  7350. 7,
  7351. 12
  7352. ],
  7353. [
  7354. 7,
  7355. 12
  7356. ],
  7357. [
  7358. 7,
  7359. 12
  7360. ],
  7361. [
  7362. 7,
  7363. 12
  7364. ],
  7365. [
  7366. 7,
  7367. 12
  7368. ],
  7369. [
  7370. 7,
  7371. 12
  7372. ]
  7373. ];
  7374. var blackTable3 = [
  7375. [
  7376. -1,
  7377. -1
  7378. ],
  7379. [
  7380. -1,
  7381. -1
  7382. ],
  7383. [
  7384. -1,
  7385. -1
  7386. ],
  7387. [
  7388. -1,
  7389. -1
  7390. ],
  7391. [
  7392. 6,
  7393. 9
  7394. ],
  7395. [
  7396. 6,
  7397. 8
  7398. ],
  7399. [
  7400. 5,
  7401. 7
  7402. ],
  7403. [
  7404. 5,
  7405. 7
  7406. ],
  7407. [
  7408. 4,
  7409. 6
  7410. ],
  7411. [
  7412. 4,
  7413. 6
  7414. ],
  7415. [
  7416. 4,
  7417. 6
  7418. ],
  7419. [
  7420. 4,
  7421. 6
  7422. ],
  7423. [
  7424. 4,
  7425. 5
  7426. ],
  7427. [
  7428. 4,
  7429. 5
  7430. ],
  7431. [
  7432. 4,
  7433. 5
  7434. ],
  7435. [
  7436. 4,
  7437. 5
  7438. ],
  7439. [
  7440. 3,
  7441. 1
  7442. ],
  7443. [
  7444. 3,
  7445. 1
  7446. ],
  7447. [
  7448. 3,
  7449. 1
  7450. ],
  7451. [
  7452. 3,
  7453. 1
  7454. ],
  7455. [
  7456. 3,
  7457. 1
  7458. ],
  7459. [
  7460. 3,
  7461. 1
  7462. ],
  7463. [
  7464. 3,
  7465. 1
  7466. ],
  7467. [
  7468. 3,
  7469. 1
  7470. ],
  7471. [
  7472. 3,
  7473. 4
  7474. ],
  7475. [
  7476. 3,
  7477. 4
  7478. ],
  7479. [
  7480. 3,
  7481. 4
  7482. ],
  7483. [
  7484. 3,
  7485. 4
  7486. ],
  7487. [
  7488. 3,
  7489. 4
  7490. ],
  7491. [
  7492. 3,
  7493. 4
  7494. ],
  7495. [
  7496. 3,
  7497. 4
  7498. ],
  7499. [
  7500. 3,
  7501. 4
  7502. ],
  7503. [
  7504. 2,
  7505. 3
  7506. ],
  7507. [
  7508. 2,
  7509. 3
  7510. ],
  7511. [
  7512. 2,
  7513. 3
  7514. ],
  7515. [
  7516. 2,
  7517. 3
  7518. ],
  7519. [
  7520. 2,
  7521. 3
  7522. ],
  7523. [
  7524. 2,
  7525. 3
  7526. ],
  7527. [
  7528. 2,
  7529. 3
  7530. ],
  7531. [
  7532. 2,
  7533. 3
  7534. ],
  7535. [
  7536. 2,
  7537. 3
  7538. ],
  7539. [
  7540. 2,
  7541. 3
  7542. ],
  7543. [
  7544. 2,
  7545. 3
  7546. ],
  7547. [
  7548. 2,
  7549. 3
  7550. ],
  7551. [
  7552. 2,
  7553. 3
  7554. ],
  7555. [
  7556. 2,
  7557. 3
  7558. ],
  7559. [
  7560. 2,
  7561. 3
  7562. ],
  7563. [
  7564. 2,
  7565. 3
  7566. ],
  7567. [
  7568. 2,
  7569. 2
  7570. ],
  7571. [
  7572. 2,
  7573. 2
  7574. ],
  7575. [
  7576. 2,
  7577. 2
  7578. ],
  7579. [
  7580. 2,
  7581. 2
  7582. ],
  7583. [
  7584. 2,
  7585. 2
  7586. ],
  7587. [
  7588. 2,
  7589. 2
  7590. ],
  7591. [
  7592. 2,
  7593. 2
  7594. ],
  7595. [
  7596. 2,
  7597. 2
  7598. ],
  7599. [
  7600. 2,
  7601. 2
  7602. ],
  7603. [
  7604. 2,
  7605. 2
  7606. ],
  7607. [
  7608. 2,
  7609. 2
  7610. ],
  7611. [
  7612. 2,
  7613. 2
  7614. ],
  7615. [
  7616. 2,
  7617. 2
  7618. ],
  7619. [
  7620. 2,
  7621. 2
  7622. ],
  7623. [
  7624. 2,
  7625. 2
  7626. ],
  7627. [
  7628. 2,
  7629. 2
  7630. ]
  7631. ];
  7632. function CCITTFaxStream(str, maybeLength, params) {
  7633. this.str = str;
  7634. this.dict = str.dict;
  7635. params = params || Dict.empty;
  7636. this.encoding = params.get('K') || 0;
  7637. this.eoline = params.get('EndOfLine') || false;
  7638. this.byteAlign = params.get('EncodedByteAlign') || false;
  7639. this.columns = params.get('Columns') || 1728;
  7640. this.rows = params.get('Rows') || 0;
  7641. var eoblock = params.get('EndOfBlock');
  7642. if (eoblock === null || eoblock === undefined) {
  7643. eoblock = true;
  7644. }
  7645. this.eoblock = eoblock;
  7646. this.black = params.get('BlackIs1') || false;
  7647. this.codingLine = new Uint32Array(this.columns + 1);
  7648. this.refLine = new Uint32Array(this.columns + 2);
  7649. this.codingLine[0] = this.columns;
  7650. this.codingPos = 0;
  7651. this.row = 0;
  7652. this.nextLine2D = this.encoding < 0;
  7653. this.inputBits = 0;
  7654. this.inputBuf = 0;
  7655. this.outputBits = 0;
  7656. var code1;
  7657. while ((code1 = this.lookBits(12)) === 0) {
  7658. this.eatBits(1);
  7659. }
  7660. if (code1 === 1) {
  7661. this.eatBits(12);
  7662. }
  7663. if (this.encoding > 0) {
  7664. this.nextLine2D = !this.lookBits(1);
  7665. this.eatBits(1);
  7666. }
  7667. DecodeStream.call(this, maybeLength);
  7668. }
  7669. CCITTFaxStream.prototype = Object.create(DecodeStream.prototype);
  7670. CCITTFaxStream.prototype.readBlock = function CCITTFaxStream_readBlock() {
  7671. while (!this.eof) {
  7672. var c = this.lookChar();
  7673. this.ensureBuffer(this.bufferLength + 1);
  7674. this.buffer[this.bufferLength++] = c;
  7675. }
  7676. };
  7677. CCITTFaxStream.prototype.addPixels = function ccittFaxStreamAddPixels(a1, blackPixels) {
  7678. var codingLine = this.codingLine;
  7679. var codingPos = this.codingPos;
  7680. if (a1 > codingLine[codingPos]) {
  7681. if (a1 > this.columns) {
  7682. info('row is wrong length');
  7683. this.err = true;
  7684. a1 = this.columns;
  7685. }
  7686. if (codingPos & 1 ^ blackPixels) {
  7687. ++codingPos;
  7688. }
  7689. codingLine[codingPos] = a1;
  7690. }
  7691. this.codingPos = codingPos;
  7692. };
  7693. CCITTFaxStream.prototype.addPixelsNeg = function ccittFaxStreamAddPixelsNeg(a1, blackPixels) {
  7694. var codingLine = this.codingLine;
  7695. var codingPos = this.codingPos;
  7696. if (a1 > codingLine[codingPos]) {
  7697. if (a1 > this.columns) {
  7698. info('row is wrong length');
  7699. this.err = true;
  7700. a1 = this.columns;
  7701. }
  7702. if (codingPos & 1 ^ blackPixels) {
  7703. ++codingPos;
  7704. }
  7705. codingLine[codingPos] = a1;
  7706. } else if (a1 < codingLine[codingPos]) {
  7707. if (a1 < 0) {
  7708. info('invalid code');
  7709. this.err = true;
  7710. a1 = 0;
  7711. }
  7712. while (codingPos > 0 && a1 < codingLine[codingPos - 1]) {
  7713. --codingPos;
  7714. }
  7715. codingLine[codingPos] = a1;
  7716. }
  7717. this.codingPos = codingPos;
  7718. };
  7719. CCITTFaxStream.prototype.lookChar = function CCITTFaxStream_lookChar() {
  7720. var refLine = this.refLine;
  7721. var codingLine = this.codingLine;
  7722. var columns = this.columns;
  7723. var refPos, blackPixels, bits, i;
  7724. if (this.outputBits === 0) {
  7725. if (this.eof) {
  7726. return null;
  7727. }
  7728. this.err = false;
  7729. var code1, code2, code3;
  7730. if (this.nextLine2D) {
  7731. for (i = 0; codingLine[i] < columns; ++i) {
  7732. refLine[i] = codingLine[i];
  7733. }
  7734. refLine[i++] = columns;
  7735. refLine[i] = columns;
  7736. codingLine[0] = 0;
  7737. this.codingPos = 0;
  7738. refPos = 0;
  7739. blackPixels = 0;
  7740. while (codingLine[this.codingPos] < columns) {
  7741. code1 = this.getTwoDimCode();
  7742. switch (code1) {
  7743. case twoDimPass:
  7744. this.addPixels(refLine[refPos + 1], blackPixels);
  7745. if (refLine[refPos + 1] < columns) {
  7746. refPos += 2;
  7747. }
  7748. break;
  7749. case twoDimHoriz:
  7750. code1 = code2 = 0;
  7751. if (blackPixels) {
  7752. do {
  7753. code1 += code3 = this.getBlackCode();
  7754. } while (code3 >= 64);
  7755. do {
  7756. code2 += code3 = this.getWhiteCode();
  7757. } while (code3 >= 64);
  7758. } else {
  7759. do {
  7760. code1 += code3 = this.getWhiteCode();
  7761. } while (code3 >= 64);
  7762. do {
  7763. code2 += code3 = this.getBlackCode();
  7764. } while (code3 >= 64);
  7765. }
  7766. this.addPixels(codingLine[this.codingPos] + code1, blackPixels);
  7767. if (codingLine[this.codingPos] < columns) {
  7768. this.addPixels(codingLine[this.codingPos] + code2, blackPixels ^ 1);
  7769. }
  7770. while (refLine[refPos] <= codingLine[this.codingPos] && refLine[refPos] < columns) {
  7771. refPos += 2;
  7772. }
  7773. break;
  7774. case twoDimVertR3:
  7775. this.addPixels(refLine[refPos] + 3, blackPixels);
  7776. blackPixels ^= 1;
  7777. if (codingLine[this.codingPos] < columns) {
  7778. ++refPos;
  7779. while (refLine[refPos] <= codingLine[this.codingPos] && refLine[refPos] < columns) {
  7780. refPos += 2;
  7781. }
  7782. }
  7783. break;
  7784. case twoDimVertR2:
  7785. this.addPixels(refLine[refPos] + 2, blackPixels);
  7786. blackPixels ^= 1;
  7787. if (codingLine[this.codingPos] < columns) {
  7788. ++refPos;
  7789. while (refLine[refPos] <= codingLine[this.codingPos] && refLine[refPos] < columns) {
  7790. refPos += 2;
  7791. }
  7792. }
  7793. break;
  7794. case twoDimVertR1:
  7795. this.addPixels(refLine[refPos] + 1, blackPixels);
  7796. blackPixels ^= 1;
  7797. if (codingLine[this.codingPos] < columns) {
  7798. ++refPos;
  7799. while (refLine[refPos] <= codingLine[this.codingPos] && refLine[refPos] < columns) {
  7800. refPos += 2;
  7801. }
  7802. }
  7803. break;
  7804. case twoDimVert0:
  7805. this.addPixels(refLine[refPos], blackPixels);
  7806. blackPixels ^= 1;
  7807. if (codingLine[this.codingPos] < columns) {
  7808. ++refPos;
  7809. while (refLine[refPos] <= codingLine[this.codingPos] && refLine[refPos] < columns) {
  7810. refPos += 2;
  7811. }
  7812. }
  7813. break;
  7814. case twoDimVertL3:
  7815. this.addPixelsNeg(refLine[refPos] - 3, blackPixels);
  7816. blackPixels ^= 1;
  7817. if (codingLine[this.codingPos] < columns) {
  7818. if (refPos > 0) {
  7819. --refPos;
  7820. } else {
  7821. ++refPos;
  7822. }
  7823. while (refLine[refPos] <= codingLine[this.codingPos] && refLine[refPos] < columns) {
  7824. refPos += 2;
  7825. }
  7826. }
  7827. break;
  7828. case twoDimVertL2:
  7829. this.addPixelsNeg(refLine[refPos] - 2, blackPixels);
  7830. blackPixels ^= 1;
  7831. if (codingLine[this.codingPos] < columns) {
  7832. if (refPos > 0) {
  7833. --refPos;
  7834. } else {
  7835. ++refPos;
  7836. }
  7837. while (refLine[refPos] <= codingLine[this.codingPos] && refLine[refPos] < columns) {
  7838. refPos += 2;
  7839. }
  7840. }
  7841. break;
  7842. case twoDimVertL1:
  7843. this.addPixelsNeg(refLine[refPos] - 1, blackPixels);
  7844. blackPixels ^= 1;
  7845. if (codingLine[this.codingPos] < columns) {
  7846. if (refPos > 0) {
  7847. --refPos;
  7848. } else {
  7849. ++refPos;
  7850. }
  7851. while (refLine[refPos] <= codingLine[this.codingPos] && refLine[refPos] < columns) {
  7852. refPos += 2;
  7853. }
  7854. }
  7855. break;
  7856. case ccittEOF:
  7857. this.addPixels(columns, 0);
  7858. this.eof = true;
  7859. break;
  7860. default:
  7861. info('bad 2d code');
  7862. this.addPixels(columns, 0);
  7863. this.err = true;
  7864. }
  7865. }
  7866. } else {
  7867. codingLine[0] = 0;
  7868. this.codingPos = 0;
  7869. blackPixels = 0;
  7870. while (codingLine[this.codingPos] < columns) {
  7871. code1 = 0;
  7872. if (blackPixels) {
  7873. do {
  7874. code1 += code3 = this.getBlackCode();
  7875. } while (code3 >= 64);
  7876. } else {
  7877. do {
  7878. code1 += code3 = this.getWhiteCode();
  7879. } while (code3 >= 64);
  7880. }
  7881. this.addPixels(codingLine[this.codingPos] + code1, blackPixels);
  7882. blackPixels ^= 1;
  7883. }
  7884. }
  7885. var gotEOL = false;
  7886. if (this.byteAlign) {
  7887. this.inputBits &= ~7;
  7888. }
  7889. if (!this.eoblock && this.row === this.rows - 1) {
  7890. this.eof = true;
  7891. } else {
  7892. code1 = this.lookBits(12);
  7893. if (this.eoline) {
  7894. while (code1 !== ccittEOF && code1 !== 1) {
  7895. this.eatBits(1);
  7896. code1 = this.lookBits(12);
  7897. }
  7898. } else {
  7899. while (code1 === 0) {
  7900. this.eatBits(1);
  7901. code1 = this.lookBits(12);
  7902. }
  7903. }
  7904. if (code1 === 1) {
  7905. this.eatBits(12);
  7906. gotEOL = true;
  7907. } else if (code1 === ccittEOF) {
  7908. this.eof = true;
  7909. }
  7910. }
  7911. if (!this.eof && this.encoding > 0) {
  7912. this.nextLine2D = !this.lookBits(1);
  7913. this.eatBits(1);
  7914. }
  7915. if (this.eoblock && gotEOL && this.byteAlign) {
  7916. code1 = this.lookBits(12);
  7917. if (code1 === 1) {
  7918. this.eatBits(12);
  7919. if (this.encoding > 0) {
  7920. this.lookBits(1);
  7921. this.eatBits(1);
  7922. }
  7923. if (this.encoding >= 0) {
  7924. for (i = 0; i < 4; ++i) {
  7925. code1 = this.lookBits(12);
  7926. if (code1 !== 1) {
  7927. info('bad rtc code: ' + code1);
  7928. }
  7929. this.eatBits(12);
  7930. if (this.encoding > 0) {
  7931. this.lookBits(1);
  7932. this.eatBits(1);
  7933. }
  7934. }
  7935. }
  7936. this.eof = true;
  7937. }
  7938. } else if (this.err && this.eoline) {
  7939. while (true) {
  7940. code1 = this.lookBits(13);
  7941. if (code1 === ccittEOF) {
  7942. this.eof = true;
  7943. return null;
  7944. }
  7945. if (code1 >> 1 === 1) {
  7946. break;
  7947. }
  7948. this.eatBits(1);
  7949. }
  7950. this.eatBits(12);
  7951. if (this.encoding > 0) {
  7952. this.eatBits(1);
  7953. this.nextLine2D = !(code1 & 1);
  7954. }
  7955. }
  7956. if (codingLine[0] > 0) {
  7957. this.outputBits = codingLine[this.codingPos = 0];
  7958. } else {
  7959. this.outputBits = codingLine[this.codingPos = 1];
  7960. }
  7961. this.row++;
  7962. }
  7963. var c;
  7964. if (this.outputBits >= 8) {
  7965. c = this.codingPos & 1 ? 0 : 0xFF;
  7966. this.outputBits -= 8;
  7967. if (this.outputBits === 0 && codingLine[this.codingPos] < columns) {
  7968. this.codingPos++;
  7969. this.outputBits = codingLine[this.codingPos] - codingLine[this.codingPos - 1];
  7970. }
  7971. } else {
  7972. bits = 8;
  7973. c = 0;
  7974. do {
  7975. if (this.outputBits > bits) {
  7976. c <<= bits;
  7977. if (!(this.codingPos & 1)) {
  7978. c |= 0xFF >> 8 - bits;
  7979. }
  7980. this.outputBits -= bits;
  7981. bits = 0;
  7982. } else {
  7983. c <<= this.outputBits;
  7984. if (!(this.codingPos & 1)) {
  7985. c |= 0xFF >> 8 - this.outputBits;
  7986. }
  7987. bits -= this.outputBits;
  7988. this.outputBits = 0;
  7989. if (codingLine[this.codingPos] < columns) {
  7990. this.codingPos++;
  7991. this.outputBits = codingLine[this.codingPos] - codingLine[this.codingPos - 1];
  7992. } else if (bits > 0) {
  7993. c <<= bits;
  7994. bits = 0;
  7995. }
  7996. }
  7997. } while (bits);
  7998. }
  7999. if (this.black) {
  8000. c ^= 0xFF;
  8001. }
  8002. return c;
  8003. };
  8004. CCITTFaxStream.prototype.findTableCode = function ccittFaxStreamFindTableCode(start, end, table, limit) {
  8005. var limitValue = limit || 0;
  8006. for (var i = start; i <= end; ++i) {
  8007. var code = this.lookBits(i);
  8008. if (code === ccittEOF) {
  8009. return [
  8010. true,
  8011. 1,
  8012. false
  8013. ];
  8014. }
  8015. if (i < end) {
  8016. code <<= end - i;
  8017. }
  8018. if (!limitValue || code >= limitValue) {
  8019. var p = table[code - limitValue];
  8020. if (p[0] === i) {
  8021. this.eatBits(i);
  8022. return [
  8023. true,
  8024. p[1],
  8025. true
  8026. ];
  8027. }
  8028. }
  8029. }
  8030. return [
  8031. false,
  8032. 0,
  8033. false
  8034. ];
  8035. };
  8036. CCITTFaxStream.prototype.getTwoDimCode = function ccittFaxStreamGetTwoDimCode() {
  8037. var code = 0;
  8038. var p;
  8039. if (this.eoblock) {
  8040. code = this.lookBits(7);
  8041. p = twoDimTable[code];
  8042. if (p && p[0] > 0) {
  8043. this.eatBits(p[0]);
  8044. return p[1];
  8045. }
  8046. } else {
  8047. var result = this.findTableCode(1, 7, twoDimTable);
  8048. if (result[0] && result[2]) {
  8049. return result[1];
  8050. }
  8051. }
  8052. info('Bad two dim code');
  8053. return ccittEOF;
  8054. };
  8055. CCITTFaxStream.prototype.getWhiteCode = function ccittFaxStreamGetWhiteCode() {
  8056. var code = 0;
  8057. var p;
  8058. if (this.eoblock) {
  8059. code = this.lookBits(12);
  8060. if (code === ccittEOF) {
  8061. return 1;
  8062. }
  8063. if (code >> 5 === 0) {
  8064. p = whiteTable1[code];
  8065. } else {
  8066. p = whiteTable2[code >> 3];
  8067. }
  8068. if (p[0] > 0) {
  8069. this.eatBits(p[0]);
  8070. return p[1];
  8071. }
  8072. } else {
  8073. var result = this.findTableCode(1, 9, whiteTable2);
  8074. if (result[0]) {
  8075. return result[1];
  8076. }
  8077. result = this.findTableCode(11, 12, whiteTable1);
  8078. if (result[0]) {
  8079. return result[1];
  8080. }
  8081. }
  8082. info('bad white code');
  8083. this.eatBits(1);
  8084. return 1;
  8085. };
  8086. CCITTFaxStream.prototype.getBlackCode = function ccittFaxStreamGetBlackCode() {
  8087. var code, p;
  8088. if (this.eoblock) {
  8089. code = this.lookBits(13);
  8090. if (code === ccittEOF) {
  8091. return 1;
  8092. }
  8093. if (code >> 7 === 0) {
  8094. p = blackTable1[code];
  8095. } else if (code >> 9 === 0 && code >> 7 !== 0) {
  8096. p = blackTable2[(code >> 1) - 64];
  8097. } else {
  8098. p = blackTable3[code >> 7];
  8099. }
  8100. if (p[0] > 0) {
  8101. this.eatBits(p[0]);
  8102. return p[1];
  8103. }
  8104. } else {
  8105. var result = this.findTableCode(2, 6, blackTable3);
  8106. if (result[0]) {
  8107. return result[1];
  8108. }
  8109. result = this.findTableCode(7, 12, blackTable2, 64);
  8110. if (result[0]) {
  8111. return result[1];
  8112. }
  8113. result = this.findTableCode(10, 13, blackTable1);
  8114. if (result[0]) {
  8115. return result[1];
  8116. }
  8117. }
  8118. info('bad black code');
  8119. this.eatBits(1);
  8120. return 1;
  8121. };
  8122. CCITTFaxStream.prototype.lookBits = function CCITTFaxStream_lookBits(n) {
  8123. var c;
  8124. while (this.inputBits < n) {
  8125. if ((c = this.str.getByte()) === -1) {
  8126. if (this.inputBits === 0) {
  8127. return ccittEOF;
  8128. }
  8129. return this.inputBuf << n - this.inputBits & 0xFFFF >> 16 - n;
  8130. }
  8131. this.inputBuf = this.inputBuf << 8 | c;
  8132. this.inputBits += 8;
  8133. }
  8134. return this.inputBuf >> this.inputBits - n & 0xFFFF >> 16 - n;
  8135. };
  8136. CCITTFaxStream.prototype.eatBits = function CCITTFaxStream_eatBits(n) {
  8137. if ((this.inputBits -= n) < 0) {
  8138. this.inputBits = 0;
  8139. }
  8140. };
  8141. return CCITTFaxStream;
  8142. }();
  8143. var LZWStream = function LZWStreamClosure() {
  8144. function LZWStream(str, maybeLength, earlyChange) {
  8145. this.str = str;
  8146. this.dict = str.dict;
  8147. this.cachedData = 0;
  8148. this.bitsCached = 0;
  8149. var maxLzwDictionarySize = 4096;
  8150. var lzwState = {
  8151. earlyChange: earlyChange,
  8152. codeLength: 9,
  8153. nextCode: 258,
  8154. dictionaryValues: new Uint8Array(maxLzwDictionarySize),
  8155. dictionaryLengths: new Uint16Array(maxLzwDictionarySize),
  8156. dictionaryPrevCodes: new Uint16Array(maxLzwDictionarySize),
  8157. currentSequence: new Uint8Array(maxLzwDictionarySize),
  8158. currentSequenceLength: 0
  8159. };
  8160. for (var i = 0; i < 256; ++i) {
  8161. lzwState.dictionaryValues[i] = i;
  8162. lzwState.dictionaryLengths[i] = 1;
  8163. }
  8164. this.lzwState = lzwState;
  8165. DecodeStream.call(this, maybeLength);
  8166. }
  8167. LZWStream.prototype = Object.create(DecodeStream.prototype);
  8168. LZWStream.prototype.readBits = function LZWStream_readBits(n) {
  8169. var bitsCached = this.bitsCached;
  8170. var cachedData = this.cachedData;
  8171. while (bitsCached < n) {
  8172. var c = this.str.getByte();
  8173. if (c === -1) {
  8174. this.eof = true;
  8175. return null;
  8176. }
  8177. cachedData = cachedData << 8 | c;
  8178. bitsCached += 8;
  8179. }
  8180. this.bitsCached = bitsCached -= n;
  8181. this.cachedData = cachedData;
  8182. this.lastCode = null;
  8183. return cachedData >>> bitsCached & (1 << n) - 1;
  8184. };
  8185. LZWStream.prototype.readBlock = function LZWStream_readBlock() {
  8186. var blockSize = 512;
  8187. var estimatedDecodedSize = blockSize * 2, decodedSizeDelta = blockSize;
  8188. var i, j, q;
  8189. var lzwState = this.lzwState;
  8190. if (!lzwState) {
  8191. return;
  8192. }
  8193. var earlyChange = lzwState.earlyChange;
  8194. var nextCode = lzwState.nextCode;
  8195. var dictionaryValues = lzwState.dictionaryValues;
  8196. var dictionaryLengths = lzwState.dictionaryLengths;
  8197. var dictionaryPrevCodes = lzwState.dictionaryPrevCodes;
  8198. var codeLength = lzwState.codeLength;
  8199. var prevCode = lzwState.prevCode;
  8200. var currentSequence = lzwState.currentSequence;
  8201. var currentSequenceLength = lzwState.currentSequenceLength;
  8202. var decodedLength = 0;
  8203. var currentBufferLength = this.bufferLength;
  8204. var buffer = this.ensureBuffer(this.bufferLength + estimatedDecodedSize);
  8205. for (i = 0; i < blockSize; i++) {
  8206. var code = this.readBits(codeLength);
  8207. var hasPrev = currentSequenceLength > 0;
  8208. if (code < 256) {
  8209. currentSequence[0] = code;
  8210. currentSequenceLength = 1;
  8211. } else if (code >= 258) {
  8212. if (code < nextCode) {
  8213. currentSequenceLength = dictionaryLengths[code];
  8214. for (j = currentSequenceLength - 1, q = code; j >= 0; j--) {
  8215. currentSequence[j] = dictionaryValues[q];
  8216. q = dictionaryPrevCodes[q];
  8217. }
  8218. } else {
  8219. currentSequence[currentSequenceLength++] = currentSequence[0];
  8220. }
  8221. } else if (code === 256) {
  8222. codeLength = 9;
  8223. nextCode = 258;
  8224. currentSequenceLength = 0;
  8225. continue;
  8226. } else {
  8227. this.eof = true;
  8228. delete this.lzwState;
  8229. break;
  8230. }
  8231. if (hasPrev) {
  8232. dictionaryPrevCodes[nextCode] = prevCode;
  8233. dictionaryLengths[nextCode] = dictionaryLengths[prevCode] + 1;
  8234. dictionaryValues[nextCode] = currentSequence[0];
  8235. nextCode++;
  8236. codeLength = nextCode + earlyChange & nextCode + earlyChange - 1 ? codeLength : Math.min(Math.log(nextCode + earlyChange) / 0.6931471805599453 + 1, 12) | 0;
  8237. }
  8238. prevCode = code;
  8239. decodedLength += currentSequenceLength;
  8240. if (estimatedDecodedSize < decodedLength) {
  8241. do {
  8242. estimatedDecodedSize += decodedSizeDelta;
  8243. } while (estimatedDecodedSize < decodedLength);
  8244. buffer = this.ensureBuffer(this.bufferLength + estimatedDecodedSize);
  8245. }
  8246. for (j = 0; j < currentSequenceLength; j++) {
  8247. buffer[currentBufferLength++] = currentSequence[j];
  8248. }
  8249. }
  8250. lzwState.nextCode = nextCode;
  8251. lzwState.codeLength = codeLength;
  8252. lzwState.prevCode = prevCode;
  8253. lzwState.currentSequenceLength = currentSequenceLength;
  8254. this.bufferLength = currentBufferLength;
  8255. };
  8256. return LZWStream;
  8257. }();
  8258. var NullStream = function NullStreamClosure() {
  8259. function NullStream() {
  8260. Stream.call(this, new Uint8Array(0));
  8261. }
  8262. NullStream.prototype = Stream.prototype;
  8263. return NullStream;
  8264. }();
  8265. exports.Ascii85Stream = Ascii85Stream;
  8266. exports.AsciiHexStream = AsciiHexStream;
  8267. exports.CCITTFaxStream = CCITTFaxStream;
  8268. exports.DecryptStream = DecryptStream;
  8269. exports.DecodeStream = DecodeStream;
  8270. exports.FlateStream = FlateStream;
  8271. exports.Jbig2Stream = Jbig2Stream;
  8272. exports.JpegStream = JpegStream;
  8273. exports.JpxStream = JpxStream;
  8274. exports.NullStream = NullStream;
  8275. exports.PredictorStream = PredictorStream;
  8276. exports.RunLengthStream = RunLengthStream;
  8277. exports.Stream = Stream;
  8278. exports.StreamsSequenceStream = StreamsSequenceStream;
  8279. exports.StringStream = StringStream;
  8280. exports.LZWStream = LZWStream;
  8281. /***/ }),
  8282. /* 3 */
  8283. /***/ (function(module, exports, __w_pdfjs_require__) {
  8284. "use strict";
  8285. var sharedUtil = __w_pdfjs_require__(0);
  8286. var corePrimitives = __w_pdfjs_require__(1);
  8287. var coreFunction = __w_pdfjs_require__(6);
  8288. var error = sharedUtil.error;
  8289. var info = sharedUtil.info;
  8290. var isArray = sharedUtil.isArray;
  8291. var isString = sharedUtil.isString;
  8292. var shadow = sharedUtil.shadow;
  8293. var warn = sharedUtil.warn;
  8294. var isDict = corePrimitives.isDict;
  8295. var isName = corePrimitives.isName;
  8296. var isStream = corePrimitives.isStream;
  8297. var PDFFunction = coreFunction.PDFFunction;
  8298. var ColorSpace = function ColorSpaceClosure() {
  8299. function resizeRgbImage(src, bpc, w1, h1, w2, h2, alpha01, dest) {
  8300. var COMPONENTS = 3;
  8301. alpha01 = alpha01 !== 1 ? 0 : alpha01;
  8302. var xRatio = w1 / w2;
  8303. var yRatio = h1 / h2;
  8304. var i, j, py, newIndex = 0, oldIndex;
  8305. var xScaled = new Uint16Array(w2);
  8306. var w1Scanline = w1 * COMPONENTS;
  8307. for (i = 0; i < w2; i++) {
  8308. xScaled[i] = Math.floor(i * xRatio) * COMPONENTS;
  8309. }
  8310. for (i = 0; i < h2; i++) {
  8311. py = Math.floor(i * yRatio) * w1Scanline;
  8312. for (j = 0; j < w2; j++) {
  8313. oldIndex = py + xScaled[j];
  8314. dest[newIndex++] = src[oldIndex++];
  8315. dest[newIndex++] = src[oldIndex++];
  8316. dest[newIndex++] = src[oldIndex++];
  8317. newIndex += alpha01;
  8318. }
  8319. }
  8320. }
  8321. function ColorSpace() {
  8322. error('should not call ColorSpace constructor');
  8323. }
  8324. ColorSpace.prototype = {
  8325. getRgb: function ColorSpace_getRgb(src, srcOffset) {
  8326. var rgb = new Uint8Array(3);
  8327. this.getRgbItem(src, srcOffset, rgb, 0);
  8328. return rgb;
  8329. },
  8330. getRgbItem: function ColorSpace_getRgbItem(src, srcOffset, dest, destOffset) {
  8331. error('Should not call ColorSpace.getRgbItem');
  8332. },
  8333. getRgbBuffer: function ColorSpace_getRgbBuffer(src, srcOffset, count, dest, destOffset, bits, alpha01) {
  8334. error('Should not call ColorSpace.getRgbBuffer');
  8335. },
  8336. getOutputLength: function ColorSpace_getOutputLength(inputLength, alpha01) {
  8337. error('Should not call ColorSpace.getOutputLength');
  8338. },
  8339. isPassthrough: function ColorSpace_isPassthrough(bits) {
  8340. return false;
  8341. },
  8342. fillRgb: function ColorSpace_fillRgb(dest, originalWidth, originalHeight, width, height, actualHeight, bpc, comps, alpha01) {
  8343. var count = originalWidth * originalHeight;
  8344. var rgbBuf = null;
  8345. var numComponentColors = 1 << bpc;
  8346. var needsResizing = originalHeight !== height || originalWidth !== width;
  8347. var i, ii;
  8348. if (this.isPassthrough(bpc)) {
  8349. rgbBuf = comps;
  8350. } else if (this.numComps === 1 && count > numComponentColors && this.name !== 'DeviceGray' && this.name !== 'DeviceRGB') {
  8351. var allColors = bpc <= 8 ? new Uint8Array(numComponentColors) : new Uint16Array(numComponentColors);
  8352. var key;
  8353. for (i = 0; i < numComponentColors; i++) {
  8354. allColors[i] = i;
  8355. }
  8356. var colorMap = new Uint8Array(numComponentColors * 3);
  8357. this.getRgbBuffer(allColors, 0, numComponentColors, colorMap, 0, bpc, 0);
  8358. var destPos, rgbPos;
  8359. if (!needsResizing) {
  8360. destPos = 0;
  8361. for (i = 0; i < count; ++i) {
  8362. key = comps[i] * 3;
  8363. dest[destPos++] = colorMap[key];
  8364. dest[destPos++] = colorMap[key + 1];
  8365. dest[destPos++] = colorMap[key + 2];
  8366. destPos += alpha01;
  8367. }
  8368. } else {
  8369. rgbBuf = new Uint8Array(count * 3);
  8370. rgbPos = 0;
  8371. for (i = 0; i < count; ++i) {
  8372. key = comps[i] * 3;
  8373. rgbBuf[rgbPos++] = colorMap[key];
  8374. rgbBuf[rgbPos++] = colorMap[key + 1];
  8375. rgbBuf[rgbPos++] = colorMap[key + 2];
  8376. }
  8377. }
  8378. } else {
  8379. if (!needsResizing) {
  8380. this.getRgbBuffer(comps, 0, width * actualHeight, dest, 0, bpc, alpha01);
  8381. } else {
  8382. rgbBuf = new Uint8Array(count * 3);
  8383. this.getRgbBuffer(comps, 0, count, rgbBuf, 0, bpc, 0);
  8384. }
  8385. }
  8386. if (rgbBuf) {
  8387. if (needsResizing) {
  8388. resizeRgbImage(rgbBuf, bpc, originalWidth, originalHeight, width, height, alpha01, dest);
  8389. } else {
  8390. rgbPos = 0;
  8391. destPos = 0;
  8392. for (i = 0, ii = width * actualHeight; i < ii; i++) {
  8393. dest[destPos++] = rgbBuf[rgbPos++];
  8394. dest[destPos++] = rgbBuf[rgbPos++];
  8395. dest[destPos++] = rgbBuf[rgbPos++];
  8396. destPos += alpha01;
  8397. }
  8398. }
  8399. }
  8400. },
  8401. usesZeroToOneRange: true
  8402. };
  8403. ColorSpace.parse = function ColorSpace_parse(cs, xref, res) {
  8404. var IR = ColorSpace.parseToIR(cs, xref, res);
  8405. if (IR instanceof AlternateCS) {
  8406. return IR;
  8407. }
  8408. return ColorSpace.fromIR(IR);
  8409. };
  8410. ColorSpace.fromIR = function ColorSpace_fromIR(IR) {
  8411. var name = isArray(IR) ? IR[0] : IR;
  8412. var whitePoint, blackPoint, gamma;
  8413. switch (name) {
  8414. case 'DeviceGrayCS':
  8415. return this.singletons.gray;
  8416. case 'DeviceRgbCS':
  8417. return this.singletons.rgb;
  8418. case 'DeviceCmykCS':
  8419. return this.singletons.cmyk;
  8420. case 'CalGrayCS':
  8421. whitePoint = IR[1];
  8422. blackPoint = IR[2];
  8423. gamma = IR[3];
  8424. return new CalGrayCS(whitePoint, blackPoint, gamma);
  8425. case 'CalRGBCS':
  8426. whitePoint = IR[1];
  8427. blackPoint = IR[2];
  8428. gamma = IR[3];
  8429. var matrix = IR[4];
  8430. return new CalRGBCS(whitePoint, blackPoint, gamma, matrix);
  8431. case 'PatternCS':
  8432. var basePatternCS = IR[1];
  8433. if (basePatternCS) {
  8434. basePatternCS = ColorSpace.fromIR(basePatternCS);
  8435. }
  8436. return new PatternCS(basePatternCS);
  8437. case 'IndexedCS':
  8438. var baseIndexedCS = IR[1];
  8439. var hiVal = IR[2];
  8440. var lookup = IR[3];
  8441. return new IndexedCS(ColorSpace.fromIR(baseIndexedCS), hiVal, lookup);
  8442. case 'AlternateCS':
  8443. var numComps = IR[1];
  8444. var alt = IR[2];
  8445. var tintFnIR = IR[3];
  8446. return new AlternateCS(numComps, ColorSpace.fromIR(alt), PDFFunction.fromIR(tintFnIR));
  8447. case 'LabCS':
  8448. whitePoint = IR[1];
  8449. blackPoint = IR[2];
  8450. var range = IR[3];
  8451. return new LabCS(whitePoint, blackPoint, range);
  8452. default:
  8453. error('Unknown name ' + name);
  8454. }
  8455. return null;
  8456. };
  8457. ColorSpace.parseToIR = function ColorSpace_parseToIR(cs, xref, res) {
  8458. if (isName(cs)) {
  8459. var colorSpaces = res.get('ColorSpace');
  8460. if (isDict(colorSpaces)) {
  8461. var refcs = colorSpaces.get(cs.name);
  8462. if (refcs) {
  8463. cs = refcs;
  8464. }
  8465. }
  8466. }
  8467. cs = xref.fetchIfRef(cs);
  8468. if (isName(cs)) {
  8469. switch (cs.name) {
  8470. case 'DeviceGray':
  8471. case 'G':
  8472. return 'DeviceGrayCS';
  8473. case 'DeviceRGB':
  8474. case 'RGB':
  8475. return 'DeviceRgbCS';
  8476. case 'DeviceCMYK':
  8477. case 'CMYK':
  8478. return 'DeviceCmykCS';
  8479. case 'Pattern':
  8480. return [
  8481. 'PatternCS',
  8482. null
  8483. ];
  8484. default:
  8485. error('unrecognized colorspace ' + cs.name);
  8486. }
  8487. } else if (isArray(cs)) {
  8488. var mode = xref.fetchIfRef(cs[0]).name;
  8489. var numComps, params, alt, whitePoint, blackPoint, gamma;
  8490. switch (mode) {
  8491. case 'DeviceGray':
  8492. case 'G':
  8493. return 'DeviceGrayCS';
  8494. case 'DeviceRGB':
  8495. case 'RGB':
  8496. return 'DeviceRgbCS';
  8497. case 'DeviceCMYK':
  8498. case 'CMYK':
  8499. return 'DeviceCmykCS';
  8500. case 'CalGray':
  8501. params = xref.fetchIfRef(cs[1]);
  8502. whitePoint = params.getArray('WhitePoint');
  8503. blackPoint = params.getArray('BlackPoint');
  8504. gamma = params.get('Gamma');
  8505. return [
  8506. 'CalGrayCS',
  8507. whitePoint,
  8508. blackPoint,
  8509. gamma
  8510. ];
  8511. case 'CalRGB':
  8512. params = xref.fetchIfRef(cs[1]);
  8513. whitePoint = params.getArray('WhitePoint');
  8514. blackPoint = params.getArray('BlackPoint');
  8515. gamma = params.getArray('Gamma');
  8516. var matrix = params.getArray('Matrix');
  8517. return [
  8518. 'CalRGBCS',
  8519. whitePoint,
  8520. blackPoint,
  8521. gamma,
  8522. matrix
  8523. ];
  8524. case 'ICCBased':
  8525. var stream = xref.fetchIfRef(cs[1]);
  8526. var dict = stream.dict;
  8527. numComps = dict.get('N');
  8528. alt = dict.get('Alternate');
  8529. if (alt) {
  8530. var altIR = ColorSpace.parseToIR(alt, xref, res);
  8531. var altCS = ColorSpace.fromIR(altIR);
  8532. if (altCS.numComps === numComps) {
  8533. return altIR;
  8534. }
  8535. warn('ICCBased color space: Ignoring incorrect /Alternate entry.');
  8536. }
  8537. if (numComps === 1) {
  8538. return 'DeviceGrayCS';
  8539. } else if (numComps === 3) {
  8540. return 'DeviceRgbCS';
  8541. } else if (numComps === 4) {
  8542. return 'DeviceCmykCS';
  8543. }
  8544. break;
  8545. case 'Pattern':
  8546. var basePatternCS = cs[1] || null;
  8547. if (basePatternCS) {
  8548. basePatternCS = ColorSpace.parseToIR(basePatternCS, xref, res);
  8549. }
  8550. return [
  8551. 'PatternCS',
  8552. basePatternCS
  8553. ];
  8554. case 'Indexed':
  8555. case 'I':
  8556. var baseIndexedCS = ColorSpace.parseToIR(cs[1], xref, res);
  8557. var hiVal = xref.fetchIfRef(cs[2]) + 1;
  8558. var lookup = xref.fetchIfRef(cs[3]);
  8559. if (isStream(lookup)) {
  8560. lookup = lookup.getBytes();
  8561. }
  8562. return [
  8563. 'IndexedCS',
  8564. baseIndexedCS,
  8565. hiVal,
  8566. lookup
  8567. ];
  8568. case 'Separation':
  8569. case 'DeviceN':
  8570. var name = xref.fetchIfRef(cs[1]);
  8571. numComps = isArray(name) ? name.length : 1;
  8572. alt = ColorSpace.parseToIR(cs[2], xref, res);
  8573. var tintFnIR = PDFFunction.getIR(xref, xref.fetchIfRef(cs[3]));
  8574. return [
  8575. 'AlternateCS',
  8576. numComps,
  8577. alt,
  8578. tintFnIR
  8579. ];
  8580. case 'Lab':
  8581. params = xref.fetchIfRef(cs[1]);
  8582. whitePoint = params.getArray('WhitePoint');
  8583. blackPoint = params.getArray('BlackPoint');
  8584. var range = params.getArray('Range');
  8585. return [
  8586. 'LabCS',
  8587. whitePoint,
  8588. blackPoint,
  8589. range
  8590. ];
  8591. default:
  8592. error('unimplemented color space object "' + mode + '"');
  8593. }
  8594. } else {
  8595. error('unrecognized color space object: "' + cs + '"');
  8596. }
  8597. return null;
  8598. };
  8599. ColorSpace.isDefaultDecode = function ColorSpace_isDefaultDecode(decode, n) {
  8600. if (!isArray(decode)) {
  8601. return true;
  8602. }
  8603. if (n * 2 !== decode.length) {
  8604. warn('The decode map is not the correct length');
  8605. return true;
  8606. }
  8607. for (var i = 0, ii = decode.length; i < ii; i += 2) {
  8608. if (decode[i] !== 0 || decode[i + 1] !== 1) {
  8609. return false;
  8610. }
  8611. }
  8612. return true;
  8613. };
  8614. ColorSpace.singletons = {
  8615. get gray() {
  8616. return shadow(this, 'gray', new DeviceGrayCS());
  8617. },
  8618. get rgb() {
  8619. return shadow(this, 'rgb', new DeviceRgbCS());
  8620. },
  8621. get cmyk() {
  8622. return shadow(this, 'cmyk', new DeviceCmykCS());
  8623. }
  8624. };
  8625. return ColorSpace;
  8626. }();
  8627. var AlternateCS = function AlternateCSClosure() {
  8628. function AlternateCS(numComps, base, tintFn) {
  8629. this.name = 'Alternate';
  8630. this.numComps = numComps;
  8631. this.defaultColor = new Float32Array(numComps);
  8632. for (var i = 0; i < numComps; ++i) {
  8633. this.defaultColor[i] = 1;
  8634. }
  8635. this.base = base;
  8636. this.tintFn = tintFn;
  8637. this.tmpBuf = new Float32Array(base.numComps);
  8638. }
  8639. AlternateCS.prototype = {
  8640. getRgb: ColorSpace.prototype.getRgb,
  8641. getRgbItem: function AlternateCS_getRgbItem(src, srcOffset, dest, destOffset) {
  8642. var tmpBuf = this.tmpBuf;
  8643. this.tintFn(src, srcOffset, tmpBuf, 0);
  8644. this.base.getRgbItem(tmpBuf, 0, dest, destOffset);
  8645. },
  8646. getRgbBuffer: function AlternateCS_getRgbBuffer(src, srcOffset, count, dest, destOffset, bits, alpha01) {
  8647. var tintFn = this.tintFn;
  8648. var base = this.base;
  8649. var scale = 1 / ((1 << bits) - 1);
  8650. var baseNumComps = base.numComps;
  8651. var usesZeroToOneRange = base.usesZeroToOneRange;
  8652. var isPassthrough = (base.isPassthrough(8) || !usesZeroToOneRange) && alpha01 === 0;
  8653. var pos = isPassthrough ? destOffset : 0;
  8654. var baseBuf = isPassthrough ? dest : new Uint8Array(baseNumComps * count);
  8655. var numComps = this.numComps;
  8656. var scaled = new Float32Array(numComps);
  8657. var tinted = new Float32Array(baseNumComps);
  8658. var i, j;
  8659. for (i = 0; i < count; i++) {
  8660. for (j = 0; j < numComps; j++) {
  8661. scaled[j] = src[srcOffset++] * scale;
  8662. }
  8663. tintFn(scaled, 0, tinted, 0);
  8664. if (usesZeroToOneRange) {
  8665. for (j = 0; j < baseNumComps; j++) {
  8666. baseBuf[pos++] = tinted[j] * 255;
  8667. }
  8668. } else {
  8669. base.getRgbItem(tinted, 0, baseBuf, pos);
  8670. pos += baseNumComps;
  8671. }
  8672. }
  8673. if (!isPassthrough) {
  8674. base.getRgbBuffer(baseBuf, 0, count, dest, destOffset, 8, alpha01);
  8675. }
  8676. },
  8677. getOutputLength: function AlternateCS_getOutputLength(inputLength, alpha01) {
  8678. return this.base.getOutputLength(inputLength * this.base.numComps / this.numComps, alpha01);
  8679. },
  8680. isPassthrough: ColorSpace.prototype.isPassthrough,
  8681. fillRgb: ColorSpace.prototype.fillRgb,
  8682. isDefaultDecode: function AlternateCS_isDefaultDecode(decodeMap) {
  8683. return ColorSpace.isDefaultDecode(decodeMap, this.numComps);
  8684. },
  8685. usesZeroToOneRange: true
  8686. };
  8687. return AlternateCS;
  8688. }();
  8689. var PatternCS = function PatternCSClosure() {
  8690. function PatternCS(baseCS) {
  8691. this.name = 'Pattern';
  8692. this.base = baseCS;
  8693. }
  8694. PatternCS.prototype = {};
  8695. return PatternCS;
  8696. }();
  8697. var IndexedCS = function IndexedCSClosure() {
  8698. function IndexedCS(base, highVal, lookup) {
  8699. this.name = 'Indexed';
  8700. this.numComps = 1;
  8701. this.defaultColor = new Uint8Array(this.numComps);
  8702. this.base = base;
  8703. this.highVal = highVal;
  8704. var baseNumComps = base.numComps;
  8705. var length = baseNumComps * highVal;
  8706. if (isStream(lookup)) {
  8707. this.lookup = new Uint8Array(length);
  8708. var bytes = lookup.getBytes(length);
  8709. this.lookup.set(bytes);
  8710. } else if (isString(lookup)) {
  8711. this.lookup = new Uint8Array(length);
  8712. for (var i = 0; i < length; ++i) {
  8713. this.lookup[i] = lookup.charCodeAt(i);
  8714. }
  8715. } else if (lookup instanceof Uint8Array || lookup instanceof Array) {
  8716. this.lookup = lookup;
  8717. } else {
  8718. error('Unrecognized lookup table: ' + lookup);
  8719. }
  8720. }
  8721. IndexedCS.prototype = {
  8722. getRgb: ColorSpace.prototype.getRgb,
  8723. getRgbItem: function IndexedCS_getRgbItem(src, srcOffset, dest, destOffset) {
  8724. var numComps = this.base.numComps;
  8725. var start = src[srcOffset] * numComps;
  8726. this.base.getRgbItem(this.lookup, start, dest, destOffset);
  8727. },
  8728. getRgbBuffer: function IndexedCS_getRgbBuffer(src, srcOffset, count, dest, destOffset, bits, alpha01) {
  8729. var base = this.base;
  8730. var numComps = base.numComps;
  8731. var outputDelta = base.getOutputLength(numComps, alpha01);
  8732. var lookup = this.lookup;
  8733. for (var i = 0; i < count; ++i) {
  8734. var lookupPos = src[srcOffset++] * numComps;
  8735. base.getRgbBuffer(lookup, lookupPos, 1, dest, destOffset, 8, alpha01);
  8736. destOffset += outputDelta;
  8737. }
  8738. },
  8739. getOutputLength: function IndexedCS_getOutputLength(inputLength, alpha01) {
  8740. return this.base.getOutputLength(inputLength * this.base.numComps, alpha01);
  8741. },
  8742. isPassthrough: ColorSpace.prototype.isPassthrough,
  8743. fillRgb: ColorSpace.prototype.fillRgb,
  8744. isDefaultDecode: function IndexedCS_isDefaultDecode(decodeMap) {
  8745. return true;
  8746. },
  8747. usesZeroToOneRange: true
  8748. };
  8749. return IndexedCS;
  8750. }();
  8751. var DeviceGrayCS = function DeviceGrayCSClosure() {
  8752. function DeviceGrayCS() {
  8753. this.name = 'DeviceGray';
  8754. this.numComps = 1;
  8755. this.defaultColor = new Float32Array(this.numComps);
  8756. }
  8757. DeviceGrayCS.prototype = {
  8758. getRgb: ColorSpace.prototype.getRgb,
  8759. getRgbItem: function DeviceGrayCS_getRgbItem(src, srcOffset, dest, destOffset) {
  8760. var c = src[srcOffset] * 255 | 0;
  8761. c = c < 0 ? 0 : c > 255 ? 255 : c;
  8762. dest[destOffset] = dest[destOffset + 1] = dest[destOffset + 2] = c;
  8763. },
  8764. getRgbBuffer: function DeviceGrayCS_getRgbBuffer(src, srcOffset, count, dest, destOffset, bits, alpha01) {
  8765. var scale = 255 / ((1 << bits) - 1);
  8766. var j = srcOffset, q = destOffset;
  8767. for (var i = 0; i < count; ++i) {
  8768. var c = scale * src[j++] | 0;
  8769. dest[q++] = c;
  8770. dest[q++] = c;
  8771. dest[q++] = c;
  8772. q += alpha01;
  8773. }
  8774. },
  8775. getOutputLength: function DeviceGrayCS_getOutputLength(inputLength, alpha01) {
  8776. return inputLength * (3 + alpha01);
  8777. },
  8778. isPassthrough: ColorSpace.prototype.isPassthrough,
  8779. fillRgb: ColorSpace.prototype.fillRgb,
  8780. isDefaultDecode: function DeviceGrayCS_isDefaultDecode(decodeMap) {
  8781. return ColorSpace.isDefaultDecode(decodeMap, this.numComps);
  8782. },
  8783. usesZeroToOneRange: true
  8784. };
  8785. return DeviceGrayCS;
  8786. }();
  8787. var DeviceRgbCS = function DeviceRgbCSClosure() {
  8788. function DeviceRgbCS() {
  8789. this.name = 'DeviceRGB';
  8790. this.numComps = 3;
  8791. this.defaultColor = new Float32Array(this.numComps);
  8792. }
  8793. DeviceRgbCS.prototype = {
  8794. getRgb: ColorSpace.prototype.getRgb,
  8795. getRgbItem: function DeviceRgbCS_getRgbItem(src, srcOffset, dest, destOffset) {
  8796. var r = src[srcOffset] * 255 | 0;
  8797. var g = src[srcOffset + 1] * 255 | 0;
  8798. var b = src[srcOffset + 2] * 255 | 0;
  8799. dest[destOffset] = r < 0 ? 0 : r > 255 ? 255 : r;
  8800. dest[destOffset + 1] = g < 0 ? 0 : g > 255 ? 255 : g;
  8801. dest[destOffset + 2] = b < 0 ? 0 : b > 255 ? 255 : b;
  8802. },
  8803. getRgbBuffer: function DeviceRgbCS_getRgbBuffer(src, srcOffset, count, dest, destOffset, bits, alpha01) {
  8804. if (bits === 8 && alpha01 === 0) {
  8805. dest.set(src.subarray(srcOffset, srcOffset + count * 3), destOffset);
  8806. return;
  8807. }
  8808. var scale = 255 / ((1 << bits) - 1);
  8809. var j = srcOffset, q = destOffset;
  8810. for (var i = 0; i < count; ++i) {
  8811. dest[q++] = scale * src[j++] | 0;
  8812. dest[q++] = scale * src[j++] | 0;
  8813. dest[q++] = scale * src[j++] | 0;
  8814. q += alpha01;
  8815. }
  8816. },
  8817. getOutputLength: function DeviceRgbCS_getOutputLength(inputLength, alpha01) {
  8818. return inputLength * (3 + alpha01) / 3 | 0;
  8819. },
  8820. isPassthrough: function DeviceRgbCS_isPassthrough(bits) {
  8821. return bits === 8;
  8822. },
  8823. fillRgb: ColorSpace.prototype.fillRgb,
  8824. isDefaultDecode: function DeviceRgbCS_isDefaultDecode(decodeMap) {
  8825. return ColorSpace.isDefaultDecode(decodeMap, this.numComps);
  8826. },
  8827. usesZeroToOneRange: true
  8828. };
  8829. return DeviceRgbCS;
  8830. }();
  8831. var DeviceCmykCS = function DeviceCmykCSClosure() {
  8832. function convertToRgb(src, srcOffset, srcScale, dest, destOffset) {
  8833. var c = src[srcOffset + 0] * srcScale;
  8834. var m = src[srcOffset + 1] * srcScale;
  8835. var y = src[srcOffset + 2] * srcScale;
  8836. var k = src[srcOffset + 3] * srcScale;
  8837. 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;
  8838. 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;
  8839. 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;
  8840. dest[destOffset] = r > 255 ? 255 : r < 0 ? 0 : r;
  8841. dest[destOffset + 1] = g > 255 ? 255 : g < 0 ? 0 : g;
  8842. dest[destOffset + 2] = b > 255 ? 255 : b < 0 ? 0 : b;
  8843. }
  8844. function DeviceCmykCS() {
  8845. this.name = 'DeviceCMYK';
  8846. this.numComps = 4;
  8847. this.defaultColor = new Float32Array(this.numComps);
  8848. this.defaultColor[3] = 1;
  8849. }
  8850. DeviceCmykCS.prototype = {
  8851. getRgb: ColorSpace.prototype.getRgb,
  8852. getRgbItem: function DeviceCmykCS_getRgbItem(src, srcOffset, dest, destOffset) {
  8853. convertToRgb(src, srcOffset, 1, dest, destOffset);
  8854. },
  8855. getRgbBuffer: function DeviceCmykCS_getRgbBuffer(src, srcOffset, count, dest, destOffset, bits, alpha01) {
  8856. var scale = 1 / ((1 << bits) - 1);
  8857. for (var i = 0; i < count; i++) {
  8858. convertToRgb(src, srcOffset, scale, dest, destOffset);
  8859. srcOffset += 4;
  8860. destOffset += 3 + alpha01;
  8861. }
  8862. },
  8863. getOutputLength: function DeviceCmykCS_getOutputLength(inputLength, alpha01) {
  8864. return inputLength / 4 * (3 + alpha01) | 0;
  8865. },
  8866. isPassthrough: ColorSpace.prototype.isPassthrough,
  8867. fillRgb: ColorSpace.prototype.fillRgb,
  8868. isDefaultDecode: function DeviceCmykCS_isDefaultDecode(decodeMap) {
  8869. return ColorSpace.isDefaultDecode(decodeMap, this.numComps);
  8870. },
  8871. usesZeroToOneRange: true
  8872. };
  8873. return DeviceCmykCS;
  8874. }();
  8875. var CalGrayCS = function CalGrayCSClosure() {
  8876. function CalGrayCS(whitePoint, blackPoint, gamma) {
  8877. this.name = 'CalGray';
  8878. this.numComps = 1;
  8879. this.defaultColor = new Float32Array(this.numComps);
  8880. if (!whitePoint) {
  8881. error('WhitePoint missing - required for color space CalGray');
  8882. }
  8883. blackPoint = blackPoint || [
  8884. 0,
  8885. 0,
  8886. 0
  8887. ];
  8888. gamma = gamma || 1;
  8889. this.XW = whitePoint[0];
  8890. this.YW = whitePoint[1];
  8891. this.ZW = whitePoint[2];
  8892. this.XB = blackPoint[0];
  8893. this.YB = blackPoint[1];
  8894. this.ZB = blackPoint[2];
  8895. this.G = gamma;
  8896. if (this.XW < 0 || this.ZW < 0 || this.YW !== 1) {
  8897. error('Invalid WhitePoint components for ' + this.name + ', no fallback available');
  8898. }
  8899. if (this.XB < 0 || this.YB < 0 || this.ZB < 0) {
  8900. info('Invalid BlackPoint for ' + this.name + ', falling back to default');
  8901. this.XB = this.YB = this.ZB = 0;
  8902. }
  8903. if (this.XB !== 0 || this.YB !== 0 || this.ZB !== 0) {
  8904. warn(this.name + ', BlackPoint: XB: ' + this.XB + ', YB: ' + this.YB + ', ZB: ' + this.ZB + ', only default values are supported.');
  8905. }
  8906. if (this.G < 1) {
  8907. info('Invalid Gamma: ' + this.G + ' for ' + this.name + ', falling back to default');
  8908. this.G = 1;
  8909. }
  8910. }
  8911. function convertToRgb(cs, src, srcOffset, dest, destOffset, scale) {
  8912. var A = src[srcOffset] * scale;
  8913. var AG = Math.pow(A, cs.G);
  8914. var L = cs.YW * AG;
  8915. var val = Math.max(295.8 * Math.pow(L, 0.333333333333333333) - 40.8, 0) | 0;
  8916. dest[destOffset] = val;
  8917. dest[destOffset + 1] = val;
  8918. dest[destOffset + 2] = val;
  8919. }
  8920. CalGrayCS.prototype = {
  8921. getRgb: ColorSpace.prototype.getRgb,
  8922. getRgbItem: function CalGrayCS_getRgbItem(src, srcOffset, dest, destOffset) {
  8923. convertToRgb(this, src, srcOffset, dest, destOffset, 1);
  8924. },
  8925. getRgbBuffer: function CalGrayCS_getRgbBuffer(src, srcOffset, count, dest, destOffset, bits, alpha01) {
  8926. var scale = 1 / ((1 << bits) - 1);
  8927. for (var i = 0; i < count; ++i) {
  8928. convertToRgb(this, src, srcOffset, dest, destOffset, scale);
  8929. srcOffset += 1;
  8930. destOffset += 3 + alpha01;
  8931. }
  8932. },
  8933. getOutputLength: function CalGrayCS_getOutputLength(inputLength, alpha01) {
  8934. return inputLength * (3 + alpha01);
  8935. },
  8936. isPassthrough: ColorSpace.prototype.isPassthrough,
  8937. fillRgb: ColorSpace.prototype.fillRgb,
  8938. isDefaultDecode: function CalGrayCS_isDefaultDecode(decodeMap) {
  8939. return ColorSpace.isDefaultDecode(decodeMap, this.numComps);
  8940. },
  8941. usesZeroToOneRange: true
  8942. };
  8943. return CalGrayCS;
  8944. }();
  8945. var CalRGBCS = function CalRGBCSClosure() {
  8946. var BRADFORD_SCALE_MATRIX = new Float32Array([
  8947. 0.8951,
  8948. 0.2664,
  8949. -0.1614,
  8950. -0.7502,
  8951. 1.7135,
  8952. 0.0367,
  8953. 0.0389,
  8954. -0.0685,
  8955. 1.0296
  8956. ]);
  8957. var BRADFORD_SCALE_INVERSE_MATRIX = new Float32Array([
  8958. 0.9869929,
  8959. -0.1470543,
  8960. 0.1599627,
  8961. 0.4323053,
  8962. 0.5183603,
  8963. 0.0492912,
  8964. -0.0085287,
  8965. 0.0400428,
  8966. 0.9684867
  8967. ]);
  8968. var SRGB_D65_XYZ_TO_RGB_MATRIX = new Float32Array([
  8969. 3.2404542,
  8970. -1.5371385,
  8971. -0.4985314,
  8972. -0.9692660,
  8973. 1.8760108,
  8974. 0.0415560,
  8975. 0.0556434,
  8976. -0.2040259,
  8977. 1.0572252
  8978. ]);
  8979. var FLAT_WHITEPOINT_MATRIX = new Float32Array([
  8980. 1,
  8981. 1,
  8982. 1
  8983. ]);
  8984. var tempNormalizeMatrix = new Float32Array(3);
  8985. var tempConvertMatrix1 = new Float32Array(3);
  8986. var tempConvertMatrix2 = new Float32Array(3);
  8987. var DECODE_L_CONSTANT = Math.pow((8 + 16) / 116, 3) / 8.0;
  8988. function CalRGBCS(whitePoint, blackPoint, gamma, matrix) {
  8989. this.name = 'CalRGB';
  8990. this.numComps = 3;
  8991. this.defaultColor = new Float32Array(this.numComps);
  8992. if (!whitePoint) {
  8993. error('WhitePoint missing - required for color space CalRGB');
  8994. }
  8995. blackPoint = blackPoint || new Float32Array(3);
  8996. gamma = gamma || new Float32Array([
  8997. 1,
  8998. 1,
  8999. 1
  9000. ]);
  9001. matrix = matrix || new Float32Array([
  9002. 1,
  9003. 0,
  9004. 0,
  9005. 0,
  9006. 1,
  9007. 0,
  9008. 0,
  9009. 0,
  9010. 1
  9011. ]);
  9012. var XW = whitePoint[0];
  9013. var YW = whitePoint[1];
  9014. var ZW = whitePoint[2];
  9015. this.whitePoint = whitePoint;
  9016. var XB = blackPoint[0];
  9017. var YB = blackPoint[1];
  9018. var ZB = blackPoint[2];
  9019. this.blackPoint = blackPoint;
  9020. this.GR = gamma[0];
  9021. this.GG = gamma[1];
  9022. this.GB = gamma[2];
  9023. this.MXA = matrix[0];
  9024. this.MYA = matrix[1];
  9025. this.MZA = matrix[2];
  9026. this.MXB = matrix[3];
  9027. this.MYB = matrix[4];
  9028. this.MZB = matrix[5];
  9029. this.MXC = matrix[6];
  9030. this.MYC = matrix[7];
  9031. this.MZC = matrix[8];
  9032. if (XW < 0 || ZW < 0 || YW !== 1) {
  9033. error('Invalid WhitePoint components for ' + this.name + ', no fallback available');
  9034. }
  9035. if (XB < 0 || YB < 0 || ZB < 0) {
  9036. info('Invalid BlackPoint for ' + this.name + ' [' + XB + ', ' + YB + ', ' + ZB + '], falling back to default');
  9037. this.blackPoint = new Float32Array(3);
  9038. }
  9039. if (this.GR < 0 || this.GG < 0 || this.GB < 0) {
  9040. info('Invalid Gamma [' + this.GR + ', ' + this.GG + ', ' + this.GB + '] for ' + this.name + ', falling back to default');
  9041. this.GR = this.GG = this.GB = 1;
  9042. }
  9043. 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) {
  9044. 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');
  9045. this.MXA = this.MYB = this.MZC = 1;
  9046. this.MXB = this.MYA = this.MZA = this.MXC = this.MYC = this.MZB = 0;
  9047. }
  9048. }
  9049. function matrixProduct(a, b, result) {
  9050. result[0] = a[0] * b[0] + a[1] * b[1] + a[2] * b[2];
  9051. result[1] = a[3] * b[0] + a[4] * b[1] + a[5] * b[2];
  9052. result[2] = a[6] * b[0] + a[7] * b[1] + a[8] * b[2];
  9053. }
  9054. function convertToFlat(sourceWhitePoint, LMS, result) {
  9055. result[0] = LMS[0] * 1 / sourceWhitePoint[0];
  9056. result[1] = LMS[1] * 1 / sourceWhitePoint[1];
  9057. result[2] = LMS[2] * 1 / sourceWhitePoint[2];
  9058. }
  9059. function convertToD65(sourceWhitePoint, LMS, result) {
  9060. var D65X = 0.95047;
  9061. var D65Y = 1;
  9062. var D65Z = 1.08883;
  9063. result[0] = LMS[0] * D65X / sourceWhitePoint[0];
  9064. result[1] = LMS[1] * D65Y / sourceWhitePoint[1];
  9065. result[2] = LMS[2] * D65Z / sourceWhitePoint[2];
  9066. }
  9067. function sRGBTransferFunction(color) {
  9068. if (color <= 0.0031308) {
  9069. return adjustToRange(0, 1, 12.92 * color);
  9070. }
  9071. return adjustToRange(0, 1, (1 + 0.055) * Math.pow(color, 1 / 2.4) - 0.055);
  9072. }
  9073. function adjustToRange(min, max, value) {
  9074. return Math.max(min, Math.min(max, value));
  9075. }
  9076. function decodeL(L) {
  9077. if (L < 0) {
  9078. return -decodeL(-L);
  9079. }
  9080. if (L > 8.0) {
  9081. return Math.pow((L + 16) / 116, 3);
  9082. }
  9083. return L * DECODE_L_CONSTANT;
  9084. }
  9085. function compensateBlackPoint(sourceBlackPoint, XYZ_Flat, result) {
  9086. if (sourceBlackPoint[0] === 0 && sourceBlackPoint[1] === 0 && sourceBlackPoint[2] === 0) {
  9087. result[0] = XYZ_Flat[0];
  9088. result[1] = XYZ_Flat[1];
  9089. result[2] = XYZ_Flat[2];
  9090. return;
  9091. }
  9092. var zeroDecodeL = decodeL(0);
  9093. var X_DST = zeroDecodeL;
  9094. var X_SRC = decodeL(sourceBlackPoint[0]);
  9095. var Y_DST = zeroDecodeL;
  9096. var Y_SRC = decodeL(sourceBlackPoint[1]);
  9097. var Z_DST = zeroDecodeL;
  9098. var Z_SRC = decodeL(sourceBlackPoint[2]);
  9099. var X_Scale = (1 - X_DST) / (1 - X_SRC);
  9100. var X_Offset = 1 - X_Scale;
  9101. var Y_Scale = (1 - Y_DST) / (1 - Y_SRC);
  9102. var Y_Offset = 1 - Y_Scale;
  9103. var Z_Scale = (1 - Z_DST) / (1 - Z_SRC);
  9104. var Z_Offset = 1 - Z_Scale;
  9105. result[0] = XYZ_Flat[0] * X_Scale + X_Offset;
  9106. result[1] = XYZ_Flat[1] * Y_Scale + Y_Offset;
  9107. result[2] = XYZ_Flat[2] * Z_Scale + Z_Offset;
  9108. }
  9109. function normalizeWhitePointToFlat(sourceWhitePoint, XYZ_In, result) {
  9110. if (sourceWhitePoint[0] === 1 && sourceWhitePoint[2] === 1) {
  9111. result[0] = XYZ_In[0];
  9112. result[1] = XYZ_In[1];
  9113. result[2] = XYZ_In[2];
  9114. return;
  9115. }
  9116. var LMS = result;
  9117. matrixProduct(BRADFORD_SCALE_MATRIX, XYZ_In, LMS);
  9118. var LMS_Flat = tempNormalizeMatrix;
  9119. convertToFlat(sourceWhitePoint, LMS, LMS_Flat);
  9120. matrixProduct(BRADFORD_SCALE_INVERSE_MATRIX, LMS_Flat, result);
  9121. }
  9122. function normalizeWhitePointToD65(sourceWhitePoint, XYZ_In, result) {
  9123. var LMS = result;
  9124. matrixProduct(BRADFORD_SCALE_MATRIX, XYZ_In, LMS);
  9125. var LMS_D65 = tempNormalizeMatrix;
  9126. convertToD65(sourceWhitePoint, LMS, LMS_D65);
  9127. matrixProduct(BRADFORD_SCALE_INVERSE_MATRIX, LMS_D65, result);
  9128. }
  9129. function convertToRgb(cs, src, srcOffset, dest, destOffset, scale) {
  9130. var A = adjustToRange(0, 1, src[srcOffset] * scale);
  9131. var B = adjustToRange(0, 1, src[srcOffset + 1] * scale);
  9132. var C = adjustToRange(0, 1, src[srcOffset + 2] * scale);
  9133. var AGR = Math.pow(A, cs.GR);
  9134. var BGG = Math.pow(B, cs.GG);
  9135. var CGB = Math.pow(C, cs.GB);
  9136. var X = cs.MXA * AGR + cs.MXB * BGG + cs.MXC * CGB;
  9137. var Y = cs.MYA * AGR + cs.MYB * BGG + cs.MYC * CGB;
  9138. var Z = cs.MZA * AGR + cs.MZB * BGG + cs.MZC * CGB;
  9139. var XYZ = tempConvertMatrix1;
  9140. XYZ[0] = X;
  9141. XYZ[1] = Y;
  9142. XYZ[2] = Z;
  9143. var XYZ_Flat = tempConvertMatrix2;
  9144. normalizeWhitePointToFlat(cs.whitePoint, XYZ, XYZ_Flat);
  9145. var XYZ_Black = tempConvertMatrix1;
  9146. compensateBlackPoint(cs.blackPoint, XYZ_Flat, XYZ_Black);
  9147. var XYZ_D65 = tempConvertMatrix2;
  9148. normalizeWhitePointToD65(FLAT_WHITEPOINT_MATRIX, XYZ_Black, XYZ_D65);
  9149. var SRGB = tempConvertMatrix1;
  9150. matrixProduct(SRGB_D65_XYZ_TO_RGB_MATRIX, XYZ_D65, SRGB);
  9151. var sR = sRGBTransferFunction(SRGB[0]);
  9152. var sG = sRGBTransferFunction(SRGB[1]);
  9153. var sB = sRGBTransferFunction(SRGB[2]);
  9154. dest[destOffset] = Math.round(sR * 255);
  9155. dest[destOffset + 1] = Math.round(sG * 255);
  9156. dest[destOffset + 2] = Math.round(sB * 255);
  9157. }
  9158. CalRGBCS.prototype = {
  9159. getRgb: function CalRGBCS_getRgb(src, srcOffset) {
  9160. var rgb = new Uint8Array(3);
  9161. this.getRgbItem(src, srcOffset, rgb, 0);
  9162. return rgb;
  9163. },
  9164. getRgbItem: function CalRGBCS_getRgbItem(src, srcOffset, dest, destOffset) {
  9165. convertToRgb(this, src, srcOffset, dest, destOffset, 1);
  9166. },
  9167. getRgbBuffer: function CalRGBCS_getRgbBuffer(src, srcOffset, count, dest, destOffset, bits, alpha01) {
  9168. var scale = 1 / ((1 << bits) - 1);
  9169. for (var i = 0; i < count; ++i) {
  9170. convertToRgb(this, src, srcOffset, dest, destOffset, scale);
  9171. srcOffset += 3;
  9172. destOffset += 3 + alpha01;
  9173. }
  9174. },
  9175. getOutputLength: function CalRGBCS_getOutputLength(inputLength, alpha01) {
  9176. return inputLength * (3 + alpha01) / 3 | 0;
  9177. },
  9178. isPassthrough: ColorSpace.prototype.isPassthrough,
  9179. fillRgb: ColorSpace.prototype.fillRgb,
  9180. isDefaultDecode: function CalRGBCS_isDefaultDecode(decodeMap) {
  9181. return ColorSpace.isDefaultDecode(decodeMap, this.numComps);
  9182. },
  9183. usesZeroToOneRange: true
  9184. };
  9185. return CalRGBCS;
  9186. }();
  9187. var LabCS = function LabCSClosure() {
  9188. function LabCS(whitePoint, blackPoint, range) {
  9189. this.name = 'Lab';
  9190. this.numComps = 3;
  9191. this.defaultColor = new Float32Array(this.numComps);
  9192. if (!whitePoint) {
  9193. error('WhitePoint missing - required for color space Lab');
  9194. }
  9195. blackPoint = blackPoint || [
  9196. 0,
  9197. 0,
  9198. 0
  9199. ];
  9200. range = range || [
  9201. -100,
  9202. 100,
  9203. -100,
  9204. 100
  9205. ];
  9206. this.XW = whitePoint[0];
  9207. this.YW = whitePoint[1];
  9208. this.ZW = whitePoint[2];
  9209. this.amin = range[0];
  9210. this.amax = range[1];
  9211. this.bmin = range[2];
  9212. this.bmax = range[3];
  9213. this.XB = blackPoint[0];
  9214. this.YB = blackPoint[1];
  9215. this.ZB = blackPoint[2];
  9216. if (this.XW < 0 || this.ZW < 0 || this.YW !== 1) {
  9217. error('Invalid WhitePoint components, no fallback available');
  9218. }
  9219. if (this.XB < 0 || this.YB < 0 || this.ZB < 0) {
  9220. info('Invalid BlackPoint, falling back to default');
  9221. this.XB = this.YB = this.ZB = 0;
  9222. }
  9223. if (this.amin > this.amax || this.bmin > this.bmax) {
  9224. info('Invalid Range, falling back to defaults');
  9225. this.amin = -100;
  9226. this.amax = 100;
  9227. this.bmin = -100;
  9228. this.bmax = 100;
  9229. }
  9230. }
  9231. function fn_g(x) {
  9232. var result;
  9233. if (x >= 6 / 29) {
  9234. result = x * x * x;
  9235. } else {
  9236. result = 108 / 841 * (x - 4 / 29);
  9237. }
  9238. return result;
  9239. }
  9240. function decode(value, high1, low2, high2) {
  9241. return low2 + value * (high2 - low2) / high1;
  9242. }
  9243. function convertToRgb(cs, src, srcOffset, maxVal, dest, destOffset) {
  9244. var Ls = src[srcOffset];
  9245. var as = src[srcOffset + 1];
  9246. var bs = src[srcOffset + 2];
  9247. if (maxVal !== false) {
  9248. Ls = decode(Ls, maxVal, 0, 100);
  9249. as = decode(as, maxVal, cs.amin, cs.amax);
  9250. bs = decode(bs, maxVal, cs.bmin, cs.bmax);
  9251. }
  9252. as = as > cs.amax ? cs.amax : as < cs.amin ? cs.amin : as;
  9253. bs = bs > cs.bmax ? cs.bmax : bs < cs.bmin ? cs.bmin : bs;
  9254. var M = (Ls + 16) / 116;
  9255. var L = M + as / 500;
  9256. var N = M - bs / 200;
  9257. var X = cs.XW * fn_g(L);
  9258. var Y = cs.YW * fn_g(M);
  9259. var Z = cs.ZW * fn_g(N);
  9260. var r, g, b;
  9261. if (cs.ZW < 1) {
  9262. r = X * 3.1339 + Y * -1.6170 + Z * -0.4906;
  9263. g = X * -0.9785 + Y * 1.9160 + Z * 0.0333;
  9264. b = X * 0.0720 + Y * -0.2290 + Z * 1.4057;
  9265. } else {
  9266. r = X * 3.2406 + Y * -1.5372 + Z * -0.4986;
  9267. g = X * -0.9689 + Y * 1.8758 + Z * 0.0415;
  9268. b = X * 0.0557 + Y * -0.2040 + Z * 1.0570;
  9269. }
  9270. dest[destOffset] = r <= 0 ? 0 : r >= 1 ? 255 : Math.sqrt(r) * 255 | 0;
  9271. dest[destOffset + 1] = g <= 0 ? 0 : g >= 1 ? 255 : Math.sqrt(g) * 255 | 0;
  9272. dest[destOffset + 2] = b <= 0 ? 0 : b >= 1 ? 255 : Math.sqrt(b) * 255 | 0;
  9273. }
  9274. LabCS.prototype = {
  9275. getRgb: ColorSpace.prototype.getRgb,
  9276. getRgbItem: function LabCS_getRgbItem(src, srcOffset, dest, destOffset) {
  9277. convertToRgb(this, src, srcOffset, false, dest, destOffset);
  9278. },
  9279. getRgbBuffer: function LabCS_getRgbBuffer(src, srcOffset, count, dest, destOffset, bits, alpha01) {
  9280. var maxVal = (1 << bits) - 1;
  9281. for (var i = 0; i < count; i++) {
  9282. convertToRgb(this, src, srcOffset, maxVal, dest, destOffset);
  9283. srcOffset += 3;
  9284. destOffset += 3 + alpha01;
  9285. }
  9286. },
  9287. getOutputLength: function LabCS_getOutputLength(inputLength, alpha01) {
  9288. return inputLength * (3 + alpha01) / 3 | 0;
  9289. },
  9290. isPassthrough: ColorSpace.prototype.isPassthrough,
  9291. fillRgb: ColorSpace.prototype.fillRgb,
  9292. isDefaultDecode: function LabCS_isDefaultDecode(decodeMap) {
  9293. return true;
  9294. },
  9295. usesZeroToOneRange: false
  9296. };
  9297. return LabCS;
  9298. }();
  9299. exports.ColorSpace = ColorSpace;
  9300. /***/ }),
  9301. /* 4 */
  9302. /***/ (function(module, exports, __w_pdfjs_require__) {
  9303. "use strict";
  9304. var ExpertEncoding = [
  9305. '',
  9306. '',
  9307. '',
  9308. '',
  9309. '',
  9310. '',
  9311. '',
  9312. '',
  9313. '',
  9314. '',
  9315. '',
  9316. '',
  9317. '',
  9318. '',
  9319. '',
  9320. '',
  9321. '',
  9322. '',
  9323. '',
  9324. '',
  9325. '',
  9326. '',
  9327. '',
  9328. '',
  9329. '',
  9330. '',
  9331. '',
  9332. '',
  9333. '',
  9334. '',
  9335. '',
  9336. '',
  9337. 'space',
  9338. 'exclamsmall',
  9339. 'Hungarumlautsmall',
  9340. '',
  9341. 'dollaroldstyle',
  9342. 'dollarsuperior',
  9343. 'ampersandsmall',
  9344. 'Acutesmall',
  9345. 'parenleftsuperior',
  9346. 'parenrightsuperior',
  9347. 'twodotenleader',
  9348. 'onedotenleader',
  9349. 'comma',
  9350. 'hyphen',
  9351. 'period',
  9352. 'fraction',
  9353. 'zerooldstyle',
  9354. 'oneoldstyle',
  9355. 'twooldstyle',
  9356. 'threeoldstyle',
  9357. 'fouroldstyle',
  9358. 'fiveoldstyle',
  9359. 'sixoldstyle',
  9360. 'sevenoldstyle',
  9361. 'eightoldstyle',
  9362. 'nineoldstyle',
  9363. 'colon',
  9364. 'semicolon',
  9365. 'commasuperior',
  9366. 'threequartersemdash',
  9367. 'periodsuperior',
  9368. 'questionsmall',
  9369. '',
  9370. 'asuperior',
  9371. 'bsuperior',
  9372. 'centsuperior',
  9373. 'dsuperior',
  9374. 'esuperior',
  9375. '',
  9376. '',
  9377. 'isuperior',
  9378. '',
  9379. '',
  9380. 'lsuperior',
  9381. 'msuperior',
  9382. 'nsuperior',
  9383. 'osuperior',
  9384. '',
  9385. '',
  9386. 'rsuperior',
  9387. 'ssuperior',
  9388. 'tsuperior',
  9389. '',
  9390. 'ff',
  9391. 'fi',
  9392. 'fl',
  9393. 'ffi',
  9394. 'ffl',
  9395. 'parenleftinferior',
  9396. '',
  9397. 'parenrightinferior',
  9398. 'Circumflexsmall',
  9399. 'hyphensuperior',
  9400. 'Gravesmall',
  9401. 'Asmall',
  9402. 'Bsmall',
  9403. 'Csmall',
  9404. 'Dsmall',
  9405. 'Esmall',
  9406. 'Fsmall',
  9407. 'Gsmall',
  9408. 'Hsmall',
  9409. 'Ismall',
  9410. 'Jsmall',
  9411. 'Ksmall',
  9412. 'Lsmall',
  9413. 'Msmall',
  9414. 'Nsmall',
  9415. 'Osmall',
  9416. 'Psmall',
  9417. 'Qsmall',
  9418. 'Rsmall',
  9419. 'Ssmall',
  9420. 'Tsmall',
  9421. 'Usmall',
  9422. 'Vsmall',
  9423. 'Wsmall',
  9424. 'Xsmall',
  9425. 'Ysmall',
  9426. 'Zsmall',
  9427. 'colonmonetary',
  9428. 'onefitted',
  9429. 'rupiah',
  9430. 'Tildesmall',
  9431. '',
  9432. '',
  9433. '',
  9434. '',
  9435. '',
  9436. '',
  9437. '',
  9438. '',
  9439. '',
  9440. '',
  9441. '',
  9442. '',
  9443. '',
  9444. '',
  9445. '',
  9446. '',
  9447. '',
  9448. '',
  9449. '',
  9450. '',
  9451. '',
  9452. '',
  9453. '',
  9454. '',
  9455. '',
  9456. '',
  9457. '',
  9458. '',
  9459. '',
  9460. '',
  9461. '',
  9462. '',
  9463. '',
  9464. '',
  9465. 'exclamdownsmall',
  9466. 'centoldstyle',
  9467. 'Lslashsmall',
  9468. '',
  9469. '',
  9470. 'Scaronsmall',
  9471. 'Zcaronsmall',
  9472. 'Dieresissmall',
  9473. 'Brevesmall',
  9474. 'Caronsmall',
  9475. '',
  9476. 'Dotaccentsmall',
  9477. '',
  9478. '',
  9479. 'Macronsmall',
  9480. '',
  9481. '',
  9482. 'figuredash',
  9483. 'hypheninferior',
  9484. '',
  9485. '',
  9486. 'Ogoneksmall',
  9487. 'Ringsmall',
  9488. 'Cedillasmall',
  9489. '',
  9490. '',
  9491. '',
  9492. 'onequarter',
  9493. 'onehalf',
  9494. 'threequarters',
  9495. 'questiondownsmall',
  9496. 'oneeighth',
  9497. 'threeeighths',
  9498. 'fiveeighths',
  9499. 'seveneighths',
  9500. 'onethird',
  9501. 'twothirds',
  9502. '',
  9503. '',
  9504. 'zerosuperior',
  9505. 'onesuperior',
  9506. 'twosuperior',
  9507. 'threesuperior',
  9508. 'foursuperior',
  9509. 'fivesuperior',
  9510. 'sixsuperior',
  9511. 'sevensuperior',
  9512. 'eightsuperior',
  9513. 'ninesuperior',
  9514. 'zeroinferior',
  9515. 'oneinferior',
  9516. 'twoinferior',
  9517. 'threeinferior',
  9518. 'fourinferior',
  9519. 'fiveinferior',
  9520. 'sixinferior',
  9521. 'seveninferior',
  9522. 'eightinferior',
  9523. 'nineinferior',
  9524. 'centinferior',
  9525. 'dollarinferior',
  9526. 'periodinferior',
  9527. 'commainferior',
  9528. 'Agravesmall',
  9529. 'Aacutesmall',
  9530. 'Acircumflexsmall',
  9531. 'Atildesmall',
  9532. 'Adieresissmall',
  9533. 'Aringsmall',
  9534. 'AEsmall',
  9535. 'Ccedillasmall',
  9536. 'Egravesmall',
  9537. 'Eacutesmall',
  9538. 'Ecircumflexsmall',
  9539. 'Edieresissmall',
  9540. 'Igravesmall',
  9541. 'Iacutesmall',
  9542. 'Icircumflexsmall',
  9543. 'Idieresissmall',
  9544. 'Ethsmall',
  9545. 'Ntildesmall',
  9546. 'Ogravesmall',
  9547. 'Oacutesmall',
  9548. 'Ocircumflexsmall',
  9549. 'Otildesmall',
  9550. 'Odieresissmall',
  9551. 'OEsmall',
  9552. 'Oslashsmall',
  9553. 'Ugravesmall',
  9554. 'Uacutesmall',
  9555. 'Ucircumflexsmall',
  9556. 'Udieresissmall',
  9557. 'Yacutesmall',
  9558. 'Thornsmall',
  9559. 'Ydieresissmall'
  9560. ];
  9561. var MacExpertEncoding = [
  9562. '',
  9563. '',
  9564. '',
  9565. '',
  9566. '',
  9567. '',
  9568. '',
  9569. '',
  9570. '',
  9571. '',
  9572. '',
  9573. '',
  9574. '',
  9575. '',
  9576. '',
  9577. '',
  9578. '',
  9579. '',
  9580. '',
  9581. '',
  9582. '',
  9583. '',
  9584. '',
  9585. '',
  9586. '',
  9587. '',
  9588. '',
  9589. '',
  9590. '',
  9591. '',
  9592. '',
  9593. '',
  9594. 'space',
  9595. 'exclamsmall',
  9596. 'Hungarumlautsmall',
  9597. 'centoldstyle',
  9598. 'dollaroldstyle',
  9599. 'dollarsuperior',
  9600. 'ampersandsmall',
  9601. 'Acutesmall',
  9602. 'parenleftsuperior',
  9603. 'parenrightsuperior',
  9604. 'twodotenleader',
  9605. 'onedotenleader',
  9606. 'comma',
  9607. 'hyphen',
  9608. 'period',
  9609. 'fraction',
  9610. 'zerooldstyle',
  9611. 'oneoldstyle',
  9612. 'twooldstyle',
  9613. 'threeoldstyle',
  9614. 'fouroldstyle',
  9615. 'fiveoldstyle',
  9616. 'sixoldstyle',
  9617. 'sevenoldstyle',
  9618. 'eightoldstyle',
  9619. 'nineoldstyle',
  9620. 'colon',
  9621. 'semicolon',
  9622. '',
  9623. 'threequartersemdash',
  9624. '',
  9625. 'questionsmall',
  9626. '',
  9627. '',
  9628. '',
  9629. '',
  9630. 'Ethsmall',
  9631. '',
  9632. '',
  9633. 'onequarter',
  9634. 'onehalf',
  9635. 'threequarters',
  9636. 'oneeighth',
  9637. 'threeeighths',
  9638. 'fiveeighths',
  9639. 'seveneighths',
  9640. 'onethird',
  9641. 'twothirds',
  9642. '',
  9643. '',
  9644. '',
  9645. '',
  9646. '',
  9647. '',
  9648. 'ff',
  9649. 'fi',
  9650. 'fl',
  9651. 'ffi',
  9652. 'ffl',
  9653. 'parenleftinferior',
  9654. '',
  9655. 'parenrightinferior',
  9656. 'Circumflexsmall',
  9657. 'hypheninferior',
  9658. 'Gravesmall',
  9659. 'Asmall',
  9660. 'Bsmall',
  9661. 'Csmall',
  9662. 'Dsmall',
  9663. 'Esmall',
  9664. 'Fsmall',
  9665. 'Gsmall',
  9666. 'Hsmall',
  9667. 'Ismall',
  9668. 'Jsmall',
  9669. 'Ksmall',
  9670. 'Lsmall',
  9671. 'Msmall',
  9672. 'Nsmall',
  9673. 'Osmall',
  9674. 'Psmall',
  9675. 'Qsmall',
  9676. 'Rsmall',
  9677. 'Ssmall',
  9678. 'Tsmall',
  9679. 'Usmall',
  9680. 'Vsmall',
  9681. 'Wsmall',
  9682. 'Xsmall',
  9683. 'Ysmall',
  9684. 'Zsmall',
  9685. 'colonmonetary',
  9686. 'onefitted',
  9687. 'rupiah',
  9688. 'Tildesmall',
  9689. '',
  9690. '',
  9691. 'asuperior',
  9692. 'centsuperior',
  9693. '',
  9694. '',
  9695. '',
  9696. '',
  9697. 'Aacutesmall',
  9698. 'Agravesmall',
  9699. 'Acircumflexsmall',
  9700. 'Adieresissmall',
  9701. 'Atildesmall',
  9702. 'Aringsmall',
  9703. 'Ccedillasmall',
  9704. 'Eacutesmall',
  9705. 'Egravesmall',
  9706. 'Ecircumflexsmall',
  9707. 'Edieresissmall',
  9708. 'Iacutesmall',
  9709. 'Igravesmall',
  9710. 'Icircumflexsmall',
  9711. 'Idieresissmall',
  9712. 'Ntildesmall',
  9713. 'Oacutesmall',
  9714. 'Ogravesmall',
  9715. 'Ocircumflexsmall',
  9716. 'Odieresissmall',
  9717. 'Otildesmall',
  9718. 'Uacutesmall',
  9719. 'Ugravesmall',
  9720. 'Ucircumflexsmall',
  9721. 'Udieresissmall',
  9722. '',
  9723. 'eightsuperior',
  9724. 'fourinferior',
  9725. 'threeinferior',
  9726. 'sixinferior',
  9727. 'eightinferior',
  9728. 'seveninferior',
  9729. 'Scaronsmall',
  9730. '',
  9731. 'centinferior',
  9732. 'twoinferior',
  9733. '',
  9734. 'Dieresissmall',
  9735. '',
  9736. 'Caronsmall',
  9737. 'osuperior',
  9738. 'fiveinferior',
  9739. '',
  9740. 'commainferior',
  9741. 'periodinferior',
  9742. 'Yacutesmall',
  9743. '',
  9744. 'dollarinferior',
  9745. '',
  9746. 'Thornsmall',
  9747. '',
  9748. 'nineinferior',
  9749. 'zeroinferior',
  9750. 'Zcaronsmall',
  9751. 'AEsmall',
  9752. 'Oslashsmall',
  9753. 'questiondownsmall',
  9754. 'oneinferior',
  9755. 'Lslashsmall',
  9756. '',
  9757. '',
  9758. '',
  9759. '',
  9760. '',
  9761. '',
  9762. 'Cedillasmall',
  9763. '',
  9764. '',
  9765. '',
  9766. '',
  9767. '',
  9768. 'OEsmall',
  9769. 'figuredash',
  9770. 'hyphensuperior',
  9771. '',
  9772. '',
  9773. '',
  9774. '',
  9775. 'exclamdownsmall',
  9776. '',
  9777. 'Ydieresissmall',
  9778. '',
  9779. 'onesuperior',
  9780. 'twosuperior',
  9781. 'threesuperior',
  9782. 'foursuperior',
  9783. 'fivesuperior',
  9784. 'sixsuperior',
  9785. 'sevensuperior',
  9786. 'ninesuperior',
  9787. 'zerosuperior',
  9788. '',
  9789. 'esuperior',
  9790. 'rsuperior',
  9791. 'tsuperior',
  9792. '',
  9793. '',
  9794. 'isuperior',
  9795. 'ssuperior',
  9796. 'dsuperior',
  9797. '',
  9798. '',
  9799. '',
  9800. '',
  9801. '',
  9802. 'lsuperior',
  9803. 'Ogoneksmall',
  9804. 'Brevesmall',
  9805. 'Macronsmall',
  9806. 'bsuperior',
  9807. 'nsuperior',
  9808. 'msuperior',
  9809. 'commasuperior',
  9810. 'periodsuperior',
  9811. 'Dotaccentsmall',
  9812. 'Ringsmall'
  9813. ];
  9814. var MacRomanEncoding = [
  9815. '',
  9816. '',
  9817. '',
  9818. '',
  9819. '',
  9820. '',
  9821. '',
  9822. '',
  9823. '',
  9824. '',
  9825. '',
  9826. '',
  9827. '',
  9828. '',
  9829. '',
  9830. '',
  9831. '',
  9832. '',
  9833. '',
  9834. '',
  9835. '',
  9836. '',
  9837. '',
  9838. '',
  9839. '',
  9840. '',
  9841. '',
  9842. '',
  9843. '',
  9844. '',
  9845. '',
  9846. '',
  9847. 'space',
  9848. 'exclam',
  9849. 'quotedbl',
  9850. 'numbersign',
  9851. 'dollar',
  9852. 'percent',
  9853. 'ampersand',
  9854. 'quotesingle',
  9855. 'parenleft',
  9856. 'parenright',
  9857. 'asterisk',
  9858. 'plus',
  9859. 'comma',
  9860. 'hyphen',
  9861. 'period',
  9862. 'slash',
  9863. 'zero',
  9864. 'one',
  9865. 'two',
  9866. 'three',
  9867. 'four',
  9868. 'five',
  9869. 'six',
  9870. 'seven',
  9871. 'eight',
  9872. 'nine',
  9873. 'colon',
  9874. 'semicolon',
  9875. 'less',
  9876. 'equal',
  9877. 'greater',
  9878. 'question',
  9879. 'at',
  9880. 'A',
  9881. 'B',
  9882. 'C',
  9883. 'D',
  9884. 'E',
  9885. 'F',
  9886. 'G',
  9887. 'H',
  9888. 'I',
  9889. 'J',
  9890. 'K',
  9891. 'L',
  9892. 'M',
  9893. 'N',
  9894. 'O',
  9895. 'P',
  9896. 'Q',
  9897. 'R',
  9898. 'S',
  9899. 'T',
  9900. 'U',
  9901. 'V',
  9902. 'W',
  9903. 'X',
  9904. 'Y',
  9905. 'Z',
  9906. 'bracketleft',
  9907. 'backslash',
  9908. 'bracketright',
  9909. 'asciicircum',
  9910. 'underscore',
  9911. 'grave',
  9912. 'a',
  9913. 'b',
  9914. 'c',
  9915. 'd',
  9916. 'e',
  9917. 'f',
  9918. 'g',
  9919. 'h',
  9920. 'i',
  9921. 'j',
  9922. 'k',
  9923. 'l',
  9924. 'm',
  9925. 'n',
  9926. 'o',
  9927. 'p',
  9928. 'q',
  9929. 'r',
  9930. 's',
  9931. 't',
  9932. 'u',
  9933. 'v',
  9934. 'w',
  9935. 'x',
  9936. 'y',
  9937. 'z',
  9938. 'braceleft',
  9939. 'bar',
  9940. 'braceright',
  9941. 'asciitilde',
  9942. '',
  9943. 'Adieresis',
  9944. 'Aring',
  9945. 'Ccedilla',
  9946. 'Eacute',
  9947. 'Ntilde',
  9948. 'Odieresis',
  9949. 'Udieresis',
  9950. 'aacute',
  9951. 'agrave',
  9952. 'acircumflex',
  9953. 'adieresis',
  9954. 'atilde',
  9955. 'aring',
  9956. 'ccedilla',
  9957. 'eacute',
  9958. 'egrave',
  9959. 'ecircumflex',
  9960. 'edieresis',
  9961. 'iacute',
  9962. 'igrave',
  9963. 'icircumflex',
  9964. 'idieresis',
  9965. 'ntilde',
  9966. 'oacute',
  9967. 'ograve',
  9968. 'ocircumflex',
  9969. 'odieresis',
  9970. 'otilde',
  9971. 'uacute',
  9972. 'ugrave',
  9973. 'ucircumflex',
  9974. 'udieresis',
  9975. 'dagger',
  9976. 'degree',
  9977. 'cent',
  9978. 'sterling',
  9979. 'section',
  9980. 'bullet',
  9981. 'paragraph',
  9982. 'germandbls',
  9983. 'registered',
  9984. 'copyright',
  9985. 'trademark',
  9986. 'acute',
  9987. 'dieresis',
  9988. 'notequal',
  9989. 'AE',
  9990. 'Oslash',
  9991. 'infinity',
  9992. 'plusminus',
  9993. 'lessequal',
  9994. 'greaterequal',
  9995. 'yen',
  9996. 'mu',
  9997. 'partialdiff',
  9998. 'summation',
  9999. 'product',
  10000. 'pi',
  10001. 'integral',
  10002. 'ordfeminine',
  10003. 'ordmasculine',
  10004. 'Omega',
  10005. 'ae',
  10006. 'oslash',
  10007. 'questiondown',
  10008. 'exclamdown',
  10009. 'logicalnot',
  10010. 'radical',
  10011. 'florin',
  10012. 'approxequal',
  10013. 'Delta',
  10014. 'guillemotleft',
  10015. 'guillemotright',
  10016. 'ellipsis',
  10017. 'space',
  10018. 'Agrave',
  10019. 'Atilde',
  10020. 'Otilde',
  10021. 'OE',
  10022. 'oe',
  10023. 'endash',
  10024. 'emdash',
  10025. 'quotedblleft',
  10026. 'quotedblright',
  10027. 'quoteleft',
  10028. 'quoteright',
  10029. 'divide',
  10030. 'lozenge',
  10031. 'ydieresis',
  10032. 'Ydieresis',
  10033. 'fraction',
  10034. 'currency',
  10035. 'guilsinglleft',
  10036. 'guilsinglright',
  10037. 'fi',
  10038. 'fl',
  10039. 'daggerdbl',
  10040. 'periodcentered',
  10041. 'quotesinglbase',
  10042. 'quotedblbase',
  10043. 'perthousand',
  10044. 'Acircumflex',
  10045. 'Ecircumflex',
  10046. 'Aacute',
  10047. 'Edieresis',
  10048. 'Egrave',
  10049. 'Iacute',
  10050. 'Icircumflex',
  10051. 'Idieresis',
  10052. 'Igrave',
  10053. 'Oacute',
  10054. 'Ocircumflex',
  10055. 'apple',
  10056. 'Ograve',
  10057. 'Uacute',
  10058. 'Ucircumflex',
  10059. 'Ugrave',
  10060. 'dotlessi',
  10061. 'circumflex',
  10062. 'tilde',
  10063. 'macron',
  10064. 'breve',
  10065. 'dotaccent',
  10066. 'ring',
  10067. 'cedilla',
  10068. 'hungarumlaut',
  10069. 'ogonek',
  10070. 'caron'
  10071. ];
  10072. var StandardEncoding = [
  10073. '',
  10074. '',
  10075. '',
  10076. '',
  10077. '',
  10078. '',
  10079. '',
  10080. '',
  10081. '',
  10082. '',
  10083. '',
  10084. '',
  10085. '',
  10086. '',
  10087. '',
  10088. '',
  10089. '',
  10090. '',
  10091. '',
  10092. '',
  10093. '',
  10094. '',
  10095. '',
  10096. '',
  10097. '',
  10098. '',
  10099. '',
  10100. '',
  10101. '',
  10102. '',
  10103. '',
  10104. '',
  10105. 'space',
  10106. 'exclam',
  10107. 'quotedbl',
  10108. 'numbersign',
  10109. 'dollar',
  10110. 'percent',
  10111. 'ampersand',
  10112. 'quoteright',
  10113. 'parenleft',
  10114. 'parenright',
  10115. 'asterisk',
  10116. 'plus',
  10117. 'comma',
  10118. 'hyphen',
  10119. 'period',
  10120. 'slash',
  10121. 'zero',
  10122. 'one',
  10123. 'two',
  10124. 'three',
  10125. 'four',
  10126. 'five',
  10127. 'six',
  10128. 'seven',
  10129. 'eight',
  10130. 'nine',
  10131. 'colon',
  10132. 'semicolon',
  10133. 'less',
  10134. 'equal',
  10135. 'greater',
  10136. 'question',
  10137. 'at',
  10138. 'A',
  10139. 'B',
  10140. 'C',
  10141. 'D',
  10142. 'E',
  10143. 'F',
  10144. 'G',
  10145. 'H',
  10146. 'I',
  10147. 'J',
  10148. 'K',
  10149. 'L',
  10150. 'M',
  10151. 'N',
  10152. 'O',
  10153. 'P',
  10154. 'Q',
  10155. 'R',
  10156. 'S',
  10157. 'T',
  10158. 'U',
  10159. 'V',
  10160. 'W',
  10161. 'X',
  10162. 'Y',
  10163. 'Z',
  10164. 'bracketleft',
  10165. 'backslash',
  10166. 'bracketright',
  10167. 'asciicircum',
  10168. 'underscore',
  10169. 'quoteleft',
  10170. 'a',
  10171. 'b',
  10172. 'c',
  10173. 'd',
  10174. 'e',
  10175. 'f',
  10176. 'g',
  10177. 'h',
  10178. 'i',
  10179. 'j',
  10180. 'k',
  10181. 'l',
  10182. 'm',
  10183. 'n',
  10184. 'o',
  10185. 'p',
  10186. 'q',
  10187. 'r',
  10188. 's',
  10189. 't',
  10190. 'u',
  10191. 'v',
  10192. 'w',
  10193. 'x',
  10194. 'y',
  10195. 'z',
  10196. 'braceleft',
  10197. 'bar',
  10198. 'braceright',
  10199. 'asciitilde',
  10200. '',
  10201. '',
  10202. '',
  10203. '',
  10204. '',
  10205. '',
  10206. '',
  10207. '',
  10208. '',
  10209. '',
  10210. '',
  10211. '',
  10212. '',
  10213. '',
  10214. '',
  10215. '',
  10216. '',
  10217. '',
  10218. '',
  10219. '',
  10220. '',
  10221. '',
  10222. '',
  10223. '',
  10224. '',
  10225. '',
  10226. '',
  10227. '',
  10228. '',
  10229. '',
  10230. '',
  10231. '',
  10232. '',
  10233. '',
  10234. 'exclamdown',
  10235. 'cent',
  10236. 'sterling',
  10237. 'fraction',
  10238. 'yen',
  10239. 'florin',
  10240. 'section',
  10241. 'currency',
  10242. 'quotesingle',
  10243. 'quotedblleft',
  10244. 'guillemotleft',
  10245. 'guilsinglleft',
  10246. 'guilsinglright',
  10247. 'fi',
  10248. 'fl',
  10249. '',
  10250. 'endash',
  10251. 'dagger',
  10252. 'daggerdbl',
  10253. 'periodcentered',
  10254. '',
  10255. 'paragraph',
  10256. 'bullet',
  10257. 'quotesinglbase',
  10258. 'quotedblbase',
  10259. 'quotedblright',
  10260. 'guillemotright',
  10261. 'ellipsis',
  10262. 'perthousand',
  10263. '',
  10264. 'questiondown',
  10265. '',
  10266. 'grave',
  10267. 'acute',
  10268. 'circumflex',
  10269. 'tilde',
  10270. 'macron',
  10271. 'breve',
  10272. 'dotaccent',
  10273. 'dieresis',
  10274. '',
  10275. 'ring',
  10276. 'cedilla',
  10277. '',
  10278. 'hungarumlaut',
  10279. 'ogonek',
  10280. 'caron',
  10281. 'emdash',
  10282. '',
  10283. '',
  10284. '',
  10285. '',
  10286. '',
  10287. '',
  10288. '',
  10289. '',
  10290. '',
  10291. '',
  10292. '',
  10293. '',
  10294. '',
  10295. '',
  10296. '',
  10297. '',
  10298. 'AE',
  10299. '',
  10300. 'ordfeminine',
  10301. '',
  10302. '',
  10303. '',
  10304. '',
  10305. 'Lslash',
  10306. 'Oslash',
  10307. 'OE',
  10308. 'ordmasculine',
  10309. '',
  10310. '',
  10311. '',
  10312. '',
  10313. '',
  10314. 'ae',
  10315. '',
  10316. '',
  10317. '',
  10318. 'dotlessi',
  10319. '',
  10320. '',
  10321. 'lslash',
  10322. 'oslash',
  10323. 'oe',
  10324. 'germandbls'
  10325. ];
  10326. var WinAnsiEncoding = [
  10327. '',
  10328. '',
  10329. '',
  10330. '',
  10331. '',
  10332. '',
  10333. '',
  10334. '',
  10335. '',
  10336. '',
  10337. '',
  10338. '',
  10339. '',
  10340. '',
  10341. '',
  10342. '',
  10343. '',
  10344. '',
  10345. '',
  10346. '',
  10347. '',
  10348. '',
  10349. '',
  10350. '',
  10351. '',
  10352. '',
  10353. '',
  10354. '',
  10355. '',
  10356. '',
  10357. '',
  10358. '',
  10359. 'space',
  10360. 'exclam',
  10361. 'quotedbl',
  10362. 'numbersign',
  10363. 'dollar',
  10364. 'percent',
  10365. 'ampersand',
  10366. 'quotesingle',
  10367. 'parenleft',
  10368. 'parenright',
  10369. 'asterisk',
  10370. 'plus',
  10371. 'comma',
  10372. 'hyphen',
  10373. 'period',
  10374. 'slash',
  10375. 'zero',
  10376. 'one',
  10377. 'two',
  10378. 'three',
  10379. 'four',
  10380. 'five',
  10381. 'six',
  10382. 'seven',
  10383. 'eight',
  10384. 'nine',
  10385. 'colon',
  10386. 'semicolon',
  10387. 'less',
  10388. 'equal',
  10389. 'greater',
  10390. 'question',
  10391. 'at',
  10392. 'A',
  10393. 'B',
  10394. 'C',
  10395. 'D',
  10396. 'E',
  10397. 'F',
  10398. 'G',
  10399. 'H',
  10400. 'I',
  10401. 'J',
  10402. 'K',
  10403. 'L',
  10404. 'M',
  10405. 'N',
  10406. 'O',
  10407. 'P',
  10408. 'Q',
  10409. 'R',
  10410. 'S',
  10411. 'T',
  10412. 'U',
  10413. 'V',
  10414. 'W',
  10415. 'X',
  10416. 'Y',
  10417. 'Z',
  10418. 'bracketleft',
  10419. 'backslash',
  10420. 'bracketright',
  10421. 'asciicircum',
  10422. 'underscore',
  10423. 'grave',
  10424. 'a',
  10425. 'b',
  10426. 'c',
  10427. 'd',
  10428. 'e',
  10429. 'f',
  10430. 'g',
  10431. 'h',
  10432. 'i',
  10433. 'j',
  10434. 'k',
  10435. 'l',
  10436. 'm',
  10437. 'n',
  10438. 'o',
  10439. 'p',
  10440. 'q',
  10441. 'r',
  10442. 's',
  10443. 't',
  10444. 'u',
  10445. 'v',
  10446. 'w',
  10447. 'x',
  10448. 'y',
  10449. 'z',
  10450. 'braceleft',
  10451. 'bar',
  10452. 'braceright',
  10453. 'asciitilde',
  10454. 'bullet',
  10455. 'Euro',
  10456. 'bullet',
  10457. 'quotesinglbase',
  10458. 'florin',
  10459. 'quotedblbase',
  10460. 'ellipsis',
  10461. 'dagger',
  10462. 'daggerdbl',
  10463. 'circumflex',
  10464. 'perthousand',
  10465. 'Scaron',
  10466. 'guilsinglleft',
  10467. 'OE',
  10468. 'bullet',
  10469. 'Zcaron',
  10470. 'bullet',
  10471. 'bullet',
  10472. 'quoteleft',
  10473. 'quoteright',
  10474. 'quotedblleft',
  10475. 'quotedblright',
  10476. 'bullet',
  10477. 'endash',
  10478. 'emdash',
  10479. 'tilde',
  10480. 'trademark',
  10481. 'scaron',
  10482. 'guilsinglright',
  10483. 'oe',
  10484. 'bullet',
  10485. 'zcaron',
  10486. 'Ydieresis',
  10487. 'space',
  10488. 'exclamdown',
  10489. 'cent',
  10490. 'sterling',
  10491. 'currency',
  10492. 'yen',
  10493. 'brokenbar',
  10494. 'section',
  10495. 'dieresis',
  10496. 'copyright',
  10497. 'ordfeminine',
  10498. 'guillemotleft',
  10499. 'logicalnot',
  10500. 'hyphen',
  10501. 'registered',
  10502. 'macron',
  10503. 'degree',
  10504. 'plusminus',
  10505. 'twosuperior',
  10506. 'threesuperior',
  10507. 'acute',
  10508. 'mu',
  10509. 'paragraph',
  10510. 'periodcentered',
  10511. 'cedilla',
  10512. 'onesuperior',
  10513. 'ordmasculine',
  10514. 'guillemotright',
  10515. 'onequarter',
  10516. 'onehalf',
  10517. 'threequarters',
  10518. 'questiondown',
  10519. 'Agrave',
  10520. 'Aacute',
  10521. 'Acircumflex',
  10522. 'Atilde',
  10523. 'Adieresis',
  10524. 'Aring',
  10525. 'AE',
  10526. 'Ccedilla',
  10527. 'Egrave',
  10528. 'Eacute',
  10529. 'Ecircumflex',
  10530. 'Edieresis',
  10531. 'Igrave',
  10532. 'Iacute',
  10533. 'Icircumflex',
  10534. 'Idieresis',
  10535. 'Eth',
  10536. 'Ntilde',
  10537. 'Ograve',
  10538. 'Oacute',
  10539. 'Ocircumflex',
  10540. 'Otilde',
  10541. 'Odieresis',
  10542. 'multiply',
  10543. 'Oslash',
  10544. 'Ugrave',
  10545. 'Uacute',
  10546. 'Ucircumflex',
  10547. 'Udieresis',
  10548. 'Yacute',
  10549. 'Thorn',
  10550. 'germandbls',
  10551. 'agrave',
  10552. 'aacute',
  10553. 'acircumflex',
  10554. 'atilde',
  10555. 'adieresis',
  10556. 'aring',
  10557. 'ae',
  10558. 'ccedilla',
  10559. 'egrave',
  10560. 'eacute',
  10561. 'ecircumflex',
  10562. 'edieresis',
  10563. 'igrave',
  10564. 'iacute',
  10565. 'icircumflex',
  10566. 'idieresis',
  10567. 'eth',
  10568. 'ntilde',
  10569. 'ograve',
  10570. 'oacute',
  10571. 'ocircumflex',
  10572. 'otilde',
  10573. 'odieresis',
  10574. 'divide',
  10575. 'oslash',
  10576. 'ugrave',
  10577. 'uacute',
  10578. 'ucircumflex',
  10579. 'udieresis',
  10580. 'yacute',
  10581. 'thorn',
  10582. 'ydieresis'
  10583. ];
  10584. var SymbolSetEncoding = [
  10585. '',
  10586. '',
  10587. '',
  10588. '',
  10589. '',
  10590. '',
  10591. '',
  10592. '',
  10593. '',
  10594. '',
  10595. '',
  10596. '',
  10597. '',
  10598. '',
  10599. '',
  10600. '',
  10601. '',
  10602. '',
  10603. '',
  10604. '',
  10605. '',
  10606. '',
  10607. '',
  10608. '',
  10609. '',
  10610. '',
  10611. '',
  10612. '',
  10613. '',
  10614. '',
  10615. '',
  10616. '',
  10617. 'space',
  10618. 'exclam',
  10619. 'universal',
  10620. 'numbersign',
  10621. 'existential',
  10622. 'percent',
  10623. 'ampersand',
  10624. 'suchthat',
  10625. 'parenleft',
  10626. 'parenright',
  10627. 'asteriskmath',
  10628. 'plus',
  10629. 'comma',
  10630. 'minus',
  10631. 'period',
  10632. 'slash',
  10633. 'zero',
  10634. 'one',
  10635. 'two',
  10636. 'three',
  10637. 'four',
  10638. 'five',
  10639. 'six',
  10640. 'seven',
  10641. 'eight',
  10642. 'nine',
  10643. 'colon',
  10644. 'semicolon',
  10645. 'less',
  10646. 'equal',
  10647. 'greater',
  10648. 'question',
  10649. 'congruent',
  10650. 'Alpha',
  10651. 'Beta',
  10652. 'Chi',
  10653. 'Delta',
  10654. 'Epsilon',
  10655. 'Phi',
  10656. 'Gamma',
  10657. 'Eta',
  10658. 'Iota',
  10659. 'theta1',
  10660. 'Kappa',
  10661. 'Lambda',
  10662. 'Mu',
  10663. 'Nu',
  10664. 'Omicron',
  10665. 'Pi',
  10666. 'Theta',
  10667. 'Rho',
  10668. 'Sigma',
  10669. 'Tau',
  10670. 'Upsilon',
  10671. 'sigma1',
  10672. 'Omega',
  10673. 'Xi',
  10674. 'Psi',
  10675. 'Zeta',
  10676. 'bracketleft',
  10677. 'therefore',
  10678. 'bracketright',
  10679. 'perpendicular',
  10680. 'underscore',
  10681. 'radicalex',
  10682. 'alpha',
  10683. 'beta',
  10684. 'chi',
  10685. 'delta',
  10686. 'epsilon',
  10687. 'phi',
  10688. 'gamma',
  10689. 'eta',
  10690. 'iota',
  10691. 'phi1',
  10692. 'kappa',
  10693. 'lambda',
  10694. 'mu',
  10695. 'nu',
  10696. 'omicron',
  10697. 'pi',
  10698. 'theta',
  10699. 'rho',
  10700. 'sigma',
  10701. 'tau',
  10702. 'upsilon',
  10703. 'omega1',
  10704. 'omega',
  10705. 'xi',
  10706. 'psi',
  10707. 'zeta',
  10708. 'braceleft',
  10709. 'bar',
  10710. 'braceright',
  10711. 'similar',
  10712. '',
  10713. '',
  10714. '',
  10715. '',
  10716. '',
  10717. '',
  10718. '',
  10719. '',
  10720. '',
  10721. '',
  10722. '',
  10723. '',
  10724. '',
  10725. '',
  10726. '',
  10727. '',
  10728. '',
  10729. '',
  10730. '',
  10731. '',
  10732. '',
  10733. '',
  10734. '',
  10735. '',
  10736. '',
  10737. '',
  10738. '',
  10739. '',
  10740. '',
  10741. '',
  10742. '',
  10743. '',
  10744. '',
  10745. 'Euro',
  10746. 'Upsilon1',
  10747. 'minute',
  10748. 'lessequal',
  10749. 'fraction',
  10750. 'infinity',
  10751. 'florin',
  10752. 'club',
  10753. 'diamond',
  10754. 'heart',
  10755. 'spade',
  10756. 'arrowboth',
  10757. 'arrowleft',
  10758. 'arrowup',
  10759. 'arrowright',
  10760. 'arrowdown',
  10761. 'degree',
  10762. 'plusminus',
  10763. 'second',
  10764. 'greaterequal',
  10765. 'multiply',
  10766. 'proportional',
  10767. 'partialdiff',
  10768. 'bullet',
  10769. 'divide',
  10770. 'notequal',
  10771. 'equivalence',
  10772. 'approxequal',
  10773. 'ellipsis',
  10774. 'arrowvertex',
  10775. 'arrowhorizex',
  10776. 'carriagereturn',
  10777. 'aleph',
  10778. 'Ifraktur',
  10779. 'Rfraktur',
  10780. 'weierstrass',
  10781. 'circlemultiply',
  10782. 'circleplus',
  10783. 'emptyset',
  10784. 'intersection',
  10785. 'union',
  10786. 'propersuperset',
  10787. 'reflexsuperset',
  10788. 'notsubset',
  10789. 'propersubset',
  10790. 'reflexsubset',
  10791. 'element',
  10792. 'notelement',
  10793. 'angle',
  10794. 'gradient',
  10795. 'registerserif',
  10796. 'copyrightserif',
  10797. 'trademarkserif',
  10798. 'product',
  10799. 'radical',
  10800. 'dotmath',
  10801. 'logicalnot',
  10802. 'logicaland',
  10803. 'logicalor',
  10804. 'arrowdblboth',
  10805. 'arrowdblleft',
  10806. 'arrowdblup',
  10807. 'arrowdblright',
  10808. 'arrowdbldown',
  10809. 'lozenge',
  10810. 'angleleft',
  10811. 'registersans',
  10812. 'copyrightsans',
  10813. 'trademarksans',
  10814. 'summation',
  10815. 'parenlefttp',
  10816. 'parenleftex',
  10817. 'parenleftbt',
  10818. 'bracketlefttp',
  10819. 'bracketleftex',
  10820. 'bracketleftbt',
  10821. 'bracelefttp',
  10822. 'braceleftmid',
  10823. 'braceleftbt',
  10824. 'braceex',
  10825. '',
  10826. 'angleright',
  10827. 'integral',
  10828. 'integraltp',
  10829. 'integralex',
  10830. 'integralbt',
  10831. 'parenrighttp',
  10832. 'parenrightex',
  10833. 'parenrightbt',
  10834. 'bracketrighttp',
  10835. 'bracketrightex',
  10836. 'bracketrightbt',
  10837. 'bracerighttp',
  10838. 'bracerightmid',
  10839. 'bracerightbt'
  10840. ];
  10841. var ZapfDingbatsEncoding = [
  10842. '',
  10843. '',
  10844. '',
  10845. '',
  10846. '',
  10847. '',
  10848. '',
  10849. '',
  10850. '',
  10851. '',
  10852. '',
  10853. '',
  10854. '',
  10855. '',
  10856. '',
  10857. '',
  10858. '',
  10859. '',
  10860. '',
  10861. '',
  10862. '',
  10863. '',
  10864. '',
  10865. '',
  10866. '',
  10867. '',
  10868. '',
  10869. '',
  10870. '',
  10871. '',
  10872. '',
  10873. '',
  10874. 'space',
  10875. 'a1',
  10876. 'a2',
  10877. 'a202',
  10878. 'a3',
  10879. 'a4',
  10880. 'a5',
  10881. 'a119',
  10882. 'a118',
  10883. 'a117',
  10884. 'a11',
  10885. 'a12',
  10886. 'a13',
  10887. 'a14',
  10888. 'a15',
  10889. 'a16',
  10890. 'a105',
  10891. 'a17',
  10892. 'a18',
  10893. 'a19',
  10894. 'a20',
  10895. 'a21',
  10896. 'a22',
  10897. 'a23',
  10898. 'a24',
  10899. 'a25',
  10900. 'a26',
  10901. 'a27',
  10902. 'a28',
  10903. 'a6',
  10904. 'a7',
  10905. 'a8',
  10906. 'a9',
  10907. 'a10',
  10908. 'a29',
  10909. 'a30',
  10910. 'a31',
  10911. 'a32',
  10912. 'a33',
  10913. 'a34',
  10914. 'a35',
  10915. 'a36',
  10916. 'a37',
  10917. 'a38',
  10918. 'a39',
  10919. 'a40',
  10920. 'a41',
  10921. 'a42',
  10922. 'a43',
  10923. 'a44',
  10924. 'a45',
  10925. 'a46',
  10926. 'a47',
  10927. 'a48',
  10928. 'a49',
  10929. 'a50',
  10930. 'a51',
  10931. 'a52',
  10932. 'a53',
  10933. 'a54',
  10934. 'a55',
  10935. 'a56',
  10936. 'a57',
  10937. 'a58',
  10938. 'a59',
  10939. 'a60',
  10940. 'a61',
  10941. 'a62',
  10942. 'a63',
  10943. 'a64',
  10944. 'a65',
  10945. 'a66',
  10946. 'a67',
  10947. 'a68',
  10948. 'a69',
  10949. 'a70',
  10950. 'a71',
  10951. 'a72',
  10952. 'a73',
  10953. 'a74',
  10954. 'a203',
  10955. 'a75',
  10956. 'a204',
  10957. 'a76',
  10958. 'a77',
  10959. 'a78',
  10960. 'a79',
  10961. 'a81',
  10962. 'a82',
  10963. 'a83',
  10964. 'a84',
  10965. 'a97',
  10966. 'a98',
  10967. 'a99',
  10968. 'a100',
  10969. '',
  10970. 'a89',
  10971. 'a90',
  10972. 'a93',
  10973. 'a94',
  10974. 'a91',
  10975. 'a92',
  10976. 'a205',
  10977. 'a85',
  10978. 'a206',
  10979. 'a86',
  10980. 'a87',
  10981. 'a88',
  10982. 'a95',
  10983. 'a96',
  10984. '',
  10985. '',
  10986. '',
  10987. '',
  10988. '',
  10989. '',
  10990. '',
  10991. '',
  10992. '',
  10993. '',
  10994. '',
  10995. '',
  10996. '',
  10997. '',
  10998. '',
  10999. '',
  11000. '',
  11001. '',
  11002. '',
  11003. 'a101',
  11004. 'a102',
  11005. 'a103',
  11006. 'a104',
  11007. 'a106',
  11008. 'a107',
  11009. 'a108',
  11010. 'a112',
  11011. 'a111',
  11012. 'a110',
  11013. 'a109',
  11014. 'a120',
  11015. 'a121',
  11016. 'a122',
  11017. 'a123',
  11018. 'a124',
  11019. 'a125',
  11020. 'a126',
  11021. 'a127',
  11022. 'a128',
  11023. 'a129',
  11024. 'a130',
  11025. 'a131',
  11026. 'a132',
  11027. 'a133',
  11028. 'a134',
  11029. 'a135',
  11030. 'a136',
  11031. 'a137',
  11032. 'a138',
  11033. 'a139',
  11034. 'a140',
  11035. 'a141',
  11036. 'a142',
  11037. 'a143',
  11038. 'a144',
  11039. 'a145',
  11040. 'a146',
  11041. 'a147',
  11042. 'a148',
  11043. 'a149',
  11044. 'a150',
  11045. 'a151',
  11046. 'a152',
  11047. 'a153',
  11048. 'a154',
  11049. 'a155',
  11050. 'a156',
  11051. 'a157',
  11052. 'a158',
  11053. 'a159',
  11054. 'a160',
  11055. 'a161',
  11056. 'a163',
  11057. 'a164',
  11058. 'a196',
  11059. 'a165',
  11060. 'a192',
  11061. 'a166',
  11062. 'a167',
  11063. 'a168',
  11064. 'a169',
  11065. 'a170',
  11066. 'a171',
  11067. 'a172',
  11068. 'a173',
  11069. 'a162',
  11070. 'a174',
  11071. 'a175',
  11072. 'a176',
  11073. 'a177',
  11074. 'a178',
  11075. 'a179',
  11076. 'a193',
  11077. 'a180',
  11078. 'a199',
  11079. 'a181',
  11080. 'a200',
  11081. 'a182',
  11082. '',
  11083. 'a201',
  11084. 'a183',
  11085. 'a184',
  11086. 'a197',
  11087. 'a185',
  11088. 'a194',
  11089. 'a198',
  11090. 'a186',
  11091. 'a195',
  11092. 'a187',
  11093. 'a188',
  11094. 'a189',
  11095. 'a190',
  11096. 'a191'
  11097. ];
  11098. function getEncoding(encodingName) {
  11099. switch (encodingName) {
  11100. case 'WinAnsiEncoding':
  11101. return WinAnsiEncoding;
  11102. case 'StandardEncoding':
  11103. return StandardEncoding;
  11104. case 'MacRomanEncoding':
  11105. return MacRomanEncoding;
  11106. case 'SymbolSetEncoding':
  11107. return SymbolSetEncoding;
  11108. case 'ZapfDingbatsEncoding':
  11109. return ZapfDingbatsEncoding;
  11110. case 'ExpertEncoding':
  11111. return ExpertEncoding;
  11112. case 'MacExpertEncoding':
  11113. return MacExpertEncoding;
  11114. default:
  11115. return null;
  11116. }
  11117. }
  11118. exports.WinAnsiEncoding = WinAnsiEncoding;
  11119. exports.StandardEncoding = StandardEncoding;
  11120. exports.MacRomanEncoding = MacRomanEncoding;
  11121. exports.SymbolSetEncoding = SymbolSetEncoding;
  11122. exports.ZapfDingbatsEncoding = ZapfDingbatsEncoding;
  11123. exports.ExpertEncoding = ExpertEncoding;
  11124. exports.getEncoding = getEncoding;
  11125. /***/ }),
  11126. /* 5 */
  11127. /***/ (function(module, exports, __w_pdfjs_require__) {
  11128. "use strict";
  11129. var sharedUtil = __w_pdfjs_require__(0);
  11130. var corePrimitives = __w_pdfjs_require__(1);
  11131. var coreStream = __w_pdfjs_require__(2);
  11132. var MissingDataException = sharedUtil.MissingDataException;
  11133. var StreamType = sharedUtil.StreamType;
  11134. var assert = sharedUtil.assert;
  11135. var error = sharedUtil.error;
  11136. var info = sharedUtil.info;
  11137. var isArray = sharedUtil.isArray;
  11138. var isInt = sharedUtil.isInt;
  11139. var isNum = sharedUtil.isNum;
  11140. var isString = sharedUtil.isString;
  11141. var warn = sharedUtil.warn;
  11142. var EOF = corePrimitives.EOF;
  11143. var Cmd = corePrimitives.Cmd;
  11144. var Dict = corePrimitives.Dict;
  11145. var Name = corePrimitives.Name;
  11146. var Ref = corePrimitives.Ref;
  11147. var isEOF = corePrimitives.isEOF;
  11148. var isCmd = corePrimitives.isCmd;
  11149. var isDict = corePrimitives.isDict;
  11150. var isName = corePrimitives.isName;
  11151. var Ascii85Stream = coreStream.Ascii85Stream;
  11152. var AsciiHexStream = coreStream.AsciiHexStream;
  11153. var CCITTFaxStream = coreStream.CCITTFaxStream;
  11154. var FlateStream = coreStream.FlateStream;
  11155. var Jbig2Stream = coreStream.Jbig2Stream;
  11156. var JpegStream = coreStream.JpegStream;
  11157. var JpxStream = coreStream.JpxStream;
  11158. var LZWStream = coreStream.LZWStream;
  11159. var NullStream = coreStream.NullStream;
  11160. var PredictorStream = coreStream.PredictorStream;
  11161. var RunLengthStream = coreStream.RunLengthStream;
  11162. var MAX_LENGTH_TO_CACHE = 1000;
  11163. var Parser = function ParserClosure() {
  11164. function Parser(lexer, allowStreams, xref, recoveryMode) {
  11165. this.lexer = lexer;
  11166. this.allowStreams = allowStreams;
  11167. this.xref = xref;
  11168. this.recoveryMode = recoveryMode || false;
  11169. this.imageCache = Object.create(null);
  11170. this.refill();
  11171. }
  11172. Parser.prototype = {
  11173. refill: function Parser_refill() {
  11174. this.buf1 = this.lexer.getObj();
  11175. this.buf2 = this.lexer.getObj();
  11176. },
  11177. shift: function Parser_shift() {
  11178. if (isCmd(this.buf2, 'ID')) {
  11179. this.buf1 = this.buf2;
  11180. this.buf2 = null;
  11181. } else {
  11182. this.buf1 = this.buf2;
  11183. this.buf2 = this.lexer.getObj();
  11184. }
  11185. },
  11186. tryShift: function Parser_tryShift() {
  11187. try {
  11188. this.shift();
  11189. return true;
  11190. } catch (e) {
  11191. if (e instanceof MissingDataException) {
  11192. throw e;
  11193. }
  11194. return false;
  11195. }
  11196. },
  11197. getObj: function Parser_getObj(cipherTransform) {
  11198. var buf1 = this.buf1;
  11199. this.shift();
  11200. if (buf1 instanceof Cmd) {
  11201. switch (buf1.cmd) {
  11202. case 'BI':
  11203. return this.makeInlineImage(cipherTransform);
  11204. case '[':
  11205. var array = [];
  11206. while (!isCmd(this.buf1, ']') && !isEOF(this.buf1)) {
  11207. array.push(this.getObj(cipherTransform));
  11208. }
  11209. if (isEOF(this.buf1)) {
  11210. if (!this.recoveryMode) {
  11211. error('End of file inside array');
  11212. }
  11213. return array;
  11214. }
  11215. this.shift();
  11216. return array;
  11217. case '<<':
  11218. var dict = new Dict(this.xref);
  11219. while (!isCmd(this.buf1, '>>') && !isEOF(this.buf1)) {
  11220. if (!isName(this.buf1)) {
  11221. info('Malformed dictionary: key must be a name object');
  11222. this.shift();
  11223. continue;
  11224. }
  11225. var key = this.buf1.name;
  11226. this.shift();
  11227. if (isEOF(this.buf1)) {
  11228. break;
  11229. }
  11230. dict.set(key, this.getObj(cipherTransform));
  11231. }
  11232. if (isEOF(this.buf1)) {
  11233. if (!this.recoveryMode) {
  11234. error('End of file inside dictionary');
  11235. }
  11236. return dict;
  11237. }
  11238. if (isCmd(this.buf2, 'stream')) {
  11239. return this.allowStreams ? this.makeStream(dict, cipherTransform) : dict;
  11240. }
  11241. this.shift();
  11242. return dict;
  11243. default:
  11244. return buf1;
  11245. }
  11246. }
  11247. if (isInt(buf1)) {
  11248. var num = buf1;
  11249. if (isInt(this.buf1) && isCmd(this.buf2, 'R')) {
  11250. var ref = new Ref(num, this.buf1);
  11251. this.shift();
  11252. this.shift();
  11253. return ref;
  11254. }
  11255. return num;
  11256. }
  11257. if (isString(buf1)) {
  11258. var str = buf1;
  11259. if (cipherTransform) {
  11260. str = cipherTransform.decryptString(str);
  11261. }
  11262. return str;
  11263. }
  11264. return buf1;
  11265. },
  11266. findDefaultInlineStreamEnd: function Parser_findDefaultInlineStreamEnd(stream) {
  11267. var E = 0x45, I = 0x49, SPACE = 0x20, LF = 0xA, CR = 0xD;
  11268. var startPos = stream.pos, state = 0, ch, i, n, followingBytes;
  11269. while ((ch = stream.getByte()) !== -1) {
  11270. if (state === 0) {
  11271. state = ch === E ? 1 : 0;
  11272. } else if (state === 1) {
  11273. state = ch === I ? 2 : 0;
  11274. } else {
  11275. assert(state === 2);
  11276. if (ch === SPACE || ch === LF || ch === CR) {
  11277. n = 5;
  11278. followingBytes = stream.peekBytes(n);
  11279. for (i = 0; i < n; i++) {
  11280. ch = followingBytes[i];
  11281. if (ch !== LF && ch !== CR && (ch < SPACE || ch > 0x7F)) {
  11282. state = 0;
  11283. break;
  11284. }
  11285. }
  11286. if (state === 2) {
  11287. break;
  11288. }
  11289. } else {
  11290. state = 0;
  11291. }
  11292. }
  11293. }
  11294. return stream.pos - 4 - startPos;
  11295. },
  11296. findDCTDecodeInlineStreamEnd: function Parser_findDCTDecodeInlineStreamEnd(stream) {
  11297. var startPos = stream.pos, foundEOI = false, b, markerLength, length;
  11298. while ((b = stream.getByte()) !== -1) {
  11299. if (b !== 0xFF) {
  11300. continue;
  11301. }
  11302. switch (stream.getByte()) {
  11303. case 0x00:
  11304. break;
  11305. case 0xFF:
  11306. stream.skip(-1);
  11307. break;
  11308. case 0xD9:
  11309. foundEOI = true;
  11310. break;
  11311. case 0xC0:
  11312. case 0xC1:
  11313. case 0xC2:
  11314. case 0xC3:
  11315. case 0xC5:
  11316. case 0xC6:
  11317. case 0xC7:
  11318. case 0xC9:
  11319. case 0xCA:
  11320. case 0xCB:
  11321. case 0xCD:
  11322. case 0xCE:
  11323. case 0xCF:
  11324. case 0xC4:
  11325. case 0xCC:
  11326. case 0xDA:
  11327. case 0xDB:
  11328. case 0xDC:
  11329. case 0xDD:
  11330. case 0xDE:
  11331. case 0xDF:
  11332. case 0xE0:
  11333. case 0xE1:
  11334. case 0xE2:
  11335. case 0xE3:
  11336. case 0xE4:
  11337. case 0xE5:
  11338. case 0xE6:
  11339. case 0xE7:
  11340. case 0xE8:
  11341. case 0xE9:
  11342. case 0xEA:
  11343. case 0xEB:
  11344. case 0xEC:
  11345. case 0xED:
  11346. case 0xEE:
  11347. case 0xEF:
  11348. case 0xFE:
  11349. markerLength = stream.getUint16();
  11350. if (markerLength > 2) {
  11351. stream.skip(markerLength - 2);
  11352. } else {
  11353. stream.skip(-2);
  11354. }
  11355. break;
  11356. }
  11357. if (foundEOI) {
  11358. break;
  11359. }
  11360. }
  11361. length = stream.pos - startPos;
  11362. if (b === -1) {
  11363. warn('Inline DCTDecode image stream: ' + 'EOI marker not found, searching for /EI/ instead.');
  11364. stream.skip(-length);
  11365. return this.findDefaultInlineStreamEnd(stream);
  11366. }
  11367. this.inlineStreamSkipEI(stream);
  11368. return length;
  11369. },
  11370. findASCII85DecodeInlineStreamEnd: function Parser_findASCII85DecodeInlineStreamEnd(stream) {
  11371. var TILDE = 0x7E, GT = 0x3E;
  11372. var startPos = stream.pos, ch, length;
  11373. while ((ch = stream.getByte()) !== -1) {
  11374. if (ch === TILDE && stream.peekByte() === GT) {
  11375. stream.skip();
  11376. break;
  11377. }
  11378. }
  11379. length = stream.pos - startPos;
  11380. if (ch === -1) {
  11381. warn('Inline ASCII85Decode image stream: ' + 'EOD marker not found, searching for /EI/ instead.');
  11382. stream.skip(-length);
  11383. return this.findDefaultInlineStreamEnd(stream);
  11384. }
  11385. this.inlineStreamSkipEI(stream);
  11386. return length;
  11387. },
  11388. findASCIIHexDecodeInlineStreamEnd: function Parser_findASCIIHexDecodeInlineStreamEnd(stream) {
  11389. var GT = 0x3E;
  11390. var startPos = stream.pos, ch, length;
  11391. while ((ch = stream.getByte()) !== -1) {
  11392. if (ch === GT) {
  11393. break;
  11394. }
  11395. }
  11396. length = stream.pos - startPos;
  11397. if (ch === -1) {
  11398. warn('Inline ASCIIHexDecode image stream: ' + 'EOD marker not found, searching for /EI/ instead.');
  11399. stream.skip(-length);
  11400. return this.findDefaultInlineStreamEnd(stream);
  11401. }
  11402. this.inlineStreamSkipEI(stream);
  11403. return length;
  11404. },
  11405. inlineStreamSkipEI: function Parser_inlineStreamSkipEI(stream) {
  11406. var E = 0x45, I = 0x49;
  11407. var state = 0, ch;
  11408. while ((ch = stream.getByte()) !== -1) {
  11409. if (state === 0) {
  11410. state = ch === E ? 1 : 0;
  11411. } else if (state === 1) {
  11412. state = ch === I ? 2 : 0;
  11413. } else if (state === 2) {
  11414. break;
  11415. }
  11416. }
  11417. },
  11418. makeInlineImage: function Parser_makeInlineImage(cipherTransform) {
  11419. var lexer = this.lexer;
  11420. var stream = lexer.stream;
  11421. var dict = new Dict(this.xref);
  11422. while (!isCmd(this.buf1, 'ID') && !isEOF(this.buf1)) {
  11423. if (!isName(this.buf1)) {
  11424. error('Dictionary key must be a name object');
  11425. }
  11426. var key = this.buf1.name;
  11427. this.shift();
  11428. if (isEOF(this.buf1)) {
  11429. break;
  11430. }
  11431. dict.set(key, this.getObj(cipherTransform));
  11432. }
  11433. var filter = dict.get('Filter', 'F'), filterName;
  11434. if (isName(filter)) {
  11435. filterName = filter.name;
  11436. } else if (isArray(filter)) {
  11437. var filterZero = this.xref.fetchIfRef(filter[0]);
  11438. if (isName(filterZero)) {
  11439. filterName = filterZero.name;
  11440. }
  11441. }
  11442. var startPos = stream.pos, length, i, ii;
  11443. if (filterName === 'DCTDecode' || filterName === 'DCT') {
  11444. length = this.findDCTDecodeInlineStreamEnd(stream);
  11445. } else if (filterName === 'ASCII85Decide' || filterName === 'A85') {
  11446. length = this.findASCII85DecodeInlineStreamEnd(stream);
  11447. } else if (filterName === 'ASCIIHexDecode' || filterName === 'AHx') {
  11448. length = this.findASCIIHexDecodeInlineStreamEnd(stream);
  11449. } else {
  11450. length = this.findDefaultInlineStreamEnd(stream);
  11451. }
  11452. var imageStream = stream.makeSubStream(startPos, length, dict);
  11453. var adler32;
  11454. if (length < MAX_LENGTH_TO_CACHE) {
  11455. var imageBytes = imageStream.getBytes();
  11456. imageStream.reset();
  11457. var a = 1;
  11458. var b = 0;
  11459. for (i = 0, ii = imageBytes.length; i < ii; ++i) {
  11460. a += imageBytes[i] & 0xff;
  11461. b += a;
  11462. }
  11463. adler32 = b % 65521 << 16 | a % 65521;
  11464. if (this.imageCache.adler32 === adler32) {
  11465. this.buf2 = Cmd.get('EI');
  11466. this.shift();
  11467. this.imageCache[adler32].reset();
  11468. return this.imageCache[adler32];
  11469. }
  11470. }
  11471. if (cipherTransform) {
  11472. imageStream = cipherTransform.createStream(imageStream, length);
  11473. }
  11474. imageStream = this.filter(imageStream, dict, length);
  11475. imageStream.dict = dict;
  11476. if (adler32 !== undefined) {
  11477. imageStream.cacheKey = 'inline_' + length + '_' + adler32;
  11478. this.imageCache[adler32] = imageStream;
  11479. }
  11480. this.buf2 = Cmd.get('EI');
  11481. this.shift();
  11482. return imageStream;
  11483. },
  11484. makeStream: function Parser_makeStream(dict, cipherTransform) {
  11485. var lexer = this.lexer;
  11486. var stream = lexer.stream;
  11487. lexer.skipToNextLine();
  11488. var pos = stream.pos - 1;
  11489. var length = dict.get('Length');
  11490. if (!isInt(length)) {
  11491. info('Bad ' + length + ' attribute in stream');
  11492. length = 0;
  11493. }
  11494. stream.pos = pos + length;
  11495. lexer.nextChar();
  11496. if (this.tryShift() && isCmd(this.buf2, 'endstream')) {
  11497. this.shift();
  11498. } else {
  11499. stream.pos = pos;
  11500. var SCAN_BLOCK_SIZE = 2048;
  11501. var ENDSTREAM_SIGNATURE_LENGTH = 9;
  11502. var ENDSTREAM_SIGNATURE = [
  11503. 0x65,
  11504. 0x6E,
  11505. 0x64,
  11506. 0x73,
  11507. 0x74,
  11508. 0x72,
  11509. 0x65,
  11510. 0x61,
  11511. 0x6D
  11512. ];
  11513. var skipped = 0, found = false, i, j;
  11514. while (stream.pos < stream.end) {
  11515. var scanBytes = stream.peekBytes(SCAN_BLOCK_SIZE);
  11516. var scanLength = scanBytes.length - ENDSTREAM_SIGNATURE_LENGTH;
  11517. if (scanLength <= 0) {
  11518. break;
  11519. }
  11520. found = false;
  11521. i = 0;
  11522. while (i < scanLength) {
  11523. j = 0;
  11524. while (j < ENDSTREAM_SIGNATURE_LENGTH && scanBytes[i + j] === ENDSTREAM_SIGNATURE[j]) {
  11525. j++;
  11526. }
  11527. if (j >= ENDSTREAM_SIGNATURE_LENGTH) {
  11528. found = true;
  11529. break;
  11530. }
  11531. i++;
  11532. }
  11533. if (found) {
  11534. skipped += i;
  11535. stream.pos += i;
  11536. break;
  11537. }
  11538. skipped += scanLength;
  11539. stream.pos += scanLength;
  11540. }
  11541. if (!found) {
  11542. error('Missing endstream');
  11543. }
  11544. length = skipped;
  11545. lexer.nextChar();
  11546. this.shift();
  11547. this.shift();
  11548. }
  11549. this.shift();
  11550. stream = stream.makeSubStream(pos, length, dict);
  11551. if (cipherTransform) {
  11552. stream = cipherTransform.createStream(stream, length);
  11553. }
  11554. stream = this.filter(stream, dict, length);
  11555. stream.dict = dict;
  11556. return stream;
  11557. },
  11558. filter: function Parser_filter(stream, dict, length) {
  11559. var filter = dict.get('Filter', 'F');
  11560. var params = dict.get('DecodeParms', 'DP');
  11561. if (isName(filter)) {
  11562. if (isArray(params)) {
  11563. params = this.xref.fetchIfRef(params[0]);
  11564. }
  11565. return this.makeFilter(stream, filter.name, length, params);
  11566. }
  11567. var maybeLength = length;
  11568. if (isArray(filter)) {
  11569. var filterArray = filter;
  11570. var paramsArray = params;
  11571. for (var i = 0, ii = filterArray.length; i < ii; ++i) {
  11572. filter = this.xref.fetchIfRef(filterArray[i]);
  11573. if (!isName(filter)) {
  11574. error('Bad filter name: ' + filter);
  11575. }
  11576. params = null;
  11577. if (isArray(paramsArray) && i in paramsArray) {
  11578. params = this.xref.fetchIfRef(paramsArray[i]);
  11579. }
  11580. stream = this.makeFilter(stream, filter.name, maybeLength, params);
  11581. maybeLength = null;
  11582. }
  11583. }
  11584. return stream;
  11585. },
  11586. makeFilter: function Parser_makeFilter(stream, name, maybeLength, params) {
  11587. if (maybeLength === 0) {
  11588. warn('Empty "' + name + '" stream.');
  11589. return new NullStream(stream);
  11590. }
  11591. try {
  11592. var xrefStreamStats = this.xref.stats.streamTypes;
  11593. if (name === 'FlateDecode' || name === 'Fl') {
  11594. xrefStreamStats[StreamType.FLATE] = true;
  11595. if (params) {
  11596. return new PredictorStream(new FlateStream(stream, maybeLength), maybeLength, params);
  11597. }
  11598. return new FlateStream(stream, maybeLength);
  11599. }
  11600. if (name === 'LZWDecode' || name === 'LZW') {
  11601. xrefStreamStats[StreamType.LZW] = true;
  11602. var earlyChange = 1;
  11603. if (params) {
  11604. if (params.has('EarlyChange')) {
  11605. earlyChange = params.get('EarlyChange');
  11606. }
  11607. return new PredictorStream(new LZWStream(stream, maybeLength, earlyChange), maybeLength, params);
  11608. }
  11609. return new LZWStream(stream, maybeLength, earlyChange);
  11610. }
  11611. if (name === 'DCTDecode' || name === 'DCT') {
  11612. xrefStreamStats[StreamType.DCT] = true;
  11613. return new JpegStream(stream, maybeLength, stream.dict, params);
  11614. }
  11615. if (name === 'JPXDecode' || name === 'JPX') {
  11616. xrefStreamStats[StreamType.JPX] = true;
  11617. return new JpxStream(stream, maybeLength, stream.dict, params);
  11618. }
  11619. if (name === 'ASCII85Decode' || name === 'A85') {
  11620. xrefStreamStats[StreamType.A85] = true;
  11621. return new Ascii85Stream(stream, maybeLength);
  11622. }
  11623. if (name === 'ASCIIHexDecode' || name === 'AHx') {
  11624. xrefStreamStats[StreamType.AHX] = true;
  11625. return new AsciiHexStream(stream, maybeLength);
  11626. }
  11627. if (name === 'CCITTFaxDecode' || name === 'CCF') {
  11628. xrefStreamStats[StreamType.CCF] = true;
  11629. return new CCITTFaxStream(stream, maybeLength, params);
  11630. }
  11631. if (name === 'RunLengthDecode' || name === 'RL') {
  11632. xrefStreamStats[StreamType.RL] = true;
  11633. return new RunLengthStream(stream, maybeLength);
  11634. }
  11635. if (name === 'JBIG2Decode') {
  11636. xrefStreamStats[StreamType.JBIG] = true;
  11637. return new Jbig2Stream(stream, maybeLength, stream.dict, params);
  11638. }
  11639. warn('filter "' + name + '" not supported yet');
  11640. return stream;
  11641. } catch (ex) {
  11642. if (ex instanceof MissingDataException) {
  11643. throw ex;
  11644. }
  11645. warn('Invalid stream: \"' + ex + '\"');
  11646. return new NullStream(stream);
  11647. }
  11648. }
  11649. };
  11650. return Parser;
  11651. }();
  11652. var Lexer = function LexerClosure() {
  11653. function Lexer(stream, knownCommands) {
  11654. this.stream = stream;
  11655. this.nextChar();
  11656. this.strBuf = [];
  11657. this.knownCommands = knownCommands;
  11658. }
  11659. var specialChars = [
  11660. 1,
  11661. 0,
  11662. 0,
  11663. 0,
  11664. 0,
  11665. 0,
  11666. 0,
  11667. 0,
  11668. 0,
  11669. 1,
  11670. 1,
  11671. 0,
  11672. 1,
  11673. 1,
  11674. 0,
  11675. 0,
  11676. 0,
  11677. 0,
  11678. 0,
  11679. 0,
  11680. 0,
  11681. 0,
  11682. 0,
  11683. 0,
  11684. 0,
  11685. 0,
  11686. 0,
  11687. 0,
  11688. 0,
  11689. 0,
  11690. 0,
  11691. 0,
  11692. 1,
  11693. 0,
  11694. 0,
  11695. 0,
  11696. 0,
  11697. 2,
  11698. 0,
  11699. 0,
  11700. 2,
  11701. 2,
  11702. 0,
  11703. 0,
  11704. 0,
  11705. 0,
  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. 2,
  11721. 0,
  11722. 2,
  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. 0,
  11737. 0,
  11738. 0,
  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. 2,
  11752. 0,
  11753. 2,
  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. 0,
  11769. 0,
  11770. 0,
  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. 2,
  11784. 0,
  11785. 2,
  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. 0,
  11902. 0,
  11903. 0,
  11904. 0,
  11905. 0,
  11906. 0,
  11907. 0,
  11908. 0,
  11909. 0,
  11910. 0,
  11911. 0,
  11912. 0,
  11913. 0,
  11914. 0,
  11915. 0
  11916. ];
  11917. function toHexDigit(ch) {
  11918. if (ch >= 0x30 && ch <= 0x39) {
  11919. return ch & 0x0F;
  11920. }
  11921. if (ch >= 0x41 && ch <= 0x46 || ch >= 0x61 && ch <= 0x66) {
  11922. return (ch & 0x0F) + 9;
  11923. }
  11924. return -1;
  11925. }
  11926. Lexer.prototype = {
  11927. nextChar: function Lexer_nextChar() {
  11928. return this.currentChar = this.stream.getByte();
  11929. },
  11930. peekChar: function Lexer_peekChar() {
  11931. return this.stream.peekByte();
  11932. },
  11933. getNumber: function Lexer_getNumber() {
  11934. var ch = this.currentChar;
  11935. var eNotation = false;
  11936. var divideBy = 0;
  11937. var sign = 1;
  11938. if (ch === 0x2D) {
  11939. sign = -1;
  11940. ch = this.nextChar();
  11941. if (ch === 0x2D) {
  11942. ch = this.nextChar();
  11943. }
  11944. } else if (ch === 0x2B) {
  11945. ch = this.nextChar();
  11946. }
  11947. if (ch === 0x2E) {
  11948. divideBy = 10;
  11949. ch = this.nextChar();
  11950. }
  11951. if (ch < 0x30 || ch > 0x39) {
  11952. error('Invalid number: ' + String.fromCharCode(ch));
  11953. return 0;
  11954. }
  11955. var baseValue = ch - 0x30;
  11956. var powerValue = 0;
  11957. var powerValueSign = 1;
  11958. while ((ch = this.nextChar()) >= 0) {
  11959. if (0x30 <= ch && ch <= 0x39) {
  11960. var currentDigit = ch - 0x30;
  11961. if (eNotation) {
  11962. powerValue = powerValue * 10 + currentDigit;
  11963. } else {
  11964. if (divideBy !== 0) {
  11965. divideBy *= 10;
  11966. }
  11967. baseValue = baseValue * 10 + currentDigit;
  11968. }
  11969. } else if (ch === 0x2E) {
  11970. if (divideBy === 0) {
  11971. divideBy = 1;
  11972. } else {
  11973. break;
  11974. }
  11975. } else if (ch === 0x2D) {
  11976. warn('Badly formatted number');
  11977. } else if (ch === 0x45 || ch === 0x65) {
  11978. ch = this.peekChar();
  11979. if (ch === 0x2B || ch === 0x2D) {
  11980. powerValueSign = ch === 0x2D ? -1 : 1;
  11981. this.nextChar();
  11982. } else if (ch < 0x30 || ch > 0x39) {
  11983. break;
  11984. }
  11985. eNotation = true;
  11986. } else {
  11987. break;
  11988. }
  11989. }
  11990. if (divideBy !== 0) {
  11991. baseValue /= divideBy;
  11992. }
  11993. if (eNotation) {
  11994. baseValue *= Math.pow(10, powerValueSign * powerValue);
  11995. }
  11996. return sign * baseValue;
  11997. },
  11998. getString: function Lexer_getString() {
  11999. var numParen = 1;
  12000. var done = false;
  12001. var strBuf = this.strBuf;
  12002. strBuf.length = 0;
  12003. var ch = this.nextChar();
  12004. while (true) {
  12005. var charBuffered = false;
  12006. switch (ch | 0) {
  12007. case -1:
  12008. warn('Unterminated string');
  12009. done = true;
  12010. break;
  12011. case 0x28:
  12012. ++numParen;
  12013. strBuf.push('(');
  12014. break;
  12015. case 0x29:
  12016. if (--numParen === 0) {
  12017. this.nextChar();
  12018. done = true;
  12019. } else {
  12020. strBuf.push(')');
  12021. }
  12022. break;
  12023. case 0x5C:
  12024. ch = this.nextChar();
  12025. switch (ch) {
  12026. case -1:
  12027. warn('Unterminated string');
  12028. done = true;
  12029. break;
  12030. case 0x6E:
  12031. strBuf.push('\n');
  12032. break;
  12033. case 0x72:
  12034. strBuf.push('\r');
  12035. break;
  12036. case 0x74:
  12037. strBuf.push('\t');
  12038. break;
  12039. case 0x62:
  12040. strBuf.push('\b');
  12041. break;
  12042. case 0x66:
  12043. strBuf.push('\f');
  12044. break;
  12045. case 0x5C:
  12046. case 0x28:
  12047. case 0x29:
  12048. strBuf.push(String.fromCharCode(ch));
  12049. break;
  12050. case 0x30:
  12051. case 0x31:
  12052. case 0x32:
  12053. case 0x33:
  12054. case 0x34:
  12055. case 0x35:
  12056. case 0x36:
  12057. case 0x37:
  12058. var x = ch & 0x0F;
  12059. ch = this.nextChar();
  12060. charBuffered = true;
  12061. if (ch >= 0x30 && ch <= 0x37) {
  12062. x = (x << 3) + (ch & 0x0F);
  12063. ch = this.nextChar();
  12064. if (ch >= 0x30 && ch <= 0x37) {
  12065. charBuffered = false;
  12066. x = (x << 3) + (ch & 0x0F);
  12067. }
  12068. }
  12069. strBuf.push(String.fromCharCode(x));
  12070. break;
  12071. case 0x0D:
  12072. if (this.peekChar() === 0x0A) {
  12073. this.nextChar();
  12074. }
  12075. break;
  12076. case 0x0A:
  12077. break;
  12078. default:
  12079. strBuf.push(String.fromCharCode(ch));
  12080. break;
  12081. }
  12082. break;
  12083. default:
  12084. strBuf.push(String.fromCharCode(ch));
  12085. break;
  12086. }
  12087. if (done) {
  12088. break;
  12089. }
  12090. if (!charBuffered) {
  12091. ch = this.nextChar();
  12092. }
  12093. }
  12094. return strBuf.join('');
  12095. },
  12096. getName: function Lexer_getName() {
  12097. var ch, previousCh;
  12098. var strBuf = this.strBuf;
  12099. strBuf.length = 0;
  12100. while ((ch = this.nextChar()) >= 0 && !specialChars[ch]) {
  12101. if (ch === 0x23) {
  12102. ch = this.nextChar();
  12103. if (specialChars[ch]) {
  12104. warn('Lexer_getName: ' + 'NUMBER SIGN (#) should be followed by a hexadecimal number.');
  12105. strBuf.push('#');
  12106. break;
  12107. }
  12108. var x = toHexDigit(ch);
  12109. if (x !== -1) {
  12110. previousCh = ch;
  12111. ch = this.nextChar();
  12112. var x2 = toHexDigit(ch);
  12113. if (x2 === -1) {
  12114. warn('Lexer_getName: Illegal digit (' + String.fromCharCode(ch) + ') in hexadecimal number.');
  12115. strBuf.push('#', String.fromCharCode(previousCh));
  12116. if (specialChars[ch]) {
  12117. break;
  12118. }
  12119. strBuf.push(String.fromCharCode(ch));
  12120. continue;
  12121. }
  12122. strBuf.push(String.fromCharCode(x << 4 | x2));
  12123. } else {
  12124. strBuf.push('#', String.fromCharCode(ch));
  12125. }
  12126. } else {
  12127. strBuf.push(String.fromCharCode(ch));
  12128. }
  12129. }
  12130. if (strBuf.length > 127) {
  12131. warn('name token is longer than allowed by the spec: ' + strBuf.length);
  12132. }
  12133. return Name.get(strBuf.join(''));
  12134. },
  12135. getHexString: function Lexer_getHexString() {
  12136. var strBuf = this.strBuf;
  12137. strBuf.length = 0;
  12138. var ch = this.currentChar;
  12139. var isFirstHex = true;
  12140. var firstDigit;
  12141. var secondDigit;
  12142. while (true) {
  12143. if (ch < 0) {
  12144. warn('Unterminated hex string');
  12145. break;
  12146. } else if (ch === 0x3E) {
  12147. this.nextChar();
  12148. break;
  12149. } else if (specialChars[ch] === 1) {
  12150. ch = this.nextChar();
  12151. continue;
  12152. } else {
  12153. if (isFirstHex) {
  12154. firstDigit = toHexDigit(ch);
  12155. if (firstDigit === -1) {
  12156. warn('Ignoring invalid character "' + ch + '" in hex string');
  12157. ch = this.nextChar();
  12158. continue;
  12159. }
  12160. } else {
  12161. secondDigit = toHexDigit(ch);
  12162. if (secondDigit === -1) {
  12163. warn('Ignoring invalid character "' + ch + '" in hex string');
  12164. ch = this.nextChar();
  12165. continue;
  12166. }
  12167. strBuf.push(String.fromCharCode(firstDigit << 4 | secondDigit));
  12168. }
  12169. isFirstHex = !isFirstHex;
  12170. ch = this.nextChar();
  12171. }
  12172. }
  12173. return strBuf.join('');
  12174. },
  12175. getObj: function Lexer_getObj() {
  12176. var comment = false;
  12177. var ch = this.currentChar;
  12178. while (true) {
  12179. if (ch < 0) {
  12180. return EOF;
  12181. }
  12182. if (comment) {
  12183. if (ch === 0x0A || ch === 0x0D) {
  12184. comment = false;
  12185. }
  12186. } else if (ch === 0x25) {
  12187. comment = true;
  12188. } else if (specialChars[ch] !== 1) {
  12189. break;
  12190. }
  12191. ch = this.nextChar();
  12192. }
  12193. switch (ch | 0) {
  12194. case 0x30:
  12195. case 0x31:
  12196. case 0x32:
  12197. case 0x33:
  12198. case 0x34:
  12199. case 0x35:
  12200. case 0x36:
  12201. case 0x37:
  12202. case 0x38:
  12203. case 0x39:
  12204. case 0x2B:
  12205. case 0x2D:
  12206. case 0x2E:
  12207. return this.getNumber();
  12208. case 0x28:
  12209. return this.getString();
  12210. case 0x2F:
  12211. return this.getName();
  12212. case 0x5B:
  12213. this.nextChar();
  12214. return Cmd.get('[');
  12215. case 0x5D:
  12216. this.nextChar();
  12217. return Cmd.get(']');
  12218. case 0x3C:
  12219. ch = this.nextChar();
  12220. if (ch === 0x3C) {
  12221. this.nextChar();
  12222. return Cmd.get('<<');
  12223. }
  12224. return this.getHexString();
  12225. case 0x3E:
  12226. ch = this.nextChar();
  12227. if (ch === 0x3E) {
  12228. this.nextChar();
  12229. return Cmd.get('>>');
  12230. }
  12231. return Cmd.get('>');
  12232. case 0x7B:
  12233. this.nextChar();
  12234. return Cmd.get('{');
  12235. case 0x7D:
  12236. this.nextChar();
  12237. return Cmd.get('}');
  12238. case 0x29:
  12239. this.nextChar();
  12240. error('Illegal character: ' + ch);
  12241. break;
  12242. }
  12243. var str = String.fromCharCode(ch);
  12244. var knownCommands = this.knownCommands;
  12245. var knownCommandFound = knownCommands && knownCommands[str] !== undefined;
  12246. while ((ch = this.nextChar()) >= 0 && !specialChars[ch]) {
  12247. var possibleCommand = str + String.fromCharCode(ch);
  12248. if (knownCommandFound && knownCommands[possibleCommand] === undefined) {
  12249. break;
  12250. }
  12251. if (str.length === 128) {
  12252. error('Command token too long: ' + str.length);
  12253. }
  12254. str = possibleCommand;
  12255. knownCommandFound = knownCommands && knownCommands[str] !== undefined;
  12256. }
  12257. if (str === 'true') {
  12258. return true;
  12259. }
  12260. if (str === 'false') {
  12261. return false;
  12262. }
  12263. if (str === 'null') {
  12264. return null;
  12265. }
  12266. return Cmd.get(str);
  12267. },
  12268. skipToNextLine: function Lexer_skipToNextLine() {
  12269. var ch = this.currentChar;
  12270. while (ch >= 0) {
  12271. if (ch === 0x0D) {
  12272. ch = this.nextChar();
  12273. if (ch === 0x0A) {
  12274. this.nextChar();
  12275. }
  12276. break;
  12277. } else if (ch === 0x0A) {
  12278. this.nextChar();
  12279. break;
  12280. }
  12281. ch = this.nextChar();
  12282. }
  12283. }
  12284. };
  12285. return Lexer;
  12286. }();
  12287. var Linearization = {
  12288. create: function LinearizationCreate(stream) {
  12289. function getInt(name, allowZeroValue) {
  12290. var obj = linDict.get(name);
  12291. if (isInt(obj) && (allowZeroValue ? obj >= 0 : obj > 0)) {
  12292. return obj;
  12293. }
  12294. throw new Error('The "' + name + '" parameter in the linearization ' + 'dictionary is invalid.');
  12295. }
  12296. function getHints() {
  12297. var hints = linDict.get('H'), hintsLength, item;
  12298. if (isArray(hints) && ((hintsLength = hints.length) === 2 || hintsLength === 4)) {
  12299. for (var index = 0; index < hintsLength; index++) {
  12300. if (!(isInt(item = hints[index]) && item > 0)) {
  12301. throw new Error('Hint (' + index + ') in the linearization dictionary is invalid.');
  12302. }
  12303. }
  12304. return hints;
  12305. }
  12306. throw new Error('Hint array in the linearization dictionary is invalid.');
  12307. }
  12308. var parser = new Parser(new Lexer(stream), false, null);
  12309. var obj1 = parser.getObj();
  12310. var obj2 = parser.getObj();
  12311. var obj3 = parser.getObj();
  12312. var linDict = parser.getObj();
  12313. var obj, length;
  12314. if (!(isInt(obj1) && isInt(obj2) && isCmd(obj3, 'obj') && isDict(linDict) && isNum(obj = linDict.get('Linearized')) && obj > 0)) {
  12315. return null;
  12316. } else if ((length = getInt('L')) !== stream.length) {
  12317. throw new Error('The "L" parameter in the linearization dictionary ' + 'does not equal the stream length.');
  12318. }
  12319. return {
  12320. length: length,
  12321. hints: getHints(),
  12322. objectNumberFirst: getInt('O'),
  12323. endFirst: getInt('E'),
  12324. numPages: getInt('N'),
  12325. mainXRefEntriesOffset: getInt('T'),
  12326. pageFirst: linDict.has('P') ? getInt('P', true) : 0
  12327. };
  12328. }
  12329. };
  12330. exports.Lexer = Lexer;
  12331. exports.Linearization = Linearization;
  12332. exports.Parser = Parser;
  12333. /***/ }),
  12334. /* 6 */
  12335. /***/ (function(module, exports, __w_pdfjs_require__) {
  12336. "use strict";
  12337. var sharedUtil = __w_pdfjs_require__(0);
  12338. var corePrimitives = __w_pdfjs_require__(1);
  12339. var corePsParser = __w_pdfjs_require__(34);
  12340. var error = sharedUtil.error;
  12341. var info = sharedUtil.info;
  12342. var isArray = sharedUtil.isArray;
  12343. var isBool = sharedUtil.isBool;
  12344. var isDict = corePrimitives.isDict;
  12345. var isStream = corePrimitives.isStream;
  12346. var PostScriptLexer = corePsParser.PostScriptLexer;
  12347. var PostScriptParser = corePsParser.PostScriptParser;
  12348. var PDFFunction = function PDFFunctionClosure() {
  12349. var CONSTRUCT_SAMPLED = 0;
  12350. var CONSTRUCT_INTERPOLATED = 2;
  12351. var CONSTRUCT_STICHED = 3;
  12352. var CONSTRUCT_POSTSCRIPT = 4;
  12353. return {
  12354. getSampleArray: function PDFFunction_getSampleArray(size, outputSize, bps, str) {
  12355. var i, ii;
  12356. var length = 1;
  12357. for (i = 0, ii = size.length; i < ii; i++) {
  12358. length *= size[i];
  12359. }
  12360. length *= outputSize;
  12361. var array = new Array(length);
  12362. var codeSize = 0;
  12363. var codeBuf = 0;
  12364. var sampleMul = 1.0 / (Math.pow(2.0, bps) - 1);
  12365. var strBytes = str.getBytes((length * bps + 7) / 8);
  12366. var strIdx = 0;
  12367. for (i = 0; i < length; i++) {
  12368. while (codeSize < bps) {
  12369. codeBuf <<= 8;
  12370. codeBuf |= strBytes[strIdx++];
  12371. codeSize += 8;
  12372. }
  12373. codeSize -= bps;
  12374. array[i] = (codeBuf >> codeSize) * sampleMul;
  12375. codeBuf &= (1 << codeSize) - 1;
  12376. }
  12377. return array;
  12378. },
  12379. getIR: function PDFFunction_getIR(xref, fn) {
  12380. var dict = fn.dict;
  12381. if (!dict) {
  12382. dict = fn;
  12383. }
  12384. var types = [
  12385. this.constructSampled,
  12386. null,
  12387. this.constructInterpolated,
  12388. this.constructStiched,
  12389. this.constructPostScript
  12390. ];
  12391. var typeNum = dict.get('FunctionType');
  12392. var typeFn = types[typeNum];
  12393. if (!typeFn) {
  12394. error('Unknown type of function');
  12395. }
  12396. return typeFn.call(this, fn, dict, xref);
  12397. },
  12398. fromIR: function PDFFunction_fromIR(IR) {
  12399. var type = IR[0];
  12400. switch (type) {
  12401. case CONSTRUCT_SAMPLED:
  12402. return this.constructSampledFromIR(IR);
  12403. case CONSTRUCT_INTERPOLATED:
  12404. return this.constructInterpolatedFromIR(IR);
  12405. case CONSTRUCT_STICHED:
  12406. return this.constructStichedFromIR(IR);
  12407. default:
  12408. return this.constructPostScriptFromIR(IR);
  12409. }
  12410. },
  12411. parse: function PDFFunction_parse(xref, fn) {
  12412. var IR = this.getIR(xref, fn);
  12413. return this.fromIR(IR);
  12414. },
  12415. parseArray: function PDFFunction_parseArray(xref, fnObj) {
  12416. if (!isArray(fnObj)) {
  12417. return this.parse(xref, fnObj);
  12418. }
  12419. var fnArray = [];
  12420. for (var j = 0, jj = fnObj.length; j < jj; j++) {
  12421. var obj = xref.fetchIfRef(fnObj[j]);
  12422. fnArray.push(PDFFunction.parse(xref, obj));
  12423. }
  12424. return function (src, srcOffset, dest, destOffset) {
  12425. for (var i = 0, ii = fnArray.length; i < ii; i++) {
  12426. fnArray[i](src, srcOffset, dest, destOffset + i);
  12427. }
  12428. };
  12429. },
  12430. constructSampled: function PDFFunction_constructSampled(str, dict) {
  12431. function toMultiArray(arr) {
  12432. var inputLength = arr.length;
  12433. var out = [];
  12434. var index = 0;
  12435. for (var i = 0; i < inputLength; i += 2) {
  12436. out[index] = [
  12437. arr[i],
  12438. arr[i + 1]
  12439. ];
  12440. ++index;
  12441. }
  12442. return out;
  12443. }
  12444. var domain = dict.getArray('Domain');
  12445. var range = dict.getArray('Range');
  12446. if (!domain || !range) {
  12447. error('No domain or range');
  12448. }
  12449. var inputSize = domain.length / 2;
  12450. var outputSize = range.length / 2;
  12451. domain = toMultiArray(domain);
  12452. range = toMultiArray(range);
  12453. var size = dict.get('Size');
  12454. var bps = dict.get('BitsPerSample');
  12455. var order = dict.get('Order') || 1;
  12456. if (order !== 1) {
  12457. info('No support for cubic spline interpolation: ' + order);
  12458. }
  12459. var encode = dict.getArray('Encode');
  12460. if (!encode) {
  12461. encode = [];
  12462. for (var i = 0; i < inputSize; ++i) {
  12463. encode.push(0);
  12464. encode.push(size[i] - 1);
  12465. }
  12466. }
  12467. encode = toMultiArray(encode);
  12468. var decode = dict.getArray('Decode');
  12469. if (!decode) {
  12470. decode = range;
  12471. } else {
  12472. decode = toMultiArray(decode);
  12473. }
  12474. var samples = this.getSampleArray(size, outputSize, bps, str);
  12475. return [
  12476. CONSTRUCT_SAMPLED,
  12477. inputSize,
  12478. domain,
  12479. encode,
  12480. decode,
  12481. samples,
  12482. size,
  12483. outputSize,
  12484. Math.pow(2, bps) - 1,
  12485. range
  12486. ];
  12487. },
  12488. constructSampledFromIR: function PDFFunction_constructSampledFromIR(IR) {
  12489. function interpolate(x, xmin, xmax, ymin, ymax) {
  12490. return ymin + (x - xmin) * ((ymax - ymin) / (xmax - xmin));
  12491. }
  12492. return function constructSampledFromIRResult(src, srcOffset, dest, destOffset) {
  12493. var m = IR[1];
  12494. var domain = IR[2];
  12495. var encode = IR[3];
  12496. var decode = IR[4];
  12497. var samples = IR[5];
  12498. var size = IR[6];
  12499. var n = IR[7];
  12500. var range = IR[9];
  12501. var cubeVertices = 1 << m;
  12502. var cubeN = new Float64Array(cubeVertices);
  12503. var cubeVertex = new Uint32Array(cubeVertices);
  12504. var i, j;
  12505. for (j = 0; j < cubeVertices; j++) {
  12506. cubeN[j] = 1;
  12507. }
  12508. var k = n, pos = 1;
  12509. for (i = 0; i < m; ++i) {
  12510. var domain_2i = domain[i][0];
  12511. var domain_2i_1 = domain[i][1];
  12512. var xi = Math.min(Math.max(src[srcOffset + i], domain_2i), domain_2i_1);
  12513. var e = interpolate(xi, domain_2i, domain_2i_1, encode[i][0], encode[i][1]);
  12514. var size_i = size[i];
  12515. e = Math.min(Math.max(e, 0), size_i - 1);
  12516. var e0 = e < size_i - 1 ? Math.floor(e) : e - 1;
  12517. var n0 = e0 + 1 - e;
  12518. var n1 = e - e0;
  12519. var offset0 = e0 * k;
  12520. var offset1 = offset0 + k;
  12521. for (j = 0; j < cubeVertices; j++) {
  12522. if (j & pos) {
  12523. cubeN[j] *= n1;
  12524. cubeVertex[j] += offset1;
  12525. } else {
  12526. cubeN[j] *= n0;
  12527. cubeVertex[j] += offset0;
  12528. }
  12529. }
  12530. k *= size_i;
  12531. pos <<= 1;
  12532. }
  12533. for (j = 0; j < n; ++j) {
  12534. var rj = 0;
  12535. for (i = 0; i < cubeVertices; i++) {
  12536. rj += samples[cubeVertex[i] + j] * cubeN[i];
  12537. }
  12538. rj = interpolate(rj, 0, 1, decode[j][0], decode[j][1]);
  12539. dest[destOffset + j] = Math.min(Math.max(rj, range[j][0]), range[j][1]);
  12540. }
  12541. };
  12542. },
  12543. constructInterpolated: function PDFFunction_constructInterpolated(str, dict) {
  12544. var c0 = dict.getArray('C0') || [0];
  12545. var c1 = dict.getArray('C1') || [1];
  12546. var n = dict.get('N');
  12547. if (!isArray(c0) || !isArray(c1)) {
  12548. error('Illegal dictionary for interpolated function');
  12549. }
  12550. var length = c0.length;
  12551. var diff = [];
  12552. for (var i = 0; i < length; ++i) {
  12553. diff.push(c1[i] - c0[i]);
  12554. }
  12555. return [
  12556. CONSTRUCT_INTERPOLATED,
  12557. c0,
  12558. diff,
  12559. n
  12560. ];
  12561. },
  12562. constructInterpolatedFromIR: function PDFFunction_constructInterpolatedFromIR(IR) {
  12563. var c0 = IR[1];
  12564. var diff = IR[2];
  12565. var n = IR[3];
  12566. var length = diff.length;
  12567. return function constructInterpolatedFromIRResult(src, srcOffset, dest, destOffset) {
  12568. var x = n === 1 ? src[srcOffset] : Math.pow(src[srcOffset], n);
  12569. for (var j = 0; j < length; ++j) {
  12570. dest[destOffset + j] = c0[j] + x * diff[j];
  12571. }
  12572. };
  12573. },
  12574. constructStiched: function PDFFunction_constructStiched(fn, dict, xref) {
  12575. var domain = dict.getArray('Domain');
  12576. if (!domain) {
  12577. error('No domain');
  12578. }
  12579. var inputSize = domain.length / 2;
  12580. if (inputSize !== 1) {
  12581. error('Bad domain for stiched function');
  12582. }
  12583. var fnRefs = dict.get('Functions');
  12584. var fns = [];
  12585. for (var i = 0, ii = fnRefs.length; i < ii; ++i) {
  12586. fns.push(PDFFunction.getIR(xref, xref.fetchIfRef(fnRefs[i])));
  12587. }
  12588. var bounds = dict.getArray('Bounds');
  12589. var encode = dict.getArray('Encode');
  12590. return [
  12591. CONSTRUCT_STICHED,
  12592. domain,
  12593. bounds,
  12594. encode,
  12595. fns
  12596. ];
  12597. },
  12598. constructStichedFromIR: function PDFFunction_constructStichedFromIR(IR) {
  12599. var domain = IR[1];
  12600. var bounds = IR[2];
  12601. var encode = IR[3];
  12602. var fnsIR = IR[4];
  12603. var fns = [];
  12604. var tmpBuf = new Float32Array(1);
  12605. for (var i = 0, ii = fnsIR.length; i < ii; i++) {
  12606. fns.push(PDFFunction.fromIR(fnsIR[i]));
  12607. }
  12608. return function constructStichedFromIRResult(src, srcOffset, dest, destOffset) {
  12609. var clip = function constructStichedFromIRClip(v, min, max) {
  12610. if (v > max) {
  12611. v = max;
  12612. } else if (v < min) {
  12613. v = min;
  12614. }
  12615. return v;
  12616. };
  12617. var v = clip(src[srcOffset], domain[0], domain[1]);
  12618. for (var i = 0, ii = bounds.length; i < ii; ++i) {
  12619. if (v < bounds[i]) {
  12620. break;
  12621. }
  12622. }
  12623. var dmin = domain[0];
  12624. if (i > 0) {
  12625. dmin = bounds[i - 1];
  12626. }
  12627. var dmax = domain[1];
  12628. if (i < bounds.length) {
  12629. dmax = bounds[i];
  12630. }
  12631. var rmin = encode[2 * i];
  12632. var rmax = encode[2 * i + 1];
  12633. tmpBuf[0] = dmin === dmax ? rmin : rmin + (v - dmin) * (rmax - rmin) / (dmax - dmin);
  12634. fns[i](tmpBuf, 0, dest, destOffset);
  12635. };
  12636. },
  12637. constructPostScript: function PDFFunction_constructPostScript(fn, dict, xref) {
  12638. var domain = dict.getArray('Domain');
  12639. var range = dict.getArray('Range');
  12640. if (!domain) {
  12641. error('No domain.');
  12642. }
  12643. if (!range) {
  12644. error('No range.');
  12645. }
  12646. var lexer = new PostScriptLexer(fn);
  12647. var parser = new PostScriptParser(lexer);
  12648. var code = parser.parse();
  12649. return [
  12650. CONSTRUCT_POSTSCRIPT,
  12651. domain,
  12652. range,
  12653. code
  12654. ];
  12655. },
  12656. constructPostScriptFromIR: function PDFFunction_constructPostScriptFromIR(IR) {
  12657. var domain = IR[1];
  12658. var range = IR[2];
  12659. var code = IR[3];
  12660. var compiled = new PostScriptCompiler().compile(code, domain, range);
  12661. if (compiled) {
  12662. return new Function('src', 'srcOffset', 'dest', 'destOffset', compiled);
  12663. }
  12664. info('Unable to compile PS function');
  12665. var numOutputs = range.length >> 1;
  12666. var numInputs = domain.length >> 1;
  12667. var evaluator = new PostScriptEvaluator(code);
  12668. var cache = Object.create(null);
  12669. var MAX_CACHE_SIZE = 2048 * 4;
  12670. var cache_available = MAX_CACHE_SIZE;
  12671. var tmpBuf = new Float32Array(numInputs);
  12672. return function constructPostScriptFromIRResult(src, srcOffset, dest, destOffset) {
  12673. var i, value;
  12674. var key = '';
  12675. var input = tmpBuf;
  12676. for (i = 0; i < numInputs; i++) {
  12677. value = src[srcOffset + i];
  12678. input[i] = value;
  12679. key += value + '_';
  12680. }
  12681. var cachedValue = cache[key];
  12682. if (cachedValue !== undefined) {
  12683. dest.set(cachedValue, destOffset);
  12684. return;
  12685. }
  12686. var output = new Float32Array(numOutputs);
  12687. var stack = evaluator.execute(input);
  12688. var stackIndex = stack.length - numOutputs;
  12689. for (i = 0; i < numOutputs; i++) {
  12690. value = stack[stackIndex + i];
  12691. var bound = range[i * 2];
  12692. if (value < bound) {
  12693. value = bound;
  12694. } else {
  12695. bound = range[i * 2 + 1];
  12696. if (value > bound) {
  12697. value = bound;
  12698. }
  12699. }
  12700. output[i] = value;
  12701. }
  12702. if (cache_available > 0) {
  12703. cache_available--;
  12704. cache[key] = output;
  12705. }
  12706. dest.set(output, destOffset);
  12707. };
  12708. }
  12709. };
  12710. }();
  12711. function isPDFFunction(v) {
  12712. var fnDict;
  12713. if (typeof v !== 'object') {
  12714. return false;
  12715. } else if (isDict(v)) {
  12716. fnDict = v;
  12717. } else if (isStream(v)) {
  12718. fnDict = v.dict;
  12719. } else {
  12720. return false;
  12721. }
  12722. return fnDict.has('FunctionType');
  12723. }
  12724. var PostScriptStack = function PostScriptStackClosure() {
  12725. var MAX_STACK_SIZE = 100;
  12726. function PostScriptStack(initialStack) {
  12727. this.stack = !initialStack ? [] : Array.prototype.slice.call(initialStack, 0);
  12728. }
  12729. PostScriptStack.prototype = {
  12730. push: function PostScriptStack_push(value) {
  12731. if (this.stack.length >= MAX_STACK_SIZE) {
  12732. error('PostScript function stack overflow.');
  12733. }
  12734. this.stack.push(value);
  12735. },
  12736. pop: function PostScriptStack_pop() {
  12737. if (this.stack.length <= 0) {
  12738. error('PostScript function stack underflow.');
  12739. }
  12740. return this.stack.pop();
  12741. },
  12742. copy: function PostScriptStack_copy(n) {
  12743. if (this.stack.length + n >= MAX_STACK_SIZE) {
  12744. error('PostScript function stack overflow.');
  12745. }
  12746. var stack = this.stack;
  12747. for (var i = stack.length - n, j = n - 1; j >= 0; j--, i++) {
  12748. stack.push(stack[i]);
  12749. }
  12750. },
  12751. index: function PostScriptStack_index(n) {
  12752. this.push(this.stack[this.stack.length - n - 1]);
  12753. },
  12754. roll: function PostScriptStack_roll(n, p) {
  12755. var stack = this.stack;
  12756. var l = stack.length - n;
  12757. var r = stack.length - 1, c = l + (p - Math.floor(p / n) * n), i, j, t;
  12758. for (i = l, j = r; i < j; i++, j--) {
  12759. t = stack[i];
  12760. stack[i] = stack[j];
  12761. stack[j] = t;
  12762. }
  12763. for (i = l, j = c - 1; i < j; i++, j--) {
  12764. t = stack[i];
  12765. stack[i] = stack[j];
  12766. stack[j] = t;
  12767. }
  12768. for (i = c, j = r; i < j; i++, j--) {
  12769. t = stack[i];
  12770. stack[i] = stack[j];
  12771. stack[j] = t;
  12772. }
  12773. }
  12774. };
  12775. return PostScriptStack;
  12776. }();
  12777. var PostScriptEvaluator = function PostScriptEvaluatorClosure() {
  12778. function PostScriptEvaluator(operators) {
  12779. this.operators = operators;
  12780. }
  12781. PostScriptEvaluator.prototype = {
  12782. execute: function PostScriptEvaluator_execute(initialStack) {
  12783. var stack = new PostScriptStack(initialStack);
  12784. var counter = 0;
  12785. var operators = this.operators;
  12786. var length = operators.length;
  12787. var operator, a, b;
  12788. while (counter < length) {
  12789. operator = operators[counter++];
  12790. if (typeof operator === 'number') {
  12791. stack.push(operator);
  12792. continue;
  12793. }
  12794. switch (operator) {
  12795. case 'jz':
  12796. b = stack.pop();
  12797. a = stack.pop();
  12798. if (!a) {
  12799. counter = b;
  12800. }
  12801. break;
  12802. case 'j':
  12803. a = stack.pop();
  12804. counter = a;
  12805. break;
  12806. case 'abs':
  12807. a = stack.pop();
  12808. stack.push(Math.abs(a));
  12809. break;
  12810. case 'add':
  12811. b = stack.pop();
  12812. a = stack.pop();
  12813. stack.push(a + b);
  12814. break;
  12815. case 'and':
  12816. b = stack.pop();
  12817. a = stack.pop();
  12818. if (isBool(a) && isBool(b)) {
  12819. stack.push(a && b);
  12820. } else {
  12821. stack.push(a & b);
  12822. }
  12823. break;
  12824. case 'atan':
  12825. a = stack.pop();
  12826. stack.push(Math.atan(a));
  12827. break;
  12828. case 'bitshift':
  12829. b = stack.pop();
  12830. a = stack.pop();
  12831. if (a > 0) {
  12832. stack.push(a << b);
  12833. } else {
  12834. stack.push(a >> b);
  12835. }
  12836. break;
  12837. case 'ceiling':
  12838. a = stack.pop();
  12839. stack.push(Math.ceil(a));
  12840. break;
  12841. case 'copy':
  12842. a = stack.pop();
  12843. stack.copy(a);
  12844. break;
  12845. case 'cos':
  12846. a = stack.pop();
  12847. stack.push(Math.cos(a));
  12848. break;
  12849. case 'cvi':
  12850. a = stack.pop() | 0;
  12851. stack.push(a);
  12852. break;
  12853. case 'cvr':
  12854. break;
  12855. case 'div':
  12856. b = stack.pop();
  12857. a = stack.pop();
  12858. stack.push(a / b);
  12859. break;
  12860. case 'dup':
  12861. stack.copy(1);
  12862. break;
  12863. case 'eq':
  12864. b = stack.pop();
  12865. a = stack.pop();
  12866. stack.push(a === b);
  12867. break;
  12868. case 'exch':
  12869. stack.roll(2, 1);
  12870. break;
  12871. case 'exp':
  12872. b = stack.pop();
  12873. a = stack.pop();
  12874. stack.push(Math.pow(a, b));
  12875. break;
  12876. case 'false':
  12877. stack.push(false);
  12878. break;
  12879. case 'floor':
  12880. a = stack.pop();
  12881. stack.push(Math.floor(a));
  12882. break;
  12883. case 'ge':
  12884. b = stack.pop();
  12885. a = stack.pop();
  12886. stack.push(a >= b);
  12887. break;
  12888. case 'gt':
  12889. b = stack.pop();
  12890. a = stack.pop();
  12891. stack.push(a > b);
  12892. break;
  12893. case 'idiv':
  12894. b = stack.pop();
  12895. a = stack.pop();
  12896. stack.push(a / b | 0);
  12897. break;
  12898. case 'index':
  12899. a = stack.pop();
  12900. stack.index(a);
  12901. break;
  12902. case 'le':
  12903. b = stack.pop();
  12904. a = stack.pop();
  12905. stack.push(a <= b);
  12906. break;
  12907. case 'ln':
  12908. a = stack.pop();
  12909. stack.push(Math.log(a));
  12910. break;
  12911. case 'log':
  12912. a = stack.pop();
  12913. stack.push(Math.log(a) / Math.LN10);
  12914. break;
  12915. case 'lt':
  12916. b = stack.pop();
  12917. a = stack.pop();
  12918. stack.push(a < b);
  12919. break;
  12920. case 'mod':
  12921. b = stack.pop();
  12922. a = stack.pop();
  12923. stack.push(a % b);
  12924. break;
  12925. case 'mul':
  12926. b = stack.pop();
  12927. a = stack.pop();
  12928. stack.push(a * b);
  12929. break;
  12930. case 'ne':
  12931. b = stack.pop();
  12932. a = stack.pop();
  12933. stack.push(a !== b);
  12934. break;
  12935. case 'neg':
  12936. a = stack.pop();
  12937. stack.push(-a);
  12938. break;
  12939. case 'not':
  12940. a = stack.pop();
  12941. if (isBool(a)) {
  12942. stack.push(!a);
  12943. } else {
  12944. stack.push(~a);
  12945. }
  12946. break;
  12947. case 'or':
  12948. b = stack.pop();
  12949. a = stack.pop();
  12950. if (isBool(a) && isBool(b)) {
  12951. stack.push(a || b);
  12952. } else {
  12953. stack.push(a | b);
  12954. }
  12955. break;
  12956. case 'pop':
  12957. stack.pop();
  12958. break;
  12959. case 'roll':
  12960. b = stack.pop();
  12961. a = stack.pop();
  12962. stack.roll(a, b);
  12963. break;
  12964. case 'round':
  12965. a = stack.pop();
  12966. stack.push(Math.round(a));
  12967. break;
  12968. case 'sin':
  12969. a = stack.pop();
  12970. stack.push(Math.sin(a));
  12971. break;
  12972. case 'sqrt':
  12973. a = stack.pop();
  12974. stack.push(Math.sqrt(a));
  12975. break;
  12976. case 'sub':
  12977. b = stack.pop();
  12978. a = stack.pop();
  12979. stack.push(a - b);
  12980. break;
  12981. case 'true':
  12982. stack.push(true);
  12983. break;
  12984. case 'truncate':
  12985. a = stack.pop();
  12986. a = a < 0 ? Math.ceil(a) : Math.floor(a);
  12987. stack.push(a);
  12988. break;
  12989. case 'xor':
  12990. b = stack.pop();
  12991. a = stack.pop();
  12992. if (isBool(a) && isBool(b)) {
  12993. stack.push(a !== b);
  12994. } else {
  12995. stack.push(a ^ b);
  12996. }
  12997. break;
  12998. default:
  12999. error('Unknown operator ' + operator);
  13000. break;
  13001. }
  13002. }
  13003. return stack.stack;
  13004. }
  13005. };
  13006. return PostScriptEvaluator;
  13007. }();
  13008. var PostScriptCompiler = function PostScriptCompilerClosure() {
  13009. function AstNode(type) {
  13010. this.type = type;
  13011. }
  13012. AstNode.prototype.visit = function (visitor) {
  13013. throw new Error('abstract method');
  13014. };
  13015. function AstArgument(index, min, max) {
  13016. AstNode.call(this, 'args');
  13017. this.index = index;
  13018. this.min = min;
  13019. this.max = max;
  13020. }
  13021. AstArgument.prototype = Object.create(AstNode.prototype);
  13022. AstArgument.prototype.visit = function (visitor) {
  13023. visitor.visitArgument(this);
  13024. };
  13025. function AstLiteral(number) {
  13026. AstNode.call(this, 'literal');
  13027. this.number = number;
  13028. this.min = number;
  13029. this.max = number;
  13030. }
  13031. AstLiteral.prototype = Object.create(AstNode.prototype);
  13032. AstLiteral.prototype.visit = function (visitor) {
  13033. visitor.visitLiteral(this);
  13034. };
  13035. function AstBinaryOperation(op, arg1, arg2, min, max) {
  13036. AstNode.call(this, 'binary');
  13037. this.op = op;
  13038. this.arg1 = arg1;
  13039. this.arg2 = arg2;
  13040. this.min = min;
  13041. this.max = max;
  13042. }
  13043. AstBinaryOperation.prototype = Object.create(AstNode.prototype);
  13044. AstBinaryOperation.prototype.visit = function (visitor) {
  13045. visitor.visitBinaryOperation(this);
  13046. };
  13047. function AstMin(arg, max) {
  13048. AstNode.call(this, 'max');
  13049. this.arg = arg;
  13050. this.min = arg.min;
  13051. this.max = max;
  13052. }
  13053. AstMin.prototype = Object.create(AstNode.prototype);
  13054. AstMin.prototype.visit = function (visitor) {
  13055. visitor.visitMin(this);
  13056. };
  13057. function AstVariable(index, min, max) {
  13058. AstNode.call(this, 'var');
  13059. this.index = index;
  13060. this.min = min;
  13061. this.max = max;
  13062. }
  13063. AstVariable.prototype = Object.create(AstNode.prototype);
  13064. AstVariable.prototype.visit = function (visitor) {
  13065. visitor.visitVariable(this);
  13066. };
  13067. function AstVariableDefinition(variable, arg) {
  13068. AstNode.call(this, 'definition');
  13069. this.variable = variable;
  13070. this.arg = arg;
  13071. }
  13072. AstVariableDefinition.prototype = Object.create(AstNode.prototype);
  13073. AstVariableDefinition.prototype.visit = function (visitor) {
  13074. visitor.visitVariableDefinition(this);
  13075. };
  13076. function ExpressionBuilderVisitor() {
  13077. this.parts = [];
  13078. }
  13079. ExpressionBuilderVisitor.prototype = {
  13080. visitArgument: function (arg) {
  13081. this.parts.push('Math.max(', arg.min, ', Math.min(', arg.max, ', src[srcOffset + ', arg.index, ']))');
  13082. },
  13083. visitVariable: function (variable) {
  13084. this.parts.push('v', variable.index);
  13085. },
  13086. visitLiteral: function (literal) {
  13087. this.parts.push(literal.number);
  13088. },
  13089. visitBinaryOperation: function (operation) {
  13090. this.parts.push('(');
  13091. operation.arg1.visit(this);
  13092. this.parts.push(' ', operation.op, ' ');
  13093. operation.arg2.visit(this);
  13094. this.parts.push(')');
  13095. },
  13096. visitVariableDefinition: function (definition) {
  13097. this.parts.push('var ');
  13098. definition.variable.visit(this);
  13099. this.parts.push(' = ');
  13100. definition.arg.visit(this);
  13101. this.parts.push(';');
  13102. },
  13103. visitMin: function (max) {
  13104. this.parts.push('Math.min(');
  13105. max.arg.visit(this);
  13106. this.parts.push(', ', max.max, ')');
  13107. },
  13108. toString: function () {
  13109. return this.parts.join('');
  13110. }
  13111. };
  13112. function buildAddOperation(num1, num2) {
  13113. if (num2.type === 'literal' && num2.number === 0) {
  13114. return num1;
  13115. }
  13116. if (num1.type === 'literal' && num1.number === 0) {
  13117. return num2;
  13118. }
  13119. if (num2.type === 'literal' && num1.type === 'literal') {
  13120. return new AstLiteral(num1.number + num2.number);
  13121. }
  13122. return new AstBinaryOperation('+', num1, num2, num1.min + num2.min, num1.max + num2.max);
  13123. }
  13124. function buildMulOperation(num1, num2) {
  13125. if (num2.type === 'literal') {
  13126. if (num2.number === 0) {
  13127. return new AstLiteral(0);
  13128. } else if (num2.number === 1) {
  13129. return num1;
  13130. } else if (num1.type === 'literal') {
  13131. return new AstLiteral(num1.number * num2.number);
  13132. }
  13133. }
  13134. if (num1.type === 'literal') {
  13135. if (num1.number === 0) {
  13136. return new AstLiteral(0);
  13137. } else if (num1.number === 1) {
  13138. return num2;
  13139. }
  13140. }
  13141. var min = Math.min(num1.min * num2.min, num1.min * num2.max, num1.max * num2.min, num1.max * num2.max);
  13142. var max = Math.max(num1.min * num2.min, num1.min * num2.max, num1.max * num2.min, num1.max * num2.max);
  13143. return new AstBinaryOperation('*', num1, num2, min, max);
  13144. }
  13145. function buildSubOperation(num1, num2) {
  13146. if (num2.type === 'literal') {
  13147. if (num2.number === 0) {
  13148. return num1;
  13149. } else if (num1.type === 'literal') {
  13150. return new AstLiteral(num1.number - num2.number);
  13151. }
  13152. }
  13153. if (num2.type === 'binary' && num2.op === '-' && num1.type === 'literal' && num1.number === 1 && num2.arg1.type === 'literal' && num2.arg1.number === 1) {
  13154. return num2.arg2;
  13155. }
  13156. return new AstBinaryOperation('-', num1, num2, num1.min - num2.max, num1.max - num2.min);
  13157. }
  13158. function buildMinOperation(num1, max) {
  13159. if (num1.min >= max) {
  13160. return new AstLiteral(max);
  13161. } else if (num1.max <= max) {
  13162. return num1;
  13163. }
  13164. return new AstMin(num1, max);
  13165. }
  13166. function PostScriptCompiler() {
  13167. }
  13168. PostScriptCompiler.prototype = {
  13169. compile: function PostScriptCompiler_compile(code, domain, range) {
  13170. var stack = [];
  13171. var i, ii;
  13172. var instructions = [];
  13173. var inputSize = domain.length >> 1, outputSize = range.length >> 1;
  13174. var lastRegister = 0;
  13175. var n, j;
  13176. var num1, num2, ast1, ast2, tmpVar, item;
  13177. for (i = 0; i < inputSize; i++) {
  13178. stack.push(new AstArgument(i, domain[i * 2], domain[i * 2 + 1]));
  13179. }
  13180. for (i = 0, ii = code.length; i < ii; i++) {
  13181. item = code[i];
  13182. if (typeof item === 'number') {
  13183. stack.push(new AstLiteral(item));
  13184. continue;
  13185. }
  13186. switch (item) {
  13187. case 'add':
  13188. if (stack.length < 2) {
  13189. return null;
  13190. }
  13191. num2 = stack.pop();
  13192. num1 = stack.pop();
  13193. stack.push(buildAddOperation(num1, num2));
  13194. break;
  13195. case 'cvr':
  13196. if (stack.length < 1) {
  13197. return null;
  13198. }
  13199. break;
  13200. case 'mul':
  13201. if (stack.length < 2) {
  13202. return null;
  13203. }
  13204. num2 = stack.pop();
  13205. num1 = stack.pop();
  13206. stack.push(buildMulOperation(num1, num2));
  13207. break;
  13208. case 'sub':
  13209. if (stack.length < 2) {
  13210. return null;
  13211. }
  13212. num2 = stack.pop();
  13213. num1 = stack.pop();
  13214. stack.push(buildSubOperation(num1, num2));
  13215. break;
  13216. case 'exch':
  13217. if (stack.length < 2) {
  13218. return null;
  13219. }
  13220. ast1 = stack.pop();
  13221. ast2 = stack.pop();
  13222. stack.push(ast1, ast2);
  13223. break;
  13224. case 'pop':
  13225. if (stack.length < 1) {
  13226. return null;
  13227. }
  13228. stack.pop();
  13229. break;
  13230. case 'index':
  13231. if (stack.length < 1) {
  13232. return null;
  13233. }
  13234. num1 = stack.pop();
  13235. if (num1.type !== 'literal') {
  13236. return null;
  13237. }
  13238. n = num1.number;
  13239. if (n < 0 || (n | 0) !== n || stack.length < n) {
  13240. return null;
  13241. }
  13242. ast1 = stack[stack.length - n - 1];
  13243. if (ast1.type === 'literal' || ast1.type === 'var') {
  13244. stack.push(ast1);
  13245. break;
  13246. }
  13247. tmpVar = new AstVariable(lastRegister++, ast1.min, ast1.max);
  13248. stack[stack.length - n - 1] = tmpVar;
  13249. stack.push(tmpVar);
  13250. instructions.push(new AstVariableDefinition(tmpVar, ast1));
  13251. break;
  13252. case 'dup':
  13253. if (stack.length < 1) {
  13254. return null;
  13255. }
  13256. 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]) {
  13257. num1 = stack.pop();
  13258. stack.push(buildMinOperation(num1, code[i + 1]));
  13259. i += 6;
  13260. break;
  13261. }
  13262. ast1 = stack[stack.length - 1];
  13263. if (ast1.type === 'literal' || ast1.type === 'var') {
  13264. stack.push(ast1);
  13265. break;
  13266. }
  13267. tmpVar = new AstVariable(lastRegister++, ast1.min, ast1.max);
  13268. stack[stack.length - 1] = tmpVar;
  13269. stack.push(tmpVar);
  13270. instructions.push(new AstVariableDefinition(tmpVar, ast1));
  13271. break;
  13272. case 'roll':
  13273. if (stack.length < 2) {
  13274. return null;
  13275. }
  13276. num2 = stack.pop();
  13277. num1 = stack.pop();
  13278. if (num2.type !== 'literal' || num1.type !== 'literal') {
  13279. return null;
  13280. }
  13281. j = num2.number;
  13282. n = num1.number;
  13283. if (n <= 0 || (n | 0) !== n || (j | 0) !== j || stack.length < n) {
  13284. return null;
  13285. }
  13286. j = (j % n + n) % n;
  13287. if (j === 0) {
  13288. break;
  13289. }
  13290. Array.prototype.push.apply(stack, stack.splice(stack.length - n, n - j));
  13291. break;
  13292. default:
  13293. return null;
  13294. }
  13295. }
  13296. if (stack.length !== outputSize) {
  13297. return null;
  13298. }
  13299. var result = [];
  13300. instructions.forEach(function (instruction) {
  13301. var statementBuilder = new ExpressionBuilderVisitor();
  13302. instruction.visit(statementBuilder);
  13303. result.push(statementBuilder.toString());
  13304. });
  13305. stack.forEach(function (expr, i) {
  13306. var statementBuilder = new ExpressionBuilderVisitor();
  13307. expr.visit(statementBuilder);
  13308. var min = range[i * 2], max = range[i * 2 + 1];
  13309. var out = [statementBuilder.toString()];
  13310. if (min > expr.min) {
  13311. out.unshift('Math.max(', min, ', ');
  13312. out.push(')');
  13313. }
  13314. if (max < expr.max) {
  13315. out.unshift('Math.min(', max, ', ');
  13316. out.push(')');
  13317. }
  13318. out.unshift('dest[destOffset + ', i, '] = ');
  13319. out.push(';');
  13320. result.push(out.join(''));
  13321. });
  13322. return result.join('\n');
  13323. }
  13324. };
  13325. return PostScriptCompiler;
  13326. }();
  13327. exports.isPDFFunction = isPDFFunction;
  13328. exports.PDFFunction = PDFFunction;
  13329. exports.PostScriptEvaluator = PostScriptEvaluator;
  13330. exports.PostScriptCompiler = PostScriptCompiler;
  13331. /***/ }),
  13332. /* 7 */
  13333. /***/ (function(module, exports, __w_pdfjs_require__) {
  13334. "use strict";
  13335. var sharedUtil = __w_pdfjs_require__(0);
  13336. var getLookupTableFactory = sharedUtil.getLookupTableFactory;
  13337. var getGlyphsUnicode = getLookupTableFactory(function (t) {
  13338. t['A'] = 0x0041;
  13339. t['AE'] = 0x00C6;
  13340. t['AEacute'] = 0x01FC;
  13341. t['AEmacron'] = 0x01E2;
  13342. t['AEsmall'] = 0xF7E6;
  13343. t['Aacute'] = 0x00C1;
  13344. t['Aacutesmall'] = 0xF7E1;
  13345. t['Abreve'] = 0x0102;
  13346. t['Abreveacute'] = 0x1EAE;
  13347. t['Abrevecyrillic'] = 0x04D0;
  13348. t['Abrevedotbelow'] = 0x1EB6;
  13349. t['Abrevegrave'] = 0x1EB0;
  13350. t['Abrevehookabove'] = 0x1EB2;
  13351. t['Abrevetilde'] = 0x1EB4;
  13352. t['Acaron'] = 0x01CD;
  13353. t['Acircle'] = 0x24B6;
  13354. t['Acircumflex'] = 0x00C2;
  13355. t['Acircumflexacute'] = 0x1EA4;
  13356. t['Acircumflexdotbelow'] = 0x1EAC;
  13357. t['Acircumflexgrave'] = 0x1EA6;
  13358. t['Acircumflexhookabove'] = 0x1EA8;
  13359. t['Acircumflexsmall'] = 0xF7E2;
  13360. t['Acircumflextilde'] = 0x1EAA;
  13361. t['Acute'] = 0xF6C9;
  13362. t['Acutesmall'] = 0xF7B4;
  13363. t['Acyrillic'] = 0x0410;
  13364. t['Adblgrave'] = 0x0200;
  13365. t['Adieresis'] = 0x00C4;
  13366. t['Adieresiscyrillic'] = 0x04D2;
  13367. t['Adieresismacron'] = 0x01DE;
  13368. t['Adieresissmall'] = 0xF7E4;
  13369. t['Adotbelow'] = 0x1EA0;
  13370. t['Adotmacron'] = 0x01E0;
  13371. t['Agrave'] = 0x00C0;
  13372. t['Agravesmall'] = 0xF7E0;
  13373. t['Ahookabove'] = 0x1EA2;
  13374. t['Aiecyrillic'] = 0x04D4;
  13375. t['Ainvertedbreve'] = 0x0202;
  13376. t['Alpha'] = 0x0391;
  13377. t['Alphatonos'] = 0x0386;
  13378. t['Amacron'] = 0x0100;
  13379. t['Amonospace'] = 0xFF21;
  13380. t['Aogonek'] = 0x0104;
  13381. t['Aring'] = 0x00C5;
  13382. t['Aringacute'] = 0x01FA;
  13383. t['Aringbelow'] = 0x1E00;
  13384. t['Aringsmall'] = 0xF7E5;
  13385. t['Asmall'] = 0xF761;
  13386. t['Atilde'] = 0x00C3;
  13387. t['Atildesmall'] = 0xF7E3;
  13388. t['Aybarmenian'] = 0x0531;
  13389. t['B'] = 0x0042;
  13390. t['Bcircle'] = 0x24B7;
  13391. t['Bdotaccent'] = 0x1E02;
  13392. t['Bdotbelow'] = 0x1E04;
  13393. t['Becyrillic'] = 0x0411;
  13394. t['Benarmenian'] = 0x0532;
  13395. t['Beta'] = 0x0392;
  13396. t['Bhook'] = 0x0181;
  13397. t['Blinebelow'] = 0x1E06;
  13398. t['Bmonospace'] = 0xFF22;
  13399. t['Brevesmall'] = 0xF6F4;
  13400. t['Bsmall'] = 0xF762;
  13401. t['Btopbar'] = 0x0182;
  13402. t['C'] = 0x0043;
  13403. t['Caarmenian'] = 0x053E;
  13404. t['Cacute'] = 0x0106;
  13405. t['Caron'] = 0xF6CA;
  13406. t['Caronsmall'] = 0xF6F5;
  13407. t['Ccaron'] = 0x010C;
  13408. t['Ccedilla'] = 0x00C7;
  13409. t['Ccedillaacute'] = 0x1E08;
  13410. t['Ccedillasmall'] = 0xF7E7;
  13411. t['Ccircle'] = 0x24B8;
  13412. t['Ccircumflex'] = 0x0108;
  13413. t['Cdot'] = 0x010A;
  13414. t['Cdotaccent'] = 0x010A;
  13415. t['Cedillasmall'] = 0xF7B8;
  13416. t['Chaarmenian'] = 0x0549;
  13417. t['Cheabkhasiancyrillic'] = 0x04BC;
  13418. t['Checyrillic'] = 0x0427;
  13419. t['Chedescenderabkhasiancyrillic'] = 0x04BE;
  13420. t['Chedescendercyrillic'] = 0x04B6;
  13421. t['Chedieresiscyrillic'] = 0x04F4;
  13422. t['Cheharmenian'] = 0x0543;
  13423. t['Chekhakassiancyrillic'] = 0x04CB;
  13424. t['Cheverticalstrokecyrillic'] = 0x04B8;
  13425. t['Chi'] = 0x03A7;
  13426. t['Chook'] = 0x0187;
  13427. t['Circumflexsmall'] = 0xF6F6;
  13428. t['Cmonospace'] = 0xFF23;
  13429. t['Coarmenian'] = 0x0551;
  13430. t['Csmall'] = 0xF763;
  13431. t['D'] = 0x0044;
  13432. t['DZ'] = 0x01F1;
  13433. t['DZcaron'] = 0x01C4;
  13434. t['Daarmenian'] = 0x0534;
  13435. t['Dafrican'] = 0x0189;
  13436. t['Dcaron'] = 0x010E;
  13437. t['Dcedilla'] = 0x1E10;
  13438. t['Dcircle'] = 0x24B9;
  13439. t['Dcircumflexbelow'] = 0x1E12;
  13440. t['Dcroat'] = 0x0110;
  13441. t['Ddotaccent'] = 0x1E0A;
  13442. t['Ddotbelow'] = 0x1E0C;
  13443. t['Decyrillic'] = 0x0414;
  13444. t['Deicoptic'] = 0x03EE;
  13445. t['Delta'] = 0x2206;
  13446. t['Deltagreek'] = 0x0394;
  13447. t['Dhook'] = 0x018A;
  13448. t['Dieresis'] = 0xF6CB;
  13449. t['DieresisAcute'] = 0xF6CC;
  13450. t['DieresisGrave'] = 0xF6CD;
  13451. t['Dieresissmall'] = 0xF7A8;
  13452. t['Digammagreek'] = 0x03DC;
  13453. t['Djecyrillic'] = 0x0402;
  13454. t['Dlinebelow'] = 0x1E0E;
  13455. t['Dmonospace'] = 0xFF24;
  13456. t['Dotaccentsmall'] = 0xF6F7;
  13457. t['Dslash'] = 0x0110;
  13458. t['Dsmall'] = 0xF764;
  13459. t['Dtopbar'] = 0x018B;
  13460. t['Dz'] = 0x01F2;
  13461. t['Dzcaron'] = 0x01C5;
  13462. t['Dzeabkhasiancyrillic'] = 0x04E0;
  13463. t['Dzecyrillic'] = 0x0405;
  13464. t['Dzhecyrillic'] = 0x040F;
  13465. t['E'] = 0x0045;
  13466. t['Eacute'] = 0x00C9;
  13467. t['Eacutesmall'] = 0xF7E9;
  13468. t['Ebreve'] = 0x0114;
  13469. t['Ecaron'] = 0x011A;
  13470. t['Ecedillabreve'] = 0x1E1C;
  13471. t['Echarmenian'] = 0x0535;
  13472. t['Ecircle'] = 0x24BA;
  13473. t['Ecircumflex'] = 0x00CA;
  13474. t['Ecircumflexacute'] = 0x1EBE;
  13475. t['Ecircumflexbelow'] = 0x1E18;
  13476. t['Ecircumflexdotbelow'] = 0x1EC6;
  13477. t['Ecircumflexgrave'] = 0x1EC0;
  13478. t['Ecircumflexhookabove'] = 0x1EC2;
  13479. t['Ecircumflexsmall'] = 0xF7EA;
  13480. t['Ecircumflextilde'] = 0x1EC4;
  13481. t['Ecyrillic'] = 0x0404;
  13482. t['Edblgrave'] = 0x0204;
  13483. t['Edieresis'] = 0x00CB;
  13484. t['Edieresissmall'] = 0xF7EB;
  13485. t['Edot'] = 0x0116;
  13486. t['Edotaccent'] = 0x0116;
  13487. t['Edotbelow'] = 0x1EB8;
  13488. t['Efcyrillic'] = 0x0424;
  13489. t['Egrave'] = 0x00C8;
  13490. t['Egravesmall'] = 0xF7E8;
  13491. t['Eharmenian'] = 0x0537;
  13492. t['Ehookabove'] = 0x1EBA;
  13493. t['Eightroman'] = 0x2167;
  13494. t['Einvertedbreve'] = 0x0206;
  13495. t['Eiotifiedcyrillic'] = 0x0464;
  13496. t['Elcyrillic'] = 0x041B;
  13497. t['Elevenroman'] = 0x216A;
  13498. t['Emacron'] = 0x0112;
  13499. t['Emacronacute'] = 0x1E16;
  13500. t['Emacrongrave'] = 0x1E14;
  13501. t['Emcyrillic'] = 0x041C;
  13502. t['Emonospace'] = 0xFF25;
  13503. t['Encyrillic'] = 0x041D;
  13504. t['Endescendercyrillic'] = 0x04A2;
  13505. t['Eng'] = 0x014A;
  13506. t['Enghecyrillic'] = 0x04A4;
  13507. t['Enhookcyrillic'] = 0x04C7;
  13508. t['Eogonek'] = 0x0118;
  13509. t['Eopen'] = 0x0190;
  13510. t['Epsilon'] = 0x0395;
  13511. t['Epsilontonos'] = 0x0388;
  13512. t['Ercyrillic'] = 0x0420;
  13513. t['Ereversed'] = 0x018E;
  13514. t['Ereversedcyrillic'] = 0x042D;
  13515. t['Escyrillic'] = 0x0421;
  13516. t['Esdescendercyrillic'] = 0x04AA;
  13517. t['Esh'] = 0x01A9;
  13518. t['Esmall'] = 0xF765;
  13519. t['Eta'] = 0x0397;
  13520. t['Etarmenian'] = 0x0538;
  13521. t['Etatonos'] = 0x0389;
  13522. t['Eth'] = 0x00D0;
  13523. t['Ethsmall'] = 0xF7F0;
  13524. t['Etilde'] = 0x1EBC;
  13525. t['Etildebelow'] = 0x1E1A;
  13526. t['Euro'] = 0x20AC;
  13527. t['Ezh'] = 0x01B7;
  13528. t['Ezhcaron'] = 0x01EE;
  13529. t['Ezhreversed'] = 0x01B8;
  13530. t['F'] = 0x0046;
  13531. t['Fcircle'] = 0x24BB;
  13532. t['Fdotaccent'] = 0x1E1E;
  13533. t['Feharmenian'] = 0x0556;
  13534. t['Feicoptic'] = 0x03E4;
  13535. t['Fhook'] = 0x0191;
  13536. t['Fitacyrillic'] = 0x0472;
  13537. t['Fiveroman'] = 0x2164;
  13538. t['Fmonospace'] = 0xFF26;
  13539. t['Fourroman'] = 0x2163;
  13540. t['Fsmall'] = 0xF766;
  13541. t['G'] = 0x0047;
  13542. t['GBsquare'] = 0x3387;
  13543. t['Gacute'] = 0x01F4;
  13544. t['Gamma'] = 0x0393;
  13545. t['Gammaafrican'] = 0x0194;
  13546. t['Gangiacoptic'] = 0x03EA;
  13547. t['Gbreve'] = 0x011E;
  13548. t['Gcaron'] = 0x01E6;
  13549. t['Gcedilla'] = 0x0122;
  13550. t['Gcircle'] = 0x24BC;
  13551. t['Gcircumflex'] = 0x011C;
  13552. t['Gcommaaccent'] = 0x0122;
  13553. t['Gdot'] = 0x0120;
  13554. t['Gdotaccent'] = 0x0120;
  13555. t['Gecyrillic'] = 0x0413;
  13556. t['Ghadarmenian'] = 0x0542;
  13557. t['Ghemiddlehookcyrillic'] = 0x0494;
  13558. t['Ghestrokecyrillic'] = 0x0492;
  13559. t['Gheupturncyrillic'] = 0x0490;
  13560. t['Ghook'] = 0x0193;
  13561. t['Gimarmenian'] = 0x0533;
  13562. t['Gjecyrillic'] = 0x0403;
  13563. t['Gmacron'] = 0x1E20;
  13564. t['Gmonospace'] = 0xFF27;
  13565. t['Grave'] = 0xF6CE;
  13566. t['Gravesmall'] = 0xF760;
  13567. t['Gsmall'] = 0xF767;
  13568. t['Gsmallhook'] = 0x029B;
  13569. t['Gstroke'] = 0x01E4;
  13570. t['H'] = 0x0048;
  13571. t['H18533'] = 0x25CF;
  13572. t['H18543'] = 0x25AA;
  13573. t['H18551'] = 0x25AB;
  13574. t['H22073'] = 0x25A1;
  13575. t['HPsquare'] = 0x33CB;
  13576. t['Haabkhasiancyrillic'] = 0x04A8;
  13577. t['Hadescendercyrillic'] = 0x04B2;
  13578. t['Hardsigncyrillic'] = 0x042A;
  13579. t['Hbar'] = 0x0126;
  13580. t['Hbrevebelow'] = 0x1E2A;
  13581. t['Hcedilla'] = 0x1E28;
  13582. t['Hcircle'] = 0x24BD;
  13583. t['Hcircumflex'] = 0x0124;
  13584. t['Hdieresis'] = 0x1E26;
  13585. t['Hdotaccent'] = 0x1E22;
  13586. t['Hdotbelow'] = 0x1E24;
  13587. t['Hmonospace'] = 0xFF28;
  13588. t['Hoarmenian'] = 0x0540;
  13589. t['Horicoptic'] = 0x03E8;
  13590. t['Hsmall'] = 0xF768;
  13591. t['Hungarumlaut'] = 0xF6CF;
  13592. t['Hungarumlautsmall'] = 0xF6F8;
  13593. t['Hzsquare'] = 0x3390;
  13594. t['I'] = 0x0049;
  13595. t['IAcyrillic'] = 0x042F;
  13596. t['IJ'] = 0x0132;
  13597. t['IUcyrillic'] = 0x042E;
  13598. t['Iacute'] = 0x00CD;
  13599. t['Iacutesmall'] = 0xF7ED;
  13600. t['Ibreve'] = 0x012C;
  13601. t['Icaron'] = 0x01CF;
  13602. t['Icircle'] = 0x24BE;
  13603. t['Icircumflex'] = 0x00CE;
  13604. t['Icircumflexsmall'] = 0xF7EE;
  13605. t['Icyrillic'] = 0x0406;
  13606. t['Idblgrave'] = 0x0208;
  13607. t['Idieresis'] = 0x00CF;
  13608. t['Idieresisacute'] = 0x1E2E;
  13609. t['Idieresiscyrillic'] = 0x04E4;
  13610. t['Idieresissmall'] = 0xF7EF;
  13611. t['Idot'] = 0x0130;
  13612. t['Idotaccent'] = 0x0130;
  13613. t['Idotbelow'] = 0x1ECA;
  13614. t['Iebrevecyrillic'] = 0x04D6;
  13615. t['Iecyrillic'] = 0x0415;
  13616. t['Ifraktur'] = 0x2111;
  13617. t['Igrave'] = 0x00CC;
  13618. t['Igravesmall'] = 0xF7EC;
  13619. t['Ihookabove'] = 0x1EC8;
  13620. t['Iicyrillic'] = 0x0418;
  13621. t['Iinvertedbreve'] = 0x020A;
  13622. t['Iishortcyrillic'] = 0x0419;
  13623. t['Imacron'] = 0x012A;
  13624. t['Imacroncyrillic'] = 0x04E2;
  13625. t['Imonospace'] = 0xFF29;
  13626. t['Iniarmenian'] = 0x053B;
  13627. t['Iocyrillic'] = 0x0401;
  13628. t['Iogonek'] = 0x012E;
  13629. t['Iota'] = 0x0399;
  13630. t['Iotaafrican'] = 0x0196;
  13631. t['Iotadieresis'] = 0x03AA;
  13632. t['Iotatonos'] = 0x038A;
  13633. t['Ismall'] = 0xF769;
  13634. t['Istroke'] = 0x0197;
  13635. t['Itilde'] = 0x0128;
  13636. t['Itildebelow'] = 0x1E2C;
  13637. t['Izhitsacyrillic'] = 0x0474;
  13638. t['Izhitsadblgravecyrillic'] = 0x0476;
  13639. t['J'] = 0x004A;
  13640. t['Jaarmenian'] = 0x0541;
  13641. t['Jcircle'] = 0x24BF;
  13642. t['Jcircumflex'] = 0x0134;
  13643. t['Jecyrillic'] = 0x0408;
  13644. t['Jheharmenian'] = 0x054B;
  13645. t['Jmonospace'] = 0xFF2A;
  13646. t['Jsmall'] = 0xF76A;
  13647. t['K'] = 0x004B;
  13648. t['KBsquare'] = 0x3385;
  13649. t['KKsquare'] = 0x33CD;
  13650. t['Kabashkircyrillic'] = 0x04A0;
  13651. t['Kacute'] = 0x1E30;
  13652. t['Kacyrillic'] = 0x041A;
  13653. t['Kadescendercyrillic'] = 0x049A;
  13654. t['Kahookcyrillic'] = 0x04C3;
  13655. t['Kappa'] = 0x039A;
  13656. t['Kastrokecyrillic'] = 0x049E;
  13657. t['Kaverticalstrokecyrillic'] = 0x049C;
  13658. t['Kcaron'] = 0x01E8;
  13659. t['Kcedilla'] = 0x0136;
  13660. t['Kcircle'] = 0x24C0;
  13661. t['Kcommaaccent'] = 0x0136;
  13662. t['Kdotbelow'] = 0x1E32;
  13663. t['Keharmenian'] = 0x0554;
  13664. t['Kenarmenian'] = 0x053F;
  13665. t['Khacyrillic'] = 0x0425;
  13666. t['Kheicoptic'] = 0x03E6;
  13667. t['Khook'] = 0x0198;
  13668. t['Kjecyrillic'] = 0x040C;
  13669. t['Klinebelow'] = 0x1E34;
  13670. t['Kmonospace'] = 0xFF2B;
  13671. t['Koppacyrillic'] = 0x0480;
  13672. t['Koppagreek'] = 0x03DE;
  13673. t['Ksicyrillic'] = 0x046E;
  13674. t['Ksmall'] = 0xF76B;
  13675. t['L'] = 0x004C;
  13676. t['LJ'] = 0x01C7;
  13677. t['LL'] = 0xF6BF;
  13678. t['Lacute'] = 0x0139;
  13679. t['Lambda'] = 0x039B;
  13680. t['Lcaron'] = 0x013D;
  13681. t['Lcedilla'] = 0x013B;
  13682. t['Lcircle'] = 0x24C1;
  13683. t['Lcircumflexbelow'] = 0x1E3C;
  13684. t['Lcommaaccent'] = 0x013B;
  13685. t['Ldot'] = 0x013F;
  13686. t['Ldotaccent'] = 0x013F;
  13687. t['Ldotbelow'] = 0x1E36;
  13688. t['Ldotbelowmacron'] = 0x1E38;
  13689. t['Liwnarmenian'] = 0x053C;
  13690. t['Lj'] = 0x01C8;
  13691. t['Ljecyrillic'] = 0x0409;
  13692. t['Llinebelow'] = 0x1E3A;
  13693. t['Lmonospace'] = 0xFF2C;
  13694. t['Lslash'] = 0x0141;
  13695. t['Lslashsmall'] = 0xF6F9;
  13696. t['Lsmall'] = 0xF76C;
  13697. t['M'] = 0x004D;
  13698. t['MBsquare'] = 0x3386;
  13699. t['Macron'] = 0xF6D0;
  13700. t['Macronsmall'] = 0xF7AF;
  13701. t['Macute'] = 0x1E3E;
  13702. t['Mcircle'] = 0x24C2;
  13703. t['Mdotaccent'] = 0x1E40;
  13704. t['Mdotbelow'] = 0x1E42;
  13705. t['Menarmenian'] = 0x0544;
  13706. t['Mmonospace'] = 0xFF2D;
  13707. t['Msmall'] = 0xF76D;
  13708. t['Mturned'] = 0x019C;
  13709. t['Mu'] = 0x039C;
  13710. t['N'] = 0x004E;
  13711. t['NJ'] = 0x01CA;
  13712. t['Nacute'] = 0x0143;
  13713. t['Ncaron'] = 0x0147;
  13714. t['Ncedilla'] = 0x0145;
  13715. t['Ncircle'] = 0x24C3;
  13716. t['Ncircumflexbelow'] = 0x1E4A;
  13717. t['Ncommaaccent'] = 0x0145;
  13718. t['Ndotaccent'] = 0x1E44;
  13719. t['Ndotbelow'] = 0x1E46;
  13720. t['Nhookleft'] = 0x019D;
  13721. t['Nineroman'] = 0x2168;
  13722. t['Nj'] = 0x01CB;
  13723. t['Njecyrillic'] = 0x040A;
  13724. t['Nlinebelow'] = 0x1E48;
  13725. t['Nmonospace'] = 0xFF2E;
  13726. t['Nowarmenian'] = 0x0546;
  13727. t['Nsmall'] = 0xF76E;
  13728. t['Ntilde'] = 0x00D1;
  13729. t['Ntildesmall'] = 0xF7F1;
  13730. t['Nu'] = 0x039D;
  13731. t['O'] = 0x004F;
  13732. t['OE'] = 0x0152;
  13733. t['OEsmall'] = 0xF6FA;
  13734. t['Oacute'] = 0x00D3;
  13735. t['Oacutesmall'] = 0xF7F3;
  13736. t['Obarredcyrillic'] = 0x04E8;
  13737. t['Obarreddieresiscyrillic'] = 0x04EA;
  13738. t['Obreve'] = 0x014E;
  13739. t['Ocaron'] = 0x01D1;
  13740. t['Ocenteredtilde'] = 0x019F;
  13741. t['Ocircle'] = 0x24C4;
  13742. t['Ocircumflex'] = 0x00D4;
  13743. t['Ocircumflexacute'] = 0x1ED0;
  13744. t['Ocircumflexdotbelow'] = 0x1ED8;
  13745. t['Ocircumflexgrave'] = 0x1ED2;
  13746. t['Ocircumflexhookabove'] = 0x1ED4;
  13747. t['Ocircumflexsmall'] = 0xF7F4;
  13748. t['Ocircumflextilde'] = 0x1ED6;
  13749. t['Ocyrillic'] = 0x041E;
  13750. t['Odblacute'] = 0x0150;
  13751. t['Odblgrave'] = 0x020C;
  13752. t['Odieresis'] = 0x00D6;
  13753. t['Odieresiscyrillic'] = 0x04E6;
  13754. t['Odieresissmall'] = 0xF7F6;
  13755. t['Odotbelow'] = 0x1ECC;
  13756. t['Ogoneksmall'] = 0xF6FB;
  13757. t['Ograve'] = 0x00D2;
  13758. t['Ogravesmall'] = 0xF7F2;
  13759. t['Oharmenian'] = 0x0555;
  13760. t['Ohm'] = 0x2126;
  13761. t['Ohookabove'] = 0x1ECE;
  13762. t['Ohorn'] = 0x01A0;
  13763. t['Ohornacute'] = 0x1EDA;
  13764. t['Ohorndotbelow'] = 0x1EE2;
  13765. t['Ohorngrave'] = 0x1EDC;
  13766. t['Ohornhookabove'] = 0x1EDE;
  13767. t['Ohorntilde'] = 0x1EE0;
  13768. t['Ohungarumlaut'] = 0x0150;
  13769. t['Oi'] = 0x01A2;
  13770. t['Oinvertedbreve'] = 0x020E;
  13771. t['Omacron'] = 0x014C;
  13772. t['Omacronacute'] = 0x1E52;
  13773. t['Omacrongrave'] = 0x1E50;
  13774. t['Omega'] = 0x2126;
  13775. t['Omegacyrillic'] = 0x0460;
  13776. t['Omegagreek'] = 0x03A9;
  13777. t['Omegaroundcyrillic'] = 0x047A;
  13778. t['Omegatitlocyrillic'] = 0x047C;
  13779. t['Omegatonos'] = 0x038F;
  13780. t['Omicron'] = 0x039F;
  13781. t['Omicrontonos'] = 0x038C;
  13782. t['Omonospace'] = 0xFF2F;
  13783. t['Oneroman'] = 0x2160;
  13784. t['Oogonek'] = 0x01EA;
  13785. t['Oogonekmacron'] = 0x01EC;
  13786. t['Oopen'] = 0x0186;
  13787. t['Oslash'] = 0x00D8;
  13788. t['Oslashacute'] = 0x01FE;
  13789. t['Oslashsmall'] = 0xF7F8;
  13790. t['Osmall'] = 0xF76F;
  13791. t['Ostrokeacute'] = 0x01FE;
  13792. t['Otcyrillic'] = 0x047E;
  13793. t['Otilde'] = 0x00D5;
  13794. t['Otildeacute'] = 0x1E4C;
  13795. t['Otildedieresis'] = 0x1E4E;
  13796. t['Otildesmall'] = 0xF7F5;
  13797. t['P'] = 0x0050;
  13798. t['Pacute'] = 0x1E54;
  13799. t['Pcircle'] = 0x24C5;
  13800. t['Pdotaccent'] = 0x1E56;
  13801. t['Pecyrillic'] = 0x041F;
  13802. t['Peharmenian'] = 0x054A;
  13803. t['Pemiddlehookcyrillic'] = 0x04A6;
  13804. t['Phi'] = 0x03A6;
  13805. t['Phook'] = 0x01A4;
  13806. t['Pi'] = 0x03A0;
  13807. t['Piwrarmenian'] = 0x0553;
  13808. t['Pmonospace'] = 0xFF30;
  13809. t['Psi'] = 0x03A8;
  13810. t['Psicyrillic'] = 0x0470;
  13811. t['Psmall'] = 0xF770;
  13812. t['Q'] = 0x0051;
  13813. t['Qcircle'] = 0x24C6;
  13814. t['Qmonospace'] = 0xFF31;
  13815. t['Qsmall'] = 0xF771;
  13816. t['R'] = 0x0052;
  13817. t['Raarmenian'] = 0x054C;
  13818. t['Racute'] = 0x0154;
  13819. t['Rcaron'] = 0x0158;
  13820. t['Rcedilla'] = 0x0156;
  13821. t['Rcircle'] = 0x24C7;
  13822. t['Rcommaaccent'] = 0x0156;
  13823. t['Rdblgrave'] = 0x0210;
  13824. t['Rdotaccent'] = 0x1E58;
  13825. t['Rdotbelow'] = 0x1E5A;
  13826. t['Rdotbelowmacron'] = 0x1E5C;
  13827. t['Reharmenian'] = 0x0550;
  13828. t['Rfraktur'] = 0x211C;
  13829. t['Rho'] = 0x03A1;
  13830. t['Ringsmall'] = 0xF6FC;
  13831. t['Rinvertedbreve'] = 0x0212;
  13832. t['Rlinebelow'] = 0x1E5E;
  13833. t['Rmonospace'] = 0xFF32;
  13834. t['Rsmall'] = 0xF772;
  13835. t['Rsmallinverted'] = 0x0281;
  13836. t['Rsmallinvertedsuperior'] = 0x02B6;
  13837. t['S'] = 0x0053;
  13838. t['SF010000'] = 0x250C;
  13839. t['SF020000'] = 0x2514;
  13840. t['SF030000'] = 0x2510;
  13841. t['SF040000'] = 0x2518;
  13842. t['SF050000'] = 0x253C;
  13843. t['SF060000'] = 0x252C;
  13844. t['SF070000'] = 0x2534;
  13845. t['SF080000'] = 0x251C;
  13846. t['SF090000'] = 0x2524;
  13847. t['SF100000'] = 0x2500;
  13848. t['SF110000'] = 0x2502;
  13849. t['SF190000'] = 0x2561;
  13850. t['SF200000'] = 0x2562;
  13851. t['SF210000'] = 0x2556;
  13852. t['SF220000'] = 0x2555;
  13853. t['SF230000'] = 0x2563;
  13854. t['SF240000'] = 0x2551;
  13855. t['SF250000'] = 0x2557;
  13856. t['SF260000'] = 0x255D;
  13857. t['SF270000'] = 0x255C;
  13858. t['SF280000'] = 0x255B;
  13859. t['SF360000'] = 0x255E;
  13860. t['SF370000'] = 0x255F;
  13861. t['SF380000'] = 0x255A;
  13862. t['SF390000'] = 0x2554;
  13863. t['SF400000'] = 0x2569;
  13864. t['SF410000'] = 0x2566;
  13865. t['SF420000'] = 0x2560;
  13866. t['SF430000'] = 0x2550;
  13867. t['SF440000'] = 0x256C;
  13868. t['SF450000'] = 0x2567;
  13869. t['SF460000'] = 0x2568;
  13870. t['SF470000'] = 0x2564;
  13871. t['SF480000'] = 0x2565;
  13872. t['SF490000'] = 0x2559;
  13873. t['SF500000'] = 0x2558;
  13874. t['SF510000'] = 0x2552;
  13875. t['SF520000'] = 0x2553;
  13876. t['SF530000'] = 0x256B;
  13877. t['SF540000'] = 0x256A;
  13878. t['Sacute'] = 0x015A;
  13879. t['Sacutedotaccent'] = 0x1E64;
  13880. t['Sampigreek'] = 0x03E0;
  13881. t['Scaron'] = 0x0160;
  13882. t['Scarondotaccent'] = 0x1E66;
  13883. t['Scaronsmall'] = 0xF6FD;
  13884. t['Scedilla'] = 0x015E;
  13885. t['Schwa'] = 0x018F;
  13886. t['Schwacyrillic'] = 0x04D8;
  13887. t['Schwadieresiscyrillic'] = 0x04DA;
  13888. t['Scircle'] = 0x24C8;
  13889. t['Scircumflex'] = 0x015C;
  13890. t['Scommaaccent'] = 0x0218;
  13891. t['Sdotaccent'] = 0x1E60;
  13892. t['Sdotbelow'] = 0x1E62;
  13893. t['Sdotbelowdotaccent'] = 0x1E68;
  13894. t['Seharmenian'] = 0x054D;
  13895. t['Sevenroman'] = 0x2166;
  13896. t['Shaarmenian'] = 0x0547;
  13897. t['Shacyrillic'] = 0x0428;
  13898. t['Shchacyrillic'] = 0x0429;
  13899. t['Sheicoptic'] = 0x03E2;
  13900. t['Shhacyrillic'] = 0x04BA;
  13901. t['Shimacoptic'] = 0x03EC;
  13902. t['Sigma'] = 0x03A3;
  13903. t['Sixroman'] = 0x2165;
  13904. t['Smonospace'] = 0xFF33;
  13905. t['Softsigncyrillic'] = 0x042C;
  13906. t['Ssmall'] = 0xF773;
  13907. t['Stigmagreek'] = 0x03DA;
  13908. t['T'] = 0x0054;
  13909. t['Tau'] = 0x03A4;
  13910. t['Tbar'] = 0x0166;
  13911. t['Tcaron'] = 0x0164;
  13912. t['Tcedilla'] = 0x0162;
  13913. t['Tcircle'] = 0x24C9;
  13914. t['Tcircumflexbelow'] = 0x1E70;
  13915. t['Tcommaaccent'] = 0x0162;
  13916. t['Tdotaccent'] = 0x1E6A;
  13917. t['Tdotbelow'] = 0x1E6C;
  13918. t['Tecyrillic'] = 0x0422;
  13919. t['Tedescendercyrillic'] = 0x04AC;
  13920. t['Tenroman'] = 0x2169;
  13921. t['Tetsecyrillic'] = 0x04B4;
  13922. t['Theta'] = 0x0398;
  13923. t['Thook'] = 0x01AC;
  13924. t['Thorn'] = 0x00DE;
  13925. t['Thornsmall'] = 0xF7FE;
  13926. t['Threeroman'] = 0x2162;
  13927. t['Tildesmall'] = 0xF6FE;
  13928. t['Tiwnarmenian'] = 0x054F;
  13929. t['Tlinebelow'] = 0x1E6E;
  13930. t['Tmonospace'] = 0xFF34;
  13931. t['Toarmenian'] = 0x0539;
  13932. t['Tonefive'] = 0x01BC;
  13933. t['Tonesix'] = 0x0184;
  13934. t['Tonetwo'] = 0x01A7;
  13935. t['Tretroflexhook'] = 0x01AE;
  13936. t['Tsecyrillic'] = 0x0426;
  13937. t['Tshecyrillic'] = 0x040B;
  13938. t['Tsmall'] = 0xF774;
  13939. t['Twelveroman'] = 0x216B;
  13940. t['Tworoman'] = 0x2161;
  13941. t['U'] = 0x0055;
  13942. t['Uacute'] = 0x00DA;
  13943. t['Uacutesmall'] = 0xF7FA;
  13944. t['Ubreve'] = 0x016C;
  13945. t['Ucaron'] = 0x01D3;
  13946. t['Ucircle'] = 0x24CA;
  13947. t['Ucircumflex'] = 0x00DB;
  13948. t['Ucircumflexbelow'] = 0x1E76;
  13949. t['Ucircumflexsmall'] = 0xF7FB;
  13950. t['Ucyrillic'] = 0x0423;
  13951. t['Udblacute'] = 0x0170;
  13952. t['Udblgrave'] = 0x0214;
  13953. t['Udieresis'] = 0x00DC;
  13954. t['Udieresisacute'] = 0x01D7;
  13955. t['Udieresisbelow'] = 0x1E72;
  13956. t['Udieresiscaron'] = 0x01D9;
  13957. t['Udieresiscyrillic'] = 0x04F0;
  13958. t['Udieresisgrave'] = 0x01DB;
  13959. t['Udieresismacron'] = 0x01D5;
  13960. t['Udieresissmall'] = 0xF7FC;
  13961. t['Udotbelow'] = 0x1EE4;
  13962. t['Ugrave'] = 0x00D9;
  13963. t['Ugravesmall'] = 0xF7F9;
  13964. t['Uhookabove'] = 0x1EE6;
  13965. t['Uhorn'] = 0x01AF;
  13966. t['Uhornacute'] = 0x1EE8;
  13967. t['Uhorndotbelow'] = 0x1EF0;
  13968. t['Uhorngrave'] = 0x1EEA;
  13969. t['Uhornhookabove'] = 0x1EEC;
  13970. t['Uhorntilde'] = 0x1EEE;
  13971. t['Uhungarumlaut'] = 0x0170;
  13972. t['Uhungarumlautcyrillic'] = 0x04F2;
  13973. t['Uinvertedbreve'] = 0x0216;
  13974. t['Ukcyrillic'] = 0x0478;
  13975. t['Umacron'] = 0x016A;
  13976. t['Umacroncyrillic'] = 0x04EE;
  13977. t['Umacrondieresis'] = 0x1E7A;
  13978. t['Umonospace'] = 0xFF35;
  13979. t['Uogonek'] = 0x0172;
  13980. t['Upsilon'] = 0x03A5;
  13981. t['Upsilon1'] = 0x03D2;
  13982. t['Upsilonacutehooksymbolgreek'] = 0x03D3;
  13983. t['Upsilonafrican'] = 0x01B1;
  13984. t['Upsilondieresis'] = 0x03AB;
  13985. t['Upsilondieresishooksymbolgreek'] = 0x03D4;
  13986. t['Upsilonhooksymbol'] = 0x03D2;
  13987. t['Upsilontonos'] = 0x038E;
  13988. t['Uring'] = 0x016E;
  13989. t['Ushortcyrillic'] = 0x040E;
  13990. t['Usmall'] = 0xF775;
  13991. t['Ustraightcyrillic'] = 0x04AE;
  13992. t['Ustraightstrokecyrillic'] = 0x04B0;
  13993. t['Utilde'] = 0x0168;
  13994. t['Utildeacute'] = 0x1E78;
  13995. t['Utildebelow'] = 0x1E74;
  13996. t['V'] = 0x0056;
  13997. t['Vcircle'] = 0x24CB;
  13998. t['Vdotbelow'] = 0x1E7E;
  13999. t['Vecyrillic'] = 0x0412;
  14000. t['Vewarmenian'] = 0x054E;
  14001. t['Vhook'] = 0x01B2;
  14002. t['Vmonospace'] = 0xFF36;
  14003. t['Voarmenian'] = 0x0548;
  14004. t['Vsmall'] = 0xF776;
  14005. t['Vtilde'] = 0x1E7C;
  14006. t['W'] = 0x0057;
  14007. t['Wacute'] = 0x1E82;
  14008. t['Wcircle'] = 0x24CC;
  14009. t['Wcircumflex'] = 0x0174;
  14010. t['Wdieresis'] = 0x1E84;
  14011. t['Wdotaccent'] = 0x1E86;
  14012. t['Wdotbelow'] = 0x1E88;
  14013. t['Wgrave'] = 0x1E80;
  14014. t['Wmonospace'] = 0xFF37;
  14015. t['Wsmall'] = 0xF777;
  14016. t['X'] = 0x0058;
  14017. t['Xcircle'] = 0x24CD;
  14018. t['Xdieresis'] = 0x1E8C;
  14019. t['Xdotaccent'] = 0x1E8A;
  14020. t['Xeharmenian'] = 0x053D;
  14021. t['Xi'] = 0x039E;
  14022. t['Xmonospace'] = 0xFF38;
  14023. t['Xsmall'] = 0xF778;
  14024. t['Y'] = 0x0059;
  14025. t['Yacute'] = 0x00DD;
  14026. t['Yacutesmall'] = 0xF7FD;
  14027. t['Yatcyrillic'] = 0x0462;
  14028. t['Ycircle'] = 0x24CE;
  14029. t['Ycircumflex'] = 0x0176;
  14030. t['Ydieresis'] = 0x0178;
  14031. t['Ydieresissmall'] = 0xF7FF;
  14032. t['Ydotaccent'] = 0x1E8E;
  14033. t['Ydotbelow'] = 0x1EF4;
  14034. t['Yericyrillic'] = 0x042B;
  14035. t['Yerudieresiscyrillic'] = 0x04F8;
  14036. t['Ygrave'] = 0x1EF2;
  14037. t['Yhook'] = 0x01B3;
  14038. t['Yhookabove'] = 0x1EF6;
  14039. t['Yiarmenian'] = 0x0545;
  14040. t['Yicyrillic'] = 0x0407;
  14041. t['Yiwnarmenian'] = 0x0552;
  14042. t['Ymonospace'] = 0xFF39;
  14043. t['Ysmall'] = 0xF779;
  14044. t['Ytilde'] = 0x1EF8;
  14045. t['Yusbigcyrillic'] = 0x046A;
  14046. t['Yusbigiotifiedcyrillic'] = 0x046C;
  14047. t['Yuslittlecyrillic'] = 0x0466;
  14048. t['Yuslittleiotifiedcyrillic'] = 0x0468;
  14049. t['Z'] = 0x005A;
  14050. t['Zaarmenian'] = 0x0536;
  14051. t['Zacute'] = 0x0179;
  14052. t['Zcaron'] = 0x017D;
  14053. t['Zcaronsmall'] = 0xF6FF;
  14054. t['Zcircle'] = 0x24CF;
  14055. t['Zcircumflex'] = 0x1E90;
  14056. t['Zdot'] = 0x017B;
  14057. t['Zdotaccent'] = 0x017B;
  14058. t['Zdotbelow'] = 0x1E92;
  14059. t['Zecyrillic'] = 0x0417;
  14060. t['Zedescendercyrillic'] = 0x0498;
  14061. t['Zedieresiscyrillic'] = 0x04DE;
  14062. t['Zeta'] = 0x0396;
  14063. t['Zhearmenian'] = 0x053A;
  14064. t['Zhebrevecyrillic'] = 0x04C1;
  14065. t['Zhecyrillic'] = 0x0416;
  14066. t['Zhedescendercyrillic'] = 0x0496;
  14067. t['Zhedieresiscyrillic'] = 0x04DC;
  14068. t['Zlinebelow'] = 0x1E94;
  14069. t['Zmonospace'] = 0xFF3A;
  14070. t['Zsmall'] = 0xF77A;
  14071. t['Zstroke'] = 0x01B5;
  14072. t['a'] = 0x0061;
  14073. t['aabengali'] = 0x0986;
  14074. t['aacute'] = 0x00E1;
  14075. t['aadeva'] = 0x0906;
  14076. t['aagujarati'] = 0x0A86;
  14077. t['aagurmukhi'] = 0x0A06;
  14078. t['aamatragurmukhi'] = 0x0A3E;
  14079. t['aarusquare'] = 0x3303;
  14080. t['aavowelsignbengali'] = 0x09BE;
  14081. t['aavowelsigndeva'] = 0x093E;
  14082. t['aavowelsigngujarati'] = 0x0ABE;
  14083. t['abbreviationmarkarmenian'] = 0x055F;
  14084. t['abbreviationsigndeva'] = 0x0970;
  14085. t['abengali'] = 0x0985;
  14086. t['abopomofo'] = 0x311A;
  14087. t['abreve'] = 0x0103;
  14088. t['abreveacute'] = 0x1EAF;
  14089. t['abrevecyrillic'] = 0x04D1;
  14090. t['abrevedotbelow'] = 0x1EB7;
  14091. t['abrevegrave'] = 0x1EB1;
  14092. t['abrevehookabove'] = 0x1EB3;
  14093. t['abrevetilde'] = 0x1EB5;
  14094. t['acaron'] = 0x01CE;
  14095. t['acircle'] = 0x24D0;
  14096. t['acircumflex'] = 0x00E2;
  14097. t['acircumflexacute'] = 0x1EA5;
  14098. t['acircumflexdotbelow'] = 0x1EAD;
  14099. t['acircumflexgrave'] = 0x1EA7;
  14100. t['acircumflexhookabove'] = 0x1EA9;
  14101. t['acircumflextilde'] = 0x1EAB;
  14102. t['acute'] = 0x00B4;
  14103. t['acutebelowcmb'] = 0x0317;
  14104. t['acutecmb'] = 0x0301;
  14105. t['acutecomb'] = 0x0301;
  14106. t['acutedeva'] = 0x0954;
  14107. t['acutelowmod'] = 0x02CF;
  14108. t['acutetonecmb'] = 0x0341;
  14109. t['acyrillic'] = 0x0430;
  14110. t['adblgrave'] = 0x0201;
  14111. t['addakgurmukhi'] = 0x0A71;
  14112. t['adeva'] = 0x0905;
  14113. t['adieresis'] = 0x00E4;
  14114. t['adieresiscyrillic'] = 0x04D3;
  14115. t['adieresismacron'] = 0x01DF;
  14116. t['adotbelow'] = 0x1EA1;
  14117. t['adotmacron'] = 0x01E1;
  14118. t['ae'] = 0x00E6;
  14119. t['aeacute'] = 0x01FD;
  14120. t['aekorean'] = 0x3150;
  14121. t['aemacron'] = 0x01E3;
  14122. t['afii00208'] = 0x2015;
  14123. t['afii08941'] = 0x20A4;
  14124. t['afii10017'] = 0x0410;
  14125. t['afii10018'] = 0x0411;
  14126. t['afii10019'] = 0x0412;
  14127. t['afii10020'] = 0x0413;
  14128. t['afii10021'] = 0x0414;
  14129. t['afii10022'] = 0x0415;
  14130. t['afii10023'] = 0x0401;
  14131. t['afii10024'] = 0x0416;
  14132. t['afii10025'] = 0x0417;
  14133. t['afii10026'] = 0x0418;
  14134. t['afii10027'] = 0x0419;
  14135. t['afii10028'] = 0x041A;
  14136. t['afii10029'] = 0x041B;
  14137. t['afii10030'] = 0x041C;
  14138. t['afii10031'] = 0x041D;
  14139. t['afii10032'] = 0x041E;
  14140. t['afii10033'] = 0x041F;
  14141. t['afii10034'] = 0x0420;
  14142. t['afii10035'] = 0x0421;
  14143. t['afii10036'] = 0x0422;
  14144. t['afii10037'] = 0x0423;
  14145. t['afii10038'] = 0x0424;
  14146. t['afii10039'] = 0x0425;
  14147. t['afii10040'] = 0x0426;
  14148. t['afii10041'] = 0x0427;
  14149. t['afii10042'] = 0x0428;
  14150. t['afii10043'] = 0x0429;
  14151. t['afii10044'] = 0x042A;
  14152. t['afii10045'] = 0x042B;
  14153. t['afii10046'] = 0x042C;
  14154. t['afii10047'] = 0x042D;
  14155. t['afii10048'] = 0x042E;
  14156. t['afii10049'] = 0x042F;
  14157. t['afii10050'] = 0x0490;
  14158. t['afii10051'] = 0x0402;
  14159. t['afii10052'] = 0x0403;
  14160. t['afii10053'] = 0x0404;
  14161. t['afii10054'] = 0x0405;
  14162. t['afii10055'] = 0x0406;
  14163. t['afii10056'] = 0x0407;
  14164. t['afii10057'] = 0x0408;
  14165. t['afii10058'] = 0x0409;
  14166. t['afii10059'] = 0x040A;
  14167. t['afii10060'] = 0x040B;
  14168. t['afii10061'] = 0x040C;
  14169. t['afii10062'] = 0x040E;
  14170. t['afii10063'] = 0xF6C4;
  14171. t['afii10064'] = 0xF6C5;
  14172. t['afii10065'] = 0x0430;
  14173. t['afii10066'] = 0x0431;
  14174. t['afii10067'] = 0x0432;
  14175. t['afii10068'] = 0x0433;
  14176. t['afii10069'] = 0x0434;
  14177. t['afii10070'] = 0x0435;
  14178. t['afii10071'] = 0x0451;
  14179. t['afii10072'] = 0x0436;
  14180. t['afii10073'] = 0x0437;
  14181. t['afii10074'] = 0x0438;
  14182. t['afii10075'] = 0x0439;
  14183. t['afii10076'] = 0x043A;
  14184. t['afii10077'] = 0x043B;
  14185. t['afii10078'] = 0x043C;
  14186. t['afii10079'] = 0x043D;
  14187. t['afii10080'] = 0x043E;
  14188. t['afii10081'] = 0x043F;
  14189. t['afii10082'] = 0x0440;
  14190. t['afii10083'] = 0x0441;
  14191. t['afii10084'] = 0x0442;
  14192. t['afii10085'] = 0x0443;
  14193. t['afii10086'] = 0x0444;
  14194. t['afii10087'] = 0x0445;
  14195. t['afii10088'] = 0x0446;
  14196. t['afii10089'] = 0x0447;
  14197. t['afii10090'] = 0x0448;
  14198. t['afii10091'] = 0x0449;
  14199. t['afii10092'] = 0x044A;
  14200. t['afii10093'] = 0x044B;
  14201. t['afii10094'] = 0x044C;
  14202. t['afii10095'] = 0x044D;
  14203. t['afii10096'] = 0x044E;
  14204. t['afii10097'] = 0x044F;
  14205. t['afii10098'] = 0x0491;
  14206. t['afii10099'] = 0x0452;
  14207. t['afii10100'] = 0x0453;
  14208. t['afii10101'] = 0x0454;
  14209. t['afii10102'] = 0x0455;
  14210. t['afii10103'] = 0x0456;
  14211. t['afii10104'] = 0x0457;
  14212. t['afii10105'] = 0x0458;
  14213. t['afii10106'] = 0x0459;
  14214. t['afii10107'] = 0x045A;
  14215. t['afii10108'] = 0x045B;
  14216. t['afii10109'] = 0x045C;
  14217. t['afii10110'] = 0x045E;
  14218. t['afii10145'] = 0x040F;
  14219. t['afii10146'] = 0x0462;
  14220. t['afii10147'] = 0x0472;
  14221. t['afii10148'] = 0x0474;
  14222. t['afii10192'] = 0xF6C6;
  14223. t['afii10193'] = 0x045F;
  14224. t['afii10194'] = 0x0463;
  14225. t['afii10195'] = 0x0473;
  14226. t['afii10196'] = 0x0475;
  14227. t['afii10831'] = 0xF6C7;
  14228. t['afii10832'] = 0xF6C8;
  14229. t['afii10846'] = 0x04D9;
  14230. t['afii299'] = 0x200E;
  14231. t['afii300'] = 0x200F;
  14232. t['afii301'] = 0x200D;
  14233. t['afii57381'] = 0x066A;
  14234. t['afii57388'] = 0x060C;
  14235. t['afii57392'] = 0x0660;
  14236. t['afii57393'] = 0x0661;
  14237. t['afii57394'] = 0x0662;
  14238. t['afii57395'] = 0x0663;
  14239. t['afii57396'] = 0x0664;
  14240. t['afii57397'] = 0x0665;
  14241. t['afii57398'] = 0x0666;
  14242. t['afii57399'] = 0x0667;
  14243. t['afii57400'] = 0x0668;
  14244. t['afii57401'] = 0x0669;
  14245. t['afii57403'] = 0x061B;
  14246. t['afii57407'] = 0x061F;
  14247. t['afii57409'] = 0x0621;
  14248. t['afii57410'] = 0x0622;
  14249. t['afii57411'] = 0x0623;
  14250. t['afii57412'] = 0x0624;
  14251. t['afii57413'] = 0x0625;
  14252. t['afii57414'] = 0x0626;
  14253. t['afii57415'] = 0x0627;
  14254. t['afii57416'] = 0x0628;
  14255. t['afii57417'] = 0x0629;
  14256. t['afii57418'] = 0x062A;
  14257. t['afii57419'] = 0x062B;
  14258. t['afii57420'] = 0x062C;
  14259. t['afii57421'] = 0x062D;
  14260. t['afii57422'] = 0x062E;
  14261. t['afii57423'] = 0x062F;
  14262. t['afii57424'] = 0x0630;
  14263. t['afii57425'] = 0x0631;
  14264. t['afii57426'] = 0x0632;
  14265. t['afii57427'] = 0x0633;
  14266. t['afii57428'] = 0x0634;
  14267. t['afii57429'] = 0x0635;
  14268. t['afii57430'] = 0x0636;
  14269. t['afii57431'] = 0x0637;
  14270. t['afii57432'] = 0x0638;
  14271. t['afii57433'] = 0x0639;
  14272. t['afii57434'] = 0x063A;
  14273. t['afii57440'] = 0x0640;
  14274. t['afii57441'] = 0x0641;
  14275. t['afii57442'] = 0x0642;
  14276. t['afii57443'] = 0x0643;
  14277. t['afii57444'] = 0x0644;
  14278. t['afii57445'] = 0x0645;
  14279. t['afii57446'] = 0x0646;
  14280. t['afii57448'] = 0x0648;
  14281. t['afii57449'] = 0x0649;
  14282. t['afii57450'] = 0x064A;
  14283. t['afii57451'] = 0x064B;
  14284. t['afii57452'] = 0x064C;
  14285. t['afii57453'] = 0x064D;
  14286. t['afii57454'] = 0x064E;
  14287. t['afii57455'] = 0x064F;
  14288. t['afii57456'] = 0x0650;
  14289. t['afii57457'] = 0x0651;
  14290. t['afii57458'] = 0x0652;
  14291. t['afii57470'] = 0x0647;
  14292. t['afii57505'] = 0x06A4;
  14293. t['afii57506'] = 0x067E;
  14294. t['afii57507'] = 0x0686;
  14295. t['afii57508'] = 0x0698;
  14296. t['afii57509'] = 0x06AF;
  14297. t['afii57511'] = 0x0679;
  14298. t['afii57512'] = 0x0688;
  14299. t['afii57513'] = 0x0691;
  14300. t['afii57514'] = 0x06BA;
  14301. t['afii57519'] = 0x06D2;
  14302. t['afii57534'] = 0x06D5;
  14303. t['afii57636'] = 0x20AA;
  14304. t['afii57645'] = 0x05BE;
  14305. t['afii57658'] = 0x05C3;
  14306. t['afii57664'] = 0x05D0;
  14307. t['afii57665'] = 0x05D1;
  14308. t['afii57666'] = 0x05D2;
  14309. t['afii57667'] = 0x05D3;
  14310. t['afii57668'] = 0x05D4;
  14311. t['afii57669'] = 0x05D5;
  14312. t['afii57670'] = 0x05D6;
  14313. t['afii57671'] = 0x05D7;
  14314. t['afii57672'] = 0x05D8;
  14315. t['afii57673'] = 0x05D9;
  14316. t['afii57674'] = 0x05DA;
  14317. t['afii57675'] = 0x05DB;
  14318. t['afii57676'] = 0x05DC;
  14319. t['afii57677'] = 0x05DD;
  14320. t['afii57678'] = 0x05DE;
  14321. t['afii57679'] = 0x05DF;
  14322. t['afii57680'] = 0x05E0;
  14323. t['afii57681'] = 0x05E1;
  14324. t['afii57682'] = 0x05E2;
  14325. t['afii57683'] = 0x05E3;
  14326. t['afii57684'] = 0x05E4;
  14327. t['afii57685'] = 0x05E5;
  14328. t['afii57686'] = 0x05E6;
  14329. t['afii57687'] = 0x05E7;
  14330. t['afii57688'] = 0x05E8;
  14331. t['afii57689'] = 0x05E9;
  14332. t['afii57690'] = 0x05EA;
  14333. t['afii57694'] = 0xFB2A;
  14334. t['afii57695'] = 0xFB2B;
  14335. t['afii57700'] = 0xFB4B;
  14336. t['afii57705'] = 0xFB1F;
  14337. t['afii57716'] = 0x05F0;
  14338. t['afii57717'] = 0x05F1;
  14339. t['afii57718'] = 0x05F2;
  14340. t['afii57723'] = 0xFB35;
  14341. t['afii57793'] = 0x05B4;
  14342. t['afii57794'] = 0x05B5;
  14343. t['afii57795'] = 0x05B6;
  14344. t['afii57796'] = 0x05BB;
  14345. t['afii57797'] = 0x05B8;
  14346. t['afii57798'] = 0x05B7;
  14347. t['afii57799'] = 0x05B0;
  14348. t['afii57800'] = 0x05B2;
  14349. t['afii57801'] = 0x05B1;
  14350. t['afii57802'] = 0x05B3;
  14351. t['afii57803'] = 0x05C2;
  14352. t['afii57804'] = 0x05C1;
  14353. t['afii57806'] = 0x05B9;
  14354. t['afii57807'] = 0x05BC;
  14355. t['afii57839'] = 0x05BD;
  14356. t['afii57841'] = 0x05BF;
  14357. t['afii57842'] = 0x05C0;
  14358. t['afii57929'] = 0x02BC;
  14359. t['afii61248'] = 0x2105;
  14360. t['afii61289'] = 0x2113;
  14361. t['afii61352'] = 0x2116;
  14362. t['afii61573'] = 0x202C;
  14363. t['afii61574'] = 0x202D;
  14364. t['afii61575'] = 0x202E;
  14365. t['afii61664'] = 0x200C;
  14366. t['afii63167'] = 0x066D;
  14367. t['afii64937'] = 0x02BD;
  14368. t['agrave'] = 0x00E0;
  14369. t['agujarati'] = 0x0A85;
  14370. t['agurmukhi'] = 0x0A05;
  14371. t['ahiragana'] = 0x3042;
  14372. t['ahookabove'] = 0x1EA3;
  14373. t['aibengali'] = 0x0990;
  14374. t['aibopomofo'] = 0x311E;
  14375. t['aideva'] = 0x0910;
  14376. t['aiecyrillic'] = 0x04D5;
  14377. t['aigujarati'] = 0x0A90;
  14378. t['aigurmukhi'] = 0x0A10;
  14379. t['aimatragurmukhi'] = 0x0A48;
  14380. t['ainarabic'] = 0x0639;
  14381. t['ainfinalarabic'] = 0xFECA;
  14382. t['aininitialarabic'] = 0xFECB;
  14383. t['ainmedialarabic'] = 0xFECC;
  14384. t['ainvertedbreve'] = 0x0203;
  14385. t['aivowelsignbengali'] = 0x09C8;
  14386. t['aivowelsigndeva'] = 0x0948;
  14387. t['aivowelsigngujarati'] = 0x0AC8;
  14388. t['akatakana'] = 0x30A2;
  14389. t['akatakanahalfwidth'] = 0xFF71;
  14390. t['akorean'] = 0x314F;
  14391. t['alef'] = 0x05D0;
  14392. t['alefarabic'] = 0x0627;
  14393. t['alefdageshhebrew'] = 0xFB30;
  14394. t['aleffinalarabic'] = 0xFE8E;
  14395. t['alefhamzaabovearabic'] = 0x0623;
  14396. t['alefhamzaabovefinalarabic'] = 0xFE84;
  14397. t['alefhamzabelowarabic'] = 0x0625;
  14398. t['alefhamzabelowfinalarabic'] = 0xFE88;
  14399. t['alefhebrew'] = 0x05D0;
  14400. t['aleflamedhebrew'] = 0xFB4F;
  14401. t['alefmaddaabovearabic'] = 0x0622;
  14402. t['alefmaddaabovefinalarabic'] = 0xFE82;
  14403. t['alefmaksuraarabic'] = 0x0649;
  14404. t['alefmaksurafinalarabic'] = 0xFEF0;
  14405. t['alefmaksurainitialarabic'] = 0xFEF3;
  14406. t['alefmaksuramedialarabic'] = 0xFEF4;
  14407. t['alefpatahhebrew'] = 0xFB2E;
  14408. t['alefqamatshebrew'] = 0xFB2F;
  14409. t['aleph'] = 0x2135;
  14410. t['allequal'] = 0x224C;
  14411. t['alpha'] = 0x03B1;
  14412. t['alphatonos'] = 0x03AC;
  14413. t['amacron'] = 0x0101;
  14414. t['amonospace'] = 0xFF41;
  14415. t['ampersand'] = 0x0026;
  14416. t['ampersandmonospace'] = 0xFF06;
  14417. t['ampersandsmall'] = 0xF726;
  14418. t['amsquare'] = 0x33C2;
  14419. t['anbopomofo'] = 0x3122;
  14420. t['angbopomofo'] = 0x3124;
  14421. t['angbracketleft'] = 0x3008;
  14422. t['angbracketright'] = 0x3009;
  14423. t['angkhankhuthai'] = 0x0E5A;
  14424. t['angle'] = 0x2220;
  14425. t['anglebracketleft'] = 0x3008;
  14426. t['anglebracketleftvertical'] = 0xFE3F;
  14427. t['anglebracketright'] = 0x3009;
  14428. t['anglebracketrightvertical'] = 0xFE40;
  14429. t['angleleft'] = 0x2329;
  14430. t['angleright'] = 0x232A;
  14431. t['angstrom'] = 0x212B;
  14432. t['anoteleia'] = 0x0387;
  14433. t['anudattadeva'] = 0x0952;
  14434. t['anusvarabengali'] = 0x0982;
  14435. t['anusvaradeva'] = 0x0902;
  14436. t['anusvaragujarati'] = 0x0A82;
  14437. t['aogonek'] = 0x0105;
  14438. t['apaatosquare'] = 0x3300;
  14439. t['aparen'] = 0x249C;
  14440. t['apostrophearmenian'] = 0x055A;
  14441. t['apostrophemod'] = 0x02BC;
  14442. t['apple'] = 0xF8FF;
  14443. t['approaches'] = 0x2250;
  14444. t['approxequal'] = 0x2248;
  14445. t['approxequalorimage'] = 0x2252;
  14446. t['approximatelyequal'] = 0x2245;
  14447. t['araeaekorean'] = 0x318E;
  14448. t['araeakorean'] = 0x318D;
  14449. t['arc'] = 0x2312;
  14450. t['arighthalfring'] = 0x1E9A;
  14451. t['aring'] = 0x00E5;
  14452. t['aringacute'] = 0x01FB;
  14453. t['aringbelow'] = 0x1E01;
  14454. t['arrowboth'] = 0x2194;
  14455. t['arrowdashdown'] = 0x21E3;
  14456. t['arrowdashleft'] = 0x21E0;
  14457. t['arrowdashright'] = 0x21E2;
  14458. t['arrowdashup'] = 0x21E1;
  14459. t['arrowdblboth'] = 0x21D4;
  14460. t['arrowdbldown'] = 0x21D3;
  14461. t['arrowdblleft'] = 0x21D0;
  14462. t['arrowdblright'] = 0x21D2;
  14463. t['arrowdblup'] = 0x21D1;
  14464. t['arrowdown'] = 0x2193;
  14465. t['arrowdownleft'] = 0x2199;
  14466. t['arrowdownright'] = 0x2198;
  14467. t['arrowdownwhite'] = 0x21E9;
  14468. t['arrowheaddownmod'] = 0x02C5;
  14469. t['arrowheadleftmod'] = 0x02C2;
  14470. t['arrowheadrightmod'] = 0x02C3;
  14471. t['arrowheadupmod'] = 0x02C4;
  14472. t['arrowhorizex'] = 0xF8E7;
  14473. t['arrowleft'] = 0x2190;
  14474. t['arrowleftdbl'] = 0x21D0;
  14475. t['arrowleftdblstroke'] = 0x21CD;
  14476. t['arrowleftoverright'] = 0x21C6;
  14477. t['arrowleftwhite'] = 0x21E6;
  14478. t['arrowright'] = 0x2192;
  14479. t['arrowrightdblstroke'] = 0x21CF;
  14480. t['arrowrightheavy'] = 0x279E;
  14481. t['arrowrightoverleft'] = 0x21C4;
  14482. t['arrowrightwhite'] = 0x21E8;
  14483. t['arrowtableft'] = 0x21E4;
  14484. t['arrowtabright'] = 0x21E5;
  14485. t['arrowup'] = 0x2191;
  14486. t['arrowupdn'] = 0x2195;
  14487. t['arrowupdnbse'] = 0x21A8;
  14488. t['arrowupdownbase'] = 0x21A8;
  14489. t['arrowupleft'] = 0x2196;
  14490. t['arrowupleftofdown'] = 0x21C5;
  14491. t['arrowupright'] = 0x2197;
  14492. t['arrowupwhite'] = 0x21E7;
  14493. t['arrowvertex'] = 0xF8E6;
  14494. t['asciicircum'] = 0x005E;
  14495. t['asciicircummonospace'] = 0xFF3E;
  14496. t['asciitilde'] = 0x007E;
  14497. t['asciitildemonospace'] = 0xFF5E;
  14498. t['ascript'] = 0x0251;
  14499. t['ascriptturned'] = 0x0252;
  14500. t['asmallhiragana'] = 0x3041;
  14501. t['asmallkatakana'] = 0x30A1;
  14502. t['asmallkatakanahalfwidth'] = 0xFF67;
  14503. t['asterisk'] = 0x002A;
  14504. t['asteriskaltonearabic'] = 0x066D;
  14505. t['asteriskarabic'] = 0x066D;
  14506. t['asteriskmath'] = 0x2217;
  14507. t['asteriskmonospace'] = 0xFF0A;
  14508. t['asterisksmall'] = 0xFE61;
  14509. t['asterism'] = 0x2042;
  14510. t['asuperior'] = 0xF6E9;
  14511. t['asymptoticallyequal'] = 0x2243;
  14512. t['at'] = 0x0040;
  14513. t['atilde'] = 0x00E3;
  14514. t['atmonospace'] = 0xFF20;
  14515. t['atsmall'] = 0xFE6B;
  14516. t['aturned'] = 0x0250;
  14517. t['aubengali'] = 0x0994;
  14518. t['aubopomofo'] = 0x3120;
  14519. t['audeva'] = 0x0914;
  14520. t['augujarati'] = 0x0A94;
  14521. t['augurmukhi'] = 0x0A14;
  14522. t['aulengthmarkbengali'] = 0x09D7;
  14523. t['aumatragurmukhi'] = 0x0A4C;
  14524. t['auvowelsignbengali'] = 0x09CC;
  14525. t['auvowelsigndeva'] = 0x094C;
  14526. t['auvowelsigngujarati'] = 0x0ACC;
  14527. t['avagrahadeva'] = 0x093D;
  14528. t['aybarmenian'] = 0x0561;
  14529. t['ayin'] = 0x05E2;
  14530. t['ayinaltonehebrew'] = 0xFB20;
  14531. t['ayinhebrew'] = 0x05E2;
  14532. t['b'] = 0x0062;
  14533. t['babengali'] = 0x09AC;
  14534. t['backslash'] = 0x005C;
  14535. t['backslashmonospace'] = 0xFF3C;
  14536. t['badeva'] = 0x092C;
  14537. t['bagujarati'] = 0x0AAC;
  14538. t['bagurmukhi'] = 0x0A2C;
  14539. t['bahiragana'] = 0x3070;
  14540. t['bahtthai'] = 0x0E3F;
  14541. t['bakatakana'] = 0x30D0;
  14542. t['bar'] = 0x007C;
  14543. t['barmonospace'] = 0xFF5C;
  14544. t['bbopomofo'] = 0x3105;
  14545. t['bcircle'] = 0x24D1;
  14546. t['bdotaccent'] = 0x1E03;
  14547. t['bdotbelow'] = 0x1E05;
  14548. t['beamedsixteenthnotes'] = 0x266C;
  14549. t['because'] = 0x2235;
  14550. t['becyrillic'] = 0x0431;
  14551. t['beharabic'] = 0x0628;
  14552. t['behfinalarabic'] = 0xFE90;
  14553. t['behinitialarabic'] = 0xFE91;
  14554. t['behiragana'] = 0x3079;
  14555. t['behmedialarabic'] = 0xFE92;
  14556. t['behmeeminitialarabic'] = 0xFC9F;
  14557. t['behmeemisolatedarabic'] = 0xFC08;
  14558. t['behnoonfinalarabic'] = 0xFC6D;
  14559. t['bekatakana'] = 0x30D9;
  14560. t['benarmenian'] = 0x0562;
  14561. t['bet'] = 0x05D1;
  14562. t['beta'] = 0x03B2;
  14563. t['betasymbolgreek'] = 0x03D0;
  14564. t['betdagesh'] = 0xFB31;
  14565. t['betdageshhebrew'] = 0xFB31;
  14566. t['bethebrew'] = 0x05D1;
  14567. t['betrafehebrew'] = 0xFB4C;
  14568. t['bhabengali'] = 0x09AD;
  14569. t['bhadeva'] = 0x092D;
  14570. t['bhagujarati'] = 0x0AAD;
  14571. t['bhagurmukhi'] = 0x0A2D;
  14572. t['bhook'] = 0x0253;
  14573. t['bihiragana'] = 0x3073;
  14574. t['bikatakana'] = 0x30D3;
  14575. t['bilabialclick'] = 0x0298;
  14576. t['bindigurmukhi'] = 0x0A02;
  14577. t['birusquare'] = 0x3331;
  14578. t['blackcircle'] = 0x25CF;
  14579. t['blackdiamond'] = 0x25C6;
  14580. t['blackdownpointingtriangle'] = 0x25BC;
  14581. t['blackleftpointingpointer'] = 0x25C4;
  14582. t['blackleftpointingtriangle'] = 0x25C0;
  14583. t['blacklenticularbracketleft'] = 0x3010;
  14584. t['blacklenticularbracketleftvertical'] = 0xFE3B;
  14585. t['blacklenticularbracketright'] = 0x3011;
  14586. t['blacklenticularbracketrightvertical'] = 0xFE3C;
  14587. t['blacklowerlefttriangle'] = 0x25E3;
  14588. t['blacklowerrighttriangle'] = 0x25E2;
  14589. t['blackrectangle'] = 0x25AC;
  14590. t['blackrightpointingpointer'] = 0x25BA;
  14591. t['blackrightpointingtriangle'] = 0x25B6;
  14592. t['blacksmallsquare'] = 0x25AA;
  14593. t['blacksmilingface'] = 0x263B;
  14594. t['blacksquare'] = 0x25A0;
  14595. t['blackstar'] = 0x2605;
  14596. t['blackupperlefttriangle'] = 0x25E4;
  14597. t['blackupperrighttriangle'] = 0x25E5;
  14598. t['blackuppointingsmalltriangle'] = 0x25B4;
  14599. t['blackuppointingtriangle'] = 0x25B2;
  14600. t['blank'] = 0x2423;
  14601. t['blinebelow'] = 0x1E07;
  14602. t['block'] = 0x2588;
  14603. t['bmonospace'] = 0xFF42;
  14604. t['bobaimaithai'] = 0x0E1A;
  14605. t['bohiragana'] = 0x307C;
  14606. t['bokatakana'] = 0x30DC;
  14607. t['bparen'] = 0x249D;
  14608. t['bqsquare'] = 0x33C3;
  14609. t['braceex'] = 0xF8F4;
  14610. t['braceleft'] = 0x007B;
  14611. t['braceleftbt'] = 0xF8F3;
  14612. t['braceleftmid'] = 0xF8F2;
  14613. t['braceleftmonospace'] = 0xFF5B;
  14614. t['braceleftsmall'] = 0xFE5B;
  14615. t['bracelefttp'] = 0xF8F1;
  14616. t['braceleftvertical'] = 0xFE37;
  14617. t['braceright'] = 0x007D;
  14618. t['bracerightbt'] = 0xF8FE;
  14619. t['bracerightmid'] = 0xF8FD;
  14620. t['bracerightmonospace'] = 0xFF5D;
  14621. t['bracerightsmall'] = 0xFE5C;
  14622. t['bracerighttp'] = 0xF8FC;
  14623. t['bracerightvertical'] = 0xFE38;
  14624. t['bracketleft'] = 0x005B;
  14625. t['bracketleftbt'] = 0xF8F0;
  14626. t['bracketleftex'] = 0xF8EF;
  14627. t['bracketleftmonospace'] = 0xFF3B;
  14628. t['bracketlefttp'] = 0xF8EE;
  14629. t['bracketright'] = 0x005D;
  14630. t['bracketrightbt'] = 0xF8FB;
  14631. t['bracketrightex'] = 0xF8FA;
  14632. t['bracketrightmonospace'] = 0xFF3D;
  14633. t['bracketrighttp'] = 0xF8F9;
  14634. t['breve'] = 0x02D8;
  14635. t['brevebelowcmb'] = 0x032E;
  14636. t['brevecmb'] = 0x0306;
  14637. t['breveinvertedbelowcmb'] = 0x032F;
  14638. t['breveinvertedcmb'] = 0x0311;
  14639. t['breveinverteddoublecmb'] = 0x0361;
  14640. t['bridgebelowcmb'] = 0x032A;
  14641. t['bridgeinvertedbelowcmb'] = 0x033A;
  14642. t['brokenbar'] = 0x00A6;
  14643. t['bstroke'] = 0x0180;
  14644. t['bsuperior'] = 0xF6EA;
  14645. t['btopbar'] = 0x0183;
  14646. t['buhiragana'] = 0x3076;
  14647. t['bukatakana'] = 0x30D6;
  14648. t['bullet'] = 0x2022;
  14649. t['bulletinverse'] = 0x25D8;
  14650. t['bulletoperator'] = 0x2219;
  14651. t['bullseye'] = 0x25CE;
  14652. t['c'] = 0x0063;
  14653. t['caarmenian'] = 0x056E;
  14654. t['cabengali'] = 0x099A;
  14655. t['cacute'] = 0x0107;
  14656. t['cadeva'] = 0x091A;
  14657. t['cagujarati'] = 0x0A9A;
  14658. t['cagurmukhi'] = 0x0A1A;
  14659. t['calsquare'] = 0x3388;
  14660. t['candrabindubengali'] = 0x0981;
  14661. t['candrabinducmb'] = 0x0310;
  14662. t['candrabindudeva'] = 0x0901;
  14663. t['candrabindugujarati'] = 0x0A81;
  14664. t['capslock'] = 0x21EA;
  14665. t['careof'] = 0x2105;
  14666. t['caron'] = 0x02C7;
  14667. t['caronbelowcmb'] = 0x032C;
  14668. t['caroncmb'] = 0x030C;
  14669. t['carriagereturn'] = 0x21B5;
  14670. t['cbopomofo'] = 0x3118;
  14671. t['ccaron'] = 0x010D;
  14672. t['ccedilla'] = 0x00E7;
  14673. t['ccedillaacute'] = 0x1E09;
  14674. t['ccircle'] = 0x24D2;
  14675. t['ccircumflex'] = 0x0109;
  14676. t['ccurl'] = 0x0255;
  14677. t['cdot'] = 0x010B;
  14678. t['cdotaccent'] = 0x010B;
  14679. t['cdsquare'] = 0x33C5;
  14680. t['cedilla'] = 0x00B8;
  14681. t['cedillacmb'] = 0x0327;
  14682. t['cent'] = 0x00A2;
  14683. t['centigrade'] = 0x2103;
  14684. t['centinferior'] = 0xF6DF;
  14685. t['centmonospace'] = 0xFFE0;
  14686. t['centoldstyle'] = 0xF7A2;
  14687. t['centsuperior'] = 0xF6E0;
  14688. t['chaarmenian'] = 0x0579;
  14689. t['chabengali'] = 0x099B;
  14690. t['chadeva'] = 0x091B;
  14691. t['chagujarati'] = 0x0A9B;
  14692. t['chagurmukhi'] = 0x0A1B;
  14693. t['chbopomofo'] = 0x3114;
  14694. t['cheabkhasiancyrillic'] = 0x04BD;
  14695. t['checkmark'] = 0x2713;
  14696. t['checyrillic'] = 0x0447;
  14697. t['chedescenderabkhasiancyrillic'] = 0x04BF;
  14698. t['chedescendercyrillic'] = 0x04B7;
  14699. t['chedieresiscyrillic'] = 0x04F5;
  14700. t['cheharmenian'] = 0x0573;
  14701. t['chekhakassiancyrillic'] = 0x04CC;
  14702. t['cheverticalstrokecyrillic'] = 0x04B9;
  14703. t['chi'] = 0x03C7;
  14704. t['chieuchacirclekorean'] = 0x3277;
  14705. t['chieuchaparenkorean'] = 0x3217;
  14706. t['chieuchcirclekorean'] = 0x3269;
  14707. t['chieuchkorean'] = 0x314A;
  14708. t['chieuchparenkorean'] = 0x3209;
  14709. t['chochangthai'] = 0x0E0A;
  14710. t['chochanthai'] = 0x0E08;
  14711. t['chochingthai'] = 0x0E09;
  14712. t['chochoethai'] = 0x0E0C;
  14713. t['chook'] = 0x0188;
  14714. t['cieucacirclekorean'] = 0x3276;
  14715. t['cieucaparenkorean'] = 0x3216;
  14716. t['cieuccirclekorean'] = 0x3268;
  14717. t['cieuckorean'] = 0x3148;
  14718. t['cieucparenkorean'] = 0x3208;
  14719. t['cieucuparenkorean'] = 0x321C;
  14720. t['circle'] = 0x25CB;
  14721. t['circlecopyrt'] = 0x00A9;
  14722. t['circlemultiply'] = 0x2297;
  14723. t['circleot'] = 0x2299;
  14724. t['circleplus'] = 0x2295;
  14725. t['circlepostalmark'] = 0x3036;
  14726. t['circlewithlefthalfblack'] = 0x25D0;
  14727. t['circlewithrighthalfblack'] = 0x25D1;
  14728. t['circumflex'] = 0x02C6;
  14729. t['circumflexbelowcmb'] = 0x032D;
  14730. t['circumflexcmb'] = 0x0302;
  14731. t['clear'] = 0x2327;
  14732. t['clickalveolar'] = 0x01C2;
  14733. t['clickdental'] = 0x01C0;
  14734. t['clicklateral'] = 0x01C1;
  14735. t['clickretroflex'] = 0x01C3;
  14736. t['club'] = 0x2663;
  14737. t['clubsuitblack'] = 0x2663;
  14738. t['clubsuitwhite'] = 0x2667;
  14739. t['cmcubedsquare'] = 0x33A4;
  14740. t['cmonospace'] = 0xFF43;
  14741. t['cmsquaredsquare'] = 0x33A0;
  14742. t['coarmenian'] = 0x0581;
  14743. t['colon'] = 0x003A;
  14744. t['colonmonetary'] = 0x20A1;
  14745. t['colonmonospace'] = 0xFF1A;
  14746. t['colonsign'] = 0x20A1;
  14747. t['colonsmall'] = 0xFE55;
  14748. t['colontriangularhalfmod'] = 0x02D1;
  14749. t['colontriangularmod'] = 0x02D0;
  14750. t['comma'] = 0x002C;
  14751. t['commaabovecmb'] = 0x0313;
  14752. t['commaaboverightcmb'] = 0x0315;
  14753. t['commaaccent'] = 0xF6C3;
  14754. t['commaarabic'] = 0x060C;
  14755. t['commaarmenian'] = 0x055D;
  14756. t['commainferior'] = 0xF6E1;
  14757. t['commamonospace'] = 0xFF0C;
  14758. t['commareversedabovecmb'] = 0x0314;
  14759. t['commareversedmod'] = 0x02BD;
  14760. t['commasmall'] = 0xFE50;
  14761. t['commasuperior'] = 0xF6E2;
  14762. t['commaturnedabovecmb'] = 0x0312;
  14763. t['commaturnedmod'] = 0x02BB;
  14764. t['compass'] = 0x263C;
  14765. t['congruent'] = 0x2245;
  14766. t['contourintegral'] = 0x222E;
  14767. t['control'] = 0x2303;
  14768. t['controlACK'] = 0x0006;
  14769. t['controlBEL'] = 0x0007;
  14770. t['controlBS'] = 0x0008;
  14771. t['controlCAN'] = 0x0018;
  14772. t['controlCR'] = 0x000D;
  14773. t['controlDC1'] = 0x0011;
  14774. t['controlDC2'] = 0x0012;
  14775. t['controlDC3'] = 0x0013;
  14776. t['controlDC4'] = 0x0014;
  14777. t['controlDEL'] = 0x007F;
  14778. t['controlDLE'] = 0x0010;
  14779. t['controlEM'] = 0x0019;
  14780. t['controlENQ'] = 0x0005;
  14781. t['controlEOT'] = 0x0004;
  14782. t['controlESC'] = 0x001B;
  14783. t['controlETB'] = 0x0017;
  14784. t['controlETX'] = 0x0003;
  14785. t['controlFF'] = 0x000C;
  14786. t['controlFS'] = 0x001C;
  14787. t['controlGS'] = 0x001D;
  14788. t['controlHT'] = 0x0009;
  14789. t['controlLF'] = 0x000A;
  14790. t['controlNAK'] = 0x0015;
  14791. t['controlNULL'] = 0x0000;
  14792. t['controlRS'] = 0x001E;
  14793. t['controlSI'] = 0x000F;
  14794. t['controlSO'] = 0x000E;
  14795. t['controlSOT'] = 0x0002;
  14796. t['controlSTX'] = 0x0001;
  14797. t['controlSUB'] = 0x001A;
  14798. t['controlSYN'] = 0x0016;
  14799. t['controlUS'] = 0x001F;
  14800. t['controlVT'] = 0x000B;
  14801. t['copyright'] = 0x00A9;
  14802. t['copyrightsans'] = 0xF8E9;
  14803. t['copyrightserif'] = 0xF6D9;
  14804. t['cornerbracketleft'] = 0x300C;
  14805. t['cornerbracketlefthalfwidth'] = 0xFF62;
  14806. t['cornerbracketleftvertical'] = 0xFE41;
  14807. t['cornerbracketright'] = 0x300D;
  14808. t['cornerbracketrighthalfwidth'] = 0xFF63;
  14809. t['cornerbracketrightvertical'] = 0xFE42;
  14810. t['corporationsquare'] = 0x337F;
  14811. t['cosquare'] = 0x33C7;
  14812. t['coverkgsquare'] = 0x33C6;
  14813. t['cparen'] = 0x249E;
  14814. t['cruzeiro'] = 0x20A2;
  14815. t['cstretched'] = 0x0297;
  14816. t['curlyand'] = 0x22CF;
  14817. t['curlyor'] = 0x22CE;
  14818. t['currency'] = 0x00A4;
  14819. t['cyrBreve'] = 0xF6D1;
  14820. t['cyrFlex'] = 0xF6D2;
  14821. t['cyrbreve'] = 0xF6D4;
  14822. t['cyrflex'] = 0xF6D5;
  14823. t['d'] = 0x0064;
  14824. t['daarmenian'] = 0x0564;
  14825. t['dabengali'] = 0x09A6;
  14826. t['dadarabic'] = 0x0636;
  14827. t['dadeva'] = 0x0926;
  14828. t['dadfinalarabic'] = 0xFEBE;
  14829. t['dadinitialarabic'] = 0xFEBF;
  14830. t['dadmedialarabic'] = 0xFEC0;
  14831. t['dagesh'] = 0x05BC;
  14832. t['dageshhebrew'] = 0x05BC;
  14833. t['dagger'] = 0x2020;
  14834. t['daggerdbl'] = 0x2021;
  14835. t['dagujarati'] = 0x0AA6;
  14836. t['dagurmukhi'] = 0x0A26;
  14837. t['dahiragana'] = 0x3060;
  14838. t['dakatakana'] = 0x30C0;
  14839. t['dalarabic'] = 0x062F;
  14840. t['dalet'] = 0x05D3;
  14841. t['daletdagesh'] = 0xFB33;
  14842. t['daletdageshhebrew'] = 0xFB33;
  14843. t['dalethebrew'] = 0x05D3;
  14844. t['dalfinalarabic'] = 0xFEAA;
  14845. t['dammaarabic'] = 0x064F;
  14846. t['dammalowarabic'] = 0x064F;
  14847. t['dammatanaltonearabic'] = 0x064C;
  14848. t['dammatanarabic'] = 0x064C;
  14849. t['danda'] = 0x0964;
  14850. t['dargahebrew'] = 0x05A7;
  14851. t['dargalefthebrew'] = 0x05A7;
  14852. t['dasiapneumatacyrilliccmb'] = 0x0485;
  14853. t['dblGrave'] = 0xF6D3;
  14854. t['dblanglebracketleft'] = 0x300A;
  14855. t['dblanglebracketleftvertical'] = 0xFE3D;
  14856. t['dblanglebracketright'] = 0x300B;
  14857. t['dblanglebracketrightvertical'] = 0xFE3E;
  14858. t['dblarchinvertedbelowcmb'] = 0x032B;
  14859. t['dblarrowleft'] = 0x21D4;
  14860. t['dblarrowright'] = 0x21D2;
  14861. t['dbldanda'] = 0x0965;
  14862. t['dblgrave'] = 0xF6D6;
  14863. t['dblgravecmb'] = 0x030F;
  14864. t['dblintegral'] = 0x222C;
  14865. t['dbllowline'] = 0x2017;
  14866. t['dbllowlinecmb'] = 0x0333;
  14867. t['dbloverlinecmb'] = 0x033F;
  14868. t['dblprimemod'] = 0x02BA;
  14869. t['dblverticalbar'] = 0x2016;
  14870. t['dblverticallineabovecmb'] = 0x030E;
  14871. t['dbopomofo'] = 0x3109;
  14872. t['dbsquare'] = 0x33C8;
  14873. t['dcaron'] = 0x010F;
  14874. t['dcedilla'] = 0x1E11;
  14875. t['dcircle'] = 0x24D3;
  14876. t['dcircumflexbelow'] = 0x1E13;
  14877. t['dcroat'] = 0x0111;
  14878. t['ddabengali'] = 0x09A1;
  14879. t['ddadeva'] = 0x0921;
  14880. t['ddagujarati'] = 0x0AA1;
  14881. t['ddagurmukhi'] = 0x0A21;
  14882. t['ddalarabic'] = 0x0688;
  14883. t['ddalfinalarabic'] = 0xFB89;
  14884. t['dddhadeva'] = 0x095C;
  14885. t['ddhabengali'] = 0x09A2;
  14886. t['ddhadeva'] = 0x0922;
  14887. t['ddhagujarati'] = 0x0AA2;
  14888. t['ddhagurmukhi'] = 0x0A22;
  14889. t['ddotaccent'] = 0x1E0B;
  14890. t['ddotbelow'] = 0x1E0D;
  14891. t['decimalseparatorarabic'] = 0x066B;
  14892. t['decimalseparatorpersian'] = 0x066B;
  14893. t['decyrillic'] = 0x0434;
  14894. t['degree'] = 0x00B0;
  14895. t['dehihebrew'] = 0x05AD;
  14896. t['dehiragana'] = 0x3067;
  14897. t['deicoptic'] = 0x03EF;
  14898. t['dekatakana'] = 0x30C7;
  14899. t['deleteleft'] = 0x232B;
  14900. t['deleteright'] = 0x2326;
  14901. t['delta'] = 0x03B4;
  14902. t['deltaturned'] = 0x018D;
  14903. t['denominatorminusonenumeratorbengali'] = 0x09F8;
  14904. t['dezh'] = 0x02A4;
  14905. t['dhabengali'] = 0x09A7;
  14906. t['dhadeva'] = 0x0927;
  14907. t['dhagujarati'] = 0x0AA7;
  14908. t['dhagurmukhi'] = 0x0A27;
  14909. t['dhook'] = 0x0257;
  14910. t['dialytikatonos'] = 0x0385;
  14911. t['dialytikatonoscmb'] = 0x0344;
  14912. t['diamond'] = 0x2666;
  14913. t['diamondsuitwhite'] = 0x2662;
  14914. t['dieresis'] = 0x00A8;
  14915. t['dieresisacute'] = 0xF6D7;
  14916. t['dieresisbelowcmb'] = 0x0324;
  14917. t['dieresiscmb'] = 0x0308;
  14918. t['dieresisgrave'] = 0xF6D8;
  14919. t['dieresistonos'] = 0x0385;
  14920. t['dihiragana'] = 0x3062;
  14921. t['dikatakana'] = 0x30C2;
  14922. t['dittomark'] = 0x3003;
  14923. t['divide'] = 0x00F7;
  14924. t['divides'] = 0x2223;
  14925. t['divisionslash'] = 0x2215;
  14926. t['djecyrillic'] = 0x0452;
  14927. t['dkshade'] = 0x2593;
  14928. t['dlinebelow'] = 0x1E0F;
  14929. t['dlsquare'] = 0x3397;
  14930. t['dmacron'] = 0x0111;
  14931. t['dmonospace'] = 0xFF44;
  14932. t['dnblock'] = 0x2584;
  14933. t['dochadathai'] = 0x0E0E;
  14934. t['dodekthai'] = 0x0E14;
  14935. t['dohiragana'] = 0x3069;
  14936. t['dokatakana'] = 0x30C9;
  14937. t['dollar'] = 0x0024;
  14938. t['dollarinferior'] = 0xF6E3;
  14939. t['dollarmonospace'] = 0xFF04;
  14940. t['dollaroldstyle'] = 0xF724;
  14941. t['dollarsmall'] = 0xFE69;
  14942. t['dollarsuperior'] = 0xF6E4;
  14943. t['dong'] = 0x20AB;
  14944. t['dorusquare'] = 0x3326;
  14945. t['dotaccent'] = 0x02D9;
  14946. t['dotaccentcmb'] = 0x0307;
  14947. t['dotbelowcmb'] = 0x0323;
  14948. t['dotbelowcomb'] = 0x0323;
  14949. t['dotkatakana'] = 0x30FB;
  14950. t['dotlessi'] = 0x0131;
  14951. t['dotlessj'] = 0xF6BE;
  14952. t['dotlessjstrokehook'] = 0x0284;
  14953. t['dotmath'] = 0x22C5;
  14954. t['dottedcircle'] = 0x25CC;
  14955. t['doubleyodpatah'] = 0xFB1F;
  14956. t['doubleyodpatahhebrew'] = 0xFB1F;
  14957. t['downtackbelowcmb'] = 0x031E;
  14958. t['downtackmod'] = 0x02D5;
  14959. t['dparen'] = 0x249F;
  14960. t['dsuperior'] = 0xF6EB;
  14961. t['dtail'] = 0x0256;
  14962. t['dtopbar'] = 0x018C;
  14963. t['duhiragana'] = 0x3065;
  14964. t['dukatakana'] = 0x30C5;
  14965. t['dz'] = 0x01F3;
  14966. t['dzaltone'] = 0x02A3;
  14967. t['dzcaron'] = 0x01C6;
  14968. t['dzcurl'] = 0x02A5;
  14969. t['dzeabkhasiancyrillic'] = 0x04E1;
  14970. t['dzecyrillic'] = 0x0455;
  14971. t['dzhecyrillic'] = 0x045F;
  14972. t['e'] = 0x0065;
  14973. t['eacute'] = 0x00E9;
  14974. t['earth'] = 0x2641;
  14975. t['ebengali'] = 0x098F;
  14976. t['ebopomofo'] = 0x311C;
  14977. t['ebreve'] = 0x0115;
  14978. t['ecandradeva'] = 0x090D;
  14979. t['ecandragujarati'] = 0x0A8D;
  14980. t['ecandravowelsigndeva'] = 0x0945;
  14981. t['ecandravowelsigngujarati'] = 0x0AC5;
  14982. t['ecaron'] = 0x011B;
  14983. t['ecedillabreve'] = 0x1E1D;
  14984. t['echarmenian'] = 0x0565;
  14985. t['echyiwnarmenian'] = 0x0587;
  14986. t['ecircle'] = 0x24D4;
  14987. t['ecircumflex'] = 0x00EA;
  14988. t['ecircumflexacute'] = 0x1EBF;
  14989. t['ecircumflexbelow'] = 0x1E19;
  14990. t['ecircumflexdotbelow'] = 0x1EC7;
  14991. t['ecircumflexgrave'] = 0x1EC1;
  14992. t['ecircumflexhookabove'] = 0x1EC3;
  14993. t['ecircumflextilde'] = 0x1EC5;
  14994. t['ecyrillic'] = 0x0454;
  14995. t['edblgrave'] = 0x0205;
  14996. t['edeva'] = 0x090F;
  14997. t['edieresis'] = 0x00EB;
  14998. t['edot'] = 0x0117;
  14999. t['edotaccent'] = 0x0117;
  15000. t['edotbelow'] = 0x1EB9;
  15001. t['eegurmukhi'] = 0x0A0F;
  15002. t['eematragurmukhi'] = 0x0A47;
  15003. t['efcyrillic'] = 0x0444;
  15004. t['egrave'] = 0x00E8;
  15005. t['egujarati'] = 0x0A8F;
  15006. t['eharmenian'] = 0x0567;
  15007. t['ehbopomofo'] = 0x311D;
  15008. t['ehiragana'] = 0x3048;
  15009. t['ehookabove'] = 0x1EBB;
  15010. t['eibopomofo'] = 0x311F;
  15011. t['eight'] = 0x0038;
  15012. t['eightarabic'] = 0x0668;
  15013. t['eightbengali'] = 0x09EE;
  15014. t['eightcircle'] = 0x2467;
  15015. t['eightcircleinversesansserif'] = 0x2791;
  15016. t['eightdeva'] = 0x096E;
  15017. t['eighteencircle'] = 0x2471;
  15018. t['eighteenparen'] = 0x2485;
  15019. t['eighteenperiod'] = 0x2499;
  15020. t['eightgujarati'] = 0x0AEE;
  15021. t['eightgurmukhi'] = 0x0A6E;
  15022. t['eighthackarabic'] = 0x0668;
  15023. t['eighthangzhou'] = 0x3028;
  15024. t['eighthnotebeamed'] = 0x266B;
  15025. t['eightideographicparen'] = 0x3227;
  15026. t['eightinferior'] = 0x2088;
  15027. t['eightmonospace'] = 0xFF18;
  15028. t['eightoldstyle'] = 0xF738;
  15029. t['eightparen'] = 0x247B;
  15030. t['eightperiod'] = 0x248F;
  15031. t['eightpersian'] = 0x06F8;
  15032. t['eightroman'] = 0x2177;
  15033. t['eightsuperior'] = 0x2078;
  15034. t['eightthai'] = 0x0E58;
  15035. t['einvertedbreve'] = 0x0207;
  15036. t['eiotifiedcyrillic'] = 0x0465;
  15037. t['ekatakana'] = 0x30A8;
  15038. t['ekatakanahalfwidth'] = 0xFF74;
  15039. t['ekonkargurmukhi'] = 0x0A74;
  15040. t['ekorean'] = 0x3154;
  15041. t['elcyrillic'] = 0x043B;
  15042. t['element'] = 0x2208;
  15043. t['elevencircle'] = 0x246A;
  15044. t['elevenparen'] = 0x247E;
  15045. t['elevenperiod'] = 0x2492;
  15046. t['elevenroman'] = 0x217A;
  15047. t['ellipsis'] = 0x2026;
  15048. t['ellipsisvertical'] = 0x22EE;
  15049. t['emacron'] = 0x0113;
  15050. t['emacronacute'] = 0x1E17;
  15051. t['emacrongrave'] = 0x1E15;
  15052. t['emcyrillic'] = 0x043C;
  15053. t['emdash'] = 0x2014;
  15054. t['emdashvertical'] = 0xFE31;
  15055. t['emonospace'] = 0xFF45;
  15056. t['emphasismarkarmenian'] = 0x055B;
  15057. t['emptyset'] = 0x2205;
  15058. t['enbopomofo'] = 0x3123;
  15059. t['encyrillic'] = 0x043D;
  15060. t['endash'] = 0x2013;
  15061. t['endashvertical'] = 0xFE32;
  15062. t['endescendercyrillic'] = 0x04A3;
  15063. t['eng'] = 0x014B;
  15064. t['engbopomofo'] = 0x3125;
  15065. t['enghecyrillic'] = 0x04A5;
  15066. t['enhookcyrillic'] = 0x04C8;
  15067. t['enspace'] = 0x2002;
  15068. t['eogonek'] = 0x0119;
  15069. t['eokorean'] = 0x3153;
  15070. t['eopen'] = 0x025B;
  15071. t['eopenclosed'] = 0x029A;
  15072. t['eopenreversed'] = 0x025C;
  15073. t['eopenreversedclosed'] = 0x025E;
  15074. t['eopenreversedhook'] = 0x025D;
  15075. t['eparen'] = 0x24A0;
  15076. t['epsilon'] = 0x03B5;
  15077. t['epsilontonos'] = 0x03AD;
  15078. t['equal'] = 0x003D;
  15079. t['equalmonospace'] = 0xFF1D;
  15080. t['equalsmall'] = 0xFE66;
  15081. t['equalsuperior'] = 0x207C;
  15082. t['equivalence'] = 0x2261;
  15083. t['erbopomofo'] = 0x3126;
  15084. t['ercyrillic'] = 0x0440;
  15085. t['ereversed'] = 0x0258;
  15086. t['ereversedcyrillic'] = 0x044D;
  15087. t['escyrillic'] = 0x0441;
  15088. t['esdescendercyrillic'] = 0x04AB;
  15089. t['esh'] = 0x0283;
  15090. t['eshcurl'] = 0x0286;
  15091. t['eshortdeva'] = 0x090E;
  15092. t['eshortvowelsigndeva'] = 0x0946;
  15093. t['eshreversedloop'] = 0x01AA;
  15094. t['eshsquatreversed'] = 0x0285;
  15095. t['esmallhiragana'] = 0x3047;
  15096. t['esmallkatakana'] = 0x30A7;
  15097. t['esmallkatakanahalfwidth'] = 0xFF6A;
  15098. t['estimated'] = 0x212E;
  15099. t['esuperior'] = 0xF6EC;
  15100. t['eta'] = 0x03B7;
  15101. t['etarmenian'] = 0x0568;
  15102. t['etatonos'] = 0x03AE;
  15103. t['eth'] = 0x00F0;
  15104. t['etilde'] = 0x1EBD;
  15105. t['etildebelow'] = 0x1E1B;
  15106. t['etnahtafoukhhebrew'] = 0x0591;
  15107. t['etnahtafoukhlefthebrew'] = 0x0591;
  15108. t['etnahtahebrew'] = 0x0591;
  15109. t['etnahtalefthebrew'] = 0x0591;
  15110. t['eturned'] = 0x01DD;
  15111. t['eukorean'] = 0x3161;
  15112. t['euro'] = 0x20AC;
  15113. t['evowelsignbengali'] = 0x09C7;
  15114. t['evowelsigndeva'] = 0x0947;
  15115. t['evowelsigngujarati'] = 0x0AC7;
  15116. t['exclam'] = 0x0021;
  15117. t['exclamarmenian'] = 0x055C;
  15118. t['exclamdbl'] = 0x203C;
  15119. t['exclamdown'] = 0x00A1;
  15120. t['exclamdownsmall'] = 0xF7A1;
  15121. t['exclammonospace'] = 0xFF01;
  15122. t['exclamsmall'] = 0xF721;
  15123. t['existential'] = 0x2203;
  15124. t['ezh'] = 0x0292;
  15125. t['ezhcaron'] = 0x01EF;
  15126. t['ezhcurl'] = 0x0293;
  15127. t['ezhreversed'] = 0x01B9;
  15128. t['ezhtail'] = 0x01BA;
  15129. t['f'] = 0x0066;
  15130. t['fadeva'] = 0x095E;
  15131. t['fagurmukhi'] = 0x0A5E;
  15132. t['fahrenheit'] = 0x2109;
  15133. t['fathaarabic'] = 0x064E;
  15134. t['fathalowarabic'] = 0x064E;
  15135. t['fathatanarabic'] = 0x064B;
  15136. t['fbopomofo'] = 0x3108;
  15137. t['fcircle'] = 0x24D5;
  15138. t['fdotaccent'] = 0x1E1F;
  15139. t['feharabic'] = 0x0641;
  15140. t['feharmenian'] = 0x0586;
  15141. t['fehfinalarabic'] = 0xFED2;
  15142. t['fehinitialarabic'] = 0xFED3;
  15143. t['fehmedialarabic'] = 0xFED4;
  15144. t['feicoptic'] = 0x03E5;
  15145. t['female'] = 0x2640;
  15146. t['ff'] = 0xFB00;
  15147. t['ffi'] = 0xFB03;
  15148. t['ffl'] = 0xFB04;
  15149. t['fi'] = 0xFB01;
  15150. t['fifteencircle'] = 0x246E;
  15151. t['fifteenparen'] = 0x2482;
  15152. t['fifteenperiod'] = 0x2496;
  15153. t['figuredash'] = 0x2012;
  15154. t['filledbox'] = 0x25A0;
  15155. t['filledrect'] = 0x25AC;
  15156. t['finalkaf'] = 0x05DA;
  15157. t['finalkafdagesh'] = 0xFB3A;
  15158. t['finalkafdageshhebrew'] = 0xFB3A;
  15159. t['finalkafhebrew'] = 0x05DA;
  15160. t['finalmem'] = 0x05DD;
  15161. t['finalmemhebrew'] = 0x05DD;
  15162. t['finalnun'] = 0x05DF;
  15163. t['finalnunhebrew'] = 0x05DF;
  15164. t['finalpe'] = 0x05E3;
  15165. t['finalpehebrew'] = 0x05E3;
  15166. t['finaltsadi'] = 0x05E5;
  15167. t['finaltsadihebrew'] = 0x05E5;
  15168. t['firsttonechinese'] = 0x02C9;
  15169. t['fisheye'] = 0x25C9;
  15170. t['fitacyrillic'] = 0x0473;
  15171. t['five'] = 0x0035;
  15172. t['fivearabic'] = 0x0665;
  15173. t['fivebengali'] = 0x09EB;
  15174. t['fivecircle'] = 0x2464;
  15175. t['fivecircleinversesansserif'] = 0x278E;
  15176. t['fivedeva'] = 0x096B;
  15177. t['fiveeighths'] = 0x215D;
  15178. t['fivegujarati'] = 0x0AEB;
  15179. t['fivegurmukhi'] = 0x0A6B;
  15180. t['fivehackarabic'] = 0x0665;
  15181. t['fivehangzhou'] = 0x3025;
  15182. t['fiveideographicparen'] = 0x3224;
  15183. t['fiveinferior'] = 0x2085;
  15184. t['fivemonospace'] = 0xFF15;
  15185. t['fiveoldstyle'] = 0xF735;
  15186. t['fiveparen'] = 0x2478;
  15187. t['fiveperiod'] = 0x248C;
  15188. t['fivepersian'] = 0x06F5;
  15189. t['fiveroman'] = 0x2174;
  15190. t['fivesuperior'] = 0x2075;
  15191. t['fivethai'] = 0x0E55;
  15192. t['fl'] = 0xFB02;
  15193. t['florin'] = 0x0192;
  15194. t['fmonospace'] = 0xFF46;
  15195. t['fmsquare'] = 0x3399;
  15196. t['fofanthai'] = 0x0E1F;
  15197. t['fofathai'] = 0x0E1D;
  15198. t['fongmanthai'] = 0x0E4F;
  15199. t['forall'] = 0x2200;
  15200. t['four'] = 0x0034;
  15201. t['fourarabic'] = 0x0664;
  15202. t['fourbengali'] = 0x09EA;
  15203. t['fourcircle'] = 0x2463;
  15204. t['fourcircleinversesansserif'] = 0x278D;
  15205. t['fourdeva'] = 0x096A;
  15206. t['fourgujarati'] = 0x0AEA;
  15207. t['fourgurmukhi'] = 0x0A6A;
  15208. t['fourhackarabic'] = 0x0664;
  15209. t['fourhangzhou'] = 0x3024;
  15210. t['fourideographicparen'] = 0x3223;
  15211. t['fourinferior'] = 0x2084;
  15212. t['fourmonospace'] = 0xFF14;
  15213. t['fournumeratorbengali'] = 0x09F7;
  15214. t['fouroldstyle'] = 0xF734;
  15215. t['fourparen'] = 0x2477;
  15216. t['fourperiod'] = 0x248B;
  15217. t['fourpersian'] = 0x06F4;
  15218. t['fourroman'] = 0x2173;
  15219. t['foursuperior'] = 0x2074;
  15220. t['fourteencircle'] = 0x246D;
  15221. t['fourteenparen'] = 0x2481;
  15222. t['fourteenperiod'] = 0x2495;
  15223. t['fourthai'] = 0x0E54;
  15224. t['fourthtonechinese'] = 0x02CB;
  15225. t['fparen'] = 0x24A1;
  15226. t['fraction'] = 0x2044;
  15227. t['franc'] = 0x20A3;
  15228. t['g'] = 0x0067;
  15229. t['gabengali'] = 0x0997;
  15230. t['gacute'] = 0x01F5;
  15231. t['gadeva'] = 0x0917;
  15232. t['gafarabic'] = 0x06AF;
  15233. t['gaffinalarabic'] = 0xFB93;
  15234. t['gafinitialarabic'] = 0xFB94;
  15235. t['gafmedialarabic'] = 0xFB95;
  15236. t['gagujarati'] = 0x0A97;
  15237. t['gagurmukhi'] = 0x0A17;
  15238. t['gahiragana'] = 0x304C;
  15239. t['gakatakana'] = 0x30AC;
  15240. t['gamma'] = 0x03B3;
  15241. t['gammalatinsmall'] = 0x0263;
  15242. t['gammasuperior'] = 0x02E0;
  15243. t['gangiacoptic'] = 0x03EB;
  15244. t['gbopomofo'] = 0x310D;
  15245. t['gbreve'] = 0x011F;
  15246. t['gcaron'] = 0x01E7;
  15247. t['gcedilla'] = 0x0123;
  15248. t['gcircle'] = 0x24D6;
  15249. t['gcircumflex'] = 0x011D;
  15250. t['gcommaaccent'] = 0x0123;
  15251. t['gdot'] = 0x0121;
  15252. t['gdotaccent'] = 0x0121;
  15253. t['gecyrillic'] = 0x0433;
  15254. t['gehiragana'] = 0x3052;
  15255. t['gekatakana'] = 0x30B2;
  15256. t['geometricallyequal'] = 0x2251;
  15257. t['gereshaccenthebrew'] = 0x059C;
  15258. t['gereshhebrew'] = 0x05F3;
  15259. t['gereshmuqdamhebrew'] = 0x059D;
  15260. t['germandbls'] = 0x00DF;
  15261. t['gershayimaccenthebrew'] = 0x059E;
  15262. t['gershayimhebrew'] = 0x05F4;
  15263. t['getamark'] = 0x3013;
  15264. t['ghabengali'] = 0x0998;
  15265. t['ghadarmenian'] = 0x0572;
  15266. t['ghadeva'] = 0x0918;
  15267. t['ghagujarati'] = 0x0A98;
  15268. t['ghagurmukhi'] = 0x0A18;
  15269. t['ghainarabic'] = 0x063A;
  15270. t['ghainfinalarabic'] = 0xFECE;
  15271. t['ghaininitialarabic'] = 0xFECF;
  15272. t['ghainmedialarabic'] = 0xFED0;
  15273. t['ghemiddlehookcyrillic'] = 0x0495;
  15274. t['ghestrokecyrillic'] = 0x0493;
  15275. t['gheupturncyrillic'] = 0x0491;
  15276. t['ghhadeva'] = 0x095A;
  15277. t['ghhagurmukhi'] = 0x0A5A;
  15278. t['ghook'] = 0x0260;
  15279. t['ghzsquare'] = 0x3393;
  15280. t['gihiragana'] = 0x304E;
  15281. t['gikatakana'] = 0x30AE;
  15282. t['gimarmenian'] = 0x0563;
  15283. t['gimel'] = 0x05D2;
  15284. t['gimeldagesh'] = 0xFB32;
  15285. t['gimeldageshhebrew'] = 0xFB32;
  15286. t['gimelhebrew'] = 0x05D2;
  15287. t['gjecyrillic'] = 0x0453;
  15288. t['glottalinvertedstroke'] = 0x01BE;
  15289. t['glottalstop'] = 0x0294;
  15290. t['glottalstopinverted'] = 0x0296;
  15291. t['glottalstopmod'] = 0x02C0;
  15292. t['glottalstopreversed'] = 0x0295;
  15293. t['glottalstopreversedmod'] = 0x02C1;
  15294. t['glottalstopreversedsuperior'] = 0x02E4;
  15295. t['glottalstopstroke'] = 0x02A1;
  15296. t['glottalstopstrokereversed'] = 0x02A2;
  15297. t['gmacron'] = 0x1E21;
  15298. t['gmonospace'] = 0xFF47;
  15299. t['gohiragana'] = 0x3054;
  15300. t['gokatakana'] = 0x30B4;
  15301. t['gparen'] = 0x24A2;
  15302. t['gpasquare'] = 0x33AC;
  15303. t['gradient'] = 0x2207;
  15304. t['grave'] = 0x0060;
  15305. t['gravebelowcmb'] = 0x0316;
  15306. t['gravecmb'] = 0x0300;
  15307. t['gravecomb'] = 0x0300;
  15308. t['gravedeva'] = 0x0953;
  15309. t['gravelowmod'] = 0x02CE;
  15310. t['gravemonospace'] = 0xFF40;
  15311. t['gravetonecmb'] = 0x0340;
  15312. t['greater'] = 0x003E;
  15313. t['greaterequal'] = 0x2265;
  15314. t['greaterequalorless'] = 0x22DB;
  15315. t['greatermonospace'] = 0xFF1E;
  15316. t['greaterorequivalent'] = 0x2273;
  15317. t['greaterorless'] = 0x2277;
  15318. t['greateroverequal'] = 0x2267;
  15319. t['greatersmall'] = 0xFE65;
  15320. t['gscript'] = 0x0261;
  15321. t['gstroke'] = 0x01E5;
  15322. t['guhiragana'] = 0x3050;
  15323. t['guillemotleft'] = 0x00AB;
  15324. t['guillemotright'] = 0x00BB;
  15325. t['guilsinglleft'] = 0x2039;
  15326. t['guilsinglright'] = 0x203A;
  15327. t['gukatakana'] = 0x30B0;
  15328. t['guramusquare'] = 0x3318;
  15329. t['gysquare'] = 0x33C9;
  15330. t['h'] = 0x0068;
  15331. t['haabkhasiancyrillic'] = 0x04A9;
  15332. t['haaltonearabic'] = 0x06C1;
  15333. t['habengali'] = 0x09B9;
  15334. t['hadescendercyrillic'] = 0x04B3;
  15335. t['hadeva'] = 0x0939;
  15336. t['hagujarati'] = 0x0AB9;
  15337. t['hagurmukhi'] = 0x0A39;
  15338. t['haharabic'] = 0x062D;
  15339. t['hahfinalarabic'] = 0xFEA2;
  15340. t['hahinitialarabic'] = 0xFEA3;
  15341. t['hahiragana'] = 0x306F;
  15342. t['hahmedialarabic'] = 0xFEA4;
  15343. t['haitusquare'] = 0x332A;
  15344. t['hakatakana'] = 0x30CF;
  15345. t['hakatakanahalfwidth'] = 0xFF8A;
  15346. t['halantgurmukhi'] = 0x0A4D;
  15347. t['hamzaarabic'] = 0x0621;
  15348. t['hamzalowarabic'] = 0x0621;
  15349. t['hangulfiller'] = 0x3164;
  15350. t['hardsigncyrillic'] = 0x044A;
  15351. t['harpoonleftbarbup'] = 0x21BC;
  15352. t['harpoonrightbarbup'] = 0x21C0;
  15353. t['hasquare'] = 0x33CA;
  15354. t['hatafpatah'] = 0x05B2;
  15355. t['hatafpatah16'] = 0x05B2;
  15356. t['hatafpatah23'] = 0x05B2;
  15357. t['hatafpatah2f'] = 0x05B2;
  15358. t['hatafpatahhebrew'] = 0x05B2;
  15359. t['hatafpatahnarrowhebrew'] = 0x05B2;
  15360. t['hatafpatahquarterhebrew'] = 0x05B2;
  15361. t['hatafpatahwidehebrew'] = 0x05B2;
  15362. t['hatafqamats'] = 0x05B3;
  15363. t['hatafqamats1b'] = 0x05B3;
  15364. t['hatafqamats28'] = 0x05B3;
  15365. t['hatafqamats34'] = 0x05B3;
  15366. t['hatafqamatshebrew'] = 0x05B3;
  15367. t['hatafqamatsnarrowhebrew'] = 0x05B3;
  15368. t['hatafqamatsquarterhebrew'] = 0x05B3;
  15369. t['hatafqamatswidehebrew'] = 0x05B3;
  15370. t['hatafsegol'] = 0x05B1;
  15371. t['hatafsegol17'] = 0x05B1;
  15372. t['hatafsegol24'] = 0x05B1;
  15373. t['hatafsegol30'] = 0x05B1;
  15374. t['hatafsegolhebrew'] = 0x05B1;
  15375. t['hatafsegolnarrowhebrew'] = 0x05B1;
  15376. t['hatafsegolquarterhebrew'] = 0x05B1;
  15377. t['hatafsegolwidehebrew'] = 0x05B1;
  15378. t['hbar'] = 0x0127;
  15379. t['hbopomofo'] = 0x310F;
  15380. t['hbrevebelow'] = 0x1E2B;
  15381. t['hcedilla'] = 0x1E29;
  15382. t['hcircle'] = 0x24D7;
  15383. t['hcircumflex'] = 0x0125;
  15384. t['hdieresis'] = 0x1E27;
  15385. t['hdotaccent'] = 0x1E23;
  15386. t['hdotbelow'] = 0x1E25;
  15387. t['he'] = 0x05D4;
  15388. t['heart'] = 0x2665;
  15389. t['heartsuitblack'] = 0x2665;
  15390. t['heartsuitwhite'] = 0x2661;
  15391. t['hedagesh'] = 0xFB34;
  15392. t['hedageshhebrew'] = 0xFB34;
  15393. t['hehaltonearabic'] = 0x06C1;
  15394. t['heharabic'] = 0x0647;
  15395. t['hehebrew'] = 0x05D4;
  15396. t['hehfinalaltonearabic'] = 0xFBA7;
  15397. t['hehfinalalttwoarabic'] = 0xFEEA;
  15398. t['hehfinalarabic'] = 0xFEEA;
  15399. t['hehhamzaabovefinalarabic'] = 0xFBA5;
  15400. t['hehhamzaaboveisolatedarabic'] = 0xFBA4;
  15401. t['hehinitialaltonearabic'] = 0xFBA8;
  15402. t['hehinitialarabic'] = 0xFEEB;
  15403. t['hehiragana'] = 0x3078;
  15404. t['hehmedialaltonearabic'] = 0xFBA9;
  15405. t['hehmedialarabic'] = 0xFEEC;
  15406. t['heiseierasquare'] = 0x337B;
  15407. t['hekatakana'] = 0x30D8;
  15408. t['hekatakanahalfwidth'] = 0xFF8D;
  15409. t['hekutaarusquare'] = 0x3336;
  15410. t['henghook'] = 0x0267;
  15411. t['herutusquare'] = 0x3339;
  15412. t['het'] = 0x05D7;
  15413. t['hethebrew'] = 0x05D7;
  15414. t['hhook'] = 0x0266;
  15415. t['hhooksuperior'] = 0x02B1;
  15416. t['hieuhacirclekorean'] = 0x327B;
  15417. t['hieuhaparenkorean'] = 0x321B;
  15418. t['hieuhcirclekorean'] = 0x326D;
  15419. t['hieuhkorean'] = 0x314E;
  15420. t['hieuhparenkorean'] = 0x320D;
  15421. t['hihiragana'] = 0x3072;
  15422. t['hikatakana'] = 0x30D2;
  15423. t['hikatakanahalfwidth'] = 0xFF8B;
  15424. t['hiriq'] = 0x05B4;
  15425. t['hiriq14'] = 0x05B4;
  15426. t['hiriq21'] = 0x05B4;
  15427. t['hiriq2d'] = 0x05B4;
  15428. t['hiriqhebrew'] = 0x05B4;
  15429. t['hiriqnarrowhebrew'] = 0x05B4;
  15430. t['hiriqquarterhebrew'] = 0x05B4;
  15431. t['hiriqwidehebrew'] = 0x05B4;
  15432. t['hlinebelow'] = 0x1E96;
  15433. t['hmonospace'] = 0xFF48;
  15434. t['hoarmenian'] = 0x0570;
  15435. t['hohipthai'] = 0x0E2B;
  15436. t['hohiragana'] = 0x307B;
  15437. t['hokatakana'] = 0x30DB;
  15438. t['hokatakanahalfwidth'] = 0xFF8E;
  15439. t['holam'] = 0x05B9;
  15440. t['holam19'] = 0x05B9;
  15441. t['holam26'] = 0x05B9;
  15442. t['holam32'] = 0x05B9;
  15443. t['holamhebrew'] = 0x05B9;
  15444. t['holamnarrowhebrew'] = 0x05B9;
  15445. t['holamquarterhebrew'] = 0x05B9;
  15446. t['holamwidehebrew'] = 0x05B9;
  15447. t['honokhukthai'] = 0x0E2E;
  15448. t['hookabovecomb'] = 0x0309;
  15449. t['hookcmb'] = 0x0309;
  15450. t['hookpalatalizedbelowcmb'] = 0x0321;
  15451. t['hookretroflexbelowcmb'] = 0x0322;
  15452. t['hoonsquare'] = 0x3342;
  15453. t['horicoptic'] = 0x03E9;
  15454. t['horizontalbar'] = 0x2015;
  15455. t['horncmb'] = 0x031B;
  15456. t['hotsprings'] = 0x2668;
  15457. t['house'] = 0x2302;
  15458. t['hparen'] = 0x24A3;
  15459. t['hsuperior'] = 0x02B0;
  15460. t['hturned'] = 0x0265;
  15461. t['huhiragana'] = 0x3075;
  15462. t['huiitosquare'] = 0x3333;
  15463. t['hukatakana'] = 0x30D5;
  15464. t['hukatakanahalfwidth'] = 0xFF8C;
  15465. t['hungarumlaut'] = 0x02DD;
  15466. t['hungarumlautcmb'] = 0x030B;
  15467. t['hv'] = 0x0195;
  15468. t['hyphen'] = 0x002D;
  15469. t['hypheninferior'] = 0xF6E5;
  15470. t['hyphenmonospace'] = 0xFF0D;
  15471. t['hyphensmall'] = 0xFE63;
  15472. t['hyphensuperior'] = 0xF6E6;
  15473. t['hyphentwo'] = 0x2010;
  15474. t['i'] = 0x0069;
  15475. t['iacute'] = 0x00ED;
  15476. t['iacyrillic'] = 0x044F;
  15477. t['ibengali'] = 0x0987;
  15478. t['ibopomofo'] = 0x3127;
  15479. t['ibreve'] = 0x012D;
  15480. t['icaron'] = 0x01D0;
  15481. t['icircle'] = 0x24D8;
  15482. t['icircumflex'] = 0x00EE;
  15483. t['icyrillic'] = 0x0456;
  15484. t['idblgrave'] = 0x0209;
  15485. t['ideographearthcircle'] = 0x328F;
  15486. t['ideographfirecircle'] = 0x328B;
  15487. t['ideographicallianceparen'] = 0x323F;
  15488. t['ideographiccallparen'] = 0x323A;
  15489. t['ideographiccentrecircle'] = 0x32A5;
  15490. t['ideographicclose'] = 0x3006;
  15491. t['ideographiccomma'] = 0x3001;
  15492. t['ideographiccommaleft'] = 0xFF64;
  15493. t['ideographiccongratulationparen'] = 0x3237;
  15494. t['ideographiccorrectcircle'] = 0x32A3;
  15495. t['ideographicearthparen'] = 0x322F;
  15496. t['ideographicenterpriseparen'] = 0x323D;
  15497. t['ideographicexcellentcircle'] = 0x329D;
  15498. t['ideographicfestivalparen'] = 0x3240;
  15499. t['ideographicfinancialcircle'] = 0x3296;
  15500. t['ideographicfinancialparen'] = 0x3236;
  15501. t['ideographicfireparen'] = 0x322B;
  15502. t['ideographichaveparen'] = 0x3232;
  15503. t['ideographichighcircle'] = 0x32A4;
  15504. t['ideographiciterationmark'] = 0x3005;
  15505. t['ideographiclaborcircle'] = 0x3298;
  15506. t['ideographiclaborparen'] = 0x3238;
  15507. t['ideographicleftcircle'] = 0x32A7;
  15508. t['ideographiclowcircle'] = 0x32A6;
  15509. t['ideographicmedicinecircle'] = 0x32A9;
  15510. t['ideographicmetalparen'] = 0x322E;
  15511. t['ideographicmoonparen'] = 0x322A;
  15512. t['ideographicnameparen'] = 0x3234;
  15513. t['ideographicperiod'] = 0x3002;
  15514. t['ideographicprintcircle'] = 0x329E;
  15515. t['ideographicreachparen'] = 0x3243;
  15516. t['ideographicrepresentparen'] = 0x3239;
  15517. t['ideographicresourceparen'] = 0x323E;
  15518. t['ideographicrightcircle'] = 0x32A8;
  15519. t['ideographicsecretcircle'] = 0x3299;
  15520. t['ideographicselfparen'] = 0x3242;
  15521. t['ideographicsocietyparen'] = 0x3233;
  15522. t['ideographicspace'] = 0x3000;
  15523. t['ideographicspecialparen'] = 0x3235;
  15524. t['ideographicstockparen'] = 0x3231;
  15525. t['ideographicstudyparen'] = 0x323B;
  15526. t['ideographicsunparen'] = 0x3230;
  15527. t['ideographicsuperviseparen'] = 0x323C;
  15528. t['ideographicwaterparen'] = 0x322C;
  15529. t['ideographicwoodparen'] = 0x322D;
  15530. t['ideographiczero'] = 0x3007;
  15531. t['ideographmetalcircle'] = 0x328E;
  15532. t['ideographmooncircle'] = 0x328A;
  15533. t['ideographnamecircle'] = 0x3294;
  15534. t['ideographsuncircle'] = 0x3290;
  15535. t['ideographwatercircle'] = 0x328C;
  15536. t['ideographwoodcircle'] = 0x328D;
  15537. t['ideva'] = 0x0907;
  15538. t['idieresis'] = 0x00EF;
  15539. t['idieresisacute'] = 0x1E2F;
  15540. t['idieresiscyrillic'] = 0x04E5;
  15541. t['idotbelow'] = 0x1ECB;
  15542. t['iebrevecyrillic'] = 0x04D7;
  15543. t['iecyrillic'] = 0x0435;
  15544. t['ieungacirclekorean'] = 0x3275;
  15545. t['ieungaparenkorean'] = 0x3215;
  15546. t['ieungcirclekorean'] = 0x3267;
  15547. t['ieungkorean'] = 0x3147;
  15548. t['ieungparenkorean'] = 0x3207;
  15549. t['igrave'] = 0x00EC;
  15550. t['igujarati'] = 0x0A87;
  15551. t['igurmukhi'] = 0x0A07;
  15552. t['ihiragana'] = 0x3044;
  15553. t['ihookabove'] = 0x1EC9;
  15554. t['iibengali'] = 0x0988;
  15555. t['iicyrillic'] = 0x0438;
  15556. t['iideva'] = 0x0908;
  15557. t['iigujarati'] = 0x0A88;
  15558. t['iigurmukhi'] = 0x0A08;
  15559. t['iimatragurmukhi'] = 0x0A40;
  15560. t['iinvertedbreve'] = 0x020B;
  15561. t['iishortcyrillic'] = 0x0439;
  15562. t['iivowelsignbengali'] = 0x09C0;
  15563. t['iivowelsigndeva'] = 0x0940;
  15564. t['iivowelsigngujarati'] = 0x0AC0;
  15565. t['ij'] = 0x0133;
  15566. t['ikatakana'] = 0x30A4;
  15567. t['ikatakanahalfwidth'] = 0xFF72;
  15568. t['ikorean'] = 0x3163;
  15569. t['ilde'] = 0x02DC;
  15570. t['iluyhebrew'] = 0x05AC;
  15571. t['imacron'] = 0x012B;
  15572. t['imacroncyrillic'] = 0x04E3;
  15573. t['imageorapproximatelyequal'] = 0x2253;
  15574. t['imatragurmukhi'] = 0x0A3F;
  15575. t['imonospace'] = 0xFF49;
  15576. t['increment'] = 0x2206;
  15577. t['infinity'] = 0x221E;
  15578. t['iniarmenian'] = 0x056B;
  15579. t['integral'] = 0x222B;
  15580. t['integralbottom'] = 0x2321;
  15581. t['integralbt'] = 0x2321;
  15582. t['integralex'] = 0xF8F5;
  15583. t['integraltop'] = 0x2320;
  15584. t['integraltp'] = 0x2320;
  15585. t['intersection'] = 0x2229;
  15586. t['intisquare'] = 0x3305;
  15587. t['invbullet'] = 0x25D8;
  15588. t['invcircle'] = 0x25D9;
  15589. t['invsmileface'] = 0x263B;
  15590. t['iocyrillic'] = 0x0451;
  15591. t['iogonek'] = 0x012F;
  15592. t['iota'] = 0x03B9;
  15593. t['iotadieresis'] = 0x03CA;
  15594. t['iotadieresistonos'] = 0x0390;
  15595. t['iotalatin'] = 0x0269;
  15596. t['iotatonos'] = 0x03AF;
  15597. t['iparen'] = 0x24A4;
  15598. t['irigurmukhi'] = 0x0A72;
  15599. t['ismallhiragana'] = 0x3043;
  15600. t['ismallkatakana'] = 0x30A3;
  15601. t['ismallkatakanahalfwidth'] = 0xFF68;
  15602. t['issharbengali'] = 0x09FA;
  15603. t['istroke'] = 0x0268;
  15604. t['isuperior'] = 0xF6ED;
  15605. t['iterationhiragana'] = 0x309D;
  15606. t['iterationkatakana'] = 0x30FD;
  15607. t['itilde'] = 0x0129;
  15608. t['itildebelow'] = 0x1E2D;
  15609. t['iubopomofo'] = 0x3129;
  15610. t['iucyrillic'] = 0x044E;
  15611. t['ivowelsignbengali'] = 0x09BF;
  15612. t['ivowelsigndeva'] = 0x093F;
  15613. t['ivowelsigngujarati'] = 0x0ABF;
  15614. t['izhitsacyrillic'] = 0x0475;
  15615. t['izhitsadblgravecyrillic'] = 0x0477;
  15616. t['j'] = 0x006A;
  15617. t['jaarmenian'] = 0x0571;
  15618. t['jabengali'] = 0x099C;
  15619. t['jadeva'] = 0x091C;
  15620. t['jagujarati'] = 0x0A9C;
  15621. t['jagurmukhi'] = 0x0A1C;
  15622. t['jbopomofo'] = 0x3110;
  15623. t['jcaron'] = 0x01F0;
  15624. t['jcircle'] = 0x24D9;
  15625. t['jcircumflex'] = 0x0135;
  15626. t['jcrossedtail'] = 0x029D;
  15627. t['jdotlessstroke'] = 0x025F;
  15628. t['jecyrillic'] = 0x0458;
  15629. t['jeemarabic'] = 0x062C;
  15630. t['jeemfinalarabic'] = 0xFE9E;
  15631. t['jeeminitialarabic'] = 0xFE9F;
  15632. t['jeemmedialarabic'] = 0xFEA0;
  15633. t['jeharabic'] = 0x0698;
  15634. t['jehfinalarabic'] = 0xFB8B;
  15635. t['jhabengali'] = 0x099D;
  15636. t['jhadeva'] = 0x091D;
  15637. t['jhagujarati'] = 0x0A9D;
  15638. t['jhagurmukhi'] = 0x0A1D;
  15639. t['jheharmenian'] = 0x057B;
  15640. t['jis'] = 0x3004;
  15641. t['jmonospace'] = 0xFF4A;
  15642. t['jparen'] = 0x24A5;
  15643. t['jsuperior'] = 0x02B2;
  15644. t['k'] = 0x006B;
  15645. t['kabashkircyrillic'] = 0x04A1;
  15646. t['kabengali'] = 0x0995;
  15647. t['kacute'] = 0x1E31;
  15648. t['kacyrillic'] = 0x043A;
  15649. t['kadescendercyrillic'] = 0x049B;
  15650. t['kadeva'] = 0x0915;
  15651. t['kaf'] = 0x05DB;
  15652. t['kafarabic'] = 0x0643;
  15653. t['kafdagesh'] = 0xFB3B;
  15654. t['kafdageshhebrew'] = 0xFB3B;
  15655. t['kaffinalarabic'] = 0xFEDA;
  15656. t['kafhebrew'] = 0x05DB;
  15657. t['kafinitialarabic'] = 0xFEDB;
  15658. t['kafmedialarabic'] = 0xFEDC;
  15659. t['kafrafehebrew'] = 0xFB4D;
  15660. t['kagujarati'] = 0x0A95;
  15661. t['kagurmukhi'] = 0x0A15;
  15662. t['kahiragana'] = 0x304B;
  15663. t['kahookcyrillic'] = 0x04C4;
  15664. t['kakatakana'] = 0x30AB;
  15665. t['kakatakanahalfwidth'] = 0xFF76;
  15666. t['kappa'] = 0x03BA;
  15667. t['kappasymbolgreek'] = 0x03F0;
  15668. t['kapyeounmieumkorean'] = 0x3171;
  15669. t['kapyeounphieuphkorean'] = 0x3184;
  15670. t['kapyeounpieupkorean'] = 0x3178;
  15671. t['kapyeounssangpieupkorean'] = 0x3179;
  15672. t['karoriisquare'] = 0x330D;
  15673. t['kashidaautoarabic'] = 0x0640;
  15674. t['kashidaautonosidebearingarabic'] = 0x0640;
  15675. t['kasmallkatakana'] = 0x30F5;
  15676. t['kasquare'] = 0x3384;
  15677. t['kasraarabic'] = 0x0650;
  15678. t['kasratanarabic'] = 0x064D;
  15679. t['kastrokecyrillic'] = 0x049F;
  15680. t['katahiraprolongmarkhalfwidth'] = 0xFF70;
  15681. t['kaverticalstrokecyrillic'] = 0x049D;
  15682. t['kbopomofo'] = 0x310E;
  15683. t['kcalsquare'] = 0x3389;
  15684. t['kcaron'] = 0x01E9;
  15685. t['kcedilla'] = 0x0137;
  15686. t['kcircle'] = 0x24DA;
  15687. t['kcommaaccent'] = 0x0137;
  15688. t['kdotbelow'] = 0x1E33;
  15689. t['keharmenian'] = 0x0584;
  15690. t['kehiragana'] = 0x3051;
  15691. t['kekatakana'] = 0x30B1;
  15692. t['kekatakanahalfwidth'] = 0xFF79;
  15693. t['kenarmenian'] = 0x056F;
  15694. t['kesmallkatakana'] = 0x30F6;
  15695. t['kgreenlandic'] = 0x0138;
  15696. t['khabengali'] = 0x0996;
  15697. t['khacyrillic'] = 0x0445;
  15698. t['khadeva'] = 0x0916;
  15699. t['khagujarati'] = 0x0A96;
  15700. t['khagurmukhi'] = 0x0A16;
  15701. t['khaharabic'] = 0x062E;
  15702. t['khahfinalarabic'] = 0xFEA6;
  15703. t['khahinitialarabic'] = 0xFEA7;
  15704. t['khahmedialarabic'] = 0xFEA8;
  15705. t['kheicoptic'] = 0x03E7;
  15706. t['khhadeva'] = 0x0959;
  15707. t['khhagurmukhi'] = 0x0A59;
  15708. t['khieukhacirclekorean'] = 0x3278;
  15709. t['khieukhaparenkorean'] = 0x3218;
  15710. t['khieukhcirclekorean'] = 0x326A;
  15711. t['khieukhkorean'] = 0x314B;
  15712. t['khieukhparenkorean'] = 0x320A;
  15713. t['khokhaithai'] = 0x0E02;
  15714. t['khokhonthai'] = 0x0E05;
  15715. t['khokhuatthai'] = 0x0E03;
  15716. t['khokhwaithai'] = 0x0E04;
  15717. t['khomutthai'] = 0x0E5B;
  15718. t['khook'] = 0x0199;
  15719. t['khorakhangthai'] = 0x0E06;
  15720. t['khzsquare'] = 0x3391;
  15721. t['kihiragana'] = 0x304D;
  15722. t['kikatakana'] = 0x30AD;
  15723. t['kikatakanahalfwidth'] = 0xFF77;
  15724. t['kiroguramusquare'] = 0x3315;
  15725. t['kiromeetorusquare'] = 0x3316;
  15726. t['kirosquare'] = 0x3314;
  15727. t['kiyeokacirclekorean'] = 0x326E;
  15728. t['kiyeokaparenkorean'] = 0x320E;
  15729. t['kiyeokcirclekorean'] = 0x3260;
  15730. t['kiyeokkorean'] = 0x3131;
  15731. t['kiyeokparenkorean'] = 0x3200;
  15732. t['kiyeoksioskorean'] = 0x3133;
  15733. t['kjecyrillic'] = 0x045C;
  15734. t['klinebelow'] = 0x1E35;
  15735. t['klsquare'] = 0x3398;
  15736. t['kmcubedsquare'] = 0x33A6;
  15737. t['kmonospace'] = 0xFF4B;
  15738. t['kmsquaredsquare'] = 0x33A2;
  15739. t['kohiragana'] = 0x3053;
  15740. t['kohmsquare'] = 0x33C0;
  15741. t['kokaithai'] = 0x0E01;
  15742. t['kokatakana'] = 0x30B3;
  15743. t['kokatakanahalfwidth'] = 0xFF7A;
  15744. t['kooposquare'] = 0x331E;
  15745. t['koppacyrillic'] = 0x0481;
  15746. t['koreanstandardsymbol'] = 0x327F;
  15747. t['koroniscmb'] = 0x0343;
  15748. t['kparen'] = 0x24A6;
  15749. t['kpasquare'] = 0x33AA;
  15750. t['ksicyrillic'] = 0x046F;
  15751. t['ktsquare'] = 0x33CF;
  15752. t['kturned'] = 0x029E;
  15753. t['kuhiragana'] = 0x304F;
  15754. t['kukatakana'] = 0x30AF;
  15755. t['kukatakanahalfwidth'] = 0xFF78;
  15756. t['kvsquare'] = 0x33B8;
  15757. t['kwsquare'] = 0x33BE;
  15758. t['l'] = 0x006C;
  15759. t['labengali'] = 0x09B2;
  15760. t['lacute'] = 0x013A;
  15761. t['ladeva'] = 0x0932;
  15762. t['lagujarati'] = 0x0AB2;
  15763. t['lagurmukhi'] = 0x0A32;
  15764. t['lakkhangyaothai'] = 0x0E45;
  15765. t['lamaleffinalarabic'] = 0xFEFC;
  15766. t['lamalefhamzaabovefinalarabic'] = 0xFEF8;
  15767. t['lamalefhamzaaboveisolatedarabic'] = 0xFEF7;
  15768. t['lamalefhamzabelowfinalarabic'] = 0xFEFA;
  15769. t['lamalefhamzabelowisolatedarabic'] = 0xFEF9;
  15770. t['lamalefisolatedarabic'] = 0xFEFB;
  15771. t['lamalefmaddaabovefinalarabic'] = 0xFEF6;
  15772. t['lamalefmaddaaboveisolatedarabic'] = 0xFEF5;
  15773. t['lamarabic'] = 0x0644;
  15774. t['lambda'] = 0x03BB;
  15775. t['lambdastroke'] = 0x019B;
  15776. t['lamed'] = 0x05DC;
  15777. t['lameddagesh'] = 0xFB3C;
  15778. t['lameddageshhebrew'] = 0xFB3C;
  15779. t['lamedhebrew'] = 0x05DC;
  15780. t['lamfinalarabic'] = 0xFEDE;
  15781. t['lamhahinitialarabic'] = 0xFCCA;
  15782. t['laminitialarabic'] = 0xFEDF;
  15783. t['lamjeeminitialarabic'] = 0xFCC9;
  15784. t['lamkhahinitialarabic'] = 0xFCCB;
  15785. t['lamlamhehisolatedarabic'] = 0xFDF2;
  15786. t['lammedialarabic'] = 0xFEE0;
  15787. t['lammeemhahinitialarabic'] = 0xFD88;
  15788. t['lammeeminitialarabic'] = 0xFCCC;
  15789. t['largecircle'] = 0x25EF;
  15790. t['lbar'] = 0x019A;
  15791. t['lbelt'] = 0x026C;
  15792. t['lbopomofo'] = 0x310C;
  15793. t['lcaron'] = 0x013E;
  15794. t['lcedilla'] = 0x013C;
  15795. t['lcircle'] = 0x24DB;
  15796. t['lcircumflexbelow'] = 0x1E3D;
  15797. t['lcommaaccent'] = 0x013C;
  15798. t['ldot'] = 0x0140;
  15799. t['ldotaccent'] = 0x0140;
  15800. t['ldotbelow'] = 0x1E37;
  15801. t['ldotbelowmacron'] = 0x1E39;
  15802. t['leftangleabovecmb'] = 0x031A;
  15803. t['lefttackbelowcmb'] = 0x0318;
  15804. t['less'] = 0x003C;
  15805. t['lessequal'] = 0x2264;
  15806. t['lessequalorgreater'] = 0x22DA;
  15807. t['lessmonospace'] = 0xFF1C;
  15808. t['lessorequivalent'] = 0x2272;
  15809. t['lessorgreater'] = 0x2276;
  15810. t['lessoverequal'] = 0x2266;
  15811. t['lesssmall'] = 0xFE64;
  15812. t['lezh'] = 0x026E;
  15813. t['lfblock'] = 0x258C;
  15814. t['lhookretroflex'] = 0x026D;
  15815. t['lira'] = 0x20A4;
  15816. t['liwnarmenian'] = 0x056C;
  15817. t['lj'] = 0x01C9;
  15818. t['ljecyrillic'] = 0x0459;
  15819. t['ll'] = 0xF6C0;
  15820. t['lladeva'] = 0x0933;
  15821. t['llagujarati'] = 0x0AB3;
  15822. t['llinebelow'] = 0x1E3B;
  15823. t['llladeva'] = 0x0934;
  15824. t['llvocalicbengali'] = 0x09E1;
  15825. t['llvocalicdeva'] = 0x0961;
  15826. t['llvocalicvowelsignbengali'] = 0x09E3;
  15827. t['llvocalicvowelsigndeva'] = 0x0963;
  15828. t['lmiddletilde'] = 0x026B;
  15829. t['lmonospace'] = 0xFF4C;
  15830. t['lmsquare'] = 0x33D0;
  15831. t['lochulathai'] = 0x0E2C;
  15832. t['logicaland'] = 0x2227;
  15833. t['logicalnot'] = 0x00AC;
  15834. t['logicalnotreversed'] = 0x2310;
  15835. t['logicalor'] = 0x2228;
  15836. t['lolingthai'] = 0x0E25;
  15837. t['longs'] = 0x017F;
  15838. t['lowlinecenterline'] = 0xFE4E;
  15839. t['lowlinecmb'] = 0x0332;
  15840. t['lowlinedashed'] = 0xFE4D;
  15841. t['lozenge'] = 0x25CA;
  15842. t['lparen'] = 0x24A7;
  15843. t['lslash'] = 0x0142;
  15844. t['lsquare'] = 0x2113;
  15845. t['lsuperior'] = 0xF6EE;
  15846. t['ltshade'] = 0x2591;
  15847. t['luthai'] = 0x0E26;
  15848. t['lvocalicbengali'] = 0x098C;
  15849. t['lvocalicdeva'] = 0x090C;
  15850. t['lvocalicvowelsignbengali'] = 0x09E2;
  15851. t['lvocalicvowelsigndeva'] = 0x0962;
  15852. t['lxsquare'] = 0x33D3;
  15853. t['m'] = 0x006D;
  15854. t['mabengali'] = 0x09AE;
  15855. t['macron'] = 0x00AF;
  15856. t['macronbelowcmb'] = 0x0331;
  15857. t['macroncmb'] = 0x0304;
  15858. t['macronlowmod'] = 0x02CD;
  15859. t['macronmonospace'] = 0xFFE3;
  15860. t['macute'] = 0x1E3F;
  15861. t['madeva'] = 0x092E;
  15862. t['magujarati'] = 0x0AAE;
  15863. t['magurmukhi'] = 0x0A2E;
  15864. t['mahapakhhebrew'] = 0x05A4;
  15865. t['mahapakhlefthebrew'] = 0x05A4;
  15866. t['mahiragana'] = 0x307E;
  15867. t['maichattawalowleftthai'] = 0xF895;
  15868. t['maichattawalowrightthai'] = 0xF894;
  15869. t['maichattawathai'] = 0x0E4B;
  15870. t['maichattawaupperleftthai'] = 0xF893;
  15871. t['maieklowleftthai'] = 0xF88C;
  15872. t['maieklowrightthai'] = 0xF88B;
  15873. t['maiekthai'] = 0x0E48;
  15874. t['maiekupperleftthai'] = 0xF88A;
  15875. t['maihanakatleftthai'] = 0xF884;
  15876. t['maihanakatthai'] = 0x0E31;
  15877. t['maitaikhuleftthai'] = 0xF889;
  15878. t['maitaikhuthai'] = 0x0E47;
  15879. t['maitholowleftthai'] = 0xF88F;
  15880. t['maitholowrightthai'] = 0xF88E;
  15881. t['maithothai'] = 0x0E49;
  15882. t['maithoupperleftthai'] = 0xF88D;
  15883. t['maitrilowleftthai'] = 0xF892;
  15884. t['maitrilowrightthai'] = 0xF891;
  15885. t['maitrithai'] = 0x0E4A;
  15886. t['maitriupperleftthai'] = 0xF890;
  15887. t['maiyamokthai'] = 0x0E46;
  15888. t['makatakana'] = 0x30DE;
  15889. t['makatakanahalfwidth'] = 0xFF8F;
  15890. t['male'] = 0x2642;
  15891. t['mansyonsquare'] = 0x3347;
  15892. t['maqafhebrew'] = 0x05BE;
  15893. t['mars'] = 0x2642;
  15894. t['masoracirclehebrew'] = 0x05AF;
  15895. t['masquare'] = 0x3383;
  15896. t['mbopomofo'] = 0x3107;
  15897. t['mbsquare'] = 0x33D4;
  15898. t['mcircle'] = 0x24DC;
  15899. t['mcubedsquare'] = 0x33A5;
  15900. t['mdotaccent'] = 0x1E41;
  15901. t['mdotbelow'] = 0x1E43;
  15902. t['meemarabic'] = 0x0645;
  15903. t['meemfinalarabic'] = 0xFEE2;
  15904. t['meeminitialarabic'] = 0xFEE3;
  15905. t['meemmedialarabic'] = 0xFEE4;
  15906. t['meemmeeminitialarabic'] = 0xFCD1;
  15907. t['meemmeemisolatedarabic'] = 0xFC48;
  15908. t['meetorusquare'] = 0x334D;
  15909. t['mehiragana'] = 0x3081;
  15910. t['meizierasquare'] = 0x337E;
  15911. t['mekatakana'] = 0x30E1;
  15912. t['mekatakanahalfwidth'] = 0xFF92;
  15913. t['mem'] = 0x05DE;
  15914. t['memdagesh'] = 0xFB3E;
  15915. t['memdageshhebrew'] = 0xFB3E;
  15916. t['memhebrew'] = 0x05DE;
  15917. t['menarmenian'] = 0x0574;
  15918. t['merkhahebrew'] = 0x05A5;
  15919. t['merkhakefulahebrew'] = 0x05A6;
  15920. t['merkhakefulalefthebrew'] = 0x05A6;
  15921. t['merkhalefthebrew'] = 0x05A5;
  15922. t['mhook'] = 0x0271;
  15923. t['mhzsquare'] = 0x3392;
  15924. t['middledotkatakanahalfwidth'] = 0xFF65;
  15925. t['middot'] = 0x00B7;
  15926. t['mieumacirclekorean'] = 0x3272;
  15927. t['mieumaparenkorean'] = 0x3212;
  15928. t['mieumcirclekorean'] = 0x3264;
  15929. t['mieumkorean'] = 0x3141;
  15930. t['mieumpansioskorean'] = 0x3170;
  15931. t['mieumparenkorean'] = 0x3204;
  15932. t['mieumpieupkorean'] = 0x316E;
  15933. t['mieumsioskorean'] = 0x316F;
  15934. t['mihiragana'] = 0x307F;
  15935. t['mikatakana'] = 0x30DF;
  15936. t['mikatakanahalfwidth'] = 0xFF90;
  15937. t['minus'] = 0x2212;
  15938. t['minusbelowcmb'] = 0x0320;
  15939. t['minuscircle'] = 0x2296;
  15940. t['minusmod'] = 0x02D7;
  15941. t['minusplus'] = 0x2213;
  15942. t['minute'] = 0x2032;
  15943. t['miribaarusquare'] = 0x334A;
  15944. t['mirisquare'] = 0x3349;
  15945. t['mlonglegturned'] = 0x0270;
  15946. t['mlsquare'] = 0x3396;
  15947. t['mmcubedsquare'] = 0x33A3;
  15948. t['mmonospace'] = 0xFF4D;
  15949. t['mmsquaredsquare'] = 0x339F;
  15950. t['mohiragana'] = 0x3082;
  15951. t['mohmsquare'] = 0x33C1;
  15952. t['mokatakana'] = 0x30E2;
  15953. t['mokatakanahalfwidth'] = 0xFF93;
  15954. t['molsquare'] = 0x33D6;
  15955. t['momathai'] = 0x0E21;
  15956. t['moverssquare'] = 0x33A7;
  15957. t['moverssquaredsquare'] = 0x33A8;
  15958. t['mparen'] = 0x24A8;
  15959. t['mpasquare'] = 0x33AB;
  15960. t['mssquare'] = 0x33B3;
  15961. t['msuperior'] = 0xF6EF;
  15962. t['mturned'] = 0x026F;
  15963. t['mu'] = 0x00B5;
  15964. t['mu1'] = 0x00B5;
  15965. t['muasquare'] = 0x3382;
  15966. t['muchgreater'] = 0x226B;
  15967. t['muchless'] = 0x226A;
  15968. t['mufsquare'] = 0x338C;
  15969. t['mugreek'] = 0x03BC;
  15970. t['mugsquare'] = 0x338D;
  15971. t['muhiragana'] = 0x3080;
  15972. t['mukatakana'] = 0x30E0;
  15973. t['mukatakanahalfwidth'] = 0xFF91;
  15974. t['mulsquare'] = 0x3395;
  15975. t['multiply'] = 0x00D7;
  15976. t['mumsquare'] = 0x339B;
  15977. t['munahhebrew'] = 0x05A3;
  15978. t['munahlefthebrew'] = 0x05A3;
  15979. t['musicalnote'] = 0x266A;
  15980. t['musicalnotedbl'] = 0x266B;
  15981. t['musicflatsign'] = 0x266D;
  15982. t['musicsharpsign'] = 0x266F;
  15983. t['mussquare'] = 0x33B2;
  15984. t['muvsquare'] = 0x33B6;
  15985. t['muwsquare'] = 0x33BC;
  15986. t['mvmegasquare'] = 0x33B9;
  15987. t['mvsquare'] = 0x33B7;
  15988. t['mwmegasquare'] = 0x33BF;
  15989. t['mwsquare'] = 0x33BD;
  15990. t['n'] = 0x006E;
  15991. t['nabengali'] = 0x09A8;
  15992. t['nabla'] = 0x2207;
  15993. t['nacute'] = 0x0144;
  15994. t['nadeva'] = 0x0928;
  15995. t['nagujarati'] = 0x0AA8;
  15996. t['nagurmukhi'] = 0x0A28;
  15997. t['nahiragana'] = 0x306A;
  15998. t['nakatakana'] = 0x30CA;
  15999. t['nakatakanahalfwidth'] = 0xFF85;
  16000. t['napostrophe'] = 0x0149;
  16001. t['nasquare'] = 0x3381;
  16002. t['nbopomofo'] = 0x310B;
  16003. t['nbspace'] = 0x00A0;
  16004. t['ncaron'] = 0x0148;
  16005. t['ncedilla'] = 0x0146;
  16006. t['ncircle'] = 0x24DD;
  16007. t['ncircumflexbelow'] = 0x1E4B;
  16008. t['ncommaaccent'] = 0x0146;
  16009. t['ndotaccent'] = 0x1E45;
  16010. t['ndotbelow'] = 0x1E47;
  16011. t['nehiragana'] = 0x306D;
  16012. t['nekatakana'] = 0x30CD;
  16013. t['nekatakanahalfwidth'] = 0xFF88;
  16014. t['newsheqelsign'] = 0x20AA;
  16015. t['nfsquare'] = 0x338B;
  16016. t['ngabengali'] = 0x0999;
  16017. t['ngadeva'] = 0x0919;
  16018. t['ngagujarati'] = 0x0A99;
  16019. t['ngagurmukhi'] = 0x0A19;
  16020. t['ngonguthai'] = 0x0E07;
  16021. t['nhiragana'] = 0x3093;
  16022. t['nhookleft'] = 0x0272;
  16023. t['nhookretroflex'] = 0x0273;
  16024. t['nieunacirclekorean'] = 0x326F;
  16025. t['nieunaparenkorean'] = 0x320F;
  16026. t['nieuncieuckorean'] = 0x3135;
  16027. t['nieuncirclekorean'] = 0x3261;
  16028. t['nieunhieuhkorean'] = 0x3136;
  16029. t['nieunkorean'] = 0x3134;
  16030. t['nieunpansioskorean'] = 0x3168;
  16031. t['nieunparenkorean'] = 0x3201;
  16032. t['nieunsioskorean'] = 0x3167;
  16033. t['nieuntikeutkorean'] = 0x3166;
  16034. t['nihiragana'] = 0x306B;
  16035. t['nikatakana'] = 0x30CB;
  16036. t['nikatakanahalfwidth'] = 0xFF86;
  16037. t['nikhahitleftthai'] = 0xF899;
  16038. t['nikhahitthai'] = 0x0E4D;
  16039. t['nine'] = 0x0039;
  16040. t['ninearabic'] = 0x0669;
  16041. t['ninebengali'] = 0x09EF;
  16042. t['ninecircle'] = 0x2468;
  16043. t['ninecircleinversesansserif'] = 0x2792;
  16044. t['ninedeva'] = 0x096F;
  16045. t['ninegujarati'] = 0x0AEF;
  16046. t['ninegurmukhi'] = 0x0A6F;
  16047. t['ninehackarabic'] = 0x0669;
  16048. t['ninehangzhou'] = 0x3029;
  16049. t['nineideographicparen'] = 0x3228;
  16050. t['nineinferior'] = 0x2089;
  16051. t['ninemonospace'] = 0xFF19;
  16052. t['nineoldstyle'] = 0xF739;
  16053. t['nineparen'] = 0x247C;
  16054. t['nineperiod'] = 0x2490;
  16055. t['ninepersian'] = 0x06F9;
  16056. t['nineroman'] = 0x2178;
  16057. t['ninesuperior'] = 0x2079;
  16058. t['nineteencircle'] = 0x2472;
  16059. t['nineteenparen'] = 0x2486;
  16060. t['nineteenperiod'] = 0x249A;
  16061. t['ninethai'] = 0x0E59;
  16062. t['nj'] = 0x01CC;
  16063. t['njecyrillic'] = 0x045A;
  16064. t['nkatakana'] = 0x30F3;
  16065. t['nkatakanahalfwidth'] = 0xFF9D;
  16066. t['nlegrightlong'] = 0x019E;
  16067. t['nlinebelow'] = 0x1E49;
  16068. t['nmonospace'] = 0xFF4E;
  16069. t['nmsquare'] = 0x339A;
  16070. t['nnabengali'] = 0x09A3;
  16071. t['nnadeva'] = 0x0923;
  16072. t['nnagujarati'] = 0x0AA3;
  16073. t['nnagurmukhi'] = 0x0A23;
  16074. t['nnnadeva'] = 0x0929;
  16075. t['nohiragana'] = 0x306E;
  16076. t['nokatakana'] = 0x30CE;
  16077. t['nokatakanahalfwidth'] = 0xFF89;
  16078. t['nonbreakingspace'] = 0x00A0;
  16079. t['nonenthai'] = 0x0E13;
  16080. t['nonuthai'] = 0x0E19;
  16081. t['noonarabic'] = 0x0646;
  16082. t['noonfinalarabic'] = 0xFEE6;
  16083. t['noonghunnaarabic'] = 0x06BA;
  16084. t['noonghunnafinalarabic'] = 0xFB9F;
  16085. t['nooninitialarabic'] = 0xFEE7;
  16086. t['noonjeeminitialarabic'] = 0xFCD2;
  16087. t['noonjeemisolatedarabic'] = 0xFC4B;
  16088. t['noonmedialarabic'] = 0xFEE8;
  16089. t['noonmeeminitialarabic'] = 0xFCD5;
  16090. t['noonmeemisolatedarabic'] = 0xFC4E;
  16091. t['noonnoonfinalarabic'] = 0xFC8D;
  16092. t['notcontains'] = 0x220C;
  16093. t['notelement'] = 0x2209;
  16094. t['notelementof'] = 0x2209;
  16095. t['notequal'] = 0x2260;
  16096. t['notgreater'] = 0x226F;
  16097. t['notgreaternorequal'] = 0x2271;
  16098. t['notgreaternorless'] = 0x2279;
  16099. t['notidentical'] = 0x2262;
  16100. t['notless'] = 0x226E;
  16101. t['notlessnorequal'] = 0x2270;
  16102. t['notparallel'] = 0x2226;
  16103. t['notprecedes'] = 0x2280;
  16104. t['notsubset'] = 0x2284;
  16105. t['notsucceeds'] = 0x2281;
  16106. t['notsuperset'] = 0x2285;
  16107. t['nowarmenian'] = 0x0576;
  16108. t['nparen'] = 0x24A9;
  16109. t['nssquare'] = 0x33B1;
  16110. t['nsuperior'] = 0x207F;
  16111. t['ntilde'] = 0x00F1;
  16112. t['nu'] = 0x03BD;
  16113. t['nuhiragana'] = 0x306C;
  16114. t['nukatakana'] = 0x30CC;
  16115. t['nukatakanahalfwidth'] = 0xFF87;
  16116. t['nuktabengali'] = 0x09BC;
  16117. t['nuktadeva'] = 0x093C;
  16118. t['nuktagujarati'] = 0x0ABC;
  16119. t['nuktagurmukhi'] = 0x0A3C;
  16120. t['numbersign'] = 0x0023;
  16121. t['numbersignmonospace'] = 0xFF03;
  16122. t['numbersignsmall'] = 0xFE5F;
  16123. t['numeralsigngreek'] = 0x0374;
  16124. t['numeralsignlowergreek'] = 0x0375;
  16125. t['numero'] = 0x2116;
  16126. t['nun'] = 0x05E0;
  16127. t['nundagesh'] = 0xFB40;
  16128. t['nundageshhebrew'] = 0xFB40;
  16129. t['nunhebrew'] = 0x05E0;
  16130. t['nvsquare'] = 0x33B5;
  16131. t['nwsquare'] = 0x33BB;
  16132. t['nyabengali'] = 0x099E;
  16133. t['nyadeva'] = 0x091E;
  16134. t['nyagujarati'] = 0x0A9E;
  16135. t['nyagurmukhi'] = 0x0A1E;
  16136. t['o'] = 0x006F;
  16137. t['oacute'] = 0x00F3;
  16138. t['oangthai'] = 0x0E2D;
  16139. t['obarred'] = 0x0275;
  16140. t['obarredcyrillic'] = 0x04E9;
  16141. t['obarreddieresiscyrillic'] = 0x04EB;
  16142. t['obengali'] = 0x0993;
  16143. t['obopomofo'] = 0x311B;
  16144. t['obreve'] = 0x014F;
  16145. t['ocandradeva'] = 0x0911;
  16146. t['ocandragujarati'] = 0x0A91;
  16147. t['ocandravowelsigndeva'] = 0x0949;
  16148. t['ocandravowelsigngujarati'] = 0x0AC9;
  16149. t['ocaron'] = 0x01D2;
  16150. t['ocircle'] = 0x24DE;
  16151. t['ocircumflex'] = 0x00F4;
  16152. t['ocircumflexacute'] = 0x1ED1;
  16153. t['ocircumflexdotbelow'] = 0x1ED9;
  16154. t['ocircumflexgrave'] = 0x1ED3;
  16155. t['ocircumflexhookabove'] = 0x1ED5;
  16156. t['ocircumflextilde'] = 0x1ED7;
  16157. t['ocyrillic'] = 0x043E;
  16158. t['odblacute'] = 0x0151;
  16159. t['odblgrave'] = 0x020D;
  16160. t['odeva'] = 0x0913;
  16161. t['odieresis'] = 0x00F6;
  16162. t['odieresiscyrillic'] = 0x04E7;
  16163. t['odotbelow'] = 0x1ECD;
  16164. t['oe'] = 0x0153;
  16165. t['oekorean'] = 0x315A;
  16166. t['ogonek'] = 0x02DB;
  16167. t['ogonekcmb'] = 0x0328;
  16168. t['ograve'] = 0x00F2;
  16169. t['ogujarati'] = 0x0A93;
  16170. t['oharmenian'] = 0x0585;
  16171. t['ohiragana'] = 0x304A;
  16172. t['ohookabove'] = 0x1ECF;
  16173. t['ohorn'] = 0x01A1;
  16174. t['ohornacute'] = 0x1EDB;
  16175. t['ohorndotbelow'] = 0x1EE3;
  16176. t['ohorngrave'] = 0x1EDD;
  16177. t['ohornhookabove'] = 0x1EDF;
  16178. t['ohorntilde'] = 0x1EE1;
  16179. t['ohungarumlaut'] = 0x0151;
  16180. t['oi'] = 0x01A3;
  16181. t['oinvertedbreve'] = 0x020F;
  16182. t['okatakana'] = 0x30AA;
  16183. t['okatakanahalfwidth'] = 0xFF75;
  16184. t['okorean'] = 0x3157;
  16185. t['olehebrew'] = 0x05AB;
  16186. t['omacron'] = 0x014D;
  16187. t['omacronacute'] = 0x1E53;
  16188. t['omacrongrave'] = 0x1E51;
  16189. t['omdeva'] = 0x0950;
  16190. t['omega'] = 0x03C9;
  16191. t['omega1'] = 0x03D6;
  16192. t['omegacyrillic'] = 0x0461;
  16193. t['omegalatinclosed'] = 0x0277;
  16194. t['omegaroundcyrillic'] = 0x047B;
  16195. t['omegatitlocyrillic'] = 0x047D;
  16196. t['omegatonos'] = 0x03CE;
  16197. t['omgujarati'] = 0x0AD0;
  16198. t['omicron'] = 0x03BF;
  16199. t['omicrontonos'] = 0x03CC;
  16200. t['omonospace'] = 0xFF4F;
  16201. t['one'] = 0x0031;
  16202. t['onearabic'] = 0x0661;
  16203. t['onebengali'] = 0x09E7;
  16204. t['onecircle'] = 0x2460;
  16205. t['onecircleinversesansserif'] = 0x278A;
  16206. t['onedeva'] = 0x0967;
  16207. t['onedotenleader'] = 0x2024;
  16208. t['oneeighth'] = 0x215B;
  16209. t['onefitted'] = 0xF6DC;
  16210. t['onegujarati'] = 0x0AE7;
  16211. t['onegurmukhi'] = 0x0A67;
  16212. t['onehackarabic'] = 0x0661;
  16213. t['onehalf'] = 0x00BD;
  16214. t['onehangzhou'] = 0x3021;
  16215. t['oneideographicparen'] = 0x3220;
  16216. t['oneinferior'] = 0x2081;
  16217. t['onemonospace'] = 0xFF11;
  16218. t['onenumeratorbengali'] = 0x09F4;
  16219. t['oneoldstyle'] = 0xF731;
  16220. t['oneparen'] = 0x2474;
  16221. t['oneperiod'] = 0x2488;
  16222. t['onepersian'] = 0x06F1;
  16223. t['onequarter'] = 0x00BC;
  16224. t['oneroman'] = 0x2170;
  16225. t['onesuperior'] = 0x00B9;
  16226. t['onethai'] = 0x0E51;
  16227. t['onethird'] = 0x2153;
  16228. t['oogonek'] = 0x01EB;
  16229. t['oogonekmacron'] = 0x01ED;
  16230. t['oogurmukhi'] = 0x0A13;
  16231. t['oomatragurmukhi'] = 0x0A4B;
  16232. t['oopen'] = 0x0254;
  16233. t['oparen'] = 0x24AA;
  16234. t['openbullet'] = 0x25E6;
  16235. t['option'] = 0x2325;
  16236. t['ordfeminine'] = 0x00AA;
  16237. t['ordmasculine'] = 0x00BA;
  16238. t['orthogonal'] = 0x221F;
  16239. t['oshortdeva'] = 0x0912;
  16240. t['oshortvowelsigndeva'] = 0x094A;
  16241. t['oslash'] = 0x00F8;
  16242. t['oslashacute'] = 0x01FF;
  16243. t['osmallhiragana'] = 0x3049;
  16244. t['osmallkatakana'] = 0x30A9;
  16245. t['osmallkatakanahalfwidth'] = 0xFF6B;
  16246. t['ostrokeacute'] = 0x01FF;
  16247. t['osuperior'] = 0xF6F0;
  16248. t['otcyrillic'] = 0x047F;
  16249. t['otilde'] = 0x00F5;
  16250. t['otildeacute'] = 0x1E4D;
  16251. t['otildedieresis'] = 0x1E4F;
  16252. t['oubopomofo'] = 0x3121;
  16253. t['overline'] = 0x203E;
  16254. t['overlinecenterline'] = 0xFE4A;
  16255. t['overlinecmb'] = 0x0305;
  16256. t['overlinedashed'] = 0xFE49;
  16257. t['overlinedblwavy'] = 0xFE4C;
  16258. t['overlinewavy'] = 0xFE4B;
  16259. t['overscore'] = 0x00AF;
  16260. t['ovowelsignbengali'] = 0x09CB;
  16261. t['ovowelsigndeva'] = 0x094B;
  16262. t['ovowelsigngujarati'] = 0x0ACB;
  16263. t['p'] = 0x0070;
  16264. t['paampssquare'] = 0x3380;
  16265. t['paasentosquare'] = 0x332B;
  16266. t['pabengali'] = 0x09AA;
  16267. t['pacute'] = 0x1E55;
  16268. t['padeva'] = 0x092A;
  16269. t['pagedown'] = 0x21DF;
  16270. t['pageup'] = 0x21DE;
  16271. t['pagujarati'] = 0x0AAA;
  16272. t['pagurmukhi'] = 0x0A2A;
  16273. t['pahiragana'] = 0x3071;
  16274. t['paiyannoithai'] = 0x0E2F;
  16275. t['pakatakana'] = 0x30D1;
  16276. t['palatalizationcyrilliccmb'] = 0x0484;
  16277. t['palochkacyrillic'] = 0x04C0;
  16278. t['pansioskorean'] = 0x317F;
  16279. t['paragraph'] = 0x00B6;
  16280. t['parallel'] = 0x2225;
  16281. t['parenleft'] = 0x0028;
  16282. t['parenleftaltonearabic'] = 0xFD3E;
  16283. t['parenleftbt'] = 0xF8ED;
  16284. t['parenleftex'] = 0xF8EC;
  16285. t['parenleftinferior'] = 0x208D;
  16286. t['parenleftmonospace'] = 0xFF08;
  16287. t['parenleftsmall'] = 0xFE59;
  16288. t['parenleftsuperior'] = 0x207D;
  16289. t['parenlefttp'] = 0xF8EB;
  16290. t['parenleftvertical'] = 0xFE35;
  16291. t['parenright'] = 0x0029;
  16292. t['parenrightaltonearabic'] = 0xFD3F;
  16293. t['parenrightbt'] = 0xF8F8;
  16294. t['parenrightex'] = 0xF8F7;
  16295. t['parenrightinferior'] = 0x208E;
  16296. t['parenrightmonospace'] = 0xFF09;
  16297. t['parenrightsmall'] = 0xFE5A;
  16298. t['parenrightsuperior'] = 0x207E;
  16299. t['parenrighttp'] = 0xF8F6;
  16300. t['parenrightvertical'] = 0xFE36;
  16301. t['partialdiff'] = 0x2202;
  16302. t['paseqhebrew'] = 0x05C0;
  16303. t['pashtahebrew'] = 0x0599;
  16304. t['pasquare'] = 0x33A9;
  16305. t['patah'] = 0x05B7;
  16306. t['patah11'] = 0x05B7;
  16307. t['patah1d'] = 0x05B7;
  16308. t['patah2a'] = 0x05B7;
  16309. t['patahhebrew'] = 0x05B7;
  16310. t['patahnarrowhebrew'] = 0x05B7;
  16311. t['patahquarterhebrew'] = 0x05B7;
  16312. t['patahwidehebrew'] = 0x05B7;
  16313. t['pazerhebrew'] = 0x05A1;
  16314. t['pbopomofo'] = 0x3106;
  16315. t['pcircle'] = 0x24DF;
  16316. t['pdotaccent'] = 0x1E57;
  16317. t['pe'] = 0x05E4;
  16318. t['pecyrillic'] = 0x043F;
  16319. t['pedagesh'] = 0xFB44;
  16320. t['pedageshhebrew'] = 0xFB44;
  16321. t['peezisquare'] = 0x333B;
  16322. t['pefinaldageshhebrew'] = 0xFB43;
  16323. t['peharabic'] = 0x067E;
  16324. t['peharmenian'] = 0x057A;
  16325. t['pehebrew'] = 0x05E4;
  16326. t['pehfinalarabic'] = 0xFB57;
  16327. t['pehinitialarabic'] = 0xFB58;
  16328. t['pehiragana'] = 0x307A;
  16329. t['pehmedialarabic'] = 0xFB59;
  16330. t['pekatakana'] = 0x30DA;
  16331. t['pemiddlehookcyrillic'] = 0x04A7;
  16332. t['perafehebrew'] = 0xFB4E;
  16333. t['percent'] = 0x0025;
  16334. t['percentarabic'] = 0x066A;
  16335. t['percentmonospace'] = 0xFF05;
  16336. t['percentsmall'] = 0xFE6A;
  16337. t['period'] = 0x002E;
  16338. t['periodarmenian'] = 0x0589;
  16339. t['periodcentered'] = 0x00B7;
  16340. t['periodhalfwidth'] = 0xFF61;
  16341. t['periodinferior'] = 0xF6E7;
  16342. t['periodmonospace'] = 0xFF0E;
  16343. t['periodsmall'] = 0xFE52;
  16344. t['periodsuperior'] = 0xF6E8;
  16345. t['perispomenigreekcmb'] = 0x0342;
  16346. t['perpendicular'] = 0x22A5;
  16347. t['perthousand'] = 0x2030;
  16348. t['peseta'] = 0x20A7;
  16349. t['pfsquare'] = 0x338A;
  16350. t['phabengali'] = 0x09AB;
  16351. t['phadeva'] = 0x092B;
  16352. t['phagujarati'] = 0x0AAB;
  16353. t['phagurmukhi'] = 0x0A2B;
  16354. t['phi'] = 0x03C6;
  16355. t['phi1'] = 0x03D5;
  16356. t['phieuphacirclekorean'] = 0x327A;
  16357. t['phieuphaparenkorean'] = 0x321A;
  16358. t['phieuphcirclekorean'] = 0x326C;
  16359. t['phieuphkorean'] = 0x314D;
  16360. t['phieuphparenkorean'] = 0x320C;
  16361. t['philatin'] = 0x0278;
  16362. t['phinthuthai'] = 0x0E3A;
  16363. t['phisymbolgreek'] = 0x03D5;
  16364. t['phook'] = 0x01A5;
  16365. t['phophanthai'] = 0x0E1E;
  16366. t['phophungthai'] = 0x0E1C;
  16367. t['phosamphaothai'] = 0x0E20;
  16368. t['pi'] = 0x03C0;
  16369. t['pieupacirclekorean'] = 0x3273;
  16370. t['pieupaparenkorean'] = 0x3213;
  16371. t['pieupcieuckorean'] = 0x3176;
  16372. t['pieupcirclekorean'] = 0x3265;
  16373. t['pieupkiyeokkorean'] = 0x3172;
  16374. t['pieupkorean'] = 0x3142;
  16375. t['pieupparenkorean'] = 0x3205;
  16376. t['pieupsioskiyeokkorean'] = 0x3174;
  16377. t['pieupsioskorean'] = 0x3144;
  16378. t['pieupsiostikeutkorean'] = 0x3175;
  16379. t['pieupthieuthkorean'] = 0x3177;
  16380. t['pieuptikeutkorean'] = 0x3173;
  16381. t['pihiragana'] = 0x3074;
  16382. t['pikatakana'] = 0x30D4;
  16383. t['pisymbolgreek'] = 0x03D6;
  16384. t['piwrarmenian'] = 0x0583;
  16385. t['plus'] = 0x002B;
  16386. t['plusbelowcmb'] = 0x031F;
  16387. t['pluscircle'] = 0x2295;
  16388. t['plusminus'] = 0x00B1;
  16389. t['plusmod'] = 0x02D6;
  16390. t['plusmonospace'] = 0xFF0B;
  16391. t['plussmall'] = 0xFE62;
  16392. t['plussuperior'] = 0x207A;
  16393. t['pmonospace'] = 0xFF50;
  16394. t['pmsquare'] = 0x33D8;
  16395. t['pohiragana'] = 0x307D;
  16396. t['pointingindexdownwhite'] = 0x261F;
  16397. t['pointingindexleftwhite'] = 0x261C;
  16398. t['pointingindexrightwhite'] = 0x261E;
  16399. t['pointingindexupwhite'] = 0x261D;
  16400. t['pokatakana'] = 0x30DD;
  16401. t['poplathai'] = 0x0E1B;
  16402. t['postalmark'] = 0x3012;
  16403. t['postalmarkface'] = 0x3020;
  16404. t['pparen'] = 0x24AB;
  16405. t['precedes'] = 0x227A;
  16406. t['prescription'] = 0x211E;
  16407. t['primemod'] = 0x02B9;
  16408. t['primereversed'] = 0x2035;
  16409. t['product'] = 0x220F;
  16410. t['projective'] = 0x2305;
  16411. t['prolongedkana'] = 0x30FC;
  16412. t['propellor'] = 0x2318;
  16413. t['propersubset'] = 0x2282;
  16414. t['propersuperset'] = 0x2283;
  16415. t['proportion'] = 0x2237;
  16416. t['proportional'] = 0x221D;
  16417. t['psi'] = 0x03C8;
  16418. t['psicyrillic'] = 0x0471;
  16419. t['psilipneumatacyrilliccmb'] = 0x0486;
  16420. t['pssquare'] = 0x33B0;
  16421. t['puhiragana'] = 0x3077;
  16422. t['pukatakana'] = 0x30D7;
  16423. t['pvsquare'] = 0x33B4;
  16424. t['pwsquare'] = 0x33BA;
  16425. t['q'] = 0x0071;
  16426. t['qadeva'] = 0x0958;
  16427. t['qadmahebrew'] = 0x05A8;
  16428. t['qafarabic'] = 0x0642;
  16429. t['qaffinalarabic'] = 0xFED6;
  16430. t['qafinitialarabic'] = 0xFED7;
  16431. t['qafmedialarabic'] = 0xFED8;
  16432. t['qamats'] = 0x05B8;
  16433. t['qamats10'] = 0x05B8;
  16434. t['qamats1a'] = 0x05B8;
  16435. t['qamats1c'] = 0x05B8;
  16436. t['qamats27'] = 0x05B8;
  16437. t['qamats29'] = 0x05B8;
  16438. t['qamats33'] = 0x05B8;
  16439. t['qamatsde'] = 0x05B8;
  16440. t['qamatshebrew'] = 0x05B8;
  16441. t['qamatsnarrowhebrew'] = 0x05B8;
  16442. t['qamatsqatanhebrew'] = 0x05B8;
  16443. t['qamatsqatannarrowhebrew'] = 0x05B8;
  16444. t['qamatsqatanquarterhebrew'] = 0x05B8;
  16445. t['qamatsqatanwidehebrew'] = 0x05B8;
  16446. t['qamatsquarterhebrew'] = 0x05B8;
  16447. t['qamatswidehebrew'] = 0x05B8;
  16448. t['qarneyparahebrew'] = 0x059F;
  16449. t['qbopomofo'] = 0x3111;
  16450. t['qcircle'] = 0x24E0;
  16451. t['qhook'] = 0x02A0;
  16452. t['qmonospace'] = 0xFF51;
  16453. t['qof'] = 0x05E7;
  16454. t['qofdagesh'] = 0xFB47;
  16455. t['qofdageshhebrew'] = 0xFB47;
  16456. t['qofhebrew'] = 0x05E7;
  16457. t['qparen'] = 0x24AC;
  16458. t['quarternote'] = 0x2669;
  16459. t['qubuts'] = 0x05BB;
  16460. t['qubuts18'] = 0x05BB;
  16461. t['qubuts25'] = 0x05BB;
  16462. t['qubuts31'] = 0x05BB;
  16463. t['qubutshebrew'] = 0x05BB;
  16464. t['qubutsnarrowhebrew'] = 0x05BB;
  16465. t['qubutsquarterhebrew'] = 0x05BB;
  16466. t['qubutswidehebrew'] = 0x05BB;
  16467. t['question'] = 0x003F;
  16468. t['questionarabic'] = 0x061F;
  16469. t['questionarmenian'] = 0x055E;
  16470. t['questiondown'] = 0x00BF;
  16471. t['questiondownsmall'] = 0xF7BF;
  16472. t['questiongreek'] = 0x037E;
  16473. t['questionmonospace'] = 0xFF1F;
  16474. t['questionsmall'] = 0xF73F;
  16475. t['quotedbl'] = 0x0022;
  16476. t['quotedblbase'] = 0x201E;
  16477. t['quotedblleft'] = 0x201C;
  16478. t['quotedblmonospace'] = 0xFF02;
  16479. t['quotedblprime'] = 0x301E;
  16480. t['quotedblprimereversed'] = 0x301D;
  16481. t['quotedblright'] = 0x201D;
  16482. t['quoteleft'] = 0x2018;
  16483. t['quoteleftreversed'] = 0x201B;
  16484. t['quotereversed'] = 0x201B;
  16485. t['quoteright'] = 0x2019;
  16486. t['quoterightn'] = 0x0149;
  16487. t['quotesinglbase'] = 0x201A;
  16488. t['quotesingle'] = 0x0027;
  16489. t['quotesinglemonospace'] = 0xFF07;
  16490. t['r'] = 0x0072;
  16491. t['raarmenian'] = 0x057C;
  16492. t['rabengali'] = 0x09B0;
  16493. t['racute'] = 0x0155;
  16494. t['radeva'] = 0x0930;
  16495. t['radical'] = 0x221A;
  16496. t['radicalex'] = 0xF8E5;
  16497. t['radoverssquare'] = 0x33AE;
  16498. t['radoverssquaredsquare'] = 0x33AF;
  16499. t['radsquare'] = 0x33AD;
  16500. t['rafe'] = 0x05BF;
  16501. t['rafehebrew'] = 0x05BF;
  16502. t['ragujarati'] = 0x0AB0;
  16503. t['ragurmukhi'] = 0x0A30;
  16504. t['rahiragana'] = 0x3089;
  16505. t['rakatakana'] = 0x30E9;
  16506. t['rakatakanahalfwidth'] = 0xFF97;
  16507. t['ralowerdiagonalbengali'] = 0x09F1;
  16508. t['ramiddlediagonalbengali'] = 0x09F0;
  16509. t['ramshorn'] = 0x0264;
  16510. t['ratio'] = 0x2236;
  16511. t['rbopomofo'] = 0x3116;
  16512. t['rcaron'] = 0x0159;
  16513. t['rcedilla'] = 0x0157;
  16514. t['rcircle'] = 0x24E1;
  16515. t['rcommaaccent'] = 0x0157;
  16516. t['rdblgrave'] = 0x0211;
  16517. t['rdotaccent'] = 0x1E59;
  16518. t['rdotbelow'] = 0x1E5B;
  16519. t['rdotbelowmacron'] = 0x1E5D;
  16520. t['referencemark'] = 0x203B;
  16521. t['reflexsubset'] = 0x2286;
  16522. t['reflexsuperset'] = 0x2287;
  16523. t['registered'] = 0x00AE;
  16524. t['registersans'] = 0xF8E8;
  16525. t['registerserif'] = 0xF6DA;
  16526. t['reharabic'] = 0x0631;
  16527. t['reharmenian'] = 0x0580;
  16528. t['rehfinalarabic'] = 0xFEAE;
  16529. t['rehiragana'] = 0x308C;
  16530. t['rekatakana'] = 0x30EC;
  16531. t['rekatakanahalfwidth'] = 0xFF9A;
  16532. t['resh'] = 0x05E8;
  16533. t['reshdageshhebrew'] = 0xFB48;
  16534. t['reshhebrew'] = 0x05E8;
  16535. t['reversedtilde'] = 0x223D;
  16536. t['reviahebrew'] = 0x0597;
  16537. t['reviamugrashhebrew'] = 0x0597;
  16538. t['revlogicalnot'] = 0x2310;
  16539. t['rfishhook'] = 0x027E;
  16540. t['rfishhookreversed'] = 0x027F;
  16541. t['rhabengali'] = 0x09DD;
  16542. t['rhadeva'] = 0x095D;
  16543. t['rho'] = 0x03C1;
  16544. t['rhook'] = 0x027D;
  16545. t['rhookturned'] = 0x027B;
  16546. t['rhookturnedsuperior'] = 0x02B5;
  16547. t['rhosymbolgreek'] = 0x03F1;
  16548. t['rhotichookmod'] = 0x02DE;
  16549. t['rieulacirclekorean'] = 0x3271;
  16550. t['rieulaparenkorean'] = 0x3211;
  16551. t['rieulcirclekorean'] = 0x3263;
  16552. t['rieulhieuhkorean'] = 0x3140;
  16553. t['rieulkiyeokkorean'] = 0x313A;
  16554. t['rieulkiyeoksioskorean'] = 0x3169;
  16555. t['rieulkorean'] = 0x3139;
  16556. t['rieulmieumkorean'] = 0x313B;
  16557. t['rieulpansioskorean'] = 0x316C;
  16558. t['rieulparenkorean'] = 0x3203;
  16559. t['rieulphieuphkorean'] = 0x313F;
  16560. t['rieulpieupkorean'] = 0x313C;
  16561. t['rieulpieupsioskorean'] = 0x316B;
  16562. t['rieulsioskorean'] = 0x313D;
  16563. t['rieulthieuthkorean'] = 0x313E;
  16564. t['rieultikeutkorean'] = 0x316A;
  16565. t['rieulyeorinhieuhkorean'] = 0x316D;
  16566. t['rightangle'] = 0x221F;
  16567. t['righttackbelowcmb'] = 0x0319;
  16568. t['righttriangle'] = 0x22BF;
  16569. t['rihiragana'] = 0x308A;
  16570. t['rikatakana'] = 0x30EA;
  16571. t['rikatakanahalfwidth'] = 0xFF98;
  16572. t['ring'] = 0x02DA;
  16573. t['ringbelowcmb'] = 0x0325;
  16574. t['ringcmb'] = 0x030A;
  16575. t['ringhalfleft'] = 0x02BF;
  16576. t['ringhalfleftarmenian'] = 0x0559;
  16577. t['ringhalfleftbelowcmb'] = 0x031C;
  16578. t['ringhalfleftcentered'] = 0x02D3;
  16579. t['ringhalfright'] = 0x02BE;
  16580. t['ringhalfrightbelowcmb'] = 0x0339;
  16581. t['ringhalfrightcentered'] = 0x02D2;
  16582. t['rinvertedbreve'] = 0x0213;
  16583. t['rittorusquare'] = 0x3351;
  16584. t['rlinebelow'] = 0x1E5F;
  16585. t['rlongleg'] = 0x027C;
  16586. t['rlonglegturned'] = 0x027A;
  16587. t['rmonospace'] = 0xFF52;
  16588. t['rohiragana'] = 0x308D;
  16589. t['rokatakana'] = 0x30ED;
  16590. t['rokatakanahalfwidth'] = 0xFF9B;
  16591. t['roruathai'] = 0x0E23;
  16592. t['rparen'] = 0x24AD;
  16593. t['rrabengali'] = 0x09DC;
  16594. t['rradeva'] = 0x0931;
  16595. t['rragurmukhi'] = 0x0A5C;
  16596. t['rreharabic'] = 0x0691;
  16597. t['rrehfinalarabic'] = 0xFB8D;
  16598. t['rrvocalicbengali'] = 0x09E0;
  16599. t['rrvocalicdeva'] = 0x0960;
  16600. t['rrvocalicgujarati'] = 0x0AE0;
  16601. t['rrvocalicvowelsignbengali'] = 0x09C4;
  16602. t['rrvocalicvowelsigndeva'] = 0x0944;
  16603. t['rrvocalicvowelsigngujarati'] = 0x0AC4;
  16604. t['rsuperior'] = 0xF6F1;
  16605. t['rtblock'] = 0x2590;
  16606. t['rturned'] = 0x0279;
  16607. t['rturnedsuperior'] = 0x02B4;
  16608. t['ruhiragana'] = 0x308B;
  16609. t['rukatakana'] = 0x30EB;
  16610. t['rukatakanahalfwidth'] = 0xFF99;
  16611. t['rupeemarkbengali'] = 0x09F2;
  16612. t['rupeesignbengali'] = 0x09F3;
  16613. t['rupiah'] = 0xF6DD;
  16614. t['ruthai'] = 0x0E24;
  16615. t['rvocalicbengali'] = 0x098B;
  16616. t['rvocalicdeva'] = 0x090B;
  16617. t['rvocalicgujarati'] = 0x0A8B;
  16618. t['rvocalicvowelsignbengali'] = 0x09C3;
  16619. t['rvocalicvowelsigndeva'] = 0x0943;
  16620. t['rvocalicvowelsigngujarati'] = 0x0AC3;
  16621. t['s'] = 0x0073;
  16622. t['sabengali'] = 0x09B8;
  16623. t['sacute'] = 0x015B;
  16624. t['sacutedotaccent'] = 0x1E65;
  16625. t['sadarabic'] = 0x0635;
  16626. t['sadeva'] = 0x0938;
  16627. t['sadfinalarabic'] = 0xFEBA;
  16628. t['sadinitialarabic'] = 0xFEBB;
  16629. t['sadmedialarabic'] = 0xFEBC;
  16630. t['sagujarati'] = 0x0AB8;
  16631. t['sagurmukhi'] = 0x0A38;
  16632. t['sahiragana'] = 0x3055;
  16633. t['sakatakana'] = 0x30B5;
  16634. t['sakatakanahalfwidth'] = 0xFF7B;
  16635. t['sallallahoualayhewasallamarabic'] = 0xFDFA;
  16636. t['samekh'] = 0x05E1;
  16637. t['samekhdagesh'] = 0xFB41;
  16638. t['samekhdageshhebrew'] = 0xFB41;
  16639. t['samekhhebrew'] = 0x05E1;
  16640. t['saraaathai'] = 0x0E32;
  16641. t['saraaethai'] = 0x0E41;
  16642. t['saraaimaimalaithai'] = 0x0E44;
  16643. t['saraaimaimuanthai'] = 0x0E43;
  16644. t['saraamthai'] = 0x0E33;
  16645. t['saraathai'] = 0x0E30;
  16646. t['saraethai'] = 0x0E40;
  16647. t['saraiileftthai'] = 0xF886;
  16648. t['saraiithai'] = 0x0E35;
  16649. t['saraileftthai'] = 0xF885;
  16650. t['saraithai'] = 0x0E34;
  16651. t['saraothai'] = 0x0E42;
  16652. t['saraueeleftthai'] = 0xF888;
  16653. t['saraueethai'] = 0x0E37;
  16654. t['saraueleftthai'] = 0xF887;
  16655. t['sarauethai'] = 0x0E36;
  16656. t['sarauthai'] = 0x0E38;
  16657. t['sarauuthai'] = 0x0E39;
  16658. t['sbopomofo'] = 0x3119;
  16659. t['scaron'] = 0x0161;
  16660. t['scarondotaccent'] = 0x1E67;
  16661. t['scedilla'] = 0x015F;
  16662. t['schwa'] = 0x0259;
  16663. t['schwacyrillic'] = 0x04D9;
  16664. t['schwadieresiscyrillic'] = 0x04DB;
  16665. t['schwahook'] = 0x025A;
  16666. t['scircle'] = 0x24E2;
  16667. t['scircumflex'] = 0x015D;
  16668. t['scommaaccent'] = 0x0219;
  16669. t['sdotaccent'] = 0x1E61;
  16670. t['sdotbelow'] = 0x1E63;
  16671. t['sdotbelowdotaccent'] = 0x1E69;
  16672. t['seagullbelowcmb'] = 0x033C;
  16673. t['second'] = 0x2033;
  16674. t['secondtonechinese'] = 0x02CA;
  16675. t['section'] = 0x00A7;
  16676. t['seenarabic'] = 0x0633;
  16677. t['seenfinalarabic'] = 0xFEB2;
  16678. t['seeninitialarabic'] = 0xFEB3;
  16679. t['seenmedialarabic'] = 0xFEB4;
  16680. t['segol'] = 0x05B6;
  16681. t['segol13'] = 0x05B6;
  16682. t['segol1f'] = 0x05B6;
  16683. t['segol2c'] = 0x05B6;
  16684. t['segolhebrew'] = 0x05B6;
  16685. t['segolnarrowhebrew'] = 0x05B6;
  16686. t['segolquarterhebrew'] = 0x05B6;
  16687. t['segoltahebrew'] = 0x0592;
  16688. t['segolwidehebrew'] = 0x05B6;
  16689. t['seharmenian'] = 0x057D;
  16690. t['sehiragana'] = 0x305B;
  16691. t['sekatakana'] = 0x30BB;
  16692. t['sekatakanahalfwidth'] = 0xFF7E;
  16693. t['semicolon'] = 0x003B;
  16694. t['semicolonarabic'] = 0x061B;
  16695. t['semicolonmonospace'] = 0xFF1B;
  16696. t['semicolonsmall'] = 0xFE54;
  16697. t['semivoicedmarkkana'] = 0x309C;
  16698. t['semivoicedmarkkanahalfwidth'] = 0xFF9F;
  16699. t['sentisquare'] = 0x3322;
  16700. t['sentosquare'] = 0x3323;
  16701. t['seven'] = 0x0037;
  16702. t['sevenarabic'] = 0x0667;
  16703. t['sevenbengali'] = 0x09ED;
  16704. t['sevencircle'] = 0x2466;
  16705. t['sevencircleinversesansserif'] = 0x2790;
  16706. t['sevendeva'] = 0x096D;
  16707. t['seveneighths'] = 0x215E;
  16708. t['sevengujarati'] = 0x0AED;
  16709. t['sevengurmukhi'] = 0x0A6D;
  16710. t['sevenhackarabic'] = 0x0667;
  16711. t['sevenhangzhou'] = 0x3027;
  16712. t['sevenideographicparen'] = 0x3226;
  16713. t['seveninferior'] = 0x2087;
  16714. t['sevenmonospace'] = 0xFF17;
  16715. t['sevenoldstyle'] = 0xF737;
  16716. t['sevenparen'] = 0x247A;
  16717. t['sevenperiod'] = 0x248E;
  16718. t['sevenpersian'] = 0x06F7;
  16719. t['sevenroman'] = 0x2176;
  16720. t['sevensuperior'] = 0x2077;
  16721. t['seventeencircle'] = 0x2470;
  16722. t['seventeenparen'] = 0x2484;
  16723. t['seventeenperiod'] = 0x2498;
  16724. t['seventhai'] = 0x0E57;
  16725. t['sfthyphen'] = 0x00AD;
  16726. t['shaarmenian'] = 0x0577;
  16727. t['shabengali'] = 0x09B6;
  16728. t['shacyrillic'] = 0x0448;
  16729. t['shaddaarabic'] = 0x0651;
  16730. t['shaddadammaarabic'] = 0xFC61;
  16731. t['shaddadammatanarabic'] = 0xFC5E;
  16732. t['shaddafathaarabic'] = 0xFC60;
  16733. t['shaddakasraarabic'] = 0xFC62;
  16734. t['shaddakasratanarabic'] = 0xFC5F;
  16735. t['shade'] = 0x2592;
  16736. t['shadedark'] = 0x2593;
  16737. t['shadelight'] = 0x2591;
  16738. t['shademedium'] = 0x2592;
  16739. t['shadeva'] = 0x0936;
  16740. t['shagujarati'] = 0x0AB6;
  16741. t['shagurmukhi'] = 0x0A36;
  16742. t['shalshelethebrew'] = 0x0593;
  16743. t['shbopomofo'] = 0x3115;
  16744. t['shchacyrillic'] = 0x0449;
  16745. t['sheenarabic'] = 0x0634;
  16746. t['sheenfinalarabic'] = 0xFEB6;
  16747. t['sheeninitialarabic'] = 0xFEB7;
  16748. t['sheenmedialarabic'] = 0xFEB8;
  16749. t['sheicoptic'] = 0x03E3;
  16750. t['sheqel'] = 0x20AA;
  16751. t['sheqelhebrew'] = 0x20AA;
  16752. t['sheva'] = 0x05B0;
  16753. t['sheva115'] = 0x05B0;
  16754. t['sheva15'] = 0x05B0;
  16755. t['sheva22'] = 0x05B0;
  16756. t['sheva2e'] = 0x05B0;
  16757. t['shevahebrew'] = 0x05B0;
  16758. t['shevanarrowhebrew'] = 0x05B0;
  16759. t['shevaquarterhebrew'] = 0x05B0;
  16760. t['shevawidehebrew'] = 0x05B0;
  16761. t['shhacyrillic'] = 0x04BB;
  16762. t['shimacoptic'] = 0x03ED;
  16763. t['shin'] = 0x05E9;
  16764. t['shindagesh'] = 0xFB49;
  16765. t['shindageshhebrew'] = 0xFB49;
  16766. t['shindageshshindot'] = 0xFB2C;
  16767. t['shindageshshindothebrew'] = 0xFB2C;
  16768. t['shindageshsindot'] = 0xFB2D;
  16769. t['shindageshsindothebrew'] = 0xFB2D;
  16770. t['shindothebrew'] = 0x05C1;
  16771. t['shinhebrew'] = 0x05E9;
  16772. t['shinshindot'] = 0xFB2A;
  16773. t['shinshindothebrew'] = 0xFB2A;
  16774. t['shinsindot'] = 0xFB2B;
  16775. t['shinsindothebrew'] = 0xFB2B;
  16776. t['shook'] = 0x0282;
  16777. t['sigma'] = 0x03C3;
  16778. t['sigma1'] = 0x03C2;
  16779. t['sigmafinal'] = 0x03C2;
  16780. t['sigmalunatesymbolgreek'] = 0x03F2;
  16781. t['sihiragana'] = 0x3057;
  16782. t['sikatakana'] = 0x30B7;
  16783. t['sikatakanahalfwidth'] = 0xFF7C;
  16784. t['siluqhebrew'] = 0x05BD;
  16785. t['siluqlefthebrew'] = 0x05BD;
  16786. t['similar'] = 0x223C;
  16787. t['sindothebrew'] = 0x05C2;
  16788. t['siosacirclekorean'] = 0x3274;
  16789. t['siosaparenkorean'] = 0x3214;
  16790. t['sioscieuckorean'] = 0x317E;
  16791. t['sioscirclekorean'] = 0x3266;
  16792. t['sioskiyeokkorean'] = 0x317A;
  16793. t['sioskorean'] = 0x3145;
  16794. t['siosnieunkorean'] = 0x317B;
  16795. t['siosparenkorean'] = 0x3206;
  16796. t['siospieupkorean'] = 0x317D;
  16797. t['siostikeutkorean'] = 0x317C;
  16798. t['six'] = 0x0036;
  16799. t['sixarabic'] = 0x0666;
  16800. t['sixbengali'] = 0x09EC;
  16801. t['sixcircle'] = 0x2465;
  16802. t['sixcircleinversesansserif'] = 0x278F;
  16803. t['sixdeva'] = 0x096C;
  16804. t['sixgujarati'] = 0x0AEC;
  16805. t['sixgurmukhi'] = 0x0A6C;
  16806. t['sixhackarabic'] = 0x0666;
  16807. t['sixhangzhou'] = 0x3026;
  16808. t['sixideographicparen'] = 0x3225;
  16809. t['sixinferior'] = 0x2086;
  16810. t['sixmonospace'] = 0xFF16;
  16811. t['sixoldstyle'] = 0xF736;
  16812. t['sixparen'] = 0x2479;
  16813. t['sixperiod'] = 0x248D;
  16814. t['sixpersian'] = 0x06F6;
  16815. t['sixroman'] = 0x2175;
  16816. t['sixsuperior'] = 0x2076;
  16817. t['sixteencircle'] = 0x246F;
  16818. t['sixteencurrencydenominatorbengali'] = 0x09F9;
  16819. t['sixteenparen'] = 0x2483;
  16820. t['sixteenperiod'] = 0x2497;
  16821. t['sixthai'] = 0x0E56;
  16822. t['slash'] = 0x002F;
  16823. t['slashmonospace'] = 0xFF0F;
  16824. t['slong'] = 0x017F;
  16825. t['slongdotaccent'] = 0x1E9B;
  16826. t['smileface'] = 0x263A;
  16827. t['smonospace'] = 0xFF53;
  16828. t['sofpasuqhebrew'] = 0x05C3;
  16829. t['softhyphen'] = 0x00AD;
  16830. t['softsigncyrillic'] = 0x044C;
  16831. t['sohiragana'] = 0x305D;
  16832. t['sokatakana'] = 0x30BD;
  16833. t['sokatakanahalfwidth'] = 0xFF7F;
  16834. t['soliduslongoverlaycmb'] = 0x0338;
  16835. t['solidusshortoverlaycmb'] = 0x0337;
  16836. t['sorusithai'] = 0x0E29;
  16837. t['sosalathai'] = 0x0E28;
  16838. t['sosothai'] = 0x0E0B;
  16839. t['sosuathai'] = 0x0E2A;
  16840. t['space'] = 0x0020;
  16841. t['spacehackarabic'] = 0x0020;
  16842. t['spade'] = 0x2660;
  16843. t['spadesuitblack'] = 0x2660;
  16844. t['spadesuitwhite'] = 0x2664;
  16845. t['sparen'] = 0x24AE;
  16846. t['squarebelowcmb'] = 0x033B;
  16847. t['squarecc'] = 0x33C4;
  16848. t['squarecm'] = 0x339D;
  16849. t['squarediagonalcrosshatchfill'] = 0x25A9;
  16850. t['squarehorizontalfill'] = 0x25A4;
  16851. t['squarekg'] = 0x338F;
  16852. t['squarekm'] = 0x339E;
  16853. t['squarekmcapital'] = 0x33CE;
  16854. t['squareln'] = 0x33D1;
  16855. t['squarelog'] = 0x33D2;
  16856. t['squaremg'] = 0x338E;
  16857. t['squaremil'] = 0x33D5;
  16858. t['squaremm'] = 0x339C;
  16859. t['squaremsquared'] = 0x33A1;
  16860. t['squareorthogonalcrosshatchfill'] = 0x25A6;
  16861. t['squareupperlefttolowerrightfill'] = 0x25A7;
  16862. t['squareupperrighttolowerleftfill'] = 0x25A8;
  16863. t['squareverticalfill'] = 0x25A5;
  16864. t['squarewhitewithsmallblack'] = 0x25A3;
  16865. t['srsquare'] = 0x33DB;
  16866. t['ssabengali'] = 0x09B7;
  16867. t['ssadeva'] = 0x0937;
  16868. t['ssagujarati'] = 0x0AB7;
  16869. t['ssangcieuckorean'] = 0x3149;
  16870. t['ssanghieuhkorean'] = 0x3185;
  16871. t['ssangieungkorean'] = 0x3180;
  16872. t['ssangkiyeokkorean'] = 0x3132;
  16873. t['ssangnieunkorean'] = 0x3165;
  16874. t['ssangpieupkorean'] = 0x3143;
  16875. t['ssangsioskorean'] = 0x3146;
  16876. t['ssangtikeutkorean'] = 0x3138;
  16877. t['ssuperior'] = 0xF6F2;
  16878. t['sterling'] = 0x00A3;
  16879. t['sterlingmonospace'] = 0xFFE1;
  16880. t['strokelongoverlaycmb'] = 0x0336;
  16881. t['strokeshortoverlaycmb'] = 0x0335;
  16882. t['subset'] = 0x2282;
  16883. t['subsetnotequal'] = 0x228A;
  16884. t['subsetorequal'] = 0x2286;
  16885. t['succeeds'] = 0x227B;
  16886. t['suchthat'] = 0x220B;
  16887. t['suhiragana'] = 0x3059;
  16888. t['sukatakana'] = 0x30B9;
  16889. t['sukatakanahalfwidth'] = 0xFF7D;
  16890. t['sukunarabic'] = 0x0652;
  16891. t['summation'] = 0x2211;
  16892. t['sun'] = 0x263C;
  16893. t['superset'] = 0x2283;
  16894. t['supersetnotequal'] = 0x228B;
  16895. t['supersetorequal'] = 0x2287;
  16896. t['svsquare'] = 0x33DC;
  16897. t['syouwaerasquare'] = 0x337C;
  16898. t['t'] = 0x0074;
  16899. t['tabengali'] = 0x09A4;
  16900. t['tackdown'] = 0x22A4;
  16901. t['tackleft'] = 0x22A3;
  16902. t['tadeva'] = 0x0924;
  16903. t['tagujarati'] = 0x0AA4;
  16904. t['tagurmukhi'] = 0x0A24;
  16905. t['taharabic'] = 0x0637;
  16906. t['tahfinalarabic'] = 0xFEC2;
  16907. t['tahinitialarabic'] = 0xFEC3;
  16908. t['tahiragana'] = 0x305F;
  16909. t['tahmedialarabic'] = 0xFEC4;
  16910. t['taisyouerasquare'] = 0x337D;
  16911. t['takatakana'] = 0x30BF;
  16912. t['takatakanahalfwidth'] = 0xFF80;
  16913. t['tatweelarabic'] = 0x0640;
  16914. t['tau'] = 0x03C4;
  16915. t['tav'] = 0x05EA;
  16916. t['tavdages'] = 0xFB4A;
  16917. t['tavdagesh'] = 0xFB4A;
  16918. t['tavdageshhebrew'] = 0xFB4A;
  16919. t['tavhebrew'] = 0x05EA;
  16920. t['tbar'] = 0x0167;
  16921. t['tbopomofo'] = 0x310A;
  16922. t['tcaron'] = 0x0165;
  16923. t['tccurl'] = 0x02A8;
  16924. t['tcedilla'] = 0x0163;
  16925. t['tcheharabic'] = 0x0686;
  16926. t['tchehfinalarabic'] = 0xFB7B;
  16927. t['tchehinitialarabic'] = 0xFB7C;
  16928. t['tchehmedialarabic'] = 0xFB7D;
  16929. t['tcircle'] = 0x24E3;
  16930. t['tcircumflexbelow'] = 0x1E71;
  16931. t['tcommaaccent'] = 0x0163;
  16932. t['tdieresis'] = 0x1E97;
  16933. t['tdotaccent'] = 0x1E6B;
  16934. t['tdotbelow'] = 0x1E6D;
  16935. t['tecyrillic'] = 0x0442;
  16936. t['tedescendercyrillic'] = 0x04AD;
  16937. t['teharabic'] = 0x062A;
  16938. t['tehfinalarabic'] = 0xFE96;
  16939. t['tehhahinitialarabic'] = 0xFCA2;
  16940. t['tehhahisolatedarabic'] = 0xFC0C;
  16941. t['tehinitialarabic'] = 0xFE97;
  16942. t['tehiragana'] = 0x3066;
  16943. t['tehjeeminitialarabic'] = 0xFCA1;
  16944. t['tehjeemisolatedarabic'] = 0xFC0B;
  16945. t['tehmarbutaarabic'] = 0x0629;
  16946. t['tehmarbutafinalarabic'] = 0xFE94;
  16947. t['tehmedialarabic'] = 0xFE98;
  16948. t['tehmeeminitialarabic'] = 0xFCA4;
  16949. t['tehmeemisolatedarabic'] = 0xFC0E;
  16950. t['tehnoonfinalarabic'] = 0xFC73;
  16951. t['tekatakana'] = 0x30C6;
  16952. t['tekatakanahalfwidth'] = 0xFF83;
  16953. t['telephone'] = 0x2121;
  16954. t['telephoneblack'] = 0x260E;
  16955. t['telishagedolahebrew'] = 0x05A0;
  16956. t['telishaqetanahebrew'] = 0x05A9;
  16957. t['tencircle'] = 0x2469;
  16958. t['tenideographicparen'] = 0x3229;
  16959. t['tenparen'] = 0x247D;
  16960. t['tenperiod'] = 0x2491;
  16961. t['tenroman'] = 0x2179;
  16962. t['tesh'] = 0x02A7;
  16963. t['tet'] = 0x05D8;
  16964. t['tetdagesh'] = 0xFB38;
  16965. t['tetdageshhebrew'] = 0xFB38;
  16966. t['tethebrew'] = 0x05D8;
  16967. t['tetsecyrillic'] = 0x04B5;
  16968. t['tevirhebrew'] = 0x059B;
  16969. t['tevirlefthebrew'] = 0x059B;
  16970. t['thabengali'] = 0x09A5;
  16971. t['thadeva'] = 0x0925;
  16972. t['thagujarati'] = 0x0AA5;
  16973. t['thagurmukhi'] = 0x0A25;
  16974. t['thalarabic'] = 0x0630;
  16975. t['thalfinalarabic'] = 0xFEAC;
  16976. t['thanthakhatlowleftthai'] = 0xF898;
  16977. t['thanthakhatlowrightthai'] = 0xF897;
  16978. t['thanthakhatthai'] = 0x0E4C;
  16979. t['thanthakhatupperleftthai'] = 0xF896;
  16980. t['theharabic'] = 0x062B;
  16981. t['thehfinalarabic'] = 0xFE9A;
  16982. t['thehinitialarabic'] = 0xFE9B;
  16983. t['thehmedialarabic'] = 0xFE9C;
  16984. t['thereexists'] = 0x2203;
  16985. t['therefore'] = 0x2234;
  16986. t['theta'] = 0x03B8;
  16987. t['theta1'] = 0x03D1;
  16988. t['thetasymbolgreek'] = 0x03D1;
  16989. t['thieuthacirclekorean'] = 0x3279;
  16990. t['thieuthaparenkorean'] = 0x3219;
  16991. t['thieuthcirclekorean'] = 0x326B;
  16992. t['thieuthkorean'] = 0x314C;
  16993. t['thieuthparenkorean'] = 0x320B;
  16994. t['thirteencircle'] = 0x246C;
  16995. t['thirteenparen'] = 0x2480;
  16996. t['thirteenperiod'] = 0x2494;
  16997. t['thonangmonthothai'] = 0x0E11;
  16998. t['thook'] = 0x01AD;
  16999. t['thophuthaothai'] = 0x0E12;
  17000. t['thorn'] = 0x00FE;
  17001. t['thothahanthai'] = 0x0E17;
  17002. t['thothanthai'] = 0x0E10;
  17003. t['thothongthai'] = 0x0E18;
  17004. t['thothungthai'] = 0x0E16;
  17005. t['thousandcyrillic'] = 0x0482;
  17006. t['thousandsseparatorarabic'] = 0x066C;
  17007. t['thousandsseparatorpersian'] = 0x066C;
  17008. t['three'] = 0x0033;
  17009. t['threearabic'] = 0x0663;
  17010. t['threebengali'] = 0x09E9;
  17011. t['threecircle'] = 0x2462;
  17012. t['threecircleinversesansserif'] = 0x278C;
  17013. t['threedeva'] = 0x0969;
  17014. t['threeeighths'] = 0x215C;
  17015. t['threegujarati'] = 0x0AE9;
  17016. t['threegurmukhi'] = 0x0A69;
  17017. t['threehackarabic'] = 0x0663;
  17018. t['threehangzhou'] = 0x3023;
  17019. t['threeideographicparen'] = 0x3222;
  17020. t['threeinferior'] = 0x2083;
  17021. t['threemonospace'] = 0xFF13;
  17022. t['threenumeratorbengali'] = 0x09F6;
  17023. t['threeoldstyle'] = 0xF733;
  17024. t['threeparen'] = 0x2476;
  17025. t['threeperiod'] = 0x248A;
  17026. t['threepersian'] = 0x06F3;
  17027. t['threequarters'] = 0x00BE;
  17028. t['threequartersemdash'] = 0xF6DE;
  17029. t['threeroman'] = 0x2172;
  17030. t['threesuperior'] = 0x00B3;
  17031. t['threethai'] = 0x0E53;
  17032. t['thzsquare'] = 0x3394;
  17033. t['tihiragana'] = 0x3061;
  17034. t['tikatakana'] = 0x30C1;
  17035. t['tikatakanahalfwidth'] = 0xFF81;
  17036. t['tikeutacirclekorean'] = 0x3270;
  17037. t['tikeutaparenkorean'] = 0x3210;
  17038. t['tikeutcirclekorean'] = 0x3262;
  17039. t['tikeutkorean'] = 0x3137;
  17040. t['tikeutparenkorean'] = 0x3202;
  17041. t['tilde'] = 0x02DC;
  17042. t['tildebelowcmb'] = 0x0330;
  17043. t['tildecmb'] = 0x0303;
  17044. t['tildecomb'] = 0x0303;
  17045. t['tildedoublecmb'] = 0x0360;
  17046. t['tildeoperator'] = 0x223C;
  17047. t['tildeoverlaycmb'] = 0x0334;
  17048. t['tildeverticalcmb'] = 0x033E;
  17049. t['timescircle'] = 0x2297;
  17050. t['tipehahebrew'] = 0x0596;
  17051. t['tipehalefthebrew'] = 0x0596;
  17052. t['tippigurmukhi'] = 0x0A70;
  17053. t['titlocyrilliccmb'] = 0x0483;
  17054. t['tiwnarmenian'] = 0x057F;
  17055. t['tlinebelow'] = 0x1E6F;
  17056. t['tmonospace'] = 0xFF54;
  17057. t['toarmenian'] = 0x0569;
  17058. t['tohiragana'] = 0x3068;
  17059. t['tokatakana'] = 0x30C8;
  17060. t['tokatakanahalfwidth'] = 0xFF84;
  17061. t['tonebarextrahighmod'] = 0x02E5;
  17062. t['tonebarextralowmod'] = 0x02E9;
  17063. t['tonebarhighmod'] = 0x02E6;
  17064. t['tonebarlowmod'] = 0x02E8;
  17065. t['tonebarmidmod'] = 0x02E7;
  17066. t['tonefive'] = 0x01BD;
  17067. t['tonesix'] = 0x0185;
  17068. t['tonetwo'] = 0x01A8;
  17069. t['tonos'] = 0x0384;
  17070. t['tonsquare'] = 0x3327;
  17071. t['topatakthai'] = 0x0E0F;
  17072. t['tortoiseshellbracketleft'] = 0x3014;
  17073. t['tortoiseshellbracketleftsmall'] = 0xFE5D;
  17074. t['tortoiseshellbracketleftvertical'] = 0xFE39;
  17075. t['tortoiseshellbracketright'] = 0x3015;
  17076. t['tortoiseshellbracketrightsmall'] = 0xFE5E;
  17077. t['tortoiseshellbracketrightvertical'] = 0xFE3A;
  17078. t['totaothai'] = 0x0E15;
  17079. t['tpalatalhook'] = 0x01AB;
  17080. t['tparen'] = 0x24AF;
  17081. t['trademark'] = 0x2122;
  17082. t['trademarksans'] = 0xF8EA;
  17083. t['trademarkserif'] = 0xF6DB;
  17084. t['tretroflexhook'] = 0x0288;
  17085. t['triagdn'] = 0x25BC;
  17086. t['triaglf'] = 0x25C4;
  17087. t['triagrt'] = 0x25BA;
  17088. t['triagup'] = 0x25B2;
  17089. t['ts'] = 0x02A6;
  17090. t['tsadi'] = 0x05E6;
  17091. t['tsadidagesh'] = 0xFB46;
  17092. t['tsadidageshhebrew'] = 0xFB46;
  17093. t['tsadihebrew'] = 0x05E6;
  17094. t['tsecyrillic'] = 0x0446;
  17095. t['tsere'] = 0x05B5;
  17096. t['tsere12'] = 0x05B5;
  17097. t['tsere1e'] = 0x05B5;
  17098. t['tsere2b'] = 0x05B5;
  17099. t['tserehebrew'] = 0x05B5;
  17100. t['tserenarrowhebrew'] = 0x05B5;
  17101. t['tserequarterhebrew'] = 0x05B5;
  17102. t['tserewidehebrew'] = 0x05B5;
  17103. t['tshecyrillic'] = 0x045B;
  17104. t['tsuperior'] = 0xF6F3;
  17105. t['ttabengali'] = 0x099F;
  17106. t['ttadeva'] = 0x091F;
  17107. t['ttagujarati'] = 0x0A9F;
  17108. t['ttagurmukhi'] = 0x0A1F;
  17109. t['tteharabic'] = 0x0679;
  17110. t['ttehfinalarabic'] = 0xFB67;
  17111. t['ttehinitialarabic'] = 0xFB68;
  17112. t['ttehmedialarabic'] = 0xFB69;
  17113. t['tthabengali'] = 0x09A0;
  17114. t['tthadeva'] = 0x0920;
  17115. t['tthagujarati'] = 0x0AA0;
  17116. t['tthagurmukhi'] = 0x0A20;
  17117. t['tturned'] = 0x0287;
  17118. t['tuhiragana'] = 0x3064;
  17119. t['tukatakana'] = 0x30C4;
  17120. t['tukatakanahalfwidth'] = 0xFF82;
  17121. t['tusmallhiragana'] = 0x3063;
  17122. t['tusmallkatakana'] = 0x30C3;
  17123. t['tusmallkatakanahalfwidth'] = 0xFF6F;
  17124. t['twelvecircle'] = 0x246B;
  17125. t['twelveparen'] = 0x247F;
  17126. t['twelveperiod'] = 0x2493;
  17127. t['twelveroman'] = 0x217B;
  17128. t['twentycircle'] = 0x2473;
  17129. t['twentyhangzhou'] = 0x5344;
  17130. t['twentyparen'] = 0x2487;
  17131. t['twentyperiod'] = 0x249B;
  17132. t['two'] = 0x0032;
  17133. t['twoarabic'] = 0x0662;
  17134. t['twobengali'] = 0x09E8;
  17135. t['twocircle'] = 0x2461;
  17136. t['twocircleinversesansserif'] = 0x278B;
  17137. t['twodeva'] = 0x0968;
  17138. t['twodotenleader'] = 0x2025;
  17139. t['twodotleader'] = 0x2025;
  17140. t['twodotleadervertical'] = 0xFE30;
  17141. t['twogujarati'] = 0x0AE8;
  17142. t['twogurmukhi'] = 0x0A68;
  17143. t['twohackarabic'] = 0x0662;
  17144. t['twohangzhou'] = 0x3022;
  17145. t['twoideographicparen'] = 0x3221;
  17146. t['twoinferior'] = 0x2082;
  17147. t['twomonospace'] = 0xFF12;
  17148. t['twonumeratorbengali'] = 0x09F5;
  17149. t['twooldstyle'] = 0xF732;
  17150. t['twoparen'] = 0x2475;
  17151. t['twoperiod'] = 0x2489;
  17152. t['twopersian'] = 0x06F2;
  17153. t['tworoman'] = 0x2171;
  17154. t['twostroke'] = 0x01BB;
  17155. t['twosuperior'] = 0x00B2;
  17156. t['twothai'] = 0x0E52;
  17157. t['twothirds'] = 0x2154;
  17158. t['u'] = 0x0075;
  17159. t['uacute'] = 0x00FA;
  17160. t['ubar'] = 0x0289;
  17161. t['ubengali'] = 0x0989;
  17162. t['ubopomofo'] = 0x3128;
  17163. t['ubreve'] = 0x016D;
  17164. t['ucaron'] = 0x01D4;
  17165. t['ucircle'] = 0x24E4;
  17166. t['ucircumflex'] = 0x00FB;
  17167. t['ucircumflexbelow'] = 0x1E77;
  17168. t['ucyrillic'] = 0x0443;
  17169. t['udattadeva'] = 0x0951;
  17170. t['udblacute'] = 0x0171;
  17171. t['udblgrave'] = 0x0215;
  17172. t['udeva'] = 0x0909;
  17173. t['udieresis'] = 0x00FC;
  17174. t['udieresisacute'] = 0x01D8;
  17175. t['udieresisbelow'] = 0x1E73;
  17176. t['udieresiscaron'] = 0x01DA;
  17177. t['udieresiscyrillic'] = 0x04F1;
  17178. t['udieresisgrave'] = 0x01DC;
  17179. t['udieresismacron'] = 0x01D6;
  17180. t['udotbelow'] = 0x1EE5;
  17181. t['ugrave'] = 0x00F9;
  17182. t['ugujarati'] = 0x0A89;
  17183. t['ugurmukhi'] = 0x0A09;
  17184. t['uhiragana'] = 0x3046;
  17185. t['uhookabove'] = 0x1EE7;
  17186. t['uhorn'] = 0x01B0;
  17187. t['uhornacute'] = 0x1EE9;
  17188. t['uhorndotbelow'] = 0x1EF1;
  17189. t['uhorngrave'] = 0x1EEB;
  17190. t['uhornhookabove'] = 0x1EED;
  17191. t['uhorntilde'] = 0x1EEF;
  17192. t['uhungarumlaut'] = 0x0171;
  17193. t['uhungarumlautcyrillic'] = 0x04F3;
  17194. t['uinvertedbreve'] = 0x0217;
  17195. t['ukatakana'] = 0x30A6;
  17196. t['ukatakanahalfwidth'] = 0xFF73;
  17197. t['ukcyrillic'] = 0x0479;
  17198. t['ukorean'] = 0x315C;
  17199. t['umacron'] = 0x016B;
  17200. t['umacroncyrillic'] = 0x04EF;
  17201. t['umacrondieresis'] = 0x1E7B;
  17202. t['umatragurmukhi'] = 0x0A41;
  17203. t['umonospace'] = 0xFF55;
  17204. t['underscore'] = 0x005F;
  17205. t['underscoredbl'] = 0x2017;
  17206. t['underscoremonospace'] = 0xFF3F;
  17207. t['underscorevertical'] = 0xFE33;
  17208. t['underscorewavy'] = 0xFE4F;
  17209. t['union'] = 0x222A;
  17210. t['universal'] = 0x2200;
  17211. t['uogonek'] = 0x0173;
  17212. t['uparen'] = 0x24B0;
  17213. t['upblock'] = 0x2580;
  17214. t['upperdothebrew'] = 0x05C4;
  17215. t['upsilon'] = 0x03C5;
  17216. t['upsilondieresis'] = 0x03CB;
  17217. t['upsilondieresistonos'] = 0x03B0;
  17218. t['upsilonlatin'] = 0x028A;
  17219. t['upsilontonos'] = 0x03CD;
  17220. t['uptackbelowcmb'] = 0x031D;
  17221. t['uptackmod'] = 0x02D4;
  17222. t['uragurmukhi'] = 0x0A73;
  17223. t['uring'] = 0x016F;
  17224. t['ushortcyrillic'] = 0x045E;
  17225. t['usmallhiragana'] = 0x3045;
  17226. t['usmallkatakana'] = 0x30A5;
  17227. t['usmallkatakanahalfwidth'] = 0xFF69;
  17228. t['ustraightcyrillic'] = 0x04AF;
  17229. t['ustraightstrokecyrillic'] = 0x04B1;
  17230. t['utilde'] = 0x0169;
  17231. t['utildeacute'] = 0x1E79;
  17232. t['utildebelow'] = 0x1E75;
  17233. t['uubengali'] = 0x098A;
  17234. t['uudeva'] = 0x090A;
  17235. t['uugujarati'] = 0x0A8A;
  17236. t['uugurmukhi'] = 0x0A0A;
  17237. t['uumatragurmukhi'] = 0x0A42;
  17238. t['uuvowelsignbengali'] = 0x09C2;
  17239. t['uuvowelsigndeva'] = 0x0942;
  17240. t['uuvowelsigngujarati'] = 0x0AC2;
  17241. t['uvowelsignbengali'] = 0x09C1;
  17242. t['uvowelsigndeva'] = 0x0941;
  17243. t['uvowelsigngujarati'] = 0x0AC1;
  17244. t['v'] = 0x0076;
  17245. t['vadeva'] = 0x0935;
  17246. t['vagujarati'] = 0x0AB5;
  17247. t['vagurmukhi'] = 0x0A35;
  17248. t['vakatakana'] = 0x30F7;
  17249. t['vav'] = 0x05D5;
  17250. t['vavdagesh'] = 0xFB35;
  17251. t['vavdagesh65'] = 0xFB35;
  17252. t['vavdageshhebrew'] = 0xFB35;
  17253. t['vavhebrew'] = 0x05D5;
  17254. t['vavholam'] = 0xFB4B;
  17255. t['vavholamhebrew'] = 0xFB4B;
  17256. t['vavvavhebrew'] = 0x05F0;
  17257. t['vavyodhebrew'] = 0x05F1;
  17258. t['vcircle'] = 0x24E5;
  17259. t['vdotbelow'] = 0x1E7F;
  17260. t['vecyrillic'] = 0x0432;
  17261. t['veharabic'] = 0x06A4;
  17262. t['vehfinalarabic'] = 0xFB6B;
  17263. t['vehinitialarabic'] = 0xFB6C;
  17264. t['vehmedialarabic'] = 0xFB6D;
  17265. t['vekatakana'] = 0x30F9;
  17266. t['venus'] = 0x2640;
  17267. t['verticalbar'] = 0x007C;
  17268. t['verticallineabovecmb'] = 0x030D;
  17269. t['verticallinebelowcmb'] = 0x0329;
  17270. t['verticallinelowmod'] = 0x02CC;
  17271. t['verticallinemod'] = 0x02C8;
  17272. t['vewarmenian'] = 0x057E;
  17273. t['vhook'] = 0x028B;
  17274. t['vikatakana'] = 0x30F8;
  17275. t['viramabengali'] = 0x09CD;
  17276. t['viramadeva'] = 0x094D;
  17277. t['viramagujarati'] = 0x0ACD;
  17278. t['visargabengali'] = 0x0983;
  17279. t['visargadeva'] = 0x0903;
  17280. t['visargagujarati'] = 0x0A83;
  17281. t['vmonospace'] = 0xFF56;
  17282. t['voarmenian'] = 0x0578;
  17283. t['voicediterationhiragana'] = 0x309E;
  17284. t['voicediterationkatakana'] = 0x30FE;
  17285. t['voicedmarkkana'] = 0x309B;
  17286. t['voicedmarkkanahalfwidth'] = 0xFF9E;
  17287. t['vokatakana'] = 0x30FA;
  17288. t['vparen'] = 0x24B1;
  17289. t['vtilde'] = 0x1E7D;
  17290. t['vturned'] = 0x028C;
  17291. t['vuhiragana'] = 0x3094;
  17292. t['vukatakana'] = 0x30F4;
  17293. t['w'] = 0x0077;
  17294. t['wacute'] = 0x1E83;
  17295. t['waekorean'] = 0x3159;
  17296. t['wahiragana'] = 0x308F;
  17297. t['wakatakana'] = 0x30EF;
  17298. t['wakatakanahalfwidth'] = 0xFF9C;
  17299. t['wakorean'] = 0x3158;
  17300. t['wasmallhiragana'] = 0x308E;
  17301. t['wasmallkatakana'] = 0x30EE;
  17302. t['wattosquare'] = 0x3357;
  17303. t['wavedash'] = 0x301C;
  17304. t['wavyunderscorevertical'] = 0xFE34;
  17305. t['wawarabic'] = 0x0648;
  17306. t['wawfinalarabic'] = 0xFEEE;
  17307. t['wawhamzaabovearabic'] = 0x0624;
  17308. t['wawhamzaabovefinalarabic'] = 0xFE86;
  17309. t['wbsquare'] = 0x33DD;
  17310. t['wcircle'] = 0x24E6;
  17311. t['wcircumflex'] = 0x0175;
  17312. t['wdieresis'] = 0x1E85;
  17313. t['wdotaccent'] = 0x1E87;
  17314. t['wdotbelow'] = 0x1E89;
  17315. t['wehiragana'] = 0x3091;
  17316. t['weierstrass'] = 0x2118;
  17317. t['wekatakana'] = 0x30F1;
  17318. t['wekorean'] = 0x315E;
  17319. t['weokorean'] = 0x315D;
  17320. t['wgrave'] = 0x1E81;
  17321. t['whitebullet'] = 0x25E6;
  17322. t['whitecircle'] = 0x25CB;
  17323. t['whitecircleinverse'] = 0x25D9;
  17324. t['whitecornerbracketleft'] = 0x300E;
  17325. t['whitecornerbracketleftvertical'] = 0xFE43;
  17326. t['whitecornerbracketright'] = 0x300F;
  17327. t['whitecornerbracketrightvertical'] = 0xFE44;
  17328. t['whitediamond'] = 0x25C7;
  17329. t['whitediamondcontainingblacksmalldiamond'] = 0x25C8;
  17330. t['whitedownpointingsmalltriangle'] = 0x25BF;
  17331. t['whitedownpointingtriangle'] = 0x25BD;
  17332. t['whiteleftpointingsmalltriangle'] = 0x25C3;
  17333. t['whiteleftpointingtriangle'] = 0x25C1;
  17334. t['whitelenticularbracketleft'] = 0x3016;
  17335. t['whitelenticularbracketright'] = 0x3017;
  17336. t['whiterightpointingsmalltriangle'] = 0x25B9;
  17337. t['whiterightpointingtriangle'] = 0x25B7;
  17338. t['whitesmallsquare'] = 0x25AB;
  17339. t['whitesmilingface'] = 0x263A;
  17340. t['whitesquare'] = 0x25A1;
  17341. t['whitestar'] = 0x2606;
  17342. t['whitetelephone'] = 0x260F;
  17343. t['whitetortoiseshellbracketleft'] = 0x3018;
  17344. t['whitetortoiseshellbracketright'] = 0x3019;
  17345. t['whiteuppointingsmalltriangle'] = 0x25B5;
  17346. t['whiteuppointingtriangle'] = 0x25B3;
  17347. t['wihiragana'] = 0x3090;
  17348. t['wikatakana'] = 0x30F0;
  17349. t['wikorean'] = 0x315F;
  17350. t['wmonospace'] = 0xFF57;
  17351. t['wohiragana'] = 0x3092;
  17352. t['wokatakana'] = 0x30F2;
  17353. t['wokatakanahalfwidth'] = 0xFF66;
  17354. t['won'] = 0x20A9;
  17355. t['wonmonospace'] = 0xFFE6;
  17356. t['wowaenthai'] = 0x0E27;
  17357. t['wparen'] = 0x24B2;
  17358. t['wring'] = 0x1E98;
  17359. t['wsuperior'] = 0x02B7;
  17360. t['wturned'] = 0x028D;
  17361. t['wynn'] = 0x01BF;
  17362. t['x'] = 0x0078;
  17363. t['xabovecmb'] = 0x033D;
  17364. t['xbopomofo'] = 0x3112;
  17365. t['xcircle'] = 0x24E7;
  17366. t['xdieresis'] = 0x1E8D;
  17367. t['xdotaccent'] = 0x1E8B;
  17368. t['xeharmenian'] = 0x056D;
  17369. t['xi'] = 0x03BE;
  17370. t['xmonospace'] = 0xFF58;
  17371. t['xparen'] = 0x24B3;
  17372. t['xsuperior'] = 0x02E3;
  17373. t['y'] = 0x0079;
  17374. t['yaadosquare'] = 0x334E;
  17375. t['yabengali'] = 0x09AF;
  17376. t['yacute'] = 0x00FD;
  17377. t['yadeva'] = 0x092F;
  17378. t['yaekorean'] = 0x3152;
  17379. t['yagujarati'] = 0x0AAF;
  17380. t['yagurmukhi'] = 0x0A2F;
  17381. t['yahiragana'] = 0x3084;
  17382. t['yakatakana'] = 0x30E4;
  17383. t['yakatakanahalfwidth'] = 0xFF94;
  17384. t['yakorean'] = 0x3151;
  17385. t['yamakkanthai'] = 0x0E4E;
  17386. t['yasmallhiragana'] = 0x3083;
  17387. t['yasmallkatakana'] = 0x30E3;
  17388. t['yasmallkatakanahalfwidth'] = 0xFF6C;
  17389. t['yatcyrillic'] = 0x0463;
  17390. t['ycircle'] = 0x24E8;
  17391. t['ycircumflex'] = 0x0177;
  17392. t['ydieresis'] = 0x00FF;
  17393. t['ydotaccent'] = 0x1E8F;
  17394. t['ydotbelow'] = 0x1EF5;
  17395. t['yeharabic'] = 0x064A;
  17396. t['yehbarreearabic'] = 0x06D2;
  17397. t['yehbarreefinalarabic'] = 0xFBAF;
  17398. t['yehfinalarabic'] = 0xFEF2;
  17399. t['yehhamzaabovearabic'] = 0x0626;
  17400. t['yehhamzaabovefinalarabic'] = 0xFE8A;
  17401. t['yehhamzaaboveinitialarabic'] = 0xFE8B;
  17402. t['yehhamzaabovemedialarabic'] = 0xFE8C;
  17403. t['yehinitialarabic'] = 0xFEF3;
  17404. t['yehmedialarabic'] = 0xFEF4;
  17405. t['yehmeeminitialarabic'] = 0xFCDD;
  17406. t['yehmeemisolatedarabic'] = 0xFC58;
  17407. t['yehnoonfinalarabic'] = 0xFC94;
  17408. t['yehthreedotsbelowarabic'] = 0x06D1;
  17409. t['yekorean'] = 0x3156;
  17410. t['yen'] = 0x00A5;
  17411. t['yenmonospace'] = 0xFFE5;
  17412. t['yeokorean'] = 0x3155;
  17413. t['yeorinhieuhkorean'] = 0x3186;
  17414. t['yerahbenyomohebrew'] = 0x05AA;
  17415. t['yerahbenyomolefthebrew'] = 0x05AA;
  17416. t['yericyrillic'] = 0x044B;
  17417. t['yerudieresiscyrillic'] = 0x04F9;
  17418. t['yesieungkorean'] = 0x3181;
  17419. t['yesieungpansioskorean'] = 0x3183;
  17420. t['yesieungsioskorean'] = 0x3182;
  17421. t['yetivhebrew'] = 0x059A;
  17422. t['ygrave'] = 0x1EF3;
  17423. t['yhook'] = 0x01B4;
  17424. t['yhookabove'] = 0x1EF7;
  17425. t['yiarmenian'] = 0x0575;
  17426. t['yicyrillic'] = 0x0457;
  17427. t['yikorean'] = 0x3162;
  17428. t['yinyang'] = 0x262F;
  17429. t['yiwnarmenian'] = 0x0582;
  17430. t['ymonospace'] = 0xFF59;
  17431. t['yod'] = 0x05D9;
  17432. t['yoddagesh'] = 0xFB39;
  17433. t['yoddageshhebrew'] = 0xFB39;
  17434. t['yodhebrew'] = 0x05D9;
  17435. t['yodyodhebrew'] = 0x05F2;
  17436. t['yodyodpatahhebrew'] = 0xFB1F;
  17437. t['yohiragana'] = 0x3088;
  17438. t['yoikorean'] = 0x3189;
  17439. t['yokatakana'] = 0x30E8;
  17440. t['yokatakanahalfwidth'] = 0xFF96;
  17441. t['yokorean'] = 0x315B;
  17442. t['yosmallhiragana'] = 0x3087;
  17443. t['yosmallkatakana'] = 0x30E7;
  17444. t['yosmallkatakanahalfwidth'] = 0xFF6E;
  17445. t['yotgreek'] = 0x03F3;
  17446. t['yoyaekorean'] = 0x3188;
  17447. t['yoyakorean'] = 0x3187;
  17448. t['yoyakthai'] = 0x0E22;
  17449. t['yoyingthai'] = 0x0E0D;
  17450. t['yparen'] = 0x24B4;
  17451. t['ypogegrammeni'] = 0x037A;
  17452. t['ypogegrammenigreekcmb'] = 0x0345;
  17453. t['yr'] = 0x01A6;
  17454. t['yring'] = 0x1E99;
  17455. t['ysuperior'] = 0x02B8;
  17456. t['ytilde'] = 0x1EF9;
  17457. t['yturned'] = 0x028E;
  17458. t['yuhiragana'] = 0x3086;
  17459. t['yuikorean'] = 0x318C;
  17460. t['yukatakana'] = 0x30E6;
  17461. t['yukatakanahalfwidth'] = 0xFF95;
  17462. t['yukorean'] = 0x3160;
  17463. t['yusbigcyrillic'] = 0x046B;
  17464. t['yusbigiotifiedcyrillic'] = 0x046D;
  17465. t['yuslittlecyrillic'] = 0x0467;
  17466. t['yuslittleiotifiedcyrillic'] = 0x0469;
  17467. t['yusmallhiragana'] = 0x3085;
  17468. t['yusmallkatakana'] = 0x30E5;
  17469. t['yusmallkatakanahalfwidth'] = 0xFF6D;
  17470. t['yuyekorean'] = 0x318B;
  17471. t['yuyeokorean'] = 0x318A;
  17472. t['yyabengali'] = 0x09DF;
  17473. t['yyadeva'] = 0x095F;
  17474. t['z'] = 0x007A;
  17475. t['zaarmenian'] = 0x0566;
  17476. t['zacute'] = 0x017A;
  17477. t['zadeva'] = 0x095B;
  17478. t['zagurmukhi'] = 0x0A5B;
  17479. t['zaharabic'] = 0x0638;
  17480. t['zahfinalarabic'] = 0xFEC6;
  17481. t['zahinitialarabic'] = 0xFEC7;
  17482. t['zahiragana'] = 0x3056;
  17483. t['zahmedialarabic'] = 0xFEC8;
  17484. t['zainarabic'] = 0x0632;
  17485. t['zainfinalarabic'] = 0xFEB0;
  17486. t['zakatakana'] = 0x30B6;
  17487. t['zaqefgadolhebrew'] = 0x0595;
  17488. t['zaqefqatanhebrew'] = 0x0594;
  17489. t['zarqahebrew'] = 0x0598;
  17490. t['zayin'] = 0x05D6;
  17491. t['zayindagesh'] = 0xFB36;
  17492. t['zayindageshhebrew'] = 0xFB36;
  17493. t['zayinhebrew'] = 0x05D6;
  17494. t['zbopomofo'] = 0x3117;
  17495. t['zcaron'] = 0x017E;
  17496. t['zcircle'] = 0x24E9;
  17497. t['zcircumflex'] = 0x1E91;
  17498. t['zcurl'] = 0x0291;
  17499. t['zdot'] = 0x017C;
  17500. t['zdotaccent'] = 0x017C;
  17501. t['zdotbelow'] = 0x1E93;
  17502. t['zecyrillic'] = 0x0437;
  17503. t['zedescendercyrillic'] = 0x0499;
  17504. t['zedieresiscyrillic'] = 0x04DF;
  17505. t['zehiragana'] = 0x305C;
  17506. t['zekatakana'] = 0x30BC;
  17507. t['zero'] = 0x0030;
  17508. t['zeroarabic'] = 0x0660;
  17509. t['zerobengali'] = 0x09E6;
  17510. t['zerodeva'] = 0x0966;
  17511. t['zerogujarati'] = 0x0AE6;
  17512. t['zerogurmukhi'] = 0x0A66;
  17513. t['zerohackarabic'] = 0x0660;
  17514. t['zeroinferior'] = 0x2080;
  17515. t['zeromonospace'] = 0xFF10;
  17516. t['zerooldstyle'] = 0xF730;
  17517. t['zeropersian'] = 0x06F0;
  17518. t['zerosuperior'] = 0x2070;
  17519. t['zerothai'] = 0x0E50;
  17520. t['zerowidthjoiner'] = 0xFEFF;
  17521. t['zerowidthnonjoiner'] = 0x200C;
  17522. t['zerowidthspace'] = 0x200B;
  17523. t['zeta'] = 0x03B6;
  17524. t['zhbopomofo'] = 0x3113;
  17525. t['zhearmenian'] = 0x056A;
  17526. t['zhebrevecyrillic'] = 0x04C2;
  17527. t['zhecyrillic'] = 0x0436;
  17528. t['zhedescendercyrillic'] = 0x0497;
  17529. t['zhedieresiscyrillic'] = 0x04DD;
  17530. t['zihiragana'] = 0x3058;
  17531. t['zikatakana'] = 0x30B8;
  17532. t['zinorhebrew'] = 0x05AE;
  17533. t['zlinebelow'] = 0x1E95;
  17534. t['zmonospace'] = 0xFF5A;
  17535. t['zohiragana'] = 0x305E;
  17536. t['zokatakana'] = 0x30BE;
  17537. t['zparen'] = 0x24B5;
  17538. t['zretroflexhook'] = 0x0290;
  17539. t['zstroke'] = 0x01B6;
  17540. t['zuhiragana'] = 0x305A;
  17541. t['zukatakana'] = 0x30BA;
  17542. t['.notdef'] = 0x0000;
  17543. t['angbracketleftbig'] = 0x2329;
  17544. t['angbracketleftBig'] = 0x2329;
  17545. t['angbracketleftbigg'] = 0x2329;
  17546. t['angbracketleftBigg'] = 0x2329;
  17547. t['angbracketrightBig'] = 0x232A;
  17548. t['angbracketrightbig'] = 0x232A;
  17549. t['angbracketrightBigg'] = 0x232A;
  17550. t['angbracketrightbigg'] = 0x232A;
  17551. t['arrowhookleft'] = 0x21AA;
  17552. t['arrowhookright'] = 0x21A9;
  17553. t['arrowlefttophalf'] = 0x21BC;
  17554. t['arrowleftbothalf'] = 0x21BD;
  17555. t['arrownortheast'] = 0x2197;
  17556. t['arrownorthwest'] = 0x2196;
  17557. t['arrowrighttophalf'] = 0x21C0;
  17558. t['arrowrightbothalf'] = 0x21C1;
  17559. t['arrowsoutheast'] = 0x2198;
  17560. t['arrowsouthwest'] = 0x2199;
  17561. t['backslashbig'] = 0x2216;
  17562. t['backslashBig'] = 0x2216;
  17563. t['backslashBigg'] = 0x2216;
  17564. t['backslashbigg'] = 0x2216;
  17565. t['bardbl'] = 0x2016;
  17566. t['bracehtipdownleft'] = 0xFE37;
  17567. t['bracehtipdownright'] = 0xFE37;
  17568. t['bracehtipupleft'] = 0xFE38;
  17569. t['bracehtipupright'] = 0xFE38;
  17570. t['braceleftBig'] = 0x007B;
  17571. t['braceleftbig'] = 0x007B;
  17572. t['braceleftbigg'] = 0x007B;
  17573. t['braceleftBigg'] = 0x007B;
  17574. t['bracerightBig'] = 0x007D;
  17575. t['bracerightbig'] = 0x007D;
  17576. t['bracerightbigg'] = 0x007D;
  17577. t['bracerightBigg'] = 0x007D;
  17578. t['bracketleftbig'] = 0x005B;
  17579. t['bracketleftBig'] = 0x005B;
  17580. t['bracketleftbigg'] = 0x005B;
  17581. t['bracketleftBigg'] = 0x005B;
  17582. t['bracketrightBig'] = 0x005D;
  17583. t['bracketrightbig'] = 0x005D;
  17584. t['bracketrightbigg'] = 0x005D;
  17585. t['bracketrightBigg'] = 0x005D;
  17586. t['ceilingleftbig'] = 0x2308;
  17587. t['ceilingleftBig'] = 0x2308;
  17588. t['ceilingleftBigg'] = 0x2308;
  17589. t['ceilingleftbigg'] = 0x2308;
  17590. t['ceilingrightbig'] = 0x2309;
  17591. t['ceilingrightBig'] = 0x2309;
  17592. t['ceilingrightbigg'] = 0x2309;
  17593. t['ceilingrightBigg'] = 0x2309;
  17594. t['circledotdisplay'] = 0x2299;
  17595. t['circledottext'] = 0x2299;
  17596. t['circlemultiplydisplay'] = 0x2297;
  17597. t['circlemultiplytext'] = 0x2297;
  17598. t['circleplusdisplay'] = 0x2295;
  17599. t['circleplustext'] = 0x2295;
  17600. t['contintegraldisplay'] = 0x222E;
  17601. t['contintegraltext'] = 0x222E;
  17602. t['coproductdisplay'] = 0x2210;
  17603. t['coproducttext'] = 0x2210;
  17604. t['floorleftBig'] = 0x230A;
  17605. t['floorleftbig'] = 0x230A;
  17606. t['floorleftbigg'] = 0x230A;
  17607. t['floorleftBigg'] = 0x230A;
  17608. t['floorrightbig'] = 0x230B;
  17609. t['floorrightBig'] = 0x230B;
  17610. t['floorrightBigg'] = 0x230B;
  17611. t['floorrightbigg'] = 0x230B;
  17612. t['hatwide'] = 0x0302;
  17613. t['hatwider'] = 0x0302;
  17614. t['hatwidest'] = 0x0302;
  17615. t['intercal'] = 0x1D40;
  17616. t['integraldisplay'] = 0x222B;
  17617. t['integraltext'] = 0x222B;
  17618. t['intersectiondisplay'] = 0x22C2;
  17619. t['intersectiontext'] = 0x22C2;
  17620. t['logicalanddisplay'] = 0x2227;
  17621. t['logicalandtext'] = 0x2227;
  17622. t['logicalordisplay'] = 0x2228;
  17623. t['logicalortext'] = 0x2228;
  17624. t['parenleftBig'] = 0x0028;
  17625. t['parenleftbig'] = 0x0028;
  17626. t['parenleftBigg'] = 0x0028;
  17627. t['parenleftbigg'] = 0x0028;
  17628. t['parenrightBig'] = 0x0029;
  17629. t['parenrightbig'] = 0x0029;
  17630. t['parenrightBigg'] = 0x0029;
  17631. t['parenrightbigg'] = 0x0029;
  17632. t['prime'] = 0x2032;
  17633. t['productdisplay'] = 0x220F;
  17634. t['producttext'] = 0x220F;
  17635. t['radicalbig'] = 0x221A;
  17636. t['radicalBig'] = 0x221A;
  17637. t['radicalBigg'] = 0x221A;
  17638. t['radicalbigg'] = 0x221A;
  17639. t['radicalbt'] = 0x221A;
  17640. t['radicaltp'] = 0x221A;
  17641. t['radicalvertex'] = 0x221A;
  17642. t['slashbig'] = 0x002F;
  17643. t['slashBig'] = 0x002F;
  17644. t['slashBigg'] = 0x002F;
  17645. t['slashbigg'] = 0x002F;
  17646. t['summationdisplay'] = 0x2211;
  17647. t['summationtext'] = 0x2211;
  17648. t['tildewide'] = 0x02DC;
  17649. t['tildewider'] = 0x02DC;
  17650. t['tildewidest'] = 0x02DC;
  17651. t['uniondisplay'] = 0x22C3;
  17652. t['unionmultidisplay'] = 0x228E;
  17653. t['unionmultitext'] = 0x228E;
  17654. t['unionsqdisplay'] = 0x2294;
  17655. t['unionsqtext'] = 0x2294;
  17656. t['uniontext'] = 0x22C3;
  17657. t['vextenddouble'] = 0x2225;
  17658. t['vextendsingle'] = 0x2223;
  17659. });
  17660. var getDingbatsGlyphsUnicode = getLookupTableFactory(function (t) {
  17661. t['space'] = 0x0020;
  17662. t['a1'] = 0x2701;
  17663. t['a2'] = 0x2702;
  17664. t['a202'] = 0x2703;
  17665. t['a3'] = 0x2704;
  17666. t['a4'] = 0x260E;
  17667. t['a5'] = 0x2706;
  17668. t['a119'] = 0x2707;
  17669. t['a118'] = 0x2708;
  17670. t['a117'] = 0x2709;
  17671. t['a11'] = 0x261B;
  17672. t['a12'] = 0x261E;
  17673. t['a13'] = 0x270C;
  17674. t['a14'] = 0x270D;
  17675. t['a15'] = 0x270E;
  17676. t['a16'] = 0x270F;
  17677. t['a105'] = 0x2710;
  17678. t['a17'] = 0x2711;
  17679. t['a18'] = 0x2712;
  17680. t['a19'] = 0x2713;
  17681. t['a20'] = 0x2714;
  17682. t['a21'] = 0x2715;
  17683. t['a22'] = 0x2716;
  17684. t['a23'] = 0x2717;
  17685. t['a24'] = 0x2718;
  17686. t['a25'] = 0x2719;
  17687. t['a26'] = 0x271A;
  17688. t['a27'] = 0x271B;
  17689. t['a28'] = 0x271C;
  17690. t['a6'] = 0x271D;
  17691. t['a7'] = 0x271E;
  17692. t['a8'] = 0x271F;
  17693. t['a9'] = 0x2720;
  17694. t['a10'] = 0x2721;
  17695. t['a29'] = 0x2722;
  17696. t['a30'] = 0x2723;
  17697. t['a31'] = 0x2724;
  17698. t['a32'] = 0x2725;
  17699. t['a33'] = 0x2726;
  17700. t['a34'] = 0x2727;
  17701. t['a35'] = 0x2605;
  17702. t['a36'] = 0x2729;
  17703. t['a37'] = 0x272A;
  17704. t['a38'] = 0x272B;
  17705. t['a39'] = 0x272C;
  17706. t['a40'] = 0x272D;
  17707. t['a41'] = 0x272E;
  17708. t['a42'] = 0x272F;
  17709. t['a43'] = 0x2730;
  17710. t['a44'] = 0x2731;
  17711. t['a45'] = 0x2732;
  17712. t['a46'] = 0x2733;
  17713. t['a47'] = 0x2734;
  17714. t['a48'] = 0x2735;
  17715. t['a49'] = 0x2736;
  17716. t['a50'] = 0x2737;
  17717. t['a51'] = 0x2738;
  17718. t['a52'] = 0x2739;
  17719. t['a53'] = 0x273A;
  17720. t['a54'] = 0x273B;
  17721. t['a55'] = 0x273C;
  17722. t['a56'] = 0x273D;
  17723. t['a57'] = 0x273E;
  17724. t['a58'] = 0x273F;
  17725. t['a59'] = 0x2740;
  17726. t['a60'] = 0x2741;
  17727. t['a61'] = 0x2742;
  17728. t['a62'] = 0x2743;
  17729. t['a63'] = 0x2744;
  17730. t['a64'] = 0x2745;
  17731. t['a65'] = 0x2746;
  17732. t['a66'] = 0x2747;
  17733. t['a67'] = 0x2748;
  17734. t['a68'] = 0x2749;
  17735. t['a69'] = 0x274A;
  17736. t['a70'] = 0x274B;
  17737. t['a71'] = 0x25CF;
  17738. t['a72'] = 0x274D;
  17739. t['a73'] = 0x25A0;
  17740. t['a74'] = 0x274F;
  17741. t['a203'] = 0x2750;
  17742. t['a75'] = 0x2751;
  17743. t['a204'] = 0x2752;
  17744. t['a76'] = 0x25B2;
  17745. t['a77'] = 0x25BC;
  17746. t['a78'] = 0x25C6;
  17747. t['a79'] = 0x2756;
  17748. t['a81'] = 0x25D7;
  17749. t['a82'] = 0x2758;
  17750. t['a83'] = 0x2759;
  17751. t['a84'] = 0x275A;
  17752. t['a97'] = 0x275B;
  17753. t['a98'] = 0x275C;
  17754. t['a99'] = 0x275D;
  17755. t['a100'] = 0x275E;
  17756. t['a101'] = 0x2761;
  17757. t['a102'] = 0x2762;
  17758. t['a103'] = 0x2763;
  17759. t['a104'] = 0x2764;
  17760. t['a106'] = 0x2765;
  17761. t['a107'] = 0x2766;
  17762. t['a108'] = 0x2767;
  17763. t['a112'] = 0x2663;
  17764. t['a111'] = 0x2666;
  17765. t['a110'] = 0x2665;
  17766. t['a109'] = 0x2660;
  17767. t['a120'] = 0x2460;
  17768. t['a121'] = 0x2461;
  17769. t['a122'] = 0x2462;
  17770. t['a123'] = 0x2463;
  17771. t['a124'] = 0x2464;
  17772. t['a125'] = 0x2465;
  17773. t['a126'] = 0x2466;
  17774. t['a127'] = 0x2467;
  17775. t['a128'] = 0x2468;
  17776. t['a129'] = 0x2469;
  17777. t['a130'] = 0x2776;
  17778. t['a131'] = 0x2777;
  17779. t['a132'] = 0x2778;
  17780. t['a133'] = 0x2779;
  17781. t['a134'] = 0x277A;
  17782. t['a135'] = 0x277B;
  17783. t['a136'] = 0x277C;
  17784. t['a137'] = 0x277D;
  17785. t['a138'] = 0x277E;
  17786. t['a139'] = 0x277F;
  17787. t['a140'] = 0x2780;
  17788. t['a141'] = 0x2781;
  17789. t['a142'] = 0x2782;
  17790. t['a143'] = 0x2783;
  17791. t['a144'] = 0x2784;
  17792. t['a145'] = 0x2785;
  17793. t['a146'] = 0x2786;
  17794. t['a147'] = 0x2787;
  17795. t['a148'] = 0x2788;
  17796. t['a149'] = 0x2789;
  17797. t['a150'] = 0x278A;
  17798. t['a151'] = 0x278B;
  17799. t['a152'] = 0x278C;
  17800. t['a153'] = 0x278D;
  17801. t['a154'] = 0x278E;
  17802. t['a155'] = 0x278F;
  17803. t['a156'] = 0x2790;
  17804. t['a157'] = 0x2791;
  17805. t['a158'] = 0x2792;
  17806. t['a159'] = 0x2793;
  17807. t['a160'] = 0x2794;
  17808. t['a161'] = 0x2192;
  17809. t['a163'] = 0x2194;
  17810. t['a164'] = 0x2195;
  17811. t['a196'] = 0x2798;
  17812. t['a165'] = 0x2799;
  17813. t['a192'] = 0x279A;
  17814. t['a166'] = 0x279B;
  17815. t['a167'] = 0x279C;
  17816. t['a168'] = 0x279D;
  17817. t['a169'] = 0x279E;
  17818. t['a170'] = 0x279F;
  17819. t['a171'] = 0x27A0;
  17820. t['a172'] = 0x27A1;
  17821. t['a173'] = 0x27A2;
  17822. t['a162'] = 0x27A3;
  17823. t['a174'] = 0x27A4;
  17824. t['a175'] = 0x27A5;
  17825. t['a176'] = 0x27A6;
  17826. t['a177'] = 0x27A7;
  17827. t['a178'] = 0x27A8;
  17828. t['a179'] = 0x27A9;
  17829. t['a193'] = 0x27AA;
  17830. t['a180'] = 0x27AB;
  17831. t['a199'] = 0x27AC;
  17832. t['a181'] = 0x27AD;
  17833. t['a200'] = 0x27AE;
  17834. t['a182'] = 0x27AF;
  17835. t['a201'] = 0x27B1;
  17836. t['a183'] = 0x27B2;
  17837. t['a184'] = 0x27B3;
  17838. t['a197'] = 0x27B4;
  17839. t['a185'] = 0x27B5;
  17840. t['a194'] = 0x27B6;
  17841. t['a198'] = 0x27B7;
  17842. t['a186'] = 0x27B8;
  17843. t['a195'] = 0x27B9;
  17844. t['a187'] = 0x27BA;
  17845. t['a188'] = 0x27BB;
  17846. t['a189'] = 0x27BC;
  17847. t['a190'] = 0x27BD;
  17848. t['a191'] = 0x27BE;
  17849. t['a89'] = 0x2768;
  17850. t['a90'] = 0x2769;
  17851. t['a93'] = 0x276A;
  17852. t['a94'] = 0x276B;
  17853. t['a91'] = 0x276C;
  17854. t['a92'] = 0x276D;
  17855. t['a205'] = 0x276E;
  17856. t['a85'] = 0x276F;
  17857. t['a206'] = 0x2770;
  17858. t['a86'] = 0x2771;
  17859. t['a87'] = 0x2772;
  17860. t['a88'] = 0x2773;
  17861. t['a95'] = 0x2774;
  17862. t['a96'] = 0x2775;
  17863. t['.notdef'] = 0x0000;
  17864. });
  17865. exports.getGlyphsUnicode = getGlyphsUnicode;
  17866. exports.getDingbatsGlyphsUnicode = getDingbatsGlyphsUnicode;
  17867. /***/ }),
  17868. /* 8 */
  17869. /***/ (function(module, exports, __w_pdfjs_require__) {
  17870. "use strict";
  17871. var sharedUtil = __w_pdfjs_require__(0);
  17872. var corePrimitives = __w_pdfjs_require__(1);
  17873. var corePdfManager = __w_pdfjs_require__(33);
  17874. var UNSUPPORTED_FEATURES = sharedUtil.UNSUPPORTED_FEATURES;
  17875. var InvalidPDFException = sharedUtil.InvalidPDFException;
  17876. var MessageHandler = sharedUtil.MessageHandler;
  17877. var MissingPDFException = sharedUtil.MissingPDFException;
  17878. var UnexpectedResponseException = sharedUtil.UnexpectedResponseException;
  17879. var PasswordException = sharedUtil.PasswordException;
  17880. var UnknownErrorException = sharedUtil.UnknownErrorException;
  17881. var XRefParseException = sharedUtil.XRefParseException;
  17882. var arrayByteLength = sharedUtil.arrayByteLength;
  17883. var arraysToBytes = sharedUtil.arraysToBytes;
  17884. var assert = sharedUtil.assert;
  17885. var createPromiseCapability = sharedUtil.createPromiseCapability;
  17886. var info = sharedUtil.info;
  17887. var warn = sharedUtil.warn;
  17888. var setVerbosityLevel = sharedUtil.setVerbosityLevel;
  17889. var isNodeJS = sharedUtil.isNodeJS;
  17890. var Ref = corePrimitives.Ref;
  17891. var LocalPdfManager = corePdfManager.LocalPdfManager;
  17892. var NetworkPdfManager = corePdfManager.NetworkPdfManager;
  17893. var WorkerTask = function WorkerTaskClosure() {
  17894. function WorkerTask(name) {
  17895. this.name = name;
  17896. this.terminated = false;
  17897. this._capability = createPromiseCapability();
  17898. }
  17899. WorkerTask.prototype = {
  17900. get finished() {
  17901. return this._capability.promise;
  17902. },
  17903. finish: function () {
  17904. this._capability.resolve();
  17905. },
  17906. terminate: function () {
  17907. this.terminated = true;
  17908. },
  17909. ensureNotTerminated: function () {
  17910. if (this.terminated) {
  17911. throw new Error('Worker task was terminated');
  17912. }
  17913. }
  17914. };
  17915. return WorkerTask;
  17916. }();
  17917. var PDFWorkerStream = function PDFWorkerStreamClosure() {
  17918. function PDFWorkerStream(params, msgHandler) {
  17919. this._queuedChunks = [];
  17920. var initialData = params.initialData;
  17921. if (initialData && initialData.length > 0) {
  17922. this._queuedChunks.push(initialData);
  17923. }
  17924. this._msgHandler = msgHandler;
  17925. this._isRangeSupported = !params.disableRange;
  17926. this._isStreamingSupported = !params.disableStream;
  17927. this._contentLength = params.length;
  17928. this._fullRequestReader = null;
  17929. this._rangeReaders = [];
  17930. msgHandler.on('OnDataRange', this._onReceiveData.bind(this));
  17931. msgHandler.on('OnDataProgress', this._onProgress.bind(this));
  17932. }
  17933. PDFWorkerStream.prototype = {
  17934. _onReceiveData: function PDFWorkerStream_onReceiveData(args) {
  17935. if (args.begin === undefined) {
  17936. if (this._fullRequestReader) {
  17937. this._fullRequestReader._enqueue(args.chunk);
  17938. } else {
  17939. this._queuedChunks.push(args.chunk);
  17940. }
  17941. } else {
  17942. var found = this._rangeReaders.some(function (rangeReader) {
  17943. if (rangeReader._begin !== args.begin) {
  17944. return false;
  17945. }
  17946. rangeReader._enqueue(args.chunk);
  17947. return true;
  17948. });
  17949. assert(found);
  17950. }
  17951. },
  17952. _onProgress: function PDFWorkerStream_onProgress(evt) {
  17953. if (this._rangeReaders.length > 0) {
  17954. var firstReader = this._rangeReaders[0];
  17955. if (firstReader.onProgress) {
  17956. firstReader.onProgress({ loaded: evt.loaded });
  17957. }
  17958. }
  17959. },
  17960. _removeRangeReader: function PDFWorkerStream_removeRangeReader(reader) {
  17961. var i = this._rangeReaders.indexOf(reader);
  17962. if (i >= 0) {
  17963. this._rangeReaders.splice(i, 1);
  17964. }
  17965. },
  17966. getFullReader: function PDFWorkerStream_getFullReader() {
  17967. assert(!this._fullRequestReader);
  17968. var queuedChunks = this._queuedChunks;
  17969. this._queuedChunks = null;
  17970. return new PDFWorkerStreamReader(this, queuedChunks);
  17971. },
  17972. getRangeReader: function PDFWorkerStream_getRangeReader(begin, end) {
  17973. var reader = new PDFWorkerStreamRangeReader(this, begin, end);
  17974. this._msgHandler.send('RequestDataRange', {
  17975. begin: begin,
  17976. end: end
  17977. });
  17978. this._rangeReaders.push(reader);
  17979. return reader;
  17980. },
  17981. cancelAllRequests: function PDFWorkerStream_cancelAllRequests(reason) {
  17982. if (this._fullRequestReader) {
  17983. this._fullRequestReader.cancel(reason);
  17984. }
  17985. var readers = this._rangeReaders.slice(0);
  17986. readers.forEach(function (rangeReader) {
  17987. rangeReader.cancel(reason);
  17988. });
  17989. }
  17990. };
  17991. function PDFWorkerStreamReader(stream, queuedChunks) {
  17992. this._stream = stream;
  17993. this._done = false;
  17994. this._queuedChunks = queuedChunks || [];
  17995. this._requests = [];
  17996. this._headersReady = Promise.resolve();
  17997. stream._fullRequestReader = this;
  17998. this.onProgress = null;
  17999. }
  18000. PDFWorkerStreamReader.prototype = {
  18001. _enqueue: function PDFWorkerStreamReader_enqueue(chunk) {
  18002. if (this._done) {
  18003. return;
  18004. }
  18005. if (this._requests.length > 0) {
  18006. var requestCapability = this._requests.shift();
  18007. requestCapability.resolve({
  18008. value: chunk,
  18009. done: false
  18010. });
  18011. return;
  18012. }
  18013. this._queuedChunks.push(chunk);
  18014. },
  18015. get headersReady() {
  18016. return this._headersReady;
  18017. },
  18018. get isRangeSupported() {
  18019. return this._stream._isRangeSupported;
  18020. },
  18021. get isStreamingSupported() {
  18022. return this._stream._isStreamingSupported;
  18023. },
  18024. get contentLength() {
  18025. return this._stream._contentLength;
  18026. },
  18027. read: function PDFWorkerStreamReader_read() {
  18028. if (this._queuedChunks.length > 0) {
  18029. var chunk = this._queuedChunks.shift();
  18030. return Promise.resolve({
  18031. value: chunk,
  18032. done: false
  18033. });
  18034. }
  18035. if (this._done) {
  18036. return Promise.resolve({
  18037. value: undefined,
  18038. done: true
  18039. });
  18040. }
  18041. var requestCapability = createPromiseCapability();
  18042. this._requests.push(requestCapability);
  18043. return requestCapability.promise;
  18044. },
  18045. cancel: function PDFWorkerStreamReader_cancel(reason) {
  18046. this._done = true;
  18047. this._requests.forEach(function (requestCapability) {
  18048. requestCapability.resolve({
  18049. value: undefined,
  18050. done: true
  18051. });
  18052. });
  18053. this._requests = [];
  18054. }
  18055. };
  18056. function PDFWorkerStreamRangeReader(stream, begin, end) {
  18057. this._stream = stream;
  18058. this._begin = begin;
  18059. this._end = end;
  18060. this._queuedChunk = null;
  18061. this._requests = [];
  18062. this._done = false;
  18063. this.onProgress = null;
  18064. }
  18065. PDFWorkerStreamRangeReader.prototype = {
  18066. _enqueue: function PDFWorkerStreamRangeReader_enqueue(chunk) {
  18067. if (this._done) {
  18068. return;
  18069. }
  18070. if (this._requests.length === 0) {
  18071. this._queuedChunk = chunk;
  18072. } else {
  18073. var requestsCapability = this._requests.shift();
  18074. requestsCapability.resolve({
  18075. value: chunk,
  18076. done: false
  18077. });
  18078. this._requests.forEach(function (requestCapability) {
  18079. requestCapability.resolve({
  18080. value: undefined,
  18081. done: true
  18082. });
  18083. });
  18084. this._requests = [];
  18085. }
  18086. this._done = true;
  18087. this._stream._removeRangeReader(this);
  18088. },
  18089. get isStreamingSupported() {
  18090. return false;
  18091. },
  18092. read: function PDFWorkerStreamRangeReader_read() {
  18093. if (this._queuedChunk) {
  18094. return Promise.resolve({
  18095. value: this._queuedChunk,
  18096. done: false
  18097. });
  18098. }
  18099. if (this._done) {
  18100. return Promise.resolve({
  18101. value: undefined,
  18102. done: true
  18103. });
  18104. }
  18105. var requestCapability = createPromiseCapability();
  18106. this._requests.push(requestCapability);
  18107. return requestCapability.promise;
  18108. },
  18109. cancel: function PDFWorkerStreamRangeReader_cancel(reason) {
  18110. this._done = true;
  18111. this._requests.forEach(function (requestCapability) {
  18112. requestCapability.resolve({
  18113. value: undefined,
  18114. done: true
  18115. });
  18116. });
  18117. this._requests = [];
  18118. this._stream._removeRangeReader(this);
  18119. }
  18120. };
  18121. return PDFWorkerStream;
  18122. }();
  18123. var PDFNetworkStream;
  18124. function setPDFNetworkStreamClass(cls) {
  18125. PDFNetworkStream = cls;
  18126. }
  18127. var WorkerMessageHandler = {
  18128. setup: function wphSetup(handler, port) {
  18129. var testMessageProcessed = false;
  18130. handler.on('test', function wphSetupTest(data) {
  18131. if (testMessageProcessed) {
  18132. return;
  18133. }
  18134. testMessageProcessed = true;
  18135. if (!(data instanceof Uint8Array)) {
  18136. handler.send('test', 'main', false);
  18137. return;
  18138. }
  18139. var supportTransfers = data[0] === 255;
  18140. handler.postMessageTransfers = supportTransfers;
  18141. var xhr = new XMLHttpRequest();
  18142. var responseExists = 'response' in xhr;
  18143. try {
  18144. xhr.responseType;
  18145. } catch (e) {
  18146. responseExists = false;
  18147. }
  18148. if (!responseExists) {
  18149. handler.send('test', false);
  18150. return;
  18151. }
  18152. handler.send('test', {
  18153. supportTypedArray: true,
  18154. supportTransfers: supportTransfers
  18155. });
  18156. });
  18157. handler.on('configure', function wphConfigure(data) {
  18158. setVerbosityLevel(data.verbosity);
  18159. });
  18160. handler.on('GetDocRequest', function wphSetupDoc(data) {
  18161. return WorkerMessageHandler.createDocumentHandler(data, port);
  18162. });
  18163. },
  18164. createDocumentHandler: function wphCreateDocumentHandler(docParams, port) {
  18165. var pdfManager;
  18166. var terminated = false;
  18167. var cancelXHRs = null;
  18168. var WorkerTasks = [];
  18169. var docId = docParams.docId;
  18170. var docBaseUrl = docParams.docBaseUrl;
  18171. var workerHandlerName = docParams.docId + '_worker';
  18172. var handler = new MessageHandler(workerHandlerName, docId, port);
  18173. handler.postMessageTransfers = docParams.postMessageTransfers;
  18174. function ensureNotTerminated() {
  18175. if (terminated) {
  18176. throw new Error('Worker was terminated');
  18177. }
  18178. }
  18179. function startWorkerTask(task) {
  18180. WorkerTasks.push(task);
  18181. }
  18182. function finishWorkerTask(task) {
  18183. task.finish();
  18184. var i = WorkerTasks.indexOf(task);
  18185. WorkerTasks.splice(i, 1);
  18186. }
  18187. function loadDocument(recoveryMode) {
  18188. var loadDocumentCapability = createPromiseCapability();
  18189. var parseSuccess = function parseSuccess() {
  18190. var numPagesPromise = pdfManager.ensureDoc('numPages');
  18191. var fingerprintPromise = pdfManager.ensureDoc('fingerprint');
  18192. var encryptedPromise = pdfManager.ensureXRef('encrypt');
  18193. Promise.all([
  18194. numPagesPromise,
  18195. fingerprintPromise,
  18196. encryptedPromise
  18197. ]).then(function onDocReady(results) {
  18198. var doc = {
  18199. numPages: results[0],
  18200. fingerprint: results[1],
  18201. encrypted: !!results[2]
  18202. };
  18203. loadDocumentCapability.resolve(doc);
  18204. }, parseFailure);
  18205. };
  18206. var parseFailure = function parseFailure(e) {
  18207. loadDocumentCapability.reject(e);
  18208. };
  18209. pdfManager.ensureDoc('checkHeader', []).then(function () {
  18210. pdfManager.ensureDoc('parseStartXRef', []).then(function () {
  18211. pdfManager.ensureDoc('parse', [recoveryMode]).then(parseSuccess, parseFailure);
  18212. }, parseFailure);
  18213. }, parseFailure);
  18214. return loadDocumentCapability.promise;
  18215. }
  18216. function getPdfManager(data, evaluatorOptions) {
  18217. var pdfManagerCapability = createPromiseCapability();
  18218. var pdfManager;
  18219. var source = data.source;
  18220. if (source.data) {
  18221. try {
  18222. pdfManager = new LocalPdfManager(docId, source.data, source.password, evaluatorOptions, docBaseUrl);
  18223. pdfManagerCapability.resolve(pdfManager);
  18224. } catch (ex) {
  18225. pdfManagerCapability.reject(ex);
  18226. }
  18227. return pdfManagerCapability.promise;
  18228. }
  18229. var pdfStream;
  18230. try {
  18231. if (source.chunkedViewerLoading) {
  18232. pdfStream = new PDFWorkerStream(source, handler);
  18233. } else {
  18234. assert(PDFNetworkStream, 'pdfjs/core/network module is not loaded');
  18235. pdfStream = new PDFNetworkStream(data);
  18236. }
  18237. } catch (ex) {
  18238. pdfManagerCapability.reject(ex);
  18239. return pdfManagerCapability.promise;
  18240. }
  18241. var fullRequest = pdfStream.getFullReader();
  18242. fullRequest.headersReady.then(function () {
  18243. if (!fullRequest.isStreamingSupported || !fullRequest.isRangeSupported) {
  18244. fullRequest.onProgress = function (evt) {
  18245. handler.send('DocProgress', {
  18246. loaded: evt.loaded,
  18247. total: evt.total
  18248. });
  18249. };
  18250. }
  18251. if (!fullRequest.isRangeSupported) {
  18252. return;
  18253. }
  18254. var disableAutoFetch = source.disableAutoFetch || fullRequest.isStreamingSupported;
  18255. pdfManager = new NetworkPdfManager(docId, pdfStream, {
  18256. msgHandler: handler,
  18257. url: source.url,
  18258. password: source.password,
  18259. length: fullRequest.contentLength,
  18260. disableAutoFetch: disableAutoFetch,
  18261. rangeChunkSize: source.rangeChunkSize
  18262. }, evaluatorOptions, docBaseUrl);
  18263. pdfManagerCapability.resolve(pdfManager);
  18264. cancelXHRs = null;
  18265. }).catch(function (reason) {
  18266. pdfManagerCapability.reject(reason);
  18267. cancelXHRs = null;
  18268. });
  18269. var cachedChunks = [], loaded = 0;
  18270. var flushChunks = function () {
  18271. var pdfFile = arraysToBytes(cachedChunks);
  18272. if (source.length && pdfFile.length !== source.length) {
  18273. warn('reported HTTP length is different from actual');
  18274. }
  18275. try {
  18276. pdfManager = new LocalPdfManager(docId, pdfFile, source.password, evaluatorOptions, docBaseUrl);
  18277. pdfManagerCapability.resolve(pdfManager);
  18278. } catch (ex) {
  18279. pdfManagerCapability.reject(ex);
  18280. }
  18281. cachedChunks = [];
  18282. };
  18283. var readPromise = new Promise(function (resolve, reject) {
  18284. var readChunk = function (chunk) {
  18285. try {
  18286. ensureNotTerminated();
  18287. if (chunk.done) {
  18288. if (!pdfManager) {
  18289. flushChunks();
  18290. }
  18291. cancelXHRs = null;
  18292. return;
  18293. }
  18294. var data = chunk.value;
  18295. loaded += arrayByteLength(data);
  18296. if (!fullRequest.isStreamingSupported) {
  18297. handler.send('DocProgress', {
  18298. loaded: loaded,
  18299. total: Math.max(loaded, fullRequest.contentLength || 0)
  18300. });
  18301. }
  18302. if (pdfManager) {
  18303. pdfManager.sendProgressiveData(data);
  18304. } else {
  18305. cachedChunks.push(data);
  18306. }
  18307. fullRequest.read().then(readChunk, reject);
  18308. } catch (e) {
  18309. reject(e);
  18310. }
  18311. };
  18312. fullRequest.read().then(readChunk, reject);
  18313. });
  18314. readPromise.catch(function (e) {
  18315. pdfManagerCapability.reject(e);
  18316. cancelXHRs = null;
  18317. });
  18318. cancelXHRs = function () {
  18319. pdfStream.cancelAllRequests('abort');
  18320. };
  18321. return pdfManagerCapability.promise;
  18322. }
  18323. function setupDoc(data) {
  18324. function onSuccess(doc) {
  18325. ensureNotTerminated();
  18326. handler.send('GetDoc', { pdfInfo: doc });
  18327. }
  18328. function onFailure(e) {
  18329. if (e instanceof PasswordException) {
  18330. var task = new WorkerTask('PasswordException: response ' + e.code);
  18331. startWorkerTask(task);
  18332. handler.sendWithPromise('PasswordRequest', e).then(function (data) {
  18333. finishWorkerTask(task);
  18334. pdfManager.updatePassword(data.password);
  18335. pdfManagerReady();
  18336. }).catch(function (ex) {
  18337. finishWorkerTask(task);
  18338. handler.send('PasswordException', ex);
  18339. }.bind(null, e));
  18340. } else if (e instanceof InvalidPDFException) {
  18341. handler.send('InvalidPDF', e);
  18342. } else if (e instanceof MissingPDFException) {
  18343. handler.send('MissingPDF', e);
  18344. } else if (e instanceof UnexpectedResponseException) {
  18345. handler.send('UnexpectedResponse', e);
  18346. } else {
  18347. handler.send('UnknownError', new UnknownErrorException(e.message, e.toString()));
  18348. }
  18349. }
  18350. function pdfManagerReady() {
  18351. ensureNotTerminated();
  18352. loadDocument(false).then(onSuccess, function loadFailure(ex) {
  18353. ensureNotTerminated();
  18354. if (!(ex instanceof XRefParseException)) {
  18355. onFailure(ex);
  18356. return;
  18357. }
  18358. pdfManager.requestLoadedStream();
  18359. pdfManager.onLoadedStream().then(function () {
  18360. ensureNotTerminated();
  18361. loadDocument(true).then(onSuccess, onFailure);
  18362. });
  18363. }, onFailure);
  18364. }
  18365. ensureNotTerminated();
  18366. var evaluatorOptions = {
  18367. forceDataSchema: data.disableCreateObjectURL,
  18368. maxImageSize: data.maxImageSize === undefined ? -1 : data.maxImageSize,
  18369. disableFontFace: data.disableFontFace,
  18370. disableNativeImageDecoder: data.disableNativeImageDecoder
  18371. };
  18372. getPdfManager(data, evaluatorOptions).then(function (newPdfManager) {
  18373. if (terminated) {
  18374. newPdfManager.terminate();
  18375. throw new Error('Worker was terminated');
  18376. }
  18377. pdfManager = newPdfManager;
  18378. handler.send('PDFManagerReady', null);
  18379. pdfManager.onLoadedStream().then(function (stream) {
  18380. handler.send('DataLoaded', { length: stream.bytes.byteLength });
  18381. });
  18382. }).then(pdfManagerReady, onFailure);
  18383. }
  18384. handler.on('GetPage', function wphSetupGetPage(data) {
  18385. return pdfManager.getPage(data.pageIndex).then(function (page) {
  18386. var rotatePromise = pdfManager.ensure(page, 'rotate');
  18387. var refPromise = pdfManager.ensure(page, 'ref');
  18388. var userUnitPromise = pdfManager.ensure(page, 'userUnit');
  18389. var viewPromise = pdfManager.ensure(page, 'view');
  18390. return Promise.all([
  18391. rotatePromise,
  18392. refPromise,
  18393. userUnitPromise,
  18394. viewPromise
  18395. ]).then(function (results) {
  18396. return {
  18397. rotate: results[0],
  18398. ref: results[1],
  18399. userUnit: results[2],
  18400. view: results[3]
  18401. };
  18402. });
  18403. });
  18404. });
  18405. handler.on('GetPageIndex', function wphSetupGetPageIndex(data) {
  18406. var ref = new Ref(data.ref.num, data.ref.gen);
  18407. var catalog = pdfManager.pdfDocument.catalog;
  18408. return catalog.getPageIndex(ref);
  18409. });
  18410. handler.on('GetDestinations', function wphSetupGetDestinations(data) {
  18411. return pdfManager.ensureCatalog('destinations');
  18412. });
  18413. handler.on('GetDestination', function wphSetupGetDestination(data) {
  18414. return pdfManager.ensureCatalog('getDestination', [data.id]);
  18415. });
  18416. handler.on('GetPageLabels', function wphSetupGetPageLabels(data) {
  18417. return pdfManager.ensureCatalog('pageLabels');
  18418. });
  18419. handler.on('GetAttachments', function wphSetupGetAttachments(data) {
  18420. return pdfManager.ensureCatalog('attachments');
  18421. });
  18422. handler.on('GetJavaScript', function wphSetupGetJavaScript(data) {
  18423. return pdfManager.ensureCatalog('javaScript');
  18424. });
  18425. handler.on('GetOutline', function wphSetupGetOutline(data) {
  18426. return pdfManager.ensureCatalog('documentOutline');
  18427. });
  18428. handler.on('GetMetadata', function wphSetupGetMetadata(data) {
  18429. return Promise.all([
  18430. pdfManager.ensureDoc('documentInfo'),
  18431. pdfManager.ensureCatalog('metadata')
  18432. ]);
  18433. });
  18434. handler.on('GetData', function wphSetupGetData(data) {
  18435. pdfManager.requestLoadedStream();
  18436. return pdfManager.onLoadedStream().then(function (stream) {
  18437. return stream.bytes;
  18438. });
  18439. });
  18440. handler.on('GetStats', function wphSetupGetStats(data) {
  18441. return pdfManager.pdfDocument.xref.stats;
  18442. });
  18443. handler.on('GetAnnotations', function wphSetupGetAnnotations(data) {
  18444. return pdfManager.getPage(data.pageIndex).then(function (page) {
  18445. return pdfManager.ensure(page, 'getAnnotationsData', [data.intent]);
  18446. });
  18447. });
  18448. handler.on('RenderPageRequest', function wphSetupRenderPage(data) {
  18449. var pageIndex = data.pageIndex;
  18450. pdfManager.getPage(pageIndex).then(function (page) {
  18451. var task = new WorkerTask('RenderPageRequest: page ' + pageIndex);
  18452. startWorkerTask(task);
  18453. var pageNum = pageIndex + 1;
  18454. var start = Date.now();
  18455. page.getOperatorList(handler, task, data.intent, data.renderInteractiveForms).then(function (operatorList) {
  18456. finishWorkerTask(task);
  18457. info('page=' + pageNum + ' - getOperatorList: time=' + (Date.now() - start) + 'ms, len=' + operatorList.totalLength);
  18458. }, function (e) {
  18459. finishWorkerTask(task);
  18460. if (task.terminated) {
  18461. return;
  18462. }
  18463. handler.send('UnsupportedFeature', { featureId: UNSUPPORTED_FEATURES.unknown });
  18464. var minimumStackMessage = 'worker.js: while trying to getPage() and getOperatorList()';
  18465. var wrappedException;
  18466. if (typeof e === 'string') {
  18467. wrappedException = {
  18468. message: e,
  18469. stack: minimumStackMessage
  18470. };
  18471. } else if (typeof e === 'object') {
  18472. wrappedException = {
  18473. message: e.message || e.toString(),
  18474. stack: e.stack || minimumStackMessage
  18475. };
  18476. } else {
  18477. wrappedException = {
  18478. message: 'Unknown exception type: ' + typeof e,
  18479. stack: minimumStackMessage
  18480. };
  18481. }
  18482. handler.send('PageError', {
  18483. pageNum: pageNum,
  18484. error: wrappedException,
  18485. intent: data.intent
  18486. });
  18487. });
  18488. });
  18489. }, this);
  18490. handler.on('GetTextContent', function wphExtractText(data) {
  18491. var pageIndex = data.pageIndex;
  18492. var normalizeWhitespace = data.normalizeWhitespace;
  18493. var combineTextItems = data.combineTextItems;
  18494. return pdfManager.getPage(pageIndex).then(function (page) {
  18495. var task = new WorkerTask('GetTextContent: page ' + pageIndex);
  18496. startWorkerTask(task);
  18497. var pageNum = pageIndex + 1;
  18498. var start = Date.now();
  18499. return page.extractTextContent(task, normalizeWhitespace, combineTextItems).then(function (textContent) {
  18500. finishWorkerTask(task);
  18501. info('text indexing: page=' + pageNum + ' - time=' + (Date.now() - start) + 'ms');
  18502. return textContent;
  18503. }, function (reason) {
  18504. finishWorkerTask(task);
  18505. if (task.terminated) {
  18506. return;
  18507. }
  18508. throw reason;
  18509. });
  18510. });
  18511. });
  18512. handler.on('Cleanup', function wphCleanup(data) {
  18513. return pdfManager.cleanup();
  18514. });
  18515. handler.on('Terminate', function wphTerminate(data) {
  18516. terminated = true;
  18517. if (pdfManager) {
  18518. pdfManager.terminate();
  18519. pdfManager = null;
  18520. }
  18521. if (cancelXHRs) {
  18522. cancelXHRs();
  18523. }
  18524. var waitOn = [];
  18525. WorkerTasks.forEach(function (task) {
  18526. waitOn.push(task.finished);
  18527. task.terminate();
  18528. });
  18529. return Promise.all(waitOn).then(function () {
  18530. handler.destroy();
  18531. handler = null;
  18532. });
  18533. });
  18534. handler.on('Ready', function wphReady(data) {
  18535. setupDoc(docParams);
  18536. docParams = null;
  18537. });
  18538. return workerHandlerName;
  18539. }
  18540. };
  18541. function initializeWorker() {
  18542. var handler = new MessageHandler('worker', 'main', self);
  18543. WorkerMessageHandler.setup(handler, self);
  18544. handler.send('ready', null);
  18545. }
  18546. if (typeof window === 'undefined' && !isNodeJS()) {
  18547. initializeWorker();
  18548. }
  18549. exports.setPDFNetworkStreamClass = setPDFNetworkStreamClass;
  18550. exports.WorkerTask = WorkerTask;
  18551. exports.WorkerMessageHandler = WorkerMessageHandler;
  18552. /***/ }),
  18553. /* 9 */
  18554. /***/ (function(module, exports) {
  18555. var g;
  18556. g = function () {
  18557. return this;
  18558. }();
  18559. try {
  18560. g = g || Function("return this")() || (1, eval)("this");
  18561. } catch (e) {
  18562. if (typeof window === "object")
  18563. g = window;
  18564. }
  18565. module.exports = g;
  18566. /***/ }),
  18567. /* 10 */
  18568. /***/ (function(module, exports, __w_pdfjs_require__) {
  18569. "use strict";
  18570. var ArithmeticDecoder = function ArithmeticDecoderClosure() {
  18571. var QeTable = [
  18572. {
  18573. qe: 0x5601,
  18574. nmps: 1,
  18575. nlps: 1,
  18576. switchFlag: 1
  18577. },
  18578. {
  18579. qe: 0x3401,
  18580. nmps: 2,
  18581. nlps: 6,
  18582. switchFlag: 0
  18583. },
  18584. {
  18585. qe: 0x1801,
  18586. nmps: 3,
  18587. nlps: 9,
  18588. switchFlag: 0
  18589. },
  18590. {
  18591. qe: 0x0AC1,
  18592. nmps: 4,
  18593. nlps: 12,
  18594. switchFlag: 0
  18595. },
  18596. {
  18597. qe: 0x0521,
  18598. nmps: 5,
  18599. nlps: 29,
  18600. switchFlag: 0
  18601. },
  18602. {
  18603. qe: 0x0221,
  18604. nmps: 38,
  18605. nlps: 33,
  18606. switchFlag: 0
  18607. },
  18608. {
  18609. qe: 0x5601,
  18610. nmps: 7,
  18611. nlps: 6,
  18612. switchFlag: 1
  18613. },
  18614. {
  18615. qe: 0x5401,
  18616. nmps: 8,
  18617. nlps: 14,
  18618. switchFlag: 0
  18619. },
  18620. {
  18621. qe: 0x4801,
  18622. nmps: 9,
  18623. nlps: 14,
  18624. switchFlag: 0
  18625. },
  18626. {
  18627. qe: 0x3801,
  18628. nmps: 10,
  18629. nlps: 14,
  18630. switchFlag: 0
  18631. },
  18632. {
  18633. qe: 0x3001,
  18634. nmps: 11,
  18635. nlps: 17,
  18636. switchFlag: 0
  18637. },
  18638. {
  18639. qe: 0x2401,
  18640. nmps: 12,
  18641. nlps: 18,
  18642. switchFlag: 0
  18643. },
  18644. {
  18645. qe: 0x1C01,
  18646. nmps: 13,
  18647. nlps: 20,
  18648. switchFlag: 0
  18649. },
  18650. {
  18651. qe: 0x1601,
  18652. nmps: 29,
  18653. nlps: 21,
  18654. switchFlag: 0
  18655. },
  18656. {
  18657. qe: 0x5601,
  18658. nmps: 15,
  18659. nlps: 14,
  18660. switchFlag: 1
  18661. },
  18662. {
  18663. qe: 0x5401,
  18664. nmps: 16,
  18665. nlps: 14,
  18666. switchFlag: 0
  18667. },
  18668. {
  18669. qe: 0x5101,
  18670. nmps: 17,
  18671. nlps: 15,
  18672. switchFlag: 0
  18673. },
  18674. {
  18675. qe: 0x4801,
  18676. nmps: 18,
  18677. nlps: 16,
  18678. switchFlag: 0
  18679. },
  18680. {
  18681. qe: 0x3801,
  18682. nmps: 19,
  18683. nlps: 17,
  18684. switchFlag: 0
  18685. },
  18686. {
  18687. qe: 0x3401,
  18688. nmps: 20,
  18689. nlps: 18,
  18690. switchFlag: 0
  18691. },
  18692. {
  18693. qe: 0x3001,
  18694. nmps: 21,
  18695. nlps: 19,
  18696. switchFlag: 0
  18697. },
  18698. {
  18699. qe: 0x2801,
  18700. nmps: 22,
  18701. nlps: 19,
  18702. switchFlag: 0
  18703. },
  18704. {
  18705. qe: 0x2401,
  18706. nmps: 23,
  18707. nlps: 20,
  18708. switchFlag: 0
  18709. },
  18710. {
  18711. qe: 0x2201,
  18712. nmps: 24,
  18713. nlps: 21,
  18714. switchFlag: 0
  18715. },
  18716. {
  18717. qe: 0x1C01,
  18718. nmps: 25,
  18719. nlps: 22,
  18720. switchFlag: 0
  18721. },
  18722. {
  18723. qe: 0x1801,
  18724. nmps: 26,
  18725. nlps: 23,
  18726. switchFlag: 0
  18727. },
  18728. {
  18729. qe: 0x1601,
  18730. nmps: 27,
  18731. nlps: 24,
  18732. switchFlag: 0
  18733. },
  18734. {
  18735. qe: 0x1401,
  18736. nmps: 28,
  18737. nlps: 25,
  18738. switchFlag: 0
  18739. },
  18740. {
  18741. qe: 0x1201,
  18742. nmps: 29,
  18743. nlps: 26,
  18744. switchFlag: 0
  18745. },
  18746. {
  18747. qe: 0x1101,
  18748. nmps: 30,
  18749. nlps: 27,
  18750. switchFlag: 0
  18751. },
  18752. {
  18753. qe: 0x0AC1,
  18754. nmps: 31,
  18755. nlps: 28,
  18756. switchFlag: 0
  18757. },
  18758. {
  18759. qe: 0x09C1,
  18760. nmps: 32,
  18761. nlps: 29,
  18762. switchFlag: 0
  18763. },
  18764. {
  18765. qe: 0x08A1,
  18766. nmps: 33,
  18767. nlps: 30,
  18768. switchFlag: 0
  18769. },
  18770. {
  18771. qe: 0x0521,
  18772. nmps: 34,
  18773. nlps: 31,
  18774. switchFlag: 0
  18775. },
  18776. {
  18777. qe: 0x0441,
  18778. nmps: 35,
  18779. nlps: 32,
  18780. switchFlag: 0
  18781. },
  18782. {
  18783. qe: 0x02A1,
  18784. nmps: 36,
  18785. nlps: 33,
  18786. switchFlag: 0
  18787. },
  18788. {
  18789. qe: 0x0221,
  18790. nmps: 37,
  18791. nlps: 34,
  18792. switchFlag: 0
  18793. },
  18794. {
  18795. qe: 0x0141,
  18796. nmps: 38,
  18797. nlps: 35,
  18798. switchFlag: 0
  18799. },
  18800. {
  18801. qe: 0x0111,
  18802. nmps: 39,
  18803. nlps: 36,
  18804. switchFlag: 0
  18805. },
  18806. {
  18807. qe: 0x0085,
  18808. nmps: 40,
  18809. nlps: 37,
  18810. switchFlag: 0
  18811. },
  18812. {
  18813. qe: 0x0049,
  18814. nmps: 41,
  18815. nlps: 38,
  18816. switchFlag: 0
  18817. },
  18818. {
  18819. qe: 0x0025,
  18820. nmps: 42,
  18821. nlps: 39,
  18822. switchFlag: 0
  18823. },
  18824. {
  18825. qe: 0x0015,
  18826. nmps: 43,
  18827. nlps: 40,
  18828. switchFlag: 0
  18829. },
  18830. {
  18831. qe: 0x0009,
  18832. nmps: 44,
  18833. nlps: 41,
  18834. switchFlag: 0
  18835. },
  18836. {
  18837. qe: 0x0005,
  18838. nmps: 45,
  18839. nlps: 42,
  18840. switchFlag: 0
  18841. },
  18842. {
  18843. qe: 0x0001,
  18844. nmps: 45,
  18845. nlps: 43,
  18846. switchFlag: 0
  18847. },
  18848. {
  18849. qe: 0x5601,
  18850. nmps: 46,
  18851. nlps: 46,
  18852. switchFlag: 0
  18853. }
  18854. ];
  18855. function ArithmeticDecoder(data, start, end) {
  18856. this.data = data;
  18857. this.bp = start;
  18858. this.dataEnd = end;
  18859. this.chigh = data[start];
  18860. this.clow = 0;
  18861. this.byteIn();
  18862. this.chigh = this.chigh << 7 & 0xFFFF | this.clow >> 9 & 0x7F;
  18863. this.clow = this.clow << 7 & 0xFFFF;
  18864. this.ct -= 7;
  18865. this.a = 0x8000;
  18866. }
  18867. ArithmeticDecoder.prototype = {
  18868. byteIn: function ArithmeticDecoder_byteIn() {
  18869. var data = this.data;
  18870. var bp = this.bp;
  18871. if (data[bp] === 0xFF) {
  18872. var b1 = data[bp + 1];
  18873. if (b1 > 0x8F) {
  18874. this.clow += 0xFF00;
  18875. this.ct = 8;
  18876. } else {
  18877. bp++;
  18878. this.clow += data[bp] << 9;
  18879. this.ct = 7;
  18880. this.bp = bp;
  18881. }
  18882. } else {
  18883. bp++;
  18884. this.clow += bp < this.dataEnd ? data[bp] << 8 : 0xFF00;
  18885. this.ct = 8;
  18886. this.bp = bp;
  18887. }
  18888. if (this.clow > 0xFFFF) {
  18889. this.chigh += this.clow >> 16;
  18890. this.clow &= 0xFFFF;
  18891. }
  18892. },
  18893. readBit: function ArithmeticDecoder_readBit(contexts, pos) {
  18894. var cx_index = contexts[pos] >> 1, cx_mps = contexts[pos] & 1;
  18895. var qeTableIcx = QeTable[cx_index];
  18896. var qeIcx = qeTableIcx.qe;
  18897. var d;
  18898. var a = this.a - qeIcx;
  18899. if (this.chigh < qeIcx) {
  18900. if (a < qeIcx) {
  18901. a = qeIcx;
  18902. d = cx_mps;
  18903. cx_index = qeTableIcx.nmps;
  18904. } else {
  18905. a = qeIcx;
  18906. d = 1 ^ cx_mps;
  18907. if (qeTableIcx.switchFlag === 1) {
  18908. cx_mps = d;
  18909. }
  18910. cx_index = qeTableIcx.nlps;
  18911. }
  18912. } else {
  18913. this.chigh -= qeIcx;
  18914. if ((a & 0x8000) !== 0) {
  18915. this.a = a;
  18916. return cx_mps;
  18917. }
  18918. if (a < qeIcx) {
  18919. d = 1 ^ cx_mps;
  18920. if (qeTableIcx.switchFlag === 1) {
  18921. cx_mps = d;
  18922. }
  18923. cx_index = qeTableIcx.nlps;
  18924. } else {
  18925. d = cx_mps;
  18926. cx_index = qeTableIcx.nmps;
  18927. }
  18928. }
  18929. do {
  18930. if (this.ct === 0) {
  18931. this.byteIn();
  18932. }
  18933. a <<= 1;
  18934. this.chigh = this.chigh << 1 & 0xFFFF | this.clow >> 15 & 1;
  18935. this.clow = this.clow << 1 & 0xFFFF;
  18936. this.ct--;
  18937. } while ((a & 0x8000) === 0);
  18938. this.a = a;
  18939. contexts[pos] = cx_index << 1 | cx_mps;
  18940. return d;
  18941. }
  18942. };
  18943. return ArithmeticDecoder;
  18944. }();
  18945. exports.ArithmeticDecoder = ArithmeticDecoder;
  18946. /***/ }),
  18947. /* 11 */
  18948. /***/ (function(module, exports, __w_pdfjs_require__) {
  18949. "use strict";
  18950. var sharedUtil = __w_pdfjs_require__(0);
  18951. var coreCharsets = __w_pdfjs_require__(22);
  18952. var coreEncodings = __w_pdfjs_require__(4);
  18953. var error = sharedUtil.error;
  18954. var info = sharedUtil.info;
  18955. var bytesToString = sharedUtil.bytesToString;
  18956. var warn = sharedUtil.warn;
  18957. var isArray = sharedUtil.isArray;
  18958. var Util = sharedUtil.Util;
  18959. var stringToBytes = sharedUtil.stringToBytes;
  18960. var assert = sharedUtil.assert;
  18961. var ISOAdobeCharset = coreCharsets.ISOAdobeCharset;
  18962. var ExpertCharset = coreCharsets.ExpertCharset;
  18963. var ExpertSubsetCharset = coreCharsets.ExpertSubsetCharset;
  18964. var StandardEncoding = coreEncodings.StandardEncoding;
  18965. var ExpertEncoding = coreEncodings.ExpertEncoding;
  18966. var MAX_SUBR_NESTING = 10;
  18967. var CFFStandardStrings = [
  18968. '.notdef',
  18969. 'space',
  18970. 'exclam',
  18971. 'quotedbl',
  18972. 'numbersign',
  18973. 'dollar',
  18974. 'percent',
  18975. 'ampersand',
  18976. 'quoteright',
  18977. 'parenleft',
  18978. 'parenright',
  18979. 'asterisk',
  18980. 'plus',
  18981. 'comma',
  18982. 'hyphen',
  18983. 'period',
  18984. 'slash',
  18985. 'zero',
  18986. 'one',
  18987. 'two',
  18988. 'three',
  18989. 'four',
  18990. 'five',
  18991. 'six',
  18992. 'seven',
  18993. 'eight',
  18994. 'nine',
  18995. 'colon',
  18996. 'semicolon',
  18997. 'less',
  18998. 'equal',
  18999. 'greater',
  19000. 'question',
  19001. 'at',
  19002. 'A',
  19003. 'B',
  19004. 'C',
  19005. 'D',
  19006. 'E',
  19007. 'F',
  19008. 'G',
  19009. 'H',
  19010. 'I',
  19011. 'J',
  19012. 'K',
  19013. 'L',
  19014. 'M',
  19015. 'N',
  19016. 'O',
  19017. 'P',
  19018. 'Q',
  19019. 'R',
  19020. 'S',
  19021. 'T',
  19022. 'U',
  19023. 'V',
  19024. 'W',
  19025. 'X',
  19026. 'Y',
  19027. 'Z',
  19028. 'bracketleft',
  19029. 'backslash',
  19030. 'bracketright',
  19031. 'asciicircum',
  19032. 'underscore',
  19033. 'quoteleft',
  19034. 'a',
  19035. 'b',
  19036. 'c',
  19037. 'd',
  19038. 'e',
  19039. 'f',
  19040. 'g',
  19041. 'h',
  19042. 'i',
  19043. 'j',
  19044. 'k',
  19045. 'l',
  19046. 'm',
  19047. 'n',
  19048. 'o',
  19049. 'p',
  19050. 'q',
  19051. 'r',
  19052. 's',
  19053. 't',
  19054. 'u',
  19055. 'v',
  19056. 'w',
  19057. 'x',
  19058. 'y',
  19059. 'z',
  19060. 'braceleft',
  19061. 'bar',
  19062. 'braceright',
  19063. 'asciitilde',
  19064. 'exclamdown',
  19065. 'cent',
  19066. 'sterling',
  19067. 'fraction',
  19068. 'yen',
  19069. 'florin',
  19070. 'section',
  19071. 'currency',
  19072. 'quotesingle',
  19073. 'quotedblleft',
  19074. 'guillemotleft',
  19075. 'guilsinglleft',
  19076. 'guilsinglright',
  19077. 'fi',
  19078. 'fl',
  19079. 'endash',
  19080. 'dagger',
  19081. 'daggerdbl',
  19082. 'periodcentered',
  19083. 'paragraph',
  19084. 'bullet',
  19085. 'quotesinglbase',
  19086. 'quotedblbase',
  19087. 'quotedblright',
  19088. 'guillemotright',
  19089. 'ellipsis',
  19090. 'perthousand',
  19091. 'questiondown',
  19092. 'grave',
  19093. 'acute',
  19094. 'circumflex',
  19095. 'tilde',
  19096. 'macron',
  19097. 'breve',
  19098. 'dotaccent',
  19099. 'dieresis',
  19100. 'ring',
  19101. 'cedilla',
  19102. 'hungarumlaut',
  19103. 'ogonek',
  19104. 'caron',
  19105. 'emdash',
  19106. 'AE',
  19107. 'ordfeminine',
  19108. 'Lslash',
  19109. 'Oslash',
  19110. 'OE',
  19111. 'ordmasculine',
  19112. 'ae',
  19113. 'dotlessi',
  19114. 'lslash',
  19115. 'oslash',
  19116. 'oe',
  19117. 'germandbls',
  19118. 'onesuperior',
  19119. 'logicalnot',
  19120. 'mu',
  19121. 'trademark',
  19122. 'Eth',
  19123. 'onehalf',
  19124. 'plusminus',
  19125. 'Thorn',
  19126. 'onequarter',
  19127. 'divide',
  19128. 'brokenbar',
  19129. 'degree',
  19130. 'thorn',
  19131. 'threequarters',
  19132. 'twosuperior',
  19133. 'registered',
  19134. 'minus',
  19135. 'eth',
  19136. 'multiply',
  19137. 'threesuperior',
  19138. 'copyright',
  19139. 'Aacute',
  19140. 'Acircumflex',
  19141. 'Adieresis',
  19142. 'Agrave',
  19143. 'Aring',
  19144. 'Atilde',
  19145. 'Ccedilla',
  19146. 'Eacute',
  19147. 'Ecircumflex',
  19148. 'Edieresis',
  19149. 'Egrave',
  19150. 'Iacute',
  19151. 'Icircumflex',
  19152. 'Idieresis',
  19153. 'Igrave',
  19154. 'Ntilde',
  19155. 'Oacute',
  19156. 'Ocircumflex',
  19157. 'Odieresis',
  19158. 'Ograve',
  19159. 'Otilde',
  19160. 'Scaron',
  19161. 'Uacute',
  19162. 'Ucircumflex',
  19163. 'Udieresis',
  19164. 'Ugrave',
  19165. 'Yacute',
  19166. 'Ydieresis',
  19167. 'Zcaron',
  19168. 'aacute',
  19169. 'acircumflex',
  19170. 'adieresis',
  19171. 'agrave',
  19172. 'aring',
  19173. 'atilde',
  19174. 'ccedilla',
  19175. 'eacute',
  19176. 'ecircumflex',
  19177. 'edieresis',
  19178. 'egrave',
  19179. 'iacute',
  19180. 'icircumflex',
  19181. 'idieresis',
  19182. 'igrave',
  19183. 'ntilde',
  19184. 'oacute',
  19185. 'ocircumflex',
  19186. 'odieresis',
  19187. 'ograve',
  19188. 'otilde',
  19189. 'scaron',
  19190. 'uacute',
  19191. 'ucircumflex',
  19192. 'udieresis',
  19193. 'ugrave',
  19194. 'yacute',
  19195. 'ydieresis',
  19196. 'zcaron',
  19197. 'exclamsmall',
  19198. 'Hungarumlautsmall',
  19199. 'dollaroldstyle',
  19200. 'dollarsuperior',
  19201. 'ampersandsmall',
  19202. 'Acutesmall',
  19203. 'parenleftsuperior',
  19204. 'parenrightsuperior',
  19205. 'twodotenleader',
  19206. 'onedotenleader',
  19207. 'zerooldstyle',
  19208. 'oneoldstyle',
  19209. 'twooldstyle',
  19210. 'threeoldstyle',
  19211. 'fouroldstyle',
  19212. 'fiveoldstyle',
  19213. 'sixoldstyle',
  19214. 'sevenoldstyle',
  19215. 'eightoldstyle',
  19216. 'nineoldstyle',
  19217. 'commasuperior',
  19218. 'threequartersemdash',
  19219. 'periodsuperior',
  19220. 'questionsmall',
  19221. 'asuperior',
  19222. 'bsuperior',
  19223. 'centsuperior',
  19224. 'dsuperior',
  19225. 'esuperior',
  19226. 'isuperior',
  19227. 'lsuperior',
  19228. 'msuperior',
  19229. 'nsuperior',
  19230. 'osuperior',
  19231. 'rsuperior',
  19232. 'ssuperior',
  19233. 'tsuperior',
  19234. 'ff',
  19235. 'ffi',
  19236. 'ffl',
  19237. 'parenleftinferior',
  19238. 'parenrightinferior',
  19239. 'Circumflexsmall',
  19240. 'hyphensuperior',
  19241. 'Gravesmall',
  19242. 'Asmall',
  19243. 'Bsmall',
  19244. 'Csmall',
  19245. 'Dsmall',
  19246. 'Esmall',
  19247. 'Fsmall',
  19248. 'Gsmall',
  19249. 'Hsmall',
  19250. 'Ismall',
  19251. 'Jsmall',
  19252. 'Ksmall',
  19253. 'Lsmall',
  19254. 'Msmall',
  19255. 'Nsmall',
  19256. 'Osmall',
  19257. 'Psmall',
  19258. 'Qsmall',
  19259. 'Rsmall',
  19260. 'Ssmall',
  19261. 'Tsmall',
  19262. 'Usmall',
  19263. 'Vsmall',
  19264. 'Wsmall',
  19265. 'Xsmall',
  19266. 'Ysmall',
  19267. 'Zsmall',
  19268. 'colonmonetary',
  19269. 'onefitted',
  19270. 'rupiah',
  19271. 'Tildesmall',
  19272. 'exclamdownsmall',
  19273. 'centoldstyle',
  19274. 'Lslashsmall',
  19275. 'Scaronsmall',
  19276. 'Zcaronsmall',
  19277. 'Dieresissmall',
  19278. 'Brevesmall',
  19279. 'Caronsmall',
  19280. 'Dotaccentsmall',
  19281. 'Macronsmall',
  19282. 'figuredash',
  19283. 'hypheninferior',
  19284. 'Ogoneksmall',
  19285. 'Ringsmall',
  19286. 'Cedillasmall',
  19287. 'questiondownsmall',
  19288. 'oneeighth',
  19289. 'threeeighths',
  19290. 'fiveeighths',
  19291. 'seveneighths',
  19292. 'onethird',
  19293. 'twothirds',
  19294. 'zerosuperior',
  19295. 'foursuperior',
  19296. 'fivesuperior',
  19297. 'sixsuperior',
  19298. 'sevensuperior',
  19299. 'eightsuperior',
  19300. 'ninesuperior',
  19301. 'zeroinferior',
  19302. 'oneinferior',
  19303. 'twoinferior',
  19304. 'threeinferior',
  19305. 'fourinferior',
  19306. 'fiveinferior',
  19307. 'sixinferior',
  19308. 'seveninferior',
  19309. 'eightinferior',
  19310. 'nineinferior',
  19311. 'centinferior',
  19312. 'dollarinferior',
  19313. 'periodinferior',
  19314. 'commainferior',
  19315. 'Agravesmall',
  19316. 'Aacutesmall',
  19317. 'Acircumflexsmall',
  19318. 'Atildesmall',
  19319. 'Adieresissmall',
  19320. 'Aringsmall',
  19321. 'AEsmall',
  19322. 'Ccedillasmall',
  19323. 'Egravesmall',
  19324. 'Eacutesmall',
  19325. 'Ecircumflexsmall',
  19326. 'Edieresissmall',
  19327. 'Igravesmall',
  19328. 'Iacutesmall',
  19329. 'Icircumflexsmall',
  19330. 'Idieresissmall',
  19331. 'Ethsmall',
  19332. 'Ntildesmall',
  19333. 'Ogravesmall',
  19334. 'Oacutesmall',
  19335. 'Ocircumflexsmall',
  19336. 'Otildesmall',
  19337. 'Odieresissmall',
  19338. 'OEsmall',
  19339. 'Oslashsmall',
  19340. 'Ugravesmall',
  19341. 'Uacutesmall',
  19342. 'Ucircumflexsmall',
  19343. 'Udieresissmall',
  19344. 'Yacutesmall',
  19345. 'Thornsmall',
  19346. 'Ydieresissmall',
  19347. '001.000',
  19348. '001.001',
  19349. '001.002',
  19350. '001.003',
  19351. 'Black',
  19352. 'Bold',
  19353. 'Book',
  19354. 'Light',
  19355. 'Medium',
  19356. 'Regular',
  19357. 'Roman',
  19358. 'Semibold'
  19359. ];
  19360. var CFFParser = function CFFParserClosure() {
  19361. var CharstringValidationData = [
  19362. null,
  19363. {
  19364. id: 'hstem',
  19365. min: 2,
  19366. stackClearing: true,
  19367. stem: true
  19368. },
  19369. null,
  19370. {
  19371. id: 'vstem',
  19372. min: 2,
  19373. stackClearing: true,
  19374. stem: true
  19375. },
  19376. {
  19377. id: 'vmoveto',
  19378. min: 1,
  19379. stackClearing: true
  19380. },
  19381. {
  19382. id: 'rlineto',
  19383. min: 2,
  19384. resetStack: true
  19385. },
  19386. {
  19387. id: 'hlineto',
  19388. min: 1,
  19389. resetStack: true
  19390. },
  19391. {
  19392. id: 'vlineto',
  19393. min: 1,
  19394. resetStack: true
  19395. },
  19396. {
  19397. id: 'rrcurveto',
  19398. min: 6,
  19399. resetStack: true
  19400. },
  19401. null,
  19402. {
  19403. id: 'callsubr',
  19404. min: 1,
  19405. undefStack: true
  19406. },
  19407. {
  19408. id: 'return',
  19409. min: 0,
  19410. undefStack: true
  19411. },
  19412. null,
  19413. null,
  19414. {
  19415. id: 'endchar',
  19416. min: 0,
  19417. stackClearing: true
  19418. },
  19419. null,
  19420. null,
  19421. null,
  19422. {
  19423. id: 'hstemhm',
  19424. min: 2,
  19425. stackClearing: true,
  19426. stem: true
  19427. },
  19428. {
  19429. id: 'hintmask',
  19430. min: 0,
  19431. stackClearing: true
  19432. },
  19433. {
  19434. id: 'cntrmask',
  19435. min: 0,
  19436. stackClearing: true
  19437. },
  19438. {
  19439. id: 'rmoveto',
  19440. min: 2,
  19441. stackClearing: true
  19442. },
  19443. {
  19444. id: 'hmoveto',
  19445. min: 1,
  19446. stackClearing: true
  19447. },
  19448. {
  19449. id: 'vstemhm',
  19450. min: 2,
  19451. stackClearing: true,
  19452. stem: true
  19453. },
  19454. {
  19455. id: 'rcurveline',
  19456. min: 8,
  19457. resetStack: true
  19458. },
  19459. {
  19460. id: 'rlinecurve',
  19461. min: 8,
  19462. resetStack: true
  19463. },
  19464. {
  19465. id: 'vvcurveto',
  19466. min: 4,
  19467. resetStack: true
  19468. },
  19469. {
  19470. id: 'hhcurveto',
  19471. min: 4,
  19472. resetStack: true
  19473. },
  19474. null,
  19475. {
  19476. id: 'callgsubr',
  19477. min: 1,
  19478. undefStack: true
  19479. },
  19480. {
  19481. id: 'vhcurveto',
  19482. min: 4,
  19483. resetStack: true
  19484. },
  19485. {
  19486. id: 'hvcurveto',
  19487. min: 4,
  19488. resetStack: true
  19489. }
  19490. ];
  19491. var CharstringValidationData12 = [
  19492. null,
  19493. null,
  19494. null,
  19495. {
  19496. id: 'and',
  19497. min: 2,
  19498. stackDelta: -1
  19499. },
  19500. {
  19501. id: 'or',
  19502. min: 2,
  19503. stackDelta: -1
  19504. },
  19505. {
  19506. id: 'not',
  19507. min: 1,
  19508. stackDelta: 0
  19509. },
  19510. null,
  19511. null,
  19512. null,
  19513. {
  19514. id: 'abs',
  19515. min: 1,
  19516. stackDelta: 0
  19517. },
  19518. {
  19519. id: 'add',
  19520. min: 2,
  19521. stackDelta: -1,
  19522. stackFn: function stack_div(stack, index) {
  19523. stack[index - 2] = stack[index - 2] + stack[index - 1];
  19524. }
  19525. },
  19526. {
  19527. id: 'sub',
  19528. min: 2,
  19529. stackDelta: -1,
  19530. stackFn: function stack_div(stack, index) {
  19531. stack[index - 2] = stack[index - 2] - stack[index - 1];
  19532. }
  19533. },
  19534. {
  19535. id: 'div',
  19536. min: 2,
  19537. stackDelta: -1,
  19538. stackFn: function stack_div(stack, index) {
  19539. stack[index - 2] = stack[index - 2] / stack[index - 1];
  19540. }
  19541. },
  19542. null,
  19543. {
  19544. id: 'neg',
  19545. min: 1,
  19546. stackDelta: 0,
  19547. stackFn: function stack_div(stack, index) {
  19548. stack[index - 1] = -stack[index - 1];
  19549. }
  19550. },
  19551. {
  19552. id: 'eq',
  19553. min: 2,
  19554. stackDelta: -1
  19555. },
  19556. null,
  19557. null,
  19558. {
  19559. id: 'drop',
  19560. min: 1,
  19561. stackDelta: -1
  19562. },
  19563. null,
  19564. {
  19565. id: 'put',
  19566. min: 2,
  19567. stackDelta: -2
  19568. },
  19569. {
  19570. id: 'get',
  19571. min: 1,
  19572. stackDelta: 0
  19573. },
  19574. {
  19575. id: 'ifelse',
  19576. min: 4,
  19577. stackDelta: -3
  19578. },
  19579. {
  19580. id: 'random',
  19581. min: 0,
  19582. stackDelta: 1
  19583. },
  19584. {
  19585. id: 'mul',
  19586. min: 2,
  19587. stackDelta: -1,
  19588. stackFn: function stack_div(stack, index) {
  19589. stack[index - 2] = stack[index - 2] * stack[index - 1];
  19590. }
  19591. },
  19592. null,
  19593. {
  19594. id: 'sqrt',
  19595. min: 1,
  19596. stackDelta: 0
  19597. },
  19598. {
  19599. id: 'dup',
  19600. min: 1,
  19601. stackDelta: 1
  19602. },
  19603. {
  19604. id: 'exch',
  19605. min: 2,
  19606. stackDelta: 0
  19607. },
  19608. {
  19609. id: 'index',
  19610. min: 2,
  19611. stackDelta: 0
  19612. },
  19613. {
  19614. id: 'roll',
  19615. min: 3,
  19616. stackDelta: -2
  19617. },
  19618. null,
  19619. null,
  19620. null,
  19621. {
  19622. id: 'hflex',
  19623. min: 7,
  19624. resetStack: true
  19625. },
  19626. {
  19627. id: 'flex',
  19628. min: 13,
  19629. resetStack: true
  19630. },
  19631. {
  19632. id: 'hflex1',
  19633. min: 9,
  19634. resetStack: true
  19635. },
  19636. {
  19637. id: 'flex1',
  19638. min: 11,
  19639. resetStack: true
  19640. }
  19641. ];
  19642. function CFFParser(file, properties, seacAnalysisEnabled) {
  19643. this.bytes = file.getBytes();
  19644. this.properties = properties;
  19645. this.seacAnalysisEnabled = !!seacAnalysisEnabled;
  19646. }
  19647. CFFParser.prototype = {
  19648. parse: function CFFParser_parse() {
  19649. var properties = this.properties;
  19650. var cff = new CFF();
  19651. this.cff = cff;
  19652. var header = this.parseHeader();
  19653. var nameIndex = this.parseIndex(header.endPos);
  19654. var topDictIndex = this.parseIndex(nameIndex.endPos);
  19655. var stringIndex = this.parseIndex(topDictIndex.endPos);
  19656. var globalSubrIndex = this.parseIndex(stringIndex.endPos);
  19657. var topDictParsed = this.parseDict(topDictIndex.obj.get(0));
  19658. var topDict = this.createDict(CFFTopDict, topDictParsed, cff.strings);
  19659. cff.header = header.obj;
  19660. cff.names = this.parseNameIndex(nameIndex.obj);
  19661. cff.strings = this.parseStringIndex(stringIndex.obj);
  19662. cff.topDict = topDict;
  19663. cff.globalSubrIndex = globalSubrIndex.obj;
  19664. this.parsePrivateDict(cff.topDict);
  19665. cff.isCIDFont = topDict.hasName('ROS');
  19666. var charStringOffset = topDict.getByName('CharStrings');
  19667. var charStringIndex = this.parseIndex(charStringOffset).obj;
  19668. var fontMatrix = topDict.getByName('FontMatrix');
  19669. if (fontMatrix) {
  19670. properties.fontMatrix = fontMatrix;
  19671. }
  19672. var fontBBox = topDict.getByName('FontBBox');
  19673. if (fontBBox) {
  19674. properties.ascent = Math.max(fontBBox[3], fontBBox[1]);
  19675. properties.descent = Math.min(fontBBox[1], fontBBox[3]);
  19676. properties.ascentScaled = true;
  19677. }
  19678. var charset, encoding;
  19679. if (cff.isCIDFont) {
  19680. var fdArrayIndex = this.parseIndex(topDict.getByName('FDArray')).obj;
  19681. for (var i = 0, ii = fdArrayIndex.count; i < ii; ++i) {
  19682. var dictRaw = fdArrayIndex.get(i);
  19683. var fontDict = this.createDict(CFFTopDict, this.parseDict(dictRaw), cff.strings);
  19684. this.parsePrivateDict(fontDict);
  19685. cff.fdArray.push(fontDict);
  19686. }
  19687. encoding = null;
  19688. charset = this.parseCharsets(topDict.getByName('charset'), charStringIndex.count, cff.strings, true);
  19689. cff.fdSelect = this.parseFDSelect(topDict.getByName('FDSelect'), charStringIndex.count);
  19690. } else {
  19691. charset = this.parseCharsets(topDict.getByName('charset'), charStringIndex.count, cff.strings, false);
  19692. encoding = this.parseEncoding(topDict.getByName('Encoding'), properties, cff.strings, charset.charset);
  19693. }
  19694. cff.charset = charset;
  19695. cff.encoding = encoding;
  19696. var charStringsAndSeacs = this.parseCharStrings(charStringIndex, topDict.privateDict.subrsIndex, globalSubrIndex.obj, cff.fdSelect, cff.fdArray);
  19697. cff.charStrings = charStringsAndSeacs.charStrings;
  19698. cff.seacs = charStringsAndSeacs.seacs;
  19699. cff.widths = charStringsAndSeacs.widths;
  19700. return cff;
  19701. },
  19702. parseHeader: function CFFParser_parseHeader() {
  19703. var bytes = this.bytes;
  19704. var bytesLength = bytes.length;
  19705. var offset = 0;
  19706. while (offset < bytesLength && bytes[offset] !== 1) {
  19707. ++offset;
  19708. }
  19709. if (offset >= bytesLength) {
  19710. error('Invalid CFF header');
  19711. } else if (offset !== 0) {
  19712. info('cff data is shifted');
  19713. bytes = bytes.subarray(offset);
  19714. this.bytes = bytes;
  19715. }
  19716. var major = bytes[0];
  19717. var minor = bytes[1];
  19718. var hdrSize = bytes[2];
  19719. var offSize = bytes[3];
  19720. var header = new CFFHeader(major, minor, hdrSize, offSize);
  19721. return {
  19722. obj: header,
  19723. endPos: hdrSize
  19724. };
  19725. },
  19726. parseDict: function CFFParser_parseDict(dict) {
  19727. var pos = 0;
  19728. function parseOperand() {
  19729. var value = dict[pos++];
  19730. if (value === 30) {
  19731. return parseFloatOperand();
  19732. } else if (value === 28) {
  19733. value = dict[pos++];
  19734. value = (value << 24 | dict[pos++] << 16) >> 16;
  19735. return value;
  19736. } else if (value === 29) {
  19737. value = dict[pos++];
  19738. value = value << 8 | dict[pos++];
  19739. value = value << 8 | dict[pos++];
  19740. value = value << 8 | dict[pos++];
  19741. return value;
  19742. } else if (value >= 32 && value <= 246) {
  19743. return value - 139;
  19744. } else if (value >= 247 && value <= 250) {
  19745. return (value - 247) * 256 + dict[pos++] + 108;
  19746. } else if (value >= 251 && value <= 254) {
  19747. return -((value - 251) * 256) - dict[pos++] - 108;
  19748. }
  19749. warn('CFFParser_parseDict: "' + value + '" is a reserved command.');
  19750. return NaN;
  19751. }
  19752. function parseFloatOperand() {
  19753. var str = '';
  19754. var eof = 15;
  19755. var lookup = [
  19756. '0',
  19757. '1',
  19758. '2',
  19759. '3',
  19760. '4',
  19761. '5',
  19762. '6',
  19763. '7',
  19764. '8',
  19765. '9',
  19766. '.',
  19767. 'E',
  19768. 'E-',
  19769. null,
  19770. '-'
  19771. ];
  19772. var length = dict.length;
  19773. while (pos < length) {
  19774. var b = dict[pos++];
  19775. var b1 = b >> 4;
  19776. var b2 = b & 15;
  19777. if (b1 === eof) {
  19778. break;
  19779. }
  19780. str += lookup[b1];
  19781. if (b2 === eof) {
  19782. break;
  19783. }
  19784. str += lookup[b2];
  19785. }
  19786. return parseFloat(str);
  19787. }
  19788. var operands = [];
  19789. var entries = [];
  19790. pos = 0;
  19791. var end = dict.length;
  19792. while (pos < end) {
  19793. var b = dict[pos];
  19794. if (b <= 21) {
  19795. if (b === 12) {
  19796. b = b << 8 | dict[++pos];
  19797. }
  19798. entries.push([
  19799. b,
  19800. operands
  19801. ]);
  19802. operands = [];
  19803. ++pos;
  19804. } else {
  19805. operands.push(parseOperand());
  19806. }
  19807. }
  19808. return entries;
  19809. },
  19810. parseIndex: function CFFParser_parseIndex(pos) {
  19811. var cffIndex = new CFFIndex();
  19812. var bytes = this.bytes;
  19813. var count = bytes[pos++] << 8 | bytes[pos++];
  19814. var offsets = [];
  19815. var end = pos;
  19816. var i, ii;
  19817. if (count !== 0) {
  19818. var offsetSize = bytes[pos++];
  19819. var startPos = pos + (count + 1) * offsetSize - 1;
  19820. for (i = 0, ii = count + 1; i < ii; ++i) {
  19821. var offset = 0;
  19822. for (var j = 0; j < offsetSize; ++j) {
  19823. offset <<= 8;
  19824. offset += bytes[pos++];
  19825. }
  19826. offsets.push(startPos + offset);
  19827. }
  19828. end = offsets[count];
  19829. }
  19830. for (i = 0, ii = offsets.length - 1; i < ii; ++i) {
  19831. var offsetStart = offsets[i];
  19832. var offsetEnd = offsets[i + 1];
  19833. cffIndex.add(bytes.subarray(offsetStart, offsetEnd));
  19834. }
  19835. return {
  19836. obj: cffIndex,
  19837. endPos: end
  19838. };
  19839. },
  19840. parseNameIndex: function CFFParser_parseNameIndex(index) {
  19841. var names = [];
  19842. for (var i = 0, ii = index.count; i < ii; ++i) {
  19843. var name = index.get(i);
  19844. var length = Math.min(name.length, 127);
  19845. var data = [];
  19846. for (var j = 0; j < length; ++j) {
  19847. var c = name[j];
  19848. if (j === 0 && c === 0) {
  19849. data[j] = c;
  19850. continue;
  19851. }
  19852. 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) {
  19853. data[j] = 95;
  19854. continue;
  19855. }
  19856. data[j] = c;
  19857. }
  19858. names.push(bytesToString(data));
  19859. }
  19860. return names;
  19861. },
  19862. parseStringIndex: function CFFParser_parseStringIndex(index) {
  19863. var strings = new CFFStrings();
  19864. for (var i = 0, ii = index.count; i < ii; ++i) {
  19865. var data = index.get(i);
  19866. strings.add(bytesToString(data));
  19867. }
  19868. return strings;
  19869. },
  19870. createDict: function CFFParser_createDict(Type, dict, strings) {
  19871. var cffDict = new Type(strings);
  19872. for (var i = 0, ii = dict.length; i < ii; ++i) {
  19873. var pair = dict[i];
  19874. var key = pair[0];
  19875. var value = pair[1];
  19876. cffDict.setByKey(key, value);
  19877. }
  19878. return cffDict;
  19879. },
  19880. parseCharString: function CFFParser_parseCharString(state, data, localSubrIndex, globalSubrIndex) {
  19881. if (!data || state.callDepth > MAX_SUBR_NESTING) {
  19882. return false;
  19883. }
  19884. var stackSize = state.stackSize;
  19885. var stack = state.stack;
  19886. var length = data.length;
  19887. for (var j = 0; j < length;) {
  19888. var value = data[j++];
  19889. var validationCommand = null;
  19890. if (value === 12) {
  19891. var q = data[j++];
  19892. if (q === 0) {
  19893. data[j - 2] = 139;
  19894. data[j - 1] = 22;
  19895. stackSize = 0;
  19896. } else {
  19897. validationCommand = CharstringValidationData12[q];
  19898. }
  19899. } else if (value === 28) {
  19900. stack[stackSize] = (data[j] << 24 | data[j + 1] << 16) >> 16;
  19901. j += 2;
  19902. stackSize++;
  19903. } else if (value === 14) {
  19904. if (stackSize >= 4) {
  19905. stackSize -= 4;
  19906. if (this.seacAnalysisEnabled) {
  19907. state.seac = stack.slice(stackSize, stackSize + 4);
  19908. return false;
  19909. }
  19910. }
  19911. validationCommand = CharstringValidationData[value];
  19912. } else if (value >= 32 && value <= 246) {
  19913. stack[stackSize] = value - 139;
  19914. stackSize++;
  19915. } else if (value >= 247 && value <= 254) {
  19916. stack[stackSize] = value < 251 ? (value - 247 << 8) + data[j] + 108 : -(value - 251 << 8) - data[j] - 108;
  19917. j++;
  19918. stackSize++;
  19919. } else if (value === 255) {
  19920. stack[stackSize] = (data[j] << 24 | data[j + 1] << 16 | data[j + 2] << 8 | data[j + 3]) / 65536;
  19921. j += 4;
  19922. stackSize++;
  19923. } else if (value === 19 || value === 20) {
  19924. state.hints += stackSize >> 1;
  19925. j += state.hints + 7 >> 3;
  19926. stackSize %= 2;
  19927. validationCommand = CharstringValidationData[value];
  19928. } else if (value === 10 || value === 29) {
  19929. var subrsIndex;
  19930. if (value === 10) {
  19931. subrsIndex = localSubrIndex;
  19932. } else {
  19933. subrsIndex = globalSubrIndex;
  19934. }
  19935. if (!subrsIndex) {
  19936. validationCommand = CharstringValidationData[value];
  19937. warn('Missing subrsIndex for ' + validationCommand.id);
  19938. return false;
  19939. }
  19940. var bias = 32768;
  19941. if (subrsIndex.count < 1240) {
  19942. bias = 107;
  19943. } else if (subrsIndex.count < 33900) {
  19944. bias = 1131;
  19945. }
  19946. var subrNumber = stack[--stackSize] + bias;
  19947. if (subrNumber < 0 || subrNumber >= subrsIndex.count || isNaN(subrNumber)) {
  19948. validationCommand = CharstringValidationData[value];
  19949. warn('Out of bounds subrIndex for ' + validationCommand.id);
  19950. return false;
  19951. }
  19952. state.stackSize = stackSize;
  19953. state.callDepth++;
  19954. var valid = this.parseCharString(state, subrsIndex.get(subrNumber), localSubrIndex, globalSubrIndex);
  19955. if (!valid) {
  19956. return false;
  19957. }
  19958. state.callDepth--;
  19959. stackSize = state.stackSize;
  19960. continue;
  19961. } else if (value === 11) {
  19962. state.stackSize = stackSize;
  19963. return true;
  19964. } else {
  19965. validationCommand = CharstringValidationData[value];
  19966. }
  19967. if (validationCommand) {
  19968. if (validationCommand.stem) {
  19969. state.hints += stackSize >> 1;
  19970. }
  19971. if ('min' in validationCommand) {
  19972. if (!state.undefStack && stackSize < validationCommand.min) {
  19973. warn('Not enough parameters for ' + validationCommand.id + '; actual: ' + stackSize + ', expected: ' + validationCommand.min);
  19974. return false;
  19975. }
  19976. }
  19977. if (state.firstStackClearing && validationCommand.stackClearing) {
  19978. state.firstStackClearing = false;
  19979. stackSize -= validationCommand.min;
  19980. if (stackSize >= 2 && validationCommand.stem) {
  19981. stackSize %= 2;
  19982. } else if (stackSize > 1) {
  19983. warn('Found too many parameters for stack-clearing command');
  19984. }
  19985. if (stackSize > 0 && stack[stackSize - 1] >= 0) {
  19986. state.width = stack[stackSize - 1];
  19987. }
  19988. }
  19989. if ('stackDelta' in validationCommand) {
  19990. if ('stackFn' in validationCommand) {
  19991. validationCommand.stackFn(stack, stackSize);
  19992. }
  19993. stackSize += validationCommand.stackDelta;
  19994. } else if (validationCommand.stackClearing) {
  19995. stackSize = 0;
  19996. } else if (validationCommand.resetStack) {
  19997. stackSize = 0;
  19998. state.undefStack = false;
  19999. } else if (validationCommand.undefStack) {
  20000. stackSize = 0;
  20001. state.undefStack = true;
  20002. state.firstStackClearing = false;
  20003. }
  20004. }
  20005. }
  20006. state.stackSize = stackSize;
  20007. return true;
  20008. },
  20009. parseCharStrings: function CFFParser_parseCharStrings(charStrings, localSubrIndex, globalSubrIndex, fdSelect, fdArray) {
  20010. var seacs = [];
  20011. var widths = [];
  20012. var count = charStrings.count;
  20013. for (var i = 0; i < count; i++) {
  20014. var charstring = charStrings.get(i);
  20015. var state = {
  20016. callDepth: 0,
  20017. stackSize: 0,
  20018. stack: [],
  20019. undefStack: true,
  20020. hints: 0,
  20021. firstStackClearing: true,
  20022. seac: null,
  20023. width: null
  20024. };
  20025. var valid = true;
  20026. var localSubrToUse = null;
  20027. if (fdSelect && fdArray.length) {
  20028. var fdIndex = fdSelect.getFDIndex(i);
  20029. if (fdIndex === -1) {
  20030. warn('Glyph index is not in fd select.');
  20031. valid = false;
  20032. }
  20033. if (fdIndex >= fdArray.length) {
  20034. warn('Invalid fd index for glyph index.');
  20035. valid = false;
  20036. }
  20037. if (valid) {
  20038. localSubrToUse = fdArray[fdIndex].privateDict.subrsIndex;
  20039. }
  20040. } else if (localSubrIndex) {
  20041. localSubrToUse = localSubrIndex;
  20042. }
  20043. if (valid) {
  20044. valid = this.parseCharString(state, charstring, localSubrToUse, globalSubrIndex);
  20045. }
  20046. if (state.width !== null) {
  20047. widths[i] = state.width;
  20048. }
  20049. if (state.seac !== null) {
  20050. seacs[i] = state.seac;
  20051. }
  20052. if (!valid) {
  20053. charStrings.set(i, new Uint8Array([14]));
  20054. }
  20055. }
  20056. return {
  20057. charStrings: charStrings,
  20058. seacs: seacs,
  20059. widths: widths
  20060. };
  20061. },
  20062. emptyPrivateDictionary: function CFFParser_emptyPrivateDictionary(parentDict) {
  20063. var privateDict = this.createDict(CFFPrivateDict, [], parentDict.strings);
  20064. parentDict.setByKey(18, [
  20065. 0,
  20066. 0
  20067. ]);
  20068. parentDict.privateDict = privateDict;
  20069. },
  20070. parsePrivateDict: function CFFParser_parsePrivateDict(parentDict) {
  20071. if (!parentDict.hasName('Private')) {
  20072. this.emptyPrivateDictionary(parentDict);
  20073. return;
  20074. }
  20075. var privateOffset = parentDict.getByName('Private');
  20076. if (!isArray(privateOffset) || privateOffset.length !== 2) {
  20077. parentDict.removeByName('Private');
  20078. return;
  20079. }
  20080. var size = privateOffset[0];
  20081. var offset = privateOffset[1];
  20082. if (size === 0 || offset >= this.bytes.length) {
  20083. this.emptyPrivateDictionary(parentDict);
  20084. return;
  20085. }
  20086. var privateDictEnd = offset + size;
  20087. var dictData = this.bytes.subarray(offset, privateDictEnd);
  20088. var dict = this.parseDict(dictData);
  20089. var privateDict = this.createDict(CFFPrivateDict, dict, parentDict.strings);
  20090. parentDict.privateDict = privateDict;
  20091. if (!privateDict.getByName('Subrs')) {
  20092. return;
  20093. }
  20094. var subrsOffset = privateDict.getByName('Subrs');
  20095. var relativeOffset = offset + subrsOffset;
  20096. if (subrsOffset === 0 || relativeOffset >= this.bytes.length) {
  20097. this.emptyPrivateDictionary(parentDict);
  20098. return;
  20099. }
  20100. var subrsIndex = this.parseIndex(relativeOffset);
  20101. privateDict.subrsIndex = subrsIndex.obj;
  20102. },
  20103. parseCharsets: function CFFParser_parseCharsets(pos, length, strings, cid) {
  20104. if (pos === 0) {
  20105. return new CFFCharset(true, CFFCharsetPredefinedTypes.ISO_ADOBE, ISOAdobeCharset);
  20106. } else if (pos === 1) {
  20107. return new CFFCharset(true, CFFCharsetPredefinedTypes.EXPERT, ExpertCharset);
  20108. } else if (pos === 2) {
  20109. return new CFFCharset(true, CFFCharsetPredefinedTypes.EXPERT_SUBSET, ExpertSubsetCharset);
  20110. }
  20111. var bytes = this.bytes;
  20112. var start = pos;
  20113. var format = bytes[pos++];
  20114. var charset = ['.notdef'];
  20115. var id, count, i;
  20116. length -= 1;
  20117. switch (format) {
  20118. case 0:
  20119. for (i = 0; i < length; i++) {
  20120. id = bytes[pos++] << 8 | bytes[pos++];
  20121. charset.push(cid ? id : strings.get(id));
  20122. }
  20123. break;
  20124. case 1:
  20125. while (charset.length <= length) {
  20126. id = bytes[pos++] << 8 | bytes[pos++];
  20127. count = bytes[pos++];
  20128. for (i = 0; i <= count; i++) {
  20129. charset.push(cid ? id++ : strings.get(id++));
  20130. }
  20131. }
  20132. break;
  20133. case 2:
  20134. while (charset.length <= length) {
  20135. id = bytes[pos++] << 8 | bytes[pos++];
  20136. count = bytes[pos++] << 8 | bytes[pos++];
  20137. for (i = 0; i <= count; i++) {
  20138. charset.push(cid ? id++ : strings.get(id++));
  20139. }
  20140. }
  20141. break;
  20142. default:
  20143. error('Unknown charset format');
  20144. }
  20145. var end = pos;
  20146. var raw = bytes.subarray(start, end);
  20147. return new CFFCharset(false, format, charset, raw);
  20148. },
  20149. parseEncoding: function CFFParser_parseEncoding(pos, properties, strings, charset) {
  20150. var encoding = Object.create(null);
  20151. var bytes = this.bytes;
  20152. var predefined = false;
  20153. var format, i, ii;
  20154. var raw = null;
  20155. function readSupplement() {
  20156. var supplementsCount = bytes[pos++];
  20157. for (i = 0; i < supplementsCount; i++) {
  20158. var code = bytes[pos++];
  20159. var sid = (bytes[pos++] << 8) + (bytes[pos++] & 0xff);
  20160. encoding[code] = charset.indexOf(strings.get(sid));
  20161. }
  20162. }
  20163. if (pos === 0 || pos === 1) {
  20164. predefined = true;
  20165. format = pos;
  20166. var baseEncoding = pos ? ExpertEncoding : StandardEncoding;
  20167. for (i = 0, ii = charset.length; i < ii; i++) {
  20168. var index = baseEncoding.indexOf(charset[i]);
  20169. if (index !== -1) {
  20170. encoding[index] = i;
  20171. }
  20172. }
  20173. } else {
  20174. var dataStart = pos;
  20175. format = bytes[pos++];
  20176. switch (format & 0x7f) {
  20177. case 0:
  20178. var glyphsCount = bytes[pos++];
  20179. for (i = 1; i <= glyphsCount; i++) {
  20180. encoding[bytes[pos++]] = i;
  20181. }
  20182. break;
  20183. case 1:
  20184. var rangesCount = bytes[pos++];
  20185. var gid = 1;
  20186. for (i = 0; i < rangesCount; i++) {
  20187. var start = bytes[pos++];
  20188. var left = bytes[pos++];
  20189. for (var j = start; j <= start + left; j++) {
  20190. encoding[j] = gid++;
  20191. }
  20192. }
  20193. break;
  20194. default:
  20195. error('Unknown encoding format: ' + format + ' in CFF');
  20196. break;
  20197. }
  20198. var dataEnd = pos;
  20199. if (format & 0x80) {
  20200. bytes[dataStart] &= 0x7f;
  20201. readSupplement();
  20202. }
  20203. raw = bytes.subarray(dataStart, dataEnd);
  20204. }
  20205. format = format & 0x7f;
  20206. return new CFFEncoding(predefined, format, encoding, raw);
  20207. },
  20208. parseFDSelect: function CFFParser_parseFDSelect(pos, length) {
  20209. var start = pos;
  20210. var bytes = this.bytes;
  20211. var format = bytes[pos++];
  20212. var fdSelect = [], rawBytes;
  20213. var i, invalidFirstGID = false;
  20214. switch (format) {
  20215. case 0:
  20216. for (i = 0; i < length; ++i) {
  20217. var id = bytes[pos++];
  20218. fdSelect.push(id);
  20219. }
  20220. rawBytes = bytes.subarray(start, pos);
  20221. break;
  20222. case 3:
  20223. var rangesCount = bytes[pos++] << 8 | bytes[pos++];
  20224. for (i = 0; i < rangesCount; ++i) {
  20225. var first = bytes[pos++] << 8 | bytes[pos++];
  20226. if (i === 0 && first !== 0) {
  20227. warn('parseFDSelect: The first range must have a first GID of 0' + ' -- trying to recover.');
  20228. invalidFirstGID = true;
  20229. first = 0;
  20230. }
  20231. var fdIndex = bytes[pos++];
  20232. var next = bytes[pos] << 8 | bytes[pos + 1];
  20233. for (var j = first; j < next; ++j) {
  20234. fdSelect.push(fdIndex);
  20235. }
  20236. }
  20237. pos += 2;
  20238. rawBytes = bytes.subarray(start, pos);
  20239. if (invalidFirstGID) {
  20240. rawBytes[3] = rawBytes[4] = 0;
  20241. }
  20242. break;
  20243. default:
  20244. error('parseFDSelect: Unknown format "' + format + '".');
  20245. break;
  20246. }
  20247. assert(fdSelect.length === length, 'parseFDSelect: Invalid font data.');
  20248. return new CFFFDSelect(fdSelect, rawBytes);
  20249. }
  20250. };
  20251. return CFFParser;
  20252. }();
  20253. var CFF = function CFFClosure() {
  20254. function CFF() {
  20255. this.header = null;
  20256. this.names = [];
  20257. this.topDict = null;
  20258. this.strings = new CFFStrings();
  20259. this.globalSubrIndex = null;
  20260. this.encoding = null;
  20261. this.charset = null;
  20262. this.charStrings = null;
  20263. this.fdArray = [];
  20264. this.fdSelect = null;
  20265. this.isCIDFont = false;
  20266. }
  20267. return CFF;
  20268. }();
  20269. var CFFHeader = function CFFHeaderClosure() {
  20270. function CFFHeader(major, minor, hdrSize, offSize) {
  20271. this.major = major;
  20272. this.minor = minor;
  20273. this.hdrSize = hdrSize;
  20274. this.offSize = offSize;
  20275. }
  20276. return CFFHeader;
  20277. }();
  20278. var CFFStrings = function CFFStringsClosure() {
  20279. function CFFStrings() {
  20280. this.strings = [];
  20281. }
  20282. CFFStrings.prototype = {
  20283. get: function CFFStrings_get(index) {
  20284. if (index >= 0 && index <= 390) {
  20285. return CFFStandardStrings[index];
  20286. }
  20287. if (index - 391 <= this.strings.length) {
  20288. return this.strings[index - 391];
  20289. }
  20290. return CFFStandardStrings[0];
  20291. },
  20292. add: function CFFStrings_add(value) {
  20293. this.strings.push(value);
  20294. },
  20295. get count() {
  20296. return this.strings.length;
  20297. }
  20298. };
  20299. return CFFStrings;
  20300. }();
  20301. var CFFIndex = function CFFIndexClosure() {
  20302. function CFFIndex() {
  20303. this.objects = [];
  20304. this.length = 0;
  20305. }
  20306. CFFIndex.prototype = {
  20307. add: function CFFIndex_add(data) {
  20308. this.length += data.length;
  20309. this.objects.push(data);
  20310. },
  20311. set: function CFFIndex_set(index, data) {
  20312. this.length += data.length - this.objects[index].length;
  20313. this.objects[index] = data;
  20314. },
  20315. get: function CFFIndex_get(index) {
  20316. return this.objects[index];
  20317. },
  20318. get count() {
  20319. return this.objects.length;
  20320. }
  20321. };
  20322. return CFFIndex;
  20323. }();
  20324. var CFFDict = function CFFDictClosure() {
  20325. function CFFDict(tables, strings) {
  20326. this.keyToNameMap = tables.keyToNameMap;
  20327. this.nameToKeyMap = tables.nameToKeyMap;
  20328. this.defaults = tables.defaults;
  20329. this.types = tables.types;
  20330. this.opcodes = tables.opcodes;
  20331. this.order = tables.order;
  20332. this.strings = strings;
  20333. this.values = Object.create(null);
  20334. }
  20335. CFFDict.prototype = {
  20336. setByKey: function CFFDict_setByKey(key, value) {
  20337. if (!(key in this.keyToNameMap)) {
  20338. return false;
  20339. }
  20340. var valueLength = value.length;
  20341. if (valueLength === 0) {
  20342. return true;
  20343. }
  20344. for (var i = 0; i < valueLength; i++) {
  20345. if (isNaN(value[i])) {
  20346. warn('Invalid CFFDict value: "' + value + '" for key "' + key + '".');
  20347. return true;
  20348. }
  20349. }
  20350. var type = this.types[key];
  20351. if (type === 'num' || type === 'sid' || type === 'offset') {
  20352. value = value[0];
  20353. }
  20354. this.values[key] = value;
  20355. return true;
  20356. },
  20357. setByName: function CFFDict_setByName(name, value) {
  20358. if (!(name in this.nameToKeyMap)) {
  20359. error('Invalid dictionary name "' + name + '"');
  20360. }
  20361. this.values[this.nameToKeyMap[name]] = value;
  20362. },
  20363. hasName: function CFFDict_hasName(name) {
  20364. return this.nameToKeyMap[name] in this.values;
  20365. },
  20366. getByName: function CFFDict_getByName(name) {
  20367. if (!(name in this.nameToKeyMap)) {
  20368. error('Invalid dictionary name "' + name + '"');
  20369. }
  20370. var key = this.nameToKeyMap[name];
  20371. if (!(key in this.values)) {
  20372. return this.defaults[key];
  20373. }
  20374. return this.values[key];
  20375. },
  20376. removeByName: function CFFDict_removeByName(name) {
  20377. delete this.values[this.nameToKeyMap[name]];
  20378. }
  20379. };
  20380. CFFDict.createTables = function CFFDict_createTables(layout) {
  20381. var tables = {
  20382. keyToNameMap: {},
  20383. nameToKeyMap: {},
  20384. defaults: {},
  20385. types: {},
  20386. opcodes: {},
  20387. order: []
  20388. };
  20389. for (var i = 0, ii = layout.length; i < ii; ++i) {
  20390. var entry = layout[i];
  20391. var key = isArray(entry[0]) ? (entry[0][0] << 8) + entry[0][1] : entry[0];
  20392. tables.keyToNameMap[key] = entry[1];
  20393. tables.nameToKeyMap[entry[1]] = key;
  20394. tables.types[key] = entry[2];
  20395. tables.defaults[key] = entry[3];
  20396. tables.opcodes[key] = isArray(entry[0]) ? entry[0] : [entry[0]];
  20397. tables.order.push(key);
  20398. }
  20399. return tables;
  20400. };
  20401. return CFFDict;
  20402. }();
  20403. var CFFTopDict = function CFFTopDictClosure() {
  20404. var layout = [
  20405. [
  20406. [
  20407. 12,
  20408. 30
  20409. ],
  20410. 'ROS',
  20411. [
  20412. 'sid',
  20413. 'sid',
  20414. 'num'
  20415. ],
  20416. null
  20417. ],
  20418. [
  20419. [
  20420. 12,
  20421. 20
  20422. ],
  20423. 'SyntheticBase',
  20424. 'num',
  20425. null
  20426. ],
  20427. [
  20428. 0,
  20429. 'version',
  20430. 'sid',
  20431. null
  20432. ],
  20433. [
  20434. 1,
  20435. 'Notice',
  20436. 'sid',
  20437. null
  20438. ],
  20439. [
  20440. [
  20441. 12,
  20442. 0
  20443. ],
  20444. 'Copyright',
  20445. 'sid',
  20446. null
  20447. ],
  20448. [
  20449. 2,
  20450. 'FullName',
  20451. 'sid',
  20452. null
  20453. ],
  20454. [
  20455. 3,
  20456. 'FamilyName',
  20457. 'sid',
  20458. null
  20459. ],
  20460. [
  20461. 4,
  20462. 'Weight',
  20463. 'sid',
  20464. null
  20465. ],
  20466. [
  20467. [
  20468. 12,
  20469. 1
  20470. ],
  20471. 'isFixedPitch',
  20472. 'num',
  20473. 0
  20474. ],
  20475. [
  20476. [
  20477. 12,
  20478. 2
  20479. ],
  20480. 'ItalicAngle',
  20481. 'num',
  20482. 0
  20483. ],
  20484. [
  20485. [
  20486. 12,
  20487. 3
  20488. ],
  20489. 'UnderlinePosition',
  20490. 'num',
  20491. -100
  20492. ],
  20493. [
  20494. [
  20495. 12,
  20496. 4
  20497. ],
  20498. 'UnderlineThickness',
  20499. 'num',
  20500. 50
  20501. ],
  20502. [
  20503. [
  20504. 12,
  20505. 5
  20506. ],
  20507. 'PaintType',
  20508. 'num',
  20509. 0
  20510. ],
  20511. [
  20512. [
  20513. 12,
  20514. 6
  20515. ],
  20516. 'CharstringType',
  20517. 'num',
  20518. 2
  20519. ],
  20520. [
  20521. [
  20522. 12,
  20523. 7
  20524. ],
  20525. 'FontMatrix',
  20526. [
  20527. 'num',
  20528. 'num',
  20529. 'num',
  20530. 'num',
  20531. 'num',
  20532. 'num'
  20533. ],
  20534. [
  20535. 0.001,
  20536. 0,
  20537. 0,
  20538. 0.001,
  20539. 0,
  20540. 0
  20541. ]
  20542. ],
  20543. [
  20544. 13,
  20545. 'UniqueID',
  20546. 'num',
  20547. null
  20548. ],
  20549. [
  20550. 5,
  20551. 'FontBBox',
  20552. [
  20553. 'num',
  20554. 'num',
  20555. 'num',
  20556. 'num'
  20557. ],
  20558. [
  20559. 0,
  20560. 0,
  20561. 0,
  20562. 0
  20563. ]
  20564. ],
  20565. [
  20566. [
  20567. 12,
  20568. 8
  20569. ],
  20570. 'StrokeWidth',
  20571. 'num',
  20572. 0
  20573. ],
  20574. [
  20575. 14,
  20576. 'XUID',
  20577. 'array',
  20578. null
  20579. ],
  20580. [
  20581. 15,
  20582. 'charset',
  20583. 'offset',
  20584. 0
  20585. ],
  20586. [
  20587. 16,
  20588. 'Encoding',
  20589. 'offset',
  20590. 0
  20591. ],
  20592. [
  20593. 17,
  20594. 'CharStrings',
  20595. 'offset',
  20596. 0
  20597. ],
  20598. [
  20599. 18,
  20600. 'Private',
  20601. [
  20602. 'offset',
  20603. 'offset'
  20604. ],
  20605. null
  20606. ],
  20607. [
  20608. [
  20609. 12,
  20610. 21
  20611. ],
  20612. 'PostScript',
  20613. 'sid',
  20614. null
  20615. ],
  20616. [
  20617. [
  20618. 12,
  20619. 22
  20620. ],
  20621. 'BaseFontName',
  20622. 'sid',
  20623. null
  20624. ],
  20625. [
  20626. [
  20627. 12,
  20628. 23
  20629. ],
  20630. 'BaseFontBlend',
  20631. 'delta',
  20632. null
  20633. ],
  20634. [
  20635. [
  20636. 12,
  20637. 31
  20638. ],
  20639. 'CIDFontVersion',
  20640. 'num',
  20641. 0
  20642. ],
  20643. [
  20644. [
  20645. 12,
  20646. 32
  20647. ],
  20648. 'CIDFontRevision',
  20649. 'num',
  20650. 0
  20651. ],
  20652. [
  20653. [
  20654. 12,
  20655. 33
  20656. ],
  20657. 'CIDFontType',
  20658. 'num',
  20659. 0
  20660. ],
  20661. [
  20662. [
  20663. 12,
  20664. 34
  20665. ],
  20666. 'CIDCount',
  20667. 'num',
  20668. 8720
  20669. ],
  20670. [
  20671. [
  20672. 12,
  20673. 35
  20674. ],
  20675. 'UIDBase',
  20676. 'num',
  20677. null
  20678. ],
  20679. [
  20680. [
  20681. 12,
  20682. 37
  20683. ],
  20684. 'FDSelect',
  20685. 'offset',
  20686. null
  20687. ],
  20688. [
  20689. [
  20690. 12,
  20691. 36
  20692. ],
  20693. 'FDArray',
  20694. 'offset',
  20695. null
  20696. ],
  20697. [
  20698. [
  20699. 12,
  20700. 38
  20701. ],
  20702. 'FontName',
  20703. 'sid',
  20704. null
  20705. ]
  20706. ];
  20707. var tables = null;
  20708. function CFFTopDict(strings) {
  20709. if (tables === null) {
  20710. tables = CFFDict.createTables(layout);
  20711. }
  20712. CFFDict.call(this, tables, strings);
  20713. this.privateDict = null;
  20714. }
  20715. CFFTopDict.prototype = Object.create(CFFDict.prototype);
  20716. return CFFTopDict;
  20717. }();
  20718. var CFFPrivateDict = function CFFPrivateDictClosure() {
  20719. var layout = [
  20720. [
  20721. 6,
  20722. 'BlueValues',
  20723. 'delta',
  20724. null
  20725. ],
  20726. [
  20727. 7,
  20728. 'OtherBlues',
  20729. 'delta',
  20730. null
  20731. ],
  20732. [
  20733. 8,
  20734. 'FamilyBlues',
  20735. 'delta',
  20736. null
  20737. ],
  20738. [
  20739. 9,
  20740. 'FamilyOtherBlues',
  20741. 'delta',
  20742. null
  20743. ],
  20744. [
  20745. [
  20746. 12,
  20747. 9
  20748. ],
  20749. 'BlueScale',
  20750. 'num',
  20751. 0.039625
  20752. ],
  20753. [
  20754. [
  20755. 12,
  20756. 10
  20757. ],
  20758. 'BlueShift',
  20759. 'num',
  20760. 7
  20761. ],
  20762. [
  20763. [
  20764. 12,
  20765. 11
  20766. ],
  20767. 'BlueFuzz',
  20768. 'num',
  20769. 1
  20770. ],
  20771. [
  20772. 10,
  20773. 'StdHW',
  20774. 'num',
  20775. null
  20776. ],
  20777. [
  20778. 11,
  20779. 'StdVW',
  20780. 'num',
  20781. null
  20782. ],
  20783. [
  20784. [
  20785. 12,
  20786. 12
  20787. ],
  20788. 'StemSnapH',
  20789. 'delta',
  20790. null
  20791. ],
  20792. [
  20793. [
  20794. 12,
  20795. 13
  20796. ],
  20797. 'StemSnapV',
  20798. 'delta',
  20799. null
  20800. ],
  20801. [
  20802. [
  20803. 12,
  20804. 14
  20805. ],
  20806. 'ForceBold',
  20807. 'num',
  20808. 0
  20809. ],
  20810. [
  20811. [
  20812. 12,
  20813. 17
  20814. ],
  20815. 'LanguageGroup',
  20816. 'num',
  20817. 0
  20818. ],
  20819. [
  20820. [
  20821. 12,
  20822. 18
  20823. ],
  20824. 'ExpansionFactor',
  20825. 'num',
  20826. 0.06
  20827. ],
  20828. [
  20829. [
  20830. 12,
  20831. 19
  20832. ],
  20833. 'initialRandomSeed',
  20834. 'num',
  20835. 0
  20836. ],
  20837. [
  20838. 20,
  20839. 'defaultWidthX',
  20840. 'num',
  20841. 0
  20842. ],
  20843. [
  20844. 21,
  20845. 'nominalWidthX',
  20846. 'num',
  20847. 0
  20848. ],
  20849. [
  20850. 19,
  20851. 'Subrs',
  20852. 'offset',
  20853. null
  20854. ]
  20855. ];
  20856. var tables = null;
  20857. function CFFPrivateDict(strings) {
  20858. if (tables === null) {
  20859. tables = CFFDict.createTables(layout);
  20860. }
  20861. CFFDict.call(this, tables, strings);
  20862. this.subrsIndex = null;
  20863. }
  20864. CFFPrivateDict.prototype = Object.create(CFFDict.prototype);
  20865. return CFFPrivateDict;
  20866. }();
  20867. var CFFCharsetPredefinedTypes = {
  20868. ISO_ADOBE: 0,
  20869. EXPERT: 1,
  20870. EXPERT_SUBSET: 2
  20871. };
  20872. var CFFCharset = function CFFCharsetClosure() {
  20873. function CFFCharset(predefined, format, charset, raw) {
  20874. this.predefined = predefined;
  20875. this.format = format;
  20876. this.charset = charset;
  20877. this.raw = raw;
  20878. }
  20879. return CFFCharset;
  20880. }();
  20881. var CFFEncoding = function CFFEncodingClosure() {
  20882. function CFFEncoding(predefined, format, encoding, raw) {
  20883. this.predefined = predefined;
  20884. this.format = format;
  20885. this.encoding = encoding;
  20886. this.raw = raw;
  20887. }
  20888. return CFFEncoding;
  20889. }();
  20890. var CFFFDSelect = function CFFFDSelectClosure() {
  20891. function CFFFDSelect(fdSelect, raw) {
  20892. this.fdSelect = fdSelect;
  20893. this.raw = raw;
  20894. }
  20895. CFFFDSelect.prototype = {
  20896. getFDIndex: function CFFFDSelect_get(glyphIndex) {
  20897. if (glyphIndex < 0 || glyphIndex >= this.fdSelect.length) {
  20898. return -1;
  20899. }
  20900. return this.fdSelect[glyphIndex];
  20901. }
  20902. };
  20903. return CFFFDSelect;
  20904. }();
  20905. var CFFOffsetTracker = function CFFOffsetTrackerClosure() {
  20906. function CFFOffsetTracker() {
  20907. this.offsets = Object.create(null);
  20908. }
  20909. CFFOffsetTracker.prototype = {
  20910. isTracking: function CFFOffsetTracker_isTracking(key) {
  20911. return key in this.offsets;
  20912. },
  20913. track: function CFFOffsetTracker_track(key, location) {
  20914. if (key in this.offsets) {
  20915. error('Already tracking location of ' + key);
  20916. }
  20917. this.offsets[key] = location;
  20918. },
  20919. offset: function CFFOffsetTracker_offset(value) {
  20920. for (var key in this.offsets) {
  20921. this.offsets[key] += value;
  20922. }
  20923. },
  20924. setEntryLocation: function CFFOffsetTracker_setEntryLocation(key, values, output) {
  20925. if (!(key in this.offsets)) {
  20926. error('Not tracking location of ' + key);
  20927. }
  20928. var data = output.data;
  20929. var dataOffset = this.offsets[key];
  20930. var size = 5;
  20931. for (var i = 0, ii = values.length; i < ii; ++i) {
  20932. var offset0 = i * size + dataOffset;
  20933. var offset1 = offset0 + 1;
  20934. var offset2 = offset0 + 2;
  20935. var offset3 = offset0 + 3;
  20936. var offset4 = offset0 + 4;
  20937. if (data[offset0] !== 0x1d || data[offset1] !== 0 || data[offset2] !== 0 || data[offset3] !== 0 || data[offset4] !== 0) {
  20938. error('writing to an offset that is not empty');
  20939. }
  20940. var value = values[i];
  20941. data[offset0] = 0x1d;
  20942. data[offset1] = value >> 24 & 0xFF;
  20943. data[offset2] = value >> 16 & 0xFF;
  20944. data[offset3] = value >> 8 & 0xFF;
  20945. data[offset4] = value & 0xFF;
  20946. }
  20947. }
  20948. };
  20949. return CFFOffsetTracker;
  20950. }();
  20951. var CFFCompiler = function CFFCompilerClosure() {
  20952. function CFFCompiler(cff) {
  20953. this.cff = cff;
  20954. }
  20955. CFFCompiler.prototype = {
  20956. compile: function CFFCompiler_compile() {
  20957. var cff = this.cff;
  20958. var output = {
  20959. data: [],
  20960. length: 0,
  20961. add: function CFFCompiler_add(data) {
  20962. this.data = this.data.concat(data);
  20963. this.length = this.data.length;
  20964. }
  20965. };
  20966. var header = this.compileHeader(cff.header);
  20967. output.add(header);
  20968. var nameIndex = this.compileNameIndex(cff.names);
  20969. output.add(nameIndex);
  20970. if (cff.isCIDFont) {
  20971. if (cff.topDict.hasName('FontMatrix')) {
  20972. var base = cff.topDict.getByName('FontMatrix');
  20973. cff.topDict.removeByName('FontMatrix');
  20974. for (var i = 0, ii = cff.fdArray.length; i < ii; i++) {
  20975. var subDict = cff.fdArray[i];
  20976. var matrix = base.slice(0);
  20977. if (subDict.hasName('FontMatrix')) {
  20978. matrix = Util.transform(matrix, subDict.getByName('FontMatrix'));
  20979. }
  20980. subDict.setByName('FontMatrix', matrix);
  20981. }
  20982. }
  20983. }
  20984. var compiled = this.compileTopDicts([cff.topDict], output.length, cff.isCIDFont);
  20985. output.add(compiled.output);
  20986. var topDictTracker = compiled.trackers[0];
  20987. var stringIndex = this.compileStringIndex(cff.strings.strings);
  20988. output.add(stringIndex);
  20989. var globalSubrIndex = this.compileIndex(cff.globalSubrIndex);
  20990. output.add(globalSubrIndex);
  20991. if (cff.encoding && cff.topDict.hasName('Encoding')) {
  20992. if (cff.encoding.predefined) {
  20993. topDictTracker.setEntryLocation('Encoding', [cff.encoding.format], output);
  20994. } else {
  20995. var encoding = this.compileEncoding(cff.encoding);
  20996. topDictTracker.setEntryLocation('Encoding', [output.length], output);
  20997. output.add(encoding);
  20998. }
  20999. }
  21000. if (cff.charset && cff.topDict.hasName('charset')) {
  21001. if (cff.charset.predefined) {
  21002. topDictTracker.setEntryLocation('charset', [cff.charset.format], output);
  21003. } else {
  21004. var charset = this.compileCharset(cff.charset);
  21005. topDictTracker.setEntryLocation('charset', [output.length], output);
  21006. output.add(charset);
  21007. }
  21008. }
  21009. var charStrings = this.compileCharStrings(cff.charStrings);
  21010. topDictTracker.setEntryLocation('CharStrings', [output.length], output);
  21011. output.add(charStrings);
  21012. if (cff.isCIDFont) {
  21013. topDictTracker.setEntryLocation('FDSelect', [output.length], output);
  21014. var fdSelect = this.compileFDSelect(cff.fdSelect.raw);
  21015. output.add(fdSelect);
  21016. compiled = this.compileTopDicts(cff.fdArray, output.length, true);
  21017. topDictTracker.setEntryLocation('FDArray', [output.length], output);
  21018. output.add(compiled.output);
  21019. var fontDictTrackers = compiled.trackers;
  21020. this.compilePrivateDicts(cff.fdArray, fontDictTrackers, output);
  21021. }
  21022. this.compilePrivateDicts([cff.topDict], [topDictTracker], output);
  21023. output.add([0]);
  21024. return output.data;
  21025. },
  21026. encodeNumber: function CFFCompiler_encodeNumber(value) {
  21027. if (parseFloat(value) === parseInt(value, 10) && !isNaN(value)) {
  21028. return this.encodeInteger(value);
  21029. }
  21030. return this.encodeFloat(value);
  21031. },
  21032. encodeFloat: function CFFCompiler_encodeFloat(num) {
  21033. var value = num.toString();
  21034. var m = /\.(\d*?)(?:9{5,20}|0{5,20})\d{0,2}(?:e(.+)|$)/.exec(value);
  21035. if (m) {
  21036. var epsilon = parseFloat('1e' + ((m[2] ? +m[2] : 0) + m[1].length));
  21037. value = (Math.round(num * epsilon) / epsilon).toString();
  21038. }
  21039. var nibbles = '';
  21040. var i, ii;
  21041. for (i = 0, ii = value.length; i < ii; ++i) {
  21042. var a = value[i];
  21043. if (a === 'e') {
  21044. nibbles += value[++i] === '-' ? 'c' : 'b';
  21045. } else if (a === '.') {
  21046. nibbles += 'a';
  21047. } else if (a === '-') {
  21048. nibbles += 'e';
  21049. } else {
  21050. nibbles += a;
  21051. }
  21052. }
  21053. nibbles += nibbles.length & 1 ? 'f' : 'ff';
  21054. var out = [30];
  21055. for (i = 0, ii = nibbles.length; i < ii; i += 2) {
  21056. out.push(parseInt(nibbles.substr(i, 2), 16));
  21057. }
  21058. return out;
  21059. },
  21060. encodeInteger: function CFFCompiler_encodeInteger(value) {
  21061. var code;
  21062. if (value >= -107 && value <= 107) {
  21063. code = [value + 139];
  21064. } else if (value >= 108 && value <= 1131) {
  21065. value = value - 108;
  21066. code = [
  21067. (value >> 8) + 247,
  21068. value & 0xFF
  21069. ];
  21070. } else if (value >= -1131 && value <= -108) {
  21071. value = -value - 108;
  21072. code = [
  21073. (value >> 8) + 251,
  21074. value & 0xFF
  21075. ];
  21076. } else if (value >= -32768 && value <= 32767) {
  21077. code = [
  21078. 0x1c,
  21079. value >> 8 & 0xFF,
  21080. value & 0xFF
  21081. ];
  21082. } else {
  21083. code = [
  21084. 0x1d,
  21085. value >> 24 & 0xFF,
  21086. value >> 16 & 0xFF,
  21087. value >> 8 & 0xFF,
  21088. value & 0xFF
  21089. ];
  21090. }
  21091. return code;
  21092. },
  21093. compileHeader: function CFFCompiler_compileHeader(header) {
  21094. return [
  21095. header.major,
  21096. header.minor,
  21097. header.hdrSize,
  21098. header.offSize
  21099. ];
  21100. },
  21101. compileNameIndex: function CFFCompiler_compileNameIndex(names) {
  21102. var nameIndex = new CFFIndex();
  21103. for (var i = 0, ii = names.length; i < ii; ++i) {
  21104. nameIndex.add(stringToBytes(names[i]));
  21105. }
  21106. return this.compileIndex(nameIndex);
  21107. },
  21108. compileTopDicts: function CFFCompiler_compileTopDicts(dicts, length, removeCidKeys) {
  21109. var fontDictTrackers = [];
  21110. var fdArrayIndex = new CFFIndex();
  21111. for (var i = 0, ii = dicts.length; i < ii; ++i) {
  21112. var fontDict = dicts[i];
  21113. if (removeCidKeys) {
  21114. fontDict.removeByName('CIDFontVersion');
  21115. fontDict.removeByName('CIDFontRevision');
  21116. fontDict.removeByName('CIDFontType');
  21117. fontDict.removeByName('CIDCount');
  21118. fontDict.removeByName('UIDBase');
  21119. }
  21120. var fontDictTracker = new CFFOffsetTracker();
  21121. var fontDictData = this.compileDict(fontDict, fontDictTracker);
  21122. fontDictTrackers.push(fontDictTracker);
  21123. fdArrayIndex.add(fontDictData);
  21124. fontDictTracker.offset(length);
  21125. }
  21126. fdArrayIndex = this.compileIndex(fdArrayIndex, fontDictTrackers);
  21127. return {
  21128. trackers: fontDictTrackers,
  21129. output: fdArrayIndex
  21130. };
  21131. },
  21132. compilePrivateDicts: function CFFCompiler_compilePrivateDicts(dicts, trackers, output) {
  21133. for (var i = 0, ii = dicts.length; i < ii; ++i) {
  21134. var fontDict = dicts[i];
  21135. assert(fontDict.privateDict && fontDict.hasName('Private'), 'There must be an private dictionary.');
  21136. var privateDict = fontDict.privateDict;
  21137. var privateDictTracker = new CFFOffsetTracker();
  21138. var privateDictData = this.compileDict(privateDict, privateDictTracker);
  21139. var outputLength = output.length;
  21140. privateDictTracker.offset(outputLength);
  21141. if (!privateDictData.length) {
  21142. outputLength = 0;
  21143. }
  21144. trackers[i].setEntryLocation('Private', [
  21145. privateDictData.length,
  21146. outputLength
  21147. ], output);
  21148. output.add(privateDictData);
  21149. if (privateDict.subrsIndex && privateDict.hasName('Subrs')) {
  21150. var subrs = this.compileIndex(privateDict.subrsIndex);
  21151. privateDictTracker.setEntryLocation('Subrs', [privateDictData.length], output);
  21152. output.add(subrs);
  21153. }
  21154. }
  21155. },
  21156. compileDict: function CFFCompiler_compileDict(dict, offsetTracker) {
  21157. var out = [];
  21158. var order = dict.order;
  21159. for (var i = 0; i < order.length; ++i) {
  21160. var key = order[i];
  21161. if (!(key in dict.values)) {
  21162. continue;
  21163. }
  21164. var values = dict.values[key];
  21165. var types = dict.types[key];
  21166. if (!isArray(types)) {
  21167. types = [types];
  21168. }
  21169. if (!isArray(values)) {
  21170. values = [values];
  21171. }
  21172. if (values.length === 0) {
  21173. continue;
  21174. }
  21175. for (var j = 0, jj = types.length; j < jj; ++j) {
  21176. var type = types[j];
  21177. var value = values[j];
  21178. switch (type) {
  21179. case 'num':
  21180. case 'sid':
  21181. out = out.concat(this.encodeNumber(value));
  21182. break;
  21183. case 'offset':
  21184. var name = dict.keyToNameMap[key];
  21185. if (!offsetTracker.isTracking(name)) {
  21186. offsetTracker.track(name, out.length);
  21187. }
  21188. out = out.concat([
  21189. 0x1d,
  21190. 0,
  21191. 0,
  21192. 0,
  21193. 0
  21194. ]);
  21195. break;
  21196. case 'array':
  21197. case 'delta':
  21198. out = out.concat(this.encodeNumber(value));
  21199. for (var k = 1, kk = values.length; k < kk; ++k) {
  21200. out = out.concat(this.encodeNumber(values[k]));
  21201. }
  21202. break;
  21203. default:
  21204. error('Unknown data type of ' + type);
  21205. break;
  21206. }
  21207. }
  21208. out = out.concat(dict.opcodes[key]);
  21209. }
  21210. return out;
  21211. },
  21212. compileStringIndex: function CFFCompiler_compileStringIndex(strings) {
  21213. var stringIndex = new CFFIndex();
  21214. for (var i = 0, ii = strings.length; i < ii; ++i) {
  21215. stringIndex.add(stringToBytes(strings[i]));
  21216. }
  21217. return this.compileIndex(stringIndex);
  21218. },
  21219. compileGlobalSubrIndex: function CFFCompiler_compileGlobalSubrIndex() {
  21220. var globalSubrIndex = this.cff.globalSubrIndex;
  21221. this.out.writeByteArray(this.compileIndex(globalSubrIndex));
  21222. },
  21223. compileCharStrings: function CFFCompiler_compileCharStrings(charStrings) {
  21224. return this.compileIndex(charStrings);
  21225. },
  21226. compileCharset: function CFFCompiler_compileCharset(charset) {
  21227. return this.compileTypedArray(charset.raw);
  21228. },
  21229. compileEncoding: function CFFCompiler_compileEncoding(encoding) {
  21230. return this.compileTypedArray(encoding.raw);
  21231. },
  21232. compileFDSelect: function CFFCompiler_compileFDSelect(fdSelect) {
  21233. return this.compileTypedArray(fdSelect);
  21234. },
  21235. compileTypedArray: function CFFCompiler_compileTypedArray(data) {
  21236. var out = [];
  21237. for (var i = 0, ii = data.length; i < ii; ++i) {
  21238. out[i] = data[i];
  21239. }
  21240. return out;
  21241. },
  21242. compileIndex: function CFFCompiler_compileIndex(index, trackers) {
  21243. trackers = trackers || [];
  21244. var objects = index.objects;
  21245. var count = objects.length;
  21246. if (count === 0) {
  21247. return [
  21248. 0,
  21249. 0,
  21250. 0
  21251. ];
  21252. }
  21253. var data = [
  21254. count >> 8 & 0xFF,
  21255. count & 0xff
  21256. ];
  21257. var lastOffset = 1, i;
  21258. for (i = 0; i < count; ++i) {
  21259. lastOffset += objects[i].length;
  21260. }
  21261. var offsetSize;
  21262. if (lastOffset < 0x100) {
  21263. offsetSize = 1;
  21264. } else if (lastOffset < 0x10000) {
  21265. offsetSize = 2;
  21266. } else if (lastOffset < 0x1000000) {
  21267. offsetSize = 3;
  21268. } else {
  21269. offsetSize = 4;
  21270. }
  21271. data.push(offsetSize);
  21272. var relativeOffset = 1;
  21273. for (i = 0; i < count + 1; i++) {
  21274. if (offsetSize === 1) {
  21275. data.push(relativeOffset & 0xFF);
  21276. } else if (offsetSize === 2) {
  21277. data.push(relativeOffset >> 8 & 0xFF, relativeOffset & 0xFF);
  21278. } else if (offsetSize === 3) {
  21279. data.push(relativeOffset >> 16 & 0xFF, relativeOffset >> 8 & 0xFF, relativeOffset & 0xFF);
  21280. } else {
  21281. data.push(relativeOffset >>> 24 & 0xFF, relativeOffset >> 16 & 0xFF, relativeOffset >> 8 & 0xFF, relativeOffset & 0xFF);
  21282. }
  21283. if (objects[i]) {
  21284. relativeOffset += objects[i].length;
  21285. }
  21286. }
  21287. for (i = 0; i < count; i++) {
  21288. if (trackers[i]) {
  21289. trackers[i].offset(data.length);
  21290. }
  21291. for (var j = 0, jj = objects[i].length; j < jj; j++) {
  21292. data.push(objects[i][j]);
  21293. }
  21294. }
  21295. return data;
  21296. }
  21297. };
  21298. return CFFCompiler;
  21299. }();
  21300. exports.CFFStandardStrings = CFFStandardStrings;
  21301. exports.CFFParser = CFFParser;
  21302. exports.CFF = CFF;
  21303. exports.CFFHeader = CFFHeader;
  21304. exports.CFFStrings = CFFStrings;
  21305. exports.CFFIndex = CFFIndex;
  21306. exports.CFFCharset = CFFCharset;
  21307. exports.CFFTopDict = CFFTopDict;
  21308. exports.CFFPrivateDict = CFFPrivateDict;
  21309. exports.CFFCompiler = CFFCompiler;
  21310. /***/ }),
  21311. /* 12 */
  21312. /***/ (function(module, exports, __w_pdfjs_require__) {
  21313. "use strict";
  21314. var sharedUtil = __w_pdfjs_require__(0);
  21315. var MissingDataException = sharedUtil.MissingDataException;
  21316. var arrayByteLength = sharedUtil.arrayByteLength;
  21317. var arraysToBytes = sharedUtil.arraysToBytes;
  21318. var assert = sharedUtil.assert;
  21319. var createPromiseCapability = sharedUtil.createPromiseCapability;
  21320. var isInt = sharedUtil.isInt;
  21321. var isEmptyObj = sharedUtil.isEmptyObj;
  21322. var ChunkedStream = function ChunkedStreamClosure() {
  21323. function ChunkedStream(length, chunkSize, manager) {
  21324. this.bytes = new Uint8Array(length);
  21325. this.start = 0;
  21326. this.pos = 0;
  21327. this.end = length;
  21328. this.chunkSize = chunkSize;
  21329. this.loadedChunks = [];
  21330. this.numChunksLoaded = 0;
  21331. this.numChunks = Math.ceil(length / chunkSize);
  21332. this.manager = manager;
  21333. this.progressiveDataLength = 0;
  21334. this.lastSuccessfulEnsureByteChunk = -1;
  21335. }
  21336. ChunkedStream.prototype = {
  21337. getMissingChunks: function ChunkedStream_getMissingChunks() {
  21338. var chunks = [];
  21339. for (var chunk = 0, n = this.numChunks; chunk < n; ++chunk) {
  21340. if (!this.loadedChunks[chunk]) {
  21341. chunks.push(chunk);
  21342. }
  21343. }
  21344. return chunks;
  21345. },
  21346. getBaseStreams: function ChunkedStream_getBaseStreams() {
  21347. return [this];
  21348. },
  21349. allChunksLoaded: function ChunkedStream_allChunksLoaded() {
  21350. return this.numChunksLoaded === this.numChunks;
  21351. },
  21352. onReceiveData: function ChunkedStream_onReceiveData(begin, chunk) {
  21353. var end = begin + chunk.byteLength;
  21354. assert(begin % this.chunkSize === 0, 'Bad begin offset: ' + begin);
  21355. var length = this.bytes.length;
  21356. assert(end % this.chunkSize === 0 || end === length, 'Bad end offset: ' + end);
  21357. this.bytes.set(new Uint8Array(chunk), begin);
  21358. var chunkSize = this.chunkSize;
  21359. var beginChunk = Math.floor(begin / chunkSize);
  21360. var endChunk = Math.floor((end - 1) / chunkSize) + 1;
  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. onReceiveProgressiveData: function ChunkedStream_onReceiveProgressiveData(data) {
  21370. var position = this.progressiveDataLength;
  21371. var beginChunk = Math.floor(position / this.chunkSize);
  21372. this.bytes.set(new Uint8Array(data), position);
  21373. position += data.byteLength;
  21374. this.progressiveDataLength = position;
  21375. var endChunk = position >= this.end ? this.numChunks : Math.floor(position / this.chunkSize);
  21376. var curChunk;
  21377. for (curChunk = beginChunk; curChunk < endChunk; ++curChunk) {
  21378. if (!this.loadedChunks[curChunk]) {
  21379. this.loadedChunks[curChunk] = true;
  21380. ++this.numChunksLoaded;
  21381. }
  21382. }
  21383. },
  21384. ensureByte: function ChunkedStream_ensureByte(pos) {
  21385. var chunk = Math.floor(pos / this.chunkSize);
  21386. if (chunk === this.lastSuccessfulEnsureByteChunk) {
  21387. return;
  21388. }
  21389. if (!this.loadedChunks[chunk]) {
  21390. throw new MissingDataException(pos, pos + 1);
  21391. }
  21392. this.lastSuccessfulEnsureByteChunk = chunk;
  21393. },
  21394. ensureRange: function ChunkedStream_ensureRange(begin, end) {
  21395. if (begin >= end) {
  21396. return;
  21397. }
  21398. if (end <= this.progressiveDataLength) {
  21399. return;
  21400. }
  21401. var chunkSize = this.chunkSize;
  21402. var beginChunk = Math.floor(begin / chunkSize);
  21403. var endChunk = Math.floor((end - 1) / chunkSize) + 1;
  21404. for (var chunk = beginChunk; chunk < endChunk; ++chunk) {
  21405. if (!this.loadedChunks[chunk]) {
  21406. throw new MissingDataException(begin, end);
  21407. }
  21408. }
  21409. },
  21410. nextEmptyChunk: function ChunkedStream_nextEmptyChunk(beginChunk) {
  21411. var chunk, numChunks = this.numChunks;
  21412. for (var i = 0; i < numChunks; ++i) {
  21413. chunk = (beginChunk + i) % numChunks;
  21414. if (!this.loadedChunks[chunk]) {
  21415. return chunk;
  21416. }
  21417. }
  21418. return null;
  21419. },
  21420. hasChunk: function ChunkedStream_hasChunk(chunk) {
  21421. return !!this.loadedChunks[chunk];
  21422. },
  21423. get length() {
  21424. return this.end - this.start;
  21425. },
  21426. get isEmpty() {
  21427. return this.length === 0;
  21428. },
  21429. getByte: function ChunkedStream_getByte() {
  21430. var pos = this.pos;
  21431. if (pos >= this.end) {
  21432. return -1;
  21433. }
  21434. this.ensureByte(pos);
  21435. return this.bytes[this.pos++];
  21436. },
  21437. getUint16: function ChunkedStream_getUint16() {
  21438. var b0 = this.getByte();
  21439. var b1 = this.getByte();
  21440. if (b0 === -1 || b1 === -1) {
  21441. return -1;
  21442. }
  21443. return (b0 << 8) + b1;
  21444. },
  21445. getInt32: function ChunkedStream_getInt32() {
  21446. var b0 = this.getByte();
  21447. var b1 = this.getByte();
  21448. var b2 = this.getByte();
  21449. var b3 = this.getByte();
  21450. return (b0 << 24) + (b1 << 16) + (b2 << 8) + b3;
  21451. },
  21452. getBytes: function ChunkedStream_getBytes(length) {
  21453. var bytes = this.bytes;
  21454. var pos = this.pos;
  21455. var strEnd = this.end;
  21456. if (!length) {
  21457. this.ensureRange(pos, strEnd);
  21458. return bytes.subarray(pos, strEnd);
  21459. }
  21460. var end = pos + length;
  21461. if (end > strEnd) {
  21462. end = strEnd;
  21463. }
  21464. this.ensureRange(pos, end);
  21465. this.pos = end;
  21466. return bytes.subarray(pos, end);
  21467. },
  21468. peekByte: function ChunkedStream_peekByte() {
  21469. var peekedByte = this.getByte();
  21470. this.pos--;
  21471. return peekedByte;
  21472. },
  21473. peekBytes: function ChunkedStream_peekBytes(length) {
  21474. var bytes = this.getBytes(length);
  21475. this.pos -= bytes.length;
  21476. return bytes;
  21477. },
  21478. getByteRange: function ChunkedStream_getBytes(begin, end) {
  21479. this.ensureRange(begin, end);
  21480. return this.bytes.subarray(begin, end);
  21481. },
  21482. skip: function ChunkedStream_skip(n) {
  21483. if (!n) {
  21484. n = 1;
  21485. }
  21486. this.pos += n;
  21487. },
  21488. reset: function ChunkedStream_reset() {
  21489. this.pos = this.start;
  21490. },
  21491. moveStart: function ChunkedStream_moveStart() {
  21492. this.start = this.pos;
  21493. },
  21494. makeSubStream: function ChunkedStream_makeSubStream(start, length, dict) {
  21495. this.ensureRange(start, start + length);
  21496. function ChunkedStreamSubstream() {
  21497. }
  21498. ChunkedStreamSubstream.prototype = Object.create(this);
  21499. ChunkedStreamSubstream.prototype.getMissingChunks = function () {
  21500. var chunkSize = this.chunkSize;
  21501. var beginChunk = Math.floor(this.start / chunkSize);
  21502. var endChunk = Math.floor((this.end - 1) / chunkSize) + 1;
  21503. var missingChunks = [];
  21504. for (var chunk = beginChunk; chunk < endChunk; ++chunk) {
  21505. if (!this.loadedChunks[chunk]) {
  21506. missingChunks.push(chunk);
  21507. }
  21508. }
  21509. return missingChunks;
  21510. };
  21511. var subStream = new ChunkedStreamSubstream();
  21512. subStream.pos = subStream.start = start;
  21513. subStream.end = start + length || this.end;
  21514. subStream.dict = dict;
  21515. return subStream;
  21516. }
  21517. };
  21518. return ChunkedStream;
  21519. }();
  21520. var ChunkedStreamManager = function ChunkedStreamManagerClosure() {
  21521. function ChunkedStreamManager(pdfNetworkStream, args) {
  21522. var chunkSize = args.rangeChunkSize;
  21523. var length = args.length;
  21524. this.stream = new ChunkedStream(length, chunkSize, this);
  21525. this.length = length;
  21526. this.chunkSize = chunkSize;
  21527. this.pdfNetworkStream = pdfNetworkStream;
  21528. this.url = args.url;
  21529. this.disableAutoFetch = args.disableAutoFetch;
  21530. this.msgHandler = args.msgHandler;
  21531. this.currRequestId = 0;
  21532. this.chunksNeededByRequest = Object.create(null);
  21533. this.requestsByChunk = Object.create(null);
  21534. this.promisesByRequest = Object.create(null);
  21535. this.progressiveDataLength = 0;
  21536. this.aborted = false;
  21537. this._loadedStreamCapability = createPromiseCapability();
  21538. }
  21539. ChunkedStreamManager.prototype = {
  21540. onLoadedStream: function ChunkedStreamManager_getLoadedStream() {
  21541. return this._loadedStreamCapability.promise;
  21542. },
  21543. sendRequest: function ChunkedStreamManager_sendRequest(begin, end) {
  21544. var rangeReader = this.pdfNetworkStream.getRangeReader(begin, end);
  21545. if (!rangeReader.isStreamingSupported) {
  21546. rangeReader.onProgress = this.onProgress.bind(this);
  21547. }
  21548. var chunks = [], loaded = 0;
  21549. var manager = this;
  21550. var promise = new Promise(function (resolve, reject) {
  21551. var readChunk = function (chunk) {
  21552. try {
  21553. if (!chunk.done) {
  21554. var data = chunk.value;
  21555. chunks.push(data);
  21556. loaded += arrayByteLength(data);
  21557. if (rangeReader.isStreamingSupported) {
  21558. manager.onProgress({ loaded: loaded });
  21559. }
  21560. rangeReader.read().then(readChunk, reject);
  21561. return;
  21562. }
  21563. var chunkData = arraysToBytes(chunks);
  21564. chunks = null;
  21565. resolve(chunkData);
  21566. } catch (e) {
  21567. reject(e);
  21568. }
  21569. };
  21570. rangeReader.read().then(readChunk, reject);
  21571. });
  21572. promise.then(function (data) {
  21573. if (this.aborted) {
  21574. return;
  21575. }
  21576. this.onReceiveData({
  21577. chunk: data,
  21578. begin: begin
  21579. });
  21580. }.bind(this));
  21581. },
  21582. requestAllChunks: function ChunkedStreamManager_requestAllChunks() {
  21583. var missingChunks = this.stream.getMissingChunks();
  21584. this._requestChunks(missingChunks);
  21585. return this._loadedStreamCapability.promise;
  21586. },
  21587. _requestChunks: function ChunkedStreamManager_requestChunks(chunks) {
  21588. var requestId = this.currRequestId++;
  21589. var i, ii;
  21590. var chunksNeeded = Object.create(null);
  21591. this.chunksNeededByRequest[requestId] = chunksNeeded;
  21592. for (i = 0, ii = chunks.length; i < ii; i++) {
  21593. if (!this.stream.hasChunk(chunks[i])) {
  21594. chunksNeeded[chunks[i]] = true;
  21595. }
  21596. }
  21597. if (isEmptyObj(chunksNeeded)) {
  21598. return Promise.resolve();
  21599. }
  21600. var capability = createPromiseCapability();
  21601. this.promisesByRequest[requestId] = capability;
  21602. var chunksToRequest = [];
  21603. for (var chunk in chunksNeeded) {
  21604. chunk = chunk | 0;
  21605. if (!(chunk in this.requestsByChunk)) {
  21606. this.requestsByChunk[chunk] = [];
  21607. chunksToRequest.push(chunk);
  21608. }
  21609. this.requestsByChunk[chunk].push(requestId);
  21610. }
  21611. if (!chunksToRequest.length) {
  21612. return capability.promise;
  21613. }
  21614. var groupedChunksToRequest = this.groupChunks(chunksToRequest);
  21615. for (i = 0; i < groupedChunksToRequest.length; ++i) {
  21616. var groupedChunk = groupedChunksToRequest[i];
  21617. var begin = groupedChunk.beginChunk * this.chunkSize;
  21618. var end = Math.min(groupedChunk.endChunk * this.chunkSize, this.length);
  21619. this.sendRequest(begin, end);
  21620. }
  21621. return capability.promise;
  21622. },
  21623. getStream: function ChunkedStreamManager_getStream() {
  21624. return this.stream;
  21625. },
  21626. requestRange: function ChunkedStreamManager_requestRange(begin, end) {
  21627. end = Math.min(end, this.length);
  21628. var beginChunk = this.getBeginChunk(begin);
  21629. var endChunk = this.getEndChunk(end);
  21630. var chunks = [];
  21631. for (var chunk = beginChunk; chunk < endChunk; ++chunk) {
  21632. chunks.push(chunk);
  21633. }
  21634. return this._requestChunks(chunks);
  21635. },
  21636. requestRanges: function ChunkedStreamManager_requestRanges(ranges) {
  21637. ranges = ranges || [];
  21638. var chunksToRequest = [];
  21639. for (var i = 0; i < ranges.length; i++) {
  21640. var beginChunk = this.getBeginChunk(ranges[i].begin);
  21641. var endChunk = this.getEndChunk(ranges[i].end);
  21642. for (var chunk = beginChunk; chunk < endChunk; ++chunk) {
  21643. if (chunksToRequest.indexOf(chunk) < 0) {
  21644. chunksToRequest.push(chunk);
  21645. }
  21646. }
  21647. }
  21648. chunksToRequest.sort(function (a, b) {
  21649. return a - b;
  21650. });
  21651. return this._requestChunks(chunksToRequest);
  21652. },
  21653. groupChunks: function ChunkedStreamManager_groupChunks(chunks) {
  21654. var groupedChunks = [];
  21655. var beginChunk = -1;
  21656. var prevChunk = -1;
  21657. for (var i = 0; i < chunks.length; ++i) {
  21658. var chunk = chunks[i];
  21659. if (beginChunk < 0) {
  21660. beginChunk = chunk;
  21661. }
  21662. if (prevChunk >= 0 && prevChunk + 1 !== chunk) {
  21663. groupedChunks.push({
  21664. beginChunk: beginChunk,
  21665. endChunk: prevChunk + 1
  21666. });
  21667. beginChunk = chunk;
  21668. }
  21669. if (i + 1 === chunks.length) {
  21670. groupedChunks.push({
  21671. beginChunk: beginChunk,
  21672. endChunk: chunk + 1
  21673. });
  21674. }
  21675. prevChunk = chunk;
  21676. }
  21677. return groupedChunks;
  21678. },
  21679. onProgress: function ChunkedStreamManager_onProgress(args) {
  21680. var bytesLoaded = this.stream.numChunksLoaded * this.chunkSize + args.loaded;
  21681. this.msgHandler.send('DocProgress', {
  21682. loaded: bytesLoaded,
  21683. total: this.length
  21684. });
  21685. },
  21686. onReceiveData: function ChunkedStreamManager_onReceiveData(args) {
  21687. var chunk = args.chunk;
  21688. var isProgressive = args.begin === undefined;
  21689. var begin = isProgressive ? this.progressiveDataLength : args.begin;
  21690. var end = begin + chunk.byteLength;
  21691. var beginChunk = Math.floor(begin / this.chunkSize);
  21692. var endChunk = end < this.length ? Math.floor(end / this.chunkSize) : Math.ceil(end / this.chunkSize);
  21693. if (isProgressive) {
  21694. this.stream.onReceiveProgressiveData(chunk);
  21695. this.progressiveDataLength = end;
  21696. } else {
  21697. this.stream.onReceiveData(begin, chunk);
  21698. }
  21699. if (this.stream.allChunksLoaded()) {
  21700. this._loadedStreamCapability.resolve(this.stream);
  21701. }
  21702. var loadedRequests = [];
  21703. var i, requestId;
  21704. for (chunk = beginChunk; chunk < endChunk; ++chunk) {
  21705. var requestIds = this.requestsByChunk[chunk] || [];
  21706. delete this.requestsByChunk[chunk];
  21707. for (i = 0; i < requestIds.length; ++i) {
  21708. requestId = requestIds[i];
  21709. var chunksNeeded = this.chunksNeededByRequest[requestId];
  21710. if (chunk in chunksNeeded) {
  21711. delete chunksNeeded[chunk];
  21712. }
  21713. if (!isEmptyObj(chunksNeeded)) {
  21714. continue;
  21715. }
  21716. loadedRequests.push(requestId);
  21717. }
  21718. }
  21719. if (!this.disableAutoFetch && isEmptyObj(this.requestsByChunk)) {
  21720. var nextEmptyChunk;
  21721. if (this.stream.numChunksLoaded === 1) {
  21722. var lastChunk = this.stream.numChunks - 1;
  21723. if (!this.stream.hasChunk(lastChunk)) {
  21724. nextEmptyChunk = lastChunk;
  21725. }
  21726. } else {
  21727. nextEmptyChunk = this.stream.nextEmptyChunk(endChunk);
  21728. }
  21729. if (isInt(nextEmptyChunk)) {
  21730. this._requestChunks([nextEmptyChunk]);
  21731. }
  21732. }
  21733. for (i = 0; i < loadedRequests.length; ++i) {
  21734. requestId = loadedRequests[i];
  21735. var capability = this.promisesByRequest[requestId];
  21736. delete this.promisesByRequest[requestId];
  21737. capability.resolve();
  21738. }
  21739. this.msgHandler.send('DocProgress', {
  21740. loaded: this.stream.numChunksLoaded * this.chunkSize,
  21741. total: this.length
  21742. });
  21743. },
  21744. onError: function ChunkedStreamManager_onError(err) {
  21745. this._loadedStreamCapability.reject(err);
  21746. },
  21747. getBeginChunk: function ChunkedStreamManager_getBeginChunk(begin) {
  21748. var chunk = Math.floor(begin / this.chunkSize);
  21749. return chunk;
  21750. },
  21751. getEndChunk: function ChunkedStreamManager_getEndChunk(end) {
  21752. var chunk = Math.floor((end - 1) / this.chunkSize) + 1;
  21753. return chunk;
  21754. },
  21755. abort: function ChunkedStreamManager_abort() {
  21756. this.aborted = true;
  21757. if (this.pdfNetworkStream) {
  21758. this.pdfNetworkStream.cancelAllRequests('abort');
  21759. }
  21760. for (var requestId in this.promisesByRequest) {
  21761. var capability = this.promisesByRequest[requestId];
  21762. capability.reject(new Error('Request was aborted'));
  21763. }
  21764. }
  21765. };
  21766. return ChunkedStreamManager;
  21767. }();
  21768. exports.ChunkedStream = ChunkedStream;
  21769. exports.ChunkedStreamManager = ChunkedStreamManager;
  21770. /***/ }),
  21771. /* 13 */
  21772. /***/ (function(module, exports, __w_pdfjs_require__) {
  21773. "use strict";
  21774. var sharedUtil = __w_pdfjs_require__(0);
  21775. var corePrimitives = __w_pdfjs_require__(1);
  21776. var coreStream = __w_pdfjs_require__(2);
  21777. var PasswordException = sharedUtil.PasswordException;
  21778. var PasswordResponses = sharedUtil.PasswordResponses;
  21779. var bytesToString = sharedUtil.bytesToString;
  21780. var warn = sharedUtil.warn;
  21781. var error = sharedUtil.error;
  21782. var assert = sharedUtil.assert;
  21783. var isInt = sharedUtil.isInt;
  21784. var stringToBytes = sharedUtil.stringToBytes;
  21785. var utf8StringToString = sharedUtil.utf8StringToString;
  21786. var Name = corePrimitives.Name;
  21787. var isName = corePrimitives.isName;
  21788. var isDict = corePrimitives.isDict;
  21789. var DecryptStream = coreStream.DecryptStream;
  21790. var ARCFourCipher = function ARCFourCipherClosure() {
  21791. function ARCFourCipher(key) {
  21792. this.a = 0;
  21793. this.b = 0;
  21794. var s = new Uint8Array(256);
  21795. var i, j = 0, tmp, keyLength = key.length;
  21796. for (i = 0; i < 256; ++i) {
  21797. s[i] = i;
  21798. }
  21799. for (i = 0; i < 256; ++i) {
  21800. tmp = s[i];
  21801. j = j + tmp + key[i % keyLength] & 0xFF;
  21802. s[i] = s[j];
  21803. s[j] = tmp;
  21804. }
  21805. this.s = s;
  21806. }
  21807. ARCFourCipher.prototype = {
  21808. encryptBlock: function ARCFourCipher_encryptBlock(data) {
  21809. var i, n = data.length, tmp, tmp2;
  21810. var a = this.a, b = this.b, s = this.s;
  21811. var output = new Uint8Array(n);
  21812. for (i = 0; i < n; ++i) {
  21813. a = a + 1 & 0xFF;
  21814. tmp = s[a];
  21815. b = b + tmp & 0xFF;
  21816. tmp2 = s[b];
  21817. s[a] = tmp2;
  21818. s[b] = tmp;
  21819. output[i] = data[i] ^ s[tmp + tmp2 & 0xFF];
  21820. }
  21821. this.a = a;
  21822. this.b = b;
  21823. return output;
  21824. }
  21825. };
  21826. ARCFourCipher.prototype.decryptBlock = ARCFourCipher.prototype.encryptBlock;
  21827. return ARCFourCipher;
  21828. }();
  21829. var calculateMD5 = function calculateMD5Closure() {
  21830. var r = new Uint8Array([
  21831. 7,
  21832. 12,
  21833. 17,
  21834. 22,
  21835. 7,
  21836. 12,
  21837. 17,
  21838. 22,
  21839. 7,
  21840. 12,
  21841. 17,
  21842. 22,
  21843. 7,
  21844. 12,
  21845. 17,
  21846. 22,
  21847. 5,
  21848. 9,
  21849. 14,
  21850. 20,
  21851. 5,
  21852. 9,
  21853. 14,
  21854. 20,
  21855. 5,
  21856. 9,
  21857. 14,
  21858. 20,
  21859. 5,
  21860. 9,
  21861. 14,
  21862. 20,
  21863. 4,
  21864. 11,
  21865. 16,
  21866. 23,
  21867. 4,
  21868. 11,
  21869. 16,
  21870. 23,
  21871. 4,
  21872. 11,
  21873. 16,
  21874. 23,
  21875. 4,
  21876. 11,
  21877. 16,
  21878. 23,
  21879. 6,
  21880. 10,
  21881. 15,
  21882. 21,
  21883. 6,
  21884. 10,
  21885. 15,
  21886. 21,
  21887. 6,
  21888. 10,
  21889. 15,
  21890. 21,
  21891. 6,
  21892. 10,
  21893. 15,
  21894. 21
  21895. ]);
  21896. var k = new Int32Array([
  21897. -680876936,
  21898. -389564586,
  21899. 606105819,
  21900. -1044525330,
  21901. -176418897,
  21902. 1200080426,
  21903. -1473231341,
  21904. -45705983,
  21905. 1770035416,
  21906. -1958414417,
  21907. -42063,
  21908. -1990404162,
  21909. 1804603682,
  21910. -40341101,
  21911. -1502002290,
  21912. 1236535329,
  21913. -165796510,
  21914. -1069501632,
  21915. 643717713,
  21916. -373897302,
  21917. -701558691,
  21918. 38016083,
  21919. -660478335,
  21920. -405537848,
  21921. 568446438,
  21922. -1019803690,
  21923. -187363961,
  21924. 1163531501,
  21925. -1444681467,
  21926. -51403784,
  21927. 1735328473,
  21928. -1926607734,
  21929. -378558,
  21930. -2022574463,
  21931. 1839030562,
  21932. -35309556,
  21933. -1530992060,
  21934. 1272893353,
  21935. -155497632,
  21936. -1094730640,
  21937. 681279174,
  21938. -358537222,
  21939. -722521979,
  21940. 76029189,
  21941. -640364487,
  21942. -421815835,
  21943. 530742520,
  21944. -995338651,
  21945. -198630844,
  21946. 1126891415,
  21947. -1416354905,
  21948. -57434055,
  21949. 1700485571,
  21950. -1894986606,
  21951. -1051523,
  21952. -2054922799,
  21953. 1873313359,
  21954. -30611744,
  21955. -1560198380,
  21956. 1309151649,
  21957. -145523070,
  21958. -1120210379,
  21959. 718787259,
  21960. -343485551
  21961. ]);
  21962. function hash(data, offset, length) {
  21963. var h0 = 1732584193, h1 = -271733879, h2 = -1732584194, h3 = 271733878;
  21964. var paddedLength = length + 72 & ~63;
  21965. var padded = new Uint8Array(paddedLength);
  21966. var i, j, n;
  21967. for (i = 0; i < length; ++i) {
  21968. padded[i] = data[offset++];
  21969. }
  21970. padded[i++] = 0x80;
  21971. n = paddedLength - 8;
  21972. while (i < n) {
  21973. padded[i++] = 0;
  21974. }
  21975. padded[i++] = length << 3 & 0xFF;
  21976. padded[i++] = length >> 5 & 0xFF;
  21977. padded[i++] = length >> 13 & 0xFF;
  21978. padded[i++] = length >> 21 & 0xFF;
  21979. padded[i++] = length >>> 29 & 0xFF;
  21980. padded[i++] = 0;
  21981. padded[i++] = 0;
  21982. padded[i++] = 0;
  21983. var w = new Int32Array(16);
  21984. for (i = 0; i < paddedLength;) {
  21985. for (j = 0; j < 16; ++j, i += 4) {
  21986. w[j] = padded[i] | padded[i + 1] << 8 | padded[i + 2] << 16 | padded[i + 3] << 24;
  21987. }
  21988. var a = h0, b = h1, c = h2, d = h3, f, g;
  21989. for (j = 0; j < 64; ++j) {
  21990. if (j < 16) {
  21991. f = b & c | ~b & d;
  21992. g = j;
  21993. } else if (j < 32) {
  21994. f = d & b | ~d & c;
  21995. g = 5 * j + 1 & 15;
  21996. } else if (j < 48) {
  21997. f = b ^ c ^ d;
  21998. g = 3 * j + 5 & 15;
  21999. } else {
  22000. f = c ^ (b | ~d);
  22001. g = 7 * j & 15;
  22002. }
  22003. var tmp = d, rotateArg = a + f + k[j] + w[g] | 0, rotate = r[j];
  22004. d = c;
  22005. c = b;
  22006. b = b + (rotateArg << rotate | rotateArg >>> 32 - rotate) | 0;
  22007. a = tmp;
  22008. }
  22009. h0 = h0 + a | 0;
  22010. h1 = h1 + b | 0;
  22011. h2 = h2 + c | 0;
  22012. h3 = h3 + d | 0;
  22013. }
  22014. return new Uint8Array([
  22015. h0 & 0xFF,
  22016. h0 >> 8 & 0xFF,
  22017. h0 >> 16 & 0xFF,
  22018. h0 >>> 24 & 0xFF,
  22019. h1 & 0xFF,
  22020. h1 >> 8 & 0xFF,
  22021. h1 >> 16 & 0xFF,
  22022. h1 >>> 24 & 0xFF,
  22023. h2 & 0xFF,
  22024. h2 >> 8 & 0xFF,
  22025. h2 >> 16 & 0xFF,
  22026. h2 >>> 24 & 0xFF,
  22027. h3 & 0xFF,
  22028. h3 >> 8 & 0xFF,
  22029. h3 >> 16 & 0xFF,
  22030. h3 >>> 24 & 0xFF
  22031. ]);
  22032. }
  22033. return hash;
  22034. }();
  22035. var Word64 = function Word64Closure() {
  22036. function Word64(highInteger, lowInteger) {
  22037. this.high = highInteger | 0;
  22038. this.low = lowInteger | 0;
  22039. }
  22040. Word64.prototype = {
  22041. and: function Word64_and(word) {
  22042. this.high &= word.high;
  22043. this.low &= word.low;
  22044. },
  22045. xor: function Word64_xor(word) {
  22046. this.high ^= word.high;
  22047. this.low ^= word.low;
  22048. },
  22049. or: function Word64_or(word) {
  22050. this.high |= word.high;
  22051. this.low |= word.low;
  22052. },
  22053. shiftRight: function Word64_shiftRight(places) {
  22054. if (places >= 32) {
  22055. this.low = this.high >>> places - 32 | 0;
  22056. this.high = 0;
  22057. } else {
  22058. this.low = this.low >>> places | this.high << 32 - places;
  22059. this.high = this.high >>> places | 0;
  22060. }
  22061. },
  22062. shiftLeft: function Word64_shiftLeft(places) {
  22063. if (places >= 32) {
  22064. this.high = this.low << places - 32;
  22065. this.low = 0;
  22066. } else {
  22067. this.high = this.high << places | this.low >>> 32 - places;
  22068. this.low = this.low << places;
  22069. }
  22070. },
  22071. rotateRight: function Word64_rotateRight(places) {
  22072. var low, high;
  22073. if (places & 32) {
  22074. high = this.low;
  22075. low = this.high;
  22076. } else {
  22077. low = this.low;
  22078. high = this.high;
  22079. }
  22080. places &= 31;
  22081. this.low = low >>> places | high << 32 - places;
  22082. this.high = high >>> places | low << 32 - places;
  22083. },
  22084. not: function Word64_not() {
  22085. this.high = ~this.high;
  22086. this.low = ~this.low;
  22087. },
  22088. add: function Word64_add(word) {
  22089. var lowAdd = (this.low >>> 0) + (word.low >>> 0);
  22090. var highAdd = (this.high >>> 0) + (word.high >>> 0);
  22091. if (lowAdd > 0xFFFFFFFF) {
  22092. highAdd += 1;
  22093. }
  22094. this.low = lowAdd | 0;
  22095. this.high = highAdd | 0;
  22096. },
  22097. copyTo: function Word64_copyTo(bytes, offset) {
  22098. bytes[offset] = this.high >>> 24 & 0xFF;
  22099. bytes[offset + 1] = this.high >> 16 & 0xFF;
  22100. bytes[offset + 2] = this.high >> 8 & 0xFF;
  22101. bytes[offset + 3] = this.high & 0xFF;
  22102. bytes[offset + 4] = this.low >>> 24 & 0xFF;
  22103. bytes[offset + 5] = this.low >> 16 & 0xFF;
  22104. bytes[offset + 6] = this.low >> 8 & 0xFF;
  22105. bytes[offset + 7] = this.low & 0xFF;
  22106. },
  22107. assign: function Word64_assign(word) {
  22108. this.high = word.high;
  22109. this.low = word.low;
  22110. }
  22111. };
  22112. return Word64;
  22113. }();
  22114. var calculateSHA256 = function calculateSHA256Closure() {
  22115. function rotr(x, n) {
  22116. return x >>> n | x << 32 - n;
  22117. }
  22118. function ch(x, y, z) {
  22119. return x & y ^ ~x & z;
  22120. }
  22121. function maj(x, y, z) {
  22122. return x & y ^ x & z ^ y & z;
  22123. }
  22124. function sigma(x) {
  22125. return rotr(x, 2) ^ rotr(x, 13) ^ rotr(x, 22);
  22126. }
  22127. function sigmaPrime(x) {
  22128. return rotr(x, 6) ^ rotr(x, 11) ^ rotr(x, 25);
  22129. }
  22130. function littleSigma(x) {
  22131. return rotr(x, 7) ^ rotr(x, 18) ^ x >>> 3;
  22132. }
  22133. function littleSigmaPrime(x) {
  22134. return rotr(x, 17) ^ rotr(x, 19) ^ x >>> 10;
  22135. }
  22136. var k = [
  22137. 0x428a2f98,
  22138. 0x71374491,
  22139. 0xb5c0fbcf,
  22140. 0xe9b5dba5,
  22141. 0x3956c25b,
  22142. 0x59f111f1,
  22143. 0x923f82a4,
  22144. 0xab1c5ed5,
  22145. 0xd807aa98,
  22146. 0x12835b01,
  22147. 0x243185be,
  22148. 0x550c7dc3,
  22149. 0x72be5d74,
  22150. 0x80deb1fe,
  22151. 0x9bdc06a7,
  22152. 0xc19bf174,
  22153. 0xe49b69c1,
  22154. 0xefbe4786,
  22155. 0x0fc19dc6,
  22156. 0x240ca1cc,
  22157. 0x2de92c6f,
  22158. 0x4a7484aa,
  22159. 0x5cb0a9dc,
  22160. 0x76f988da,
  22161. 0x983e5152,
  22162. 0xa831c66d,
  22163. 0xb00327c8,
  22164. 0xbf597fc7,
  22165. 0xc6e00bf3,
  22166. 0xd5a79147,
  22167. 0x06ca6351,
  22168. 0x14292967,
  22169. 0x27b70a85,
  22170. 0x2e1b2138,
  22171. 0x4d2c6dfc,
  22172. 0x53380d13,
  22173. 0x650a7354,
  22174. 0x766a0abb,
  22175. 0x81c2c92e,
  22176. 0x92722c85,
  22177. 0xa2bfe8a1,
  22178. 0xa81a664b,
  22179. 0xc24b8b70,
  22180. 0xc76c51a3,
  22181. 0xd192e819,
  22182. 0xd6990624,
  22183. 0xf40e3585,
  22184. 0x106aa070,
  22185. 0x19a4c116,
  22186. 0x1e376c08,
  22187. 0x2748774c,
  22188. 0x34b0bcb5,
  22189. 0x391c0cb3,
  22190. 0x4ed8aa4a,
  22191. 0x5b9cca4f,
  22192. 0x682e6ff3,
  22193. 0x748f82ee,
  22194. 0x78a5636f,
  22195. 0x84c87814,
  22196. 0x8cc70208,
  22197. 0x90befffa,
  22198. 0xa4506ceb,
  22199. 0xbef9a3f7,
  22200. 0xc67178f2
  22201. ];
  22202. function hash(data, offset, length) {
  22203. var h0 = 0x6a09e667, h1 = 0xbb67ae85, h2 = 0x3c6ef372, h3 = 0xa54ff53a, h4 = 0x510e527f, h5 = 0x9b05688c, h6 = 0x1f83d9ab, h7 = 0x5be0cd19;
  22204. var paddedLength = Math.ceil((length + 9) / 64) * 64;
  22205. var padded = new Uint8Array(paddedLength);
  22206. var i, j, n;
  22207. for (i = 0; i < length; ++i) {
  22208. padded[i] = data[offset++];
  22209. }
  22210. padded[i++] = 0x80;
  22211. n = paddedLength - 8;
  22212. while (i < n) {
  22213. padded[i++] = 0;
  22214. }
  22215. padded[i++] = 0;
  22216. padded[i++] = 0;
  22217. padded[i++] = 0;
  22218. padded[i++] = length >>> 29 & 0xFF;
  22219. padded[i++] = length >> 21 & 0xFF;
  22220. padded[i++] = length >> 13 & 0xFF;
  22221. padded[i++] = length >> 5 & 0xFF;
  22222. padded[i++] = length << 3 & 0xFF;
  22223. var w = new Uint32Array(64);
  22224. for (i = 0; i < paddedLength;) {
  22225. for (j = 0; j < 16; ++j) {
  22226. w[j] = padded[i] << 24 | padded[i + 1] << 16 | padded[i + 2] << 8 | padded[i + 3];
  22227. i += 4;
  22228. }
  22229. for (j = 16; j < 64; ++j) {
  22230. w[j] = littleSigmaPrime(w[j - 2]) + w[j - 7] + littleSigma(w[j - 15]) + w[j - 16] | 0;
  22231. }
  22232. var a = h0, b = h1, c = h2, d = h3, e = h4, f = h5, g = h6, h = h7, t1, t2;
  22233. for (j = 0; j < 64; ++j) {
  22234. t1 = h + sigmaPrime(e) + ch(e, f, g) + k[j] + w[j];
  22235. t2 = sigma(a) + maj(a, b, c);
  22236. h = g;
  22237. g = f;
  22238. f = e;
  22239. e = d + t1 | 0;
  22240. d = c;
  22241. c = b;
  22242. b = a;
  22243. a = t1 + t2 | 0;
  22244. }
  22245. h0 = h0 + a | 0;
  22246. h1 = h1 + b | 0;
  22247. h2 = h2 + c | 0;
  22248. h3 = h3 + d | 0;
  22249. h4 = h4 + e | 0;
  22250. h5 = h5 + f | 0;
  22251. h6 = h6 + g | 0;
  22252. h7 = h7 + h | 0;
  22253. }
  22254. return new Uint8Array([
  22255. h0 >> 24 & 0xFF,
  22256. h0 >> 16 & 0xFF,
  22257. h0 >> 8 & 0xFF,
  22258. h0 & 0xFF,
  22259. h1 >> 24 & 0xFF,
  22260. h1 >> 16 & 0xFF,
  22261. h1 >> 8 & 0xFF,
  22262. h1 & 0xFF,
  22263. h2 >> 24 & 0xFF,
  22264. h2 >> 16 & 0xFF,
  22265. h2 >> 8 & 0xFF,
  22266. h2 & 0xFF,
  22267. h3 >> 24 & 0xFF,
  22268. h3 >> 16 & 0xFF,
  22269. h3 >> 8 & 0xFF,
  22270. h3 & 0xFF,
  22271. h4 >> 24 & 0xFF,
  22272. h4 >> 16 & 0xFF,
  22273. h4 >> 8 & 0xFF,
  22274. h4 & 0xFF,
  22275. h5 >> 24 & 0xFF,
  22276. h5 >> 16 & 0xFF,
  22277. h5 >> 8 & 0xFF,
  22278. h5 & 0xFF,
  22279. h6 >> 24 & 0xFF,
  22280. h6 >> 16 & 0xFF,
  22281. h6 >> 8 & 0xFF,
  22282. h6 & 0xFF,
  22283. h7 >> 24 & 0xFF,
  22284. h7 >> 16 & 0xFF,
  22285. h7 >> 8 & 0xFF,
  22286. h7 & 0xFF
  22287. ]);
  22288. }
  22289. return hash;
  22290. }();
  22291. var calculateSHA512 = function calculateSHA512Closure() {
  22292. function ch(result, x, y, z, tmp) {
  22293. result.assign(x);
  22294. result.and(y);
  22295. tmp.assign(x);
  22296. tmp.not();
  22297. tmp.and(z);
  22298. result.xor(tmp);
  22299. }
  22300. function maj(result, x, y, z, tmp) {
  22301. result.assign(x);
  22302. result.and(y);
  22303. tmp.assign(x);
  22304. tmp.and(z);
  22305. result.xor(tmp);
  22306. tmp.assign(y);
  22307. tmp.and(z);
  22308. result.xor(tmp);
  22309. }
  22310. function sigma(result, x, tmp) {
  22311. result.assign(x);
  22312. result.rotateRight(28);
  22313. tmp.assign(x);
  22314. tmp.rotateRight(34);
  22315. result.xor(tmp);
  22316. tmp.assign(x);
  22317. tmp.rotateRight(39);
  22318. result.xor(tmp);
  22319. }
  22320. function sigmaPrime(result, x, tmp) {
  22321. result.assign(x);
  22322. result.rotateRight(14);
  22323. tmp.assign(x);
  22324. tmp.rotateRight(18);
  22325. result.xor(tmp);
  22326. tmp.assign(x);
  22327. tmp.rotateRight(41);
  22328. result.xor(tmp);
  22329. }
  22330. function littleSigma(result, x, tmp) {
  22331. result.assign(x);
  22332. result.rotateRight(1);
  22333. tmp.assign(x);
  22334. tmp.rotateRight(8);
  22335. result.xor(tmp);
  22336. tmp.assign(x);
  22337. tmp.shiftRight(7);
  22338. result.xor(tmp);
  22339. }
  22340. function littleSigmaPrime(result, x, tmp) {
  22341. result.assign(x);
  22342. result.rotateRight(19);
  22343. tmp.assign(x);
  22344. tmp.rotateRight(61);
  22345. result.xor(tmp);
  22346. tmp.assign(x);
  22347. tmp.shiftRight(6);
  22348. result.xor(tmp);
  22349. }
  22350. var k = [
  22351. new Word64(0x428a2f98, 0xd728ae22),
  22352. new Word64(0x71374491, 0x23ef65cd),
  22353. new Word64(0xb5c0fbcf, 0xec4d3b2f),
  22354. new Word64(0xe9b5dba5, 0x8189dbbc),
  22355. new Word64(0x3956c25b, 0xf348b538),
  22356. new Word64(0x59f111f1, 0xb605d019),
  22357. new Word64(0x923f82a4, 0xaf194f9b),
  22358. new Word64(0xab1c5ed5, 0xda6d8118),
  22359. new Word64(0xd807aa98, 0xa3030242),
  22360. new Word64(0x12835b01, 0x45706fbe),
  22361. new Word64(0x243185be, 0x4ee4b28c),
  22362. new Word64(0x550c7dc3, 0xd5ffb4e2),
  22363. new Word64(0x72be5d74, 0xf27b896f),
  22364. new Word64(0x80deb1fe, 0x3b1696b1),
  22365. new Word64(0x9bdc06a7, 0x25c71235),
  22366. new Word64(0xc19bf174, 0xcf692694),
  22367. new Word64(0xe49b69c1, 0x9ef14ad2),
  22368. new Word64(0xefbe4786, 0x384f25e3),
  22369. new Word64(0x0fc19dc6, 0x8b8cd5b5),
  22370. new Word64(0x240ca1cc, 0x77ac9c65),
  22371. new Word64(0x2de92c6f, 0x592b0275),
  22372. new Word64(0x4a7484aa, 0x6ea6e483),
  22373. new Word64(0x5cb0a9dc, 0xbd41fbd4),
  22374. new Word64(0x76f988da, 0x831153b5),
  22375. new Word64(0x983e5152, 0xee66dfab),
  22376. new Word64(0xa831c66d, 0x2db43210),
  22377. new Word64(0xb00327c8, 0x98fb213f),
  22378. new Word64(0xbf597fc7, 0xbeef0ee4),
  22379. new Word64(0xc6e00bf3, 0x3da88fc2),
  22380. new Word64(0xd5a79147, 0x930aa725),
  22381. new Word64(0x06ca6351, 0xe003826f),
  22382. new Word64(0x14292967, 0x0a0e6e70),
  22383. new Word64(0x27b70a85, 0x46d22ffc),
  22384. new Word64(0x2e1b2138, 0x5c26c926),
  22385. new Word64(0x4d2c6dfc, 0x5ac42aed),
  22386. new Word64(0x53380d13, 0x9d95b3df),
  22387. new Word64(0x650a7354, 0x8baf63de),
  22388. new Word64(0x766a0abb, 0x3c77b2a8),
  22389. new Word64(0x81c2c92e, 0x47edaee6),
  22390. new Word64(0x92722c85, 0x1482353b),
  22391. new Word64(0xa2bfe8a1, 0x4cf10364),
  22392. new Word64(0xa81a664b, 0xbc423001),
  22393. new Word64(0xc24b8b70, 0xd0f89791),
  22394. new Word64(0xc76c51a3, 0x0654be30),
  22395. new Word64(0xd192e819, 0xd6ef5218),
  22396. new Word64(0xd6990624, 0x5565a910),
  22397. new Word64(0xf40e3585, 0x5771202a),
  22398. new Word64(0x106aa070, 0x32bbd1b8),
  22399. new Word64(0x19a4c116, 0xb8d2d0c8),
  22400. new Word64(0x1e376c08, 0x5141ab53),
  22401. new Word64(0x2748774c, 0xdf8eeb99),
  22402. new Word64(0x34b0bcb5, 0xe19b48a8),
  22403. new Word64(0x391c0cb3, 0xc5c95a63),
  22404. new Word64(0x4ed8aa4a, 0xe3418acb),
  22405. new Word64(0x5b9cca4f, 0x7763e373),
  22406. new Word64(0x682e6ff3, 0xd6b2b8a3),
  22407. new Word64(0x748f82ee, 0x5defb2fc),
  22408. new Word64(0x78a5636f, 0x43172f60),
  22409. new Word64(0x84c87814, 0xa1f0ab72),
  22410. new Word64(0x8cc70208, 0x1a6439ec),
  22411. new Word64(0x90befffa, 0x23631e28),
  22412. new Word64(0xa4506ceb, 0xde82bde9),
  22413. new Word64(0xbef9a3f7, 0xb2c67915),
  22414. new Word64(0xc67178f2, 0xe372532b),
  22415. new Word64(0xca273ece, 0xea26619c),
  22416. new Word64(0xd186b8c7, 0x21c0c207),
  22417. new Word64(0xeada7dd6, 0xcde0eb1e),
  22418. new Word64(0xf57d4f7f, 0xee6ed178),
  22419. new Word64(0x06f067aa, 0x72176fba),
  22420. new Word64(0x0a637dc5, 0xa2c898a6),
  22421. new Word64(0x113f9804, 0xbef90dae),
  22422. new Word64(0x1b710b35, 0x131c471b),
  22423. new Word64(0x28db77f5, 0x23047d84),
  22424. new Word64(0x32caab7b, 0x40c72493),
  22425. new Word64(0x3c9ebe0a, 0x15c9bebc),
  22426. new Word64(0x431d67c4, 0x9c100d4c),
  22427. new Word64(0x4cc5d4be, 0xcb3e42b6),
  22428. new Word64(0x597f299c, 0xfc657e2a),
  22429. new Word64(0x5fcb6fab, 0x3ad6faec),
  22430. new Word64(0x6c44198c, 0x4a475817)
  22431. ];
  22432. function hash(data, offset, length, mode384) {
  22433. mode384 = !!mode384;
  22434. var h0, h1, h2, h3, h4, h5, h6, h7;
  22435. if (!mode384) {
  22436. h0 = new Word64(0x6a09e667, 0xf3bcc908);
  22437. h1 = new Word64(0xbb67ae85, 0x84caa73b);
  22438. h2 = new Word64(0x3c6ef372, 0xfe94f82b);
  22439. h3 = new Word64(0xa54ff53a, 0x5f1d36f1);
  22440. h4 = new Word64(0x510e527f, 0xade682d1);
  22441. h5 = new Word64(0x9b05688c, 0x2b3e6c1f);
  22442. h6 = new Word64(0x1f83d9ab, 0xfb41bd6b);
  22443. h7 = new Word64(0x5be0cd19, 0x137e2179);
  22444. } else {
  22445. h0 = new Word64(0xcbbb9d5d, 0xc1059ed8);
  22446. h1 = new Word64(0x629a292a, 0x367cd507);
  22447. h2 = new Word64(0x9159015a, 0x3070dd17);
  22448. h3 = new Word64(0x152fecd8, 0xf70e5939);
  22449. h4 = new Word64(0x67332667, 0xffc00b31);
  22450. h5 = new Word64(0x8eb44a87, 0x68581511);
  22451. h6 = new Word64(0xdb0c2e0d, 0x64f98fa7);
  22452. h7 = new Word64(0x47b5481d, 0xbefa4fa4);
  22453. }
  22454. var paddedLength = Math.ceil((length + 17) / 128) * 128;
  22455. var padded = new Uint8Array(paddedLength);
  22456. var i, j, n;
  22457. for (i = 0; i < length; ++i) {
  22458. padded[i] = data[offset++];
  22459. }
  22460. padded[i++] = 0x80;
  22461. n = paddedLength - 16;
  22462. while (i < n) {
  22463. padded[i++] = 0;
  22464. }
  22465. padded[i++] = 0;
  22466. padded[i++] = 0;
  22467. padded[i++] = 0;
  22468. padded[i++] = 0;
  22469. padded[i++] = 0;
  22470. padded[i++] = 0;
  22471. padded[i++] = 0;
  22472. padded[i++] = 0;
  22473. padded[i++] = 0;
  22474. padded[i++] = 0;
  22475. padded[i++] = 0;
  22476. padded[i++] = length >>> 29 & 0xFF;
  22477. padded[i++] = length >> 21 & 0xFF;
  22478. padded[i++] = length >> 13 & 0xFF;
  22479. padded[i++] = length >> 5 & 0xFF;
  22480. padded[i++] = length << 3 & 0xFF;
  22481. var w = new Array(80);
  22482. for (i = 0; i < 80; i++) {
  22483. w[i] = new Word64(0, 0);
  22484. }
  22485. var a = new Word64(0, 0), b = new Word64(0, 0), c = new Word64(0, 0);
  22486. var d = new Word64(0, 0), e = new Word64(0, 0), f = new Word64(0, 0);
  22487. var g = new Word64(0, 0), h = new Word64(0, 0);
  22488. var t1 = new Word64(0, 0), t2 = new Word64(0, 0);
  22489. var tmp1 = new Word64(0, 0), tmp2 = new Word64(0, 0), tmp3;
  22490. for (i = 0; i < paddedLength;) {
  22491. for (j = 0; j < 16; ++j) {
  22492. w[j].high = padded[i] << 24 | padded[i + 1] << 16 | padded[i + 2] << 8 | padded[i + 3];
  22493. w[j].low = padded[i + 4] << 24 | padded[i + 5] << 16 | padded[i + 6] << 8 | padded[i + 7];
  22494. i += 8;
  22495. }
  22496. for (j = 16; j < 80; ++j) {
  22497. tmp3 = w[j];
  22498. littleSigmaPrime(tmp3, w[j - 2], tmp2);
  22499. tmp3.add(w[j - 7]);
  22500. littleSigma(tmp1, w[j - 15], tmp2);
  22501. tmp3.add(tmp1);
  22502. tmp3.add(w[j - 16]);
  22503. }
  22504. a.assign(h0);
  22505. b.assign(h1);
  22506. c.assign(h2);
  22507. d.assign(h3);
  22508. e.assign(h4);
  22509. f.assign(h5);
  22510. g.assign(h6);
  22511. h.assign(h7);
  22512. for (j = 0; j < 80; ++j) {
  22513. t1.assign(h);
  22514. sigmaPrime(tmp1, e, tmp2);
  22515. t1.add(tmp1);
  22516. ch(tmp1, e, f, g, tmp2);
  22517. t1.add(tmp1);
  22518. t1.add(k[j]);
  22519. t1.add(w[j]);
  22520. sigma(t2, a, tmp2);
  22521. maj(tmp1, a, b, c, tmp2);
  22522. t2.add(tmp1);
  22523. tmp3 = h;
  22524. h = g;
  22525. g = f;
  22526. f = e;
  22527. d.add(t1);
  22528. e = d;
  22529. d = c;
  22530. c = b;
  22531. b = a;
  22532. tmp3.assign(t1);
  22533. tmp3.add(t2);
  22534. a = tmp3;
  22535. }
  22536. h0.add(a);
  22537. h1.add(b);
  22538. h2.add(c);
  22539. h3.add(d);
  22540. h4.add(e);
  22541. h5.add(f);
  22542. h6.add(g);
  22543. h7.add(h);
  22544. }
  22545. var result;
  22546. if (!mode384) {
  22547. result = new Uint8Array(64);
  22548. h0.copyTo(result, 0);
  22549. h1.copyTo(result, 8);
  22550. h2.copyTo(result, 16);
  22551. h3.copyTo(result, 24);
  22552. h4.copyTo(result, 32);
  22553. h5.copyTo(result, 40);
  22554. h6.copyTo(result, 48);
  22555. h7.copyTo(result, 56);
  22556. } else {
  22557. result = new Uint8Array(48);
  22558. h0.copyTo(result, 0);
  22559. h1.copyTo(result, 8);
  22560. h2.copyTo(result, 16);
  22561. h3.copyTo(result, 24);
  22562. h4.copyTo(result, 32);
  22563. h5.copyTo(result, 40);
  22564. }
  22565. return result;
  22566. }
  22567. return hash;
  22568. }();
  22569. var calculateSHA384 = function calculateSHA384Closure() {
  22570. function hash(data, offset, length) {
  22571. return calculateSHA512(data, offset, length, true);
  22572. }
  22573. return hash;
  22574. }();
  22575. var NullCipher = function NullCipherClosure() {
  22576. function NullCipher() {
  22577. }
  22578. NullCipher.prototype = {
  22579. decryptBlock: function NullCipher_decryptBlock(data) {
  22580. return data;
  22581. }
  22582. };
  22583. return NullCipher;
  22584. }();
  22585. var AES128Cipher = function AES128CipherClosure() {
  22586. var rcon = new Uint8Array([
  22587. 0x8d,
  22588. 0x01,
  22589. 0x02,
  22590. 0x04,
  22591. 0x08,
  22592. 0x10,
  22593. 0x20,
  22594. 0x40,
  22595. 0x80,
  22596. 0x1b,
  22597. 0x36,
  22598. 0x6c,
  22599. 0xd8,
  22600. 0xab,
  22601. 0x4d,
  22602. 0x9a,
  22603. 0x2f,
  22604. 0x5e,
  22605. 0xbc,
  22606. 0x63,
  22607. 0xc6,
  22608. 0x97,
  22609. 0x35,
  22610. 0x6a,
  22611. 0xd4,
  22612. 0xb3,
  22613. 0x7d,
  22614. 0xfa,
  22615. 0xef,
  22616. 0xc5,
  22617. 0x91,
  22618. 0x39,
  22619. 0x72,
  22620. 0xe4,
  22621. 0xd3,
  22622. 0xbd,
  22623. 0x61,
  22624. 0xc2,
  22625. 0x9f,
  22626. 0x25,
  22627. 0x4a,
  22628. 0x94,
  22629. 0x33,
  22630. 0x66,
  22631. 0xcc,
  22632. 0x83,
  22633. 0x1d,
  22634. 0x3a,
  22635. 0x74,
  22636. 0xe8,
  22637. 0xcb,
  22638. 0x8d,
  22639. 0x01,
  22640. 0x02,
  22641. 0x04,
  22642. 0x08,
  22643. 0x10,
  22644. 0x20,
  22645. 0x40,
  22646. 0x80,
  22647. 0x1b,
  22648. 0x36,
  22649. 0x6c,
  22650. 0xd8,
  22651. 0xab,
  22652. 0x4d,
  22653. 0x9a,
  22654. 0x2f,
  22655. 0x5e,
  22656. 0xbc,
  22657. 0x63,
  22658. 0xc6,
  22659. 0x97,
  22660. 0x35,
  22661. 0x6a,
  22662. 0xd4,
  22663. 0xb3,
  22664. 0x7d,
  22665. 0xfa,
  22666. 0xef,
  22667. 0xc5,
  22668. 0x91,
  22669. 0x39,
  22670. 0x72,
  22671. 0xe4,
  22672. 0xd3,
  22673. 0xbd,
  22674. 0x61,
  22675. 0xc2,
  22676. 0x9f,
  22677. 0x25,
  22678. 0x4a,
  22679. 0x94,
  22680. 0x33,
  22681. 0x66,
  22682. 0xcc,
  22683. 0x83,
  22684. 0x1d,
  22685. 0x3a,
  22686. 0x74,
  22687. 0xe8,
  22688. 0xcb,
  22689. 0x8d,
  22690. 0x01,
  22691. 0x02,
  22692. 0x04,
  22693. 0x08,
  22694. 0x10,
  22695. 0x20,
  22696. 0x40,
  22697. 0x80,
  22698. 0x1b,
  22699. 0x36,
  22700. 0x6c,
  22701. 0xd8,
  22702. 0xab,
  22703. 0x4d,
  22704. 0x9a,
  22705. 0x2f,
  22706. 0x5e,
  22707. 0xbc,
  22708. 0x63,
  22709. 0xc6,
  22710. 0x97,
  22711. 0x35,
  22712. 0x6a,
  22713. 0xd4,
  22714. 0xb3,
  22715. 0x7d,
  22716. 0xfa,
  22717. 0xef,
  22718. 0xc5,
  22719. 0x91,
  22720. 0x39,
  22721. 0x72,
  22722. 0xe4,
  22723. 0xd3,
  22724. 0xbd,
  22725. 0x61,
  22726. 0xc2,
  22727. 0x9f,
  22728. 0x25,
  22729. 0x4a,
  22730. 0x94,
  22731. 0x33,
  22732. 0x66,
  22733. 0xcc,
  22734. 0x83,
  22735. 0x1d,
  22736. 0x3a,
  22737. 0x74,
  22738. 0xe8,
  22739. 0xcb,
  22740. 0x8d,
  22741. 0x01,
  22742. 0x02,
  22743. 0x04,
  22744. 0x08,
  22745. 0x10,
  22746. 0x20,
  22747. 0x40,
  22748. 0x80,
  22749. 0x1b,
  22750. 0x36,
  22751. 0x6c,
  22752. 0xd8,
  22753. 0xab,
  22754. 0x4d,
  22755. 0x9a,
  22756. 0x2f,
  22757. 0x5e,
  22758. 0xbc,
  22759. 0x63,
  22760. 0xc6,
  22761. 0x97,
  22762. 0x35,
  22763. 0x6a,
  22764. 0xd4,
  22765. 0xb3,
  22766. 0x7d,
  22767. 0xfa,
  22768. 0xef,
  22769. 0xc5,
  22770. 0x91,
  22771. 0x39,
  22772. 0x72,
  22773. 0xe4,
  22774. 0xd3,
  22775. 0xbd,
  22776. 0x61,
  22777. 0xc2,
  22778. 0x9f,
  22779. 0x25,
  22780. 0x4a,
  22781. 0x94,
  22782. 0x33,
  22783. 0x66,
  22784. 0xcc,
  22785. 0x83,
  22786. 0x1d,
  22787. 0x3a,
  22788. 0x74,
  22789. 0xe8,
  22790. 0xcb,
  22791. 0x8d,
  22792. 0x01,
  22793. 0x02,
  22794. 0x04,
  22795. 0x08,
  22796. 0x10,
  22797. 0x20,
  22798. 0x40,
  22799. 0x80,
  22800. 0x1b,
  22801. 0x36,
  22802. 0x6c,
  22803. 0xd8,
  22804. 0xab,
  22805. 0x4d,
  22806. 0x9a,
  22807. 0x2f,
  22808. 0x5e,
  22809. 0xbc,
  22810. 0x63,
  22811. 0xc6,
  22812. 0x97,
  22813. 0x35,
  22814. 0x6a,
  22815. 0xd4,
  22816. 0xb3,
  22817. 0x7d,
  22818. 0xfa,
  22819. 0xef,
  22820. 0xc5,
  22821. 0x91,
  22822. 0x39,
  22823. 0x72,
  22824. 0xe4,
  22825. 0xd3,
  22826. 0xbd,
  22827. 0x61,
  22828. 0xc2,
  22829. 0x9f,
  22830. 0x25,
  22831. 0x4a,
  22832. 0x94,
  22833. 0x33,
  22834. 0x66,
  22835. 0xcc,
  22836. 0x83,
  22837. 0x1d,
  22838. 0x3a,
  22839. 0x74,
  22840. 0xe8,
  22841. 0xcb,
  22842. 0x8d
  22843. ]);
  22844. var s = new Uint8Array([
  22845. 0x63,
  22846. 0x7c,
  22847. 0x77,
  22848. 0x7b,
  22849. 0xf2,
  22850. 0x6b,
  22851. 0x6f,
  22852. 0xc5,
  22853. 0x30,
  22854. 0x01,
  22855. 0x67,
  22856. 0x2b,
  22857. 0xfe,
  22858. 0xd7,
  22859. 0xab,
  22860. 0x76,
  22861. 0xca,
  22862. 0x82,
  22863. 0xc9,
  22864. 0x7d,
  22865. 0xfa,
  22866. 0x59,
  22867. 0x47,
  22868. 0xf0,
  22869. 0xad,
  22870. 0xd4,
  22871. 0xa2,
  22872. 0xaf,
  22873. 0x9c,
  22874. 0xa4,
  22875. 0x72,
  22876. 0xc0,
  22877. 0xb7,
  22878. 0xfd,
  22879. 0x93,
  22880. 0x26,
  22881. 0x36,
  22882. 0x3f,
  22883. 0xf7,
  22884. 0xcc,
  22885. 0x34,
  22886. 0xa5,
  22887. 0xe5,
  22888. 0xf1,
  22889. 0x71,
  22890. 0xd8,
  22891. 0x31,
  22892. 0x15,
  22893. 0x04,
  22894. 0xc7,
  22895. 0x23,
  22896. 0xc3,
  22897. 0x18,
  22898. 0x96,
  22899. 0x05,
  22900. 0x9a,
  22901. 0x07,
  22902. 0x12,
  22903. 0x80,
  22904. 0xe2,
  22905. 0xeb,
  22906. 0x27,
  22907. 0xb2,
  22908. 0x75,
  22909. 0x09,
  22910. 0x83,
  22911. 0x2c,
  22912. 0x1a,
  22913. 0x1b,
  22914. 0x6e,
  22915. 0x5a,
  22916. 0xa0,
  22917. 0x52,
  22918. 0x3b,
  22919. 0xd6,
  22920. 0xb3,
  22921. 0x29,
  22922. 0xe3,
  22923. 0x2f,
  22924. 0x84,
  22925. 0x53,
  22926. 0xd1,
  22927. 0x00,
  22928. 0xed,
  22929. 0x20,
  22930. 0xfc,
  22931. 0xb1,
  22932. 0x5b,
  22933. 0x6a,
  22934. 0xcb,
  22935. 0xbe,
  22936. 0x39,
  22937. 0x4a,
  22938. 0x4c,
  22939. 0x58,
  22940. 0xcf,
  22941. 0xd0,
  22942. 0xef,
  22943. 0xaa,
  22944. 0xfb,
  22945. 0x43,
  22946. 0x4d,
  22947. 0x33,
  22948. 0x85,
  22949. 0x45,
  22950. 0xf9,
  22951. 0x02,
  22952. 0x7f,
  22953. 0x50,
  22954. 0x3c,
  22955. 0x9f,
  22956. 0xa8,
  22957. 0x51,
  22958. 0xa3,
  22959. 0x40,
  22960. 0x8f,
  22961. 0x92,
  22962. 0x9d,
  22963. 0x38,
  22964. 0xf5,
  22965. 0xbc,
  22966. 0xb6,
  22967. 0xda,
  22968. 0x21,
  22969. 0x10,
  22970. 0xff,
  22971. 0xf3,
  22972. 0xd2,
  22973. 0xcd,
  22974. 0x0c,
  22975. 0x13,
  22976. 0xec,
  22977. 0x5f,
  22978. 0x97,
  22979. 0x44,
  22980. 0x17,
  22981. 0xc4,
  22982. 0xa7,
  22983. 0x7e,
  22984. 0x3d,
  22985. 0x64,
  22986. 0x5d,
  22987. 0x19,
  22988. 0x73,
  22989. 0x60,
  22990. 0x81,
  22991. 0x4f,
  22992. 0xdc,
  22993. 0x22,
  22994. 0x2a,
  22995. 0x90,
  22996. 0x88,
  22997. 0x46,
  22998. 0xee,
  22999. 0xb8,
  23000. 0x14,
  23001. 0xde,
  23002. 0x5e,
  23003. 0x0b,
  23004. 0xdb,
  23005. 0xe0,
  23006. 0x32,
  23007. 0x3a,
  23008. 0x0a,
  23009. 0x49,
  23010. 0x06,
  23011. 0x24,
  23012. 0x5c,
  23013. 0xc2,
  23014. 0xd3,
  23015. 0xac,
  23016. 0x62,
  23017. 0x91,
  23018. 0x95,
  23019. 0xe4,
  23020. 0x79,
  23021. 0xe7,
  23022. 0xc8,
  23023. 0x37,
  23024. 0x6d,
  23025. 0x8d,
  23026. 0xd5,
  23027. 0x4e,
  23028. 0xa9,
  23029. 0x6c,
  23030. 0x56,
  23031. 0xf4,
  23032. 0xea,
  23033. 0x65,
  23034. 0x7a,
  23035. 0xae,
  23036. 0x08,
  23037. 0xba,
  23038. 0x78,
  23039. 0x25,
  23040. 0x2e,
  23041. 0x1c,
  23042. 0xa6,
  23043. 0xb4,
  23044. 0xc6,
  23045. 0xe8,
  23046. 0xdd,
  23047. 0x74,
  23048. 0x1f,
  23049. 0x4b,
  23050. 0xbd,
  23051. 0x8b,
  23052. 0x8a,
  23053. 0x70,
  23054. 0x3e,
  23055. 0xb5,
  23056. 0x66,
  23057. 0x48,
  23058. 0x03,
  23059. 0xf6,
  23060. 0x0e,
  23061. 0x61,
  23062. 0x35,
  23063. 0x57,
  23064. 0xb9,
  23065. 0x86,
  23066. 0xc1,
  23067. 0x1d,
  23068. 0x9e,
  23069. 0xe1,
  23070. 0xf8,
  23071. 0x98,
  23072. 0x11,
  23073. 0x69,
  23074. 0xd9,
  23075. 0x8e,
  23076. 0x94,
  23077. 0x9b,
  23078. 0x1e,
  23079. 0x87,
  23080. 0xe9,
  23081. 0xce,
  23082. 0x55,
  23083. 0x28,
  23084. 0xdf,
  23085. 0x8c,
  23086. 0xa1,
  23087. 0x89,
  23088. 0x0d,
  23089. 0xbf,
  23090. 0xe6,
  23091. 0x42,
  23092. 0x68,
  23093. 0x41,
  23094. 0x99,
  23095. 0x2d,
  23096. 0x0f,
  23097. 0xb0,
  23098. 0x54,
  23099. 0xbb,
  23100. 0x16
  23101. ]);
  23102. var inv_s = new Uint8Array([
  23103. 0x52,
  23104. 0x09,
  23105. 0x6a,
  23106. 0xd5,
  23107. 0x30,
  23108. 0x36,
  23109. 0xa5,
  23110. 0x38,
  23111. 0xbf,
  23112. 0x40,
  23113. 0xa3,
  23114. 0x9e,
  23115. 0x81,
  23116. 0xf3,
  23117. 0xd7,
  23118. 0xfb,
  23119. 0x7c,
  23120. 0xe3,
  23121. 0x39,
  23122. 0x82,
  23123. 0x9b,
  23124. 0x2f,
  23125. 0xff,
  23126. 0x87,
  23127. 0x34,
  23128. 0x8e,
  23129. 0x43,
  23130. 0x44,
  23131. 0xc4,
  23132. 0xde,
  23133. 0xe9,
  23134. 0xcb,
  23135. 0x54,
  23136. 0x7b,
  23137. 0x94,
  23138. 0x32,
  23139. 0xa6,
  23140. 0xc2,
  23141. 0x23,
  23142. 0x3d,
  23143. 0xee,
  23144. 0x4c,
  23145. 0x95,
  23146. 0x0b,
  23147. 0x42,
  23148. 0xfa,
  23149. 0xc3,
  23150. 0x4e,
  23151. 0x08,
  23152. 0x2e,
  23153. 0xa1,
  23154. 0x66,
  23155. 0x28,
  23156. 0xd9,
  23157. 0x24,
  23158. 0xb2,
  23159. 0x76,
  23160. 0x5b,
  23161. 0xa2,
  23162. 0x49,
  23163. 0x6d,
  23164. 0x8b,
  23165. 0xd1,
  23166. 0x25,
  23167. 0x72,
  23168. 0xf8,
  23169. 0xf6,
  23170. 0x64,
  23171. 0x86,
  23172. 0x68,
  23173. 0x98,
  23174. 0x16,
  23175. 0xd4,
  23176. 0xa4,
  23177. 0x5c,
  23178. 0xcc,
  23179. 0x5d,
  23180. 0x65,
  23181. 0xb6,
  23182. 0x92,
  23183. 0x6c,
  23184. 0x70,
  23185. 0x48,
  23186. 0x50,
  23187. 0xfd,
  23188. 0xed,
  23189. 0xb9,
  23190. 0xda,
  23191. 0x5e,
  23192. 0x15,
  23193. 0x46,
  23194. 0x57,
  23195. 0xa7,
  23196. 0x8d,
  23197. 0x9d,
  23198. 0x84,
  23199. 0x90,
  23200. 0xd8,
  23201. 0xab,
  23202. 0x00,
  23203. 0x8c,
  23204. 0xbc,
  23205. 0xd3,
  23206. 0x0a,
  23207. 0xf7,
  23208. 0xe4,
  23209. 0x58,
  23210. 0x05,
  23211. 0xb8,
  23212. 0xb3,
  23213. 0x45,
  23214. 0x06,
  23215. 0xd0,
  23216. 0x2c,
  23217. 0x1e,
  23218. 0x8f,
  23219. 0xca,
  23220. 0x3f,
  23221. 0x0f,
  23222. 0x02,
  23223. 0xc1,
  23224. 0xaf,
  23225. 0xbd,
  23226. 0x03,
  23227. 0x01,
  23228. 0x13,
  23229. 0x8a,
  23230. 0x6b,
  23231. 0x3a,
  23232. 0x91,
  23233. 0x11,
  23234. 0x41,
  23235. 0x4f,
  23236. 0x67,
  23237. 0xdc,
  23238. 0xea,
  23239. 0x97,
  23240. 0xf2,
  23241. 0xcf,
  23242. 0xce,
  23243. 0xf0,
  23244. 0xb4,
  23245. 0xe6,
  23246. 0x73,
  23247. 0x96,
  23248. 0xac,
  23249. 0x74,
  23250. 0x22,
  23251. 0xe7,
  23252. 0xad,
  23253. 0x35,
  23254. 0x85,
  23255. 0xe2,
  23256. 0xf9,
  23257. 0x37,
  23258. 0xe8,
  23259. 0x1c,
  23260. 0x75,
  23261. 0xdf,
  23262. 0x6e,
  23263. 0x47,
  23264. 0xf1,
  23265. 0x1a,
  23266. 0x71,
  23267. 0x1d,
  23268. 0x29,
  23269. 0xc5,
  23270. 0x89,
  23271. 0x6f,
  23272. 0xb7,
  23273. 0x62,
  23274. 0x0e,
  23275. 0xaa,
  23276. 0x18,
  23277. 0xbe,
  23278. 0x1b,
  23279. 0xfc,
  23280. 0x56,
  23281. 0x3e,
  23282. 0x4b,
  23283. 0xc6,
  23284. 0xd2,
  23285. 0x79,
  23286. 0x20,
  23287. 0x9a,
  23288. 0xdb,
  23289. 0xc0,
  23290. 0xfe,
  23291. 0x78,
  23292. 0xcd,
  23293. 0x5a,
  23294. 0xf4,
  23295. 0x1f,
  23296. 0xdd,
  23297. 0xa8,
  23298. 0x33,
  23299. 0x88,
  23300. 0x07,
  23301. 0xc7,
  23302. 0x31,
  23303. 0xb1,
  23304. 0x12,
  23305. 0x10,
  23306. 0x59,
  23307. 0x27,
  23308. 0x80,
  23309. 0xec,
  23310. 0x5f,
  23311. 0x60,
  23312. 0x51,
  23313. 0x7f,
  23314. 0xa9,
  23315. 0x19,
  23316. 0xb5,
  23317. 0x4a,
  23318. 0x0d,
  23319. 0x2d,
  23320. 0xe5,
  23321. 0x7a,
  23322. 0x9f,
  23323. 0x93,
  23324. 0xc9,
  23325. 0x9c,
  23326. 0xef,
  23327. 0xa0,
  23328. 0xe0,
  23329. 0x3b,
  23330. 0x4d,
  23331. 0xae,
  23332. 0x2a,
  23333. 0xf5,
  23334. 0xb0,
  23335. 0xc8,
  23336. 0xeb,
  23337. 0xbb,
  23338. 0x3c,
  23339. 0x83,
  23340. 0x53,
  23341. 0x99,
  23342. 0x61,
  23343. 0x17,
  23344. 0x2b,
  23345. 0x04,
  23346. 0x7e,
  23347. 0xba,
  23348. 0x77,
  23349. 0xd6,
  23350. 0x26,
  23351. 0xe1,
  23352. 0x69,
  23353. 0x14,
  23354. 0x63,
  23355. 0x55,
  23356. 0x21,
  23357. 0x0c,
  23358. 0x7d
  23359. ]);
  23360. var mixCol = new Uint8Array(256);
  23361. for (var i = 0; i < 256; i++) {
  23362. if (i < 128) {
  23363. mixCol[i] = i << 1;
  23364. } else {
  23365. mixCol[i] = i << 1 ^ 0x1b;
  23366. }
  23367. }
  23368. var mix = new Uint32Array([
  23369. 0x00000000,
  23370. 0x0e090d0b,
  23371. 0x1c121a16,
  23372. 0x121b171d,
  23373. 0x3824342c,
  23374. 0x362d3927,
  23375. 0x24362e3a,
  23376. 0x2a3f2331,
  23377. 0x70486858,
  23378. 0x7e416553,
  23379. 0x6c5a724e,
  23380. 0x62537f45,
  23381. 0x486c5c74,
  23382. 0x4665517f,
  23383. 0x547e4662,
  23384. 0x5a774b69,
  23385. 0xe090d0b0,
  23386. 0xee99ddbb,
  23387. 0xfc82caa6,
  23388. 0xf28bc7ad,
  23389. 0xd8b4e49c,
  23390. 0xd6bde997,
  23391. 0xc4a6fe8a,
  23392. 0xcaaff381,
  23393. 0x90d8b8e8,
  23394. 0x9ed1b5e3,
  23395. 0x8ccaa2fe,
  23396. 0x82c3aff5,
  23397. 0xa8fc8cc4,
  23398. 0xa6f581cf,
  23399. 0xb4ee96d2,
  23400. 0xbae79bd9,
  23401. 0xdb3bbb7b,
  23402. 0xd532b670,
  23403. 0xc729a16d,
  23404. 0xc920ac66,
  23405. 0xe31f8f57,
  23406. 0xed16825c,
  23407. 0xff0d9541,
  23408. 0xf104984a,
  23409. 0xab73d323,
  23410. 0xa57ade28,
  23411. 0xb761c935,
  23412. 0xb968c43e,
  23413. 0x9357e70f,
  23414. 0x9d5eea04,
  23415. 0x8f45fd19,
  23416. 0x814cf012,
  23417. 0x3bab6bcb,
  23418. 0x35a266c0,
  23419. 0x27b971dd,
  23420. 0x29b07cd6,
  23421. 0x038f5fe7,
  23422. 0x0d8652ec,
  23423. 0x1f9d45f1,
  23424. 0x119448fa,
  23425. 0x4be30393,
  23426. 0x45ea0e98,
  23427. 0x57f11985,
  23428. 0x59f8148e,
  23429. 0x73c737bf,
  23430. 0x7dce3ab4,
  23431. 0x6fd52da9,
  23432. 0x61dc20a2,
  23433. 0xad766df6,
  23434. 0xa37f60fd,
  23435. 0xb16477e0,
  23436. 0xbf6d7aeb,
  23437. 0x955259da,
  23438. 0x9b5b54d1,
  23439. 0x894043cc,
  23440. 0x87494ec7,
  23441. 0xdd3e05ae,
  23442. 0xd33708a5,
  23443. 0xc12c1fb8,
  23444. 0xcf2512b3,
  23445. 0xe51a3182,
  23446. 0xeb133c89,
  23447. 0xf9082b94,
  23448. 0xf701269f,
  23449. 0x4de6bd46,
  23450. 0x43efb04d,
  23451. 0x51f4a750,
  23452. 0x5ffdaa5b,
  23453. 0x75c2896a,
  23454. 0x7bcb8461,
  23455. 0x69d0937c,
  23456. 0x67d99e77,
  23457. 0x3daed51e,
  23458. 0x33a7d815,
  23459. 0x21bccf08,
  23460. 0x2fb5c203,
  23461. 0x058ae132,
  23462. 0x0b83ec39,
  23463. 0x1998fb24,
  23464. 0x1791f62f,
  23465. 0x764dd68d,
  23466. 0x7844db86,
  23467. 0x6a5fcc9b,
  23468. 0x6456c190,
  23469. 0x4e69e2a1,
  23470. 0x4060efaa,
  23471. 0x527bf8b7,
  23472. 0x5c72f5bc,
  23473. 0x0605bed5,
  23474. 0x080cb3de,
  23475. 0x1a17a4c3,
  23476. 0x141ea9c8,
  23477. 0x3e218af9,
  23478. 0x302887f2,
  23479. 0x223390ef,
  23480. 0x2c3a9de4,
  23481. 0x96dd063d,
  23482. 0x98d40b36,
  23483. 0x8acf1c2b,
  23484. 0x84c61120,
  23485. 0xaef93211,
  23486. 0xa0f03f1a,
  23487. 0xb2eb2807,
  23488. 0xbce2250c,
  23489. 0xe6956e65,
  23490. 0xe89c636e,
  23491. 0xfa877473,
  23492. 0xf48e7978,
  23493. 0xdeb15a49,
  23494. 0xd0b85742,
  23495. 0xc2a3405f,
  23496. 0xccaa4d54,
  23497. 0x41ecdaf7,
  23498. 0x4fe5d7fc,
  23499. 0x5dfec0e1,
  23500. 0x53f7cdea,
  23501. 0x79c8eedb,
  23502. 0x77c1e3d0,
  23503. 0x65daf4cd,
  23504. 0x6bd3f9c6,
  23505. 0x31a4b2af,
  23506. 0x3fadbfa4,
  23507. 0x2db6a8b9,
  23508. 0x23bfa5b2,
  23509. 0x09808683,
  23510. 0x07898b88,
  23511. 0x15929c95,
  23512. 0x1b9b919e,
  23513. 0xa17c0a47,
  23514. 0xaf75074c,
  23515. 0xbd6e1051,
  23516. 0xb3671d5a,
  23517. 0x99583e6b,
  23518. 0x97513360,
  23519. 0x854a247d,
  23520. 0x8b432976,
  23521. 0xd134621f,
  23522. 0xdf3d6f14,
  23523. 0xcd267809,
  23524. 0xc32f7502,
  23525. 0xe9105633,
  23526. 0xe7195b38,
  23527. 0xf5024c25,
  23528. 0xfb0b412e,
  23529. 0x9ad7618c,
  23530. 0x94de6c87,
  23531. 0x86c57b9a,
  23532. 0x88cc7691,
  23533. 0xa2f355a0,
  23534. 0xacfa58ab,
  23535. 0xbee14fb6,
  23536. 0xb0e842bd,
  23537. 0xea9f09d4,
  23538. 0xe49604df,
  23539. 0xf68d13c2,
  23540. 0xf8841ec9,
  23541. 0xd2bb3df8,
  23542. 0xdcb230f3,
  23543. 0xcea927ee,
  23544. 0xc0a02ae5,
  23545. 0x7a47b13c,
  23546. 0x744ebc37,
  23547. 0x6655ab2a,
  23548. 0x685ca621,
  23549. 0x42638510,
  23550. 0x4c6a881b,
  23551. 0x5e719f06,
  23552. 0x5078920d,
  23553. 0x0a0fd964,
  23554. 0x0406d46f,
  23555. 0x161dc372,
  23556. 0x1814ce79,
  23557. 0x322bed48,
  23558. 0x3c22e043,
  23559. 0x2e39f75e,
  23560. 0x2030fa55,
  23561. 0xec9ab701,
  23562. 0xe293ba0a,
  23563. 0xf088ad17,
  23564. 0xfe81a01c,
  23565. 0xd4be832d,
  23566. 0xdab78e26,
  23567. 0xc8ac993b,
  23568. 0xc6a59430,
  23569. 0x9cd2df59,
  23570. 0x92dbd252,
  23571. 0x80c0c54f,
  23572. 0x8ec9c844,
  23573. 0xa4f6eb75,
  23574. 0xaaffe67e,
  23575. 0xb8e4f163,
  23576. 0xb6edfc68,
  23577. 0x0c0a67b1,
  23578. 0x02036aba,
  23579. 0x10187da7,
  23580. 0x1e1170ac,
  23581. 0x342e539d,
  23582. 0x3a275e96,
  23583. 0x283c498b,
  23584. 0x26354480,
  23585. 0x7c420fe9,
  23586. 0x724b02e2,
  23587. 0x605015ff,
  23588. 0x6e5918f4,
  23589. 0x44663bc5,
  23590. 0x4a6f36ce,
  23591. 0x587421d3,
  23592. 0x567d2cd8,
  23593. 0x37a10c7a,
  23594. 0x39a80171,
  23595. 0x2bb3166c,
  23596. 0x25ba1b67,
  23597. 0x0f853856,
  23598. 0x018c355d,
  23599. 0x13972240,
  23600. 0x1d9e2f4b,
  23601. 0x47e96422,
  23602. 0x49e06929,
  23603. 0x5bfb7e34,
  23604. 0x55f2733f,
  23605. 0x7fcd500e,
  23606. 0x71c45d05,
  23607. 0x63df4a18,
  23608. 0x6dd64713,
  23609. 0xd731dcca,
  23610. 0xd938d1c1,
  23611. 0xcb23c6dc,
  23612. 0xc52acbd7,
  23613. 0xef15e8e6,
  23614. 0xe11ce5ed,
  23615. 0xf307f2f0,
  23616. 0xfd0efffb,
  23617. 0xa779b492,
  23618. 0xa970b999,
  23619. 0xbb6bae84,
  23620. 0xb562a38f,
  23621. 0x9f5d80be,
  23622. 0x91548db5,
  23623. 0x834f9aa8,
  23624. 0x8d4697a3
  23625. ]);
  23626. function expandKey128(cipherKey) {
  23627. var b = 176, result = new Uint8Array(b);
  23628. result.set(cipherKey);
  23629. for (var j = 16, i = 1; j < b; ++i) {
  23630. var t1 = result[j - 3], t2 = result[j - 2], t3 = result[j - 1], t4 = result[j - 4];
  23631. t1 = s[t1];
  23632. t2 = s[t2];
  23633. t3 = s[t3];
  23634. t4 = s[t4];
  23635. t1 = t1 ^ rcon[i];
  23636. for (var n = 0; n < 4; ++n) {
  23637. result[j] = t1 ^= result[j - 16];
  23638. j++;
  23639. result[j] = t2 ^= result[j - 16];
  23640. j++;
  23641. result[j] = t3 ^= result[j - 16];
  23642. j++;
  23643. result[j] = t4 ^= result[j - 16];
  23644. j++;
  23645. }
  23646. }
  23647. return result;
  23648. }
  23649. function decrypt128(input, key) {
  23650. var state = new Uint8Array(16);
  23651. state.set(input);
  23652. var i, j, k;
  23653. var t, u, v;
  23654. for (j = 0, k = 160; j < 16; ++j, ++k) {
  23655. state[j] ^= key[k];
  23656. }
  23657. for (i = 9; i >= 1; --i) {
  23658. t = state[13];
  23659. state[13] = state[9];
  23660. state[9] = state[5];
  23661. state[5] = state[1];
  23662. state[1] = t;
  23663. t = state[14];
  23664. u = state[10];
  23665. state[14] = state[6];
  23666. state[10] = state[2];
  23667. state[6] = t;
  23668. state[2] = u;
  23669. t = state[15];
  23670. u = state[11];
  23671. v = state[7];
  23672. state[15] = state[3];
  23673. state[11] = t;
  23674. state[7] = u;
  23675. state[3] = v;
  23676. for (j = 0; j < 16; ++j) {
  23677. state[j] = inv_s[state[j]];
  23678. }
  23679. for (j = 0, k = i * 16; j < 16; ++j, ++k) {
  23680. state[j] ^= key[k];
  23681. }
  23682. for (j = 0; j < 16; j += 4) {
  23683. var s0 = mix[state[j]], s1 = mix[state[j + 1]], s2 = mix[state[j + 2]], s3 = mix[state[j + 3]];
  23684. t = s0 ^ s1 >>> 8 ^ s1 << 24 ^ s2 >>> 16 ^ s2 << 16 ^ s3 >>> 24 ^ s3 << 8;
  23685. state[j] = t >>> 24 & 0xFF;
  23686. state[j + 1] = t >> 16 & 0xFF;
  23687. state[j + 2] = t >> 8 & 0xFF;
  23688. state[j + 3] = t & 0xFF;
  23689. }
  23690. }
  23691. t = state[13];
  23692. state[13] = state[9];
  23693. state[9] = state[5];
  23694. state[5] = state[1];
  23695. state[1] = t;
  23696. t = state[14];
  23697. u = state[10];
  23698. state[14] = state[6];
  23699. state[10] = state[2];
  23700. state[6] = t;
  23701. state[2] = u;
  23702. t = state[15];
  23703. u = state[11];
  23704. v = state[7];
  23705. state[15] = state[3];
  23706. state[11] = t;
  23707. state[7] = u;
  23708. state[3] = v;
  23709. for (j = 0; j < 16; ++j) {
  23710. state[j] = inv_s[state[j]];
  23711. state[j] ^= key[j];
  23712. }
  23713. return state;
  23714. }
  23715. function encrypt128(input, key) {
  23716. var t, u, v, k;
  23717. var state = new Uint8Array(16);
  23718. state.set(input);
  23719. for (j = 0; j < 16; ++j) {
  23720. state[j] ^= key[j];
  23721. }
  23722. for (i = 1; i < 10; i++) {
  23723. for (j = 0; j < 16; ++j) {
  23724. state[j] = s[state[j]];
  23725. }
  23726. v = state[1];
  23727. state[1] = state[5];
  23728. state[5] = state[9];
  23729. state[9] = state[13];
  23730. state[13] = v;
  23731. v = state[2];
  23732. u = state[6];
  23733. state[2] = state[10];
  23734. state[6] = state[14];
  23735. state[10] = v;
  23736. state[14] = u;
  23737. v = state[3];
  23738. u = state[7];
  23739. t = state[11];
  23740. state[3] = state[15];
  23741. state[7] = v;
  23742. state[11] = u;
  23743. state[15] = t;
  23744. for (var j = 0; j < 16; j += 4) {
  23745. var s0 = state[j + 0], s1 = state[j + 1];
  23746. var s2 = state[j + 2], s3 = state[j + 3];
  23747. t = s0 ^ s1 ^ s2 ^ s3;
  23748. state[j + 0] ^= t ^ mixCol[s0 ^ s1];
  23749. state[j + 1] ^= t ^ mixCol[s1 ^ s2];
  23750. state[j + 2] ^= t ^ mixCol[s2 ^ s3];
  23751. state[j + 3] ^= t ^ mixCol[s3 ^ s0];
  23752. }
  23753. for (j = 0, k = i * 16; j < 16; ++j, ++k) {
  23754. state[j] ^= key[k];
  23755. }
  23756. }
  23757. for (j = 0; j < 16; ++j) {
  23758. state[j] = s[state[j]];
  23759. }
  23760. v = state[1];
  23761. state[1] = state[5];
  23762. state[5] = state[9];
  23763. state[9] = state[13];
  23764. state[13] = v;
  23765. v = state[2];
  23766. u = state[6];
  23767. state[2] = state[10];
  23768. state[6] = state[14];
  23769. state[10] = v;
  23770. state[14] = u;
  23771. v = state[3];
  23772. u = state[7];
  23773. t = state[11];
  23774. state[3] = state[15];
  23775. state[7] = v;
  23776. state[11] = u;
  23777. state[15] = t;
  23778. for (j = 0, k = 160; j < 16; ++j, ++k) {
  23779. state[j] ^= key[k];
  23780. }
  23781. return state;
  23782. }
  23783. function AES128Cipher(key) {
  23784. this.key = expandKey128(key);
  23785. this.buffer = new Uint8Array(16);
  23786. this.bufferPosition = 0;
  23787. }
  23788. function decryptBlock2(data, finalize) {
  23789. var i, j, ii, sourceLength = data.length, buffer = this.buffer, bufferLength = this.bufferPosition, result = [], iv = this.iv;
  23790. for (i = 0; i < sourceLength; ++i) {
  23791. buffer[bufferLength] = data[i];
  23792. ++bufferLength;
  23793. if (bufferLength < 16) {
  23794. continue;
  23795. }
  23796. var plain = decrypt128(buffer, this.key);
  23797. for (j = 0; j < 16; ++j) {
  23798. plain[j] ^= iv[j];
  23799. }
  23800. iv = buffer;
  23801. result.push(plain);
  23802. buffer = new Uint8Array(16);
  23803. bufferLength = 0;
  23804. }
  23805. this.buffer = buffer;
  23806. this.bufferLength = bufferLength;
  23807. this.iv = iv;
  23808. if (result.length === 0) {
  23809. return new Uint8Array([]);
  23810. }
  23811. var outputLength = 16 * result.length;
  23812. if (finalize) {
  23813. var lastBlock = result[result.length - 1];
  23814. var psLen = lastBlock[15];
  23815. if (psLen <= 16) {
  23816. for (i = 15, ii = 16 - psLen; i >= ii; --i) {
  23817. if (lastBlock[i] !== psLen) {
  23818. psLen = 0;
  23819. break;
  23820. }
  23821. }
  23822. outputLength -= psLen;
  23823. result[result.length - 1] = lastBlock.subarray(0, 16 - psLen);
  23824. }
  23825. }
  23826. var output = new Uint8Array(outputLength);
  23827. for (i = 0, j = 0, ii = result.length; i < ii; ++i, j += 16) {
  23828. output.set(result[i], j);
  23829. }
  23830. return output;
  23831. }
  23832. AES128Cipher.prototype = {
  23833. decryptBlock: function AES128Cipher_decryptBlock(data, finalize) {
  23834. var i, sourceLength = data.length;
  23835. var buffer = this.buffer, bufferLength = this.bufferPosition;
  23836. for (i = 0; bufferLength < 16 && i < sourceLength; ++i, ++bufferLength) {
  23837. buffer[bufferLength] = data[i];
  23838. }
  23839. if (bufferLength < 16) {
  23840. this.bufferLength = bufferLength;
  23841. return new Uint8Array([]);
  23842. }
  23843. this.iv = buffer;
  23844. this.buffer = new Uint8Array(16);
  23845. this.bufferLength = 0;
  23846. this.decryptBlock = decryptBlock2;
  23847. return this.decryptBlock(data.subarray(16), finalize);
  23848. },
  23849. encrypt: function AES128Cipher_encrypt(data, iv) {
  23850. var i, j, ii, sourceLength = data.length, buffer = this.buffer, bufferLength = this.bufferPosition, result = [];
  23851. if (!iv) {
  23852. iv = new Uint8Array(16);
  23853. }
  23854. for (i = 0; i < sourceLength; ++i) {
  23855. buffer[bufferLength] = data[i];
  23856. ++bufferLength;
  23857. if (bufferLength < 16) {
  23858. continue;
  23859. }
  23860. for (j = 0; j < 16; ++j) {
  23861. buffer[j] ^= iv[j];
  23862. }
  23863. var cipher = encrypt128(buffer, this.key);
  23864. iv = cipher;
  23865. result.push(cipher);
  23866. buffer = new Uint8Array(16);
  23867. bufferLength = 0;
  23868. }
  23869. this.buffer = buffer;
  23870. this.bufferLength = bufferLength;
  23871. this.iv = iv;
  23872. if (result.length === 0) {
  23873. return new Uint8Array([]);
  23874. }
  23875. var outputLength = 16 * result.length;
  23876. var output = new Uint8Array(outputLength);
  23877. for (i = 0, j = 0, ii = result.length; i < ii; ++i, j += 16) {
  23878. output.set(result[i], j);
  23879. }
  23880. return output;
  23881. }
  23882. };
  23883. return AES128Cipher;
  23884. }();
  23885. var AES256Cipher = function AES256CipherClosure() {
  23886. var s = new Uint8Array([
  23887. 0x63,
  23888. 0x7c,
  23889. 0x77,
  23890. 0x7b,
  23891. 0xf2,
  23892. 0x6b,
  23893. 0x6f,
  23894. 0xc5,
  23895. 0x30,
  23896. 0x01,
  23897. 0x67,
  23898. 0x2b,
  23899. 0xfe,
  23900. 0xd7,
  23901. 0xab,
  23902. 0x76,
  23903. 0xca,
  23904. 0x82,
  23905. 0xc9,
  23906. 0x7d,
  23907. 0xfa,
  23908. 0x59,
  23909. 0x47,
  23910. 0xf0,
  23911. 0xad,
  23912. 0xd4,
  23913. 0xa2,
  23914. 0xaf,
  23915. 0x9c,
  23916. 0xa4,
  23917. 0x72,
  23918. 0xc0,
  23919. 0xb7,
  23920. 0xfd,
  23921. 0x93,
  23922. 0x26,
  23923. 0x36,
  23924. 0x3f,
  23925. 0xf7,
  23926. 0xcc,
  23927. 0x34,
  23928. 0xa5,
  23929. 0xe5,
  23930. 0xf1,
  23931. 0x71,
  23932. 0xd8,
  23933. 0x31,
  23934. 0x15,
  23935. 0x04,
  23936. 0xc7,
  23937. 0x23,
  23938. 0xc3,
  23939. 0x18,
  23940. 0x96,
  23941. 0x05,
  23942. 0x9a,
  23943. 0x07,
  23944. 0x12,
  23945. 0x80,
  23946. 0xe2,
  23947. 0xeb,
  23948. 0x27,
  23949. 0xb2,
  23950. 0x75,
  23951. 0x09,
  23952. 0x83,
  23953. 0x2c,
  23954. 0x1a,
  23955. 0x1b,
  23956. 0x6e,
  23957. 0x5a,
  23958. 0xa0,
  23959. 0x52,
  23960. 0x3b,
  23961. 0xd6,
  23962. 0xb3,
  23963. 0x29,
  23964. 0xe3,
  23965. 0x2f,
  23966. 0x84,
  23967. 0x53,
  23968. 0xd1,
  23969. 0x00,
  23970. 0xed,
  23971. 0x20,
  23972. 0xfc,
  23973. 0xb1,
  23974. 0x5b,
  23975. 0x6a,
  23976. 0xcb,
  23977. 0xbe,
  23978. 0x39,
  23979. 0x4a,
  23980. 0x4c,
  23981. 0x58,
  23982. 0xcf,
  23983. 0xd0,
  23984. 0xef,
  23985. 0xaa,
  23986. 0xfb,
  23987. 0x43,
  23988. 0x4d,
  23989. 0x33,
  23990. 0x85,
  23991. 0x45,
  23992. 0xf9,
  23993. 0x02,
  23994. 0x7f,
  23995. 0x50,
  23996. 0x3c,
  23997. 0x9f,
  23998. 0xa8,
  23999. 0x51,
  24000. 0xa3,
  24001. 0x40,
  24002. 0x8f,
  24003. 0x92,
  24004. 0x9d,
  24005. 0x38,
  24006. 0xf5,
  24007. 0xbc,
  24008. 0xb6,
  24009. 0xda,
  24010. 0x21,
  24011. 0x10,
  24012. 0xff,
  24013. 0xf3,
  24014. 0xd2,
  24015. 0xcd,
  24016. 0x0c,
  24017. 0x13,
  24018. 0xec,
  24019. 0x5f,
  24020. 0x97,
  24021. 0x44,
  24022. 0x17,
  24023. 0xc4,
  24024. 0xa7,
  24025. 0x7e,
  24026. 0x3d,
  24027. 0x64,
  24028. 0x5d,
  24029. 0x19,
  24030. 0x73,
  24031. 0x60,
  24032. 0x81,
  24033. 0x4f,
  24034. 0xdc,
  24035. 0x22,
  24036. 0x2a,
  24037. 0x90,
  24038. 0x88,
  24039. 0x46,
  24040. 0xee,
  24041. 0xb8,
  24042. 0x14,
  24043. 0xde,
  24044. 0x5e,
  24045. 0x0b,
  24046. 0xdb,
  24047. 0xe0,
  24048. 0x32,
  24049. 0x3a,
  24050. 0x0a,
  24051. 0x49,
  24052. 0x06,
  24053. 0x24,
  24054. 0x5c,
  24055. 0xc2,
  24056. 0xd3,
  24057. 0xac,
  24058. 0x62,
  24059. 0x91,
  24060. 0x95,
  24061. 0xe4,
  24062. 0x79,
  24063. 0xe7,
  24064. 0xc8,
  24065. 0x37,
  24066. 0x6d,
  24067. 0x8d,
  24068. 0xd5,
  24069. 0x4e,
  24070. 0xa9,
  24071. 0x6c,
  24072. 0x56,
  24073. 0xf4,
  24074. 0xea,
  24075. 0x65,
  24076. 0x7a,
  24077. 0xae,
  24078. 0x08,
  24079. 0xba,
  24080. 0x78,
  24081. 0x25,
  24082. 0x2e,
  24083. 0x1c,
  24084. 0xa6,
  24085. 0xb4,
  24086. 0xc6,
  24087. 0xe8,
  24088. 0xdd,
  24089. 0x74,
  24090. 0x1f,
  24091. 0x4b,
  24092. 0xbd,
  24093. 0x8b,
  24094. 0x8a,
  24095. 0x70,
  24096. 0x3e,
  24097. 0xb5,
  24098. 0x66,
  24099. 0x48,
  24100. 0x03,
  24101. 0xf6,
  24102. 0x0e,
  24103. 0x61,
  24104. 0x35,
  24105. 0x57,
  24106. 0xb9,
  24107. 0x86,
  24108. 0xc1,
  24109. 0x1d,
  24110. 0x9e,
  24111. 0xe1,
  24112. 0xf8,
  24113. 0x98,
  24114. 0x11,
  24115. 0x69,
  24116. 0xd9,
  24117. 0x8e,
  24118. 0x94,
  24119. 0x9b,
  24120. 0x1e,
  24121. 0x87,
  24122. 0xe9,
  24123. 0xce,
  24124. 0x55,
  24125. 0x28,
  24126. 0xdf,
  24127. 0x8c,
  24128. 0xa1,
  24129. 0x89,
  24130. 0x0d,
  24131. 0xbf,
  24132. 0xe6,
  24133. 0x42,
  24134. 0x68,
  24135. 0x41,
  24136. 0x99,
  24137. 0x2d,
  24138. 0x0f,
  24139. 0xb0,
  24140. 0x54,
  24141. 0xbb,
  24142. 0x16
  24143. ]);
  24144. var inv_s = new Uint8Array([
  24145. 0x52,
  24146. 0x09,
  24147. 0x6a,
  24148. 0xd5,
  24149. 0x30,
  24150. 0x36,
  24151. 0xa5,
  24152. 0x38,
  24153. 0xbf,
  24154. 0x40,
  24155. 0xa3,
  24156. 0x9e,
  24157. 0x81,
  24158. 0xf3,
  24159. 0xd7,
  24160. 0xfb,
  24161. 0x7c,
  24162. 0xe3,
  24163. 0x39,
  24164. 0x82,
  24165. 0x9b,
  24166. 0x2f,
  24167. 0xff,
  24168. 0x87,
  24169. 0x34,
  24170. 0x8e,
  24171. 0x43,
  24172. 0x44,
  24173. 0xc4,
  24174. 0xde,
  24175. 0xe9,
  24176. 0xcb,
  24177. 0x54,
  24178. 0x7b,
  24179. 0x94,
  24180. 0x32,
  24181. 0xa6,
  24182. 0xc2,
  24183. 0x23,
  24184. 0x3d,
  24185. 0xee,
  24186. 0x4c,
  24187. 0x95,
  24188. 0x0b,
  24189. 0x42,
  24190. 0xfa,
  24191. 0xc3,
  24192. 0x4e,
  24193. 0x08,
  24194. 0x2e,
  24195. 0xa1,
  24196. 0x66,
  24197. 0x28,
  24198. 0xd9,
  24199. 0x24,
  24200. 0xb2,
  24201. 0x76,
  24202. 0x5b,
  24203. 0xa2,
  24204. 0x49,
  24205. 0x6d,
  24206. 0x8b,
  24207. 0xd1,
  24208. 0x25,
  24209. 0x72,
  24210. 0xf8,
  24211. 0xf6,
  24212. 0x64,
  24213. 0x86,
  24214. 0x68,
  24215. 0x98,
  24216. 0x16,
  24217. 0xd4,
  24218. 0xa4,
  24219. 0x5c,
  24220. 0xcc,
  24221. 0x5d,
  24222. 0x65,
  24223. 0xb6,
  24224. 0x92,
  24225. 0x6c,
  24226. 0x70,
  24227. 0x48,
  24228. 0x50,
  24229. 0xfd,
  24230. 0xed,
  24231. 0xb9,
  24232. 0xda,
  24233. 0x5e,
  24234. 0x15,
  24235. 0x46,
  24236. 0x57,
  24237. 0xa7,
  24238. 0x8d,
  24239. 0x9d,
  24240. 0x84,
  24241. 0x90,
  24242. 0xd8,
  24243. 0xab,
  24244. 0x00,
  24245. 0x8c,
  24246. 0xbc,
  24247. 0xd3,
  24248. 0x0a,
  24249. 0xf7,
  24250. 0xe4,
  24251. 0x58,
  24252. 0x05,
  24253. 0xb8,
  24254. 0xb3,
  24255. 0x45,
  24256. 0x06,
  24257. 0xd0,
  24258. 0x2c,
  24259. 0x1e,
  24260. 0x8f,
  24261. 0xca,
  24262. 0x3f,
  24263. 0x0f,
  24264. 0x02,
  24265. 0xc1,
  24266. 0xaf,
  24267. 0xbd,
  24268. 0x03,
  24269. 0x01,
  24270. 0x13,
  24271. 0x8a,
  24272. 0x6b,
  24273. 0x3a,
  24274. 0x91,
  24275. 0x11,
  24276. 0x41,
  24277. 0x4f,
  24278. 0x67,
  24279. 0xdc,
  24280. 0xea,
  24281. 0x97,
  24282. 0xf2,
  24283. 0xcf,
  24284. 0xce,
  24285. 0xf0,
  24286. 0xb4,
  24287. 0xe6,
  24288. 0x73,
  24289. 0x96,
  24290. 0xac,
  24291. 0x74,
  24292. 0x22,
  24293. 0xe7,
  24294. 0xad,
  24295. 0x35,
  24296. 0x85,
  24297. 0xe2,
  24298. 0xf9,
  24299. 0x37,
  24300. 0xe8,
  24301. 0x1c,
  24302. 0x75,
  24303. 0xdf,
  24304. 0x6e,
  24305. 0x47,
  24306. 0xf1,
  24307. 0x1a,
  24308. 0x71,
  24309. 0x1d,
  24310. 0x29,
  24311. 0xc5,
  24312. 0x89,
  24313. 0x6f,
  24314. 0xb7,
  24315. 0x62,
  24316. 0x0e,
  24317. 0xaa,
  24318. 0x18,
  24319. 0xbe,
  24320. 0x1b,
  24321. 0xfc,
  24322. 0x56,
  24323. 0x3e,
  24324. 0x4b,
  24325. 0xc6,
  24326. 0xd2,
  24327. 0x79,
  24328. 0x20,
  24329. 0x9a,
  24330. 0xdb,
  24331. 0xc0,
  24332. 0xfe,
  24333. 0x78,
  24334. 0xcd,
  24335. 0x5a,
  24336. 0xf4,
  24337. 0x1f,
  24338. 0xdd,
  24339. 0xa8,
  24340. 0x33,
  24341. 0x88,
  24342. 0x07,
  24343. 0xc7,
  24344. 0x31,
  24345. 0xb1,
  24346. 0x12,
  24347. 0x10,
  24348. 0x59,
  24349. 0x27,
  24350. 0x80,
  24351. 0xec,
  24352. 0x5f,
  24353. 0x60,
  24354. 0x51,
  24355. 0x7f,
  24356. 0xa9,
  24357. 0x19,
  24358. 0xb5,
  24359. 0x4a,
  24360. 0x0d,
  24361. 0x2d,
  24362. 0xe5,
  24363. 0x7a,
  24364. 0x9f,
  24365. 0x93,
  24366. 0xc9,
  24367. 0x9c,
  24368. 0xef,
  24369. 0xa0,
  24370. 0xe0,
  24371. 0x3b,
  24372. 0x4d,
  24373. 0xae,
  24374. 0x2a,
  24375. 0xf5,
  24376. 0xb0,
  24377. 0xc8,
  24378. 0xeb,
  24379. 0xbb,
  24380. 0x3c,
  24381. 0x83,
  24382. 0x53,
  24383. 0x99,
  24384. 0x61,
  24385. 0x17,
  24386. 0x2b,
  24387. 0x04,
  24388. 0x7e,
  24389. 0xba,
  24390. 0x77,
  24391. 0xd6,
  24392. 0x26,
  24393. 0xe1,
  24394. 0x69,
  24395. 0x14,
  24396. 0x63,
  24397. 0x55,
  24398. 0x21,
  24399. 0x0c,
  24400. 0x7d
  24401. ]);
  24402. var mixCol = new Uint8Array(256);
  24403. for (var i = 0; i < 256; i++) {
  24404. if (i < 128) {
  24405. mixCol[i] = i << 1;
  24406. } else {
  24407. mixCol[i] = i << 1 ^ 0x1b;
  24408. }
  24409. }
  24410. var mix = new Uint32Array([
  24411. 0x00000000,
  24412. 0x0e090d0b,
  24413. 0x1c121a16,
  24414. 0x121b171d,
  24415. 0x3824342c,
  24416. 0x362d3927,
  24417. 0x24362e3a,
  24418. 0x2a3f2331,
  24419. 0x70486858,
  24420. 0x7e416553,
  24421. 0x6c5a724e,
  24422. 0x62537f45,
  24423. 0x486c5c74,
  24424. 0x4665517f,
  24425. 0x547e4662,
  24426. 0x5a774b69,
  24427. 0xe090d0b0,
  24428. 0xee99ddbb,
  24429. 0xfc82caa6,
  24430. 0xf28bc7ad,
  24431. 0xd8b4e49c,
  24432. 0xd6bde997,
  24433. 0xc4a6fe8a,
  24434. 0xcaaff381,
  24435. 0x90d8b8e8,
  24436. 0x9ed1b5e3,
  24437. 0x8ccaa2fe,
  24438. 0x82c3aff5,
  24439. 0xa8fc8cc4,
  24440. 0xa6f581cf,
  24441. 0xb4ee96d2,
  24442. 0xbae79bd9,
  24443. 0xdb3bbb7b,
  24444. 0xd532b670,
  24445. 0xc729a16d,
  24446. 0xc920ac66,
  24447. 0xe31f8f57,
  24448. 0xed16825c,
  24449. 0xff0d9541,
  24450. 0xf104984a,
  24451. 0xab73d323,
  24452. 0xa57ade28,
  24453. 0xb761c935,
  24454. 0xb968c43e,
  24455. 0x9357e70f,
  24456. 0x9d5eea04,
  24457. 0x8f45fd19,
  24458. 0x814cf012,
  24459. 0x3bab6bcb,
  24460. 0x35a266c0,
  24461. 0x27b971dd,
  24462. 0x29b07cd6,
  24463. 0x038f5fe7,
  24464. 0x0d8652ec,
  24465. 0x1f9d45f1,
  24466. 0x119448fa,
  24467. 0x4be30393,
  24468. 0x45ea0e98,
  24469. 0x57f11985,
  24470. 0x59f8148e,
  24471. 0x73c737bf,
  24472. 0x7dce3ab4,
  24473. 0x6fd52da9,
  24474. 0x61dc20a2,
  24475. 0xad766df6,
  24476. 0xa37f60fd,
  24477. 0xb16477e0,
  24478. 0xbf6d7aeb,
  24479. 0x955259da,
  24480. 0x9b5b54d1,
  24481. 0x894043cc,
  24482. 0x87494ec7,
  24483. 0xdd3e05ae,
  24484. 0xd33708a5,
  24485. 0xc12c1fb8,
  24486. 0xcf2512b3,
  24487. 0xe51a3182,
  24488. 0xeb133c89,
  24489. 0xf9082b94,
  24490. 0xf701269f,
  24491. 0x4de6bd46,
  24492. 0x43efb04d,
  24493. 0x51f4a750,
  24494. 0x5ffdaa5b,
  24495. 0x75c2896a,
  24496. 0x7bcb8461,
  24497. 0x69d0937c,
  24498. 0x67d99e77,
  24499. 0x3daed51e,
  24500. 0x33a7d815,
  24501. 0x21bccf08,
  24502. 0x2fb5c203,
  24503. 0x058ae132,
  24504. 0x0b83ec39,
  24505. 0x1998fb24,
  24506. 0x1791f62f,
  24507. 0x764dd68d,
  24508. 0x7844db86,
  24509. 0x6a5fcc9b,
  24510. 0x6456c190,
  24511. 0x4e69e2a1,
  24512. 0x4060efaa,
  24513. 0x527bf8b7,
  24514. 0x5c72f5bc,
  24515. 0x0605bed5,
  24516. 0x080cb3de,
  24517. 0x1a17a4c3,
  24518. 0x141ea9c8,
  24519. 0x3e218af9,
  24520. 0x302887f2,
  24521. 0x223390ef,
  24522. 0x2c3a9de4,
  24523. 0x96dd063d,
  24524. 0x98d40b36,
  24525. 0x8acf1c2b,
  24526. 0x84c61120,
  24527. 0xaef93211,
  24528. 0xa0f03f1a,
  24529. 0xb2eb2807,
  24530. 0xbce2250c,
  24531. 0xe6956e65,
  24532. 0xe89c636e,
  24533. 0xfa877473,
  24534. 0xf48e7978,
  24535. 0xdeb15a49,
  24536. 0xd0b85742,
  24537. 0xc2a3405f,
  24538. 0xccaa4d54,
  24539. 0x41ecdaf7,
  24540. 0x4fe5d7fc,
  24541. 0x5dfec0e1,
  24542. 0x53f7cdea,
  24543. 0x79c8eedb,
  24544. 0x77c1e3d0,
  24545. 0x65daf4cd,
  24546. 0x6bd3f9c6,
  24547. 0x31a4b2af,
  24548. 0x3fadbfa4,
  24549. 0x2db6a8b9,
  24550. 0x23bfa5b2,
  24551. 0x09808683,
  24552. 0x07898b88,
  24553. 0x15929c95,
  24554. 0x1b9b919e,
  24555. 0xa17c0a47,
  24556. 0xaf75074c,
  24557. 0xbd6e1051,
  24558. 0xb3671d5a,
  24559. 0x99583e6b,
  24560. 0x97513360,
  24561. 0x854a247d,
  24562. 0x8b432976,
  24563. 0xd134621f,
  24564. 0xdf3d6f14,
  24565. 0xcd267809,
  24566. 0xc32f7502,
  24567. 0xe9105633,
  24568. 0xe7195b38,
  24569. 0xf5024c25,
  24570. 0xfb0b412e,
  24571. 0x9ad7618c,
  24572. 0x94de6c87,
  24573. 0x86c57b9a,
  24574. 0x88cc7691,
  24575. 0xa2f355a0,
  24576. 0xacfa58ab,
  24577. 0xbee14fb6,
  24578. 0xb0e842bd,
  24579. 0xea9f09d4,
  24580. 0xe49604df,
  24581. 0xf68d13c2,
  24582. 0xf8841ec9,
  24583. 0xd2bb3df8,
  24584. 0xdcb230f3,
  24585. 0xcea927ee,
  24586. 0xc0a02ae5,
  24587. 0x7a47b13c,
  24588. 0x744ebc37,
  24589. 0x6655ab2a,
  24590. 0x685ca621,
  24591. 0x42638510,
  24592. 0x4c6a881b,
  24593. 0x5e719f06,
  24594. 0x5078920d,
  24595. 0x0a0fd964,
  24596. 0x0406d46f,
  24597. 0x161dc372,
  24598. 0x1814ce79,
  24599. 0x322bed48,
  24600. 0x3c22e043,
  24601. 0x2e39f75e,
  24602. 0x2030fa55,
  24603. 0xec9ab701,
  24604. 0xe293ba0a,
  24605. 0xf088ad17,
  24606. 0xfe81a01c,
  24607. 0xd4be832d,
  24608. 0xdab78e26,
  24609. 0xc8ac993b,
  24610. 0xc6a59430,
  24611. 0x9cd2df59,
  24612. 0x92dbd252,
  24613. 0x80c0c54f,
  24614. 0x8ec9c844,
  24615. 0xa4f6eb75,
  24616. 0xaaffe67e,
  24617. 0xb8e4f163,
  24618. 0xb6edfc68,
  24619. 0x0c0a67b1,
  24620. 0x02036aba,
  24621. 0x10187da7,
  24622. 0x1e1170ac,
  24623. 0x342e539d,
  24624. 0x3a275e96,
  24625. 0x283c498b,
  24626. 0x26354480,
  24627. 0x7c420fe9,
  24628. 0x724b02e2,
  24629. 0x605015ff,
  24630. 0x6e5918f4,
  24631. 0x44663bc5,
  24632. 0x4a6f36ce,
  24633. 0x587421d3,
  24634. 0x567d2cd8,
  24635. 0x37a10c7a,
  24636. 0x39a80171,
  24637. 0x2bb3166c,
  24638. 0x25ba1b67,
  24639. 0x0f853856,
  24640. 0x018c355d,
  24641. 0x13972240,
  24642. 0x1d9e2f4b,
  24643. 0x47e96422,
  24644. 0x49e06929,
  24645. 0x5bfb7e34,
  24646. 0x55f2733f,
  24647. 0x7fcd500e,
  24648. 0x71c45d05,
  24649. 0x63df4a18,
  24650. 0x6dd64713,
  24651. 0xd731dcca,
  24652. 0xd938d1c1,
  24653. 0xcb23c6dc,
  24654. 0xc52acbd7,
  24655. 0xef15e8e6,
  24656. 0xe11ce5ed,
  24657. 0xf307f2f0,
  24658. 0xfd0efffb,
  24659. 0xa779b492,
  24660. 0xa970b999,
  24661. 0xbb6bae84,
  24662. 0xb562a38f,
  24663. 0x9f5d80be,
  24664. 0x91548db5,
  24665. 0x834f9aa8,
  24666. 0x8d4697a3
  24667. ]);
  24668. function expandKey256(cipherKey) {
  24669. var b = 240, result = new Uint8Array(b);
  24670. var r = 1;
  24671. result.set(cipherKey);
  24672. for (var j = 32, i = 1; j < b; ++i) {
  24673. if (j % 32 === 16) {
  24674. t1 = s[t1];
  24675. t2 = s[t2];
  24676. t3 = s[t3];
  24677. t4 = s[t4];
  24678. } else if (j % 32 === 0) {
  24679. var t1 = result[j - 3], t2 = result[j - 2], t3 = result[j - 1], t4 = result[j - 4];
  24680. t1 = s[t1];
  24681. t2 = s[t2];
  24682. t3 = s[t3];
  24683. t4 = s[t4];
  24684. t1 = t1 ^ r;
  24685. if ((r <<= 1) >= 256) {
  24686. r = (r ^ 0x1b) & 0xFF;
  24687. }
  24688. }
  24689. for (var n = 0; n < 4; ++n) {
  24690. result[j] = t1 ^= result[j - 32];
  24691. j++;
  24692. result[j] = t2 ^= result[j - 32];
  24693. j++;
  24694. result[j] = t3 ^= result[j - 32];
  24695. j++;
  24696. result[j] = t4 ^= result[j - 32];
  24697. j++;
  24698. }
  24699. }
  24700. return result;
  24701. }
  24702. function decrypt256(input, key) {
  24703. var state = new Uint8Array(16);
  24704. state.set(input);
  24705. var i, j, k;
  24706. var t, u, v;
  24707. for (j = 0, k = 224; j < 16; ++j, ++k) {
  24708. state[j] ^= key[k];
  24709. }
  24710. for (i = 13; i >= 1; --i) {
  24711. t = state[13];
  24712. state[13] = state[9];
  24713. state[9] = state[5];
  24714. state[5] = state[1];
  24715. state[1] = t;
  24716. t = state[14];
  24717. u = state[10];
  24718. state[14] = state[6];
  24719. state[10] = state[2];
  24720. state[6] = t;
  24721. state[2] = u;
  24722. t = state[15];
  24723. u = state[11];
  24724. v = state[7];
  24725. state[15] = state[3];
  24726. state[11] = t;
  24727. state[7] = u;
  24728. state[3] = v;
  24729. for (j = 0; j < 16; ++j) {
  24730. state[j] = inv_s[state[j]];
  24731. }
  24732. for (j = 0, k = i * 16; j < 16; ++j, ++k) {
  24733. state[j] ^= key[k];
  24734. }
  24735. for (j = 0; j < 16; j += 4) {
  24736. var s0 = mix[state[j]], s1 = mix[state[j + 1]], s2 = mix[state[j + 2]], s3 = mix[state[j + 3]];
  24737. t = s0 ^ s1 >>> 8 ^ s1 << 24 ^ s2 >>> 16 ^ s2 << 16 ^ s3 >>> 24 ^ s3 << 8;
  24738. state[j] = t >>> 24 & 0xFF;
  24739. state[j + 1] = t >> 16 & 0xFF;
  24740. state[j + 2] = t >> 8 & 0xFF;
  24741. state[j + 3] = t & 0xFF;
  24742. }
  24743. }
  24744. t = state[13];
  24745. state[13] = state[9];
  24746. state[9] = state[5];
  24747. state[5] = state[1];
  24748. state[1] = t;
  24749. t = state[14];
  24750. u = state[10];
  24751. state[14] = state[6];
  24752. state[10] = state[2];
  24753. state[6] = t;
  24754. state[2] = u;
  24755. t = state[15];
  24756. u = state[11];
  24757. v = state[7];
  24758. state[15] = state[3];
  24759. state[11] = t;
  24760. state[7] = u;
  24761. state[3] = v;
  24762. for (j = 0; j < 16; ++j) {
  24763. state[j] = inv_s[state[j]];
  24764. state[j] ^= key[j];
  24765. }
  24766. return state;
  24767. }
  24768. function encrypt256(input, key) {
  24769. var t, u, v, k;
  24770. var state = new Uint8Array(16);
  24771. state.set(input);
  24772. for (j = 0; j < 16; ++j) {
  24773. state[j] ^= key[j];
  24774. }
  24775. for (i = 1; i < 14; i++) {
  24776. for (j = 0; j < 16; ++j) {
  24777. state[j] = s[state[j]];
  24778. }
  24779. v = state[1];
  24780. state[1] = state[5];
  24781. state[5] = state[9];
  24782. state[9] = state[13];
  24783. state[13] = v;
  24784. v = state[2];
  24785. u = state[6];
  24786. state[2] = state[10];
  24787. state[6] = state[14];
  24788. state[10] = v;
  24789. state[14] = u;
  24790. v = state[3];
  24791. u = state[7];
  24792. t = state[11];
  24793. state[3] = state[15];
  24794. state[7] = v;
  24795. state[11] = u;
  24796. state[15] = t;
  24797. for (var j = 0; j < 16; j += 4) {
  24798. var s0 = state[j + 0], s1 = state[j + 1];
  24799. var s2 = state[j + 2], s3 = state[j + 3];
  24800. t = s0 ^ s1 ^ s2 ^ s3;
  24801. state[j + 0] ^= t ^ mixCol[s0 ^ s1];
  24802. state[j + 1] ^= t ^ mixCol[s1 ^ s2];
  24803. state[j + 2] ^= t ^ mixCol[s2 ^ s3];
  24804. state[j + 3] ^= t ^ mixCol[s3 ^ s0];
  24805. }
  24806. for (j = 0, k = i * 16; j < 16; ++j, ++k) {
  24807. state[j] ^= key[k];
  24808. }
  24809. }
  24810. for (j = 0; j < 16; ++j) {
  24811. state[j] = s[state[j]];
  24812. }
  24813. v = state[1];
  24814. state[1] = state[5];
  24815. state[5] = state[9];
  24816. state[9] = state[13];
  24817. state[13] = v;
  24818. v = state[2];
  24819. u = state[6];
  24820. state[2] = state[10];
  24821. state[6] = state[14];
  24822. state[10] = v;
  24823. state[14] = u;
  24824. v = state[3];
  24825. u = state[7];
  24826. t = state[11];
  24827. state[3] = state[15];
  24828. state[7] = v;
  24829. state[11] = u;
  24830. state[15] = t;
  24831. for (j = 0, k = 224; j < 16; ++j, ++k) {
  24832. state[j] ^= key[k];
  24833. }
  24834. return state;
  24835. }
  24836. function AES256Cipher(key) {
  24837. this.key = expandKey256(key);
  24838. this.buffer = new Uint8Array(16);
  24839. this.bufferPosition = 0;
  24840. }
  24841. function decryptBlock2(data, finalize) {
  24842. var i, j, ii, sourceLength = data.length, buffer = this.buffer, bufferLength = this.bufferPosition, result = [], iv = this.iv;
  24843. for (i = 0; i < sourceLength; ++i) {
  24844. buffer[bufferLength] = data[i];
  24845. ++bufferLength;
  24846. if (bufferLength < 16) {
  24847. continue;
  24848. }
  24849. var plain = decrypt256(buffer, this.key);
  24850. for (j = 0; j < 16; ++j) {
  24851. plain[j] ^= iv[j];
  24852. }
  24853. iv = buffer;
  24854. result.push(plain);
  24855. buffer = new Uint8Array(16);
  24856. bufferLength = 0;
  24857. }
  24858. this.buffer = buffer;
  24859. this.bufferLength = bufferLength;
  24860. this.iv = iv;
  24861. if (result.length === 0) {
  24862. return new Uint8Array([]);
  24863. }
  24864. var outputLength = 16 * result.length;
  24865. if (finalize) {
  24866. var lastBlock = result[result.length - 1];
  24867. var psLen = lastBlock[15];
  24868. if (psLen <= 16) {
  24869. for (i = 15, ii = 16 - psLen; i >= ii; --i) {
  24870. if (lastBlock[i] !== psLen) {
  24871. psLen = 0;
  24872. break;
  24873. }
  24874. }
  24875. outputLength -= psLen;
  24876. result[result.length - 1] = lastBlock.subarray(0, 16 - psLen);
  24877. }
  24878. }
  24879. var output = new Uint8Array(outputLength);
  24880. for (i = 0, j = 0, ii = result.length; i < ii; ++i, j += 16) {
  24881. output.set(result[i], j);
  24882. }
  24883. return output;
  24884. }
  24885. AES256Cipher.prototype = {
  24886. decryptBlock: function AES256Cipher_decryptBlock(data, finalize, iv) {
  24887. var i, sourceLength = data.length;
  24888. var buffer = this.buffer, bufferLength = this.bufferPosition;
  24889. if (iv) {
  24890. this.iv = iv;
  24891. } else {
  24892. for (i = 0; bufferLength < 16 && i < sourceLength; ++i, ++bufferLength) {
  24893. buffer[bufferLength] = data[i];
  24894. }
  24895. if (bufferLength < 16) {
  24896. this.bufferLength = bufferLength;
  24897. return new Uint8Array([]);
  24898. }
  24899. this.iv = buffer;
  24900. data = data.subarray(16);
  24901. }
  24902. this.buffer = new Uint8Array(16);
  24903. this.bufferLength = 0;
  24904. this.decryptBlock = decryptBlock2;
  24905. return this.decryptBlock(data, finalize);
  24906. },
  24907. encrypt: function AES256Cipher_encrypt(data, iv) {
  24908. var i, j, ii, sourceLength = data.length, buffer = this.buffer, bufferLength = this.bufferPosition, result = [];
  24909. if (!iv) {
  24910. iv = new Uint8Array(16);
  24911. }
  24912. for (i = 0; i < sourceLength; ++i) {
  24913. buffer[bufferLength] = data[i];
  24914. ++bufferLength;
  24915. if (bufferLength < 16) {
  24916. continue;
  24917. }
  24918. for (j = 0; j < 16; ++j) {
  24919. buffer[j] ^= iv[j];
  24920. }
  24921. var cipher = encrypt256(buffer, this.key);
  24922. this.iv = cipher;
  24923. result.push(cipher);
  24924. buffer = new Uint8Array(16);
  24925. bufferLength = 0;
  24926. }
  24927. this.buffer = buffer;
  24928. this.bufferLength = bufferLength;
  24929. this.iv = iv;
  24930. if (result.length === 0) {
  24931. return new Uint8Array([]);
  24932. }
  24933. var outputLength = 16 * result.length;
  24934. var output = new Uint8Array(outputLength);
  24935. for (i = 0, j = 0, ii = result.length; i < ii; ++i, j += 16) {
  24936. output.set(result[i], j);
  24937. }
  24938. return output;
  24939. }
  24940. };
  24941. return AES256Cipher;
  24942. }();
  24943. var PDF17 = function PDF17Closure() {
  24944. function compareByteArrays(array1, array2) {
  24945. if (array1.length !== array2.length) {
  24946. return false;
  24947. }
  24948. for (var i = 0; i < array1.length; i++) {
  24949. if (array1[i] !== array2[i]) {
  24950. return false;
  24951. }
  24952. }
  24953. return true;
  24954. }
  24955. function PDF17() {
  24956. }
  24957. PDF17.prototype = {
  24958. checkOwnerPassword: function PDF17_checkOwnerPassword(password, ownerValidationSalt, userBytes, ownerPassword) {
  24959. var hashData = new Uint8Array(password.length + 56);
  24960. hashData.set(password, 0);
  24961. hashData.set(ownerValidationSalt, password.length);
  24962. hashData.set(userBytes, password.length + ownerValidationSalt.length);
  24963. var result = calculateSHA256(hashData, 0, hashData.length);
  24964. return compareByteArrays(result, ownerPassword);
  24965. },
  24966. checkUserPassword: function PDF17_checkUserPassword(password, userValidationSalt, userPassword) {
  24967. var hashData = new Uint8Array(password.length + 8);
  24968. hashData.set(password, 0);
  24969. hashData.set(userValidationSalt, password.length);
  24970. var result = calculateSHA256(hashData, 0, hashData.length);
  24971. return compareByteArrays(result, userPassword);
  24972. },
  24973. getOwnerKey: function PDF17_getOwnerKey(password, ownerKeySalt, userBytes, ownerEncryption) {
  24974. var hashData = new Uint8Array(password.length + 56);
  24975. hashData.set(password, 0);
  24976. hashData.set(ownerKeySalt, password.length);
  24977. hashData.set(userBytes, password.length + ownerKeySalt.length);
  24978. var key = calculateSHA256(hashData, 0, hashData.length);
  24979. var cipher = new AES256Cipher(key);
  24980. return cipher.decryptBlock(ownerEncryption, false, new Uint8Array(16));
  24981. },
  24982. getUserKey: function PDF17_getUserKey(password, userKeySalt, userEncryption) {
  24983. var hashData = new Uint8Array(password.length + 8);
  24984. hashData.set(password, 0);
  24985. hashData.set(userKeySalt, password.length);
  24986. var key = calculateSHA256(hashData, 0, hashData.length);
  24987. var cipher = new AES256Cipher(key);
  24988. return cipher.decryptBlock(userEncryption, false, new Uint8Array(16));
  24989. }
  24990. };
  24991. return PDF17;
  24992. }();
  24993. var PDF20 = function PDF20Closure() {
  24994. function concatArrays(array1, array2) {
  24995. var t = new Uint8Array(array1.length + array2.length);
  24996. t.set(array1, 0);
  24997. t.set(array2, array1.length);
  24998. return t;
  24999. }
  25000. function calculatePDF20Hash(password, input, userBytes) {
  25001. var k = calculateSHA256(input, 0, input.length).subarray(0, 32);
  25002. var e = [0];
  25003. var i = 0;
  25004. while (i < 64 || e[e.length - 1] > i - 32) {
  25005. var arrayLength = password.length + k.length + userBytes.length;
  25006. var k1 = new Uint8Array(arrayLength * 64);
  25007. var array = concatArrays(password, k);
  25008. array = concatArrays(array, userBytes);
  25009. for (var j = 0, pos = 0; j < 64; j++, pos += arrayLength) {
  25010. k1.set(array, pos);
  25011. }
  25012. var cipher = new AES128Cipher(k.subarray(0, 16));
  25013. e = cipher.encrypt(k1, k.subarray(16, 32));
  25014. var remainder = 0;
  25015. for (var z = 0; z < 16; z++) {
  25016. remainder *= 256 % 3;
  25017. remainder %= 3;
  25018. remainder += (e[z] >>> 0) % 3;
  25019. remainder %= 3;
  25020. }
  25021. if (remainder === 0) {
  25022. k = calculateSHA256(e, 0, e.length);
  25023. } else if (remainder === 1) {
  25024. k = calculateSHA384(e, 0, e.length);
  25025. } else if (remainder === 2) {
  25026. k = calculateSHA512(e, 0, e.length);
  25027. }
  25028. i++;
  25029. }
  25030. return k.subarray(0, 32);
  25031. }
  25032. function PDF20() {
  25033. }
  25034. function compareByteArrays(array1, array2) {
  25035. if (array1.length !== array2.length) {
  25036. return false;
  25037. }
  25038. for (var i = 0; i < array1.length; i++) {
  25039. if (array1[i] !== array2[i]) {
  25040. return false;
  25041. }
  25042. }
  25043. return true;
  25044. }
  25045. PDF20.prototype = {
  25046. hash: function PDF20_hash(password, concatBytes, userBytes) {
  25047. return calculatePDF20Hash(password, concatBytes, userBytes);
  25048. },
  25049. checkOwnerPassword: function PDF20_checkOwnerPassword(password, ownerValidationSalt, userBytes, ownerPassword) {
  25050. var hashData = new Uint8Array(password.length + 56);
  25051. hashData.set(password, 0);
  25052. hashData.set(ownerValidationSalt, password.length);
  25053. hashData.set(userBytes, password.length + ownerValidationSalt.length);
  25054. var result = calculatePDF20Hash(password, hashData, userBytes);
  25055. return compareByteArrays(result, ownerPassword);
  25056. },
  25057. checkUserPassword: function PDF20_checkUserPassword(password, userValidationSalt, userPassword) {
  25058. var hashData = new Uint8Array(password.length + 8);
  25059. hashData.set(password, 0);
  25060. hashData.set(userValidationSalt, password.length);
  25061. var result = calculatePDF20Hash(password, hashData, []);
  25062. return compareByteArrays(result, userPassword);
  25063. },
  25064. getOwnerKey: function PDF20_getOwnerKey(password, ownerKeySalt, userBytes, ownerEncryption) {
  25065. var hashData = new Uint8Array(password.length + 56);
  25066. hashData.set(password, 0);
  25067. hashData.set(ownerKeySalt, password.length);
  25068. hashData.set(userBytes, password.length + ownerKeySalt.length);
  25069. var key = calculatePDF20Hash(password, hashData, userBytes);
  25070. var cipher = new AES256Cipher(key);
  25071. return cipher.decryptBlock(ownerEncryption, false, new Uint8Array(16));
  25072. },
  25073. getUserKey: function PDF20_getUserKey(password, userKeySalt, userEncryption) {
  25074. var hashData = new Uint8Array(password.length + 8);
  25075. hashData.set(password, 0);
  25076. hashData.set(userKeySalt, password.length);
  25077. var key = calculatePDF20Hash(password, hashData, []);
  25078. var cipher = new AES256Cipher(key);
  25079. return cipher.decryptBlock(userEncryption, false, new Uint8Array(16));
  25080. }
  25081. };
  25082. return PDF20;
  25083. }();
  25084. var CipherTransform = function CipherTransformClosure() {
  25085. function CipherTransform(stringCipherConstructor, streamCipherConstructor) {
  25086. this.StringCipherConstructor = stringCipherConstructor;
  25087. this.StreamCipherConstructor = streamCipherConstructor;
  25088. }
  25089. CipherTransform.prototype = {
  25090. createStream: function CipherTransform_createStream(stream, length) {
  25091. var cipher = new this.StreamCipherConstructor();
  25092. return new DecryptStream(stream, length, function cipherTransformDecryptStream(data, finalize) {
  25093. return cipher.decryptBlock(data, finalize);
  25094. });
  25095. },
  25096. decryptString: function CipherTransform_decryptString(s) {
  25097. var cipher = new this.StringCipherConstructor();
  25098. var data = stringToBytes(s);
  25099. data = cipher.decryptBlock(data, true);
  25100. return bytesToString(data);
  25101. }
  25102. };
  25103. return CipherTransform;
  25104. }();
  25105. var CipherTransformFactory = function CipherTransformFactoryClosure() {
  25106. var defaultPasswordBytes = new Uint8Array([
  25107. 0x28,
  25108. 0xBF,
  25109. 0x4E,
  25110. 0x5E,
  25111. 0x4E,
  25112. 0x75,
  25113. 0x8A,
  25114. 0x41,
  25115. 0x64,
  25116. 0x00,
  25117. 0x4E,
  25118. 0x56,
  25119. 0xFF,
  25120. 0xFA,
  25121. 0x01,
  25122. 0x08,
  25123. 0x2E,
  25124. 0x2E,
  25125. 0x00,
  25126. 0xB6,
  25127. 0xD0,
  25128. 0x68,
  25129. 0x3E,
  25130. 0x80,
  25131. 0x2F,
  25132. 0x0C,
  25133. 0xA9,
  25134. 0xFE,
  25135. 0x64,
  25136. 0x53,
  25137. 0x69,
  25138. 0x7A
  25139. ]);
  25140. function createEncryptionKey20(revision, password, ownerPassword, ownerValidationSalt, ownerKeySalt, uBytes, userPassword, userValidationSalt, userKeySalt, ownerEncryption, userEncryption, perms) {
  25141. if (password) {
  25142. var passwordLength = Math.min(127, password.length);
  25143. password = password.subarray(0, passwordLength);
  25144. } else {
  25145. password = [];
  25146. }
  25147. var pdfAlgorithm;
  25148. if (revision === 6) {
  25149. pdfAlgorithm = new PDF20();
  25150. } else {
  25151. pdfAlgorithm = new PDF17();
  25152. }
  25153. if (pdfAlgorithm.checkUserPassword(password, userValidationSalt, userPassword)) {
  25154. return pdfAlgorithm.getUserKey(password, userKeySalt, userEncryption);
  25155. } else if (password.length && pdfAlgorithm.checkOwnerPassword(password, ownerValidationSalt, uBytes, ownerPassword)) {
  25156. return pdfAlgorithm.getOwnerKey(password, ownerKeySalt, uBytes, ownerEncryption);
  25157. }
  25158. return null;
  25159. }
  25160. function prepareKeyData(fileId, password, ownerPassword, userPassword, flags, revision, keyLength, encryptMetadata) {
  25161. var hashDataSize = 40 + ownerPassword.length + fileId.length;
  25162. var hashData = new Uint8Array(hashDataSize), i = 0, j, n;
  25163. if (password) {
  25164. n = Math.min(32, password.length);
  25165. for (; i < n; ++i) {
  25166. hashData[i] = password[i];
  25167. }
  25168. }
  25169. j = 0;
  25170. while (i < 32) {
  25171. hashData[i++] = defaultPasswordBytes[j++];
  25172. }
  25173. for (j = 0, n = ownerPassword.length; j < n; ++j) {
  25174. hashData[i++] = ownerPassword[j];
  25175. }
  25176. hashData[i++] = flags & 0xFF;
  25177. hashData[i++] = flags >> 8 & 0xFF;
  25178. hashData[i++] = flags >> 16 & 0xFF;
  25179. hashData[i++] = flags >>> 24 & 0xFF;
  25180. for (j = 0, n = fileId.length; j < n; ++j) {
  25181. hashData[i++] = fileId[j];
  25182. }
  25183. if (revision >= 4 && !encryptMetadata) {
  25184. hashData[i++] = 0xFF;
  25185. hashData[i++] = 0xFF;
  25186. hashData[i++] = 0xFF;
  25187. hashData[i++] = 0xFF;
  25188. }
  25189. var hash = calculateMD5(hashData, 0, i);
  25190. var keyLengthInBytes = keyLength >> 3;
  25191. if (revision >= 3) {
  25192. for (j = 0; j < 50; ++j) {
  25193. hash = calculateMD5(hash, 0, keyLengthInBytes);
  25194. }
  25195. }
  25196. var encryptionKey = hash.subarray(0, keyLengthInBytes);
  25197. var cipher, checkData;
  25198. if (revision >= 3) {
  25199. for (i = 0; i < 32; ++i) {
  25200. hashData[i] = defaultPasswordBytes[i];
  25201. }
  25202. for (j = 0, n = fileId.length; j < n; ++j) {
  25203. hashData[i++] = fileId[j];
  25204. }
  25205. cipher = new ARCFourCipher(encryptionKey);
  25206. checkData = cipher.encryptBlock(calculateMD5(hashData, 0, i));
  25207. n = encryptionKey.length;
  25208. var derivedKey = new Uint8Array(n), k;
  25209. for (j = 1; j <= 19; ++j) {
  25210. for (k = 0; k < n; ++k) {
  25211. derivedKey[k] = encryptionKey[k] ^ j;
  25212. }
  25213. cipher = new ARCFourCipher(derivedKey);
  25214. checkData = cipher.encryptBlock(checkData);
  25215. }
  25216. for (j = 0, n = checkData.length; j < n; ++j) {
  25217. if (userPassword[j] !== checkData[j]) {
  25218. return null;
  25219. }
  25220. }
  25221. } else {
  25222. cipher = new ARCFourCipher(encryptionKey);
  25223. checkData = cipher.encryptBlock(defaultPasswordBytes);
  25224. for (j = 0, n = checkData.length; j < n; ++j) {
  25225. if (userPassword[j] !== checkData[j]) {
  25226. return null;
  25227. }
  25228. }
  25229. }
  25230. return encryptionKey;
  25231. }
  25232. function decodeUserPassword(password, ownerPassword, revision, keyLength) {
  25233. var hashData = new Uint8Array(32), i = 0, j, n;
  25234. n = Math.min(32, password.length);
  25235. for (; i < n; ++i) {
  25236. hashData[i] = password[i];
  25237. }
  25238. j = 0;
  25239. while (i < 32) {
  25240. hashData[i++] = defaultPasswordBytes[j++];
  25241. }
  25242. var hash = calculateMD5(hashData, 0, i);
  25243. var keyLengthInBytes = keyLength >> 3;
  25244. if (revision >= 3) {
  25245. for (j = 0; j < 50; ++j) {
  25246. hash = calculateMD5(hash, 0, hash.length);
  25247. }
  25248. }
  25249. var cipher, userPassword;
  25250. if (revision >= 3) {
  25251. userPassword = ownerPassword;
  25252. var derivedKey = new Uint8Array(keyLengthInBytes), k;
  25253. for (j = 19; j >= 0; j--) {
  25254. for (k = 0; k < keyLengthInBytes; ++k) {
  25255. derivedKey[k] = hash[k] ^ j;
  25256. }
  25257. cipher = new ARCFourCipher(derivedKey);
  25258. userPassword = cipher.encryptBlock(userPassword);
  25259. }
  25260. } else {
  25261. cipher = new ARCFourCipher(hash.subarray(0, keyLengthInBytes));
  25262. userPassword = cipher.encryptBlock(ownerPassword);
  25263. }
  25264. return userPassword;
  25265. }
  25266. var identityName = Name.get('Identity');
  25267. function CipherTransformFactory(dict, fileId, password) {
  25268. var filter = dict.get('Filter');
  25269. if (!isName(filter, 'Standard')) {
  25270. error('unknown encryption method');
  25271. }
  25272. this.dict = dict;
  25273. var algorithm = dict.get('V');
  25274. if (!isInt(algorithm) || algorithm !== 1 && algorithm !== 2 && algorithm !== 4 && algorithm !== 5) {
  25275. error('unsupported encryption algorithm');
  25276. }
  25277. this.algorithm = algorithm;
  25278. var keyLength = dict.get('Length');
  25279. if (!keyLength) {
  25280. if (algorithm <= 3) {
  25281. keyLength = 40;
  25282. } else {
  25283. var cfDict = dict.get('CF');
  25284. var streamCryptoName = dict.get('StmF');
  25285. if (isDict(cfDict) && isName(streamCryptoName)) {
  25286. cfDict.suppressEncryption = true;
  25287. var handlerDict = cfDict.get(streamCryptoName.name);
  25288. keyLength = handlerDict && handlerDict.get('Length') || 128;
  25289. if (keyLength < 40) {
  25290. keyLength <<= 3;
  25291. }
  25292. }
  25293. }
  25294. }
  25295. if (!isInt(keyLength) || keyLength < 40 || keyLength % 8 !== 0) {
  25296. error('invalid key length');
  25297. }
  25298. var ownerPassword = stringToBytes(dict.get('O')).subarray(0, 32);
  25299. var userPassword = stringToBytes(dict.get('U')).subarray(0, 32);
  25300. var flags = dict.get('P');
  25301. var revision = dict.get('R');
  25302. var encryptMetadata = (algorithm === 4 || algorithm === 5) && dict.get('EncryptMetadata') !== false;
  25303. this.encryptMetadata = encryptMetadata;
  25304. var fileIdBytes = stringToBytes(fileId);
  25305. var passwordBytes;
  25306. if (password) {
  25307. if (revision === 6) {
  25308. try {
  25309. password = utf8StringToString(password);
  25310. } catch (ex) {
  25311. warn('CipherTransformFactory: ' + 'Unable to convert UTF8 encoded password.');
  25312. }
  25313. }
  25314. passwordBytes = stringToBytes(password);
  25315. }
  25316. var encryptionKey;
  25317. if (algorithm !== 5) {
  25318. encryptionKey = prepareKeyData(fileIdBytes, passwordBytes, ownerPassword, userPassword, flags, revision, keyLength, encryptMetadata);
  25319. } else {
  25320. var ownerValidationSalt = stringToBytes(dict.get('O')).subarray(32, 40);
  25321. var ownerKeySalt = stringToBytes(dict.get('O')).subarray(40, 48);
  25322. var uBytes = stringToBytes(dict.get('U')).subarray(0, 48);
  25323. var userValidationSalt = stringToBytes(dict.get('U')).subarray(32, 40);
  25324. var userKeySalt = stringToBytes(dict.get('U')).subarray(40, 48);
  25325. var ownerEncryption = stringToBytes(dict.get('OE'));
  25326. var userEncryption = stringToBytes(dict.get('UE'));
  25327. var perms = stringToBytes(dict.get('Perms'));
  25328. encryptionKey = createEncryptionKey20(revision, passwordBytes, ownerPassword, ownerValidationSalt, ownerKeySalt, uBytes, userPassword, userValidationSalt, userKeySalt, ownerEncryption, userEncryption, perms);
  25329. }
  25330. if (!encryptionKey && !password) {
  25331. throw new PasswordException('No password given', PasswordResponses.NEED_PASSWORD);
  25332. } else if (!encryptionKey && password) {
  25333. var decodedPassword = decodeUserPassword(passwordBytes, ownerPassword, revision, keyLength);
  25334. encryptionKey = prepareKeyData(fileIdBytes, decodedPassword, ownerPassword, userPassword, flags, revision, keyLength, encryptMetadata);
  25335. }
  25336. if (!encryptionKey) {
  25337. throw new PasswordException('Incorrect Password', PasswordResponses.INCORRECT_PASSWORD);
  25338. }
  25339. this.encryptionKey = encryptionKey;
  25340. if (algorithm >= 4) {
  25341. var cf = dict.get('CF');
  25342. if (isDict(cf)) {
  25343. cf.suppressEncryption = true;
  25344. }
  25345. this.cf = cf;
  25346. this.stmf = dict.get('StmF') || identityName;
  25347. this.strf = dict.get('StrF') || identityName;
  25348. this.eff = dict.get('EFF') || this.stmf;
  25349. }
  25350. }
  25351. function buildObjectKey(num, gen, encryptionKey, isAes) {
  25352. var key = new Uint8Array(encryptionKey.length + 9), i, n;
  25353. for (i = 0, n = encryptionKey.length; i < n; ++i) {
  25354. key[i] = encryptionKey[i];
  25355. }
  25356. key[i++] = num & 0xFF;
  25357. key[i++] = num >> 8 & 0xFF;
  25358. key[i++] = num >> 16 & 0xFF;
  25359. key[i++] = gen & 0xFF;
  25360. key[i++] = gen >> 8 & 0xFF;
  25361. if (isAes) {
  25362. key[i++] = 0x73;
  25363. key[i++] = 0x41;
  25364. key[i++] = 0x6C;
  25365. key[i++] = 0x54;
  25366. }
  25367. var hash = calculateMD5(key, 0, i);
  25368. return hash.subarray(0, Math.min(encryptionKey.length + 5, 16));
  25369. }
  25370. function buildCipherConstructor(cf, name, num, gen, key) {
  25371. assert(isName(name), 'Invalid crypt filter name.');
  25372. var cryptFilter = cf.get(name.name);
  25373. var cfm;
  25374. if (cryptFilter !== null && cryptFilter !== undefined) {
  25375. cfm = cryptFilter.get('CFM');
  25376. }
  25377. if (!cfm || cfm.name === 'None') {
  25378. return function cipherTransformFactoryBuildCipherConstructorNone() {
  25379. return new NullCipher();
  25380. };
  25381. }
  25382. if (cfm.name === 'V2') {
  25383. return function cipherTransformFactoryBuildCipherConstructorV2() {
  25384. return new ARCFourCipher(buildObjectKey(num, gen, key, false));
  25385. };
  25386. }
  25387. if (cfm.name === 'AESV2') {
  25388. return function cipherTransformFactoryBuildCipherConstructorAESV2() {
  25389. return new AES128Cipher(buildObjectKey(num, gen, key, true));
  25390. };
  25391. }
  25392. if (cfm.name === 'AESV3') {
  25393. return function cipherTransformFactoryBuildCipherConstructorAESV3() {
  25394. return new AES256Cipher(key);
  25395. };
  25396. }
  25397. error('Unknown crypto method');
  25398. }
  25399. CipherTransformFactory.prototype = {
  25400. createCipherTransform: function CipherTransformFactory_createCipherTransform(num, gen) {
  25401. if (this.algorithm === 4 || this.algorithm === 5) {
  25402. return new CipherTransform(buildCipherConstructor(this.cf, this.stmf, num, gen, this.encryptionKey), buildCipherConstructor(this.cf, this.strf, num, gen, this.encryptionKey));
  25403. }
  25404. var key = buildObjectKey(num, gen, this.encryptionKey, false);
  25405. var cipherConstructor = function buildCipherCipherConstructor() {
  25406. return new ARCFourCipher(key);
  25407. };
  25408. return new CipherTransform(cipherConstructor, cipherConstructor);
  25409. }
  25410. };
  25411. return CipherTransformFactory;
  25412. }();
  25413. exports.AES128Cipher = AES128Cipher;
  25414. exports.AES256Cipher = AES256Cipher;
  25415. exports.ARCFourCipher = ARCFourCipher;
  25416. exports.CipherTransformFactory = CipherTransformFactory;
  25417. exports.PDF17 = PDF17;
  25418. exports.PDF20 = PDF20;
  25419. exports.calculateMD5 = calculateMD5;
  25420. exports.calculateSHA256 = calculateSHA256;
  25421. exports.calculateSHA384 = calculateSHA384;
  25422. exports.calculateSHA512 = calculateSHA512;
  25423. /***/ }),
  25424. /* 14 */
  25425. /***/ (function(module, exports, __w_pdfjs_require__) {
  25426. "use strict";
  25427. var sharedUtil = __w_pdfjs_require__(0);
  25428. var corePrimitives = __w_pdfjs_require__(1);
  25429. var coreStream = __w_pdfjs_require__(2);
  25430. var coreParser = __w_pdfjs_require__(5);
  25431. var coreImage = __w_pdfjs_require__(27);
  25432. var coreColorSpace = __w_pdfjs_require__(3);
  25433. var coreMurmurHash3 = __w_pdfjs_require__(31);
  25434. var coreFonts = __w_pdfjs_require__(26);
  25435. var coreFunction = __w_pdfjs_require__(6);
  25436. var corePattern = __w_pdfjs_require__(32);
  25437. var coreCMap = __w_pdfjs_require__(23);
  25438. var coreMetrics = __w_pdfjs_require__(30);
  25439. var coreBidi = __w_pdfjs_require__(21);
  25440. var coreEncodings = __w_pdfjs_require__(4);
  25441. var coreStandardFonts = __w_pdfjs_require__(17);
  25442. var coreUnicode = __w_pdfjs_require__(18);
  25443. var coreGlyphList = __w_pdfjs_require__(7);
  25444. var FONT_IDENTITY_MATRIX = sharedUtil.FONT_IDENTITY_MATRIX;
  25445. var IDENTITY_MATRIX = sharedUtil.IDENTITY_MATRIX;
  25446. var UNSUPPORTED_FEATURES = sharedUtil.UNSUPPORTED_FEATURES;
  25447. var ImageKind = sharedUtil.ImageKind;
  25448. var OPS = sharedUtil.OPS;
  25449. var TextRenderingMode = sharedUtil.TextRenderingMode;
  25450. var CMapCompressionType = sharedUtil.CMapCompressionType;
  25451. var Util = sharedUtil.Util;
  25452. var assert = sharedUtil.assert;
  25453. var createPromiseCapability = sharedUtil.createPromiseCapability;
  25454. var error = sharedUtil.error;
  25455. var info = sharedUtil.info;
  25456. var isArray = sharedUtil.isArray;
  25457. var isNum = sharedUtil.isNum;
  25458. var isString = sharedUtil.isString;
  25459. var getLookupTableFactory = sharedUtil.getLookupTableFactory;
  25460. var warn = sharedUtil.warn;
  25461. var Dict = corePrimitives.Dict;
  25462. var Name = corePrimitives.Name;
  25463. var isEOF = corePrimitives.isEOF;
  25464. var isCmd = corePrimitives.isCmd;
  25465. var isDict = corePrimitives.isDict;
  25466. var isName = corePrimitives.isName;
  25467. var isRef = corePrimitives.isRef;
  25468. var isStream = corePrimitives.isStream;
  25469. var DecodeStream = coreStream.DecodeStream;
  25470. var JpegStream = coreStream.JpegStream;
  25471. var Stream = coreStream.Stream;
  25472. var Lexer = coreParser.Lexer;
  25473. var Parser = coreParser.Parser;
  25474. var PDFImage = coreImage.PDFImage;
  25475. var ColorSpace = coreColorSpace.ColorSpace;
  25476. var MurmurHash3_64 = coreMurmurHash3.MurmurHash3_64;
  25477. var ErrorFont = coreFonts.ErrorFont;
  25478. var FontFlags = coreFonts.FontFlags;
  25479. var Font = coreFonts.Font;
  25480. var IdentityToUnicodeMap = coreFonts.IdentityToUnicodeMap;
  25481. var ToUnicodeMap = coreFonts.ToUnicodeMap;
  25482. var getFontType = coreFonts.getFontType;
  25483. var isPDFFunction = coreFunction.isPDFFunction;
  25484. var PDFFunction = coreFunction.PDFFunction;
  25485. var Pattern = corePattern.Pattern;
  25486. var getTilingPatternIR = corePattern.getTilingPatternIR;
  25487. var CMapFactory = coreCMap.CMapFactory;
  25488. var IdentityCMap = coreCMap.IdentityCMap;
  25489. var getMetrics = coreMetrics.getMetrics;
  25490. var bidi = coreBidi.bidi;
  25491. var WinAnsiEncoding = coreEncodings.WinAnsiEncoding;
  25492. var StandardEncoding = coreEncodings.StandardEncoding;
  25493. var MacRomanEncoding = coreEncodings.MacRomanEncoding;
  25494. var SymbolSetEncoding = coreEncodings.SymbolSetEncoding;
  25495. var ZapfDingbatsEncoding = coreEncodings.ZapfDingbatsEncoding;
  25496. var getEncoding = coreEncodings.getEncoding;
  25497. var getStdFontMap = coreStandardFonts.getStdFontMap;
  25498. var getSerifFonts = coreStandardFonts.getSerifFonts;
  25499. var getSymbolsFonts = coreStandardFonts.getSymbolsFonts;
  25500. var getNormalizedUnicodes = coreUnicode.getNormalizedUnicodes;
  25501. var reverseIfRtl = coreUnicode.reverseIfRtl;
  25502. var getUnicodeForGlyph = coreUnicode.getUnicodeForGlyph;
  25503. var getGlyphsUnicode = coreGlyphList.getGlyphsUnicode;
  25504. var PartialEvaluator = function PartialEvaluatorClosure() {
  25505. var DefaultPartialEvaluatorOptions = {
  25506. forceDataSchema: false,
  25507. maxImageSize: -1,
  25508. disableFontFace: false,
  25509. disableNativeImageDecoder: false
  25510. };
  25511. function NativeImageDecoder(xref, resources, handler, forceDataSchema) {
  25512. this.xref = xref;
  25513. this.resources = resources;
  25514. this.handler = handler;
  25515. this.forceDataSchema = forceDataSchema;
  25516. }
  25517. NativeImageDecoder.prototype = {
  25518. canDecode: function (image) {
  25519. return image instanceof JpegStream && NativeImageDecoder.isDecodable(image, this.xref, this.resources);
  25520. },
  25521. decode: function (image) {
  25522. var dict = image.dict;
  25523. var colorSpace = dict.get('ColorSpace', 'CS');
  25524. colorSpace = ColorSpace.parse(colorSpace, this.xref, this.resources);
  25525. var numComps = colorSpace.numComps;
  25526. var decodePromise = this.handler.sendWithPromise('JpegDecode', [
  25527. image.getIR(this.forceDataSchema),
  25528. numComps
  25529. ]);
  25530. return decodePromise.then(function (message) {
  25531. var data = message.data;
  25532. return new Stream(data, 0, data.length, image.dict);
  25533. });
  25534. }
  25535. };
  25536. NativeImageDecoder.isSupported = function NativeImageDecoder_isSupported(image, xref, res) {
  25537. var dict = image.dict;
  25538. if (dict.has('DecodeParms') || dict.has('DP')) {
  25539. return false;
  25540. }
  25541. var cs = ColorSpace.parse(dict.get('ColorSpace', 'CS'), xref, res);
  25542. return (cs.name === 'DeviceGray' || cs.name === 'DeviceRGB') && cs.isDefaultDecode(dict.getArray('Decode', 'D'));
  25543. };
  25544. NativeImageDecoder.isDecodable = function NativeImageDecoder_isDecodable(image, xref, res) {
  25545. var dict = image.dict;
  25546. if (dict.has('DecodeParms') || dict.has('DP')) {
  25547. return false;
  25548. }
  25549. var cs = ColorSpace.parse(dict.get('ColorSpace', 'CS'), xref, res);
  25550. return (cs.numComps === 1 || cs.numComps === 3) && cs.isDefaultDecode(dict.getArray('Decode', 'D'));
  25551. };
  25552. function PartialEvaluator(pdfManager, xref, handler, pageIndex, idFactory, fontCache, builtInCMapCache, options) {
  25553. this.pdfManager = pdfManager;
  25554. this.xref = xref;
  25555. this.handler = handler;
  25556. this.pageIndex = pageIndex;
  25557. this.idFactory = idFactory;
  25558. this.fontCache = fontCache;
  25559. this.builtInCMapCache = builtInCMapCache;
  25560. this.options = options || DefaultPartialEvaluatorOptions;
  25561. this.fetchBuiltInCMap = function (name) {
  25562. var cachedCMap = builtInCMapCache[name];
  25563. if (cachedCMap) {
  25564. return Promise.resolve(cachedCMap);
  25565. }
  25566. return handler.sendWithPromise('FetchBuiltInCMap', { name: name }).then(function (data) {
  25567. if (data.compressionType !== CMapCompressionType.NONE) {
  25568. builtInCMapCache[name] = data;
  25569. }
  25570. return data;
  25571. });
  25572. };
  25573. }
  25574. var TIME_SLOT_DURATION_MS = 20;
  25575. var CHECK_TIME_EVERY = 100;
  25576. function TimeSlotManager() {
  25577. this.reset();
  25578. }
  25579. TimeSlotManager.prototype = {
  25580. check: function TimeSlotManager_check() {
  25581. if (++this.checked < CHECK_TIME_EVERY) {
  25582. return false;
  25583. }
  25584. this.checked = 0;
  25585. return this.endTime <= Date.now();
  25586. },
  25587. reset: function TimeSlotManager_reset() {
  25588. this.endTime = Date.now() + TIME_SLOT_DURATION_MS;
  25589. this.checked = 0;
  25590. }
  25591. };
  25592. var deferred = Promise.resolve();
  25593. var TILING_PATTERN = 1, SHADING_PATTERN = 2;
  25594. PartialEvaluator.prototype = {
  25595. hasBlendModes: function PartialEvaluator_hasBlendModes(resources) {
  25596. if (!isDict(resources)) {
  25597. return false;
  25598. }
  25599. var processed = Object.create(null);
  25600. if (resources.objId) {
  25601. processed[resources.objId] = true;
  25602. }
  25603. var nodes = [resources], xref = this.xref;
  25604. while (nodes.length) {
  25605. var key, i, ii;
  25606. var node = nodes.shift();
  25607. var graphicStates = node.get('ExtGState');
  25608. if (isDict(graphicStates)) {
  25609. var graphicStatesKeys = graphicStates.getKeys();
  25610. for (i = 0, ii = graphicStatesKeys.length; i < ii; i++) {
  25611. key = graphicStatesKeys[i];
  25612. var graphicState = graphicStates.get(key);
  25613. var bm = graphicState.get('BM');
  25614. if (isName(bm) && bm.name !== 'Normal') {
  25615. return true;
  25616. }
  25617. }
  25618. }
  25619. var xObjects = node.get('XObject');
  25620. if (!isDict(xObjects)) {
  25621. continue;
  25622. }
  25623. var xObjectsKeys = xObjects.getKeys();
  25624. for (i = 0, ii = xObjectsKeys.length; i < ii; i++) {
  25625. key = xObjectsKeys[i];
  25626. var xObject = xObjects.getRaw(key);
  25627. if (isRef(xObject)) {
  25628. if (processed[xObject.toString()]) {
  25629. continue;
  25630. }
  25631. xObject = xref.fetch(xObject);
  25632. }
  25633. if (!isStream(xObject)) {
  25634. continue;
  25635. }
  25636. if (xObject.dict.objId) {
  25637. if (processed[xObject.dict.objId]) {
  25638. continue;
  25639. }
  25640. processed[xObject.dict.objId] = true;
  25641. }
  25642. var xResources = xObject.dict.get('Resources');
  25643. if (isDict(xResources) && (!xResources.objId || !processed[xResources.objId])) {
  25644. nodes.push(xResources);
  25645. if (xResources.objId) {
  25646. processed[xResources.objId] = true;
  25647. }
  25648. }
  25649. }
  25650. }
  25651. return false;
  25652. },
  25653. buildFormXObject: function PartialEvaluator_buildFormXObject(resources, xobj, smask, operatorList, task, initialState) {
  25654. var matrix = xobj.dict.getArray('Matrix');
  25655. var bbox = xobj.dict.getArray('BBox');
  25656. var group = xobj.dict.get('Group');
  25657. if (group) {
  25658. var groupOptions = {
  25659. matrix: matrix,
  25660. bbox: bbox,
  25661. smask: smask,
  25662. isolated: false,
  25663. knockout: false
  25664. };
  25665. var groupSubtype = group.get('S');
  25666. var colorSpace;
  25667. if (isName(groupSubtype, 'Transparency')) {
  25668. groupOptions.isolated = group.get('I') || false;
  25669. groupOptions.knockout = group.get('K') || false;
  25670. colorSpace = group.has('CS') ? ColorSpace.parse(group.get('CS'), this.xref, resources) : null;
  25671. }
  25672. if (smask && smask.backdrop) {
  25673. colorSpace = colorSpace || ColorSpace.singletons.rgb;
  25674. smask.backdrop = colorSpace.getRgb(smask.backdrop, 0);
  25675. }
  25676. operatorList.addOp(OPS.beginGroup, [groupOptions]);
  25677. }
  25678. operatorList.addOp(OPS.paintFormXObjectBegin, [
  25679. matrix,
  25680. bbox
  25681. ]);
  25682. return this.getOperatorList(xobj, task, xobj.dict.get('Resources') || resources, operatorList, initialState).then(function () {
  25683. operatorList.addOp(OPS.paintFormXObjectEnd, []);
  25684. if (group) {
  25685. operatorList.addOp(OPS.endGroup, [groupOptions]);
  25686. }
  25687. });
  25688. },
  25689. buildPaintImageXObject: function PartialEvaluator_buildPaintImageXObject(resources, image, inline, operatorList, cacheKey, imageCache) {
  25690. var self = this;
  25691. var dict = image.dict;
  25692. var w = dict.get('Width', 'W');
  25693. var h = dict.get('Height', 'H');
  25694. if (!(w && isNum(w)) || !(h && isNum(h))) {
  25695. warn('Image dimensions are missing, or not numbers.');
  25696. return;
  25697. }
  25698. var maxImageSize = this.options.maxImageSize;
  25699. if (maxImageSize !== -1 && w * h > maxImageSize) {
  25700. warn('Image exceeded maximum allowed size and was removed.');
  25701. return;
  25702. }
  25703. var imageMask = dict.get('ImageMask', 'IM') || false;
  25704. var imgData, args;
  25705. if (imageMask) {
  25706. var width = dict.get('Width', 'W');
  25707. var height = dict.get('Height', 'H');
  25708. var bitStrideLength = width + 7 >> 3;
  25709. var imgArray = image.getBytes(bitStrideLength * height);
  25710. var decode = dict.getArray('Decode', 'D');
  25711. var inverseDecode = !!decode && decode[0] > 0;
  25712. imgData = PDFImage.createMask(imgArray, width, height, image instanceof DecodeStream, inverseDecode);
  25713. imgData.cached = true;
  25714. args = [imgData];
  25715. operatorList.addOp(OPS.paintImageMaskXObject, args);
  25716. if (cacheKey) {
  25717. imageCache[cacheKey] = {
  25718. fn: OPS.paintImageMaskXObject,
  25719. args: args
  25720. };
  25721. }
  25722. return;
  25723. }
  25724. var softMask = dict.get('SMask', 'SM') || false;
  25725. var mask = dict.get('Mask') || false;
  25726. var SMALL_IMAGE_DIMENSIONS = 200;
  25727. if (inline && !softMask && !mask && !(image instanceof JpegStream) && w + h < SMALL_IMAGE_DIMENSIONS) {
  25728. var imageObj = new PDFImage(this.xref, resources, image, inline, null, null);
  25729. imgData = imageObj.createImageData(true);
  25730. operatorList.addOp(OPS.paintInlineImageXObject, [imgData]);
  25731. return;
  25732. }
  25733. var useNativeImageDecoder = !this.options.disableNativeImageDecoder;
  25734. var objId = 'img_' + this.idFactory.createObjId();
  25735. operatorList.addDependency(objId);
  25736. args = [
  25737. objId,
  25738. w,
  25739. h
  25740. ];
  25741. if (useNativeImageDecoder && !softMask && !mask && image instanceof JpegStream && NativeImageDecoder.isSupported(image, this.xref, resources)) {
  25742. operatorList.addOp(OPS.paintJpegXObject, args);
  25743. this.handler.send('obj', [
  25744. objId,
  25745. this.pageIndex,
  25746. 'JpegStream',
  25747. image.getIR(this.options.forceDataSchema)
  25748. ]);
  25749. return;
  25750. }
  25751. var nativeImageDecoder = null;
  25752. if (useNativeImageDecoder && (image instanceof JpegStream || mask instanceof JpegStream || softMask instanceof JpegStream)) {
  25753. nativeImageDecoder = new NativeImageDecoder(self.xref, resources, self.handler, self.options.forceDataSchema);
  25754. }
  25755. PDFImage.buildImage(self.handler, self.xref, resources, image, inline, nativeImageDecoder).then(function (imageObj) {
  25756. var imgData = imageObj.createImageData(false);
  25757. self.handler.send('obj', [
  25758. objId,
  25759. self.pageIndex,
  25760. 'Image',
  25761. imgData
  25762. ], [imgData.data.buffer]);
  25763. }).then(undefined, function (reason) {
  25764. warn('Unable to decode image: ' + reason);
  25765. self.handler.send('obj', [
  25766. objId,
  25767. self.pageIndex,
  25768. 'Image',
  25769. null
  25770. ]);
  25771. });
  25772. operatorList.addOp(OPS.paintImageXObject, args);
  25773. if (cacheKey) {
  25774. imageCache[cacheKey] = {
  25775. fn: OPS.paintImageXObject,
  25776. args: args
  25777. };
  25778. }
  25779. },
  25780. handleSMask: function PartialEvaluator_handleSmask(smask, resources, operatorList, task, stateManager) {
  25781. var smaskContent = smask.get('G');
  25782. var smaskOptions = {
  25783. subtype: smask.get('S').name,
  25784. backdrop: smask.get('BC')
  25785. };
  25786. var transferObj = smask.get('TR');
  25787. if (isPDFFunction(transferObj)) {
  25788. var transferFn = PDFFunction.parse(this.xref, transferObj);
  25789. var transferMap = new Uint8Array(256);
  25790. var tmp = new Float32Array(1);
  25791. for (var i = 0; i < 256; i++) {
  25792. tmp[0] = i / 255;
  25793. transferFn(tmp, 0, tmp, 0);
  25794. transferMap[i] = tmp[0] * 255 | 0;
  25795. }
  25796. smaskOptions.transferMap = transferMap;
  25797. }
  25798. return this.buildFormXObject(resources, smaskContent, smaskOptions, operatorList, task, stateManager.state.clone());
  25799. },
  25800. handleTilingType: function PartialEvaluator_handleTilingType(fn, args, resources, pattern, patternDict, operatorList, task) {
  25801. var tilingOpList = new OperatorList();
  25802. var resourcesArray = [
  25803. patternDict.get('Resources'),
  25804. resources
  25805. ];
  25806. var patternResources = Dict.merge(this.xref, resourcesArray);
  25807. return this.getOperatorList(pattern, task, patternResources, tilingOpList).then(function () {
  25808. operatorList.addDependencies(tilingOpList.dependencies);
  25809. operatorList.addOp(fn, getTilingPatternIR({
  25810. fnArray: tilingOpList.fnArray,
  25811. argsArray: tilingOpList.argsArray
  25812. }, patternDict, args));
  25813. });
  25814. },
  25815. handleSetFont: function PartialEvaluator_handleSetFont(resources, fontArgs, fontRef, operatorList, task, state) {
  25816. var fontName;
  25817. if (fontArgs) {
  25818. fontArgs = fontArgs.slice();
  25819. fontName = fontArgs[0].name;
  25820. }
  25821. var self = this;
  25822. return this.loadFont(fontName, fontRef, this.xref, resources).then(function (translated) {
  25823. if (!translated.font.isType3Font) {
  25824. return translated;
  25825. }
  25826. return translated.loadType3Data(self, resources, operatorList, task).then(function () {
  25827. return translated;
  25828. }, function (reason) {
  25829. self.handler.send('UnsupportedFeature', { featureId: UNSUPPORTED_FEATURES.font });
  25830. return new TranslatedFont('g_font_error', new ErrorFont('Type3 font load error: ' + reason), translated.font);
  25831. });
  25832. }).then(function (translated) {
  25833. state.font = translated.font;
  25834. translated.send(self.handler);
  25835. return translated.loadedName;
  25836. });
  25837. },
  25838. handleText: function PartialEvaluator_handleText(chars, state) {
  25839. var font = state.font;
  25840. var glyphs = font.charsToGlyphs(chars);
  25841. var isAddToPathSet = !!(state.textRenderingMode & TextRenderingMode.ADD_TO_PATH_FLAG);
  25842. if (font.data && (isAddToPathSet || this.options.disableFontFace)) {
  25843. var buildPath = function (fontChar) {
  25844. if (!font.renderer.hasBuiltPath(fontChar)) {
  25845. var path = font.renderer.getPathJs(fontChar);
  25846. this.handler.send('commonobj', [
  25847. font.loadedName + '_path_' + fontChar,
  25848. 'FontPath',
  25849. path
  25850. ]);
  25851. }
  25852. }.bind(this);
  25853. for (var i = 0, ii = glyphs.length; i < ii; i++) {
  25854. var glyph = glyphs[i];
  25855. buildPath(glyph.fontChar);
  25856. var accent = glyph.accent;
  25857. if (accent && accent.fontChar) {
  25858. buildPath(accent.fontChar);
  25859. }
  25860. }
  25861. }
  25862. return glyphs;
  25863. },
  25864. setGState: function PartialEvaluator_setGState(resources, gState, operatorList, task, xref, stateManager) {
  25865. var gStateObj = [];
  25866. var gStateKeys = gState.getKeys();
  25867. var self = this;
  25868. var promise = Promise.resolve();
  25869. for (var i = 0, ii = gStateKeys.length; i < ii; i++) {
  25870. var key = gStateKeys[i];
  25871. var value = gState.get(key);
  25872. switch (key) {
  25873. case 'Type':
  25874. break;
  25875. case 'LW':
  25876. case 'LC':
  25877. case 'LJ':
  25878. case 'ML':
  25879. case 'D':
  25880. case 'RI':
  25881. case 'FL':
  25882. case 'CA':
  25883. case 'ca':
  25884. gStateObj.push([
  25885. key,
  25886. value
  25887. ]);
  25888. break;
  25889. case 'Font':
  25890. promise = promise.then(function () {
  25891. return self.handleSetFont(resources, null, value[0], operatorList, task, stateManager.state).then(function (loadedName) {
  25892. operatorList.addDependency(loadedName);
  25893. gStateObj.push([
  25894. key,
  25895. [
  25896. loadedName,
  25897. value[1]
  25898. ]
  25899. ]);
  25900. });
  25901. });
  25902. break;
  25903. case 'BM':
  25904. gStateObj.push([
  25905. key,
  25906. value
  25907. ]);
  25908. break;
  25909. case 'SMask':
  25910. if (isName(value, 'None')) {
  25911. gStateObj.push([
  25912. key,
  25913. false
  25914. ]);
  25915. break;
  25916. }
  25917. if (isDict(value)) {
  25918. promise = promise.then(function (dict) {
  25919. return self.handleSMask(dict, resources, operatorList, task, stateManager);
  25920. }.bind(this, value));
  25921. gStateObj.push([
  25922. key,
  25923. true
  25924. ]);
  25925. } else {
  25926. warn('Unsupported SMask type');
  25927. }
  25928. break;
  25929. case 'OP':
  25930. case 'op':
  25931. case 'OPM':
  25932. case 'BG':
  25933. case 'BG2':
  25934. case 'UCR':
  25935. case 'UCR2':
  25936. case 'TR':
  25937. case 'TR2':
  25938. case 'HT':
  25939. case 'SM':
  25940. case 'SA':
  25941. case 'AIS':
  25942. case 'TK':
  25943. info('graphic state operator ' + key);
  25944. break;
  25945. default:
  25946. info('Unknown graphic state operator ' + key);
  25947. break;
  25948. }
  25949. }
  25950. return promise.then(function () {
  25951. if (gStateObj.length > 0) {
  25952. operatorList.addOp(OPS.setGState, [gStateObj]);
  25953. }
  25954. });
  25955. },
  25956. loadFont: function PartialEvaluator_loadFont(fontName, font, xref, resources) {
  25957. function errorFont() {
  25958. return Promise.resolve(new TranslatedFont('g_font_error', new ErrorFont('Font ' + fontName + ' is not available'), font));
  25959. }
  25960. var fontRef;
  25961. if (font) {
  25962. assert(isRef(font));
  25963. fontRef = font;
  25964. } else {
  25965. var fontRes = resources.get('Font');
  25966. if (fontRes) {
  25967. fontRef = fontRes.getRaw(fontName);
  25968. } else {
  25969. warn('fontRes not available');
  25970. return errorFont();
  25971. }
  25972. }
  25973. if (!fontRef) {
  25974. warn('fontRef not available');
  25975. return errorFont();
  25976. }
  25977. if (this.fontCache.has(fontRef)) {
  25978. return this.fontCache.get(fontRef);
  25979. }
  25980. font = xref.fetchIfRef(fontRef);
  25981. if (!isDict(font)) {
  25982. return errorFont();
  25983. }
  25984. if (font.translated) {
  25985. return font.translated;
  25986. }
  25987. var fontCapability = createPromiseCapability();
  25988. var preEvaluatedFont = this.preEvaluateFont(font, xref);
  25989. var descriptor = preEvaluatedFont.descriptor;
  25990. var fontRefIsRef = isRef(fontRef), fontID;
  25991. if (fontRefIsRef) {
  25992. fontID = fontRef.toString();
  25993. }
  25994. if (isDict(descriptor)) {
  25995. if (!descriptor.fontAliases) {
  25996. descriptor.fontAliases = Object.create(null);
  25997. }
  25998. var fontAliases = descriptor.fontAliases;
  25999. var hash = preEvaluatedFont.hash;
  26000. if (fontAliases[hash]) {
  26001. var aliasFontRef = fontAliases[hash].aliasRef;
  26002. if (fontRefIsRef && aliasFontRef && this.fontCache.has(aliasFontRef)) {
  26003. this.fontCache.putAlias(fontRef, aliasFontRef);
  26004. return this.fontCache.get(fontRef);
  26005. }
  26006. } else {
  26007. fontAliases[hash] = { fontID: Font.getFontID() };
  26008. }
  26009. if (fontRefIsRef) {
  26010. fontAliases[hash].aliasRef = fontRef;
  26011. }
  26012. fontID = fontAliases[hash].fontID;
  26013. }
  26014. if (fontRefIsRef) {
  26015. this.fontCache.put(fontRef, fontCapability.promise);
  26016. } else {
  26017. if (!fontID) {
  26018. fontID = this.idFactory.createObjId();
  26019. }
  26020. this.fontCache.put('id_' + fontID, fontCapability.promise);
  26021. }
  26022. assert(fontID, 'The "fontID" must be defined.');
  26023. font.loadedName = 'g_' + this.pdfManager.docId + '_f' + fontID;
  26024. font.translated = fontCapability.promise;
  26025. var translatedPromise;
  26026. try {
  26027. translatedPromise = this.translateFont(preEvaluatedFont, xref);
  26028. } catch (e) {
  26029. translatedPromise = Promise.reject(e);
  26030. }
  26031. var self = this;
  26032. translatedPromise.then(function (translatedFont) {
  26033. if (translatedFont.fontType !== undefined) {
  26034. var xrefFontStats = xref.stats.fontTypes;
  26035. xrefFontStats[translatedFont.fontType] = true;
  26036. }
  26037. fontCapability.resolve(new TranslatedFont(font.loadedName, translatedFont, font));
  26038. }, function (reason) {
  26039. self.handler.send('UnsupportedFeature', { featureId: UNSUPPORTED_FEATURES.font });
  26040. try {
  26041. var descriptor = preEvaluatedFont.descriptor;
  26042. var fontFile3 = descriptor && descriptor.get('FontFile3');
  26043. var subtype = fontFile3 && fontFile3.get('Subtype');
  26044. var fontType = getFontType(preEvaluatedFont.type, subtype && subtype.name);
  26045. var xrefFontStats = xref.stats.fontTypes;
  26046. xrefFontStats[fontType] = true;
  26047. } catch (ex) {
  26048. }
  26049. fontCapability.resolve(new TranslatedFont(font.loadedName, new ErrorFont(reason instanceof Error ? reason.message : reason), font));
  26050. });
  26051. return fontCapability.promise;
  26052. },
  26053. buildPath: function PartialEvaluator_buildPath(operatorList, fn, args) {
  26054. var lastIndex = operatorList.length - 1;
  26055. if (!args) {
  26056. args = [];
  26057. }
  26058. if (lastIndex < 0 || operatorList.fnArray[lastIndex] !== OPS.constructPath) {
  26059. operatorList.addOp(OPS.constructPath, [
  26060. [fn],
  26061. args
  26062. ]);
  26063. } else {
  26064. var opArgs = operatorList.argsArray[lastIndex];
  26065. opArgs[0].push(fn);
  26066. Array.prototype.push.apply(opArgs[1], args);
  26067. }
  26068. },
  26069. handleColorN: function PartialEvaluator_handleColorN(operatorList, fn, args, cs, patterns, resources, task, xref) {
  26070. var patternName = args[args.length - 1];
  26071. var pattern;
  26072. if (isName(patternName) && (pattern = patterns.get(patternName.name))) {
  26073. var dict = isStream(pattern) ? pattern.dict : pattern;
  26074. var typeNum = dict.get('PatternType');
  26075. if (typeNum === TILING_PATTERN) {
  26076. var color = cs.base ? cs.base.getRgb(args, 0) : null;
  26077. return this.handleTilingType(fn, color, resources, pattern, dict, operatorList, task);
  26078. } else if (typeNum === SHADING_PATTERN) {
  26079. var shading = dict.get('Shading');
  26080. var matrix = dict.getArray('Matrix');
  26081. pattern = Pattern.parseShading(shading, matrix, xref, resources, this.handler);
  26082. operatorList.addOp(fn, pattern.getIR());
  26083. return Promise.resolve();
  26084. }
  26085. return Promise.reject('Unknown PatternType: ' + typeNum);
  26086. }
  26087. operatorList.addOp(fn, args);
  26088. return Promise.resolve();
  26089. },
  26090. getOperatorList: function PartialEvaluator_getOperatorList(stream, task, resources, operatorList, initialState) {
  26091. var self = this;
  26092. var xref = this.xref;
  26093. var imageCache = Object.create(null);
  26094. assert(operatorList);
  26095. resources = resources || Dict.empty;
  26096. var xobjs = resources.get('XObject') || Dict.empty;
  26097. var patterns = resources.get('Pattern') || Dict.empty;
  26098. var stateManager = new StateManager(initialState || new EvalState());
  26099. var preprocessor = new EvaluatorPreprocessor(stream, xref, stateManager);
  26100. var timeSlotManager = new TimeSlotManager();
  26101. return new Promise(function promiseBody(resolve, reject) {
  26102. var next = function (promise) {
  26103. promise.then(function () {
  26104. try {
  26105. promiseBody(resolve, reject);
  26106. } catch (ex) {
  26107. reject(ex);
  26108. }
  26109. }, reject);
  26110. };
  26111. task.ensureNotTerminated();
  26112. timeSlotManager.reset();
  26113. var stop, operation = {}, i, ii, cs;
  26114. while (!(stop = timeSlotManager.check())) {
  26115. operation.args = null;
  26116. if (!preprocessor.read(operation)) {
  26117. break;
  26118. }
  26119. var args = operation.args;
  26120. var fn = operation.fn;
  26121. switch (fn | 0) {
  26122. case OPS.paintXObject:
  26123. if (args[0].code) {
  26124. break;
  26125. }
  26126. var name = args[0].name;
  26127. if (!name) {
  26128. warn('XObject must be referred to by name.');
  26129. continue;
  26130. }
  26131. if (imageCache[name] !== undefined) {
  26132. operatorList.addOp(imageCache[name].fn, imageCache[name].args);
  26133. args = null;
  26134. continue;
  26135. }
  26136. var xobj = xobjs.get(name);
  26137. if (xobj) {
  26138. assert(isStream(xobj), 'XObject should be a stream');
  26139. var type = xobj.dict.get('Subtype');
  26140. assert(isName(type), 'XObject should have a Name subtype');
  26141. if (type.name === 'Form') {
  26142. stateManager.save();
  26143. next(self.buildFormXObject(resources, xobj, null, operatorList, task, stateManager.state.clone()).then(function () {
  26144. stateManager.restore();
  26145. }));
  26146. return;
  26147. } else if (type.name === 'Image') {
  26148. self.buildPaintImageXObject(resources, xobj, false, operatorList, name, imageCache);
  26149. args = null;
  26150. continue;
  26151. } else if (type.name === 'PS') {
  26152. info('Ignored XObject subtype PS');
  26153. continue;
  26154. } else {
  26155. error('Unhandled XObject subtype ' + type.name);
  26156. }
  26157. }
  26158. break;
  26159. case OPS.setFont:
  26160. var fontSize = args[1];
  26161. next(self.handleSetFont(resources, args, null, operatorList, task, stateManager.state).then(function (loadedName) {
  26162. operatorList.addDependency(loadedName);
  26163. operatorList.addOp(OPS.setFont, [
  26164. loadedName,
  26165. fontSize
  26166. ]);
  26167. }));
  26168. return;
  26169. case OPS.endInlineImage:
  26170. var cacheKey = args[0].cacheKey;
  26171. if (cacheKey) {
  26172. var cacheEntry = imageCache[cacheKey];
  26173. if (cacheEntry !== undefined) {
  26174. operatorList.addOp(cacheEntry.fn, cacheEntry.args);
  26175. args = null;
  26176. continue;
  26177. }
  26178. }
  26179. self.buildPaintImageXObject(resources, args[0], true, operatorList, cacheKey, imageCache);
  26180. args = null;
  26181. continue;
  26182. case OPS.showText:
  26183. args[0] = self.handleText(args[0], stateManager.state);
  26184. break;
  26185. case OPS.showSpacedText:
  26186. var arr = args[0];
  26187. var combinedGlyphs = [];
  26188. var arrLength = arr.length;
  26189. var state = stateManager.state;
  26190. for (i = 0; i < arrLength; ++i) {
  26191. var arrItem = arr[i];
  26192. if (isString(arrItem)) {
  26193. Array.prototype.push.apply(combinedGlyphs, self.handleText(arrItem, state));
  26194. } else if (isNum(arrItem)) {
  26195. combinedGlyphs.push(arrItem);
  26196. }
  26197. }
  26198. args[0] = combinedGlyphs;
  26199. fn = OPS.showText;
  26200. break;
  26201. case OPS.nextLineShowText:
  26202. operatorList.addOp(OPS.nextLine);
  26203. args[0] = self.handleText(args[0], stateManager.state);
  26204. fn = OPS.showText;
  26205. break;
  26206. case OPS.nextLineSetSpacingShowText:
  26207. operatorList.addOp(OPS.nextLine);
  26208. operatorList.addOp(OPS.setWordSpacing, [args.shift()]);
  26209. operatorList.addOp(OPS.setCharSpacing, [args.shift()]);
  26210. args[0] = self.handleText(args[0], stateManager.state);
  26211. fn = OPS.showText;
  26212. break;
  26213. case OPS.setTextRenderingMode:
  26214. stateManager.state.textRenderingMode = args[0];
  26215. break;
  26216. case OPS.setFillColorSpace:
  26217. stateManager.state.fillColorSpace = ColorSpace.parse(args[0], xref, resources);
  26218. continue;
  26219. case OPS.setStrokeColorSpace:
  26220. stateManager.state.strokeColorSpace = ColorSpace.parse(args[0], xref, resources);
  26221. continue;
  26222. case OPS.setFillColor:
  26223. cs = stateManager.state.fillColorSpace;
  26224. args = cs.getRgb(args, 0);
  26225. fn = OPS.setFillRGBColor;
  26226. break;
  26227. case OPS.setStrokeColor:
  26228. cs = stateManager.state.strokeColorSpace;
  26229. args = cs.getRgb(args, 0);
  26230. fn = OPS.setStrokeRGBColor;
  26231. break;
  26232. case OPS.setFillGray:
  26233. stateManager.state.fillColorSpace = ColorSpace.singletons.gray;
  26234. args = ColorSpace.singletons.gray.getRgb(args, 0);
  26235. fn = OPS.setFillRGBColor;
  26236. break;
  26237. case OPS.setStrokeGray:
  26238. stateManager.state.strokeColorSpace = ColorSpace.singletons.gray;
  26239. args = ColorSpace.singletons.gray.getRgb(args, 0);
  26240. fn = OPS.setStrokeRGBColor;
  26241. break;
  26242. case OPS.setFillCMYKColor:
  26243. stateManager.state.fillColorSpace = ColorSpace.singletons.cmyk;
  26244. args = ColorSpace.singletons.cmyk.getRgb(args, 0);
  26245. fn = OPS.setFillRGBColor;
  26246. break;
  26247. case OPS.setStrokeCMYKColor:
  26248. stateManager.state.strokeColorSpace = ColorSpace.singletons.cmyk;
  26249. args = ColorSpace.singletons.cmyk.getRgb(args, 0);
  26250. fn = OPS.setStrokeRGBColor;
  26251. break;
  26252. case OPS.setFillRGBColor:
  26253. stateManager.state.fillColorSpace = ColorSpace.singletons.rgb;
  26254. args = ColorSpace.singletons.rgb.getRgb(args, 0);
  26255. break;
  26256. case OPS.setStrokeRGBColor:
  26257. stateManager.state.strokeColorSpace = ColorSpace.singletons.rgb;
  26258. args = ColorSpace.singletons.rgb.getRgb(args, 0);
  26259. break;
  26260. case OPS.setFillColorN:
  26261. cs = stateManager.state.fillColorSpace;
  26262. if (cs.name === 'Pattern') {
  26263. next(self.handleColorN(operatorList, OPS.setFillColorN, args, cs, patterns, resources, task, xref));
  26264. return;
  26265. }
  26266. args = cs.getRgb(args, 0);
  26267. fn = OPS.setFillRGBColor;
  26268. break;
  26269. case OPS.setStrokeColorN:
  26270. cs = stateManager.state.strokeColorSpace;
  26271. if (cs.name === 'Pattern') {
  26272. next(self.handleColorN(operatorList, OPS.setStrokeColorN, args, cs, patterns, resources, task, xref));
  26273. return;
  26274. }
  26275. args = cs.getRgb(args, 0);
  26276. fn = OPS.setStrokeRGBColor;
  26277. break;
  26278. case OPS.shadingFill:
  26279. var shadingRes = resources.get('Shading');
  26280. if (!shadingRes) {
  26281. error('No shading resource found');
  26282. }
  26283. var shading = shadingRes.get(args[0].name);
  26284. if (!shading) {
  26285. error('No shading object found');
  26286. }
  26287. var shadingFill = Pattern.parseShading(shading, null, xref, resources, self.handler);
  26288. var patternIR = shadingFill.getIR();
  26289. args = [patternIR];
  26290. fn = OPS.shadingFill;
  26291. break;
  26292. case OPS.setGState:
  26293. var dictName = args[0];
  26294. var extGState = resources.get('ExtGState');
  26295. if (!isDict(extGState) || !extGState.has(dictName.name)) {
  26296. break;
  26297. }
  26298. var gState = extGState.get(dictName.name);
  26299. next(self.setGState(resources, gState, operatorList, task, xref, stateManager));
  26300. return;
  26301. case OPS.moveTo:
  26302. case OPS.lineTo:
  26303. case OPS.curveTo:
  26304. case OPS.curveTo2:
  26305. case OPS.curveTo3:
  26306. case OPS.closePath:
  26307. self.buildPath(operatorList, fn, args);
  26308. continue;
  26309. case OPS.rectangle:
  26310. self.buildPath(operatorList, fn, args);
  26311. continue;
  26312. case OPS.markPoint:
  26313. case OPS.markPointProps:
  26314. case OPS.beginMarkedContent:
  26315. case OPS.beginMarkedContentProps:
  26316. case OPS.endMarkedContent:
  26317. case OPS.beginCompat:
  26318. case OPS.endCompat:
  26319. continue;
  26320. default:
  26321. if (args !== null) {
  26322. for (i = 0, ii = args.length; i < ii; i++) {
  26323. if (args[i] instanceof Dict) {
  26324. break;
  26325. }
  26326. }
  26327. if (i < ii) {
  26328. warn('getOperatorList - ignoring operator: ' + fn);
  26329. continue;
  26330. }
  26331. }
  26332. }
  26333. operatorList.addOp(fn, args);
  26334. }
  26335. if (stop) {
  26336. next(deferred);
  26337. return;
  26338. }
  26339. for (i = 0, ii = preprocessor.savedStatesDepth; i < ii; i++) {
  26340. operatorList.addOp(OPS.restore, []);
  26341. }
  26342. resolve();
  26343. });
  26344. },
  26345. getTextContent: function PartialEvaluator_getTextContent(stream, task, resources, stateManager, normalizeWhitespace, combineTextItems) {
  26346. stateManager = stateManager || new StateManager(new TextState());
  26347. var WhitespaceRegexp = /\s/g;
  26348. var textContent = {
  26349. items: [],
  26350. styles: Object.create(null)
  26351. };
  26352. var textContentItem = {
  26353. initialized: false,
  26354. str: [],
  26355. width: 0,
  26356. height: 0,
  26357. vertical: false,
  26358. lastAdvanceWidth: 0,
  26359. lastAdvanceHeight: 0,
  26360. textAdvanceScale: 0,
  26361. spaceWidth: 0,
  26362. fakeSpaceMin: Infinity,
  26363. fakeMultiSpaceMin: Infinity,
  26364. fakeMultiSpaceMax: -0,
  26365. textRunBreakAllowed: false,
  26366. transform: null,
  26367. fontName: null
  26368. };
  26369. var SPACE_FACTOR = 0.3;
  26370. var MULTI_SPACE_FACTOR = 1.5;
  26371. var MULTI_SPACE_FACTOR_MAX = 4;
  26372. var self = this;
  26373. var xref = this.xref;
  26374. resources = xref.fetchIfRef(resources) || Dict.empty;
  26375. var xobjs = null;
  26376. var xobjsCache = Object.create(null);
  26377. var preprocessor = new EvaluatorPreprocessor(stream, xref, stateManager);
  26378. var textState;
  26379. function ensureTextContentItem() {
  26380. if (textContentItem.initialized) {
  26381. return textContentItem;
  26382. }
  26383. var font = textState.font;
  26384. if (!(font.loadedName in textContent.styles)) {
  26385. textContent.styles[font.loadedName] = {
  26386. fontFamily: font.fallbackName,
  26387. ascent: font.ascent,
  26388. descent: font.descent,
  26389. vertical: font.vertical
  26390. };
  26391. }
  26392. textContentItem.fontName = font.loadedName;
  26393. var tsm = [
  26394. textState.fontSize * textState.textHScale,
  26395. 0,
  26396. 0,
  26397. textState.fontSize,
  26398. 0,
  26399. textState.textRise
  26400. ];
  26401. if (font.isType3Font && textState.fontMatrix !== FONT_IDENTITY_MATRIX && textState.fontSize === 1) {
  26402. var glyphHeight = font.bbox[3] - font.bbox[1];
  26403. if (glyphHeight > 0) {
  26404. glyphHeight = glyphHeight * textState.fontMatrix[3];
  26405. tsm[3] *= glyphHeight;
  26406. }
  26407. }
  26408. var trm = Util.transform(textState.ctm, Util.transform(textState.textMatrix, tsm));
  26409. textContentItem.transform = trm;
  26410. if (!font.vertical) {
  26411. textContentItem.width = 0;
  26412. textContentItem.height = Math.sqrt(trm[2] * trm[2] + trm[3] * trm[3]);
  26413. textContentItem.vertical = false;
  26414. } else {
  26415. textContentItem.width = Math.sqrt(trm[0] * trm[0] + trm[1] * trm[1]);
  26416. textContentItem.height = 0;
  26417. textContentItem.vertical = true;
  26418. }
  26419. var a = textState.textLineMatrix[0];
  26420. var b = textState.textLineMatrix[1];
  26421. var scaleLineX = Math.sqrt(a * a + b * b);
  26422. a = textState.ctm[0];
  26423. b = textState.ctm[1];
  26424. var scaleCtmX = Math.sqrt(a * a + b * b);
  26425. textContentItem.textAdvanceScale = scaleCtmX * scaleLineX;
  26426. textContentItem.lastAdvanceWidth = 0;
  26427. textContentItem.lastAdvanceHeight = 0;
  26428. var spaceWidth = font.spaceWidth / 1000 * textState.fontSize;
  26429. if (spaceWidth) {
  26430. textContentItem.spaceWidth = spaceWidth;
  26431. textContentItem.fakeSpaceMin = spaceWidth * SPACE_FACTOR;
  26432. textContentItem.fakeMultiSpaceMin = spaceWidth * MULTI_SPACE_FACTOR;
  26433. textContentItem.fakeMultiSpaceMax = spaceWidth * MULTI_SPACE_FACTOR_MAX;
  26434. textContentItem.textRunBreakAllowed = !font.isMonospace;
  26435. } else {
  26436. textContentItem.spaceWidth = 0;
  26437. textContentItem.fakeSpaceMin = Infinity;
  26438. textContentItem.fakeMultiSpaceMin = Infinity;
  26439. textContentItem.fakeMultiSpaceMax = 0;
  26440. textContentItem.textRunBreakAllowed = false;
  26441. }
  26442. textContentItem.initialized = true;
  26443. return textContentItem;
  26444. }
  26445. function replaceWhitespace(str) {
  26446. var i = 0, ii = str.length, code;
  26447. while (i < ii && (code = str.charCodeAt(i)) >= 0x20 && code <= 0x7F) {
  26448. i++;
  26449. }
  26450. return i < ii ? str.replace(WhitespaceRegexp, ' ') : str;
  26451. }
  26452. function runBidiTransform(textChunk) {
  26453. var str = textChunk.str.join('');
  26454. var bidiResult = bidi(str, -1, textChunk.vertical);
  26455. return {
  26456. str: normalizeWhitespace ? replaceWhitespace(bidiResult.str) : bidiResult.str,
  26457. dir: bidiResult.dir,
  26458. width: textChunk.width,
  26459. height: textChunk.height,
  26460. transform: textChunk.transform,
  26461. fontName: textChunk.fontName
  26462. };
  26463. }
  26464. function handleSetFont(fontName, fontRef) {
  26465. return self.loadFont(fontName, fontRef, xref, resources).then(function (translated) {
  26466. textState.font = translated.font;
  26467. textState.fontMatrix = translated.font.fontMatrix || FONT_IDENTITY_MATRIX;
  26468. });
  26469. }
  26470. function buildTextContentItem(chars) {
  26471. var font = textState.font;
  26472. var textChunk = ensureTextContentItem();
  26473. var width = 0;
  26474. var height = 0;
  26475. var glyphs = font.charsToGlyphs(chars);
  26476. for (var i = 0; i < glyphs.length; i++) {
  26477. var glyph = glyphs[i];
  26478. var glyphWidth = null;
  26479. if (font.vertical && glyph.vmetric) {
  26480. glyphWidth = glyph.vmetric[0];
  26481. } else {
  26482. glyphWidth = glyph.width;
  26483. }
  26484. var glyphUnicode = glyph.unicode;
  26485. var NormalizedUnicodes = getNormalizedUnicodes();
  26486. if (NormalizedUnicodes[glyphUnicode] !== undefined) {
  26487. glyphUnicode = NormalizedUnicodes[glyphUnicode];
  26488. }
  26489. glyphUnicode = reverseIfRtl(glyphUnicode);
  26490. var charSpacing = textState.charSpacing;
  26491. if (glyph.isSpace) {
  26492. var wordSpacing = textState.wordSpacing;
  26493. charSpacing += wordSpacing;
  26494. if (wordSpacing > 0) {
  26495. addFakeSpaces(wordSpacing, textChunk.str);
  26496. }
  26497. }
  26498. var tx = 0;
  26499. var ty = 0;
  26500. if (!font.vertical) {
  26501. var w0 = glyphWidth * textState.fontMatrix[0];
  26502. tx = (w0 * textState.fontSize + charSpacing) * textState.textHScale;
  26503. width += tx;
  26504. } else {
  26505. var w1 = glyphWidth * textState.fontMatrix[0];
  26506. ty = w1 * textState.fontSize + charSpacing;
  26507. height += ty;
  26508. }
  26509. textState.translateTextMatrix(tx, ty);
  26510. textChunk.str.push(glyphUnicode);
  26511. }
  26512. if (!font.vertical) {
  26513. textChunk.lastAdvanceWidth = width;
  26514. textChunk.width += width;
  26515. } else {
  26516. textChunk.lastAdvanceHeight = height;
  26517. textChunk.height += Math.abs(height);
  26518. }
  26519. return textChunk;
  26520. }
  26521. function addFakeSpaces(width, strBuf) {
  26522. if (width < textContentItem.fakeSpaceMin) {
  26523. return;
  26524. }
  26525. if (width < textContentItem.fakeMultiSpaceMin) {
  26526. strBuf.push(' ');
  26527. return;
  26528. }
  26529. var fakeSpaces = Math.round(width / textContentItem.spaceWidth);
  26530. while (fakeSpaces-- > 0) {
  26531. strBuf.push(' ');
  26532. }
  26533. }
  26534. function flushTextContentItem() {
  26535. if (!textContentItem.initialized) {
  26536. return;
  26537. }
  26538. textContentItem.width *= textContentItem.textAdvanceScale;
  26539. textContentItem.height *= textContentItem.textAdvanceScale;
  26540. textContent.items.push(runBidiTransform(textContentItem));
  26541. textContentItem.initialized = false;
  26542. textContentItem.str.length = 0;
  26543. }
  26544. var timeSlotManager = new TimeSlotManager();
  26545. return new Promise(function promiseBody(resolve, reject) {
  26546. var next = function (promise) {
  26547. promise.then(function () {
  26548. try {
  26549. promiseBody(resolve, reject);
  26550. } catch (ex) {
  26551. reject(ex);
  26552. }
  26553. }, reject);
  26554. };
  26555. task.ensureNotTerminated();
  26556. timeSlotManager.reset();
  26557. var stop, operation = {}, args = [];
  26558. while (!(stop = timeSlotManager.check())) {
  26559. args.length = 0;
  26560. operation.args = args;
  26561. if (!preprocessor.read(operation)) {
  26562. break;
  26563. }
  26564. textState = stateManager.state;
  26565. var fn = operation.fn;
  26566. args = operation.args;
  26567. var advance, diff;
  26568. switch (fn | 0) {
  26569. case OPS.setFont:
  26570. var fontNameArg = args[0].name, fontSizeArg = args[1];
  26571. if (textState.font && fontNameArg === textState.fontName && fontSizeArg === textState.fontSize) {
  26572. break;
  26573. }
  26574. flushTextContentItem();
  26575. textState.fontName = fontNameArg;
  26576. textState.fontSize = fontSizeArg;
  26577. next(handleSetFont(fontNameArg, null));
  26578. return;
  26579. case OPS.setTextRise:
  26580. flushTextContentItem();
  26581. textState.textRise = args[0];
  26582. break;
  26583. case OPS.setHScale:
  26584. flushTextContentItem();
  26585. textState.textHScale = args[0] / 100;
  26586. break;
  26587. case OPS.setLeading:
  26588. flushTextContentItem();
  26589. textState.leading = args[0];
  26590. break;
  26591. case OPS.moveText:
  26592. var isSameTextLine = !textState.font ? false : (textState.font.vertical ? args[0] : args[1]) === 0;
  26593. advance = args[0] - args[1];
  26594. if (combineTextItems && isSameTextLine && textContentItem.initialized && advance > 0 && advance <= textContentItem.fakeMultiSpaceMax) {
  26595. textState.translateTextLineMatrix(args[0], args[1]);
  26596. textContentItem.width += args[0] - textContentItem.lastAdvanceWidth;
  26597. textContentItem.height += args[1] - textContentItem.lastAdvanceHeight;
  26598. diff = args[0] - textContentItem.lastAdvanceWidth - (args[1] - textContentItem.lastAdvanceHeight);
  26599. addFakeSpaces(diff, textContentItem.str);
  26600. break;
  26601. }
  26602. flushTextContentItem();
  26603. textState.translateTextLineMatrix(args[0], args[1]);
  26604. textState.textMatrix = textState.textLineMatrix.slice();
  26605. break;
  26606. case OPS.setLeadingMoveText:
  26607. flushTextContentItem();
  26608. textState.leading = -args[1];
  26609. textState.translateTextLineMatrix(args[0], args[1]);
  26610. textState.textMatrix = textState.textLineMatrix.slice();
  26611. break;
  26612. case OPS.nextLine:
  26613. flushTextContentItem();
  26614. textState.carriageReturn();
  26615. break;
  26616. case OPS.setTextMatrix:
  26617. advance = textState.calcTextLineMatrixAdvance(args[0], args[1], args[2], args[3], args[4], args[5]);
  26618. if (combineTextItems && advance !== null && textContentItem.initialized && advance.value > 0 && advance.value <= textContentItem.fakeMultiSpaceMax) {
  26619. textState.translateTextLineMatrix(advance.width, advance.height);
  26620. textContentItem.width += advance.width - textContentItem.lastAdvanceWidth;
  26621. textContentItem.height += advance.height - textContentItem.lastAdvanceHeight;
  26622. diff = advance.width - textContentItem.lastAdvanceWidth - (advance.height - textContentItem.lastAdvanceHeight);
  26623. addFakeSpaces(diff, textContentItem.str);
  26624. break;
  26625. }
  26626. flushTextContentItem();
  26627. textState.setTextMatrix(args[0], args[1], args[2], args[3], args[4], args[5]);
  26628. textState.setTextLineMatrix(args[0], args[1], args[2], args[3], args[4], args[5]);
  26629. break;
  26630. case OPS.setCharSpacing:
  26631. textState.charSpacing = args[0];
  26632. break;
  26633. case OPS.setWordSpacing:
  26634. textState.wordSpacing = args[0];
  26635. break;
  26636. case OPS.beginText:
  26637. flushTextContentItem();
  26638. textState.textMatrix = IDENTITY_MATRIX.slice();
  26639. textState.textLineMatrix = IDENTITY_MATRIX.slice();
  26640. break;
  26641. case OPS.showSpacedText:
  26642. var items = args[0];
  26643. var offset;
  26644. for (var j = 0, jj = items.length; j < jj; j++) {
  26645. if (typeof items[j] === 'string') {
  26646. buildTextContentItem(items[j]);
  26647. } else if (isNum(items[j])) {
  26648. ensureTextContentItem();
  26649. advance = items[j] * textState.fontSize / 1000;
  26650. var breakTextRun = false;
  26651. if (textState.font.vertical) {
  26652. offset = advance;
  26653. textState.translateTextMatrix(0, offset);
  26654. breakTextRun = textContentItem.textRunBreakAllowed && advance > textContentItem.fakeMultiSpaceMax;
  26655. if (!breakTextRun) {
  26656. textContentItem.height += offset;
  26657. }
  26658. } else {
  26659. advance = -advance;
  26660. offset = advance * textState.textHScale;
  26661. textState.translateTextMatrix(offset, 0);
  26662. breakTextRun = textContentItem.textRunBreakAllowed && advance > textContentItem.fakeMultiSpaceMax;
  26663. if (!breakTextRun) {
  26664. textContentItem.width += offset;
  26665. }
  26666. }
  26667. if (breakTextRun) {
  26668. flushTextContentItem();
  26669. } else if (advance > 0) {
  26670. addFakeSpaces(advance, textContentItem.str);
  26671. }
  26672. }
  26673. }
  26674. break;
  26675. case OPS.showText:
  26676. buildTextContentItem(args[0]);
  26677. break;
  26678. case OPS.nextLineShowText:
  26679. flushTextContentItem();
  26680. textState.carriageReturn();
  26681. buildTextContentItem(args[0]);
  26682. break;
  26683. case OPS.nextLineSetSpacingShowText:
  26684. flushTextContentItem();
  26685. textState.wordSpacing = args[0];
  26686. textState.charSpacing = args[1];
  26687. textState.carriageReturn();
  26688. buildTextContentItem(args[2]);
  26689. break;
  26690. case OPS.paintXObject:
  26691. flushTextContentItem();
  26692. if (args[0].code) {
  26693. break;
  26694. }
  26695. if (!xobjs) {
  26696. xobjs = resources.get('XObject') || Dict.empty;
  26697. }
  26698. var name = args[0].name;
  26699. if (xobjsCache.key === name) {
  26700. if (xobjsCache.texts) {
  26701. Util.appendToArray(textContent.items, xobjsCache.texts.items);
  26702. Util.extendObj(textContent.styles, xobjsCache.texts.styles);
  26703. }
  26704. break;
  26705. }
  26706. var xobj = xobjs.get(name);
  26707. if (!xobj) {
  26708. break;
  26709. }
  26710. assert(isStream(xobj), 'XObject should be a stream');
  26711. var type = xobj.dict.get('Subtype');
  26712. assert(isName(type), 'XObject should have a Name subtype');
  26713. if ('Form' !== type.name) {
  26714. xobjsCache.key = name;
  26715. xobjsCache.texts = null;
  26716. break;
  26717. }
  26718. stateManager.save();
  26719. var matrix = xobj.dict.getArray('Matrix');
  26720. if (isArray(matrix) && matrix.length === 6) {
  26721. stateManager.transform(matrix);
  26722. }
  26723. next(self.getTextContent(xobj, task, xobj.dict.get('Resources') || resources, stateManager, normalizeWhitespace, combineTextItems).then(function (formTextContent) {
  26724. Util.appendToArray(textContent.items, formTextContent.items);
  26725. Util.extendObj(textContent.styles, formTextContent.styles);
  26726. stateManager.restore();
  26727. xobjsCache.key = name;
  26728. xobjsCache.texts = formTextContent;
  26729. }));
  26730. return;
  26731. case OPS.setGState:
  26732. flushTextContentItem();
  26733. var dictName = args[0];
  26734. var extGState = resources.get('ExtGState');
  26735. if (!isDict(extGState) || !isName(dictName)) {
  26736. break;
  26737. }
  26738. var gState = extGState.get(dictName.name);
  26739. if (!isDict(gState)) {
  26740. break;
  26741. }
  26742. var gStateFont = gState.get('Font');
  26743. if (gStateFont) {
  26744. textState.fontName = null;
  26745. textState.fontSize = gStateFont[1];
  26746. next(handleSetFont(null, gStateFont[0]));
  26747. return;
  26748. }
  26749. break;
  26750. }
  26751. }
  26752. if (stop) {
  26753. next(deferred);
  26754. return;
  26755. }
  26756. flushTextContentItem();
  26757. resolve(textContent);
  26758. });
  26759. },
  26760. extractDataStructures: function PartialEvaluator_extractDataStructures(dict, baseDict, xref, properties) {
  26761. var toUnicode = dict.get('ToUnicode') || baseDict.get('ToUnicode');
  26762. var toUnicodePromise = toUnicode ? this.readToUnicode(toUnicode) : Promise.resolve(undefined);
  26763. if (properties.composite) {
  26764. var cidSystemInfo = dict.get('CIDSystemInfo');
  26765. if (isDict(cidSystemInfo)) {
  26766. properties.cidSystemInfo = {
  26767. registry: cidSystemInfo.get('Registry'),
  26768. ordering: cidSystemInfo.get('Ordering'),
  26769. supplement: cidSystemInfo.get('Supplement')
  26770. };
  26771. }
  26772. var cidToGidMap = dict.get('CIDToGIDMap');
  26773. if (isStream(cidToGidMap)) {
  26774. properties.cidToGidMap = this.readCidToGidMap(cidToGidMap);
  26775. }
  26776. }
  26777. var differences = [];
  26778. var baseEncodingName = null;
  26779. var encoding;
  26780. if (dict.has('Encoding')) {
  26781. encoding = dict.get('Encoding');
  26782. if (isDict(encoding)) {
  26783. baseEncodingName = encoding.get('BaseEncoding');
  26784. baseEncodingName = isName(baseEncodingName) ? baseEncodingName.name : null;
  26785. if (encoding.has('Differences')) {
  26786. var diffEncoding = encoding.get('Differences');
  26787. var index = 0;
  26788. for (var j = 0, jj = diffEncoding.length; j < jj; j++) {
  26789. var data = xref.fetchIfRef(diffEncoding[j]);
  26790. if (isNum(data)) {
  26791. index = data;
  26792. } else if (isName(data)) {
  26793. differences[index++] = data.name;
  26794. } else {
  26795. error('Invalid entry in \'Differences\' array: ' + data);
  26796. }
  26797. }
  26798. }
  26799. } else if (isName(encoding)) {
  26800. baseEncodingName = encoding.name;
  26801. } else {
  26802. error('Encoding is not a Name nor a Dict');
  26803. }
  26804. if (baseEncodingName !== 'MacRomanEncoding' && baseEncodingName !== 'MacExpertEncoding' && baseEncodingName !== 'WinAnsiEncoding') {
  26805. baseEncodingName = null;
  26806. }
  26807. }
  26808. if (baseEncodingName) {
  26809. properties.defaultEncoding = getEncoding(baseEncodingName).slice();
  26810. } else {
  26811. var isSymbolicFont = !!(properties.flags & FontFlags.Symbolic);
  26812. var isNonsymbolicFont = !!(properties.flags & FontFlags.Nonsymbolic);
  26813. encoding = StandardEncoding;
  26814. if (properties.type === 'TrueType' && !isNonsymbolicFont) {
  26815. encoding = WinAnsiEncoding;
  26816. }
  26817. if (isSymbolicFont) {
  26818. encoding = MacRomanEncoding;
  26819. if (!properties.file) {
  26820. if (/Symbol/i.test(properties.name)) {
  26821. encoding = SymbolSetEncoding;
  26822. } else if (/Dingbats/i.test(properties.name)) {
  26823. encoding = ZapfDingbatsEncoding;
  26824. }
  26825. }
  26826. }
  26827. properties.defaultEncoding = encoding;
  26828. }
  26829. properties.differences = differences;
  26830. properties.baseEncodingName = baseEncodingName;
  26831. properties.hasEncoding = !!baseEncodingName || differences.length > 0;
  26832. properties.dict = dict;
  26833. return toUnicodePromise.then(function (toUnicode) {
  26834. properties.toUnicode = toUnicode;
  26835. return this.buildToUnicode(properties);
  26836. }.bind(this)).then(function (toUnicode) {
  26837. properties.toUnicode = toUnicode;
  26838. return properties;
  26839. });
  26840. },
  26841. buildToUnicode: function PartialEvaluator_buildToUnicode(properties) {
  26842. properties.hasIncludedToUnicodeMap = !!properties.toUnicode && properties.toUnicode.length > 0;
  26843. if (properties.hasIncludedToUnicodeMap) {
  26844. return Promise.resolve(properties.toUnicode);
  26845. }
  26846. var toUnicode, charcode, glyphName;
  26847. if (!properties.composite) {
  26848. toUnicode = [];
  26849. var encoding = properties.defaultEncoding.slice();
  26850. var baseEncodingName = properties.baseEncodingName;
  26851. var differences = properties.differences;
  26852. for (charcode in differences) {
  26853. glyphName = differences[charcode];
  26854. if (glyphName === '.notdef') {
  26855. continue;
  26856. }
  26857. encoding[charcode] = glyphName;
  26858. }
  26859. var glyphsUnicodeMap = getGlyphsUnicode();
  26860. for (charcode in encoding) {
  26861. glyphName = encoding[charcode];
  26862. if (glyphName === '') {
  26863. continue;
  26864. } else if (glyphsUnicodeMap[glyphName] === undefined) {
  26865. var code = 0;
  26866. switch (glyphName[0]) {
  26867. case 'G':
  26868. if (glyphName.length === 3) {
  26869. code = parseInt(glyphName.substr(1), 16);
  26870. }
  26871. break;
  26872. case 'g':
  26873. if (glyphName.length === 5) {
  26874. code = parseInt(glyphName.substr(1), 16);
  26875. }
  26876. break;
  26877. case 'C':
  26878. case 'c':
  26879. if (glyphName.length >= 3) {
  26880. code = +glyphName.substr(1);
  26881. }
  26882. break;
  26883. default:
  26884. var unicode = getUnicodeForGlyph(glyphName, glyphsUnicodeMap);
  26885. if (unicode !== -1) {
  26886. code = unicode;
  26887. }
  26888. }
  26889. if (code) {
  26890. if (baseEncodingName && code === +charcode) {
  26891. var baseEncoding = getEncoding(baseEncodingName);
  26892. if (baseEncoding && (glyphName = baseEncoding[charcode])) {
  26893. toUnicode[charcode] = String.fromCharCode(glyphsUnicodeMap[glyphName]);
  26894. continue;
  26895. }
  26896. }
  26897. toUnicode[charcode] = String.fromCharCode(code);
  26898. }
  26899. continue;
  26900. }
  26901. toUnicode[charcode] = String.fromCharCode(glyphsUnicodeMap[glyphName]);
  26902. }
  26903. return Promise.resolve(new ToUnicodeMap(toUnicode));
  26904. }
  26905. 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'))) {
  26906. var registry = properties.cidSystemInfo.registry;
  26907. var ordering = properties.cidSystemInfo.ordering;
  26908. var ucs2CMapName = Name.get(registry + '-' + ordering + '-UCS2');
  26909. return CMapFactory.create({
  26910. encoding: ucs2CMapName,
  26911. fetchBuiltInCMap: this.fetchBuiltInCMap,
  26912. useCMap: null
  26913. }).then(function (ucs2CMap) {
  26914. var cMap = properties.cMap;
  26915. toUnicode = [];
  26916. cMap.forEach(function (charcode, cid) {
  26917. assert(cid <= 0xffff, 'Max size of CID is 65,535');
  26918. var ucs2 = ucs2CMap.lookup(cid);
  26919. if (ucs2) {
  26920. toUnicode[charcode] = String.fromCharCode((ucs2.charCodeAt(0) << 8) + ucs2.charCodeAt(1));
  26921. }
  26922. });
  26923. return new ToUnicodeMap(toUnicode);
  26924. });
  26925. }
  26926. return Promise.resolve(new IdentityToUnicodeMap(properties.firstChar, properties.lastChar));
  26927. },
  26928. readToUnicode: function PartialEvaluator_readToUnicode(toUnicode) {
  26929. var cmapObj = toUnicode;
  26930. if (isName(cmapObj)) {
  26931. return CMapFactory.create({
  26932. encoding: cmapObj,
  26933. fetchBuiltInCMap: this.fetchBuiltInCMap,
  26934. useCMap: null
  26935. }).then(function (cmap) {
  26936. if (cmap instanceof IdentityCMap) {
  26937. return new IdentityToUnicodeMap(0, 0xFFFF);
  26938. }
  26939. return new ToUnicodeMap(cmap.getMap());
  26940. });
  26941. } else if (isStream(cmapObj)) {
  26942. return CMapFactory.create({
  26943. encoding: cmapObj,
  26944. fetchBuiltInCMap: this.fetchBuiltInCMap,
  26945. useCMap: null
  26946. }).then(function (cmap) {
  26947. if (cmap instanceof IdentityCMap) {
  26948. return new IdentityToUnicodeMap(0, 0xFFFF);
  26949. }
  26950. var map = new Array(cmap.length);
  26951. cmap.forEach(function (charCode, token) {
  26952. var str = [];
  26953. for (var k = 0; k < token.length; k += 2) {
  26954. var w1 = token.charCodeAt(k) << 8 | token.charCodeAt(k + 1);
  26955. if ((w1 & 0xF800) !== 0xD800) {
  26956. str.push(w1);
  26957. continue;
  26958. }
  26959. k += 2;
  26960. var w2 = token.charCodeAt(k) << 8 | token.charCodeAt(k + 1);
  26961. str.push(((w1 & 0x3ff) << 10) + (w2 & 0x3ff) + 0x10000);
  26962. }
  26963. map[charCode] = String.fromCharCode.apply(String, str);
  26964. });
  26965. return new ToUnicodeMap(map);
  26966. });
  26967. }
  26968. return Promise.resolve(null);
  26969. },
  26970. readCidToGidMap: function PartialEvaluator_readCidToGidMap(cidToGidStream) {
  26971. var glyphsData = cidToGidStream.getBytes();
  26972. var result = [];
  26973. for (var j = 0, jj = glyphsData.length; j < jj; j++) {
  26974. var glyphID = glyphsData[j++] << 8 | glyphsData[j];
  26975. if (glyphID === 0) {
  26976. continue;
  26977. }
  26978. var code = j >> 1;
  26979. result[code] = glyphID;
  26980. }
  26981. return result;
  26982. },
  26983. extractWidths: function PartialEvaluator_extractWidths(dict, xref, descriptor, properties) {
  26984. var glyphsWidths = [];
  26985. var defaultWidth = 0;
  26986. var glyphsVMetrics = [];
  26987. var defaultVMetrics;
  26988. var i, ii, j, jj, start, code, widths;
  26989. if (properties.composite) {
  26990. defaultWidth = dict.get('DW') || 1000;
  26991. widths = dict.get('W');
  26992. if (widths) {
  26993. for (i = 0, ii = widths.length; i < ii; i++) {
  26994. start = xref.fetchIfRef(widths[i++]);
  26995. code = xref.fetchIfRef(widths[i]);
  26996. if (isArray(code)) {
  26997. for (j = 0, jj = code.length; j < jj; j++) {
  26998. glyphsWidths[start++] = xref.fetchIfRef(code[j]);
  26999. }
  27000. } else {
  27001. var width = xref.fetchIfRef(widths[++i]);
  27002. for (j = start; j <= code; j++) {
  27003. glyphsWidths[j] = width;
  27004. }
  27005. }
  27006. }
  27007. }
  27008. if (properties.vertical) {
  27009. var vmetrics = dict.getArray('DW2') || [
  27010. 880,
  27011. -1000
  27012. ];
  27013. defaultVMetrics = [
  27014. vmetrics[1],
  27015. defaultWidth * 0.5,
  27016. vmetrics[0]
  27017. ];
  27018. vmetrics = dict.get('W2');
  27019. if (vmetrics) {
  27020. for (i = 0, ii = vmetrics.length; i < ii; i++) {
  27021. start = xref.fetchIfRef(vmetrics[i++]);
  27022. code = xref.fetchIfRef(vmetrics[i]);
  27023. if (isArray(code)) {
  27024. for (j = 0, jj = code.length; j < jj; j++) {
  27025. glyphsVMetrics[start++] = [
  27026. xref.fetchIfRef(code[j++]),
  27027. xref.fetchIfRef(code[j++]),
  27028. xref.fetchIfRef(code[j])
  27029. ];
  27030. }
  27031. } else {
  27032. var vmetric = [
  27033. xref.fetchIfRef(vmetrics[++i]),
  27034. xref.fetchIfRef(vmetrics[++i]),
  27035. xref.fetchIfRef(vmetrics[++i])
  27036. ];
  27037. for (j = start; j <= code; j++) {
  27038. glyphsVMetrics[j] = vmetric;
  27039. }
  27040. }
  27041. }
  27042. }
  27043. }
  27044. } else {
  27045. var firstChar = properties.firstChar;
  27046. widths = dict.get('Widths');
  27047. if (widths) {
  27048. j = firstChar;
  27049. for (i = 0, ii = widths.length; i < ii; i++) {
  27050. glyphsWidths[j++] = xref.fetchIfRef(widths[i]);
  27051. }
  27052. defaultWidth = parseFloat(descriptor.get('MissingWidth')) || 0;
  27053. } else {
  27054. var baseFontName = dict.get('BaseFont');
  27055. if (isName(baseFontName)) {
  27056. var metrics = this.getBaseFontMetrics(baseFontName.name);
  27057. glyphsWidths = this.buildCharCodeToWidth(metrics.widths, properties);
  27058. defaultWidth = metrics.defaultWidth;
  27059. }
  27060. }
  27061. }
  27062. var isMonospace = true;
  27063. var firstWidth = defaultWidth;
  27064. for (var glyph in glyphsWidths) {
  27065. var glyphWidth = glyphsWidths[glyph];
  27066. if (!glyphWidth) {
  27067. continue;
  27068. }
  27069. if (!firstWidth) {
  27070. firstWidth = glyphWidth;
  27071. continue;
  27072. }
  27073. if (firstWidth !== glyphWidth) {
  27074. isMonospace = false;
  27075. break;
  27076. }
  27077. }
  27078. if (isMonospace) {
  27079. properties.flags |= FontFlags.FixedPitch;
  27080. }
  27081. properties.defaultWidth = defaultWidth;
  27082. properties.widths = glyphsWidths;
  27083. properties.defaultVMetrics = defaultVMetrics;
  27084. properties.vmetrics = glyphsVMetrics;
  27085. },
  27086. isSerifFont: function PartialEvaluator_isSerifFont(baseFontName) {
  27087. var fontNameWoStyle = baseFontName.split('-')[0];
  27088. return fontNameWoStyle in getSerifFonts() || fontNameWoStyle.search(/serif/gi) !== -1;
  27089. },
  27090. getBaseFontMetrics: function PartialEvaluator_getBaseFontMetrics(name) {
  27091. var defaultWidth = 0;
  27092. var widths = [];
  27093. var monospace = false;
  27094. var stdFontMap = getStdFontMap();
  27095. var lookupName = stdFontMap[name] || name;
  27096. var Metrics = getMetrics();
  27097. if (!(lookupName in Metrics)) {
  27098. if (this.isSerifFont(name)) {
  27099. lookupName = 'Times-Roman';
  27100. } else {
  27101. lookupName = 'Helvetica';
  27102. }
  27103. }
  27104. var glyphWidths = Metrics[lookupName];
  27105. if (isNum(glyphWidths)) {
  27106. defaultWidth = glyphWidths;
  27107. monospace = true;
  27108. } else {
  27109. widths = glyphWidths();
  27110. }
  27111. return {
  27112. defaultWidth: defaultWidth,
  27113. monospace: monospace,
  27114. widths: widths
  27115. };
  27116. },
  27117. buildCharCodeToWidth: function PartialEvaluator_bulildCharCodeToWidth(widthsByGlyphName, properties) {
  27118. var widths = Object.create(null);
  27119. var differences = properties.differences;
  27120. var encoding = properties.defaultEncoding;
  27121. for (var charCode = 0; charCode < 256; charCode++) {
  27122. if (charCode in differences && widthsByGlyphName[differences[charCode]]) {
  27123. widths[charCode] = widthsByGlyphName[differences[charCode]];
  27124. continue;
  27125. }
  27126. if (charCode in encoding && widthsByGlyphName[encoding[charCode]]) {
  27127. widths[charCode] = widthsByGlyphName[encoding[charCode]];
  27128. continue;
  27129. }
  27130. }
  27131. return widths;
  27132. },
  27133. preEvaluateFont: function PartialEvaluator_preEvaluateFont(dict, xref) {
  27134. var baseDict = dict;
  27135. var type = dict.get('Subtype');
  27136. assert(isName(type), 'invalid font Subtype');
  27137. var composite = false;
  27138. var uint8array;
  27139. if (type.name === 'Type0') {
  27140. var df = dict.get('DescendantFonts');
  27141. if (!df) {
  27142. error('Descendant fonts are not specified');
  27143. }
  27144. dict = isArray(df) ? xref.fetchIfRef(df[0]) : df;
  27145. type = dict.get('Subtype');
  27146. assert(isName(type), 'invalid font Subtype');
  27147. composite = true;
  27148. }
  27149. var descriptor = dict.get('FontDescriptor');
  27150. if (descriptor) {
  27151. var hash = new MurmurHash3_64();
  27152. var encoding = baseDict.getRaw('Encoding');
  27153. if (isName(encoding)) {
  27154. hash.update(encoding.name);
  27155. } else if (isRef(encoding)) {
  27156. hash.update(encoding.toString());
  27157. } else if (isDict(encoding)) {
  27158. var keys = encoding.getKeys();
  27159. for (var i = 0, ii = keys.length; i < ii; i++) {
  27160. var entry = encoding.getRaw(keys[i]);
  27161. if (isName(entry)) {
  27162. hash.update(entry.name);
  27163. } else if (isRef(entry)) {
  27164. hash.update(entry.toString());
  27165. } else if (isArray(entry)) {
  27166. var diffLength = entry.length, diffBuf = new Array(diffLength);
  27167. for (var j = 0; j < diffLength; j++) {
  27168. var diffEntry = entry[j];
  27169. if (isName(diffEntry)) {
  27170. diffBuf[j] = diffEntry.name;
  27171. } else if (isNum(diffEntry) || isRef(diffEntry)) {
  27172. diffBuf[j] = diffEntry.toString();
  27173. }
  27174. }
  27175. hash.update(diffBuf.join());
  27176. }
  27177. }
  27178. }
  27179. var toUnicode = dict.get('ToUnicode') || baseDict.get('ToUnicode');
  27180. if (isStream(toUnicode)) {
  27181. var stream = toUnicode.str || toUnicode;
  27182. uint8array = stream.buffer ? new Uint8Array(stream.buffer.buffer, 0, stream.bufferLength) : new Uint8Array(stream.bytes.buffer, stream.start, stream.end - stream.start);
  27183. hash.update(uint8array);
  27184. } else if (isName(toUnicode)) {
  27185. hash.update(toUnicode.name);
  27186. }
  27187. var widths = dict.get('Widths') || baseDict.get('Widths');
  27188. if (widths) {
  27189. uint8array = new Uint8Array(new Uint32Array(widths).buffer);
  27190. hash.update(uint8array);
  27191. }
  27192. }
  27193. return {
  27194. descriptor: descriptor,
  27195. dict: dict,
  27196. baseDict: baseDict,
  27197. composite: composite,
  27198. type: type.name,
  27199. hash: hash ? hash.hexdigest() : ''
  27200. };
  27201. },
  27202. translateFont: function PartialEvaluator_translateFont(preEvaluatedFont, xref) {
  27203. var baseDict = preEvaluatedFont.baseDict;
  27204. var dict = preEvaluatedFont.dict;
  27205. var composite = preEvaluatedFont.composite;
  27206. var descriptor = preEvaluatedFont.descriptor;
  27207. var type = preEvaluatedFont.type;
  27208. var maxCharIndex = composite ? 0xFFFF : 0xFF;
  27209. var properties;
  27210. if (!descriptor) {
  27211. if (type === 'Type3') {
  27212. descriptor = new Dict(null);
  27213. descriptor.set('FontName', Name.get(type));
  27214. descriptor.set('FontBBox', dict.getArray('FontBBox'));
  27215. } else {
  27216. var baseFontName = dict.get('BaseFont');
  27217. if (!isName(baseFontName)) {
  27218. error('Base font is not specified');
  27219. }
  27220. baseFontName = baseFontName.name.replace(/[,_]/g, '-');
  27221. var metrics = this.getBaseFontMetrics(baseFontName);
  27222. var fontNameWoStyle = baseFontName.split('-')[0];
  27223. var flags = (this.isSerifFont(fontNameWoStyle) ? FontFlags.Serif : 0) | (metrics.monospace ? FontFlags.FixedPitch : 0) | (getSymbolsFonts()[fontNameWoStyle] ? FontFlags.Symbolic : FontFlags.Nonsymbolic);
  27224. properties = {
  27225. type: type,
  27226. name: baseFontName,
  27227. widths: metrics.widths,
  27228. defaultWidth: metrics.defaultWidth,
  27229. flags: flags,
  27230. firstChar: 0,
  27231. lastChar: maxCharIndex
  27232. };
  27233. return this.extractDataStructures(dict, dict, xref, properties).then(function (properties) {
  27234. properties.widths = this.buildCharCodeToWidth(metrics.widths, properties);
  27235. return new Font(baseFontName, null, properties);
  27236. }.bind(this));
  27237. }
  27238. }
  27239. var firstChar = dict.get('FirstChar') || 0;
  27240. var lastChar = dict.get('LastChar') || maxCharIndex;
  27241. var fontName = descriptor.get('FontName');
  27242. var baseFont = dict.get('BaseFont');
  27243. if (isString(fontName)) {
  27244. fontName = Name.get(fontName);
  27245. }
  27246. if (isString(baseFont)) {
  27247. baseFont = Name.get(baseFont);
  27248. }
  27249. if (type !== 'Type3') {
  27250. var fontNameStr = fontName && fontName.name;
  27251. var baseFontStr = baseFont && baseFont.name;
  27252. if (fontNameStr !== baseFontStr) {
  27253. info('The FontDescriptor\'s FontName is "' + fontNameStr + '" but should be the same as the Font\'s BaseFont "' + baseFontStr + '"');
  27254. if (fontNameStr && baseFontStr && baseFontStr.indexOf(fontNameStr) === 0) {
  27255. fontName = baseFont;
  27256. }
  27257. }
  27258. }
  27259. fontName = fontName || baseFont;
  27260. assert(isName(fontName), 'invalid font name');
  27261. var fontFile = descriptor.get('FontFile', 'FontFile2', 'FontFile3');
  27262. if (fontFile) {
  27263. if (fontFile.dict) {
  27264. var subtype = fontFile.dict.get('Subtype');
  27265. if (subtype) {
  27266. subtype = subtype.name;
  27267. }
  27268. var length1 = fontFile.dict.get('Length1');
  27269. var length2 = fontFile.dict.get('Length2');
  27270. var length3 = fontFile.dict.get('Length3');
  27271. }
  27272. }
  27273. properties = {
  27274. type: type,
  27275. name: fontName.name,
  27276. subtype: subtype,
  27277. file: fontFile,
  27278. length1: length1,
  27279. length2: length2,
  27280. length3: length3,
  27281. loadedName: baseDict.loadedName,
  27282. composite: composite,
  27283. wideChars: composite,
  27284. fixedPitch: false,
  27285. fontMatrix: dict.getArray('FontMatrix') || FONT_IDENTITY_MATRIX,
  27286. firstChar: firstChar || 0,
  27287. lastChar: lastChar || maxCharIndex,
  27288. bbox: descriptor.getArray('FontBBox'),
  27289. ascent: descriptor.get('Ascent'),
  27290. descent: descriptor.get('Descent'),
  27291. xHeight: descriptor.get('XHeight'),
  27292. capHeight: descriptor.get('CapHeight'),
  27293. flags: descriptor.get('Flags'),
  27294. italicAngle: descriptor.get('ItalicAngle'),
  27295. coded: false
  27296. };
  27297. var cMapPromise;
  27298. if (composite) {
  27299. var cidEncoding = baseDict.get('Encoding');
  27300. if (isName(cidEncoding)) {
  27301. properties.cidEncoding = cidEncoding.name;
  27302. }
  27303. cMapPromise = CMapFactory.create({
  27304. encoding: cidEncoding,
  27305. fetchBuiltInCMap: this.fetchBuiltInCMap,
  27306. useCMap: null
  27307. }).then(function (cMap) {
  27308. properties.cMap = cMap;
  27309. properties.vertical = properties.cMap.vertical;
  27310. });
  27311. } else {
  27312. cMapPromise = Promise.resolve(undefined);
  27313. }
  27314. return cMapPromise.then(function () {
  27315. return this.extractDataStructures(dict, baseDict, xref, properties);
  27316. }.bind(this)).then(function (properties) {
  27317. this.extractWidths(dict, xref, descriptor, properties);
  27318. if (type === 'Type3') {
  27319. properties.isType3Font = true;
  27320. }
  27321. return new Font(fontName.name, fontFile, properties);
  27322. }.bind(this));
  27323. }
  27324. };
  27325. return PartialEvaluator;
  27326. }();
  27327. var TranslatedFont = function TranslatedFontClosure() {
  27328. function TranslatedFont(loadedName, font, dict) {
  27329. this.loadedName = loadedName;
  27330. this.font = font;
  27331. this.dict = dict;
  27332. this.type3Loaded = null;
  27333. this.sent = false;
  27334. }
  27335. TranslatedFont.prototype = {
  27336. send: function (handler) {
  27337. if (this.sent) {
  27338. return;
  27339. }
  27340. var fontData = this.font.exportData();
  27341. handler.send('commonobj', [
  27342. this.loadedName,
  27343. 'Font',
  27344. fontData
  27345. ]);
  27346. this.sent = true;
  27347. },
  27348. loadType3Data: function (evaluator, resources, parentOperatorList, task) {
  27349. assert(this.font.isType3Font);
  27350. if (this.type3Loaded) {
  27351. return this.type3Loaded;
  27352. }
  27353. var translatedFont = this.font;
  27354. var loadCharProcsPromise = Promise.resolve();
  27355. var charProcs = this.dict.get('CharProcs');
  27356. var fontResources = this.dict.get('Resources') || resources;
  27357. var charProcKeys = charProcs.getKeys();
  27358. var charProcOperatorList = Object.create(null);
  27359. for (var i = 0, n = charProcKeys.length; i < n; ++i) {
  27360. loadCharProcsPromise = loadCharProcsPromise.then(function (key) {
  27361. var glyphStream = charProcs.get(key);
  27362. var operatorList = new OperatorList();
  27363. return evaluator.getOperatorList(glyphStream, task, fontResources, operatorList).then(function () {
  27364. charProcOperatorList[key] = operatorList.getIR();
  27365. parentOperatorList.addDependencies(operatorList.dependencies);
  27366. }, function (reason) {
  27367. warn('Type3 font resource \"' + key + '\" is not available');
  27368. var operatorList = new OperatorList();
  27369. charProcOperatorList[key] = operatorList.getIR();
  27370. });
  27371. }.bind(this, charProcKeys[i]));
  27372. }
  27373. this.type3Loaded = loadCharProcsPromise.then(function () {
  27374. translatedFont.charProcOperatorList = charProcOperatorList;
  27375. });
  27376. return this.type3Loaded;
  27377. }
  27378. };
  27379. return TranslatedFont;
  27380. }();
  27381. var OperatorList = function OperatorListClosure() {
  27382. var CHUNK_SIZE = 1000;
  27383. var CHUNK_SIZE_ABOUT = CHUNK_SIZE - 5;
  27384. function getTransfers(queue) {
  27385. var transfers = [];
  27386. var fnArray = queue.fnArray, argsArray = queue.argsArray;
  27387. for (var i = 0, ii = queue.length; i < ii; i++) {
  27388. switch (fnArray[i]) {
  27389. case OPS.paintInlineImageXObject:
  27390. case OPS.paintInlineImageXObjectGroup:
  27391. case OPS.paintImageMaskXObject:
  27392. var arg = argsArray[i][0];
  27393. if (!arg.cached) {
  27394. transfers.push(arg.data.buffer);
  27395. }
  27396. break;
  27397. }
  27398. }
  27399. return transfers;
  27400. }
  27401. function OperatorList(intent, messageHandler, pageIndex) {
  27402. this.messageHandler = messageHandler;
  27403. this.fnArray = [];
  27404. this.argsArray = [];
  27405. this.dependencies = Object.create(null);
  27406. this._totalLength = 0;
  27407. this.pageIndex = pageIndex;
  27408. this.intent = intent;
  27409. }
  27410. OperatorList.prototype = {
  27411. get length() {
  27412. return this.argsArray.length;
  27413. },
  27414. get totalLength() {
  27415. return this._totalLength + this.length;
  27416. },
  27417. addOp: function (fn, args) {
  27418. this.fnArray.push(fn);
  27419. this.argsArray.push(args);
  27420. if (this.messageHandler) {
  27421. if (this.fnArray.length >= CHUNK_SIZE) {
  27422. this.flush();
  27423. } else if (this.fnArray.length >= CHUNK_SIZE_ABOUT && (fn === OPS.restore || fn === OPS.endText)) {
  27424. this.flush();
  27425. }
  27426. }
  27427. },
  27428. addDependency: function (dependency) {
  27429. if (dependency in this.dependencies) {
  27430. return;
  27431. }
  27432. this.dependencies[dependency] = true;
  27433. this.addOp(OPS.dependency, [dependency]);
  27434. },
  27435. addDependencies: function (dependencies) {
  27436. for (var key in dependencies) {
  27437. this.addDependency(key);
  27438. }
  27439. },
  27440. addOpList: function (opList) {
  27441. Util.extendObj(this.dependencies, opList.dependencies);
  27442. for (var i = 0, ii = opList.length; i < ii; i++) {
  27443. this.addOp(opList.fnArray[i], opList.argsArray[i]);
  27444. }
  27445. },
  27446. getIR: function () {
  27447. return {
  27448. fnArray: this.fnArray,
  27449. argsArray: this.argsArray,
  27450. length: this.length
  27451. };
  27452. },
  27453. flush: function (lastChunk) {
  27454. if (this.intent !== 'oplist') {
  27455. new QueueOptimizer().optimize(this);
  27456. }
  27457. var transfers = getTransfers(this);
  27458. var length = this.length;
  27459. this._totalLength += length;
  27460. this.messageHandler.send('RenderPageChunk', {
  27461. operatorList: {
  27462. fnArray: this.fnArray,
  27463. argsArray: this.argsArray,
  27464. lastChunk: lastChunk,
  27465. length: length
  27466. },
  27467. pageIndex: this.pageIndex,
  27468. intent: this.intent
  27469. }, transfers);
  27470. this.dependencies = Object.create(null);
  27471. this.fnArray.length = 0;
  27472. this.argsArray.length = 0;
  27473. }
  27474. };
  27475. return OperatorList;
  27476. }();
  27477. var StateManager = function StateManagerClosure() {
  27478. function StateManager(initialState) {
  27479. this.state = initialState;
  27480. this.stateStack = [];
  27481. }
  27482. StateManager.prototype = {
  27483. save: function () {
  27484. var old = this.state;
  27485. this.stateStack.push(this.state);
  27486. this.state = old.clone();
  27487. },
  27488. restore: function () {
  27489. var prev = this.stateStack.pop();
  27490. if (prev) {
  27491. this.state = prev;
  27492. }
  27493. },
  27494. transform: function (args) {
  27495. this.state.ctm = Util.transform(this.state.ctm, args);
  27496. }
  27497. };
  27498. return StateManager;
  27499. }();
  27500. var TextState = function TextStateClosure() {
  27501. function TextState() {
  27502. this.ctm = new Float32Array(IDENTITY_MATRIX);
  27503. this.fontName = null;
  27504. this.fontSize = 0;
  27505. this.font = null;
  27506. this.fontMatrix = FONT_IDENTITY_MATRIX;
  27507. this.textMatrix = IDENTITY_MATRIX.slice();
  27508. this.textLineMatrix = IDENTITY_MATRIX.slice();
  27509. this.charSpacing = 0;
  27510. this.wordSpacing = 0;
  27511. this.leading = 0;
  27512. this.textHScale = 1;
  27513. this.textRise = 0;
  27514. }
  27515. TextState.prototype = {
  27516. setTextMatrix: function TextState_setTextMatrix(a, b, c, d, e, f) {
  27517. var m = this.textMatrix;
  27518. m[0] = a;
  27519. m[1] = b;
  27520. m[2] = c;
  27521. m[3] = d;
  27522. m[4] = e;
  27523. m[5] = f;
  27524. },
  27525. setTextLineMatrix: function TextState_setTextMatrix(a, b, c, d, e, f) {
  27526. var m = this.textLineMatrix;
  27527. m[0] = a;
  27528. m[1] = b;
  27529. m[2] = c;
  27530. m[3] = d;
  27531. m[4] = e;
  27532. m[5] = f;
  27533. },
  27534. translateTextMatrix: function TextState_translateTextMatrix(x, y) {
  27535. var m = this.textMatrix;
  27536. m[4] = m[0] * x + m[2] * y + m[4];
  27537. m[5] = m[1] * x + m[3] * y + m[5];
  27538. },
  27539. translateTextLineMatrix: function TextState_translateTextMatrix(x, y) {
  27540. var m = this.textLineMatrix;
  27541. m[4] = m[0] * x + m[2] * y + m[4];
  27542. m[5] = m[1] * x + m[3] * y + m[5];
  27543. },
  27544. calcTextLineMatrixAdvance: function TextState_calcTextLineMatrixAdvance(a, b, c, d, e, f) {
  27545. var font = this.font;
  27546. if (!font) {
  27547. return null;
  27548. }
  27549. var m = this.textLineMatrix;
  27550. if (!(a === m[0] && b === m[1] && c === m[2] && d === m[3])) {
  27551. return null;
  27552. }
  27553. var txDiff = e - m[4], tyDiff = f - m[5];
  27554. if (font.vertical && txDiff !== 0 || !font.vertical && tyDiff !== 0) {
  27555. return null;
  27556. }
  27557. var tx, ty, denominator = a * d - b * c;
  27558. if (font.vertical) {
  27559. tx = -tyDiff * c / denominator;
  27560. ty = tyDiff * a / denominator;
  27561. } else {
  27562. tx = txDiff * d / denominator;
  27563. ty = -txDiff * b / denominator;
  27564. }
  27565. return {
  27566. width: tx,
  27567. height: ty,
  27568. value: font.vertical ? ty : tx
  27569. };
  27570. },
  27571. calcRenderMatrix: function TextState_calcRendeMatrix(ctm) {
  27572. var tsm = [
  27573. this.fontSize * this.textHScale,
  27574. 0,
  27575. 0,
  27576. this.fontSize,
  27577. 0,
  27578. this.textRise
  27579. ];
  27580. return Util.transform(ctm, Util.transform(this.textMatrix, tsm));
  27581. },
  27582. carriageReturn: function TextState_carriageReturn() {
  27583. this.translateTextLineMatrix(0, -this.leading);
  27584. this.textMatrix = this.textLineMatrix.slice();
  27585. },
  27586. clone: function TextState_clone() {
  27587. var clone = Object.create(this);
  27588. clone.textMatrix = this.textMatrix.slice();
  27589. clone.textLineMatrix = this.textLineMatrix.slice();
  27590. clone.fontMatrix = this.fontMatrix.slice();
  27591. return clone;
  27592. }
  27593. };
  27594. return TextState;
  27595. }();
  27596. var EvalState = function EvalStateClosure() {
  27597. function EvalState() {
  27598. this.ctm = new Float32Array(IDENTITY_MATRIX);
  27599. this.font = null;
  27600. this.textRenderingMode = TextRenderingMode.FILL;
  27601. this.fillColorSpace = ColorSpace.singletons.gray;
  27602. this.strokeColorSpace = ColorSpace.singletons.gray;
  27603. }
  27604. EvalState.prototype = {
  27605. clone: function CanvasExtraState_clone() {
  27606. return Object.create(this);
  27607. }
  27608. };
  27609. return EvalState;
  27610. }();
  27611. var EvaluatorPreprocessor = function EvaluatorPreprocessorClosure() {
  27612. var getOPMap = getLookupTableFactory(function (t) {
  27613. t['w'] = {
  27614. id: OPS.setLineWidth,
  27615. numArgs: 1,
  27616. variableArgs: false
  27617. };
  27618. t['J'] = {
  27619. id: OPS.setLineCap,
  27620. numArgs: 1,
  27621. variableArgs: false
  27622. };
  27623. t['j'] = {
  27624. id: OPS.setLineJoin,
  27625. numArgs: 1,
  27626. variableArgs: false
  27627. };
  27628. t['M'] = {
  27629. id: OPS.setMiterLimit,
  27630. numArgs: 1,
  27631. variableArgs: false
  27632. };
  27633. t['d'] = {
  27634. id: OPS.setDash,
  27635. numArgs: 2,
  27636. variableArgs: false
  27637. };
  27638. t['ri'] = {
  27639. id: OPS.setRenderingIntent,
  27640. numArgs: 1,
  27641. variableArgs: false
  27642. };
  27643. t['i'] = {
  27644. id: OPS.setFlatness,
  27645. numArgs: 1,
  27646. variableArgs: false
  27647. };
  27648. t['gs'] = {
  27649. id: OPS.setGState,
  27650. numArgs: 1,
  27651. variableArgs: false
  27652. };
  27653. t['q'] = {
  27654. id: OPS.save,
  27655. numArgs: 0,
  27656. variableArgs: false
  27657. };
  27658. t['Q'] = {
  27659. id: OPS.restore,
  27660. numArgs: 0,
  27661. variableArgs: false
  27662. };
  27663. t['cm'] = {
  27664. id: OPS.transform,
  27665. numArgs: 6,
  27666. variableArgs: false
  27667. };
  27668. t['m'] = {
  27669. id: OPS.moveTo,
  27670. numArgs: 2,
  27671. variableArgs: false
  27672. };
  27673. t['l'] = {
  27674. id: OPS.lineTo,
  27675. numArgs: 2,
  27676. variableArgs: false
  27677. };
  27678. t['c'] = {
  27679. id: OPS.curveTo,
  27680. numArgs: 6,
  27681. variableArgs: false
  27682. };
  27683. t['v'] = {
  27684. id: OPS.curveTo2,
  27685. numArgs: 4,
  27686. variableArgs: false
  27687. };
  27688. t['y'] = {
  27689. id: OPS.curveTo3,
  27690. numArgs: 4,
  27691. variableArgs: false
  27692. };
  27693. t['h'] = {
  27694. id: OPS.closePath,
  27695. numArgs: 0,
  27696. variableArgs: false
  27697. };
  27698. t['re'] = {
  27699. id: OPS.rectangle,
  27700. numArgs: 4,
  27701. variableArgs: false
  27702. };
  27703. t['S'] = {
  27704. id: OPS.stroke,
  27705. numArgs: 0,
  27706. variableArgs: false
  27707. };
  27708. t['s'] = {
  27709. id: OPS.closeStroke,
  27710. numArgs: 0,
  27711. variableArgs: false
  27712. };
  27713. t['f'] = {
  27714. id: OPS.fill,
  27715. numArgs: 0,
  27716. variableArgs: false
  27717. };
  27718. t['F'] = {
  27719. id: OPS.fill,
  27720. numArgs: 0,
  27721. variableArgs: false
  27722. };
  27723. t['f*'] = {
  27724. id: OPS.eoFill,
  27725. numArgs: 0,
  27726. variableArgs: false
  27727. };
  27728. t['B'] = {
  27729. id: OPS.fillStroke,
  27730. numArgs: 0,
  27731. variableArgs: false
  27732. };
  27733. t['B*'] = {
  27734. id: OPS.eoFillStroke,
  27735. numArgs: 0,
  27736. variableArgs: false
  27737. };
  27738. t['b'] = {
  27739. id: OPS.closeFillStroke,
  27740. numArgs: 0,
  27741. variableArgs: false
  27742. };
  27743. t['b*'] = {
  27744. id: OPS.closeEOFillStroke,
  27745. numArgs: 0,
  27746. variableArgs: false
  27747. };
  27748. t['n'] = {
  27749. id: OPS.endPath,
  27750. numArgs: 0,
  27751. variableArgs: false
  27752. };
  27753. t['W'] = {
  27754. id: OPS.clip,
  27755. numArgs: 0,
  27756. variableArgs: false
  27757. };
  27758. t['W*'] = {
  27759. id: OPS.eoClip,
  27760. numArgs: 0,
  27761. variableArgs: false
  27762. };
  27763. t['BT'] = {
  27764. id: OPS.beginText,
  27765. numArgs: 0,
  27766. variableArgs: false
  27767. };
  27768. t['ET'] = {
  27769. id: OPS.endText,
  27770. numArgs: 0,
  27771. variableArgs: false
  27772. };
  27773. t['Tc'] = {
  27774. id: OPS.setCharSpacing,
  27775. numArgs: 1,
  27776. variableArgs: false
  27777. };
  27778. t['Tw'] = {
  27779. id: OPS.setWordSpacing,
  27780. numArgs: 1,
  27781. variableArgs: false
  27782. };
  27783. t['Tz'] = {
  27784. id: OPS.setHScale,
  27785. numArgs: 1,
  27786. variableArgs: false
  27787. };
  27788. t['TL'] = {
  27789. id: OPS.setLeading,
  27790. numArgs: 1,
  27791. variableArgs: false
  27792. };
  27793. t['Tf'] = {
  27794. id: OPS.setFont,
  27795. numArgs: 2,
  27796. variableArgs: false
  27797. };
  27798. t['Tr'] = {
  27799. id: OPS.setTextRenderingMode,
  27800. numArgs: 1,
  27801. variableArgs: false
  27802. };
  27803. t['Ts'] = {
  27804. id: OPS.setTextRise,
  27805. numArgs: 1,
  27806. variableArgs: false
  27807. };
  27808. t['Td'] = {
  27809. id: OPS.moveText,
  27810. numArgs: 2,
  27811. variableArgs: false
  27812. };
  27813. t['TD'] = {
  27814. id: OPS.setLeadingMoveText,
  27815. numArgs: 2,
  27816. variableArgs: false
  27817. };
  27818. t['Tm'] = {
  27819. id: OPS.setTextMatrix,
  27820. numArgs: 6,
  27821. variableArgs: false
  27822. };
  27823. t['T*'] = {
  27824. id: OPS.nextLine,
  27825. numArgs: 0,
  27826. variableArgs: false
  27827. };
  27828. t['Tj'] = {
  27829. id: OPS.showText,
  27830. numArgs: 1,
  27831. variableArgs: false
  27832. };
  27833. t['TJ'] = {
  27834. id: OPS.showSpacedText,
  27835. numArgs: 1,
  27836. variableArgs: false
  27837. };
  27838. t['\''] = {
  27839. id: OPS.nextLineShowText,
  27840. numArgs: 1,
  27841. variableArgs: false
  27842. };
  27843. t['"'] = {
  27844. id: OPS.nextLineSetSpacingShowText,
  27845. numArgs: 3,
  27846. variableArgs: false
  27847. };
  27848. t['d0'] = {
  27849. id: OPS.setCharWidth,
  27850. numArgs: 2,
  27851. variableArgs: false
  27852. };
  27853. t['d1'] = {
  27854. id: OPS.setCharWidthAndBounds,
  27855. numArgs: 6,
  27856. variableArgs: false
  27857. };
  27858. t['CS'] = {
  27859. id: OPS.setStrokeColorSpace,
  27860. numArgs: 1,
  27861. variableArgs: false
  27862. };
  27863. t['cs'] = {
  27864. id: OPS.setFillColorSpace,
  27865. numArgs: 1,
  27866. variableArgs: false
  27867. };
  27868. t['SC'] = {
  27869. id: OPS.setStrokeColor,
  27870. numArgs: 4,
  27871. variableArgs: true
  27872. };
  27873. t['SCN'] = {
  27874. id: OPS.setStrokeColorN,
  27875. numArgs: 33,
  27876. variableArgs: true
  27877. };
  27878. t['sc'] = {
  27879. id: OPS.setFillColor,
  27880. numArgs: 4,
  27881. variableArgs: true
  27882. };
  27883. t['scn'] = {
  27884. id: OPS.setFillColorN,
  27885. numArgs: 33,
  27886. variableArgs: true
  27887. };
  27888. t['G'] = {
  27889. id: OPS.setStrokeGray,
  27890. numArgs: 1,
  27891. variableArgs: false
  27892. };
  27893. t['g'] = {
  27894. id: OPS.setFillGray,
  27895. numArgs: 1,
  27896. variableArgs: false
  27897. };
  27898. t['RG'] = {
  27899. id: OPS.setStrokeRGBColor,
  27900. numArgs: 3,
  27901. variableArgs: false
  27902. };
  27903. t['rg'] = {
  27904. id: OPS.setFillRGBColor,
  27905. numArgs: 3,
  27906. variableArgs: false
  27907. };
  27908. t['K'] = {
  27909. id: OPS.setStrokeCMYKColor,
  27910. numArgs: 4,
  27911. variableArgs: false
  27912. };
  27913. t['k'] = {
  27914. id: OPS.setFillCMYKColor,
  27915. numArgs: 4,
  27916. variableArgs: false
  27917. };
  27918. t['sh'] = {
  27919. id: OPS.shadingFill,
  27920. numArgs: 1,
  27921. variableArgs: false
  27922. };
  27923. t['BI'] = {
  27924. id: OPS.beginInlineImage,
  27925. numArgs: 0,
  27926. variableArgs: false
  27927. };
  27928. t['ID'] = {
  27929. id: OPS.beginImageData,
  27930. numArgs: 0,
  27931. variableArgs: false
  27932. };
  27933. t['EI'] = {
  27934. id: OPS.endInlineImage,
  27935. numArgs: 1,
  27936. variableArgs: false
  27937. };
  27938. t['Do'] = {
  27939. id: OPS.paintXObject,
  27940. numArgs: 1,
  27941. variableArgs: false
  27942. };
  27943. t['MP'] = {
  27944. id: OPS.markPoint,
  27945. numArgs: 1,
  27946. variableArgs: false
  27947. };
  27948. t['DP'] = {
  27949. id: OPS.markPointProps,
  27950. numArgs: 2,
  27951. variableArgs: false
  27952. };
  27953. t['BMC'] = {
  27954. id: OPS.beginMarkedContent,
  27955. numArgs: 1,
  27956. variableArgs: false
  27957. };
  27958. t['BDC'] = {
  27959. id: OPS.beginMarkedContentProps,
  27960. numArgs: 2,
  27961. variableArgs: false
  27962. };
  27963. t['EMC'] = {
  27964. id: OPS.endMarkedContent,
  27965. numArgs: 0,
  27966. variableArgs: false
  27967. };
  27968. t['BX'] = {
  27969. id: OPS.beginCompat,
  27970. numArgs: 0,
  27971. variableArgs: false
  27972. };
  27973. t['EX'] = {
  27974. id: OPS.endCompat,
  27975. numArgs: 0,
  27976. variableArgs: false
  27977. };
  27978. t['BM'] = null;
  27979. t['BD'] = null;
  27980. t['true'] = null;
  27981. t['fa'] = null;
  27982. t['fal'] = null;
  27983. t['fals'] = null;
  27984. t['false'] = null;
  27985. t['nu'] = null;
  27986. t['nul'] = null;
  27987. t['null'] = null;
  27988. });
  27989. function EvaluatorPreprocessor(stream, xref, stateManager) {
  27990. this.opMap = getOPMap();
  27991. this.parser = new Parser(new Lexer(stream, this.opMap), false, xref);
  27992. this.stateManager = stateManager;
  27993. this.nonProcessedArgs = [];
  27994. }
  27995. EvaluatorPreprocessor.prototype = {
  27996. get savedStatesDepth() {
  27997. return this.stateManager.stateStack.length;
  27998. },
  27999. read: function EvaluatorPreprocessor_read(operation) {
  28000. var args = operation.args;
  28001. while (true) {
  28002. var obj = this.parser.getObj();
  28003. if (isCmd(obj)) {
  28004. var cmd = obj.cmd;
  28005. var opSpec = this.opMap[cmd];
  28006. if (!opSpec) {
  28007. warn('Unknown command "' + cmd + '"');
  28008. continue;
  28009. }
  28010. var fn = opSpec.id;
  28011. var numArgs = opSpec.numArgs;
  28012. var argsLength = args !== null ? args.length : 0;
  28013. if (!opSpec.variableArgs) {
  28014. if (argsLength !== numArgs) {
  28015. var nonProcessedArgs = this.nonProcessedArgs;
  28016. while (argsLength > numArgs) {
  28017. nonProcessedArgs.push(args.shift());
  28018. argsLength--;
  28019. }
  28020. while (argsLength < numArgs && nonProcessedArgs.length !== 0) {
  28021. if (args === null) {
  28022. args = [];
  28023. }
  28024. args.unshift(nonProcessedArgs.pop());
  28025. argsLength++;
  28026. }
  28027. }
  28028. if (argsLength < numArgs) {
  28029. warn('Skipping command ' + fn + ': expected ' + numArgs + ' args, but received ' + argsLength + ' args.');
  28030. if (args !== null) {
  28031. args.length = 0;
  28032. }
  28033. continue;
  28034. }
  28035. } else if (argsLength > numArgs) {
  28036. info('Command ' + fn + ': expected [0,' + numArgs + '] args, but received ' + argsLength + ' args.');
  28037. }
  28038. this.preprocessCommand(fn, args);
  28039. operation.fn = fn;
  28040. operation.args = args;
  28041. return true;
  28042. }
  28043. if (isEOF(obj)) {
  28044. return false;
  28045. }
  28046. if (obj !== null) {
  28047. if (args === null) {
  28048. args = [];
  28049. }
  28050. args.push(obj);
  28051. assert(args.length <= 33, 'Too many arguments');
  28052. }
  28053. }
  28054. },
  28055. preprocessCommand: function EvaluatorPreprocessor_preprocessCommand(fn, args) {
  28056. switch (fn | 0) {
  28057. case OPS.save:
  28058. this.stateManager.save();
  28059. break;
  28060. case OPS.restore:
  28061. this.stateManager.restore();
  28062. break;
  28063. case OPS.transform:
  28064. this.stateManager.transform(args);
  28065. break;
  28066. }
  28067. }
  28068. };
  28069. return EvaluatorPreprocessor;
  28070. }();
  28071. var QueueOptimizer = function QueueOptimizerClosure() {
  28072. function addState(parentState, pattern, fn) {
  28073. var state = parentState;
  28074. for (var i = 0, ii = pattern.length - 1; i < ii; i++) {
  28075. var item = pattern[i];
  28076. state = state[item] || (state[item] = []);
  28077. }
  28078. state[pattern[pattern.length - 1]] = fn;
  28079. }
  28080. function handlePaintSolidColorImageMask(iFirstSave, count, fnArray, argsArray) {
  28081. var iFirstPIMXO = iFirstSave + 2;
  28082. for (var i = 0; i < count; i++) {
  28083. var arg = argsArray[iFirstPIMXO + 4 * i];
  28084. var imageMask = arg.length === 1 && arg[0];
  28085. if (imageMask && imageMask.width === 1 && imageMask.height === 1 && (!imageMask.data.length || imageMask.data.length === 1 && imageMask.data[0] === 0)) {
  28086. fnArray[iFirstPIMXO + 4 * i] = OPS.paintSolidColorImageMask;
  28087. continue;
  28088. }
  28089. break;
  28090. }
  28091. return count - i;
  28092. }
  28093. var InitialState = [];
  28094. addState(InitialState, [
  28095. OPS.save,
  28096. OPS.transform,
  28097. OPS.paintInlineImageXObject,
  28098. OPS.restore
  28099. ], function foundInlineImageGroup(context) {
  28100. var MIN_IMAGES_IN_INLINE_IMAGES_BLOCK = 10;
  28101. var MAX_IMAGES_IN_INLINE_IMAGES_BLOCK = 200;
  28102. var MAX_WIDTH = 1000;
  28103. var IMAGE_PADDING = 1;
  28104. var fnArray = context.fnArray, argsArray = context.argsArray;
  28105. var curr = context.iCurr;
  28106. var iFirstSave = curr - 3;
  28107. var iFirstTransform = curr - 2;
  28108. var iFirstPIIXO = curr - 1;
  28109. var i = iFirstSave + 4;
  28110. var ii = fnArray.length;
  28111. while (i + 3 < ii) {
  28112. if (fnArray[i] !== OPS.save || fnArray[i + 1] !== OPS.transform || fnArray[i + 2] !== OPS.paintInlineImageXObject || fnArray[i + 3] !== OPS.restore) {
  28113. break;
  28114. }
  28115. i += 4;
  28116. }
  28117. var count = Math.min((i - iFirstSave) / 4, MAX_IMAGES_IN_INLINE_IMAGES_BLOCK);
  28118. if (count < MIN_IMAGES_IN_INLINE_IMAGES_BLOCK) {
  28119. return i;
  28120. }
  28121. var maxX = 0;
  28122. var map = [], maxLineHeight = 0;
  28123. var currentX = IMAGE_PADDING, currentY = IMAGE_PADDING;
  28124. var q;
  28125. for (q = 0; q < count; q++) {
  28126. var transform = argsArray[iFirstTransform + (q << 2)];
  28127. var img = argsArray[iFirstPIIXO + (q << 2)][0];
  28128. if (currentX + img.width > MAX_WIDTH) {
  28129. maxX = Math.max(maxX, currentX);
  28130. currentY += maxLineHeight + 2 * IMAGE_PADDING;
  28131. currentX = 0;
  28132. maxLineHeight = 0;
  28133. }
  28134. map.push({
  28135. transform: transform,
  28136. x: currentX,
  28137. y: currentY,
  28138. w: img.width,
  28139. h: img.height
  28140. });
  28141. currentX += img.width + 2 * IMAGE_PADDING;
  28142. maxLineHeight = Math.max(maxLineHeight, img.height);
  28143. }
  28144. var imgWidth = Math.max(maxX, currentX) + IMAGE_PADDING;
  28145. var imgHeight = currentY + maxLineHeight + IMAGE_PADDING;
  28146. var imgData = new Uint8Array(imgWidth * imgHeight * 4);
  28147. var imgRowSize = imgWidth << 2;
  28148. for (q = 0; q < count; q++) {
  28149. var data = argsArray[iFirstPIIXO + (q << 2)][0].data;
  28150. var rowSize = map[q].w << 2;
  28151. var dataOffset = 0;
  28152. var offset = map[q].x + map[q].y * imgWidth << 2;
  28153. imgData.set(data.subarray(0, rowSize), offset - imgRowSize);
  28154. for (var k = 0, kk = map[q].h; k < kk; k++) {
  28155. imgData.set(data.subarray(dataOffset, dataOffset + rowSize), offset);
  28156. dataOffset += rowSize;
  28157. offset += imgRowSize;
  28158. }
  28159. imgData.set(data.subarray(dataOffset - rowSize, dataOffset), offset);
  28160. while (offset >= 0) {
  28161. data[offset - 4] = data[offset];
  28162. data[offset - 3] = data[offset + 1];
  28163. data[offset - 2] = data[offset + 2];
  28164. data[offset - 1] = data[offset + 3];
  28165. data[offset + rowSize] = data[offset + rowSize - 4];
  28166. data[offset + rowSize + 1] = data[offset + rowSize - 3];
  28167. data[offset + rowSize + 2] = data[offset + rowSize - 2];
  28168. data[offset + rowSize + 3] = data[offset + rowSize - 1];
  28169. offset -= imgRowSize;
  28170. }
  28171. }
  28172. fnArray.splice(iFirstSave, count * 4, OPS.paintInlineImageXObjectGroup);
  28173. argsArray.splice(iFirstSave, count * 4, [
  28174. {
  28175. width: imgWidth,
  28176. height: imgHeight,
  28177. kind: ImageKind.RGBA_32BPP,
  28178. data: imgData
  28179. },
  28180. map
  28181. ]);
  28182. return iFirstSave + 1;
  28183. });
  28184. addState(InitialState, [
  28185. OPS.save,
  28186. OPS.transform,
  28187. OPS.paintImageMaskXObject,
  28188. OPS.restore
  28189. ], function foundImageMaskGroup(context) {
  28190. var MIN_IMAGES_IN_MASKS_BLOCK = 10;
  28191. var MAX_IMAGES_IN_MASKS_BLOCK = 100;
  28192. var MAX_SAME_IMAGES_IN_MASKS_BLOCK = 1000;
  28193. var fnArray = context.fnArray, argsArray = context.argsArray;
  28194. var curr = context.iCurr;
  28195. var iFirstSave = curr - 3;
  28196. var iFirstTransform = curr - 2;
  28197. var iFirstPIMXO = curr - 1;
  28198. var i = iFirstSave + 4;
  28199. var ii = fnArray.length;
  28200. while (i + 3 < ii) {
  28201. if (fnArray[i] !== OPS.save || fnArray[i + 1] !== OPS.transform || fnArray[i + 2] !== OPS.paintImageMaskXObject || fnArray[i + 3] !== OPS.restore) {
  28202. break;
  28203. }
  28204. i += 4;
  28205. }
  28206. var count = (i - iFirstSave) / 4;
  28207. count = handlePaintSolidColorImageMask(iFirstSave, count, fnArray, argsArray);
  28208. if (count < MIN_IMAGES_IN_MASKS_BLOCK) {
  28209. return i;
  28210. }
  28211. var q;
  28212. var isSameImage = false;
  28213. var iTransform, transformArgs;
  28214. var firstPIMXOArg0 = argsArray[iFirstPIMXO][0];
  28215. if (argsArray[iFirstTransform][1] === 0 && argsArray[iFirstTransform][2] === 0) {
  28216. isSameImage = true;
  28217. var firstTransformArg0 = argsArray[iFirstTransform][0];
  28218. var firstTransformArg3 = argsArray[iFirstTransform][3];
  28219. iTransform = iFirstTransform + 4;
  28220. var iPIMXO = iFirstPIMXO + 4;
  28221. for (q = 1; q < count; q++, iTransform += 4, iPIMXO += 4) {
  28222. transformArgs = argsArray[iTransform];
  28223. if (argsArray[iPIMXO][0] !== firstPIMXOArg0 || transformArgs[0] !== firstTransformArg0 || transformArgs[1] !== 0 || transformArgs[2] !== 0 || transformArgs[3] !== firstTransformArg3) {
  28224. if (q < MIN_IMAGES_IN_MASKS_BLOCK) {
  28225. isSameImage = false;
  28226. } else {
  28227. count = q;
  28228. }
  28229. break;
  28230. }
  28231. }
  28232. }
  28233. if (isSameImage) {
  28234. count = Math.min(count, MAX_SAME_IMAGES_IN_MASKS_BLOCK);
  28235. var positions = new Float32Array(count * 2);
  28236. iTransform = iFirstTransform;
  28237. for (q = 0; q < count; q++, iTransform += 4) {
  28238. transformArgs = argsArray[iTransform];
  28239. positions[q << 1] = transformArgs[4];
  28240. positions[(q << 1) + 1] = transformArgs[5];
  28241. }
  28242. fnArray.splice(iFirstSave, count * 4, OPS.paintImageMaskXObjectRepeat);
  28243. argsArray.splice(iFirstSave, count * 4, [
  28244. firstPIMXOArg0,
  28245. firstTransformArg0,
  28246. firstTransformArg3,
  28247. positions
  28248. ]);
  28249. } else {
  28250. count = Math.min(count, MAX_IMAGES_IN_MASKS_BLOCK);
  28251. var images = [];
  28252. for (q = 0; q < count; q++) {
  28253. transformArgs = argsArray[iFirstTransform + (q << 2)];
  28254. var maskParams = argsArray[iFirstPIMXO + (q << 2)][0];
  28255. images.push({
  28256. data: maskParams.data,
  28257. width: maskParams.width,
  28258. height: maskParams.height,
  28259. transform: transformArgs
  28260. });
  28261. }
  28262. fnArray.splice(iFirstSave, count * 4, OPS.paintImageMaskXObjectGroup);
  28263. argsArray.splice(iFirstSave, count * 4, [images]);
  28264. }
  28265. return iFirstSave + 1;
  28266. });
  28267. addState(InitialState, [
  28268. OPS.save,
  28269. OPS.transform,
  28270. OPS.paintImageXObject,
  28271. OPS.restore
  28272. ], function (context) {
  28273. var MIN_IMAGES_IN_BLOCK = 3;
  28274. var MAX_IMAGES_IN_BLOCK = 1000;
  28275. var fnArray = context.fnArray, argsArray = context.argsArray;
  28276. var curr = context.iCurr;
  28277. var iFirstSave = curr - 3;
  28278. var iFirstTransform = curr - 2;
  28279. var iFirstPIXO = curr - 1;
  28280. var iFirstRestore = curr;
  28281. if (argsArray[iFirstTransform][1] !== 0 || argsArray[iFirstTransform][2] !== 0) {
  28282. return iFirstRestore + 1;
  28283. }
  28284. var firstPIXOArg0 = argsArray[iFirstPIXO][0];
  28285. var firstTransformArg0 = argsArray[iFirstTransform][0];
  28286. var firstTransformArg3 = argsArray[iFirstTransform][3];
  28287. var i = iFirstSave + 4;
  28288. var ii = fnArray.length;
  28289. while (i + 3 < ii) {
  28290. if (fnArray[i] !== OPS.save || fnArray[i + 1] !== OPS.transform || fnArray[i + 2] !== OPS.paintImageXObject || fnArray[i + 3] !== OPS.restore) {
  28291. break;
  28292. }
  28293. if (argsArray[i + 1][0] !== firstTransformArg0 || argsArray[i + 1][1] !== 0 || argsArray[i + 1][2] !== 0 || argsArray[i + 1][3] !== firstTransformArg3) {
  28294. break;
  28295. }
  28296. if (argsArray[i + 2][0] !== firstPIXOArg0) {
  28297. break;
  28298. }
  28299. i += 4;
  28300. }
  28301. var count = Math.min((i - iFirstSave) / 4, MAX_IMAGES_IN_BLOCK);
  28302. if (count < MIN_IMAGES_IN_BLOCK) {
  28303. return i;
  28304. }
  28305. var positions = new Float32Array(count * 2);
  28306. var iTransform = iFirstTransform;
  28307. for (var q = 0; q < count; q++, iTransform += 4) {
  28308. var transformArgs = argsArray[iTransform];
  28309. positions[q << 1] = transformArgs[4];
  28310. positions[(q << 1) + 1] = transformArgs[5];
  28311. }
  28312. var args = [
  28313. firstPIXOArg0,
  28314. firstTransformArg0,
  28315. firstTransformArg3,
  28316. positions
  28317. ];
  28318. fnArray.splice(iFirstSave, count * 4, OPS.paintImageXObjectRepeat);
  28319. argsArray.splice(iFirstSave, count * 4, args);
  28320. return iFirstSave + 1;
  28321. });
  28322. addState(InitialState, [
  28323. OPS.beginText,
  28324. OPS.setFont,
  28325. OPS.setTextMatrix,
  28326. OPS.showText,
  28327. OPS.endText
  28328. ], function (context) {
  28329. var MIN_CHARS_IN_BLOCK = 3;
  28330. var MAX_CHARS_IN_BLOCK = 1000;
  28331. var fnArray = context.fnArray, argsArray = context.argsArray;
  28332. var curr = context.iCurr;
  28333. var iFirstBeginText = curr - 4;
  28334. var iFirstSetFont = curr - 3;
  28335. var iFirstSetTextMatrix = curr - 2;
  28336. var iFirstShowText = curr - 1;
  28337. var iFirstEndText = curr;
  28338. var firstSetFontArg0 = argsArray[iFirstSetFont][0];
  28339. var firstSetFontArg1 = argsArray[iFirstSetFont][1];
  28340. var i = iFirstBeginText + 5;
  28341. var ii = fnArray.length;
  28342. while (i + 4 < ii) {
  28343. 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) {
  28344. break;
  28345. }
  28346. if (argsArray[i + 1][0] !== firstSetFontArg0 || argsArray[i + 1][1] !== firstSetFontArg1) {
  28347. break;
  28348. }
  28349. i += 5;
  28350. }
  28351. var count = Math.min((i - iFirstBeginText) / 5, MAX_CHARS_IN_BLOCK);
  28352. if (count < MIN_CHARS_IN_BLOCK) {
  28353. return i;
  28354. }
  28355. var iFirst = iFirstBeginText;
  28356. 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) {
  28357. count++;
  28358. iFirst -= 5;
  28359. }
  28360. var iEndText = iFirst + 4;
  28361. for (var q = 1; q < count; q++) {
  28362. fnArray.splice(iEndText, 3);
  28363. argsArray.splice(iEndText, 3);
  28364. iEndText += 2;
  28365. }
  28366. return iEndText + 1;
  28367. });
  28368. function QueueOptimizer() {
  28369. }
  28370. QueueOptimizer.prototype = {
  28371. optimize: function QueueOptimizer_optimize(queue) {
  28372. var fnArray = queue.fnArray, argsArray = queue.argsArray;
  28373. var context = {
  28374. iCurr: 0,
  28375. fnArray: fnArray,
  28376. argsArray: argsArray
  28377. };
  28378. var state;
  28379. var i = 0, ii = fnArray.length;
  28380. while (i < ii) {
  28381. state = (state || InitialState)[fnArray[i]];
  28382. if (typeof state === 'function') {
  28383. context.iCurr = i;
  28384. i = state(context);
  28385. state = undefined;
  28386. ii = context.fnArray.length;
  28387. } else {
  28388. i++;
  28389. }
  28390. }
  28391. }
  28392. };
  28393. return QueueOptimizer;
  28394. }();
  28395. exports.OperatorList = OperatorList;
  28396. exports.PartialEvaluator = PartialEvaluator;
  28397. /***/ }),
  28398. /* 15 */
  28399. /***/ (function(module, exports, __w_pdfjs_require__) {
  28400. "use strict";
  28401. var sharedUtil = __w_pdfjs_require__(0);
  28402. var coreArithmeticDecoder = __w_pdfjs_require__(10);
  28403. var info = sharedUtil.info;
  28404. var warn = sharedUtil.warn;
  28405. var error = sharedUtil.error;
  28406. var log2 = sharedUtil.log2;
  28407. var readUint16 = sharedUtil.readUint16;
  28408. var readUint32 = sharedUtil.readUint32;
  28409. var ArithmeticDecoder = coreArithmeticDecoder.ArithmeticDecoder;
  28410. var JpxImage = function JpxImageClosure() {
  28411. var SubbandsGainLog2 = {
  28412. 'LL': 0,
  28413. 'LH': 1,
  28414. 'HL': 1,
  28415. 'HH': 2
  28416. };
  28417. function JpxImage() {
  28418. this.failOnCorruptedImage = false;
  28419. }
  28420. JpxImage.prototype = {
  28421. parse: function JpxImage_parse(data) {
  28422. var head = readUint16(data, 0);
  28423. if (head === 0xFF4F) {
  28424. this.parseCodestream(data, 0, data.length);
  28425. return;
  28426. }
  28427. var position = 0, length = data.length;
  28428. while (position < length) {
  28429. var headerSize = 8;
  28430. var lbox = readUint32(data, position);
  28431. var tbox = readUint32(data, position + 4);
  28432. position += headerSize;
  28433. if (lbox === 1) {
  28434. lbox = readUint32(data, position) * 4294967296 + readUint32(data, position + 4);
  28435. position += 8;
  28436. headerSize += 8;
  28437. }
  28438. if (lbox === 0) {
  28439. lbox = length - position + headerSize;
  28440. }
  28441. if (lbox < headerSize) {
  28442. error('JPX Error: Invalid box field size');
  28443. }
  28444. var dataLength = lbox - headerSize;
  28445. var jumpDataLength = true;
  28446. switch (tbox) {
  28447. case 0x6A703268:
  28448. jumpDataLength = false;
  28449. break;
  28450. case 0x636F6C72:
  28451. var method = data[position];
  28452. if (method === 1) {
  28453. var colorspace = readUint32(data, position + 3);
  28454. switch (colorspace) {
  28455. case 16:
  28456. case 17:
  28457. case 18:
  28458. break;
  28459. default:
  28460. warn('Unknown colorspace ' + colorspace);
  28461. break;
  28462. }
  28463. } else if (method === 2) {
  28464. info('ICC profile not supported');
  28465. }
  28466. break;
  28467. case 0x6A703263:
  28468. this.parseCodestream(data, position, position + dataLength);
  28469. break;
  28470. case 0x6A502020:
  28471. if (0x0d0a870a !== readUint32(data, position)) {
  28472. warn('Invalid JP2 signature');
  28473. }
  28474. break;
  28475. case 0x6A501A1A:
  28476. case 0x66747970:
  28477. case 0x72726571:
  28478. case 0x72657320:
  28479. case 0x69686472:
  28480. break;
  28481. default:
  28482. var headerType = String.fromCharCode(tbox >> 24 & 0xFF, tbox >> 16 & 0xFF, tbox >> 8 & 0xFF, tbox & 0xFF);
  28483. warn('Unsupported header type ' + tbox + ' (' + headerType + ')');
  28484. break;
  28485. }
  28486. if (jumpDataLength) {
  28487. position += dataLength;
  28488. }
  28489. }
  28490. },
  28491. parseImageProperties: function JpxImage_parseImageProperties(stream) {
  28492. var newByte = stream.getByte();
  28493. while (newByte >= 0) {
  28494. var oldByte = newByte;
  28495. newByte = stream.getByte();
  28496. var code = oldByte << 8 | newByte;
  28497. if (code === 0xFF51) {
  28498. stream.skip(4);
  28499. var Xsiz = stream.getInt32() >>> 0;
  28500. var Ysiz = stream.getInt32() >>> 0;
  28501. var XOsiz = stream.getInt32() >>> 0;
  28502. var YOsiz = stream.getInt32() >>> 0;
  28503. stream.skip(16);
  28504. var Csiz = stream.getUint16();
  28505. this.width = Xsiz - XOsiz;
  28506. this.height = Ysiz - YOsiz;
  28507. this.componentsCount = Csiz;
  28508. this.bitsPerComponent = 8;
  28509. return;
  28510. }
  28511. }
  28512. error('JPX Error: No size marker found in JPX stream');
  28513. },
  28514. parseCodestream: function JpxImage_parseCodestream(data, start, end) {
  28515. var context = {};
  28516. var doNotRecover = false;
  28517. try {
  28518. var position = start;
  28519. while (position + 1 < end) {
  28520. var code = readUint16(data, position);
  28521. position += 2;
  28522. var length = 0, j, sqcd, spqcds, spqcdSize, scalarExpounded, tile;
  28523. switch (code) {
  28524. case 0xFF4F:
  28525. context.mainHeader = true;
  28526. break;
  28527. case 0xFFD9:
  28528. break;
  28529. case 0xFF51:
  28530. length = readUint16(data, position);
  28531. var siz = {};
  28532. siz.Xsiz = readUint32(data, position + 4);
  28533. siz.Ysiz = readUint32(data, position + 8);
  28534. siz.XOsiz = readUint32(data, position + 12);
  28535. siz.YOsiz = readUint32(data, position + 16);
  28536. siz.XTsiz = readUint32(data, position + 20);
  28537. siz.YTsiz = readUint32(data, position + 24);
  28538. siz.XTOsiz = readUint32(data, position + 28);
  28539. siz.YTOsiz = readUint32(data, position + 32);
  28540. var componentsCount = readUint16(data, position + 36);
  28541. siz.Csiz = componentsCount;
  28542. var components = [];
  28543. j = position + 38;
  28544. for (var i = 0; i < componentsCount; i++) {
  28545. var component = {
  28546. precision: (data[j] & 0x7F) + 1,
  28547. isSigned: !!(data[j] & 0x80),
  28548. XRsiz: data[j + 1],
  28549. YRsiz: data[j + 1]
  28550. };
  28551. calculateComponentDimensions(component, siz);
  28552. components.push(component);
  28553. }
  28554. context.SIZ = siz;
  28555. context.components = components;
  28556. calculateTileGrids(context, components);
  28557. context.QCC = [];
  28558. context.COC = [];
  28559. break;
  28560. case 0xFF5C:
  28561. length = readUint16(data, position);
  28562. var qcd = {};
  28563. j = position + 2;
  28564. sqcd = data[j++];
  28565. switch (sqcd & 0x1F) {
  28566. case 0:
  28567. spqcdSize = 8;
  28568. scalarExpounded = true;
  28569. break;
  28570. case 1:
  28571. spqcdSize = 16;
  28572. scalarExpounded = false;
  28573. break;
  28574. case 2:
  28575. spqcdSize = 16;
  28576. scalarExpounded = true;
  28577. break;
  28578. default:
  28579. throw new Error('Invalid SQcd value ' + sqcd);
  28580. }
  28581. qcd.noQuantization = spqcdSize === 8;
  28582. qcd.scalarExpounded = scalarExpounded;
  28583. qcd.guardBits = sqcd >> 5;
  28584. spqcds = [];
  28585. while (j < length + position) {
  28586. var spqcd = {};
  28587. if (spqcdSize === 8) {
  28588. spqcd.epsilon = data[j++] >> 3;
  28589. spqcd.mu = 0;
  28590. } else {
  28591. spqcd.epsilon = data[j] >> 3;
  28592. spqcd.mu = (data[j] & 0x7) << 8 | data[j + 1];
  28593. j += 2;
  28594. }
  28595. spqcds.push(spqcd);
  28596. }
  28597. qcd.SPqcds = spqcds;
  28598. if (context.mainHeader) {
  28599. context.QCD = qcd;
  28600. } else {
  28601. context.currentTile.QCD = qcd;
  28602. context.currentTile.QCC = [];
  28603. }
  28604. break;
  28605. case 0xFF5D:
  28606. length = readUint16(data, position);
  28607. var qcc = {};
  28608. j = position + 2;
  28609. var cqcc;
  28610. if (context.SIZ.Csiz < 257) {
  28611. cqcc = data[j++];
  28612. } else {
  28613. cqcc = readUint16(data, j);
  28614. j += 2;
  28615. }
  28616. sqcd = data[j++];
  28617. switch (sqcd & 0x1F) {
  28618. case 0:
  28619. spqcdSize = 8;
  28620. scalarExpounded = true;
  28621. break;
  28622. case 1:
  28623. spqcdSize = 16;
  28624. scalarExpounded = false;
  28625. break;
  28626. case 2:
  28627. spqcdSize = 16;
  28628. scalarExpounded = true;
  28629. break;
  28630. default:
  28631. throw new Error('Invalid SQcd value ' + sqcd);
  28632. }
  28633. qcc.noQuantization = spqcdSize === 8;
  28634. qcc.scalarExpounded = scalarExpounded;
  28635. qcc.guardBits = sqcd >> 5;
  28636. spqcds = [];
  28637. while (j < length + position) {
  28638. spqcd = {};
  28639. if (spqcdSize === 8) {
  28640. spqcd.epsilon = data[j++] >> 3;
  28641. spqcd.mu = 0;
  28642. } else {
  28643. spqcd.epsilon = data[j] >> 3;
  28644. spqcd.mu = (data[j] & 0x7) << 8 | data[j + 1];
  28645. j += 2;
  28646. }
  28647. spqcds.push(spqcd);
  28648. }
  28649. qcc.SPqcds = spqcds;
  28650. if (context.mainHeader) {
  28651. context.QCC[cqcc] = qcc;
  28652. } else {
  28653. context.currentTile.QCC[cqcc] = qcc;
  28654. }
  28655. break;
  28656. case 0xFF52:
  28657. length = readUint16(data, position);
  28658. var cod = {};
  28659. j = position + 2;
  28660. var scod = data[j++];
  28661. cod.entropyCoderWithCustomPrecincts = !!(scod & 1);
  28662. cod.sopMarkerUsed = !!(scod & 2);
  28663. cod.ephMarkerUsed = !!(scod & 4);
  28664. cod.progressionOrder = data[j++];
  28665. cod.layersCount = readUint16(data, j);
  28666. j += 2;
  28667. cod.multipleComponentTransform = data[j++];
  28668. cod.decompositionLevelsCount = data[j++];
  28669. cod.xcb = (data[j++] & 0xF) + 2;
  28670. cod.ycb = (data[j++] & 0xF) + 2;
  28671. var blockStyle = data[j++];
  28672. cod.selectiveArithmeticCodingBypass = !!(blockStyle & 1);
  28673. cod.resetContextProbabilities = !!(blockStyle & 2);
  28674. cod.terminationOnEachCodingPass = !!(blockStyle & 4);
  28675. cod.verticalyStripe = !!(blockStyle & 8);
  28676. cod.predictableTermination = !!(blockStyle & 16);
  28677. cod.segmentationSymbolUsed = !!(blockStyle & 32);
  28678. cod.reversibleTransformation = data[j++];
  28679. if (cod.entropyCoderWithCustomPrecincts) {
  28680. var precinctsSizes = [];
  28681. while (j < length + position) {
  28682. var precinctsSize = data[j++];
  28683. precinctsSizes.push({
  28684. PPx: precinctsSize & 0xF,
  28685. PPy: precinctsSize >> 4
  28686. });
  28687. }
  28688. cod.precinctsSizes = precinctsSizes;
  28689. }
  28690. var unsupported = [];
  28691. if (cod.selectiveArithmeticCodingBypass) {
  28692. unsupported.push('selectiveArithmeticCodingBypass');
  28693. }
  28694. if (cod.resetContextProbabilities) {
  28695. unsupported.push('resetContextProbabilities');
  28696. }
  28697. if (cod.terminationOnEachCodingPass) {
  28698. unsupported.push('terminationOnEachCodingPass');
  28699. }
  28700. if (cod.verticalyStripe) {
  28701. unsupported.push('verticalyStripe');
  28702. }
  28703. if (cod.predictableTermination) {
  28704. unsupported.push('predictableTermination');
  28705. }
  28706. if (unsupported.length > 0) {
  28707. doNotRecover = true;
  28708. throw new Error('Unsupported COD options (' + unsupported.join(', ') + ')');
  28709. }
  28710. if (context.mainHeader) {
  28711. context.COD = cod;
  28712. } else {
  28713. context.currentTile.COD = cod;
  28714. context.currentTile.COC = [];
  28715. }
  28716. break;
  28717. case 0xFF90:
  28718. length = readUint16(data, position);
  28719. tile = {};
  28720. tile.index = readUint16(data, position + 2);
  28721. tile.length = readUint32(data, position + 4);
  28722. tile.dataEnd = tile.length + position - 2;
  28723. tile.partIndex = data[position + 8];
  28724. tile.partsCount = data[position + 9];
  28725. context.mainHeader = false;
  28726. if (tile.partIndex === 0) {
  28727. tile.COD = context.COD;
  28728. tile.COC = context.COC.slice(0);
  28729. tile.QCD = context.QCD;
  28730. tile.QCC = context.QCC.slice(0);
  28731. }
  28732. context.currentTile = tile;
  28733. break;
  28734. case 0xFF93:
  28735. tile = context.currentTile;
  28736. if (tile.partIndex === 0) {
  28737. initializeTile(context, tile.index);
  28738. buildPackets(context);
  28739. }
  28740. length = tile.dataEnd - position;
  28741. parseTilePackets(context, data, position, length);
  28742. break;
  28743. case 0xFF55:
  28744. case 0xFF57:
  28745. case 0xFF58:
  28746. case 0xFF64:
  28747. length = readUint16(data, position);
  28748. break;
  28749. case 0xFF53:
  28750. throw new Error('Codestream code 0xFF53 (COC) is ' + 'not implemented');
  28751. default:
  28752. throw new Error('Unknown codestream code: ' + code.toString(16));
  28753. }
  28754. position += length;
  28755. }
  28756. } catch (e) {
  28757. if (doNotRecover || this.failOnCorruptedImage) {
  28758. error('JPX Error: ' + e.message);
  28759. } else {
  28760. warn('JPX: Trying to recover from: ' + e.message);
  28761. }
  28762. }
  28763. this.tiles = transformComponents(context);
  28764. this.width = context.SIZ.Xsiz - context.SIZ.XOsiz;
  28765. this.height = context.SIZ.Ysiz - context.SIZ.YOsiz;
  28766. this.componentsCount = context.SIZ.Csiz;
  28767. }
  28768. };
  28769. function calculateComponentDimensions(component, siz) {
  28770. component.x0 = Math.ceil(siz.XOsiz / component.XRsiz);
  28771. component.x1 = Math.ceil(siz.Xsiz / component.XRsiz);
  28772. component.y0 = Math.ceil(siz.YOsiz / component.YRsiz);
  28773. component.y1 = Math.ceil(siz.Ysiz / component.YRsiz);
  28774. component.width = component.x1 - component.x0;
  28775. component.height = component.y1 - component.y0;
  28776. }
  28777. function calculateTileGrids(context, components) {
  28778. var siz = context.SIZ;
  28779. var tile, tiles = [];
  28780. var numXtiles = Math.ceil((siz.Xsiz - siz.XTOsiz) / siz.XTsiz);
  28781. var numYtiles = Math.ceil((siz.Ysiz - siz.YTOsiz) / siz.YTsiz);
  28782. for (var q = 0; q < numYtiles; q++) {
  28783. for (var p = 0; p < numXtiles; p++) {
  28784. tile = {};
  28785. tile.tx0 = Math.max(siz.XTOsiz + p * siz.XTsiz, siz.XOsiz);
  28786. tile.ty0 = Math.max(siz.YTOsiz + q * siz.YTsiz, siz.YOsiz);
  28787. tile.tx1 = Math.min(siz.XTOsiz + (p + 1) * siz.XTsiz, siz.Xsiz);
  28788. tile.ty1 = Math.min(siz.YTOsiz + (q + 1) * siz.YTsiz, siz.Ysiz);
  28789. tile.width = tile.tx1 - tile.tx0;
  28790. tile.height = tile.ty1 - tile.ty0;
  28791. tile.components = [];
  28792. tiles.push(tile);
  28793. }
  28794. }
  28795. context.tiles = tiles;
  28796. var componentsCount = siz.Csiz;
  28797. for (var i = 0, ii = componentsCount; i < ii; i++) {
  28798. var component = components[i];
  28799. for (var j = 0, jj = tiles.length; j < jj; j++) {
  28800. var tileComponent = {};
  28801. tile = tiles[j];
  28802. tileComponent.tcx0 = Math.ceil(tile.tx0 / component.XRsiz);
  28803. tileComponent.tcy0 = Math.ceil(tile.ty0 / component.YRsiz);
  28804. tileComponent.tcx1 = Math.ceil(tile.tx1 / component.XRsiz);
  28805. tileComponent.tcy1 = Math.ceil(tile.ty1 / component.YRsiz);
  28806. tileComponent.width = tileComponent.tcx1 - tileComponent.tcx0;
  28807. tileComponent.height = tileComponent.tcy1 - tileComponent.tcy0;
  28808. tile.components[i] = tileComponent;
  28809. }
  28810. }
  28811. }
  28812. function getBlocksDimensions(context, component, r) {
  28813. var codOrCoc = component.codingStyleParameters;
  28814. var result = {};
  28815. if (!codOrCoc.entropyCoderWithCustomPrecincts) {
  28816. result.PPx = 15;
  28817. result.PPy = 15;
  28818. } else {
  28819. result.PPx = codOrCoc.precinctsSizes[r].PPx;
  28820. result.PPy = codOrCoc.precinctsSizes[r].PPy;
  28821. }
  28822. result.xcb_ = r > 0 ? Math.min(codOrCoc.xcb, result.PPx - 1) : Math.min(codOrCoc.xcb, result.PPx);
  28823. result.ycb_ = r > 0 ? Math.min(codOrCoc.ycb, result.PPy - 1) : Math.min(codOrCoc.ycb, result.PPy);
  28824. return result;
  28825. }
  28826. function buildPrecincts(context, resolution, dimensions) {
  28827. var precinctWidth = 1 << dimensions.PPx;
  28828. var precinctHeight = 1 << dimensions.PPy;
  28829. var isZeroRes = resolution.resLevel === 0;
  28830. var precinctWidthInSubband = 1 << dimensions.PPx + (isZeroRes ? 0 : -1);
  28831. var precinctHeightInSubband = 1 << dimensions.PPy + (isZeroRes ? 0 : -1);
  28832. var numprecinctswide = resolution.trx1 > resolution.trx0 ? Math.ceil(resolution.trx1 / precinctWidth) - Math.floor(resolution.trx0 / precinctWidth) : 0;
  28833. var numprecinctshigh = resolution.try1 > resolution.try0 ? Math.ceil(resolution.try1 / precinctHeight) - Math.floor(resolution.try0 / precinctHeight) : 0;
  28834. var numprecincts = numprecinctswide * numprecinctshigh;
  28835. resolution.precinctParameters = {
  28836. precinctWidth: precinctWidth,
  28837. precinctHeight: precinctHeight,
  28838. numprecinctswide: numprecinctswide,
  28839. numprecinctshigh: numprecinctshigh,
  28840. numprecincts: numprecincts,
  28841. precinctWidthInSubband: precinctWidthInSubband,
  28842. precinctHeightInSubband: precinctHeightInSubband
  28843. };
  28844. }
  28845. function buildCodeblocks(context, subband, dimensions) {
  28846. var xcb_ = dimensions.xcb_;
  28847. var ycb_ = dimensions.ycb_;
  28848. var codeblockWidth = 1 << xcb_;
  28849. var codeblockHeight = 1 << ycb_;
  28850. var cbx0 = subband.tbx0 >> xcb_;
  28851. var cby0 = subband.tby0 >> ycb_;
  28852. var cbx1 = subband.tbx1 + codeblockWidth - 1 >> xcb_;
  28853. var cby1 = subband.tby1 + codeblockHeight - 1 >> ycb_;
  28854. var precinctParameters = subband.resolution.precinctParameters;
  28855. var codeblocks = [];
  28856. var precincts = [];
  28857. var i, j, codeblock, precinctNumber;
  28858. for (j = cby0; j < cby1; j++) {
  28859. for (i = cbx0; i < cbx1; i++) {
  28860. codeblock = {
  28861. cbx: i,
  28862. cby: j,
  28863. tbx0: codeblockWidth * i,
  28864. tby0: codeblockHeight * j,
  28865. tbx1: codeblockWidth * (i + 1),
  28866. tby1: codeblockHeight * (j + 1)
  28867. };
  28868. codeblock.tbx0_ = Math.max(subband.tbx0, codeblock.tbx0);
  28869. codeblock.tby0_ = Math.max(subband.tby0, codeblock.tby0);
  28870. codeblock.tbx1_ = Math.min(subband.tbx1, codeblock.tbx1);
  28871. codeblock.tby1_ = Math.min(subband.tby1, codeblock.tby1);
  28872. var pi = Math.floor((codeblock.tbx0_ - subband.tbx0) / precinctParameters.precinctWidthInSubband);
  28873. var pj = Math.floor((codeblock.tby0_ - subband.tby0) / precinctParameters.precinctHeightInSubband);
  28874. precinctNumber = pi + pj * precinctParameters.numprecinctswide;
  28875. codeblock.precinctNumber = precinctNumber;
  28876. codeblock.subbandType = subband.type;
  28877. codeblock.Lblock = 3;
  28878. if (codeblock.tbx1_ <= codeblock.tbx0_ || codeblock.tby1_ <= codeblock.tby0_) {
  28879. continue;
  28880. }
  28881. codeblocks.push(codeblock);
  28882. var precinct = precincts[precinctNumber];
  28883. if (precinct !== undefined) {
  28884. if (i < precinct.cbxMin) {
  28885. precinct.cbxMin = i;
  28886. } else if (i > precinct.cbxMax) {
  28887. precinct.cbxMax = i;
  28888. }
  28889. if (j < precinct.cbyMin) {
  28890. precinct.cbxMin = j;
  28891. } else if (j > precinct.cbyMax) {
  28892. precinct.cbyMax = j;
  28893. }
  28894. } else {
  28895. precincts[precinctNumber] = precinct = {
  28896. cbxMin: i,
  28897. cbyMin: j,
  28898. cbxMax: i,
  28899. cbyMax: j
  28900. };
  28901. }
  28902. codeblock.precinct = precinct;
  28903. }
  28904. }
  28905. subband.codeblockParameters = {
  28906. codeblockWidth: xcb_,
  28907. codeblockHeight: ycb_,
  28908. numcodeblockwide: cbx1 - cbx0 + 1,
  28909. numcodeblockhigh: cby1 - cby0 + 1
  28910. };
  28911. subband.codeblocks = codeblocks;
  28912. subband.precincts = precincts;
  28913. }
  28914. function createPacket(resolution, precinctNumber, layerNumber) {
  28915. var precinctCodeblocks = [];
  28916. var subbands = resolution.subbands;
  28917. for (var i = 0, ii = subbands.length; i < ii; i++) {
  28918. var subband = subbands[i];
  28919. var codeblocks = subband.codeblocks;
  28920. for (var j = 0, jj = codeblocks.length; j < jj; j++) {
  28921. var codeblock = codeblocks[j];
  28922. if (codeblock.precinctNumber !== precinctNumber) {
  28923. continue;
  28924. }
  28925. precinctCodeblocks.push(codeblock);
  28926. }
  28927. }
  28928. return {
  28929. layerNumber: layerNumber,
  28930. codeblocks: precinctCodeblocks
  28931. };
  28932. }
  28933. function LayerResolutionComponentPositionIterator(context) {
  28934. var siz = context.SIZ;
  28935. var tileIndex = context.currentTile.index;
  28936. var tile = context.tiles[tileIndex];
  28937. var layersCount = tile.codingStyleDefaultParameters.layersCount;
  28938. var componentsCount = siz.Csiz;
  28939. var maxDecompositionLevelsCount = 0;
  28940. for (var q = 0; q < componentsCount; q++) {
  28941. maxDecompositionLevelsCount = Math.max(maxDecompositionLevelsCount, tile.components[q].codingStyleParameters.decompositionLevelsCount);
  28942. }
  28943. var l = 0, r = 0, i = 0, k = 0;
  28944. this.nextPacket = function JpxImage_nextPacket() {
  28945. for (; l < layersCount; l++) {
  28946. for (; r <= maxDecompositionLevelsCount; r++) {
  28947. for (; i < componentsCount; i++) {
  28948. var component = tile.components[i];
  28949. if (r > component.codingStyleParameters.decompositionLevelsCount) {
  28950. continue;
  28951. }
  28952. var resolution = component.resolutions[r];
  28953. var numprecincts = resolution.precinctParameters.numprecincts;
  28954. for (; k < numprecincts;) {
  28955. var packet = createPacket(resolution, k, l);
  28956. k++;
  28957. return packet;
  28958. }
  28959. k = 0;
  28960. }
  28961. i = 0;
  28962. }
  28963. r = 0;
  28964. }
  28965. error('JPX Error: Out of packets');
  28966. };
  28967. }
  28968. function ResolutionLayerComponentPositionIterator(context) {
  28969. var siz = context.SIZ;
  28970. var tileIndex = context.currentTile.index;
  28971. var tile = context.tiles[tileIndex];
  28972. var layersCount = tile.codingStyleDefaultParameters.layersCount;
  28973. var componentsCount = siz.Csiz;
  28974. var maxDecompositionLevelsCount = 0;
  28975. for (var q = 0; q < componentsCount; q++) {
  28976. maxDecompositionLevelsCount = Math.max(maxDecompositionLevelsCount, tile.components[q].codingStyleParameters.decompositionLevelsCount);
  28977. }
  28978. var r = 0, l = 0, i = 0, k = 0;
  28979. this.nextPacket = function JpxImage_nextPacket() {
  28980. for (; r <= maxDecompositionLevelsCount; r++) {
  28981. for (; l < layersCount; l++) {
  28982. for (; i < componentsCount; i++) {
  28983. var component = tile.components[i];
  28984. if (r > component.codingStyleParameters.decompositionLevelsCount) {
  28985. continue;
  28986. }
  28987. var resolution = component.resolutions[r];
  28988. var numprecincts = resolution.precinctParameters.numprecincts;
  28989. for (; k < numprecincts;) {
  28990. var packet = createPacket(resolution, k, l);
  28991. k++;
  28992. return packet;
  28993. }
  28994. k = 0;
  28995. }
  28996. i = 0;
  28997. }
  28998. l = 0;
  28999. }
  29000. error('JPX Error: Out of packets');
  29001. };
  29002. }
  29003. function ResolutionPositionComponentLayerIterator(context) {
  29004. var siz = context.SIZ;
  29005. var tileIndex = context.currentTile.index;
  29006. var tile = context.tiles[tileIndex];
  29007. var layersCount = tile.codingStyleDefaultParameters.layersCount;
  29008. var componentsCount = siz.Csiz;
  29009. var l, r, c, p;
  29010. var maxDecompositionLevelsCount = 0;
  29011. for (c = 0; c < componentsCount; c++) {
  29012. var component = tile.components[c];
  29013. maxDecompositionLevelsCount = Math.max(maxDecompositionLevelsCount, component.codingStyleParameters.decompositionLevelsCount);
  29014. }
  29015. var maxNumPrecinctsInLevel = new Int32Array(maxDecompositionLevelsCount + 1);
  29016. for (r = 0; r <= maxDecompositionLevelsCount; ++r) {
  29017. var maxNumPrecincts = 0;
  29018. for (c = 0; c < componentsCount; ++c) {
  29019. var resolutions = tile.components[c].resolutions;
  29020. if (r < resolutions.length) {
  29021. maxNumPrecincts = Math.max(maxNumPrecincts, resolutions[r].precinctParameters.numprecincts);
  29022. }
  29023. }
  29024. maxNumPrecinctsInLevel[r] = maxNumPrecincts;
  29025. }
  29026. l = 0;
  29027. r = 0;
  29028. c = 0;
  29029. p = 0;
  29030. this.nextPacket = function JpxImage_nextPacket() {
  29031. for (; r <= maxDecompositionLevelsCount; r++) {
  29032. for (; p < maxNumPrecinctsInLevel[r]; p++) {
  29033. for (; c < componentsCount; c++) {
  29034. var component = tile.components[c];
  29035. if (r > component.codingStyleParameters.decompositionLevelsCount) {
  29036. continue;
  29037. }
  29038. var resolution = component.resolutions[r];
  29039. var numprecincts = resolution.precinctParameters.numprecincts;
  29040. if (p >= numprecincts) {
  29041. continue;
  29042. }
  29043. for (; l < layersCount;) {
  29044. var packet = createPacket(resolution, p, l);
  29045. l++;
  29046. return packet;
  29047. }
  29048. l = 0;
  29049. }
  29050. c = 0;
  29051. }
  29052. p = 0;
  29053. }
  29054. error('JPX Error: Out of packets');
  29055. };
  29056. }
  29057. function PositionComponentResolutionLayerIterator(context) {
  29058. var siz = context.SIZ;
  29059. var tileIndex = context.currentTile.index;
  29060. var tile = context.tiles[tileIndex];
  29061. var layersCount = tile.codingStyleDefaultParameters.layersCount;
  29062. var componentsCount = siz.Csiz;
  29063. var precinctsSizes = getPrecinctSizesInImageScale(tile);
  29064. var precinctsIterationSizes = precinctsSizes;
  29065. var l = 0, r = 0, c = 0, px = 0, py = 0;
  29066. this.nextPacket = function JpxImage_nextPacket() {
  29067. for (; py < precinctsIterationSizes.maxNumHigh; py++) {
  29068. for (; px < precinctsIterationSizes.maxNumWide; px++) {
  29069. for (; c < componentsCount; c++) {
  29070. var component = tile.components[c];
  29071. var decompositionLevelsCount = component.codingStyleParameters.decompositionLevelsCount;
  29072. for (; r <= decompositionLevelsCount; r++) {
  29073. var resolution = component.resolutions[r];
  29074. var sizeInImageScale = precinctsSizes.components[c].resolutions[r];
  29075. var k = getPrecinctIndexIfExist(px, py, sizeInImageScale, precinctsIterationSizes, resolution);
  29076. if (k === null) {
  29077. continue;
  29078. }
  29079. for (; l < layersCount;) {
  29080. var packet = createPacket(resolution, k, l);
  29081. l++;
  29082. return packet;
  29083. }
  29084. l = 0;
  29085. }
  29086. r = 0;
  29087. }
  29088. c = 0;
  29089. }
  29090. px = 0;
  29091. }
  29092. error('JPX Error: Out of packets');
  29093. };
  29094. }
  29095. function ComponentPositionResolutionLayerIterator(context) {
  29096. var siz = context.SIZ;
  29097. var tileIndex = context.currentTile.index;
  29098. var tile = context.tiles[tileIndex];
  29099. var layersCount = tile.codingStyleDefaultParameters.layersCount;
  29100. var componentsCount = siz.Csiz;
  29101. var precinctsSizes = getPrecinctSizesInImageScale(tile);
  29102. var l = 0, r = 0, c = 0, px = 0, py = 0;
  29103. this.nextPacket = function JpxImage_nextPacket() {
  29104. for (; c < componentsCount; ++c) {
  29105. var component = tile.components[c];
  29106. var precinctsIterationSizes = precinctsSizes.components[c];
  29107. var decompositionLevelsCount = component.codingStyleParameters.decompositionLevelsCount;
  29108. for (; py < precinctsIterationSizes.maxNumHigh; py++) {
  29109. for (; px < precinctsIterationSizes.maxNumWide; px++) {
  29110. for (; r <= decompositionLevelsCount; r++) {
  29111. var resolution = component.resolutions[r];
  29112. var sizeInImageScale = precinctsIterationSizes.resolutions[r];
  29113. var k = getPrecinctIndexIfExist(px, py, sizeInImageScale, precinctsIterationSizes, resolution);
  29114. if (k === null) {
  29115. continue;
  29116. }
  29117. for (; l < layersCount;) {
  29118. var packet = createPacket(resolution, k, l);
  29119. l++;
  29120. return packet;
  29121. }
  29122. l = 0;
  29123. }
  29124. r = 0;
  29125. }
  29126. px = 0;
  29127. }
  29128. py = 0;
  29129. }
  29130. error('JPX Error: Out of packets');
  29131. };
  29132. }
  29133. function getPrecinctIndexIfExist(pxIndex, pyIndex, sizeInImageScale, precinctIterationSizes, resolution) {
  29134. var posX = pxIndex * precinctIterationSizes.minWidth;
  29135. var posY = pyIndex * precinctIterationSizes.minHeight;
  29136. if (posX % sizeInImageScale.width !== 0 || posY % sizeInImageScale.height !== 0) {
  29137. return null;
  29138. }
  29139. var startPrecinctRowIndex = posY / sizeInImageScale.width * resolution.precinctParameters.numprecinctswide;
  29140. return posX / sizeInImageScale.height + startPrecinctRowIndex;
  29141. }
  29142. function getPrecinctSizesInImageScale(tile) {
  29143. var componentsCount = tile.components.length;
  29144. var minWidth = Number.MAX_VALUE;
  29145. var minHeight = Number.MAX_VALUE;
  29146. var maxNumWide = 0;
  29147. var maxNumHigh = 0;
  29148. var sizePerComponent = new Array(componentsCount);
  29149. for (var c = 0; c < componentsCount; c++) {
  29150. var component = tile.components[c];
  29151. var decompositionLevelsCount = component.codingStyleParameters.decompositionLevelsCount;
  29152. var sizePerResolution = new Array(decompositionLevelsCount + 1);
  29153. var minWidthCurrentComponent = Number.MAX_VALUE;
  29154. var minHeightCurrentComponent = Number.MAX_VALUE;
  29155. var maxNumWideCurrentComponent = 0;
  29156. var maxNumHighCurrentComponent = 0;
  29157. var scale = 1;
  29158. for (var r = decompositionLevelsCount; r >= 0; --r) {
  29159. var resolution = component.resolutions[r];
  29160. var widthCurrentResolution = scale * resolution.precinctParameters.precinctWidth;
  29161. var heightCurrentResolution = scale * resolution.precinctParameters.precinctHeight;
  29162. minWidthCurrentComponent = Math.min(minWidthCurrentComponent, widthCurrentResolution);
  29163. minHeightCurrentComponent = Math.min(minHeightCurrentComponent, heightCurrentResolution);
  29164. maxNumWideCurrentComponent = Math.max(maxNumWideCurrentComponent, resolution.precinctParameters.numprecinctswide);
  29165. maxNumHighCurrentComponent = Math.max(maxNumHighCurrentComponent, resolution.precinctParameters.numprecinctshigh);
  29166. sizePerResolution[r] = {
  29167. width: widthCurrentResolution,
  29168. height: heightCurrentResolution
  29169. };
  29170. scale <<= 1;
  29171. }
  29172. minWidth = Math.min(minWidth, minWidthCurrentComponent);
  29173. minHeight = Math.min(minHeight, minHeightCurrentComponent);
  29174. maxNumWide = Math.max(maxNumWide, maxNumWideCurrentComponent);
  29175. maxNumHigh = Math.max(maxNumHigh, maxNumHighCurrentComponent);
  29176. sizePerComponent[c] = {
  29177. resolutions: sizePerResolution,
  29178. minWidth: minWidthCurrentComponent,
  29179. minHeight: minHeightCurrentComponent,
  29180. maxNumWide: maxNumWideCurrentComponent,
  29181. maxNumHigh: maxNumHighCurrentComponent
  29182. };
  29183. }
  29184. return {
  29185. components: sizePerComponent,
  29186. minWidth: minWidth,
  29187. minHeight: minHeight,
  29188. maxNumWide: maxNumWide,
  29189. maxNumHigh: maxNumHigh
  29190. };
  29191. }
  29192. function buildPackets(context) {
  29193. var siz = context.SIZ;
  29194. var tileIndex = context.currentTile.index;
  29195. var tile = context.tiles[tileIndex];
  29196. var componentsCount = siz.Csiz;
  29197. for (var c = 0; c < componentsCount; c++) {
  29198. var component = tile.components[c];
  29199. var decompositionLevelsCount = component.codingStyleParameters.decompositionLevelsCount;
  29200. var resolutions = [];
  29201. var subbands = [];
  29202. for (var r = 0; r <= decompositionLevelsCount; r++) {
  29203. var blocksDimensions = getBlocksDimensions(context, component, r);
  29204. var resolution = {};
  29205. var scale = 1 << decompositionLevelsCount - r;
  29206. resolution.trx0 = Math.ceil(component.tcx0 / scale);
  29207. resolution.try0 = Math.ceil(component.tcy0 / scale);
  29208. resolution.trx1 = Math.ceil(component.tcx1 / scale);
  29209. resolution.try1 = Math.ceil(component.tcy1 / scale);
  29210. resolution.resLevel = r;
  29211. buildPrecincts(context, resolution, blocksDimensions);
  29212. resolutions.push(resolution);
  29213. var subband;
  29214. if (r === 0) {
  29215. subband = {};
  29216. subband.type = 'LL';
  29217. subband.tbx0 = Math.ceil(component.tcx0 / scale);
  29218. subband.tby0 = Math.ceil(component.tcy0 / scale);
  29219. subband.tbx1 = Math.ceil(component.tcx1 / scale);
  29220. subband.tby1 = Math.ceil(component.tcy1 / scale);
  29221. subband.resolution = resolution;
  29222. buildCodeblocks(context, subband, blocksDimensions);
  29223. subbands.push(subband);
  29224. resolution.subbands = [subband];
  29225. } else {
  29226. var bscale = 1 << decompositionLevelsCount - r + 1;
  29227. var resolutionSubbands = [];
  29228. subband = {};
  29229. subband.type = 'HL';
  29230. subband.tbx0 = Math.ceil(component.tcx0 / bscale - 0.5);
  29231. subband.tby0 = Math.ceil(component.tcy0 / bscale);
  29232. subband.tbx1 = Math.ceil(component.tcx1 / bscale - 0.5);
  29233. subband.tby1 = Math.ceil(component.tcy1 / bscale);
  29234. subband.resolution = resolution;
  29235. buildCodeblocks(context, subband, blocksDimensions);
  29236. subbands.push(subband);
  29237. resolutionSubbands.push(subband);
  29238. subband = {};
  29239. subband.type = 'LH';
  29240. subband.tbx0 = Math.ceil(component.tcx0 / bscale);
  29241. subband.tby0 = Math.ceil(component.tcy0 / bscale - 0.5);
  29242. subband.tbx1 = Math.ceil(component.tcx1 / bscale);
  29243. subband.tby1 = Math.ceil(component.tcy1 / bscale - 0.5);
  29244. subband.resolution = resolution;
  29245. buildCodeblocks(context, subband, blocksDimensions);
  29246. subbands.push(subband);
  29247. resolutionSubbands.push(subband);
  29248. subband = {};
  29249. subband.type = 'HH';
  29250. subband.tbx0 = Math.ceil(component.tcx0 / bscale - 0.5);
  29251. subband.tby0 = Math.ceil(component.tcy0 / bscale - 0.5);
  29252. subband.tbx1 = Math.ceil(component.tcx1 / bscale - 0.5);
  29253. subband.tby1 = Math.ceil(component.tcy1 / bscale - 0.5);
  29254. subband.resolution = resolution;
  29255. buildCodeblocks(context, subband, blocksDimensions);
  29256. subbands.push(subband);
  29257. resolutionSubbands.push(subband);
  29258. resolution.subbands = resolutionSubbands;
  29259. }
  29260. }
  29261. component.resolutions = resolutions;
  29262. component.subbands = subbands;
  29263. }
  29264. var progressionOrder = tile.codingStyleDefaultParameters.progressionOrder;
  29265. switch (progressionOrder) {
  29266. case 0:
  29267. tile.packetsIterator = new LayerResolutionComponentPositionIterator(context);
  29268. break;
  29269. case 1:
  29270. tile.packetsIterator = new ResolutionLayerComponentPositionIterator(context);
  29271. break;
  29272. case 2:
  29273. tile.packetsIterator = new ResolutionPositionComponentLayerIterator(context);
  29274. break;
  29275. case 3:
  29276. tile.packetsIterator = new PositionComponentResolutionLayerIterator(context);
  29277. break;
  29278. case 4:
  29279. tile.packetsIterator = new ComponentPositionResolutionLayerIterator(context);
  29280. break;
  29281. default:
  29282. error('JPX Error: Unsupported progression order ' + progressionOrder);
  29283. }
  29284. }
  29285. function parseTilePackets(context, data, offset, dataLength) {
  29286. var position = 0;
  29287. var buffer, bufferSize = 0, skipNextBit = false;
  29288. function readBits(count) {
  29289. while (bufferSize < count) {
  29290. var b = data[offset + position];
  29291. position++;
  29292. if (skipNextBit) {
  29293. buffer = buffer << 7 | b;
  29294. bufferSize += 7;
  29295. skipNextBit = false;
  29296. } else {
  29297. buffer = buffer << 8 | b;
  29298. bufferSize += 8;
  29299. }
  29300. if (b === 0xFF) {
  29301. skipNextBit = true;
  29302. }
  29303. }
  29304. bufferSize -= count;
  29305. return buffer >>> bufferSize & (1 << count) - 1;
  29306. }
  29307. function skipMarkerIfEqual(value) {
  29308. if (data[offset + position - 1] === 0xFF && data[offset + position] === value) {
  29309. skipBytes(1);
  29310. return true;
  29311. } else if (data[offset + position] === 0xFF && data[offset + position + 1] === value) {
  29312. skipBytes(2);
  29313. return true;
  29314. }
  29315. return false;
  29316. }
  29317. function skipBytes(count) {
  29318. position += count;
  29319. }
  29320. function alignToByte() {
  29321. bufferSize = 0;
  29322. if (skipNextBit) {
  29323. position++;
  29324. skipNextBit = false;
  29325. }
  29326. }
  29327. function readCodingpasses() {
  29328. if (readBits(1) === 0) {
  29329. return 1;
  29330. }
  29331. if (readBits(1) === 0) {
  29332. return 2;
  29333. }
  29334. var value = readBits(2);
  29335. if (value < 3) {
  29336. return value + 3;
  29337. }
  29338. value = readBits(5);
  29339. if (value < 31) {
  29340. return value + 6;
  29341. }
  29342. value = readBits(7);
  29343. return value + 37;
  29344. }
  29345. var tileIndex = context.currentTile.index;
  29346. var tile = context.tiles[tileIndex];
  29347. var sopMarkerUsed = context.COD.sopMarkerUsed;
  29348. var ephMarkerUsed = context.COD.ephMarkerUsed;
  29349. var packetsIterator = tile.packetsIterator;
  29350. while (position < dataLength) {
  29351. alignToByte();
  29352. if (sopMarkerUsed && skipMarkerIfEqual(0x91)) {
  29353. skipBytes(4);
  29354. }
  29355. var packet = packetsIterator.nextPacket();
  29356. if (!readBits(1)) {
  29357. continue;
  29358. }
  29359. var layerNumber = packet.layerNumber;
  29360. var queue = [], codeblock;
  29361. for (var i = 0, ii = packet.codeblocks.length; i < ii; i++) {
  29362. codeblock = packet.codeblocks[i];
  29363. var precinct = codeblock.precinct;
  29364. var codeblockColumn = codeblock.cbx - precinct.cbxMin;
  29365. var codeblockRow = codeblock.cby - precinct.cbyMin;
  29366. var codeblockIncluded = false;
  29367. var firstTimeInclusion = false;
  29368. var valueReady;
  29369. if (codeblock['included'] !== undefined) {
  29370. codeblockIncluded = !!readBits(1);
  29371. } else {
  29372. precinct = codeblock.precinct;
  29373. var inclusionTree, zeroBitPlanesTree;
  29374. if (precinct['inclusionTree'] !== undefined) {
  29375. inclusionTree = precinct.inclusionTree;
  29376. } else {
  29377. var width = precinct.cbxMax - precinct.cbxMin + 1;
  29378. var height = precinct.cbyMax - precinct.cbyMin + 1;
  29379. inclusionTree = new InclusionTree(width, height, layerNumber);
  29380. zeroBitPlanesTree = new TagTree(width, height);
  29381. precinct.inclusionTree = inclusionTree;
  29382. precinct.zeroBitPlanesTree = zeroBitPlanesTree;
  29383. }
  29384. if (inclusionTree.reset(codeblockColumn, codeblockRow, layerNumber)) {
  29385. while (true) {
  29386. if (readBits(1)) {
  29387. valueReady = !inclusionTree.nextLevel();
  29388. if (valueReady) {
  29389. codeblock.included = true;
  29390. codeblockIncluded = firstTimeInclusion = true;
  29391. break;
  29392. }
  29393. } else {
  29394. inclusionTree.incrementValue(layerNumber);
  29395. break;
  29396. }
  29397. }
  29398. }
  29399. }
  29400. if (!codeblockIncluded) {
  29401. continue;
  29402. }
  29403. if (firstTimeInclusion) {
  29404. zeroBitPlanesTree = precinct.zeroBitPlanesTree;
  29405. zeroBitPlanesTree.reset(codeblockColumn, codeblockRow);
  29406. while (true) {
  29407. if (readBits(1)) {
  29408. valueReady = !zeroBitPlanesTree.nextLevel();
  29409. if (valueReady) {
  29410. break;
  29411. }
  29412. } else {
  29413. zeroBitPlanesTree.incrementValue();
  29414. }
  29415. }
  29416. codeblock.zeroBitPlanes = zeroBitPlanesTree.value;
  29417. }
  29418. var codingpasses = readCodingpasses();
  29419. while (readBits(1)) {
  29420. codeblock.Lblock++;
  29421. }
  29422. var codingpassesLog2 = log2(codingpasses);
  29423. var bits = (codingpasses < 1 << codingpassesLog2 ? codingpassesLog2 - 1 : codingpassesLog2) + codeblock.Lblock;
  29424. var codedDataLength = readBits(bits);
  29425. queue.push({
  29426. codeblock: codeblock,
  29427. codingpasses: codingpasses,
  29428. dataLength: codedDataLength
  29429. });
  29430. }
  29431. alignToByte();
  29432. if (ephMarkerUsed) {
  29433. skipMarkerIfEqual(0x92);
  29434. }
  29435. while (queue.length > 0) {
  29436. var packetItem = queue.shift();
  29437. codeblock = packetItem.codeblock;
  29438. if (codeblock['data'] === undefined) {
  29439. codeblock.data = [];
  29440. }
  29441. codeblock.data.push({
  29442. data: data,
  29443. start: offset + position,
  29444. end: offset + position + packetItem.dataLength,
  29445. codingpasses: packetItem.codingpasses
  29446. });
  29447. position += packetItem.dataLength;
  29448. }
  29449. }
  29450. return position;
  29451. }
  29452. function copyCoefficients(coefficients, levelWidth, levelHeight, subband, delta, mb, reversible, segmentationSymbolUsed) {
  29453. var x0 = subband.tbx0;
  29454. var y0 = subband.tby0;
  29455. var width = subband.tbx1 - subband.tbx0;
  29456. var codeblocks = subband.codeblocks;
  29457. var right = subband.type.charAt(0) === 'H' ? 1 : 0;
  29458. var bottom = subband.type.charAt(1) === 'H' ? levelWidth : 0;
  29459. for (var i = 0, ii = codeblocks.length; i < ii; ++i) {
  29460. var codeblock = codeblocks[i];
  29461. var blockWidth = codeblock.tbx1_ - codeblock.tbx0_;
  29462. var blockHeight = codeblock.tby1_ - codeblock.tby0_;
  29463. if (blockWidth === 0 || blockHeight === 0) {
  29464. continue;
  29465. }
  29466. if (codeblock['data'] === undefined) {
  29467. continue;
  29468. }
  29469. var bitModel, currentCodingpassType;
  29470. bitModel = new BitModel(blockWidth, blockHeight, codeblock.subbandType, codeblock.zeroBitPlanes, mb);
  29471. currentCodingpassType = 2;
  29472. var data = codeblock.data, totalLength = 0, codingpasses = 0;
  29473. var j, jj, dataItem;
  29474. for (j = 0, jj = data.length; j < jj; j++) {
  29475. dataItem = data[j];
  29476. totalLength += dataItem.end - dataItem.start;
  29477. codingpasses += dataItem.codingpasses;
  29478. }
  29479. var encodedData = new Uint8Array(totalLength);
  29480. var position = 0;
  29481. for (j = 0, jj = data.length; j < jj; j++) {
  29482. dataItem = data[j];
  29483. var chunk = dataItem.data.subarray(dataItem.start, dataItem.end);
  29484. encodedData.set(chunk, position);
  29485. position += chunk.length;
  29486. }
  29487. var decoder = new ArithmeticDecoder(encodedData, 0, totalLength);
  29488. bitModel.setDecoder(decoder);
  29489. for (j = 0; j < codingpasses; j++) {
  29490. switch (currentCodingpassType) {
  29491. case 0:
  29492. bitModel.runSignificancePropagationPass();
  29493. break;
  29494. case 1:
  29495. bitModel.runMagnitudeRefinementPass();
  29496. break;
  29497. case 2:
  29498. bitModel.runCleanupPass();
  29499. if (segmentationSymbolUsed) {
  29500. bitModel.checkSegmentationSymbol();
  29501. }
  29502. break;
  29503. }
  29504. currentCodingpassType = (currentCodingpassType + 1) % 3;
  29505. }
  29506. var offset = codeblock.tbx0_ - x0 + (codeblock.tby0_ - y0) * width;
  29507. var sign = bitModel.coefficentsSign;
  29508. var magnitude = bitModel.coefficentsMagnitude;
  29509. var bitsDecoded = bitModel.bitsDecoded;
  29510. var magnitudeCorrection = reversible ? 0 : 0.5;
  29511. var k, n, nb;
  29512. position = 0;
  29513. var interleave = subband.type !== 'LL';
  29514. for (j = 0; j < blockHeight; j++) {
  29515. var row = offset / width | 0;
  29516. var levelOffset = 2 * row * (levelWidth - width) + right + bottom;
  29517. for (k = 0; k < blockWidth; k++) {
  29518. n = magnitude[position];
  29519. if (n !== 0) {
  29520. n = (n + magnitudeCorrection) * delta;
  29521. if (sign[position] !== 0) {
  29522. n = -n;
  29523. }
  29524. nb = bitsDecoded[position];
  29525. var pos = interleave ? levelOffset + (offset << 1) : offset;
  29526. if (reversible && nb >= mb) {
  29527. coefficients[pos] = n;
  29528. } else {
  29529. coefficients[pos] = n * (1 << mb - nb);
  29530. }
  29531. }
  29532. offset++;
  29533. position++;
  29534. }
  29535. offset += width - blockWidth;
  29536. }
  29537. }
  29538. }
  29539. function transformTile(context, tile, c) {
  29540. var component = tile.components[c];
  29541. var codingStyleParameters = component.codingStyleParameters;
  29542. var quantizationParameters = component.quantizationParameters;
  29543. var decompositionLevelsCount = codingStyleParameters.decompositionLevelsCount;
  29544. var spqcds = quantizationParameters.SPqcds;
  29545. var scalarExpounded = quantizationParameters.scalarExpounded;
  29546. var guardBits = quantizationParameters.guardBits;
  29547. var segmentationSymbolUsed = codingStyleParameters.segmentationSymbolUsed;
  29548. var precision = context.components[c].precision;
  29549. var reversible = codingStyleParameters.reversibleTransformation;
  29550. var transform = reversible ? new ReversibleTransform() : new IrreversibleTransform();
  29551. var subbandCoefficients = [];
  29552. var b = 0;
  29553. for (var i = 0; i <= decompositionLevelsCount; i++) {
  29554. var resolution = component.resolutions[i];
  29555. var width = resolution.trx1 - resolution.trx0;
  29556. var height = resolution.try1 - resolution.try0;
  29557. var coefficients = new Float32Array(width * height);
  29558. for (var j = 0, jj = resolution.subbands.length; j < jj; j++) {
  29559. var mu, epsilon;
  29560. if (!scalarExpounded) {
  29561. mu = spqcds[0].mu;
  29562. epsilon = spqcds[0].epsilon + (i > 0 ? 1 - i : 0);
  29563. } else {
  29564. mu = spqcds[b].mu;
  29565. epsilon = spqcds[b].epsilon;
  29566. b++;
  29567. }
  29568. var subband = resolution.subbands[j];
  29569. var gainLog2 = SubbandsGainLog2[subband.type];
  29570. var delta = reversible ? 1 : Math.pow(2, precision + gainLog2 - epsilon) * (1 + mu / 2048);
  29571. var mb = guardBits + epsilon - 1;
  29572. copyCoefficients(coefficients, width, height, subband, delta, mb, reversible, segmentationSymbolUsed);
  29573. }
  29574. subbandCoefficients.push({
  29575. width: width,
  29576. height: height,
  29577. items: coefficients
  29578. });
  29579. }
  29580. var result = transform.calculate(subbandCoefficients, component.tcx0, component.tcy0);
  29581. return {
  29582. left: component.tcx0,
  29583. top: component.tcy0,
  29584. width: result.width,
  29585. height: result.height,
  29586. items: result.items
  29587. };
  29588. }
  29589. function transformComponents(context) {
  29590. var siz = context.SIZ;
  29591. var components = context.components;
  29592. var componentsCount = siz.Csiz;
  29593. var resultImages = [];
  29594. for (var i = 0, ii = context.tiles.length; i < ii; i++) {
  29595. var tile = context.tiles[i];
  29596. var transformedTiles = [];
  29597. var c;
  29598. for (c = 0; c < componentsCount; c++) {
  29599. transformedTiles[c] = transformTile(context, tile, c);
  29600. }
  29601. var tile0 = transformedTiles[0];
  29602. var out = new Uint8Array(tile0.items.length * componentsCount);
  29603. var result = {
  29604. left: tile0.left,
  29605. top: tile0.top,
  29606. width: tile0.width,
  29607. height: tile0.height,
  29608. items: out
  29609. };
  29610. var shift, offset, max, min, maxK;
  29611. var pos = 0, j, jj, y0, y1, y2, r, g, b, k, val;
  29612. if (tile.codingStyleDefaultParameters.multipleComponentTransform) {
  29613. var fourComponents = componentsCount === 4;
  29614. var y0items = transformedTiles[0].items;
  29615. var y1items = transformedTiles[1].items;
  29616. var y2items = transformedTiles[2].items;
  29617. var y3items = fourComponents ? transformedTiles[3].items : null;
  29618. shift = components[0].precision - 8;
  29619. offset = (128 << shift) + 0.5;
  29620. max = 255 * (1 << shift);
  29621. maxK = max * 0.5;
  29622. min = -maxK;
  29623. var component0 = tile.components[0];
  29624. var alpha01 = componentsCount - 3;
  29625. jj = y0items.length;
  29626. if (!component0.codingStyleParameters.reversibleTransformation) {
  29627. for (j = 0; j < jj; j++, pos += alpha01) {
  29628. y0 = y0items[j] + offset;
  29629. y1 = y1items[j];
  29630. y2 = y2items[j];
  29631. r = y0 + 1.402 * y2;
  29632. g = y0 - 0.34413 * y1 - 0.71414 * y2;
  29633. b = y0 + 1.772 * y1;
  29634. out[pos++] = r <= 0 ? 0 : r >= max ? 255 : r >> shift;
  29635. out[pos++] = g <= 0 ? 0 : g >= max ? 255 : g >> shift;
  29636. out[pos++] = b <= 0 ? 0 : b >= max ? 255 : b >> shift;
  29637. }
  29638. } else {
  29639. for (j = 0; j < jj; j++, pos += alpha01) {
  29640. y0 = y0items[j] + offset;
  29641. y1 = y1items[j];
  29642. y2 = y2items[j];
  29643. g = y0 - (y2 + y1 >> 2);
  29644. r = g + y2;
  29645. b = g + y1;
  29646. out[pos++] = r <= 0 ? 0 : r >= max ? 255 : r >> shift;
  29647. out[pos++] = g <= 0 ? 0 : g >= max ? 255 : g >> shift;
  29648. out[pos++] = b <= 0 ? 0 : b >= max ? 255 : b >> shift;
  29649. }
  29650. }
  29651. if (fourComponents) {
  29652. for (j = 0, pos = 3; j < jj; j++, pos += 4) {
  29653. k = y3items[j];
  29654. out[pos] = k <= min ? 0 : k >= maxK ? 255 : k + offset >> shift;
  29655. }
  29656. }
  29657. } else {
  29658. for (c = 0; c < componentsCount; c++) {
  29659. var items = transformedTiles[c].items;
  29660. shift = components[c].precision - 8;
  29661. offset = (128 << shift) + 0.5;
  29662. max = 127.5 * (1 << shift);
  29663. min = -max;
  29664. for (pos = c, j = 0, jj = items.length; j < jj; j++) {
  29665. val = items[j];
  29666. out[pos] = val <= min ? 0 : val >= max ? 255 : val + offset >> shift;
  29667. pos += componentsCount;
  29668. }
  29669. }
  29670. }
  29671. resultImages.push(result);
  29672. }
  29673. return resultImages;
  29674. }
  29675. function initializeTile(context, tileIndex) {
  29676. var siz = context.SIZ;
  29677. var componentsCount = siz.Csiz;
  29678. var tile = context.tiles[tileIndex];
  29679. for (var c = 0; c < componentsCount; c++) {
  29680. var component = tile.components[c];
  29681. var qcdOrQcc = context.currentTile.QCC[c] !== undefined ? context.currentTile.QCC[c] : context.currentTile.QCD;
  29682. component.quantizationParameters = qcdOrQcc;
  29683. var codOrCoc = context.currentTile.COC[c] !== undefined ? context.currentTile.COC[c] : context.currentTile.COD;
  29684. component.codingStyleParameters = codOrCoc;
  29685. }
  29686. tile.codingStyleDefaultParameters = context.currentTile.COD;
  29687. }
  29688. var TagTree = function TagTreeClosure() {
  29689. function TagTree(width, height) {
  29690. var levelsLength = log2(Math.max(width, height)) + 1;
  29691. this.levels = [];
  29692. for (var i = 0; i < levelsLength; i++) {
  29693. var level = {
  29694. width: width,
  29695. height: height,
  29696. items: []
  29697. };
  29698. this.levels.push(level);
  29699. width = Math.ceil(width / 2);
  29700. height = Math.ceil(height / 2);
  29701. }
  29702. }
  29703. TagTree.prototype = {
  29704. reset: function TagTree_reset(i, j) {
  29705. var currentLevel = 0, value = 0, level;
  29706. while (currentLevel < this.levels.length) {
  29707. level = this.levels[currentLevel];
  29708. var index = i + j * level.width;
  29709. if (level.items[index] !== undefined) {
  29710. value = level.items[index];
  29711. break;
  29712. }
  29713. level.index = index;
  29714. i >>= 1;
  29715. j >>= 1;
  29716. currentLevel++;
  29717. }
  29718. currentLevel--;
  29719. level = this.levels[currentLevel];
  29720. level.items[level.index] = value;
  29721. this.currentLevel = currentLevel;
  29722. delete this.value;
  29723. },
  29724. incrementValue: function TagTree_incrementValue() {
  29725. var level = this.levels[this.currentLevel];
  29726. level.items[level.index]++;
  29727. },
  29728. nextLevel: function TagTree_nextLevel() {
  29729. var currentLevel = this.currentLevel;
  29730. var level = this.levels[currentLevel];
  29731. var value = level.items[level.index];
  29732. currentLevel--;
  29733. if (currentLevel < 0) {
  29734. this.value = value;
  29735. return false;
  29736. }
  29737. this.currentLevel = currentLevel;
  29738. level = this.levels[currentLevel];
  29739. level.items[level.index] = value;
  29740. return true;
  29741. }
  29742. };
  29743. return TagTree;
  29744. }();
  29745. var InclusionTree = function InclusionTreeClosure() {
  29746. function InclusionTree(width, height, defaultValue) {
  29747. var levelsLength = log2(Math.max(width, height)) + 1;
  29748. this.levels = [];
  29749. for (var i = 0; i < levelsLength; i++) {
  29750. var items = new Uint8Array(width * height);
  29751. for (var j = 0, jj = items.length; j < jj; j++) {
  29752. items[j] = defaultValue;
  29753. }
  29754. var level = {
  29755. width: width,
  29756. height: height,
  29757. items: items
  29758. };
  29759. this.levels.push(level);
  29760. width = Math.ceil(width / 2);
  29761. height = Math.ceil(height / 2);
  29762. }
  29763. }
  29764. InclusionTree.prototype = {
  29765. reset: function InclusionTree_reset(i, j, stopValue) {
  29766. var currentLevel = 0;
  29767. while (currentLevel < this.levels.length) {
  29768. var level = this.levels[currentLevel];
  29769. var index = i + j * level.width;
  29770. level.index = index;
  29771. var value = level.items[index];
  29772. if (value === 0xFF) {
  29773. break;
  29774. }
  29775. if (value > stopValue) {
  29776. this.currentLevel = currentLevel;
  29777. this.propagateValues();
  29778. return false;
  29779. }
  29780. i >>= 1;
  29781. j >>= 1;
  29782. currentLevel++;
  29783. }
  29784. this.currentLevel = currentLevel - 1;
  29785. return true;
  29786. },
  29787. incrementValue: function InclusionTree_incrementValue(stopValue) {
  29788. var level = this.levels[this.currentLevel];
  29789. level.items[level.index] = stopValue + 1;
  29790. this.propagateValues();
  29791. },
  29792. propagateValues: function InclusionTree_propagateValues() {
  29793. var levelIndex = this.currentLevel;
  29794. var level = this.levels[levelIndex];
  29795. var currentValue = level.items[level.index];
  29796. while (--levelIndex >= 0) {
  29797. level = this.levels[levelIndex];
  29798. level.items[level.index] = currentValue;
  29799. }
  29800. },
  29801. nextLevel: function InclusionTree_nextLevel() {
  29802. var currentLevel = this.currentLevel;
  29803. var level = this.levels[currentLevel];
  29804. var value = level.items[level.index];
  29805. level.items[level.index] = 0xFF;
  29806. currentLevel--;
  29807. if (currentLevel < 0) {
  29808. return false;
  29809. }
  29810. this.currentLevel = currentLevel;
  29811. level = this.levels[currentLevel];
  29812. level.items[level.index] = value;
  29813. return true;
  29814. }
  29815. };
  29816. return InclusionTree;
  29817. }();
  29818. var BitModel = function BitModelClosure() {
  29819. var UNIFORM_CONTEXT = 17;
  29820. var RUNLENGTH_CONTEXT = 18;
  29821. var LLAndLHContextsLabel = new Uint8Array([
  29822. 0,
  29823. 5,
  29824. 8,
  29825. 0,
  29826. 3,
  29827. 7,
  29828. 8,
  29829. 0,
  29830. 4,
  29831. 7,
  29832. 8,
  29833. 0,
  29834. 0,
  29835. 0,
  29836. 0,
  29837. 0,
  29838. 1,
  29839. 6,
  29840. 8,
  29841. 0,
  29842. 3,
  29843. 7,
  29844. 8,
  29845. 0,
  29846. 4,
  29847. 7,
  29848. 8,
  29849. 0,
  29850. 0,
  29851. 0,
  29852. 0,
  29853. 0,
  29854. 2,
  29855. 6,
  29856. 8,
  29857. 0,
  29858. 3,
  29859. 7,
  29860. 8,
  29861. 0,
  29862. 4,
  29863. 7,
  29864. 8,
  29865. 0,
  29866. 0,
  29867. 0,
  29868. 0,
  29869. 0,
  29870. 2,
  29871. 6,
  29872. 8,
  29873. 0,
  29874. 3,
  29875. 7,
  29876. 8,
  29877. 0,
  29878. 4,
  29879. 7,
  29880. 8,
  29881. 0,
  29882. 0,
  29883. 0,
  29884. 0,
  29885. 0,
  29886. 2,
  29887. 6,
  29888. 8,
  29889. 0,
  29890. 3,
  29891. 7,
  29892. 8,
  29893. 0,
  29894. 4,
  29895. 7,
  29896. 8
  29897. ]);
  29898. var HLContextLabel = new Uint8Array([
  29899. 0,
  29900. 3,
  29901. 4,
  29902. 0,
  29903. 5,
  29904. 7,
  29905. 7,
  29906. 0,
  29907. 8,
  29908. 8,
  29909. 8,
  29910. 0,
  29911. 0,
  29912. 0,
  29913. 0,
  29914. 0,
  29915. 1,
  29916. 3,
  29917. 4,
  29918. 0,
  29919. 6,
  29920. 7,
  29921. 7,
  29922. 0,
  29923. 8,
  29924. 8,
  29925. 8,
  29926. 0,
  29927. 0,
  29928. 0,
  29929. 0,
  29930. 0,
  29931. 2,
  29932. 3,
  29933. 4,
  29934. 0,
  29935. 6,
  29936. 7,
  29937. 7,
  29938. 0,
  29939. 8,
  29940. 8,
  29941. 8,
  29942. 0,
  29943. 0,
  29944. 0,
  29945. 0,
  29946. 0,
  29947. 2,
  29948. 3,
  29949. 4,
  29950. 0,
  29951. 6,
  29952. 7,
  29953. 7,
  29954. 0,
  29955. 8,
  29956. 8,
  29957. 8,
  29958. 0,
  29959. 0,
  29960. 0,
  29961. 0,
  29962. 0,
  29963. 2,
  29964. 3,
  29965. 4,
  29966. 0,
  29967. 6,
  29968. 7,
  29969. 7,
  29970. 0,
  29971. 8,
  29972. 8,
  29973. 8
  29974. ]);
  29975. var HHContextLabel = new Uint8Array([
  29976. 0,
  29977. 1,
  29978. 2,
  29979. 0,
  29980. 1,
  29981. 2,
  29982. 2,
  29983. 0,
  29984. 2,
  29985. 2,
  29986. 2,
  29987. 0,
  29988. 0,
  29989. 0,
  29990. 0,
  29991. 0,
  29992. 3,
  29993. 4,
  29994. 5,
  29995. 0,
  29996. 4,
  29997. 5,
  29998. 5,
  29999. 0,
  30000. 5,
  30001. 5,
  30002. 5,
  30003. 0,
  30004. 0,
  30005. 0,
  30006. 0,
  30007. 0,
  30008. 6,
  30009. 7,
  30010. 7,
  30011. 0,
  30012. 7,
  30013. 7,
  30014. 7,
  30015. 0,
  30016. 7,
  30017. 7,
  30018. 7,
  30019. 0,
  30020. 0,
  30021. 0,
  30022. 0,
  30023. 0,
  30024. 8,
  30025. 8,
  30026. 8,
  30027. 0,
  30028. 8,
  30029. 8,
  30030. 8,
  30031. 0,
  30032. 8,
  30033. 8,
  30034. 8,
  30035. 0,
  30036. 0,
  30037. 0,
  30038. 0,
  30039. 0,
  30040. 8,
  30041. 8,
  30042. 8,
  30043. 0,
  30044. 8,
  30045. 8,
  30046. 8,
  30047. 0,
  30048. 8,
  30049. 8,
  30050. 8
  30051. ]);
  30052. function BitModel(width, height, subband, zeroBitPlanes, mb) {
  30053. this.width = width;
  30054. this.height = height;
  30055. this.contextLabelTable = subband === 'HH' ? HHContextLabel : subband === 'HL' ? HLContextLabel : LLAndLHContextsLabel;
  30056. var coefficientCount = width * height;
  30057. this.neighborsSignificance = new Uint8Array(coefficientCount);
  30058. this.coefficentsSign = new Uint8Array(coefficientCount);
  30059. this.coefficentsMagnitude = mb > 14 ? new Uint32Array(coefficientCount) : mb > 6 ? new Uint16Array(coefficientCount) : new Uint8Array(coefficientCount);
  30060. this.processingFlags = new Uint8Array(coefficientCount);
  30061. var bitsDecoded = new Uint8Array(coefficientCount);
  30062. if (zeroBitPlanes !== 0) {
  30063. for (var i = 0; i < coefficientCount; i++) {
  30064. bitsDecoded[i] = zeroBitPlanes;
  30065. }
  30066. }
  30067. this.bitsDecoded = bitsDecoded;
  30068. this.reset();
  30069. }
  30070. BitModel.prototype = {
  30071. setDecoder: function BitModel_setDecoder(decoder) {
  30072. this.decoder = decoder;
  30073. },
  30074. reset: function BitModel_reset() {
  30075. this.contexts = new Int8Array(19);
  30076. this.contexts[0] = 4 << 1 | 0;
  30077. this.contexts[UNIFORM_CONTEXT] = 46 << 1 | 0;
  30078. this.contexts[RUNLENGTH_CONTEXT] = 3 << 1 | 0;
  30079. },
  30080. setNeighborsSignificance: function BitModel_setNeighborsSignificance(row, column, index) {
  30081. var neighborsSignificance = this.neighborsSignificance;
  30082. var width = this.width, height = this.height;
  30083. var left = column > 0;
  30084. var right = column + 1 < width;
  30085. var i;
  30086. if (row > 0) {
  30087. i = index - width;
  30088. if (left) {
  30089. neighborsSignificance[i - 1] += 0x10;
  30090. }
  30091. if (right) {
  30092. neighborsSignificance[i + 1] += 0x10;
  30093. }
  30094. neighborsSignificance[i] += 0x04;
  30095. }
  30096. if (row + 1 < height) {
  30097. i = index + width;
  30098. if (left) {
  30099. neighborsSignificance[i - 1] += 0x10;
  30100. }
  30101. if (right) {
  30102. neighborsSignificance[i + 1] += 0x10;
  30103. }
  30104. neighborsSignificance[i] += 0x04;
  30105. }
  30106. if (left) {
  30107. neighborsSignificance[index - 1] += 0x01;
  30108. }
  30109. if (right) {
  30110. neighborsSignificance[index + 1] += 0x01;
  30111. }
  30112. neighborsSignificance[index] |= 0x80;
  30113. },
  30114. runSignificancePropagationPass: function BitModel_runSignificancePropagationPass() {
  30115. var decoder = this.decoder;
  30116. var width = this.width, height = this.height;
  30117. var coefficentsMagnitude = this.coefficentsMagnitude;
  30118. var coefficentsSign = this.coefficentsSign;
  30119. var neighborsSignificance = this.neighborsSignificance;
  30120. var processingFlags = this.processingFlags;
  30121. var contexts = this.contexts;
  30122. var labels = this.contextLabelTable;
  30123. var bitsDecoded = this.bitsDecoded;
  30124. var processedInverseMask = ~1;
  30125. var processedMask = 1;
  30126. var firstMagnitudeBitMask = 2;
  30127. for (var i0 = 0; i0 < height; i0 += 4) {
  30128. for (var j = 0; j < width; j++) {
  30129. var index = i0 * width + j;
  30130. for (var i1 = 0; i1 < 4; i1++, index += width) {
  30131. var i = i0 + i1;
  30132. if (i >= height) {
  30133. break;
  30134. }
  30135. processingFlags[index] &= processedInverseMask;
  30136. if (coefficentsMagnitude[index] || !neighborsSignificance[index]) {
  30137. continue;
  30138. }
  30139. var contextLabel = labels[neighborsSignificance[index]];
  30140. var decision = decoder.readBit(contexts, contextLabel);
  30141. if (decision) {
  30142. var sign = this.decodeSignBit(i, j, index);
  30143. coefficentsSign[index] = sign;
  30144. coefficentsMagnitude[index] = 1;
  30145. this.setNeighborsSignificance(i, j, index);
  30146. processingFlags[index] |= firstMagnitudeBitMask;
  30147. }
  30148. bitsDecoded[index]++;
  30149. processingFlags[index] |= processedMask;
  30150. }
  30151. }
  30152. }
  30153. },
  30154. decodeSignBit: function BitModel_decodeSignBit(row, column, index) {
  30155. var width = this.width, height = this.height;
  30156. var coefficentsMagnitude = this.coefficentsMagnitude;
  30157. var coefficentsSign = this.coefficentsSign;
  30158. var contribution, sign0, sign1, significance1;
  30159. var contextLabel, decoded;
  30160. significance1 = column > 0 && coefficentsMagnitude[index - 1] !== 0;
  30161. if (column + 1 < width && coefficentsMagnitude[index + 1] !== 0) {
  30162. sign1 = coefficentsSign[index + 1];
  30163. if (significance1) {
  30164. sign0 = coefficentsSign[index - 1];
  30165. contribution = 1 - sign1 - sign0;
  30166. } else {
  30167. contribution = 1 - sign1 - sign1;
  30168. }
  30169. } else if (significance1) {
  30170. sign0 = coefficentsSign[index - 1];
  30171. contribution = 1 - sign0 - sign0;
  30172. } else {
  30173. contribution = 0;
  30174. }
  30175. var horizontalContribution = 3 * contribution;
  30176. significance1 = row > 0 && coefficentsMagnitude[index - width] !== 0;
  30177. if (row + 1 < height && coefficentsMagnitude[index + width] !== 0) {
  30178. sign1 = coefficentsSign[index + width];
  30179. if (significance1) {
  30180. sign0 = coefficentsSign[index - width];
  30181. contribution = 1 - sign1 - sign0 + horizontalContribution;
  30182. } else {
  30183. contribution = 1 - sign1 - sign1 + horizontalContribution;
  30184. }
  30185. } else if (significance1) {
  30186. sign0 = coefficentsSign[index - width];
  30187. contribution = 1 - sign0 - sign0 + horizontalContribution;
  30188. } else {
  30189. contribution = horizontalContribution;
  30190. }
  30191. if (contribution >= 0) {
  30192. contextLabel = 9 + contribution;
  30193. decoded = this.decoder.readBit(this.contexts, contextLabel);
  30194. } else {
  30195. contextLabel = 9 - contribution;
  30196. decoded = this.decoder.readBit(this.contexts, contextLabel) ^ 1;
  30197. }
  30198. return decoded;
  30199. },
  30200. runMagnitudeRefinementPass: function BitModel_runMagnitudeRefinementPass() {
  30201. var decoder = this.decoder;
  30202. var width = this.width, height = this.height;
  30203. var coefficentsMagnitude = this.coefficentsMagnitude;
  30204. var neighborsSignificance = this.neighborsSignificance;
  30205. var contexts = this.contexts;
  30206. var bitsDecoded = this.bitsDecoded;
  30207. var processingFlags = this.processingFlags;
  30208. var processedMask = 1;
  30209. var firstMagnitudeBitMask = 2;
  30210. var length = width * height;
  30211. var width4 = width * 4;
  30212. for (var index0 = 0, indexNext; index0 < length; index0 = indexNext) {
  30213. indexNext = Math.min(length, index0 + width4);
  30214. for (var j = 0; j < width; j++) {
  30215. for (var index = index0 + j; index < indexNext; index += width) {
  30216. if (!coefficentsMagnitude[index] || (processingFlags[index] & processedMask) !== 0) {
  30217. continue;
  30218. }
  30219. var contextLabel = 16;
  30220. if ((processingFlags[index] & firstMagnitudeBitMask) !== 0) {
  30221. processingFlags[index] ^= firstMagnitudeBitMask;
  30222. var significance = neighborsSignificance[index] & 127;
  30223. contextLabel = significance === 0 ? 15 : 14;
  30224. }
  30225. var bit = decoder.readBit(contexts, contextLabel);
  30226. coefficentsMagnitude[index] = coefficentsMagnitude[index] << 1 | bit;
  30227. bitsDecoded[index]++;
  30228. processingFlags[index] |= processedMask;
  30229. }
  30230. }
  30231. }
  30232. },
  30233. runCleanupPass: function BitModel_runCleanupPass() {
  30234. var decoder = this.decoder;
  30235. var width = this.width, height = this.height;
  30236. var neighborsSignificance = this.neighborsSignificance;
  30237. var coefficentsMagnitude = this.coefficentsMagnitude;
  30238. var coefficentsSign = this.coefficentsSign;
  30239. var contexts = this.contexts;
  30240. var labels = this.contextLabelTable;
  30241. var bitsDecoded = this.bitsDecoded;
  30242. var processingFlags = this.processingFlags;
  30243. var processedMask = 1;
  30244. var firstMagnitudeBitMask = 2;
  30245. var oneRowDown = width;
  30246. var twoRowsDown = width * 2;
  30247. var threeRowsDown = width * 3;
  30248. var iNext;
  30249. for (var i0 = 0; i0 < height; i0 = iNext) {
  30250. iNext = Math.min(i0 + 4, height);
  30251. var indexBase = i0 * width;
  30252. var checkAllEmpty = i0 + 3 < height;
  30253. for (var j = 0; j < width; j++) {
  30254. var index0 = indexBase + j;
  30255. 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;
  30256. var i1 = 0, index = index0;
  30257. var i = i0, sign;
  30258. if (allEmpty) {
  30259. var hasSignificantCoefficent = decoder.readBit(contexts, RUNLENGTH_CONTEXT);
  30260. if (!hasSignificantCoefficent) {
  30261. bitsDecoded[index0]++;
  30262. bitsDecoded[index0 + oneRowDown]++;
  30263. bitsDecoded[index0 + twoRowsDown]++;
  30264. bitsDecoded[index0 + threeRowsDown]++;
  30265. continue;
  30266. }
  30267. i1 = decoder.readBit(contexts, UNIFORM_CONTEXT) << 1 | decoder.readBit(contexts, UNIFORM_CONTEXT);
  30268. if (i1 !== 0) {
  30269. i = i0 + i1;
  30270. index += i1 * width;
  30271. }
  30272. sign = this.decodeSignBit(i, j, index);
  30273. coefficentsSign[index] = sign;
  30274. coefficentsMagnitude[index] = 1;
  30275. this.setNeighborsSignificance(i, j, index);
  30276. processingFlags[index] |= firstMagnitudeBitMask;
  30277. index = index0;
  30278. for (var i2 = i0; i2 <= i; i2++, index += width) {
  30279. bitsDecoded[index]++;
  30280. }
  30281. i1++;
  30282. }
  30283. for (i = i0 + i1; i < iNext; i++, index += width) {
  30284. if (coefficentsMagnitude[index] || (processingFlags[index] & processedMask) !== 0) {
  30285. continue;
  30286. }
  30287. var contextLabel = labels[neighborsSignificance[index]];
  30288. var decision = decoder.readBit(contexts, contextLabel);
  30289. if (decision === 1) {
  30290. sign = this.decodeSignBit(i, j, index);
  30291. coefficentsSign[index] = sign;
  30292. coefficentsMagnitude[index] = 1;
  30293. this.setNeighborsSignificance(i, j, index);
  30294. processingFlags[index] |= firstMagnitudeBitMask;
  30295. }
  30296. bitsDecoded[index]++;
  30297. }
  30298. }
  30299. }
  30300. },
  30301. checkSegmentationSymbol: function BitModel_checkSegmentationSymbol() {
  30302. var decoder = this.decoder;
  30303. var contexts = this.contexts;
  30304. 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);
  30305. if (symbol !== 0xA) {
  30306. error('JPX Error: Invalid segmentation symbol');
  30307. }
  30308. }
  30309. };
  30310. return BitModel;
  30311. }();
  30312. var Transform = function TransformClosure() {
  30313. function Transform() {
  30314. }
  30315. Transform.prototype.calculate = function transformCalculate(subbands, u0, v0) {
  30316. var ll = subbands[0];
  30317. for (var i = 1, ii = subbands.length; i < ii; i++) {
  30318. ll = this.iterate(ll, subbands[i], u0, v0);
  30319. }
  30320. return ll;
  30321. };
  30322. Transform.prototype.extend = function extend(buffer, offset, size) {
  30323. var i1 = offset - 1, j1 = offset + 1;
  30324. var i2 = offset + size - 2, j2 = offset + size;
  30325. buffer[i1--] = buffer[j1++];
  30326. buffer[j2++] = buffer[i2--];
  30327. buffer[i1--] = buffer[j1++];
  30328. buffer[j2++] = buffer[i2--];
  30329. buffer[i1--] = buffer[j1++];
  30330. buffer[j2++] = buffer[i2--];
  30331. buffer[i1] = buffer[j1];
  30332. buffer[j2] = buffer[i2];
  30333. };
  30334. Transform.prototype.iterate = function Transform_iterate(ll, hl_lh_hh, u0, v0) {
  30335. var llWidth = ll.width, llHeight = ll.height, llItems = ll.items;
  30336. var width = hl_lh_hh.width;
  30337. var height = hl_lh_hh.height;
  30338. var items = hl_lh_hh.items;
  30339. var i, j, k, l, u, v;
  30340. for (k = 0, i = 0; i < llHeight; i++) {
  30341. l = i * 2 * width;
  30342. for (j = 0; j < llWidth; j++, k++, l += 2) {
  30343. items[l] = llItems[k];
  30344. }
  30345. }
  30346. llItems = ll.items = null;
  30347. var bufferPadding = 4;
  30348. var rowBuffer = new Float32Array(width + 2 * bufferPadding);
  30349. if (width === 1) {
  30350. if ((u0 & 1) !== 0) {
  30351. for (v = 0, k = 0; v < height; v++, k += width) {
  30352. items[k] *= 0.5;
  30353. }
  30354. }
  30355. } else {
  30356. for (v = 0, k = 0; v < height; v++, k += width) {
  30357. rowBuffer.set(items.subarray(k, k + width), bufferPadding);
  30358. this.extend(rowBuffer, bufferPadding, width);
  30359. this.filter(rowBuffer, bufferPadding, width);
  30360. items.set(rowBuffer.subarray(bufferPadding, bufferPadding + width), k);
  30361. }
  30362. }
  30363. var numBuffers = 16;
  30364. var colBuffers = [];
  30365. for (i = 0; i < numBuffers; i++) {
  30366. colBuffers.push(new Float32Array(height + 2 * bufferPadding));
  30367. }
  30368. var b, currentBuffer = 0;
  30369. ll = bufferPadding + height;
  30370. if (height === 1) {
  30371. if ((v0 & 1) !== 0) {
  30372. for (u = 0; u < width; u++) {
  30373. items[u] *= 0.5;
  30374. }
  30375. }
  30376. } else {
  30377. for (u = 0; u < width; u++) {
  30378. if (currentBuffer === 0) {
  30379. numBuffers = Math.min(width - u, numBuffers);
  30380. for (k = u, l = bufferPadding; l < ll; k += width, l++) {
  30381. for (b = 0; b < numBuffers; b++) {
  30382. colBuffers[b][l] = items[k + b];
  30383. }
  30384. }
  30385. currentBuffer = numBuffers;
  30386. }
  30387. currentBuffer--;
  30388. var buffer = colBuffers[currentBuffer];
  30389. this.extend(buffer, bufferPadding, height);
  30390. this.filter(buffer, bufferPadding, height);
  30391. if (currentBuffer === 0) {
  30392. k = u - numBuffers + 1;
  30393. for (l = bufferPadding; l < ll; k += width, l++) {
  30394. for (b = 0; b < numBuffers; b++) {
  30395. items[k + b] = colBuffers[b][l];
  30396. }
  30397. }
  30398. }
  30399. }
  30400. }
  30401. return {
  30402. width: width,
  30403. height: height,
  30404. items: items
  30405. };
  30406. };
  30407. return Transform;
  30408. }();
  30409. var IrreversibleTransform = function IrreversibleTransformClosure() {
  30410. function IrreversibleTransform() {
  30411. Transform.call(this);
  30412. }
  30413. IrreversibleTransform.prototype = Object.create(Transform.prototype);
  30414. IrreversibleTransform.prototype.filter = function irreversibleTransformFilter(x, offset, length) {
  30415. var len = length >> 1;
  30416. offset = offset | 0;
  30417. var j, n, current, next;
  30418. var alpha = -1.586134342059924;
  30419. var beta = -0.052980118572961;
  30420. var gamma = 0.882911075530934;
  30421. var delta = 0.443506852043971;
  30422. var K = 1.230174104914001;
  30423. var K_ = 1 / K;
  30424. j = offset - 3;
  30425. for (n = len + 4; n--; j += 2) {
  30426. x[j] *= K_;
  30427. }
  30428. j = offset - 2;
  30429. current = delta * x[j - 1];
  30430. for (n = len + 3; n--; j += 2) {
  30431. next = delta * x[j + 1];
  30432. x[j] = K * x[j] - current - next;
  30433. if (n--) {
  30434. j += 2;
  30435. current = delta * x[j + 1];
  30436. x[j] = K * x[j] - current - next;
  30437. } else {
  30438. break;
  30439. }
  30440. }
  30441. j = offset - 1;
  30442. current = gamma * x[j - 1];
  30443. for (n = len + 2; n--; j += 2) {
  30444. next = gamma * x[j + 1];
  30445. x[j] -= current + next;
  30446. if (n--) {
  30447. j += 2;
  30448. current = gamma * x[j + 1];
  30449. x[j] -= current + next;
  30450. } else {
  30451. break;
  30452. }
  30453. }
  30454. j = offset;
  30455. current = beta * x[j - 1];
  30456. for (n = len + 1; n--; j += 2) {
  30457. next = beta * x[j + 1];
  30458. x[j] -= current + next;
  30459. if (n--) {
  30460. j += 2;
  30461. current = beta * x[j + 1];
  30462. x[j] -= current + next;
  30463. } else {
  30464. break;
  30465. }
  30466. }
  30467. if (len !== 0) {
  30468. j = offset + 1;
  30469. current = alpha * x[j - 1];
  30470. for (n = len; n--; j += 2) {
  30471. next = alpha * x[j + 1];
  30472. x[j] -= current + next;
  30473. if (n--) {
  30474. j += 2;
  30475. current = alpha * x[j + 1];
  30476. x[j] -= current + next;
  30477. } else {
  30478. break;
  30479. }
  30480. }
  30481. }
  30482. };
  30483. return IrreversibleTransform;
  30484. }();
  30485. var ReversibleTransform = function ReversibleTransformClosure() {
  30486. function ReversibleTransform() {
  30487. Transform.call(this);
  30488. }
  30489. ReversibleTransform.prototype = Object.create(Transform.prototype);
  30490. ReversibleTransform.prototype.filter = function reversibleTransformFilter(x, offset, length) {
  30491. var len = length >> 1;
  30492. offset = offset | 0;
  30493. var j, n;
  30494. for (j = offset, n = len + 1; n--; j += 2) {
  30495. x[j] -= x[j - 1] + x[j + 1] + 2 >> 2;
  30496. }
  30497. for (j = offset + 1, n = len; n--; j += 2) {
  30498. x[j] += x[j - 1] + x[j + 1] >> 1;
  30499. }
  30500. };
  30501. return ReversibleTransform;
  30502. }();
  30503. return JpxImage;
  30504. }();
  30505. exports.JpxImage = JpxImage;
  30506. /***/ }),
  30507. /* 16 */
  30508. /***/ (function(module, exports, __w_pdfjs_require__) {
  30509. "use strict";
  30510. var sharedUtil = __w_pdfjs_require__(0);
  30511. var corePrimitives = __w_pdfjs_require__(1);
  30512. var coreCrypto = __w_pdfjs_require__(13);
  30513. var coreParser = __w_pdfjs_require__(5);
  30514. var coreChunkedStream = __w_pdfjs_require__(12);
  30515. var coreColorSpace = __w_pdfjs_require__(3);
  30516. var InvalidPDFException = sharedUtil.InvalidPDFException;
  30517. var MissingDataException = sharedUtil.MissingDataException;
  30518. var XRefParseException = sharedUtil.XRefParseException;
  30519. var assert = sharedUtil.assert;
  30520. var bytesToString = sharedUtil.bytesToString;
  30521. var createPromiseCapability = sharedUtil.createPromiseCapability;
  30522. var error = sharedUtil.error;
  30523. var info = sharedUtil.info;
  30524. var isArray = sharedUtil.isArray;
  30525. var isBool = sharedUtil.isBool;
  30526. var isInt = sharedUtil.isInt;
  30527. var isString = sharedUtil.isString;
  30528. var shadow = sharedUtil.shadow;
  30529. var stringToPDFString = sharedUtil.stringToPDFString;
  30530. var stringToUTF8String = sharedUtil.stringToUTF8String;
  30531. var warn = sharedUtil.warn;
  30532. var createValidAbsoluteUrl = sharedUtil.createValidAbsoluteUrl;
  30533. var Util = sharedUtil.Util;
  30534. var Ref = corePrimitives.Ref;
  30535. var RefSet = corePrimitives.RefSet;
  30536. var RefSetCache = corePrimitives.RefSetCache;
  30537. var isName = corePrimitives.isName;
  30538. var isCmd = corePrimitives.isCmd;
  30539. var isDict = corePrimitives.isDict;
  30540. var isRef = corePrimitives.isRef;
  30541. var isRefsEqual = corePrimitives.isRefsEqual;
  30542. var isStream = corePrimitives.isStream;
  30543. var CipherTransformFactory = coreCrypto.CipherTransformFactory;
  30544. var Lexer = coreParser.Lexer;
  30545. var Parser = coreParser.Parser;
  30546. var ChunkedStream = coreChunkedStream.ChunkedStream;
  30547. var ColorSpace = coreColorSpace.ColorSpace;
  30548. var Catalog = function CatalogClosure() {
  30549. function Catalog(pdfManager, xref, pageFactory) {
  30550. this.pdfManager = pdfManager;
  30551. this.xref = xref;
  30552. this.catDict = xref.getCatalogObj();
  30553. this.fontCache = new RefSetCache();
  30554. this.builtInCMapCache = Object.create(null);
  30555. assert(isDict(this.catDict), 'catalog object is not a dictionary');
  30556. this.pageFactory = pageFactory;
  30557. this.pagePromises = [];
  30558. }
  30559. Catalog.prototype = {
  30560. get metadata() {
  30561. var streamRef = this.catDict.getRaw('Metadata');
  30562. if (!isRef(streamRef)) {
  30563. return shadow(this, 'metadata', null);
  30564. }
  30565. var encryptMetadata = !this.xref.encrypt ? false : this.xref.encrypt.encryptMetadata;
  30566. var stream = this.xref.fetch(streamRef, !encryptMetadata);
  30567. var metadata;
  30568. if (stream && isDict(stream.dict)) {
  30569. var type = stream.dict.get('Type');
  30570. var subtype = stream.dict.get('Subtype');
  30571. if (isName(type, 'Metadata') && isName(subtype, 'XML')) {
  30572. try {
  30573. metadata = stringToUTF8String(bytesToString(stream.getBytes()));
  30574. } catch (e) {
  30575. info('Skipping invalid metadata.');
  30576. }
  30577. }
  30578. }
  30579. return shadow(this, 'metadata', metadata);
  30580. },
  30581. get toplevelPagesDict() {
  30582. var pagesObj = this.catDict.get('Pages');
  30583. assert(isDict(pagesObj), 'invalid top-level pages dictionary');
  30584. return shadow(this, 'toplevelPagesDict', pagesObj);
  30585. },
  30586. get documentOutline() {
  30587. var obj = null;
  30588. try {
  30589. obj = this.readDocumentOutline();
  30590. } catch (ex) {
  30591. if (ex instanceof MissingDataException) {
  30592. throw ex;
  30593. }
  30594. warn('Unable to read document outline');
  30595. }
  30596. return shadow(this, 'documentOutline', obj);
  30597. },
  30598. readDocumentOutline: function Catalog_readDocumentOutline() {
  30599. var obj = this.catDict.get('Outlines');
  30600. if (!isDict(obj)) {
  30601. return null;
  30602. }
  30603. obj = obj.getRaw('First');
  30604. if (!isRef(obj)) {
  30605. return null;
  30606. }
  30607. var root = { items: [] };
  30608. var queue = [{
  30609. obj: obj,
  30610. parent: root
  30611. }];
  30612. var processed = new RefSet();
  30613. processed.put(obj);
  30614. var xref = this.xref, blackColor = new Uint8Array(3);
  30615. while (queue.length > 0) {
  30616. var i = queue.shift();
  30617. var outlineDict = xref.fetchIfRef(i.obj);
  30618. if (outlineDict === null) {
  30619. continue;
  30620. }
  30621. assert(outlineDict.has('Title'), 'Invalid outline item');
  30622. var data = {
  30623. url: null,
  30624. dest: null
  30625. };
  30626. Catalog.parseDestDictionary({
  30627. destDict: outlineDict,
  30628. resultObj: data,
  30629. docBaseUrl: this.pdfManager.docBaseUrl
  30630. });
  30631. var title = outlineDict.get('Title');
  30632. var flags = outlineDict.get('F') || 0;
  30633. var color = outlineDict.getArray('C'), rgbColor = blackColor;
  30634. if (isArray(color) && color.length === 3 && (color[0] !== 0 || color[1] !== 0 || color[2] !== 0)) {
  30635. rgbColor = ColorSpace.singletons.rgb.getRgb(color, 0);
  30636. }
  30637. var outlineItem = {
  30638. dest: data.dest,
  30639. url: data.url,
  30640. unsafeUrl: data.unsafeUrl,
  30641. newWindow: data.newWindow,
  30642. title: stringToPDFString(title),
  30643. color: rgbColor,
  30644. count: outlineDict.get('Count'),
  30645. bold: !!(flags & 2),
  30646. italic: !!(flags & 1),
  30647. items: []
  30648. };
  30649. i.parent.items.push(outlineItem);
  30650. obj = outlineDict.getRaw('First');
  30651. if (isRef(obj) && !processed.has(obj)) {
  30652. queue.push({
  30653. obj: obj,
  30654. parent: outlineItem
  30655. });
  30656. processed.put(obj);
  30657. }
  30658. obj = outlineDict.getRaw('Next');
  30659. if (isRef(obj) && !processed.has(obj)) {
  30660. queue.push({
  30661. obj: obj,
  30662. parent: i.parent
  30663. });
  30664. processed.put(obj);
  30665. }
  30666. }
  30667. return root.items.length > 0 ? root.items : null;
  30668. },
  30669. get numPages() {
  30670. var obj = this.toplevelPagesDict.get('Count');
  30671. assert(isInt(obj), 'page count in top level pages object is not an integer');
  30672. return shadow(this, 'num', obj);
  30673. },
  30674. get destinations() {
  30675. function fetchDestination(dest) {
  30676. return isDict(dest) ? dest.get('D') : dest;
  30677. }
  30678. var xref = this.xref;
  30679. var dests = {}, nameTreeRef, nameDictionaryRef;
  30680. var obj = this.catDict.get('Names');
  30681. if (obj && obj.has('Dests')) {
  30682. nameTreeRef = obj.getRaw('Dests');
  30683. } else if (this.catDict.has('Dests')) {
  30684. nameDictionaryRef = this.catDict.get('Dests');
  30685. }
  30686. if (nameDictionaryRef) {
  30687. obj = nameDictionaryRef;
  30688. obj.forEach(function catalogForEach(key, value) {
  30689. if (!value) {
  30690. return;
  30691. }
  30692. dests[key] = fetchDestination(value);
  30693. });
  30694. }
  30695. if (nameTreeRef) {
  30696. var nameTree = new NameTree(nameTreeRef, xref);
  30697. var names = nameTree.getAll();
  30698. for (var name in names) {
  30699. dests[name] = fetchDestination(names[name]);
  30700. }
  30701. }
  30702. return shadow(this, 'destinations', dests);
  30703. },
  30704. getDestination: function Catalog_getDestination(destinationId) {
  30705. function fetchDestination(dest) {
  30706. return isDict(dest) ? dest.get('D') : dest;
  30707. }
  30708. var xref = this.xref;
  30709. var dest = null, nameTreeRef, nameDictionaryRef;
  30710. var obj = this.catDict.get('Names');
  30711. if (obj && obj.has('Dests')) {
  30712. nameTreeRef = obj.getRaw('Dests');
  30713. } else if (this.catDict.has('Dests')) {
  30714. nameDictionaryRef = this.catDict.get('Dests');
  30715. }
  30716. if (nameDictionaryRef) {
  30717. var value = nameDictionaryRef.get(destinationId);
  30718. if (value) {
  30719. dest = fetchDestination(value);
  30720. }
  30721. }
  30722. if (nameTreeRef) {
  30723. var nameTree = new NameTree(nameTreeRef, xref);
  30724. dest = fetchDestination(nameTree.get(destinationId));
  30725. }
  30726. return dest;
  30727. },
  30728. get pageLabels() {
  30729. var obj = null;
  30730. try {
  30731. obj = this.readPageLabels();
  30732. } catch (ex) {
  30733. if (ex instanceof MissingDataException) {
  30734. throw ex;
  30735. }
  30736. warn('Unable to read page labels.');
  30737. }
  30738. return shadow(this, 'pageLabels', obj);
  30739. },
  30740. readPageLabels: function Catalog_readPageLabels() {
  30741. var obj = this.catDict.getRaw('PageLabels');
  30742. if (!obj) {
  30743. return null;
  30744. }
  30745. var pageLabels = new Array(this.numPages);
  30746. var style = null;
  30747. var prefix = '';
  30748. var numberTree = new NumberTree(obj, this.xref);
  30749. var nums = numberTree.getAll();
  30750. var currentLabel = '', currentIndex = 1;
  30751. for (var i = 0, ii = this.numPages; i < ii; i++) {
  30752. if (i in nums) {
  30753. var labelDict = nums[i];
  30754. assert(isDict(labelDict), 'The PageLabel is not a dictionary.');
  30755. var type = labelDict.get('Type');
  30756. assert(!type || isName(type, 'PageLabel'), 'Invalid type in PageLabel dictionary.');
  30757. var s = labelDict.get('S');
  30758. assert(!s || isName(s), 'Invalid style in PageLabel dictionary.');
  30759. style = s ? s.name : null;
  30760. var p = labelDict.get('P');
  30761. assert(!p || isString(p), 'Invalid prefix in PageLabel dictionary.');
  30762. prefix = p ? stringToPDFString(p) : '';
  30763. var st = labelDict.get('St');
  30764. assert(!st || isInt(st) && st >= 1, 'Invalid start in PageLabel dictionary.');
  30765. currentIndex = st || 1;
  30766. }
  30767. switch (style) {
  30768. case 'D':
  30769. currentLabel = currentIndex;
  30770. break;
  30771. case 'R':
  30772. case 'r':
  30773. currentLabel = Util.toRoman(currentIndex, style === 'r');
  30774. break;
  30775. case 'A':
  30776. case 'a':
  30777. var LIMIT = 26;
  30778. var A_UPPER_CASE = 0x41, A_LOWER_CASE = 0x61;
  30779. var baseCharCode = style === 'a' ? A_LOWER_CASE : A_UPPER_CASE;
  30780. var letterIndex = currentIndex - 1;
  30781. var character = String.fromCharCode(baseCharCode + letterIndex % LIMIT);
  30782. var charBuf = [];
  30783. for (var j = 0, jj = letterIndex / LIMIT | 0; j <= jj; j++) {
  30784. charBuf.push(character);
  30785. }
  30786. currentLabel = charBuf.join('');
  30787. break;
  30788. default:
  30789. assert(!style, 'Invalid style "' + style + '" in PageLabel dictionary.');
  30790. }
  30791. pageLabels[i] = prefix + currentLabel;
  30792. currentLabel = '';
  30793. currentIndex++;
  30794. }
  30795. return pageLabels;
  30796. },
  30797. get attachments() {
  30798. var xref = this.xref;
  30799. var attachments = null, nameTreeRef;
  30800. var obj = this.catDict.get('Names');
  30801. if (obj) {
  30802. nameTreeRef = obj.getRaw('EmbeddedFiles');
  30803. }
  30804. if (nameTreeRef) {
  30805. var nameTree = new NameTree(nameTreeRef, xref);
  30806. var names = nameTree.getAll();
  30807. for (var name in names) {
  30808. var fs = new FileSpec(names[name], xref);
  30809. if (!attachments) {
  30810. attachments = Object.create(null);
  30811. }
  30812. attachments[stringToPDFString(name)] = fs.serializable;
  30813. }
  30814. }
  30815. return shadow(this, 'attachments', attachments);
  30816. },
  30817. get javaScript() {
  30818. var xref = this.xref;
  30819. var obj = this.catDict.get('Names');
  30820. var javaScript = [];
  30821. function appendIfJavaScriptDict(jsDict) {
  30822. var type = jsDict.get('S');
  30823. if (!isName(type, 'JavaScript')) {
  30824. return;
  30825. }
  30826. var js = jsDict.get('JS');
  30827. if (isStream(js)) {
  30828. js = bytesToString(js.getBytes());
  30829. } else if (!isString(js)) {
  30830. return;
  30831. }
  30832. javaScript.push(stringToPDFString(js));
  30833. }
  30834. if (obj && obj.has('JavaScript')) {
  30835. var nameTree = new NameTree(obj.getRaw('JavaScript'), xref);
  30836. var names = nameTree.getAll();
  30837. for (var name in names) {
  30838. var jsDict = names[name];
  30839. if (isDict(jsDict)) {
  30840. appendIfJavaScriptDict(jsDict);
  30841. }
  30842. }
  30843. }
  30844. var openactionDict = this.catDict.get('OpenAction');
  30845. if (isDict(openactionDict, 'Action')) {
  30846. var actionType = openactionDict.get('S');
  30847. if (isName(actionType, 'Named')) {
  30848. var action = openactionDict.get('N');
  30849. if (isName(action, 'Print')) {
  30850. javaScript.push('print({});');
  30851. }
  30852. } else {
  30853. appendIfJavaScriptDict(openactionDict);
  30854. }
  30855. }
  30856. return shadow(this, 'javaScript', javaScript);
  30857. },
  30858. cleanup: function Catalog_cleanup() {
  30859. var promises = [];
  30860. this.fontCache.forEach(function (promise) {
  30861. promises.push(promise);
  30862. });
  30863. return Promise.all(promises).then(function (translatedFonts) {
  30864. for (var i = 0, ii = translatedFonts.length; i < ii; i++) {
  30865. var font = translatedFonts[i].dict;
  30866. delete font.translated;
  30867. }
  30868. this.fontCache.clear();
  30869. this.builtInCMapCache = Object.create(null);
  30870. }.bind(this));
  30871. },
  30872. getPage: function Catalog_getPage(pageIndex) {
  30873. if (!(pageIndex in this.pagePromises)) {
  30874. this.pagePromises[pageIndex] = this.getPageDict(pageIndex).then(function (a) {
  30875. var dict = a[0];
  30876. var ref = a[1];
  30877. return this.pageFactory.createPage(pageIndex, dict, ref, this.fontCache, this.builtInCMapCache);
  30878. }.bind(this));
  30879. }
  30880. return this.pagePromises[pageIndex];
  30881. },
  30882. getPageDict: function Catalog_getPageDict(pageIndex) {
  30883. var capability = createPromiseCapability();
  30884. var nodesToVisit = [this.catDict.getRaw('Pages')];
  30885. var currentPageIndex = 0;
  30886. var xref = this.xref;
  30887. function next() {
  30888. while (nodesToVisit.length) {
  30889. var currentNode = nodesToVisit.pop();
  30890. if (isRef(currentNode)) {
  30891. xref.fetchAsync(currentNode).then(function (obj) {
  30892. if (isDict(obj, 'Page') || isDict(obj) && !obj.has('Kids')) {
  30893. if (pageIndex === currentPageIndex) {
  30894. capability.resolve([
  30895. obj,
  30896. currentNode
  30897. ]);
  30898. } else {
  30899. currentPageIndex++;
  30900. next();
  30901. }
  30902. return;
  30903. }
  30904. nodesToVisit.push(obj);
  30905. next();
  30906. }, capability.reject);
  30907. return;
  30908. }
  30909. assert(isDict(currentNode), 'page dictionary kid reference points to wrong type of object');
  30910. var count = currentNode.get('Count');
  30911. if (currentPageIndex + count <= pageIndex) {
  30912. currentPageIndex += count;
  30913. continue;
  30914. }
  30915. var kids = currentNode.get('Kids');
  30916. assert(isArray(kids), 'page dictionary kids object is not an array');
  30917. for (var last = kids.length - 1; last >= 0; last--) {
  30918. nodesToVisit.push(kids[last]);
  30919. }
  30920. }
  30921. capability.reject('Page index ' + pageIndex + ' not found.');
  30922. }
  30923. next();
  30924. return capability.promise;
  30925. },
  30926. getPageIndex: function Catalog_getPageIndex(pageRef) {
  30927. var xref = this.xref;
  30928. function pagesBeforeRef(kidRef) {
  30929. var total = 0;
  30930. var parentRef;
  30931. return xref.fetchAsync(kidRef).then(function (node) {
  30932. if (isRefsEqual(kidRef, pageRef) && !isDict(node, 'Page') && !(isDict(node) && !node.has('Type') && node.has('Contents'))) {
  30933. throw new Error('The reference does not point to a /Page Dict.');
  30934. }
  30935. if (!node) {
  30936. return null;
  30937. }
  30938. assert(isDict(node), 'node must be a Dict.');
  30939. parentRef = node.getRaw('Parent');
  30940. return node.getAsync('Parent');
  30941. }).then(function (parent) {
  30942. if (!parent) {
  30943. return null;
  30944. }
  30945. assert(isDict(parent), 'parent must be a Dict.');
  30946. return parent.getAsync('Kids');
  30947. }).then(function (kids) {
  30948. if (!kids) {
  30949. return null;
  30950. }
  30951. var kidPromises = [];
  30952. var found = false;
  30953. for (var i = 0; i < kids.length; i++) {
  30954. var kid = kids[i];
  30955. assert(isRef(kid), 'kid must be a Ref.');
  30956. if (kid.num === kidRef.num) {
  30957. found = true;
  30958. break;
  30959. }
  30960. kidPromises.push(xref.fetchAsync(kid).then(function (kid) {
  30961. if (kid.has('Count')) {
  30962. var count = kid.get('Count');
  30963. total += count;
  30964. } else {
  30965. total++;
  30966. }
  30967. }));
  30968. }
  30969. if (!found) {
  30970. error('kid ref not found in parents kids');
  30971. }
  30972. return Promise.all(kidPromises).then(function () {
  30973. return [
  30974. total,
  30975. parentRef
  30976. ];
  30977. });
  30978. });
  30979. }
  30980. var total = 0;
  30981. function next(ref) {
  30982. return pagesBeforeRef(ref).then(function (args) {
  30983. if (!args) {
  30984. return total;
  30985. }
  30986. var count = args[0];
  30987. var parentRef = args[1];
  30988. total += count;
  30989. return next(parentRef);
  30990. });
  30991. }
  30992. return next(pageRef);
  30993. }
  30994. };
  30995. Catalog.parseDestDictionary = function Catalog_parseDestDictionary(params) {
  30996. function addDefaultProtocolToUrl(url) {
  30997. if (url.indexOf('www.') === 0) {
  30998. return 'http://' + url;
  30999. }
  31000. return url;
  31001. }
  31002. function tryConvertUrlEncoding(url) {
  31003. try {
  31004. return stringToUTF8String(url);
  31005. } catch (e) {
  31006. return url;
  31007. }
  31008. }
  31009. var destDict = params.destDict;
  31010. if (!isDict(destDict)) {
  31011. warn('Catalog_parseDestDictionary: "destDict" must be a dictionary.');
  31012. return;
  31013. }
  31014. var resultObj = params.resultObj;
  31015. if (typeof resultObj !== 'object') {
  31016. warn('Catalog_parseDestDictionary: "resultObj" must be an object.');
  31017. return;
  31018. }
  31019. var docBaseUrl = params.docBaseUrl || null;
  31020. var action = destDict.get('A'), url, dest;
  31021. if (isDict(action)) {
  31022. var linkType = action.get('S').name;
  31023. switch (linkType) {
  31024. case 'URI':
  31025. url = action.get('URI');
  31026. if (isName(url)) {
  31027. url = '/' + url.name;
  31028. } else if (isString(url)) {
  31029. url = addDefaultProtocolToUrl(url);
  31030. }
  31031. break;
  31032. case 'GoTo':
  31033. dest = action.get('D');
  31034. break;
  31035. case 'Launch':
  31036. case 'GoToR':
  31037. var urlDict = action.get('F');
  31038. if (isDict(urlDict)) {
  31039. url = urlDict.get('F') || null;
  31040. } else if (isString(urlDict)) {
  31041. url = urlDict;
  31042. }
  31043. var remoteDest = action.get('D');
  31044. if (remoteDest) {
  31045. if (isName(remoteDest)) {
  31046. remoteDest = remoteDest.name;
  31047. }
  31048. if (isString(url)) {
  31049. var baseUrl = url.split('#')[0];
  31050. if (isString(remoteDest)) {
  31051. url = baseUrl + '#' + (/^\d+$/.test(remoteDest) ? 'nameddest=' : '') + remoteDest;
  31052. } else if (isArray(remoteDest)) {
  31053. url = baseUrl + '#' + JSON.stringify(remoteDest);
  31054. }
  31055. }
  31056. }
  31057. var newWindow = action.get('NewWindow');
  31058. if (isBool(newWindow)) {
  31059. resultObj.newWindow = newWindow;
  31060. }
  31061. break;
  31062. case 'Named':
  31063. var namedAction = action.get('N');
  31064. if (isName(namedAction)) {
  31065. resultObj.action = namedAction.name;
  31066. }
  31067. break;
  31068. case 'JavaScript':
  31069. var jsAction = action.get('JS'), js;
  31070. if (isStream(jsAction)) {
  31071. js = bytesToString(jsAction.getBytes());
  31072. } else if (isString(jsAction)) {
  31073. js = jsAction;
  31074. }
  31075. if (js) {
  31076. var URL_OPEN_METHODS = [
  31077. 'app.launchURL',
  31078. 'window.open'
  31079. ];
  31080. var regex = new RegExp('^\\s*(' + URL_OPEN_METHODS.join('|').split('.').join('\\.') + ')\\((?:\'|\")([^\'\"]*)(?:\'|\")(?:,\\s*(\\w+)\\)|\\))', 'i');
  31081. var jsUrl = regex.exec(stringToPDFString(js));
  31082. if (jsUrl && jsUrl[2]) {
  31083. url = jsUrl[2];
  31084. if (jsUrl[3] === 'true' && jsUrl[1] === 'app.launchURL') {
  31085. resultObj.newWindow = true;
  31086. }
  31087. break;
  31088. }
  31089. }
  31090. default:
  31091. warn('Catalog_parseDestDictionary: Unrecognized link type "' + linkType + '".');
  31092. break;
  31093. }
  31094. } else if (destDict.has('Dest')) {
  31095. dest = destDict.get('Dest');
  31096. }
  31097. if (isString(url)) {
  31098. url = tryConvertUrlEncoding(url);
  31099. var absoluteUrl = createValidAbsoluteUrl(url, docBaseUrl);
  31100. if (absoluteUrl) {
  31101. resultObj.url = absoluteUrl.href;
  31102. }
  31103. resultObj.unsafeUrl = url;
  31104. }
  31105. if (dest) {
  31106. if (isName(dest)) {
  31107. dest = dest.name;
  31108. }
  31109. if (isString(dest) || isArray(dest)) {
  31110. resultObj.dest = dest;
  31111. }
  31112. }
  31113. };
  31114. return Catalog;
  31115. }();
  31116. var XRef = function XRefClosure() {
  31117. function XRef(stream, pdfManager) {
  31118. this.stream = stream;
  31119. this.pdfManager = pdfManager;
  31120. this.entries = [];
  31121. this.xrefstms = Object.create(null);
  31122. this.cache = [];
  31123. this.stats = {
  31124. streamTypes: [],
  31125. fontTypes: []
  31126. };
  31127. }
  31128. XRef.prototype = {
  31129. setStartXRef: function XRef_setStartXRef(startXRef) {
  31130. this.startXRefQueue = [startXRef];
  31131. },
  31132. parse: function XRef_parse(recoveryMode) {
  31133. var trailerDict;
  31134. if (!recoveryMode) {
  31135. trailerDict = this.readXRef();
  31136. } else {
  31137. warn('Indexing all PDF objects');
  31138. trailerDict = this.indexObjects();
  31139. }
  31140. trailerDict.assignXref(this);
  31141. this.trailer = trailerDict;
  31142. var encrypt = trailerDict.get('Encrypt');
  31143. if (isDict(encrypt)) {
  31144. var ids = trailerDict.get('ID');
  31145. var fileId = ids && ids.length ? ids[0] : '';
  31146. encrypt.suppressEncryption = true;
  31147. this.encrypt = new CipherTransformFactory(encrypt, fileId, this.pdfManager.password);
  31148. }
  31149. if (!(this.root = trailerDict.get('Root'))) {
  31150. error('Invalid root reference');
  31151. }
  31152. },
  31153. processXRefTable: function XRef_processXRefTable(parser) {
  31154. if (!('tableState' in this)) {
  31155. this.tableState = {
  31156. entryNum: 0,
  31157. streamPos: parser.lexer.stream.pos,
  31158. parserBuf1: parser.buf1,
  31159. parserBuf2: parser.buf2
  31160. };
  31161. }
  31162. var obj = this.readXRefTable(parser);
  31163. if (!isCmd(obj, 'trailer')) {
  31164. error('Invalid XRef table: could not find trailer dictionary');
  31165. }
  31166. var dict = parser.getObj();
  31167. if (!isDict(dict) && dict.dict) {
  31168. dict = dict.dict;
  31169. }
  31170. if (!isDict(dict)) {
  31171. error('Invalid XRef table: could not parse trailer dictionary');
  31172. }
  31173. delete this.tableState;
  31174. return dict;
  31175. },
  31176. readXRefTable: function XRef_readXRefTable(parser) {
  31177. var stream = parser.lexer.stream;
  31178. var tableState = this.tableState;
  31179. stream.pos = tableState.streamPos;
  31180. parser.buf1 = tableState.parserBuf1;
  31181. parser.buf2 = tableState.parserBuf2;
  31182. var obj;
  31183. while (true) {
  31184. if (!('firstEntryNum' in tableState) || !('entryCount' in tableState)) {
  31185. if (isCmd(obj = parser.getObj(), 'trailer')) {
  31186. break;
  31187. }
  31188. tableState.firstEntryNum = obj;
  31189. tableState.entryCount = parser.getObj();
  31190. }
  31191. var first = tableState.firstEntryNum;
  31192. var count = tableState.entryCount;
  31193. if (!isInt(first) || !isInt(count)) {
  31194. error('Invalid XRef table: wrong types in subsection header');
  31195. }
  31196. for (var i = tableState.entryNum; i < count; i++) {
  31197. tableState.streamPos = stream.pos;
  31198. tableState.entryNum = i;
  31199. tableState.parserBuf1 = parser.buf1;
  31200. tableState.parserBuf2 = parser.buf2;
  31201. var entry = {};
  31202. entry.offset = parser.getObj();
  31203. entry.gen = parser.getObj();
  31204. var type = parser.getObj();
  31205. if (isCmd(type, 'f')) {
  31206. entry.free = true;
  31207. } else if (isCmd(type, 'n')) {
  31208. entry.uncompressed = true;
  31209. }
  31210. if (!isInt(entry.offset) || !isInt(entry.gen) || !(entry.free || entry.uncompressed)) {
  31211. error('Invalid entry in XRef subsection: ' + first + ', ' + count);
  31212. }
  31213. if (i === 0 && entry.free && first === 1) {
  31214. first = 0;
  31215. }
  31216. if (!this.entries[i + first]) {
  31217. this.entries[i + first] = entry;
  31218. }
  31219. }
  31220. tableState.entryNum = 0;
  31221. tableState.streamPos = stream.pos;
  31222. tableState.parserBuf1 = parser.buf1;
  31223. tableState.parserBuf2 = parser.buf2;
  31224. delete tableState.firstEntryNum;
  31225. delete tableState.entryCount;
  31226. }
  31227. if (this.entries[0] && !this.entries[0].free) {
  31228. error('Invalid XRef table: unexpected first object');
  31229. }
  31230. return obj;
  31231. },
  31232. processXRefStream: function XRef_processXRefStream(stream) {
  31233. if (!('streamState' in this)) {
  31234. var streamParameters = stream.dict;
  31235. var byteWidths = streamParameters.get('W');
  31236. var range = streamParameters.get('Index');
  31237. if (!range) {
  31238. range = [
  31239. 0,
  31240. streamParameters.get('Size')
  31241. ];
  31242. }
  31243. this.streamState = {
  31244. entryRanges: range,
  31245. byteWidths: byteWidths,
  31246. entryNum: 0,
  31247. streamPos: stream.pos
  31248. };
  31249. }
  31250. this.readXRefStream(stream);
  31251. delete this.streamState;
  31252. return stream.dict;
  31253. },
  31254. readXRefStream: function XRef_readXRefStream(stream) {
  31255. var i, j;
  31256. var streamState = this.streamState;
  31257. stream.pos = streamState.streamPos;
  31258. var byteWidths = streamState.byteWidths;
  31259. var typeFieldWidth = byteWidths[0];
  31260. var offsetFieldWidth = byteWidths[1];
  31261. var generationFieldWidth = byteWidths[2];
  31262. var entryRanges = streamState.entryRanges;
  31263. while (entryRanges.length > 0) {
  31264. var first = entryRanges[0];
  31265. var n = entryRanges[1];
  31266. if (!isInt(first) || !isInt(n)) {
  31267. error('Invalid XRef range fields: ' + first + ', ' + n);
  31268. }
  31269. if (!isInt(typeFieldWidth) || !isInt(offsetFieldWidth) || !isInt(generationFieldWidth)) {
  31270. error('Invalid XRef entry fields length: ' + first + ', ' + n);
  31271. }
  31272. for (i = streamState.entryNum; i < n; ++i) {
  31273. streamState.entryNum = i;
  31274. streamState.streamPos = stream.pos;
  31275. var type = 0, offset = 0, generation = 0;
  31276. for (j = 0; j < typeFieldWidth; ++j) {
  31277. type = type << 8 | stream.getByte();
  31278. }
  31279. if (typeFieldWidth === 0) {
  31280. type = 1;
  31281. }
  31282. for (j = 0; j < offsetFieldWidth; ++j) {
  31283. offset = offset << 8 | stream.getByte();
  31284. }
  31285. for (j = 0; j < generationFieldWidth; ++j) {
  31286. generation = generation << 8 | stream.getByte();
  31287. }
  31288. var entry = {};
  31289. entry.offset = offset;
  31290. entry.gen = generation;
  31291. switch (type) {
  31292. case 0:
  31293. entry.free = true;
  31294. break;
  31295. case 1:
  31296. entry.uncompressed = true;
  31297. break;
  31298. case 2:
  31299. break;
  31300. default:
  31301. error('Invalid XRef entry type: ' + type);
  31302. }
  31303. if (!this.entries[first + i]) {
  31304. this.entries[first + i] = entry;
  31305. }
  31306. }
  31307. streamState.entryNum = 0;
  31308. streamState.streamPos = stream.pos;
  31309. entryRanges.splice(0, 2);
  31310. }
  31311. },
  31312. indexObjects: function XRef_indexObjects() {
  31313. var TAB = 0x9, LF = 0xA, CR = 0xD, SPACE = 0x20;
  31314. var PERCENT = 0x25, LT = 0x3C;
  31315. function readToken(data, offset) {
  31316. var token = '', ch = data[offset];
  31317. while (ch !== LF && ch !== CR && ch !== LT) {
  31318. if (++offset >= data.length) {
  31319. break;
  31320. }
  31321. token += String.fromCharCode(ch);
  31322. ch = data[offset];
  31323. }
  31324. return token;
  31325. }
  31326. function skipUntil(data, offset, what) {
  31327. var length = what.length, dataLength = data.length;
  31328. var skipped = 0;
  31329. while (offset < dataLength) {
  31330. var i = 0;
  31331. while (i < length && data[offset + i] === what[i]) {
  31332. ++i;
  31333. }
  31334. if (i >= length) {
  31335. break;
  31336. }
  31337. offset++;
  31338. skipped++;
  31339. }
  31340. return skipped;
  31341. }
  31342. var objRegExp = /^(\d+)\s+(\d+)\s+obj\b/;
  31343. var trailerBytes = new Uint8Array([
  31344. 116,
  31345. 114,
  31346. 97,
  31347. 105,
  31348. 108,
  31349. 101,
  31350. 114
  31351. ]);
  31352. var startxrefBytes = new Uint8Array([
  31353. 115,
  31354. 116,
  31355. 97,
  31356. 114,
  31357. 116,
  31358. 120,
  31359. 114,
  31360. 101,
  31361. 102
  31362. ]);
  31363. var endobjBytes = new Uint8Array([
  31364. 101,
  31365. 110,
  31366. 100,
  31367. 111,
  31368. 98,
  31369. 106
  31370. ]);
  31371. var xrefBytes = new Uint8Array([
  31372. 47,
  31373. 88,
  31374. 82,
  31375. 101,
  31376. 102
  31377. ]);
  31378. this.entries.length = 0;
  31379. var stream = this.stream;
  31380. stream.pos = 0;
  31381. var buffer = stream.getBytes();
  31382. var position = stream.start, length = buffer.length;
  31383. var trailers = [], xrefStms = [];
  31384. while (position < length) {
  31385. var ch = buffer[position];
  31386. if (ch === TAB || ch === LF || ch === CR || ch === SPACE) {
  31387. ++position;
  31388. continue;
  31389. }
  31390. if (ch === PERCENT) {
  31391. do {
  31392. ++position;
  31393. if (position >= length) {
  31394. break;
  31395. }
  31396. ch = buffer[position];
  31397. } while (ch !== LF && ch !== CR);
  31398. continue;
  31399. }
  31400. var token = readToken(buffer, position);
  31401. var m;
  31402. if (token.indexOf('xref') === 0 && (token.length === 4 || /\s/.test(token[4]))) {
  31403. position += skipUntil(buffer, position, trailerBytes);
  31404. trailers.push(position);
  31405. position += skipUntil(buffer, position, startxrefBytes);
  31406. } else if (m = objRegExp.exec(token)) {
  31407. if (typeof this.entries[m[1]] === 'undefined') {
  31408. this.entries[m[1]] = {
  31409. offset: position - stream.start,
  31410. gen: m[2] | 0,
  31411. uncompressed: true
  31412. };
  31413. }
  31414. var contentLength = skipUntil(buffer, position, endobjBytes) + 7;
  31415. var content = buffer.subarray(position, position + contentLength);
  31416. var xrefTagOffset = skipUntil(content, 0, xrefBytes);
  31417. if (xrefTagOffset < contentLength && content[xrefTagOffset + 5] < 64) {
  31418. xrefStms.push(position - stream.start);
  31419. this.xrefstms[position - stream.start] = 1;
  31420. }
  31421. position += contentLength;
  31422. } else if (token.indexOf('trailer') === 0 && (token.length === 7 || /\s/.test(token[7]))) {
  31423. trailers.push(position);
  31424. position += skipUntil(buffer, position, startxrefBytes);
  31425. } else {
  31426. position += token.length + 1;
  31427. }
  31428. }
  31429. var i, ii;
  31430. for (i = 0, ii = xrefStms.length; i < ii; ++i) {
  31431. this.startXRefQueue.push(xrefStms[i]);
  31432. this.readXRef(true);
  31433. }
  31434. var dict;
  31435. for (i = 0, ii = trailers.length; i < ii; ++i) {
  31436. stream.pos = trailers[i];
  31437. var parser = new Parser(new Lexer(stream), true, this, true);
  31438. var obj = parser.getObj();
  31439. if (!isCmd(obj, 'trailer')) {
  31440. continue;
  31441. }
  31442. dict = parser.getObj();
  31443. if (!isDict(dict)) {
  31444. continue;
  31445. }
  31446. if (dict.has('ID')) {
  31447. return dict;
  31448. }
  31449. }
  31450. if (dict) {
  31451. return dict;
  31452. }
  31453. throw new InvalidPDFException('Invalid PDF structure');
  31454. },
  31455. readXRef: function XRef_readXRef(recoveryMode) {
  31456. var stream = this.stream;
  31457. try {
  31458. while (this.startXRefQueue.length) {
  31459. var startXRef = this.startXRefQueue[0];
  31460. stream.pos = startXRef + stream.start;
  31461. var parser = new Parser(new Lexer(stream), true, this);
  31462. var obj = parser.getObj();
  31463. var dict;
  31464. if (isCmd(obj, 'xref')) {
  31465. dict = this.processXRefTable(parser);
  31466. if (!this.topDict) {
  31467. this.topDict = dict;
  31468. }
  31469. obj = dict.get('XRefStm');
  31470. if (isInt(obj)) {
  31471. var pos = obj;
  31472. if (!(pos in this.xrefstms)) {
  31473. this.xrefstms[pos] = 1;
  31474. this.startXRefQueue.push(pos);
  31475. }
  31476. }
  31477. } else if (isInt(obj)) {
  31478. if (!isInt(parser.getObj()) || !isCmd(parser.getObj(), 'obj') || !isStream(obj = parser.getObj())) {
  31479. error('Invalid XRef stream');
  31480. }
  31481. dict = this.processXRefStream(obj);
  31482. if (!this.topDict) {
  31483. this.topDict = dict;
  31484. }
  31485. if (!dict) {
  31486. error('Failed to read XRef stream');
  31487. }
  31488. } else {
  31489. error('Invalid XRef stream header');
  31490. }
  31491. obj = dict.get('Prev');
  31492. if (isInt(obj)) {
  31493. this.startXRefQueue.push(obj);
  31494. } else if (isRef(obj)) {
  31495. this.startXRefQueue.push(obj.num);
  31496. }
  31497. this.startXRefQueue.shift();
  31498. }
  31499. return this.topDict;
  31500. } catch (e) {
  31501. if (e instanceof MissingDataException) {
  31502. throw e;
  31503. }
  31504. info('(while reading XRef): ' + e);
  31505. }
  31506. if (recoveryMode) {
  31507. return;
  31508. }
  31509. throw new XRefParseException();
  31510. },
  31511. getEntry: function XRef_getEntry(i) {
  31512. var xrefEntry = this.entries[i];
  31513. if (xrefEntry && !xrefEntry.free && xrefEntry.offset) {
  31514. return xrefEntry;
  31515. }
  31516. return null;
  31517. },
  31518. fetchIfRef: function XRef_fetchIfRef(obj, suppressEncryption) {
  31519. if (!isRef(obj)) {
  31520. return obj;
  31521. }
  31522. return this.fetch(obj, suppressEncryption);
  31523. },
  31524. fetch: function XRef_fetch(ref, suppressEncryption) {
  31525. assert(isRef(ref), 'ref object is not a reference');
  31526. var num = ref.num;
  31527. if (num in this.cache) {
  31528. var cacheEntry = this.cache[num];
  31529. if (isDict(cacheEntry) && !cacheEntry.objId) {
  31530. cacheEntry.objId = ref.toString();
  31531. }
  31532. return cacheEntry;
  31533. }
  31534. var xrefEntry = this.getEntry(num);
  31535. if (xrefEntry === null) {
  31536. return this.cache[num] = null;
  31537. }
  31538. if (xrefEntry.uncompressed) {
  31539. xrefEntry = this.fetchUncompressed(ref, xrefEntry, suppressEncryption);
  31540. } else {
  31541. xrefEntry = this.fetchCompressed(xrefEntry, suppressEncryption);
  31542. }
  31543. if (isDict(xrefEntry)) {
  31544. xrefEntry.objId = ref.toString();
  31545. } else if (isStream(xrefEntry)) {
  31546. xrefEntry.dict.objId = ref.toString();
  31547. }
  31548. return xrefEntry;
  31549. },
  31550. fetchUncompressed: function XRef_fetchUncompressed(ref, xrefEntry, suppressEncryption) {
  31551. var gen = ref.gen;
  31552. var num = ref.num;
  31553. if (xrefEntry.gen !== gen) {
  31554. error('inconsistent generation in XRef');
  31555. }
  31556. var stream = this.stream.makeSubStream(xrefEntry.offset + this.stream.start);
  31557. var parser = new Parser(new Lexer(stream), true, this);
  31558. var obj1 = parser.getObj();
  31559. var obj2 = parser.getObj();
  31560. var obj3 = parser.getObj();
  31561. if (!isInt(obj1) || parseInt(obj1, 10) !== num || !isInt(obj2) || parseInt(obj2, 10) !== gen || !isCmd(obj3)) {
  31562. error('bad XRef entry');
  31563. }
  31564. if (!isCmd(obj3, 'obj')) {
  31565. if (obj3.cmd.indexOf('obj') === 0) {
  31566. num = parseInt(obj3.cmd.substring(3), 10);
  31567. if (!isNaN(num)) {
  31568. return num;
  31569. }
  31570. }
  31571. error('bad XRef entry');
  31572. }
  31573. if (this.encrypt && !suppressEncryption) {
  31574. xrefEntry = parser.getObj(this.encrypt.createCipherTransform(num, gen));
  31575. } else {
  31576. xrefEntry = parser.getObj();
  31577. }
  31578. if (!isStream(xrefEntry)) {
  31579. this.cache[num] = xrefEntry;
  31580. }
  31581. return xrefEntry;
  31582. },
  31583. fetchCompressed: function XRef_fetchCompressed(xrefEntry, suppressEncryption) {
  31584. var tableOffset = xrefEntry.offset;
  31585. var stream = this.fetch(new Ref(tableOffset, 0));
  31586. if (!isStream(stream)) {
  31587. error('bad ObjStm stream');
  31588. }
  31589. var first = stream.dict.get('First');
  31590. var n = stream.dict.get('N');
  31591. if (!isInt(first) || !isInt(n)) {
  31592. error('invalid first and n parameters for ObjStm stream');
  31593. }
  31594. var parser = new Parser(new Lexer(stream), false, this);
  31595. parser.allowStreams = true;
  31596. var i, entries = [], num, nums = [];
  31597. for (i = 0; i < n; ++i) {
  31598. num = parser.getObj();
  31599. if (!isInt(num)) {
  31600. error('invalid object number in the ObjStm stream: ' + num);
  31601. }
  31602. nums.push(num);
  31603. var offset = parser.getObj();
  31604. if (!isInt(offset)) {
  31605. error('invalid object offset in the ObjStm stream: ' + offset);
  31606. }
  31607. }
  31608. for (i = 0; i < n; ++i) {
  31609. entries.push(parser.getObj());
  31610. if (isCmd(parser.buf1, 'endobj')) {
  31611. parser.shift();
  31612. }
  31613. num = nums[i];
  31614. var entry = this.entries[num];
  31615. if (entry && entry.offset === tableOffset && entry.gen === i) {
  31616. this.cache[num] = entries[i];
  31617. }
  31618. }
  31619. xrefEntry = entries[xrefEntry.gen];
  31620. if (xrefEntry === undefined) {
  31621. error('bad XRef entry for compressed object');
  31622. }
  31623. return xrefEntry;
  31624. },
  31625. fetchIfRefAsync: function XRef_fetchIfRefAsync(obj, suppressEncryption) {
  31626. if (!isRef(obj)) {
  31627. return Promise.resolve(obj);
  31628. }
  31629. return this.fetchAsync(obj, suppressEncryption);
  31630. },
  31631. fetchAsync: function XRef_fetchAsync(ref, suppressEncryption) {
  31632. var streamManager = this.stream.manager;
  31633. var xref = this;
  31634. return new Promise(function tryFetch(resolve, reject) {
  31635. try {
  31636. resolve(xref.fetch(ref, suppressEncryption));
  31637. } catch (e) {
  31638. if (e instanceof MissingDataException) {
  31639. streamManager.requestRange(e.begin, e.end).then(function () {
  31640. tryFetch(resolve, reject);
  31641. }, reject);
  31642. return;
  31643. }
  31644. reject(e);
  31645. }
  31646. });
  31647. },
  31648. getCatalogObj: function XRef_getCatalogObj() {
  31649. return this.root;
  31650. }
  31651. };
  31652. return XRef;
  31653. }();
  31654. var NameOrNumberTree = function NameOrNumberTreeClosure() {
  31655. function NameOrNumberTree(root, xref) {
  31656. throw new Error('Cannot initialize NameOrNumberTree.');
  31657. }
  31658. NameOrNumberTree.prototype = {
  31659. getAll: function NameOrNumberTree_getAll() {
  31660. var dict = Object.create(null);
  31661. if (!this.root) {
  31662. return dict;
  31663. }
  31664. var xref = this.xref;
  31665. var processed = new RefSet();
  31666. processed.put(this.root);
  31667. var queue = [this.root];
  31668. while (queue.length > 0) {
  31669. var i, n;
  31670. var obj = xref.fetchIfRef(queue.shift());
  31671. if (!isDict(obj)) {
  31672. continue;
  31673. }
  31674. if (obj.has('Kids')) {
  31675. var kids = obj.get('Kids');
  31676. for (i = 0, n = kids.length; i < n; i++) {
  31677. var kid = kids[i];
  31678. assert(!processed.has(kid), 'Duplicate entry in "' + this._type + '" tree.');
  31679. queue.push(kid);
  31680. processed.put(kid);
  31681. }
  31682. continue;
  31683. }
  31684. var entries = obj.get(this._type);
  31685. if (isArray(entries)) {
  31686. for (i = 0, n = entries.length; i < n; i += 2) {
  31687. dict[xref.fetchIfRef(entries[i])] = xref.fetchIfRef(entries[i + 1]);
  31688. }
  31689. }
  31690. }
  31691. return dict;
  31692. },
  31693. get: function NameOrNumberTree_get(key) {
  31694. if (!this.root) {
  31695. return null;
  31696. }
  31697. var xref = this.xref;
  31698. var kidsOrEntries = xref.fetchIfRef(this.root);
  31699. var loopCount = 0;
  31700. var MAX_LEVELS = 10;
  31701. var l, r, m;
  31702. while (kidsOrEntries.has('Kids')) {
  31703. if (++loopCount > MAX_LEVELS) {
  31704. warn('Search depth limit reached for "' + this._type + '" tree.');
  31705. return null;
  31706. }
  31707. var kids = kidsOrEntries.get('Kids');
  31708. if (!isArray(kids)) {
  31709. return null;
  31710. }
  31711. l = 0;
  31712. r = kids.length - 1;
  31713. while (l <= r) {
  31714. m = l + r >> 1;
  31715. var kid = xref.fetchIfRef(kids[m]);
  31716. var limits = kid.get('Limits');
  31717. if (key < xref.fetchIfRef(limits[0])) {
  31718. r = m - 1;
  31719. } else if (key > xref.fetchIfRef(limits[1])) {
  31720. l = m + 1;
  31721. } else {
  31722. kidsOrEntries = xref.fetchIfRef(kids[m]);
  31723. break;
  31724. }
  31725. }
  31726. if (l > r) {
  31727. return null;
  31728. }
  31729. }
  31730. var entries = kidsOrEntries.get(this._type);
  31731. if (isArray(entries)) {
  31732. l = 0;
  31733. r = entries.length - 2;
  31734. while (l <= r) {
  31735. m = l + r & ~1;
  31736. var currentKey = xref.fetchIfRef(entries[m]);
  31737. if (key < currentKey) {
  31738. r = m - 2;
  31739. } else if (key > currentKey) {
  31740. l = m + 2;
  31741. } else {
  31742. return xref.fetchIfRef(entries[m + 1]);
  31743. }
  31744. }
  31745. }
  31746. return null;
  31747. }
  31748. };
  31749. return NameOrNumberTree;
  31750. }();
  31751. var NameTree = function NameTreeClosure() {
  31752. function NameTree(root, xref) {
  31753. this.root = root;
  31754. this.xref = xref;
  31755. this._type = 'Names';
  31756. }
  31757. Util.inherit(NameTree, NameOrNumberTree, {});
  31758. return NameTree;
  31759. }();
  31760. var NumberTree = function NumberTreeClosure() {
  31761. function NumberTree(root, xref) {
  31762. this.root = root;
  31763. this.xref = xref;
  31764. this._type = 'Nums';
  31765. }
  31766. Util.inherit(NumberTree, NameOrNumberTree, {});
  31767. return NumberTree;
  31768. }();
  31769. var FileSpec = function FileSpecClosure() {
  31770. function FileSpec(root, xref) {
  31771. if (!root || !isDict(root)) {
  31772. return;
  31773. }
  31774. this.xref = xref;
  31775. this.root = root;
  31776. if (root.has('FS')) {
  31777. this.fs = root.get('FS');
  31778. }
  31779. this.description = root.has('Desc') ? stringToPDFString(root.get('Desc')) : '';
  31780. if (root.has('RF')) {
  31781. warn('Related file specifications are not supported');
  31782. }
  31783. this.contentAvailable = true;
  31784. if (!root.has('EF')) {
  31785. this.contentAvailable = false;
  31786. warn('Non-embedded file specifications are not supported');
  31787. }
  31788. }
  31789. function pickPlatformItem(dict) {
  31790. if (dict.has('UF')) {
  31791. return dict.get('UF');
  31792. } else if (dict.has('F')) {
  31793. return dict.get('F');
  31794. } else if (dict.has('Unix')) {
  31795. return dict.get('Unix');
  31796. } else if (dict.has('Mac')) {
  31797. return dict.get('Mac');
  31798. } else if (dict.has('DOS')) {
  31799. return dict.get('DOS');
  31800. }
  31801. return null;
  31802. }
  31803. FileSpec.prototype = {
  31804. get filename() {
  31805. if (!this._filename && this.root) {
  31806. var filename = pickPlatformItem(this.root) || 'unnamed';
  31807. this._filename = stringToPDFString(filename).replace(/\\\\/g, '\\').replace(/\\\//g, '/').replace(/\\/g, '/');
  31808. }
  31809. return this._filename;
  31810. },
  31811. get content() {
  31812. if (!this.contentAvailable) {
  31813. return null;
  31814. }
  31815. if (!this.contentRef && this.root) {
  31816. this.contentRef = pickPlatformItem(this.root.get('EF'));
  31817. }
  31818. var content = null;
  31819. if (this.contentRef) {
  31820. var xref = this.xref;
  31821. var fileObj = xref.fetchIfRef(this.contentRef);
  31822. if (fileObj && isStream(fileObj)) {
  31823. content = fileObj.getBytes();
  31824. } else {
  31825. warn('Embedded file specification points to non-existing/invalid ' + 'content');
  31826. }
  31827. } else {
  31828. warn('Embedded file specification does not have a content');
  31829. }
  31830. return content;
  31831. },
  31832. get serializable() {
  31833. return {
  31834. filename: this.filename,
  31835. content: this.content
  31836. };
  31837. }
  31838. };
  31839. return FileSpec;
  31840. }();
  31841. var ObjectLoader = function () {
  31842. function mayHaveChildren(value) {
  31843. return isRef(value) || isDict(value) || isArray(value) || isStream(value);
  31844. }
  31845. function addChildren(node, nodesToVisit) {
  31846. var value;
  31847. if (isDict(node) || isStream(node)) {
  31848. var map;
  31849. if (isDict(node)) {
  31850. map = node.map;
  31851. } else {
  31852. map = node.dict.map;
  31853. }
  31854. for (var key in map) {
  31855. value = map[key];
  31856. if (mayHaveChildren(value)) {
  31857. nodesToVisit.push(value);
  31858. }
  31859. }
  31860. } else if (isArray(node)) {
  31861. for (var i = 0, ii = node.length; i < ii; i++) {
  31862. value = node[i];
  31863. if (mayHaveChildren(value)) {
  31864. nodesToVisit.push(value);
  31865. }
  31866. }
  31867. }
  31868. }
  31869. function ObjectLoader(obj, keys, xref) {
  31870. this.obj = obj;
  31871. this.keys = keys;
  31872. this.xref = xref;
  31873. this.refSet = null;
  31874. this.capability = null;
  31875. }
  31876. ObjectLoader.prototype = {
  31877. load: function ObjectLoader_load() {
  31878. var keys = this.keys;
  31879. this.capability = createPromiseCapability();
  31880. if (!(this.xref.stream instanceof ChunkedStream) || this.xref.stream.getMissingChunks().length === 0) {
  31881. this.capability.resolve();
  31882. return this.capability.promise;
  31883. }
  31884. this.refSet = new RefSet();
  31885. var nodesToVisit = [];
  31886. for (var i = 0; i < keys.length; i++) {
  31887. nodesToVisit.push(this.obj[keys[i]]);
  31888. }
  31889. this._walk(nodesToVisit);
  31890. return this.capability.promise;
  31891. },
  31892. _walk: function ObjectLoader_walk(nodesToVisit) {
  31893. var nodesToRevisit = [];
  31894. var pendingRequests = [];
  31895. while (nodesToVisit.length) {
  31896. var currentNode = nodesToVisit.pop();
  31897. if (isRef(currentNode)) {
  31898. if (this.refSet.has(currentNode)) {
  31899. continue;
  31900. }
  31901. try {
  31902. var ref = currentNode;
  31903. this.refSet.put(ref);
  31904. currentNode = this.xref.fetch(currentNode);
  31905. } catch (e) {
  31906. if (!(e instanceof MissingDataException)) {
  31907. throw e;
  31908. }
  31909. nodesToRevisit.push(currentNode);
  31910. pendingRequests.push({
  31911. begin: e.begin,
  31912. end: e.end
  31913. });
  31914. }
  31915. }
  31916. if (currentNode && currentNode.getBaseStreams) {
  31917. var baseStreams = currentNode.getBaseStreams();
  31918. var foundMissingData = false;
  31919. for (var i = 0; i < baseStreams.length; i++) {
  31920. var stream = baseStreams[i];
  31921. if (stream.getMissingChunks && stream.getMissingChunks().length) {
  31922. foundMissingData = true;
  31923. pendingRequests.push({
  31924. begin: stream.start,
  31925. end: stream.end
  31926. });
  31927. }
  31928. }
  31929. if (foundMissingData) {
  31930. nodesToRevisit.push(currentNode);
  31931. }
  31932. }
  31933. addChildren(currentNode, nodesToVisit);
  31934. }
  31935. if (pendingRequests.length) {
  31936. this.xref.stream.manager.requestRanges(pendingRequests).then(function pendingRequestCallback() {
  31937. nodesToVisit = nodesToRevisit;
  31938. for (var i = 0; i < nodesToRevisit.length; i++) {
  31939. var node = nodesToRevisit[i];
  31940. if (isRef(node)) {
  31941. this.refSet.remove(node);
  31942. }
  31943. }
  31944. this._walk(nodesToVisit);
  31945. }.bind(this), this.capability.reject);
  31946. return;
  31947. }
  31948. this.refSet = null;
  31949. this.capability.resolve();
  31950. }
  31951. };
  31952. return ObjectLoader;
  31953. }();
  31954. exports.Catalog = Catalog;
  31955. exports.ObjectLoader = ObjectLoader;
  31956. exports.XRef = XRef;
  31957. exports.FileSpec = FileSpec;
  31958. /***/ }),
  31959. /* 17 */
  31960. /***/ (function(module, exports, __w_pdfjs_require__) {
  31961. "use strict";
  31962. var sharedUtil = __w_pdfjs_require__(0);
  31963. var getLookupTableFactory = sharedUtil.getLookupTableFactory;
  31964. var getStdFontMap = getLookupTableFactory(function (t) {
  31965. t['ArialNarrow'] = 'Helvetica';
  31966. t['ArialNarrow-Bold'] = 'Helvetica-Bold';
  31967. t['ArialNarrow-BoldItalic'] = 'Helvetica-BoldOblique';
  31968. t['ArialNarrow-Italic'] = 'Helvetica-Oblique';
  31969. t['ArialBlack'] = 'Helvetica';
  31970. t['ArialBlack-Bold'] = 'Helvetica-Bold';
  31971. t['ArialBlack-BoldItalic'] = 'Helvetica-BoldOblique';
  31972. t['ArialBlack-Italic'] = 'Helvetica-Oblique';
  31973. t['Arial-Black'] = 'Helvetica';
  31974. t['Arial-Black-Bold'] = 'Helvetica-Bold';
  31975. t['Arial-Black-BoldItalic'] = 'Helvetica-BoldOblique';
  31976. t['Arial-Black-Italic'] = 'Helvetica-Oblique';
  31977. t['Arial'] = 'Helvetica';
  31978. t['Arial-Bold'] = 'Helvetica-Bold';
  31979. t['Arial-BoldItalic'] = 'Helvetica-BoldOblique';
  31980. t['Arial-Italic'] = 'Helvetica-Oblique';
  31981. t['Arial-BoldItalicMT'] = 'Helvetica-BoldOblique';
  31982. t['Arial-BoldMT'] = 'Helvetica-Bold';
  31983. t['Arial-ItalicMT'] = 'Helvetica-Oblique';
  31984. t['ArialMT'] = 'Helvetica';
  31985. t['Courier-Bold'] = 'Courier-Bold';
  31986. t['Courier-BoldItalic'] = 'Courier-BoldOblique';
  31987. t['Courier-Italic'] = 'Courier-Oblique';
  31988. t['CourierNew'] = 'Courier';
  31989. t['CourierNew-Bold'] = 'Courier-Bold';
  31990. t['CourierNew-BoldItalic'] = 'Courier-BoldOblique';
  31991. t['CourierNew-Italic'] = 'Courier-Oblique';
  31992. t['CourierNewPS-BoldItalicMT'] = 'Courier-BoldOblique';
  31993. t['CourierNewPS-BoldMT'] = 'Courier-Bold';
  31994. t['CourierNewPS-ItalicMT'] = 'Courier-Oblique';
  31995. t['CourierNewPSMT'] = 'Courier';
  31996. t['Helvetica'] = 'Helvetica';
  31997. t['Helvetica-Bold'] = 'Helvetica-Bold';
  31998. t['Helvetica-BoldItalic'] = 'Helvetica-BoldOblique';
  31999. t['Helvetica-BoldOblique'] = 'Helvetica-BoldOblique';
  32000. t['Helvetica-Italic'] = 'Helvetica-Oblique';
  32001. t['Helvetica-Oblique'] = 'Helvetica-Oblique';
  32002. t['Symbol-Bold'] = 'Symbol';
  32003. t['Symbol-BoldItalic'] = 'Symbol';
  32004. t['Symbol-Italic'] = 'Symbol';
  32005. t['TimesNewRoman'] = 'Times-Roman';
  32006. t['TimesNewRoman-Bold'] = 'Times-Bold';
  32007. t['TimesNewRoman-BoldItalic'] = 'Times-BoldItalic';
  32008. t['TimesNewRoman-Italic'] = 'Times-Italic';
  32009. t['TimesNewRomanPS'] = 'Times-Roman';
  32010. t['TimesNewRomanPS-Bold'] = 'Times-Bold';
  32011. t['TimesNewRomanPS-BoldItalic'] = 'Times-BoldItalic';
  32012. t['TimesNewRomanPS-BoldItalicMT'] = 'Times-BoldItalic';
  32013. t['TimesNewRomanPS-BoldMT'] = 'Times-Bold';
  32014. t['TimesNewRomanPS-Italic'] = 'Times-Italic';
  32015. t['TimesNewRomanPS-ItalicMT'] = 'Times-Italic';
  32016. t['TimesNewRomanPSMT'] = 'Times-Roman';
  32017. t['TimesNewRomanPSMT-Bold'] = 'Times-Bold';
  32018. t['TimesNewRomanPSMT-BoldItalic'] = 'Times-BoldItalic';
  32019. t['TimesNewRomanPSMT-Italic'] = 'Times-Italic';
  32020. });
  32021. var getNonStdFontMap = getLookupTableFactory(function (t) {
  32022. t['CenturyGothic'] = 'Helvetica';
  32023. t['CenturyGothic-Bold'] = 'Helvetica-Bold';
  32024. t['CenturyGothic-BoldItalic'] = 'Helvetica-BoldOblique';
  32025. t['CenturyGothic-Italic'] = 'Helvetica-Oblique';
  32026. t['ComicSansMS'] = 'Comic Sans MS';
  32027. t['ComicSansMS-Bold'] = 'Comic Sans MS-Bold';
  32028. t['ComicSansMS-BoldItalic'] = 'Comic Sans MS-BoldItalic';
  32029. t['ComicSansMS-Italic'] = 'Comic Sans MS-Italic';
  32030. t['LucidaConsole'] = 'Courier';
  32031. t['LucidaConsole-Bold'] = 'Courier-Bold';
  32032. t['LucidaConsole-BoldItalic'] = 'Courier-BoldOblique';
  32033. t['LucidaConsole-Italic'] = 'Courier-Oblique';
  32034. t['MS-Gothic'] = 'MS Gothic';
  32035. t['MS-Gothic-Bold'] = 'MS Gothic-Bold';
  32036. t['MS-Gothic-BoldItalic'] = 'MS Gothic-BoldItalic';
  32037. t['MS-Gothic-Italic'] = 'MS Gothic-Italic';
  32038. t['MS-Mincho'] = 'MS Mincho';
  32039. t['MS-Mincho-Bold'] = 'MS Mincho-Bold';
  32040. t['MS-Mincho-BoldItalic'] = 'MS Mincho-BoldItalic';
  32041. t['MS-Mincho-Italic'] = 'MS Mincho-Italic';
  32042. t['MS-PGothic'] = 'MS PGothic';
  32043. t['MS-PGothic-Bold'] = 'MS PGothic-Bold';
  32044. t['MS-PGothic-BoldItalic'] = 'MS PGothic-BoldItalic';
  32045. t['MS-PGothic-Italic'] = 'MS PGothic-Italic';
  32046. t['MS-PMincho'] = 'MS PMincho';
  32047. t['MS-PMincho-Bold'] = 'MS PMincho-Bold';
  32048. t['MS-PMincho-BoldItalic'] = 'MS PMincho-BoldItalic';
  32049. t['MS-PMincho-Italic'] = 'MS PMincho-Italic';
  32050. t['NuptialScript'] = 'Times-Italic';
  32051. t['Wingdings'] = 'ZapfDingbats';
  32052. });
  32053. var getSerifFonts = getLookupTableFactory(function (t) {
  32054. t['Adobe Jenson'] = true;
  32055. t['Adobe Text'] = true;
  32056. t['Albertus'] = true;
  32057. t['Aldus'] = true;
  32058. t['Alexandria'] = true;
  32059. t['Algerian'] = true;
  32060. t['American Typewriter'] = true;
  32061. t['Antiqua'] = true;
  32062. t['Apex'] = true;
  32063. t['Arno'] = true;
  32064. t['Aster'] = true;
  32065. t['Aurora'] = true;
  32066. t['Baskerville'] = true;
  32067. t['Bell'] = true;
  32068. t['Bembo'] = true;
  32069. t['Bembo Schoolbook'] = true;
  32070. t['Benguiat'] = true;
  32071. t['Berkeley Old Style'] = true;
  32072. t['Bernhard Modern'] = true;
  32073. t['Berthold City'] = true;
  32074. t['Bodoni'] = true;
  32075. t['Bauer Bodoni'] = true;
  32076. t['Book Antiqua'] = true;
  32077. t['Bookman'] = true;
  32078. t['Bordeaux Roman'] = true;
  32079. t['Californian FB'] = true;
  32080. t['Calisto'] = true;
  32081. t['Calvert'] = true;
  32082. t['Capitals'] = true;
  32083. t['Cambria'] = true;
  32084. t['Cartier'] = true;
  32085. t['Caslon'] = true;
  32086. t['Catull'] = true;
  32087. t['Centaur'] = true;
  32088. t['Century Old Style'] = true;
  32089. t['Century Schoolbook'] = true;
  32090. t['Chaparral'] = true;
  32091. t['Charis SIL'] = true;
  32092. t['Cheltenham'] = true;
  32093. t['Cholla Slab'] = true;
  32094. t['Clarendon'] = true;
  32095. t['Clearface'] = true;
  32096. t['Cochin'] = true;
  32097. t['Colonna'] = true;
  32098. t['Computer Modern'] = true;
  32099. t['Concrete Roman'] = true;
  32100. t['Constantia'] = true;
  32101. t['Cooper Black'] = true;
  32102. t['Corona'] = true;
  32103. t['Ecotype'] = true;
  32104. t['Egyptienne'] = true;
  32105. t['Elephant'] = true;
  32106. t['Excelsior'] = true;
  32107. t['Fairfield'] = true;
  32108. t['FF Scala'] = true;
  32109. t['Folkard'] = true;
  32110. t['Footlight'] = true;
  32111. t['FreeSerif'] = true;
  32112. t['Friz Quadrata'] = true;
  32113. t['Garamond'] = true;
  32114. t['Gentium'] = true;
  32115. t['Georgia'] = true;
  32116. t['Gloucester'] = true;
  32117. t['Goudy Old Style'] = true;
  32118. t['Goudy Schoolbook'] = true;
  32119. t['Goudy Pro Font'] = true;
  32120. t['Granjon'] = true;
  32121. t['Guardian Egyptian'] = true;
  32122. t['Heather'] = true;
  32123. t['Hercules'] = true;
  32124. t['High Tower Text'] = true;
  32125. t['Hiroshige'] = true;
  32126. t['Hoefler Text'] = true;
  32127. t['Humana Serif'] = true;
  32128. t['Imprint'] = true;
  32129. t['Ionic No. 5'] = true;
  32130. t['Janson'] = true;
  32131. t['Joanna'] = true;
  32132. t['Korinna'] = true;
  32133. t['Lexicon'] = true;
  32134. t['Liberation Serif'] = true;
  32135. t['Linux Libertine'] = true;
  32136. t['Literaturnaya'] = true;
  32137. t['Lucida'] = true;
  32138. t['Lucida Bright'] = true;
  32139. t['Melior'] = true;
  32140. t['Memphis'] = true;
  32141. t['Miller'] = true;
  32142. t['Minion'] = true;
  32143. t['Modern'] = true;
  32144. t['Mona Lisa'] = true;
  32145. t['Mrs Eaves'] = true;
  32146. t['MS Serif'] = true;
  32147. t['Museo Slab'] = true;
  32148. t['New York'] = true;
  32149. t['Nimbus Roman'] = true;
  32150. t['NPS Rawlinson Roadway'] = true;
  32151. t['NuptialScript'] = true;
  32152. t['Palatino'] = true;
  32153. t['Perpetua'] = true;
  32154. t['Plantin'] = true;
  32155. t['Plantin Schoolbook'] = true;
  32156. t['Playbill'] = true;
  32157. t['Poor Richard'] = true;
  32158. t['Rawlinson Roadway'] = true;
  32159. t['Renault'] = true;
  32160. t['Requiem'] = true;
  32161. t['Rockwell'] = true;
  32162. t['Roman'] = true;
  32163. t['Rotis Serif'] = true;
  32164. t['Sabon'] = true;
  32165. t['Scala'] = true;
  32166. t['Seagull'] = true;
  32167. t['Sistina'] = true;
  32168. t['Souvenir'] = true;
  32169. t['STIX'] = true;
  32170. t['Stone Informal'] = true;
  32171. t['Stone Serif'] = true;
  32172. t['Sylfaen'] = true;
  32173. t['Times'] = true;
  32174. t['Trajan'] = true;
  32175. t['Trinité'] = true;
  32176. t['Trump Mediaeval'] = true;
  32177. t['Utopia'] = true;
  32178. t['Vale Type'] = true;
  32179. t['Bitstream Vera'] = true;
  32180. t['Vera Serif'] = true;
  32181. t['Versailles'] = true;
  32182. t['Wanted'] = true;
  32183. t['Weiss'] = true;
  32184. t['Wide Latin'] = true;
  32185. t['Windsor'] = true;
  32186. t['XITS'] = true;
  32187. });
  32188. var getSymbolsFonts = getLookupTableFactory(function (t) {
  32189. t['Dingbats'] = true;
  32190. t['Symbol'] = true;
  32191. t['ZapfDingbats'] = true;
  32192. });
  32193. var getGlyphMapForStandardFonts = getLookupTableFactory(function (t) {
  32194. t[2] = 10;
  32195. t[3] = 32;
  32196. t[4] = 33;
  32197. t[5] = 34;
  32198. t[6] = 35;
  32199. t[7] = 36;
  32200. t[8] = 37;
  32201. t[9] = 38;
  32202. t[10] = 39;
  32203. t[11] = 40;
  32204. t[12] = 41;
  32205. t[13] = 42;
  32206. t[14] = 43;
  32207. t[15] = 44;
  32208. t[16] = 45;
  32209. t[17] = 46;
  32210. t[18] = 47;
  32211. t[19] = 48;
  32212. t[20] = 49;
  32213. t[21] = 50;
  32214. t[22] = 51;
  32215. t[23] = 52;
  32216. t[24] = 53;
  32217. t[25] = 54;
  32218. t[26] = 55;
  32219. t[27] = 56;
  32220. t[28] = 57;
  32221. t[29] = 58;
  32222. t[30] = 894;
  32223. t[31] = 60;
  32224. t[32] = 61;
  32225. t[33] = 62;
  32226. t[34] = 63;
  32227. t[35] = 64;
  32228. t[36] = 65;
  32229. t[37] = 66;
  32230. t[38] = 67;
  32231. t[39] = 68;
  32232. t[40] = 69;
  32233. t[41] = 70;
  32234. t[42] = 71;
  32235. t[43] = 72;
  32236. t[44] = 73;
  32237. t[45] = 74;
  32238. t[46] = 75;
  32239. t[47] = 76;
  32240. t[48] = 77;
  32241. t[49] = 78;
  32242. t[50] = 79;
  32243. t[51] = 80;
  32244. t[52] = 81;
  32245. t[53] = 82;
  32246. t[54] = 83;
  32247. t[55] = 84;
  32248. t[56] = 85;
  32249. t[57] = 86;
  32250. t[58] = 87;
  32251. t[59] = 88;
  32252. t[60] = 89;
  32253. t[61] = 90;
  32254. t[62] = 91;
  32255. t[63] = 92;
  32256. t[64] = 93;
  32257. t[65] = 94;
  32258. t[66] = 95;
  32259. t[67] = 96;
  32260. t[68] = 97;
  32261. t[69] = 98;
  32262. t[70] = 99;
  32263. t[71] = 100;
  32264. t[72] = 101;
  32265. t[73] = 102;
  32266. t[74] = 103;
  32267. t[75] = 104;
  32268. t[76] = 105;
  32269. t[77] = 106;
  32270. t[78] = 107;
  32271. t[79] = 108;
  32272. t[80] = 109;
  32273. t[81] = 110;
  32274. t[82] = 111;
  32275. t[83] = 112;
  32276. t[84] = 113;
  32277. t[85] = 114;
  32278. t[86] = 115;
  32279. t[87] = 116;
  32280. t[88] = 117;
  32281. t[89] = 118;
  32282. t[90] = 119;
  32283. t[91] = 120;
  32284. t[92] = 121;
  32285. t[93] = 122;
  32286. t[94] = 123;
  32287. t[95] = 124;
  32288. t[96] = 125;
  32289. t[97] = 126;
  32290. t[98] = 196;
  32291. t[99] = 197;
  32292. t[100] = 199;
  32293. t[101] = 201;
  32294. t[102] = 209;
  32295. t[103] = 214;
  32296. t[104] = 220;
  32297. t[105] = 225;
  32298. t[106] = 224;
  32299. t[107] = 226;
  32300. t[108] = 228;
  32301. t[109] = 227;
  32302. t[110] = 229;
  32303. t[111] = 231;
  32304. t[112] = 233;
  32305. t[113] = 232;
  32306. t[114] = 234;
  32307. t[115] = 235;
  32308. t[116] = 237;
  32309. t[117] = 236;
  32310. t[118] = 238;
  32311. t[119] = 239;
  32312. t[120] = 241;
  32313. t[121] = 243;
  32314. t[122] = 242;
  32315. t[123] = 244;
  32316. t[124] = 246;
  32317. t[125] = 245;
  32318. t[126] = 250;
  32319. t[127] = 249;
  32320. t[128] = 251;
  32321. t[129] = 252;
  32322. t[130] = 8224;
  32323. t[131] = 176;
  32324. t[132] = 162;
  32325. t[133] = 163;
  32326. t[134] = 167;
  32327. t[135] = 8226;
  32328. t[136] = 182;
  32329. t[137] = 223;
  32330. t[138] = 174;
  32331. t[139] = 169;
  32332. t[140] = 8482;
  32333. t[141] = 180;
  32334. t[142] = 168;
  32335. t[143] = 8800;
  32336. t[144] = 198;
  32337. t[145] = 216;
  32338. t[146] = 8734;
  32339. t[147] = 177;
  32340. t[148] = 8804;
  32341. t[149] = 8805;
  32342. t[150] = 165;
  32343. t[151] = 181;
  32344. t[152] = 8706;
  32345. t[153] = 8721;
  32346. t[154] = 8719;
  32347. t[156] = 8747;
  32348. t[157] = 170;
  32349. t[158] = 186;
  32350. t[159] = 8486;
  32351. t[160] = 230;
  32352. t[161] = 248;
  32353. t[162] = 191;
  32354. t[163] = 161;
  32355. t[164] = 172;
  32356. t[165] = 8730;
  32357. t[166] = 402;
  32358. t[167] = 8776;
  32359. t[168] = 8710;
  32360. t[169] = 171;
  32361. t[170] = 187;
  32362. t[171] = 8230;
  32363. t[210] = 218;
  32364. t[223] = 711;
  32365. t[224] = 321;
  32366. t[225] = 322;
  32367. t[227] = 353;
  32368. t[229] = 382;
  32369. t[234] = 253;
  32370. t[252] = 263;
  32371. t[253] = 268;
  32372. t[254] = 269;
  32373. t[258] = 258;
  32374. t[260] = 260;
  32375. t[261] = 261;
  32376. t[265] = 280;
  32377. t[266] = 281;
  32378. t[268] = 283;
  32379. t[269] = 313;
  32380. t[275] = 323;
  32381. t[276] = 324;
  32382. t[278] = 328;
  32383. t[284] = 345;
  32384. t[285] = 346;
  32385. t[286] = 347;
  32386. t[292] = 367;
  32387. t[295] = 377;
  32388. t[296] = 378;
  32389. t[298] = 380;
  32390. t[305] = 963;
  32391. t[306] = 964;
  32392. t[307] = 966;
  32393. t[308] = 8215;
  32394. t[309] = 8252;
  32395. t[310] = 8319;
  32396. t[311] = 8359;
  32397. t[312] = 8592;
  32398. t[313] = 8593;
  32399. t[337] = 9552;
  32400. t[493] = 1039;
  32401. t[494] = 1040;
  32402. t[705] = 1524;
  32403. t[706] = 8362;
  32404. t[710] = 64288;
  32405. t[711] = 64298;
  32406. t[759] = 1617;
  32407. t[761] = 1776;
  32408. t[763] = 1778;
  32409. t[775] = 1652;
  32410. t[777] = 1764;
  32411. t[778] = 1780;
  32412. t[779] = 1781;
  32413. t[780] = 1782;
  32414. t[782] = 771;
  32415. t[783] = 64726;
  32416. t[786] = 8363;
  32417. t[788] = 8532;
  32418. t[790] = 768;
  32419. t[791] = 769;
  32420. t[792] = 768;
  32421. t[795] = 803;
  32422. t[797] = 64336;
  32423. t[798] = 64337;
  32424. t[799] = 64342;
  32425. t[800] = 64343;
  32426. t[801] = 64344;
  32427. t[802] = 64345;
  32428. t[803] = 64362;
  32429. t[804] = 64363;
  32430. t[805] = 64364;
  32431. t[2424] = 7821;
  32432. t[2425] = 7822;
  32433. t[2426] = 7823;
  32434. t[2427] = 7824;
  32435. t[2428] = 7825;
  32436. t[2429] = 7826;
  32437. t[2430] = 7827;
  32438. t[2433] = 7682;
  32439. t[2678] = 8045;
  32440. t[2679] = 8046;
  32441. t[2830] = 1552;
  32442. t[2838] = 686;
  32443. t[2840] = 751;
  32444. t[2842] = 753;
  32445. t[2843] = 754;
  32446. t[2844] = 755;
  32447. t[2846] = 757;
  32448. t[2856] = 767;
  32449. t[2857] = 848;
  32450. t[2858] = 849;
  32451. t[2862] = 853;
  32452. t[2863] = 854;
  32453. t[2864] = 855;
  32454. t[2865] = 861;
  32455. t[2866] = 862;
  32456. t[2906] = 7460;
  32457. t[2908] = 7462;
  32458. t[2909] = 7463;
  32459. t[2910] = 7464;
  32460. t[2912] = 7466;
  32461. t[2913] = 7467;
  32462. t[2914] = 7468;
  32463. t[2916] = 7470;
  32464. t[2917] = 7471;
  32465. t[2918] = 7472;
  32466. t[2920] = 7474;
  32467. t[2921] = 7475;
  32468. t[2922] = 7476;
  32469. t[2924] = 7478;
  32470. t[2925] = 7479;
  32471. t[2926] = 7480;
  32472. t[2928] = 7482;
  32473. t[2929] = 7483;
  32474. t[2930] = 7484;
  32475. t[2932] = 7486;
  32476. t[2933] = 7487;
  32477. t[2934] = 7488;
  32478. t[2936] = 7490;
  32479. t[2937] = 7491;
  32480. t[2938] = 7492;
  32481. t[2940] = 7494;
  32482. t[2941] = 7495;
  32483. t[2942] = 7496;
  32484. t[2944] = 7498;
  32485. t[2946] = 7500;
  32486. t[2948] = 7502;
  32487. t[2950] = 7504;
  32488. t[2951] = 7505;
  32489. t[2952] = 7506;
  32490. t[2954] = 7508;
  32491. t[2955] = 7509;
  32492. t[2956] = 7510;
  32493. t[2958] = 7512;
  32494. t[2959] = 7513;
  32495. t[2960] = 7514;
  32496. t[2962] = 7516;
  32497. t[2963] = 7517;
  32498. t[2964] = 7518;
  32499. t[2966] = 7520;
  32500. t[2967] = 7521;
  32501. t[2968] = 7522;
  32502. t[2970] = 7524;
  32503. t[2971] = 7525;
  32504. t[2972] = 7526;
  32505. t[2974] = 7528;
  32506. t[2975] = 7529;
  32507. t[2976] = 7530;
  32508. t[2978] = 1537;
  32509. t[2979] = 1538;
  32510. t[2980] = 1539;
  32511. t[2982] = 1549;
  32512. t[2983] = 1551;
  32513. t[2984] = 1552;
  32514. t[2986] = 1554;
  32515. t[2987] = 1555;
  32516. t[2988] = 1556;
  32517. t[2990] = 1623;
  32518. t[2991] = 1624;
  32519. t[2995] = 1775;
  32520. t[2999] = 1791;
  32521. t[3002] = 64290;
  32522. t[3003] = 64291;
  32523. t[3004] = 64292;
  32524. t[3006] = 64294;
  32525. t[3007] = 64295;
  32526. t[3008] = 64296;
  32527. t[3011] = 1900;
  32528. t[3014] = 8223;
  32529. t[3015] = 8244;
  32530. t[3017] = 7532;
  32531. t[3018] = 7533;
  32532. t[3019] = 7534;
  32533. t[3075] = 7590;
  32534. t[3076] = 7591;
  32535. t[3079] = 7594;
  32536. t[3080] = 7595;
  32537. t[3083] = 7598;
  32538. t[3084] = 7599;
  32539. t[3087] = 7602;
  32540. t[3088] = 7603;
  32541. t[3091] = 7606;
  32542. t[3092] = 7607;
  32543. t[3095] = 7610;
  32544. t[3096] = 7611;
  32545. t[3099] = 7614;
  32546. t[3100] = 7615;
  32547. t[3103] = 7618;
  32548. t[3104] = 7619;
  32549. t[3107] = 8337;
  32550. t[3108] = 8338;
  32551. t[3116] = 1884;
  32552. t[3119] = 1885;
  32553. t[3120] = 1885;
  32554. t[3123] = 1886;
  32555. t[3124] = 1886;
  32556. t[3127] = 1887;
  32557. t[3128] = 1887;
  32558. t[3131] = 1888;
  32559. t[3132] = 1888;
  32560. t[3135] = 1889;
  32561. t[3136] = 1889;
  32562. t[3139] = 1890;
  32563. t[3140] = 1890;
  32564. t[3143] = 1891;
  32565. t[3144] = 1891;
  32566. t[3147] = 1892;
  32567. t[3148] = 1892;
  32568. t[3153] = 580;
  32569. t[3154] = 581;
  32570. t[3157] = 584;
  32571. t[3158] = 585;
  32572. t[3161] = 588;
  32573. t[3162] = 589;
  32574. t[3165] = 891;
  32575. t[3166] = 892;
  32576. t[3169] = 1274;
  32577. t[3170] = 1275;
  32578. t[3173] = 1278;
  32579. t[3174] = 1279;
  32580. t[3181] = 7622;
  32581. t[3182] = 7623;
  32582. t[3282] = 11799;
  32583. t[3316] = 578;
  32584. t[3379] = 42785;
  32585. t[3393] = 1159;
  32586. t[3416] = 8377;
  32587. });
  32588. var getSupplementalGlyphMapForArialBlack = getLookupTableFactory(function (t) {
  32589. t[227] = 322;
  32590. t[264] = 261;
  32591. t[291] = 346;
  32592. });
  32593. exports.getStdFontMap = getStdFontMap;
  32594. exports.getNonStdFontMap = getNonStdFontMap;
  32595. exports.getSerifFonts = getSerifFonts;
  32596. exports.getSymbolsFonts = getSymbolsFonts;
  32597. exports.getGlyphMapForStandardFonts = getGlyphMapForStandardFonts;
  32598. exports.getSupplementalGlyphMapForArialBlack = getSupplementalGlyphMapForArialBlack;
  32599. /***/ }),
  32600. /* 18 */
  32601. /***/ (function(module, exports, __w_pdfjs_require__) {
  32602. "use strict";
  32603. var sharedUtil = __w_pdfjs_require__(0);
  32604. var getLookupTableFactory = sharedUtil.getLookupTableFactory;
  32605. var getSpecialPUASymbols = getLookupTableFactory(function (t) {
  32606. t[63721] = 0x00A9;
  32607. t[63193] = 0x00A9;
  32608. t[63720] = 0x00AE;
  32609. t[63194] = 0x00AE;
  32610. t[63722] = 0x2122;
  32611. t[63195] = 0x2122;
  32612. t[63729] = 0x23A7;
  32613. t[63730] = 0x23A8;
  32614. t[63731] = 0x23A9;
  32615. t[63740] = 0x23AB;
  32616. t[63741] = 0x23AC;
  32617. t[63742] = 0x23AD;
  32618. t[63726] = 0x23A1;
  32619. t[63727] = 0x23A2;
  32620. t[63728] = 0x23A3;
  32621. t[63737] = 0x23A4;
  32622. t[63738] = 0x23A5;
  32623. t[63739] = 0x23A6;
  32624. t[63723] = 0x239B;
  32625. t[63724] = 0x239C;
  32626. t[63725] = 0x239D;
  32627. t[63734] = 0x239E;
  32628. t[63735] = 0x239F;
  32629. t[63736] = 0x23A0;
  32630. });
  32631. function mapSpecialUnicodeValues(code) {
  32632. if (code >= 0xFFF0 && code <= 0xFFFF) {
  32633. return 0;
  32634. } else if (code >= 0xF600 && code <= 0xF8FF) {
  32635. return getSpecialPUASymbols()[code] || code;
  32636. }
  32637. return code;
  32638. }
  32639. function getUnicodeForGlyph(name, glyphsUnicodeMap) {
  32640. var unicode = glyphsUnicodeMap[name];
  32641. if (unicode !== undefined) {
  32642. return unicode;
  32643. }
  32644. if (!name) {
  32645. return -1;
  32646. }
  32647. if (name[0] === 'u') {
  32648. var nameLen = name.length, hexStr;
  32649. if (nameLen === 7 && name[1] === 'n' && name[2] === 'i') {
  32650. hexStr = name.substr(3);
  32651. } else if (nameLen >= 5 && nameLen <= 7) {
  32652. hexStr = name.substr(1);
  32653. } else {
  32654. return -1;
  32655. }
  32656. if (hexStr === hexStr.toUpperCase()) {
  32657. unicode = parseInt(hexStr, 16);
  32658. if (unicode >= 0) {
  32659. return unicode;
  32660. }
  32661. }
  32662. }
  32663. return -1;
  32664. }
  32665. var UnicodeRanges = [
  32666. {
  32667. 'begin': 0x0000,
  32668. 'end': 0x007F
  32669. },
  32670. {
  32671. 'begin': 0x0080,
  32672. 'end': 0x00FF
  32673. },
  32674. {
  32675. 'begin': 0x0100,
  32676. 'end': 0x017F
  32677. },
  32678. {
  32679. 'begin': 0x0180,
  32680. 'end': 0x024F
  32681. },
  32682. {
  32683. 'begin': 0x0250,
  32684. 'end': 0x02AF
  32685. },
  32686. {
  32687. 'begin': 0x02B0,
  32688. 'end': 0x02FF
  32689. },
  32690. {
  32691. 'begin': 0x0300,
  32692. 'end': 0x036F
  32693. },
  32694. {
  32695. 'begin': 0x0370,
  32696. 'end': 0x03FF
  32697. },
  32698. {
  32699. 'begin': 0x2C80,
  32700. 'end': 0x2CFF
  32701. },
  32702. {
  32703. 'begin': 0x0400,
  32704. 'end': 0x04FF
  32705. },
  32706. {
  32707. 'begin': 0x0530,
  32708. 'end': 0x058F
  32709. },
  32710. {
  32711. 'begin': 0x0590,
  32712. 'end': 0x05FF
  32713. },
  32714. {
  32715. 'begin': 0xA500,
  32716. 'end': 0xA63F
  32717. },
  32718. {
  32719. 'begin': 0x0600,
  32720. 'end': 0x06FF
  32721. },
  32722. {
  32723. 'begin': 0x07C0,
  32724. 'end': 0x07FF
  32725. },
  32726. {
  32727. 'begin': 0x0900,
  32728. 'end': 0x097F
  32729. },
  32730. {
  32731. 'begin': 0x0980,
  32732. 'end': 0x09FF
  32733. },
  32734. {
  32735. 'begin': 0x0A00,
  32736. 'end': 0x0A7F
  32737. },
  32738. {
  32739. 'begin': 0x0A80,
  32740. 'end': 0x0AFF
  32741. },
  32742. {
  32743. 'begin': 0x0B00,
  32744. 'end': 0x0B7F
  32745. },
  32746. {
  32747. 'begin': 0x0B80,
  32748. 'end': 0x0BFF
  32749. },
  32750. {
  32751. 'begin': 0x0C00,
  32752. 'end': 0x0C7F
  32753. },
  32754. {
  32755. 'begin': 0x0C80,
  32756. 'end': 0x0CFF
  32757. },
  32758. {
  32759. 'begin': 0x0D00,
  32760. 'end': 0x0D7F
  32761. },
  32762. {
  32763. 'begin': 0x0E00,
  32764. 'end': 0x0E7F
  32765. },
  32766. {
  32767. 'begin': 0x0E80,
  32768. 'end': 0x0EFF
  32769. },
  32770. {
  32771. 'begin': 0x10A0,
  32772. 'end': 0x10FF
  32773. },
  32774. {
  32775. 'begin': 0x1B00,
  32776. 'end': 0x1B7F
  32777. },
  32778. {
  32779. 'begin': 0x1100,
  32780. 'end': 0x11FF
  32781. },
  32782. {
  32783. 'begin': 0x1E00,
  32784. 'end': 0x1EFF
  32785. },
  32786. {
  32787. 'begin': 0x1F00,
  32788. 'end': 0x1FFF
  32789. },
  32790. {
  32791. 'begin': 0x2000,
  32792. 'end': 0x206F
  32793. },
  32794. {
  32795. 'begin': 0x2070,
  32796. 'end': 0x209F
  32797. },
  32798. {
  32799. 'begin': 0x20A0,
  32800. 'end': 0x20CF
  32801. },
  32802. {
  32803. 'begin': 0x20D0,
  32804. 'end': 0x20FF
  32805. },
  32806. {
  32807. 'begin': 0x2100,
  32808. 'end': 0x214F
  32809. },
  32810. {
  32811. 'begin': 0x2150,
  32812. 'end': 0x218F
  32813. },
  32814. {
  32815. 'begin': 0x2190,
  32816. 'end': 0x21FF
  32817. },
  32818. {
  32819. 'begin': 0x2200,
  32820. 'end': 0x22FF
  32821. },
  32822. {
  32823. 'begin': 0x2300,
  32824. 'end': 0x23FF
  32825. },
  32826. {
  32827. 'begin': 0x2400,
  32828. 'end': 0x243F
  32829. },
  32830. {
  32831. 'begin': 0x2440,
  32832. 'end': 0x245F
  32833. },
  32834. {
  32835. 'begin': 0x2460,
  32836. 'end': 0x24FF
  32837. },
  32838. {
  32839. 'begin': 0x2500,
  32840. 'end': 0x257F
  32841. },
  32842. {
  32843. 'begin': 0x2580,
  32844. 'end': 0x259F
  32845. },
  32846. {
  32847. 'begin': 0x25A0,
  32848. 'end': 0x25FF
  32849. },
  32850. {
  32851. 'begin': 0x2600,
  32852. 'end': 0x26FF
  32853. },
  32854. {
  32855. 'begin': 0x2700,
  32856. 'end': 0x27BF
  32857. },
  32858. {
  32859. 'begin': 0x3000,
  32860. 'end': 0x303F
  32861. },
  32862. {
  32863. 'begin': 0x3040,
  32864. 'end': 0x309F
  32865. },
  32866. {
  32867. 'begin': 0x30A0,
  32868. 'end': 0x30FF
  32869. },
  32870. {
  32871. 'begin': 0x3100,
  32872. 'end': 0x312F
  32873. },
  32874. {
  32875. 'begin': 0x3130,
  32876. 'end': 0x318F
  32877. },
  32878. {
  32879. 'begin': 0xA840,
  32880. 'end': 0xA87F
  32881. },
  32882. {
  32883. 'begin': 0x3200,
  32884. 'end': 0x32FF
  32885. },
  32886. {
  32887. 'begin': 0x3300,
  32888. 'end': 0x33FF
  32889. },
  32890. {
  32891. 'begin': 0xAC00,
  32892. 'end': 0xD7AF
  32893. },
  32894. {
  32895. 'begin': 0xD800,
  32896. 'end': 0xDFFF
  32897. },
  32898. {
  32899. 'begin': 0x10900,
  32900. 'end': 0x1091F
  32901. },
  32902. {
  32903. 'begin': 0x4E00,
  32904. 'end': 0x9FFF
  32905. },
  32906. {
  32907. 'begin': 0xE000,
  32908. 'end': 0xF8FF
  32909. },
  32910. {
  32911. 'begin': 0x31C0,
  32912. 'end': 0x31EF
  32913. },
  32914. {
  32915. 'begin': 0xFB00,
  32916. 'end': 0xFB4F
  32917. },
  32918. {
  32919. 'begin': 0xFB50,
  32920. 'end': 0xFDFF
  32921. },
  32922. {
  32923. 'begin': 0xFE20,
  32924. 'end': 0xFE2F
  32925. },
  32926. {
  32927. 'begin': 0xFE10,
  32928. 'end': 0xFE1F
  32929. },
  32930. {
  32931. 'begin': 0xFE50,
  32932. 'end': 0xFE6F
  32933. },
  32934. {
  32935. 'begin': 0xFE70,
  32936. 'end': 0xFEFF
  32937. },
  32938. {
  32939. 'begin': 0xFF00,
  32940. 'end': 0xFFEF
  32941. },
  32942. {
  32943. 'begin': 0xFFF0,
  32944. 'end': 0xFFFF
  32945. },
  32946. {
  32947. 'begin': 0x0F00,
  32948. 'end': 0x0FFF
  32949. },
  32950. {
  32951. 'begin': 0x0700,
  32952. 'end': 0x074F
  32953. },
  32954. {
  32955. 'begin': 0x0780,
  32956. 'end': 0x07BF
  32957. },
  32958. {
  32959. 'begin': 0x0D80,
  32960. 'end': 0x0DFF
  32961. },
  32962. {
  32963. 'begin': 0x1000,
  32964. 'end': 0x109F
  32965. },
  32966. {
  32967. 'begin': 0x1200,
  32968. 'end': 0x137F
  32969. },
  32970. {
  32971. 'begin': 0x13A0,
  32972. 'end': 0x13FF
  32973. },
  32974. {
  32975. 'begin': 0x1400,
  32976. 'end': 0x167F
  32977. },
  32978. {
  32979. 'begin': 0x1680,
  32980. 'end': 0x169F
  32981. },
  32982. {
  32983. 'begin': 0x16A0,
  32984. 'end': 0x16FF
  32985. },
  32986. {
  32987. 'begin': 0x1780,
  32988. 'end': 0x17FF
  32989. },
  32990. {
  32991. 'begin': 0x1800,
  32992. 'end': 0x18AF
  32993. },
  32994. {
  32995. 'begin': 0x2800,
  32996. 'end': 0x28FF
  32997. },
  32998. {
  32999. 'begin': 0xA000,
  33000. 'end': 0xA48F
  33001. },
  33002. {
  33003. 'begin': 0x1700,
  33004. 'end': 0x171F
  33005. },
  33006. {
  33007. 'begin': 0x10300,
  33008. 'end': 0x1032F
  33009. },
  33010. {
  33011. 'begin': 0x10330,
  33012. 'end': 0x1034F
  33013. },
  33014. {
  33015. 'begin': 0x10400,
  33016. 'end': 0x1044F
  33017. },
  33018. {
  33019. 'begin': 0x1D000,
  33020. 'end': 0x1D0FF
  33021. },
  33022. {
  33023. 'begin': 0x1D400,
  33024. 'end': 0x1D7FF
  33025. },
  33026. {
  33027. 'begin': 0xFF000,
  33028. 'end': 0xFFFFD
  33029. },
  33030. {
  33031. 'begin': 0xFE00,
  33032. 'end': 0xFE0F
  33033. },
  33034. {
  33035. 'begin': 0xE0000,
  33036. 'end': 0xE007F
  33037. },
  33038. {
  33039. 'begin': 0x1900,
  33040. 'end': 0x194F
  33041. },
  33042. {
  33043. 'begin': 0x1950,
  33044. 'end': 0x197F
  33045. },
  33046. {
  33047. 'begin': 0x1980,
  33048. 'end': 0x19DF
  33049. },
  33050. {
  33051. 'begin': 0x1A00,
  33052. 'end': 0x1A1F
  33053. },
  33054. {
  33055. 'begin': 0x2C00,
  33056. 'end': 0x2C5F
  33057. },
  33058. {
  33059. 'begin': 0x2D30,
  33060. 'end': 0x2D7F
  33061. },
  33062. {
  33063. 'begin': 0x4DC0,
  33064. 'end': 0x4DFF
  33065. },
  33066. {
  33067. 'begin': 0xA800,
  33068. 'end': 0xA82F
  33069. },
  33070. {
  33071. 'begin': 0x10000,
  33072. 'end': 0x1007F
  33073. },
  33074. {
  33075. 'begin': 0x10140,
  33076. 'end': 0x1018F
  33077. },
  33078. {
  33079. 'begin': 0x10380,
  33080. 'end': 0x1039F
  33081. },
  33082. {
  33083. 'begin': 0x103A0,
  33084. 'end': 0x103DF
  33085. },
  33086. {
  33087. 'begin': 0x10450,
  33088. 'end': 0x1047F
  33089. },
  33090. {
  33091. 'begin': 0x10480,
  33092. 'end': 0x104AF
  33093. },
  33094. {
  33095. 'begin': 0x10800,
  33096. 'end': 0x1083F
  33097. },
  33098. {
  33099. 'begin': 0x10A00,
  33100. 'end': 0x10A5F
  33101. },
  33102. {
  33103. 'begin': 0x1D300,
  33104. 'end': 0x1D35F
  33105. },
  33106. {
  33107. 'begin': 0x12000,
  33108. 'end': 0x123FF
  33109. },
  33110. {
  33111. 'begin': 0x1D360,
  33112. 'end': 0x1D37F
  33113. },
  33114. {
  33115. 'begin': 0x1B80,
  33116. 'end': 0x1BBF
  33117. },
  33118. {
  33119. 'begin': 0x1C00,
  33120. 'end': 0x1C4F
  33121. },
  33122. {
  33123. 'begin': 0x1C50,
  33124. 'end': 0x1C7F
  33125. },
  33126. {
  33127. 'begin': 0xA880,
  33128. 'end': 0xA8DF
  33129. },
  33130. {
  33131. 'begin': 0xA900,
  33132. 'end': 0xA92F
  33133. },
  33134. {
  33135. 'begin': 0xA930,
  33136. 'end': 0xA95F
  33137. },
  33138. {
  33139. 'begin': 0xAA00,
  33140. 'end': 0xAA5F
  33141. },
  33142. {
  33143. 'begin': 0x10190,
  33144. 'end': 0x101CF
  33145. },
  33146. {
  33147. 'begin': 0x101D0,
  33148. 'end': 0x101FF
  33149. },
  33150. {
  33151. 'begin': 0x102A0,
  33152. 'end': 0x102DF
  33153. },
  33154. {
  33155. 'begin': 0x1F030,
  33156. 'end': 0x1F09F
  33157. }
  33158. ];
  33159. function getUnicodeRangeFor(value) {
  33160. for (var i = 0, ii = UnicodeRanges.length; i < ii; i++) {
  33161. var range = UnicodeRanges[i];
  33162. if (value >= range.begin && value < range.end) {
  33163. return i;
  33164. }
  33165. }
  33166. return -1;
  33167. }
  33168. function isRTLRangeFor(value) {
  33169. var range = UnicodeRanges[13];
  33170. if (value >= range.begin && value < range.end) {
  33171. return true;
  33172. }
  33173. range = UnicodeRanges[11];
  33174. if (value >= range.begin && value < range.end) {
  33175. return true;
  33176. }
  33177. return false;
  33178. }
  33179. var getNormalizedUnicodes = getLookupTableFactory(function (t) {
  33180. t['\u00A8'] = '\u0020\u0308';
  33181. t['\u00AF'] = '\u0020\u0304';
  33182. t['\u00B4'] = '\u0020\u0301';
  33183. t['\u00B5'] = '\u03BC';
  33184. t['\u00B8'] = '\u0020\u0327';
  33185. t['\u0132'] = '\u0049\u004A';
  33186. t['\u0133'] = '\u0069\u006A';
  33187. t['\u013F'] = '\u004C\u00B7';
  33188. t['\u0140'] = '\u006C\u00B7';
  33189. t['\u0149'] = '\u02BC\u006E';
  33190. t['\u017F'] = '\u0073';
  33191. t['\u01C4'] = '\u0044\u017D';
  33192. t['\u01C5'] = '\u0044\u017E';
  33193. t['\u01C6'] = '\u0064\u017E';
  33194. t['\u01C7'] = '\u004C\u004A';
  33195. t['\u01C8'] = '\u004C\u006A';
  33196. t['\u01C9'] = '\u006C\u006A';
  33197. t['\u01CA'] = '\u004E\u004A';
  33198. t['\u01CB'] = '\u004E\u006A';
  33199. t['\u01CC'] = '\u006E\u006A';
  33200. t['\u01F1'] = '\u0044\u005A';
  33201. t['\u01F2'] = '\u0044\u007A';
  33202. t['\u01F3'] = '\u0064\u007A';
  33203. t['\u02D8'] = '\u0020\u0306';
  33204. t['\u02D9'] = '\u0020\u0307';
  33205. t['\u02DA'] = '\u0020\u030A';
  33206. t['\u02DB'] = '\u0020\u0328';
  33207. t['\u02DC'] = '\u0020\u0303';
  33208. t['\u02DD'] = '\u0020\u030B';
  33209. t['\u037A'] = '\u0020\u0345';
  33210. t['\u0384'] = '\u0020\u0301';
  33211. t['\u03D0'] = '\u03B2';
  33212. t['\u03D1'] = '\u03B8';
  33213. t['\u03D2'] = '\u03A5';
  33214. t['\u03D5'] = '\u03C6';
  33215. t['\u03D6'] = '\u03C0';
  33216. t['\u03F0'] = '\u03BA';
  33217. t['\u03F1'] = '\u03C1';
  33218. t['\u03F2'] = '\u03C2';
  33219. t['\u03F4'] = '\u0398';
  33220. t['\u03F5'] = '\u03B5';
  33221. t['\u03F9'] = '\u03A3';
  33222. t['\u0587'] = '\u0565\u0582';
  33223. t['\u0675'] = '\u0627\u0674';
  33224. t['\u0676'] = '\u0648\u0674';
  33225. t['\u0677'] = '\u06C7\u0674';
  33226. t['\u0678'] = '\u064A\u0674';
  33227. t['\u0E33'] = '\u0E4D\u0E32';
  33228. t['\u0EB3'] = '\u0ECD\u0EB2';
  33229. t['\u0EDC'] = '\u0EAB\u0E99';
  33230. t['\u0EDD'] = '\u0EAB\u0EA1';
  33231. t['\u0F77'] = '\u0FB2\u0F81';
  33232. t['\u0F79'] = '\u0FB3\u0F81';
  33233. t['\u1E9A'] = '\u0061\u02BE';
  33234. t['\u1FBD'] = '\u0020\u0313';
  33235. t['\u1FBF'] = '\u0020\u0313';
  33236. t['\u1FC0'] = '\u0020\u0342';
  33237. t['\u1FFE'] = '\u0020\u0314';
  33238. t['\u2002'] = '\u0020';
  33239. t['\u2003'] = '\u0020';
  33240. t['\u2004'] = '\u0020';
  33241. t['\u2005'] = '\u0020';
  33242. t['\u2006'] = '\u0020';
  33243. t['\u2008'] = '\u0020';
  33244. t['\u2009'] = '\u0020';
  33245. t['\u200A'] = '\u0020';
  33246. t['\u2017'] = '\u0020\u0333';
  33247. t['\u2024'] = '\u002E';
  33248. t['\u2025'] = '\u002E\u002E';
  33249. t['\u2026'] = '\u002E\u002E\u002E';
  33250. t['\u2033'] = '\u2032\u2032';
  33251. t['\u2034'] = '\u2032\u2032\u2032';
  33252. t['\u2036'] = '\u2035\u2035';
  33253. t['\u2037'] = '\u2035\u2035\u2035';
  33254. t['\u203C'] = '\u0021\u0021';
  33255. t['\u203E'] = '\u0020\u0305';
  33256. t['\u2047'] = '\u003F\u003F';
  33257. t['\u2048'] = '\u003F\u0021';
  33258. t['\u2049'] = '\u0021\u003F';
  33259. t['\u2057'] = '\u2032\u2032\u2032\u2032';
  33260. t['\u205F'] = '\u0020';
  33261. t['\u20A8'] = '\u0052\u0073';
  33262. t['\u2100'] = '\u0061\u002F\u0063';
  33263. t['\u2101'] = '\u0061\u002F\u0073';
  33264. t['\u2103'] = '\u00B0\u0043';
  33265. t['\u2105'] = '\u0063\u002F\u006F';
  33266. t['\u2106'] = '\u0063\u002F\u0075';
  33267. t['\u2107'] = '\u0190';
  33268. t['\u2109'] = '\u00B0\u0046';
  33269. t['\u2116'] = '\u004E\u006F';
  33270. t['\u2121'] = '\u0054\u0045\u004C';
  33271. t['\u2135'] = '\u05D0';
  33272. t['\u2136'] = '\u05D1';
  33273. t['\u2137'] = '\u05D2';
  33274. t['\u2138'] = '\u05D3';
  33275. t['\u213B'] = '\u0046\u0041\u0058';
  33276. t['\u2160'] = '\u0049';
  33277. t['\u2161'] = '\u0049\u0049';
  33278. t['\u2162'] = '\u0049\u0049\u0049';
  33279. t['\u2163'] = '\u0049\u0056';
  33280. t['\u2164'] = '\u0056';
  33281. t['\u2165'] = '\u0056\u0049';
  33282. t['\u2166'] = '\u0056\u0049\u0049';
  33283. t['\u2167'] = '\u0056\u0049\u0049\u0049';
  33284. t['\u2168'] = '\u0049\u0058';
  33285. t['\u2169'] = '\u0058';
  33286. t['\u216A'] = '\u0058\u0049';
  33287. t['\u216B'] = '\u0058\u0049\u0049';
  33288. t['\u216C'] = '\u004C';
  33289. t['\u216D'] = '\u0043';
  33290. t['\u216E'] = '\u0044';
  33291. t['\u216F'] = '\u004D';
  33292. t['\u2170'] = '\u0069';
  33293. t['\u2171'] = '\u0069\u0069';
  33294. t['\u2172'] = '\u0069\u0069\u0069';
  33295. t['\u2173'] = '\u0069\u0076';
  33296. t['\u2174'] = '\u0076';
  33297. t['\u2175'] = '\u0076\u0069';
  33298. t['\u2176'] = '\u0076\u0069\u0069';
  33299. t['\u2177'] = '\u0076\u0069\u0069\u0069';
  33300. t['\u2178'] = '\u0069\u0078';
  33301. t['\u2179'] = '\u0078';
  33302. t['\u217A'] = '\u0078\u0069';
  33303. t['\u217B'] = '\u0078\u0069\u0069';
  33304. t['\u217C'] = '\u006C';
  33305. t['\u217D'] = '\u0063';
  33306. t['\u217E'] = '\u0064';
  33307. t['\u217F'] = '\u006D';
  33308. t['\u222C'] = '\u222B\u222B';
  33309. t['\u222D'] = '\u222B\u222B\u222B';
  33310. t['\u222F'] = '\u222E\u222E';
  33311. t['\u2230'] = '\u222E\u222E\u222E';
  33312. t['\u2474'] = '\u0028\u0031\u0029';
  33313. t['\u2475'] = '\u0028\u0032\u0029';
  33314. t['\u2476'] = '\u0028\u0033\u0029';
  33315. t['\u2477'] = '\u0028\u0034\u0029';
  33316. t['\u2478'] = '\u0028\u0035\u0029';
  33317. t['\u2479'] = '\u0028\u0036\u0029';
  33318. t['\u247A'] = '\u0028\u0037\u0029';
  33319. t['\u247B'] = '\u0028\u0038\u0029';
  33320. t['\u247C'] = '\u0028\u0039\u0029';
  33321. t['\u247D'] = '\u0028\u0031\u0030\u0029';
  33322. t['\u247E'] = '\u0028\u0031\u0031\u0029';
  33323. t['\u247F'] = '\u0028\u0031\u0032\u0029';
  33324. t['\u2480'] = '\u0028\u0031\u0033\u0029';
  33325. t['\u2481'] = '\u0028\u0031\u0034\u0029';
  33326. t['\u2482'] = '\u0028\u0031\u0035\u0029';
  33327. t['\u2483'] = '\u0028\u0031\u0036\u0029';
  33328. t['\u2484'] = '\u0028\u0031\u0037\u0029';
  33329. t['\u2485'] = '\u0028\u0031\u0038\u0029';
  33330. t['\u2486'] = '\u0028\u0031\u0039\u0029';
  33331. t['\u2487'] = '\u0028\u0032\u0030\u0029';
  33332. t['\u2488'] = '\u0031\u002E';
  33333. t['\u2489'] = '\u0032\u002E';
  33334. t['\u248A'] = '\u0033\u002E';
  33335. t['\u248B'] = '\u0034\u002E';
  33336. t['\u248C'] = '\u0035\u002E';
  33337. t['\u248D'] = '\u0036\u002E';
  33338. t['\u248E'] = '\u0037\u002E';
  33339. t['\u248F'] = '\u0038\u002E';
  33340. t['\u2490'] = '\u0039\u002E';
  33341. t['\u2491'] = '\u0031\u0030\u002E';
  33342. t['\u2492'] = '\u0031\u0031\u002E';
  33343. t['\u2493'] = '\u0031\u0032\u002E';
  33344. t['\u2494'] = '\u0031\u0033\u002E';
  33345. t['\u2495'] = '\u0031\u0034\u002E';
  33346. t['\u2496'] = '\u0031\u0035\u002E';
  33347. t['\u2497'] = '\u0031\u0036\u002E';
  33348. t['\u2498'] = '\u0031\u0037\u002E';
  33349. t['\u2499'] = '\u0031\u0038\u002E';
  33350. t['\u249A'] = '\u0031\u0039\u002E';
  33351. t['\u249B'] = '\u0032\u0030\u002E';
  33352. t['\u249C'] = '\u0028\u0061\u0029';
  33353. t['\u249D'] = '\u0028\u0062\u0029';
  33354. t['\u249E'] = '\u0028\u0063\u0029';
  33355. t['\u249F'] = '\u0028\u0064\u0029';
  33356. t['\u24A0'] = '\u0028\u0065\u0029';
  33357. t['\u24A1'] = '\u0028\u0066\u0029';
  33358. t['\u24A2'] = '\u0028\u0067\u0029';
  33359. t['\u24A3'] = '\u0028\u0068\u0029';
  33360. t['\u24A4'] = '\u0028\u0069\u0029';
  33361. t['\u24A5'] = '\u0028\u006A\u0029';
  33362. t['\u24A6'] = '\u0028\u006B\u0029';
  33363. t['\u24A7'] = '\u0028\u006C\u0029';
  33364. t['\u24A8'] = '\u0028\u006D\u0029';
  33365. t['\u24A9'] = '\u0028\u006E\u0029';
  33366. t['\u24AA'] = '\u0028\u006F\u0029';
  33367. t['\u24AB'] = '\u0028\u0070\u0029';
  33368. t['\u24AC'] = '\u0028\u0071\u0029';
  33369. t['\u24AD'] = '\u0028\u0072\u0029';
  33370. t['\u24AE'] = '\u0028\u0073\u0029';
  33371. t['\u24AF'] = '\u0028\u0074\u0029';
  33372. t['\u24B0'] = '\u0028\u0075\u0029';
  33373. t['\u24B1'] = '\u0028\u0076\u0029';
  33374. t['\u24B2'] = '\u0028\u0077\u0029';
  33375. t['\u24B3'] = '\u0028\u0078\u0029';
  33376. t['\u24B4'] = '\u0028\u0079\u0029';
  33377. t['\u24B5'] = '\u0028\u007A\u0029';
  33378. t['\u2A0C'] = '\u222B\u222B\u222B\u222B';
  33379. t['\u2A74'] = '\u003A\u003A\u003D';
  33380. t['\u2A75'] = '\u003D\u003D';
  33381. t['\u2A76'] = '\u003D\u003D\u003D';
  33382. t['\u2E9F'] = '\u6BCD';
  33383. t['\u2EF3'] = '\u9F9F';
  33384. t['\u2F00'] = '\u4E00';
  33385. t['\u2F01'] = '\u4E28';
  33386. t['\u2F02'] = '\u4E36';
  33387. t['\u2F03'] = '\u4E3F';
  33388. t['\u2F04'] = '\u4E59';
  33389. t['\u2F05'] = '\u4E85';
  33390. t['\u2F06'] = '\u4E8C';
  33391. t['\u2F07'] = '\u4EA0';
  33392. t['\u2F08'] = '\u4EBA';
  33393. t['\u2F09'] = '\u513F';
  33394. t['\u2F0A'] = '\u5165';
  33395. t['\u2F0B'] = '\u516B';
  33396. t['\u2F0C'] = '\u5182';
  33397. t['\u2F0D'] = '\u5196';
  33398. t['\u2F0E'] = '\u51AB';
  33399. t['\u2F0F'] = '\u51E0';
  33400. t['\u2F10'] = '\u51F5';
  33401. t['\u2F11'] = '\u5200';
  33402. t['\u2F12'] = '\u529B';
  33403. t['\u2F13'] = '\u52F9';
  33404. t['\u2F14'] = '\u5315';
  33405. t['\u2F15'] = '\u531A';
  33406. t['\u2F16'] = '\u5338';
  33407. t['\u2F17'] = '\u5341';
  33408. t['\u2F18'] = '\u535C';
  33409. t['\u2F19'] = '\u5369';
  33410. t['\u2F1A'] = '\u5382';
  33411. t['\u2F1B'] = '\u53B6';
  33412. t['\u2F1C'] = '\u53C8';
  33413. t['\u2F1D'] = '\u53E3';
  33414. t['\u2F1E'] = '\u56D7';
  33415. t['\u2F1F'] = '\u571F';
  33416. t['\u2F20'] = '\u58EB';
  33417. t['\u2F21'] = '\u5902';
  33418. t['\u2F22'] = '\u590A';
  33419. t['\u2F23'] = '\u5915';
  33420. t['\u2F24'] = '\u5927';
  33421. t['\u2F25'] = '\u5973';
  33422. t['\u2F26'] = '\u5B50';
  33423. t['\u2F27'] = '\u5B80';
  33424. t['\u2F28'] = '\u5BF8';
  33425. t['\u2F29'] = '\u5C0F';
  33426. t['\u2F2A'] = '\u5C22';
  33427. t['\u2F2B'] = '\u5C38';
  33428. t['\u2F2C'] = '\u5C6E';
  33429. t['\u2F2D'] = '\u5C71';
  33430. t['\u2F2E'] = '\u5DDB';
  33431. t['\u2F2F'] = '\u5DE5';
  33432. t['\u2F30'] = '\u5DF1';
  33433. t['\u2F31'] = '\u5DFE';
  33434. t['\u2F32'] = '\u5E72';
  33435. t['\u2F33'] = '\u5E7A';
  33436. t['\u2F34'] = '\u5E7F';
  33437. t['\u2F35'] = '\u5EF4';
  33438. t['\u2F36'] = '\u5EFE';
  33439. t['\u2F37'] = '\u5F0B';
  33440. t['\u2F38'] = '\u5F13';
  33441. t['\u2F39'] = '\u5F50';
  33442. t['\u2F3A'] = '\u5F61';
  33443. t['\u2F3B'] = '\u5F73';
  33444. t['\u2F3C'] = '\u5FC3';
  33445. t['\u2F3D'] = '\u6208';
  33446. t['\u2F3E'] = '\u6236';
  33447. t['\u2F3F'] = '\u624B';
  33448. t['\u2F40'] = '\u652F';
  33449. t['\u2F41'] = '\u6534';
  33450. t['\u2F42'] = '\u6587';
  33451. t['\u2F43'] = '\u6597';
  33452. t['\u2F44'] = '\u65A4';
  33453. t['\u2F45'] = '\u65B9';
  33454. t['\u2F46'] = '\u65E0';
  33455. t['\u2F47'] = '\u65E5';
  33456. t['\u2F48'] = '\u66F0';
  33457. t['\u2F49'] = '\u6708';
  33458. t['\u2F4A'] = '\u6728';
  33459. t['\u2F4B'] = '\u6B20';
  33460. t['\u2F4C'] = '\u6B62';
  33461. t['\u2F4D'] = '\u6B79';
  33462. t['\u2F4E'] = '\u6BB3';
  33463. t['\u2F4F'] = '\u6BCB';
  33464. t['\u2F50'] = '\u6BD4';
  33465. t['\u2F51'] = '\u6BDB';
  33466. t['\u2F52'] = '\u6C0F';
  33467. t['\u2F53'] = '\u6C14';
  33468. t['\u2F54'] = '\u6C34';
  33469. t['\u2F55'] = '\u706B';
  33470. t['\u2F56'] = '\u722A';
  33471. t['\u2F57'] = '\u7236';
  33472. t['\u2F58'] = '\u723B';
  33473. t['\u2F59'] = '\u723F';
  33474. t['\u2F5A'] = '\u7247';
  33475. t['\u2F5B'] = '\u7259';
  33476. t['\u2F5C'] = '\u725B';
  33477. t['\u2F5D'] = '\u72AC';
  33478. t['\u2F5E'] = '\u7384';
  33479. t['\u2F5F'] = '\u7389';
  33480. t['\u2F60'] = '\u74DC';
  33481. t['\u2F61'] = '\u74E6';
  33482. t['\u2F62'] = '\u7518';
  33483. t['\u2F63'] = '\u751F';
  33484. t['\u2F64'] = '\u7528';
  33485. t['\u2F65'] = '\u7530';
  33486. t['\u2F66'] = '\u758B';
  33487. t['\u2F67'] = '\u7592';
  33488. t['\u2F68'] = '\u7676';
  33489. t['\u2F69'] = '\u767D';
  33490. t['\u2F6A'] = '\u76AE';
  33491. t['\u2F6B'] = '\u76BF';
  33492. t['\u2F6C'] = '\u76EE';
  33493. t['\u2F6D'] = '\u77DB';
  33494. t['\u2F6E'] = '\u77E2';
  33495. t['\u2F6F'] = '\u77F3';
  33496. t['\u2F70'] = '\u793A';
  33497. t['\u2F71'] = '\u79B8';
  33498. t['\u2F72'] = '\u79BE';
  33499. t['\u2F73'] = '\u7A74';
  33500. t['\u2F74'] = '\u7ACB';
  33501. t['\u2F75'] = '\u7AF9';
  33502. t['\u2F76'] = '\u7C73';
  33503. t['\u2F77'] = '\u7CF8';
  33504. t['\u2F78'] = '\u7F36';
  33505. t['\u2F79'] = '\u7F51';
  33506. t['\u2F7A'] = '\u7F8A';
  33507. t['\u2F7B'] = '\u7FBD';
  33508. t['\u2F7C'] = '\u8001';
  33509. t['\u2F7D'] = '\u800C';
  33510. t['\u2F7E'] = '\u8012';
  33511. t['\u2F7F'] = '\u8033';
  33512. t['\u2F80'] = '\u807F';
  33513. t['\u2F81'] = '\u8089';
  33514. t['\u2F82'] = '\u81E3';
  33515. t['\u2F83'] = '\u81EA';
  33516. t['\u2F84'] = '\u81F3';
  33517. t['\u2F85'] = '\u81FC';
  33518. t['\u2F86'] = '\u820C';
  33519. t['\u2F87'] = '\u821B';
  33520. t['\u2F88'] = '\u821F';
  33521. t['\u2F89'] = '\u826E';
  33522. t['\u2F8A'] = '\u8272';
  33523. t['\u2F8B'] = '\u8278';
  33524. t['\u2F8C'] = '\u864D';
  33525. t['\u2F8D'] = '\u866B';
  33526. t['\u2F8E'] = '\u8840';
  33527. t['\u2F8F'] = '\u884C';
  33528. t['\u2F90'] = '\u8863';
  33529. t['\u2F91'] = '\u897E';
  33530. t['\u2F92'] = '\u898B';
  33531. t['\u2F93'] = '\u89D2';
  33532. t['\u2F94'] = '\u8A00';
  33533. t['\u2F95'] = '\u8C37';
  33534. t['\u2F96'] = '\u8C46';
  33535. t['\u2F97'] = '\u8C55';
  33536. t['\u2F98'] = '\u8C78';
  33537. t['\u2F99'] = '\u8C9D';
  33538. t['\u2F9A'] = '\u8D64';
  33539. t['\u2F9B'] = '\u8D70';
  33540. t['\u2F9C'] = '\u8DB3';
  33541. t['\u2F9D'] = '\u8EAB';
  33542. t['\u2F9E'] = '\u8ECA';
  33543. t['\u2F9F'] = '\u8F9B';
  33544. t['\u2FA0'] = '\u8FB0';
  33545. t['\u2FA1'] = '\u8FB5';
  33546. t['\u2FA2'] = '\u9091';
  33547. t['\u2FA3'] = '\u9149';
  33548. t['\u2FA4'] = '\u91C6';
  33549. t['\u2FA5'] = '\u91CC';
  33550. t['\u2FA6'] = '\u91D1';
  33551. t['\u2FA7'] = '\u9577';
  33552. t['\u2FA8'] = '\u9580';
  33553. t['\u2FA9'] = '\u961C';
  33554. t['\u2FAA'] = '\u96B6';
  33555. t['\u2FAB'] = '\u96B9';
  33556. t['\u2FAC'] = '\u96E8';
  33557. t['\u2FAD'] = '\u9751';
  33558. t['\u2FAE'] = '\u975E';
  33559. t['\u2FAF'] = '\u9762';
  33560. t['\u2FB0'] = '\u9769';
  33561. t['\u2FB1'] = '\u97CB';
  33562. t['\u2FB2'] = '\u97ED';
  33563. t['\u2FB3'] = '\u97F3';
  33564. t['\u2FB4'] = '\u9801';
  33565. t['\u2FB5'] = '\u98A8';
  33566. t['\u2FB6'] = '\u98DB';
  33567. t['\u2FB7'] = '\u98DF';
  33568. t['\u2FB8'] = '\u9996';
  33569. t['\u2FB9'] = '\u9999';
  33570. t['\u2FBA'] = '\u99AC';
  33571. t['\u2FBB'] = '\u9AA8';
  33572. t['\u2FBC'] = '\u9AD8';
  33573. t['\u2FBD'] = '\u9ADF';
  33574. t['\u2FBE'] = '\u9B25';
  33575. t['\u2FBF'] = '\u9B2F';
  33576. t['\u2FC0'] = '\u9B32';
  33577. t['\u2FC1'] = '\u9B3C';
  33578. t['\u2FC2'] = '\u9B5A';
  33579. t['\u2FC3'] = '\u9CE5';
  33580. t['\u2FC4'] = '\u9E75';
  33581. t['\u2FC5'] = '\u9E7F';
  33582. t['\u2FC6'] = '\u9EA5';
  33583. t['\u2FC7'] = '\u9EBB';
  33584. t['\u2FC8'] = '\u9EC3';
  33585. t['\u2FC9'] = '\u9ECD';
  33586. t['\u2FCA'] = '\u9ED1';
  33587. t['\u2FCB'] = '\u9EF9';
  33588. t['\u2FCC'] = '\u9EFD';
  33589. t['\u2FCD'] = '\u9F0E';
  33590. t['\u2FCE'] = '\u9F13';
  33591. t['\u2FCF'] = '\u9F20';
  33592. t['\u2FD0'] = '\u9F3B';
  33593. t['\u2FD1'] = '\u9F4A';
  33594. t['\u2FD2'] = '\u9F52';
  33595. t['\u2FD3'] = '\u9F8D';
  33596. t['\u2FD4'] = '\u9F9C';
  33597. t['\u2FD5'] = '\u9FA0';
  33598. t['\u3036'] = '\u3012';
  33599. t['\u3038'] = '\u5341';
  33600. t['\u3039'] = '\u5344';
  33601. t['\u303A'] = '\u5345';
  33602. t['\u309B'] = '\u0020\u3099';
  33603. t['\u309C'] = '\u0020\u309A';
  33604. t['\u3131'] = '\u1100';
  33605. t['\u3132'] = '\u1101';
  33606. t['\u3133'] = '\u11AA';
  33607. t['\u3134'] = '\u1102';
  33608. t['\u3135'] = '\u11AC';
  33609. t['\u3136'] = '\u11AD';
  33610. t['\u3137'] = '\u1103';
  33611. t['\u3138'] = '\u1104';
  33612. t['\u3139'] = '\u1105';
  33613. t['\u313A'] = '\u11B0';
  33614. t['\u313B'] = '\u11B1';
  33615. t['\u313C'] = '\u11B2';
  33616. t['\u313D'] = '\u11B3';
  33617. t['\u313E'] = '\u11B4';
  33618. t['\u313F'] = '\u11B5';
  33619. t['\u3140'] = '\u111A';
  33620. t['\u3141'] = '\u1106';
  33621. t['\u3142'] = '\u1107';
  33622. t['\u3143'] = '\u1108';
  33623. t['\u3144'] = '\u1121';
  33624. t['\u3145'] = '\u1109';
  33625. t['\u3146'] = '\u110A';
  33626. t['\u3147'] = '\u110B';
  33627. t['\u3148'] = '\u110C';
  33628. t['\u3149'] = '\u110D';
  33629. t['\u314A'] = '\u110E';
  33630. t['\u314B'] = '\u110F';
  33631. t['\u314C'] = '\u1110';
  33632. t['\u314D'] = '\u1111';
  33633. t['\u314E'] = '\u1112';
  33634. t['\u314F'] = '\u1161';
  33635. t['\u3150'] = '\u1162';
  33636. t['\u3151'] = '\u1163';
  33637. t['\u3152'] = '\u1164';
  33638. t['\u3153'] = '\u1165';
  33639. t['\u3154'] = '\u1166';
  33640. t['\u3155'] = '\u1167';
  33641. t['\u3156'] = '\u1168';
  33642. t['\u3157'] = '\u1169';
  33643. t['\u3158'] = '\u116A';
  33644. t['\u3159'] = '\u116B';
  33645. t['\u315A'] = '\u116C';
  33646. t['\u315B'] = '\u116D';
  33647. t['\u315C'] = '\u116E';
  33648. t['\u315D'] = '\u116F';
  33649. t['\u315E'] = '\u1170';
  33650. t['\u315F'] = '\u1171';
  33651. t['\u3160'] = '\u1172';
  33652. t['\u3161'] = '\u1173';
  33653. t['\u3162'] = '\u1174';
  33654. t['\u3163'] = '\u1175';
  33655. t['\u3164'] = '\u1160';
  33656. t['\u3165'] = '\u1114';
  33657. t['\u3166'] = '\u1115';
  33658. t['\u3167'] = '\u11C7';
  33659. t['\u3168'] = '\u11C8';
  33660. t['\u3169'] = '\u11CC';
  33661. t['\u316A'] = '\u11CE';
  33662. t['\u316B'] = '\u11D3';
  33663. t['\u316C'] = '\u11D7';
  33664. t['\u316D'] = '\u11D9';
  33665. t['\u316E'] = '\u111C';
  33666. t['\u316F'] = '\u11DD';
  33667. t['\u3170'] = '\u11DF';
  33668. t['\u3171'] = '\u111D';
  33669. t['\u3172'] = '\u111E';
  33670. t['\u3173'] = '\u1120';
  33671. t['\u3174'] = '\u1122';
  33672. t['\u3175'] = '\u1123';
  33673. t['\u3176'] = '\u1127';
  33674. t['\u3177'] = '\u1129';
  33675. t['\u3178'] = '\u112B';
  33676. t['\u3179'] = '\u112C';
  33677. t['\u317A'] = '\u112D';
  33678. t['\u317B'] = '\u112E';
  33679. t['\u317C'] = '\u112F';
  33680. t['\u317D'] = '\u1132';
  33681. t['\u317E'] = '\u1136';
  33682. t['\u317F'] = '\u1140';
  33683. t['\u3180'] = '\u1147';
  33684. t['\u3181'] = '\u114C';
  33685. t['\u3182'] = '\u11F1';
  33686. t['\u3183'] = '\u11F2';
  33687. t['\u3184'] = '\u1157';
  33688. t['\u3185'] = '\u1158';
  33689. t['\u3186'] = '\u1159';
  33690. t['\u3187'] = '\u1184';
  33691. t['\u3188'] = '\u1185';
  33692. t['\u3189'] = '\u1188';
  33693. t['\u318A'] = '\u1191';
  33694. t['\u318B'] = '\u1192';
  33695. t['\u318C'] = '\u1194';
  33696. t['\u318D'] = '\u119E';
  33697. t['\u318E'] = '\u11A1';
  33698. t['\u3200'] = '\u0028\u1100\u0029';
  33699. t['\u3201'] = '\u0028\u1102\u0029';
  33700. t['\u3202'] = '\u0028\u1103\u0029';
  33701. t['\u3203'] = '\u0028\u1105\u0029';
  33702. t['\u3204'] = '\u0028\u1106\u0029';
  33703. t['\u3205'] = '\u0028\u1107\u0029';
  33704. t['\u3206'] = '\u0028\u1109\u0029';
  33705. t['\u3207'] = '\u0028\u110B\u0029';
  33706. t['\u3208'] = '\u0028\u110C\u0029';
  33707. t['\u3209'] = '\u0028\u110E\u0029';
  33708. t['\u320A'] = '\u0028\u110F\u0029';
  33709. t['\u320B'] = '\u0028\u1110\u0029';
  33710. t['\u320C'] = '\u0028\u1111\u0029';
  33711. t['\u320D'] = '\u0028\u1112\u0029';
  33712. t['\u320E'] = '\u0028\u1100\u1161\u0029';
  33713. t['\u320F'] = '\u0028\u1102\u1161\u0029';
  33714. t['\u3210'] = '\u0028\u1103\u1161\u0029';
  33715. t['\u3211'] = '\u0028\u1105\u1161\u0029';
  33716. t['\u3212'] = '\u0028\u1106\u1161\u0029';
  33717. t['\u3213'] = '\u0028\u1107\u1161\u0029';
  33718. t['\u3214'] = '\u0028\u1109\u1161\u0029';
  33719. t['\u3215'] = '\u0028\u110B\u1161\u0029';
  33720. t['\u3216'] = '\u0028\u110C\u1161\u0029';
  33721. t['\u3217'] = '\u0028\u110E\u1161\u0029';
  33722. t['\u3218'] = '\u0028\u110F\u1161\u0029';
  33723. t['\u3219'] = '\u0028\u1110\u1161\u0029';
  33724. t['\u321A'] = '\u0028\u1111\u1161\u0029';
  33725. t['\u321B'] = '\u0028\u1112\u1161\u0029';
  33726. t['\u321C'] = '\u0028\u110C\u116E\u0029';
  33727. t['\u321D'] = '\u0028\u110B\u1169\u110C\u1165\u11AB\u0029';
  33728. t['\u321E'] = '\u0028\u110B\u1169\u1112\u116E\u0029';
  33729. t['\u3220'] = '\u0028\u4E00\u0029';
  33730. t['\u3221'] = '\u0028\u4E8C\u0029';
  33731. t['\u3222'] = '\u0028\u4E09\u0029';
  33732. t['\u3223'] = '\u0028\u56DB\u0029';
  33733. t['\u3224'] = '\u0028\u4E94\u0029';
  33734. t['\u3225'] = '\u0028\u516D\u0029';
  33735. t['\u3226'] = '\u0028\u4E03\u0029';
  33736. t['\u3227'] = '\u0028\u516B\u0029';
  33737. t['\u3228'] = '\u0028\u4E5D\u0029';
  33738. t['\u3229'] = '\u0028\u5341\u0029';
  33739. t['\u322A'] = '\u0028\u6708\u0029';
  33740. t['\u322B'] = '\u0028\u706B\u0029';
  33741. t['\u322C'] = '\u0028\u6C34\u0029';
  33742. t['\u322D'] = '\u0028\u6728\u0029';
  33743. t['\u322E'] = '\u0028\u91D1\u0029';
  33744. t['\u322F'] = '\u0028\u571F\u0029';
  33745. t['\u3230'] = '\u0028\u65E5\u0029';
  33746. t['\u3231'] = '\u0028\u682A\u0029';
  33747. t['\u3232'] = '\u0028\u6709\u0029';
  33748. t['\u3233'] = '\u0028\u793E\u0029';
  33749. t['\u3234'] = '\u0028\u540D\u0029';
  33750. t['\u3235'] = '\u0028\u7279\u0029';
  33751. t['\u3236'] = '\u0028\u8CA1\u0029';
  33752. t['\u3237'] = '\u0028\u795D\u0029';
  33753. t['\u3238'] = '\u0028\u52B4\u0029';
  33754. t['\u3239'] = '\u0028\u4EE3\u0029';
  33755. t['\u323A'] = '\u0028\u547C\u0029';
  33756. t['\u323B'] = '\u0028\u5B66\u0029';
  33757. t['\u323C'] = '\u0028\u76E3\u0029';
  33758. t['\u323D'] = '\u0028\u4F01\u0029';
  33759. t['\u323E'] = '\u0028\u8CC7\u0029';
  33760. t['\u323F'] = '\u0028\u5354\u0029';
  33761. t['\u3240'] = '\u0028\u796D\u0029';
  33762. t['\u3241'] = '\u0028\u4F11\u0029';
  33763. t['\u3242'] = '\u0028\u81EA\u0029';
  33764. t['\u3243'] = '\u0028\u81F3\u0029';
  33765. t['\u32C0'] = '\u0031\u6708';
  33766. t['\u32C1'] = '\u0032\u6708';
  33767. t['\u32C2'] = '\u0033\u6708';
  33768. t['\u32C3'] = '\u0034\u6708';
  33769. t['\u32C4'] = '\u0035\u6708';
  33770. t['\u32C5'] = '\u0036\u6708';
  33771. t['\u32C6'] = '\u0037\u6708';
  33772. t['\u32C7'] = '\u0038\u6708';
  33773. t['\u32C8'] = '\u0039\u6708';
  33774. t['\u32C9'] = '\u0031\u0030\u6708';
  33775. t['\u32CA'] = '\u0031\u0031\u6708';
  33776. t['\u32CB'] = '\u0031\u0032\u6708';
  33777. t['\u3358'] = '\u0030\u70B9';
  33778. t['\u3359'] = '\u0031\u70B9';
  33779. t['\u335A'] = '\u0032\u70B9';
  33780. t['\u335B'] = '\u0033\u70B9';
  33781. t['\u335C'] = '\u0034\u70B9';
  33782. t['\u335D'] = '\u0035\u70B9';
  33783. t['\u335E'] = '\u0036\u70B9';
  33784. t['\u335F'] = '\u0037\u70B9';
  33785. t['\u3360'] = '\u0038\u70B9';
  33786. t['\u3361'] = '\u0039\u70B9';
  33787. t['\u3362'] = '\u0031\u0030\u70B9';
  33788. t['\u3363'] = '\u0031\u0031\u70B9';
  33789. t['\u3364'] = '\u0031\u0032\u70B9';
  33790. t['\u3365'] = '\u0031\u0033\u70B9';
  33791. t['\u3366'] = '\u0031\u0034\u70B9';
  33792. t['\u3367'] = '\u0031\u0035\u70B9';
  33793. t['\u3368'] = '\u0031\u0036\u70B9';
  33794. t['\u3369'] = '\u0031\u0037\u70B9';
  33795. t['\u336A'] = '\u0031\u0038\u70B9';
  33796. t['\u336B'] = '\u0031\u0039\u70B9';
  33797. t['\u336C'] = '\u0032\u0030\u70B9';
  33798. t['\u336D'] = '\u0032\u0031\u70B9';
  33799. t['\u336E'] = '\u0032\u0032\u70B9';
  33800. t['\u336F'] = '\u0032\u0033\u70B9';
  33801. t['\u3370'] = '\u0032\u0034\u70B9';
  33802. t['\u33E0'] = '\u0031\u65E5';
  33803. t['\u33E1'] = '\u0032\u65E5';
  33804. t['\u33E2'] = '\u0033\u65E5';
  33805. t['\u33E3'] = '\u0034\u65E5';
  33806. t['\u33E4'] = '\u0035\u65E5';
  33807. t['\u33E5'] = '\u0036\u65E5';
  33808. t['\u33E6'] = '\u0037\u65E5';
  33809. t['\u33E7'] = '\u0038\u65E5';
  33810. t['\u33E8'] = '\u0039\u65E5';
  33811. t['\u33E9'] = '\u0031\u0030\u65E5';
  33812. t['\u33EA'] = '\u0031\u0031\u65E5';
  33813. t['\u33EB'] = '\u0031\u0032\u65E5';
  33814. t['\u33EC'] = '\u0031\u0033\u65E5';
  33815. t['\u33ED'] = '\u0031\u0034\u65E5';
  33816. t['\u33EE'] = '\u0031\u0035\u65E5';
  33817. t['\u33EF'] = '\u0031\u0036\u65E5';
  33818. t['\u33F0'] = '\u0031\u0037\u65E5';
  33819. t['\u33F1'] = '\u0031\u0038\u65E5';
  33820. t['\u33F2'] = '\u0031\u0039\u65E5';
  33821. t['\u33F3'] = '\u0032\u0030\u65E5';
  33822. t['\u33F4'] = '\u0032\u0031\u65E5';
  33823. t['\u33F5'] = '\u0032\u0032\u65E5';
  33824. t['\u33F6'] = '\u0032\u0033\u65E5';
  33825. t['\u33F7'] = '\u0032\u0034\u65E5';
  33826. t['\u33F8'] = '\u0032\u0035\u65E5';
  33827. t['\u33F9'] = '\u0032\u0036\u65E5';
  33828. t['\u33FA'] = '\u0032\u0037\u65E5';
  33829. t['\u33FB'] = '\u0032\u0038\u65E5';
  33830. t['\u33FC'] = '\u0032\u0039\u65E5';
  33831. t['\u33FD'] = '\u0033\u0030\u65E5';
  33832. t['\u33FE'] = '\u0033\u0031\u65E5';
  33833. t['\uFB00'] = '\u0066\u0066';
  33834. t['\uFB01'] = '\u0066\u0069';
  33835. t['\uFB02'] = '\u0066\u006C';
  33836. t['\uFB03'] = '\u0066\u0066\u0069';
  33837. t['\uFB04'] = '\u0066\u0066\u006C';
  33838. t['\uFB05'] = '\u017F\u0074';
  33839. t['\uFB06'] = '\u0073\u0074';
  33840. t['\uFB13'] = '\u0574\u0576';
  33841. t['\uFB14'] = '\u0574\u0565';
  33842. t['\uFB15'] = '\u0574\u056B';
  33843. t['\uFB16'] = '\u057E\u0576';
  33844. t['\uFB17'] = '\u0574\u056D';
  33845. t['\uFB4F'] = '\u05D0\u05DC';
  33846. t['\uFB50'] = '\u0671';
  33847. t['\uFB51'] = '\u0671';
  33848. t['\uFB52'] = '\u067B';
  33849. t['\uFB53'] = '\u067B';
  33850. t['\uFB54'] = '\u067B';
  33851. t['\uFB55'] = '\u067B';
  33852. t['\uFB56'] = '\u067E';
  33853. t['\uFB57'] = '\u067E';
  33854. t['\uFB58'] = '\u067E';
  33855. t['\uFB59'] = '\u067E';
  33856. t['\uFB5A'] = '\u0680';
  33857. t['\uFB5B'] = '\u0680';
  33858. t['\uFB5C'] = '\u0680';
  33859. t['\uFB5D'] = '\u0680';
  33860. t['\uFB5E'] = '\u067A';
  33861. t['\uFB5F'] = '\u067A';
  33862. t['\uFB60'] = '\u067A';
  33863. t['\uFB61'] = '\u067A';
  33864. t['\uFB62'] = '\u067F';
  33865. t['\uFB63'] = '\u067F';
  33866. t['\uFB64'] = '\u067F';
  33867. t['\uFB65'] = '\u067F';
  33868. t['\uFB66'] = '\u0679';
  33869. t['\uFB67'] = '\u0679';
  33870. t['\uFB68'] = '\u0679';
  33871. t['\uFB69'] = '\u0679';
  33872. t['\uFB6A'] = '\u06A4';
  33873. t['\uFB6B'] = '\u06A4';
  33874. t['\uFB6C'] = '\u06A4';
  33875. t['\uFB6D'] = '\u06A4';
  33876. t['\uFB6E'] = '\u06A6';
  33877. t['\uFB6F'] = '\u06A6';
  33878. t['\uFB70'] = '\u06A6';
  33879. t['\uFB71'] = '\u06A6';
  33880. t['\uFB72'] = '\u0684';
  33881. t['\uFB73'] = '\u0684';
  33882. t['\uFB74'] = '\u0684';
  33883. t['\uFB75'] = '\u0684';
  33884. t['\uFB76'] = '\u0683';
  33885. t['\uFB77'] = '\u0683';
  33886. t['\uFB78'] = '\u0683';
  33887. t['\uFB79'] = '\u0683';
  33888. t['\uFB7A'] = '\u0686';
  33889. t['\uFB7B'] = '\u0686';
  33890. t['\uFB7C'] = '\u0686';
  33891. t['\uFB7D'] = '\u0686';
  33892. t['\uFB7E'] = '\u0687';
  33893. t['\uFB7F'] = '\u0687';
  33894. t['\uFB80'] = '\u0687';
  33895. t['\uFB81'] = '\u0687';
  33896. t['\uFB82'] = '\u068D';
  33897. t['\uFB83'] = '\u068D';
  33898. t['\uFB84'] = '\u068C';
  33899. t['\uFB85'] = '\u068C';
  33900. t['\uFB86'] = '\u068E';
  33901. t['\uFB87'] = '\u068E';
  33902. t['\uFB88'] = '\u0688';
  33903. t['\uFB89'] = '\u0688';
  33904. t['\uFB8A'] = '\u0698';
  33905. t['\uFB8B'] = '\u0698';
  33906. t['\uFB8C'] = '\u0691';
  33907. t['\uFB8D'] = '\u0691';
  33908. t['\uFB8E'] = '\u06A9';
  33909. t['\uFB8F'] = '\u06A9';
  33910. t['\uFB90'] = '\u06A9';
  33911. t['\uFB91'] = '\u06A9';
  33912. t['\uFB92'] = '\u06AF';
  33913. t['\uFB93'] = '\u06AF';
  33914. t['\uFB94'] = '\u06AF';
  33915. t['\uFB95'] = '\u06AF';
  33916. t['\uFB96'] = '\u06B3';
  33917. t['\uFB97'] = '\u06B3';
  33918. t['\uFB98'] = '\u06B3';
  33919. t['\uFB99'] = '\u06B3';
  33920. t['\uFB9A'] = '\u06B1';
  33921. t['\uFB9B'] = '\u06B1';
  33922. t['\uFB9C'] = '\u06B1';
  33923. t['\uFB9D'] = '\u06B1';
  33924. t['\uFB9E'] = '\u06BA';
  33925. t['\uFB9F'] = '\u06BA';
  33926. t['\uFBA0'] = '\u06BB';
  33927. t['\uFBA1'] = '\u06BB';
  33928. t['\uFBA2'] = '\u06BB';
  33929. t['\uFBA3'] = '\u06BB';
  33930. t['\uFBA4'] = '\u06C0';
  33931. t['\uFBA5'] = '\u06C0';
  33932. t['\uFBA6'] = '\u06C1';
  33933. t['\uFBA7'] = '\u06C1';
  33934. t['\uFBA8'] = '\u06C1';
  33935. t['\uFBA9'] = '\u06C1';
  33936. t['\uFBAA'] = '\u06BE';
  33937. t['\uFBAB'] = '\u06BE';
  33938. t['\uFBAC'] = '\u06BE';
  33939. t['\uFBAD'] = '\u06BE';
  33940. t['\uFBAE'] = '\u06D2';
  33941. t['\uFBAF'] = '\u06D2';
  33942. t['\uFBB0'] = '\u06D3';
  33943. t['\uFBB1'] = '\u06D3';
  33944. t['\uFBD3'] = '\u06AD';
  33945. t['\uFBD4'] = '\u06AD';
  33946. t['\uFBD5'] = '\u06AD';
  33947. t['\uFBD6'] = '\u06AD';
  33948. t['\uFBD7'] = '\u06C7';
  33949. t['\uFBD8'] = '\u06C7';
  33950. t['\uFBD9'] = '\u06C6';
  33951. t['\uFBDA'] = '\u06C6';
  33952. t['\uFBDB'] = '\u06C8';
  33953. t['\uFBDC'] = '\u06C8';
  33954. t['\uFBDD'] = '\u0677';
  33955. t['\uFBDE'] = '\u06CB';
  33956. t['\uFBDF'] = '\u06CB';
  33957. t['\uFBE0'] = '\u06C5';
  33958. t['\uFBE1'] = '\u06C5';
  33959. t['\uFBE2'] = '\u06C9';
  33960. t['\uFBE3'] = '\u06C9';
  33961. t['\uFBE4'] = '\u06D0';
  33962. t['\uFBE5'] = '\u06D0';
  33963. t['\uFBE6'] = '\u06D0';
  33964. t['\uFBE7'] = '\u06D0';
  33965. t['\uFBE8'] = '\u0649';
  33966. t['\uFBE9'] = '\u0649';
  33967. t['\uFBEA'] = '\u0626\u0627';
  33968. t['\uFBEB'] = '\u0626\u0627';
  33969. t['\uFBEC'] = '\u0626\u06D5';
  33970. t['\uFBED'] = '\u0626\u06D5';
  33971. t['\uFBEE'] = '\u0626\u0648';
  33972. t['\uFBEF'] = '\u0626\u0648';
  33973. t['\uFBF0'] = '\u0626\u06C7';
  33974. t['\uFBF1'] = '\u0626\u06C7';
  33975. t['\uFBF2'] = '\u0626\u06C6';
  33976. t['\uFBF3'] = '\u0626\u06C6';
  33977. t['\uFBF4'] = '\u0626\u06C8';
  33978. t['\uFBF5'] = '\u0626\u06C8';
  33979. t['\uFBF6'] = '\u0626\u06D0';
  33980. t['\uFBF7'] = '\u0626\u06D0';
  33981. t['\uFBF8'] = '\u0626\u06D0';
  33982. t['\uFBF9'] = '\u0626\u0649';
  33983. t['\uFBFA'] = '\u0626\u0649';
  33984. t['\uFBFB'] = '\u0626\u0649';
  33985. t['\uFBFC'] = '\u06CC';
  33986. t['\uFBFD'] = '\u06CC';
  33987. t['\uFBFE'] = '\u06CC';
  33988. t['\uFBFF'] = '\u06CC';
  33989. t['\uFC00'] = '\u0626\u062C';
  33990. t['\uFC01'] = '\u0626\u062D';
  33991. t['\uFC02'] = '\u0626\u0645';
  33992. t['\uFC03'] = '\u0626\u0649';
  33993. t['\uFC04'] = '\u0626\u064A';
  33994. t['\uFC05'] = '\u0628\u062C';
  33995. t['\uFC06'] = '\u0628\u062D';
  33996. t['\uFC07'] = '\u0628\u062E';
  33997. t['\uFC08'] = '\u0628\u0645';
  33998. t['\uFC09'] = '\u0628\u0649';
  33999. t['\uFC0A'] = '\u0628\u064A';
  34000. t['\uFC0B'] = '\u062A\u062C';
  34001. t['\uFC0C'] = '\u062A\u062D';
  34002. t['\uFC0D'] = '\u062A\u062E';
  34003. t['\uFC0E'] = '\u062A\u0645';
  34004. t['\uFC0F'] = '\u062A\u0649';
  34005. t['\uFC10'] = '\u062A\u064A';
  34006. t['\uFC11'] = '\u062B\u062C';
  34007. t['\uFC12'] = '\u062B\u0645';
  34008. t['\uFC13'] = '\u062B\u0649';
  34009. t['\uFC14'] = '\u062B\u064A';
  34010. t['\uFC15'] = '\u062C\u062D';
  34011. t['\uFC16'] = '\u062C\u0645';
  34012. t['\uFC17'] = '\u062D\u062C';
  34013. t['\uFC18'] = '\u062D\u0645';
  34014. t['\uFC19'] = '\u062E\u062C';
  34015. t['\uFC1A'] = '\u062E\u062D';
  34016. t['\uFC1B'] = '\u062E\u0645';
  34017. t['\uFC1C'] = '\u0633\u062C';
  34018. t['\uFC1D'] = '\u0633\u062D';
  34019. t['\uFC1E'] = '\u0633\u062E';
  34020. t['\uFC1F'] = '\u0633\u0645';
  34021. t['\uFC20'] = '\u0635\u062D';
  34022. t['\uFC21'] = '\u0635\u0645';
  34023. t['\uFC22'] = '\u0636\u062C';
  34024. t['\uFC23'] = '\u0636\u062D';
  34025. t['\uFC24'] = '\u0636\u062E';
  34026. t['\uFC25'] = '\u0636\u0645';
  34027. t['\uFC26'] = '\u0637\u062D';
  34028. t['\uFC27'] = '\u0637\u0645';
  34029. t['\uFC28'] = '\u0638\u0645';
  34030. t['\uFC29'] = '\u0639\u062C';
  34031. t['\uFC2A'] = '\u0639\u0645';
  34032. t['\uFC2B'] = '\u063A\u062C';
  34033. t['\uFC2C'] = '\u063A\u0645';
  34034. t['\uFC2D'] = '\u0641\u062C';
  34035. t['\uFC2E'] = '\u0641\u062D';
  34036. t['\uFC2F'] = '\u0641\u062E';
  34037. t['\uFC30'] = '\u0641\u0645';
  34038. t['\uFC31'] = '\u0641\u0649';
  34039. t['\uFC32'] = '\u0641\u064A';
  34040. t['\uFC33'] = '\u0642\u062D';
  34041. t['\uFC34'] = '\u0642\u0645';
  34042. t['\uFC35'] = '\u0642\u0649';
  34043. t['\uFC36'] = '\u0642\u064A';
  34044. t['\uFC37'] = '\u0643\u0627';
  34045. t['\uFC38'] = '\u0643\u062C';
  34046. t['\uFC39'] = '\u0643\u062D';
  34047. t['\uFC3A'] = '\u0643\u062E';
  34048. t['\uFC3B'] = '\u0643\u0644';
  34049. t['\uFC3C'] = '\u0643\u0645';
  34050. t['\uFC3D'] = '\u0643\u0649';
  34051. t['\uFC3E'] = '\u0643\u064A';
  34052. t['\uFC3F'] = '\u0644\u062C';
  34053. t['\uFC40'] = '\u0644\u062D';
  34054. t['\uFC41'] = '\u0644\u062E';
  34055. t['\uFC42'] = '\u0644\u0645';
  34056. t['\uFC43'] = '\u0644\u0649';
  34057. t['\uFC44'] = '\u0644\u064A';
  34058. t['\uFC45'] = '\u0645\u062C';
  34059. t['\uFC46'] = '\u0645\u062D';
  34060. t['\uFC47'] = '\u0645\u062E';
  34061. t['\uFC48'] = '\u0645\u0645';
  34062. t['\uFC49'] = '\u0645\u0649';
  34063. t['\uFC4A'] = '\u0645\u064A';
  34064. t['\uFC4B'] = '\u0646\u062C';
  34065. t['\uFC4C'] = '\u0646\u062D';
  34066. t['\uFC4D'] = '\u0646\u062E';
  34067. t['\uFC4E'] = '\u0646\u0645';
  34068. t['\uFC4F'] = '\u0646\u0649';
  34069. t['\uFC50'] = '\u0646\u064A';
  34070. t['\uFC51'] = '\u0647\u062C';
  34071. t['\uFC52'] = '\u0647\u0645';
  34072. t['\uFC53'] = '\u0647\u0649';
  34073. t['\uFC54'] = '\u0647\u064A';
  34074. t['\uFC55'] = '\u064A\u062C';
  34075. t['\uFC56'] = '\u064A\u062D';
  34076. t['\uFC57'] = '\u064A\u062E';
  34077. t['\uFC58'] = '\u064A\u0645';
  34078. t['\uFC59'] = '\u064A\u0649';
  34079. t['\uFC5A'] = '\u064A\u064A';
  34080. t['\uFC5B'] = '\u0630\u0670';
  34081. t['\uFC5C'] = '\u0631\u0670';
  34082. t['\uFC5D'] = '\u0649\u0670';
  34083. t['\uFC5E'] = '\u0020\u064C\u0651';
  34084. t['\uFC5F'] = '\u0020\u064D\u0651';
  34085. t['\uFC60'] = '\u0020\u064E\u0651';
  34086. t['\uFC61'] = '\u0020\u064F\u0651';
  34087. t['\uFC62'] = '\u0020\u0650\u0651';
  34088. t['\uFC63'] = '\u0020\u0651\u0670';
  34089. t['\uFC64'] = '\u0626\u0631';
  34090. t['\uFC65'] = '\u0626\u0632';
  34091. t['\uFC66'] = '\u0626\u0645';
  34092. t['\uFC67'] = '\u0626\u0646';
  34093. t['\uFC68'] = '\u0626\u0649';
  34094. t['\uFC69'] = '\u0626\u064A';
  34095. t['\uFC6A'] = '\u0628\u0631';
  34096. t['\uFC6B'] = '\u0628\u0632';
  34097. t['\uFC6C'] = '\u0628\u0645';
  34098. t['\uFC6D'] = '\u0628\u0646';
  34099. t['\uFC6E'] = '\u0628\u0649';
  34100. t['\uFC6F'] = '\u0628\u064A';
  34101. t['\uFC70'] = '\u062A\u0631';
  34102. t['\uFC71'] = '\u062A\u0632';
  34103. t['\uFC72'] = '\u062A\u0645';
  34104. t['\uFC73'] = '\u062A\u0646';
  34105. t['\uFC74'] = '\u062A\u0649';
  34106. t['\uFC75'] = '\u062A\u064A';
  34107. t['\uFC76'] = '\u062B\u0631';
  34108. t['\uFC77'] = '\u062B\u0632';
  34109. t['\uFC78'] = '\u062B\u0645';
  34110. t['\uFC79'] = '\u062B\u0646';
  34111. t['\uFC7A'] = '\u062B\u0649';
  34112. t['\uFC7B'] = '\u062B\u064A';
  34113. t['\uFC7C'] = '\u0641\u0649';
  34114. t['\uFC7D'] = '\u0641\u064A';
  34115. t['\uFC7E'] = '\u0642\u0649';
  34116. t['\uFC7F'] = '\u0642\u064A';
  34117. t['\uFC80'] = '\u0643\u0627';
  34118. t['\uFC81'] = '\u0643\u0644';
  34119. t['\uFC82'] = '\u0643\u0645';
  34120. t['\uFC83'] = '\u0643\u0649';
  34121. t['\uFC84'] = '\u0643\u064A';
  34122. t['\uFC85'] = '\u0644\u0645';
  34123. t['\uFC86'] = '\u0644\u0649';
  34124. t['\uFC87'] = '\u0644\u064A';
  34125. t['\uFC88'] = '\u0645\u0627';
  34126. t['\uFC89'] = '\u0645\u0645';
  34127. t['\uFC8A'] = '\u0646\u0631';
  34128. t['\uFC8B'] = '\u0646\u0632';
  34129. t['\uFC8C'] = '\u0646\u0645';
  34130. t['\uFC8D'] = '\u0646\u0646';
  34131. t['\uFC8E'] = '\u0646\u0649';
  34132. t['\uFC8F'] = '\u0646\u064A';
  34133. t['\uFC90'] = '\u0649\u0670';
  34134. t['\uFC91'] = '\u064A\u0631';
  34135. t['\uFC92'] = '\u064A\u0632';
  34136. t['\uFC93'] = '\u064A\u0645';
  34137. t['\uFC94'] = '\u064A\u0646';
  34138. t['\uFC95'] = '\u064A\u0649';
  34139. t['\uFC96'] = '\u064A\u064A';
  34140. t['\uFC97'] = '\u0626\u062C';
  34141. t['\uFC98'] = '\u0626\u062D';
  34142. t['\uFC99'] = '\u0626\u062E';
  34143. t['\uFC9A'] = '\u0626\u0645';
  34144. t['\uFC9B'] = '\u0626\u0647';
  34145. t['\uFC9C'] = '\u0628\u062C';
  34146. t['\uFC9D'] = '\u0628\u062D';
  34147. t['\uFC9E'] = '\u0628\u062E';
  34148. t['\uFC9F'] = '\u0628\u0645';
  34149. t['\uFCA0'] = '\u0628\u0647';
  34150. t['\uFCA1'] = '\u062A\u062C';
  34151. t['\uFCA2'] = '\u062A\u062D';
  34152. t['\uFCA3'] = '\u062A\u062E';
  34153. t['\uFCA4'] = '\u062A\u0645';
  34154. t['\uFCA5'] = '\u062A\u0647';
  34155. t['\uFCA6'] = '\u062B\u0645';
  34156. t['\uFCA7'] = '\u062C\u062D';
  34157. t['\uFCA8'] = '\u062C\u0645';
  34158. t['\uFCA9'] = '\u062D\u062C';
  34159. t['\uFCAA'] = '\u062D\u0645';
  34160. t['\uFCAB'] = '\u062E\u062C';
  34161. t['\uFCAC'] = '\u062E\u0645';
  34162. t['\uFCAD'] = '\u0633\u062C';
  34163. t['\uFCAE'] = '\u0633\u062D';
  34164. t['\uFCAF'] = '\u0633\u062E';
  34165. t['\uFCB0'] = '\u0633\u0645';
  34166. t['\uFCB1'] = '\u0635\u062D';
  34167. t['\uFCB2'] = '\u0635\u062E';
  34168. t['\uFCB3'] = '\u0635\u0645';
  34169. t['\uFCB4'] = '\u0636\u062C';
  34170. t['\uFCB5'] = '\u0636\u062D';
  34171. t['\uFCB6'] = '\u0636\u062E';
  34172. t['\uFCB7'] = '\u0636\u0645';
  34173. t['\uFCB8'] = '\u0637\u062D';
  34174. t['\uFCB9'] = '\u0638\u0645';
  34175. t['\uFCBA'] = '\u0639\u062C';
  34176. t['\uFCBB'] = '\u0639\u0645';
  34177. t['\uFCBC'] = '\u063A\u062C';
  34178. t['\uFCBD'] = '\u063A\u0645';
  34179. t['\uFCBE'] = '\u0641\u062C';
  34180. t['\uFCBF'] = '\u0641\u062D';
  34181. t['\uFCC0'] = '\u0641\u062E';
  34182. t['\uFCC1'] = '\u0641\u0645';
  34183. t['\uFCC2'] = '\u0642\u062D';
  34184. t['\uFCC3'] = '\u0642\u0645';
  34185. t['\uFCC4'] = '\u0643\u062C';
  34186. t['\uFCC5'] = '\u0643\u062D';
  34187. t['\uFCC6'] = '\u0643\u062E';
  34188. t['\uFCC7'] = '\u0643\u0644';
  34189. t['\uFCC8'] = '\u0643\u0645';
  34190. t['\uFCC9'] = '\u0644\u062C';
  34191. t['\uFCCA'] = '\u0644\u062D';
  34192. t['\uFCCB'] = '\u0644\u062E';
  34193. t['\uFCCC'] = '\u0644\u0645';
  34194. t['\uFCCD'] = '\u0644\u0647';
  34195. t['\uFCCE'] = '\u0645\u062C';
  34196. t['\uFCCF'] = '\u0645\u062D';
  34197. t['\uFCD0'] = '\u0645\u062E';
  34198. t['\uFCD1'] = '\u0645\u0645';
  34199. t['\uFCD2'] = '\u0646\u062C';
  34200. t['\uFCD3'] = '\u0646\u062D';
  34201. t['\uFCD4'] = '\u0646\u062E';
  34202. t['\uFCD5'] = '\u0646\u0645';
  34203. t['\uFCD6'] = '\u0646\u0647';
  34204. t['\uFCD7'] = '\u0647\u062C';
  34205. t['\uFCD8'] = '\u0647\u0645';
  34206. t['\uFCD9'] = '\u0647\u0670';
  34207. t['\uFCDA'] = '\u064A\u062C';
  34208. t['\uFCDB'] = '\u064A\u062D';
  34209. t['\uFCDC'] = '\u064A\u062E';
  34210. t['\uFCDD'] = '\u064A\u0645';
  34211. t['\uFCDE'] = '\u064A\u0647';
  34212. t['\uFCDF'] = '\u0626\u0645';
  34213. t['\uFCE0'] = '\u0626\u0647';
  34214. t['\uFCE1'] = '\u0628\u0645';
  34215. t['\uFCE2'] = '\u0628\u0647';
  34216. t['\uFCE3'] = '\u062A\u0645';
  34217. t['\uFCE4'] = '\u062A\u0647';
  34218. t['\uFCE5'] = '\u062B\u0645';
  34219. t['\uFCE6'] = '\u062B\u0647';
  34220. t['\uFCE7'] = '\u0633\u0645';
  34221. t['\uFCE8'] = '\u0633\u0647';
  34222. t['\uFCE9'] = '\u0634\u0645';
  34223. t['\uFCEA'] = '\u0634\u0647';
  34224. t['\uFCEB'] = '\u0643\u0644';
  34225. t['\uFCEC'] = '\u0643\u0645';
  34226. t['\uFCED'] = '\u0644\u0645';
  34227. t['\uFCEE'] = '\u0646\u0645';
  34228. t['\uFCEF'] = '\u0646\u0647';
  34229. t['\uFCF0'] = '\u064A\u0645';
  34230. t['\uFCF1'] = '\u064A\u0647';
  34231. t['\uFCF2'] = '\u0640\u064E\u0651';
  34232. t['\uFCF3'] = '\u0640\u064F\u0651';
  34233. t['\uFCF4'] = '\u0640\u0650\u0651';
  34234. t['\uFCF5'] = '\u0637\u0649';
  34235. t['\uFCF6'] = '\u0637\u064A';
  34236. t['\uFCF7'] = '\u0639\u0649';
  34237. t['\uFCF8'] = '\u0639\u064A';
  34238. t['\uFCF9'] = '\u063A\u0649';
  34239. t['\uFCFA'] = '\u063A\u064A';
  34240. t['\uFCFB'] = '\u0633\u0649';
  34241. t['\uFCFC'] = '\u0633\u064A';
  34242. t['\uFCFD'] = '\u0634\u0649';
  34243. t['\uFCFE'] = '\u0634\u064A';
  34244. t['\uFCFF'] = '\u062D\u0649';
  34245. t['\uFD00'] = '\u062D\u064A';
  34246. t['\uFD01'] = '\u062C\u0649';
  34247. t['\uFD02'] = '\u062C\u064A';
  34248. t['\uFD03'] = '\u062E\u0649';
  34249. t['\uFD04'] = '\u062E\u064A';
  34250. t['\uFD05'] = '\u0635\u0649';
  34251. t['\uFD06'] = '\u0635\u064A';
  34252. t['\uFD07'] = '\u0636\u0649';
  34253. t['\uFD08'] = '\u0636\u064A';
  34254. t['\uFD09'] = '\u0634\u062C';
  34255. t['\uFD0A'] = '\u0634\u062D';
  34256. t['\uFD0B'] = '\u0634\u062E';
  34257. t['\uFD0C'] = '\u0634\u0645';
  34258. t['\uFD0D'] = '\u0634\u0631';
  34259. t['\uFD0E'] = '\u0633\u0631';
  34260. t['\uFD0F'] = '\u0635\u0631';
  34261. t['\uFD10'] = '\u0636\u0631';
  34262. t['\uFD11'] = '\u0637\u0649';
  34263. t['\uFD12'] = '\u0637\u064A';
  34264. t['\uFD13'] = '\u0639\u0649';
  34265. t['\uFD14'] = '\u0639\u064A';
  34266. t['\uFD15'] = '\u063A\u0649';
  34267. t['\uFD16'] = '\u063A\u064A';
  34268. t['\uFD17'] = '\u0633\u0649';
  34269. t['\uFD18'] = '\u0633\u064A';
  34270. t['\uFD19'] = '\u0634\u0649';
  34271. t['\uFD1A'] = '\u0634\u064A';
  34272. t['\uFD1B'] = '\u062D\u0649';
  34273. t['\uFD1C'] = '\u062D\u064A';
  34274. t['\uFD1D'] = '\u062C\u0649';
  34275. t['\uFD1E'] = '\u062C\u064A';
  34276. t['\uFD1F'] = '\u062E\u0649';
  34277. t['\uFD20'] = '\u062E\u064A';
  34278. t['\uFD21'] = '\u0635\u0649';
  34279. t['\uFD22'] = '\u0635\u064A';
  34280. t['\uFD23'] = '\u0636\u0649';
  34281. t['\uFD24'] = '\u0636\u064A';
  34282. t['\uFD25'] = '\u0634\u062C';
  34283. t['\uFD26'] = '\u0634\u062D';
  34284. t['\uFD27'] = '\u0634\u062E';
  34285. t['\uFD28'] = '\u0634\u0645';
  34286. t['\uFD29'] = '\u0634\u0631';
  34287. t['\uFD2A'] = '\u0633\u0631';
  34288. t['\uFD2B'] = '\u0635\u0631';
  34289. t['\uFD2C'] = '\u0636\u0631';
  34290. t['\uFD2D'] = '\u0634\u062C';
  34291. t['\uFD2E'] = '\u0634\u062D';
  34292. t['\uFD2F'] = '\u0634\u062E';
  34293. t['\uFD30'] = '\u0634\u0645';
  34294. t['\uFD31'] = '\u0633\u0647';
  34295. t['\uFD32'] = '\u0634\u0647';
  34296. t['\uFD33'] = '\u0637\u0645';
  34297. t['\uFD34'] = '\u0633\u062C';
  34298. t['\uFD35'] = '\u0633\u062D';
  34299. t['\uFD36'] = '\u0633\u062E';
  34300. t['\uFD37'] = '\u0634\u062C';
  34301. t['\uFD38'] = '\u0634\u062D';
  34302. t['\uFD39'] = '\u0634\u062E';
  34303. t['\uFD3A'] = '\u0637\u0645';
  34304. t['\uFD3B'] = '\u0638\u0645';
  34305. t['\uFD3C'] = '\u0627\u064B';
  34306. t['\uFD3D'] = '\u0627\u064B';
  34307. t['\uFD50'] = '\u062A\u062C\u0645';
  34308. t['\uFD51'] = '\u062A\u062D\u062C';
  34309. t['\uFD52'] = '\u062A\u062D\u062C';
  34310. t['\uFD53'] = '\u062A\u062D\u0645';
  34311. t['\uFD54'] = '\u062A\u062E\u0645';
  34312. t['\uFD55'] = '\u062A\u0645\u062C';
  34313. t['\uFD56'] = '\u062A\u0645\u062D';
  34314. t['\uFD57'] = '\u062A\u0645\u062E';
  34315. t['\uFD58'] = '\u062C\u0645\u062D';
  34316. t['\uFD59'] = '\u062C\u0645\u062D';
  34317. t['\uFD5A'] = '\u062D\u0645\u064A';
  34318. t['\uFD5B'] = '\u062D\u0645\u0649';
  34319. t['\uFD5C'] = '\u0633\u062D\u062C';
  34320. t['\uFD5D'] = '\u0633\u062C\u062D';
  34321. t['\uFD5E'] = '\u0633\u062C\u0649';
  34322. t['\uFD5F'] = '\u0633\u0645\u062D';
  34323. t['\uFD60'] = '\u0633\u0645\u062D';
  34324. t['\uFD61'] = '\u0633\u0645\u062C';
  34325. t['\uFD62'] = '\u0633\u0645\u0645';
  34326. t['\uFD63'] = '\u0633\u0645\u0645';
  34327. t['\uFD64'] = '\u0635\u062D\u062D';
  34328. t['\uFD65'] = '\u0635\u062D\u062D';
  34329. t['\uFD66'] = '\u0635\u0645\u0645';
  34330. t['\uFD67'] = '\u0634\u062D\u0645';
  34331. t['\uFD68'] = '\u0634\u062D\u0645';
  34332. t['\uFD69'] = '\u0634\u062C\u064A';
  34333. t['\uFD6A'] = '\u0634\u0645\u062E';
  34334. t['\uFD6B'] = '\u0634\u0645\u062E';
  34335. t['\uFD6C'] = '\u0634\u0645\u0645';
  34336. t['\uFD6D'] = '\u0634\u0645\u0645';
  34337. t['\uFD6E'] = '\u0636\u062D\u0649';
  34338. t['\uFD6F'] = '\u0636\u062E\u0645';
  34339. t['\uFD70'] = '\u0636\u062E\u0645';
  34340. t['\uFD71'] = '\u0637\u0645\u062D';
  34341. t['\uFD72'] = '\u0637\u0645\u062D';
  34342. t['\uFD73'] = '\u0637\u0645\u0645';
  34343. t['\uFD74'] = '\u0637\u0645\u064A';
  34344. t['\uFD75'] = '\u0639\u062C\u0645';
  34345. t['\uFD76'] = '\u0639\u0645\u0645';
  34346. t['\uFD77'] = '\u0639\u0645\u0645';
  34347. t['\uFD78'] = '\u0639\u0645\u0649';
  34348. t['\uFD79'] = '\u063A\u0645\u0645';
  34349. t['\uFD7A'] = '\u063A\u0645\u064A';
  34350. t['\uFD7B'] = '\u063A\u0645\u0649';
  34351. t['\uFD7C'] = '\u0641\u062E\u0645';
  34352. t['\uFD7D'] = '\u0641\u062E\u0645';
  34353. t['\uFD7E'] = '\u0642\u0645\u062D';
  34354. t['\uFD7F'] = '\u0642\u0645\u0645';
  34355. t['\uFD80'] = '\u0644\u062D\u0645';
  34356. t['\uFD81'] = '\u0644\u062D\u064A';
  34357. t['\uFD82'] = '\u0644\u062D\u0649';
  34358. t['\uFD83'] = '\u0644\u062C\u062C';
  34359. t['\uFD84'] = '\u0644\u062C\u062C';
  34360. t['\uFD85'] = '\u0644\u062E\u0645';
  34361. t['\uFD86'] = '\u0644\u062E\u0645';
  34362. t['\uFD87'] = '\u0644\u0645\u062D';
  34363. t['\uFD88'] = '\u0644\u0645\u062D';
  34364. t['\uFD89'] = '\u0645\u062D\u062C';
  34365. t['\uFD8A'] = '\u0645\u062D\u0645';
  34366. t['\uFD8B'] = '\u0645\u062D\u064A';
  34367. t['\uFD8C'] = '\u0645\u062C\u062D';
  34368. t['\uFD8D'] = '\u0645\u062C\u0645';
  34369. t['\uFD8E'] = '\u0645\u062E\u062C';
  34370. t['\uFD8F'] = '\u0645\u062E\u0645';
  34371. t['\uFD92'] = '\u0645\u062C\u062E';
  34372. t['\uFD93'] = '\u0647\u0645\u062C';
  34373. t['\uFD94'] = '\u0647\u0645\u0645';
  34374. t['\uFD95'] = '\u0646\u062D\u0645';
  34375. t['\uFD96'] = '\u0646\u062D\u0649';
  34376. t['\uFD97'] = '\u0646\u062C\u0645';
  34377. t['\uFD98'] = '\u0646\u062C\u0645';
  34378. t['\uFD99'] = '\u0646\u062C\u0649';
  34379. t['\uFD9A'] = '\u0646\u0645\u064A';
  34380. t['\uFD9B'] = '\u0646\u0645\u0649';
  34381. t['\uFD9C'] = '\u064A\u0645\u0645';
  34382. t['\uFD9D'] = '\u064A\u0645\u0645';
  34383. t['\uFD9E'] = '\u0628\u062E\u064A';
  34384. t['\uFD9F'] = '\u062A\u062C\u064A';
  34385. t['\uFDA0'] = '\u062A\u062C\u0649';
  34386. t['\uFDA1'] = '\u062A\u062E\u064A';
  34387. t['\uFDA2'] = '\u062A\u062E\u0649';
  34388. t['\uFDA3'] = '\u062A\u0645\u064A';
  34389. t['\uFDA4'] = '\u062A\u0645\u0649';
  34390. t['\uFDA5'] = '\u062C\u0645\u064A';
  34391. t['\uFDA6'] = '\u062C\u062D\u0649';
  34392. t['\uFDA7'] = '\u062C\u0645\u0649';
  34393. t['\uFDA8'] = '\u0633\u062E\u0649';
  34394. t['\uFDA9'] = '\u0635\u062D\u064A';
  34395. t['\uFDAA'] = '\u0634\u062D\u064A';
  34396. t['\uFDAB'] = '\u0636\u062D\u064A';
  34397. t['\uFDAC'] = '\u0644\u062C\u064A';
  34398. t['\uFDAD'] = '\u0644\u0645\u064A';
  34399. t['\uFDAE'] = '\u064A\u062D\u064A';
  34400. t['\uFDAF'] = '\u064A\u062C\u064A';
  34401. t['\uFDB0'] = '\u064A\u0645\u064A';
  34402. t['\uFDB1'] = '\u0645\u0645\u064A';
  34403. t['\uFDB2'] = '\u0642\u0645\u064A';
  34404. t['\uFDB3'] = '\u0646\u062D\u064A';
  34405. t['\uFDB4'] = '\u0642\u0645\u062D';
  34406. t['\uFDB5'] = '\u0644\u062D\u0645';
  34407. t['\uFDB6'] = '\u0639\u0645\u064A';
  34408. t['\uFDB7'] = '\u0643\u0645\u064A';
  34409. t['\uFDB8'] = '\u0646\u062C\u062D';
  34410. t['\uFDB9'] = '\u0645\u062E\u064A';
  34411. t['\uFDBA'] = '\u0644\u062C\u0645';
  34412. t['\uFDBB'] = '\u0643\u0645\u0645';
  34413. t['\uFDBC'] = '\u0644\u062C\u0645';
  34414. t['\uFDBD'] = '\u0646\u062C\u062D';
  34415. t['\uFDBE'] = '\u062C\u062D\u064A';
  34416. t['\uFDBF'] = '\u062D\u062C\u064A';
  34417. t['\uFDC0'] = '\u0645\u062C\u064A';
  34418. t['\uFDC1'] = '\u0641\u0645\u064A';
  34419. t['\uFDC2'] = '\u0628\u062D\u064A';
  34420. t['\uFDC3'] = '\u0643\u0645\u0645';
  34421. t['\uFDC4'] = '\u0639\u062C\u0645';
  34422. t['\uFDC5'] = '\u0635\u0645\u0645';
  34423. t['\uFDC6'] = '\u0633\u062E\u064A';
  34424. t['\uFDC7'] = '\u0646\u062C\u064A';
  34425. t['\uFE49'] = '\u203E';
  34426. t['\uFE4A'] = '\u203E';
  34427. t['\uFE4B'] = '\u203E';
  34428. t['\uFE4C'] = '\u203E';
  34429. t['\uFE4D'] = '\u005F';
  34430. t['\uFE4E'] = '\u005F';
  34431. t['\uFE4F'] = '\u005F';
  34432. t['\uFE80'] = '\u0621';
  34433. t['\uFE81'] = '\u0622';
  34434. t['\uFE82'] = '\u0622';
  34435. t['\uFE83'] = '\u0623';
  34436. t['\uFE84'] = '\u0623';
  34437. t['\uFE85'] = '\u0624';
  34438. t['\uFE86'] = '\u0624';
  34439. t['\uFE87'] = '\u0625';
  34440. t['\uFE88'] = '\u0625';
  34441. t['\uFE89'] = '\u0626';
  34442. t['\uFE8A'] = '\u0626';
  34443. t['\uFE8B'] = '\u0626';
  34444. t['\uFE8C'] = '\u0626';
  34445. t['\uFE8D'] = '\u0627';
  34446. t['\uFE8E'] = '\u0627';
  34447. t['\uFE8F'] = '\u0628';
  34448. t['\uFE90'] = '\u0628';
  34449. t['\uFE91'] = '\u0628';
  34450. t['\uFE92'] = '\u0628';
  34451. t['\uFE93'] = '\u0629';
  34452. t['\uFE94'] = '\u0629';
  34453. t['\uFE95'] = '\u062A';
  34454. t['\uFE96'] = '\u062A';
  34455. t['\uFE97'] = '\u062A';
  34456. t['\uFE98'] = '\u062A';
  34457. t['\uFE99'] = '\u062B';
  34458. t['\uFE9A'] = '\u062B';
  34459. t['\uFE9B'] = '\u062B';
  34460. t['\uFE9C'] = '\u062B';
  34461. t['\uFE9D'] = '\u062C';
  34462. t['\uFE9E'] = '\u062C';
  34463. t['\uFE9F'] = '\u062C';
  34464. t['\uFEA0'] = '\u062C';
  34465. t['\uFEA1'] = '\u062D';
  34466. t['\uFEA2'] = '\u062D';
  34467. t['\uFEA3'] = '\u062D';
  34468. t['\uFEA4'] = '\u062D';
  34469. t['\uFEA5'] = '\u062E';
  34470. t['\uFEA6'] = '\u062E';
  34471. t['\uFEA7'] = '\u062E';
  34472. t['\uFEA8'] = '\u062E';
  34473. t['\uFEA9'] = '\u062F';
  34474. t['\uFEAA'] = '\u062F';
  34475. t['\uFEAB'] = '\u0630';
  34476. t['\uFEAC'] = '\u0630';
  34477. t['\uFEAD'] = '\u0631';
  34478. t['\uFEAE'] = '\u0631';
  34479. t['\uFEAF'] = '\u0632';
  34480. t['\uFEB0'] = '\u0632';
  34481. t['\uFEB1'] = '\u0633';
  34482. t['\uFEB2'] = '\u0633';
  34483. t['\uFEB3'] = '\u0633';
  34484. t['\uFEB4'] = '\u0633';
  34485. t['\uFEB5'] = '\u0634';
  34486. t['\uFEB6'] = '\u0634';
  34487. t['\uFEB7'] = '\u0634';
  34488. t['\uFEB8'] = '\u0634';
  34489. t['\uFEB9'] = '\u0635';
  34490. t['\uFEBA'] = '\u0635';
  34491. t['\uFEBB'] = '\u0635';
  34492. t['\uFEBC'] = '\u0635';
  34493. t['\uFEBD'] = '\u0636';
  34494. t['\uFEBE'] = '\u0636';
  34495. t['\uFEBF'] = '\u0636';
  34496. t['\uFEC0'] = '\u0636';
  34497. t['\uFEC1'] = '\u0637';
  34498. t['\uFEC2'] = '\u0637';
  34499. t['\uFEC3'] = '\u0637';
  34500. t['\uFEC4'] = '\u0637';
  34501. t['\uFEC5'] = '\u0638';
  34502. t['\uFEC6'] = '\u0638';
  34503. t['\uFEC7'] = '\u0638';
  34504. t['\uFEC8'] = '\u0638';
  34505. t['\uFEC9'] = '\u0639';
  34506. t['\uFECA'] = '\u0639';
  34507. t['\uFECB'] = '\u0639';
  34508. t['\uFECC'] = '\u0639';
  34509. t['\uFECD'] = '\u063A';
  34510. t['\uFECE'] = '\u063A';
  34511. t['\uFECF'] = '\u063A';
  34512. t['\uFED0'] = '\u063A';
  34513. t['\uFED1'] = '\u0641';
  34514. t['\uFED2'] = '\u0641';
  34515. t['\uFED3'] = '\u0641';
  34516. t['\uFED4'] = '\u0641';
  34517. t['\uFED5'] = '\u0642';
  34518. t['\uFED6'] = '\u0642';
  34519. t['\uFED7'] = '\u0642';
  34520. t['\uFED8'] = '\u0642';
  34521. t['\uFED9'] = '\u0643';
  34522. t['\uFEDA'] = '\u0643';
  34523. t['\uFEDB'] = '\u0643';
  34524. t['\uFEDC'] = '\u0643';
  34525. t['\uFEDD'] = '\u0644';
  34526. t['\uFEDE'] = '\u0644';
  34527. t['\uFEDF'] = '\u0644';
  34528. t['\uFEE0'] = '\u0644';
  34529. t['\uFEE1'] = '\u0645';
  34530. t['\uFEE2'] = '\u0645';
  34531. t['\uFEE3'] = '\u0645';
  34532. t['\uFEE4'] = '\u0645';
  34533. t['\uFEE5'] = '\u0646';
  34534. t['\uFEE6'] = '\u0646';
  34535. t['\uFEE7'] = '\u0646';
  34536. t['\uFEE8'] = '\u0646';
  34537. t['\uFEE9'] = '\u0647';
  34538. t['\uFEEA'] = '\u0647';
  34539. t['\uFEEB'] = '\u0647';
  34540. t['\uFEEC'] = '\u0647';
  34541. t['\uFEED'] = '\u0648';
  34542. t['\uFEEE'] = '\u0648';
  34543. t['\uFEEF'] = '\u0649';
  34544. t['\uFEF0'] = '\u0649';
  34545. t['\uFEF1'] = '\u064A';
  34546. t['\uFEF2'] = '\u064A';
  34547. t['\uFEF3'] = '\u064A';
  34548. t['\uFEF4'] = '\u064A';
  34549. t['\uFEF5'] = '\u0644\u0622';
  34550. t['\uFEF6'] = '\u0644\u0622';
  34551. t['\uFEF7'] = '\u0644\u0623';
  34552. t['\uFEF8'] = '\u0644\u0623';
  34553. t['\uFEF9'] = '\u0644\u0625';
  34554. t['\uFEFA'] = '\u0644\u0625';
  34555. t['\uFEFB'] = '\u0644\u0627';
  34556. t['\uFEFC'] = '\u0644\u0627';
  34557. });
  34558. function reverseIfRtl(chars) {
  34559. var charsLength = chars.length;
  34560. if (charsLength <= 1 || !isRTLRangeFor(chars.charCodeAt(0))) {
  34561. return chars;
  34562. }
  34563. var s = '';
  34564. for (var ii = charsLength - 1; ii >= 0; ii--) {
  34565. s += chars[ii];
  34566. }
  34567. return s;
  34568. }
  34569. exports.mapSpecialUnicodeValues = mapSpecialUnicodeValues;
  34570. exports.reverseIfRtl = reverseIfRtl;
  34571. exports.getUnicodeRangeFor = getUnicodeRangeFor;
  34572. exports.getNormalizedUnicodes = getNormalizedUnicodes;
  34573. exports.getUnicodeForGlyph = getUnicodeForGlyph;
  34574. /***/ }),
  34575. /* 19 */
  34576. /***/ (function(module, exports, __w_pdfjs_require__) {
  34577. "use strict";
  34578. var sharedUtil = __w_pdfjs_require__(0);
  34579. var coreWorker = __w_pdfjs_require__(8);
  34580. var globalScope = sharedUtil.globalScope;
  34581. var OK_RESPONSE = 200;
  34582. var PARTIAL_CONTENT_RESPONSE = 206;
  34583. function NetworkManager(url, args) {
  34584. this.url = url;
  34585. args = args || {};
  34586. this.isHttp = /^https?:/i.test(url);
  34587. this.httpHeaders = this.isHttp && args.httpHeaders || {};
  34588. this.withCredentials = args.withCredentials || false;
  34589. this.getXhr = args.getXhr || function NetworkManager_getXhr() {
  34590. return new XMLHttpRequest();
  34591. };
  34592. this.currXhrId = 0;
  34593. this.pendingRequests = Object.create(null);
  34594. this.loadedRequests = Object.create(null);
  34595. }
  34596. function getArrayBuffer(xhr) {
  34597. var data = xhr.response;
  34598. if (typeof data !== 'string') {
  34599. return data;
  34600. }
  34601. var length = data.length;
  34602. var array = new Uint8Array(length);
  34603. for (var i = 0; i < length; i++) {
  34604. array[i] = data.charCodeAt(i) & 0xFF;
  34605. }
  34606. return array.buffer;
  34607. }
  34608. var supportsMozChunked = function supportsMozChunkedClosure() {
  34609. try {
  34610. var x = new XMLHttpRequest();
  34611. x.open('GET', globalScope.location.href);
  34612. x.responseType = 'moz-chunked-arraybuffer';
  34613. return x.responseType === 'moz-chunked-arraybuffer';
  34614. } catch (e) {
  34615. return false;
  34616. }
  34617. }();
  34618. NetworkManager.prototype = {
  34619. requestRange: function NetworkManager_requestRange(begin, end, listeners) {
  34620. var args = {
  34621. begin: begin,
  34622. end: end
  34623. };
  34624. for (var prop in listeners) {
  34625. args[prop] = listeners[prop];
  34626. }
  34627. return this.request(args);
  34628. },
  34629. requestFull: function NetworkManager_requestFull(listeners) {
  34630. return this.request(listeners);
  34631. },
  34632. request: function NetworkManager_request(args) {
  34633. var xhr = this.getXhr();
  34634. var xhrId = this.currXhrId++;
  34635. var pendingRequest = this.pendingRequests[xhrId] = { xhr: xhr };
  34636. xhr.open('GET', this.url);
  34637. xhr.withCredentials = this.withCredentials;
  34638. for (var property in this.httpHeaders) {
  34639. var value = this.httpHeaders[property];
  34640. if (typeof value === 'undefined') {
  34641. continue;
  34642. }
  34643. xhr.setRequestHeader(property, value);
  34644. }
  34645. if (this.isHttp && 'begin' in args && 'end' in args) {
  34646. var rangeStr = args.begin + '-' + (args.end - 1);
  34647. xhr.setRequestHeader('Range', 'bytes=' + rangeStr);
  34648. pendingRequest.expectedStatus = 206;
  34649. } else {
  34650. pendingRequest.expectedStatus = 200;
  34651. }
  34652. var useMozChunkedLoading = supportsMozChunked && !!args.onProgressiveData;
  34653. if (useMozChunkedLoading) {
  34654. xhr.responseType = 'moz-chunked-arraybuffer';
  34655. pendingRequest.onProgressiveData = args.onProgressiveData;
  34656. pendingRequest.mozChunked = true;
  34657. } else {
  34658. xhr.responseType = 'arraybuffer';
  34659. }
  34660. if (args.onError) {
  34661. xhr.onerror = function (evt) {
  34662. args.onError(xhr.status);
  34663. };
  34664. }
  34665. xhr.onreadystatechange = this.onStateChange.bind(this, xhrId);
  34666. xhr.onprogress = this.onProgress.bind(this, xhrId);
  34667. pendingRequest.onHeadersReceived = args.onHeadersReceived;
  34668. pendingRequest.onDone = args.onDone;
  34669. pendingRequest.onError = args.onError;
  34670. pendingRequest.onProgress = args.onProgress;
  34671. xhr.send(null);
  34672. return xhrId;
  34673. },
  34674. onProgress: function NetworkManager_onProgress(xhrId, evt) {
  34675. var pendingRequest = this.pendingRequests[xhrId];
  34676. if (!pendingRequest) {
  34677. return;
  34678. }
  34679. if (pendingRequest.mozChunked) {
  34680. var chunk = getArrayBuffer(pendingRequest.xhr);
  34681. pendingRequest.onProgressiveData(chunk);
  34682. }
  34683. var onProgress = pendingRequest.onProgress;
  34684. if (onProgress) {
  34685. onProgress(evt);
  34686. }
  34687. },
  34688. onStateChange: function NetworkManager_onStateChange(xhrId, evt) {
  34689. var pendingRequest = this.pendingRequests[xhrId];
  34690. if (!pendingRequest) {
  34691. return;
  34692. }
  34693. var xhr = pendingRequest.xhr;
  34694. if (xhr.readyState >= 2 && pendingRequest.onHeadersReceived) {
  34695. pendingRequest.onHeadersReceived();
  34696. delete pendingRequest.onHeadersReceived;
  34697. }
  34698. if (xhr.readyState !== 4) {
  34699. return;
  34700. }
  34701. if (!(xhrId in this.pendingRequests)) {
  34702. return;
  34703. }
  34704. delete this.pendingRequests[xhrId];
  34705. if (xhr.status === 0 && this.isHttp) {
  34706. if (pendingRequest.onError) {
  34707. pendingRequest.onError(xhr.status);
  34708. }
  34709. return;
  34710. }
  34711. var xhrStatus = xhr.status || OK_RESPONSE;
  34712. var ok_response_on_range_request = xhrStatus === OK_RESPONSE && pendingRequest.expectedStatus === PARTIAL_CONTENT_RESPONSE;
  34713. if (!ok_response_on_range_request && xhrStatus !== pendingRequest.expectedStatus) {
  34714. if (pendingRequest.onError) {
  34715. pendingRequest.onError(xhr.status);
  34716. }
  34717. return;
  34718. }
  34719. this.loadedRequests[xhrId] = true;
  34720. var chunk = getArrayBuffer(xhr);
  34721. if (xhrStatus === PARTIAL_CONTENT_RESPONSE) {
  34722. var rangeHeader = xhr.getResponseHeader('Content-Range');
  34723. var matches = /bytes (\d+)-(\d+)\/(\d+)/.exec(rangeHeader);
  34724. var begin = parseInt(matches[1], 10);
  34725. pendingRequest.onDone({
  34726. begin: begin,
  34727. chunk: chunk
  34728. });
  34729. } else if (pendingRequest.onProgressiveData) {
  34730. pendingRequest.onDone(null);
  34731. } else if (chunk) {
  34732. pendingRequest.onDone({
  34733. begin: 0,
  34734. chunk: chunk
  34735. });
  34736. } else if (pendingRequest.onError) {
  34737. pendingRequest.onError(xhr.status);
  34738. }
  34739. },
  34740. hasPendingRequests: function NetworkManager_hasPendingRequests() {
  34741. for (var xhrId in this.pendingRequests) {
  34742. return true;
  34743. }
  34744. return false;
  34745. },
  34746. getRequestXhr: function NetworkManager_getXhr(xhrId) {
  34747. return this.pendingRequests[xhrId].xhr;
  34748. },
  34749. isStreamingRequest: function NetworkManager_isStreamingRequest(xhrId) {
  34750. return !!this.pendingRequests[xhrId].onProgressiveData;
  34751. },
  34752. isPendingRequest: function NetworkManager_isPendingRequest(xhrId) {
  34753. return xhrId in this.pendingRequests;
  34754. },
  34755. isLoadedRequest: function NetworkManager_isLoadedRequest(xhrId) {
  34756. return xhrId in this.loadedRequests;
  34757. },
  34758. abortAllRequests: function NetworkManager_abortAllRequests() {
  34759. for (var xhrId in this.pendingRequests) {
  34760. this.abortRequest(xhrId | 0);
  34761. }
  34762. },
  34763. abortRequest: function NetworkManager_abortRequest(xhrId) {
  34764. var xhr = this.pendingRequests[xhrId].xhr;
  34765. delete this.pendingRequests[xhrId];
  34766. xhr.abort();
  34767. }
  34768. };
  34769. var assert = sharedUtil.assert;
  34770. var createPromiseCapability = sharedUtil.createPromiseCapability;
  34771. var isInt = sharedUtil.isInt;
  34772. var MissingPDFException = sharedUtil.MissingPDFException;
  34773. var UnexpectedResponseException = sharedUtil.UnexpectedResponseException;
  34774. function PDFNetworkStream(options) {
  34775. this._options = options;
  34776. var source = options.source;
  34777. this._manager = new NetworkManager(source.url, {
  34778. httpHeaders: source.httpHeaders,
  34779. withCredentials: source.withCredentials
  34780. });
  34781. this._rangeChunkSize = source.rangeChunkSize;
  34782. this._fullRequestReader = null;
  34783. this._rangeRequestReaders = [];
  34784. }
  34785. PDFNetworkStream.prototype = {
  34786. _onRangeRequestReaderClosed: function PDFNetworkStream_onRangeRequestReaderClosed(reader) {
  34787. var i = this._rangeRequestReaders.indexOf(reader);
  34788. if (i >= 0) {
  34789. this._rangeRequestReaders.splice(i, 1);
  34790. }
  34791. },
  34792. getFullReader: function PDFNetworkStream_getFullReader() {
  34793. assert(!this._fullRequestReader);
  34794. this._fullRequestReader = new PDFNetworkStreamFullRequestReader(this._manager, this._options);
  34795. return this._fullRequestReader;
  34796. },
  34797. getRangeReader: function PDFNetworkStream_getRangeReader(begin, end) {
  34798. var reader = new PDFNetworkStreamRangeRequestReader(this._manager, begin, end);
  34799. reader.onClosed = this._onRangeRequestReaderClosed.bind(this);
  34800. this._rangeRequestReaders.push(reader);
  34801. return reader;
  34802. },
  34803. cancelAllRequests: function PDFNetworkStream_cancelAllRequests(reason) {
  34804. if (this._fullRequestReader) {
  34805. this._fullRequestReader.cancel(reason);
  34806. }
  34807. var readers = this._rangeRequestReaders.slice(0);
  34808. readers.forEach(function (reader) {
  34809. reader.cancel(reason);
  34810. });
  34811. }
  34812. };
  34813. function PDFNetworkStreamFullRequestReader(manager, options) {
  34814. this._manager = manager;
  34815. var source = options.source;
  34816. var args = {
  34817. onHeadersReceived: this._onHeadersReceived.bind(this),
  34818. onProgressiveData: source.disableStream ? null : this._onProgressiveData.bind(this),
  34819. onDone: this._onDone.bind(this),
  34820. onError: this._onError.bind(this),
  34821. onProgress: this._onProgress.bind(this)
  34822. };
  34823. this._url = source.url;
  34824. this._fullRequestId = manager.requestFull(args);
  34825. this._headersReceivedCapability = createPromiseCapability();
  34826. this._disableRange = options.disableRange || false;
  34827. this._contentLength = source.length;
  34828. this._rangeChunkSize = source.rangeChunkSize;
  34829. if (!this._rangeChunkSize && !this._disableRange) {
  34830. this._disableRange = true;
  34831. }
  34832. this._isStreamingSupported = false;
  34833. this._isRangeSupported = false;
  34834. this._cachedChunks = [];
  34835. this._requests = [];
  34836. this._done = false;
  34837. this._storedError = undefined;
  34838. this.onProgress = null;
  34839. }
  34840. PDFNetworkStreamFullRequestReader.prototype = {
  34841. _validateRangeRequestCapabilities: function PDFNetworkStreamFullRequestReader_validateRangeRequestCapabilities() {
  34842. if (this._disableRange) {
  34843. return false;
  34844. }
  34845. var networkManager = this._manager;
  34846. if (!networkManager.isHttp) {
  34847. return false;
  34848. }
  34849. var fullRequestXhrId = this._fullRequestId;
  34850. var fullRequestXhr = networkManager.getRequestXhr(fullRequestXhrId);
  34851. if (fullRequestXhr.getResponseHeader('Accept-Ranges') !== 'bytes') {
  34852. return false;
  34853. }
  34854. var contentEncoding = fullRequestXhr.getResponseHeader('Content-Encoding') || 'identity';
  34855. if (contentEncoding !== 'identity') {
  34856. return false;
  34857. }
  34858. var length = fullRequestXhr.getResponseHeader('Content-Length');
  34859. length = parseInt(length, 10);
  34860. if (!isInt(length)) {
  34861. return false;
  34862. }
  34863. this._contentLength = length;
  34864. if (length <= 2 * this._rangeChunkSize) {
  34865. return false;
  34866. }
  34867. return true;
  34868. },
  34869. _onHeadersReceived: function PDFNetworkStreamFullRequestReader_onHeadersReceived() {
  34870. if (this._validateRangeRequestCapabilities()) {
  34871. this._isRangeSupported = true;
  34872. }
  34873. var networkManager = this._manager;
  34874. var fullRequestXhrId = this._fullRequestId;
  34875. if (networkManager.isStreamingRequest(fullRequestXhrId)) {
  34876. this._isStreamingSupported = true;
  34877. } else if (this._isRangeSupported) {
  34878. networkManager.abortRequest(fullRequestXhrId);
  34879. }
  34880. this._headersReceivedCapability.resolve();
  34881. },
  34882. _onProgressiveData: function PDFNetworkStreamFullRequestReader_onProgressiveData(chunk) {
  34883. if (this._requests.length > 0) {
  34884. var requestCapability = this._requests.shift();
  34885. requestCapability.resolve({
  34886. value: chunk,
  34887. done: false
  34888. });
  34889. } else {
  34890. this._cachedChunks.push(chunk);
  34891. }
  34892. },
  34893. _onDone: function PDFNetworkStreamFullRequestReader_onDone(args) {
  34894. if (args) {
  34895. this._onProgressiveData(args.chunk);
  34896. }
  34897. this._done = true;
  34898. if (this._cachedChunks.length > 0) {
  34899. return;
  34900. }
  34901. this._requests.forEach(function (requestCapability) {
  34902. requestCapability.resolve({
  34903. value: undefined,
  34904. done: true
  34905. });
  34906. });
  34907. this._requests = [];
  34908. },
  34909. _onError: function PDFNetworkStreamFullRequestReader_onError(status) {
  34910. var url = this._url;
  34911. var exception;
  34912. if (status === 404 || status === 0 && /^file:/.test(url)) {
  34913. exception = new MissingPDFException('Missing PDF "' + url + '".');
  34914. } else {
  34915. exception = new UnexpectedResponseException('Unexpected server response (' + status + ') while retrieving PDF "' + url + '".', status);
  34916. }
  34917. this._storedError = exception;
  34918. this._headersReceivedCapability.reject(exception);
  34919. this._requests.forEach(function (requestCapability) {
  34920. requestCapability.reject(exception);
  34921. });
  34922. this._requests = [];
  34923. this._cachedChunks = [];
  34924. },
  34925. _onProgress: function PDFNetworkStreamFullRequestReader_onProgress(data) {
  34926. if (this.onProgress) {
  34927. this.onProgress({
  34928. loaded: data.loaded,
  34929. total: data.lengthComputable ? data.total : this._contentLength
  34930. });
  34931. }
  34932. },
  34933. get isRangeSupported() {
  34934. return this._isRangeSupported;
  34935. },
  34936. get isStreamingSupported() {
  34937. return this._isStreamingSupported;
  34938. },
  34939. get contentLength() {
  34940. return this._contentLength;
  34941. },
  34942. get headersReady() {
  34943. return this._headersReceivedCapability.promise;
  34944. },
  34945. read: function PDFNetworkStreamFullRequestReader_read() {
  34946. if (this._storedError) {
  34947. return Promise.reject(this._storedError);
  34948. }
  34949. if (this._cachedChunks.length > 0) {
  34950. var chunk = this._cachedChunks.shift();
  34951. return Promise.resolve(chunk);
  34952. }
  34953. if (this._done) {
  34954. return Promise.resolve({
  34955. value: undefined,
  34956. done: true
  34957. });
  34958. }
  34959. var requestCapability = createPromiseCapability();
  34960. this._requests.push(requestCapability);
  34961. return requestCapability.promise;
  34962. },
  34963. cancel: function PDFNetworkStreamFullRequestReader_cancel(reason) {
  34964. this._done = true;
  34965. this._headersReceivedCapability.reject(reason);
  34966. this._requests.forEach(function (requestCapability) {
  34967. requestCapability.resolve({
  34968. value: undefined,
  34969. done: true
  34970. });
  34971. });
  34972. this._requests = [];
  34973. if (this._manager.isPendingRequest(this._fullRequestId)) {
  34974. this._manager.abortRequest(this._fullRequestId);
  34975. }
  34976. this._fullRequestReader = null;
  34977. }
  34978. };
  34979. function PDFNetworkStreamRangeRequestReader(manager, begin, end) {
  34980. this._manager = manager;
  34981. var args = {
  34982. onDone: this._onDone.bind(this),
  34983. onProgress: this._onProgress.bind(this)
  34984. };
  34985. this._requestId = manager.requestRange(begin, end, args);
  34986. this._requests = [];
  34987. this._queuedChunk = null;
  34988. this._done = false;
  34989. this.onProgress = null;
  34990. this.onClosed = null;
  34991. }
  34992. PDFNetworkStreamRangeRequestReader.prototype = {
  34993. _close: function PDFNetworkStreamRangeRequestReader_close() {
  34994. if (this.onClosed) {
  34995. this.onClosed(this);
  34996. }
  34997. },
  34998. _onDone: function PDFNetworkStreamRangeRequestReader_onDone(data) {
  34999. var chunk = data.chunk;
  35000. if (this._requests.length > 0) {
  35001. var requestCapability = this._requests.shift();
  35002. requestCapability.resolve({
  35003. value: chunk,
  35004. done: false
  35005. });
  35006. } else {
  35007. this._queuedChunk = chunk;
  35008. }
  35009. this._done = true;
  35010. this._requests.forEach(function (requestCapability) {
  35011. requestCapability.resolve({
  35012. value: undefined,
  35013. done: true
  35014. });
  35015. });
  35016. this._requests = [];
  35017. this._close();
  35018. },
  35019. _onProgress: function PDFNetworkStreamRangeRequestReader_onProgress(evt) {
  35020. if (!this.isStreamingSupported && this.onProgress) {
  35021. this.onProgress({ loaded: evt.loaded });
  35022. }
  35023. },
  35024. get isStreamingSupported() {
  35025. return false;
  35026. },
  35027. read: function PDFNetworkStreamRangeRequestReader_read() {
  35028. if (this._queuedChunk !== null) {
  35029. var chunk = this._queuedChunk;
  35030. this._queuedChunk = null;
  35031. return Promise.resolve({
  35032. value: chunk,
  35033. done: false
  35034. });
  35035. }
  35036. if (this._done) {
  35037. return Promise.resolve({
  35038. value: undefined,
  35039. done: true
  35040. });
  35041. }
  35042. var requestCapability = createPromiseCapability();
  35043. this._requests.push(requestCapability);
  35044. return requestCapability.promise;
  35045. },
  35046. cancel: function PDFNetworkStreamRangeRequestReader_cancel(reason) {
  35047. this._done = true;
  35048. this._requests.forEach(function (requestCapability) {
  35049. requestCapability.resolve({
  35050. value: undefined,
  35051. done: true
  35052. });
  35053. });
  35054. this._requests = [];
  35055. if (this._manager.isPendingRequest(this._requestId)) {
  35056. this._manager.abortRequest(this._requestId);
  35057. }
  35058. this._close();
  35059. }
  35060. };
  35061. coreWorker.setPDFNetworkStreamClass(PDFNetworkStream);
  35062. exports.PDFNetworkStream = PDFNetworkStream;
  35063. exports.NetworkManager = NetworkManager;
  35064. /***/ }),
  35065. /* 20 */
  35066. /***/ (function(module, exports, __w_pdfjs_require__) {
  35067. "use strict";
  35068. var sharedUtil = __w_pdfjs_require__(0);
  35069. var corePrimitives = __w_pdfjs_require__(1);
  35070. var coreStream = __w_pdfjs_require__(2);
  35071. var coreColorSpace = __w_pdfjs_require__(3);
  35072. var coreObj = __w_pdfjs_require__(16);
  35073. var coreEvaluator = __w_pdfjs_require__(14);
  35074. var AnnotationBorderStyleType = sharedUtil.AnnotationBorderStyleType;
  35075. var AnnotationFieldFlag = sharedUtil.AnnotationFieldFlag;
  35076. var AnnotationFlag = sharedUtil.AnnotationFlag;
  35077. var AnnotationType = sharedUtil.AnnotationType;
  35078. var OPS = sharedUtil.OPS;
  35079. var Util = sharedUtil.Util;
  35080. var isArray = sharedUtil.isArray;
  35081. var isInt = sharedUtil.isInt;
  35082. var stringToBytes = sharedUtil.stringToBytes;
  35083. var stringToPDFString = sharedUtil.stringToPDFString;
  35084. var warn = sharedUtil.warn;
  35085. var Dict = corePrimitives.Dict;
  35086. var isDict = corePrimitives.isDict;
  35087. var isName = corePrimitives.isName;
  35088. var isRef = corePrimitives.isRef;
  35089. var isStream = corePrimitives.isStream;
  35090. var Stream = coreStream.Stream;
  35091. var ColorSpace = coreColorSpace.ColorSpace;
  35092. var Catalog = coreObj.Catalog;
  35093. var ObjectLoader = coreObj.ObjectLoader;
  35094. var FileSpec = coreObj.FileSpec;
  35095. var OperatorList = coreEvaluator.OperatorList;
  35096. function AnnotationFactory() {
  35097. }
  35098. AnnotationFactory.prototype = {
  35099. create: function AnnotationFactory_create(xref, ref, pdfManager, idFactory) {
  35100. var dict = xref.fetchIfRef(ref);
  35101. if (!isDict(dict)) {
  35102. return;
  35103. }
  35104. var id = isRef(ref) ? ref.toString() : 'annot_' + idFactory.createObjId();
  35105. var subtype = dict.get('Subtype');
  35106. subtype = isName(subtype) ? subtype.name : null;
  35107. var parameters = {
  35108. xref: xref,
  35109. dict: dict,
  35110. ref: isRef(ref) ? ref : null,
  35111. subtype: subtype,
  35112. id: id,
  35113. pdfManager: pdfManager
  35114. };
  35115. switch (subtype) {
  35116. case 'Link':
  35117. return new LinkAnnotation(parameters);
  35118. case 'Text':
  35119. return new TextAnnotation(parameters);
  35120. case 'Widget':
  35121. var fieldType = Util.getInheritableProperty(dict, 'FT');
  35122. fieldType = isName(fieldType) ? fieldType.name : null;
  35123. switch (fieldType) {
  35124. case 'Tx':
  35125. return new TextWidgetAnnotation(parameters);
  35126. case 'Btn':
  35127. return new ButtonWidgetAnnotation(parameters);
  35128. case 'Ch':
  35129. return new ChoiceWidgetAnnotation(parameters);
  35130. }
  35131. warn('Unimplemented widget field type "' + fieldType + '", ' + 'falling back to base field type.');
  35132. return new WidgetAnnotation(parameters);
  35133. case 'Popup':
  35134. return new PopupAnnotation(parameters);
  35135. case 'Highlight':
  35136. return new HighlightAnnotation(parameters);
  35137. case 'Underline':
  35138. return new UnderlineAnnotation(parameters);
  35139. case 'Squiggly':
  35140. return new SquigglyAnnotation(parameters);
  35141. case 'StrikeOut':
  35142. return new StrikeOutAnnotation(parameters);
  35143. case 'FileAttachment':
  35144. return new FileAttachmentAnnotation(parameters);
  35145. default:
  35146. if (!subtype) {
  35147. warn('Annotation is missing the required /Subtype.');
  35148. } else {
  35149. warn('Unimplemented annotation type "' + subtype + '", ' + 'falling back to base annotation.');
  35150. }
  35151. return new Annotation(parameters);
  35152. }
  35153. }
  35154. };
  35155. var Annotation = function AnnotationClosure() {
  35156. function getTransformMatrix(rect, bbox, matrix) {
  35157. var bounds = Util.getAxialAlignedBoundingBox(bbox, matrix);
  35158. var minX = bounds[0];
  35159. var minY = bounds[1];
  35160. var maxX = bounds[2];
  35161. var maxY = bounds[3];
  35162. if (minX === maxX || minY === maxY) {
  35163. return [
  35164. 1,
  35165. 0,
  35166. 0,
  35167. 1,
  35168. rect[0],
  35169. rect[1]
  35170. ];
  35171. }
  35172. var xRatio = (rect[2] - rect[0]) / (maxX - minX);
  35173. var yRatio = (rect[3] - rect[1]) / (maxY - minY);
  35174. return [
  35175. xRatio,
  35176. 0,
  35177. 0,
  35178. yRatio,
  35179. rect[0] - minX * xRatio,
  35180. rect[1] - minY * yRatio
  35181. ];
  35182. }
  35183. function Annotation(params) {
  35184. var dict = params.dict;
  35185. this.setFlags(dict.get('F'));
  35186. this.setRectangle(dict.getArray('Rect'));
  35187. this.setColor(dict.getArray('C'));
  35188. this.setBorderStyle(dict);
  35189. this.setAppearance(dict);
  35190. this.data = {};
  35191. this.data.id = params.id;
  35192. this.data.subtype = params.subtype;
  35193. this.data.annotationFlags = this.flags;
  35194. this.data.rect = this.rectangle;
  35195. this.data.color = this.color;
  35196. this.data.borderStyle = this.borderStyle;
  35197. this.data.hasAppearance = !!this.appearance;
  35198. }
  35199. Annotation.prototype = {
  35200. _hasFlag: function Annotation_hasFlag(flags, flag) {
  35201. return !!(flags & flag);
  35202. },
  35203. _isViewable: function Annotation_isViewable(flags) {
  35204. return !this._hasFlag(flags, AnnotationFlag.INVISIBLE) && !this._hasFlag(flags, AnnotationFlag.HIDDEN) && !this._hasFlag(flags, AnnotationFlag.NOVIEW);
  35205. },
  35206. _isPrintable: function AnnotationFlag_isPrintable(flags) {
  35207. return this._hasFlag(flags, AnnotationFlag.PRINT) && !this._hasFlag(flags, AnnotationFlag.INVISIBLE) && !this._hasFlag(flags, AnnotationFlag.HIDDEN);
  35208. },
  35209. get viewable() {
  35210. if (this.flags === 0) {
  35211. return true;
  35212. }
  35213. return this._isViewable(this.flags);
  35214. },
  35215. get printable() {
  35216. if (this.flags === 0) {
  35217. return false;
  35218. }
  35219. return this._isPrintable(this.flags);
  35220. },
  35221. setFlags: function Annotation_setFlags(flags) {
  35222. this.flags = isInt(flags) && flags > 0 ? flags : 0;
  35223. },
  35224. hasFlag: function Annotation_hasFlag(flag) {
  35225. return this._hasFlag(this.flags, flag);
  35226. },
  35227. setRectangle: function Annotation_setRectangle(rectangle) {
  35228. if (isArray(rectangle) && rectangle.length === 4) {
  35229. this.rectangle = Util.normalizeRect(rectangle);
  35230. } else {
  35231. this.rectangle = [
  35232. 0,
  35233. 0,
  35234. 0,
  35235. 0
  35236. ];
  35237. }
  35238. },
  35239. setColor: function Annotation_setColor(color) {
  35240. var rgbColor = new Uint8Array(3);
  35241. if (!isArray(color)) {
  35242. this.color = rgbColor;
  35243. return;
  35244. }
  35245. switch (color.length) {
  35246. case 0:
  35247. this.color = null;
  35248. break;
  35249. case 1:
  35250. ColorSpace.singletons.gray.getRgbItem(color, 0, rgbColor, 0);
  35251. this.color = rgbColor;
  35252. break;
  35253. case 3:
  35254. ColorSpace.singletons.rgb.getRgbItem(color, 0, rgbColor, 0);
  35255. this.color = rgbColor;
  35256. break;
  35257. case 4:
  35258. ColorSpace.singletons.cmyk.getRgbItem(color, 0, rgbColor, 0);
  35259. this.color = rgbColor;
  35260. break;
  35261. default:
  35262. this.color = rgbColor;
  35263. break;
  35264. }
  35265. },
  35266. setBorderStyle: function Annotation_setBorderStyle(borderStyle) {
  35267. this.borderStyle = new AnnotationBorderStyle();
  35268. if (!isDict(borderStyle)) {
  35269. return;
  35270. }
  35271. if (borderStyle.has('BS')) {
  35272. var dict = borderStyle.get('BS');
  35273. var dictType = dict.get('Type');
  35274. if (!dictType || isName(dictType, 'Border')) {
  35275. this.borderStyle.setWidth(dict.get('W'));
  35276. this.borderStyle.setStyle(dict.get('S'));
  35277. this.borderStyle.setDashArray(dict.getArray('D'));
  35278. }
  35279. } else if (borderStyle.has('Border')) {
  35280. var array = borderStyle.getArray('Border');
  35281. if (isArray(array) && array.length >= 3) {
  35282. this.borderStyle.setHorizontalCornerRadius(array[0]);
  35283. this.borderStyle.setVerticalCornerRadius(array[1]);
  35284. this.borderStyle.setWidth(array[2]);
  35285. if (array.length === 4) {
  35286. this.borderStyle.setDashArray(array[3]);
  35287. }
  35288. }
  35289. } else {
  35290. this.borderStyle.setWidth(0);
  35291. }
  35292. },
  35293. setAppearance: function Annotation_setAppearance(dict) {
  35294. this.appearance = null;
  35295. var appearanceStates = dict.get('AP');
  35296. if (!isDict(appearanceStates)) {
  35297. return;
  35298. }
  35299. var normalAppearanceState = appearanceStates.get('N');
  35300. if (isStream(normalAppearanceState)) {
  35301. this.appearance = normalAppearanceState;
  35302. return;
  35303. }
  35304. if (!isDict(normalAppearanceState)) {
  35305. return;
  35306. }
  35307. var as = dict.get('AS');
  35308. if (!isName(as) || !normalAppearanceState.has(as.name)) {
  35309. return;
  35310. }
  35311. this.appearance = normalAppearanceState.get(as.name);
  35312. },
  35313. _preparePopup: function Annotation_preparePopup(dict) {
  35314. if (!dict.has('C')) {
  35315. this.data.color = null;
  35316. }
  35317. this.data.hasPopup = dict.has('Popup');
  35318. this.data.title = stringToPDFString(dict.get('T') || '');
  35319. this.data.contents = stringToPDFString(dict.get('Contents') || '');
  35320. },
  35321. loadResources: function Annotation_loadResources(keys) {
  35322. return new Promise(function (resolve, reject) {
  35323. this.appearance.dict.getAsync('Resources').then(function (resources) {
  35324. if (!resources) {
  35325. resolve();
  35326. return;
  35327. }
  35328. var objectLoader = new ObjectLoader(resources.map, keys, resources.xref);
  35329. objectLoader.load().then(function () {
  35330. resolve(resources);
  35331. }, reject);
  35332. }, reject);
  35333. }.bind(this));
  35334. },
  35335. getOperatorList: function Annotation_getOperatorList(evaluator, task, renderForms) {
  35336. if (!this.appearance) {
  35337. return Promise.resolve(new OperatorList());
  35338. }
  35339. var data = this.data;
  35340. var appearanceDict = this.appearance.dict;
  35341. var resourcesPromise = this.loadResources([
  35342. 'ExtGState',
  35343. 'ColorSpace',
  35344. 'Pattern',
  35345. 'Shading',
  35346. 'XObject',
  35347. 'Font'
  35348. ]);
  35349. var bbox = appearanceDict.getArray('BBox') || [
  35350. 0,
  35351. 0,
  35352. 1,
  35353. 1
  35354. ];
  35355. var matrix = appearanceDict.getArray('Matrix') || [
  35356. 1,
  35357. 0,
  35358. 0,
  35359. 1,
  35360. 0,
  35361. 0
  35362. ];
  35363. var transform = getTransformMatrix(data.rect, bbox, matrix);
  35364. var self = this;
  35365. return resourcesPromise.then(function (resources) {
  35366. var opList = new OperatorList();
  35367. opList.addOp(OPS.beginAnnotation, [
  35368. data.rect,
  35369. transform,
  35370. matrix
  35371. ]);
  35372. return evaluator.getOperatorList(self.appearance, task, resources, opList).then(function () {
  35373. opList.addOp(OPS.endAnnotation, []);
  35374. self.appearance.reset();
  35375. return opList;
  35376. });
  35377. });
  35378. }
  35379. };
  35380. return Annotation;
  35381. }();
  35382. var AnnotationBorderStyle = function AnnotationBorderStyleClosure() {
  35383. function AnnotationBorderStyle() {
  35384. this.width = 1;
  35385. this.style = AnnotationBorderStyleType.SOLID;
  35386. this.dashArray = [3];
  35387. this.horizontalCornerRadius = 0;
  35388. this.verticalCornerRadius = 0;
  35389. }
  35390. AnnotationBorderStyle.prototype = {
  35391. setWidth: function AnnotationBorderStyle_setWidth(width) {
  35392. if (width === (width | 0)) {
  35393. this.width = width;
  35394. }
  35395. },
  35396. setStyle: function AnnotationBorderStyle_setStyle(style) {
  35397. if (!style) {
  35398. return;
  35399. }
  35400. switch (style.name) {
  35401. case 'S':
  35402. this.style = AnnotationBorderStyleType.SOLID;
  35403. break;
  35404. case 'D':
  35405. this.style = AnnotationBorderStyleType.DASHED;
  35406. break;
  35407. case 'B':
  35408. this.style = AnnotationBorderStyleType.BEVELED;
  35409. break;
  35410. case 'I':
  35411. this.style = AnnotationBorderStyleType.INSET;
  35412. break;
  35413. case 'U':
  35414. this.style = AnnotationBorderStyleType.UNDERLINE;
  35415. break;
  35416. default:
  35417. break;
  35418. }
  35419. },
  35420. setDashArray: function AnnotationBorderStyle_setDashArray(dashArray) {
  35421. if (isArray(dashArray) && dashArray.length > 0) {
  35422. var isValid = true;
  35423. var allZeros = true;
  35424. for (var i = 0, len = dashArray.length; i < len; i++) {
  35425. var element = dashArray[i];
  35426. var validNumber = +element >= 0;
  35427. if (!validNumber) {
  35428. isValid = false;
  35429. break;
  35430. } else if (element > 0) {
  35431. allZeros = false;
  35432. }
  35433. }
  35434. if (isValid && !allZeros) {
  35435. this.dashArray = dashArray;
  35436. } else {
  35437. this.width = 0;
  35438. }
  35439. } else if (dashArray) {
  35440. this.width = 0;
  35441. }
  35442. },
  35443. setHorizontalCornerRadius: function AnnotationBorderStyle_setHorizontalCornerRadius(radius) {
  35444. if (radius === (radius | 0)) {
  35445. this.horizontalCornerRadius = radius;
  35446. }
  35447. },
  35448. setVerticalCornerRadius: function AnnotationBorderStyle_setVerticalCornerRadius(radius) {
  35449. if (radius === (radius | 0)) {
  35450. this.verticalCornerRadius = radius;
  35451. }
  35452. }
  35453. };
  35454. return AnnotationBorderStyle;
  35455. }();
  35456. var WidgetAnnotation = function WidgetAnnotationClosure() {
  35457. function WidgetAnnotation(params) {
  35458. Annotation.call(this, params);
  35459. var dict = params.dict;
  35460. var data = this.data;
  35461. data.annotationType = AnnotationType.WIDGET;
  35462. data.fieldName = this._constructFieldName(dict);
  35463. data.fieldValue = Util.getInheritableProperty(dict, 'V', true);
  35464. data.alternativeText = stringToPDFString(dict.get('TU') || '');
  35465. data.defaultAppearance = Util.getInheritableProperty(dict, 'DA') || '';
  35466. var fieldType = Util.getInheritableProperty(dict, 'FT');
  35467. data.fieldType = isName(fieldType) ? fieldType.name : null;
  35468. this.fieldResources = Util.getInheritableProperty(dict, 'DR') || Dict.empty;
  35469. data.fieldFlags = Util.getInheritableProperty(dict, 'Ff');
  35470. if (!isInt(data.fieldFlags) || data.fieldFlags < 0) {
  35471. data.fieldFlags = 0;
  35472. }
  35473. data.readOnly = this.hasFieldFlag(AnnotationFieldFlag.READONLY);
  35474. if (data.fieldType === 'Sig') {
  35475. this.setFlags(AnnotationFlag.HIDDEN);
  35476. }
  35477. }
  35478. Util.inherit(WidgetAnnotation, Annotation, {
  35479. _constructFieldName: function WidgetAnnotation_constructFieldName(dict) {
  35480. if (!dict.has('T') && !dict.has('Parent')) {
  35481. warn('Unknown field name, falling back to empty field name.');
  35482. return '';
  35483. }
  35484. if (!dict.has('Parent')) {
  35485. return stringToPDFString(dict.get('T'));
  35486. }
  35487. var fieldName = [];
  35488. if (dict.has('T')) {
  35489. fieldName.unshift(stringToPDFString(dict.get('T')));
  35490. }
  35491. var loopDict = dict;
  35492. while (loopDict.has('Parent')) {
  35493. loopDict = loopDict.get('Parent');
  35494. if (!isDict(loopDict)) {
  35495. break;
  35496. }
  35497. if (loopDict.has('T')) {
  35498. fieldName.unshift(stringToPDFString(loopDict.get('T')));
  35499. }
  35500. }
  35501. return fieldName.join('.');
  35502. },
  35503. hasFieldFlag: function WidgetAnnotation_hasFieldFlag(flag) {
  35504. return !!(this.data.fieldFlags & flag);
  35505. }
  35506. });
  35507. return WidgetAnnotation;
  35508. }();
  35509. var TextWidgetAnnotation = function TextWidgetAnnotationClosure() {
  35510. function TextWidgetAnnotation(params) {
  35511. WidgetAnnotation.call(this, params);
  35512. this.data.fieldValue = stringToPDFString(this.data.fieldValue || '');
  35513. var alignment = Util.getInheritableProperty(params.dict, 'Q');
  35514. if (!isInt(alignment) || alignment < 0 || alignment > 2) {
  35515. alignment = null;
  35516. }
  35517. this.data.textAlignment = alignment;
  35518. var maximumLength = Util.getInheritableProperty(params.dict, 'MaxLen');
  35519. if (!isInt(maximumLength) || maximumLength < 0) {
  35520. maximumLength = null;
  35521. }
  35522. this.data.maxLen = maximumLength;
  35523. this.data.multiLine = this.hasFieldFlag(AnnotationFieldFlag.MULTILINE);
  35524. this.data.comb = this.hasFieldFlag(AnnotationFieldFlag.COMB) && !this.hasFieldFlag(AnnotationFieldFlag.MULTILINE) && !this.hasFieldFlag(AnnotationFieldFlag.PASSWORD) && !this.hasFieldFlag(AnnotationFieldFlag.FILESELECT) && this.data.maxLen !== null;
  35525. }
  35526. Util.inherit(TextWidgetAnnotation, WidgetAnnotation, {
  35527. getOperatorList: function TextWidgetAnnotation_getOperatorList(evaluator, task, renderForms) {
  35528. var operatorList = new OperatorList();
  35529. if (renderForms) {
  35530. return Promise.resolve(operatorList);
  35531. }
  35532. if (this.appearance) {
  35533. return Annotation.prototype.getOperatorList.call(this, evaluator, task, renderForms);
  35534. }
  35535. if (!this.data.defaultAppearance) {
  35536. return Promise.resolve(operatorList);
  35537. }
  35538. var stream = new Stream(stringToBytes(this.data.defaultAppearance));
  35539. return evaluator.getOperatorList(stream, task, this.fieldResources, operatorList).then(function () {
  35540. return operatorList;
  35541. });
  35542. }
  35543. });
  35544. return TextWidgetAnnotation;
  35545. }();
  35546. var ButtonWidgetAnnotation = function ButtonWidgetAnnotationClosure() {
  35547. function ButtonWidgetAnnotation(params) {
  35548. WidgetAnnotation.call(this, params);
  35549. this.data.checkBox = !this.hasFieldFlag(AnnotationFieldFlag.RADIO) && !this.hasFieldFlag(AnnotationFieldFlag.PUSHBUTTON);
  35550. if (this.data.checkBox) {
  35551. if (!isName(this.data.fieldValue)) {
  35552. return;
  35553. }
  35554. this.data.fieldValue = this.data.fieldValue.name;
  35555. }
  35556. this.data.radioButton = this.hasFieldFlag(AnnotationFieldFlag.RADIO) && !this.hasFieldFlag(AnnotationFieldFlag.PUSHBUTTON);
  35557. if (this.data.radioButton) {
  35558. this.data.fieldValue = this.data.buttonValue = null;
  35559. var fieldParent = params.dict.get('Parent');
  35560. if (isDict(fieldParent) && fieldParent.has('V')) {
  35561. var fieldParentValue = fieldParent.get('V');
  35562. if (isName(fieldParentValue)) {
  35563. this.data.fieldValue = fieldParentValue.name;
  35564. }
  35565. }
  35566. var appearanceStates = params.dict.get('AP');
  35567. if (!isDict(appearanceStates)) {
  35568. return;
  35569. }
  35570. var normalAppearanceState = appearanceStates.get('N');
  35571. if (!isDict(normalAppearanceState)) {
  35572. return;
  35573. }
  35574. var keys = normalAppearanceState.getKeys();
  35575. for (var i = 0, ii = keys.length; i < ii; i++) {
  35576. if (keys[i] !== 'Off') {
  35577. this.data.buttonValue = keys[i];
  35578. break;
  35579. }
  35580. }
  35581. }
  35582. }
  35583. Util.inherit(ButtonWidgetAnnotation, WidgetAnnotation, {
  35584. getOperatorList: function ButtonWidgetAnnotation_getOperatorList(evaluator, task, renderForms) {
  35585. var operatorList = new OperatorList();
  35586. if (renderForms) {
  35587. return Promise.resolve(operatorList);
  35588. }
  35589. if (this.appearance) {
  35590. return Annotation.prototype.getOperatorList.call(this, evaluator, task, renderForms);
  35591. }
  35592. return Promise.resolve(operatorList);
  35593. }
  35594. });
  35595. return ButtonWidgetAnnotation;
  35596. }();
  35597. var ChoiceWidgetAnnotation = function ChoiceWidgetAnnotationClosure() {
  35598. function ChoiceWidgetAnnotation(params) {
  35599. WidgetAnnotation.call(this, params);
  35600. this.data.options = [];
  35601. var options = Util.getInheritableProperty(params.dict, 'Opt');
  35602. if (isArray(options)) {
  35603. var xref = params.xref;
  35604. for (var i = 0, ii = options.length; i < ii; i++) {
  35605. var option = xref.fetchIfRef(options[i]);
  35606. var isOptionArray = isArray(option);
  35607. this.data.options[i] = {
  35608. exportValue: isOptionArray ? xref.fetchIfRef(option[0]) : option,
  35609. displayValue: isOptionArray ? xref.fetchIfRef(option[1]) : option
  35610. };
  35611. }
  35612. }
  35613. if (!isArray(this.data.fieldValue)) {
  35614. this.data.fieldValue = [this.data.fieldValue];
  35615. }
  35616. this.data.combo = this.hasFieldFlag(AnnotationFieldFlag.COMBO);
  35617. this.data.multiSelect = this.hasFieldFlag(AnnotationFieldFlag.MULTISELECT);
  35618. }
  35619. Util.inherit(ChoiceWidgetAnnotation, WidgetAnnotation, {
  35620. getOperatorList: function ChoiceWidgetAnnotation_getOperatorList(evaluator, task, renderForms) {
  35621. var operatorList = new OperatorList();
  35622. if (renderForms) {
  35623. return Promise.resolve(operatorList);
  35624. }
  35625. return Annotation.prototype.getOperatorList.call(this, evaluator, task, renderForms);
  35626. }
  35627. });
  35628. return ChoiceWidgetAnnotation;
  35629. }();
  35630. var TextAnnotation = function TextAnnotationClosure() {
  35631. var DEFAULT_ICON_SIZE = 22;
  35632. function TextAnnotation(parameters) {
  35633. Annotation.call(this, parameters);
  35634. this.data.annotationType = AnnotationType.TEXT;
  35635. if (this.data.hasAppearance) {
  35636. this.data.name = 'NoIcon';
  35637. } else {
  35638. this.data.rect[1] = this.data.rect[3] - DEFAULT_ICON_SIZE;
  35639. this.data.rect[2] = this.data.rect[0] + DEFAULT_ICON_SIZE;
  35640. this.data.name = parameters.dict.has('Name') ? parameters.dict.get('Name').name : 'Note';
  35641. }
  35642. this._preparePopup(parameters.dict);
  35643. }
  35644. Util.inherit(TextAnnotation, Annotation, {});
  35645. return TextAnnotation;
  35646. }();
  35647. var LinkAnnotation = function LinkAnnotationClosure() {
  35648. function LinkAnnotation(params) {
  35649. Annotation.call(this, params);
  35650. var data = this.data;
  35651. data.annotationType = AnnotationType.LINK;
  35652. Catalog.parseDestDictionary({
  35653. destDict: params.dict,
  35654. resultObj: data,
  35655. docBaseUrl: params.pdfManager.docBaseUrl
  35656. });
  35657. }
  35658. Util.inherit(LinkAnnotation, Annotation, {});
  35659. return LinkAnnotation;
  35660. }();
  35661. var PopupAnnotation = function PopupAnnotationClosure() {
  35662. function PopupAnnotation(parameters) {
  35663. Annotation.call(this, parameters);
  35664. this.data.annotationType = AnnotationType.POPUP;
  35665. var dict = parameters.dict;
  35666. var parentItem = dict.get('Parent');
  35667. if (!parentItem) {
  35668. warn('Popup annotation has a missing or invalid parent annotation.');
  35669. return;
  35670. }
  35671. this.data.parentId = dict.getRaw('Parent').toString();
  35672. this.data.title = stringToPDFString(parentItem.get('T') || '');
  35673. this.data.contents = stringToPDFString(parentItem.get('Contents') || '');
  35674. if (!parentItem.has('C')) {
  35675. this.data.color = null;
  35676. } else {
  35677. this.setColor(parentItem.getArray('C'));
  35678. this.data.color = this.color;
  35679. }
  35680. if (!this.viewable) {
  35681. var parentFlags = parentItem.get('F');
  35682. if (this._isViewable(parentFlags)) {
  35683. this.setFlags(parentFlags);
  35684. }
  35685. }
  35686. }
  35687. Util.inherit(PopupAnnotation, Annotation, {});
  35688. return PopupAnnotation;
  35689. }();
  35690. var HighlightAnnotation = function HighlightAnnotationClosure() {
  35691. function HighlightAnnotation(parameters) {
  35692. Annotation.call(this, parameters);
  35693. this.data.annotationType = AnnotationType.HIGHLIGHT;
  35694. this._preparePopup(parameters.dict);
  35695. this.data.borderStyle.setWidth(0);
  35696. }
  35697. Util.inherit(HighlightAnnotation, Annotation, {});
  35698. return HighlightAnnotation;
  35699. }();
  35700. var UnderlineAnnotation = function UnderlineAnnotationClosure() {
  35701. function UnderlineAnnotation(parameters) {
  35702. Annotation.call(this, parameters);
  35703. this.data.annotationType = AnnotationType.UNDERLINE;
  35704. this._preparePopup(parameters.dict);
  35705. this.data.borderStyle.setWidth(0);
  35706. }
  35707. Util.inherit(UnderlineAnnotation, Annotation, {});
  35708. return UnderlineAnnotation;
  35709. }();
  35710. var SquigglyAnnotation = function SquigglyAnnotationClosure() {
  35711. function SquigglyAnnotation(parameters) {
  35712. Annotation.call(this, parameters);
  35713. this.data.annotationType = AnnotationType.SQUIGGLY;
  35714. this._preparePopup(parameters.dict);
  35715. this.data.borderStyle.setWidth(0);
  35716. }
  35717. Util.inherit(SquigglyAnnotation, Annotation, {});
  35718. return SquigglyAnnotation;
  35719. }();
  35720. var StrikeOutAnnotation = function StrikeOutAnnotationClosure() {
  35721. function StrikeOutAnnotation(parameters) {
  35722. Annotation.call(this, parameters);
  35723. this.data.annotationType = AnnotationType.STRIKEOUT;
  35724. this._preparePopup(parameters.dict);
  35725. this.data.borderStyle.setWidth(0);
  35726. }
  35727. Util.inherit(StrikeOutAnnotation, Annotation, {});
  35728. return StrikeOutAnnotation;
  35729. }();
  35730. var FileAttachmentAnnotation = function FileAttachmentAnnotationClosure() {
  35731. function FileAttachmentAnnotation(parameters) {
  35732. Annotation.call(this, parameters);
  35733. var file = new FileSpec(parameters.dict.get('FS'), parameters.xref);
  35734. this.data.annotationType = AnnotationType.FILEATTACHMENT;
  35735. this.data.file = file.serializable;
  35736. this._preparePopup(parameters.dict);
  35737. }
  35738. Util.inherit(FileAttachmentAnnotation, Annotation, {});
  35739. return FileAttachmentAnnotation;
  35740. }();
  35741. exports.Annotation = Annotation;
  35742. exports.AnnotationBorderStyle = AnnotationBorderStyle;
  35743. exports.AnnotationFactory = AnnotationFactory;
  35744. /***/ }),
  35745. /* 21 */
  35746. /***/ (function(module, exports, __w_pdfjs_require__) {
  35747. "use strict";
  35748. var sharedUtil = __w_pdfjs_require__(0);
  35749. var warn = sharedUtil.warn;
  35750. var baseTypes = [
  35751. 'BN',
  35752. 'BN',
  35753. 'BN',
  35754. 'BN',
  35755. 'BN',
  35756. 'BN',
  35757. 'BN',
  35758. 'BN',
  35759. 'BN',
  35760. 'S',
  35761. 'B',
  35762. 'S',
  35763. 'WS',
  35764. 'B',
  35765. 'BN',
  35766. 'BN',
  35767. 'BN',
  35768. 'BN',
  35769. 'BN',
  35770. 'BN',
  35771. 'BN',
  35772. 'BN',
  35773. 'BN',
  35774. 'BN',
  35775. 'BN',
  35776. 'BN',
  35777. 'BN',
  35778. 'BN',
  35779. 'B',
  35780. 'B',
  35781. 'B',
  35782. 'S',
  35783. 'WS',
  35784. 'ON',
  35785. 'ON',
  35786. 'ET',
  35787. 'ET',
  35788. 'ET',
  35789. 'ON',
  35790. 'ON',
  35791. 'ON',
  35792. 'ON',
  35793. 'ON',
  35794. 'ES',
  35795. 'CS',
  35796. 'ES',
  35797. 'CS',
  35798. 'CS',
  35799. 'EN',
  35800. 'EN',
  35801. 'EN',
  35802. 'EN',
  35803. 'EN',
  35804. 'EN',
  35805. 'EN',
  35806. 'EN',
  35807. 'EN',
  35808. 'EN',
  35809. 'CS',
  35810. 'ON',
  35811. 'ON',
  35812. 'ON',
  35813. 'ON',
  35814. 'ON',
  35815. 'ON',
  35816. 'L',
  35817. 'L',
  35818. 'L',
  35819. 'L',
  35820. 'L',
  35821. 'L',
  35822. 'L',
  35823. 'L',
  35824. 'L',
  35825. 'L',
  35826. 'L',
  35827. 'L',
  35828. 'L',
  35829. 'L',
  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. 'ON',
  35843. 'ON',
  35844. 'ON',
  35845. 'ON',
  35846. 'ON',
  35847. 'ON',
  35848. 'L',
  35849. 'L',
  35850. 'L',
  35851. 'L',
  35852. 'L',
  35853. 'L',
  35854. 'L',
  35855. 'L',
  35856. 'L',
  35857. 'L',
  35858. 'L',
  35859. 'L',
  35860. 'L',
  35861. 'L',
  35862. 'L',
  35863. 'L',
  35864. 'L',
  35865. 'L',
  35866. 'L',
  35867. 'L',
  35868. 'L',
  35869. 'L',
  35870. 'L',
  35871. 'L',
  35872. 'L',
  35873. 'L',
  35874. 'ON',
  35875. 'ON',
  35876. 'ON',
  35877. 'ON',
  35878. 'BN',
  35879. 'BN',
  35880. 'BN',
  35881. 'BN',
  35882. 'BN',
  35883. 'BN',
  35884. 'B',
  35885. 'BN',
  35886. 'BN',
  35887. 'BN',
  35888. 'BN',
  35889. 'BN',
  35890. 'BN',
  35891. 'BN',
  35892. 'BN',
  35893. 'BN',
  35894. 'BN',
  35895. 'BN',
  35896. 'BN',
  35897. 'BN',
  35898. 'BN',
  35899. 'BN',
  35900. 'BN',
  35901. 'BN',
  35902. 'BN',
  35903. 'BN',
  35904. 'BN',
  35905. 'BN',
  35906. 'BN',
  35907. 'BN',
  35908. 'BN',
  35909. 'BN',
  35910. 'BN',
  35911. 'CS',
  35912. 'ON',
  35913. 'ET',
  35914. 'ET',
  35915. 'ET',
  35916. 'ET',
  35917. 'ON',
  35918. 'ON',
  35919. 'ON',
  35920. 'ON',
  35921. 'L',
  35922. 'ON',
  35923. 'ON',
  35924. 'BN',
  35925. 'ON',
  35926. 'ON',
  35927. 'ET',
  35928. 'ET',
  35929. 'EN',
  35930. 'EN',
  35931. 'ON',
  35932. 'L',
  35933. 'ON',
  35934. 'ON',
  35935. 'ON',
  35936. 'EN',
  35937. 'L',
  35938. 'ON',
  35939. 'ON',
  35940. 'ON',
  35941. 'ON',
  35942. 'ON',
  35943. 'L',
  35944. 'L',
  35945. 'L',
  35946. 'L',
  35947. 'L',
  35948. 'L',
  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. 'ON',
  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. 'L',
  35981. 'L',
  35982. 'L',
  35983. 'L',
  35984. 'L',
  35985. 'L',
  35986. 'L',
  35987. 'L',
  35988. 'L',
  35989. 'L',
  35990. 'L',
  35991. 'L',
  35992. 'L',
  35993. 'L',
  35994. 'L',
  35995. 'L',
  35996. 'L',
  35997. 'L',
  35998. 'ON',
  35999. 'L',
  36000. 'L',
  36001. 'L',
  36002. 'L',
  36003. 'L',
  36004. 'L',
  36005. 'L',
  36006. 'L'
  36007. ];
  36008. var arabicTypes = [
  36009. 'AN',
  36010. 'AN',
  36011. 'AN',
  36012. 'AN',
  36013. 'AN',
  36014. 'AN',
  36015. 'ON',
  36016. 'ON',
  36017. 'AL',
  36018. 'ET',
  36019. 'ET',
  36020. 'AL',
  36021. 'CS',
  36022. 'AL',
  36023. 'ON',
  36024. 'ON',
  36025. 'NSM',
  36026. 'NSM',
  36027. 'NSM',
  36028. 'NSM',
  36029. 'NSM',
  36030. 'NSM',
  36031. 'NSM',
  36032. 'NSM',
  36033. 'NSM',
  36034. 'NSM',
  36035. 'NSM',
  36036. 'AL',
  36037. 'AL',
  36038. '',
  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. 'AL',
  36067. 'AL',
  36068. 'AL',
  36069. 'AL',
  36070. 'AL',
  36071. 'AL',
  36072. 'AL',
  36073. 'AL',
  36074. 'AL',
  36075. 'AL',
  36076. 'AL',
  36077. 'AL',
  36078. 'AL',
  36079. 'AL',
  36080. 'AL',
  36081. 'AL',
  36082. 'AL',
  36083. 'AL',
  36084. 'NSM',
  36085. 'NSM',
  36086. 'NSM',
  36087. 'NSM',
  36088. 'NSM',
  36089. 'NSM',
  36090. 'NSM',
  36091. 'NSM',
  36092. 'NSM',
  36093. 'NSM',
  36094. 'NSM',
  36095. 'NSM',
  36096. 'NSM',
  36097. 'NSM',
  36098. 'NSM',
  36099. 'NSM',
  36100. 'NSM',
  36101. 'NSM',
  36102. 'NSM',
  36103. 'NSM',
  36104. 'NSM',
  36105. 'AN',
  36106. 'AN',
  36107. 'AN',
  36108. 'AN',
  36109. 'AN',
  36110. 'AN',
  36111. 'AN',
  36112. 'AN',
  36113. 'AN',
  36114. 'AN',
  36115. 'ET',
  36116. 'AN',
  36117. 'AN',
  36118. 'AL',
  36119. 'AL',
  36120. 'AL',
  36121. 'NSM',
  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. 'AL',
  36206. 'AL',
  36207. 'AL',
  36208. 'AL',
  36209. 'AL',
  36210. 'AL',
  36211. 'AL',
  36212. 'AL',
  36213. 'AL',
  36214. 'AL',
  36215. 'AL',
  36216. 'AL',
  36217. 'AL',
  36218. 'AL',
  36219. 'AL',
  36220. 'AL',
  36221. 'AL',
  36222. 'AL',
  36223. 'NSM',
  36224. 'NSM',
  36225. 'NSM',
  36226. 'NSM',
  36227. 'NSM',
  36228. 'NSM',
  36229. 'NSM',
  36230. 'AN',
  36231. 'ON',
  36232. 'NSM',
  36233. 'NSM',
  36234. 'NSM',
  36235. 'NSM',
  36236. 'NSM',
  36237. 'NSM',
  36238. 'AL',
  36239. 'AL',
  36240. 'NSM',
  36241. 'NSM',
  36242. 'ON',
  36243. 'NSM',
  36244. 'NSM',
  36245. 'NSM',
  36246. 'NSM',
  36247. 'AL',
  36248. 'AL',
  36249. 'EN',
  36250. 'EN',
  36251. 'EN',
  36252. 'EN',
  36253. 'EN',
  36254. 'EN',
  36255. 'EN',
  36256. 'EN',
  36257. 'EN',
  36258. 'EN',
  36259. 'AL',
  36260. 'AL',
  36261. 'AL',
  36262. 'AL',
  36263. 'AL',
  36264. 'AL'
  36265. ];
  36266. function isOdd(i) {
  36267. return (i & 1) !== 0;
  36268. }
  36269. function isEven(i) {
  36270. return (i & 1) === 0;
  36271. }
  36272. function findUnequal(arr, start, value) {
  36273. for (var j = start, jj = arr.length; j < jj; ++j) {
  36274. if (arr[j] !== value) {
  36275. return j;
  36276. }
  36277. }
  36278. return j;
  36279. }
  36280. function setValues(arr, start, end, value) {
  36281. for (var j = start; j < end; ++j) {
  36282. arr[j] = value;
  36283. }
  36284. }
  36285. function reverseValues(arr, start, end) {
  36286. for (var i = start, j = end - 1; i < j; ++i, --j) {
  36287. var temp = arr[i];
  36288. arr[i] = arr[j];
  36289. arr[j] = temp;
  36290. }
  36291. }
  36292. function createBidiText(str, isLTR, vertical) {
  36293. return {
  36294. str: str,
  36295. dir: vertical ? 'ttb' : isLTR ? 'ltr' : 'rtl'
  36296. };
  36297. }
  36298. var chars = [];
  36299. var types = [];
  36300. function bidi(str, startLevel, vertical) {
  36301. var isLTR = true;
  36302. var strLength = str.length;
  36303. if (strLength === 0 || vertical) {
  36304. return createBidiText(str, isLTR, vertical);
  36305. }
  36306. chars.length = strLength;
  36307. types.length = strLength;
  36308. var numBidi = 0;
  36309. var i, ii;
  36310. for (i = 0; i < strLength; ++i) {
  36311. chars[i] = str.charAt(i);
  36312. var charCode = str.charCodeAt(i);
  36313. var charType = 'L';
  36314. if (charCode <= 0x00ff) {
  36315. charType = baseTypes[charCode];
  36316. } else if (0x0590 <= charCode && charCode <= 0x05f4) {
  36317. charType = 'R';
  36318. } else if (0x0600 <= charCode && charCode <= 0x06ff) {
  36319. charType = arabicTypes[charCode & 0xff];
  36320. if (!charType) {
  36321. warn('Bidi: invalid Unicode character ' + charCode.toString(16));
  36322. }
  36323. } else if (0x0700 <= charCode && charCode <= 0x08AC) {
  36324. charType = 'AL';
  36325. }
  36326. if (charType === 'R' || charType === 'AL' || charType === 'AN') {
  36327. numBidi++;
  36328. }
  36329. types[i] = charType;
  36330. }
  36331. if (numBidi === 0) {
  36332. isLTR = true;
  36333. return createBidiText(str, isLTR);
  36334. }
  36335. if (startLevel === -1) {
  36336. if (numBidi / strLength < 0.3) {
  36337. isLTR = true;
  36338. startLevel = 0;
  36339. } else {
  36340. isLTR = false;
  36341. startLevel = 1;
  36342. }
  36343. }
  36344. var levels = [];
  36345. for (i = 0; i < strLength; ++i) {
  36346. levels[i] = startLevel;
  36347. }
  36348. var e = isOdd(startLevel) ? 'R' : 'L';
  36349. var sor = e;
  36350. var eor = sor;
  36351. var lastType = sor;
  36352. for (i = 0; i < strLength; ++i) {
  36353. if (types[i] === 'NSM') {
  36354. types[i] = lastType;
  36355. } else {
  36356. lastType = types[i];
  36357. }
  36358. }
  36359. lastType = sor;
  36360. var t;
  36361. for (i = 0; i < strLength; ++i) {
  36362. t = types[i];
  36363. if (t === 'EN') {
  36364. types[i] = lastType === 'AL' ? 'AN' : 'EN';
  36365. } else if (t === 'R' || t === 'L' || t === 'AL') {
  36366. lastType = t;
  36367. }
  36368. }
  36369. for (i = 0; i < strLength; ++i) {
  36370. t = types[i];
  36371. if (t === 'AL') {
  36372. types[i] = 'R';
  36373. }
  36374. }
  36375. for (i = 1; i < strLength - 1; ++i) {
  36376. if (types[i] === 'ES' && types[i - 1] === 'EN' && types[i + 1] === 'EN') {
  36377. types[i] = 'EN';
  36378. }
  36379. if (types[i] === 'CS' && (types[i - 1] === 'EN' || types[i - 1] === 'AN') && types[i + 1] === types[i - 1]) {
  36380. types[i] = types[i - 1];
  36381. }
  36382. }
  36383. for (i = 0; i < strLength; ++i) {
  36384. if (types[i] === 'EN') {
  36385. var j;
  36386. for (j = i - 1; j >= 0; --j) {
  36387. if (types[j] !== 'ET') {
  36388. break;
  36389. }
  36390. types[j] = 'EN';
  36391. }
  36392. for (j = i + 1; j < strLength; ++j) {
  36393. if (types[j] !== 'ET') {
  36394. break;
  36395. }
  36396. types[j] = 'EN';
  36397. }
  36398. }
  36399. }
  36400. for (i = 0; i < strLength; ++i) {
  36401. t = types[i];
  36402. if (t === 'WS' || t === 'ES' || t === 'ET' || t === 'CS') {
  36403. types[i] = 'ON';
  36404. }
  36405. }
  36406. lastType = sor;
  36407. for (i = 0; i < strLength; ++i) {
  36408. t = types[i];
  36409. if (t === 'EN') {
  36410. types[i] = lastType === 'L' ? 'L' : 'EN';
  36411. } else if (t === 'R' || t === 'L') {
  36412. lastType = t;
  36413. }
  36414. }
  36415. for (i = 0; i < strLength; ++i) {
  36416. if (types[i] === 'ON') {
  36417. var end = findUnequal(types, i + 1, 'ON');
  36418. var before = sor;
  36419. if (i > 0) {
  36420. before = types[i - 1];
  36421. }
  36422. var after = eor;
  36423. if (end + 1 < strLength) {
  36424. after = types[end + 1];
  36425. }
  36426. if (before !== 'L') {
  36427. before = 'R';
  36428. }
  36429. if (after !== 'L') {
  36430. after = 'R';
  36431. }
  36432. if (before === after) {
  36433. setValues(types, i, end, before);
  36434. }
  36435. i = end - 1;
  36436. }
  36437. }
  36438. for (i = 0; i < strLength; ++i) {
  36439. if (types[i] === 'ON') {
  36440. types[i] = e;
  36441. }
  36442. }
  36443. for (i = 0; i < strLength; ++i) {
  36444. t = types[i];
  36445. if (isEven(levels[i])) {
  36446. if (t === 'R') {
  36447. levels[i] += 1;
  36448. } else if (t === 'AN' || t === 'EN') {
  36449. levels[i] += 2;
  36450. }
  36451. } else {
  36452. if (t === 'L' || t === 'AN' || t === 'EN') {
  36453. levels[i] += 1;
  36454. }
  36455. }
  36456. }
  36457. var highestLevel = -1;
  36458. var lowestOddLevel = 99;
  36459. var level;
  36460. for (i = 0, ii = levels.length; i < ii; ++i) {
  36461. level = levels[i];
  36462. if (highestLevel < level) {
  36463. highestLevel = level;
  36464. }
  36465. if (lowestOddLevel > level && isOdd(level)) {
  36466. lowestOddLevel = level;
  36467. }
  36468. }
  36469. for (level = highestLevel; level >= lowestOddLevel; --level) {
  36470. var start = -1;
  36471. for (i = 0, ii = levels.length; i < ii; ++i) {
  36472. if (levels[i] < level) {
  36473. if (start >= 0) {
  36474. reverseValues(chars, start, i);
  36475. start = -1;
  36476. }
  36477. } else if (start < 0) {
  36478. start = i;
  36479. }
  36480. }
  36481. if (start >= 0) {
  36482. reverseValues(chars, start, levels.length);
  36483. }
  36484. }
  36485. for (i = 0, ii = chars.length; i < ii; ++i) {
  36486. var ch = chars[i];
  36487. if (ch === '<' || ch === '>') {
  36488. chars[i] = '';
  36489. }
  36490. }
  36491. return createBidiText(chars.join(''), isLTR);
  36492. }
  36493. exports.bidi = bidi;
  36494. /***/ }),
  36495. /* 22 */
  36496. /***/ (function(module, exports, __w_pdfjs_require__) {
  36497. "use strict";
  36498. var ISOAdobeCharset = [
  36499. '.notdef',
  36500. 'space',
  36501. 'exclam',
  36502. 'quotedbl',
  36503. 'numbersign',
  36504. 'dollar',
  36505. 'percent',
  36506. 'ampersand',
  36507. 'quoteright',
  36508. 'parenleft',
  36509. 'parenright',
  36510. 'asterisk',
  36511. 'plus',
  36512. 'comma',
  36513. 'hyphen',
  36514. 'period',
  36515. 'slash',
  36516. 'zero',
  36517. 'one',
  36518. 'two',
  36519. 'three',
  36520. 'four',
  36521. 'five',
  36522. 'six',
  36523. 'seven',
  36524. 'eight',
  36525. 'nine',
  36526. 'colon',
  36527. 'semicolon',
  36528. 'less',
  36529. 'equal',
  36530. 'greater',
  36531. 'question',
  36532. 'at',
  36533. 'A',
  36534. 'B',
  36535. 'C',
  36536. 'D',
  36537. 'E',
  36538. 'F',
  36539. 'G',
  36540. 'H',
  36541. 'I',
  36542. 'J',
  36543. 'K',
  36544. 'L',
  36545. 'M',
  36546. 'N',
  36547. 'O',
  36548. 'P',
  36549. 'Q',
  36550. 'R',
  36551. 'S',
  36552. 'T',
  36553. 'U',
  36554. 'V',
  36555. 'W',
  36556. 'X',
  36557. 'Y',
  36558. 'Z',
  36559. 'bracketleft',
  36560. 'backslash',
  36561. 'bracketright',
  36562. 'asciicircum',
  36563. 'underscore',
  36564. 'quoteleft',
  36565. 'a',
  36566. 'b',
  36567. 'c',
  36568. 'd',
  36569. 'e',
  36570. 'f',
  36571. 'g',
  36572. 'h',
  36573. 'i',
  36574. 'j',
  36575. 'k',
  36576. 'l',
  36577. 'm',
  36578. 'n',
  36579. 'o',
  36580. 'p',
  36581. 'q',
  36582. 'r',
  36583. 's',
  36584. 't',
  36585. 'u',
  36586. 'v',
  36587. 'w',
  36588. 'x',
  36589. 'y',
  36590. 'z',
  36591. 'braceleft',
  36592. 'bar',
  36593. 'braceright',
  36594. 'asciitilde',
  36595. 'exclamdown',
  36596. 'cent',
  36597. 'sterling',
  36598. 'fraction',
  36599. 'yen',
  36600. 'florin',
  36601. 'section',
  36602. 'currency',
  36603. 'quotesingle',
  36604. 'quotedblleft',
  36605. 'guillemotleft',
  36606. 'guilsinglleft',
  36607. 'guilsinglright',
  36608. 'fi',
  36609. 'fl',
  36610. 'endash',
  36611. 'dagger',
  36612. 'daggerdbl',
  36613. 'periodcentered',
  36614. 'paragraph',
  36615. 'bullet',
  36616. 'quotesinglbase',
  36617. 'quotedblbase',
  36618. 'quotedblright',
  36619. 'guillemotright',
  36620. 'ellipsis',
  36621. 'perthousand',
  36622. 'questiondown',
  36623. 'grave',
  36624. 'acute',
  36625. 'circumflex',
  36626. 'tilde',
  36627. 'macron',
  36628. 'breve',
  36629. 'dotaccent',
  36630. 'dieresis',
  36631. 'ring',
  36632. 'cedilla',
  36633. 'hungarumlaut',
  36634. 'ogonek',
  36635. 'caron',
  36636. 'emdash',
  36637. 'AE',
  36638. 'ordfeminine',
  36639. 'Lslash',
  36640. 'Oslash',
  36641. 'OE',
  36642. 'ordmasculine',
  36643. 'ae',
  36644. 'dotlessi',
  36645. 'lslash',
  36646. 'oslash',
  36647. 'oe',
  36648. 'germandbls',
  36649. 'onesuperior',
  36650. 'logicalnot',
  36651. 'mu',
  36652. 'trademark',
  36653. 'Eth',
  36654. 'onehalf',
  36655. 'plusminus',
  36656. 'Thorn',
  36657. 'onequarter',
  36658. 'divide',
  36659. 'brokenbar',
  36660. 'degree',
  36661. 'thorn',
  36662. 'threequarters',
  36663. 'twosuperior',
  36664. 'registered',
  36665. 'minus',
  36666. 'eth',
  36667. 'multiply',
  36668. 'threesuperior',
  36669. 'copyright',
  36670. 'Aacute',
  36671. 'Acircumflex',
  36672. 'Adieresis',
  36673. 'Agrave',
  36674. 'Aring',
  36675. 'Atilde',
  36676. 'Ccedilla',
  36677. 'Eacute',
  36678. 'Ecircumflex',
  36679. 'Edieresis',
  36680. 'Egrave',
  36681. 'Iacute',
  36682. 'Icircumflex',
  36683. 'Idieresis',
  36684. 'Igrave',
  36685. 'Ntilde',
  36686. 'Oacute',
  36687. 'Ocircumflex',
  36688. 'Odieresis',
  36689. 'Ograve',
  36690. 'Otilde',
  36691. 'Scaron',
  36692. 'Uacute',
  36693. 'Ucircumflex',
  36694. 'Udieresis',
  36695. 'Ugrave',
  36696. 'Yacute',
  36697. 'Ydieresis',
  36698. 'Zcaron',
  36699. 'aacute',
  36700. 'acircumflex',
  36701. 'adieresis',
  36702. 'agrave',
  36703. 'aring',
  36704. 'atilde',
  36705. 'ccedilla',
  36706. 'eacute',
  36707. 'ecircumflex',
  36708. 'edieresis',
  36709. 'egrave',
  36710. 'iacute',
  36711. 'icircumflex',
  36712. 'idieresis',
  36713. 'igrave',
  36714. 'ntilde',
  36715. 'oacute',
  36716. 'ocircumflex',
  36717. 'odieresis',
  36718. 'ograve',
  36719. 'otilde',
  36720. 'scaron',
  36721. 'uacute',
  36722. 'ucircumflex',
  36723. 'udieresis',
  36724. 'ugrave',
  36725. 'yacute',
  36726. 'ydieresis',
  36727. 'zcaron'
  36728. ];
  36729. var ExpertCharset = [
  36730. '.notdef',
  36731. 'space',
  36732. 'exclamsmall',
  36733. 'Hungarumlautsmall',
  36734. 'dollaroldstyle',
  36735. 'dollarsuperior',
  36736. 'ampersandsmall',
  36737. 'Acutesmall',
  36738. 'parenleftsuperior',
  36739. 'parenrightsuperior',
  36740. 'twodotenleader',
  36741. 'onedotenleader',
  36742. 'comma',
  36743. 'hyphen',
  36744. 'period',
  36745. 'fraction',
  36746. 'zerooldstyle',
  36747. 'oneoldstyle',
  36748. 'twooldstyle',
  36749. 'threeoldstyle',
  36750. 'fouroldstyle',
  36751. 'fiveoldstyle',
  36752. 'sixoldstyle',
  36753. 'sevenoldstyle',
  36754. 'eightoldstyle',
  36755. 'nineoldstyle',
  36756. 'colon',
  36757. 'semicolon',
  36758. 'commasuperior',
  36759. 'threequartersemdash',
  36760. 'periodsuperior',
  36761. 'questionsmall',
  36762. 'asuperior',
  36763. 'bsuperior',
  36764. 'centsuperior',
  36765. 'dsuperior',
  36766. 'esuperior',
  36767. 'isuperior',
  36768. 'lsuperior',
  36769. 'msuperior',
  36770. 'nsuperior',
  36771. 'osuperior',
  36772. 'rsuperior',
  36773. 'ssuperior',
  36774. 'tsuperior',
  36775. 'ff',
  36776. 'fi',
  36777. 'fl',
  36778. 'ffi',
  36779. 'ffl',
  36780. 'parenleftinferior',
  36781. 'parenrightinferior',
  36782. 'Circumflexsmall',
  36783. 'hyphensuperior',
  36784. 'Gravesmall',
  36785. 'Asmall',
  36786. 'Bsmall',
  36787. 'Csmall',
  36788. 'Dsmall',
  36789. 'Esmall',
  36790. 'Fsmall',
  36791. 'Gsmall',
  36792. 'Hsmall',
  36793. 'Ismall',
  36794. 'Jsmall',
  36795. 'Ksmall',
  36796. 'Lsmall',
  36797. 'Msmall',
  36798. 'Nsmall',
  36799. 'Osmall',
  36800. 'Psmall',
  36801. 'Qsmall',
  36802. 'Rsmall',
  36803. 'Ssmall',
  36804. 'Tsmall',
  36805. 'Usmall',
  36806. 'Vsmall',
  36807. 'Wsmall',
  36808. 'Xsmall',
  36809. 'Ysmall',
  36810. 'Zsmall',
  36811. 'colonmonetary',
  36812. 'onefitted',
  36813. 'rupiah',
  36814. 'Tildesmall',
  36815. 'exclamdownsmall',
  36816. 'centoldstyle',
  36817. 'Lslashsmall',
  36818. 'Scaronsmall',
  36819. 'Zcaronsmall',
  36820. 'Dieresissmall',
  36821. 'Brevesmall',
  36822. 'Caronsmall',
  36823. 'Dotaccentsmall',
  36824. 'Macronsmall',
  36825. 'figuredash',
  36826. 'hypheninferior',
  36827. 'Ogoneksmall',
  36828. 'Ringsmall',
  36829. 'Cedillasmall',
  36830. 'onequarter',
  36831. 'onehalf',
  36832. 'threequarters',
  36833. 'questiondownsmall',
  36834. 'oneeighth',
  36835. 'threeeighths',
  36836. 'fiveeighths',
  36837. 'seveneighths',
  36838. 'onethird',
  36839. 'twothirds',
  36840. 'zerosuperior',
  36841. 'onesuperior',
  36842. 'twosuperior',
  36843. 'threesuperior',
  36844. 'foursuperior',
  36845. 'fivesuperior',
  36846. 'sixsuperior',
  36847. 'sevensuperior',
  36848. 'eightsuperior',
  36849. 'ninesuperior',
  36850. 'zeroinferior',
  36851. 'oneinferior',
  36852. 'twoinferior',
  36853. 'threeinferior',
  36854. 'fourinferior',
  36855. 'fiveinferior',
  36856. 'sixinferior',
  36857. 'seveninferior',
  36858. 'eightinferior',
  36859. 'nineinferior',
  36860. 'centinferior',
  36861. 'dollarinferior',
  36862. 'periodinferior',
  36863. 'commainferior',
  36864. 'Agravesmall',
  36865. 'Aacutesmall',
  36866. 'Acircumflexsmall',
  36867. 'Atildesmall',
  36868. 'Adieresissmall',
  36869. 'Aringsmall',
  36870. 'AEsmall',
  36871. 'Ccedillasmall',
  36872. 'Egravesmall',
  36873. 'Eacutesmall',
  36874. 'Ecircumflexsmall',
  36875. 'Edieresissmall',
  36876. 'Igravesmall',
  36877. 'Iacutesmall',
  36878. 'Icircumflexsmall',
  36879. 'Idieresissmall',
  36880. 'Ethsmall',
  36881. 'Ntildesmall',
  36882. 'Ogravesmall',
  36883. 'Oacutesmall',
  36884. 'Ocircumflexsmall',
  36885. 'Otildesmall',
  36886. 'Odieresissmall',
  36887. 'OEsmall',
  36888. 'Oslashsmall',
  36889. 'Ugravesmall',
  36890. 'Uacutesmall',
  36891. 'Ucircumflexsmall',
  36892. 'Udieresissmall',
  36893. 'Yacutesmall',
  36894. 'Thornsmall',
  36895. 'Ydieresissmall'
  36896. ];
  36897. var ExpertSubsetCharset = [
  36898. '.notdef',
  36899. 'space',
  36900. 'dollaroldstyle',
  36901. 'dollarsuperior',
  36902. 'parenleftsuperior',
  36903. 'parenrightsuperior',
  36904. 'twodotenleader',
  36905. 'onedotenleader',
  36906. 'comma',
  36907. 'hyphen',
  36908. 'period',
  36909. 'fraction',
  36910. 'zerooldstyle',
  36911. 'oneoldstyle',
  36912. 'twooldstyle',
  36913. 'threeoldstyle',
  36914. 'fouroldstyle',
  36915. 'fiveoldstyle',
  36916. 'sixoldstyle',
  36917. 'sevenoldstyle',
  36918. 'eightoldstyle',
  36919. 'nineoldstyle',
  36920. 'colon',
  36921. 'semicolon',
  36922. 'commasuperior',
  36923. 'threequartersemdash',
  36924. 'periodsuperior',
  36925. 'asuperior',
  36926. 'bsuperior',
  36927. 'centsuperior',
  36928. 'dsuperior',
  36929. 'esuperior',
  36930. 'isuperior',
  36931. 'lsuperior',
  36932. 'msuperior',
  36933. 'nsuperior',
  36934. 'osuperior',
  36935. 'rsuperior',
  36936. 'ssuperior',
  36937. 'tsuperior',
  36938. 'ff',
  36939. 'fi',
  36940. 'fl',
  36941. 'ffi',
  36942. 'ffl',
  36943. 'parenleftinferior',
  36944. 'parenrightinferior',
  36945. 'hyphensuperior',
  36946. 'colonmonetary',
  36947. 'onefitted',
  36948. 'rupiah',
  36949. 'centoldstyle',
  36950. 'figuredash',
  36951. 'hypheninferior',
  36952. 'onequarter',
  36953. 'onehalf',
  36954. 'threequarters',
  36955. 'oneeighth',
  36956. 'threeeighths',
  36957. 'fiveeighths',
  36958. 'seveneighths',
  36959. 'onethird',
  36960. 'twothirds',
  36961. 'zerosuperior',
  36962. 'onesuperior',
  36963. 'twosuperior',
  36964. 'threesuperior',
  36965. 'foursuperior',
  36966. 'fivesuperior',
  36967. 'sixsuperior',
  36968. 'sevensuperior',
  36969. 'eightsuperior',
  36970. 'ninesuperior',
  36971. 'zeroinferior',
  36972. 'oneinferior',
  36973. 'twoinferior',
  36974. 'threeinferior',
  36975. 'fourinferior',
  36976. 'fiveinferior',
  36977. 'sixinferior',
  36978. 'seveninferior',
  36979. 'eightinferior',
  36980. 'nineinferior',
  36981. 'centinferior',
  36982. 'dollarinferior',
  36983. 'periodinferior',
  36984. 'commainferior'
  36985. ];
  36986. exports.ISOAdobeCharset = ISOAdobeCharset;
  36987. exports.ExpertCharset = ExpertCharset;
  36988. exports.ExpertSubsetCharset = ExpertSubsetCharset;
  36989. /***/ }),
  36990. /* 23 */
  36991. /***/ (function(module, exports, __w_pdfjs_require__) {
  36992. "use strict";
  36993. var sharedUtil = __w_pdfjs_require__(0);
  36994. var corePrimitives = __w_pdfjs_require__(1);
  36995. var coreStream = __w_pdfjs_require__(2);
  36996. var coreParser = __w_pdfjs_require__(5);
  36997. var Util = sharedUtil.Util;
  36998. var assert = sharedUtil.assert;
  36999. var warn = sharedUtil.warn;
  37000. var error = sharedUtil.error;
  37001. var isInt = sharedUtil.isInt;
  37002. var isString = sharedUtil.isString;
  37003. var MissingDataException = sharedUtil.MissingDataException;
  37004. var CMapCompressionType = sharedUtil.CMapCompressionType;
  37005. var isEOF = corePrimitives.isEOF;
  37006. var isName = corePrimitives.isName;
  37007. var isCmd = corePrimitives.isCmd;
  37008. var isStream = corePrimitives.isStream;
  37009. var Stream = coreStream.Stream;
  37010. var Lexer = coreParser.Lexer;
  37011. var BUILT_IN_CMAPS = [
  37012. 'Adobe-GB1-UCS2',
  37013. 'Adobe-CNS1-UCS2',
  37014. 'Adobe-Japan1-UCS2',
  37015. 'Adobe-Korea1-UCS2',
  37016. '78-EUC-H',
  37017. '78-EUC-V',
  37018. '78-H',
  37019. '78-RKSJ-H',
  37020. '78-RKSJ-V',
  37021. '78-V',
  37022. '78ms-RKSJ-H',
  37023. '78ms-RKSJ-V',
  37024. '83pv-RKSJ-H',
  37025. '90ms-RKSJ-H',
  37026. '90ms-RKSJ-V',
  37027. '90msp-RKSJ-H',
  37028. '90msp-RKSJ-V',
  37029. '90pv-RKSJ-H',
  37030. '90pv-RKSJ-V',
  37031. 'Add-H',
  37032. 'Add-RKSJ-H',
  37033. 'Add-RKSJ-V',
  37034. 'Add-V',
  37035. 'Adobe-CNS1-0',
  37036. 'Adobe-CNS1-1',
  37037. 'Adobe-CNS1-2',
  37038. 'Adobe-CNS1-3',
  37039. 'Adobe-CNS1-4',
  37040. 'Adobe-CNS1-5',
  37041. 'Adobe-CNS1-6',
  37042. 'Adobe-GB1-0',
  37043. 'Adobe-GB1-1',
  37044. 'Adobe-GB1-2',
  37045. 'Adobe-GB1-3',
  37046. 'Adobe-GB1-4',
  37047. 'Adobe-GB1-5',
  37048. 'Adobe-Japan1-0',
  37049. 'Adobe-Japan1-1',
  37050. 'Adobe-Japan1-2',
  37051. 'Adobe-Japan1-3',
  37052. 'Adobe-Japan1-4',
  37053. 'Adobe-Japan1-5',
  37054. 'Adobe-Japan1-6',
  37055. 'Adobe-Korea1-0',
  37056. 'Adobe-Korea1-1',
  37057. 'Adobe-Korea1-2',
  37058. 'B5-H',
  37059. 'B5-V',
  37060. 'B5pc-H',
  37061. 'B5pc-V',
  37062. 'CNS-EUC-H',
  37063. 'CNS-EUC-V',
  37064. 'CNS1-H',
  37065. 'CNS1-V',
  37066. 'CNS2-H',
  37067. 'CNS2-V',
  37068. 'ETHK-B5-H',
  37069. 'ETHK-B5-V',
  37070. 'ETen-B5-H',
  37071. 'ETen-B5-V',
  37072. 'ETenms-B5-H',
  37073. 'ETenms-B5-V',
  37074. 'EUC-H',
  37075. 'EUC-V',
  37076. 'Ext-H',
  37077. 'Ext-RKSJ-H',
  37078. 'Ext-RKSJ-V',
  37079. 'Ext-V',
  37080. 'GB-EUC-H',
  37081. 'GB-EUC-V',
  37082. 'GB-H',
  37083. 'GB-V',
  37084. 'GBK-EUC-H',
  37085. 'GBK-EUC-V',
  37086. 'GBK2K-H',
  37087. 'GBK2K-V',
  37088. 'GBKp-EUC-H',
  37089. 'GBKp-EUC-V',
  37090. 'GBT-EUC-H',
  37091. 'GBT-EUC-V',
  37092. 'GBT-H',
  37093. 'GBT-V',
  37094. 'GBTpc-EUC-H',
  37095. 'GBTpc-EUC-V',
  37096. 'GBpc-EUC-H',
  37097. 'GBpc-EUC-V',
  37098. 'H',
  37099. 'HKdla-B5-H',
  37100. 'HKdla-B5-V',
  37101. 'HKdlb-B5-H',
  37102. 'HKdlb-B5-V',
  37103. 'HKgccs-B5-H',
  37104. 'HKgccs-B5-V',
  37105. 'HKm314-B5-H',
  37106. 'HKm314-B5-V',
  37107. 'HKm471-B5-H',
  37108. 'HKm471-B5-V',
  37109. 'HKscs-B5-H',
  37110. 'HKscs-B5-V',
  37111. 'Hankaku',
  37112. 'Hiragana',
  37113. 'KSC-EUC-H',
  37114. 'KSC-EUC-V',
  37115. 'KSC-H',
  37116. 'KSC-Johab-H',
  37117. 'KSC-Johab-V',
  37118. 'KSC-V',
  37119. 'KSCms-UHC-H',
  37120. 'KSCms-UHC-HW-H',
  37121. 'KSCms-UHC-HW-V',
  37122. 'KSCms-UHC-V',
  37123. 'KSCpc-EUC-H',
  37124. 'KSCpc-EUC-V',
  37125. 'Katakana',
  37126. 'NWP-H',
  37127. 'NWP-V',
  37128. 'RKSJ-H',
  37129. 'RKSJ-V',
  37130. 'Roman',
  37131. 'UniCNS-UCS2-H',
  37132. 'UniCNS-UCS2-V',
  37133. 'UniCNS-UTF16-H',
  37134. 'UniCNS-UTF16-V',
  37135. 'UniCNS-UTF32-H',
  37136. 'UniCNS-UTF32-V',
  37137. 'UniCNS-UTF8-H',
  37138. 'UniCNS-UTF8-V',
  37139. 'UniGB-UCS2-H',
  37140. 'UniGB-UCS2-V',
  37141. 'UniGB-UTF16-H',
  37142. 'UniGB-UTF16-V',
  37143. 'UniGB-UTF32-H',
  37144. 'UniGB-UTF32-V',
  37145. 'UniGB-UTF8-H',
  37146. 'UniGB-UTF8-V',
  37147. 'UniJIS-UCS2-H',
  37148. 'UniJIS-UCS2-HW-H',
  37149. 'UniJIS-UCS2-HW-V',
  37150. 'UniJIS-UCS2-V',
  37151. 'UniJIS-UTF16-H',
  37152. 'UniJIS-UTF16-V',
  37153. 'UniJIS-UTF32-H',
  37154. 'UniJIS-UTF32-V',
  37155. 'UniJIS-UTF8-H',
  37156. 'UniJIS-UTF8-V',
  37157. 'UniJIS2004-UTF16-H',
  37158. 'UniJIS2004-UTF16-V',
  37159. 'UniJIS2004-UTF32-H',
  37160. 'UniJIS2004-UTF32-V',
  37161. 'UniJIS2004-UTF8-H',
  37162. 'UniJIS2004-UTF8-V',
  37163. 'UniJISPro-UCS2-HW-V',
  37164. 'UniJISPro-UCS2-V',
  37165. 'UniJISPro-UTF8-V',
  37166. 'UniJISX0213-UTF32-H',
  37167. 'UniJISX0213-UTF32-V',
  37168. 'UniJISX02132004-UTF32-H',
  37169. 'UniJISX02132004-UTF32-V',
  37170. 'UniKS-UCS2-H',
  37171. 'UniKS-UCS2-V',
  37172. 'UniKS-UTF16-H',
  37173. 'UniKS-UTF16-V',
  37174. 'UniKS-UTF32-H',
  37175. 'UniKS-UTF32-V',
  37176. 'UniKS-UTF8-H',
  37177. 'UniKS-UTF8-V',
  37178. 'V',
  37179. 'WP-Symbol'
  37180. ];
  37181. var CMap = function CMapClosure() {
  37182. function CMap(builtInCMap) {
  37183. this.codespaceRanges = [
  37184. [],
  37185. [],
  37186. [],
  37187. []
  37188. ];
  37189. this.numCodespaceRanges = 0;
  37190. this._map = [];
  37191. this.name = '';
  37192. this.vertical = false;
  37193. this.useCMap = null;
  37194. this.builtInCMap = builtInCMap;
  37195. }
  37196. CMap.prototype = {
  37197. addCodespaceRange: function (n, low, high) {
  37198. this.codespaceRanges[n - 1].push(low, high);
  37199. this.numCodespaceRanges++;
  37200. },
  37201. mapCidRange: function (low, high, dstLow) {
  37202. while (low <= high) {
  37203. this._map[low++] = dstLow++;
  37204. }
  37205. },
  37206. mapBfRange: function (low, high, dstLow) {
  37207. var lastByte = dstLow.length - 1;
  37208. while (low <= high) {
  37209. this._map[low++] = dstLow;
  37210. dstLow = dstLow.substr(0, lastByte) + String.fromCharCode(dstLow.charCodeAt(lastByte) + 1);
  37211. }
  37212. },
  37213. mapBfRangeToArray: function (low, high, array) {
  37214. var i = 0, ii = array.length;
  37215. while (low <= high && i < ii) {
  37216. this._map[low] = array[i++];
  37217. ++low;
  37218. }
  37219. },
  37220. mapOne: function (src, dst) {
  37221. this._map[src] = dst;
  37222. },
  37223. lookup: function (code) {
  37224. return this._map[code];
  37225. },
  37226. contains: function (code) {
  37227. return this._map[code] !== undefined;
  37228. },
  37229. forEach: function (callback) {
  37230. var map = this._map;
  37231. var length = map.length;
  37232. var i;
  37233. if (length <= 0x10000) {
  37234. for (i = 0; i < length; i++) {
  37235. if (map[i] !== undefined) {
  37236. callback(i, map[i]);
  37237. }
  37238. }
  37239. } else {
  37240. for (i in this._map) {
  37241. callback(i, map[i]);
  37242. }
  37243. }
  37244. },
  37245. charCodeOf: function (value) {
  37246. return this._map.indexOf(value);
  37247. },
  37248. getMap: function () {
  37249. return this._map;
  37250. },
  37251. readCharCode: function (str, offset, out) {
  37252. var c = 0;
  37253. var codespaceRanges = this.codespaceRanges;
  37254. var codespaceRangesLen = this.codespaceRanges.length;
  37255. for (var n = 0; n < codespaceRangesLen; n++) {
  37256. c = (c << 8 | str.charCodeAt(offset + n)) >>> 0;
  37257. var codespaceRange = codespaceRanges[n];
  37258. for (var k = 0, kk = codespaceRange.length; k < kk;) {
  37259. var low = codespaceRange[k++];
  37260. var high = codespaceRange[k++];
  37261. if (c >= low && c <= high) {
  37262. out.charcode = c;
  37263. out.length = n + 1;
  37264. return;
  37265. }
  37266. }
  37267. }
  37268. out.charcode = 0;
  37269. out.length = 1;
  37270. },
  37271. get length() {
  37272. return this._map.length;
  37273. },
  37274. get isIdentityCMap() {
  37275. if (!(this.name === 'Identity-H' || this.name === 'Identity-V')) {
  37276. return false;
  37277. }
  37278. if (this._map.length !== 0x10000) {
  37279. return false;
  37280. }
  37281. for (var i = 0; i < 0x10000; i++) {
  37282. if (this._map[i] !== i) {
  37283. return false;
  37284. }
  37285. }
  37286. return true;
  37287. }
  37288. };
  37289. return CMap;
  37290. }();
  37291. var IdentityCMap = function IdentityCMapClosure() {
  37292. function IdentityCMap(vertical, n) {
  37293. CMap.call(this);
  37294. this.vertical = vertical;
  37295. this.addCodespaceRange(n, 0, 0xffff);
  37296. }
  37297. Util.inherit(IdentityCMap, CMap, {});
  37298. IdentityCMap.prototype = {
  37299. addCodespaceRange: CMap.prototype.addCodespaceRange,
  37300. mapCidRange: function (low, high, dstLow) {
  37301. error('should not call mapCidRange');
  37302. },
  37303. mapBfRange: function (low, high, dstLow) {
  37304. error('should not call mapBfRange');
  37305. },
  37306. mapBfRangeToArray: function (low, high, array) {
  37307. error('should not call mapBfRangeToArray');
  37308. },
  37309. mapOne: function (src, dst) {
  37310. error('should not call mapCidOne');
  37311. },
  37312. lookup: function (code) {
  37313. return isInt(code) && code <= 0xffff ? code : undefined;
  37314. },
  37315. contains: function (code) {
  37316. return isInt(code) && code <= 0xffff;
  37317. },
  37318. forEach: function (callback) {
  37319. for (var i = 0; i <= 0xffff; i++) {
  37320. callback(i, i);
  37321. }
  37322. },
  37323. charCodeOf: function (value) {
  37324. return isInt(value) && value <= 0xffff ? value : -1;
  37325. },
  37326. getMap: function () {
  37327. var map = new Array(0x10000);
  37328. for (var i = 0; i <= 0xffff; i++) {
  37329. map[i] = i;
  37330. }
  37331. return map;
  37332. },
  37333. readCharCode: CMap.prototype.readCharCode,
  37334. get length() {
  37335. return 0x10000;
  37336. },
  37337. get isIdentityCMap() {
  37338. error('should not access .isIdentityCMap');
  37339. }
  37340. };
  37341. return IdentityCMap;
  37342. }();
  37343. var BinaryCMapReader = function BinaryCMapReaderClosure() {
  37344. function hexToInt(a, size) {
  37345. var n = 0;
  37346. for (var i = 0; i <= size; i++) {
  37347. n = n << 8 | a[i];
  37348. }
  37349. return n >>> 0;
  37350. }
  37351. function hexToStr(a, size) {
  37352. if (size === 1) {
  37353. return String.fromCharCode(a[0], a[1]);
  37354. }
  37355. if (size === 3) {
  37356. return String.fromCharCode(a[0], a[1], a[2], a[3]);
  37357. }
  37358. return String.fromCharCode.apply(null, a.subarray(0, size + 1));
  37359. }
  37360. function addHex(a, b, size) {
  37361. var c = 0;
  37362. for (var i = size; i >= 0; i--) {
  37363. c += a[i] + b[i];
  37364. a[i] = c & 255;
  37365. c >>= 8;
  37366. }
  37367. }
  37368. function incHex(a, size) {
  37369. var c = 1;
  37370. for (var i = size; i >= 0 && c > 0; i--) {
  37371. c += a[i];
  37372. a[i] = c & 255;
  37373. c >>= 8;
  37374. }
  37375. }
  37376. var MAX_NUM_SIZE = 16;
  37377. var MAX_ENCODED_NUM_SIZE = 19;
  37378. function BinaryCMapStream(data) {
  37379. this.buffer = data;
  37380. this.pos = 0;
  37381. this.end = data.length;
  37382. this.tmpBuf = new Uint8Array(MAX_ENCODED_NUM_SIZE);
  37383. }
  37384. BinaryCMapStream.prototype = {
  37385. readByte: function () {
  37386. if (this.pos >= this.end) {
  37387. return -1;
  37388. }
  37389. return this.buffer[this.pos++];
  37390. },
  37391. readNumber: function () {
  37392. var n = 0;
  37393. var last;
  37394. do {
  37395. var b = this.readByte();
  37396. if (b < 0) {
  37397. error('unexpected EOF in bcmap');
  37398. }
  37399. last = !(b & 0x80);
  37400. n = n << 7 | b & 0x7F;
  37401. } while (!last);
  37402. return n;
  37403. },
  37404. readSigned: function () {
  37405. var n = this.readNumber();
  37406. return n & 1 ? ~(n >>> 1) : n >>> 1;
  37407. },
  37408. readHex: function (num, size) {
  37409. num.set(this.buffer.subarray(this.pos, this.pos + size + 1));
  37410. this.pos += size + 1;
  37411. },
  37412. readHexNumber: function (num, size) {
  37413. var last;
  37414. var stack = this.tmpBuf, sp = 0;
  37415. do {
  37416. var b = this.readByte();
  37417. if (b < 0) {
  37418. error('unexpected EOF in bcmap');
  37419. }
  37420. last = !(b & 0x80);
  37421. stack[sp++] = b & 0x7F;
  37422. } while (!last);
  37423. var i = size, buffer = 0, bufferSize = 0;
  37424. while (i >= 0) {
  37425. while (bufferSize < 8 && stack.length > 0) {
  37426. buffer = stack[--sp] << bufferSize | buffer;
  37427. bufferSize += 7;
  37428. }
  37429. num[i] = buffer & 255;
  37430. i--;
  37431. buffer >>= 8;
  37432. bufferSize -= 8;
  37433. }
  37434. },
  37435. readHexSigned: function (num, size) {
  37436. this.readHexNumber(num, size);
  37437. var sign = num[size] & 1 ? 255 : 0;
  37438. var c = 0;
  37439. for (var i = 0; i <= size; i++) {
  37440. c = (c & 1) << 8 | num[i];
  37441. num[i] = c >> 1 ^ sign;
  37442. }
  37443. },
  37444. readString: function () {
  37445. var len = this.readNumber();
  37446. var s = '';
  37447. for (var i = 0; i < len; i++) {
  37448. s += String.fromCharCode(this.readNumber());
  37449. }
  37450. return s;
  37451. }
  37452. };
  37453. function processBinaryCMap(data, cMap, extend) {
  37454. return new Promise(function (resolve, reject) {
  37455. var stream = new BinaryCMapStream(data);
  37456. var header = stream.readByte();
  37457. cMap.vertical = !!(header & 1);
  37458. var useCMap = null;
  37459. var start = new Uint8Array(MAX_NUM_SIZE);
  37460. var end = new Uint8Array(MAX_NUM_SIZE);
  37461. var char = new Uint8Array(MAX_NUM_SIZE);
  37462. var charCode = new Uint8Array(MAX_NUM_SIZE);
  37463. var tmp = new Uint8Array(MAX_NUM_SIZE);
  37464. var code;
  37465. var b;
  37466. while ((b = stream.readByte()) >= 0) {
  37467. var type = b >> 5;
  37468. if (type === 7) {
  37469. switch (b & 0x1F) {
  37470. case 0:
  37471. stream.readString();
  37472. break;
  37473. case 1:
  37474. useCMap = stream.readString();
  37475. break;
  37476. }
  37477. continue;
  37478. }
  37479. var sequence = !!(b & 0x10);
  37480. var dataSize = b & 15;
  37481. assert(dataSize + 1 <= MAX_NUM_SIZE);
  37482. var ucs2DataSize = 1;
  37483. var subitemsCount = stream.readNumber();
  37484. var i;
  37485. switch (type) {
  37486. case 0:
  37487. stream.readHex(start, dataSize);
  37488. stream.readHexNumber(end, dataSize);
  37489. addHex(end, start, dataSize);
  37490. cMap.addCodespaceRange(dataSize + 1, hexToInt(start, dataSize), hexToInt(end, dataSize));
  37491. for (i = 1; i < subitemsCount; i++) {
  37492. incHex(end, dataSize);
  37493. stream.readHexNumber(start, dataSize);
  37494. addHex(start, end, dataSize);
  37495. stream.readHexNumber(end, dataSize);
  37496. addHex(end, start, dataSize);
  37497. cMap.addCodespaceRange(dataSize + 1, hexToInt(start, dataSize), hexToInt(end, dataSize));
  37498. }
  37499. break;
  37500. case 1:
  37501. stream.readHex(start, dataSize);
  37502. stream.readHexNumber(end, dataSize);
  37503. addHex(end, start, dataSize);
  37504. code = stream.readNumber();
  37505. for (i = 1; i < subitemsCount; i++) {
  37506. incHex(end, dataSize);
  37507. stream.readHexNumber(start, dataSize);
  37508. addHex(start, end, dataSize);
  37509. stream.readHexNumber(end, dataSize);
  37510. addHex(end, start, dataSize);
  37511. code = stream.readNumber();
  37512. }
  37513. break;
  37514. case 2:
  37515. stream.readHex(char, dataSize);
  37516. code = stream.readNumber();
  37517. cMap.mapOne(hexToInt(char, dataSize), code);
  37518. for (i = 1; i < subitemsCount; i++) {
  37519. incHex(char, dataSize);
  37520. if (!sequence) {
  37521. stream.readHexNumber(tmp, dataSize);
  37522. addHex(char, tmp, dataSize);
  37523. }
  37524. code = stream.readSigned() + (code + 1);
  37525. cMap.mapOne(hexToInt(char, dataSize), code);
  37526. }
  37527. break;
  37528. case 3:
  37529. stream.readHex(start, dataSize);
  37530. stream.readHexNumber(end, dataSize);
  37531. addHex(end, start, dataSize);
  37532. code = stream.readNumber();
  37533. cMap.mapCidRange(hexToInt(start, dataSize), hexToInt(end, dataSize), code);
  37534. for (i = 1; i < subitemsCount; i++) {
  37535. incHex(end, dataSize);
  37536. if (!sequence) {
  37537. stream.readHexNumber(start, dataSize);
  37538. addHex(start, end, dataSize);
  37539. } else {
  37540. start.set(end);
  37541. }
  37542. stream.readHexNumber(end, dataSize);
  37543. addHex(end, start, dataSize);
  37544. code = stream.readNumber();
  37545. cMap.mapCidRange(hexToInt(start, dataSize), hexToInt(end, dataSize), code);
  37546. }
  37547. break;
  37548. case 4:
  37549. stream.readHex(char, ucs2DataSize);
  37550. stream.readHex(charCode, dataSize);
  37551. cMap.mapOne(hexToInt(char, ucs2DataSize), hexToStr(charCode, dataSize));
  37552. for (i = 1; i < subitemsCount; i++) {
  37553. incHex(char, ucs2DataSize);
  37554. if (!sequence) {
  37555. stream.readHexNumber(tmp, ucs2DataSize);
  37556. addHex(char, tmp, ucs2DataSize);
  37557. }
  37558. incHex(charCode, dataSize);
  37559. stream.readHexSigned(tmp, dataSize);
  37560. addHex(charCode, tmp, dataSize);
  37561. cMap.mapOne(hexToInt(char, ucs2DataSize), hexToStr(charCode, dataSize));
  37562. }
  37563. break;
  37564. case 5:
  37565. stream.readHex(start, ucs2DataSize);
  37566. stream.readHexNumber(end, ucs2DataSize);
  37567. addHex(end, start, ucs2DataSize);
  37568. stream.readHex(charCode, dataSize);
  37569. cMap.mapBfRange(hexToInt(start, ucs2DataSize), hexToInt(end, ucs2DataSize), hexToStr(charCode, dataSize));
  37570. for (i = 1; i < subitemsCount; i++) {
  37571. incHex(end, ucs2DataSize);
  37572. if (!sequence) {
  37573. stream.readHexNumber(start, ucs2DataSize);
  37574. addHex(start, end, ucs2DataSize);
  37575. } else {
  37576. start.set(end);
  37577. }
  37578. stream.readHexNumber(end, ucs2DataSize);
  37579. addHex(end, start, ucs2DataSize);
  37580. stream.readHex(charCode, dataSize);
  37581. cMap.mapBfRange(hexToInt(start, ucs2DataSize), hexToInt(end, ucs2DataSize), hexToStr(charCode, dataSize));
  37582. }
  37583. break;
  37584. default:
  37585. reject(new Error('processBinaryCMap: Unknown type: ' + type));
  37586. return;
  37587. }
  37588. }
  37589. if (useCMap) {
  37590. resolve(extend(useCMap));
  37591. return;
  37592. }
  37593. resolve(cMap);
  37594. });
  37595. }
  37596. function BinaryCMapReader() {
  37597. }
  37598. BinaryCMapReader.prototype = { process: processBinaryCMap };
  37599. return BinaryCMapReader;
  37600. }();
  37601. var CMapFactory = function CMapFactoryClosure() {
  37602. function strToInt(str) {
  37603. var a = 0;
  37604. for (var i = 0; i < str.length; i++) {
  37605. a = a << 8 | str.charCodeAt(i);
  37606. }
  37607. return a >>> 0;
  37608. }
  37609. function expectString(obj) {
  37610. if (!isString(obj)) {
  37611. error('Malformed CMap: expected string.');
  37612. }
  37613. }
  37614. function expectInt(obj) {
  37615. if (!isInt(obj)) {
  37616. error('Malformed CMap: expected int.');
  37617. }
  37618. }
  37619. function parseBfChar(cMap, lexer) {
  37620. while (true) {
  37621. var obj = lexer.getObj();
  37622. if (isEOF(obj)) {
  37623. break;
  37624. }
  37625. if (isCmd(obj, 'endbfchar')) {
  37626. return;
  37627. }
  37628. expectString(obj);
  37629. var src = strToInt(obj);
  37630. obj = lexer.getObj();
  37631. expectString(obj);
  37632. var dst = obj;
  37633. cMap.mapOne(src, dst);
  37634. }
  37635. }
  37636. function parseBfRange(cMap, lexer) {
  37637. while (true) {
  37638. var obj = lexer.getObj();
  37639. if (isEOF(obj)) {
  37640. break;
  37641. }
  37642. if (isCmd(obj, 'endbfrange')) {
  37643. return;
  37644. }
  37645. expectString(obj);
  37646. var low = strToInt(obj);
  37647. obj = lexer.getObj();
  37648. expectString(obj);
  37649. var high = strToInt(obj);
  37650. obj = lexer.getObj();
  37651. if (isInt(obj) || isString(obj)) {
  37652. var dstLow = isInt(obj) ? String.fromCharCode(obj) : obj;
  37653. cMap.mapBfRange(low, high, dstLow);
  37654. } else if (isCmd(obj, '[')) {
  37655. obj = lexer.getObj();
  37656. var array = [];
  37657. while (!isCmd(obj, ']') && !isEOF(obj)) {
  37658. array.push(obj);
  37659. obj = lexer.getObj();
  37660. }
  37661. cMap.mapBfRangeToArray(low, high, array);
  37662. } else {
  37663. break;
  37664. }
  37665. }
  37666. error('Invalid bf range.');
  37667. }
  37668. function parseCidChar(cMap, lexer) {
  37669. while (true) {
  37670. var obj = lexer.getObj();
  37671. if (isEOF(obj)) {
  37672. break;
  37673. }
  37674. if (isCmd(obj, 'endcidchar')) {
  37675. return;
  37676. }
  37677. expectString(obj);
  37678. var src = strToInt(obj);
  37679. obj = lexer.getObj();
  37680. expectInt(obj);
  37681. var dst = obj;
  37682. cMap.mapOne(src, dst);
  37683. }
  37684. }
  37685. function parseCidRange(cMap, lexer) {
  37686. while (true) {
  37687. var obj = lexer.getObj();
  37688. if (isEOF(obj)) {
  37689. break;
  37690. }
  37691. if (isCmd(obj, 'endcidrange')) {
  37692. return;
  37693. }
  37694. expectString(obj);
  37695. var low = strToInt(obj);
  37696. obj = lexer.getObj();
  37697. expectString(obj);
  37698. var high = strToInt(obj);
  37699. obj = lexer.getObj();
  37700. expectInt(obj);
  37701. var dstLow = obj;
  37702. cMap.mapCidRange(low, high, dstLow);
  37703. }
  37704. }
  37705. function parseCodespaceRange(cMap, lexer) {
  37706. while (true) {
  37707. var obj = lexer.getObj();
  37708. if (isEOF(obj)) {
  37709. break;
  37710. }
  37711. if (isCmd(obj, 'endcodespacerange')) {
  37712. return;
  37713. }
  37714. if (!isString(obj)) {
  37715. break;
  37716. }
  37717. var low = strToInt(obj);
  37718. obj = lexer.getObj();
  37719. if (!isString(obj)) {
  37720. break;
  37721. }
  37722. var high = strToInt(obj);
  37723. cMap.addCodespaceRange(obj.length, low, high);
  37724. }
  37725. error('Invalid codespace range.');
  37726. }
  37727. function parseWMode(cMap, lexer) {
  37728. var obj = lexer.getObj();
  37729. if (isInt(obj)) {
  37730. cMap.vertical = !!obj;
  37731. }
  37732. }
  37733. function parseCMapName(cMap, lexer) {
  37734. var obj = lexer.getObj();
  37735. if (isName(obj) && isString(obj.name)) {
  37736. cMap.name = obj.name;
  37737. }
  37738. }
  37739. function parseCMap(cMap, lexer, fetchBuiltInCMap, useCMap) {
  37740. var previous;
  37741. var embededUseCMap;
  37742. objLoop:
  37743. while (true) {
  37744. try {
  37745. var obj = lexer.getObj();
  37746. if (isEOF(obj)) {
  37747. break;
  37748. } else if (isName(obj)) {
  37749. if (obj.name === 'WMode') {
  37750. parseWMode(cMap, lexer);
  37751. } else if (obj.name === 'CMapName') {
  37752. parseCMapName(cMap, lexer);
  37753. }
  37754. previous = obj;
  37755. } else if (isCmd(obj)) {
  37756. switch (obj.cmd) {
  37757. case 'endcmap':
  37758. break objLoop;
  37759. case 'usecmap':
  37760. if (isName(previous)) {
  37761. embededUseCMap = previous.name;
  37762. }
  37763. break;
  37764. case 'begincodespacerange':
  37765. parseCodespaceRange(cMap, lexer);
  37766. break;
  37767. case 'beginbfchar':
  37768. parseBfChar(cMap, lexer);
  37769. break;
  37770. case 'begincidchar':
  37771. parseCidChar(cMap, lexer);
  37772. break;
  37773. case 'beginbfrange':
  37774. parseBfRange(cMap, lexer);
  37775. break;
  37776. case 'begincidrange':
  37777. parseCidRange(cMap, lexer);
  37778. break;
  37779. }
  37780. }
  37781. } catch (ex) {
  37782. if (ex instanceof MissingDataException) {
  37783. throw ex;
  37784. }
  37785. warn('Invalid cMap data: ' + ex);
  37786. continue;
  37787. }
  37788. }
  37789. if (!useCMap && embededUseCMap) {
  37790. useCMap = embededUseCMap;
  37791. }
  37792. if (useCMap) {
  37793. return extendCMap(cMap, fetchBuiltInCMap, useCMap);
  37794. }
  37795. return Promise.resolve(cMap);
  37796. }
  37797. function extendCMap(cMap, fetchBuiltInCMap, useCMap) {
  37798. return createBuiltInCMap(useCMap, fetchBuiltInCMap).then(function (newCMap) {
  37799. cMap.useCMap = newCMap;
  37800. if (cMap.numCodespaceRanges === 0) {
  37801. var useCodespaceRanges = cMap.useCMap.codespaceRanges;
  37802. for (var i = 0; i < useCodespaceRanges.length; i++) {
  37803. cMap.codespaceRanges[i] = useCodespaceRanges[i].slice();
  37804. }
  37805. cMap.numCodespaceRanges = cMap.useCMap.numCodespaceRanges;
  37806. }
  37807. cMap.useCMap.forEach(function (key, value) {
  37808. if (!cMap.contains(key)) {
  37809. cMap.mapOne(key, cMap.useCMap.lookup(key));
  37810. }
  37811. });
  37812. return cMap;
  37813. });
  37814. }
  37815. function createBuiltInCMap(name, fetchBuiltInCMap) {
  37816. if (name === 'Identity-H') {
  37817. return Promise.resolve(new IdentityCMap(false, 2));
  37818. } else if (name === 'Identity-V') {
  37819. return Promise.resolve(new IdentityCMap(true, 2));
  37820. }
  37821. if (BUILT_IN_CMAPS.indexOf(name) === -1) {
  37822. return Promise.reject(new Error('Unknown cMap name: ' + name));
  37823. }
  37824. assert(fetchBuiltInCMap, 'Built-in CMap parameters are not provided.');
  37825. return fetchBuiltInCMap(name).then(function (data) {
  37826. var cMapData = data.cMapData, compressionType = data.compressionType;
  37827. var cMap = new CMap(true);
  37828. if (compressionType === CMapCompressionType.BINARY) {
  37829. return new BinaryCMapReader().process(cMapData, cMap, function (useCMap) {
  37830. return extendCMap(cMap, fetchBuiltInCMap, useCMap);
  37831. });
  37832. }
  37833. assert(compressionType === CMapCompressionType.NONE, 'TODO: Only BINARY/NONE CMap compression is currently supported.');
  37834. var lexer = new Lexer(new Stream(cMapData));
  37835. return parseCMap(cMap, lexer, fetchBuiltInCMap, null);
  37836. });
  37837. }
  37838. return {
  37839. create: function (params) {
  37840. var encoding = params.encoding;
  37841. var fetchBuiltInCMap = params.fetchBuiltInCMap;
  37842. var useCMap = params.useCMap;
  37843. if (isName(encoding)) {
  37844. return createBuiltInCMap(encoding.name, fetchBuiltInCMap);
  37845. } else if (isStream(encoding)) {
  37846. var cMap = new CMap();
  37847. var lexer = new Lexer(encoding);
  37848. return parseCMap(cMap, lexer, fetchBuiltInCMap, useCMap).then(function (parsedCMap) {
  37849. if (parsedCMap.isIdentityCMap) {
  37850. return createBuiltInCMap(parsedCMap.name, fetchBuiltInCMap);
  37851. }
  37852. return parsedCMap;
  37853. });
  37854. }
  37855. return Promise.reject(new Error('Encoding required.'));
  37856. }
  37857. };
  37858. }();
  37859. exports.CMap = CMap;
  37860. exports.CMapFactory = CMapFactory;
  37861. exports.IdentityCMap = IdentityCMap;
  37862. /***/ }),
  37863. /* 24 */
  37864. /***/ (function(module, exports, __w_pdfjs_require__) {
  37865. "use strict";
  37866. var sharedUtil = __w_pdfjs_require__(0);
  37867. var corePrimitives = __w_pdfjs_require__(1);
  37868. var coreStream = __w_pdfjs_require__(2);
  37869. var coreObj = __w_pdfjs_require__(16);
  37870. var coreParser = __w_pdfjs_require__(5);
  37871. var coreCrypto = __w_pdfjs_require__(13);
  37872. var coreEvaluator = __w_pdfjs_require__(14);
  37873. var coreAnnotation = __w_pdfjs_require__(20);
  37874. var OPS = sharedUtil.OPS;
  37875. var MissingDataException = sharedUtil.MissingDataException;
  37876. var Util = sharedUtil.Util;
  37877. var assert = sharedUtil.assert;
  37878. var error = sharedUtil.error;
  37879. var info = sharedUtil.info;
  37880. var isArray = sharedUtil.isArray;
  37881. var isArrayBuffer = sharedUtil.isArrayBuffer;
  37882. var isNum = sharedUtil.isNum;
  37883. var isString = sharedUtil.isString;
  37884. var shadow = sharedUtil.shadow;
  37885. var stringToBytes = sharedUtil.stringToBytes;
  37886. var stringToPDFString = sharedUtil.stringToPDFString;
  37887. var warn = sharedUtil.warn;
  37888. var isSpace = sharedUtil.isSpace;
  37889. var Dict = corePrimitives.Dict;
  37890. var isDict = corePrimitives.isDict;
  37891. var isName = corePrimitives.isName;
  37892. var isStream = corePrimitives.isStream;
  37893. var NullStream = coreStream.NullStream;
  37894. var Stream = coreStream.Stream;
  37895. var StreamsSequenceStream = coreStream.StreamsSequenceStream;
  37896. var Catalog = coreObj.Catalog;
  37897. var ObjectLoader = coreObj.ObjectLoader;
  37898. var XRef = coreObj.XRef;
  37899. var Linearization = coreParser.Linearization;
  37900. var calculateMD5 = coreCrypto.calculateMD5;
  37901. var OperatorList = coreEvaluator.OperatorList;
  37902. var PartialEvaluator = coreEvaluator.PartialEvaluator;
  37903. var AnnotationFactory = coreAnnotation.AnnotationFactory;
  37904. var Page = function PageClosure() {
  37905. var DEFAULT_USER_UNIT = 1.0;
  37906. var LETTER_SIZE_MEDIABOX = [
  37907. 0,
  37908. 0,
  37909. 612,
  37910. 792
  37911. ];
  37912. function isAnnotationRenderable(annotation, intent) {
  37913. return intent === 'display' && annotation.viewable || intent === 'print' && annotation.printable;
  37914. }
  37915. function Page(pdfManager, xref, pageIndex, pageDict, ref, fontCache, builtInCMapCache) {
  37916. this.pdfManager = pdfManager;
  37917. this.pageIndex = pageIndex;
  37918. this.pageDict = pageDict;
  37919. this.xref = xref;
  37920. this.ref = ref;
  37921. this.fontCache = fontCache;
  37922. this.builtInCMapCache = builtInCMapCache;
  37923. this.evaluatorOptions = pdfManager.evaluatorOptions;
  37924. this.resourcesPromise = null;
  37925. var uniquePrefix = 'p' + this.pageIndex + '_';
  37926. var idCounters = { obj: 0 };
  37927. this.idFactory = {
  37928. createObjId: function () {
  37929. return uniquePrefix + ++idCounters.obj;
  37930. }
  37931. };
  37932. }
  37933. Page.prototype = {
  37934. getPageProp: function Page_getPageProp(key) {
  37935. return this.pageDict.get(key);
  37936. },
  37937. getInheritedPageProp: function Page_getInheritedPageProp(key, getArray) {
  37938. var dict = this.pageDict, valueArray = null, loopCount = 0;
  37939. var MAX_LOOP_COUNT = 100;
  37940. getArray = getArray || false;
  37941. while (dict) {
  37942. var value = getArray ? dict.getArray(key) : dict.get(key);
  37943. if (value !== undefined) {
  37944. if (!valueArray) {
  37945. valueArray = [];
  37946. }
  37947. valueArray.push(value);
  37948. }
  37949. if (++loopCount > MAX_LOOP_COUNT) {
  37950. warn('getInheritedPageProp: maximum loop count exceeded for ' + key);
  37951. return valueArray ? valueArray[0] : undefined;
  37952. }
  37953. dict = dict.get('Parent');
  37954. }
  37955. if (!valueArray) {
  37956. return undefined;
  37957. }
  37958. if (valueArray.length === 1 || !isDict(valueArray[0])) {
  37959. return valueArray[0];
  37960. }
  37961. return Dict.merge(this.xref, valueArray);
  37962. },
  37963. get content() {
  37964. return this.getPageProp('Contents');
  37965. },
  37966. get resources() {
  37967. return shadow(this, 'resources', this.getInheritedPageProp('Resources') || Dict.empty);
  37968. },
  37969. get mediaBox() {
  37970. var mediaBox = this.getInheritedPageProp('MediaBox', true);
  37971. if (!isArray(mediaBox) || mediaBox.length !== 4) {
  37972. return shadow(this, 'mediaBox', LETTER_SIZE_MEDIABOX);
  37973. }
  37974. return shadow(this, 'mediaBox', mediaBox);
  37975. },
  37976. get cropBox() {
  37977. var cropBox = this.getInheritedPageProp('CropBox', true);
  37978. if (!isArray(cropBox) || cropBox.length !== 4) {
  37979. return shadow(this, 'cropBox', this.mediaBox);
  37980. }
  37981. return shadow(this, 'cropBox', cropBox);
  37982. },
  37983. get userUnit() {
  37984. var obj = this.getPageProp('UserUnit');
  37985. if (!isNum(obj) || obj <= 0) {
  37986. obj = DEFAULT_USER_UNIT;
  37987. }
  37988. return shadow(this, 'userUnit', obj);
  37989. },
  37990. get view() {
  37991. var mediaBox = this.mediaBox, cropBox = this.cropBox;
  37992. if (mediaBox === cropBox) {
  37993. return shadow(this, 'view', mediaBox);
  37994. }
  37995. var intersection = Util.intersect(cropBox, mediaBox);
  37996. return shadow(this, 'view', intersection || mediaBox);
  37997. },
  37998. get rotate() {
  37999. var rotate = this.getInheritedPageProp('Rotate') || 0;
  38000. if (rotate % 90 !== 0) {
  38001. rotate = 0;
  38002. } else if (rotate >= 360) {
  38003. rotate = rotate % 360;
  38004. } else if (rotate < 0) {
  38005. rotate = (rotate % 360 + 360) % 360;
  38006. }
  38007. return shadow(this, 'rotate', rotate);
  38008. },
  38009. getContentStream: function Page_getContentStream() {
  38010. var content = this.content;
  38011. var stream;
  38012. if (isArray(content)) {
  38013. var xref = this.xref;
  38014. var i, n = content.length;
  38015. var streams = [];
  38016. for (i = 0; i < n; ++i) {
  38017. streams.push(xref.fetchIfRef(content[i]));
  38018. }
  38019. stream = new StreamsSequenceStream(streams);
  38020. } else if (isStream(content)) {
  38021. stream = content;
  38022. } else {
  38023. stream = new NullStream();
  38024. }
  38025. return stream;
  38026. },
  38027. loadResources: function Page_loadResources(keys) {
  38028. if (!this.resourcesPromise) {
  38029. this.resourcesPromise = this.pdfManager.ensure(this, 'resources');
  38030. }
  38031. return this.resourcesPromise.then(function resourceSuccess() {
  38032. var objectLoader = new ObjectLoader(this.resources.map, keys, this.xref);
  38033. return objectLoader.load();
  38034. }.bind(this));
  38035. },
  38036. getOperatorList: function Page_getOperatorList(handler, task, intent, renderInteractiveForms) {
  38037. var self = this;
  38038. var pdfManager = this.pdfManager;
  38039. var contentStreamPromise = pdfManager.ensure(this, 'getContentStream', []);
  38040. var resourcesPromise = this.loadResources([
  38041. 'ExtGState',
  38042. 'ColorSpace',
  38043. 'Pattern',
  38044. 'Shading',
  38045. 'XObject',
  38046. 'Font'
  38047. ]);
  38048. var partialEvaluator = new PartialEvaluator(pdfManager, this.xref, handler, this.pageIndex, this.idFactory, this.fontCache, this.builtInCMapCache, this.evaluatorOptions);
  38049. var dataPromises = Promise.all([
  38050. contentStreamPromise,
  38051. resourcesPromise
  38052. ]);
  38053. var pageListPromise = dataPromises.then(function (data) {
  38054. var contentStream = data[0];
  38055. var opList = new OperatorList(intent, handler, self.pageIndex);
  38056. handler.send('StartRenderPage', {
  38057. transparency: partialEvaluator.hasBlendModes(self.resources),
  38058. pageIndex: self.pageIndex,
  38059. intent: intent
  38060. });
  38061. return partialEvaluator.getOperatorList(contentStream, task, self.resources, opList).then(function () {
  38062. return opList;
  38063. });
  38064. });
  38065. var annotationsPromise = pdfManager.ensure(this, 'annotations');
  38066. return Promise.all([
  38067. pageListPromise,
  38068. annotationsPromise
  38069. ]).then(function (datas) {
  38070. var pageOpList = datas[0];
  38071. var annotations = datas[1];
  38072. if (annotations.length === 0) {
  38073. pageOpList.flush(true);
  38074. return pageOpList;
  38075. }
  38076. var i, ii, opListPromises = [];
  38077. for (i = 0, ii = annotations.length; i < ii; i++) {
  38078. if (isAnnotationRenderable(annotations[i], intent)) {
  38079. opListPromises.push(annotations[i].getOperatorList(partialEvaluator, task, renderInteractiveForms));
  38080. }
  38081. }
  38082. return Promise.all(opListPromises).then(function (opLists) {
  38083. pageOpList.addOp(OPS.beginAnnotations, []);
  38084. for (i = 0, ii = opLists.length; i < ii; i++) {
  38085. pageOpList.addOpList(opLists[i]);
  38086. }
  38087. pageOpList.addOp(OPS.endAnnotations, []);
  38088. pageOpList.flush(true);
  38089. return pageOpList;
  38090. });
  38091. });
  38092. },
  38093. extractTextContent: function Page_extractTextContent(task, normalizeWhitespace, combineTextItems) {
  38094. var handler = {
  38095. on: function nullHandlerOn() {
  38096. },
  38097. send: function nullHandlerSend() {
  38098. }
  38099. };
  38100. var self = this;
  38101. var pdfManager = this.pdfManager;
  38102. var contentStreamPromise = pdfManager.ensure(this, 'getContentStream', []);
  38103. var resourcesPromise = this.loadResources([
  38104. 'ExtGState',
  38105. 'XObject',
  38106. 'Font'
  38107. ]);
  38108. var dataPromises = Promise.all([
  38109. contentStreamPromise,
  38110. resourcesPromise
  38111. ]);
  38112. return dataPromises.then(function (data) {
  38113. var contentStream = data[0];
  38114. var partialEvaluator = new PartialEvaluator(pdfManager, self.xref, handler, self.pageIndex, self.idFactory, self.fontCache, self.builtInCMapCache, self.evaluatorOptions);
  38115. return partialEvaluator.getTextContent(contentStream, task, self.resources, null, normalizeWhitespace, combineTextItems);
  38116. });
  38117. },
  38118. getAnnotationsData: function Page_getAnnotationsData(intent) {
  38119. var annotations = this.annotations;
  38120. var annotationsData = [];
  38121. for (var i = 0, n = annotations.length; i < n; ++i) {
  38122. if (!intent || isAnnotationRenderable(annotations[i], intent)) {
  38123. annotationsData.push(annotations[i].data);
  38124. }
  38125. }
  38126. return annotationsData;
  38127. },
  38128. get annotations() {
  38129. var annotations = [];
  38130. var annotationRefs = this.getInheritedPageProp('Annots') || [];
  38131. var annotationFactory = new AnnotationFactory();
  38132. for (var i = 0, n = annotationRefs.length; i < n; ++i) {
  38133. var annotationRef = annotationRefs[i];
  38134. var annotation = annotationFactory.create(this.xref, annotationRef, this.pdfManager, this.idFactory);
  38135. if (annotation) {
  38136. annotations.push(annotation);
  38137. }
  38138. }
  38139. return shadow(this, 'annotations', annotations);
  38140. }
  38141. };
  38142. return Page;
  38143. }();
  38144. var PDFDocument = function PDFDocumentClosure() {
  38145. var FINGERPRINT_FIRST_BYTES = 1024;
  38146. var EMPTY_FINGERPRINT = '\x00\x00\x00\x00\x00\x00\x00' + '\x00\x00\x00\x00\x00\x00\x00\x00\x00';
  38147. function PDFDocument(pdfManager, arg) {
  38148. var stream;
  38149. if (isStream(arg)) {
  38150. stream = arg;
  38151. } else if (isArrayBuffer(arg)) {
  38152. stream = new Stream(arg);
  38153. } else {
  38154. error('PDFDocument: Unknown argument type');
  38155. }
  38156. assert(stream.length > 0, 'stream must have data');
  38157. this.pdfManager = pdfManager;
  38158. this.stream = stream;
  38159. this.xref = new XRef(stream, pdfManager);
  38160. }
  38161. function find(stream, needle, limit, backwards) {
  38162. var pos = stream.pos;
  38163. var end = stream.end;
  38164. var strBuf = [];
  38165. if (pos + limit > end) {
  38166. limit = end - pos;
  38167. }
  38168. for (var n = 0; n < limit; ++n) {
  38169. strBuf.push(String.fromCharCode(stream.getByte()));
  38170. }
  38171. var str = strBuf.join('');
  38172. stream.pos = pos;
  38173. var index = backwards ? str.lastIndexOf(needle) : str.indexOf(needle);
  38174. if (index === -1) {
  38175. return false;
  38176. }
  38177. stream.pos += index;
  38178. return true;
  38179. }
  38180. var DocumentInfoValidators = {
  38181. get entries() {
  38182. return shadow(this, 'entries', {
  38183. Title: isString,
  38184. Author: isString,
  38185. Subject: isString,
  38186. Keywords: isString,
  38187. Creator: isString,
  38188. Producer: isString,
  38189. CreationDate: isString,
  38190. ModDate: isString,
  38191. Trapped: isName
  38192. });
  38193. }
  38194. };
  38195. PDFDocument.prototype = {
  38196. parse: function PDFDocument_parse(recoveryMode) {
  38197. this.setup(recoveryMode);
  38198. var version = this.catalog.catDict.get('Version');
  38199. if (isName(version)) {
  38200. this.pdfFormatVersion = version.name;
  38201. }
  38202. try {
  38203. this.acroForm = this.catalog.catDict.get('AcroForm');
  38204. if (this.acroForm) {
  38205. this.xfa = this.acroForm.get('XFA');
  38206. var fields = this.acroForm.get('Fields');
  38207. if ((!fields || !isArray(fields) || fields.length === 0) && !this.xfa) {
  38208. this.acroForm = null;
  38209. }
  38210. }
  38211. } catch (ex) {
  38212. info('Something wrong with AcroForm entry');
  38213. this.acroForm = null;
  38214. }
  38215. },
  38216. get linearization() {
  38217. var linearization = null;
  38218. if (this.stream.length) {
  38219. try {
  38220. linearization = Linearization.create(this.stream);
  38221. } catch (err) {
  38222. if (err instanceof MissingDataException) {
  38223. throw err;
  38224. }
  38225. info(err);
  38226. }
  38227. }
  38228. return shadow(this, 'linearization', linearization);
  38229. },
  38230. get startXRef() {
  38231. var stream = this.stream;
  38232. var startXRef = 0;
  38233. var linearization = this.linearization;
  38234. if (linearization) {
  38235. stream.reset();
  38236. if (find(stream, 'endobj', 1024)) {
  38237. startXRef = stream.pos + 6;
  38238. }
  38239. } else {
  38240. var step = 1024;
  38241. var found = false, pos = stream.end;
  38242. while (!found && pos > 0) {
  38243. pos -= step - 'startxref'.length;
  38244. if (pos < 0) {
  38245. pos = 0;
  38246. }
  38247. stream.pos = pos;
  38248. found = find(stream, 'startxref', step, true);
  38249. }
  38250. if (found) {
  38251. stream.skip(9);
  38252. var ch;
  38253. do {
  38254. ch = stream.getByte();
  38255. } while (isSpace(ch));
  38256. var str = '';
  38257. while (ch >= 0x20 && ch <= 0x39) {
  38258. str += String.fromCharCode(ch);
  38259. ch = stream.getByte();
  38260. }
  38261. startXRef = parseInt(str, 10);
  38262. if (isNaN(startXRef)) {
  38263. startXRef = 0;
  38264. }
  38265. }
  38266. }
  38267. return shadow(this, 'startXRef', startXRef);
  38268. },
  38269. get mainXRefEntriesOffset() {
  38270. var mainXRefEntriesOffset = 0;
  38271. var linearization = this.linearization;
  38272. if (linearization) {
  38273. mainXRefEntriesOffset = linearization.mainXRefEntriesOffset;
  38274. }
  38275. return shadow(this, 'mainXRefEntriesOffset', mainXRefEntriesOffset);
  38276. },
  38277. checkHeader: function PDFDocument_checkHeader() {
  38278. var stream = this.stream;
  38279. stream.reset();
  38280. if (find(stream, '%PDF-', 1024)) {
  38281. stream.moveStart();
  38282. var MAX_VERSION_LENGTH = 12;
  38283. var version = '', ch;
  38284. while ((ch = stream.getByte()) > 0x20) {
  38285. if (version.length >= MAX_VERSION_LENGTH) {
  38286. break;
  38287. }
  38288. version += String.fromCharCode(ch);
  38289. }
  38290. if (!this.pdfFormatVersion) {
  38291. this.pdfFormatVersion = version.substring(5);
  38292. }
  38293. return;
  38294. }
  38295. },
  38296. parseStartXRef: function PDFDocument_parseStartXRef() {
  38297. var startXRef = this.startXRef;
  38298. this.xref.setStartXRef(startXRef);
  38299. },
  38300. setup: function PDFDocument_setup(recoveryMode) {
  38301. this.xref.parse(recoveryMode);
  38302. var self = this;
  38303. var pageFactory = {
  38304. createPage: function (pageIndex, dict, ref, fontCache, builtInCMapCache) {
  38305. return new Page(self.pdfManager, self.xref, pageIndex, dict, ref, fontCache, builtInCMapCache);
  38306. }
  38307. };
  38308. this.catalog = new Catalog(this.pdfManager, this.xref, pageFactory);
  38309. },
  38310. get numPages() {
  38311. var linearization = this.linearization;
  38312. var num = linearization ? linearization.numPages : this.catalog.numPages;
  38313. return shadow(this, 'numPages', num);
  38314. },
  38315. get documentInfo() {
  38316. var docInfo = {
  38317. PDFFormatVersion: this.pdfFormatVersion,
  38318. IsAcroFormPresent: !!this.acroForm,
  38319. IsXFAPresent: !!this.xfa
  38320. };
  38321. var infoDict;
  38322. try {
  38323. infoDict = this.xref.trailer.get('Info');
  38324. } catch (err) {
  38325. info('The document information dictionary is invalid.');
  38326. }
  38327. if (infoDict) {
  38328. var validEntries = DocumentInfoValidators.entries;
  38329. for (var key in validEntries) {
  38330. if (infoDict.has(key)) {
  38331. var value = infoDict.get(key);
  38332. if (validEntries[key](value)) {
  38333. docInfo[key] = typeof value !== 'string' ? value : stringToPDFString(value);
  38334. } else {
  38335. info('Bad value in document info for "' + key + '"');
  38336. }
  38337. }
  38338. }
  38339. }
  38340. return shadow(this, 'documentInfo', docInfo);
  38341. },
  38342. get fingerprint() {
  38343. var xref = this.xref, hash, fileID = '';
  38344. var idArray = xref.trailer.get('ID');
  38345. if (idArray && isArray(idArray) && idArray[0] && isString(idArray[0]) && idArray[0] !== EMPTY_FINGERPRINT) {
  38346. hash = stringToBytes(idArray[0]);
  38347. } else {
  38348. if (this.stream.ensureRange) {
  38349. this.stream.ensureRange(0, Math.min(FINGERPRINT_FIRST_BYTES, this.stream.end));
  38350. }
  38351. hash = calculateMD5(this.stream.bytes.subarray(0, FINGERPRINT_FIRST_BYTES), 0, FINGERPRINT_FIRST_BYTES);
  38352. }
  38353. for (var i = 0, n = hash.length; i < n; i++) {
  38354. var hex = hash[i].toString(16);
  38355. fileID += hex.length === 1 ? '0' + hex : hex;
  38356. }
  38357. return shadow(this, 'fingerprint', fileID);
  38358. },
  38359. getPage: function PDFDocument_getPage(pageIndex) {
  38360. return this.catalog.getPage(pageIndex);
  38361. },
  38362. cleanup: function PDFDocument_cleanup() {
  38363. return this.catalog.cleanup();
  38364. }
  38365. };
  38366. return PDFDocument;
  38367. }();
  38368. exports.Page = Page;
  38369. exports.PDFDocument = PDFDocument;
  38370. /***/ }),
  38371. /* 25 */
  38372. /***/ (function(module, exports, __w_pdfjs_require__) {
  38373. "use strict";
  38374. var sharedUtil = __w_pdfjs_require__(0);
  38375. var coreStream = __w_pdfjs_require__(2);
  38376. var coreGlyphList = __w_pdfjs_require__(7);
  38377. var coreEncodings = __w_pdfjs_require__(4);
  38378. var coreCFFParser = __w_pdfjs_require__(11);
  38379. var Util = sharedUtil.Util;
  38380. var bytesToString = sharedUtil.bytesToString;
  38381. var error = sharedUtil.error;
  38382. var Stream = coreStream.Stream;
  38383. var getGlyphsUnicode = coreGlyphList.getGlyphsUnicode;
  38384. var StandardEncoding = coreEncodings.StandardEncoding;
  38385. var CFFParser = coreCFFParser.CFFParser;
  38386. var FontRendererFactory = function FontRendererFactoryClosure() {
  38387. function getLong(data, offset) {
  38388. return data[offset] << 24 | data[offset + 1] << 16 | data[offset + 2] << 8 | data[offset + 3];
  38389. }
  38390. function getUshort(data, offset) {
  38391. return data[offset] << 8 | data[offset + 1];
  38392. }
  38393. function parseCmap(data, start, end) {
  38394. var offset = getUshort(data, start + 2) === 1 ? getLong(data, start + 8) : getLong(data, start + 16);
  38395. var format = getUshort(data, start + offset);
  38396. var ranges, p, i;
  38397. if (format === 4) {
  38398. getUshort(data, start + offset + 2);
  38399. var segCount = getUshort(data, start + offset + 6) >> 1;
  38400. p = start + offset + 14;
  38401. ranges = [];
  38402. for (i = 0; i < segCount; i++, p += 2) {
  38403. ranges[i] = { end: getUshort(data, p) };
  38404. }
  38405. p += 2;
  38406. for (i = 0; i < segCount; i++, p += 2) {
  38407. ranges[i].start = getUshort(data, p);
  38408. }
  38409. for (i = 0; i < segCount; i++, p += 2) {
  38410. ranges[i].idDelta = getUshort(data, p);
  38411. }
  38412. for (i = 0; i < segCount; i++, p += 2) {
  38413. var idOffset = getUshort(data, p);
  38414. if (idOffset === 0) {
  38415. continue;
  38416. }
  38417. ranges[i].ids = [];
  38418. for (var j = 0, jj = ranges[i].end - ranges[i].start + 1; j < jj; j++) {
  38419. ranges[i].ids[j] = getUshort(data, p + idOffset);
  38420. idOffset += 2;
  38421. }
  38422. }
  38423. return ranges;
  38424. } else if (format === 12) {
  38425. getLong(data, start + offset + 4);
  38426. var groups = getLong(data, start + offset + 12);
  38427. p = start + offset + 16;
  38428. ranges = [];
  38429. for (i = 0; i < groups; i++) {
  38430. ranges.push({
  38431. start: getLong(data, p),
  38432. end: getLong(data, p + 4),
  38433. idDelta: getLong(data, p + 8) - getLong(data, p)
  38434. });
  38435. p += 12;
  38436. }
  38437. return ranges;
  38438. }
  38439. error('not supported cmap: ' + format);
  38440. }
  38441. function parseCff(data, start, end, seacAnalysisEnabled) {
  38442. var properties = {};
  38443. var parser = new CFFParser(new Stream(data, start, end - start), properties, seacAnalysisEnabled);
  38444. var cff = parser.parse();
  38445. return {
  38446. glyphs: cff.charStrings.objects,
  38447. subrs: cff.topDict.privateDict && cff.topDict.privateDict.subrsIndex && cff.topDict.privateDict.subrsIndex.objects,
  38448. gsubrs: cff.globalSubrIndex && cff.globalSubrIndex.objects
  38449. };
  38450. }
  38451. function parseGlyfTable(glyf, loca, isGlyphLocationsLong) {
  38452. var itemSize, itemDecode;
  38453. if (isGlyphLocationsLong) {
  38454. itemSize = 4;
  38455. itemDecode = function fontItemDecodeLong(data, offset) {
  38456. return data[offset] << 24 | data[offset + 1] << 16 | data[offset + 2] << 8 | data[offset + 3];
  38457. };
  38458. } else {
  38459. itemSize = 2;
  38460. itemDecode = function fontItemDecode(data, offset) {
  38461. return data[offset] << 9 | data[offset + 1] << 1;
  38462. };
  38463. }
  38464. var glyphs = [];
  38465. var startOffset = itemDecode(loca, 0);
  38466. for (var j = itemSize; j < loca.length; j += itemSize) {
  38467. var endOffset = itemDecode(loca, j);
  38468. glyphs.push(glyf.subarray(startOffset, endOffset));
  38469. startOffset = endOffset;
  38470. }
  38471. return glyphs;
  38472. }
  38473. function lookupCmap(ranges, unicode) {
  38474. var code = unicode.charCodeAt(0), gid = 0;
  38475. var l = 0, r = ranges.length - 1;
  38476. while (l < r) {
  38477. var c = l + r + 1 >> 1;
  38478. if (code < ranges[c].start) {
  38479. r = c - 1;
  38480. } else {
  38481. l = c;
  38482. }
  38483. }
  38484. if (ranges[l].start <= code && code <= ranges[l].end) {
  38485. gid = ranges[l].idDelta + (ranges[l].ids ? ranges[l].ids[code - ranges[l].start] : code) & 0xFFFF;
  38486. }
  38487. return {
  38488. charCode: code,
  38489. glyphId: gid
  38490. };
  38491. }
  38492. function compileGlyf(code, cmds, font) {
  38493. function moveTo(x, y) {
  38494. cmds.push({
  38495. cmd: 'moveTo',
  38496. args: [
  38497. x,
  38498. y
  38499. ]
  38500. });
  38501. }
  38502. function lineTo(x, y) {
  38503. cmds.push({
  38504. cmd: 'lineTo',
  38505. args: [
  38506. x,
  38507. y
  38508. ]
  38509. });
  38510. }
  38511. function quadraticCurveTo(xa, ya, x, y) {
  38512. cmds.push({
  38513. cmd: 'quadraticCurveTo',
  38514. args: [
  38515. xa,
  38516. ya,
  38517. x,
  38518. y
  38519. ]
  38520. });
  38521. }
  38522. var i = 0;
  38523. var numberOfContours = (code[i] << 24 | code[i + 1] << 16) >> 16;
  38524. var flags;
  38525. var x = 0, y = 0;
  38526. i += 10;
  38527. if (numberOfContours < 0) {
  38528. do {
  38529. flags = code[i] << 8 | code[i + 1];
  38530. var glyphIndex = code[i + 2] << 8 | code[i + 3];
  38531. i += 4;
  38532. var arg1, arg2;
  38533. if (flags & 0x01) {
  38534. arg1 = (code[i] << 24 | code[i + 1] << 16) >> 16;
  38535. arg2 = (code[i + 2] << 24 | code[i + 3] << 16) >> 16;
  38536. i += 4;
  38537. } else {
  38538. arg1 = code[i++];
  38539. arg2 = code[i++];
  38540. }
  38541. if (flags & 0x02) {
  38542. x = arg1;
  38543. y = arg2;
  38544. } else {
  38545. x = 0;
  38546. y = 0;
  38547. }
  38548. var scaleX = 1, scaleY = 1, scale01 = 0, scale10 = 0;
  38549. if (flags & 0x08) {
  38550. scaleX = scaleY = (code[i] << 24 | code[i + 1] << 16) / 1073741824;
  38551. i += 2;
  38552. } else if (flags & 0x40) {
  38553. scaleX = (code[i] << 24 | code[i + 1] << 16) / 1073741824;
  38554. scaleY = (code[i + 2] << 24 | code[i + 3] << 16) / 1073741824;
  38555. i += 4;
  38556. } else if (flags & 0x80) {
  38557. scaleX = (code[i] << 24 | code[i + 1] << 16) / 1073741824;
  38558. scale01 = (code[i + 2] << 24 | code[i + 3] << 16) / 1073741824;
  38559. scale10 = (code[i + 4] << 24 | code[i + 5] << 16) / 1073741824;
  38560. scaleY = (code[i + 6] << 24 | code[i + 7] << 16) / 1073741824;
  38561. i += 8;
  38562. }
  38563. var subglyph = font.glyphs[glyphIndex];
  38564. if (subglyph) {
  38565. cmds.push({ cmd: 'save' });
  38566. cmds.push({
  38567. cmd: 'transform',
  38568. args: [
  38569. scaleX,
  38570. scale01,
  38571. scale10,
  38572. scaleY,
  38573. x,
  38574. y
  38575. ]
  38576. });
  38577. compileGlyf(subglyph, cmds, font);
  38578. cmds.push({ cmd: 'restore' });
  38579. }
  38580. } while (flags & 0x20);
  38581. } else {
  38582. var endPtsOfContours = [];
  38583. var j, jj;
  38584. for (j = 0; j < numberOfContours; j++) {
  38585. endPtsOfContours.push(code[i] << 8 | code[i + 1]);
  38586. i += 2;
  38587. }
  38588. var instructionLength = code[i] << 8 | code[i + 1];
  38589. i += 2 + instructionLength;
  38590. var numberOfPoints = endPtsOfContours[endPtsOfContours.length - 1] + 1;
  38591. var points = [];
  38592. while (points.length < numberOfPoints) {
  38593. flags = code[i++];
  38594. var repeat = 1;
  38595. if (flags & 0x08) {
  38596. repeat += code[i++];
  38597. }
  38598. while (repeat-- > 0) {
  38599. points.push({ flags: flags });
  38600. }
  38601. }
  38602. for (j = 0; j < numberOfPoints; j++) {
  38603. switch (points[j].flags & 0x12) {
  38604. case 0x00:
  38605. x += (code[i] << 24 | code[i + 1] << 16) >> 16;
  38606. i += 2;
  38607. break;
  38608. case 0x02:
  38609. x -= code[i++];
  38610. break;
  38611. case 0x12:
  38612. x += code[i++];
  38613. break;
  38614. }
  38615. points[j].x = x;
  38616. }
  38617. for (j = 0; j < numberOfPoints; j++) {
  38618. switch (points[j].flags & 0x24) {
  38619. case 0x00:
  38620. y += (code[i] << 24 | code[i + 1] << 16) >> 16;
  38621. i += 2;
  38622. break;
  38623. case 0x04:
  38624. y -= code[i++];
  38625. break;
  38626. case 0x24:
  38627. y += code[i++];
  38628. break;
  38629. }
  38630. points[j].y = y;
  38631. }
  38632. var startPoint = 0;
  38633. for (i = 0; i < numberOfContours; i++) {
  38634. var endPoint = endPtsOfContours[i];
  38635. var contour = points.slice(startPoint, endPoint + 1);
  38636. if (contour[0].flags & 1) {
  38637. contour.push(contour[0]);
  38638. } else if (contour[contour.length - 1].flags & 1) {
  38639. contour.unshift(contour[contour.length - 1]);
  38640. } else {
  38641. var p = {
  38642. flags: 1,
  38643. x: (contour[0].x + contour[contour.length - 1].x) / 2,
  38644. y: (contour[0].y + contour[contour.length - 1].y) / 2
  38645. };
  38646. contour.unshift(p);
  38647. contour.push(p);
  38648. }
  38649. moveTo(contour[0].x, contour[0].y);
  38650. for (j = 1, jj = contour.length; j < jj; j++) {
  38651. if (contour[j].flags & 1) {
  38652. lineTo(contour[j].x, contour[j].y);
  38653. } else if (contour[j + 1].flags & 1) {
  38654. quadraticCurveTo(contour[j].x, contour[j].y, contour[j + 1].x, contour[j + 1].y);
  38655. j++;
  38656. } else {
  38657. quadraticCurveTo(contour[j].x, contour[j].y, (contour[j].x + contour[j + 1].x) / 2, (contour[j].y + contour[j + 1].y) / 2);
  38658. }
  38659. }
  38660. startPoint = endPoint + 1;
  38661. }
  38662. }
  38663. }
  38664. function compileCharString(code, cmds, font) {
  38665. var stack = [];
  38666. var x = 0, y = 0;
  38667. var stems = 0;
  38668. function moveTo(x, y) {
  38669. cmds.push({
  38670. cmd: 'moveTo',
  38671. args: [
  38672. x,
  38673. y
  38674. ]
  38675. });
  38676. }
  38677. function lineTo(x, y) {
  38678. cmds.push({
  38679. cmd: 'lineTo',
  38680. args: [
  38681. x,
  38682. y
  38683. ]
  38684. });
  38685. }
  38686. function bezierCurveTo(x1, y1, x2, y2, x, y) {
  38687. cmds.push({
  38688. cmd: 'bezierCurveTo',
  38689. args: [
  38690. x1,
  38691. y1,
  38692. x2,
  38693. y2,
  38694. x,
  38695. y
  38696. ]
  38697. });
  38698. }
  38699. function parse(code) {
  38700. var i = 0;
  38701. while (i < code.length) {
  38702. var stackClean = false;
  38703. var v = code[i++];
  38704. var xa, xb, ya, yb, y1, y2, y3, n, subrCode;
  38705. switch (v) {
  38706. case 1:
  38707. stems += stack.length >> 1;
  38708. stackClean = true;
  38709. break;
  38710. case 3:
  38711. stems += stack.length >> 1;
  38712. stackClean = true;
  38713. break;
  38714. case 4:
  38715. y += stack.pop();
  38716. moveTo(x, y);
  38717. stackClean = true;
  38718. break;
  38719. case 5:
  38720. while (stack.length > 0) {
  38721. x += stack.shift();
  38722. y += stack.shift();
  38723. lineTo(x, y);
  38724. }
  38725. break;
  38726. case 6:
  38727. while (stack.length > 0) {
  38728. x += stack.shift();
  38729. lineTo(x, y);
  38730. if (stack.length === 0) {
  38731. break;
  38732. }
  38733. y += stack.shift();
  38734. lineTo(x, y);
  38735. }
  38736. break;
  38737. case 7:
  38738. while (stack.length > 0) {
  38739. y += stack.shift();
  38740. lineTo(x, y);
  38741. if (stack.length === 0) {
  38742. break;
  38743. }
  38744. x += stack.shift();
  38745. lineTo(x, y);
  38746. }
  38747. break;
  38748. case 8:
  38749. while (stack.length > 0) {
  38750. xa = x + stack.shift();
  38751. ya = y + stack.shift();
  38752. xb = xa + stack.shift();
  38753. yb = ya + stack.shift();
  38754. x = xb + stack.shift();
  38755. y = yb + stack.shift();
  38756. bezierCurveTo(xa, ya, xb, yb, x, y);
  38757. }
  38758. break;
  38759. case 10:
  38760. n = stack.pop() + font.subrsBias;
  38761. subrCode = font.subrs[n];
  38762. if (subrCode) {
  38763. parse(subrCode);
  38764. }
  38765. break;
  38766. case 11:
  38767. return;
  38768. case 12:
  38769. v = code[i++];
  38770. switch (v) {
  38771. case 34:
  38772. xa = x + stack.shift();
  38773. xb = xa + stack.shift();
  38774. y1 = y + stack.shift();
  38775. x = xb + stack.shift();
  38776. bezierCurveTo(xa, y, xb, y1, x, y1);
  38777. xa = x + stack.shift();
  38778. xb = xa + stack.shift();
  38779. x = xb + stack.shift();
  38780. bezierCurveTo(xa, y1, xb, y, x, y);
  38781. break;
  38782. case 35:
  38783. xa = x + stack.shift();
  38784. ya = y + stack.shift();
  38785. xb = xa + stack.shift();
  38786. yb = ya + stack.shift();
  38787. x = xb + stack.shift();
  38788. y = yb + stack.shift();
  38789. bezierCurveTo(xa, ya, xb, yb, x, y);
  38790. xa = x + stack.shift();
  38791. ya = y + stack.shift();
  38792. xb = xa + stack.shift();
  38793. yb = ya + stack.shift();
  38794. x = xb + stack.shift();
  38795. y = yb + stack.shift();
  38796. bezierCurveTo(xa, ya, xb, yb, x, y);
  38797. stack.pop();
  38798. break;
  38799. case 36:
  38800. xa = x + stack.shift();
  38801. y1 = y + stack.shift();
  38802. xb = xa + stack.shift();
  38803. y2 = y1 + stack.shift();
  38804. x = xb + stack.shift();
  38805. bezierCurveTo(xa, y1, xb, y2, x, y2);
  38806. xa = x + stack.shift();
  38807. xb = xa + stack.shift();
  38808. y3 = y2 + stack.shift();
  38809. x = xb + stack.shift();
  38810. bezierCurveTo(xa, y2, xb, y3, x, y);
  38811. break;
  38812. case 37:
  38813. var x0 = x, y0 = y;
  38814. xa = x + stack.shift();
  38815. ya = y + stack.shift();
  38816. xb = xa + stack.shift();
  38817. yb = ya + stack.shift();
  38818. x = xb + stack.shift();
  38819. y = yb + stack.shift();
  38820. bezierCurveTo(xa, ya, xb, yb, x, y);
  38821. xa = x + stack.shift();
  38822. ya = y + stack.shift();
  38823. xb = xa + stack.shift();
  38824. yb = ya + stack.shift();
  38825. x = xb;
  38826. y = yb;
  38827. if (Math.abs(x - x0) > Math.abs(y - y0)) {
  38828. x += stack.shift();
  38829. } else {
  38830. y += stack.shift();
  38831. }
  38832. bezierCurveTo(xa, ya, xb, yb, x, y);
  38833. break;
  38834. default:
  38835. error('unknown operator: 12 ' + v);
  38836. }
  38837. break;
  38838. case 14:
  38839. if (stack.length >= 4) {
  38840. var achar = stack.pop();
  38841. var bchar = stack.pop();
  38842. y = stack.pop();
  38843. x = stack.pop();
  38844. cmds.push({ cmd: 'save' });
  38845. cmds.push({
  38846. cmd: 'translate',
  38847. args: [
  38848. x,
  38849. y
  38850. ]
  38851. });
  38852. var cmap = lookupCmap(font.cmap, String.fromCharCode(font.glyphNameMap[StandardEncoding[achar]]));
  38853. compileCharString(font.glyphs[cmap.glyphId], cmds, font);
  38854. cmds.push({ cmd: 'restore' });
  38855. cmap = lookupCmap(font.cmap, String.fromCharCode(font.glyphNameMap[StandardEncoding[bchar]]));
  38856. compileCharString(font.glyphs[cmap.glyphId], cmds, font);
  38857. }
  38858. return;
  38859. case 18:
  38860. stems += stack.length >> 1;
  38861. stackClean = true;
  38862. break;
  38863. case 19:
  38864. stems += stack.length >> 1;
  38865. i += stems + 7 >> 3;
  38866. stackClean = true;
  38867. break;
  38868. case 20:
  38869. stems += stack.length >> 1;
  38870. i += stems + 7 >> 3;
  38871. stackClean = true;
  38872. break;
  38873. case 21:
  38874. y += stack.pop();
  38875. x += stack.pop();
  38876. moveTo(x, y);
  38877. stackClean = true;
  38878. break;
  38879. case 22:
  38880. x += stack.pop();
  38881. moveTo(x, y);
  38882. stackClean = true;
  38883. break;
  38884. case 23:
  38885. stems += stack.length >> 1;
  38886. stackClean = true;
  38887. break;
  38888. case 24:
  38889. while (stack.length > 2) {
  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. }
  38898. x += stack.shift();
  38899. y += stack.shift();
  38900. lineTo(x, y);
  38901. break;
  38902. case 25:
  38903. while (stack.length > 6) {
  38904. x += stack.shift();
  38905. y += stack.shift();
  38906. lineTo(x, y);
  38907. }
  38908. xa = x + stack.shift();
  38909. ya = y + stack.shift();
  38910. xb = xa + stack.shift();
  38911. yb = ya + stack.shift();
  38912. x = xb + stack.shift();
  38913. y = yb + stack.shift();
  38914. bezierCurveTo(xa, ya, xb, yb, x, y);
  38915. break;
  38916. case 26:
  38917. if (stack.length % 2) {
  38918. x += stack.shift();
  38919. }
  38920. while (stack.length > 0) {
  38921. xa = x;
  38922. ya = y + stack.shift();
  38923. xb = xa + stack.shift();
  38924. yb = ya + stack.shift();
  38925. x = xb;
  38926. y = yb + stack.shift();
  38927. bezierCurveTo(xa, ya, xb, yb, x, y);
  38928. }
  38929. break;
  38930. case 27:
  38931. if (stack.length % 2) {
  38932. y += stack.shift();
  38933. }
  38934. while (stack.length > 0) {
  38935. xa = x + stack.shift();
  38936. ya = y;
  38937. xb = xa + stack.shift();
  38938. yb = ya + stack.shift();
  38939. x = xb + stack.shift();
  38940. y = yb;
  38941. bezierCurveTo(xa, ya, xb, yb, x, y);
  38942. }
  38943. break;
  38944. case 28:
  38945. stack.push((code[i] << 24 | code[i + 1] << 16) >> 16);
  38946. i += 2;
  38947. break;
  38948. case 29:
  38949. n = stack.pop() + font.gsubrsBias;
  38950. subrCode = font.gsubrs[n];
  38951. if (subrCode) {
  38952. parse(subrCode);
  38953. }
  38954. break;
  38955. case 30:
  38956. while (stack.length > 0) {
  38957. xa = x;
  38958. ya = y + stack.shift();
  38959. xb = xa + stack.shift();
  38960. yb = ya + stack.shift();
  38961. x = xb + stack.shift();
  38962. y = yb + (stack.length === 1 ? stack.shift() : 0);
  38963. bezierCurveTo(xa, ya, xb, yb, x, y);
  38964. if (stack.length === 0) {
  38965. break;
  38966. }
  38967. xa = x + stack.shift();
  38968. ya = y;
  38969. xb = xa + stack.shift();
  38970. yb = ya + stack.shift();
  38971. y = yb + stack.shift();
  38972. x = xb + (stack.length === 1 ? stack.shift() : 0);
  38973. bezierCurveTo(xa, ya, xb, yb, x, y);
  38974. }
  38975. break;
  38976. case 31:
  38977. while (stack.length > 0) {
  38978. xa = x + stack.shift();
  38979. ya = y;
  38980. xb = xa + stack.shift();
  38981. yb = ya + stack.shift();
  38982. y = yb + stack.shift();
  38983. x = xb + (stack.length === 1 ? stack.shift() : 0);
  38984. bezierCurveTo(xa, ya, xb, yb, x, y);
  38985. if (stack.length === 0) {
  38986. break;
  38987. }
  38988. xa = x;
  38989. ya = y + stack.shift();
  38990. xb = xa + stack.shift();
  38991. yb = ya + stack.shift();
  38992. x = xb + stack.shift();
  38993. y = yb + (stack.length === 1 ? stack.shift() : 0);
  38994. bezierCurveTo(xa, ya, xb, yb, x, y);
  38995. }
  38996. break;
  38997. default:
  38998. if (v < 32) {
  38999. error('unknown operator: ' + v);
  39000. }
  39001. if (v < 247) {
  39002. stack.push(v - 139);
  39003. } else if (v < 251) {
  39004. stack.push((v - 247) * 256 + code[i++] + 108);
  39005. } else if (v < 255) {
  39006. stack.push(-(v - 251) * 256 - code[i++] - 108);
  39007. } else {
  39008. stack.push((code[i] << 24 | code[i + 1] << 16 | code[i + 2] << 8 | code[i + 3]) / 65536);
  39009. i += 4;
  39010. }
  39011. break;
  39012. }
  39013. if (stackClean) {
  39014. stack.length = 0;
  39015. }
  39016. }
  39017. }
  39018. parse(code);
  39019. }
  39020. var noop = '';
  39021. function CompiledFont(fontMatrix) {
  39022. this.compiledGlyphs = Object.create(null);
  39023. this.compiledCharCodeToGlyphId = Object.create(null);
  39024. this.fontMatrix = fontMatrix;
  39025. }
  39026. CompiledFont.prototype = {
  39027. getPathJs: function (unicode) {
  39028. var cmap = lookupCmap(this.cmap, unicode);
  39029. var fn = this.compiledGlyphs[cmap.glyphId];
  39030. if (!fn) {
  39031. fn = this.compileGlyph(this.glyphs[cmap.glyphId]);
  39032. this.compiledGlyphs[cmap.glyphId] = fn;
  39033. }
  39034. if (this.compiledCharCodeToGlyphId[cmap.charCode] === undefined) {
  39035. this.compiledCharCodeToGlyphId[cmap.charCode] = cmap.glyphId;
  39036. }
  39037. return fn;
  39038. },
  39039. compileGlyph: function (code) {
  39040. if (!code || code.length === 0 || code[0] === 14) {
  39041. return noop;
  39042. }
  39043. var cmds = [];
  39044. cmds.push({ cmd: 'save' });
  39045. cmds.push({
  39046. cmd: 'transform',
  39047. args: this.fontMatrix.slice()
  39048. });
  39049. cmds.push({
  39050. cmd: 'scale',
  39051. args: [
  39052. 'size',
  39053. '-size'
  39054. ]
  39055. });
  39056. this.compileGlyphImpl(code, cmds);
  39057. cmds.push({ cmd: 'restore' });
  39058. return cmds;
  39059. },
  39060. compileGlyphImpl: function () {
  39061. error('Children classes should implement this.');
  39062. },
  39063. hasBuiltPath: function (unicode) {
  39064. var cmap = lookupCmap(this.cmap, unicode);
  39065. return this.compiledGlyphs[cmap.glyphId] !== undefined && this.compiledCharCodeToGlyphId[cmap.charCode] !== undefined;
  39066. }
  39067. };
  39068. function TrueTypeCompiled(glyphs, cmap, fontMatrix) {
  39069. fontMatrix = fontMatrix || [
  39070. 0.000488,
  39071. 0,
  39072. 0,
  39073. 0.000488,
  39074. 0,
  39075. 0
  39076. ];
  39077. CompiledFont.call(this, fontMatrix);
  39078. this.glyphs = glyphs;
  39079. this.cmap = cmap;
  39080. }
  39081. Util.inherit(TrueTypeCompiled, CompiledFont, {
  39082. compileGlyphImpl: function (code, cmds) {
  39083. compileGlyf(code, cmds, this);
  39084. }
  39085. });
  39086. function Type2Compiled(cffInfo, cmap, fontMatrix, glyphNameMap) {
  39087. fontMatrix = fontMatrix || [
  39088. 0.001,
  39089. 0,
  39090. 0,
  39091. 0.001,
  39092. 0,
  39093. 0
  39094. ];
  39095. CompiledFont.call(this, fontMatrix);
  39096. this.glyphs = cffInfo.glyphs;
  39097. this.gsubrs = cffInfo.gsubrs || [];
  39098. this.subrs = cffInfo.subrs || [];
  39099. this.cmap = cmap;
  39100. this.glyphNameMap = glyphNameMap || getGlyphsUnicode();
  39101. this.gsubrsBias = this.gsubrs.length < 1240 ? 107 : this.gsubrs.length < 33900 ? 1131 : 32768;
  39102. this.subrsBias = this.subrs.length < 1240 ? 107 : this.subrs.length < 33900 ? 1131 : 32768;
  39103. }
  39104. Util.inherit(Type2Compiled, CompiledFont, {
  39105. compileGlyphImpl: function (code, cmds) {
  39106. compileCharString(code, cmds, this);
  39107. }
  39108. });
  39109. return {
  39110. create: function FontRendererFactory_create(font, seacAnalysisEnabled) {
  39111. var data = new Uint8Array(font.data);
  39112. var cmap, glyf, loca, cff, indexToLocFormat, unitsPerEm;
  39113. var numTables = getUshort(data, 4);
  39114. for (var i = 0, p = 12; i < numTables; i++, p += 16) {
  39115. var tag = bytesToString(data.subarray(p, p + 4));
  39116. var offset = getLong(data, p + 8);
  39117. var length = getLong(data, p + 12);
  39118. switch (tag) {
  39119. case 'cmap':
  39120. cmap = parseCmap(data, offset, offset + length);
  39121. break;
  39122. case 'glyf':
  39123. glyf = data.subarray(offset, offset + length);
  39124. break;
  39125. case 'loca':
  39126. loca = data.subarray(offset, offset + length);
  39127. break;
  39128. case 'head':
  39129. unitsPerEm = getUshort(data, offset + 18);
  39130. indexToLocFormat = getUshort(data, offset + 50);
  39131. break;
  39132. case 'CFF ':
  39133. cff = parseCff(data, offset, offset + length, seacAnalysisEnabled);
  39134. break;
  39135. }
  39136. }
  39137. if (glyf) {
  39138. var fontMatrix = !unitsPerEm ? font.fontMatrix : [
  39139. 1 / unitsPerEm,
  39140. 0,
  39141. 0,
  39142. 1 / unitsPerEm,
  39143. 0,
  39144. 0
  39145. ];
  39146. return new TrueTypeCompiled(parseGlyfTable(glyf, loca, indexToLocFormat), cmap, fontMatrix);
  39147. }
  39148. return new Type2Compiled(cff, cmap, font.fontMatrix, font.glyphNameMap);
  39149. }
  39150. };
  39151. }();
  39152. exports.FontRendererFactory = FontRendererFactory;
  39153. /***/ }),
  39154. /* 26 */
  39155. /***/ (function(module, exports, __w_pdfjs_require__) {
  39156. "use strict";
  39157. var sharedUtil = __w_pdfjs_require__(0);
  39158. var corePrimitives = __w_pdfjs_require__(1);
  39159. var coreStream = __w_pdfjs_require__(2);
  39160. var coreGlyphList = __w_pdfjs_require__(7);
  39161. var coreFontRenderer = __w_pdfjs_require__(25);
  39162. var coreEncodings = __w_pdfjs_require__(4);
  39163. var coreStandardFonts = __w_pdfjs_require__(17);
  39164. var coreUnicode = __w_pdfjs_require__(18);
  39165. var coreType1Parser = __w_pdfjs_require__(35);
  39166. var coreCFFParser = __w_pdfjs_require__(11);
  39167. var FONT_IDENTITY_MATRIX = sharedUtil.FONT_IDENTITY_MATRIX;
  39168. var FontType = sharedUtil.FontType;
  39169. var assert = sharedUtil.assert;
  39170. var bytesToString = sharedUtil.bytesToString;
  39171. var error = sharedUtil.error;
  39172. var info = sharedUtil.info;
  39173. var isArray = sharedUtil.isArray;
  39174. var isInt = sharedUtil.isInt;
  39175. var isNum = sharedUtil.isNum;
  39176. var readUint32 = sharedUtil.readUint32;
  39177. var shadow = sharedUtil.shadow;
  39178. var string32 = sharedUtil.string32;
  39179. var warn = sharedUtil.warn;
  39180. var MissingDataException = sharedUtil.MissingDataException;
  39181. var isSpace = sharedUtil.isSpace;
  39182. var Stream = coreStream.Stream;
  39183. var getGlyphsUnicode = coreGlyphList.getGlyphsUnicode;
  39184. var getDingbatsGlyphsUnicode = coreGlyphList.getDingbatsGlyphsUnicode;
  39185. var FontRendererFactory = coreFontRenderer.FontRendererFactory;
  39186. var StandardEncoding = coreEncodings.StandardEncoding;
  39187. var MacRomanEncoding = coreEncodings.MacRomanEncoding;
  39188. var SymbolSetEncoding = coreEncodings.SymbolSetEncoding;
  39189. var ZapfDingbatsEncoding = coreEncodings.ZapfDingbatsEncoding;
  39190. var getEncoding = coreEncodings.getEncoding;
  39191. var getStdFontMap = coreStandardFonts.getStdFontMap;
  39192. var getNonStdFontMap = coreStandardFonts.getNonStdFontMap;
  39193. var getGlyphMapForStandardFonts = coreStandardFonts.getGlyphMapForStandardFonts;
  39194. var getSupplementalGlyphMapForArialBlack = coreStandardFonts.getSupplementalGlyphMapForArialBlack;
  39195. var getUnicodeRangeFor = coreUnicode.getUnicodeRangeFor;
  39196. var mapSpecialUnicodeValues = coreUnicode.mapSpecialUnicodeValues;
  39197. var getUnicodeForGlyph = coreUnicode.getUnicodeForGlyph;
  39198. var Type1Parser = coreType1Parser.Type1Parser;
  39199. var CFFStandardStrings = coreCFFParser.CFFStandardStrings;
  39200. var CFFParser = coreCFFParser.CFFParser;
  39201. var CFFCompiler = coreCFFParser.CFFCompiler;
  39202. var CFF = coreCFFParser.CFF;
  39203. var CFFHeader = coreCFFParser.CFFHeader;
  39204. var CFFTopDict = coreCFFParser.CFFTopDict;
  39205. var CFFPrivateDict = coreCFFParser.CFFPrivateDict;
  39206. var CFFStrings = coreCFFParser.CFFStrings;
  39207. var CFFIndex = coreCFFParser.CFFIndex;
  39208. var CFFCharset = coreCFFParser.CFFCharset;
  39209. var PRIVATE_USE_OFFSET_START = 0xE000;
  39210. var PRIVATE_USE_OFFSET_END = 0xF8FF;
  39211. var SKIP_PRIVATE_USE_RANGE_F000_TO_F01F = false;
  39212. var PDF_GLYPH_SPACE_UNITS = 1000;
  39213. var SEAC_ANALYSIS_ENABLED = false;
  39214. var FontFlags = {
  39215. FixedPitch: 1,
  39216. Serif: 2,
  39217. Symbolic: 4,
  39218. Script: 8,
  39219. Nonsymbolic: 32,
  39220. Italic: 64,
  39221. AllCap: 65536,
  39222. SmallCap: 131072,
  39223. ForceBold: 262144
  39224. };
  39225. var MacStandardGlyphOrdering = [
  39226. '.notdef',
  39227. '.null',
  39228. 'nonmarkingreturn',
  39229. 'space',
  39230. 'exclam',
  39231. 'quotedbl',
  39232. 'numbersign',
  39233. 'dollar',
  39234. 'percent',
  39235. 'ampersand',
  39236. 'quotesingle',
  39237. 'parenleft',
  39238. 'parenright',
  39239. 'asterisk',
  39240. 'plus',
  39241. 'comma',
  39242. 'hyphen',
  39243. 'period',
  39244. 'slash',
  39245. 'zero',
  39246. 'one',
  39247. 'two',
  39248. 'three',
  39249. 'four',
  39250. 'five',
  39251. 'six',
  39252. 'seven',
  39253. 'eight',
  39254. 'nine',
  39255. 'colon',
  39256. 'semicolon',
  39257. 'less',
  39258. 'equal',
  39259. 'greater',
  39260. 'question',
  39261. 'at',
  39262. 'A',
  39263. 'B',
  39264. 'C',
  39265. 'D',
  39266. 'E',
  39267. 'F',
  39268. 'G',
  39269. 'H',
  39270. 'I',
  39271. 'J',
  39272. 'K',
  39273. 'L',
  39274. 'M',
  39275. 'N',
  39276. 'O',
  39277. 'P',
  39278. 'Q',
  39279. 'R',
  39280. 'S',
  39281. 'T',
  39282. 'U',
  39283. 'V',
  39284. 'W',
  39285. 'X',
  39286. 'Y',
  39287. 'Z',
  39288. 'bracketleft',
  39289. 'backslash',
  39290. 'bracketright',
  39291. 'asciicircum',
  39292. 'underscore',
  39293. 'grave',
  39294. 'a',
  39295. 'b',
  39296. 'c',
  39297. 'd',
  39298. 'e',
  39299. 'f',
  39300. 'g',
  39301. 'h',
  39302. 'i',
  39303. 'j',
  39304. 'k',
  39305. 'l',
  39306. 'm',
  39307. 'n',
  39308. 'o',
  39309. 'p',
  39310. 'q',
  39311. 'r',
  39312. 's',
  39313. 't',
  39314. 'u',
  39315. 'v',
  39316. 'w',
  39317. 'x',
  39318. 'y',
  39319. 'z',
  39320. 'braceleft',
  39321. 'bar',
  39322. 'braceright',
  39323. 'asciitilde',
  39324. 'Adieresis',
  39325. 'Aring',
  39326. 'Ccedilla',
  39327. 'Eacute',
  39328. 'Ntilde',
  39329. 'Odieresis',
  39330. 'Udieresis',
  39331. 'aacute',
  39332. 'agrave',
  39333. 'acircumflex',
  39334. 'adieresis',
  39335. 'atilde',
  39336. 'aring',
  39337. 'ccedilla',
  39338. 'eacute',
  39339. 'egrave',
  39340. 'ecircumflex',
  39341. 'edieresis',
  39342. 'iacute',
  39343. 'igrave',
  39344. 'icircumflex',
  39345. 'idieresis',
  39346. 'ntilde',
  39347. 'oacute',
  39348. 'ograve',
  39349. 'ocircumflex',
  39350. 'odieresis',
  39351. 'otilde',
  39352. 'uacute',
  39353. 'ugrave',
  39354. 'ucircumflex',
  39355. 'udieresis',
  39356. 'dagger',
  39357. 'degree',
  39358. 'cent',
  39359. 'sterling',
  39360. 'section',
  39361. 'bullet',
  39362. 'paragraph',
  39363. 'germandbls',
  39364. 'registered',
  39365. 'copyright',
  39366. 'trademark',
  39367. 'acute',
  39368. 'dieresis',
  39369. 'notequal',
  39370. 'AE',
  39371. 'Oslash',
  39372. 'infinity',
  39373. 'plusminus',
  39374. 'lessequal',
  39375. 'greaterequal',
  39376. 'yen',
  39377. 'mu',
  39378. 'partialdiff',
  39379. 'summation',
  39380. 'product',
  39381. 'pi',
  39382. 'integral',
  39383. 'ordfeminine',
  39384. 'ordmasculine',
  39385. 'Omega',
  39386. 'ae',
  39387. 'oslash',
  39388. 'questiondown',
  39389. 'exclamdown',
  39390. 'logicalnot',
  39391. 'radical',
  39392. 'florin',
  39393. 'approxequal',
  39394. 'Delta',
  39395. 'guillemotleft',
  39396. 'guillemotright',
  39397. 'ellipsis',
  39398. 'nonbreakingspace',
  39399. 'Agrave',
  39400. 'Atilde',
  39401. 'Otilde',
  39402. 'OE',
  39403. 'oe',
  39404. 'endash',
  39405. 'emdash',
  39406. 'quotedblleft',
  39407. 'quotedblright',
  39408. 'quoteleft',
  39409. 'quoteright',
  39410. 'divide',
  39411. 'lozenge',
  39412. 'ydieresis',
  39413. 'Ydieresis',
  39414. 'fraction',
  39415. 'currency',
  39416. 'guilsinglleft',
  39417. 'guilsinglright',
  39418. 'fi',
  39419. 'fl',
  39420. 'daggerdbl',
  39421. 'periodcentered',
  39422. 'quotesinglbase',
  39423. 'quotedblbase',
  39424. 'perthousand',
  39425. 'Acircumflex',
  39426. 'Ecircumflex',
  39427. 'Aacute',
  39428. 'Edieresis',
  39429. 'Egrave',
  39430. 'Iacute',
  39431. 'Icircumflex',
  39432. 'Idieresis',
  39433. 'Igrave',
  39434. 'Oacute',
  39435. 'Ocircumflex',
  39436. 'apple',
  39437. 'Ograve',
  39438. 'Uacute',
  39439. 'Ucircumflex',
  39440. 'Ugrave',
  39441. 'dotlessi',
  39442. 'circumflex',
  39443. 'tilde',
  39444. 'macron',
  39445. 'breve',
  39446. 'dotaccent',
  39447. 'ring',
  39448. 'cedilla',
  39449. 'hungarumlaut',
  39450. 'ogonek',
  39451. 'caron',
  39452. 'Lslash',
  39453. 'lslash',
  39454. 'Scaron',
  39455. 'scaron',
  39456. 'Zcaron',
  39457. 'zcaron',
  39458. 'brokenbar',
  39459. 'Eth',
  39460. 'eth',
  39461. 'Yacute',
  39462. 'yacute',
  39463. 'Thorn',
  39464. 'thorn',
  39465. 'minus',
  39466. 'multiply',
  39467. 'onesuperior',
  39468. 'twosuperior',
  39469. 'threesuperior',
  39470. 'onehalf',
  39471. 'onequarter',
  39472. 'threequarters',
  39473. 'franc',
  39474. 'Gbreve',
  39475. 'gbreve',
  39476. 'Idotaccent',
  39477. 'Scedilla',
  39478. 'scedilla',
  39479. 'Cacute',
  39480. 'cacute',
  39481. 'Ccaron',
  39482. 'ccaron',
  39483. 'dcroat'
  39484. ];
  39485. function adjustWidths(properties) {
  39486. if (!properties.fontMatrix) {
  39487. return;
  39488. }
  39489. if (properties.fontMatrix[0] === FONT_IDENTITY_MATRIX[0]) {
  39490. return;
  39491. }
  39492. var scale = 0.001 / properties.fontMatrix[0];
  39493. var glyphsWidths = properties.widths;
  39494. for (var glyph in glyphsWidths) {
  39495. glyphsWidths[glyph] *= scale;
  39496. }
  39497. properties.defaultWidth *= scale;
  39498. }
  39499. function adjustToUnicode(properties, builtInEncoding) {
  39500. if (properties.hasIncludedToUnicodeMap) {
  39501. return;
  39502. }
  39503. if (properties.hasEncoding) {
  39504. return;
  39505. }
  39506. if (builtInEncoding === properties.defaultEncoding) {
  39507. return;
  39508. }
  39509. if (properties.toUnicode instanceof IdentityToUnicodeMap) {
  39510. return;
  39511. }
  39512. var toUnicode = [], glyphsUnicodeMap = getGlyphsUnicode();
  39513. for (var charCode in builtInEncoding) {
  39514. var glyphName = builtInEncoding[charCode];
  39515. var unicode = getUnicodeForGlyph(glyphName, glyphsUnicodeMap);
  39516. if (unicode !== -1) {
  39517. toUnicode[charCode] = String.fromCharCode(unicode);
  39518. }
  39519. }
  39520. properties.toUnicode.amend(toUnicode);
  39521. }
  39522. function getFontType(type, subtype) {
  39523. switch (type) {
  39524. case 'Type1':
  39525. return subtype === 'Type1C' ? FontType.TYPE1C : FontType.TYPE1;
  39526. case 'CIDFontType0':
  39527. return subtype === 'CIDFontType0C' ? FontType.CIDFONTTYPE0C : FontType.CIDFONTTYPE0;
  39528. case 'OpenType':
  39529. return FontType.OPENTYPE;
  39530. case 'TrueType':
  39531. return FontType.TRUETYPE;
  39532. case 'CIDFontType2':
  39533. return FontType.CIDFONTTYPE2;
  39534. case 'MMType1':
  39535. return FontType.MMTYPE1;
  39536. case 'Type0':
  39537. return FontType.TYPE0;
  39538. default:
  39539. return FontType.UNKNOWN;
  39540. }
  39541. }
  39542. function recoverGlyphName(name, glyphsUnicodeMap) {
  39543. if (glyphsUnicodeMap[name] !== undefined) {
  39544. return name;
  39545. }
  39546. var unicode = getUnicodeForGlyph(name, glyphsUnicodeMap);
  39547. if (unicode !== -1) {
  39548. for (var key in glyphsUnicodeMap) {
  39549. if (glyphsUnicodeMap[key] === unicode) {
  39550. return key;
  39551. }
  39552. }
  39553. }
  39554. info('Unable to recover a standard glyph name for: ' + name);
  39555. return name;
  39556. }
  39557. var Glyph = function GlyphClosure() {
  39558. function Glyph(fontChar, unicode, accent, width, vmetric, operatorListId, isSpace, isInFont) {
  39559. this.fontChar = fontChar;
  39560. this.unicode = unicode;
  39561. this.accent = accent;
  39562. this.width = width;
  39563. this.vmetric = vmetric;
  39564. this.operatorListId = operatorListId;
  39565. this.isSpace = isSpace;
  39566. this.isInFont = isInFont;
  39567. }
  39568. Glyph.prototype.matchesForCache = function (fontChar, unicode, accent, width, vmetric, operatorListId, isSpace, isInFont) {
  39569. 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;
  39570. };
  39571. return Glyph;
  39572. }();
  39573. var ToUnicodeMap = function ToUnicodeMapClosure() {
  39574. function ToUnicodeMap(cmap) {
  39575. this._map = cmap;
  39576. }
  39577. ToUnicodeMap.prototype = {
  39578. get length() {
  39579. return this._map.length;
  39580. },
  39581. forEach: function (callback) {
  39582. for (var charCode in this._map) {
  39583. callback(charCode, this._map[charCode].charCodeAt(0));
  39584. }
  39585. },
  39586. has: function (i) {
  39587. return this._map[i] !== undefined;
  39588. },
  39589. get: function (i) {
  39590. return this._map[i];
  39591. },
  39592. charCodeOf: function (v) {
  39593. return this._map.indexOf(v);
  39594. },
  39595. amend: function (map) {
  39596. for (var charCode in map) {
  39597. this._map[charCode] = map[charCode];
  39598. }
  39599. }
  39600. };
  39601. return ToUnicodeMap;
  39602. }();
  39603. var IdentityToUnicodeMap = function IdentityToUnicodeMapClosure() {
  39604. function IdentityToUnicodeMap(firstChar, lastChar) {
  39605. this.firstChar = firstChar;
  39606. this.lastChar = lastChar;
  39607. }
  39608. IdentityToUnicodeMap.prototype = {
  39609. get length() {
  39610. return this.lastChar + 1 - this.firstChar;
  39611. },
  39612. forEach: function (callback) {
  39613. for (var i = this.firstChar, ii = this.lastChar; i <= ii; i++) {
  39614. callback(i, i);
  39615. }
  39616. },
  39617. has: function (i) {
  39618. return this.firstChar <= i && i <= this.lastChar;
  39619. },
  39620. get: function (i) {
  39621. if (this.firstChar <= i && i <= this.lastChar) {
  39622. return String.fromCharCode(i);
  39623. }
  39624. return undefined;
  39625. },
  39626. charCodeOf: function (v) {
  39627. return isInt(v) && v >= this.firstChar && v <= this.lastChar ? v : -1;
  39628. },
  39629. amend: function (map) {
  39630. error('Should not call amend()');
  39631. }
  39632. };
  39633. return IdentityToUnicodeMap;
  39634. }();
  39635. var OpenTypeFileBuilder = function OpenTypeFileBuilderClosure() {
  39636. function writeInt16(dest, offset, num) {
  39637. dest[offset] = num >> 8 & 0xFF;
  39638. dest[offset + 1] = num & 0xFF;
  39639. }
  39640. function writeInt32(dest, offset, num) {
  39641. dest[offset] = num >> 24 & 0xFF;
  39642. dest[offset + 1] = num >> 16 & 0xFF;
  39643. dest[offset + 2] = num >> 8 & 0xFF;
  39644. dest[offset + 3] = num & 0xFF;
  39645. }
  39646. function writeData(dest, offset, data) {
  39647. var i, ii;
  39648. if (data instanceof Uint8Array) {
  39649. dest.set(data, offset);
  39650. } else if (typeof data === 'string') {
  39651. for (i = 0, ii = data.length; i < ii; i++) {
  39652. dest[offset++] = data.charCodeAt(i) & 0xFF;
  39653. }
  39654. } else {
  39655. for (i = 0, ii = data.length; i < ii; i++) {
  39656. dest[offset++] = data[i] & 0xFF;
  39657. }
  39658. }
  39659. }
  39660. function OpenTypeFileBuilder(sfnt) {
  39661. this.sfnt = sfnt;
  39662. this.tables = Object.create(null);
  39663. }
  39664. OpenTypeFileBuilder.getSearchParams = function OpenTypeFileBuilder_getSearchParams(entriesCount, entrySize) {
  39665. var maxPower2 = 1, log2 = 0;
  39666. while ((maxPower2 ^ entriesCount) > maxPower2) {
  39667. maxPower2 <<= 1;
  39668. log2++;
  39669. }
  39670. var searchRange = maxPower2 * entrySize;
  39671. return {
  39672. range: searchRange,
  39673. entry: log2,
  39674. rangeShift: entrySize * entriesCount - searchRange
  39675. };
  39676. };
  39677. var OTF_HEADER_SIZE = 12;
  39678. var OTF_TABLE_ENTRY_SIZE = 16;
  39679. OpenTypeFileBuilder.prototype = {
  39680. toArray: function OpenTypeFileBuilder_toArray() {
  39681. var sfnt = this.sfnt;
  39682. var tables = this.tables;
  39683. var tablesNames = Object.keys(tables);
  39684. tablesNames.sort();
  39685. var numTables = tablesNames.length;
  39686. var i, j, jj, table, tableName;
  39687. var offset = OTF_HEADER_SIZE + numTables * OTF_TABLE_ENTRY_SIZE;
  39688. var tableOffsets = [offset];
  39689. for (i = 0; i < numTables; i++) {
  39690. table = tables[tablesNames[i]];
  39691. var paddedLength = (table.length + 3 & ~3) >>> 0;
  39692. offset += paddedLength;
  39693. tableOffsets.push(offset);
  39694. }
  39695. var file = new Uint8Array(offset);
  39696. for (i = 0; i < numTables; i++) {
  39697. table = tables[tablesNames[i]];
  39698. writeData(file, tableOffsets[i], table);
  39699. }
  39700. if (sfnt === 'true') {
  39701. sfnt = string32(0x00010000);
  39702. }
  39703. file[0] = sfnt.charCodeAt(0) & 0xFF;
  39704. file[1] = sfnt.charCodeAt(1) & 0xFF;
  39705. file[2] = sfnt.charCodeAt(2) & 0xFF;
  39706. file[3] = sfnt.charCodeAt(3) & 0xFF;
  39707. writeInt16(file, 4, numTables);
  39708. var searchParams = OpenTypeFileBuilder.getSearchParams(numTables, 16);
  39709. writeInt16(file, 6, searchParams.range);
  39710. writeInt16(file, 8, searchParams.entry);
  39711. writeInt16(file, 10, searchParams.rangeShift);
  39712. offset = OTF_HEADER_SIZE;
  39713. for (i = 0; i < numTables; i++) {
  39714. tableName = tablesNames[i];
  39715. file[offset] = tableName.charCodeAt(0) & 0xFF;
  39716. file[offset + 1] = tableName.charCodeAt(1) & 0xFF;
  39717. file[offset + 2] = tableName.charCodeAt(2) & 0xFF;
  39718. file[offset + 3] = tableName.charCodeAt(3) & 0xFF;
  39719. var checksum = 0;
  39720. for (j = tableOffsets[i], jj = tableOffsets[i + 1]; j < jj; j += 4) {
  39721. var quad = readUint32(file, j);
  39722. checksum = checksum + quad >>> 0;
  39723. }
  39724. writeInt32(file, offset + 4, checksum);
  39725. writeInt32(file, offset + 8, tableOffsets[i]);
  39726. writeInt32(file, offset + 12, tables[tableName].length);
  39727. offset += OTF_TABLE_ENTRY_SIZE;
  39728. }
  39729. return file;
  39730. },
  39731. addTable: function OpenTypeFileBuilder_addTable(tag, data) {
  39732. if (tag in this.tables) {
  39733. throw new Error('Table ' + tag + ' already exists');
  39734. }
  39735. this.tables[tag] = data;
  39736. }
  39737. };
  39738. return OpenTypeFileBuilder;
  39739. }();
  39740. var ProblematicCharRanges = new Int32Array([
  39741. 0x0000,
  39742. 0x0020,
  39743. 0x007F,
  39744. 0x00A1,
  39745. 0x00AD,
  39746. 0x00AE,
  39747. 0x0600,
  39748. 0x0780,
  39749. 0x08A0,
  39750. 0x10A0,
  39751. 0x1780,
  39752. 0x1800,
  39753. 0x1C00,
  39754. 0x1C50,
  39755. 0x2000,
  39756. 0x2010,
  39757. 0x2011,
  39758. 0x2012,
  39759. 0x2028,
  39760. 0x2030,
  39761. 0x205F,
  39762. 0x2070,
  39763. 0x25CC,
  39764. 0x25CD,
  39765. 0x3000,
  39766. 0x3001,
  39767. 0xAA60,
  39768. 0xAA80,
  39769. 0xFFF0,
  39770. 0x10000
  39771. ]);
  39772. var Font = function FontClosure() {
  39773. function Font(name, file, properties) {
  39774. var charCode, glyphName, unicode;
  39775. this.name = name;
  39776. this.loadedName = properties.loadedName;
  39777. this.isType3Font = properties.isType3Font;
  39778. this.sizes = [];
  39779. this.missingFile = false;
  39780. this.glyphCache = Object.create(null);
  39781. this.isSerifFont = !!(properties.flags & FontFlags.Serif);
  39782. this.isSymbolicFont = !!(properties.flags & FontFlags.Symbolic);
  39783. this.isMonospace = !!(properties.flags & FontFlags.FixedPitch);
  39784. var type = properties.type;
  39785. var subtype = properties.subtype;
  39786. this.type = type;
  39787. this.fallbackName = this.isMonospace ? 'monospace' : this.isSerifFont ? 'serif' : 'sans-serif';
  39788. this.differences = properties.differences;
  39789. this.widths = properties.widths;
  39790. this.defaultWidth = properties.defaultWidth;
  39791. this.composite = properties.composite;
  39792. this.wideChars = properties.wideChars;
  39793. this.cMap = properties.cMap;
  39794. this.ascent = properties.ascent / PDF_GLYPH_SPACE_UNITS;
  39795. this.descent = properties.descent / PDF_GLYPH_SPACE_UNITS;
  39796. this.fontMatrix = properties.fontMatrix;
  39797. this.bbox = properties.bbox;
  39798. this.toUnicode = properties.toUnicode;
  39799. this.toFontChar = [];
  39800. if (properties.type === 'Type3') {
  39801. for (charCode = 0; charCode < 256; charCode++) {
  39802. this.toFontChar[charCode] = this.differences[charCode] || properties.defaultEncoding[charCode];
  39803. }
  39804. this.fontType = FontType.TYPE3;
  39805. return;
  39806. }
  39807. this.cidEncoding = properties.cidEncoding;
  39808. this.vertical = properties.vertical;
  39809. if (this.vertical) {
  39810. this.vmetrics = properties.vmetrics;
  39811. this.defaultVMetrics = properties.defaultVMetrics;
  39812. }
  39813. var glyphsUnicodeMap;
  39814. if (!file || file.isEmpty) {
  39815. if (file) {
  39816. warn('Font file is empty in "' + name + '" (' + this.loadedName + ')');
  39817. }
  39818. this.missingFile = true;
  39819. var fontName = name.replace(/[,_]/g, '-');
  39820. var stdFontMap = getStdFontMap(), nonStdFontMap = getNonStdFontMap();
  39821. var isStandardFont = !!stdFontMap[fontName] || !!(nonStdFontMap[fontName] && stdFontMap[nonStdFontMap[fontName]]);
  39822. fontName = stdFontMap[fontName] || nonStdFontMap[fontName] || fontName;
  39823. this.bold = fontName.search(/bold/gi) !== -1;
  39824. this.italic = fontName.search(/oblique/gi) !== -1 || fontName.search(/italic/gi) !== -1;
  39825. this.black = name.search(/Black/g) !== -1;
  39826. this.remeasure = Object.keys(this.widths).length > 0;
  39827. if (isStandardFont && type === 'CIDFontType2' && properties.cidEncoding.indexOf('Identity-') === 0) {
  39828. var GlyphMapForStandardFonts = getGlyphMapForStandardFonts();
  39829. var map = [];
  39830. for (charCode in GlyphMapForStandardFonts) {
  39831. map[+charCode] = GlyphMapForStandardFonts[charCode];
  39832. }
  39833. if (/Arial-?Black/i.test(name)) {
  39834. var SupplementalGlyphMapForArialBlack = getSupplementalGlyphMapForArialBlack();
  39835. for (charCode in SupplementalGlyphMapForArialBlack) {
  39836. map[+charCode] = SupplementalGlyphMapForArialBlack[charCode];
  39837. }
  39838. }
  39839. var isIdentityUnicode = this.toUnicode instanceof IdentityToUnicodeMap;
  39840. if (!isIdentityUnicode) {
  39841. this.toUnicode.forEach(function (charCode, unicodeCharCode) {
  39842. map[+charCode] = unicodeCharCode;
  39843. });
  39844. }
  39845. this.toFontChar = map;
  39846. this.toUnicode = new ToUnicodeMap(map);
  39847. } else if (/Symbol/i.test(fontName)) {
  39848. this.toFontChar = buildToFontChar(SymbolSetEncoding, getGlyphsUnicode(), properties.differences);
  39849. } else if (/Dingbats/i.test(fontName)) {
  39850. if (/Wingdings/i.test(name)) {
  39851. warn('Non-embedded Wingdings font, falling back to ZapfDingbats.');
  39852. }
  39853. this.toFontChar = buildToFontChar(ZapfDingbatsEncoding, getDingbatsGlyphsUnicode(), properties.differences);
  39854. } else if (isStandardFont) {
  39855. this.toFontChar = buildToFontChar(properties.defaultEncoding, getGlyphsUnicode(), properties.differences);
  39856. } else {
  39857. glyphsUnicodeMap = getGlyphsUnicode();
  39858. this.toUnicode.forEach(function (charCode, unicodeCharCode) {
  39859. if (!this.composite) {
  39860. glyphName = properties.differences[charCode] || properties.defaultEncoding[charCode];
  39861. unicode = getUnicodeForGlyph(glyphName, glyphsUnicodeMap);
  39862. if (unicode !== -1) {
  39863. unicodeCharCode = unicode;
  39864. }
  39865. }
  39866. this.toFontChar[charCode] = unicodeCharCode;
  39867. }.bind(this));
  39868. }
  39869. this.loadedName = fontName.split('-')[0];
  39870. this.loading = false;
  39871. this.fontType = getFontType(type, subtype);
  39872. return;
  39873. }
  39874. if (subtype === 'Type1C') {
  39875. if (type !== 'Type1' && type !== 'MMType1') {
  39876. if (isTrueTypeFile(file)) {
  39877. subtype = 'TrueType';
  39878. } else {
  39879. type = 'Type1';
  39880. }
  39881. } else if (isOpenTypeFile(file)) {
  39882. type = subtype = 'OpenType';
  39883. }
  39884. }
  39885. if (subtype === 'CIDFontType0C' && type !== 'CIDFontType0') {
  39886. type = 'CIDFontType0';
  39887. }
  39888. if (subtype === 'OpenType') {
  39889. type = 'OpenType';
  39890. }
  39891. if (type === 'CIDFontType0') {
  39892. if (isType1File(file)) {
  39893. subtype = 'CIDFontType0';
  39894. } else if (isOpenTypeFile(file)) {
  39895. type = subtype = 'OpenType';
  39896. } else {
  39897. subtype = 'CIDFontType0C';
  39898. }
  39899. }
  39900. var data;
  39901. switch (type) {
  39902. case 'MMType1':
  39903. info('MMType1 font (' + name + '), falling back to Type1.');
  39904. case 'Type1':
  39905. case 'CIDFontType0':
  39906. this.mimetype = 'font/opentype';
  39907. var cff = subtype === 'Type1C' || subtype === 'CIDFontType0C' ? new CFFFont(file, properties) : new Type1Font(name, file, properties);
  39908. adjustWidths(properties);
  39909. data = this.convert(name, cff, properties);
  39910. break;
  39911. case 'OpenType':
  39912. case 'TrueType':
  39913. case 'CIDFontType2':
  39914. this.mimetype = 'font/opentype';
  39915. data = this.checkAndRepair(name, file, properties);
  39916. if (this.isOpenType) {
  39917. adjustWidths(properties);
  39918. type = 'OpenType';
  39919. }
  39920. break;
  39921. default:
  39922. error('Font ' + type + ' is not supported');
  39923. break;
  39924. }
  39925. this.data = data;
  39926. this.fontType = getFontType(type, subtype);
  39927. this.fontMatrix = properties.fontMatrix;
  39928. this.widths = properties.widths;
  39929. this.defaultWidth = properties.defaultWidth;
  39930. this.toUnicode = properties.toUnicode;
  39931. this.encoding = properties.baseEncoding;
  39932. this.seacMap = properties.seacMap;
  39933. this.loading = true;
  39934. }
  39935. Font.getFontID = function () {
  39936. var ID = 1;
  39937. return function Font_getFontID() {
  39938. return String(ID++);
  39939. };
  39940. }();
  39941. function int16(b0, b1) {
  39942. return (b0 << 8) + b1;
  39943. }
  39944. function signedInt16(b0, b1) {
  39945. var value = (b0 << 8) + b1;
  39946. return value & 1 << 15 ? value - 0x10000 : value;
  39947. }
  39948. function int32(b0, b1, b2, b3) {
  39949. return (b0 << 24) + (b1 << 16) + (b2 << 8) + b3;
  39950. }
  39951. function string16(value) {
  39952. return String.fromCharCode(value >> 8 & 0xff, value & 0xff);
  39953. }
  39954. function safeString16(value) {
  39955. value = value > 0x7FFF ? 0x7FFF : value < -0x8000 ? -0x8000 : value;
  39956. return String.fromCharCode(value >> 8 & 0xff, value & 0xff);
  39957. }
  39958. function isTrueTypeFile(file) {
  39959. var header = file.peekBytes(4);
  39960. return readUint32(header, 0) === 0x00010000;
  39961. }
  39962. function isOpenTypeFile(file) {
  39963. var header = file.peekBytes(4);
  39964. return bytesToString(header) === 'OTTO';
  39965. }
  39966. function isType1File(file) {
  39967. var header = file.peekBytes(2);
  39968. if (header[0] === 0x25 && header[1] === 0x21) {
  39969. return true;
  39970. }
  39971. if (header[0] === 0x80 && header[1] === 0x01) {
  39972. return true;
  39973. }
  39974. return false;
  39975. }
  39976. function buildToFontChar(encoding, glyphsUnicodeMap, differences) {
  39977. var toFontChar = [], unicode;
  39978. for (var i = 0, ii = encoding.length; i < ii; i++) {
  39979. unicode = getUnicodeForGlyph(encoding[i], glyphsUnicodeMap);
  39980. if (unicode !== -1) {
  39981. toFontChar[i] = unicode;
  39982. }
  39983. }
  39984. for (var charCode in differences) {
  39985. unicode = getUnicodeForGlyph(differences[charCode], glyphsUnicodeMap);
  39986. if (unicode !== -1) {
  39987. toFontChar[+charCode] = unicode;
  39988. }
  39989. }
  39990. return toFontChar;
  39991. }
  39992. function isProblematicUnicodeLocation(code) {
  39993. var i = 0, j = ProblematicCharRanges.length - 1;
  39994. while (i < j) {
  39995. var c = i + j + 1 >> 1;
  39996. if (code < ProblematicCharRanges[c]) {
  39997. j = c - 1;
  39998. } else {
  39999. i = c;
  40000. }
  40001. }
  40002. return !(i & 1);
  40003. }
  40004. function adjustMapping(charCodeToGlyphId, properties) {
  40005. var toUnicode = properties.toUnicode;
  40006. var isSymbolic = !!(properties.flags & FontFlags.Symbolic);
  40007. var isIdentityUnicode = properties.toUnicode instanceof IdentityToUnicodeMap;
  40008. var newMap = Object.create(null);
  40009. var toFontChar = [];
  40010. var usedFontCharCodes = [];
  40011. var nextAvailableFontCharCode = PRIVATE_USE_OFFSET_START;
  40012. for (var originalCharCode in charCodeToGlyphId) {
  40013. originalCharCode |= 0;
  40014. var glyphId = charCodeToGlyphId[originalCharCode];
  40015. var fontCharCode = originalCharCode;
  40016. var hasUnicodeValue = false;
  40017. if (!isIdentityUnicode && toUnicode.has(originalCharCode)) {
  40018. hasUnicodeValue = true;
  40019. var unicode = toUnicode.get(fontCharCode);
  40020. if (unicode.length === 1) {
  40021. fontCharCode = unicode.charCodeAt(0);
  40022. }
  40023. }
  40024. if ((usedFontCharCodes[fontCharCode] !== undefined || isProblematicUnicodeLocation(fontCharCode) || isSymbolic && !hasUnicodeValue) && nextAvailableFontCharCode <= PRIVATE_USE_OFFSET_END) {
  40025. do {
  40026. fontCharCode = nextAvailableFontCharCode++;
  40027. if (SKIP_PRIVATE_USE_RANGE_F000_TO_F01F && fontCharCode === 0xF000) {
  40028. fontCharCode = 0xF020;
  40029. nextAvailableFontCharCode = fontCharCode + 1;
  40030. }
  40031. } while (usedFontCharCodes[fontCharCode] !== undefined && nextAvailableFontCharCode <= PRIVATE_USE_OFFSET_END);
  40032. }
  40033. newMap[fontCharCode] = glyphId;
  40034. toFontChar[originalCharCode] = fontCharCode;
  40035. usedFontCharCodes[fontCharCode] = true;
  40036. }
  40037. return {
  40038. toFontChar: toFontChar,
  40039. charCodeToGlyphId: newMap,
  40040. nextAvailableFontCharCode: nextAvailableFontCharCode
  40041. };
  40042. }
  40043. function getRanges(glyphs, numGlyphs) {
  40044. var codes = [];
  40045. for (var charCode in glyphs) {
  40046. if (glyphs[charCode] >= numGlyphs) {
  40047. continue;
  40048. }
  40049. codes.push({
  40050. fontCharCode: charCode | 0,
  40051. glyphId: glyphs[charCode]
  40052. });
  40053. }
  40054. codes.sort(function fontGetRangesSort(a, b) {
  40055. return a.fontCharCode - b.fontCharCode;
  40056. });
  40057. var ranges = [];
  40058. var length = codes.length;
  40059. for (var n = 0; n < length;) {
  40060. var start = codes[n].fontCharCode;
  40061. var codeIndices = [codes[n].glyphId];
  40062. ++n;
  40063. var end = start;
  40064. while (n < length && end + 1 === codes[n].fontCharCode) {
  40065. codeIndices.push(codes[n].glyphId);
  40066. ++end;
  40067. ++n;
  40068. if (end === 0xFFFF) {
  40069. break;
  40070. }
  40071. }
  40072. ranges.push([
  40073. start,
  40074. end,
  40075. codeIndices
  40076. ]);
  40077. }
  40078. return ranges;
  40079. }
  40080. function createCmapTable(glyphs, numGlyphs) {
  40081. var ranges = getRanges(glyphs, numGlyphs);
  40082. var numTables = ranges[ranges.length - 1][1] > 0xFFFF ? 2 : 1;
  40083. var cmap = '\x00\x00' + string16(numTables) + '\x00\x03' + '\x00\x01' + string32(4 + numTables * 8);
  40084. var i, ii, j, jj;
  40085. for (i = ranges.length - 1; i >= 0; --i) {
  40086. if (ranges[i][0] <= 0xFFFF) {
  40087. break;
  40088. }
  40089. }
  40090. var bmpLength = i + 1;
  40091. if (ranges[i][0] < 0xFFFF && ranges[i][1] === 0xFFFF) {
  40092. ranges[i][1] = 0xFFFE;
  40093. }
  40094. var trailingRangesCount = ranges[i][1] < 0xFFFF ? 1 : 0;
  40095. var segCount = bmpLength + trailingRangesCount;
  40096. var searchParams = OpenTypeFileBuilder.getSearchParams(segCount, 2);
  40097. var startCount = '';
  40098. var endCount = '';
  40099. var idDeltas = '';
  40100. var idRangeOffsets = '';
  40101. var glyphsIds = '';
  40102. var bias = 0;
  40103. var range, start, end, codes;
  40104. for (i = 0, ii = bmpLength; i < ii; i++) {
  40105. range = ranges[i];
  40106. start = range[0];
  40107. end = range[1];
  40108. startCount += string16(start);
  40109. endCount += string16(end);
  40110. codes = range[2];
  40111. var contiguous = true;
  40112. for (j = 1, jj = codes.length; j < jj; ++j) {
  40113. if (codes[j] !== codes[j - 1] + 1) {
  40114. contiguous = false;
  40115. break;
  40116. }
  40117. }
  40118. if (!contiguous) {
  40119. var offset = (segCount - i) * 2 + bias * 2;
  40120. bias += end - start + 1;
  40121. idDeltas += string16(0);
  40122. idRangeOffsets += string16(offset);
  40123. for (j = 0, jj = codes.length; j < jj; ++j) {
  40124. glyphsIds += string16(codes[j]);
  40125. }
  40126. } else {
  40127. var startCode = codes[0];
  40128. idDeltas += string16(startCode - start & 0xFFFF);
  40129. idRangeOffsets += string16(0);
  40130. }
  40131. }
  40132. if (trailingRangesCount > 0) {
  40133. endCount += '\xFF\xFF';
  40134. startCount += '\xFF\xFF';
  40135. idDeltas += '\x00\x01';
  40136. idRangeOffsets += '\x00\x00';
  40137. }
  40138. var format314 = '\x00\x00' + string16(2 * segCount) + string16(searchParams.range) + string16(searchParams.entry) + string16(searchParams.rangeShift) + endCount + '\x00\x00' + startCount + idDeltas + idRangeOffsets + glyphsIds;
  40139. var format31012 = '';
  40140. var header31012 = '';
  40141. if (numTables > 1) {
  40142. cmap += '\x00\x03' + '\x00\x0A' + string32(4 + numTables * 8 + 4 + format314.length);
  40143. format31012 = '';
  40144. for (i = 0, ii = ranges.length; i < ii; i++) {
  40145. range = ranges[i];
  40146. start = range[0];
  40147. codes = range[2];
  40148. var code = codes[0];
  40149. for (j = 1, jj = codes.length; j < jj; ++j) {
  40150. if (codes[j] !== codes[j - 1] + 1) {
  40151. end = range[0] + j - 1;
  40152. format31012 += string32(start) + string32(end) + string32(code);
  40153. start = end + 1;
  40154. code = codes[j];
  40155. }
  40156. }
  40157. format31012 += string32(start) + string32(range[1]) + string32(code);
  40158. }
  40159. header31012 = '\x00\x0C' + '\x00\x00' + string32(format31012.length + 16) + '\x00\x00\x00\x00' + string32(format31012.length / 12);
  40160. }
  40161. return cmap + '\x00\x04' + string16(format314.length + 4) + format314 + header31012 + format31012;
  40162. }
  40163. function validateOS2Table(os2) {
  40164. var stream = new Stream(os2.data);
  40165. var version = stream.getUint16();
  40166. stream.getBytes(60);
  40167. var selection = stream.getUint16();
  40168. if (version < 4 && selection & 0x0300) {
  40169. return false;
  40170. }
  40171. var firstChar = stream.getUint16();
  40172. var lastChar = stream.getUint16();
  40173. if (firstChar > lastChar) {
  40174. return false;
  40175. }
  40176. stream.getBytes(6);
  40177. var usWinAscent = stream.getUint16();
  40178. if (usWinAscent === 0) {
  40179. return false;
  40180. }
  40181. os2.data[8] = os2.data[9] = 0;
  40182. return true;
  40183. }
  40184. function createOS2Table(properties, charstrings, override) {
  40185. override = override || {
  40186. unitsPerEm: 0,
  40187. yMax: 0,
  40188. yMin: 0,
  40189. ascent: 0,
  40190. descent: 0
  40191. };
  40192. var ulUnicodeRange1 = 0;
  40193. var ulUnicodeRange2 = 0;
  40194. var ulUnicodeRange3 = 0;
  40195. var ulUnicodeRange4 = 0;
  40196. var firstCharIndex = null;
  40197. var lastCharIndex = 0;
  40198. if (charstrings) {
  40199. for (var code in charstrings) {
  40200. code |= 0;
  40201. if (firstCharIndex > code || !firstCharIndex) {
  40202. firstCharIndex = code;
  40203. }
  40204. if (lastCharIndex < code) {
  40205. lastCharIndex = code;
  40206. }
  40207. var position = getUnicodeRangeFor(code);
  40208. if (position < 32) {
  40209. ulUnicodeRange1 |= 1 << position;
  40210. } else if (position < 64) {
  40211. ulUnicodeRange2 |= 1 << position - 32;
  40212. } else if (position < 96) {
  40213. ulUnicodeRange3 |= 1 << position - 64;
  40214. } else if (position < 123) {
  40215. ulUnicodeRange4 |= 1 << position - 96;
  40216. } else {
  40217. error('Unicode ranges Bits > 123 are reserved for internal usage');
  40218. }
  40219. }
  40220. } else {
  40221. firstCharIndex = 0;
  40222. lastCharIndex = 255;
  40223. }
  40224. var bbox = properties.bbox || [
  40225. 0,
  40226. 0,
  40227. 0,
  40228. 0
  40229. ];
  40230. var unitsPerEm = override.unitsPerEm || 1 / (properties.fontMatrix || FONT_IDENTITY_MATRIX)[0];
  40231. var scale = properties.ascentScaled ? 1.0 : unitsPerEm / PDF_GLYPH_SPACE_UNITS;
  40232. var typoAscent = override.ascent || Math.round(scale * (properties.ascent || bbox[3]));
  40233. var typoDescent = override.descent || Math.round(scale * (properties.descent || bbox[1]));
  40234. if (typoDescent > 0 && properties.descent > 0 && bbox[1] < 0) {
  40235. typoDescent = -typoDescent;
  40236. }
  40237. var winAscent = override.yMax || typoAscent;
  40238. var winDescent = -override.yMin || -typoDescent;
  40239. 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';
  40240. }
  40241. function createPostTable(properties) {
  40242. var angle = Math.floor(properties.italicAngle * Math.pow(2, 16));
  40243. 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';
  40244. }
  40245. function createNameTable(name, proto) {
  40246. if (!proto) {
  40247. proto = [
  40248. [],
  40249. []
  40250. ];
  40251. }
  40252. var strings = [
  40253. proto[0][0] || 'Original licence',
  40254. proto[0][1] || name,
  40255. proto[0][2] || 'Unknown',
  40256. proto[0][3] || 'uniqueID',
  40257. proto[0][4] || name,
  40258. proto[0][5] || 'Version 0.11',
  40259. proto[0][6] || '',
  40260. proto[0][7] || 'Unknown',
  40261. proto[0][8] || 'Unknown',
  40262. proto[0][9] || 'Unknown'
  40263. ];
  40264. var stringsUnicode = [];
  40265. var i, ii, j, jj, str;
  40266. for (i = 0, ii = strings.length; i < ii; i++) {
  40267. str = proto[1][i] || strings[i];
  40268. var strBufUnicode = [];
  40269. for (j = 0, jj = str.length; j < jj; j++) {
  40270. strBufUnicode.push(string16(str.charCodeAt(j)));
  40271. }
  40272. stringsUnicode.push(strBufUnicode.join(''));
  40273. }
  40274. var names = [
  40275. strings,
  40276. stringsUnicode
  40277. ];
  40278. var platforms = [
  40279. '\x00\x01',
  40280. '\x00\x03'
  40281. ];
  40282. var encodings = [
  40283. '\x00\x00',
  40284. '\x00\x01'
  40285. ];
  40286. var languages = [
  40287. '\x00\x00',
  40288. '\x04\x09'
  40289. ];
  40290. var namesRecordCount = strings.length * platforms.length;
  40291. var nameTable = '\x00\x00' + string16(namesRecordCount) + string16(namesRecordCount * 12 + 6);
  40292. var strOffset = 0;
  40293. for (i = 0, ii = platforms.length; i < ii; i++) {
  40294. var strs = names[i];
  40295. for (j = 0, jj = strs.length; j < jj; j++) {
  40296. str = strs[j];
  40297. var nameRecord = platforms[i] + encodings[i] + languages[i] + string16(j) + string16(str.length) + string16(strOffset);
  40298. nameTable += nameRecord;
  40299. strOffset += str.length;
  40300. }
  40301. }
  40302. nameTable += strings.join('') + stringsUnicode.join('');
  40303. return nameTable;
  40304. }
  40305. Font.prototype = {
  40306. name: null,
  40307. font: null,
  40308. mimetype: null,
  40309. encoding: null,
  40310. get renderer() {
  40311. var renderer = FontRendererFactory.create(this, SEAC_ANALYSIS_ENABLED);
  40312. return shadow(this, 'renderer', renderer);
  40313. },
  40314. exportData: function Font_exportData() {
  40315. var data = {};
  40316. for (var i in this) {
  40317. if (this.hasOwnProperty(i)) {
  40318. data[i] = this[i];
  40319. }
  40320. }
  40321. return data;
  40322. },
  40323. checkAndRepair: function Font_checkAndRepair(name, font, properties) {
  40324. function readTableEntry(file) {
  40325. var tag = bytesToString(file.getBytes(4));
  40326. var checksum = file.getInt32() >>> 0;
  40327. var offset = file.getInt32() >>> 0;
  40328. var length = file.getInt32() >>> 0;
  40329. var previousPosition = file.pos;
  40330. file.pos = file.start ? file.start : 0;
  40331. file.skip(offset);
  40332. var data = file.getBytes(length);
  40333. file.pos = previousPosition;
  40334. if (tag === 'head') {
  40335. data[8] = data[9] = data[10] = data[11] = 0;
  40336. data[17] |= 0x20;
  40337. }
  40338. return {
  40339. tag: tag,
  40340. checksum: checksum,
  40341. length: length,
  40342. offset: offset,
  40343. data: data
  40344. };
  40345. }
  40346. function readOpenTypeHeader(ttf) {
  40347. return {
  40348. version: bytesToString(ttf.getBytes(4)),
  40349. numTables: ttf.getUint16(),
  40350. searchRange: ttf.getUint16(),
  40351. entrySelector: ttf.getUint16(),
  40352. rangeShift: ttf.getUint16()
  40353. };
  40354. }
  40355. function readCmapTable(cmap, font, isSymbolicFont, hasEncoding) {
  40356. if (!cmap) {
  40357. warn('No cmap table available.');
  40358. return {
  40359. platformId: -1,
  40360. encodingId: -1,
  40361. mappings: [],
  40362. hasShortCmap: false
  40363. };
  40364. }
  40365. var segment;
  40366. var start = (font.start ? font.start : 0) + cmap.offset;
  40367. font.pos = start;
  40368. font.getUint16();
  40369. var numTables = font.getUint16();
  40370. var potentialTable;
  40371. var canBreak = false;
  40372. for (var i = 0; i < numTables; i++) {
  40373. var platformId = font.getUint16();
  40374. var encodingId = font.getUint16();
  40375. var offset = font.getInt32() >>> 0;
  40376. var useTable = false;
  40377. if (platformId === 0 && encodingId === 0) {
  40378. useTable = true;
  40379. } else if (platformId === 1 && encodingId === 0) {
  40380. useTable = true;
  40381. } else if (platformId === 3 && encodingId === 1 && (hasEncoding || !potentialTable)) {
  40382. useTable = true;
  40383. if (!isSymbolicFont) {
  40384. canBreak = true;
  40385. }
  40386. } else if (isSymbolicFont && platformId === 3 && encodingId === 0) {
  40387. useTable = true;
  40388. canBreak = true;
  40389. }
  40390. if (useTable) {
  40391. potentialTable = {
  40392. platformId: platformId,
  40393. encodingId: encodingId,
  40394. offset: offset
  40395. };
  40396. }
  40397. if (canBreak) {
  40398. break;
  40399. }
  40400. }
  40401. if (potentialTable) {
  40402. font.pos = start + potentialTable.offset;
  40403. }
  40404. if (!potentialTable || font.peekByte() === -1) {
  40405. warn('Could not find a preferred cmap table.');
  40406. return {
  40407. platformId: -1,
  40408. encodingId: -1,
  40409. mappings: [],
  40410. hasShortCmap: false
  40411. };
  40412. }
  40413. var format = font.getUint16();
  40414. font.getUint16();
  40415. font.getUint16();
  40416. var hasShortCmap = false;
  40417. var mappings = [];
  40418. var j, glyphId;
  40419. if (format === 0) {
  40420. for (j = 0; j < 256; j++) {
  40421. var index = font.getByte();
  40422. if (!index) {
  40423. continue;
  40424. }
  40425. mappings.push({
  40426. charCode: j,
  40427. glyphId: index
  40428. });
  40429. }
  40430. hasShortCmap = true;
  40431. } else if (format === 4) {
  40432. var segCount = font.getUint16() >> 1;
  40433. font.getBytes(6);
  40434. var segIndex, segments = [];
  40435. for (segIndex = 0; segIndex < segCount; segIndex++) {
  40436. segments.push({ end: font.getUint16() });
  40437. }
  40438. font.getUint16();
  40439. for (segIndex = 0; segIndex < segCount; segIndex++) {
  40440. segments[segIndex].start = font.getUint16();
  40441. }
  40442. for (segIndex = 0; segIndex < segCount; segIndex++) {
  40443. segments[segIndex].delta = font.getUint16();
  40444. }
  40445. var offsetsCount = 0;
  40446. for (segIndex = 0; segIndex < segCount; segIndex++) {
  40447. segment = segments[segIndex];
  40448. var rangeOffset = font.getUint16();
  40449. if (!rangeOffset) {
  40450. segment.offsetIndex = -1;
  40451. continue;
  40452. }
  40453. var offsetIndex = (rangeOffset >> 1) - (segCount - segIndex);
  40454. segment.offsetIndex = offsetIndex;
  40455. offsetsCount = Math.max(offsetsCount, offsetIndex + segment.end - segment.start + 1);
  40456. }
  40457. var offsets = [];
  40458. for (j = 0; j < offsetsCount; j++) {
  40459. offsets.push(font.getUint16());
  40460. }
  40461. for (segIndex = 0; segIndex < segCount; segIndex++) {
  40462. segment = segments[segIndex];
  40463. start = segment.start;
  40464. var end = segment.end;
  40465. var delta = segment.delta;
  40466. offsetIndex = segment.offsetIndex;
  40467. for (j = start; j <= end; j++) {
  40468. if (j === 0xFFFF) {
  40469. continue;
  40470. }
  40471. glyphId = offsetIndex < 0 ? j : offsets[offsetIndex + j - start];
  40472. glyphId = glyphId + delta & 0xFFFF;
  40473. if (glyphId === 0) {
  40474. continue;
  40475. }
  40476. mappings.push({
  40477. charCode: j,
  40478. glyphId: glyphId
  40479. });
  40480. }
  40481. }
  40482. } else if (format === 6) {
  40483. var firstCode = font.getUint16();
  40484. var entryCount = font.getUint16();
  40485. for (j = 0; j < entryCount; j++) {
  40486. glyphId = font.getUint16();
  40487. var charCode = firstCode + j;
  40488. mappings.push({
  40489. charCode: charCode,
  40490. glyphId: glyphId
  40491. });
  40492. }
  40493. } else {
  40494. warn('cmap table has unsupported format: ' + format);
  40495. return {
  40496. platformId: -1,
  40497. encodingId: -1,
  40498. mappings: [],
  40499. hasShortCmap: false
  40500. };
  40501. }
  40502. mappings.sort(function (a, b) {
  40503. return a.charCode - b.charCode;
  40504. });
  40505. for (i = 1; i < mappings.length; i++) {
  40506. if (mappings[i - 1].charCode === mappings[i].charCode) {
  40507. mappings.splice(i, 1);
  40508. i--;
  40509. }
  40510. }
  40511. return {
  40512. platformId: potentialTable.platformId,
  40513. encodingId: potentialTable.encodingId,
  40514. mappings: mappings,
  40515. hasShortCmap: hasShortCmap
  40516. };
  40517. }
  40518. function sanitizeMetrics(font, header, metrics, numGlyphs) {
  40519. if (!header) {
  40520. if (metrics) {
  40521. metrics.data = null;
  40522. }
  40523. return;
  40524. }
  40525. font.pos = (font.start ? font.start : 0) + header.offset;
  40526. font.pos += header.length - 2;
  40527. var numOfMetrics = font.getUint16();
  40528. if (numOfMetrics > numGlyphs) {
  40529. info('The numOfMetrics (' + numOfMetrics + ') should not be ' + 'greater than the numGlyphs (' + numGlyphs + ')');
  40530. numOfMetrics = numGlyphs;
  40531. header.data[34] = (numOfMetrics & 0xff00) >> 8;
  40532. header.data[35] = numOfMetrics & 0x00ff;
  40533. }
  40534. var numOfSidebearings = numGlyphs - numOfMetrics;
  40535. var numMissing = numOfSidebearings - (metrics.length - numOfMetrics * 4 >> 1);
  40536. if (numMissing > 0) {
  40537. var entries = new Uint8Array(metrics.length + numMissing * 2);
  40538. entries.set(metrics.data);
  40539. metrics.data = entries;
  40540. }
  40541. }
  40542. function sanitizeGlyph(source, sourceStart, sourceEnd, dest, destStart, hintsValid) {
  40543. if (sourceEnd - sourceStart <= 12) {
  40544. return 0;
  40545. }
  40546. var glyf = source.subarray(sourceStart, sourceEnd);
  40547. var contoursCount = glyf[0] << 8 | glyf[1];
  40548. if (contoursCount & 0x8000) {
  40549. dest.set(glyf, destStart);
  40550. return glyf.length;
  40551. }
  40552. var i, j = 10, flagsCount = 0;
  40553. for (i = 0; i < contoursCount; i++) {
  40554. var endPoint = glyf[j] << 8 | glyf[j + 1];
  40555. flagsCount = endPoint + 1;
  40556. j += 2;
  40557. }
  40558. var instructionsStart = j;
  40559. var instructionsLength = glyf[j] << 8 | glyf[j + 1];
  40560. j += 2 + instructionsLength;
  40561. var instructionsEnd = j;
  40562. var coordinatesLength = 0;
  40563. for (i = 0; i < flagsCount; i++) {
  40564. var flag = glyf[j++];
  40565. if (flag & 0xC0) {
  40566. glyf[j - 1] = flag & 0x3F;
  40567. }
  40568. var xyLength = (flag & 2 ? 1 : flag & 16 ? 0 : 2) + (flag & 4 ? 1 : flag & 32 ? 0 : 2);
  40569. coordinatesLength += xyLength;
  40570. if (flag & 8) {
  40571. var repeat = glyf[j++];
  40572. i += repeat;
  40573. coordinatesLength += repeat * xyLength;
  40574. }
  40575. }
  40576. if (coordinatesLength === 0) {
  40577. return 0;
  40578. }
  40579. var glyphDataLength = j + coordinatesLength;
  40580. if (glyphDataLength > glyf.length) {
  40581. return 0;
  40582. }
  40583. if (!hintsValid && instructionsLength > 0) {
  40584. dest.set(glyf.subarray(0, instructionsStart), destStart);
  40585. dest.set([
  40586. 0,
  40587. 0
  40588. ], destStart + instructionsStart);
  40589. dest.set(glyf.subarray(instructionsEnd, glyphDataLength), destStart + instructionsStart + 2);
  40590. glyphDataLength -= instructionsLength;
  40591. if (glyf.length - glyphDataLength > 3) {
  40592. glyphDataLength = glyphDataLength + 3 & ~3;
  40593. }
  40594. return glyphDataLength;
  40595. }
  40596. if (glyf.length - glyphDataLength > 3) {
  40597. glyphDataLength = glyphDataLength + 3 & ~3;
  40598. dest.set(glyf.subarray(0, glyphDataLength), destStart);
  40599. return glyphDataLength;
  40600. }
  40601. dest.set(glyf, destStart);
  40602. return glyf.length;
  40603. }
  40604. function sanitizeHead(head, numGlyphs, locaLength) {
  40605. var data = head.data;
  40606. var version = int32(data[0], data[1], data[2], data[3]);
  40607. if (version >> 16 !== 1) {
  40608. info('Attempting to fix invalid version in head table: ' + version);
  40609. data[0] = 0;
  40610. data[1] = 1;
  40611. data[2] = 0;
  40612. data[3] = 0;
  40613. }
  40614. var indexToLocFormat = int16(data[50], data[51]);
  40615. if (indexToLocFormat < 0 || indexToLocFormat > 1) {
  40616. info('Attempting to fix invalid indexToLocFormat in head table: ' + indexToLocFormat);
  40617. var numGlyphsPlusOne = numGlyphs + 1;
  40618. if (locaLength === numGlyphsPlusOne << 1) {
  40619. data[50] = 0;
  40620. data[51] = 0;
  40621. } else if (locaLength === numGlyphsPlusOne << 2) {
  40622. data[50] = 0;
  40623. data[51] = 1;
  40624. } else {
  40625. warn('Could not fix indexToLocFormat: ' + indexToLocFormat);
  40626. }
  40627. }
  40628. }
  40629. function sanitizeGlyphLocations(loca, glyf, numGlyphs, isGlyphLocationsLong, hintsValid, dupFirstEntry) {
  40630. var itemSize, itemDecode, itemEncode;
  40631. if (isGlyphLocationsLong) {
  40632. itemSize = 4;
  40633. itemDecode = function fontItemDecodeLong(data, offset) {
  40634. return data[offset] << 24 | data[offset + 1] << 16 | data[offset + 2] << 8 | data[offset + 3];
  40635. };
  40636. itemEncode = function fontItemEncodeLong(data, offset, value) {
  40637. data[offset] = value >>> 24 & 0xFF;
  40638. data[offset + 1] = value >> 16 & 0xFF;
  40639. data[offset + 2] = value >> 8 & 0xFF;
  40640. data[offset + 3] = value & 0xFF;
  40641. };
  40642. } else {
  40643. itemSize = 2;
  40644. itemDecode = function fontItemDecode(data, offset) {
  40645. return data[offset] << 9 | data[offset + 1] << 1;
  40646. };
  40647. itemEncode = function fontItemEncode(data, offset, value) {
  40648. data[offset] = value >> 9 & 0xFF;
  40649. data[offset + 1] = value >> 1 & 0xFF;
  40650. };
  40651. }
  40652. var locaData = loca.data;
  40653. var locaDataSize = itemSize * (1 + numGlyphs);
  40654. if (locaData.length !== locaDataSize) {
  40655. locaData = new Uint8Array(locaDataSize);
  40656. locaData.set(loca.data.subarray(0, locaDataSize));
  40657. loca.data = locaData;
  40658. }
  40659. var oldGlyfData = glyf.data;
  40660. var oldGlyfDataLength = oldGlyfData.length;
  40661. var newGlyfData = new Uint8Array(oldGlyfDataLength);
  40662. var startOffset = itemDecode(locaData, 0);
  40663. var writeOffset = 0;
  40664. var missingGlyphData = Object.create(null);
  40665. itemEncode(locaData, 0, writeOffset);
  40666. var i, j;
  40667. for (i = 0, j = itemSize; i < numGlyphs; i++, j += itemSize) {
  40668. var endOffset = itemDecode(locaData, j);
  40669. if (endOffset > oldGlyfDataLength && (oldGlyfDataLength + 3 & ~3) === endOffset) {
  40670. endOffset = oldGlyfDataLength;
  40671. }
  40672. if (endOffset > oldGlyfDataLength) {
  40673. itemEncode(locaData, j, writeOffset);
  40674. startOffset = endOffset;
  40675. continue;
  40676. }
  40677. if (startOffset === endOffset) {
  40678. missingGlyphData[i] = true;
  40679. }
  40680. var newLength = sanitizeGlyph(oldGlyfData, startOffset, endOffset, newGlyfData, writeOffset, hintsValid);
  40681. writeOffset += newLength;
  40682. itemEncode(locaData, j, writeOffset);
  40683. startOffset = endOffset;
  40684. }
  40685. if (writeOffset === 0) {
  40686. var simpleGlyph = new Uint8Array([
  40687. 0,
  40688. 1,
  40689. 0,
  40690. 0,
  40691. 0,
  40692. 0,
  40693. 0,
  40694. 0,
  40695. 0,
  40696. 0,
  40697. 0,
  40698. 0,
  40699. 0,
  40700. 0,
  40701. 49,
  40702. 0
  40703. ]);
  40704. for (i = 0, j = itemSize; i < numGlyphs; i++, j += itemSize) {
  40705. itemEncode(locaData, j, simpleGlyph.length);
  40706. }
  40707. glyf.data = simpleGlyph;
  40708. return missingGlyphData;
  40709. }
  40710. if (dupFirstEntry) {
  40711. var firstEntryLength = itemDecode(locaData, itemSize);
  40712. if (newGlyfData.length > firstEntryLength + writeOffset) {
  40713. glyf.data = newGlyfData.subarray(0, firstEntryLength + writeOffset);
  40714. } else {
  40715. glyf.data = new Uint8Array(firstEntryLength + writeOffset);
  40716. glyf.data.set(newGlyfData.subarray(0, writeOffset));
  40717. }
  40718. glyf.data.set(newGlyfData.subarray(0, firstEntryLength), writeOffset);
  40719. itemEncode(loca.data, locaData.length - itemSize, writeOffset + firstEntryLength);
  40720. } else {
  40721. glyf.data = newGlyfData.subarray(0, writeOffset);
  40722. }
  40723. return missingGlyphData;
  40724. }
  40725. function readPostScriptTable(post, properties, maxpNumGlyphs) {
  40726. var start = (font.start ? font.start : 0) + post.offset;
  40727. font.pos = start;
  40728. var length = post.length, end = start + length;
  40729. var version = font.getInt32();
  40730. font.getBytes(28);
  40731. var glyphNames;
  40732. var valid = true;
  40733. var i;
  40734. switch (version) {
  40735. case 0x00010000:
  40736. glyphNames = MacStandardGlyphOrdering;
  40737. break;
  40738. case 0x00020000:
  40739. var numGlyphs = font.getUint16();
  40740. if (numGlyphs !== maxpNumGlyphs) {
  40741. valid = false;
  40742. break;
  40743. }
  40744. var glyphNameIndexes = [];
  40745. for (i = 0; i < numGlyphs; ++i) {
  40746. var index = font.getUint16();
  40747. if (index >= 32768) {
  40748. valid = false;
  40749. break;
  40750. }
  40751. glyphNameIndexes.push(index);
  40752. }
  40753. if (!valid) {
  40754. break;
  40755. }
  40756. var customNames = [];
  40757. var strBuf = [];
  40758. while (font.pos < end) {
  40759. var stringLength = font.getByte();
  40760. strBuf.length = stringLength;
  40761. for (i = 0; i < stringLength; ++i) {
  40762. strBuf[i] = String.fromCharCode(font.getByte());
  40763. }
  40764. customNames.push(strBuf.join(''));
  40765. }
  40766. glyphNames = [];
  40767. for (i = 0; i < numGlyphs; ++i) {
  40768. var j = glyphNameIndexes[i];
  40769. if (j < 258) {
  40770. glyphNames.push(MacStandardGlyphOrdering[j]);
  40771. continue;
  40772. }
  40773. glyphNames.push(customNames[j - 258]);
  40774. }
  40775. break;
  40776. case 0x00030000:
  40777. break;
  40778. default:
  40779. warn('Unknown/unsupported post table version ' + version);
  40780. valid = false;
  40781. if (properties.defaultEncoding) {
  40782. glyphNames = properties.defaultEncoding;
  40783. }
  40784. break;
  40785. }
  40786. properties.glyphNames = glyphNames;
  40787. return valid;
  40788. }
  40789. function readNameTable(nameTable) {
  40790. var start = (font.start ? font.start : 0) + nameTable.offset;
  40791. font.pos = start;
  40792. var names = [
  40793. [],
  40794. []
  40795. ];
  40796. var length = nameTable.length, end = start + length;
  40797. var format = font.getUint16();
  40798. var FORMAT_0_HEADER_LENGTH = 6;
  40799. if (format !== 0 || length < FORMAT_0_HEADER_LENGTH) {
  40800. return names;
  40801. }
  40802. var numRecords = font.getUint16();
  40803. var stringsStart = font.getUint16();
  40804. var records = [];
  40805. var NAME_RECORD_LENGTH = 12;
  40806. var i, ii;
  40807. for (i = 0; i < numRecords && font.pos + NAME_RECORD_LENGTH <= end; i++) {
  40808. var r = {
  40809. platform: font.getUint16(),
  40810. encoding: font.getUint16(),
  40811. language: font.getUint16(),
  40812. name: font.getUint16(),
  40813. length: font.getUint16(),
  40814. offset: font.getUint16()
  40815. };
  40816. if (r.platform === 1 && r.encoding === 0 && r.language === 0 || r.platform === 3 && r.encoding === 1 && r.language === 0x409) {
  40817. records.push(r);
  40818. }
  40819. }
  40820. for (i = 0, ii = records.length; i < ii; i++) {
  40821. var record = records[i];
  40822. if (record.length <= 0) {
  40823. continue;
  40824. }
  40825. var pos = start + stringsStart + record.offset;
  40826. if (pos + record.length > end) {
  40827. continue;
  40828. }
  40829. font.pos = pos;
  40830. var nameIndex = record.name;
  40831. if (record.encoding) {
  40832. var str = '';
  40833. for (var j = 0, jj = record.length; j < jj; j += 2) {
  40834. str += String.fromCharCode(font.getUint16());
  40835. }
  40836. names[1][nameIndex] = str;
  40837. } else {
  40838. names[0][nameIndex] = bytesToString(font.getBytes(record.length));
  40839. }
  40840. }
  40841. return names;
  40842. }
  40843. var TTOpsStackDeltas = [
  40844. 0,
  40845. 0,
  40846. 0,
  40847. 0,
  40848. 0,
  40849. 0,
  40850. 0,
  40851. 0,
  40852. -2,
  40853. -2,
  40854. -2,
  40855. -2,
  40856. 0,
  40857. 0,
  40858. -2,
  40859. -5,
  40860. -1,
  40861. -1,
  40862. -1,
  40863. -1,
  40864. -1,
  40865. -1,
  40866. -1,
  40867. -1,
  40868. 0,
  40869. 0,
  40870. -1,
  40871. 0,
  40872. -1,
  40873. -1,
  40874. -1,
  40875. -1,
  40876. 1,
  40877. -1,
  40878. -999,
  40879. 0,
  40880. 1,
  40881. 0,
  40882. -1,
  40883. -2,
  40884. 0,
  40885. -1,
  40886. -2,
  40887. -1,
  40888. -1,
  40889. 0,
  40890. -1,
  40891. -1,
  40892. 0,
  40893. 0,
  40894. -999,
  40895. -999,
  40896. -1,
  40897. -1,
  40898. -1,
  40899. -1,
  40900. -2,
  40901. -999,
  40902. -2,
  40903. -2,
  40904. -999,
  40905. 0,
  40906. -2,
  40907. -2,
  40908. 0,
  40909. 0,
  40910. -2,
  40911. 0,
  40912. -2,
  40913. 0,
  40914. 0,
  40915. 0,
  40916. -2,
  40917. -1,
  40918. -1,
  40919. 1,
  40920. 1,
  40921. 0,
  40922. 0,
  40923. -1,
  40924. -1,
  40925. -1,
  40926. -1,
  40927. -1,
  40928. -1,
  40929. -1,
  40930. 0,
  40931. 0,
  40932. -1,
  40933. 0,
  40934. -1,
  40935. -1,
  40936. 0,
  40937. -999,
  40938. -1,
  40939. -1,
  40940. -1,
  40941. -1,
  40942. -1,
  40943. -1,
  40944. 0,
  40945. 0,
  40946. 0,
  40947. 0,
  40948. 0,
  40949. 0,
  40950. 0,
  40951. 0,
  40952. 0,
  40953. 0,
  40954. 0,
  40955. 0,
  40956. -2,
  40957. -999,
  40958. -999,
  40959. -999,
  40960. -999,
  40961. -999,
  40962. -1,
  40963. -1,
  40964. -2,
  40965. -2,
  40966. 0,
  40967. 0,
  40968. 0,
  40969. 0,
  40970. -1,
  40971. -1,
  40972. -999,
  40973. -2,
  40974. -2,
  40975. 0,
  40976. 0,
  40977. -1,
  40978. -2,
  40979. -2,
  40980. 0,
  40981. 0,
  40982. 0,
  40983. -1,
  40984. -1,
  40985. -1,
  40986. -2
  40987. ];
  40988. function sanitizeTTProgram(table, ttContext) {
  40989. var data = table.data;
  40990. var i = 0, j, n, b, funcId, pc, lastEndf = 0, lastDeff = 0;
  40991. var stack = [];
  40992. var callstack = [];
  40993. var functionsCalled = [];
  40994. var tooComplexToFollowFunctions = ttContext.tooComplexToFollowFunctions;
  40995. var inFDEF = false, ifLevel = 0, inELSE = 0;
  40996. for (var ii = data.length; i < ii;) {
  40997. var op = data[i++];
  40998. if (op === 0x40) {
  40999. n = data[i++];
  41000. if (inFDEF || inELSE) {
  41001. i += n;
  41002. } else {
  41003. for (j = 0; j < n; j++) {
  41004. stack.push(data[i++]);
  41005. }
  41006. }
  41007. } else if (op === 0x41) {
  41008. n = data[i++];
  41009. if (inFDEF || inELSE) {
  41010. i += n * 2;
  41011. } else {
  41012. for (j = 0; j < n; j++) {
  41013. b = data[i++];
  41014. stack.push(b << 8 | data[i++]);
  41015. }
  41016. }
  41017. } else if ((op & 0xF8) === 0xB0) {
  41018. n = op - 0xB0 + 1;
  41019. if (inFDEF || inELSE) {
  41020. i += n;
  41021. } else {
  41022. for (j = 0; j < n; j++) {
  41023. stack.push(data[i++]);
  41024. }
  41025. }
  41026. } else if ((op & 0xF8) === 0xB8) {
  41027. n = op - 0xB8 + 1;
  41028. if (inFDEF || inELSE) {
  41029. i += n * 2;
  41030. } else {
  41031. for (j = 0; j < n; j++) {
  41032. b = data[i++];
  41033. stack.push(b << 8 | data[i++]);
  41034. }
  41035. }
  41036. } else if (op === 0x2B && !tooComplexToFollowFunctions) {
  41037. if (!inFDEF && !inELSE) {
  41038. funcId = stack[stack.length - 1];
  41039. ttContext.functionsUsed[funcId] = true;
  41040. if (funcId in ttContext.functionsStackDeltas) {
  41041. stack.length += ttContext.functionsStackDeltas[funcId];
  41042. } else if (funcId in ttContext.functionsDefined && functionsCalled.indexOf(funcId) < 0) {
  41043. callstack.push({
  41044. data: data,
  41045. i: i,
  41046. stackTop: stack.length - 1
  41047. });
  41048. functionsCalled.push(funcId);
  41049. pc = ttContext.functionsDefined[funcId];
  41050. if (!pc) {
  41051. warn('TT: CALL non-existent function');
  41052. ttContext.hintsValid = false;
  41053. return;
  41054. }
  41055. data = pc.data;
  41056. i = pc.i;
  41057. }
  41058. }
  41059. } else if (op === 0x2C && !tooComplexToFollowFunctions) {
  41060. if (inFDEF || inELSE) {
  41061. warn('TT: nested FDEFs not allowed');
  41062. tooComplexToFollowFunctions = true;
  41063. }
  41064. inFDEF = true;
  41065. lastDeff = i;
  41066. funcId = stack.pop();
  41067. ttContext.functionsDefined[funcId] = {
  41068. data: data,
  41069. i: i
  41070. };
  41071. } else if (op === 0x2D) {
  41072. if (inFDEF) {
  41073. inFDEF = false;
  41074. lastEndf = i;
  41075. } else {
  41076. pc = callstack.pop();
  41077. if (!pc) {
  41078. warn('TT: ENDF bad stack');
  41079. ttContext.hintsValid = false;
  41080. return;
  41081. }
  41082. funcId = functionsCalled.pop();
  41083. data = pc.data;
  41084. i = pc.i;
  41085. ttContext.functionsStackDeltas[funcId] = stack.length - pc.stackTop;
  41086. }
  41087. } else if (op === 0x89) {
  41088. if (inFDEF || inELSE) {
  41089. warn('TT: nested IDEFs not allowed');
  41090. tooComplexToFollowFunctions = true;
  41091. }
  41092. inFDEF = true;
  41093. lastDeff = i;
  41094. } else if (op === 0x58) {
  41095. ++ifLevel;
  41096. } else if (op === 0x1B) {
  41097. inELSE = ifLevel;
  41098. } else if (op === 0x59) {
  41099. if (inELSE === ifLevel) {
  41100. inELSE = 0;
  41101. }
  41102. --ifLevel;
  41103. } else if (op === 0x1C) {
  41104. if (!inFDEF && !inELSE) {
  41105. var offset = stack[stack.length - 1];
  41106. if (offset > 0) {
  41107. i += offset - 1;
  41108. }
  41109. }
  41110. }
  41111. if (!inFDEF && !inELSE) {
  41112. var stackDelta = op <= 0x8E ? TTOpsStackDeltas[op] : op >= 0xC0 && op <= 0xDF ? -1 : op >= 0xE0 ? -2 : 0;
  41113. if (op >= 0x71 && op <= 0x75) {
  41114. n = stack.pop();
  41115. if (!isNaN(n)) {
  41116. stackDelta = -n * 2;
  41117. }
  41118. }
  41119. while (stackDelta < 0 && stack.length > 0) {
  41120. stack.pop();
  41121. stackDelta++;
  41122. }
  41123. while (stackDelta > 0) {
  41124. stack.push(NaN);
  41125. stackDelta--;
  41126. }
  41127. }
  41128. }
  41129. ttContext.tooComplexToFollowFunctions = tooComplexToFollowFunctions;
  41130. var content = [data];
  41131. if (i > data.length) {
  41132. content.push(new Uint8Array(i - data.length));
  41133. }
  41134. if (lastDeff > lastEndf) {
  41135. warn('TT: complementing a missing function tail');
  41136. content.push(new Uint8Array([
  41137. 0x22,
  41138. 0x2D
  41139. ]));
  41140. }
  41141. foldTTTable(table, content);
  41142. }
  41143. function checkInvalidFunctions(ttContext, maxFunctionDefs) {
  41144. if (ttContext.tooComplexToFollowFunctions) {
  41145. return;
  41146. }
  41147. if (ttContext.functionsDefined.length > maxFunctionDefs) {
  41148. warn('TT: more functions defined than expected');
  41149. ttContext.hintsValid = false;
  41150. return;
  41151. }
  41152. for (var j = 0, jj = ttContext.functionsUsed.length; j < jj; j++) {
  41153. if (j > maxFunctionDefs) {
  41154. warn('TT: invalid function id: ' + j);
  41155. ttContext.hintsValid = false;
  41156. return;
  41157. }
  41158. if (ttContext.functionsUsed[j] && !ttContext.functionsDefined[j]) {
  41159. warn('TT: undefined function: ' + j);
  41160. ttContext.hintsValid = false;
  41161. return;
  41162. }
  41163. }
  41164. }
  41165. function foldTTTable(table, content) {
  41166. if (content.length > 1) {
  41167. var newLength = 0;
  41168. var j, jj;
  41169. for (j = 0, jj = content.length; j < jj; j++) {
  41170. newLength += content[j].length;
  41171. }
  41172. newLength = newLength + 3 & ~3;
  41173. var result = new Uint8Array(newLength);
  41174. var pos = 0;
  41175. for (j = 0, jj = content.length; j < jj; j++) {
  41176. result.set(content[j], pos);
  41177. pos += content[j].length;
  41178. }
  41179. table.data = result;
  41180. table.length = newLength;
  41181. }
  41182. }
  41183. function sanitizeTTPrograms(fpgm, prep, cvt, maxFunctionDefs) {
  41184. var ttContext = {
  41185. functionsDefined: [],
  41186. functionsUsed: [],
  41187. functionsStackDeltas: [],
  41188. tooComplexToFollowFunctions: false,
  41189. hintsValid: true
  41190. };
  41191. if (fpgm) {
  41192. sanitizeTTProgram(fpgm, ttContext);
  41193. }
  41194. if (prep) {
  41195. sanitizeTTProgram(prep, ttContext);
  41196. }
  41197. if (fpgm) {
  41198. checkInvalidFunctions(ttContext, maxFunctionDefs);
  41199. }
  41200. if (cvt && cvt.length & 1) {
  41201. var cvtData = new Uint8Array(cvt.length + 1);
  41202. cvtData.set(cvt.data);
  41203. cvt.data = cvtData;
  41204. }
  41205. return ttContext.hintsValid;
  41206. }
  41207. font = new Stream(new Uint8Array(font.getBytes()));
  41208. var VALID_TABLES = [
  41209. 'OS/2',
  41210. 'cmap',
  41211. 'head',
  41212. 'hhea',
  41213. 'hmtx',
  41214. 'maxp',
  41215. 'name',
  41216. 'post',
  41217. 'loca',
  41218. 'glyf',
  41219. 'fpgm',
  41220. 'prep',
  41221. 'cvt ',
  41222. 'CFF '
  41223. ];
  41224. var header = readOpenTypeHeader(font);
  41225. var numTables = header.numTables;
  41226. var cff, cffFile;
  41227. var tables = Object.create(null);
  41228. tables['OS/2'] = null;
  41229. tables['cmap'] = null;
  41230. tables['head'] = null;
  41231. tables['hhea'] = null;
  41232. tables['hmtx'] = null;
  41233. tables['maxp'] = null;
  41234. tables['name'] = null;
  41235. tables['post'] = null;
  41236. var table;
  41237. for (var i = 0; i < numTables; i++) {
  41238. table = readTableEntry(font);
  41239. if (VALID_TABLES.indexOf(table.tag) < 0) {
  41240. continue;
  41241. }
  41242. if (table.length === 0) {
  41243. continue;
  41244. }
  41245. tables[table.tag] = table;
  41246. }
  41247. var isTrueType = !tables['CFF '];
  41248. if (!isTrueType) {
  41249. if (header.version === 'OTTO' && !properties.composite || !tables['head'] || !tables['hhea'] || !tables['maxp'] || !tables['post']) {
  41250. cffFile = new Stream(tables['CFF '].data);
  41251. cff = new CFFFont(cffFile, properties);
  41252. adjustWidths(properties);
  41253. return this.convert(name, cff, properties);
  41254. }
  41255. delete tables['glyf'];
  41256. delete tables['loca'];
  41257. delete tables['fpgm'];
  41258. delete tables['prep'];
  41259. delete tables['cvt '];
  41260. this.isOpenType = true;
  41261. } else {
  41262. if (!tables['loca']) {
  41263. error('Required "loca" table is not found');
  41264. }
  41265. if (!tables['glyf']) {
  41266. warn('Required "glyf" table is not found -- trying to recover.');
  41267. tables['glyf'] = {
  41268. tag: 'glyf',
  41269. data: new Uint8Array(0)
  41270. };
  41271. }
  41272. this.isOpenType = false;
  41273. }
  41274. if (!tables['maxp']) {
  41275. error('Required "maxp" table is not found');
  41276. }
  41277. font.pos = (font.start || 0) + tables['maxp'].offset;
  41278. var version = font.getInt32();
  41279. var numGlyphs = font.getUint16();
  41280. var maxFunctionDefs = 0;
  41281. if (version >= 0x00010000 && tables['maxp'].length >= 22) {
  41282. font.pos += 8;
  41283. var maxZones = font.getUint16();
  41284. if (maxZones > 2) {
  41285. tables['maxp'].data[14] = 0;
  41286. tables['maxp'].data[15] = 2;
  41287. }
  41288. font.pos += 4;
  41289. maxFunctionDefs = font.getUint16();
  41290. }
  41291. var dupFirstEntry = false;
  41292. if (properties.type === 'CIDFontType2' && properties.toUnicode && properties.toUnicode.get(0) > '\u0000') {
  41293. dupFirstEntry = true;
  41294. numGlyphs++;
  41295. tables['maxp'].data[4] = numGlyphs >> 8;
  41296. tables['maxp'].data[5] = numGlyphs & 255;
  41297. }
  41298. var hintsValid = sanitizeTTPrograms(tables['fpgm'], tables['prep'], tables['cvt '], maxFunctionDefs);
  41299. if (!hintsValid) {
  41300. delete tables['fpgm'];
  41301. delete tables['prep'];
  41302. delete tables['cvt '];
  41303. }
  41304. sanitizeMetrics(font, tables['hhea'], tables['hmtx'], numGlyphs);
  41305. if (!tables['head']) {
  41306. error('Required "head" table is not found');
  41307. }
  41308. sanitizeHead(tables['head'], numGlyphs, isTrueType ? tables['loca'].length : 0);
  41309. var missingGlyphs = Object.create(null);
  41310. if (isTrueType) {
  41311. var isGlyphLocationsLong = int16(tables['head'].data[50], tables['head'].data[51]);
  41312. missingGlyphs = sanitizeGlyphLocations(tables['loca'], tables['glyf'], numGlyphs, isGlyphLocationsLong, hintsValid, dupFirstEntry);
  41313. }
  41314. if (!tables['hhea']) {
  41315. error('Required "hhea" table is not found');
  41316. }
  41317. if (tables['hhea'].data[10] === 0 && tables['hhea'].data[11] === 0) {
  41318. tables['hhea'].data[10] = 0xFF;
  41319. tables['hhea'].data[11] = 0xFF;
  41320. }
  41321. var metricsOverride = {
  41322. unitsPerEm: int16(tables['head'].data[18], tables['head'].data[19]),
  41323. yMax: int16(tables['head'].data[42], tables['head'].data[43]),
  41324. yMin: signedInt16(tables['head'].data[38], tables['head'].data[39]),
  41325. ascent: int16(tables['hhea'].data[4], tables['hhea'].data[5]),
  41326. descent: signedInt16(tables['hhea'].data[6], tables['hhea'].data[7])
  41327. };
  41328. this.ascent = metricsOverride.ascent / metricsOverride.unitsPerEm;
  41329. this.descent = metricsOverride.descent / metricsOverride.unitsPerEm;
  41330. if (tables['post']) {
  41331. var valid = readPostScriptTable(tables['post'], properties, numGlyphs);
  41332. if (!valid) {
  41333. tables['post'] = null;
  41334. }
  41335. }
  41336. var charCodeToGlyphId = [], charCode;
  41337. var toUnicode = properties.toUnicode, widths = properties.widths;
  41338. var skipToUnicode = toUnicode instanceof IdentityToUnicodeMap || toUnicode.length === 0x10000;
  41339. function hasGlyph(glyphId, charCode, widthCode) {
  41340. if (!missingGlyphs[glyphId]) {
  41341. return true;
  41342. }
  41343. if (!skipToUnicode && charCode >= 0 && toUnicode.has(charCode)) {
  41344. return true;
  41345. }
  41346. if (widths && widthCode >= 0 && isNum(widths[widthCode])) {
  41347. return true;
  41348. }
  41349. return false;
  41350. }
  41351. if (properties.composite) {
  41352. var cidToGidMap = properties.cidToGidMap || [];
  41353. var isCidToGidMapEmpty = cidToGidMap.length === 0;
  41354. properties.cMap.forEach(function (charCode, cid) {
  41355. assert(cid <= 0xffff, 'Max size of CID is 65,535');
  41356. var glyphId = -1;
  41357. if (isCidToGidMapEmpty) {
  41358. glyphId = cid;
  41359. } else if (cidToGidMap[cid] !== undefined) {
  41360. glyphId = cidToGidMap[cid];
  41361. }
  41362. if (glyphId >= 0 && glyphId < numGlyphs && hasGlyph(glyphId, charCode, cid)) {
  41363. charCodeToGlyphId[charCode] = glyphId;
  41364. }
  41365. });
  41366. if (dupFirstEntry && (isCidToGidMapEmpty || !charCodeToGlyphId[0])) {
  41367. charCodeToGlyphId[0] = numGlyphs - 1;
  41368. }
  41369. } else {
  41370. var cmapTable = readCmapTable(tables['cmap'], font, this.isSymbolicFont, properties.hasEncoding);
  41371. var cmapPlatformId = cmapTable.platformId;
  41372. var cmapEncodingId = cmapTable.encodingId;
  41373. var cmapMappings = cmapTable.mappings;
  41374. var cmapMappingsLength = cmapMappings.length;
  41375. if (properties.hasEncoding && (cmapPlatformId === 3 && cmapEncodingId === 1 || cmapPlatformId === 1 && cmapEncodingId === 0) || cmapPlatformId === -1 && cmapEncodingId === -1 && !!getEncoding(properties.baseEncodingName)) {
  41376. var baseEncoding = [];
  41377. if (properties.baseEncodingName === 'MacRomanEncoding' || properties.baseEncodingName === 'WinAnsiEncoding') {
  41378. baseEncoding = getEncoding(properties.baseEncodingName);
  41379. }
  41380. var glyphsUnicodeMap = getGlyphsUnicode();
  41381. for (charCode = 0; charCode < 256; charCode++) {
  41382. var glyphName, standardGlyphName;
  41383. if (this.differences && charCode in this.differences) {
  41384. glyphName = this.differences[charCode];
  41385. } else if (charCode in baseEncoding && baseEncoding[charCode] !== '') {
  41386. glyphName = baseEncoding[charCode];
  41387. } else {
  41388. glyphName = StandardEncoding[charCode];
  41389. }
  41390. if (!glyphName) {
  41391. continue;
  41392. }
  41393. standardGlyphName = recoverGlyphName(glyphName, glyphsUnicodeMap);
  41394. var unicodeOrCharCode, isUnicode = false;
  41395. if (cmapPlatformId === 3 && cmapEncodingId === 1) {
  41396. unicodeOrCharCode = glyphsUnicodeMap[standardGlyphName];
  41397. isUnicode = true;
  41398. } else if (cmapPlatformId === 1 && cmapEncodingId === 0) {
  41399. unicodeOrCharCode = MacRomanEncoding.indexOf(standardGlyphName);
  41400. }
  41401. var found = false;
  41402. for (i = 0; i < cmapMappingsLength; ++i) {
  41403. if (cmapMappings[i].charCode !== unicodeOrCharCode) {
  41404. continue;
  41405. }
  41406. var code = isUnicode ? charCode : unicodeOrCharCode;
  41407. if (hasGlyph(cmapMappings[i].glyphId, code, -1)) {
  41408. charCodeToGlyphId[charCode] = cmapMappings[i].glyphId;
  41409. found = true;
  41410. break;
  41411. }
  41412. }
  41413. if (!found && properties.glyphNames) {
  41414. var glyphId = properties.glyphNames.indexOf(glyphName);
  41415. if (glyphId === -1 && standardGlyphName !== glyphName) {
  41416. glyphId = properties.glyphNames.indexOf(standardGlyphName);
  41417. }
  41418. if (glyphId > 0 && hasGlyph(glyphId, -1, -1)) {
  41419. charCodeToGlyphId[charCode] = glyphId;
  41420. found = true;
  41421. }
  41422. }
  41423. if (!found) {
  41424. charCodeToGlyphId[charCode] = 0;
  41425. }
  41426. }
  41427. } else if (cmapPlatformId === 0 && cmapEncodingId === 0) {
  41428. for (i = 0; i < cmapMappingsLength; ++i) {
  41429. charCodeToGlyphId[cmapMappings[i].charCode] = cmapMappings[i].glyphId;
  41430. }
  41431. } else {
  41432. for (i = 0; i < cmapMappingsLength; ++i) {
  41433. charCode = cmapMappings[i].charCode & 0xFF;
  41434. charCodeToGlyphId[charCode] = cmapMappings[i].glyphId;
  41435. }
  41436. }
  41437. }
  41438. if (charCodeToGlyphId.length === 0) {
  41439. charCodeToGlyphId[0] = 0;
  41440. }
  41441. var newMapping = adjustMapping(charCodeToGlyphId, properties);
  41442. this.toFontChar = newMapping.toFontChar;
  41443. tables['cmap'] = {
  41444. tag: 'cmap',
  41445. data: createCmapTable(newMapping.charCodeToGlyphId, numGlyphs)
  41446. };
  41447. if (!tables['OS/2'] || !validateOS2Table(tables['OS/2'])) {
  41448. tables['OS/2'] = {
  41449. tag: 'OS/2',
  41450. data: createOS2Table(properties, newMapping.charCodeToGlyphId, metricsOverride)
  41451. };
  41452. }
  41453. if (!tables['post']) {
  41454. tables['post'] = {
  41455. tag: 'post',
  41456. data: createPostTable(properties)
  41457. };
  41458. }
  41459. if (!isTrueType) {
  41460. try {
  41461. cffFile = new Stream(tables['CFF '].data);
  41462. var parser = new CFFParser(cffFile, properties, SEAC_ANALYSIS_ENABLED);
  41463. cff = parser.parse();
  41464. var compiler = new CFFCompiler(cff);
  41465. tables['CFF '].data = compiler.compile();
  41466. } catch (e) {
  41467. warn('Failed to compile font ' + properties.loadedName);
  41468. }
  41469. }
  41470. if (!tables['name']) {
  41471. tables['name'] = {
  41472. tag: 'name',
  41473. data: createNameTable(this.name)
  41474. };
  41475. } else {
  41476. var namePrototype = readNameTable(tables['name']);
  41477. tables['name'].data = createNameTable(name, namePrototype);
  41478. }
  41479. var builder = new OpenTypeFileBuilder(header.version);
  41480. for (var tableTag in tables) {
  41481. builder.addTable(tableTag, tables[tableTag].data);
  41482. }
  41483. return builder.toArray();
  41484. },
  41485. convert: function Font_convert(fontName, font, properties) {
  41486. properties.fixedPitch = false;
  41487. if (properties.builtInEncoding) {
  41488. adjustToUnicode(properties, properties.builtInEncoding);
  41489. }
  41490. var mapping = font.getGlyphMapping(properties);
  41491. var newMapping = adjustMapping(mapping, properties);
  41492. this.toFontChar = newMapping.toFontChar;
  41493. var numGlyphs = font.numGlyphs;
  41494. function getCharCodes(charCodeToGlyphId, glyphId) {
  41495. var charCodes = null;
  41496. for (var charCode in charCodeToGlyphId) {
  41497. if (glyphId === charCodeToGlyphId[charCode]) {
  41498. if (!charCodes) {
  41499. charCodes = [];
  41500. }
  41501. charCodes.push(charCode | 0);
  41502. }
  41503. }
  41504. return charCodes;
  41505. }
  41506. function createCharCode(charCodeToGlyphId, glyphId) {
  41507. for (var charCode in charCodeToGlyphId) {
  41508. if (glyphId === charCodeToGlyphId[charCode]) {
  41509. return charCode | 0;
  41510. }
  41511. }
  41512. newMapping.charCodeToGlyphId[newMapping.nextAvailableFontCharCode] = glyphId;
  41513. return newMapping.nextAvailableFontCharCode++;
  41514. }
  41515. var seacs = font.seacs;
  41516. if (SEAC_ANALYSIS_ENABLED && seacs && seacs.length) {
  41517. var matrix = properties.fontMatrix || FONT_IDENTITY_MATRIX;
  41518. var charset = font.getCharset();
  41519. var seacMap = Object.create(null);
  41520. for (var glyphId in seacs) {
  41521. glyphId |= 0;
  41522. var seac = seacs[glyphId];
  41523. var baseGlyphName = StandardEncoding[seac[2]];
  41524. var accentGlyphName = StandardEncoding[seac[3]];
  41525. var baseGlyphId = charset.indexOf(baseGlyphName);
  41526. var accentGlyphId = charset.indexOf(accentGlyphName);
  41527. if (baseGlyphId < 0 || accentGlyphId < 0) {
  41528. continue;
  41529. }
  41530. var accentOffset = {
  41531. x: seac[0] * matrix[0] + seac[1] * matrix[2] + matrix[4],
  41532. y: seac[0] * matrix[1] + seac[1] * matrix[3] + matrix[5]
  41533. };
  41534. var charCodes = getCharCodes(mapping, glyphId);
  41535. if (!charCodes) {
  41536. continue;
  41537. }
  41538. for (var i = 0, ii = charCodes.length; i < ii; i++) {
  41539. var charCode = charCodes[i];
  41540. var charCodeToGlyphId = newMapping.charCodeToGlyphId;
  41541. var baseFontCharCode = createCharCode(charCodeToGlyphId, baseGlyphId);
  41542. var accentFontCharCode = createCharCode(charCodeToGlyphId, accentGlyphId);
  41543. seacMap[charCode] = {
  41544. baseFontCharCode: baseFontCharCode,
  41545. accentFontCharCode: accentFontCharCode,
  41546. accentOffset: accentOffset
  41547. };
  41548. }
  41549. }
  41550. properties.seacMap = seacMap;
  41551. }
  41552. var unitsPerEm = 1 / (properties.fontMatrix || FONT_IDENTITY_MATRIX)[0];
  41553. var builder = new OpenTypeFileBuilder('\x4F\x54\x54\x4F');
  41554. builder.addTable('CFF ', font.data);
  41555. builder.addTable('OS/2', createOS2Table(properties, newMapping.charCodeToGlyphId));
  41556. builder.addTable('cmap', createCmapTable(newMapping.charCodeToGlyphId, numGlyphs));
  41557. 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');
  41558. 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));
  41559. builder.addTable('hmtx', function fontFieldsHmtx() {
  41560. var charstrings = font.charstrings;
  41561. var cffWidths = font.cff ? font.cff.widths : null;
  41562. var hmtx = '\x00\x00\x00\x00';
  41563. for (var i = 1, ii = numGlyphs; i < ii; i++) {
  41564. var width = 0;
  41565. if (charstrings) {
  41566. var charstring = charstrings[i - 1];
  41567. width = 'width' in charstring ? charstring.width : 0;
  41568. } else if (cffWidths) {
  41569. width = Math.ceil(cffWidths[i] || 0);
  41570. }
  41571. hmtx += string16(width) + string16(0);
  41572. }
  41573. return hmtx;
  41574. }());
  41575. builder.addTable('maxp', '\x00\x00\x50\x00' + string16(numGlyphs));
  41576. builder.addTable('name', createNameTable(fontName));
  41577. builder.addTable('post', createPostTable(properties));
  41578. return builder.toArray();
  41579. },
  41580. get spaceWidth() {
  41581. if ('_shadowWidth' in this) {
  41582. return this._shadowWidth;
  41583. }
  41584. var possibleSpaceReplacements = [
  41585. 'space',
  41586. 'minus',
  41587. 'one',
  41588. 'i',
  41589. 'I'
  41590. ];
  41591. var width;
  41592. for (var i = 0, ii = possibleSpaceReplacements.length; i < ii; i++) {
  41593. var glyphName = possibleSpaceReplacements[i];
  41594. if (glyphName in this.widths) {
  41595. width = this.widths[glyphName];
  41596. break;
  41597. }
  41598. var glyphsUnicodeMap = getGlyphsUnicode();
  41599. var glyphUnicode = glyphsUnicodeMap[glyphName];
  41600. var charcode = 0;
  41601. if (this.composite) {
  41602. if (this.cMap.contains(glyphUnicode)) {
  41603. charcode = this.cMap.lookup(glyphUnicode);
  41604. }
  41605. }
  41606. if (!charcode && this.toUnicode) {
  41607. charcode = this.toUnicode.charCodeOf(glyphUnicode);
  41608. }
  41609. if (charcode <= 0) {
  41610. charcode = glyphUnicode;
  41611. }
  41612. width = this.widths[charcode];
  41613. if (width) {
  41614. break;
  41615. }
  41616. }
  41617. width = width || this.defaultWidth;
  41618. this._shadowWidth = width;
  41619. return width;
  41620. },
  41621. charToGlyph: function Font_charToGlyph(charcode, isSpace) {
  41622. var fontCharCode, width, operatorListId;
  41623. var widthCode = charcode;
  41624. if (this.cMap && this.cMap.contains(charcode)) {
  41625. widthCode = this.cMap.lookup(charcode);
  41626. }
  41627. width = this.widths[widthCode];
  41628. width = isNum(width) ? width : this.defaultWidth;
  41629. var vmetric = this.vmetrics && this.vmetrics[widthCode];
  41630. var unicode = this.toUnicode.get(charcode) || charcode;
  41631. if (typeof unicode === 'number') {
  41632. unicode = String.fromCharCode(unicode);
  41633. }
  41634. var isInFont = charcode in this.toFontChar;
  41635. fontCharCode = this.toFontChar[charcode] || charcode;
  41636. if (this.missingFile) {
  41637. fontCharCode = mapSpecialUnicodeValues(fontCharCode);
  41638. }
  41639. if (this.isType3Font) {
  41640. operatorListId = fontCharCode;
  41641. }
  41642. var accent = null;
  41643. if (this.seacMap && this.seacMap[charcode]) {
  41644. isInFont = true;
  41645. var seac = this.seacMap[charcode];
  41646. fontCharCode = seac.baseFontCharCode;
  41647. accent = {
  41648. fontChar: String.fromCharCode(seac.accentFontCharCode),
  41649. offset: seac.accentOffset
  41650. };
  41651. }
  41652. var fontChar = String.fromCharCode(fontCharCode);
  41653. var glyph = this.glyphCache[charcode];
  41654. if (!glyph || !glyph.matchesForCache(fontChar, unicode, accent, width, vmetric, operatorListId, isSpace, isInFont)) {
  41655. glyph = new Glyph(fontChar, unicode, accent, width, vmetric, operatorListId, isSpace, isInFont);
  41656. this.glyphCache[charcode] = glyph;
  41657. }
  41658. return glyph;
  41659. },
  41660. charsToGlyphs: function Font_charsToGlyphs(chars) {
  41661. var charsCache = this.charsCache;
  41662. var glyphs, glyph, charcode;
  41663. if (charsCache) {
  41664. glyphs = charsCache[chars];
  41665. if (glyphs) {
  41666. return glyphs;
  41667. }
  41668. }
  41669. if (!charsCache) {
  41670. charsCache = this.charsCache = Object.create(null);
  41671. }
  41672. glyphs = [];
  41673. var charsCacheKey = chars;
  41674. var i = 0, ii;
  41675. if (this.cMap) {
  41676. var c = Object.create(null);
  41677. while (i < chars.length) {
  41678. this.cMap.readCharCode(chars, i, c);
  41679. charcode = c.charcode;
  41680. var length = c.length;
  41681. i += length;
  41682. var isSpace = length === 1 && chars.charCodeAt(i - 1) === 0x20;
  41683. glyph = this.charToGlyph(charcode, isSpace);
  41684. glyphs.push(glyph);
  41685. }
  41686. } else {
  41687. for (i = 0, ii = chars.length; i < ii; ++i) {
  41688. charcode = chars.charCodeAt(i);
  41689. glyph = this.charToGlyph(charcode, charcode === 0x20);
  41690. glyphs.push(glyph);
  41691. }
  41692. }
  41693. return charsCache[charsCacheKey] = glyphs;
  41694. }
  41695. };
  41696. return Font;
  41697. }();
  41698. var ErrorFont = function ErrorFontClosure() {
  41699. function ErrorFont(error) {
  41700. this.error = error;
  41701. this.loadedName = 'g_font_error';
  41702. this.loading = false;
  41703. }
  41704. ErrorFont.prototype = {
  41705. charsToGlyphs: function ErrorFont_charsToGlyphs() {
  41706. return [];
  41707. },
  41708. exportData: function ErrorFont_exportData() {
  41709. return { error: this.error };
  41710. }
  41711. };
  41712. return ErrorFont;
  41713. }();
  41714. function type1FontGlyphMapping(properties, builtInEncoding, glyphNames) {
  41715. var charCodeToGlyphId = Object.create(null);
  41716. var glyphId, charCode, baseEncoding;
  41717. var isSymbolicFont = !!(properties.flags & FontFlags.Symbolic);
  41718. if (properties.baseEncodingName) {
  41719. baseEncoding = getEncoding(properties.baseEncodingName);
  41720. for (charCode = 0; charCode < baseEncoding.length; charCode++) {
  41721. glyphId = glyphNames.indexOf(baseEncoding[charCode]);
  41722. if (glyphId >= 0) {
  41723. charCodeToGlyphId[charCode] = glyphId;
  41724. } else {
  41725. charCodeToGlyphId[charCode] = 0;
  41726. }
  41727. }
  41728. } else if (isSymbolicFont) {
  41729. for (charCode in builtInEncoding) {
  41730. charCodeToGlyphId[charCode] = builtInEncoding[charCode];
  41731. }
  41732. } else {
  41733. baseEncoding = StandardEncoding;
  41734. for (charCode = 0; charCode < baseEncoding.length; charCode++) {
  41735. glyphId = glyphNames.indexOf(baseEncoding[charCode]);
  41736. if (glyphId >= 0) {
  41737. charCodeToGlyphId[charCode] = glyphId;
  41738. } else {
  41739. charCodeToGlyphId[charCode] = 0;
  41740. }
  41741. }
  41742. }
  41743. var differences = properties.differences, glyphsUnicodeMap;
  41744. if (differences) {
  41745. for (charCode in differences) {
  41746. var glyphName = differences[charCode];
  41747. glyphId = glyphNames.indexOf(glyphName);
  41748. if (glyphId === -1) {
  41749. if (!glyphsUnicodeMap) {
  41750. glyphsUnicodeMap = getGlyphsUnicode();
  41751. }
  41752. var standardGlyphName = recoverGlyphName(glyphName, glyphsUnicodeMap);
  41753. if (standardGlyphName !== glyphName) {
  41754. glyphId = glyphNames.indexOf(standardGlyphName);
  41755. }
  41756. }
  41757. if (glyphId >= 0) {
  41758. charCodeToGlyphId[charCode] = glyphId;
  41759. } else {
  41760. charCodeToGlyphId[charCode] = 0;
  41761. }
  41762. }
  41763. }
  41764. return charCodeToGlyphId;
  41765. }
  41766. var Type1Font = function Type1FontClosure() {
  41767. function findBlock(streamBytes, signature, startIndex) {
  41768. var streamBytesLength = streamBytes.length;
  41769. var signatureLength = signature.length;
  41770. var scanLength = streamBytesLength - signatureLength;
  41771. var i = startIndex, j, found = false;
  41772. while (i < scanLength) {
  41773. j = 0;
  41774. while (j < signatureLength && streamBytes[i + j] === signature[j]) {
  41775. j++;
  41776. }
  41777. if (j >= signatureLength) {
  41778. i += j;
  41779. while (i < streamBytesLength && isSpace(streamBytes[i])) {
  41780. i++;
  41781. }
  41782. found = true;
  41783. break;
  41784. }
  41785. i++;
  41786. }
  41787. return {
  41788. found: found,
  41789. length: i
  41790. };
  41791. }
  41792. function getHeaderBlock(stream, suggestedLength) {
  41793. var EEXEC_SIGNATURE = [
  41794. 0x65,
  41795. 0x65,
  41796. 0x78,
  41797. 0x65,
  41798. 0x63
  41799. ];
  41800. var streamStartPos = stream.pos;
  41801. var headerBytes, headerBytesLength, block;
  41802. try {
  41803. headerBytes = stream.getBytes(suggestedLength);
  41804. headerBytesLength = headerBytes.length;
  41805. } catch (ex) {
  41806. if (ex instanceof MissingDataException) {
  41807. throw ex;
  41808. }
  41809. }
  41810. if (headerBytesLength === suggestedLength) {
  41811. block = findBlock(headerBytes, EEXEC_SIGNATURE, suggestedLength - 2 * EEXEC_SIGNATURE.length);
  41812. if (block.found && block.length === suggestedLength) {
  41813. return {
  41814. stream: new Stream(headerBytes),
  41815. length: suggestedLength
  41816. };
  41817. }
  41818. }
  41819. warn('Invalid "Length1" property in Type1 font -- trying to recover.');
  41820. stream.pos = streamStartPos;
  41821. var SCAN_BLOCK_LENGTH = 2048;
  41822. var actualLength;
  41823. while (true) {
  41824. var scanBytes = stream.peekBytes(SCAN_BLOCK_LENGTH);
  41825. block = findBlock(scanBytes, EEXEC_SIGNATURE, 0);
  41826. if (block.length === 0) {
  41827. break;
  41828. }
  41829. stream.pos += block.length;
  41830. if (block.found) {
  41831. actualLength = stream.pos - streamStartPos;
  41832. break;
  41833. }
  41834. }
  41835. stream.pos = streamStartPos;
  41836. if (actualLength) {
  41837. return {
  41838. stream: new Stream(stream.getBytes(actualLength)),
  41839. length: actualLength
  41840. };
  41841. }
  41842. warn('Unable to recover "Length1" property in Type1 font -- using as is.');
  41843. return {
  41844. stream: new Stream(stream.getBytes(suggestedLength)),
  41845. length: suggestedLength
  41846. };
  41847. }
  41848. function getEexecBlock(stream, suggestedLength) {
  41849. var eexecBytes = stream.getBytes();
  41850. return {
  41851. stream: new Stream(eexecBytes),
  41852. length: eexecBytes.length
  41853. };
  41854. }
  41855. function Type1Font(name, file, properties) {
  41856. var PFB_HEADER_SIZE = 6;
  41857. var headerBlockLength = properties.length1;
  41858. var eexecBlockLength = properties.length2;
  41859. var pfbHeader = file.peekBytes(PFB_HEADER_SIZE);
  41860. var pfbHeaderPresent = pfbHeader[0] === 0x80 && pfbHeader[1] === 0x01;
  41861. if (pfbHeaderPresent) {
  41862. file.skip(PFB_HEADER_SIZE);
  41863. headerBlockLength = pfbHeader[5] << 24 | pfbHeader[4] << 16 | pfbHeader[3] << 8 | pfbHeader[2];
  41864. }
  41865. var headerBlock = getHeaderBlock(file, headerBlockLength);
  41866. headerBlockLength = headerBlock.length;
  41867. var headerBlockParser = new Type1Parser(headerBlock.stream, false, SEAC_ANALYSIS_ENABLED);
  41868. headerBlockParser.extractFontHeader(properties);
  41869. if (pfbHeaderPresent) {
  41870. pfbHeader = file.getBytes(PFB_HEADER_SIZE);
  41871. eexecBlockLength = pfbHeader[5] << 24 | pfbHeader[4] << 16 | pfbHeader[3] << 8 | pfbHeader[2];
  41872. }
  41873. var eexecBlock = getEexecBlock(file, eexecBlockLength);
  41874. eexecBlockLength = eexecBlock.length;
  41875. var eexecBlockParser = new Type1Parser(eexecBlock.stream, true, SEAC_ANALYSIS_ENABLED);
  41876. var data = eexecBlockParser.extractFontProgram();
  41877. for (var info in data.properties) {
  41878. properties[info] = data.properties[info];
  41879. }
  41880. var charstrings = data.charstrings;
  41881. var type2Charstrings = this.getType2Charstrings(charstrings);
  41882. var subrs = this.getType2Subrs(data.subrs);
  41883. this.charstrings = charstrings;
  41884. this.data = this.wrap(name, type2Charstrings, this.charstrings, subrs, properties);
  41885. this.seacs = this.getSeacs(data.charstrings);
  41886. }
  41887. Type1Font.prototype = {
  41888. get numGlyphs() {
  41889. return this.charstrings.length + 1;
  41890. },
  41891. getCharset: function Type1Font_getCharset() {
  41892. var charset = ['.notdef'];
  41893. var charstrings = this.charstrings;
  41894. for (var glyphId = 0; glyphId < charstrings.length; glyphId++) {
  41895. charset.push(charstrings[glyphId].glyphName);
  41896. }
  41897. return charset;
  41898. },
  41899. getGlyphMapping: function Type1Font_getGlyphMapping(properties) {
  41900. var charstrings = this.charstrings;
  41901. var glyphNames = ['.notdef'], glyphId;
  41902. for (glyphId = 0; glyphId < charstrings.length; glyphId++) {
  41903. glyphNames.push(charstrings[glyphId].glyphName);
  41904. }
  41905. var encoding = properties.builtInEncoding;
  41906. if (encoding) {
  41907. var builtInEncoding = Object.create(null);
  41908. for (var charCode in encoding) {
  41909. glyphId = glyphNames.indexOf(encoding[charCode]);
  41910. if (glyphId >= 0) {
  41911. builtInEncoding[charCode] = glyphId;
  41912. }
  41913. }
  41914. }
  41915. return type1FontGlyphMapping(properties, builtInEncoding, glyphNames);
  41916. },
  41917. getSeacs: function Type1Font_getSeacs(charstrings) {
  41918. var i, ii;
  41919. var seacMap = [];
  41920. for (i = 0, ii = charstrings.length; i < ii; i++) {
  41921. var charstring = charstrings[i];
  41922. if (charstring.seac) {
  41923. seacMap[i + 1] = charstring.seac;
  41924. }
  41925. }
  41926. return seacMap;
  41927. },
  41928. getType2Charstrings: function Type1Font_getType2Charstrings(type1Charstrings) {
  41929. var type2Charstrings = [];
  41930. for (var i = 0, ii = type1Charstrings.length; i < ii; i++) {
  41931. type2Charstrings.push(type1Charstrings[i].charstring);
  41932. }
  41933. return type2Charstrings;
  41934. },
  41935. getType2Subrs: function Type1Font_getType2Subrs(type1Subrs) {
  41936. var bias = 0;
  41937. var count = type1Subrs.length;
  41938. if (count < 1133) {
  41939. bias = 107;
  41940. } else if (count < 33769) {
  41941. bias = 1131;
  41942. } else {
  41943. bias = 32768;
  41944. }
  41945. var type2Subrs = [];
  41946. var i;
  41947. for (i = 0; i < bias; i++) {
  41948. type2Subrs.push([0x0B]);
  41949. }
  41950. for (i = 0; i < count; i++) {
  41951. type2Subrs.push(type1Subrs[i]);
  41952. }
  41953. return type2Subrs;
  41954. },
  41955. wrap: function Type1Font_wrap(name, glyphs, charstrings, subrs, properties) {
  41956. var cff = new CFF();
  41957. cff.header = new CFFHeader(1, 0, 4, 4);
  41958. cff.names = [name];
  41959. var topDict = new CFFTopDict();
  41960. topDict.setByName('version', 391);
  41961. topDict.setByName('Notice', 392);
  41962. topDict.setByName('FullName', 393);
  41963. topDict.setByName('FamilyName', 394);
  41964. topDict.setByName('Weight', 395);
  41965. topDict.setByName('Encoding', null);
  41966. topDict.setByName('FontMatrix', properties.fontMatrix);
  41967. topDict.setByName('FontBBox', properties.bbox);
  41968. topDict.setByName('charset', null);
  41969. topDict.setByName('CharStrings', null);
  41970. topDict.setByName('Private', null);
  41971. cff.topDict = topDict;
  41972. var strings = new CFFStrings();
  41973. strings.add('Version 0.11');
  41974. strings.add('See original notice');
  41975. strings.add(name);
  41976. strings.add(name);
  41977. strings.add('Medium');
  41978. cff.strings = strings;
  41979. cff.globalSubrIndex = new CFFIndex();
  41980. var count = glyphs.length;
  41981. var charsetArray = [0];
  41982. var i, ii;
  41983. for (i = 0; i < count; i++) {
  41984. var index = CFFStandardStrings.indexOf(charstrings[i].glyphName);
  41985. if (index === -1) {
  41986. index = 0;
  41987. }
  41988. charsetArray.push(index >> 8 & 0xff, index & 0xff);
  41989. }
  41990. cff.charset = new CFFCharset(false, 0, [], charsetArray);
  41991. var charStringsIndex = new CFFIndex();
  41992. charStringsIndex.add([
  41993. 0x8B,
  41994. 0x0E
  41995. ]);
  41996. for (i = 0; i < count; i++) {
  41997. var glyph = glyphs[i];
  41998. if (glyph.length === 0) {
  41999. charStringsIndex.add([
  42000. 0x8B,
  42001. 0x0E
  42002. ]);
  42003. continue;
  42004. }
  42005. charStringsIndex.add(glyph);
  42006. }
  42007. cff.charStrings = charStringsIndex;
  42008. var privateDict = new CFFPrivateDict();
  42009. privateDict.setByName('Subrs', null);
  42010. var fields = [
  42011. 'BlueValues',
  42012. 'OtherBlues',
  42013. 'FamilyBlues',
  42014. 'FamilyOtherBlues',
  42015. 'StemSnapH',
  42016. 'StemSnapV',
  42017. 'BlueShift',
  42018. 'BlueFuzz',
  42019. 'BlueScale',
  42020. 'LanguageGroup',
  42021. 'ExpansionFactor',
  42022. 'ForceBold',
  42023. 'StdHW',
  42024. 'StdVW'
  42025. ];
  42026. for (i = 0, ii = fields.length; i < ii; i++) {
  42027. var field = fields[i];
  42028. if (!(field in properties.privateData)) {
  42029. continue;
  42030. }
  42031. var value = properties.privateData[field];
  42032. if (isArray(value)) {
  42033. for (var j = value.length - 1; j > 0; j--) {
  42034. value[j] -= value[j - 1];
  42035. }
  42036. }
  42037. privateDict.setByName(field, value);
  42038. }
  42039. cff.topDict.privateDict = privateDict;
  42040. var subrIndex = new CFFIndex();
  42041. for (i = 0, ii = subrs.length; i < ii; i++) {
  42042. subrIndex.add(subrs[i]);
  42043. }
  42044. privateDict.subrsIndex = subrIndex;
  42045. var compiler = new CFFCompiler(cff);
  42046. return compiler.compile();
  42047. }
  42048. };
  42049. return Type1Font;
  42050. }();
  42051. var CFFFont = function CFFFontClosure() {
  42052. function CFFFont(file, properties) {
  42053. this.properties = properties;
  42054. var parser = new CFFParser(file, properties, SEAC_ANALYSIS_ENABLED);
  42055. this.cff = parser.parse();
  42056. var compiler = new CFFCompiler(this.cff);
  42057. this.seacs = this.cff.seacs;
  42058. try {
  42059. this.data = compiler.compile();
  42060. } catch (e) {
  42061. warn('Failed to compile font ' + properties.loadedName);
  42062. this.data = file;
  42063. }
  42064. }
  42065. CFFFont.prototype = {
  42066. get numGlyphs() {
  42067. return this.cff.charStrings.count;
  42068. },
  42069. getCharset: function CFFFont_getCharset() {
  42070. return this.cff.charset.charset;
  42071. },
  42072. getGlyphMapping: function CFFFont_getGlyphMapping() {
  42073. var cff = this.cff;
  42074. var properties = this.properties;
  42075. var charsets = cff.charset.charset;
  42076. var charCodeToGlyphId;
  42077. var glyphId;
  42078. if (properties.composite) {
  42079. charCodeToGlyphId = Object.create(null);
  42080. if (cff.isCIDFont) {
  42081. for (glyphId = 0; glyphId < charsets.length; glyphId++) {
  42082. var cid = charsets[glyphId];
  42083. var charCode = properties.cMap.charCodeOf(cid);
  42084. charCodeToGlyphId[charCode] = glyphId;
  42085. }
  42086. } else {
  42087. for (glyphId = 0; glyphId < cff.charStrings.count; glyphId++) {
  42088. charCodeToGlyphId[glyphId] = glyphId;
  42089. }
  42090. }
  42091. return charCodeToGlyphId;
  42092. }
  42093. var encoding = cff.encoding ? cff.encoding.encoding : null;
  42094. charCodeToGlyphId = type1FontGlyphMapping(properties, encoding, charsets);
  42095. return charCodeToGlyphId;
  42096. }
  42097. };
  42098. return CFFFont;
  42099. }();
  42100. (function checkSeacSupport() {
  42101. if (typeof navigator !== 'undefined' && /Windows/.test(navigator.userAgent)) {
  42102. SEAC_ANALYSIS_ENABLED = true;
  42103. }
  42104. }());
  42105. (function checkChromeWindows() {
  42106. if (typeof navigator !== 'undefined' && /Windows.*Chrome/.test(navigator.userAgent)) {
  42107. SKIP_PRIVATE_USE_RANGE_F000_TO_F01F = true;
  42108. }
  42109. }());
  42110. exports.SEAC_ANALYSIS_ENABLED = SEAC_ANALYSIS_ENABLED;
  42111. exports.PRIVATE_USE_OFFSET_START = PRIVATE_USE_OFFSET_START;
  42112. exports.PRIVATE_USE_OFFSET_END = PRIVATE_USE_OFFSET_END;
  42113. exports.ErrorFont = ErrorFont;
  42114. exports.Font = Font;
  42115. exports.FontFlags = FontFlags;
  42116. exports.IdentityToUnicodeMap = IdentityToUnicodeMap;
  42117. exports.ProblematicCharRanges = ProblematicCharRanges;
  42118. exports.ToUnicodeMap = ToUnicodeMap;
  42119. exports.getFontType = getFontType;
  42120. /***/ }),
  42121. /* 27 */
  42122. /***/ (function(module, exports, __w_pdfjs_require__) {
  42123. "use strict";
  42124. var sharedUtil = __w_pdfjs_require__(0);
  42125. var corePrimitives = __w_pdfjs_require__(1);
  42126. var coreColorSpace = __w_pdfjs_require__(3);
  42127. var coreStream = __w_pdfjs_require__(2);
  42128. var coreJpx = __w_pdfjs_require__(15);
  42129. var ImageKind = sharedUtil.ImageKind;
  42130. var assert = sharedUtil.assert;
  42131. var error = sharedUtil.error;
  42132. var info = sharedUtil.info;
  42133. var isArray = sharedUtil.isArray;
  42134. var warn = sharedUtil.warn;
  42135. var Name = corePrimitives.Name;
  42136. var isStream = corePrimitives.isStream;
  42137. var ColorSpace = coreColorSpace.ColorSpace;
  42138. var DecodeStream = coreStream.DecodeStream;
  42139. var JpegStream = coreStream.JpegStream;
  42140. var JpxImage = coreJpx.JpxImage;
  42141. var PDFImage = function PDFImageClosure() {
  42142. function handleImageData(image, nativeDecoder) {
  42143. if (nativeDecoder && nativeDecoder.canDecode(image)) {
  42144. return nativeDecoder.decode(image);
  42145. }
  42146. return Promise.resolve(image);
  42147. }
  42148. function decodeAndClamp(value, addend, coefficient, max) {
  42149. value = addend + value * coefficient;
  42150. return value < 0 ? 0 : value > max ? max : value;
  42151. }
  42152. function resizeImageMask(src, bpc, w1, h1, w2, h2) {
  42153. var length = w2 * h2;
  42154. var dest = bpc <= 8 ? new Uint8Array(length) : bpc <= 16 ? new Uint16Array(length) : new Uint32Array(length);
  42155. var xRatio = w1 / w2;
  42156. var yRatio = h1 / h2;
  42157. var i, j, py, newIndex = 0, oldIndex;
  42158. var xScaled = new Uint16Array(w2);
  42159. var w1Scanline = w1;
  42160. for (i = 0; i < w2; i++) {
  42161. xScaled[i] = Math.floor(i * xRatio);
  42162. }
  42163. for (i = 0; i < h2; i++) {
  42164. py = Math.floor(i * yRatio) * w1Scanline;
  42165. for (j = 0; j < w2; j++) {
  42166. oldIndex = py + xScaled[j];
  42167. dest[newIndex++] = src[oldIndex];
  42168. }
  42169. }
  42170. return dest;
  42171. }
  42172. function PDFImage(xref, res, image, inline, smask, mask, isMask) {
  42173. this.image = image;
  42174. var dict = image.dict;
  42175. if (dict.has('Filter')) {
  42176. var filter = dict.get('Filter').name;
  42177. if (filter === 'JPXDecode') {
  42178. var jpxImage = new JpxImage();
  42179. jpxImage.parseImageProperties(image.stream);
  42180. image.stream.reset();
  42181. image.bitsPerComponent = jpxImage.bitsPerComponent;
  42182. image.numComps = jpxImage.componentsCount;
  42183. } else if (filter === 'JBIG2Decode') {
  42184. image.bitsPerComponent = 1;
  42185. image.numComps = 1;
  42186. }
  42187. }
  42188. this.width = dict.get('Width', 'W');
  42189. this.height = dict.get('Height', 'H');
  42190. if (this.width < 1 || this.height < 1) {
  42191. error('Invalid image width: ' + this.width + ' or height: ' + this.height);
  42192. }
  42193. this.interpolate = dict.get('Interpolate', 'I') || false;
  42194. this.imageMask = dict.get('ImageMask', 'IM') || false;
  42195. this.matte = dict.get('Matte') || false;
  42196. var bitsPerComponent = image.bitsPerComponent;
  42197. if (!bitsPerComponent) {
  42198. bitsPerComponent = dict.get('BitsPerComponent', 'BPC');
  42199. if (!bitsPerComponent) {
  42200. if (this.imageMask) {
  42201. bitsPerComponent = 1;
  42202. } else {
  42203. error('Bits per component missing in image: ' + this.imageMask);
  42204. }
  42205. }
  42206. }
  42207. this.bpc = bitsPerComponent;
  42208. if (!this.imageMask) {
  42209. var colorSpace = dict.get('ColorSpace', 'CS');
  42210. if (!colorSpace) {
  42211. info('JPX images (which do not require color spaces)');
  42212. switch (image.numComps) {
  42213. case 1:
  42214. colorSpace = Name.get('DeviceGray');
  42215. break;
  42216. case 3:
  42217. colorSpace = Name.get('DeviceRGB');
  42218. break;
  42219. case 4:
  42220. colorSpace = Name.get('DeviceCMYK');
  42221. break;
  42222. default:
  42223. error('JPX images with ' + this.numComps + ' color components not supported.');
  42224. }
  42225. }
  42226. this.colorSpace = ColorSpace.parse(colorSpace, xref, res);
  42227. this.numComps = this.colorSpace.numComps;
  42228. }
  42229. this.decode = dict.getArray('Decode', 'D');
  42230. this.needsDecode = false;
  42231. if (this.decode && (this.colorSpace && !this.colorSpace.isDefaultDecode(this.decode) || isMask && !ColorSpace.isDefaultDecode(this.decode, 1))) {
  42232. this.needsDecode = true;
  42233. var max = (1 << bitsPerComponent) - 1;
  42234. this.decodeCoefficients = [];
  42235. this.decodeAddends = [];
  42236. for (var i = 0, j = 0; i < this.decode.length; i += 2, ++j) {
  42237. var dmin = this.decode[i];
  42238. var dmax = this.decode[i + 1];
  42239. this.decodeCoefficients[j] = dmax - dmin;
  42240. this.decodeAddends[j] = max * dmin;
  42241. }
  42242. }
  42243. if (smask) {
  42244. this.smask = new PDFImage(xref, res, smask, false);
  42245. } else if (mask) {
  42246. if (isStream(mask)) {
  42247. var maskDict = mask.dict, imageMask = maskDict.get('ImageMask', 'IM');
  42248. if (!imageMask) {
  42249. warn('Ignoring /Mask in image without /ImageMask.');
  42250. } else {
  42251. this.mask = new PDFImage(xref, res, mask, false, null, null, true);
  42252. }
  42253. } else {
  42254. this.mask = mask;
  42255. }
  42256. }
  42257. }
  42258. PDFImage.buildImage = function PDFImage_buildImage(handler, xref, res, image, inline, nativeDecoder) {
  42259. var imagePromise = handleImageData(image, nativeDecoder);
  42260. var smaskPromise;
  42261. var maskPromise;
  42262. var smask = image.dict.get('SMask');
  42263. var mask = image.dict.get('Mask');
  42264. if (smask) {
  42265. smaskPromise = handleImageData(smask, nativeDecoder);
  42266. maskPromise = Promise.resolve(null);
  42267. } else {
  42268. smaskPromise = Promise.resolve(null);
  42269. if (mask) {
  42270. if (isStream(mask)) {
  42271. maskPromise = handleImageData(mask, nativeDecoder);
  42272. } else if (isArray(mask)) {
  42273. maskPromise = Promise.resolve(mask);
  42274. } else {
  42275. warn('Unsupported mask format.');
  42276. maskPromise = Promise.resolve(null);
  42277. }
  42278. } else {
  42279. maskPromise = Promise.resolve(null);
  42280. }
  42281. }
  42282. return Promise.all([
  42283. imagePromise,
  42284. smaskPromise,
  42285. maskPromise
  42286. ]).then(function (results) {
  42287. var imageData = results[0];
  42288. var smaskData = results[1];
  42289. var maskData = results[2];
  42290. return new PDFImage(xref, res, imageData, inline, smaskData, maskData);
  42291. });
  42292. };
  42293. PDFImage.createMask = function PDFImage_createMask(imgArray, width, height, imageIsFromDecodeStream, inverseDecode) {
  42294. var computedLength = (width + 7 >> 3) * height;
  42295. var actualLength = imgArray.byteLength;
  42296. var haveFullData = computedLength === actualLength;
  42297. var data, i;
  42298. if (imageIsFromDecodeStream && (!inverseDecode || haveFullData)) {
  42299. data = imgArray;
  42300. } else if (!inverseDecode) {
  42301. data = new Uint8Array(actualLength);
  42302. data.set(imgArray);
  42303. } else {
  42304. data = new Uint8Array(computedLength);
  42305. data.set(imgArray);
  42306. for (i = actualLength; i < computedLength; i++) {
  42307. data[i] = 0xff;
  42308. }
  42309. }
  42310. if (inverseDecode) {
  42311. for (i = 0; i < actualLength; i++) {
  42312. data[i] = ~data[i];
  42313. }
  42314. }
  42315. return {
  42316. data: data,
  42317. width: width,
  42318. height: height
  42319. };
  42320. };
  42321. PDFImage.prototype = {
  42322. get drawWidth() {
  42323. return Math.max(this.width, this.smask && this.smask.width || 0, this.mask && this.mask.width || 0);
  42324. },
  42325. get drawHeight() {
  42326. return Math.max(this.height, this.smask && this.smask.height || 0, this.mask && this.mask.height || 0);
  42327. },
  42328. decodeBuffer: function PDFImage_decodeBuffer(buffer) {
  42329. var bpc = this.bpc;
  42330. var numComps = this.numComps;
  42331. var decodeAddends = this.decodeAddends;
  42332. var decodeCoefficients = this.decodeCoefficients;
  42333. var max = (1 << bpc) - 1;
  42334. var i, ii;
  42335. if (bpc === 1) {
  42336. for (i = 0, ii = buffer.length; i < ii; i++) {
  42337. buffer[i] = +!buffer[i];
  42338. }
  42339. return;
  42340. }
  42341. var index = 0;
  42342. for (i = 0, ii = this.width * this.height; i < ii; i++) {
  42343. for (var j = 0; j < numComps; j++) {
  42344. buffer[index] = decodeAndClamp(buffer[index], decodeAddends[j], decodeCoefficients[j], max);
  42345. index++;
  42346. }
  42347. }
  42348. },
  42349. getComponents: function PDFImage_getComponents(buffer) {
  42350. var bpc = this.bpc;
  42351. if (bpc === 8) {
  42352. return buffer;
  42353. }
  42354. var width = this.width;
  42355. var height = this.height;
  42356. var numComps = this.numComps;
  42357. var length = width * height * numComps;
  42358. var bufferPos = 0;
  42359. var output = bpc <= 8 ? new Uint8Array(length) : bpc <= 16 ? new Uint16Array(length) : new Uint32Array(length);
  42360. var rowComps = width * numComps;
  42361. var max = (1 << bpc) - 1;
  42362. var i = 0, ii, buf;
  42363. if (bpc === 1) {
  42364. var mask, loop1End, loop2End;
  42365. for (var j = 0; j < height; j++) {
  42366. loop1End = i + (rowComps & ~7);
  42367. loop2End = i + rowComps;
  42368. while (i < loop1End) {
  42369. buf = buffer[bufferPos++];
  42370. output[i] = buf >> 7 & 1;
  42371. output[i + 1] = buf >> 6 & 1;
  42372. output[i + 2] = buf >> 5 & 1;
  42373. output[i + 3] = buf >> 4 & 1;
  42374. output[i + 4] = buf >> 3 & 1;
  42375. output[i + 5] = buf >> 2 & 1;
  42376. output[i + 6] = buf >> 1 & 1;
  42377. output[i + 7] = buf & 1;
  42378. i += 8;
  42379. }
  42380. if (i < loop2End) {
  42381. buf = buffer[bufferPos++];
  42382. mask = 128;
  42383. while (i < loop2End) {
  42384. output[i++] = +!!(buf & mask);
  42385. mask >>= 1;
  42386. }
  42387. }
  42388. }
  42389. } else {
  42390. var bits = 0;
  42391. buf = 0;
  42392. for (i = 0, ii = length; i < ii; ++i) {
  42393. if (i % rowComps === 0) {
  42394. buf = 0;
  42395. bits = 0;
  42396. }
  42397. while (bits < bpc) {
  42398. buf = buf << 8 | buffer[bufferPos++];
  42399. bits += 8;
  42400. }
  42401. var remainingBits = bits - bpc;
  42402. var value = buf >> remainingBits;
  42403. output[i] = value < 0 ? 0 : value > max ? max : value;
  42404. buf = buf & (1 << remainingBits) - 1;
  42405. bits = remainingBits;
  42406. }
  42407. }
  42408. return output;
  42409. },
  42410. fillOpacity: function PDFImage_fillOpacity(rgbaBuf, width, height, actualHeight, image) {
  42411. var smask = this.smask;
  42412. var mask = this.mask;
  42413. var alphaBuf, sw, sh, i, ii, j;
  42414. if (smask) {
  42415. sw = smask.width;
  42416. sh = smask.height;
  42417. alphaBuf = new Uint8Array(sw * sh);
  42418. smask.fillGrayBuffer(alphaBuf);
  42419. if (sw !== width || sh !== height) {
  42420. alphaBuf = resizeImageMask(alphaBuf, smask.bpc, sw, sh, width, height);
  42421. }
  42422. } else if (mask) {
  42423. if (mask instanceof PDFImage) {
  42424. sw = mask.width;
  42425. sh = mask.height;
  42426. alphaBuf = new Uint8Array(sw * sh);
  42427. mask.numComps = 1;
  42428. mask.fillGrayBuffer(alphaBuf);
  42429. for (i = 0, ii = sw * sh; i < ii; ++i) {
  42430. alphaBuf[i] = 255 - alphaBuf[i];
  42431. }
  42432. if (sw !== width || sh !== height) {
  42433. alphaBuf = resizeImageMask(alphaBuf, mask.bpc, sw, sh, width, height);
  42434. }
  42435. } else if (isArray(mask)) {
  42436. alphaBuf = new Uint8Array(width * height);
  42437. var numComps = this.numComps;
  42438. for (i = 0, ii = width * height; i < ii; ++i) {
  42439. var opacity = 0;
  42440. var imageOffset = i * numComps;
  42441. for (j = 0; j < numComps; ++j) {
  42442. var color = image[imageOffset + j];
  42443. var maskOffset = j * 2;
  42444. if (color < mask[maskOffset] || color > mask[maskOffset + 1]) {
  42445. opacity = 255;
  42446. break;
  42447. }
  42448. }
  42449. alphaBuf[i] = opacity;
  42450. }
  42451. } else {
  42452. error('Unknown mask format.');
  42453. }
  42454. }
  42455. if (alphaBuf) {
  42456. for (i = 0, j = 3, ii = width * actualHeight; i < ii; ++i, j += 4) {
  42457. rgbaBuf[j] = alphaBuf[i];
  42458. }
  42459. } else {
  42460. for (i = 0, j = 3, ii = width * actualHeight; i < ii; ++i, j += 4) {
  42461. rgbaBuf[j] = 255;
  42462. }
  42463. }
  42464. },
  42465. undoPreblend: function PDFImage_undoPreblend(buffer, width, height) {
  42466. var matte = this.smask && this.smask.matte;
  42467. if (!matte) {
  42468. return;
  42469. }
  42470. var matteRgb = this.colorSpace.getRgb(matte, 0);
  42471. var matteR = matteRgb[0];
  42472. var matteG = matteRgb[1];
  42473. var matteB = matteRgb[2];
  42474. var length = width * height * 4;
  42475. var r, g, b;
  42476. for (var i = 0; i < length; i += 4) {
  42477. var alpha = buffer[i + 3];
  42478. if (alpha === 0) {
  42479. buffer[i] = 255;
  42480. buffer[i + 1] = 255;
  42481. buffer[i + 2] = 255;
  42482. continue;
  42483. }
  42484. var k = 255 / alpha;
  42485. r = (buffer[i] - matteR) * k + matteR;
  42486. g = (buffer[i + 1] - matteG) * k + matteG;
  42487. b = (buffer[i + 2] - matteB) * k + matteB;
  42488. buffer[i] = r <= 0 ? 0 : r >= 255 ? 255 : r | 0;
  42489. buffer[i + 1] = g <= 0 ? 0 : g >= 255 ? 255 : g | 0;
  42490. buffer[i + 2] = b <= 0 ? 0 : b >= 255 ? 255 : b | 0;
  42491. }
  42492. },
  42493. createImageData: function PDFImage_createImageData(forceRGBA) {
  42494. var drawWidth = this.drawWidth;
  42495. var drawHeight = this.drawHeight;
  42496. var imgData = {
  42497. width: drawWidth,
  42498. height: drawHeight
  42499. };
  42500. var numComps = this.numComps;
  42501. var originalWidth = this.width;
  42502. var originalHeight = this.height;
  42503. var bpc = this.bpc;
  42504. var rowBytes = originalWidth * numComps * bpc + 7 >> 3;
  42505. var imgArray;
  42506. if (!forceRGBA) {
  42507. var kind;
  42508. if (this.colorSpace.name === 'DeviceGray' && bpc === 1) {
  42509. kind = ImageKind.GRAYSCALE_1BPP;
  42510. } else if (this.colorSpace.name === 'DeviceRGB' && bpc === 8 && !this.needsDecode) {
  42511. kind = ImageKind.RGB_24BPP;
  42512. }
  42513. if (kind && !this.smask && !this.mask && drawWidth === originalWidth && drawHeight === originalHeight) {
  42514. imgData.kind = kind;
  42515. imgArray = this.getImageBytes(originalHeight * rowBytes);
  42516. if (this.image instanceof DecodeStream) {
  42517. imgData.data = imgArray;
  42518. } else {
  42519. var newArray = new Uint8Array(imgArray.length);
  42520. newArray.set(imgArray);
  42521. imgData.data = newArray;
  42522. }
  42523. if (this.needsDecode) {
  42524. assert(kind === ImageKind.GRAYSCALE_1BPP);
  42525. var buffer = imgData.data;
  42526. for (var i = 0, ii = buffer.length; i < ii; i++) {
  42527. buffer[i] ^= 0xff;
  42528. }
  42529. }
  42530. return imgData;
  42531. }
  42532. if (this.image instanceof JpegStream && !this.smask && !this.mask && (this.colorSpace.name === 'DeviceGray' || this.colorSpace.name === 'DeviceRGB' || this.colorSpace.name === 'DeviceCMYK')) {
  42533. imgData.kind = ImageKind.RGB_24BPP;
  42534. imgData.data = this.getImageBytes(originalHeight * rowBytes, drawWidth, drawHeight, true);
  42535. return imgData;
  42536. }
  42537. }
  42538. imgArray = this.getImageBytes(originalHeight * rowBytes);
  42539. var actualHeight = 0 | imgArray.length / rowBytes * drawHeight / originalHeight;
  42540. var comps = this.getComponents(imgArray);
  42541. var alpha01, maybeUndoPreblend;
  42542. if (!forceRGBA && !this.smask && !this.mask) {
  42543. imgData.kind = ImageKind.RGB_24BPP;
  42544. imgData.data = new Uint8Array(drawWidth * drawHeight * 3);
  42545. alpha01 = 0;
  42546. maybeUndoPreblend = false;
  42547. } else {
  42548. imgData.kind = ImageKind.RGBA_32BPP;
  42549. imgData.data = new Uint8Array(drawWidth * drawHeight * 4);
  42550. alpha01 = 1;
  42551. maybeUndoPreblend = true;
  42552. this.fillOpacity(imgData.data, drawWidth, drawHeight, actualHeight, comps);
  42553. }
  42554. if (this.needsDecode) {
  42555. this.decodeBuffer(comps);
  42556. }
  42557. this.colorSpace.fillRgb(imgData.data, originalWidth, originalHeight, drawWidth, drawHeight, actualHeight, bpc, comps, alpha01);
  42558. if (maybeUndoPreblend) {
  42559. this.undoPreblend(imgData.data, drawWidth, actualHeight);
  42560. }
  42561. return imgData;
  42562. },
  42563. fillGrayBuffer: function PDFImage_fillGrayBuffer(buffer) {
  42564. var numComps = this.numComps;
  42565. if (numComps !== 1) {
  42566. error('Reading gray scale from a color image: ' + numComps);
  42567. }
  42568. var width = this.width;
  42569. var height = this.height;
  42570. var bpc = this.bpc;
  42571. var rowBytes = width * numComps * bpc + 7 >> 3;
  42572. var imgArray = this.getImageBytes(height * rowBytes);
  42573. var comps = this.getComponents(imgArray);
  42574. var i, length;
  42575. if (bpc === 1) {
  42576. length = width * height;
  42577. if (this.needsDecode) {
  42578. for (i = 0; i < length; ++i) {
  42579. buffer[i] = comps[i] - 1 & 255;
  42580. }
  42581. } else {
  42582. for (i = 0; i < length; ++i) {
  42583. buffer[i] = -comps[i] & 255;
  42584. }
  42585. }
  42586. return;
  42587. }
  42588. if (this.needsDecode) {
  42589. this.decodeBuffer(comps);
  42590. }
  42591. length = width * height;
  42592. var scale = 255 / ((1 << bpc) - 1);
  42593. for (i = 0; i < length; ++i) {
  42594. buffer[i] = scale * comps[i] | 0;
  42595. }
  42596. },
  42597. getImageBytes: function PDFImage_getImageBytes(length, drawWidth, drawHeight, forceRGB) {
  42598. this.image.reset();
  42599. this.image.drawWidth = drawWidth || this.width;
  42600. this.image.drawHeight = drawHeight || this.height;
  42601. this.image.forceRGB = !!forceRGB;
  42602. return this.image.getBytes(length);
  42603. }
  42604. };
  42605. return PDFImage;
  42606. }();
  42607. exports.PDFImage = PDFImage;
  42608. /***/ }),
  42609. /* 28 */
  42610. /***/ (function(module, exports, __w_pdfjs_require__) {
  42611. "use strict";
  42612. var sharedUtil = __w_pdfjs_require__(0);
  42613. var coreArithmeticDecoder = __w_pdfjs_require__(10);
  42614. var error = sharedUtil.error;
  42615. var log2 = sharedUtil.log2;
  42616. var readInt8 = sharedUtil.readInt8;
  42617. var readUint16 = sharedUtil.readUint16;
  42618. var readUint32 = sharedUtil.readUint32;
  42619. var shadow = sharedUtil.shadow;
  42620. var ArithmeticDecoder = coreArithmeticDecoder.ArithmeticDecoder;
  42621. var Jbig2Image = function Jbig2ImageClosure() {
  42622. function ContextCache() {
  42623. }
  42624. ContextCache.prototype = {
  42625. getContexts: function (id) {
  42626. if (id in this) {
  42627. return this[id];
  42628. }
  42629. return this[id] = new Int8Array(1 << 16);
  42630. }
  42631. };
  42632. function DecodingContext(data, start, end) {
  42633. this.data = data;
  42634. this.start = start;
  42635. this.end = end;
  42636. }
  42637. DecodingContext.prototype = {
  42638. get decoder() {
  42639. var decoder = new ArithmeticDecoder(this.data, this.start, this.end);
  42640. return shadow(this, 'decoder', decoder);
  42641. },
  42642. get contextCache() {
  42643. var cache = new ContextCache();
  42644. return shadow(this, 'contextCache', cache);
  42645. }
  42646. };
  42647. function decodeInteger(contextCache, procedure, decoder) {
  42648. var contexts = contextCache.getContexts(procedure);
  42649. var prev = 1;
  42650. function readBits(length) {
  42651. var v = 0;
  42652. for (var i = 0; i < length; i++) {
  42653. var bit = decoder.readBit(contexts, prev);
  42654. prev = prev < 256 ? prev << 1 | bit : (prev << 1 | bit) & 511 | 256;
  42655. v = v << 1 | bit;
  42656. }
  42657. return v >>> 0;
  42658. }
  42659. var sign = readBits(1);
  42660. 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);
  42661. return sign === 0 ? value : value > 0 ? -value : null;
  42662. }
  42663. function decodeIAID(contextCache, decoder, codeLength) {
  42664. var contexts = contextCache.getContexts('IAID');
  42665. var prev = 1;
  42666. for (var i = 0; i < codeLength; i++) {
  42667. var bit = decoder.readBit(contexts, prev);
  42668. prev = prev << 1 | bit;
  42669. }
  42670. if (codeLength < 31) {
  42671. return prev & (1 << codeLength) - 1;
  42672. }
  42673. return prev & 0x7FFFFFFF;
  42674. }
  42675. var SegmentTypes = [
  42676. 'SymbolDictionary',
  42677. null,
  42678. null,
  42679. null,
  42680. 'IntermediateTextRegion',
  42681. null,
  42682. 'ImmediateTextRegion',
  42683. 'ImmediateLosslessTextRegion',
  42684. null,
  42685. null,
  42686. null,
  42687. null,
  42688. null,
  42689. null,
  42690. null,
  42691. null,
  42692. 'patternDictionary',
  42693. null,
  42694. null,
  42695. null,
  42696. 'IntermediateHalftoneRegion',
  42697. null,
  42698. 'ImmediateHalftoneRegion',
  42699. 'ImmediateLosslessHalftoneRegion',
  42700. null,
  42701. null,
  42702. null,
  42703. null,
  42704. null,
  42705. null,
  42706. null,
  42707. null,
  42708. null,
  42709. null,
  42710. null,
  42711. null,
  42712. 'IntermediateGenericRegion',
  42713. null,
  42714. 'ImmediateGenericRegion',
  42715. 'ImmediateLosslessGenericRegion',
  42716. 'IntermediateGenericRefinementRegion',
  42717. null,
  42718. 'ImmediateGenericRefinementRegion',
  42719. 'ImmediateLosslessGenericRefinementRegion',
  42720. null,
  42721. null,
  42722. null,
  42723. null,
  42724. 'PageInformation',
  42725. 'EndOfPage',
  42726. 'EndOfStripe',
  42727. 'EndOfFile',
  42728. 'Profiles',
  42729. 'Tables',
  42730. null,
  42731. null,
  42732. null,
  42733. null,
  42734. null,
  42735. null,
  42736. null,
  42737. null,
  42738. 'Extension'
  42739. ];
  42740. var CodingTemplates = [
  42741. [
  42742. {
  42743. x: -1,
  42744. y: -2
  42745. },
  42746. {
  42747. x: 0,
  42748. y: -2
  42749. },
  42750. {
  42751. x: 1,
  42752. y: -2
  42753. },
  42754. {
  42755. x: -2,
  42756. y: -1
  42757. },
  42758. {
  42759. x: -1,
  42760. y: -1
  42761. },
  42762. {
  42763. x: 0,
  42764. y: -1
  42765. },
  42766. {
  42767. x: 1,
  42768. y: -1
  42769. },
  42770. {
  42771. x: 2,
  42772. y: -1
  42773. },
  42774. {
  42775. x: -4,
  42776. y: 0
  42777. },
  42778. {
  42779. x: -3,
  42780. y: 0
  42781. },
  42782. {
  42783. x: -2,
  42784. y: 0
  42785. },
  42786. {
  42787. x: -1,
  42788. y: 0
  42789. }
  42790. ],
  42791. [
  42792. {
  42793. x: -1,
  42794. y: -2
  42795. },
  42796. {
  42797. x: 0,
  42798. y: -2
  42799. },
  42800. {
  42801. x: 1,
  42802. y: -2
  42803. },
  42804. {
  42805. x: 2,
  42806. y: -2
  42807. },
  42808. {
  42809. x: -2,
  42810. y: -1
  42811. },
  42812. {
  42813. x: -1,
  42814. y: -1
  42815. },
  42816. {
  42817. x: 0,
  42818. y: -1
  42819. },
  42820. {
  42821. x: 1,
  42822. y: -1
  42823. },
  42824. {
  42825. x: 2,
  42826. y: -1
  42827. },
  42828. {
  42829. x: -3,
  42830. y: 0
  42831. },
  42832. {
  42833. x: -2,
  42834. y: 0
  42835. },
  42836. {
  42837. x: -1,
  42838. y: 0
  42839. }
  42840. ],
  42841. [
  42842. {
  42843. x: -1,
  42844. y: -2
  42845. },
  42846. {
  42847. x: 0,
  42848. y: -2
  42849. },
  42850. {
  42851. x: 1,
  42852. y: -2
  42853. },
  42854. {
  42855. x: -2,
  42856. y: -1
  42857. },
  42858. {
  42859. x: -1,
  42860. y: -1
  42861. },
  42862. {
  42863. x: 0,
  42864. y: -1
  42865. },
  42866. {
  42867. x: 1,
  42868. y: -1
  42869. },
  42870. {
  42871. x: -2,
  42872. y: 0
  42873. },
  42874. {
  42875. x: -1,
  42876. y: 0
  42877. }
  42878. ],
  42879. [
  42880. {
  42881. x: -3,
  42882. y: -1
  42883. },
  42884. {
  42885. x: -2,
  42886. y: -1
  42887. },
  42888. {
  42889. x: -1,
  42890. y: -1
  42891. },
  42892. {
  42893. x: 0,
  42894. y: -1
  42895. },
  42896. {
  42897. x: 1,
  42898. y: -1
  42899. },
  42900. {
  42901. x: -4,
  42902. y: 0
  42903. },
  42904. {
  42905. x: -3,
  42906. y: 0
  42907. },
  42908. {
  42909. x: -2,
  42910. y: 0
  42911. },
  42912. {
  42913. x: -1,
  42914. y: 0
  42915. }
  42916. ]
  42917. ];
  42918. var RefinementTemplates = [
  42919. {
  42920. coding: [
  42921. {
  42922. x: 0,
  42923. y: -1
  42924. },
  42925. {
  42926. x: 1,
  42927. y: -1
  42928. },
  42929. {
  42930. x: -1,
  42931. y: 0
  42932. }
  42933. ],
  42934. reference: [
  42935. {
  42936. x: 0,
  42937. y: -1
  42938. },
  42939. {
  42940. x: 1,
  42941. y: -1
  42942. },
  42943. {
  42944. x: -1,
  42945. y: 0
  42946. },
  42947. {
  42948. x: 0,
  42949. y: 0
  42950. },
  42951. {
  42952. x: 1,
  42953. y: 0
  42954. },
  42955. {
  42956. x: -1,
  42957. y: 1
  42958. },
  42959. {
  42960. x: 0,
  42961. y: 1
  42962. },
  42963. {
  42964. x: 1,
  42965. y: 1
  42966. }
  42967. ]
  42968. },
  42969. {
  42970. coding: [
  42971. {
  42972. x: -1,
  42973. y: -1
  42974. },
  42975. {
  42976. x: 0,
  42977. y: -1
  42978. },
  42979. {
  42980. x: 1,
  42981. y: -1
  42982. },
  42983. {
  42984. x: -1,
  42985. y: 0
  42986. }
  42987. ],
  42988. reference: [
  42989. {
  42990. x: 0,
  42991. y: -1
  42992. },
  42993. {
  42994. x: -1,
  42995. y: 0
  42996. },
  42997. {
  42998. x: 0,
  42999. y: 0
  43000. },
  43001. {
  43002. x: 1,
  43003. y: 0
  43004. },
  43005. {
  43006. x: 0,
  43007. y: 1
  43008. },
  43009. {
  43010. x: 1,
  43011. y: 1
  43012. }
  43013. ]
  43014. }
  43015. ];
  43016. var ReusedContexts = [
  43017. 0x9B25,
  43018. 0x0795,
  43019. 0x00E5,
  43020. 0x0195
  43021. ];
  43022. var RefinementReusedContexts = [
  43023. 0x0020,
  43024. 0x0008
  43025. ];
  43026. function decodeBitmapTemplate0(width, height, decodingContext) {
  43027. var decoder = decodingContext.decoder;
  43028. var contexts = decodingContext.contextCache.getContexts('GB');
  43029. var contextLabel, i, j, pixel, row, row1, row2, bitmap = [];
  43030. var OLD_PIXEL_MASK = 0x7BF7;
  43031. for (i = 0; i < height; i++) {
  43032. row = bitmap[i] = new Uint8Array(width);
  43033. row1 = i < 1 ? row : bitmap[i - 1];
  43034. row2 = i < 2 ? row : bitmap[i - 2];
  43035. contextLabel = row2[0] << 13 | row2[1] << 12 | row2[2] << 11 | row1[0] << 7 | row1[1] << 6 | row1[2] << 5 | row1[3] << 4;
  43036. for (j = 0; j < width; j++) {
  43037. row[j] = pixel = decoder.readBit(contexts, contextLabel);
  43038. contextLabel = (contextLabel & OLD_PIXEL_MASK) << 1 | (j + 3 < width ? row2[j + 3] << 11 : 0) | (j + 4 < width ? row1[j + 4] << 4 : 0) | pixel;
  43039. }
  43040. }
  43041. return bitmap;
  43042. }
  43043. function decodeBitmap(mmr, width, height, templateIndex, prediction, skip, at, decodingContext) {
  43044. if (mmr) {
  43045. error('JBIG2 error: MMR encoding is not supported');
  43046. }
  43047. 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) {
  43048. return decodeBitmapTemplate0(width, height, decodingContext);
  43049. }
  43050. var useskip = !!skip;
  43051. var template = CodingTemplates[templateIndex].concat(at);
  43052. template.sort(function (a, b) {
  43053. return a.y - b.y || a.x - b.x;
  43054. });
  43055. var templateLength = template.length;
  43056. var templateX = new Int8Array(templateLength);
  43057. var templateY = new Int8Array(templateLength);
  43058. var changingTemplateEntries = [];
  43059. var reuseMask = 0, minX = 0, maxX = 0, minY = 0;
  43060. var c, k;
  43061. for (k = 0; k < templateLength; k++) {
  43062. templateX[k] = template[k].x;
  43063. templateY[k] = template[k].y;
  43064. minX = Math.min(minX, template[k].x);
  43065. maxX = Math.max(maxX, template[k].x);
  43066. minY = Math.min(minY, template[k].y);
  43067. if (k < templateLength - 1 && template[k].y === template[k + 1].y && template[k].x === template[k + 1].x - 1) {
  43068. reuseMask |= 1 << templateLength - 1 - k;
  43069. } else {
  43070. changingTemplateEntries.push(k);
  43071. }
  43072. }
  43073. var changingEntriesLength = changingTemplateEntries.length;
  43074. var changingTemplateX = new Int8Array(changingEntriesLength);
  43075. var changingTemplateY = new Int8Array(changingEntriesLength);
  43076. var changingTemplateBit = new Uint16Array(changingEntriesLength);
  43077. for (c = 0; c < changingEntriesLength; c++) {
  43078. k = changingTemplateEntries[c];
  43079. changingTemplateX[c] = template[k].x;
  43080. changingTemplateY[c] = template[k].y;
  43081. changingTemplateBit[c] = 1 << templateLength - 1 - k;
  43082. }
  43083. var sbb_left = -minX;
  43084. var sbb_top = -minY;
  43085. var sbb_right = width - maxX;
  43086. var pseudoPixelContext = ReusedContexts[templateIndex];
  43087. var row = new Uint8Array(width);
  43088. var bitmap = [];
  43089. var decoder = decodingContext.decoder;
  43090. var contexts = decodingContext.contextCache.getContexts('GB');
  43091. var ltp = 0, j, i0, j0, contextLabel = 0, bit, shift;
  43092. for (var i = 0; i < height; i++) {
  43093. if (prediction) {
  43094. var sltp = decoder.readBit(contexts, pseudoPixelContext);
  43095. ltp ^= sltp;
  43096. if (ltp) {
  43097. bitmap.push(row);
  43098. continue;
  43099. }
  43100. }
  43101. row = new Uint8Array(row);
  43102. bitmap.push(row);
  43103. for (j = 0; j < width; j++) {
  43104. if (useskip && skip[i][j]) {
  43105. row[j] = 0;
  43106. continue;
  43107. }
  43108. if (j >= sbb_left && j < sbb_right && i >= sbb_top) {
  43109. contextLabel = contextLabel << 1 & reuseMask;
  43110. for (k = 0; k < changingEntriesLength; k++) {
  43111. i0 = i + changingTemplateY[k];
  43112. j0 = j + changingTemplateX[k];
  43113. bit = bitmap[i0][j0];
  43114. if (bit) {
  43115. bit = changingTemplateBit[k];
  43116. contextLabel |= bit;
  43117. }
  43118. }
  43119. } else {
  43120. contextLabel = 0;
  43121. shift = templateLength - 1;
  43122. for (k = 0; k < templateLength; k++, shift--) {
  43123. j0 = j + templateX[k];
  43124. if (j0 >= 0 && j0 < width) {
  43125. i0 = i + templateY[k];
  43126. if (i0 >= 0) {
  43127. bit = bitmap[i0][j0];
  43128. if (bit) {
  43129. contextLabel |= bit << shift;
  43130. }
  43131. }
  43132. }
  43133. }
  43134. }
  43135. var pixel = decoder.readBit(contexts, contextLabel);
  43136. row[j] = pixel;
  43137. }
  43138. }
  43139. return bitmap;
  43140. }
  43141. function decodeRefinement(width, height, templateIndex, referenceBitmap, offsetX, offsetY, prediction, at, decodingContext) {
  43142. var codingTemplate = RefinementTemplates[templateIndex].coding;
  43143. if (templateIndex === 0) {
  43144. codingTemplate = codingTemplate.concat([at[0]]);
  43145. }
  43146. var codingTemplateLength = codingTemplate.length;
  43147. var codingTemplateX = new Int32Array(codingTemplateLength);
  43148. var codingTemplateY = new Int32Array(codingTemplateLength);
  43149. var k;
  43150. for (k = 0; k < codingTemplateLength; k++) {
  43151. codingTemplateX[k] = codingTemplate[k].x;
  43152. codingTemplateY[k] = codingTemplate[k].y;
  43153. }
  43154. var referenceTemplate = RefinementTemplates[templateIndex].reference;
  43155. if (templateIndex === 0) {
  43156. referenceTemplate = referenceTemplate.concat([at[1]]);
  43157. }
  43158. var referenceTemplateLength = referenceTemplate.length;
  43159. var referenceTemplateX = new Int32Array(referenceTemplateLength);
  43160. var referenceTemplateY = new Int32Array(referenceTemplateLength);
  43161. for (k = 0; k < referenceTemplateLength; k++) {
  43162. referenceTemplateX[k] = referenceTemplate[k].x;
  43163. referenceTemplateY[k] = referenceTemplate[k].y;
  43164. }
  43165. var referenceWidth = referenceBitmap[0].length;
  43166. var referenceHeight = referenceBitmap.length;
  43167. var pseudoPixelContext = RefinementReusedContexts[templateIndex];
  43168. var bitmap = [];
  43169. var decoder = decodingContext.decoder;
  43170. var contexts = decodingContext.contextCache.getContexts('GR');
  43171. var ltp = 0;
  43172. for (var i = 0; i < height; i++) {
  43173. if (prediction) {
  43174. var sltp = decoder.readBit(contexts, pseudoPixelContext);
  43175. ltp ^= sltp;
  43176. if (ltp) {
  43177. error('JBIG2 error: prediction is not supported');
  43178. }
  43179. }
  43180. var row = new Uint8Array(width);
  43181. bitmap.push(row);
  43182. for (var j = 0; j < width; j++) {
  43183. var i0, j0;
  43184. var contextLabel = 0;
  43185. for (k = 0; k < codingTemplateLength; k++) {
  43186. i0 = i + codingTemplateY[k];
  43187. j0 = j + codingTemplateX[k];
  43188. if (i0 < 0 || j0 < 0 || j0 >= width) {
  43189. contextLabel <<= 1;
  43190. } else {
  43191. contextLabel = contextLabel << 1 | bitmap[i0][j0];
  43192. }
  43193. }
  43194. for (k = 0; k < referenceTemplateLength; k++) {
  43195. i0 = i + referenceTemplateY[k] + offsetY;
  43196. j0 = j + referenceTemplateX[k] + offsetX;
  43197. if (i0 < 0 || i0 >= referenceHeight || j0 < 0 || j0 >= referenceWidth) {
  43198. contextLabel <<= 1;
  43199. } else {
  43200. contextLabel = contextLabel << 1 | referenceBitmap[i0][j0];
  43201. }
  43202. }
  43203. var pixel = decoder.readBit(contexts, contextLabel);
  43204. row[j] = pixel;
  43205. }
  43206. }
  43207. return bitmap;
  43208. }
  43209. function decodeSymbolDictionary(huffman, refinement, symbols, numberOfNewSymbols, numberOfExportedSymbols, huffmanTables, templateIndex, at, refinementTemplateIndex, refinementAt, decodingContext) {
  43210. if (huffman) {
  43211. error('JBIG2 error: huffman is not supported');
  43212. }
  43213. var newSymbols = [];
  43214. var currentHeight = 0;
  43215. var symbolCodeLength = log2(symbols.length + numberOfNewSymbols);
  43216. var decoder = decodingContext.decoder;
  43217. var contextCache = decodingContext.contextCache;
  43218. while (newSymbols.length < numberOfNewSymbols) {
  43219. var deltaHeight = decodeInteger(contextCache, 'IADH', decoder);
  43220. currentHeight += deltaHeight;
  43221. var currentWidth = 0;
  43222. while (true) {
  43223. var deltaWidth = decodeInteger(contextCache, 'IADW', decoder);
  43224. if (deltaWidth === null) {
  43225. break;
  43226. }
  43227. currentWidth += deltaWidth;
  43228. var bitmap;
  43229. if (refinement) {
  43230. var numberOfInstances = decodeInteger(contextCache, 'IAAI', decoder);
  43231. if (numberOfInstances > 1) {
  43232. bitmap = decodeTextRegion(huffman, refinement, currentWidth, currentHeight, 0, numberOfInstances, 1, symbols.concat(newSymbols), symbolCodeLength, 0, 0, 1, 0, huffmanTables, refinementTemplateIndex, refinementAt, decodingContext);
  43233. } else {
  43234. var symbolId = decodeIAID(contextCache, decoder, symbolCodeLength);
  43235. var rdx = decodeInteger(contextCache, 'IARDX', decoder);
  43236. var rdy = decodeInteger(contextCache, 'IARDY', decoder);
  43237. var symbol = symbolId < symbols.length ? symbols[symbolId] : newSymbols[symbolId - symbols.length];
  43238. bitmap = decodeRefinement(currentWidth, currentHeight, refinementTemplateIndex, symbol, rdx, rdy, false, refinementAt, decodingContext);
  43239. }
  43240. } else {
  43241. bitmap = decodeBitmap(false, currentWidth, currentHeight, templateIndex, false, null, at, decodingContext);
  43242. }
  43243. newSymbols.push(bitmap);
  43244. }
  43245. }
  43246. var exportedSymbols = [];
  43247. var flags = [], currentFlag = false;
  43248. var totalSymbolsLength = symbols.length + numberOfNewSymbols;
  43249. while (flags.length < totalSymbolsLength) {
  43250. var runLength = decodeInteger(contextCache, 'IAEX', decoder);
  43251. while (runLength--) {
  43252. flags.push(currentFlag);
  43253. }
  43254. currentFlag = !currentFlag;
  43255. }
  43256. for (var i = 0, ii = symbols.length; i < ii; i++) {
  43257. if (flags[i]) {
  43258. exportedSymbols.push(symbols[i]);
  43259. }
  43260. }
  43261. for (var j = 0; j < numberOfNewSymbols; i++, j++) {
  43262. if (flags[i]) {
  43263. exportedSymbols.push(newSymbols[j]);
  43264. }
  43265. }
  43266. return exportedSymbols;
  43267. }
  43268. function decodeTextRegion(huffman, refinement, width, height, defaultPixelValue, numberOfSymbolInstances, stripSize, inputSymbols, symbolCodeLength, transposed, dsOffset, referenceCorner, combinationOperator, huffmanTables, refinementTemplateIndex, refinementAt, decodingContext) {
  43269. if (huffman) {
  43270. error('JBIG2 error: huffman is not supported');
  43271. }
  43272. var bitmap = [];
  43273. var i, row;
  43274. for (i = 0; i < height; i++) {
  43275. row = new Uint8Array(width);
  43276. if (defaultPixelValue) {
  43277. for (var j = 0; j < width; j++) {
  43278. row[j] = defaultPixelValue;
  43279. }
  43280. }
  43281. bitmap.push(row);
  43282. }
  43283. var decoder = decodingContext.decoder;
  43284. var contextCache = decodingContext.contextCache;
  43285. var stripT = -decodeInteger(contextCache, 'IADT', decoder);
  43286. var firstS = 0;
  43287. i = 0;
  43288. while (i < numberOfSymbolInstances) {
  43289. var deltaT = decodeInteger(contextCache, 'IADT', decoder);
  43290. stripT += deltaT;
  43291. var deltaFirstS = decodeInteger(contextCache, 'IAFS', decoder);
  43292. firstS += deltaFirstS;
  43293. var currentS = firstS;
  43294. do {
  43295. var currentT = stripSize === 1 ? 0 : decodeInteger(contextCache, 'IAIT', decoder);
  43296. var t = stripSize * stripT + currentT;
  43297. var symbolId = decodeIAID(contextCache, decoder, symbolCodeLength);
  43298. var applyRefinement = refinement && decodeInteger(contextCache, 'IARI', decoder);
  43299. var symbolBitmap = inputSymbols[symbolId];
  43300. var symbolWidth = symbolBitmap[0].length;
  43301. var symbolHeight = symbolBitmap.length;
  43302. if (applyRefinement) {
  43303. var rdw = decodeInteger(contextCache, 'IARDW', decoder);
  43304. var rdh = decodeInteger(contextCache, 'IARDH', decoder);
  43305. var rdx = decodeInteger(contextCache, 'IARDX', decoder);
  43306. var rdy = decodeInteger(contextCache, 'IARDY', decoder);
  43307. symbolWidth += rdw;
  43308. symbolHeight += rdh;
  43309. symbolBitmap = decodeRefinement(symbolWidth, symbolHeight, refinementTemplateIndex, symbolBitmap, (rdw >> 1) + rdx, (rdh >> 1) + rdy, false, refinementAt, decodingContext);
  43310. }
  43311. var offsetT = t - (referenceCorner & 1 ? 0 : symbolHeight);
  43312. var offsetS = currentS - (referenceCorner & 2 ? symbolWidth : 0);
  43313. var s2, t2, symbolRow;
  43314. if (transposed) {
  43315. for (s2 = 0; s2 < symbolHeight; s2++) {
  43316. row = bitmap[offsetS + s2];
  43317. if (!row) {
  43318. continue;
  43319. }
  43320. symbolRow = symbolBitmap[s2];
  43321. var maxWidth = Math.min(width - offsetT, symbolWidth);
  43322. switch (combinationOperator) {
  43323. case 0:
  43324. for (t2 = 0; t2 < maxWidth; t2++) {
  43325. row[offsetT + t2] |= symbolRow[t2];
  43326. }
  43327. break;
  43328. case 2:
  43329. for (t2 = 0; t2 < maxWidth; t2++) {
  43330. row[offsetT + t2] ^= symbolRow[t2];
  43331. }
  43332. break;
  43333. default:
  43334. error('JBIG2 error: operator ' + combinationOperator + ' is not supported');
  43335. }
  43336. }
  43337. currentS += symbolHeight - 1;
  43338. } else {
  43339. for (t2 = 0; t2 < symbolHeight; t2++) {
  43340. row = bitmap[offsetT + t2];
  43341. if (!row) {
  43342. continue;
  43343. }
  43344. symbolRow = symbolBitmap[t2];
  43345. switch (combinationOperator) {
  43346. case 0:
  43347. for (s2 = 0; s2 < symbolWidth; s2++) {
  43348. row[offsetS + s2] |= symbolRow[s2];
  43349. }
  43350. break;
  43351. case 2:
  43352. for (s2 = 0; s2 < symbolWidth; s2++) {
  43353. row[offsetS + s2] ^= symbolRow[s2];
  43354. }
  43355. break;
  43356. default:
  43357. error('JBIG2 error: operator ' + combinationOperator + ' is not supported');
  43358. }
  43359. }
  43360. currentS += symbolWidth - 1;
  43361. }
  43362. i++;
  43363. var deltaS = decodeInteger(contextCache, 'IADS', decoder);
  43364. if (deltaS === null) {
  43365. break;
  43366. }
  43367. currentS += deltaS + dsOffset;
  43368. } while (true);
  43369. }
  43370. return bitmap;
  43371. }
  43372. function readSegmentHeader(data, start) {
  43373. var segmentHeader = {};
  43374. segmentHeader.number = readUint32(data, start);
  43375. var flags = data[start + 4];
  43376. var segmentType = flags & 0x3F;
  43377. if (!SegmentTypes[segmentType]) {
  43378. error('JBIG2 error: invalid segment type: ' + segmentType);
  43379. }
  43380. segmentHeader.type = segmentType;
  43381. segmentHeader.typeName = SegmentTypes[segmentType];
  43382. segmentHeader.deferredNonRetain = !!(flags & 0x80);
  43383. var pageAssociationFieldSize = !!(flags & 0x40);
  43384. var referredFlags = data[start + 5];
  43385. var referredToCount = referredFlags >> 5 & 7;
  43386. var retainBits = [referredFlags & 31];
  43387. var position = start + 6;
  43388. if (referredFlags === 7) {
  43389. referredToCount = readUint32(data, position - 1) & 0x1FFFFFFF;
  43390. position += 3;
  43391. var bytes = referredToCount + 7 >> 3;
  43392. retainBits[0] = data[position++];
  43393. while (--bytes > 0) {
  43394. retainBits.push(data[position++]);
  43395. }
  43396. } else if (referredFlags === 5 || referredFlags === 6) {
  43397. error('JBIG2 error: invalid referred-to flags');
  43398. }
  43399. segmentHeader.retainBits = retainBits;
  43400. var referredToSegmentNumberSize = segmentHeader.number <= 256 ? 1 : segmentHeader.number <= 65536 ? 2 : 4;
  43401. var referredTo = [];
  43402. var i, ii;
  43403. for (i = 0; i < referredToCount; i++) {
  43404. var number = referredToSegmentNumberSize === 1 ? data[position] : referredToSegmentNumberSize === 2 ? readUint16(data, position) : readUint32(data, position);
  43405. referredTo.push(number);
  43406. position += referredToSegmentNumberSize;
  43407. }
  43408. segmentHeader.referredTo = referredTo;
  43409. if (!pageAssociationFieldSize) {
  43410. segmentHeader.pageAssociation = data[position++];
  43411. } else {
  43412. segmentHeader.pageAssociation = readUint32(data, position);
  43413. position += 4;
  43414. }
  43415. segmentHeader.length = readUint32(data, position);
  43416. position += 4;
  43417. if (segmentHeader.length === 0xFFFFFFFF) {
  43418. if (segmentType === 38) {
  43419. var genericRegionInfo = readRegionSegmentInformation(data, position);
  43420. var genericRegionSegmentFlags = data[position + RegionSegmentInformationFieldLength];
  43421. var genericRegionMmr = !!(genericRegionSegmentFlags & 1);
  43422. var searchPatternLength = 6;
  43423. var searchPattern = new Uint8Array(searchPatternLength);
  43424. if (!genericRegionMmr) {
  43425. searchPattern[0] = 0xFF;
  43426. searchPattern[1] = 0xAC;
  43427. }
  43428. searchPattern[2] = genericRegionInfo.height >>> 24 & 0xFF;
  43429. searchPattern[3] = genericRegionInfo.height >> 16 & 0xFF;
  43430. searchPattern[4] = genericRegionInfo.height >> 8 & 0xFF;
  43431. searchPattern[5] = genericRegionInfo.height & 0xFF;
  43432. for (i = position, ii = data.length; i < ii; i++) {
  43433. var j = 0;
  43434. while (j < searchPatternLength && searchPattern[j] === data[i + j]) {
  43435. j++;
  43436. }
  43437. if (j === searchPatternLength) {
  43438. segmentHeader.length = i + searchPatternLength;
  43439. break;
  43440. }
  43441. }
  43442. if (segmentHeader.length === 0xFFFFFFFF) {
  43443. error('JBIG2 error: segment end was not found');
  43444. }
  43445. } else {
  43446. error('JBIG2 error: invalid unknown segment length');
  43447. }
  43448. }
  43449. segmentHeader.headerEnd = position;
  43450. return segmentHeader;
  43451. }
  43452. function readSegments(header, data, start, end) {
  43453. var segments = [];
  43454. var position = start;
  43455. while (position < end) {
  43456. var segmentHeader = readSegmentHeader(data, position);
  43457. position = segmentHeader.headerEnd;
  43458. var segment = {
  43459. header: segmentHeader,
  43460. data: data
  43461. };
  43462. if (!header.randomAccess) {
  43463. segment.start = position;
  43464. position += segmentHeader.length;
  43465. segment.end = position;
  43466. }
  43467. segments.push(segment);
  43468. if (segmentHeader.type === 51) {
  43469. break;
  43470. }
  43471. }
  43472. if (header.randomAccess) {
  43473. for (var i = 0, ii = segments.length; i < ii; i++) {
  43474. segments[i].start = position;
  43475. position += segments[i].header.length;
  43476. segments[i].end = position;
  43477. }
  43478. }
  43479. return segments;
  43480. }
  43481. function readRegionSegmentInformation(data, start) {
  43482. return {
  43483. width: readUint32(data, start),
  43484. height: readUint32(data, start + 4),
  43485. x: readUint32(data, start + 8),
  43486. y: readUint32(data, start + 12),
  43487. combinationOperator: data[start + 16] & 7
  43488. };
  43489. }
  43490. var RegionSegmentInformationFieldLength = 17;
  43491. function processSegment(segment, visitor) {
  43492. var header = segment.header;
  43493. var data = segment.data, position = segment.start, end = segment.end;
  43494. var args, at, i, atLength;
  43495. switch (header.type) {
  43496. case 0:
  43497. var dictionary = {};
  43498. var dictionaryFlags = readUint16(data, position);
  43499. dictionary.huffman = !!(dictionaryFlags & 1);
  43500. dictionary.refinement = !!(dictionaryFlags & 2);
  43501. dictionary.huffmanDHSelector = dictionaryFlags >> 2 & 3;
  43502. dictionary.huffmanDWSelector = dictionaryFlags >> 4 & 3;
  43503. dictionary.bitmapSizeSelector = dictionaryFlags >> 6 & 1;
  43504. dictionary.aggregationInstancesSelector = dictionaryFlags >> 7 & 1;
  43505. dictionary.bitmapCodingContextUsed = !!(dictionaryFlags & 256);
  43506. dictionary.bitmapCodingContextRetained = !!(dictionaryFlags & 512);
  43507. dictionary.template = dictionaryFlags >> 10 & 3;
  43508. dictionary.refinementTemplate = dictionaryFlags >> 12 & 1;
  43509. position += 2;
  43510. if (!dictionary.huffman) {
  43511. atLength = dictionary.template === 0 ? 4 : 1;
  43512. at = [];
  43513. for (i = 0; i < atLength; i++) {
  43514. at.push({
  43515. x: readInt8(data, position),
  43516. y: readInt8(data, position + 1)
  43517. });
  43518. position += 2;
  43519. }
  43520. dictionary.at = at;
  43521. }
  43522. if (dictionary.refinement && !dictionary.refinementTemplate) {
  43523. at = [];
  43524. for (i = 0; i < 2; i++) {
  43525. at.push({
  43526. x: readInt8(data, position),
  43527. y: readInt8(data, position + 1)
  43528. });
  43529. position += 2;
  43530. }
  43531. dictionary.refinementAt = at;
  43532. }
  43533. dictionary.numberOfExportedSymbols = readUint32(data, position);
  43534. position += 4;
  43535. dictionary.numberOfNewSymbols = readUint32(data, position);
  43536. position += 4;
  43537. args = [
  43538. dictionary,
  43539. header.number,
  43540. header.referredTo,
  43541. data,
  43542. position,
  43543. end
  43544. ];
  43545. break;
  43546. case 6:
  43547. case 7:
  43548. var textRegion = {};
  43549. textRegion.info = readRegionSegmentInformation(data, position);
  43550. position += RegionSegmentInformationFieldLength;
  43551. var textRegionSegmentFlags = readUint16(data, position);
  43552. position += 2;
  43553. textRegion.huffman = !!(textRegionSegmentFlags & 1);
  43554. textRegion.refinement = !!(textRegionSegmentFlags & 2);
  43555. textRegion.stripSize = 1 << (textRegionSegmentFlags >> 2 & 3);
  43556. textRegion.referenceCorner = textRegionSegmentFlags >> 4 & 3;
  43557. textRegion.transposed = !!(textRegionSegmentFlags & 64);
  43558. textRegion.combinationOperator = textRegionSegmentFlags >> 7 & 3;
  43559. textRegion.defaultPixelValue = textRegionSegmentFlags >> 9 & 1;
  43560. textRegion.dsOffset = textRegionSegmentFlags << 17 >> 27;
  43561. textRegion.refinementTemplate = textRegionSegmentFlags >> 15 & 1;
  43562. if (textRegion.huffman) {
  43563. var textRegionHuffmanFlags = readUint16(data, position);
  43564. position += 2;
  43565. textRegion.huffmanFS = textRegionHuffmanFlags & 3;
  43566. textRegion.huffmanDS = textRegionHuffmanFlags >> 2 & 3;
  43567. textRegion.huffmanDT = textRegionHuffmanFlags >> 4 & 3;
  43568. textRegion.huffmanRefinementDW = textRegionHuffmanFlags >> 6 & 3;
  43569. textRegion.huffmanRefinementDH = textRegionHuffmanFlags >> 8 & 3;
  43570. textRegion.huffmanRefinementDX = textRegionHuffmanFlags >> 10 & 3;
  43571. textRegion.huffmanRefinementDY = textRegionHuffmanFlags >> 12 & 3;
  43572. textRegion.huffmanRefinementSizeSelector = !!(textRegionHuffmanFlags & 14);
  43573. }
  43574. if (textRegion.refinement && !textRegion.refinementTemplate) {
  43575. at = [];
  43576. for (i = 0; i < 2; i++) {
  43577. at.push({
  43578. x: readInt8(data, position),
  43579. y: readInt8(data, position + 1)
  43580. });
  43581. position += 2;
  43582. }
  43583. textRegion.refinementAt = at;
  43584. }
  43585. textRegion.numberOfSymbolInstances = readUint32(data, position);
  43586. position += 4;
  43587. if (textRegion.huffman) {
  43588. error('JBIG2 error: huffman is not supported');
  43589. }
  43590. args = [
  43591. textRegion,
  43592. header.referredTo,
  43593. data,
  43594. position,
  43595. end
  43596. ];
  43597. break;
  43598. case 38:
  43599. case 39:
  43600. var genericRegion = {};
  43601. genericRegion.info = readRegionSegmentInformation(data, position);
  43602. position += RegionSegmentInformationFieldLength;
  43603. var genericRegionSegmentFlags = data[position++];
  43604. genericRegion.mmr = !!(genericRegionSegmentFlags & 1);
  43605. genericRegion.template = genericRegionSegmentFlags >> 1 & 3;
  43606. genericRegion.prediction = !!(genericRegionSegmentFlags & 8);
  43607. if (!genericRegion.mmr) {
  43608. atLength = genericRegion.template === 0 ? 4 : 1;
  43609. at = [];
  43610. for (i = 0; i < atLength; i++) {
  43611. at.push({
  43612. x: readInt8(data, position),
  43613. y: readInt8(data, position + 1)
  43614. });
  43615. position += 2;
  43616. }
  43617. genericRegion.at = at;
  43618. }
  43619. args = [
  43620. genericRegion,
  43621. data,
  43622. position,
  43623. end
  43624. ];
  43625. break;
  43626. case 48:
  43627. var pageInfo = {
  43628. width: readUint32(data, position),
  43629. height: readUint32(data, position + 4),
  43630. resolutionX: readUint32(data, position + 8),
  43631. resolutionY: readUint32(data, position + 12)
  43632. };
  43633. if (pageInfo.height === 0xFFFFFFFF) {
  43634. delete pageInfo.height;
  43635. }
  43636. var pageSegmentFlags = data[position + 16];
  43637. readUint16(data, position + 17);
  43638. pageInfo.lossless = !!(pageSegmentFlags & 1);
  43639. pageInfo.refinement = !!(pageSegmentFlags & 2);
  43640. pageInfo.defaultPixelValue = pageSegmentFlags >> 2 & 1;
  43641. pageInfo.combinationOperator = pageSegmentFlags >> 3 & 3;
  43642. pageInfo.requiresBuffer = !!(pageSegmentFlags & 32);
  43643. pageInfo.combinationOperatorOverride = !!(pageSegmentFlags & 64);
  43644. args = [pageInfo];
  43645. break;
  43646. case 49:
  43647. break;
  43648. case 50:
  43649. break;
  43650. case 51:
  43651. break;
  43652. case 62:
  43653. break;
  43654. default:
  43655. error('JBIG2 error: segment type ' + header.typeName + '(' + header.type + ') is not implemented');
  43656. }
  43657. var callbackName = 'on' + header.typeName;
  43658. if (callbackName in visitor) {
  43659. visitor[callbackName].apply(visitor, args);
  43660. }
  43661. }
  43662. function processSegments(segments, visitor) {
  43663. for (var i = 0, ii = segments.length; i < ii; i++) {
  43664. processSegment(segments[i], visitor);
  43665. }
  43666. }
  43667. function parseJbig2(data, start, end) {
  43668. var position = start;
  43669. 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) {
  43670. error('JBIG2 error: invalid header');
  43671. }
  43672. var header = {};
  43673. position += 8;
  43674. var flags = data[position++];
  43675. header.randomAccess = !(flags & 1);
  43676. if (!(flags & 2)) {
  43677. header.numberOfPages = readUint32(data, position);
  43678. position += 4;
  43679. }
  43680. readSegments(header, data, position, end);
  43681. error('Not implemented');
  43682. }
  43683. function parseJbig2Chunks(chunks) {
  43684. var visitor = new SimpleSegmentVisitor();
  43685. for (var i = 0, ii = chunks.length; i < ii; i++) {
  43686. var chunk = chunks[i];
  43687. var segments = readSegments({}, chunk.data, chunk.start, chunk.end);
  43688. processSegments(segments, visitor);
  43689. }
  43690. return visitor.buffer;
  43691. }
  43692. function SimpleSegmentVisitor() {
  43693. }
  43694. SimpleSegmentVisitor.prototype = {
  43695. onPageInformation: function SimpleSegmentVisitor_onPageInformation(info) {
  43696. this.currentPageInfo = info;
  43697. var rowSize = info.width + 7 >> 3;
  43698. var buffer = new Uint8Array(rowSize * info.height);
  43699. if (info.defaultPixelValue) {
  43700. for (var i = 0, ii = buffer.length; i < ii; i++) {
  43701. buffer[i] = 0xFF;
  43702. }
  43703. }
  43704. this.buffer = buffer;
  43705. },
  43706. drawBitmap: function SimpleSegmentVisitor_drawBitmap(regionInfo, bitmap) {
  43707. var pageInfo = this.currentPageInfo;
  43708. var width = regionInfo.width, height = regionInfo.height;
  43709. var rowSize = pageInfo.width + 7 >> 3;
  43710. var combinationOperator = pageInfo.combinationOperatorOverride ? regionInfo.combinationOperator : pageInfo.combinationOperator;
  43711. var buffer = this.buffer;
  43712. var mask0 = 128 >> (regionInfo.x & 7);
  43713. var offset0 = regionInfo.y * rowSize + (regionInfo.x >> 3);
  43714. var i, j, mask, offset;
  43715. switch (combinationOperator) {
  43716. case 0:
  43717. for (i = 0; i < height; i++) {
  43718. mask = mask0;
  43719. offset = offset0;
  43720. for (j = 0; j < width; j++) {
  43721. if (bitmap[i][j]) {
  43722. buffer[offset] |= mask;
  43723. }
  43724. mask >>= 1;
  43725. if (!mask) {
  43726. mask = 128;
  43727. offset++;
  43728. }
  43729. }
  43730. offset0 += rowSize;
  43731. }
  43732. break;
  43733. case 2:
  43734. for (i = 0; i < height; i++) {
  43735. mask = mask0;
  43736. offset = offset0;
  43737. for (j = 0; j < width; j++) {
  43738. if (bitmap[i][j]) {
  43739. buffer[offset] ^= mask;
  43740. }
  43741. mask >>= 1;
  43742. if (!mask) {
  43743. mask = 128;
  43744. offset++;
  43745. }
  43746. }
  43747. offset0 += rowSize;
  43748. }
  43749. break;
  43750. default:
  43751. error('JBIG2 error: operator ' + combinationOperator + ' is not supported');
  43752. }
  43753. },
  43754. onImmediateGenericRegion: function SimpleSegmentVisitor_onImmediateGenericRegion(region, data, start, end) {
  43755. var regionInfo = region.info;
  43756. var decodingContext = new DecodingContext(data, start, end);
  43757. var bitmap = decodeBitmap(region.mmr, regionInfo.width, regionInfo.height, region.template, region.prediction, null, region.at, decodingContext);
  43758. this.drawBitmap(regionInfo, bitmap);
  43759. },
  43760. onImmediateLosslessGenericRegion: function SimpleSegmentVisitor_onImmediateLosslessGenericRegion() {
  43761. this.onImmediateGenericRegion.apply(this, arguments);
  43762. },
  43763. onSymbolDictionary: function SimpleSegmentVisitor_onSymbolDictionary(dictionary, currentSegment, referredSegments, data, start, end) {
  43764. var huffmanTables;
  43765. if (dictionary.huffman) {
  43766. error('JBIG2 error: huffman is not supported');
  43767. }
  43768. var symbols = this.symbols;
  43769. if (!symbols) {
  43770. this.symbols = symbols = {};
  43771. }
  43772. var inputSymbols = [];
  43773. for (var i = 0, ii = referredSegments.length; i < ii; i++) {
  43774. inputSymbols = inputSymbols.concat(symbols[referredSegments[i]]);
  43775. }
  43776. var decodingContext = new DecodingContext(data, start, end);
  43777. symbols[currentSegment] = decodeSymbolDictionary(dictionary.huffman, dictionary.refinement, inputSymbols, dictionary.numberOfNewSymbols, dictionary.numberOfExportedSymbols, huffmanTables, dictionary.template, dictionary.at, dictionary.refinementTemplate, dictionary.refinementAt, decodingContext);
  43778. },
  43779. onImmediateTextRegion: function SimpleSegmentVisitor_onImmediateTextRegion(region, referredSegments, data, start, end) {
  43780. var regionInfo = region.info;
  43781. var huffmanTables;
  43782. var symbols = this.symbols;
  43783. var inputSymbols = [];
  43784. for (var i = 0, ii = referredSegments.length; i < ii; i++) {
  43785. inputSymbols = inputSymbols.concat(symbols[referredSegments[i]]);
  43786. }
  43787. var symbolCodeLength = log2(inputSymbols.length);
  43788. var decodingContext = new DecodingContext(data, start, end);
  43789. 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);
  43790. this.drawBitmap(regionInfo, bitmap);
  43791. },
  43792. onImmediateLosslessTextRegion: function SimpleSegmentVisitor_onImmediateLosslessTextRegion() {
  43793. this.onImmediateTextRegion.apply(this, arguments);
  43794. }
  43795. };
  43796. function Jbig2Image() {
  43797. }
  43798. Jbig2Image.prototype = {
  43799. parseChunks: function Jbig2Image_parseChunks(chunks) {
  43800. return parseJbig2Chunks(chunks);
  43801. }
  43802. };
  43803. return Jbig2Image;
  43804. }();
  43805. exports.Jbig2Image = Jbig2Image;
  43806. /***/ }),
  43807. /* 29 */
  43808. /***/ (function(module, exports, __w_pdfjs_require__) {
  43809. "use strict";
  43810. var sharedUtil = __w_pdfjs_require__(0);
  43811. var error = sharedUtil.error;
  43812. var JpegImage = function JpegImageClosure() {
  43813. var dctZigZag = new Uint8Array([
  43814. 0,
  43815. 1,
  43816. 8,
  43817. 16,
  43818. 9,
  43819. 2,
  43820. 3,
  43821. 10,
  43822. 17,
  43823. 24,
  43824. 32,
  43825. 25,
  43826. 18,
  43827. 11,
  43828. 4,
  43829. 5,
  43830. 12,
  43831. 19,
  43832. 26,
  43833. 33,
  43834. 40,
  43835. 48,
  43836. 41,
  43837. 34,
  43838. 27,
  43839. 20,
  43840. 13,
  43841. 6,
  43842. 7,
  43843. 14,
  43844. 21,
  43845. 28,
  43846. 35,
  43847. 42,
  43848. 49,
  43849. 56,
  43850. 57,
  43851. 50,
  43852. 43,
  43853. 36,
  43854. 29,
  43855. 22,
  43856. 15,
  43857. 23,
  43858. 30,
  43859. 37,
  43860. 44,
  43861. 51,
  43862. 58,
  43863. 59,
  43864. 52,
  43865. 45,
  43866. 38,
  43867. 31,
  43868. 39,
  43869. 46,
  43870. 53,
  43871. 60,
  43872. 61,
  43873. 54,
  43874. 47,
  43875. 55,
  43876. 62,
  43877. 63
  43878. ]);
  43879. var dctCos1 = 4017;
  43880. var dctSin1 = 799;
  43881. var dctCos3 = 3406;
  43882. var dctSin3 = 2276;
  43883. var dctCos6 = 1567;
  43884. var dctSin6 = 3784;
  43885. var dctSqrt2 = 5793;
  43886. var dctSqrt1d2 = 2896;
  43887. function JpegImage() {
  43888. this.decodeTransform = null;
  43889. this.colorTransform = -1;
  43890. }
  43891. function buildHuffmanTable(codeLengths, values) {
  43892. var k = 0, code = [], i, j, length = 16;
  43893. while (length > 0 && !codeLengths[length - 1]) {
  43894. length--;
  43895. }
  43896. code.push({
  43897. children: [],
  43898. index: 0
  43899. });
  43900. var p = code[0], q;
  43901. for (i = 0; i < length; i++) {
  43902. for (j = 0; j < codeLengths[i]; j++) {
  43903. p = code.pop();
  43904. p.children[p.index] = values[k];
  43905. while (p.index > 0) {
  43906. p = code.pop();
  43907. }
  43908. p.index++;
  43909. code.push(p);
  43910. while (code.length <= i) {
  43911. code.push(q = {
  43912. children: [],
  43913. index: 0
  43914. });
  43915. p.children[p.index] = q.children;
  43916. p = q;
  43917. }
  43918. k++;
  43919. }
  43920. if (i + 1 < length) {
  43921. code.push(q = {
  43922. children: [],
  43923. index: 0
  43924. });
  43925. p.children[p.index] = q.children;
  43926. p = q;
  43927. }
  43928. }
  43929. return code[0].children;
  43930. }
  43931. function getBlockBufferOffset(component, row, col) {
  43932. return 64 * ((component.blocksPerLine + 1) * row + col);
  43933. }
  43934. function decodeScan(data, offset, frame, components, resetInterval, spectralStart, spectralEnd, successivePrev, successive) {
  43935. var mcusPerLine = frame.mcusPerLine;
  43936. var progressive = frame.progressive;
  43937. var startOffset = offset, bitsData = 0, bitsCount = 0;
  43938. function readBit() {
  43939. if (bitsCount > 0) {
  43940. bitsCount--;
  43941. return bitsData >> bitsCount & 1;
  43942. }
  43943. bitsData = data[offset++];
  43944. if (bitsData === 0xFF) {
  43945. var nextByte = data[offset++];
  43946. if (nextByte) {
  43947. error('JPEG error: unexpected marker ' + (bitsData << 8 | nextByte).toString(16));
  43948. }
  43949. }
  43950. bitsCount = 7;
  43951. return bitsData >>> 7;
  43952. }
  43953. function decodeHuffman(tree) {
  43954. var node = tree;
  43955. while (true) {
  43956. node = node[readBit()];
  43957. if (typeof node === 'number') {
  43958. return node;
  43959. }
  43960. if (typeof node !== 'object') {
  43961. error('JPEG error: invalid huffman sequence');
  43962. }
  43963. }
  43964. }
  43965. function receive(length) {
  43966. var n = 0;
  43967. while (length > 0) {
  43968. n = n << 1 | readBit();
  43969. length--;
  43970. }
  43971. return n;
  43972. }
  43973. function receiveAndExtend(length) {
  43974. if (length === 1) {
  43975. return readBit() === 1 ? 1 : -1;
  43976. }
  43977. var n = receive(length);
  43978. if (n >= 1 << length - 1) {
  43979. return n;
  43980. }
  43981. return n + (-1 << length) + 1;
  43982. }
  43983. function decodeBaseline(component, offset) {
  43984. var t = decodeHuffman(component.huffmanTableDC);
  43985. var diff = t === 0 ? 0 : receiveAndExtend(t);
  43986. component.blockData[offset] = component.pred += diff;
  43987. var k = 1;
  43988. while (k < 64) {
  43989. var rs = decodeHuffman(component.huffmanTableAC);
  43990. var s = rs & 15, r = rs >> 4;
  43991. if (s === 0) {
  43992. if (r < 15) {
  43993. break;
  43994. }
  43995. k += 16;
  43996. continue;
  43997. }
  43998. k += r;
  43999. var z = dctZigZag[k];
  44000. component.blockData[offset + z] = receiveAndExtend(s);
  44001. k++;
  44002. }
  44003. }
  44004. function decodeDCFirst(component, offset) {
  44005. var t = decodeHuffman(component.huffmanTableDC);
  44006. var diff = t === 0 ? 0 : receiveAndExtend(t) << successive;
  44007. component.blockData[offset] = component.pred += diff;
  44008. }
  44009. function decodeDCSuccessive(component, offset) {
  44010. component.blockData[offset] |= readBit() << successive;
  44011. }
  44012. var eobrun = 0;
  44013. function decodeACFirst(component, offset) {
  44014. if (eobrun > 0) {
  44015. eobrun--;
  44016. return;
  44017. }
  44018. var k = spectralStart, e = spectralEnd;
  44019. while (k <= e) {
  44020. var rs = decodeHuffman(component.huffmanTableAC);
  44021. var s = rs & 15, r = rs >> 4;
  44022. if (s === 0) {
  44023. if (r < 15) {
  44024. eobrun = receive(r) + (1 << r) - 1;
  44025. break;
  44026. }
  44027. k += 16;
  44028. continue;
  44029. }
  44030. k += r;
  44031. var z = dctZigZag[k];
  44032. component.blockData[offset + z] = receiveAndExtend(s) * (1 << successive);
  44033. k++;
  44034. }
  44035. }
  44036. var successiveACState = 0, successiveACNextValue;
  44037. function decodeACSuccessive(component, offset) {
  44038. var k = spectralStart;
  44039. var e = spectralEnd;
  44040. var r = 0;
  44041. var s;
  44042. var rs;
  44043. while (k <= e) {
  44044. var z = dctZigZag[k];
  44045. switch (successiveACState) {
  44046. case 0:
  44047. rs = decodeHuffman(component.huffmanTableAC);
  44048. s = rs & 15;
  44049. r = rs >> 4;
  44050. if (s === 0) {
  44051. if (r < 15) {
  44052. eobrun = receive(r) + (1 << r);
  44053. successiveACState = 4;
  44054. } else {
  44055. r = 16;
  44056. successiveACState = 1;
  44057. }
  44058. } else {
  44059. if (s !== 1) {
  44060. error('JPEG error: invalid ACn encoding');
  44061. }
  44062. successiveACNextValue = receiveAndExtend(s);
  44063. successiveACState = r ? 2 : 3;
  44064. }
  44065. continue;
  44066. case 1:
  44067. case 2:
  44068. if (component.blockData[offset + z]) {
  44069. component.blockData[offset + z] += readBit() << successive;
  44070. } else {
  44071. r--;
  44072. if (r === 0) {
  44073. successiveACState = successiveACState === 2 ? 3 : 0;
  44074. }
  44075. }
  44076. break;
  44077. case 3:
  44078. if (component.blockData[offset + z]) {
  44079. component.blockData[offset + z] += readBit() << successive;
  44080. } else {
  44081. component.blockData[offset + z] = successiveACNextValue << successive;
  44082. successiveACState = 0;
  44083. }
  44084. break;
  44085. case 4:
  44086. if (component.blockData[offset + z]) {
  44087. component.blockData[offset + z] += readBit() << successive;
  44088. }
  44089. break;
  44090. }
  44091. k++;
  44092. }
  44093. if (successiveACState === 4) {
  44094. eobrun--;
  44095. if (eobrun === 0) {
  44096. successiveACState = 0;
  44097. }
  44098. }
  44099. }
  44100. function decodeMcu(component, decode, mcu, row, col) {
  44101. var mcuRow = mcu / mcusPerLine | 0;
  44102. var mcuCol = mcu % mcusPerLine;
  44103. var blockRow = mcuRow * component.v + row;
  44104. var blockCol = mcuCol * component.h + col;
  44105. var offset = getBlockBufferOffset(component, blockRow, blockCol);
  44106. decode(component, offset);
  44107. }
  44108. function decodeBlock(component, decode, mcu) {
  44109. var blockRow = mcu / component.blocksPerLine | 0;
  44110. var blockCol = mcu % component.blocksPerLine;
  44111. var offset = getBlockBufferOffset(component, blockRow, blockCol);
  44112. decode(component, offset);
  44113. }
  44114. var componentsLength = components.length;
  44115. var component, i, j, k, n;
  44116. var decodeFn;
  44117. if (progressive) {
  44118. if (spectralStart === 0) {
  44119. decodeFn = successivePrev === 0 ? decodeDCFirst : decodeDCSuccessive;
  44120. } else {
  44121. decodeFn = successivePrev === 0 ? decodeACFirst : decodeACSuccessive;
  44122. }
  44123. } else {
  44124. decodeFn = decodeBaseline;
  44125. }
  44126. var mcu = 0, marker;
  44127. var mcuExpected;
  44128. if (componentsLength === 1) {
  44129. mcuExpected = components[0].blocksPerLine * components[0].blocksPerColumn;
  44130. } else {
  44131. mcuExpected = mcusPerLine * frame.mcusPerColumn;
  44132. }
  44133. if (!resetInterval) {
  44134. resetInterval = mcuExpected;
  44135. }
  44136. var h, v;
  44137. while (mcu < mcuExpected) {
  44138. for (i = 0; i < componentsLength; i++) {
  44139. components[i].pred = 0;
  44140. }
  44141. eobrun = 0;
  44142. if (componentsLength === 1) {
  44143. component = components[0];
  44144. for (n = 0; n < resetInterval; n++) {
  44145. decodeBlock(component, decodeFn, mcu);
  44146. mcu++;
  44147. }
  44148. } else {
  44149. for (n = 0; n < resetInterval; n++) {
  44150. for (i = 0; i < componentsLength; i++) {
  44151. component = components[i];
  44152. h = component.h;
  44153. v = component.v;
  44154. for (j = 0; j < v; j++) {
  44155. for (k = 0; k < h; k++) {
  44156. decodeMcu(component, decodeFn, mcu, j, k);
  44157. }
  44158. }
  44159. }
  44160. mcu++;
  44161. }
  44162. }
  44163. bitsCount = 0;
  44164. marker = data[offset] << 8 | data[offset + 1];
  44165. while (data[offset] === 0x00 && offset < data.length - 1) {
  44166. offset++;
  44167. marker = data[offset] << 8 | data[offset + 1];
  44168. }
  44169. if (marker <= 0xFF00) {
  44170. error('JPEG error: marker was not found');
  44171. }
  44172. if (marker >= 0xFFD0 && marker <= 0xFFD7) {
  44173. offset += 2;
  44174. } else {
  44175. break;
  44176. }
  44177. }
  44178. return offset - startOffset;
  44179. }
  44180. function quantizeAndInverse(component, blockBufferOffset, p) {
  44181. var qt = component.quantizationTable, blockData = component.blockData;
  44182. var v0, v1, v2, v3, v4, v5, v6, v7;
  44183. var p0, p1, p2, p3, p4, p5, p6, p7;
  44184. var t;
  44185. if (!qt) {
  44186. error('JPEG error: missing required Quantization Table.');
  44187. }
  44188. for (var row = 0; row < 64; row += 8) {
  44189. p0 = blockData[blockBufferOffset + row];
  44190. p1 = blockData[blockBufferOffset + row + 1];
  44191. p2 = blockData[blockBufferOffset + row + 2];
  44192. p3 = blockData[blockBufferOffset + row + 3];
  44193. p4 = blockData[blockBufferOffset + row + 4];
  44194. p5 = blockData[blockBufferOffset + row + 5];
  44195. p6 = blockData[blockBufferOffset + row + 6];
  44196. p7 = blockData[blockBufferOffset + row + 7];
  44197. p0 *= qt[row];
  44198. if ((p1 | p2 | p3 | p4 | p5 | p6 | p7) === 0) {
  44199. t = dctSqrt2 * p0 + 512 >> 10;
  44200. p[row] = t;
  44201. p[row + 1] = t;
  44202. p[row + 2] = t;
  44203. p[row + 3] = t;
  44204. p[row + 4] = t;
  44205. p[row + 5] = t;
  44206. p[row + 6] = t;
  44207. p[row + 7] = t;
  44208. continue;
  44209. }
  44210. p1 *= qt[row + 1];
  44211. p2 *= qt[row + 2];
  44212. p3 *= qt[row + 3];
  44213. p4 *= qt[row + 4];
  44214. p5 *= qt[row + 5];
  44215. p6 *= qt[row + 6];
  44216. p7 *= qt[row + 7];
  44217. v0 = dctSqrt2 * p0 + 128 >> 8;
  44218. v1 = dctSqrt2 * p4 + 128 >> 8;
  44219. v2 = p2;
  44220. v3 = p6;
  44221. v4 = dctSqrt1d2 * (p1 - p7) + 128 >> 8;
  44222. v7 = dctSqrt1d2 * (p1 + p7) + 128 >> 8;
  44223. v5 = p3 << 4;
  44224. v6 = p5 << 4;
  44225. v0 = v0 + v1 + 1 >> 1;
  44226. v1 = v0 - v1;
  44227. t = v2 * dctSin6 + v3 * dctCos6 + 128 >> 8;
  44228. v2 = v2 * dctCos6 - v3 * dctSin6 + 128 >> 8;
  44229. v3 = t;
  44230. v4 = v4 + v6 + 1 >> 1;
  44231. v6 = v4 - v6;
  44232. v7 = v7 + v5 + 1 >> 1;
  44233. v5 = v7 - v5;
  44234. v0 = v0 + v3 + 1 >> 1;
  44235. v3 = v0 - v3;
  44236. v1 = v1 + v2 + 1 >> 1;
  44237. v2 = v1 - v2;
  44238. t = v4 * dctSin3 + v7 * dctCos3 + 2048 >> 12;
  44239. v4 = v4 * dctCos3 - v7 * dctSin3 + 2048 >> 12;
  44240. v7 = t;
  44241. t = v5 * dctSin1 + v6 * dctCos1 + 2048 >> 12;
  44242. v5 = v5 * dctCos1 - v6 * dctSin1 + 2048 >> 12;
  44243. v6 = t;
  44244. p[row] = v0 + v7;
  44245. p[row + 7] = v0 - v7;
  44246. p[row + 1] = v1 + v6;
  44247. p[row + 6] = v1 - v6;
  44248. p[row + 2] = v2 + v5;
  44249. p[row + 5] = v2 - v5;
  44250. p[row + 3] = v3 + v4;
  44251. p[row + 4] = v3 - v4;
  44252. }
  44253. for (var col = 0; col < 8; ++col) {
  44254. p0 = p[col];
  44255. p1 = p[col + 8];
  44256. p2 = p[col + 16];
  44257. p3 = p[col + 24];
  44258. p4 = p[col + 32];
  44259. p5 = p[col + 40];
  44260. p6 = p[col + 48];
  44261. p7 = p[col + 56];
  44262. if ((p1 | p2 | p3 | p4 | p5 | p6 | p7) === 0) {
  44263. t = dctSqrt2 * p0 + 8192 >> 14;
  44264. t = t < -2040 ? 0 : t >= 2024 ? 255 : t + 2056 >> 4;
  44265. blockData[blockBufferOffset + col] = t;
  44266. blockData[blockBufferOffset + col + 8] = t;
  44267. blockData[blockBufferOffset + col + 16] = t;
  44268. blockData[blockBufferOffset + col + 24] = t;
  44269. blockData[blockBufferOffset + col + 32] = t;
  44270. blockData[blockBufferOffset + col + 40] = t;
  44271. blockData[blockBufferOffset + col + 48] = t;
  44272. blockData[blockBufferOffset + col + 56] = t;
  44273. continue;
  44274. }
  44275. v0 = dctSqrt2 * p0 + 2048 >> 12;
  44276. v1 = dctSqrt2 * p4 + 2048 >> 12;
  44277. v2 = p2;
  44278. v3 = p6;
  44279. v4 = dctSqrt1d2 * (p1 - p7) + 2048 >> 12;
  44280. v7 = dctSqrt1d2 * (p1 + p7) + 2048 >> 12;
  44281. v5 = p3;
  44282. v6 = p5;
  44283. v0 = (v0 + v1 + 1 >> 1) + 4112;
  44284. v1 = v0 - v1;
  44285. t = v2 * dctSin6 + v3 * dctCos6 + 2048 >> 12;
  44286. v2 = v2 * dctCos6 - v3 * dctSin6 + 2048 >> 12;
  44287. v3 = t;
  44288. v4 = v4 + v6 + 1 >> 1;
  44289. v6 = v4 - v6;
  44290. v7 = v7 + v5 + 1 >> 1;
  44291. v5 = v7 - v5;
  44292. v0 = v0 + v3 + 1 >> 1;
  44293. v3 = v0 - v3;
  44294. v1 = v1 + v2 + 1 >> 1;
  44295. v2 = v1 - v2;
  44296. t = v4 * dctSin3 + v7 * dctCos3 + 2048 >> 12;
  44297. v4 = v4 * dctCos3 - v7 * dctSin3 + 2048 >> 12;
  44298. v7 = t;
  44299. t = v5 * dctSin1 + v6 * dctCos1 + 2048 >> 12;
  44300. v5 = v5 * dctCos1 - v6 * dctSin1 + 2048 >> 12;
  44301. v6 = t;
  44302. p0 = v0 + v7;
  44303. p7 = v0 - v7;
  44304. p1 = v1 + v6;
  44305. p6 = v1 - v6;
  44306. p2 = v2 + v5;
  44307. p5 = v2 - v5;
  44308. p3 = v3 + v4;
  44309. p4 = v3 - v4;
  44310. p0 = p0 < 16 ? 0 : p0 >= 4080 ? 255 : p0 >> 4;
  44311. p1 = p1 < 16 ? 0 : p1 >= 4080 ? 255 : p1 >> 4;
  44312. p2 = p2 < 16 ? 0 : p2 >= 4080 ? 255 : p2 >> 4;
  44313. p3 = p3 < 16 ? 0 : p3 >= 4080 ? 255 : p3 >> 4;
  44314. p4 = p4 < 16 ? 0 : p4 >= 4080 ? 255 : p4 >> 4;
  44315. p5 = p5 < 16 ? 0 : p5 >= 4080 ? 255 : p5 >> 4;
  44316. p6 = p6 < 16 ? 0 : p6 >= 4080 ? 255 : p6 >> 4;
  44317. p7 = p7 < 16 ? 0 : p7 >= 4080 ? 255 : p7 >> 4;
  44318. blockData[blockBufferOffset + col] = p0;
  44319. blockData[blockBufferOffset + col + 8] = p1;
  44320. blockData[blockBufferOffset + col + 16] = p2;
  44321. blockData[blockBufferOffset + col + 24] = p3;
  44322. blockData[blockBufferOffset + col + 32] = p4;
  44323. blockData[blockBufferOffset + col + 40] = p5;
  44324. blockData[blockBufferOffset + col + 48] = p6;
  44325. blockData[blockBufferOffset + col + 56] = p7;
  44326. }
  44327. }
  44328. function buildComponentData(frame, component) {
  44329. var blocksPerLine = component.blocksPerLine;
  44330. var blocksPerColumn = component.blocksPerColumn;
  44331. var computationBuffer = new Int16Array(64);
  44332. for (var blockRow = 0; blockRow < blocksPerColumn; blockRow++) {
  44333. for (var blockCol = 0; blockCol < blocksPerLine; blockCol++) {
  44334. var offset = getBlockBufferOffset(component, blockRow, blockCol);
  44335. quantizeAndInverse(component, offset, computationBuffer);
  44336. }
  44337. }
  44338. return component.blockData;
  44339. }
  44340. function clamp0to255(a) {
  44341. return a <= 0 ? 0 : a >= 255 ? 255 : a;
  44342. }
  44343. JpegImage.prototype = {
  44344. parse: function parse(data) {
  44345. function readUint16() {
  44346. var value = data[offset] << 8 | data[offset + 1];
  44347. offset += 2;
  44348. return value;
  44349. }
  44350. function readDataBlock() {
  44351. var length = readUint16();
  44352. var array = data.subarray(offset, offset + length - 2);
  44353. offset += array.length;
  44354. return array;
  44355. }
  44356. function prepareComponents(frame) {
  44357. var mcusPerLine = Math.ceil(frame.samplesPerLine / 8 / frame.maxH);
  44358. var mcusPerColumn = Math.ceil(frame.scanLines / 8 / frame.maxV);
  44359. for (var i = 0; i < frame.components.length; i++) {
  44360. component = frame.components[i];
  44361. var blocksPerLine = Math.ceil(Math.ceil(frame.samplesPerLine / 8) * component.h / frame.maxH);
  44362. var blocksPerColumn = Math.ceil(Math.ceil(frame.scanLines / 8) * component.v / frame.maxV);
  44363. var blocksPerLineForMcu = mcusPerLine * component.h;
  44364. var blocksPerColumnForMcu = mcusPerColumn * component.v;
  44365. var blocksBufferSize = 64 * blocksPerColumnForMcu * (blocksPerLineForMcu + 1);
  44366. component.blockData = new Int16Array(blocksBufferSize);
  44367. component.blocksPerLine = blocksPerLine;
  44368. component.blocksPerColumn = blocksPerColumn;
  44369. }
  44370. frame.mcusPerLine = mcusPerLine;
  44371. frame.mcusPerColumn = mcusPerColumn;
  44372. }
  44373. var offset = 0;
  44374. var jfif = null;
  44375. var adobe = null;
  44376. var frame, resetInterval;
  44377. var quantizationTables = [];
  44378. var huffmanTablesAC = [], huffmanTablesDC = [];
  44379. var fileMarker = readUint16();
  44380. if (fileMarker !== 0xFFD8) {
  44381. error('JPEG error: SOI not found');
  44382. }
  44383. fileMarker = readUint16();
  44384. while (fileMarker !== 0xFFD9) {
  44385. var i, j, l;
  44386. switch (fileMarker) {
  44387. case 0xFFE0:
  44388. case 0xFFE1:
  44389. case 0xFFE2:
  44390. case 0xFFE3:
  44391. case 0xFFE4:
  44392. case 0xFFE5:
  44393. case 0xFFE6:
  44394. case 0xFFE7:
  44395. case 0xFFE8:
  44396. case 0xFFE9:
  44397. case 0xFFEA:
  44398. case 0xFFEB:
  44399. case 0xFFEC:
  44400. case 0xFFED:
  44401. case 0xFFEE:
  44402. case 0xFFEF:
  44403. case 0xFFFE:
  44404. var appData = readDataBlock();
  44405. if (fileMarker === 0xFFE0) {
  44406. if (appData[0] === 0x4A && appData[1] === 0x46 && appData[2] === 0x49 && appData[3] === 0x46 && appData[4] === 0) {
  44407. jfif = {
  44408. version: {
  44409. major: appData[5],
  44410. minor: appData[6]
  44411. },
  44412. densityUnits: appData[7],
  44413. xDensity: appData[8] << 8 | appData[9],
  44414. yDensity: appData[10] << 8 | appData[11],
  44415. thumbWidth: appData[12],
  44416. thumbHeight: appData[13],
  44417. thumbData: appData.subarray(14, 14 + 3 * appData[12] * appData[13])
  44418. };
  44419. }
  44420. }
  44421. if (fileMarker === 0xFFEE) {
  44422. if (appData[0] === 0x41 && appData[1] === 0x64 && appData[2] === 0x6F && appData[3] === 0x62 && appData[4] === 0x65) {
  44423. adobe = {
  44424. version: appData[5] << 8 | appData[6],
  44425. flags0: appData[7] << 8 | appData[8],
  44426. flags1: appData[9] << 8 | appData[10],
  44427. transformCode: appData[11]
  44428. };
  44429. }
  44430. }
  44431. break;
  44432. case 0xFFDB:
  44433. var quantizationTablesLength = readUint16();
  44434. var quantizationTablesEnd = quantizationTablesLength + offset - 2;
  44435. var z;
  44436. while (offset < quantizationTablesEnd) {
  44437. var quantizationTableSpec = data[offset++];
  44438. var tableData = new Uint16Array(64);
  44439. if (quantizationTableSpec >> 4 === 0) {
  44440. for (j = 0; j < 64; j++) {
  44441. z = dctZigZag[j];
  44442. tableData[z] = data[offset++];
  44443. }
  44444. } else if (quantizationTableSpec >> 4 === 1) {
  44445. for (j = 0; j < 64; j++) {
  44446. z = dctZigZag[j];
  44447. tableData[z] = readUint16();
  44448. }
  44449. } else {
  44450. error('JPEG error: DQT - invalid table spec');
  44451. }
  44452. quantizationTables[quantizationTableSpec & 15] = tableData;
  44453. }
  44454. break;
  44455. case 0xFFC0:
  44456. case 0xFFC1:
  44457. case 0xFFC2:
  44458. if (frame) {
  44459. error('JPEG error: Only single frame JPEGs supported');
  44460. }
  44461. readUint16();
  44462. frame = {};
  44463. frame.extended = fileMarker === 0xFFC1;
  44464. frame.progressive = fileMarker === 0xFFC2;
  44465. frame.precision = data[offset++];
  44466. frame.scanLines = readUint16();
  44467. frame.samplesPerLine = readUint16();
  44468. frame.components = [];
  44469. frame.componentIds = {};
  44470. var componentsCount = data[offset++], componentId;
  44471. var maxH = 0, maxV = 0;
  44472. for (i = 0; i < componentsCount; i++) {
  44473. componentId = data[offset];
  44474. var h = data[offset + 1] >> 4;
  44475. var v = data[offset + 1] & 15;
  44476. if (maxH < h) {
  44477. maxH = h;
  44478. }
  44479. if (maxV < v) {
  44480. maxV = v;
  44481. }
  44482. var qId = data[offset + 2];
  44483. l = frame.components.push({
  44484. h: h,
  44485. v: v,
  44486. quantizationId: qId,
  44487. quantizationTable: null
  44488. });
  44489. frame.componentIds[componentId] = l - 1;
  44490. offset += 3;
  44491. }
  44492. frame.maxH = maxH;
  44493. frame.maxV = maxV;
  44494. prepareComponents(frame);
  44495. break;
  44496. case 0xFFC4:
  44497. var huffmanLength = readUint16();
  44498. for (i = 2; i < huffmanLength;) {
  44499. var huffmanTableSpec = data[offset++];
  44500. var codeLengths = new Uint8Array(16);
  44501. var codeLengthSum = 0;
  44502. for (j = 0; j < 16; j++, offset++) {
  44503. codeLengthSum += codeLengths[j] = data[offset];
  44504. }
  44505. var huffmanValues = new Uint8Array(codeLengthSum);
  44506. for (j = 0; j < codeLengthSum; j++, offset++) {
  44507. huffmanValues[j] = data[offset];
  44508. }
  44509. i += 17 + codeLengthSum;
  44510. (huffmanTableSpec >> 4 === 0 ? huffmanTablesDC : huffmanTablesAC)[huffmanTableSpec & 15] = buildHuffmanTable(codeLengths, huffmanValues);
  44511. }
  44512. break;
  44513. case 0xFFDD:
  44514. readUint16();
  44515. resetInterval = readUint16();
  44516. break;
  44517. case 0xFFDA:
  44518. readUint16();
  44519. var selectorsCount = data[offset++];
  44520. var components = [], component;
  44521. for (i = 0; i < selectorsCount; i++) {
  44522. var componentIndex = frame.componentIds[data[offset++]];
  44523. component = frame.components[componentIndex];
  44524. var tableSpec = data[offset++];
  44525. component.huffmanTableDC = huffmanTablesDC[tableSpec >> 4];
  44526. component.huffmanTableAC = huffmanTablesAC[tableSpec & 15];
  44527. components.push(component);
  44528. }
  44529. var spectralStart = data[offset++];
  44530. var spectralEnd = data[offset++];
  44531. var successiveApproximation = data[offset++];
  44532. var processed = decodeScan(data, offset, frame, components, resetInterval, spectralStart, spectralEnd, successiveApproximation >> 4, successiveApproximation & 15);
  44533. offset += processed;
  44534. break;
  44535. case 0xFFFF:
  44536. if (data[offset] !== 0xFF) {
  44537. offset--;
  44538. }
  44539. break;
  44540. default:
  44541. if (data[offset - 3] === 0xFF && data[offset - 2] >= 0xC0 && data[offset - 2] <= 0xFE) {
  44542. offset -= 3;
  44543. break;
  44544. }
  44545. error('JPEG error: unknown marker ' + fileMarker.toString(16));
  44546. }
  44547. fileMarker = readUint16();
  44548. }
  44549. this.width = frame.samplesPerLine;
  44550. this.height = frame.scanLines;
  44551. this.jfif = jfif;
  44552. this.adobe = adobe;
  44553. this.components = [];
  44554. for (i = 0; i < frame.components.length; i++) {
  44555. component = frame.components[i];
  44556. var quantizationTable = quantizationTables[component.quantizationId];
  44557. if (quantizationTable) {
  44558. component.quantizationTable = quantizationTable;
  44559. }
  44560. this.components.push({
  44561. output: buildComponentData(frame, component),
  44562. scaleX: component.h / frame.maxH,
  44563. scaleY: component.v / frame.maxV,
  44564. blocksPerLine: component.blocksPerLine,
  44565. blocksPerColumn: component.blocksPerColumn
  44566. });
  44567. }
  44568. this.numComponents = this.components.length;
  44569. },
  44570. _getLinearizedBlockData: function getLinearizedBlockData(width, height) {
  44571. var scaleX = this.width / width, scaleY = this.height / height;
  44572. var component, componentScaleX, componentScaleY, blocksPerScanline;
  44573. var x, y, i, j, k;
  44574. var index;
  44575. var offset = 0;
  44576. var output;
  44577. var numComponents = this.components.length;
  44578. var dataLength = width * height * numComponents;
  44579. var data = new Uint8Array(dataLength);
  44580. var xScaleBlockOffset = new Uint32Array(width);
  44581. var mask3LSB = 0xfffffff8;
  44582. for (i = 0; i < numComponents; i++) {
  44583. component = this.components[i];
  44584. componentScaleX = component.scaleX * scaleX;
  44585. componentScaleY = component.scaleY * scaleY;
  44586. offset = i;
  44587. output = component.output;
  44588. blocksPerScanline = component.blocksPerLine + 1 << 3;
  44589. for (x = 0; x < width; x++) {
  44590. j = 0 | x * componentScaleX;
  44591. xScaleBlockOffset[x] = (j & mask3LSB) << 3 | j & 7;
  44592. }
  44593. for (y = 0; y < height; y++) {
  44594. j = 0 | y * componentScaleY;
  44595. index = blocksPerScanline * (j & mask3LSB) | (j & 7) << 3;
  44596. for (x = 0; x < width; x++) {
  44597. data[offset] = output[index + xScaleBlockOffset[x]];
  44598. offset += numComponents;
  44599. }
  44600. }
  44601. }
  44602. var transform = this.decodeTransform;
  44603. if (transform) {
  44604. for (i = 0; i < dataLength;) {
  44605. for (j = 0, k = 0; j < numComponents; j++, i++, k += 2) {
  44606. data[i] = (data[i] * transform[k] >> 8) + transform[k + 1];
  44607. }
  44608. }
  44609. }
  44610. return data;
  44611. },
  44612. _isColorConversionNeeded: function isColorConversionNeeded() {
  44613. if (this.adobe && this.adobe.transformCode) {
  44614. return true;
  44615. } else if (this.numComponents === 3) {
  44616. if (!this.adobe && this.colorTransform === 0) {
  44617. return false;
  44618. }
  44619. return true;
  44620. }
  44621. if (!this.adobe && this.colorTransform === 1) {
  44622. return true;
  44623. }
  44624. return false;
  44625. },
  44626. _convertYccToRgb: function convertYccToRgb(data) {
  44627. var Y, Cb, Cr;
  44628. for (var i = 0, length = data.length; i < length; i += 3) {
  44629. Y = data[i];
  44630. Cb = data[i + 1];
  44631. Cr = data[i + 2];
  44632. data[i] = clamp0to255(Y - 179.456 + 1.402 * Cr);
  44633. data[i + 1] = clamp0to255(Y + 135.459 - 0.344 * Cb - 0.714 * Cr);
  44634. data[i + 2] = clamp0to255(Y - 226.816 + 1.772 * Cb);
  44635. }
  44636. return data;
  44637. },
  44638. _convertYcckToRgb: function convertYcckToRgb(data) {
  44639. var Y, Cb, Cr, k;
  44640. var offset = 0;
  44641. for (var i = 0, length = data.length; i < length; i += 4) {
  44642. Y = data[i];
  44643. Cb = data[i + 1];
  44644. Cr = data[i + 2];
  44645. k = data[i + 3];
  44646. 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);
  44647. 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);
  44648. 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);
  44649. data[offset++] = clamp0to255(r);
  44650. data[offset++] = clamp0to255(g);
  44651. data[offset++] = clamp0to255(b);
  44652. }
  44653. return data;
  44654. },
  44655. _convertYcckToCmyk: function convertYcckToCmyk(data) {
  44656. var Y, Cb, Cr;
  44657. for (var i = 0, length = data.length; i < length; i += 4) {
  44658. Y = data[i];
  44659. Cb = data[i + 1];
  44660. Cr = data[i + 2];
  44661. data[i] = clamp0to255(434.456 - Y - 1.402 * Cr);
  44662. data[i + 1] = clamp0to255(119.541 - Y + 0.344 * Cb + 0.714 * Cr);
  44663. data[i + 2] = clamp0to255(481.816 - Y - 1.772 * Cb);
  44664. }
  44665. return data;
  44666. },
  44667. _convertCmykToRgb: function convertCmykToRgb(data) {
  44668. var c, m, y, k;
  44669. var offset = 0;
  44670. var min = -255 * 255 * 255;
  44671. var scale = 1 / 255 / 255;
  44672. for (var i = 0, length = data.length; i < length; i += 4) {
  44673. c = data[i];
  44674. m = data[i + 1];
  44675. y = data[i + 2];
  44676. k = data[i + 3];
  44677. 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);
  44678. 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);
  44679. 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);
  44680. data[offset++] = r >= 0 ? 255 : r <= min ? 0 : 255 + r * scale | 0;
  44681. data[offset++] = g >= 0 ? 255 : g <= min ? 0 : 255 + g * scale | 0;
  44682. data[offset++] = b >= 0 ? 255 : b <= min ? 0 : 255 + b * scale | 0;
  44683. }
  44684. return data;
  44685. },
  44686. getData: function getData(width, height, forceRGBoutput) {
  44687. if (this.numComponents > 4) {
  44688. error('JPEG error: Unsupported color mode');
  44689. }
  44690. var data = this._getLinearizedBlockData(width, height);
  44691. if (this.numComponents === 1 && forceRGBoutput) {
  44692. var dataLength = data.length;
  44693. var rgbData = new Uint8Array(dataLength * 3);
  44694. var offset = 0;
  44695. for (var i = 0; i < dataLength; i++) {
  44696. var grayColor = data[i];
  44697. rgbData[offset++] = grayColor;
  44698. rgbData[offset++] = grayColor;
  44699. rgbData[offset++] = grayColor;
  44700. }
  44701. return rgbData;
  44702. } else if (this.numComponents === 3 && this._isColorConversionNeeded()) {
  44703. return this._convertYccToRgb(data);
  44704. } else if (this.numComponents === 4) {
  44705. if (this._isColorConversionNeeded()) {
  44706. if (forceRGBoutput) {
  44707. return this._convertYcckToRgb(data);
  44708. }
  44709. return this._convertYcckToCmyk(data);
  44710. } else if (forceRGBoutput) {
  44711. return this._convertCmykToRgb(data);
  44712. }
  44713. }
  44714. return data;
  44715. }
  44716. };
  44717. return JpegImage;
  44718. }();
  44719. exports.JpegImage = JpegImage;
  44720. /***/ }),
  44721. /* 30 */
  44722. /***/ (function(module, exports, __w_pdfjs_require__) {
  44723. "use strict";
  44724. var sharedUtil = __w_pdfjs_require__(0);
  44725. var getLookupTableFactory = sharedUtil.getLookupTableFactory;
  44726. var getMetrics = getLookupTableFactory(function (t) {
  44727. t['Courier'] = 600;
  44728. t['Courier-Bold'] = 600;
  44729. t['Courier-BoldOblique'] = 600;
  44730. t['Courier-Oblique'] = 600;
  44731. t['Helvetica'] = getLookupTableFactory(function (t) {
  44732. t['space'] = 278;
  44733. t['exclam'] = 278;
  44734. t['quotedbl'] = 355;
  44735. t['numbersign'] = 556;
  44736. t['dollar'] = 556;
  44737. t['percent'] = 889;
  44738. t['ampersand'] = 667;
  44739. t['quoteright'] = 222;
  44740. t['parenleft'] = 333;
  44741. t['parenright'] = 333;
  44742. t['asterisk'] = 389;
  44743. t['plus'] = 584;
  44744. t['comma'] = 278;
  44745. t['hyphen'] = 333;
  44746. t['period'] = 278;
  44747. t['slash'] = 278;
  44748. t['zero'] = 556;
  44749. t['one'] = 556;
  44750. t['two'] = 556;
  44751. t['three'] = 556;
  44752. t['four'] = 556;
  44753. t['five'] = 556;
  44754. t['six'] = 556;
  44755. t['seven'] = 556;
  44756. t['eight'] = 556;
  44757. t['nine'] = 556;
  44758. t['colon'] = 278;
  44759. t['semicolon'] = 278;
  44760. t['less'] = 584;
  44761. t['equal'] = 584;
  44762. t['greater'] = 584;
  44763. t['question'] = 556;
  44764. t['at'] = 1015;
  44765. t['A'] = 667;
  44766. t['B'] = 667;
  44767. t['C'] = 722;
  44768. t['D'] = 722;
  44769. t['E'] = 667;
  44770. t['F'] = 611;
  44771. t['G'] = 778;
  44772. t['H'] = 722;
  44773. t['I'] = 278;
  44774. t['J'] = 500;
  44775. t['K'] = 667;
  44776. t['L'] = 556;
  44777. t['M'] = 833;
  44778. t['N'] = 722;
  44779. t['O'] = 778;
  44780. t['P'] = 667;
  44781. t['Q'] = 778;
  44782. t['R'] = 722;
  44783. t['S'] = 667;
  44784. t['T'] = 611;
  44785. t['U'] = 722;
  44786. t['V'] = 667;
  44787. t['W'] = 944;
  44788. t['X'] = 667;
  44789. t['Y'] = 667;
  44790. t['Z'] = 611;
  44791. t['bracketleft'] = 278;
  44792. t['backslash'] = 278;
  44793. t['bracketright'] = 278;
  44794. t['asciicircum'] = 469;
  44795. t['underscore'] = 556;
  44796. t['quoteleft'] = 222;
  44797. t['a'] = 556;
  44798. t['b'] = 556;
  44799. t['c'] = 500;
  44800. t['d'] = 556;
  44801. t['e'] = 556;
  44802. t['f'] = 278;
  44803. t['g'] = 556;
  44804. t['h'] = 556;
  44805. t['i'] = 222;
  44806. t['j'] = 222;
  44807. t['k'] = 500;
  44808. t['l'] = 222;
  44809. t['m'] = 833;
  44810. t['n'] = 556;
  44811. t['o'] = 556;
  44812. t['p'] = 556;
  44813. t['q'] = 556;
  44814. t['r'] = 333;
  44815. t['s'] = 500;
  44816. t['t'] = 278;
  44817. t['u'] = 556;
  44818. t['v'] = 500;
  44819. t['w'] = 722;
  44820. t['x'] = 500;
  44821. t['y'] = 500;
  44822. t['z'] = 500;
  44823. t['braceleft'] = 334;
  44824. t['bar'] = 260;
  44825. t['braceright'] = 334;
  44826. t['asciitilde'] = 584;
  44827. t['exclamdown'] = 333;
  44828. t['cent'] = 556;
  44829. t['sterling'] = 556;
  44830. t['fraction'] = 167;
  44831. t['yen'] = 556;
  44832. t['florin'] = 556;
  44833. t['section'] = 556;
  44834. t['currency'] = 556;
  44835. t['quotesingle'] = 191;
  44836. t['quotedblleft'] = 333;
  44837. t['guillemotleft'] = 556;
  44838. t['guilsinglleft'] = 333;
  44839. t['guilsinglright'] = 333;
  44840. t['fi'] = 500;
  44841. t['fl'] = 500;
  44842. t['endash'] = 556;
  44843. t['dagger'] = 556;
  44844. t['daggerdbl'] = 556;
  44845. t['periodcentered'] = 278;
  44846. t['paragraph'] = 537;
  44847. t['bullet'] = 350;
  44848. t['quotesinglbase'] = 222;
  44849. t['quotedblbase'] = 333;
  44850. t['quotedblright'] = 333;
  44851. t['guillemotright'] = 556;
  44852. t['ellipsis'] = 1000;
  44853. t['perthousand'] = 1000;
  44854. t['questiondown'] = 611;
  44855. t['grave'] = 333;
  44856. t['acute'] = 333;
  44857. t['circumflex'] = 333;
  44858. t['tilde'] = 333;
  44859. t['macron'] = 333;
  44860. t['breve'] = 333;
  44861. t['dotaccent'] = 333;
  44862. t['dieresis'] = 333;
  44863. t['ring'] = 333;
  44864. t['cedilla'] = 333;
  44865. t['hungarumlaut'] = 333;
  44866. t['ogonek'] = 333;
  44867. t['caron'] = 333;
  44868. t['emdash'] = 1000;
  44869. t['AE'] = 1000;
  44870. t['ordfeminine'] = 370;
  44871. t['Lslash'] = 556;
  44872. t['Oslash'] = 778;
  44873. t['OE'] = 1000;
  44874. t['ordmasculine'] = 365;
  44875. t['ae'] = 889;
  44876. t['dotlessi'] = 278;
  44877. t['lslash'] = 222;
  44878. t['oslash'] = 611;
  44879. t['oe'] = 944;
  44880. t['germandbls'] = 611;
  44881. t['Idieresis'] = 278;
  44882. t['eacute'] = 556;
  44883. t['abreve'] = 556;
  44884. t['uhungarumlaut'] = 556;
  44885. t['ecaron'] = 556;
  44886. t['Ydieresis'] = 667;
  44887. t['divide'] = 584;
  44888. t['Yacute'] = 667;
  44889. t['Acircumflex'] = 667;
  44890. t['aacute'] = 556;
  44891. t['Ucircumflex'] = 722;
  44892. t['yacute'] = 500;
  44893. t['scommaaccent'] = 500;
  44894. t['ecircumflex'] = 556;
  44895. t['Uring'] = 722;
  44896. t['Udieresis'] = 722;
  44897. t['aogonek'] = 556;
  44898. t['Uacute'] = 722;
  44899. t['uogonek'] = 556;
  44900. t['Edieresis'] = 667;
  44901. t['Dcroat'] = 722;
  44902. t['commaaccent'] = 250;
  44903. t['copyright'] = 737;
  44904. t['Emacron'] = 667;
  44905. t['ccaron'] = 500;
  44906. t['aring'] = 556;
  44907. t['Ncommaaccent'] = 722;
  44908. t['lacute'] = 222;
  44909. t['agrave'] = 556;
  44910. t['Tcommaaccent'] = 611;
  44911. t['Cacute'] = 722;
  44912. t['atilde'] = 556;
  44913. t['Edotaccent'] = 667;
  44914. t['scaron'] = 500;
  44915. t['scedilla'] = 500;
  44916. t['iacute'] = 278;
  44917. t['lozenge'] = 471;
  44918. t['Rcaron'] = 722;
  44919. t['Gcommaaccent'] = 778;
  44920. t['ucircumflex'] = 556;
  44921. t['acircumflex'] = 556;
  44922. t['Amacron'] = 667;
  44923. t['rcaron'] = 333;
  44924. t['ccedilla'] = 500;
  44925. t['Zdotaccent'] = 611;
  44926. t['Thorn'] = 667;
  44927. t['Omacron'] = 778;
  44928. t['Racute'] = 722;
  44929. t['Sacute'] = 667;
  44930. t['dcaron'] = 643;
  44931. t['Umacron'] = 722;
  44932. t['uring'] = 556;
  44933. t['threesuperior'] = 333;
  44934. t['Ograve'] = 778;
  44935. t['Agrave'] = 667;
  44936. t['Abreve'] = 667;
  44937. t['multiply'] = 584;
  44938. t['uacute'] = 556;
  44939. t['Tcaron'] = 611;
  44940. t['partialdiff'] = 476;
  44941. t['ydieresis'] = 500;
  44942. t['Nacute'] = 722;
  44943. t['icircumflex'] = 278;
  44944. t['Ecircumflex'] = 667;
  44945. t['adieresis'] = 556;
  44946. t['edieresis'] = 556;
  44947. t['cacute'] = 500;
  44948. t['nacute'] = 556;
  44949. t['umacron'] = 556;
  44950. t['Ncaron'] = 722;
  44951. t['Iacute'] = 278;
  44952. t['plusminus'] = 584;
  44953. t['brokenbar'] = 260;
  44954. t['registered'] = 737;
  44955. t['Gbreve'] = 778;
  44956. t['Idotaccent'] = 278;
  44957. t['summation'] = 600;
  44958. t['Egrave'] = 667;
  44959. t['racute'] = 333;
  44960. t['omacron'] = 556;
  44961. t['Zacute'] = 611;
  44962. t['Zcaron'] = 611;
  44963. t['greaterequal'] = 549;
  44964. t['Eth'] = 722;
  44965. t['Ccedilla'] = 722;
  44966. t['lcommaaccent'] = 222;
  44967. t['tcaron'] = 317;
  44968. t['eogonek'] = 556;
  44969. t['Uogonek'] = 722;
  44970. t['Aacute'] = 667;
  44971. t['Adieresis'] = 667;
  44972. t['egrave'] = 556;
  44973. t['zacute'] = 500;
  44974. t['iogonek'] = 222;
  44975. t['Oacute'] = 778;
  44976. t['oacute'] = 556;
  44977. t['amacron'] = 556;
  44978. t['sacute'] = 500;
  44979. t['idieresis'] = 278;
  44980. t['Ocircumflex'] = 778;
  44981. t['Ugrave'] = 722;
  44982. t['Delta'] = 612;
  44983. t['thorn'] = 556;
  44984. t['twosuperior'] = 333;
  44985. t['Odieresis'] = 778;
  44986. t['mu'] = 556;
  44987. t['igrave'] = 278;
  44988. t['ohungarumlaut'] = 556;
  44989. t['Eogonek'] = 667;
  44990. t['dcroat'] = 556;
  44991. t['threequarters'] = 834;
  44992. t['Scedilla'] = 667;
  44993. t['lcaron'] = 299;
  44994. t['Kcommaaccent'] = 667;
  44995. t['Lacute'] = 556;
  44996. t['trademark'] = 1000;
  44997. t['edotaccent'] = 556;
  44998. t['Igrave'] = 278;
  44999. t['Imacron'] = 278;
  45000. t['Lcaron'] = 556;
  45001. t['onehalf'] = 834;
  45002. t['lessequal'] = 549;
  45003. t['ocircumflex'] = 556;
  45004. t['ntilde'] = 556;
  45005. t['Uhungarumlaut'] = 722;
  45006. t['Eacute'] = 667;
  45007. t['emacron'] = 556;
  45008. t['gbreve'] = 556;
  45009. t['onequarter'] = 834;
  45010. t['Scaron'] = 667;
  45011. t['Scommaaccent'] = 667;
  45012. t['Ohungarumlaut'] = 778;
  45013. t['degree'] = 400;
  45014. t['ograve'] = 556;
  45015. t['Ccaron'] = 722;
  45016. t['ugrave'] = 556;
  45017. t['radical'] = 453;
  45018. t['Dcaron'] = 722;
  45019. t['rcommaaccent'] = 333;
  45020. t['Ntilde'] = 722;
  45021. t['otilde'] = 556;
  45022. t['Rcommaaccent'] = 722;
  45023. t['Lcommaaccent'] = 556;
  45024. t['Atilde'] = 667;
  45025. t['Aogonek'] = 667;
  45026. t['Aring'] = 667;
  45027. t['Otilde'] = 778;
  45028. t['zdotaccent'] = 500;
  45029. t['Ecaron'] = 667;
  45030. t['Iogonek'] = 278;
  45031. t['kcommaaccent'] = 500;
  45032. t['minus'] = 584;
  45033. t['Icircumflex'] = 278;
  45034. t['ncaron'] = 556;
  45035. t['tcommaaccent'] = 278;
  45036. t['logicalnot'] = 584;
  45037. t['odieresis'] = 556;
  45038. t['udieresis'] = 556;
  45039. t['notequal'] = 549;
  45040. t['gcommaaccent'] = 556;
  45041. t['eth'] = 556;
  45042. t['zcaron'] = 500;
  45043. t['ncommaaccent'] = 556;
  45044. t['onesuperior'] = 333;
  45045. t['imacron'] = 278;
  45046. t['Euro'] = 556;
  45047. });
  45048. t['Helvetica-Bold'] = getLookupTableFactory(function (t) {
  45049. t['space'] = 278;
  45050. t['exclam'] = 333;
  45051. t['quotedbl'] = 474;
  45052. t['numbersign'] = 556;
  45053. t['dollar'] = 556;
  45054. t['percent'] = 889;
  45055. t['ampersand'] = 722;
  45056. t['quoteright'] = 278;
  45057. t['parenleft'] = 333;
  45058. t['parenright'] = 333;
  45059. t['asterisk'] = 389;
  45060. t['plus'] = 584;
  45061. t['comma'] = 278;
  45062. t['hyphen'] = 333;
  45063. t['period'] = 278;
  45064. t['slash'] = 278;
  45065. t['zero'] = 556;
  45066. t['one'] = 556;
  45067. t['two'] = 556;
  45068. t['three'] = 556;
  45069. t['four'] = 556;
  45070. t['five'] = 556;
  45071. t['six'] = 556;
  45072. t['seven'] = 556;
  45073. t['eight'] = 556;
  45074. t['nine'] = 556;
  45075. t['colon'] = 333;
  45076. t['semicolon'] = 333;
  45077. t['less'] = 584;
  45078. t['equal'] = 584;
  45079. t['greater'] = 584;
  45080. t['question'] = 611;
  45081. t['at'] = 975;
  45082. t['A'] = 722;
  45083. t['B'] = 722;
  45084. t['C'] = 722;
  45085. t['D'] = 722;
  45086. t['E'] = 667;
  45087. t['F'] = 611;
  45088. t['G'] = 778;
  45089. t['H'] = 722;
  45090. t['I'] = 278;
  45091. t['J'] = 556;
  45092. t['K'] = 722;
  45093. t['L'] = 611;
  45094. t['M'] = 833;
  45095. t['N'] = 722;
  45096. t['O'] = 778;
  45097. t['P'] = 667;
  45098. t['Q'] = 778;
  45099. t['R'] = 722;
  45100. t['S'] = 667;
  45101. t['T'] = 611;
  45102. t['U'] = 722;
  45103. t['V'] = 667;
  45104. t['W'] = 944;
  45105. t['X'] = 667;
  45106. t['Y'] = 667;
  45107. t['Z'] = 611;
  45108. t['bracketleft'] = 333;
  45109. t['backslash'] = 278;
  45110. t['bracketright'] = 333;
  45111. t['asciicircum'] = 584;
  45112. t['underscore'] = 556;
  45113. t['quoteleft'] = 278;
  45114. t['a'] = 556;
  45115. t['b'] = 611;
  45116. t['c'] = 556;
  45117. t['d'] = 611;
  45118. t['e'] = 556;
  45119. t['f'] = 333;
  45120. t['g'] = 611;
  45121. t['h'] = 611;
  45122. t['i'] = 278;
  45123. t['j'] = 278;
  45124. t['k'] = 556;
  45125. t['l'] = 278;
  45126. t['m'] = 889;
  45127. t['n'] = 611;
  45128. t['o'] = 611;
  45129. t['p'] = 611;
  45130. t['q'] = 611;
  45131. t['r'] = 389;
  45132. t['s'] = 556;
  45133. t['t'] = 333;
  45134. t['u'] = 611;
  45135. t['v'] = 556;
  45136. t['w'] = 778;
  45137. t['x'] = 556;
  45138. t['y'] = 556;
  45139. t['z'] = 500;
  45140. t['braceleft'] = 389;
  45141. t['bar'] = 280;
  45142. t['braceright'] = 389;
  45143. t['asciitilde'] = 584;
  45144. t['exclamdown'] = 333;
  45145. t['cent'] = 556;
  45146. t['sterling'] = 556;
  45147. t['fraction'] = 167;
  45148. t['yen'] = 556;
  45149. t['florin'] = 556;
  45150. t['section'] = 556;
  45151. t['currency'] = 556;
  45152. t['quotesingle'] = 238;
  45153. t['quotedblleft'] = 500;
  45154. t['guillemotleft'] = 556;
  45155. t['guilsinglleft'] = 333;
  45156. t['guilsinglright'] = 333;
  45157. t['fi'] = 611;
  45158. t['fl'] = 611;
  45159. t['endash'] = 556;
  45160. t['dagger'] = 556;
  45161. t['daggerdbl'] = 556;
  45162. t['periodcentered'] = 278;
  45163. t['paragraph'] = 556;
  45164. t['bullet'] = 350;
  45165. t['quotesinglbase'] = 278;
  45166. t['quotedblbase'] = 500;
  45167. t['quotedblright'] = 500;
  45168. t['guillemotright'] = 556;
  45169. t['ellipsis'] = 1000;
  45170. t['perthousand'] = 1000;
  45171. t['questiondown'] = 611;
  45172. t['grave'] = 333;
  45173. t['acute'] = 333;
  45174. t['circumflex'] = 333;
  45175. t['tilde'] = 333;
  45176. t['macron'] = 333;
  45177. t['breve'] = 333;
  45178. t['dotaccent'] = 333;
  45179. t['dieresis'] = 333;
  45180. t['ring'] = 333;
  45181. t['cedilla'] = 333;
  45182. t['hungarumlaut'] = 333;
  45183. t['ogonek'] = 333;
  45184. t['caron'] = 333;
  45185. t['emdash'] = 1000;
  45186. t['AE'] = 1000;
  45187. t['ordfeminine'] = 370;
  45188. t['Lslash'] = 611;
  45189. t['Oslash'] = 778;
  45190. t['OE'] = 1000;
  45191. t['ordmasculine'] = 365;
  45192. t['ae'] = 889;
  45193. t['dotlessi'] = 278;
  45194. t['lslash'] = 278;
  45195. t['oslash'] = 611;
  45196. t['oe'] = 944;
  45197. t['germandbls'] = 611;
  45198. t['Idieresis'] = 278;
  45199. t['eacute'] = 556;
  45200. t['abreve'] = 556;
  45201. t['uhungarumlaut'] = 611;
  45202. t['ecaron'] = 556;
  45203. t['Ydieresis'] = 667;
  45204. t['divide'] = 584;
  45205. t['Yacute'] = 667;
  45206. t['Acircumflex'] = 722;
  45207. t['aacute'] = 556;
  45208. t['Ucircumflex'] = 722;
  45209. t['yacute'] = 556;
  45210. t['scommaaccent'] = 556;
  45211. t['ecircumflex'] = 556;
  45212. t['Uring'] = 722;
  45213. t['Udieresis'] = 722;
  45214. t['aogonek'] = 556;
  45215. t['Uacute'] = 722;
  45216. t['uogonek'] = 611;
  45217. t['Edieresis'] = 667;
  45218. t['Dcroat'] = 722;
  45219. t['commaaccent'] = 250;
  45220. t['copyright'] = 737;
  45221. t['Emacron'] = 667;
  45222. t['ccaron'] = 556;
  45223. t['aring'] = 556;
  45224. t['Ncommaaccent'] = 722;
  45225. t['lacute'] = 278;
  45226. t['agrave'] = 556;
  45227. t['Tcommaaccent'] = 611;
  45228. t['Cacute'] = 722;
  45229. t['atilde'] = 556;
  45230. t['Edotaccent'] = 667;
  45231. t['scaron'] = 556;
  45232. t['scedilla'] = 556;
  45233. t['iacute'] = 278;
  45234. t['lozenge'] = 494;
  45235. t['Rcaron'] = 722;
  45236. t['Gcommaaccent'] = 778;
  45237. t['ucircumflex'] = 611;
  45238. t['acircumflex'] = 556;
  45239. t['Amacron'] = 722;
  45240. t['rcaron'] = 389;
  45241. t['ccedilla'] = 556;
  45242. t['Zdotaccent'] = 611;
  45243. t['Thorn'] = 667;
  45244. t['Omacron'] = 778;
  45245. t['Racute'] = 722;
  45246. t['Sacute'] = 667;
  45247. t['dcaron'] = 743;
  45248. t['Umacron'] = 722;
  45249. t['uring'] = 611;
  45250. t['threesuperior'] = 333;
  45251. t['Ograve'] = 778;
  45252. t['Agrave'] = 722;
  45253. t['Abreve'] = 722;
  45254. t['multiply'] = 584;
  45255. t['uacute'] = 611;
  45256. t['Tcaron'] = 611;
  45257. t['partialdiff'] = 494;
  45258. t['ydieresis'] = 556;
  45259. t['Nacute'] = 722;
  45260. t['icircumflex'] = 278;
  45261. t['Ecircumflex'] = 667;
  45262. t['adieresis'] = 556;
  45263. t['edieresis'] = 556;
  45264. t['cacute'] = 556;
  45265. t['nacute'] = 611;
  45266. t['umacron'] = 611;
  45267. t['Ncaron'] = 722;
  45268. t['Iacute'] = 278;
  45269. t['plusminus'] = 584;
  45270. t['brokenbar'] = 280;
  45271. t['registered'] = 737;
  45272. t['Gbreve'] = 778;
  45273. t['Idotaccent'] = 278;
  45274. t['summation'] = 600;
  45275. t['Egrave'] = 667;
  45276. t['racute'] = 389;
  45277. t['omacron'] = 611;
  45278. t['Zacute'] = 611;
  45279. t['Zcaron'] = 611;
  45280. t['greaterequal'] = 549;
  45281. t['Eth'] = 722;
  45282. t['Ccedilla'] = 722;
  45283. t['lcommaaccent'] = 278;
  45284. t['tcaron'] = 389;
  45285. t['eogonek'] = 556;
  45286. t['Uogonek'] = 722;
  45287. t['Aacute'] = 722;
  45288. t['Adieresis'] = 722;
  45289. t['egrave'] = 556;
  45290. t['zacute'] = 500;
  45291. t['iogonek'] = 278;
  45292. t['Oacute'] = 778;
  45293. t['oacute'] = 611;
  45294. t['amacron'] = 556;
  45295. t['sacute'] = 556;
  45296. t['idieresis'] = 278;
  45297. t['Ocircumflex'] = 778;
  45298. t['Ugrave'] = 722;
  45299. t['Delta'] = 612;
  45300. t['thorn'] = 611;
  45301. t['twosuperior'] = 333;
  45302. t['Odieresis'] = 778;
  45303. t['mu'] = 611;
  45304. t['igrave'] = 278;
  45305. t['ohungarumlaut'] = 611;
  45306. t['Eogonek'] = 667;
  45307. t['dcroat'] = 611;
  45308. t['threequarters'] = 834;
  45309. t['Scedilla'] = 667;
  45310. t['lcaron'] = 400;
  45311. t['Kcommaaccent'] = 722;
  45312. t['Lacute'] = 611;
  45313. t['trademark'] = 1000;
  45314. t['edotaccent'] = 556;
  45315. t['Igrave'] = 278;
  45316. t['Imacron'] = 278;
  45317. t['Lcaron'] = 611;
  45318. t['onehalf'] = 834;
  45319. t['lessequal'] = 549;
  45320. t['ocircumflex'] = 611;
  45321. t['ntilde'] = 611;
  45322. t['Uhungarumlaut'] = 722;
  45323. t['Eacute'] = 667;
  45324. t['emacron'] = 556;
  45325. t['gbreve'] = 611;
  45326. t['onequarter'] = 834;
  45327. t['Scaron'] = 667;
  45328. t['Scommaaccent'] = 667;
  45329. t['Ohungarumlaut'] = 778;
  45330. t['degree'] = 400;
  45331. t['ograve'] = 611;
  45332. t['Ccaron'] = 722;
  45333. t['ugrave'] = 611;
  45334. t['radical'] = 549;
  45335. t['Dcaron'] = 722;
  45336. t['rcommaaccent'] = 389;
  45337. t['Ntilde'] = 722;
  45338. t['otilde'] = 611;
  45339. t['Rcommaaccent'] = 722;
  45340. t['Lcommaaccent'] = 611;
  45341. t['Atilde'] = 722;
  45342. t['Aogonek'] = 722;
  45343. t['Aring'] = 722;
  45344. t['Otilde'] = 778;
  45345. t['zdotaccent'] = 500;
  45346. t['Ecaron'] = 667;
  45347. t['Iogonek'] = 278;
  45348. t['kcommaaccent'] = 556;
  45349. t['minus'] = 584;
  45350. t['Icircumflex'] = 278;
  45351. t['ncaron'] = 611;
  45352. t['tcommaaccent'] = 333;
  45353. t['logicalnot'] = 584;
  45354. t['odieresis'] = 611;
  45355. t['udieresis'] = 611;
  45356. t['notequal'] = 549;
  45357. t['gcommaaccent'] = 611;
  45358. t['eth'] = 611;
  45359. t['zcaron'] = 500;
  45360. t['ncommaaccent'] = 611;
  45361. t['onesuperior'] = 333;
  45362. t['imacron'] = 278;
  45363. t['Euro'] = 556;
  45364. });
  45365. t['Helvetica-BoldOblique'] = getLookupTableFactory(function (t) {
  45366. t['space'] = 278;
  45367. t['exclam'] = 333;
  45368. t['quotedbl'] = 474;
  45369. t['numbersign'] = 556;
  45370. t['dollar'] = 556;
  45371. t['percent'] = 889;
  45372. t['ampersand'] = 722;
  45373. t['quoteright'] = 278;
  45374. t['parenleft'] = 333;
  45375. t['parenright'] = 333;
  45376. t['asterisk'] = 389;
  45377. t['plus'] = 584;
  45378. t['comma'] = 278;
  45379. t['hyphen'] = 333;
  45380. t['period'] = 278;
  45381. t['slash'] = 278;
  45382. t['zero'] = 556;
  45383. t['one'] = 556;
  45384. t['two'] = 556;
  45385. t['three'] = 556;
  45386. t['four'] = 556;
  45387. t['five'] = 556;
  45388. t['six'] = 556;
  45389. t['seven'] = 556;
  45390. t['eight'] = 556;
  45391. t['nine'] = 556;
  45392. t['colon'] = 333;
  45393. t['semicolon'] = 333;
  45394. t['less'] = 584;
  45395. t['equal'] = 584;
  45396. t['greater'] = 584;
  45397. t['question'] = 611;
  45398. t['at'] = 975;
  45399. t['A'] = 722;
  45400. t['B'] = 722;
  45401. t['C'] = 722;
  45402. t['D'] = 722;
  45403. t['E'] = 667;
  45404. t['F'] = 611;
  45405. t['G'] = 778;
  45406. t['H'] = 722;
  45407. t['I'] = 278;
  45408. t['J'] = 556;
  45409. t['K'] = 722;
  45410. t['L'] = 611;
  45411. t['M'] = 833;
  45412. t['N'] = 722;
  45413. t['O'] = 778;
  45414. t['P'] = 667;
  45415. t['Q'] = 778;
  45416. t['R'] = 722;
  45417. t['S'] = 667;
  45418. t['T'] = 611;
  45419. t['U'] = 722;
  45420. t['V'] = 667;
  45421. t['W'] = 944;
  45422. t['X'] = 667;
  45423. t['Y'] = 667;
  45424. t['Z'] = 611;
  45425. t['bracketleft'] = 333;
  45426. t['backslash'] = 278;
  45427. t['bracketright'] = 333;
  45428. t['asciicircum'] = 584;
  45429. t['underscore'] = 556;
  45430. t['quoteleft'] = 278;
  45431. t['a'] = 556;
  45432. t['b'] = 611;
  45433. t['c'] = 556;
  45434. t['d'] = 611;
  45435. t['e'] = 556;
  45436. t['f'] = 333;
  45437. t['g'] = 611;
  45438. t['h'] = 611;
  45439. t['i'] = 278;
  45440. t['j'] = 278;
  45441. t['k'] = 556;
  45442. t['l'] = 278;
  45443. t['m'] = 889;
  45444. t['n'] = 611;
  45445. t['o'] = 611;
  45446. t['p'] = 611;
  45447. t['q'] = 611;
  45448. t['r'] = 389;
  45449. t['s'] = 556;
  45450. t['t'] = 333;
  45451. t['u'] = 611;
  45452. t['v'] = 556;
  45453. t['w'] = 778;
  45454. t['x'] = 556;
  45455. t['y'] = 556;
  45456. t['z'] = 500;
  45457. t['braceleft'] = 389;
  45458. t['bar'] = 280;
  45459. t['braceright'] = 389;
  45460. t['asciitilde'] = 584;
  45461. t['exclamdown'] = 333;
  45462. t['cent'] = 556;
  45463. t['sterling'] = 556;
  45464. t['fraction'] = 167;
  45465. t['yen'] = 556;
  45466. t['florin'] = 556;
  45467. t['section'] = 556;
  45468. t['currency'] = 556;
  45469. t['quotesingle'] = 238;
  45470. t['quotedblleft'] = 500;
  45471. t['guillemotleft'] = 556;
  45472. t['guilsinglleft'] = 333;
  45473. t['guilsinglright'] = 333;
  45474. t['fi'] = 611;
  45475. t['fl'] = 611;
  45476. t['endash'] = 556;
  45477. t['dagger'] = 556;
  45478. t['daggerdbl'] = 556;
  45479. t['periodcentered'] = 278;
  45480. t['paragraph'] = 556;
  45481. t['bullet'] = 350;
  45482. t['quotesinglbase'] = 278;
  45483. t['quotedblbase'] = 500;
  45484. t['quotedblright'] = 500;
  45485. t['guillemotright'] = 556;
  45486. t['ellipsis'] = 1000;
  45487. t['perthousand'] = 1000;
  45488. t['questiondown'] = 611;
  45489. t['grave'] = 333;
  45490. t['acute'] = 333;
  45491. t['circumflex'] = 333;
  45492. t['tilde'] = 333;
  45493. t['macron'] = 333;
  45494. t['breve'] = 333;
  45495. t['dotaccent'] = 333;
  45496. t['dieresis'] = 333;
  45497. t['ring'] = 333;
  45498. t['cedilla'] = 333;
  45499. t['hungarumlaut'] = 333;
  45500. t['ogonek'] = 333;
  45501. t['caron'] = 333;
  45502. t['emdash'] = 1000;
  45503. t['AE'] = 1000;
  45504. t['ordfeminine'] = 370;
  45505. t['Lslash'] = 611;
  45506. t['Oslash'] = 778;
  45507. t['OE'] = 1000;
  45508. t['ordmasculine'] = 365;
  45509. t['ae'] = 889;
  45510. t['dotlessi'] = 278;
  45511. t['lslash'] = 278;
  45512. t['oslash'] = 611;
  45513. t['oe'] = 944;
  45514. t['germandbls'] = 611;
  45515. t['Idieresis'] = 278;
  45516. t['eacute'] = 556;
  45517. t['abreve'] = 556;
  45518. t['uhungarumlaut'] = 611;
  45519. t['ecaron'] = 556;
  45520. t['Ydieresis'] = 667;
  45521. t['divide'] = 584;
  45522. t['Yacute'] = 667;
  45523. t['Acircumflex'] = 722;
  45524. t['aacute'] = 556;
  45525. t['Ucircumflex'] = 722;
  45526. t['yacute'] = 556;
  45527. t['scommaaccent'] = 556;
  45528. t['ecircumflex'] = 556;
  45529. t['Uring'] = 722;
  45530. t['Udieresis'] = 722;
  45531. t['aogonek'] = 556;
  45532. t['Uacute'] = 722;
  45533. t['uogonek'] = 611;
  45534. t['Edieresis'] = 667;
  45535. t['Dcroat'] = 722;
  45536. t['commaaccent'] = 250;
  45537. t['copyright'] = 737;
  45538. t['Emacron'] = 667;
  45539. t['ccaron'] = 556;
  45540. t['aring'] = 556;
  45541. t['Ncommaaccent'] = 722;
  45542. t['lacute'] = 278;
  45543. t['agrave'] = 556;
  45544. t['Tcommaaccent'] = 611;
  45545. t['Cacute'] = 722;
  45546. t['atilde'] = 556;
  45547. t['Edotaccent'] = 667;
  45548. t['scaron'] = 556;
  45549. t['scedilla'] = 556;
  45550. t['iacute'] = 278;
  45551. t['lozenge'] = 494;
  45552. t['Rcaron'] = 722;
  45553. t['Gcommaaccent'] = 778;
  45554. t['ucircumflex'] = 611;
  45555. t['acircumflex'] = 556;
  45556. t['Amacron'] = 722;
  45557. t['rcaron'] = 389;
  45558. t['ccedilla'] = 556;
  45559. t['Zdotaccent'] = 611;
  45560. t['Thorn'] = 667;
  45561. t['Omacron'] = 778;
  45562. t['Racute'] = 722;
  45563. t['Sacute'] = 667;
  45564. t['dcaron'] = 743;
  45565. t['Umacron'] = 722;
  45566. t['uring'] = 611;
  45567. t['threesuperior'] = 333;
  45568. t['Ograve'] = 778;
  45569. t['Agrave'] = 722;
  45570. t['Abreve'] = 722;
  45571. t['multiply'] = 584;
  45572. t['uacute'] = 611;
  45573. t['Tcaron'] = 611;
  45574. t['partialdiff'] = 494;
  45575. t['ydieresis'] = 556;
  45576. t['Nacute'] = 722;
  45577. t['icircumflex'] = 278;
  45578. t['Ecircumflex'] = 667;
  45579. t['adieresis'] = 556;
  45580. t['edieresis'] = 556;
  45581. t['cacute'] = 556;
  45582. t['nacute'] = 611;
  45583. t['umacron'] = 611;
  45584. t['Ncaron'] = 722;
  45585. t['Iacute'] = 278;
  45586. t['plusminus'] = 584;
  45587. t['brokenbar'] = 280;
  45588. t['registered'] = 737;
  45589. t['Gbreve'] = 778;
  45590. t['Idotaccent'] = 278;
  45591. t['summation'] = 600;
  45592. t['Egrave'] = 667;
  45593. t['racute'] = 389;
  45594. t['omacron'] = 611;
  45595. t['Zacute'] = 611;
  45596. t['Zcaron'] = 611;
  45597. t['greaterequal'] = 549;
  45598. t['Eth'] = 722;
  45599. t['Ccedilla'] = 722;
  45600. t['lcommaaccent'] = 278;
  45601. t['tcaron'] = 389;
  45602. t['eogonek'] = 556;
  45603. t['Uogonek'] = 722;
  45604. t['Aacute'] = 722;
  45605. t['Adieresis'] = 722;
  45606. t['egrave'] = 556;
  45607. t['zacute'] = 500;
  45608. t['iogonek'] = 278;
  45609. t['Oacute'] = 778;
  45610. t['oacute'] = 611;
  45611. t['amacron'] = 556;
  45612. t['sacute'] = 556;
  45613. t['idieresis'] = 278;
  45614. t['Ocircumflex'] = 778;
  45615. t['Ugrave'] = 722;
  45616. t['Delta'] = 612;
  45617. t['thorn'] = 611;
  45618. t['twosuperior'] = 333;
  45619. t['Odieresis'] = 778;
  45620. t['mu'] = 611;
  45621. t['igrave'] = 278;
  45622. t['ohungarumlaut'] = 611;
  45623. t['Eogonek'] = 667;
  45624. t['dcroat'] = 611;
  45625. t['threequarters'] = 834;
  45626. t['Scedilla'] = 667;
  45627. t['lcaron'] = 400;
  45628. t['Kcommaaccent'] = 722;
  45629. t['Lacute'] = 611;
  45630. t['trademark'] = 1000;
  45631. t['edotaccent'] = 556;
  45632. t['Igrave'] = 278;
  45633. t['Imacron'] = 278;
  45634. t['Lcaron'] = 611;
  45635. t['onehalf'] = 834;
  45636. t['lessequal'] = 549;
  45637. t['ocircumflex'] = 611;
  45638. t['ntilde'] = 611;
  45639. t['Uhungarumlaut'] = 722;
  45640. t['Eacute'] = 667;
  45641. t['emacron'] = 556;
  45642. t['gbreve'] = 611;
  45643. t['onequarter'] = 834;
  45644. t['Scaron'] = 667;
  45645. t['Scommaaccent'] = 667;
  45646. t['Ohungarumlaut'] = 778;
  45647. t['degree'] = 400;
  45648. t['ograve'] = 611;
  45649. t['Ccaron'] = 722;
  45650. t['ugrave'] = 611;
  45651. t['radical'] = 549;
  45652. t['Dcaron'] = 722;
  45653. t['rcommaaccent'] = 389;
  45654. t['Ntilde'] = 722;
  45655. t['otilde'] = 611;
  45656. t['Rcommaaccent'] = 722;
  45657. t['Lcommaaccent'] = 611;
  45658. t['Atilde'] = 722;
  45659. t['Aogonek'] = 722;
  45660. t['Aring'] = 722;
  45661. t['Otilde'] = 778;
  45662. t['zdotaccent'] = 500;
  45663. t['Ecaron'] = 667;
  45664. t['Iogonek'] = 278;
  45665. t['kcommaaccent'] = 556;
  45666. t['minus'] = 584;
  45667. t['Icircumflex'] = 278;
  45668. t['ncaron'] = 611;
  45669. t['tcommaaccent'] = 333;
  45670. t['logicalnot'] = 584;
  45671. t['odieresis'] = 611;
  45672. t['udieresis'] = 611;
  45673. t['notequal'] = 549;
  45674. t['gcommaaccent'] = 611;
  45675. t['eth'] = 611;
  45676. t['zcaron'] = 500;
  45677. t['ncommaaccent'] = 611;
  45678. t['onesuperior'] = 333;
  45679. t['imacron'] = 278;
  45680. t['Euro'] = 556;
  45681. });
  45682. t['Helvetica-Oblique'] = getLookupTableFactory(function (t) {
  45683. t['space'] = 278;
  45684. t['exclam'] = 278;
  45685. t['quotedbl'] = 355;
  45686. t['numbersign'] = 556;
  45687. t['dollar'] = 556;
  45688. t['percent'] = 889;
  45689. t['ampersand'] = 667;
  45690. t['quoteright'] = 222;
  45691. t['parenleft'] = 333;
  45692. t['parenright'] = 333;
  45693. t['asterisk'] = 389;
  45694. t['plus'] = 584;
  45695. t['comma'] = 278;
  45696. t['hyphen'] = 333;
  45697. t['period'] = 278;
  45698. t['slash'] = 278;
  45699. t['zero'] = 556;
  45700. t['one'] = 556;
  45701. t['two'] = 556;
  45702. t['three'] = 556;
  45703. t['four'] = 556;
  45704. t['five'] = 556;
  45705. t['six'] = 556;
  45706. t['seven'] = 556;
  45707. t['eight'] = 556;
  45708. t['nine'] = 556;
  45709. t['colon'] = 278;
  45710. t['semicolon'] = 278;
  45711. t['less'] = 584;
  45712. t['equal'] = 584;
  45713. t['greater'] = 584;
  45714. t['question'] = 556;
  45715. t['at'] = 1015;
  45716. t['A'] = 667;
  45717. t['B'] = 667;
  45718. t['C'] = 722;
  45719. t['D'] = 722;
  45720. t['E'] = 667;
  45721. t['F'] = 611;
  45722. t['G'] = 778;
  45723. t['H'] = 722;
  45724. t['I'] = 278;
  45725. t['J'] = 500;
  45726. t['K'] = 667;
  45727. t['L'] = 556;
  45728. t['M'] = 833;
  45729. t['N'] = 722;
  45730. t['O'] = 778;
  45731. t['P'] = 667;
  45732. t['Q'] = 778;
  45733. t['R'] = 722;
  45734. t['S'] = 667;
  45735. t['T'] = 611;
  45736. t['U'] = 722;
  45737. t['V'] = 667;
  45738. t['W'] = 944;
  45739. t['X'] = 667;
  45740. t['Y'] = 667;
  45741. t['Z'] = 611;
  45742. t['bracketleft'] = 278;
  45743. t['backslash'] = 278;
  45744. t['bracketright'] = 278;
  45745. t['asciicircum'] = 469;
  45746. t['underscore'] = 556;
  45747. t['quoteleft'] = 222;
  45748. t['a'] = 556;
  45749. t['b'] = 556;
  45750. t['c'] = 500;
  45751. t['d'] = 556;
  45752. t['e'] = 556;
  45753. t['f'] = 278;
  45754. t['g'] = 556;
  45755. t['h'] = 556;
  45756. t['i'] = 222;
  45757. t['j'] = 222;
  45758. t['k'] = 500;
  45759. t['l'] = 222;
  45760. t['m'] = 833;
  45761. t['n'] = 556;
  45762. t['o'] = 556;
  45763. t['p'] = 556;
  45764. t['q'] = 556;
  45765. t['r'] = 333;
  45766. t['s'] = 500;
  45767. t['t'] = 278;
  45768. t['u'] = 556;
  45769. t['v'] = 500;
  45770. t['w'] = 722;
  45771. t['x'] = 500;
  45772. t['y'] = 500;
  45773. t['z'] = 500;
  45774. t['braceleft'] = 334;
  45775. t['bar'] = 260;
  45776. t['braceright'] = 334;
  45777. t['asciitilde'] = 584;
  45778. t['exclamdown'] = 333;
  45779. t['cent'] = 556;
  45780. t['sterling'] = 556;
  45781. t['fraction'] = 167;
  45782. t['yen'] = 556;
  45783. t['florin'] = 556;
  45784. t['section'] = 556;
  45785. t['currency'] = 556;
  45786. t['quotesingle'] = 191;
  45787. t['quotedblleft'] = 333;
  45788. t['guillemotleft'] = 556;
  45789. t['guilsinglleft'] = 333;
  45790. t['guilsinglright'] = 333;
  45791. t['fi'] = 500;
  45792. t['fl'] = 500;
  45793. t['endash'] = 556;
  45794. t['dagger'] = 556;
  45795. t['daggerdbl'] = 556;
  45796. t['periodcentered'] = 278;
  45797. t['paragraph'] = 537;
  45798. t['bullet'] = 350;
  45799. t['quotesinglbase'] = 222;
  45800. t['quotedblbase'] = 333;
  45801. t['quotedblright'] = 333;
  45802. t['guillemotright'] = 556;
  45803. t['ellipsis'] = 1000;
  45804. t['perthousand'] = 1000;
  45805. t['questiondown'] = 611;
  45806. t['grave'] = 333;
  45807. t['acute'] = 333;
  45808. t['circumflex'] = 333;
  45809. t['tilde'] = 333;
  45810. t['macron'] = 333;
  45811. t['breve'] = 333;
  45812. t['dotaccent'] = 333;
  45813. t['dieresis'] = 333;
  45814. t['ring'] = 333;
  45815. t['cedilla'] = 333;
  45816. t['hungarumlaut'] = 333;
  45817. t['ogonek'] = 333;
  45818. t['caron'] = 333;
  45819. t['emdash'] = 1000;
  45820. t['AE'] = 1000;
  45821. t['ordfeminine'] = 370;
  45822. t['Lslash'] = 556;
  45823. t['Oslash'] = 778;
  45824. t['OE'] = 1000;
  45825. t['ordmasculine'] = 365;
  45826. t['ae'] = 889;
  45827. t['dotlessi'] = 278;
  45828. t['lslash'] = 222;
  45829. t['oslash'] = 611;
  45830. t['oe'] = 944;
  45831. t['germandbls'] = 611;
  45832. t['Idieresis'] = 278;
  45833. t['eacute'] = 556;
  45834. t['abreve'] = 556;
  45835. t['uhungarumlaut'] = 556;
  45836. t['ecaron'] = 556;
  45837. t['Ydieresis'] = 667;
  45838. t['divide'] = 584;
  45839. t['Yacute'] = 667;
  45840. t['Acircumflex'] = 667;
  45841. t['aacute'] = 556;
  45842. t['Ucircumflex'] = 722;
  45843. t['yacute'] = 500;
  45844. t['scommaaccent'] = 500;
  45845. t['ecircumflex'] = 556;
  45846. t['Uring'] = 722;
  45847. t['Udieresis'] = 722;
  45848. t['aogonek'] = 556;
  45849. t['Uacute'] = 722;
  45850. t['uogonek'] = 556;
  45851. t['Edieresis'] = 667;
  45852. t['Dcroat'] = 722;
  45853. t['commaaccent'] = 250;
  45854. t['copyright'] = 737;
  45855. t['Emacron'] = 667;
  45856. t['ccaron'] = 500;
  45857. t['aring'] = 556;
  45858. t['Ncommaaccent'] = 722;
  45859. t['lacute'] = 222;
  45860. t['agrave'] = 556;
  45861. t['Tcommaaccent'] = 611;
  45862. t['Cacute'] = 722;
  45863. t['atilde'] = 556;
  45864. t['Edotaccent'] = 667;
  45865. t['scaron'] = 500;
  45866. t['scedilla'] = 500;
  45867. t['iacute'] = 278;
  45868. t['lozenge'] = 471;
  45869. t['Rcaron'] = 722;
  45870. t['Gcommaaccent'] = 778;
  45871. t['ucircumflex'] = 556;
  45872. t['acircumflex'] = 556;
  45873. t['Amacron'] = 667;
  45874. t['rcaron'] = 333;
  45875. t['ccedilla'] = 500;
  45876. t['Zdotaccent'] = 611;
  45877. t['Thorn'] = 667;
  45878. t['Omacron'] = 778;
  45879. t['Racute'] = 722;
  45880. t['Sacute'] = 667;
  45881. t['dcaron'] = 643;
  45882. t['Umacron'] = 722;
  45883. t['uring'] = 556;
  45884. t['threesuperior'] = 333;
  45885. t['Ograve'] = 778;
  45886. t['Agrave'] = 667;
  45887. t['Abreve'] = 667;
  45888. t['multiply'] = 584;
  45889. t['uacute'] = 556;
  45890. t['Tcaron'] = 611;
  45891. t['partialdiff'] = 476;
  45892. t['ydieresis'] = 500;
  45893. t['Nacute'] = 722;
  45894. t['icircumflex'] = 278;
  45895. t['Ecircumflex'] = 667;
  45896. t['adieresis'] = 556;
  45897. t['edieresis'] = 556;
  45898. t['cacute'] = 500;
  45899. t['nacute'] = 556;
  45900. t['umacron'] = 556;
  45901. t['Ncaron'] = 722;
  45902. t['Iacute'] = 278;
  45903. t['plusminus'] = 584;
  45904. t['brokenbar'] = 260;
  45905. t['registered'] = 737;
  45906. t['Gbreve'] = 778;
  45907. t['Idotaccent'] = 278;
  45908. t['summation'] = 600;
  45909. t['Egrave'] = 667;
  45910. t['racute'] = 333;
  45911. t['omacron'] = 556;
  45912. t['Zacute'] = 611;
  45913. t['Zcaron'] = 611;
  45914. t['greaterequal'] = 549;
  45915. t['Eth'] = 722;
  45916. t['Ccedilla'] = 722;
  45917. t['lcommaaccent'] = 222;
  45918. t['tcaron'] = 317;
  45919. t['eogonek'] = 556;
  45920. t['Uogonek'] = 722;
  45921. t['Aacute'] = 667;
  45922. t['Adieresis'] = 667;
  45923. t['egrave'] = 556;
  45924. t['zacute'] = 500;
  45925. t['iogonek'] = 222;
  45926. t['Oacute'] = 778;
  45927. t['oacute'] = 556;
  45928. t['amacron'] = 556;
  45929. t['sacute'] = 500;
  45930. t['idieresis'] = 278;
  45931. t['Ocircumflex'] = 778;
  45932. t['Ugrave'] = 722;
  45933. t['Delta'] = 612;
  45934. t['thorn'] = 556;
  45935. t['twosuperior'] = 333;
  45936. t['Odieresis'] = 778;
  45937. t['mu'] = 556;
  45938. t['igrave'] = 278;
  45939. t['ohungarumlaut'] = 556;
  45940. t['Eogonek'] = 667;
  45941. t['dcroat'] = 556;
  45942. t['threequarters'] = 834;
  45943. t['Scedilla'] = 667;
  45944. t['lcaron'] = 299;
  45945. t['Kcommaaccent'] = 667;
  45946. t['Lacute'] = 556;
  45947. t['trademark'] = 1000;
  45948. t['edotaccent'] = 556;
  45949. t['Igrave'] = 278;
  45950. t['Imacron'] = 278;
  45951. t['Lcaron'] = 556;
  45952. t['onehalf'] = 834;
  45953. t['lessequal'] = 549;
  45954. t['ocircumflex'] = 556;
  45955. t['ntilde'] = 556;
  45956. t['Uhungarumlaut'] = 722;
  45957. t['Eacute'] = 667;
  45958. t['emacron'] = 556;
  45959. t['gbreve'] = 556;
  45960. t['onequarter'] = 834;
  45961. t['Scaron'] = 667;
  45962. t['Scommaaccent'] = 667;
  45963. t['Ohungarumlaut'] = 778;
  45964. t['degree'] = 400;
  45965. t['ograve'] = 556;
  45966. t['Ccaron'] = 722;
  45967. t['ugrave'] = 556;
  45968. t['radical'] = 453;
  45969. t['Dcaron'] = 722;
  45970. t['rcommaaccent'] = 333;
  45971. t['Ntilde'] = 722;
  45972. t['otilde'] = 556;
  45973. t['Rcommaaccent'] = 722;
  45974. t['Lcommaaccent'] = 556;
  45975. t['Atilde'] = 667;
  45976. t['Aogonek'] = 667;
  45977. t['Aring'] = 667;
  45978. t['Otilde'] = 778;
  45979. t['zdotaccent'] = 500;
  45980. t['Ecaron'] = 667;
  45981. t['Iogonek'] = 278;
  45982. t['kcommaaccent'] = 500;
  45983. t['minus'] = 584;
  45984. t['Icircumflex'] = 278;
  45985. t['ncaron'] = 556;
  45986. t['tcommaaccent'] = 278;
  45987. t['logicalnot'] = 584;
  45988. t['odieresis'] = 556;
  45989. t['udieresis'] = 556;
  45990. t['notequal'] = 549;
  45991. t['gcommaaccent'] = 556;
  45992. t['eth'] = 556;
  45993. t['zcaron'] = 500;
  45994. t['ncommaaccent'] = 556;
  45995. t['onesuperior'] = 333;
  45996. t['imacron'] = 278;
  45997. t['Euro'] = 556;
  45998. });
  45999. t['Symbol'] = getLookupTableFactory(function (t) {
  46000. t['space'] = 250;
  46001. t['exclam'] = 333;
  46002. t['universal'] = 713;
  46003. t['numbersign'] = 500;
  46004. t['existential'] = 549;
  46005. t['percent'] = 833;
  46006. t['ampersand'] = 778;
  46007. t['suchthat'] = 439;
  46008. t['parenleft'] = 333;
  46009. t['parenright'] = 333;
  46010. t['asteriskmath'] = 500;
  46011. t['plus'] = 549;
  46012. t['comma'] = 250;
  46013. t['minus'] = 549;
  46014. t['period'] = 250;
  46015. t['slash'] = 278;
  46016. t['zero'] = 500;
  46017. t['one'] = 500;
  46018. t['two'] = 500;
  46019. t['three'] = 500;
  46020. t['four'] = 500;
  46021. t['five'] = 500;
  46022. t['six'] = 500;
  46023. t['seven'] = 500;
  46024. t['eight'] = 500;
  46025. t['nine'] = 500;
  46026. t['colon'] = 278;
  46027. t['semicolon'] = 278;
  46028. t['less'] = 549;
  46029. t['equal'] = 549;
  46030. t['greater'] = 549;
  46031. t['question'] = 444;
  46032. t['congruent'] = 549;
  46033. t['Alpha'] = 722;
  46034. t['Beta'] = 667;
  46035. t['Chi'] = 722;
  46036. t['Delta'] = 612;
  46037. t['Epsilon'] = 611;
  46038. t['Phi'] = 763;
  46039. t['Gamma'] = 603;
  46040. t['Eta'] = 722;
  46041. t['Iota'] = 333;
  46042. t['theta1'] = 631;
  46043. t['Kappa'] = 722;
  46044. t['Lambda'] = 686;
  46045. t['Mu'] = 889;
  46046. t['Nu'] = 722;
  46047. t['Omicron'] = 722;
  46048. t['Pi'] = 768;
  46049. t['Theta'] = 741;
  46050. t['Rho'] = 556;
  46051. t['Sigma'] = 592;
  46052. t['Tau'] = 611;
  46053. t['Upsilon'] = 690;
  46054. t['sigma1'] = 439;
  46055. t['Omega'] = 768;
  46056. t['Xi'] = 645;
  46057. t['Psi'] = 795;
  46058. t['Zeta'] = 611;
  46059. t['bracketleft'] = 333;
  46060. t['therefore'] = 863;
  46061. t['bracketright'] = 333;
  46062. t['perpendicular'] = 658;
  46063. t['underscore'] = 500;
  46064. t['radicalex'] = 500;
  46065. t['alpha'] = 631;
  46066. t['beta'] = 549;
  46067. t['chi'] = 549;
  46068. t['delta'] = 494;
  46069. t['epsilon'] = 439;
  46070. t['phi'] = 521;
  46071. t['gamma'] = 411;
  46072. t['eta'] = 603;
  46073. t['iota'] = 329;
  46074. t['phi1'] = 603;
  46075. t['kappa'] = 549;
  46076. t['lambda'] = 549;
  46077. t['mu'] = 576;
  46078. t['nu'] = 521;
  46079. t['omicron'] = 549;
  46080. t['pi'] = 549;
  46081. t['theta'] = 521;
  46082. t['rho'] = 549;
  46083. t['sigma'] = 603;
  46084. t['tau'] = 439;
  46085. t['upsilon'] = 576;
  46086. t['omega1'] = 713;
  46087. t['omega'] = 686;
  46088. t['xi'] = 493;
  46089. t['psi'] = 686;
  46090. t['zeta'] = 494;
  46091. t['braceleft'] = 480;
  46092. t['bar'] = 200;
  46093. t['braceright'] = 480;
  46094. t['similar'] = 549;
  46095. t['Euro'] = 750;
  46096. t['Upsilon1'] = 620;
  46097. t['minute'] = 247;
  46098. t['lessequal'] = 549;
  46099. t['fraction'] = 167;
  46100. t['infinity'] = 713;
  46101. t['florin'] = 500;
  46102. t['club'] = 753;
  46103. t['diamond'] = 753;
  46104. t['heart'] = 753;
  46105. t['spade'] = 753;
  46106. t['arrowboth'] = 1042;
  46107. t['arrowleft'] = 987;
  46108. t['arrowup'] = 603;
  46109. t['arrowright'] = 987;
  46110. t['arrowdown'] = 603;
  46111. t['degree'] = 400;
  46112. t['plusminus'] = 549;
  46113. t['second'] = 411;
  46114. t['greaterequal'] = 549;
  46115. t['multiply'] = 549;
  46116. t['proportional'] = 713;
  46117. t['partialdiff'] = 494;
  46118. t['bullet'] = 460;
  46119. t['divide'] = 549;
  46120. t['notequal'] = 549;
  46121. t['equivalence'] = 549;
  46122. t['approxequal'] = 549;
  46123. t['ellipsis'] = 1000;
  46124. t['arrowvertex'] = 603;
  46125. t['arrowhorizex'] = 1000;
  46126. t['carriagereturn'] = 658;
  46127. t['aleph'] = 823;
  46128. t['Ifraktur'] = 686;
  46129. t['Rfraktur'] = 795;
  46130. t['weierstrass'] = 987;
  46131. t['circlemultiply'] = 768;
  46132. t['circleplus'] = 768;
  46133. t['emptyset'] = 823;
  46134. t['intersection'] = 768;
  46135. t['union'] = 768;
  46136. t['propersuperset'] = 713;
  46137. t['reflexsuperset'] = 713;
  46138. t['notsubset'] = 713;
  46139. t['propersubset'] = 713;
  46140. t['reflexsubset'] = 713;
  46141. t['element'] = 713;
  46142. t['notelement'] = 713;
  46143. t['angle'] = 768;
  46144. t['gradient'] = 713;
  46145. t['registerserif'] = 790;
  46146. t['copyrightserif'] = 790;
  46147. t['trademarkserif'] = 890;
  46148. t['product'] = 823;
  46149. t['radical'] = 549;
  46150. t['dotmath'] = 250;
  46151. t['logicalnot'] = 713;
  46152. t['logicaland'] = 603;
  46153. t['logicalor'] = 603;
  46154. t['arrowdblboth'] = 1042;
  46155. t['arrowdblleft'] = 987;
  46156. t['arrowdblup'] = 603;
  46157. t['arrowdblright'] = 987;
  46158. t['arrowdbldown'] = 603;
  46159. t['lozenge'] = 494;
  46160. t['angleleft'] = 329;
  46161. t['registersans'] = 790;
  46162. t['copyrightsans'] = 790;
  46163. t['trademarksans'] = 786;
  46164. t['summation'] = 713;
  46165. t['parenlefttp'] = 384;
  46166. t['parenleftex'] = 384;
  46167. t['parenleftbt'] = 384;
  46168. t['bracketlefttp'] = 384;
  46169. t['bracketleftex'] = 384;
  46170. t['bracketleftbt'] = 384;
  46171. t['bracelefttp'] = 494;
  46172. t['braceleftmid'] = 494;
  46173. t['braceleftbt'] = 494;
  46174. t['braceex'] = 494;
  46175. t['angleright'] = 329;
  46176. t['integral'] = 274;
  46177. t['integraltp'] = 686;
  46178. t['integralex'] = 686;
  46179. t['integralbt'] = 686;
  46180. t['parenrighttp'] = 384;
  46181. t['parenrightex'] = 384;
  46182. t['parenrightbt'] = 384;
  46183. t['bracketrighttp'] = 384;
  46184. t['bracketrightex'] = 384;
  46185. t['bracketrightbt'] = 384;
  46186. t['bracerighttp'] = 494;
  46187. t['bracerightmid'] = 494;
  46188. t['bracerightbt'] = 494;
  46189. t['apple'] = 790;
  46190. });
  46191. t['Times-Roman'] = getLookupTableFactory(function (t) {
  46192. t['space'] = 250;
  46193. t['exclam'] = 333;
  46194. t['quotedbl'] = 408;
  46195. t['numbersign'] = 500;
  46196. t['dollar'] = 500;
  46197. t['percent'] = 833;
  46198. t['ampersand'] = 778;
  46199. t['quoteright'] = 333;
  46200. t['parenleft'] = 333;
  46201. t['parenright'] = 333;
  46202. t['asterisk'] = 500;
  46203. t['plus'] = 564;
  46204. t['comma'] = 250;
  46205. t['hyphen'] = 333;
  46206. t['period'] = 250;
  46207. t['slash'] = 278;
  46208. t['zero'] = 500;
  46209. t['one'] = 500;
  46210. t['two'] = 500;
  46211. t['three'] = 500;
  46212. t['four'] = 500;
  46213. t['five'] = 500;
  46214. t['six'] = 500;
  46215. t['seven'] = 500;
  46216. t['eight'] = 500;
  46217. t['nine'] = 500;
  46218. t['colon'] = 278;
  46219. t['semicolon'] = 278;
  46220. t['less'] = 564;
  46221. t['equal'] = 564;
  46222. t['greater'] = 564;
  46223. t['question'] = 444;
  46224. t['at'] = 921;
  46225. t['A'] = 722;
  46226. t['B'] = 667;
  46227. t['C'] = 667;
  46228. t['D'] = 722;
  46229. t['E'] = 611;
  46230. t['F'] = 556;
  46231. t['G'] = 722;
  46232. t['H'] = 722;
  46233. t['I'] = 333;
  46234. t['J'] = 389;
  46235. t['K'] = 722;
  46236. t['L'] = 611;
  46237. t['M'] = 889;
  46238. t['N'] = 722;
  46239. t['O'] = 722;
  46240. t['P'] = 556;
  46241. t['Q'] = 722;
  46242. t['R'] = 667;
  46243. t['S'] = 556;
  46244. t['T'] = 611;
  46245. t['U'] = 722;
  46246. t['V'] = 722;
  46247. t['W'] = 944;
  46248. t['X'] = 722;
  46249. t['Y'] = 722;
  46250. t['Z'] = 611;
  46251. t['bracketleft'] = 333;
  46252. t['backslash'] = 278;
  46253. t['bracketright'] = 333;
  46254. t['asciicircum'] = 469;
  46255. t['underscore'] = 500;
  46256. t['quoteleft'] = 333;
  46257. t['a'] = 444;
  46258. t['b'] = 500;
  46259. t['c'] = 444;
  46260. t['d'] = 500;
  46261. t['e'] = 444;
  46262. t['f'] = 333;
  46263. t['g'] = 500;
  46264. t['h'] = 500;
  46265. t['i'] = 278;
  46266. t['j'] = 278;
  46267. t['k'] = 500;
  46268. t['l'] = 278;
  46269. t['m'] = 778;
  46270. t['n'] = 500;
  46271. t['o'] = 500;
  46272. t['p'] = 500;
  46273. t['q'] = 500;
  46274. t['r'] = 333;
  46275. t['s'] = 389;
  46276. t['t'] = 278;
  46277. t['u'] = 500;
  46278. t['v'] = 500;
  46279. t['w'] = 722;
  46280. t['x'] = 500;
  46281. t['y'] = 500;
  46282. t['z'] = 444;
  46283. t['braceleft'] = 480;
  46284. t['bar'] = 200;
  46285. t['braceright'] = 480;
  46286. t['asciitilde'] = 541;
  46287. t['exclamdown'] = 333;
  46288. t['cent'] = 500;
  46289. t['sterling'] = 500;
  46290. t['fraction'] = 167;
  46291. t['yen'] = 500;
  46292. t['florin'] = 500;
  46293. t['section'] = 500;
  46294. t['currency'] = 500;
  46295. t['quotesingle'] = 180;
  46296. t['quotedblleft'] = 444;
  46297. t['guillemotleft'] = 500;
  46298. t['guilsinglleft'] = 333;
  46299. t['guilsinglright'] = 333;
  46300. t['fi'] = 556;
  46301. t['fl'] = 556;
  46302. t['endash'] = 500;
  46303. t['dagger'] = 500;
  46304. t['daggerdbl'] = 500;
  46305. t['periodcentered'] = 250;
  46306. t['paragraph'] = 453;
  46307. t['bullet'] = 350;
  46308. t['quotesinglbase'] = 333;
  46309. t['quotedblbase'] = 444;
  46310. t['quotedblright'] = 444;
  46311. t['guillemotright'] = 500;
  46312. t['ellipsis'] = 1000;
  46313. t['perthousand'] = 1000;
  46314. t['questiondown'] = 444;
  46315. t['grave'] = 333;
  46316. t['acute'] = 333;
  46317. t['circumflex'] = 333;
  46318. t['tilde'] = 333;
  46319. t['macron'] = 333;
  46320. t['breve'] = 333;
  46321. t['dotaccent'] = 333;
  46322. t['dieresis'] = 333;
  46323. t['ring'] = 333;
  46324. t['cedilla'] = 333;
  46325. t['hungarumlaut'] = 333;
  46326. t['ogonek'] = 333;
  46327. t['caron'] = 333;
  46328. t['emdash'] = 1000;
  46329. t['AE'] = 889;
  46330. t['ordfeminine'] = 276;
  46331. t['Lslash'] = 611;
  46332. t['Oslash'] = 722;
  46333. t['OE'] = 889;
  46334. t['ordmasculine'] = 310;
  46335. t['ae'] = 667;
  46336. t['dotlessi'] = 278;
  46337. t['lslash'] = 278;
  46338. t['oslash'] = 500;
  46339. t['oe'] = 722;
  46340. t['germandbls'] = 500;
  46341. t['Idieresis'] = 333;
  46342. t['eacute'] = 444;
  46343. t['abreve'] = 444;
  46344. t['uhungarumlaut'] = 500;
  46345. t['ecaron'] = 444;
  46346. t['Ydieresis'] = 722;
  46347. t['divide'] = 564;
  46348. t['Yacute'] = 722;
  46349. t['Acircumflex'] = 722;
  46350. t['aacute'] = 444;
  46351. t['Ucircumflex'] = 722;
  46352. t['yacute'] = 500;
  46353. t['scommaaccent'] = 389;
  46354. t['ecircumflex'] = 444;
  46355. t['Uring'] = 722;
  46356. t['Udieresis'] = 722;
  46357. t['aogonek'] = 444;
  46358. t['Uacute'] = 722;
  46359. t['uogonek'] = 500;
  46360. t['Edieresis'] = 611;
  46361. t['Dcroat'] = 722;
  46362. t['commaaccent'] = 250;
  46363. t['copyright'] = 760;
  46364. t['Emacron'] = 611;
  46365. t['ccaron'] = 444;
  46366. t['aring'] = 444;
  46367. t['Ncommaaccent'] = 722;
  46368. t['lacute'] = 278;
  46369. t['agrave'] = 444;
  46370. t['Tcommaaccent'] = 611;
  46371. t['Cacute'] = 667;
  46372. t['atilde'] = 444;
  46373. t['Edotaccent'] = 611;
  46374. t['scaron'] = 389;
  46375. t['scedilla'] = 389;
  46376. t['iacute'] = 278;
  46377. t['lozenge'] = 471;
  46378. t['Rcaron'] = 667;
  46379. t['Gcommaaccent'] = 722;
  46380. t['ucircumflex'] = 500;
  46381. t['acircumflex'] = 444;
  46382. t['Amacron'] = 722;
  46383. t['rcaron'] = 333;
  46384. t['ccedilla'] = 444;
  46385. t['Zdotaccent'] = 611;
  46386. t['Thorn'] = 556;
  46387. t['Omacron'] = 722;
  46388. t['Racute'] = 667;
  46389. t['Sacute'] = 556;
  46390. t['dcaron'] = 588;
  46391. t['Umacron'] = 722;
  46392. t['uring'] = 500;
  46393. t['threesuperior'] = 300;
  46394. t['Ograve'] = 722;
  46395. t['Agrave'] = 722;
  46396. t['Abreve'] = 722;
  46397. t['multiply'] = 564;
  46398. t['uacute'] = 500;
  46399. t['Tcaron'] = 611;
  46400. t['partialdiff'] = 476;
  46401. t['ydieresis'] = 500;
  46402. t['Nacute'] = 722;
  46403. t['icircumflex'] = 278;
  46404. t['Ecircumflex'] = 611;
  46405. t['adieresis'] = 444;
  46406. t['edieresis'] = 444;
  46407. t['cacute'] = 444;
  46408. t['nacute'] = 500;
  46409. t['umacron'] = 500;
  46410. t['Ncaron'] = 722;
  46411. t['Iacute'] = 333;
  46412. t['plusminus'] = 564;
  46413. t['brokenbar'] = 200;
  46414. t['registered'] = 760;
  46415. t['Gbreve'] = 722;
  46416. t['Idotaccent'] = 333;
  46417. t['summation'] = 600;
  46418. t['Egrave'] = 611;
  46419. t['racute'] = 333;
  46420. t['omacron'] = 500;
  46421. t['Zacute'] = 611;
  46422. t['Zcaron'] = 611;
  46423. t['greaterequal'] = 549;
  46424. t['Eth'] = 722;
  46425. t['Ccedilla'] = 667;
  46426. t['lcommaaccent'] = 278;
  46427. t['tcaron'] = 326;
  46428. t['eogonek'] = 444;
  46429. t['Uogonek'] = 722;
  46430. t['Aacute'] = 722;
  46431. t['Adieresis'] = 722;
  46432. t['egrave'] = 444;
  46433. t['zacute'] = 444;
  46434. t['iogonek'] = 278;
  46435. t['Oacute'] = 722;
  46436. t['oacute'] = 500;
  46437. t['amacron'] = 444;
  46438. t['sacute'] = 389;
  46439. t['idieresis'] = 278;
  46440. t['Ocircumflex'] = 722;
  46441. t['Ugrave'] = 722;
  46442. t['Delta'] = 612;
  46443. t['thorn'] = 500;
  46444. t['twosuperior'] = 300;
  46445. t['Odieresis'] = 722;
  46446. t['mu'] = 500;
  46447. t['igrave'] = 278;
  46448. t['ohungarumlaut'] = 500;
  46449. t['Eogonek'] = 611;
  46450. t['dcroat'] = 500;
  46451. t['threequarters'] = 750;
  46452. t['Scedilla'] = 556;
  46453. t['lcaron'] = 344;
  46454. t['Kcommaaccent'] = 722;
  46455. t['Lacute'] = 611;
  46456. t['trademark'] = 980;
  46457. t['edotaccent'] = 444;
  46458. t['Igrave'] = 333;
  46459. t['Imacron'] = 333;
  46460. t['Lcaron'] = 611;
  46461. t['onehalf'] = 750;
  46462. t['lessequal'] = 549;
  46463. t['ocircumflex'] = 500;
  46464. t['ntilde'] = 500;
  46465. t['Uhungarumlaut'] = 722;
  46466. t['Eacute'] = 611;
  46467. t['emacron'] = 444;
  46468. t['gbreve'] = 500;
  46469. t['onequarter'] = 750;
  46470. t['Scaron'] = 556;
  46471. t['Scommaaccent'] = 556;
  46472. t['Ohungarumlaut'] = 722;
  46473. t['degree'] = 400;
  46474. t['ograve'] = 500;
  46475. t['Ccaron'] = 667;
  46476. t['ugrave'] = 500;
  46477. t['radical'] = 453;
  46478. t['Dcaron'] = 722;
  46479. t['rcommaaccent'] = 333;
  46480. t['Ntilde'] = 722;
  46481. t['otilde'] = 500;
  46482. t['Rcommaaccent'] = 667;
  46483. t['Lcommaaccent'] = 611;
  46484. t['Atilde'] = 722;
  46485. t['Aogonek'] = 722;
  46486. t['Aring'] = 722;
  46487. t['Otilde'] = 722;
  46488. t['zdotaccent'] = 444;
  46489. t['Ecaron'] = 611;
  46490. t['Iogonek'] = 333;
  46491. t['kcommaaccent'] = 500;
  46492. t['minus'] = 564;
  46493. t['Icircumflex'] = 333;
  46494. t['ncaron'] = 500;
  46495. t['tcommaaccent'] = 278;
  46496. t['logicalnot'] = 564;
  46497. t['odieresis'] = 500;
  46498. t['udieresis'] = 500;
  46499. t['notequal'] = 549;
  46500. t['gcommaaccent'] = 500;
  46501. t['eth'] = 500;
  46502. t['zcaron'] = 444;
  46503. t['ncommaaccent'] = 500;
  46504. t['onesuperior'] = 300;
  46505. t['imacron'] = 278;
  46506. t['Euro'] = 500;
  46507. });
  46508. t['Times-Bold'] = getLookupTableFactory(function (t) {
  46509. t['space'] = 250;
  46510. t['exclam'] = 333;
  46511. t['quotedbl'] = 555;
  46512. t['numbersign'] = 500;
  46513. t['dollar'] = 500;
  46514. t['percent'] = 1000;
  46515. t['ampersand'] = 833;
  46516. t['quoteright'] = 333;
  46517. t['parenleft'] = 333;
  46518. t['parenright'] = 333;
  46519. t['asterisk'] = 500;
  46520. t['plus'] = 570;
  46521. t['comma'] = 250;
  46522. t['hyphen'] = 333;
  46523. t['period'] = 250;
  46524. t['slash'] = 278;
  46525. t['zero'] = 500;
  46526. t['one'] = 500;
  46527. t['two'] = 500;
  46528. t['three'] = 500;
  46529. t['four'] = 500;
  46530. t['five'] = 500;
  46531. t['six'] = 500;
  46532. t['seven'] = 500;
  46533. t['eight'] = 500;
  46534. t['nine'] = 500;
  46535. t['colon'] = 333;
  46536. t['semicolon'] = 333;
  46537. t['less'] = 570;
  46538. t['equal'] = 570;
  46539. t['greater'] = 570;
  46540. t['question'] = 500;
  46541. t['at'] = 930;
  46542. t['A'] = 722;
  46543. t['B'] = 667;
  46544. t['C'] = 722;
  46545. t['D'] = 722;
  46546. t['E'] = 667;
  46547. t['F'] = 611;
  46548. t['G'] = 778;
  46549. t['H'] = 778;
  46550. t['I'] = 389;
  46551. t['J'] = 500;
  46552. t['K'] = 778;
  46553. t['L'] = 667;
  46554. t['M'] = 944;
  46555. t['N'] = 722;
  46556. t['O'] = 778;
  46557. t['P'] = 611;
  46558. t['Q'] = 778;
  46559. t['R'] = 722;
  46560. t['S'] = 556;
  46561. t['T'] = 667;
  46562. t['U'] = 722;
  46563. t['V'] = 722;
  46564. t['W'] = 1000;
  46565. t['X'] = 722;
  46566. t['Y'] = 722;
  46567. t['Z'] = 667;
  46568. t['bracketleft'] = 333;
  46569. t['backslash'] = 278;
  46570. t['bracketright'] = 333;
  46571. t['asciicircum'] = 581;
  46572. t['underscore'] = 500;
  46573. t['quoteleft'] = 333;
  46574. t['a'] = 500;
  46575. t['b'] = 556;
  46576. t['c'] = 444;
  46577. t['d'] = 556;
  46578. t['e'] = 444;
  46579. t['f'] = 333;
  46580. t['g'] = 500;
  46581. t['h'] = 556;
  46582. t['i'] = 278;
  46583. t['j'] = 333;
  46584. t['k'] = 556;
  46585. t['l'] = 278;
  46586. t['m'] = 833;
  46587. t['n'] = 556;
  46588. t['o'] = 500;
  46589. t['p'] = 556;
  46590. t['q'] = 556;
  46591. t['r'] = 444;
  46592. t['s'] = 389;
  46593. t['t'] = 333;
  46594. t['u'] = 556;
  46595. t['v'] = 500;
  46596. t['w'] = 722;
  46597. t['x'] = 500;
  46598. t['y'] = 500;
  46599. t['z'] = 444;
  46600. t['braceleft'] = 394;
  46601. t['bar'] = 220;
  46602. t['braceright'] = 394;
  46603. t['asciitilde'] = 520;
  46604. t['exclamdown'] = 333;
  46605. t['cent'] = 500;
  46606. t['sterling'] = 500;
  46607. t['fraction'] = 167;
  46608. t['yen'] = 500;
  46609. t['florin'] = 500;
  46610. t['section'] = 500;
  46611. t['currency'] = 500;
  46612. t['quotesingle'] = 278;
  46613. t['quotedblleft'] = 500;
  46614. t['guillemotleft'] = 500;
  46615. t['guilsinglleft'] = 333;
  46616. t['guilsinglright'] = 333;
  46617. t['fi'] = 556;
  46618. t['fl'] = 556;
  46619. t['endash'] = 500;
  46620. t['dagger'] = 500;
  46621. t['daggerdbl'] = 500;
  46622. t['periodcentered'] = 250;
  46623. t['paragraph'] = 540;
  46624. t['bullet'] = 350;
  46625. t['quotesinglbase'] = 333;
  46626. t['quotedblbase'] = 500;
  46627. t['quotedblright'] = 500;
  46628. t['guillemotright'] = 500;
  46629. t['ellipsis'] = 1000;
  46630. t['perthousand'] = 1000;
  46631. t['questiondown'] = 500;
  46632. t['grave'] = 333;
  46633. t['acute'] = 333;
  46634. t['circumflex'] = 333;
  46635. t['tilde'] = 333;
  46636. t['macron'] = 333;
  46637. t['breve'] = 333;
  46638. t['dotaccent'] = 333;
  46639. t['dieresis'] = 333;
  46640. t['ring'] = 333;
  46641. t['cedilla'] = 333;
  46642. t['hungarumlaut'] = 333;
  46643. t['ogonek'] = 333;
  46644. t['caron'] = 333;
  46645. t['emdash'] = 1000;
  46646. t['AE'] = 1000;
  46647. t['ordfeminine'] = 300;
  46648. t['Lslash'] = 667;
  46649. t['Oslash'] = 778;
  46650. t['OE'] = 1000;
  46651. t['ordmasculine'] = 330;
  46652. t['ae'] = 722;
  46653. t['dotlessi'] = 278;
  46654. t['lslash'] = 278;
  46655. t['oslash'] = 500;
  46656. t['oe'] = 722;
  46657. t['germandbls'] = 556;
  46658. t['Idieresis'] = 389;
  46659. t['eacute'] = 444;
  46660. t['abreve'] = 500;
  46661. t['uhungarumlaut'] = 556;
  46662. t['ecaron'] = 444;
  46663. t['Ydieresis'] = 722;
  46664. t['divide'] = 570;
  46665. t['Yacute'] = 722;
  46666. t['Acircumflex'] = 722;
  46667. t['aacute'] = 500;
  46668. t['Ucircumflex'] = 722;
  46669. t['yacute'] = 500;
  46670. t['scommaaccent'] = 389;
  46671. t['ecircumflex'] = 444;
  46672. t['Uring'] = 722;
  46673. t['Udieresis'] = 722;
  46674. t['aogonek'] = 500;
  46675. t['Uacute'] = 722;
  46676. t['uogonek'] = 556;
  46677. t['Edieresis'] = 667;
  46678. t['Dcroat'] = 722;
  46679. t['commaaccent'] = 250;
  46680. t['copyright'] = 747;
  46681. t['Emacron'] = 667;
  46682. t['ccaron'] = 444;
  46683. t['aring'] = 500;
  46684. t['Ncommaaccent'] = 722;
  46685. t['lacute'] = 278;
  46686. t['agrave'] = 500;
  46687. t['Tcommaaccent'] = 667;
  46688. t['Cacute'] = 722;
  46689. t['atilde'] = 500;
  46690. t['Edotaccent'] = 667;
  46691. t['scaron'] = 389;
  46692. t['scedilla'] = 389;
  46693. t['iacute'] = 278;
  46694. t['lozenge'] = 494;
  46695. t['Rcaron'] = 722;
  46696. t['Gcommaaccent'] = 778;
  46697. t['ucircumflex'] = 556;
  46698. t['acircumflex'] = 500;
  46699. t['Amacron'] = 722;
  46700. t['rcaron'] = 444;
  46701. t['ccedilla'] = 444;
  46702. t['Zdotaccent'] = 667;
  46703. t['Thorn'] = 611;
  46704. t['Omacron'] = 778;
  46705. t['Racute'] = 722;
  46706. t['Sacute'] = 556;
  46707. t['dcaron'] = 672;
  46708. t['Umacron'] = 722;
  46709. t['uring'] = 556;
  46710. t['threesuperior'] = 300;
  46711. t['Ograve'] = 778;
  46712. t['Agrave'] = 722;
  46713. t['Abreve'] = 722;
  46714. t['multiply'] = 570;
  46715. t['uacute'] = 556;
  46716. t['Tcaron'] = 667;
  46717. t['partialdiff'] = 494;
  46718. t['ydieresis'] = 500;
  46719. t['Nacute'] = 722;
  46720. t['icircumflex'] = 278;
  46721. t['Ecircumflex'] = 667;
  46722. t['adieresis'] = 500;
  46723. t['edieresis'] = 444;
  46724. t['cacute'] = 444;
  46725. t['nacute'] = 556;
  46726. t['umacron'] = 556;
  46727. t['Ncaron'] = 722;
  46728. t['Iacute'] = 389;
  46729. t['plusminus'] = 570;
  46730. t['brokenbar'] = 220;
  46731. t['registered'] = 747;
  46732. t['Gbreve'] = 778;
  46733. t['Idotaccent'] = 389;
  46734. t['summation'] = 600;
  46735. t['Egrave'] = 667;
  46736. t['racute'] = 444;
  46737. t['omacron'] = 500;
  46738. t['Zacute'] = 667;
  46739. t['Zcaron'] = 667;
  46740. t['greaterequal'] = 549;
  46741. t['Eth'] = 722;
  46742. t['Ccedilla'] = 722;
  46743. t['lcommaaccent'] = 278;
  46744. t['tcaron'] = 416;
  46745. t['eogonek'] = 444;
  46746. t['Uogonek'] = 722;
  46747. t['Aacute'] = 722;
  46748. t['Adieresis'] = 722;
  46749. t['egrave'] = 444;
  46750. t['zacute'] = 444;
  46751. t['iogonek'] = 278;
  46752. t['Oacute'] = 778;
  46753. t['oacute'] = 500;
  46754. t['amacron'] = 500;
  46755. t['sacute'] = 389;
  46756. t['idieresis'] = 278;
  46757. t['Ocircumflex'] = 778;
  46758. t['Ugrave'] = 722;
  46759. t['Delta'] = 612;
  46760. t['thorn'] = 556;
  46761. t['twosuperior'] = 300;
  46762. t['Odieresis'] = 778;
  46763. t['mu'] = 556;
  46764. t['igrave'] = 278;
  46765. t['ohungarumlaut'] = 500;
  46766. t['Eogonek'] = 667;
  46767. t['dcroat'] = 556;
  46768. t['threequarters'] = 750;
  46769. t['Scedilla'] = 556;
  46770. t['lcaron'] = 394;
  46771. t['Kcommaaccent'] = 778;
  46772. t['Lacute'] = 667;
  46773. t['trademark'] = 1000;
  46774. t['edotaccent'] = 444;
  46775. t['Igrave'] = 389;
  46776. t['Imacron'] = 389;
  46777. t['Lcaron'] = 667;
  46778. t['onehalf'] = 750;
  46779. t['lessequal'] = 549;
  46780. t['ocircumflex'] = 500;
  46781. t['ntilde'] = 556;
  46782. t['Uhungarumlaut'] = 722;
  46783. t['Eacute'] = 667;
  46784. t['emacron'] = 444;
  46785. t['gbreve'] = 500;
  46786. t['onequarter'] = 750;
  46787. t['Scaron'] = 556;
  46788. t['Scommaaccent'] = 556;
  46789. t['Ohungarumlaut'] = 778;
  46790. t['degree'] = 400;
  46791. t['ograve'] = 500;
  46792. t['Ccaron'] = 722;
  46793. t['ugrave'] = 556;
  46794. t['radical'] = 549;
  46795. t['Dcaron'] = 722;
  46796. t['rcommaaccent'] = 444;
  46797. t['Ntilde'] = 722;
  46798. t['otilde'] = 500;
  46799. t['Rcommaaccent'] = 722;
  46800. t['Lcommaaccent'] = 667;
  46801. t['Atilde'] = 722;
  46802. t['Aogonek'] = 722;
  46803. t['Aring'] = 722;
  46804. t['Otilde'] = 778;
  46805. t['zdotaccent'] = 444;
  46806. t['Ecaron'] = 667;
  46807. t['Iogonek'] = 389;
  46808. t['kcommaaccent'] = 556;
  46809. t['minus'] = 570;
  46810. t['Icircumflex'] = 389;
  46811. t['ncaron'] = 556;
  46812. t['tcommaaccent'] = 333;
  46813. t['logicalnot'] = 570;
  46814. t['odieresis'] = 500;
  46815. t['udieresis'] = 556;
  46816. t['notequal'] = 549;
  46817. t['gcommaaccent'] = 500;
  46818. t['eth'] = 500;
  46819. t['zcaron'] = 444;
  46820. t['ncommaaccent'] = 556;
  46821. t['onesuperior'] = 300;
  46822. t['imacron'] = 278;
  46823. t['Euro'] = 500;
  46824. });
  46825. t['Times-BoldItalic'] = getLookupTableFactory(function (t) {
  46826. t['space'] = 250;
  46827. t['exclam'] = 389;
  46828. t['quotedbl'] = 555;
  46829. t['numbersign'] = 500;
  46830. t['dollar'] = 500;
  46831. t['percent'] = 833;
  46832. t['ampersand'] = 778;
  46833. t['quoteright'] = 333;
  46834. t['parenleft'] = 333;
  46835. t['parenright'] = 333;
  46836. t['asterisk'] = 500;
  46837. t['plus'] = 570;
  46838. t['comma'] = 250;
  46839. t['hyphen'] = 333;
  46840. t['period'] = 250;
  46841. t['slash'] = 278;
  46842. t['zero'] = 500;
  46843. t['one'] = 500;
  46844. t['two'] = 500;
  46845. t['three'] = 500;
  46846. t['four'] = 500;
  46847. t['five'] = 500;
  46848. t['six'] = 500;
  46849. t['seven'] = 500;
  46850. t['eight'] = 500;
  46851. t['nine'] = 500;
  46852. t['colon'] = 333;
  46853. t['semicolon'] = 333;
  46854. t['less'] = 570;
  46855. t['equal'] = 570;
  46856. t['greater'] = 570;
  46857. t['question'] = 500;
  46858. t['at'] = 832;
  46859. t['A'] = 667;
  46860. t['B'] = 667;
  46861. t['C'] = 667;
  46862. t['D'] = 722;
  46863. t['E'] = 667;
  46864. t['F'] = 667;
  46865. t['G'] = 722;
  46866. t['H'] = 778;
  46867. t['I'] = 389;
  46868. t['J'] = 500;
  46869. t['K'] = 667;
  46870. t['L'] = 611;
  46871. t['M'] = 889;
  46872. t['N'] = 722;
  46873. t['O'] = 722;
  46874. t['P'] = 611;
  46875. t['Q'] = 722;
  46876. t['R'] = 667;
  46877. t['S'] = 556;
  46878. t['T'] = 611;
  46879. t['U'] = 722;
  46880. t['V'] = 667;
  46881. t['W'] = 889;
  46882. t['X'] = 667;
  46883. t['Y'] = 611;
  46884. t['Z'] = 611;
  46885. t['bracketleft'] = 333;
  46886. t['backslash'] = 278;
  46887. t['bracketright'] = 333;
  46888. t['asciicircum'] = 570;
  46889. t['underscore'] = 500;
  46890. t['quoteleft'] = 333;
  46891. t['a'] = 500;
  46892. t['b'] = 500;
  46893. t['c'] = 444;
  46894. t['d'] = 500;
  46895. t['e'] = 444;
  46896. t['f'] = 333;
  46897. t['g'] = 500;
  46898. t['h'] = 556;
  46899. t['i'] = 278;
  46900. t['j'] = 278;
  46901. t['k'] = 500;
  46902. t['l'] = 278;
  46903. t['m'] = 778;
  46904. t['n'] = 556;
  46905. t['o'] = 500;
  46906. t['p'] = 500;
  46907. t['q'] = 500;
  46908. t['r'] = 389;
  46909. t['s'] = 389;
  46910. t['t'] = 278;
  46911. t['u'] = 556;
  46912. t['v'] = 444;
  46913. t['w'] = 667;
  46914. t['x'] = 500;
  46915. t['y'] = 444;
  46916. t['z'] = 389;
  46917. t['braceleft'] = 348;
  46918. t['bar'] = 220;
  46919. t['braceright'] = 348;
  46920. t['asciitilde'] = 570;
  46921. t['exclamdown'] = 389;
  46922. t['cent'] = 500;
  46923. t['sterling'] = 500;
  46924. t['fraction'] = 167;
  46925. t['yen'] = 500;
  46926. t['florin'] = 500;
  46927. t['section'] = 500;
  46928. t['currency'] = 500;
  46929. t['quotesingle'] = 278;
  46930. t['quotedblleft'] = 500;
  46931. t['guillemotleft'] = 500;
  46932. t['guilsinglleft'] = 333;
  46933. t['guilsinglright'] = 333;
  46934. t['fi'] = 556;
  46935. t['fl'] = 556;
  46936. t['endash'] = 500;
  46937. t['dagger'] = 500;
  46938. t['daggerdbl'] = 500;
  46939. t['periodcentered'] = 250;
  46940. t['paragraph'] = 500;
  46941. t['bullet'] = 350;
  46942. t['quotesinglbase'] = 333;
  46943. t['quotedblbase'] = 500;
  46944. t['quotedblright'] = 500;
  46945. t['guillemotright'] = 500;
  46946. t['ellipsis'] = 1000;
  46947. t['perthousand'] = 1000;
  46948. t['questiondown'] = 500;
  46949. t['grave'] = 333;
  46950. t['acute'] = 333;
  46951. t['circumflex'] = 333;
  46952. t['tilde'] = 333;
  46953. t['macron'] = 333;
  46954. t['breve'] = 333;
  46955. t['dotaccent'] = 333;
  46956. t['dieresis'] = 333;
  46957. t['ring'] = 333;
  46958. t['cedilla'] = 333;
  46959. t['hungarumlaut'] = 333;
  46960. t['ogonek'] = 333;
  46961. t['caron'] = 333;
  46962. t['emdash'] = 1000;
  46963. t['AE'] = 944;
  46964. t['ordfeminine'] = 266;
  46965. t['Lslash'] = 611;
  46966. t['Oslash'] = 722;
  46967. t['OE'] = 944;
  46968. t['ordmasculine'] = 300;
  46969. t['ae'] = 722;
  46970. t['dotlessi'] = 278;
  46971. t['lslash'] = 278;
  46972. t['oslash'] = 500;
  46973. t['oe'] = 722;
  46974. t['germandbls'] = 500;
  46975. t['Idieresis'] = 389;
  46976. t['eacute'] = 444;
  46977. t['abreve'] = 500;
  46978. t['uhungarumlaut'] = 556;
  46979. t['ecaron'] = 444;
  46980. t['Ydieresis'] = 611;
  46981. t['divide'] = 570;
  46982. t['Yacute'] = 611;
  46983. t['Acircumflex'] = 667;
  46984. t['aacute'] = 500;
  46985. t['Ucircumflex'] = 722;
  46986. t['yacute'] = 444;
  46987. t['scommaaccent'] = 389;
  46988. t['ecircumflex'] = 444;
  46989. t['Uring'] = 722;
  46990. t['Udieresis'] = 722;
  46991. t['aogonek'] = 500;
  46992. t['Uacute'] = 722;
  46993. t['uogonek'] = 556;
  46994. t['Edieresis'] = 667;
  46995. t['Dcroat'] = 722;
  46996. t['commaaccent'] = 250;
  46997. t['copyright'] = 747;
  46998. t['Emacron'] = 667;
  46999. t['ccaron'] = 444;
  47000. t['aring'] = 500;
  47001. t['Ncommaaccent'] = 722;
  47002. t['lacute'] = 278;
  47003. t['agrave'] = 500;
  47004. t['Tcommaaccent'] = 611;
  47005. t['Cacute'] = 667;
  47006. t['atilde'] = 500;
  47007. t['Edotaccent'] = 667;
  47008. t['scaron'] = 389;
  47009. t['scedilla'] = 389;
  47010. t['iacute'] = 278;
  47011. t['lozenge'] = 494;
  47012. t['Rcaron'] = 667;
  47013. t['Gcommaaccent'] = 722;
  47014. t['ucircumflex'] = 556;
  47015. t['acircumflex'] = 500;
  47016. t['Amacron'] = 667;
  47017. t['rcaron'] = 389;
  47018. t['ccedilla'] = 444;
  47019. t['Zdotaccent'] = 611;
  47020. t['Thorn'] = 611;
  47021. t['Omacron'] = 722;
  47022. t['Racute'] = 667;
  47023. t['Sacute'] = 556;
  47024. t['dcaron'] = 608;
  47025. t['Umacron'] = 722;
  47026. t['uring'] = 556;
  47027. t['threesuperior'] = 300;
  47028. t['Ograve'] = 722;
  47029. t['Agrave'] = 667;
  47030. t['Abreve'] = 667;
  47031. t['multiply'] = 570;
  47032. t['uacute'] = 556;
  47033. t['Tcaron'] = 611;
  47034. t['partialdiff'] = 494;
  47035. t['ydieresis'] = 444;
  47036. t['Nacute'] = 722;
  47037. t['icircumflex'] = 278;
  47038. t['Ecircumflex'] = 667;
  47039. t['adieresis'] = 500;
  47040. t['edieresis'] = 444;
  47041. t['cacute'] = 444;
  47042. t['nacute'] = 556;
  47043. t['umacron'] = 556;
  47044. t['Ncaron'] = 722;
  47045. t['Iacute'] = 389;
  47046. t['plusminus'] = 570;
  47047. t['brokenbar'] = 220;
  47048. t['registered'] = 747;
  47049. t['Gbreve'] = 722;
  47050. t['Idotaccent'] = 389;
  47051. t['summation'] = 600;
  47052. t['Egrave'] = 667;
  47053. t['racute'] = 389;
  47054. t['omacron'] = 500;
  47055. t['Zacute'] = 611;
  47056. t['Zcaron'] = 611;
  47057. t['greaterequal'] = 549;
  47058. t['Eth'] = 722;
  47059. t['Ccedilla'] = 667;
  47060. t['lcommaaccent'] = 278;
  47061. t['tcaron'] = 366;
  47062. t['eogonek'] = 444;
  47063. t['Uogonek'] = 722;
  47064. t['Aacute'] = 667;
  47065. t['Adieresis'] = 667;
  47066. t['egrave'] = 444;
  47067. t['zacute'] = 389;
  47068. t['iogonek'] = 278;
  47069. t['Oacute'] = 722;
  47070. t['oacute'] = 500;
  47071. t['amacron'] = 500;
  47072. t['sacute'] = 389;
  47073. t['idieresis'] = 278;
  47074. t['Ocircumflex'] = 722;
  47075. t['Ugrave'] = 722;
  47076. t['Delta'] = 612;
  47077. t['thorn'] = 500;
  47078. t['twosuperior'] = 300;
  47079. t['Odieresis'] = 722;
  47080. t['mu'] = 576;
  47081. t['igrave'] = 278;
  47082. t['ohungarumlaut'] = 500;
  47083. t['Eogonek'] = 667;
  47084. t['dcroat'] = 500;
  47085. t['threequarters'] = 750;
  47086. t['Scedilla'] = 556;
  47087. t['lcaron'] = 382;
  47088. t['Kcommaaccent'] = 667;
  47089. t['Lacute'] = 611;
  47090. t['trademark'] = 1000;
  47091. t['edotaccent'] = 444;
  47092. t['Igrave'] = 389;
  47093. t['Imacron'] = 389;
  47094. t['Lcaron'] = 611;
  47095. t['onehalf'] = 750;
  47096. t['lessequal'] = 549;
  47097. t['ocircumflex'] = 500;
  47098. t['ntilde'] = 556;
  47099. t['Uhungarumlaut'] = 722;
  47100. t['Eacute'] = 667;
  47101. t['emacron'] = 444;
  47102. t['gbreve'] = 500;
  47103. t['onequarter'] = 750;
  47104. t['Scaron'] = 556;
  47105. t['Scommaaccent'] = 556;
  47106. t['Ohungarumlaut'] = 722;
  47107. t['degree'] = 400;
  47108. t['ograve'] = 500;
  47109. t['Ccaron'] = 667;
  47110. t['ugrave'] = 556;
  47111. t['radical'] = 549;
  47112. t['Dcaron'] = 722;
  47113. t['rcommaaccent'] = 389;
  47114. t['Ntilde'] = 722;
  47115. t['otilde'] = 500;
  47116. t['Rcommaaccent'] = 667;
  47117. t['Lcommaaccent'] = 611;
  47118. t['Atilde'] = 667;
  47119. t['Aogonek'] = 667;
  47120. t['Aring'] = 667;
  47121. t['Otilde'] = 722;
  47122. t['zdotaccent'] = 389;
  47123. t['Ecaron'] = 667;
  47124. t['Iogonek'] = 389;
  47125. t['kcommaaccent'] = 500;
  47126. t['minus'] = 606;
  47127. t['Icircumflex'] = 389;
  47128. t['ncaron'] = 556;
  47129. t['tcommaaccent'] = 278;
  47130. t['logicalnot'] = 606;
  47131. t['odieresis'] = 500;
  47132. t['udieresis'] = 556;
  47133. t['notequal'] = 549;
  47134. t['gcommaaccent'] = 500;
  47135. t['eth'] = 500;
  47136. t['zcaron'] = 389;
  47137. t['ncommaaccent'] = 556;
  47138. t['onesuperior'] = 300;
  47139. t['imacron'] = 278;
  47140. t['Euro'] = 500;
  47141. });
  47142. t['Times-Italic'] = getLookupTableFactory(function (t) {
  47143. t['space'] = 250;
  47144. t['exclam'] = 333;
  47145. t['quotedbl'] = 420;
  47146. t['numbersign'] = 500;
  47147. t['dollar'] = 500;
  47148. t['percent'] = 833;
  47149. t['ampersand'] = 778;
  47150. t['quoteright'] = 333;
  47151. t['parenleft'] = 333;
  47152. t['parenright'] = 333;
  47153. t['asterisk'] = 500;
  47154. t['plus'] = 675;
  47155. t['comma'] = 250;
  47156. t['hyphen'] = 333;
  47157. t['period'] = 250;
  47158. t['slash'] = 278;
  47159. t['zero'] = 500;
  47160. t['one'] = 500;
  47161. t['two'] = 500;
  47162. t['three'] = 500;
  47163. t['four'] = 500;
  47164. t['five'] = 500;
  47165. t['six'] = 500;
  47166. t['seven'] = 500;
  47167. t['eight'] = 500;
  47168. t['nine'] = 500;
  47169. t['colon'] = 333;
  47170. t['semicolon'] = 333;
  47171. t['less'] = 675;
  47172. t['equal'] = 675;
  47173. t['greater'] = 675;
  47174. t['question'] = 500;
  47175. t['at'] = 920;
  47176. t['A'] = 611;
  47177. t['B'] = 611;
  47178. t['C'] = 667;
  47179. t['D'] = 722;
  47180. t['E'] = 611;
  47181. t['F'] = 611;
  47182. t['G'] = 722;
  47183. t['H'] = 722;
  47184. t['I'] = 333;
  47185. t['J'] = 444;
  47186. t['K'] = 667;
  47187. t['L'] = 556;
  47188. t['M'] = 833;
  47189. t['N'] = 667;
  47190. t['O'] = 722;
  47191. t['P'] = 611;
  47192. t['Q'] = 722;
  47193. t['R'] = 611;
  47194. t['S'] = 500;
  47195. t['T'] = 556;
  47196. t['U'] = 722;
  47197. t['V'] = 611;
  47198. t['W'] = 833;
  47199. t['X'] = 611;
  47200. t['Y'] = 556;
  47201. t['Z'] = 556;
  47202. t['bracketleft'] = 389;
  47203. t['backslash'] = 278;
  47204. t['bracketright'] = 389;
  47205. t['asciicircum'] = 422;
  47206. t['underscore'] = 500;
  47207. t['quoteleft'] = 333;
  47208. t['a'] = 500;
  47209. t['b'] = 500;
  47210. t['c'] = 444;
  47211. t['d'] = 500;
  47212. t['e'] = 444;
  47213. t['f'] = 278;
  47214. t['g'] = 500;
  47215. t['h'] = 500;
  47216. t['i'] = 278;
  47217. t['j'] = 278;
  47218. t['k'] = 444;
  47219. t['l'] = 278;
  47220. t['m'] = 722;
  47221. t['n'] = 500;
  47222. t['o'] = 500;
  47223. t['p'] = 500;
  47224. t['q'] = 500;
  47225. t['r'] = 389;
  47226. t['s'] = 389;
  47227. t['t'] = 278;
  47228. t['u'] = 500;
  47229. t['v'] = 444;
  47230. t['w'] = 667;
  47231. t['x'] = 444;
  47232. t['y'] = 444;
  47233. t['z'] = 389;
  47234. t['braceleft'] = 400;
  47235. t['bar'] = 275;
  47236. t['braceright'] = 400;
  47237. t['asciitilde'] = 541;
  47238. t['exclamdown'] = 389;
  47239. t['cent'] = 500;
  47240. t['sterling'] = 500;
  47241. t['fraction'] = 167;
  47242. t['yen'] = 500;
  47243. t['florin'] = 500;
  47244. t['section'] = 500;
  47245. t['currency'] = 500;
  47246. t['quotesingle'] = 214;
  47247. t['quotedblleft'] = 556;
  47248. t['guillemotleft'] = 500;
  47249. t['guilsinglleft'] = 333;
  47250. t['guilsinglright'] = 333;
  47251. t['fi'] = 500;
  47252. t['fl'] = 500;
  47253. t['endash'] = 500;
  47254. t['dagger'] = 500;
  47255. t['daggerdbl'] = 500;
  47256. t['periodcentered'] = 250;
  47257. t['paragraph'] = 523;
  47258. t['bullet'] = 350;
  47259. t['quotesinglbase'] = 333;
  47260. t['quotedblbase'] = 556;
  47261. t['quotedblright'] = 556;
  47262. t['guillemotright'] = 500;
  47263. t['ellipsis'] = 889;
  47264. t['perthousand'] = 1000;
  47265. t['questiondown'] = 500;
  47266. t['grave'] = 333;
  47267. t['acute'] = 333;
  47268. t['circumflex'] = 333;
  47269. t['tilde'] = 333;
  47270. t['macron'] = 333;
  47271. t['breve'] = 333;
  47272. t['dotaccent'] = 333;
  47273. t['dieresis'] = 333;
  47274. t['ring'] = 333;
  47275. t['cedilla'] = 333;
  47276. t['hungarumlaut'] = 333;
  47277. t['ogonek'] = 333;
  47278. t['caron'] = 333;
  47279. t['emdash'] = 889;
  47280. t['AE'] = 889;
  47281. t['ordfeminine'] = 276;
  47282. t['Lslash'] = 556;
  47283. t['Oslash'] = 722;
  47284. t['OE'] = 944;
  47285. t['ordmasculine'] = 310;
  47286. t['ae'] = 667;
  47287. t['dotlessi'] = 278;
  47288. t['lslash'] = 278;
  47289. t['oslash'] = 500;
  47290. t['oe'] = 667;
  47291. t['germandbls'] = 500;
  47292. t['Idieresis'] = 333;
  47293. t['eacute'] = 444;
  47294. t['abreve'] = 500;
  47295. t['uhungarumlaut'] = 500;
  47296. t['ecaron'] = 444;
  47297. t['Ydieresis'] = 556;
  47298. t['divide'] = 675;
  47299. t['Yacute'] = 556;
  47300. t['Acircumflex'] = 611;
  47301. t['aacute'] = 500;
  47302. t['Ucircumflex'] = 722;
  47303. t['yacute'] = 444;
  47304. t['scommaaccent'] = 389;
  47305. t['ecircumflex'] = 444;
  47306. t['Uring'] = 722;
  47307. t['Udieresis'] = 722;
  47308. t['aogonek'] = 500;
  47309. t['Uacute'] = 722;
  47310. t['uogonek'] = 500;
  47311. t['Edieresis'] = 611;
  47312. t['Dcroat'] = 722;
  47313. t['commaaccent'] = 250;
  47314. t['copyright'] = 760;
  47315. t['Emacron'] = 611;
  47316. t['ccaron'] = 444;
  47317. t['aring'] = 500;
  47318. t['Ncommaaccent'] = 667;
  47319. t['lacute'] = 278;
  47320. t['agrave'] = 500;
  47321. t['Tcommaaccent'] = 556;
  47322. t['Cacute'] = 667;
  47323. t['atilde'] = 500;
  47324. t['Edotaccent'] = 611;
  47325. t['scaron'] = 389;
  47326. t['scedilla'] = 389;
  47327. t['iacute'] = 278;
  47328. t['lozenge'] = 471;
  47329. t['Rcaron'] = 611;
  47330. t['Gcommaaccent'] = 722;
  47331. t['ucircumflex'] = 500;
  47332. t['acircumflex'] = 500;
  47333. t['Amacron'] = 611;
  47334. t['rcaron'] = 389;
  47335. t['ccedilla'] = 444;
  47336. t['Zdotaccent'] = 556;
  47337. t['Thorn'] = 611;
  47338. t['Omacron'] = 722;
  47339. t['Racute'] = 611;
  47340. t['Sacute'] = 500;
  47341. t['dcaron'] = 544;
  47342. t['Umacron'] = 722;
  47343. t['uring'] = 500;
  47344. t['threesuperior'] = 300;
  47345. t['Ograve'] = 722;
  47346. t['Agrave'] = 611;
  47347. t['Abreve'] = 611;
  47348. t['multiply'] = 675;
  47349. t['uacute'] = 500;
  47350. t['Tcaron'] = 556;
  47351. t['partialdiff'] = 476;
  47352. t['ydieresis'] = 444;
  47353. t['Nacute'] = 667;
  47354. t['icircumflex'] = 278;
  47355. t['Ecircumflex'] = 611;
  47356. t['adieresis'] = 500;
  47357. t['edieresis'] = 444;
  47358. t['cacute'] = 444;
  47359. t['nacute'] = 500;
  47360. t['umacron'] = 500;
  47361. t['Ncaron'] = 667;
  47362. t['Iacute'] = 333;
  47363. t['plusminus'] = 675;
  47364. t['brokenbar'] = 275;
  47365. t['registered'] = 760;
  47366. t['Gbreve'] = 722;
  47367. t['Idotaccent'] = 333;
  47368. t['summation'] = 600;
  47369. t['Egrave'] = 611;
  47370. t['racute'] = 389;
  47371. t['omacron'] = 500;
  47372. t['Zacute'] = 556;
  47373. t['Zcaron'] = 556;
  47374. t['greaterequal'] = 549;
  47375. t['Eth'] = 722;
  47376. t['Ccedilla'] = 667;
  47377. t['lcommaaccent'] = 278;
  47378. t['tcaron'] = 300;
  47379. t['eogonek'] = 444;
  47380. t['Uogonek'] = 722;
  47381. t['Aacute'] = 611;
  47382. t['Adieresis'] = 611;
  47383. t['egrave'] = 444;
  47384. t['zacute'] = 389;
  47385. t['iogonek'] = 278;
  47386. t['Oacute'] = 722;
  47387. t['oacute'] = 500;
  47388. t['amacron'] = 500;
  47389. t['sacute'] = 389;
  47390. t['idieresis'] = 278;
  47391. t['Ocircumflex'] = 722;
  47392. t['Ugrave'] = 722;
  47393. t['Delta'] = 612;
  47394. t['thorn'] = 500;
  47395. t['twosuperior'] = 300;
  47396. t['Odieresis'] = 722;
  47397. t['mu'] = 500;
  47398. t['igrave'] = 278;
  47399. t['ohungarumlaut'] = 500;
  47400. t['Eogonek'] = 611;
  47401. t['dcroat'] = 500;
  47402. t['threequarters'] = 750;
  47403. t['Scedilla'] = 500;
  47404. t['lcaron'] = 300;
  47405. t['Kcommaaccent'] = 667;
  47406. t['Lacute'] = 556;
  47407. t['trademark'] = 980;
  47408. t['edotaccent'] = 444;
  47409. t['Igrave'] = 333;
  47410. t['Imacron'] = 333;
  47411. t['Lcaron'] = 611;
  47412. t['onehalf'] = 750;
  47413. t['lessequal'] = 549;
  47414. t['ocircumflex'] = 500;
  47415. t['ntilde'] = 500;
  47416. t['Uhungarumlaut'] = 722;
  47417. t['Eacute'] = 611;
  47418. t['emacron'] = 444;
  47419. t['gbreve'] = 500;
  47420. t['onequarter'] = 750;
  47421. t['Scaron'] = 500;
  47422. t['Scommaaccent'] = 500;
  47423. t['Ohungarumlaut'] = 722;
  47424. t['degree'] = 400;
  47425. t['ograve'] = 500;
  47426. t['Ccaron'] = 667;
  47427. t['ugrave'] = 500;
  47428. t['radical'] = 453;
  47429. t['Dcaron'] = 722;
  47430. t['rcommaaccent'] = 389;
  47431. t['Ntilde'] = 667;
  47432. t['otilde'] = 500;
  47433. t['Rcommaaccent'] = 611;
  47434. t['Lcommaaccent'] = 556;
  47435. t['Atilde'] = 611;
  47436. t['Aogonek'] = 611;
  47437. t['Aring'] = 611;
  47438. t['Otilde'] = 722;
  47439. t['zdotaccent'] = 389;
  47440. t['Ecaron'] = 611;
  47441. t['Iogonek'] = 333;
  47442. t['kcommaaccent'] = 444;
  47443. t['minus'] = 675;
  47444. t['Icircumflex'] = 333;
  47445. t['ncaron'] = 500;
  47446. t['tcommaaccent'] = 278;
  47447. t['logicalnot'] = 675;
  47448. t['odieresis'] = 500;
  47449. t['udieresis'] = 500;
  47450. t['notequal'] = 549;
  47451. t['gcommaaccent'] = 500;
  47452. t['eth'] = 500;
  47453. t['zcaron'] = 389;
  47454. t['ncommaaccent'] = 500;
  47455. t['onesuperior'] = 300;
  47456. t['imacron'] = 278;
  47457. t['Euro'] = 500;
  47458. });
  47459. t['ZapfDingbats'] = getLookupTableFactory(function (t) {
  47460. t['space'] = 278;
  47461. t['a1'] = 974;
  47462. t['a2'] = 961;
  47463. t['a202'] = 974;
  47464. t['a3'] = 980;
  47465. t['a4'] = 719;
  47466. t['a5'] = 789;
  47467. t['a119'] = 790;
  47468. t['a118'] = 791;
  47469. t['a117'] = 690;
  47470. t['a11'] = 960;
  47471. t['a12'] = 939;
  47472. t['a13'] = 549;
  47473. t['a14'] = 855;
  47474. t['a15'] = 911;
  47475. t['a16'] = 933;
  47476. t['a105'] = 911;
  47477. t['a17'] = 945;
  47478. t['a18'] = 974;
  47479. t['a19'] = 755;
  47480. t['a20'] = 846;
  47481. t['a21'] = 762;
  47482. t['a22'] = 761;
  47483. t['a23'] = 571;
  47484. t['a24'] = 677;
  47485. t['a25'] = 763;
  47486. t['a26'] = 760;
  47487. t['a27'] = 759;
  47488. t['a28'] = 754;
  47489. t['a6'] = 494;
  47490. t['a7'] = 552;
  47491. t['a8'] = 537;
  47492. t['a9'] = 577;
  47493. t['a10'] = 692;
  47494. t['a29'] = 786;
  47495. t['a30'] = 788;
  47496. t['a31'] = 788;
  47497. t['a32'] = 790;
  47498. t['a33'] = 793;
  47499. t['a34'] = 794;
  47500. t['a35'] = 816;
  47501. t['a36'] = 823;
  47502. t['a37'] = 789;
  47503. t['a38'] = 841;
  47504. t['a39'] = 823;
  47505. t['a40'] = 833;
  47506. t['a41'] = 816;
  47507. t['a42'] = 831;
  47508. t['a43'] = 923;
  47509. t['a44'] = 744;
  47510. t['a45'] = 723;
  47511. t['a46'] = 749;
  47512. t['a47'] = 790;
  47513. t['a48'] = 792;
  47514. t['a49'] = 695;
  47515. t['a50'] = 776;
  47516. t['a51'] = 768;
  47517. t['a52'] = 792;
  47518. t['a53'] = 759;
  47519. t['a54'] = 707;
  47520. t['a55'] = 708;
  47521. t['a56'] = 682;
  47522. t['a57'] = 701;
  47523. t['a58'] = 826;
  47524. t['a59'] = 815;
  47525. t['a60'] = 789;
  47526. t['a61'] = 789;
  47527. t['a62'] = 707;
  47528. t['a63'] = 687;
  47529. t['a64'] = 696;
  47530. t['a65'] = 689;
  47531. t['a66'] = 786;
  47532. t['a67'] = 787;
  47533. t['a68'] = 713;
  47534. t['a69'] = 791;
  47535. t['a70'] = 785;
  47536. t['a71'] = 791;
  47537. t['a72'] = 873;
  47538. t['a73'] = 761;
  47539. t['a74'] = 762;
  47540. t['a203'] = 762;
  47541. t['a75'] = 759;
  47542. t['a204'] = 759;
  47543. t['a76'] = 892;
  47544. t['a77'] = 892;
  47545. t['a78'] = 788;
  47546. t['a79'] = 784;
  47547. t['a81'] = 438;
  47548. t['a82'] = 138;
  47549. t['a83'] = 277;
  47550. t['a84'] = 415;
  47551. t['a97'] = 392;
  47552. t['a98'] = 392;
  47553. t['a99'] = 668;
  47554. t['a100'] = 668;
  47555. t['a89'] = 390;
  47556. t['a90'] = 390;
  47557. t['a93'] = 317;
  47558. t['a94'] = 317;
  47559. t['a91'] = 276;
  47560. t['a92'] = 276;
  47561. t['a205'] = 509;
  47562. t['a85'] = 509;
  47563. t['a206'] = 410;
  47564. t['a86'] = 410;
  47565. t['a87'] = 234;
  47566. t['a88'] = 234;
  47567. t['a95'] = 334;
  47568. t['a96'] = 334;
  47569. t['a101'] = 732;
  47570. t['a102'] = 544;
  47571. t['a103'] = 544;
  47572. t['a104'] = 910;
  47573. t['a106'] = 667;
  47574. t['a107'] = 760;
  47575. t['a108'] = 760;
  47576. t['a112'] = 776;
  47577. t['a111'] = 595;
  47578. t['a110'] = 694;
  47579. t['a109'] = 626;
  47580. t['a120'] = 788;
  47581. t['a121'] = 788;
  47582. t['a122'] = 788;
  47583. t['a123'] = 788;
  47584. t['a124'] = 788;
  47585. t['a125'] = 788;
  47586. t['a126'] = 788;
  47587. t['a127'] = 788;
  47588. t['a128'] = 788;
  47589. t['a129'] = 788;
  47590. t['a130'] = 788;
  47591. t['a131'] = 788;
  47592. t['a132'] = 788;
  47593. t['a133'] = 788;
  47594. t['a134'] = 788;
  47595. t['a135'] = 788;
  47596. t['a136'] = 788;
  47597. t['a137'] = 788;
  47598. t['a138'] = 788;
  47599. t['a139'] = 788;
  47600. t['a140'] = 788;
  47601. t['a141'] = 788;
  47602. t['a142'] = 788;
  47603. t['a143'] = 788;
  47604. t['a144'] = 788;
  47605. t['a145'] = 788;
  47606. t['a146'] = 788;
  47607. t['a147'] = 788;
  47608. t['a148'] = 788;
  47609. t['a149'] = 788;
  47610. t['a150'] = 788;
  47611. t['a151'] = 788;
  47612. t['a152'] = 788;
  47613. t['a153'] = 788;
  47614. t['a154'] = 788;
  47615. t['a155'] = 788;
  47616. t['a156'] = 788;
  47617. t['a157'] = 788;
  47618. t['a158'] = 788;
  47619. t['a159'] = 788;
  47620. t['a160'] = 894;
  47621. t['a161'] = 838;
  47622. t['a163'] = 1016;
  47623. t['a164'] = 458;
  47624. t['a196'] = 748;
  47625. t['a165'] = 924;
  47626. t['a192'] = 748;
  47627. t['a166'] = 918;
  47628. t['a167'] = 927;
  47629. t['a168'] = 928;
  47630. t['a169'] = 928;
  47631. t['a170'] = 834;
  47632. t['a171'] = 873;
  47633. t['a172'] = 828;
  47634. t['a173'] = 924;
  47635. t['a162'] = 924;
  47636. t['a174'] = 917;
  47637. t['a175'] = 930;
  47638. t['a176'] = 931;
  47639. t['a177'] = 463;
  47640. t['a178'] = 883;
  47641. t['a179'] = 836;
  47642. t['a193'] = 836;
  47643. t['a180'] = 867;
  47644. t['a199'] = 867;
  47645. t['a181'] = 696;
  47646. t['a200'] = 696;
  47647. t['a182'] = 874;
  47648. t['a201'] = 874;
  47649. t['a183'] = 760;
  47650. t['a184'] = 946;
  47651. t['a197'] = 771;
  47652. t['a185'] = 865;
  47653. t['a194'] = 771;
  47654. t['a198'] = 888;
  47655. t['a186'] = 967;
  47656. t['a195'] = 888;
  47657. t['a187'] = 831;
  47658. t['a188'] = 873;
  47659. t['a189'] = 927;
  47660. t['a190'] = 970;
  47661. t['a191'] = 918;
  47662. });
  47663. });
  47664. exports.getMetrics = getMetrics;
  47665. /***/ }),
  47666. /* 31 */
  47667. /***/ (function(module, exports, __w_pdfjs_require__) {
  47668. "use strict";
  47669. var sharedUtil = __w_pdfjs_require__(0);
  47670. var Uint32ArrayView = sharedUtil.Uint32ArrayView;
  47671. var MurmurHash3_64 = function MurmurHash3_64Closure(seed) {
  47672. var MASK_HIGH = 0xffff0000;
  47673. var MASK_LOW = 0xffff;
  47674. function MurmurHash3_64(seed) {
  47675. var SEED = 0xc3d2e1f0;
  47676. this.h1 = seed ? seed & 0xffffffff : SEED;
  47677. this.h2 = seed ? seed & 0xffffffff : SEED;
  47678. }
  47679. var alwaysUseUint32ArrayView = false;
  47680. try {
  47681. new Uint32Array(new Uint8Array(5).buffer, 0, 1);
  47682. } catch (e) {
  47683. alwaysUseUint32ArrayView = true;
  47684. }
  47685. MurmurHash3_64.prototype = {
  47686. update: function MurmurHash3_64_update(input) {
  47687. var useUint32ArrayView = alwaysUseUint32ArrayView;
  47688. var i;
  47689. if (typeof input === 'string') {
  47690. var data = new Uint8Array(input.length * 2);
  47691. var length = 0;
  47692. for (i = 0; i < input.length; i++) {
  47693. var code = input.charCodeAt(i);
  47694. if (code <= 0xff) {
  47695. data[length++] = code;
  47696. } else {
  47697. data[length++] = code >>> 8;
  47698. data[length++] = code & 0xff;
  47699. }
  47700. }
  47701. } else if (input instanceof Uint8Array) {
  47702. data = input;
  47703. length = data.length;
  47704. } else if (typeof input === 'object' && 'length' in input) {
  47705. data = input;
  47706. length = data.length;
  47707. useUint32ArrayView = true;
  47708. } else {
  47709. throw new Error('Wrong data format in MurmurHash3_64_update. ' + 'Input must be a string or array.');
  47710. }
  47711. var blockCounts = length >> 2;
  47712. var tailLength = length - blockCounts * 4;
  47713. var dataUint32 = useUint32ArrayView ? new Uint32ArrayView(data, blockCounts) : new Uint32Array(data.buffer, 0, blockCounts);
  47714. var k1 = 0;
  47715. var k2 = 0;
  47716. var h1 = this.h1;
  47717. var h2 = this.h2;
  47718. var C1 = 0xcc9e2d51;
  47719. var C2 = 0x1b873593;
  47720. var C1_LOW = C1 & MASK_LOW;
  47721. var C2_LOW = C2 & MASK_LOW;
  47722. for (i = 0; i < blockCounts; i++) {
  47723. if (i & 1) {
  47724. k1 = dataUint32[i];
  47725. k1 = k1 * C1 & MASK_HIGH | k1 * C1_LOW & MASK_LOW;
  47726. k1 = k1 << 15 | k1 >>> 17;
  47727. k1 = k1 * C2 & MASK_HIGH | k1 * C2_LOW & MASK_LOW;
  47728. h1 ^= k1;
  47729. h1 = h1 << 13 | h1 >>> 19;
  47730. h1 = h1 * 5 + 0xe6546b64;
  47731. } else {
  47732. k2 = dataUint32[i];
  47733. k2 = k2 * C1 & MASK_HIGH | k2 * C1_LOW & MASK_LOW;
  47734. k2 = k2 << 15 | k2 >>> 17;
  47735. k2 = k2 * C2 & MASK_HIGH | k2 * C2_LOW & MASK_LOW;
  47736. h2 ^= k2;
  47737. h2 = h2 << 13 | h2 >>> 19;
  47738. h2 = h2 * 5 + 0xe6546b64;
  47739. }
  47740. }
  47741. k1 = 0;
  47742. switch (tailLength) {
  47743. case 3:
  47744. k1 ^= data[blockCounts * 4 + 2] << 16;
  47745. case 2:
  47746. k1 ^= data[blockCounts * 4 + 1] << 8;
  47747. case 1:
  47748. k1 ^= data[blockCounts * 4];
  47749. k1 = k1 * C1 & MASK_HIGH | k1 * C1_LOW & MASK_LOW;
  47750. k1 = k1 << 15 | k1 >>> 17;
  47751. k1 = k1 * C2 & MASK_HIGH | k1 * C2_LOW & MASK_LOW;
  47752. if (blockCounts & 1) {
  47753. h1 ^= k1;
  47754. } else {
  47755. h2 ^= k1;
  47756. }
  47757. }
  47758. this.h1 = h1;
  47759. this.h2 = h2;
  47760. return this;
  47761. },
  47762. hexdigest: function MurmurHash3_64_hexdigest() {
  47763. var h1 = this.h1;
  47764. var h2 = this.h2;
  47765. h1 ^= h2 >>> 1;
  47766. h1 = h1 * 0xed558ccd & MASK_HIGH | h1 * 0x8ccd & MASK_LOW;
  47767. h2 = h2 * 0xff51afd7 & MASK_HIGH | ((h2 << 16 | h1 >>> 16) * 0xafd7ed55 & MASK_HIGH) >>> 16;
  47768. h1 ^= h2 >>> 1;
  47769. h1 = h1 * 0x1a85ec53 & MASK_HIGH | h1 * 0xec53 & MASK_LOW;
  47770. h2 = h2 * 0xc4ceb9fe & MASK_HIGH | ((h2 << 16 | h1 >>> 16) * 0xb9fe1a85 & MASK_HIGH) >>> 16;
  47771. h1 ^= h2 >>> 1;
  47772. for (var i = 0, arr = [
  47773. h1,
  47774. h2
  47775. ], str = ''; i < arr.length; i++) {
  47776. var hex = (arr[i] >>> 0).toString(16);
  47777. while (hex.length < 8) {
  47778. hex = '0' + hex;
  47779. }
  47780. str += hex;
  47781. }
  47782. return str;
  47783. }
  47784. };
  47785. return MurmurHash3_64;
  47786. }();
  47787. exports.MurmurHash3_64 = MurmurHash3_64;
  47788. /***/ }),
  47789. /* 32 */
  47790. /***/ (function(module, exports, __w_pdfjs_require__) {
  47791. "use strict";
  47792. var sharedUtil = __w_pdfjs_require__(0);
  47793. var corePrimitives = __w_pdfjs_require__(1);
  47794. var coreFunction = __w_pdfjs_require__(6);
  47795. var coreColorSpace = __w_pdfjs_require__(3);
  47796. var UNSUPPORTED_FEATURES = sharedUtil.UNSUPPORTED_FEATURES;
  47797. var MissingDataException = sharedUtil.MissingDataException;
  47798. var Util = sharedUtil.Util;
  47799. var assert = sharedUtil.assert;
  47800. var error = sharedUtil.error;
  47801. var info = sharedUtil.info;
  47802. var warn = sharedUtil.warn;
  47803. var isStream = corePrimitives.isStream;
  47804. var PDFFunction = coreFunction.PDFFunction;
  47805. var ColorSpace = coreColorSpace.ColorSpace;
  47806. var ShadingType = {
  47807. FUNCTION_BASED: 1,
  47808. AXIAL: 2,
  47809. RADIAL: 3,
  47810. FREE_FORM_MESH: 4,
  47811. LATTICE_FORM_MESH: 5,
  47812. COONS_PATCH_MESH: 6,
  47813. TENSOR_PATCH_MESH: 7
  47814. };
  47815. var Pattern = function PatternClosure() {
  47816. function Pattern() {
  47817. error('should not call Pattern constructor');
  47818. }
  47819. Pattern.prototype = {
  47820. getPattern: function Pattern_getPattern(ctx) {
  47821. error('Should not call Pattern.getStyle: ' + ctx);
  47822. }
  47823. };
  47824. Pattern.parseShading = function Pattern_parseShading(shading, matrix, xref, res, handler) {
  47825. var dict = isStream(shading) ? shading.dict : shading;
  47826. var type = dict.get('ShadingType');
  47827. try {
  47828. switch (type) {
  47829. case ShadingType.AXIAL:
  47830. case ShadingType.RADIAL:
  47831. return new Shadings.RadialAxial(dict, matrix, xref, res);
  47832. case ShadingType.FREE_FORM_MESH:
  47833. case ShadingType.LATTICE_FORM_MESH:
  47834. case ShadingType.COONS_PATCH_MESH:
  47835. case ShadingType.TENSOR_PATCH_MESH:
  47836. return new Shadings.Mesh(shading, matrix, xref, res);
  47837. default:
  47838. throw new Error('Unsupported ShadingType: ' + type);
  47839. }
  47840. } catch (ex) {
  47841. if (ex instanceof MissingDataException) {
  47842. throw ex;
  47843. }
  47844. handler.send('UnsupportedFeature', { featureId: UNSUPPORTED_FEATURES.shadingPattern });
  47845. warn(ex);
  47846. return new Shadings.Dummy();
  47847. }
  47848. };
  47849. return Pattern;
  47850. }();
  47851. var Shadings = {};
  47852. Shadings.SMALL_NUMBER = 1e-6;
  47853. Shadings.RadialAxial = function RadialAxialClosure() {
  47854. function RadialAxial(dict, matrix, xref, res) {
  47855. this.matrix = matrix;
  47856. this.coordsArr = dict.getArray('Coords');
  47857. this.shadingType = dict.get('ShadingType');
  47858. this.type = 'Pattern';
  47859. var cs = dict.get('ColorSpace', 'CS');
  47860. cs = ColorSpace.parse(cs, xref, res);
  47861. this.cs = cs;
  47862. var t0 = 0.0, t1 = 1.0;
  47863. if (dict.has('Domain')) {
  47864. var domainArr = dict.getArray('Domain');
  47865. t0 = domainArr[0];
  47866. t1 = domainArr[1];
  47867. }
  47868. var extendStart = false, extendEnd = false;
  47869. if (dict.has('Extend')) {
  47870. var extendArr = dict.getArray('Extend');
  47871. extendStart = extendArr[0];
  47872. extendEnd = extendArr[1];
  47873. }
  47874. if (this.shadingType === ShadingType.RADIAL && (!extendStart || !extendEnd)) {
  47875. var x1 = this.coordsArr[0];
  47876. var y1 = this.coordsArr[1];
  47877. var r1 = this.coordsArr[2];
  47878. var x2 = this.coordsArr[3];
  47879. var y2 = this.coordsArr[4];
  47880. var r2 = this.coordsArr[5];
  47881. var distance = Math.sqrt((x1 - x2) * (x1 - x2) + (y1 - y2) * (y1 - y2));
  47882. if (r1 <= r2 + distance && r2 <= r1 + distance) {
  47883. warn('Unsupported radial gradient.');
  47884. }
  47885. }
  47886. this.extendStart = extendStart;
  47887. this.extendEnd = extendEnd;
  47888. var fnObj = dict.get('Function');
  47889. var fn = PDFFunction.parseArray(xref, fnObj);
  47890. var diff = t1 - t0;
  47891. var step = diff / 10;
  47892. var colorStops = this.colorStops = [];
  47893. if (t0 >= t1 || step <= 0) {
  47894. info('Bad shading domain.');
  47895. return;
  47896. }
  47897. var color = new Float32Array(cs.numComps), ratio = new Float32Array(1);
  47898. var rgbColor;
  47899. for (var i = t0; i <= t1; i += step) {
  47900. ratio[0] = i;
  47901. fn(ratio, 0, color, 0);
  47902. rgbColor = cs.getRgb(color, 0);
  47903. var cssColor = Util.makeCssRgb(rgbColor[0], rgbColor[1], rgbColor[2]);
  47904. colorStops.push([
  47905. (i - t0) / diff,
  47906. cssColor
  47907. ]);
  47908. }
  47909. var background = 'transparent';
  47910. if (dict.has('Background')) {
  47911. rgbColor = cs.getRgb(dict.get('Background'), 0);
  47912. background = Util.makeCssRgb(rgbColor[0], rgbColor[1], rgbColor[2]);
  47913. }
  47914. if (!extendStart) {
  47915. colorStops.unshift([
  47916. 0,
  47917. background
  47918. ]);
  47919. colorStops[1][0] += Shadings.SMALL_NUMBER;
  47920. }
  47921. if (!extendEnd) {
  47922. colorStops[colorStops.length - 1][0] -= Shadings.SMALL_NUMBER;
  47923. colorStops.push([
  47924. 1,
  47925. background
  47926. ]);
  47927. }
  47928. this.colorStops = colorStops;
  47929. }
  47930. RadialAxial.prototype = {
  47931. getIR: function RadialAxial_getIR() {
  47932. var coordsArr = this.coordsArr;
  47933. var shadingType = this.shadingType;
  47934. var type, p0, p1, r0, r1;
  47935. if (shadingType === ShadingType.AXIAL) {
  47936. p0 = [
  47937. coordsArr[0],
  47938. coordsArr[1]
  47939. ];
  47940. p1 = [
  47941. coordsArr[2],
  47942. coordsArr[3]
  47943. ];
  47944. r0 = null;
  47945. r1 = null;
  47946. type = 'axial';
  47947. } else if (shadingType === ShadingType.RADIAL) {
  47948. p0 = [
  47949. coordsArr[0],
  47950. coordsArr[1]
  47951. ];
  47952. p1 = [
  47953. coordsArr[3],
  47954. coordsArr[4]
  47955. ];
  47956. r0 = coordsArr[2];
  47957. r1 = coordsArr[5];
  47958. type = 'radial';
  47959. } else {
  47960. error('getPattern type unknown: ' + shadingType);
  47961. }
  47962. var matrix = this.matrix;
  47963. if (matrix) {
  47964. p0 = Util.applyTransform(p0, matrix);
  47965. p1 = Util.applyTransform(p1, matrix);
  47966. if (shadingType === ShadingType.RADIAL) {
  47967. var scale = Util.singularValueDecompose2dScale(matrix);
  47968. r0 *= scale[0];
  47969. r1 *= scale[1];
  47970. }
  47971. }
  47972. return [
  47973. 'RadialAxial',
  47974. type,
  47975. this.colorStops,
  47976. p0,
  47977. p1,
  47978. r0,
  47979. r1
  47980. ];
  47981. }
  47982. };
  47983. return RadialAxial;
  47984. }();
  47985. Shadings.Mesh = function MeshClosure() {
  47986. function MeshStreamReader(stream, context) {
  47987. this.stream = stream;
  47988. this.context = context;
  47989. this.buffer = 0;
  47990. this.bufferLength = 0;
  47991. var numComps = context.numComps;
  47992. this.tmpCompsBuf = new Float32Array(numComps);
  47993. var csNumComps = context.colorSpace.numComps;
  47994. this.tmpCsCompsBuf = context.colorFn ? new Float32Array(csNumComps) : this.tmpCompsBuf;
  47995. }
  47996. MeshStreamReader.prototype = {
  47997. get hasData() {
  47998. if (this.stream.end) {
  47999. return this.stream.pos < this.stream.end;
  48000. }
  48001. if (this.bufferLength > 0) {
  48002. return true;
  48003. }
  48004. var nextByte = this.stream.getByte();
  48005. if (nextByte < 0) {
  48006. return false;
  48007. }
  48008. this.buffer = nextByte;
  48009. this.bufferLength = 8;
  48010. return true;
  48011. },
  48012. readBits: function MeshStreamReader_readBits(n) {
  48013. var buffer = this.buffer;
  48014. var bufferLength = this.bufferLength;
  48015. if (n === 32) {
  48016. if (bufferLength === 0) {
  48017. return (this.stream.getByte() << 24 | this.stream.getByte() << 16 | this.stream.getByte() << 8 | this.stream.getByte()) >>> 0;
  48018. }
  48019. buffer = buffer << 24 | this.stream.getByte() << 16 | this.stream.getByte() << 8 | this.stream.getByte();
  48020. var nextByte = this.stream.getByte();
  48021. this.buffer = nextByte & (1 << bufferLength) - 1;
  48022. return (buffer << 8 - bufferLength | (nextByte & 0xFF) >> bufferLength) >>> 0;
  48023. }
  48024. if (n === 8 && bufferLength === 0) {
  48025. return this.stream.getByte();
  48026. }
  48027. while (bufferLength < n) {
  48028. buffer = buffer << 8 | this.stream.getByte();
  48029. bufferLength += 8;
  48030. }
  48031. bufferLength -= n;
  48032. this.bufferLength = bufferLength;
  48033. this.buffer = buffer & (1 << bufferLength) - 1;
  48034. return buffer >> bufferLength;
  48035. },
  48036. align: function MeshStreamReader_align() {
  48037. this.buffer = 0;
  48038. this.bufferLength = 0;
  48039. },
  48040. readFlag: function MeshStreamReader_readFlag() {
  48041. return this.readBits(this.context.bitsPerFlag);
  48042. },
  48043. readCoordinate: function MeshStreamReader_readCoordinate() {
  48044. var bitsPerCoordinate = this.context.bitsPerCoordinate;
  48045. var xi = this.readBits(bitsPerCoordinate);
  48046. var yi = this.readBits(bitsPerCoordinate);
  48047. var decode = this.context.decode;
  48048. var scale = bitsPerCoordinate < 32 ? 1 / ((1 << bitsPerCoordinate) - 1) : 2.3283064365386963e-10;
  48049. return [
  48050. xi * scale * (decode[1] - decode[0]) + decode[0],
  48051. yi * scale * (decode[3] - decode[2]) + decode[2]
  48052. ];
  48053. },
  48054. readComponents: function MeshStreamReader_readComponents() {
  48055. var numComps = this.context.numComps;
  48056. var bitsPerComponent = this.context.bitsPerComponent;
  48057. var scale = bitsPerComponent < 32 ? 1 / ((1 << bitsPerComponent) - 1) : 2.3283064365386963e-10;
  48058. var decode = this.context.decode;
  48059. var components = this.tmpCompsBuf;
  48060. for (var i = 0, j = 4; i < numComps; i++, j += 2) {
  48061. var ci = this.readBits(bitsPerComponent);
  48062. components[i] = ci * scale * (decode[j + 1] - decode[j]) + decode[j];
  48063. }
  48064. var color = this.tmpCsCompsBuf;
  48065. if (this.context.colorFn) {
  48066. this.context.colorFn(components, 0, color, 0);
  48067. }
  48068. return this.context.colorSpace.getRgb(color, 0);
  48069. }
  48070. };
  48071. function decodeType4Shading(mesh, reader) {
  48072. var coords = mesh.coords;
  48073. var colors = mesh.colors;
  48074. var operators = [];
  48075. var ps = [];
  48076. var verticesLeft = 0;
  48077. while (reader.hasData) {
  48078. var f = reader.readFlag();
  48079. var coord = reader.readCoordinate();
  48080. var color = reader.readComponents();
  48081. if (verticesLeft === 0) {
  48082. assert(0 <= f && f <= 2, 'Unknown type4 flag');
  48083. switch (f) {
  48084. case 0:
  48085. verticesLeft = 3;
  48086. break;
  48087. case 1:
  48088. ps.push(ps[ps.length - 2], ps[ps.length - 1]);
  48089. verticesLeft = 1;
  48090. break;
  48091. case 2:
  48092. ps.push(ps[ps.length - 3], ps[ps.length - 1]);
  48093. verticesLeft = 1;
  48094. break;
  48095. }
  48096. operators.push(f);
  48097. }
  48098. ps.push(coords.length);
  48099. coords.push(coord);
  48100. colors.push(color);
  48101. verticesLeft--;
  48102. reader.align();
  48103. }
  48104. mesh.figures.push({
  48105. type: 'triangles',
  48106. coords: new Int32Array(ps),
  48107. colors: new Int32Array(ps)
  48108. });
  48109. }
  48110. function decodeType5Shading(mesh, reader, verticesPerRow) {
  48111. var coords = mesh.coords;
  48112. var colors = mesh.colors;
  48113. var ps = [];
  48114. while (reader.hasData) {
  48115. var coord = reader.readCoordinate();
  48116. var color = reader.readComponents();
  48117. ps.push(coords.length);
  48118. coords.push(coord);
  48119. colors.push(color);
  48120. }
  48121. mesh.figures.push({
  48122. type: 'lattice',
  48123. coords: new Int32Array(ps),
  48124. colors: new Int32Array(ps),
  48125. verticesPerRow: verticesPerRow
  48126. });
  48127. }
  48128. var MIN_SPLIT_PATCH_CHUNKS_AMOUNT = 3;
  48129. var MAX_SPLIT_PATCH_CHUNKS_AMOUNT = 20;
  48130. var TRIANGLE_DENSITY = 20;
  48131. var getB = function getBClosure() {
  48132. function buildB(count) {
  48133. var lut = [];
  48134. for (var i = 0; i <= count; i++) {
  48135. var t = i / count, t_ = 1 - t;
  48136. lut.push(new Float32Array([
  48137. t_ * t_ * t_,
  48138. 3 * t * t_ * t_,
  48139. 3 * t * t * t_,
  48140. t * t * t
  48141. ]));
  48142. }
  48143. return lut;
  48144. }
  48145. var cache = [];
  48146. return function getB(count) {
  48147. if (!cache[count]) {
  48148. cache[count] = buildB(count);
  48149. }
  48150. return cache[count];
  48151. };
  48152. }();
  48153. function buildFigureFromPatch(mesh, index) {
  48154. var figure = mesh.figures[index];
  48155. assert(figure.type === 'patch', 'Unexpected patch mesh figure');
  48156. var coords = mesh.coords, colors = mesh.colors;
  48157. var pi = figure.coords;
  48158. var ci = figure.colors;
  48159. var figureMinX = Math.min(coords[pi[0]][0], coords[pi[3]][0], coords[pi[12]][0], coords[pi[15]][0]);
  48160. var figureMinY = Math.min(coords[pi[0]][1], coords[pi[3]][1], coords[pi[12]][1], coords[pi[15]][1]);
  48161. var figureMaxX = Math.max(coords[pi[0]][0], coords[pi[3]][0], coords[pi[12]][0], coords[pi[15]][0]);
  48162. var figureMaxY = Math.max(coords[pi[0]][1], coords[pi[3]][1], coords[pi[12]][1], coords[pi[15]][1]);
  48163. var splitXBy = Math.ceil((figureMaxX - figureMinX) * TRIANGLE_DENSITY / (mesh.bounds[2] - mesh.bounds[0]));
  48164. splitXBy = Math.max(MIN_SPLIT_PATCH_CHUNKS_AMOUNT, Math.min(MAX_SPLIT_PATCH_CHUNKS_AMOUNT, splitXBy));
  48165. var splitYBy = Math.ceil((figureMaxY - figureMinY) * TRIANGLE_DENSITY / (mesh.bounds[3] - mesh.bounds[1]));
  48166. splitYBy = Math.max(MIN_SPLIT_PATCH_CHUNKS_AMOUNT, Math.min(MAX_SPLIT_PATCH_CHUNKS_AMOUNT, splitYBy));
  48167. var verticesPerRow = splitXBy + 1;
  48168. var figureCoords = new Int32Array((splitYBy + 1) * verticesPerRow);
  48169. var figureColors = new Int32Array((splitYBy + 1) * verticesPerRow);
  48170. var k = 0;
  48171. var cl = new Uint8Array(3), cr = new Uint8Array(3);
  48172. var c0 = colors[ci[0]], c1 = colors[ci[1]], c2 = colors[ci[2]], c3 = colors[ci[3]];
  48173. var bRow = getB(splitYBy), bCol = getB(splitXBy);
  48174. for (var row = 0; row <= splitYBy; row++) {
  48175. cl[0] = (c0[0] * (splitYBy - row) + c2[0] * row) / splitYBy | 0;
  48176. cl[1] = (c0[1] * (splitYBy - row) + c2[1] * row) / splitYBy | 0;
  48177. cl[2] = (c0[2] * (splitYBy - row) + c2[2] * row) / splitYBy | 0;
  48178. cr[0] = (c1[0] * (splitYBy - row) + c3[0] * row) / splitYBy | 0;
  48179. cr[1] = (c1[1] * (splitYBy - row) + c3[1] * row) / splitYBy | 0;
  48180. cr[2] = (c1[2] * (splitYBy - row) + c3[2] * row) / splitYBy | 0;
  48181. for (var col = 0; col <= splitXBy; col++, k++) {
  48182. if ((row === 0 || row === splitYBy) && (col === 0 || col === splitXBy)) {
  48183. continue;
  48184. }
  48185. var x = 0, y = 0;
  48186. var q = 0;
  48187. for (var i = 0; i <= 3; i++) {
  48188. for (var j = 0; j <= 3; j++, q++) {
  48189. var m = bRow[row][i] * bCol[col][j];
  48190. x += coords[pi[q]][0] * m;
  48191. y += coords[pi[q]][1] * m;
  48192. }
  48193. }
  48194. figureCoords[k] = coords.length;
  48195. coords.push([
  48196. x,
  48197. y
  48198. ]);
  48199. figureColors[k] = colors.length;
  48200. var newColor = new Uint8Array(3);
  48201. newColor[0] = (cl[0] * (splitXBy - col) + cr[0] * col) / splitXBy | 0;
  48202. newColor[1] = (cl[1] * (splitXBy - col) + cr[1] * col) / splitXBy | 0;
  48203. newColor[2] = (cl[2] * (splitXBy - col) + cr[2] * col) / splitXBy | 0;
  48204. colors.push(newColor);
  48205. }
  48206. }
  48207. figureCoords[0] = pi[0];
  48208. figureColors[0] = ci[0];
  48209. figureCoords[splitXBy] = pi[3];
  48210. figureColors[splitXBy] = ci[1];
  48211. figureCoords[verticesPerRow * splitYBy] = pi[12];
  48212. figureColors[verticesPerRow * splitYBy] = ci[2];
  48213. figureCoords[verticesPerRow * splitYBy + splitXBy] = pi[15];
  48214. figureColors[verticesPerRow * splitYBy + splitXBy] = ci[3];
  48215. mesh.figures[index] = {
  48216. type: 'lattice',
  48217. coords: figureCoords,
  48218. colors: figureColors,
  48219. verticesPerRow: verticesPerRow
  48220. };
  48221. }
  48222. function decodeType6Shading(mesh, reader) {
  48223. var coords = mesh.coords;
  48224. var colors = mesh.colors;
  48225. var ps = new Int32Array(16);
  48226. var cs = new Int32Array(4);
  48227. while (reader.hasData) {
  48228. var f = reader.readFlag();
  48229. assert(0 <= f && f <= 3, 'Unknown type6 flag');
  48230. var i, ii;
  48231. var pi = coords.length;
  48232. for (i = 0, ii = f !== 0 ? 8 : 12; i < ii; i++) {
  48233. coords.push(reader.readCoordinate());
  48234. }
  48235. var ci = colors.length;
  48236. for (i = 0, ii = f !== 0 ? 2 : 4; i < ii; i++) {
  48237. colors.push(reader.readComponents());
  48238. }
  48239. var tmp1, tmp2, tmp3, tmp4;
  48240. switch (f) {
  48241. case 0:
  48242. ps[12] = pi + 3;
  48243. ps[13] = pi + 4;
  48244. ps[14] = pi + 5;
  48245. ps[15] = pi + 6;
  48246. ps[8] = pi + 2;
  48247. ps[11] = pi + 7;
  48248. ps[4] = pi + 1;
  48249. ps[7] = pi + 8;
  48250. ps[0] = pi;
  48251. ps[1] = pi + 11;
  48252. ps[2] = pi + 10;
  48253. ps[3] = pi + 9;
  48254. cs[2] = ci + 1;
  48255. cs[3] = ci + 2;
  48256. cs[0] = ci;
  48257. cs[1] = ci + 3;
  48258. break;
  48259. case 1:
  48260. tmp1 = ps[12];
  48261. tmp2 = ps[13];
  48262. tmp3 = ps[14];
  48263. tmp4 = ps[15];
  48264. ps[12] = tmp4;
  48265. ps[13] = pi + 0;
  48266. ps[14] = pi + 1;
  48267. ps[15] = pi + 2;
  48268. ps[8] = tmp3;
  48269. ps[11] = pi + 3;
  48270. ps[4] = tmp2;
  48271. ps[7] = pi + 4;
  48272. ps[0] = tmp1;
  48273. ps[1] = pi + 7;
  48274. ps[2] = pi + 6;
  48275. ps[3] = pi + 5;
  48276. tmp1 = cs[2];
  48277. tmp2 = cs[3];
  48278. cs[2] = tmp2;
  48279. cs[3] = ci;
  48280. cs[0] = tmp1;
  48281. cs[1] = ci + 1;
  48282. break;
  48283. case 2:
  48284. tmp1 = ps[15];
  48285. tmp2 = ps[11];
  48286. ps[12] = ps[3];
  48287. ps[13] = pi + 0;
  48288. ps[14] = pi + 1;
  48289. ps[15] = pi + 2;
  48290. ps[8] = ps[7];
  48291. ps[11] = pi + 3;
  48292. ps[4] = tmp2;
  48293. ps[7] = pi + 4;
  48294. ps[0] = tmp1;
  48295. ps[1] = pi + 7;
  48296. ps[2] = pi + 6;
  48297. ps[3] = pi + 5;
  48298. tmp1 = cs[3];
  48299. cs[2] = cs[1];
  48300. cs[3] = ci;
  48301. cs[0] = tmp1;
  48302. cs[1] = ci + 1;
  48303. break;
  48304. case 3:
  48305. ps[12] = ps[0];
  48306. ps[13] = pi + 0;
  48307. ps[14] = pi + 1;
  48308. ps[15] = pi + 2;
  48309. ps[8] = ps[1];
  48310. ps[11] = pi + 3;
  48311. ps[4] = ps[2];
  48312. ps[7] = pi + 4;
  48313. ps[0] = ps[3];
  48314. ps[1] = pi + 7;
  48315. ps[2] = pi + 6;
  48316. ps[3] = pi + 5;
  48317. cs[2] = cs[0];
  48318. cs[3] = ci;
  48319. cs[0] = cs[1];
  48320. cs[1] = ci + 1;
  48321. break;
  48322. }
  48323. ps[5] = coords.length;
  48324. coords.push([
  48325. (-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,
  48326. (-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
  48327. ]);
  48328. ps[6] = coords.length;
  48329. coords.push([
  48330. (-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,
  48331. (-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
  48332. ]);
  48333. ps[9] = coords.length;
  48334. coords.push([
  48335. (-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,
  48336. (-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
  48337. ]);
  48338. ps[10] = coords.length;
  48339. coords.push([
  48340. (-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,
  48341. (-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
  48342. ]);
  48343. mesh.figures.push({
  48344. type: 'patch',
  48345. coords: new Int32Array(ps),
  48346. colors: new Int32Array(cs)
  48347. });
  48348. }
  48349. }
  48350. function decodeType7Shading(mesh, reader) {
  48351. var coords = mesh.coords;
  48352. var colors = mesh.colors;
  48353. var ps = new Int32Array(16);
  48354. var cs = new Int32Array(4);
  48355. while (reader.hasData) {
  48356. var f = reader.readFlag();
  48357. assert(0 <= f && f <= 3, 'Unknown type7 flag');
  48358. var i, ii;
  48359. var pi = coords.length;
  48360. for (i = 0, ii = f !== 0 ? 12 : 16; i < ii; i++) {
  48361. coords.push(reader.readCoordinate());
  48362. }
  48363. var ci = colors.length;
  48364. for (i = 0, ii = f !== 0 ? 2 : 4; i < ii; i++) {
  48365. colors.push(reader.readComponents());
  48366. }
  48367. var tmp1, tmp2, tmp3, tmp4;
  48368. switch (f) {
  48369. case 0:
  48370. ps[12] = pi + 3;
  48371. ps[13] = pi + 4;
  48372. ps[14] = pi + 5;
  48373. ps[15] = pi + 6;
  48374. ps[8] = pi + 2;
  48375. ps[9] = pi + 13;
  48376. ps[10] = pi + 14;
  48377. ps[11] = pi + 7;
  48378. ps[4] = pi + 1;
  48379. ps[5] = pi + 12;
  48380. ps[6] = pi + 15;
  48381. ps[7] = pi + 8;
  48382. ps[0] = pi;
  48383. ps[1] = pi + 11;
  48384. ps[2] = pi + 10;
  48385. ps[3] = pi + 9;
  48386. cs[2] = ci + 1;
  48387. cs[3] = ci + 2;
  48388. cs[0] = ci;
  48389. cs[1] = ci + 3;
  48390. break;
  48391. case 1:
  48392. tmp1 = ps[12];
  48393. tmp2 = ps[13];
  48394. tmp3 = ps[14];
  48395. tmp4 = ps[15];
  48396. ps[12] = tmp4;
  48397. ps[13] = pi + 0;
  48398. ps[14] = pi + 1;
  48399. ps[15] = pi + 2;
  48400. ps[8] = tmp3;
  48401. ps[9] = pi + 9;
  48402. ps[10] = pi + 10;
  48403. ps[11] = pi + 3;
  48404. ps[4] = tmp2;
  48405. ps[5] = pi + 8;
  48406. ps[6] = pi + 11;
  48407. ps[7] = pi + 4;
  48408. ps[0] = tmp1;
  48409. ps[1] = pi + 7;
  48410. ps[2] = pi + 6;
  48411. ps[3] = pi + 5;
  48412. tmp1 = cs[2];
  48413. tmp2 = cs[3];
  48414. cs[2] = tmp2;
  48415. cs[3] = ci;
  48416. cs[0] = tmp1;
  48417. cs[1] = ci + 1;
  48418. break;
  48419. case 2:
  48420. tmp1 = ps[15];
  48421. tmp2 = ps[11];
  48422. ps[12] = ps[3];
  48423. ps[13] = pi + 0;
  48424. ps[14] = pi + 1;
  48425. ps[15] = pi + 2;
  48426. ps[8] = ps[7];
  48427. ps[9] = pi + 9;
  48428. ps[10] = pi + 10;
  48429. ps[11] = pi + 3;
  48430. ps[4] = tmp2;
  48431. ps[5] = pi + 8;
  48432. ps[6] = pi + 11;
  48433. ps[7] = pi + 4;
  48434. ps[0] = tmp1;
  48435. ps[1] = pi + 7;
  48436. ps[2] = pi + 6;
  48437. ps[3] = pi + 5;
  48438. tmp1 = cs[3];
  48439. cs[2] = cs[1];
  48440. cs[3] = ci;
  48441. cs[0] = tmp1;
  48442. cs[1] = ci + 1;
  48443. break;
  48444. case 3:
  48445. ps[12] = ps[0];
  48446. ps[13] = pi + 0;
  48447. ps[14] = pi + 1;
  48448. ps[15] = pi + 2;
  48449. ps[8] = ps[1];
  48450. ps[9] = pi + 9;
  48451. ps[10] = pi + 10;
  48452. ps[11] = pi + 3;
  48453. ps[4] = ps[2];
  48454. ps[5] = pi + 8;
  48455. ps[6] = pi + 11;
  48456. ps[7] = pi + 4;
  48457. ps[0] = ps[3];
  48458. ps[1] = pi + 7;
  48459. ps[2] = pi + 6;
  48460. ps[3] = pi + 5;
  48461. cs[2] = cs[0];
  48462. cs[3] = ci;
  48463. cs[0] = cs[1];
  48464. cs[1] = ci + 1;
  48465. break;
  48466. }
  48467. mesh.figures.push({
  48468. type: 'patch',
  48469. coords: new Int32Array(ps),
  48470. colors: new Int32Array(cs)
  48471. });
  48472. }
  48473. }
  48474. function updateBounds(mesh) {
  48475. var minX = mesh.coords[0][0], minY = mesh.coords[0][1], maxX = minX, maxY = minY;
  48476. for (var i = 1, ii = mesh.coords.length; i < ii; i++) {
  48477. var x = mesh.coords[i][0], y = mesh.coords[i][1];
  48478. minX = minX > x ? x : minX;
  48479. minY = minY > y ? y : minY;
  48480. maxX = maxX < x ? x : maxX;
  48481. maxY = maxY < y ? y : maxY;
  48482. }
  48483. mesh.bounds = [
  48484. minX,
  48485. minY,
  48486. maxX,
  48487. maxY
  48488. ];
  48489. }
  48490. function packData(mesh) {
  48491. var i, ii, j, jj;
  48492. var coords = mesh.coords;
  48493. var coordsPacked = new Float32Array(coords.length * 2);
  48494. for (i = 0, j = 0, ii = coords.length; i < ii; i++) {
  48495. var xy = coords[i];
  48496. coordsPacked[j++] = xy[0];
  48497. coordsPacked[j++] = xy[1];
  48498. }
  48499. mesh.coords = coordsPacked;
  48500. var colors = mesh.colors;
  48501. var colorsPacked = new Uint8Array(colors.length * 3);
  48502. for (i = 0, j = 0, ii = colors.length; i < ii; i++) {
  48503. var c = colors[i];
  48504. colorsPacked[j++] = c[0];
  48505. colorsPacked[j++] = c[1];
  48506. colorsPacked[j++] = c[2];
  48507. }
  48508. mesh.colors = colorsPacked;
  48509. var figures = mesh.figures;
  48510. for (i = 0, ii = figures.length; i < ii; i++) {
  48511. var figure = figures[i], ps = figure.coords, cs = figure.colors;
  48512. for (j = 0, jj = ps.length; j < jj; j++) {
  48513. ps[j] *= 2;
  48514. cs[j] *= 3;
  48515. }
  48516. }
  48517. }
  48518. function Mesh(stream, matrix, xref, res) {
  48519. assert(isStream(stream), 'Mesh data is not a stream');
  48520. var dict = stream.dict;
  48521. this.matrix = matrix;
  48522. this.shadingType = dict.get('ShadingType');
  48523. this.type = 'Pattern';
  48524. this.bbox = dict.getArray('BBox');
  48525. var cs = dict.get('ColorSpace', 'CS');
  48526. cs = ColorSpace.parse(cs, xref, res);
  48527. this.cs = cs;
  48528. this.background = dict.has('Background') ? cs.getRgb(dict.get('Background'), 0) : null;
  48529. var fnObj = dict.get('Function');
  48530. var fn = fnObj ? PDFFunction.parseArray(xref, fnObj) : null;
  48531. this.coords = [];
  48532. this.colors = [];
  48533. this.figures = [];
  48534. var decodeContext = {
  48535. bitsPerCoordinate: dict.get('BitsPerCoordinate'),
  48536. bitsPerComponent: dict.get('BitsPerComponent'),
  48537. bitsPerFlag: dict.get('BitsPerFlag'),
  48538. decode: dict.getArray('Decode'),
  48539. colorFn: fn,
  48540. colorSpace: cs,
  48541. numComps: fn ? 1 : cs.numComps
  48542. };
  48543. var reader = new MeshStreamReader(stream, decodeContext);
  48544. var patchMesh = false;
  48545. switch (this.shadingType) {
  48546. case ShadingType.FREE_FORM_MESH:
  48547. decodeType4Shading(this, reader);
  48548. break;
  48549. case ShadingType.LATTICE_FORM_MESH:
  48550. var verticesPerRow = dict.get('VerticesPerRow') | 0;
  48551. assert(verticesPerRow >= 2, 'Invalid VerticesPerRow');
  48552. decodeType5Shading(this, reader, verticesPerRow);
  48553. break;
  48554. case ShadingType.COONS_PATCH_MESH:
  48555. decodeType6Shading(this, reader);
  48556. patchMesh = true;
  48557. break;
  48558. case ShadingType.TENSOR_PATCH_MESH:
  48559. decodeType7Shading(this, reader);
  48560. patchMesh = true;
  48561. break;
  48562. default:
  48563. error('Unsupported mesh type.');
  48564. break;
  48565. }
  48566. if (patchMesh) {
  48567. updateBounds(this);
  48568. for (var i = 0, ii = this.figures.length; i < ii; i++) {
  48569. buildFigureFromPatch(this, i);
  48570. }
  48571. }
  48572. updateBounds(this);
  48573. packData(this);
  48574. }
  48575. Mesh.prototype = {
  48576. getIR: function Mesh_getIR() {
  48577. return [
  48578. 'Mesh',
  48579. this.shadingType,
  48580. this.coords,
  48581. this.colors,
  48582. this.figures,
  48583. this.bounds,
  48584. this.matrix,
  48585. this.bbox,
  48586. this.background
  48587. ];
  48588. }
  48589. };
  48590. return Mesh;
  48591. }();
  48592. Shadings.Dummy = function DummyClosure() {
  48593. function Dummy() {
  48594. this.type = 'Pattern';
  48595. }
  48596. Dummy.prototype = {
  48597. getIR: function Dummy_getIR() {
  48598. return ['Dummy'];
  48599. }
  48600. };
  48601. return Dummy;
  48602. }();
  48603. function getTilingPatternIR(operatorList, dict, args) {
  48604. var matrix = dict.getArray('Matrix');
  48605. var bbox = dict.getArray('BBox');
  48606. var xstep = dict.get('XStep');
  48607. var ystep = dict.get('YStep');
  48608. var paintType = dict.get('PaintType');
  48609. var tilingType = dict.get('TilingType');
  48610. return [
  48611. 'TilingPattern',
  48612. args,
  48613. operatorList,
  48614. matrix,
  48615. bbox,
  48616. xstep,
  48617. ystep,
  48618. paintType,
  48619. tilingType
  48620. ];
  48621. }
  48622. exports.Pattern = Pattern;
  48623. exports.getTilingPatternIR = getTilingPatternIR;
  48624. /***/ }),
  48625. /* 33 */
  48626. /***/ (function(module, exports, __w_pdfjs_require__) {
  48627. "use strict";
  48628. var sharedUtil = __w_pdfjs_require__(0);
  48629. var coreStream = __w_pdfjs_require__(2);
  48630. var coreChunkedStream = __w_pdfjs_require__(12);
  48631. var coreDocument = __w_pdfjs_require__(24);
  48632. var warn = sharedUtil.warn;
  48633. var createValidAbsoluteUrl = sharedUtil.createValidAbsoluteUrl;
  48634. var shadow = sharedUtil.shadow;
  48635. var NotImplementedException = sharedUtil.NotImplementedException;
  48636. var MissingDataException = sharedUtil.MissingDataException;
  48637. var createPromiseCapability = sharedUtil.createPromiseCapability;
  48638. var Util = sharedUtil.Util;
  48639. var Stream = coreStream.Stream;
  48640. var ChunkedStreamManager = coreChunkedStream.ChunkedStreamManager;
  48641. var PDFDocument = coreDocument.PDFDocument;
  48642. var BasePdfManager = function BasePdfManagerClosure() {
  48643. function BasePdfManager() {
  48644. throw new Error('Cannot initialize BaseManagerManager');
  48645. }
  48646. BasePdfManager.prototype = {
  48647. get docId() {
  48648. return this._docId;
  48649. },
  48650. get password() {
  48651. return this._password;
  48652. },
  48653. get docBaseUrl() {
  48654. var docBaseUrl = null;
  48655. if (this._docBaseUrl) {
  48656. var absoluteUrl = createValidAbsoluteUrl(this._docBaseUrl);
  48657. if (absoluteUrl) {
  48658. docBaseUrl = absoluteUrl.href;
  48659. } else {
  48660. warn('Invalid absolute docBaseUrl: "' + this._docBaseUrl + '".');
  48661. }
  48662. }
  48663. return shadow(this, 'docBaseUrl', docBaseUrl);
  48664. },
  48665. onLoadedStream: function BasePdfManager_onLoadedStream() {
  48666. throw new NotImplementedException();
  48667. },
  48668. ensureDoc: function BasePdfManager_ensureDoc(prop, args) {
  48669. return this.ensure(this.pdfDocument, prop, args);
  48670. },
  48671. ensureXRef: function BasePdfManager_ensureXRef(prop, args) {
  48672. return this.ensure(this.pdfDocument.xref, prop, args);
  48673. },
  48674. ensureCatalog: function BasePdfManager_ensureCatalog(prop, args) {
  48675. return this.ensure(this.pdfDocument.catalog, prop, args);
  48676. },
  48677. getPage: function BasePdfManager_getPage(pageIndex) {
  48678. return this.pdfDocument.getPage(pageIndex);
  48679. },
  48680. cleanup: function BasePdfManager_cleanup() {
  48681. return this.pdfDocument.cleanup();
  48682. },
  48683. ensure: function BasePdfManager_ensure(obj, prop, args) {
  48684. return new NotImplementedException();
  48685. },
  48686. requestRange: function BasePdfManager_requestRange(begin, end) {
  48687. return new NotImplementedException();
  48688. },
  48689. requestLoadedStream: function BasePdfManager_requestLoadedStream() {
  48690. return new NotImplementedException();
  48691. },
  48692. sendProgressiveData: function BasePdfManager_sendProgressiveData(chunk) {
  48693. return new NotImplementedException();
  48694. },
  48695. updatePassword: function BasePdfManager_updatePassword(password) {
  48696. this._password = password;
  48697. },
  48698. terminate: function BasePdfManager_terminate() {
  48699. return new NotImplementedException();
  48700. }
  48701. };
  48702. return BasePdfManager;
  48703. }();
  48704. var LocalPdfManager = function LocalPdfManagerClosure() {
  48705. function LocalPdfManager(docId, data, password, evaluatorOptions, docBaseUrl) {
  48706. this._docId = docId;
  48707. this._password = password;
  48708. this._docBaseUrl = docBaseUrl;
  48709. this.evaluatorOptions = evaluatorOptions;
  48710. var stream = new Stream(data);
  48711. this.pdfDocument = new PDFDocument(this, stream);
  48712. this._loadedStreamCapability = createPromiseCapability();
  48713. this._loadedStreamCapability.resolve(stream);
  48714. }
  48715. Util.inherit(LocalPdfManager, BasePdfManager, {
  48716. ensure: function LocalPdfManager_ensure(obj, prop, args) {
  48717. return new Promise(function (resolve, reject) {
  48718. try {
  48719. var value = obj[prop];
  48720. var result;
  48721. if (typeof value === 'function') {
  48722. result = value.apply(obj, args);
  48723. } else {
  48724. result = value;
  48725. }
  48726. resolve(result);
  48727. } catch (e) {
  48728. reject(e);
  48729. }
  48730. });
  48731. },
  48732. requestRange: function LocalPdfManager_requestRange(begin, end) {
  48733. return Promise.resolve();
  48734. },
  48735. requestLoadedStream: function LocalPdfManager_requestLoadedStream() {
  48736. },
  48737. onLoadedStream: function LocalPdfManager_onLoadedStream() {
  48738. return this._loadedStreamCapability.promise;
  48739. },
  48740. terminate: function LocalPdfManager_terminate() {
  48741. }
  48742. });
  48743. return LocalPdfManager;
  48744. }();
  48745. var NetworkPdfManager = function NetworkPdfManagerClosure() {
  48746. function NetworkPdfManager(docId, pdfNetworkStream, args, evaluatorOptions, docBaseUrl) {
  48747. this._docId = docId;
  48748. this._password = args.password;
  48749. this._docBaseUrl = docBaseUrl;
  48750. this.msgHandler = args.msgHandler;
  48751. this.evaluatorOptions = evaluatorOptions;
  48752. var params = {
  48753. msgHandler: args.msgHandler,
  48754. url: args.url,
  48755. length: args.length,
  48756. disableAutoFetch: args.disableAutoFetch,
  48757. rangeChunkSize: args.rangeChunkSize
  48758. };
  48759. this.streamManager = new ChunkedStreamManager(pdfNetworkStream, params);
  48760. this.pdfDocument = new PDFDocument(this, this.streamManager.getStream());
  48761. }
  48762. Util.inherit(NetworkPdfManager, BasePdfManager, {
  48763. ensure: function NetworkPdfManager_ensure(obj, prop, args) {
  48764. var pdfManager = this;
  48765. return new Promise(function (resolve, reject) {
  48766. function ensureHelper() {
  48767. try {
  48768. var result;
  48769. var value = obj[prop];
  48770. if (typeof value === 'function') {
  48771. result = value.apply(obj, args);
  48772. } else {
  48773. result = value;
  48774. }
  48775. resolve(result);
  48776. } catch (e) {
  48777. if (!(e instanceof MissingDataException)) {
  48778. reject(e);
  48779. return;
  48780. }
  48781. pdfManager.streamManager.requestRange(e.begin, e.end).then(ensureHelper, reject);
  48782. }
  48783. }
  48784. ensureHelper();
  48785. });
  48786. },
  48787. requestRange: function NetworkPdfManager_requestRange(begin, end) {
  48788. return this.streamManager.requestRange(begin, end);
  48789. },
  48790. requestLoadedStream: function NetworkPdfManager_requestLoadedStream() {
  48791. this.streamManager.requestAllChunks();
  48792. },
  48793. sendProgressiveData: function NetworkPdfManager_sendProgressiveData(chunk) {
  48794. this.streamManager.onReceiveData({ chunk: chunk });
  48795. },
  48796. onLoadedStream: function NetworkPdfManager_onLoadedStream() {
  48797. return this.streamManager.onLoadedStream();
  48798. },
  48799. terminate: function NetworkPdfManager_terminate() {
  48800. this.streamManager.abort();
  48801. }
  48802. });
  48803. return NetworkPdfManager;
  48804. }();
  48805. exports.LocalPdfManager = LocalPdfManager;
  48806. exports.NetworkPdfManager = NetworkPdfManager;
  48807. /***/ }),
  48808. /* 34 */
  48809. /***/ (function(module, exports, __w_pdfjs_require__) {
  48810. "use strict";
  48811. var sharedUtil = __w_pdfjs_require__(0);
  48812. var corePrimitives = __w_pdfjs_require__(1);
  48813. var error = sharedUtil.error;
  48814. var isSpace = sharedUtil.isSpace;
  48815. var EOF = corePrimitives.EOF;
  48816. var PostScriptParser = function PostScriptParserClosure() {
  48817. function PostScriptParser(lexer) {
  48818. this.lexer = lexer;
  48819. this.operators = [];
  48820. this.token = null;
  48821. this.prev = null;
  48822. }
  48823. PostScriptParser.prototype = {
  48824. nextToken: function PostScriptParser_nextToken() {
  48825. this.prev = this.token;
  48826. this.token = this.lexer.getToken();
  48827. },
  48828. accept: function PostScriptParser_accept(type) {
  48829. if (this.token.type === type) {
  48830. this.nextToken();
  48831. return true;
  48832. }
  48833. return false;
  48834. },
  48835. expect: function PostScriptParser_expect(type) {
  48836. if (this.accept(type)) {
  48837. return true;
  48838. }
  48839. error('Unexpected symbol: found ' + this.token.type + ' expected ' + type + '.');
  48840. },
  48841. parse: function PostScriptParser_parse() {
  48842. this.nextToken();
  48843. this.expect(PostScriptTokenTypes.LBRACE);
  48844. this.parseBlock();
  48845. this.expect(PostScriptTokenTypes.RBRACE);
  48846. return this.operators;
  48847. },
  48848. parseBlock: function PostScriptParser_parseBlock() {
  48849. while (true) {
  48850. if (this.accept(PostScriptTokenTypes.NUMBER)) {
  48851. this.operators.push(this.prev.value);
  48852. } else if (this.accept(PostScriptTokenTypes.OPERATOR)) {
  48853. this.operators.push(this.prev.value);
  48854. } else if (this.accept(PostScriptTokenTypes.LBRACE)) {
  48855. this.parseCondition();
  48856. } else {
  48857. return;
  48858. }
  48859. }
  48860. },
  48861. parseCondition: function PostScriptParser_parseCondition() {
  48862. var conditionLocation = this.operators.length;
  48863. this.operators.push(null, null);
  48864. this.parseBlock();
  48865. this.expect(PostScriptTokenTypes.RBRACE);
  48866. if (this.accept(PostScriptTokenTypes.IF)) {
  48867. this.operators[conditionLocation] = this.operators.length;
  48868. this.operators[conditionLocation + 1] = 'jz';
  48869. } else if (this.accept(PostScriptTokenTypes.LBRACE)) {
  48870. var jumpLocation = this.operators.length;
  48871. this.operators.push(null, null);
  48872. var endOfTrue = this.operators.length;
  48873. this.parseBlock();
  48874. this.expect(PostScriptTokenTypes.RBRACE);
  48875. this.expect(PostScriptTokenTypes.IFELSE);
  48876. this.operators[jumpLocation] = this.operators.length;
  48877. this.operators[jumpLocation + 1] = 'j';
  48878. this.operators[conditionLocation] = endOfTrue;
  48879. this.operators[conditionLocation + 1] = 'jz';
  48880. } else {
  48881. error('PS Function: error parsing conditional.');
  48882. }
  48883. }
  48884. };
  48885. return PostScriptParser;
  48886. }();
  48887. var PostScriptTokenTypes = {
  48888. LBRACE: 0,
  48889. RBRACE: 1,
  48890. NUMBER: 2,
  48891. OPERATOR: 3,
  48892. IF: 4,
  48893. IFELSE: 5
  48894. };
  48895. var PostScriptToken = function PostScriptTokenClosure() {
  48896. function PostScriptToken(type, value) {
  48897. this.type = type;
  48898. this.value = value;
  48899. }
  48900. var opCache = Object.create(null);
  48901. PostScriptToken.getOperator = function PostScriptToken_getOperator(op) {
  48902. var opValue = opCache[op];
  48903. if (opValue) {
  48904. return opValue;
  48905. }
  48906. return opCache[op] = new PostScriptToken(PostScriptTokenTypes.OPERATOR, op);
  48907. };
  48908. PostScriptToken.LBRACE = new PostScriptToken(PostScriptTokenTypes.LBRACE, '{');
  48909. PostScriptToken.RBRACE = new PostScriptToken(PostScriptTokenTypes.RBRACE, '}');
  48910. PostScriptToken.IF = new PostScriptToken(PostScriptTokenTypes.IF, 'IF');
  48911. PostScriptToken.IFELSE = new PostScriptToken(PostScriptTokenTypes.IFELSE, 'IFELSE');
  48912. return PostScriptToken;
  48913. }();
  48914. var PostScriptLexer = function PostScriptLexerClosure() {
  48915. function PostScriptLexer(stream) {
  48916. this.stream = stream;
  48917. this.nextChar();
  48918. this.strBuf = [];
  48919. }
  48920. PostScriptLexer.prototype = {
  48921. nextChar: function PostScriptLexer_nextChar() {
  48922. return this.currentChar = this.stream.getByte();
  48923. },
  48924. getToken: function PostScriptLexer_getToken() {
  48925. var comment = false;
  48926. var ch = this.currentChar;
  48927. while (true) {
  48928. if (ch < 0) {
  48929. return EOF;
  48930. }
  48931. if (comment) {
  48932. if (ch === 0x0A || ch === 0x0D) {
  48933. comment = false;
  48934. }
  48935. } else if (ch === 0x25) {
  48936. comment = true;
  48937. } else if (!isSpace(ch)) {
  48938. break;
  48939. }
  48940. ch = this.nextChar();
  48941. }
  48942. switch (ch | 0) {
  48943. case 0x30:
  48944. case 0x31:
  48945. case 0x32:
  48946. case 0x33:
  48947. case 0x34:
  48948. case 0x35:
  48949. case 0x36:
  48950. case 0x37:
  48951. case 0x38:
  48952. case 0x39:
  48953. case 0x2B:
  48954. case 0x2D:
  48955. case 0x2E:
  48956. return new PostScriptToken(PostScriptTokenTypes.NUMBER, this.getNumber());
  48957. case 0x7B:
  48958. this.nextChar();
  48959. return PostScriptToken.LBRACE;
  48960. case 0x7D:
  48961. this.nextChar();
  48962. return PostScriptToken.RBRACE;
  48963. }
  48964. var strBuf = this.strBuf;
  48965. strBuf.length = 0;
  48966. strBuf[0] = String.fromCharCode(ch);
  48967. while ((ch = this.nextChar()) >= 0 && (ch >= 0x41 && ch <= 0x5A || ch >= 0x61 && ch <= 0x7A)) {
  48968. strBuf.push(String.fromCharCode(ch));
  48969. }
  48970. var str = strBuf.join('');
  48971. switch (str.toLowerCase()) {
  48972. case 'if':
  48973. return PostScriptToken.IF;
  48974. case 'ifelse':
  48975. return PostScriptToken.IFELSE;
  48976. default:
  48977. return PostScriptToken.getOperator(str);
  48978. }
  48979. },
  48980. getNumber: function PostScriptLexer_getNumber() {
  48981. var ch = this.currentChar;
  48982. var strBuf = this.strBuf;
  48983. strBuf.length = 0;
  48984. strBuf[0] = String.fromCharCode(ch);
  48985. while ((ch = this.nextChar()) >= 0) {
  48986. if (ch >= 0x30 && ch <= 0x39 || ch === 0x2D || ch === 0x2E) {
  48987. strBuf.push(String.fromCharCode(ch));
  48988. } else {
  48989. break;
  48990. }
  48991. }
  48992. var value = parseFloat(strBuf.join(''));
  48993. if (isNaN(value)) {
  48994. error('Invalid floating point number: ' + value);
  48995. }
  48996. return value;
  48997. }
  48998. };
  48999. return PostScriptLexer;
  49000. }();
  49001. exports.PostScriptLexer = PostScriptLexer;
  49002. exports.PostScriptParser = PostScriptParser;
  49003. /***/ }),
  49004. /* 35 */
  49005. /***/ (function(module, exports, __w_pdfjs_require__) {
  49006. "use strict";
  49007. var sharedUtil = __w_pdfjs_require__(0);
  49008. var coreStream = __w_pdfjs_require__(2);
  49009. var coreEncodings = __w_pdfjs_require__(4);
  49010. var warn = sharedUtil.warn;
  49011. var isSpace = sharedUtil.isSpace;
  49012. var Stream = coreStream.Stream;
  49013. var getEncoding = coreEncodings.getEncoding;
  49014. var HINTING_ENABLED = false;
  49015. var Type1CharString = function Type1CharStringClosure() {
  49016. var COMMAND_MAP = {
  49017. 'hstem': [1],
  49018. 'vstem': [3],
  49019. 'vmoveto': [4],
  49020. 'rlineto': [5],
  49021. 'hlineto': [6],
  49022. 'vlineto': [7],
  49023. 'rrcurveto': [8],
  49024. 'callsubr': [10],
  49025. 'flex': [
  49026. 12,
  49027. 35
  49028. ],
  49029. 'drop': [
  49030. 12,
  49031. 18
  49032. ],
  49033. 'endchar': [14],
  49034. 'rmoveto': [21],
  49035. 'hmoveto': [22],
  49036. 'vhcurveto': [30],
  49037. 'hvcurveto': [31]
  49038. };
  49039. function Type1CharString() {
  49040. this.width = 0;
  49041. this.lsb = 0;
  49042. this.flexing = false;
  49043. this.output = [];
  49044. this.stack = [];
  49045. }
  49046. Type1CharString.prototype = {
  49047. convert: function Type1CharString_convert(encoded, subrs, seacAnalysisEnabled) {
  49048. var count = encoded.length;
  49049. var error = false;
  49050. var wx, sbx, subrNumber;
  49051. for (var i = 0; i < count; i++) {
  49052. var value = encoded[i];
  49053. if (value < 32) {
  49054. if (value === 12) {
  49055. value = (value << 8) + encoded[++i];
  49056. }
  49057. switch (value) {
  49058. case 1:
  49059. if (!HINTING_ENABLED) {
  49060. this.stack = [];
  49061. break;
  49062. }
  49063. error = this.executeCommand(2, COMMAND_MAP.hstem);
  49064. break;
  49065. case 3:
  49066. if (!HINTING_ENABLED) {
  49067. this.stack = [];
  49068. break;
  49069. }
  49070. error = this.executeCommand(2, COMMAND_MAP.vstem);
  49071. break;
  49072. case 4:
  49073. if (this.flexing) {
  49074. if (this.stack.length < 1) {
  49075. error = true;
  49076. break;
  49077. }
  49078. var dy = this.stack.pop();
  49079. this.stack.push(0, dy);
  49080. break;
  49081. }
  49082. error = this.executeCommand(1, COMMAND_MAP.vmoveto);
  49083. break;
  49084. case 5:
  49085. error = this.executeCommand(2, COMMAND_MAP.rlineto);
  49086. break;
  49087. case 6:
  49088. error = this.executeCommand(1, COMMAND_MAP.hlineto);
  49089. break;
  49090. case 7:
  49091. error = this.executeCommand(1, COMMAND_MAP.vlineto);
  49092. break;
  49093. case 8:
  49094. error = this.executeCommand(6, COMMAND_MAP.rrcurveto);
  49095. break;
  49096. case 9:
  49097. this.stack = [];
  49098. break;
  49099. case 10:
  49100. if (this.stack.length < 1) {
  49101. error = true;
  49102. break;
  49103. }
  49104. subrNumber = this.stack.pop();
  49105. error = this.convert(subrs[subrNumber], subrs, seacAnalysisEnabled);
  49106. break;
  49107. case 11:
  49108. return error;
  49109. case 13:
  49110. if (this.stack.length < 2) {
  49111. error = true;
  49112. break;
  49113. }
  49114. wx = this.stack.pop();
  49115. sbx = this.stack.pop();
  49116. this.lsb = sbx;
  49117. this.width = wx;
  49118. this.stack.push(wx, sbx);
  49119. error = this.executeCommand(2, COMMAND_MAP.hmoveto);
  49120. break;
  49121. case 14:
  49122. this.output.push(COMMAND_MAP.endchar[0]);
  49123. break;
  49124. case 21:
  49125. if (this.flexing) {
  49126. break;
  49127. }
  49128. error = this.executeCommand(2, COMMAND_MAP.rmoveto);
  49129. break;
  49130. case 22:
  49131. if (this.flexing) {
  49132. this.stack.push(0);
  49133. break;
  49134. }
  49135. error = this.executeCommand(1, COMMAND_MAP.hmoveto);
  49136. break;
  49137. case 30:
  49138. error = this.executeCommand(4, COMMAND_MAP.vhcurveto);
  49139. break;
  49140. case 31:
  49141. error = this.executeCommand(4, COMMAND_MAP.hvcurveto);
  49142. break;
  49143. case (12 << 8) + 0:
  49144. this.stack = [];
  49145. break;
  49146. case (12 << 8) + 1:
  49147. if (!HINTING_ENABLED) {
  49148. this.stack = [];
  49149. break;
  49150. }
  49151. error = this.executeCommand(2, COMMAND_MAP.vstem);
  49152. break;
  49153. case (12 << 8) + 2:
  49154. if (!HINTING_ENABLED) {
  49155. this.stack = [];
  49156. break;
  49157. }
  49158. error = this.executeCommand(2, COMMAND_MAP.hstem);
  49159. break;
  49160. case (12 << 8) + 6:
  49161. if (seacAnalysisEnabled) {
  49162. this.seac = this.stack.splice(-4, 4);
  49163. error = this.executeCommand(0, COMMAND_MAP.endchar);
  49164. } else {
  49165. error = this.executeCommand(4, COMMAND_MAP.endchar);
  49166. }
  49167. break;
  49168. case (12 << 8) + 7:
  49169. if (this.stack.length < 4) {
  49170. error = true;
  49171. break;
  49172. }
  49173. this.stack.pop();
  49174. wx = this.stack.pop();
  49175. var sby = this.stack.pop();
  49176. sbx = this.stack.pop();
  49177. this.lsb = sbx;
  49178. this.width = wx;
  49179. this.stack.push(wx, sbx, sby);
  49180. error = this.executeCommand(3, COMMAND_MAP.rmoveto);
  49181. break;
  49182. case (12 << 8) + 12:
  49183. if (this.stack.length < 2) {
  49184. error = true;
  49185. break;
  49186. }
  49187. var num2 = this.stack.pop();
  49188. var num1 = this.stack.pop();
  49189. this.stack.push(num1 / num2);
  49190. break;
  49191. case (12 << 8) + 16:
  49192. if (this.stack.length < 2) {
  49193. error = true;
  49194. break;
  49195. }
  49196. subrNumber = this.stack.pop();
  49197. var numArgs = this.stack.pop();
  49198. if (subrNumber === 0 && numArgs === 3) {
  49199. var flexArgs = this.stack.splice(this.stack.length - 17, 17);
  49200. 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]);
  49201. error = this.executeCommand(13, COMMAND_MAP.flex, true);
  49202. this.flexing = false;
  49203. this.stack.push(flexArgs[15], flexArgs[16]);
  49204. } else if (subrNumber === 1 && numArgs === 0) {
  49205. this.flexing = true;
  49206. }
  49207. break;
  49208. case (12 << 8) + 17:
  49209. break;
  49210. case (12 << 8) + 33:
  49211. this.stack = [];
  49212. break;
  49213. default:
  49214. warn('Unknown type 1 charstring command of "' + value + '"');
  49215. break;
  49216. }
  49217. if (error) {
  49218. break;
  49219. }
  49220. continue;
  49221. } else if (value <= 246) {
  49222. value = value - 139;
  49223. } else if (value <= 250) {
  49224. value = (value - 247) * 256 + encoded[++i] + 108;
  49225. } else if (value <= 254) {
  49226. value = -((value - 251) * 256) - encoded[++i] - 108;
  49227. } else {
  49228. value = (encoded[++i] & 0xff) << 24 | (encoded[++i] & 0xff) << 16 | (encoded[++i] & 0xff) << 8 | (encoded[++i] & 0xff) << 0;
  49229. }
  49230. this.stack.push(value);
  49231. }
  49232. return error;
  49233. },
  49234. executeCommand: function (howManyArgs, command, keepStack) {
  49235. var stackLength = this.stack.length;
  49236. if (howManyArgs > stackLength) {
  49237. return true;
  49238. }
  49239. var start = stackLength - howManyArgs;
  49240. for (var i = start; i < stackLength; i++) {
  49241. var value = this.stack[i];
  49242. if (value === (value | 0)) {
  49243. this.output.push(28, value >> 8 & 0xff, value & 0xff);
  49244. } else {
  49245. value = 65536 * value | 0;
  49246. this.output.push(255, value >> 24 & 0xFF, value >> 16 & 0xFF, value >> 8 & 0xFF, value & 0xFF);
  49247. }
  49248. }
  49249. this.output.push.apply(this.output, command);
  49250. if (keepStack) {
  49251. this.stack.splice(start, howManyArgs);
  49252. } else {
  49253. this.stack.length = 0;
  49254. }
  49255. return false;
  49256. }
  49257. };
  49258. return Type1CharString;
  49259. }();
  49260. var Type1Parser = function Type1ParserClosure() {
  49261. var EEXEC_ENCRYPT_KEY = 55665;
  49262. var CHAR_STRS_ENCRYPT_KEY = 4330;
  49263. function isHexDigit(code) {
  49264. return code >= 48 && code <= 57 || code >= 65 && code <= 70 || code >= 97 && code <= 102;
  49265. }
  49266. function decrypt(data, key, discardNumber) {
  49267. if (discardNumber >= data.length) {
  49268. return new Uint8Array(0);
  49269. }
  49270. var r = key | 0, c1 = 52845, c2 = 22719, i, j;
  49271. for (i = 0; i < discardNumber; i++) {
  49272. r = (data[i] + r) * c1 + c2 & (1 << 16) - 1;
  49273. }
  49274. var count = data.length - discardNumber;
  49275. var decrypted = new Uint8Array(count);
  49276. for (i = discardNumber, j = 0; j < count; i++, j++) {
  49277. var value = data[i];
  49278. decrypted[j] = value ^ r >> 8;
  49279. r = (value + r) * c1 + c2 & (1 << 16) - 1;
  49280. }
  49281. return decrypted;
  49282. }
  49283. function decryptAscii(data, key, discardNumber) {
  49284. var r = key | 0, c1 = 52845, c2 = 22719;
  49285. var count = data.length, maybeLength = count >>> 1;
  49286. var decrypted = new Uint8Array(maybeLength);
  49287. var i, j;
  49288. for (i = 0, j = 0; i < count; i++) {
  49289. var digit1 = data[i];
  49290. if (!isHexDigit(digit1)) {
  49291. continue;
  49292. }
  49293. i++;
  49294. var digit2;
  49295. while (i < count && !isHexDigit(digit2 = data[i])) {
  49296. i++;
  49297. }
  49298. if (i < count) {
  49299. var value = parseInt(String.fromCharCode(digit1, digit2), 16);
  49300. decrypted[j++] = value ^ r >> 8;
  49301. r = (value + r) * c1 + c2 & (1 << 16) - 1;
  49302. }
  49303. }
  49304. return Array.prototype.slice.call(decrypted, discardNumber, j);
  49305. }
  49306. function isSpecial(c) {
  49307. return c === 0x2F || c === 0x5B || c === 0x5D || c === 0x7B || c === 0x7D || c === 0x28 || c === 0x29;
  49308. }
  49309. function Type1Parser(stream, encrypted, seacAnalysisEnabled) {
  49310. if (encrypted) {
  49311. var data = stream.getBytes();
  49312. var isBinary = !(isHexDigit(data[0]) && isHexDigit(data[1]) && isHexDigit(data[2]) && isHexDigit(data[3]));
  49313. stream = new Stream(isBinary ? decrypt(data, EEXEC_ENCRYPT_KEY, 4) : decryptAscii(data, EEXEC_ENCRYPT_KEY, 4));
  49314. }
  49315. this.seacAnalysisEnabled = !!seacAnalysisEnabled;
  49316. this.stream = stream;
  49317. this.nextChar();
  49318. }
  49319. Type1Parser.prototype = {
  49320. readNumberArray: function Type1Parser_readNumberArray() {
  49321. this.getToken();
  49322. var array = [];
  49323. while (true) {
  49324. var token = this.getToken();
  49325. if (token === null || token === ']' || token === '}') {
  49326. break;
  49327. }
  49328. array.push(parseFloat(token || 0));
  49329. }
  49330. return array;
  49331. },
  49332. readNumber: function Type1Parser_readNumber() {
  49333. var token = this.getToken();
  49334. return parseFloat(token || 0);
  49335. },
  49336. readInt: function Type1Parser_readInt() {
  49337. var token = this.getToken();
  49338. return parseInt(token || 0, 10) | 0;
  49339. },
  49340. readBoolean: function Type1Parser_readBoolean() {
  49341. var token = this.getToken();
  49342. return token === 'true' ? 1 : 0;
  49343. },
  49344. nextChar: function Type1_nextChar() {
  49345. return this.currentChar = this.stream.getByte();
  49346. },
  49347. getToken: function Type1Parser_getToken() {
  49348. var comment = false;
  49349. var ch = this.currentChar;
  49350. while (true) {
  49351. if (ch === -1) {
  49352. return null;
  49353. }
  49354. if (comment) {
  49355. if (ch === 0x0A || ch === 0x0D) {
  49356. comment = false;
  49357. }
  49358. } else if (ch === 0x25) {
  49359. comment = true;
  49360. } else if (!isSpace(ch)) {
  49361. break;
  49362. }
  49363. ch = this.nextChar();
  49364. }
  49365. if (isSpecial(ch)) {
  49366. this.nextChar();
  49367. return String.fromCharCode(ch);
  49368. }
  49369. var token = '';
  49370. do {
  49371. token += String.fromCharCode(ch);
  49372. ch = this.nextChar();
  49373. } while (ch >= 0 && !isSpace(ch) && !isSpecial(ch));
  49374. return token;
  49375. },
  49376. extractFontProgram: function Type1Parser_extractFontProgram() {
  49377. var stream = this.stream;
  49378. var subrs = [], charstrings = [];
  49379. var privateData = Object.create(null);
  49380. privateData['lenIV'] = 4;
  49381. var program = {
  49382. subrs: [],
  49383. charstrings: [],
  49384. properties: { 'privateData': privateData }
  49385. };
  49386. var token, length, data, lenIV, encoded;
  49387. while ((token = this.getToken()) !== null) {
  49388. if (token !== '/') {
  49389. continue;
  49390. }
  49391. token = this.getToken();
  49392. switch (token) {
  49393. case 'CharStrings':
  49394. this.getToken();
  49395. this.getToken();
  49396. this.getToken();
  49397. this.getToken();
  49398. while (true) {
  49399. token = this.getToken();
  49400. if (token === null || token === 'end') {
  49401. break;
  49402. }
  49403. if (token !== '/') {
  49404. continue;
  49405. }
  49406. var glyph = this.getToken();
  49407. length = this.readInt();
  49408. this.getToken();
  49409. data = stream.makeSubStream(stream.pos, length);
  49410. lenIV = program.properties.privateData['lenIV'];
  49411. encoded = decrypt(data.getBytes(), CHAR_STRS_ENCRYPT_KEY, lenIV);
  49412. stream.skip(length);
  49413. this.nextChar();
  49414. token = this.getToken();
  49415. if (token === 'noaccess') {
  49416. this.getToken();
  49417. }
  49418. charstrings.push({
  49419. glyph: glyph,
  49420. encoded: encoded
  49421. });
  49422. }
  49423. break;
  49424. case 'Subrs':
  49425. this.readInt();
  49426. this.getToken();
  49427. while ((token = this.getToken()) === 'dup') {
  49428. var index = this.readInt();
  49429. length = this.readInt();
  49430. this.getToken();
  49431. data = stream.makeSubStream(stream.pos, length);
  49432. lenIV = program.properties.privateData['lenIV'];
  49433. encoded = decrypt(data.getBytes(), CHAR_STRS_ENCRYPT_KEY, lenIV);
  49434. stream.skip(length);
  49435. this.nextChar();
  49436. token = this.getToken();
  49437. if (token === 'noaccess') {
  49438. this.getToken();
  49439. }
  49440. subrs[index] = encoded;
  49441. }
  49442. break;
  49443. case 'BlueValues':
  49444. case 'OtherBlues':
  49445. case 'FamilyBlues':
  49446. case 'FamilyOtherBlues':
  49447. var blueArray = this.readNumberArray();
  49448. if (blueArray.length > 0 && blueArray.length % 2 === 0 && HINTING_ENABLED) {
  49449. program.properties.privateData[token] = blueArray;
  49450. }
  49451. break;
  49452. case 'StemSnapH':
  49453. case 'StemSnapV':
  49454. program.properties.privateData[token] = this.readNumberArray();
  49455. break;
  49456. case 'StdHW':
  49457. case 'StdVW':
  49458. program.properties.privateData[token] = this.readNumberArray()[0];
  49459. break;
  49460. case 'BlueShift':
  49461. case 'lenIV':
  49462. case 'BlueFuzz':
  49463. case 'BlueScale':
  49464. case 'LanguageGroup':
  49465. case 'ExpansionFactor':
  49466. program.properties.privateData[token] = this.readNumber();
  49467. break;
  49468. case 'ForceBold':
  49469. program.properties.privateData[token] = this.readBoolean();
  49470. break;
  49471. }
  49472. }
  49473. for (var i = 0; i < charstrings.length; i++) {
  49474. glyph = charstrings[i].glyph;
  49475. encoded = charstrings[i].encoded;
  49476. var charString = new Type1CharString();
  49477. var error = charString.convert(encoded, subrs, this.seacAnalysisEnabled);
  49478. var output = charString.output;
  49479. if (error) {
  49480. output = [14];
  49481. }
  49482. program.charstrings.push({
  49483. glyphName: glyph,
  49484. charstring: output,
  49485. width: charString.width,
  49486. lsb: charString.lsb,
  49487. seac: charString.seac
  49488. });
  49489. }
  49490. return program;
  49491. },
  49492. extractFontHeader: function Type1Parser_extractFontHeader(properties) {
  49493. var token;
  49494. while ((token = this.getToken()) !== null) {
  49495. if (token !== '/') {
  49496. continue;
  49497. }
  49498. token = this.getToken();
  49499. switch (token) {
  49500. case 'FontMatrix':
  49501. var matrix = this.readNumberArray();
  49502. properties.fontMatrix = matrix;
  49503. break;
  49504. case 'Encoding':
  49505. var encodingArg = this.getToken();
  49506. var encoding;
  49507. if (!/^\d+$/.test(encodingArg)) {
  49508. encoding = getEncoding(encodingArg);
  49509. } else {
  49510. encoding = [];
  49511. var size = parseInt(encodingArg, 10) | 0;
  49512. this.getToken();
  49513. for (var j = 0; j < size; j++) {
  49514. token = this.getToken();
  49515. while (token !== 'dup' && token !== 'def') {
  49516. token = this.getToken();
  49517. if (token === null) {
  49518. return;
  49519. }
  49520. }
  49521. if (token === 'def') {
  49522. break;
  49523. }
  49524. var index = this.readInt();
  49525. this.getToken();
  49526. var glyph = this.getToken();
  49527. encoding[index] = glyph;
  49528. this.getToken();
  49529. }
  49530. }
  49531. properties.builtInEncoding = encoding;
  49532. break;
  49533. case 'FontBBox':
  49534. var fontBBox = this.readNumberArray();
  49535. properties.ascent = Math.max(fontBBox[3], fontBBox[1]);
  49536. properties.descent = Math.min(fontBBox[1], fontBBox[3]);
  49537. properties.ascentScaled = true;
  49538. break;
  49539. }
  49540. }
  49541. }
  49542. };
  49543. return Type1Parser;
  49544. }();
  49545. exports.Type1Parser = Type1Parser;
  49546. /***/ }),
  49547. /* 36 */
  49548. /***/ (function(module, exports, __w_pdfjs_require__) {
  49549. "use strict";
  49550. /* WEBPACK VAR INJECTION */(function(global) {
  49551. if (typeof PDFJS === 'undefined' || !PDFJS.compatibilityChecked) {
  49552. var globalScope = typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : this;
  49553. var userAgent = typeof navigator !== 'undefined' && navigator.userAgent || '';
  49554. var isAndroid = /Android/.test(userAgent);
  49555. var isAndroidPre3 = /Android\s[0-2][^\d]/.test(userAgent);
  49556. var isAndroidPre5 = /Android\s[0-4][^\d]/.test(userAgent);
  49557. var isChrome = userAgent.indexOf('Chrom') >= 0;
  49558. var isChromeWithRangeBug = /Chrome\/(39|40)\./.test(userAgent);
  49559. var isIOSChrome = userAgent.indexOf('CriOS') >= 0;
  49560. var isIE = userAgent.indexOf('Trident') >= 0;
  49561. var isIOS = /\b(iPad|iPhone|iPod)(?=;)/.test(userAgent);
  49562. var isOpera = userAgent.indexOf('Opera') >= 0;
  49563. var isSafari = /Safari\//.test(userAgent) && !/(Chrome\/|Android\s)/.test(userAgent);
  49564. var hasDOM = typeof window === 'object' && typeof document === 'object';
  49565. if (typeof PDFJS === 'undefined') {
  49566. globalScope.PDFJS = {};
  49567. }
  49568. PDFJS.compatibilityChecked = true;
  49569. (function checkTypedArrayCompatibility() {
  49570. if (typeof Uint8Array !== 'undefined') {
  49571. if (typeof Uint8Array.prototype.subarray === 'undefined') {
  49572. Uint8Array.prototype.subarray = function subarray(start, end) {
  49573. return new Uint8Array(this.slice(start, end));
  49574. };
  49575. Float32Array.prototype.subarray = function subarray(start, end) {
  49576. return new Float32Array(this.slice(start, end));
  49577. };
  49578. }
  49579. if (typeof Float64Array === 'undefined') {
  49580. globalScope.Float64Array = Float32Array;
  49581. }
  49582. return;
  49583. }
  49584. function subarray(start, end) {
  49585. return new TypedArray(this.slice(start, end));
  49586. }
  49587. function setArrayOffset(array, offset) {
  49588. if (arguments.length < 2) {
  49589. offset = 0;
  49590. }
  49591. for (var i = 0, n = array.length; i < n; ++i, ++offset) {
  49592. this[offset] = array[i] & 0xFF;
  49593. }
  49594. }
  49595. function TypedArray(arg1) {
  49596. var result, i, n;
  49597. if (typeof arg1 === 'number') {
  49598. result = [];
  49599. for (i = 0; i < arg1; ++i) {
  49600. result[i] = 0;
  49601. }
  49602. } else if ('slice' in arg1) {
  49603. result = arg1.slice(0);
  49604. } else {
  49605. result = [];
  49606. for (i = 0, n = arg1.length; i < n; ++i) {
  49607. result[i] = arg1[i];
  49608. }
  49609. }
  49610. result.subarray = subarray;
  49611. result.buffer = result;
  49612. result.byteLength = result.length;
  49613. result.set = setArrayOffset;
  49614. if (typeof arg1 === 'object' && arg1.buffer) {
  49615. result.buffer = arg1.buffer;
  49616. }
  49617. return result;
  49618. }
  49619. globalScope.Uint8Array = TypedArray;
  49620. globalScope.Int8Array = TypedArray;
  49621. globalScope.Uint32Array = TypedArray;
  49622. globalScope.Int32Array = TypedArray;
  49623. globalScope.Uint16Array = TypedArray;
  49624. globalScope.Float32Array = TypedArray;
  49625. globalScope.Float64Array = TypedArray;
  49626. }());
  49627. (function normalizeURLObject() {
  49628. if (!globalScope.URL) {
  49629. globalScope.URL = globalScope.webkitURL;
  49630. }
  49631. }());
  49632. (function checkObjectDefinePropertyCompatibility() {
  49633. if (typeof Object.defineProperty !== 'undefined') {
  49634. var definePropertyPossible = true;
  49635. try {
  49636. if (hasDOM) {
  49637. Object.defineProperty(new Image(), 'id', { value: 'test' });
  49638. }
  49639. var Test = function Test() {
  49640. };
  49641. Test.prototype = {
  49642. get id() {
  49643. }
  49644. };
  49645. Object.defineProperty(new Test(), 'id', {
  49646. value: '',
  49647. configurable: true,
  49648. enumerable: true,
  49649. writable: false
  49650. });
  49651. } catch (e) {
  49652. definePropertyPossible = false;
  49653. }
  49654. if (definePropertyPossible) {
  49655. return;
  49656. }
  49657. }
  49658. Object.defineProperty = function objectDefineProperty(obj, name, def) {
  49659. delete obj[name];
  49660. if ('get' in def) {
  49661. obj.__defineGetter__(name, def['get']);
  49662. }
  49663. if ('set' in def) {
  49664. obj.__defineSetter__(name, def['set']);
  49665. }
  49666. if ('value' in def) {
  49667. obj.__defineSetter__(name, function objectDefinePropertySetter(value) {
  49668. this.__defineGetter__(name, function objectDefinePropertyGetter() {
  49669. return value;
  49670. });
  49671. return value;
  49672. });
  49673. obj[name] = def.value;
  49674. }
  49675. };
  49676. }());
  49677. (function checkXMLHttpRequestResponseCompatibility() {
  49678. if (typeof XMLHttpRequest === 'undefined') {
  49679. return;
  49680. }
  49681. var xhrPrototype = XMLHttpRequest.prototype;
  49682. var xhr = new XMLHttpRequest();
  49683. if (!('overrideMimeType' in xhr)) {
  49684. Object.defineProperty(xhrPrototype, 'overrideMimeType', {
  49685. value: function xmlHttpRequestOverrideMimeType(mimeType) {
  49686. }
  49687. });
  49688. }
  49689. if ('responseType' in xhr) {
  49690. return;
  49691. }
  49692. Object.defineProperty(xhrPrototype, 'responseType', {
  49693. get: function xmlHttpRequestGetResponseType() {
  49694. return this._responseType || 'text';
  49695. },
  49696. set: function xmlHttpRequestSetResponseType(value) {
  49697. if (value === 'text' || value === 'arraybuffer') {
  49698. this._responseType = value;
  49699. if (value === 'arraybuffer' && typeof this.overrideMimeType === 'function') {
  49700. this.overrideMimeType('text/plain; charset=x-user-defined');
  49701. }
  49702. }
  49703. }
  49704. });
  49705. if (typeof VBArray !== 'undefined') {
  49706. Object.defineProperty(xhrPrototype, 'response', {
  49707. get: function xmlHttpRequestResponseGet() {
  49708. if (this.responseType === 'arraybuffer') {
  49709. return new Uint8Array(new VBArray(this.responseBody).toArray());
  49710. }
  49711. return this.responseText;
  49712. }
  49713. });
  49714. return;
  49715. }
  49716. Object.defineProperty(xhrPrototype, 'response', {
  49717. get: function xmlHttpRequestResponseGet() {
  49718. if (this.responseType !== 'arraybuffer') {
  49719. return this.responseText;
  49720. }
  49721. var text = this.responseText;
  49722. var i, n = text.length;
  49723. var result = new Uint8Array(n);
  49724. for (i = 0; i < n; ++i) {
  49725. result[i] = text.charCodeAt(i) & 0xFF;
  49726. }
  49727. return result.buffer;
  49728. }
  49729. });
  49730. }());
  49731. (function checkWindowBtoaCompatibility() {
  49732. if ('btoa' in globalScope) {
  49733. return;
  49734. }
  49735. var digits = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=';
  49736. globalScope.btoa = function (chars) {
  49737. var buffer = '';
  49738. var i, n;
  49739. for (i = 0, n = chars.length; i < n; i += 3) {
  49740. var b1 = chars.charCodeAt(i) & 0xFF;
  49741. var b2 = chars.charCodeAt(i + 1) & 0xFF;
  49742. var b3 = chars.charCodeAt(i + 2) & 0xFF;
  49743. var d1 = b1 >> 2, d2 = (b1 & 3) << 4 | b2 >> 4;
  49744. var d3 = i + 1 < n ? (b2 & 0xF) << 2 | b3 >> 6 : 64;
  49745. var d4 = i + 2 < n ? b3 & 0x3F : 64;
  49746. buffer += digits.charAt(d1) + digits.charAt(d2) + digits.charAt(d3) + digits.charAt(d4);
  49747. }
  49748. return buffer;
  49749. };
  49750. }());
  49751. (function checkWindowAtobCompatibility() {
  49752. if ('atob' in globalScope) {
  49753. return;
  49754. }
  49755. var digits = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=';
  49756. globalScope.atob = function (input) {
  49757. input = input.replace(/=+$/, '');
  49758. if (input.length % 4 === 1) {
  49759. throw new Error('bad atob input');
  49760. }
  49761. 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) {
  49762. buffer = digits.indexOf(buffer);
  49763. }
  49764. return output;
  49765. };
  49766. }());
  49767. (function checkFunctionPrototypeBindCompatibility() {
  49768. if (typeof Function.prototype.bind !== 'undefined') {
  49769. return;
  49770. }
  49771. Function.prototype.bind = function functionPrototypeBind(obj) {
  49772. var fn = this, headArgs = Array.prototype.slice.call(arguments, 1);
  49773. var bound = function functionPrototypeBindBound() {
  49774. var args = headArgs.concat(Array.prototype.slice.call(arguments));
  49775. return fn.apply(obj, args);
  49776. };
  49777. return bound;
  49778. };
  49779. }());
  49780. (function checkDatasetProperty() {
  49781. if (!hasDOM) {
  49782. return;
  49783. }
  49784. var div = document.createElement('div');
  49785. if ('dataset' in div) {
  49786. return;
  49787. }
  49788. Object.defineProperty(HTMLElement.prototype, 'dataset', {
  49789. get: function () {
  49790. if (this._dataset) {
  49791. return this._dataset;
  49792. }
  49793. var dataset = {};
  49794. for (var j = 0, jj = this.attributes.length; j < jj; j++) {
  49795. var attribute = this.attributes[j];
  49796. if (attribute.name.substring(0, 5) !== 'data-') {
  49797. continue;
  49798. }
  49799. var key = attribute.name.substring(5).replace(/\-([a-z])/g, function (all, ch) {
  49800. return ch.toUpperCase();
  49801. });
  49802. dataset[key] = attribute.value;
  49803. }
  49804. Object.defineProperty(this, '_dataset', {
  49805. value: dataset,
  49806. writable: false,
  49807. enumerable: false
  49808. });
  49809. return dataset;
  49810. },
  49811. enumerable: true
  49812. });
  49813. }());
  49814. (function checkClassListProperty() {
  49815. function changeList(element, itemName, add, remove) {
  49816. var s = element.className || '';
  49817. var list = s.split(/\s+/g);
  49818. if (list[0] === '') {
  49819. list.shift();
  49820. }
  49821. var index = list.indexOf(itemName);
  49822. if (index < 0 && add) {
  49823. list.push(itemName);
  49824. }
  49825. if (index >= 0 && remove) {
  49826. list.splice(index, 1);
  49827. }
  49828. element.className = list.join(' ');
  49829. return index >= 0;
  49830. }
  49831. if (!hasDOM) {
  49832. return;
  49833. }
  49834. var div = document.createElement('div');
  49835. if ('classList' in div) {
  49836. return;
  49837. }
  49838. var classListPrototype = {
  49839. add: function (name) {
  49840. changeList(this.element, name, true, false);
  49841. },
  49842. contains: function (name) {
  49843. return changeList(this.element, name, false, false);
  49844. },
  49845. remove: function (name) {
  49846. changeList(this.element, name, false, true);
  49847. },
  49848. toggle: function (name) {
  49849. changeList(this.element, name, true, true);
  49850. }
  49851. };
  49852. Object.defineProperty(HTMLElement.prototype, 'classList', {
  49853. get: function () {
  49854. if (this._classList) {
  49855. return this._classList;
  49856. }
  49857. var classList = Object.create(classListPrototype, {
  49858. element: {
  49859. value: this,
  49860. writable: false,
  49861. enumerable: true
  49862. }
  49863. });
  49864. Object.defineProperty(this, '_classList', {
  49865. value: classList,
  49866. writable: false,
  49867. enumerable: false
  49868. });
  49869. return classList;
  49870. },
  49871. enumerable: true
  49872. });
  49873. }());
  49874. (function checkWorkerConsoleCompatibility() {
  49875. if (typeof importScripts === 'undefined' || 'console' in globalScope) {
  49876. return;
  49877. }
  49878. var consoleTimer = {};
  49879. var workerConsole = {
  49880. log: function log() {
  49881. var args = Array.prototype.slice.call(arguments);
  49882. globalScope.postMessage({
  49883. targetName: 'main',
  49884. action: 'console_log',
  49885. data: args
  49886. });
  49887. },
  49888. error: function error() {
  49889. var args = Array.prototype.slice.call(arguments);
  49890. globalScope.postMessage({
  49891. targetName: 'main',
  49892. action: 'console_error',
  49893. data: args
  49894. });
  49895. },
  49896. time: function time(name) {
  49897. consoleTimer[name] = Date.now();
  49898. },
  49899. timeEnd: function timeEnd(name) {
  49900. var time = consoleTimer[name];
  49901. if (!time) {
  49902. throw new Error('Unknown timer name ' + name);
  49903. }
  49904. this.log('Timer:', name, Date.now() - time);
  49905. }
  49906. };
  49907. globalScope.console = workerConsole;
  49908. }());
  49909. (function checkConsoleCompatibility() {
  49910. if (!hasDOM) {
  49911. return;
  49912. }
  49913. if (!('console' in window)) {
  49914. window.console = {
  49915. log: function () {
  49916. },
  49917. error: function () {
  49918. },
  49919. warn: function () {
  49920. }
  49921. };
  49922. return;
  49923. }
  49924. if (!('bind' in console.log)) {
  49925. console.log = function (fn) {
  49926. return function (msg) {
  49927. return fn(msg);
  49928. };
  49929. }(console.log);
  49930. console.error = function (fn) {
  49931. return function (msg) {
  49932. return fn(msg);
  49933. };
  49934. }(console.error);
  49935. console.warn = function (fn) {
  49936. return function (msg) {
  49937. return fn(msg);
  49938. };
  49939. }(console.warn);
  49940. return;
  49941. }
  49942. }());
  49943. (function checkOnClickCompatibility() {
  49944. function ignoreIfTargetDisabled(event) {
  49945. if (isDisabled(event.target)) {
  49946. event.stopPropagation();
  49947. }
  49948. }
  49949. function isDisabled(node) {
  49950. return node.disabled || node.parentNode && isDisabled(node.parentNode);
  49951. }
  49952. if (isOpera) {
  49953. document.addEventListener('click', ignoreIfTargetDisabled, true);
  49954. }
  49955. }());
  49956. (function checkOnBlobSupport() {
  49957. if (isIE || isIOSChrome) {
  49958. PDFJS.disableCreateObjectURL = true;
  49959. }
  49960. }());
  49961. (function checkNavigatorLanguage() {
  49962. if (typeof navigator === 'undefined') {
  49963. return;
  49964. }
  49965. if ('language' in navigator) {
  49966. return;
  49967. }
  49968. PDFJS.locale = navigator.userLanguage || 'en-US';
  49969. }());
  49970. (function checkRangeRequests() {
  49971. if (isSafari || isAndroidPre3 || isChromeWithRangeBug || isIOS) {
  49972. PDFJS.disableRange = true;
  49973. PDFJS.disableStream = true;
  49974. }
  49975. }());
  49976. (function checkHistoryManipulation() {
  49977. if (!hasDOM) {
  49978. return;
  49979. }
  49980. if (!history.pushState || isAndroidPre3) {
  49981. PDFJS.disableHistory = true;
  49982. }
  49983. }());
  49984. (function checkSetPresenceInImageData() {
  49985. if (!hasDOM) {
  49986. return;
  49987. }
  49988. if (window.CanvasPixelArray) {
  49989. if (typeof window.CanvasPixelArray.prototype.set !== 'function') {
  49990. window.CanvasPixelArray.prototype.set = function (arr) {
  49991. for (var i = 0, ii = this.length; i < ii; i++) {
  49992. this[i] = arr[i];
  49993. }
  49994. };
  49995. }
  49996. } else {
  49997. var polyfill = false, versionMatch;
  49998. if (isChrome) {
  49999. versionMatch = userAgent.match(/Chrom(e|ium)\/([0-9]+)\./);
  50000. polyfill = versionMatch && parseInt(versionMatch[2]) < 21;
  50001. } else if (isAndroid) {
  50002. polyfill = isAndroidPre5;
  50003. } else if (isSafari) {
  50004. versionMatch = userAgent.match(/Version\/([0-9]+)\.([0-9]+)\.([0-9]+) Safari\//);
  50005. polyfill = versionMatch && parseInt(versionMatch[1]) < 6;
  50006. }
  50007. if (polyfill) {
  50008. var contextPrototype = window.CanvasRenderingContext2D.prototype;
  50009. var createImageData = contextPrototype.createImageData;
  50010. contextPrototype.createImageData = function (w, h) {
  50011. var imageData = createImageData.call(this, w, h);
  50012. imageData.data.set = function (arr) {
  50013. for (var i = 0, ii = this.length; i < ii; i++) {
  50014. this[i] = arr[i];
  50015. }
  50016. };
  50017. return imageData;
  50018. };
  50019. contextPrototype = null;
  50020. }
  50021. }
  50022. }());
  50023. (function checkRequestAnimationFrame() {
  50024. function fakeRequestAnimationFrame(callback) {
  50025. window.setTimeout(callback, 20);
  50026. }
  50027. if (!hasDOM) {
  50028. return;
  50029. }
  50030. if (isIOS) {
  50031. window.requestAnimationFrame = fakeRequestAnimationFrame;
  50032. return;
  50033. }
  50034. if ('requestAnimationFrame' in window) {
  50035. return;
  50036. }
  50037. window.requestAnimationFrame = window.mozRequestAnimationFrame || window.webkitRequestAnimationFrame || fakeRequestAnimationFrame;
  50038. }());
  50039. (function checkCanvasSizeLimitation() {
  50040. if (isIOS || isAndroid) {
  50041. PDFJS.maxCanvasPixels = 5242880;
  50042. }
  50043. }());
  50044. (function checkFullscreenSupport() {
  50045. if (!hasDOM) {
  50046. return;
  50047. }
  50048. if (isIE && window.parent !== window) {
  50049. PDFJS.disableFullscreen = true;
  50050. }
  50051. }());
  50052. (function checkCurrentScript() {
  50053. if (!hasDOM) {
  50054. return;
  50055. }
  50056. if ('currentScript' in document) {
  50057. return;
  50058. }
  50059. Object.defineProperty(document, 'currentScript', {
  50060. get: function () {
  50061. var scripts = document.getElementsByTagName('script');
  50062. return scripts[scripts.length - 1];
  50063. },
  50064. enumerable: true,
  50065. configurable: true
  50066. });
  50067. }());
  50068. (function checkInputTypeNumberAssign() {
  50069. if (!hasDOM) {
  50070. return;
  50071. }
  50072. var el = document.createElement('input');
  50073. try {
  50074. el.type = 'number';
  50075. } catch (ex) {
  50076. var inputProto = el.constructor.prototype;
  50077. var typeProperty = Object.getOwnPropertyDescriptor(inputProto, 'type');
  50078. Object.defineProperty(inputProto, 'type', {
  50079. get: function () {
  50080. return typeProperty.get.call(this);
  50081. },
  50082. set: function (value) {
  50083. typeProperty.set.call(this, value === 'number' ? 'text' : value);
  50084. },
  50085. enumerable: true,
  50086. configurable: true
  50087. });
  50088. }
  50089. }());
  50090. (function checkDocumentReadyState() {
  50091. if (!hasDOM) {
  50092. return;
  50093. }
  50094. if (!document.attachEvent) {
  50095. return;
  50096. }
  50097. var documentProto = document.constructor.prototype;
  50098. var readyStateProto = Object.getOwnPropertyDescriptor(documentProto, 'readyState');
  50099. Object.defineProperty(documentProto, 'readyState', {
  50100. get: function () {
  50101. var value = readyStateProto.get.call(this);
  50102. return value === 'interactive' ? 'loading' : value;
  50103. },
  50104. set: function (value) {
  50105. readyStateProto.set.call(this, value);
  50106. },
  50107. enumerable: true,
  50108. configurable: true
  50109. });
  50110. }());
  50111. (function checkChildNodeRemove() {
  50112. if (!hasDOM) {
  50113. return;
  50114. }
  50115. if (typeof Element.prototype.remove !== 'undefined') {
  50116. return;
  50117. }
  50118. Element.prototype.remove = function () {
  50119. if (this.parentNode) {
  50120. this.parentNode.removeChild(this);
  50121. }
  50122. };
  50123. }());
  50124. (function checkPromise() {
  50125. if (globalScope.Promise) {
  50126. if (typeof globalScope.Promise.all !== 'function') {
  50127. globalScope.Promise.all = function (iterable) {
  50128. var count = 0, results = [], resolve, reject;
  50129. var promise = new globalScope.Promise(function (resolve_, reject_) {
  50130. resolve = resolve_;
  50131. reject = reject_;
  50132. });
  50133. iterable.forEach(function (p, i) {
  50134. count++;
  50135. p.then(function (result) {
  50136. results[i] = result;
  50137. count--;
  50138. if (count === 0) {
  50139. resolve(results);
  50140. }
  50141. }, reject);
  50142. });
  50143. if (count === 0) {
  50144. resolve(results);
  50145. }
  50146. return promise;
  50147. };
  50148. }
  50149. if (typeof globalScope.Promise.resolve !== 'function') {
  50150. globalScope.Promise.resolve = function (value) {
  50151. return new globalScope.Promise(function (resolve) {
  50152. resolve(value);
  50153. });
  50154. };
  50155. }
  50156. if (typeof globalScope.Promise.reject !== 'function') {
  50157. globalScope.Promise.reject = function (reason) {
  50158. return new globalScope.Promise(function (resolve, reject) {
  50159. reject(reason);
  50160. });
  50161. };
  50162. }
  50163. if (typeof globalScope.Promise.prototype.catch !== 'function') {
  50164. globalScope.Promise.prototype.catch = function (onReject) {
  50165. return globalScope.Promise.prototype.then(undefined, onReject);
  50166. };
  50167. }
  50168. return;
  50169. }
  50170. var STATUS_PENDING = 0;
  50171. var STATUS_RESOLVED = 1;
  50172. var STATUS_REJECTED = 2;
  50173. var REJECTION_TIMEOUT = 500;
  50174. var HandlerManager = {
  50175. handlers: [],
  50176. running: false,
  50177. unhandledRejections: [],
  50178. pendingRejectionCheck: false,
  50179. scheduleHandlers: function scheduleHandlers(promise) {
  50180. if (promise._status === STATUS_PENDING) {
  50181. return;
  50182. }
  50183. this.handlers = this.handlers.concat(promise._handlers);
  50184. promise._handlers = [];
  50185. if (this.running) {
  50186. return;
  50187. }
  50188. this.running = true;
  50189. setTimeout(this.runHandlers.bind(this), 0);
  50190. },
  50191. runHandlers: function runHandlers() {
  50192. var RUN_TIMEOUT = 1;
  50193. var timeoutAt = Date.now() + RUN_TIMEOUT;
  50194. while (this.handlers.length > 0) {
  50195. var handler = this.handlers.shift();
  50196. var nextStatus = handler.thisPromise._status;
  50197. var nextValue = handler.thisPromise._value;
  50198. try {
  50199. if (nextStatus === STATUS_RESOLVED) {
  50200. if (typeof handler.onResolve === 'function') {
  50201. nextValue = handler.onResolve(nextValue);
  50202. }
  50203. } else if (typeof handler.onReject === 'function') {
  50204. nextValue = handler.onReject(nextValue);
  50205. nextStatus = STATUS_RESOLVED;
  50206. if (handler.thisPromise._unhandledRejection) {
  50207. this.removeUnhandeledRejection(handler.thisPromise);
  50208. }
  50209. }
  50210. } catch (ex) {
  50211. nextStatus = STATUS_REJECTED;
  50212. nextValue = ex;
  50213. }
  50214. handler.nextPromise._updateStatus(nextStatus, nextValue);
  50215. if (Date.now() >= timeoutAt) {
  50216. break;
  50217. }
  50218. }
  50219. if (this.handlers.length > 0) {
  50220. setTimeout(this.runHandlers.bind(this), 0);
  50221. return;
  50222. }
  50223. this.running = false;
  50224. },
  50225. addUnhandledRejection: function addUnhandledRejection(promise) {
  50226. this.unhandledRejections.push({
  50227. promise: promise,
  50228. time: Date.now()
  50229. });
  50230. this.scheduleRejectionCheck();
  50231. },
  50232. removeUnhandeledRejection: function removeUnhandeledRejection(promise) {
  50233. promise._unhandledRejection = false;
  50234. for (var i = 0; i < this.unhandledRejections.length; i++) {
  50235. if (this.unhandledRejections[i].promise === promise) {
  50236. this.unhandledRejections.splice(i);
  50237. i--;
  50238. }
  50239. }
  50240. },
  50241. scheduleRejectionCheck: function scheduleRejectionCheck() {
  50242. if (this.pendingRejectionCheck) {
  50243. return;
  50244. }
  50245. this.pendingRejectionCheck = true;
  50246. setTimeout(function rejectionCheck() {
  50247. this.pendingRejectionCheck = false;
  50248. var now = Date.now();
  50249. for (var i = 0; i < this.unhandledRejections.length; i++) {
  50250. if (now - this.unhandledRejections[i].time > REJECTION_TIMEOUT) {
  50251. var unhandled = this.unhandledRejections[i].promise._value;
  50252. var msg = 'Unhandled rejection: ' + unhandled;
  50253. if (unhandled.stack) {
  50254. msg += '\n' + unhandled.stack;
  50255. }
  50256. try {
  50257. throw new Error(msg);
  50258. } catch (_) {
  50259. console.warn(msg);
  50260. }
  50261. this.unhandledRejections.splice(i);
  50262. i--;
  50263. }
  50264. }
  50265. if (this.unhandledRejections.length) {
  50266. this.scheduleRejectionCheck();
  50267. }
  50268. }.bind(this), REJECTION_TIMEOUT);
  50269. }
  50270. };
  50271. var Promise = function Promise(resolver) {
  50272. this._status = STATUS_PENDING;
  50273. this._handlers = [];
  50274. try {
  50275. resolver.call(this, this._resolve.bind(this), this._reject.bind(this));
  50276. } catch (e) {
  50277. this._reject(e);
  50278. }
  50279. };
  50280. Promise.all = function Promise_all(promises) {
  50281. var resolveAll, rejectAll;
  50282. var deferred = new Promise(function (resolve, reject) {
  50283. resolveAll = resolve;
  50284. rejectAll = reject;
  50285. });
  50286. var unresolved = promises.length;
  50287. var results = [];
  50288. if (unresolved === 0) {
  50289. resolveAll(results);
  50290. return deferred;
  50291. }
  50292. function reject(reason) {
  50293. if (deferred._status === STATUS_REJECTED) {
  50294. return;
  50295. }
  50296. results = [];
  50297. rejectAll(reason);
  50298. }
  50299. for (var i = 0, ii = promises.length; i < ii; ++i) {
  50300. var promise = promises[i];
  50301. var resolve = function (i) {
  50302. return function (value) {
  50303. if (deferred._status === STATUS_REJECTED) {
  50304. return;
  50305. }
  50306. results[i] = value;
  50307. unresolved--;
  50308. if (unresolved === 0) {
  50309. resolveAll(results);
  50310. }
  50311. };
  50312. }(i);
  50313. if (Promise.isPromise(promise)) {
  50314. promise.then(resolve, reject);
  50315. } else {
  50316. resolve(promise);
  50317. }
  50318. }
  50319. return deferred;
  50320. };
  50321. Promise.isPromise = function Promise_isPromise(value) {
  50322. return value && typeof value.then === 'function';
  50323. };
  50324. Promise.resolve = function Promise_resolve(value) {
  50325. return new Promise(function (resolve) {
  50326. resolve(value);
  50327. });
  50328. };
  50329. Promise.reject = function Promise_reject(reason) {
  50330. return new Promise(function (resolve, reject) {
  50331. reject(reason);
  50332. });
  50333. };
  50334. Promise.prototype = {
  50335. _status: null,
  50336. _value: null,
  50337. _handlers: null,
  50338. _unhandledRejection: null,
  50339. _updateStatus: function Promise__updateStatus(status, value) {
  50340. if (this._status === STATUS_RESOLVED || this._status === STATUS_REJECTED) {
  50341. return;
  50342. }
  50343. if (status === STATUS_RESOLVED && Promise.isPromise(value)) {
  50344. value.then(this._updateStatus.bind(this, STATUS_RESOLVED), this._updateStatus.bind(this, STATUS_REJECTED));
  50345. return;
  50346. }
  50347. this._status = status;
  50348. this._value = value;
  50349. if (status === STATUS_REJECTED && this._handlers.length === 0) {
  50350. this._unhandledRejection = true;
  50351. HandlerManager.addUnhandledRejection(this);
  50352. }
  50353. HandlerManager.scheduleHandlers(this);
  50354. },
  50355. _resolve: function Promise_resolve(value) {
  50356. this._updateStatus(STATUS_RESOLVED, value);
  50357. },
  50358. _reject: function Promise_reject(reason) {
  50359. this._updateStatus(STATUS_REJECTED, reason);
  50360. },
  50361. then: function Promise_then(onResolve, onReject) {
  50362. var nextPromise = new Promise(function (resolve, reject) {
  50363. this.resolve = resolve;
  50364. this.reject = reject;
  50365. });
  50366. this._handlers.push({
  50367. thisPromise: this,
  50368. onResolve: onResolve,
  50369. onReject: onReject,
  50370. nextPromise: nextPromise
  50371. });
  50372. HandlerManager.scheduleHandlers(this);
  50373. return nextPromise;
  50374. },
  50375. catch: function Promise_catch(onReject) {
  50376. return this.then(undefined, onReject);
  50377. }
  50378. };
  50379. globalScope.Promise = Promise;
  50380. }());
  50381. (function checkWeakMap() {
  50382. if (globalScope.WeakMap) {
  50383. return;
  50384. }
  50385. var id = 0;
  50386. function WeakMap() {
  50387. this.id = '$weakmap' + id++;
  50388. }
  50389. WeakMap.prototype = {
  50390. has: function (obj) {
  50391. return !!Object.getOwnPropertyDescriptor(obj, this.id);
  50392. },
  50393. get: function (obj, defaultValue) {
  50394. return this.has(obj) ? obj[this.id] : defaultValue;
  50395. },
  50396. set: function (obj, value) {
  50397. Object.defineProperty(obj, this.id, {
  50398. value: value,
  50399. enumerable: false,
  50400. configurable: true
  50401. });
  50402. },
  50403. delete: function (obj) {
  50404. delete obj[this.id];
  50405. }
  50406. };
  50407. globalScope.WeakMap = WeakMap;
  50408. }());
  50409. (function checkURLConstructor() {
  50410. var hasWorkingUrl = false;
  50411. try {
  50412. if (typeof URL === 'function' && typeof URL.prototype === 'object' && 'origin' in URL.prototype) {
  50413. var u = new URL('b', 'http://a');
  50414. u.pathname = 'c%20d';
  50415. hasWorkingUrl = u.href === 'http://a/c%20d';
  50416. }
  50417. } catch (e) {
  50418. }
  50419. if (hasWorkingUrl) {
  50420. return;
  50421. }
  50422. var relative = Object.create(null);
  50423. relative['ftp'] = 21;
  50424. relative['file'] = 0;
  50425. relative['gopher'] = 70;
  50426. relative['http'] = 80;
  50427. relative['https'] = 443;
  50428. relative['ws'] = 80;
  50429. relative['wss'] = 443;
  50430. var relativePathDotMapping = Object.create(null);
  50431. relativePathDotMapping['%2e'] = '.';
  50432. relativePathDotMapping['.%2e'] = '..';
  50433. relativePathDotMapping['%2e.'] = '..';
  50434. relativePathDotMapping['%2e%2e'] = '..';
  50435. function isRelativeScheme(scheme) {
  50436. return relative[scheme] !== undefined;
  50437. }
  50438. function invalid() {
  50439. clear.call(this);
  50440. this._isInvalid = true;
  50441. }
  50442. function IDNAToASCII(h) {
  50443. if (h === '') {
  50444. invalid.call(this);
  50445. }
  50446. return h.toLowerCase();
  50447. }
  50448. function percentEscape(c) {
  50449. var unicode = c.charCodeAt(0);
  50450. if (unicode > 0x20 && unicode < 0x7F && [
  50451. 0x22,
  50452. 0x23,
  50453. 0x3C,
  50454. 0x3E,
  50455. 0x3F,
  50456. 0x60
  50457. ].indexOf(unicode) === -1) {
  50458. return c;
  50459. }
  50460. return encodeURIComponent(c);
  50461. }
  50462. function percentEscapeQuery(c) {
  50463. var unicode = c.charCodeAt(0);
  50464. if (unicode > 0x20 && unicode < 0x7F && [
  50465. 0x22,
  50466. 0x23,
  50467. 0x3C,
  50468. 0x3E,
  50469. 0x60
  50470. ].indexOf(unicode) === -1) {
  50471. return c;
  50472. }
  50473. return encodeURIComponent(c);
  50474. }
  50475. var EOF, ALPHA = /[a-zA-Z]/, ALPHANUMERIC = /[a-zA-Z0-9\+\-\.]/;
  50476. function parse(input, stateOverride, base) {
  50477. function err(message) {
  50478. errors.push(message);
  50479. }
  50480. var state = stateOverride || 'scheme start', cursor = 0, buffer = '', seenAt = false, seenBracket = false, errors = [];
  50481. loop:
  50482. while ((input[cursor - 1] !== EOF || cursor === 0) && !this._isInvalid) {
  50483. var c = input[cursor];
  50484. switch (state) {
  50485. case 'scheme start':
  50486. if (c && ALPHA.test(c)) {
  50487. buffer += c.toLowerCase();
  50488. state = 'scheme';
  50489. } else if (!stateOverride) {
  50490. buffer = '';
  50491. state = 'no scheme';
  50492. continue;
  50493. } else {
  50494. err('Invalid scheme.');
  50495. break loop;
  50496. }
  50497. break;
  50498. case 'scheme':
  50499. if (c && ALPHANUMERIC.test(c)) {
  50500. buffer += c.toLowerCase();
  50501. } else if (c === ':') {
  50502. this._scheme = buffer;
  50503. buffer = '';
  50504. if (stateOverride) {
  50505. break loop;
  50506. }
  50507. if (isRelativeScheme(this._scheme)) {
  50508. this._isRelative = true;
  50509. }
  50510. if (this._scheme === 'file') {
  50511. state = 'relative';
  50512. } else if (this._isRelative && base && base._scheme === this._scheme) {
  50513. state = 'relative or authority';
  50514. } else if (this._isRelative) {
  50515. state = 'authority first slash';
  50516. } else {
  50517. state = 'scheme data';
  50518. }
  50519. } else if (!stateOverride) {
  50520. buffer = '';
  50521. cursor = 0;
  50522. state = 'no scheme';
  50523. continue;
  50524. } else if (EOF === c) {
  50525. break loop;
  50526. } else {
  50527. err('Code point not allowed in scheme: ' + c);
  50528. break loop;
  50529. }
  50530. break;
  50531. case 'scheme data':
  50532. if (c === '?') {
  50533. this._query = '?';
  50534. state = 'query';
  50535. } else if (c === '#') {
  50536. this._fragment = '#';
  50537. state = 'fragment';
  50538. } else {
  50539. if (EOF !== c && '\t' !== c && '\n' !== c && '\r' !== c) {
  50540. this._schemeData += percentEscape(c);
  50541. }
  50542. }
  50543. break;
  50544. case 'no scheme':
  50545. if (!base || !isRelativeScheme(base._scheme)) {
  50546. err('Missing scheme.');
  50547. invalid.call(this);
  50548. } else {
  50549. state = 'relative';
  50550. continue;
  50551. }
  50552. break;
  50553. case 'relative or authority':
  50554. if (c === '/' && input[cursor + 1] === '/') {
  50555. state = 'authority ignore slashes';
  50556. } else {
  50557. err('Expected /, got: ' + c);
  50558. state = 'relative';
  50559. continue;
  50560. }
  50561. break;
  50562. case 'relative':
  50563. this._isRelative = true;
  50564. if ('file' !== this._scheme) {
  50565. this._scheme = base._scheme;
  50566. }
  50567. if (EOF === c) {
  50568. this._host = base._host;
  50569. this._port = base._port;
  50570. this._path = base._path.slice();
  50571. this._query = base._query;
  50572. this._username = base._username;
  50573. this._password = base._password;
  50574. break loop;
  50575. } else if (c === '/' || c === '\\') {
  50576. if (c === '\\') {
  50577. err('\\ is an invalid code point.');
  50578. }
  50579. state = 'relative slash';
  50580. } else if (c === '?') {
  50581. this._host = base._host;
  50582. this._port = base._port;
  50583. this._path = base._path.slice();
  50584. this._query = '?';
  50585. this._username = base._username;
  50586. this._password = base._password;
  50587. state = 'query';
  50588. } else if (c === '#') {
  50589. this._host = base._host;
  50590. this._port = base._port;
  50591. this._path = base._path.slice();
  50592. this._query = base._query;
  50593. this._fragment = '#';
  50594. this._username = base._username;
  50595. this._password = base._password;
  50596. state = 'fragment';
  50597. } else {
  50598. var nextC = input[cursor + 1];
  50599. var nextNextC = input[cursor + 2];
  50600. if ('file' !== this._scheme || !ALPHA.test(c) || nextC !== ':' && nextC !== '|' || EOF !== nextNextC && '/' !== nextNextC && '\\' !== nextNextC && '?' !== nextNextC && '#' !== nextNextC) {
  50601. this._host = base._host;
  50602. this._port = base._port;
  50603. this._username = base._username;
  50604. this._password = base._password;
  50605. this._path = base._path.slice();
  50606. this._path.pop();
  50607. }
  50608. state = 'relative path';
  50609. continue;
  50610. }
  50611. break;
  50612. case 'relative slash':
  50613. if (c === '/' || c === '\\') {
  50614. if (c === '\\') {
  50615. err('\\ is an invalid code point.');
  50616. }
  50617. if (this._scheme === 'file') {
  50618. state = 'file host';
  50619. } else {
  50620. state = 'authority ignore slashes';
  50621. }
  50622. } else {
  50623. if ('file' !== this._scheme) {
  50624. this._host = base._host;
  50625. this._port = base._port;
  50626. this._username = base._username;
  50627. this._password = base._password;
  50628. }
  50629. state = 'relative path';
  50630. continue;
  50631. }
  50632. break;
  50633. case 'authority first slash':
  50634. if (c === '/') {
  50635. state = 'authority second slash';
  50636. } else {
  50637. err('Expected \'/\', got: ' + c);
  50638. state = 'authority ignore slashes';
  50639. continue;
  50640. }
  50641. break;
  50642. case 'authority second slash':
  50643. state = 'authority ignore slashes';
  50644. if ('/' !== c) {
  50645. err('Expected \'/\', got: ' + c);
  50646. continue;
  50647. }
  50648. break;
  50649. case 'authority ignore slashes':
  50650. if ('/' !== c && '\\' !== c) {
  50651. state = 'authority';
  50652. continue;
  50653. } else {
  50654. err('Expected authority, got: ' + c);
  50655. }
  50656. break;
  50657. case 'authority':
  50658. if (c === '@') {
  50659. if (seenAt) {
  50660. err('@ already seen.');
  50661. buffer += '%40';
  50662. }
  50663. seenAt = true;
  50664. for (var i = 0; i < buffer.length; i++) {
  50665. var cp = buffer[i];
  50666. if (cp === '\t' || cp === '\n' || cp === '\r') {
  50667. err('Invalid whitespace in authority.');
  50668. continue;
  50669. }
  50670. if (cp === ':' && this._password === null) {
  50671. this._password = '';
  50672. continue;
  50673. }
  50674. var tempC = percentEscape(cp);
  50675. if (null !== this._password) {
  50676. this._password += tempC;
  50677. } else {
  50678. this._username += tempC;
  50679. }
  50680. }
  50681. buffer = '';
  50682. } else if (c === EOF || c === '/' || c === '\\' || c === '?' || c === '#') {
  50683. cursor -= buffer.length;
  50684. buffer = '';
  50685. state = 'host';
  50686. continue;
  50687. } else {
  50688. buffer += c;
  50689. }
  50690. break;
  50691. case 'file host':
  50692. if (c === EOF || c === '/' || c === '\\' || c === '?' || c === '#') {
  50693. if (buffer.length === 2 && ALPHA.test(buffer[0]) && (buffer[1] === ':' || buffer[1] === '|')) {
  50694. state = 'relative path';
  50695. } else if (buffer.length === 0) {
  50696. state = 'relative path start';
  50697. } else {
  50698. this._host = IDNAToASCII.call(this, buffer);
  50699. buffer = '';
  50700. state = 'relative path start';
  50701. }
  50702. continue;
  50703. } else if (c === '\t' || c === '\n' || c === '\r') {
  50704. err('Invalid whitespace in file host.');
  50705. } else {
  50706. buffer += c;
  50707. }
  50708. break;
  50709. case 'host':
  50710. case 'hostname':
  50711. if (c === ':' && !seenBracket) {
  50712. this._host = IDNAToASCII.call(this, buffer);
  50713. buffer = '';
  50714. state = 'port';
  50715. if (stateOverride === 'hostname') {
  50716. break loop;
  50717. }
  50718. } else if (c === EOF || c === '/' || c === '\\' || c === '?' || c === '#') {
  50719. this._host = IDNAToASCII.call(this, buffer);
  50720. buffer = '';
  50721. state = 'relative path start';
  50722. if (stateOverride) {
  50723. break loop;
  50724. }
  50725. continue;
  50726. } else if ('\t' !== c && '\n' !== c && '\r' !== c) {
  50727. if (c === '[') {
  50728. seenBracket = true;
  50729. } else if (c === ']') {
  50730. seenBracket = false;
  50731. }
  50732. buffer += c;
  50733. } else {
  50734. err('Invalid code point in host/hostname: ' + c);
  50735. }
  50736. break;
  50737. case 'port':
  50738. if (/[0-9]/.test(c)) {
  50739. buffer += c;
  50740. } else if (c === EOF || c === '/' || c === '\\' || c === '?' || c === '#' || stateOverride) {
  50741. if ('' !== buffer) {
  50742. var temp = parseInt(buffer, 10);
  50743. if (temp !== relative[this._scheme]) {
  50744. this._port = temp + '';
  50745. }
  50746. buffer = '';
  50747. }
  50748. if (stateOverride) {
  50749. break loop;
  50750. }
  50751. state = 'relative path start';
  50752. continue;
  50753. } else if (c === '\t' || c === '\n' || c === '\r') {
  50754. err('Invalid code point in port: ' + c);
  50755. } else {
  50756. invalid.call(this);
  50757. }
  50758. break;
  50759. case 'relative path start':
  50760. if (c === '\\') {
  50761. err('\'\\\' not allowed in path.');
  50762. }
  50763. state = 'relative path';
  50764. if ('/' !== c && '\\' !== c) {
  50765. continue;
  50766. }
  50767. break;
  50768. case 'relative path':
  50769. if (c === EOF || c === '/' || c === '\\' || !stateOverride && (c === '?' || c === '#')) {
  50770. if (c === '\\') {
  50771. err('\\ not allowed in relative path.');
  50772. }
  50773. var tmp;
  50774. if (tmp = relativePathDotMapping[buffer.toLowerCase()]) {
  50775. buffer = tmp;
  50776. }
  50777. if (buffer === '..') {
  50778. this._path.pop();
  50779. if ('/' !== c && '\\' !== c) {
  50780. this._path.push('');
  50781. }
  50782. } else if (buffer === '.' && '/' !== c && '\\' !== c) {
  50783. this._path.push('');
  50784. } else if ('.' !== buffer) {
  50785. if (this._scheme === 'file' && this._path.length === 0 && buffer.length === 2 && ALPHA.test(buffer[0]) && buffer[1] === '|') {
  50786. buffer = buffer[0] + ':';
  50787. }
  50788. this._path.push(buffer);
  50789. }
  50790. buffer = '';
  50791. if (c === '?') {
  50792. this._query = '?';
  50793. state = 'query';
  50794. } else if (c === '#') {
  50795. this._fragment = '#';
  50796. state = 'fragment';
  50797. }
  50798. } else if ('\t' !== c && '\n' !== c && '\r' !== c) {
  50799. buffer += percentEscape(c);
  50800. }
  50801. break;
  50802. case 'query':
  50803. if (!stateOverride && c === '#') {
  50804. this._fragment = '#';
  50805. state = 'fragment';
  50806. } else if (EOF !== c && '\t' !== c && '\n' !== c && '\r' !== c) {
  50807. this._query += percentEscapeQuery(c);
  50808. }
  50809. break;
  50810. case 'fragment':
  50811. if (EOF !== c && '\t' !== c && '\n' !== c && '\r' !== c) {
  50812. this._fragment += c;
  50813. }
  50814. break;
  50815. }
  50816. cursor++;
  50817. }
  50818. }
  50819. function clear() {
  50820. this._scheme = '';
  50821. this._schemeData = '';
  50822. this._username = '';
  50823. this._password = null;
  50824. this._host = '';
  50825. this._port = '';
  50826. this._path = [];
  50827. this._query = '';
  50828. this._fragment = '';
  50829. this._isInvalid = false;
  50830. this._isRelative = false;
  50831. }
  50832. function JURL(url, base) {
  50833. if (base !== undefined && !(base instanceof JURL)) {
  50834. base = new JURL(String(base));
  50835. }
  50836. this._url = url;
  50837. clear.call(this);
  50838. var input = url.replace(/^[ \t\r\n\f]+|[ \t\r\n\f]+$/g, '');
  50839. parse.call(this, input, null, base);
  50840. }
  50841. JURL.prototype = {
  50842. toString: function () {
  50843. return this.href;
  50844. },
  50845. get href() {
  50846. if (this._isInvalid) {
  50847. return this._url;
  50848. }
  50849. var authority = '';
  50850. if ('' !== this._username || null !== this._password) {
  50851. authority = this._username + (null !== this._password ? ':' + this._password : '') + '@';
  50852. }
  50853. return this.protocol + (this._isRelative ? '//' + authority + this.host : '') + this.pathname + this._query + this._fragment;
  50854. },
  50855. set href(href) {
  50856. clear.call(this);
  50857. parse.call(this, href);
  50858. },
  50859. get protocol() {
  50860. return this._scheme + ':';
  50861. },
  50862. set protocol(protocol) {
  50863. if (this._isInvalid) {
  50864. return;
  50865. }
  50866. parse.call(this, protocol + ':', 'scheme start');
  50867. },
  50868. get host() {
  50869. return this._isInvalid ? '' : this._port ? this._host + ':' + this._port : this._host;
  50870. },
  50871. set host(host) {
  50872. if (this._isInvalid || !this._isRelative) {
  50873. return;
  50874. }
  50875. parse.call(this, host, 'host');
  50876. },
  50877. get hostname() {
  50878. return this._host;
  50879. },
  50880. set hostname(hostname) {
  50881. if (this._isInvalid || !this._isRelative) {
  50882. return;
  50883. }
  50884. parse.call(this, hostname, 'hostname');
  50885. },
  50886. get port() {
  50887. return this._port;
  50888. },
  50889. set port(port) {
  50890. if (this._isInvalid || !this._isRelative) {
  50891. return;
  50892. }
  50893. parse.call(this, port, 'port');
  50894. },
  50895. get pathname() {
  50896. return this._isInvalid ? '' : this._isRelative ? '/' + this._path.join('/') : this._schemeData;
  50897. },
  50898. set pathname(pathname) {
  50899. if (this._isInvalid || !this._isRelative) {
  50900. return;
  50901. }
  50902. this._path = [];
  50903. parse.call(this, pathname, 'relative path start');
  50904. },
  50905. get search() {
  50906. return this._isInvalid || !this._query || this._query === '?' ? '' : this._query;
  50907. },
  50908. set search(search) {
  50909. if (this._isInvalid || !this._isRelative) {
  50910. return;
  50911. }
  50912. this._query = '?';
  50913. if (search[0] === '?') {
  50914. search = search.slice(1);
  50915. }
  50916. parse.call(this, search, 'query');
  50917. },
  50918. get hash() {
  50919. return this._isInvalid || !this._fragment || this._fragment === '#' ? '' : this._fragment;
  50920. },
  50921. set hash(hash) {
  50922. if (this._isInvalid) {
  50923. return;
  50924. }
  50925. this._fragment = '#';
  50926. if (hash[0] === '#') {
  50927. hash = hash.slice(1);
  50928. }
  50929. parse.call(this, hash, 'fragment');
  50930. },
  50931. get origin() {
  50932. var host;
  50933. if (this._isInvalid || !this._scheme) {
  50934. return '';
  50935. }
  50936. switch (this._scheme) {
  50937. case 'data':
  50938. case 'file':
  50939. case 'javascript':
  50940. case 'mailto':
  50941. return 'null';
  50942. }
  50943. host = this.host;
  50944. if (!host) {
  50945. return '';
  50946. }
  50947. return this._scheme + '://' + host;
  50948. }
  50949. };
  50950. var OriginalURL = globalScope.URL;
  50951. if (OriginalURL) {
  50952. JURL.createObjectURL = function (blob) {
  50953. return OriginalURL.createObjectURL.apply(OriginalURL, arguments);
  50954. };
  50955. JURL.revokeObjectURL = function (url) {
  50956. OriginalURL.revokeObjectURL(url);
  50957. };
  50958. }
  50959. globalScope.URL = JURL;
  50960. }());
  50961. }
  50962. /* WEBPACK VAR INJECTION */}.call(exports, __w_pdfjs_require__(9)))
  50963. /***/ }),
  50964. /* 37 */
  50965. /***/ (function(module, exports, __w_pdfjs_require__) {
  50966. "use strict";
  50967. var pdfjsVersion = '1.7.367';
  50968. var pdfjsBuild = 'f0c45f03';
  50969. var pdfjsCoreWorker = __w_pdfjs_require__(8);
  50970. {
  50971. __w_pdfjs_require__(19);
  50972. }
  50973. exports.WorkerMessageHandler = pdfjsCoreWorker.WorkerMessageHandler;
  50974. /***/ })
  50975. /******/ ]);
  50976. });