pdf.worker.js 1.3 MB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287228822892290229122922293229422952296229722982299230023012302230323042305230623072308230923102311231223132314231523162317231823192320232123222323232423252326232723282329233023312332233323342335233623372338233923402341234223432344234523462347234823492350235123522353235423552356235723582359236023612362236323642365236623672368236923702371237223732374237523762377237823792380238123822383238423852386238723882389239023912392239323942395239623972398239924002401240224032404240524062407240824092410241124122413241424152416241724182419242024212422242324242425242624272428242924302431243224332434243524362437243824392440244124422443244424452446244724482449245024512452245324542455245624572458245924602461246224632464246524662467246824692470247124722473247424752476247724782479248024812482248324842485248624872488248924902491249224932494249524962497249824992500250125022503250425052506250725082509251025112512251325142515251625172518251925202521252225232524252525262527252825292530253125322533253425352536253725382539254025412542254325442545254625472548254925502551255225532554255525562557255825592560256125622563256425652566256725682569257025712572257325742575257625772578257925802581258225832584258525862587258825892590259125922593259425952596259725982599260026012602260326042605260626072608260926102611261226132614261526162617261826192620262126222623262426252626262726282629263026312632263326342635263626372638263926402641264226432644264526462647264826492650265126522653265426552656265726582659266026612662266326642665266626672668266926702671267226732674267526762677267826792680268126822683268426852686268726882689269026912692269326942695269626972698269927002701270227032704270527062707270827092710271127122713271427152716271727182719272027212722272327242725272627272728272927302731273227332734273527362737273827392740274127422743274427452746274727482749275027512752275327542755275627572758275927602761276227632764276527662767276827692770277127722773277427752776277727782779278027812782278327842785278627872788278927902791279227932794279527962797279827992800280128022803280428052806280728082809281028112812281328142815281628172818281928202821282228232824282528262827282828292830283128322833283428352836283728382839284028412842284328442845284628472848284928502851285228532854285528562857285828592860286128622863286428652866286728682869287028712872287328742875287628772878287928802881288228832884288528862887288828892890289128922893289428952896289728982899290029012902290329042905290629072908290929102911291229132914291529162917291829192920292129222923292429252926292729282929293029312932293329342935293629372938293929402941294229432944294529462947294829492950295129522953295429552956295729582959296029612962296329642965296629672968296929702971297229732974297529762977297829792980298129822983298429852986298729882989299029912992299329942995299629972998299930003001300230033004300530063007300830093010301130123013301430153016301730183019302030213022302330243025302630273028302930303031303230333034303530363037303830393040304130423043304430453046304730483049305030513052305330543055305630573058305930603061306230633064306530663067306830693070307130723073307430753076307730783079308030813082308330843085308630873088308930903091309230933094309530963097309830993100310131023103310431053106310731083109311031113112311331143115311631173118311931203121312231233124312531263127312831293130313131323133313431353136313731383139314031413142314331443145314631473148314931503151315231533154315531563157315831593160316131623163316431653166316731683169317031713172317331743175317631773178317931803181318231833184318531863187318831893190319131923193319431953196319731983199320032013202320332043205320632073208320932103211321232133214321532163217321832193220322132223223322432253226322732283229323032313232323332343235323632373238323932403241324232433244324532463247324832493250325132523253325432553256325732583259326032613262326332643265326632673268326932703271327232733274327532763277327832793280328132823283328432853286328732883289329032913292329332943295329632973298329933003301330233033304330533063307330833093310331133123313331433153316331733183319332033213322332333243325332633273328332933303331333233333334333533363337333833393340334133423343334433453346334733483349335033513352335333543355335633573358335933603361336233633364336533663367336833693370337133723373337433753376337733783379338033813382338333843385338633873388338933903391339233933394339533963397339833993400340134023403340434053406340734083409341034113412341334143415341634173418341934203421342234233424342534263427342834293430343134323433343434353436343734383439344034413442344334443445344634473448344934503451345234533454345534563457345834593460346134623463346434653466346734683469347034713472347334743475347634773478347934803481348234833484348534863487348834893490349134923493349434953496349734983499350035013502350335043505350635073508350935103511351235133514351535163517351835193520352135223523352435253526352735283529353035313532353335343535353635373538353935403541354235433544354535463547354835493550355135523553355435553556355735583559356035613562356335643565356635673568356935703571357235733574357535763577357835793580358135823583358435853586358735883589359035913592359335943595359635973598359936003601360236033604360536063607360836093610361136123613361436153616361736183619362036213622362336243625362636273628362936303631363236333634363536363637363836393640364136423643364436453646364736483649365036513652365336543655365636573658365936603661366236633664366536663667366836693670367136723673367436753676367736783679368036813682368336843685368636873688368936903691369236933694369536963697369836993700370137023703370437053706370737083709371037113712371337143715371637173718371937203721372237233724372537263727372837293730373137323733373437353736373737383739374037413742374337443745374637473748374937503751375237533754375537563757375837593760376137623763376437653766376737683769377037713772377337743775377637773778377937803781378237833784378537863787378837893790379137923793379437953796379737983799380038013802380338043805380638073808380938103811381238133814381538163817381838193820382138223823382438253826382738283829383038313832383338343835383638373838383938403841384238433844384538463847384838493850385138523853385438553856385738583859386038613862386338643865386638673868386938703871387238733874387538763877387838793880388138823883388438853886388738883889389038913892389338943895389638973898389939003901390239033904390539063907390839093910391139123913391439153916391739183919392039213922392339243925392639273928392939303931393239333934393539363937393839393940394139423943394439453946394739483949395039513952395339543955395639573958395939603961396239633964396539663967396839693970397139723973397439753976397739783979398039813982398339843985398639873988398939903991399239933994399539963997399839994000400140024003400440054006400740084009401040114012401340144015401640174018401940204021402240234024402540264027402840294030403140324033403440354036403740384039404040414042404340444045404640474048404940504051405240534054405540564057405840594060406140624063406440654066406740684069407040714072407340744075407640774078407940804081408240834084408540864087408840894090409140924093409440954096409740984099410041014102410341044105410641074108410941104111411241134114411541164117411841194120412141224123412441254126412741284129413041314132413341344135413641374138413941404141414241434144414541464147414841494150415141524153415441554156415741584159416041614162416341644165416641674168416941704171417241734174417541764177417841794180418141824183418441854186418741884189419041914192419341944195419641974198419942004201420242034204420542064207420842094210421142124213421442154216421742184219422042214222422342244225422642274228422942304231423242334234423542364237423842394240424142424243424442454246424742484249425042514252425342544255425642574258425942604261426242634264426542664267426842694270427142724273427442754276427742784279428042814282428342844285428642874288428942904291429242934294429542964297429842994300430143024303430443054306430743084309431043114312431343144315431643174318431943204321432243234324432543264327432843294330433143324333433443354336433743384339434043414342434343444345434643474348434943504351435243534354435543564357435843594360436143624363436443654366436743684369437043714372437343744375437643774378437943804381438243834384438543864387438843894390439143924393439443954396439743984399440044014402440344044405440644074408440944104411441244134414441544164417441844194420442144224423442444254426442744284429443044314432443344344435443644374438443944404441444244434444444544464447444844494450445144524453445444554456445744584459446044614462446344644465446644674468446944704471447244734474447544764477447844794480448144824483448444854486448744884489449044914492449344944495449644974498449945004501450245034504450545064507450845094510451145124513451445154516451745184519452045214522452345244525452645274528452945304531453245334534453545364537453845394540454145424543454445454546454745484549455045514552455345544555455645574558455945604561456245634564456545664567456845694570457145724573457445754576457745784579458045814582458345844585458645874588458945904591459245934594459545964597459845994600460146024603460446054606460746084609461046114612461346144615461646174618461946204621462246234624462546264627462846294630463146324633463446354636463746384639464046414642464346444645464646474648464946504651465246534654465546564657465846594660466146624663466446654666466746684669467046714672467346744675467646774678467946804681468246834684468546864687468846894690469146924693469446954696469746984699470047014702470347044705470647074708470947104711471247134714471547164717471847194720472147224723472447254726472747284729473047314732473347344735473647374738473947404741474247434744474547464747474847494750475147524753475447554756475747584759476047614762476347644765476647674768476947704771477247734774477547764777477847794780478147824783478447854786478747884789479047914792479347944795479647974798479948004801480248034804480548064807480848094810481148124813481448154816481748184819482048214822482348244825482648274828482948304831483248334834483548364837483848394840484148424843484448454846484748484849485048514852485348544855485648574858485948604861486248634864486548664867486848694870487148724873487448754876487748784879488048814882488348844885488648874888488948904891489248934894489548964897489848994900490149024903490449054906490749084909491049114912491349144915491649174918491949204921492249234924492549264927492849294930493149324933493449354936493749384939494049414942494349444945494649474948494949504951495249534954495549564957495849594960496149624963496449654966496749684969497049714972497349744975497649774978497949804981498249834984498549864987498849894990499149924993499449954996499749984999500050015002500350045005500650075008500950105011501250135014501550165017501850195020502150225023502450255026502750285029503050315032503350345035503650375038503950405041504250435044504550465047504850495050505150525053505450555056505750585059506050615062506350645065506650675068506950705071507250735074507550765077507850795080508150825083508450855086508750885089509050915092509350945095509650975098509951005101510251035104510551065107510851095110511151125113511451155116511751185119512051215122512351245125512651275128512951305131513251335134513551365137513851395140514151425143514451455146514751485149515051515152515351545155515651575158515951605161516251635164516551665167516851695170517151725173517451755176517751785179518051815182518351845185518651875188518951905191519251935194519551965197519851995200520152025203520452055206520752085209521052115212521352145215521652175218521952205221522252235224522552265227522852295230523152325233523452355236523752385239524052415242524352445245524652475248524952505251525252535254525552565257525852595260526152625263526452655266526752685269527052715272527352745275527652775278527952805281528252835284528552865287528852895290529152925293529452955296529752985299530053015302530353045305530653075308530953105311531253135314531553165317531853195320532153225323532453255326532753285329533053315332533353345335533653375338533953405341534253435344534553465347534853495350535153525353535453555356535753585359536053615362536353645365536653675368536953705371537253735374537553765377537853795380538153825383538453855386538753885389539053915392539353945395539653975398539954005401540254035404540554065407540854095410541154125413541454155416541754185419542054215422542354245425542654275428542954305431543254335434543554365437543854395440544154425443544454455446544754485449545054515452545354545455545654575458545954605461546254635464546554665467546854695470547154725473547454755476547754785479548054815482548354845485548654875488548954905491549254935494549554965497549854995500550155025503550455055506550755085509551055115512551355145515551655175518551955205521552255235524552555265527552855295530553155325533553455355536553755385539554055415542554355445545554655475548554955505551555255535554555555565557555855595560556155625563556455655566556755685569557055715572557355745575557655775578557955805581558255835584558555865587558855895590559155925593559455955596559755985599560056015602560356045605560656075608560956105611561256135614561556165617561856195620562156225623562456255626562756285629563056315632563356345635563656375638563956405641564256435644564556465647564856495650565156525653565456555656565756585659566056615662566356645665566656675668566956705671567256735674567556765677567856795680568156825683568456855686568756885689569056915692569356945695569656975698569957005701570257035704570557065707570857095710571157125713571457155716571757185719572057215722572357245725572657275728572957305731573257335734573557365737573857395740574157425743574457455746574757485749575057515752575357545755575657575758575957605761576257635764576557665767576857695770577157725773577457755776577757785779578057815782578357845785578657875788578957905791579257935794579557965797579857995800580158025803580458055806580758085809581058115812581358145815581658175818581958205821582258235824582558265827582858295830583158325833583458355836583758385839584058415842584358445845584658475848584958505851585258535854585558565857585858595860586158625863586458655866586758685869587058715872587358745875587658775878587958805881588258835884588558865887588858895890589158925893589458955896589758985899590059015902590359045905590659075908590959105911591259135914591559165917591859195920592159225923592459255926592759285929593059315932593359345935593659375938593959405941594259435944594559465947594859495950595159525953595459555956595759585959596059615962596359645965596659675968596959705971597259735974597559765977597859795980598159825983598459855986598759885989599059915992599359945995599659975998599960006001600260036004600560066007600860096010601160126013601460156016601760186019602060216022602360246025602660276028602960306031603260336034603560366037603860396040604160426043604460456046604760486049605060516052605360546055605660576058605960606061606260636064606560666067606860696070607160726073607460756076607760786079608060816082608360846085608660876088608960906091609260936094609560966097609860996100610161026103610461056106610761086109611061116112611361146115611661176118611961206121612261236124612561266127612861296130613161326133613461356136613761386139614061416142614361446145614661476148614961506151615261536154615561566157615861596160616161626163616461656166616761686169617061716172617361746175617661776178617961806181618261836184618561866187618861896190619161926193619461956196619761986199620062016202620362046205620662076208620962106211621262136214621562166217621862196220622162226223622462256226622762286229623062316232623362346235623662376238623962406241624262436244624562466247624862496250625162526253625462556256625762586259626062616262626362646265626662676268626962706271627262736274627562766277627862796280628162826283628462856286628762886289629062916292629362946295629662976298629963006301630263036304630563066307630863096310631163126313631463156316631763186319632063216322632363246325632663276328632963306331633263336334633563366337633863396340634163426343634463456346634763486349635063516352635363546355635663576358635963606361636263636364636563666367636863696370637163726373637463756376637763786379638063816382638363846385638663876388638963906391639263936394639563966397639863996400640164026403640464056406640764086409641064116412641364146415641664176418641964206421642264236424642564266427642864296430643164326433643464356436643764386439644064416442644364446445644664476448644964506451645264536454645564566457645864596460646164626463646464656466646764686469647064716472647364746475647664776478647964806481648264836484648564866487648864896490649164926493649464956496649764986499650065016502650365046505650665076508650965106511651265136514651565166517651865196520652165226523652465256526652765286529653065316532653365346535653665376538653965406541654265436544654565466547654865496550655165526553655465556556655765586559656065616562656365646565656665676568656965706571657265736574657565766577657865796580658165826583658465856586658765886589659065916592659365946595659665976598659966006601660266036604660566066607660866096610661166126613661466156616661766186619662066216622662366246625662666276628662966306631663266336634663566366637663866396640664166426643664466456646664766486649665066516652665366546655665666576658665966606661666266636664666566666667666866696670667166726673667466756676667766786679668066816682668366846685668666876688668966906691669266936694669566966697669866996700670167026703670467056706670767086709671067116712671367146715671667176718671967206721672267236724672567266727672867296730673167326733673467356736673767386739674067416742674367446745674667476748674967506751675267536754675567566757675867596760676167626763676467656766676767686769677067716772677367746775677667776778677967806781678267836784678567866787678867896790679167926793679467956796679767986799680068016802680368046805680668076808680968106811681268136814681568166817681868196820682168226823682468256826682768286829683068316832683368346835683668376838683968406841684268436844684568466847684868496850685168526853685468556856685768586859686068616862686368646865686668676868686968706871687268736874687568766877687868796880688168826883688468856886688768886889689068916892689368946895689668976898689969006901690269036904690569066907690869096910691169126913691469156916691769186919692069216922692369246925692669276928692969306931693269336934693569366937693869396940694169426943694469456946694769486949695069516952695369546955695669576958695969606961696269636964696569666967696869696970697169726973697469756976697769786979698069816982698369846985698669876988698969906991699269936994699569966997699869997000700170027003700470057006700770087009701070117012701370147015701670177018701970207021702270237024702570267027702870297030703170327033703470357036703770387039704070417042704370447045704670477048704970507051705270537054705570567057705870597060706170627063706470657066706770687069707070717072707370747075707670777078707970807081708270837084708570867087708870897090709170927093709470957096709770987099710071017102710371047105710671077108710971107111711271137114711571167117711871197120712171227123712471257126712771287129713071317132713371347135713671377138713971407141714271437144714571467147714871497150715171527153715471557156715771587159716071617162716371647165716671677168716971707171717271737174717571767177717871797180718171827183718471857186718771887189719071917192719371947195719671977198719972007201720272037204720572067207720872097210721172127213721472157216721772187219722072217222722372247225722672277228722972307231723272337234723572367237723872397240724172427243724472457246724772487249725072517252725372547255725672577258725972607261726272637264726572667267726872697270727172727273727472757276727772787279728072817282728372847285728672877288728972907291729272937294729572967297729872997300730173027303730473057306730773087309731073117312731373147315731673177318731973207321732273237324732573267327732873297330733173327333733473357336733773387339734073417342734373447345734673477348734973507351735273537354735573567357735873597360736173627363736473657366736773687369737073717372737373747375737673777378737973807381738273837384738573867387738873897390739173927393739473957396739773987399740074017402740374047405740674077408740974107411741274137414741574167417741874197420742174227423742474257426742774287429743074317432743374347435743674377438743974407441744274437444744574467447744874497450745174527453745474557456745774587459746074617462746374647465746674677468746974707471747274737474747574767477747874797480748174827483748474857486748774887489749074917492749374947495749674977498749975007501750275037504750575067507750875097510751175127513751475157516751775187519752075217522752375247525752675277528752975307531753275337534753575367537753875397540754175427543754475457546754775487549755075517552755375547555755675577558755975607561756275637564756575667567756875697570757175727573757475757576757775787579758075817582758375847585758675877588758975907591759275937594759575967597759875997600760176027603760476057606760776087609761076117612761376147615761676177618761976207621762276237624762576267627762876297630763176327633763476357636763776387639764076417642764376447645764676477648764976507651765276537654765576567657765876597660766176627663766476657666766776687669767076717672767376747675767676777678767976807681768276837684768576867687768876897690769176927693769476957696769776987699770077017702770377047705770677077708770977107711771277137714771577167717771877197720772177227723772477257726772777287729773077317732773377347735773677377738773977407741774277437744774577467747774877497750775177527753775477557756775777587759776077617762776377647765776677677768776977707771777277737774777577767777777877797780778177827783778477857786778777887789779077917792779377947795779677977798779978007801780278037804780578067807780878097810781178127813781478157816781778187819782078217822782378247825782678277828782978307831783278337834783578367837783878397840784178427843784478457846784778487849785078517852785378547855785678577858785978607861786278637864786578667867786878697870787178727873787478757876787778787879788078817882788378847885788678877888788978907891789278937894789578967897789878997900790179027903790479057906790779087909791079117912791379147915791679177918791979207921792279237924792579267927792879297930793179327933793479357936793779387939794079417942794379447945794679477948794979507951795279537954795579567957795879597960796179627963796479657966796779687969797079717972797379747975797679777978797979807981798279837984798579867987798879897990799179927993799479957996799779987999800080018002800380048005800680078008800980108011801280138014801580168017801880198020802180228023802480258026802780288029803080318032803380348035803680378038803980408041804280438044804580468047804880498050805180528053805480558056805780588059806080618062806380648065806680678068806980708071807280738074807580768077807880798080808180828083808480858086808780888089809080918092809380948095809680978098809981008101810281038104810581068107810881098110811181128113811481158116811781188119812081218122812381248125812681278128812981308131813281338134813581368137813881398140814181428143814481458146814781488149815081518152815381548155815681578158815981608161816281638164816581668167816881698170817181728173817481758176817781788179818081818182818381848185818681878188818981908191819281938194819581968197819881998200820182028203820482058206820782088209821082118212821382148215821682178218821982208221822282238224822582268227822882298230823182328233823482358236823782388239824082418242824382448245824682478248824982508251825282538254825582568257825882598260826182628263826482658266826782688269827082718272827382748275827682778278827982808281828282838284828582868287828882898290829182928293829482958296829782988299830083018302830383048305830683078308830983108311831283138314831583168317831883198320832183228323832483258326832783288329833083318332833383348335833683378338833983408341834283438344834583468347834883498350835183528353835483558356835783588359836083618362836383648365836683678368836983708371837283738374837583768377837883798380838183828383838483858386838783888389839083918392839383948395839683978398839984008401840284038404840584068407840884098410841184128413841484158416841784188419842084218422842384248425842684278428842984308431843284338434843584368437843884398440844184428443844484458446844784488449845084518452845384548455845684578458845984608461846284638464846584668467846884698470847184728473847484758476847784788479848084818482848384848485848684878488848984908491849284938494849584968497849884998500850185028503850485058506850785088509851085118512851385148515851685178518851985208521852285238524852585268527852885298530853185328533853485358536853785388539854085418542854385448545854685478548854985508551855285538554855585568557855885598560856185628563856485658566856785688569857085718572857385748575857685778578857985808581858285838584858585868587858885898590859185928593859485958596859785988599860086018602860386048605860686078608860986108611861286138614861586168617861886198620862186228623862486258626862786288629863086318632863386348635863686378638863986408641864286438644864586468647864886498650865186528653865486558656865786588659866086618662866386648665866686678668866986708671867286738674867586768677867886798680868186828683868486858686868786888689869086918692869386948695869686978698869987008701870287038704870587068707870887098710871187128713871487158716871787188719872087218722872387248725872687278728872987308731873287338734873587368737873887398740874187428743874487458746874787488749875087518752875387548755875687578758875987608761876287638764876587668767876887698770877187728773877487758776877787788779878087818782878387848785878687878788878987908791879287938794879587968797879887998800880188028803880488058806880788088809881088118812881388148815881688178818881988208821882288238824882588268827882888298830883188328833883488358836883788388839884088418842884388448845884688478848884988508851885288538854885588568857885888598860886188628863886488658866886788688869887088718872887388748875887688778878887988808881888288838884888588868887888888898890889188928893889488958896889788988899890089018902890389048905890689078908890989108911891289138914891589168917891889198920892189228923892489258926892789288929893089318932893389348935893689378938893989408941894289438944894589468947894889498950895189528953895489558956895789588959896089618962896389648965896689678968896989708971897289738974897589768977897889798980898189828983898489858986898789888989899089918992899389948995899689978998899990009001900290039004900590069007900890099010901190129013901490159016901790189019902090219022902390249025902690279028902990309031903290339034903590369037903890399040904190429043904490459046904790489049905090519052905390549055905690579058905990609061906290639064906590669067906890699070907190729073907490759076907790789079908090819082908390849085908690879088908990909091909290939094909590969097909890999100910191029103910491059106910791089109911091119112911391149115911691179118911991209121912291239124912591269127912891299130913191329133913491359136913791389139914091419142914391449145914691479148914991509151915291539154915591569157915891599160916191629163916491659166916791689169917091719172917391749175917691779178917991809181918291839184918591869187918891899190919191929193919491959196919791989199920092019202920392049205920692079208920992109211921292139214921592169217921892199220922192229223922492259226922792289229923092319232923392349235923692379238923992409241924292439244924592469247924892499250925192529253925492559256925792589259926092619262926392649265926692679268926992709271927292739274927592769277927892799280928192829283928492859286928792889289929092919292929392949295929692979298929993009301930293039304930593069307930893099310931193129313931493159316931793189319932093219322932393249325932693279328932993309331933293339334933593369337933893399340934193429343934493459346934793489349935093519352935393549355935693579358935993609361936293639364936593669367936893699370937193729373937493759376937793789379938093819382938393849385938693879388938993909391939293939394939593969397939893999400940194029403940494059406940794089409941094119412941394149415941694179418941994209421942294239424942594269427942894299430943194329433943494359436943794389439944094419442944394449445944694479448944994509451945294539454945594569457945894599460946194629463946494659466946794689469947094719472947394749475947694779478947994809481948294839484948594869487948894899490949194929493949494959496949794989499950095019502950395049505950695079508950995109511951295139514951595169517951895199520952195229523952495259526952795289529953095319532953395349535953695379538953995409541954295439544954595469547954895499550955195529553955495559556955795589559956095619562956395649565956695679568956995709571957295739574957595769577957895799580958195829583958495859586958795889589959095919592959395949595959695979598959996009601960296039604960596069607960896099610961196129613961496159616961796189619962096219622962396249625962696279628962996309631963296339634963596369637963896399640964196429643964496459646964796489649965096519652965396549655965696579658965996609661966296639664966596669667966896699670967196729673967496759676967796789679968096819682968396849685968696879688968996909691969296939694969596969697969896999700970197029703970497059706970797089709971097119712971397149715971697179718971997209721972297239724972597269727972897299730973197329733973497359736973797389739974097419742974397449745974697479748974997509751975297539754975597569757975897599760976197629763976497659766976797689769977097719772977397749775977697779778977997809781978297839784978597869787978897899790979197929793979497959796979797989799980098019802980398049805980698079808980998109811981298139814981598169817981898199820982198229823982498259826982798289829983098319832983398349835983698379838983998409841984298439844984598469847984898499850985198529853985498559856985798589859986098619862986398649865986698679868986998709871987298739874987598769877987898799880988198829883988498859886988798889889989098919892989398949895989698979898989999009901990299039904990599069907990899099910991199129913991499159916991799189919992099219922992399249925992699279928992999309931993299339934993599369937993899399940994199429943994499459946994799489949995099519952995399549955995699579958995999609961996299639964996599669967996899699970997199729973997499759976997799789979998099819982998399849985998699879988998999909991999299939994999599969997999899991000010001100021000310004100051000610007100081000910010100111001210013100141001510016100171001810019100201002110022100231002410025100261002710028100291003010031100321003310034100351003610037100381003910040100411004210043100441004510046100471004810049100501005110052100531005410055100561005710058100591006010061100621006310064100651006610067100681006910070100711007210073100741007510076100771007810079100801008110082100831008410085100861008710088100891009010091100921009310094100951009610097100981009910100101011010210103101041010510106101071010810109101101011110112101131011410115101161011710118101191012010121101221012310124101251012610127101281012910130101311013210133101341013510136101371013810139101401014110142101431014410145101461014710148101491015010151101521015310154101551015610157101581015910160101611016210163101641016510166101671016810169101701017110172101731017410175101761017710178101791018010181101821018310184101851018610187101881018910190101911019210193101941019510196101971019810199102001020110202102031020410205102061020710208102091021010211102121021310214102151021610217102181021910220102211022210223102241022510226102271022810229102301023110232102331023410235102361023710238102391024010241102421024310244102451024610247102481024910250102511025210253102541025510256102571025810259102601026110262102631026410265102661026710268102691027010271102721027310274102751027610277102781027910280102811028210283102841028510286102871028810289102901029110292102931029410295102961029710298102991030010301103021030310304103051030610307103081030910310103111031210313103141031510316103171031810319103201032110322103231032410325103261032710328103291033010331103321033310334103351033610337103381033910340103411034210343103441034510346103471034810349103501035110352103531035410355103561035710358103591036010361103621036310364103651036610367103681036910370103711037210373103741037510376103771037810379103801038110382103831038410385103861038710388103891039010391103921039310394103951039610397103981039910400104011040210403104041040510406104071040810409104101041110412104131041410415104161041710418104191042010421104221042310424104251042610427104281042910430104311043210433104341043510436104371043810439104401044110442104431044410445104461044710448104491045010451104521045310454104551045610457104581045910460104611046210463104641046510466104671046810469104701047110472104731047410475104761047710478104791048010481104821048310484104851048610487104881048910490104911049210493104941049510496104971049810499105001050110502105031050410505105061050710508105091051010511105121051310514105151051610517105181051910520105211052210523105241052510526105271052810529105301053110532105331053410535105361053710538105391054010541105421054310544105451054610547105481054910550105511055210553105541055510556105571055810559105601056110562105631056410565105661056710568105691057010571105721057310574105751057610577105781057910580105811058210583105841058510586105871058810589105901059110592105931059410595105961059710598105991060010601106021060310604106051060610607106081060910610106111061210613106141061510616106171061810619106201062110622106231062410625106261062710628106291063010631106321063310634106351063610637106381063910640106411064210643106441064510646106471064810649106501065110652106531065410655106561065710658106591066010661106621066310664106651066610667106681066910670106711067210673106741067510676106771067810679106801068110682106831068410685106861068710688106891069010691106921069310694106951069610697106981069910700107011070210703107041070510706107071070810709107101071110712107131071410715107161071710718107191072010721107221072310724107251072610727107281072910730107311073210733107341073510736107371073810739107401074110742107431074410745107461074710748107491075010751107521075310754107551075610757107581075910760107611076210763107641076510766107671076810769107701077110772107731077410775107761077710778107791078010781107821078310784107851078610787107881078910790107911079210793107941079510796107971079810799108001080110802108031080410805108061080710808108091081010811108121081310814108151081610817108181081910820108211082210823108241082510826108271082810829108301083110832108331083410835108361083710838108391084010841108421084310844108451084610847108481084910850108511085210853108541085510856108571085810859108601086110862108631086410865108661086710868108691087010871108721087310874108751087610877108781087910880108811088210883108841088510886108871088810889108901089110892108931089410895108961089710898108991090010901109021090310904109051090610907109081090910910109111091210913109141091510916109171091810919109201092110922109231092410925109261092710928109291093010931109321093310934109351093610937109381093910940109411094210943109441094510946109471094810949109501095110952109531095410955109561095710958109591096010961109621096310964109651096610967109681096910970109711097210973109741097510976109771097810979109801098110982109831098410985109861098710988109891099010991109921099310994109951099610997109981099911000110011100211003110041100511006110071100811009110101101111012110131101411015110161101711018110191102011021110221102311024110251102611027110281102911030110311103211033110341103511036110371103811039110401104111042110431104411045110461104711048110491105011051110521105311054110551105611057110581105911060110611106211063110641106511066110671106811069110701107111072110731107411075110761107711078110791108011081110821108311084110851108611087110881108911090110911109211093110941109511096110971109811099111001110111102111031110411105111061110711108111091111011111111121111311114111151111611117111181111911120111211112211123111241112511126111271112811129111301113111132111331113411135111361113711138111391114011141111421114311144111451114611147111481114911150111511115211153111541115511156111571115811159111601116111162111631116411165111661116711168111691117011171111721117311174111751117611177111781117911180111811118211183111841118511186111871118811189111901119111192111931119411195111961119711198111991120011201112021120311204112051120611207112081120911210112111121211213112141121511216112171121811219112201122111222112231122411225112261122711228112291123011231112321123311234112351123611237112381123911240112411124211243112441124511246112471124811249112501125111252112531125411255112561125711258112591126011261112621126311264112651126611267112681126911270112711127211273112741127511276112771127811279112801128111282112831128411285112861128711288112891129011291112921129311294112951129611297112981129911300113011130211303113041130511306113071130811309113101131111312113131131411315113161131711318113191132011321113221132311324113251132611327113281132911330113311133211333113341133511336113371133811339113401134111342113431134411345113461134711348113491135011351113521135311354113551135611357113581135911360113611136211363113641136511366113671136811369113701137111372113731137411375113761137711378113791138011381113821138311384113851138611387113881138911390113911139211393113941139511396113971139811399114001140111402114031140411405114061140711408114091141011411114121141311414114151141611417114181141911420114211142211423114241142511426114271142811429114301143111432114331143411435114361143711438114391144011441114421144311444114451144611447114481144911450114511145211453114541145511456114571145811459114601146111462114631146411465114661146711468114691147011471114721147311474114751147611477114781147911480114811148211483114841148511486114871148811489114901149111492114931149411495114961149711498114991150011501115021150311504115051150611507115081150911510115111151211513115141151511516115171151811519115201152111522115231152411525115261152711528115291153011531115321153311534115351153611537115381153911540115411154211543115441154511546115471154811549115501155111552115531155411555115561155711558115591156011561115621156311564115651156611567115681156911570115711157211573115741157511576115771157811579115801158111582115831158411585115861158711588115891159011591115921159311594115951159611597115981159911600116011160211603116041160511606116071160811609116101161111612116131161411615116161161711618116191162011621116221162311624116251162611627116281162911630116311163211633116341163511636116371163811639116401164111642116431164411645116461164711648116491165011651116521165311654116551165611657116581165911660116611166211663116641166511666116671166811669116701167111672116731167411675116761167711678116791168011681116821168311684116851168611687116881168911690116911169211693116941169511696116971169811699117001170111702117031170411705117061170711708117091171011711117121171311714117151171611717117181171911720117211172211723117241172511726117271172811729117301173111732117331173411735117361173711738117391174011741117421174311744117451174611747117481174911750117511175211753117541175511756117571175811759117601176111762117631176411765117661176711768117691177011771117721177311774117751177611777117781177911780117811178211783117841178511786117871178811789117901179111792117931179411795117961179711798117991180011801118021180311804118051180611807118081180911810118111181211813118141181511816118171181811819118201182111822118231182411825118261182711828118291183011831118321183311834118351183611837118381183911840118411184211843118441184511846118471184811849118501185111852118531185411855118561185711858118591186011861118621186311864118651186611867118681186911870118711187211873118741187511876118771187811879118801188111882118831188411885118861188711888118891189011891118921189311894118951189611897118981189911900119011190211903119041190511906119071190811909119101191111912119131191411915119161191711918119191192011921119221192311924119251192611927119281192911930119311193211933119341193511936119371193811939119401194111942119431194411945119461194711948119491195011951119521195311954119551195611957119581195911960119611196211963119641196511966119671196811969119701197111972119731197411975119761197711978119791198011981119821198311984119851198611987119881198911990119911199211993119941199511996119971199811999120001200112002120031200412005120061200712008120091201012011120121201312014120151201612017120181201912020120211202212023120241202512026120271202812029120301203112032120331203412035120361203712038120391204012041120421204312044120451204612047120481204912050120511205212053120541205512056120571205812059120601206112062120631206412065120661206712068120691207012071120721207312074120751207612077120781207912080120811208212083120841208512086120871208812089120901209112092120931209412095120961209712098120991210012101121021210312104121051210612107121081210912110121111211212113121141211512116121171211812119121201212112122121231212412125121261212712128121291213012131121321213312134121351213612137121381213912140121411214212143121441214512146121471214812149121501215112152121531215412155121561215712158121591216012161121621216312164121651216612167121681216912170121711217212173121741217512176121771217812179121801218112182121831218412185121861218712188121891219012191121921219312194121951219612197121981219912200122011220212203122041220512206122071220812209122101221112212122131221412215122161221712218122191222012221122221222312224122251222612227122281222912230122311223212233122341223512236122371223812239122401224112242122431224412245122461224712248122491225012251122521225312254122551225612257122581225912260122611226212263122641226512266122671226812269122701227112272122731227412275122761227712278122791228012281122821228312284122851228612287122881228912290122911229212293122941229512296122971229812299123001230112302123031230412305123061230712308123091231012311123121231312314123151231612317123181231912320123211232212323123241232512326123271232812329123301233112332123331233412335123361233712338123391234012341123421234312344123451234612347123481234912350123511235212353123541235512356123571235812359123601236112362123631236412365123661236712368123691237012371123721237312374123751237612377123781237912380123811238212383123841238512386123871238812389123901239112392123931239412395123961239712398123991240012401124021240312404124051240612407124081240912410124111241212413124141241512416124171241812419124201242112422124231242412425124261242712428124291243012431124321243312434124351243612437124381243912440124411244212443124441244512446124471244812449124501245112452124531245412455124561245712458124591246012461124621246312464124651246612467124681246912470124711247212473124741247512476124771247812479124801248112482124831248412485124861248712488124891249012491124921249312494124951249612497124981249912500125011250212503125041250512506125071250812509125101251112512125131251412515125161251712518125191252012521125221252312524125251252612527125281252912530125311253212533125341253512536125371253812539125401254112542125431254412545125461254712548125491255012551125521255312554125551255612557125581255912560125611256212563125641256512566125671256812569125701257112572125731257412575125761257712578125791258012581125821258312584125851258612587125881258912590125911259212593125941259512596125971259812599126001260112602126031260412605126061260712608126091261012611126121261312614126151261612617126181261912620126211262212623126241262512626126271262812629126301263112632126331263412635126361263712638126391264012641126421264312644126451264612647126481264912650126511265212653126541265512656126571265812659126601266112662126631266412665126661266712668126691267012671126721267312674126751267612677126781267912680126811268212683126841268512686126871268812689126901269112692126931269412695126961269712698126991270012701127021270312704127051270612707127081270912710127111271212713127141271512716127171271812719127201272112722127231272412725127261272712728127291273012731127321273312734127351273612737127381273912740127411274212743127441274512746127471274812749127501275112752127531275412755127561275712758127591276012761127621276312764127651276612767127681276912770127711277212773127741277512776127771277812779127801278112782127831278412785127861278712788127891279012791127921279312794127951279612797127981279912800128011280212803128041280512806128071280812809128101281112812128131281412815128161281712818128191282012821128221282312824128251282612827128281282912830128311283212833128341283512836128371283812839128401284112842128431284412845128461284712848128491285012851128521285312854128551285612857128581285912860128611286212863128641286512866128671286812869128701287112872128731287412875128761287712878128791288012881128821288312884128851288612887128881288912890128911289212893128941289512896128971289812899129001290112902129031290412905129061290712908129091291012911129121291312914129151291612917129181291912920129211292212923129241292512926129271292812929129301293112932129331293412935129361293712938129391294012941129421294312944129451294612947129481294912950129511295212953129541295512956129571295812959129601296112962129631296412965129661296712968129691297012971129721297312974129751297612977129781297912980129811298212983129841298512986129871298812989129901299112992129931299412995129961299712998129991300013001130021300313004130051300613007130081300913010130111301213013130141301513016130171301813019130201302113022130231302413025130261302713028130291303013031130321303313034130351303613037130381303913040130411304213043130441304513046130471304813049130501305113052130531305413055130561305713058130591306013061130621306313064130651306613067130681306913070130711307213073130741307513076130771307813079130801308113082130831308413085130861308713088130891309013091130921309313094130951309613097130981309913100131011310213103131041310513106131071310813109131101311113112131131311413115131161311713118131191312013121131221312313124131251312613127131281312913130131311313213133131341313513136131371313813139131401314113142131431314413145131461314713148131491315013151131521315313154131551315613157131581315913160131611316213163131641316513166131671316813169131701317113172131731317413175131761317713178131791318013181131821318313184131851318613187131881318913190131911319213193131941319513196131971319813199132001320113202132031320413205132061320713208132091321013211132121321313214132151321613217132181321913220132211322213223132241322513226132271322813229132301323113232132331323413235132361323713238132391324013241132421324313244132451324613247132481324913250132511325213253132541325513256132571325813259132601326113262132631326413265132661326713268132691327013271132721327313274132751327613277132781327913280132811328213283132841328513286132871328813289132901329113292132931329413295132961329713298132991330013301133021330313304133051330613307133081330913310133111331213313133141331513316133171331813319133201332113322133231332413325133261332713328133291333013331133321333313334133351333613337133381333913340133411334213343133441334513346133471334813349133501335113352133531335413355133561335713358133591336013361133621336313364133651336613367133681336913370133711337213373133741337513376133771337813379133801338113382133831338413385133861338713388133891339013391133921339313394133951339613397133981339913400134011340213403134041340513406134071340813409134101341113412134131341413415134161341713418134191342013421134221342313424134251342613427134281342913430134311343213433134341343513436134371343813439134401344113442134431344413445134461344713448134491345013451134521345313454134551345613457134581345913460134611346213463134641346513466134671346813469134701347113472134731347413475134761347713478134791348013481134821348313484134851348613487134881348913490134911349213493134941349513496134971349813499135001350113502135031350413505135061350713508135091351013511135121351313514135151351613517135181351913520135211352213523135241352513526135271352813529135301353113532135331353413535135361353713538135391354013541135421354313544135451354613547135481354913550135511355213553135541355513556135571355813559135601356113562135631356413565135661356713568135691357013571135721357313574135751357613577135781357913580135811358213583135841358513586135871358813589135901359113592135931359413595135961359713598135991360013601136021360313604136051360613607136081360913610136111361213613136141361513616136171361813619136201362113622136231362413625136261362713628136291363013631136321363313634136351363613637136381363913640136411364213643136441364513646136471364813649136501365113652136531365413655136561365713658136591366013661136621366313664136651366613667136681366913670136711367213673136741367513676136771367813679136801368113682136831368413685136861368713688136891369013691136921369313694136951369613697136981369913700137011370213703137041370513706137071370813709137101371113712137131371413715137161371713718137191372013721137221372313724137251372613727137281372913730137311373213733137341373513736137371373813739137401374113742137431374413745137461374713748137491375013751137521375313754137551375613757137581375913760137611376213763137641376513766137671376813769137701377113772137731377413775137761377713778137791378013781137821378313784137851378613787137881378913790137911379213793137941379513796137971379813799138001380113802138031380413805138061380713808138091381013811138121381313814138151381613817138181381913820138211382213823138241382513826138271382813829138301383113832138331383413835138361383713838138391384013841138421384313844138451384613847138481384913850138511385213853138541385513856138571385813859138601386113862138631386413865138661386713868138691387013871138721387313874138751387613877138781387913880138811388213883138841388513886138871388813889138901389113892138931389413895138961389713898138991390013901139021390313904139051390613907139081390913910139111391213913139141391513916139171391813919139201392113922139231392413925139261392713928139291393013931139321393313934139351393613937139381393913940139411394213943139441394513946139471394813949139501395113952139531395413955139561395713958139591396013961139621396313964139651396613967139681396913970139711397213973139741397513976139771397813979139801398113982139831398413985139861398713988139891399013991139921399313994139951399613997139981399914000140011400214003140041400514006140071400814009140101401114012140131401414015140161401714018140191402014021140221402314024140251402614027140281402914030140311403214033140341403514036140371403814039140401404114042140431404414045140461404714048140491405014051140521405314054140551405614057140581405914060140611406214063140641406514066140671406814069140701407114072140731407414075140761407714078140791408014081140821408314084140851408614087140881408914090140911409214093140941409514096140971409814099141001410114102141031410414105141061410714108141091411014111141121411314114141151411614117141181411914120141211412214123141241412514126141271412814129141301413114132141331413414135141361413714138141391414014141141421414314144141451414614147141481414914150141511415214153141541415514156141571415814159141601416114162141631416414165141661416714168141691417014171141721417314174141751417614177141781417914180141811418214183141841418514186141871418814189141901419114192141931419414195141961419714198141991420014201142021420314204142051420614207142081420914210142111421214213142141421514216142171421814219142201422114222142231422414225142261422714228142291423014231142321423314234142351423614237142381423914240142411424214243142441424514246142471424814249142501425114252142531425414255142561425714258142591426014261142621426314264142651426614267142681426914270142711427214273142741427514276142771427814279142801428114282142831428414285142861428714288142891429014291142921429314294142951429614297142981429914300143011430214303143041430514306143071430814309143101431114312143131431414315143161431714318143191432014321143221432314324143251432614327143281432914330143311433214333143341433514336143371433814339143401434114342143431434414345143461434714348143491435014351143521435314354143551435614357143581435914360143611436214363143641436514366143671436814369143701437114372143731437414375143761437714378143791438014381143821438314384143851438614387143881438914390143911439214393143941439514396143971439814399144001440114402144031440414405144061440714408144091441014411144121441314414144151441614417144181441914420144211442214423144241442514426144271442814429144301443114432144331443414435144361443714438144391444014441144421444314444144451444614447144481444914450144511445214453144541445514456144571445814459144601446114462144631446414465144661446714468144691447014471144721447314474144751447614477144781447914480144811448214483144841448514486144871448814489144901449114492144931449414495144961449714498144991450014501145021450314504145051450614507145081450914510145111451214513145141451514516145171451814519145201452114522145231452414525145261452714528145291453014531145321453314534145351453614537145381453914540145411454214543145441454514546145471454814549145501455114552145531455414555145561455714558145591456014561145621456314564145651456614567145681456914570145711457214573145741457514576145771457814579145801458114582145831458414585145861458714588145891459014591145921459314594145951459614597145981459914600146011460214603146041460514606146071460814609146101461114612146131461414615146161461714618146191462014621146221462314624146251462614627146281462914630146311463214633146341463514636146371463814639146401464114642146431464414645146461464714648146491465014651146521465314654146551465614657146581465914660146611466214663146641466514666146671466814669146701467114672146731467414675146761467714678146791468014681146821468314684146851468614687146881468914690146911469214693146941469514696146971469814699147001470114702147031470414705147061470714708147091471014711147121471314714147151471614717147181471914720147211472214723147241472514726147271472814729147301473114732147331473414735147361473714738147391474014741147421474314744147451474614747147481474914750147511475214753147541475514756147571475814759147601476114762147631476414765147661476714768147691477014771147721477314774147751477614777147781477914780147811478214783147841478514786147871478814789147901479114792147931479414795147961479714798147991480014801148021480314804148051480614807148081480914810148111481214813148141481514816148171481814819148201482114822148231482414825148261482714828148291483014831148321483314834148351483614837148381483914840148411484214843148441484514846148471484814849148501485114852148531485414855148561485714858148591486014861148621486314864148651486614867148681486914870148711487214873148741487514876148771487814879148801488114882148831488414885148861488714888148891489014891148921489314894148951489614897148981489914900149011490214903149041490514906149071490814909149101491114912149131491414915149161491714918149191492014921149221492314924149251492614927149281492914930149311493214933149341493514936149371493814939149401494114942149431494414945149461494714948149491495014951149521495314954149551495614957149581495914960149611496214963149641496514966149671496814969149701497114972149731497414975149761497714978149791498014981149821498314984149851498614987149881498914990149911499214993149941499514996149971499814999150001500115002150031500415005150061500715008150091501015011150121501315014150151501615017150181501915020150211502215023150241502515026150271502815029150301503115032150331503415035150361503715038150391504015041150421504315044150451504615047150481504915050150511505215053150541505515056150571505815059150601506115062150631506415065150661506715068150691507015071150721507315074150751507615077150781507915080150811508215083150841508515086150871508815089150901509115092150931509415095150961509715098150991510015101151021510315104151051510615107151081510915110151111511215113151141511515116151171511815119151201512115122151231512415125151261512715128151291513015131151321513315134151351513615137151381513915140151411514215143151441514515146151471514815149151501515115152151531515415155151561515715158151591516015161151621516315164151651516615167151681516915170151711517215173151741517515176151771517815179151801518115182151831518415185151861518715188151891519015191151921519315194151951519615197151981519915200152011520215203152041520515206152071520815209152101521115212152131521415215152161521715218152191522015221152221522315224152251522615227152281522915230152311523215233152341523515236152371523815239152401524115242152431524415245152461524715248152491525015251152521525315254152551525615257152581525915260152611526215263152641526515266152671526815269152701527115272152731527415275152761527715278152791528015281152821528315284152851528615287152881528915290152911529215293152941529515296152971529815299153001530115302153031530415305153061530715308153091531015311153121531315314153151531615317153181531915320153211532215323153241532515326153271532815329153301533115332153331533415335153361533715338153391534015341153421534315344153451534615347153481534915350153511535215353153541535515356153571535815359153601536115362153631536415365153661536715368153691537015371153721537315374153751537615377153781537915380153811538215383153841538515386153871538815389153901539115392153931539415395153961539715398153991540015401154021540315404154051540615407154081540915410154111541215413154141541515416154171541815419154201542115422154231542415425154261542715428154291543015431154321543315434154351543615437154381543915440154411544215443154441544515446154471544815449154501545115452154531545415455154561545715458154591546015461154621546315464154651546615467154681546915470154711547215473154741547515476154771547815479154801548115482154831548415485154861548715488154891549015491154921549315494154951549615497154981549915500155011550215503155041550515506155071550815509155101551115512155131551415515155161551715518155191552015521155221552315524155251552615527155281552915530155311553215533155341553515536155371553815539155401554115542155431554415545155461554715548155491555015551155521555315554155551555615557155581555915560155611556215563155641556515566155671556815569155701557115572155731557415575155761557715578155791558015581155821558315584155851558615587155881558915590155911559215593155941559515596155971559815599156001560115602156031560415605156061560715608156091561015611156121561315614156151561615617156181561915620156211562215623156241562515626156271562815629156301563115632156331563415635156361563715638156391564015641156421564315644156451564615647156481564915650156511565215653156541565515656156571565815659156601566115662156631566415665156661566715668156691567015671156721567315674156751567615677156781567915680156811568215683156841568515686156871568815689156901569115692156931569415695156961569715698156991570015701157021570315704157051570615707157081570915710157111571215713157141571515716157171571815719157201572115722157231572415725157261572715728157291573015731157321573315734157351573615737157381573915740157411574215743157441574515746157471574815749157501575115752157531575415755157561575715758157591576015761157621576315764157651576615767157681576915770157711577215773157741577515776157771577815779157801578115782157831578415785157861578715788157891579015791157921579315794157951579615797157981579915800158011580215803158041580515806158071580815809158101581115812158131581415815158161581715818158191582015821158221582315824158251582615827158281582915830158311583215833158341583515836158371583815839158401584115842158431584415845158461584715848158491585015851158521585315854158551585615857158581585915860158611586215863158641586515866158671586815869158701587115872158731587415875158761587715878158791588015881158821588315884158851588615887158881588915890158911589215893158941589515896158971589815899159001590115902159031590415905159061590715908159091591015911159121591315914159151591615917159181591915920159211592215923159241592515926159271592815929159301593115932159331593415935159361593715938159391594015941159421594315944159451594615947159481594915950159511595215953159541595515956159571595815959159601596115962159631596415965159661596715968159691597015971159721597315974159751597615977159781597915980159811598215983159841598515986159871598815989159901599115992159931599415995159961599715998159991600016001160021600316004160051600616007160081600916010160111601216013160141601516016160171601816019160201602116022160231602416025160261602716028160291603016031160321603316034160351603616037160381603916040160411604216043160441604516046160471604816049160501605116052160531605416055160561605716058160591606016061160621606316064160651606616067160681606916070160711607216073160741607516076160771607816079160801608116082160831608416085160861608716088160891609016091160921609316094160951609616097160981609916100161011610216103161041610516106161071610816109161101611116112161131611416115161161611716118161191612016121161221612316124161251612616127161281612916130161311613216133161341613516136161371613816139161401614116142161431614416145161461614716148161491615016151161521615316154161551615616157161581615916160161611616216163161641616516166161671616816169161701617116172161731617416175161761617716178161791618016181161821618316184161851618616187161881618916190161911619216193161941619516196161971619816199162001620116202162031620416205162061620716208162091621016211162121621316214162151621616217162181621916220162211622216223162241622516226162271622816229162301623116232162331623416235162361623716238162391624016241162421624316244162451624616247162481624916250162511625216253162541625516256162571625816259162601626116262162631626416265162661626716268162691627016271162721627316274162751627616277162781627916280162811628216283162841628516286162871628816289162901629116292162931629416295162961629716298162991630016301163021630316304163051630616307163081630916310163111631216313163141631516316163171631816319163201632116322163231632416325163261632716328163291633016331163321633316334163351633616337163381633916340163411634216343163441634516346163471634816349163501635116352163531635416355163561635716358163591636016361163621636316364163651636616367163681636916370163711637216373163741637516376163771637816379163801638116382163831638416385163861638716388163891639016391163921639316394163951639616397163981639916400164011640216403164041640516406164071640816409164101641116412164131641416415164161641716418164191642016421164221642316424164251642616427164281642916430164311643216433164341643516436164371643816439164401644116442164431644416445164461644716448164491645016451164521645316454164551645616457164581645916460164611646216463164641646516466164671646816469164701647116472164731647416475164761647716478164791648016481164821648316484164851648616487164881648916490164911649216493164941649516496164971649816499165001650116502165031650416505165061650716508165091651016511165121651316514165151651616517165181651916520165211652216523165241652516526165271652816529165301653116532165331653416535165361653716538165391654016541165421654316544165451654616547165481654916550165511655216553165541655516556165571655816559165601656116562165631656416565165661656716568165691657016571165721657316574165751657616577165781657916580165811658216583165841658516586165871658816589165901659116592165931659416595165961659716598165991660016601166021660316604166051660616607166081660916610166111661216613166141661516616166171661816619166201662116622166231662416625166261662716628166291663016631166321663316634166351663616637166381663916640166411664216643166441664516646166471664816649166501665116652166531665416655166561665716658166591666016661166621666316664166651666616667166681666916670166711667216673166741667516676166771667816679166801668116682166831668416685166861668716688166891669016691166921669316694166951669616697166981669916700167011670216703167041670516706167071670816709167101671116712167131671416715167161671716718167191672016721167221672316724167251672616727167281672916730167311673216733167341673516736167371673816739167401674116742167431674416745167461674716748167491675016751167521675316754167551675616757167581675916760167611676216763167641676516766167671676816769167701677116772167731677416775167761677716778167791678016781167821678316784167851678616787167881678916790167911679216793167941679516796167971679816799168001680116802168031680416805168061680716808168091681016811168121681316814168151681616817168181681916820168211682216823168241682516826168271682816829168301683116832168331683416835168361683716838168391684016841168421684316844168451684616847168481684916850168511685216853168541685516856168571685816859168601686116862168631686416865168661686716868168691687016871168721687316874168751687616877168781687916880168811688216883168841688516886168871688816889168901689116892168931689416895168961689716898168991690016901169021690316904169051690616907169081690916910169111691216913169141691516916169171691816919169201692116922169231692416925169261692716928169291693016931169321693316934169351693616937169381693916940169411694216943169441694516946169471694816949169501695116952169531695416955169561695716958169591696016961169621696316964169651696616967169681696916970169711697216973169741697516976169771697816979169801698116982169831698416985169861698716988169891699016991169921699316994169951699616997169981699917000170011700217003170041700517006170071700817009170101701117012170131701417015170161701717018170191702017021170221702317024170251702617027170281702917030170311703217033170341703517036170371703817039170401704117042170431704417045170461704717048170491705017051170521705317054170551705617057170581705917060170611706217063170641706517066170671706817069170701707117072170731707417075170761707717078170791708017081170821708317084170851708617087170881708917090170911709217093170941709517096170971709817099171001710117102171031710417105171061710717108171091711017111171121711317114171151711617117171181711917120171211712217123171241712517126171271712817129171301713117132171331713417135171361713717138171391714017141171421714317144171451714617147171481714917150171511715217153171541715517156171571715817159171601716117162171631716417165171661716717168171691717017171171721717317174171751717617177171781717917180171811718217183171841718517186171871718817189171901719117192171931719417195171961719717198171991720017201172021720317204172051720617207172081720917210172111721217213172141721517216172171721817219172201722117222172231722417225172261722717228172291723017231172321723317234172351723617237172381723917240172411724217243172441724517246172471724817249172501725117252172531725417255172561725717258172591726017261172621726317264172651726617267172681726917270172711727217273172741727517276172771727817279172801728117282172831728417285172861728717288172891729017291172921729317294172951729617297172981729917300173011730217303173041730517306173071730817309173101731117312173131731417315173161731717318173191732017321173221732317324173251732617327173281732917330173311733217333173341733517336173371733817339173401734117342173431734417345173461734717348173491735017351173521735317354173551735617357173581735917360173611736217363173641736517366173671736817369173701737117372173731737417375173761737717378173791738017381173821738317384173851738617387173881738917390173911739217393173941739517396173971739817399174001740117402174031740417405174061740717408174091741017411174121741317414174151741617417174181741917420174211742217423174241742517426174271742817429174301743117432174331743417435174361743717438174391744017441174421744317444174451744617447174481744917450174511745217453174541745517456174571745817459174601746117462174631746417465174661746717468174691747017471174721747317474174751747617477174781747917480174811748217483174841748517486174871748817489174901749117492174931749417495174961749717498174991750017501175021750317504175051750617507175081750917510175111751217513175141751517516175171751817519175201752117522175231752417525175261752717528175291753017531175321753317534175351753617537175381753917540175411754217543175441754517546175471754817549175501755117552175531755417555175561755717558175591756017561175621756317564175651756617567175681756917570175711757217573175741757517576175771757817579175801758117582175831758417585175861758717588175891759017591175921759317594175951759617597175981759917600176011760217603176041760517606176071760817609176101761117612176131761417615176161761717618176191762017621176221762317624176251762617627176281762917630176311763217633176341763517636176371763817639176401764117642176431764417645176461764717648176491765017651176521765317654176551765617657176581765917660176611766217663176641766517666176671766817669176701767117672176731767417675176761767717678176791768017681176821768317684176851768617687176881768917690176911769217693176941769517696176971769817699177001770117702177031770417705177061770717708177091771017711177121771317714177151771617717177181771917720177211772217723177241772517726177271772817729177301773117732177331773417735177361773717738177391774017741177421774317744177451774617747177481774917750177511775217753177541775517756177571775817759177601776117762177631776417765177661776717768177691777017771177721777317774177751777617777177781777917780177811778217783177841778517786177871778817789177901779117792177931779417795177961779717798177991780017801178021780317804178051780617807178081780917810178111781217813178141781517816178171781817819178201782117822178231782417825178261782717828178291783017831178321783317834178351783617837178381783917840178411784217843178441784517846178471784817849178501785117852178531785417855178561785717858178591786017861178621786317864178651786617867178681786917870178711787217873178741787517876178771787817879178801788117882178831788417885178861788717888178891789017891178921789317894178951789617897178981789917900179011790217903179041790517906179071790817909179101791117912179131791417915179161791717918179191792017921179221792317924179251792617927179281792917930179311793217933179341793517936179371793817939179401794117942179431794417945179461794717948179491795017951179521795317954179551795617957179581795917960179611796217963179641796517966179671796817969179701797117972179731797417975179761797717978179791798017981179821798317984179851798617987179881798917990179911799217993179941799517996179971799817999180001800118002180031800418005180061800718008180091801018011180121801318014180151801618017180181801918020180211802218023180241802518026180271802818029180301803118032180331803418035180361803718038180391804018041180421804318044180451804618047180481804918050180511805218053180541805518056180571805818059180601806118062180631806418065180661806718068180691807018071180721807318074180751807618077180781807918080180811808218083180841808518086180871808818089180901809118092180931809418095180961809718098180991810018101181021810318104181051810618107181081810918110181111811218113181141811518116181171811818119181201812118122181231812418125181261812718128181291813018131181321813318134181351813618137181381813918140181411814218143181441814518146181471814818149181501815118152181531815418155181561815718158181591816018161181621816318164181651816618167181681816918170181711817218173181741817518176181771817818179181801818118182181831818418185181861818718188181891819018191181921819318194181951819618197181981819918200182011820218203182041820518206182071820818209182101821118212182131821418215182161821718218182191822018221182221822318224182251822618227182281822918230182311823218233182341823518236182371823818239182401824118242182431824418245182461824718248182491825018251182521825318254182551825618257182581825918260182611826218263182641826518266182671826818269182701827118272182731827418275182761827718278182791828018281182821828318284182851828618287182881828918290182911829218293182941829518296182971829818299183001830118302183031830418305183061830718308183091831018311183121831318314183151831618317183181831918320183211832218323183241832518326183271832818329183301833118332183331833418335183361833718338183391834018341183421834318344183451834618347183481834918350183511835218353183541835518356183571835818359183601836118362183631836418365183661836718368183691837018371183721837318374183751837618377183781837918380183811838218383183841838518386183871838818389183901839118392183931839418395183961839718398183991840018401184021840318404184051840618407184081840918410184111841218413184141841518416184171841818419184201842118422184231842418425184261842718428184291843018431184321843318434184351843618437184381843918440184411844218443184441844518446184471844818449184501845118452184531845418455184561845718458184591846018461184621846318464184651846618467184681846918470184711847218473184741847518476184771847818479184801848118482184831848418485184861848718488184891849018491184921849318494184951849618497184981849918500185011850218503185041850518506185071850818509185101851118512185131851418515185161851718518185191852018521185221852318524185251852618527185281852918530185311853218533185341853518536185371853818539185401854118542185431854418545185461854718548185491855018551185521855318554185551855618557185581855918560185611856218563185641856518566185671856818569185701857118572185731857418575185761857718578185791858018581185821858318584185851858618587185881858918590185911859218593185941859518596185971859818599186001860118602186031860418605186061860718608186091861018611186121861318614186151861618617186181861918620186211862218623186241862518626186271862818629186301863118632186331863418635186361863718638186391864018641186421864318644186451864618647186481864918650186511865218653186541865518656186571865818659186601866118662186631866418665186661866718668186691867018671186721867318674186751867618677186781867918680186811868218683186841868518686186871868818689186901869118692186931869418695186961869718698186991870018701187021870318704187051870618707187081870918710187111871218713187141871518716187171871818719187201872118722187231872418725187261872718728187291873018731187321873318734187351873618737187381873918740187411874218743187441874518746187471874818749187501875118752187531875418755187561875718758187591876018761187621876318764187651876618767187681876918770187711877218773187741877518776187771877818779187801878118782187831878418785187861878718788187891879018791187921879318794187951879618797187981879918800188011880218803188041880518806188071880818809188101881118812188131881418815188161881718818188191882018821188221882318824188251882618827188281882918830188311883218833188341883518836188371883818839188401884118842188431884418845188461884718848188491885018851188521885318854188551885618857188581885918860188611886218863188641886518866188671886818869188701887118872188731887418875188761887718878188791888018881188821888318884188851888618887188881888918890188911889218893188941889518896188971889818899189001890118902189031890418905189061890718908189091891018911189121891318914189151891618917189181891918920189211892218923189241892518926189271892818929189301893118932189331893418935189361893718938189391894018941189421894318944189451894618947189481894918950189511895218953189541895518956189571895818959189601896118962189631896418965189661896718968189691897018971189721897318974189751897618977189781897918980189811898218983189841898518986189871898818989189901899118992189931899418995189961899718998189991900019001190021900319004190051900619007190081900919010190111901219013190141901519016190171901819019190201902119022190231902419025190261902719028190291903019031190321903319034190351903619037190381903919040190411904219043190441904519046190471904819049190501905119052190531905419055190561905719058190591906019061190621906319064190651906619067190681906919070190711907219073190741907519076190771907819079190801908119082190831908419085190861908719088190891909019091190921909319094190951909619097190981909919100191011910219103191041910519106191071910819109191101911119112191131911419115191161911719118191191912019121191221912319124191251912619127191281912919130191311913219133191341913519136191371913819139191401914119142191431914419145191461914719148191491915019151191521915319154191551915619157191581915919160191611916219163191641916519166191671916819169191701917119172191731917419175191761917719178191791918019181191821918319184191851918619187191881918919190191911919219193191941919519196191971919819199192001920119202192031920419205192061920719208192091921019211192121921319214192151921619217192181921919220192211922219223192241922519226192271922819229192301923119232192331923419235192361923719238192391924019241192421924319244192451924619247192481924919250192511925219253192541925519256192571925819259192601926119262192631926419265192661926719268192691927019271192721927319274192751927619277192781927919280192811928219283192841928519286192871928819289192901929119292192931929419295192961929719298192991930019301193021930319304193051930619307193081930919310193111931219313193141931519316193171931819319193201932119322193231932419325193261932719328193291933019331193321933319334193351933619337193381933919340193411934219343193441934519346193471934819349193501935119352193531935419355193561935719358193591936019361193621936319364193651936619367193681936919370193711937219373193741937519376193771937819379193801938119382193831938419385193861938719388193891939019391193921939319394193951939619397193981939919400194011940219403194041940519406194071940819409194101941119412194131941419415194161941719418194191942019421194221942319424194251942619427194281942919430194311943219433194341943519436194371943819439194401944119442194431944419445194461944719448194491945019451194521945319454194551945619457194581945919460194611946219463194641946519466194671946819469194701947119472194731947419475194761947719478194791948019481194821948319484194851948619487194881948919490194911949219493194941949519496194971949819499195001950119502195031950419505195061950719508195091951019511195121951319514195151951619517195181951919520195211952219523195241952519526195271952819529195301953119532195331953419535195361953719538195391954019541195421954319544195451954619547195481954919550195511955219553195541955519556195571955819559195601956119562195631956419565195661956719568195691957019571195721957319574195751957619577195781957919580195811958219583195841958519586195871958819589195901959119592195931959419595195961959719598195991960019601196021960319604196051960619607196081960919610196111961219613196141961519616196171961819619196201962119622196231962419625196261962719628196291963019631196321963319634196351963619637196381963919640196411964219643196441964519646196471964819649196501965119652196531965419655196561965719658196591966019661196621966319664196651966619667196681966919670196711967219673196741967519676196771967819679196801968119682196831968419685196861968719688196891969019691196921969319694196951969619697196981969919700197011970219703197041970519706197071970819709197101971119712197131971419715197161971719718197191972019721197221972319724197251972619727197281972919730197311973219733197341973519736197371973819739197401974119742197431974419745197461974719748197491975019751197521975319754197551975619757197581975919760197611976219763197641976519766197671976819769197701977119772197731977419775197761977719778197791978019781197821978319784197851978619787197881978919790197911979219793197941979519796197971979819799198001980119802198031980419805198061980719808198091981019811198121981319814198151981619817198181981919820198211982219823198241982519826198271982819829198301983119832198331983419835198361983719838198391984019841198421984319844198451984619847198481984919850198511985219853198541985519856198571985819859198601986119862198631986419865198661986719868198691987019871198721987319874198751987619877198781987919880198811988219883198841988519886198871988819889198901989119892198931989419895198961989719898198991990019901199021990319904199051990619907199081990919910199111991219913199141991519916199171991819919199201992119922199231992419925199261992719928199291993019931199321993319934199351993619937199381993919940199411994219943199441994519946199471994819949199501995119952199531995419955199561995719958199591996019961199621996319964199651996619967199681996919970199711997219973199741997519976199771997819979199801998119982199831998419985199861998719988199891999019991199921999319994199951999619997199981999920000200012000220003200042000520006200072000820009200102001120012200132001420015200162001720018200192002020021200222002320024200252002620027200282002920030200312003220033200342003520036200372003820039200402004120042200432004420045200462004720048200492005020051200522005320054200552005620057200582005920060200612006220063200642006520066200672006820069200702007120072200732007420075200762007720078200792008020081200822008320084200852008620087200882008920090200912009220093200942009520096200972009820099201002010120102201032010420105201062010720108201092011020111201122011320114201152011620117201182011920120201212012220123201242012520126201272012820129201302013120132201332013420135201362013720138201392014020141201422014320144201452014620147201482014920150201512015220153201542015520156201572015820159201602016120162201632016420165201662016720168201692017020171201722017320174201752017620177201782017920180201812018220183201842018520186201872018820189201902019120192201932019420195201962019720198201992020020201202022020320204202052020620207202082020920210202112021220213202142021520216202172021820219202202022120222202232022420225202262022720228202292023020231202322023320234202352023620237202382023920240202412024220243202442024520246202472024820249202502025120252202532025420255202562025720258202592026020261202622026320264202652026620267202682026920270202712027220273202742027520276202772027820279202802028120282202832028420285202862028720288202892029020291202922029320294202952029620297202982029920300203012030220303203042030520306203072030820309203102031120312203132031420315203162031720318203192032020321203222032320324203252032620327203282032920330203312033220333203342033520336203372033820339203402034120342203432034420345203462034720348203492035020351203522035320354203552035620357203582035920360203612036220363203642036520366203672036820369203702037120372203732037420375203762037720378203792038020381203822038320384203852038620387203882038920390203912039220393203942039520396203972039820399204002040120402204032040420405204062040720408204092041020411204122041320414204152041620417204182041920420204212042220423204242042520426204272042820429204302043120432204332043420435204362043720438204392044020441204422044320444204452044620447204482044920450204512045220453204542045520456204572045820459204602046120462204632046420465204662046720468204692047020471204722047320474204752047620477204782047920480204812048220483204842048520486204872048820489204902049120492204932049420495204962049720498204992050020501205022050320504205052050620507205082050920510205112051220513205142051520516205172051820519205202052120522205232052420525205262052720528205292053020531205322053320534205352053620537205382053920540205412054220543205442054520546205472054820549205502055120552205532055420555205562055720558205592056020561205622056320564205652056620567205682056920570205712057220573205742057520576205772057820579205802058120582205832058420585205862058720588205892059020591205922059320594205952059620597205982059920600206012060220603206042060520606206072060820609206102061120612206132061420615206162061720618206192062020621206222062320624206252062620627206282062920630206312063220633206342063520636206372063820639206402064120642206432064420645206462064720648206492065020651206522065320654206552065620657206582065920660206612066220663206642066520666206672066820669206702067120672206732067420675206762067720678206792068020681206822068320684206852068620687206882068920690206912069220693206942069520696206972069820699207002070120702207032070420705207062070720708207092071020711207122071320714207152071620717207182071920720207212072220723207242072520726207272072820729207302073120732207332073420735207362073720738207392074020741207422074320744207452074620747207482074920750207512075220753207542075520756207572075820759207602076120762207632076420765207662076720768207692077020771207722077320774207752077620777207782077920780207812078220783207842078520786207872078820789207902079120792207932079420795207962079720798207992080020801208022080320804208052080620807208082080920810208112081220813208142081520816208172081820819208202082120822208232082420825208262082720828208292083020831208322083320834208352083620837208382083920840208412084220843208442084520846208472084820849208502085120852208532085420855208562085720858208592086020861208622086320864208652086620867208682086920870208712087220873208742087520876208772087820879208802088120882208832088420885208862088720888208892089020891208922089320894208952089620897208982089920900209012090220903209042090520906209072090820909209102091120912209132091420915209162091720918209192092020921209222092320924209252092620927209282092920930209312093220933209342093520936209372093820939209402094120942209432094420945209462094720948209492095020951209522095320954209552095620957209582095920960209612096220963209642096520966209672096820969209702097120972209732097420975209762097720978209792098020981209822098320984209852098620987209882098920990209912099220993209942099520996209972099820999210002100121002210032100421005210062100721008210092101021011210122101321014210152101621017210182101921020210212102221023210242102521026210272102821029210302103121032210332103421035210362103721038210392104021041210422104321044210452104621047210482104921050210512105221053210542105521056210572105821059210602106121062210632106421065210662106721068210692107021071210722107321074210752107621077210782107921080210812108221083210842108521086210872108821089210902109121092210932109421095210962109721098210992110021101211022110321104211052110621107211082110921110211112111221113211142111521116211172111821119211202112121122211232112421125211262112721128211292113021131211322113321134211352113621137211382113921140211412114221143211442114521146211472114821149211502115121152211532115421155211562115721158211592116021161211622116321164211652116621167211682116921170211712117221173211742117521176211772117821179211802118121182211832118421185211862118721188211892119021191211922119321194211952119621197211982119921200212012120221203212042120521206212072120821209212102121121212212132121421215212162121721218212192122021221212222122321224212252122621227212282122921230212312123221233212342123521236212372123821239212402124121242212432124421245212462124721248212492125021251212522125321254212552125621257212582125921260212612126221263212642126521266212672126821269212702127121272212732127421275212762127721278212792128021281212822128321284212852128621287212882128921290212912129221293212942129521296212972129821299213002130121302213032130421305213062130721308213092131021311213122131321314213152131621317213182131921320213212132221323213242132521326213272132821329213302133121332213332133421335213362133721338213392134021341213422134321344213452134621347213482134921350213512135221353213542135521356213572135821359213602136121362213632136421365213662136721368213692137021371213722137321374213752137621377213782137921380213812138221383213842138521386213872138821389213902139121392213932139421395213962139721398213992140021401214022140321404214052140621407214082140921410214112141221413214142141521416214172141821419214202142121422214232142421425214262142721428214292143021431214322143321434214352143621437214382143921440214412144221443214442144521446214472144821449214502145121452214532145421455214562145721458214592146021461214622146321464214652146621467214682146921470214712147221473214742147521476214772147821479214802148121482214832148421485214862148721488214892149021491214922149321494214952149621497214982149921500215012150221503215042150521506215072150821509215102151121512215132151421515215162151721518215192152021521215222152321524215252152621527215282152921530215312153221533215342153521536215372153821539215402154121542215432154421545215462154721548215492155021551215522155321554215552155621557215582155921560215612156221563215642156521566215672156821569215702157121572215732157421575215762157721578215792158021581215822158321584215852158621587215882158921590215912159221593215942159521596215972159821599216002160121602216032160421605216062160721608216092161021611216122161321614216152161621617216182161921620216212162221623216242162521626216272162821629216302163121632216332163421635216362163721638216392164021641216422164321644216452164621647216482164921650216512165221653216542165521656216572165821659216602166121662216632166421665216662166721668216692167021671216722167321674216752167621677216782167921680216812168221683216842168521686216872168821689216902169121692216932169421695216962169721698216992170021701217022170321704217052170621707217082170921710217112171221713217142171521716217172171821719217202172121722217232172421725217262172721728217292173021731217322173321734217352173621737217382173921740217412174221743217442174521746217472174821749217502175121752217532175421755217562175721758217592176021761217622176321764217652176621767217682176921770217712177221773217742177521776217772177821779217802178121782217832178421785217862178721788217892179021791217922179321794217952179621797217982179921800218012180221803218042180521806218072180821809218102181121812218132181421815218162181721818218192182021821218222182321824218252182621827218282182921830218312183221833218342183521836218372183821839218402184121842218432184421845218462184721848218492185021851218522185321854218552185621857218582185921860218612186221863218642186521866218672186821869218702187121872218732187421875218762187721878218792188021881218822188321884218852188621887218882188921890218912189221893218942189521896218972189821899219002190121902219032190421905219062190721908219092191021911219122191321914219152191621917219182191921920219212192221923219242192521926219272192821929219302193121932219332193421935219362193721938219392194021941219422194321944219452194621947219482194921950219512195221953219542195521956219572195821959219602196121962219632196421965219662196721968219692197021971219722197321974219752197621977219782197921980219812198221983219842198521986219872198821989219902199121992219932199421995219962199721998219992200022001220022200322004220052200622007220082200922010220112201222013220142201522016220172201822019220202202122022220232202422025220262202722028220292203022031220322203322034220352203622037220382203922040220412204222043220442204522046220472204822049220502205122052220532205422055220562205722058220592206022061220622206322064220652206622067220682206922070220712207222073220742207522076220772207822079220802208122082220832208422085220862208722088220892209022091220922209322094220952209622097220982209922100221012210222103221042210522106221072210822109221102211122112221132211422115221162211722118221192212022121221222212322124221252212622127221282212922130221312213222133221342213522136221372213822139221402214122142221432214422145221462214722148221492215022151221522215322154221552215622157221582215922160221612216222163221642216522166221672216822169221702217122172221732217422175221762217722178221792218022181221822218322184221852218622187221882218922190221912219222193221942219522196221972219822199222002220122202222032220422205222062220722208222092221022211222122221322214222152221622217222182221922220222212222222223222242222522226222272222822229222302223122232222332223422235222362223722238222392224022241222422224322244222452224622247222482224922250222512225222253222542225522256222572225822259222602226122262222632226422265222662226722268222692227022271222722227322274222752227622277222782227922280222812228222283222842228522286222872228822289222902229122292222932229422295222962229722298222992230022301223022230322304223052230622307223082230922310223112231222313223142231522316223172231822319223202232122322223232232422325223262232722328223292233022331223322233322334223352233622337223382233922340223412234222343223442234522346223472234822349223502235122352223532235422355223562235722358223592236022361223622236322364223652236622367223682236922370223712237222373223742237522376223772237822379223802238122382223832238422385223862238722388223892239022391223922239322394223952239622397223982239922400224012240222403224042240522406224072240822409224102241122412224132241422415224162241722418224192242022421224222242322424224252242622427224282242922430224312243222433224342243522436224372243822439224402244122442224432244422445224462244722448224492245022451224522245322454224552245622457224582245922460224612246222463224642246522466224672246822469224702247122472224732247422475224762247722478224792248022481224822248322484224852248622487224882248922490224912249222493224942249522496224972249822499225002250122502225032250422505225062250722508225092251022511225122251322514225152251622517225182251922520225212252222523225242252522526225272252822529225302253122532225332253422535225362253722538225392254022541225422254322544225452254622547225482254922550225512255222553225542255522556225572255822559225602256122562225632256422565225662256722568225692257022571225722257322574225752257622577225782257922580225812258222583225842258522586225872258822589225902259122592225932259422595225962259722598225992260022601226022260322604226052260622607226082260922610226112261222613226142261522616226172261822619226202262122622226232262422625226262262722628226292263022631226322263322634226352263622637226382263922640226412264222643226442264522646226472264822649226502265122652226532265422655226562265722658226592266022661226622266322664226652266622667226682266922670226712267222673226742267522676226772267822679226802268122682226832268422685226862268722688226892269022691226922269322694226952269622697226982269922700227012270222703227042270522706227072270822709227102271122712227132271422715227162271722718227192272022721227222272322724227252272622727227282272922730227312273222733227342273522736227372273822739227402274122742227432274422745227462274722748227492275022751227522275322754227552275622757227582275922760227612276222763227642276522766227672276822769227702277122772227732277422775227762277722778227792278022781227822278322784227852278622787227882278922790227912279222793227942279522796227972279822799228002280122802228032280422805228062280722808228092281022811228122281322814228152281622817228182281922820228212282222823228242282522826228272282822829228302283122832228332283422835228362283722838228392284022841228422284322844228452284622847228482284922850228512285222853228542285522856228572285822859228602286122862228632286422865228662286722868228692287022871228722287322874228752287622877228782287922880228812288222883228842288522886228872288822889228902289122892228932289422895228962289722898228992290022901229022290322904229052290622907229082290922910229112291222913229142291522916229172291822919229202292122922229232292422925229262292722928229292293022931229322293322934229352293622937229382293922940229412294222943229442294522946229472294822949229502295122952229532295422955229562295722958229592296022961229622296322964229652296622967229682296922970229712297222973229742297522976229772297822979229802298122982229832298422985229862298722988229892299022991229922299322994229952299622997229982299923000230012300223003230042300523006230072300823009230102301123012230132301423015230162301723018230192302023021230222302323024230252302623027230282302923030230312303223033230342303523036230372303823039230402304123042230432304423045230462304723048230492305023051230522305323054230552305623057230582305923060230612306223063230642306523066230672306823069230702307123072230732307423075230762307723078230792308023081230822308323084230852308623087230882308923090230912309223093230942309523096230972309823099231002310123102231032310423105231062310723108231092311023111231122311323114231152311623117231182311923120231212312223123231242312523126231272312823129231302313123132231332313423135231362313723138231392314023141231422314323144231452314623147231482314923150231512315223153231542315523156231572315823159231602316123162231632316423165231662316723168231692317023171231722317323174231752317623177231782317923180231812318223183231842318523186231872318823189231902319123192231932319423195231962319723198231992320023201232022320323204232052320623207232082320923210232112321223213232142321523216232172321823219232202322123222232232322423225232262322723228232292323023231232322323323234232352323623237232382323923240232412324223243232442324523246232472324823249232502325123252232532325423255232562325723258232592326023261232622326323264232652326623267232682326923270232712327223273232742327523276232772327823279232802328123282232832328423285232862328723288232892329023291232922329323294232952329623297232982329923300233012330223303233042330523306233072330823309233102331123312233132331423315233162331723318233192332023321233222332323324233252332623327233282332923330233312333223333233342333523336233372333823339233402334123342233432334423345233462334723348233492335023351233522335323354233552335623357233582335923360233612336223363233642336523366233672336823369233702337123372233732337423375233762337723378233792338023381233822338323384233852338623387233882338923390233912339223393233942339523396233972339823399234002340123402234032340423405234062340723408234092341023411234122341323414234152341623417234182341923420234212342223423234242342523426234272342823429234302343123432234332343423435234362343723438234392344023441234422344323444234452344623447234482344923450234512345223453234542345523456234572345823459234602346123462234632346423465234662346723468234692347023471234722347323474234752347623477234782347923480234812348223483234842348523486234872348823489234902349123492234932349423495234962349723498234992350023501235022350323504235052350623507235082350923510235112351223513235142351523516235172351823519235202352123522235232352423525235262352723528235292353023531235322353323534235352353623537235382353923540235412354223543235442354523546235472354823549235502355123552235532355423555235562355723558235592356023561235622356323564235652356623567235682356923570235712357223573235742357523576235772357823579235802358123582235832358423585235862358723588235892359023591235922359323594235952359623597235982359923600236012360223603236042360523606236072360823609236102361123612236132361423615236162361723618236192362023621236222362323624236252362623627236282362923630236312363223633236342363523636236372363823639236402364123642236432364423645236462364723648236492365023651236522365323654236552365623657236582365923660236612366223663236642366523666236672366823669236702367123672236732367423675236762367723678236792368023681236822368323684236852368623687236882368923690236912369223693236942369523696236972369823699237002370123702237032370423705237062370723708237092371023711237122371323714237152371623717237182371923720237212372223723237242372523726237272372823729237302373123732237332373423735237362373723738237392374023741237422374323744237452374623747237482374923750237512375223753237542375523756237572375823759237602376123762237632376423765237662376723768237692377023771237722377323774237752377623777237782377923780237812378223783237842378523786237872378823789237902379123792237932379423795237962379723798237992380023801238022380323804238052380623807238082380923810238112381223813238142381523816238172381823819238202382123822238232382423825238262382723828238292383023831238322383323834238352383623837238382383923840238412384223843238442384523846238472384823849238502385123852238532385423855238562385723858238592386023861238622386323864238652386623867238682386923870238712387223873238742387523876238772387823879238802388123882238832388423885238862388723888238892389023891238922389323894238952389623897238982389923900239012390223903239042390523906239072390823909239102391123912239132391423915239162391723918239192392023921239222392323924239252392623927239282392923930239312393223933239342393523936239372393823939239402394123942239432394423945239462394723948239492395023951239522395323954239552395623957239582395923960239612396223963239642396523966239672396823969239702397123972239732397423975239762397723978239792398023981239822398323984239852398623987239882398923990239912399223993239942399523996239972399823999240002400124002240032400424005240062400724008240092401024011240122401324014240152401624017240182401924020240212402224023240242402524026240272402824029240302403124032240332403424035240362403724038240392404024041240422404324044240452404624047240482404924050240512405224053240542405524056240572405824059240602406124062240632406424065240662406724068240692407024071240722407324074240752407624077240782407924080240812408224083240842408524086240872408824089240902409124092240932409424095240962409724098240992410024101241022410324104241052410624107241082410924110241112411224113241142411524116241172411824119241202412124122241232412424125241262412724128241292413024131241322413324134241352413624137241382413924140241412414224143241442414524146241472414824149241502415124152241532415424155241562415724158241592416024161241622416324164241652416624167241682416924170241712417224173241742417524176241772417824179241802418124182241832418424185241862418724188241892419024191241922419324194241952419624197241982419924200242012420224203242042420524206242072420824209242102421124212242132421424215242162421724218242192422024221242222422324224242252422624227242282422924230242312423224233242342423524236242372423824239242402424124242242432424424245242462424724248242492425024251242522425324254242552425624257242582425924260242612426224263242642426524266242672426824269242702427124272242732427424275242762427724278242792428024281242822428324284242852428624287242882428924290242912429224293242942429524296242972429824299243002430124302243032430424305243062430724308243092431024311243122431324314243152431624317243182431924320243212432224323243242432524326243272432824329243302433124332243332433424335243362433724338243392434024341243422434324344243452434624347243482434924350243512435224353243542435524356243572435824359243602436124362243632436424365243662436724368243692437024371243722437324374243752437624377243782437924380243812438224383243842438524386243872438824389243902439124392243932439424395243962439724398243992440024401244022440324404244052440624407244082440924410244112441224413244142441524416244172441824419244202442124422244232442424425244262442724428244292443024431244322443324434244352443624437244382443924440244412444224443244442444524446244472444824449244502445124452244532445424455244562445724458244592446024461244622446324464244652446624467244682446924470244712447224473244742447524476244772447824479244802448124482244832448424485244862448724488244892449024491244922449324494244952449624497244982449924500245012450224503245042450524506245072450824509245102451124512245132451424515245162451724518245192452024521245222452324524245252452624527245282452924530245312453224533245342453524536245372453824539245402454124542245432454424545245462454724548245492455024551245522455324554245552455624557245582455924560245612456224563245642456524566245672456824569245702457124572245732457424575245762457724578245792458024581245822458324584245852458624587245882458924590245912459224593245942459524596245972459824599246002460124602246032460424605246062460724608246092461024611246122461324614246152461624617246182461924620246212462224623246242462524626246272462824629246302463124632246332463424635246362463724638246392464024641246422464324644246452464624647246482464924650246512465224653246542465524656246572465824659246602466124662246632466424665246662466724668246692467024671246722467324674246752467624677246782467924680246812468224683246842468524686246872468824689246902469124692246932469424695246962469724698246992470024701247022470324704247052470624707247082470924710247112471224713247142471524716247172471824719247202472124722247232472424725247262472724728247292473024731247322473324734247352473624737247382473924740247412474224743247442474524746247472474824749247502475124752247532475424755247562475724758247592476024761247622476324764247652476624767247682476924770247712477224773247742477524776247772477824779247802478124782247832478424785247862478724788247892479024791247922479324794247952479624797247982479924800248012480224803248042480524806248072480824809248102481124812248132481424815248162481724818248192482024821248222482324824248252482624827248282482924830248312483224833248342483524836248372483824839248402484124842248432484424845248462484724848248492485024851248522485324854248552485624857248582485924860248612486224863248642486524866248672486824869248702487124872248732487424875248762487724878248792488024881248822488324884248852488624887248882488924890248912489224893248942489524896248972489824899249002490124902249032490424905249062490724908249092491024911249122491324914249152491624917249182491924920249212492224923249242492524926249272492824929249302493124932249332493424935249362493724938249392494024941249422494324944249452494624947249482494924950249512495224953249542495524956249572495824959249602496124962249632496424965249662496724968249692497024971249722497324974249752497624977249782497924980249812498224983249842498524986249872498824989249902499124992249932499424995249962499724998249992500025001250022500325004250052500625007250082500925010250112501225013250142501525016250172501825019250202502125022250232502425025250262502725028250292503025031250322503325034250352503625037250382503925040250412504225043250442504525046250472504825049250502505125052250532505425055250562505725058250592506025061250622506325064250652506625067250682506925070250712507225073250742507525076250772507825079250802508125082250832508425085250862508725088250892509025091250922509325094250952509625097250982509925100251012510225103251042510525106251072510825109251102511125112251132511425115251162511725118251192512025121251222512325124251252512625127251282512925130251312513225133251342513525136251372513825139251402514125142251432514425145251462514725148251492515025151251522515325154251552515625157251582515925160251612516225163251642516525166251672516825169251702517125172251732517425175251762517725178251792518025181251822518325184251852518625187251882518925190251912519225193251942519525196251972519825199252002520125202252032520425205252062520725208252092521025211252122521325214252152521625217252182521925220252212522225223252242522525226252272522825229252302523125232252332523425235252362523725238252392524025241252422524325244252452524625247252482524925250252512525225253252542525525256252572525825259252602526125262252632526425265252662526725268252692527025271252722527325274252752527625277252782527925280252812528225283252842528525286252872528825289252902529125292252932529425295252962529725298252992530025301253022530325304253052530625307253082530925310253112531225313253142531525316253172531825319253202532125322253232532425325253262532725328253292533025331253322533325334253352533625337253382533925340253412534225343253442534525346253472534825349253502535125352253532535425355253562535725358253592536025361253622536325364253652536625367253682536925370253712537225373253742537525376253772537825379253802538125382253832538425385253862538725388253892539025391253922539325394253952539625397253982539925400254012540225403254042540525406254072540825409254102541125412254132541425415254162541725418254192542025421254222542325424254252542625427254282542925430254312543225433254342543525436254372543825439254402544125442254432544425445254462544725448254492545025451254522545325454254552545625457254582545925460254612546225463254642546525466254672546825469254702547125472254732547425475254762547725478254792548025481254822548325484254852548625487254882548925490254912549225493254942549525496254972549825499255002550125502255032550425505255062550725508255092551025511255122551325514255152551625517255182551925520255212552225523255242552525526255272552825529255302553125532255332553425535255362553725538255392554025541255422554325544255452554625547255482554925550255512555225553255542555525556255572555825559255602556125562255632556425565255662556725568255692557025571255722557325574255752557625577255782557925580255812558225583255842558525586255872558825589255902559125592255932559425595255962559725598255992560025601256022560325604256052560625607256082560925610256112561225613256142561525616256172561825619256202562125622256232562425625256262562725628256292563025631256322563325634256352563625637256382563925640256412564225643256442564525646256472564825649256502565125652256532565425655256562565725658256592566025661256622566325664256652566625667256682566925670256712567225673256742567525676256772567825679256802568125682256832568425685256862568725688256892569025691256922569325694256952569625697256982569925700257012570225703257042570525706257072570825709257102571125712257132571425715257162571725718257192572025721257222572325724257252572625727257282572925730257312573225733257342573525736257372573825739257402574125742257432574425745257462574725748257492575025751257522575325754257552575625757257582575925760257612576225763257642576525766257672576825769257702577125772257732577425775257762577725778257792578025781257822578325784257852578625787257882578925790257912579225793257942579525796257972579825799258002580125802258032580425805258062580725808258092581025811258122581325814258152581625817258182581925820258212582225823258242582525826258272582825829258302583125832258332583425835258362583725838258392584025841258422584325844258452584625847258482584925850258512585225853258542585525856258572585825859258602586125862258632586425865258662586725868258692587025871258722587325874258752587625877258782587925880258812588225883258842588525886258872588825889258902589125892258932589425895258962589725898258992590025901259022590325904259052590625907259082590925910259112591225913259142591525916259172591825919259202592125922259232592425925259262592725928259292593025931259322593325934259352593625937259382593925940259412594225943259442594525946259472594825949259502595125952259532595425955259562595725958259592596025961259622596325964259652596625967259682596925970259712597225973259742597525976259772597825979259802598125982259832598425985259862598725988259892599025991259922599325994259952599625997259982599926000260012600226003260042600526006260072600826009260102601126012260132601426015260162601726018260192602026021260222602326024260252602626027260282602926030260312603226033260342603526036260372603826039260402604126042260432604426045260462604726048260492605026051260522605326054260552605626057260582605926060260612606226063260642606526066260672606826069260702607126072260732607426075260762607726078260792608026081260822608326084260852608626087260882608926090260912609226093260942609526096260972609826099261002610126102261032610426105261062610726108261092611026111261122611326114261152611626117261182611926120261212612226123261242612526126261272612826129261302613126132261332613426135261362613726138261392614026141261422614326144261452614626147261482614926150261512615226153261542615526156261572615826159261602616126162261632616426165261662616726168261692617026171261722617326174261752617626177261782617926180261812618226183261842618526186261872618826189261902619126192261932619426195261962619726198261992620026201262022620326204262052620626207262082620926210262112621226213262142621526216262172621826219262202622126222262232622426225262262622726228262292623026231262322623326234262352623626237262382623926240262412624226243262442624526246262472624826249262502625126252262532625426255262562625726258262592626026261262622626326264262652626626267262682626926270262712627226273262742627526276262772627826279262802628126282262832628426285262862628726288262892629026291262922629326294262952629626297262982629926300263012630226303263042630526306263072630826309263102631126312263132631426315263162631726318263192632026321263222632326324263252632626327263282632926330263312633226333263342633526336263372633826339263402634126342263432634426345263462634726348263492635026351263522635326354263552635626357263582635926360263612636226363263642636526366263672636826369263702637126372263732637426375263762637726378263792638026381263822638326384263852638626387263882638926390263912639226393263942639526396263972639826399264002640126402264032640426405264062640726408264092641026411264122641326414264152641626417264182641926420264212642226423264242642526426264272642826429264302643126432264332643426435264362643726438264392644026441264422644326444264452644626447264482644926450264512645226453264542645526456264572645826459264602646126462264632646426465264662646726468264692647026471264722647326474264752647626477264782647926480264812648226483264842648526486264872648826489264902649126492264932649426495264962649726498264992650026501265022650326504265052650626507265082650926510265112651226513265142651526516265172651826519265202652126522265232652426525265262652726528265292653026531265322653326534265352653626537265382653926540265412654226543265442654526546265472654826549265502655126552265532655426555265562655726558265592656026561265622656326564265652656626567265682656926570265712657226573265742657526576265772657826579265802658126582265832658426585265862658726588265892659026591265922659326594265952659626597265982659926600266012660226603266042660526606266072660826609266102661126612266132661426615266162661726618266192662026621266222662326624266252662626627266282662926630266312663226633266342663526636266372663826639266402664126642266432664426645266462664726648266492665026651266522665326654266552665626657266582665926660266612666226663266642666526666266672666826669266702667126672266732667426675266762667726678266792668026681266822668326684266852668626687266882668926690266912669226693266942669526696266972669826699267002670126702267032670426705267062670726708267092671026711267122671326714267152671626717267182671926720267212672226723267242672526726267272672826729267302673126732267332673426735267362673726738267392674026741267422674326744267452674626747267482674926750267512675226753267542675526756267572675826759267602676126762267632676426765267662676726768267692677026771267722677326774267752677626777267782677926780267812678226783267842678526786267872678826789267902679126792267932679426795267962679726798267992680026801268022680326804268052680626807268082680926810268112681226813268142681526816268172681826819268202682126822268232682426825268262682726828268292683026831268322683326834268352683626837268382683926840268412684226843268442684526846268472684826849268502685126852268532685426855268562685726858268592686026861268622686326864268652686626867268682686926870268712687226873268742687526876268772687826879268802688126882268832688426885268862688726888268892689026891268922689326894268952689626897268982689926900269012690226903269042690526906269072690826909269102691126912269132691426915269162691726918269192692026921269222692326924269252692626927269282692926930269312693226933269342693526936269372693826939269402694126942269432694426945269462694726948269492695026951269522695326954269552695626957269582695926960269612696226963269642696526966269672696826969269702697126972269732697426975269762697726978269792698026981269822698326984269852698626987269882698926990269912699226993269942699526996269972699826999270002700127002270032700427005270062700727008270092701027011270122701327014270152701627017270182701927020270212702227023270242702527026270272702827029270302703127032270332703427035270362703727038270392704027041270422704327044270452704627047270482704927050270512705227053270542705527056270572705827059270602706127062270632706427065270662706727068270692707027071270722707327074270752707627077270782707927080270812708227083270842708527086270872708827089270902709127092270932709427095270962709727098270992710027101271022710327104271052710627107271082710927110271112711227113271142711527116271172711827119271202712127122271232712427125271262712727128271292713027131271322713327134271352713627137271382713927140271412714227143271442714527146271472714827149271502715127152271532715427155271562715727158271592716027161271622716327164271652716627167271682716927170271712717227173271742717527176271772717827179271802718127182271832718427185271862718727188271892719027191271922719327194271952719627197271982719927200272012720227203272042720527206272072720827209272102721127212272132721427215272162721727218272192722027221272222722327224272252722627227272282722927230272312723227233272342723527236272372723827239272402724127242272432724427245272462724727248272492725027251272522725327254272552725627257272582725927260272612726227263272642726527266272672726827269272702727127272272732727427275272762727727278272792728027281272822728327284272852728627287272882728927290272912729227293272942729527296272972729827299273002730127302273032730427305273062730727308273092731027311273122731327314273152731627317273182731927320273212732227323273242732527326273272732827329273302733127332273332733427335273362733727338273392734027341273422734327344273452734627347273482734927350273512735227353273542735527356273572735827359273602736127362273632736427365273662736727368273692737027371273722737327374273752737627377273782737927380273812738227383273842738527386273872738827389273902739127392273932739427395273962739727398273992740027401274022740327404274052740627407274082740927410274112741227413274142741527416274172741827419274202742127422274232742427425274262742727428274292743027431274322743327434274352743627437274382743927440274412744227443274442744527446274472744827449274502745127452274532745427455274562745727458274592746027461274622746327464274652746627467274682746927470274712747227473274742747527476274772747827479274802748127482274832748427485274862748727488274892749027491274922749327494274952749627497274982749927500275012750227503275042750527506275072750827509275102751127512275132751427515275162751727518275192752027521275222752327524275252752627527275282752927530275312753227533275342753527536275372753827539275402754127542275432754427545275462754727548275492755027551275522755327554275552755627557275582755927560275612756227563275642756527566275672756827569275702757127572275732757427575275762757727578275792758027581275822758327584275852758627587275882758927590275912759227593275942759527596275972759827599276002760127602276032760427605276062760727608276092761027611276122761327614276152761627617276182761927620276212762227623276242762527626276272762827629276302763127632276332763427635276362763727638276392764027641276422764327644276452764627647276482764927650276512765227653276542765527656276572765827659276602766127662276632766427665276662766727668276692767027671276722767327674276752767627677276782767927680276812768227683276842768527686276872768827689276902769127692276932769427695276962769727698276992770027701277022770327704277052770627707277082770927710277112771227713277142771527716277172771827719277202772127722277232772427725277262772727728277292773027731277322773327734277352773627737277382773927740277412774227743277442774527746277472774827749277502775127752277532775427755277562775727758277592776027761277622776327764277652776627767277682776927770277712777227773277742777527776277772777827779277802778127782277832778427785277862778727788277892779027791277922779327794277952779627797277982779927800278012780227803278042780527806278072780827809278102781127812278132781427815278162781727818278192782027821278222782327824278252782627827278282782927830278312783227833278342783527836278372783827839278402784127842278432784427845278462784727848278492785027851278522785327854278552785627857278582785927860278612786227863278642786527866278672786827869278702787127872278732787427875278762787727878278792788027881278822788327884278852788627887278882788927890278912789227893278942789527896278972789827899279002790127902279032790427905279062790727908279092791027911279122791327914279152791627917279182791927920279212792227923279242792527926279272792827929279302793127932279332793427935279362793727938279392794027941279422794327944279452794627947279482794927950279512795227953279542795527956279572795827959279602796127962279632796427965279662796727968279692797027971279722797327974279752797627977279782797927980279812798227983279842798527986279872798827989279902799127992279932799427995279962799727998279992800028001280022800328004280052800628007280082800928010280112801228013280142801528016280172801828019280202802128022280232802428025280262802728028280292803028031280322803328034280352803628037280382803928040280412804228043280442804528046280472804828049280502805128052280532805428055280562805728058280592806028061280622806328064280652806628067280682806928070280712807228073280742807528076280772807828079280802808128082280832808428085280862808728088280892809028091280922809328094280952809628097280982809928100281012810228103281042810528106281072810828109281102811128112281132811428115281162811728118281192812028121281222812328124281252812628127281282812928130281312813228133281342813528136281372813828139281402814128142281432814428145281462814728148281492815028151281522815328154281552815628157281582815928160281612816228163281642816528166281672816828169281702817128172281732817428175281762817728178281792818028181281822818328184281852818628187281882818928190281912819228193281942819528196281972819828199282002820128202282032820428205282062820728208282092821028211282122821328214282152821628217282182821928220282212822228223282242822528226282272822828229282302823128232282332823428235282362823728238282392824028241282422824328244282452824628247282482824928250282512825228253282542825528256282572825828259282602826128262282632826428265282662826728268282692827028271282722827328274282752827628277282782827928280282812828228283282842828528286282872828828289282902829128292282932829428295282962829728298282992830028301283022830328304283052830628307283082830928310283112831228313283142831528316283172831828319283202832128322283232832428325283262832728328283292833028331283322833328334283352833628337283382833928340283412834228343283442834528346283472834828349283502835128352283532835428355283562835728358283592836028361283622836328364283652836628367283682836928370283712837228373283742837528376283772837828379283802838128382283832838428385283862838728388283892839028391283922839328394283952839628397283982839928400284012840228403284042840528406284072840828409284102841128412284132841428415284162841728418284192842028421284222842328424284252842628427284282842928430284312843228433284342843528436284372843828439284402844128442284432844428445284462844728448284492845028451284522845328454284552845628457284582845928460284612846228463284642846528466284672846828469284702847128472284732847428475284762847728478284792848028481284822848328484284852848628487284882848928490284912849228493284942849528496284972849828499285002850128502285032850428505285062850728508285092851028511285122851328514285152851628517285182851928520285212852228523285242852528526285272852828529285302853128532285332853428535285362853728538285392854028541285422854328544285452854628547285482854928550285512855228553285542855528556285572855828559285602856128562285632856428565285662856728568285692857028571285722857328574285752857628577285782857928580285812858228583285842858528586285872858828589285902859128592285932859428595285962859728598285992860028601286022860328604286052860628607286082860928610286112861228613286142861528616286172861828619286202862128622286232862428625286262862728628286292863028631286322863328634286352863628637286382863928640286412864228643286442864528646286472864828649286502865128652286532865428655286562865728658286592866028661286622866328664286652866628667286682866928670286712867228673286742867528676286772867828679286802868128682286832868428685286862868728688286892869028691286922869328694286952869628697286982869928700287012870228703287042870528706287072870828709287102871128712287132871428715287162871728718287192872028721287222872328724287252872628727287282872928730287312873228733287342873528736287372873828739287402874128742287432874428745287462874728748287492875028751287522875328754287552875628757287582875928760287612876228763287642876528766287672876828769287702877128772287732877428775287762877728778287792878028781287822878328784287852878628787287882878928790287912879228793287942879528796287972879828799288002880128802288032880428805288062880728808288092881028811288122881328814288152881628817288182881928820288212882228823288242882528826288272882828829288302883128832288332883428835288362883728838288392884028841288422884328844288452884628847288482884928850288512885228853288542885528856288572885828859288602886128862288632886428865288662886728868288692887028871288722887328874288752887628877288782887928880288812888228883288842888528886288872888828889288902889128892288932889428895288962889728898288992890028901289022890328904289052890628907289082890928910289112891228913289142891528916289172891828919289202892128922289232892428925289262892728928289292893028931289322893328934289352893628937289382893928940289412894228943289442894528946289472894828949289502895128952289532895428955289562895728958289592896028961289622896328964289652896628967289682896928970289712897228973289742897528976289772897828979289802898128982289832898428985289862898728988289892899028991289922899328994289952899628997289982899929000290012900229003290042900529006290072900829009290102901129012290132901429015290162901729018290192902029021290222902329024290252902629027290282902929030290312903229033290342903529036290372903829039290402904129042290432904429045290462904729048290492905029051290522905329054290552905629057290582905929060290612906229063290642906529066290672906829069290702907129072290732907429075290762907729078290792908029081290822908329084290852908629087290882908929090290912909229093290942909529096290972909829099291002910129102291032910429105291062910729108291092911029111291122911329114291152911629117291182911929120291212912229123291242912529126291272912829129291302913129132291332913429135291362913729138291392914029141291422914329144291452914629147291482914929150291512915229153291542915529156291572915829159291602916129162291632916429165291662916729168291692917029171291722917329174291752917629177291782917929180291812918229183291842918529186291872918829189291902919129192291932919429195291962919729198291992920029201292022920329204292052920629207292082920929210292112921229213292142921529216292172921829219292202922129222292232922429225292262922729228292292923029231292322923329234292352923629237292382923929240292412924229243292442924529246292472924829249292502925129252292532925429255292562925729258292592926029261292622926329264292652926629267292682926929270292712927229273292742927529276292772927829279292802928129282292832928429285292862928729288292892929029291292922929329294292952929629297292982929929300293012930229303293042930529306293072930829309293102931129312293132931429315293162931729318293192932029321293222932329324293252932629327293282932929330293312933229333293342933529336293372933829339293402934129342293432934429345293462934729348293492935029351293522935329354293552935629357293582935929360293612936229363293642936529366293672936829369293702937129372293732937429375293762937729378293792938029381293822938329384293852938629387293882938929390293912939229393293942939529396293972939829399294002940129402294032940429405294062940729408294092941029411294122941329414294152941629417294182941929420294212942229423294242942529426294272942829429294302943129432294332943429435294362943729438294392944029441294422944329444294452944629447294482944929450294512945229453294542945529456294572945829459294602946129462294632946429465294662946729468294692947029471294722947329474294752947629477294782947929480294812948229483294842948529486294872948829489294902949129492294932949429495294962949729498294992950029501295022950329504295052950629507295082950929510295112951229513295142951529516295172951829519295202952129522295232952429525295262952729528295292953029531295322953329534295352953629537295382953929540295412954229543295442954529546295472954829549295502955129552295532955429555295562955729558295592956029561295622956329564295652956629567295682956929570295712957229573295742957529576295772957829579295802958129582295832958429585295862958729588295892959029591295922959329594295952959629597295982959929600296012960229603296042960529606296072960829609296102961129612296132961429615296162961729618296192962029621296222962329624296252962629627296282962929630296312963229633296342963529636296372963829639296402964129642296432964429645296462964729648296492965029651296522965329654296552965629657296582965929660296612966229663296642966529666296672966829669296702967129672296732967429675296762967729678296792968029681296822968329684296852968629687296882968929690296912969229693296942969529696296972969829699297002970129702297032970429705297062970729708297092971029711297122971329714297152971629717297182971929720297212972229723297242972529726297272972829729297302973129732297332973429735297362973729738297392974029741297422974329744297452974629747297482974929750297512975229753297542975529756297572975829759297602976129762297632976429765297662976729768297692977029771297722977329774297752977629777297782977929780297812978229783297842978529786297872978829789297902979129792297932979429795297962979729798297992980029801298022980329804298052980629807298082980929810298112981229813298142981529816298172981829819298202982129822298232982429825298262982729828298292983029831298322983329834298352983629837298382983929840298412984229843298442984529846298472984829849298502985129852298532985429855298562985729858298592986029861298622986329864298652986629867298682986929870298712987229873298742987529876298772987829879298802988129882298832988429885298862988729888298892989029891298922989329894298952989629897298982989929900299012990229903299042990529906299072990829909299102991129912299132991429915299162991729918299192992029921299222992329924299252992629927299282992929930299312993229933299342993529936299372993829939299402994129942299432994429945299462994729948299492995029951299522995329954299552995629957299582995929960299612996229963299642996529966299672996829969299702997129972299732997429975299762997729978299792998029981299822998329984299852998629987299882998929990299912999229993299942999529996299972999829999300003000130002300033000430005300063000730008300093001030011300123001330014300153001630017300183001930020300213002230023300243002530026300273002830029300303003130032300333003430035300363003730038300393004030041300423004330044300453004630047300483004930050300513005230053300543005530056300573005830059300603006130062300633006430065300663006730068300693007030071300723007330074300753007630077300783007930080300813008230083300843008530086300873008830089300903009130092300933009430095300963009730098300993010030101301023010330104301053010630107301083010930110301113011230113301143011530116301173011830119301203012130122301233012430125301263012730128301293013030131301323013330134301353013630137301383013930140301413014230143301443014530146301473014830149301503015130152301533015430155301563015730158301593016030161301623016330164301653016630167301683016930170301713017230173301743017530176301773017830179301803018130182301833018430185301863018730188301893019030191301923019330194301953019630197301983019930200302013020230203302043020530206302073020830209302103021130212302133021430215302163021730218302193022030221302223022330224302253022630227302283022930230302313023230233302343023530236302373023830239302403024130242302433024430245302463024730248302493025030251302523025330254302553025630257302583025930260302613026230263302643026530266302673026830269302703027130272302733027430275302763027730278302793028030281302823028330284302853028630287302883028930290302913029230293302943029530296302973029830299303003030130302303033030430305303063030730308303093031030311303123031330314303153031630317303183031930320303213032230323303243032530326303273032830329303303033130332303333033430335303363033730338303393034030341303423034330344303453034630347303483034930350303513035230353303543035530356303573035830359303603036130362303633036430365303663036730368303693037030371303723037330374303753037630377303783037930380303813038230383303843038530386303873038830389303903039130392303933039430395303963039730398303993040030401304023040330404304053040630407304083040930410304113041230413304143041530416304173041830419304203042130422304233042430425304263042730428304293043030431304323043330434304353043630437304383043930440304413044230443304443044530446304473044830449304503045130452304533045430455304563045730458304593046030461304623046330464304653046630467304683046930470304713047230473304743047530476304773047830479304803048130482304833048430485304863048730488304893049030491304923049330494304953049630497304983049930500305013050230503305043050530506305073050830509305103051130512305133051430515305163051730518305193052030521305223052330524305253052630527305283052930530305313053230533305343053530536305373053830539305403054130542305433054430545305463054730548305493055030551305523055330554305553055630557305583055930560305613056230563305643056530566305673056830569305703057130572305733057430575305763057730578305793058030581305823058330584305853058630587305883058930590305913059230593305943059530596305973059830599306003060130602306033060430605306063060730608306093061030611306123061330614306153061630617306183061930620306213062230623306243062530626306273062830629306303063130632306333063430635306363063730638306393064030641306423064330644306453064630647306483064930650306513065230653306543065530656306573065830659306603066130662306633066430665306663066730668306693067030671306723067330674306753067630677306783067930680306813068230683306843068530686306873068830689306903069130692306933069430695306963069730698306993070030701307023070330704307053070630707307083070930710307113071230713307143071530716307173071830719307203072130722307233072430725307263072730728307293073030731307323073330734307353073630737307383073930740307413074230743307443074530746307473074830749307503075130752307533075430755307563075730758307593076030761307623076330764307653076630767307683076930770307713077230773307743077530776307773077830779307803078130782307833078430785307863078730788307893079030791307923079330794307953079630797307983079930800308013080230803308043080530806308073080830809308103081130812308133081430815308163081730818308193082030821308223082330824308253082630827308283082930830308313083230833308343083530836308373083830839308403084130842308433084430845308463084730848308493085030851308523085330854308553085630857308583085930860308613086230863308643086530866308673086830869308703087130872308733087430875308763087730878308793088030881308823088330884308853088630887308883088930890308913089230893308943089530896308973089830899309003090130902309033090430905309063090730908309093091030911309123091330914309153091630917309183091930920309213092230923309243092530926309273092830929309303093130932309333093430935309363093730938309393094030941309423094330944309453094630947309483094930950309513095230953309543095530956309573095830959309603096130962309633096430965309663096730968309693097030971309723097330974309753097630977309783097930980309813098230983309843098530986309873098830989309903099130992309933099430995309963099730998309993100031001310023100331004310053100631007310083100931010310113101231013310143101531016310173101831019310203102131022310233102431025310263102731028310293103031031310323103331034310353103631037310383103931040310413104231043310443104531046310473104831049310503105131052310533105431055310563105731058310593106031061310623106331064310653106631067310683106931070310713107231073310743107531076310773107831079310803108131082310833108431085310863108731088310893109031091310923109331094310953109631097310983109931100311013110231103311043110531106311073110831109311103111131112311133111431115311163111731118311193112031121311223112331124311253112631127311283112931130311313113231133311343113531136311373113831139311403114131142311433114431145311463114731148311493115031151311523115331154311553115631157311583115931160311613116231163311643116531166311673116831169311703117131172311733117431175311763117731178311793118031181311823118331184311853118631187311883118931190311913119231193311943119531196311973119831199312003120131202312033120431205312063120731208312093121031211312123121331214312153121631217312183121931220312213122231223312243122531226312273122831229312303123131232312333123431235312363123731238312393124031241312423124331244312453124631247312483124931250312513125231253312543125531256312573125831259312603126131262312633126431265312663126731268312693127031271312723127331274312753127631277312783127931280312813128231283312843128531286312873128831289312903129131292312933129431295312963129731298312993130031301313023130331304313053130631307313083130931310313113131231313313143131531316313173131831319313203132131322313233132431325313263132731328313293133031331313323133331334313353133631337313383133931340313413134231343313443134531346313473134831349313503135131352313533135431355313563135731358313593136031361313623136331364313653136631367313683136931370313713137231373313743137531376313773137831379313803138131382313833138431385313863138731388313893139031391313923139331394313953139631397313983139931400314013140231403314043140531406314073140831409314103141131412314133141431415314163141731418314193142031421314223142331424314253142631427314283142931430314313143231433314343143531436314373143831439314403144131442314433144431445314463144731448314493145031451314523145331454314553145631457314583145931460314613146231463314643146531466314673146831469314703147131472314733147431475314763147731478314793148031481314823148331484314853148631487314883148931490314913149231493314943149531496314973149831499315003150131502315033150431505315063150731508315093151031511315123151331514315153151631517315183151931520315213152231523315243152531526315273152831529315303153131532315333153431535315363153731538315393154031541315423154331544315453154631547315483154931550315513155231553315543155531556315573155831559315603156131562315633156431565315663156731568315693157031571315723157331574315753157631577315783157931580315813158231583315843158531586315873158831589315903159131592315933159431595315963159731598315993160031601316023160331604316053160631607316083160931610316113161231613316143161531616316173161831619316203162131622316233162431625316263162731628316293163031631316323163331634316353163631637316383163931640316413164231643316443164531646316473164831649316503165131652316533165431655316563165731658316593166031661316623166331664316653166631667316683166931670316713167231673316743167531676316773167831679316803168131682316833168431685316863168731688316893169031691316923169331694316953169631697316983169931700317013170231703317043170531706317073170831709317103171131712317133171431715317163171731718317193172031721317223172331724317253172631727317283172931730317313173231733317343173531736317373173831739317403174131742317433174431745317463174731748317493175031751317523175331754317553175631757317583175931760317613176231763317643176531766317673176831769317703177131772317733177431775317763177731778317793178031781317823178331784317853178631787317883178931790317913179231793317943179531796317973179831799318003180131802318033180431805318063180731808318093181031811318123181331814318153181631817318183181931820318213182231823318243182531826318273182831829318303183131832318333183431835318363183731838318393184031841318423184331844318453184631847318483184931850318513185231853318543185531856318573185831859318603186131862318633186431865318663186731868318693187031871318723187331874318753187631877318783187931880318813188231883318843188531886318873188831889318903189131892318933189431895318963189731898318993190031901319023190331904319053190631907319083190931910319113191231913319143191531916319173191831919319203192131922319233192431925319263192731928319293193031931319323193331934319353193631937319383193931940319413194231943319443194531946319473194831949319503195131952319533195431955319563195731958319593196031961319623196331964319653196631967319683196931970319713197231973319743197531976319773197831979319803198131982319833198431985319863198731988319893199031991319923199331994319953199631997319983199932000320013200232003320043200532006320073200832009320103201132012320133201432015320163201732018320193202032021320223202332024320253202632027320283202932030320313203232033320343203532036320373203832039320403204132042320433204432045320463204732048320493205032051320523205332054320553205632057320583205932060320613206232063320643206532066320673206832069320703207132072320733207432075320763207732078320793208032081320823208332084320853208632087320883208932090320913209232093320943209532096320973209832099321003210132102321033210432105321063210732108321093211032111321123211332114321153211632117321183211932120321213212232123321243212532126321273212832129321303213132132321333213432135321363213732138321393214032141321423214332144321453214632147321483214932150321513215232153321543215532156321573215832159321603216132162321633216432165321663216732168321693217032171321723217332174321753217632177321783217932180321813218232183321843218532186321873218832189321903219132192321933219432195321963219732198321993220032201322023220332204322053220632207322083220932210322113221232213322143221532216322173221832219322203222132222322233222432225322263222732228322293223032231322323223332234322353223632237322383223932240322413224232243322443224532246322473224832249322503225132252322533225432255322563225732258322593226032261322623226332264322653226632267322683226932270322713227232273322743227532276322773227832279322803228132282322833228432285322863228732288322893229032291322923229332294322953229632297322983229932300323013230232303323043230532306323073230832309323103231132312323133231432315323163231732318323193232032321323223232332324323253232632327323283232932330323313233232333323343233532336323373233832339323403234132342323433234432345323463234732348323493235032351323523235332354323553235632357323583235932360323613236232363323643236532366323673236832369323703237132372323733237432375323763237732378323793238032381323823238332384323853238632387323883238932390323913239232393323943239532396323973239832399324003240132402324033240432405324063240732408324093241032411324123241332414324153241632417324183241932420324213242232423324243242532426324273242832429324303243132432324333243432435324363243732438324393244032441324423244332444324453244632447324483244932450324513245232453324543245532456324573245832459324603246132462324633246432465324663246732468324693247032471324723247332474324753247632477324783247932480324813248232483324843248532486324873248832489324903249132492324933249432495324963249732498324993250032501325023250332504325053250632507325083250932510325113251232513325143251532516325173251832519325203252132522325233252432525325263252732528325293253032531325323253332534325353253632537325383253932540325413254232543325443254532546325473254832549325503255132552325533255432555325563255732558325593256032561325623256332564325653256632567325683256932570325713257232573325743257532576325773257832579325803258132582325833258432585325863258732588325893259032591325923259332594325953259632597325983259932600326013260232603326043260532606326073260832609326103261132612326133261432615326163261732618326193262032621326223262332624326253262632627326283262932630326313263232633326343263532636326373263832639326403264132642326433264432645326463264732648326493265032651326523265332654326553265632657326583265932660326613266232663326643266532666326673266832669326703267132672326733267432675326763267732678326793268032681326823268332684326853268632687326883268932690326913269232693326943269532696326973269832699327003270132702327033270432705327063270732708327093271032711327123271332714327153271632717327183271932720327213272232723327243272532726327273272832729327303273132732327333273432735327363273732738327393274032741327423274332744327453274632747327483274932750327513275232753327543275532756327573275832759327603276132762327633276432765327663276732768327693277032771327723277332774327753277632777327783277932780327813278232783327843278532786327873278832789327903279132792327933279432795327963279732798327993280032801328023280332804328053280632807328083280932810328113281232813328143281532816328173281832819328203282132822328233282432825328263282732828328293283032831328323283332834328353283632837328383283932840328413284232843328443284532846328473284832849328503285132852328533285432855328563285732858328593286032861328623286332864328653286632867328683286932870328713287232873328743287532876328773287832879328803288132882328833288432885328863288732888328893289032891328923289332894328953289632897328983289932900329013290232903329043290532906329073290832909329103291132912329133291432915329163291732918329193292032921329223292332924329253292632927329283292932930329313293232933329343293532936329373293832939329403294132942329433294432945329463294732948329493295032951329523295332954329553295632957329583295932960329613296232963329643296532966329673296832969329703297132972329733297432975329763297732978329793298032981329823298332984329853298632987329883298932990329913299232993329943299532996329973299832999330003300133002330033300433005330063300733008330093301033011330123301333014330153301633017330183301933020330213302233023330243302533026330273302833029330303303133032330333303433035330363303733038330393304033041330423304333044330453304633047330483304933050330513305233053330543305533056330573305833059330603306133062330633306433065330663306733068330693307033071330723307333074330753307633077330783307933080330813308233083330843308533086330873308833089330903309133092330933309433095330963309733098330993310033101331023310333104331053310633107331083310933110331113311233113331143311533116331173311833119331203312133122331233312433125331263312733128331293313033131331323313333134331353313633137331383313933140331413314233143331443314533146331473314833149331503315133152331533315433155331563315733158331593316033161331623316333164331653316633167331683316933170331713317233173331743317533176331773317833179331803318133182331833318433185331863318733188331893319033191331923319333194331953319633197331983319933200332013320233203332043320533206332073320833209332103321133212332133321433215332163321733218332193322033221332223322333224332253322633227332283322933230332313323233233332343323533236332373323833239332403324133242332433324433245332463324733248332493325033251332523325333254332553325633257332583325933260332613326233263332643326533266332673326833269332703327133272332733327433275332763327733278332793328033281332823328333284332853328633287332883328933290332913329233293332943329533296332973329833299333003330133302333033330433305333063330733308333093331033311333123331333314333153331633317333183331933320333213332233323333243332533326333273332833329333303333133332333333333433335333363333733338333393334033341333423334333344333453334633347333483334933350333513335233353333543335533356333573335833359333603336133362333633336433365333663336733368333693337033371333723337333374333753337633377333783337933380333813338233383333843338533386333873338833389333903339133392333933339433395333963339733398333993340033401334023340333404334053340633407334083340933410334113341233413334143341533416334173341833419334203342133422334233342433425334263342733428334293343033431334323343333434334353343633437334383343933440334413344233443334443344533446334473344833449334503345133452334533345433455334563345733458334593346033461334623346333464334653346633467334683346933470334713347233473334743347533476334773347833479334803348133482334833348433485334863348733488334893349033491334923349333494334953349633497334983349933500335013350233503335043350533506335073350833509335103351133512335133351433515335163351733518335193352033521335223352333524335253352633527335283352933530335313353233533335343353533536335373353833539335403354133542335433354433545335463354733548335493355033551335523355333554335553355633557335583355933560335613356233563335643356533566335673356833569335703357133572335733357433575335763357733578335793358033581335823358333584335853358633587335883358933590335913359233593335943359533596335973359833599336003360133602336033360433605336063360733608336093361033611336123361333614336153361633617336183361933620336213362233623336243362533626336273362833629336303363133632336333363433635336363363733638336393364033641336423364333644336453364633647336483364933650336513365233653336543365533656336573365833659336603366133662336633366433665336663366733668336693367033671336723367333674336753367633677336783367933680336813368233683336843368533686336873368833689336903369133692336933369433695336963369733698336993370033701337023370333704337053370633707337083370933710337113371233713337143371533716337173371833719337203372133722337233372433725337263372733728337293373033731337323373333734337353373633737337383373933740337413374233743337443374533746337473374833749337503375133752337533375433755337563375733758337593376033761337623376333764337653376633767337683376933770337713377233773337743377533776337773377833779337803378133782337833378433785337863378733788337893379033791337923379333794337953379633797337983379933800338013380233803338043380533806338073380833809338103381133812338133381433815338163381733818338193382033821338223382333824338253382633827338283382933830338313383233833338343383533836338373383833839338403384133842338433384433845338463384733848338493385033851338523385333854338553385633857338583385933860338613386233863338643386533866338673386833869338703387133872338733387433875338763387733878338793388033881338823388333884338853388633887338883388933890338913389233893338943389533896338973389833899339003390133902339033390433905339063390733908339093391033911339123391333914339153391633917339183391933920339213392233923339243392533926339273392833929339303393133932339333393433935339363393733938339393394033941339423394333944339453394633947339483394933950339513395233953339543395533956339573395833959339603396133962339633396433965339663396733968339693397033971339723397333974339753397633977339783397933980339813398233983339843398533986339873398833989339903399133992339933399433995339963399733998339993400034001340023400334004340053400634007340083400934010340113401234013340143401534016340173401834019340203402134022340233402434025340263402734028340293403034031340323403334034340353403634037340383403934040340413404234043340443404534046340473404834049340503405134052340533405434055340563405734058340593406034061340623406334064340653406634067340683406934070340713407234073340743407534076340773407834079340803408134082340833408434085340863408734088340893409034091340923409334094340953409634097340983409934100341013410234103341043410534106341073410834109341103411134112341133411434115341163411734118341193412034121341223412334124341253412634127341283412934130341313413234133341343413534136341373413834139341403414134142341433414434145341463414734148341493415034151341523415334154341553415634157341583415934160341613416234163341643416534166341673416834169341703417134172341733417434175341763417734178341793418034181341823418334184341853418634187341883418934190341913419234193341943419534196341973419834199342003420134202342033420434205342063420734208342093421034211342123421334214342153421634217342183421934220342213422234223342243422534226342273422834229342303423134232342333423434235342363423734238342393424034241342423424334244342453424634247342483424934250342513425234253342543425534256342573425834259342603426134262342633426434265342663426734268342693427034271342723427334274342753427634277342783427934280342813428234283342843428534286342873428834289342903429134292342933429434295342963429734298342993430034301343023430334304343053430634307343083430934310343113431234313343143431534316343173431834319343203432134322343233432434325343263432734328343293433034331343323433334334343353433634337343383433934340343413434234343343443434534346343473434834349343503435134352343533435434355343563435734358343593436034361343623436334364343653436634367343683436934370343713437234373343743437534376343773437834379343803438134382343833438434385343863438734388343893439034391343923439334394343953439634397343983439934400344013440234403344043440534406344073440834409344103441134412344133441434415344163441734418344193442034421344223442334424344253442634427344283442934430344313443234433344343443534436344373443834439344403444134442344433444434445344463444734448344493445034451344523445334454344553445634457344583445934460344613446234463344643446534466344673446834469344703447134472344733447434475344763447734478344793448034481344823448334484344853448634487344883448934490344913449234493344943449534496344973449834499345003450134502345033450434505345063450734508345093451034511345123451334514345153451634517345183451934520345213452234523345243452534526345273452834529345303453134532345333453434535345363453734538345393454034541345423454334544345453454634547345483454934550345513455234553345543455534556345573455834559345603456134562345633456434565345663456734568345693457034571345723457334574345753457634577345783457934580345813458234583345843458534586345873458834589345903459134592345933459434595345963459734598345993460034601346023460334604346053460634607346083460934610346113461234613346143461534616346173461834619346203462134622346233462434625346263462734628346293463034631346323463334634346353463634637346383463934640346413464234643346443464534646346473464834649346503465134652346533465434655346563465734658346593466034661346623466334664346653466634667346683466934670346713467234673346743467534676346773467834679346803468134682346833468434685346863468734688346893469034691346923469334694346953469634697346983469934700347013470234703347043470534706347073470834709347103471134712347133471434715347163471734718347193472034721347223472334724347253472634727347283472934730347313473234733347343473534736347373473834739347403474134742347433474434745347463474734748347493475034751347523475334754347553475634757347583475934760347613476234763347643476534766347673476834769347703477134772347733477434775347763477734778347793478034781347823478334784347853478634787347883478934790347913479234793347943479534796347973479834799348003480134802348033480434805348063480734808348093481034811348123481334814348153481634817348183481934820348213482234823348243482534826348273482834829348303483134832348333483434835348363483734838348393484034841348423484334844348453484634847348483484934850348513485234853348543485534856348573485834859348603486134862348633486434865348663486734868348693487034871348723487334874348753487634877348783487934880348813488234883348843488534886348873488834889348903489134892348933489434895348963489734898348993490034901349023490334904349053490634907349083490934910349113491234913349143491534916349173491834919349203492134922349233492434925349263492734928349293493034931349323493334934349353493634937349383493934940349413494234943349443494534946349473494834949349503495134952349533495434955349563495734958349593496034961349623496334964349653496634967349683496934970349713497234973349743497534976349773497834979349803498134982349833498434985349863498734988349893499034991349923499334994349953499634997349983499935000350013500235003350043500535006350073500835009350103501135012350133501435015350163501735018350193502035021350223502335024350253502635027350283502935030350313503235033350343503535036350373503835039350403504135042350433504435045350463504735048350493505035051350523505335054350553505635057350583505935060350613506235063350643506535066350673506835069350703507135072350733507435075350763507735078350793508035081350823508335084350853508635087350883508935090350913509235093350943509535096350973509835099351003510135102351033510435105351063510735108351093511035111351123511335114351153511635117351183511935120351213512235123351243512535126351273512835129351303513135132351333513435135351363513735138351393514035141351423514335144351453514635147351483514935150351513515235153351543515535156351573515835159351603516135162351633516435165351663516735168351693517035171351723517335174351753517635177351783517935180351813518235183351843518535186351873518835189351903519135192351933519435195351963519735198351993520035201352023520335204352053520635207352083520935210352113521235213352143521535216352173521835219352203522135222352233522435225352263522735228352293523035231352323523335234352353523635237352383523935240352413524235243352443524535246352473524835249352503525135252352533525435255352563525735258352593526035261352623526335264352653526635267352683526935270352713527235273352743527535276352773527835279352803528135282352833528435285352863528735288352893529035291352923529335294352953529635297352983529935300353013530235303353043530535306353073530835309353103531135312353133531435315353163531735318353193532035321353223532335324353253532635327353283532935330353313533235333353343533535336353373533835339353403534135342353433534435345353463534735348353493535035351353523535335354353553535635357353583535935360353613536235363353643536535366353673536835369353703537135372353733537435375353763537735378353793538035381353823538335384353853538635387353883538935390353913539235393353943539535396353973539835399354003540135402354033540435405354063540735408354093541035411354123541335414354153541635417354183541935420354213542235423354243542535426354273542835429354303543135432354333543435435354363543735438354393544035441354423544335444354453544635447354483544935450354513545235453354543545535456354573545835459354603546135462354633546435465354663546735468354693547035471354723547335474354753547635477354783547935480354813548235483354843548535486354873548835489354903549135492354933549435495354963549735498354993550035501355023550335504355053550635507355083550935510355113551235513355143551535516355173551835519355203552135522355233552435525355263552735528355293553035531355323553335534355353553635537355383553935540355413554235543355443554535546355473554835549355503555135552355533555435555355563555735558355593556035561355623556335564355653556635567355683556935570355713557235573355743557535576355773557835579355803558135582355833558435585355863558735588355893559035591355923559335594355953559635597355983559935600356013560235603356043560535606356073560835609356103561135612356133561435615356163561735618356193562035621356223562335624356253562635627356283562935630356313563235633356343563535636356373563835639356403564135642356433564435645356463564735648356493565035651356523565335654356553565635657356583565935660356613566235663356643566535666356673566835669356703567135672356733567435675356763567735678356793568035681356823568335684356853568635687356883568935690356913569235693356943569535696356973569835699357003570135702357033570435705357063570735708357093571035711357123571335714357153571635717357183571935720357213572235723357243572535726357273572835729357303573135732357333573435735357363573735738357393574035741357423574335744357453574635747357483574935750357513575235753357543575535756357573575835759357603576135762357633576435765357663576735768357693577035771357723577335774357753577635777357783577935780357813578235783357843578535786357873578835789357903579135792357933579435795357963579735798357993580035801358023580335804358053580635807358083580935810358113581235813358143581535816358173581835819358203582135822358233582435825358263582735828358293583035831358323583335834358353583635837358383583935840358413584235843358443584535846358473584835849358503585135852358533585435855358563585735858358593586035861358623586335864358653586635867358683586935870358713587235873358743587535876358773587835879358803588135882358833588435885358863588735888358893589035891358923589335894358953589635897358983589935900359013590235903359043590535906359073590835909359103591135912359133591435915359163591735918359193592035921359223592335924359253592635927359283592935930359313593235933359343593535936359373593835939359403594135942359433594435945359463594735948359493595035951359523595335954359553595635957359583595935960359613596235963359643596535966359673596835969359703597135972359733597435975359763597735978359793598035981359823598335984359853598635987359883598935990359913599235993359943599535996359973599835999360003600136002360033600436005360063600736008360093601036011360123601336014360153601636017360183601936020360213602236023360243602536026360273602836029360303603136032360333603436035360363603736038360393604036041360423604336044360453604636047360483604936050360513605236053360543605536056360573605836059360603606136062360633606436065360663606736068360693607036071360723607336074360753607636077360783607936080360813608236083360843608536086360873608836089360903609136092360933609436095360963609736098360993610036101361023610336104361053610636107361083610936110361113611236113361143611536116361173611836119361203612136122361233612436125361263612736128361293613036131361323613336134361353613636137361383613936140361413614236143361443614536146361473614836149361503615136152361533615436155361563615736158361593616036161361623616336164361653616636167361683616936170361713617236173361743617536176361773617836179361803618136182361833618436185361863618736188361893619036191361923619336194361953619636197361983619936200362013620236203362043620536206362073620836209362103621136212362133621436215362163621736218362193622036221362223622336224362253622636227362283622936230362313623236233362343623536236362373623836239362403624136242362433624436245362463624736248362493625036251362523625336254362553625636257362583625936260362613626236263362643626536266362673626836269362703627136272362733627436275362763627736278362793628036281362823628336284362853628636287362883628936290362913629236293362943629536296362973629836299363003630136302363033630436305363063630736308363093631036311363123631336314363153631636317363183631936320363213632236323363243632536326363273632836329363303633136332363333633436335363363633736338363393634036341363423634336344363453634636347363483634936350363513635236353363543635536356363573635836359363603636136362363633636436365363663636736368363693637036371363723637336374363753637636377363783637936380363813638236383363843638536386363873638836389363903639136392363933639436395363963639736398363993640036401364023640336404364053640636407364083640936410364113641236413364143641536416364173641836419364203642136422364233642436425364263642736428364293643036431364323643336434364353643636437364383643936440364413644236443364443644536446364473644836449364503645136452364533645436455364563645736458364593646036461364623646336464364653646636467364683646936470364713647236473364743647536476364773647836479364803648136482364833648436485364863648736488364893649036491364923649336494364953649636497364983649936500365013650236503365043650536506365073650836509365103651136512365133651436515365163651736518365193652036521365223652336524365253652636527365283652936530365313653236533365343653536536365373653836539365403654136542365433654436545365463654736548365493655036551365523655336554365553655636557365583655936560365613656236563365643656536566365673656836569365703657136572365733657436575365763657736578365793658036581365823658336584365853658636587365883658936590365913659236593365943659536596365973659836599366003660136602366033660436605366063660736608366093661036611366123661336614366153661636617366183661936620366213662236623366243662536626366273662836629366303663136632366333663436635366363663736638366393664036641366423664336644366453664636647366483664936650366513665236653366543665536656366573665836659366603666136662366633666436665366663666736668366693667036671366723667336674366753667636677366783667936680366813668236683366843668536686366873668836689366903669136692366933669436695366963669736698366993670036701367023670336704367053670636707367083670936710367113671236713367143671536716367173671836719367203672136722367233672436725367263672736728367293673036731367323673336734367353673636737367383673936740367413674236743367443674536746367473674836749367503675136752367533675436755367563675736758367593676036761367623676336764367653676636767367683676936770367713677236773367743677536776367773677836779367803678136782367833678436785367863678736788367893679036791367923679336794367953679636797367983679936800368013680236803368043680536806368073680836809368103681136812368133681436815368163681736818368193682036821368223682336824368253682636827368283682936830368313683236833368343683536836368373683836839368403684136842368433684436845368463684736848368493685036851368523685336854368553685636857368583685936860368613686236863368643686536866368673686836869368703687136872368733687436875368763687736878368793688036881368823688336884368853688636887368883688936890368913689236893368943689536896368973689836899369003690136902369033690436905369063690736908369093691036911369123691336914369153691636917369183691936920369213692236923369243692536926369273692836929369303693136932369333693436935369363693736938369393694036941369423694336944369453694636947369483694936950369513695236953369543695536956369573695836959369603696136962369633696436965369663696736968369693697036971369723697336974369753697636977369783697936980369813698236983369843698536986369873698836989369903699136992369933699436995369963699736998369993700037001370023700337004370053700637007370083700937010370113701237013370143701537016370173701837019370203702137022370233702437025370263702737028370293703037031370323703337034370353703637037370383703937040370413704237043370443704537046370473704837049370503705137052370533705437055370563705737058370593706037061370623706337064370653706637067370683706937070370713707237073370743707537076370773707837079370803708137082370833708437085370863708737088370893709037091370923709337094370953709637097370983709937100371013710237103371043710537106371073710837109371103711137112371133711437115371163711737118371193712037121371223712337124371253712637127371283712937130371313713237133371343713537136371373713837139371403714137142371433714437145371463714737148371493715037151371523715337154371553715637157371583715937160371613716237163371643716537166371673716837169371703717137172371733717437175371763717737178371793718037181371823718337184371853718637187371883718937190371913719237193371943719537196371973719837199372003720137202372033720437205372063720737208372093721037211372123721337214372153721637217372183721937220372213722237223372243722537226372273722837229372303723137232372333723437235372363723737238372393724037241372423724337244372453724637247372483724937250372513725237253372543725537256372573725837259372603726137262372633726437265372663726737268372693727037271372723727337274372753727637277372783727937280372813728237283372843728537286372873728837289372903729137292372933729437295372963729737298372993730037301373023730337304373053730637307373083730937310373113731237313373143731537316373173731837319373203732137322373233732437325373263732737328373293733037331373323733337334373353733637337373383733937340373413734237343373443734537346373473734837349373503735137352373533735437355373563735737358373593736037361373623736337364373653736637367373683736937370373713737237373373743737537376373773737837379373803738137382373833738437385373863738737388373893739037391373923739337394373953739637397373983739937400374013740237403374043740537406374073740837409374103741137412374133741437415374163741737418374193742037421374223742337424374253742637427374283742937430374313743237433374343743537436374373743837439374403744137442374433744437445374463744737448374493745037451374523745337454374553745637457374583745937460374613746237463374643746537466374673746837469374703747137472374733747437475374763747737478374793748037481374823748337484374853748637487374883748937490374913749237493374943749537496374973749837499375003750137502375033750437505375063750737508375093751037511375123751337514375153751637517375183751937520375213752237523375243752537526375273752837529375303753137532375333753437535375363753737538375393754037541375423754337544375453754637547375483754937550375513755237553375543755537556375573755837559375603756137562375633756437565375663756737568375693757037571375723757337574375753757637577375783757937580375813758237583375843758537586375873758837589375903759137592375933759437595375963759737598375993760037601376023760337604376053760637607376083760937610376113761237613376143761537616376173761837619376203762137622376233762437625376263762737628376293763037631376323763337634376353763637637376383763937640376413764237643376443764537646376473764837649376503765137652376533765437655376563765737658376593766037661376623766337664376653766637667376683766937670376713767237673376743767537676376773767837679376803768137682376833768437685376863768737688376893769037691376923769337694376953769637697376983769937700377013770237703377043770537706377073770837709377103771137712377133771437715377163771737718377193772037721377223772337724377253772637727377283772937730377313773237733377343773537736377373773837739377403774137742377433774437745377463774737748377493775037751377523775337754377553775637757377583775937760377613776237763377643776537766377673776837769377703777137772377733777437775377763777737778377793778037781377823778337784377853778637787377883778937790377913779237793377943779537796377973779837799378003780137802378033780437805378063780737808378093781037811378123781337814378153781637817378183781937820378213782237823378243782537826378273782837829378303783137832378333783437835378363783737838378393784037841378423784337844378453784637847378483784937850378513785237853378543785537856378573785837859378603786137862378633786437865378663786737868378693787037871378723787337874378753787637877378783787937880378813788237883378843788537886378873788837889378903789137892378933789437895378963789737898378993790037901379023790337904379053790637907379083790937910379113791237913379143791537916379173791837919379203792137922379233792437925379263792737928379293793037931379323793337934379353793637937379383793937940379413794237943379443794537946379473794837949379503795137952379533795437955379563795737958379593796037961379623796337964379653796637967379683796937970379713797237973379743797537976379773797837979379803798137982379833798437985379863798737988379893799037991379923799337994379953799637997379983799938000380013800238003380043800538006380073800838009380103801138012380133801438015380163801738018380193802038021380223802338024380253802638027380283802938030380313803238033380343803538036380373803838039380403804138042380433804438045380463804738048380493805038051380523805338054380553805638057380583805938060380613806238063380643806538066380673806838069380703807138072380733807438075380763807738078380793808038081380823808338084380853808638087380883808938090380913809238093380943809538096380973809838099381003810138102381033810438105381063810738108381093811038111381123811338114381153811638117381183811938120381213812238123381243812538126381273812838129381303813138132381333813438135381363813738138381393814038141381423814338144381453814638147381483814938150381513815238153381543815538156381573815838159381603816138162381633816438165381663816738168381693817038171381723817338174381753817638177381783817938180381813818238183381843818538186381873818838189381903819138192381933819438195381963819738198381993820038201382023820338204382053820638207382083820938210382113821238213382143821538216382173821838219382203822138222382233822438225382263822738228382293823038231382323823338234382353823638237382383823938240382413824238243382443824538246382473824838249382503825138252382533825438255382563825738258382593826038261382623826338264382653826638267382683826938270382713827238273382743827538276382773827838279382803828138282382833828438285382863828738288382893829038291382923829338294382953829638297382983829938300383013830238303383043830538306383073830838309383103831138312383133831438315383163831738318383193832038321383223832338324383253832638327383283832938330383313833238333383343833538336383373833838339383403834138342383433834438345383463834738348383493835038351383523835338354383553835638357383583835938360383613836238363383643836538366383673836838369383703837138372383733837438375383763837738378383793838038381383823838338384383853838638387383883838938390383913839238393383943839538396383973839838399384003840138402384033840438405384063840738408384093841038411384123841338414384153841638417384183841938420384213842238423384243842538426384273842838429384303843138432384333843438435384363843738438384393844038441384423844338444384453844638447384483844938450384513845238453384543845538456384573845838459384603846138462384633846438465384663846738468384693847038471384723847338474384753847638477384783847938480384813848238483384843848538486384873848838489384903849138492384933849438495384963849738498384993850038501385023850338504385053850638507385083850938510385113851238513385143851538516385173851838519385203852138522385233852438525385263852738528385293853038531385323853338534385353853638537385383853938540385413854238543385443854538546385473854838549385503855138552385533855438555385563855738558385593856038561385623856338564385653856638567385683856938570385713857238573385743857538576385773857838579385803858138582385833858438585385863858738588385893859038591385923859338594385953859638597385983859938600386013860238603386043860538606386073860838609386103861138612386133861438615386163861738618386193862038621386223862338624386253862638627386283862938630386313863238633386343863538636386373863838639386403864138642386433864438645386463864738648386493865038651386523865338654386553865638657386583865938660386613866238663386643866538666386673866838669386703867138672386733867438675386763867738678386793868038681386823868338684386853868638687386883868938690386913869238693386943869538696386973869838699387003870138702387033870438705387063870738708387093871038711387123871338714387153871638717387183871938720387213872238723387243872538726387273872838729387303873138732387333873438735387363873738738387393874038741387423874338744387453874638747387483874938750387513875238753387543875538756387573875838759387603876138762387633876438765387663876738768387693877038771387723877338774387753877638777387783877938780387813878238783387843878538786387873878838789387903879138792387933879438795387963879738798387993880038801388023880338804388053880638807388083880938810388113881238813388143881538816388173881838819388203882138822388233882438825388263882738828388293883038831388323883338834388353883638837388383883938840388413884238843388443884538846388473884838849388503885138852388533885438855388563885738858388593886038861388623886338864388653886638867388683886938870388713887238873388743887538876388773887838879388803888138882388833888438885388863888738888388893889038891388923889338894388953889638897388983889938900389013890238903389043890538906389073890838909389103891138912389133891438915389163891738918389193892038921389223892338924389253892638927389283892938930389313893238933389343893538936389373893838939389403894138942389433894438945389463894738948389493895038951389523895338954389553895638957389583895938960389613896238963389643896538966389673896838969389703897138972389733897438975389763897738978389793898038981389823898338984389853898638987389883898938990389913899238993389943899538996389973899838999390003900139002390033900439005390063900739008390093901039011390123901339014390153901639017390183901939020390213902239023390243902539026390273902839029390303903139032390333903439035390363903739038390393904039041390423904339044390453904639047390483904939050390513905239053390543905539056390573905839059390603906139062390633906439065390663906739068390693907039071390723907339074390753907639077390783907939080390813908239083390843908539086390873908839089390903909139092390933909439095390963909739098390993910039101391023910339104391053910639107391083910939110391113911239113391143911539116391173911839119391203912139122391233912439125391263912739128391293913039131391323913339134391353913639137391383913939140391413914239143391443914539146391473914839149391503915139152391533915439155391563915739158391593916039161391623916339164391653916639167391683916939170391713917239173391743917539176391773917839179391803918139182391833918439185391863918739188391893919039191391923919339194391953919639197391983919939200392013920239203392043920539206392073920839209392103921139212392133921439215392163921739218392193922039221392223922339224392253922639227392283922939230392313923239233392343923539236392373923839239392403924139242392433924439245392463924739248392493925039251392523925339254392553925639257392583925939260392613926239263392643926539266392673926839269392703927139272392733927439275392763927739278392793928039281392823928339284392853928639287392883928939290392913929239293392943929539296392973929839299393003930139302393033930439305393063930739308393093931039311393123931339314393153931639317393183931939320393213932239323393243932539326393273932839329393303933139332393333933439335393363933739338393393934039341393423934339344393453934639347393483934939350393513935239353393543935539356393573935839359393603936139362393633936439365393663936739368393693937039371393723937339374393753937639377393783937939380393813938239383393843938539386393873938839389393903939139392393933939439395393963939739398393993940039401394023940339404394053940639407394083940939410394113941239413394143941539416394173941839419394203942139422394233942439425394263942739428394293943039431394323943339434394353943639437394383943939440394413944239443394443944539446394473944839449394503945139452394533945439455394563945739458394593946039461394623946339464394653946639467394683946939470394713947239473394743947539476394773947839479394803948139482394833948439485394863948739488394893949039491394923949339494394953949639497394983949939500395013950239503395043950539506395073950839509395103951139512395133951439515395163951739518395193952039521395223952339524395253952639527395283952939530395313953239533395343953539536395373953839539395403954139542395433954439545395463954739548395493955039551395523955339554395553955639557395583955939560395613956239563395643956539566395673956839569395703957139572395733957439575395763957739578395793958039581395823958339584395853958639587395883958939590395913959239593395943959539596395973959839599396003960139602396033960439605396063960739608396093961039611396123961339614396153961639617396183961939620396213962239623396243962539626396273962839629396303963139632396333963439635396363963739638396393964039641396423964339644396453964639647396483964939650396513965239653396543965539656396573965839659396603966139662396633966439665396663966739668396693967039671396723967339674396753967639677396783967939680396813968239683396843968539686396873968839689396903969139692396933969439695396963969739698396993970039701397023970339704397053970639707397083970939710397113971239713397143971539716397173971839719397203972139722397233972439725397263972739728397293973039731397323973339734397353973639737397383973939740397413974239743397443974539746397473974839749397503975139752397533975439755397563975739758397593976039761397623976339764397653976639767397683976939770397713977239773397743977539776397773977839779397803978139782397833978439785397863978739788397893979039791397923979339794397953979639797397983979939800398013980239803398043980539806398073980839809398103981139812398133981439815398163981739818398193982039821398223982339824398253982639827398283982939830398313983239833398343983539836398373983839839398403984139842398433984439845398463984739848398493985039851398523985339854398553985639857398583985939860398613986239863398643986539866398673986839869398703987139872398733987439875398763987739878398793988039881398823988339884398853988639887398883988939890398913989239893398943989539896398973989839899399003990139902399033990439905399063990739908399093991039911399123991339914399153991639917399183991939920399213992239923399243992539926399273992839929399303993139932399333993439935399363993739938399393994039941399423994339944399453994639947399483994939950399513995239953399543995539956399573995839959399603996139962399633996439965399663996739968399693997039971399723997339974399753997639977399783997939980399813998239983399843998539986399873998839989399903999139992399933999439995399963999739998399994000040001400024000340004400054000640007400084000940010400114001240013400144001540016400174001840019400204002140022400234002440025400264002740028400294003040031400324003340034400354003640037400384003940040400414004240043400444004540046400474004840049400504005140052400534005440055400564005740058400594006040061400624006340064400654006640067400684006940070400714007240073400744007540076400774007840079400804008140082400834008440085400864008740088400894009040091400924009340094400954009640097400984009940100401014010240103401044010540106401074010840109401104011140112401134011440115401164011740118401194012040121401224012340124401254012640127401284012940130401314013240133401344013540136401374013840139401404014140142401434014440145401464014740148401494015040151401524015340154401554015640157401584015940160401614016240163401644016540166401674016840169401704017140172401734017440175401764017740178401794018040181401824018340184401854018640187401884018940190401914019240193401944019540196401974019840199402004020140202402034020440205402064020740208402094021040211402124021340214402154021640217402184021940220402214022240223402244022540226402274022840229402304023140232402334023440235402364023740238402394024040241402424024340244402454024640247402484024940250402514025240253402544025540256402574025840259402604026140262402634026440265402664026740268402694027040271402724027340274402754027640277402784027940280402814028240283402844028540286402874028840289402904029140292402934029440295402964029740298402994030040301403024030340304403054030640307403084030940310403114031240313403144031540316403174031840319403204032140322403234032440325403264032740328403294033040331403324033340334403354033640337403384033940340403414034240343403444034540346403474034840349403504035140352403534035440355403564035740358403594036040361403624036340364403654036640367403684036940370403714037240373403744037540376403774037840379403804038140382403834038440385403864038740388403894039040391403924039340394403954039640397403984039940400404014040240403404044040540406404074040840409404104041140412404134041440415404164041740418404194042040421404224042340424404254042640427404284042940430404314043240433404344043540436404374043840439404404044140442404434044440445404464044740448404494045040451404524045340454404554045640457404584045940460404614046240463404644046540466404674046840469404704047140472404734047440475404764047740478404794048040481404824048340484404854048640487404884048940490404914049240493404944049540496404974049840499405004050140502405034050440505405064050740508405094051040511405124051340514405154051640517405184051940520405214052240523405244052540526405274052840529405304053140532405334053440535405364053740538405394054040541405424054340544405454054640547405484054940550405514055240553405544055540556405574055840559405604056140562405634056440565405664056740568405694057040571405724057340574405754057640577405784057940580405814058240583405844058540586405874058840589405904059140592405934059440595405964059740598405994060040601406024060340604406054060640607406084060940610406114061240613406144061540616406174061840619406204062140622406234062440625406264062740628406294063040631406324063340634406354063640637406384063940640406414064240643406444064540646406474064840649406504065140652406534065440655406564065740658406594066040661406624066340664406654066640667406684066940670406714067240673406744067540676406774067840679406804068140682406834068440685406864068740688406894069040691406924069340694406954069640697406984069940700407014070240703407044070540706407074070840709407104071140712407134071440715407164071740718407194072040721407224072340724407254072640727407284072940730407314073240733407344073540736407374073840739407404074140742407434074440745407464074740748407494075040751407524075340754407554075640757407584075940760407614076240763407644076540766407674076840769407704077140772407734077440775407764077740778407794078040781407824078340784407854078640787407884078940790407914079240793407944079540796407974079840799408004080140802408034080440805408064080740808408094081040811408124081340814408154081640817408184081940820408214082240823408244082540826408274082840829408304083140832408334083440835408364083740838408394084040841408424084340844408454084640847408484084940850408514085240853408544085540856408574085840859408604086140862408634086440865408664086740868408694087040871408724087340874408754087640877408784087940880408814088240883408844088540886408874088840889408904089140892408934089440895408964089740898408994090040901409024090340904409054090640907409084090940910409114091240913409144091540916409174091840919409204092140922409234092440925409264092740928409294093040931409324093340934409354093640937409384093940940409414094240943409444094540946409474094840949409504095140952409534095440955409564095740958409594096040961409624096340964409654096640967409684096940970409714097240973409744097540976409774097840979409804098140982409834098440985409864098740988409894099040991409924099340994409954099640997409984099941000410014100241003410044100541006410074100841009410104101141012410134101441015410164101741018410194102041021410224102341024410254102641027410284102941030410314103241033410344103541036410374103841039410404104141042410434104441045410464104741048410494105041051410524105341054410554105641057410584105941060410614106241063410644106541066410674106841069410704107141072410734107441075410764107741078410794108041081410824108341084410854108641087410884108941090410914109241093410944109541096410974109841099411004110141102411034110441105411064110741108411094111041111411124111341114411154111641117411184111941120411214112241123411244112541126411274112841129411304113141132411334113441135411364113741138411394114041141411424114341144411454114641147411484114941150411514115241153411544115541156411574115841159411604116141162411634116441165411664116741168411694117041171411724117341174411754117641177411784117941180411814118241183411844118541186411874118841189411904119141192411934119441195411964119741198411994120041201412024120341204412054120641207412084120941210412114121241213412144121541216412174121841219412204122141222412234122441225412264122741228412294123041231412324123341234412354123641237412384123941240412414124241243412444124541246412474124841249412504125141252412534125441255412564125741258412594126041261412624126341264412654126641267412684126941270412714127241273412744127541276412774127841279412804128141282412834128441285412864128741288412894129041291412924129341294412954129641297412984129941300413014130241303413044130541306413074130841309413104131141312413134131441315413164131741318413194132041321413224132341324413254132641327413284132941330413314133241333413344133541336413374133841339413404134141342413434134441345413464134741348413494135041351413524135341354413554135641357413584135941360413614136241363413644136541366413674136841369413704137141372413734137441375413764137741378413794138041381413824138341384413854138641387413884138941390413914139241393413944139541396413974139841399414004140141402414034140441405414064140741408414094141041411414124141341414414154141641417414184141941420414214142241423414244142541426414274142841429414304143141432414334143441435414364143741438414394144041441414424144341444414454144641447414484144941450414514145241453414544145541456414574145841459414604146141462414634146441465414664146741468414694147041471414724147341474414754147641477414784147941480414814148241483414844148541486414874148841489414904149141492414934149441495414964149741498414994150041501415024150341504415054150641507415084150941510415114151241513415144151541516415174151841519415204152141522415234152441525415264152741528415294153041531415324153341534415354153641537415384153941540415414154241543415444154541546415474154841549415504155141552415534155441555415564155741558415594156041561415624156341564415654156641567415684156941570415714157241573415744157541576415774157841579415804158141582415834158441585415864158741588415894159041591415924159341594415954159641597415984159941600416014160241603416044160541606416074160841609416104161141612416134161441615416164161741618416194162041621416224162341624416254162641627416284162941630416314163241633416344163541636416374163841639416404164141642416434164441645416464164741648416494165041651416524165341654416554165641657416584165941660416614166241663416644166541666416674166841669416704167141672416734167441675416764167741678416794168041681416824168341684416854168641687416884168941690416914169241693416944169541696416974169841699417004170141702417034170441705417064170741708417094171041711417124171341714417154171641717417184171941720417214172241723417244172541726417274172841729417304173141732417334173441735417364173741738417394174041741417424174341744417454174641747417484174941750417514175241753417544175541756417574175841759417604176141762417634176441765417664176741768417694177041771417724177341774417754177641777417784177941780417814178241783417844178541786417874178841789417904179141792417934179441795417964179741798417994180041801418024180341804418054180641807418084180941810418114181241813418144181541816418174181841819418204182141822418234182441825418264182741828418294183041831418324183341834418354183641837418384183941840418414184241843418444184541846418474184841849418504185141852418534185441855418564185741858418594186041861418624186341864418654186641867418684186941870418714187241873418744187541876418774187841879418804188141882418834188441885418864188741888418894189041891418924189341894418954189641897418984189941900419014190241903419044190541906419074190841909419104191141912419134191441915419164191741918419194192041921419224192341924419254192641927419284192941930419314193241933419344193541936419374193841939419404194141942419434194441945419464194741948419494195041951419524195341954419554195641957419584195941960419614196241963419644196541966419674196841969419704197141972419734197441975419764197741978419794198041981419824198341984419854198641987419884198941990419914199241993419944199541996419974199841999420004200142002420034200442005420064200742008420094201042011420124201342014420154201642017420184201942020420214202242023420244202542026420274202842029420304203142032420334203442035420364203742038420394204042041420424204342044420454204642047420484204942050420514205242053420544205542056420574205842059420604206142062420634206442065420664206742068420694207042071420724207342074420754207642077420784207942080420814208242083420844208542086420874208842089420904209142092420934209442095420964209742098420994210042101421024210342104421054210642107421084210942110421114211242113421144211542116421174211842119421204212142122421234212442125421264212742128421294213042131421324213342134421354213642137421384213942140421414214242143421444214542146421474214842149421504215142152421534215442155421564215742158421594216042161421624216342164421654216642167421684216942170421714217242173421744217542176421774217842179421804218142182421834218442185421864218742188421894219042191421924219342194421954219642197421984219942200422014220242203422044220542206422074220842209422104221142212422134221442215422164221742218422194222042221422224222342224422254222642227422284222942230422314223242233422344223542236422374223842239422404224142242422434224442245422464224742248422494225042251422524225342254422554225642257422584225942260422614226242263422644226542266422674226842269422704227142272422734227442275422764227742278422794228042281422824228342284422854228642287422884228942290422914229242293422944229542296422974229842299423004230142302423034230442305423064230742308423094231042311423124231342314423154231642317423184231942320423214232242323423244232542326423274232842329423304233142332423334233442335423364233742338423394234042341423424234342344423454234642347423484234942350423514235242353423544235542356423574235842359423604236142362423634236442365423664236742368423694237042371423724237342374423754237642377423784237942380423814238242383423844238542386423874238842389423904239142392423934239442395423964239742398423994240042401424024240342404424054240642407424084240942410424114241242413424144241542416424174241842419424204242142422424234242442425424264242742428424294243042431424324243342434424354243642437424384243942440424414244242443424444244542446424474244842449424504245142452424534245442455424564245742458424594246042461424624246342464424654246642467424684246942470424714247242473424744247542476424774247842479424804248142482424834248442485424864248742488424894249042491424924249342494424954249642497424984249942500425014250242503425044250542506425074250842509425104251142512425134251442515425164251742518425194252042521425224252342524425254252642527425284252942530425314253242533425344253542536425374253842539425404254142542425434254442545425464254742548425494255042551425524255342554425554255642557425584255942560425614256242563425644256542566425674256842569425704257142572425734257442575425764257742578425794258042581425824258342584425854258642587425884258942590425914259242593425944259542596425974259842599426004260142602426034260442605426064260742608426094261042611426124261342614426154261642617426184261942620426214262242623426244262542626426274262842629426304263142632426334263442635426364263742638426394264042641426424264342644426454264642647426484264942650426514265242653426544265542656426574265842659426604266142662426634266442665426664266742668426694267042671426724267342674426754267642677426784267942680426814268242683426844268542686426874268842689426904269142692426934269442695426964269742698426994270042701427024270342704427054270642707427084270942710427114271242713427144271542716427174271842719427204272142722427234272442725427264272742728427294273042731427324273342734427354273642737427384273942740427414274242743427444274542746427474274842749427504275142752427534275442755427564275742758427594276042761427624276342764427654276642767427684276942770427714277242773427744277542776427774277842779427804278142782427834278442785427864278742788427894279042791427924279342794427954279642797427984279942800428014280242803428044280542806428074280842809428104281142812428134281442815428164281742818428194282042821428224282342824428254282642827428284282942830428314283242833428344283542836428374283842839428404284142842428434284442845428464284742848428494285042851428524285342854428554285642857428584285942860428614286242863428644286542866428674286842869428704287142872428734287442875428764287742878428794288042881428824288342884428854288642887428884288942890428914289242893428944289542896428974289842899429004290142902429034290442905429064290742908429094291042911429124291342914429154291642917429184291942920429214292242923429244292542926429274292842929429304293142932429334293442935429364293742938429394294042941429424294342944429454294642947429484294942950429514295242953429544295542956429574295842959429604296142962429634296442965429664296742968429694297042971429724297342974429754297642977429784297942980429814298242983429844298542986429874298842989429904299142992429934299442995429964299742998429994300043001430024300343004430054300643007430084300943010430114301243013430144301543016430174301843019430204302143022430234302443025430264302743028430294303043031430324303343034430354303643037430384303943040430414304243043430444304543046430474304843049430504305143052430534305443055430564305743058430594306043061430624306343064430654306643067430684306943070430714307243073430744307543076430774307843079430804308143082430834308443085430864308743088430894309043091430924309343094430954309643097430984309943100431014310243103431044310543106431074310843109431104311143112431134311443115431164311743118431194312043121431224312343124431254312643127431284312943130431314313243133431344313543136431374313843139431404314143142431434314443145431464314743148431494315043151431524315343154431554315643157431584315943160431614316243163431644316543166431674316843169431704317143172431734317443175431764317743178431794318043181431824318343184431854318643187431884318943190431914319243193431944319543196431974319843199432004320143202432034320443205432064320743208432094321043211432124321343214432154321643217432184321943220432214322243223432244322543226432274322843229432304323143232432334323443235432364323743238432394324043241432424324343244432454324643247432484324943250432514325243253432544325543256432574325843259432604326143262432634326443265432664326743268432694327043271432724327343274432754327643277432784327943280432814328243283432844328543286432874328843289432904329143292432934329443295432964329743298432994330043301433024330343304433054330643307433084330943310433114331243313433144331543316433174331843319433204332143322433234332443325433264332743328433294333043331433324333343334433354333643337433384333943340433414334243343433444334543346433474334843349433504335143352433534335443355433564335743358433594336043361433624336343364433654336643367433684336943370433714337243373433744337543376433774337843379433804338143382433834338443385433864338743388433894339043391433924339343394433954339643397433984339943400434014340243403434044340543406434074340843409434104341143412434134341443415434164341743418434194342043421434224342343424434254342643427434284342943430434314343243433434344343543436434374343843439434404344143442434434344443445434464344743448434494345043451434524345343454434554345643457434584345943460434614346243463434644346543466434674346843469434704347143472434734347443475434764347743478434794348043481434824348343484434854348643487434884348943490434914349243493434944349543496434974349843499435004350143502435034350443505435064350743508435094351043511435124351343514435154351643517435184351943520435214352243523435244352543526435274352843529435304353143532435334353443535435364353743538435394354043541435424354343544435454354643547435484354943550435514355243553435544355543556435574355843559435604356143562435634356443565435664356743568435694357043571435724357343574435754357643577435784357943580435814358243583435844358543586435874358843589435904359143592435934359443595435964359743598435994360043601436024360343604436054360643607436084360943610436114361243613436144361543616436174361843619436204362143622436234362443625436264362743628436294363043631436324363343634436354363643637436384363943640436414364243643436444364543646436474364843649436504365143652436534365443655436564365743658436594366043661436624366343664436654366643667436684366943670436714367243673436744367543676436774367843679436804368143682436834368443685436864368743688436894369043691436924369343694436954369643697436984369943700437014370243703437044370543706437074370843709437104371143712437134371443715437164371743718437194372043721437224372343724437254372643727437284372943730437314373243733437344373543736437374373843739437404374143742437434374443745437464374743748437494375043751437524375343754437554375643757437584375943760437614376243763437644376543766437674376843769437704377143772437734377443775437764377743778437794378043781437824378343784437854378643787437884378943790437914379243793437944379543796437974379843799438004380143802438034380443805438064380743808438094381043811438124381343814438154381643817438184381943820438214382243823438244382543826438274382843829438304383143832438334383443835438364383743838438394384043841438424384343844438454384643847438484384943850438514385243853438544385543856438574385843859438604386143862438634386443865438664386743868438694387043871438724387343874438754387643877438784387943880438814388243883438844388543886438874388843889438904389143892438934389443895438964389743898438994390043901439024390343904439054390643907439084390943910439114391243913439144391543916439174391843919439204392143922439234392443925439264392743928439294393043931439324393343934439354393643937439384393943940439414394243943439444394543946439474394843949439504395143952439534395443955439564395743958439594396043961439624396343964439654396643967439684396943970439714397243973439744397543976439774397843979439804398143982439834398443985439864398743988439894399043991439924399343994439954399643997439984399944000440014400244003440044400544006440074400844009440104401144012440134401444015440164401744018440194402044021440224402344024440254402644027440284402944030440314403244033440344403544036440374403844039440404404144042440434404444045440464404744048440494405044051440524405344054440554405644057440584405944060440614406244063440644406544066440674406844069440704407144072440734407444075440764407744078440794408044081440824408344084440854408644087440884408944090440914409244093440944409544096440974409844099441004410144102441034410444105441064410744108441094411044111441124411344114441154411644117441184411944120441214412244123441244412544126441274412844129441304413144132441334413444135441364413744138441394414044141441424414344144441454414644147441484414944150441514415244153441544415544156441574415844159441604416144162441634416444165441664416744168441694417044171441724417344174441754417644177441784417944180441814418244183441844418544186441874418844189441904419144192441934419444195441964419744198441994420044201442024420344204442054420644207442084420944210442114421244213442144421544216442174421844219442204422144222442234422444225442264422744228442294423044231442324423344234442354423644237442384423944240442414424244243442444424544246442474424844249442504425144252442534425444255442564425744258442594426044261442624426344264442654426644267442684426944270442714427244273442744427544276442774427844279442804428144282442834428444285442864428744288442894429044291442924429344294442954429644297442984429944300443014430244303443044430544306443074430844309443104431144312443134431444315443164431744318443194432044321443224432344324443254432644327443284432944330443314433244333443344433544336443374433844339443404434144342443434434444345443464434744348443494435044351443524435344354443554435644357443584435944360443614436244363443644436544366443674436844369443704437144372443734437444375443764437744378443794438044381443824438344384443854438644387443884438944390443914439244393443944439544396443974439844399444004440144402444034440444405444064440744408444094441044411444124441344414444154441644417444184441944420444214442244423444244442544426444274442844429444304443144432444334443444435444364443744438444394444044441444424444344444444454444644447444484444944450444514445244453444544445544456444574445844459444604446144462444634446444465444664446744468444694447044471444724447344474444754447644477444784447944480444814448244483444844448544486444874448844489444904449144492444934449444495444964449744498444994450044501445024450344504445054450644507445084450944510445114451244513445144451544516445174451844519445204452144522445234452444525445264452744528445294453044531445324453344534445354453644537445384453944540445414454244543445444454544546445474454844549445504455144552445534455444555445564455744558445594456044561445624456344564445654456644567445684456944570445714457244573445744457544576445774457844579445804458144582445834458444585445864458744588445894459044591445924459344594445954459644597445984459944600446014460244603446044460544606446074460844609446104461144612446134461444615446164461744618446194462044621446224462344624446254462644627446284462944630446314463244633446344463544636446374463844639446404464144642446434464444645446464464744648446494465044651446524465344654446554465644657446584465944660446614466244663446644466544666446674466844669446704467144672446734467444675446764467744678446794468044681446824468344684446854468644687446884468944690446914469244693446944469544696446974469844699447004470144702447034470444705447064470744708447094471044711447124471344714447154471644717447184471944720447214472244723447244472544726447274472844729447304473144732447334473444735447364473744738447394474044741447424474344744447454474644747447484474944750447514475244753447544475544756447574475844759447604476144762447634476444765447664476744768447694477044771447724477344774447754477644777447784477944780447814478244783447844478544786447874478844789447904479144792447934479444795447964479744798447994480044801448024480344804448054480644807448084480944810448114481244813448144481544816448174481844819448204482144822448234482444825448264482744828448294483044831448324483344834448354483644837448384483944840448414484244843448444484544846448474484844849448504485144852448534485444855448564485744858448594486044861448624486344864448654486644867448684486944870448714487244873448744487544876448774487844879448804488144882448834488444885448864488744888448894489044891448924489344894448954489644897448984489944900449014490244903449044490544906449074490844909449104491144912449134491444915449164491744918449194492044921449224492344924449254492644927449284492944930449314493244933449344493544936449374493844939449404494144942449434494444945449464494744948449494495044951449524495344954449554495644957449584495944960449614496244963449644496544966449674496844969449704497144972449734497444975449764497744978449794498044981449824498344984449854498644987449884498944990449914499244993449944499544996449974499844999450004500145002450034500445005450064500745008450094501045011450124501345014450154501645017450184501945020450214502245023450244502545026450274502845029450304503145032450334503445035450364503745038450394504045041450424504345044450454504645047450484504945050450514505245053450544505545056450574505845059450604506145062450634506445065450664506745068450694507045071450724507345074450754507645077450784507945080450814508245083450844508545086450874508845089450904509145092450934509445095450964509745098450994510045101451024510345104451054510645107451084510945110451114511245113451144511545116451174511845119451204512145122451234512445125451264512745128451294513045131451324513345134451354513645137451384513945140451414514245143451444514545146451474514845149451504515145152451534515445155451564515745158451594516045161451624516345164451654516645167451684516945170451714517245173451744517545176451774517845179451804518145182451834518445185451864518745188451894519045191451924519345194451954519645197451984519945200452014520245203452044520545206452074520845209452104521145212452134521445215452164521745218452194522045221452224522345224452254522645227452284522945230452314523245233452344523545236452374523845239452404524145242452434524445245452464524745248452494525045251452524525345254452554525645257452584525945260452614526245263452644526545266452674526845269452704527145272452734527445275452764527745278452794528045281452824528345284452854528645287452884528945290452914529245293452944529545296452974529845299453004530145302453034530445305453064530745308453094531045311453124531345314453154531645317453184531945320453214532245323453244532545326453274532845329453304533145332453334533445335453364533745338453394534045341453424534345344453454534645347453484534945350453514535245353453544535545356453574535845359453604536145362453634536445365453664536745368453694537045371453724537345374453754537645377453784537945380453814538245383453844538545386453874538845389453904539145392453934539445395453964539745398453994540045401454024540345404454054540645407454084540945410454114541245413454144541545416454174541845419454204542145422454234542445425454264542745428454294543045431454324543345434454354543645437454384543945440454414544245443454444544545446454474544845449454504545145452454534545445455454564545745458454594546045461454624546345464454654546645467454684546945470454714547245473454744547545476454774547845479454804548145482454834548445485454864548745488454894549045491454924549345494454954549645497454984549945500455014550245503455044550545506455074550845509455104551145512455134551445515455164551745518455194552045521455224552345524455254552645527455284552945530455314553245533455344553545536455374553845539455404554145542455434554445545455464554745548455494555045551455524555345554455554555645557455584555945560455614556245563455644556545566455674556845569455704557145572455734557445575455764557745578455794558045581455824558345584455854558645587455884558945590455914559245593455944559545596455974559845599456004560145602456034560445605456064560745608456094561045611456124561345614456154561645617456184561945620456214562245623456244562545626456274562845629456304563145632456334563445635456364563745638456394564045641456424564345644456454564645647456484564945650456514565245653456544565545656456574565845659456604566145662456634566445665456664566745668456694567045671456724567345674456754567645677456784567945680456814568245683456844568545686456874568845689456904569145692456934569445695456964569745698456994570045701457024570345704457054570645707457084570945710457114571245713457144571545716457174571845719457204572145722457234572445725457264572745728457294573045731457324573345734457354573645737457384573945740457414574245743457444574545746457474574845749457504575145752457534575445755457564575745758457594576045761457624576345764457654576645767457684576945770457714577245773457744577545776457774577845779457804578145782457834578445785457864578745788457894579045791457924579345794457954579645797457984579945800458014580245803458044580545806458074580845809458104581145812458134581445815458164581745818458194582045821458224582345824458254582645827458284582945830458314583245833458344583545836458374583845839458404584145842458434584445845458464584745848458494585045851458524585345854458554585645857458584585945860458614586245863458644586545866458674586845869458704587145872458734587445875458764587745878458794588045881458824588345884458854588645887458884588945890458914589245893458944589545896458974589845899459004590145902459034590445905459064590745908459094591045911459124591345914459154591645917459184591945920459214592245923459244592545926459274592845929459304593145932459334593445935459364593745938459394594045941459424594345944459454594645947459484594945950459514595245953459544595545956459574595845959459604596145962459634596445965459664596745968459694597045971459724597345974459754597645977459784597945980459814598245983459844598545986459874598845989459904599145992459934599445995459964599745998459994600046001460024600346004460054600646007460084600946010460114601246013460144601546016460174601846019460204602146022460234602446025460264602746028460294603046031460324603346034460354603646037460384603946040460414604246043460444604546046460474604846049460504605146052460534605446055460564605746058460594606046061460624606346064460654606646067460684606946070460714607246073460744607546076460774607846079460804608146082460834608446085460864608746088460894609046091460924609346094460954609646097460984609946100461014610246103461044610546106461074610846109461104611146112461134611446115461164611746118461194612046121461224612346124461254612646127461284612946130461314613246133461344613546136461374613846139461404614146142461434614446145461464614746148461494615046151461524615346154461554615646157461584615946160461614616246163461644616546166461674616846169461704617146172461734617446175461764617746178461794618046181461824618346184461854618646187461884618946190461914619246193461944619546196461974619846199462004620146202462034620446205462064620746208462094621046211462124621346214462154621646217462184621946220462214622246223462244622546226462274622846229462304623146232462334623446235462364623746238462394624046241462424624346244462454624646247462484624946250462514625246253462544625546256462574625846259462604626146262462634626446265462664626746268462694627046271462724627346274462754627646277462784627946280462814628246283462844628546286462874628846289462904629146292462934629446295462964629746298462994630046301463024630346304463054630646307463084630946310463114631246313463144631546316463174631846319463204632146322463234632446325463264632746328463294633046331463324633346334463354633646337463384633946340463414634246343463444634546346463474634846349463504635146352463534635446355463564635746358463594636046361463624636346364463654636646367463684636946370463714637246373463744637546376463774637846379463804638146382463834638446385463864638746388463894639046391463924639346394463954639646397463984639946400464014640246403464044640546406464074640846409464104641146412464134641446415464164641746418464194642046421464224642346424464254642646427464284642946430464314643246433464344643546436464374643846439464404644146442464434644446445464464644746448464494645046451464524645346454464554645646457464584645946460464614646246463464644646546466464674646846469464704647146472464734647446475464764647746478464794648046481464824648346484464854648646487464884648946490464914649246493464944649546496464974649846499465004650146502465034650446505465064650746508465094651046511465124651346514465154651646517465184651946520465214652246523465244652546526465274652846529465304653146532465334653446535465364653746538465394654046541465424654346544465454654646547465484654946550465514655246553465544655546556465574655846559465604656146562465634656446565465664656746568465694657046571465724657346574465754657646577465784657946580465814658246583465844658546586465874658846589465904659146592465934659446595465964659746598465994660046601466024660346604466054660646607466084660946610466114661246613466144661546616466174661846619466204662146622466234662446625466264662746628466294663046631466324663346634466354663646637466384663946640466414664246643466444664546646466474664846649466504665146652466534665446655466564665746658466594666046661466624666346664466654666646667466684666946670466714667246673466744667546676466774667846679466804668146682466834668446685466864668746688466894669046691466924669346694466954669646697466984669946700467014670246703467044670546706467074670846709467104671146712467134671446715467164671746718467194672046721467224672346724467254672646727467284672946730467314673246733467344673546736467374673846739467404674146742467434674446745467464674746748467494675046751467524675346754467554675646757467584675946760467614676246763467644676546766467674676846769467704677146772467734677446775467764677746778467794678046781467824678346784467854678646787467884678946790467914679246793467944679546796467974679846799468004680146802468034680446805468064680746808468094681046811468124681346814468154681646817468184681946820468214682246823468244682546826468274682846829468304683146832468334683446835468364683746838468394684046841468424684346844468454684646847468484684946850468514685246853468544685546856468574685846859468604686146862468634686446865468664686746868468694687046871468724687346874468754687646877468784687946880468814688246883468844688546886468874688846889468904689146892468934689446895468964689746898468994690046901469024690346904469054690646907469084690946910469114691246913469144691546916469174691846919469204692146922469234692446925469264692746928469294693046931469324693346934469354693646937469384693946940469414694246943469444694546946469474694846949469504695146952469534695446955469564695746958469594696046961469624696346964469654696646967469684696946970469714697246973469744697546976469774697846979469804698146982469834698446985469864698746988469894699046991469924699346994469954699646997469984699947000470014700247003470044700547006470074700847009470104701147012470134701447015470164701747018470194702047021470224702347024470254702647027470284702947030470314703247033470344703547036470374703847039470404704147042470434704447045470464704747048470494705047051470524705347054470554705647057470584705947060470614706247063470644706547066470674706847069470704707147072470734707447075470764707747078470794708047081470824708347084470854708647087470884708947090470914709247093470944709547096470974709847099471004710147102471034710447105471064710747108471094711047111471124711347114471154711647117471184711947120471214712247123471244712547126471274712847129471304713147132471334713447135471364713747138471394714047141471424714347144471454714647147471484714947150471514715247153471544715547156471574715847159471604716147162471634716447165471664716747168471694717047171471724717347174471754717647177471784717947180471814718247183471844718547186471874718847189471904719147192471934719447195471964719747198471994720047201472024720347204472054720647207472084720947210472114721247213472144721547216472174721847219472204722147222472234722447225472264722747228472294723047231472324723347234472354723647237472384723947240472414724247243472444724547246472474724847249472504725147252472534725447255472564725747258472594726047261472624726347264472654726647267472684726947270472714727247273472744727547276472774727847279472804728147282472834728447285472864728747288472894729047291472924729347294472954729647297472984729947300473014730247303473044730547306473074730847309473104731147312473134731447315473164731747318473194732047321473224732347324473254732647327473284732947330473314733247333473344733547336473374733847339473404734147342473434734447345473464734747348473494735047351473524735347354473554735647357473584735947360473614736247363473644736547366473674736847369473704737147372473734737447375473764737747378473794738047381473824738347384473854738647387473884738947390473914739247393473944739547396473974739847399474004740147402474034740447405474064740747408474094741047411474124741347414474154741647417474184741947420474214742247423474244742547426474274742847429474304743147432474334743447435474364743747438474394744047441474424744347444474454744647447474484744947450474514745247453474544745547456474574745847459474604746147462474634746447465474664746747468474694747047471474724747347474474754747647477474784747947480474814748247483474844748547486474874748847489474904749147492474934749447495474964749747498474994750047501475024750347504475054750647507475084750947510475114751247513475144751547516475174751847519475204752147522475234752447525475264752747528475294753047531475324753347534475354753647537475384753947540475414754247543475444754547546475474754847549475504755147552475534755447555475564755747558475594756047561475624756347564475654756647567475684756947570475714757247573475744757547576475774757847579475804758147582475834758447585475864758747588475894759047591475924759347594475954759647597475984759947600476014760247603476044760547606476074760847609476104761147612476134761447615476164761747618476194762047621476224762347624476254762647627476284762947630476314763247633476344763547636476374763847639476404764147642476434764447645476464764747648476494765047651476524765347654476554765647657476584765947660476614766247663476644766547666476674766847669476704767147672476734767447675476764767747678476794768047681476824768347684476854768647687476884768947690476914769247693476944769547696476974769847699477004770147702477034770447705477064770747708477094771047711477124771347714477154771647717477184771947720477214772247723477244772547726477274772847729477304773147732477334773447735477364773747738477394774047741477424774347744477454774647747477484774947750477514775247753477544775547756477574775847759477604776147762477634776447765477664776747768477694777047771477724777347774477754777647777477784777947780477814778247783477844778547786477874778847789477904779147792477934779447795477964779747798477994780047801478024780347804478054780647807478084780947810478114781247813478144781547816478174781847819478204782147822478234782447825478264782747828478294783047831478324783347834478354783647837478384783947840478414784247843478444784547846478474784847849478504785147852478534785447855478564785747858478594786047861478624786347864478654786647867478684786947870478714787247873478744787547876478774787847879478804788147882478834788447885478864788747888478894789047891478924789347894478954789647897478984789947900479014790247903479044790547906479074790847909479104791147912479134791447915479164791747918479194792047921479224792347924479254792647927479284792947930479314793247933479344793547936479374793847939479404794147942479434794447945479464794747948479494795047951479524795347954479554795647957479584795947960479614796247963479644796547966479674796847969479704797147972479734797447975479764797747978479794798047981479824798347984479854798647987479884798947990479914799247993479944799547996479974799847999480004800148002480034800448005480064800748008480094801048011480124801348014480154801648017480184801948020480214802248023480244802548026480274802848029480304803148032480334803448035480364803748038480394804048041480424804348044480454804648047480484804948050480514805248053480544805548056480574805848059480604806148062480634806448065480664806748068480694807048071480724807348074480754807648077480784807948080480814808248083480844808548086480874808848089480904809148092480934809448095480964809748098480994810048101481024810348104481054810648107481084810948110481114811248113481144811548116481174811848119481204812148122481234812448125481264812748128481294813048131481324813348134481354813648137481384813948140481414814248143481444814548146481474814848149481504815148152481534815448155481564815748158481594816048161481624816348164481654816648167481684816948170481714817248173481744817548176481774817848179481804818148182481834818448185481864818748188481894819048191481924819348194481954819648197481984819948200482014820248203482044820548206482074820848209482104821148212482134821448215482164821748218482194822048221482224822348224482254822648227482284822948230482314823248233482344823548236482374823848239482404824148242482434824448245482464824748248482494825048251482524825348254482554825648257482584825948260482614826248263482644826548266482674826848269482704827148272482734827448275482764827748278482794828048281482824828348284482854828648287482884828948290482914829248293482944829548296482974829848299483004830148302483034830448305483064830748308483094831048311483124831348314483154831648317483184831948320483214832248323483244832548326483274832848329483304833148332483334833448335483364833748338483394834048341483424834348344483454834648347483484834948350483514835248353483544835548356483574835848359483604836148362483634836448365483664836748368483694837048371483724837348374483754837648377483784837948380483814838248383483844838548386483874838848389483904839148392483934839448395483964839748398483994840048401484024840348404484054840648407484084840948410484114841248413484144841548416484174841848419484204842148422484234842448425484264842748428484294843048431484324843348434484354843648437484384843948440484414844248443484444844548446484474844848449484504845148452484534845448455484564845748458484594846048461484624846348464484654846648467484684846948470484714847248473484744847548476484774847848479484804848148482484834848448485484864848748488484894849048491484924849348494484954849648497484984849948500485014850248503485044850548506485074850848509485104851148512485134851448515485164851748518485194852048521485224852348524485254852648527485284852948530485314853248533485344853548536485374853848539485404854148542485434854448545485464854748548485494855048551485524855348554485554855648557485584855948560485614856248563485644856548566485674856848569485704857148572485734857448575485764857748578485794858048581485824858348584485854858648587485884858948590485914859248593485944859548596485974859848599486004860148602486034860448605486064860748608486094861048611486124861348614486154861648617486184861948620486214862248623486244862548626486274862848629486304863148632486334863448635486364863748638486394864048641486424864348644486454864648647486484864948650486514865248653486544865548656486574865848659486604866148662486634866448665486664866748668486694867048671486724867348674486754867648677486784867948680486814868248683486844868548686486874868848689486904869148692486934869448695486964869748698486994870048701487024870348704487054870648707487084870948710487114871248713487144871548716487174871848719487204872148722487234872448725487264872748728487294873048731487324873348734487354873648737487384873948740487414874248743487444874548746487474874848749487504875148752487534875448755487564875748758487594876048761487624876348764487654876648767487684876948770487714877248773487744877548776487774877848779487804878148782487834878448785487864878748788487894879048791487924879348794487954879648797487984879948800488014880248803488044880548806488074880848809488104881148812488134881448815488164881748818488194882048821488224882348824488254882648827488284882948830488314883248833488344883548836488374883848839488404884148842488434884448845488464884748848488494885048851488524885348854488554885648857488584885948860488614886248863488644886548866488674886848869488704887148872488734887448875488764887748878488794888048881488824888348884488854888648887488884888948890488914889248893488944889548896488974889848899489004890148902489034890448905489064890748908489094891048911489124891348914489154891648917489184891948920489214892248923489244892548926489274892848929489304893148932489334893448935489364893748938489394894048941489424894348944489454894648947489484894948950489514895248953489544895548956489574895848959489604896148962489634896448965489664896748968489694897048971489724897348974489754897648977489784897948980489814898248983489844898548986489874898848989489904899148992489934899448995489964899748998489994900049001490024900349004490054900649007490084900949010490114901249013490144901549016490174901849019490204902149022490234902449025490264902749028490294903049031490324903349034490354903649037490384903949040490414904249043490444904549046490474904849049490504905149052490534905449055490564905749058490594906049061490624906349064490654906649067490684906949070490714907249073490744907549076490774907849079490804908149082490834908449085490864908749088490894909049091490924909349094490954909649097490984909949100491014910249103491044910549106491074910849109491104911149112491134911449115491164911749118491194912049121491224912349124491254912649127491284912949130491314913249133491344913549136491374913849139491404914149142491434914449145491464914749148491494915049151491524915349154491554915649157491584915949160491614916249163491644916549166491674916849169491704917149172491734917449175491764917749178491794918049181491824918349184491854918649187491884918949190491914919249193491944919549196491974919849199492004920149202492034920449205492064920749208492094921049211492124921349214492154921649217492184921949220492214922249223492244922549226492274922849229492304923149232492334923449235492364923749238492394924049241492424924349244492454924649247492484924949250492514925249253492544925549256492574925849259492604926149262492634926449265492664926749268492694927049271492724927349274492754927649277492784927949280492814928249283492844928549286492874928849289492904929149292492934929449295492964929749298492994930049301493024930349304493054930649307493084930949310493114931249313493144931549316493174931849319493204932149322493234932449325493264932749328493294933049331493324933349334493354933649337493384933949340493414934249343493444934549346493474934849349493504935149352493534935449355493564935749358493594936049361493624936349364493654936649367493684936949370493714937249373493744937549376493774937849379493804938149382493834938449385493864938749388493894939049391493924939349394493954939649397493984939949400494014940249403494044940549406494074940849409494104941149412494134941449415494164941749418494194942049421494224942349424494254942649427494284942949430494314943249433494344943549436494374943849439494404944149442494434944449445494464944749448494494945049451494524945349454494554945649457494584945949460494614946249463494644946549466494674946849469494704947149472494734947449475494764947749478494794948049481494824948349484494854948649487494884948949490494914949249493494944949549496494974949849499495004950149502495034950449505495064950749508495094951049511495124951349514495154951649517495184951949520495214952249523495244952549526495274952849529495304953149532495334953449535495364953749538495394954049541495424954349544495454954649547495484954949550495514955249553495544955549556495574955849559495604956149562495634956449565495664956749568495694957049571495724957349574495754957649577495784957949580495814958249583495844958549586495874958849589495904959149592495934959449595495964959749598495994960049601496024960349604496054960649607496084960949610496114961249613496144961549616496174961849619496204962149622496234962449625496264962749628496294963049631496324963349634496354963649637496384963949640496414964249643496444964549646496474964849649496504965149652496534965449655496564965749658496594966049661496624966349664496654966649667496684966949670496714967249673496744967549676496774967849679496804968149682496834968449685496864968749688496894969049691496924969349694496954969649697496984969949700497014970249703497044970549706497074970849709497104971149712497134971449715497164971749718497194972049721497224972349724497254972649727497284972949730497314973249733497344973549736497374973849739497404974149742497434974449745497464974749748497494975049751497524975349754497554975649757497584975949760497614976249763497644976549766497674976849769497704977149772497734977449775497764977749778497794978049781497824978349784497854978649787497884978949790497914979249793497944979549796497974979849799498004980149802498034980449805498064980749808498094981049811498124981349814498154981649817498184981949820498214982249823498244982549826498274982849829498304983149832498334983449835498364983749838498394984049841498424984349844498454984649847498484984949850498514985249853498544985549856498574985849859498604986149862498634986449865498664986749868498694987049871498724987349874498754987649877498784987949880498814988249883498844988549886498874988849889498904989149892498934989449895498964989749898498994990049901499024990349904499054990649907499084990949910499114991249913499144991549916499174991849919499204992149922499234992449925499264992749928499294993049931499324993349934499354993649937499384993949940499414994249943499444994549946499474994849949499504995149952499534995449955499564995749958499594996049961499624996349964499654996649967499684996949970499714997249973499744997549976499774997849979499804998149982499834998449985499864998749988499894999049991499924999349994499954999649997499984999950000500015000250003500045000550006500075000850009500105001150012500135001450015500165001750018500195002050021500225002350024500255002650027500285002950030500315003250033500345003550036500375003850039500405004150042500435004450045500465004750048500495005050051500525005350054500555005650057500585005950060500615006250063500645006550066500675006850069500705007150072500735007450075500765007750078500795008050081500825008350084500855008650087500885008950090500915009250093500945009550096500975009850099501005010150102501035010450105501065010750108501095011050111501125011350114501155011650117501185011950120501215012250123501245012550126501275012850129501305013150132501335013450135501365013750138501395014050141501425014350144501455014650147501485014950150501515015250153501545015550156501575015850159501605016150162501635016450165501665016750168501695017050171501725017350174501755017650177501785017950180501815018250183501845018550186501875018850189501905019150192501935019450195501965019750198501995020050201502025020350204502055020650207502085020950210502115021250213502145021550216502175021850219502205022150222502235022450225502265022750228502295023050231502325023350234502355023650237502385023950240502415024250243502445024550246502475024850249502505025150252502535025450255502565025750258502595026050261502625026350264502655026650267502685026950270502715027250273502745027550276502775027850279502805028150282502835028450285502865028750288502895029050291502925029350294502955029650297502985029950300503015030250303503045030550306503075030850309503105031150312503135031450315503165031750318503195032050321503225032350324503255032650327503285032950330503315033250333503345033550336503375033850339503405034150342503435034450345503465034750348503495035050351503525035350354503555035650357503585035950360503615036250363503645036550366503675036850369503705037150372503735037450375503765037750378503795038050381503825038350384503855038650387503885038950390503915039250393503945039550396503975039850399504005040150402504035040450405504065040750408504095041050411504125041350414504155041650417504185041950420504215042250423504245042550426504275042850429504305043150432504335043450435504365043750438504395044050441504425044350444504455044650447504485044950450504515045250453504545045550456504575045850459504605046150462504635046450465504665046750468504695047050471504725047350474504755047650477504785047950480504815048250483504845048550486504875048850489504905049150492504935049450495504965049750498504995050050501505025050350504505055050650507505085050950510505115051250513505145051550516505175051850519505205052150522505235052450525505265052750528505295053050531505325053350534505355053650537505385053950540505415054250543505445054550546505475054850549505505055150552505535055450555505565055750558505595056050561505625056350564505655056650567505685056950570505715057250573505745057550576505775057850579505805058150582505835058450585505865058750588505895059050591505925059350594505955059650597505985059950600506015060250603506045060550606506075060850609506105061150612506135061450615506165061750618506195062050621506225062350624506255062650627506285062950630506315063250633506345063550636506375063850639506405064150642506435064450645506465064750648506495065050651506525065350654506555065650657506585065950660506615066250663506645066550666506675066850669506705067150672506735067450675506765067750678506795068050681506825068350684506855068650687506885068950690506915069250693506945069550696506975069850699507005070150702507035070450705507065070750708507095071050711507125071350714507155071650717507185071950720507215072250723507245072550726507275072850729507305073150732507335073450735507365073750738507395074050741507425074350744507455074650747507485074950750507515075250753507545075550756507575075850759507605076150762507635076450765507665076750768507695077050771507725077350774507755077650777507785077950780507815078250783507845078550786507875078850789507905079150792507935079450795507965079750798507995080050801508025080350804508055080650807508085080950810508115081250813508145081550816508175081850819508205082150822508235082450825508265082750828508295083050831508325083350834508355083650837508385083950840508415084250843508445084550846508475084850849508505085150852508535085450855508565085750858508595086050861508625086350864508655086650867508685086950870508715087250873508745087550876508775087850879508805088150882508835088450885508865088750888508895089050891508925089350894508955089650897508985089950900509015090250903509045090550906509075090850909509105091150912509135091450915509165091750918509195092050921509225092350924509255092650927509285092950930509315093250933509345093550936509375093850939509405094150942509435094450945509465094750948509495095050951509525095350954509555095650957509585095950960509615096250963509645096550966509675096850969509705097150972509735097450975509765097750978509795098050981509825098350984509855098650987509885098950990509915099250993509945099550996509975099850999510005100151002510035100451005510065100751008510095101051011510125101351014510155101651017510185101951020510215102251023510245102551026510275102851029510305103151032510335103451035510365103751038510395104051041510425104351044510455104651047510485104951050510515105251053510545105551056510575105851059510605106151062510635106451065510665106751068510695107051071510725107351074510755107651077510785107951080510815108251083510845108551086510875108851089510905109151092510935109451095510965109751098510995110051101511025110351104511055110651107511085110951110511115111251113511145111551116511175111851119511205112151122511235112451125511265112751128511295113051131511325113351134511355113651137511385113951140511415114251143511445114551146511475114851149511505115151152511535115451155511565115751158511595116051161511625116351164511655116651167511685116951170511715117251173511745117551176511775117851179511805118151182511835118451185511865118751188511895119051191511925119351194511955119651197511985119951200512015120251203512045120551206512075120851209512105121151212512135121451215512165121751218512195122051221512225122351224512255122651227512285122951230512315123251233512345123551236512375123851239512405124151242512435124451245512465124751248512495125051251512525125351254512555125651257512585125951260512615126251263512645126551266512675126851269512705127151272512735127451275512765127751278512795128051281512825128351284512855128651287512885128951290512915129251293512945129551296512975129851299513005130151302513035130451305513065130751308513095131051311513125131351314513155131651317513185131951320513215132251323513245132551326513275132851329513305133151332513335133451335513365133751338513395134051341513425134351344513455134651347513485134951350513515135251353513545135551356513575135851359513605136151362513635136451365513665136751368513695137051371513725137351374513755137651377513785137951380513815138251383513845138551386513875138851389513905139151392513935139451395513965139751398513995140051401514025140351404514055140651407514085140951410514115141251413514145141551416514175141851419514205142151422514235142451425514265142751428514295143051431514325143351434514355143651437514385143951440514415144251443514445144551446514475144851449514505145151452514535145451455514565145751458514595146051461514625146351464514655146651467514685146951470514715147251473514745147551476514775147851479514805148151482514835148451485514865148751488514895149051491514925149351494514955149651497514985149951500515015150251503515045150551506515075150851509515105151151512515135151451515515165151751518515195152051521515225152351524515255152651527515285152951530515315153251533515345153551536515375153851539515405154151542515435154451545515465154751548515495155051551515525155351554515555155651557515585155951560515615156251563515645156551566515675156851569515705157151572515735157451575515765157751578515795158051581515825158351584515855158651587515885158951590515915159251593515945159551596515975159851599516005160151602516035160451605516065160751608516095161051611516125161351614516155161651617516185161951620516215162251623516245162551626516275162851629516305163151632516335163451635516365163751638516395164051641516425164351644516455164651647516485164951650516515165251653516545165551656516575165851659516605166151662516635166451665516665166751668516695167051671516725167351674516755167651677516785167951680516815168251683516845168551686516875168851689516905169151692516935169451695516965169751698516995170051701517025170351704517055170651707517085170951710517115171251713517145171551716517175171851719517205172151722517235172451725517265172751728517295173051731517325173351734517355173651737517385173951740517415174251743517445174551746517475174851749517505175151752517535175451755517565175751758517595176051761517625176351764517655176651767517685176951770517715177251773517745177551776517775177851779517805178151782517835178451785517865178751788517895179051791517925179351794517955179651797517985179951800518015180251803518045180551806518075180851809518105181151812518135181451815518165181751818518195182051821518225182351824518255182651827518285182951830518315183251833518345183551836518375183851839518405184151842518435184451845518465184751848518495185051851518525185351854518555185651857518585185951860518615186251863518645186551866518675186851869518705187151872518735187451875518765187751878518795188051881518825188351884518855188651887518885188951890518915189251893518945189551896518975189851899519005190151902519035190451905519065190751908519095191051911519125191351914519155191651917519185191951920519215192251923519245192551926519275192851929519305193151932519335193451935519365193751938519395194051941519425194351944519455194651947519485194951950519515195251953519545195551956519575195851959519605196151962519635196451965519665196751968519695197051971519725197351974519755197651977519785197951980519815198251983519845198551986519875198851989519905199151992519935199451995519965199751998519995200052001520025200352004520055200652007520085200952010520115201252013520145201552016520175201852019520205202152022520235202452025520265202752028520295203052031520325203352034520355203652037520385203952040520415204252043520445204552046520475204852049520505205152052520535205452055520565205752058520595206052061520625206352064520655206652067520685206952070520715207252073520745207552076520775207852079520805208152082520835208452085520865208752088520895209052091520925209352094520955209652097520985209952100521015210252103521045210552106521075210852109521105211152112521135211452115521165211752118521195212052121521225212352124521255212652127521285212952130521315213252133521345213552136521375213852139521405214152142521435214452145521465214752148521495215052151521525215352154521555215652157521585215952160521615216252163521645216552166521675216852169521705217152172521735217452175521765217752178521795218052181521825218352184521855218652187521885218952190521915219252193521945219552196521975219852199522005220152202522035220452205522065220752208522095221052211522125221352214522155221652217522185221952220522215222252223522245222552226522275222852229522305223152232522335223452235522365223752238522395224052241522425224352244522455224652247522485224952250522515225252253522545225552256522575225852259522605226152262522635226452265522665226752268522695227052271522725227352274522755227652277522785227952280522815228252283522845228552286522875228852289522905229152292522935229452295522965229752298522995230052301523025230352304523055230652307523085230952310523115231252313523145231552316523175231852319523205232152322523235232452325523265232752328523295233052331523325233352334523355233652337523385233952340523415234252343523445234552346523475234852349523505235152352523535235452355523565235752358523595236052361523625236352364523655236652367523685236952370523715237252373523745237552376523775237852379523805238152382523835238452385523865238752388523895239052391523925239352394523955239652397523985239952400524015240252403524045240552406524075240852409524105241152412524135241452415524165241752418524195242052421524225242352424524255242652427524285242952430524315243252433524345243552436524375243852439524405244152442524435244452445524465244752448524495245052451524525245352454524555245652457524585245952460524615246252463524645246552466524675246852469524705247152472524735247452475524765247752478524795248052481524825248352484524855248652487524885248952490524915249252493524945249552496524975249852499525005250152502525035250452505525065250752508525095251052511525125251352514525155251652517525185251952520525215252252523525245252552526525275252852529525305253152532525335253452535525365253752538525395254052541525425254352544525455254652547525485254952550525515255252553525545255552556525575255852559525605256152562525635256452565525665256752568525695257052571525725257352574525755257652577525785257952580525815258252583525845258552586525875258852589525905259152592525935259452595525965259752598525995260052601526025260352604526055260652607526085260952610526115261252613526145261552616526175261852619526205262152622526235262452625526265262752628526295263052631526325263352634526355263652637526385263952640526415264252643526445264552646526475264852649526505265152652526535265452655526565265752658526595266052661526625266352664526655266652667526685266952670526715267252673526745267552676526775267852679526805268152682526835268452685526865268752688526895269052691526925269352694526955269652697526985269952700527015270252703527045270552706527075270852709527105271152712527135271452715527165271752718527195272052721527225272352724527255272652727527285272952730527315273252733527345273552736527375273852739527405274152742527435274452745527465274752748527495275052751527525275352754527555275652757527585275952760527615276252763527645276552766527675276852769527705277152772527735277452775527765277752778527795278052781527825278352784527855278652787527885278952790527915279252793527945279552796527975279852799528005280152802528035280452805528065280752808528095281052811528125281352814528155281652817528185281952820528215282252823528245282552826528275282852829528305283152832528335283452835528365283752838528395284052841528425284352844528455284652847528485284952850528515285252853528545285552856528575285852859528605286152862528635286452865528665286752868528695287052871528725287352874528755287652877528785287952880528815288252883528845288552886528875288852889528905289152892528935289452895528965289752898528995290052901529025290352904529055290652907529085290952910529115291252913529145291552916529175291852919529205292152922529235292452925529265292752928529295293052931529325293352934529355293652937529385293952940529415294252943529445294552946529475294852949529505295152952529535295452955529565295752958529595296052961529625296352964529655296652967529685296952970529715297252973529745297552976529775297852979529805298152982529835298452985529865298752988529895299052991529925299352994529955299652997529985299953000530015300253003530045300553006530075300853009530105301153012530135301453015530165301753018530195302053021530225302353024530255302653027530285302953030530315303253033530345303553036530375303853039530405304153042530435304453045530465304753048530495305053051530525305353054530555305653057530585305953060530615306253063530645306553066530675306853069530705307153072530735307453075530765307753078530795308053081530825308353084530855308653087530885308953090530915309253093530945309553096530975309853099531005310153102531035310453105531065310753108531095311053111531125311353114531155311653117531185311953120531215312253123531245312553126531275312853129531305313153132531335313453135531365313753138531395314053141531425314353144531455314653147531485314953150531515315253153531545315553156531575315853159531605316153162531635316453165531665316753168531695317053171531725317353174531755317653177531785317953180531815318253183531845318553186531875318853189531905319153192531935319453195531965319753198531995320053201532025320353204532055320653207532085320953210532115321253213532145321553216532175321853219532205322153222532235322453225532265322753228532295323053231532325323353234532355323653237532385323953240532415324253243532445324553246532475324853249532505325153252532535325453255532565325753258532595326053261532625326353264532655326653267532685326953270532715327253273532745327553276532775327853279532805328153282532835328453285532865328753288532895329053291532925329353294532955329653297532985329953300533015330253303533045330553306533075330853309533105331153312533135331453315533165331753318533195332053321533225332353324533255332653327533285332953330533315333253333533345333553336533375333853339533405334153342533435334453345533465334753348533495335053351533525335353354533555335653357533585335953360533615336253363533645336553366533675336853369533705337153372533735337453375533765337753378533795338053381533825338353384533855338653387533885338953390533915339253393533945339553396533975339853399534005340153402534035340453405534065340753408534095341053411534125341353414534155341653417534185341953420534215342253423534245342553426534275342853429534305343153432534335343453435534365343753438534395344053441534425344353444534455344653447534485344953450534515345253453534545345553456534575345853459534605346153462534635346453465534665346753468534695347053471534725347353474534755347653477534785347953480534815348253483534845348553486534875348853489534905349153492534935349453495534965349753498534995350053501535025350353504535055350653507535085350953510535115351253513535145351553516535175351853519535205352153522535235352453525535265352753528535295353053531535325353353534535355353653537535385353953540535415354253543535445354553546535475354853549535505355153552535535355453555535565355753558535595356053561535625356353564535655356653567535685356953570535715357253573535745357553576535775357853579535805358153582535835358453585535865358753588535895359053591535925359353594535955359653597535985359953600536015360253603536045360553606536075360853609536105361153612536135361453615536165361753618536195362053621536225362353624536255362653627536285362953630536315363253633536345363553636536375363853639536405364153642536435364453645536465364753648536495365053651536525365353654536555365653657536585365953660536615366253663536645366553666536675366853669536705367153672536735367453675536765367753678536795368053681536825368353684536855368653687536885368953690536915369253693536945369553696536975369853699537005370153702537035370453705537065370753708537095371053711537125371353714537155371653717537185371953720537215372253723537245372553726537275372853729537305373153732537335373453735537365373753738537395374053741537425374353744537455374653747537485374953750537515375253753537545375553756537575375853759537605376153762537635376453765537665376753768537695377053771537725377353774537755377653777537785377953780537815378253783537845378553786537875378853789537905379153792537935379453795537965379753798537995380053801538025380353804538055380653807538085380953810538115381253813538145381553816538175381853819538205382153822538235382453825538265382753828538295383053831538325383353834538355383653837538385383953840538415384253843538445384553846538475384853849538505385153852538535385453855538565385753858538595386053861538625386353864538655386653867538685386953870538715387253873538745387553876538775387853879538805388153882538835388453885538865388753888538895389053891538925389353894538955389653897538985389953900539015390253903539045390553906539075390853909539105391153912539135391453915539165391753918539195392053921539225392353924539255392653927539285392953930539315393253933539345393553936539375393853939539405394153942539435394453945539465394753948539495395053951539525395353954539555395653957539585395953960539615396253963539645396553966539675396853969539705397153972539735397453975539765397753978539795398053981539825398353984539855398653987539885398953990539915399253993539945399553996539975399853999540005400154002540035400454005540065400754008540095401054011540125401354014540155401654017540185401954020540215402254023540245402554026540275402854029540305403154032540335403454035540365403754038540395404054041540425404354044540455404654047540485404954050540515405254053540545405554056540575405854059540605406154062540635406454065540665406754068540695407054071540725407354074540755407654077540785407954080540815408254083540845408554086540875408854089540905409154092540935409454095540965409754098540995410054101541025410354104541055410654107541085410954110541115411254113541145411554116541175411854119541205412154122541235412454125541265412754128541295413054131541325413354134541355413654137541385413954140541415414254143541445414554146541475414854149541505415154152541535415454155541565415754158541595416054161541625416354164541655416654167541685416954170541715417254173541745417554176541775417854179541805418154182541835418454185541865418754188541895419054191541925419354194541955419654197541985419954200542015420254203542045420554206542075420854209542105421154212542135421454215542165421754218542195422054221542225422354224542255422654227542285422954230542315423254233542345423554236542375423854239542405424154242542435424454245542465424754248542495425054251542525425354254542555425654257542585425954260542615426254263542645426554266542675426854269542705427154272542735427454275542765427754278542795428054281542825428354284542855428654287542885428954290542915429254293542945429554296542975429854299543005430154302543035430454305543065430754308543095431054311543125431354314543155431654317543185431954320543215432254323543245432554326543275432854329543305433154332543335433454335543365433754338543395434054341543425434354344543455434654347543485434954350543515435254353543545435554356543575435854359543605436154362543635436454365543665436754368543695437054371543725437354374543755437654377543785437954380543815438254383543845438554386543875438854389543905439154392543935439454395543965439754398543995440054401544025440354404544055440654407544085440954410544115441254413544145441554416544175441854419544205442154422544235442454425544265442754428544295443054431544325443354434544355443654437544385443954440544415444254443544445444554446544475444854449544505445154452544535445454455544565445754458544595446054461544625446354464544655446654467544685446954470544715447254473544745447554476544775447854479544805448154482544835448454485544865448754488544895449054491544925449354494544955449654497544985449954500545015450254503545045450554506545075450854509545105451154512545135451454515545165451754518545195452054521545225452354524545255452654527545285452954530545315453254533545345453554536545375453854539545405454154542545435454454545545465454754548545495455054551545525455354554545555455654557545585455954560545615456254563545645456554566545675456854569545705457154572545735457454575545765457754578545795458054581545825458354584545855458654587545885458954590545915459254593545945459554596545975459854599546005460154602546035460454605546065460754608546095461054611546125461354614546155461654617546185461954620546215462254623546245462554626546275462854629546305463154632546335463454635546365463754638546395464054641546425464354644546455464654647546485464954650546515465254653546545465554656546575465854659546605466154662546635466454665546665466754668546695467054671546725467354674546755467654677546785467954680546815468254683546845468554686546875468854689546905469154692546935469454695546965469754698546995470054701547025470354704547055470654707547085470954710547115471254713547145471554716547175471854719547205472154722547235472454725547265472754728547295473054731547325473354734547355473654737547385473954740547415474254743547445474554746547475474854749547505475154752547535475454755547565475754758547595476054761547625476354764547655476654767547685476954770547715477254773547745477554776547775477854779547805478154782547835478454785547865478754788547895479054791547925479354794547955479654797547985479954800548015480254803548045480554806548075480854809548105481154812548135481454815548165481754818548195482054821548225482354824548255482654827548285482954830548315483254833548345483554836548375483854839548405484154842548435484454845548465484754848548495485054851548525485354854548555485654857548585485954860548615486254863548645486554866548675486854869548705487154872548735487454875548765487754878548795488054881548825488354884548855488654887548885488954890548915489254893548945489554896548975489854899549005490154902549035490454905549065490754908549095491054911549125491354914549155491654917549185491954920549215492254923549245492554926549275492854929549305493154932549335493454935549365493754938549395494054941549425494354944549455494654947549485494954950549515495254953549545495554956549575495854959549605496154962549635496454965549665496754968549695497054971549725497354974549755497654977549785497954980549815498254983549845498554986549875498854989549905499154992549935499454995549965499754998549995500055001550025500355004550055500655007550085500955010550115501255013550145501555016550175501855019550205502155022550235502455025550265502755028550295503055031550325503355034550355503655037550385503955040550415504255043550445504555046550475504855049550505505155052550535505455055550565505755058550595506055061550625506355064550655506655067550685506955070550715507255073550745507555076550775507855079550805508155082550835508455085550865508755088550895509055091550925509355094550955509655097550985509955100551015510255103551045510555106551075510855109551105511155112551135511455115551165511755118551195512055121551225512355124551255512655127551285512955130551315513255133551345513555136551375513855139551405514155142551435514455145551465514755148551495515055151551525515355154551555515655157551585515955160551615516255163551645516555166551675516855169551705517155172551735517455175551765517755178551795518055181551825518355184551855518655187551885518955190551915519255193551945519555196551975519855199552005520155202552035520455205552065520755208552095521055211552125521355214552155521655217552185521955220552215522255223552245522555226552275522855229552305523155232552335523455235552365523755238552395524055241552425524355244552455524655247552485524955250552515525255253552545525555256552575525855259552605526155262552635526455265552665526755268552695527055271552725527355274552755527655277552785527955280552815528255283552845528555286552875528855289552905529155292552935529455295552965529755298552995530055301553025530355304553055530655307553085530955310553115531255313553145531555316553175531855319553205532155322553235532455325553265532755328553295533055331553325533355334553355533655337553385533955340553415534255343553445534555346553475534855349553505535155352553535535455355553565535755358553595536055361553625536355364553655536655367553685536955370553715537255373553745537555376553775537855379553805538155382553835538455385553865538755388553895539055391553925539355394553955539655397553985539955400554015540255403554045540555406554075540855409554105541155412554135541455415554165541755418554195542055421
  1. /**
  2. * @licstart The following is the entire license notice for the
  3. * Javascript code in this page
  4. *
  5. * Copyright 2020 Mozilla Foundation
  6. *
  7. * Licensed under the Apache License, Version 2.0 (the "License");
  8. * you may not use this file except in compliance with the License.
  9. * You may obtain a copy of the License at
  10. *
  11. * http://www.apache.org/licenses/LICENSE-2.0
  12. *
  13. * Unless required by applicable law or agreed to in writing, software
  14. * distributed under the License is distributed on an "AS IS" BASIS,
  15. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  16. * See the License for the specific language governing permissions and
  17. * limitations under the License.
  18. *
  19. * @licend The above is the entire license notice for the
  20. * Javascript code in this page
  21. */
  22. (function webpackUniversalModuleDefinition(root, factory) {
  23. if(typeof exports === 'object' && typeof module === 'object')
  24. module.exports = factory();
  25. else if(typeof define === 'function' && define.amd)
  26. define("pdfjs-dist/build/pdf.worker", [], factory);
  27. else if(typeof exports === 'object')
  28. exports["pdfjs-dist/build/pdf.worker"] = factory();
  29. else
  30. root["pdfjs-dist/build/pdf.worker"] = root.pdfjsWorker = factory();
  31. })(this, function() {
  32. return /******/ (() => { // webpackBootstrap
  33. /******/ "use strict";
  34. /******/ var __webpack_modules__ = ([
  35. /* 0 */
  36. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  37. Object.defineProperty(exports, "__esModule", ({
  38. value: true
  39. }));
  40. Object.defineProperty(exports, "WorkerMessageHandler", ({
  41. enumerable: true,
  42. get: function () {
  43. return _worker.WorkerMessageHandler;
  44. }
  45. }));
  46. var _worker = __w_pdfjs_require__(1);
  47. const pdfjsVersion = '2.7.570';
  48. const pdfjsBuild = 'f2c7338b0';
  49. /***/ }),
  50. /* 1 */
  51. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  52. Object.defineProperty(exports, "__esModule", ({
  53. value: true
  54. }));
  55. exports.WorkerTask = exports.WorkerMessageHandler = void 0;
  56. var _util = __w_pdfjs_require__(2);
  57. var _primitives = __w_pdfjs_require__(5);
  58. var _pdf_manager = __w_pdfjs_require__(6);
  59. var _writer = __w_pdfjs_require__(46);
  60. var _is_node = __w_pdfjs_require__(4);
  61. var _message_handler = __w_pdfjs_require__(48);
  62. var _worker_stream = __w_pdfjs_require__(49);
  63. var _core_utils = __w_pdfjs_require__(8);
  64. class WorkerTask {
  65. constructor(name) {
  66. this.name = name;
  67. this.terminated = false;
  68. this._capability = (0, _util.createPromiseCapability)();
  69. }
  70. get finished() {
  71. return this._capability.promise;
  72. }
  73. finish() {
  74. this._capability.resolve();
  75. }
  76. terminate() {
  77. this.terminated = true;
  78. }
  79. ensureNotTerminated() {
  80. if (this.terminated) {
  81. throw new Error("Worker task was terminated");
  82. }
  83. }
  84. }
  85. exports.WorkerTask = WorkerTask;
  86. class WorkerMessageHandler {
  87. static setup(handler, port) {
  88. var testMessageProcessed = false;
  89. handler.on("test", function wphSetupTest(data) {
  90. if (testMessageProcessed) {
  91. return;
  92. }
  93. testMessageProcessed = true;
  94. if (!(data instanceof Uint8Array)) {
  95. handler.send("test", null);
  96. return;
  97. }
  98. const supportTransfers = data[0] === 255;
  99. handler.postMessageTransfers = supportTransfers;
  100. handler.send("test", {
  101. supportTransfers
  102. });
  103. });
  104. handler.on("configure", function wphConfigure(data) {
  105. (0, _util.setVerbosityLevel)(data.verbosity);
  106. });
  107. handler.on("GetDocRequest", function wphSetupDoc(data) {
  108. return WorkerMessageHandler.createDocumentHandler(data, port);
  109. });
  110. }
  111. static createDocumentHandler(docParams, port) {
  112. var pdfManager;
  113. var terminated = false;
  114. var cancelXHRs = null;
  115. var WorkerTasks = [];
  116. const verbosity = (0, _util.getVerbosityLevel)();
  117. const apiVersion = docParams.apiVersion;
  118. const workerVersion = '2.7.570';
  119. if (apiVersion !== workerVersion) {
  120. throw new Error(`The API version "${apiVersion}" does not match ` + `the Worker version "${workerVersion}".`);
  121. }
  122. const enumerableProperties = [];
  123. for (const property in []) {
  124. enumerableProperties.push(property);
  125. }
  126. if (enumerableProperties.length) {
  127. throw new Error("The `Array.prototype` contains unexpected enumerable properties: " + enumerableProperties.join(", ") + "; thus breaking e.g. `for...in` iteration of `Array`s.");
  128. }
  129. if (typeof ReadableStream === "undefined") {
  130. throw new Error("The browser/environment lacks native support for critical " + "functionality used by the PDF.js library (e.g. `ReadableStream`); " + "please use an `es5`-build instead.");
  131. }
  132. var docId = docParams.docId;
  133. var docBaseUrl = docParams.docBaseUrl;
  134. var workerHandlerName = docParams.docId + "_worker";
  135. var handler = new _message_handler.MessageHandler(workerHandlerName, docId, port);
  136. handler.postMessageTransfers = docParams.postMessageTransfers;
  137. function ensureNotTerminated() {
  138. if (terminated) {
  139. throw new Error("Worker was terminated");
  140. }
  141. }
  142. function startWorkerTask(task) {
  143. WorkerTasks.push(task);
  144. }
  145. function finishWorkerTask(task) {
  146. task.finish();
  147. var i = WorkerTasks.indexOf(task);
  148. WorkerTasks.splice(i, 1);
  149. }
  150. async function loadDocument(recoveryMode) {
  151. await pdfManager.ensureDoc("checkHeader");
  152. await pdfManager.ensureDoc("parseStartXRef");
  153. await pdfManager.ensureDoc("parse", [recoveryMode]);
  154. if (!recoveryMode) {
  155. await pdfManager.ensureDoc("checkFirstPage");
  156. }
  157. const [numPages, fingerprint] = await Promise.all([pdfManager.ensureDoc("numPages"), pdfManager.ensureDoc("fingerprint")]);
  158. return {
  159. numPages,
  160. fingerprint
  161. };
  162. }
  163. function getPdfManager(data, evaluatorOptions) {
  164. var pdfManagerCapability = (0, _util.createPromiseCapability)();
  165. let newPdfManager;
  166. var source = data.source;
  167. if (source.data) {
  168. try {
  169. newPdfManager = new _pdf_manager.LocalPdfManager(docId, source.data, source.password, evaluatorOptions, docBaseUrl);
  170. pdfManagerCapability.resolve(newPdfManager);
  171. } catch (ex) {
  172. pdfManagerCapability.reject(ex);
  173. }
  174. return pdfManagerCapability.promise;
  175. }
  176. var pdfStream,
  177. cachedChunks = [];
  178. try {
  179. pdfStream = new _worker_stream.PDFWorkerStream(handler);
  180. } catch (ex) {
  181. pdfManagerCapability.reject(ex);
  182. return pdfManagerCapability.promise;
  183. }
  184. var fullRequest = pdfStream.getFullReader();
  185. fullRequest.headersReady.then(function () {
  186. if (!fullRequest.isRangeSupported) {
  187. return;
  188. }
  189. var disableAutoFetch = source.disableAutoFetch || fullRequest.isStreamingSupported;
  190. newPdfManager = new _pdf_manager.NetworkPdfManager(docId, pdfStream, {
  191. msgHandler: handler,
  192. password: source.password,
  193. length: fullRequest.contentLength,
  194. disableAutoFetch,
  195. rangeChunkSize: source.rangeChunkSize
  196. }, evaluatorOptions, docBaseUrl);
  197. for (let i = 0; i < cachedChunks.length; i++) {
  198. newPdfManager.sendProgressiveData(cachedChunks[i]);
  199. }
  200. cachedChunks = [];
  201. pdfManagerCapability.resolve(newPdfManager);
  202. cancelXHRs = null;
  203. }).catch(function (reason) {
  204. pdfManagerCapability.reject(reason);
  205. cancelXHRs = null;
  206. });
  207. var loaded = 0;
  208. var flushChunks = function () {
  209. var pdfFile = (0, _util.arraysToBytes)(cachedChunks);
  210. if (source.length && pdfFile.length !== source.length) {
  211. (0, _util.warn)("reported HTTP length is different from actual");
  212. }
  213. try {
  214. newPdfManager = new _pdf_manager.LocalPdfManager(docId, pdfFile, source.password, evaluatorOptions, docBaseUrl);
  215. pdfManagerCapability.resolve(newPdfManager);
  216. } catch (ex) {
  217. pdfManagerCapability.reject(ex);
  218. }
  219. cachedChunks = [];
  220. };
  221. var readPromise = new Promise(function (resolve, reject) {
  222. var readChunk = function ({
  223. value,
  224. done
  225. }) {
  226. try {
  227. ensureNotTerminated();
  228. if (done) {
  229. if (!newPdfManager) {
  230. flushChunks();
  231. }
  232. cancelXHRs = null;
  233. return;
  234. }
  235. loaded += (0, _util.arrayByteLength)(value);
  236. if (!fullRequest.isStreamingSupported) {
  237. handler.send("DocProgress", {
  238. loaded,
  239. total: Math.max(loaded, fullRequest.contentLength || 0)
  240. });
  241. }
  242. if (newPdfManager) {
  243. newPdfManager.sendProgressiveData(value);
  244. } else {
  245. cachedChunks.push(value);
  246. }
  247. fullRequest.read().then(readChunk, reject);
  248. } catch (e) {
  249. reject(e);
  250. }
  251. };
  252. fullRequest.read().then(readChunk, reject);
  253. });
  254. readPromise.catch(function (e) {
  255. pdfManagerCapability.reject(e);
  256. cancelXHRs = null;
  257. });
  258. cancelXHRs = function (reason) {
  259. pdfStream.cancelAllRequests(reason);
  260. };
  261. return pdfManagerCapability.promise;
  262. }
  263. function setupDoc(data) {
  264. function onSuccess(doc) {
  265. ensureNotTerminated();
  266. handler.send("GetDoc", {
  267. pdfInfo: doc
  268. });
  269. }
  270. function onFailure(ex) {
  271. ensureNotTerminated();
  272. if (ex instanceof _util.PasswordException) {
  273. var task = new WorkerTask(`PasswordException: response ${ex.code}`);
  274. startWorkerTask(task);
  275. handler.sendWithPromise("PasswordRequest", ex).then(function ({
  276. password
  277. }) {
  278. finishWorkerTask(task);
  279. pdfManager.updatePassword(password);
  280. pdfManagerReady();
  281. }).catch(function () {
  282. finishWorkerTask(task);
  283. handler.send("DocException", ex);
  284. });
  285. } else if (ex instanceof _util.InvalidPDFException || ex instanceof _util.MissingPDFException || ex instanceof _util.UnexpectedResponseException || ex instanceof _util.UnknownErrorException) {
  286. handler.send("DocException", ex);
  287. } else {
  288. handler.send("DocException", new _util.UnknownErrorException(ex.message, ex.toString()));
  289. }
  290. }
  291. function pdfManagerReady() {
  292. ensureNotTerminated();
  293. loadDocument(false).then(onSuccess, function (reason) {
  294. ensureNotTerminated();
  295. if (!(reason instanceof _core_utils.XRefParseException)) {
  296. onFailure(reason);
  297. return;
  298. }
  299. pdfManager.requestLoadedStream();
  300. pdfManager.onLoadedStream().then(function () {
  301. ensureNotTerminated();
  302. loadDocument(true).then(onSuccess, onFailure);
  303. });
  304. });
  305. }
  306. ensureNotTerminated();
  307. var evaluatorOptions = {
  308. maxImageSize: data.maxImageSize,
  309. disableFontFace: data.disableFontFace,
  310. ignoreErrors: data.ignoreErrors,
  311. isEvalSupported: data.isEvalSupported,
  312. fontExtraProperties: data.fontExtraProperties
  313. };
  314. getPdfManager(data, evaluatorOptions).then(function (newPdfManager) {
  315. if (terminated) {
  316. newPdfManager.terminate(new _util.AbortException("Worker was terminated."));
  317. throw new Error("Worker was terminated");
  318. }
  319. pdfManager = newPdfManager;
  320. pdfManager.onLoadedStream().then(function (stream) {
  321. handler.send("DataLoaded", {
  322. length: stream.bytes.byteLength
  323. });
  324. });
  325. }).then(pdfManagerReady, onFailure);
  326. }
  327. handler.on("GetPage", function wphSetupGetPage(data) {
  328. return pdfManager.getPage(data.pageIndex).then(function (page) {
  329. return Promise.all([pdfManager.ensure(page, "rotate"), pdfManager.ensure(page, "ref"), pdfManager.ensure(page, "userUnit"), pdfManager.ensure(page, "view")]).then(function ([rotate, ref, userUnit, view]) {
  330. return {
  331. rotate,
  332. ref,
  333. userUnit,
  334. view
  335. };
  336. });
  337. });
  338. });
  339. handler.on("GetPageIndex", function wphSetupGetPageIndex({
  340. ref
  341. }) {
  342. const pageRef = _primitives.Ref.get(ref.num, ref.gen);
  343. return pdfManager.ensureCatalog("getPageIndex", [pageRef]);
  344. });
  345. handler.on("GetDestinations", function wphSetupGetDestinations(data) {
  346. return pdfManager.ensureCatalog("destinations");
  347. });
  348. handler.on("GetDestination", function wphSetupGetDestination(data) {
  349. return pdfManager.ensureCatalog("getDestination", [data.id]);
  350. });
  351. handler.on("GetPageLabels", function wphSetupGetPageLabels(data) {
  352. return pdfManager.ensureCatalog("pageLabels");
  353. });
  354. handler.on("GetPageLayout", function wphSetupGetPageLayout(data) {
  355. return pdfManager.ensureCatalog("pageLayout");
  356. });
  357. handler.on("GetPageMode", function wphSetupGetPageMode(data) {
  358. return pdfManager.ensureCatalog("pageMode");
  359. });
  360. handler.on("GetViewerPreferences", function (data) {
  361. return pdfManager.ensureCatalog("viewerPreferences");
  362. });
  363. handler.on("GetOpenAction", function (data) {
  364. return pdfManager.ensureCatalog("openAction");
  365. });
  366. handler.on("GetAttachments", function wphSetupGetAttachments(data) {
  367. return pdfManager.ensureCatalog("attachments");
  368. });
  369. handler.on("GetJavaScript", function wphSetupGetJavaScript(data) {
  370. return pdfManager.ensureCatalog("javaScript");
  371. });
  372. handler.on("GetDocJSActions", function wphSetupGetDocJSActions(data) {
  373. return pdfManager.ensureCatalog("jsActions");
  374. });
  375. handler.on("GetPageJSActions", function ({
  376. pageIndex
  377. }) {
  378. return pdfManager.getPage(pageIndex).then(function (page) {
  379. return page.jsActions;
  380. });
  381. });
  382. handler.on("GetOutline", function wphSetupGetOutline(data) {
  383. return pdfManager.ensureCatalog("documentOutline");
  384. });
  385. handler.on("GetOptionalContentConfig", function (data) {
  386. return pdfManager.ensureCatalog("optionalContentConfig");
  387. });
  388. handler.on("GetPermissions", function (data) {
  389. return pdfManager.ensureCatalog("permissions");
  390. });
  391. handler.on("GetMetadata", function wphSetupGetMetadata(data) {
  392. return Promise.all([pdfManager.ensureDoc("documentInfo"), pdfManager.ensureCatalog("metadata")]);
  393. });
  394. handler.on("GetMarkInfo", function wphSetupGetMarkInfo(data) {
  395. return pdfManager.ensureCatalog("markInfo");
  396. });
  397. handler.on("GetData", function wphSetupGetData(data) {
  398. pdfManager.requestLoadedStream();
  399. return pdfManager.onLoadedStream().then(function (stream) {
  400. return stream.bytes;
  401. });
  402. });
  403. handler.on("GetStats", function wphSetupGetStats(data) {
  404. return pdfManager.ensureXRef("stats");
  405. });
  406. handler.on("GetAnnotations", function ({
  407. pageIndex,
  408. intent
  409. }) {
  410. return pdfManager.getPage(pageIndex).then(function (page) {
  411. return page.getAnnotationsData(intent);
  412. });
  413. });
  414. handler.on("GetFieldObjects", function (data) {
  415. return pdfManager.ensureDoc("fieldObjects");
  416. });
  417. handler.on("HasJSActions", function (data) {
  418. return pdfManager.ensureDoc("hasJSActions");
  419. });
  420. handler.on("GetCalculationOrderIds", function (data) {
  421. return pdfManager.ensureDoc("calculationOrderIds");
  422. });
  423. handler.on("SaveDocument", function ({
  424. numPages,
  425. annotationStorage,
  426. filename
  427. }) {
  428. pdfManager.requestLoadedStream();
  429. const promises = [pdfManager.onLoadedStream(), pdfManager.ensureCatalog("acroForm"), pdfManager.ensureDoc("xref"), pdfManager.ensureDoc("startXRef")];
  430. for (let pageIndex = 0; pageIndex < numPages; pageIndex++) {
  431. promises.push(pdfManager.getPage(pageIndex).then(function (page) {
  432. const task = new WorkerTask(`Save: page ${pageIndex}`);
  433. startWorkerTask(task);
  434. return page.save(handler, task, annotationStorage).finally(function () {
  435. finishWorkerTask(task);
  436. });
  437. }));
  438. }
  439. return Promise.all(promises).then(function ([stream, acroForm, xref, startXRef, ...refs]) {
  440. let newRefs = [];
  441. for (const ref of refs) {
  442. newRefs = ref.filter(x => x !== null).reduce((a, b) => a.concat(b), newRefs);
  443. }
  444. if (newRefs.length === 0) {
  445. return stream.bytes;
  446. }
  447. const xfa = acroForm instanceof _primitives.Dict && acroForm.get("XFA") || [];
  448. let xfaDatasets = null;
  449. if (Array.isArray(xfa)) {
  450. for (let i = 0, ii = xfa.length; i < ii; i += 2) {
  451. if (xfa[i] === "datasets") {
  452. xfaDatasets = xfa[i + 1];
  453. }
  454. }
  455. } else {
  456. (0, _util.warn)("Unsupported XFA type.");
  457. }
  458. let newXrefInfo = Object.create(null);
  459. if (xref.trailer) {
  460. const infoObj = Object.create(null);
  461. const xrefInfo = xref.trailer.get("Info") || null;
  462. if (xrefInfo instanceof _primitives.Dict) {
  463. xrefInfo.forEach((key, value) => {
  464. if ((0, _util.isString)(key) && (0, _util.isString)(value)) {
  465. infoObj[key] = (0, _util.stringToPDFString)(value);
  466. }
  467. });
  468. }
  469. newXrefInfo = {
  470. rootRef: xref.trailer.getRaw("Root") || null,
  471. encrypt: xref.trailer.getRaw("Encrypt") || null,
  472. newRef: xref.getNewRef(),
  473. infoRef: xref.trailer.getRaw("Info") || null,
  474. info: infoObj,
  475. fileIds: xref.trailer.getRaw("ID") || null,
  476. startXRef,
  477. filename
  478. };
  479. }
  480. xref.resetNewRef();
  481. return (0, _writer.incrementalUpdate)({
  482. originalData: stream.bytes,
  483. xrefInfo: newXrefInfo,
  484. newRefs,
  485. xref,
  486. datasetsRef: xfaDatasets
  487. });
  488. });
  489. });
  490. handler.on("GetOperatorList", function wphSetupRenderPage(data, sink) {
  491. var pageIndex = data.pageIndex;
  492. pdfManager.getPage(pageIndex).then(function (page) {
  493. var task = new WorkerTask(`GetOperatorList: page ${pageIndex}`);
  494. startWorkerTask(task);
  495. const start = verbosity >= _util.VerbosityLevel.INFOS ? Date.now() : 0;
  496. page.getOperatorList({
  497. handler,
  498. sink,
  499. task,
  500. intent: data.intent,
  501. renderInteractiveForms: data.renderInteractiveForms,
  502. annotationStorage: data.annotationStorage
  503. }).then(function (operatorListInfo) {
  504. finishWorkerTask(task);
  505. if (start) {
  506. (0, _util.info)(`page=${pageIndex + 1} - getOperatorList: time=` + `${Date.now() - start}ms, len=${operatorListInfo.length}`);
  507. }
  508. sink.close();
  509. }, function (reason) {
  510. finishWorkerTask(task);
  511. if (task.terminated) {
  512. return;
  513. }
  514. handler.send("UnsupportedFeature", {
  515. featureId: _util.UNSUPPORTED_FEATURES.errorOperatorList
  516. });
  517. sink.error(reason);
  518. });
  519. });
  520. });
  521. handler.on("GetTextContent", function wphExtractText(data, sink) {
  522. var pageIndex = data.pageIndex;
  523. sink.onPull = function (desiredSize) {};
  524. sink.onCancel = function (reason) {};
  525. pdfManager.getPage(pageIndex).then(function (page) {
  526. var task = new WorkerTask("GetTextContent: page " + pageIndex);
  527. startWorkerTask(task);
  528. const start = verbosity >= _util.VerbosityLevel.INFOS ? Date.now() : 0;
  529. page.extractTextContent({
  530. handler,
  531. task,
  532. sink,
  533. normalizeWhitespace: data.normalizeWhitespace,
  534. combineTextItems: data.combineTextItems
  535. }).then(function () {
  536. finishWorkerTask(task);
  537. if (start) {
  538. (0, _util.info)(`page=${pageIndex + 1} - getTextContent: time=` + `${Date.now() - start}ms`);
  539. }
  540. sink.close();
  541. }, function (reason) {
  542. finishWorkerTask(task);
  543. if (task.terminated) {
  544. return;
  545. }
  546. sink.error(reason);
  547. });
  548. });
  549. });
  550. handler.on("FontFallback", function (data) {
  551. return pdfManager.fontFallback(data.id, handler);
  552. });
  553. handler.on("Cleanup", function wphCleanup(data) {
  554. return pdfManager.cleanup(true);
  555. });
  556. handler.on("Terminate", function wphTerminate(data) {
  557. terminated = true;
  558. const waitOn = [];
  559. if (pdfManager) {
  560. pdfManager.terminate(new _util.AbortException("Worker was terminated."));
  561. const cleanupPromise = pdfManager.cleanup();
  562. waitOn.push(cleanupPromise);
  563. pdfManager = null;
  564. } else {
  565. (0, _primitives.clearPrimitiveCaches)();
  566. }
  567. if (cancelXHRs) {
  568. cancelXHRs(new _util.AbortException("Worker was terminated."));
  569. }
  570. WorkerTasks.forEach(function (task) {
  571. waitOn.push(task.finished);
  572. task.terminate();
  573. });
  574. return Promise.all(waitOn).then(function () {
  575. handler.destroy();
  576. handler = null;
  577. });
  578. });
  579. handler.on("Ready", function wphReady(data) {
  580. setupDoc(docParams);
  581. docParams = null;
  582. });
  583. return workerHandlerName;
  584. }
  585. static initializeFromPort(port) {
  586. var handler = new _message_handler.MessageHandler("worker", "main", port);
  587. WorkerMessageHandler.setup(handler, port);
  588. handler.send("ready", null);
  589. }
  590. }
  591. exports.WorkerMessageHandler = WorkerMessageHandler;
  592. function isMessagePort(maybePort) {
  593. return typeof maybePort.postMessage === "function" && "onmessage" in maybePort;
  594. }
  595. if (typeof window === "undefined" && !_is_node.isNodeJS && typeof self !== "undefined" && isMessagePort(self)) {
  596. WorkerMessageHandler.initializeFromPort(self);
  597. }
  598. /***/ }),
  599. /* 2 */
  600. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  601. Object.defineProperty(exports, "__esModule", ({
  602. value: true
  603. }));
  604. exports.arrayByteLength = arrayByteLength;
  605. exports.arraysToBytes = arraysToBytes;
  606. exports.assert = assert;
  607. exports.bytesToString = bytesToString;
  608. exports.createPromiseCapability = createPromiseCapability;
  609. exports.createValidAbsoluteUrl = createValidAbsoluteUrl;
  610. exports.encodeToXmlString = encodeToXmlString;
  611. exports.escapeString = escapeString;
  612. exports.getModificationDate = getModificationDate;
  613. exports.getVerbosityLevel = getVerbosityLevel;
  614. exports.info = info;
  615. exports.isArrayBuffer = isArrayBuffer;
  616. exports.isArrayEqual = isArrayEqual;
  617. exports.isAscii = isAscii;
  618. exports.isBool = isBool;
  619. exports.isNum = isNum;
  620. exports.isSameOrigin = isSameOrigin;
  621. exports.isString = isString;
  622. exports.objectFromEntries = objectFromEntries;
  623. exports.objectSize = objectSize;
  624. exports.removeNullCharacters = removeNullCharacters;
  625. exports.setVerbosityLevel = setVerbosityLevel;
  626. exports.shadow = shadow;
  627. exports.string32 = string32;
  628. exports.stringToBytes = stringToBytes;
  629. exports.stringToPDFString = stringToPDFString;
  630. exports.stringToUTF16BEString = stringToUTF16BEString;
  631. exports.stringToUTF8String = stringToUTF8String;
  632. exports.unreachable = unreachable;
  633. exports.utf8StringToString = utf8StringToString;
  634. exports.warn = warn;
  635. exports.VerbosityLevel = exports.Util = exports.UNSUPPORTED_FEATURES = exports.UnknownErrorException = exports.UnexpectedResponseException = exports.TextRenderingMode = exports.StreamType = exports.PermissionFlag = exports.PasswordResponses = exports.PasswordException = exports.PageActionEventType = exports.OPS = exports.MissingPDFException = exports.IsLittleEndianCached = exports.IsEvalSupportedCached = exports.InvalidPDFException = exports.ImageKind = exports.IDENTITY_MATRIX = exports.FormatError = exports.FontType = exports.FONT_IDENTITY_MATRIX = exports.DocumentActionEventType = exports.createObjectURL = exports.CMapCompressionType = exports.BaseException = exports.AnnotationType = exports.AnnotationStateModelType = exports.AnnotationReviewState = exports.AnnotationReplyType = exports.AnnotationMarkedState = exports.AnnotationFlag = exports.AnnotationFieldFlag = exports.AnnotationBorderStyleType = exports.AnnotationActionEventType = exports.AbortException = void 0;
  636. __w_pdfjs_require__(3);
  637. const IDENTITY_MATRIX = [1, 0, 0, 1, 0, 0];
  638. exports.IDENTITY_MATRIX = IDENTITY_MATRIX;
  639. const FONT_IDENTITY_MATRIX = [0.001, 0, 0, 0.001, 0, 0];
  640. exports.FONT_IDENTITY_MATRIX = FONT_IDENTITY_MATRIX;
  641. const PermissionFlag = {
  642. PRINT: 0x04,
  643. MODIFY_CONTENTS: 0x08,
  644. COPY: 0x10,
  645. MODIFY_ANNOTATIONS: 0x20,
  646. FILL_INTERACTIVE_FORMS: 0x100,
  647. COPY_FOR_ACCESSIBILITY: 0x200,
  648. ASSEMBLE: 0x400,
  649. PRINT_HIGH_QUALITY: 0x800
  650. };
  651. exports.PermissionFlag = PermissionFlag;
  652. const TextRenderingMode = {
  653. FILL: 0,
  654. STROKE: 1,
  655. FILL_STROKE: 2,
  656. INVISIBLE: 3,
  657. FILL_ADD_TO_PATH: 4,
  658. STROKE_ADD_TO_PATH: 5,
  659. FILL_STROKE_ADD_TO_PATH: 6,
  660. ADD_TO_PATH: 7,
  661. FILL_STROKE_MASK: 3,
  662. ADD_TO_PATH_FLAG: 4
  663. };
  664. exports.TextRenderingMode = TextRenderingMode;
  665. const ImageKind = {
  666. GRAYSCALE_1BPP: 1,
  667. RGB_24BPP: 2,
  668. RGBA_32BPP: 3
  669. };
  670. exports.ImageKind = ImageKind;
  671. const AnnotationType = {
  672. TEXT: 1,
  673. LINK: 2,
  674. FREETEXT: 3,
  675. LINE: 4,
  676. SQUARE: 5,
  677. CIRCLE: 6,
  678. POLYGON: 7,
  679. POLYLINE: 8,
  680. HIGHLIGHT: 9,
  681. UNDERLINE: 10,
  682. SQUIGGLY: 11,
  683. STRIKEOUT: 12,
  684. STAMP: 13,
  685. CARET: 14,
  686. INK: 15,
  687. POPUP: 16,
  688. FILEATTACHMENT: 17,
  689. SOUND: 18,
  690. MOVIE: 19,
  691. WIDGET: 20,
  692. SCREEN: 21,
  693. PRINTERMARK: 22,
  694. TRAPNET: 23,
  695. WATERMARK: 24,
  696. THREED: 25,
  697. REDACT: 26
  698. };
  699. exports.AnnotationType = AnnotationType;
  700. const AnnotationStateModelType = {
  701. MARKED: "Marked",
  702. REVIEW: "Review"
  703. };
  704. exports.AnnotationStateModelType = AnnotationStateModelType;
  705. const AnnotationMarkedState = {
  706. MARKED: "Marked",
  707. UNMARKED: "Unmarked"
  708. };
  709. exports.AnnotationMarkedState = AnnotationMarkedState;
  710. const AnnotationReviewState = {
  711. ACCEPTED: "Accepted",
  712. REJECTED: "Rejected",
  713. CANCELLED: "Cancelled",
  714. COMPLETED: "Completed",
  715. NONE: "None"
  716. };
  717. exports.AnnotationReviewState = AnnotationReviewState;
  718. const AnnotationReplyType = {
  719. GROUP: "Group",
  720. REPLY: "R"
  721. };
  722. exports.AnnotationReplyType = AnnotationReplyType;
  723. const AnnotationFlag = {
  724. INVISIBLE: 0x01,
  725. HIDDEN: 0x02,
  726. PRINT: 0x04,
  727. NOZOOM: 0x08,
  728. NOROTATE: 0x10,
  729. NOVIEW: 0x20,
  730. READONLY: 0x40,
  731. LOCKED: 0x80,
  732. TOGGLENOVIEW: 0x100,
  733. LOCKEDCONTENTS: 0x200
  734. };
  735. exports.AnnotationFlag = AnnotationFlag;
  736. const AnnotationFieldFlag = {
  737. READONLY: 0x0000001,
  738. REQUIRED: 0x0000002,
  739. NOEXPORT: 0x0000004,
  740. MULTILINE: 0x0001000,
  741. PASSWORD: 0x0002000,
  742. NOTOGGLETOOFF: 0x0004000,
  743. RADIO: 0x0008000,
  744. PUSHBUTTON: 0x0010000,
  745. COMBO: 0x0020000,
  746. EDIT: 0x0040000,
  747. SORT: 0x0080000,
  748. FILESELECT: 0x0100000,
  749. MULTISELECT: 0x0200000,
  750. DONOTSPELLCHECK: 0x0400000,
  751. DONOTSCROLL: 0x0800000,
  752. COMB: 0x1000000,
  753. RICHTEXT: 0x2000000,
  754. RADIOSINUNISON: 0x2000000,
  755. COMMITONSELCHANGE: 0x4000000
  756. };
  757. exports.AnnotationFieldFlag = AnnotationFieldFlag;
  758. const AnnotationBorderStyleType = {
  759. SOLID: 1,
  760. DASHED: 2,
  761. BEVELED: 3,
  762. INSET: 4,
  763. UNDERLINE: 5
  764. };
  765. exports.AnnotationBorderStyleType = AnnotationBorderStyleType;
  766. const AnnotationActionEventType = {
  767. E: "Mouse Enter",
  768. X: "Mouse Exit",
  769. D: "Mouse Down",
  770. U: "Mouse Up",
  771. Fo: "Focus",
  772. Bl: "Blur",
  773. PO: "PageOpen",
  774. PC: "PageClose",
  775. PV: "PageVisible",
  776. PI: "PageInvisible",
  777. K: "Keystroke",
  778. F: "Format",
  779. V: "Validate",
  780. C: "Calculate"
  781. };
  782. exports.AnnotationActionEventType = AnnotationActionEventType;
  783. const DocumentActionEventType = {
  784. WC: "WillClose",
  785. WS: "WillSave",
  786. DS: "DidSave",
  787. WP: "WillPrint",
  788. DP: "DidPrint"
  789. };
  790. exports.DocumentActionEventType = DocumentActionEventType;
  791. const PageActionEventType = {
  792. O: "PageOpen",
  793. C: "PageClose"
  794. };
  795. exports.PageActionEventType = PageActionEventType;
  796. const StreamType = {
  797. UNKNOWN: "UNKNOWN",
  798. FLATE: "FLATE",
  799. LZW: "LZW",
  800. DCT: "DCT",
  801. JPX: "JPX",
  802. JBIG: "JBIG",
  803. A85: "A85",
  804. AHX: "AHX",
  805. CCF: "CCF",
  806. RLX: "RLX"
  807. };
  808. exports.StreamType = StreamType;
  809. const FontType = {
  810. UNKNOWN: "UNKNOWN",
  811. TYPE1: "TYPE1",
  812. TYPE1C: "TYPE1C",
  813. CIDFONTTYPE0: "CIDFONTTYPE0",
  814. CIDFONTTYPE0C: "CIDFONTTYPE0C",
  815. TRUETYPE: "TRUETYPE",
  816. CIDFONTTYPE2: "CIDFONTTYPE2",
  817. TYPE3: "TYPE3",
  818. OPENTYPE: "OPENTYPE",
  819. TYPE0: "TYPE0",
  820. MMTYPE1: "MMTYPE1"
  821. };
  822. exports.FontType = FontType;
  823. const VerbosityLevel = {
  824. ERRORS: 0,
  825. WARNINGS: 1,
  826. INFOS: 5
  827. };
  828. exports.VerbosityLevel = VerbosityLevel;
  829. const CMapCompressionType = {
  830. NONE: 0,
  831. BINARY: 1,
  832. STREAM: 2
  833. };
  834. exports.CMapCompressionType = CMapCompressionType;
  835. const OPS = {
  836. dependency: 1,
  837. setLineWidth: 2,
  838. setLineCap: 3,
  839. setLineJoin: 4,
  840. setMiterLimit: 5,
  841. setDash: 6,
  842. setRenderingIntent: 7,
  843. setFlatness: 8,
  844. setGState: 9,
  845. save: 10,
  846. restore: 11,
  847. transform: 12,
  848. moveTo: 13,
  849. lineTo: 14,
  850. curveTo: 15,
  851. curveTo2: 16,
  852. curveTo3: 17,
  853. closePath: 18,
  854. rectangle: 19,
  855. stroke: 20,
  856. closeStroke: 21,
  857. fill: 22,
  858. eoFill: 23,
  859. fillStroke: 24,
  860. eoFillStroke: 25,
  861. closeFillStroke: 26,
  862. closeEOFillStroke: 27,
  863. endPath: 28,
  864. clip: 29,
  865. eoClip: 30,
  866. beginText: 31,
  867. endText: 32,
  868. setCharSpacing: 33,
  869. setWordSpacing: 34,
  870. setHScale: 35,
  871. setLeading: 36,
  872. setFont: 37,
  873. setTextRenderingMode: 38,
  874. setTextRise: 39,
  875. moveText: 40,
  876. setLeadingMoveText: 41,
  877. setTextMatrix: 42,
  878. nextLine: 43,
  879. showText: 44,
  880. showSpacedText: 45,
  881. nextLineShowText: 46,
  882. nextLineSetSpacingShowText: 47,
  883. setCharWidth: 48,
  884. setCharWidthAndBounds: 49,
  885. setStrokeColorSpace: 50,
  886. setFillColorSpace: 51,
  887. setStrokeColor: 52,
  888. setStrokeColorN: 53,
  889. setFillColor: 54,
  890. setFillColorN: 55,
  891. setStrokeGray: 56,
  892. setFillGray: 57,
  893. setStrokeRGBColor: 58,
  894. setFillRGBColor: 59,
  895. setStrokeCMYKColor: 60,
  896. setFillCMYKColor: 61,
  897. shadingFill: 62,
  898. beginInlineImage: 63,
  899. beginImageData: 64,
  900. endInlineImage: 65,
  901. paintXObject: 66,
  902. markPoint: 67,
  903. markPointProps: 68,
  904. beginMarkedContent: 69,
  905. beginMarkedContentProps: 70,
  906. endMarkedContent: 71,
  907. beginCompat: 72,
  908. endCompat: 73,
  909. paintFormXObjectBegin: 74,
  910. paintFormXObjectEnd: 75,
  911. beginGroup: 76,
  912. endGroup: 77,
  913. beginAnnotations: 78,
  914. endAnnotations: 79,
  915. beginAnnotation: 80,
  916. endAnnotation: 81,
  917. paintJpegXObject: 82,
  918. paintImageMaskXObject: 83,
  919. paintImageMaskXObjectGroup: 84,
  920. paintImageXObject: 85,
  921. paintInlineImageXObject: 86,
  922. paintInlineImageXObjectGroup: 87,
  923. paintImageXObjectRepeat: 88,
  924. paintImageMaskXObjectRepeat: 89,
  925. paintSolidColorImageMask: 90,
  926. constructPath: 91
  927. };
  928. exports.OPS = OPS;
  929. const UNSUPPORTED_FEATURES = {
  930. unknown: "unknown",
  931. forms: "forms",
  932. javaScript: "javaScript",
  933. smask: "smask",
  934. shadingPattern: "shadingPattern",
  935. font: "font",
  936. errorTilingPattern: "errorTilingPattern",
  937. errorExtGState: "errorExtGState",
  938. errorXObject: "errorXObject",
  939. errorFontLoadType3: "errorFontLoadType3",
  940. errorFontState: "errorFontState",
  941. errorFontMissing: "errorFontMissing",
  942. errorFontTranslate: "errorFontTranslate",
  943. errorColorSpace: "errorColorSpace",
  944. errorOperatorList: "errorOperatorList",
  945. errorFontToUnicode: "errorFontToUnicode",
  946. errorFontLoadNative: "errorFontLoadNative",
  947. errorFontGetPath: "errorFontGetPath",
  948. errorMarkedContent: "errorMarkedContent"
  949. };
  950. exports.UNSUPPORTED_FEATURES = UNSUPPORTED_FEATURES;
  951. const PasswordResponses = {
  952. NEED_PASSWORD: 1,
  953. INCORRECT_PASSWORD: 2
  954. };
  955. exports.PasswordResponses = PasswordResponses;
  956. let verbosity = VerbosityLevel.WARNINGS;
  957. function setVerbosityLevel(level) {
  958. if (Number.isInteger(level)) {
  959. verbosity = level;
  960. }
  961. }
  962. function getVerbosityLevel() {
  963. return verbosity;
  964. }
  965. function info(msg) {
  966. if (verbosity >= VerbosityLevel.INFOS) {
  967. console.log(`Info: ${msg}`);
  968. }
  969. }
  970. function warn(msg) {
  971. if (verbosity >= VerbosityLevel.WARNINGS) {
  972. console.log(`Warning: ${msg}`);
  973. }
  974. }
  975. function unreachable(msg) {
  976. throw new Error(msg);
  977. }
  978. function assert(cond, msg) {
  979. if (!cond) {
  980. unreachable(msg);
  981. }
  982. }
  983. function isSameOrigin(baseUrl, otherUrl) {
  984. let base;
  985. try {
  986. base = new URL(baseUrl);
  987. if (!base.origin || base.origin === "null") {
  988. return false;
  989. }
  990. } catch (e) {
  991. return false;
  992. }
  993. const other = new URL(otherUrl, base);
  994. return base.origin === other.origin;
  995. }
  996. function _isValidProtocol(url) {
  997. if (!url) {
  998. return false;
  999. }
  1000. switch (url.protocol) {
  1001. case "http:":
  1002. case "https:":
  1003. case "ftp:":
  1004. case "mailto:":
  1005. case "tel:":
  1006. return true;
  1007. default:
  1008. return false;
  1009. }
  1010. }
  1011. function createValidAbsoluteUrl(url, baseUrl) {
  1012. if (!url) {
  1013. return null;
  1014. }
  1015. try {
  1016. const absoluteUrl = baseUrl ? new URL(url, baseUrl) : new URL(url);
  1017. if (_isValidProtocol(absoluteUrl)) {
  1018. return absoluteUrl;
  1019. }
  1020. } catch (ex) {}
  1021. return null;
  1022. }
  1023. function shadow(obj, prop, value) {
  1024. Object.defineProperty(obj, prop, {
  1025. value,
  1026. enumerable: true,
  1027. configurable: true,
  1028. writable: false
  1029. });
  1030. return value;
  1031. }
  1032. const BaseException = function BaseExceptionClosure() {
  1033. function BaseException(message) {
  1034. if (this.constructor === BaseException) {
  1035. unreachable("Cannot initialize BaseException.");
  1036. }
  1037. this.message = message;
  1038. this.name = this.constructor.name;
  1039. }
  1040. BaseException.prototype = new Error();
  1041. BaseException.constructor = BaseException;
  1042. return BaseException;
  1043. }();
  1044. exports.BaseException = BaseException;
  1045. class PasswordException extends BaseException {
  1046. constructor(msg, code) {
  1047. super(msg);
  1048. this.code = code;
  1049. }
  1050. }
  1051. exports.PasswordException = PasswordException;
  1052. class UnknownErrorException extends BaseException {
  1053. constructor(msg, details) {
  1054. super(msg);
  1055. this.details = details;
  1056. }
  1057. }
  1058. exports.UnknownErrorException = UnknownErrorException;
  1059. class InvalidPDFException extends BaseException {}
  1060. exports.InvalidPDFException = InvalidPDFException;
  1061. class MissingPDFException extends BaseException {}
  1062. exports.MissingPDFException = MissingPDFException;
  1063. class UnexpectedResponseException extends BaseException {
  1064. constructor(msg, status) {
  1065. super(msg);
  1066. this.status = status;
  1067. }
  1068. }
  1069. exports.UnexpectedResponseException = UnexpectedResponseException;
  1070. class FormatError extends BaseException {}
  1071. exports.FormatError = FormatError;
  1072. class AbortException extends BaseException {}
  1073. exports.AbortException = AbortException;
  1074. const NullCharactersRegExp = /\x00/g;
  1075. function removeNullCharacters(str) {
  1076. if (typeof str !== "string") {
  1077. warn("The argument for removeNullCharacters must be a string.");
  1078. return str;
  1079. }
  1080. return str.replace(NullCharactersRegExp, "");
  1081. }
  1082. function bytesToString(bytes) {
  1083. assert(bytes !== null && typeof bytes === "object" && bytes.length !== undefined, "Invalid argument for bytesToString");
  1084. const length = bytes.length;
  1085. const MAX_ARGUMENT_COUNT = 8192;
  1086. if (length < MAX_ARGUMENT_COUNT) {
  1087. return String.fromCharCode.apply(null, bytes);
  1088. }
  1089. const strBuf = [];
  1090. for (let i = 0; i < length; i += MAX_ARGUMENT_COUNT) {
  1091. const chunkEnd = Math.min(i + MAX_ARGUMENT_COUNT, length);
  1092. const chunk = bytes.subarray(i, chunkEnd);
  1093. strBuf.push(String.fromCharCode.apply(null, chunk));
  1094. }
  1095. return strBuf.join("");
  1096. }
  1097. function stringToBytes(str) {
  1098. assert(typeof str === "string", "Invalid argument for stringToBytes");
  1099. const length = str.length;
  1100. const bytes = new Uint8Array(length);
  1101. for (let i = 0; i < length; ++i) {
  1102. bytes[i] = str.charCodeAt(i) & 0xff;
  1103. }
  1104. return bytes;
  1105. }
  1106. function arrayByteLength(arr) {
  1107. if (arr.length !== undefined) {
  1108. return arr.length;
  1109. }
  1110. assert(arr.byteLength !== undefined, "arrayByteLength - invalid argument.");
  1111. return arr.byteLength;
  1112. }
  1113. function arraysToBytes(arr) {
  1114. const length = arr.length;
  1115. if (length === 1 && arr[0] instanceof Uint8Array) {
  1116. return arr[0];
  1117. }
  1118. let resultLength = 0;
  1119. for (let i = 0; i < length; i++) {
  1120. resultLength += arrayByteLength(arr[i]);
  1121. }
  1122. let pos = 0;
  1123. const data = new Uint8Array(resultLength);
  1124. for (let i = 0; i < length; i++) {
  1125. let item = arr[i];
  1126. if (!(item instanceof Uint8Array)) {
  1127. if (typeof item === "string") {
  1128. item = stringToBytes(item);
  1129. } else {
  1130. item = new Uint8Array(item);
  1131. }
  1132. }
  1133. const itemLength = item.byteLength;
  1134. data.set(item, pos);
  1135. pos += itemLength;
  1136. }
  1137. return data;
  1138. }
  1139. function string32(value) {
  1140. return String.fromCharCode(value >> 24 & 0xff, value >> 16 & 0xff, value >> 8 & 0xff, value & 0xff);
  1141. }
  1142. function objectSize(obj) {
  1143. return Object.keys(obj).length;
  1144. }
  1145. function objectFromEntries(iterable) {
  1146. return Object.assign(Object.create(null), Object.fromEntries(iterable));
  1147. }
  1148. function isLittleEndian() {
  1149. const buffer8 = new Uint8Array(4);
  1150. buffer8[0] = 1;
  1151. const view32 = new Uint32Array(buffer8.buffer, 0, 1);
  1152. return view32[0] === 1;
  1153. }
  1154. const IsLittleEndianCached = {
  1155. get value() {
  1156. return shadow(this, "value", isLittleEndian());
  1157. }
  1158. };
  1159. exports.IsLittleEndianCached = IsLittleEndianCached;
  1160. function isEvalSupported() {
  1161. try {
  1162. new Function("");
  1163. return true;
  1164. } catch (e) {
  1165. return false;
  1166. }
  1167. }
  1168. const IsEvalSupportedCached = {
  1169. get value() {
  1170. return shadow(this, "value", isEvalSupported());
  1171. }
  1172. };
  1173. exports.IsEvalSupportedCached = IsEvalSupportedCached;
  1174. const hexNumbers = [...Array(256).keys()].map(n => n.toString(16).padStart(2, "0"));
  1175. class Util {
  1176. static makeHexColor(r, g, b) {
  1177. return `#${hexNumbers[r]}${hexNumbers[g]}${hexNumbers[b]}`;
  1178. }
  1179. static transform(m1, m2) {
  1180. return [m1[0] * m2[0] + m1[2] * m2[1], m1[1] * m2[0] + m1[3] * m2[1], m1[0] * m2[2] + m1[2] * m2[3], m1[1] * m2[2] + m1[3] * m2[3], m1[0] * m2[4] + m1[2] * m2[5] + m1[4], m1[1] * m2[4] + m1[3] * m2[5] + m1[5]];
  1181. }
  1182. static applyTransform(p, m) {
  1183. const xt = p[0] * m[0] + p[1] * m[2] + m[4];
  1184. const yt = p[0] * m[1] + p[1] * m[3] + m[5];
  1185. return [xt, yt];
  1186. }
  1187. static applyInverseTransform(p, m) {
  1188. const d = m[0] * m[3] - m[1] * m[2];
  1189. const xt = (p[0] * m[3] - p[1] * m[2] + m[2] * m[5] - m[4] * m[3]) / d;
  1190. const yt = (-p[0] * m[1] + p[1] * m[0] + m[4] * m[1] - m[5] * m[0]) / d;
  1191. return [xt, yt];
  1192. }
  1193. static getAxialAlignedBoundingBox(r, m) {
  1194. const p1 = Util.applyTransform(r, m);
  1195. const p2 = Util.applyTransform(r.slice(2, 4), m);
  1196. const p3 = Util.applyTransform([r[0], r[3]], m);
  1197. const p4 = Util.applyTransform([r[2], r[1]], m);
  1198. return [Math.min(p1[0], p2[0], p3[0], p4[0]), Math.min(p1[1], p2[1], p3[1], p4[1]), Math.max(p1[0], p2[0], p3[0], p4[0]), Math.max(p1[1], p2[1], p3[1], p4[1])];
  1199. }
  1200. static inverseTransform(m) {
  1201. const d = m[0] * m[3] - m[1] * m[2];
  1202. return [m[3] / d, -m[1] / d, -m[2] / d, m[0] / d, (m[2] * m[5] - m[4] * m[3]) / d, (m[4] * m[1] - m[5] * m[0]) / d];
  1203. }
  1204. static apply3dTransform(m, v) {
  1205. return [m[0] * v[0] + m[1] * v[1] + m[2] * v[2], m[3] * v[0] + m[4] * v[1] + m[5] * v[2], m[6] * v[0] + m[7] * v[1] + m[8] * v[2]];
  1206. }
  1207. static singularValueDecompose2dScale(m) {
  1208. const transpose = [m[0], m[2], m[1], m[3]];
  1209. const a = m[0] * transpose[0] + m[1] * transpose[2];
  1210. const b = m[0] * transpose[1] + m[1] * transpose[3];
  1211. const c = m[2] * transpose[0] + m[3] * transpose[2];
  1212. const d = m[2] * transpose[1] + m[3] * transpose[3];
  1213. const first = (a + d) / 2;
  1214. const second = Math.sqrt((a + d) * (a + d) - 4 * (a * d - c * b)) / 2;
  1215. const sx = first + second || 1;
  1216. const sy = first - second || 1;
  1217. return [Math.sqrt(sx), Math.sqrt(sy)];
  1218. }
  1219. static normalizeRect(rect) {
  1220. const r = rect.slice(0);
  1221. if (rect[0] > rect[2]) {
  1222. r[0] = rect[2];
  1223. r[2] = rect[0];
  1224. }
  1225. if (rect[1] > rect[3]) {
  1226. r[1] = rect[3];
  1227. r[3] = rect[1];
  1228. }
  1229. return r;
  1230. }
  1231. static intersect(rect1, rect2) {
  1232. function compare(a, b) {
  1233. return a - b;
  1234. }
  1235. const orderedX = [rect1[0], rect1[2], rect2[0], rect2[2]].sort(compare);
  1236. const orderedY = [rect1[1], rect1[3], rect2[1], rect2[3]].sort(compare);
  1237. const result = [];
  1238. rect1 = Util.normalizeRect(rect1);
  1239. rect2 = Util.normalizeRect(rect2);
  1240. if (orderedX[0] === rect1[0] && orderedX[1] === rect2[0] || orderedX[0] === rect2[0] && orderedX[1] === rect1[0]) {
  1241. result[0] = orderedX[1];
  1242. result[2] = orderedX[2];
  1243. } else {
  1244. return null;
  1245. }
  1246. if (orderedY[0] === rect1[1] && orderedY[1] === rect2[1] || orderedY[0] === rect2[1] && orderedY[1] === rect1[1]) {
  1247. result[1] = orderedY[1];
  1248. result[3] = orderedY[2];
  1249. } else {
  1250. return null;
  1251. }
  1252. return result;
  1253. }
  1254. }
  1255. exports.Util = Util;
  1256. const PDFStringTranslateTable = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0x2D8, 0x2C7, 0x2C6, 0x2D9, 0x2DD, 0x2DB, 0x2DA, 0x2DC, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0x2022, 0x2020, 0x2021, 0x2026, 0x2014, 0x2013, 0x192, 0x2044, 0x2039, 0x203A, 0x2212, 0x2030, 0x201E, 0x201C, 0x201D, 0x2018, 0x2019, 0x201A, 0x2122, 0xFB01, 0xFB02, 0x141, 0x152, 0x160, 0x178, 0x17D, 0x131, 0x142, 0x153, 0x161, 0x17E, 0, 0x20AC];
  1257. function stringToPDFString(str) {
  1258. const length = str.length,
  1259. strBuf = [];
  1260. if (str[0] === "\xFE" && str[1] === "\xFF") {
  1261. for (let i = 2; i < length; i += 2) {
  1262. strBuf.push(String.fromCharCode(str.charCodeAt(i) << 8 | str.charCodeAt(i + 1)));
  1263. }
  1264. } else if (str[0] === "\xFF" && str[1] === "\xFE") {
  1265. for (let i = 2; i < length; i += 2) {
  1266. strBuf.push(String.fromCharCode(str.charCodeAt(i + 1) << 8 | str.charCodeAt(i)));
  1267. }
  1268. } else {
  1269. for (let i = 0; i < length; ++i) {
  1270. const code = PDFStringTranslateTable[str.charCodeAt(i)];
  1271. strBuf.push(code ? String.fromCharCode(code) : str.charAt(i));
  1272. }
  1273. }
  1274. return strBuf.join("");
  1275. }
  1276. function escapeString(str) {
  1277. return str.replace(/([()\\\n\r])/g, match => {
  1278. if (match === "\n") {
  1279. return "\\n";
  1280. } else if (match === "\r") {
  1281. return "\\r";
  1282. }
  1283. return `\\${match}`;
  1284. });
  1285. }
  1286. function isAscii(str) {
  1287. return /^[\x00-\x7F]*$/.test(str);
  1288. }
  1289. function stringToUTF16BEString(str) {
  1290. const buf = ["\xFE\xFF"];
  1291. for (let i = 0, ii = str.length; i < ii; i++) {
  1292. const char = str.charCodeAt(i);
  1293. buf.push(String.fromCharCode(char >> 8 & 0xff));
  1294. buf.push(String.fromCharCode(char & 0xff));
  1295. }
  1296. return buf.join("");
  1297. }
  1298. function stringToUTF8String(str) {
  1299. return decodeURIComponent(escape(str));
  1300. }
  1301. function utf8StringToString(str) {
  1302. return unescape(encodeURIComponent(str));
  1303. }
  1304. function isBool(v) {
  1305. return typeof v === "boolean";
  1306. }
  1307. function isNum(v) {
  1308. return typeof v === "number";
  1309. }
  1310. function isString(v) {
  1311. return typeof v === "string";
  1312. }
  1313. function isArrayBuffer(v) {
  1314. return typeof v === "object" && v !== null && v.byteLength !== undefined;
  1315. }
  1316. function isArrayEqual(arr1, arr2) {
  1317. if (arr1.length !== arr2.length) {
  1318. return false;
  1319. }
  1320. return arr1.every(function (element, index) {
  1321. return element === arr2[index];
  1322. });
  1323. }
  1324. function getModificationDate(date = new Date()) {
  1325. const buffer = [date.getUTCFullYear().toString(), (date.getUTCMonth() + 1).toString().padStart(2, "0"), date.getUTCDate().toString().padStart(2, "0"), date.getUTCHours().toString().padStart(2, "0"), date.getUTCMinutes().toString().padStart(2, "0"), date.getUTCSeconds().toString().padStart(2, "0")];
  1326. return buffer.join("");
  1327. }
  1328. function createPromiseCapability() {
  1329. const capability = Object.create(null);
  1330. let isSettled = false;
  1331. Object.defineProperty(capability, "settled", {
  1332. get() {
  1333. return isSettled;
  1334. }
  1335. });
  1336. capability.promise = new Promise(function (resolve, reject) {
  1337. capability.resolve = function (data) {
  1338. isSettled = true;
  1339. resolve(data);
  1340. };
  1341. capability.reject = function (reason) {
  1342. isSettled = true;
  1343. reject(reason);
  1344. };
  1345. });
  1346. return capability;
  1347. }
  1348. const createObjectURL = function createObjectURLClosure() {
  1349. const digits = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";
  1350. return function createObjectURL(data, contentType, forceDataSchema = false) {
  1351. if (!forceDataSchema && URL.createObjectURL) {
  1352. const blob = new Blob([data], {
  1353. type: contentType
  1354. });
  1355. return URL.createObjectURL(blob);
  1356. }
  1357. let buffer = `data:${contentType};base64,`;
  1358. for (let i = 0, ii = data.length; i < ii; i += 3) {
  1359. const b1 = data[i] & 0xff;
  1360. const b2 = data[i + 1] & 0xff;
  1361. const b3 = data[i + 2] & 0xff;
  1362. const d1 = b1 >> 2,
  1363. d2 = (b1 & 3) << 4 | b2 >> 4;
  1364. const d3 = i + 1 < ii ? (b2 & 0xf) << 2 | b3 >> 6 : 64;
  1365. const d4 = i + 2 < ii ? b3 & 0x3f : 64;
  1366. buffer += digits[d1] + digits[d2] + digits[d3] + digits[d4];
  1367. }
  1368. return buffer;
  1369. };
  1370. }();
  1371. exports.createObjectURL = createObjectURL;
  1372. const XMLEntities = {
  1373. 0x3c: "&lt;",
  1374. 0x3e: "&gt;",
  1375. 0x26: "&amp;",
  1376. 0x22: "&quot;",
  1377. 0x27: "&apos;"
  1378. };
  1379. function encodeToXmlString(str) {
  1380. const buffer = [];
  1381. let start = 0;
  1382. for (let i = 0, ii = str.length; i < ii; i++) {
  1383. const char = str.codePointAt(i);
  1384. if (0x20 <= char && char <= 0x7e) {
  1385. const entity = XMLEntities[char];
  1386. if (entity) {
  1387. if (start < i) {
  1388. buffer.push(str.substring(start, i));
  1389. }
  1390. buffer.push(entity);
  1391. start = i + 1;
  1392. }
  1393. } else {
  1394. if (start < i) {
  1395. buffer.push(str.substring(start, i));
  1396. }
  1397. buffer.push(`&#x${char.toString(16).toUpperCase()};`);
  1398. if (char > 0xd7ff && (char < 0xe000 || char > 0xfffd)) {
  1399. i++;
  1400. }
  1401. start = i + 1;
  1402. }
  1403. }
  1404. if (buffer.length === 0) {
  1405. return str;
  1406. }
  1407. if (start < str.length) {
  1408. buffer.push(str.substring(start, str.length));
  1409. }
  1410. return buffer.join("");
  1411. }
  1412. /***/ }),
  1413. /* 3 */
  1414. /***/ ((__unused_webpack_module, __unused_webpack_exports, __w_pdfjs_require__) => {
  1415. var _is_node = __w_pdfjs_require__(4);
  1416. ;
  1417. /***/ }),
  1418. /* 4 */
  1419. /***/ ((__unused_webpack_module, exports) => {
  1420. Object.defineProperty(exports, "__esModule", ({
  1421. value: true
  1422. }));
  1423. exports.isNodeJS = void 0;
  1424. const isNodeJS = typeof process === "object" && process + "" === "[object process]" && !process.versions.nw && !(process.versions.electron && process.type && process.type !== "browser");
  1425. exports.isNodeJS = isNodeJS;
  1426. /***/ }),
  1427. /* 5 */
  1428. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  1429. Object.defineProperty(exports, "__esModule", ({
  1430. value: true
  1431. }));
  1432. exports.clearPrimitiveCaches = clearPrimitiveCaches;
  1433. exports.isCmd = isCmd;
  1434. exports.isDict = isDict;
  1435. exports.isEOF = isEOF;
  1436. exports.isName = isName;
  1437. exports.isRef = isRef;
  1438. exports.isRefsEqual = isRefsEqual;
  1439. exports.isStream = isStream;
  1440. exports.RefSetCache = exports.RefSet = exports.Ref = exports.Name = exports.EOF = exports.Dict = exports.Cmd = void 0;
  1441. var _util = __w_pdfjs_require__(2);
  1442. var EOF = {};
  1443. exports.EOF = EOF;
  1444. var Name = function NameClosure() {
  1445. let nameCache = Object.create(null);
  1446. function Name(name) {
  1447. this.name = name;
  1448. }
  1449. Name.prototype = {};
  1450. Name.get = function Name_get(name) {
  1451. var nameValue = nameCache[name];
  1452. return nameValue ? nameValue : nameCache[name] = new Name(name);
  1453. };
  1454. Name._clearCache = function () {
  1455. nameCache = Object.create(null);
  1456. };
  1457. return Name;
  1458. }();
  1459. exports.Name = Name;
  1460. var Cmd = function CmdClosure() {
  1461. let cmdCache = Object.create(null);
  1462. function Cmd(cmd) {
  1463. this.cmd = cmd;
  1464. }
  1465. Cmd.prototype = {};
  1466. Cmd.get = function Cmd_get(cmd) {
  1467. var cmdValue = cmdCache[cmd];
  1468. return cmdValue ? cmdValue : cmdCache[cmd] = new Cmd(cmd);
  1469. };
  1470. Cmd._clearCache = function () {
  1471. cmdCache = Object.create(null);
  1472. };
  1473. return Cmd;
  1474. }();
  1475. exports.Cmd = Cmd;
  1476. var Dict = function DictClosure() {
  1477. var nonSerializable = function nonSerializableClosure() {
  1478. return nonSerializable;
  1479. };
  1480. function Dict(xref) {
  1481. this._map = Object.create(null);
  1482. this.xref = xref;
  1483. this.objId = null;
  1484. this.suppressEncryption = false;
  1485. this.__nonSerializable__ = nonSerializable;
  1486. }
  1487. Dict.prototype = {
  1488. assignXref: function Dict_assignXref(newXref) {
  1489. this.xref = newXref;
  1490. },
  1491. get size() {
  1492. return Object.keys(this._map).length;
  1493. },
  1494. get(key1, key2, key3) {
  1495. let value = this._map[key1];
  1496. if (value === undefined && key2 !== undefined) {
  1497. value = this._map[key2];
  1498. if (value === undefined && key3 !== undefined) {
  1499. value = this._map[key3];
  1500. }
  1501. }
  1502. if (value instanceof Ref && this.xref) {
  1503. return this.xref.fetch(value, this.suppressEncryption);
  1504. }
  1505. return value;
  1506. },
  1507. async getAsync(key1, key2, key3) {
  1508. let value = this._map[key1];
  1509. if (value === undefined && key2 !== undefined) {
  1510. value = this._map[key2];
  1511. if (value === undefined && key3 !== undefined) {
  1512. value = this._map[key3];
  1513. }
  1514. }
  1515. if (value instanceof Ref && this.xref) {
  1516. return this.xref.fetchAsync(value, this.suppressEncryption);
  1517. }
  1518. return value;
  1519. },
  1520. getArray(key1, key2, key3) {
  1521. let value = this.get(key1, key2, key3);
  1522. if (!Array.isArray(value) || !this.xref) {
  1523. return value;
  1524. }
  1525. value = value.slice();
  1526. for (let i = 0, ii = value.length; i < ii; i++) {
  1527. if (!(value[i] instanceof Ref)) {
  1528. continue;
  1529. }
  1530. value[i] = this.xref.fetch(value[i], this.suppressEncryption);
  1531. }
  1532. return value;
  1533. },
  1534. getRaw: function Dict_getRaw(key) {
  1535. return this._map[key];
  1536. },
  1537. getKeys: function Dict_getKeys() {
  1538. return Object.keys(this._map);
  1539. },
  1540. getRawValues: function Dict_getRawValues() {
  1541. return Object.values(this._map);
  1542. },
  1543. set: function Dict_set(key, value) {
  1544. this._map[key] = value;
  1545. },
  1546. has: function Dict_has(key) {
  1547. return this._map[key] !== undefined;
  1548. },
  1549. forEach: function Dict_forEach(callback) {
  1550. for (var key in this._map) {
  1551. callback(key, this.get(key));
  1552. }
  1553. }
  1554. };
  1555. Dict.empty = function () {
  1556. const emptyDict = new Dict(null);
  1557. emptyDict.set = (key, value) => {
  1558. (0, _util.unreachable)("Should not call `set` on the empty dictionary.");
  1559. };
  1560. return emptyDict;
  1561. }();
  1562. Dict.merge = function ({
  1563. xref,
  1564. dictArray,
  1565. mergeSubDicts = false
  1566. }) {
  1567. const mergedDict = new Dict(xref);
  1568. if (!mergeSubDicts) {
  1569. for (const dict of dictArray) {
  1570. if (!(dict instanceof Dict)) {
  1571. continue;
  1572. }
  1573. for (const [key, value] of Object.entries(dict._map)) {
  1574. if (mergedDict._map[key] === undefined) {
  1575. mergedDict._map[key] = value;
  1576. }
  1577. }
  1578. }
  1579. return mergedDict.size > 0 ? mergedDict : Dict.empty;
  1580. }
  1581. const properties = new Map();
  1582. for (const dict of dictArray) {
  1583. if (!(dict instanceof Dict)) {
  1584. continue;
  1585. }
  1586. for (const [key, value] of Object.entries(dict._map)) {
  1587. let property = properties.get(key);
  1588. if (property === undefined) {
  1589. property = [];
  1590. properties.set(key, property);
  1591. }
  1592. property.push(value);
  1593. }
  1594. }
  1595. for (const [name, values] of properties) {
  1596. if (values.length === 1 || !(values[0] instanceof Dict)) {
  1597. mergedDict._map[name] = values[0];
  1598. continue;
  1599. }
  1600. const subDict = new Dict(xref);
  1601. for (const dict of values) {
  1602. if (!(dict instanceof Dict)) {
  1603. continue;
  1604. }
  1605. for (const [key, value] of Object.entries(dict._map)) {
  1606. if (subDict._map[key] === undefined) {
  1607. subDict._map[key] = value;
  1608. }
  1609. }
  1610. }
  1611. if (subDict.size > 0) {
  1612. mergedDict._map[name] = subDict;
  1613. }
  1614. }
  1615. properties.clear();
  1616. return mergedDict.size > 0 ? mergedDict : Dict.empty;
  1617. };
  1618. return Dict;
  1619. }();
  1620. exports.Dict = Dict;
  1621. var Ref = function RefClosure() {
  1622. let refCache = Object.create(null);
  1623. function Ref(num, gen) {
  1624. this.num = num;
  1625. this.gen = gen;
  1626. }
  1627. Ref.prototype = {
  1628. toString: function Ref_toString() {
  1629. if (this.gen === 0) {
  1630. return `${this.num}R`;
  1631. }
  1632. return `${this.num}R${this.gen}`;
  1633. }
  1634. };
  1635. Ref.get = function (num, gen) {
  1636. const key = gen === 0 ? `${num}R` : `${num}R${gen}`;
  1637. const refValue = refCache[key];
  1638. return refValue ? refValue : refCache[key] = new Ref(num, gen);
  1639. };
  1640. Ref._clearCache = function () {
  1641. refCache = Object.create(null);
  1642. };
  1643. return Ref;
  1644. }();
  1645. exports.Ref = Ref;
  1646. class RefSet {
  1647. constructor(parent = null) {
  1648. this._set = new Set(parent && parent._set);
  1649. }
  1650. has(ref) {
  1651. return this._set.has(ref.toString());
  1652. }
  1653. put(ref) {
  1654. this._set.add(ref.toString());
  1655. }
  1656. remove(ref) {
  1657. this._set.delete(ref.toString());
  1658. }
  1659. forEach(callback) {
  1660. for (const ref of this._set.values()) {
  1661. callback(ref);
  1662. }
  1663. }
  1664. clear() {
  1665. this._set.clear();
  1666. }
  1667. }
  1668. exports.RefSet = RefSet;
  1669. class RefSetCache {
  1670. constructor() {
  1671. this._map = new Map();
  1672. }
  1673. get size() {
  1674. return this._map.size;
  1675. }
  1676. get(ref) {
  1677. return this._map.get(ref.toString());
  1678. }
  1679. has(ref) {
  1680. return this._map.has(ref.toString());
  1681. }
  1682. put(ref, obj) {
  1683. this._map.set(ref.toString(), obj);
  1684. }
  1685. putAlias(ref, aliasRef) {
  1686. this._map.set(ref.toString(), this.get(aliasRef));
  1687. }
  1688. forEach(callback) {
  1689. for (const value of this._map.values()) {
  1690. callback(value);
  1691. }
  1692. }
  1693. clear() {
  1694. this._map.clear();
  1695. }
  1696. }
  1697. exports.RefSetCache = RefSetCache;
  1698. function isEOF(v) {
  1699. return v === EOF;
  1700. }
  1701. function isName(v, name) {
  1702. return v instanceof Name && (name === undefined || v.name === name);
  1703. }
  1704. function isCmd(v, cmd) {
  1705. return v instanceof Cmd && (cmd === undefined || v.cmd === cmd);
  1706. }
  1707. function isDict(v, type) {
  1708. return v instanceof Dict && (type === undefined || isName(v.get("Type"), type));
  1709. }
  1710. function isRef(v) {
  1711. return v instanceof Ref;
  1712. }
  1713. function isRefsEqual(v1, v2) {
  1714. return v1.num === v2.num && v1.gen === v2.gen;
  1715. }
  1716. function isStream(v) {
  1717. return typeof v === "object" && v !== null && v.getBytes !== undefined;
  1718. }
  1719. function clearPrimitiveCaches() {
  1720. Cmd._clearCache();
  1721. Name._clearCache();
  1722. Ref._clearCache();
  1723. }
  1724. /***/ }),
  1725. /* 6 */
  1726. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  1727. Object.defineProperty(exports, "__esModule", ({
  1728. value: true
  1729. }));
  1730. exports.NetworkPdfManager = exports.LocalPdfManager = void 0;
  1731. var _util = __w_pdfjs_require__(2);
  1732. var _chunked_stream = __w_pdfjs_require__(7);
  1733. var _core_utils = __w_pdfjs_require__(8);
  1734. var _document = __w_pdfjs_require__(9);
  1735. var _stream = __w_pdfjs_require__(12);
  1736. class BasePdfManager {
  1737. constructor() {
  1738. if (this.constructor === BasePdfManager) {
  1739. (0, _util.unreachable)("Cannot initialize BasePdfManager.");
  1740. }
  1741. }
  1742. get docId() {
  1743. return this._docId;
  1744. }
  1745. get password() {
  1746. return this._password;
  1747. }
  1748. get docBaseUrl() {
  1749. let docBaseUrl = null;
  1750. if (this._docBaseUrl) {
  1751. const absoluteUrl = (0, _util.createValidAbsoluteUrl)(this._docBaseUrl);
  1752. if (absoluteUrl) {
  1753. docBaseUrl = absoluteUrl.href;
  1754. } else {
  1755. (0, _util.warn)(`Invalid absolute docBaseUrl: "${this._docBaseUrl}".`);
  1756. }
  1757. }
  1758. return (0, _util.shadow)(this, "docBaseUrl", docBaseUrl);
  1759. }
  1760. onLoadedStream() {
  1761. (0, _util.unreachable)("Abstract method `onLoadedStream` called");
  1762. }
  1763. ensureDoc(prop, args) {
  1764. return this.ensure(this.pdfDocument, prop, args);
  1765. }
  1766. ensureXRef(prop, args) {
  1767. return this.ensure(this.pdfDocument.xref, prop, args);
  1768. }
  1769. ensureCatalog(prop, args) {
  1770. return this.ensure(this.pdfDocument.catalog, prop, args);
  1771. }
  1772. getPage(pageIndex) {
  1773. return this.pdfDocument.getPage(pageIndex);
  1774. }
  1775. fontFallback(id, handler) {
  1776. return this.pdfDocument.fontFallback(id, handler);
  1777. }
  1778. cleanup(manuallyTriggered = false) {
  1779. return this.pdfDocument.cleanup(manuallyTriggered);
  1780. }
  1781. async ensure(obj, prop, args) {
  1782. (0, _util.unreachable)("Abstract method `ensure` called");
  1783. }
  1784. requestRange(begin, end) {
  1785. (0, _util.unreachable)("Abstract method `requestRange` called");
  1786. }
  1787. requestLoadedStream() {
  1788. (0, _util.unreachable)("Abstract method `requestLoadedStream` called");
  1789. }
  1790. sendProgressiveData(chunk) {
  1791. (0, _util.unreachable)("Abstract method `sendProgressiveData` called");
  1792. }
  1793. updatePassword(password) {
  1794. this._password = password;
  1795. }
  1796. terminate(reason) {
  1797. (0, _util.unreachable)("Abstract method `terminate` called");
  1798. }
  1799. }
  1800. class LocalPdfManager extends BasePdfManager {
  1801. constructor(docId, data, password, evaluatorOptions, docBaseUrl) {
  1802. super();
  1803. this._docId = docId;
  1804. this._password = password;
  1805. this._docBaseUrl = docBaseUrl;
  1806. this.evaluatorOptions = evaluatorOptions;
  1807. const stream = new _stream.Stream(data);
  1808. this.pdfDocument = new _document.PDFDocument(this, stream);
  1809. this._loadedStreamPromise = Promise.resolve(stream);
  1810. }
  1811. async ensure(obj, prop, args) {
  1812. const value = obj[prop];
  1813. if (typeof value === "function") {
  1814. return value.apply(obj, args);
  1815. }
  1816. return value;
  1817. }
  1818. requestRange(begin, end) {
  1819. return Promise.resolve();
  1820. }
  1821. requestLoadedStream() {}
  1822. onLoadedStream() {
  1823. return this._loadedStreamPromise;
  1824. }
  1825. terminate(reason) {}
  1826. }
  1827. exports.LocalPdfManager = LocalPdfManager;
  1828. class NetworkPdfManager extends BasePdfManager {
  1829. constructor(docId, pdfNetworkStream, args, evaluatorOptions, docBaseUrl) {
  1830. super();
  1831. this._docId = docId;
  1832. this._password = args.password;
  1833. this._docBaseUrl = docBaseUrl;
  1834. this.msgHandler = args.msgHandler;
  1835. this.evaluatorOptions = evaluatorOptions;
  1836. this.streamManager = new _chunked_stream.ChunkedStreamManager(pdfNetworkStream, {
  1837. msgHandler: args.msgHandler,
  1838. length: args.length,
  1839. disableAutoFetch: args.disableAutoFetch,
  1840. rangeChunkSize: args.rangeChunkSize
  1841. });
  1842. this.pdfDocument = new _document.PDFDocument(this, this.streamManager.getStream());
  1843. }
  1844. async ensure(obj, prop, args) {
  1845. try {
  1846. const value = obj[prop];
  1847. if (typeof value === "function") {
  1848. return value.apply(obj, args);
  1849. }
  1850. return value;
  1851. } catch (ex) {
  1852. if (!(ex instanceof _core_utils.MissingDataException)) {
  1853. throw ex;
  1854. }
  1855. await this.requestRange(ex.begin, ex.end);
  1856. return this.ensure(obj, prop, args);
  1857. }
  1858. }
  1859. requestRange(begin, end) {
  1860. return this.streamManager.requestRange(begin, end);
  1861. }
  1862. requestLoadedStream() {
  1863. this.streamManager.requestAllChunks();
  1864. }
  1865. sendProgressiveData(chunk) {
  1866. this.streamManager.onReceiveData({
  1867. chunk
  1868. });
  1869. }
  1870. onLoadedStream() {
  1871. return this.streamManager.onLoadedStream();
  1872. }
  1873. terminate(reason) {
  1874. this.streamManager.abort(reason);
  1875. }
  1876. }
  1877. exports.NetworkPdfManager = NetworkPdfManager;
  1878. /***/ }),
  1879. /* 7 */
  1880. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  1881. Object.defineProperty(exports, "__esModule", ({
  1882. value: true
  1883. }));
  1884. exports.ChunkedStreamManager = exports.ChunkedStream = void 0;
  1885. var _util = __w_pdfjs_require__(2);
  1886. var _core_utils = __w_pdfjs_require__(8);
  1887. class ChunkedStream {
  1888. constructor(length, chunkSize, manager) {
  1889. this.bytes = new Uint8Array(length);
  1890. this.start = 0;
  1891. this.pos = 0;
  1892. this.end = length;
  1893. this.chunkSize = chunkSize;
  1894. this._loadedChunks = new Set();
  1895. this.numChunks = Math.ceil(length / chunkSize);
  1896. this.manager = manager;
  1897. this.progressiveDataLength = 0;
  1898. this.lastSuccessfulEnsureByteChunk = -1;
  1899. }
  1900. getMissingChunks() {
  1901. const chunks = [];
  1902. for (let chunk = 0, n = this.numChunks; chunk < n; ++chunk) {
  1903. if (!this._loadedChunks.has(chunk)) {
  1904. chunks.push(chunk);
  1905. }
  1906. }
  1907. return chunks;
  1908. }
  1909. getBaseStreams() {
  1910. return [this];
  1911. }
  1912. get numChunksLoaded() {
  1913. return this._loadedChunks.size;
  1914. }
  1915. allChunksLoaded() {
  1916. return this.numChunksLoaded === this.numChunks;
  1917. }
  1918. onReceiveData(begin, chunk) {
  1919. const chunkSize = this.chunkSize;
  1920. if (begin % chunkSize !== 0) {
  1921. throw new Error(`Bad begin offset: ${begin}`);
  1922. }
  1923. const end = begin + chunk.byteLength;
  1924. if (end % chunkSize !== 0 && end !== this.bytes.length) {
  1925. throw new Error(`Bad end offset: ${end}`);
  1926. }
  1927. this.bytes.set(new Uint8Array(chunk), begin);
  1928. const beginChunk = Math.floor(begin / chunkSize);
  1929. const endChunk = Math.floor((end - 1) / chunkSize) + 1;
  1930. for (let curChunk = beginChunk; curChunk < endChunk; ++curChunk) {
  1931. this._loadedChunks.add(curChunk);
  1932. }
  1933. }
  1934. onReceiveProgressiveData(data) {
  1935. let position = this.progressiveDataLength;
  1936. const beginChunk = Math.floor(position / this.chunkSize);
  1937. this.bytes.set(new Uint8Array(data), position);
  1938. position += data.byteLength;
  1939. this.progressiveDataLength = position;
  1940. const endChunk = position >= this.end ? this.numChunks : Math.floor(position / this.chunkSize);
  1941. for (let curChunk = beginChunk; curChunk < endChunk; ++curChunk) {
  1942. this._loadedChunks.add(curChunk);
  1943. }
  1944. }
  1945. ensureByte(pos) {
  1946. if (pos < this.progressiveDataLength) {
  1947. return;
  1948. }
  1949. const chunk = Math.floor(pos / this.chunkSize);
  1950. if (chunk === this.lastSuccessfulEnsureByteChunk) {
  1951. return;
  1952. }
  1953. if (!this._loadedChunks.has(chunk)) {
  1954. throw new _core_utils.MissingDataException(pos, pos + 1);
  1955. }
  1956. this.lastSuccessfulEnsureByteChunk = chunk;
  1957. }
  1958. ensureRange(begin, end) {
  1959. if (begin >= end) {
  1960. return;
  1961. }
  1962. if (end <= this.progressiveDataLength) {
  1963. return;
  1964. }
  1965. const chunkSize = this.chunkSize;
  1966. const beginChunk = Math.floor(begin / chunkSize);
  1967. const endChunk = Math.floor((end - 1) / chunkSize) + 1;
  1968. for (let chunk = beginChunk; chunk < endChunk; ++chunk) {
  1969. if (!this._loadedChunks.has(chunk)) {
  1970. throw new _core_utils.MissingDataException(begin, end);
  1971. }
  1972. }
  1973. }
  1974. nextEmptyChunk(beginChunk) {
  1975. const numChunks = this.numChunks;
  1976. for (let i = 0; i < numChunks; ++i) {
  1977. const chunk = (beginChunk + i) % numChunks;
  1978. if (!this._loadedChunks.has(chunk)) {
  1979. return chunk;
  1980. }
  1981. }
  1982. return null;
  1983. }
  1984. hasChunk(chunk) {
  1985. return this._loadedChunks.has(chunk);
  1986. }
  1987. get length() {
  1988. return this.end - this.start;
  1989. }
  1990. get isEmpty() {
  1991. return this.length === 0;
  1992. }
  1993. getByte() {
  1994. const pos = this.pos;
  1995. if (pos >= this.end) {
  1996. return -1;
  1997. }
  1998. if (pos >= this.progressiveDataLength) {
  1999. this.ensureByte(pos);
  2000. }
  2001. return this.bytes[this.pos++];
  2002. }
  2003. getUint16() {
  2004. const b0 = this.getByte();
  2005. const b1 = this.getByte();
  2006. if (b0 === -1 || b1 === -1) {
  2007. return -1;
  2008. }
  2009. return (b0 << 8) + b1;
  2010. }
  2011. getInt32() {
  2012. const b0 = this.getByte();
  2013. const b1 = this.getByte();
  2014. const b2 = this.getByte();
  2015. const b3 = this.getByte();
  2016. return (b0 << 24) + (b1 << 16) + (b2 << 8) + b3;
  2017. }
  2018. getBytes(length, forceClamped = false) {
  2019. const bytes = this.bytes;
  2020. const pos = this.pos;
  2021. const strEnd = this.end;
  2022. if (!length) {
  2023. if (strEnd > this.progressiveDataLength) {
  2024. this.ensureRange(pos, strEnd);
  2025. }
  2026. const subarray = bytes.subarray(pos, strEnd);
  2027. return forceClamped ? new Uint8ClampedArray(subarray) : subarray;
  2028. }
  2029. let end = pos + length;
  2030. if (end > strEnd) {
  2031. end = strEnd;
  2032. }
  2033. if (end > this.progressiveDataLength) {
  2034. this.ensureRange(pos, end);
  2035. }
  2036. this.pos = end;
  2037. const subarray = bytes.subarray(pos, end);
  2038. return forceClamped ? new Uint8ClampedArray(subarray) : subarray;
  2039. }
  2040. peekByte() {
  2041. const peekedByte = this.getByte();
  2042. if (peekedByte !== -1) {
  2043. this.pos--;
  2044. }
  2045. return peekedByte;
  2046. }
  2047. peekBytes(length, forceClamped = false) {
  2048. const bytes = this.getBytes(length, forceClamped);
  2049. this.pos -= bytes.length;
  2050. return bytes;
  2051. }
  2052. getByteRange(begin, end) {
  2053. if (begin < 0) {
  2054. begin = 0;
  2055. }
  2056. if (end > this.end) {
  2057. end = this.end;
  2058. }
  2059. if (end > this.progressiveDataLength) {
  2060. this.ensureRange(begin, end);
  2061. }
  2062. return this.bytes.subarray(begin, end);
  2063. }
  2064. skip(n) {
  2065. if (!n) {
  2066. n = 1;
  2067. }
  2068. this.pos += n;
  2069. }
  2070. reset() {
  2071. this.pos = this.start;
  2072. }
  2073. moveStart() {
  2074. this.start = this.pos;
  2075. }
  2076. makeSubStream(start, length, dict) {
  2077. if (length) {
  2078. if (start + length > this.progressiveDataLength) {
  2079. this.ensureRange(start, start + length);
  2080. }
  2081. } else {
  2082. if (start >= this.progressiveDataLength) {
  2083. this.ensureByte(start);
  2084. }
  2085. }
  2086. function ChunkedStreamSubstream() {}
  2087. ChunkedStreamSubstream.prototype = Object.create(this);
  2088. ChunkedStreamSubstream.prototype.getMissingChunks = function () {
  2089. const chunkSize = this.chunkSize;
  2090. const beginChunk = Math.floor(this.start / chunkSize);
  2091. const endChunk = Math.floor((this.end - 1) / chunkSize) + 1;
  2092. const missingChunks = [];
  2093. for (let chunk = beginChunk; chunk < endChunk; ++chunk) {
  2094. if (!this._loadedChunks.has(chunk)) {
  2095. missingChunks.push(chunk);
  2096. }
  2097. }
  2098. return missingChunks;
  2099. };
  2100. ChunkedStreamSubstream.prototype.allChunksLoaded = function () {
  2101. if (this.numChunksLoaded === this.numChunks) {
  2102. return true;
  2103. }
  2104. return this.getMissingChunks().length === 0;
  2105. };
  2106. const subStream = new ChunkedStreamSubstream();
  2107. subStream.pos = subStream.start = start;
  2108. subStream.end = start + length || this.end;
  2109. subStream.dict = dict;
  2110. return subStream;
  2111. }
  2112. }
  2113. exports.ChunkedStream = ChunkedStream;
  2114. class ChunkedStreamManager {
  2115. constructor(pdfNetworkStream, args) {
  2116. this.length = args.length;
  2117. this.chunkSize = args.rangeChunkSize;
  2118. this.stream = new ChunkedStream(this.length, this.chunkSize, this);
  2119. this.pdfNetworkStream = pdfNetworkStream;
  2120. this.disableAutoFetch = args.disableAutoFetch;
  2121. this.msgHandler = args.msgHandler;
  2122. this.currRequestId = 0;
  2123. this._chunksNeededByRequest = new Map();
  2124. this._requestsByChunk = new Map();
  2125. this._promisesByRequest = new Map();
  2126. this.progressiveDataLength = 0;
  2127. this.aborted = false;
  2128. this._loadedStreamCapability = (0, _util.createPromiseCapability)();
  2129. }
  2130. onLoadedStream() {
  2131. return this._loadedStreamCapability.promise;
  2132. }
  2133. sendRequest(begin, end) {
  2134. const rangeReader = this.pdfNetworkStream.getRangeReader(begin, end);
  2135. if (!rangeReader.isStreamingSupported) {
  2136. rangeReader.onProgress = this.onProgress.bind(this);
  2137. }
  2138. let chunks = [],
  2139. loaded = 0;
  2140. const promise = new Promise((resolve, reject) => {
  2141. const readChunk = chunk => {
  2142. try {
  2143. if (!chunk.done) {
  2144. const data = chunk.value;
  2145. chunks.push(data);
  2146. loaded += (0, _util.arrayByteLength)(data);
  2147. if (rangeReader.isStreamingSupported) {
  2148. this.onProgress({
  2149. loaded
  2150. });
  2151. }
  2152. rangeReader.read().then(readChunk, reject);
  2153. return;
  2154. }
  2155. const chunkData = (0, _util.arraysToBytes)(chunks);
  2156. chunks = null;
  2157. resolve(chunkData);
  2158. } catch (e) {
  2159. reject(e);
  2160. }
  2161. };
  2162. rangeReader.read().then(readChunk, reject);
  2163. });
  2164. promise.then(data => {
  2165. if (this.aborted) {
  2166. return;
  2167. }
  2168. this.onReceiveData({
  2169. chunk: data,
  2170. begin
  2171. });
  2172. });
  2173. }
  2174. requestAllChunks() {
  2175. const missingChunks = this.stream.getMissingChunks();
  2176. this._requestChunks(missingChunks);
  2177. return this._loadedStreamCapability.promise;
  2178. }
  2179. _requestChunks(chunks) {
  2180. const requestId = this.currRequestId++;
  2181. const chunksNeeded = new Set();
  2182. this._chunksNeededByRequest.set(requestId, chunksNeeded);
  2183. for (const chunk of chunks) {
  2184. if (!this.stream.hasChunk(chunk)) {
  2185. chunksNeeded.add(chunk);
  2186. }
  2187. }
  2188. if (chunksNeeded.size === 0) {
  2189. return Promise.resolve();
  2190. }
  2191. const capability = (0, _util.createPromiseCapability)();
  2192. this._promisesByRequest.set(requestId, capability);
  2193. const chunksToRequest = [];
  2194. for (const chunk of chunksNeeded) {
  2195. let requestIds = this._requestsByChunk.get(chunk);
  2196. if (!requestIds) {
  2197. requestIds = [];
  2198. this._requestsByChunk.set(chunk, requestIds);
  2199. chunksToRequest.push(chunk);
  2200. }
  2201. requestIds.push(requestId);
  2202. }
  2203. if (chunksToRequest.length > 0) {
  2204. const groupedChunksToRequest = this.groupChunks(chunksToRequest);
  2205. for (const groupedChunk of groupedChunksToRequest) {
  2206. const begin = groupedChunk.beginChunk * this.chunkSize;
  2207. const end = Math.min(groupedChunk.endChunk * this.chunkSize, this.length);
  2208. this.sendRequest(begin, end);
  2209. }
  2210. }
  2211. return capability.promise.catch(reason => {
  2212. if (this.aborted) {
  2213. return;
  2214. }
  2215. throw reason;
  2216. });
  2217. }
  2218. getStream() {
  2219. return this.stream;
  2220. }
  2221. requestRange(begin, end) {
  2222. end = Math.min(end, this.length);
  2223. const beginChunk = this.getBeginChunk(begin);
  2224. const endChunk = this.getEndChunk(end);
  2225. const chunks = [];
  2226. for (let chunk = beginChunk; chunk < endChunk; ++chunk) {
  2227. chunks.push(chunk);
  2228. }
  2229. return this._requestChunks(chunks);
  2230. }
  2231. requestRanges(ranges = []) {
  2232. const chunksToRequest = [];
  2233. for (const range of ranges) {
  2234. const beginChunk = this.getBeginChunk(range.begin);
  2235. const endChunk = this.getEndChunk(range.end);
  2236. for (let chunk = beginChunk; chunk < endChunk; ++chunk) {
  2237. if (!chunksToRequest.includes(chunk)) {
  2238. chunksToRequest.push(chunk);
  2239. }
  2240. }
  2241. }
  2242. chunksToRequest.sort(function (a, b) {
  2243. return a - b;
  2244. });
  2245. return this._requestChunks(chunksToRequest);
  2246. }
  2247. groupChunks(chunks) {
  2248. const groupedChunks = [];
  2249. let beginChunk = -1;
  2250. let prevChunk = -1;
  2251. for (let i = 0, ii = chunks.length; i < ii; ++i) {
  2252. const chunk = chunks[i];
  2253. if (beginChunk < 0) {
  2254. beginChunk = chunk;
  2255. }
  2256. if (prevChunk >= 0 && prevChunk + 1 !== chunk) {
  2257. groupedChunks.push({
  2258. beginChunk,
  2259. endChunk: prevChunk + 1
  2260. });
  2261. beginChunk = chunk;
  2262. }
  2263. if (i + 1 === chunks.length) {
  2264. groupedChunks.push({
  2265. beginChunk,
  2266. endChunk: chunk + 1
  2267. });
  2268. }
  2269. prevChunk = chunk;
  2270. }
  2271. return groupedChunks;
  2272. }
  2273. onProgress(args) {
  2274. this.msgHandler.send("DocProgress", {
  2275. loaded: this.stream.numChunksLoaded * this.chunkSize + args.loaded,
  2276. total: this.length
  2277. });
  2278. }
  2279. onReceiveData(args) {
  2280. const chunk = args.chunk;
  2281. const isProgressive = args.begin === undefined;
  2282. const begin = isProgressive ? this.progressiveDataLength : args.begin;
  2283. const end = begin + chunk.byteLength;
  2284. const beginChunk = Math.floor(begin / this.chunkSize);
  2285. const endChunk = end < this.length ? Math.floor(end / this.chunkSize) : Math.ceil(end / this.chunkSize);
  2286. if (isProgressive) {
  2287. this.stream.onReceiveProgressiveData(chunk);
  2288. this.progressiveDataLength = end;
  2289. } else {
  2290. this.stream.onReceiveData(begin, chunk);
  2291. }
  2292. if (this.stream.allChunksLoaded()) {
  2293. this._loadedStreamCapability.resolve(this.stream);
  2294. }
  2295. const loadedRequests = [];
  2296. for (let curChunk = beginChunk; curChunk < endChunk; ++curChunk) {
  2297. const requestIds = this._requestsByChunk.get(curChunk);
  2298. if (!requestIds) {
  2299. continue;
  2300. }
  2301. this._requestsByChunk.delete(curChunk);
  2302. for (const requestId of requestIds) {
  2303. const chunksNeeded = this._chunksNeededByRequest.get(requestId);
  2304. if (chunksNeeded.has(curChunk)) {
  2305. chunksNeeded.delete(curChunk);
  2306. }
  2307. if (chunksNeeded.size > 0) {
  2308. continue;
  2309. }
  2310. loadedRequests.push(requestId);
  2311. }
  2312. }
  2313. if (!this.disableAutoFetch && this._requestsByChunk.size === 0) {
  2314. let nextEmptyChunk;
  2315. if (this.stream.numChunksLoaded === 1) {
  2316. const lastChunk = this.stream.numChunks - 1;
  2317. if (!this.stream.hasChunk(lastChunk)) {
  2318. nextEmptyChunk = lastChunk;
  2319. }
  2320. } else {
  2321. nextEmptyChunk = this.stream.nextEmptyChunk(endChunk);
  2322. }
  2323. if (Number.isInteger(nextEmptyChunk)) {
  2324. this._requestChunks([nextEmptyChunk]);
  2325. }
  2326. }
  2327. for (const requestId of loadedRequests) {
  2328. const capability = this._promisesByRequest.get(requestId);
  2329. this._promisesByRequest.delete(requestId);
  2330. capability.resolve();
  2331. }
  2332. this.msgHandler.send("DocProgress", {
  2333. loaded: this.stream.numChunksLoaded * this.chunkSize,
  2334. total: this.length
  2335. });
  2336. }
  2337. onError(err) {
  2338. this._loadedStreamCapability.reject(err);
  2339. }
  2340. getBeginChunk(begin) {
  2341. return Math.floor(begin / this.chunkSize);
  2342. }
  2343. getEndChunk(end) {
  2344. return Math.floor((end - 1) / this.chunkSize) + 1;
  2345. }
  2346. abort(reason) {
  2347. this.aborted = true;
  2348. if (this.pdfNetworkStream) {
  2349. this.pdfNetworkStream.cancelAllRequests(reason);
  2350. }
  2351. for (const capability of this._promisesByRequest.values()) {
  2352. capability.reject(reason);
  2353. }
  2354. }
  2355. }
  2356. exports.ChunkedStreamManager = ChunkedStreamManager;
  2357. /***/ }),
  2358. /* 8 */
  2359. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  2360. Object.defineProperty(exports, "__esModule", ({
  2361. value: true
  2362. }));
  2363. exports.collectActions = collectActions;
  2364. exports.escapePDFName = escapePDFName;
  2365. exports.getArrayLookupTableFactory = getArrayLookupTableFactory;
  2366. exports.getInheritableProperty = getInheritableProperty;
  2367. exports.getLookupTableFactory = getLookupTableFactory;
  2368. exports.isWhiteSpace = isWhiteSpace;
  2369. exports.log2 = log2;
  2370. exports.parseXFAPath = parseXFAPath;
  2371. exports.readInt8 = readInt8;
  2372. exports.readUint16 = readUint16;
  2373. exports.readUint32 = readUint32;
  2374. exports.toRomanNumerals = toRomanNumerals;
  2375. exports.XRefParseException = exports.XRefEntryException = exports.MissingDataException = void 0;
  2376. var _util = __w_pdfjs_require__(2);
  2377. var _primitives = __w_pdfjs_require__(5);
  2378. function getLookupTableFactory(initializer) {
  2379. let lookup;
  2380. return function () {
  2381. if (initializer) {
  2382. lookup = Object.create(null);
  2383. initializer(lookup);
  2384. initializer = null;
  2385. }
  2386. return lookup;
  2387. };
  2388. }
  2389. function getArrayLookupTableFactory(initializer) {
  2390. let lookup;
  2391. return function () {
  2392. if (initializer) {
  2393. let arr = initializer();
  2394. initializer = null;
  2395. lookup = Object.create(null);
  2396. for (let i = 0, ii = arr.length; i < ii; i += 2) {
  2397. lookup[arr[i]] = arr[i + 1];
  2398. }
  2399. arr = null;
  2400. }
  2401. return lookup;
  2402. };
  2403. }
  2404. class MissingDataException extends _util.BaseException {
  2405. constructor(begin, end) {
  2406. super(`Missing data [${begin}, ${end})`);
  2407. this.begin = begin;
  2408. this.end = end;
  2409. }
  2410. }
  2411. exports.MissingDataException = MissingDataException;
  2412. class XRefEntryException extends _util.BaseException {}
  2413. exports.XRefEntryException = XRefEntryException;
  2414. class XRefParseException extends _util.BaseException {}
  2415. exports.XRefParseException = XRefParseException;
  2416. function getInheritableProperty({
  2417. dict,
  2418. key,
  2419. getArray = false,
  2420. stopWhenFound = true
  2421. }) {
  2422. const LOOP_LIMIT = 100;
  2423. let loopCount = 0;
  2424. let values;
  2425. while (dict) {
  2426. const value = getArray ? dict.getArray(key) : dict.get(key);
  2427. if (value !== undefined) {
  2428. if (stopWhenFound) {
  2429. return value;
  2430. }
  2431. if (!values) {
  2432. values = [];
  2433. }
  2434. values.push(value);
  2435. }
  2436. if (++loopCount > LOOP_LIMIT) {
  2437. (0, _util.warn)(`getInheritableProperty: maximum loop count exceeded for "${key}"`);
  2438. break;
  2439. }
  2440. dict = dict.get("Parent");
  2441. }
  2442. return values;
  2443. }
  2444. const ROMAN_NUMBER_MAP = ["", "C", "CC", "CCC", "CD", "D", "DC", "DCC", "DCCC", "CM", "", "X", "XX", "XXX", "XL", "L", "LX", "LXX", "LXXX", "XC", "", "I", "II", "III", "IV", "V", "VI", "VII", "VIII", "IX"];
  2445. function toRomanNumerals(number, lowerCase = false) {
  2446. (0, _util.assert)(Number.isInteger(number) && number > 0, "The number should be a positive integer.");
  2447. const romanBuf = [];
  2448. let pos;
  2449. while (number >= 1000) {
  2450. number -= 1000;
  2451. romanBuf.push("M");
  2452. }
  2453. pos = number / 100 | 0;
  2454. number %= 100;
  2455. romanBuf.push(ROMAN_NUMBER_MAP[pos]);
  2456. pos = number / 10 | 0;
  2457. number %= 10;
  2458. romanBuf.push(ROMAN_NUMBER_MAP[10 + pos]);
  2459. romanBuf.push(ROMAN_NUMBER_MAP[20 + number]);
  2460. const romanStr = romanBuf.join("");
  2461. return lowerCase ? romanStr.toLowerCase() : romanStr;
  2462. }
  2463. function log2(x) {
  2464. if (x <= 0) {
  2465. return 0;
  2466. }
  2467. return Math.ceil(Math.log2(x));
  2468. }
  2469. function readInt8(data, offset) {
  2470. return data[offset] << 24 >> 24;
  2471. }
  2472. function readUint16(data, offset) {
  2473. return data[offset] << 8 | data[offset + 1];
  2474. }
  2475. function readUint32(data, offset) {
  2476. return (data[offset] << 24 | data[offset + 1] << 16 | data[offset + 2] << 8 | data[offset + 3]) >>> 0;
  2477. }
  2478. function isWhiteSpace(ch) {
  2479. return ch === 0x20 || ch === 0x09 || ch === 0x0d || ch === 0x0a;
  2480. }
  2481. function parseXFAPath(path) {
  2482. const positionPattern = /(.+)\[([0-9]+)\]$/;
  2483. return path.split(".").map(component => {
  2484. const m = component.match(positionPattern);
  2485. if (m) {
  2486. return {
  2487. name: m[1],
  2488. pos: parseInt(m[2], 10)
  2489. };
  2490. }
  2491. return {
  2492. name: component,
  2493. pos: 0
  2494. };
  2495. });
  2496. }
  2497. function escapePDFName(str) {
  2498. const buffer = [];
  2499. let start = 0;
  2500. for (let i = 0, ii = str.length; i < ii; i++) {
  2501. const char = str.charCodeAt(i);
  2502. if (char < 0x21 || char > 0x7e || char === 0x23 || char === 0x28 || char === 0x29 || char === 0x3c || char === 0x3e || char === 0x5b || char === 0x5d || char === 0x7b || char === 0x7d || char === 0x2f || char === 0x25) {
  2503. if (start < i) {
  2504. buffer.push(str.substring(start, i));
  2505. }
  2506. buffer.push(`#${char.toString(16)}`);
  2507. start = i + 1;
  2508. }
  2509. }
  2510. if (buffer.length === 0) {
  2511. return str;
  2512. }
  2513. if (start < str.length) {
  2514. buffer.push(str.substring(start, str.length));
  2515. }
  2516. return buffer.join("");
  2517. }
  2518. function _collectJS(entry, xref, list, parents) {
  2519. if (!entry) {
  2520. return;
  2521. }
  2522. let parent = null;
  2523. if ((0, _primitives.isRef)(entry)) {
  2524. if (parents.has(entry)) {
  2525. return;
  2526. }
  2527. parent = entry;
  2528. parents.put(parent);
  2529. entry = xref.fetch(entry);
  2530. }
  2531. if (Array.isArray(entry)) {
  2532. for (const element of entry) {
  2533. _collectJS(element, xref, list, parents);
  2534. }
  2535. } else if (entry instanceof _primitives.Dict) {
  2536. if ((0, _primitives.isName)(entry.get("S"), "JavaScript") && entry.has("JS")) {
  2537. const js = entry.get("JS");
  2538. let code;
  2539. if ((0, _primitives.isStream)(js)) {
  2540. code = (0, _util.bytesToString)(js.getBytes());
  2541. } else {
  2542. code = js;
  2543. }
  2544. code = (0, _util.stringToPDFString)(code);
  2545. if (code) {
  2546. list.push(code);
  2547. }
  2548. }
  2549. _collectJS(entry.getRaw("Next"), xref, list, parents);
  2550. }
  2551. if (parent) {
  2552. parents.remove(parent);
  2553. }
  2554. }
  2555. function collectActions(xref, dict, eventType) {
  2556. const actions = Object.create(null);
  2557. if (dict.has("AA")) {
  2558. const additionalActions = dict.get("AA");
  2559. for (const key of additionalActions.getKeys()) {
  2560. const action = eventType[key];
  2561. if (!action) {
  2562. continue;
  2563. }
  2564. const actionDict = additionalActions.getRaw(key);
  2565. const parents = new _primitives.RefSet();
  2566. const list = [];
  2567. _collectJS(actionDict, xref, list, parents);
  2568. if (list.length > 0) {
  2569. actions[action] = list;
  2570. }
  2571. }
  2572. }
  2573. if (dict.has("A")) {
  2574. const actionDict = dict.get("A");
  2575. const parents = new _primitives.RefSet();
  2576. const list = [];
  2577. _collectJS(actionDict, xref, list, parents);
  2578. if (list.length > 0) {
  2579. actions.Action = list;
  2580. }
  2581. }
  2582. return (0, _util.objectSize)(actions) > 0 ? actions : null;
  2583. }
  2584. /***/ }),
  2585. /* 9 */
  2586. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  2587. Object.defineProperty(exports, "__esModule", ({
  2588. value: true
  2589. }));
  2590. exports.PDFDocument = exports.Page = void 0;
  2591. var _util = __w_pdfjs_require__(2);
  2592. var _obj = __w_pdfjs_require__(10);
  2593. var _primitives = __w_pdfjs_require__(5);
  2594. var _core_utils = __w_pdfjs_require__(8);
  2595. var _stream = __w_pdfjs_require__(12);
  2596. var _annotation = __w_pdfjs_require__(25);
  2597. var _crypto = __w_pdfjs_require__(22);
  2598. var _parser = __w_pdfjs_require__(11);
  2599. var _operator_list = __w_pdfjs_require__(44);
  2600. var _evaluator = __w_pdfjs_require__(27);
  2601. const DEFAULT_USER_UNIT = 1.0;
  2602. const LETTER_SIZE_MEDIABOX = [0, 0, 612, 792];
  2603. function isAnnotationRenderable(annotation, intent) {
  2604. return intent === "display" && annotation.viewable || intent === "print" && annotation.printable;
  2605. }
  2606. class Page {
  2607. constructor({
  2608. pdfManager,
  2609. xref,
  2610. pageIndex,
  2611. pageDict,
  2612. ref,
  2613. globalIdFactory,
  2614. fontCache,
  2615. builtInCMapCache,
  2616. globalImageCache,
  2617. nonBlendModesSet
  2618. }) {
  2619. this.pdfManager = pdfManager;
  2620. this.pageIndex = pageIndex;
  2621. this.pageDict = pageDict;
  2622. this.xref = xref;
  2623. this.ref = ref;
  2624. this.fontCache = fontCache;
  2625. this.builtInCMapCache = builtInCMapCache;
  2626. this.globalImageCache = globalImageCache;
  2627. this.nonBlendModesSet = nonBlendModesSet;
  2628. this.evaluatorOptions = pdfManager.evaluatorOptions;
  2629. this.resourcesPromise = null;
  2630. const idCounters = {
  2631. obj: 0
  2632. };
  2633. this._localIdFactory = class extends globalIdFactory {
  2634. static createObjId() {
  2635. return `p${pageIndex}_${++idCounters.obj}`;
  2636. }
  2637. };
  2638. }
  2639. _getInheritableProperty(key, getArray = false) {
  2640. const value = (0, _core_utils.getInheritableProperty)({
  2641. dict: this.pageDict,
  2642. key,
  2643. getArray,
  2644. stopWhenFound: false
  2645. });
  2646. if (!Array.isArray(value)) {
  2647. return value;
  2648. }
  2649. if (value.length === 1 || !(0, _primitives.isDict)(value[0])) {
  2650. return value[0];
  2651. }
  2652. return _primitives.Dict.merge({
  2653. xref: this.xref,
  2654. dictArray: value
  2655. });
  2656. }
  2657. get content() {
  2658. return this.pageDict.get("Contents");
  2659. }
  2660. get resources() {
  2661. return (0, _util.shadow)(this, "resources", this._getInheritableProperty("Resources") || _primitives.Dict.empty);
  2662. }
  2663. _getBoundingBox(name) {
  2664. const box = this._getInheritableProperty(name, true);
  2665. if (Array.isArray(box) && box.length === 4) {
  2666. if (box[2] - box[0] !== 0 && box[3] - box[1] !== 0) {
  2667. return box;
  2668. }
  2669. (0, _util.warn)(`Empty /${name} entry.`);
  2670. }
  2671. return null;
  2672. }
  2673. get mediaBox() {
  2674. return (0, _util.shadow)(this, "mediaBox", this._getBoundingBox("MediaBox") || LETTER_SIZE_MEDIABOX);
  2675. }
  2676. get cropBox() {
  2677. return (0, _util.shadow)(this, "cropBox", this._getBoundingBox("CropBox") || this.mediaBox);
  2678. }
  2679. get userUnit() {
  2680. let obj = this.pageDict.get("UserUnit");
  2681. if (!(0, _util.isNum)(obj) || obj <= 0) {
  2682. obj = DEFAULT_USER_UNIT;
  2683. }
  2684. return (0, _util.shadow)(this, "userUnit", obj);
  2685. }
  2686. get view() {
  2687. const {
  2688. cropBox,
  2689. mediaBox
  2690. } = this;
  2691. let view;
  2692. if (cropBox === mediaBox || (0, _util.isArrayEqual)(cropBox, mediaBox)) {
  2693. view = mediaBox;
  2694. } else {
  2695. const box = _util.Util.intersect(cropBox, mediaBox);
  2696. if (box && box[2] - box[0] !== 0 && box[3] - box[1] !== 0) {
  2697. view = box;
  2698. } else {
  2699. (0, _util.warn)("Empty /CropBox and /MediaBox intersection.");
  2700. }
  2701. }
  2702. return (0, _util.shadow)(this, "view", view || mediaBox);
  2703. }
  2704. get rotate() {
  2705. let rotate = this._getInheritableProperty("Rotate") || 0;
  2706. if (rotate % 90 !== 0) {
  2707. rotate = 0;
  2708. } else if (rotate >= 360) {
  2709. rotate = rotate % 360;
  2710. } else if (rotate < 0) {
  2711. rotate = (rotate % 360 + 360) % 360;
  2712. }
  2713. return (0, _util.shadow)(this, "rotate", rotate);
  2714. }
  2715. getContentStream() {
  2716. const content = this.content;
  2717. let stream;
  2718. if (Array.isArray(content)) {
  2719. const xref = this.xref;
  2720. const streams = [];
  2721. for (const subStream of content) {
  2722. streams.push(xref.fetchIfRef(subStream));
  2723. }
  2724. stream = new _stream.StreamsSequenceStream(streams);
  2725. } else if ((0, _primitives.isStream)(content)) {
  2726. stream = content;
  2727. } else {
  2728. stream = new _stream.NullStream();
  2729. }
  2730. return stream;
  2731. }
  2732. save(handler, task, annotationStorage) {
  2733. const partialEvaluator = new _evaluator.PartialEvaluator({
  2734. xref: this.xref,
  2735. handler,
  2736. pageIndex: this.pageIndex,
  2737. idFactory: this._localIdFactory,
  2738. fontCache: this.fontCache,
  2739. builtInCMapCache: this.builtInCMapCache,
  2740. globalImageCache: this.globalImageCache,
  2741. options: this.evaluatorOptions
  2742. });
  2743. return this._parsedAnnotations.then(function (annotations) {
  2744. const newRefsPromises = [];
  2745. for (const annotation of annotations) {
  2746. if (!isAnnotationRenderable(annotation, "print")) {
  2747. continue;
  2748. }
  2749. newRefsPromises.push(annotation.save(partialEvaluator, task, annotationStorage).catch(function (reason) {
  2750. (0, _util.warn)("save - ignoring annotation data during " + `"${task.name}" task: "${reason}".`);
  2751. return null;
  2752. }));
  2753. }
  2754. return Promise.all(newRefsPromises);
  2755. });
  2756. }
  2757. loadResources(keys) {
  2758. if (!this.resourcesPromise) {
  2759. this.resourcesPromise = this.pdfManager.ensure(this, "resources");
  2760. }
  2761. return this.resourcesPromise.then(() => {
  2762. const objectLoader = new _obj.ObjectLoader(this.resources, keys, this.xref);
  2763. return objectLoader.load();
  2764. });
  2765. }
  2766. getOperatorList({
  2767. handler,
  2768. sink,
  2769. task,
  2770. intent,
  2771. renderInteractiveForms,
  2772. annotationStorage
  2773. }) {
  2774. const contentStreamPromise = this.pdfManager.ensure(this, "getContentStream");
  2775. const resourcesPromise = this.loadResources(["ExtGState", "ColorSpace", "Pattern", "Shading", "XObject", "Font"]);
  2776. const partialEvaluator = new _evaluator.PartialEvaluator({
  2777. xref: this.xref,
  2778. handler,
  2779. pageIndex: this.pageIndex,
  2780. idFactory: this._localIdFactory,
  2781. fontCache: this.fontCache,
  2782. builtInCMapCache: this.builtInCMapCache,
  2783. globalImageCache: this.globalImageCache,
  2784. options: this.evaluatorOptions
  2785. });
  2786. const dataPromises = Promise.all([contentStreamPromise, resourcesPromise]);
  2787. const pageListPromise = dataPromises.then(([contentStream]) => {
  2788. const opList = new _operator_list.OperatorList(intent, sink);
  2789. handler.send("StartRenderPage", {
  2790. transparency: partialEvaluator.hasBlendModes(this.resources, this.nonBlendModesSet),
  2791. pageIndex: this.pageIndex,
  2792. intent
  2793. });
  2794. return partialEvaluator.getOperatorList({
  2795. stream: contentStream,
  2796. task,
  2797. resources: this.resources,
  2798. operatorList: opList
  2799. }).then(function () {
  2800. return opList;
  2801. });
  2802. });
  2803. return Promise.all([pageListPromise, this._parsedAnnotations]).then(function ([pageOpList, annotations]) {
  2804. if (annotations.length === 0) {
  2805. pageOpList.flush(true);
  2806. return {
  2807. length: pageOpList.totalLength
  2808. };
  2809. }
  2810. const opListPromises = [];
  2811. for (const annotation of annotations) {
  2812. if (isAnnotationRenderable(annotation, intent) && !annotation.isHidden(annotationStorage)) {
  2813. opListPromises.push(annotation.getOperatorList(partialEvaluator, task, renderInteractiveForms, annotationStorage).catch(function (reason) {
  2814. (0, _util.warn)("getOperatorList - ignoring annotation data during " + `"${task.name}" task: "${reason}".`);
  2815. return null;
  2816. }));
  2817. }
  2818. }
  2819. return Promise.all(opListPromises).then(function (opLists) {
  2820. pageOpList.addOp(_util.OPS.beginAnnotations, []);
  2821. for (const opList of opLists) {
  2822. pageOpList.addOpList(opList);
  2823. }
  2824. pageOpList.addOp(_util.OPS.endAnnotations, []);
  2825. pageOpList.flush(true);
  2826. return {
  2827. length: pageOpList.totalLength
  2828. };
  2829. });
  2830. });
  2831. }
  2832. extractTextContent({
  2833. handler,
  2834. task,
  2835. normalizeWhitespace,
  2836. sink,
  2837. combineTextItems
  2838. }) {
  2839. const contentStreamPromise = this.pdfManager.ensure(this, "getContentStream");
  2840. const resourcesPromise = this.loadResources(["ExtGState", "XObject", "Font"]);
  2841. const dataPromises = Promise.all([contentStreamPromise, resourcesPromise]);
  2842. return dataPromises.then(([contentStream]) => {
  2843. const partialEvaluator = new _evaluator.PartialEvaluator({
  2844. xref: this.xref,
  2845. handler,
  2846. pageIndex: this.pageIndex,
  2847. idFactory: this._localIdFactory,
  2848. fontCache: this.fontCache,
  2849. builtInCMapCache: this.builtInCMapCache,
  2850. globalImageCache: this.globalImageCache,
  2851. options: this.evaluatorOptions
  2852. });
  2853. return partialEvaluator.getTextContent({
  2854. stream: contentStream,
  2855. task,
  2856. resources: this.resources,
  2857. normalizeWhitespace,
  2858. combineTextItems,
  2859. sink
  2860. });
  2861. });
  2862. }
  2863. getAnnotationsData(intent) {
  2864. return this._parsedAnnotations.then(function (annotations) {
  2865. const annotationsData = [];
  2866. for (let i = 0, ii = annotations.length; i < ii; i++) {
  2867. if (!intent || isAnnotationRenderable(annotations[i], intent)) {
  2868. annotationsData.push(annotations[i].data);
  2869. }
  2870. }
  2871. return annotationsData;
  2872. });
  2873. }
  2874. get annotations() {
  2875. const annots = this._getInheritableProperty("Annots");
  2876. return (0, _util.shadow)(this, "annotations", Array.isArray(annots) ? annots : []);
  2877. }
  2878. get _parsedAnnotations() {
  2879. const parsedAnnotations = this.pdfManager.ensure(this, "annotations").then(() => {
  2880. const annotationPromises = [];
  2881. for (const annotationRef of this.annotations) {
  2882. annotationPromises.push(_annotation.AnnotationFactory.create(this.xref, annotationRef, this.pdfManager, this._localIdFactory).catch(function (reason) {
  2883. (0, _util.warn)(`_parsedAnnotations: "${reason}".`);
  2884. return null;
  2885. }));
  2886. }
  2887. return Promise.all(annotationPromises).then(function (annotations) {
  2888. return annotations.filter(annotation => !!annotation);
  2889. });
  2890. });
  2891. return (0, _util.shadow)(this, "_parsedAnnotations", parsedAnnotations);
  2892. }
  2893. get jsActions() {
  2894. const actions = (0, _core_utils.collectActions)(this.xref, this.pageDict, _util.PageActionEventType);
  2895. return (0, _util.shadow)(this, "jsActions", actions);
  2896. }
  2897. }
  2898. exports.Page = Page;
  2899. const PDF_HEADER_SIGNATURE = new Uint8Array([0x25, 0x50, 0x44, 0x46, 0x2d]);
  2900. const STARTXREF_SIGNATURE = new Uint8Array([0x73, 0x74, 0x61, 0x72, 0x74, 0x78, 0x72, 0x65, 0x66]);
  2901. const ENDOBJ_SIGNATURE = new Uint8Array([0x65, 0x6e, 0x64, 0x6f, 0x62, 0x6a]);
  2902. const FINGERPRINT_FIRST_BYTES = 1024;
  2903. const EMPTY_FINGERPRINT = "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00";
  2904. const PDF_HEADER_VERSION_REGEXP = /^[1-9]\.[0-9]$/;
  2905. function find(stream, signature, limit = 1024, backwards = false) {
  2906. const signatureLength = signature.length;
  2907. const scanBytes = stream.peekBytes(limit);
  2908. const scanLength = scanBytes.length - signatureLength;
  2909. if (scanLength <= 0) {
  2910. return false;
  2911. }
  2912. if (backwards) {
  2913. const signatureEnd = signatureLength - 1;
  2914. let pos = scanBytes.length - 1;
  2915. while (pos >= signatureEnd) {
  2916. let j = 0;
  2917. while (j < signatureLength && scanBytes[pos - j] === signature[signatureEnd - j]) {
  2918. j++;
  2919. }
  2920. if (j >= signatureLength) {
  2921. stream.pos += pos - signatureEnd;
  2922. return true;
  2923. }
  2924. pos--;
  2925. }
  2926. } else {
  2927. let pos = 0;
  2928. while (pos <= scanLength) {
  2929. let j = 0;
  2930. while (j < signatureLength && scanBytes[pos + j] === signature[j]) {
  2931. j++;
  2932. }
  2933. if (j >= signatureLength) {
  2934. stream.pos += pos;
  2935. return true;
  2936. }
  2937. pos++;
  2938. }
  2939. }
  2940. return false;
  2941. }
  2942. class PDFDocument {
  2943. constructor(pdfManager, arg) {
  2944. let stream;
  2945. if ((0, _primitives.isStream)(arg)) {
  2946. stream = arg;
  2947. } else if ((0, _util.isArrayBuffer)(arg)) {
  2948. stream = new _stream.Stream(arg);
  2949. } else {
  2950. throw new Error("PDFDocument: Unknown argument type");
  2951. }
  2952. if (stream.length <= 0) {
  2953. throw new _util.InvalidPDFException("The PDF file is empty, i.e. its size is zero bytes.");
  2954. }
  2955. this.pdfManager = pdfManager;
  2956. this.stream = stream;
  2957. this.xref = new _obj.XRef(stream, pdfManager);
  2958. this._pagePromises = [];
  2959. this._version = null;
  2960. const idCounters = {
  2961. font: 0
  2962. };
  2963. this._globalIdFactory = class {
  2964. static getDocId() {
  2965. return `g_${pdfManager.docId}`;
  2966. }
  2967. static createFontId() {
  2968. return `f${++idCounters.font}`;
  2969. }
  2970. static createObjId() {
  2971. (0, _util.unreachable)("Abstract method `createObjId` called.");
  2972. }
  2973. };
  2974. }
  2975. parse(recoveryMode) {
  2976. this.xref.parse(recoveryMode);
  2977. this.catalog = new _obj.Catalog(this.pdfManager, this.xref);
  2978. if (this.catalog.version) {
  2979. this._version = this.catalog.version;
  2980. }
  2981. }
  2982. get linearization() {
  2983. let linearization = null;
  2984. try {
  2985. linearization = _parser.Linearization.create(this.stream);
  2986. } catch (err) {
  2987. if (err instanceof _core_utils.MissingDataException) {
  2988. throw err;
  2989. }
  2990. (0, _util.info)(err);
  2991. }
  2992. return (0, _util.shadow)(this, "linearization", linearization);
  2993. }
  2994. get startXRef() {
  2995. const stream = this.stream;
  2996. let startXRef = 0;
  2997. if (this.linearization) {
  2998. stream.reset();
  2999. if (find(stream, ENDOBJ_SIGNATURE)) {
  3000. startXRef = stream.pos + 6 - stream.start;
  3001. }
  3002. } else {
  3003. const step = 1024;
  3004. const startXRefLength = STARTXREF_SIGNATURE.length;
  3005. let found = false,
  3006. pos = stream.end;
  3007. while (!found && pos > 0) {
  3008. pos -= step - startXRefLength;
  3009. if (pos < 0) {
  3010. pos = 0;
  3011. }
  3012. stream.pos = pos;
  3013. found = find(stream, STARTXREF_SIGNATURE, step, true);
  3014. }
  3015. if (found) {
  3016. stream.skip(9);
  3017. let ch;
  3018. do {
  3019. ch = stream.getByte();
  3020. } while ((0, _core_utils.isWhiteSpace)(ch));
  3021. let str = "";
  3022. while (ch >= 0x20 && ch <= 0x39) {
  3023. str += String.fromCharCode(ch);
  3024. ch = stream.getByte();
  3025. }
  3026. startXRef = parseInt(str, 10);
  3027. if (isNaN(startXRef)) {
  3028. startXRef = 0;
  3029. }
  3030. }
  3031. }
  3032. return (0, _util.shadow)(this, "startXRef", startXRef);
  3033. }
  3034. checkHeader() {
  3035. const stream = this.stream;
  3036. stream.reset();
  3037. if (!find(stream, PDF_HEADER_SIGNATURE)) {
  3038. return;
  3039. }
  3040. stream.moveStart();
  3041. const MAX_PDF_VERSION_LENGTH = 12;
  3042. let version = "",
  3043. ch;
  3044. while ((ch = stream.getByte()) > 0x20) {
  3045. if (version.length >= MAX_PDF_VERSION_LENGTH) {
  3046. break;
  3047. }
  3048. version += String.fromCharCode(ch);
  3049. }
  3050. if (!this._version) {
  3051. this._version = version.substring(5);
  3052. }
  3053. }
  3054. parseStartXRef() {
  3055. this.xref.setStartXRef(this.startXRef);
  3056. }
  3057. get numPages() {
  3058. const linearization = this.linearization;
  3059. const num = linearization ? linearization.numPages : this.catalog.numPages;
  3060. return (0, _util.shadow)(this, "numPages", num);
  3061. }
  3062. _hasOnlyDocumentSignatures(fields, recursionDepth = 0) {
  3063. const RECURSION_LIMIT = 10;
  3064. if (!Array.isArray(fields)) {
  3065. return false;
  3066. }
  3067. return fields.every(field => {
  3068. field = this.xref.fetchIfRef(field);
  3069. if (!(field instanceof _primitives.Dict)) {
  3070. return false;
  3071. }
  3072. if (field.has("Kids")) {
  3073. if (++recursionDepth > RECURSION_LIMIT) {
  3074. (0, _util.warn)("_hasOnlyDocumentSignatures: maximum recursion depth reached");
  3075. return false;
  3076. }
  3077. return this._hasOnlyDocumentSignatures(field.get("Kids"), recursionDepth);
  3078. }
  3079. const isSignature = (0, _primitives.isName)(field.get("FT"), "Sig");
  3080. const rectangle = field.get("Rect");
  3081. const isInvisible = Array.isArray(rectangle) && rectangle.every(value => value === 0);
  3082. return isSignature && isInvisible;
  3083. });
  3084. }
  3085. get formInfo() {
  3086. const formInfo = {
  3087. hasFields: false,
  3088. hasAcroForm: false,
  3089. hasXfa: false
  3090. };
  3091. const acroForm = this.catalog.acroForm;
  3092. if (!acroForm) {
  3093. return (0, _util.shadow)(this, "formInfo", formInfo);
  3094. }
  3095. try {
  3096. const fields = acroForm.get("Fields");
  3097. const hasFields = Array.isArray(fields) && fields.length > 0;
  3098. formInfo.hasFields = hasFields;
  3099. const xfa = acroForm.get("XFA");
  3100. formInfo.hasXfa = Array.isArray(xfa) && xfa.length > 0 || (0, _primitives.isStream)(xfa) && !xfa.isEmpty;
  3101. const sigFlags = acroForm.get("SigFlags");
  3102. const hasOnlyDocumentSignatures = !!(sigFlags & 0x1) && this._hasOnlyDocumentSignatures(fields);
  3103. formInfo.hasAcroForm = hasFields && !hasOnlyDocumentSignatures;
  3104. } catch (ex) {
  3105. if (ex instanceof _core_utils.MissingDataException) {
  3106. throw ex;
  3107. }
  3108. (0, _util.warn)(`Cannot fetch form information: "${ex}".`);
  3109. }
  3110. return (0, _util.shadow)(this, "formInfo", formInfo);
  3111. }
  3112. get documentInfo() {
  3113. const DocumentInfoValidators = {
  3114. Title: _util.isString,
  3115. Author: _util.isString,
  3116. Subject: _util.isString,
  3117. Keywords: _util.isString,
  3118. Creator: _util.isString,
  3119. Producer: _util.isString,
  3120. CreationDate: _util.isString,
  3121. ModDate: _util.isString,
  3122. Trapped: _primitives.isName
  3123. };
  3124. let version = this._version;
  3125. if (typeof version !== "string" || !PDF_HEADER_VERSION_REGEXP.test(version)) {
  3126. (0, _util.warn)(`Invalid PDF header version number: ${version}`);
  3127. version = null;
  3128. }
  3129. const docInfo = {
  3130. PDFFormatVersion: version,
  3131. IsLinearized: !!this.linearization,
  3132. IsAcroFormPresent: this.formInfo.hasAcroForm,
  3133. IsXFAPresent: this.formInfo.hasXfa,
  3134. IsCollectionPresent: !!this.catalog.collection
  3135. };
  3136. let infoDict;
  3137. try {
  3138. infoDict = this.xref.trailer.get("Info");
  3139. } catch (err) {
  3140. if (err instanceof _core_utils.MissingDataException) {
  3141. throw err;
  3142. }
  3143. (0, _util.info)("The document information dictionary is invalid.");
  3144. }
  3145. if ((0, _primitives.isDict)(infoDict)) {
  3146. for (const key of infoDict.getKeys()) {
  3147. const value = infoDict.get(key);
  3148. if (DocumentInfoValidators[key]) {
  3149. if (DocumentInfoValidators[key](value)) {
  3150. docInfo[key] = typeof value !== "string" ? value : (0, _util.stringToPDFString)(value);
  3151. } else {
  3152. (0, _util.info)(`Bad value in document info for "${key}".`);
  3153. }
  3154. } else if (typeof key === "string") {
  3155. let customValue;
  3156. if ((0, _util.isString)(value)) {
  3157. customValue = (0, _util.stringToPDFString)(value);
  3158. } else if ((0, _primitives.isName)(value) || (0, _util.isNum)(value) || (0, _util.isBool)(value)) {
  3159. customValue = value;
  3160. } else {
  3161. (0, _util.info)(`Unsupported value in document info for (custom) "${key}".`);
  3162. continue;
  3163. }
  3164. if (!docInfo.Custom) {
  3165. docInfo.Custom = Object.create(null);
  3166. }
  3167. docInfo.Custom[key] = customValue;
  3168. }
  3169. }
  3170. }
  3171. return (0, _util.shadow)(this, "documentInfo", docInfo);
  3172. }
  3173. get fingerprint() {
  3174. let hash;
  3175. const idArray = this.xref.trailer.get("ID");
  3176. if (Array.isArray(idArray) && idArray[0] && (0, _util.isString)(idArray[0]) && idArray[0] !== EMPTY_FINGERPRINT) {
  3177. hash = (0, _util.stringToBytes)(idArray[0]);
  3178. } else {
  3179. hash = (0, _crypto.calculateMD5)(this.stream.getByteRange(0, FINGERPRINT_FIRST_BYTES), 0, FINGERPRINT_FIRST_BYTES);
  3180. }
  3181. const fingerprintBuf = [];
  3182. for (let i = 0, ii = hash.length; i < ii; i++) {
  3183. const hex = hash[i].toString(16);
  3184. fingerprintBuf.push(hex.padStart(2, "0"));
  3185. }
  3186. return (0, _util.shadow)(this, "fingerprint", fingerprintBuf.join(""));
  3187. }
  3188. _getLinearizationPage(pageIndex) {
  3189. const {
  3190. catalog,
  3191. linearization
  3192. } = this;
  3193. const ref = _primitives.Ref.get(linearization.objectNumberFirst, 0);
  3194. return this.xref.fetchAsync(ref).then(obj => {
  3195. if ((0, _primitives.isDict)(obj, "Page") || (0, _primitives.isDict)(obj) && !obj.has("Type") && obj.has("Contents")) {
  3196. if (ref && !catalog.pageKidsCountCache.has(ref)) {
  3197. catalog.pageKidsCountCache.put(ref, 1);
  3198. }
  3199. return [obj, ref];
  3200. }
  3201. throw new _util.FormatError("The Linearization dictionary doesn't point " + "to a valid Page dictionary.");
  3202. }).catch(reason => {
  3203. (0, _util.info)(reason);
  3204. return catalog.getPageDict(pageIndex);
  3205. });
  3206. }
  3207. getPage(pageIndex) {
  3208. if (this._pagePromises[pageIndex] !== undefined) {
  3209. return this._pagePromises[pageIndex];
  3210. }
  3211. const {
  3212. catalog,
  3213. linearization
  3214. } = this;
  3215. const promise = linearization && linearization.pageFirst === pageIndex ? this._getLinearizationPage(pageIndex) : catalog.getPageDict(pageIndex);
  3216. return this._pagePromises[pageIndex] = promise.then(([pageDict, ref]) => {
  3217. return new Page({
  3218. pdfManager: this.pdfManager,
  3219. xref: this.xref,
  3220. pageIndex,
  3221. pageDict,
  3222. ref,
  3223. globalIdFactory: this._globalIdFactory,
  3224. fontCache: catalog.fontCache,
  3225. builtInCMapCache: catalog.builtInCMapCache,
  3226. globalImageCache: catalog.globalImageCache,
  3227. nonBlendModesSet: catalog.nonBlendModesSet
  3228. });
  3229. });
  3230. }
  3231. checkFirstPage() {
  3232. return this.getPage(0).catch(async reason => {
  3233. if (reason instanceof _core_utils.XRefEntryException) {
  3234. this._pagePromises.length = 0;
  3235. await this.cleanup();
  3236. throw new _core_utils.XRefParseException();
  3237. }
  3238. });
  3239. }
  3240. fontFallback(id, handler) {
  3241. return this.catalog.fontFallback(id, handler);
  3242. }
  3243. async cleanup(manuallyTriggered = false) {
  3244. return this.catalog ? this.catalog.cleanup(manuallyTriggered) : (0, _primitives.clearPrimitiveCaches)();
  3245. }
  3246. _collectFieldObjects(name, fieldRef, promises) {
  3247. const field = this.xref.fetchIfRef(fieldRef);
  3248. if (field.has("T")) {
  3249. const partName = (0, _util.stringToPDFString)(field.get("T"));
  3250. if (name === "") {
  3251. name = partName;
  3252. } else {
  3253. name = `${name}.${partName}`;
  3254. }
  3255. }
  3256. if (!promises.has(name)) {
  3257. promises.set(name, []);
  3258. }
  3259. promises.get(name).push(_annotation.AnnotationFactory.create(this.xref, fieldRef, this.pdfManager, this._localIdFactory).then(annotation => annotation && annotation.getFieldObject()).catch(function (reason) {
  3260. (0, _util.warn)(`_collectFieldObjects: "${reason}".`);
  3261. return null;
  3262. }));
  3263. if (field.has("Kids")) {
  3264. const kids = field.get("Kids");
  3265. for (const kid of kids) {
  3266. this._collectFieldObjects(name, kid, promises);
  3267. }
  3268. }
  3269. }
  3270. get fieldObjects() {
  3271. if (!this.formInfo.hasFields) {
  3272. return (0, _util.shadow)(this, "fieldObjects", Promise.resolve(null));
  3273. }
  3274. const allFields = Object.create(null);
  3275. const fieldPromises = new Map();
  3276. for (const fieldRef of this.catalog.acroForm.get("Fields")) {
  3277. this._collectFieldObjects("", fieldRef, fieldPromises);
  3278. }
  3279. const allPromises = [];
  3280. for (const [name, promises] of fieldPromises) {
  3281. allPromises.push(Promise.all(promises).then(fields => {
  3282. fields = fields.filter(field => !!field);
  3283. if (fields.length > 0) {
  3284. allFields[name] = fields;
  3285. }
  3286. }));
  3287. }
  3288. return (0, _util.shadow)(this, "fieldObjects", Promise.all(allPromises).then(() => allFields));
  3289. }
  3290. get hasJSActions() {
  3291. return (0, _util.shadow)(this, "hasJSActions", this.fieldObjects.then(fieldObjects => {
  3292. return fieldObjects !== null && Object.values(fieldObjects).some(fieldObject => fieldObject.some(object => object.actions !== null)) || !!this.catalog.jsActions;
  3293. }));
  3294. }
  3295. get calculationOrderIds() {
  3296. const acroForm = this.catalog.acroForm;
  3297. if (!acroForm || !acroForm.has("CO")) {
  3298. return (0, _util.shadow)(this, "calculationOrderIds", null);
  3299. }
  3300. const calculationOrder = acroForm.get("CO");
  3301. if (!Array.isArray(calculationOrder) || calculationOrder.length === 0) {
  3302. return (0, _util.shadow)(this, "calculationOrderIds", null);
  3303. }
  3304. const ids = calculationOrder.filter(_primitives.isRef).map(ref => ref.toString());
  3305. if (ids.length === 0) {
  3306. return (0, _util.shadow)(this, "calculationOrderIds", null);
  3307. }
  3308. return (0, _util.shadow)(this, "calculationOrderIds", ids);
  3309. }
  3310. }
  3311. exports.PDFDocument = PDFDocument;
  3312. /***/ }),
  3313. /* 10 */
  3314. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  3315. Object.defineProperty(exports, "__esModule", ({
  3316. value: true
  3317. }));
  3318. exports.XRef = exports.ObjectLoader = exports.FileSpec = exports.Catalog = void 0;
  3319. var _util = __w_pdfjs_require__(2);
  3320. var _primitives = __w_pdfjs_require__(5);
  3321. var _core_utils = __w_pdfjs_require__(8);
  3322. var _parser = __w_pdfjs_require__(11);
  3323. var _crypto = __w_pdfjs_require__(22);
  3324. var _colorspace = __w_pdfjs_require__(23);
  3325. var _image_utils = __w_pdfjs_require__(24);
  3326. function fetchDestination(dest) {
  3327. return (0, _primitives.isDict)(dest) ? dest.get("D") : dest;
  3328. }
  3329. class Catalog {
  3330. constructor(pdfManager, xref) {
  3331. this.pdfManager = pdfManager;
  3332. this.xref = xref;
  3333. this._catDict = xref.getCatalogObj();
  3334. if (!(0, _primitives.isDict)(this._catDict)) {
  3335. throw new _util.FormatError("Catalog object is not a dictionary.");
  3336. }
  3337. this.fontCache = new _primitives.RefSetCache();
  3338. this.builtInCMapCache = new Map();
  3339. this.globalImageCache = new _image_utils.GlobalImageCache();
  3340. this.pageKidsCountCache = new _primitives.RefSetCache();
  3341. this.nonBlendModesSet = new _primitives.RefSet();
  3342. }
  3343. get version() {
  3344. const version = this._catDict.get("Version");
  3345. if (!(0, _primitives.isName)(version)) {
  3346. return (0, _util.shadow)(this, "version", null);
  3347. }
  3348. return (0, _util.shadow)(this, "version", version.name);
  3349. }
  3350. get collection() {
  3351. let collection = null;
  3352. try {
  3353. const obj = this._catDict.get("Collection");
  3354. if ((0, _primitives.isDict)(obj) && obj.size > 0) {
  3355. collection = obj;
  3356. }
  3357. } catch (ex) {
  3358. if (ex instanceof _core_utils.MissingDataException) {
  3359. throw ex;
  3360. }
  3361. (0, _util.info)("Cannot fetch Collection entry; assuming no collection is present.");
  3362. }
  3363. return (0, _util.shadow)(this, "collection", collection);
  3364. }
  3365. get acroForm() {
  3366. let acroForm = null;
  3367. try {
  3368. const obj = this._catDict.get("AcroForm");
  3369. if ((0, _primitives.isDict)(obj) && obj.size > 0) {
  3370. acroForm = obj;
  3371. }
  3372. } catch (ex) {
  3373. if (ex instanceof _core_utils.MissingDataException) {
  3374. throw ex;
  3375. }
  3376. (0, _util.info)("Cannot fetch AcroForm entry; assuming no forms are present.");
  3377. }
  3378. return (0, _util.shadow)(this, "acroForm", acroForm);
  3379. }
  3380. get metadata() {
  3381. const streamRef = this._catDict.getRaw("Metadata");
  3382. if (!(0, _primitives.isRef)(streamRef)) {
  3383. return (0, _util.shadow)(this, "metadata", null);
  3384. }
  3385. const suppressEncryption = !(this.xref.encrypt && this.xref.encrypt.encryptMetadata);
  3386. const stream = this.xref.fetch(streamRef, suppressEncryption);
  3387. let metadata;
  3388. if (stream && (0, _primitives.isDict)(stream.dict)) {
  3389. const type = stream.dict.get("Type");
  3390. const subtype = stream.dict.get("Subtype");
  3391. if ((0, _primitives.isName)(type, "Metadata") && (0, _primitives.isName)(subtype, "XML")) {
  3392. try {
  3393. metadata = (0, _util.stringToUTF8String)((0, _util.bytesToString)(stream.getBytes()));
  3394. } catch (e) {
  3395. if (e instanceof _core_utils.MissingDataException) {
  3396. throw e;
  3397. }
  3398. (0, _util.info)("Skipping invalid metadata.");
  3399. }
  3400. }
  3401. }
  3402. return (0, _util.shadow)(this, "metadata", metadata);
  3403. }
  3404. get markInfo() {
  3405. let markInfo = null;
  3406. try {
  3407. markInfo = this._readMarkInfo();
  3408. } catch (ex) {
  3409. if (ex instanceof _core_utils.MissingDataException) {
  3410. throw ex;
  3411. }
  3412. (0, _util.warn)("Unable to read mark info.");
  3413. }
  3414. return (0, _util.shadow)(this, "markInfo", markInfo);
  3415. }
  3416. _readMarkInfo() {
  3417. const obj = this._catDict.get("MarkInfo");
  3418. if (!(0, _primitives.isDict)(obj)) {
  3419. return null;
  3420. }
  3421. const markInfo = Object.assign(Object.create(null), {
  3422. Marked: false,
  3423. UserProperties: false,
  3424. Suspects: false
  3425. });
  3426. for (const key in markInfo) {
  3427. if (!obj.has(key)) {
  3428. continue;
  3429. }
  3430. const value = obj.get(key);
  3431. if (!(0, _util.isBool)(value)) {
  3432. continue;
  3433. }
  3434. markInfo[key] = value;
  3435. }
  3436. return markInfo;
  3437. }
  3438. get toplevelPagesDict() {
  3439. const pagesObj = this._catDict.get("Pages");
  3440. if (!(0, _primitives.isDict)(pagesObj)) {
  3441. throw new _util.FormatError("Invalid top-level pages dictionary.");
  3442. }
  3443. return (0, _util.shadow)(this, "toplevelPagesDict", pagesObj);
  3444. }
  3445. get documentOutline() {
  3446. let obj = null;
  3447. try {
  3448. obj = this._readDocumentOutline();
  3449. } catch (ex) {
  3450. if (ex instanceof _core_utils.MissingDataException) {
  3451. throw ex;
  3452. }
  3453. (0, _util.warn)("Unable to read document outline.");
  3454. }
  3455. return (0, _util.shadow)(this, "documentOutline", obj);
  3456. }
  3457. _readDocumentOutline() {
  3458. let obj = this._catDict.get("Outlines");
  3459. if (!(0, _primitives.isDict)(obj)) {
  3460. return null;
  3461. }
  3462. obj = obj.getRaw("First");
  3463. if (!(0, _primitives.isRef)(obj)) {
  3464. return null;
  3465. }
  3466. const root = {
  3467. items: []
  3468. };
  3469. const queue = [{
  3470. obj,
  3471. parent: root
  3472. }];
  3473. const processed = new _primitives.RefSet();
  3474. processed.put(obj);
  3475. const xref = this.xref,
  3476. blackColor = new Uint8ClampedArray(3);
  3477. while (queue.length > 0) {
  3478. const i = queue.shift();
  3479. const outlineDict = xref.fetchIfRef(i.obj);
  3480. if (outlineDict === null) {
  3481. continue;
  3482. }
  3483. if (!outlineDict.has("Title")) {
  3484. throw new _util.FormatError("Invalid outline item encountered.");
  3485. }
  3486. const data = {
  3487. url: null,
  3488. dest: null
  3489. };
  3490. Catalog.parseDestDictionary({
  3491. destDict: outlineDict,
  3492. resultObj: data,
  3493. docBaseUrl: this.pdfManager.docBaseUrl
  3494. });
  3495. const title = outlineDict.get("Title");
  3496. const flags = outlineDict.get("F") || 0;
  3497. const color = outlineDict.getArray("C");
  3498. const count = outlineDict.get("Count");
  3499. let rgbColor = blackColor;
  3500. if (Array.isArray(color) && color.length === 3 && (color[0] !== 0 || color[1] !== 0 || color[2] !== 0)) {
  3501. rgbColor = _colorspace.ColorSpace.singletons.rgb.getRgb(color, 0);
  3502. }
  3503. const outlineItem = {
  3504. dest: data.dest,
  3505. url: data.url,
  3506. unsafeUrl: data.unsafeUrl,
  3507. newWindow: data.newWindow,
  3508. title: (0, _util.stringToPDFString)(title),
  3509. color: rgbColor,
  3510. count: Number.isInteger(count) ? count : undefined,
  3511. bold: !!(flags & 2),
  3512. italic: !!(flags & 1),
  3513. items: []
  3514. };
  3515. i.parent.items.push(outlineItem);
  3516. obj = outlineDict.getRaw("First");
  3517. if ((0, _primitives.isRef)(obj) && !processed.has(obj)) {
  3518. queue.push({
  3519. obj,
  3520. parent: outlineItem
  3521. });
  3522. processed.put(obj);
  3523. }
  3524. obj = outlineDict.getRaw("Next");
  3525. if ((0, _primitives.isRef)(obj) && !processed.has(obj)) {
  3526. queue.push({
  3527. obj,
  3528. parent: i.parent
  3529. });
  3530. processed.put(obj);
  3531. }
  3532. }
  3533. return root.items.length > 0 ? root.items : null;
  3534. }
  3535. get permissions() {
  3536. let permissions = null;
  3537. try {
  3538. permissions = this._readPermissions();
  3539. } catch (ex) {
  3540. if (ex instanceof _core_utils.MissingDataException) {
  3541. throw ex;
  3542. }
  3543. (0, _util.warn)("Unable to read permissions.");
  3544. }
  3545. return (0, _util.shadow)(this, "permissions", permissions);
  3546. }
  3547. _readPermissions() {
  3548. const encrypt = this.xref.trailer.get("Encrypt");
  3549. if (!(0, _primitives.isDict)(encrypt)) {
  3550. return null;
  3551. }
  3552. let flags = encrypt.get("P");
  3553. if (!(0, _util.isNum)(flags)) {
  3554. return null;
  3555. }
  3556. flags += 2 ** 32;
  3557. const permissions = [];
  3558. for (const key in _util.PermissionFlag) {
  3559. const value = _util.PermissionFlag[key];
  3560. if (flags & value) {
  3561. permissions.push(value);
  3562. }
  3563. }
  3564. return permissions;
  3565. }
  3566. get optionalContentConfig() {
  3567. let config = null;
  3568. try {
  3569. const properties = this._catDict.get("OCProperties");
  3570. if (!properties) {
  3571. return (0, _util.shadow)(this, "optionalContentConfig", null);
  3572. }
  3573. const defaultConfig = properties.get("D");
  3574. if (!defaultConfig) {
  3575. return (0, _util.shadow)(this, "optionalContentConfig", null);
  3576. }
  3577. const groupsData = properties.get("OCGs");
  3578. if (!Array.isArray(groupsData)) {
  3579. return (0, _util.shadow)(this, "optionalContentConfig", null);
  3580. }
  3581. const groups = [];
  3582. const groupRefs = [];
  3583. for (const groupRef of groupsData) {
  3584. if (!(0, _primitives.isRef)(groupRef)) {
  3585. continue;
  3586. }
  3587. groupRefs.push(groupRef);
  3588. const group = this.xref.fetchIfRef(groupRef);
  3589. groups.push({
  3590. id: groupRef.toString(),
  3591. name: (0, _util.isString)(group.get("Name")) ? (0, _util.stringToPDFString)(group.get("Name")) : null,
  3592. intent: (0, _util.isString)(group.get("Intent")) ? (0, _util.stringToPDFString)(group.get("Intent")) : null
  3593. });
  3594. }
  3595. config = this._readOptionalContentConfig(defaultConfig, groupRefs);
  3596. config.groups = groups;
  3597. } catch (ex) {
  3598. if (ex instanceof _core_utils.MissingDataException) {
  3599. throw ex;
  3600. }
  3601. (0, _util.warn)(`Unable to read optional content config: ${ex}`);
  3602. }
  3603. return (0, _util.shadow)(this, "optionalContentConfig", config);
  3604. }
  3605. _readOptionalContentConfig(config, contentGroupRefs) {
  3606. function parseOnOff(refs) {
  3607. const onParsed = [];
  3608. if (Array.isArray(refs)) {
  3609. for (const value of refs) {
  3610. if (!(0, _primitives.isRef)(value)) {
  3611. continue;
  3612. }
  3613. if (contentGroupRefs.includes(value)) {
  3614. onParsed.push(value.toString());
  3615. }
  3616. }
  3617. }
  3618. return onParsed;
  3619. }
  3620. function parseOrder(refs, nestedLevels = 0) {
  3621. if (!Array.isArray(refs)) {
  3622. return null;
  3623. }
  3624. const order = [];
  3625. for (const value of refs) {
  3626. if ((0, _primitives.isRef)(value) && contentGroupRefs.includes(value)) {
  3627. parsedOrderRefs.put(value);
  3628. order.push(value.toString());
  3629. continue;
  3630. }
  3631. const nestedOrder = parseNestedOrder(value, nestedLevels);
  3632. if (nestedOrder) {
  3633. order.push(nestedOrder);
  3634. }
  3635. }
  3636. if (nestedLevels > 0) {
  3637. return order;
  3638. }
  3639. const hiddenGroups = [];
  3640. for (const groupRef of contentGroupRefs) {
  3641. if (parsedOrderRefs.has(groupRef)) {
  3642. continue;
  3643. }
  3644. hiddenGroups.push(groupRef.toString());
  3645. }
  3646. if (hiddenGroups.length) {
  3647. order.push({
  3648. name: null,
  3649. order: hiddenGroups
  3650. });
  3651. }
  3652. return order;
  3653. }
  3654. function parseNestedOrder(ref, nestedLevels) {
  3655. if (++nestedLevels > MAX_NESTED_LEVELS) {
  3656. (0, _util.warn)("parseNestedOrder - reached MAX_NESTED_LEVELS.");
  3657. return null;
  3658. }
  3659. const value = xref.fetchIfRef(ref);
  3660. if (!Array.isArray(value)) {
  3661. return null;
  3662. }
  3663. const nestedName = xref.fetchIfRef(value[0]);
  3664. if (typeof nestedName !== "string") {
  3665. return null;
  3666. }
  3667. const nestedOrder = parseOrder(value.slice(1), nestedLevels);
  3668. if (!nestedOrder || !nestedOrder.length) {
  3669. return null;
  3670. }
  3671. return {
  3672. name: (0, _util.stringToPDFString)(nestedName),
  3673. order: nestedOrder
  3674. };
  3675. }
  3676. const xref = this.xref,
  3677. parsedOrderRefs = new _primitives.RefSet(),
  3678. MAX_NESTED_LEVELS = 10;
  3679. return {
  3680. name: (0, _util.isString)(config.get("Name")) ? (0, _util.stringToPDFString)(config.get("Name")) : null,
  3681. creator: (0, _util.isString)(config.get("Creator")) ? (0, _util.stringToPDFString)(config.get("Creator")) : null,
  3682. baseState: (0, _primitives.isName)(config.get("BaseState")) ? config.get("BaseState").name : null,
  3683. on: parseOnOff(config.get("ON")),
  3684. off: parseOnOff(config.get("OFF")),
  3685. order: parseOrder(config.get("Order")),
  3686. groups: null
  3687. };
  3688. }
  3689. get numPages() {
  3690. const obj = this.toplevelPagesDict.get("Count");
  3691. if (!Number.isInteger(obj)) {
  3692. throw new _util.FormatError("Page count in top-level pages dictionary is not an integer.");
  3693. }
  3694. return (0, _util.shadow)(this, "numPages", obj);
  3695. }
  3696. get destinations() {
  3697. const obj = this._readDests(),
  3698. dests = Object.create(null);
  3699. if (obj instanceof NameTree) {
  3700. const names = obj.getAll();
  3701. for (const name in names) {
  3702. dests[name] = fetchDestination(names[name]);
  3703. }
  3704. } else if (obj instanceof _primitives.Dict) {
  3705. obj.forEach(function (key, value) {
  3706. if (value) {
  3707. dests[key] = fetchDestination(value);
  3708. }
  3709. });
  3710. }
  3711. return (0, _util.shadow)(this, "destinations", dests);
  3712. }
  3713. getDestination(destinationId) {
  3714. const obj = this._readDests();
  3715. if (obj instanceof NameTree || obj instanceof _primitives.Dict) {
  3716. return fetchDestination(obj.get(destinationId) || null);
  3717. }
  3718. return null;
  3719. }
  3720. _readDests() {
  3721. const obj = this._catDict.get("Names");
  3722. if (obj && obj.has("Dests")) {
  3723. return new NameTree(obj.getRaw("Dests"), this.xref);
  3724. } else if (this._catDict.has("Dests")) {
  3725. return this._catDict.get("Dests");
  3726. }
  3727. return undefined;
  3728. }
  3729. get pageLabels() {
  3730. let obj = null;
  3731. try {
  3732. obj = this._readPageLabels();
  3733. } catch (ex) {
  3734. if (ex instanceof _core_utils.MissingDataException) {
  3735. throw ex;
  3736. }
  3737. (0, _util.warn)("Unable to read page labels.");
  3738. }
  3739. return (0, _util.shadow)(this, "pageLabels", obj);
  3740. }
  3741. _readPageLabels() {
  3742. const obj = this._catDict.getRaw("PageLabels");
  3743. if (!obj) {
  3744. return null;
  3745. }
  3746. const pageLabels = new Array(this.numPages);
  3747. let style = null,
  3748. prefix = "";
  3749. const numberTree = new NumberTree(obj, this.xref);
  3750. const nums = numberTree.getAll();
  3751. let currentLabel = "",
  3752. currentIndex = 1;
  3753. for (let i = 0, ii = this.numPages; i < ii; i++) {
  3754. if (i in nums) {
  3755. const labelDict = nums[i];
  3756. if (!(0, _primitives.isDict)(labelDict)) {
  3757. throw new _util.FormatError("PageLabel is not a dictionary.");
  3758. }
  3759. if (labelDict.has("Type") && !(0, _primitives.isName)(labelDict.get("Type"), "PageLabel")) {
  3760. throw new _util.FormatError("Invalid type in PageLabel dictionary.");
  3761. }
  3762. if (labelDict.has("S")) {
  3763. const s = labelDict.get("S");
  3764. if (!(0, _primitives.isName)(s)) {
  3765. throw new _util.FormatError("Invalid style in PageLabel dictionary.");
  3766. }
  3767. style = s.name;
  3768. } else {
  3769. style = null;
  3770. }
  3771. if (labelDict.has("P")) {
  3772. const p = labelDict.get("P");
  3773. if (!(0, _util.isString)(p)) {
  3774. throw new _util.FormatError("Invalid prefix in PageLabel dictionary.");
  3775. }
  3776. prefix = (0, _util.stringToPDFString)(p);
  3777. } else {
  3778. prefix = "";
  3779. }
  3780. if (labelDict.has("St")) {
  3781. const st = labelDict.get("St");
  3782. if (!(Number.isInteger(st) && st >= 1)) {
  3783. throw new _util.FormatError("Invalid start in PageLabel dictionary.");
  3784. }
  3785. currentIndex = st;
  3786. } else {
  3787. currentIndex = 1;
  3788. }
  3789. }
  3790. switch (style) {
  3791. case "D":
  3792. currentLabel = currentIndex;
  3793. break;
  3794. case "R":
  3795. case "r":
  3796. currentLabel = (0, _core_utils.toRomanNumerals)(currentIndex, style === "r");
  3797. break;
  3798. case "A":
  3799. case "a":
  3800. const LIMIT = 26;
  3801. const A_UPPER_CASE = 0x41,
  3802. A_LOWER_CASE = 0x61;
  3803. const baseCharCode = style === "a" ? A_LOWER_CASE : A_UPPER_CASE;
  3804. const letterIndex = currentIndex - 1;
  3805. const character = String.fromCharCode(baseCharCode + letterIndex % LIMIT);
  3806. const charBuf = [];
  3807. for (let j = 0, jj = letterIndex / LIMIT | 0; j <= jj; j++) {
  3808. charBuf.push(character);
  3809. }
  3810. currentLabel = charBuf.join("");
  3811. break;
  3812. default:
  3813. if (style) {
  3814. throw new _util.FormatError(`Invalid style "${style}" in PageLabel dictionary.`);
  3815. }
  3816. currentLabel = "";
  3817. }
  3818. pageLabels[i] = prefix + currentLabel;
  3819. currentIndex++;
  3820. }
  3821. return pageLabels;
  3822. }
  3823. get pageLayout() {
  3824. const obj = this._catDict.get("PageLayout");
  3825. let pageLayout = "";
  3826. if ((0, _primitives.isName)(obj)) {
  3827. switch (obj.name) {
  3828. case "SinglePage":
  3829. case "OneColumn":
  3830. case "TwoColumnLeft":
  3831. case "TwoColumnRight":
  3832. case "TwoPageLeft":
  3833. case "TwoPageRight":
  3834. pageLayout = obj.name;
  3835. }
  3836. }
  3837. return (0, _util.shadow)(this, "pageLayout", pageLayout);
  3838. }
  3839. get pageMode() {
  3840. const obj = this._catDict.get("PageMode");
  3841. let pageMode = "UseNone";
  3842. if ((0, _primitives.isName)(obj)) {
  3843. switch (obj.name) {
  3844. case "UseNone":
  3845. case "UseOutlines":
  3846. case "UseThumbs":
  3847. case "FullScreen":
  3848. case "UseOC":
  3849. case "UseAttachments":
  3850. pageMode = obj.name;
  3851. }
  3852. }
  3853. return (0, _util.shadow)(this, "pageMode", pageMode);
  3854. }
  3855. get viewerPreferences() {
  3856. const ViewerPreferencesValidators = {
  3857. HideToolbar: _util.isBool,
  3858. HideMenubar: _util.isBool,
  3859. HideWindowUI: _util.isBool,
  3860. FitWindow: _util.isBool,
  3861. CenterWindow: _util.isBool,
  3862. DisplayDocTitle: _util.isBool,
  3863. NonFullScreenPageMode: _primitives.isName,
  3864. Direction: _primitives.isName,
  3865. ViewArea: _primitives.isName,
  3866. ViewClip: _primitives.isName,
  3867. PrintArea: _primitives.isName,
  3868. PrintClip: _primitives.isName,
  3869. PrintScaling: _primitives.isName,
  3870. Duplex: _primitives.isName,
  3871. PickTrayByPDFSize: _util.isBool,
  3872. PrintPageRange: Array.isArray,
  3873. NumCopies: Number.isInteger
  3874. };
  3875. const obj = this._catDict.get("ViewerPreferences");
  3876. let prefs = null;
  3877. if ((0, _primitives.isDict)(obj)) {
  3878. for (const key in ViewerPreferencesValidators) {
  3879. if (!obj.has(key)) {
  3880. continue;
  3881. }
  3882. const value = obj.get(key);
  3883. if (!ViewerPreferencesValidators[key](value)) {
  3884. (0, _util.info)(`Bad value in ViewerPreferences for "${key}".`);
  3885. continue;
  3886. }
  3887. let prefValue;
  3888. switch (key) {
  3889. case "NonFullScreenPageMode":
  3890. switch (value.name) {
  3891. case "UseNone":
  3892. case "UseOutlines":
  3893. case "UseThumbs":
  3894. case "UseOC":
  3895. prefValue = value.name;
  3896. break;
  3897. default:
  3898. prefValue = "UseNone";
  3899. }
  3900. break;
  3901. case "Direction":
  3902. switch (value.name) {
  3903. case "L2R":
  3904. case "R2L":
  3905. prefValue = value.name;
  3906. break;
  3907. default:
  3908. prefValue = "L2R";
  3909. }
  3910. break;
  3911. case "ViewArea":
  3912. case "ViewClip":
  3913. case "PrintArea":
  3914. case "PrintClip":
  3915. switch (value.name) {
  3916. case "MediaBox":
  3917. case "CropBox":
  3918. case "BleedBox":
  3919. case "TrimBox":
  3920. case "ArtBox":
  3921. prefValue = value.name;
  3922. break;
  3923. default:
  3924. prefValue = "CropBox";
  3925. }
  3926. break;
  3927. case "PrintScaling":
  3928. switch (value.name) {
  3929. case "None":
  3930. case "AppDefault":
  3931. prefValue = value.name;
  3932. break;
  3933. default:
  3934. prefValue = "AppDefault";
  3935. }
  3936. break;
  3937. case "Duplex":
  3938. switch (value.name) {
  3939. case "Simplex":
  3940. case "DuplexFlipShortEdge":
  3941. case "DuplexFlipLongEdge":
  3942. prefValue = value.name;
  3943. break;
  3944. default:
  3945. prefValue = "None";
  3946. }
  3947. break;
  3948. case "PrintPageRange":
  3949. const length = value.length;
  3950. if (length % 2 !== 0) {
  3951. break;
  3952. }
  3953. const isValid = value.every((page, i, arr) => {
  3954. return Number.isInteger(page) && page > 0 && (i === 0 || page >= arr[i - 1]) && page <= this.numPages;
  3955. });
  3956. if (isValid) {
  3957. prefValue = value;
  3958. }
  3959. break;
  3960. case "NumCopies":
  3961. if (value > 0) {
  3962. prefValue = value;
  3963. }
  3964. break;
  3965. default:
  3966. if (typeof value !== "boolean") {
  3967. throw new _util.FormatError(`viewerPreferences - expected a boolean value for: ${key}`);
  3968. }
  3969. prefValue = value;
  3970. }
  3971. if (prefValue !== undefined) {
  3972. if (!prefs) {
  3973. prefs = Object.create(null);
  3974. }
  3975. prefs[key] = prefValue;
  3976. } else {
  3977. (0, _util.info)(`Bad value in ViewerPreferences for "${key}".`);
  3978. }
  3979. }
  3980. }
  3981. return (0, _util.shadow)(this, "viewerPreferences", prefs);
  3982. }
  3983. get openAction() {
  3984. const obj = this._catDict.get("OpenAction");
  3985. const openAction = Object.create(null);
  3986. if ((0, _primitives.isDict)(obj)) {
  3987. const destDict = new _primitives.Dict(this.xref);
  3988. destDict.set("A", obj);
  3989. const resultObj = {
  3990. url: null,
  3991. dest: null,
  3992. action: null
  3993. };
  3994. Catalog.parseDestDictionary({
  3995. destDict,
  3996. resultObj
  3997. });
  3998. if (Array.isArray(resultObj.dest)) {
  3999. openAction.dest = resultObj.dest;
  4000. } else if (resultObj.action) {
  4001. openAction.action = resultObj.action;
  4002. }
  4003. } else if (Array.isArray(obj)) {
  4004. openAction.dest = obj;
  4005. }
  4006. return (0, _util.shadow)(this, "openAction", (0, _util.objectSize)(openAction) > 0 ? openAction : null);
  4007. }
  4008. get attachments() {
  4009. const obj = this._catDict.get("Names");
  4010. let attachments = null;
  4011. if (obj && obj.has("EmbeddedFiles")) {
  4012. const nameTree = new NameTree(obj.getRaw("EmbeddedFiles"), this.xref);
  4013. const names = nameTree.getAll();
  4014. for (const name in names) {
  4015. const fs = new FileSpec(names[name], this.xref);
  4016. if (!attachments) {
  4017. attachments = Object.create(null);
  4018. }
  4019. attachments[(0, _util.stringToPDFString)(name)] = fs.serializable;
  4020. }
  4021. }
  4022. return (0, _util.shadow)(this, "attachments", attachments);
  4023. }
  4024. _collectJavaScript() {
  4025. const obj = this._catDict.get("Names");
  4026. let javaScript = null;
  4027. function appendIfJavaScriptDict(name, jsDict) {
  4028. const type = jsDict.get("S");
  4029. if (!(0, _primitives.isName)(type, "JavaScript")) {
  4030. return;
  4031. }
  4032. let js = jsDict.get("JS");
  4033. if ((0, _primitives.isStream)(js)) {
  4034. js = (0, _util.bytesToString)(js.getBytes());
  4035. } else if (!(0, _util.isString)(js)) {
  4036. return;
  4037. }
  4038. if (javaScript === null) {
  4039. javaScript = Object.create(null);
  4040. }
  4041. javaScript[name] = (0, _util.stringToPDFString)(js);
  4042. }
  4043. if (obj && obj.has("JavaScript")) {
  4044. const nameTree = new NameTree(obj.getRaw("JavaScript"), this.xref);
  4045. const names = nameTree.getAll();
  4046. for (const name in names) {
  4047. const jsDict = names[name];
  4048. if ((0, _primitives.isDict)(jsDict)) {
  4049. appendIfJavaScriptDict(name, jsDict);
  4050. }
  4051. }
  4052. }
  4053. const openAction = this._catDict.get("OpenAction");
  4054. if ((0, _primitives.isDict)(openAction) && (0, _primitives.isName)(openAction.get("S"), "JavaScript")) {
  4055. appendIfJavaScriptDict("OpenAction", openAction);
  4056. }
  4057. return javaScript;
  4058. }
  4059. get javaScript() {
  4060. const javaScript = this._collectJavaScript();
  4061. return (0, _util.shadow)(this, "javaScript", javaScript ? Object.values(javaScript) : null);
  4062. }
  4063. get jsActions() {
  4064. const js = this._collectJavaScript();
  4065. let actions = (0, _core_utils.collectActions)(this.xref, this._catDict, _util.DocumentActionEventType);
  4066. if (!actions && js) {
  4067. actions = Object.create(null);
  4068. }
  4069. if (actions && js) {
  4070. for (const [key, val] of Object.entries(js)) {
  4071. if (key in actions) {
  4072. actions[key].push(val);
  4073. } else {
  4074. actions[key] = [val];
  4075. }
  4076. }
  4077. }
  4078. return (0, _util.shadow)(this, "jsActions", actions);
  4079. }
  4080. fontFallback(id, handler) {
  4081. const promises = [];
  4082. this.fontCache.forEach(function (promise) {
  4083. promises.push(promise);
  4084. });
  4085. return Promise.all(promises).then(translatedFonts => {
  4086. for (const translatedFont of translatedFonts) {
  4087. if (translatedFont.loadedName === id) {
  4088. translatedFont.fallback(handler);
  4089. return;
  4090. }
  4091. }
  4092. });
  4093. }
  4094. cleanup(manuallyTriggered = false) {
  4095. (0, _primitives.clearPrimitiveCaches)();
  4096. this.globalImageCache.clear(manuallyTriggered);
  4097. this.pageKidsCountCache.clear();
  4098. this.nonBlendModesSet.clear();
  4099. const promises = [];
  4100. this.fontCache.forEach(function (promise) {
  4101. promises.push(promise);
  4102. });
  4103. return Promise.all(promises).then(translatedFonts => {
  4104. for (const {
  4105. dict
  4106. } of translatedFonts) {
  4107. delete dict.cacheKey;
  4108. }
  4109. this.fontCache.clear();
  4110. this.builtInCMapCache.clear();
  4111. });
  4112. }
  4113. getPageDict(pageIndex) {
  4114. const capability = (0, _util.createPromiseCapability)();
  4115. const nodesToVisit = [this._catDict.getRaw("Pages")];
  4116. const visitedNodes = new _primitives.RefSet();
  4117. const xref = this.xref,
  4118. pageKidsCountCache = this.pageKidsCountCache;
  4119. let count,
  4120. currentPageIndex = 0;
  4121. function next() {
  4122. while (nodesToVisit.length) {
  4123. const currentNode = nodesToVisit.pop();
  4124. if ((0, _primitives.isRef)(currentNode)) {
  4125. count = pageKidsCountCache.get(currentNode);
  4126. if (count > 0 && currentPageIndex + count < pageIndex) {
  4127. currentPageIndex += count;
  4128. continue;
  4129. }
  4130. if (visitedNodes.has(currentNode)) {
  4131. capability.reject(new _util.FormatError("Pages tree contains circular reference."));
  4132. return;
  4133. }
  4134. visitedNodes.put(currentNode);
  4135. xref.fetchAsync(currentNode).then(function (obj) {
  4136. if ((0, _primitives.isDict)(obj, "Page") || (0, _primitives.isDict)(obj) && !obj.has("Kids")) {
  4137. if (pageIndex === currentPageIndex) {
  4138. if (currentNode && !pageKidsCountCache.has(currentNode)) {
  4139. pageKidsCountCache.put(currentNode, 1);
  4140. }
  4141. capability.resolve([obj, currentNode]);
  4142. } else {
  4143. currentPageIndex++;
  4144. next();
  4145. }
  4146. return;
  4147. }
  4148. nodesToVisit.push(obj);
  4149. next();
  4150. }, capability.reject);
  4151. return;
  4152. }
  4153. if (!(0, _primitives.isDict)(currentNode)) {
  4154. capability.reject(new _util.FormatError("Page dictionary kid reference points to wrong type of object."));
  4155. return;
  4156. }
  4157. count = currentNode.get("Count");
  4158. if (Number.isInteger(count) && count >= 0) {
  4159. const objId = currentNode.objId;
  4160. if (objId && !pageKidsCountCache.has(objId)) {
  4161. pageKidsCountCache.put(objId, count);
  4162. }
  4163. if (currentPageIndex + count <= pageIndex) {
  4164. currentPageIndex += count;
  4165. continue;
  4166. }
  4167. }
  4168. const kids = currentNode.get("Kids");
  4169. if (!Array.isArray(kids)) {
  4170. if ((0, _primitives.isName)(currentNode.get("Type"), "Page") || !currentNode.has("Type") && currentNode.has("Contents")) {
  4171. if (currentPageIndex === pageIndex) {
  4172. capability.resolve([currentNode, null]);
  4173. return;
  4174. }
  4175. currentPageIndex++;
  4176. continue;
  4177. }
  4178. capability.reject(new _util.FormatError("Page dictionary kids object is not an array."));
  4179. return;
  4180. }
  4181. for (let last = kids.length - 1; last >= 0; last--) {
  4182. nodesToVisit.push(kids[last]);
  4183. }
  4184. }
  4185. capability.reject(new Error(`Page index ${pageIndex} not found.`));
  4186. }
  4187. next();
  4188. return capability.promise;
  4189. }
  4190. getPageIndex(pageRef) {
  4191. const xref = this.xref;
  4192. function pagesBeforeRef(kidRef) {
  4193. let total = 0,
  4194. parentRef;
  4195. return xref.fetchAsync(kidRef).then(function (node) {
  4196. if ((0, _primitives.isRefsEqual)(kidRef, pageRef) && !(0, _primitives.isDict)(node, "Page") && !((0, _primitives.isDict)(node) && !node.has("Type") && node.has("Contents"))) {
  4197. throw new _util.FormatError("The reference does not point to a /Page dictionary.");
  4198. }
  4199. if (!node) {
  4200. return null;
  4201. }
  4202. if (!(0, _primitives.isDict)(node)) {
  4203. throw new _util.FormatError("Node must be a dictionary.");
  4204. }
  4205. parentRef = node.getRaw("Parent");
  4206. return node.getAsync("Parent");
  4207. }).then(function (parent) {
  4208. if (!parent) {
  4209. return null;
  4210. }
  4211. if (!(0, _primitives.isDict)(parent)) {
  4212. throw new _util.FormatError("Parent must be a dictionary.");
  4213. }
  4214. return parent.getAsync("Kids");
  4215. }).then(function (kids) {
  4216. if (!kids) {
  4217. return null;
  4218. }
  4219. const kidPromises = [];
  4220. let found = false;
  4221. for (let i = 0, ii = kids.length; i < ii; i++) {
  4222. const kid = kids[i];
  4223. if (!(0, _primitives.isRef)(kid)) {
  4224. throw new _util.FormatError("Kid must be a reference.");
  4225. }
  4226. if ((0, _primitives.isRefsEqual)(kid, kidRef)) {
  4227. found = true;
  4228. break;
  4229. }
  4230. kidPromises.push(xref.fetchAsync(kid).then(function (obj) {
  4231. if (!(0, _primitives.isDict)(obj)) {
  4232. throw new _util.FormatError("Kid node must be a dictionary.");
  4233. }
  4234. if (obj.has("Count")) {
  4235. total += obj.get("Count");
  4236. } else {
  4237. total++;
  4238. }
  4239. }));
  4240. }
  4241. if (!found) {
  4242. throw new _util.FormatError("Kid reference not found in parent's kids.");
  4243. }
  4244. return Promise.all(kidPromises).then(function () {
  4245. return [total, parentRef];
  4246. });
  4247. });
  4248. }
  4249. let total = 0;
  4250. function next(ref) {
  4251. return pagesBeforeRef(ref).then(function (args) {
  4252. if (!args) {
  4253. return total;
  4254. }
  4255. const [count, parentRef] = args;
  4256. total += count;
  4257. return next(parentRef);
  4258. });
  4259. }
  4260. return next(pageRef);
  4261. }
  4262. static parseDestDictionary(params) {
  4263. function addDefaultProtocolToUrl(url) {
  4264. return url.startsWith("www.") ? `http://${url}` : url;
  4265. }
  4266. function tryConvertUrlEncoding(url) {
  4267. try {
  4268. return (0, _util.stringToUTF8String)(url);
  4269. } catch (e) {
  4270. return url;
  4271. }
  4272. }
  4273. const destDict = params.destDict;
  4274. if (!(0, _primitives.isDict)(destDict)) {
  4275. (0, _util.warn)("parseDestDictionary: `destDict` must be a dictionary.");
  4276. return;
  4277. }
  4278. const resultObj = params.resultObj;
  4279. if (typeof resultObj !== "object") {
  4280. (0, _util.warn)("parseDestDictionary: `resultObj` must be an object.");
  4281. return;
  4282. }
  4283. const docBaseUrl = params.docBaseUrl || null;
  4284. let action = destDict.get("A"),
  4285. url,
  4286. dest;
  4287. if (!(0, _primitives.isDict)(action)) {
  4288. if (destDict.has("Dest")) {
  4289. action = destDict.get("Dest");
  4290. } else {
  4291. action = destDict.get("AA");
  4292. if ((0, _primitives.isDict)(action)) {
  4293. if (action.has("D")) {
  4294. action = action.get("D");
  4295. } else if (action.has("U")) {
  4296. action = action.get("U");
  4297. }
  4298. }
  4299. }
  4300. }
  4301. if ((0, _primitives.isDict)(action)) {
  4302. const actionType = action.get("S");
  4303. if (!(0, _primitives.isName)(actionType)) {
  4304. (0, _util.warn)("parseDestDictionary: Invalid type in Action dictionary.");
  4305. return;
  4306. }
  4307. const actionName = actionType.name;
  4308. switch (actionName) {
  4309. case "URI":
  4310. url = action.get("URI");
  4311. if ((0, _primitives.isName)(url)) {
  4312. url = "/" + url.name;
  4313. } else if ((0, _util.isString)(url)) {
  4314. url = addDefaultProtocolToUrl(url);
  4315. }
  4316. break;
  4317. case "GoTo":
  4318. dest = action.get("D");
  4319. break;
  4320. case "Launch":
  4321. case "GoToR":
  4322. const urlDict = action.get("F");
  4323. if ((0, _primitives.isDict)(urlDict)) {
  4324. url = urlDict.get("F") || null;
  4325. } else if ((0, _util.isString)(urlDict)) {
  4326. url = urlDict;
  4327. }
  4328. let remoteDest = action.get("D");
  4329. if (remoteDest) {
  4330. if ((0, _primitives.isName)(remoteDest)) {
  4331. remoteDest = remoteDest.name;
  4332. }
  4333. if ((0, _util.isString)(url)) {
  4334. const baseUrl = url.split("#")[0];
  4335. if ((0, _util.isString)(remoteDest)) {
  4336. url = baseUrl + "#" + remoteDest;
  4337. } else if (Array.isArray(remoteDest)) {
  4338. url = baseUrl + "#" + JSON.stringify(remoteDest);
  4339. }
  4340. }
  4341. }
  4342. const newWindow = action.get("NewWindow");
  4343. if ((0, _util.isBool)(newWindow)) {
  4344. resultObj.newWindow = newWindow;
  4345. }
  4346. break;
  4347. case "Named":
  4348. const namedAction = action.get("N");
  4349. if ((0, _primitives.isName)(namedAction)) {
  4350. resultObj.action = namedAction.name;
  4351. }
  4352. break;
  4353. case "JavaScript":
  4354. const jsAction = action.get("JS");
  4355. let js;
  4356. if ((0, _primitives.isStream)(jsAction)) {
  4357. js = (0, _util.bytesToString)(jsAction.getBytes());
  4358. } else if ((0, _util.isString)(jsAction)) {
  4359. js = jsAction;
  4360. }
  4361. if (js) {
  4362. const URL_OPEN_METHODS = ["app.launchURL", "window.open"];
  4363. const regex = new RegExp("^\\s*(" + URL_OPEN_METHODS.join("|").split(".").join("\\.") + ")\\((?:'|\")([^'\"]*)(?:'|\")(?:,\\s*(\\w+)\\)|\\))", "i");
  4364. const jsUrl = regex.exec((0, _util.stringToPDFString)(js));
  4365. if (jsUrl && jsUrl[2]) {
  4366. url = jsUrl[2];
  4367. if (jsUrl[3] === "true" && jsUrl[1] === "app.launchURL") {
  4368. resultObj.newWindow = true;
  4369. }
  4370. break;
  4371. }
  4372. }
  4373. default:
  4374. (0, _util.warn)(`parseDestDictionary: unsupported action type "${actionName}".`);
  4375. break;
  4376. }
  4377. } else if (destDict.has("Dest")) {
  4378. dest = destDict.get("Dest");
  4379. }
  4380. if ((0, _util.isString)(url)) {
  4381. url = tryConvertUrlEncoding(url);
  4382. const absoluteUrl = (0, _util.createValidAbsoluteUrl)(url, docBaseUrl);
  4383. if (absoluteUrl) {
  4384. resultObj.url = absoluteUrl.href;
  4385. }
  4386. resultObj.unsafeUrl = url;
  4387. }
  4388. if (dest) {
  4389. if ((0, _primitives.isName)(dest)) {
  4390. dest = dest.name;
  4391. }
  4392. if ((0, _util.isString)(dest) || Array.isArray(dest)) {
  4393. resultObj.dest = dest;
  4394. }
  4395. }
  4396. }
  4397. }
  4398. exports.Catalog = Catalog;
  4399. var XRef = function XRefClosure() {
  4400. function XRef(stream, pdfManager) {
  4401. this.stream = stream;
  4402. this.pdfManager = pdfManager;
  4403. this.entries = [];
  4404. this.xrefstms = Object.create(null);
  4405. this._cacheMap = new Map();
  4406. this.stats = {
  4407. streamTypes: Object.create(null),
  4408. fontTypes: Object.create(null)
  4409. };
  4410. this._newRefNum = null;
  4411. }
  4412. XRef.prototype = {
  4413. getNewRef: function XRef_getNewRef() {
  4414. if (this._newRefNum === null) {
  4415. this._newRefNum = this.entries.length;
  4416. }
  4417. return _primitives.Ref.get(this._newRefNum++, 0);
  4418. },
  4419. resetNewRef: function XRef_resetNewRef() {
  4420. this._newRefNum = null;
  4421. },
  4422. setStartXRef: function XRef_setStartXRef(startXRef) {
  4423. this.startXRefQueue = [startXRef];
  4424. },
  4425. parse: function XRef_parse(recoveryMode) {
  4426. var trailerDict;
  4427. if (!recoveryMode) {
  4428. trailerDict = this.readXRef();
  4429. } else {
  4430. (0, _util.warn)("Indexing all PDF objects");
  4431. trailerDict = this.indexObjects();
  4432. }
  4433. trailerDict.assignXref(this);
  4434. this.trailer = trailerDict;
  4435. let encrypt;
  4436. try {
  4437. encrypt = trailerDict.get("Encrypt");
  4438. } catch (ex) {
  4439. if (ex instanceof _core_utils.MissingDataException) {
  4440. throw ex;
  4441. }
  4442. (0, _util.warn)(`XRef.parse - Invalid "Encrypt" reference: "${ex}".`);
  4443. }
  4444. if ((0, _primitives.isDict)(encrypt)) {
  4445. var ids = trailerDict.get("ID");
  4446. var fileId = ids && ids.length ? ids[0] : "";
  4447. encrypt.suppressEncryption = true;
  4448. this.encrypt = new _crypto.CipherTransformFactory(encrypt, fileId, this.pdfManager.password);
  4449. }
  4450. let root;
  4451. try {
  4452. root = trailerDict.get("Root");
  4453. } catch (ex) {
  4454. if (ex instanceof _core_utils.MissingDataException) {
  4455. throw ex;
  4456. }
  4457. (0, _util.warn)(`XRef.parse - Invalid "Root" reference: "${ex}".`);
  4458. }
  4459. if ((0, _primitives.isDict)(root) && root.has("Pages")) {
  4460. this.root = root;
  4461. } else {
  4462. if (!recoveryMode) {
  4463. throw new _core_utils.XRefParseException();
  4464. }
  4465. throw new _util.FormatError("Invalid root reference");
  4466. }
  4467. },
  4468. processXRefTable: function XRef_processXRefTable(parser) {
  4469. if (!("tableState" in this)) {
  4470. this.tableState = {
  4471. entryNum: 0,
  4472. streamPos: parser.lexer.stream.pos,
  4473. parserBuf1: parser.buf1,
  4474. parserBuf2: parser.buf2
  4475. };
  4476. }
  4477. var obj = this.readXRefTable(parser);
  4478. if (!(0, _primitives.isCmd)(obj, "trailer")) {
  4479. throw new _util.FormatError("Invalid XRef table: could not find trailer dictionary");
  4480. }
  4481. var dict = parser.getObj();
  4482. if (!(0, _primitives.isDict)(dict) && dict.dict) {
  4483. dict = dict.dict;
  4484. }
  4485. if (!(0, _primitives.isDict)(dict)) {
  4486. throw new _util.FormatError("Invalid XRef table: could not parse trailer dictionary");
  4487. }
  4488. delete this.tableState;
  4489. return dict;
  4490. },
  4491. readXRefTable: function XRef_readXRefTable(parser) {
  4492. var stream = parser.lexer.stream;
  4493. var tableState = this.tableState;
  4494. stream.pos = tableState.streamPos;
  4495. parser.buf1 = tableState.parserBuf1;
  4496. parser.buf2 = tableState.parserBuf2;
  4497. var obj;
  4498. while (true) {
  4499. if (!("firstEntryNum" in tableState) || !("entryCount" in tableState)) {
  4500. if ((0, _primitives.isCmd)(obj = parser.getObj(), "trailer")) {
  4501. break;
  4502. }
  4503. tableState.firstEntryNum = obj;
  4504. tableState.entryCount = parser.getObj();
  4505. }
  4506. var first = tableState.firstEntryNum;
  4507. var count = tableState.entryCount;
  4508. if (!Number.isInteger(first) || !Number.isInteger(count)) {
  4509. throw new _util.FormatError("Invalid XRef table: wrong types in subsection header");
  4510. }
  4511. for (var i = tableState.entryNum; i < count; i++) {
  4512. tableState.streamPos = stream.pos;
  4513. tableState.entryNum = i;
  4514. tableState.parserBuf1 = parser.buf1;
  4515. tableState.parserBuf2 = parser.buf2;
  4516. var entry = {};
  4517. entry.offset = parser.getObj();
  4518. entry.gen = parser.getObj();
  4519. var type = parser.getObj();
  4520. if (type instanceof _primitives.Cmd) {
  4521. switch (type.cmd) {
  4522. case "f":
  4523. entry.free = true;
  4524. break;
  4525. case "n":
  4526. entry.uncompressed = true;
  4527. break;
  4528. }
  4529. }
  4530. if (!Number.isInteger(entry.offset) || !Number.isInteger(entry.gen) || !(entry.free || entry.uncompressed)) {
  4531. throw new _util.FormatError(`Invalid entry in XRef subsection: ${first}, ${count}`);
  4532. }
  4533. if (i === 0 && entry.free && first === 1) {
  4534. first = 0;
  4535. }
  4536. if (!this.entries[i + first]) {
  4537. this.entries[i + first] = entry;
  4538. }
  4539. }
  4540. tableState.entryNum = 0;
  4541. tableState.streamPos = stream.pos;
  4542. tableState.parserBuf1 = parser.buf1;
  4543. tableState.parserBuf2 = parser.buf2;
  4544. delete tableState.firstEntryNum;
  4545. delete tableState.entryCount;
  4546. }
  4547. if (this.entries[0] && !this.entries[0].free) {
  4548. throw new _util.FormatError("Invalid XRef table: unexpected first object");
  4549. }
  4550. return obj;
  4551. },
  4552. processXRefStream: function XRef_processXRefStream(stream) {
  4553. if (!("streamState" in this)) {
  4554. var streamParameters = stream.dict;
  4555. var byteWidths = streamParameters.get("W");
  4556. var range = streamParameters.get("Index");
  4557. if (!range) {
  4558. range = [0, streamParameters.get("Size")];
  4559. }
  4560. this.streamState = {
  4561. entryRanges: range,
  4562. byteWidths,
  4563. entryNum: 0,
  4564. streamPos: stream.pos
  4565. };
  4566. }
  4567. this.readXRefStream(stream);
  4568. delete this.streamState;
  4569. return stream.dict;
  4570. },
  4571. readXRefStream: function XRef_readXRefStream(stream) {
  4572. var i, j;
  4573. var streamState = this.streamState;
  4574. stream.pos = streamState.streamPos;
  4575. var byteWidths = streamState.byteWidths;
  4576. var typeFieldWidth = byteWidths[0];
  4577. var offsetFieldWidth = byteWidths[1];
  4578. var generationFieldWidth = byteWidths[2];
  4579. var entryRanges = streamState.entryRanges;
  4580. while (entryRanges.length > 0) {
  4581. var first = entryRanges[0];
  4582. var n = entryRanges[1];
  4583. if (!Number.isInteger(first) || !Number.isInteger(n)) {
  4584. throw new _util.FormatError(`Invalid XRef range fields: ${first}, ${n}`);
  4585. }
  4586. if (!Number.isInteger(typeFieldWidth) || !Number.isInteger(offsetFieldWidth) || !Number.isInteger(generationFieldWidth)) {
  4587. throw new _util.FormatError(`Invalid XRef entry fields length: ${first}, ${n}`);
  4588. }
  4589. for (i = streamState.entryNum; i < n; ++i) {
  4590. streamState.entryNum = i;
  4591. streamState.streamPos = stream.pos;
  4592. var type = 0,
  4593. offset = 0,
  4594. generation = 0;
  4595. for (j = 0; j < typeFieldWidth; ++j) {
  4596. type = type << 8 | stream.getByte();
  4597. }
  4598. if (typeFieldWidth === 0) {
  4599. type = 1;
  4600. }
  4601. for (j = 0; j < offsetFieldWidth; ++j) {
  4602. offset = offset << 8 | stream.getByte();
  4603. }
  4604. for (j = 0; j < generationFieldWidth; ++j) {
  4605. generation = generation << 8 | stream.getByte();
  4606. }
  4607. var entry = {};
  4608. entry.offset = offset;
  4609. entry.gen = generation;
  4610. switch (type) {
  4611. case 0:
  4612. entry.free = true;
  4613. break;
  4614. case 1:
  4615. entry.uncompressed = true;
  4616. break;
  4617. case 2:
  4618. break;
  4619. default:
  4620. throw new _util.FormatError(`Invalid XRef entry type: ${type}`);
  4621. }
  4622. if (!this.entries[first + i]) {
  4623. this.entries[first + i] = entry;
  4624. }
  4625. }
  4626. streamState.entryNum = 0;
  4627. streamState.streamPos = stream.pos;
  4628. entryRanges.splice(0, 2);
  4629. }
  4630. },
  4631. indexObjects: function XRef_indexObjects() {
  4632. var TAB = 0x9,
  4633. LF = 0xa,
  4634. CR = 0xd,
  4635. SPACE = 0x20;
  4636. var PERCENT = 0x25,
  4637. LT = 0x3c;
  4638. function readToken(data, offset) {
  4639. var token = "",
  4640. ch = data[offset];
  4641. while (ch !== LF && ch !== CR && ch !== LT) {
  4642. if (++offset >= data.length) {
  4643. break;
  4644. }
  4645. token += String.fromCharCode(ch);
  4646. ch = data[offset];
  4647. }
  4648. return token;
  4649. }
  4650. function skipUntil(data, offset, what) {
  4651. var length = what.length,
  4652. dataLength = data.length;
  4653. var skipped = 0;
  4654. while (offset < dataLength) {
  4655. var i = 0;
  4656. while (i < length && data[offset + i] === what[i]) {
  4657. ++i;
  4658. }
  4659. if (i >= length) {
  4660. break;
  4661. }
  4662. offset++;
  4663. skipped++;
  4664. }
  4665. return skipped;
  4666. }
  4667. var objRegExp = /^(\d+)\s+(\d+)\s+obj\b/;
  4668. const endobjRegExp = /\bendobj[\b\s]$/;
  4669. const nestedObjRegExp = /\s+(\d+\s+\d+\s+obj[\b\s<])$/;
  4670. const CHECK_CONTENT_LENGTH = 25;
  4671. var trailerBytes = new Uint8Array([116, 114, 97, 105, 108, 101, 114]);
  4672. var startxrefBytes = new Uint8Array([115, 116, 97, 114, 116, 120, 114, 101, 102]);
  4673. const objBytes = new Uint8Array([111, 98, 106]);
  4674. var xrefBytes = new Uint8Array([47, 88, 82, 101, 102]);
  4675. this.entries.length = 0;
  4676. var stream = this.stream;
  4677. stream.pos = 0;
  4678. var buffer = stream.getBytes();
  4679. var position = stream.start,
  4680. length = buffer.length;
  4681. var trailers = [],
  4682. xrefStms = [];
  4683. while (position < length) {
  4684. var ch = buffer[position];
  4685. if (ch === TAB || ch === LF || ch === CR || ch === SPACE) {
  4686. ++position;
  4687. continue;
  4688. }
  4689. if (ch === PERCENT) {
  4690. do {
  4691. ++position;
  4692. if (position >= length) {
  4693. break;
  4694. }
  4695. ch = buffer[position];
  4696. } while (ch !== LF && ch !== CR);
  4697. continue;
  4698. }
  4699. var token = readToken(buffer, position);
  4700. var m;
  4701. if (token.startsWith("xref") && (token.length === 4 || /\s/.test(token[4]))) {
  4702. position += skipUntil(buffer, position, trailerBytes);
  4703. trailers.push(position);
  4704. position += skipUntil(buffer, position, startxrefBytes);
  4705. } else if (m = objRegExp.exec(token)) {
  4706. const num = m[1] | 0,
  4707. gen = m[2] | 0;
  4708. if (!this.entries[num] || this.entries[num].gen === gen) {
  4709. this.entries[num] = {
  4710. offset: position - stream.start,
  4711. gen,
  4712. uncompressed: true
  4713. };
  4714. }
  4715. let contentLength,
  4716. startPos = position + token.length;
  4717. while (startPos < buffer.length) {
  4718. const endPos = startPos + skipUntil(buffer, startPos, objBytes) + 4;
  4719. contentLength = endPos - position;
  4720. const checkPos = Math.max(endPos - CHECK_CONTENT_LENGTH, startPos);
  4721. const tokenStr = (0, _util.bytesToString)(buffer.subarray(checkPos, endPos));
  4722. if (endobjRegExp.test(tokenStr)) {
  4723. break;
  4724. } else {
  4725. const objToken = nestedObjRegExp.exec(tokenStr);
  4726. if (objToken && objToken[1]) {
  4727. (0, _util.warn)('indexObjects: Found new "obj" inside of another "obj", ' + 'caused by missing "endobj" -- trying to recover.');
  4728. contentLength -= objToken[1].length;
  4729. break;
  4730. }
  4731. }
  4732. startPos = endPos;
  4733. }
  4734. const content = buffer.subarray(position, position + contentLength);
  4735. var xrefTagOffset = skipUntil(content, 0, xrefBytes);
  4736. if (xrefTagOffset < contentLength && content[xrefTagOffset + 5] < 64) {
  4737. xrefStms.push(position - stream.start);
  4738. this.xrefstms[position - stream.start] = 1;
  4739. }
  4740. position += contentLength;
  4741. } else if (token.startsWith("trailer") && (token.length === 7 || /\s/.test(token[7]))) {
  4742. trailers.push(position);
  4743. position += skipUntil(buffer, position, startxrefBytes);
  4744. } else {
  4745. position += token.length + 1;
  4746. }
  4747. }
  4748. for (let i = 0, ii = xrefStms.length; i < ii; ++i) {
  4749. this.startXRefQueue.push(xrefStms[i]);
  4750. this.readXRef(true);
  4751. }
  4752. let trailerDict;
  4753. for (let i = 0, ii = trailers.length; i < ii; ++i) {
  4754. stream.pos = trailers[i];
  4755. const parser = new _parser.Parser({
  4756. lexer: new _parser.Lexer(stream),
  4757. xref: this,
  4758. allowStreams: true,
  4759. recoveryMode: true
  4760. });
  4761. var obj = parser.getObj();
  4762. if (!(0, _primitives.isCmd)(obj, "trailer")) {
  4763. continue;
  4764. }
  4765. const dict = parser.getObj();
  4766. if (!(0, _primitives.isDict)(dict)) {
  4767. continue;
  4768. }
  4769. try {
  4770. const rootDict = dict.get("Root");
  4771. if (!(rootDict instanceof _primitives.Dict)) {
  4772. continue;
  4773. }
  4774. const pagesDict = rootDict.get("Pages");
  4775. if (!(pagesDict instanceof _primitives.Dict)) {
  4776. continue;
  4777. }
  4778. const pagesCount = pagesDict.get("Count");
  4779. if (!Number.isInteger(pagesCount)) {
  4780. continue;
  4781. }
  4782. } catch (ex) {
  4783. if (ex instanceof _core_utils.MissingDataException) {
  4784. throw ex;
  4785. }
  4786. continue;
  4787. }
  4788. if (dict.has("ID")) {
  4789. return dict;
  4790. }
  4791. trailerDict = dict;
  4792. }
  4793. if (trailerDict) {
  4794. return trailerDict;
  4795. }
  4796. throw new _util.InvalidPDFException("Invalid PDF structure.");
  4797. },
  4798. readXRef: function XRef_readXRef(recoveryMode) {
  4799. var stream = this.stream;
  4800. const startXRefParsedCache = Object.create(null);
  4801. try {
  4802. while (this.startXRefQueue.length) {
  4803. var startXRef = this.startXRefQueue[0];
  4804. if (startXRefParsedCache[startXRef]) {
  4805. (0, _util.warn)("readXRef - skipping XRef table since it was already parsed.");
  4806. this.startXRefQueue.shift();
  4807. continue;
  4808. }
  4809. startXRefParsedCache[startXRef] = true;
  4810. stream.pos = startXRef + stream.start;
  4811. const parser = new _parser.Parser({
  4812. lexer: new _parser.Lexer(stream),
  4813. xref: this,
  4814. allowStreams: true
  4815. });
  4816. var obj = parser.getObj();
  4817. var dict;
  4818. if ((0, _primitives.isCmd)(obj, "xref")) {
  4819. dict = this.processXRefTable(parser);
  4820. if (!this.topDict) {
  4821. this.topDict = dict;
  4822. }
  4823. obj = dict.get("XRefStm");
  4824. if (Number.isInteger(obj)) {
  4825. var pos = obj;
  4826. if (!(pos in this.xrefstms)) {
  4827. this.xrefstms[pos] = 1;
  4828. this.startXRefQueue.push(pos);
  4829. }
  4830. }
  4831. } else if (Number.isInteger(obj)) {
  4832. if (!Number.isInteger(parser.getObj()) || !(0, _primitives.isCmd)(parser.getObj(), "obj") || !(0, _primitives.isStream)(obj = parser.getObj())) {
  4833. throw new _util.FormatError("Invalid XRef stream");
  4834. }
  4835. dict = this.processXRefStream(obj);
  4836. if (!this.topDict) {
  4837. this.topDict = dict;
  4838. }
  4839. if (!dict) {
  4840. throw new _util.FormatError("Failed to read XRef stream");
  4841. }
  4842. } else {
  4843. throw new _util.FormatError("Invalid XRef stream header");
  4844. }
  4845. obj = dict.get("Prev");
  4846. if (Number.isInteger(obj)) {
  4847. this.startXRefQueue.push(obj);
  4848. } else if ((0, _primitives.isRef)(obj)) {
  4849. this.startXRefQueue.push(obj.num);
  4850. }
  4851. this.startXRefQueue.shift();
  4852. }
  4853. return this.topDict;
  4854. } catch (e) {
  4855. if (e instanceof _core_utils.MissingDataException) {
  4856. throw e;
  4857. }
  4858. (0, _util.info)("(while reading XRef): " + e);
  4859. }
  4860. if (recoveryMode) {
  4861. return undefined;
  4862. }
  4863. throw new _core_utils.XRefParseException();
  4864. },
  4865. getEntry: function XRef_getEntry(i) {
  4866. var xrefEntry = this.entries[i];
  4867. if (xrefEntry && !xrefEntry.free && xrefEntry.offset) {
  4868. return xrefEntry;
  4869. }
  4870. return null;
  4871. },
  4872. fetchIfRef: function XRef_fetchIfRef(obj, suppressEncryption) {
  4873. if (obj instanceof _primitives.Ref) {
  4874. return this.fetch(obj, suppressEncryption);
  4875. }
  4876. return obj;
  4877. },
  4878. fetch: function XRef_fetch(ref, suppressEncryption) {
  4879. if (!(ref instanceof _primitives.Ref)) {
  4880. throw new Error("ref object is not a reference");
  4881. }
  4882. const num = ref.num;
  4883. const cacheEntry = this._cacheMap.get(num);
  4884. if (cacheEntry !== undefined) {
  4885. if (cacheEntry instanceof _primitives.Dict && !cacheEntry.objId) {
  4886. cacheEntry.objId = ref.toString();
  4887. }
  4888. return cacheEntry;
  4889. }
  4890. let xrefEntry = this.getEntry(num);
  4891. if (xrefEntry === null) {
  4892. this._cacheMap.set(num, xrefEntry);
  4893. return xrefEntry;
  4894. }
  4895. if (xrefEntry.uncompressed) {
  4896. xrefEntry = this.fetchUncompressed(ref, xrefEntry, suppressEncryption);
  4897. } else {
  4898. xrefEntry = this.fetchCompressed(ref, xrefEntry, suppressEncryption);
  4899. }
  4900. if ((0, _primitives.isDict)(xrefEntry)) {
  4901. xrefEntry.objId = ref.toString();
  4902. } else if ((0, _primitives.isStream)(xrefEntry)) {
  4903. xrefEntry.dict.objId = ref.toString();
  4904. }
  4905. return xrefEntry;
  4906. },
  4907. fetchUncompressed(ref, xrefEntry, suppressEncryption = false) {
  4908. var gen = ref.gen;
  4909. var num = ref.num;
  4910. if (xrefEntry.gen !== gen) {
  4911. throw new _core_utils.XRefEntryException(`Inconsistent generation in XRef: ${ref}`);
  4912. }
  4913. var stream = this.stream.makeSubStream(xrefEntry.offset + this.stream.start);
  4914. const parser = new _parser.Parser({
  4915. lexer: new _parser.Lexer(stream),
  4916. xref: this,
  4917. allowStreams: true
  4918. });
  4919. var obj1 = parser.getObj();
  4920. var obj2 = parser.getObj();
  4921. var obj3 = parser.getObj();
  4922. if (obj1 !== num || obj2 !== gen || !(obj3 instanceof _primitives.Cmd)) {
  4923. throw new _core_utils.XRefEntryException(`Bad (uncompressed) XRef entry: ${ref}`);
  4924. }
  4925. if (obj3.cmd !== "obj") {
  4926. if (obj3.cmd.startsWith("obj")) {
  4927. num = parseInt(obj3.cmd.substring(3), 10);
  4928. if (!Number.isNaN(num)) {
  4929. return num;
  4930. }
  4931. }
  4932. throw new _core_utils.XRefEntryException(`Bad (uncompressed) XRef entry: ${ref}`);
  4933. }
  4934. if (this.encrypt && !suppressEncryption) {
  4935. xrefEntry = parser.getObj(this.encrypt.createCipherTransform(num, gen));
  4936. } else {
  4937. xrefEntry = parser.getObj();
  4938. }
  4939. if (!(0, _primitives.isStream)(xrefEntry)) {
  4940. this._cacheMap.set(num, xrefEntry);
  4941. }
  4942. return xrefEntry;
  4943. },
  4944. fetchCompressed(ref, xrefEntry, suppressEncryption = false) {
  4945. const tableOffset = xrefEntry.offset;
  4946. const stream = this.fetch(_primitives.Ref.get(tableOffset, 0));
  4947. if (!(0, _primitives.isStream)(stream)) {
  4948. throw new _util.FormatError("bad ObjStm stream");
  4949. }
  4950. const first = stream.dict.get("First");
  4951. const n = stream.dict.get("N");
  4952. if (!Number.isInteger(first) || !Number.isInteger(n)) {
  4953. throw new _util.FormatError("invalid first and n parameters for ObjStm stream");
  4954. }
  4955. const parser = new _parser.Parser({
  4956. lexer: new _parser.Lexer(stream),
  4957. xref: this,
  4958. allowStreams: true
  4959. });
  4960. const nums = new Array(n);
  4961. for (let i = 0; i < n; ++i) {
  4962. const num = parser.getObj();
  4963. if (!Number.isInteger(num)) {
  4964. throw new _util.FormatError(`invalid object number in the ObjStm stream: ${num}`);
  4965. }
  4966. const offset = parser.getObj();
  4967. if (!Number.isInteger(offset)) {
  4968. throw new _util.FormatError(`invalid object offset in the ObjStm stream: ${offset}`);
  4969. }
  4970. nums[i] = num;
  4971. }
  4972. const entries = new Array(n);
  4973. for (let i = 0; i < n; ++i) {
  4974. const obj = parser.getObj();
  4975. entries[i] = obj;
  4976. if (parser.buf1 instanceof _primitives.Cmd && parser.buf1.cmd === "endobj") {
  4977. parser.shift();
  4978. }
  4979. if ((0, _primitives.isStream)(obj)) {
  4980. continue;
  4981. }
  4982. const num = nums[i],
  4983. entry = this.entries[num];
  4984. if (entry && entry.offset === tableOffset && entry.gen === i) {
  4985. this._cacheMap.set(num, obj);
  4986. }
  4987. }
  4988. xrefEntry = entries[xrefEntry.gen];
  4989. if (xrefEntry === undefined) {
  4990. throw new _core_utils.XRefEntryException(`Bad (compressed) XRef entry: ${ref}`);
  4991. }
  4992. return xrefEntry;
  4993. },
  4994. async fetchIfRefAsync(obj, suppressEncryption) {
  4995. if (obj instanceof _primitives.Ref) {
  4996. return this.fetchAsync(obj, suppressEncryption);
  4997. }
  4998. return obj;
  4999. },
  5000. async fetchAsync(ref, suppressEncryption) {
  5001. try {
  5002. return this.fetch(ref, suppressEncryption);
  5003. } catch (ex) {
  5004. if (!(ex instanceof _core_utils.MissingDataException)) {
  5005. throw ex;
  5006. }
  5007. await this.pdfManager.requestRange(ex.begin, ex.end);
  5008. return this.fetchAsync(ref, suppressEncryption);
  5009. }
  5010. },
  5011. getCatalogObj: function XRef_getCatalogObj() {
  5012. return this.root;
  5013. }
  5014. };
  5015. return XRef;
  5016. }();
  5017. exports.XRef = XRef;
  5018. class NameOrNumberTree {
  5019. constructor(root, xref, type) {
  5020. if (this.constructor === NameOrNumberTree) {
  5021. (0, _util.unreachable)("Cannot initialize NameOrNumberTree.");
  5022. }
  5023. this.root = root;
  5024. this.xref = xref;
  5025. this._type = type;
  5026. }
  5027. getAll() {
  5028. const dict = Object.create(null);
  5029. if (!this.root) {
  5030. return dict;
  5031. }
  5032. const xref = this.xref;
  5033. const processed = new _primitives.RefSet();
  5034. processed.put(this.root);
  5035. const queue = [this.root];
  5036. while (queue.length > 0) {
  5037. const obj = xref.fetchIfRef(queue.shift());
  5038. if (!(0, _primitives.isDict)(obj)) {
  5039. continue;
  5040. }
  5041. if (obj.has("Kids")) {
  5042. const kids = obj.get("Kids");
  5043. for (let i = 0, ii = kids.length; i < ii; i++) {
  5044. const kid = kids[i];
  5045. if (processed.has(kid)) {
  5046. throw new _util.FormatError(`Duplicate entry in "${this._type}" tree.`);
  5047. }
  5048. queue.push(kid);
  5049. processed.put(kid);
  5050. }
  5051. continue;
  5052. }
  5053. const entries = obj.get(this._type);
  5054. if (Array.isArray(entries)) {
  5055. for (let i = 0, ii = entries.length; i < ii; i += 2) {
  5056. dict[xref.fetchIfRef(entries[i])] = xref.fetchIfRef(entries[i + 1]);
  5057. }
  5058. }
  5059. }
  5060. return dict;
  5061. }
  5062. get(key) {
  5063. if (!this.root) {
  5064. return null;
  5065. }
  5066. const xref = this.xref;
  5067. let kidsOrEntries = xref.fetchIfRef(this.root);
  5068. let loopCount = 0;
  5069. const MAX_LEVELS = 10;
  5070. while (kidsOrEntries.has("Kids")) {
  5071. if (++loopCount > MAX_LEVELS) {
  5072. (0, _util.warn)(`Search depth limit reached for "${this._type}" tree.`);
  5073. return null;
  5074. }
  5075. const kids = kidsOrEntries.get("Kids");
  5076. if (!Array.isArray(kids)) {
  5077. return null;
  5078. }
  5079. let l = 0,
  5080. r = kids.length - 1;
  5081. while (l <= r) {
  5082. const m = l + r >> 1;
  5083. const kid = xref.fetchIfRef(kids[m]);
  5084. const limits = kid.get("Limits");
  5085. if (key < xref.fetchIfRef(limits[0])) {
  5086. r = m - 1;
  5087. } else if (key > xref.fetchIfRef(limits[1])) {
  5088. l = m + 1;
  5089. } else {
  5090. kidsOrEntries = xref.fetchIfRef(kids[m]);
  5091. break;
  5092. }
  5093. }
  5094. if (l > r) {
  5095. return null;
  5096. }
  5097. }
  5098. const entries = kidsOrEntries.get(this._type);
  5099. if (Array.isArray(entries)) {
  5100. let l = 0,
  5101. r = entries.length - 2;
  5102. while (l <= r) {
  5103. const tmp = l + r >> 1,
  5104. m = tmp + (tmp & 1);
  5105. const currentKey = xref.fetchIfRef(entries[m]);
  5106. if (key < currentKey) {
  5107. r = m - 2;
  5108. } else if (key > currentKey) {
  5109. l = m + 2;
  5110. } else {
  5111. return xref.fetchIfRef(entries[m + 1]);
  5112. }
  5113. }
  5114. (0, _util.info)(`Falling back to an exhaustive search, for key "${key}", ` + `in "${this._type}" tree.`);
  5115. for (let m = 0, mm = entries.length; m < mm; m += 2) {
  5116. const currentKey = xref.fetchIfRef(entries[m]);
  5117. if (currentKey === key) {
  5118. (0, _util.warn)(`The "${key}" key was found at an incorrect, ` + `i.e. out-of-order, position in "${this._type}" tree.`);
  5119. return xref.fetchIfRef(entries[m + 1]);
  5120. }
  5121. }
  5122. }
  5123. return null;
  5124. }
  5125. }
  5126. class NameTree extends NameOrNumberTree {
  5127. constructor(root, xref) {
  5128. super(root, xref, "Names");
  5129. }
  5130. }
  5131. class NumberTree extends NameOrNumberTree {
  5132. constructor(root, xref) {
  5133. super(root, xref, "Nums");
  5134. }
  5135. }
  5136. var FileSpec = function FileSpecClosure() {
  5137. function FileSpec(root, xref) {
  5138. if (!root || !(0, _primitives.isDict)(root)) {
  5139. return;
  5140. }
  5141. this.xref = xref;
  5142. this.root = root;
  5143. if (root.has("FS")) {
  5144. this.fs = root.get("FS");
  5145. }
  5146. this.description = root.has("Desc") ? (0, _util.stringToPDFString)(root.get("Desc")) : "";
  5147. if (root.has("RF")) {
  5148. (0, _util.warn)("Related file specifications are not supported");
  5149. }
  5150. this.contentAvailable = true;
  5151. if (!root.has("EF")) {
  5152. this.contentAvailable = false;
  5153. (0, _util.warn)("Non-embedded file specifications are not supported");
  5154. }
  5155. }
  5156. function pickPlatformItem(dict) {
  5157. if (dict.has("UF")) {
  5158. return dict.get("UF");
  5159. } else if (dict.has("F")) {
  5160. return dict.get("F");
  5161. } else if (dict.has("Unix")) {
  5162. return dict.get("Unix");
  5163. } else if (dict.has("Mac")) {
  5164. return dict.get("Mac");
  5165. } else if (dict.has("DOS")) {
  5166. return dict.get("DOS");
  5167. }
  5168. return null;
  5169. }
  5170. FileSpec.prototype = {
  5171. get filename() {
  5172. if (!this._filename && this.root) {
  5173. var filename = pickPlatformItem(this.root) || "unnamed";
  5174. this._filename = (0, _util.stringToPDFString)(filename).replace(/\\\\/g, "\\").replace(/\\\//g, "/").replace(/\\/g, "/");
  5175. }
  5176. return this._filename;
  5177. },
  5178. get content() {
  5179. if (!this.contentAvailable) {
  5180. return null;
  5181. }
  5182. if (!this.contentRef && this.root) {
  5183. this.contentRef = pickPlatformItem(this.root.get("EF"));
  5184. }
  5185. var content = null;
  5186. if (this.contentRef) {
  5187. var xref = this.xref;
  5188. var fileObj = xref.fetchIfRef(this.contentRef);
  5189. if (fileObj && (0, _primitives.isStream)(fileObj)) {
  5190. content = fileObj.getBytes();
  5191. } else {
  5192. (0, _util.warn)("Embedded file specification points to non-existing/invalid " + "content");
  5193. }
  5194. } else {
  5195. (0, _util.warn)("Embedded file specification does not have a content");
  5196. }
  5197. return content;
  5198. },
  5199. get serializable() {
  5200. return {
  5201. filename: this.filename,
  5202. content: this.content
  5203. };
  5204. }
  5205. };
  5206. return FileSpec;
  5207. }();
  5208. exports.FileSpec = FileSpec;
  5209. const ObjectLoader = function () {
  5210. function mayHaveChildren(value) {
  5211. return value instanceof _primitives.Ref || value instanceof _primitives.Dict || Array.isArray(value) || (0, _primitives.isStream)(value);
  5212. }
  5213. function addChildren(node, nodesToVisit) {
  5214. if (node instanceof _primitives.Dict) {
  5215. node = node.getRawValues();
  5216. } else if ((0, _primitives.isStream)(node)) {
  5217. node = node.dict.getRawValues();
  5218. } else if (!Array.isArray(node)) {
  5219. return;
  5220. }
  5221. for (const rawValue of node) {
  5222. if (mayHaveChildren(rawValue)) {
  5223. nodesToVisit.push(rawValue);
  5224. }
  5225. }
  5226. }
  5227. function ObjectLoader(dict, keys, xref) {
  5228. this.dict = dict;
  5229. this.keys = keys;
  5230. this.xref = xref;
  5231. this.refSet = null;
  5232. }
  5233. ObjectLoader.prototype = {
  5234. async load() {
  5235. if (!this.xref.stream.allChunksLoaded || this.xref.stream.allChunksLoaded()) {
  5236. return undefined;
  5237. }
  5238. const {
  5239. keys,
  5240. dict
  5241. } = this;
  5242. this.refSet = new _primitives.RefSet();
  5243. const nodesToVisit = [];
  5244. for (let i = 0, ii = keys.length; i < ii; i++) {
  5245. const rawValue = dict.getRaw(keys[i]);
  5246. if (rawValue !== undefined) {
  5247. nodesToVisit.push(rawValue);
  5248. }
  5249. }
  5250. return this._walk(nodesToVisit);
  5251. },
  5252. async _walk(nodesToVisit) {
  5253. const nodesToRevisit = [];
  5254. const pendingRequests = [];
  5255. while (nodesToVisit.length) {
  5256. let currentNode = nodesToVisit.pop();
  5257. if (currentNode instanceof _primitives.Ref) {
  5258. if (this.refSet.has(currentNode)) {
  5259. continue;
  5260. }
  5261. try {
  5262. this.refSet.put(currentNode);
  5263. currentNode = this.xref.fetch(currentNode);
  5264. } catch (ex) {
  5265. if (!(ex instanceof _core_utils.MissingDataException)) {
  5266. throw ex;
  5267. }
  5268. nodesToRevisit.push(currentNode);
  5269. pendingRequests.push({
  5270. begin: ex.begin,
  5271. end: ex.end
  5272. });
  5273. }
  5274. }
  5275. if (currentNode && currentNode.getBaseStreams) {
  5276. const baseStreams = currentNode.getBaseStreams();
  5277. let foundMissingData = false;
  5278. for (let i = 0, ii = baseStreams.length; i < ii; i++) {
  5279. const stream = baseStreams[i];
  5280. if (stream.allChunksLoaded && !stream.allChunksLoaded()) {
  5281. foundMissingData = true;
  5282. pendingRequests.push({
  5283. begin: stream.start,
  5284. end: stream.end
  5285. });
  5286. }
  5287. }
  5288. if (foundMissingData) {
  5289. nodesToRevisit.push(currentNode);
  5290. }
  5291. }
  5292. addChildren(currentNode, nodesToVisit);
  5293. }
  5294. if (pendingRequests.length) {
  5295. await this.xref.stream.manager.requestRanges(pendingRequests);
  5296. for (let i = 0, ii = nodesToRevisit.length; i < ii; i++) {
  5297. const node = nodesToRevisit[i];
  5298. if (node instanceof _primitives.Ref) {
  5299. this.refSet.remove(node);
  5300. }
  5301. }
  5302. return this._walk(nodesToRevisit);
  5303. }
  5304. this.refSet = null;
  5305. return undefined;
  5306. }
  5307. };
  5308. return ObjectLoader;
  5309. }();
  5310. exports.ObjectLoader = ObjectLoader;
  5311. /***/ }),
  5312. /* 11 */
  5313. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  5314. Object.defineProperty(exports, "__esModule", ({
  5315. value: true
  5316. }));
  5317. exports.Parser = exports.Linearization = exports.Lexer = void 0;
  5318. var _stream = __w_pdfjs_require__(12);
  5319. var _util = __w_pdfjs_require__(2);
  5320. var _primitives = __w_pdfjs_require__(5);
  5321. var _core_utils = __w_pdfjs_require__(8);
  5322. var _ccitt_stream = __w_pdfjs_require__(13);
  5323. var _jbig2_stream = __w_pdfjs_require__(15);
  5324. var _jpeg_stream = __w_pdfjs_require__(18);
  5325. var _jpx_stream = __w_pdfjs_require__(20);
  5326. const MAX_LENGTH_TO_CACHE = 1000;
  5327. const MAX_ADLER32_LENGTH = 5552;
  5328. function computeAdler32(bytes) {
  5329. const bytesLength = bytes.length;
  5330. let a = 1,
  5331. b = 0;
  5332. for (let i = 0; i < bytesLength; ++i) {
  5333. a += bytes[i] & 0xff;
  5334. b += a;
  5335. }
  5336. return b % 65521 << 16 | a % 65521;
  5337. }
  5338. class Parser {
  5339. constructor({
  5340. lexer,
  5341. xref,
  5342. allowStreams = false,
  5343. recoveryMode = false
  5344. }) {
  5345. this.lexer = lexer;
  5346. this.xref = xref;
  5347. this.allowStreams = allowStreams;
  5348. this.recoveryMode = recoveryMode;
  5349. this.imageCache = Object.create(null);
  5350. this.refill();
  5351. }
  5352. refill() {
  5353. this.buf1 = this.lexer.getObj();
  5354. this.buf2 = this.lexer.getObj();
  5355. }
  5356. shift() {
  5357. if (this.buf2 instanceof _primitives.Cmd && this.buf2.cmd === "ID") {
  5358. this.buf1 = this.buf2;
  5359. this.buf2 = null;
  5360. } else {
  5361. this.buf1 = this.buf2;
  5362. this.buf2 = this.lexer.getObj();
  5363. }
  5364. }
  5365. tryShift() {
  5366. try {
  5367. this.shift();
  5368. return true;
  5369. } catch (e) {
  5370. if (e instanceof _core_utils.MissingDataException) {
  5371. throw e;
  5372. }
  5373. return false;
  5374. }
  5375. }
  5376. getObj(cipherTransform = null) {
  5377. const buf1 = this.buf1;
  5378. this.shift();
  5379. if (buf1 instanceof _primitives.Cmd) {
  5380. switch (buf1.cmd) {
  5381. case "BI":
  5382. return this.makeInlineImage(cipherTransform);
  5383. case "[":
  5384. const array = [];
  5385. while (!(0, _primitives.isCmd)(this.buf1, "]") && !(0, _primitives.isEOF)(this.buf1)) {
  5386. array.push(this.getObj(cipherTransform));
  5387. }
  5388. if ((0, _primitives.isEOF)(this.buf1)) {
  5389. if (!this.recoveryMode) {
  5390. throw new _util.FormatError("End of file inside array");
  5391. }
  5392. return array;
  5393. }
  5394. this.shift();
  5395. return array;
  5396. case "<<":
  5397. const dict = new _primitives.Dict(this.xref);
  5398. while (!(0, _primitives.isCmd)(this.buf1, ">>") && !(0, _primitives.isEOF)(this.buf1)) {
  5399. if (!(0, _primitives.isName)(this.buf1)) {
  5400. (0, _util.info)("Malformed dictionary: key must be a name object");
  5401. this.shift();
  5402. continue;
  5403. }
  5404. const key = this.buf1.name;
  5405. this.shift();
  5406. if ((0, _primitives.isEOF)(this.buf1)) {
  5407. break;
  5408. }
  5409. dict.set(key, this.getObj(cipherTransform));
  5410. }
  5411. if ((0, _primitives.isEOF)(this.buf1)) {
  5412. if (!this.recoveryMode) {
  5413. throw new _util.FormatError("End of file inside dictionary");
  5414. }
  5415. return dict;
  5416. }
  5417. if ((0, _primitives.isCmd)(this.buf2, "stream")) {
  5418. return this.allowStreams ? this.makeStream(dict, cipherTransform) : dict;
  5419. }
  5420. this.shift();
  5421. return dict;
  5422. default:
  5423. return buf1;
  5424. }
  5425. }
  5426. if (Number.isInteger(buf1)) {
  5427. if (Number.isInteger(this.buf1) && (0, _primitives.isCmd)(this.buf2, "R")) {
  5428. const ref = _primitives.Ref.get(buf1, this.buf1);
  5429. this.shift();
  5430. this.shift();
  5431. return ref;
  5432. }
  5433. return buf1;
  5434. }
  5435. if (typeof buf1 === "string") {
  5436. if (cipherTransform) {
  5437. return cipherTransform.decryptString(buf1);
  5438. }
  5439. return buf1;
  5440. }
  5441. return buf1;
  5442. }
  5443. findDefaultInlineStreamEnd(stream) {
  5444. const E = 0x45,
  5445. I = 0x49,
  5446. SPACE = 0x20,
  5447. LF = 0xa,
  5448. CR = 0xd,
  5449. NUL = 0x0;
  5450. const lexer = this.lexer,
  5451. startPos = stream.pos,
  5452. n = 10;
  5453. let state = 0,
  5454. ch,
  5455. maybeEIPos;
  5456. while ((ch = stream.getByte()) !== -1) {
  5457. if (state === 0) {
  5458. state = ch === E ? 1 : 0;
  5459. } else if (state === 1) {
  5460. state = ch === I ? 2 : 0;
  5461. } else {
  5462. (0, _util.assert)(state === 2, "findDefaultInlineStreamEnd - invalid state.");
  5463. if (ch === SPACE || ch === LF || ch === CR) {
  5464. maybeEIPos = stream.pos;
  5465. const followingBytes = stream.peekBytes(n);
  5466. for (let i = 0, ii = followingBytes.length; i < ii; i++) {
  5467. ch = followingBytes[i];
  5468. if (ch === NUL && followingBytes[i + 1] !== NUL) {
  5469. continue;
  5470. }
  5471. if (ch !== LF && ch !== CR && (ch < SPACE || ch > 0x7f)) {
  5472. state = 0;
  5473. break;
  5474. }
  5475. }
  5476. if (state !== 2) {
  5477. continue;
  5478. }
  5479. if (lexer.knownCommands) {
  5480. const nextObj = lexer.peekObj();
  5481. if (nextObj instanceof _primitives.Cmd && !lexer.knownCommands[nextObj.cmd]) {
  5482. state = 0;
  5483. }
  5484. } else {
  5485. (0, _util.warn)("findDefaultInlineStreamEnd - `lexer.knownCommands` is undefined.");
  5486. }
  5487. if (state === 2) {
  5488. break;
  5489. }
  5490. } else {
  5491. state = 0;
  5492. }
  5493. }
  5494. }
  5495. if (ch === -1) {
  5496. (0, _util.warn)("findDefaultInlineStreamEnd: " + "Reached the end of the stream without finding a valid EI marker");
  5497. if (maybeEIPos) {
  5498. (0, _util.warn)('... trying to recover by using the last "EI" occurrence.');
  5499. stream.skip(-(stream.pos - maybeEIPos));
  5500. }
  5501. }
  5502. let endOffset = 4;
  5503. stream.skip(-endOffset);
  5504. ch = stream.peekByte();
  5505. stream.skip(endOffset);
  5506. if (!(0, _core_utils.isWhiteSpace)(ch)) {
  5507. endOffset--;
  5508. }
  5509. return stream.pos - endOffset - startPos;
  5510. }
  5511. findDCTDecodeInlineStreamEnd(stream) {
  5512. const startPos = stream.pos;
  5513. let foundEOI = false,
  5514. b,
  5515. markerLength;
  5516. while ((b = stream.getByte()) !== -1) {
  5517. if (b !== 0xff) {
  5518. continue;
  5519. }
  5520. switch (stream.getByte()) {
  5521. case 0x00:
  5522. break;
  5523. case 0xff:
  5524. stream.skip(-1);
  5525. break;
  5526. case 0xd9:
  5527. foundEOI = true;
  5528. break;
  5529. case 0xc0:
  5530. case 0xc1:
  5531. case 0xc2:
  5532. case 0xc3:
  5533. case 0xc5:
  5534. case 0xc6:
  5535. case 0xc7:
  5536. case 0xc9:
  5537. case 0xca:
  5538. case 0xcb:
  5539. case 0xcd:
  5540. case 0xce:
  5541. case 0xcf:
  5542. case 0xc4:
  5543. case 0xcc:
  5544. case 0xda:
  5545. case 0xdb:
  5546. case 0xdc:
  5547. case 0xdd:
  5548. case 0xde:
  5549. case 0xdf:
  5550. case 0xe0:
  5551. case 0xe1:
  5552. case 0xe2:
  5553. case 0xe3:
  5554. case 0xe4:
  5555. case 0xe5:
  5556. case 0xe6:
  5557. case 0xe7:
  5558. case 0xe8:
  5559. case 0xe9:
  5560. case 0xea:
  5561. case 0xeb:
  5562. case 0xec:
  5563. case 0xed:
  5564. case 0xee:
  5565. case 0xef:
  5566. case 0xfe:
  5567. markerLength = stream.getUint16();
  5568. if (markerLength > 2) {
  5569. stream.skip(markerLength - 2);
  5570. } else {
  5571. stream.skip(-2);
  5572. }
  5573. break;
  5574. }
  5575. if (foundEOI) {
  5576. break;
  5577. }
  5578. }
  5579. const length = stream.pos - startPos;
  5580. if (b === -1) {
  5581. (0, _util.warn)("Inline DCTDecode image stream: " + "EOI marker not found, searching for /EI/ instead.");
  5582. stream.skip(-length);
  5583. return this.findDefaultInlineStreamEnd(stream);
  5584. }
  5585. this.inlineStreamSkipEI(stream);
  5586. return length;
  5587. }
  5588. findASCII85DecodeInlineStreamEnd(stream) {
  5589. const TILDE = 0x7e,
  5590. GT = 0x3e;
  5591. const startPos = stream.pos;
  5592. let ch;
  5593. while ((ch = stream.getByte()) !== -1) {
  5594. if (ch === TILDE) {
  5595. const tildePos = stream.pos;
  5596. ch = stream.peekByte();
  5597. while ((0, _core_utils.isWhiteSpace)(ch)) {
  5598. stream.skip();
  5599. ch = stream.peekByte();
  5600. }
  5601. if (ch === GT) {
  5602. stream.skip();
  5603. break;
  5604. }
  5605. if (stream.pos > tildePos) {
  5606. const maybeEI = stream.peekBytes(2);
  5607. if (maybeEI[0] === 0x45 && maybeEI[1] === 0x49) {
  5608. break;
  5609. }
  5610. }
  5611. }
  5612. }
  5613. const length = stream.pos - startPos;
  5614. if (ch === -1) {
  5615. (0, _util.warn)("Inline ASCII85Decode image stream: " + "EOD marker not found, searching for /EI/ instead.");
  5616. stream.skip(-length);
  5617. return this.findDefaultInlineStreamEnd(stream);
  5618. }
  5619. this.inlineStreamSkipEI(stream);
  5620. return length;
  5621. }
  5622. findASCIIHexDecodeInlineStreamEnd(stream) {
  5623. const GT = 0x3e;
  5624. const startPos = stream.pos;
  5625. let ch;
  5626. while ((ch = stream.getByte()) !== -1) {
  5627. if (ch === GT) {
  5628. break;
  5629. }
  5630. }
  5631. const length = stream.pos - startPos;
  5632. if (ch === -1) {
  5633. (0, _util.warn)("Inline ASCIIHexDecode image stream: " + "EOD marker not found, searching for /EI/ instead.");
  5634. stream.skip(-length);
  5635. return this.findDefaultInlineStreamEnd(stream);
  5636. }
  5637. this.inlineStreamSkipEI(stream);
  5638. return length;
  5639. }
  5640. inlineStreamSkipEI(stream) {
  5641. const E = 0x45,
  5642. I = 0x49;
  5643. let state = 0,
  5644. ch;
  5645. while ((ch = stream.getByte()) !== -1) {
  5646. if (state === 0) {
  5647. state = ch === E ? 1 : 0;
  5648. } else if (state === 1) {
  5649. state = ch === I ? 2 : 0;
  5650. } else if (state === 2) {
  5651. break;
  5652. }
  5653. }
  5654. }
  5655. makeInlineImage(cipherTransform) {
  5656. const lexer = this.lexer;
  5657. const stream = lexer.stream;
  5658. const dict = new _primitives.Dict(this.xref);
  5659. let dictLength;
  5660. while (!(0, _primitives.isCmd)(this.buf1, "ID") && !(0, _primitives.isEOF)(this.buf1)) {
  5661. if (!(0, _primitives.isName)(this.buf1)) {
  5662. throw new _util.FormatError("Dictionary key must be a name object");
  5663. }
  5664. const key = this.buf1.name;
  5665. this.shift();
  5666. if ((0, _primitives.isEOF)(this.buf1)) {
  5667. break;
  5668. }
  5669. dict.set(key, this.getObj(cipherTransform));
  5670. }
  5671. if (lexer.beginInlineImagePos !== -1) {
  5672. dictLength = stream.pos - lexer.beginInlineImagePos;
  5673. }
  5674. const filter = dict.get("Filter", "F");
  5675. let filterName;
  5676. if ((0, _primitives.isName)(filter)) {
  5677. filterName = filter.name;
  5678. } else if (Array.isArray(filter)) {
  5679. const filterZero = this.xref.fetchIfRef(filter[0]);
  5680. if ((0, _primitives.isName)(filterZero)) {
  5681. filterName = filterZero.name;
  5682. }
  5683. }
  5684. const startPos = stream.pos;
  5685. let length;
  5686. if (filterName === "DCTDecode" || filterName === "DCT") {
  5687. length = this.findDCTDecodeInlineStreamEnd(stream);
  5688. } else if (filterName === "ASCII85Decode" || filterName === "A85") {
  5689. length = this.findASCII85DecodeInlineStreamEnd(stream);
  5690. } else if (filterName === "ASCIIHexDecode" || filterName === "AHx") {
  5691. length = this.findASCIIHexDecodeInlineStreamEnd(stream);
  5692. } else {
  5693. length = this.findDefaultInlineStreamEnd(stream);
  5694. }
  5695. let imageStream = stream.makeSubStream(startPos, length, dict);
  5696. let cacheKey;
  5697. if (length < MAX_LENGTH_TO_CACHE && dictLength < MAX_ADLER32_LENGTH) {
  5698. const imageBytes = imageStream.getBytes();
  5699. imageStream.reset();
  5700. const initialStreamPos = stream.pos;
  5701. stream.pos = lexer.beginInlineImagePos;
  5702. const dictBytes = stream.getBytes(dictLength);
  5703. stream.pos = initialStreamPos;
  5704. cacheKey = computeAdler32(imageBytes) + "_" + computeAdler32(dictBytes);
  5705. const cacheEntry = this.imageCache[cacheKey];
  5706. if (cacheEntry !== undefined) {
  5707. this.buf2 = _primitives.Cmd.get("EI");
  5708. this.shift();
  5709. cacheEntry.reset();
  5710. return cacheEntry;
  5711. }
  5712. }
  5713. if (cipherTransform) {
  5714. imageStream = cipherTransform.createStream(imageStream, length);
  5715. }
  5716. imageStream = this.filter(imageStream, dict, length);
  5717. imageStream.dict = dict;
  5718. if (cacheKey !== undefined) {
  5719. imageStream.cacheKey = `inline_${length}_${cacheKey}`;
  5720. this.imageCache[cacheKey] = imageStream;
  5721. }
  5722. this.buf2 = _primitives.Cmd.get("EI");
  5723. this.shift();
  5724. return imageStream;
  5725. }
  5726. _findStreamLength(startPos, signature) {
  5727. const {
  5728. stream
  5729. } = this.lexer;
  5730. stream.pos = startPos;
  5731. const SCAN_BLOCK_LENGTH = 2048;
  5732. const signatureLength = signature.length;
  5733. while (stream.pos < stream.end) {
  5734. const scanBytes = stream.peekBytes(SCAN_BLOCK_LENGTH);
  5735. const scanLength = scanBytes.length - signatureLength;
  5736. if (scanLength <= 0) {
  5737. break;
  5738. }
  5739. let pos = 0;
  5740. while (pos < scanLength) {
  5741. let j = 0;
  5742. while (j < signatureLength && scanBytes[pos + j] === signature[j]) {
  5743. j++;
  5744. }
  5745. if (j >= signatureLength) {
  5746. stream.pos += pos;
  5747. return stream.pos - startPos;
  5748. }
  5749. pos++;
  5750. }
  5751. stream.pos += scanLength;
  5752. }
  5753. return -1;
  5754. }
  5755. makeStream(dict, cipherTransform) {
  5756. const lexer = this.lexer;
  5757. let stream = lexer.stream;
  5758. lexer.skipToNextLine();
  5759. const startPos = stream.pos - 1;
  5760. let length = dict.get("Length");
  5761. if (!Number.isInteger(length)) {
  5762. (0, _util.info)(`Bad length "${length}" in stream`);
  5763. length = 0;
  5764. }
  5765. stream.pos = startPos + length;
  5766. lexer.nextChar();
  5767. if (this.tryShift() && (0, _primitives.isCmd)(this.buf2, "endstream")) {
  5768. this.shift();
  5769. } else {
  5770. const ENDSTREAM_SIGNATURE = new Uint8Array([0x65, 0x6E, 0x64, 0x73, 0x74, 0x72, 0x65, 0x61, 0x6D]);
  5771. let actualLength = this._findStreamLength(startPos, ENDSTREAM_SIGNATURE);
  5772. if (actualLength < 0) {
  5773. const MAX_TRUNCATION = 1;
  5774. for (let i = 1; i <= MAX_TRUNCATION; i++) {
  5775. const end = ENDSTREAM_SIGNATURE.length - i;
  5776. const TRUNCATED_SIGNATURE = ENDSTREAM_SIGNATURE.slice(0, end);
  5777. const maybeLength = this._findStreamLength(startPos, TRUNCATED_SIGNATURE);
  5778. if (maybeLength >= 0) {
  5779. const lastByte = stream.peekBytes(end + 1)[end];
  5780. if (!(0, _core_utils.isWhiteSpace)(lastByte)) {
  5781. break;
  5782. }
  5783. (0, _util.info)(`Found "${(0, _util.bytesToString)(TRUNCATED_SIGNATURE)}" when ` + "searching for endstream command.");
  5784. actualLength = maybeLength;
  5785. break;
  5786. }
  5787. }
  5788. if (actualLength < 0) {
  5789. throw new _util.FormatError("Missing endstream command.");
  5790. }
  5791. }
  5792. length = actualLength;
  5793. lexer.nextChar();
  5794. this.shift();
  5795. this.shift();
  5796. }
  5797. this.shift();
  5798. stream = stream.makeSubStream(startPos, length, dict);
  5799. if (cipherTransform) {
  5800. stream = cipherTransform.createStream(stream, length);
  5801. }
  5802. stream = this.filter(stream, dict, length);
  5803. stream.dict = dict;
  5804. return stream;
  5805. }
  5806. filter(stream, dict, length) {
  5807. let filter = dict.get("Filter", "F");
  5808. let params = dict.get("DecodeParms", "DP");
  5809. if ((0, _primitives.isName)(filter)) {
  5810. if (Array.isArray(params)) {
  5811. (0, _util.warn)("/DecodeParms should not contain an Array, " + "when /Filter contains a Name.");
  5812. }
  5813. return this.makeFilter(stream, filter.name, length, params);
  5814. }
  5815. let maybeLength = length;
  5816. if (Array.isArray(filter)) {
  5817. const filterArray = filter;
  5818. const paramsArray = params;
  5819. for (let i = 0, ii = filterArray.length; i < ii; ++i) {
  5820. filter = this.xref.fetchIfRef(filterArray[i]);
  5821. if (!(0, _primitives.isName)(filter)) {
  5822. throw new _util.FormatError(`Bad filter name "${filter}"`);
  5823. }
  5824. params = null;
  5825. if (Array.isArray(paramsArray) && i in paramsArray) {
  5826. params = this.xref.fetchIfRef(paramsArray[i]);
  5827. }
  5828. stream = this.makeFilter(stream, filter.name, maybeLength, params);
  5829. maybeLength = null;
  5830. }
  5831. }
  5832. return stream;
  5833. }
  5834. makeFilter(stream, name, maybeLength, params) {
  5835. if (maybeLength === 0) {
  5836. (0, _util.warn)(`Empty "${name}" stream.`);
  5837. return new _stream.NullStream();
  5838. }
  5839. try {
  5840. const xrefStreamStats = this.xref.stats.streamTypes;
  5841. if (name === "FlateDecode" || name === "Fl") {
  5842. xrefStreamStats[_util.StreamType.FLATE] = true;
  5843. if (params) {
  5844. return new _stream.PredictorStream(new _stream.FlateStream(stream, maybeLength), maybeLength, params);
  5845. }
  5846. return new _stream.FlateStream(stream, maybeLength);
  5847. }
  5848. if (name === "LZWDecode" || name === "LZW") {
  5849. xrefStreamStats[_util.StreamType.LZW] = true;
  5850. let earlyChange = 1;
  5851. if (params) {
  5852. if (params.has("EarlyChange")) {
  5853. earlyChange = params.get("EarlyChange");
  5854. }
  5855. return new _stream.PredictorStream(new _stream.LZWStream(stream, maybeLength, earlyChange), maybeLength, params);
  5856. }
  5857. return new _stream.LZWStream(stream, maybeLength, earlyChange);
  5858. }
  5859. if (name === "DCTDecode" || name === "DCT") {
  5860. xrefStreamStats[_util.StreamType.DCT] = true;
  5861. return new _jpeg_stream.JpegStream(stream, maybeLength, stream.dict, params);
  5862. }
  5863. if (name === "JPXDecode" || name === "JPX") {
  5864. xrefStreamStats[_util.StreamType.JPX] = true;
  5865. return new _jpx_stream.JpxStream(stream, maybeLength, stream.dict, params);
  5866. }
  5867. if (name === "ASCII85Decode" || name === "A85") {
  5868. xrefStreamStats[_util.StreamType.A85] = true;
  5869. return new _stream.Ascii85Stream(stream, maybeLength);
  5870. }
  5871. if (name === "ASCIIHexDecode" || name === "AHx") {
  5872. xrefStreamStats[_util.StreamType.AHX] = true;
  5873. return new _stream.AsciiHexStream(stream, maybeLength);
  5874. }
  5875. if (name === "CCITTFaxDecode" || name === "CCF") {
  5876. xrefStreamStats[_util.StreamType.CCF] = true;
  5877. return new _ccitt_stream.CCITTFaxStream(stream, maybeLength, params);
  5878. }
  5879. if (name === "RunLengthDecode" || name === "RL") {
  5880. xrefStreamStats[_util.StreamType.RLX] = true;
  5881. return new _stream.RunLengthStream(stream, maybeLength);
  5882. }
  5883. if (name === "JBIG2Decode") {
  5884. xrefStreamStats[_util.StreamType.JBIG] = true;
  5885. return new _jbig2_stream.Jbig2Stream(stream, maybeLength, stream.dict, params);
  5886. }
  5887. (0, _util.warn)(`Filter "${name}" is not supported.`);
  5888. return stream;
  5889. } catch (ex) {
  5890. if (ex instanceof _core_utils.MissingDataException) {
  5891. throw ex;
  5892. }
  5893. (0, _util.warn)(`Invalid stream: "${ex}"`);
  5894. return new _stream.NullStream();
  5895. }
  5896. }
  5897. }
  5898. exports.Parser = Parser;
  5899. const specialChars = [1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 2, 0, 0, 2, 2, 0, 0, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0];
  5900. function toHexDigit(ch) {
  5901. if (ch >= 0x30 && ch <= 0x39) {
  5902. return ch & 0x0f;
  5903. }
  5904. if (ch >= 0x41 && ch <= 0x46 || ch >= 0x61 && ch <= 0x66) {
  5905. return (ch & 0x0f) + 9;
  5906. }
  5907. return -1;
  5908. }
  5909. class Lexer {
  5910. constructor(stream, knownCommands = null) {
  5911. this.stream = stream;
  5912. this.nextChar();
  5913. this.strBuf = [];
  5914. this.knownCommands = knownCommands;
  5915. this._hexStringNumWarn = 0;
  5916. this.beginInlineImagePos = -1;
  5917. }
  5918. nextChar() {
  5919. return this.currentChar = this.stream.getByte();
  5920. }
  5921. peekChar() {
  5922. return this.stream.peekByte();
  5923. }
  5924. getNumber() {
  5925. let ch = this.currentChar;
  5926. let eNotation = false;
  5927. let divideBy = 0;
  5928. let sign = 0;
  5929. if (ch === 0x2d) {
  5930. sign = -1;
  5931. ch = this.nextChar();
  5932. if (ch === 0x2d) {
  5933. ch = this.nextChar();
  5934. }
  5935. } else if (ch === 0x2b) {
  5936. sign = 1;
  5937. ch = this.nextChar();
  5938. }
  5939. if (ch === 0x0a || ch === 0x0d) {
  5940. do {
  5941. ch = this.nextChar();
  5942. } while (ch === 0x0a || ch === 0x0d);
  5943. }
  5944. if (ch === 0x2e) {
  5945. divideBy = 10;
  5946. ch = this.nextChar();
  5947. }
  5948. if (ch < 0x30 || ch > 0x39) {
  5949. if (divideBy === 10 && sign === 0 && ((0, _core_utils.isWhiteSpace)(ch) || ch === -1)) {
  5950. (0, _util.warn)("Lexer.getNumber - treating a single decimal point as zero.");
  5951. return 0;
  5952. }
  5953. throw new _util.FormatError(`Invalid number: ${String.fromCharCode(ch)} (charCode ${ch})`);
  5954. }
  5955. sign = sign || 1;
  5956. let baseValue = ch - 0x30;
  5957. let powerValue = 0;
  5958. let powerValueSign = 1;
  5959. while ((ch = this.nextChar()) >= 0) {
  5960. if (ch >= 0x30 && ch <= 0x39) {
  5961. const currentDigit = ch - 0x30;
  5962. if (eNotation) {
  5963. powerValue = powerValue * 10 + currentDigit;
  5964. } else {
  5965. if (divideBy !== 0) {
  5966. divideBy *= 10;
  5967. }
  5968. baseValue = baseValue * 10 + currentDigit;
  5969. }
  5970. } else if (ch === 0x2e) {
  5971. if (divideBy === 0) {
  5972. divideBy = 1;
  5973. } else {
  5974. break;
  5975. }
  5976. } else if (ch === 0x2d) {
  5977. (0, _util.warn)("Badly formatted number: minus sign in the middle");
  5978. } else if (ch === 0x45 || ch === 0x65) {
  5979. ch = this.peekChar();
  5980. if (ch === 0x2b || ch === 0x2d) {
  5981. powerValueSign = ch === 0x2d ? -1 : 1;
  5982. this.nextChar();
  5983. } else if (ch < 0x30 || ch > 0x39) {
  5984. break;
  5985. }
  5986. eNotation = true;
  5987. } else {
  5988. break;
  5989. }
  5990. }
  5991. if (divideBy !== 0) {
  5992. baseValue /= divideBy;
  5993. }
  5994. if (eNotation) {
  5995. baseValue *= 10 ** (powerValueSign * powerValue);
  5996. }
  5997. return sign * baseValue;
  5998. }
  5999. getString() {
  6000. let numParen = 1;
  6001. let done = false;
  6002. const strBuf = this.strBuf;
  6003. strBuf.length = 0;
  6004. let ch = this.nextChar();
  6005. while (true) {
  6006. let charBuffered = false;
  6007. switch (ch | 0) {
  6008. case -1:
  6009. (0, _util.warn)("Unterminated string");
  6010. done = true;
  6011. break;
  6012. case 0x28:
  6013. ++numParen;
  6014. strBuf.push("(");
  6015. break;
  6016. case 0x29:
  6017. if (--numParen === 0) {
  6018. this.nextChar();
  6019. done = true;
  6020. } else {
  6021. strBuf.push(")");
  6022. }
  6023. break;
  6024. case 0x5c:
  6025. ch = this.nextChar();
  6026. switch (ch) {
  6027. case -1:
  6028. (0, _util.warn)("Unterminated string");
  6029. done = true;
  6030. break;
  6031. case 0x6e:
  6032. strBuf.push("\n");
  6033. break;
  6034. case 0x72:
  6035. strBuf.push("\r");
  6036. break;
  6037. case 0x74:
  6038. strBuf.push("\t");
  6039. break;
  6040. case 0x62:
  6041. strBuf.push("\b");
  6042. break;
  6043. case 0x66:
  6044. strBuf.push("\f");
  6045. break;
  6046. case 0x5c:
  6047. case 0x28:
  6048. case 0x29:
  6049. strBuf.push(String.fromCharCode(ch));
  6050. break;
  6051. case 0x30:
  6052. case 0x31:
  6053. case 0x32:
  6054. case 0x33:
  6055. case 0x34:
  6056. case 0x35:
  6057. case 0x36:
  6058. case 0x37:
  6059. let x = ch & 0x0f;
  6060. ch = this.nextChar();
  6061. charBuffered = true;
  6062. if (ch >= 0x30 && ch <= 0x37) {
  6063. x = (x << 3) + (ch & 0x0f);
  6064. ch = this.nextChar();
  6065. if (ch >= 0x30 && ch <= 0x37) {
  6066. charBuffered = false;
  6067. x = (x << 3) + (ch & 0x0f);
  6068. }
  6069. }
  6070. strBuf.push(String.fromCharCode(x));
  6071. break;
  6072. case 0x0d:
  6073. if (this.peekChar() === 0x0a) {
  6074. this.nextChar();
  6075. }
  6076. break;
  6077. case 0x0a:
  6078. break;
  6079. default:
  6080. strBuf.push(String.fromCharCode(ch));
  6081. break;
  6082. }
  6083. break;
  6084. default:
  6085. strBuf.push(String.fromCharCode(ch));
  6086. break;
  6087. }
  6088. if (done) {
  6089. break;
  6090. }
  6091. if (!charBuffered) {
  6092. ch = this.nextChar();
  6093. }
  6094. }
  6095. return strBuf.join("");
  6096. }
  6097. getName() {
  6098. let ch, previousCh;
  6099. const strBuf = this.strBuf;
  6100. strBuf.length = 0;
  6101. while ((ch = this.nextChar()) >= 0 && !specialChars[ch]) {
  6102. if (ch === 0x23) {
  6103. ch = this.nextChar();
  6104. if (specialChars[ch]) {
  6105. (0, _util.warn)("Lexer_getName: " + "NUMBER SIGN (#) should be followed by a hexadecimal number.");
  6106. strBuf.push("#");
  6107. break;
  6108. }
  6109. const x = toHexDigit(ch);
  6110. if (x !== -1) {
  6111. previousCh = ch;
  6112. ch = this.nextChar();
  6113. const x2 = toHexDigit(ch);
  6114. if (x2 === -1) {
  6115. (0, _util.warn)(`Lexer_getName: Illegal digit (${String.fromCharCode(ch)}) ` + "in hexadecimal number.");
  6116. strBuf.push("#", String.fromCharCode(previousCh));
  6117. if (specialChars[ch]) {
  6118. break;
  6119. }
  6120. strBuf.push(String.fromCharCode(ch));
  6121. continue;
  6122. }
  6123. strBuf.push(String.fromCharCode(x << 4 | x2));
  6124. } else {
  6125. strBuf.push("#", String.fromCharCode(ch));
  6126. }
  6127. } else {
  6128. strBuf.push(String.fromCharCode(ch));
  6129. }
  6130. }
  6131. if (strBuf.length > 127) {
  6132. (0, _util.warn)(`Name token is longer than allowed by the spec: ${strBuf.length}`);
  6133. }
  6134. return _primitives.Name.get(strBuf.join(""));
  6135. }
  6136. _hexStringWarn(ch) {
  6137. const MAX_HEX_STRING_NUM_WARN = 5;
  6138. if (this._hexStringNumWarn++ === MAX_HEX_STRING_NUM_WARN) {
  6139. (0, _util.warn)("getHexString - ignoring additional invalid characters.");
  6140. return;
  6141. }
  6142. if (this._hexStringNumWarn > MAX_HEX_STRING_NUM_WARN) {
  6143. return;
  6144. }
  6145. (0, _util.warn)(`getHexString - ignoring invalid character: ${ch}`);
  6146. }
  6147. getHexString() {
  6148. const strBuf = this.strBuf;
  6149. strBuf.length = 0;
  6150. let ch = this.currentChar;
  6151. let isFirstHex = true;
  6152. let firstDigit, secondDigit;
  6153. this._hexStringNumWarn = 0;
  6154. while (true) {
  6155. if (ch < 0) {
  6156. (0, _util.warn)("Unterminated hex string");
  6157. break;
  6158. } else if (ch === 0x3e) {
  6159. this.nextChar();
  6160. break;
  6161. } else if (specialChars[ch] === 1) {
  6162. ch = this.nextChar();
  6163. continue;
  6164. } else {
  6165. if (isFirstHex) {
  6166. firstDigit = toHexDigit(ch);
  6167. if (firstDigit === -1) {
  6168. this._hexStringWarn(ch);
  6169. ch = this.nextChar();
  6170. continue;
  6171. }
  6172. } else {
  6173. secondDigit = toHexDigit(ch);
  6174. if (secondDigit === -1) {
  6175. this._hexStringWarn(ch);
  6176. ch = this.nextChar();
  6177. continue;
  6178. }
  6179. strBuf.push(String.fromCharCode(firstDigit << 4 | secondDigit));
  6180. }
  6181. isFirstHex = !isFirstHex;
  6182. ch = this.nextChar();
  6183. }
  6184. }
  6185. return strBuf.join("");
  6186. }
  6187. getObj() {
  6188. let comment = false;
  6189. let ch = this.currentChar;
  6190. while (true) {
  6191. if (ch < 0) {
  6192. return _primitives.EOF;
  6193. }
  6194. if (comment) {
  6195. if (ch === 0x0a || ch === 0x0d) {
  6196. comment = false;
  6197. }
  6198. } else if (ch === 0x25) {
  6199. comment = true;
  6200. } else if (specialChars[ch] !== 1) {
  6201. break;
  6202. }
  6203. ch = this.nextChar();
  6204. }
  6205. switch (ch | 0) {
  6206. case 0x30:
  6207. case 0x31:
  6208. case 0x32:
  6209. case 0x33:
  6210. case 0x34:
  6211. case 0x35:
  6212. case 0x36:
  6213. case 0x37:
  6214. case 0x38:
  6215. case 0x39:
  6216. case 0x2b:
  6217. case 0x2d:
  6218. case 0x2e:
  6219. return this.getNumber();
  6220. case 0x28:
  6221. return this.getString();
  6222. case 0x2f:
  6223. return this.getName();
  6224. case 0x5b:
  6225. this.nextChar();
  6226. return _primitives.Cmd.get("[");
  6227. case 0x5d:
  6228. this.nextChar();
  6229. return _primitives.Cmd.get("]");
  6230. case 0x3c:
  6231. ch = this.nextChar();
  6232. if (ch === 0x3c) {
  6233. this.nextChar();
  6234. return _primitives.Cmd.get("<<");
  6235. }
  6236. return this.getHexString();
  6237. case 0x3e:
  6238. ch = this.nextChar();
  6239. if (ch === 0x3e) {
  6240. this.nextChar();
  6241. return _primitives.Cmd.get(">>");
  6242. }
  6243. return _primitives.Cmd.get(">");
  6244. case 0x7b:
  6245. this.nextChar();
  6246. return _primitives.Cmd.get("{");
  6247. case 0x7d:
  6248. this.nextChar();
  6249. return _primitives.Cmd.get("}");
  6250. case 0x29:
  6251. this.nextChar();
  6252. throw new _util.FormatError(`Illegal character: ${ch}`);
  6253. }
  6254. let str = String.fromCharCode(ch);
  6255. const knownCommands = this.knownCommands;
  6256. let knownCommandFound = knownCommands && knownCommands[str] !== undefined;
  6257. while ((ch = this.nextChar()) >= 0 && !specialChars[ch]) {
  6258. const possibleCommand = str + String.fromCharCode(ch);
  6259. if (knownCommandFound && knownCommands[possibleCommand] === undefined) {
  6260. break;
  6261. }
  6262. if (str.length === 128) {
  6263. throw new _util.FormatError(`Command token too long: ${str.length}`);
  6264. }
  6265. str = possibleCommand;
  6266. knownCommandFound = knownCommands && knownCommands[str] !== undefined;
  6267. }
  6268. if (str === "true") {
  6269. return true;
  6270. }
  6271. if (str === "false") {
  6272. return false;
  6273. }
  6274. if (str === "null") {
  6275. return null;
  6276. }
  6277. if (str === "BI") {
  6278. this.beginInlineImagePos = this.stream.pos;
  6279. }
  6280. return _primitives.Cmd.get(str);
  6281. }
  6282. peekObj() {
  6283. const streamPos = this.stream.pos,
  6284. currentChar = this.currentChar,
  6285. beginInlineImagePos = this.beginInlineImagePos;
  6286. let nextObj;
  6287. try {
  6288. nextObj = this.getObj();
  6289. } catch (ex) {
  6290. if (ex instanceof _core_utils.MissingDataException) {
  6291. throw ex;
  6292. }
  6293. (0, _util.warn)(`peekObj: ${ex}`);
  6294. }
  6295. this.stream.pos = streamPos;
  6296. this.currentChar = currentChar;
  6297. this.beginInlineImagePos = beginInlineImagePos;
  6298. return nextObj;
  6299. }
  6300. skipToNextLine() {
  6301. let ch = this.currentChar;
  6302. while (ch >= 0) {
  6303. if (ch === 0x0d) {
  6304. ch = this.nextChar();
  6305. if (ch === 0x0a) {
  6306. this.nextChar();
  6307. }
  6308. break;
  6309. } else if (ch === 0x0a) {
  6310. this.nextChar();
  6311. break;
  6312. }
  6313. ch = this.nextChar();
  6314. }
  6315. }
  6316. }
  6317. exports.Lexer = Lexer;
  6318. class Linearization {
  6319. static create(stream) {
  6320. function getInt(linDict, name, allowZeroValue = false) {
  6321. const obj = linDict.get(name);
  6322. if (Number.isInteger(obj) && (allowZeroValue ? obj >= 0 : obj > 0)) {
  6323. return obj;
  6324. }
  6325. throw new Error(`The "${name}" parameter in the linearization ` + "dictionary is invalid.");
  6326. }
  6327. function getHints(linDict) {
  6328. const hints = linDict.get("H");
  6329. let hintsLength;
  6330. if (Array.isArray(hints) && ((hintsLength = hints.length) === 2 || hintsLength === 4)) {
  6331. for (let index = 0; index < hintsLength; index++) {
  6332. const hint = hints[index];
  6333. if (!(Number.isInteger(hint) && hint > 0)) {
  6334. throw new Error(`Hint (${index}) in the linearization dictionary is invalid.`);
  6335. }
  6336. }
  6337. return hints;
  6338. }
  6339. throw new Error("Hint array in the linearization dictionary is invalid.");
  6340. }
  6341. const parser = new Parser({
  6342. lexer: new Lexer(stream),
  6343. xref: null
  6344. });
  6345. const obj1 = parser.getObj();
  6346. const obj2 = parser.getObj();
  6347. const obj3 = parser.getObj();
  6348. const linDict = parser.getObj();
  6349. let obj, length;
  6350. if (!(Number.isInteger(obj1) && Number.isInteger(obj2) && (0, _primitives.isCmd)(obj3, "obj") && (0, _primitives.isDict)(linDict) && (0, _util.isNum)(obj = linDict.get("Linearized")) && obj > 0)) {
  6351. return null;
  6352. } else if ((length = getInt(linDict, "L")) !== stream.length) {
  6353. throw new Error('The "L" parameter in the linearization dictionary ' + "does not equal the stream length.");
  6354. }
  6355. return {
  6356. length,
  6357. hints: getHints(linDict),
  6358. objectNumberFirst: getInt(linDict, "O"),
  6359. endFirst: getInt(linDict, "E"),
  6360. numPages: getInt(linDict, "N"),
  6361. mainXRefEntriesOffset: getInt(linDict, "T"),
  6362. pageFirst: linDict.has("P") ? getInt(linDict, "P", true) : 0
  6363. };
  6364. }
  6365. }
  6366. exports.Linearization = Linearization;
  6367. /***/ }),
  6368. /* 12 */
  6369. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  6370. Object.defineProperty(exports, "__esModule", ({
  6371. value: true
  6372. }));
  6373. exports.StringStream = exports.StreamsSequenceStream = exports.Stream = exports.RunLengthStream = exports.PredictorStream = exports.NullStream = exports.LZWStream = exports.FlateStream = exports.DecryptStream = exports.DecodeStream = exports.AsciiHexStream = exports.Ascii85Stream = void 0;
  6374. var _util = __w_pdfjs_require__(2);
  6375. var _primitives = __w_pdfjs_require__(5);
  6376. var _core_utils = __w_pdfjs_require__(8);
  6377. var Stream = function StreamClosure() {
  6378. function Stream(arrayBuffer, start, length, dict) {
  6379. this.bytes = arrayBuffer instanceof Uint8Array ? arrayBuffer : new Uint8Array(arrayBuffer);
  6380. this.start = start || 0;
  6381. this.pos = this.start;
  6382. this.end = start + length || this.bytes.length;
  6383. this.dict = dict;
  6384. }
  6385. Stream.prototype = {
  6386. get length() {
  6387. return this.end - this.start;
  6388. },
  6389. get isEmpty() {
  6390. return this.length === 0;
  6391. },
  6392. getByte: function Stream_getByte() {
  6393. if (this.pos >= this.end) {
  6394. return -1;
  6395. }
  6396. return this.bytes[this.pos++];
  6397. },
  6398. getUint16: function Stream_getUint16() {
  6399. var b0 = this.getByte();
  6400. var b1 = this.getByte();
  6401. if (b0 === -1 || b1 === -1) {
  6402. return -1;
  6403. }
  6404. return (b0 << 8) + b1;
  6405. },
  6406. getInt32: function Stream_getInt32() {
  6407. var b0 = this.getByte();
  6408. var b1 = this.getByte();
  6409. var b2 = this.getByte();
  6410. var b3 = this.getByte();
  6411. return (b0 << 24) + (b1 << 16) + (b2 << 8) + b3;
  6412. },
  6413. getBytes(length, forceClamped = false) {
  6414. var bytes = this.bytes;
  6415. var pos = this.pos;
  6416. var strEnd = this.end;
  6417. if (!length) {
  6418. const subarray = bytes.subarray(pos, strEnd);
  6419. return forceClamped ? new Uint8ClampedArray(subarray) : subarray;
  6420. }
  6421. var end = pos + length;
  6422. if (end > strEnd) {
  6423. end = strEnd;
  6424. }
  6425. this.pos = end;
  6426. const subarray = bytes.subarray(pos, end);
  6427. return forceClamped ? new Uint8ClampedArray(subarray) : subarray;
  6428. },
  6429. peekByte: function Stream_peekByte() {
  6430. var peekedByte = this.getByte();
  6431. if (peekedByte !== -1) {
  6432. this.pos--;
  6433. }
  6434. return peekedByte;
  6435. },
  6436. peekBytes(length, forceClamped = false) {
  6437. var bytes = this.getBytes(length, forceClamped);
  6438. this.pos -= bytes.length;
  6439. return bytes;
  6440. },
  6441. getByteRange(begin, end) {
  6442. if (begin < 0) {
  6443. begin = 0;
  6444. }
  6445. if (end > this.end) {
  6446. end = this.end;
  6447. }
  6448. return this.bytes.subarray(begin, end);
  6449. },
  6450. skip: function Stream_skip(n) {
  6451. if (!n) {
  6452. n = 1;
  6453. }
  6454. this.pos += n;
  6455. },
  6456. reset: function Stream_reset() {
  6457. this.pos = this.start;
  6458. },
  6459. moveStart: function Stream_moveStart() {
  6460. this.start = this.pos;
  6461. },
  6462. makeSubStream: function Stream_makeSubStream(start, length, dict) {
  6463. return new Stream(this.bytes.buffer, start, length, dict);
  6464. }
  6465. };
  6466. return Stream;
  6467. }();
  6468. exports.Stream = Stream;
  6469. var StringStream = function StringStreamClosure() {
  6470. function StringStream(str) {
  6471. const bytes = (0, _util.stringToBytes)(str);
  6472. Stream.call(this, bytes);
  6473. }
  6474. StringStream.prototype = Stream.prototype;
  6475. return StringStream;
  6476. }();
  6477. exports.StringStream = StringStream;
  6478. var DecodeStream = function DecodeStreamClosure() {
  6479. var emptyBuffer = new Uint8Array(0);
  6480. function DecodeStream(maybeMinBufferLength) {
  6481. this._rawMinBufferLength = maybeMinBufferLength || 0;
  6482. this.pos = 0;
  6483. this.bufferLength = 0;
  6484. this.eof = false;
  6485. this.buffer = emptyBuffer;
  6486. this.minBufferLength = 512;
  6487. if (maybeMinBufferLength) {
  6488. while (this.minBufferLength < maybeMinBufferLength) {
  6489. this.minBufferLength *= 2;
  6490. }
  6491. }
  6492. }
  6493. DecodeStream.prototype = {
  6494. get length() {
  6495. (0, _util.unreachable)("Should not access DecodeStream.length");
  6496. },
  6497. get isEmpty() {
  6498. while (!this.eof && this.bufferLength === 0) {
  6499. this.readBlock();
  6500. }
  6501. return this.bufferLength === 0;
  6502. },
  6503. ensureBuffer: function DecodeStream_ensureBuffer(requested) {
  6504. var buffer = this.buffer;
  6505. if (requested <= buffer.byteLength) {
  6506. return buffer;
  6507. }
  6508. var size = this.minBufferLength;
  6509. while (size < requested) {
  6510. size *= 2;
  6511. }
  6512. var buffer2 = new Uint8Array(size);
  6513. buffer2.set(buffer);
  6514. return this.buffer = buffer2;
  6515. },
  6516. getByte: function DecodeStream_getByte() {
  6517. var pos = this.pos;
  6518. while (this.bufferLength <= pos) {
  6519. if (this.eof) {
  6520. return -1;
  6521. }
  6522. this.readBlock();
  6523. }
  6524. return this.buffer[this.pos++];
  6525. },
  6526. getUint16: function DecodeStream_getUint16() {
  6527. var b0 = this.getByte();
  6528. var b1 = this.getByte();
  6529. if (b0 === -1 || b1 === -1) {
  6530. return -1;
  6531. }
  6532. return (b0 << 8) + b1;
  6533. },
  6534. getInt32: function DecodeStream_getInt32() {
  6535. var b0 = this.getByte();
  6536. var b1 = this.getByte();
  6537. var b2 = this.getByte();
  6538. var b3 = this.getByte();
  6539. return (b0 << 24) + (b1 << 16) + (b2 << 8) + b3;
  6540. },
  6541. getBytes(length, forceClamped = false) {
  6542. var end,
  6543. pos = this.pos;
  6544. if (length) {
  6545. this.ensureBuffer(pos + length);
  6546. end = pos + length;
  6547. while (!this.eof && this.bufferLength < end) {
  6548. this.readBlock();
  6549. }
  6550. var bufEnd = this.bufferLength;
  6551. if (end > bufEnd) {
  6552. end = bufEnd;
  6553. }
  6554. } else {
  6555. while (!this.eof) {
  6556. this.readBlock();
  6557. }
  6558. end = this.bufferLength;
  6559. }
  6560. this.pos = end;
  6561. const subarray = this.buffer.subarray(pos, end);
  6562. return forceClamped && !(subarray instanceof Uint8ClampedArray) ? new Uint8ClampedArray(subarray) : subarray;
  6563. },
  6564. peekByte: function DecodeStream_peekByte() {
  6565. var peekedByte = this.getByte();
  6566. if (peekedByte !== -1) {
  6567. this.pos--;
  6568. }
  6569. return peekedByte;
  6570. },
  6571. peekBytes(length, forceClamped = false) {
  6572. var bytes = this.getBytes(length, forceClamped);
  6573. this.pos -= bytes.length;
  6574. return bytes;
  6575. },
  6576. makeSubStream: function DecodeStream_makeSubStream(start, length, dict) {
  6577. var end = start + length;
  6578. while (this.bufferLength <= end && !this.eof) {
  6579. this.readBlock();
  6580. }
  6581. return new Stream(this.buffer, start, length, dict);
  6582. },
  6583. getByteRange(begin, end) {
  6584. (0, _util.unreachable)("Should not call DecodeStream.getByteRange");
  6585. },
  6586. skip: function DecodeStream_skip(n) {
  6587. if (!n) {
  6588. n = 1;
  6589. }
  6590. this.pos += n;
  6591. },
  6592. reset: function DecodeStream_reset() {
  6593. this.pos = 0;
  6594. },
  6595. getBaseStreams: function DecodeStream_getBaseStreams() {
  6596. if (this.str && this.str.getBaseStreams) {
  6597. return this.str.getBaseStreams();
  6598. }
  6599. return [];
  6600. }
  6601. };
  6602. return DecodeStream;
  6603. }();
  6604. exports.DecodeStream = DecodeStream;
  6605. var StreamsSequenceStream = function StreamsSequenceStreamClosure() {
  6606. function StreamsSequenceStream(streams) {
  6607. this.streams = streams;
  6608. let maybeLength = 0;
  6609. for (let i = 0, ii = streams.length; i < ii; i++) {
  6610. const stream = streams[i];
  6611. if (stream instanceof DecodeStream) {
  6612. maybeLength += stream._rawMinBufferLength;
  6613. } else {
  6614. maybeLength += stream.length;
  6615. }
  6616. }
  6617. DecodeStream.call(this, maybeLength);
  6618. }
  6619. StreamsSequenceStream.prototype = Object.create(DecodeStream.prototype);
  6620. StreamsSequenceStream.prototype.readBlock = function streamSequenceStreamReadBlock() {
  6621. var streams = this.streams;
  6622. if (streams.length === 0) {
  6623. this.eof = true;
  6624. return;
  6625. }
  6626. var stream = streams.shift();
  6627. var chunk = stream.getBytes();
  6628. var bufferLength = this.bufferLength;
  6629. var newLength = bufferLength + chunk.length;
  6630. var buffer = this.ensureBuffer(newLength);
  6631. buffer.set(chunk, bufferLength);
  6632. this.bufferLength = newLength;
  6633. };
  6634. StreamsSequenceStream.prototype.getBaseStreams = function StreamsSequenceStream_getBaseStreams() {
  6635. var baseStreams = [];
  6636. for (var i = 0, ii = this.streams.length; i < ii; i++) {
  6637. var stream = this.streams[i];
  6638. if (stream.getBaseStreams) {
  6639. baseStreams.push(...stream.getBaseStreams());
  6640. }
  6641. }
  6642. return baseStreams;
  6643. };
  6644. return StreamsSequenceStream;
  6645. }();
  6646. exports.StreamsSequenceStream = StreamsSequenceStream;
  6647. var FlateStream = function FlateStreamClosure() {
  6648. var codeLenCodeMap = new Int32Array([16, 17, 18, 0, 8, 7, 9, 6, 10, 5, 11, 4, 12, 3, 13, 2, 14, 1, 15]);
  6649. var lengthDecode = new Int32Array([0x00003, 0x00004, 0x00005, 0x00006, 0x00007, 0x00008, 0x00009, 0x0000a, 0x1000b, 0x1000d, 0x1000f, 0x10011, 0x20013, 0x20017, 0x2001b, 0x2001f, 0x30023, 0x3002b, 0x30033, 0x3003b, 0x40043, 0x40053, 0x40063, 0x40073, 0x50083, 0x500a3, 0x500c3, 0x500e3, 0x00102, 0x00102, 0x00102]);
  6650. var distDecode = new Int32Array([0x00001, 0x00002, 0x00003, 0x00004, 0x10005, 0x10007, 0x20009, 0x2000d, 0x30011, 0x30019, 0x40021, 0x40031, 0x50041, 0x50061, 0x60081, 0x600c1, 0x70101, 0x70181, 0x80201, 0x80301, 0x90401, 0x90601, 0xa0801, 0xa0c01, 0xb1001, 0xb1801, 0xc2001, 0xc3001, 0xd4001, 0xd6001]);
  6651. var fixedLitCodeTab = [new Int32Array([0x70100, 0x80050, 0x80010, 0x80118, 0x70110, 0x80070, 0x80030, 0x900c0, 0x70108, 0x80060, 0x80020, 0x900a0, 0x80000, 0x80080, 0x80040, 0x900e0, 0x70104, 0x80058, 0x80018, 0x90090, 0x70114, 0x80078, 0x80038, 0x900d0, 0x7010c, 0x80068, 0x80028, 0x900b0, 0x80008, 0x80088, 0x80048, 0x900f0, 0x70102, 0x80054, 0x80014, 0x8011c, 0x70112, 0x80074, 0x80034, 0x900c8, 0x7010a, 0x80064, 0x80024, 0x900a8, 0x80004, 0x80084, 0x80044, 0x900e8, 0x70106, 0x8005c, 0x8001c, 0x90098, 0x70116, 0x8007c, 0x8003c, 0x900d8, 0x7010e, 0x8006c, 0x8002c, 0x900b8, 0x8000c, 0x8008c, 0x8004c, 0x900f8, 0x70101, 0x80052, 0x80012, 0x8011a, 0x70111, 0x80072, 0x80032, 0x900c4, 0x70109, 0x80062, 0x80022, 0x900a4, 0x80002, 0x80082, 0x80042, 0x900e4, 0x70105, 0x8005a, 0x8001a, 0x90094, 0x70115, 0x8007a, 0x8003a, 0x900d4, 0x7010d, 0x8006a, 0x8002a, 0x900b4, 0x8000a, 0x8008a, 0x8004a, 0x900f4, 0x70103, 0x80056, 0x80016, 0x8011e, 0x70113, 0x80076, 0x80036, 0x900cc, 0x7010b, 0x80066, 0x80026, 0x900ac, 0x80006, 0x80086, 0x80046, 0x900ec, 0x70107, 0x8005e, 0x8001e, 0x9009c, 0x70117, 0x8007e, 0x8003e, 0x900dc, 0x7010f, 0x8006e, 0x8002e, 0x900bc, 0x8000e, 0x8008e, 0x8004e, 0x900fc, 0x70100, 0x80051, 0x80011, 0x80119, 0x70110, 0x80071, 0x80031, 0x900c2, 0x70108, 0x80061, 0x80021, 0x900a2, 0x80001, 0x80081, 0x80041, 0x900e2, 0x70104, 0x80059, 0x80019, 0x90092, 0x70114, 0x80079, 0x80039, 0x900d2, 0x7010c, 0x80069, 0x80029, 0x900b2, 0x80009, 0x80089, 0x80049, 0x900f2, 0x70102, 0x80055, 0x80015, 0x8011d, 0x70112, 0x80075, 0x80035, 0x900ca, 0x7010a, 0x80065, 0x80025, 0x900aa, 0x80005, 0x80085, 0x80045, 0x900ea, 0x70106, 0x8005d, 0x8001d, 0x9009a, 0x70116, 0x8007d, 0x8003d, 0x900da, 0x7010e, 0x8006d, 0x8002d, 0x900ba, 0x8000d, 0x8008d, 0x8004d, 0x900fa, 0x70101, 0x80053, 0x80013, 0x8011b, 0x70111, 0x80073, 0x80033, 0x900c6, 0x70109, 0x80063, 0x80023, 0x900a6, 0x80003, 0x80083, 0x80043, 0x900e6, 0x70105, 0x8005b, 0x8001b, 0x90096, 0x70115, 0x8007b, 0x8003b, 0x900d6, 0x7010d, 0x8006b, 0x8002b, 0x900b6, 0x8000b, 0x8008b, 0x8004b, 0x900f6, 0x70103, 0x80057, 0x80017, 0x8011f, 0x70113, 0x80077, 0x80037, 0x900ce, 0x7010b, 0x80067, 0x80027, 0x900ae, 0x80007, 0x80087, 0x80047, 0x900ee, 0x70107, 0x8005f, 0x8001f, 0x9009e, 0x70117, 0x8007f, 0x8003f, 0x900de, 0x7010f, 0x8006f, 0x8002f, 0x900be, 0x8000f, 0x8008f, 0x8004f, 0x900fe, 0x70100, 0x80050, 0x80010, 0x80118, 0x70110, 0x80070, 0x80030, 0x900c1, 0x70108, 0x80060, 0x80020, 0x900a1, 0x80000, 0x80080, 0x80040, 0x900e1, 0x70104, 0x80058, 0x80018, 0x90091, 0x70114, 0x80078, 0x80038, 0x900d1, 0x7010c, 0x80068, 0x80028, 0x900b1, 0x80008, 0x80088, 0x80048, 0x900f1, 0x70102, 0x80054, 0x80014, 0x8011c, 0x70112, 0x80074, 0x80034, 0x900c9, 0x7010a, 0x80064, 0x80024, 0x900a9, 0x80004, 0x80084, 0x80044, 0x900e9, 0x70106, 0x8005c, 0x8001c, 0x90099, 0x70116, 0x8007c, 0x8003c, 0x900d9, 0x7010e, 0x8006c, 0x8002c, 0x900b9, 0x8000c, 0x8008c, 0x8004c, 0x900f9, 0x70101, 0x80052, 0x80012, 0x8011a, 0x70111, 0x80072, 0x80032, 0x900c5, 0x70109, 0x80062, 0x80022, 0x900a5, 0x80002, 0x80082, 0x80042, 0x900e5, 0x70105, 0x8005a, 0x8001a, 0x90095, 0x70115, 0x8007a, 0x8003a, 0x900d5, 0x7010d, 0x8006a, 0x8002a, 0x900b5, 0x8000a, 0x8008a, 0x8004a, 0x900f5, 0x70103, 0x80056, 0x80016, 0x8011e, 0x70113, 0x80076, 0x80036, 0x900cd, 0x7010b, 0x80066, 0x80026, 0x900ad, 0x80006, 0x80086, 0x80046, 0x900ed, 0x70107, 0x8005e, 0x8001e, 0x9009d, 0x70117, 0x8007e, 0x8003e, 0x900dd, 0x7010f, 0x8006e, 0x8002e, 0x900bd, 0x8000e, 0x8008e, 0x8004e, 0x900fd, 0x70100, 0x80051, 0x80011, 0x80119, 0x70110, 0x80071, 0x80031, 0x900c3, 0x70108, 0x80061, 0x80021, 0x900a3, 0x80001, 0x80081, 0x80041, 0x900e3, 0x70104, 0x80059, 0x80019, 0x90093, 0x70114, 0x80079, 0x80039, 0x900d3, 0x7010c, 0x80069, 0x80029, 0x900b3, 0x80009, 0x80089, 0x80049, 0x900f3, 0x70102, 0x80055, 0x80015, 0x8011d, 0x70112, 0x80075, 0x80035, 0x900cb, 0x7010a, 0x80065, 0x80025, 0x900ab, 0x80005, 0x80085, 0x80045, 0x900eb, 0x70106, 0x8005d, 0x8001d, 0x9009b, 0x70116, 0x8007d, 0x8003d, 0x900db, 0x7010e, 0x8006d, 0x8002d, 0x900bb, 0x8000d, 0x8008d, 0x8004d, 0x900fb, 0x70101, 0x80053, 0x80013, 0x8011b, 0x70111, 0x80073, 0x80033, 0x900c7, 0x70109, 0x80063, 0x80023, 0x900a7, 0x80003, 0x80083, 0x80043, 0x900e7, 0x70105, 0x8005b, 0x8001b, 0x90097, 0x70115, 0x8007b, 0x8003b, 0x900d7, 0x7010d, 0x8006b, 0x8002b, 0x900b7, 0x8000b, 0x8008b, 0x8004b, 0x900f7, 0x70103, 0x80057, 0x80017, 0x8011f, 0x70113, 0x80077, 0x80037, 0x900cf, 0x7010b, 0x80067, 0x80027, 0x900af, 0x80007, 0x80087, 0x80047, 0x900ef, 0x70107, 0x8005f, 0x8001f, 0x9009f, 0x70117, 0x8007f, 0x8003f, 0x900df, 0x7010f, 0x8006f, 0x8002f, 0x900bf, 0x8000f, 0x8008f, 0x8004f, 0x900ff]), 9];
  6652. var fixedDistCodeTab = [new Int32Array([0x50000, 0x50010, 0x50008, 0x50018, 0x50004, 0x50014, 0x5000c, 0x5001c, 0x50002, 0x50012, 0x5000a, 0x5001a, 0x50006, 0x50016, 0x5000e, 0x00000, 0x50001, 0x50011, 0x50009, 0x50019, 0x50005, 0x50015, 0x5000d, 0x5001d, 0x50003, 0x50013, 0x5000b, 0x5001b, 0x50007, 0x50017, 0x5000f, 0x00000]), 5];
  6653. function FlateStream(str, maybeLength) {
  6654. this.str = str;
  6655. this.dict = str.dict;
  6656. var cmf = str.getByte();
  6657. var flg = str.getByte();
  6658. if (cmf === -1 || flg === -1) {
  6659. throw new _util.FormatError(`Invalid header in flate stream: ${cmf}, ${flg}`);
  6660. }
  6661. if ((cmf & 0x0f) !== 0x08) {
  6662. throw new _util.FormatError(`Unknown compression method in flate stream: ${cmf}, ${flg}`);
  6663. }
  6664. if (((cmf << 8) + flg) % 31 !== 0) {
  6665. throw new _util.FormatError(`Bad FCHECK in flate stream: ${cmf}, ${flg}`);
  6666. }
  6667. if (flg & 0x20) {
  6668. throw new _util.FormatError(`FDICT bit set in flate stream: ${cmf}, ${flg}`);
  6669. }
  6670. this.codeSize = 0;
  6671. this.codeBuf = 0;
  6672. DecodeStream.call(this, maybeLength);
  6673. }
  6674. FlateStream.prototype = Object.create(DecodeStream.prototype);
  6675. FlateStream.prototype.getBits = function FlateStream_getBits(bits) {
  6676. var str = this.str;
  6677. var codeSize = this.codeSize;
  6678. var codeBuf = this.codeBuf;
  6679. var b;
  6680. while (codeSize < bits) {
  6681. if ((b = str.getByte()) === -1) {
  6682. throw new _util.FormatError("Bad encoding in flate stream");
  6683. }
  6684. codeBuf |= b << codeSize;
  6685. codeSize += 8;
  6686. }
  6687. b = codeBuf & (1 << bits) - 1;
  6688. this.codeBuf = codeBuf >> bits;
  6689. this.codeSize = codeSize -= bits;
  6690. return b;
  6691. };
  6692. FlateStream.prototype.getCode = function FlateStream_getCode(table) {
  6693. var str = this.str;
  6694. var codes = table[0];
  6695. var maxLen = table[1];
  6696. var codeSize = this.codeSize;
  6697. var codeBuf = this.codeBuf;
  6698. var b;
  6699. while (codeSize < maxLen) {
  6700. if ((b = str.getByte()) === -1) {
  6701. break;
  6702. }
  6703. codeBuf |= b << codeSize;
  6704. codeSize += 8;
  6705. }
  6706. var code = codes[codeBuf & (1 << maxLen) - 1];
  6707. var codeLen = code >> 16;
  6708. var codeVal = code & 0xffff;
  6709. if (codeLen < 1 || codeSize < codeLen) {
  6710. throw new _util.FormatError("Bad encoding in flate stream");
  6711. }
  6712. this.codeBuf = codeBuf >> codeLen;
  6713. this.codeSize = codeSize - codeLen;
  6714. return codeVal;
  6715. };
  6716. FlateStream.prototype.generateHuffmanTable = function flateStreamGenerateHuffmanTable(lengths) {
  6717. var n = lengths.length;
  6718. var maxLen = 0;
  6719. var i;
  6720. for (i = 0; i < n; ++i) {
  6721. if (lengths[i] > maxLen) {
  6722. maxLen = lengths[i];
  6723. }
  6724. }
  6725. var size = 1 << maxLen;
  6726. var codes = new Int32Array(size);
  6727. for (var len = 1, code = 0, skip = 2; len <= maxLen; ++len, code <<= 1, skip <<= 1) {
  6728. for (var val = 0; val < n; ++val) {
  6729. if (lengths[val] === len) {
  6730. var code2 = 0;
  6731. var t = code;
  6732. for (i = 0; i < len; ++i) {
  6733. code2 = code2 << 1 | t & 1;
  6734. t >>= 1;
  6735. }
  6736. for (i = code2; i < size; i += skip) {
  6737. codes[i] = len << 16 | val;
  6738. }
  6739. ++code;
  6740. }
  6741. }
  6742. }
  6743. return [codes, maxLen];
  6744. };
  6745. FlateStream.prototype.readBlock = function FlateStream_readBlock() {
  6746. var buffer, len;
  6747. var str = this.str;
  6748. var hdr = this.getBits(3);
  6749. if (hdr & 1) {
  6750. this.eof = true;
  6751. }
  6752. hdr >>= 1;
  6753. if (hdr === 0) {
  6754. var b;
  6755. if ((b = str.getByte()) === -1) {
  6756. throw new _util.FormatError("Bad block header in flate stream");
  6757. }
  6758. var blockLen = b;
  6759. if ((b = str.getByte()) === -1) {
  6760. throw new _util.FormatError("Bad block header in flate stream");
  6761. }
  6762. blockLen |= b << 8;
  6763. if ((b = str.getByte()) === -1) {
  6764. throw new _util.FormatError("Bad block header in flate stream");
  6765. }
  6766. var check = b;
  6767. if ((b = str.getByte()) === -1) {
  6768. throw new _util.FormatError("Bad block header in flate stream");
  6769. }
  6770. check |= b << 8;
  6771. if (check !== (~blockLen & 0xffff) && (blockLen !== 0 || check !== 0)) {
  6772. throw new _util.FormatError("Bad uncompressed block length in flate stream");
  6773. }
  6774. this.codeBuf = 0;
  6775. this.codeSize = 0;
  6776. const bufferLength = this.bufferLength,
  6777. end = bufferLength + blockLen;
  6778. buffer = this.ensureBuffer(end);
  6779. this.bufferLength = end;
  6780. if (blockLen === 0) {
  6781. if (str.peekByte() === -1) {
  6782. this.eof = true;
  6783. }
  6784. } else {
  6785. const block = str.getBytes(blockLen);
  6786. buffer.set(block, bufferLength);
  6787. if (block.length < blockLen) {
  6788. this.eof = true;
  6789. }
  6790. }
  6791. return;
  6792. }
  6793. var litCodeTable;
  6794. var distCodeTable;
  6795. if (hdr === 1) {
  6796. litCodeTable = fixedLitCodeTab;
  6797. distCodeTable = fixedDistCodeTab;
  6798. } else if (hdr === 2) {
  6799. var numLitCodes = this.getBits(5) + 257;
  6800. var numDistCodes = this.getBits(5) + 1;
  6801. var numCodeLenCodes = this.getBits(4) + 4;
  6802. var codeLenCodeLengths = new Uint8Array(codeLenCodeMap.length);
  6803. var i;
  6804. for (i = 0; i < numCodeLenCodes; ++i) {
  6805. codeLenCodeLengths[codeLenCodeMap[i]] = this.getBits(3);
  6806. }
  6807. var codeLenCodeTab = this.generateHuffmanTable(codeLenCodeLengths);
  6808. len = 0;
  6809. i = 0;
  6810. var codes = numLitCodes + numDistCodes;
  6811. var codeLengths = new Uint8Array(codes);
  6812. var bitsLength, bitsOffset, what;
  6813. while (i < codes) {
  6814. var code = this.getCode(codeLenCodeTab);
  6815. if (code === 16) {
  6816. bitsLength = 2;
  6817. bitsOffset = 3;
  6818. what = len;
  6819. } else if (code === 17) {
  6820. bitsLength = 3;
  6821. bitsOffset = 3;
  6822. what = len = 0;
  6823. } else if (code === 18) {
  6824. bitsLength = 7;
  6825. bitsOffset = 11;
  6826. what = len = 0;
  6827. } else {
  6828. codeLengths[i++] = len = code;
  6829. continue;
  6830. }
  6831. var repeatLength = this.getBits(bitsLength) + bitsOffset;
  6832. while (repeatLength-- > 0) {
  6833. codeLengths[i++] = what;
  6834. }
  6835. }
  6836. litCodeTable = this.generateHuffmanTable(codeLengths.subarray(0, numLitCodes));
  6837. distCodeTable = this.generateHuffmanTable(codeLengths.subarray(numLitCodes, codes));
  6838. } else {
  6839. throw new _util.FormatError("Unknown block type in flate stream");
  6840. }
  6841. buffer = this.buffer;
  6842. var limit = buffer ? buffer.length : 0;
  6843. var pos = this.bufferLength;
  6844. while (true) {
  6845. var code1 = this.getCode(litCodeTable);
  6846. if (code1 < 256) {
  6847. if (pos + 1 >= limit) {
  6848. buffer = this.ensureBuffer(pos + 1);
  6849. limit = buffer.length;
  6850. }
  6851. buffer[pos++] = code1;
  6852. continue;
  6853. }
  6854. if (code1 === 256) {
  6855. this.bufferLength = pos;
  6856. return;
  6857. }
  6858. code1 -= 257;
  6859. code1 = lengthDecode[code1];
  6860. var code2 = code1 >> 16;
  6861. if (code2 > 0) {
  6862. code2 = this.getBits(code2);
  6863. }
  6864. len = (code1 & 0xffff) + code2;
  6865. code1 = this.getCode(distCodeTable);
  6866. code1 = distDecode[code1];
  6867. code2 = code1 >> 16;
  6868. if (code2 > 0) {
  6869. code2 = this.getBits(code2);
  6870. }
  6871. var dist = (code1 & 0xffff) + code2;
  6872. if (pos + len >= limit) {
  6873. buffer = this.ensureBuffer(pos + len);
  6874. limit = buffer.length;
  6875. }
  6876. for (var k = 0; k < len; ++k, ++pos) {
  6877. buffer[pos] = buffer[pos - dist];
  6878. }
  6879. }
  6880. };
  6881. return FlateStream;
  6882. }();
  6883. exports.FlateStream = FlateStream;
  6884. var PredictorStream = function PredictorStreamClosure() {
  6885. function PredictorStream(str, maybeLength, params) {
  6886. if (!(0, _primitives.isDict)(params)) {
  6887. return str;
  6888. }
  6889. var predictor = this.predictor = params.get("Predictor") || 1;
  6890. if (predictor <= 1) {
  6891. return str;
  6892. }
  6893. if (predictor !== 2 && (predictor < 10 || predictor > 15)) {
  6894. throw new _util.FormatError(`Unsupported predictor: ${predictor}`);
  6895. }
  6896. if (predictor === 2) {
  6897. this.readBlock = this.readBlockTiff;
  6898. } else {
  6899. this.readBlock = this.readBlockPng;
  6900. }
  6901. this.str = str;
  6902. this.dict = str.dict;
  6903. var colors = this.colors = params.get("Colors") || 1;
  6904. var bits = this.bits = params.get("BitsPerComponent") || 8;
  6905. var columns = this.columns = params.get("Columns") || 1;
  6906. this.pixBytes = colors * bits + 7 >> 3;
  6907. this.rowBytes = columns * colors * bits + 7 >> 3;
  6908. DecodeStream.call(this, maybeLength);
  6909. return this;
  6910. }
  6911. PredictorStream.prototype = Object.create(DecodeStream.prototype);
  6912. PredictorStream.prototype.readBlockTiff = function predictorStreamReadBlockTiff() {
  6913. var rowBytes = this.rowBytes;
  6914. var bufferLength = this.bufferLength;
  6915. var buffer = this.ensureBuffer(bufferLength + rowBytes);
  6916. var bits = this.bits;
  6917. var colors = this.colors;
  6918. var rawBytes = this.str.getBytes(rowBytes);
  6919. this.eof = !rawBytes.length;
  6920. if (this.eof) {
  6921. return;
  6922. }
  6923. var inbuf = 0,
  6924. outbuf = 0;
  6925. var inbits = 0,
  6926. outbits = 0;
  6927. var pos = bufferLength;
  6928. var i;
  6929. if (bits === 1 && colors === 1) {
  6930. for (i = 0; i < rowBytes; ++i) {
  6931. var c = rawBytes[i] ^ inbuf;
  6932. c ^= c >> 1;
  6933. c ^= c >> 2;
  6934. c ^= c >> 4;
  6935. inbuf = (c & 1) << 7;
  6936. buffer[pos++] = c;
  6937. }
  6938. } else if (bits === 8) {
  6939. for (i = 0; i < colors; ++i) {
  6940. buffer[pos++] = rawBytes[i];
  6941. }
  6942. for (; i < rowBytes; ++i) {
  6943. buffer[pos] = buffer[pos - colors] + rawBytes[i];
  6944. pos++;
  6945. }
  6946. } else if (bits === 16) {
  6947. var bytesPerPixel = colors * 2;
  6948. for (i = 0; i < bytesPerPixel; ++i) {
  6949. buffer[pos++] = rawBytes[i];
  6950. }
  6951. for (; i < rowBytes; i += 2) {
  6952. var sum = ((rawBytes[i] & 0xff) << 8) + (rawBytes[i + 1] & 0xff) + ((buffer[pos - bytesPerPixel] & 0xff) << 8) + (buffer[pos - bytesPerPixel + 1] & 0xff);
  6953. buffer[pos++] = sum >> 8 & 0xff;
  6954. buffer[pos++] = sum & 0xff;
  6955. }
  6956. } else {
  6957. var compArray = new Uint8Array(colors + 1);
  6958. var bitMask = (1 << bits) - 1;
  6959. var j = 0,
  6960. k = bufferLength;
  6961. var columns = this.columns;
  6962. for (i = 0; i < columns; ++i) {
  6963. for (var kk = 0; kk < colors; ++kk) {
  6964. if (inbits < bits) {
  6965. inbuf = inbuf << 8 | rawBytes[j++] & 0xff;
  6966. inbits += 8;
  6967. }
  6968. compArray[kk] = compArray[kk] + (inbuf >> inbits - bits) & bitMask;
  6969. inbits -= bits;
  6970. outbuf = outbuf << bits | compArray[kk];
  6971. outbits += bits;
  6972. if (outbits >= 8) {
  6973. buffer[k++] = outbuf >> outbits - 8 & 0xff;
  6974. outbits -= 8;
  6975. }
  6976. }
  6977. }
  6978. if (outbits > 0) {
  6979. buffer[k++] = (outbuf << 8 - outbits) + (inbuf & (1 << 8 - outbits) - 1);
  6980. }
  6981. }
  6982. this.bufferLength += rowBytes;
  6983. };
  6984. PredictorStream.prototype.readBlockPng = function predictorStreamReadBlockPng() {
  6985. var rowBytes = this.rowBytes;
  6986. var pixBytes = this.pixBytes;
  6987. var predictor = this.str.getByte();
  6988. var rawBytes = this.str.getBytes(rowBytes);
  6989. this.eof = !rawBytes.length;
  6990. if (this.eof) {
  6991. return;
  6992. }
  6993. var bufferLength = this.bufferLength;
  6994. var buffer = this.ensureBuffer(bufferLength + rowBytes);
  6995. var prevRow = buffer.subarray(bufferLength - rowBytes, bufferLength);
  6996. if (prevRow.length === 0) {
  6997. prevRow = new Uint8Array(rowBytes);
  6998. }
  6999. var i,
  7000. j = bufferLength,
  7001. up,
  7002. c;
  7003. switch (predictor) {
  7004. case 0:
  7005. for (i = 0; i < rowBytes; ++i) {
  7006. buffer[j++] = rawBytes[i];
  7007. }
  7008. break;
  7009. case 1:
  7010. for (i = 0; i < pixBytes; ++i) {
  7011. buffer[j++] = rawBytes[i];
  7012. }
  7013. for (; i < rowBytes; ++i) {
  7014. buffer[j] = buffer[j - pixBytes] + rawBytes[i] & 0xff;
  7015. j++;
  7016. }
  7017. break;
  7018. case 2:
  7019. for (i = 0; i < rowBytes; ++i) {
  7020. buffer[j++] = prevRow[i] + rawBytes[i] & 0xff;
  7021. }
  7022. break;
  7023. case 3:
  7024. for (i = 0; i < pixBytes; ++i) {
  7025. buffer[j++] = (prevRow[i] >> 1) + rawBytes[i];
  7026. }
  7027. for (; i < rowBytes; ++i) {
  7028. buffer[j] = (prevRow[i] + buffer[j - pixBytes] >> 1) + rawBytes[i] & 0xff;
  7029. j++;
  7030. }
  7031. break;
  7032. case 4:
  7033. for (i = 0; i < pixBytes; ++i) {
  7034. up = prevRow[i];
  7035. c = rawBytes[i];
  7036. buffer[j++] = up + c;
  7037. }
  7038. for (; i < rowBytes; ++i) {
  7039. up = prevRow[i];
  7040. var upLeft = prevRow[i - pixBytes];
  7041. var left = buffer[j - pixBytes];
  7042. var p = left + up - upLeft;
  7043. var pa = p - left;
  7044. if (pa < 0) {
  7045. pa = -pa;
  7046. }
  7047. var pb = p - up;
  7048. if (pb < 0) {
  7049. pb = -pb;
  7050. }
  7051. var pc = p - upLeft;
  7052. if (pc < 0) {
  7053. pc = -pc;
  7054. }
  7055. c = rawBytes[i];
  7056. if (pa <= pb && pa <= pc) {
  7057. buffer[j++] = left + c;
  7058. } else if (pb <= pc) {
  7059. buffer[j++] = up + c;
  7060. } else {
  7061. buffer[j++] = upLeft + c;
  7062. }
  7063. }
  7064. break;
  7065. default:
  7066. throw new _util.FormatError(`Unsupported predictor: ${predictor}`);
  7067. }
  7068. this.bufferLength += rowBytes;
  7069. };
  7070. return PredictorStream;
  7071. }();
  7072. exports.PredictorStream = PredictorStream;
  7073. var DecryptStream = function DecryptStreamClosure() {
  7074. function DecryptStream(str, maybeLength, decrypt) {
  7075. this.str = str;
  7076. this.dict = str.dict;
  7077. this.decrypt = decrypt;
  7078. this.nextChunk = null;
  7079. this.initialized = false;
  7080. DecodeStream.call(this, maybeLength);
  7081. }
  7082. var chunkSize = 512;
  7083. DecryptStream.prototype = Object.create(DecodeStream.prototype);
  7084. DecryptStream.prototype.readBlock = function DecryptStream_readBlock() {
  7085. var chunk;
  7086. if (this.initialized) {
  7087. chunk = this.nextChunk;
  7088. } else {
  7089. chunk = this.str.getBytes(chunkSize);
  7090. this.initialized = true;
  7091. }
  7092. if (!chunk || chunk.length === 0) {
  7093. this.eof = true;
  7094. return;
  7095. }
  7096. this.nextChunk = this.str.getBytes(chunkSize);
  7097. var hasMoreData = this.nextChunk && this.nextChunk.length > 0;
  7098. var decrypt = this.decrypt;
  7099. chunk = decrypt(chunk, !hasMoreData);
  7100. var bufferLength = this.bufferLength;
  7101. var i,
  7102. n = chunk.length;
  7103. var buffer = this.ensureBuffer(bufferLength + n);
  7104. for (i = 0; i < n; i++) {
  7105. buffer[bufferLength++] = chunk[i];
  7106. }
  7107. this.bufferLength = bufferLength;
  7108. };
  7109. return DecryptStream;
  7110. }();
  7111. exports.DecryptStream = DecryptStream;
  7112. var Ascii85Stream = function Ascii85StreamClosure() {
  7113. function Ascii85Stream(str, maybeLength) {
  7114. this.str = str;
  7115. this.dict = str.dict;
  7116. this.input = new Uint8Array(5);
  7117. if (maybeLength) {
  7118. maybeLength = 0.8 * maybeLength;
  7119. }
  7120. DecodeStream.call(this, maybeLength);
  7121. }
  7122. Ascii85Stream.prototype = Object.create(DecodeStream.prototype);
  7123. Ascii85Stream.prototype.readBlock = function Ascii85Stream_readBlock() {
  7124. var TILDA_CHAR = 0x7e;
  7125. var Z_LOWER_CHAR = 0x7a;
  7126. var EOF = -1;
  7127. var str = this.str;
  7128. var c = str.getByte();
  7129. while ((0, _core_utils.isWhiteSpace)(c)) {
  7130. c = str.getByte();
  7131. }
  7132. if (c === EOF || c === TILDA_CHAR) {
  7133. this.eof = true;
  7134. return;
  7135. }
  7136. var bufferLength = this.bufferLength,
  7137. buffer;
  7138. var i;
  7139. if (c === Z_LOWER_CHAR) {
  7140. buffer = this.ensureBuffer(bufferLength + 4);
  7141. for (i = 0; i < 4; ++i) {
  7142. buffer[bufferLength + i] = 0;
  7143. }
  7144. this.bufferLength += 4;
  7145. } else {
  7146. var input = this.input;
  7147. input[0] = c;
  7148. for (i = 1; i < 5; ++i) {
  7149. c = str.getByte();
  7150. while ((0, _core_utils.isWhiteSpace)(c)) {
  7151. c = str.getByte();
  7152. }
  7153. input[i] = c;
  7154. if (c === EOF || c === TILDA_CHAR) {
  7155. break;
  7156. }
  7157. }
  7158. buffer = this.ensureBuffer(bufferLength + i - 1);
  7159. this.bufferLength += i - 1;
  7160. if (i < 5) {
  7161. for (; i < 5; ++i) {
  7162. input[i] = 0x21 + 84;
  7163. }
  7164. this.eof = true;
  7165. }
  7166. var t = 0;
  7167. for (i = 0; i < 5; ++i) {
  7168. t = t * 85 + (input[i] - 0x21);
  7169. }
  7170. for (i = 3; i >= 0; --i) {
  7171. buffer[bufferLength + i] = t & 0xff;
  7172. t >>= 8;
  7173. }
  7174. }
  7175. };
  7176. return Ascii85Stream;
  7177. }();
  7178. exports.Ascii85Stream = Ascii85Stream;
  7179. var AsciiHexStream = function AsciiHexStreamClosure() {
  7180. function AsciiHexStream(str, maybeLength) {
  7181. this.str = str;
  7182. this.dict = str.dict;
  7183. this.firstDigit = -1;
  7184. if (maybeLength) {
  7185. maybeLength = 0.5 * maybeLength;
  7186. }
  7187. DecodeStream.call(this, maybeLength);
  7188. }
  7189. AsciiHexStream.prototype = Object.create(DecodeStream.prototype);
  7190. AsciiHexStream.prototype.readBlock = function AsciiHexStream_readBlock() {
  7191. var UPSTREAM_BLOCK_SIZE = 8000;
  7192. var bytes = this.str.getBytes(UPSTREAM_BLOCK_SIZE);
  7193. if (!bytes.length) {
  7194. this.eof = true;
  7195. return;
  7196. }
  7197. var maxDecodeLength = bytes.length + 1 >> 1;
  7198. var buffer = this.ensureBuffer(this.bufferLength + maxDecodeLength);
  7199. var bufferLength = this.bufferLength;
  7200. var firstDigit = this.firstDigit;
  7201. for (var i = 0, ii = bytes.length; i < ii; i++) {
  7202. var ch = bytes[i],
  7203. digit;
  7204. if (ch >= 0x30 && ch <= 0x39) {
  7205. digit = ch & 0x0f;
  7206. } else if (ch >= 0x41 && ch <= 0x46 || ch >= 0x61 && ch <= 0x66) {
  7207. digit = (ch & 0x0f) + 9;
  7208. } else if (ch === 0x3e) {
  7209. this.eof = true;
  7210. break;
  7211. } else {
  7212. continue;
  7213. }
  7214. if (firstDigit < 0) {
  7215. firstDigit = digit;
  7216. } else {
  7217. buffer[bufferLength++] = firstDigit << 4 | digit;
  7218. firstDigit = -1;
  7219. }
  7220. }
  7221. if (firstDigit >= 0 && this.eof) {
  7222. buffer[bufferLength++] = firstDigit << 4;
  7223. firstDigit = -1;
  7224. }
  7225. this.firstDigit = firstDigit;
  7226. this.bufferLength = bufferLength;
  7227. };
  7228. return AsciiHexStream;
  7229. }();
  7230. exports.AsciiHexStream = AsciiHexStream;
  7231. var RunLengthStream = function RunLengthStreamClosure() {
  7232. function RunLengthStream(str, maybeLength) {
  7233. this.str = str;
  7234. this.dict = str.dict;
  7235. DecodeStream.call(this, maybeLength);
  7236. }
  7237. RunLengthStream.prototype = Object.create(DecodeStream.prototype);
  7238. RunLengthStream.prototype.readBlock = function RunLengthStream_readBlock() {
  7239. var repeatHeader = this.str.getBytes(2);
  7240. if (!repeatHeader || repeatHeader.length < 2 || repeatHeader[0] === 128) {
  7241. this.eof = true;
  7242. return;
  7243. }
  7244. var buffer;
  7245. var bufferLength = this.bufferLength;
  7246. var n = repeatHeader[0];
  7247. if (n < 128) {
  7248. buffer = this.ensureBuffer(bufferLength + n + 1);
  7249. buffer[bufferLength++] = repeatHeader[1];
  7250. if (n > 0) {
  7251. var source = this.str.getBytes(n);
  7252. buffer.set(source, bufferLength);
  7253. bufferLength += n;
  7254. }
  7255. } else {
  7256. n = 257 - n;
  7257. var b = repeatHeader[1];
  7258. buffer = this.ensureBuffer(bufferLength + n + 1);
  7259. for (var i = 0; i < n; i++) {
  7260. buffer[bufferLength++] = b;
  7261. }
  7262. }
  7263. this.bufferLength = bufferLength;
  7264. };
  7265. return RunLengthStream;
  7266. }();
  7267. exports.RunLengthStream = RunLengthStream;
  7268. var LZWStream = function LZWStreamClosure() {
  7269. function LZWStream(str, maybeLength, earlyChange) {
  7270. this.str = str;
  7271. this.dict = str.dict;
  7272. this.cachedData = 0;
  7273. this.bitsCached = 0;
  7274. var maxLzwDictionarySize = 4096;
  7275. var lzwState = {
  7276. earlyChange,
  7277. codeLength: 9,
  7278. nextCode: 258,
  7279. dictionaryValues: new Uint8Array(maxLzwDictionarySize),
  7280. dictionaryLengths: new Uint16Array(maxLzwDictionarySize),
  7281. dictionaryPrevCodes: new Uint16Array(maxLzwDictionarySize),
  7282. currentSequence: new Uint8Array(maxLzwDictionarySize),
  7283. currentSequenceLength: 0
  7284. };
  7285. for (var i = 0; i < 256; ++i) {
  7286. lzwState.dictionaryValues[i] = i;
  7287. lzwState.dictionaryLengths[i] = 1;
  7288. }
  7289. this.lzwState = lzwState;
  7290. DecodeStream.call(this, maybeLength);
  7291. }
  7292. LZWStream.prototype = Object.create(DecodeStream.prototype);
  7293. LZWStream.prototype.readBits = function LZWStream_readBits(n) {
  7294. var bitsCached = this.bitsCached;
  7295. var cachedData = this.cachedData;
  7296. while (bitsCached < n) {
  7297. var c = this.str.getByte();
  7298. if (c === -1) {
  7299. this.eof = true;
  7300. return null;
  7301. }
  7302. cachedData = cachedData << 8 | c;
  7303. bitsCached += 8;
  7304. }
  7305. this.bitsCached = bitsCached -= n;
  7306. this.cachedData = cachedData;
  7307. this.lastCode = null;
  7308. return cachedData >>> bitsCached & (1 << n) - 1;
  7309. };
  7310. LZWStream.prototype.readBlock = function LZWStream_readBlock() {
  7311. var blockSize = 512;
  7312. var estimatedDecodedSize = blockSize * 2,
  7313. decodedSizeDelta = blockSize;
  7314. var i, j, q;
  7315. var lzwState = this.lzwState;
  7316. if (!lzwState) {
  7317. return;
  7318. }
  7319. var earlyChange = lzwState.earlyChange;
  7320. var nextCode = lzwState.nextCode;
  7321. var dictionaryValues = lzwState.dictionaryValues;
  7322. var dictionaryLengths = lzwState.dictionaryLengths;
  7323. var dictionaryPrevCodes = lzwState.dictionaryPrevCodes;
  7324. var codeLength = lzwState.codeLength;
  7325. var prevCode = lzwState.prevCode;
  7326. var currentSequence = lzwState.currentSequence;
  7327. var currentSequenceLength = lzwState.currentSequenceLength;
  7328. var decodedLength = 0;
  7329. var currentBufferLength = this.bufferLength;
  7330. var buffer = this.ensureBuffer(this.bufferLength + estimatedDecodedSize);
  7331. for (i = 0; i < blockSize; i++) {
  7332. var code = this.readBits(codeLength);
  7333. var hasPrev = currentSequenceLength > 0;
  7334. if (code < 256) {
  7335. currentSequence[0] = code;
  7336. currentSequenceLength = 1;
  7337. } else if (code >= 258) {
  7338. if (code < nextCode) {
  7339. currentSequenceLength = dictionaryLengths[code];
  7340. for (j = currentSequenceLength - 1, q = code; j >= 0; j--) {
  7341. currentSequence[j] = dictionaryValues[q];
  7342. q = dictionaryPrevCodes[q];
  7343. }
  7344. } else {
  7345. currentSequence[currentSequenceLength++] = currentSequence[0];
  7346. }
  7347. } else if (code === 256) {
  7348. codeLength = 9;
  7349. nextCode = 258;
  7350. currentSequenceLength = 0;
  7351. continue;
  7352. } else {
  7353. this.eof = true;
  7354. delete this.lzwState;
  7355. break;
  7356. }
  7357. if (hasPrev) {
  7358. dictionaryPrevCodes[nextCode] = prevCode;
  7359. dictionaryLengths[nextCode] = dictionaryLengths[prevCode] + 1;
  7360. dictionaryValues[nextCode] = currentSequence[0];
  7361. nextCode++;
  7362. codeLength = nextCode + earlyChange & nextCode + earlyChange - 1 ? codeLength : Math.min(Math.log(nextCode + earlyChange) / 0.6931471805599453 + 1, 12) | 0;
  7363. }
  7364. prevCode = code;
  7365. decodedLength += currentSequenceLength;
  7366. if (estimatedDecodedSize < decodedLength) {
  7367. do {
  7368. estimatedDecodedSize += decodedSizeDelta;
  7369. } while (estimatedDecodedSize < decodedLength);
  7370. buffer = this.ensureBuffer(this.bufferLength + estimatedDecodedSize);
  7371. }
  7372. for (j = 0; j < currentSequenceLength; j++) {
  7373. buffer[currentBufferLength++] = currentSequence[j];
  7374. }
  7375. }
  7376. lzwState.nextCode = nextCode;
  7377. lzwState.codeLength = codeLength;
  7378. lzwState.prevCode = prevCode;
  7379. lzwState.currentSequenceLength = currentSequenceLength;
  7380. this.bufferLength = currentBufferLength;
  7381. };
  7382. return LZWStream;
  7383. }();
  7384. exports.LZWStream = LZWStream;
  7385. var NullStream = function NullStreamClosure() {
  7386. function NullStream() {
  7387. Stream.call(this, new Uint8Array(0));
  7388. }
  7389. NullStream.prototype = Stream.prototype;
  7390. return NullStream;
  7391. }();
  7392. exports.NullStream = NullStream;
  7393. /***/ }),
  7394. /* 13 */
  7395. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  7396. Object.defineProperty(exports, "__esModule", ({
  7397. value: true
  7398. }));
  7399. exports.CCITTFaxStream = void 0;
  7400. var _primitives = __w_pdfjs_require__(5);
  7401. var _ccitt = __w_pdfjs_require__(14);
  7402. var _stream = __w_pdfjs_require__(12);
  7403. var CCITTFaxStream = function CCITTFaxStreamClosure() {
  7404. function CCITTFaxStream(str, maybeLength, params) {
  7405. this.str = str;
  7406. this.dict = str.dict;
  7407. if (!(0, _primitives.isDict)(params)) {
  7408. params = _primitives.Dict.empty;
  7409. }
  7410. const source = {
  7411. next() {
  7412. return str.getByte();
  7413. }
  7414. };
  7415. this.ccittFaxDecoder = new _ccitt.CCITTFaxDecoder(source, {
  7416. K: params.get("K"),
  7417. EndOfLine: params.get("EndOfLine"),
  7418. EncodedByteAlign: params.get("EncodedByteAlign"),
  7419. Columns: params.get("Columns"),
  7420. Rows: params.get("Rows"),
  7421. EndOfBlock: params.get("EndOfBlock"),
  7422. BlackIs1: params.get("BlackIs1")
  7423. });
  7424. _stream.DecodeStream.call(this, maybeLength);
  7425. }
  7426. CCITTFaxStream.prototype = Object.create(_stream.DecodeStream.prototype);
  7427. CCITTFaxStream.prototype.readBlock = function () {
  7428. while (!this.eof) {
  7429. const c = this.ccittFaxDecoder.readNextChar();
  7430. if (c === -1) {
  7431. this.eof = true;
  7432. return;
  7433. }
  7434. this.ensureBuffer(this.bufferLength + 1);
  7435. this.buffer[this.bufferLength++] = c;
  7436. }
  7437. };
  7438. return CCITTFaxStream;
  7439. }();
  7440. exports.CCITTFaxStream = CCITTFaxStream;
  7441. /***/ }),
  7442. /* 14 */
  7443. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  7444. Object.defineProperty(exports, "__esModule", ({
  7445. value: true
  7446. }));
  7447. exports.CCITTFaxDecoder = void 0;
  7448. var _util = __w_pdfjs_require__(2);
  7449. const CCITTFaxDecoder = function CCITTFaxDecoder() {
  7450. const ccittEOL = -2;
  7451. const ccittEOF = -1;
  7452. const twoDimPass = 0;
  7453. const twoDimHoriz = 1;
  7454. const twoDimVert0 = 2;
  7455. const twoDimVertR1 = 3;
  7456. const twoDimVertL1 = 4;
  7457. const twoDimVertR2 = 5;
  7458. const twoDimVertL2 = 6;
  7459. const twoDimVertR3 = 7;
  7460. const twoDimVertL3 = 8;
  7461. const twoDimTable = [[-1, -1], [-1, -1], [7, twoDimVertL3], [7, twoDimVertR3], [6, twoDimVertL2], [6, twoDimVertL2], [6, twoDimVertR2], [6, twoDimVertR2], [4, twoDimPass], [4, twoDimPass], [4, twoDimPass], [4, twoDimPass], [4, twoDimPass], [4, twoDimPass], [4, twoDimPass], [4, twoDimPass], [3, twoDimHoriz], [3, twoDimHoriz], [3, twoDimHoriz], [3, twoDimHoriz], [3, twoDimHoriz], [3, twoDimHoriz], [3, twoDimHoriz], [3, twoDimHoriz], [3, twoDimHoriz], [3, twoDimHoriz], [3, twoDimHoriz], [3, twoDimHoriz], [3, twoDimHoriz], [3, twoDimHoriz], [3, twoDimHoriz], [3, twoDimHoriz], [3, twoDimVertL1], [3, twoDimVertL1], [3, twoDimVertL1], [3, twoDimVertL1], [3, twoDimVertL1], [3, twoDimVertL1], [3, twoDimVertL1], [3, twoDimVertL1], [3, twoDimVertL1], [3, twoDimVertL1], [3, twoDimVertL1], [3, twoDimVertL1], [3, twoDimVertL1], [3, twoDimVertL1], [3, twoDimVertL1], [3, twoDimVertL1], [3, twoDimVertR1], [3, twoDimVertR1], [3, twoDimVertR1], [3, twoDimVertR1], [3, twoDimVertR1], [3, twoDimVertR1], [3, twoDimVertR1], [3, twoDimVertR1], [3, twoDimVertR1], [3, twoDimVertR1], [3, twoDimVertR1], [3, twoDimVertR1], [3, twoDimVertR1], [3, twoDimVertR1], [3, twoDimVertR1], [3, twoDimVertR1], [1, twoDimVert0], [1, twoDimVert0], [1, twoDimVert0], [1, twoDimVert0], [1, twoDimVert0], [1, twoDimVert0], [1, twoDimVert0], [1, twoDimVert0], [1, twoDimVert0], [1, twoDimVert0], [1, twoDimVert0], [1, twoDimVert0], [1, twoDimVert0], [1, twoDimVert0], [1, twoDimVert0], [1, twoDimVert0], [1, twoDimVert0], [1, twoDimVert0], [1, twoDimVert0], [1, twoDimVert0], [1, twoDimVert0], [1, twoDimVert0], [1, twoDimVert0], [1, twoDimVert0], [1, twoDimVert0], [1, twoDimVert0], [1, twoDimVert0], [1, twoDimVert0], [1, twoDimVert0], [1, twoDimVert0], [1, twoDimVert0], [1, twoDimVert0], [1, twoDimVert0], [1, twoDimVert0], [1, twoDimVert0], [1, twoDimVert0], [1, twoDimVert0], [1, twoDimVert0], [1, twoDimVert0], [1, twoDimVert0], [1, twoDimVert0], [1, twoDimVert0], [1, twoDimVert0], [1, twoDimVert0], [1, twoDimVert0], [1, twoDimVert0], [1, twoDimVert0], [1, twoDimVert0], [1, twoDimVert0], [1, twoDimVert0], [1, twoDimVert0], [1, twoDimVert0], [1, twoDimVert0], [1, twoDimVert0], [1, twoDimVert0], [1, twoDimVert0], [1, twoDimVert0], [1, twoDimVert0], [1, twoDimVert0], [1, twoDimVert0], [1, twoDimVert0], [1, twoDimVert0], [1, twoDimVert0], [1, twoDimVert0]];
  7462. const whiteTable1 = [[-1, -1], [12, ccittEOL], [-1, -1], [-1, -1], [-1, -1], [-1, -1], [-1, -1], [-1, -1], [-1, -1], [-1, -1], [-1, -1], [-1, -1], [-1, -1], [-1, -1], [-1, -1], [-1, -1], [11, 1792], [11, 1792], [12, 1984], [12, 2048], [12, 2112], [12, 2176], [12, 2240], [12, 2304], [11, 1856], [11, 1856], [11, 1920], [11, 1920], [12, 2368], [12, 2432], [12, 2496], [12, 2560]];
  7463. const whiteTable2 = [[-1, -1], [-1, -1], [-1, -1], [-1, -1], [8, 29], [8, 29], [8, 30], [8, 30], [8, 45], [8, 45], [8, 46], [8, 46], [7, 22], [7, 22], [7, 22], [7, 22], [7, 23], [7, 23], [7, 23], [7, 23], [8, 47], [8, 47], [8, 48], [8, 48], [6, 13], [6, 13], [6, 13], [6, 13], [6, 13], [6, 13], [6, 13], [6, 13], [7, 20], [7, 20], [7, 20], [7, 20], [8, 33], [8, 33], [8, 34], [8, 34], [8, 35], [8, 35], [8, 36], [8, 36], [8, 37], [8, 37], [8, 38], [8, 38], [7, 19], [7, 19], [7, 19], [7, 19], [8, 31], [8, 31], [8, 32], [8, 32], [6, 1], [6, 1], [6, 1], [6, 1], [6, 1], [6, 1], [6, 1], [6, 1], [6, 12], [6, 12], [6, 12], [6, 12], [6, 12], [6, 12], [6, 12], [6, 12], [8, 53], [8, 53], [8, 54], [8, 54], [7, 26], [7, 26], [7, 26], [7, 26], [8, 39], [8, 39], [8, 40], [8, 40], [8, 41], [8, 41], [8, 42], [8, 42], [8, 43], [8, 43], [8, 44], [8, 44], [7, 21], [7, 21], [7, 21], [7, 21], [7, 28], [7, 28], [7, 28], [7, 28], [8, 61], [8, 61], [8, 62], [8, 62], [8, 63], [8, 63], [8, 0], [8, 0], [8, 320], [8, 320], [8, 384], [8, 384], [5, 10], [5, 10], [5, 10], [5, 10], [5, 10], [5, 10], [5, 10], [5, 10], [5, 10], [5, 10], [5, 10], [5, 10], [5, 10], [5, 10], [5, 10], [5, 10], [5, 11], [5, 11], [5, 11], [5, 11], [5, 11], [5, 11], [5, 11], [5, 11], [5, 11], [5, 11], [5, 11], [5, 11], [5, 11], [5, 11], [5, 11], [5, 11], [7, 27], [7, 27], [7, 27], [7, 27], [8, 59], [8, 59], [8, 60], [8, 60], [9, 1472], [9, 1536], [9, 1600], [9, 1728], [7, 18], [7, 18], [7, 18], [7, 18], [7, 24], [7, 24], [7, 24], [7, 24], [8, 49], [8, 49], [8, 50], [8, 50], [8, 51], [8, 51], [8, 52], [8, 52], [7, 25], [7, 25], [7, 25], [7, 25], [8, 55], [8, 55], [8, 56], [8, 56], [8, 57], [8, 57], [8, 58], [8, 58], [6, 192], [6, 192], [6, 192], [6, 192], [6, 192], [6, 192], [6, 192], [6, 192], [6, 1664], [6, 1664], [6, 1664], [6, 1664], [6, 1664], [6, 1664], [6, 1664], [6, 1664], [8, 448], [8, 448], [8, 512], [8, 512], [9, 704], [9, 768], [8, 640], [8, 640], [8, 576], [8, 576], [9, 832], [9, 896], [9, 960], [9, 1024], [9, 1088], [9, 1152], [9, 1216], [9, 1280], [9, 1344], [9, 1408], [7, 256], [7, 256], [7, 256], [7, 256], [4, 2], [4, 2], [4, 2], [4, 2], [4, 2], [4, 2], [4, 2], [4, 2], [4, 2], [4, 2], [4, 2], [4, 2], [4, 2], [4, 2], [4, 2], [4, 2], [4, 2], [4, 2], [4, 2], [4, 2], [4, 2], [4, 2], [4, 2], [4, 2], [4, 2], [4, 2], [4, 2], [4, 2], [4, 2], [4, 2], [4, 2], [4, 2], [4, 3], [4, 3], [4, 3], [4, 3], [4, 3], [4, 3], [4, 3], [4, 3], [4, 3], [4, 3], [4, 3], [4, 3], [4, 3], [4, 3], [4, 3], [4, 3], [4, 3], [4, 3], [4, 3], [4, 3], [4, 3], [4, 3], [4, 3], [4, 3], [4, 3], [4, 3], [4, 3], [4, 3], [4, 3], [4, 3], [4, 3], [4, 3], [5, 128], [5, 128], [5, 128], [5, 128], [5, 128], [5, 128], [5, 128], [5, 128], [5, 128], [5, 128], [5, 128], [5, 128], [5, 128], [5, 128], [5, 128], [5, 128], [5, 8], [5, 8], [5, 8], [5, 8], [5, 8], [5, 8], [5, 8], [5, 8], [5, 8], [5, 8], [5, 8], [5, 8], [5, 8], [5, 8], [5, 8], [5, 8], [5, 9], [5, 9], [5, 9], [5, 9], [5, 9], [5, 9], [5, 9], [5, 9], [5, 9], [5, 9], [5, 9], [5, 9], [5, 9], [5, 9], [5, 9], [5, 9], [6, 16], [6, 16], [6, 16], [6, 16], [6, 16], [6, 16], [6, 16], [6, 16], [6, 17], [6, 17], [6, 17], [6, 17], [6, 17], [6, 17], [6, 17], [6, 17], [4, 4], [4, 4], [4, 4], [4, 4], [4, 4], [4, 4], [4, 4], [4, 4], [4, 4], [4, 4], [4, 4], [4, 4], [4, 4], [4, 4], [4, 4], [4, 4], [4, 4], [4, 4], [4, 4], [4, 4], [4, 4], [4, 4], [4, 4], [4, 4], [4, 4], [4, 4], [4, 4], [4, 4], [4, 4], [4, 4], [4, 4], [4, 4], [4, 5], [4, 5], [4, 5], [4, 5], [4, 5], [4, 5], [4, 5], [4, 5], [4, 5], [4, 5], [4, 5], [4, 5], [4, 5], [4, 5], [4, 5], [4, 5], [4, 5], [4, 5], [4, 5], [4, 5], [4, 5], [4, 5], [4, 5], [4, 5], [4, 5], [4, 5], [4, 5], [4, 5], [4, 5], [4, 5], [4, 5], [4, 5], [6, 14], [6, 14], [6, 14], [6, 14], [6, 14], [6, 14], [6, 14], [6, 14], [6, 15], [6, 15], [6, 15], [6, 15], [6, 15], [6, 15], [6, 15], [6, 15], [5, 64], [5, 64], [5, 64], [5, 64], [5, 64], [5, 64], [5, 64], [5, 64], [5, 64], [5, 64], [5, 64], [5, 64], [5, 64], [5, 64], [5, 64], [5, 64], [4, 6], [4, 6], [4, 6], [4, 6], [4, 6], [4, 6], [4, 6], [4, 6], [4, 6], [4, 6], [4, 6], [4, 6], [4, 6], [4, 6], [4, 6], [4, 6], [4, 6], [4, 6], [4, 6], [4, 6], [4, 6], [4, 6], [4, 6], [4, 6], [4, 6], [4, 6], [4, 6], [4, 6], [4, 6], [4, 6], [4, 6], [4, 6], [4, 7], [4, 7], [4, 7], [4, 7], [4, 7], [4, 7], [4, 7], [4, 7], [4, 7], [4, 7], [4, 7], [4, 7], [4, 7], [4, 7], [4, 7], [4, 7], [4, 7], [4, 7], [4, 7], [4, 7], [4, 7], [4, 7], [4, 7], [4, 7], [4, 7], [4, 7], [4, 7], [4, 7], [4, 7], [4, 7], [4, 7], [4, 7]];
  7464. const blackTable1 = [[-1, -1], [-1, -1], [12, ccittEOL], [12, ccittEOL], [-1, -1], [-1, -1], [-1, -1], [-1, -1], [-1, -1], [-1, -1], [-1, -1], [-1, -1], [-1, -1], [-1, -1], [-1, -1], [-1, -1], [-1, -1], [-1, -1], [-1, -1], [-1, -1], [-1, -1], [-1, -1], [-1, -1], [-1, -1], [-1, -1], [-1, -1], [-1, -1], [-1, -1], [-1, -1], [-1, -1], [-1, -1], [-1, -1], [11, 1792], [11, 1792], [11, 1792], [11, 1792], [12, 1984], [12, 1984], [12, 2048], [12, 2048], [12, 2112], [12, 2112], [12, 2176], [12, 2176], [12, 2240], [12, 2240], [12, 2304], [12, 2304], [11, 1856], [11, 1856], [11, 1856], [11, 1856], [11, 1920], [11, 1920], [11, 1920], [11, 1920], [12, 2368], [12, 2368], [12, 2432], [12, 2432], [12, 2496], [12, 2496], [12, 2560], [12, 2560], [10, 18], [10, 18], [10, 18], [10, 18], [10, 18], [10, 18], [10, 18], [10, 18], [12, 52], [12, 52], [13, 640], [13, 704], [13, 768], [13, 832], [12, 55], [12, 55], [12, 56], [12, 56], [13, 1280], [13, 1344], [13, 1408], [13, 1472], [12, 59], [12, 59], [12, 60], [12, 60], [13, 1536], [13, 1600], [11, 24], [11, 24], [11, 24], [11, 24], [11, 25], [11, 25], [11, 25], [11, 25], [13, 1664], [13, 1728], [12, 320], [12, 320], [12, 384], [12, 384], [12, 448], [12, 448], [13, 512], [13, 576], [12, 53], [12, 53], [12, 54], [12, 54], [13, 896], [13, 960], [13, 1024], [13, 1088], [13, 1152], [13, 1216], [10, 64], [10, 64], [10, 64], [10, 64], [10, 64], [10, 64], [10, 64], [10, 64]];
  7465. const blackTable2 = [[8, 13], [8, 13], [8, 13], [8, 13], [8, 13], [8, 13], [8, 13], [8, 13], [8, 13], [8, 13], [8, 13], [8, 13], [8, 13], [8, 13], [8, 13], [8, 13], [11, 23], [11, 23], [12, 50], [12, 51], [12, 44], [12, 45], [12, 46], [12, 47], [12, 57], [12, 58], [12, 61], [12, 256], [10, 16], [10, 16], [10, 16], [10, 16], [10, 17], [10, 17], [10, 17], [10, 17], [12, 48], [12, 49], [12, 62], [12, 63], [12, 30], [12, 31], [12, 32], [12, 33], [12, 40], [12, 41], [11, 22], [11, 22], [8, 14], [8, 14], [8, 14], [8, 14], [8, 14], [8, 14], [8, 14], [8, 14], [8, 14], [8, 14], [8, 14], [8, 14], [8, 14], [8, 14], [8, 14], [8, 14], [7, 10], [7, 10], [7, 10], [7, 10], [7, 10], [7, 10], [7, 10], [7, 10], [7, 10], [7, 10], [7, 10], [7, 10], [7, 10], [7, 10], [7, 10], [7, 10], [7, 10], [7, 10], [7, 10], [7, 10], [7, 10], [7, 10], [7, 10], [7, 10], [7, 10], [7, 10], [7, 10], [7, 10], [7, 10], [7, 10], [7, 10], [7, 10], [7, 11], [7, 11], [7, 11], [7, 11], [7, 11], [7, 11], [7, 11], [7, 11], [7, 11], [7, 11], [7, 11], [7, 11], [7, 11], [7, 11], [7, 11], [7, 11], [7, 11], [7, 11], [7, 11], [7, 11], [7, 11], [7, 11], [7, 11], [7, 11], [7, 11], [7, 11], [7, 11], [7, 11], [7, 11], [7, 11], [7, 11], [7, 11], [9, 15], [9, 15], [9, 15], [9, 15], [9, 15], [9, 15], [9, 15], [9, 15], [12, 128], [12, 192], [12, 26], [12, 27], [12, 28], [12, 29], [11, 19], [11, 19], [11, 20], [11, 20], [12, 34], [12, 35], [12, 36], [12, 37], [12, 38], [12, 39], [11, 21], [11, 21], [12, 42], [12, 43], [10, 0], [10, 0], [10, 0], [10, 0], [7, 12], [7, 12], [7, 12], [7, 12], [7, 12], [7, 12], [7, 12], [7, 12], [7, 12], [7, 12], [7, 12], [7, 12], [7, 12], [7, 12], [7, 12], [7, 12], [7, 12], [7, 12], [7, 12], [7, 12], [7, 12], [7, 12], [7, 12], [7, 12], [7, 12], [7, 12], [7, 12], [7, 12], [7, 12], [7, 12], [7, 12], [7, 12]];
  7466. const blackTable3 = [[-1, -1], [-1, -1], [-1, -1], [-1, -1], [6, 9], [6, 8], [5, 7], [5, 7], [4, 6], [4, 6], [4, 6], [4, 6], [4, 5], [4, 5], [4, 5], [4, 5], [3, 1], [3, 1], [3, 1], [3, 1], [3, 1], [3, 1], [3, 1], [3, 1], [3, 4], [3, 4], [3, 4], [3, 4], [3, 4], [3, 4], [3, 4], [3, 4], [2, 3], [2, 3], [2, 3], [2, 3], [2, 3], [2, 3], [2, 3], [2, 3], [2, 3], [2, 3], [2, 3], [2, 3], [2, 3], [2, 3], [2, 3], [2, 3], [2, 2], [2, 2], [2, 2], [2, 2], [2, 2], [2, 2], [2, 2], [2, 2], [2, 2], [2, 2], [2, 2], [2, 2], [2, 2], [2, 2], [2, 2], [2, 2]];
  7467. function CCITTFaxDecoder(source, options = {}) {
  7468. if (!source || typeof source.next !== "function") {
  7469. throw new Error('CCITTFaxDecoder - invalid "source" parameter.');
  7470. }
  7471. this.source = source;
  7472. this.eof = false;
  7473. this.encoding = options.K || 0;
  7474. this.eoline = options.EndOfLine || false;
  7475. this.byteAlign = options.EncodedByteAlign || false;
  7476. this.columns = options.Columns || 1728;
  7477. this.rows = options.Rows || 0;
  7478. let eoblock = options.EndOfBlock;
  7479. if (eoblock === null || eoblock === undefined) {
  7480. eoblock = true;
  7481. }
  7482. this.eoblock = eoblock;
  7483. this.black = options.BlackIs1 || false;
  7484. this.codingLine = new Uint32Array(this.columns + 1);
  7485. this.refLine = new Uint32Array(this.columns + 2);
  7486. this.codingLine[0] = this.columns;
  7487. this.codingPos = 0;
  7488. this.row = 0;
  7489. this.nextLine2D = this.encoding < 0;
  7490. this.inputBits = 0;
  7491. this.inputBuf = 0;
  7492. this.outputBits = 0;
  7493. this.rowsDone = false;
  7494. let code1;
  7495. while ((code1 = this._lookBits(12)) === 0) {
  7496. this._eatBits(1);
  7497. }
  7498. if (code1 === 1) {
  7499. this._eatBits(12);
  7500. }
  7501. if (this.encoding > 0) {
  7502. this.nextLine2D = !this._lookBits(1);
  7503. this._eatBits(1);
  7504. }
  7505. }
  7506. CCITTFaxDecoder.prototype = {
  7507. readNextChar() {
  7508. if (this.eof) {
  7509. return -1;
  7510. }
  7511. const refLine = this.refLine;
  7512. const codingLine = this.codingLine;
  7513. const columns = this.columns;
  7514. let refPos, blackPixels, bits, i;
  7515. if (this.outputBits === 0) {
  7516. if (this.rowsDone) {
  7517. this.eof = true;
  7518. }
  7519. if (this.eof) {
  7520. return -1;
  7521. }
  7522. this.err = false;
  7523. let code1, code2, code3;
  7524. if (this.nextLine2D) {
  7525. for (i = 0; codingLine[i] < columns; ++i) {
  7526. refLine[i] = codingLine[i];
  7527. }
  7528. refLine[i++] = columns;
  7529. refLine[i] = columns;
  7530. codingLine[0] = 0;
  7531. this.codingPos = 0;
  7532. refPos = 0;
  7533. blackPixels = 0;
  7534. while (codingLine[this.codingPos] < columns) {
  7535. code1 = this._getTwoDimCode();
  7536. switch (code1) {
  7537. case twoDimPass:
  7538. this._addPixels(refLine[refPos + 1], blackPixels);
  7539. if (refLine[refPos + 1] < columns) {
  7540. refPos += 2;
  7541. }
  7542. break;
  7543. case twoDimHoriz:
  7544. code1 = code2 = 0;
  7545. if (blackPixels) {
  7546. do {
  7547. code1 += code3 = this._getBlackCode();
  7548. } while (code3 >= 64);
  7549. do {
  7550. code2 += code3 = this._getWhiteCode();
  7551. } while (code3 >= 64);
  7552. } else {
  7553. do {
  7554. code1 += code3 = this._getWhiteCode();
  7555. } while (code3 >= 64);
  7556. do {
  7557. code2 += code3 = this._getBlackCode();
  7558. } while (code3 >= 64);
  7559. }
  7560. this._addPixels(codingLine[this.codingPos] + code1, blackPixels);
  7561. if (codingLine[this.codingPos] < columns) {
  7562. this._addPixels(codingLine[this.codingPos] + code2, blackPixels ^ 1);
  7563. }
  7564. while (refLine[refPos] <= codingLine[this.codingPos] && refLine[refPos] < columns) {
  7565. refPos += 2;
  7566. }
  7567. break;
  7568. case twoDimVertR3:
  7569. this._addPixels(refLine[refPos] + 3, blackPixels);
  7570. blackPixels ^= 1;
  7571. if (codingLine[this.codingPos] < columns) {
  7572. ++refPos;
  7573. while (refLine[refPos] <= codingLine[this.codingPos] && refLine[refPos] < columns) {
  7574. refPos += 2;
  7575. }
  7576. }
  7577. break;
  7578. case twoDimVertR2:
  7579. this._addPixels(refLine[refPos] + 2, blackPixels);
  7580. blackPixels ^= 1;
  7581. if (codingLine[this.codingPos] < columns) {
  7582. ++refPos;
  7583. while (refLine[refPos] <= codingLine[this.codingPos] && refLine[refPos] < columns) {
  7584. refPos += 2;
  7585. }
  7586. }
  7587. break;
  7588. case twoDimVertR1:
  7589. this._addPixels(refLine[refPos] + 1, blackPixels);
  7590. blackPixels ^= 1;
  7591. if (codingLine[this.codingPos] < columns) {
  7592. ++refPos;
  7593. while (refLine[refPos] <= codingLine[this.codingPos] && refLine[refPos] < columns) {
  7594. refPos += 2;
  7595. }
  7596. }
  7597. break;
  7598. case twoDimVert0:
  7599. this._addPixels(refLine[refPos], blackPixels);
  7600. blackPixels ^= 1;
  7601. if (codingLine[this.codingPos] < columns) {
  7602. ++refPos;
  7603. while (refLine[refPos] <= codingLine[this.codingPos] && refLine[refPos] < columns) {
  7604. refPos += 2;
  7605. }
  7606. }
  7607. break;
  7608. case twoDimVertL3:
  7609. this._addPixelsNeg(refLine[refPos] - 3, blackPixels);
  7610. blackPixels ^= 1;
  7611. if (codingLine[this.codingPos] < columns) {
  7612. if (refPos > 0) {
  7613. --refPos;
  7614. } else {
  7615. ++refPos;
  7616. }
  7617. while (refLine[refPos] <= codingLine[this.codingPos] && refLine[refPos] < columns) {
  7618. refPos += 2;
  7619. }
  7620. }
  7621. break;
  7622. case twoDimVertL2:
  7623. this._addPixelsNeg(refLine[refPos] - 2, blackPixels);
  7624. blackPixels ^= 1;
  7625. if (codingLine[this.codingPos] < columns) {
  7626. if (refPos > 0) {
  7627. --refPos;
  7628. } else {
  7629. ++refPos;
  7630. }
  7631. while (refLine[refPos] <= codingLine[this.codingPos] && refLine[refPos] < columns) {
  7632. refPos += 2;
  7633. }
  7634. }
  7635. break;
  7636. case twoDimVertL1:
  7637. this._addPixelsNeg(refLine[refPos] - 1, blackPixels);
  7638. blackPixels ^= 1;
  7639. if (codingLine[this.codingPos] < columns) {
  7640. if (refPos > 0) {
  7641. --refPos;
  7642. } else {
  7643. ++refPos;
  7644. }
  7645. while (refLine[refPos] <= codingLine[this.codingPos] && refLine[refPos] < columns) {
  7646. refPos += 2;
  7647. }
  7648. }
  7649. break;
  7650. case ccittEOF:
  7651. this._addPixels(columns, 0);
  7652. this.eof = true;
  7653. break;
  7654. default:
  7655. (0, _util.info)("bad 2d code");
  7656. this._addPixels(columns, 0);
  7657. this.err = true;
  7658. }
  7659. }
  7660. } else {
  7661. codingLine[0] = 0;
  7662. this.codingPos = 0;
  7663. blackPixels = 0;
  7664. while (codingLine[this.codingPos] < columns) {
  7665. code1 = 0;
  7666. if (blackPixels) {
  7667. do {
  7668. code1 += code3 = this._getBlackCode();
  7669. } while (code3 >= 64);
  7670. } else {
  7671. do {
  7672. code1 += code3 = this._getWhiteCode();
  7673. } while (code3 >= 64);
  7674. }
  7675. this._addPixels(codingLine[this.codingPos] + code1, blackPixels);
  7676. blackPixels ^= 1;
  7677. }
  7678. }
  7679. let gotEOL = false;
  7680. if (this.byteAlign) {
  7681. this.inputBits &= ~7;
  7682. }
  7683. if (!this.eoblock && this.row === this.rows - 1) {
  7684. this.rowsDone = true;
  7685. } else {
  7686. code1 = this._lookBits(12);
  7687. if (this.eoline) {
  7688. while (code1 !== ccittEOF && code1 !== 1) {
  7689. this._eatBits(1);
  7690. code1 = this._lookBits(12);
  7691. }
  7692. } else {
  7693. while (code1 === 0) {
  7694. this._eatBits(1);
  7695. code1 = this._lookBits(12);
  7696. }
  7697. }
  7698. if (code1 === 1) {
  7699. this._eatBits(12);
  7700. gotEOL = true;
  7701. } else if (code1 === ccittEOF) {
  7702. this.eof = true;
  7703. }
  7704. }
  7705. if (!this.eof && this.encoding > 0 && !this.rowsDone) {
  7706. this.nextLine2D = !this._lookBits(1);
  7707. this._eatBits(1);
  7708. }
  7709. if (this.eoblock && gotEOL && this.byteAlign) {
  7710. code1 = this._lookBits(12);
  7711. if (code1 === 1) {
  7712. this._eatBits(12);
  7713. if (this.encoding > 0) {
  7714. this._lookBits(1);
  7715. this._eatBits(1);
  7716. }
  7717. if (this.encoding >= 0) {
  7718. for (i = 0; i < 4; ++i) {
  7719. code1 = this._lookBits(12);
  7720. if (code1 !== 1) {
  7721. (0, _util.info)("bad rtc code: " + code1);
  7722. }
  7723. this._eatBits(12);
  7724. if (this.encoding > 0) {
  7725. this._lookBits(1);
  7726. this._eatBits(1);
  7727. }
  7728. }
  7729. }
  7730. this.eof = true;
  7731. }
  7732. } else if (this.err && this.eoline) {
  7733. while (true) {
  7734. code1 = this._lookBits(13);
  7735. if (code1 === ccittEOF) {
  7736. this.eof = true;
  7737. return -1;
  7738. }
  7739. if (code1 >> 1 === 1) {
  7740. break;
  7741. }
  7742. this._eatBits(1);
  7743. }
  7744. this._eatBits(12);
  7745. if (this.encoding > 0) {
  7746. this._eatBits(1);
  7747. this.nextLine2D = !(code1 & 1);
  7748. }
  7749. }
  7750. if (codingLine[0] > 0) {
  7751. this.outputBits = codingLine[this.codingPos = 0];
  7752. } else {
  7753. this.outputBits = codingLine[this.codingPos = 1];
  7754. }
  7755. this.row++;
  7756. }
  7757. let c;
  7758. if (this.outputBits >= 8) {
  7759. c = this.codingPos & 1 ? 0 : 0xff;
  7760. this.outputBits -= 8;
  7761. if (this.outputBits === 0 && codingLine[this.codingPos] < columns) {
  7762. this.codingPos++;
  7763. this.outputBits = codingLine[this.codingPos] - codingLine[this.codingPos - 1];
  7764. }
  7765. } else {
  7766. bits = 8;
  7767. c = 0;
  7768. do {
  7769. if (this.outputBits > bits) {
  7770. c <<= bits;
  7771. if (!(this.codingPos & 1)) {
  7772. c |= 0xff >> 8 - bits;
  7773. }
  7774. this.outputBits -= bits;
  7775. bits = 0;
  7776. } else {
  7777. c <<= this.outputBits;
  7778. if (!(this.codingPos & 1)) {
  7779. c |= 0xff >> 8 - this.outputBits;
  7780. }
  7781. bits -= this.outputBits;
  7782. this.outputBits = 0;
  7783. if (codingLine[this.codingPos] < columns) {
  7784. this.codingPos++;
  7785. this.outputBits = codingLine[this.codingPos] - codingLine[this.codingPos - 1];
  7786. } else if (bits > 0) {
  7787. c <<= bits;
  7788. bits = 0;
  7789. }
  7790. }
  7791. } while (bits);
  7792. }
  7793. if (this.black) {
  7794. c ^= 0xff;
  7795. }
  7796. return c;
  7797. },
  7798. _addPixels(a1, blackPixels) {
  7799. const codingLine = this.codingLine;
  7800. let codingPos = this.codingPos;
  7801. if (a1 > codingLine[codingPos]) {
  7802. if (a1 > this.columns) {
  7803. (0, _util.info)("row is wrong length");
  7804. this.err = true;
  7805. a1 = this.columns;
  7806. }
  7807. if (codingPos & 1 ^ blackPixels) {
  7808. ++codingPos;
  7809. }
  7810. codingLine[codingPos] = a1;
  7811. }
  7812. this.codingPos = codingPos;
  7813. },
  7814. _addPixelsNeg(a1, blackPixels) {
  7815. const codingLine = this.codingLine;
  7816. let codingPos = this.codingPos;
  7817. if (a1 > codingLine[codingPos]) {
  7818. if (a1 > this.columns) {
  7819. (0, _util.info)("row is wrong length");
  7820. this.err = true;
  7821. a1 = this.columns;
  7822. }
  7823. if (codingPos & 1 ^ blackPixels) {
  7824. ++codingPos;
  7825. }
  7826. codingLine[codingPos] = a1;
  7827. } else if (a1 < codingLine[codingPos]) {
  7828. if (a1 < 0) {
  7829. (0, _util.info)("invalid code");
  7830. this.err = true;
  7831. a1 = 0;
  7832. }
  7833. while (codingPos > 0 && a1 < codingLine[codingPos - 1]) {
  7834. --codingPos;
  7835. }
  7836. codingLine[codingPos] = a1;
  7837. }
  7838. this.codingPos = codingPos;
  7839. },
  7840. _findTableCode(start, end, table, limit) {
  7841. const limitValue = limit || 0;
  7842. for (let i = start; i <= end; ++i) {
  7843. let code = this._lookBits(i);
  7844. if (code === ccittEOF) {
  7845. return [true, 1, false];
  7846. }
  7847. if (i < end) {
  7848. code <<= end - i;
  7849. }
  7850. if (!limitValue || code >= limitValue) {
  7851. const p = table[code - limitValue];
  7852. if (p[0] === i) {
  7853. this._eatBits(i);
  7854. return [true, p[1], true];
  7855. }
  7856. }
  7857. }
  7858. return [false, 0, false];
  7859. },
  7860. _getTwoDimCode() {
  7861. let code = 0;
  7862. let p;
  7863. if (this.eoblock) {
  7864. code = this._lookBits(7);
  7865. p = twoDimTable[code];
  7866. if (p && p[0] > 0) {
  7867. this._eatBits(p[0]);
  7868. return p[1];
  7869. }
  7870. } else {
  7871. const result = this._findTableCode(1, 7, twoDimTable);
  7872. if (result[0] && result[2]) {
  7873. return result[1];
  7874. }
  7875. }
  7876. (0, _util.info)("Bad two dim code");
  7877. return ccittEOF;
  7878. },
  7879. _getWhiteCode() {
  7880. let code = 0;
  7881. let p;
  7882. if (this.eoblock) {
  7883. code = this._lookBits(12);
  7884. if (code === ccittEOF) {
  7885. return 1;
  7886. }
  7887. if (code >> 5 === 0) {
  7888. p = whiteTable1[code];
  7889. } else {
  7890. p = whiteTable2[code >> 3];
  7891. }
  7892. if (p[0] > 0) {
  7893. this._eatBits(p[0]);
  7894. return p[1];
  7895. }
  7896. } else {
  7897. let result = this._findTableCode(1, 9, whiteTable2);
  7898. if (result[0]) {
  7899. return result[1];
  7900. }
  7901. result = this._findTableCode(11, 12, whiteTable1);
  7902. if (result[0]) {
  7903. return result[1];
  7904. }
  7905. }
  7906. (0, _util.info)("bad white code");
  7907. this._eatBits(1);
  7908. return 1;
  7909. },
  7910. _getBlackCode() {
  7911. let code, p;
  7912. if (this.eoblock) {
  7913. code = this._lookBits(13);
  7914. if (code === ccittEOF) {
  7915. return 1;
  7916. }
  7917. if (code >> 7 === 0) {
  7918. p = blackTable1[code];
  7919. } else if (code >> 9 === 0 && code >> 7 !== 0) {
  7920. p = blackTable2[(code >> 1) - 64];
  7921. } else {
  7922. p = blackTable3[code >> 7];
  7923. }
  7924. if (p[0] > 0) {
  7925. this._eatBits(p[0]);
  7926. return p[1];
  7927. }
  7928. } else {
  7929. let result = this._findTableCode(2, 6, blackTable3);
  7930. if (result[0]) {
  7931. return result[1];
  7932. }
  7933. result = this._findTableCode(7, 12, blackTable2, 64);
  7934. if (result[0]) {
  7935. return result[1];
  7936. }
  7937. result = this._findTableCode(10, 13, blackTable1);
  7938. if (result[0]) {
  7939. return result[1];
  7940. }
  7941. }
  7942. (0, _util.info)("bad black code");
  7943. this._eatBits(1);
  7944. return 1;
  7945. },
  7946. _lookBits(n) {
  7947. let c;
  7948. while (this.inputBits < n) {
  7949. if ((c = this.source.next()) === -1) {
  7950. if (this.inputBits === 0) {
  7951. return ccittEOF;
  7952. }
  7953. return this.inputBuf << n - this.inputBits & 0xffff >> 16 - n;
  7954. }
  7955. this.inputBuf = this.inputBuf << 8 | c;
  7956. this.inputBits += 8;
  7957. }
  7958. return this.inputBuf >> this.inputBits - n & 0xffff >> 16 - n;
  7959. },
  7960. _eatBits(n) {
  7961. if ((this.inputBits -= n) < 0) {
  7962. this.inputBits = 0;
  7963. }
  7964. }
  7965. };
  7966. return CCITTFaxDecoder;
  7967. }();
  7968. exports.CCITTFaxDecoder = CCITTFaxDecoder;
  7969. /***/ }),
  7970. /* 15 */
  7971. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  7972. Object.defineProperty(exports, "__esModule", ({
  7973. value: true
  7974. }));
  7975. exports.Jbig2Stream = void 0;
  7976. var _primitives = __w_pdfjs_require__(5);
  7977. var _stream = __w_pdfjs_require__(12);
  7978. var _jbig = __w_pdfjs_require__(16);
  7979. var _util = __w_pdfjs_require__(2);
  7980. const Jbig2Stream = function Jbig2StreamClosure() {
  7981. function Jbig2Stream(stream, maybeLength, dict, params) {
  7982. this.stream = stream;
  7983. this.maybeLength = maybeLength;
  7984. this.dict = dict;
  7985. this.params = params;
  7986. _stream.DecodeStream.call(this, maybeLength);
  7987. }
  7988. Jbig2Stream.prototype = Object.create(_stream.DecodeStream.prototype);
  7989. Object.defineProperty(Jbig2Stream.prototype, "bytes", {
  7990. get() {
  7991. return (0, _util.shadow)(this, "bytes", this.stream.getBytes(this.maybeLength));
  7992. },
  7993. configurable: true
  7994. });
  7995. Jbig2Stream.prototype.ensureBuffer = function (requested) {};
  7996. Jbig2Stream.prototype.readBlock = function () {
  7997. if (this.eof) {
  7998. return;
  7999. }
  8000. const jbig2Image = new _jbig.Jbig2Image();
  8001. const chunks = [];
  8002. if ((0, _primitives.isDict)(this.params)) {
  8003. const globalsStream = this.params.get("JBIG2Globals");
  8004. if ((0, _primitives.isStream)(globalsStream)) {
  8005. const globals = globalsStream.getBytes();
  8006. chunks.push({
  8007. data: globals,
  8008. start: 0,
  8009. end: globals.length
  8010. });
  8011. }
  8012. }
  8013. chunks.push({
  8014. data: this.bytes,
  8015. start: 0,
  8016. end: this.bytes.length
  8017. });
  8018. const data = jbig2Image.parseChunks(chunks);
  8019. const dataLength = data.length;
  8020. for (let i = 0; i < dataLength; i++) {
  8021. data[i] ^= 0xff;
  8022. }
  8023. this.buffer = data;
  8024. this.bufferLength = dataLength;
  8025. this.eof = true;
  8026. };
  8027. return Jbig2Stream;
  8028. }();
  8029. exports.Jbig2Stream = Jbig2Stream;
  8030. /***/ }),
  8031. /* 16 */
  8032. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  8033. Object.defineProperty(exports, "__esModule", ({
  8034. value: true
  8035. }));
  8036. exports.Jbig2Image = void 0;
  8037. var _util = __w_pdfjs_require__(2);
  8038. var _core_utils = __w_pdfjs_require__(8);
  8039. var _arithmetic_decoder = __w_pdfjs_require__(17);
  8040. var _ccitt = __w_pdfjs_require__(14);
  8041. class Jbig2Error extends _util.BaseException {
  8042. constructor(msg) {
  8043. super(`JBIG2 error: ${msg}`);
  8044. }
  8045. }
  8046. var Jbig2Image = function Jbig2ImageClosure() {
  8047. function ContextCache() {}
  8048. ContextCache.prototype = {
  8049. getContexts(id) {
  8050. if (id in this) {
  8051. return this[id];
  8052. }
  8053. return this[id] = new Int8Array(1 << 16);
  8054. }
  8055. };
  8056. function DecodingContext(data, start, end) {
  8057. this.data = data;
  8058. this.start = start;
  8059. this.end = end;
  8060. }
  8061. DecodingContext.prototype = {
  8062. get decoder() {
  8063. var decoder = new _arithmetic_decoder.ArithmeticDecoder(this.data, this.start, this.end);
  8064. return (0, _util.shadow)(this, "decoder", decoder);
  8065. },
  8066. get contextCache() {
  8067. var cache = new ContextCache();
  8068. return (0, _util.shadow)(this, "contextCache", cache);
  8069. }
  8070. };
  8071. function decodeInteger(contextCache, procedure, decoder) {
  8072. var contexts = contextCache.getContexts(procedure);
  8073. var prev = 1;
  8074. function readBits(length) {
  8075. var v = 0;
  8076. for (var i = 0; i < length; i++) {
  8077. var bit = decoder.readBit(contexts, prev);
  8078. prev = prev < 256 ? prev << 1 | bit : (prev << 1 | bit) & 511 | 256;
  8079. v = v << 1 | bit;
  8080. }
  8081. return v >>> 0;
  8082. }
  8083. var sign = readBits(1);
  8084. 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);
  8085. if (sign === 0) {
  8086. return value;
  8087. } else if (value > 0) {
  8088. return -value;
  8089. }
  8090. return null;
  8091. }
  8092. function decodeIAID(contextCache, decoder, codeLength) {
  8093. var contexts = contextCache.getContexts("IAID");
  8094. var prev = 1;
  8095. for (var i = 0; i < codeLength; i++) {
  8096. var bit = decoder.readBit(contexts, prev);
  8097. prev = prev << 1 | bit;
  8098. }
  8099. if (codeLength < 31) {
  8100. return prev & (1 << codeLength) - 1;
  8101. }
  8102. return prev & 0x7fffffff;
  8103. }
  8104. var SegmentTypes = ["SymbolDictionary", null, null, null, "IntermediateTextRegion", null, "ImmediateTextRegion", "ImmediateLosslessTextRegion", null, null, null, null, null, null, null, null, "PatternDictionary", null, null, null, "IntermediateHalftoneRegion", null, "ImmediateHalftoneRegion", "ImmediateLosslessHalftoneRegion", null, null, null, null, null, null, null, null, null, null, null, null, "IntermediateGenericRegion", null, "ImmediateGenericRegion", "ImmediateLosslessGenericRegion", "IntermediateGenericRefinementRegion", null, "ImmediateGenericRefinementRegion", "ImmediateLosslessGenericRefinementRegion", null, null, null, null, "PageInformation", "EndOfPage", "EndOfStripe", "EndOfFile", "Profiles", "Tables", null, null, null, null, null, null, null, null, "Extension"];
  8105. var CodingTemplates = [[{
  8106. x: -1,
  8107. y: -2
  8108. }, {
  8109. x: 0,
  8110. y: -2
  8111. }, {
  8112. x: 1,
  8113. y: -2
  8114. }, {
  8115. x: -2,
  8116. y: -1
  8117. }, {
  8118. x: -1,
  8119. y: -1
  8120. }, {
  8121. x: 0,
  8122. y: -1
  8123. }, {
  8124. x: 1,
  8125. y: -1
  8126. }, {
  8127. x: 2,
  8128. y: -1
  8129. }, {
  8130. x: -4,
  8131. y: 0
  8132. }, {
  8133. x: -3,
  8134. y: 0
  8135. }, {
  8136. x: -2,
  8137. y: 0
  8138. }, {
  8139. x: -1,
  8140. y: 0
  8141. }], [{
  8142. x: -1,
  8143. y: -2
  8144. }, {
  8145. x: 0,
  8146. y: -2
  8147. }, {
  8148. x: 1,
  8149. y: -2
  8150. }, {
  8151. x: 2,
  8152. y: -2
  8153. }, {
  8154. x: -2,
  8155. y: -1
  8156. }, {
  8157. x: -1,
  8158. y: -1
  8159. }, {
  8160. x: 0,
  8161. y: -1
  8162. }, {
  8163. x: 1,
  8164. y: -1
  8165. }, {
  8166. x: 2,
  8167. y: -1
  8168. }, {
  8169. x: -3,
  8170. y: 0
  8171. }, {
  8172. x: -2,
  8173. y: 0
  8174. }, {
  8175. x: -1,
  8176. y: 0
  8177. }], [{
  8178. x: -1,
  8179. y: -2
  8180. }, {
  8181. x: 0,
  8182. y: -2
  8183. }, {
  8184. x: 1,
  8185. y: -2
  8186. }, {
  8187. x: -2,
  8188. y: -1
  8189. }, {
  8190. x: -1,
  8191. y: -1
  8192. }, {
  8193. x: 0,
  8194. y: -1
  8195. }, {
  8196. x: 1,
  8197. y: -1
  8198. }, {
  8199. x: -2,
  8200. y: 0
  8201. }, {
  8202. x: -1,
  8203. y: 0
  8204. }], [{
  8205. x: -3,
  8206. y: -1
  8207. }, {
  8208. x: -2,
  8209. y: -1
  8210. }, {
  8211. x: -1,
  8212. y: -1
  8213. }, {
  8214. x: 0,
  8215. y: -1
  8216. }, {
  8217. x: 1,
  8218. y: -1
  8219. }, {
  8220. x: -4,
  8221. y: 0
  8222. }, {
  8223. x: -3,
  8224. y: 0
  8225. }, {
  8226. x: -2,
  8227. y: 0
  8228. }, {
  8229. x: -1,
  8230. y: 0
  8231. }]];
  8232. var RefinementTemplates = [{
  8233. coding: [{
  8234. x: 0,
  8235. y: -1
  8236. }, {
  8237. x: 1,
  8238. y: -1
  8239. }, {
  8240. x: -1,
  8241. y: 0
  8242. }],
  8243. reference: [{
  8244. x: 0,
  8245. y: -1
  8246. }, {
  8247. x: 1,
  8248. y: -1
  8249. }, {
  8250. x: -1,
  8251. y: 0
  8252. }, {
  8253. x: 0,
  8254. y: 0
  8255. }, {
  8256. x: 1,
  8257. y: 0
  8258. }, {
  8259. x: -1,
  8260. y: 1
  8261. }, {
  8262. x: 0,
  8263. y: 1
  8264. }, {
  8265. x: 1,
  8266. y: 1
  8267. }]
  8268. }, {
  8269. coding: [{
  8270. x: -1,
  8271. y: -1
  8272. }, {
  8273. x: 0,
  8274. y: -1
  8275. }, {
  8276. x: 1,
  8277. y: -1
  8278. }, {
  8279. x: -1,
  8280. y: 0
  8281. }],
  8282. reference: [{
  8283. x: 0,
  8284. y: -1
  8285. }, {
  8286. x: -1,
  8287. y: 0
  8288. }, {
  8289. x: 0,
  8290. y: 0
  8291. }, {
  8292. x: 1,
  8293. y: 0
  8294. }, {
  8295. x: 0,
  8296. y: 1
  8297. }, {
  8298. x: 1,
  8299. y: 1
  8300. }]
  8301. }];
  8302. var ReusedContexts = [0x9b25, 0x0795, 0x00e5, 0x0195];
  8303. var RefinementReusedContexts = [0x0020, 0x0008];
  8304. function decodeBitmapTemplate0(width, height, decodingContext) {
  8305. var decoder = decodingContext.decoder;
  8306. var contexts = decodingContext.contextCache.getContexts("GB");
  8307. var contextLabel,
  8308. i,
  8309. j,
  8310. pixel,
  8311. row,
  8312. row1,
  8313. row2,
  8314. bitmap = [];
  8315. var OLD_PIXEL_MASK = 0x7bf7;
  8316. for (i = 0; i < height; i++) {
  8317. row = bitmap[i] = new Uint8Array(width);
  8318. row1 = i < 1 ? row : bitmap[i - 1];
  8319. row2 = i < 2 ? row : bitmap[i - 2];
  8320. contextLabel = row2[0] << 13 | row2[1] << 12 | row2[2] << 11 | row1[0] << 7 | row1[1] << 6 | row1[2] << 5 | row1[3] << 4;
  8321. for (j = 0; j < width; j++) {
  8322. row[j] = pixel = decoder.readBit(contexts, contextLabel);
  8323. contextLabel = (contextLabel & OLD_PIXEL_MASK) << 1 | (j + 3 < width ? row2[j + 3] << 11 : 0) | (j + 4 < width ? row1[j + 4] << 4 : 0) | pixel;
  8324. }
  8325. }
  8326. return bitmap;
  8327. }
  8328. function decodeBitmap(mmr, width, height, templateIndex, prediction, skip, at, decodingContext) {
  8329. if (mmr) {
  8330. const input = new Reader(decodingContext.data, decodingContext.start, decodingContext.end);
  8331. return decodeMMRBitmap(input, width, height, false);
  8332. }
  8333. 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) {
  8334. return decodeBitmapTemplate0(width, height, decodingContext);
  8335. }
  8336. var useskip = !!skip;
  8337. var template = CodingTemplates[templateIndex].concat(at);
  8338. template.sort(function (a, b) {
  8339. return a.y - b.y || a.x - b.x;
  8340. });
  8341. var templateLength = template.length;
  8342. var templateX = new Int8Array(templateLength);
  8343. var templateY = new Int8Array(templateLength);
  8344. var changingTemplateEntries = [];
  8345. var reuseMask = 0,
  8346. minX = 0,
  8347. maxX = 0,
  8348. minY = 0;
  8349. var c, k;
  8350. for (k = 0; k < templateLength; k++) {
  8351. templateX[k] = template[k].x;
  8352. templateY[k] = template[k].y;
  8353. minX = Math.min(minX, template[k].x);
  8354. maxX = Math.max(maxX, template[k].x);
  8355. minY = Math.min(minY, template[k].y);
  8356. if (k < templateLength - 1 && template[k].y === template[k + 1].y && template[k].x === template[k + 1].x - 1) {
  8357. reuseMask |= 1 << templateLength - 1 - k;
  8358. } else {
  8359. changingTemplateEntries.push(k);
  8360. }
  8361. }
  8362. var changingEntriesLength = changingTemplateEntries.length;
  8363. var changingTemplateX = new Int8Array(changingEntriesLength);
  8364. var changingTemplateY = new Int8Array(changingEntriesLength);
  8365. var changingTemplateBit = new Uint16Array(changingEntriesLength);
  8366. for (c = 0; c < changingEntriesLength; c++) {
  8367. k = changingTemplateEntries[c];
  8368. changingTemplateX[c] = template[k].x;
  8369. changingTemplateY[c] = template[k].y;
  8370. changingTemplateBit[c] = 1 << templateLength - 1 - k;
  8371. }
  8372. var sbb_left = -minX;
  8373. var sbb_top = -minY;
  8374. var sbb_right = width - maxX;
  8375. var pseudoPixelContext = ReusedContexts[templateIndex];
  8376. var row = new Uint8Array(width);
  8377. var bitmap = [];
  8378. var decoder = decodingContext.decoder;
  8379. var contexts = decodingContext.contextCache.getContexts("GB");
  8380. var ltp = 0,
  8381. j,
  8382. i0,
  8383. j0,
  8384. contextLabel = 0,
  8385. bit,
  8386. shift;
  8387. for (var i = 0; i < height; i++) {
  8388. if (prediction) {
  8389. var sltp = decoder.readBit(contexts, pseudoPixelContext);
  8390. ltp ^= sltp;
  8391. if (ltp) {
  8392. bitmap.push(row);
  8393. continue;
  8394. }
  8395. }
  8396. row = new Uint8Array(row);
  8397. bitmap.push(row);
  8398. for (j = 0; j < width; j++) {
  8399. if (useskip && skip[i][j]) {
  8400. row[j] = 0;
  8401. continue;
  8402. }
  8403. if (j >= sbb_left && j < sbb_right && i >= sbb_top) {
  8404. contextLabel = contextLabel << 1 & reuseMask;
  8405. for (k = 0; k < changingEntriesLength; k++) {
  8406. i0 = i + changingTemplateY[k];
  8407. j0 = j + changingTemplateX[k];
  8408. bit = bitmap[i0][j0];
  8409. if (bit) {
  8410. bit = changingTemplateBit[k];
  8411. contextLabel |= bit;
  8412. }
  8413. }
  8414. } else {
  8415. contextLabel = 0;
  8416. shift = templateLength - 1;
  8417. for (k = 0; k < templateLength; k++, shift--) {
  8418. j0 = j + templateX[k];
  8419. if (j0 >= 0 && j0 < width) {
  8420. i0 = i + templateY[k];
  8421. if (i0 >= 0) {
  8422. bit = bitmap[i0][j0];
  8423. if (bit) {
  8424. contextLabel |= bit << shift;
  8425. }
  8426. }
  8427. }
  8428. }
  8429. }
  8430. var pixel = decoder.readBit(contexts, contextLabel);
  8431. row[j] = pixel;
  8432. }
  8433. }
  8434. return bitmap;
  8435. }
  8436. function decodeRefinement(width, height, templateIndex, referenceBitmap, offsetX, offsetY, prediction, at, decodingContext) {
  8437. var codingTemplate = RefinementTemplates[templateIndex].coding;
  8438. if (templateIndex === 0) {
  8439. codingTemplate = codingTemplate.concat([at[0]]);
  8440. }
  8441. var codingTemplateLength = codingTemplate.length;
  8442. var codingTemplateX = new Int32Array(codingTemplateLength);
  8443. var codingTemplateY = new Int32Array(codingTemplateLength);
  8444. var k;
  8445. for (k = 0; k < codingTemplateLength; k++) {
  8446. codingTemplateX[k] = codingTemplate[k].x;
  8447. codingTemplateY[k] = codingTemplate[k].y;
  8448. }
  8449. var referenceTemplate = RefinementTemplates[templateIndex].reference;
  8450. if (templateIndex === 0) {
  8451. referenceTemplate = referenceTemplate.concat([at[1]]);
  8452. }
  8453. var referenceTemplateLength = referenceTemplate.length;
  8454. var referenceTemplateX = new Int32Array(referenceTemplateLength);
  8455. var referenceTemplateY = new Int32Array(referenceTemplateLength);
  8456. for (k = 0; k < referenceTemplateLength; k++) {
  8457. referenceTemplateX[k] = referenceTemplate[k].x;
  8458. referenceTemplateY[k] = referenceTemplate[k].y;
  8459. }
  8460. var referenceWidth = referenceBitmap[0].length;
  8461. var referenceHeight = referenceBitmap.length;
  8462. var pseudoPixelContext = RefinementReusedContexts[templateIndex];
  8463. var bitmap = [];
  8464. var decoder = decodingContext.decoder;
  8465. var contexts = decodingContext.contextCache.getContexts("GR");
  8466. var ltp = 0;
  8467. for (var i = 0; i < height; i++) {
  8468. if (prediction) {
  8469. var sltp = decoder.readBit(contexts, pseudoPixelContext);
  8470. ltp ^= sltp;
  8471. if (ltp) {
  8472. throw new Jbig2Error("prediction is not supported");
  8473. }
  8474. }
  8475. var row = new Uint8Array(width);
  8476. bitmap.push(row);
  8477. for (var j = 0; j < width; j++) {
  8478. var i0, j0;
  8479. var contextLabel = 0;
  8480. for (k = 0; k < codingTemplateLength; k++) {
  8481. i0 = i + codingTemplateY[k];
  8482. j0 = j + codingTemplateX[k];
  8483. if (i0 < 0 || j0 < 0 || j0 >= width) {
  8484. contextLabel <<= 1;
  8485. } else {
  8486. contextLabel = contextLabel << 1 | bitmap[i0][j0];
  8487. }
  8488. }
  8489. for (k = 0; k < referenceTemplateLength; k++) {
  8490. i0 = i + referenceTemplateY[k] - offsetY;
  8491. j0 = j + referenceTemplateX[k] - offsetX;
  8492. if (i0 < 0 || i0 >= referenceHeight || j0 < 0 || j0 >= referenceWidth) {
  8493. contextLabel <<= 1;
  8494. } else {
  8495. contextLabel = contextLabel << 1 | referenceBitmap[i0][j0];
  8496. }
  8497. }
  8498. var pixel = decoder.readBit(contexts, contextLabel);
  8499. row[j] = pixel;
  8500. }
  8501. }
  8502. return bitmap;
  8503. }
  8504. function decodeSymbolDictionary(huffman, refinement, symbols, numberOfNewSymbols, numberOfExportedSymbols, huffmanTables, templateIndex, at, refinementTemplateIndex, refinementAt, decodingContext, huffmanInput) {
  8505. if (huffman && refinement) {
  8506. throw new Jbig2Error("symbol refinement with Huffman is not supported");
  8507. }
  8508. var newSymbols = [];
  8509. var currentHeight = 0;
  8510. var symbolCodeLength = (0, _core_utils.log2)(symbols.length + numberOfNewSymbols);
  8511. var decoder = decodingContext.decoder;
  8512. var contextCache = decodingContext.contextCache;
  8513. let tableB1, symbolWidths;
  8514. if (huffman) {
  8515. tableB1 = getStandardTable(1);
  8516. symbolWidths = [];
  8517. symbolCodeLength = Math.max(symbolCodeLength, 1);
  8518. }
  8519. while (newSymbols.length < numberOfNewSymbols) {
  8520. var deltaHeight = huffman ? huffmanTables.tableDeltaHeight.decode(huffmanInput) : decodeInteger(contextCache, "IADH", decoder);
  8521. currentHeight += deltaHeight;
  8522. let currentWidth = 0,
  8523. totalWidth = 0;
  8524. const firstSymbol = huffman ? symbolWidths.length : 0;
  8525. while (true) {
  8526. var deltaWidth = huffman ? huffmanTables.tableDeltaWidth.decode(huffmanInput) : decodeInteger(contextCache, "IADW", decoder);
  8527. if (deltaWidth === null) {
  8528. break;
  8529. }
  8530. currentWidth += deltaWidth;
  8531. totalWidth += currentWidth;
  8532. var bitmap;
  8533. if (refinement) {
  8534. var numberOfInstances = decodeInteger(contextCache, "IAAI", decoder);
  8535. if (numberOfInstances > 1) {
  8536. bitmap = decodeTextRegion(huffman, refinement, currentWidth, currentHeight, 0, numberOfInstances, 1, symbols.concat(newSymbols), symbolCodeLength, 0, 0, 1, 0, huffmanTables, refinementTemplateIndex, refinementAt, decodingContext, 0, huffmanInput);
  8537. } else {
  8538. var symbolId = decodeIAID(contextCache, decoder, symbolCodeLength);
  8539. var rdx = decodeInteger(contextCache, "IARDX", decoder);
  8540. var rdy = decodeInteger(contextCache, "IARDY", decoder);
  8541. var symbol = symbolId < symbols.length ? symbols[symbolId] : newSymbols[symbolId - symbols.length];
  8542. bitmap = decodeRefinement(currentWidth, currentHeight, refinementTemplateIndex, symbol, rdx, rdy, false, refinementAt, decodingContext);
  8543. }
  8544. newSymbols.push(bitmap);
  8545. } else if (huffman) {
  8546. symbolWidths.push(currentWidth);
  8547. } else {
  8548. bitmap = decodeBitmap(false, currentWidth, currentHeight, templateIndex, false, null, at, decodingContext);
  8549. newSymbols.push(bitmap);
  8550. }
  8551. }
  8552. if (huffman && !refinement) {
  8553. const bitmapSize = huffmanTables.tableBitmapSize.decode(huffmanInput);
  8554. huffmanInput.byteAlign();
  8555. let collectiveBitmap;
  8556. if (bitmapSize === 0) {
  8557. collectiveBitmap = readUncompressedBitmap(huffmanInput, totalWidth, currentHeight);
  8558. } else {
  8559. const originalEnd = huffmanInput.end;
  8560. const bitmapEnd = huffmanInput.position + bitmapSize;
  8561. huffmanInput.end = bitmapEnd;
  8562. collectiveBitmap = decodeMMRBitmap(huffmanInput, totalWidth, currentHeight, false);
  8563. huffmanInput.end = originalEnd;
  8564. huffmanInput.position = bitmapEnd;
  8565. }
  8566. const numberOfSymbolsDecoded = symbolWidths.length;
  8567. if (firstSymbol === numberOfSymbolsDecoded - 1) {
  8568. newSymbols.push(collectiveBitmap);
  8569. } else {
  8570. let i,
  8571. y,
  8572. xMin = 0,
  8573. xMax,
  8574. bitmapWidth,
  8575. symbolBitmap;
  8576. for (i = firstSymbol; i < numberOfSymbolsDecoded; i++) {
  8577. bitmapWidth = symbolWidths[i];
  8578. xMax = xMin + bitmapWidth;
  8579. symbolBitmap = [];
  8580. for (y = 0; y < currentHeight; y++) {
  8581. symbolBitmap.push(collectiveBitmap[y].subarray(xMin, xMax));
  8582. }
  8583. newSymbols.push(symbolBitmap);
  8584. xMin = xMax;
  8585. }
  8586. }
  8587. }
  8588. }
  8589. var exportedSymbols = [];
  8590. var flags = [],
  8591. currentFlag = false;
  8592. var totalSymbolsLength = symbols.length + numberOfNewSymbols;
  8593. while (flags.length < totalSymbolsLength) {
  8594. var runLength = huffman ? tableB1.decode(huffmanInput) : decodeInteger(contextCache, "IAEX", decoder);
  8595. while (runLength--) {
  8596. flags.push(currentFlag);
  8597. }
  8598. currentFlag = !currentFlag;
  8599. }
  8600. for (var i = 0, ii = symbols.length; i < ii; i++) {
  8601. if (flags[i]) {
  8602. exportedSymbols.push(symbols[i]);
  8603. }
  8604. }
  8605. for (var j = 0; j < numberOfNewSymbols; i++, j++) {
  8606. if (flags[i]) {
  8607. exportedSymbols.push(newSymbols[j]);
  8608. }
  8609. }
  8610. return exportedSymbols;
  8611. }
  8612. function decodeTextRegion(huffman, refinement, width, height, defaultPixelValue, numberOfSymbolInstances, stripSize, inputSymbols, symbolCodeLength, transposed, dsOffset, referenceCorner, combinationOperator, huffmanTables, refinementTemplateIndex, refinementAt, decodingContext, logStripSize, huffmanInput) {
  8613. if (huffman && refinement) {
  8614. throw new Jbig2Error("refinement with Huffman is not supported");
  8615. }
  8616. var bitmap = [];
  8617. var i, row;
  8618. for (i = 0; i < height; i++) {
  8619. row = new Uint8Array(width);
  8620. if (defaultPixelValue) {
  8621. for (var j = 0; j < width; j++) {
  8622. row[j] = defaultPixelValue;
  8623. }
  8624. }
  8625. bitmap.push(row);
  8626. }
  8627. var decoder = decodingContext.decoder;
  8628. var contextCache = decodingContext.contextCache;
  8629. var stripT = huffman ? -huffmanTables.tableDeltaT.decode(huffmanInput) : -decodeInteger(contextCache, "IADT", decoder);
  8630. var firstS = 0;
  8631. i = 0;
  8632. while (i < numberOfSymbolInstances) {
  8633. var deltaT = huffman ? huffmanTables.tableDeltaT.decode(huffmanInput) : decodeInteger(contextCache, "IADT", decoder);
  8634. stripT += deltaT;
  8635. var deltaFirstS = huffman ? huffmanTables.tableFirstS.decode(huffmanInput) : decodeInteger(contextCache, "IAFS", decoder);
  8636. firstS += deltaFirstS;
  8637. var currentS = firstS;
  8638. do {
  8639. let currentT = 0;
  8640. if (stripSize > 1) {
  8641. currentT = huffman ? huffmanInput.readBits(logStripSize) : decodeInteger(contextCache, "IAIT", decoder);
  8642. }
  8643. var t = stripSize * stripT + currentT;
  8644. var symbolId = huffman ? huffmanTables.symbolIDTable.decode(huffmanInput) : decodeIAID(contextCache, decoder, symbolCodeLength);
  8645. var applyRefinement = refinement && (huffman ? huffmanInput.readBit() : decodeInteger(contextCache, "IARI", decoder));
  8646. var symbolBitmap = inputSymbols[symbolId];
  8647. var symbolWidth = symbolBitmap[0].length;
  8648. var symbolHeight = symbolBitmap.length;
  8649. if (applyRefinement) {
  8650. var rdw = decodeInteger(contextCache, "IARDW", decoder);
  8651. var rdh = decodeInteger(contextCache, "IARDH", decoder);
  8652. var rdx = decodeInteger(contextCache, "IARDX", decoder);
  8653. var rdy = decodeInteger(contextCache, "IARDY", decoder);
  8654. symbolWidth += rdw;
  8655. symbolHeight += rdh;
  8656. symbolBitmap = decodeRefinement(symbolWidth, symbolHeight, refinementTemplateIndex, symbolBitmap, (rdw >> 1) + rdx, (rdh >> 1) + rdy, false, refinementAt, decodingContext);
  8657. }
  8658. var offsetT = t - (referenceCorner & 1 ? 0 : symbolHeight - 1);
  8659. var offsetS = currentS - (referenceCorner & 2 ? symbolWidth - 1 : 0);
  8660. var s2, t2, symbolRow;
  8661. if (transposed) {
  8662. for (s2 = 0; s2 < symbolHeight; s2++) {
  8663. row = bitmap[offsetS + s2];
  8664. if (!row) {
  8665. continue;
  8666. }
  8667. symbolRow = symbolBitmap[s2];
  8668. var maxWidth = Math.min(width - offsetT, symbolWidth);
  8669. switch (combinationOperator) {
  8670. case 0:
  8671. for (t2 = 0; t2 < maxWidth; t2++) {
  8672. row[offsetT + t2] |= symbolRow[t2];
  8673. }
  8674. break;
  8675. case 2:
  8676. for (t2 = 0; t2 < maxWidth; t2++) {
  8677. row[offsetT + t2] ^= symbolRow[t2];
  8678. }
  8679. break;
  8680. default:
  8681. throw new Jbig2Error(`operator ${combinationOperator} is not supported`);
  8682. }
  8683. }
  8684. currentS += symbolHeight - 1;
  8685. } else {
  8686. for (t2 = 0; t2 < symbolHeight; t2++) {
  8687. row = bitmap[offsetT + t2];
  8688. if (!row) {
  8689. continue;
  8690. }
  8691. symbolRow = symbolBitmap[t2];
  8692. switch (combinationOperator) {
  8693. case 0:
  8694. for (s2 = 0; s2 < symbolWidth; s2++) {
  8695. row[offsetS + s2] |= symbolRow[s2];
  8696. }
  8697. break;
  8698. case 2:
  8699. for (s2 = 0; s2 < symbolWidth; s2++) {
  8700. row[offsetS + s2] ^= symbolRow[s2];
  8701. }
  8702. break;
  8703. default:
  8704. throw new Jbig2Error(`operator ${combinationOperator} is not supported`);
  8705. }
  8706. }
  8707. currentS += symbolWidth - 1;
  8708. }
  8709. i++;
  8710. var deltaS = huffman ? huffmanTables.tableDeltaS.decode(huffmanInput) : decodeInteger(contextCache, "IADS", decoder);
  8711. if (deltaS === null) {
  8712. break;
  8713. }
  8714. currentS += deltaS + dsOffset;
  8715. } while (true);
  8716. }
  8717. return bitmap;
  8718. }
  8719. function decodePatternDictionary(mmr, patternWidth, patternHeight, maxPatternIndex, template, decodingContext) {
  8720. const at = [];
  8721. if (!mmr) {
  8722. at.push({
  8723. x: -patternWidth,
  8724. y: 0
  8725. });
  8726. if (template === 0) {
  8727. at.push({
  8728. x: -3,
  8729. y: -1
  8730. });
  8731. at.push({
  8732. x: 2,
  8733. y: -2
  8734. });
  8735. at.push({
  8736. x: -2,
  8737. y: -2
  8738. });
  8739. }
  8740. }
  8741. const collectiveWidth = (maxPatternIndex + 1) * patternWidth;
  8742. const collectiveBitmap = decodeBitmap(mmr, collectiveWidth, patternHeight, template, false, null, at, decodingContext);
  8743. const patterns = [];
  8744. for (let i = 0; i <= maxPatternIndex; i++) {
  8745. const patternBitmap = [];
  8746. const xMin = patternWidth * i;
  8747. const xMax = xMin + patternWidth;
  8748. for (let y = 0; y < patternHeight; y++) {
  8749. patternBitmap.push(collectiveBitmap[y].subarray(xMin, xMax));
  8750. }
  8751. patterns.push(patternBitmap);
  8752. }
  8753. return patterns;
  8754. }
  8755. function decodeHalftoneRegion(mmr, patterns, template, regionWidth, regionHeight, defaultPixelValue, enableSkip, combinationOperator, gridWidth, gridHeight, gridOffsetX, gridOffsetY, gridVectorX, gridVectorY, decodingContext) {
  8756. const skip = null;
  8757. if (enableSkip) {
  8758. throw new Jbig2Error("skip is not supported");
  8759. }
  8760. if (combinationOperator !== 0) {
  8761. throw new Jbig2Error("operator " + combinationOperator + " is not supported in halftone region");
  8762. }
  8763. const regionBitmap = [];
  8764. let i, j, row;
  8765. for (i = 0; i < regionHeight; i++) {
  8766. row = new Uint8Array(regionWidth);
  8767. if (defaultPixelValue) {
  8768. for (j = 0; j < regionWidth; j++) {
  8769. row[j] = defaultPixelValue;
  8770. }
  8771. }
  8772. regionBitmap.push(row);
  8773. }
  8774. const numberOfPatterns = patterns.length;
  8775. const pattern0 = patterns[0];
  8776. const patternWidth = pattern0[0].length,
  8777. patternHeight = pattern0.length;
  8778. const bitsPerValue = (0, _core_utils.log2)(numberOfPatterns);
  8779. const at = [];
  8780. if (!mmr) {
  8781. at.push({
  8782. x: template <= 1 ? 3 : 2,
  8783. y: -1
  8784. });
  8785. if (template === 0) {
  8786. at.push({
  8787. x: -3,
  8788. y: -1
  8789. });
  8790. at.push({
  8791. x: 2,
  8792. y: -2
  8793. });
  8794. at.push({
  8795. x: -2,
  8796. y: -2
  8797. });
  8798. }
  8799. }
  8800. const grayScaleBitPlanes = [];
  8801. let mmrInput, bitmap;
  8802. if (mmr) {
  8803. mmrInput = new Reader(decodingContext.data, decodingContext.start, decodingContext.end);
  8804. }
  8805. for (i = bitsPerValue - 1; i >= 0; i--) {
  8806. if (mmr) {
  8807. bitmap = decodeMMRBitmap(mmrInput, gridWidth, gridHeight, true);
  8808. } else {
  8809. bitmap = decodeBitmap(false, gridWidth, gridHeight, template, false, skip, at, decodingContext);
  8810. }
  8811. grayScaleBitPlanes[i] = bitmap;
  8812. }
  8813. let mg, ng, bit, patternIndex, patternBitmap, x, y, patternRow, regionRow;
  8814. for (mg = 0; mg < gridHeight; mg++) {
  8815. for (ng = 0; ng < gridWidth; ng++) {
  8816. bit = 0;
  8817. patternIndex = 0;
  8818. for (j = bitsPerValue - 1; j >= 0; j--) {
  8819. bit = grayScaleBitPlanes[j][mg][ng] ^ bit;
  8820. patternIndex |= bit << j;
  8821. }
  8822. patternBitmap = patterns[patternIndex];
  8823. x = gridOffsetX + mg * gridVectorY + ng * gridVectorX >> 8;
  8824. y = gridOffsetY + mg * gridVectorX - ng * gridVectorY >> 8;
  8825. if (x >= 0 && x + patternWidth <= regionWidth && y >= 0 && y + patternHeight <= regionHeight) {
  8826. for (i = 0; i < patternHeight; i++) {
  8827. regionRow = regionBitmap[y + i];
  8828. patternRow = patternBitmap[i];
  8829. for (j = 0; j < patternWidth; j++) {
  8830. regionRow[x + j] |= patternRow[j];
  8831. }
  8832. }
  8833. } else {
  8834. let regionX, regionY;
  8835. for (i = 0; i < patternHeight; i++) {
  8836. regionY = y + i;
  8837. if (regionY < 0 || regionY >= regionHeight) {
  8838. continue;
  8839. }
  8840. regionRow = regionBitmap[regionY];
  8841. patternRow = patternBitmap[i];
  8842. for (j = 0; j < patternWidth; j++) {
  8843. regionX = x + j;
  8844. if (regionX >= 0 && regionX < regionWidth) {
  8845. regionRow[regionX] |= patternRow[j];
  8846. }
  8847. }
  8848. }
  8849. }
  8850. }
  8851. }
  8852. return regionBitmap;
  8853. }
  8854. function readSegmentHeader(data, start) {
  8855. var segmentHeader = {};
  8856. segmentHeader.number = (0, _core_utils.readUint32)(data, start);
  8857. var flags = data[start + 4];
  8858. var segmentType = flags & 0x3f;
  8859. if (!SegmentTypes[segmentType]) {
  8860. throw new Jbig2Error("invalid segment type: " + segmentType);
  8861. }
  8862. segmentHeader.type = segmentType;
  8863. segmentHeader.typeName = SegmentTypes[segmentType];
  8864. segmentHeader.deferredNonRetain = !!(flags & 0x80);
  8865. var pageAssociationFieldSize = !!(flags & 0x40);
  8866. var referredFlags = data[start + 5];
  8867. var referredToCount = referredFlags >> 5 & 7;
  8868. var retainBits = [referredFlags & 31];
  8869. var position = start + 6;
  8870. if (referredFlags === 7) {
  8871. referredToCount = (0, _core_utils.readUint32)(data, position - 1) & 0x1fffffff;
  8872. position += 3;
  8873. var bytes = referredToCount + 7 >> 3;
  8874. retainBits[0] = data[position++];
  8875. while (--bytes > 0) {
  8876. retainBits.push(data[position++]);
  8877. }
  8878. } else if (referredFlags === 5 || referredFlags === 6) {
  8879. throw new Jbig2Error("invalid referred-to flags");
  8880. }
  8881. segmentHeader.retainBits = retainBits;
  8882. let referredToSegmentNumberSize = 4;
  8883. if (segmentHeader.number <= 256) {
  8884. referredToSegmentNumberSize = 1;
  8885. } else if (segmentHeader.number <= 65536) {
  8886. referredToSegmentNumberSize = 2;
  8887. }
  8888. var referredTo = [];
  8889. var i, ii;
  8890. for (i = 0; i < referredToCount; i++) {
  8891. let number;
  8892. if (referredToSegmentNumberSize === 1) {
  8893. number = data[position];
  8894. } else if (referredToSegmentNumberSize === 2) {
  8895. number = (0, _core_utils.readUint16)(data, position);
  8896. } else {
  8897. number = (0, _core_utils.readUint32)(data, position);
  8898. }
  8899. referredTo.push(number);
  8900. position += referredToSegmentNumberSize;
  8901. }
  8902. segmentHeader.referredTo = referredTo;
  8903. if (!pageAssociationFieldSize) {
  8904. segmentHeader.pageAssociation = data[position++];
  8905. } else {
  8906. segmentHeader.pageAssociation = (0, _core_utils.readUint32)(data, position);
  8907. position += 4;
  8908. }
  8909. segmentHeader.length = (0, _core_utils.readUint32)(data, position);
  8910. position += 4;
  8911. if (segmentHeader.length === 0xffffffff) {
  8912. if (segmentType === 38) {
  8913. var genericRegionInfo = readRegionSegmentInformation(data, position);
  8914. var genericRegionSegmentFlags = data[position + RegionSegmentInformationFieldLength];
  8915. var genericRegionMmr = !!(genericRegionSegmentFlags & 1);
  8916. var searchPatternLength = 6;
  8917. var searchPattern = new Uint8Array(searchPatternLength);
  8918. if (!genericRegionMmr) {
  8919. searchPattern[0] = 0xff;
  8920. searchPattern[1] = 0xac;
  8921. }
  8922. searchPattern[2] = genericRegionInfo.height >>> 24 & 0xff;
  8923. searchPattern[3] = genericRegionInfo.height >> 16 & 0xff;
  8924. searchPattern[4] = genericRegionInfo.height >> 8 & 0xff;
  8925. searchPattern[5] = genericRegionInfo.height & 0xff;
  8926. for (i = position, ii = data.length; i < ii; i++) {
  8927. var j = 0;
  8928. while (j < searchPatternLength && searchPattern[j] === data[i + j]) {
  8929. j++;
  8930. }
  8931. if (j === searchPatternLength) {
  8932. segmentHeader.length = i + searchPatternLength;
  8933. break;
  8934. }
  8935. }
  8936. if (segmentHeader.length === 0xffffffff) {
  8937. throw new Jbig2Error("segment end was not found");
  8938. }
  8939. } else {
  8940. throw new Jbig2Error("invalid unknown segment length");
  8941. }
  8942. }
  8943. segmentHeader.headerEnd = position;
  8944. return segmentHeader;
  8945. }
  8946. function readSegments(header, data, start, end) {
  8947. var segments = [];
  8948. var position = start;
  8949. while (position < end) {
  8950. var segmentHeader = readSegmentHeader(data, position);
  8951. position = segmentHeader.headerEnd;
  8952. var segment = {
  8953. header: segmentHeader,
  8954. data
  8955. };
  8956. if (!header.randomAccess) {
  8957. segment.start = position;
  8958. position += segmentHeader.length;
  8959. segment.end = position;
  8960. }
  8961. segments.push(segment);
  8962. if (segmentHeader.type === 51) {
  8963. break;
  8964. }
  8965. }
  8966. if (header.randomAccess) {
  8967. for (var i = 0, ii = segments.length; i < ii; i++) {
  8968. segments[i].start = position;
  8969. position += segments[i].header.length;
  8970. segments[i].end = position;
  8971. }
  8972. }
  8973. return segments;
  8974. }
  8975. function readRegionSegmentInformation(data, start) {
  8976. return {
  8977. width: (0, _core_utils.readUint32)(data, start),
  8978. height: (0, _core_utils.readUint32)(data, start + 4),
  8979. x: (0, _core_utils.readUint32)(data, start + 8),
  8980. y: (0, _core_utils.readUint32)(data, start + 12),
  8981. combinationOperator: data[start + 16] & 7
  8982. };
  8983. }
  8984. var RegionSegmentInformationFieldLength = 17;
  8985. function processSegment(segment, visitor) {
  8986. var header = segment.header;
  8987. var data = segment.data,
  8988. position = segment.start,
  8989. end = segment.end;
  8990. var args, at, i, atLength;
  8991. switch (header.type) {
  8992. case 0:
  8993. var dictionary = {};
  8994. var dictionaryFlags = (0, _core_utils.readUint16)(data, position);
  8995. dictionary.huffman = !!(dictionaryFlags & 1);
  8996. dictionary.refinement = !!(dictionaryFlags & 2);
  8997. dictionary.huffmanDHSelector = dictionaryFlags >> 2 & 3;
  8998. dictionary.huffmanDWSelector = dictionaryFlags >> 4 & 3;
  8999. dictionary.bitmapSizeSelector = dictionaryFlags >> 6 & 1;
  9000. dictionary.aggregationInstancesSelector = dictionaryFlags >> 7 & 1;
  9001. dictionary.bitmapCodingContextUsed = !!(dictionaryFlags & 256);
  9002. dictionary.bitmapCodingContextRetained = !!(dictionaryFlags & 512);
  9003. dictionary.template = dictionaryFlags >> 10 & 3;
  9004. dictionary.refinementTemplate = dictionaryFlags >> 12 & 1;
  9005. position += 2;
  9006. if (!dictionary.huffman) {
  9007. atLength = dictionary.template === 0 ? 4 : 1;
  9008. at = [];
  9009. for (i = 0; i < atLength; i++) {
  9010. at.push({
  9011. x: (0, _core_utils.readInt8)(data, position),
  9012. y: (0, _core_utils.readInt8)(data, position + 1)
  9013. });
  9014. position += 2;
  9015. }
  9016. dictionary.at = at;
  9017. }
  9018. if (dictionary.refinement && !dictionary.refinementTemplate) {
  9019. at = [];
  9020. for (i = 0; i < 2; i++) {
  9021. at.push({
  9022. x: (0, _core_utils.readInt8)(data, position),
  9023. y: (0, _core_utils.readInt8)(data, position + 1)
  9024. });
  9025. position += 2;
  9026. }
  9027. dictionary.refinementAt = at;
  9028. }
  9029. dictionary.numberOfExportedSymbols = (0, _core_utils.readUint32)(data, position);
  9030. position += 4;
  9031. dictionary.numberOfNewSymbols = (0, _core_utils.readUint32)(data, position);
  9032. position += 4;
  9033. args = [dictionary, header.number, header.referredTo, data, position, end];
  9034. break;
  9035. case 6:
  9036. case 7:
  9037. var textRegion = {};
  9038. textRegion.info = readRegionSegmentInformation(data, position);
  9039. position += RegionSegmentInformationFieldLength;
  9040. var textRegionSegmentFlags = (0, _core_utils.readUint16)(data, position);
  9041. position += 2;
  9042. textRegion.huffman = !!(textRegionSegmentFlags & 1);
  9043. textRegion.refinement = !!(textRegionSegmentFlags & 2);
  9044. textRegion.logStripSize = textRegionSegmentFlags >> 2 & 3;
  9045. textRegion.stripSize = 1 << textRegion.logStripSize;
  9046. textRegion.referenceCorner = textRegionSegmentFlags >> 4 & 3;
  9047. textRegion.transposed = !!(textRegionSegmentFlags & 64);
  9048. textRegion.combinationOperator = textRegionSegmentFlags >> 7 & 3;
  9049. textRegion.defaultPixelValue = textRegionSegmentFlags >> 9 & 1;
  9050. textRegion.dsOffset = textRegionSegmentFlags << 17 >> 27;
  9051. textRegion.refinementTemplate = textRegionSegmentFlags >> 15 & 1;
  9052. if (textRegion.huffman) {
  9053. var textRegionHuffmanFlags = (0, _core_utils.readUint16)(data, position);
  9054. position += 2;
  9055. textRegion.huffmanFS = textRegionHuffmanFlags & 3;
  9056. textRegion.huffmanDS = textRegionHuffmanFlags >> 2 & 3;
  9057. textRegion.huffmanDT = textRegionHuffmanFlags >> 4 & 3;
  9058. textRegion.huffmanRefinementDW = textRegionHuffmanFlags >> 6 & 3;
  9059. textRegion.huffmanRefinementDH = textRegionHuffmanFlags >> 8 & 3;
  9060. textRegion.huffmanRefinementDX = textRegionHuffmanFlags >> 10 & 3;
  9061. textRegion.huffmanRefinementDY = textRegionHuffmanFlags >> 12 & 3;
  9062. textRegion.huffmanRefinementSizeSelector = !!(textRegionHuffmanFlags & 0x4000);
  9063. }
  9064. if (textRegion.refinement && !textRegion.refinementTemplate) {
  9065. at = [];
  9066. for (i = 0; i < 2; i++) {
  9067. at.push({
  9068. x: (0, _core_utils.readInt8)(data, position),
  9069. y: (0, _core_utils.readInt8)(data, position + 1)
  9070. });
  9071. position += 2;
  9072. }
  9073. textRegion.refinementAt = at;
  9074. }
  9075. textRegion.numberOfSymbolInstances = (0, _core_utils.readUint32)(data, position);
  9076. position += 4;
  9077. args = [textRegion, header.referredTo, data, position, end];
  9078. break;
  9079. case 16:
  9080. const patternDictionary = {};
  9081. const patternDictionaryFlags = data[position++];
  9082. patternDictionary.mmr = !!(patternDictionaryFlags & 1);
  9083. patternDictionary.template = patternDictionaryFlags >> 1 & 3;
  9084. patternDictionary.patternWidth = data[position++];
  9085. patternDictionary.patternHeight = data[position++];
  9086. patternDictionary.maxPatternIndex = (0, _core_utils.readUint32)(data, position);
  9087. position += 4;
  9088. args = [patternDictionary, header.number, data, position, end];
  9089. break;
  9090. case 22:
  9091. case 23:
  9092. const halftoneRegion = {};
  9093. halftoneRegion.info = readRegionSegmentInformation(data, position);
  9094. position += RegionSegmentInformationFieldLength;
  9095. const halftoneRegionFlags = data[position++];
  9096. halftoneRegion.mmr = !!(halftoneRegionFlags & 1);
  9097. halftoneRegion.template = halftoneRegionFlags >> 1 & 3;
  9098. halftoneRegion.enableSkip = !!(halftoneRegionFlags & 8);
  9099. halftoneRegion.combinationOperator = halftoneRegionFlags >> 4 & 7;
  9100. halftoneRegion.defaultPixelValue = halftoneRegionFlags >> 7 & 1;
  9101. halftoneRegion.gridWidth = (0, _core_utils.readUint32)(data, position);
  9102. position += 4;
  9103. halftoneRegion.gridHeight = (0, _core_utils.readUint32)(data, position);
  9104. position += 4;
  9105. halftoneRegion.gridOffsetX = (0, _core_utils.readUint32)(data, position) & 0xffffffff;
  9106. position += 4;
  9107. halftoneRegion.gridOffsetY = (0, _core_utils.readUint32)(data, position) & 0xffffffff;
  9108. position += 4;
  9109. halftoneRegion.gridVectorX = (0, _core_utils.readUint16)(data, position);
  9110. position += 2;
  9111. halftoneRegion.gridVectorY = (0, _core_utils.readUint16)(data, position);
  9112. position += 2;
  9113. args = [halftoneRegion, header.referredTo, data, position, end];
  9114. break;
  9115. case 38:
  9116. case 39:
  9117. var genericRegion = {};
  9118. genericRegion.info = readRegionSegmentInformation(data, position);
  9119. position += RegionSegmentInformationFieldLength;
  9120. var genericRegionSegmentFlags = data[position++];
  9121. genericRegion.mmr = !!(genericRegionSegmentFlags & 1);
  9122. genericRegion.template = genericRegionSegmentFlags >> 1 & 3;
  9123. genericRegion.prediction = !!(genericRegionSegmentFlags & 8);
  9124. if (!genericRegion.mmr) {
  9125. atLength = genericRegion.template === 0 ? 4 : 1;
  9126. at = [];
  9127. for (i = 0; i < atLength; i++) {
  9128. at.push({
  9129. x: (0, _core_utils.readInt8)(data, position),
  9130. y: (0, _core_utils.readInt8)(data, position + 1)
  9131. });
  9132. position += 2;
  9133. }
  9134. genericRegion.at = at;
  9135. }
  9136. args = [genericRegion, data, position, end];
  9137. break;
  9138. case 48:
  9139. var pageInfo = {
  9140. width: (0, _core_utils.readUint32)(data, position),
  9141. height: (0, _core_utils.readUint32)(data, position + 4),
  9142. resolutionX: (0, _core_utils.readUint32)(data, position + 8),
  9143. resolutionY: (0, _core_utils.readUint32)(data, position + 12)
  9144. };
  9145. if (pageInfo.height === 0xffffffff) {
  9146. delete pageInfo.height;
  9147. }
  9148. var pageSegmentFlags = data[position + 16];
  9149. (0, _core_utils.readUint16)(data, position + 17);
  9150. pageInfo.lossless = !!(pageSegmentFlags & 1);
  9151. pageInfo.refinement = !!(pageSegmentFlags & 2);
  9152. pageInfo.defaultPixelValue = pageSegmentFlags >> 2 & 1;
  9153. pageInfo.combinationOperator = pageSegmentFlags >> 3 & 3;
  9154. pageInfo.requiresBuffer = !!(pageSegmentFlags & 32);
  9155. pageInfo.combinationOperatorOverride = !!(pageSegmentFlags & 64);
  9156. args = [pageInfo];
  9157. break;
  9158. case 49:
  9159. break;
  9160. case 50:
  9161. break;
  9162. case 51:
  9163. break;
  9164. case 53:
  9165. args = [header.number, data, position, end];
  9166. break;
  9167. case 62:
  9168. break;
  9169. default:
  9170. throw new Jbig2Error(`segment type ${header.typeName}(${header.type})` + " is not implemented");
  9171. }
  9172. var callbackName = "on" + header.typeName;
  9173. if (callbackName in visitor) {
  9174. visitor[callbackName].apply(visitor, args);
  9175. }
  9176. }
  9177. function processSegments(segments, visitor) {
  9178. for (var i = 0, ii = segments.length; i < ii; i++) {
  9179. processSegment(segments[i], visitor);
  9180. }
  9181. }
  9182. function parseJbig2Chunks(chunks) {
  9183. var visitor = new SimpleSegmentVisitor();
  9184. for (var i = 0, ii = chunks.length; i < ii; i++) {
  9185. var chunk = chunks[i];
  9186. var segments = readSegments({}, chunk.data, chunk.start, chunk.end);
  9187. processSegments(segments, visitor);
  9188. }
  9189. return visitor.buffer;
  9190. }
  9191. function parseJbig2(data) {
  9192. const end = data.length;
  9193. let position = 0;
  9194. 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) {
  9195. throw new Jbig2Error("parseJbig2 - invalid header.");
  9196. }
  9197. const header = Object.create(null);
  9198. position += 8;
  9199. const flags = data[position++];
  9200. header.randomAccess = !(flags & 1);
  9201. if (!(flags & 2)) {
  9202. header.numberOfPages = (0, _core_utils.readUint32)(data, position);
  9203. position += 4;
  9204. }
  9205. const segments = readSegments(header, data, position, end);
  9206. const visitor = new SimpleSegmentVisitor();
  9207. processSegments(segments, visitor);
  9208. const {
  9209. width,
  9210. height
  9211. } = visitor.currentPageInfo;
  9212. const bitPacked = visitor.buffer;
  9213. const imgData = new Uint8ClampedArray(width * height);
  9214. let q = 0,
  9215. k = 0;
  9216. for (let i = 0; i < height; i++) {
  9217. let mask = 0,
  9218. buffer;
  9219. for (let j = 0; j < width; j++) {
  9220. if (!mask) {
  9221. mask = 128;
  9222. buffer = bitPacked[k++];
  9223. }
  9224. imgData[q++] = buffer & mask ? 0 : 255;
  9225. mask >>= 1;
  9226. }
  9227. }
  9228. return {
  9229. imgData,
  9230. width,
  9231. height
  9232. };
  9233. }
  9234. function SimpleSegmentVisitor() {}
  9235. SimpleSegmentVisitor.prototype = {
  9236. onPageInformation: function SimpleSegmentVisitor_onPageInformation(info) {
  9237. this.currentPageInfo = info;
  9238. var rowSize = info.width + 7 >> 3;
  9239. var buffer = new Uint8ClampedArray(rowSize * info.height);
  9240. if (info.defaultPixelValue) {
  9241. for (var i = 0, ii = buffer.length; i < ii; i++) {
  9242. buffer[i] = 0xff;
  9243. }
  9244. }
  9245. this.buffer = buffer;
  9246. },
  9247. drawBitmap: function SimpleSegmentVisitor_drawBitmap(regionInfo, bitmap) {
  9248. var pageInfo = this.currentPageInfo;
  9249. var width = regionInfo.width,
  9250. height = regionInfo.height;
  9251. var rowSize = pageInfo.width + 7 >> 3;
  9252. var combinationOperator = pageInfo.combinationOperatorOverride ? regionInfo.combinationOperator : pageInfo.combinationOperator;
  9253. var buffer = this.buffer;
  9254. var mask0 = 128 >> (regionInfo.x & 7);
  9255. var offset0 = regionInfo.y * rowSize + (regionInfo.x >> 3);
  9256. var i, j, mask, offset;
  9257. switch (combinationOperator) {
  9258. case 0:
  9259. for (i = 0; i < height; i++) {
  9260. mask = mask0;
  9261. offset = offset0;
  9262. for (j = 0; j < width; j++) {
  9263. if (bitmap[i][j]) {
  9264. buffer[offset] |= mask;
  9265. }
  9266. mask >>= 1;
  9267. if (!mask) {
  9268. mask = 128;
  9269. offset++;
  9270. }
  9271. }
  9272. offset0 += rowSize;
  9273. }
  9274. break;
  9275. case 2:
  9276. for (i = 0; i < height; i++) {
  9277. mask = mask0;
  9278. offset = offset0;
  9279. for (j = 0; j < width; j++) {
  9280. if (bitmap[i][j]) {
  9281. buffer[offset] ^= mask;
  9282. }
  9283. mask >>= 1;
  9284. if (!mask) {
  9285. mask = 128;
  9286. offset++;
  9287. }
  9288. }
  9289. offset0 += rowSize;
  9290. }
  9291. break;
  9292. default:
  9293. throw new Jbig2Error(`operator ${combinationOperator} is not supported`);
  9294. }
  9295. },
  9296. onImmediateGenericRegion: function SimpleSegmentVisitor_onImmediateGenericRegion(region, data, start, end) {
  9297. var regionInfo = region.info;
  9298. var decodingContext = new DecodingContext(data, start, end);
  9299. var bitmap = decodeBitmap(region.mmr, regionInfo.width, regionInfo.height, region.template, region.prediction, null, region.at, decodingContext);
  9300. this.drawBitmap(regionInfo, bitmap);
  9301. },
  9302. onImmediateLosslessGenericRegion: function SimpleSegmentVisitor_onImmediateLosslessGenericRegion() {
  9303. this.onImmediateGenericRegion.apply(this, arguments);
  9304. },
  9305. onSymbolDictionary: function SimpleSegmentVisitor_onSymbolDictionary(dictionary, currentSegment, referredSegments, data, start, end) {
  9306. let huffmanTables, huffmanInput;
  9307. if (dictionary.huffman) {
  9308. huffmanTables = getSymbolDictionaryHuffmanTables(dictionary, referredSegments, this.customTables);
  9309. huffmanInput = new Reader(data, start, end);
  9310. }
  9311. var symbols = this.symbols;
  9312. if (!symbols) {
  9313. this.symbols = symbols = {};
  9314. }
  9315. var inputSymbols = [];
  9316. for (var i = 0, ii = referredSegments.length; i < ii; i++) {
  9317. const referredSymbols = symbols[referredSegments[i]];
  9318. if (referredSymbols) {
  9319. inputSymbols = inputSymbols.concat(referredSymbols);
  9320. }
  9321. }
  9322. var decodingContext = new DecodingContext(data, start, end);
  9323. symbols[currentSegment] = decodeSymbolDictionary(dictionary.huffman, dictionary.refinement, inputSymbols, dictionary.numberOfNewSymbols, dictionary.numberOfExportedSymbols, huffmanTables, dictionary.template, dictionary.at, dictionary.refinementTemplate, dictionary.refinementAt, decodingContext, huffmanInput);
  9324. },
  9325. onImmediateTextRegion: function SimpleSegmentVisitor_onImmediateTextRegion(region, referredSegments, data, start, end) {
  9326. var regionInfo = region.info;
  9327. let huffmanTables, huffmanInput;
  9328. var symbols = this.symbols;
  9329. var inputSymbols = [];
  9330. for (var i = 0, ii = referredSegments.length; i < ii; i++) {
  9331. const referredSymbols = symbols[referredSegments[i]];
  9332. if (referredSymbols) {
  9333. inputSymbols = inputSymbols.concat(referredSymbols);
  9334. }
  9335. }
  9336. var symbolCodeLength = (0, _core_utils.log2)(inputSymbols.length);
  9337. if (region.huffman) {
  9338. huffmanInput = new Reader(data, start, end);
  9339. huffmanTables = getTextRegionHuffmanTables(region, referredSegments, this.customTables, inputSymbols.length, huffmanInput);
  9340. }
  9341. var decodingContext = new DecodingContext(data, start, end);
  9342. var bitmap = decodeTextRegion(region.huffman, region.refinement, regionInfo.width, regionInfo.height, region.defaultPixelValue, region.numberOfSymbolInstances, region.stripSize, inputSymbols, symbolCodeLength, region.transposed, region.dsOffset, region.referenceCorner, region.combinationOperator, huffmanTables, region.refinementTemplate, region.refinementAt, decodingContext, region.logStripSize, huffmanInput);
  9343. this.drawBitmap(regionInfo, bitmap);
  9344. },
  9345. onImmediateLosslessTextRegion: function SimpleSegmentVisitor_onImmediateLosslessTextRegion() {
  9346. this.onImmediateTextRegion.apply(this, arguments);
  9347. },
  9348. onPatternDictionary(dictionary, currentSegment, data, start, end) {
  9349. let patterns = this.patterns;
  9350. if (!patterns) {
  9351. this.patterns = patterns = {};
  9352. }
  9353. const decodingContext = new DecodingContext(data, start, end);
  9354. patterns[currentSegment] = decodePatternDictionary(dictionary.mmr, dictionary.patternWidth, dictionary.patternHeight, dictionary.maxPatternIndex, dictionary.template, decodingContext);
  9355. },
  9356. onImmediateHalftoneRegion(region, referredSegments, data, start, end) {
  9357. const patterns = this.patterns[referredSegments[0]];
  9358. const regionInfo = region.info;
  9359. const decodingContext = new DecodingContext(data, start, end);
  9360. const bitmap = decodeHalftoneRegion(region.mmr, patterns, region.template, regionInfo.width, regionInfo.height, region.defaultPixelValue, region.enableSkip, region.combinationOperator, region.gridWidth, region.gridHeight, region.gridOffsetX, region.gridOffsetY, region.gridVectorX, region.gridVectorY, decodingContext);
  9361. this.drawBitmap(regionInfo, bitmap);
  9362. },
  9363. onImmediateLosslessHalftoneRegion() {
  9364. this.onImmediateHalftoneRegion.apply(this, arguments);
  9365. },
  9366. onTables(currentSegment, data, start, end) {
  9367. let customTables = this.customTables;
  9368. if (!customTables) {
  9369. this.customTables = customTables = {};
  9370. }
  9371. customTables[currentSegment] = decodeTablesSegment(data, start, end);
  9372. }
  9373. };
  9374. function HuffmanLine(lineData) {
  9375. if (lineData.length === 2) {
  9376. this.isOOB = true;
  9377. this.rangeLow = 0;
  9378. this.prefixLength = lineData[0];
  9379. this.rangeLength = 0;
  9380. this.prefixCode = lineData[1];
  9381. this.isLowerRange = false;
  9382. } else {
  9383. this.isOOB = false;
  9384. this.rangeLow = lineData[0];
  9385. this.prefixLength = lineData[1];
  9386. this.rangeLength = lineData[2];
  9387. this.prefixCode = lineData[3];
  9388. this.isLowerRange = lineData[4] === "lower";
  9389. }
  9390. }
  9391. function HuffmanTreeNode(line) {
  9392. this.children = [];
  9393. if (line) {
  9394. this.isLeaf = true;
  9395. this.rangeLength = line.rangeLength;
  9396. this.rangeLow = line.rangeLow;
  9397. this.isLowerRange = line.isLowerRange;
  9398. this.isOOB = line.isOOB;
  9399. } else {
  9400. this.isLeaf = false;
  9401. }
  9402. }
  9403. HuffmanTreeNode.prototype = {
  9404. buildTree(line, shift) {
  9405. const bit = line.prefixCode >> shift & 1;
  9406. if (shift <= 0) {
  9407. this.children[bit] = new HuffmanTreeNode(line);
  9408. } else {
  9409. let node = this.children[bit];
  9410. if (!node) {
  9411. this.children[bit] = node = new HuffmanTreeNode(null);
  9412. }
  9413. node.buildTree(line, shift - 1);
  9414. }
  9415. },
  9416. decodeNode(reader) {
  9417. if (this.isLeaf) {
  9418. if (this.isOOB) {
  9419. return null;
  9420. }
  9421. const htOffset = reader.readBits(this.rangeLength);
  9422. return this.rangeLow + (this.isLowerRange ? -htOffset : htOffset);
  9423. }
  9424. const node = this.children[reader.readBit()];
  9425. if (!node) {
  9426. throw new Jbig2Error("invalid Huffman data");
  9427. }
  9428. return node.decodeNode(reader);
  9429. }
  9430. };
  9431. function HuffmanTable(lines, prefixCodesDone) {
  9432. if (!prefixCodesDone) {
  9433. this.assignPrefixCodes(lines);
  9434. }
  9435. this.rootNode = new HuffmanTreeNode(null);
  9436. for (let i = 0, ii = lines.length; i < ii; i++) {
  9437. const line = lines[i];
  9438. if (line.prefixLength > 0) {
  9439. this.rootNode.buildTree(line, line.prefixLength - 1);
  9440. }
  9441. }
  9442. }
  9443. HuffmanTable.prototype = {
  9444. decode(reader) {
  9445. return this.rootNode.decodeNode(reader);
  9446. },
  9447. assignPrefixCodes(lines) {
  9448. const linesLength = lines.length;
  9449. let prefixLengthMax = 0;
  9450. for (let i = 0; i < linesLength; i++) {
  9451. prefixLengthMax = Math.max(prefixLengthMax, lines[i].prefixLength);
  9452. }
  9453. const histogram = new Uint32Array(prefixLengthMax + 1);
  9454. for (let i = 0; i < linesLength; i++) {
  9455. histogram[lines[i].prefixLength]++;
  9456. }
  9457. let currentLength = 1,
  9458. firstCode = 0,
  9459. currentCode,
  9460. currentTemp,
  9461. line;
  9462. histogram[0] = 0;
  9463. while (currentLength <= prefixLengthMax) {
  9464. firstCode = firstCode + histogram[currentLength - 1] << 1;
  9465. currentCode = firstCode;
  9466. currentTemp = 0;
  9467. while (currentTemp < linesLength) {
  9468. line = lines[currentTemp];
  9469. if (line.prefixLength === currentLength) {
  9470. line.prefixCode = currentCode;
  9471. currentCode++;
  9472. }
  9473. currentTemp++;
  9474. }
  9475. currentLength++;
  9476. }
  9477. }
  9478. };
  9479. function decodeTablesSegment(data, start, end) {
  9480. const flags = data[start];
  9481. const lowestValue = (0, _core_utils.readUint32)(data, start + 1) & 0xffffffff;
  9482. const highestValue = (0, _core_utils.readUint32)(data, start + 5) & 0xffffffff;
  9483. const reader = new Reader(data, start + 9, end);
  9484. const prefixSizeBits = (flags >> 1 & 7) + 1;
  9485. const rangeSizeBits = (flags >> 4 & 7) + 1;
  9486. const lines = [];
  9487. let prefixLength,
  9488. rangeLength,
  9489. currentRangeLow = lowestValue;
  9490. do {
  9491. prefixLength = reader.readBits(prefixSizeBits);
  9492. rangeLength = reader.readBits(rangeSizeBits);
  9493. lines.push(new HuffmanLine([currentRangeLow, prefixLength, rangeLength, 0]));
  9494. currentRangeLow += 1 << rangeLength;
  9495. } while (currentRangeLow < highestValue);
  9496. prefixLength = reader.readBits(prefixSizeBits);
  9497. lines.push(new HuffmanLine([lowestValue - 1, prefixLength, 32, 0, "lower"]));
  9498. prefixLength = reader.readBits(prefixSizeBits);
  9499. lines.push(new HuffmanLine([highestValue, prefixLength, 32, 0]));
  9500. if (flags & 1) {
  9501. prefixLength = reader.readBits(prefixSizeBits);
  9502. lines.push(new HuffmanLine([prefixLength, 0]));
  9503. }
  9504. return new HuffmanTable(lines, false);
  9505. }
  9506. const standardTablesCache = {};
  9507. function getStandardTable(number) {
  9508. let table = standardTablesCache[number];
  9509. if (table) {
  9510. return table;
  9511. }
  9512. let lines;
  9513. switch (number) {
  9514. case 1:
  9515. lines = [[0, 1, 4, 0x0], [16, 2, 8, 0x2], [272, 3, 16, 0x6], [65808, 3, 32, 0x7]];
  9516. break;
  9517. case 2:
  9518. lines = [[0, 1, 0, 0x0], [1, 2, 0, 0x2], [2, 3, 0, 0x6], [3, 4, 3, 0xe], [11, 5, 6, 0x1e], [75, 6, 32, 0x3e], [6, 0x3f]];
  9519. break;
  9520. case 3:
  9521. lines = [[-256, 8, 8, 0xfe], [0, 1, 0, 0x0], [1, 2, 0, 0x2], [2, 3, 0, 0x6], [3, 4, 3, 0xe], [11, 5, 6, 0x1e], [-257, 8, 32, 0xff, "lower"], [75, 7, 32, 0x7e], [6, 0x3e]];
  9522. break;
  9523. case 4:
  9524. lines = [[1, 1, 0, 0x0], [2, 2, 0, 0x2], [3, 3, 0, 0x6], [4, 4, 3, 0xe], [12, 5, 6, 0x1e], [76, 5, 32, 0x1f]];
  9525. break;
  9526. case 5:
  9527. lines = [[-255, 7, 8, 0x7e], [1, 1, 0, 0x0], [2, 2, 0, 0x2], [3, 3, 0, 0x6], [4, 4, 3, 0xe], [12, 5, 6, 0x1e], [-256, 7, 32, 0x7f, "lower"], [76, 6, 32, 0x3e]];
  9528. break;
  9529. case 6:
  9530. lines = [[-2048, 5, 10, 0x1c], [-1024, 4, 9, 0x8], [-512, 4, 8, 0x9], [-256, 4, 7, 0xa], [-128, 5, 6, 0x1d], [-64, 5, 5, 0x1e], [-32, 4, 5, 0xb], [0, 2, 7, 0x0], [128, 3, 7, 0x2], [256, 3, 8, 0x3], [512, 4, 9, 0xc], [1024, 4, 10, 0xd], [-2049, 6, 32, 0x3e, "lower"], [2048, 6, 32, 0x3f]];
  9531. break;
  9532. case 7:
  9533. lines = [[-1024, 4, 9, 0x8], [-512, 3, 8, 0x0], [-256, 4, 7, 0x9], [-128, 5, 6, 0x1a], [-64, 5, 5, 0x1b], [-32, 4, 5, 0xa], [0, 4, 5, 0xb], [32, 5, 5, 0x1c], [64, 5, 6, 0x1d], [128, 4, 7, 0xc], [256, 3, 8, 0x1], [512, 3, 9, 0x2], [1024, 3, 10, 0x3], [-1025, 5, 32, 0x1e, "lower"], [2048, 5, 32, 0x1f]];
  9534. break;
  9535. case 8:
  9536. lines = [[-15, 8, 3, 0xfc], [-7, 9, 1, 0x1fc], [-5, 8, 1, 0xfd], [-3, 9, 0, 0x1fd], [-2, 7, 0, 0x7c], [-1, 4, 0, 0xa], [0, 2, 1, 0x0], [2, 5, 0, 0x1a], [3, 6, 0, 0x3a], [4, 3, 4, 0x4], [20, 6, 1, 0x3b], [22, 4, 4, 0xb], [38, 4, 5, 0xc], [70, 5, 6, 0x1b], [134, 5, 7, 0x1c], [262, 6, 7, 0x3c], [390, 7, 8, 0x7d], [646, 6, 10, 0x3d], [-16, 9, 32, 0x1fe, "lower"], [1670, 9, 32, 0x1ff], [2, 0x1]];
  9537. break;
  9538. case 9:
  9539. lines = [[-31, 8, 4, 0xfc], [-15, 9, 2, 0x1fc], [-11, 8, 2, 0xfd], [-7, 9, 1, 0x1fd], [-5, 7, 1, 0x7c], [-3, 4, 1, 0xa], [-1, 3, 1, 0x2], [1, 3, 1, 0x3], [3, 5, 1, 0x1a], [5, 6, 1, 0x3a], [7, 3, 5, 0x4], [39, 6, 2, 0x3b], [43, 4, 5, 0xb], [75, 4, 6, 0xc], [139, 5, 7, 0x1b], [267, 5, 8, 0x1c], [523, 6, 8, 0x3c], [779, 7, 9, 0x7d], [1291, 6, 11, 0x3d], [-32, 9, 32, 0x1fe, "lower"], [3339, 9, 32, 0x1ff], [2, 0x0]];
  9540. break;
  9541. case 10:
  9542. lines = [[-21, 7, 4, 0x7a], [-5, 8, 0, 0xfc], [-4, 7, 0, 0x7b], [-3, 5, 0, 0x18], [-2, 2, 2, 0x0], [2, 5, 0, 0x19], [3, 6, 0, 0x36], [4, 7, 0, 0x7c], [5, 8, 0, 0xfd], [6, 2, 6, 0x1], [70, 5, 5, 0x1a], [102, 6, 5, 0x37], [134, 6, 6, 0x38], [198, 6, 7, 0x39], [326, 6, 8, 0x3a], [582, 6, 9, 0x3b], [1094, 6, 10, 0x3c], [2118, 7, 11, 0x7d], [-22, 8, 32, 0xfe, "lower"], [4166, 8, 32, 0xff], [2, 0x2]];
  9543. break;
  9544. case 11:
  9545. lines = [[1, 1, 0, 0x0], [2, 2, 1, 0x2], [4, 4, 0, 0xc], [5, 4, 1, 0xd], [7, 5, 1, 0x1c], [9, 5, 2, 0x1d], [13, 6, 2, 0x3c], [17, 7, 2, 0x7a], [21, 7, 3, 0x7b], [29, 7, 4, 0x7c], [45, 7, 5, 0x7d], [77, 7, 6, 0x7e], [141, 7, 32, 0x7f]];
  9546. break;
  9547. case 12:
  9548. lines = [[1, 1, 0, 0x0], [2, 2, 0, 0x2], [3, 3, 1, 0x6], [5, 5, 0, 0x1c], [6, 5, 1, 0x1d], [8, 6, 1, 0x3c], [10, 7, 0, 0x7a], [11, 7, 1, 0x7b], [13, 7, 2, 0x7c], [17, 7, 3, 0x7d], [25, 7, 4, 0x7e], [41, 8, 5, 0xfe], [73, 8, 32, 0xff]];
  9549. break;
  9550. case 13:
  9551. lines = [[1, 1, 0, 0x0], [2, 3, 0, 0x4], [3, 4, 0, 0xc], [4, 5, 0, 0x1c], [5, 4, 1, 0xd], [7, 3, 3, 0x5], [15, 6, 1, 0x3a], [17, 6, 2, 0x3b], [21, 6, 3, 0x3c], [29, 6, 4, 0x3d], [45, 6, 5, 0x3e], [77, 7, 6, 0x7e], [141, 7, 32, 0x7f]];
  9552. break;
  9553. case 14:
  9554. lines = [[-2, 3, 0, 0x4], [-1, 3, 0, 0x5], [0, 1, 0, 0x0], [1, 3, 0, 0x6], [2, 3, 0, 0x7]];
  9555. break;
  9556. case 15:
  9557. lines = [[-24, 7, 4, 0x7c], [-8, 6, 2, 0x3c], [-4, 5, 1, 0x1c], [-2, 4, 0, 0xc], [-1, 3, 0, 0x4], [0, 1, 0, 0x0], [1, 3, 0, 0x5], [2, 4, 0, 0xd], [3, 5, 1, 0x1d], [5, 6, 2, 0x3d], [9, 7, 4, 0x7d], [-25, 7, 32, 0x7e, "lower"], [25, 7, 32, 0x7f]];
  9558. break;
  9559. default:
  9560. throw new Jbig2Error(`standard table B.${number} does not exist`);
  9561. }
  9562. for (let i = 0, ii = lines.length; i < ii; i++) {
  9563. lines[i] = new HuffmanLine(lines[i]);
  9564. }
  9565. table = new HuffmanTable(lines, true);
  9566. standardTablesCache[number] = table;
  9567. return table;
  9568. }
  9569. function Reader(data, start, end) {
  9570. this.data = data;
  9571. this.start = start;
  9572. this.end = end;
  9573. this.position = start;
  9574. this.shift = -1;
  9575. this.currentByte = 0;
  9576. }
  9577. Reader.prototype = {
  9578. readBit() {
  9579. if (this.shift < 0) {
  9580. if (this.position >= this.end) {
  9581. throw new Jbig2Error("end of data while reading bit");
  9582. }
  9583. this.currentByte = this.data[this.position++];
  9584. this.shift = 7;
  9585. }
  9586. const bit = this.currentByte >> this.shift & 1;
  9587. this.shift--;
  9588. return bit;
  9589. },
  9590. readBits(numBits) {
  9591. let result = 0,
  9592. i;
  9593. for (i = numBits - 1; i >= 0; i--) {
  9594. result |= this.readBit() << i;
  9595. }
  9596. return result;
  9597. },
  9598. byteAlign() {
  9599. this.shift = -1;
  9600. },
  9601. next() {
  9602. if (this.position >= this.end) {
  9603. return -1;
  9604. }
  9605. return this.data[this.position++];
  9606. }
  9607. };
  9608. function getCustomHuffmanTable(index, referredTo, customTables) {
  9609. let currentIndex = 0;
  9610. for (let i = 0, ii = referredTo.length; i < ii; i++) {
  9611. const table = customTables[referredTo[i]];
  9612. if (table) {
  9613. if (index === currentIndex) {
  9614. return table;
  9615. }
  9616. currentIndex++;
  9617. }
  9618. }
  9619. throw new Jbig2Error("can't find custom Huffman table");
  9620. }
  9621. function getTextRegionHuffmanTables(textRegion, referredTo, customTables, numberOfSymbols, reader) {
  9622. const codes = [];
  9623. for (let i = 0; i <= 34; i++) {
  9624. const codeLength = reader.readBits(4);
  9625. codes.push(new HuffmanLine([i, codeLength, 0, 0]));
  9626. }
  9627. const runCodesTable = new HuffmanTable(codes, false);
  9628. codes.length = 0;
  9629. for (let i = 0; i < numberOfSymbols;) {
  9630. const codeLength = runCodesTable.decode(reader);
  9631. if (codeLength >= 32) {
  9632. let repeatedLength, numberOfRepeats, j;
  9633. switch (codeLength) {
  9634. case 32:
  9635. if (i === 0) {
  9636. throw new Jbig2Error("no previous value in symbol ID table");
  9637. }
  9638. numberOfRepeats = reader.readBits(2) + 3;
  9639. repeatedLength = codes[i - 1].prefixLength;
  9640. break;
  9641. case 33:
  9642. numberOfRepeats = reader.readBits(3) + 3;
  9643. repeatedLength = 0;
  9644. break;
  9645. case 34:
  9646. numberOfRepeats = reader.readBits(7) + 11;
  9647. repeatedLength = 0;
  9648. break;
  9649. default:
  9650. throw new Jbig2Error("invalid code length in symbol ID table");
  9651. }
  9652. for (j = 0; j < numberOfRepeats; j++) {
  9653. codes.push(new HuffmanLine([i, repeatedLength, 0, 0]));
  9654. i++;
  9655. }
  9656. } else {
  9657. codes.push(new HuffmanLine([i, codeLength, 0, 0]));
  9658. i++;
  9659. }
  9660. }
  9661. reader.byteAlign();
  9662. const symbolIDTable = new HuffmanTable(codes, false);
  9663. let customIndex = 0,
  9664. tableFirstS,
  9665. tableDeltaS,
  9666. tableDeltaT;
  9667. switch (textRegion.huffmanFS) {
  9668. case 0:
  9669. case 1:
  9670. tableFirstS = getStandardTable(textRegion.huffmanFS + 6);
  9671. break;
  9672. case 3:
  9673. tableFirstS = getCustomHuffmanTable(customIndex, referredTo, customTables);
  9674. customIndex++;
  9675. break;
  9676. default:
  9677. throw new Jbig2Error("invalid Huffman FS selector");
  9678. }
  9679. switch (textRegion.huffmanDS) {
  9680. case 0:
  9681. case 1:
  9682. case 2:
  9683. tableDeltaS = getStandardTable(textRegion.huffmanDS + 8);
  9684. break;
  9685. case 3:
  9686. tableDeltaS = getCustomHuffmanTable(customIndex, referredTo, customTables);
  9687. customIndex++;
  9688. break;
  9689. default:
  9690. throw new Jbig2Error("invalid Huffman DS selector");
  9691. }
  9692. switch (textRegion.huffmanDT) {
  9693. case 0:
  9694. case 1:
  9695. case 2:
  9696. tableDeltaT = getStandardTable(textRegion.huffmanDT + 11);
  9697. break;
  9698. case 3:
  9699. tableDeltaT = getCustomHuffmanTable(customIndex, referredTo, customTables);
  9700. customIndex++;
  9701. break;
  9702. default:
  9703. throw new Jbig2Error("invalid Huffman DT selector");
  9704. }
  9705. if (textRegion.refinement) {
  9706. throw new Jbig2Error("refinement with Huffman is not supported");
  9707. }
  9708. return {
  9709. symbolIDTable,
  9710. tableFirstS,
  9711. tableDeltaS,
  9712. tableDeltaT
  9713. };
  9714. }
  9715. function getSymbolDictionaryHuffmanTables(dictionary, referredTo, customTables) {
  9716. let customIndex = 0,
  9717. tableDeltaHeight,
  9718. tableDeltaWidth;
  9719. switch (dictionary.huffmanDHSelector) {
  9720. case 0:
  9721. case 1:
  9722. tableDeltaHeight = getStandardTable(dictionary.huffmanDHSelector + 4);
  9723. break;
  9724. case 3:
  9725. tableDeltaHeight = getCustomHuffmanTable(customIndex, referredTo, customTables);
  9726. customIndex++;
  9727. break;
  9728. default:
  9729. throw new Jbig2Error("invalid Huffman DH selector");
  9730. }
  9731. switch (dictionary.huffmanDWSelector) {
  9732. case 0:
  9733. case 1:
  9734. tableDeltaWidth = getStandardTable(dictionary.huffmanDWSelector + 2);
  9735. break;
  9736. case 3:
  9737. tableDeltaWidth = getCustomHuffmanTable(customIndex, referredTo, customTables);
  9738. customIndex++;
  9739. break;
  9740. default:
  9741. throw new Jbig2Error("invalid Huffman DW selector");
  9742. }
  9743. let tableBitmapSize, tableAggregateInstances;
  9744. if (dictionary.bitmapSizeSelector) {
  9745. tableBitmapSize = getCustomHuffmanTable(customIndex, referredTo, customTables);
  9746. customIndex++;
  9747. } else {
  9748. tableBitmapSize = getStandardTable(1);
  9749. }
  9750. if (dictionary.aggregationInstancesSelector) {
  9751. tableAggregateInstances = getCustomHuffmanTable(customIndex, referredTo, customTables);
  9752. } else {
  9753. tableAggregateInstances = getStandardTable(1);
  9754. }
  9755. return {
  9756. tableDeltaHeight,
  9757. tableDeltaWidth,
  9758. tableBitmapSize,
  9759. tableAggregateInstances
  9760. };
  9761. }
  9762. function readUncompressedBitmap(reader, width, height) {
  9763. const bitmap = [];
  9764. for (let y = 0; y < height; y++) {
  9765. const row = new Uint8Array(width);
  9766. bitmap.push(row);
  9767. for (let x = 0; x < width; x++) {
  9768. row[x] = reader.readBit();
  9769. }
  9770. reader.byteAlign();
  9771. }
  9772. return bitmap;
  9773. }
  9774. function decodeMMRBitmap(input, width, height, endOfBlock) {
  9775. const params = {
  9776. K: -1,
  9777. Columns: width,
  9778. Rows: height,
  9779. BlackIs1: true,
  9780. EndOfBlock: endOfBlock
  9781. };
  9782. const decoder = new _ccitt.CCITTFaxDecoder(input, params);
  9783. const bitmap = [];
  9784. let currentByte,
  9785. eof = false;
  9786. for (let y = 0; y < height; y++) {
  9787. const row = new Uint8Array(width);
  9788. bitmap.push(row);
  9789. let shift = -1;
  9790. for (let x = 0; x < width; x++) {
  9791. if (shift < 0) {
  9792. currentByte = decoder.readNextChar();
  9793. if (currentByte === -1) {
  9794. currentByte = 0;
  9795. eof = true;
  9796. }
  9797. shift = 7;
  9798. }
  9799. row[x] = currentByte >> shift & 1;
  9800. shift--;
  9801. }
  9802. }
  9803. if (endOfBlock && !eof) {
  9804. const lookForEOFLimit = 5;
  9805. for (let i = 0; i < lookForEOFLimit; i++) {
  9806. if (decoder.readNextChar() === -1) {
  9807. break;
  9808. }
  9809. }
  9810. }
  9811. return bitmap;
  9812. }
  9813. function Jbig2Image() {}
  9814. Jbig2Image.prototype = {
  9815. parseChunks(chunks) {
  9816. return parseJbig2Chunks(chunks);
  9817. },
  9818. parse(data) {
  9819. const {
  9820. imgData,
  9821. width,
  9822. height
  9823. } = parseJbig2(data);
  9824. this.width = width;
  9825. this.height = height;
  9826. return imgData;
  9827. }
  9828. };
  9829. return Jbig2Image;
  9830. }();
  9831. exports.Jbig2Image = Jbig2Image;
  9832. /***/ }),
  9833. /* 17 */
  9834. /***/ ((__unused_webpack_module, exports) => {
  9835. Object.defineProperty(exports, "__esModule", ({
  9836. value: true
  9837. }));
  9838. exports.ArithmeticDecoder = void 0;
  9839. const QeTable = [{
  9840. qe: 0x5601,
  9841. nmps: 1,
  9842. nlps: 1,
  9843. switchFlag: 1
  9844. }, {
  9845. qe: 0x3401,
  9846. nmps: 2,
  9847. nlps: 6,
  9848. switchFlag: 0
  9849. }, {
  9850. qe: 0x1801,
  9851. nmps: 3,
  9852. nlps: 9,
  9853. switchFlag: 0
  9854. }, {
  9855. qe: 0x0ac1,
  9856. nmps: 4,
  9857. nlps: 12,
  9858. switchFlag: 0
  9859. }, {
  9860. qe: 0x0521,
  9861. nmps: 5,
  9862. nlps: 29,
  9863. switchFlag: 0
  9864. }, {
  9865. qe: 0x0221,
  9866. nmps: 38,
  9867. nlps: 33,
  9868. switchFlag: 0
  9869. }, {
  9870. qe: 0x5601,
  9871. nmps: 7,
  9872. nlps: 6,
  9873. switchFlag: 1
  9874. }, {
  9875. qe: 0x5401,
  9876. nmps: 8,
  9877. nlps: 14,
  9878. switchFlag: 0
  9879. }, {
  9880. qe: 0x4801,
  9881. nmps: 9,
  9882. nlps: 14,
  9883. switchFlag: 0
  9884. }, {
  9885. qe: 0x3801,
  9886. nmps: 10,
  9887. nlps: 14,
  9888. switchFlag: 0
  9889. }, {
  9890. qe: 0x3001,
  9891. nmps: 11,
  9892. nlps: 17,
  9893. switchFlag: 0
  9894. }, {
  9895. qe: 0x2401,
  9896. nmps: 12,
  9897. nlps: 18,
  9898. switchFlag: 0
  9899. }, {
  9900. qe: 0x1c01,
  9901. nmps: 13,
  9902. nlps: 20,
  9903. switchFlag: 0
  9904. }, {
  9905. qe: 0x1601,
  9906. nmps: 29,
  9907. nlps: 21,
  9908. switchFlag: 0
  9909. }, {
  9910. qe: 0x5601,
  9911. nmps: 15,
  9912. nlps: 14,
  9913. switchFlag: 1
  9914. }, {
  9915. qe: 0x5401,
  9916. nmps: 16,
  9917. nlps: 14,
  9918. switchFlag: 0
  9919. }, {
  9920. qe: 0x5101,
  9921. nmps: 17,
  9922. nlps: 15,
  9923. switchFlag: 0
  9924. }, {
  9925. qe: 0x4801,
  9926. nmps: 18,
  9927. nlps: 16,
  9928. switchFlag: 0
  9929. }, {
  9930. qe: 0x3801,
  9931. nmps: 19,
  9932. nlps: 17,
  9933. switchFlag: 0
  9934. }, {
  9935. qe: 0x3401,
  9936. nmps: 20,
  9937. nlps: 18,
  9938. switchFlag: 0
  9939. }, {
  9940. qe: 0x3001,
  9941. nmps: 21,
  9942. nlps: 19,
  9943. switchFlag: 0
  9944. }, {
  9945. qe: 0x2801,
  9946. nmps: 22,
  9947. nlps: 19,
  9948. switchFlag: 0
  9949. }, {
  9950. qe: 0x2401,
  9951. nmps: 23,
  9952. nlps: 20,
  9953. switchFlag: 0
  9954. }, {
  9955. qe: 0x2201,
  9956. nmps: 24,
  9957. nlps: 21,
  9958. switchFlag: 0
  9959. }, {
  9960. qe: 0x1c01,
  9961. nmps: 25,
  9962. nlps: 22,
  9963. switchFlag: 0
  9964. }, {
  9965. qe: 0x1801,
  9966. nmps: 26,
  9967. nlps: 23,
  9968. switchFlag: 0
  9969. }, {
  9970. qe: 0x1601,
  9971. nmps: 27,
  9972. nlps: 24,
  9973. switchFlag: 0
  9974. }, {
  9975. qe: 0x1401,
  9976. nmps: 28,
  9977. nlps: 25,
  9978. switchFlag: 0
  9979. }, {
  9980. qe: 0x1201,
  9981. nmps: 29,
  9982. nlps: 26,
  9983. switchFlag: 0
  9984. }, {
  9985. qe: 0x1101,
  9986. nmps: 30,
  9987. nlps: 27,
  9988. switchFlag: 0
  9989. }, {
  9990. qe: 0x0ac1,
  9991. nmps: 31,
  9992. nlps: 28,
  9993. switchFlag: 0
  9994. }, {
  9995. qe: 0x09c1,
  9996. nmps: 32,
  9997. nlps: 29,
  9998. switchFlag: 0
  9999. }, {
  10000. qe: 0x08a1,
  10001. nmps: 33,
  10002. nlps: 30,
  10003. switchFlag: 0
  10004. }, {
  10005. qe: 0x0521,
  10006. nmps: 34,
  10007. nlps: 31,
  10008. switchFlag: 0
  10009. }, {
  10010. qe: 0x0441,
  10011. nmps: 35,
  10012. nlps: 32,
  10013. switchFlag: 0
  10014. }, {
  10015. qe: 0x02a1,
  10016. nmps: 36,
  10017. nlps: 33,
  10018. switchFlag: 0
  10019. }, {
  10020. qe: 0x0221,
  10021. nmps: 37,
  10022. nlps: 34,
  10023. switchFlag: 0
  10024. }, {
  10025. qe: 0x0141,
  10026. nmps: 38,
  10027. nlps: 35,
  10028. switchFlag: 0
  10029. }, {
  10030. qe: 0x0111,
  10031. nmps: 39,
  10032. nlps: 36,
  10033. switchFlag: 0
  10034. }, {
  10035. qe: 0x0085,
  10036. nmps: 40,
  10037. nlps: 37,
  10038. switchFlag: 0
  10039. }, {
  10040. qe: 0x0049,
  10041. nmps: 41,
  10042. nlps: 38,
  10043. switchFlag: 0
  10044. }, {
  10045. qe: 0x0025,
  10046. nmps: 42,
  10047. nlps: 39,
  10048. switchFlag: 0
  10049. }, {
  10050. qe: 0x0015,
  10051. nmps: 43,
  10052. nlps: 40,
  10053. switchFlag: 0
  10054. }, {
  10055. qe: 0x0009,
  10056. nmps: 44,
  10057. nlps: 41,
  10058. switchFlag: 0
  10059. }, {
  10060. qe: 0x0005,
  10061. nmps: 45,
  10062. nlps: 42,
  10063. switchFlag: 0
  10064. }, {
  10065. qe: 0x0001,
  10066. nmps: 45,
  10067. nlps: 43,
  10068. switchFlag: 0
  10069. }, {
  10070. qe: 0x5601,
  10071. nmps: 46,
  10072. nlps: 46,
  10073. switchFlag: 0
  10074. }];
  10075. class ArithmeticDecoder {
  10076. constructor(data, start, end) {
  10077. this.data = data;
  10078. this.bp = start;
  10079. this.dataEnd = end;
  10080. this.chigh = data[start];
  10081. this.clow = 0;
  10082. this.byteIn();
  10083. this.chigh = this.chigh << 7 & 0xffff | this.clow >> 9 & 0x7f;
  10084. this.clow = this.clow << 7 & 0xffff;
  10085. this.ct -= 7;
  10086. this.a = 0x8000;
  10087. }
  10088. byteIn() {
  10089. const data = this.data;
  10090. let bp = this.bp;
  10091. if (data[bp] === 0xff) {
  10092. if (data[bp + 1] > 0x8f) {
  10093. this.clow += 0xff00;
  10094. this.ct = 8;
  10095. } else {
  10096. bp++;
  10097. this.clow += data[bp] << 9;
  10098. this.ct = 7;
  10099. this.bp = bp;
  10100. }
  10101. } else {
  10102. bp++;
  10103. this.clow += bp < this.dataEnd ? data[bp] << 8 : 0xff00;
  10104. this.ct = 8;
  10105. this.bp = bp;
  10106. }
  10107. if (this.clow > 0xffff) {
  10108. this.chigh += this.clow >> 16;
  10109. this.clow &= 0xffff;
  10110. }
  10111. }
  10112. readBit(contexts, pos) {
  10113. let cx_index = contexts[pos] >> 1,
  10114. cx_mps = contexts[pos] & 1;
  10115. const qeTableIcx = QeTable[cx_index];
  10116. const qeIcx = qeTableIcx.qe;
  10117. let d;
  10118. let a = this.a - qeIcx;
  10119. if (this.chigh < qeIcx) {
  10120. if (a < qeIcx) {
  10121. a = qeIcx;
  10122. d = cx_mps;
  10123. cx_index = qeTableIcx.nmps;
  10124. } else {
  10125. a = qeIcx;
  10126. d = 1 ^ cx_mps;
  10127. if (qeTableIcx.switchFlag === 1) {
  10128. cx_mps = d;
  10129. }
  10130. cx_index = qeTableIcx.nlps;
  10131. }
  10132. } else {
  10133. this.chigh -= qeIcx;
  10134. if ((a & 0x8000) !== 0) {
  10135. this.a = a;
  10136. return cx_mps;
  10137. }
  10138. if (a < qeIcx) {
  10139. d = 1 ^ cx_mps;
  10140. if (qeTableIcx.switchFlag === 1) {
  10141. cx_mps = d;
  10142. }
  10143. cx_index = qeTableIcx.nlps;
  10144. } else {
  10145. d = cx_mps;
  10146. cx_index = qeTableIcx.nmps;
  10147. }
  10148. }
  10149. do {
  10150. if (this.ct === 0) {
  10151. this.byteIn();
  10152. }
  10153. a <<= 1;
  10154. this.chigh = this.chigh << 1 & 0xffff | this.clow >> 15 & 1;
  10155. this.clow = this.clow << 1 & 0xffff;
  10156. this.ct--;
  10157. } while ((a & 0x8000) === 0);
  10158. this.a = a;
  10159. contexts[pos] = cx_index << 1 | cx_mps;
  10160. return d;
  10161. }
  10162. }
  10163. exports.ArithmeticDecoder = ArithmeticDecoder;
  10164. /***/ }),
  10165. /* 18 */
  10166. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  10167. Object.defineProperty(exports, "__esModule", ({
  10168. value: true
  10169. }));
  10170. exports.JpegStream = void 0;
  10171. var _stream = __w_pdfjs_require__(12);
  10172. var _primitives = __w_pdfjs_require__(5);
  10173. var _jpg = __w_pdfjs_require__(19);
  10174. var _util = __w_pdfjs_require__(2);
  10175. const JpegStream = function JpegStreamClosure() {
  10176. function JpegStream(stream, maybeLength, dict, params) {
  10177. let ch;
  10178. while ((ch = stream.getByte()) !== -1) {
  10179. if (ch === 0xff) {
  10180. stream.skip(-1);
  10181. break;
  10182. }
  10183. }
  10184. this.stream = stream;
  10185. this.maybeLength = maybeLength;
  10186. this.dict = dict;
  10187. this.params = params;
  10188. _stream.DecodeStream.call(this, maybeLength);
  10189. }
  10190. JpegStream.prototype = Object.create(_stream.DecodeStream.prototype);
  10191. Object.defineProperty(JpegStream.prototype, "bytes", {
  10192. get: function JpegStream_bytes() {
  10193. return (0, _util.shadow)(this, "bytes", this.stream.getBytes(this.maybeLength));
  10194. },
  10195. configurable: true
  10196. });
  10197. JpegStream.prototype.ensureBuffer = function (requested) {};
  10198. JpegStream.prototype.readBlock = function () {
  10199. if (this.eof) {
  10200. return;
  10201. }
  10202. const jpegOptions = {
  10203. decodeTransform: undefined,
  10204. colorTransform: undefined
  10205. };
  10206. const decodeArr = this.dict.getArray("Decode", "D");
  10207. if (this.forceRGB && Array.isArray(decodeArr)) {
  10208. const bitsPerComponent = this.dict.get("BitsPerComponent") || 8;
  10209. const decodeArrLength = decodeArr.length;
  10210. const transform = new Int32Array(decodeArrLength);
  10211. let transformNeeded = false;
  10212. const maxValue = (1 << bitsPerComponent) - 1;
  10213. for (let i = 0; i < decodeArrLength; i += 2) {
  10214. transform[i] = (decodeArr[i + 1] - decodeArr[i]) * 256 | 0;
  10215. transform[i + 1] = decodeArr[i] * maxValue | 0;
  10216. if (transform[i] !== 256 || transform[i + 1] !== 0) {
  10217. transformNeeded = true;
  10218. }
  10219. }
  10220. if (transformNeeded) {
  10221. jpegOptions.decodeTransform = transform;
  10222. }
  10223. }
  10224. if ((0, _primitives.isDict)(this.params)) {
  10225. const colorTransform = this.params.get("ColorTransform");
  10226. if (Number.isInteger(colorTransform)) {
  10227. jpegOptions.colorTransform = colorTransform;
  10228. }
  10229. }
  10230. const jpegImage = new _jpg.JpegImage(jpegOptions);
  10231. jpegImage.parse(this.bytes);
  10232. const data = jpegImage.getData({
  10233. width: this.drawWidth,
  10234. height: this.drawHeight,
  10235. forceRGB: this.forceRGB,
  10236. isSourcePDF: true
  10237. });
  10238. this.buffer = data;
  10239. this.bufferLength = data.length;
  10240. this.eof = true;
  10241. };
  10242. return JpegStream;
  10243. }();
  10244. exports.JpegStream = JpegStream;
  10245. /***/ }),
  10246. /* 19 */
  10247. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  10248. Object.defineProperty(exports, "__esModule", ({
  10249. value: true
  10250. }));
  10251. exports.JpegImage = void 0;
  10252. var _util = __w_pdfjs_require__(2);
  10253. var _core_utils = __w_pdfjs_require__(8);
  10254. class JpegError extends _util.BaseException {
  10255. constructor(msg) {
  10256. super(`JPEG error: ${msg}`);
  10257. }
  10258. }
  10259. class DNLMarkerError extends _util.BaseException {
  10260. constructor(message, scanLines) {
  10261. super(message);
  10262. this.scanLines = scanLines;
  10263. }
  10264. }
  10265. class EOIMarkerError extends _util.BaseException {}
  10266. var JpegImage = function JpegImageClosure() {
  10267. var dctZigZag = new Uint8Array([0, 1, 8, 16, 9, 2, 3, 10, 17, 24, 32, 25, 18, 11, 4, 5, 12, 19, 26, 33, 40, 48, 41, 34, 27, 20, 13, 6, 7, 14, 21, 28, 35, 42, 49, 56, 57, 50, 43, 36, 29, 22, 15, 23, 30, 37, 44, 51, 58, 59, 52, 45, 38, 31, 39, 46, 53, 60, 61, 54, 47, 55, 62, 63]);
  10268. var dctCos1 = 4017;
  10269. var dctSin1 = 799;
  10270. var dctCos3 = 3406;
  10271. var dctSin3 = 2276;
  10272. var dctCos6 = 1567;
  10273. var dctSin6 = 3784;
  10274. var dctSqrt2 = 5793;
  10275. var dctSqrt1d2 = 2896;
  10276. function JpegImage({
  10277. decodeTransform = null,
  10278. colorTransform = -1
  10279. } = {}) {
  10280. this._decodeTransform = decodeTransform;
  10281. this._colorTransform = colorTransform;
  10282. }
  10283. function buildHuffmanTable(codeLengths, values) {
  10284. var k = 0,
  10285. code = [],
  10286. i,
  10287. j,
  10288. length = 16;
  10289. while (length > 0 && !codeLengths[length - 1]) {
  10290. length--;
  10291. }
  10292. code.push({
  10293. children: [],
  10294. index: 0
  10295. });
  10296. var p = code[0],
  10297. q;
  10298. for (i = 0; i < length; i++) {
  10299. for (j = 0; j < codeLengths[i]; j++) {
  10300. p = code.pop();
  10301. p.children[p.index] = values[k];
  10302. while (p.index > 0) {
  10303. p = code.pop();
  10304. }
  10305. p.index++;
  10306. code.push(p);
  10307. while (code.length <= i) {
  10308. code.push(q = {
  10309. children: [],
  10310. index: 0
  10311. });
  10312. p.children[p.index] = q.children;
  10313. p = q;
  10314. }
  10315. k++;
  10316. }
  10317. if (i + 1 < length) {
  10318. code.push(q = {
  10319. children: [],
  10320. index: 0
  10321. });
  10322. p.children[p.index] = q.children;
  10323. p = q;
  10324. }
  10325. }
  10326. return code[0].children;
  10327. }
  10328. function getBlockBufferOffset(component, row, col) {
  10329. return 64 * ((component.blocksPerLine + 1) * row + col);
  10330. }
  10331. function decodeScan(data, offset, frame, components, resetInterval, spectralStart, spectralEnd, successivePrev, successive, parseDNLMarker = false) {
  10332. var mcusPerLine = frame.mcusPerLine;
  10333. var progressive = frame.progressive;
  10334. const startOffset = offset;
  10335. let bitsData = 0,
  10336. bitsCount = 0;
  10337. function readBit() {
  10338. if (bitsCount > 0) {
  10339. bitsCount--;
  10340. return bitsData >> bitsCount & 1;
  10341. }
  10342. bitsData = data[offset++];
  10343. if (bitsData === 0xff) {
  10344. var nextByte = data[offset++];
  10345. if (nextByte) {
  10346. if (nextByte === 0xdc && parseDNLMarker) {
  10347. offset += 2;
  10348. const scanLines = (0, _core_utils.readUint16)(data, offset);
  10349. offset += 2;
  10350. if (scanLines > 0 && scanLines !== frame.scanLines) {
  10351. throw new DNLMarkerError("Found DNL marker (0xFFDC) while parsing scan data", scanLines);
  10352. }
  10353. } else if (nextByte === 0xd9) {
  10354. if (parseDNLMarker) {
  10355. const maybeScanLines = blockRow * (frame.precision === 8 ? 8 : 0);
  10356. if (maybeScanLines > 0 && Math.round(frame.scanLines / maybeScanLines) >= 10) {
  10357. throw new DNLMarkerError("Found EOI marker (0xFFD9) while parsing scan data, " + "possibly caused by incorrect `scanLines` parameter", maybeScanLines);
  10358. }
  10359. }
  10360. throw new EOIMarkerError("Found EOI marker (0xFFD9) while parsing scan data");
  10361. }
  10362. throw new JpegError(`unexpected marker ${(bitsData << 8 | nextByte).toString(16)}`);
  10363. }
  10364. }
  10365. bitsCount = 7;
  10366. return bitsData >>> 7;
  10367. }
  10368. function decodeHuffman(tree) {
  10369. var node = tree;
  10370. while (true) {
  10371. node = node[readBit()];
  10372. switch (typeof node) {
  10373. case "number":
  10374. return node;
  10375. case "object":
  10376. continue;
  10377. }
  10378. throw new JpegError("invalid huffman sequence");
  10379. }
  10380. }
  10381. function receive(length) {
  10382. var n = 0;
  10383. while (length > 0) {
  10384. n = n << 1 | readBit();
  10385. length--;
  10386. }
  10387. return n;
  10388. }
  10389. function receiveAndExtend(length) {
  10390. if (length === 1) {
  10391. return readBit() === 1 ? 1 : -1;
  10392. }
  10393. var n = receive(length);
  10394. if (n >= 1 << length - 1) {
  10395. return n;
  10396. }
  10397. return n + (-1 << length) + 1;
  10398. }
  10399. function decodeBaseline(component, blockOffset) {
  10400. var t = decodeHuffman(component.huffmanTableDC);
  10401. var diff = t === 0 ? 0 : receiveAndExtend(t);
  10402. component.blockData[blockOffset] = component.pred += diff;
  10403. var k = 1;
  10404. while (k < 64) {
  10405. var rs = decodeHuffman(component.huffmanTableAC);
  10406. var s = rs & 15,
  10407. r = rs >> 4;
  10408. if (s === 0) {
  10409. if (r < 15) {
  10410. break;
  10411. }
  10412. k += 16;
  10413. continue;
  10414. }
  10415. k += r;
  10416. var z = dctZigZag[k];
  10417. component.blockData[blockOffset + z] = receiveAndExtend(s);
  10418. k++;
  10419. }
  10420. }
  10421. function decodeDCFirst(component, blockOffset) {
  10422. var t = decodeHuffman(component.huffmanTableDC);
  10423. var diff = t === 0 ? 0 : receiveAndExtend(t) << successive;
  10424. component.blockData[blockOffset] = component.pred += diff;
  10425. }
  10426. function decodeDCSuccessive(component, blockOffset) {
  10427. component.blockData[blockOffset] |= readBit() << successive;
  10428. }
  10429. var eobrun = 0;
  10430. function decodeACFirst(component, blockOffset) {
  10431. if (eobrun > 0) {
  10432. eobrun--;
  10433. return;
  10434. }
  10435. var k = spectralStart,
  10436. e = spectralEnd;
  10437. while (k <= e) {
  10438. var rs = decodeHuffman(component.huffmanTableAC);
  10439. var s = rs & 15,
  10440. r = rs >> 4;
  10441. if (s === 0) {
  10442. if (r < 15) {
  10443. eobrun = receive(r) + (1 << r) - 1;
  10444. break;
  10445. }
  10446. k += 16;
  10447. continue;
  10448. }
  10449. k += r;
  10450. var z = dctZigZag[k];
  10451. component.blockData[blockOffset + z] = receiveAndExtend(s) * (1 << successive);
  10452. k++;
  10453. }
  10454. }
  10455. var successiveACState = 0,
  10456. successiveACNextValue;
  10457. function decodeACSuccessive(component, blockOffset) {
  10458. var k = spectralStart;
  10459. var e = spectralEnd;
  10460. var r = 0;
  10461. var s;
  10462. var rs;
  10463. while (k <= e) {
  10464. const offsetZ = blockOffset + dctZigZag[k];
  10465. const sign = component.blockData[offsetZ] < 0 ? -1 : 1;
  10466. switch (successiveACState) {
  10467. case 0:
  10468. rs = decodeHuffman(component.huffmanTableAC);
  10469. s = rs & 15;
  10470. r = rs >> 4;
  10471. if (s === 0) {
  10472. if (r < 15) {
  10473. eobrun = receive(r) + (1 << r);
  10474. successiveACState = 4;
  10475. } else {
  10476. r = 16;
  10477. successiveACState = 1;
  10478. }
  10479. } else {
  10480. if (s !== 1) {
  10481. throw new JpegError("invalid ACn encoding");
  10482. }
  10483. successiveACNextValue = receiveAndExtend(s);
  10484. successiveACState = r ? 2 : 3;
  10485. }
  10486. continue;
  10487. case 1:
  10488. case 2:
  10489. if (component.blockData[offsetZ]) {
  10490. component.blockData[offsetZ] += sign * (readBit() << successive);
  10491. } else {
  10492. r--;
  10493. if (r === 0) {
  10494. successiveACState = successiveACState === 2 ? 3 : 0;
  10495. }
  10496. }
  10497. break;
  10498. case 3:
  10499. if (component.blockData[offsetZ]) {
  10500. component.blockData[offsetZ] += sign * (readBit() << successive);
  10501. } else {
  10502. component.blockData[offsetZ] = successiveACNextValue << successive;
  10503. successiveACState = 0;
  10504. }
  10505. break;
  10506. case 4:
  10507. if (component.blockData[offsetZ]) {
  10508. component.blockData[offsetZ] += sign * (readBit() << successive);
  10509. }
  10510. break;
  10511. }
  10512. k++;
  10513. }
  10514. if (successiveACState === 4) {
  10515. eobrun--;
  10516. if (eobrun === 0) {
  10517. successiveACState = 0;
  10518. }
  10519. }
  10520. }
  10521. let blockRow = 0;
  10522. function decodeMcu(component, decode, mcu, row, col) {
  10523. var mcuRow = mcu / mcusPerLine | 0;
  10524. var mcuCol = mcu % mcusPerLine;
  10525. blockRow = mcuRow * component.v + row;
  10526. var blockCol = mcuCol * component.h + col;
  10527. const blockOffset = getBlockBufferOffset(component, blockRow, blockCol);
  10528. decode(component, blockOffset);
  10529. }
  10530. function decodeBlock(component, decode, mcu) {
  10531. blockRow = mcu / component.blocksPerLine | 0;
  10532. var blockCol = mcu % component.blocksPerLine;
  10533. const blockOffset = getBlockBufferOffset(component, blockRow, blockCol);
  10534. decode(component, blockOffset);
  10535. }
  10536. var componentsLength = components.length;
  10537. var component, i, j, k, n;
  10538. var decodeFn;
  10539. if (progressive) {
  10540. if (spectralStart === 0) {
  10541. decodeFn = successivePrev === 0 ? decodeDCFirst : decodeDCSuccessive;
  10542. } else {
  10543. decodeFn = successivePrev === 0 ? decodeACFirst : decodeACSuccessive;
  10544. }
  10545. } else {
  10546. decodeFn = decodeBaseline;
  10547. }
  10548. var mcu = 0,
  10549. fileMarker;
  10550. var mcuExpected;
  10551. if (componentsLength === 1) {
  10552. mcuExpected = components[0].blocksPerLine * components[0].blocksPerColumn;
  10553. } else {
  10554. mcuExpected = mcusPerLine * frame.mcusPerColumn;
  10555. }
  10556. var h, v;
  10557. while (mcu <= mcuExpected) {
  10558. var mcuToRead = resetInterval ? Math.min(mcuExpected - mcu, resetInterval) : mcuExpected;
  10559. if (mcuToRead > 0) {
  10560. for (i = 0; i < componentsLength; i++) {
  10561. components[i].pred = 0;
  10562. }
  10563. eobrun = 0;
  10564. if (componentsLength === 1) {
  10565. component = components[0];
  10566. for (n = 0; n < mcuToRead; n++) {
  10567. decodeBlock(component, decodeFn, mcu);
  10568. mcu++;
  10569. }
  10570. } else {
  10571. for (n = 0; n < mcuToRead; n++) {
  10572. for (i = 0; i < componentsLength; i++) {
  10573. component = components[i];
  10574. h = component.h;
  10575. v = component.v;
  10576. for (j = 0; j < v; j++) {
  10577. for (k = 0; k < h; k++) {
  10578. decodeMcu(component, decodeFn, mcu, j, k);
  10579. }
  10580. }
  10581. }
  10582. mcu++;
  10583. }
  10584. }
  10585. }
  10586. bitsCount = 0;
  10587. fileMarker = findNextFileMarker(data, offset);
  10588. if (!fileMarker) {
  10589. break;
  10590. }
  10591. if (fileMarker.invalid) {
  10592. const partialMsg = mcuToRead > 0 ? "unexpected" : "excessive";
  10593. (0, _util.warn)(`decodeScan - ${partialMsg} MCU data, current marker is: ${fileMarker.invalid}`);
  10594. offset = fileMarker.offset;
  10595. }
  10596. if (fileMarker.marker >= 0xffd0 && fileMarker.marker <= 0xffd7) {
  10597. offset += 2;
  10598. } else {
  10599. break;
  10600. }
  10601. }
  10602. return offset - startOffset;
  10603. }
  10604. function quantizeAndInverse(component, blockBufferOffset, p) {
  10605. var qt = component.quantizationTable,
  10606. blockData = component.blockData;
  10607. var v0, v1, v2, v3, v4, v5, v6, v7;
  10608. var p0, p1, p2, p3, p4, p5, p6, p7;
  10609. var t;
  10610. if (!qt) {
  10611. throw new JpegError("missing required Quantization Table.");
  10612. }
  10613. for (var row = 0; row < 64; row += 8) {
  10614. p0 = blockData[blockBufferOffset + row];
  10615. p1 = blockData[blockBufferOffset + row + 1];
  10616. p2 = blockData[blockBufferOffset + row + 2];
  10617. p3 = blockData[blockBufferOffset + row + 3];
  10618. p4 = blockData[blockBufferOffset + row + 4];
  10619. p5 = blockData[blockBufferOffset + row + 5];
  10620. p6 = blockData[blockBufferOffset + row + 6];
  10621. p7 = blockData[blockBufferOffset + row + 7];
  10622. p0 *= qt[row];
  10623. if ((p1 | p2 | p3 | p4 | p5 | p6 | p7) === 0) {
  10624. t = dctSqrt2 * p0 + 512 >> 10;
  10625. p[row] = t;
  10626. p[row + 1] = t;
  10627. p[row + 2] = t;
  10628. p[row + 3] = t;
  10629. p[row + 4] = t;
  10630. p[row + 5] = t;
  10631. p[row + 6] = t;
  10632. p[row + 7] = t;
  10633. continue;
  10634. }
  10635. p1 *= qt[row + 1];
  10636. p2 *= qt[row + 2];
  10637. p3 *= qt[row + 3];
  10638. p4 *= qt[row + 4];
  10639. p5 *= qt[row + 5];
  10640. p6 *= qt[row + 6];
  10641. p7 *= qt[row + 7];
  10642. v0 = dctSqrt2 * p0 + 128 >> 8;
  10643. v1 = dctSqrt2 * p4 + 128 >> 8;
  10644. v2 = p2;
  10645. v3 = p6;
  10646. v4 = dctSqrt1d2 * (p1 - p7) + 128 >> 8;
  10647. v7 = dctSqrt1d2 * (p1 + p7) + 128 >> 8;
  10648. v5 = p3 << 4;
  10649. v6 = p5 << 4;
  10650. v0 = v0 + v1 + 1 >> 1;
  10651. v1 = v0 - v1;
  10652. t = v2 * dctSin6 + v3 * dctCos6 + 128 >> 8;
  10653. v2 = v2 * dctCos6 - v3 * dctSin6 + 128 >> 8;
  10654. v3 = t;
  10655. v4 = v4 + v6 + 1 >> 1;
  10656. v6 = v4 - v6;
  10657. v7 = v7 + v5 + 1 >> 1;
  10658. v5 = v7 - v5;
  10659. v0 = v0 + v3 + 1 >> 1;
  10660. v3 = v0 - v3;
  10661. v1 = v1 + v2 + 1 >> 1;
  10662. v2 = v1 - v2;
  10663. t = v4 * dctSin3 + v7 * dctCos3 + 2048 >> 12;
  10664. v4 = v4 * dctCos3 - v7 * dctSin3 + 2048 >> 12;
  10665. v7 = t;
  10666. t = v5 * dctSin1 + v6 * dctCos1 + 2048 >> 12;
  10667. v5 = v5 * dctCos1 - v6 * dctSin1 + 2048 >> 12;
  10668. v6 = t;
  10669. p[row] = v0 + v7;
  10670. p[row + 7] = v0 - v7;
  10671. p[row + 1] = v1 + v6;
  10672. p[row + 6] = v1 - v6;
  10673. p[row + 2] = v2 + v5;
  10674. p[row + 5] = v2 - v5;
  10675. p[row + 3] = v3 + v4;
  10676. p[row + 4] = v3 - v4;
  10677. }
  10678. for (var col = 0; col < 8; ++col) {
  10679. p0 = p[col];
  10680. p1 = p[col + 8];
  10681. p2 = p[col + 16];
  10682. p3 = p[col + 24];
  10683. p4 = p[col + 32];
  10684. p5 = p[col + 40];
  10685. p6 = p[col + 48];
  10686. p7 = p[col + 56];
  10687. if ((p1 | p2 | p3 | p4 | p5 | p6 | p7) === 0) {
  10688. t = dctSqrt2 * p0 + 8192 >> 14;
  10689. if (t < -2040) {
  10690. t = 0;
  10691. } else if (t >= 2024) {
  10692. t = 255;
  10693. } else {
  10694. t = t + 2056 >> 4;
  10695. }
  10696. blockData[blockBufferOffset + col] = t;
  10697. blockData[blockBufferOffset + col + 8] = t;
  10698. blockData[blockBufferOffset + col + 16] = t;
  10699. blockData[blockBufferOffset + col + 24] = t;
  10700. blockData[blockBufferOffset + col + 32] = t;
  10701. blockData[blockBufferOffset + col + 40] = t;
  10702. blockData[blockBufferOffset + col + 48] = t;
  10703. blockData[blockBufferOffset + col + 56] = t;
  10704. continue;
  10705. }
  10706. v0 = dctSqrt2 * p0 + 2048 >> 12;
  10707. v1 = dctSqrt2 * p4 + 2048 >> 12;
  10708. v2 = p2;
  10709. v3 = p6;
  10710. v4 = dctSqrt1d2 * (p1 - p7) + 2048 >> 12;
  10711. v7 = dctSqrt1d2 * (p1 + p7) + 2048 >> 12;
  10712. v5 = p3;
  10713. v6 = p5;
  10714. v0 = (v0 + v1 + 1 >> 1) + 4112;
  10715. v1 = v0 - v1;
  10716. t = v2 * dctSin6 + v3 * dctCos6 + 2048 >> 12;
  10717. v2 = v2 * dctCos6 - v3 * dctSin6 + 2048 >> 12;
  10718. v3 = t;
  10719. v4 = v4 + v6 + 1 >> 1;
  10720. v6 = v4 - v6;
  10721. v7 = v7 + v5 + 1 >> 1;
  10722. v5 = v7 - v5;
  10723. v0 = v0 + v3 + 1 >> 1;
  10724. v3 = v0 - v3;
  10725. v1 = v1 + v2 + 1 >> 1;
  10726. v2 = v1 - v2;
  10727. t = v4 * dctSin3 + v7 * dctCos3 + 2048 >> 12;
  10728. v4 = v4 * dctCos3 - v7 * dctSin3 + 2048 >> 12;
  10729. v7 = t;
  10730. t = v5 * dctSin1 + v6 * dctCos1 + 2048 >> 12;
  10731. v5 = v5 * dctCos1 - v6 * dctSin1 + 2048 >> 12;
  10732. v6 = t;
  10733. p0 = v0 + v7;
  10734. p7 = v0 - v7;
  10735. p1 = v1 + v6;
  10736. p6 = v1 - v6;
  10737. p2 = v2 + v5;
  10738. p5 = v2 - v5;
  10739. p3 = v3 + v4;
  10740. p4 = v3 - v4;
  10741. if (p0 < 16) {
  10742. p0 = 0;
  10743. } else if (p0 >= 4080) {
  10744. p0 = 255;
  10745. } else {
  10746. p0 >>= 4;
  10747. }
  10748. if (p1 < 16) {
  10749. p1 = 0;
  10750. } else if (p1 >= 4080) {
  10751. p1 = 255;
  10752. } else {
  10753. p1 >>= 4;
  10754. }
  10755. if (p2 < 16) {
  10756. p2 = 0;
  10757. } else if (p2 >= 4080) {
  10758. p2 = 255;
  10759. } else {
  10760. p2 >>= 4;
  10761. }
  10762. if (p3 < 16) {
  10763. p3 = 0;
  10764. } else if (p3 >= 4080) {
  10765. p3 = 255;
  10766. } else {
  10767. p3 >>= 4;
  10768. }
  10769. if (p4 < 16) {
  10770. p4 = 0;
  10771. } else if (p4 >= 4080) {
  10772. p4 = 255;
  10773. } else {
  10774. p4 >>= 4;
  10775. }
  10776. if (p5 < 16) {
  10777. p5 = 0;
  10778. } else if (p5 >= 4080) {
  10779. p5 = 255;
  10780. } else {
  10781. p5 >>= 4;
  10782. }
  10783. if (p6 < 16) {
  10784. p6 = 0;
  10785. } else if (p6 >= 4080) {
  10786. p6 = 255;
  10787. } else {
  10788. p6 >>= 4;
  10789. }
  10790. if (p7 < 16) {
  10791. p7 = 0;
  10792. } else if (p7 >= 4080) {
  10793. p7 = 255;
  10794. } else {
  10795. p7 >>= 4;
  10796. }
  10797. blockData[blockBufferOffset + col] = p0;
  10798. blockData[blockBufferOffset + col + 8] = p1;
  10799. blockData[blockBufferOffset + col + 16] = p2;
  10800. blockData[blockBufferOffset + col + 24] = p3;
  10801. blockData[blockBufferOffset + col + 32] = p4;
  10802. blockData[blockBufferOffset + col + 40] = p5;
  10803. blockData[blockBufferOffset + col + 48] = p6;
  10804. blockData[blockBufferOffset + col + 56] = p7;
  10805. }
  10806. }
  10807. function buildComponentData(frame, component) {
  10808. var blocksPerLine = component.blocksPerLine;
  10809. var blocksPerColumn = component.blocksPerColumn;
  10810. var computationBuffer = new Int16Array(64);
  10811. for (var blockRow = 0; blockRow < blocksPerColumn; blockRow++) {
  10812. for (var blockCol = 0; blockCol < blocksPerLine; blockCol++) {
  10813. var offset = getBlockBufferOffset(component, blockRow, blockCol);
  10814. quantizeAndInverse(component, offset, computationBuffer);
  10815. }
  10816. }
  10817. return component.blockData;
  10818. }
  10819. function findNextFileMarker(data, currentPos, startPos = currentPos) {
  10820. const maxPos = data.length - 1;
  10821. var newPos = startPos < currentPos ? startPos : currentPos;
  10822. if (currentPos >= maxPos) {
  10823. return null;
  10824. }
  10825. var currentMarker = (0, _core_utils.readUint16)(data, currentPos);
  10826. if (currentMarker >= 0xffc0 && currentMarker <= 0xfffe) {
  10827. return {
  10828. invalid: null,
  10829. marker: currentMarker,
  10830. offset: currentPos
  10831. };
  10832. }
  10833. var newMarker = (0, _core_utils.readUint16)(data, newPos);
  10834. while (!(newMarker >= 0xffc0 && newMarker <= 0xfffe)) {
  10835. if (++newPos >= maxPos) {
  10836. return null;
  10837. }
  10838. newMarker = (0, _core_utils.readUint16)(data, newPos);
  10839. }
  10840. return {
  10841. invalid: currentMarker.toString(16),
  10842. marker: newMarker,
  10843. offset: newPos
  10844. };
  10845. }
  10846. JpegImage.prototype = {
  10847. parse(data, {
  10848. dnlScanLines = null
  10849. } = {}) {
  10850. function readDataBlock() {
  10851. const length = (0, _core_utils.readUint16)(data, offset);
  10852. offset += 2;
  10853. let endOffset = offset + length - 2;
  10854. var fileMarker = findNextFileMarker(data, endOffset, offset);
  10855. if (fileMarker && fileMarker.invalid) {
  10856. (0, _util.warn)("readDataBlock - incorrect length, current marker is: " + fileMarker.invalid);
  10857. endOffset = fileMarker.offset;
  10858. }
  10859. var array = data.subarray(offset, endOffset);
  10860. offset += array.length;
  10861. return array;
  10862. }
  10863. function prepareComponents(frame) {
  10864. var mcusPerLine = Math.ceil(frame.samplesPerLine / 8 / frame.maxH);
  10865. var mcusPerColumn = Math.ceil(frame.scanLines / 8 / frame.maxV);
  10866. for (var i = 0; i < frame.components.length; i++) {
  10867. component = frame.components[i];
  10868. var blocksPerLine = Math.ceil(Math.ceil(frame.samplesPerLine / 8) * component.h / frame.maxH);
  10869. var blocksPerColumn = Math.ceil(Math.ceil(frame.scanLines / 8) * component.v / frame.maxV);
  10870. var blocksPerLineForMcu = mcusPerLine * component.h;
  10871. var blocksPerColumnForMcu = mcusPerColumn * component.v;
  10872. var blocksBufferSize = 64 * blocksPerColumnForMcu * (blocksPerLineForMcu + 1);
  10873. component.blockData = new Int16Array(blocksBufferSize);
  10874. component.blocksPerLine = blocksPerLine;
  10875. component.blocksPerColumn = blocksPerColumn;
  10876. }
  10877. frame.mcusPerLine = mcusPerLine;
  10878. frame.mcusPerColumn = mcusPerColumn;
  10879. }
  10880. var offset = 0;
  10881. var jfif = null;
  10882. var adobe = null;
  10883. var frame, resetInterval;
  10884. let numSOSMarkers = 0;
  10885. var quantizationTables = [];
  10886. var huffmanTablesAC = [],
  10887. huffmanTablesDC = [];
  10888. let fileMarker = (0, _core_utils.readUint16)(data, offset);
  10889. offset += 2;
  10890. if (fileMarker !== 0xffd8) {
  10891. throw new JpegError("SOI not found");
  10892. }
  10893. fileMarker = (0, _core_utils.readUint16)(data, offset);
  10894. offset += 2;
  10895. markerLoop: while (fileMarker !== 0xffd9) {
  10896. var i, j, l;
  10897. switch (fileMarker) {
  10898. case 0xffe0:
  10899. case 0xffe1:
  10900. case 0xffe2:
  10901. case 0xffe3:
  10902. case 0xffe4:
  10903. case 0xffe5:
  10904. case 0xffe6:
  10905. case 0xffe7:
  10906. case 0xffe8:
  10907. case 0xffe9:
  10908. case 0xffea:
  10909. case 0xffeb:
  10910. case 0xffec:
  10911. case 0xffed:
  10912. case 0xffee:
  10913. case 0xffef:
  10914. case 0xfffe:
  10915. var appData = readDataBlock();
  10916. if (fileMarker === 0xffe0) {
  10917. if (appData[0] === 0x4a && appData[1] === 0x46 && appData[2] === 0x49 && appData[3] === 0x46 && appData[4] === 0) {
  10918. jfif = {
  10919. version: {
  10920. major: appData[5],
  10921. minor: appData[6]
  10922. },
  10923. densityUnits: appData[7],
  10924. xDensity: appData[8] << 8 | appData[9],
  10925. yDensity: appData[10] << 8 | appData[11],
  10926. thumbWidth: appData[12],
  10927. thumbHeight: appData[13],
  10928. thumbData: appData.subarray(14, 14 + 3 * appData[12] * appData[13])
  10929. };
  10930. }
  10931. }
  10932. if (fileMarker === 0xffee) {
  10933. if (appData[0] === 0x41 && appData[1] === 0x64 && appData[2] === 0x6f && appData[3] === 0x62 && appData[4] === 0x65) {
  10934. adobe = {
  10935. version: appData[5] << 8 | appData[6],
  10936. flags0: appData[7] << 8 | appData[8],
  10937. flags1: appData[9] << 8 | appData[10],
  10938. transformCode: appData[11]
  10939. };
  10940. }
  10941. }
  10942. break;
  10943. case 0xffdb:
  10944. const quantizationTablesLength = (0, _core_utils.readUint16)(data, offset);
  10945. offset += 2;
  10946. var quantizationTablesEnd = quantizationTablesLength + offset - 2;
  10947. var z;
  10948. while (offset < quantizationTablesEnd) {
  10949. var quantizationTableSpec = data[offset++];
  10950. var tableData = new Uint16Array(64);
  10951. if (quantizationTableSpec >> 4 === 0) {
  10952. for (j = 0; j < 64; j++) {
  10953. z = dctZigZag[j];
  10954. tableData[z] = data[offset++];
  10955. }
  10956. } else if (quantizationTableSpec >> 4 === 1) {
  10957. for (j = 0; j < 64; j++) {
  10958. z = dctZigZag[j];
  10959. tableData[z] = (0, _core_utils.readUint16)(data, offset);
  10960. offset += 2;
  10961. }
  10962. } else {
  10963. throw new JpegError("DQT - invalid table spec");
  10964. }
  10965. quantizationTables[quantizationTableSpec & 15] = tableData;
  10966. }
  10967. break;
  10968. case 0xffc0:
  10969. case 0xffc1:
  10970. case 0xffc2:
  10971. if (frame) {
  10972. throw new JpegError("Only single frame JPEGs supported");
  10973. }
  10974. offset += 2;
  10975. frame = {};
  10976. frame.extended = fileMarker === 0xffc1;
  10977. frame.progressive = fileMarker === 0xffc2;
  10978. frame.precision = data[offset++];
  10979. const sofScanLines = (0, _core_utils.readUint16)(data, offset);
  10980. offset += 2;
  10981. frame.scanLines = dnlScanLines || sofScanLines;
  10982. frame.samplesPerLine = (0, _core_utils.readUint16)(data, offset);
  10983. offset += 2;
  10984. frame.components = [];
  10985. frame.componentIds = {};
  10986. var componentsCount = data[offset++],
  10987. componentId;
  10988. var maxH = 0,
  10989. maxV = 0;
  10990. for (i = 0; i < componentsCount; i++) {
  10991. componentId = data[offset];
  10992. var h = data[offset + 1] >> 4;
  10993. var v = data[offset + 1] & 15;
  10994. if (maxH < h) {
  10995. maxH = h;
  10996. }
  10997. if (maxV < v) {
  10998. maxV = v;
  10999. }
  11000. var qId = data[offset + 2];
  11001. l = frame.components.push({
  11002. h,
  11003. v,
  11004. quantizationId: qId,
  11005. quantizationTable: null
  11006. });
  11007. frame.componentIds[componentId] = l - 1;
  11008. offset += 3;
  11009. }
  11010. frame.maxH = maxH;
  11011. frame.maxV = maxV;
  11012. prepareComponents(frame);
  11013. break;
  11014. case 0xffc4:
  11015. const huffmanLength = (0, _core_utils.readUint16)(data, offset);
  11016. offset += 2;
  11017. for (i = 2; i < huffmanLength;) {
  11018. var huffmanTableSpec = data[offset++];
  11019. var codeLengths = new Uint8Array(16);
  11020. var codeLengthSum = 0;
  11021. for (j = 0; j < 16; j++, offset++) {
  11022. codeLengthSum += codeLengths[j] = data[offset];
  11023. }
  11024. var huffmanValues = new Uint8Array(codeLengthSum);
  11025. for (j = 0; j < codeLengthSum; j++, offset++) {
  11026. huffmanValues[j] = data[offset];
  11027. }
  11028. i += 17 + codeLengthSum;
  11029. (huffmanTableSpec >> 4 === 0 ? huffmanTablesDC : huffmanTablesAC)[huffmanTableSpec & 15] = buildHuffmanTable(codeLengths, huffmanValues);
  11030. }
  11031. break;
  11032. case 0xffdd:
  11033. offset += 2;
  11034. resetInterval = (0, _core_utils.readUint16)(data, offset);
  11035. offset += 2;
  11036. break;
  11037. case 0xffda:
  11038. const parseDNLMarker = ++numSOSMarkers === 1 && !dnlScanLines;
  11039. offset += 2;
  11040. var selectorsCount = data[offset++];
  11041. var components = [],
  11042. component;
  11043. for (i = 0; i < selectorsCount; i++) {
  11044. const index = data[offset++];
  11045. var componentIndex = frame.componentIds[index];
  11046. component = frame.components[componentIndex];
  11047. component.index = index;
  11048. var tableSpec = data[offset++];
  11049. component.huffmanTableDC = huffmanTablesDC[tableSpec >> 4];
  11050. component.huffmanTableAC = huffmanTablesAC[tableSpec & 15];
  11051. components.push(component);
  11052. }
  11053. var spectralStart = data[offset++];
  11054. var spectralEnd = data[offset++];
  11055. var successiveApproximation = data[offset++];
  11056. try {
  11057. var processed = decodeScan(data, offset, frame, components, resetInterval, spectralStart, spectralEnd, successiveApproximation >> 4, successiveApproximation & 15, parseDNLMarker);
  11058. offset += processed;
  11059. } catch (ex) {
  11060. if (ex instanceof DNLMarkerError) {
  11061. (0, _util.warn)(`${ex.message} -- attempting to re-parse the JPEG image.`);
  11062. return this.parse(data, {
  11063. dnlScanLines: ex.scanLines
  11064. });
  11065. } else if (ex instanceof EOIMarkerError) {
  11066. (0, _util.warn)(`${ex.message} -- ignoring the rest of the image data.`);
  11067. break markerLoop;
  11068. }
  11069. throw ex;
  11070. }
  11071. break;
  11072. case 0xffdc:
  11073. offset += 4;
  11074. break;
  11075. case 0xffff:
  11076. if (data[offset] !== 0xff) {
  11077. offset--;
  11078. }
  11079. break;
  11080. default:
  11081. const nextFileMarker = findNextFileMarker(data, offset - 2, offset - 3);
  11082. if (nextFileMarker && nextFileMarker.invalid) {
  11083. (0, _util.warn)("JpegImage.parse - unexpected data, current marker is: " + nextFileMarker.invalid);
  11084. offset = nextFileMarker.offset;
  11085. break;
  11086. }
  11087. if (!nextFileMarker || offset >= data.length - 1) {
  11088. (0, _util.warn)("JpegImage.parse - reached the end of the image data " + "without finding an EOI marker (0xFFD9).");
  11089. break markerLoop;
  11090. }
  11091. throw new JpegError("JpegImage.parse - unknown marker: " + fileMarker.toString(16));
  11092. }
  11093. fileMarker = (0, _core_utils.readUint16)(data, offset);
  11094. offset += 2;
  11095. }
  11096. this.width = frame.samplesPerLine;
  11097. this.height = frame.scanLines;
  11098. this.jfif = jfif;
  11099. this.adobe = adobe;
  11100. this.components = [];
  11101. for (i = 0; i < frame.components.length; i++) {
  11102. component = frame.components[i];
  11103. var quantizationTable = quantizationTables[component.quantizationId];
  11104. if (quantizationTable) {
  11105. component.quantizationTable = quantizationTable;
  11106. }
  11107. this.components.push({
  11108. index: component.index,
  11109. output: buildComponentData(frame, component),
  11110. scaleX: component.h / frame.maxH,
  11111. scaleY: component.v / frame.maxV,
  11112. blocksPerLine: component.blocksPerLine,
  11113. blocksPerColumn: component.blocksPerColumn
  11114. });
  11115. }
  11116. this.numComponents = this.components.length;
  11117. return undefined;
  11118. },
  11119. _getLinearizedBlockData(width, height, isSourcePDF = false) {
  11120. var scaleX = this.width / width,
  11121. scaleY = this.height / height;
  11122. var component, componentScaleX, componentScaleY, blocksPerScanline;
  11123. var x, y, i, j, k;
  11124. var index;
  11125. var offset = 0;
  11126. var output;
  11127. var numComponents = this.components.length;
  11128. var dataLength = width * height * numComponents;
  11129. var data = new Uint8ClampedArray(dataLength);
  11130. var xScaleBlockOffset = new Uint32Array(width);
  11131. var mask3LSB = 0xfffffff8;
  11132. let lastComponentScaleX;
  11133. for (i = 0; i < numComponents; i++) {
  11134. component = this.components[i];
  11135. componentScaleX = component.scaleX * scaleX;
  11136. componentScaleY = component.scaleY * scaleY;
  11137. offset = i;
  11138. output = component.output;
  11139. blocksPerScanline = component.blocksPerLine + 1 << 3;
  11140. if (componentScaleX !== lastComponentScaleX) {
  11141. for (x = 0; x < width; x++) {
  11142. j = 0 | x * componentScaleX;
  11143. xScaleBlockOffset[x] = (j & mask3LSB) << 3 | j & 7;
  11144. }
  11145. lastComponentScaleX = componentScaleX;
  11146. }
  11147. for (y = 0; y < height; y++) {
  11148. j = 0 | y * componentScaleY;
  11149. index = blocksPerScanline * (j & mask3LSB) | (j & 7) << 3;
  11150. for (x = 0; x < width; x++) {
  11151. data[offset] = output[index + xScaleBlockOffset[x]];
  11152. offset += numComponents;
  11153. }
  11154. }
  11155. }
  11156. let transform = this._decodeTransform;
  11157. if (!isSourcePDF && numComponents === 4 && !transform) {
  11158. transform = new Int32Array([-256, 255, -256, 255, -256, 255, -256, 255]);
  11159. }
  11160. if (transform) {
  11161. for (i = 0; i < dataLength;) {
  11162. for (j = 0, k = 0; j < numComponents; j++, i++, k += 2) {
  11163. data[i] = (data[i] * transform[k] >> 8) + transform[k + 1];
  11164. }
  11165. }
  11166. }
  11167. return data;
  11168. },
  11169. get _isColorConversionNeeded() {
  11170. if (this.adobe) {
  11171. return !!this.adobe.transformCode;
  11172. }
  11173. if (this.numComponents === 3) {
  11174. if (this._colorTransform === 0) {
  11175. return false;
  11176. } else if (this.components[0].index === 0x52 && this.components[1].index === 0x47 && this.components[2].index === 0x42) {
  11177. return false;
  11178. }
  11179. return true;
  11180. }
  11181. if (this._colorTransform === 1) {
  11182. return true;
  11183. }
  11184. return false;
  11185. },
  11186. _convertYccToRgb: function convertYccToRgb(data) {
  11187. var Y, Cb, Cr;
  11188. for (var i = 0, length = data.length; i < length; i += 3) {
  11189. Y = data[i];
  11190. Cb = data[i + 1];
  11191. Cr = data[i + 2];
  11192. data[i] = Y - 179.456 + 1.402 * Cr;
  11193. data[i + 1] = Y + 135.459 - 0.344 * Cb - 0.714 * Cr;
  11194. data[i + 2] = Y - 226.816 + 1.772 * Cb;
  11195. }
  11196. return data;
  11197. },
  11198. _convertYcckToRgb: function convertYcckToRgb(data) {
  11199. var Y, Cb, Cr, k;
  11200. var offset = 0;
  11201. for (var i = 0, length = data.length; i < length; i += 4) {
  11202. Y = data[i];
  11203. Cb = data[i + 1];
  11204. Cr = data[i + 2];
  11205. k = data[i + 3];
  11206. data[offset++] = -122.67195406894 + Cb * (-6.60635669420364e-5 * Cb + 0.000437130475926232 * Cr - 5.4080610064599e-5 * Y + 0.00048449797120281 * k - 0.154362151871126) + Cr * (-0.000957964378445773 * Cr + 0.000817076911346625 * Y - 0.00477271405408747 * k + 1.53380253221734) + Y * (0.000961250184130688 * Y - 0.00266257332283933 * k + 0.48357088451265) + k * (-0.000336197177618394 * k + 0.484791561490776);
  11207. data[offset++] = 107.268039397724 + Cb * (2.19927104525741e-5 * Cb - 0.000640992018297945 * Cr + 0.000659397001245577 * Y + 0.000426105652938837 * k - 0.176491792462875) + Cr * (-0.000778269941513683 * Cr + 0.00130872261408275 * Y + 0.000770482631801132 * k - 0.151051492775562) + Y * (0.00126935368114843 * Y - 0.00265090189010898 * k + 0.25802910206845) + k * (-0.000318913117588328 * k - 0.213742400323665);
  11208. data[offset++] = -20.810012546947 + Cb * (-0.000570115196973677 * Cb - 2.63409051004589e-5 * Cr + 0.0020741088115012 * Y - 0.00288260236853442 * k + 0.814272968359295) + Cr * (-1.53496057440975e-5 * Cr - 0.000132689043961446 * Y + 0.000560833691242812 * k - 0.195152027534049) + Y * (0.00174418132927582 * Y - 0.00255243321439347 * k + 0.116935020465145) + k * (-0.000343531996510555 * k + 0.24165260232407);
  11209. }
  11210. return data.subarray(0, offset);
  11211. },
  11212. _convertYcckToCmyk: function convertYcckToCmyk(data) {
  11213. var Y, Cb, Cr;
  11214. for (var i = 0, length = data.length; i < length; i += 4) {
  11215. Y = data[i];
  11216. Cb = data[i + 1];
  11217. Cr = data[i + 2];
  11218. data[i] = 434.456 - Y - 1.402 * Cr;
  11219. data[i + 1] = 119.541 - Y + 0.344 * Cb + 0.714 * Cr;
  11220. data[i + 2] = 481.816 - Y - 1.772 * Cb;
  11221. }
  11222. return data;
  11223. },
  11224. _convertCmykToRgb: function convertCmykToRgb(data) {
  11225. var c, m, y, k;
  11226. var offset = 0;
  11227. for (var i = 0, length = data.length; i < length; i += 4) {
  11228. c = data[i];
  11229. m = data[i + 1];
  11230. y = data[i + 2];
  11231. k = data[i + 3];
  11232. data[offset++] = 255 + c * (-0.00006747147073602441 * c + 0.0008379262121013727 * m + 0.0002894718188643294 * y + 0.003264231057537806 * k - 1.1185611867203937) + m * (0.000026374107616089405 * m - 0.00008626949158638572 * y - 0.0002748769067499491 * k - 0.02155688794978967) + y * (-0.00003878099212869363 * y - 0.0003267808279485286 * k + 0.0686742238595345) - k * (0.0003361971776183937 * k + 0.7430659151342254);
  11233. data[offset++] = 255 + c * (0.00013596372813588848 * c + 0.000924537132573585 * m + 0.00010567359618683593 * y + 0.0004791864687436512 * k - 0.3109689587515875) + m * (-0.00023545346108370344 * m + 0.0002702845253534714 * y + 0.0020200308977307156 * k - 0.7488052167015494) + y * (0.00006834815998235662 * y + 0.00015168452363460973 * k - 0.09751927774728933) - k * (0.00031891311758832814 * k + 0.7364883807733168);
  11234. data[offset++] = 255 + c * (0.000013598650411385307 * c + 0.00012423956175490851 * m + 0.0004751985097583589 * y - 0.0000036729317476630422 * k - 0.05562186980264034) + m * (0.00016141380598724676 * m + 0.0009692239130725186 * y + 0.0007782692450036253 * k - 0.44015232367526463) + y * (5.068882914068769e-7 * y + 0.0017778369011375071 * k - 0.7591454649749609) - k * (0.0003435319965105553 * k + 0.7063770186160144);
  11235. }
  11236. return data.subarray(0, offset);
  11237. },
  11238. getData({
  11239. width,
  11240. height,
  11241. forceRGB = false,
  11242. isSourcePDF = false
  11243. }) {
  11244. if (this.numComponents > 4) {
  11245. throw new JpegError("Unsupported color mode");
  11246. }
  11247. var data = this._getLinearizedBlockData(width, height, isSourcePDF);
  11248. if (this.numComponents === 1 && forceRGB) {
  11249. var dataLength = data.length;
  11250. var rgbData = new Uint8ClampedArray(dataLength * 3);
  11251. var offset = 0;
  11252. for (var i = 0; i < dataLength; i++) {
  11253. var grayColor = data[i];
  11254. rgbData[offset++] = grayColor;
  11255. rgbData[offset++] = grayColor;
  11256. rgbData[offset++] = grayColor;
  11257. }
  11258. return rgbData;
  11259. } else if (this.numComponents === 3 && this._isColorConversionNeeded) {
  11260. return this._convertYccToRgb(data);
  11261. } else if (this.numComponents === 4) {
  11262. if (this._isColorConversionNeeded) {
  11263. if (forceRGB) {
  11264. return this._convertYcckToRgb(data);
  11265. }
  11266. return this._convertYcckToCmyk(data);
  11267. } else if (forceRGB) {
  11268. return this._convertCmykToRgb(data);
  11269. }
  11270. }
  11271. return data;
  11272. }
  11273. };
  11274. return JpegImage;
  11275. }();
  11276. exports.JpegImage = JpegImage;
  11277. /***/ }),
  11278. /* 20 */
  11279. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  11280. Object.defineProperty(exports, "__esModule", ({
  11281. value: true
  11282. }));
  11283. exports.JpxStream = void 0;
  11284. var _stream = __w_pdfjs_require__(12);
  11285. var _jpx = __w_pdfjs_require__(21);
  11286. var _util = __w_pdfjs_require__(2);
  11287. const JpxStream = function JpxStreamClosure() {
  11288. function JpxStream(stream, maybeLength, dict, params) {
  11289. this.stream = stream;
  11290. this.maybeLength = maybeLength;
  11291. this.dict = dict;
  11292. this.params = params;
  11293. _stream.DecodeStream.call(this, maybeLength);
  11294. }
  11295. JpxStream.prototype = Object.create(_stream.DecodeStream.prototype);
  11296. Object.defineProperty(JpxStream.prototype, "bytes", {
  11297. get: function JpxStream_bytes() {
  11298. return (0, _util.shadow)(this, "bytes", this.stream.getBytes(this.maybeLength));
  11299. },
  11300. configurable: true
  11301. });
  11302. JpxStream.prototype.ensureBuffer = function (requested) {};
  11303. JpxStream.prototype.readBlock = function () {
  11304. if (this.eof) {
  11305. return;
  11306. }
  11307. const jpxImage = new _jpx.JpxImage();
  11308. jpxImage.parse(this.bytes);
  11309. const width = jpxImage.width;
  11310. const height = jpxImage.height;
  11311. const componentsCount = jpxImage.componentsCount;
  11312. const tileCount = jpxImage.tiles.length;
  11313. if (tileCount === 1) {
  11314. this.buffer = jpxImage.tiles[0].items;
  11315. } else {
  11316. const data = new Uint8ClampedArray(width * height * componentsCount);
  11317. for (let k = 0; k < tileCount; k++) {
  11318. const tileComponents = jpxImage.tiles[k];
  11319. const tileWidth = tileComponents.width;
  11320. const tileHeight = tileComponents.height;
  11321. const tileLeft = tileComponents.left;
  11322. const tileTop = tileComponents.top;
  11323. const src = tileComponents.items;
  11324. let srcPosition = 0;
  11325. let dataPosition = (width * tileTop + tileLeft) * componentsCount;
  11326. const imgRowSize = width * componentsCount;
  11327. const tileRowSize = tileWidth * componentsCount;
  11328. for (let j = 0; j < tileHeight; j++) {
  11329. const rowBytes = src.subarray(srcPosition, srcPosition + tileRowSize);
  11330. data.set(rowBytes, dataPosition);
  11331. srcPosition += tileRowSize;
  11332. dataPosition += imgRowSize;
  11333. }
  11334. }
  11335. this.buffer = data;
  11336. }
  11337. this.bufferLength = this.buffer.length;
  11338. this.eof = true;
  11339. };
  11340. return JpxStream;
  11341. }();
  11342. exports.JpxStream = JpxStream;
  11343. /***/ }),
  11344. /* 21 */
  11345. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  11346. Object.defineProperty(exports, "__esModule", ({
  11347. value: true
  11348. }));
  11349. exports.JpxImage = void 0;
  11350. var _util = __w_pdfjs_require__(2);
  11351. var _core_utils = __w_pdfjs_require__(8);
  11352. var _arithmetic_decoder = __w_pdfjs_require__(17);
  11353. class JpxError extends _util.BaseException {
  11354. constructor(msg) {
  11355. super(`JPX error: ${msg}`);
  11356. }
  11357. }
  11358. var JpxImage = function JpxImageClosure() {
  11359. var SubbandsGainLog2 = {
  11360. LL: 0,
  11361. LH: 1,
  11362. HL: 1,
  11363. HH: 2
  11364. };
  11365. function JpxImage() {
  11366. this.failOnCorruptedImage = false;
  11367. }
  11368. JpxImage.prototype = {
  11369. parse: function JpxImage_parse(data) {
  11370. var head = (0, _core_utils.readUint16)(data, 0);
  11371. if (head === 0xff4f) {
  11372. this.parseCodestream(data, 0, data.length);
  11373. return;
  11374. }
  11375. var position = 0,
  11376. length = data.length;
  11377. while (position < length) {
  11378. var headerSize = 8;
  11379. var lbox = (0, _core_utils.readUint32)(data, position);
  11380. var tbox = (0, _core_utils.readUint32)(data, position + 4);
  11381. position += headerSize;
  11382. if (lbox === 1) {
  11383. lbox = (0, _core_utils.readUint32)(data, position) * 4294967296 + (0, _core_utils.readUint32)(data, position + 4);
  11384. position += 8;
  11385. headerSize += 8;
  11386. }
  11387. if (lbox === 0) {
  11388. lbox = length - position + headerSize;
  11389. }
  11390. if (lbox < headerSize) {
  11391. throw new JpxError("Invalid box field size");
  11392. }
  11393. var dataLength = lbox - headerSize;
  11394. var jumpDataLength = true;
  11395. switch (tbox) {
  11396. case 0x6a703268:
  11397. jumpDataLength = false;
  11398. break;
  11399. case 0x636f6c72:
  11400. var method = data[position];
  11401. if (method === 1) {
  11402. var colorspace = (0, _core_utils.readUint32)(data, position + 3);
  11403. switch (colorspace) {
  11404. case 16:
  11405. case 17:
  11406. case 18:
  11407. break;
  11408. default:
  11409. (0, _util.warn)("Unknown colorspace " + colorspace);
  11410. break;
  11411. }
  11412. } else if (method === 2) {
  11413. (0, _util.info)("ICC profile not supported");
  11414. }
  11415. break;
  11416. case 0x6a703263:
  11417. this.parseCodestream(data, position, position + dataLength);
  11418. break;
  11419. case 0x6a502020:
  11420. if ((0, _core_utils.readUint32)(data, position) !== 0x0d0a870a) {
  11421. (0, _util.warn)("Invalid JP2 signature");
  11422. }
  11423. break;
  11424. case 0x6a501a1a:
  11425. case 0x66747970:
  11426. case 0x72726571:
  11427. case 0x72657320:
  11428. case 0x69686472:
  11429. break;
  11430. default:
  11431. var headerType = String.fromCharCode(tbox >> 24 & 0xff, tbox >> 16 & 0xff, tbox >> 8 & 0xff, tbox & 0xff);
  11432. (0, _util.warn)("Unsupported header type " + tbox + " (" + headerType + ")");
  11433. break;
  11434. }
  11435. if (jumpDataLength) {
  11436. position += dataLength;
  11437. }
  11438. }
  11439. },
  11440. parseImageProperties: function JpxImage_parseImageProperties(stream) {
  11441. var newByte = stream.getByte();
  11442. while (newByte >= 0) {
  11443. var oldByte = newByte;
  11444. newByte = stream.getByte();
  11445. var code = oldByte << 8 | newByte;
  11446. if (code === 0xff51) {
  11447. stream.skip(4);
  11448. var Xsiz = stream.getInt32() >>> 0;
  11449. var Ysiz = stream.getInt32() >>> 0;
  11450. var XOsiz = stream.getInt32() >>> 0;
  11451. var YOsiz = stream.getInt32() >>> 0;
  11452. stream.skip(16);
  11453. var Csiz = stream.getUint16();
  11454. this.width = Xsiz - XOsiz;
  11455. this.height = Ysiz - YOsiz;
  11456. this.componentsCount = Csiz;
  11457. this.bitsPerComponent = 8;
  11458. return;
  11459. }
  11460. }
  11461. throw new JpxError("No size marker found in JPX stream");
  11462. },
  11463. parseCodestream: function JpxImage_parseCodestream(data, start, end) {
  11464. var context = {};
  11465. var doNotRecover = false;
  11466. try {
  11467. var position = start;
  11468. while (position + 1 < end) {
  11469. var code = (0, _core_utils.readUint16)(data, position);
  11470. position += 2;
  11471. var length = 0,
  11472. j,
  11473. sqcd,
  11474. spqcds,
  11475. spqcdSize,
  11476. scalarExpounded,
  11477. tile;
  11478. switch (code) {
  11479. case 0xff4f:
  11480. context.mainHeader = true;
  11481. break;
  11482. case 0xffd9:
  11483. break;
  11484. case 0xff51:
  11485. length = (0, _core_utils.readUint16)(data, position);
  11486. var siz = {};
  11487. siz.Xsiz = (0, _core_utils.readUint32)(data, position + 4);
  11488. siz.Ysiz = (0, _core_utils.readUint32)(data, position + 8);
  11489. siz.XOsiz = (0, _core_utils.readUint32)(data, position + 12);
  11490. siz.YOsiz = (0, _core_utils.readUint32)(data, position + 16);
  11491. siz.XTsiz = (0, _core_utils.readUint32)(data, position + 20);
  11492. siz.YTsiz = (0, _core_utils.readUint32)(data, position + 24);
  11493. siz.XTOsiz = (0, _core_utils.readUint32)(data, position + 28);
  11494. siz.YTOsiz = (0, _core_utils.readUint32)(data, position + 32);
  11495. var componentsCount = (0, _core_utils.readUint16)(data, position + 36);
  11496. siz.Csiz = componentsCount;
  11497. var components = [];
  11498. j = position + 38;
  11499. for (var i = 0; i < componentsCount; i++) {
  11500. var component = {
  11501. precision: (data[j] & 0x7f) + 1,
  11502. isSigned: !!(data[j] & 0x80),
  11503. XRsiz: data[j + 1],
  11504. YRsiz: data[j + 2]
  11505. };
  11506. j += 3;
  11507. calculateComponentDimensions(component, siz);
  11508. components.push(component);
  11509. }
  11510. context.SIZ = siz;
  11511. context.components = components;
  11512. calculateTileGrids(context, components);
  11513. context.QCC = [];
  11514. context.COC = [];
  11515. break;
  11516. case 0xff5c:
  11517. length = (0, _core_utils.readUint16)(data, position);
  11518. var qcd = {};
  11519. j = position + 2;
  11520. sqcd = data[j++];
  11521. switch (sqcd & 0x1f) {
  11522. case 0:
  11523. spqcdSize = 8;
  11524. scalarExpounded = true;
  11525. break;
  11526. case 1:
  11527. spqcdSize = 16;
  11528. scalarExpounded = false;
  11529. break;
  11530. case 2:
  11531. spqcdSize = 16;
  11532. scalarExpounded = true;
  11533. break;
  11534. default:
  11535. throw new Error("Invalid SQcd value " + sqcd);
  11536. }
  11537. qcd.noQuantization = spqcdSize === 8;
  11538. qcd.scalarExpounded = scalarExpounded;
  11539. qcd.guardBits = sqcd >> 5;
  11540. spqcds = [];
  11541. while (j < length + position) {
  11542. var spqcd = {};
  11543. if (spqcdSize === 8) {
  11544. spqcd.epsilon = data[j++] >> 3;
  11545. spqcd.mu = 0;
  11546. } else {
  11547. spqcd.epsilon = data[j] >> 3;
  11548. spqcd.mu = (data[j] & 0x7) << 8 | data[j + 1];
  11549. j += 2;
  11550. }
  11551. spqcds.push(spqcd);
  11552. }
  11553. qcd.SPqcds = spqcds;
  11554. if (context.mainHeader) {
  11555. context.QCD = qcd;
  11556. } else {
  11557. context.currentTile.QCD = qcd;
  11558. context.currentTile.QCC = [];
  11559. }
  11560. break;
  11561. case 0xff5d:
  11562. length = (0, _core_utils.readUint16)(data, position);
  11563. var qcc = {};
  11564. j = position + 2;
  11565. var cqcc;
  11566. if (context.SIZ.Csiz < 257) {
  11567. cqcc = data[j++];
  11568. } else {
  11569. cqcc = (0, _core_utils.readUint16)(data, j);
  11570. j += 2;
  11571. }
  11572. sqcd = data[j++];
  11573. switch (sqcd & 0x1f) {
  11574. case 0:
  11575. spqcdSize = 8;
  11576. scalarExpounded = true;
  11577. break;
  11578. case 1:
  11579. spqcdSize = 16;
  11580. scalarExpounded = false;
  11581. break;
  11582. case 2:
  11583. spqcdSize = 16;
  11584. scalarExpounded = true;
  11585. break;
  11586. default:
  11587. throw new Error("Invalid SQcd value " + sqcd);
  11588. }
  11589. qcc.noQuantization = spqcdSize === 8;
  11590. qcc.scalarExpounded = scalarExpounded;
  11591. qcc.guardBits = sqcd >> 5;
  11592. spqcds = [];
  11593. while (j < length + position) {
  11594. spqcd = {};
  11595. if (spqcdSize === 8) {
  11596. spqcd.epsilon = data[j++] >> 3;
  11597. spqcd.mu = 0;
  11598. } else {
  11599. spqcd.epsilon = data[j] >> 3;
  11600. spqcd.mu = (data[j] & 0x7) << 8 | data[j + 1];
  11601. j += 2;
  11602. }
  11603. spqcds.push(spqcd);
  11604. }
  11605. qcc.SPqcds = spqcds;
  11606. if (context.mainHeader) {
  11607. context.QCC[cqcc] = qcc;
  11608. } else {
  11609. context.currentTile.QCC[cqcc] = qcc;
  11610. }
  11611. break;
  11612. case 0xff52:
  11613. length = (0, _core_utils.readUint16)(data, position);
  11614. var cod = {};
  11615. j = position + 2;
  11616. var scod = data[j++];
  11617. cod.entropyCoderWithCustomPrecincts = !!(scod & 1);
  11618. cod.sopMarkerUsed = !!(scod & 2);
  11619. cod.ephMarkerUsed = !!(scod & 4);
  11620. cod.progressionOrder = data[j++];
  11621. cod.layersCount = (0, _core_utils.readUint16)(data, j);
  11622. j += 2;
  11623. cod.multipleComponentTransform = data[j++];
  11624. cod.decompositionLevelsCount = data[j++];
  11625. cod.xcb = (data[j++] & 0xf) + 2;
  11626. cod.ycb = (data[j++] & 0xf) + 2;
  11627. var blockStyle = data[j++];
  11628. cod.selectiveArithmeticCodingBypass = !!(blockStyle & 1);
  11629. cod.resetContextProbabilities = !!(blockStyle & 2);
  11630. cod.terminationOnEachCodingPass = !!(blockStyle & 4);
  11631. cod.verticallyStripe = !!(blockStyle & 8);
  11632. cod.predictableTermination = !!(blockStyle & 16);
  11633. cod.segmentationSymbolUsed = !!(blockStyle & 32);
  11634. cod.reversibleTransformation = data[j++];
  11635. if (cod.entropyCoderWithCustomPrecincts) {
  11636. var precinctsSizes = [];
  11637. while (j < length + position) {
  11638. var precinctsSize = data[j++];
  11639. precinctsSizes.push({
  11640. PPx: precinctsSize & 0xf,
  11641. PPy: precinctsSize >> 4
  11642. });
  11643. }
  11644. cod.precinctsSizes = precinctsSizes;
  11645. }
  11646. var unsupported = [];
  11647. if (cod.selectiveArithmeticCodingBypass) {
  11648. unsupported.push("selectiveArithmeticCodingBypass");
  11649. }
  11650. if (cod.resetContextProbabilities) {
  11651. unsupported.push("resetContextProbabilities");
  11652. }
  11653. if (cod.terminationOnEachCodingPass) {
  11654. unsupported.push("terminationOnEachCodingPass");
  11655. }
  11656. if (cod.verticallyStripe) {
  11657. unsupported.push("verticallyStripe");
  11658. }
  11659. if (cod.predictableTermination) {
  11660. unsupported.push("predictableTermination");
  11661. }
  11662. if (unsupported.length > 0) {
  11663. doNotRecover = true;
  11664. (0, _util.warn)(`JPX: Unsupported COD options (${unsupported.join(", ")}).`);
  11665. }
  11666. if (context.mainHeader) {
  11667. context.COD = cod;
  11668. } else {
  11669. context.currentTile.COD = cod;
  11670. context.currentTile.COC = [];
  11671. }
  11672. break;
  11673. case 0xff90:
  11674. length = (0, _core_utils.readUint16)(data, position);
  11675. tile = {};
  11676. tile.index = (0, _core_utils.readUint16)(data, position + 2);
  11677. tile.length = (0, _core_utils.readUint32)(data, position + 4);
  11678. tile.dataEnd = tile.length + position - 2;
  11679. tile.partIndex = data[position + 8];
  11680. tile.partsCount = data[position + 9];
  11681. context.mainHeader = false;
  11682. if (tile.partIndex === 0) {
  11683. tile.COD = context.COD;
  11684. tile.COC = context.COC.slice(0);
  11685. tile.QCD = context.QCD;
  11686. tile.QCC = context.QCC.slice(0);
  11687. }
  11688. context.currentTile = tile;
  11689. break;
  11690. case 0xff93:
  11691. tile = context.currentTile;
  11692. if (tile.partIndex === 0) {
  11693. initializeTile(context, tile.index);
  11694. buildPackets(context);
  11695. }
  11696. length = tile.dataEnd - position;
  11697. parseTilePackets(context, data, position, length);
  11698. break;
  11699. case 0xff53:
  11700. (0, _util.warn)("JPX: Codestream code 0xFF53 (COC) is not implemented.");
  11701. case 0xff55:
  11702. case 0xff57:
  11703. case 0xff58:
  11704. case 0xff64:
  11705. length = (0, _core_utils.readUint16)(data, position);
  11706. break;
  11707. default:
  11708. throw new Error("Unknown codestream code: " + code.toString(16));
  11709. }
  11710. position += length;
  11711. }
  11712. } catch (e) {
  11713. if (doNotRecover || this.failOnCorruptedImage) {
  11714. throw new JpxError(e.message);
  11715. } else {
  11716. (0, _util.warn)(`JPX: Trying to recover from: "${e.message}".`);
  11717. }
  11718. }
  11719. this.tiles = transformComponents(context);
  11720. this.width = context.SIZ.Xsiz - context.SIZ.XOsiz;
  11721. this.height = context.SIZ.Ysiz - context.SIZ.YOsiz;
  11722. this.componentsCount = context.SIZ.Csiz;
  11723. }
  11724. };
  11725. function calculateComponentDimensions(component, siz) {
  11726. component.x0 = Math.ceil(siz.XOsiz / component.XRsiz);
  11727. component.x1 = Math.ceil(siz.Xsiz / component.XRsiz);
  11728. component.y0 = Math.ceil(siz.YOsiz / component.YRsiz);
  11729. component.y1 = Math.ceil(siz.Ysiz / component.YRsiz);
  11730. component.width = component.x1 - component.x0;
  11731. component.height = component.y1 - component.y0;
  11732. }
  11733. function calculateTileGrids(context, components) {
  11734. var siz = context.SIZ;
  11735. var tile,
  11736. tiles = [];
  11737. var numXtiles = Math.ceil((siz.Xsiz - siz.XTOsiz) / siz.XTsiz);
  11738. var numYtiles = Math.ceil((siz.Ysiz - siz.YTOsiz) / siz.YTsiz);
  11739. for (var q = 0; q < numYtiles; q++) {
  11740. for (var p = 0; p < numXtiles; p++) {
  11741. tile = {};
  11742. tile.tx0 = Math.max(siz.XTOsiz + p * siz.XTsiz, siz.XOsiz);
  11743. tile.ty0 = Math.max(siz.YTOsiz + q * siz.YTsiz, siz.YOsiz);
  11744. tile.tx1 = Math.min(siz.XTOsiz + (p + 1) * siz.XTsiz, siz.Xsiz);
  11745. tile.ty1 = Math.min(siz.YTOsiz + (q + 1) * siz.YTsiz, siz.Ysiz);
  11746. tile.width = tile.tx1 - tile.tx0;
  11747. tile.height = tile.ty1 - tile.ty0;
  11748. tile.components = [];
  11749. tiles.push(tile);
  11750. }
  11751. }
  11752. context.tiles = tiles;
  11753. var componentsCount = siz.Csiz;
  11754. for (var i = 0, ii = componentsCount; i < ii; i++) {
  11755. var component = components[i];
  11756. for (var j = 0, jj = tiles.length; j < jj; j++) {
  11757. var tileComponent = {};
  11758. tile = tiles[j];
  11759. tileComponent.tcx0 = Math.ceil(tile.tx0 / component.XRsiz);
  11760. tileComponent.tcy0 = Math.ceil(tile.ty0 / component.YRsiz);
  11761. tileComponent.tcx1 = Math.ceil(tile.tx1 / component.XRsiz);
  11762. tileComponent.tcy1 = Math.ceil(tile.ty1 / component.YRsiz);
  11763. tileComponent.width = tileComponent.tcx1 - tileComponent.tcx0;
  11764. tileComponent.height = tileComponent.tcy1 - tileComponent.tcy0;
  11765. tile.components[i] = tileComponent;
  11766. }
  11767. }
  11768. }
  11769. function getBlocksDimensions(context, component, r) {
  11770. var codOrCoc = component.codingStyleParameters;
  11771. var result = {};
  11772. if (!codOrCoc.entropyCoderWithCustomPrecincts) {
  11773. result.PPx = 15;
  11774. result.PPy = 15;
  11775. } else {
  11776. result.PPx = codOrCoc.precinctsSizes[r].PPx;
  11777. result.PPy = codOrCoc.precinctsSizes[r].PPy;
  11778. }
  11779. result.xcb_ = r > 0 ? Math.min(codOrCoc.xcb, result.PPx - 1) : Math.min(codOrCoc.xcb, result.PPx);
  11780. result.ycb_ = r > 0 ? Math.min(codOrCoc.ycb, result.PPy - 1) : Math.min(codOrCoc.ycb, result.PPy);
  11781. return result;
  11782. }
  11783. function buildPrecincts(context, resolution, dimensions) {
  11784. var precinctWidth = 1 << dimensions.PPx;
  11785. var precinctHeight = 1 << dimensions.PPy;
  11786. var isZeroRes = resolution.resLevel === 0;
  11787. var precinctWidthInSubband = 1 << dimensions.PPx + (isZeroRes ? 0 : -1);
  11788. var precinctHeightInSubband = 1 << dimensions.PPy + (isZeroRes ? 0 : -1);
  11789. var numprecinctswide = resolution.trx1 > resolution.trx0 ? Math.ceil(resolution.trx1 / precinctWidth) - Math.floor(resolution.trx0 / precinctWidth) : 0;
  11790. var numprecinctshigh = resolution.try1 > resolution.try0 ? Math.ceil(resolution.try1 / precinctHeight) - Math.floor(resolution.try0 / precinctHeight) : 0;
  11791. var numprecincts = numprecinctswide * numprecinctshigh;
  11792. resolution.precinctParameters = {
  11793. precinctWidth,
  11794. precinctHeight,
  11795. numprecinctswide,
  11796. numprecinctshigh,
  11797. numprecincts,
  11798. precinctWidthInSubband,
  11799. precinctHeightInSubband
  11800. };
  11801. }
  11802. function buildCodeblocks(context, subband, dimensions) {
  11803. var xcb_ = dimensions.xcb_;
  11804. var ycb_ = dimensions.ycb_;
  11805. var codeblockWidth = 1 << xcb_;
  11806. var codeblockHeight = 1 << ycb_;
  11807. var cbx0 = subband.tbx0 >> xcb_;
  11808. var cby0 = subband.tby0 >> ycb_;
  11809. var cbx1 = subband.tbx1 + codeblockWidth - 1 >> xcb_;
  11810. var cby1 = subband.tby1 + codeblockHeight - 1 >> ycb_;
  11811. var precinctParameters = subband.resolution.precinctParameters;
  11812. var codeblocks = [];
  11813. var precincts = [];
  11814. var i, j, codeblock, precinctNumber;
  11815. for (j = cby0; j < cby1; j++) {
  11816. for (i = cbx0; i < cbx1; i++) {
  11817. codeblock = {
  11818. cbx: i,
  11819. cby: j,
  11820. tbx0: codeblockWidth * i,
  11821. tby0: codeblockHeight * j,
  11822. tbx1: codeblockWidth * (i + 1),
  11823. tby1: codeblockHeight * (j + 1)
  11824. };
  11825. codeblock.tbx0_ = Math.max(subband.tbx0, codeblock.tbx0);
  11826. codeblock.tby0_ = Math.max(subband.tby0, codeblock.tby0);
  11827. codeblock.tbx1_ = Math.min(subband.tbx1, codeblock.tbx1);
  11828. codeblock.tby1_ = Math.min(subband.tby1, codeblock.tby1);
  11829. var pi = Math.floor((codeblock.tbx0_ - subband.tbx0) / precinctParameters.precinctWidthInSubband);
  11830. var pj = Math.floor((codeblock.tby0_ - subband.tby0) / precinctParameters.precinctHeightInSubband);
  11831. precinctNumber = pi + pj * precinctParameters.numprecinctswide;
  11832. codeblock.precinctNumber = precinctNumber;
  11833. codeblock.subbandType = subband.type;
  11834. codeblock.Lblock = 3;
  11835. if (codeblock.tbx1_ <= codeblock.tbx0_ || codeblock.tby1_ <= codeblock.tby0_) {
  11836. continue;
  11837. }
  11838. codeblocks.push(codeblock);
  11839. var precinct = precincts[precinctNumber];
  11840. if (precinct !== undefined) {
  11841. if (i < precinct.cbxMin) {
  11842. precinct.cbxMin = i;
  11843. } else if (i > precinct.cbxMax) {
  11844. precinct.cbxMax = i;
  11845. }
  11846. if (j < precinct.cbyMin) {
  11847. precinct.cbxMin = j;
  11848. } else if (j > precinct.cbyMax) {
  11849. precinct.cbyMax = j;
  11850. }
  11851. } else {
  11852. precincts[precinctNumber] = precinct = {
  11853. cbxMin: i,
  11854. cbyMin: j,
  11855. cbxMax: i,
  11856. cbyMax: j
  11857. };
  11858. }
  11859. codeblock.precinct = precinct;
  11860. }
  11861. }
  11862. subband.codeblockParameters = {
  11863. codeblockWidth: xcb_,
  11864. codeblockHeight: ycb_,
  11865. numcodeblockwide: cbx1 - cbx0 + 1,
  11866. numcodeblockhigh: cby1 - cby0 + 1
  11867. };
  11868. subband.codeblocks = codeblocks;
  11869. subband.precincts = precincts;
  11870. }
  11871. function createPacket(resolution, precinctNumber, layerNumber) {
  11872. var precinctCodeblocks = [];
  11873. var subbands = resolution.subbands;
  11874. for (var i = 0, ii = subbands.length; i < ii; i++) {
  11875. var subband = subbands[i];
  11876. var codeblocks = subband.codeblocks;
  11877. for (var j = 0, jj = codeblocks.length; j < jj; j++) {
  11878. var codeblock = codeblocks[j];
  11879. if (codeblock.precinctNumber !== precinctNumber) {
  11880. continue;
  11881. }
  11882. precinctCodeblocks.push(codeblock);
  11883. }
  11884. }
  11885. return {
  11886. layerNumber,
  11887. codeblocks: precinctCodeblocks
  11888. };
  11889. }
  11890. function LayerResolutionComponentPositionIterator(context) {
  11891. var siz = context.SIZ;
  11892. var tileIndex = context.currentTile.index;
  11893. var tile = context.tiles[tileIndex];
  11894. var layersCount = tile.codingStyleDefaultParameters.layersCount;
  11895. var componentsCount = siz.Csiz;
  11896. var maxDecompositionLevelsCount = 0;
  11897. for (var q = 0; q < componentsCount; q++) {
  11898. maxDecompositionLevelsCount = Math.max(maxDecompositionLevelsCount, tile.components[q].codingStyleParameters.decompositionLevelsCount);
  11899. }
  11900. var l = 0,
  11901. r = 0,
  11902. i = 0,
  11903. k = 0;
  11904. this.nextPacket = function JpxImage_nextPacket() {
  11905. for (; l < layersCount; l++) {
  11906. for (; r <= maxDecompositionLevelsCount; r++) {
  11907. for (; i < componentsCount; i++) {
  11908. var component = tile.components[i];
  11909. if (r > component.codingStyleParameters.decompositionLevelsCount) {
  11910. continue;
  11911. }
  11912. var resolution = component.resolutions[r];
  11913. var numprecincts = resolution.precinctParameters.numprecincts;
  11914. for (; k < numprecincts;) {
  11915. var packet = createPacket(resolution, k, l);
  11916. k++;
  11917. return packet;
  11918. }
  11919. k = 0;
  11920. }
  11921. i = 0;
  11922. }
  11923. r = 0;
  11924. }
  11925. throw new JpxError("Out of packets");
  11926. };
  11927. }
  11928. function ResolutionLayerComponentPositionIterator(context) {
  11929. var siz = context.SIZ;
  11930. var tileIndex = context.currentTile.index;
  11931. var tile = context.tiles[tileIndex];
  11932. var layersCount = tile.codingStyleDefaultParameters.layersCount;
  11933. var componentsCount = siz.Csiz;
  11934. var maxDecompositionLevelsCount = 0;
  11935. for (var q = 0; q < componentsCount; q++) {
  11936. maxDecompositionLevelsCount = Math.max(maxDecompositionLevelsCount, tile.components[q].codingStyleParameters.decompositionLevelsCount);
  11937. }
  11938. var r = 0,
  11939. l = 0,
  11940. i = 0,
  11941. k = 0;
  11942. this.nextPacket = function JpxImage_nextPacket() {
  11943. for (; r <= maxDecompositionLevelsCount; r++) {
  11944. for (; l < layersCount; l++) {
  11945. for (; i < componentsCount; i++) {
  11946. var component = tile.components[i];
  11947. if (r > component.codingStyleParameters.decompositionLevelsCount) {
  11948. continue;
  11949. }
  11950. var resolution = component.resolutions[r];
  11951. var numprecincts = resolution.precinctParameters.numprecincts;
  11952. for (; k < numprecincts;) {
  11953. var packet = createPacket(resolution, k, l);
  11954. k++;
  11955. return packet;
  11956. }
  11957. k = 0;
  11958. }
  11959. i = 0;
  11960. }
  11961. l = 0;
  11962. }
  11963. throw new JpxError("Out of packets");
  11964. };
  11965. }
  11966. function ResolutionPositionComponentLayerIterator(context) {
  11967. var siz = context.SIZ;
  11968. var tileIndex = context.currentTile.index;
  11969. var tile = context.tiles[tileIndex];
  11970. var layersCount = tile.codingStyleDefaultParameters.layersCount;
  11971. var componentsCount = siz.Csiz;
  11972. var l, r, c, p;
  11973. var maxDecompositionLevelsCount = 0;
  11974. for (c = 0; c < componentsCount; c++) {
  11975. const component = tile.components[c];
  11976. maxDecompositionLevelsCount = Math.max(maxDecompositionLevelsCount, component.codingStyleParameters.decompositionLevelsCount);
  11977. }
  11978. var maxNumPrecinctsInLevel = new Int32Array(maxDecompositionLevelsCount + 1);
  11979. for (r = 0; r <= maxDecompositionLevelsCount; ++r) {
  11980. var maxNumPrecincts = 0;
  11981. for (c = 0; c < componentsCount; ++c) {
  11982. var resolutions = tile.components[c].resolutions;
  11983. if (r < resolutions.length) {
  11984. maxNumPrecincts = Math.max(maxNumPrecincts, resolutions[r].precinctParameters.numprecincts);
  11985. }
  11986. }
  11987. maxNumPrecinctsInLevel[r] = maxNumPrecincts;
  11988. }
  11989. l = 0;
  11990. r = 0;
  11991. c = 0;
  11992. p = 0;
  11993. this.nextPacket = function JpxImage_nextPacket() {
  11994. for (; r <= maxDecompositionLevelsCount; r++) {
  11995. for (; p < maxNumPrecinctsInLevel[r]; p++) {
  11996. for (; c < componentsCount; c++) {
  11997. const component = tile.components[c];
  11998. if (r > component.codingStyleParameters.decompositionLevelsCount) {
  11999. continue;
  12000. }
  12001. var resolution = component.resolutions[r];
  12002. var numprecincts = resolution.precinctParameters.numprecincts;
  12003. if (p >= numprecincts) {
  12004. continue;
  12005. }
  12006. for (; l < layersCount;) {
  12007. var packet = createPacket(resolution, p, l);
  12008. l++;
  12009. return packet;
  12010. }
  12011. l = 0;
  12012. }
  12013. c = 0;
  12014. }
  12015. p = 0;
  12016. }
  12017. throw new JpxError("Out of packets");
  12018. };
  12019. }
  12020. function PositionComponentResolutionLayerIterator(context) {
  12021. var siz = context.SIZ;
  12022. var tileIndex = context.currentTile.index;
  12023. var tile = context.tiles[tileIndex];
  12024. var layersCount = tile.codingStyleDefaultParameters.layersCount;
  12025. var componentsCount = siz.Csiz;
  12026. var precinctsSizes = getPrecinctSizesInImageScale(tile);
  12027. var precinctsIterationSizes = precinctsSizes;
  12028. var l = 0,
  12029. r = 0,
  12030. c = 0,
  12031. px = 0,
  12032. py = 0;
  12033. this.nextPacket = function JpxImage_nextPacket() {
  12034. for (; py < precinctsIterationSizes.maxNumHigh; py++) {
  12035. for (; px < precinctsIterationSizes.maxNumWide; px++) {
  12036. for (; c < componentsCount; c++) {
  12037. var component = tile.components[c];
  12038. var decompositionLevelsCount = component.codingStyleParameters.decompositionLevelsCount;
  12039. for (; r <= decompositionLevelsCount; r++) {
  12040. var resolution = component.resolutions[r];
  12041. var sizeInImageScale = precinctsSizes.components[c].resolutions[r];
  12042. var k = getPrecinctIndexIfExist(px, py, sizeInImageScale, precinctsIterationSizes, resolution);
  12043. if (k === null) {
  12044. continue;
  12045. }
  12046. for (; l < layersCount;) {
  12047. var packet = createPacket(resolution, k, l);
  12048. l++;
  12049. return packet;
  12050. }
  12051. l = 0;
  12052. }
  12053. r = 0;
  12054. }
  12055. c = 0;
  12056. }
  12057. px = 0;
  12058. }
  12059. throw new JpxError("Out of packets");
  12060. };
  12061. }
  12062. function ComponentPositionResolutionLayerIterator(context) {
  12063. var siz = context.SIZ;
  12064. var tileIndex = context.currentTile.index;
  12065. var tile = context.tiles[tileIndex];
  12066. var layersCount = tile.codingStyleDefaultParameters.layersCount;
  12067. var componentsCount = siz.Csiz;
  12068. var precinctsSizes = getPrecinctSizesInImageScale(tile);
  12069. var l = 0,
  12070. r = 0,
  12071. c = 0,
  12072. px = 0,
  12073. py = 0;
  12074. this.nextPacket = function JpxImage_nextPacket() {
  12075. for (; c < componentsCount; ++c) {
  12076. var component = tile.components[c];
  12077. var precinctsIterationSizes = precinctsSizes.components[c];
  12078. var decompositionLevelsCount = component.codingStyleParameters.decompositionLevelsCount;
  12079. for (; py < precinctsIterationSizes.maxNumHigh; py++) {
  12080. for (; px < precinctsIterationSizes.maxNumWide; px++) {
  12081. for (; r <= decompositionLevelsCount; r++) {
  12082. var resolution = component.resolutions[r];
  12083. var sizeInImageScale = precinctsIterationSizes.resolutions[r];
  12084. var k = getPrecinctIndexIfExist(px, py, sizeInImageScale, precinctsIterationSizes, resolution);
  12085. if (k === null) {
  12086. continue;
  12087. }
  12088. for (; l < layersCount;) {
  12089. var packet = createPacket(resolution, k, l);
  12090. l++;
  12091. return packet;
  12092. }
  12093. l = 0;
  12094. }
  12095. r = 0;
  12096. }
  12097. px = 0;
  12098. }
  12099. py = 0;
  12100. }
  12101. throw new JpxError("Out of packets");
  12102. };
  12103. }
  12104. function getPrecinctIndexIfExist(pxIndex, pyIndex, sizeInImageScale, precinctIterationSizes, resolution) {
  12105. var posX = pxIndex * precinctIterationSizes.minWidth;
  12106. var posY = pyIndex * precinctIterationSizes.minHeight;
  12107. if (posX % sizeInImageScale.width !== 0 || posY % sizeInImageScale.height !== 0) {
  12108. return null;
  12109. }
  12110. var startPrecinctRowIndex = posY / sizeInImageScale.width * resolution.precinctParameters.numprecinctswide;
  12111. return posX / sizeInImageScale.height + startPrecinctRowIndex;
  12112. }
  12113. function getPrecinctSizesInImageScale(tile) {
  12114. var componentsCount = tile.components.length;
  12115. var minWidth = Number.MAX_VALUE;
  12116. var minHeight = Number.MAX_VALUE;
  12117. var maxNumWide = 0;
  12118. var maxNumHigh = 0;
  12119. var sizePerComponent = new Array(componentsCount);
  12120. for (var c = 0; c < componentsCount; c++) {
  12121. var component = tile.components[c];
  12122. var decompositionLevelsCount = component.codingStyleParameters.decompositionLevelsCount;
  12123. var sizePerResolution = new Array(decompositionLevelsCount + 1);
  12124. var minWidthCurrentComponent = Number.MAX_VALUE;
  12125. var minHeightCurrentComponent = Number.MAX_VALUE;
  12126. var maxNumWideCurrentComponent = 0;
  12127. var maxNumHighCurrentComponent = 0;
  12128. var scale = 1;
  12129. for (var r = decompositionLevelsCount; r >= 0; --r) {
  12130. var resolution = component.resolutions[r];
  12131. var widthCurrentResolution = scale * resolution.precinctParameters.precinctWidth;
  12132. var heightCurrentResolution = scale * resolution.precinctParameters.precinctHeight;
  12133. minWidthCurrentComponent = Math.min(minWidthCurrentComponent, widthCurrentResolution);
  12134. minHeightCurrentComponent = Math.min(minHeightCurrentComponent, heightCurrentResolution);
  12135. maxNumWideCurrentComponent = Math.max(maxNumWideCurrentComponent, resolution.precinctParameters.numprecinctswide);
  12136. maxNumHighCurrentComponent = Math.max(maxNumHighCurrentComponent, resolution.precinctParameters.numprecinctshigh);
  12137. sizePerResolution[r] = {
  12138. width: widthCurrentResolution,
  12139. height: heightCurrentResolution
  12140. };
  12141. scale <<= 1;
  12142. }
  12143. minWidth = Math.min(minWidth, minWidthCurrentComponent);
  12144. minHeight = Math.min(minHeight, minHeightCurrentComponent);
  12145. maxNumWide = Math.max(maxNumWide, maxNumWideCurrentComponent);
  12146. maxNumHigh = Math.max(maxNumHigh, maxNumHighCurrentComponent);
  12147. sizePerComponent[c] = {
  12148. resolutions: sizePerResolution,
  12149. minWidth: minWidthCurrentComponent,
  12150. minHeight: minHeightCurrentComponent,
  12151. maxNumWide: maxNumWideCurrentComponent,
  12152. maxNumHigh: maxNumHighCurrentComponent
  12153. };
  12154. }
  12155. return {
  12156. components: sizePerComponent,
  12157. minWidth,
  12158. minHeight,
  12159. maxNumWide,
  12160. maxNumHigh
  12161. };
  12162. }
  12163. function buildPackets(context) {
  12164. var siz = context.SIZ;
  12165. var tileIndex = context.currentTile.index;
  12166. var tile = context.tiles[tileIndex];
  12167. var componentsCount = siz.Csiz;
  12168. for (var c = 0; c < componentsCount; c++) {
  12169. var component = tile.components[c];
  12170. var decompositionLevelsCount = component.codingStyleParameters.decompositionLevelsCount;
  12171. var resolutions = [];
  12172. var subbands = [];
  12173. for (var r = 0; r <= decompositionLevelsCount; r++) {
  12174. var blocksDimensions = getBlocksDimensions(context, component, r);
  12175. var resolution = {};
  12176. var scale = 1 << decompositionLevelsCount - r;
  12177. resolution.trx0 = Math.ceil(component.tcx0 / scale);
  12178. resolution.try0 = Math.ceil(component.tcy0 / scale);
  12179. resolution.trx1 = Math.ceil(component.tcx1 / scale);
  12180. resolution.try1 = Math.ceil(component.tcy1 / scale);
  12181. resolution.resLevel = r;
  12182. buildPrecincts(context, resolution, blocksDimensions);
  12183. resolutions.push(resolution);
  12184. var subband;
  12185. if (r === 0) {
  12186. subband = {};
  12187. subband.type = "LL";
  12188. subband.tbx0 = Math.ceil(component.tcx0 / scale);
  12189. subband.tby0 = Math.ceil(component.tcy0 / scale);
  12190. subband.tbx1 = Math.ceil(component.tcx1 / scale);
  12191. subband.tby1 = Math.ceil(component.tcy1 / scale);
  12192. subband.resolution = resolution;
  12193. buildCodeblocks(context, subband, blocksDimensions);
  12194. subbands.push(subband);
  12195. resolution.subbands = [subband];
  12196. } else {
  12197. var bscale = 1 << decompositionLevelsCount - r + 1;
  12198. var resolutionSubbands = [];
  12199. subband = {};
  12200. subband.type = "HL";
  12201. subband.tbx0 = Math.ceil(component.tcx0 / bscale - 0.5);
  12202. subband.tby0 = Math.ceil(component.tcy0 / bscale);
  12203. subband.tbx1 = Math.ceil(component.tcx1 / bscale - 0.5);
  12204. subband.tby1 = Math.ceil(component.tcy1 / bscale);
  12205. subband.resolution = resolution;
  12206. buildCodeblocks(context, subband, blocksDimensions);
  12207. subbands.push(subband);
  12208. resolutionSubbands.push(subband);
  12209. subband = {};
  12210. subband.type = "LH";
  12211. subband.tbx0 = Math.ceil(component.tcx0 / bscale);
  12212. subband.tby0 = Math.ceil(component.tcy0 / bscale - 0.5);
  12213. subband.tbx1 = Math.ceil(component.tcx1 / bscale);
  12214. subband.tby1 = Math.ceil(component.tcy1 / bscale - 0.5);
  12215. subband.resolution = resolution;
  12216. buildCodeblocks(context, subband, blocksDimensions);
  12217. subbands.push(subband);
  12218. resolutionSubbands.push(subband);
  12219. subband = {};
  12220. subband.type = "HH";
  12221. subband.tbx0 = Math.ceil(component.tcx0 / bscale - 0.5);
  12222. subband.tby0 = Math.ceil(component.tcy0 / bscale - 0.5);
  12223. subband.tbx1 = Math.ceil(component.tcx1 / bscale - 0.5);
  12224. subband.tby1 = Math.ceil(component.tcy1 / bscale - 0.5);
  12225. subband.resolution = resolution;
  12226. buildCodeblocks(context, subband, blocksDimensions);
  12227. subbands.push(subband);
  12228. resolutionSubbands.push(subband);
  12229. resolution.subbands = resolutionSubbands;
  12230. }
  12231. }
  12232. component.resolutions = resolutions;
  12233. component.subbands = subbands;
  12234. }
  12235. var progressionOrder = tile.codingStyleDefaultParameters.progressionOrder;
  12236. switch (progressionOrder) {
  12237. case 0:
  12238. tile.packetsIterator = new LayerResolutionComponentPositionIterator(context);
  12239. break;
  12240. case 1:
  12241. tile.packetsIterator = new ResolutionLayerComponentPositionIterator(context);
  12242. break;
  12243. case 2:
  12244. tile.packetsIterator = new ResolutionPositionComponentLayerIterator(context);
  12245. break;
  12246. case 3:
  12247. tile.packetsIterator = new PositionComponentResolutionLayerIterator(context);
  12248. break;
  12249. case 4:
  12250. tile.packetsIterator = new ComponentPositionResolutionLayerIterator(context);
  12251. break;
  12252. default:
  12253. throw new JpxError(`Unsupported progression order ${progressionOrder}`);
  12254. }
  12255. }
  12256. function parseTilePackets(context, data, offset, dataLength) {
  12257. var position = 0;
  12258. var buffer,
  12259. bufferSize = 0,
  12260. skipNextBit = false;
  12261. function readBits(count) {
  12262. while (bufferSize < count) {
  12263. var b = data[offset + position];
  12264. position++;
  12265. if (skipNextBit) {
  12266. buffer = buffer << 7 | b;
  12267. bufferSize += 7;
  12268. skipNextBit = false;
  12269. } else {
  12270. buffer = buffer << 8 | b;
  12271. bufferSize += 8;
  12272. }
  12273. if (b === 0xff) {
  12274. skipNextBit = true;
  12275. }
  12276. }
  12277. bufferSize -= count;
  12278. return buffer >>> bufferSize & (1 << count) - 1;
  12279. }
  12280. function skipMarkerIfEqual(value) {
  12281. if (data[offset + position - 1] === 0xff && data[offset + position] === value) {
  12282. skipBytes(1);
  12283. return true;
  12284. } else if (data[offset + position] === 0xff && data[offset + position + 1] === value) {
  12285. skipBytes(2);
  12286. return true;
  12287. }
  12288. return false;
  12289. }
  12290. function skipBytes(count) {
  12291. position += count;
  12292. }
  12293. function alignToByte() {
  12294. bufferSize = 0;
  12295. if (skipNextBit) {
  12296. position++;
  12297. skipNextBit = false;
  12298. }
  12299. }
  12300. function readCodingpasses() {
  12301. if (readBits(1) === 0) {
  12302. return 1;
  12303. }
  12304. if (readBits(1) === 0) {
  12305. return 2;
  12306. }
  12307. var value = readBits(2);
  12308. if (value < 3) {
  12309. return value + 3;
  12310. }
  12311. value = readBits(5);
  12312. if (value < 31) {
  12313. return value + 6;
  12314. }
  12315. value = readBits(7);
  12316. return value + 37;
  12317. }
  12318. var tileIndex = context.currentTile.index;
  12319. var tile = context.tiles[tileIndex];
  12320. var sopMarkerUsed = context.COD.sopMarkerUsed;
  12321. var ephMarkerUsed = context.COD.ephMarkerUsed;
  12322. var packetsIterator = tile.packetsIterator;
  12323. while (position < dataLength) {
  12324. alignToByte();
  12325. if (sopMarkerUsed && skipMarkerIfEqual(0x91)) {
  12326. skipBytes(4);
  12327. }
  12328. var packet = packetsIterator.nextPacket();
  12329. if (!readBits(1)) {
  12330. continue;
  12331. }
  12332. var layerNumber = packet.layerNumber;
  12333. var queue = [],
  12334. codeblock;
  12335. for (var i = 0, ii = packet.codeblocks.length; i < ii; i++) {
  12336. codeblock = packet.codeblocks[i];
  12337. var precinct = codeblock.precinct;
  12338. var codeblockColumn = codeblock.cbx - precinct.cbxMin;
  12339. var codeblockRow = codeblock.cby - precinct.cbyMin;
  12340. var codeblockIncluded = false;
  12341. var firstTimeInclusion = false;
  12342. var valueReady;
  12343. if (codeblock.included !== undefined) {
  12344. codeblockIncluded = !!readBits(1);
  12345. } else {
  12346. precinct = codeblock.precinct;
  12347. var inclusionTree, zeroBitPlanesTree;
  12348. if (precinct.inclusionTree !== undefined) {
  12349. inclusionTree = precinct.inclusionTree;
  12350. } else {
  12351. var width = precinct.cbxMax - precinct.cbxMin + 1;
  12352. var height = precinct.cbyMax - precinct.cbyMin + 1;
  12353. inclusionTree = new InclusionTree(width, height, layerNumber);
  12354. zeroBitPlanesTree = new TagTree(width, height);
  12355. precinct.inclusionTree = inclusionTree;
  12356. precinct.zeroBitPlanesTree = zeroBitPlanesTree;
  12357. }
  12358. if (inclusionTree.reset(codeblockColumn, codeblockRow, layerNumber)) {
  12359. while (true) {
  12360. if (readBits(1)) {
  12361. valueReady = !inclusionTree.nextLevel();
  12362. if (valueReady) {
  12363. codeblock.included = true;
  12364. codeblockIncluded = firstTimeInclusion = true;
  12365. break;
  12366. }
  12367. } else {
  12368. inclusionTree.incrementValue(layerNumber);
  12369. break;
  12370. }
  12371. }
  12372. }
  12373. }
  12374. if (!codeblockIncluded) {
  12375. continue;
  12376. }
  12377. if (firstTimeInclusion) {
  12378. zeroBitPlanesTree = precinct.zeroBitPlanesTree;
  12379. zeroBitPlanesTree.reset(codeblockColumn, codeblockRow);
  12380. while (true) {
  12381. if (readBits(1)) {
  12382. valueReady = !zeroBitPlanesTree.nextLevel();
  12383. if (valueReady) {
  12384. break;
  12385. }
  12386. } else {
  12387. zeroBitPlanesTree.incrementValue();
  12388. }
  12389. }
  12390. codeblock.zeroBitPlanes = zeroBitPlanesTree.value;
  12391. }
  12392. var codingpasses = readCodingpasses();
  12393. while (readBits(1)) {
  12394. codeblock.Lblock++;
  12395. }
  12396. var codingpassesLog2 = (0, _core_utils.log2)(codingpasses);
  12397. var bits = (codingpasses < 1 << codingpassesLog2 ? codingpassesLog2 - 1 : codingpassesLog2) + codeblock.Lblock;
  12398. var codedDataLength = readBits(bits);
  12399. queue.push({
  12400. codeblock,
  12401. codingpasses,
  12402. dataLength: codedDataLength
  12403. });
  12404. }
  12405. alignToByte();
  12406. if (ephMarkerUsed) {
  12407. skipMarkerIfEqual(0x92);
  12408. }
  12409. while (queue.length > 0) {
  12410. var packetItem = queue.shift();
  12411. codeblock = packetItem.codeblock;
  12412. if (codeblock.data === undefined) {
  12413. codeblock.data = [];
  12414. }
  12415. codeblock.data.push({
  12416. data,
  12417. start: offset + position,
  12418. end: offset + position + packetItem.dataLength,
  12419. codingpasses: packetItem.codingpasses
  12420. });
  12421. position += packetItem.dataLength;
  12422. }
  12423. }
  12424. return position;
  12425. }
  12426. function copyCoefficients(coefficients, levelWidth, levelHeight, subband, delta, mb, reversible, segmentationSymbolUsed) {
  12427. var x0 = subband.tbx0;
  12428. var y0 = subband.tby0;
  12429. var width = subband.tbx1 - subband.tbx0;
  12430. var codeblocks = subband.codeblocks;
  12431. var right = subband.type.charAt(0) === "H" ? 1 : 0;
  12432. var bottom = subband.type.charAt(1) === "H" ? levelWidth : 0;
  12433. for (var i = 0, ii = codeblocks.length; i < ii; ++i) {
  12434. var codeblock = codeblocks[i];
  12435. var blockWidth = codeblock.tbx1_ - codeblock.tbx0_;
  12436. var blockHeight = codeblock.tby1_ - codeblock.tby0_;
  12437. if (blockWidth === 0 || blockHeight === 0) {
  12438. continue;
  12439. }
  12440. if (codeblock.data === undefined) {
  12441. continue;
  12442. }
  12443. var bitModel, currentCodingpassType;
  12444. bitModel = new BitModel(blockWidth, blockHeight, codeblock.subbandType, codeblock.zeroBitPlanes, mb);
  12445. currentCodingpassType = 2;
  12446. var data = codeblock.data,
  12447. totalLength = 0,
  12448. codingpasses = 0;
  12449. var j, jj, dataItem;
  12450. for (j = 0, jj = data.length; j < jj; j++) {
  12451. dataItem = data[j];
  12452. totalLength += dataItem.end - dataItem.start;
  12453. codingpasses += dataItem.codingpasses;
  12454. }
  12455. var encodedData = new Uint8Array(totalLength);
  12456. var position = 0;
  12457. for (j = 0, jj = data.length; j < jj; j++) {
  12458. dataItem = data[j];
  12459. var chunk = dataItem.data.subarray(dataItem.start, dataItem.end);
  12460. encodedData.set(chunk, position);
  12461. position += chunk.length;
  12462. }
  12463. var decoder = new _arithmetic_decoder.ArithmeticDecoder(encodedData, 0, totalLength);
  12464. bitModel.setDecoder(decoder);
  12465. for (j = 0; j < codingpasses; j++) {
  12466. switch (currentCodingpassType) {
  12467. case 0:
  12468. bitModel.runSignificancePropagationPass();
  12469. break;
  12470. case 1:
  12471. bitModel.runMagnitudeRefinementPass();
  12472. break;
  12473. case 2:
  12474. bitModel.runCleanupPass();
  12475. if (segmentationSymbolUsed) {
  12476. bitModel.checkSegmentationSymbol();
  12477. }
  12478. break;
  12479. }
  12480. currentCodingpassType = (currentCodingpassType + 1) % 3;
  12481. }
  12482. var offset = codeblock.tbx0_ - x0 + (codeblock.tby0_ - y0) * width;
  12483. var sign = bitModel.coefficentsSign;
  12484. var magnitude = bitModel.coefficentsMagnitude;
  12485. var bitsDecoded = bitModel.bitsDecoded;
  12486. var magnitudeCorrection = reversible ? 0 : 0.5;
  12487. var k, n, nb;
  12488. position = 0;
  12489. var interleave = subband.type !== "LL";
  12490. for (j = 0; j < blockHeight; j++) {
  12491. var row = offset / width | 0;
  12492. var levelOffset = 2 * row * (levelWidth - width) + right + bottom;
  12493. for (k = 0; k < blockWidth; k++) {
  12494. n = magnitude[position];
  12495. if (n !== 0) {
  12496. n = (n + magnitudeCorrection) * delta;
  12497. if (sign[position] !== 0) {
  12498. n = -n;
  12499. }
  12500. nb = bitsDecoded[position];
  12501. var pos = interleave ? levelOffset + (offset << 1) : offset;
  12502. if (reversible && nb >= mb) {
  12503. coefficients[pos] = n;
  12504. } else {
  12505. coefficients[pos] = n * (1 << mb - nb);
  12506. }
  12507. }
  12508. offset++;
  12509. position++;
  12510. }
  12511. offset += width - blockWidth;
  12512. }
  12513. }
  12514. }
  12515. function transformTile(context, tile, c) {
  12516. var component = tile.components[c];
  12517. var codingStyleParameters = component.codingStyleParameters;
  12518. var quantizationParameters = component.quantizationParameters;
  12519. var decompositionLevelsCount = codingStyleParameters.decompositionLevelsCount;
  12520. var spqcds = quantizationParameters.SPqcds;
  12521. var scalarExpounded = quantizationParameters.scalarExpounded;
  12522. var guardBits = quantizationParameters.guardBits;
  12523. var segmentationSymbolUsed = codingStyleParameters.segmentationSymbolUsed;
  12524. var precision = context.components[c].precision;
  12525. var reversible = codingStyleParameters.reversibleTransformation;
  12526. var transform = reversible ? new ReversibleTransform() : new IrreversibleTransform();
  12527. var subbandCoefficients = [];
  12528. var b = 0;
  12529. for (var i = 0; i <= decompositionLevelsCount; i++) {
  12530. var resolution = component.resolutions[i];
  12531. var width = resolution.trx1 - resolution.trx0;
  12532. var height = resolution.try1 - resolution.try0;
  12533. var coefficients = new Float32Array(width * height);
  12534. for (var j = 0, jj = resolution.subbands.length; j < jj; j++) {
  12535. var mu, epsilon;
  12536. if (!scalarExpounded) {
  12537. mu = spqcds[0].mu;
  12538. epsilon = spqcds[0].epsilon + (i > 0 ? 1 - i : 0);
  12539. } else {
  12540. mu = spqcds[b].mu;
  12541. epsilon = spqcds[b].epsilon;
  12542. b++;
  12543. }
  12544. var subband = resolution.subbands[j];
  12545. var gainLog2 = SubbandsGainLog2[subband.type];
  12546. var delta = reversible ? 1 : 2 ** (precision + gainLog2 - epsilon) * (1 + mu / 2048);
  12547. var mb = guardBits + epsilon - 1;
  12548. copyCoefficients(coefficients, width, height, subband, delta, mb, reversible, segmentationSymbolUsed);
  12549. }
  12550. subbandCoefficients.push({
  12551. width,
  12552. height,
  12553. items: coefficients
  12554. });
  12555. }
  12556. var result = transform.calculate(subbandCoefficients, component.tcx0, component.tcy0);
  12557. return {
  12558. left: component.tcx0,
  12559. top: component.tcy0,
  12560. width: result.width,
  12561. height: result.height,
  12562. items: result.items
  12563. };
  12564. }
  12565. function transformComponents(context) {
  12566. var siz = context.SIZ;
  12567. var components = context.components;
  12568. var componentsCount = siz.Csiz;
  12569. var resultImages = [];
  12570. for (var i = 0, ii = context.tiles.length; i < ii; i++) {
  12571. var tile = context.tiles[i];
  12572. var transformedTiles = [];
  12573. var c;
  12574. for (c = 0; c < componentsCount; c++) {
  12575. transformedTiles[c] = transformTile(context, tile, c);
  12576. }
  12577. var tile0 = transformedTiles[0];
  12578. var out = new Uint8ClampedArray(tile0.items.length * componentsCount);
  12579. var result = {
  12580. left: tile0.left,
  12581. top: tile0.top,
  12582. width: tile0.width,
  12583. height: tile0.height,
  12584. items: out
  12585. };
  12586. var shift, offset;
  12587. var pos = 0,
  12588. j,
  12589. jj,
  12590. y0,
  12591. y1,
  12592. y2;
  12593. if (tile.codingStyleDefaultParameters.multipleComponentTransform) {
  12594. var fourComponents = componentsCount === 4;
  12595. var y0items = transformedTiles[0].items;
  12596. var y1items = transformedTiles[1].items;
  12597. var y2items = transformedTiles[2].items;
  12598. var y3items = fourComponents ? transformedTiles[3].items : null;
  12599. shift = components[0].precision - 8;
  12600. offset = (128 << shift) + 0.5;
  12601. var component0 = tile.components[0];
  12602. var alpha01 = componentsCount - 3;
  12603. jj = y0items.length;
  12604. if (!component0.codingStyleParameters.reversibleTransformation) {
  12605. for (j = 0; j < jj; j++, pos += alpha01) {
  12606. y0 = y0items[j] + offset;
  12607. y1 = y1items[j];
  12608. y2 = y2items[j];
  12609. out[pos++] = y0 + 1.402 * y2 >> shift;
  12610. out[pos++] = y0 - 0.34413 * y1 - 0.71414 * y2 >> shift;
  12611. out[pos++] = y0 + 1.772 * y1 >> shift;
  12612. }
  12613. } else {
  12614. for (j = 0; j < jj; j++, pos += alpha01) {
  12615. y0 = y0items[j] + offset;
  12616. y1 = y1items[j];
  12617. y2 = y2items[j];
  12618. const g = y0 - (y2 + y1 >> 2);
  12619. out[pos++] = g + y2 >> shift;
  12620. out[pos++] = g >> shift;
  12621. out[pos++] = g + y1 >> shift;
  12622. }
  12623. }
  12624. if (fourComponents) {
  12625. for (j = 0, pos = 3; j < jj; j++, pos += 4) {
  12626. out[pos] = y3items[j] + offset >> shift;
  12627. }
  12628. }
  12629. } else {
  12630. for (c = 0; c < componentsCount; c++) {
  12631. var items = transformedTiles[c].items;
  12632. shift = components[c].precision - 8;
  12633. offset = (128 << shift) + 0.5;
  12634. for (pos = c, j = 0, jj = items.length; j < jj; j++) {
  12635. out[pos] = items[j] + offset >> shift;
  12636. pos += componentsCount;
  12637. }
  12638. }
  12639. }
  12640. resultImages.push(result);
  12641. }
  12642. return resultImages;
  12643. }
  12644. function initializeTile(context, tileIndex) {
  12645. var siz = context.SIZ;
  12646. var componentsCount = siz.Csiz;
  12647. var tile = context.tiles[tileIndex];
  12648. for (var c = 0; c < componentsCount; c++) {
  12649. var component = tile.components[c];
  12650. var qcdOrQcc = context.currentTile.QCC[c] !== undefined ? context.currentTile.QCC[c] : context.currentTile.QCD;
  12651. component.quantizationParameters = qcdOrQcc;
  12652. var codOrCoc = context.currentTile.COC[c] !== undefined ? context.currentTile.COC[c] : context.currentTile.COD;
  12653. component.codingStyleParameters = codOrCoc;
  12654. }
  12655. tile.codingStyleDefaultParameters = context.currentTile.COD;
  12656. }
  12657. var TagTree = function TagTreeClosure() {
  12658. function TagTree(width, height) {
  12659. var levelsLength = (0, _core_utils.log2)(Math.max(width, height)) + 1;
  12660. this.levels = [];
  12661. for (var i = 0; i < levelsLength; i++) {
  12662. var level = {
  12663. width,
  12664. height,
  12665. items: []
  12666. };
  12667. this.levels.push(level);
  12668. width = Math.ceil(width / 2);
  12669. height = Math.ceil(height / 2);
  12670. }
  12671. }
  12672. TagTree.prototype = {
  12673. reset: function TagTree_reset(i, j) {
  12674. var currentLevel = 0,
  12675. value = 0,
  12676. level;
  12677. while (currentLevel < this.levels.length) {
  12678. level = this.levels[currentLevel];
  12679. var index = i + j * level.width;
  12680. if (level.items[index] !== undefined) {
  12681. value = level.items[index];
  12682. break;
  12683. }
  12684. level.index = index;
  12685. i >>= 1;
  12686. j >>= 1;
  12687. currentLevel++;
  12688. }
  12689. currentLevel--;
  12690. level = this.levels[currentLevel];
  12691. level.items[level.index] = value;
  12692. this.currentLevel = currentLevel;
  12693. delete this.value;
  12694. },
  12695. incrementValue: function TagTree_incrementValue() {
  12696. var level = this.levels[this.currentLevel];
  12697. level.items[level.index]++;
  12698. },
  12699. nextLevel: function TagTree_nextLevel() {
  12700. var currentLevel = this.currentLevel;
  12701. var level = this.levels[currentLevel];
  12702. var value = level.items[level.index];
  12703. currentLevel--;
  12704. if (currentLevel < 0) {
  12705. this.value = value;
  12706. return false;
  12707. }
  12708. this.currentLevel = currentLevel;
  12709. level = this.levels[currentLevel];
  12710. level.items[level.index] = value;
  12711. return true;
  12712. }
  12713. };
  12714. return TagTree;
  12715. }();
  12716. var InclusionTree = function InclusionTreeClosure() {
  12717. function InclusionTree(width, height, defaultValue) {
  12718. var levelsLength = (0, _core_utils.log2)(Math.max(width, height)) + 1;
  12719. this.levels = [];
  12720. for (var i = 0; i < levelsLength; i++) {
  12721. var items = new Uint8Array(width * height);
  12722. for (var j = 0, jj = items.length; j < jj; j++) {
  12723. items[j] = defaultValue;
  12724. }
  12725. var level = {
  12726. width,
  12727. height,
  12728. items
  12729. };
  12730. this.levels.push(level);
  12731. width = Math.ceil(width / 2);
  12732. height = Math.ceil(height / 2);
  12733. }
  12734. }
  12735. InclusionTree.prototype = {
  12736. reset: function InclusionTree_reset(i, j, stopValue) {
  12737. var currentLevel = 0;
  12738. while (currentLevel < this.levels.length) {
  12739. var level = this.levels[currentLevel];
  12740. var index = i + j * level.width;
  12741. level.index = index;
  12742. var value = level.items[index];
  12743. if (value === 0xff) {
  12744. break;
  12745. }
  12746. if (value > stopValue) {
  12747. this.currentLevel = currentLevel;
  12748. this.propagateValues();
  12749. return false;
  12750. }
  12751. i >>= 1;
  12752. j >>= 1;
  12753. currentLevel++;
  12754. }
  12755. this.currentLevel = currentLevel - 1;
  12756. return true;
  12757. },
  12758. incrementValue: function InclusionTree_incrementValue(stopValue) {
  12759. var level = this.levels[this.currentLevel];
  12760. level.items[level.index] = stopValue + 1;
  12761. this.propagateValues();
  12762. },
  12763. propagateValues: function InclusionTree_propagateValues() {
  12764. var levelIndex = this.currentLevel;
  12765. var level = this.levels[levelIndex];
  12766. var currentValue = level.items[level.index];
  12767. while (--levelIndex >= 0) {
  12768. level = this.levels[levelIndex];
  12769. level.items[level.index] = currentValue;
  12770. }
  12771. },
  12772. nextLevel: function InclusionTree_nextLevel() {
  12773. var currentLevel = this.currentLevel;
  12774. var level = this.levels[currentLevel];
  12775. var value = level.items[level.index];
  12776. level.items[level.index] = 0xff;
  12777. currentLevel--;
  12778. if (currentLevel < 0) {
  12779. return false;
  12780. }
  12781. this.currentLevel = currentLevel;
  12782. level = this.levels[currentLevel];
  12783. level.items[level.index] = value;
  12784. return true;
  12785. }
  12786. };
  12787. return InclusionTree;
  12788. }();
  12789. var BitModel = function BitModelClosure() {
  12790. var UNIFORM_CONTEXT = 17;
  12791. var RUNLENGTH_CONTEXT = 18;
  12792. var LLAndLHContextsLabel = new Uint8Array([0, 5, 8, 0, 3, 7, 8, 0, 4, 7, 8, 0, 0, 0, 0, 0, 1, 6, 8, 0, 3, 7, 8, 0, 4, 7, 8, 0, 0, 0, 0, 0, 2, 6, 8, 0, 3, 7, 8, 0, 4, 7, 8, 0, 0, 0, 0, 0, 2, 6, 8, 0, 3, 7, 8, 0, 4, 7, 8, 0, 0, 0, 0, 0, 2, 6, 8, 0, 3, 7, 8, 0, 4, 7, 8]);
  12793. var HLContextLabel = new Uint8Array([0, 3, 4, 0, 5, 7, 7, 0, 8, 8, 8, 0, 0, 0, 0, 0, 1, 3, 4, 0, 6, 7, 7, 0, 8, 8, 8, 0, 0, 0, 0, 0, 2, 3, 4, 0, 6, 7, 7, 0, 8, 8, 8, 0, 0, 0, 0, 0, 2, 3, 4, 0, 6, 7, 7, 0, 8, 8, 8, 0, 0, 0, 0, 0, 2, 3, 4, 0, 6, 7, 7, 0, 8, 8, 8]);
  12794. var HHContextLabel = new Uint8Array([0, 1, 2, 0, 1, 2, 2, 0, 2, 2, 2, 0, 0, 0, 0, 0, 3, 4, 5, 0, 4, 5, 5, 0, 5, 5, 5, 0, 0, 0, 0, 0, 6, 7, 7, 0, 7, 7, 7, 0, 7, 7, 7, 0, 0, 0, 0, 0, 8, 8, 8, 0, 8, 8, 8, 0, 8, 8, 8, 0, 0, 0, 0, 0, 8, 8, 8, 0, 8, 8, 8, 0, 8, 8, 8]);
  12795. function BitModel(width, height, subband, zeroBitPlanes, mb) {
  12796. this.width = width;
  12797. this.height = height;
  12798. let contextLabelTable;
  12799. if (subband === "HH") {
  12800. contextLabelTable = HHContextLabel;
  12801. } else if (subband === "HL") {
  12802. contextLabelTable = HLContextLabel;
  12803. } else {
  12804. contextLabelTable = LLAndLHContextsLabel;
  12805. }
  12806. this.contextLabelTable = contextLabelTable;
  12807. var coefficientCount = width * height;
  12808. this.neighborsSignificance = new Uint8Array(coefficientCount);
  12809. this.coefficentsSign = new Uint8Array(coefficientCount);
  12810. let coefficentsMagnitude;
  12811. if (mb > 14) {
  12812. coefficentsMagnitude = new Uint32Array(coefficientCount);
  12813. } else if (mb > 6) {
  12814. coefficentsMagnitude = new Uint16Array(coefficientCount);
  12815. } else {
  12816. coefficentsMagnitude = new Uint8Array(coefficientCount);
  12817. }
  12818. this.coefficentsMagnitude = coefficentsMagnitude;
  12819. this.processingFlags = new Uint8Array(coefficientCount);
  12820. var bitsDecoded = new Uint8Array(coefficientCount);
  12821. if (zeroBitPlanes !== 0) {
  12822. for (var i = 0; i < coefficientCount; i++) {
  12823. bitsDecoded[i] = zeroBitPlanes;
  12824. }
  12825. }
  12826. this.bitsDecoded = bitsDecoded;
  12827. this.reset();
  12828. }
  12829. BitModel.prototype = {
  12830. setDecoder: function BitModel_setDecoder(decoder) {
  12831. this.decoder = decoder;
  12832. },
  12833. reset: function BitModel_reset() {
  12834. this.contexts = new Int8Array(19);
  12835. this.contexts[0] = 4 << 1 | 0;
  12836. this.contexts[UNIFORM_CONTEXT] = 46 << 1 | 0;
  12837. this.contexts[RUNLENGTH_CONTEXT] = 3 << 1 | 0;
  12838. },
  12839. setNeighborsSignificance: function BitModel_setNeighborsSignificance(row, column, index) {
  12840. var neighborsSignificance = this.neighborsSignificance;
  12841. var width = this.width,
  12842. height = this.height;
  12843. var left = column > 0;
  12844. var right = column + 1 < width;
  12845. var i;
  12846. if (row > 0) {
  12847. i = index - width;
  12848. if (left) {
  12849. neighborsSignificance[i - 1] += 0x10;
  12850. }
  12851. if (right) {
  12852. neighborsSignificance[i + 1] += 0x10;
  12853. }
  12854. neighborsSignificance[i] += 0x04;
  12855. }
  12856. if (row + 1 < height) {
  12857. i = index + width;
  12858. if (left) {
  12859. neighborsSignificance[i - 1] += 0x10;
  12860. }
  12861. if (right) {
  12862. neighborsSignificance[i + 1] += 0x10;
  12863. }
  12864. neighborsSignificance[i] += 0x04;
  12865. }
  12866. if (left) {
  12867. neighborsSignificance[index - 1] += 0x01;
  12868. }
  12869. if (right) {
  12870. neighborsSignificance[index + 1] += 0x01;
  12871. }
  12872. neighborsSignificance[index] |= 0x80;
  12873. },
  12874. runSignificancePropagationPass: function BitModel_runSignificancePropagationPass() {
  12875. var decoder = this.decoder;
  12876. var width = this.width,
  12877. height = this.height;
  12878. var coefficentsMagnitude = this.coefficentsMagnitude;
  12879. var coefficentsSign = this.coefficentsSign;
  12880. var neighborsSignificance = this.neighborsSignificance;
  12881. var processingFlags = this.processingFlags;
  12882. var contexts = this.contexts;
  12883. var labels = this.contextLabelTable;
  12884. var bitsDecoded = this.bitsDecoded;
  12885. var processedInverseMask = ~1;
  12886. var processedMask = 1;
  12887. var firstMagnitudeBitMask = 2;
  12888. for (var i0 = 0; i0 < height; i0 += 4) {
  12889. for (var j = 0; j < width; j++) {
  12890. var index = i0 * width + j;
  12891. for (var i1 = 0; i1 < 4; i1++, index += width) {
  12892. var i = i0 + i1;
  12893. if (i >= height) {
  12894. break;
  12895. }
  12896. processingFlags[index] &= processedInverseMask;
  12897. if (coefficentsMagnitude[index] || !neighborsSignificance[index]) {
  12898. continue;
  12899. }
  12900. var contextLabel = labels[neighborsSignificance[index]];
  12901. var decision = decoder.readBit(contexts, contextLabel);
  12902. if (decision) {
  12903. var sign = this.decodeSignBit(i, j, index);
  12904. coefficentsSign[index] = sign;
  12905. coefficentsMagnitude[index] = 1;
  12906. this.setNeighborsSignificance(i, j, index);
  12907. processingFlags[index] |= firstMagnitudeBitMask;
  12908. }
  12909. bitsDecoded[index]++;
  12910. processingFlags[index] |= processedMask;
  12911. }
  12912. }
  12913. }
  12914. },
  12915. decodeSignBit: function BitModel_decodeSignBit(row, column, index) {
  12916. var width = this.width,
  12917. height = this.height;
  12918. var coefficentsMagnitude = this.coefficentsMagnitude;
  12919. var coefficentsSign = this.coefficentsSign;
  12920. var contribution, sign0, sign1, significance1;
  12921. var contextLabel, decoded;
  12922. significance1 = column > 0 && coefficentsMagnitude[index - 1] !== 0;
  12923. if (column + 1 < width && coefficentsMagnitude[index + 1] !== 0) {
  12924. sign1 = coefficentsSign[index + 1];
  12925. if (significance1) {
  12926. sign0 = coefficentsSign[index - 1];
  12927. contribution = 1 - sign1 - sign0;
  12928. } else {
  12929. contribution = 1 - sign1 - sign1;
  12930. }
  12931. } else if (significance1) {
  12932. sign0 = coefficentsSign[index - 1];
  12933. contribution = 1 - sign0 - sign0;
  12934. } else {
  12935. contribution = 0;
  12936. }
  12937. var horizontalContribution = 3 * contribution;
  12938. significance1 = row > 0 && coefficentsMagnitude[index - width] !== 0;
  12939. if (row + 1 < height && coefficentsMagnitude[index + width] !== 0) {
  12940. sign1 = coefficentsSign[index + width];
  12941. if (significance1) {
  12942. sign0 = coefficentsSign[index - width];
  12943. contribution = 1 - sign1 - sign0 + horizontalContribution;
  12944. } else {
  12945. contribution = 1 - sign1 - sign1 + horizontalContribution;
  12946. }
  12947. } else if (significance1) {
  12948. sign0 = coefficentsSign[index - width];
  12949. contribution = 1 - sign0 - sign0 + horizontalContribution;
  12950. } else {
  12951. contribution = horizontalContribution;
  12952. }
  12953. if (contribution >= 0) {
  12954. contextLabel = 9 + contribution;
  12955. decoded = this.decoder.readBit(this.contexts, contextLabel);
  12956. } else {
  12957. contextLabel = 9 - contribution;
  12958. decoded = this.decoder.readBit(this.contexts, contextLabel) ^ 1;
  12959. }
  12960. return decoded;
  12961. },
  12962. runMagnitudeRefinementPass: function BitModel_runMagnitudeRefinementPass() {
  12963. var decoder = this.decoder;
  12964. var width = this.width,
  12965. height = this.height;
  12966. var coefficentsMagnitude = this.coefficentsMagnitude;
  12967. var neighborsSignificance = this.neighborsSignificance;
  12968. var contexts = this.contexts;
  12969. var bitsDecoded = this.bitsDecoded;
  12970. var processingFlags = this.processingFlags;
  12971. var processedMask = 1;
  12972. var firstMagnitudeBitMask = 2;
  12973. var length = width * height;
  12974. var width4 = width * 4;
  12975. for (var index0 = 0, indexNext; index0 < length; index0 = indexNext) {
  12976. indexNext = Math.min(length, index0 + width4);
  12977. for (var j = 0; j < width; j++) {
  12978. for (var index = index0 + j; index < indexNext; index += width) {
  12979. if (!coefficentsMagnitude[index] || (processingFlags[index] & processedMask) !== 0) {
  12980. continue;
  12981. }
  12982. var contextLabel = 16;
  12983. if ((processingFlags[index] & firstMagnitudeBitMask) !== 0) {
  12984. processingFlags[index] ^= firstMagnitudeBitMask;
  12985. var significance = neighborsSignificance[index] & 127;
  12986. contextLabel = significance === 0 ? 15 : 14;
  12987. }
  12988. var bit = decoder.readBit(contexts, contextLabel);
  12989. coefficentsMagnitude[index] = coefficentsMagnitude[index] << 1 | bit;
  12990. bitsDecoded[index]++;
  12991. processingFlags[index] |= processedMask;
  12992. }
  12993. }
  12994. }
  12995. },
  12996. runCleanupPass: function BitModel_runCleanupPass() {
  12997. var decoder = this.decoder;
  12998. var width = this.width,
  12999. height = this.height;
  13000. var neighborsSignificance = this.neighborsSignificance;
  13001. var coefficentsMagnitude = this.coefficentsMagnitude;
  13002. var coefficentsSign = this.coefficentsSign;
  13003. var contexts = this.contexts;
  13004. var labels = this.contextLabelTable;
  13005. var bitsDecoded = this.bitsDecoded;
  13006. var processingFlags = this.processingFlags;
  13007. var processedMask = 1;
  13008. var firstMagnitudeBitMask = 2;
  13009. var oneRowDown = width;
  13010. var twoRowsDown = width * 2;
  13011. var threeRowsDown = width * 3;
  13012. var iNext;
  13013. for (var i0 = 0; i0 < height; i0 = iNext) {
  13014. iNext = Math.min(i0 + 4, height);
  13015. var indexBase = i0 * width;
  13016. var checkAllEmpty = i0 + 3 < height;
  13017. for (var j = 0; j < width; j++) {
  13018. var index0 = indexBase + j;
  13019. 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;
  13020. var i1 = 0,
  13021. index = index0;
  13022. var i = i0,
  13023. sign;
  13024. if (allEmpty) {
  13025. var hasSignificantCoefficent = decoder.readBit(contexts, RUNLENGTH_CONTEXT);
  13026. if (!hasSignificantCoefficent) {
  13027. bitsDecoded[index0]++;
  13028. bitsDecoded[index0 + oneRowDown]++;
  13029. bitsDecoded[index0 + twoRowsDown]++;
  13030. bitsDecoded[index0 + threeRowsDown]++;
  13031. continue;
  13032. }
  13033. i1 = decoder.readBit(contexts, UNIFORM_CONTEXT) << 1 | decoder.readBit(contexts, UNIFORM_CONTEXT);
  13034. if (i1 !== 0) {
  13035. i = i0 + i1;
  13036. index += i1 * width;
  13037. }
  13038. sign = this.decodeSignBit(i, j, index);
  13039. coefficentsSign[index] = sign;
  13040. coefficentsMagnitude[index] = 1;
  13041. this.setNeighborsSignificance(i, j, index);
  13042. processingFlags[index] |= firstMagnitudeBitMask;
  13043. index = index0;
  13044. for (var i2 = i0; i2 <= i; i2++, index += width) {
  13045. bitsDecoded[index]++;
  13046. }
  13047. i1++;
  13048. }
  13049. for (i = i0 + i1; i < iNext; i++, index += width) {
  13050. if (coefficentsMagnitude[index] || (processingFlags[index] & processedMask) !== 0) {
  13051. continue;
  13052. }
  13053. var contextLabel = labels[neighborsSignificance[index]];
  13054. var decision = decoder.readBit(contexts, contextLabel);
  13055. if (decision === 1) {
  13056. sign = this.decodeSignBit(i, j, index);
  13057. coefficentsSign[index] = sign;
  13058. coefficentsMagnitude[index] = 1;
  13059. this.setNeighborsSignificance(i, j, index);
  13060. processingFlags[index] |= firstMagnitudeBitMask;
  13061. }
  13062. bitsDecoded[index]++;
  13063. }
  13064. }
  13065. }
  13066. },
  13067. checkSegmentationSymbol: function BitModel_checkSegmentationSymbol() {
  13068. var decoder = this.decoder;
  13069. var contexts = this.contexts;
  13070. 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);
  13071. if (symbol !== 0xa) {
  13072. throw new JpxError("Invalid segmentation symbol");
  13073. }
  13074. }
  13075. };
  13076. return BitModel;
  13077. }();
  13078. var Transform = function TransformClosure() {
  13079. function Transform() {}
  13080. Transform.prototype.calculate = function transformCalculate(subbands, u0, v0) {
  13081. var ll = subbands[0];
  13082. for (var i = 1, ii = subbands.length; i < ii; i++) {
  13083. ll = this.iterate(ll, subbands[i], u0, v0);
  13084. }
  13085. return ll;
  13086. };
  13087. Transform.prototype.extend = function extend(buffer, offset, size) {
  13088. var i1 = offset - 1,
  13089. j1 = offset + 1;
  13090. var i2 = offset + size - 2,
  13091. j2 = offset + size;
  13092. buffer[i1--] = buffer[j1++];
  13093. buffer[j2++] = buffer[i2--];
  13094. buffer[i1--] = buffer[j1++];
  13095. buffer[j2++] = buffer[i2--];
  13096. buffer[i1--] = buffer[j1++];
  13097. buffer[j2++] = buffer[i2--];
  13098. buffer[i1] = buffer[j1];
  13099. buffer[j2] = buffer[i2];
  13100. };
  13101. Transform.prototype.iterate = function Transform_iterate(ll, hl_lh_hh, u0, v0) {
  13102. var llWidth = ll.width,
  13103. llHeight = ll.height,
  13104. llItems = ll.items;
  13105. var width = hl_lh_hh.width;
  13106. var height = hl_lh_hh.height;
  13107. var items = hl_lh_hh.items;
  13108. var i, j, k, l, u, v;
  13109. for (k = 0, i = 0; i < llHeight; i++) {
  13110. l = i * 2 * width;
  13111. for (j = 0; j < llWidth; j++, k++, l += 2) {
  13112. items[l] = llItems[k];
  13113. }
  13114. }
  13115. llItems = ll.items = null;
  13116. var bufferPadding = 4;
  13117. var rowBuffer = new Float32Array(width + 2 * bufferPadding);
  13118. if (width === 1) {
  13119. if ((u0 & 1) !== 0) {
  13120. for (v = 0, k = 0; v < height; v++, k += width) {
  13121. items[k] *= 0.5;
  13122. }
  13123. }
  13124. } else {
  13125. for (v = 0, k = 0; v < height; v++, k += width) {
  13126. rowBuffer.set(items.subarray(k, k + width), bufferPadding);
  13127. this.extend(rowBuffer, bufferPadding, width);
  13128. this.filter(rowBuffer, bufferPadding, width);
  13129. items.set(rowBuffer.subarray(bufferPadding, bufferPadding + width), k);
  13130. }
  13131. }
  13132. var numBuffers = 16;
  13133. var colBuffers = [];
  13134. for (i = 0; i < numBuffers; i++) {
  13135. colBuffers.push(new Float32Array(height + 2 * bufferPadding));
  13136. }
  13137. var b,
  13138. currentBuffer = 0;
  13139. ll = bufferPadding + height;
  13140. if (height === 1) {
  13141. if ((v0 & 1) !== 0) {
  13142. for (u = 0; u < width; u++) {
  13143. items[u] *= 0.5;
  13144. }
  13145. }
  13146. } else {
  13147. for (u = 0; u < width; u++) {
  13148. if (currentBuffer === 0) {
  13149. numBuffers = Math.min(width - u, numBuffers);
  13150. for (k = u, l = bufferPadding; l < ll; k += width, l++) {
  13151. for (b = 0; b < numBuffers; b++) {
  13152. colBuffers[b][l] = items[k + b];
  13153. }
  13154. }
  13155. currentBuffer = numBuffers;
  13156. }
  13157. currentBuffer--;
  13158. var buffer = colBuffers[currentBuffer];
  13159. this.extend(buffer, bufferPadding, height);
  13160. this.filter(buffer, bufferPadding, height);
  13161. if (currentBuffer === 0) {
  13162. k = u - numBuffers + 1;
  13163. for (l = bufferPadding; l < ll; k += width, l++) {
  13164. for (b = 0; b < numBuffers; b++) {
  13165. items[k + b] = colBuffers[b][l];
  13166. }
  13167. }
  13168. }
  13169. }
  13170. }
  13171. return {
  13172. width,
  13173. height,
  13174. items
  13175. };
  13176. };
  13177. return Transform;
  13178. }();
  13179. var IrreversibleTransform = function IrreversibleTransformClosure() {
  13180. function IrreversibleTransform() {
  13181. Transform.call(this);
  13182. }
  13183. IrreversibleTransform.prototype = Object.create(Transform.prototype);
  13184. IrreversibleTransform.prototype.filter = function irreversibleTransformFilter(x, offset, length) {
  13185. var len = length >> 1;
  13186. offset = offset | 0;
  13187. var j, n, current, next;
  13188. var alpha = -1.586134342059924;
  13189. var beta = -0.052980118572961;
  13190. var gamma = 0.882911075530934;
  13191. var delta = 0.443506852043971;
  13192. var K = 1.230174104914001;
  13193. var K_ = 1 / K;
  13194. j = offset - 3;
  13195. for (n = len + 4; n--; j += 2) {
  13196. x[j] *= K_;
  13197. }
  13198. j = offset - 2;
  13199. current = delta * x[j - 1];
  13200. for (n = len + 3; n--; j += 2) {
  13201. next = delta * x[j + 1];
  13202. x[j] = K * x[j] - current - next;
  13203. if (n--) {
  13204. j += 2;
  13205. current = delta * x[j + 1];
  13206. x[j] = K * x[j] - current - next;
  13207. } else {
  13208. break;
  13209. }
  13210. }
  13211. j = offset - 1;
  13212. current = gamma * x[j - 1];
  13213. for (n = len + 2; n--; j += 2) {
  13214. next = gamma * x[j + 1];
  13215. x[j] -= current + next;
  13216. if (n--) {
  13217. j += 2;
  13218. current = gamma * x[j + 1];
  13219. x[j] -= current + next;
  13220. } else {
  13221. break;
  13222. }
  13223. }
  13224. j = offset;
  13225. current = beta * x[j - 1];
  13226. for (n = len + 1; n--; j += 2) {
  13227. next = beta * x[j + 1];
  13228. x[j] -= current + next;
  13229. if (n--) {
  13230. j += 2;
  13231. current = beta * x[j + 1];
  13232. x[j] -= current + next;
  13233. } else {
  13234. break;
  13235. }
  13236. }
  13237. if (len !== 0) {
  13238. j = offset + 1;
  13239. current = alpha * x[j - 1];
  13240. for (n = len; n--; j += 2) {
  13241. next = alpha * x[j + 1];
  13242. x[j] -= current + next;
  13243. if (n--) {
  13244. j += 2;
  13245. current = alpha * x[j + 1];
  13246. x[j] -= current + next;
  13247. } else {
  13248. break;
  13249. }
  13250. }
  13251. }
  13252. };
  13253. return IrreversibleTransform;
  13254. }();
  13255. var ReversibleTransform = function ReversibleTransformClosure() {
  13256. function ReversibleTransform() {
  13257. Transform.call(this);
  13258. }
  13259. ReversibleTransform.prototype = Object.create(Transform.prototype);
  13260. ReversibleTransform.prototype.filter = function reversibleTransformFilter(x, offset, length) {
  13261. var len = length >> 1;
  13262. offset = offset | 0;
  13263. var j, n;
  13264. for (j = offset, n = len + 1; n--; j += 2) {
  13265. x[j] -= x[j - 1] + x[j + 1] + 2 >> 2;
  13266. }
  13267. for (j = offset + 1, n = len; n--; j += 2) {
  13268. x[j] += x[j - 1] + x[j + 1] >> 1;
  13269. }
  13270. };
  13271. return ReversibleTransform;
  13272. }();
  13273. return JpxImage;
  13274. }();
  13275. exports.JpxImage = JpxImage;
  13276. /***/ }),
  13277. /* 22 */
  13278. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  13279. Object.defineProperty(exports, "__esModule", ({
  13280. value: true
  13281. }));
  13282. exports.PDF20 = exports.PDF17 = exports.CipherTransformFactory = exports.calculateSHA512 = exports.calculateSHA384 = exports.calculateSHA256 = exports.calculateMD5 = exports.ARCFourCipher = exports.AES256Cipher = exports.AES128Cipher = void 0;
  13283. var _util = __w_pdfjs_require__(2);
  13284. var _primitives = __w_pdfjs_require__(5);
  13285. var _stream = __w_pdfjs_require__(12);
  13286. var ARCFourCipher = function ARCFourCipherClosure() {
  13287. function ARCFourCipher(key) {
  13288. this.a = 0;
  13289. this.b = 0;
  13290. var s = new Uint8Array(256);
  13291. var i,
  13292. j = 0,
  13293. tmp,
  13294. keyLength = key.length;
  13295. for (i = 0; i < 256; ++i) {
  13296. s[i] = i;
  13297. }
  13298. for (i = 0; i < 256; ++i) {
  13299. tmp = s[i];
  13300. j = j + tmp + key[i % keyLength] & 0xff;
  13301. s[i] = s[j];
  13302. s[j] = tmp;
  13303. }
  13304. this.s = s;
  13305. }
  13306. ARCFourCipher.prototype = {
  13307. encryptBlock: function ARCFourCipher_encryptBlock(data) {
  13308. var i,
  13309. n = data.length,
  13310. tmp,
  13311. tmp2;
  13312. var a = this.a,
  13313. b = this.b,
  13314. s = this.s;
  13315. var output = new Uint8Array(n);
  13316. for (i = 0; i < n; ++i) {
  13317. a = a + 1 & 0xff;
  13318. tmp = s[a];
  13319. b = b + tmp & 0xff;
  13320. tmp2 = s[b];
  13321. s[a] = tmp2;
  13322. s[b] = tmp;
  13323. output[i] = data[i] ^ s[tmp + tmp2 & 0xff];
  13324. }
  13325. this.a = a;
  13326. this.b = b;
  13327. return output;
  13328. }
  13329. };
  13330. ARCFourCipher.prototype.decryptBlock = ARCFourCipher.prototype.encryptBlock;
  13331. ARCFourCipher.prototype.encrypt = ARCFourCipher.prototype.encryptBlock;
  13332. return ARCFourCipher;
  13333. }();
  13334. exports.ARCFourCipher = ARCFourCipher;
  13335. var calculateMD5 = function calculateMD5Closure() {
  13336. var r = new Uint8Array([7, 12, 17, 22, 7, 12, 17, 22, 7, 12, 17, 22, 7, 12, 17, 22, 5, 9, 14, 20, 5, 9, 14, 20, 5, 9, 14, 20, 5, 9, 14, 20, 4, 11, 16, 23, 4, 11, 16, 23, 4, 11, 16, 23, 4, 11, 16, 23, 6, 10, 15, 21, 6, 10, 15, 21, 6, 10, 15, 21, 6, 10, 15, 21]);
  13337. var k = new Int32Array([-680876936, -389564586, 606105819, -1044525330, -176418897, 1200080426, -1473231341, -45705983, 1770035416, -1958414417, -42063, -1990404162, 1804603682, -40341101, -1502002290, 1236535329, -165796510, -1069501632, 643717713, -373897302, -701558691, 38016083, -660478335, -405537848, 568446438, -1019803690, -187363961, 1163531501, -1444681467, -51403784, 1735328473, -1926607734, -378558, -2022574463, 1839030562, -35309556, -1530992060, 1272893353, -155497632, -1094730640, 681279174, -358537222, -722521979, 76029189, -640364487, -421815835, 530742520, -995338651, -198630844, 1126891415, -1416354905, -57434055, 1700485571, -1894986606, -1051523, -2054922799, 1873313359, -30611744, -1560198380, 1309151649, -145523070, -1120210379, 718787259, -343485551]);
  13338. function hash(data, offset, length) {
  13339. var h0 = 1732584193,
  13340. h1 = -271733879,
  13341. h2 = -1732584194,
  13342. h3 = 271733878;
  13343. var paddedLength = length + 72 & ~63;
  13344. var padded = new Uint8Array(paddedLength);
  13345. var i, j, n;
  13346. for (i = 0; i < length; ++i) {
  13347. padded[i] = data[offset++];
  13348. }
  13349. padded[i++] = 0x80;
  13350. n = paddedLength - 8;
  13351. while (i < n) {
  13352. padded[i++] = 0;
  13353. }
  13354. padded[i++] = length << 3 & 0xff;
  13355. padded[i++] = length >> 5 & 0xff;
  13356. padded[i++] = length >> 13 & 0xff;
  13357. padded[i++] = length >> 21 & 0xff;
  13358. padded[i++] = length >>> 29 & 0xff;
  13359. padded[i++] = 0;
  13360. padded[i++] = 0;
  13361. padded[i++] = 0;
  13362. var w = new Int32Array(16);
  13363. for (i = 0; i < paddedLength;) {
  13364. for (j = 0; j < 16; ++j, i += 4) {
  13365. w[j] = padded[i] | padded[i + 1] << 8 | padded[i + 2] << 16 | padded[i + 3] << 24;
  13366. }
  13367. var a = h0,
  13368. b = h1,
  13369. c = h2,
  13370. d = h3,
  13371. f,
  13372. g;
  13373. for (j = 0; j < 64; ++j) {
  13374. if (j < 16) {
  13375. f = b & c | ~b & d;
  13376. g = j;
  13377. } else if (j < 32) {
  13378. f = d & b | ~d & c;
  13379. g = 5 * j + 1 & 15;
  13380. } else if (j < 48) {
  13381. f = b ^ c ^ d;
  13382. g = 3 * j + 5 & 15;
  13383. } else {
  13384. f = c ^ (b | ~d);
  13385. g = 7 * j & 15;
  13386. }
  13387. var tmp = d,
  13388. rotateArg = a + f + k[j] + w[g] | 0,
  13389. rotate = r[j];
  13390. d = c;
  13391. c = b;
  13392. b = b + (rotateArg << rotate | rotateArg >>> 32 - rotate) | 0;
  13393. a = tmp;
  13394. }
  13395. h0 = h0 + a | 0;
  13396. h1 = h1 + b | 0;
  13397. h2 = h2 + c | 0;
  13398. h3 = h3 + d | 0;
  13399. }
  13400. return new Uint8Array([h0 & 0xFF, h0 >> 8 & 0xFF, h0 >> 16 & 0xFF, h0 >>> 24 & 0xFF, h1 & 0xFF, h1 >> 8 & 0xFF, h1 >> 16 & 0xFF, h1 >>> 24 & 0xFF, h2 & 0xFF, h2 >> 8 & 0xFF, h2 >> 16 & 0xFF, h2 >>> 24 & 0xFF, h3 & 0xFF, h3 >> 8 & 0xFF, h3 >> 16 & 0xFF, h3 >>> 24 & 0xFF]);
  13401. }
  13402. return hash;
  13403. }();
  13404. exports.calculateMD5 = calculateMD5;
  13405. var Word64 = function Word64Closure() {
  13406. function Word64(highInteger, lowInteger) {
  13407. this.high = highInteger | 0;
  13408. this.low = lowInteger | 0;
  13409. }
  13410. Word64.prototype = {
  13411. and: function Word64_and(word) {
  13412. this.high &= word.high;
  13413. this.low &= word.low;
  13414. },
  13415. xor: function Word64_xor(word) {
  13416. this.high ^= word.high;
  13417. this.low ^= word.low;
  13418. },
  13419. or: function Word64_or(word) {
  13420. this.high |= word.high;
  13421. this.low |= word.low;
  13422. },
  13423. shiftRight: function Word64_shiftRight(places) {
  13424. if (places >= 32) {
  13425. this.low = this.high >>> places - 32 | 0;
  13426. this.high = 0;
  13427. } else {
  13428. this.low = this.low >>> places | this.high << 32 - places;
  13429. this.high = this.high >>> places | 0;
  13430. }
  13431. },
  13432. shiftLeft: function Word64_shiftLeft(places) {
  13433. if (places >= 32) {
  13434. this.high = this.low << places - 32;
  13435. this.low = 0;
  13436. } else {
  13437. this.high = this.high << places | this.low >>> 32 - places;
  13438. this.low = this.low << places;
  13439. }
  13440. },
  13441. rotateRight: function Word64_rotateRight(places) {
  13442. var low, high;
  13443. if (places & 32) {
  13444. high = this.low;
  13445. low = this.high;
  13446. } else {
  13447. low = this.low;
  13448. high = this.high;
  13449. }
  13450. places &= 31;
  13451. this.low = low >>> places | high << 32 - places;
  13452. this.high = high >>> places | low << 32 - places;
  13453. },
  13454. not: function Word64_not() {
  13455. this.high = ~this.high;
  13456. this.low = ~this.low;
  13457. },
  13458. add: function Word64_add(word) {
  13459. var lowAdd = (this.low >>> 0) + (word.low >>> 0);
  13460. var highAdd = (this.high >>> 0) + (word.high >>> 0);
  13461. if (lowAdd > 0xffffffff) {
  13462. highAdd += 1;
  13463. }
  13464. this.low = lowAdd | 0;
  13465. this.high = highAdd | 0;
  13466. },
  13467. copyTo: function Word64_copyTo(bytes, offset) {
  13468. bytes[offset] = this.high >>> 24 & 0xff;
  13469. bytes[offset + 1] = this.high >> 16 & 0xff;
  13470. bytes[offset + 2] = this.high >> 8 & 0xff;
  13471. bytes[offset + 3] = this.high & 0xff;
  13472. bytes[offset + 4] = this.low >>> 24 & 0xff;
  13473. bytes[offset + 5] = this.low >> 16 & 0xff;
  13474. bytes[offset + 6] = this.low >> 8 & 0xff;
  13475. bytes[offset + 7] = this.low & 0xff;
  13476. },
  13477. assign: function Word64_assign(word) {
  13478. this.high = word.high;
  13479. this.low = word.low;
  13480. }
  13481. };
  13482. return Word64;
  13483. }();
  13484. var calculateSHA256 = function calculateSHA256Closure() {
  13485. function rotr(x, n) {
  13486. return x >>> n | x << 32 - n;
  13487. }
  13488. function ch(x, y, z) {
  13489. return x & y ^ ~x & z;
  13490. }
  13491. function maj(x, y, z) {
  13492. return x & y ^ x & z ^ y & z;
  13493. }
  13494. function sigma(x) {
  13495. return rotr(x, 2) ^ rotr(x, 13) ^ rotr(x, 22);
  13496. }
  13497. function sigmaPrime(x) {
  13498. return rotr(x, 6) ^ rotr(x, 11) ^ rotr(x, 25);
  13499. }
  13500. function littleSigma(x) {
  13501. return rotr(x, 7) ^ rotr(x, 18) ^ x >>> 3;
  13502. }
  13503. function littleSigmaPrime(x) {
  13504. return rotr(x, 17) ^ rotr(x, 19) ^ x >>> 10;
  13505. }
  13506. var k = [0x428a2f98, 0x71374491, 0xb5c0fbcf, 0xe9b5dba5, 0x3956c25b, 0x59f111f1, 0x923f82a4, 0xab1c5ed5, 0xd807aa98, 0x12835b01, 0x243185be, 0x550c7dc3, 0x72be5d74, 0x80deb1fe, 0x9bdc06a7, 0xc19bf174, 0xe49b69c1, 0xefbe4786, 0x0fc19dc6, 0x240ca1cc, 0x2de92c6f, 0x4a7484aa, 0x5cb0a9dc, 0x76f988da, 0x983e5152, 0xa831c66d, 0xb00327c8, 0xbf597fc7, 0xc6e00bf3, 0xd5a79147, 0x06ca6351, 0x14292967, 0x27b70a85, 0x2e1b2138, 0x4d2c6dfc, 0x53380d13, 0x650a7354, 0x766a0abb, 0x81c2c92e, 0x92722c85, 0xa2bfe8a1, 0xa81a664b, 0xc24b8b70, 0xc76c51a3, 0xd192e819, 0xd6990624, 0xf40e3585, 0x106aa070, 0x19a4c116, 0x1e376c08, 0x2748774c, 0x34b0bcb5, 0x391c0cb3, 0x4ed8aa4a, 0x5b9cca4f, 0x682e6ff3, 0x748f82ee, 0x78a5636f, 0x84c87814, 0x8cc70208, 0x90befffa, 0xa4506ceb, 0xbef9a3f7, 0xc67178f2];
  13507. function hash(data, offset, length) {
  13508. var h0 = 0x6a09e667,
  13509. h1 = 0xbb67ae85,
  13510. h2 = 0x3c6ef372,
  13511. h3 = 0xa54ff53a,
  13512. h4 = 0x510e527f,
  13513. h5 = 0x9b05688c,
  13514. h6 = 0x1f83d9ab,
  13515. h7 = 0x5be0cd19;
  13516. var paddedLength = Math.ceil((length + 9) / 64) * 64;
  13517. var padded = new Uint8Array(paddedLength);
  13518. var i, j, n;
  13519. for (i = 0; i < length; ++i) {
  13520. padded[i] = data[offset++];
  13521. }
  13522. padded[i++] = 0x80;
  13523. n = paddedLength - 8;
  13524. while (i < n) {
  13525. padded[i++] = 0;
  13526. }
  13527. padded[i++] = 0;
  13528. padded[i++] = 0;
  13529. padded[i++] = 0;
  13530. padded[i++] = length >>> 29 & 0xff;
  13531. padded[i++] = length >> 21 & 0xff;
  13532. padded[i++] = length >> 13 & 0xff;
  13533. padded[i++] = length >> 5 & 0xff;
  13534. padded[i++] = length << 3 & 0xff;
  13535. var w = new Uint32Array(64);
  13536. for (i = 0; i < paddedLength;) {
  13537. for (j = 0; j < 16; ++j) {
  13538. w[j] = padded[i] << 24 | padded[i + 1] << 16 | padded[i + 2] << 8 | padded[i + 3];
  13539. i += 4;
  13540. }
  13541. for (j = 16; j < 64; ++j) {
  13542. w[j] = littleSigmaPrime(w[j - 2]) + w[j - 7] + littleSigma(w[j - 15]) + w[j - 16] | 0;
  13543. }
  13544. var a = h0,
  13545. b = h1,
  13546. c = h2,
  13547. d = h3,
  13548. e = h4,
  13549. f = h5,
  13550. g = h6,
  13551. h = h7,
  13552. t1,
  13553. t2;
  13554. for (j = 0; j < 64; ++j) {
  13555. t1 = h + sigmaPrime(e) + ch(e, f, g) + k[j] + w[j];
  13556. t2 = sigma(a) + maj(a, b, c);
  13557. h = g;
  13558. g = f;
  13559. f = e;
  13560. e = d + t1 | 0;
  13561. d = c;
  13562. c = b;
  13563. b = a;
  13564. a = t1 + t2 | 0;
  13565. }
  13566. h0 = h0 + a | 0;
  13567. h1 = h1 + b | 0;
  13568. h2 = h2 + c | 0;
  13569. h3 = h3 + d | 0;
  13570. h4 = h4 + e | 0;
  13571. h5 = h5 + f | 0;
  13572. h6 = h6 + g | 0;
  13573. h7 = h7 + h | 0;
  13574. }
  13575. return new Uint8Array([h0 >> 24 & 0xFF, h0 >> 16 & 0xFF, h0 >> 8 & 0xFF, h0 & 0xFF, h1 >> 24 & 0xFF, h1 >> 16 & 0xFF, h1 >> 8 & 0xFF, h1 & 0xFF, h2 >> 24 & 0xFF, h2 >> 16 & 0xFF, h2 >> 8 & 0xFF, h2 & 0xFF, h3 >> 24 & 0xFF, h3 >> 16 & 0xFF, h3 >> 8 & 0xFF, h3 & 0xFF, h4 >> 24 & 0xFF, h4 >> 16 & 0xFF, h4 >> 8 & 0xFF, h4 & 0xFF, h5 >> 24 & 0xFF, h5 >> 16 & 0xFF, h5 >> 8 & 0xFF, h5 & 0xFF, h6 >> 24 & 0xFF, h6 >> 16 & 0xFF, h6 >> 8 & 0xFF, h6 & 0xFF, h7 >> 24 & 0xFF, h7 >> 16 & 0xFF, h7 >> 8 & 0xFF, h7 & 0xFF]);
  13576. }
  13577. return hash;
  13578. }();
  13579. exports.calculateSHA256 = calculateSHA256;
  13580. var calculateSHA512 = function calculateSHA512Closure() {
  13581. function ch(result, x, y, z, tmp) {
  13582. result.assign(x);
  13583. result.and(y);
  13584. tmp.assign(x);
  13585. tmp.not();
  13586. tmp.and(z);
  13587. result.xor(tmp);
  13588. }
  13589. function maj(result, x, y, z, tmp) {
  13590. result.assign(x);
  13591. result.and(y);
  13592. tmp.assign(x);
  13593. tmp.and(z);
  13594. result.xor(tmp);
  13595. tmp.assign(y);
  13596. tmp.and(z);
  13597. result.xor(tmp);
  13598. }
  13599. function sigma(result, x, tmp) {
  13600. result.assign(x);
  13601. result.rotateRight(28);
  13602. tmp.assign(x);
  13603. tmp.rotateRight(34);
  13604. result.xor(tmp);
  13605. tmp.assign(x);
  13606. tmp.rotateRight(39);
  13607. result.xor(tmp);
  13608. }
  13609. function sigmaPrime(result, x, tmp) {
  13610. result.assign(x);
  13611. result.rotateRight(14);
  13612. tmp.assign(x);
  13613. tmp.rotateRight(18);
  13614. result.xor(tmp);
  13615. tmp.assign(x);
  13616. tmp.rotateRight(41);
  13617. result.xor(tmp);
  13618. }
  13619. function littleSigma(result, x, tmp) {
  13620. result.assign(x);
  13621. result.rotateRight(1);
  13622. tmp.assign(x);
  13623. tmp.rotateRight(8);
  13624. result.xor(tmp);
  13625. tmp.assign(x);
  13626. tmp.shiftRight(7);
  13627. result.xor(tmp);
  13628. }
  13629. function littleSigmaPrime(result, x, tmp) {
  13630. result.assign(x);
  13631. result.rotateRight(19);
  13632. tmp.assign(x);
  13633. tmp.rotateRight(61);
  13634. result.xor(tmp);
  13635. tmp.assign(x);
  13636. tmp.shiftRight(6);
  13637. result.xor(tmp);
  13638. }
  13639. var k = [new Word64(0x428a2f98, 0xd728ae22), new Word64(0x71374491, 0x23ef65cd), new Word64(0xb5c0fbcf, 0xec4d3b2f), new Word64(0xe9b5dba5, 0x8189dbbc), new Word64(0x3956c25b, 0xf348b538), new Word64(0x59f111f1, 0xb605d019), new Word64(0x923f82a4, 0xaf194f9b), new Word64(0xab1c5ed5, 0xda6d8118), new Word64(0xd807aa98, 0xa3030242), new Word64(0x12835b01, 0x45706fbe), new Word64(0x243185be, 0x4ee4b28c), new Word64(0x550c7dc3, 0xd5ffb4e2), new Word64(0x72be5d74, 0xf27b896f), new Word64(0x80deb1fe, 0x3b1696b1), new Word64(0x9bdc06a7, 0x25c71235), new Word64(0xc19bf174, 0xcf692694), new Word64(0xe49b69c1, 0x9ef14ad2), new Word64(0xefbe4786, 0x384f25e3), new Word64(0x0fc19dc6, 0x8b8cd5b5), new Word64(0x240ca1cc, 0x77ac9c65), new Word64(0x2de92c6f, 0x592b0275), new Word64(0x4a7484aa, 0x6ea6e483), new Word64(0x5cb0a9dc, 0xbd41fbd4), new Word64(0x76f988da, 0x831153b5), new Word64(0x983e5152, 0xee66dfab), new Word64(0xa831c66d, 0x2db43210), new Word64(0xb00327c8, 0x98fb213f), new Word64(0xbf597fc7, 0xbeef0ee4), new Word64(0xc6e00bf3, 0x3da88fc2), new Word64(0xd5a79147, 0x930aa725), new Word64(0x06ca6351, 0xe003826f), new Word64(0x14292967, 0x0a0e6e70), new Word64(0x27b70a85, 0x46d22ffc), new Word64(0x2e1b2138, 0x5c26c926), new Word64(0x4d2c6dfc, 0x5ac42aed), new Word64(0x53380d13, 0x9d95b3df), new Word64(0x650a7354, 0x8baf63de), new Word64(0x766a0abb, 0x3c77b2a8), new Word64(0x81c2c92e, 0x47edaee6), new Word64(0x92722c85, 0x1482353b), new Word64(0xa2bfe8a1, 0x4cf10364), new Word64(0xa81a664b, 0xbc423001), new Word64(0xc24b8b70, 0xd0f89791), new Word64(0xc76c51a3, 0x0654be30), new Word64(0xd192e819, 0xd6ef5218), new Word64(0xd6990624, 0x5565a910), new Word64(0xf40e3585, 0x5771202a), new Word64(0x106aa070, 0x32bbd1b8), new Word64(0x19a4c116, 0xb8d2d0c8), new Word64(0x1e376c08, 0x5141ab53), new Word64(0x2748774c, 0xdf8eeb99), new Word64(0x34b0bcb5, 0xe19b48a8), new Word64(0x391c0cb3, 0xc5c95a63), new Word64(0x4ed8aa4a, 0xe3418acb), new Word64(0x5b9cca4f, 0x7763e373), new Word64(0x682e6ff3, 0xd6b2b8a3), new Word64(0x748f82ee, 0x5defb2fc), new Word64(0x78a5636f, 0x43172f60), new Word64(0x84c87814, 0xa1f0ab72), new Word64(0x8cc70208, 0x1a6439ec), new Word64(0x90befffa, 0x23631e28), new Word64(0xa4506ceb, 0xde82bde9), new Word64(0xbef9a3f7, 0xb2c67915), new Word64(0xc67178f2, 0xe372532b), new Word64(0xca273ece, 0xea26619c), new Word64(0xd186b8c7, 0x21c0c207), new Word64(0xeada7dd6, 0xcde0eb1e), new Word64(0xf57d4f7f, 0xee6ed178), new Word64(0x06f067aa, 0x72176fba), new Word64(0x0a637dc5, 0xa2c898a6), new Word64(0x113f9804, 0xbef90dae), new Word64(0x1b710b35, 0x131c471b), new Word64(0x28db77f5, 0x23047d84), new Word64(0x32caab7b, 0x40c72493), new Word64(0x3c9ebe0a, 0x15c9bebc), new Word64(0x431d67c4, 0x9c100d4c), new Word64(0x4cc5d4be, 0xcb3e42b6), new Word64(0x597f299c, 0xfc657e2a), new Word64(0x5fcb6fab, 0x3ad6faec), new Word64(0x6c44198c, 0x4a475817)];
  13640. function hash(data, offset, length, mode384) {
  13641. mode384 = !!mode384;
  13642. var h0, h1, h2, h3, h4, h5, h6, h7;
  13643. if (!mode384) {
  13644. h0 = new Word64(0x6a09e667, 0xf3bcc908);
  13645. h1 = new Word64(0xbb67ae85, 0x84caa73b);
  13646. h2 = new Word64(0x3c6ef372, 0xfe94f82b);
  13647. h3 = new Word64(0xa54ff53a, 0x5f1d36f1);
  13648. h4 = new Word64(0x510e527f, 0xade682d1);
  13649. h5 = new Word64(0x9b05688c, 0x2b3e6c1f);
  13650. h6 = new Word64(0x1f83d9ab, 0xfb41bd6b);
  13651. h7 = new Word64(0x5be0cd19, 0x137e2179);
  13652. } else {
  13653. h0 = new Word64(0xcbbb9d5d, 0xc1059ed8);
  13654. h1 = new Word64(0x629a292a, 0x367cd507);
  13655. h2 = new Word64(0x9159015a, 0x3070dd17);
  13656. h3 = new Word64(0x152fecd8, 0xf70e5939);
  13657. h4 = new Word64(0x67332667, 0xffc00b31);
  13658. h5 = new Word64(0x8eb44a87, 0x68581511);
  13659. h6 = new Word64(0xdb0c2e0d, 0x64f98fa7);
  13660. h7 = new Word64(0x47b5481d, 0xbefa4fa4);
  13661. }
  13662. var paddedLength = Math.ceil((length + 17) / 128) * 128;
  13663. var padded = new Uint8Array(paddedLength);
  13664. var i, j, n;
  13665. for (i = 0; i < length; ++i) {
  13666. padded[i] = data[offset++];
  13667. }
  13668. padded[i++] = 0x80;
  13669. n = paddedLength - 16;
  13670. while (i < n) {
  13671. padded[i++] = 0;
  13672. }
  13673. padded[i++] = 0;
  13674. padded[i++] = 0;
  13675. padded[i++] = 0;
  13676. padded[i++] = 0;
  13677. padded[i++] = 0;
  13678. padded[i++] = 0;
  13679. padded[i++] = 0;
  13680. padded[i++] = 0;
  13681. padded[i++] = 0;
  13682. padded[i++] = 0;
  13683. padded[i++] = 0;
  13684. padded[i++] = length >>> 29 & 0xff;
  13685. padded[i++] = length >> 21 & 0xff;
  13686. padded[i++] = length >> 13 & 0xff;
  13687. padded[i++] = length >> 5 & 0xff;
  13688. padded[i++] = length << 3 & 0xff;
  13689. var w = new Array(80);
  13690. for (i = 0; i < 80; i++) {
  13691. w[i] = new Word64(0, 0);
  13692. }
  13693. var a = new Word64(0, 0),
  13694. b = new Word64(0, 0),
  13695. c = new Word64(0, 0);
  13696. var d = new Word64(0, 0),
  13697. e = new Word64(0, 0),
  13698. f = new Word64(0, 0);
  13699. var g = new Word64(0, 0),
  13700. h = new Word64(0, 0);
  13701. var t1 = new Word64(0, 0),
  13702. t2 = new Word64(0, 0);
  13703. var tmp1 = new Word64(0, 0),
  13704. tmp2 = new Word64(0, 0),
  13705. tmp3;
  13706. for (i = 0; i < paddedLength;) {
  13707. for (j = 0; j < 16; ++j) {
  13708. w[j].high = padded[i] << 24 | padded[i + 1] << 16 | padded[i + 2] << 8 | padded[i + 3];
  13709. w[j].low = padded[i + 4] << 24 | padded[i + 5] << 16 | padded[i + 6] << 8 | padded[i + 7];
  13710. i += 8;
  13711. }
  13712. for (j = 16; j < 80; ++j) {
  13713. tmp3 = w[j];
  13714. littleSigmaPrime(tmp3, w[j - 2], tmp2);
  13715. tmp3.add(w[j - 7]);
  13716. littleSigma(tmp1, w[j - 15], tmp2);
  13717. tmp3.add(tmp1);
  13718. tmp3.add(w[j - 16]);
  13719. }
  13720. a.assign(h0);
  13721. b.assign(h1);
  13722. c.assign(h2);
  13723. d.assign(h3);
  13724. e.assign(h4);
  13725. f.assign(h5);
  13726. g.assign(h6);
  13727. h.assign(h7);
  13728. for (j = 0; j < 80; ++j) {
  13729. t1.assign(h);
  13730. sigmaPrime(tmp1, e, tmp2);
  13731. t1.add(tmp1);
  13732. ch(tmp1, e, f, g, tmp2);
  13733. t1.add(tmp1);
  13734. t1.add(k[j]);
  13735. t1.add(w[j]);
  13736. sigma(t2, a, tmp2);
  13737. maj(tmp1, a, b, c, tmp2);
  13738. t2.add(tmp1);
  13739. tmp3 = h;
  13740. h = g;
  13741. g = f;
  13742. f = e;
  13743. d.add(t1);
  13744. e = d;
  13745. d = c;
  13746. c = b;
  13747. b = a;
  13748. tmp3.assign(t1);
  13749. tmp3.add(t2);
  13750. a = tmp3;
  13751. }
  13752. h0.add(a);
  13753. h1.add(b);
  13754. h2.add(c);
  13755. h3.add(d);
  13756. h4.add(e);
  13757. h5.add(f);
  13758. h6.add(g);
  13759. h7.add(h);
  13760. }
  13761. var result;
  13762. if (!mode384) {
  13763. result = new Uint8Array(64);
  13764. h0.copyTo(result, 0);
  13765. h1.copyTo(result, 8);
  13766. h2.copyTo(result, 16);
  13767. h3.copyTo(result, 24);
  13768. h4.copyTo(result, 32);
  13769. h5.copyTo(result, 40);
  13770. h6.copyTo(result, 48);
  13771. h7.copyTo(result, 56);
  13772. } else {
  13773. result = new Uint8Array(48);
  13774. h0.copyTo(result, 0);
  13775. h1.copyTo(result, 8);
  13776. h2.copyTo(result, 16);
  13777. h3.copyTo(result, 24);
  13778. h4.copyTo(result, 32);
  13779. h5.copyTo(result, 40);
  13780. }
  13781. return result;
  13782. }
  13783. return hash;
  13784. }();
  13785. exports.calculateSHA512 = calculateSHA512;
  13786. var calculateSHA384 = function calculateSHA384Closure() {
  13787. function hash(data, offset, length) {
  13788. return calculateSHA512(data, offset, length, true);
  13789. }
  13790. return hash;
  13791. }();
  13792. exports.calculateSHA384 = calculateSHA384;
  13793. var NullCipher = function NullCipherClosure() {
  13794. function NullCipher() {}
  13795. NullCipher.prototype = {
  13796. decryptBlock: function NullCipher_decryptBlock(data) {
  13797. return data;
  13798. },
  13799. encrypt: function NullCipher_encrypt(data) {
  13800. return data;
  13801. }
  13802. };
  13803. return NullCipher;
  13804. }();
  13805. class AESBaseCipher {
  13806. constructor() {
  13807. if (this.constructor === AESBaseCipher) {
  13808. (0, _util.unreachable)("Cannot initialize AESBaseCipher.");
  13809. }
  13810. this._s = new Uint8Array([0x63, 0x7c, 0x77, 0x7b, 0xf2, 0x6b, 0x6f, 0xc5, 0x30, 0x01, 0x67, 0x2b, 0xfe, 0xd7, 0xab, 0x76, 0xca, 0x82, 0xc9, 0x7d, 0xfa, 0x59, 0x47, 0xf0, 0xad, 0xd4, 0xa2, 0xaf, 0x9c, 0xa4, 0x72, 0xc0, 0xb7, 0xfd, 0x93, 0x26, 0x36, 0x3f, 0xf7, 0xcc, 0x34, 0xa5, 0xe5, 0xf1, 0x71, 0xd8, 0x31, 0x15, 0x04, 0xc7, 0x23, 0xc3, 0x18, 0x96, 0x05, 0x9a, 0x07, 0x12, 0x80, 0xe2, 0xeb, 0x27, 0xb2, 0x75, 0x09, 0x83, 0x2c, 0x1a, 0x1b, 0x6e, 0x5a, 0xa0, 0x52, 0x3b, 0xd6, 0xb3, 0x29, 0xe3, 0x2f, 0x84, 0x53, 0xd1, 0x00, 0xed, 0x20, 0xfc, 0xb1, 0x5b, 0x6a, 0xcb, 0xbe, 0x39, 0x4a, 0x4c, 0x58, 0xcf, 0xd0, 0xef, 0xaa, 0xfb, 0x43, 0x4d, 0x33, 0x85, 0x45, 0xf9, 0x02, 0x7f, 0x50, 0x3c, 0x9f, 0xa8, 0x51, 0xa3, 0x40, 0x8f, 0x92, 0x9d, 0x38, 0xf5, 0xbc, 0xb6, 0xda, 0x21, 0x10, 0xff, 0xf3, 0xd2, 0xcd, 0x0c, 0x13, 0xec, 0x5f, 0x97, 0x44, 0x17, 0xc4, 0xa7, 0x7e, 0x3d, 0x64, 0x5d, 0x19, 0x73, 0x60, 0x81, 0x4f, 0xdc, 0x22, 0x2a, 0x90, 0x88, 0x46, 0xee, 0xb8, 0x14, 0xde, 0x5e, 0x0b, 0xdb, 0xe0, 0x32, 0x3a, 0x0a, 0x49, 0x06, 0x24, 0x5c, 0xc2, 0xd3, 0xac, 0x62, 0x91, 0x95, 0xe4, 0x79, 0xe7, 0xc8, 0x37, 0x6d, 0x8d, 0xd5, 0x4e, 0xa9, 0x6c, 0x56, 0xf4, 0xea, 0x65, 0x7a, 0xae, 0x08, 0xba, 0x78, 0x25, 0x2e, 0x1c, 0xa6, 0xb4, 0xc6, 0xe8, 0xdd, 0x74, 0x1f, 0x4b, 0xbd, 0x8b, 0x8a, 0x70, 0x3e, 0xb5, 0x66, 0x48, 0x03, 0xf6, 0x0e, 0x61, 0x35, 0x57, 0xb9, 0x86, 0xc1, 0x1d, 0x9e, 0xe1, 0xf8, 0x98, 0x11, 0x69, 0xd9, 0x8e, 0x94, 0x9b, 0x1e, 0x87, 0xe9, 0xce, 0x55, 0x28, 0xdf, 0x8c, 0xa1, 0x89, 0x0d, 0xbf, 0xe6, 0x42, 0x68, 0x41, 0x99, 0x2d, 0x0f, 0xb0, 0x54, 0xbb, 0x16]);
  13811. this._inv_s = new Uint8Array([0x52, 0x09, 0x6a, 0xd5, 0x30, 0x36, 0xa5, 0x38, 0xbf, 0x40, 0xa3, 0x9e, 0x81, 0xf3, 0xd7, 0xfb, 0x7c, 0xe3, 0x39, 0x82, 0x9b, 0x2f, 0xff, 0x87, 0x34, 0x8e, 0x43, 0x44, 0xc4, 0xde, 0xe9, 0xcb, 0x54, 0x7b, 0x94, 0x32, 0xa6, 0xc2, 0x23, 0x3d, 0xee, 0x4c, 0x95, 0x0b, 0x42, 0xfa, 0xc3, 0x4e, 0x08, 0x2e, 0xa1, 0x66, 0x28, 0xd9, 0x24, 0xb2, 0x76, 0x5b, 0xa2, 0x49, 0x6d, 0x8b, 0xd1, 0x25, 0x72, 0xf8, 0xf6, 0x64, 0x86, 0x68, 0x98, 0x16, 0xd4, 0xa4, 0x5c, 0xcc, 0x5d, 0x65, 0xb6, 0x92, 0x6c, 0x70, 0x48, 0x50, 0xfd, 0xed, 0xb9, 0xda, 0x5e, 0x15, 0x46, 0x57, 0xa7, 0x8d, 0x9d, 0x84, 0x90, 0xd8, 0xab, 0x00, 0x8c, 0xbc, 0xd3, 0x0a, 0xf7, 0xe4, 0x58, 0x05, 0xb8, 0xb3, 0x45, 0x06, 0xd0, 0x2c, 0x1e, 0x8f, 0xca, 0x3f, 0x0f, 0x02, 0xc1, 0xaf, 0xbd, 0x03, 0x01, 0x13, 0x8a, 0x6b, 0x3a, 0x91, 0x11, 0x41, 0x4f, 0x67, 0xdc, 0xea, 0x97, 0xf2, 0xcf, 0xce, 0xf0, 0xb4, 0xe6, 0x73, 0x96, 0xac, 0x74, 0x22, 0xe7, 0xad, 0x35, 0x85, 0xe2, 0xf9, 0x37, 0xe8, 0x1c, 0x75, 0xdf, 0x6e, 0x47, 0xf1, 0x1a, 0x71, 0x1d, 0x29, 0xc5, 0x89, 0x6f, 0xb7, 0x62, 0x0e, 0xaa, 0x18, 0xbe, 0x1b, 0xfc, 0x56, 0x3e, 0x4b, 0xc6, 0xd2, 0x79, 0x20, 0x9a, 0xdb, 0xc0, 0xfe, 0x78, 0xcd, 0x5a, 0xf4, 0x1f, 0xdd, 0xa8, 0x33, 0x88, 0x07, 0xc7, 0x31, 0xb1, 0x12, 0x10, 0x59, 0x27, 0x80, 0xec, 0x5f, 0x60, 0x51, 0x7f, 0xa9, 0x19, 0xb5, 0x4a, 0x0d, 0x2d, 0xe5, 0x7a, 0x9f, 0x93, 0xc9, 0x9c, 0xef, 0xa0, 0xe0, 0x3b, 0x4d, 0xae, 0x2a, 0xf5, 0xb0, 0xc8, 0xeb, 0xbb, 0x3c, 0x83, 0x53, 0x99, 0x61, 0x17, 0x2b, 0x04, 0x7e, 0xba, 0x77, 0xd6, 0x26, 0xe1, 0x69, 0x14, 0x63, 0x55, 0x21, 0x0c, 0x7d]);
  13812. this._mix = new Uint32Array([0x00000000, 0x0e090d0b, 0x1c121a16, 0x121b171d, 0x3824342c, 0x362d3927, 0x24362e3a, 0x2a3f2331, 0x70486858, 0x7e416553, 0x6c5a724e, 0x62537f45, 0x486c5c74, 0x4665517f, 0x547e4662, 0x5a774b69, 0xe090d0b0, 0xee99ddbb, 0xfc82caa6, 0xf28bc7ad, 0xd8b4e49c, 0xd6bde997, 0xc4a6fe8a, 0xcaaff381, 0x90d8b8e8, 0x9ed1b5e3, 0x8ccaa2fe, 0x82c3aff5, 0xa8fc8cc4, 0xa6f581cf, 0xb4ee96d2, 0xbae79bd9, 0xdb3bbb7b, 0xd532b670, 0xc729a16d, 0xc920ac66, 0xe31f8f57, 0xed16825c, 0xff0d9541, 0xf104984a, 0xab73d323, 0xa57ade28, 0xb761c935, 0xb968c43e, 0x9357e70f, 0x9d5eea04, 0x8f45fd19, 0x814cf012, 0x3bab6bcb, 0x35a266c0, 0x27b971dd, 0x29b07cd6, 0x038f5fe7, 0x0d8652ec, 0x1f9d45f1, 0x119448fa, 0x4be30393, 0x45ea0e98, 0x57f11985, 0x59f8148e, 0x73c737bf, 0x7dce3ab4, 0x6fd52da9, 0x61dc20a2, 0xad766df6, 0xa37f60fd, 0xb16477e0, 0xbf6d7aeb, 0x955259da, 0x9b5b54d1, 0x894043cc, 0x87494ec7, 0xdd3e05ae, 0xd33708a5, 0xc12c1fb8, 0xcf2512b3, 0xe51a3182, 0xeb133c89, 0xf9082b94, 0xf701269f, 0x4de6bd46, 0x43efb04d, 0x51f4a750, 0x5ffdaa5b, 0x75c2896a, 0x7bcb8461, 0x69d0937c, 0x67d99e77, 0x3daed51e, 0x33a7d815, 0x21bccf08, 0x2fb5c203, 0x058ae132, 0x0b83ec39, 0x1998fb24, 0x1791f62f, 0x764dd68d, 0x7844db86, 0x6a5fcc9b, 0x6456c190, 0x4e69e2a1, 0x4060efaa, 0x527bf8b7, 0x5c72f5bc, 0x0605bed5, 0x080cb3de, 0x1a17a4c3, 0x141ea9c8, 0x3e218af9, 0x302887f2, 0x223390ef, 0x2c3a9de4, 0x96dd063d, 0x98d40b36, 0x8acf1c2b, 0x84c61120, 0xaef93211, 0xa0f03f1a, 0xb2eb2807, 0xbce2250c, 0xe6956e65, 0xe89c636e, 0xfa877473, 0xf48e7978, 0xdeb15a49, 0xd0b85742, 0xc2a3405f, 0xccaa4d54, 0x41ecdaf7, 0x4fe5d7fc, 0x5dfec0e1, 0x53f7cdea, 0x79c8eedb, 0x77c1e3d0, 0x65daf4cd, 0x6bd3f9c6, 0x31a4b2af, 0x3fadbfa4, 0x2db6a8b9, 0x23bfa5b2, 0x09808683, 0x07898b88, 0x15929c95, 0x1b9b919e, 0xa17c0a47, 0xaf75074c, 0xbd6e1051, 0xb3671d5a, 0x99583e6b, 0x97513360, 0x854a247d, 0x8b432976, 0xd134621f, 0xdf3d6f14, 0xcd267809, 0xc32f7502, 0xe9105633, 0xe7195b38, 0xf5024c25, 0xfb0b412e, 0x9ad7618c, 0x94de6c87, 0x86c57b9a, 0x88cc7691, 0xa2f355a0, 0xacfa58ab, 0xbee14fb6, 0xb0e842bd, 0xea9f09d4, 0xe49604df, 0xf68d13c2, 0xf8841ec9, 0xd2bb3df8, 0xdcb230f3, 0xcea927ee, 0xc0a02ae5, 0x7a47b13c, 0x744ebc37, 0x6655ab2a, 0x685ca621, 0x42638510, 0x4c6a881b, 0x5e719f06, 0x5078920d, 0x0a0fd964, 0x0406d46f, 0x161dc372, 0x1814ce79, 0x322bed48, 0x3c22e043, 0x2e39f75e, 0x2030fa55, 0xec9ab701, 0xe293ba0a, 0xf088ad17, 0xfe81a01c, 0xd4be832d, 0xdab78e26, 0xc8ac993b, 0xc6a59430, 0x9cd2df59, 0x92dbd252, 0x80c0c54f, 0x8ec9c844, 0xa4f6eb75, 0xaaffe67e, 0xb8e4f163, 0xb6edfc68, 0x0c0a67b1, 0x02036aba, 0x10187da7, 0x1e1170ac, 0x342e539d, 0x3a275e96, 0x283c498b, 0x26354480, 0x7c420fe9, 0x724b02e2, 0x605015ff, 0x6e5918f4, 0x44663bc5, 0x4a6f36ce, 0x587421d3, 0x567d2cd8, 0x37a10c7a, 0x39a80171, 0x2bb3166c, 0x25ba1b67, 0x0f853856, 0x018c355d, 0x13972240, 0x1d9e2f4b, 0x47e96422, 0x49e06929, 0x5bfb7e34, 0x55f2733f, 0x7fcd500e, 0x71c45d05, 0x63df4a18, 0x6dd64713, 0xd731dcca, 0xd938d1c1, 0xcb23c6dc, 0xc52acbd7, 0xef15e8e6, 0xe11ce5ed, 0xf307f2f0, 0xfd0efffb, 0xa779b492, 0xa970b999, 0xbb6bae84, 0xb562a38f, 0x9f5d80be, 0x91548db5, 0x834f9aa8, 0x8d4697a3]);
  13813. this._mixCol = new Uint8Array(256);
  13814. for (let i = 0; i < 256; i++) {
  13815. if (i < 128) {
  13816. this._mixCol[i] = i << 1;
  13817. } else {
  13818. this._mixCol[i] = i << 1 ^ 0x1b;
  13819. }
  13820. }
  13821. this.buffer = new Uint8Array(16);
  13822. this.bufferPosition = 0;
  13823. }
  13824. _expandKey(cipherKey) {
  13825. (0, _util.unreachable)("Cannot call `_expandKey` on the base class");
  13826. }
  13827. _decrypt(input, key) {
  13828. let t, u, v;
  13829. const state = new Uint8Array(16);
  13830. state.set(input);
  13831. for (let j = 0, k = this._keySize; j < 16; ++j, ++k) {
  13832. state[j] ^= key[k];
  13833. }
  13834. for (let i = this._cyclesOfRepetition - 1; i >= 1; --i) {
  13835. t = state[13];
  13836. state[13] = state[9];
  13837. state[9] = state[5];
  13838. state[5] = state[1];
  13839. state[1] = t;
  13840. t = state[14];
  13841. u = state[10];
  13842. state[14] = state[6];
  13843. state[10] = state[2];
  13844. state[6] = t;
  13845. state[2] = u;
  13846. t = state[15];
  13847. u = state[11];
  13848. v = state[7];
  13849. state[15] = state[3];
  13850. state[11] = t;
  13851. state[7] = u;
  13852. state[3] = v;
  13853. for (let j = 0; j < 16; ++j) {
  13854. state[j] = this._inv_s[state[j]];
  13855. }
  13856. for (let j = 0, k = i * 16; j < 16; ++j, ++k) {
  13857. state[j] ^= key[k];
  13858. }
  13859. for (let j = 0; j < 16; j += 4) {
  13860. const s0 = this._mix[state[j]];
  13861. const s1 = this._mix[state[j + 1]];
  13862. const s2 = this._mix[state[j + 2]];
  13863. const s3 = this._mix[state[j + 3]];
  13864. t = s0 ^ s1 >>> 8 ^ s1 << 24 ^ s2 >>> 16 ^ s2 << 16 ^ s3 >>> 24 ^ s3 << 8;
  13865. state[j] = t >>> 24 & 0xff;
  13866. state[j + 1] = t >> 16 & 0xff;
  13867. state[j + 2] = t >> 8 & 0xff;
  13868. state[j + 3] = t & 0xff;
  13869. }
  13870. }
  13871. t = state[13];
  13872. state[13] = state[9];
  13873. state[9] = state[5];
  13874. state[5] = state[1];
  13875. state[1] = t;
  13876. t = state[14];
  13877. u = state[10];
  13878. state[14] = state[6];
  13879. state[10] = state[2];
  13880. state[6] = t;
  13881. state[2] = u;
  13882. t = state[15];
  13883. u = state[11];
  13884. v = state[7];
  13885. state[15] = state[3];
  13886. state[11] = t;
  13887. state[7] = u;
  13888. state[3] = v;
  13889. for (let j = 0; j < 16; ++j) {
  13890. state[j] = this._inv_s[state[j]];
  13891. state[j] ^= key[j];
  13892. }
  13893. return state;
  13894. }
  13895. _encrypt(input, key) {
  13896. const s = this._s;
  13897. let t, u, v;
  13898. const state = new Uint8Array(16);
  13899. state.set(input);
  13900. for (let j = 0; j < 16; ++j) {
  13901. state[j] ^= key[j];
  13902. }
  13903. for (let i = 1; i < this._cyclesOfRepetition; i++) {
  13904. for (let j = 0; j < 16; ++j) {
  13905. state[j] = s[state[j]];
  13906. }
  13907. v = state[1];
  13908. state[1] = state[5];
  13909. state[5] = state[9];
  13910. state[9] = state[13];
  13911. state[13] = v;
  13912. v = state[2];
  13913. u = state[6];
  13914. state[2] = state[10];
  13915. state[6] = state[14];
  13916. state[10] = v;
  13917. state[14] = u;
  13918. v = state[3];
  13919. u = state[7];
  13920. t = state[11];
  13921. state[3] = state[15];
  13922. state[7] = v;
  13923. state[11] = u;
  13924. state[15] = t;
  13925. for (let j = 0; j < 16; j += 4) {
  13926. const s0 = state[j + 0];
  13927. const s1 = state[j + 1];
  13928. const s2 = state[j + 2];
  13929. const s3 = state[j + 3];
  13930. t = s0 ^ s1 ^ s2 ^ s3;
  13931. state[j + 0] ^= t ^ this._mixCol[s0 ^ s1];
  13932. state[j + 1] ^= t ^ this._mixCol[s1 ^ s2];
  13933. state[j + 2] ^= t ^ this._mixCol[s2 ^ s3];
  13934. state[j + 3] ^= t ^ this._mixCol[s3 ^ s0];
  13935. }
  13936. for (let j = 0, k = i * 16; j < 16; ++j, ++k) {
  13937. state[j] ^= key[k];
  13938. }
  13939. }
  13940. for (let j = 0; j < 16; ++j) {
  13941. state[j] = s[state[j]];
  13942. }
  13943. v = state[1];
  13944. state[1] = state[5];
  13945. state[5] = state[9];
  13946. state[9] = state[13];
  13947. state[13] = v;
  13948. v = state[2];
  13949. u = state[6];
  13950. state[2] = state[10];
  13951. state[6] = state[14];
  13952. state[10] = v;
  13953. state[14] = u;
  13954. v = state[3];
  13955. u = state[7];
  13956. t = state[11];
  13957. state[3] = state[15];
  13958. state[7] = v;
  13959. state[11] = u;
  13960. state[15] = t;
  13961. for (let j = 0, k = this._keySize; j < 16; ++j, ++k) {
  13962. state[j] ^= key[k];
  13963. }
  13964. return state;
  13965. }
  13966. _decryptBlock2(data, finalize) {
  13967. const sourceLength = data.length;
  13968. let buffer = this.buffer,
  13969. bufferLength = this.bufferPosition;
  13970. const result = [];
  13971. let iv = this.iv;
  13972. for (let i = 0; i < sourceLength; ++i) {
  13973. buffer[bufferLength] = data[i];
  13974. ++bufferLength;
  13975. if (bufferLength < 16) {
  13976. continue;
  13977. }
  13978. const plain = this._decrypt(buffer, this._key);
  13979. for (let j = 0; j < 16; ++j) {
  13980. plain[j] ^= iv[j];
  13981. }
  13982. iv = buffer;
  13983. result.push(plain);
  13984. buffer = new Uint8Array(16);
  13985. bufferLength = 0;
  13986. }
  13987. this.buffer = buffer;
  13988. this.bufferLength = bufferLength;
  13989. this.iv = iv;
  13990. if (result.length === 0) {
  13991. return new Uint8Array(0);
  13992. }
  13993. let outputLength = 16 * result.length;
  13994. if (finalize) {
  13995. const lastBlock = result[result.length - 1];
  13996. let psLen = lastBlock[15];
  13997. if (psLen <= 16) {
  13998. for (let i = 15, ii = 16 - psLen; i >= ii; --i) {
  13999. if (lastBlock[i] !== psLen) {
  14000. psLen = 0;
  14001. break;
  14002. }
  14003. }
  14004. outputLength -= psLen;
  14005. result[result.length - 1] = lastBlock.subarray(0, 16 - psLen);
  14006. }
  14007. }
  14008. const output = new Uint8Array(outputLength);
  14009. for (let i = 0, j = 0, ii = result.length; i < ii; ++i, j += 16) {
  14010. output.set(result[i], j);
  14011. }
  14012. return output;
  14013. }
  14014. decryptBlock(data, finalize, iv = null) {
  14015. const sourceLength = data.length;
  14016. const buffer = this.buffer;
  14017. let bufferLength = this.bufferPosition;
  14018. if (iv) {
  14019. this.iv = iv;
  14020. } else {
  14021. for (let i = 0; bufferLength < 16 && i < sourceLength; ++i, ++bufferLength) {
  14022. buffer[bufferLength] = data[i];
  14023. }
  14024. if (bufferLength < 16) {
  14025. this.bufferLength = bufferLength;
  14026. return new Uint8Array(0);
  14027. }
  14028. this.iv = buffer;
  14029. data = data.subarray(16);
  14030. }
  14031. this.buffer = new Uint8Array(16);
  14032. this.bufferLength = 0;
  14033. this.decryptBlock = this._decryptBlock2;
  14034. return this.decryptBlock(data, finalize);
  14035. }
  14036. encrypt(data, iv) {
  14037. const sourceLength = data.length;
  14038. let buffer = this.buffer,
  14039. bufferLength = this.bufferPosition;
  14040. const result = [];
  14041. if (!iv) {
  14042. iv = new Uint8Array(16);
  14043. }
  14044. for (let i = 0; i < sourceLength; ++i) {
  14045. buffer[bufferLength] = data[i];
  14046. ++bufferLength;
  14047. if (bufferLength < 16) {
  14048. continue;
  14049. }
  14050. for (let j = 0; j < 16; ++j) {
  14051. buffer[j] ^= iv[j];
  14052. }
  14053. const cipher = this._encrypt(buffer, this._key);
  14054. iv = cipher;
  14055. result.push(cipher);
  14056. buffer = new Uint8Array(16);
  14057. bufferLength = 0;
  14058. }
  14059. this.buffer = buffer;
  14060. this.bufferLength = bufferLength;
  14061. this.iv = iv;
  14062. if (result.length === 0) {
  14063. return new Uint8Array(0);
  14064. }
  14065. const outputLength = 16 * result.length;
  14066. const output = new Uint8Array(outputLength);
  14067. for (let i = 0, j = 0, ii = result.length; i < ii; ++i, j += 16) {
  14068. output.set(result[i], j);
  14069. }
  14070. return output;
  14071. }
  14072. }
  14073. class AES128Cipher extends AESBaseCipher {
  14074. constructor(key) {
  14075. super();
  14076. this._cyclesOfRepetition = 10;
  14077. this._keySize = 160;
  14078. this._rcon = new Uint8Array([0x8d, 0x01, 0x02, 0x04, 0x08, 0x10, 0x20, 0x40, 0x80, 0x1b, 0x36, 0x6c, 0xd8, 0xab, 0x4d, 0x9a, 0x2f, 0x5e, 0xbc, 0x63, 0xc6, 0x97, 0x35, 0x6a, 0xd4, 0xb3, 0x7d, 0xfa, 0xef, 0xc5, 0x91, 0x39, 0x72, 0xe4, 0xd3, 0xbd, 0x61, 0xc2, 0x9f, 0x25, 0x4a, 0x94, 0x33, 0x66, 0xcc, 0x83, 0x1d, 0x3a, 0x74, 0xe8, 0xcb, 0x8d, 0x01, 0x02, 0x04, 0x08, 0x10, 0x20, 0x40, 0x80, 0x1b, 0x36, 0x6c, 0xd8, 0xab, 0x4d, 0x9a, 0x2f, 0x5e, 0xbc, 0x63, 0xc6, 0x97, 0x35, 0x6a, 0xd4, 0xb3, 0x7d, 0xfa, 0xef, 0xc5, 0x91, 0x39, 0x72, 0xe4, 0xd3, 0xbd, 0x61, 0xc2, 0x9f, 0x25, 0x4a, 0x94, 0x33, 0x66, 0xcc, 0x83, 0x1d, 0x3a, 0x74, 0xe8, 0xcb, 0x8d, 0x01, 0x02, 0x04, 0x08, 0x10, 0x20, 0x40, 0x80, 0x1b, 0x36, 0x6c, 0xd8, 0xab, 0x4d, 0x9a, 0x2f, 0x5e, 0xbc, 0x63, 0xc6, 0x97, 0x35, 0x6a, 0xd4, 0xb3, 0x7d, 0xfa, 0xef, 0xc5, 0x91, 0x39, 0x72, 0xe4, 0xd3, 0xbd, 0x61, 0xc2, 0x9f, 0x25, 0x4a, 0x94, 0x33, 0x66, 0xcc, 0x83, 0x1d, 0x3a, 0x74, 0xe8, 0xcb, 0x8d, 0x01, 0x02, 0x04, 0x08, 0x10, 0x20, 0x40, 0x80, 0x1b, 0x36, 0x6c, 0xd8, 0xab, 0x4d, 0x9a, 0x2f, 0x5e, 0xbc, 0x63, 0xc6, 0x97, 0x35, 0x6a, 0xd4, 0xb3, 0x7d, 0xfa, 0xef, 0xc5, 0x91, 0x39, 0x72, 0xe4, 0xd3, 0xbd, 0x61, 0xc2, 0x9f, 0x25, 0x4a, 0x94, 0x33, 0x66, 0xcc, 0x83, 0x1d, 0x3a, 0x74, 0xe8, 0xcb, 0x8d, 0x01, 0x02, 0x04, 0x08, 0x10, 0x20, 0x40, 0x80, 0x1b, 0x36, 0x6c, 0xd8, 0xab, 0x4d, 0x9a, 0x2f, 0x5e, 0xbc, 0x63, 0xc6, 0x97, 0x35, 0x6a, 0xd4, 0xb3, 0x7d, 0xfa, 0xef, 0xc5, 0x91, 0x39, 0x72, 0xe4, 0xd3, 0xbd, 0x61, 0xc2, 0x9f, 0x25, 0x4a, 0x94, 0x33, 0x66, 0xcc, 0x83, 0x1d, 0x3a, 0x74, 0xe8, 0xcb, 0x8d]);
  14079. this._key = this._expandKey(key);
  14080. }
  14081. _expandKey(cipherKey) {
  14082. const b = 176;
  14083. const s = this._s;
  14084. const rcon = this._rcon;
  14085. const result = new Uint8Array(b);
  14086. result.set(cipherKey);
  14087. for (let j = 16, i = 1; j < b; ++i) {
  14088. let t1 = result[j - 3];
  14089. let t2 = result[j - 2];
  14090. let t3 = result[j - 1];
  14091. let t4 = result[j - 4];
  14092. t1 = s[t1];
  14093. t2 = s[t2];
  14094. t3 = s[t3];
  14095. t4 = s[t4];
  14096. t1 = t1 ^ rcon[i];
  14097. for (let n = 0; n < 4; ++n) {
  14098. result[j] = t1 ^= result[j - 16];
  14099. j++;
  14100. result[j] = t2 ^= result[j - 16];
  14101. j++;
  14102. result[j] = t3 ^= result[j - 16];
  14103. j++;
  14104. result[j] = t4 ^= result[j - 16];
  14105. j++;
  14106. }
  14107. }
  14108. return result;
  14109. }
  14110. }
  14111. exports.AES128Cipher = AES128Cipher;
  14112. class AES256Cipher extends AESBaseCipher {
  14113. constructor(key) {
  14114. super();
  14115. this._cyclesOfRepetition = 14;
  14116. this._keySize = 224;
  14117. this._key = this._expandKey(key);
  14118. }
  14119. _expandKey(cipherKey) {
  14120. const b = 240;
  14121. const s = this._s;
  14122. const result = new Uint8Array(b);
  14123. result.set(cipherKey);
  14124. let r = 1;
  14125. let t1, t2, t3, t4;
  14126. for (let j = 32, i = 1; j < b; ++i) {
  14127. if (j % 32 === 16) {
  14128. t1 = s[t1];
  14129. t2 = s[t2];
  14130. t3 = s[t3];
  14131. t4 = s[t4];
  14132. } else if (j % 32 === 0) {
  14133. t1 = result[j - 3];
  14134. t2 = result[j - 2];
  14135. t3 = result[j - 1];
  14136. t4 = result[j - 4];
  14137. t1 = s[t1];
  14138. t2 = s[t2];
  14139. t3 = s[t3];
  14140. t4 = s[t4];
  14141. t1 = t1 ^ r;
  14142. if ((r <<= 1) >= 256) {
  14143. r = (r ^ 0x1b) & 0xff;
  14144. }
  14145. }
  14146. for (let n = 0; n < 4; ++n) {
  14147. result[j] = t1 ^= result[j - 32];
  14148. j++;
  14149. result[j] = t2 ^= result[j - 32];
  14150. j++;
  14151. result[j] = t3 ^= result[j - 32];
  14152. j++;
  14153. result[j] = t4 ^= result[j - 32];
  14154. j++;
  14155. }
  14156. }
  14157. return result;
  14158. }
  14159. }
  14160. exports.AES256Cipher = AES256Cipher;
  14161. var PDF17 = function PDF17Closure() {
  14162. function compareByteArrays(array1, array2) {
  14163. if (array1.length !== array2.length) {
  14164. return false;
  14165. }
  14166. for (var i = 0; i < array1.length; i++) {
  14167. if (array1[i] !== array2[i]) {
  14168. return false;
  14169. }
  14170. }
  14171. return true;
  14172. }
  14173. function PDF17() {}
  14174. PDF17.prototype = {
  14175. checkOwnerPassword: function PDF17_checkOwnerPassword(password, ownerValidationSalt, userBytes, ownerPassword) {
  14176. var hashData = new Uint8Array(password.length + 56);
  14177. hashData.set(password, 0);
  14178. hashData.set(ownerValidationSalt, password.length);
  14179. hashData.set(userBytes, password.length + ownerValidationSalt.length);
  14180. var result = calculateSHA256(hashData, 0, hashData.length);
  14181. return compareByteArrays(result, ownerPassword);
  14182. },
  14183. checkUserPassword: function PDF17_checkUserPassword(password, userValidationSalt, userPassword) {
  14184. var hashData = new Uint8Array(password.length + 8);
  14185. hashData.set(password, 0);
  14186. hashData.set(userValidationSalt, password.length);
  14187. var result = calculateSHA256(hashData, 0, hashData.length);
  14188. return compareByteArrays(result, userPassword);
  14189. },
  14190. getOwnerKey: function PDF17_getOwnerKey(password, ownerKeySalt, userBytes, ownerEncryption) {
  14191. var hashData = new Uint8Array(password.length + 56);
  14192. hashData.set(password, 0);
  14193. hashData.set(ownerKeySalt, password.length);
  14194. hashData.set(userBytes, password.length + ownerKeySalt.length);
  14195. var key = calculateSHA256(hashData, 0, hashData.length);
  14196. var cipher = new AES256Cipher(key);
  14197. return cipher.decryptBlock(ownerEncryption, false, new Uint8Array(16));
  14198. },
  14199. getUserKey: function PDF17_getUserKey(password, userKeySalt, userEncryption) {
  14200. var hashData = new Uint8Array(password.length + 8);
  14201. hashData.set(password, 0);
  14202. hashData.set(userKeySalt, password.length);
  14203. var key = calculateSHA256(hashData, 0, hashData.length);
  14204. var cipher = new AES256Cipher(key);
  14205. return cipher.decryptBlock(userEncryption, false, new Uint8Array(16));
  14206. }
  14207. };
  14208. return PDF17;
  14209. }();
  14210. exports.PDF17 = PDF17;
  14211. var PDF20 = function PDF20Closure() {
  14212. function concatArrays(array1, array2) {
  14213. var t = new Uint8Array(array1.length + array2.length);
  14214. t.set(array1, 0);
  14215. t.set(array2, array1.length);
  14216. return t;
  14217. }
  14218. function calculatePDF20Hash(password, input, userBytes) {
  14219. var k = calculateSHA256(input, 0, input.length).subarray(0, 32);
  14220. var e = [0];
  14221. var i = 0;
  14222. while (i < 64 || e[e.length - 1] > i - 32) {
  14223. var arrayLength = password.length + k.length + userBytes.length;
  14224. var k1 = new Uint8Array(arrayLength * 64);
  14225. var array = concatArrays(password, k);
  14226. array = concatArrays(array, userBytes);
  14227. for (var j = 0, pos = 0; j < 64; j++, pos += arrayLength) {
  14228. k1.set(array, pos);
  14229. }
  14230. var cipher = new AES128Cipher(k.subarray(0, 16));
  14231. e = cipher.encrypt(k1, k.subarray(16, 32));
  14232. var remainder = 0;
  14233. for (var z = 0; z < 16; z++) {
  14234. remainder *= 256 % 3;
  14235. remainder %= 3;
  14236. remainder += (e[z] >>> 0) % 3;
  14237. remainder %= 3;
  14238. }
  14239. if (remainder === 0) {
  14240. k = calculateSHA256(e, 0, e.length);
  14241. } else if (remainder === 1) {
  14242. k = calculateSHA384(e, 0, e.length);
  14243. } else if (remainder === 2) {
  14244. k = calculateSHA512(e, 0, e.length);
  14245. }
  14246. i++;
  14247. }
  14248. return k.subarray(0, 32);
  14249. }
  14250. function PDF20() {}
  14251. function compareByteArrays(array1, array2) {
  14252. if (array1.length !== array2.length) {
  14253. return false;
  14254. }
  14255. for (var i = 0; i < array1.length; i++) {
  14256. if (array1[i] !== array2[i]) {
  14257. return false;
  14258. }
  14259. }
  14260. return true;
  14261. }
  14262. PDF20.prototype = {
  14263. hash: function PDF20_hash(password, concatBytes, userBytes) {
  14264. return calculatePDF20Hash(password, concatBytes, userBytes);
  14265. },
  14266. checkOwnerPassword: function PDF20_checkOwnerPassword(password, ownerValidationSalt, userBytes, ownerPassword) {
  14267. var hashData = new Uint8Array(password.length + 56);
  14268. hashData.set(password, 0);
  14269. hashData.set(ownerValidationSalt, password.length);
  14270. hashData.set(userBytes, password.length + ownerValidationSalt.length);
  14271. var result = calculatePDF20Hash(password, hashData, userBytes);
  14272. return compareByteArrays(result, ownerPassword);
  14273. },
  14274. checkUserPassword: function PDF20_checkUserPassword(password, userValidationSalt, userPassword) {
  14275. var hashData = new Uint8Array(password.length + 8);
  14276. hashData.set(password, 0);
  14277. hashData.set(userValidationSalt, password.length);
  14278. var result = calculatePDF20Hash(password, hashData, []);
  14279. return compareByteArrays(result, userPassword);
  14280. },
  14281. getOwnerKey: function PDF20_getOwnerKey(password, ownerKeySalt, userBytes, ownerEncryption) {
  14282. var hashData = new Uint8Array(password.length + 56);
  14283. hashData.set(password, 0);
  14284. hashData.set(ownerKeySalt, password.length);
  14285. hashData.set(userBytes, password.length + ownerKeySalt.length);
  14286. var key = calculatePDF20Hash(password, hashData, userBytes);
  14287. var cipher = new AES256Cipher(key);
  14288. return cipher.decryptBlock(ownerEncryption, false, new Uint8Array(16));
  14289. },
  14290. getUserKey: function PDF20_getUserKey(password, userKeySalt, userEncryption) {
  14291. var hashData = new Uint8Array(password.length + 8);
  14292. hashData.set(password, 0);
  14293. hashData.set(userKeySalt, password.length);
  14294. var key = calculatePDF20Hash(password, hashData, []);
  14295. var cipher = new AES256Cipher(key);
  14296. return cipher.decryptBlock(userEncryption, false, new Uint8Array(16));
  14297. }
  14298. };
  14299. return PDF20;
  14300. }();
  14301. exports.PDF20 = PDF20;
  14302. var CipherTransform = function CipherTransformClosure() {
  14303. function CipherTransform(stringCipherConstructor, streamCipherConstructor) {
  14304. this.StringCipherConstructor = stringCipherConstructor;
  14305. this.StreamCipherConstructor = streamCipherConstructor;
  14306. }
  14307. CipherTransform.prototype = {
  14308. createStream: function CipherTransform_createStream(stream, length) {
  14309. var cipher = new this.StreamCipherConstructor();
  14310. return new _stream.DecryptStream(stream, length, function cipherTransformDecryptStream(data, finalize) {
  14311. return cipher.decryptBlock(data, finalize);
  14312. });
  14313. },
  14314. decryptString: function CipherTransform_decryptString(s) {
  14315. var cipher = new this.StringCipherConstructor();
  14316. var data = (0, _util.stringToBytes)(s);
  14317. data = cipher.decryptBlock(data, true);
  14318. return (0, _util.bytesToString)(data);
  14319. },
  14320. encryptString: function CipherTransform_encryptString(s) {
  14321. const cipher = new this.StringCipherConstructor();
  14322. if (cipher instanceof AESBaseCipher) {
  14323. const strLen = s.length;
  14324. const pad = 16 - strLen % 16;
  14325. if (pad !== 16) {
  14326. s = s.padEnd(16 * Math.ceil(strLen / 16), String.fromCharCode(pad));
  14327. }
  14328. const iv = new Uint8Array(16);
  14329. if (typeof crypto !== "undefined") {
  14330. crypto.getRandomValues(iv);
  14331. } else {
  14332. for (let i = 0; i < 16; i++) {
  14333. iv[i] = Math.floor(256 * Math.random());
  14334. }
  14335. }
  14336. let data = (0, _util.stringToBytes)(s);
  14337. data = cipher.encrypt(data, iv);
  14338. const buf = new Uint8Array(16 + data.length);
  14339. buf.set(iv);
  14340. buf.set(data, 16);
  14341. return (0, _util.bytesToString)(buf);
  14342. }
  14343. let data = (0, _util.stringToBytes)(s);
  14344. data = cipher.encrypt(data);
  14345. return (0, _util.bytesToString)(data);
  14346. }
  14347. };
  14348. return CipherTransform;
  14349. }();
  14350. var CipherTransformFactory = function CipherTransformFactoryClosure() {
  14351. var defaultPasswordBytes = new Uint8Array([0x28, 0xBF, 0x4E, 0x5E, 0x4E, 0x75, 0x8A, 0x41, 0x64, 0x00, 0x4E, 0x56, 0xFF, 0xFA, 0x01, 0x08, 0x2E, 0x2E, 0x00, 0xB6, 0xD0, 0x68, 0x3E, 0x80, 0x2F, 0x0C, 0xA9, 0xFE, 0x64, 0x53, 0x69, 0x7A]);
  14352. function createEncryptionKey20(revision, password, ownerPassword, ownerValidationSalt, ownerKeySalt, uBytes, userPassword, userValidationSalt, userKeySalt, ownerEncryption, userEncryption, perms) {
  14353. if (password) {
  14354. var passwordLength = Math.min(127, password.length);
  14355. password = password.subarray(0, passwordLength);
  14356. } else {
  14357. password = [];
  14358. }
  14359. var pdfAlgorithm;
  14360. if (revision === 6) {
  14361. pdfAlgorithm = new PDF20();
  14362. } else {
  14363. pdfAlgorithm = new PDF17();
  14364. }
  14365. if (pdfAlgorithm.checkUserPassword(password, userValidationSalt, userPassword)) {
  14366. return pdfAlgorithm.getUserKey(password, userKeySalt, userEncryption);
  14367. } else if (password.length && pdfAlgorithm.checkOwnerPassword(password, ownerValidationSalt, uBytes, ownerPassword)) {
  14368. return pdfAlgorithm.getOwnerKey(password, ownerKeySalt, uBytes, ownerEncryption);
  14369. }
  14370. return null;
  14371. }
  14372. function prepareKeyData(fileId, password, ownerPassword, userPassword, flags, revision, keyLength, encryptMetadata) {
  14373. var hashDataSize = 40 + ownerPassword.length + fileId.length;
  14374. var hashData = new Uint8Array(hashDataSize),
  14375. i = 0,
  14376. j,
  14377. n;
  14378. if (password) {
  14379. n = Math.min(32, password.length);
  14380. for (; i < n; ++i) {
  14381. hashData[i] = password[i];
  14382. }
  14383. }
  14384. j = 0;
  14385. while (i < 32) {
  14386. hashData[i++] = defaultPasswordBytes[j++];
  14387. }
  14388. for (j = 0, n = ownerPassword.length; j < n; ++j) {
  14389. hashData[i++] = ownerPassword[j];
  14390. }
  14391. hashData[i++] = flags & 0xff;
  14392. hashData[i++] = flags >> 8 & 0xff;
  14393. hashData[i++] = flags >> 16 & 0xff;
  14394. hashData[i++] = flags >>> 24 & 0xff;
  14395. for (j = 0, n = fileId.length; j < n; ++j) {
  14396. hashData[i++] = fileId[j];
  14397. }
  14398. if (revision >= 4 && !encryptMetadata) {
  14399. hashData[i++] = 0xff;
  14400. hashData[i++] = 0xff;
  14401. hashData[i++] = 0xff;
  14402. hashData[i++] = 0xff;
  14403. }
  14404. var hash = calculateMD5(hashData, 0, i);
  14405. var keyLengthInBytes = keyLength >> 3;
  14406. if (revision >= 3) {
  14407. for (j = 0; j < 50; ++j) {
  14408. hash = calculateMD5(hash, 0, keyLengthInBytes);
  14409. }
  14410. }
  14411. var encryptionKey = hash.subarray(0, keyLengthInBytes);
  14412. var cipher, checkData;
  14413. if (revision >= 3) {
  14414. for (i = 0; i < 32; ++i) {
  14415. hashData[i] = defaultPasswordBytes[i];
  14416. }
  14417. for (j = 0, n = fileId.length; j < n; ++j) {
  14418. hashData[i++] = fileId[j];
  14419. }
  14420. cipher = new ARCFourCipher(encryptionKey);
  14421. checkData = cipher.encryptBlock(calculateMD5(hashData, 0, i));
  14422. n = encryptionKey.length;
  14423. var derivedKey = new Uint8Array(n),
  14424. k;
  14425. for (j = 1; j <= 19; ++j) {
  14426. for (k = 0; k < n; ++k) {
  14427. derivedKey[k] = encryptionKey[k] ^ j;
  14428. }
  14429. cipher = new ARCFourCipher(derivedKey);
  14430. checkData = cipher.encryptBlock(checkData);
  14431. }
  14432. for (j = 0, n = checkData.length; j < n; ++j) {
  14433. if (userPassword[j] !== checkData[j]) {
  14434. return null;
  14435. }
  14436. }
  14437. } else {
  14438. cipher = new ARCFourCipher(encryptionKey);
  14439. checkData = cipher.encryptBlock(defaultPasswordBytes);
  14440. for (j = 0, n = checkData.length; j < n; ++j) {
  14441. if (userPassword[j] !== checkData[j]) {
  14442. return null;
  14443. }
  14444. }
  14445. }
  14446. return encryptionKey;
  14447. }
  14448. function decodeUserPassword(password, ownerPassword, revision, keyLength) {
  14449. var hashData = new Uint8Array(32),
  14450. i = 0,
  14451. j,
  14452. n;
  14453. n = Math.min(32, password.length);
  14454. for (; i < n; ++i) {
  14455. hashData[i] = password[i];
  14456. }
  14457. j = 0;
  14458. while (i < 32) {
  14459. hashData[i++] = defaultPasswordBytes[j++];
  14460. }
  14461. var hash = calculateMD5(hashData, 0, i);
  14462. var keyLengthInBytes = keyLength >> 3;
  14463. if (revision >= 3) {
  14464. for (j = 0; j < 50; ++j) {
  14465. hash = calculateMD5(hash, 0, hash.length);
  14466. }
  14467. }
  14468. var cipher, userPassword;
  14469. if (revision >= 3) {
  14470. userPassword = ownerPassword;
  14471. var derivedKey = new Uint8Array(keyLengthInBytes),
  14472. k;
  14473. for (j = 19; j >= 0; j--) {
  14474. for (k = 0; k < keyLengthInBytes; ++k) {
  14475. derivedKey[k] = hash[k] ^ j;
  14476. }
  14477. cipher = new ARCFourCipher(derivedKey);
  14478. userPassword = cipher.encryptBlock(userPassword);
  14479. }
  14480. } else {
  14481. cipher = new ARCFourCipher(hash.subarray(0, keyLengthInBytes));
  14482. userPassword = cipher.encryptBlock(ownerPassword);
  14483. }
  14484. return userPassword;
  14485. }
  14486. var identityName = _primitives.Name.get("Identity");
  14487. function CipherTransformFactory(dict, fileId, password) {
  14488. var filter = dict.get("Filter");
  14489. if (!(0, _primitives.isName)(filter, "Standard")) {
  14490. throw new _util.FormatError("unknown encryption method");
  14491. }
  14492. this.dict = dict;
  14493. var algorithm = dict.get("V");
  14494. if (!Number.isInteger(algorithm) || algorithm !== 1 && algorithm !== 2 && algorithm !== 4 && algorithm !== 5) {
  14495. throw new _util.FormatError("unsupported encryption algorithm");
  14496. }
  14497. this.algorithm = algorithm;
  14498. var keyLength = dict.get("Length");
  14499. if (!keyLength) {
  14500. if (algorithm <= 3) {
  14501. keyLength = 40;
  14502. } else {
  14503. var cfDict = dict.get("CF");
  14504. var streamCryptoName = dict.get("StmF");
  14505. if ((0, _primitives.isDict)(cfDict) && (0, _primitives.isName)(streamCryptoName)) {
  14506. cfDict.suppressEncryption = true;
  14507. var handlerDict = cfDict.get(streamCryptoName.name);
  14508. keyLength = handlerDict && handlerDict.get("Length") || 128;
  14509. if (keyLength < 40) {
  14510. keyLength <<= 3;
  14511. }
  14512. }
  14513. }
  14514. }
  14515. if (!Number.isInteger(keyLength) || keyLength < 40 || keyLength % 8 !== 0) {
  14516. throw new _util.FormatError("invalid key length");
  14517. }
  14518. var ownerPassword = (0, _util.stringToBytes)(dict.get("O")).subarray(0, 32);
  14519. var userPassword = (0, _util.stringToBytes)(dict.get("U")).subarray(0, 32);
  14520. var flags = dict.get("P");
  14521. var revision = dict.get("R");
  14522. var encryptMetadata = (algorithm === 4 || algorithm === 5) && dict.get("EncryptMetadata") !== false;
  14523. this.encryptMetadata = encryptMetadata;
  14524. var fileIdBytes = (0, _util.stringToBytes)(fileId);
  14525. var passwordBytes;
  14526. if (password) {
  14527. if (revision === 6) {
  14528. try {
  14529. password = (0, _util.utf8StringToString)(password);
  14530. } catch (ex) {
  14531. (0, _util.warn)("CipherTransformFactory: " + "Unable to convert UTF8 encoded password.");
  14532. }
  14533. }
  14534. passwordBytes = (0, _util.stringToBytes)(password);
  14535. }
  14536. var encryptionKey;
  14537. if (algorithm !== 5) {
  14538. encryptionKey = prepareKeyData(fileIdBytes, passwordBytes, ownerPassword, userPassword, flags, revision, keyLength, encryptMetadata);
  14539. } else {
  14540. var ownerValidationSalt = (0, _util.stringToBytes)(dict.get("O")).subarray(32, 40);
  14541. var ownerKeySalt = (0, _util.stringToBytes)(dict.get("O")).subarray(40, 48);
  14542. var uBytes = (0, _util.stringToBytes)(dict.get("U")).subarray(0, 48);
  14543. var userValidationSalt = (0, _util.stringToBytes)(dict.get("U")).subarray(32, 40);
  14544. var userKeySalt = (0, _util.stringToBytes)(dict.get("U")).subarray(40, 48);
  14545. var ownerEncryption = (0, _util.stringToBytes)(dict.get("OE"));
  14546. var userEncryption = (0, _util.stringToBytes)(dict.get("UE"));
  14547. var perms = (0, _util.stringToBytes)(dict.get("Perms"));
  14548. encryptionKey = createEncryptionKey20(revision, passwordBytes, ownerPassword, ownerValidationSalt, ownerKeySalt, uBytes, userPassword, userValidationSalt, userKeySalt, ownerEncryption, userEncryption, perms);
  14549. }
  14550. if (!encryptionKey && !password) {
  14551. throw new _util.PasswordException("No password given", _util.PasswordResponses.NEED_PASSWORD);
  14552. } else if (!encryptionKey && password) {
  14553. var decodedPassword = decodeUserPassword(passwordBytes, ownerPassword, revision, keyLength);
  14554. encryptionKey = prepareKeyData(fileIdBytes, decodedPassword, ownerPassword, userPassword, flags, revision, keyLength, encryptMetadata);
  14555. }
  14556. if (!encryptionKey) {
  14557. throw new _util.PasswordException("Incorrect Password", _util.PasswordResponses.INCORRECT_PASSWORD);
  14558. }
  14559. this.encryptionKey = encryptionKey;
  14560. if (algorithm >= 4) {
  14561. var cf = dict.get("CF");
  14562. if ((0, _primitives.isDict)(cf)) {
  14563. cf.suppressEncryption = true;
  14564. }
  14565. this.cf = cf;
  14566. this.stmf = dict.get("StmF") || identityName;
  14567. this.strf = dict.get("StrF") || identityName;
  14568. this.eff = dict.get("EFF") || this.stmf;
  14569. }
  14570. }
  14571. function buildObjectKey(num, gen, encryptionKey, isAes) {
  14572. var key = new Uint8Array(encryptionKey.length + 9),
  14573. i,
  14574. n;
  14575. for (i = 0, n = encryptionKey.length; i < n; ++i) {
  14576. key[i] = encryptionKey[i];
  14577. }
  14578. key[i++] = num & 0xff;
  14579. key[i++] = num >> 8 & 0xff;
  14580. key[i++] = num >> 16 & 0xff;
  14581. key[i++] = gen & 0xff;
  14582. key[i++] = gen >> 8 & 0xff;
  14583. if (isAes) {
  14584. key[i++] = 0x73;
  14585. key[i++] = 0x41;
  14586. key[i++] = 0x6c;
  14587. key[i++] = 0x54;
  14588. }
  14589. var hash = calculateMD5(key, 0, i);
  14590. return hash.subarray(0, Math.min(encryptionKey.length + 5, 16));
  14591. }
  14592. function buildCipherConstructor(cf, name, num, gen, key) {
  14593. if (!(0, _primitives.isName)(name)) {
  14594. throw new _util.FormatError("Invalid crypt filter name.");
  14595. }
  14596. var cryptFilter = cf.get(name.name);
  14597. var cfm;
  14598. if (cryptFilter !== null && cryptFilter !== undefined) {
  14599. cfm = cryptFilter.get("CFM");
  14600. }
  14601. if (!cfm || cfm.name === "None") {
  14602. return function cipherTransformFactoryBuildCipherConstructorNone() {
  14603. return new NullCipher();
  14604. };
  14605. }
  14606. if (cfm.name === "V2") {
  14607. return function cipherTransformFactoryBuildCipherConstructorV2() {
  14608. return new ARCFourCipher(buildObjectKey(num, gen, key, false));
  14609. };
  14610. }
  14611. if (cfm.name === "AESV2") {
  14612. return function cipherTransformFactoryBuildCipherConstructorAESV2() {
  14613. return new AES128Cipher(buildObjectKey(num, gen, key, true));
  14614. };
  14615. }
  14616. if (cfm.name === "AESV3") {
  14617. return function cipherTransformFactoryBuildCipherConstructorAESV3() {
  14618. return new AES256Cipher(key);
  14619. };
  14620. }
  14621. throw new _util.FormatError("Unknown crypto method");
  14622. }
  14623. CipherTransformFactory.prototype = {
  14624. createCipherTransform: function CipherTransformFactory_createCipherTransform(num, gen) {
  14625. if (this.algorithm === 4 || this.algorithm === 5) {
  14626. return new CipherTransform(buildCipherConstructor(this.cf, this.stmf, num, gen, this.encryptionKey), buildCipherConstructor(this.cf, this.strf, num, gen, this.encryptionKey));
  14627. }
  14628. var key = buildObjectKey(num, gen, this.encryptionKey, false);
  14629. var cipherConstructor = function buildCipherCipherConstructor() {
  14630. return new ARCFourCipher(key);
  14631. };
  14632. return new CipherTransform(cipherConstructor, cipherConstructor);
  14633. }
  14634. };
  14635. return CipherTransformFactory;
  14636. }();
  14637. exports.CipherTransformFactory = CipherTransformFactory;
  14638. /***/ }),
  14639. /* 23 */
  14640. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  14641. Object.defineProperty(exports, "__esModule", ({
  14642. value: true
  14643. }));
  14644. exports.ColorSpace = void 0;
  14645. var _util = __w_pdfjs_require__(2);
  14646. var _primitives = __w_pdfjs_require__(5);
  14647. var _core_utils = __w_pdfjs_require__(8);
  14648. function resizeRgbImage(src, dest, w1, h1, w2, h2, alpha01) {
  14649. const COMPONENTS = 3;
  14650. alpha01 = alpha01 !== 1 ? 0 : alpha01;
  14651. const xRatio = w1 / w2;
  14652. const yRatio = h1 / h2;
  14653. let newIndex = 0,
  14654. oldIndex;
  14655. const xScaled = new Uint16Array(w2);
  14656. const w1Scanline = w1 * COMPONENTS;
  14657. for (let i = 0; i < w2; i++) {
  14658. xScaled[i] = Math.floor(i * xRatio) * COMPONENTS;
  14659. }
  14660. for (let i = 0; i < h2; i++) {
  14661. const py = Math.floor(i * yRatio) * w1Scanline;
  14662. for (let j = 0; j < w2; j++) {
  14663. oldIndex = py + xScaled[j];
  14664. dest[newIndex++] = src[oldIndex++];
  14665. dest[newIndex++] = src[oldIndex++];
  14666. dest[newIndex++] = src[oldIndex++];
  14667. newIndex += alpha01;
  14668. }
  14669. }
  14670. }
  14671. class ColorSpace {
  14672. constructor(name, numComps) {
  14673. if (this.constructor === ColorSpace) {
  14674. (0, _util.unreachable)("Cannot initialize ColorSpace.");
  14675. }
  14676. this.name = name;
  14677. this.numComps = numComps;
  14678. }
  14679. getRgb(src, srcOffset) {
  14680. const rgb = new Uint8ClampedArray(3);
  14681. this.getRgbItem(src, srcOffset, rgb, 0);
  14682. return rgb;
  14683. }
  14684. getRgbItem(src, srcOffset, dest, destOffset) {
  14685. (0, _util.unreachable)("Should not call ColorSpace.getRgbItem");
  14686. }
  14687. getRgbBuffer(src, srcOffset, count, dest, destOffset, bits, alpha01) {
  14688. (0, _util.unreachable)("Should not call ColorSpace.getRgbBuffer");
  14689. }
  14690. getOutputLength(inputLength, alpha01) {
  14691. (0, _util.unreachable)("Should not call ColorSpace.getOutputLength");
  14692. }
  14693. isPassthrough(bits) {
  14694. return false;
  14695. }
  14696. isDefaultDecode(decodeMap, bpc) {
  14697. return ColorSpace.isDefaultDecode(decodeMap, this.numComps);
  14698. }
  14699. fillRgb(dest, originalWidth, originalHeight, width, height, actualHeight, bpc, comps, alpha01) {
  14700. const count = originalWidth * originalHeight;
  14701. let rgbBuf = null;
  14702. const numComponentColors = 1 << bpc;
  14703. const needsResizing = originalHeight !== height || originalWidth !== width;
  14704. if (this.isPassthrough(bpc)) {
  14705. rgbBuf = comps;
  14706. } else if (this.numComps === 1 && count > numComponentColors && this.name !== "DeviceGray" && this.name !== "DeviceRGB") {
  14707. const allColors = bpc <= 8 ? new Uint8Array(numComponentColors) : new Uint16Array(numComponentColors);
  14708. for (let i = 0; i < numComponentColors; i++) {
  14709. allColors[i] = i;
  14710. }
  14711. const colorMap = new Uint8ClampedArray(numComponentColors * 3);
  14712. this.getRgbBuffer(allColors, 0, numComponentColors, colorMap, 0, bpc, 0);
  14713. if (!needsResizing) {
  14714. let destPos = 0;
  14715. for (let i = 0; i < count; ++i) {
  14716. const key = comps[i] * 3;
  14717. dest[destPos++] = colorMap[key];
  14718. dest[destPos++] = colorMap[key + 1];
  14719. dest[destPos++] = colorMap[key + 2];
  14720. destPos += alpha01;
  14721. }
  14722. } else {
  14723. rgbBuf = new Uint8Array(count * 3);
  14724. let rgbPos = 0;
  14725. for (let i = 0; i < count; ++i) {
  14726. const key = comps[i] * 3;
  14727. rgbBuf[rgbPos++] = colorMap[key];
  14728. rgbBuf[rgbPos++] = colorMap[key + 1];
  14729. rgbBuf[rgbPos++] = colorMap[key + 2];
  14730. }
  14731. }
  14732. } else {
  14733. if (!needsResizing) {
  14734. this.getRgbBuffer(comps, 0, width * actualHeight, dest, 0, bpc, alpha01);
  14735. } else {
  14736. rgbBuf = new Uint8ClampedArray(count * 3);
  14737. this.getRgbBuffer(comps, 0, count, rgbBuf, 0, bpc, 0);
  14738. }
  14739. }
  14740. if (rgbBuf) {
  14741. if (needsResizing) {
  14742. resizeRgbImage(rgbBuf, dest, originalWidth, originalHeight, width, height, alpha01);
  14743. } else {
  14744. let destPos = 0,
  14745. rgbPos = 0;
  14746. for (let i = 0, ii = width * actualHeight; i < ii; i++) {
  14747. dest[destPos++] = rgbBuf[rgbPos++];
  14748. dest[destPos++] = rgbBuf[rgbPos++];
  14749. dest[destPos++] = rgbBuf[rgbPos++];
  14750. destPos += alpha01;
  14751. }
  14752. }
  14753. }
  14754. }
  14755. get usesZeroToOneRange() {
  14756. return (0, _util.shadow)(this, "usesZeroToOneRange", true);
  14757. }
  14758. static _cache(cacheKey, xref, localColorSpaceCache, parsedColorSpace) {
  14759. if (!localColorSpaceCache) {
  14760. throw new Error('ColorSpace._cache - expected "localColorSpaceCache" argument.');
  14761. }
  14762. if (!parsedColorSpace) {
  14763. throw new Error('ColorSpace._cache - expected "parsedColorSpace" argument.');
  14764. }
  14765. let csName, csRef;
  14766. if (cacheKey instanceof _primitives.Ref) {
  14767. csRef = cacheKey;
  14768. cacheKey = xref.fetch(cacheKey);
  14769. }
  14770. if (cacheKey instanceof _primitives.Name) {
  14771. csName = cacheKey.name;
  14772. }
  14773. if (csName || csRef) {
  14774. localColorSpaceCache.set(csName, csRef, parsedColorSpace);
  14775. }
  14776. }
  14777. static getCached(cacheKey, xref, localColorSpaceCache) {
  14778. if (!localColorSpaceCache) {
  14779. throw new Error('ColorSpace.getCached - expected "localColorSpaceCache" argument.');
  14780. }
  14781. if (cacheKey instanceof _primitives.Ref) {
  14782. const localColorSpace = localColorSpaceCache.getByRef(cacheKey);
  14783. if (localColorSpace) {
  14784. return localColorSpace;
  14785. }
  14786. try {
  14787. cacheKey = xref.fetch(cacheKey);
  14788. } catch (ex) {
  14789. if (ex instanceof _core_utils.MissingDataException) {
  14790. throw ex;
  14791. }
  14792. }
  14793. }
  14794. if (cacheKey instanceof _primitives.Name) {
  14795. const localColorSpace = localColorSpaceCache.getByName(cacheKey.name);
  14796. if (localColorSpace) {
  14797. return localColorSpace;
  14798. }
  14799. }
  14800. return null;
  14801. }
  14802. static async parseAsync({
  14803. cs,
  14804. xref,
  14805. resources = null,
  14806. pdfFunctionFactory,
  14807. localColorSpaceCache
  14808. }) {
  14809. const parsedColorSpace = this._parse(cs, xref, resources, pdfFunctionFactory);
  14810. this._cache(cs, xref, localColorSpaceCache, parsedColorSpace);
  14811. return parsedColorSpace;
  14812. }
  14813. static parse({
  14814. cs,
  14815. xref,
  14816. resources = null,
  14817. pdfFunctionFactory,
  14818. localColorSpaceCache
  14819. }) {
  14820. const cachedColorSpace = this.getCached(cs, xref, localColorSpaceCache);
  14821. if (cachedColorSpace) {
  14822. return cachedColorSpace;
  14823. }
  14824. const parsedColorSpace = this._parse(cs, xref, resources, pdfFunctionFactory);
  14825. this._cache(cs, xref, localColorSpaceCache, parsedColorSpace);
  14826. return parsedColorSpace;
  14827. }
  14828. static _parse(cs, xref, resources = null, pdfFunctionFactory) {
  14829. cs = xref.fetchIfRef(cs);
  14830. if ((0, _primitives.isName)(cs)) {
  14831. switch (cs.name) {
  14832. case "DeviceGray":
  14833. case "G":
  14834. return this.singletons.gray;
  14835. case "DeviceRGB":
  14836. case "RGB":
  14837. return this.singletons.rgb;
  14838. case "DeviceCMYK":
  14839. case "CMYK":
  14840. return this.singletons.cmyk;
  14841. case "Pattern":
  14842. return new PatternCS(null);
  14843. default:
  14844. if ((0, _primitives.isDict)(resources)) {
  14845. const colorSpaces = resources.get("ColorSpace");
  14846. if ((0, _primitives.isDict)(colorSpaces)) {
  14847. const resourcesCS = colorSpaces.get(cs.name);
  14848. if (resourcesCS) {
  14849. if ((0, _primitives.isName)(resourcesCS)) {
  14850. return this._parse(resourcesCS, xref, resources, pdfFunctionFactory);
  14851. }
  14852. cs = resourcesCS;
  14853. break;
  14854. }
  14855. }
  14856. }
  14857. throw new _util.FormatError(`Unrecognized ColorSpace: ${cs.name}`);
  14858. }
  14859. }
  14860. if (Array.isArray(cs)) {
  14861. const mode = xref.fetchIfRef(cs[0]).name;
  14862. let params, numComps, baseCS, whitePoint, blackPoint, gamma;
  14863. switch (mode) {
  14864. case "DeviceGray":
  14865. case "G":
  14866. return this.singletons.gray;
  14867. case "DeviceRGB":
  14868. case "RGB":
  14869. return this.singletons.rgb;
  14870. case "DeviceCMYK":
  14871. case "CMYK":
  14872. return this.singletons.cmyk;
  14873. case "CalGray":
  14874. params = xref.fetchIfRef(cs[1]);
  14875. whitePoint = params.getArray("WhitePoint");
  14876. blackPoint = params.getArray("BlackPoint");
  14877. gamma = params.get("Gamma");
  14878. return new CalGrayCS(whitePoint, blackPoint, gamma);
  14879. case "CalRGB":
  14880. params = xref.fetchIfRef(cs[1]);
  14881. whitePoint = params.getArray("WhitePoint");
  14882. blackPoint = params.getArray("BlackPoint");
  14883. gamma = params.getArray("Gamma");
  14884. const matrix = params.getArray("Matrix");
  14885. return new CalRGBCS(whitePoint, blackPoint, gamma, matrix);
  14886. case "ICCBased":
  14887. const stream = xref.fetchIfRef(cs[1]);
  14888. const dict = stream.dict;
  14889. numComps = dict.get("N");
  14890. const alt = dict.get("Alternate");
  14891. if (alt) {
  14892. const altCS = this._parse(alt, xref, resources, pdfFunctionFactory);
  14893. if (altCS.numComps === numComps) {
  14894. return altCS;
  14895. }
  14896. (0, _util.warn)("ICCBased color space: Ignoring incorrect /Alternate entry.");
  14897. }
  14898. if (numComps === 1) {
  14899. return this.singletons.gray;
  14900. } else if (numComps === 3) {
  14901. return this.singletons.rgb;
  14902. } else if (numComps === 4) {
  14903. return this.singletons.cmyk;
  14904. }
  14905. break;
  14906. case "Pattern":
  14907. baseCS = cs[1] || null;
  14908. if (baseCS) {
  14909. baseCS = this._parse(baseCS, xref, resources, pdfFunctionFactory);
  14910. }
  14911. return new PatternCS(baseCS);
  14912. case "Indexed":
  14913. case "I":
  14914. baseCS = this._parse(cs[1], xref, resources, pdfFunctionFactory);
  14915. const hiVal = xref.fetchIfRef(cs[2]) + 1;
  14916. const lookup = xref.fetchIfRef(cs[3]);
  14917. return new IndexedCS(baseCS, hiVal, lookup);
  14918. case "Separation":
  14919. case "DeviceN":
  14920. const name = xref.fetchIfRef(cs[1]);
  14921. numComps = Array.isArray(name) ? name.length : 1;
  14922. baseCS = this._parse(cs[2], xref, resources, pdfFunctionFactory);
  14923. const tintFn = pdfFunctionFactory.create(cs[3]);
  14924. return new AlternateCS(numComps, baseCS, tintFn);
  14925. case "Lab":
  14926. params = xref.fetchIfRef(cs[1]);
  14927. whitePoint = params.getArray("WhitePoint");
  14928. blackPoint = params.getArray("BlackPoint");
  14929. const range = params.getArray("Range");
  14930. return new LabCS(whitePoint, blackPoint, range);
  14931. default:
  14932. throw new _util.FormatError(`Unimplemented ColorSpace object: ${mode}`);
  14933. }
  14934. }
  14935. throw new _util.FormatError(`Unrecognized ColorSpace object: ${cs}`);
  14936. }
  14937. static isDefaultDecode(decode, numComps) {
  14938. if (!Array.isArray(decode)) {
  14939. return true;
  14940. }
  14941. if (numComps * 2 !== decode.length) {
  14942. (0, _util.warn)("The decode map is not the correct length");
  14943. return true;
  14944. }
  14945. for (let i = 0, ii = decode.length; i < ii; i += 2) {
  14946. if (decode[i] !== 0 || decode[i + 1] !== 1) {
  14947. return false;
  14948. }
  14949. }
  14950. return true;
  14951. }
  14952. static get singletons() {
  14953. return (0, _util.shadow)(this, "singletons", {
  14954. get gray() {
  14955. return (0, _util.shadow)(this, "gray", new DeviceGrayCS());
  14956. },
  14957. get rgb() {
  14958. return (0, _util.shadow)(this, "rgb", new DeviceRgbCS());
  14959. },
  14960. get cmyk() {
  14961. return (0, _util.shadow)(this, "cmyk", new DeviceCmykCS());
  14962. }
  14963. });
  14964. }
  14965. }
  14966. exports.ColorSpace = ColorSpace;
  14967. class AlternateCS extends ColorSpace {
  14968. constructor(numComps, base, tintFn) {
  14969. super("Alternate", numComps);
  14970. this.base = base;
  14971. this.tintFn = tintFn;
  14972. this.tmpBuf = new Float32Array(base.numComps);
  14973. }
  14974. getRgbItem(src, srcOffset, dest, destOffset) {
  14975. const tmpBuf = this.tmpBuf;
  14976. this.tintFn(src, srcOffset, tmpBuf, 0);
  14977. this.base.getRgbItem(tmpBuf, 0, dest, destOffset);
  14978. }
  14979. getRgbBuffer(src, srcOffset, count, dest, destOffset, bits, alpha01) {
  14980. const tintFn = this.tintFn;
  14981. const base = this.base;
  14982. const scale = 1 / ((1 << bits) - 1);
  14983. const baseNumComps = base.numComps;
  14984. const usesZeroToOneRange = base.usesZeroToOneRange;
  14985. const isPassthrough = (base.isPassthrough(8) || !usesZeroToOneRange) && alpha01 === 0;
  14986. let pos = isPassthrough ? destOffset : 0;
  14987. const baseBuf = isPassthrough ? dest : new Uint8ClampedArray(baseNumComps * count);
  14988. const numComps = this.numComps;
  14989. const scaled = new Float32Array(numComps);
  14990. const tinted = new Float32Array(baseNumComps);
  14991. let i, j;
  14992. for (i = 0; i < count; i++) {
  14993. for (j = 0; j < numComps; j++) {
  14994. scaled[j] = src[srcOffset++] * scale;
  14995. }
  14996. tintFn(scaled, 0, tinted, 0);
  14997. if (usesZeroToOneRange) {
  14998. for (j = 0; j < baseNumComps; j++) {
  14999. baseBuf[pos++] = tinted[j] * 255;
  15000. }
  15001. } else {
  15002. base.getRgbItem(tinted, 0, baseBuf, pos);
  15003. pos += baseNumComps;
  15004. }
  15005. }
  15006. if (!isPassthrough) {
  15007. base.getRgbBuffer(baseBuf, 0, count, dest, destOffset, 8, alpha01);
  15008. }
  15009. }
  15010. getOutputLength(inputLength, alpha01) {
  15011. return this.base.getOutputLength(inputLength * this.base.numComps / this.numComps, alpha01);
  15012. }
  15013. }
  15014. class PatternCS extends ColorSpace {
  15015. constructor(baseCS) {
  15016. super("Pattern", null);
  15017. this.base = baseCS;
  15018. }
  15019. isDefaultDecode(decodeMap, bpc) {
  15020. (0, _util.unreachable)("Should not call PatternCS.isDefaultDecode");
  15021. }
  15022. }
  15023. class IndexedCS extends ColorSpace {
  15024. constructor(base, highVal, lookup) {
  15025. super("Indexed", 1);
  15026. this.base = base;
  15027. this.highVal = highVal;
  15028. const length = base.numComps * highVal;
  15029. this.lookup = new Uint8Array(length);
  15030. if ((0, _primitives.isStream)(lookup)) {
  15031. const bytes = lookup.getBytes(length);
  15032. this.lookup.set(bytes);
  15033. } else if (typeof lookup === "string") {
  15034. for (let i = 0; i < length; ++i) {
  15035. this.lookup[i] = lookup.charCodeAt(i) & 0xff;
  15036. }
  15037. } else {
  15038. throw new _util.FormatError(`IndexedCS - unrecognized lookup table: ${lookup}`);
  15039. }
  15040. }
  15041. getRgbItem(src, srcOffset, dest, destOffset) {
  15042. const numComps = this.base.numComps;
  15043. const start = src[srcOffset] * numComps;
  15044. this.base.getRgbBuffer(this.lookup, start, 1, dest, destOffset, 8, 0);
  15045. }
  15046. getRgbBuffer(src, srcOffset, count, dest, destOffset, bits, alpha01) {
  15047. const base = this.base;
  15048. const numComps = base.numComps;
  15049. const outputDelta = base.getOutputLength(numComps, alpha01);
  15050. const lookup = this.lookup;
  15051. for (let i = 0; i < count; ++i) {
  15052. const lookupPos = src[srcOffset++] * numComps;
  15053. base.getRgbBuffer(lookup, lookupPos, 1, dest, destOffset, 8, alpha01);
  15054. destOffset += outputDelta;
  15055. }
  15056. }
  15057. getOutputLength(inputLength, alpha01) {
  15058. return this.base.getOutputLength(inputLength * this.base.numComps, alpha01);
  15059. }
  15060. isDefaultDecode(decodeMap, bpc) {
  15061. if (!Array.isArray(decodeMap)) {
  15062. return true;
  15063. }
  15064. if (decodeMap.length !== 2) {
  15065. (0, _util.warn)("Decode map length is not correct");
  15066. return true;
  15067. }
  15068. if (!Number.isInteger(bpc) || bpc < 1) {
  15069. (0, _util.warn)("Bits per component is not correct");
  15070. return true;
  15071. }
  15072. return decodeMap[0] === 0 && decodeMap[1] === (1 << bpc) - 1;
  15073. }
  15074. }
  15075. class DeviceGrayCS extends ColorSpace {
  15076. constructor() {
  15077. super("DeviceGray", 1);
  15078. }
  15079. getRgbItem(src, srcOffset, dest, destOffset) {
  15080. const c = src[srcOffset] * 255;
  15081. dest[destOffset] = dest[destOffset + 1] = dest[destOffset + 2] = c;
  15082. }
  15083. getRgbBuffer(src, srcOffset, count, dest, destOffset, bits, alpha01) {
  15084. const scale = 255 / ((1 << bits) - 1);
  15085. let j = srcOffset,
  15086. q = destOffset;
  15087. for (let i = 0; i < count; ++i) {
  15088. const c = scale * src[j++];
  15089. dest[q++] = c;
  15090. dest[q++] = c;
  15091. dest[q++] = c;
  15092. q += alpha01;
  15093. }
  15094. }
  15095. getOutputLength(inputLength, alpha01) {
  15096. return inputLength * (3 + alpha01);
  15097. }
  15098. }
  15099. class DeviceRgbCS extends ColorSpace {
  15100. constructor() {
  15101. super("DeviceRGB", 3);
  15102. }
  15103. getRgbItem(src, srcOffset, dest, destOffset) {
  15104. dest[destOffset] = src[srcOffset] * 255;
  15105. dest[destOffset + 1] = src[srcOffset + 1] * 255;
  15106. dest[destOffset + 2] = src[srcOffset + 2] * 255;
  15107. }
  15108. getRgbBuffer(src, srcOffset, count, dest, destOffset, bits, alpha01) {
  15109. if (bits === 8 && alpha01 === 0) {
  15110. dest.set(src.subarray(srcOffset, srcOffset + count * 3), destOffset);
  15111. return;
  15112. }
  15113. const scale = 255 / ((1 << bits) - 1);
  15114. let j = srcOffset,
  15115. q = destOffset;
  15116. for (let i = 0; i < count; ++i) {
  15117. dest[q++] = scale * src[j++];
  15118. dest[q++] = scale * src[j++];
  15119. dest[q++] = scale * src[j++];
  15120. q += alpha01;
  15121. }
  15122. }
  15123. getOutputLength(inputLength, alpha01) {
  15124. return inputLength * (3 + alpha01) / 3 | 0;
  15125. }
  15126. isPassthrough(bits) {
  15127. return bits === 8;
  15128. }
  15129. }
  15130. const DeviceCmykCS = function DeviceCmykCSClosure() {
  15131. function convertToRgb(src, srcOffset, srcScale, dest, destOffset) {
  15132. const c = src[srcOffset] * srcScale;
  15133. const m = src[srcOffset + 1] * srcScale;
  15134. const y = src[srcOffset + 2] * srcScale;
  15135. const k = src[srcOffset + 3] * srcScale;
  15136. dest[destOffset] = 255 + c * (-4.387332384609988 * c + 54.48615194189176 * m + 18.82290502165302 * y + 212.25662451639585 * k + -285.2331026137004) + m * (1.7149763477362134 * m - 5.6096736904047315 * y + -17.873870861415444 * k - 5.497006427196366) + y * (-2.5217340131683033 * y - 21.248923337353073 * k + 17.5119270841813) + k * (-21.86122147463605 * k - 189.48180835922747);
  15137. dest[destOffset + 1] = 255 + c * (8.841041422036149 * c + 60.118027045597366 * m + 6.871425592049007 * y + 31.159100130055922 * k + -79.2970844816548) + m * (-15.310361306967817 * m + 17.575251261109482 * y + 131.35250912493976 * k - 190.9453302588951) + y * (4.444339102852739 * y + 9.8632861493405 * k - 24.86741582555878) + k * (-20.737325471181034 * k - 187.80453709719578);
  15138. dest[destOffset + 2] = 255 + c * (0.8842522430003296 * c + 8.078677503112928 * m + 30.89978309703729 * y - 0.23883238689178934 * k + -14.183576799673286) + m * (10.49593273432072 * m + 63.02378494754052 * y + 50.606957656360734 * k - 112.23884253719248) + y * (0.03296041114873217 * y + 115.60384449646641 * k + -193.58209356861505) + k * (-22.33816807309886 * k - 180.12613974708367);
  15139. }
  15140. class DeviceCmykCS extends ColorSpace {
  15141. constructor() {
  15142. super("DeviceCMYK", 4);
  15143. }
  15144. getRgbItem(src, srcOffset, dest, destOffset) {
  15145. convertToRgb(src, srcOffset, 1, dest, destOffset);
  15146. }
  15147. getRgbBuffer(src, srcOffset, count, dest, destOffset, bits, alpha01) {
  15148. const scale = 1 / ((1 << bits) - 1);
  15149. for (let i = 0; i < count; i++) {
  15150. convertToRgb(src, srcOffset, scale, dest, destOffset);
  15151. srcOffset += 4;
  15152. destOffset += 3 + alpha01;
  15153. }
  15154. }
  15155. getOutputLength(inputLength, alpha01) {
  15156. return inputLength / 4 * (3 + alpha01) | 0;
  15157. }
  15158. }
  15159. return DeviceCmykCS;
  15160. }();
  15161. const CalGrayCS = function CalGrayCSClosure() {
  15162. function convertToRgb(cs, src, srcOffset, dest, destOffset, scale) {
  15163. const A = src[srcOffset] * scale;
  15164. const AG = A ** cs.G;
  15165. const L = cs.YW * AG;
  15166. const val = Math.max(295.8 * L ** 0.333333333333333333 - 40.8, 0);
  15167. dest[destOffset] = val;
  15168. dest[destOffset + 1] = val;
  15169. dest[destOffset + 2] = val;
  15170. }
  15171. class CalGrayCS extends ColorSpace {
  15172. constructor(whitePoint, blackPoint, gamma) {
  15173. super("CalGray", 1);
  15174. if (!whitePoint) {
  15175. throw new _util.FormatError("WhitePoint missing - required for color space CalGray");
  15176. }
  15177. blackPoint = blackPoint || [0, 0, 0];
  15178. gamma = gamma || 1;
  15179. this.XW = whitePoint[0];
  15180. this.YW = whitePoint[1];
  15181. this.ZW = whitePoint[2];
  15182. this.XB = blackPoint[0];
  15183. this.YB = blackPoint[1];
  15184. this.ZB = blackPoint[2];
  15185. this.G = gamma;
  15186. if (this.XW < 0 || this.ZW < 0 || this.YW !== 1) {
  15187. throw new _util.FormatError(`Invalid WhitePoint components for ${this.name}` + ", no fallback available");
  15188. }
  15189. if (this.XB < 0 || this.YB < 0 || this.ZB < 0) {
  15190. (0, _util.info)(`Invalid BlackPoint for ${this.name}, falling back to default.`);
  15191. this.XB = this.YB = this.ZB = 0;
  15192. }
  15193. if (this.XB !== 0 || this.YB !== 0 || this.ZB !== 0) {
  15194. (0, _util.warn)(`${this.name}, BlackPoint: XB: ${this.XB}, YB: ${this.YB}, ` + `ZB: ${this.ZB}, only default values are supported.`);
  15195. }
  15196. if (this.G < 1) {
  15197. (0, _util.info)(`Invalid Gamma: ${this.G} for ${this.name}, ` + "falling back to default.");
  15198. this.G = 1;
  15199. }
  15200. }
  15201. getRgbItem(src, srcOffset, dest, destOffset) {
  15202. convertToRgb(this, src, srcOffset, dest, destOffset, 1);
  15203. }
  15204. getRgbBuffer(src, srcOffset, count, dest, destOffset, bits, alpha01) {
  15205. const scale = 1 / ((1 << bits) - 1);
  15206. for (let i = 0; i < count; ++i) {
  15207. convertToRgb(this, src, srcOffset, dest, destOffset, scale);
  15208. srcOffset += 1;
  15209. destOffset += 3 + alpha01;
  15210. }
  15211. }
  15212. getOutputLength(inputLength, alpha01) {
  15213. return inputLength * (3 + alpha01);
  15214. }
  15215. }
  15216. return CalGrayCS;
  15217. }();
  15218. const CalRGBCS = function CalRGBCSClosure() {
  15219. const BRADFORD_SCALE_MATRIX = new Float32Array([0.8951, 0.2664, -0.1614, -0.7502, 1.7135, 0.0367, 0.0389, -0.0685, 1.0296]);
  15220. const BRADFORD_SCALE_INVERSE_MATRIX = new Float32Array([0.9869929, -0.1470543, 0.1599627, 0.4323053, 0.5183603, 0.0492912, -0.0085287, 0.0400428, 0.9684867]);
  15221. const SRGB_D65_XYZ_TO_RGB_MATRIX = new Float32Array([3.2404542, -1.5371385, -0.4985314, -0.9692660, 1.8760108, 0.0415560, 0.0556434, -0.2040259, 1.0572252]);
  15222. const FLAT_WHITEPOINT_MATRIX = new Float32Array([1, 1, 1]);
  15223. const tempNormalizeMatrix = new Float32Array(3);
  15224. const tempConvertMatrix1 = new Float32Array(3);
  15225. const tempConvertMatrix2 = new Float32Array(3);
  15226. const DECODE_L_CONSTANT = ((8 + 16) / 116) ** 3 / 8.0;
  15227. function matrixProduct(a, b, result) {
  15228. result[0] = a[0] * b[0] + a[1] * b[1] + a[2] * b[2];
  15229. result[1] = a[3] * b[0] + a[4] * b[1] + a[5] * b[2];
  15230. result[2] = a[6] * b[0] + a[7] * b[1] + a[8] * b[2];
  15231. }
  15232. function convertToFlat(sourceWhitePoint, LMS, result) {
  15233. result[0] = LMS[0] * 1 / sourceWhitePoint[0];
  15234. result[1] = LMS[1] * 1 / sourceWhitePoint[1];
  15235. result[2] = LMS[2] * 1 / sourceWhitePoint[2];
  15236. }
  15237. function convertToD65(sourceWhitePoint, LMS, result) {
  15238. const D65X = 0.95047;
  15239. const D65Y = 1;
  15240. const D65Z = 1.08883;
  15241. result[0] = LMS[0] * D65X / sourceWhitePoint[0];
  15242. result[1] = LMS[1] * D65Y / sourceWhitePoint[1];
  15243. result[2] = LMS[2] * D65Z / sourceWhitePoint[2];
  15244. }
  15245. function sRGBTransferFunction(color) {
  15246. if (color <= 0.0031308) {
  15247. return adjustToRange(0, 1, 12.92 * color);
  15248. }
  15249. if (color >= 0.99554525) {
  15250. return 1;
  15251. }
  15252. return adjustToRange(0, 1, (1 + 0.055) * color ** (1 / 2.4) - 0.055);
  15253. }
  15254. function adjustToRange(min, max, value) {
  15255. return Math.max(min, Math.min(max, value));
  15256. }
  15257. function decodeL(L) {
  15258. if (L < 0) {
  15259. return -decodeL(-L);
  15260. }
  15261. if (L > 8.0) {
  15262. return ((L + 16) / 116) ** 3;
  15263. }
  15264. return L * DECODE_L_CONSTANT;
  15265. }
  15266. function compensateBlackPoint(sourceBlackPoint, XYZ_Flat, result) {
  15267. if (sourceBlackPoint[0] === 0 && sourceBlackPoint[1] === 0 && sourceBlackPoint[2] === 0) {
  15268. result[0] = XYZ_Flat[0];
  15269. result[1] = XYZ_Flat[1];
  15270. result[2] = XYZ_Flat[2];
  15271. return;
  15272. }
  15273. const zeroDecodeL = decodeL(0);
  15274. const X_DST = zeroDecodeL;
  15275. const X_SRC = decodeL(sourceBlackPoint[0]);
  15276. const Y_DST = zeroDecodeL;
  15277. const Y_SRC = decodeL(sourceBlackPoint[1]);
  15278. const Z_DST = zeroDecodeL;
  15279. const Z_SRC = decodeL(sourceBlackPoint[2]);
  15280. const X_Scale = (1 - X_DST) / (1 - X_SRC);
  15281. const X_Offset = 1 - X_Scale;
  15282. const Y_Scale = (1 - Y_DST) / (1 - Y_SRC);
  15283. const Y_Offset = 1 - Y_Scale;
  15284. const Z_Scale = (1 - Z_DST) / (1 - Z_SRC);
  15285. const Z_Offset = 1 - Z_Scale;
  15286. result[0] = XYZ_Flat[0] * X_Scale + X_Offset;
  15287. result[1] = XYZ_Flat[1] * Y_Scale + Y_Offset;
  15288. result[2] = XYZ_Flat[2] * Z_Scale + Z_Offset;
  15289. }
  15290. function normalizeWhitePointToFlat(sourceWhitePoint, XYZ_In, result) {
  15291. if (sourceWhitePoint[0] === 1 && sourceWhitePoint[2] === 1) {
  15292. result[0] = XYZ_In[0];
  15293. result[1] = XYZ_In[1];
  15294. result[2] = XYZ_In[2];
  15295. return;
  15296. }
  15297. const LMS = result;
  15298. matrixProduct(BRADFORD_SCALE_MATRIX, XYZ_In, LMS);
  15299. const LMS_Flat = tempNormalizeMatrix;
  15300. convertToFlat(sourceWhitePoint, LMS, LMS_Flat);
  15301. matrixProduct(BRADFORD_SCALE_INVERSE_MATRIX, LMS_Flat, result);
  15302. }
  15303. function normalizeWhitePointToD65(sourceWhitePoint, XYZ_In, result) {
  15304. const LMS = result;
  15305. matrixProduct(BRADFORD_SCALE_MATRIX, XYZ_In, LMS);
  15306. const LMS_D65 = tempNormalizeMatrix;
  15307. convertToD65(sourceWhitePoint, LMS, LMS_D65);
  15308. matrixProduct(BRADFORD_SCALE_INVERSE_MATRIX, LMS_D65, result);
  15309. }
  15310. function convertToRgb(cs, src, srcOffset, dest, destOffset, scale) {
  15311. const A = adjustToRange(0, 1, src[srcOffset] * scale);
  15312. const B = adjustToRange(0, 1, src[srcOffset + 1] * scale);
  15313. const C = adjustToRange(0, 1, src[srcOffset + 2] * scale);
  15314. const AGR = A === 1 ? 1 : A ** cs.GR;
  15315. const BGG = B === 1 ? 1 : B ** cs.GG;
  15316. const CGB = C === 1 ? 1 : C ** cs.GB;
  15317. const X = cs.MXA * AGR + cs.MXB * BGG + cs.MXC * CGB;
  15318. const Y = cs.MYA * AGR + cs.MYB * BGG + cs.MYC * CGB;
  15319. const Z = cs.MZA * AGR + cs.MZB * BGG + cs.MZC * CGB;
  15320. const XYZ = tempConvertMatrix1;
  15321. XYZ[0] = X;
  15322. XYZ[1] = Y;
  15323. XYZ[2] = Z;
  15324. const XYZ_Flat = tempConvertMatrix2;
  15325. normalizeWhitePointToFlat(cs.whitePoint, XYZ, XYZ_Flat);
  15326. const XYZ_Black = tempConvertMatrix1;
  15327. compensateBlackPoint(cs.blackPoint, XYZ_Flat, XYZ_Black);
  15328. const XYZ_D65 = tempConvertMatrix2;
  15329. normalizeWhitePointToD65(FLAT_WHITEPOINT_MATRIX, XYZ_Black, XYZ_D65);
  15330. const SRGB = tempConvertMatrix1;
  15331. matrixProduct(SRGB_D65_XYZ_TO_RGB_MATRIX, XYZ_D65, SRGB);
  15332. dest[destOffset] = sRGBTransferFunction(SRGB[0]) * 255;
  15333. dest[destOffset + 1] = sRGBTransferFunction(SRGB[1]) * 255;
  15334. dest[destOffset + 2] = sRGBTransferFunction(SRGB[2]) * 255;
  15335. }
  15336. class CalRGBCS extends ColorSpace {
  15337. constructor(whitePoint, blackPoint, gamma, matrix) {
  15338. super("CalRGB", 3);
  15339. if (!whitePoint) {
  15340. throw new _util.FormatError("WhitePoint missing - required for color space CalRGB");
  15341. }
  15342. blackPoint = blackPoint || new Float32Array(3);
  15343. gamma = gamma || new Float32Array([1, 1, 1]);
  15344. matrix = matrix || new Float32Array([1, 0, 0, 0, 1, 0, 0, 0, 1]);
  15345. const XW = whitePoint[0];
  15346. const YW = whitePoint[1];
  15347. const ZW = whitePoint[2];
  15348. this.whitePoint = whitePoint;
  15349. const XB = blackPoint[0];
  15350. const YB = blackPoint[1];
  15351. const ZB = blackPoint[2];
  15352. this.blackPoint = blackPoint;
  15353. this.GR = gamma[0];
  15354. this.GG = gamma[1];
  15355. this.GB = gamma[2];
  15356. this.MXA = matrix[0];
  15357. this.MYA = matrix[1];
  15358. this.MZA = matrix[2];
  15359. this.MXB = matrix[3];
  15360. this.MYB = matrix[4];
  15361. this.MZB = matrix[5];
  15362. this.MXC = matrix[6];
  15363. this.MYC = matrix[7];
  15364. this.MZC = matrix[8];
  15365. if (XW < 0 || ZW < 0 || YW !== 1) {
  15366. throw new _util.FormatError(`Invalid WhitePoint components for ${this.name}` + ", no fallback available");
  15367. }
  15368. if (XB < 0 || YB < 0 || ZB < 0) {
  15369. (0, _util.info)(`Invalid BlackPoint for ${this.name} [${XB}, ${YB}, ${ZB}], ` + "falling back to default.");
  15370. this.blackPoint = new Float32Array(3);
  15371. }
  15372. if (this.GR < 0 || this.GG < 0 || this.GB < 0) {
  15373. (0, _util.info)(`Invalid Gamma [${this.GR}, ${this.GG}, ${this.GB}] for ` + `${this.name}, falling back to default.`);
  15374. this.GR = this.GG = this.GB = 1;
  15375. }
  15376. }
  15377. getRgbItem(src, srcOffset, dest, destOffset) {
  15378. convertToRgb(this, src, srcOffset, dest, destOffset, 1);
  15379. }
  15380. getRgbBuffer(src, srcOffset, count, dest, destOffset, bits, alpha01) {
  15381. const scale = 1 / ((1 << bits) - 1);
  15382. for (let i = 0; i < count; ++i) {
  15383. convertToRgb(this, src, srcOffset, dest, destOffset, scale);
  15384. srcOffset += 3;
  15385. destOffset += 3 + alpha01;
  15386. }
  15387. }
  15388. getOutputLength(inputLength, alpha01) {
  15389. return inputLength * (3 + alpha01) / 3 | 0;
  15390. }
  15391. }
  15392. return CalRGBCS;
  15393. }();
  15394. const LabCS = function LabCSClosure() {
  15395. function fn_g(x) {
  15396. let result;
  15397. if (x >= 6 / 29) {
  15398. result = x * x * x;
  15399. } else {
  15400. result = 108 / 841 * (x - 4 / 29);
  15401. }
  15402. return result;
  15403. }
  15404. function decode(value, high1, low2, high2) {
  15405. return low2 + value * (high2 - low2) / high1;
  15406. }
  15407. function convertToRgb(cs, src, srcOffset, maxVal, dest, destOffset) {
  15408. let Ls = src[srcOffset];
  15409. let as = src[srcOffset + 1];
  15410. let bs = src[srcOffset + 2];
  15411. if (maxVal !== false) {
  15412. Ls = decode(Ls, maxVal, 0, 100);
  15413. as = decode(as, maxVal, cs.amin, cs.amax);
  15414. bs = decode(bs, maxVal, cs.bmin, cs.bmax);
  15415. }
  15416. if (as > cs.amax) {
  15417. as = cs.amax;
  15418. } else if (as < cs.amin) {
  15419. as = cs.amin;
  15420. }
  15421. if (bs > cs.bmax) {
  15422. bs = cs.bmax;
  15423. } else if (bs < cs.bmin) {
  15424. bs = cs.bmin;
  15425. }
  15426. const M = (Ls + 16) / 116;
  15427. const L = M + as / 500;
  15428. const N = M - bs / 200;
  15429. const X = cs.XW * fn_g(L);
  15430. const Y = cs.YW * fn_g(M);
  15431. const Z = cs.ZW * fn_g(N);
  15432. let r, g, b;
  15433. if (cs.ZW < 1) {
  15434. r = X * 3.1339 + Y * -1.617 + Z * -0.4906;
  15435. g = X * -0.9785 + Y * 1.916 + Z * 0.0333;
  15436. b = X * 0.072 + Y * -0.229 + Z * 1.4057;
  15437. } else {
  15438. r = X * 3.2406 + Y * -1.5372 + Z * -0.4986;
  15439. g = X * -0.9689 + Y * 1.8758 + Z * 0.0415;
  15440. b = X * 0.0557 + Y * -0.204 + Z * 1.057;
  15441. }
  15442. dest[destOffset] = Math.sqrt(r) * 255;
  15443. dest[destOffset + 1] = Math.sqrt(g) * 255;
  15444. dest[destOffset + 2] = Math.sqrt(b) * 255;
  15445. }
  15446. class LabCS extends ColorSpace {
  15447. constructor(whitePoint, blackPoint, range) {
  15448. super("Lab", 3);
  15449. if (!whitePoint) {
  15450. throw new _util.FormatError("WhitePoint missing - required for color space Lab");
  15451. }
  15452. blackPoint = blackPoint || [0, 0, 0];
  15453. range = range || [-100, 100, -100, 100];
  15454. this.XW = whitePoint[0];
  15455. this.YW = whitePoint[1];
  15456. this.ZW = whitePoint[2];
  15457. this.amin = range[0];
  15458. this.amax = range[1];
  15459. this.bmin = range[2];
  15460. this.bmax = range[3];
  15461. this.XB = blackPoint[0];
  15462. this.YB = blackPoint[1];
  15463. this.ZB = blackPoint[2];
  15464. if (this.XW < 0 || this.ZW < 0 || this.YW !== 1) {
  15465. throw new _util.FormatError("Invalid WhitePoint components, no fallback available");
  15466. }
  15467. if (this.XB < 0 || this.YB < 0 || this.ZB < 0) {
  15468. (0, _util.info)("Invalid BlackPoint, falling back to default");
  15469. this.XB = this.YB = this.ZB = 0;
  15470. }
  15471. if (this.amin > this.amax || this.bmin > this.bmax) {
  15472. (0, _util.info)("Invalid Range, falling back to defaults");
  15473. this.amin = -100;
  15474. this.amax = 100;
  15475. this.bmin = -100;
  15476. this.bmax = 100;
  15477. }
  15478. }
  15479. getRgbItem(src, srcOffset, dest, destOffset) {
  15480. convertToRgb(this, src, srcOffset, false, dest, destOffset);
  15481. }
  15482. getRgbBuffer(src, srcOffset, count, dest, destOffset, bits, alpha01) {
  15483. const maxVal = (1 << bits) - 1;
  15484. for (let i = 0; i < count; i++) {
  15485. convertToRgb(this, src, srcOffset, maxVal, dest, destOffset);
  15486. srcOffset += 3;
  15487. destOffset += 3 + alpha01;
  15488. }
  15489. }
  15490. getOutputLength(inputLength, alpha01) {
  15491. return inputLength * (3 + alpha01) / 3 | 0;
  15492. }
  15493. isDefaultDecode(decodeMap, bpc) {
  15494. return true;
  15495. }
  15496. get usesZeroToOneRange() {
  15497. return (0, _util.shadow)(this, "usesZeroToOneRange", false);
  15498. }
  15499. }
  15500. return LabCS;
  15501. }();
  15502. /***/ }),
  15503. /* 24 */
  15504. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  15505. Object.defineProperty(exports, "__esModule", ({
  15506. value: true
  15507. }));
  15508. exports.LocalTilingPatternCache = exports.LocalImageCache = exports.LocalGStateCache = exports.LocalFunctionCache = exports.LocalColorSpaceCache = exports.GlobalImageCache = void 0;
  15509. var _util = __w_pdfjs_require__(2);
  15510. var _primitives = __w_pdfjs_require__(5);
  15511. class BaseLocalCache {
  15512. constructor(options) {
  15513. if (this.constructor === BaseLocalCache) {
  15514. (0, _util.unreachable)("Cannot initialize BaseLocalCache.");
  15515. }
  15516. if (!options || !options.onlyRefs) {
  15517. this._nameRefMap = new Map();
  15518. this._imageMap = new Map();
  15519. }
  15520. this._imageCache = new _primitives.RefSetCache();
  15521. }
  15522. getByName(name) {
  15523. const ref = this._nameRefMap.get(name);
  15524. if (ref) {
  15525. return this.getByRef(ref);
  15526. }
  15527. return this._imageMap.get(name) || null;
  15528. }
  15529. getByRef(ref) {
  15530. return this._imageCache.get(ref) || null;
  15531. }
  15532. set(name, ref, data) {
  15533. (0, _util.unreachable)("Abstract method `set` called.");
  15534. }
  15535. }
  15536. class LocalImageCache extends BaseLocalCache {
  15537. set(name, ref = null, data) {
  15538. if (!name) {
  15539. throw new Error('LocalImageCache.set - expected "name" argument.');
  15540. }
  15541. if (ref) {
  15542. if (this._imageCache.has(ref)) {
  15543. return;
  15544. }
  15545. this._nameRefMap.set(name, ref);
  15546. this._imageCache.put(ref, data);
  15547. return;
  15548. }
  15549. if (this._imageMap.has(name)) {
  15550. return;
  15551. }
  15552. this._imageMap.set(name, data);
  15553. }
  15554. }
  15555. exports.LocalImageCache = LocalImageCache;
  15556. class LocalColorSpaceCache extends BaseLocalCache {
  15557. set(name = null, ref = null, data) {
  15558. if (!name && !ref) {
  15559. throw new Error('LocalColorSpaceCache.set - expected "name" and/or "ref" argument.');
  15560. }
  15561. if (ref) {
  15562. if (this._imageCache.has(ref)) {
  15563. return;
  15564. }
  15565. if (name) {
  15566. this._nameRefMap.set(name, ref);
  15567. }
  15568. this._imageCache.put(ref, data);
  15569. return;
  15570. }
  15571. if (this._imageMap.has(name)) {
  15572. return;
  15573. }
  15574. this._imageMap.set(name, data);
  15575. }
  15576. }
  15577. exports.LocalColorSpaceCache = LocalColorSpaceCache;
  15578. class LocalFunctionCache extends BaseLocalCache {
  15579. constructor(options) {
  15580. super({
  15581. onlyRefs: true
  15582. });
  15583. }
  15584. getByName(name) {
  15585. (0, _util.unreachable)("Should not call `getByName` method.");
  15586. }
  15587. set(name = null, ref, data) {
  15588. if (!ref) {
  15589. throw new Error('LocalFunctionCache.set - expected "ref" argument.');
  15590. }
  15591. if (this._imageCache.has(ref)) {
  15592. return;
  15593. }
  15594. this._imageCache.put(ref, data);
  15595. }
  15596. }
  15597. exports.LocalFunctionCache = LocalFunctionCache;
  15598. class LocalGStateCache extends BaseLocalCache {
  15599. set(name, ref = null, data) {
  15600. if (!name) {
  15601. throw new Error('LocalGStateCache.set - expected "name" argument.');
  15602. }
  15603. if (ref) {
  15604. if (this._imageCache.has(ref)) {
  15605. return;
  15606. }
  15607. this._nameRefMap.set(name, ref);
  15608. this._imageCache.put(ref, data);
  15609. return;
  15610. }
  15611. if (this._imageMap.has(name)) {
  15612. return;
  15613. }
  15614. this._imageMap.set(name, data);
  15615. }
  15616. }
  15617. exports.LocalGStateCache = LocalGStateCache;
  15618. class LocalTilingPatternCache extends BaseLocalCache {
  15619. set(name, ref = null, data) {
  15620. if (!name) {
  15621. throw new Error('LocalTilingPatternCache.set - expected "name" argument.');
  15622. }
  15623. if (ref) {
  15624. if (this._imageCache.has(ref)) {
  15625. return;
  15626. }
  15627. this._nameRefMap.set(name, ref);
  15628. this._imageCache.put(ref, data);
  15629. return;
  15630. }
  15631. if (this._imageMap.has(name)) {
  15632. return;
  15633. }
  15634. this._imageMap.set(name, data);
  15635. }
  15636. }
  15637. exports.LocalTilingPatternCache = LocalTilingPatternCache;
  15638. class GlobalImageCache {
  15639. static get NUM_PAGES_THRESHOLD() {
  15640. return (0, _util.shadow)(this, "NUM_PAGES_THRESHOLD", 2);
  15641. }
  15642. static get MAX_IMAGES_TO_CACHE() {
  15643. return (0, _util.shadow)(this, "MAX_IMAGES_TO_CACHE", 10);
  15644. }
  15645. constructor() {
  15646. this._refCache = new _primitives.RefSetCache();
  15647. this._imageCache = new _primitives.RefSetCache();
  15648. }
  15649. shouldCache(ref, pageIndex) {
  15650. const pageIndexSet = this._refCache.get(ref);
  15651. const numPages = pageIndexSet ? pageIndexSet.size + (pageIndexSet.has(pageIndex) ? 0 : 1) : 1;
  15652. if (numPages < GlobalImageCache.NUM_PAGES_THRESHOLD) {
  15653. return false;
  15654. }
  15655. if (!this._imageCache.has(ref) && this._imageCache.size >= GlobalImageCache.MAX_IMAGES_TO_CACHE) {
  15656. return false;
  15657. }
  15658. return true;
  15659. }
  15660. addPageIndex(ref, pageIndex) {
  15661. let pageIndexSet = this._refCache.get(ref);
  15662. if (!pageIndexSet) {
  15663. pageIndexSet = new Set();
  15664. this._refCache.put(ref, pageIndexSet);
  15665. }
  15666. pageIndexSet.add(pageIndex);
  15667. }
  15668. getData(ref, pageIndex) {
  15669. const pageIndexSet = this._refCache.get(ref);
  15670. if (!pageIndexSet) {
  15671. return null;
  15672. }
  15673. if (pageIndexSet.size < GlobalImageCache.NUM_PAGES_THRESHOLD) {
  15674. return null;
  15675. }
  15676. if (!this._imageCache.has(ref)) {
  15677. return null;
  15678. }
  15679. pageIndexSet.add(pageIndex);
  15680. return this._imageCache.get(ref);
  15681. }
  15682. setData(ref, data) {
  15683. if (!this._refCache.has(ref)) {
  15684. throw new Error('GlobalImageCache.setData - expected "addPageIndex" to have been called.');
  15685. }
  15686. if (this._imageCache.has(ref)) {
  15687. return;
  15688. }
  15689. if (this._imageCache.size >= GlobalImageCache.MAX_IMAGES_TO_CACHE) {
  15690. (0, _util.info)("GlobalImageCache.setData - ignoring image above MAX_IMAGES_TO_CACHE.");
  15691. return;
  15692. }
  15693. this._imageCache.put(ref, data);
  15694. }
  15695. clear(onlyData = false) {
  15696. if (!onlyData) {
  15697. this._refCache.clear();
  15698. }
  15699. this._imageCache.clear();
  15700. }
  15701. }
  15702. exports.GlobalImageCache = GlobalImageCache;
  15703. /***/ }),
  15704. /* 25 */
  15705. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  15706. Object.defineProperty(exports, "__esModule", ({
  15707. value: true
  15708. }));
  15709. exports.getQuadPoints = getQuadPoints;
  15710. exports.MarkupAnnotation = exports.AnnotationFactory = exports.AnnotationBorderStyle = exports.Annotation = void 0;
  15711. var _util = __w_pdfjs_require__(2);
  15712. var _obj = __w_pdfjs_require__(10);
  15713. var _core_utils = __w_pdfjs_require__(8);
  15714. var _default_appearance = __w_pdfjs_require__(26);
  15715. var _primitives = __w_pdfjs_require__(5);
  15716. var _colorspace = __w_pdfjs_require__(23);
  15717. var _operator_list = __w_pdfjs_require__(44);
  15718. var _stream = __w_pdfjs_require__(12);
  15719. var _writer = __w_pdfjs_require__(46);
  15720. class AnnotationFactory {
  15721. static create(xref, ref, pdfManager, idFactory) {
  15722. return pdfManager.ensureCatalog("acroForm").then(acroForm => {
  15723. return pdfManager.ensure(this, "_create", [xref, ref, pdfManager, idFactory, acroForm]);
  15724. });
  15725. }
  15726. static _create(xref, ref, pdfManager, idFactory, acroForm) {
  15727. const dict = xref.fetchIfRef(ref);
  15728. if (!(0, _primitives.isDict)(dict)) {
  15729. return undefined;
  15730. }
  15731. const id = (0, _primitives.isRef)(ref) ? ref.toString() : `annot_${idFactory.createObjId()}`;
  15732. let subtype = dict.get("Subtype");
  15733. subtype = (0, _primitives.isName)(subtype) ? subtype.name : null;
  15734. const parameters = {
  15735. xref,
  15736. ref,
  15737. dict,
  15738. subtype,
  15739. id,
  15740. pdfManager,
  15741. acroForm: acroForm instanceof _primitives.Dict ? acroForm : _primitives.Dict.empty
  15742. };
  15743. switch (subtype) {
  15744. case "Link":
  15745. return new LinkAnnotation(parameters);
  15746. case "Text":
  15747. return new TextAnnotation(parameters);
  15748. case "Widget":
  15749. let fieldType = (0, _core_utils.getInheritableProperty)({
  15750. dict,
  15751. key: "FT"
  15752. });
  15753. fieldType = (0, _primitives.isName)(fieldType) ? fieldType.name : null;
  15754. switch (fieldType) {
  15755. case "Tx":
  15756. return new TextWidgetAnnotation(parameters);
  15757. case "Btn":
  15758. return new ButtonWidgetAnnotation(parameters);
  15759. case "Ch":
  15760. return new ChoiceWidgetAnnotation(parameters);
  15761. }
  15762. (0, _util.warn)('Unimplemented widget field type "' + fieldType + '", ' + "falling back to base field type.");
  15763. return new WidgetAnnotation(parameters);
  15764. case "Popup":
  15765. return new PopupAnnotation(parameters);
  15766. case "FreeText":
  15767. return new FreeTextAnnotation(parameters);
  15768. case "Line":
  15769. return new LineAnnotation(parameters);
  15770. case "Square":
  15771. return new SquareAnnotation(parameters);
  15772. case "Circle":
  15773. return new CircleAnnotation(parameters);
  15774. case "PolyLine":
  15775. return new PolylineAnnotation(parameters);
  15776. case "Polygon":
  15777. return new PolygonAnnotation(parameters);
  15778. case "Caret":
  15779. return new CaretAnnotation(parameters);
  15780. case "Ink":
  15781. return new InkAnnotation(parameters);
  15782. case "Highlight":
  15783. return new HighlightAnnotation(parameters);
  15784. case "Underline":
  15785. return new UnderlineAnnotation(parameters);
  15786. case "Squiggly":
  15787. return new SquigglyAnnotation(parameters);
  15788. case "StrikeOut":
  15789. return new StrikeOutAnnotation(parameters);
  15790. case "Stamp":
  15791. return new StampAnnotation(parameters);
  15792. case "FileAttachment":
  15793. return new FileAttachmentAnnotation(parameters);
  15794. default:
  15795. if (!subtype) {
  15796. (0, _util.warn)("Annotation is missing the required /Subtype.");
  15797. } else {
  15798. (0, _util.warn)('Unimplemented annotation type "' + subtype + '", ' + "falling back to base annotation.");
  15799. }
  15800. return new Annotation(parameters);
  15801. }
  15802. }
  15803. }
  15804. exports.AnnotationFactory = AnnotationFactory;
  15805. function getQuadPoints(dict, rect) {
  15806. if (!dict.has("QuadPoints")) {
  15807. return null;
  15808. }
  15809. const quadPoints = dict.getArray("QuadPoints");
  15810. if (!Array.isArray(quadPoints) || quadPoints.length === 0 || quadPoints.length % 8 > 0) {
  15811. return null;
  15812. }
  15813. const quadPointsLists = [];
  15814. for (let i = 0, ii = quadPoints.length / 8; i < ii; i++) {
  15815. quadPointsLists.push([]);
  15816. for (let j = i * 8, jj = i * 8 + 8; j < jj; j += 2) {
  15817. const x = quadPoints[j];
  15818. const y = quadPoints[j + 1];
  15819. if (rect !== null && (x < rect[0] || x > rect[2] || y < rect[1] || y > rect[3])) {
  15820. return null;
  15821. }
  15822. quadPointsLists[i].push({
  15823. x,
  15824. y
  15825. });
  15826. }
  15827. }
  15828. return quadPointsLists.map(quadPointsList => {
  15829. const [minX, maxX, minY, maxY] = quadPointsList.reduce(([mX, MX, mY, MY], quadPoint) => [Math.min(mX, quadPoint.x), Math.max(MX, quadPoint.x), Math.min(mY, quadPoint.y), Math.max(MY, quadPoint.y)], [Number.MAX_VALUE, Number.MIN_VALUE, Number.MAX_VALUE, Number.MIN_VALUE]);
  15830. return [{
  15831. x: minX,
  15832. y: maxY
  15833. }, {
  15834. x: maxX,
  15835. y: maxY
  15836. }, {
  15837. x: minX,
  15838. y: minY
  15839. }, {
  15840. x: maxX,
  15841. y: minY
  15842. }];
  15843. });
  15844. }
  15845. function getTransformMatrix(rect, bbox, matrix) {
  15846. const [minX, minY, maxX, maxY] = _util.Util.getAxialAlignedBoundingBox(bbox, matrix);
  15847. if (minX === maxX || minY === maxY) {
  15848. return [1, 0, 0, 1, rect[0], rect[1]];
  15849. }
  15850. const xRatio = (rect[2] - rect[0]) / (maxX - minX);
  15851. const yRatio = (rect[3] - rect[1]) / (maxY - minY);
  15852. return [xRatio, 0, 0, yRatio, rect[0] - minX * xRatio, rect[1] - minY * yRatio];
  15853. }
  15854. class Annotation {
  15855. constructor(params) {
  15856. const dict = params.dict;
  15857. this.setContents(dict.get("Contents"));
  15858. this.setModificationDate(dict.get("M"));
  15859. this.setFlags(dict.get("F"));
  15860. this.setRectangle(dict.getArray("Rect"));
  15861. this.setColor(dict.getArray("C"));
  15862. this.setBorderStyle(dict);
  15863. this.setAppearance(dict);
  15864. this._streams = [];
  15865. if (this.appearance) {
  15866. this._streams.push(this.appearance);
  15867. }
  15868. this.data = {
  15869. annotationFlags: this.flags,
  15870. borderStyle: this.borderStyle,
  15871. color: this.color,
  15872. contents: this.contents,
  15873. hasAppearance: !!this.appearance,
  15874. id: params.id,
  15875. modificationDate: this.modificationDate,
  15876. rect: this.rectangle,
  15877. subtype: params.subtype
  15878. };
  15879. this._fallbackFontDict = null;
  15880. }
  15881. _hasFlag(flags, flag) {
  15882. return !!(flags & flag);
  15883. }
  15884. _isViewable(flags) {
  15885. return !this._hasFlag(flags, _util.AnnotationFlag.INVISIBLE) && !this._hasFlag(flags, _util.AnnotationFlag.NOVIEW);
  15886. }
  15887. _isPrintable(flags) {
  15888. return this._hasFlag(flags, _util.AnnotationFlag.PRINT) && !this._hasFlag(flags, _util.AnnotationFlag.INVISIBLE);
  15889. }
  15890. isHidden(annotationStorage) {
  15891. const data = annotationStorage && annotationStorage[this.data.id];
  15892. if (data && "hidden" in data) {
  15893. return data.hidden;
  15894. }
  15895. return this._hasFlag(this.flags, _util.AnnotationFlag.HIDDEN);
  15896. }
  15897. get viewable() {
  15898. if (this.data.quadPoints === null) {
  15899. return false;
  15900. }
  15901. if (this.flags === 0) {
  15902. return true;
  15903. }
  15904. return this._isViewable(this.flags);
  15905. }
  15906. get printable() {
  15907. if (this.data.quadPoints === null) {
  15908. return false;
  15909. }
  15910. if (this.flags === 0) {
  15911. return false;
  15912. }
  15913. return this._isPrintable(this.flags);
  15914. }
  15915. setContents(contents) {
  15916. this.contents = (0, _util.stringToPDFString)(contents || "");
  15917. }
  15918. setModificationDate(modificationDate) {
  15919. this.modificationDate = (0, _util.isString)(modificationDate) ? modificationDate : null;
  15920. }
  15921. setFlags(flags) {
  15922. this.flags = Number.isInteger(flags) && flags > 0 ? flags : 0;
  15923. }
  15924. hasFlag(flag) {
  15925. return this._hasFlag(this.flags, flag);
  15926. }
  15927. setRectangle(rectangle) {
  15928. if (Array.isArray(rectangle) && rectangle.length === 4) {
  15929. this.rectangle = _util.Util.normalizeRect(rectangle);
  15930. } else {
  15931. this.rectangle = [0, 0, 0, 0];
  15932. }
  15933. }
  15934. setColor(color) {
  15935. const rgbColor = new Uint8ClampedArray(3);
  15936. if (!Array.isArray(color)) {
  15937. this.color = rgbColor;
  15938. return;
  15939. }
  15940. switch (color.length) {
  15941. case 0:
  15942. this.color = null;
  15943. break;
  15944. case 1:
  15945. _colorspace.ColorSpace.singletons.gray.getRgbItem(color, 0, rgbColor, 0);
  15946. this.color = rgbColor;
  15947. break;
  15948. case 3:
  15949. _colorspace.ColorSpace.singletons.rgb.getRgbItem(color, 0, rgbColor, 0);
  15950. this.color = rgbColor;
  15951. break;
  15952. case 4:
  15953. _colorspace.ColorSpace.singletons.cmyk.getRgbItem(color, 0, rgbColor, 0);
  15954. this.color = rgbColor;
  15955. break;
  15956. default:
  15957. this.color = rgbColor;
  15958. break;
  15959. }
  15960. }
  15961. setBorderStyle(borderStyle) {
  15962. this.borderStyle = new AnnotationBorderStyle();
  15963. if (!(0, _primitives.isDict)(borderStyle)) {
  15964. return;
  15965. }
  15966. if (borderStyle.has("BS")) {
  15967. const dict = borderStyle.get("BS");
  15968. const dictType = dict.get("Type");
  15969. if (!dictType || (0, _primitives.isName)(dictType, "Border")) {
  15970. this.borderStyle.setWidth(dict.get("W"), this.rectangle);
  15971. this.borderStyle.setStyle(dict.get("S"));
  15972. this.borderStyle.setDashArray(dict.getArray("D"));
  15973. }
  15974. } else if (borderStyle.has("Border")) {
  15975. const array = borderStyle.getArray("Border");
  15976. if (Array.isArray(array) && array.length >= 3) {
  15977. this.borderStyle.setHorizontalCornerRadius(array[0]);
  15978. this.borderStyle.setVerticalCornerRadius(array[1]);
  15979. this.borderStyle.setWidth(array[2], this.rectangle);
  15980. if (array.length === 4) {
  15981. this.borderStyle.setDashArray(array[3]);
  15982. }
  15983. }
  15984. } else {
  15985. this.borderStyle.setWidth(0);
  15986. }
  15987. }
  15988. setAppearance(dict) {
  15989. this.appearance = null;
  15990. const appearanceStates = dict.get("AP");
  15991. if (!(0, _primitives.isDict)(appearanceStates)) {
  15992. return;
  15993. }
  15994. const normalAppearanceState = appearanceStates.get("N");
  15995. if ((0, _primitives.isStream)(normalAppearanceState)) {
  15996. this.appearance = normalAppearanceState;
  15997. return;
  15998. }
  15999. if (!(0, _primitives.isDict)(normalAppearanceState)) {
  16000. return;
  16001. }
  16002. const as = dict.get("AS");
  16003. if (!(0, _primitives.isName)(as) || !normalAppearanceState.has(as.name)) {
  16004. return;
  16005. }
  16006. this.appearance = normalAppearanceState.get(as.name);
  16007. }
  16008. loadResources(keys) {
  16009. return this.appearance.dict.getAsync("Resources").then(resources => {
  16010. if (!resources) {
  16011. return undefined;
  16012. }
  16013. const objectLoader = new _obj.ObjectLoader(resources, keys, resources.xref);
  16014. return objectLoader.load().then(function () {
  16015. return resources;
  16016. });
  16017. });
  16018. }
  16019. getOperatorList(evaluator, task, renderForms, annotationStorage) {
  16020. if (!this.appearance) {
  16021. return Promise.resolve(new _operator_list.OperatorList());
  16022. }
  16023. const appearance = this.appearance;
  16024. const data = this.data;
  16025. const appearanceDict = appearance.dict;
  16026. const resourcesPromise = this.loadResources(["ExtGState", "ColorSpace", "Pattern", "Shading", "XObject", "Font"]);
  16027. const bbox = appearanceDict.getArray("BBox") || [0, 0, 1, 1];
  16028. const matrix = appearanceDict.getArray("Matrix") || [1, 0, 0, 1, 0, 0];
  16029. const transform = getTransformMatrix(data.rect, bbox, matrix);
  16030. return resourcesPromise.then(resources => {
  16031. const opList = new _operator_list.OperatorList();
  16032. opList.addOp(_util.OPS.beginAnnotation, [data.rect, transform, matrix]);
  16033. return evaluator.getOperatorList({
  16034. stream: appearance,
  16035. task,
  16036. resources,
  16037. operatorList: opList,
  16038. fallbackFontDict: this._fallbackFontDict
  16039. }).then(() => {
  16040. opList.addOp(_util.OPS.endAnnotation, []);
  16041. this.reset();
  16042. return opList;
  16043. });
  16044. });
  16045. }
  16046. async save(evaluator, task, annotationStorage) {
  16047. return null;
  16048. }
  16049. getFieldObject() {
  16050. return null;
  16051. }
  16052. reset() {
  16053. for (const stream of this._streams) {
  16054. stream.reset();
  16055. }
  16056. }
  16057. }
  16058. exports.Annotation = Annotation;
  16059. class AnnotationBorderStyle {
  16060. constructor() {
  16061. this.width = 1;
  16062. this.style = _util.AnnotationBorderStyleType.SOLID;
  16063. this.dashArray = [3];
  16064. this.horizontalCornerRadius = 0;
  16065. this.verticalCornerRadius = 0;
  16066. }
  16067. setWidth(width, rect = [0, 0, 0, 0]) {
  16068. if ((0, _primitives.isName)(width)) {
  16069. this.width = 0;
  16070. return;
  16071. }
  16072. if (Number.isInteger(width)) {
  16073. if (width > 0) {
  16074. const maxWidth = (rect[2] - rect[0]) / 2;
  16075. const maxHeight = (rect[3] - rect[1]) / 2;
  16076. if (maxWidth > 0 && maxHeight > 0 && (width > maxWidth || width > maxHeight)) {
  16077. (0, _util.warn)(`AnnotationBorderStyle.setWidth - ignoring width: ${width}`);
  16078. width = 1;
  16079. }
  16080. }
  16081. this.width = width;
  16082. }
  16083. }
  16084. setStyle(style) {
  16085. if (!(0, _primitives.isName)(style)) {
  16086. return;
  16087. }
  16088. switch (style.name) {
  16089. case "S":
  16090. this.style = _util.AnnotationBorderStyleType.SOLID;
  16091. break;
  16092. case "D":
  16093. this.style = _util.AnnotationBorderStyleType.DASHED;
  16094. break;
  16095. case "B":
  16096. this.style = _util.AnnotationBorderStyleType.BEVELED;
  16097. break;
  16098. case "I":
  16099. this.style = _util.AnnotationBorderStyleType.INSET;
  16100. break;
  16101. case "U":
  16102. this.style = _util.AnnotationBorderStyleType.UNDERLINE;
  16103. break;
  16104. default:
  16105. break;
  16106. }
  16107. }
  16108. setDashArray(dashArray) {
  16109. if (Array.isArray(dashArray) && dashArray.length > 0) {
  16110. let isValid = true;
  16111. let allZeros = true;
  16112. for (const element of dashArray) {
  16113. const validNumber = +element >= 0;
  16114. if (!validNumber) {
  16115. isValid = false;
  16116. break;
  16117. } else if (element > 0) {
  16118. allZeros = false;
  16119. }
  16120. }
  16121. if (isValid && !allZeros) {
  16122. this.dashArray = dashArray;
  16123. } else {
  16124. this.width = 0;
  16125. }
  16126. } else if (dashArray) {
  16127. this.width = 0;
  16128. }
  16129. }
  16130. setHorizontalCornerRadius(radius) {
  16131. if (Number.isInteger(radius)) {
  16132. this.horizontalCornerRadius = radius;
  16133. }
  16134. }
  16135. setVerticalCornerRadius(radius) {
  16136. if (Number.isInteger(radius)) {
  16137. this.verticalCornerRadius = radius;
  16138. }
  16139. }
  16140. }
  16141. exports.AnnotationBorderStyle = AnnotationBorderStyle;
  16142. class MarkupAnnotation extends Annotation {
  16143. constructor(parameters) {
  16144. super(parameters);
  16145. const dict = parameters.dict;
  16146. if (dict.has("IRT")) {
  16147. const rawIRT = dict.getRaw("IRT");
  16148. this.data.inReplyTo = (0, _primitives.isRef)(rawIRT) ? rawIRT.toString() : null;
  16149. const rt = dict.get("RT");
  16150. this.data.replyType = (0, _primitives.isName)(rt) ? rt.name : _util.AnnotationReplyType.REPLY;
  16151. }
  16152. if (this.data.replyType === _util.AnnotationReplyType.GROUP) {
  16153. const parent = dict.get("IRT");
  16154. this.data.title = (0, _util.stringToPDFString)(parent.get("T") || "");
  16155. this.setContents(parent.get("Contents"));
  16156. this.data.contents = this.contents;
  16157. if (!parent.has("CreationDate")) {
  16158. this.data.creationDate = null;
  16159. } else {
  16160. this.setCreationDate(parent.get("CreationDate"));
  16161. this.data.creationDate = this.creationDate;
  16162. }
  16163. if (!parent.has("M")) {
  16164. this.data.modificationDate = null;
  16165. } else {
  16166. this.setModificationDate(parent.get("M"));
  16167. this.data.modificationDate = this.modificationDate;
  16168. }
  16169. this.data.hasPopup = parent.has("Popup");
  16170. if (!parent.has("C")) {
  16171. this.data.color = null;
  16172. } else {
  16173. this.setColor(parent.getArray("C"));
  16174. this.data.color = this.color;
  16175. }
  16176. } else {
  16177. this.data.title = (0, _util.stringToPDFString)(dict.get("T") || "");
  16178. this.setCreationDate(dict.get("CreationDate"));
  16179. this.data.creationDate = this.creationDate;
  16180. this.data.hasPopup = dict.has("Popup");
  16181. if (!dict.has("C")) {
  16182. this.data.color = null;
  16183. }
  16184. }
  16185. }
  16186. setCreationDate(creationDate) {
  16187. this.creationDate = (0, _util.isString)(creationDate) ? creationDate : null;
  16188. }
  16189. _setDefaultAppearance({
  16190. xref,
  16191. extra,
  16192. strokeColor,
  16193. fillColor,
  16194. blendMode,
  16195. pointsCallback
  16196. }) {
  16197. let minX = Number.MAX_VALUE;
  16198. let minY = Number.MAX_VALUE;
  16199. let maxX = Number.MIN_VALUE;
  16200. let maxY = Number.MIN_VALUE;
  16201. const buffer = ["q"];
  16202. if (extra) {
  16203. buffer.push(extra);
  16204. }
  16205. if (strokeColor) {
  16206. buffer.push(`${strokeColor[0]} ${strokeColor[1]} ${strokeColor[2]} RG`);
  16207. }
  16208. if (fillColor) {
  16209. buffer.push(`${fillColor[0]} ${fillColor[1]} ${fillColor[2]} rg`);
  16210. }
  16211. for (const points of this.data.quadPoints) {
  16212. const [mX, MX, mY, MY] = pointsCallback(buffer, points);
  16213. minX = Math.min(minX, mX);
  16214. maxX = Math.max(maxX, MX);
  16215. minY = Math.min(minY, mY);
  16216. maxY = Math.max(maxY, MY);
  16217. }
  16218. buffer.push("Q");
  16219. const formDict = new _primitives.Dict(xref);
  16220. const appearanceStreamDict = new _primitives.Dict(xref);
  16221. appearanceStreamDict.set("Subtype", _primitives.Name.get("Form"));
  16222. const appearanceStream = new _stream.StringStream(buffer.join(" "));
  16223. appearanceStream.dict = appearanceStreamDict;
  16224. formDict.set("Fm0", appearanceStream);
  16225. const gsDict = new _primitives.Dict(xref);
  16226. if (blendMode) {
  16227. gsDict.set("BM", _primitives.Name.get(blendMode));
  16228. }
  16229. const stateDict = new _primitives.Dict(xref);
  16230. stateDict.set("GS0", gsDict);
  16231. const resources = new _primitives.Dict(xref);
  16232. resources.set("ExtGState", stateDict);
  16233. resources.set("XObject", formDict);
  16234. const appearanceDict = new _primitives.Dict(xref);
  16235. appearanceDict.set("Resources", resources);
  16236. const bbox = this.data.rect = [minX, minY, maxX, maxY];
  16237. appearanceDict.set("BBox", bbox);
  16238. this.appearance = new _stream.StringStream("/GS0 gs /Fm0 Do");
  16239. this.appearance.dict = appearanceDict;
  16240. this._streams.push(this.appearance, appearanceStream);
  16241. }
  16242. }
  16243. exports.MarkupAnnotation = MarkupAnnotation;
  16244. class WidgetAnnotation extends Annotation {
  16245. constructor(params) {
  16246. super(params);
  16247. const dict = params.dict;
  16248. const data = this.data;
  16249. this.ref = params.ref;
  16250. data.annotationType = _util.AnnotationType.WIDGET;
  16251. data.fieldName = this._constructFieldName(dict);
  16252. data.actions = (0, _core_utils.collectActions)(params.xref, dict, _util.AnnotationActionEventType);
  16253. const fieldValue = (0, _core_utils.getInheritableProperty)({
  16254. dict,
  16255. key: "V",
  16256. getArray: true
  16257. });
  16258. data.fieldValue = this._decodeFormValue(fieldValue);
  16259. const defaultFieldValue = (0, _core_utils.getInheritableProperty)({
  16260. dict,
  16261. key: "DV",
  16262. getArray: true
  16263. });
  16264. data.defaultFieldValue = this._decodeFormValue(defaultFieldValue);
  16265. data.alternativeText = (0, _util.stringToPDFString)(dict.get("TU") || "");
  16266. const defaultAppearance = (0, _core_utils.getInheritableProperty)({
  16267. dict,
  16268. key: "DA"
  16269. }) || params.acroForm.get("DA") || "";
  16270. data.defaultAppearance = (0, _util.isString)(defaultAppearance) ? defaultAppearance : "";
  16271. data.defaultAppearanceData = (0, _default_appearance.parseDefaultAppearance)(data.defaultAppearance);
  16272. const fieldType = (0, _core_utils.getInheritableProperty)({
  16273. dict,
  16274. key: "FT"
  16275. });
  16276. data.fieldType = (0, _primitives.isName)(fieldType) ? fieldType.name : null;
  16277. const localResources = (0, _core_utils.getInheritableProperty)({
  16278. dict,
  16279. key: "DR"
  16280. });
  16281. const acroFormResources = params.acroForm.get("DR");
  16282. const appearanceResources = this.appearance && this.appearance.dict.get("Resources");
  16283. this._fieldResources = {
  16284. localResources,
  16285. acroFormResources,
  16286. appearanceResources,
  16287. mergedResources: _primitives.Dict.merge({
  16288. xref: params.xref,
  16289. dictArray: [localResources, appearanceResources, acroFormResources],
  16290. mergeSubDicts: true
  16291. })
  16292. };
  16293. data.fieldFlags = (0, _core_utils.getInheritableProperty)({
  16294. dict,
  16295. key: "Ff"
  16296. });
  16297. if (!Number.isInteger(data.fieldFlags) || data.fieldFlags < 0) {
  16298. data.fieldFlags = 0;
  16299. }
  16300. data.readOnly = this.hasFieldFlag(_util.AnnotationFieldFlag.READONLY);
  16301. data.hidden = this._hasFlag(data.annotationFlags, _util.AnnotationFlag.HIDDEN);
  16302. if (data.fieldType === "Sig") {
  16303. data.fieldValue = null;
  16304. this.setFlags(_util.AnnotationFlag.HIDDEN);
  16305. data.hidden = true;
  16306. }
  16307. }
  16308. _constructFieldName(dict) {
  16309. if (!dict.has("T") && !dict.has("Parent")) {
  16310. (0, _util.warn)("Unknown field name, falling back to empty field name.");
  16311. return "";
  16312. }
  16313. if (!dict.has("Parent")) {
  16314. return (0, _util.stringToPDFString)(dict.get("T"));
  16315. }
  16316. const fieldName = [];
  16317. if (dict.has("T")) {
  16318. fieldName.unshift((0, _util.stringToPDFString)(dict.get("T")));
  16319. }
  16320. let loopDict = dict;
  16321. while (loopDict.has("Parent")) {
  16322. loopDict = loopDict.get("Parent");
  16323. if (!(0, _primitives.isDict)(loopDict)) {
  16324. break;
  16325. }
  16326. if (loopDict.has("T")) {
  16327. fieldName.unshift((0, _util.stringToPDFString)(loopDict.get("T")));
  16328. }
  16329. }
  16330. return fieldName.join(".");
  16331. }
  16332. _decodeFormValue(formValue) {
  16333. if (Array.isArray(formValue)) {
  16334. return formValue.filter(item => (0, _util.isString)(item)).map(item => (0, _util.stringToPDFString)(item));
  16335. } else if ((0, _primitives.isName)(formValue)) {
  16336. return (0, _util.stringToPDFString)(formValue.name);
  16337. } else if ((0, _util.isString)(formValue)) {
  16338. return (0, _util.stringToPDFString)(formValue);
  16339. }
  16340. return null;
  16341. }
  16342. hasFieldFlag(flag) {
  16343. return !!(this.data.fieldFlags & flag);
  16344. }
  16345. getOperatorList(evaluator, task, renderForms, annotationStorage) {
  16346. if (renderForms) {
  16347. return Promise.resolve(new _operator_list.OperatorList());
  16348. }
  16349. if (!this._hasText) {
  16350. return super.getOperatorList(evaluator, task, renderForms, annotationStorage);
  16351. }
  16352. return this._getAppearance(evaluator, task, annotationStorage).then(content => {
  16353. if (this.appearance && content === null) {
  16354. return super.getOperatorList(evaluator, task, renderForms, annotationStorage);
  16355. }
  16356. const operatorList = new _operator_list.OperatorList();
  16357. if (!this.data.defaultAppearance || content === null) {
  16358. return operatorList;
  16359. }
  16360. const matrix = [1, 0, 0, 1, 0, 0];
  16361. const bbox = [0, 0, this.data.rect[2] - this.data.rect[0], this.data.rect[3] - this.data.rect[1]];
  16362. const transform = getTransformMatrix(this.data.rect, bbox, matrix);
  16363. operatorList.addOp(_util.OPS.beginAnnotation, [this.data.rect, transform, matrix]);
  16364. const stream = new _stream.StringStream(content);
  16365. return evaluator.getOperatorList({
  16366. stream,
  16367. task,
  16368. resources: this._fieldResources.mergedResources,
  16369. operatorList
  16370. }).then(function () {
  16371. operatorList.addOp(_util.OPS.endAnnotation, []);
  16372. return operatorList;
  16373. });
  16374. });
  16375. }
  16376. async save(evaluator, task, annotationStorage) {
  16377. const value = annotationStorage[this.data.id] && annotationStorage[this.data.id].value;
  16378. if (value === this.data.fieldValue || value === undefined) {
  16379. return null;
  16380. }
  16381. let appearance = await this._getAppearance(evaluator, task, annotationStorage);
  16382. if (appearance === null) {
  16383. return null;
  16384. }
  16385. const {
  16386. xref
  16387. } = evaluator;
  16388. const dict = xref.fetchIfRef(this.ref);
  16389. if (!(0, _primitives.isDict)(dict)) {
  16390. return null;
  16391. }
  16392. const bbox = [0, 0, this.data.rect[2] - this.data.rect[0], this.data.rect[3] - this.data.rect[1]];
  16393. const xfa = {
  16394. path: (0, _util.stringToPDFString)(dict.get("T") || ""),
  16395. value
  16396. };
  16397. const newRef = xref.getNewRef();
  16398. const AP = new _primitives.Dict(xref);
  16399. AP.set("N", newRef);
  16400. const encrypt = xref.encrypt;
  16401. let originalTransform = null;
  16402. let newTransform = null;
  16403. if (encrypt) {
  16404. originalTransform = encrypt.createCipherTransform(this.ref.num, this.ref.gen);
  16405. newTransform = encrypt.createCipherTransform(newRef.num, newRef.gen);
  16406. appearance = newTransform.encryptString(appearance);
  16407. }
  16408. dict.set("V", (0, _util.isAscii)(value) ? value : (0, _util.stringToUTF16BEString)(value));
  16409. dict.set("AP", AP);
  16410. dict.set("M", `D:${(0, _util.getModificationDate)()}`);
  16411. const appearanceDict = new _primitives.Dict(xref);
  16412. appearanceDict.set("Length", appearance.length);
  16413. appearanceDict.set("Subtype", _primitives.Name.get("Form"));
  16414. appearanceDict.set("Resources", this._getSaveFieldResources(xref));
  16415. appearanceDict.set("BBox", bbox);
  16416. const bufferOriginal = [`${this.ref.num} ${this.ref.gen} obj\n`];
  16417. (0, _writer.writeDict)(dict, bufferOriginal, originalTransform);
  16418. bufferOriginal.push("\nendobj\n");
  16419. const bufferNew = [`${newRef.num} ${newRef.gen} obj\n`];
  16420. (0, _writer.writeDict)(appearanceDict, bufferNew, newTransform);
  16421. bufferNew.push(" stream\n");
  16422. bufferNew.push(appearance);
  16423. bufferNew.push("\nendstream\nendobj\n");
  16424. return [{
  16425. ref: this.ref,
  16426. data: bufferOriginal.join(""),
  16427. xfa
  16428. }, {
  16429. ref: newRef,
  16430. data: bufferNew.join(""),
  16431. xfa: null
  16432. }];
  16433. }
  16434. async _getAppearance(evaluator, task, annotationStorage) {
  16435. const isPassword = this.hasFieldFlag(_util.AnnotationFieldFlag.PASSWORD);
  16436. if (!annotationStorage || isPassword) {
  16437. return null;
  16438. }
  16439. const value = annotationStorage[this.data.id] && annotationStorage[this.data.id].value;
  16440. if (value === undefined) {
  16441. return null;
  16442. }
  16443. if (value === "") {
  16444. return "";
  16445. }
  16446. const defaultPadding = 2;
  16447. const hPadding = defaultPadding;
  16448. const totalHeight = this.data.rect[3] - this.data.rect[1];
  16449. const totalWidth = this.data.rect[2] - this.data.rect[0];
  16450. if (!this.data.defaultAppearance) {
  16451. this.data.defaultAppearance = "/Helvetica 0 Tf 0 g";
  16452. this.data.defaultAppearanceData = (0, _default_appearance.parseDefaultAppearance)(this.data.defaultAppearance);
  16453. }
  16454. const font = await this._getFontData(evaluator, task);
  16455. const fontSize = this._computeFontSize(font, totalHeight);
  16456. let descent = font.descent;
  16457. if (isNaN(descent)) {
  16458. descent = 0;
  16459. }
  16460. const vPadding = defaultPadding + Math.abs(descent) * fontSize;
  16461. const defaultAppearance = this.data.defaultAppearance;
  16462. const alignment = this.data.textAlignment;
  16463. if (this.data.multiLine) {
  16464. return this._getMultilineAppearance(defaultAppearance, value, font, fontSize, totalWidth, totalHeight, alignment, hPadding, vPadding);
  16465. }
  16466. const encodedString = font.encodeString(value).join("");
  16467. if (this.data.comb) {
  16468. return this._getCombAppearance(defaultAppearance, font, encodedString, totalWidth, hPadding, vPadding);
  16469. }
  16470. if (alignment === 0 || alignment > 2) {
  16471. return "/Tx BMC q BT " + defaultAppearance + ` 1 0 0 1 ${hPadding} ${vPadding} Tm (${(0, _util.escapeString)(encodedString)}) Tj` + " ET Q EMC";
  16472. }
  16473. const renderedText = this._renderText(encodedString, font, fontSize, totalWidth, alignment, hPadding, vPadding);
  16474. return "/Tx BMC q BT " + defaultAppearance + ` 1 0 0 1 0 0 Tm ${renderedText}` + " ET Q EMC";
  16475. }
  16476. async _getFontData(evaluator, task) {
  16477. const operatorList = new _operator_list.OperatorList();
  16478. const initialState = {
  16479. font: null,
  16480. clone() {
  16481. return this;
  16482. }
  16483. };
  16484. const {
  16485. fontName,
  16486. fontSize
  16487. } = this.data.defaultAppearanceData;
  16488. await evaluator.handleSetFont(this._fieldResources.mergedResources, [fontName, fontSize], null, operatorList, task, initialState, null);
  16489. return initialState.font;
  16490. }
  16491. _computeFontSize(font, height) {
  16492. let fontSize = this.data.defaultAppearanceData.fontSize;
  16493. if (!fontSize) {
  16494. const {
  16495. fontColor,
  16496. fontName
  16497. } = this.data.defaultAppearanceData;
  16498. let capHeight;
  16499. if (font.capHeight) {
  16500. capHeight = font.capHeight;
  16501. } else {
  16502. const glyphs = font.charsToGlyphs(font.encodeString("M").join(""));
  16503. if (glyphs.length === 1 && glyphs[0].width) {
  16504. const em = glyphs[0].width / 1000;
  16505. capHeight = 0.7 * em;
  16506. } else {
  16507. capHeight = 0.7;
  16508. }
  16509. }
  16510. fontSize = Math.max(1, Math.floor(height / (1.5 * capHeight)));
  16511. this.data.defaultAppearance = (0, _default_appearance.createDefaultAppearance)({
  16512. fontSize,
  16513. fontName,
  16514. fontColor
  16515. });
  16516. }
  16517. return fontSize;
  16518. }
  16519. _renderText(text, font, fontSize, totalWidth, alignment, hPadding, vPadding) {
  16520. const glyphs = font.charsToGlyphs(text);
  16521. const scale = fontSize / 1000;
  16522. let width = 0;
  16523. for (const glyph of glyphs) {
  16524. width += glyph.width * scale;
  16525. }
  16526. let shift;
  16527. if (alignment === 1) {
  16528. shift = (totalWidth - width) / 2;
  16529. } else if (alignment === 2) {
  16530. shift = totalWidth - width - hPadding;
  16531. } else {
  16532. shift = hPadding;
  16533. }
  16534. shift = shift.toFixed(2);
  16535. vPadding = vPadding.toFixed(2);
  16536. return `${shift} ${vPadding} Td (${(0, _util.escapeString)(text)}) Tj`;
  16537. }
  16538. _getSaveFieldResources(xref) {
  16539. const {
  16540. localResources,
  16541. appearanceResources,
  16542. acroFormResources
  16543. } = this._fieldResources;
  16544. const fontNameStr = this.data.defaultAppearanceData && this.data.defaultAppearanceData.fontName.name;
  16545. if (!fontNameStr) {
  16546. return localResources || _primitives.Dict.empty;
  16547. }
  16548. for (const resources of [localResources, appearanceResources]) {
  16549. if (resources instanceof _primitives.Dict) {
  16550. const localFont = resources.get("Font");
  16551. if (localFont instanceof _primitives.Dict && localFont.has(fontNameStr)) {
  16552. return resources;
  16553. }
  16554. }
  16555. }
  16556. if (acroFormResources instanceof _primitives.Dict) {
  16557. const acroFormFont = acroFormResources.get("Font");
  16558. if (acroFormFont instanceof _primitives.Dict && acroFormFont.has(fontNameStr)) {
  16559. const subFontDict = new _primitives.Dict(xref);
  16560. subFontDict.set(fontNameStr, acroFormFont.getRaw(fontNameStr));
  16561. const subResourcesDict = new _primitives.Dict(xref);
  16562. subResourcesDict.set("Font", subFontDict);
  16563. return _primitives.Dict.merge({
  16564. xref,
  16565. dictArray: [subResourcesDict, localResources],
  16566. mergeSubDicts: true
  16567. });
  16568. }
  16569. }
  16570. return localResources || _primitives.Dict.empty;
  16571. }
  16572. getFieldObject() {
  16573. if (this.data.fieldType === "Sig") {
  16574. return {
  16575. id: this.data.id,
  16576. value: null,
  16577. type: "signature"
  16578. };
  16579. }
  16580. return null;
  16581. }
  16582. }
  16583. class TextWidgetAnnotation extends WidgetAnnotation {
  16584. constructor(params) {
  16585. super(params);
  16586. this._hasText = true;
  16587. const dict = params.dict;
  16588. if (!(0, _util.isString)(this.data.fieldValue)) {
  16589. this.data.fieldValue = "";
  16590. }
  16591. let alignment = (0, _core_utils.getInheritableProperty)({
  16592. dict,
  16593. key: "Q"
  16594. });
  16595. if (!Number.isInteger(alignment) || alignment < 0 || alignment > 2) {
  16596. alignment = null;
  16597. }
  16598. this.data.textAlignment = alignment;
  16599. let maximumLength = (0, _core_utils.getInheritableProperty)({
  16600. dict,
  16601. key: "MaxLen"
  16602. });
  16603. if (!Number.isInteger(maximumLength) || maximumLength < 0) {
  16604. maximumLength = null;
  16605. }
  16606. this.data.maxLen = maximumLength;
  16607. this.data.multiLine = this.hasFieldFlag(_util.AnnotationFieldFlag.MULTILINE);
  16608. this.data.comb = this.hasFieldFlag(_util.AnnotationFieldFlag.COMB) && !this.hasFieldFlag(_util.AnnotationFieldFlag.MULTILINE) && !this.hasFieldFlag(_util.AnnotationFieldFlag.PASSWORD) && !this.hasFieldFlag(_util.AnnotationFieldFlag.FILESELECT) && this.data.maxLen !== null;
  16609. }
  16610. _getCombAppearance(defaultAppearance, font, text, width, hPadding, vPadding) {
  16611. const combWidth = (width / this.data.maxLen).toFixed(2);
  16612. const buf = [];
  16613. const positions = font.getCharPositions(text);
  16614. for (const [start, end] of positions) {
  16615. buf.push(`(${(0, _util.escapeString)(text.substring(start, end))}) Tj`);
  16616. }
  16617. const renderedComb = buf.join(` ${combWidth} 0 Td `);
  16618. return "/Tx BMC q BT " + defaultAppearance + ` 1 0 0 1 ${hPadding} ${vPadding} Tm ${renderedComb}` + " ET Q EMC";
  16619. }
  16620. _getMultilineAppearance(defaultAppearance, text, font, fontSize, width, height, alignment, hPadding, vPadding) {
  16621. const lines = text.split(/\r\n|\r|\n/);
  16622. const buf = [];
  16623. const totalWidth = width - 2 * hPadding;
  16624. for (const line of lines) {
  16625. const chunks = this._splitLine(line, font, fontSize, totalWidth);
  16626. for (const chunk of chunks) {
  16627. const padding = buf.length === 0 ? hPadding : 0;
  16628. buf.push(this._renderText(chunk, font, fontSize, width, alignment, padding, -fontSize));
  16629. }
  16630. }
  16631. const renderedText = buf.join("\n");
  16632. return "/Tx BMC q BT " + defaultAppearance + ` 1 0 0 1 0 ${height} Tm ${renderedText}` + " ET Q EMC";
  16633. }
  16634. _splitLine(line, font, fontSize, width) {
  16635. line = font.encodeString(line).join("");
  16636. const glyphs = font.charsToGlyphs(line);
  16637. if (glyphs.length <= 1) {
  16638. return [line];
  16639. }
  16640. const positions = font.getCharPositions(line);
  16641. const scale = fontSize / 1000;
  16642. const chunks = [];
  16643. let lastSpacePosInStringStart = -1,
  16644. lastSpacePosInStringEnd = -1,
  16645. lastSpacePos = -1,
  16646. startChunk = 0,
  16647. currentWidth = 0;
  16648. for (let i = 0, ii = glyphs.length; i < ii; i++) {
  16649. const [start, end] = positions[i];
  16650. const glyph = glyphs[i];
  16651. const glyphWidth = glyph.width * scale;
  16652. if (glyph.unicode === " ") {
  16653. if (currentWidth + glyphWidth > width) {
  16654. chunks.push(line.substring(startChunk, start));
  16655. startChunk = start;
  16656. currentWidth = glyphWidth;
  16657. lastSpacePosInStringStart = -1;
  16658. lastSpacePos = -1;
  16659. } else {
  16660. currentWidth += glyphWidth;
  16661. lastSpacePosInStringStart = start;
  16662. lastSpacePosInStringEnd = end;
  16663. lastSpacePos = i;
  16664. }
  16665. } else {
  16666. if (currentWidth + glyphWidth > width) {
  16667. if (lastSpacePosInStringStart !== -1) {
  16668. chunks.push(line.substring(startChunk, lastSpacePosInStringEnd));
  16669. startChunk = lastSpacePosInStringEnd;
  16670. i = lastSpacePos + 1;
  16671. lastSpacePosInStringStart = -1;
  16672. currentWidth = 0;
  16673. } else {
  16674. chunks.push(line.substring(startChunk, start));
  16675. startChunk = start;
  16676. currentWidth = glyphWidth;
  16677. }
  16678. } else {
  16679. currentWidth += glyphWidth;
  16680. }
  16681. }
  16682. }
  16683. if (startChunk < line.length) {
  16684. chunks.push(line.substring(startChunk, line.length));
  16685. }
  16686. return chunks;
  16687. }
  16688. getFieldObject() {
  16689. return {
  16690. id: this.data.id,
  16691. value: this.data.fieldValue,
  16692. defaultValue: this.data.defaultFieldValue,
  16693. multiline: this.data.multiLine,
  16694. password: this.hasFieldFlag(_util.AnnotationFieldFlag.PASSWORD),
  16695. charLimit: this.data.maxLen,
  16696. comb: this.data.comb,
  16697. editable: !this.data.readOnly,
  16698. hidden: this.data.hidden,
  16699. name: this.data.fieldName,
  16700. rect: this.data.rect,
  16701. actions: this.data.actions,
  16702. type: "text"
  16703. };
  16704. }
  16705. }
  16706. class ButtonWidgetAnnotation extends WidgetAnnotation {
  16707. constructor(params) {
  16708. super(params);
  16709. this.checkedAppearance = null;
  16710. this.uncheckedAppearance = null;
  16711. this.data.checkBox = !this.hasFieldFlag(_util.AnnotationFieldFlag.RADIO) && !this.hasFieldFlag(_util.AnnotationFieldFlag.PUSHBUTTON);
  16712. this.data.radioButton = this.hasFieldFlag(_util.AnnotationFieldFlag.RADIO) && !this.hasFieldFlag(_util.AnnotationFieldFlag.PUSHBUTTON);
  16713. this.data.pushButton = this.hasFieldFlag(_util.AnnotationFieldFlag.PUSHBUTTON);
  16714. this.data.isTooltipOnly = false;
  16715. if (this.data.checkBox) {
  16716. this._processCheckBox(params);
  16717. } else if (this.data.radioButton) {
  16718. this._processRadioButton(params);
  16719. } else if (this.data.pushButton) {
  16720. this._processPushButton(params);
  16721. } else {
  16722. (0, _util.warn)("Invalid field flags for button widget annotation");
  16723. }
  16724. }
  16725. getOperatorList(evaluator, task, renderForms, annotationStorage) {
  16726. if (this.data.pushButton) {
  16727. return super.getOperatorList(evaluator, task, false, annotationStorage);
  16728. }
  16729. if (annotationStorage) {
  16730. const value = annotationStorage[this.data.id] && annotationStorage[this.data.id].value;
  16731. if (value === undefined) {
  16732. return super.getOperatorList(evaluator, task, renderForms, annotationStorage);
  16733. }
  16734. let appearance;
  16735. if (value) {
  16736. appearance = this.checkedAppearance;
  16737. } else {
  16738. appearance = this.uncheckedAppearance;
  16739. }
  16740. if (appearance) {
  16741. const savedAppearance = this.appearance;
  16742. this.appearance = appearance;
  16743. const operatorList = super.getOperatorList(evaluator, task, renderForms, annotationStorage);
  16744. this.appearance = savedAppearance;
  16745. return operatorList;
  16746. }
  16747. return Promise.resolve(new _operator_list.OperatorList());
  16748. }
  16749. return super.getOperatorList(evaluator, task, renderForms, annotationStorage);
  16750. }
  16751. async save(evaluator, task, annotationStorage) {
  16752. if (this.data.checkBox) {
  16753. return this._saveCheckbox(evaluator, task, annotationStorage);
  16754. }
  16755. if (this.data.radioButton) {
  16756. return this._saveRadioButton(evaluator, task, annotationStorage);
  16757. }
  16758. return null;
  16759. }
  16760. async _saveCheckbox(evaluator, task, annotationStorage) {
  16761. const value = annotationStorage[this.data.id] && annotationStorage[this.data.id].value;
  16762. if (value === undefined) {
  16763. return null;
  16764. }
  16765. const defaultValue = this.data.fieldValue && this.data.fieldValue !== "Off";
  16766. if (defaultValue === value) {
  16767. return null;
  16768. }
  16769. const dict = evaluator.xref.fetchIfRef(this.ref);
  16770. if (!(0, _primitives.isDict)(dict)) {
  16771. return null;
  16772. }
  16773. const xfa = {
  16774. path: (0, _util.stringToPDFString)(dict.get("T") || ""),
  16775. value: value ? this.data.exportValue : ""
  16776. };
  16777. const name = _primitives.Name.get(value ? this.data.exportValue : "Off");
  16778. dict.set("V", name);
  16779. dict.set("AS", name);
  16780. dict.set("M", `D:${(0, _util.getModificationDate)()}`);
  16781. const encrypt = evaluator.xref.encrypt;
  16782. let originalTransform = null;
  16783. if (encrypt) {
  16784. originalTransform = encrypt.createCipherTransform(this.ref.num, this.ref.gen);
  16785. }
  16786. const buffer = [`${this.ref.num} ${this.ref.gen} obj\n`];
  16787. (0, _writer.writeDict)(dict, buffer, originalTransform);
  16788. buffer.push("\nendobj\n");
  16789. return [{
  16790. ref: this.ref,
  16791. data: buffer.join(""),
  16792. xfa
  16793. }];
  16794. }
  16795. async _saveRadioButton(evaluator, task, annotationStorage) {
  16796. const value = annotationStorage[this.data.id] && annotationStorage[this.data.id].value;
  16797. if (value === undefined) {
  16798. return null;
  16799. }
  16800. const defaultValue = this.data.fieldValue === this.data.buttonValue;
  16801. if (defaultValue === value) {
  16802. return null;
  16803. }
  16804. const dict = evaluator.xref.fetchIfRef(this.ref);
  16805. if (!(0, _primitives.isDict)(dict)) {
  16806. return null;
  16807. }
  16808. const xfa = {
  16809. path: (0, _util.stringToPDFString)(dict.get("T") || ""),
  16810. value: value ? this.data.buttonValue : ""
  16811. };
  16812. const name = _primitives.Name.get(value ? this.data.buttonValue : "Off");
  16813. let parentBuffer = null;
  16814. const encrypt = evaluator.xref.encrypt;
  16815. if (value) {
  16816. if ((0, _primitives.isRef)(this.parent)) {
  16817. const parent = evaluator.xref.fetch(this.parent);
  16818. let parentTransform = null;
  16819. if (encrypt) {
  16820. parentTransform = encrypt.createCipherTransform(this.parent.num, this.parent.gen);
  16821. }
  16822. parent.set("V", name);
  16823. parentBuffer = [`${this.parent.num} ${this.parent.gen} obj\n`];
  16824. (0, _writer.writeDict)(parent, parentBuffer, parentTransform);
  16825. parentBuffer.push("\nendobj\n");
  16826. } else if ((0, _primitives.isDict)(this.parent)) {
  16827. this.parent.set("V", name);
  16828. }
  16829. }
  16830. dict.set("AS", name);
  16831. dict.set("M", `D:${(0, _util.getModificationDate)()}`);
  16832. let originalTransform = null;
  16833. if (encrypt) {
  16834. originalTransform = encrypt.createCipherTransform(this.ref.num, this.ref.gen);
  16835. }
  16836. const buffer = [`${this.ref.num} ${this.ref.gen} obj\n`];
  16837. (0, _writer.writeDict)(dict, buffer, originalTransform);
  16838. buffer.push("\nendobj\n");
  16839. const newRefs = [{
  16840. ref: this.ref,
  16841. data: buffer.join(""),
  16842. xfa
  16843. }];
  16844. if (parentBuffer !== null) {
  16845. newRefs.push({
  16846. ref: this.parent,
  16847. data: parentBuffer.join(""),
  16848. xfa: null
  16849. });
  16850. }
  16851. return newRefs;
  16852. }
  16853. _processCheckBox(params) {
  16854. const customAppearance = params.dict.get("AP");
  16855. if (!(0, _primitives.isDict)(customAppearance)) {
  16856. return;
  16857. }
  16858. const normalAppearance = customAppearance.get("N");
  16859. if (!(0, _primitives.isDict)(normalAppearance)) {
  16860. return;
  16861. }
  16862. const exportValues = normalAppearance.getKeys();
  16863. if (!exportValues.includes("Off")) {
  16864. exportValues.push("Off");
  16865. }
  16866. if (exportValues.length !== 2) {
  16867. return;
  16868. }
  16869. this.data.exportValue = exportValues[0] === "Off" ? exportValues[1] : exportValues[0];
  16870. this.checkedAppearance = normalAppearance.get(this.data.exportValue);
  16871. this.uncheckedAppearance = normalAppearance.get("Off") || null;
  16872. this._streams.push(this.checkedAppearance);
  16873. if (this.uncheckedAppearance) {
  16874. this._streams.push(this.uncheckedAppearance);
  16875. }
  16876. this._fallbackFontDict = this.fallbackFontDict;
  16877. }
  16878. _processRadioButton(params) {
  16879. this.data.fieldValue = this.data.buttonValue = null;
  16880. const fieldParent = params.dict.get("Parent");
  16881. if ((0, _primitives.isDict)(fieldParent)) {
  16882. this.parent = params.dict.getRaw("Parent");
  16883. const fieldParentValue = fieldParent.get("V");
  16884. if ((0, _primitives.isName)(fieldParentValue)) {
  16885. this.data.fieldValue = this._decodeFormValue(fieldParentValue);
  16886. }
  16887. }
  16888. const appearanceStates = params.dict.get("AP");
  16889. if (!(0, _primitives.isDict)(appearanceStates)) {
  16890. return;
  16891. }
  16892. const normalAppearance = appearanceStates.get("N");
  16893. if (!(0, _primitives.isDict)(normalAppearance)) {
  16894. return;
  16895. }
  16896. for (const key of normalAppearance.getKeys()) {
  16897. if (key !== "Off") {
  16898. this.data.buttonValue = this._decodeFormValue(key);
  16899. break;
  16900. }
  16901. }
  16902. this.checkedAppearance = normalAppearance.get(this.data.buttonValue);
  16903. this.uncheckedAppearance = normalAppearance.get("Off") || null;
  16904. this._streams.push(this.checkedAppearance);
  16905. if (this.uncheckedAppearance) {
  16906. this._streams.push(this.uncheckedAppearance);
  16907. }
  16908. this._fallbackFontDict = this.fallbackFontDict;
  16909. }
  16910. _processPushButton(params) {
  16911. if (!params.dict.has("A") && !params.dict.has("AA") && !this.data.alternativeText) {
  16912. (0, _util.warn)("Push buttons without action dictionaries are not supported");
  16913. return;
  16914. }
  16915. this.data.isTooltipOnly = !params.dict.has("A") && !params.dict.has("AA");
  16916. _obj.Catalog.parseDestDictionary({
  16917. destDict: params.dict,
  16918. resultObj: this.data,
  16919. docBaseUrl: params.pdfManager.docBaseUrl
  16920. });
  16921. }
  16922. getFieldObject() {
  16923. let type = "button";
  16924. let exportValues;
  16925. if (this.data.checkBox) {
  16926. type = "checkbox";
  16927. exportValues = this.data.exportValue;
  16928. } else if (this.data.radioButton) {
  16929. type = "radiobutton";
  16930. exportValues = this.data.buttonValue;
  16931. }
  16932. return {
  16933. id: this.data.id,
  16934. value: this.data.fieldValue || "Off",
  16935. defaultValue: this.data.defaultFieldValue,
  16936. exportValues,
  16937. editable: !this.data.readOnly,
  16938. name: this.data.fieldName,
  16939. rect: this.data.rect,
  16940. hidden: this.data.hidden,
  16941. actions: this.data.actions,
  16942. type
  16943. };
  16944. }
  16945. get fallbackFontDict() {
  16946. const dict = new _primitives.Dict();
  16947. dict.set("BaseFont", _primitives.Name.get("ZapfDingbats"));
  16948. dict.set("Type", _primitives.Name.get("FallbackType"));
  16949. dict.set("Subtype", _primitives.Name.get("FallbackType"));
  16950. dict.set("Encoding", _primitives.Name.get("ZapfDingbatsEncoding"));
  16951. return (0, _util.shadow)(this, "fallbackFontDict", dict);
  16952. }
  16953. }
  16954. class ChoiceWidgetAnnotation extends WidgetAnnotation {
  16955. constructor(params) {
  16956. super(params);
  16957. this.data.options = [];
  16958. const options = (0, _core_utils.getInheritableProperty)({
  16959. dict: params.dict,
  16960. key: "Opt"
  16961. });
  16962. if (Array.isArray(options)) {
  16963. const xref = params.xref;
  16964. for (let i = 0, ii = options.length; i < ii; i++) {
  16965. const option = xref.fetchIfRef(options[i]);
  16966. const isOptionArray = Array.isArray(option);
  16967. this.data.options[i] = {
  16968. exportValue: this._decodeFormValue(isOptionArray ? xref.fetchIfRef(option[0]) : option),
  16969. displayValue: this._decodeFormValue(isOptionArray ? xref.fetchIfRef(option[1]) : option)
  16970. };
  16971. }
  16972. }
  16973. if ((0, _util.isString)(this.data.fieldValue)) {
  16974. this.data.fieldValue = [this.data.fieldValue];
  16975. } else if (!this.data.fieldValue) {
  16976. this.data.fieldValue = [];
  16977. }
  16978. this.data.combo = this.hasFieldFlag(_util.AnnotationFieldFlag.COMBO);
  16979. this.data.multiSelect = this.hasFieldFlag(_util.AnnotationFieldFlag.MULTISELECT);
  16980. this._hasText = true;
  16981. }
  16982. getFieldObject() {
  16983. const type = this.data.combo ? "combobox" : "listbox";
  16984. const value = this.data.fieldValue.length > 0 ? this.data.fieldValue[0] : null;
  16985. return {
  16986. id: this.data.id,
  16987. value,
  16988. defaultValue: this.data.defaultFieldValue,
  16989. editable: !this.data.readOnly,
  16990. name: this.data.fieldName,
  16991. rect: this.data.rect,
  16992. numItems: this.data.fieldValue.length,
  16993. multipleSelection: this.data.multiSelect,
  16994. hidden: this.data.hidden,
  16995. actions: this.data.actions,
  16996. type
  16997. };
  16998. }
  16999. }
  17000. class TextAnnotation extends MarkupAnnotation {
  17001. constructor(parameters) {
  17002. const DEFAULT_ICON_SIZE = 22;
  17003. super(parameters);
  17004. const dict = parameters.dict;
  17005. this.data.annotationType = _util.AnnotationType.TEXT;
  17006. if (this.data.hasAppearance) {
  17007. this.data.name = "NoIcon";
  17008. } else {
  17009. this.data.rect[1] = this.data.rect[3] - DEFAULT_ICON_SIZE;
  17010. this.data.rect[2] = this.data.rect[0] + DEFAULT_ICON_SIZE;
  17011. this.data.name = dict.has("Name") ? dict.get("Name").name : "Note";
  17012. }
  17013. if (dict.has("State")) {
  17014. this.data.state = dict.get("State") || null;
  17015. this.data.stateModel = dict.get("StateModel") || null;
  17016. } else {
  17017. this.data.state = null;
  17018. this.data.stateModel = null;
  17019. }
  17020. }
  17021. }
  17022. class LinkAnnotation extends Annotation {
  17023. constructor(params) {
  17024. super(params);
  17025. this.data.annotationType = _util.AnnotationType.LINK;
  17026. const quadPoints = getQuadPoints(params.dict, this.rectangle);
  17027. if (quadPoints) {
  17028. this.data.quadPoints = quadPoints;
  17029. }
  17030. _obj.Catalog.parseDestDictionary({
  17031. destDict: params.dict,
  17032. resultObj: this.data,
  17033. docBaseUrl: params.pdfManager.docBaseUrl
  17034. });
  17035. }
  17036. }
  17037. class PopupAnnotation extends Annotation {
  17038. constructor(parameters) {
  17039. super(parameters);
  17040. this.data.annotationType = _util.AnnotationType.POPUP;
  17041. let parentItem = parameters.dict.get("Parent");
  17042. if (!parentItem) {
  17043. (0, _util.warn)("Popup annotation has a missing or invalid parent annotation.");
  17044. return;
  17045. }
  17046. const parentSubtype = parentItem.get("Subtype");
  17047. this.data.parentType = (0, _primitives.isName)(parentSubtype) ? parentSubtype.name : null;
  17048. const rawParent = parameters.dict.getRaw("Parent");
  17049. this.data.parentId = (0, _primitives.isRef)(rawParent) ? rawParent.toString() : null;
  17050. const parentRect = parentItem.getArray("Rect");
  17051. if (Array.isArray(parentRect) && parentRect.length === 4) {
  17052. this.data.parentRect = _util.Util.normalizeRect(parentRect);
  17053. } else {
  17054. this.data.parentRect = [0, 0, 0, 0];
  17055. }
  17056. const rt = parentItem.get("RT");
  17057. if ((0, _primitives.isName)(rt, _util.AnnotationReplyType.GROUP)) {
  17058. parentItem = parentItem.get("IRT");
  17059. }
  17060. if (!parentItem.has("M")) {
  17061. this.data.modificationDate = null;
  17062. } else {
  17063. this.setModificationDate(parentItem.get("M"));
  17064. this.data.modificationDate = this.modificationDate;
  17065. }
  17066. if (!parentItem.has("C")) {
  17067. this.data.color = null;
  17068. } else {
  17069. this.setColor(parentItem.getArray("C"));
  17070. this.data.color = this.color;
  17071. }
  17072. if (!this.viewable) {
  17073. const parentFlags = parentItem.get("F");
  17074. if (this._isViewable(parentFlags)) {
  17075. this.setFlags(parentFlags);
  17076. }
  17077. }
  17078. this.data.title = (0, _util.stringToPDFString)(parentItem.get("T") || "");
  17079. this.data.contents = (0, _util.stringToPDFString)(parentItem.get("Contents") || "");
  17080. }
  17081. }
  17082. class FreeTextAnnotation extends MarkupAnnotation {
  17083. constructor(parameters) {
  17084. super(parameters);
  17085. this.data.annotationType = _util.AnnotationType.FREETEXT;
  17086. }
  17087. }
  17088. class LineAnnotation extends MarkupAnnotation {
  17089. constructor(parameters) {
  17090. super(parameters);
  17091. this.data.annotationType = _util.AnnotationType.LINE;
  17092. this.data.lineCoordinates = _util.Util.normalizeRect(parameters.dict.getArray("L"));
  17093. }
  17094. }
  17095. class SquareAnnotation extends MarkupAnnotation {
  17096. constructor(parameters) {
  17097. super(parameters);
  17098. this.data.annotationType = _util.AnnotationType.SQUARE;
  17099. }
  17100. }
  17101. class CircleAnnotation extends MarkupAnnotation {
  17102. constructor(parameters) {
  17103. super(parameters);
  17104. this.data.annotationType = _util.AnnotationType.CIRCLE;
  17105. }
  17106. }
  17107. class PolylineAnnotation extends MarkupAnnotation {
  17108. constructor(parameters) {
  17109. super(parameters);
  17110. this.data.annotationType = _util.AnnotationType.POLYLINE;
  17111. this.data.vertices = [];
  17112. const rawVertices = parameters.dict.getArray("Vertices");
  17113. if (!Array.isArray(rawVertices)) {
  17114. return;
  17115. }
  17116. for (let i = 0, ii = rawVertices.length; i < ii; i += 2) {
  17117. this.data.vertices.push({
  17118. x: rawVertices[i],
  17119. y: rawVertices[i + 1]
  17120. });
  17121. }
  17122. }
  17123. }
  17124. class PolygonAnnotation extends PolylineAnnotation {
  17125. constructor(parameters) {
  17126. super(parameters);
  17127. this.data.annotationType = _util.AnnotationType.POLYGON;
  17128. }
  17129. }
  17130. class CaretAnnotation extends MarkupAnnotation {
  17131. constructor(parameters) {
  17132. super(parameters);
  17133. this.data.annotationType = _util.AnnotationType.CARET;
  17134. }
  17135. }
  17136. class InkAnnotation extends MarkupAnnotation {
  17137. constructor(parameters) {
  17138. super(parameters);
  17139. this.data.annotationType = _util.AnnotationType.INK;
  17140. this.data.inkLists = [];
  17141. const rawInkLists = parameters.dict.getArray("InkList");
  17142. if (!Array.isArray(rawInkLists)) {
  17143. return;
  17144. }
  17145. const xref = parameters.xref;
  17146. for (let i = 0, ii = rawInkLists.length; i < ii; ++i) {
  17147. this.data.inkLists.push([]);
  17148. for (let j = 0, jj = rawInkLists[i].length; j < jj; j += 2) {
  17149. this.data.inkLists[i].push({
  17150. x: xref.fetchIfRef(rawInkLists[i][j]),
  17151. y: xref.fetchIfRef(rawInkLists[i][j + 1])
  17152. });
  17153. }
  17154. }
  17155. }
  17156. }
  17157. class HighlightAnnotation extends MarkupAnnotation {
  17158. constructor(parameters) {
  17159. super(parameters);
  17160. this.data.annotationType = _util.AnnotationType.HIGHLIGHT;
  17161. const quadPoints = this.data.quadPoints = getQuadPoints(parameters.dict, null);
  17162. if (quadPoints) {
  17163. if (!this.appearance) {
  17164. const fillColor = this.color ? Array.from(this.color).map(c => c / 255) : [1, 1, 0];
  17165. this._setDefaultAppearance({
  17166. xref: parameters.xref,
  17167. fillColor,
  17168. blendMode: "Multiply",
  17169. pointsCallback: (buffer, points) => {
  17170. buffer.push(`${points[0].x} ${points[0].y} m`);
  17171. buffer.push(`${points[1].x} ${points[1].y} l`);
  17172. buffer.push(`${points[3].x} ${points[3].y} l`);
  17173. buffer.push(`${points[2].x} ${points[2].y} l`);
  17174. buffer.push("f");
  17175. return [points[0].x, points[1].x, points[3].y, points[1].y];
  17176. }
  17177. });
  17178. }
  17179. } else {
  17180. this.data.hasPopup = false;
  17181. }
  17182. }
  17183. }
  17184. class UnderlineAnnotation extends MarkupAnnotation {
  17185. constructor(parameters) {
  17186. super(parameters);
  17187. this.data.annotationType = _util.AnnotationType.UNDERLINE;
  17188. const quadPoints = this.data.quadPoints = getQuadPoints(parameters.dict, null);
  17189. if (quadPoints) {
  17190. if (!this.appearance) {
  17191. const strokeColor = this.color ? Array.from(this.color).map(c => c / 255) : [0, 0, 0];
  17192. this._setDefaultAppearance({
  17193. xref: parameters.xref,
  17194. extra: "[] 0 d 1 w",
  17195. strokeColor,
  17196. pointsCallback: (buffer, points) => {
  17197. buffer.push(`${points[2].x} ${points[2].y} m`);
  17198. buffer.push(`${points[3].x} ${points[3].y} l`);
  17199. buffer.push("S");
  17200. return [points[0].x, points[1].x, points[3].y, points[1].y];
  17201. }
  17202. });
  17203. }
  17204. } else {
  17205. this.data.hasPopup = false;
  17206. }
  17207. }
  17208. }
  17209. class SquigglyAnnotation extends MarkupAnnotation {
  17210. constructor(parameters) {
  17211. super(parameters);
  17212. this.data.annotationType = _util.AnnotationType.SQUIGGLY;
  17213. const quadPoints = this.data.quadPoints = getQuadPoints(parameters.dict, null);
  17214. if (quadPoints) {
  17215. if (!this.appearance) {
  17216. const strokeColor = this.color ? Array.from(this.color).map(c => c / 255) : [0, 0, 0];
  17217. this._setDefaultAppearance({
  17218. xref: parameters.xref,
  17219. extra: "[] 0 d 1 w",
  17220. strokeColor,
  17221. pointsCallback: (buffer, points) => {
  17222. const dy = (points[0].y - points[2].y) / 6;
  17223. let shift = dy;
  17224. let x = points[2].x;
  17225. const y = points[2].y;
  17226. const xEnd = points[3].x;
  17227. buffer.push(`${x} ${y + shift} m`);
  17228. do {
  17229. x += 2;
  17230. shift = shift === 0 ? dy : 0;
  17231. buffer.push(`${x} ${y + shift} l`);
  17232. } while (x < xEnd);
  17233. buffer.push("S");
  17234. return [points[2].x, xEnd, y - 2 * dy, y + 2 * dy];
  17235. }
  17236. });
  17237. }
  17238. } else {
  17239. this.data.hasPopup = false;
  17240. }
  17241. }
  17242. }
  17243. class StrikeOutAnnotation extends MarkupAnnotation {
  17244. constructor(parameters) {
  17245. super(parameters);
  17246. this.data.annotationType = _util.AnnotationType.STRIKEOUT;
  17247. const quadPoints = this.data.quadPoints = getQuadPoints(parameters.dict, null);
  17248. if (quadPoints) {
  17249. if (!this.appearance) {
  17250. const strokeColor = this.color ? Array.from(this.color).map(c => c / 255) : [0, 0, 0];
  17251. this._setDefaultAppearance({
  17252. xref: parameters.xref,
  17253. extra: "[] 0 d 1 w",
  17254. strokeColor,
  17255. pointsCallback: (buffer, points) => {
  17256. buffer.push(`${(points[0].x + points[2].x) / 2}` + ` ${(points[0].y + points[2].y) / 2} m`);
  17257. buffer.push(`${(points[1].x + points[3].x) / 2}` + ` ${(points[1].y + points[3].y) / 2} l`);
  17258. buffer.push("S");
  17259. return [points[0].x, points[1].x, points[3].y, points[1].y];
  17260. }
  17261. });
  17262. }
  17263. } else {
  17264. this.data.hasPopup = false;
  17265. }
  17266. }
  17267. }
  17268. class StampAnnotation extends MarkupAnnotation {
  17269. constructor(parameters) {
  17270. super(parameters);
  17271. this.data.annotationType = _util.AnnotationType.STAMP;
  17272. }
  17273. }
  17274. class FileAttachmentAnnotation extends MarkupAnnotation {
  17275. constructor(parameters) {
  17276. super(parameters);
  17277. const file = new _obj.FileSpec(parameters.dict.get("FS"), parameters.xref);
  17278. this.data.annotationType = _util.AnnotationType.FILEATTACHMENT;
  17279. this.data.file = file.serializable;
  17280. }
  17281. }
  17282. /***/ }),
  17283. /* 26 */
  17284. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  17285. Object.defineProperty(exports, "__esModule", ({
  17286. value: true
  17287. }));
  17288. exports.createDefaultAppearance = createDefaultAppearance;
  17289. exports.parseDefaultAppearance = parseDefaultAppearance;
  17290. var _primitives = __w_pdfjs_require__(5);
  17291. var _util = __w_pdfjs_require__(2);
  17292. var _colorspace = __w_pdfjs_require__(23);
  17293. var _core_utils = __w_pdfjs_require__(8);
  17294. var _evaluator = __w_pdfjs_require__(27);
  17295. var _stream = __w_pdfjs_require__(12);
  17296. class DefaultAppearanceEvaluator extends _evaluator.EvaluatorPreprocessor {
  17297. constructor(str) {
  17298. super(new _stream.StringStream(str));
  17299. }
  17300. parse() {
  17301. const operation = {
  17302. fn: 0,
  17303. args: []
  17304. };
  17305. const result = {
  17306. fontSize: 0,
  17307. fontName: _primitives.Name.get(""),
  17308. fontColor: new Uint8ClampedArray([0, 0, 0])
  17309. };
  17310. try {
  17311. while (true) {
  17312. operation.args.length = 0;
  17313. if (!this.read(operation)) {
  17314. break;
  17315. }
  17316. if (this.savedStatesDepth !== 0) {
  17317. continue;
  17318. }
  17319. const {
  17320. fn,
  17321. args
  17322. } = operation;
  17323. switch (fn | 0) {
  17324. case _util.OPS.setFont:
  17325. const [fontName, fontSize] = args;
  17326. if ((0, _primitives.isName)(fontName)) {
  17327. result.fontName = fontName;
  17328. }
  17329. if (typeof fontSize === "number" && fontSize > 0) {
  17330. result.fontSize = fontSize;
  17331. }
  17332. break;
  17333. case _util.OPS.setFillRGBColor:
  17334. _colorspace.ColorSpace.singletons.rgb.getRgbItem(args, 0, result.fontColor, 0);
  17335. break;
  17336. case _util.OPS.setFillGray:
  17337. _colorspace.ColorSpace.singletons.gray.getRgbItem(args, 0, result.fontColor, 0);
  17338. break;
  17339. case _util.OPS.setFillColorSpace:
  17340. _colorspace.ColorSpace.singletons.cmyk.getRgbItem(args, 0, result.fontColor, 0);
  17341. break;
  17342. }
  17343. }
  17344. } catch (reason) {
  17345. (0, _util.warn)(`parseDefaultAppearance - ignoring errors: "${reason}".`);
  17346. }
  17347. return result;
  17348. }
  17349. }
  17350. function parseDefaultAppearance(str) {
  17351. return new DefaultAppearanceEvaluator(str).parse();
  17352. }
  17353. function createDefaultAppearance({
  17354. fontSize,
  17355. fontName,
  17356. fontColor
  17357. }) {
  17358. let colorCmd;
  17359. if (fontColor.every(c => c === 0)) {
  17360. colorCmd = "0 g";
  17361. } else {
  17362. colorCmd = Array.from(fontColor).map(c => (c / 255).toFixed(2)).join(" ") + " rg";
  17363. }
  17364. return `/${(0, _core_utils.escapePDFName)(fontName.name)} ${fontSize} Tf ${colorCmd}`;
  17365. }
  17366. /***/ }),
  17367. /* 27 */
  17368. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  17369. Object.defineProperty(exports, "__esModule", ({
  17370. value: true
  17371. }));
  17372. exports.PartialEvaluator = exports.EvaluatorPreprocessor = void 0;
  17373. var _util = __w_pdfjs_require__(2);
  17374. var _cmap = __w_pdfjs_require__(28);
  17375. var _primitives = __w_pdfjs_require__(5);
  17376. var _fonts = __w_pdfjs_require__(29);
  17377. var _encodings = __w_pdfjs_require__(32);
  17378. var _core_utils = __w_pdfjs_require__(8);
  17379. var _unicode = __w_pdfjs_require__(35);
  17380. var _standard_fonts = __w_pdfjs_require__(34);
  17381. var _pattern = __w_pdfjs_require__(38);
  17382. var _function = __w_pdfjs_require__(39);
  17383. var _parser = __w_pdfjs_require__(11);
  17384. var _image_utils = __w_pdfjs_require__(24);
  17385. var _bidi = __w_pdfjs_require__(41);
  17386. var _colorspace = __w_pdfjs_require__(23);
  17387. var _stream = __w_pdfjs_require__(12);
  17388. var _glyphlist = __w_pdfjs_require__(33);
  17389. var _metrics = __w_pdfjs_require__(42);
  17390. var _murmurhash = __w_pdfjs_require__(43);
  17391. var _operator_list = __w_pdfjs_require__(44);
  17392. var _image = __w_pdfjs_require__(45);
  17393. const DefaultPartialEvaluatorOptions = Object.freeze({
  17394. maxImageSize: -1,
  17395. disableFontFace: false,
  17396. ignoreErrors: false,
  17397. isEvalSupported: true,
  17398. fontExtraProperties: false
  17399. });
  17400. const PatternType = {
  17401. TILING: 1,
  17402. SHADING: 2
  17403. };
  17404. const deferred = Promise.resolve();
  17405. function normalizeBlendMode(value, parsingArray = false) {
  17406. if (Array.isArray(value)) {
  17407. for (let i = 0, ii = value.length; i < ii; i++) {
  17408. const maybeBM = normalizeBlendMode(value[i], true);
  17409. if (maybeBM) {
  17410. return maybeBM;
  17411. }
  17412. }
  17413. (0, _util.warn)(`Unsupported blend mode Array: ${value}`);
  17414. return "source-over";
  17415. }
  17416. if (!(0, _primitives.isName)(value)) {
  17417. if (parsingArray) {
  17418. return null;
  17419. }
  17420. return "source-over";
  17421. }
  17422. switch (value.name) {
  17423. case "Normal":
  17424. case "Compatible":
  17425. return "source-over";
  17426. case "Multiply":
  17427. return "multiply";
  17428. case "Screen":
  17429. return "screen";
  17430. case "Overlay":
  17431. return "overlay";
  17432. case "Darken":
  17433. return "darken";
  17434. case "Lighten":
  17435. return "lighten";
  17436. case "ColorDodge":
  17437. return "color-dodge";
  17438. case "ColorBurn":
  17439. return "color-burn";
  17440. case "HardLight":
  17441. return "hard-light";
  17442. case "SoftLight":
  17443. return "soft-light";
  17444. case "Difference":
  17445. return "difference";
  17446. case "Exclusion":
  17447. return "exclusion";
  17448. case "Hue":
  17449. return "hue";
  17450. case "Saturation":
  17451. return "saturation";
  17452. case "Color":
  17453. return "color";
  17454. case "Luminosity":
  17455. return "luminosity";
  17456. }
  17457. if (parsingArray) {
  17458. return null;
  17459. }
  17460. (0, _util.warn)(`Unsupported blend mode: ${value.name}`);
  17461. return "source-over";
  17462. }
  17463. class TimeSlotManager {
  17464. static get TIME_SLOT_DURATION_MS() {
  17465. return (0, _util.shadow)(this, "TIME_SLOT_DURATION_MS", 20);
  17466. }
  17467. static get CHECK_TIME_EVERY() {
  17468. return (0, _util.shadow)(this, "CHECK_TIME_EVERY", 100);
  17469. }
  17470. constructor() {
  17471. this.reset();
  17472. }
  17473. check() {
  17474. if (++this.checked < TimeSlotManager.CHECK_TIME_EVERY) {
  17475. return false;
  17476. }
  17477. this.checked = 0;
  17478. return this.endTime <= Date.now();
  17479. }
  17480. reset() {
  17481. this.endTime = Date.now() + TimeSlotManager.TIME_SLOT_DURATION_MS;
  17482. this.checked = 0;
  17483. }
  17484. }
  17485. class PartialEvaluator {
  17486. constructor({
  17487. xref,
  17488. handler,
  17489. pageIndex,
  17490. idFactory,
  17491. fontCache,
  17492. builtInCMapCache,
  17493. globalImageCache,
  17494. options = null
  17495. }) {
  17496. this.xref = xref;
  17497. this.handler = handler;
  17498. this.pageIndex = pageIndex;
  17499. this.idFactory = idFactory;
  17500. this.fontCache = fontCache;
  17501. this.builtInCMapCache = builtInCMapCache;
  17502. this.globalImageCache = globalImageCache;
  17503. this.options = options || DefaultPartialEvaluatorOptions;
  17504. this.parsingType3Font = false;
  17505. this._fetchBuiltInCMapBound = this.fetchBuiltInCMap.bind(this);
  17506. }
  17507. get _pdfFunctionFactory() {
  17508. const pdfFunctionFactory = new _function.PDFFunctionFactory({
  17509. xref: this.xref,
  17510. isEvalSupported: this.options.isEvalSupported
  17511. });
  17512. return (0, _util.shadow)(this, "_pdfFunctionFactory", pdfFunctionFactory);
  17513. }
  17514. clone(newOptions = DefaultPartialEvaluatorOptions) {
  17515. var newEvaluator = Object.create(this);
  17516. newEvaluator.options = newOptions;
  17517. return newEvaluator;
  17518. }
  17519. hasBlendModes(resources, nonBlendModesSet) {
  17520. if (!(resources instanceof _primitives.Dict)) {
  17521. return false;
  17522. }
  17523. if (resources.objId && nonBlendModesSet.has(resources.objId)) {
  17524. return false;
  17525. }
  17526. const processed = new _primitives.RefSet(nonBlendModesSet);
  17527. if (resources.objId) {
  17528. processed.put(resources.objId);
  17529. }
  17530. var nodes = [resources],
  17531. xref = this.xref;
  17532. while (nodes.length) {
  17533. var node = nodes.shift();
  17534. var graphicStates = node.get("ExtGState");
  17535. if (graphicStates instanceof _primitives.Dict) {
  17536. for (let graphicState of graphicStates.getRawValues()) {
  17537. if (graphicState instanceof _primitives.Ref) {
  17538. if (processed.has(graphicState)) {
  17539. continue;
  17540. }
  17541. try {
  17542. graphicState = xref.fetch(graphicState);
  17543. } catch (ex) {
  17544. if (ex instanceof _core_utils.MissingDataException) {
  17545. throw ex;
  17546. }
  17547. processed.put(graphicState);
  17548. (0, _util.info)(`hasBlendModes - ignoring ExtGState: "${ex}".`);
  17549. continue;
  17550. }
  17551. }
  17552. if (!(graphicState instanceof _primitives.Dict)) {
  17553. continue;
  17554. }
  17555. if (graphicState.objId) {
  17556. processed.put(graphicState.objId);
  17557. }
  17558. const bm = graphicState.get("BM");
  17559. if (bm instanceof _primitives.Name) {
  17560. if (bm.name !== "Normal") {
  17561. return true;
  17562. }
  17563. continue;
  17564. }
  17565. if (bm !== undefined && Array.isArray(bm)) {
  17566. for (const element of bm) {
  17567. if (element instanceof _primitives.Name && element.name !== "Normal") {
  17568. return true;
  17569. }
  17570. }
  17571. }
  17572. }
  17573. }
  17574. var xObjects = node.get("XObject");
  17575. if (!(xObjects instanceof _primitives.Dict)) {
  17576. continue;
  17577. }
  17578. for (let xObject of xObjects.getRawValues()) {
  17579. if (xObject instanceof _primitives.Ref) {
  17580. if (processed.has(xObject)) {
  17581. continue;
  17582. }
  17583. try {
  17584. xObject = xref.fetch(xObject);
  17585. } catch (ex) {
  17586. if (ex instanceof _core_utils.MissingDataException) {
  17587. throw ex;
  17588. }
  17589. processed.put(xObject);
  17590. (0, _util.info)(`hasBlendModes - ignoring XObject: "${ex}".`);
  17591. continue;
  17592. }
  17593. }
  17594. if (!(0, _primitives.isStream)(xObject)) {
  17595. continue;
  17596. }
  17597. if (xObject.dict.objId) {
  17598. processed.put(xObject.dict.objId);
  17599. }
  17600. var xResources = xObject.dict.get("Resources");
  17601. if (!(xResources instanceof _primitives.Dict)) {
  17602. continue;
  17603. }
  17604. if (xResources.objId && processed.has(xResources.objId)) {
  17605. continue;
  17606. }
  17607. nodes.push(xResources);
  17608. if (xResources.objId) {
  17609. processed.put(xResources.objId);
  17610. }
  17611. }
  17612. }
  17613. processed.forEach(ref => {
  17614. nonBlendModesSet.put(ref);
  17615. });
  17616. return false;
  17617. }
  17618. async fetchBuiltInCMap(name) {
  17619. const cachedData = this.builtInCMapCache.get(name);
  17620. if (cachedData) {
  17621. return cachedData;
  17622. }
  17623. const readableStream = this.handler.sendWithStream("FetchBuiltInCMap", {
  17624. name
  17625. });
  17626. const reader = readableStream.getReader();
  17627. const data = await new Promise(function (resolve, reject) {
  17628. function pump() {
  17629. reader.read().then(function ({
  17630. value,
  17631. done
  17632. }) {
  17633. if (done) {
  17634. return;
  17635. }
  17636. resolve(value);
  17637. pump();
  17638. }, reject);
  17639. }
  17640. pump();
  17641. });
  17642. if (data.compressionType !== _util.CMapCompressionType.NONE) {
  17643. this.builtInCMapCache.set(name, data);
  17644. }
  17645. return data;
  17646. }
  17647. async buildFormXObject(resources, xobj, smask, operatorList, task, initialState, localColorSpaceCache) {
  17648. var dict = xobj.dict;
  17649. var matrix = dict.getArray("Matrix");
  17650. var bbox = dict.getArray("BBox");
  17651. if (Array.isArray(bbox) && bbox.length === 4) {
  17652. bbox = _util.Util.normalizeRect(bbox);
  17653. } else {
  17654. bbox = null;
  17655. }
  17656. let optionalContent = null;
  17657. if (dict.has("OC")) {
  17658. optionalContent = await this.parseMarkedContentProps(dict.get("OC"), resources);
  17659. operatorList.addOp(_util.OPS.beginMarkedContentProps, ["OC", optionalContent]);
  17660. }
  17661. var group = dict.get("Group");
  17662. if (group) {
  17663. var groupOptions = {
  17664. matrix,
  17665. bbox,
  17666. smask,
  17667. isolated: false,
  17668. knockout: false
  17669. };
  17670. var groupSubtype = group.get("S");
  17671. var colorSpace = null;
  17672. if ((0, _primitives.isName)(groupSubtype, "Transparency")) {
  17673. groupOptions.isolated = group.get("I") || false;
  17674. groupOptions.knockout = group.get("K") || false;
  17675. if (group.has("CS")) {
  17676. const cs = group.getRaw("CS");
  17677. const cachedColorSpace = _colorspace.ColorSpace.getCached(cs, this.xref, localColorSpaceCache);
  17678. if (cachedColorSpace) {
  17679. colorSpace = cachedColorSpace;
  17680. } else {
  17681. colorSpace = await this.parseColorSpace({
  17682. cs,
  17683. resources,
  17684. localColorSpaceCache
  17685. });
  17686. }
  17687. }
  17688. }
  17689. if (smask && smask.backdrop) {
  17690. colorSpace = colorSpace || _colorspace.ColorSpace.singletons.rgb;
  17691. smask.backdrop = colorSpace.getRgb(smask.backdrop, 0);
  17692. }
  17693. operatorList.addOp(_util.OPS.beginGroup, [groupOptions]);
  17694. }
  17695. operatorList.addOp(_util.OPS.paintFormXObjectBegin, [matrix, bbox]);
  17696. return this.getOperatorList({
  17697. stream: xobj,
  17698. task,
  17699. resources: dict.get("Resources") || resources,
  17700. operatorList,
  17701. initialState
  17702. }).then(function () {
  17703. operatorList.addOp(_util.OPS.paintFormXObjectEnd, []);
  17704. if (group) {
  17705. operatorList.addOp(_util.OPS.endGroup, [groupOptions]);
  17706. }
  17707. if (optionalContent) {
  17708. operatorList.addOp(_util.OPS.endMarkedContent, []);
  17709. }
  17710. });
  17711. }
  17712. _sendImgData(objId, imgData, cacheGlobally = false) {
  17713. const transfers = imgData ? [imgData.data.buffer] : null;
  17714. if (this.parsingType3Font || cacheGlobally) {
  17715. return this.handler.send("commonobj", [objId, "Image", imgData], transfers);
  17716. }
  17717. return this.handler.send("obj", [objId, this.pageIndex, "Image", imgData], transfers);
  17718. }
  17719. async buildPaintImageXObject({
  17720. resources,
  17721. image,
  17722. isInline = false,
  17723. operatorList,
  17724. cacheKey,
  17725. localImageCache,
  17726. localColorSpaceCache
  17727. }) {
  17728. var dict = image.dict;
  17729. const imageRef = dict.objId;
  17730. var w = dict.get("Width", "W");
  17731. var h = dict.get("Height", "H");
  17732. if (!(w && (0, _util.isNum)(w)) || !(h && (0, _util.isNum)(h))) {
  17733. (0, _util.warn)("Image dimensions are missing, or not numbers.");
  17734. return undefined;
  17735. }
  17736. var maxImageSize = this.options.maxImageSize;
  17737. if (maxImageSize !== -1 && w * h > maxImageSize) {
  17738. (0, _util.warn)("Image exceeded maximum allowed size and was removed.");
  17739. return undefined;
  17740. }
  17741. var imageMask = dict.get("ImageMask", "IM") || false;
  17742. var imgData, args;
  17743. if (imageMask) {
  17744. var width = dict.get("Width", "W");
  17745. var height = dict.get("Height", "H");
  17746. var bitStrideLength = width + 7 >> 3;
  17747. var imgArray = image.getBytes(bitStrideLength * height, true);
  17748. var decode = dict.getArray("Decode", "D");
  17749. imgData = _image.PDFImage.createMask({
  17750. imgArray,
  17751. width,
  17752. height,
  17753. imageIsFromDecodeStream: image instanceof _stream.DecodeStream,
  17754. inverseDecode: !!decode && decode[0] > 0
  17755. });
  17756. imgData.cached = !!cacheKey;
  17757. args = [imgData];
  17758. operatorList.addOp(_util.OPS.paintImageMaskXObject, args);
  17759. if (cacheKey) {
  17760. localImageCache.set(cacheKey, imageRef, {
  17761. fn: _util.OPS.paintImageMaskXObject,
  17762. args
  17763. });
  17764. }
  17765. return undefined;
  17766. }
  17767. var softMask = dict.get("SMask", "SM") || false;
  17768. var mask = dict.get("Mask") || false;
  17769. var SMALL_IMAGE_DIMENSIONS = 200;
  17770. if (isInline && !softMask && !mask && w + h < SMALL_IMAGE_DIMENSIONS) {
  17771. const imageObj = new _image.PDFImage({
  17772. xref: this.xref,
  17773. res: resources,
  17774. image,
  17775. isInline,
  17776. pdfFunctionFactory: this._pdfFunctionFactory,
  17777. localColorSpaceCache
  17778. });
  17779. imgData = imageObj.createImageData(true);
  17780. operatorList.addOp(_util.OPS.paintInlineImageXObject, [imgData]);
  17781. return undefined;
  17782. }
  17783. let objId = `img_${this.idFactory.createObjId()}`,
  17784. cacheGlobally = false;
  17785. if (this.parsingType3Font) {
  17786. objId = `${this.idFactory.getDocId()}_type3_${objId}`;
  17787. } else if (imageRef) {
  17788. cacheGlobally = this.globalImageCache.shouldCache(imageRef, this.pageIndex);
  17789. if (cacheGlobally) {
  17790. objId = `${this.idFactory.getDocId()}_${objId}`;
  17791. }
  17792. }
  17793. operatorList.addDependency(objId);
  17794. args = [objId, w, h];
  17795. _image.PDFImage.buildImage({
  17796. xref: this.xref,
  17797. res: resources,
  17798. image,
  17799. isInline,
  17800. pdfFunctionFactory: this._pdfFunctionFactory,
  17801. localColorSpaceCache
  17802. }).then(imageObj => {
  17803. imgData = imageObj.createImageData(false);
  17804. return this._sendImgData(objId, imgData, cacheGlobally);
  17805. }).catch(reason => {
  17806. (0, _util.warn)(`Unable to decode image "${objId}": "${reason}".`);
  17807. return this._sendImgData(objId, null, cacheGlobally);
  17808. });
  17809. operatorList.addOp(_util.OPS.paintImageXObject, args);
  17810. if (cacheKey) {
  17811. localImageCache.set(cacheKey, imageRef, {
  17812. fn: _util.OPS.paintImageXObject,
  17813. args
  17814. });
  17815. if (imageRef) {
  17816. (0, _util.assert)(!isInline, "Cannot cache an inline image globally.");
  17817. this.globalImageCache.addPageIndex(imageRef, this.pageIndex);
  17818. if (cacheGlobally) {
  17819. this.globalImageCache.setData(imageRef, {
  17820. objId,
  17821. fn: _util.OPS.paintImageXObject,
  17822. args
  17823. });
  17824. }
  17825. }
  17826. }
  17827. return undefined;
  17828. }
  17829. handleSMask(smask, resources, operatorList, task, stateManager, localColorSpaceCache) {
  17830. var smaskContent = smask.get("G");
  17831. var smaskOptions = {
  17832. subtype: smask.get("S").name,
  17833. backdrop: smask.get("BC")
  17834. };
  17835. var transferObj = smask.get("TR");
  17836. if ((0, _function.isPDFFunction)(transferObj)) {
  17837. const transferFn = this._pdfFunctionFactory.create(transferObj);
  17838. var transferMap = new Uint8Array(256);
  17839. var tmp = new Float32Array(1);
  17840. for (var i = 0; i < 256; i++) {
  17841. tmp[0] = i / 255;
  17842. transferFn(tmp, 0, tmp, 0);
  17843. transferMap[i] = tmp[0] * 255 | 0;
  17844. }
  17845. smaskOptions.transferMap = transferMap;
  17846. }
  17847. return this.buildFormXObject(resources, smaskContent, smaskOptions, operatorList, task, stateManager.state.clone(), localColorSpaceCache);
  17848. }
  17849. handleTransferFunction(tr) {
  17850. let transferArray;
  17851. if (Array.isArray(tr)) {
  17852. transferArray = tr;
  17853. } else if ((0, _function.isPDFFunction)(tr)) {
  17854. transferArray = [tr];
  17855. } else {
  17856. return null;
  17857. }
  17858. const transferMaps = [];
  17859. let numFns = 0,
  17860. numEffectfulFns = 0;
  17861. for (const entry of transferArray) {
  17862. const transferObj = this.xref.fetchIfRef(entry);
  17863. numFns++;
  17864. if ((0, _primitives.isName)(transferObj, "Identity")) {
  17865. transferMaps.push(null);
  17866. continue;
  17867. } else if (!(0, _function.isPDFFunction)(transferObj)) {
  17868. return null;
  17869. }
  17870. const transferFn = this._pdfFunctionFactory.create(transferObj);
  17871. const transferMap = new Uint8Array(256),
  17872. tmp = new Float32Array(1);
  17873. for (let j = 0; j < 256; j++) {
  17874. tmp[0] = j / 255;
  17875. transferFn(tmp, 0, tmp, 0);
  17876. transferMap[j] = tmp[0] * 255 | 0;
  17877. }
  17878. transferMaps.push(transferMap);
  17879. numEffectfulFns++;
  17880. }
  17881. if (!(numFns === 1 || numFns === 4)) {
  17882. return null;
  17883. }
  17884. if (numEffectfulFns === 0) {
  17885. return null;
  17886. }
  17887. return transferMaps;
  17888. }
  17889. handleTilingType(fn, color, resources, pattern, patternDict, operatorList, task, cacheKey, localTilingPatternCache) {
  17890. const tilingOpList = new _operator_list.OperatorList();
  17891. const patternResources = _primitives.Dict.merge({
  17892. xref: this.xref,
  17893. dictArray: [patternDict.get("Resources"), resources]
  17894. });
  17895. return this.getOperatorList({
  17896. stream: pattern,
  17897. task,
  17898. resources: patternResources,
  17899. operatorList: tilingOpList
  17900. }).then(function () {
  17901. const operatorListIR = tilingOpList.getIR();
  17902. const tilingPatternIR = (0, _pattern.getTilingPatternIR)(operatorListIR, patternDict, color);
  17903. operatorList.addDependencies(tilingOpList.dependencies);
  17904. operatorList.addOp(fn, tilingPatternIR);
  17905. if (cacheKey) {
  17906. localTilingPatternCache.set(cacheKey, patternDict.objId, {
  17907. operatorListIR,
  17908. dict: patternDict
  17909. });
  17910. }
  17911. }).catch(reason => {
  17912. if (reason instanceof _util.AbortException) {
  17913. return;
  17914. }
  17915. if (this.options.ignoreErrors) {
  17916. this.handler.send("UnsupportedFeature", {
  17917. featureId: _util.UNSUPPORTED_FEATURES.errorTilingPattern
  17918. });
  17919. (0, _util.warn)(`handleTilingType - ignoring pattern: "${reason}".`);
  17920. return;
  17921. }
  17922. throw reason;
  17923. });
  17924. }
  17925. handleSetFont(resources, fontArgs, fontRef, operatorList, task, state, fallbackFontDict = null) {
  17926. var fontName;
  17927. if (fontArgs) {
  17928. fontArgs = fontArgs.slice();
  17929. fontName = fontArgs[0].name;
  17930. }
  17931. return this.loadFont(fontName, fontRef, resources, fallbackFontDict).then(translated => {
  17932. if (!translated.font.isType3Font) {
  17933. return translated;
  17934. }
  17935. return translated.loadType3Data(this, resources, task).then(function () {
  17936. operatorList.addDependencies(translated.type3Dependencies);
  17937. return translated;
  17938. }).catch(reason => {
  17939. this.handler.send("UnsupportedFeature", {
  17940. featureId: _util.UNSUPPORTED_FEATURES.errorFontLoadType3
  17941. });
  17942. return new TranslatedFont({
  17943. loadedName: "g_font_error",
  17944. font: new _fonts.ErrorFont(`Type3 font load error: ${reason}`),
  17945. dict: translated.font,
  17946. extraProperties: this.options.fontExtraProperties
  17947. });
  17948. });
  17949. }).then(translated => {
  17950. state.font = translated.font;
  17951. translated.send(this.handler);
  17952. return translated.loadedName;
  17953. });
  17954. }
  17955. handleText(chars, state) {
  17956. const font = state.font;
  17957. const glyphs = font.charsToGlyphs(chars);
  17958. if (font.data) {
  17959. const isAddToPathSet = !!(state.textRenderingMode & _util.TextRenderingMode.ADD_TO_PATH_FLAG);
  17960. if (isAddToPathSet || state.fillColorSpace.name === "Pattern" || font.disableFontFace || this.options.disableFontFace) {
  17961. PartialEvaluator.buildFontPaths(font, glyphs, this.handler);
  17962. }
  17963. }
  17964. return glyphs;
  17965. }
  17966. ensureStateFont(state) {
  17967. if (state.font) {
  17968. return;
  17969. }
  17970. const reason = new _util.FormatError("Missing setFont (Tf) operator before text rendering operator.");
  17971. if (this.options.ignoreErrors) {
  17972. this.handler.send("UnsupportedFeature", {
  17973. featureId: _util.UNSUPPORTED_FEATURES.errorFontState
  17974. });
  17975. (0, _util.warn)(`ensureStateFont: "${reason}".`);
  17976. return;
  17977. }
  17978. throw reason;
  17979. }
  17980. async setGState({
  17981. resources,
  17982. gState,
  17983. operatorList,
  17984. cacheKey,
  17985. task,
  17986. stateManager,
  17987. localGStateCache,
  17988. localColorSpaceCache
  17989. }) {
  17990. const gStateRef = gState.objId;
  17991. let isSimpleGState = true;
  17992. var gStateObj = [];
  17993. var gStateKeys = gState.getKeys();
  17994. var promise = Promise.resolve();
  17995. for (var i = 0, ii = gStateKeys.length; i < ii; i++) {
  17996. const key = gStateKeys[i];
  17997. const value = gState.get(key);
  17998. switch (key) {
  17999. case "Type":
  18000. break;
  18001. case "LW":
  18002. case "LC":
  18003. case "LJ":
  18004. case "ML":
  18005. case "D":
  18006. case "RI":
  18007. case "FL":
  18008. case "CA":
  18009. case "ca":
  18010. gStateObj.push([key, value]);
  18011. break;
  18012. case "Font":
  18013. isSimpleGState = false;
  18014. promise = promise.then(() => {
  18015. return this.handleSetFont(resources, null, value[0], operatorList, task, stateManager.state).then(function (loadedName) {
  18016. operatorList.addDependency(loadedName);
  18017. gStateObj.push([key, [loadedName, value[1]]]);
  18018. });
  18019. });
  18020. break;
  18021. case "BM":
  18022. gStateObj.push([key, normalizeBlendMode(value)]);
  18023. break;
  18024. case "SMask":
  18025. if ((0, _primitives.isName)(value, "None")) {
  18026. gStateObj.push([key, false]);
  18027. break;
  18028. }
  18029. if ((0, _primitives.isDict)(value)) {
  18030. isSimpleGState = false;
  18031. promise = promise.then(() => {
  18032. return this.handleSMask(value, resources, operatorList, task, stateManager, localColorSpaceCache);
  18033. });
  18034. gStateObj.push([key, true]);
  18035. } else {
  18036. (0, _util.warn)("Unsupported SMask type");
  18037. }
  18038. break;
  18039. case "TR":
  18040. const transferMaps = this.handleTransferFunction(value);
  18041. gStateObj.push([key, transferMaps]);
  18042. break;
  18043. case "OP":
  18044. case "op":
  18045. case "OPM":
  18046. case "BG":
  18047. case "BG2":
  18048. case "UCR":
  18049. case "UCR2":
  18050. case "TR2":
  18051. case "HT":
  18052. case "SM":
  18053. case "SA":
  18054. case "AIS":
  18055. case "TK":
  18056. (0, _util.info)("graphic state operator " + key);
  18057. break;
  18058. default:
  18059. (0, _util.info)("Unknown graphic state operator " + key);
  18060. break;
  18061. }
  18062. }
  18063. return promise.then(function () {
  18064. if (gStateObj.length > 0) {
  18065. operatorList.addOp(_util.OPS.setGState, [gStateObj]);
  18066. }
  18067. if (isSimpleGState) {
  18068. localGStateCache.set(cacheKey, gStateRef, gStateObj);
  18069. }
  18070. });
  18071. }
  18072. loadFont(fontName, font, resources, fallbackFontDict = null) {
  18073. const errorFont = async () => {
  18074. return new TranslatedFont({
  18075. loadedName: "g_font_error",
  18076. font: new _fonts.ErrorFont(`Font "${fontName}" is not available.`),
  18077. dict: font,
  18078. extraProperties: this.options.fontExtraProperties
  18079. });
  18080. };
  18081. var fontRef,
  18082. xref = this.xref;
  18083. if (font) {
  18084. if (!(0, _primitives.isRef)(font)) {
  18085. throw new _util.FormatError('The "font" object should be a reference.');
  18086. }
  18087. fontRef = font;
  18088. } else {
  18089. var fontRes = resources.get("Font");
  18090. if (fontRes) {
  18091. fontRef = fontRes.getRaw(fontName);
  18092. }
  18093. }
  18094. if (!fontRef) {
  18095. const partialMsg = `Font "${fontName || font && font.toString()}" is not available`;
  18096. if (!this.options.ignoreErrors && !this.parsingType3Font) {
  18097. (0, _util.warn)(`${partialMsg}.`);
  18098. return errorFont();
  18099. }
  18100. this.handler.send("UnsupportedFeature", {
  18101. featureId: _util.UNSUPPORTED_FEATURES.errorFontMissing
  18102. });
  18103. (0, _util.warn)(`${partialMsg} -- attempting to fallback to a default font.`);
  18104. if (fallbackFontDict) {
  18105. fontRef = fallbackFontDict;
  18106. } else {
  18107. fontRef = PartialEvaluator.fallbackFontDict;
  18108. }
  18109. }
  18110. if (this.fontCache.has(fontRef)) {
  18111. return this.fontCache.get(fontRef);
  18112. }
  18113. font = xref.fetchIfRef(fontRef);
  18114. if (!(0, _primitives.isDict)(font)) {
  18115. return errorFont();
  18116. }
  18117. if (font.cacheKey && this.fontCache.has(font.cacheKey)) {
  18118. return this.fontCache.get(font.cacheKey);
  18119. }
  18120. var fontCapability = (0, _util.createPromiseCapability)();
  18121. let preEvaluatedFont;
  18122. try {
  18123. preEvaluatedFont = this.preEvaluateFont(font);
  18124. } catch (reason) {
  18125. (0, _util.warn)(`loadFont - ignoring preEvaluateFont errors: "${reason}".`);
  18126. return errorFont();
  18127. }
  18128. const {
  18129. descriptor,
  18130. hash
  18131. } = preEvaluatedFont;
  18132. var fontRefIsRef = (0, _primitives.isRef)(fontRef),
  18133. fontID;
  18134. if (fontRefIsRef) {
  18135. fontID = `f${fontRef.toString()}`;
  18136. }
  18137. if (hash && (0, _primitives.isDict)(descriptor)) {
  18138. if (!descriptor.fontAliases) {
  18139. descriptor.fontAliases = Object.create(null);
  18140. }
  18141. var fontAliases = descriptor.fontAliases;
  18142. if (fontAliases[hash]) {
  18143. var aliasFontRef = fontAliases[hash].aliasRef;
  18144. if (fontRefIsRef && aliasFontRef && this.fontCache.has(aliasFontRef)) {
  18145. this.fontCache.putAlias(fontRef, aliasFontRef);
  18146. return this.fontCache.get(fontRef);
  18147. }
  18148. } else {
  18149. fontAliases[hash] = {
  18150. fontID: this.idFactory.createFontId()
  18151. };
  18152. }
  18153. if (fontRefIsRef) {
  18154. fontAliases[hash].aliasRef = fontRef;
  18155. }
  18156. fontID = fontAliases[hash].fontID;
  18157. }
  18158. if (fontRefIsRef) {
  18159. this.fontCache.put(fontRef, fontCapability.promise);
  18160. } else {
  18161. if (!fontID) {
  18162. fontID = this.idFactory.createFontId();
  18163. }
  18164. font.cacheKey = `cacheKey_${fontID}`;
  18165. this.fontCache.put(font.cacheKey, fontCapability.promise);
  18166. }
  18167. (0, _util.assert)(fontID && fontID.startsWith("f"), 'The "fontID" must be (correctly) defined.');
  18168. font.loadedName = `${this.idFactory.getDocId()}_${fontID}`;
  18169. this.translateFont(preEvaluatedFont).then(translatedFont => {
  18170. if (translatedFont.fontType !== undefined) {
  18171. var xrefFontStats = xref.stats.fontTypes;
  18172. xrefFontStats[translatedFont.fontType] = true;
  18173. }
  18174. fontCapability.resolve(new TranslatedFont({
  18175. loadedName: font.loadedName,
  18176. font: translatedFont,
  18177. dict: font,
  18178. extraProperties: this.options.fontExtraProperties
  18179. }));
  18180. }).catch(reason => {
  18181. this.handler.send("UnsupportedFeature", {
  18182. featureId: _util.UNSUPPORTED_FEATURES.errorFontTranslate
  18183. });
  18184. try {
  18185. var fontFile3 = descriptor && descriptor.get("FontFile3");
  18186. var subtype = fontFile3 && fontFile3.get("Subtype");
  18187. var fontType = (0, _fonts.getFontType)(preEvaluatedFont.type, subtype && subtype.name);
  18188. var xrefFontStats = xref.stats.fontTypes;
  18189. xrefFontStats[fontType] = true;
  18190. } catch (ex) {}
  18191. fontCapability.resolve(new TranslatedFont({
  18192. loadedName: font.loadedName,
  18193. font: new _fonts.ErrorFont(reason instanceof Error ? reason.message : reason),
  18194. dict: font,
  18195. extraProperties: this.options.fontExtraProperties
  18196. }));
  18197. });
  18198. return fontCapability.promise;
  18199. }
  18200. buildPath(operatorList, fn, args, parsingText = false) {
  18201. var lastIndex = operatorList.length - 1;
  18202. if (!args) {
  18203. args = [];
  18204. }
  18205. if (lastIndex < 0 || operatorList.fnArray[lastIndex] !== _util.OPS.constructPath) {
  18206. if (parsingText) {
  18207. (0, _util.warn)(`Encountered path operator "${fn}" inside of a text object.`);
  18208. operatorList.addOp(_util.OPS.save, null);
  18209. }
  18210. operatorList.addOp(_util.OPS.constructPath, [[fn], args]);
  18211. if (parsingText) {
  18212. operatorList.addOp(_util.OPS.restore, null);
  18213. }
  18214. } else {
  18215. var opArgs = operatorList.argsArray[lastIndex];
  18216. opArgs[0].push(fn);
  18217. Array.prototype.push.apply(opArgs[1], args);
  18218. }
  18219. }
  18220. parseColorSpace({
  18221. cs,
  18222. resources,
  18223. localColorSpaceCache
  18224. }) {
  18225. return _colorspace.ColorSpace.parseAsync({
  18226. cs,
  18227. xref: this.xref,
  18228. resources,
  18229. pdfFunctionFactory: this._pdfFunctionFactory,
  18230. localColorSpaceCache
  18231. }).catch(reason => {
  18232. if (reason instanceof _util.AbortException) {
  18233. return null;
  18234. }
  18235. if (this.options.ignoreErrors) {
  18236. this.handler.send("UnsupportedFeature", {
  18237. featureId: _util.UNSUPPORTED_FEATURES.errorColorSpace
  18238. });
  18239. (0, _util.warn)(`parseColorSpace - ignoring ColorSpace: "${reason}".`);
  18240. return null;
  18241. }
  18242. throw reason;
  18243. });
  18244. }
  18245. handleColorN(operatorList, fn, args, cs, patterns, resources, task, localColorSpaceCache, localTilingPatternCache) {
  18246. const patternName = args.pop();
  18247. if (patternName instanceof _primitives.Name) {
  18248. const name = patternName.name;
  18249. const localTilingPattern = localTilingPatternCache.getByName(name);
  18250. if (localTilingPattern) {
  18251. try {
  18252. const color = cs.base ? cs.base.getRgb(args, 0) : null;
  18253. const tilingPatternIR = (0, _pattern.getTilingPatternIR)(localTilingPattern.operatorListIR, localTilingPattern.dict, color);
  18254. operatorList.addOp(fn, tilingPatternIR);
  18255. return undefined;
  18256. } catch (ex) {
  18257. if (ex instanceof _core_utils.MissingDataException) {
  18258. throw ex;
  18259. }
  18260. }
  18261. }
  18262. let pattern = patterns.get(name);
  18263. if (pattern) {
  18264. var dict = (0, _primitives.isStream)(pattern) ? pattern.dict : pattern;
  18265. var typeNum = dict.get("PatternType");
  18266. if (typeNum === PatternType.TILING) {
  18267. const color = cs.base ? cs.base.getRgb(args, 0) : null;
  18268. return this.handleTilingType(fn, color, resources, pattern, dict, operatorList, task, name, localTilingPatternCache);
  18269. } else if (typeNum === PatternType.SHADING) {
  18270. var shading = dict.get("Shading");
  18271. var matrix = dict.getArray("Matrix");
  18272. pattern = _pattern.Pattern.parseShading(shading, matrix, this.xref, resources, this.handler, this._pdfFunctionFactory, localColorSpaceCache);
  18273. operatorList.addOp(fn, pattern.getIR());
  18274. return undefined;
  18275. }
  18276. throw new _util.FormatError(`Unknown PatternType: ${typeNum}`);
  18277. }
  18278. }
  18279. throw new _util.FormatError(`Unknown PatternName: ${patternName}`);
  18280. }
  18281. async parseMarkedContentProps(contentProperties, resources) {
  18282. let optionalContent;
  18283. if ((0, _primitives.isName)(contentProperties)) {
  18284. const properties = resources.get("Properties");
  18285. optionalContent = properties.get(contentProperties.name);
  18286. } else if ((0, _primitives.isDict)(contentProperties)) {
  18287. optionalContent = contentProperties;
  18288. } else {
  18289. throw new _util.FormatError("Optional content properties malformed.");
  18290. }
  18291. const optionalContentType = optionalContent.get("Type").name;
  18292. if (optionalContentType === "OCG") {
  18293. return {
  18294. type: optionalContentType,
  18295. id: optionalContent.objId
  18296. };
  18297. } else if (optionalContentType === "OCMD") {
  18298. const optionalContentGroups = optionalContent.get("OCGs");
  18299. if (Array.isArray(optionalContentGroups) || (0, _primitives.isDict)(optionalContentGroups)) {
  18300. const groupIds = [];
  18301. if (Array.isArray(optionalContentGroups)) {
  18302. optionalContent.get("OCGs").forEach(ocg => {
  18303. groupIds.push(ocg.toString());
  18304. });
  18305. } else {
  18306. groupIds.push(optionalContentGroups.objId);
  18307. }
  18308. let expression = null;
  18309. if (optionalContent.get("VE")) {
  18310. expression = true;
  18311. }
  18312. return {
  18313. type: optionalContentType,
  18314. ids: groupIds,
  18315. policy: (0, _primitives.isName)(optionalContent.get("P")) ? optionalContent.get("P").name : null,
  18316. expression
  18317. };
  18318. } else if ((0, _primitives.isRef)(optionalContentGroups)) {
  18319. return {
  18320. type: optionalContentType,
  18321. id: optionalContentGroups.toString()
  18322. };
  18323. }
  18324. }
  18325. return null;
  18326. }
  18327. getOperatorList({
  18328. stream,
  18329. task,
  18330. resources,
  18331. operatorList,
  18332. initialState = null,
  18333. fallbackFontDict = null
  18334. }) {
  18335. resources = resources || _primitives.Dict.empty;
  18336. initialState = initialState || new EvalState();
  18337. if (!operatorList) {
  18338. throw new Error('getOperatorList: missing "operatorList" parameter');
  18339. }
  18340. var self = this;
  18341. var xref = this.xref;
  18342. let parsingText = false;
  18343. const localImageCache = new _image_utils.LocalImageCache();
  18344. const localColorSpaceCache = new _image_utils.LocalColorSpaceCache();
  18345. const localGStateCache = new _image_utils.LocalGStateCache();
  18346. const localTilingPatternCache = new _image_utils.LocalTilingPatternCache();
  18347. var xobjs = resources.get("XObject") || _primitives.Dict.empty;
  18348. var patterns = resources.get("Pattern") || _primitives.Dict.empty;
  18349. var stateManager = new StateManager(initialState);
  18350. var preprocessor = new EvaluatorPreprocessor(stream, xref, stateManager);
  18351. var timeSlotManager = new TimeSlotManager();
  18352. function closePendingRestoreOPS(argument) {
  18353. for (var i = 0, ii = preprocessor.savedStatesDepth; i < ii; i++) {
  18354. operatorList.addOp(_util.OPS.restore, []);
  18355. }
  18356. }
  18357. return new Promise(function promiseBody(resolve, reject) {
  18358. const next = function (promise) {
  18359. Promise.all([promise, operatorList.ready]).then(function () {
  18360. try {
  18361. promiseBody(resolve, reject);
  18362. } catch (ex) {
  18363. reject(ex);
  18364. }
  18365. }, reject);
  18366. };
  18367. task.ensureNotTerminated();
  18368. timeSlotManager.reset();
  18369. var stop,
  18370. operation = {},
  18371. i,
  18372. ii,
  18373. cs,
  18374. name;
  18375. while (!(stop = timeSlotManager.check())) {
  18376. operation.args = null;
  18377. if (!preprocessor.read(operation)) {
  18378. break;
  18379. }
  18380. var args = operation.args;
  18381. var fn = operation.fn;
  18382. switch (fn | 0) {
  18383. case _util.OPS.paintXObject:
  18384. name = args[0].name;
  18385. if (name) {
  18386. const localImage = localImageCache.getByName(name);
  18387. if (localImage) {
  18388. operatorList.addOp(localImage.fn, localImage.args);
  18389. args = null;
  18390. continue;
  18391. }
  18392. }
  18393. next(new Promise(function (resolveXObject, rejectXObject) {
  18394. if (!name) {
  18395. throw new _util.FormatError("XObject must be referred to by name.");
  18396. }
  18397. let xobj = xobjs.getRaw(name);
  18398. if (xobj instanceof _primitives.Ref) {
  18399. const localImage = localImageCache.getByRef(xobj);
  18400. if (localImage) {
  18401. operatorList.addOp(localImage.fn, localImage.args);
  18402. resolveXObject();
  18403. return;
  18404. }
  18405. const globalImage = self.globalImageCache.getData(xobj, self.pageIndex);
  18406. if (globalImage) {
  18407. operatorList.addDependency(globalImage.objId);
  18408. operatorList.addOp(globalImage.fn, globalImage.args);
  18409. resolveXObject();
  18410. return;
  18411. }
  18412. xobj = xref.fetch(xobj);
  18413. }
  18414. if (!(0, _primitives.isStream)(xobj)) {
  18415. throw new _util.FormatError("XObject should be a stream");
  18416. }
  18417. const type = xobj.dict.get("Subtype");
  18418. if (!(0, _primitives.isName)(type)) {
  18419. throw new _util.FormatError("XObject should have a Name subtype");
  18420. }
  18421. if (type.name === "Form") {
  18422. stateManager.save();
  18423. self.buildFormXObject(resources, xobj, null, operatorList, task, stateManager.state.clone(), localColorSpaceCache).then(function () {
  18424. stateManager.restore();
  18425. resolveXObject();
  18426. }, rejectXObject);
  18427. return;
  18428. } else if (type.name === "Image") {
  18429. self.buildPaintImageXObject({
  18430. resources,
  18431. image: xobj,
  18432. operatorList,
  18433. cacheKey: name,
  18434. localImageCache,
  18435. localColorSpaceCache
  18436. }).then(resolveXObject, rejectXObject);
  18437. return;
  18438. } else if (type.name === "PS") {
  18439. (0, _util.info)("Ignored XObject subtype PS");
  18440. } else {
  18441. throw new _util.FormatError(`Unhandled XObject subtype ${type.name}`);
  18442. }
  18443. resolveXObject();
  18444. }).catch(function (reason) {
  18445. if (reason instanceof _util.AbortException) {
  18446. return;
  18447. }
  18448. if (self.options.ignoreErrors) {
  18449. self.handler.send("UnsupportedFeature", {
  18450. featureId: _util.UNSUPPORTED_FEATURES.errorXObject
  18451. });
  18452. (0, _util.warn)(`getOperatorList - ignoring XObject: "${reason}".`);
  18453. return;
  18454. }
  18455. throw reason;
  18456. }));
  18457. return;
  18458. case _util.OPS.setFont:
  18459. var fontSize = args[1];
  18460. next(self.handleSetFont(resources, args, null, operatorList, task, stateManager.state, fallbackFontDict).then(function (loadedName) {
  18461. operatorList.addDependency(loadedName);
  18462. operatorList.addOp(_util.OPS.setFont, [loadedName, fontSize]);
  18463. }));
  18464. return;
  18465. case _util.OPS.beginText:
  18466. parsingText = true;
  18467. break;
  18468. case _util.OPS.endText:
  18469. parsingText = false;
  18470. break;
  18471. case _util.OPS.endInlineImage:
  18472. var cacheKey = args[0].cacheKey;
  18473. if (cacheKey) {
  18474. const localImage = localImageCache.getByName(cacheKey);
  18475. if (localImage) {
  18476. operatorList.addOp(localImage.fn, localImage.args);
  18477. args = null;
  18478. continue;
  18479. }
  18480. }
  18481. next(self.buildPaintImageXObject({
  18482. resources,
  18483. image: args[0],
  18484. isInline: true,
  18485. operatorList,
  18486. cacheKey,
  18487. localImageCache,
  18488. localColorSpaceCache
  18489. }));
  18490. return;
  18491. case _util.OPS.showText:
  18492. if (!stateManager.state.font) {
  18493. self.ensureStateFont(stateManager.state);
  18494. continue;
  18495. }
  18496. args[0] = self.handleText(args[0], stateManager.state);
  18497. break;
  18498. case _util.OPS.showSpacedText:
  18499. if (!stateManager.state.font) {
  18500. self.ensureStateFont(stateManager.state);
  18501. continue;
  18502. }
  18503. var arr = args[0];
  18504. var combinedGlyphs = [];
  18505. var arrLength = arr.length;
  18506. var state = stateManager.state;
  18507. for (i = 0; i < arrLength; ++i) {
  18508. var arrItem = arr[i];
  18509. if ((0, _util.isString)(arrItem)) {
  18510. Array.prototype.push.apply(combinedGlyphs, self.handleText(arrItem, state));
  18511. } else if ((0, _util.isNum)(arrItem)) {
  18512. combinedGlyphs.push(arrItem);
  18513. }
  18514. }
  18515. args[0] = combinedGlyphs;
  18516. fn = _util.OPS.showText;
  18517. break;
  18518. case _util.OPS.nextLineShowText:
  18519. if (!stateManager.state.font) {
  18520. self.ensureStateFont(stateManager.state);
  18521. continue;
  18522. }
  18523. operatorList.addOp(_util.OPS.nextLine);
  18524. args[0] = self.handleText(args[0], stateManager.state);
  18525. fn = _util.OPS.showText;
  18526. break;
  18527. case _util.OPS.nextLineSetSpacingShowText:
  18528. if (!stateManager.state.font) {
  18529. self.ensureStateFont(stateManager.state);
  18530. continue;
  18531. }
  18532. operatorList.addOp(_util.OPS.nextLine);
  18533. operatorList.addOp(_util.OPS.setWordSpacing, [args.shift()]);
  18534. operatorList.addOp(_util.OPS.setCharSpacing, [args.shift()]);
  18535. args[0] = self.handleText(args[0], stateManager.state);
  18536. fn = _util.OPS.showText;
  18537. break;
  18538. case _util.OPS.setTextRenderingMode:
  18539. stateManager.state.textRenderingMode = args[0];
  18540. break;
  18541. case _util.OPS.setFillColorSpace:
  18542. {
  18543. const cachedColorSpace = _colorspace.ColorSpace.getCached(args[0], xref, localColorSpaceCache);
  18544. if (cachedColorSpace) {
  18545. stateManager.state.fillColorSpace = cachedColorSpace;
  18546. continue;
  18547. }
  18548. next(self.parseColorSpace({
  18549. cs: args[0],
  18550. resources,
  18551. localColorSpaceCache
  18552. }).then(function (colorSpace) {
  18553. if (colorSpace) {
  18554. stateManager.state.fillColorSpace = colorSpace;
  18555. }
  18556. }));
  18557. return;
  18558. }
  18559. case _util.OPS.setStrokeColorSpace:
  18560. {
  18561. const cachedColorSpace = _colorspace.ColorSpace.getCached(args[0], xref, localColorSpaceCache);
  18562. if (cachedColorSpace) {
  18563. stateManager.state.strokeColorSpace = cachedColorSpace;
  18564. continue;
  18565. }
  18566. next(self.parseColorSpace({
  18567. cs: args[0],
  18568. resources,
  18569. localColorSpaceCache
  18570. }).then(function (colorSpace) {
  18571. if (colorSpace) {
  18572. stateManager.state.strokeColorSpace = colorSpace;
  18573. }
  18574. }));
  18575. return;
  18576. }
  18577. case _util.OPS.setFillColor:
  18578. cs = stateManager.state.fillColorSpace;
  18579. args = cs.getRgb(args, 0);
  18580. fn = _util.OPS.setFillRGBColor;
  18581. break;
  18582. case _util.OPS.setStrokeColor:
  18583. cs = stateManager.state.strokeColorSpace;
  18584. args = cs.getRgb(args, 0);
  18585. fn = _util.OPS.setStrokeRGBColor;
  18586. break;
  18587. case _util.OPS.setFillGray:
  18588. stateManager.state.fillColorSpace = _colorspace.ColorSpace.singletons.gray;
  18589. args = _colorspace.ColorSpace.singletons.gray.getRgb(args, 0);
  18590. fn = _util.OPS.setFillRGBColor;
  18591. break;
  18592. case _util.OPS.setStrokeGray:
  18593. stateManager.state.strokeColorSpace = _colorspace.ColorSpace.singletons.gray;
  18594. args = _colorspace.ColorSpace.singletons.gray.getRgb(args, 0);
  18595. fn = _util.OPS.setStrokeRGBColor;
  18596. break;
  18597. case _util.OPS.setFillCMYKColor:
  18598. stateManager.state.fillColorSpace = _colorspace.ColorSpace.singletons.cmyk;
  18599. args = _colorspace.ColorSpace.singletons.cmyk.getRgb(args, 0);
  18600. fn = _util.OPS.setFillRGBColor;
  18601. break;
  18602. case _util.OPS.setStrokeCMYKColor:
  18603. stateManager.state.strokeColorSpace = _colorspace.ColorSpace.singletons.cmyk;
  18604. args = _colorspace.ColorSpace.singletons.cmyk.getRgb(args, 0);
  18605. fn = _util.OPS.setStrokeRGBColor;
  18606. break;
  18607. case _util.OPS.setFillRGBColor:
  18608. stateManager.state.fillColorSpace = _colorspace.ColorSpace.singletons.rgb;
  18609. args = _colorspace.ColorSpace.singletons.rgb.getRgb(args, 0);
  18610. break;
  18611. case _util.OPS.setStrokeRGBColor:
  18612. stateManager.state.strokeColorSpace = _colorspace.ColorSpace.singletons.rgb;
  18613. args = _colorspace.ColorSpace.singletons.rgb.getRgb(args, 0);
  18614. break;
  18615. case _util.OPS.setFillColorN:
  18616. cs = stateManager.state.fillColorSpace;
  18617. if (cs.name === "Pattern") {
  18618. next(self.handleColorN(operatorList, _util.OPS.setFillColorN, args, cs, patterns, resources, task, localColorSpaceCache, localTilingPatternCache));
  18619. return;
  18620. }
  18621. args = cs.getRgb(args, 0);
  18622. fn = _util.OPS.setFillRGBColor;
  18623. break;
  18624. case _util.OPS.setStrokeColorN:
  18625. cs = stateManager.state.strokeColorSpace;
  18626. if (cs.name === "Pattern") {
  18627. next(self.handleColorN(operatorList, _util.OPS.setStrokeColorN, args, cs, patterns, resources, task, localColorSpaceCache, localTilingPatternCache));
  18628. return;
  18629. }
  18630. args = cs.getRgb(args, 0);
  18631. fn = _util.OPS.setStrokeRGBColor;
  18632. break;
  18633. case _util.OPS.shadingFill:
  18634. var shadingRes = resources.get("Shading");
  18635. if (!shadingRes) {
  18636. throw new _util.FormatError("No shading resource found");
  18637. }
  18638. var shading = shadingRes.get(args[0].name);
  18639. if (!shading) {
  18640. throw new _util.FormatError("No shading object found");
  18641. }
  18642. var shadingFill = _pattern.Pattern.parseShading(shading, null, xref, resources, self.handler, self._pdfFunctionFactory, localColorSpaceCache);
  18643. var patternIR = shadingFill.getIR();
  18644. args = [patternIR];
  18645. fn = _util.OPS.shadingFill;
  18646. break;
  18647. case _util.OPS.setGState:
  18648. name = args[0].name;
  18649. if (name) {
  18650. const localGStateObj = localGStateCache.getByName(name);
  18651. if (localGStateObj) {
  18652. if (localGStateObj.length > 0) {
  18653. operatorList.addOp(_util.OPS.setGState, [localGStateObj]);
  18654. }
  18655. args = null;
  18656. continue;
  18657. }
  18658. }
  18659. next(new Promise(function (resolveGState, rejectGState) {
  18660. if (!name) {
  18661. throw new _util.FormatError("GState must be referred to by name.");
  18662. }
  18663. const extGState = resources.get("ExtGState");
  18664. if (!(extGState instanceof _primitives.Dict)) {
  18665. throw new _util.FormatError("ExtGState should be a dictionary.");
  18666. }
  18667. const gState = extGState.get(name);
  18668. if (!(gState instanceof _primitives.Dict)) {
  18669. throw new _util.FormatError("GState should be a dictionary.");
  18670. }
  18671. self.setGState({
  18672. resources,
  18673. gState,
  18674. operatorList,
  18675. cacheKey: name,
  18676. task,
  18677. stateManager,
  18678. localGStateCache,
  18679. localColorSpaceCache
  18680. }).then(resolveGState, rejectGState);
  18681. }).catch(function (reason) {
  18682. if (reason instanceof _util.AbortException) {
  18683. return;
  18684. }
  18685. if (self.options.ignoreErrors) {
  18686. self.handler.send("UnsupportedFeature", {
  18687. featureId: _util.UNSUPPORTED_FEATURES.errorExtGState
  18688. });
  18689. (0, _util.warn)(`getOperatorList - ignoring ExtGState: "${reason}".`);
  18690. return;
  18691. }
  18692. throw reason;
  18693. }));
  18694. return;
  18695. case _util.OPS.moveTo:
  18696. case _util.OPS.lineTo:
  18697. case _util.OPS.curveTo:
  18698. case _util.OPS.curveTo2:
  18699. case _util.OPS.curveTo3:
  18700. case _util.OPS.closePath:
  18701. case _util.OPS.rectangle:
  18702. self.buildPath(operatorList, fn, args, parsingText);
  18703. continue;
  18704. case _util.OPS.markPoint:
  18705. case _util.OPS.markPointProps:
  18706. case _util.OPS.beginCompat:
  18707. case _util.OPS.endCompat:
  18708. continue;
  18709. case _util.OPS.beginMarkedContentProps:
  18710. if (!(0, _primitives.isName)(args[0])) {
  18711. (0, _util.warn)(`Expected name for beginMarkedContentProps arg0=${args[0]}`);
  18712. continue;
  18713. }
  18714. if (args[0].name === "OC") {
  18715. next(self.parseMarkedContentProps(args[1], resources).then(data => {
  18716. operatorList.addOp(_util.OPS.beginMarkedContentProps, ["OC", data]);
  18717. }).catch(reason => {
  18718. if (reason instanceof _util.AbortException) {
  18719. return;
  18720. }
  18721. if (self.options.ignoreErrors) {
  18722. self.handler.send("UnsupportedFeature", {
  18723. featureId: _util.UNSUPPORTED_FEATURES.errorMarkedContent
  18724. });
  18725. (0, _util.warn)(`getOperatorList - ignoring beginMarkedContentProps: "${reason}".`);
  18726. return;
  18727. }
  18728. throw reason;
  18729. }));
  18730. return;
  18731. }
  18732. args = [args[0].name];
  18733. break;
  18734. case _util.OPS.beginMarkedContent:
  18735. case _util.OPS.endMarkedContent:
  18736. default:
  18737. if (args !== null) {
  18738. for (i = 0, ii = args.length; i < ii; i++) {
  18739. if (args[i] instanceof _primitives.Dict) {
  18740. break;
  18741. }
  18742. }
  18743. if (i < ii) {
  18744. (0, _util.warn)("getOperatorList - ignoring operator: " + fn);
  18745. continue;
  18746. }
  18747. }
  18748. }
  18749. operatorList.addOp(fn, args);
  18750. }
  18751. if (stop) {
  18752. next(deferred);
  18753. return;
  18754. }
  18755. closePendingRestoreOPS();
  18756. resolve();
  18757. }).catch(reason => {
  18758. if (reason instanceof _util.AbortException) {
  18759. return;
  18760. }
  18761. if (this.options.ignoreErrors) {
  18762. this.handler.send("UnsupportedFeature", {
  18763. featureId: _util.UNSUPPORTED_FEATURES.errorOperatorList
  18764. });
  18765. (0, _util.warn)(`getOperatorList - ignoring errors during "${task.name}" ` + `task: "${reason}".`);
  18766. closePendingRestoreOPS();
  18767. return;
  18768. }
  18769. throw reason;
  18770. });
  18771. }
  18772. getTextContent({
  18773. stream,
  18774. task,
  18775. resources,
  18776. stateManager = null,
  18777. normalizeWhitespace = false,
  18778. combineTextItems = false,
  18779. sink,
  18780. seenStyles = Object.create(null)
  18781. }) {
  18782. resources = resources || _primitives.Dict.empty;
  18783. stateManager = stateManager || new StateManager(new TextState());
  18784. var WhitespaceRegexp = /\s/g;
  18785. var textContent = {
  18786. items: [],
  18787. styles: Object.create(null)
  18788. };
  18789. var textContentItem = {
  18790. initialized: false,
  18791. str: [],
  18792. width: 0,
  18793. height: 0,
  18794. vertical: false,
  18795. lastAdvanceWidth: 0,
  18796. lastAdvanceHeight: 0,
  18797. textAdvanceScale: 0,
  18798. spaceWidth: 0,
  18799. fakeSpaceMin: Infinity,
  18800. fakeMultiSpaceMin: Infinity,
  18801. fakeMultiSpaceMax: -0,
  18802. textRunBreakAllowed: false,
  18803. transform: null,
  18804. fontName: null
  18805. };
  18806. var SPACE_FACTOR = 0.3;
  18807. var MULTI_SPACE_FACTOR = 1.5;
  18808. var MULTI_SPACE_FACTOR_MAX = 4;
  18809. var self = this;
  18810. var xref = this.xref;
  18811. var xobjs = null;
  18812. const emptyXObjectCache = new _image_utils.LocalImageCache();
  18813. const emptyGStateCache = new _image_utils.LocalGStateCache();
  18814. var preprocessor = new EvaluatorPreprocessor(stream, xref, stateManager);
  18815. var textState;
  18816. function ensureTextContentItem() {
  18817. if (textContentItem.initialized) {
  18818. return textContentItem;
  18819. }
  18820. var font = textState.font;
  18821. if (!(font.loadedName in seenStyles)) {
  18822. seenStyles[font.loadedName] = true;
  18823. textContent.styles[font.loadedName] = {
  18824. fontFamily: font.fallbackName,
  18825. ascent: font.ascent,
  18826. descent: font.descent,
  18827. vertical: font.vertical
  18828. };
  18829. }
  18830. textContentItem.fontName = font.loadedName;
  18831. var tsm = [textState.fontSize * textState.textHScale, 0, 0, textState.fontSize, 0, textState.textRise];
  18832. if (font.isType3Font && textState.fontSize <= 1 && !(0, _util.isArrayEqual)(textState.fontMatrix, _util.FONT_IDENTITY_MATRIX)) {
  18833. const glyphHeight = font.bbox[3] - font.bbox[1];
  18834. if (glyphHeight > 0) {
  18835. tsm[3] *= glyphHeight * textState.fontMatrix[3];
  18836. }
  18837. }
  18838. var trm = _util.Util.transform(textState.ctm, _util.Util.transform(textState.textMatrix, tsm));
  18839. textContentItem.transform = trm;
  18840. if (!font.vertical) {
  18841. textContentItem.width = 0;
  18842. textContentItem.height = Math.sqrt(trm[2] * trm[2] + trm[3] * trm[3]);
  18843. textContentItem.vertical = false;
  18844. } else {
  18845. textContentItem.width = Math.sqrt(trm[0] * trm[0] + trm[1] * trm[1]);
  18846. textContentItem.height = 0;
  18847. textContentItem.vertical = true;
  18848. }
  18849. var a = textState.textLineMatrix[0];
  18850. var b = textState.textLineMatrix[1];
  18851. var scaleLineX = Math.sqrt(a * a + b * b);
  18852. a = textState.ctm[0];
  18853. b = textState.ctm[1];
  18854. var scaleCtmX = Math.sqrt(a * a + b * b);
  18855. textContentItem.textAdvanceScale = scaleCtmX * scaleLineX;
  18856. textContentItem.lastAdvanceWidth = 0;
  18857. textContentItem.lastAdvanceHeight = 0;
  18858. var spaceWidth = font.spaceWidth / 1000 * textState.fontSize;
  18859. if (spaceWidth) {
  18860. textContentItem.spaceWidth = spaceWidth;
  18861. textContentItem.fakeSpaceMin = spaceWidth * SPACE_FACTOR;
  18862. textContentItem.fakeMultiSpaceMin = spaceWidth * MULTI_SPACE_FACTOR;
  18863. textContentItem.fakeMultiSpaceMax = spaceWidth * MULTI_SPACE_FACTOR_MAX;
  18864. textContentItem.textRunBreakAllowed = !font.isMonospace;
  18865. } else {
  18866. textContentItem.spaceWidth = 0;
  18867. textContentItem.fakeSpaceMin = Infinity;
  18868. textContentItem.fakeMultiSpaceMin = Infinity;
  18869. textContentItem.fakeMultiSpaceMax = 0;
  18870. textContentItem.textRunBreakAllowed = false;
  18871. }
  18872. textContentItem.initialized = true;
  18873. return textContentItem;
  18874. }
  18875. function replaceWhitespace(str) {
  18876. var i = 0,
  18877. ii = str.length,
  18878. code;
  18879. while (i < ii && (code = str.charCodeAt(i)) >= 0x20 && code <= 0x7f) {
  18880. i++;
  18881. }
  18882. return i < ii ? str.replace(WhitespaceRegexp, " ") : str;
  18883. }
  18884. function runBidiTransform(textChunk) {
  18885. var str = textChunk.str.join("");
  18886. var bidiResult = (0, _bidi.bidi)(str, -1, textChunk.vertical);
  18887. return {
  18888. str: normalizeWhitespace ? replaceWhitespace(bidiResult.str) : bidiResult.str,
  18889. dir: bidiResult.dir,
  18890. width: textChunk.width,
  18891. height: textChunk.height,
  18892. transform: textChunk.transform,
  18893. fontName: textChunk.fontName
  18894. };
  18895. }
  18896. function handleSetFont(fontName, fontRef) {
  18897. return self.loadFont(fontName, fontRef, resources).then(function (translated) {
  18898. textState.font = translated.font;
  18899. textState.fontMatrix = translated.font.fontMatrix || _util.FONT_IDENTITY_MATRIX;
  18900. });
  18901. }
  18902. function buildTextContentItem(chars) {
  18903. var font = textState.font;
  18904. var textChunk = ensureTextContentItem();
  18905. var width = 0;
  18906. var height = 0;
  18907. var glyphs = font.charsToGlyphs(chars);
  18908. for (var i = 0; i < glyphs.length; i++) {
  18909. var glyph = glyphs[i];
  18910. var glyphWidth = null;
  18911. if (font.vertical && glyph.vmetric) {
  18912. glyphWidth = glyph.vmetric[0];
  18913. } else {
  18914. glyphWidth = glyph.width;
  18915. }
  18916. var glyphUnicode = glyph.unicode;
  18917. var NormalizedUnicodes = (0, _unicode.getNormalizedUnicodes)();
  18918. if (NormalizedUnicodes[glyphUnicode] !== undefined) {
  18919. glyphUnicode = NormalizedUnicodes[glyphUnicode];
  18920. }
  18921. glyphUnicode = (0, _unicode.reverseIfRtl)(glyphUnicode);
  18922. var charSpacing = textState.charSpacing;
  18923. if (glyph.isSpace) {
  18924. var wordSpacing = textState.wordSpacing;
  18925. charSpacing += wordSpacing;
  18926. if (wordSpacing > 0) {
  18927. addFakeSpaces(wordSpacing, textChunk.str);
  18928. }
  18929. }
  18930. var tx = 0;
  18931. var ty = 0;
  18932. if (!font.vertical) {
  18933. var w0 = glyphWidth * textState.fontMatrix[0];
  18934. tx = (w0 * textState.fontSize + charSpacing) * textState.textHScale;
  18935. width += tx;
  18936. } else {
  18937. var w1 = glyphWidth * textState.fontMatrix[0];
  18938. ty = w1 * textState.fontSize + charSpacing;
  18939. height += ty;
  18940. }
  18941. textState.translateTextMatrix(tx, ty);
  18942. textChunk.str.push(glyphUnicode);
  18943. }
  18944. if (!font.vertical) {
  18945. textChunk.lastAdvanceWidth = width;
  18946. textChunk.width += width;
  18947. } else {
  18948. textChunk.lastAdvanceHeight = height;
  18949. textChunk.height += Math.abs(height);
  18950. }
  18951. return textChunk;
  18952. }
  18953. function addFakeSpaces(width, strBuf) {
  18954. if (width < textContentItem.fakeSpaceMin) {
  18955. return;
  18956. }
  18957. if (width < textContentItem.fakeMultiSpaceMin) {
  18958. strBuf.push(" ");
  18959. return;
  18960. }
  18961. var fakeSpaces = Math.round(width / textContentItem.spaceWidth);
  18962. while (fakeSpaces-- > 0) {
  18963. strBuf.push(" ");
  18964. }
  18965. }
  18966. function flushTextContentItem() {
  18967. if (!textContentItem.initialized) {
  18968. return;
  18969. }
  18970. if (!textContentItem.vertical) {
  18971. textContentItem.width *= textContentItem.textAdvanceScale;
  18972. } else {
  18973. textContentItem.height *= textContentItem.textAdvanceScale;
  18974. }
  18975. textContent.items.push(runBidiTransform(textContentItem));
  18976. textContentItem.initialized = false;
  18977. textContentItem.str.length = 0;
  18978. }
  18979. function enqueueChunk() {
  18980. const length = textContent.items.length;
  18981. if (length > 0) {
  18982. sink.enqueue(textContent, length);
  18983. textContent.items = [];
  18984. textContent.styles = Object.create(null);
  18985. }
  18986. }
  18987. var timeSlotManager = new TimeSlotManager();
  18988. return new Promise(function promiseBody(resolve, reject) {
  18989. const next = function (promise) {
  18990. enqueueChunk();
  18991. Promise.all([promise, sink.ready]).then(function () {
  18992. try {
  18993. promiseBody(resolve, reject);
  18994. } catch (ex) {
  18995. reject(ex);
  18996. }
  18997. }, reject);
  18998. };
  18999. task.ensureNotTerminated();
  19000. timeSlotManager.reset();
  19001. var stop,
  19002. operation = {},
  19003. args = [];
  19004. while (!(stop = timeSlotManager.check())) {
  19005. args.length = 0;
  19006. operation.args = args;
  19007. if (!preprocessor.read(operation)) {
  19008. break;
  19009. }
  19010. textState = stateManager.state;
  19011. var fn = operation.fn;
  19012. args = operation.args;
  19013. var advance, diff;
  19014. switch (fn | 0) {
  19015. case _util.OPS.setFont:
  19016. var fontNameArg = args[0].name,
  19017. fontSizeArg = args[1];
  19018. if (textState.font && fontNameArg === textState.fontName && fontSizeArg === textState.fontSize) {
  19019. break;
  19020. }
  19021. flushTextContentItem();
  19022. textState.fontName = fontNameArg;
  19023. textState.fontSize = fontSizeArg;
  19024. next(handleSetFont(fontNameArg, null));
  19025. return;
  19026. case _util.OPS.setTextRise:
  19027. flushTextContentItem();
  19028. textState.textRise = args[0];
  19029. break;
  19030. case _util.OPS.setHScale:
  19031. flushTextContentItem();
  19032. textState.textHScale = args[0] / 100;
  19033. break;
  19034. case _util.OPS.setLeading:
  19035. flushTextContentItem();
  19036. textState.leading = args[0];
  19037. break;
  19038. case _util.OPS.moveText:
  19039. var isSameTextLine = !textState.font ? false : (textState.font.vertical ? args[0] : args[1]) === 0;
  19040. advance = args[0] - args[1];
  19041. if (combineTextItems && isSameTextLine && textContentItem.initialized && advance > 0 && advance <= textContentItem.fakeMultiSpaceMax) {
  19042. textState.translateTextLineMatrix(args[0], args[1]);
  19043. textContentItem.width += args[0] - textContentItem.lastAdvanceWidth;
  19044. textContentItem.height += args[1] - textContentItem.lastAdvanceHeight;
  19045. diff = args[0] - textContentItem.lastAdvanceWidth - (args[1] - textContentItem.lastAdvanceHeight);
  19046. addFakeSpaces(diff, textContentItem.str);
  19047. break;
  19048. }
  19049. flushTextContentItem();
  19050. textState.translateTextLineMatrix(args[0], args[1]);
  19051. textState.textMatrix = textState.textLineMatrix.slice();
  19052. break;
  19053. case _util.OPS.setLeadingMoveText:
  19054. flushTextContentItem();
  19055. textState.leading = -args[1];
  19056. textState.translateTextLineMatrix(args[0], args[1]);
  19057. textState.textMatrix = textState.textLineMatrix.slice();
  19058. break;
  19059. case _util.OPS.nextLine:
  19060. flushTextContentItem();
  19061. textState.carriageReturn();
  19062. break;
  19063. case _util.OPS.setTextMatrix:
  19064. advance = textState.calcTextLineMatrixAdvance(args[0], args[1], args[2], args[3], args[4], args[5]);
  19065. if (combineTextItems && advance !== null && textContentItem.initialized && advance.value > 0 && advance.value <= textContentItem.fakeMultiSpaceMax) {
  19066. textState.translateTextLineMatrix(advance.width, advance.height);
  19067. textContentItem.width += advance.width - textContentItem.lastAdvanceWidth;
  19068. textContentItem.height += advance.height - textContentItem.lastAdvanceHeight;
  19069. diff = advance.width - textContentItem.lastAdvanceWidth - (advance.height - textContentItem.lastAdvanceHeight);
  19070. addFakeSpaces(diff, textContentItem.str);
  19071. break;
  19072. }
  19073. flushTextContentItem();
  19074. textState.setTextMatrix(args[0], args[1], args[2], args[3], args[4], args[5]);
  19075. textState.setTextLineMatrix(args[0], args[1], args[2], args[3], args[4], args[5]);
  19076. break;
  19077. case _util.OPS.setCharSpacing:
  19078. textState.charSpacing = args[0];
  19079. break;
  19080. case _util.OPS.setWordSpacing:
  19081. textState.wordSpacing = args[0];
  19082. break;
  19083. case _util.OPS.beginText:
  19084. flushTextContentItem();
  19085. textState.textMatrix = _util.IDENTITY_MATRIX.slice();
  19086. textState.textLineMatrix = _util.IDENTITY_MATRIX.slice();
  19087. break;
  19088. case _util.OPS.showSpacedText:
  19089. if (!stateManager.state.font) {
  19090. self.ensureStateFont(stateManager.state);
  19091. continue;
  19092. }
  19093. var items = args[0];
  19094. var offset;
  19095. for (var j = 0, jj = items.length; j < jj; j++) {
  19096. if (typeof items[j] === "string") {
  19097. buildTextContentItem(items[j]);
  19098. } else if ((0, _util.isNum)(items[j])) {
  19099. ensureTextContentItem();
  19100. advance = items[j] * textState.fontSize / 1000;
  19101. var breakTextRun = false;
  19102. if (textState.font.vertical) {
  19103. offset = advance;
  19104. textState.translateTextMatrix(0, offset);
  19105. breakTextRun = textContentItem.textRunBreakAllowed && advance > textContentItem.fakeMultiSpaceMax;
  19106. if (!breakTextRun) {
  19107. textContentItem.height += offset;
  19108. }
  19109. } else {
  19110. advance = -advance;
  19111. offset = advance * textState.textHScale;
  19112. textState.translateTextMatrix(offset, 0);
  19113. breakTextRun = textContentItem.textRunBreakAllowed && advance > textContentItem.fakeMultiSpaceMax;
  19114. if (!breakTextRun) {
  19115. textContentItem.width += offset;
  19116. }
  19117. }
  19118. if (breakTextRun) {
  19119. flushTextContentItem();
  19120. } else if (advance > 0) {
  19121. addFakeSpaces(advance, textContentItem.str);
  19122. }
  19123. }
  19124. }
  19125. break;
  19126. case _util.OPS.showText:
  19127. if (!stateManager.state.font) {
  19128. self.ensureStateFont(stateManager.state);
  19129. continue;
  19130. }
  19131. buildTextContentItem(args[0]);
  19132. break;
  19133. case _util.OPS.nextLineShowText:
  19134. if (!stateManager.state.font) {
  19135. self.ensureStateFont(stateManager.state);
  19136. continue;
  19137. }
  19138. flushTextContentItem();
  19139. textState.carriageReturn();
  19140. buildTextContentItem(args[0]);
  19141. break;
  19142. case _util.OPS.nextLineSetSpacingShowText:
  19143. if (!stateManager.state.font) {
  19144. self.ensureStateFont(stateManager.state);
  19145. continue;
  19146. }
  19147. flushTextContentItem();
  19148. textState.wordSpacing = args[0];
  19149. textState.charSpacing = args[1];
  19150. textState.carriageReturn();
  19151. buildTextContentItem(args[2]);
  19152. break;
  19153. case _util.OPS.paintXObject:
  19154. flushTextContentItem();
  19155. if (!xobjs) {
  19156. xobjs = resources.get("XObject") || _primitives.Dict.empty;
  19157. }
  19158. var name = args[0].name;
  19159. if (name && emptyXObjectCache.getByName(name)) {
  19160. break;
  19161. }
  19162. next(new Promise(function (resolveXObject, rejectXObject) {
  19163. if (!name) {
  19164. throw new _util.FormatError("XObject must be referred to by name.");
  19165. }
  19166. let xobj = xobjs.getRaw(name);
  19167. if (xobj instanceof _primitives.Ref) {
  19168. if (emptyXObjectCache.getByRef(xobj)) {
  19169. resolveXObject();
  19170. return;
  19171. }
  19172. xobj = xref.fetch(xobj);
  19173. }
  19174. if (!(0, _primitives.isStream)(xobj)) {
  19175. throw new _util.FormatError("XObject should be a stream");
  19176. }
  19177. const type = xobj.dict.get("Subtype");
  19178. if (!(0, _primitives.isName)(type)) {
  19179. throw new _util.FormatError("XObject should have a Name subtype");
  19180. }
  19181. if (type.name !== "Form") {
  19182. emptyXObjectCache.set(name, xobj.dict.objId, true);
  19183. resolveXObject();
  19184. return;
  19185. }
  19186. const currentState = stateManager.state.clone();
  19187. const xObjStateManager = new StateManager(currentState);
  19188. const matrix = xobj.dict.getArray("Matrix");
  19189. if (Array.isArray(matrix) && matrix.length === 6) {
  19190. xObjStateManager.transform(matrix);
  19191. }
  19192. enqueueChunk();
  19193. const sinkWrapper = {
  19194. enqueueInvoked: false,
  19195. enqueue(chunk, size) {
  19196. this.enqueueInvoked = true;
  19197. sink.enqueue(chunk, size);
  19198. },
  19199. get desiredSize() {
  19200. return sink.desiredSize;
  19201. },
  19202. get ready() {
  19203. return sink.ready;
  19204. }
  19205. };
  19206. self.getTextContent({
  19207. stream: xobj,
  19208. task,
  19209. resources: xobj.dict.get("Resources") || resources,
  19210. stateManager: xObjStateManager,
  19211. normalizeWhitespace,
  19212. combineTextItems,
  19213. sink: sinkWrapper,
  19214. seenStyles
  19215. }).then(function () {
  19216. if (!sinkWrapper.enqueueInvoked) {
  19217. emptyXObjectCache.set(name, xobj.dict.objId, true);
  19218. }
  19219. resolveXObject();
  19220. }, rejectXObject);
  19221. }).catch(function (reason) {
  19222. if (reason instanceof _util.AbortException) {
  19223. return;
  19224. }
  19225. if (self.options.ignoreErrors) {
  19226. (0, _util.warn)(`getTextContent - ignoring XObject: "${reason}".`);
  19227. return;
  19228. }
  19229. throw reason;
  19230. }));
  19231. return;
  19232. case _util.OPS.setGState:
  19233. name = args[0].name;
  19234. if (name && emptyGStateCache.getByName(name)) {
  19235. break;
  19236. }
  19237. next(new Promise(function (resolveGState, rejectGState) {
  19238. if (!name) {
  19239. throw new _util.FormatError("GState must be referred to by name.");
  19240. }
  19241. const extGState = resources.get("ExtGState");
  19242. if (!(extGState instanceof _primitives.Dict)) {
  19243. throw new _util.FormatError("ExtGState should be a dictionary.");
  19244. }
  19245. const gState = extGState.get(name);
  19246. if (!(gState instanceof _primitives.Dict)) {
  19247. throw new _util.FormatError("GState should be a dictionary.");
  19248. }
  19249. const gStateFont = gState.get("Font");
  19250. if (!gStateFont) {
  19251. emptyGStateCache.set(name, gState.objId, true);
  19252. resolveGState();
  19253. return;
  19254. }
  19255. flushTextContentItem();
  19256. textState.fontName = null;
  19257. textState.fontSize = gStateFont[1];
  19258. handleSetFont(null, gStateFont[0]).then(resolveGState, rejectGState);
  19259. }).catch(function (reason) {
  19260. if (reason instanceof _util.AbortException) {
  19261. return;
  19262. }
  19263. if (self.options.ignoreErrors) {
  19264. (0, _util.warn)(`getTextContent - ignoring ExtGState: "${reason}".`);
  19265. return;
  19266. }
  19267. throw reason;
  19268. }));
  19269. return;
  19270. }
  19271. if (textContent.items.length >= sink.desiredSize) {
  19272. stop = true;
  19273. break;
  19274. }
  19275. }
  19276. if (stop) {
  19277. next(deferred);
  19278. return;
  19279. }
  19280. flushTextContentItem();
  19281. enqueueChunk();
  19282. resolve();
  19283. }).catch(reason => {
  19284. if (reason instanceof _util.AbortException) {
  19285. return;
  19286. }
  19287. if (this.options.ignoreErrors) {
  19288. (0, _util.warn)(`getTextContent - ignoring errors during "${task.name}" ` + `task: "${reason}".`);
  19289. flushTextContentItem();
  19290. enqueueChunk();
  19291. return;
  19292. }
  19293. throw reason;
  19294. });
  19295. }
  19296. extractDataStructures(dict, baseDict, properties) {
  19297. const xref = this.xref;
  19298. let cidToGidBytes;
  19299. var toUnicode = dict.get("ToUnicode") || baseDict.get("ToUnicode");
  19300. var toUnicodePromise = toUnicode ? this.readToUnicode(toUnicode) : Promise.resolve(undefined);
  19301. if (properties.composite) {
  19302. var cidSystemInfo = dict.get("CIDSystemInfo");
  19303. if ((0, _primitives.isDict)(cidSystemInfo)) {
  19304. properties.cidSystemInfo = {
  19305. registry: (0, _util.stringToPDFString)(cidSystemInfo.get("Registry")),
  19306. ordering: (0, _util.stringToPDFString)(cidSystemInfo.get("Ordering")),
  19307. supplement: cidSystemInfo.get("Supplement")
  19308. };
  19309. }
  19310. var cidToGidMap = dict.get("CIDToGIDMap");
  19311. if ((0, _primitives.isStream)(cidToGidMap)) {
  19312. cidToGidBytes = cidToGidMap.getBytes();
  19313. }
  19314. }
  19315. var differences = [];
  19316. var baseEncodingName = null;
  19317. var encoding;
  19318. if (dict.has("Encoding")) {
  19319. encoding = dict.get("Encoding");
  19320. if ((0, _primitives.isDict)(encoding)) {
  19321. baseEncodingName = encoding.get("BaseEncoding");
  19322. baseEncodingName = (0, _primitives.isName)(baseEncodingName) ? baseEncodingName.name : null;
  19323. if (encoding.has("Differences")) {
  19324. var diffEncoding = encoding.get("Differences");
  19325. var index = 0;
  19326. for (var j = 0, jj = diffEncoding.length; j < jj; j++) {
  19327. var data = xref.fetchIfRef(diffEncoding[j]);
  19328. if ((0, _util.isNum)(data)) {
  19329. index = data;
  19330. } else if ((0, _primitives.isName)(data)) {
  19331. differences[index++] = data.name;
  19332. } else {
  19333. throw new _util.FormatError(`Invalid entry in 'Differences' array: ${data}`);
  19334. }
  19335. }
  19336. }
  19337. } else if ((0, _primitives.isName)(encoding)) {
  19338. baseEncodingName = encoding.name;
  19339. } else {
  19340. throw new _util.FormatError("Encoding is not a Name nor a Dict");
  19341. }
  19342. if (baseEncodingName !== "MacRomanEncoding" && baseEncodingName !== "MacExpertEncoding" && baseEncodingName !== "WinAnsiEncoding") {
  19343. baseEncodingName = null;
  19344. }
  19345. }
  19346. if (baseEncodingName) {
  19347. properties.defaultEncoding = (0, _encodings.getEncoding)(baseEncodingName).slice();
  19348. } else {
  19349. var isSymbolicFont = !!(properties.flags & _fonts.FontFlags.Symbolic);
  19350. var isNonsymbolicFont = !!(properties.flags & _fonts.FontFlags.Nonsymbolic);
  19351. encoding = _encodings.StandardEncoding;
  19352. if (properties.type === "TrueType" && !isNonsymbolicFont) {
  19353. encoding = _encodings.WinAnsiEncoding;
  19354. }
  19355. if (isSymbolicFont) {
  19356. encoding = _encodings.MacRomanEncoding;
  19357. if (!properties.file) {
  19358. if (/Symbol/i.test(properties.name)) {
  19359. encoding = _encodings.SymbolSetEncoding;
  19360. } else if (/Dingbats|Wingdings/i.test(properties.name)) {
  19361. encoding = _encodings.ZapfDingbatsEncoding;
  19362. }
  19363. }
  19364. }
  19365. properties.defaultEncoding = encoding;
  19366. }
  19367. properties.differences = differences;
  19368. properties.baseEncodingName = baseEncodingName;
  19369. properties.hasEncoding = !!baseEncodingName || differences.length > 0;
  19370. properties.dict = dict;
  19371. return toUnicodePromise.then(readToUnicode => {
  19372. properties.toUnicode = readToUnicode;
  19373. return this.buildToUnicode(properties);
  19374. }).then(builtToUnicode => {
  19375. properties.toUnicode = builtToUnicode;
  19376. if (cidToGidBytes) {
  19377. properties.cidToGidMap = this.readCidToGidMap(cidToGidBytes, builtToUnicode);
  19378. }
  19379. return properties;
  19380. });
  19381. }
  19382. _buildSimpleFontToUnicode(properties, forceGlyphs = false) {
  19383. (0, _util.assert)(!properties.composite, "Must be a simple font.");
  19384. const toUnicode = [];
  19385. const encoding = properties.defaultEncoding.slice();
  19386. const baseEncodingName = properties.baseEncodingName;
  19387. const differences = properties.differences;
  19388. for (const charcode in differences) {
  19389. const glyphName = differences[charcode];
  19390. if (glyphName === ".notdef") {
  19391. continue;
  19392. }
  19393. encoding[charcode] = glyphName;
  19394. }
  19395. const glyphsUnicodeMap = (0, _glyphlist.getGlyphsUnicode)();
  19396. for (const charcode in encoding) {
  19397. let glyphName = encoding[charcode];
  19398. if (glyphName === "") {
  19399. continue;
  19400. } else if (glyphsUnicodeMap[glyphName] === undefined) {
  19401. let code = 0;
  19402. switch (glyphName[0]) {
  19403. case "G":
  19404. if (glyphName.length === 3) {
  19405. code = parseInt(glyphName.substring(1), 16);
  19406. }
  19407. break;
  19408. case "g":
  19409. if (glyphName.length === 5) {
  19410. code = parseInt(glyphName.substring(1), 16);
  19411. }
  19412. break;
  19413. case "C":
  19414. case "c":
  19415. if (glyphName.length >= 3 && glyphName.length <= 4) {
  19416. const codeStr = glyphName.substring(1);
  19417. if (forceGlyphs) {
  19418. code = parseInt(codeStr, 16);
  19419. break;
  19420. }
  19421. code = +codeStr;
  19422. if (Number.isNaN(code) && Number.isInteger(parseInt(codeStr, 16))) {
  19423. return this._buildSimpleFontToUnicode(properties, true);
  19424. }
  19425. }
  19426. break;
  19427. default:
  19428. const unicode = (0, _unicode.getUnicodeForGlyph)(glyphName, glyphsUnicodeMap);
  19429. if (unicode !== -1) {
  19430. code = unicode;
  19431. }
  19432. }
  19433. if (code > 0 && code <= 0x10ffff && Number.isInteger(code)) {
  19434. if (baseEncodingName && code === +charcode) {
  19435. const baseEncoding = (0, _encodings.getEncoding)(baseEncodingName);
  19436. if (baseEncoding && (glyphName = baseEncoding[charcode])) {
  19437. toUnicode[charcode] = String.fromCharCode(glyphsUnicodeMap[glyphName]);
  19438. continue;
  19439. }
  19440. }
  19441. toUnicode[charcode] = String.fromCodePoint(code);
  19442. }
  19443. continue;
  19444. }
  19445. toUnicode[charcode] = String.fromCharCode(glyphsUnicodeMap[glyphName]);
  19446. }
  19447. return new _fonts.ToUnicodeMap(toUnicode);
  19448. }
  19449. buildToUnicode(properties) {
  19450. properties.hasIncludedToUnicodeMap = !!properties.toUnicode && properties.toUnicode.length > 0;
  19451. if (properties.hasIncludedToUnicodeMap) {
  19452. if (!properties.composite && properties.hasEncoding) {
  19453. properties.fallbackToUnicode = this._buildSimpleFontToUnicode(properties);
  19454. }
  19455. return Promise.resolve(properties.toUnicode);
  19456. }
  19457. if (!properties.composite) {
  19458. return Promise.resolve(this._buildSimpleFontToUnicode(properties));
  19459. }
  19460. if (properties.composite && (properties.cMap.builtInCMap && !(properties.cMap instanceof _cmap.IdentityCMap) || properties.cidSystemInfo.registry === "Adobe" && (properties.cidSystemInfo.ordering === "GB1" || properties.cidSystemInfo.ordering === "CNS1" || properties.cidSystemInfo.ordering === "Japan1" || properties.cidSystemInfo.ordering === "Korea1"))) {
  19461. const registry = properties.cidSystemInfo.registry;
  19462. const ordering = properties.cidSystemInfo.ordering;
  19463. const ucs2CMapName = _primitives.Name.get(registry + "-" + ordering + "-UCS2");
  19464. return _cmap.CMapFactory.create({
  19465. encoding: ucs2CMapName,
  19466. fetchBuiltInCMap: this._fetchBuiltInCMapBound,
  19467. useCMap: null
  19468. }).then(function (ucs2CMap) {
  19469. const cMap = properties.cMap;
  19470. const toUnicode = [];
  19471. cMap.forEach(function (charcode, cid) {
  19472. if (cid > 0xffff) {
  19473. throw new _util.FormatError("Max size of CID is 65,535");
  19474. }
  19475. const ucs2 = ucs2CMap.lookup(cid);
  19476. if (ucs2) {
  19477. toUnicode[charcode] = String.fromCharCode((ucs2.charCodeAt(0) << 8) + ucs2.charCodeAt(1));
  19478. }
  19479. });
  19480. return new _fonts.ToUnicodeMap(toUnicode);
  19481. });
  19482. }
  19483. return Promise.resolve(new _fonts.IdentityToUnicodeMap(properties.firstChar, properties.lastChar));
  19484. }
  19485. readToUnicode(toUnicode) {
  19486. var cmapObj = toUnicode;
  19487. if ((0, _primitives.isName)(cmapObj)) {
  19488. return _cmap.CMapFactory.create({
  19489. encoding: cmapObj,
  19490. fetchBuiltInCMap: this._fetchBuiltInCMapBound,
  19491. useCMap: null
  19492. }).then(function (cmap) {
  19493. if (cmap instanceof _cmap.IdentityCMap) {
  19494. return new _fonts.IdentityToUnicodeMap(0, 0xffff);
  19495. }
  19496. return new _fonts.ToUnicodeMap(cmap.getMap());
  19497. });
  19498. } else if ((0, _primitives.isStream)(cmapObj)) {
  19499. return _cmap.CMapFactory.create({
  19500. encoding: cmapObj,
  19501. fetchBuiltInCMap: this._fetchBuiltInCMapBound,
  19502. useCMap: null
  19503. }).then(function (cmap) {
  19504. if (cmap instanceof _cmap.IdentityCMap) {
  19505. return new _fonts.IdentityToUnicodeMap(0, 0xffff);
  19506. }
  19507. var map = new Array(cmap.length);
  19508. cmap.forEach(function (charCode, token) {
  19509. var str = [];
  19510. for (var k = 0; k < token.length; k += 2) {
  19511. var w1 = token.charCodeAt(k) << 8 | token.charCodeAt(k + 1);
  19512. if ((w1 & 0xf800) !== 0xd800) {
  19513. str.push(w1);
  19514. continue;
  19515. }
  19516. k += 2;
  19517. var w2 = token.charCodeAt(k) << 8 | token.charCodeAt(k + 1);
  19518. str.push(((w1 & 0x3ff) << 10) + (w2 & 0x3ff) + 0x10000);
  19519. }
  19520. map[charCode] = String.fromCodePoint.apply(String, str);
  19521. });
  19522. return new _fonts.ToUnicodeMap(map);
  19523. }, reason => {
  19524. if (reason instanceof _util.AbortException) {
  19525. return null;
  19526. }
  19527. if (this.options.ignoreErrors) {
  19528. this.handler.send("UnsupportedFeature", {
  19529. featureId: _util.UNSUPPORTED_FEATURES.errorFontToUnicode
  19530. });
  19531. (0, _util.warn)(`readToUnicode - ignoring ToUnicode data: "${reason}".`);
  19532. return null;
  19533. }
  19534. throw reason;
  19535. });
  19536. }
  19537. return Promise.resolve(null);
  19538. }
  19539. readCidToGidMap(glyphsData, toUnicode) {
  19540. var result = [];
  19541. for (var j = 0, jj = glyphsData.length; j < jj; j++) {
  19542. var glyphID = glyphsData[j++] << 8 | glyphsData[j];
  19543. const code = j >> 1;
  19544. if (glyphID === 0 && !toUnicode.has(code)) {
  19545. continue;
  19546. }
  19547. result[code] = glyphID;
  19548. }
  19549. return result;
  19550. }
  19551. extractWidths(dict, descriptor, properties) {
  19552. var xref = this.xref;
  19553. var glyphsWidths = [];
  19554. var defaultWidth = 0;
  19555. var glyphsVMetrics = [];
  19556. var defaultVMetrics;
  19557. var i, ii, j, jj, start, code, widths;
  19558. if (properties.composite) {
  19559. defaultWidth = dict.has("DW") ? dict.get("DW") : 1000;
  19560. widths = dict.get("W");
  19561. if (widths) {
  19562. for (i = 0, ii = widths.length; i < ii; i++) {
  19563. start = xref.fetchIfRef(widths[i++]);
  19564. code = xref.fetchIfRef(widths[i]);
  19565. if (Array.isArray(code)) {
  19566. for (j = 0, jj = code.length; j < jj; j++) {
  19567. glyphsWidths[start++] = xref.fetchIfRef(code[j]);
  19568. }
  19569. } else {
  19570. var width = xref.fetchIfRef(widths[++i]);
  19571. for (j = start; j <= code; j++) {
  19572. glyphsWidths[j] = width;
  19573. }
  19574. }
  19575. }
  19576. }
  19577. if (properties.vertical) {
  19578. var vmetrics = dict.getArray("DW2") || [880, -1000];
  19579. defaultVMetrics = [vmetrics[1], defaultWidth * 0.5, vmetrics[0]];
  19580. vmetrics = dict.get("W2");
  19581. if (vmetrics) {
  19582. for (i = 0, ii = vmetrics.length; i < ii; i++) {
  19583. start = xref.fetchIfRef(vmetrics[i++]);
  19584. code = xref.fetchIfRef(vmetrics[i]);
  19585. if (Array.isArray(code)) {
  19586. for (j = 0, jj = code.length; j < jj; j++) {
  19587. glyphsVMetrics[start++] = [xref.fetchIfRef(code[j++]), xref.fetchIfRef(code[j++]), xref.fetchIfRef(code[j])];
  19588. }
  19589. } else {
  19590. var vmetric = [xref.fetchIfRef(vmetrics[++i]), xref.fetchIfRef(vmetrics[++i]), xref.fetchIfRef(vmetrics[++i])];
  19591. for (j = start; j <= code; j++) {
  19592. glyphsVMetrics[j] = vmetric;
  19593. }
  19594. }
  19595. }
  19596. }
  19597. }
  19598. } else {
  19599. var firstChar = properties.firstChar;
  19600. widths = dict.get("Widths");
  19601. if (widths) {
  19602. j = firstChar;
  19603. for (i = 0, ii = widths.length; i < ii; i++) {
  19604. glyphsWidths[j++] = xref.fetchIfRef(widths[i]);
  19605. }
  19606. defaultWidth = parseFloat(descriptor.get("MissingWidth")) || 0;
  19607. } else {
  19608. var baseFontName = dict.get("BaseFont");
  19609. if ((0, _primitives.isName)(baseFontName)) {
  19610. var metrics = this.getBaseFontMetrics(baseFontName.name);
  19611. glyphsWidths = this.buildCharCodeToWidth(metrics.widths, properties);
  19612. defaultWidth = metrics.defaultWidth;
  19613. }
  19614. }
  19615. }
  19616. var isMonospace = true;
  19617. var firstWidth = defaultWidth;
  19618. for (var glyph in glyphsWidths) {
  19619. var glyphWidth = glyphsWidths[glyph];
  19620. if (!glyphWidth) {
  19621. continue;
  19622. }
  19623. if (!firstWidth) {
  19624. firstWidth = glyphWidth;
  19625. continue;
  19626. }
  19627. if (firstWidth !== glyphWidth) {
  19628. isMonospace = false;
  19629. break;
  19630. }
  19631. }
  19632. if (isMonospace) {
  19633. properties.flags |= _fonts.FontFlags.FixedPitch;
  19634. }
  19635. properties.defaultWidth = defaultWidth;
  19636. properties.widths = glyphsWidths;
  19637. properties.defaultVMetrics = defaultVMetrics;
  19638. properties.vmetrics = glyphsVMetrics;
  19639. }
  19640. isSerifFont(baseFontName) {
  19641. var fontNameWoStyle = baseFontName.split("-")[0];
  19642. return fontNameWoStyle in (0, _standard_fonts.getSerifFonts)() || fontNameWoStyle.search(/serif/gi) !== -1;
  19643. }
  19644. getBaseFontMetrics(name) {
  19645. var defaultWidth = 0;
  19646. var widths = [];
  19647. var monospace = false;
  19648. var stdFontMap = (0, _standard_fonts.getStdFontMap)();
  19649. var lookupName = stdFontMap[name] || name;
  19650. var Metrics = (0, _metrics.getMetrics)();
  19651. if (!(lookupName in Metrics)) {
  19652. if (this.isSerifFont(name)) {
  19653. lookupName = "Times-Roman";
  19654. } else {
  19655. lookupName = "Helvetica";
  19656. }
  19657. }
  19658. var glyphWidths = Metrics[lookupName];
  19659. if ((0, _util.isNum)(glyphWidths)) {
  19660. defaultWidth = glyphWidths;
  19661. monospace = true;
  19662. } else {
  19663. widths = glyphWidths();
  19664. }
  19665. return {
  19666. defaultWidth,
  19667. monospace,
  19668. widths
  19669. };
  19670. }
  19671. buildCharCodeToWidth(widthsByGlyphName, properties) {
  19672. var widths = Object.create(null);
  19673. var differences = properties.differences;
  19674. var encoding = properties.defaultEncoding;
  19675. for (var charCode = 0; charCode < 256; charCode++) {
  19676. if (charCode in differences && widthsByGlyphName[differences[charCode]]) {
  19677. widths[charCode] = widthsByGlyphName[differences[charCode]];
  19678. continue;
  19679. }
  19680. if (charCode in encoding && widthsByGlyphName[encoding[charCode]]) {
  19681. widths[charCode] = widthsByGlyphName[encoding[charCode]];
  19682. continue;
  19683. }
  19684. }
  19685. return widths;
  19686. }
  19687. preEvaluateFont(dict) {
  19688. var baseDict = dict;
  19689. var type = dict.get("Subtype");
  19690. if (!(0, _primitives.isName)(type)) {
  19691. throw new _util.FormatError("invalid font Subtype");
  19692. }
  19693. var composite = false;
  19694. var uint8array;
  19695. if (type.name === "Type0") {
  19696. var df = dict.get("DescendantFonts");
  19697. if (!df) {
  19698. throw new _util.FormatError("Descendant fonts are not specified");
  19699. }
  19700. dict = Array.isArray(df) ? this.xref.fetchIfRef(df[0]) : df;
  19701. if (!(dict instanceof _primitives.Dict)) {
  19702. throw new _util.FormatError("Descendant font is not a dictionary.");
  19703. }
  19704. type = dict.get("Subtype");
  19705. if (!(0, _primitives.isName)(type)) {
  19706. throw new _util.FormatError("invalid font Subtype");
  19707. }
  19708. composite = true;
  19709. }
  19710. var descriptor = dict.get("FontDescriptor");
  19711. if (descriptor) {
  19712. var hash = new _murmurhash.MurmurHash3_64();
  19713. var encoding = baseDict.getRaw("Encoding");
  19714. if ((0, _primitives.isName)(encoding)) {
  19715. hash.update(encoding.name);
  19716. } else if ((0, _primitives.isRef)(encoding)) {
  19717. hash.update(encoding.toString());
  19718. } else if ((0, _primitives.isDict)(encoding)) {
  19719. for (const entry of encoding.getRawValues()) {
  19720. if ((0, _primitives.isName)(entry)) {
  19721. hash.update(entry.name);
  19722. } else if ((0, _primitives.isRef)(entry)) {
  19723. hash.update(entry.toString());
  19724. } else if (Array.isArray(entry)) {
  19725. var diffLength = entry.length,
  19726. diffBuf = new Array(diffLength);
  19727. for (var j = 0; j < diffLength; j++) {
  19728. var diffEntry = entry[j];
  19729. if ((0, _primitives.isName)(diffEntry)) {
  19730. diffBuf[j] = diffEntry.name;
  19731. } else if ((0, _util.isNum)(diffEntry) || (0, _primitives.isRef)(diffEntry)) {
  19732. diffBuf[j] = diffEntry.toString();
  19733. }
  19734. }
  19735. hash.update(diffBuf.join());
  19736. }
  19737. }
  19738. }
  19739. const firstChar = dict.get("FirstChar") || 0;
  19740. const lastChar = dict.get("LastChar") || (composite ? 0xffff : 0xff);
  19741. hash.update(`${firstChar}-${lastChar}`);
  19742. var toUnicode = dict.get("ToUnicode") || baseDict.get("ToUnicode");
  19743. if ((0, _primitives.isStream)(toUnicode)) {
  19744. var stream = toUnicode.str || toUnicode;
  19745. uint8array = stream.buffer ? new Uint8Array(stream.buffer.buffer, 0, stream.bufferLength) : new Uint8Array(stream.bytes.buffer, stream.start, stream.end - stream.start);
  19746. hash.update(uint8array);
  19747. } else if ((0, _primitives.isName)(toUnicode)) {
  19748. hash.update(toUnicode.name);
  19749. }
  19750. var widths = dict.get("Widths") || baseDict.get("Widths");
  19751. if (widths) {
  19752. uint8array = new Uint8Array(new Uint32Array(widths).buffer);
  19753. hash.update(uint8array);
  19754. }
  19755. }
  19756. return {
  19757. descriptor,
  19758. dict,
  19759. baseDict,
  19760. composite,
  19761. type: type.name,
  19762. hash: hash ? hash.hexdigest() : ""
  19763. };
  19764. }
  19765. async translateFont(preEvaluatedFont) {
  19766. var baseDict = preEvaluatedFont.baseDict;
  19767. var dict = preEvaluatedFont.dict;
  19768. var composite = preEvaluatedFont.composite;
  19769. var descriptor = preEvaluatedFont.descriptor;
  19770. var type = preEvaluatedFont.type;
  19771. var maxCharIndex = composite ? 0xffff : 0xff;
  19772. var properties;
  19773. const firstChar = dict.get("FirstChar") || 0;
  19774. const lastChar = dict.get("LastChar") || maxCharIndex;
  19775. if (!descriptor) {
  19776. if (type === "Type3") {
  19777. descriptor = new _primitives.Dict(null);
  19778. descriptor.set("FontName", _primitives.Name.get(type));
  19779. descriptor.set("FontBBox", dict.getArray("FontBBox") || [0, 0, 0, 0]);
  19780. } else {
  19781. var baseFontName = dict.get("BaseFont");
  19782. if (!(0, _primitives.isName)(baseFontName)) {
  19783. throw new _util.FormatError("Base font is not specified");
  19784. }
  19785. baseFontName = baseFontName.name.replace(/[,_]/g, "-");
  19786. var metrics = this.getBaseFontMetrics(baseFontName);
  19787. var fontNameWoStyle = baseFontName.split("-")[0];
  19788. var flags = (this.isSerifFont(fontNameWoStyle) ? _fonts.FontFlags.Serif : 0) | (metrics.monospace ? _fonts.FontFlags.FixedPitch : 0) | ((0, _standard_fonts.getSymbolsFonts)()[fontNameWoStyle] ? _fonts.FontFlags.Symbolic : _fonts.FontFlags.Nonsymbolic);
  19789. properties = {
  19790. type,
  19791. name: baseFontName,
  19792. widths: metrics.widths,
  19793. defaultWidth: metrics.defaultWidth,
  19794. flags,
  19795. firstChar,
  19796. lastChar
  19797. };
  19798. const widths = dict.get("Widths");
  19799. return this.extractDataStructures(dict, dict, properties).then(newProperties => {
  19800. if (widths) {
  19801. const glyphWidths = [];
  19802. let j = firstChar;
  19803. for (let i = 0, ii = widths.length; i < ii; i++) {
  19804. glyphWidths[j++] = this.xref.fetchIfRef(widths[i]);
  19805. }
  19806. newProperties.widths = glyphWidths;
  19807. } else {
  19808. newProperties.widths = this.buildCharCodeToWidth(metrics.widths, newProperties);
  19809. }
  19810. return new _fonts.Font(baseFontName, null, newProperties);
  19811. });
  19812. }
  19813. }
  19814. var fontName = descriptor.get("FontName");
  19815. var baseFont = dict.get("BaseFont");
  19816. if ((0, _util.isString)(fontName)) {
  19817. fontName = _primitives.Name.get(fontName);
  19818. }
  19819. if ((0, _util.isString)(baseFont)) {
  19820. baseFont = _primitives.Name.get(baseFont);
  19821. }
  19822. if (type !== "Type3") {
  19823. var fontNameStr = fontName && fontName.name;
  19824. var baseFontStr = baseFont && baseFont.name;
  19825. if (fontNameStr !== baseFontStr) {
  19826. (0, _util.info)(`The FontDescriptor's FontName is "${fontNameStr}" but ` + `should be the same as the Font's BaseFont "${baseFontStr}".`);
  19827. if (fontNameStr && baseFontStr && baseFontStr.startsWith(fontNameStr)) {
  19828. fontName = baseFont;
  19829. }
  19830. }
  19831. }
  19832. fontName = fontName || baseFont;
  19833. if (!(0, _primitives.isName)(fontName)) {
  19834. throw new _util.FormatError("invalid font name");
  19835. }
  19836. var fontFile = descriptor.get("FontFile", "FontFile2", "FontFile3");
  19837. if (fontFile) {
  19838. if (fontFile.dict) {
  19839. var subtype = fontFile.dict.get("Subtype");
  19840. if (subtype) {
  19841. subtype = subtype.name;
  19842. }
  19843. var length1 = fontFile.dict.get("Length1");
  19844. var length2 = fontFile.dict.get("Length2");
  19845. var length3 = fontFile.dict.get("Length3");
  19846. }
  19847. }
  19848. properties = {
  19849. type,
  19850. name: fontName.name,
  19851. subtype,
  19852. file: fontFile,
  19853. length1,
  19854. length2,
  19855. length3,
  19856. loadedName: baseDict.loadedName,
  19857. composite,
  19858. fixedPitch: false,
  19859. fontMatrix: dict.getArray("FontMatrix") || _util.FONT_IDENTITY_MATRIX,
  19860. firstChar: firstChar || 0,
  19861. lastChar: lastChar || maxCharIndex,
  19862. bbox: descriptor.getArray("FontBBox"),
  19863. ascent: descriptor.get("Ascent"),
  19864. descent: descriptor.get("Descent"),
  19865. xHeight: descriptor.get("XHeight"),
  19866. capHeight: descriptor.get("CapHeight"),
  19867. flags: descriptor.get("Flags"),
  19868. italicAngle: descriptor.get("ItalicAngle"),
  19869. isType3Font: false
  19870. };
  19871. if (composite) {
  19872. const cidEncoding = baseDict.get("Encoding");
  19873. if ((0, _primitives.isName)(cidEncoding)) {
  19874. properties.cidEncoding = cidEncoding.name;
  19875. }
  19876. const cMap = await _cmap.CMapFactory.create({
  19877. encoding: cidEncoding,
  19878. fetchBuiltInCMap: this._fetchBuiltInCMapBound,
  19879. useCMap: null
  19880. });
  19881. properties.cMap = cMap;
  19882. properties.vertical = properties.cMap.vertical;
  19883. }
  19884. return this.extractDataStructures(dict, baseDict, properties).then(newProperties => {
  19885. this.extractWidths(dict, descriptor, newProperties);
  19886. if (type === "Type3") {
  19887. newProperties.isType3Font = true;
  19888. }
  19889. return new _fonts.Font(fontName.name, fontFile, newProperties);
  19890. });
  19891. }
  19892. static buildFontPaths(font, glyphs, handler) {
  19893. function buildPath(fontChar) {
  19894. if (font.renderer.hasBuiltPath(fontChar)) {
  19895. return;
  19896. }
  19897. handler.send("commonobj", [`${font.loadedName}_path_${fontChar}`, "FontPath", font.renderer.getPathJs(fontChar)]);
  19898. }
  19899. for (const glyph of glyphs) {
  19900. buildPath(glyph.fontChar);
  19901. const accent = glyph.accent;
  19902. if (accent && accent.fontChar) {
  19903. buildPath(accent.fontChar);
  19904. }
  19905. }
  19906. }
  19907. static get fallbackFontDict() {
  19908. const dict = new _primitives.Dict();
  19909. dict.set("BaseFont", _primitives.Name.get("PDFJS-FallbackFont"));
  19910. dict.set("Type", _primitives.Name.get("FallbackType"));
  19911. dict.set("Subtype", _primitives.Name.get("FallbackType"));
  19912. dict.set("Encoding", _primitives.Name.get("WinAnsiEncoding"));
  19913. return (0, _util.shadow)(this, "fallbackFontDict", dict);
  19914. }
  19915. }
  19916. exports.PartialEvaluator = PartialEvaluator;
  19917. class TranslatedFont {
  19918. constructor({
  19919. loadedName,
  19920. font,
  19921. dict,
  19922. extraProperties = false
  19923. }) {
  19924. this.loadedName = loadedName;
  19925. this.font = font;
  19926. this.dict = dict;
  19927. this._extraProperties = extraProperties;
  19928. this.type3Loaded = null;
  19929. this.type3Dependencies = font.isType3Font ? new Set() : null;
  19930. this.sent = false;
  19931. }
  19932. send(handler) {
  19933. if (this.sent) {
  19934. return;
  19935. }
  19936. this.sent = true;
  19937. handler.send("commonobj", [this.loadedName, "Font", this.font.exportData(this._extraProperties)]);
  19938. }
  19939. fallback(handler) {
  19940. if (!this.font.data) {
  19941. return;
  19942. }
  19943. this.font.disableFontFace = true;
  19944. const glyphs = this.font.glyphCacheValues;
  19945. PartialEvaluator.buildFontPaths(this.font, glyphs, handler);
  19946. }
  19947. loadType3Data(evaluator, resources, task) {
  19948. if (this.type3Loaded) {
  19949. return this.type3Loaded;
  19950. }
  19951. if (!this.font.isType3Font) {
  19952. throw new Error("Must be a Type3 font.");
  19953. }
  19954. var type3Options = Object.create(evaluator.options);
  19955. type3Options.ignoreErrors = false;
  19956. var type3Evaluator = evaluator.clone(type3Options);
  19957. type3Evaluator.parsingType3Font = true;
  19958. const translatedFont = this.font,
  19959. type3Dependencies = this.type3Dependencies;
  19960. var loadCharProcsPromise = Promise.resolve();
  19961. var charProcs = this.dict.get("CharProcs");
  19962. var fontResources = this.dict.get("Resources") || resources;
  19963. var charProcOperatorList = Object.create(null);
  19964. for (const key of charProcs.getKeys()) {
  19965. loadCharProcsPromise = loadCharProcsPromise.then(() => {
  19966. var glyphStream = charProcs.get(key);
  19967. var operatorList = new _operator_list.OperatorList();
  19968. return type3Evaluator.getOperatorList({
  19969. stream: glyphStream,
  19970. task,
  19971. resources: fontResources,
  19972. operatorList
  19973. }).then(() => {
  19974. if (operatorList.fnArray[0] === _util.OPS.setCharWidthAndBounds) {
  19975. this._removeType3ColorOperators(operatorList);
  19976. }
  19977. charProcOperatorList[key] = operatorList.getIR();
  19978. for (const dependency of operatorList.dependencies) {
  19979. type3Dependencies.add(dependency);
  19980. }
  19981. }).catch(function (reason) {
  19982. (0, _util.warn)(`Type3 font resource "${key}" is not available.`);
  19983. const dummyOperatorList = new _operator_list.OperatorList();
  19984. charProcOperatorList[key] = dummyOperatorList.getIR();
  19985. });
  19986. });
  19987. }
  19988. this.type3Loaded = loadCharProcsPromise.then(function () {
  19989. translatedFont.charProcOperatorList = charProcOperatorList;
  19990. });
  19991. return this.type3Loaded;
  19992. }
  19993. _removeType3ColorOperators(operatorList) {
  19994. let i = 1,
  19995. ii = operatorList.length;
  19996. while (i < ii) {
  19997. switch (operatorList.fnArray[i]) {
  19998. case _util.OPS.setStrokeColorSpace:
  19999. case _util.OPS.setFillColorSpace:
  20000. case _util.OPS.setStrokeColor:
  20001. case _util.OPS.setStrokeColorN:
  20002. case _util.OPS.setFillColor:
  20003. case _util.OPS.setFillColorN:
  20004. case _util.OPS.setStrokeGray:
  20005. case _util.OPS.setFillGray:
  20006. case _util.OPS.setStrokeRGBColor:
  20007. case _util.OPS.setFillRGBColor:
  20008. case _util.OPS.setStrokeCMYKColor:
  20009. case _util.OPS.setFillCMYKColor:
  20010. case _util.OPS.shadingFill:
  20011. case _util.OPS.setRenderingIntent:
  20012. operatorList.fnArray.splice(i, 1);
  20013. operatorList.argsArray.splice(i, 1);
  20014. ii--;
  20015. continue;
  20016. case _util.OPS.setGState:
  20017. const [gStateObj] = operatorList.argsArray[i];
  20018. let j = 0,
  20019. jj = gStateObj.length;
  20020. while (j < jj) {
  20021. const [gStateKey] = gStateObj[j];
  20022. switch (gStateKey) {
  20023. case "TR":
  20024. case "TR2":
  20025. case "HT":
  20026. case "BG":
  20027. case "BG2":
  20028. case "UCR":
  20029. case "UCR2":
  20030. gStateObj.splice(j, 1);
  20031. jj--;
  20032. continue;
  20033. }
  20034. j++;
  20035. }
  20036. break;
  20037. }
  20038. i++;
  20039. }
  20040. }
  20041. }
  20042. class StateManager {
  20043. constructor(initialState = new EvalState()) {
  20044. this.state = initialState;
  20045. this.stateStack = [];
  20046. }
  20047. save() {
  20048. var old = this.state;
  20049. this.stateStack.push(this.state);
  20050. this.state = old.clone();
  20051. }
  20052. restore() {
  20053. var prev = this.stateStack.pop();
  20054. if (prev) {
  20055. this.state = prev;
  20056. }
  20057. }
  20058. transform(args) {
  20059. this.state.ctm = _util.Util.transform(this.state.ctm, args);
  20060. }
  20061. }
  20062. class TextState {
  20063. constructor() {
  20064. this.ctm = new Float32Array(_util.IDENTITY_MATRIX);
  20065. this.fontName = null;
  20066. this.fontSize = 0;
  20067. this.font = null;
  20068. this.fontMatrix = _util.FONT_IDENTITY_MATRIX;
  20069. this.textMatrix = _util.IDENTITY_MATRIX.slice();
  20070. this.textLineMatrix = _util.IDENTITY_MATRIX.slice();
  20071. this.charSpacing = 0;
  20072. this.wordSpacing = 0;
  20073. this.leading = 0;
  20074. this.textHScale = 1;
  20075. this.textRise = 0;
  20076. }
  20077. setTextMatrix(a, b, c, d, e, f) {
  20078. var m = this.textMatrix;
  20079. m[0] = a;
  20080. m[1] = b;
  20081. m[2] = c;
  20082. m[3] = d;
  20083. m[4] = e;
  20084. m[5] = f;
  20085. }
  20086. setTextLineMatrix(a, b, c, d, e, f) {
  20087. var m = this.textLineMatrix;
  20088. m[0] = a;
  20089. m[1] = b;
  20090. m[2] = c;
  20091. m[3] = d;
  20092. m[4] = e;
  20093. m[5] = f;
  20094. }
  20095. translateTextMatrix(x, y) {
  20096. var m = this.textMatrix;
  20097. m[4] = m[0] * x + m[2] * y + m[4];
  20098. m[5] = m[1] * x + m[3] * y + m[5];
  20099. }
  20100. translateTextLineMatrix(x, y) {
  20101. var m = this.textLineMatrix;
  20102. m[4] = m[0] * x + m[2] * y + m[4];
  20103. m[5] = m[1] * x + m[3] * y + m[5];
  20104. }
  20105. calcTextLineMatrixAdvance(a, b, c, d, e, f) {
  20106. var font = this.font;
  20107. if (!font) {
  20108. return null;
  20109. }
  20110. var m = this.textLineMatrix;
  20111. if (!(a === m[0] && b === m[1] && c === m[2] && d === m[3])) {
  20112. return null;
  20113. }
  20114. var txDiff = e - m[4],
  20115. tyDiff = f - m[5];
  20116. if (font.vertical && txDiff !== 0 || !font.vertical && tyDiff !== 0) {
  20117. return null;
  20118. }
  20119. var tx,
  20120. ty,
  20121. denominator = a * d - b * c;
  20122. if (font.vertical) {
  20123. tx = -tyDiff * c / denominator;
  20124. ty = tyDiff * a / denominator;
  20125. } else {
  20126. tx = txDiff * d / denominator;
  20127. ty = -txDiff * b / denominator;
  20128. }
  20129. return {
  20130. width: tx,
  20131. height: ty,
  20132. value: font.vertical ? ty : tx
  20133. };
  20134. }
  20135. calcRenderMatrix(ctm) {
  20136. var tsm = [this.fontSize * this.textHScale, 0, 0, this.fontSize, 0, this.textRise];
  20137. return _util.Util.transform(ctm, _util.Util.transform(this.textMatrix, tsm));
  20138. }
  20139. carriageReturn() {
  20140. this.translateTextLineMatrix(0, -this.leading);
  20141. this.textMatrix = this.textLineMatrix.slice();
  20142. }
  20143. clone() {
  20144. var clone = Object.create(this);
  20145. clone.textMatrix = this.textMatrix.slice();
  20146. clone.textLineMatrix = this.textLineMatrix.slice();
  20147. clone.fontMatrix = this.fontMatrix.slice();
  20148. return clone;
  20149. }
  20150. }
  20151. class EvalState {
  20152. constructor() {
  20153. this.ctm = new Float32Array(_util.IDENTITY_MATRIX);
  20154. this.font = null;
  20155. this.textRenderingMode = _util.TextRenderingMode.FILL;
  20156. this.fillColorSpace = _colorspace.ColorSpace.singletons.gray;
  20157. this.strokeColorSpace = _colorspace.ColorSpace.singletons.gray;
  20158. }
  20159. clone() {
  20160. return Object.create(this);
  20161. }
  20162. }
  20163. class EvaluatorPreprocessor {
  20164. static get opMap() {
  20165. const getOPMap = (0, _core_utils.getLookupTableFactory)(function (t) {
  20166. t.w = {
  20167. id: _util.OPS.setLineWidth,
  20168. numArgs: 1,
  20169. variableArgs: false
  20170. };
  20171. t.J = {
  20172. id: _util.OPS.setLineCap,
  20173. numArgs: 1,
  20174. variableArgs: false
  20175. };
  20176. t.j = {
  20177. id: _util.OPS.setLineJoin,
  20178. numArgs: 1,
  20179. variableArgs: false
  20180. };
  20181. t.M = {
  20182. id: _util.OPS.setMiterLimit,
  20183. numArgs: 1,
  20184. variableArgs: false
  20185. };
  20186. t.d = {
  20187. id: _util.OPS.setDash,
  20188. numArgs: 2,
  20189. variableArgs: false
  20190. };
  20191. t.ri = {
  20192. id: _util.OPS.setRenderingIntent,
  20193. numArgs: 1,
  20194. variableArgs: false
  20195. };
  20196. t.i = {
  20197. id: _util.OPS.setFlatness,
  20198. numArgs: 1,
  20199. variableArgs: false
  20200. };
  20201. t.gs = {
  20202. id: _util.OPS.setGState,
  20203. numArgs: 1,
  20204. variableArgs: false
  20205. };
  20206. t.q = {
  20207. id: _util.OPS.save,
  20208. numArgs: 0,
  20209. variableArgs: false
  20210. };
  20211. t.Q = {
  20212. id: _util.OPS.restore,
  20213. numArgs: 0,
  20214. variableArgs: false
  20215. };
  20216. t.cm = {
  20217. id: _util.OPS.transform,
  20218. numArgs: 6,
  20219. variableArgs: false
  20220. };
  20221. t.m = {
  20222. id: _util.OPS.moveTo,
  20223. numArgs: 2,
  20224. variableArgs: false
  20225. };
  20226. t.l = {
  20227. id: _util.OPS.lineTo,
  20228. numArgs: 2,
  20229. variableArgs: false
  20230. };
  20231. t.c = {
  20232. id: _util.OPS.curveTo,
  20233. numArgs: 6,
  20234. variableArgs: false
  20235. };
  20236. t.v = {
  20237. id: _util.OPS.curveTo2,
  20238. numArgs: 4,
  20239. variableArgs: false
  20240. };
  20241. t.y = {
  20242. id: _util.OPS.curveTo3,
  20243. numArgs: 4,
  20244. variableArgs: false
  20245. };
  20246. t.h = {
  20247. id: _util.OPS.closePath,
  20248. numArgs: 0,
  20249. variableArgs: false
  20250. };
  20251. t.re = {
  20252. id: _util.OPS.rectangle,
  20253. numArgs: 4,
  20254. variableArgs: false
  20255. };
  20256. t.S = {
  20257. id: _util.OPS.stroke,
  20258. numArgs: 0,
  20259. variableArgs: false
  20260. };
  20261. t.s = {
  20262. id: _util.OPS.closeStroke,
  20263. numArgs: 0,
  20264. variableArgs: false
  20265. };
  20266. t.f = {
  20267. id: _util.OPS.fill,
  20268. numArgs: 0,
  20269. variableArgs: false
  20270. };
  20271. t.F = {
  20272. id: _util.OPS.fill,
  20273. numArgs: 0,
  20274. variableArgs: false
  20275. };
  20276. t["f*"] = {
  20277. id: _util.OPS.eoFill,
  20278. numArgs: 0,
  20279. variableArgs: false
  20280. };
  20281. t.B = {
  20282. id: _util.OPS.fillStroke,
  20283. numArgs: 0,
  20284. variableArgs: false
  20285. };
  20286. t["B*"] = {
  20287. id: _util.OPS.eoFillStroke,
  20288. numArgs: 0,
  20289. variableArgs: false
  20290. };
  20291. t.b = {
  20292. id: _util.OPS.closeFillStroke,
  20293. numArgs: 0,
  20294. variableArgs: false
  20295. };
  20296. t["b*"] = {
  20297. id: _util.OPS.closeEOFillStroke,
  20298. numArgs: 0,
  20299. variableArgs: false
  20300. };
  20301. t.n = {
  20302. id: _util.OPS.endPath,
  20303. numArgs: 0,
  20304. variableArgs: false
  20305. };
  20306. t.W = {
  20307. id: _util.OPS.clip,
  20308. numArgs: 0,
  20309. variableArgs: false
  20310. };
  20311. t["W*"] = {
  20312. id: _util.OPS.eoClip,
  20313. numArgs: 0,
  20314. variableArgs: false
  20315. };
  20316. t.BT = {
  20317. id: _util.OPS.beginText,
  20318. numArgs: 0,
  20319. variableArgs: false
  20320. };
  20321. t.ET = {
  20322. id: _util.OPS.endText,
  20323. numArgs: 0,
  20324. variableArgs: false
  20325. };
  20326. t.Tc = {
  20327. id: _util.OPS.setCharSpacing,
  20328. numArgs: 1,
  20329. variableArgs: false
  20330. };
  20331. t.Tw = {
  20332. id: _util.OPS.setWordSpacing,
  20333. numArgs: 1,
  20334. variableArgs: false
  20335. };
  20336. t.Tz = {
  20337. id: _util.OPS.setHScale,
  20338. numArgs: 1,
  20339. variableArgs: false
  20340. };
  20341. t.TL = {
  20342. id: _util.OPS.setLeading,
  20343. numArgs: 1,
  20344. variableArgs: false
  20345. };
  20346. t.Tf = {
  20347. id: _util.OPS.setFont,
  20348. numArgs: 2,
  20349. variableArgs: false
  20350. };
  20351. t.Tr = {
  20352. id: _util.OPS.setTextRenderingMode,
  20353. numArgs: 1,
  20354. variableArgs: false
  20355. };
  20356. t.Ts = {
  20357. id: _util.OPS.setTextRise,
  20358. numArgs: 1,
  20359. variableArgs: false
  20360. };
  20361. t.Td = {
  20362. id: _util.OPS.moveText,
  20363. numArgs: 2,
  20364. variableArgs: false
  20365. };
  20366. t.TD = {
  20367. id: _util.OPS.setLeadingMoveText,
  20368. numArgs: 2,
  20369. variableArgs: false
  20370. };
  20371. t.Tm = {
  20372. id: _util.OPS.setTextMatrix,
  20373. numArgs: 6,
  20374. variableArgs: false
  20375. };
  20376. t["T*"] = {
  20377. id: _util.OPS.nextLine,
  20378. numArgs: 0,
  20379. variableArgs: false
  20380. };
  20381. t.Tj = {
  20382. id: _util.OPS.showText,
  20383. numArgs: 1,
  20384. variableArgs: false
  20385. };
  20386. t.TJ = {
  20387. id: _util.OPS.showSpacedText,
  20388. numArgs: 1,
  20389. variableArgs: false
  20390. };
  20391. t["'"] = {
  20392. id: _util.OPS.nextLineShowText,
  20393. numArgs: 1,
  20394. variableArgs: false
  20395. };
  20396. t['"'] = {
  20397. id: _util.OPS.nextLineSetSpacingShowText,
  20398. numArgs: 3,
  20399. variableArgs: false
  20400. };
  20401. t.d0 = {
  20402. id: _util.OPS.setCharWidth,
  20403. numArgs: 2,
  20404. variableArgs: false
  20405. };
  20406. t.d1 = {
  20407. id: _util.OPS.setCharWidthAndBounds,
  20408. numArgs: 6,
  20409. variableArgs: false
  20410. };
  20411. t.CS = {
  20412. id: _util.OPS.setStrokeColorSpace,
  20413. numArgs: 1,
  20414. variableArgs: false
  20415. };
  20416. t.cs = {
  20417. id: _util.OPS.setFillColorSpace,
  20418. numArgs: 1,
  20419. variableArgs: false
  20420. };
  20421. t.SC = {
  20422. id: _util.OPS.setStrokeColor,
  20423. numArgs: 4,
  20424. variableArgs: true
  20425. };
  20426. t.SCN = {
  20427. id: _util.OPS.setStrokeColorN,
  20428. numArgs: 33,
  20429. variableArgs: true
  20430. };
  20431. t.sc = {
  20432. id: _util.OPS.setFillColor,
  20433. numArgs: 4,
  20434. variableArgs: true
  20435. };
  20436. t.scn = {
  20437. id: _util.OPS.setFillColorN,
  20438. numArgs: 33,
  20439. variableArgs: true
  20440. };
  20441. t.G = {
  20442. id: _util.OPS.setStrokeGray,
  20443. numArgs: 1,
  20444. variableArgs: false
  20445. };
  20446. t.g = {
  20447. id: _util.OPS.setFillGray,
  20448. numArgs: 1,
  20449. variableArgs: false
  20450. };
  20451. t.RG = {
  20452. id: _util.OPS.setStrokeRGBColor,
  20453. numArgs: 3,
  20454. variableArgs: false
  20455. };
  20456. t.rg = {
  20457. id: _util.OPS.setFillRGBColor,
  20458. numArgs: 3,
  20459. variableArgs: false
  20460. };
  20461. t.K = {
  20462. id: _util.OPS.setStrokeCMYKColor,
  20463. numArgs: 4,
  20464. variableArgs: false
  20465. };
  20466. t.k = {
  20467. id: _util.OPS.setFillCMYKColor,
  20468. numArgs: 4,
  20469. variableArgs: false
  20470. };
  20471. t.sh = {
  20472. id: _util.OPS.shadingFill,
  20473. numArgs: 1,
  20474. variableArgs: false
  20475. };
  20476. t.BI = {
  20477. id: _util.OPS.beginInlineImage,
  20478. numArgs: 0,
  20479. variableArgs: false
  20480. };
  20481. t.ID = {
  20482. id: _util.OPS.beginImageData,
  20483. numArgs: 0,
  20484. variableArgs: false
  20485. };
  20486. t.EI = {
  20487. id: _util.OPS.endInlineImage,
  20488. numArgs: 1,
  20489. variableArgs: false
  20490. };
  20491. t.Do = {
  20492. id: _util.OPS.paintXObject,
  20493. numArgs: 1,
  20494. variableArgs: false
  20495. };
  20496. t.MP = {
  20497. id: _util.OPS.markPoint,
  20498. numArgs: 1,
  20499. variableArgs: false
  20500. };
  20501. t.DP = {
  20502. id: _util.OPS.markPointProps,
  20503. numArgs: 2,
  20504. variableArgs: false
  20505. };
  20506. t.BMC = {
  20507. id: _util.OPS.beginMarkedContent,
  20508. numArgs: 1,
  20509. variableArgs: false
  20510. };
  20511. t.BDC = {
  20512. id: _util.OPS.beginMarkedContentProps,
  20513. numArgs: 2,
  20514. variableArgs: false
  20515. };
  20516. t.EMC = {
  20517. id: _util.OPS.endMarkedContent,
  20518. numArgs: 0,
  20519. variableArgs: false
  20520. };
  20521. t.BX = {
  20522. id: _util.OPS.beginCompat,
  20523. numArgs: 0,
  20524. variableArgs: false
  20525. };
  20526. t.EX = {
  20527. id: _util.OPS.endCompat,
  20528. numArgs: 0,
  20529. variableArgs: false
  20530. };
  20531. t.BM = null;
  20532. t.BD = null;
  20533. t.true = null;
  20534. t.fa = null;
  20535. t.fal = null;
  20536. t.fals = null;
  20537. t.false = null;
  20538. t.nu = null;
  20539. t.nul = null;
  20540. t.null = null;
  20541. });
  20542. return (0, _util.shadow)(this, "opMap", getOPMap());
  20543. }
  20544. static get MAX_INVALID_PATH_OPS() {
  20545. return (0, _util.shadow)(this, "MAX_INVALID_PATH_OPS", 20);
  20546. }
  20547. constructor(stream, xref, stateManager = new StateManager()) {
  20548. this.parser = new _parser.Parser({
  20549. lexer: new _parser.Lexer(stream, EvaluatorPreprocessor.opMap),
  20550. xref
  20551. });
  20552. this.stateManager = stateManager;
  20553. this.nonProcessedArgs = [];
  20554. this._numInvalidPathOPS = 0;
  20555. }
  20556. get savedStatesDepth() {
  20557. return this.stateManager.stateStack.length;
  20558. }
  20559. read(operation) {
  20560. var args = operation.args;
  20561. while (true) {
  20562. var obj = this.parser.getObj();
  20563. if (obj instanceof _primitives.Cmd) {
  20564. var cmd = obj.cmd;
  20565. var opSpec = EvaluatorPreprocessor.opMap[cmd];
  20566. if (!opSpec) {
  20567. (0, _util.warn)(`Unknown command "${cmd}".`);
  20568. continue;
  20569. }
  20570. var fn = opSpec.id;
  20571. var numArgs = opSpec.numArgs;
  20572. var argsLength = args !== null ? args.length : 0;
  20573. if (!opSpec.variableArgs) {
  20574. if (argsLength !== numArgs) {
  20575. var nonProcessedArgs = this.nonProcessedArgs;
  20576. while (argsLength > numArgs) {
  20577. nonProcessedArgs.push(args.shift());
  20578. argsLength--;
  20579. }
  20580. while (argsLength < numArgs && nonProcessedArgs.length !== 0) {
  20581. if (args === null) {
  20582. args = [];
  20583. }
  20584. args.unshift(nonProcessedArgs.pop());
  20585. argsLength++;
  20586. }
  20587. }
  20588. if (argsLength < numArgs) {
  20589. const partialMsg = `command ${cmd}: expected ${numArgs} args, ` + `but received ${argsLength} args.`;
  20590. if (fn >= _util.OPS.moveTo && fn <= _util.OPS.endPath && ++this._numInvalidPathOPS > EvaluatorPreprocessor.MAX_INVALID_PATH_OPS) {
  20591. throw new _util.FormatError(`Invalid ${partialMsg}`);
  20592. }
  20593. (0, _util.warn)(`Skipping ${partialMsg}`);
  20594. if (args !== null) {
  20595. args.length = 0;
  20596. }
  20597. continue;
  20598. }
  20599. } else if (argsLength > numArgs) {
  20600. (0, _util.info)(`Command ${cmd}: expected [0, ${numArgs}] args, ` + `but received ${argsLength} args.`);
  20601. }
  20602. this.preprocessCommand(fn, args);
  20603. operation.fn = fn;
  20604. operation.args = args;
  20605. return true;
  20606. }
  20607. if (obj === _primitives.EOF) {
  20608. return false;
  20609. }
  20610. if (obj !== null) {
  20611. if (args === null) {
  20612. args = [];
  20613. }
  20614. args.push(obj);
  20615. if (args.length > 33) {
  20616. throw new _util.FormatError("Too many arguments");
  20617. }
  20618. }
  20619. }
  20620. }
  20621. preprocessCommand(fn, args) {
  20622. switch (fn | 0) {
  20623. case _util.OPS.save:
  20624. this.stateManager.save();
  20625. break;
  20626. case _util.OPS.restore:
  20627. this.stateManager.restore();
  20628. break;
  20629. case _util.OPS.transform:
  20630. this.stateManager.transform(args);
  20631. break;
  20632. }
  20633. }
  20634. }
  20635. exports.EvaluatorPreprocessor = EvaluatorPreprocessor;
  20636. /***/ }),
  20637. /* 28 */
  20638. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  20639. Object.defineProperty(exports, "__esModule", ({
  20640. value: true
  20641. }));
  20642. exports.IdentityCMap = exports.CMapFactory = exports.CMap = void 0;
  20643. var _util = __w_pdfjs_require__(2);
  20644. var _primitives = __w_pdfjs_require__(5);
  20645. var _parser = __w_pdfjs_require__(11);
  20646. var _core_utils = __w_pdfjs_require__(8);
  20647. var _stream = __w_pdfjs_require__(12);
  20648. var BUILT_IN_CMAPS = ["Adobe-GB1-UCS2", "Adobe-CNS1-UCS2", "Adobe-Japan1-UCS2", "Adobe-Korea1-UCS2", "78-EUC-H", "78-EUC-V", "78-H", "78-RKSJ-H", "78-RKSJ-V", "78-V", "78ms-RKSJ-H", "78ms-RKSJ-V", "83pv-RKSJ-H", "90ms-RKSJ-H", "90ms-RKSJ-V", "90msp-RKSJ-H", "90msp-RKSJ-V", "90pv-RKSJ-H", "90pv-RKSJ-V", "Add-H", "Add-RKSJ-H", "Add-RKSJ-V", "Add-V", "Adobe-CNS1-0", "Adobe-CNS1-1", "Adobe-CNS1-2", "Adobe-CNS1-3", "Adobe-CNS1-4", "Adobe-CNS1-5", "Adobe-CNS1-6", "Adobe-GB1-0", "Adobe-GB1-1", "Adobe-GB1-2", "Adobe-GB1-3", "Adobe-GB1-4", "Adobe-GB1-5", "Adobe-Japan1-0", "Adobe-Japan1-1", "Adobe-Japan1-2", "Adobe-Japan1-3", "Adobe-Japan1-4", "Adobe-Japan1-5", "Adobe-Japan1-6", "Adobe-Korea1-0", "Adobe-Korea1-1", "Adobe-Korea1-2", "B5-H", "B5-V", "B5pc-H", "B5pc-V", "CNS-EUC-H", "CNS-EUC-V", "CNS1-H", "CNS1-V", "CNS2-H", "CNS2-V", "ETHK-B5-H", "ETHK-B5-V", "ETen-B5-H", "ETen-B5-V", "ETenms-B5-H", "ETenms-B5-V", "EUC-H", "EUC-V", "Ext-H", "Ext-RKSJ-H", "Ext-RKSJ-V", "Ext-V", "GB-EUC-H", "GB-EUC-V", "GB-H", "GB-V", "GBK-EUC-H", "GBK-EUC-V", "GBK2K-H", "GBK2K-V", "GBKp-EUC-H", "GBKp-EUC-V", "GBT-EUC-H", "GBT-EUC-V", "GBT-H", "GBT-V", "GBTpc-EUC-H", "GBTpc-EUC-V", "GBpc-EUC-H", "GBpc-EUC-V", "H", "HKdla-B5-H", "HKdla-B5-V", "HKdlb-B5-H", "HKdlb-B5-V", "HKgccs-B5-H", "HKgccs-B5-V", "HKm314-B5-H", "HKm314-B5-V", "HKm471-B5-H", "HKm471-B5-V", "HKscs-B5-H", "HKscs-B5-V", "Hankaku", "Hiragana", "KSC-EUC-H", "KSC-EUC-V", "KSC-H", "KSC-Johab-H", "KSC-Johab-V", "KSC-V", "KSCms-UHC-H", "KSCms-UHC-HW-H", "KSCms-UHC-HW-V", "KSCms-UHC-V", "KSCpc-EUC-H", "KSCpc-EUC-V", "Katakana", "NWP-H", "NWP-V", "RKSJ-H", "RKSJ-V", "Roman", "UniCNS-UCS2-H", "UniCNS-UCS2-V", "UniCNS-UTF16-H", "UniCNS-UTF16-V", "UniCNS-UTF32-H", "UniCNS-UTF32-V", "UniCNS-UTF8-H", "UniCNS-UTF8-V", "UniGB-UCS2-H", "UniGB-UCS2-V", "UniGB-UTF16-H", "UniGB-UTF16-V", "UniGB-UTF32-H", "UniGB-UTF32-V", "UniGB-UTF8-H", "UniGB-UTF8-V", "UniJIS-UCS2-H", "UniJIS-UCS2-HW-H", "UniJIS-UCS2-HW-V", "UniJIS-UCS2-V", "UniJIS-UTF16-H", "UniJIS-UTF16-V", "UniJIS-UTF32-H", "UniJIS-UTF32-V", "UniJIS-UTF8-H", "UniJIS-UTF8-V", "UniJIS2004-UTF16-H", "UniJIS2004-UTF16-V", "UniJIS2004-UTF32-H", "UniJIS2004-UTF32-V", "UniJIS2004-UTF8-H", "UniJIS2004-UTF8-V", "UniJISPro-UCS2-HW-V", "UniJISPro-UCS2-V", "UniJISPro-UTF8-V", "UniJISX0213-UTF32-H", "UniJISX0213-UTF32-V", "UniJISX02132004-UTF32-H", "UniJISX02132004-UTF32-V", "UniKS-UCS2-H", "UniKS-UCS2-V", "UniKS-UTF16-H", "UniKS-UTF16-V", "UniKS-UTF32-H", "UniKS-UTF32-V", "UniKS-UTF8-H", "UniKS-UTF8-V", "V", "WP-Symbol"];
  20649. const MAX_MAP_RANGE = 2 ** 24 - 1;
  20650. class CMap {
  20651. constructor(builtInCMap = false) {
  20652. this.codespaceRanges = [[], [], [], []];
  20653. this.numCodespaceRanges = 0;
  20654. this._map = [];
  20655. this.name = "";
  20656. this.vertical = false;
  20657. this.useCMap = null;
  20658. this.builtInCMap = builtInCMap;
  20659. }
  20660. addCodespaceRange(n, low, high) {
  20661. this.codespaceRanges[n - 1].push(low, high);
  20662. this.numCodespaceRanges++;
  20663. }
  20664. mapCidRange(low, high, dstLow) {
  20665. if (high - low > MAX_MAP_RANGE) {
  20666. throw new Error("mapCidRange - ignoring data above MAX_MAP_RANGE.");
  20667. }
  20668. while (low <= high) {
  20669. this._map[low++] = dstLow++;
  20670. }
  20671. }
  20672. mapBfRange(low, high, dstLow) {
  20673. if (high - low > MAX_MAP_RANGE) {
  20674. throw new Error("mapBfRange - ignoring data above MAX_MAP_RANGE.");
  20675. }
  20676. var lastByte = dstLow.length - 1;
  20677. while (low <= high) {
  20678. this._map[low++] = dstLow;
  20679. dstLow = dstLow.substring(0, lastByte) + String.fromCharCode(dstLow.charCodeAt(lastByte) + 1);
  20680. }
  20681. }
  20682. mapBfRangeToArray(low, high, array) {
  20683. if (high - low > MAX_MAP_RANGE) {
  20684. throw new Error("mapBfRangeToArray - ignoring data above MAX_MAP_RANGE.");
  20685. }
  20686. const ii = array.length;
  20687. let i = 0;
  20688. while (low <= high && i < ii) {
  20689. this._map[low] = array[i++];
  20690. ++low;
  20691. }
  20692. }
  20693. mapOne(src, dst) {
  20694. this._map[src] = dst;
  20695. }
  20696. lookup(code) {
  20697. return this._map[code];
  20698. }
  20699. contains(code) {
  20700. return this._map[code] !== undefined;
  20701. }
  20702. forEach(callback) {
  20703. const map = this._map;
  20704. const length = map.length;
  20705. if (length <= 0x10000) {
  20706. for (let i = 0; i < length; i++) {
  20707. if (map[i] !== undefined) {
  20708. callback(i, map[i]);
  20709. }
  20710. }
  20711. } else {
  20712. for (const i in map) {
  20713. callback(i, map[i]);
  20714. }
  20715. }
  20716. }
  20717. charCodeOf(value) {
  20718. const map = this._map;
  20719. if (map.length <= 0x10000) {
  20720. return map.indexOf(value);
  20721. }
  20722. for (const charCode in map) {
  20723. if (map[charCode] === value) {
  20724. return charCode | 0;
  20725. }
  20726. }
  20727. return -1;
  20728. }
  20729. getMap() {
  20730. return this._map;
  20731. }
  20732. readCharCode(str, offset, out) {
  20733. let c = 0;
  20734. const codespaceRanges = this.codespaceRanges;
  20735. for (let n = 0, nn = codespaceRanges.length; n < nn; n++) {
  20736. c = (c << 8 | str.charCodeAt(offset + n)) >>> 0;
  20737. const codespaceRange = codespaceRanges[n];
  20738. for (let k = 0, kk = codespaceRange.length; k < kk;) {
  20739. const low = codespaceRange[k++];
  20740. const high = codespaceRange[k++];
  20741. if (c >= low && c <= high) {
  20742. out.charcode = c;
  20743. out.length = n + 1;
  20744. return;
  20745. }
  20746. }
  20747. }
  20748. out.charcode = 0;
  20749. out.length = 1;
  20750. }
  20751. getCharCodeLength(charCode) {
  20752. const codespaceRanges = this.codespaceRanges;
  20753. for (let n = 0, nn = codespaceRanges.length; n < nn; n++) {
  20754. const codespaceRange = codespaceRanges[n];
  20755. for (let k = 0, kk = codespaceRange.length; k < kk;) {
  20756. const low = codespaceRange[k++];
  20757. const high = codespaceRange[k++];
  20758. if (charCode >= low && charCode <= high) {
  20759. return n + 1;
  20760. }
  20761. }
  20762. }
  20763. return 1;
  20764. }
  20765. get length() {
  20766. return this._map.length;
  20767. }
  20768. get isIdentityCMap() {
  20769. if (!(this.name === "Identity-H" || this.name === "Identity-V")) {
  20770. return false;
  20771. }
  20772. if (this._map.length !== 0x10000) {
  20773. return false;
  20774. }
  20775. for (let i = 0; i < 0x10000; i++) {
  20776. if (this._map[i] !== i) {
  20777. return false;
  20778. }
  20779. }
  20780. return true;
  20781. }
  20782. }
  20783. exports.CMap = CMap;
  20784. class IdentityCMap extends CMap {
  20785. constructor(vertical, n) {
  20786. super();
  20787. this.vertical = vertical;
  20788. this.addCodespaceRange(n, 0, 0xffff);
  20789. }
  20790. mapCidRange(low, high, dstLow) {
  20791. (0, _util.unreachable)("should not call mapCidRange");
  20792. }
  20793. mapBfRange(low, high, dstLow) {
  20794. (0, _util.unreachable)("should not call mapBfRange");
  20795. }
  20796. mapBfRangeToArray(low, high, array) {
  20797. (0, _util.unreachable)("should not call mapBfRangeToArray");
  20798. }
  20799. mapOne(src, dst) {
  20800. (0, _util.unreachable)("should not call mapCidOne");
  20801. }
  20802. lookup(code) {
  20803. return Number.isInteger(code) && code <= 0xffff ? code : undefined;
  20804. }
  20805. contains(code) {
  20806. return Number.isInteger(code) && code <= 0xffff;
  20807. }
  20808. forEach(callback) {
  20809. for (let i = 0; i <= 0xffff; i++) {
  20810. callback(i, i);
  20811. }
  20812. }
  20813. charCodeOf(value) {
  20814. return Number.isInteger(value) && value <= 0xffff ? value : -1;
  20815. }
  20816. getMap() {
  20817. const map = new Array(0x10000);
  20818. for (let i = 0; i <= 0xffff; i++) {
  20819. map[i] = i;
  20820. }
  20821. return map;
  20822. }
  20823. get length() {
  20824. return 0x10000;
  20825. }
  20826. get isIdentityCMap() {
  20827. (0, _util.unreachable)("should not access .isIdentityCMap");
  20828. }
  20829. }
  20830. exports.IdentityCMap = IdentityCMap;
  20831. var BinaryCMapReader = function BinaryCMapReaderClosure() {
  20832. function hexToInt(a, size) {
  20833. var n = 0;
  20834. for (var i = 0; i <= size; i++) {
  20835. n = n << 8 | a[i];
  20836. }
  20837. return n >>> 0;
  20838. }
  20839. function hexToStr(a, size) {
  20840. if (size === 1) {
  20841. return String.fromCharCode(a[0], a[1]);
  20842. }
  20843. if (size === 3) {
  20844. return String.fromCharCode(a[0], a[1], a[2], a[3]);
  20845. }
  20846. return String.fromCharCode.apply(null, a.subarray(0, size + 1));
  20847. }
  20848. function addHex(a, b, size) {
  20849. var c = 0;
  20850. for (var i = size; i >= 0; i--) {
  20851. c += a[i] + b[i];
  20852. a[i] = c & 255;
  20853. c >>= 8;
  20854. }
  20855. }
  20856. function incHex(a, size) {
  20857. var c = 1;
  20858. for (var i = size; i >= 0 && c > 0; i--) {
  20859. c += a[i];
  20860. a[i] = c & 255;
  20861. c >>= 8;
  20862. }
  20863. }
  20864. var MAX_NUM_SIZE = 16;
  20865. var MAX_ENCODED_NUM_SIZE = 19;
  20866. function BinaryCMapStream(data) {
  20867. this.buffer = data;
  20868. this.pos = 0;
  20869. this.end = data.length;
  20870. this.tmpBuf = new Uint8Array(MAX_ENCODED_NUM_SIZE);
  20871. }
  20872. BinaryCMapStream.prototype = {
  20873. readByte() {
  20874. if (this.pos >= this.end) {
  20875. return -1;
  20876. }
  20877. return this.buffer[this.pos++];
  20878. },
  20879. readNumber() {
  20880. var n = 0;
  20881. var last;
  20882. do {
  20883. var b = this.readByte();
  20884. if (b < 0) {
  20885. throw new _util.FormatError("unexpected EOF in bcmap");
  20886. }
  20887. last = !(b & 0x80);
  20888. n = n << 7 | b & 0x7f;
  20889. } while (!last);
  20890. return n;
  20891. },
  20892. readSigned() {
  20893. var n = this.readNumber();
  20894. return n & 1 ? ~(n >>> 1) : n >>> 1;
  20895. },
  20896. readHex(num, size) {
  20897. num.set(this.buffer.subarray(this.pos, this.pos + size + 1));
  20898. this.pos += size + 1;
  20899. },
  20900. readHexNumber(num, size) {
  20901. var last;
  20902. var stack = this.tmpBuf,
  20903. sp = 0;
  20904. do {
  20905. var b = this.readByte();
  20906. if (b < 0) {
  20907. throw new _util.FormatError("unexpected EOF in bcmap");
  20908. }
  20909. last = !(b & 0x80);
  20910. stack[sp++] = b & 0x7f;
  20911. } while (!last);
  20912. var i = size,
  20913. buffer = 0,
  20914. bufferSize = 0;
  20915. while (i >= 0) {
  20916. while (bufferSize < 8 && stack.length > 0) {
  20917. buffer = stack[--sp] << bufferSize | buffer;
  20918. bufferSize += 7;
  20919. }
  20920. num[i] = buffer & 255;
  20921. i--;
  20922. buffer >>= 8;
  20923. bufferSize -= 8;
  20924. }
  20925. },
  20926. readHexSigned(num, size) {
  20927. this.readHexNumber(num, size);
  20928. var sign = num[size] & 1 ? 255 : 0;
  20929. var c = 0;
  20930. for (var i = 0; i <= size; i++) {
  20931. c = (c & 1) << 8 | num[i];
  20932. num[i] = c >> 1 ^ sign;
  20933. }
  20934. },
  20935. readString() {
  20936. var len = this.readNumber();
  20937. var s = "";
  20938. for (var i = 0; i < len; i++) {
  20939. s += String.fromCharCode(this.readNumber());
  20940. }
  20941. return s;
  20942. }
  20943. };
  20944. function processBinaryCMap(data, cMap, extend) {
  20945. return new Promise(function (resolve, reject) {
  20946. var stream = new BinaryCMapStream(data);
  20947. var header = stream.readByte();
  20948. cMap.vertical = !!(header & 1);
  20949. var useCMap = null;
  20950. var start = new Uint8Array(MAX_NUM_SIZE);
  20951. var end = new Uint8Array(MAX_NUM_SIZE);
  20952. var char = new Uint8Array(MAX_NUM_SIZE);
  20953. var charCode = new Uint8Array(MAX_NUM_SIZE);
  20954. var tmp = new Uint8Array(MAX_NUM_SIZE);
  20955. var code;
  20956. var b;
  20957. while ((b = stream.readByte()) >= 0) {
  20958. var type = b >> 5;
  20959. if (type === 7) {
  20960. switch (b & 0x1f) {
  20961. case 0:
  20962. stream.readString();
  20963. break;
  20964. case 1:
  20965. useCMap = stream.readString();
  20966. break;
  20967. }
  20968. continue;
  20969. }
  20970. var sequence = !!(b & 0x10);
  20971. var dataSize = b & 15;
  20972. if (dataSize + 1 > MAX_NUM_SIZE) {
  20973. throw new Error("processBinaryCMap: Invalid dataSize.");
  20974. }
  20975. var ucs2DataSize = 1;
  20976. var subitemsCount = stream.readNumber();
  20977. var i;
  20978. switch (type) {
  20979. case 0:
  20980. stream.readHex(start, dataSize);
  20981. stream.readHexNumber(end, dataSize);
  20982. addHex(end, start, dataSize);
  20983. cMap.addCodespaceRange(dataSize + 1, hexToInt(start, dataSize), hexToInt(end, dataSize));
  20984. for (i = 1; i < subitemsCount; i++) {
  20985. incHex(end, dataSize);
  20986. stream.readHexNumber(start, dataSize);
  20987. addHex(start, end, dataSize);
  20988. stream.readHexNumber(end, dataSize);
  20989. addHex(end, start, dataSize);
  20990. cMap.addCodespaceRange(dataSize + 1, hexToInt(start, dataSize), hexToInt(end, dataSize));
  20991. }
  20992. break;
  20993. case 1:
  20994. stream.readHex(start, dataSize);
  20995. stream.readHexNumber(end, dataSize);
  20996. addHex(end, start, dataSize);
  20997. stream.readNumber();
  20998. for (i = 1; i < subitemsCount; i++) {
  20999. incHex(end, dataSize);
  21000. stream.readHexNumber(start, dataSize);
  21001. addHex(start, end, dataSize);
  21002. stream.readHexNumber(end, dataSize);
  21003. addHex(end, start, dataSize);
  21004. stream.readNumber();
  21005. }
  21006. break;
  21007. case 2:
  21008. stream.readHex(char, dataSize);
  21009. code = stream.readNumber();
  21010. cMap.mapOne(hexToInt(char, dataSize), code);
  21011. for (i = 1; i < subitemsCount; i++) {
  21012. incHex(char, dataSize);
  21013. if (!sequence) {
  21014. stream.readHexNumber(tmp, dataSize);
  21015. addHex(char, tmp, dataSize);
  21016. }
  21017. code = stream.readSigned() + (code + 1);
  21018. cMap.mapOne(hexToInt(char, dataSize), code);
  21019. }
  21020. break;
  21021. case 3:
  21022. stream.readHex(start, dataSize);
  21023. stream.readHexNumber(end, dataSize);
  21024. addHex(end, start, dataSize);
  21025. code = stream.readNumber();
  21026. cMap.mapCidRange(hexToInt(start, dataSize), hexToInt(end, dataSize), code);
  21027. for (i = 1; i < subitemsCount; i++) {
  21028. incHex(end, dataSize);
  21029. if (!sequence) {
  21030. stream.readHexNumber(start, dataSize);
  21031. addHex(start, end, dataSize);
  21032. } else {
  21033. start.set(end);
  21034. }
  21035. stream.readHexNumber(end, dataSize);
  21036. addHex(end, start, dataSize);
  21037. code = stream.readNumber();
  21038. cMap.mapCidRange(hexToInt(start, dataSize), hexToInt(end, dataSize), code);
  21039. }
  21040. break;
  21041. case 4:
  21042. stream.readHex(char, ucs2DataSize);
  21043. stream.readHex(charCode, dataSize);
  21044. cMap.mapOne(hexToInt(char, ucs2DataSize), hexToStr(charCode, dataSize));
  21045. for (i = 1; i < subitemsCount; i++) {
  21046. incHex(char, ucs2DataSize);
  21047. if (!sequence) {
  21048. stream.readHexNumber(tmp, ucs2DataSize);
  21049. addHex(char, tmp, ucs2DataSize);
  21050. }
  21051. incHex(charCode, dataSize);
  21052. stream.readHexSigned(tmp, dataSize);
  21053. addHex(charCode, tmp, dataSize);
  21054. cMap.mapOne(hexToInt(char, ucs2DataSize), hexToStr(charCode, dataSize));
  21055. }
  21056. break;
  21057. case 5:
  21058. stream.readHex(start, ucs2DataSize);
  21059. stream.readHexNumber(end, ucs2DataSize);
  21060. addHex(end, start, ucs2DataSize);
  21061. stream.readHex(charCode, dataSize);
  21062. cMap.mapBfRange(hexToInt(start, ucs2DataSize), hexToInt(end, ucs2DataSize), hexToStr(charCode, dataSize));
  21063. for (i = 1; i < subitemsCount; i++) {
  21064. incHex(end, ucs2DataSize);
  21065. if (!sequence) {
  21066. stream.readHexNumber(start, ucs2DataSize);
  21067. addHex(start, end, ucs2DataSize);
  21068. } else {
  21069. start.set(end);
  21070. }
  21071. stream.readHexNumber(end, ucs2DataSize);
  21072. addHex(end, start, ucs2DataSize);
  21073. stream.readHex(charCode, dataSize);
  21074. cMap.mapBfRange(hexToInt(start, ucs2DataSize), hexToInt(end, ucs2DataSize), hexToStr(charCode, dataSize));
  21075. }
  21076. break;
  21077. default:
  21078. reject(new Error("processBinaryCMap: Unknown type: " + type));
  21079. return;
  21080. }
  21081. }
  21082. if (useCMap) {
  21083. resolve(extend(useCMap));
  21084. return;
  21085. }
  21086. resolve(cMap);
  21087. });
  21088. }
  21089. function BinaryCMapReader() {}
  21090. BinaryCMapReader.prototype = {
  21091. process: processBinaryCMap
  21092. };
  21093. return BinaryCMapReader;
  21094. }();
  21095. var CMapFactory = function CMapFactoryClosure() {
  21096. function strToInt(str) {
  21097. var a = 0;
  21098. for (var i = 0; i < str.length; i++) {
  21099. a = a << 8 | str.charCodeAt(i);
  21100. }
  21101. return a >>> 0;
  21102. }
  21103. function expectString(obj) {
  21104. if (!(0, _util.isString)(obj)) {
  21105. throw new _util.FormatError("Malformed CMap: expected string.");
  21106. }
  21107. }
  21108. function expectInt(obj) {
  21109. if (!Number.isInteger(obj)) {
  21110. throw new _util.FormatError("Malformed CMap: expected int.");
  21111. }
  21112. }
  21113. function parseBfChar(cMap, lexer) {
  21114. while (true) {
  21115. var obj = lexer.getObj();
  21116. if ((0, _primitives.isEOF)(obj)) {
  21117. break;
  21118. }
  21119. if ((0, _primitives.isCmd)(obj, "endbfchar")) {
  21120. return;
  21121. }
  21122. expectString(obj);
  21123. var src = strToInt(obj);
  21124. obj = lexer.getObj();
  21125. expectString(obj);
  21126. var dst = obj;
  21127. cMap.mapOne(src, dst);
  21128. }
  21129. }
  21130. function parseBfRange(cMap, lexer) {
  21131. while (true) {
  21132. var obj = lexer.getObj();
  21133. if ((0, _primitives.isEOF)(obj)) {
  21134. break;
  21135. }
  21136. if ((0, _primitives.isCmd)(obj, "endbfrange")) {
  21137. return;
  21138. }
  21139. expectString(obj);
  21140. var low = strToInt(obj);
  21141. obj = lexer.getObj();
  21142. expectString(obj);
  21143. var high = strToInt(obj);
  21144. obj = lexer.getObj();
  21145. if (Number.isInteger(obj) || (0, _util.isString)(obj)) {
  21146. var dstLow = Number.isInteger(obj) ? String.fromCharCode(obj) : obj;
  21147. cMap.mapBfRange(low, high, dstLow);
  21148. } else if ((0, _primitives.isCmd)(obj, "[")) {
  21149. obj = lexer.getObj();
  21150. var array = [];
  21151. while (!(0, _primitives.isCmd)(obj, "]") && !(0, _primitives.isEOF)(obj)) {
  21152. array.push(obj);
  21153. obj = lexer.getObj();
  21154. }
  21155. cMap.mapBfRangeToArray(low, high, array);
  21156. } else {
  21157. break;
  21158. }
  21159. }
  21160. throw new _util.FormatError("Invalid bf range.");
  21161. }
  21162. function parseCidChar(cMap, lexer) {
  21163. while (true) {
  21164. var obj = lexer.getObj();
  21165. if ((0, _primitives.isEOF)(obj)) {
  21166. break;
  21167. }
  21168. if ((0, _primitives.isCmd)(obj, "endcidchar")) {
  21169. return;
  21170. }
  21171. expectString(obj);
  21172. var src = strToInt(obj);
  21173. obj = lexer.getObj();
  21174. expectInt(obj);
  21175. var dst = obj;
  21176. cMap.mapOne(src, dst);
  21177. }
  21178. }
  21179. function parseCidRange(cMap, lexer) {
  21180. while (true) {
  21181. var obj = lexer.getObj();
  21182. if ((0, _primitives.isEOF)(obj)) {
  21183. break;
  21184. }
  21185. if ((0, _primitives.isCmd)(obj, "endcidrange")) {
  21186. return;
  21187. }
  21188. expectString(obj);
  21189. var low = strToInt(obj);
  21190. obj = lexer.getObj();
  21191. expectString(obj);
  21192. var high = strToInt(obj);
  21193. obj = lexer.getObj();
  21194. expectInt(obj);
  21195. var dstLow = obj;
  21196. cMap.mapCidRange(low, high, dstLow);
  21197. }
  21198. }
  21199. function parseCodespaceRange(cMap, lexer) {
  21200. while (true) {
  21201. var obj = lexer.getObj();
  21202. if ((0, _primitives.isEOF)(obj)) {
  21203. break;
  21204. }
  21205. if ((0, _primitives.isCmd)(obj, "endcodespacerange")) {
  21206. return;
  21207. }
  21208. if (!(0, _util.isString)(obj)) {
  21209. break;
  21210. }
  21211. var low = strToInt(obj);
  21212. obj = lexer.getObj();
  21213. if (!(0, _util.isString)(obj)) {
  21214. break;
  21215. }
  21216. var high = strToInt(obj);
  21217. cMap.addCodespaceRange(obj.length, low, high);
  21218. }
  21219. throw new _util.FormatError("Invalid codespace range.");
  21220. }
  21221. function parseWMode(cMap, lexer) {
  21222. var obj = lexer.getObj();
  21223. if (Number.isInteger(obj)) {
  21224. cMap.vertical = !!obj;
  21225. }
  21226. }
  21227. function parseCMapName(cMap, lexer) {
  21228. var obj = lexer.getObj();
  21229. if ((0, _primitives.isName)(obj) && (0, _util.isString)(obj.name)) {
  21230. cMap.name = obj.name;
  21231. }
  21232. }
  21233. function parseCMap(cMap, lexer, fetchBuiltInCMap, useCMap) {
  21234. var previous;
  21235. var embeddedUseCMap;
  21236. objLoop: while (true) {
  21237. try {
  21238. var obj = lexer.getObj();
  21239. if ((0, _primitives.isEOF)(obj)) {
  21240. break;
  21241. } else if ((0, _primitives.isName)(obj)) {
  21242. if (obj.name === "WMode") {
  21243. parseWMode(cMap, lexer);
  21244. } else if (obj.name === "CMapName") {
  21245. parseCMapName(cMap, lexer);
  21246. }
  21247. previous = obj;
  21248. } else if ((0, _primitives.isCmd)(obj)) {
  21249. switch (obj.cmd) {
  21250. case "endcmap":
  21251. break objLoop;
  21252. case "usecmap":
  21253. if ((0, _primitives.isName)(previous)) {
  21254. embeddedUseCMap = previous.name;
  21255. }
  21256. break;
  21257. case "begincodespacerange":
  21258. parseCodespaceRange(cMap, lexer);
  21259. break;
  21260. case "beginbfchar":
  21261. parseBfChar(cMap, lexer);
  21262. break;
  21263. case "begincidchar":
  21264. parseCidChar(cMap, lexer);
  21265. break;
  21266. case "beginbfrange":
  21267. parseBfRange(cMap, lexer);
  21268. break;
  21269. case "begincidrange":
  21270. parseCidRange(cMap, lexer);
  21271. break;
  21272. }
  21273. }
  21274. } catch (ex) {
  21275. if (ex instanceof _core_utils.MissingDataException) {
  21276. throw ex;
  21277. }
  21278. (0, _util.warn)("Invalid cMap data: " + ex);
  21279. continue;
  21280. }
  21281. }
  21282. if (!useCMap && embeddedUseCMap) {
  21283. useCMap = embeddedUseCMap;
  21284. }
  21285. if (useCMap) {
  21286. return extendCMap(cMap, fetchBuiltInCMap, useCMap);
  21287. }
  21288. return Promise.resolve(cMap);
  21289. }
  21290. function extendCMap(cMap, fetchBuiltInCMap, useCMap) {
  21291. return createBuiltInCMap(useCMap, fetchBuiltInCMap).then(function (newCMap) {
  21292. cMap.useCMap = newCMap;
  21293. if (cMap.numCodespaceRanges === 0) {
  21294. var useCodespaceRanges = cMap.useCMap.codespaceRanges;
  21295. for (var i = 0; i < useCodespaceRanges.length; i++) {
  21296. cMap.codespaceRanges[i] = useCodespaceRanges[i].slice();
  21297. }
  21298. cMap.numCodespaceRanges = cMap.useCMap.numCodespaceRanges;
  21299. }
  21300. cMap.useCMap.forEach(function (key, value) {
  21301. if (!cMap.contains(key)) {
  21302. cMap.mapOne(key, cMap.useCMap.lookup(key));
  21303. }
  21304. });
  21305. return cMap;
  21306. });
  21307. }
  21308. function createBuiltInCMap(name, fetchBuiltInCMap) {
  21309. if (name === "Identity-H") {
  21310. return Promise.resolve(new IdentityCMap(false, 2));
  21311. } else if (name === "Identity-V") {
  21312. return Promise.resolve(new IdentityCMap(true, 2));
  21313. }
  21314. if (!BUILT_IN_CMAPS.includes(name)) {
  21315. return Promise.reject(new Error("Unknown CMap name: " + name));
  21316. }
  21317. if (!fetchBuiltInCMap) {
  21318. return Promise.reject(new Error("Built-in CMap parameters are not provided."));
  21319. }
  21320. return fetchBuiltInCMap(name).then(function (data) {
  21321. var cMapData = data.cMapData,
  21322. compressionType = data.compressionType;
  21323. var cMap = new CMap(true);
  21324. if (compressionType === _util.CMapCompressionType.BINARY) {
  21325. return new BinaryCMapReader().process(cMapData, cMap, function (useCMap) {
  21326. return extendCMap(cMap, fetchBuiltInCMap, useCMap);
  21327. });
  21328. }
  21329. if (compressionType === _util.CMapCompressionType.NONE) {
  21330. var lexer = new _parser.Lexer(new _stream.Stream(cMapData));
  21331. return parseCMap(cMap, lexer, fetchBuiltInCMap, null);
  21332. }
  21333. return Promise.reject(new Error("TODO: Only BINARY/NONE CMap compression is currently supported."));
  21334. });
  21335. }
  21336. return {
  21337. async create(params) {
  21338. var encoding = params.encoding;
  21339. var fetchBuiltInCMap = params.fetchBuiltInCMap;
  21340. var useCMap = params.useCMap;
  21341. if ((0, _primitives.isName)(encoding)) {
  21342. return createBuiltInCMap(encoding.name, fetchBuiltInCMap);
  21343. } else if ((0, _primitives.isStream)(encoding)) {
  21344. var cMap = new CMap();
  21345. var lexer = new _parser.Lexer(encoding);
  21346. return parseCMap(cMap, lexer, fetchBuiltInCMap, useCMap).then(function (parsedCMap) {
  21347. if (parsedCMap.isIdentityCMap) {
  21348. return createBuiltInCMap(parsedCMap.name, fetchBuiltInCMap);
  21349. }
  21350. return parsedCMap;
  21351. });
  21352. }
  21353. throw new Error("Encoding required.");
  21354. }
  21355. };
  21356. }();
  21357. exports.CMapFactory = CMapFactory;
  21358. /***/ }),
  21359. /* 29 */
  21360. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  21361. Object.defineProperty(exports, "__esModule", ({
  21362. value: true
  21363. }));
  21364. exports.getFontType = getFontType;
  21365. exports.ToUnicodeMap = exports.SEAC_ANALYSIS_ENABLED = exports.IdentityToUnicodeMap = exports.FontFlags = exports.Font = exports.ErrorFont = void 0;
  21366. var _util = __w_pdfjs_require__(2);
  21367. var _cff_parser = __w_pdfjs_require__(30);
  21368. var _glyphlist = __w_pdfjs_require__(33);
  21369. var _encodings = __w_pdfjs_require__(32);
  21370. var _standard_fonts = __w_pdfjs_require__(34);
  21371. var _unicode = __w_pdfjs_require__(35);
  21372. var _core_utils = __w_pdfjs_require__(8);
  21373. var _font_renderer = __w_pdfjs_require__(36);
  21374. var _cmap = __w_pdfjs_require__(28);
  21375. var _stream = __w_pdfjs_require__(12);
  21376. var _type1_parser = __w_pdfjs_require__(37);
  21377. const PRIVATE_USE_AREAS = [[0xe000, 0xf8ff], [0x100000, 0x10fffd]];
  21378. var PDF_GLYPH_SPACE_UNITS = 1000;
  21379. var SEAC_ANALYSIS_ENABLED = true;
  21380. exports.SEAC_ANALYSIS_ENABLED = SEAC_ANALYSIS_ENABLED;
  21381. const EXPORT_DATA_PROPERTIES = ["ascent", "bbox", "black", "bold", "charProcOperatorList", "composite", "data", "defaultVMetrics", "defaultWidth", "descent", "fallbackName", "fontMatrix", "fontType", "isMonospace", "isSerifFont", "isType3Font", "italic", "loadedName", "mimetype", "missingFile", "name", "remeasure", "subtype", "type", "vertical"];
  21382. const EXPORT_DATA_EXTRA_PROPERTIES = ["cMap", "defaultEncoding", "differences", "isSymbolicFont", "seacMap", "toFontChar", "toUnicode", "vmetrics", "widths"];
  21383. var FontFlags = {
  21384. FixedPitch: 1,
  21385. Serif: 2,
  21386. Symbolic: 4,
  21387. Script: 8,
  21388. Nonsymbolic: 32,
  21389. Italic: 64,
  21390. AllCap: 65536,
  21391. SmallCap: 131072,
  21392. ForceBold: 262144
  21393. };
  21394. exports.FontFlags = FontFlags;
  21395. var MacStandardGlyphOrdering = [".notdef", ".null", "nonmarkingreturn", "space", "exclam", "quotedbl", "numbersign", "dollar", "percent", "ampersand", "quotesingle", "parenleft", "parenright", "asterisk", "plus", "comma", "hyphen", "period", "slash", "zero", "one", "two", "three", "four", "five", "six", "seven", "eight", "nine", "colon", "semicolon", "less", "equal", "greater", "question", "at", "A", "B", "C", "D", "E", "F", "G", "H", "I", "J", "K", "L", "M", "N", "O", "P", "Q", "R", "S", "T", "U", "V", "W", "X", "Y", "Z", "bracketleft", "backslash", "bracketright", "asciicircum", "underscore", "grave", "a", "b", "c", "d", "e", "f", "g", "h", "i", "j", "k", "l", "m", "n", "o", "p", "q", "r", "s", "t", "u", "v", "w", "x", "y", "z", "braceleft", "bar", "braceright", "asciitilde", "Adieresis", "Aring", "Ccedilla", "Eacute", "Ntilde", "Odieresis", "Udieresis", "aacute", "agrave", "acircumflex", "adieresis", "atilde", "aring", "ccedilla", "eacute", "egrave", "ecircumflex", "edieresis", "iacute", "igrave", "icircumflex", "idieresis", "ntilde", "oacute", "ograve", "ocircumflex", "odieresis", "otilde", "uacute", "ugrave", "ucircumflex", "udieresis", "dagger", "degree", "cent", "sterling", "section", "bullet", "paragraph", "germandbls", "registered", "copyright", "trademark", "acute", "dieresis", "notequal", "AE", "Oslash", "infinity", "plusminus", "lessequal", "greaterequal", "yen", "mu", "partialdiff", "summation", "product", "pi", "integral", "ordfeminine", "ordmasculine", "Omega", "ae", "oslash", "questiondown", "exclamdown", "logicalnot", "radical", "florin", "approxequal", "Delta", "guillemotleft", "guillemotright", "ellipsis", "nonbreakingspace", "Agrave", "Atilde", "Otilde", "OE", "oe", "endash", "emdash", "quotedblleft", "quotedblright", "quoteleft", "quoteright", "divide", "lozenge", "ydieresis", "Ydieresis", "fraction", "currency", "guilsinglleft", "guilsinglright", "fi", "fl", "daggerdbl", "periodcentered", "quotesinglbase", "quotedblbase", "perthousand", "Acircumflex", "Ecircumflex", "Aacute", "Edieresis", "Egrave", "Iacute", "Icircumflex", "Idieresis", "Igrave", "Oacute", "Ocircumflex", "apple", "Ograve", "Uacute", "Ucircumflex", "Ugrave", "dotlessi", "circumflex", "tilde", "macron", "breve", "dotaccent", "ring", "cedilla", "hungarumlaut", "ogonek", "caron", "Lslash", "lslash", "Scaron", "scaron", "Zcaron", "zcaron", "brokenbar", "Eth", "eth", "Yacute", "yacute", "Thorn", "thorn", "minus", "multiply", "onesuperior", "twosuperior", "threesuperior", "onehalf", "onequarter", "threequarters", "franc", "Gbreve", "gbreve", "Idotaccent", "Scedilla", "scedilla", "Cacute", "cacute", "Ccaron", "ccaron", "dcroat"];
  21396. function adjustWidths(properties) {
  21397. if (!properties.fontMatrix) {
  21398. return;
  21399. }
  21400. if (properties.fontMatrix[0] === _util.FONT_IDENTITY_MATRIX[0]) {
  21401. return;
  21402. }
  21403. var scale = 0.001 / properties.fontMatrix[0];
  21404. var glyphsWidths = properties.widths;
  21405. for (var glyph in glyphsWidths) {
  21406. glyphsWidths[glyph] *= scale;
  21407. }
  21408. properties.defaultWidth *= scale;
  21409. }
  21410. function adjustToUnicode(properties, builtInEncoding) {
  21411. if (properties.hasIncludedToUnicodeMap) {
  21412. return;
  21413. }
  21414. if (properties.hasEncoding) {
  21415. return;
  21416. }
  21417. if (builtInEncoding === properties.defaultEncoding) {
  21418. return;
  21419. }
  21420. if (properties.toUnicode instanceof IdentityToUnicodeMap) {
  21421. return;
  21422. }
  21423. var toUnicode = [],
  21424. glyphsUnicodeMap = (0, _glyphlist.getGlyphsUnicode)();
  21425. for (var charCode in builtInEncoding) {
  21426. var glyphName = builtInEncoding[charCode];
  21427. var unicode = (0, _unicode.getUnicodeForGlyph)(glyphName, glyphsUnicodeMap);
  21428. if (unicode !== -1) {
  21429. toUnicode[charCode] = String.fromCharCode(unicode);
  21430. }
  21431. }
  21432. properties.toUnicode.amend(toUnicode);
  21433. }
  21434. function getFontType(type, subtype) {
  21435. switch (type) {
  21436. case "Type1":
  21437. return subtype === "Type1C" ? _util.FontType.TYPE1C : _util.FontType.TYPE1;
  21438. case "CIDFontType0":
  21439. return subtype === "CIDFontType0C" ? _util.FontType.CIDFONTTYPE0C : _util.FontType.CIDFONTTYPE0;
  21440. case "OpenType":
  21441. return _util.FontType.OPENTYPE;
  21442. case "TrueType":
  21443. return _util.FontType.TRUETYPE;
  21444. case "CIDFontType2":
  21445. return _util.FontType.CIDFONTTYPE2;
  21446. case "MMType1":
  21447. return _util.FontType.MMTYPE1;
  21448. case "Type0":
  21449. return _util.FontType.TYPE0;
  21450. default:
  21451. return _util.FontType.UNKNOWN;
  21452. }
  21453. }
  21454. function recoverGlyphName(name, glyphsUnicodeMap) {
  21455. if (glyphsUnicodeMap[name] !== undefined) {
  21456. return name;
  21457. }
  21458. var unicode = (0, _unicode.getUnicodeForGlyph)(name, glyphsUnicodeMap);
  21459. if (unicode !== -1) {
  21460. for (var key in glyphsUnicodeMap) {
  21461. if (glyphsUnicodeMap[key] === unicode) {
  21462. return key;
  21463. }
  21464. }
  21465. }
  21466. (0, _util.info)("Unable to recover a standard glyph name for: " + name);
  21467. return name;
  21468. }
  21469. var Glyph = function GlyphClosure() {
  21470. function Glyph(fontChar, unicode, accent, width, vmetric, operatorListId, isSpace, isInFont) {
  21471. this.fontChar = fontChar;
  21472. this.unicode = unicode;
  21473. this.accent = accent;
  21474. this.width = width;
  21475. this.vmetric = vmetric;
  21476. this.operatorListId = operatorListId;
  21477. this.isSpace = isSpace;
  21478. this.isInFont = isInFont;
  21479. }
  21480. Glyph.prototype.matchesForCache = function (fontChar, unicode, accent, width, vmetric, operatorListId, isSpace, isInFont) {
  21481. 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;
  21482. };
  21483. return Glyph;
  21484. }();
  21485. var ToUnicodeMap = function ToUnicodeMapClosure() {
  21486. function ToUnicodeMap(cmap = []) {
  21487. this._map = cmap;
  21488. }
  21489. ToUnicodeMap.prototype = {
  21490. get length() {
  21491. return this._map.length;
  21492. },
  21493. forEach(callback) {
  21494. for (var charCode in this._map) {
  21495. callback(charCode, this._map[charCode].charCodeAt(0));
  21496. }
  21497. },
  21498. has(i) {
  21499. return this._map[i] !== undefined;
  21500. },
  21501. get(i) {
  21502. return this._map[i];
  21503. },
  21504. charCodeOf(value) {
  21505. const map = this._map;
  21506. if (map.length <= 0x10000) {
  21507. return map.indexOf(value);
  21508. }
  21509. for (const charCode in map) {
  21510. if (map[charCode] === value) {
  21511. return charCode | 0;
  21512. }
  21513. }
  21514. return -1;
  21515. },
  21516. amend(map) {
  21517. for (var charCode in map) {
  21518. this._map[charCode] = map[charCode];
  21519. }
  21520. }
  21521. };
  21522. return ToUnicodeMap;
  21523. }();
  21524. exports.ToUnicodeMap = ToUnicodeMap;
  21525. var IdentityToUnicodeMap = function IdentityToUnicodeMapClosure() {
  21526. function IdentityToUnicodeMap(firstChar, lastChar) {
  21527. this.firstChar = firstChar;
  21528. this.lastChar = lastChar;
  21529. }
  21530. IdentityToUnicodeMap.prototype = {
  21531. get length() {
  21532. return this.lastChar + 1 - this.firstChar;
  21533. },
  21534. forEach(callback) {
  21535. for (var i = this.firstChar, ii = this.lastChar; i <= ii; i++) {
  21536. callback(i, i);
  21537. }
  21538. },
  21539. has(i) {
  21540. return this.firstChar <= i && i <= this.lastChar;
  21541. },
  21542. get(i) {
  21543. if (this.firstChar <= i && i <= this.lastChar) {
  21544. return String.fromCharCode(i);
  21545. }
  21546. return undefined;
  21547. },
  21548. charCodeOf(v) {
  21549. return Number.isInteger(v) && v >= this.firstChar && v <= this.lastChar ? v : -1;
  21550. },
  21551. amend(map) {
  21552. (0, _util.unreachable)("Should not call amend()");
  21553. }
  21554. };
  21555. return IdentityToUnicodeMap;
  21556. }();
  21557. exports.IdentityToUnicodeMap = IdentityToUnicodeMap;
  21558. var OpenTypeFileBuilder = function OpenTypeFileBuilderClosure() {
  21559. function writeInt16(dest, offset, num) {
  21560. dest[offset] = num >> 8 & 0xff;
  21561. dest[offset + 1] = num & 0xff;
  21562. }
  21563. function writeInt32(dest, offset, num) {
  21564. dest[offset] = num >> 24 & 0xff;
  21565. dest[offset + 1] = num >> 16 & 0xff;
  21566. dest[offset + 2] = num >> 8 & 0xff;
  21567. dest[offset + 3] = num & 0xff;
  21568. }
  21569. function writeData(dest, offset, data) {
  21570. var i, ii;
  21571. if (data instanceof Uint8Array) {
  21572. dest.set(data, offset);
  21573. } else if (typeof data === "string") {
  21574. for (i = 0, ii = data.length; i < ii; i++) {
  21575. dest[offset++] = data.charCodeAt(i) & 0xff;
  21576. }
  21577. } else {
  21578. for (i = 0, ii = data.length; i < ii; i++) {
  21579. dest[offset++] = data[i] & 0xff;
  21580. }
  21581. }
  21582. }
  21583. function OpenTypeFileBuilder(sfnt) {
  21584. this.sfnt = sfnt;
  21585. this.tables = Object.create(null);
  21586. }
  21587. OpenTypeFileBuilder.getSearchParams = function OpenTypeFileBuilder_getSearchParams(entriesCount, entrySize) {
  21588. var maxPower2 = 1,
  21589. log2 = 0;
  21590. while ((maxPower2 ^ entriesCount) > maxPower2) {
  21591. maxPower2 <<= 1;
  21592. log2++;
  21593. }
  21594. var searchRange = maxPower2 * entrySize;
  21595. return {
  21596. range: searchRange,
  21597. entry: log2,
  21598. rangeShift: entrySize * entriesCount - searchRange
  21599. };
  21600. };
  21601. var OTF_HEADER_SIZE = 12;
  21602. var OTF_TABLE_ENTRY_SIZE = 16;
  21603. OpenTypeFileBuilder.prototype = {
  21604. toArray: function OpenTypeFileBuilder_toArray() {
  21605. var sfnt = this.sfnt;
  21606. var tables = this.tables;
  21607. var tablesNames = Object.keys(tables);
  21608. tablesNames.sort();
  21609. var numTables = tablesNames.length;
  21610. var i, j, jj, table, tableName;
  21611. var offset = OTF_HEADER_SIZE + numTables * OTF_TABLE_ENTRY_SIZE;
  21612. var tableOffsets = [offset];
  21613. for (i = 0; i < numTables; i++) {
  21614. table = tables[tablesNames[i]];
  21615. var paddedLength = (table.length + 3 & ~3) >>> 0;
  21616. offset += paddedLength;
  21617. tableOffsets.push(offset);
  21618. }
  21619. var file = new Uint8Array(offset);
  21620. for (i = 0; i < numTables; i++) {
  21621. table = tables[tablesNames[i]];
  21622. writeData(file, tableOffsets[i], table);
  21623. }
  21624. if (sfnt === "true") {
  21625. sfnt = (0, _util.string32)(0x00010000);
  21626. }
  21627. file[0] = sfnt.charCodeAt(0) & 0xff;
  21628. file[1] = sfnt.charCodeAt(1) & 0xff;
  21629. file[2] = sfnt.charCodeAt(2) & 0xff;
  21630. file[3] = sfnt.charCodeAt(3) & 0xff;
  21631. writeInt16(file, 4, numTables);
  21632. var searchParams = OpenTypeFileBuilder.getSearchParams(numTables, 16);
  21633. writeInt16(file, 6, searchParams.range);
  21634. writeInt16(file, 8, searchParams.entry);
  21635. writeInt16(file, 10, searchParams.rangeShift);
  21636. offset = OTF_HEADER_SIZE;
  21637. for (i = 0; i < numTables; i++) {
  21638. tableName = tablesNames[i];
  21639. file[offset] = tableName.charCodeAt(0) & 0xff;
  21640. file[offset + 1] = tableName.charCodeAt(1) & 0xff;
  21641. file[offset + 2] = tableName.charCodeAt(2) & 0xff;
  21642. file[offset + 3] = tableName.charCodeAt(3) & 0xff;
  21643. var checksum = 0;
  21644. for (j = tableOffsets[i], jj = tableOffsets[i + 1]; j < jj; j += 4) {
  21645. var quad = (0, _core_utils.readUint32)(file, j);
  21646. checksum = checksum + quad >>> 0;
  21647. }
  21648. writeInt32(file, offset + 4, checksum);
  21649. writeInt32(file, offset + 8, tableOffsets[i]);
  21650. writeInt32(file, offset + 12, tables[tableName].length);
  21651. offset += OTF_TABLE_ENTRY_SIZE;
  21652. }
  21653. return file;
  21654. },
  21655. addTable: function OpenTypeFileBuilder_addTable(tag, data) {
  21656. if (tag in this.tables) {
  21657. throw new Error("Table " + tag + " already exists");
  21658. }
  21659. this.tables[tag] = data;
  21660. }
  21661. };
  21662. return OpenTypeFileBuilder;
  21663. }();
  21664. var Font = function FontClosure() {
  21665. function Font(name, file, properties) {
  21666. var charCode;
  21667. this.name = name;
  21668. this.loadedName = properties.loadedName;
  21669. this.isType3Font = properties.isType3Font;
  21670. this.missingFile = false;
  21671. this.glyphCache = Object.create(null);
  21672. this.isSerifFont = !!(properties.flags & FontFlags.Serif);
  21673. this.isSymbolicFont = !!(properties.flags & FontFlags.Symbolic);
  21674. this.isMonospace = !!(properties.flags & FontFlags.FixedPitch);
  21675. var type = properties.type;
  21676. var subtype = properties.subtype;
  21677. this.type = type;
  21678. this.subtype = subtype;
  21679. let fallbackName = "sans-serif";
  21680. if (this.isMonospace) {
  21681. fallbackName = "monospace";
  21682. } else if (this.isSerifFont) {
  21683. fallbackName = "serif";
  21684. }
  21685. this.fallbackName = fallbackName;
  21686. this.differences = properties.differences;
  21687. this.widths = properties.widths;
  21688. this.defaultWidth = properties.defaultWidth;
  21689. this.composite = properties.composite;
  21690. this.cMap = properties.cMap;
  21691. this.capHeight = properties.capHeight / PDF_GLYPH_SPACE_UNITS;
  21692. this.ascent = properties.ascent / PDF_GLYPH_SPACE_UNITS;
  21693. this.descent = properties.descent / PDF_GLYPH_SPACE_UNITS;
  21694. this.fontMatrix = properties.fontMatrix;
  21695. this.bbox = properties.bbox;
  21696. this.defaultEncoding = properties.defaultEncoding;
  21697. this.toUnicode = properties.toUnicode;
  21698. this.fallbackToUnicode = properties.fallbackToUnicode || new ToUnicodeMap();
  21699. this.toFontChar = [];
  21700. if (properties.type === "Type3") {
  21701. for (charCode = 0; charCode < 256; charCode++) {
  21702. this.toFontChar[charCode] = this.differences[charCode] || properties.defaultEncoding[charCode];
  21703. }
  21704. this.fontType = _util.FontType.TYPE3;
  21705. return;
  21706. }
  21707. this.cidEncoding = properties.cidEncoding;
  21708. this.vertical = !!properties.vertical;
  21709. if (this.vertical) {
  21710. this.vmetrics = properties.vmetrics;
  21711. this.defaultVMetrics = properties.defaultVMetrics;
  21712. }
  21713. if (!file || file.isEmpty) {
  21714. if (file) {
  21715. (0, _util.warn)('Font file is empty in "' + name + '" (' + this.loadedName + ")");
  21716. }
  21717. this.fallbackToSystemFont(properties);
  21718. return;
  21719. }
  21720. [type, subtype] = getFontFileType(file, properties);
  21721. if (type !== this.type || subtype !== this.subtype) {
  21722. (0, _util.info)("Inconsistent font file Type/SubType, expected: " + `${this.type}/${this.subtype} but found: ${type}/${subtype}.`);
  21723. }
  21724. try {
  21725. var data;
  21726. switch (type) {
  21727. case "MMType1":
  21728. (0, _util.info)("MMType1 font (" + name + "), falling back to Type1.");
  21729. case "Type1":
  21730. case "CIDFontType0":
  21731. this.mimetype = "font/opentype";
  21732. var cff = subtype === "Type1C" || subtype === "CIDFontType0C" ? new CFFFont(file, properties) : new Type1Font(name, file, properties);
  21733. adjustWidths(properties);
  21734. data = this.convert(name, cff, properties);
  21735. break;
  21736. case "OpenType":
  21737. case "TrueType":
  21738. case "CIDFontType2":
  21739. this.mimetype = "font/opentype";
  21740. data = this.checkAndRepair(name, file, properties);
  21741. if (this.isOpenType) {
  21742. adjustWidths(properties);
  21743. type = "OpenType";
  21744. }
  21745. break;
  21746. default:
  21747. throw new _util.FormatError(`Font ${type} is not supported`);
  21748. }
  21749. } catch (e) {
  21750. (0, _util.warn)(e);
  21751. this.fallbackToSystemFont(properties);
  21752. return;
  21753. }
  21754. this.data = data;
  21755. this.fontType = getFontType(type, subtype);
  21756. this.fontMatrix = properties.fontMatrix;
  21757. this.widths = properties.widths;
  21758. this.defaultWidth = properties.defaultWidth;
  21759. this.toUnicode = properties.toUnicode;
  21760. this.seacMap = properties.seacMap;
  21761. }
  21762. function int16(b0, b1) {
  21763. return (b0 << 8) + b1;
  21764. }
  21765. function writeSignedInt16(bytes, index, value) {
  21766. bytes[index + 1] = value;
  21767. bytes[index] = value >>> 8;
  21768. }
  21769. function signedInt16(b0, b1) {
  21770. var value = (b0 << 8) + b1;
  21771. return value & 1 << 15 ? value - 0x10000 : value;
  21772. }
  21773. function int32(b0, b1, b2, b3) {
  21774. return (b0 << 24) + (b1 << 16) + (b2 << 8) + b3;
  21775. }
  21776. function string16(value) {
  21777. return String.fromCharCode(value >> 8 & 0xff, value & 0xff);
  21778. }
  21779. function safeString16(value) {
  21780. if (value > 0x7fff) {
  21781. value = 0x7fff;
  21782. } else if (value < -0x8000) {
  21783. value = -0x8000;
  21784. }
  21785. return String.fromCharCode(value >> 8 & 0xff, value & 0xff);
  21786. }
  21787. function isTrueTypeFile(file) {
  21788. var header = file.peekBytes(4);
  21789. return (0, _core_utils.readUint32)(header, 0) === 0x00010000 || (0, _util.bytesToString)(header) === "true";
  21790. }
  21791. function isTrueTypeCollectionFile(file) {
  21792. const header = file.peekBytes(4);
  21793. return (0, _util.bytesToString)(header) === "ttcf";
  21794. }
  21795. function isOpenTypeFile(file) {
  21796. var header = file.peekBytes(4);
  21797. return (0, _util.bytesToString)(header) === "OTTO";
  21798. }
  21799. function isType1File(file) {
  21800. var header = file.peekBytes(2);
  21801. if (header[0] === 0x25 && header[1] === 0x21) {
  21802. return true;
  21803. }
  21804. if (header[0] === 0x80 && header[1] === 0x01) {
  21805. return true;
  21806. }
  21807. return false;
  21808. }
  21809. function isCFFFile(file) {
  21810. const header = file.peekBytes(4);
  21811. if (header[0] >= 1 && header[3] >= 1 && header[3] <= 4) {
  21812. return true;
  21813. }
  21814. return false;
  21815. }
  21816. function getFontFileType(file, {
  21817. type,
  21818. subtype,
  21819. composite
  21820. }) {
  21821. let fileType, fileSubtype;
  21822. if (isTrueTypeFile(file) || isTrueTypeCollectionFile(file)) {
  21823. if (composite) {
  21824. fileType = "CIDFontType2";
  21825. } else {
  21826. fileType = "TrueType";
  21827. }
  21828. } else if (isOpenTypeFile(file)) {
  21829. if (composite) {
  21830. fileType = "CIDFontType2";
  21831. } else {
  21832. fileType = "OpenType";
  21833. }
  21834. } else if (isType1File(file)) {
  21835. if (composite) {
  21836. fileType = "CIDFontType0";
  21837. } else {
  21838. fileType = type === "MMType1" ? "MMType1" : "Type1";
  21839. }
  21840. } else if (isCFFFile(file)) {
  21841. if (composite) {
  21842. fileType = "CIDFontType0";
  21843. fileSubtype = "CIDFontType0C";
  21844. } else {
  21845. fileType = type === "MMType1" ? "MMType1" : "Type1";
  21846. fileSubtype = "Type1C";
  21847. }
  21848. } else {
  21849. (0, _util.warn)("getFontFileType: Unable to detect correct font file Type/Subtype.");
  21850. fileType = type;
  21851. fileSubtype = subtype;
  21852. }
  21853. return [fileType, fileSubtype];
  21854. }
  21855. function buildToFontChar(encoding, glyphsUnicodeMap, differences) {
  21856. var toFontChar = [],
  21857. unicode;
  21858. for (var i = 0, ii = encoding.length; i < ii; i++) {
  21859. unicode = (0, _unicode.getUnicodeForGlyph)(encoding[i], glyphsUnicodeMap);
  21860. if (unicode !== -1) {
  21861. toFontChar[i] = unicode;
  21862. }
  21863. }
  21864. for (var charCode in differences) {
  21865. unicode = (0, _unicode.getUnicodeForGlyph)(differences[charCode], glyphsUnicodeMap);
  21866. if (unicode !== -1) {
  21867. toFontChar[+charCode] = unicode;
  21868. }
  21869. }
  21870. return toFontChar;
  21871. }
  21872. function adjustMapping(charCodeToGlyphId, hasGlyph, newGlyphZeroId) {
  21873. var newMap = Object.create(null);
  21874. var toFontChar = [];
  21875. var privateUseAreaIndex = 0;
  21876. var nextAvailableFontCharCode = PRIVATE_USE_AREAS[privateUseAreaIndex][0];
  21877. var privateUseOffetEnd = PRIVATE_USE_AREAS[privateUseAreaIndex][1];
  21878. for (var originalCharCode in charCodeToGlyphId) {
  21879. originalCharCode |= 0;
  21880. var glyphId = charCodeToGlyphId[originalCharCode];
  21881. if (!hasGlyph(glyphId)) {
  21882. continue;
  21883. }
  21884. if (nextAvailableFontCharCode > privateUseOffetEnd) {
  21885. privateUseAreaIndex++;
  21886. if (privateUseAreaIndex >= PRIVATE_USE_AREAS.length) {
  21887. (0, _util.warn)("Ran out of space in font private use area.");
  21888. break;
  21889. }
  21890. nextAvailableFontCharCode = PRIVATE_USE_AREAS[privateUseAreaIndex][0];
  21891. privateUseOffetEnd = PRIVATE_USE_AREAS[privateUseAreaIndex][1];
  21892. }
  21893. var fontCharCode = nextAvailableFontCharCode++;
  21894. if (glyphId === 0) {
  21895. glyphId = newGlyphZeroId;
  21896. }
  21897. newMap[fontCharCode] = glyphId;
  21898. toFontChar[originalCharCode] = fontCharCode;
  21899. }
  21900. return {
  21901. toFontChar,
  21902. charCodeToGlyphId: newMap,
  21903. nextAvailableFontCharCode
  21904. };
  21905. }
  21906. function getRanges(glyphs, numGlyphs) {
  21907. var codes = [];
  21908. for (var charCode in glyphs) {
  21909. if (glyphs[charCode] >= numGlyphs) {
  21910. continue;
  21911. }
  21912. codes.push({
  21913. fontCharCode: charCode | 0,
  21914. glyphId: glyphs[charCode]
  21915. });
  21916. }
  21917. if (codes.length === 0) {
  21918. codes.push({
  21919. fontCharCode: 0,
  21920. glyphId: 0
  21921. });
  21922. }
  21923. codes.sort(function fontGetRangesSort(a, b) {
  21924. return a.fontCharCode - b.fontCharCode;
  21925. });
  21926. var ranges = [];
  21927. var length = codes.length;
  21928. for (var n = 0; n < length;) {
  21929. var start = codes[n].fontCharCode;
  21930. var codeIndices = [codes[n].glyphId];
  21931. ++n;
  21932. var end = start;
  21933. while (n < length && end + 1 === codes[n].fontCharCode) {
  21934. codeIndices.push(codes[n].glyphId);
  21935. ++end;
  21936. ++n;
  21937. if (end === 0xffff) {
  21938. break;
  21939. }
  21940. }
  21941. ranges.push([start, end, codeIndices]);
  21942. }
  21943. return ranges;
  21944. }
  21945. function createCmapTable(glyphs, numGlyphs) {
  21946. var ranges = getRanges(glyphs, numGlyphs);
  21947. var numTables = ranges[ranges.length - 1][1] > 0xffff ? 2 : 1;
  21948. var cmap = "\x00\x00" + string16(numTables) + "\x00\x03" + "\x00\x01" + (0, _util.string32)(4 + numTables * 8);
  21949. var i, ii, j, jj;
  21950. for (i = ranges.length - 1; i >= 0; --i) {
  21951. if (ranges[i][0] <= 0xffff) {
  21952. break;
  21953. }
  21954. }
  21955. var bmpLength = i + 1;
  21956. if (ranges[i][0] < 0xffff && ranges[i][1] === 0xffff) {
  21957. ranges[i][1] = 0xfffe;
  21958. }
  21959. var trailingRangesCount = ranges[i][1] < 0xffff ? 1 : 0;
  21960. var segCount = bmpLength + trailingRangesCount;
  21961. var searchParams = OpenTypeFileBuilder.getSearchParams(segCount, 2);
  21962. var startCount = "";
  21963. var endCount = "";
  21964. var idDeltas = "";
  21965. var idRangeOffsets = "";
  21966. var glyphsIds = "";
  21967. var bias = 0;
  21968. var range, start, end, codes;
  21969. for (i = 0, ii = bmpLength; i < ii; i++) {
  21970. range = ranges[i];
  21971. start = range[0];
  21972. end = range[1];
  21973. startCount += string16(start);
  21974. endCount += string16(end);
  21975. codes = range[2];
  21976. var contiguous = true;
  21977. for (j = 1, jj = codes.length; j < jj; ++j) {
  21978. if (codes[j] !== codes[j - 1] + 1) {
  21979. contiguous = false;
  21980. break;
  21981. }
  21982. }
  21983. if (!contiguous) {
  21984. var offset = (segCount - i) * 2 + bias * 2;
  21985. bias += end - start + 1;
  21986. idDeltas += string16(0);
  21987. idRangeOffsets += string16(offset);
  21988. for (j = 0, jj = codes.length; j < jj; ++j) {
  21989. glyphsIds += string16(codes[j]);
  21990. }
  21991. } else {
  21992. var startCode = codes[0];
  21993. idDeltas += string16(startCode - start & 0xffff);
  21994. idRangeOffsets += string16(0);
  21995. }
  21996. }
  21997. if (trailingRangesCount > 0) {
  21998. endCount += "\xFF\xFF";
  21999. startCount += "\xFF\xFF";
  22000. idDeltas += "\x00\x01";
  22001. idRangeOffsets += "\x00\x00";
  22002. }
  22003. var format314 = "\x00\x00" + string16(2 * segCount) + string16(searchParams.range) + string16(searchParams.entry) + string16(searchParams.rangeShift) + endCount + "\x00\x00" + startCount + idDeltas + idRangeOffsets + glyphsIds;
  22004. var format31012 = "";
  22005. var header31012 = "";
  22006. if (numTables > 1) {
  22007. cmap += "\x00\x03" + "\x00\x0A" + (0, _util.string32)(4 + numTables * 8 + 4 + format314.length);
  22008. format31012 = "";
  22009. for (i = 0, ii = ranges.length; i < ii; i++) {
  22010. range = ranges[i];
  22011. start = range[0];
  22012. codes = range[2];
  22013. var code = codes[0];
  22014. for (j = 1, jj = codes.length; j < jj; ++j) {
  22015. if (codes[j] !== codes[j - 1] + 1) {
  22016. end = range[0] + j - 1;
  22017. format31012 += (0, _util.string32)(start) + (0, _util.string32)(end) + (0, _util.string32)(code);
  22018. start = end + 1;
  22019. code = codes[j];
  22020. }
  22021. }
  22022. format31012 += (0, _util.string32)(start) + (0, _util.string32)(range[1]) + (0, _util.string32)(code);
  22023. }
  22024. header31012 = "\x00\x0C" + "\x00\x00" + (0, _util.string32)(format31012.length + 16) + "\x00\x00\x00\x00" + (0, _util.string32)(format31012.length / 12);
  22025. }
  22026. return cmap + "\x00\x04" + string16(format314.length + 4) + format314 + header31012 + format31012;
  22027. }
  22028. function validateOS2Table(os2, file) {
  22029. file.pos = (file.start || 0) + os2.offset;
  22030. var version = file.getUint16();
  22031. file.skip(60);
  22032. var selection = file.getUint16();
  22033. if (version < 4 && selection & 0x0300) {
  22034. return false;
  22035. }
  22036. var firstChar = file.getUint16();
  22037. var lastChar = file.getUint16();
  22038. if (firstChar > lastChar) {
  22039. return false;
  22040. }
  22041. file.skip(6);
  22042. var usWinAscent = file.getUint16();
  22043. if (usWinAscent === 0) {
  22044. return false;
  22045. }
  22046. os2.data[8] = os2.data[9] = 0;
  22047. return true;
  22048. }
  22049. function createOS2Table(properties, charstrings, override) {
  22050. override = override || {
  22051. unitsPerEm: 0,
  22052. yMax: 0,
  22053. yMin: 0,
  22054. ascent: 0,
  22055. descent: 0
  22056. };
  22057. var ulUnicodeRange1 = 0;
  22058. var ulUnicodeRange2 = 0;
  22059. var ulUnicodeRange3 = 0;
  22060. var ulUnicodeRange4 = 0;
  22061. var firstCharIndex = null;
  22062. var lastCharIndex = 0;
  22063. if (charstrings) {
  22064. for (var code in charstrings) {
  22065. code |= 0;
  22066. if (firstCharIndex > code || !firstCharIndex) {
  22067. firstCharIndex = code;
  22068. }
  22069. if (lastCharIndex < code) {
  22070. lastCharIndex = code;
  22071. }
  22072. var position = (0, _unicode.getUnicodeRangeFor)(code);
  22073. if (position < 32) {
  22074. ulUnicodeRange1 |= 1 << position;
  22075. } else if (position < 64) {
  22076. ulUnicodeRange2 |= 1 << position - 32;
  22077. } else if (position < 96) {
  22078. ulUnicodeRange3 |= 1 << position - 64;
  22079. } else if (position < 123) {
  22080. ulUnicodeRange4 |= 1 << position - 96;
  22081. } else {
  22082. throw new _util.FormatError("Unicode ranges Bits > 123 are reserved for internal usage");
  22083. }
  22084. }
  22085. if (lastCharIndex > 0xffff) {
  22086. lastCharIndex = 0xffff;
  22087. }
  22088. } else {
  22089. firstCharIndex = 0;
  22090. lastCharIndex = 255;
  22091. }
  22092. var bbox = properties.bbox || [0, 0, 0, 0];
  22093. var unitsPerEm = override.unitsPerEm || 1 / (properties.fontMatrix || _util.FONT_IDENTITY_MATRIX)[0];
  22094. var scale = properties.ascentScaled ? 1.0 : unitsPerEm / PDF_GLYPH_SPACE_UNITS;
  22095. var typoAscent = override.ascent || Math.round(scale * (properties.ascent || bbox[3]));
  22096. var typoDescent = override.descent || Math.round(scale * (properties.descent || bbox[1]));
  22097. if (typoDescent > 0 && properties.descent > 0 && bbox[1] < 0) {
  22098. typoDescent = -typoDescent;
  22099. }
  22100. var winAscent = override.yMax || typoAscent;
  22101. var winDescent = -override.yMin || -typoDescent;
  22102. return "\x00\x03" + "\x02\x24" + "\x01\xF4" + "\x00\x05" + "\x00\x00" + "\x02\x8A" + "\x02\xBB" + "\x00\x00" + "\x00\x8C" + "\x02\x8A" + "\x02\xBB" + "\x00\x00" + "\x01\xDF" + "\x00\x31" + "\x01\x02" + "\x00\x00" + "\x00\x00\x06" + String.fromCharCode(properties.fixedPitch ? 0x09 : 0x00) + "\x00\x00\x00\x00\x00\x00" + (0, _util.string32)(ulUnicodeRange1) + (0, _util.string32)(ulUnicodeRange2) + (0, _util.string32)(ulUnicodeRange3) + (0, _util.string32)(ulUnicodeRange4) + "\x2A\x32\x31\x2A" + string16(properties.italicAngle ? 1 : 0) + string16(firstCharIndex || properties.firstChar) + string16(lastCharIndex || properties.lastChar) + string16(typoAscent) + string16(typoDescent) + "\x00\x64" + string16(winAscent) + string16(winDescent) + "\x00\x00\x00\x00" + "\x00\x00\x00\x00" + string16(properties.xHeight) + string16(properties.capHeight) + string16(0) + string16(firstCharIndex || properties.firstChar) + "\x00\x03";
  22103. }
  22104. function createPostTable(properties) {
  22105. var angle = Math.floor(properties.italicAngle * 2 ** 16);
  22106. return "\x00\x03\x00\x00" + (0, _util.string32)(angle) + "\x00\x00" + "\x00\x00" + (0, _util.string32)(properties.fixedPitch) + "\x00\x00\x00\x00" + "\x00\x00\x00\x00" + "\x00\x00\x00\x00" + "\x00\x00\x00\x00";
  22107. }
  22108. function createNameTable(name, proto) {
  22109. if (!proto) {
  22110. proto = [[], []];
  22111. }
  22112. var strings = [proto[0][0] || "Original licence", proto[0][1] || name, proto[0][2] || "Unknown", proto[0][3] || "uniqueID", proto[0][4] || name, proto[0][5] || "Version 0.11", proto[0][6] || "", proto[0][7] || "Unknown", proto[0][8] || "Unknown", proto[0][9] || "Unknown"];
  22113. var stringsUnicode = [];
  22114. var i, ii, j, jj, str;
  22115. for (i = 0, ii = strings.length; i < ii; i++) {
  22116. str = proto[1][i] || strings[i];
  22117. var strBufUnicode = [];
  22118. for (j = 0, jj = str.length; j < jj; j++) {
  22119. strBufUnicode.push(string16(str.charCodeAt(j)));
  22120. }
  22121. stringsUnicode.push(strBufUnicode.join(""));
  22122. }
  22123. var names = [strings, stringsUnicode];
  22124. var platforms = ["\x00\x01", "\x00\x03"];
  22125. var encodings = ["\x00\x00", "\x00\x01"];
  22126. var languages = ["\x00\x00", "\x04\x09"];
  22127. var namesRecordCount = strings.length * platforms.length;
  22128. var nameTable = "\x00\x00" + string16(namesRecordCount) + string16(namesRecordCount * 12 + 6);
  22129. var strOffset = 0;
  22130. for (i = 0, ii = platforms.length; i < ii; i++) {
  22131. var strs = names[i];
  22132. for (j = 0, jj = strs.length; j < jj; j++) {
  22133. str = strs[j];
  22134. var nameRecord = platforms[i] + encodings[i] + languages[i] + string16(j) + string16(str.length) + string16(strOffset);
  22135. nameTable += nameRecord;
  22136. strOffset += str.length;
  22137. }
  22138. }
  22139. nameTable += strings.join("") + stringsUnicode.join("");
  22140. return nameTable;
  22141. }
  22142. Font.prototype = {
  22143. name: null,
  22144. font: null,
  22145. mimetype: null,
  22146. disableFontFace: false,
  22147. get renderer() {
  22148. var renderer = _font_renderer.FontRendererFactory.create(this, SEAC_ANALYSIS_ENABLED);
  22149. return (0, _util.shadow)(this, "renderer", renderer);
  22150. },
  22151. exportData(extraProperties = false) {
  22152. const exportDataProperties = extraProperties ? [...EXPORT_DATA_PROPERTIES, ...EXPORT_DATA_EXTRA_PROPERTIES] : EXPORT_DATA_PROPERTIES;
  22153. const data = Object.create(null);
  22154. let property, value;
  22155. for (property of exportDataProperties) {
  22156. value = this[property];
  22157. if (value !== undefined) {
  22158. data[property] = value;
  22159. }
  22160. }
  22161. return data;
  22162. },
  22163. fallbackToSystemFont(properties) {
  22164. this.missingFile = true;
  22165. var name = this.name;
  22166. var type = this.type;
  22167. var subtype = this.subtype;
  22168. let fontName = name.replace(/[,_]/g, "-").replace(/\s/g, "");
  22169. var stdFontMap = (0, _standard_fonts.getStdFontMap)(),
  22170. nonStdFontMap = (0, _standard_fonts.getNonStdFontMap)();
  22171. const isStandardFont = !!stdFontMap[fontName];
  22172. const isMappedToStandardFont = !!(nonStdFontMap[fontName] && stdFontMap[nonStdFontMap[fontName]]);
  22173. fontName = stdFontMap[fontName] || nonStdFontMap[fontName] || fontName;
  22174. this.bold = fontName.search(/bold/gi) !== -1;
  22175. this.italic = fontName.search(/oblique/gi) !== -1 || fontName.search(/italic/gi) !== -1;
  22176. this.black = name.search(/Black/g) !== -1;
  22177. const isNarrow = name.search(/Narrow/g) !== -1;
  22178. this.remeasure = (!isStandardFont || isNarrow) && Object.keys(this.widths).length > 0;
  22179. if ((isStandardFont || isMappedToStandardFont) && type === "CIDFontType2" && this.cidEncoding.startsWith("Identity-")) {
  22180. const GlyphMapForStandardFonts = (0, _standard_fonts.getGlyphMapForStandardFonts)(),
  22181. cidToGidMap = properties.cidToGidMap;
  22182. const map = [];
  22183. for (const charCode in GlyphMapForStandardFonts) {
  22184. map[+charCode] = GlyphMapForStandardFonts[charCode];
  22185. }
  22186. if (/Arial-?Black/i.test(name)) {
  22187. var SupplementalGlyphMapForArialBlack = (0, _standard_fonts.getSupplementalGlyphMapForArialBlack)();
  22188. for (const charCode in SupplementalGlyphMapForArialBlack) {
  22189. map[+charCode] = SupplementalGlyphMapForArialBlack[charCode];
  22190. }
  22191. } else if (/Calibri/i.test(name)) {
  22192. const SupplementalGlyphMapForCalibri = (0, _standard_fonts.getSupplementalGlyphMapForCalibri)();
  22193. for (const charCode in SupplementalGlyphMapForCalibri) {
  22194. map[+charCode] = SupplementalGlyphMapForCalibri[charCode];
  22195. }
  22196. }
  22197. if (cidToGidMap) {
  22198. for (const charCode in map) {
  22199. const cid = map[charCode];
  22200. if (cidToGidMap[cid] !== undefined) {
  22201. map[+charCode] = cidToGidMap[cid];
  22202. }
  22203. }
  22204. }
  22205. var isIdentityUnicode = this.toUnicode instanceof IdentityToUnicodeMap;
  22206. if (!isIdentityUnicode) {
  22207. this.toUnicode.forEach(function (charCode, unicodeCharCode) {
  22208. map[+charCode] = unicodeCharCode;
  22209. });
  22210. }
  22211. this.toFontChar = map;
  22212. this.toUnicode = new ToUnicodeMap(map);
  22213. } else if (/Symbol/i.test(fontName)) {
  22214. this.toFontChar = buildToFontChar(_encodings.SymbolSetEncoding, (0, _glyphlist.getGlyphsUnicode)(), this.differences);
  22215. } else if (/Dingbats/i.test(fontName)) {
  22216. if (/Wingdings/i.test(name)) {
  22217. (0, _util.warn)("Non-embedded Wingdings font, falling back to ZapfDingbats.");
  22218. }
  22219. this.toFontChar = buildToFontChar(_encodings.ZapfDingbatsEncoding, (0, _glyphlist.getDingbatsGlyphsUnicode)(), this.differences);
  22220. } else if (isStandardFont) {
  22221. this.toFontChar = buildToFontChar(this.defaultEncoding, (0, _glyphlist.getGlyphsUnicode)(), this.differences);
  22222. } else {
  22223. const glyphsUnicodeMap = (0, _glyphlist.getGlyphsUnicode)();
  22224. const map = [];
  22225. this.toUnicode.forEach((charCode, unicodeCharCode) => {
  22226. if (!this.composite) {
  22227. var glyphName = this.differences[charCode] || this.defaultEncoding[charCode];
  22228. const unicode = (0, _unicode.getUnicodeForGlyph)(glyphName, glyphsUnicodeMap);
  22229. if (unicode !== -1) {
  22230. unicodeCharCode = unicode;
  22231. }
  22232. }
  22233. map[+charCode] = unicodeCharCode;
  22234. });
  22235. if (this.composite && this.toUnicode instanceof IdentityToUnicodeMap) {
  22236. if (/Verdana/i.test(name)) {
  22237. const GlyphMapForStandardFonts = (0, _standard_fonts.getGlyphMapForStandardFonts)();
  22238. for (const charCode in GlyphMapForStandardFonts) {
  22239. map[+charCode] = GlyphMapForStandardFonts[charCode];
  22240. }
  22241. }
  22242. }
  22243. this.toFontChar = map;
  22244. }
  22245. this.loadedName = fontName.split("-")[0];
  22246. this.fontType = getFontType(type, subtype);
  22247. },
  22248. checkAndRepair: function Font_checkAndRepair(name, font, properties) {
  22249. const VALID_TABLES = ["OS/2", "cmap", "head", "hhea", "hmtx", "maxp", "name", "post", "loca", "glyf", "fpgm", "prep", "cvt ", "CFF "];
  22250. function readTables(file, numTables) {
  22251. const tables = Object.create(null);
  22252. tables["OS/2"] = null;
  22253. tables.cmap = null;
  22254. tables.head = null;
  22255. tables.hhea = null;
  22256. tables.hmtx = null;
  22257. tables.maxp = null;
  22258. tables.name = null;
  22259. tables.post = null;
  22260. for (let i = 0; i < numTables; i++) {
  22261. const table = readTableEntry(file);
  22262. if (!VALID_TABLES.includes(table.tag)) {
  22263. continue;
  22264. }
  22265. if (table.length === 0) {
  22266. continue;
  22267. }
  22268. tables[table.tag] = table;
  22269. }
  22270. return tables;
  22271. }
  22272. function readTableEntry(file) {
  22273. var tag = (0, _util.bytesToString)(file.getBytes(4));
  22274. var checksum = file.getInt32() >>> 0;
  22275. var offset = file.getInt32() >>> 0;
  22276. var length = file.getInt32() >>> 0;
  22277. var previousPosition = file.pos;
  22278. file.pos = file.start ? file.start : 0;
  22279. file.skip(offset);
  22280. var data = file.getBytes(length);
  22281. file.pos = previousPosition;
  22282. if (tag === "head") {
  22283. data[8] = data[9] = data[10] = data[11] = 0;
  22284. data[17] |= 0x20;
  22285. }
  22286. return {
  22287. tag,
  22288. checksum,
  22289. length,
  22290. offset,
  22291. data
  22292. };
  22293. }
  22294. function readOpenTypeHeader(ttf) {
  22295. return {
  22296. version: (0, _util.bytesToString)(ttf.getBytes(4)),
  22297. numTables: ttf.getUint16(),
  22298. searchRange: ttf.getUint16(),
  22299. entrySelector: ttf.getUint16(),
  22300. rangeShift: ttf.getUint16()
  22301. };
  22302. }
  22303. function readTrueTypeCollectionHeader(ttc) {
  22304. const ttcTag = (0, _util.bytesToString)(ttc.getBytes(4));
  22305. (0, _util.assert)(ttcTag === "ttcf", "Must be a TrueType Collection font.");
  22306. const majorVersion = ttc.getUint16();
  22307. const minorVersion = ttc.getUint16();
  22308. const numFonts = ttc.getInt32() >>> 0;
  22309. const offsetTable = [];
  22310. for (let i = 0; i < numFonts; i++) {
  22311. offsetTable.push(ttc.getInt32() >>> 0);
  22312. }
  22313. const header = {
  22314. ttcTag,
  22315. majorVersion,
  22316. minorVersion,
  22317. numFonts,
  22318. offsetTable
  22319. };
  22320. switch (majorVersion) {
  22321. case 1:
  22322. return header;
  22323. case 2:
  22324. header.dsigTag = ttc.getInt32() >>> 0;
  22325. header.dsigLength = ttc.getInt32() >>> 0;
  22326. header.dsigOffset = ttc.getInt32() >>> 0;
  22327. return header;
  22328. }
  22329. throw new _util.FormatError(`Invalid TrueType Collection majorVersion: ${majorVersion}.`);
  22330. }
  22331. function readTrueTypeCollectionData(ttc, fontName) {
  22332. const {
  22333. numFonts,
  22334. offsetTable
  22335. } = readTrueTypeCollectionHeader(ttc);
  22336. for (let i = 0; i < numFonts; i++) {
  22337. ttc.pos = (ttc.start || 0) + offsetTable[i];
  22338. const potentialHeader = readOpenTypeHeader(ttc);
  22339. const potentialTables = readTables(ttc, potentialHeader.numTables);
  22340. if (!potentialTables.name) {
  22341. throw new _util.FormatError('TrueType Collection font must contain a "name" table.');
  22342. }
  22343. const nameTable = readNameTable(potentialTables.name);
  22344. for (let j = 0, jj = nameTable.length; j < jj; j++) {
  22345. for (let k = 0, kk = nameTable[j].length; k < kk; k++) {
  22346. const nameEntry = nameTable[j][k];
  22347. if (nameEntry && nameEntry.replace(/\s/g, "") === fontName) {
  22348. return {
  22349. header: potentialHeader,
  22350. tables: potentialTables
  22351. };
  22352. }
  22353. }
  22354. }
  22355. }
  22356. throw new _util.FormatError(`TrueType Collection does not contain "${fontName}" font.`);
  22357. }
  22358. function readCmapTable(cmap, file, isSymbolicFont, hasEncoding) {
  22359. if (!cmap) {
  22360. (0, _util.warn)("No cmap table available.");
  22361. return {
  22362. platformId: -1,
  22363. encodingId: -1,
  22364. mappings: [],
  22365. hasShortCmap: false
  22366. };
  22367. }
  22368. var segment;
  22369. var start = (file.start ? file.start : 0) + cmap.offset;
  22370. file.pos = start;
  22371. file.skip(2);
  22372. var numTables = file.getUint16();
  22373. var potentialTable;
  22374. var canBreak = false;
  22375. for (var i = 0; i < numTables; i++) {
  22376. var platformId = file.getUint16();
  22377. var encodingId = file.getUint16();
  22378. var offset = file.getInt32() >>> 0;
  22379. var useTable = false;
  22380. if (potentialTable && potentialTable.platformId === platformId && potentialTable.encodingId === encodingId) {
  22381. continue;
  22382. }
  22383. if (platformId === 0 && (encodingId === 0 || encodingId === 1 || encodingId === 3)) {
  22384. useTable = true;
  22385. } else if (platformId === 1 && encodingId === 0) {
  22386. useTable = true;
  22387. } else if (platformId === 3 && encodingId === 1 && (hasEncoding || !potentialTable)) {
  22388. useTable = true;
  22389. if (!isSymbolicFont) {
  22390. canBreak = true;
  22391. }
  22392. } else if (isSymbolicFont && platformId === 3 && encodingId === 0) {
  22393. useTable = true;
  22394. canBreak = true;
  22395. }
  22396. if (useTable) {
  22397. potentialTable = {
  22398. platformId,
  22399. encodingId,
  22400. offset
  22401. };
  22402. }
  22403. if (canBreak) {
  22404. break;
  22405. }
  22406. }
  22407. if (potentialTable) {
  22408. file.pos = start + potentialTable.offset;
  22409. }
  22410. if (!potentialTable || file.peekByte() === -1) {
  22411. (0, _util.warn)("Could not find a preferred cmap table.");
  22412. return {
  22413. platformId: -1,
  22414. encodingId: -1,
  22415. mappings: [],
  22416. hasShortCmap: false
  22417. };
  22418. }
  22419. var format = file.getUint16();
  22420. file.skip(2 + 2);
  22421. var hasShortCmap = false;
  22422. var mappings = [];
  22423. var j, glyphId;
  22424. if (format === 0) {
  22425. for (j = 0; j < 256; j++) {
  22426. var index = file.getByte();
  22427. if (!index) {
  22428. continue;
  22429. }
  22430. mappings.push({
  22431. charCode: j,
  22432. glyphId: index
  22433. });
  22434. }
  22435. hasShortCmap = true;
  22436. } else if (format === 4) {
  22437. var segCount = file.getUint16() >> 1;
  22438. file.skip(6);
  22439. var segIndex,
  22440. segments = [];
  22441. for (segIndex = 0; segIndex < segCount; segIndex++) {
  22442. segments.push({
  22443. end: file.getUint16()
  22444. });
  22445. }
  22446. file.skip(2);
  22447. for (segIndex = 0; segIndex < segCount; segIndex++) {
  22448. segments[segIndex].start = file.getUint16();
  22449. }
  22450. for (segIndex = 0; segIndex < segCount; segIndex++) {
  22451. segments[segIndex].delta = file.getUint16();
  22452. }
  22453. var offsetsCount = 0;
  22454. for (segIndex = 0; segIndex < segCount; segIndex++) {
  22455. segment = segments[segIndex];
  22456. var rangeOffset = file.getUint16();
  22457. if (!rangeOffset) {
  22458. segment.offsetIndex = -1;
  22459. continue;
  22460. }
  22461. var offsetIndex = (rangeOffset >> 1) - (segCount - segIndex);
  22462. segment.offsetIndex = offsetIndex;
  22463. offsetsCount = Math.max(offsetsCount, offsetIndex + segment.end - segment.start + 1);
  22464. }
  22465. var offsets = [];
  22466. for (j = 0; j < offsetsCount; j++) {
  22467. offsets.push(file.getUint16());
  22468. }
  22469. for (segIndex = 0; segIndex < segCount; segIndex++) {
  22470. segment = segments[segIndex];
  22471. start = segment.start;
  22472. var end = segment.end;
  22473. var delta = segment.delta;
  22474. offsetIndex = segment.offsetIndex;
  22475. for (j = start; j <= end; j++) {
  22476. if (j === 0xffff) {
  22477. continue;
  22478. }
  22479. glyphId = offsetIndex < 0 ? j : offsets[offsetIndex + j - start];
  22480. glyphId = glyphId + delta & 0xffff;
  22481. mappings.push({
  22482. charCode: j,
  22483. glyphId
  22484. });
  22485. }
  22486. }
  22487. } else if (format === 6) {
  22488. var firstCode = file.getUint16();
  22489. var entryCount = file.getUint16();
  22490. for (j = 0; j < entryCount; j++) {
  22491. glyphId = file.getUint16();
  22492. var charCode = firstCode + j;
  22493. mappings.push({
  22494. charCode,
  22495. glyphId
  22496. });
  22497. }
  22498. } else {
  22499. (0, _util.warn)("cmap table has unsupported format: " + format);
  22500. return {
  22501. platformId: -1,
  22502. encodingId: -1,
  22503. mappings: [],
  22504. hasShortCmap: false
  22505. };
  22506. }
  22507. mappings.sort(function (a, b) {
  22508. return a.charCode - b.charCode;
  22509. });
  22510. for (i = 1; i < mappings.length; i++) {
  22511. if (mappings[i - 1].charCode === mappings[i].charCode) {
  22512. mappings.splice(i, 1);
  22513. i--;
  22514. }
  22515. }
  22516. return {
  22517. platformId: potentialTable.platformId,
  22518. encodingId: potentialTable.encodingId,
  22519. mappings,
  22520. hasShortCmap
  22521. };
  22522. }
  22523. function sanitizeMetrics(file, header, metrics, numGlyphs, dupFirstEntry) {
  22524. if (!header) {
  22525. if (metrics) {
  22526. metrics.data = null;
  22527. }
  22528. return;
  22529. }
  22530. file.pos = (file.start ? file.start : 0) + header.offset;
  22531. file.pos += 4;
  22532. file.pos += 2;
  22533. file.pos += 2;
  22534. file.pos += 2;
  22535. file.pos += 2;
  22536. file.pos += 2;
  22537. file.pos += 2;
  22538. file.pos += 2;
  22539. file.pos += 2;
  22540. file.pos += 2;
  22541. file.pos += 2;
  22542. file.pos += 8;
  22543. file.pos += 2;
  22544. var numOfMetrics = file.getUint16();
  22545. if (numOfMetrics > numGlyphs) {
  22546. (0, _util.info)("The numOfMetrics (" + numOfMetrics + ") should not be " + "greater than the numGlyphs (" + numGlyphs + ")");
  22547. numOfMetrics = numGlyphs;
  22548. header.data[34] = (numOfMetrics & 0xff00) >> 8;
  22549. header.data[35] = numOfMetrics & 0x00ff;
  22550. }
  22551. var numOfSidebearings = numGlyphs - numOfMetrics;
  22552. var numMissing = numOfSidebearings - (metrics.length - numOfMetrics * 4 >> 1);
  22553. if (numMissing > 0) {
  22554. var entries = new Uint8Array(metrics.length + numMissing * 2);
  22555. entries.set(metrics.data);
  22556. if (dupFirstEntry) {
  22557. entries[metrics.length] = metrics.data[2];
  22558. entries[metrics.length + 1] = metrics.data[3];
  22559. }
  22560. metrics.data = entries;
  22561. }
  22562. }
  22563. function sanitizeGlyph(source, sourceStart, sourceEnd, dest, destStart, hintsValid) {
  22564. var glyphProfile = {
  22565. length: 0,
  22566. sizeOfInstructions: 0
  22567. };
  22568. if (sourceEnd - sourceStart <= 12) {
  22569. return glyphProfile;
  22570. }
  22571. var glyf = source.subarray(sourceStart, sourceEnd);
  22572. var contoursCount = signedInt16(glyf[0], glyf[1]);
  22573. if (contoursCount < 0) {
  22574. contoursCount = -1;
  22575. writeSignedInt16(glyf, 0, contoursCount);
  22576. dest.set(glyf, destStart);
  22577. glyphProfile.length = glyf.length;
  22578. return glyphProfile;
  22579. }
  22580. var i,
  22581. j = 10,
  22582. flagsCount = 0;
  22583. for (i = 0; i < contoursCount; i++) {
  22584. var endPoint = glyf[j] << 8 | glyf[j + 1];
  22585. flagsCount = endPoint + 1;
  22586. j += 2;
  22587. }
  22588. var instructionsStart = j;
  22589. var instructionsLength = glyf[j] << 8 | glyf[j + 1];
  22590. glyphProfile.sizeOfInstructions = instructionsLength;
  22591. j += 2 + instructionsLength;
  22592. var instructionsEnd = j;
  22593. var coordinatesLength = 0;
  22594. for (i = 0; i < flagsCount; i++) {
  22595. var flag = glyf[j++];
  22596. if (flag & 0xc0) {
  22597. glyf[j - 1] = flag & 0x3f;
  22598. }
  22599. let xLength = 2;
  22600. if (flag & 2) {
  22601. xLength = 1;
  22602. } else if (flag & 16) {
  22603. xLength = 0;
  22604. }
  22605. let yLength = 2;
  22606. if (flag & 4) {
  22607. yLength = 1;
  22608. } else if (flag & 32) {
  22609. yLength = 0;
  22610. }
  22611. const xyLength = xLength + yLength;
  22612. coordinatesLength += xyLength;
  22613. if (flag & 8) {
  22614. var repeat = glyf[j++];
  22615. i += repeat;
  22616. coordinatesLength += repeat * xyLength;
  22617. }
  22618. }
  22619. if (coordinatesLength === 0) {
  22620. return glyphProfile;
  22621. }
  22622. var glyphDataLength = j + coordinatesLength;
  22623. if (glyphDataLength > glyf.length) {
  22624. return glyphProfile;
  22625. }
  22626. if (!hintsValid && instructionsLength > 0) {
  22627. dest.set(glyf.subarray(0, instructionsStart), destStart);
  22628. dest.set([0, 0], destStart + instructionsStart);
  22629. dest.set(glyf.subarray(instructionsEnd, glyphDataLength), destStart + instructionsStart + 2);
  22630. glyphDataLength -= instructionsLength;
  22631. if (glyf.length - glyphDataLength > 3) {
  22632. glyphDataLength = glyphDataLength + 3 & ~3;
  22633. }
  22634. glyphProfile.length = glyphDataLength;
  22635. return glyphProfile;
  22636. }
  22637. if (glyf.length - glyphDataLength > 3) {
  22638. glyphDataLength = glyphDataLength + 3 & ~3;
  22639. dest.set(glyf.subarray(0, glyphDataLength), destStart);
  22640. glyphProfile.length = glyphDataLength;
  22641. return glyphProfile;
  22642. }
  22643. dest.set(glyf, destStart);
  22644. glyphProfile.length = glyf.length;
  22645. return glyphProfile;
  22646. }
  22647. function sanitizeHead(head, numGlyphs, locaLength) {
  22648. var data = head.data;
  22649. var version = int32(data[0], data[1], data[2], data[3]);
  22650. if (version >> 16 !== 1) {
  22651. (0, _util.info)("Attempting to fix invalid version in head table: " + version);
  22652. data[0] = 0;
  22653. data[1] = 1;
  22654. data[2] = 0;
  22655. data[3] = 0;
  22656. }
  22657. var indexToLocFormat = int16(data[50], data[51]);
  22658. if (indexToLocFormat < 0 || indexToLocFormat > 1) {
  22659. (0, _util.info)("Attempting to fix invalid indexToLocFormat in head table: " + indexToLocFormat);
  22660. var numGlyphsPlusOne = numGlyphs + 1;
  22661. if (locaLength === numGlyphsPlusOne << 1) {
  22662. data[50] = 0;
  22663. data[51] = 0;
  22664. } else if (locaLength === numGlyphsPlusOne << 2) {
  22665. data[50] = 0;
  22666. data[51] = 1;
  22667. } else {
  22668. throw new _util.FormatError("Could not fix indexToLocFormat: " + indexToLocFormat);
  22669. }
  22670. }
  22671. }
  22672. function sanitizeGlyphLocations(loca, glyf, numGlyphs, isGlyphLocationsLong, hintsValid, dupFirstEntry, maxSizeOfInstructions) {
  22673. var itemSize, itemDecode, itemEncode;
  22674. if (isGlyphLocationsLong) {
  22675. itemSize = 4;
  22676. itemDecode = function fontItemDecodeLong(data, offset) {
  22677. return data[offset] << 24 | data[offset + 1] << 16 | data[offset + 2] << 8 | data[offset + 3];
  22678. };
  22679. itemEncode = function fontItemEncodeLong(data, offset, value) {
  22680. data[offset] = value >>> 24 & 0xff;
  22681. data[offset + 1] = value >> 16 & 0xff;
  22682. data[offset + 2] = value >> 8 & 0xff;
  22683. data[offset + 3] = value & 0xff;
  22684. };
  22685. } else {
  22686. itemSize = 2;
  22687. itemDecode = function fontItemDecode(data, offset) {
  22688. return data[offset] << 9 | data[offset + 1] << 1;
  22689. };
  22690. itemEncode = function fontItemEncode(data, offset, value) {
  22691. data[offset] = value >> 9 & 0xff;
  22692. data[offset + 1] = value >> 1 & 0xff;
  22693. };
  22694. }
  22695. var numGlyphsOut = dupFirstEntry ? numGlyphs + 1 : numGlyphs;
  22696. var locaDataSize = itemSize * (1 + numGlyphsOut);
  22697. var locaData = new Uint8Array(locaDataSize);
  22698. locaData.set(loca.data.subarray(0, locaDataSize));
  22699. loca.data = locaData;
  22700. var oldGlyfData = glyf.data;
  22701. var oldGlyfDataLength = oldGlyfData.length;
  22702. var newGlyfData = new Uint8Array(oldGlyfDataLength);
  22703. var i, j;
  22704. const locaEntries = [];
  22705. for (i = 0, j = 0; i < numGlyphs + 1; i++, j += itemSize) {
  22706. let offset = itemDecode(locaData, j);
  22707. if (offset > oldGlyfDataLength) {
  22708. offset = oldGlyfDataLength;
  22709. }
  22710. locaEntries.push({
  22711. index: i,
  22712. offset,
  22713. endOffset: 0
  22714. });
  22715. }
  22716. locaEntries.sort((a, b) => {
  22717. return a.offset - b.offset;
  22718. });
  22719. for (i = 0; i < numGlyphs; i++) {
  22720. locaEntries[i].endOffset = locaEntries[i + 1].offset;
  22721. }
  22722. locaEntries.sort((a, b) => {
  22723. return a.index - b.index;
  22724. });
  22725. var missingGlyphs = Object.create(null);
  22726. var writeOffset = 0;
  22727. itemEncode(locaData, 0, writeOffset);
  22728. for (i = 0, j = itemSize; i < numGlyphs; i++, j += itemSize) {
  22729. var glyphProfile = sanitizeGlyph(oldGlyfData, locaEntries[i].offset, locaEntries[i].endOffset, newGlyfData, writeOffset, hintsValid);
  22730. var newLength = glyphProfile.length;
  22731. if (newLength === 0) {
  22732. missingGlyphs[i] = true;
  22733. }
  22734. if (glyphProfile.sizeOfInstructions > maxSizeOfInstructions) {
  22735. maxSizeOfInstructions = glyphProfile.sizeOfInstructions;
  22736. }
  22737. writeOffset += newLength;
  22738. itemEncode(locaData, j, writeOffset);
  22739. }
  22740. if (writeOffset === 0) {
  22741. var simpleGlyph = new Uint8Array([0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 49, 0]);
  22742. for (i = 0, j = itemSize; i < numGlyphsOut; i++, j += itemSize) {
  22743. itemEncode(locaData, j, simpleGlyph.length);
  22744. }
  22745. glyf.data = simpleGlyph;
  22746. } else if (dupFirstEntry) {
  22747. var firstEntryLength = itemDecode(locaData, itemSize);
  22748. if (newGlyfData.length > firstEntryLength + writeOffset) {
  22749. glyf.data = newGlyfData.subarray(0, firstEntryLength + writeOffset);
  22750. } else {
  22751. glyf.data = new Uint8Array(firstEntryLength + writeOffset);
  22752. glyf.data.set(newGlyfData.subarray(0, writeOffset));
  22753. }
  22754. glyf.data.set(newGlyfData.subarray(0, firstEntryLength), writeOffset);
  22755. itemEncode(loca.data, locaData.length - itemSize, writeOffset + firstEntryLength);
  22756. } else {
  22757. glyf.data = newGlyfData.subarray(0, writeOffset);
  22758. }
  22759. return {
  22760. missingGlyphs,
  22761. maxSizeOfInstructions
  22762. };
  22763. }
  22764. function readPostScriptTable(post, propertiesObj, maxpNumGlyphs) {
  22765. var start = (font.start ? font.start : 0) + post.offset;
  22766. font.pos = start;
  22767. var length = post.length,
  22768. end = start + length;
  22769. var version = font.getInt32();
  22770. font.skip(28);
  22771. var glyphNames;
  22772. var valid = true;
  22773. var i;
  22774. switch (version) {
  22775. case 0x00010000:
  22776. glyphNames = MacStandardGlyphOrdering;
  22777. break;
  22778. case 0x00020000:
  22779. var numGlyphs = font.getUint16();
  22780. if (numGlyphs !== maxpNumGlyphs) {
  22781. valid = false;
  22782. break;
  22783. }
  22784. var glyphNameIndexes = [];
  22785. for (i = 0; i < numGlyphs; ++i) {
  22786. var index = font.getUint16();
  22787. if (index >= 32768) {
  22788. valid = false;
  22789. break;
  22790. }
  22791. glyphNameIndexes.push(index);
  22792. }
  22793. if (!valid) {
  22794. break;
  22795. }
  22796. var customNames = [];
  22797. var strBuf = [];
  22798. while (font.pos < end) {
  22799. var stringLength = font.getByte();
  22800. strBuf.length = stringLength;
  22801. for (i = 0; i < stringLength; ++i) {
  22802. strBuf[i] = String.fromCharCode(font.getByte());
  22803. }
  22804. customNames.push(strBuf.join(""));
  22805. }
  22806. glyphNames = [];
  22807. for (i = 0; i < numGlyphs; ++i) {
  22808. var j = glyphNameIndexes[i];
  22809. if (j < 258) {
  22810. glyphNames.push(MacStandardGlyphOrdering[j]);
  22811. continue;
  22812. }
  22813. glyphNames.push(customNames[j - 258]);
  22814. }
  22815. break;
  22816. case 0x00030000:
  22817. break;
  22818. default:
  22819. (0, _util.warn)("Unknown/unsupported post table version " + version);
  22820. valid = false;
  22821. if (propertiesObj.defaultEncoding) {
  22822. glyphNames = propertiesObj.defaultEncoding;
  22823. }
  22824. break;
  22825. }
  22826. propertiesObj.glyphNames = glyphNames;
  22827. return valid;
  22828. }
  22829. function readNameTable(nameTable) {
  22830. var start = (font.start ? font.start : 0) + nameTable.offset;
  22831. font.pos = start;
  22832. var names = [[], []];
  22833. var length = nameTable.length,
  22834. end = start + length;
  22835. var format = font.getUint16();
  22836. var FORMAT_0_HEADER_LENGTH = 6;
  22837. if (format !== 0 || length < FORMAT_0_HEADER_LENGTH) {
  22838. return names;
  22839. }
  22840. var numRecords = font.getUint16();
  22841. var stringsStart = font.getUint16();
  22842. var records = [];
  22843. var NAME_RECORD_LENGTH = 12;
  22844. var i, ii;
  22845. for (i = 0; i < numRecords && font.pos + NAME_RECORD_LENGTH <= end; i++) {
  22846. var r = {
  22847. platform: font.getUint16(),
  22848. encoding: font.getUint16(),
  22849. language: font.getUint16(),
  22850. name: font.getUint16(),
  22851. length: font.getUint16(),
  22852. offset: font.getUint16()
  22853. };
  22854. if (r.platform === 1 && r.encoding === 0 && r.language === 0 || r.platform === 3 && r.encoding === 1 && r.language === 0x409) {
  22855. records.push(r);
  22856. }
  22857. }
  22858. for (i = 0, ii = records.length; i < ii; i++) {
  22859. var record = records[i];
  22860. if (record.length <= 0) {
  22861. continue;
  22862. }
  22863. var pos = start + stringsStart + record.offset;
  22864. if (pos + record.length > end) {
  22865. continue;
  22866. }
  22867. font.pos = pos;
  22868. var nameIndex = record.name;
  22869. if (record.encoding) {
  22870. var str = "";
  22871. for (var j = 0, jj = record.length; j < jj; j += 2) {
  22872. str += String.fromCharCode(font.getUint16());
  22873. }
  22874. names[1][nameIndex] = str;
  22875. } else {
  22876. names[0][nameIndex] = (0, _util.bytesToString)(font.getBytes(record.length));
  22877. }
  22878. }
  22879. return names;
  22880. }
  22881. var TTOpsStackDeltas = [0, 0, 0, 0, 0, 0, 0, 0, -2, -2, -2, -2, 0, 0, -2, -5, -1, -1, -1, -1, -1, -1, -1, -1, 0, 0, -1, 0, -1, -1, -1, -1, 1, -1, -999, 0, 1, 0, -1, -2, 0, -1, -2, -1, -1, 0, -1, -1, 0, 0, -999, -999, -1, -1, -1, -1, -2, -999, -2, -2, -999, 0, -2, -2, 0, 0, -2, 0, -2, 0, 0, 0, -2, -1, -1, 1, 1, 0, 0, -1, -1, -1, -1, -1, -1, -1, 0, 0, -1, 0, -1, -1, 0, -999, -1, -1, -1, -1, -1, -1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -2, -999, -999, -999, -999, -999, -1, -1, -2, -2, 0, 0, 0, 0, -1, -1, -999, -2, -2, 0, 0, -1, -2, -2, 0, 0, 0, -1, -1, -1, -2];
  22882. function sanitizeTTProgram(table, ttContext) {
  22883. var data = table.data;
  22884. var i = 0,
  22885. j,
  22886. n,
  22887. b,
  22888. funcId,
  22889. pc,
  22890. lastEndf = 0,
  22891. lastDeff = 0;
  22892. var stack = [];
  22893. var callstack = [];
  22894. var functionsCalled = [];
  22895. var tooComplexToFollowFunctions = ttContext.tooComplexToFollowFunctions;
  22896. var inFDEF = false,
  22897. ifLevel = 0,
  22898. inELSE = 0;
  22899. for (var ii = data.length; i < ii;) {
  22900. var op = data[i++];
  22901. if (op === 0x40) {
  22902. n = data[i++];
  22903. if (inFDEF || inELSE) {
  22904. i += n;
  22905. } else {
  22906. for (j = 0; j < n; j++) {
  22907. stack.push(data[i++]);
  22908. }
  22909. }
  22910. } else if (op === 0x41) {
  22911. n = data[i++];
  22912. if (inFDEF || inELSE) {
  22913. i += n * 2;
  22914. } else {
  22915. for (j = 0; j < n; j++) {
  22916. b = data[i++];
  22917. stack.push(b << 8 | data[i++]);
  22918. }
  22919. }
  22920. } else if ((op & 0xf8) === 0xb0) {
  22921. n = op - 0xb0 + 1;
  22922. if (inFDEF || inELSE) {
  22923. i += n;
  22924. } else {
  22925. for (j = 0; j < n; j++) {
  22926. stack.push(data[i++]);
  22927. }
  22928. }
  22929. } else if ((op & 0xf8) === 0xb8) {
  22930. n = op - 0xb8 + 1;
  22931. if (inFDEF || inELSE) {
  22932. i += n * 2;
  22933. } else {
  22934. for (j = 0; j < n; j++) {
  22935. b = data[i++];
  22936. stack.push(b << 8 | data[i++]);
  22937. }
  22938. }
  22939. } else if (op === 0x2b && !tooComplexToFollowFunctions) {
  22940. if (!inFDEF && !inELSE) {
  22941. funcId = stack[stack.length - 1];
  22942. if (isNaN(funcId)) {
  22943. (0, _util.info)("TT: CALL empty stack (or invalid entry).");
  22944. } else {
  22945. ttContext.functionsUsed[funcId] = true;
  22946. if (funcId in ttContext.functionsStackDeltas) {
  22947. const newStackLength = stack.length + ttContext.functionsStackDeltas[funcId];
  22948. if (newStackLength < 0) {
  22949. (0, _util.warn)("TT: CALL invalid functions stack delta.");
  22950. ttContext.hintsValid = false;
  22951. return;
  22952. }
  22953. stack.length = newStackLength;
  22954. } else if (funcId in ttContext.functionsDefined && !functionsCalled.includes(funcId)) {
  22955. callstack.push({
  22956. data,
  22957. i,
  22958. stackTop: stack.length - 1
  22959. });
  22960. functionsCalled.push(funcId);
  22961. pc = ttContext.functionsDefined[funcId];
  22962. if (!pc) {
  22963. (0, _util.warn)("TT: CALL non-existent function");
  22964. ttContext.hintsValid = false;
  22965. return;
  22966. }
  22967. data = pc.data;
  22968. i = pc.i;
  22969. }
  22970. }
  22971. }
  22972. } else if (op === 0x2c && !tooComplexToFollowFunctions) {
  22973. if (inFDEF || inELSE) {
  22974. (0, _util.warn)("TT: nested FDEFs not allowed");
  22975. tooComplexToFollowFunctions = true;
  22976. }
  22977. inFDEF = true;
  22978. lastDeff = i;
  22979. funcId = stack.pop();
  22980. ttContext.functionsDefined[funcId] = {
  22981. data,
  22982. i
  22983. };
  22984. } else if (op === 0x2d) {
  22985. if (inFDEF) {
  22986. inFDEF = false;
  22987. lastEndf = i;
  22988. } else {
  22989. pc = callstack.pop();
  22990. if (!pc) {
  22991. (0, _util.warn)("TT: ENDF bad stack");
  22992. ttContext.hintsValid = false;
  22993. return;
  22994. }
  22995. funcId = functionsCalled.pop();
  22996. data = pc.data;
  22997. i = pc.i;
  22998. ttContext.functionsStackDeltas[funcId] = stack.length - pc.stackTop;
  22999. }
  23000. } else if (op === 0x89) {
  23001. if (inFDEF || inELSE) {
  23002. (0, _util.warn)("TT: nested IDEFs not allowed");
  23003. tooComplexToFollowFunctions = true;
  23004. }
  23005. inFDEF = true;
  23006. lastDeff = i;
  23007. } else if (op === 0x58) {
  23008. ++ifLevel;
  23009. } else if (op === 0x1b) {
  23010. inELSE = ifLevel;
  23011. } else if (op === 0x59) {
  23012. if (inELSE === ifLevel) {
  23013. inELSE = 0;
  23014. }
  23015. --ifLevel;
  23016. } else if (op === 0x1c) {
  23017. if (!inFDEF && !inELSE) {
  23018. var offset = stack[stack.length - 1];
  23019. if (offset > 0) {
  23020. i += offset - 1;
  23021. }
  23022. }
  23023. }
  23024. if (!inFDEF && !inELSE) {
  23025. let stackDelta = 0;
  23026. if (op <= 0x8e) {
  23027. stackDelta = TTOpsStackDeltas[op];
  23028. } else if (op >= 0xc0 && op <= 0xdf) {
  23029. stackDelta = -1;
  23030. } else if (op >= 0xe0) {
  23031. stackDelta = -2;
  23032. }
  23033. if (op >= 0x71 && op <= 0x75) {
  23034. n = stack.pop();
  23035. if (!isNaN(n)) {
  23036. stackDelta = -n * 2;
  23037. }
  23038. }
  23039. while (stackDelta < 0 && stack.length > 0) {
  23040. stack.pop();
  23041. stackDelta++;
  23042. }
  23043. while (stackDelta > 0) {
  23044. stack.push(NaN);
  23045. stackDelta--;
  23046. }
  23047. }
  23048. }
  23049. ttContext.tooComplexToFollowFunctions = tooComplexToFollowFunctions;
  23050. var content = [data];
  23051. if (i > data.length) {
  23052. content.push(new Uint8Array(i - data.length));
  23053. }
  23054. if (lastDeff > lastEndf) {
  23055. (0, _util.warn)("TT: complementing a missing function tail");
  23056. content.push(new Uint8Array([0x22, 0x2d]));
  23057. }
  23058. foldTTTable(table, content);
  23059. }
  23060. function checkInvalidFunctions(ttContext, maxFunctionDefs) {
  23061. if (ttContext.tooComplexToFollowFunctions) {
  23062. return;
  23063. }
  23064. if (ttContext.functionsDefined.length > maxFunctionDefs) {
  23065. (0, _util.warn)("TT: more functions defined than expected");
  23066. ttContext.hintsValid = false;
  23067. return;
  23068. }
  23069. for (var j = 0, jj = ttContext.functionsUsed.length; j < jj; j++) {
  23070. if (j > maxFunctionDefs) {
  23071. (0, _util.warn)("TT: invalid function id: " + j);
  23072. ttContext.hintsValid = false;
  23073. return;
  23074. }
  23075. if (ttContext.functionsUsed[j] && !ttContext.functionsDefined[j]) {
  23076. (0, _util.warn)("TT: undefined function: " + j);
  23077. ttContext.hintsValid = false;
  23078. return;
  23079. }
  23080. }
  23081. }
  23082. function foldTTTable(table, content) {
  23083. if (content.length > 1) {
  23084. var newLength = 0;
  23085. var j, jj;
  23086. for (j = 0, jj = content.length; j < jj; j++) {
  23087. newLength += content[j].length;
  23088. }
  23089. newLength = newLength + 3 & ~3;
  23090. var result = new Uint8Array(newLength);
  23091. var pos = 0;
  23092. for (j = 0, jj = content.length; j < jj; j++) {
  23093. result.set(content[j], pos);
  23094. pos += content[j].length;
  23095. }
  23096. table.data = result;
  23097. table.length = newLength;
  23098. }
  23099. }
  23100. function sanitizeTTPrograms(fpgm, prep, cvt, maxFunctionDefs) {
  23101. var ttContext = {
  23102. functionsDefined: [],
  23103. functionsUsed: [],
  23104. functionsStackDeltas: [],
  23105. tooComplexToFollowFunctions: false,
  23106. hintsValid: true
  23107. };
  23108. if (fpgm) {
  23109. sanitizeTTProgram(fpgm, ttContext);
  23110. }
  23111. if (prep) {
  23112. sanitizeTTProgram(prep, ttContext);
  23113. }
  23114. if (fpgm) {
  23115. checkInvalidFunctions(ttContext, maxFunctionDefs);
  23116. }
  23117. if (cvt && cvt.length & 1) {
  23118. var cvtData = new Uint8Array(cvt.length + 1);
  23119. cvtData.set(cvt.data);
  23120. cvt.data = cvtData;
  23121. }
  23122. return ttContext.hintsValid;
  23123. }
  23124. font = new _stream.Stream(new Uint8Array(font.getBytes()));
  23125. let header, tables;
  23126. if (isTrueTypeCollectionFile(font)) {
  23127. const ttcData = readTrueTypeCollectionData(font, this.name);
  23128. header = ttcData.header;
  23129. tables = ttcData.tables;
  23130. } else {
  23131. header = readOpenTypeHeader(font);
  23132. tables = readTables(font, header.numTables);
  23133. }
  23134. let cff, cffFile;
  23135. var isTrueType = !tables["CFF "];
  23136. if (!isTrueType) {
  23137. const isComposite = properties.composite && ((properties.cidToGidMap || []).length > 0 || !(properties.cMap instanceof _cmap.IdentityCMap));
  23138. if (header.version === "OTTO" && !isComposite || !tables.head || !tables.hhea || !tables.maxp || !tables.post) {
  23139. cffFile = new _stream.Stream(tables["CFF "].data);
  23140. cff = new CFFFont(cffFile, properties);
  23141. adjustWidths(properties);
  23142. return this.convert(name, cff, properties);
  23143. }
  23144. delete tables.glyf;
  23145. delete tables.loca;
  23146. delete tables.fpgm;
  23147. delete tables.prep;
  23148. delete tables["cvt "];
  23149. this.isOpenType = true;
  23150. } else {
  23151. if (!tables.loca) {
  23152. throw new _util.FormatError('Required "loca" table is not found');
  23153. }
  23154. if (!tables.glyf) {
  23155. (0, _util.warn)('Required "glyf" table is not found -- trying to recover.');
  23156. tables.glyf = {
  23157. tag: "glyf",
  23158. data: new Uint8Array(0)
  23159. };
  23160. }
  23161. this.isOpenType = false;
  23162. }
  23163. if (!tables.maxp) {
  23164. throw new _util.FormatError('Required "maxp" table is not found');
  23165. }
  23166. font.pos = (font.start || 0) + tables.maxp.offset;
  23167. var version = font.getInt32();
  23168. const numGlyphs = font.getUint16();
  23169. let numGlyphsOut = numGlyphs + 1;
  23170. let dupFirstEntry = true;
  23171. if (numGlyphsOut > 0xffff) {
  23172. dupFirstEntry = false;
  23173. numGlyphsOut = numGlyphs;
  23174. (0, _util.warn)("Not enough space in glyfs to duplicate first glyph.");
  23175. }
  23176. var maxFunctionDefs = 0;
  23177. var maxSizeOfInstructions = 0;
  23178. if (version >= 0x00010000 && tables.maxp.length >= 22) {
  23179. font.pos += 8;
  23180. var maxZones = font.getUint16();
  23181. if (maxZones > 2) {
  23182. tables.maxp.data[14] = 0;
  23183. tables.maxp.data[15] = 2;
  23184. }
  23185. font.pos += 4;
  23186. maxFunctionDefs = font.getUint16();
  23187. font.pos += 4;
  23188. maxSizeOfInstructions = font.getUint16();
  23189. }
  23190. tables.maxp.data[4] = numGlyphsOut >> 8;
  23191. tables.maxp.data[5] = numGlyphsOut & 255;
  23192. var hintsValid = sanitizeTTPrograms(tables.fpgm, tables.prep, tables["cvt "], maxFunctionDefs);
  23193. if (!hintsValid) {
  23194. delete tables.fpgm;
  23195. delete tables.prep;
  23196. delete tables["cvt "];
  23197. }
  23198. sanitizeMetrics(font, tables.hhea, tables.hmtx, numGlyphsOut, dupFirstEntry);
  23199. if (!tables.head) {
  23200. throw new _util.FormatError('Required "head" table is not found');
  23201. }
  23202. sanitizeHead(tables.head, numGlyphs, isTrueType ? tables.loca.length : 0);
  23203. var missingGlyphs = Object.create(null);
  23204. if (isTrueType) {
  23205. var isGlyphLocationsLong = int16(tables.head.data[50], tables.head.data[51]);
  23206. var glyphsInfo = sanitizeGlyphLocations(tables.loca, tables.glyf, numGlyphs, isGlyphLocationsLong, hintsValid, dupFirstEntry, maxSizeOfInstructions);
  23207. missingGlyphs = glyphsInfo.missingGlyphs;
  23208. if (version >= 0x00010000 && tables.maxp.length >= 22) {
  23209. tables.maxp.data[26] = glyphsInfo.maxSizeOfInstructions >> 8;
  23210. tables.maxp.data[27] = glyphsInfo.maxSizeOfInstructions & 255;
  23211. }
  23212. }
  23213. if (!tables.hhea) {
  23214. throw new _util.FormatError('Required "hhea" table is not found');
  23215. }
  23216. if (tables.hhea.data[10] === 0 && tables.hhea.data[11] === 0) {
  23217. tables.hhea.data[10] = 0xff;
  23218. tables.hhea.data[11] = 0xff;
  23219. }
  23220. var metricsOverride = {
  23221. unitsPerEm: int16(tables.head.data[18], tables.head.data[19]),
  23222. yMax: int16(tables.head.data[42], tables.head.data[43]),
  23223. yMin: signedInt16(tables.head.data[38], tables.head.data[39]),
  23224. ascent: int16(tables.hhea.data[4], tables.hhea.data[5]),
  23225. descent: signedInt16(tables.hhea.data[6], tables.hhea.data[7])
  23226. };
  23227. this.ascent = metricsOverride.ascent / metricsOverride.unitsPerEm;
  23228. this.descent = metricsOverride.descent / metricsOverride.unitsPerEm;
  23229. if (tables.post) {
  23230. readPostScriptTable(tables.post, properties, numGlyphs);
  23231. }
  23232. tables.post = {
  23233. tag: "post",
  23234. data: createPostTable(properties)
  23235. };
  23236. const charCodeToGlyphId = [];
  23237. function hasGlyph(glyphId) {
  23238. return !missingGlyphs[glyphId];
  23239. }
  23240. if (properties.composite) {
  23241. var cidToGidMap = properties.cidToGidMap || [];
  23242. var isCidToGidMapEmpty = cidToGidMap.length === 0;
  23243. properties.cMap.forEach(function (charCode, cid) {
  23244. if (cid > 0xffff) {
  23245. throw new _util.FormatError("Max size of CID is 65,535");
  23246. }
  23247. var glyphId = -1;
  23248. if (isCidToGidMapEmpty) {
  23249. glyphId = cid;
  23250. } else if (cidToGidMap[cid] !== undefined) {
  23251. glyphId = cidToGidMap[cid];
  23252. }
  23253. if (glyphId >= 0 && glyphId < numGlyphs && hasGlyph(glyphId)) {
  23254. charCodeToGlyphId[charCode] = glyphId;
  23255. }
  23256. });
  23257. } else {
  23258. var cmapTable = readCmapTable(tables.cmap, font, this.isSymbolicFont, properties.hasEncoding);
  23259. var cmapPlatformId = cmapTable.platformId;
  23260. var cmapEncodingId = cmapTable.encodingId;
  23261. var cmapMappings = cmapTable.mappings;
  23262. var cmapMappingsLength = cmapMappings.length;
  23263. let baseEncoding = [];
  23264. if (properties.hasEncoding && (properties.baseEncodingName === "MacRomanEncoding" || properties.baseEncodingName === "WinAnsiEncoding")) {
  23265. baseEncoding = (0, _encodings.getEncoding)(properties.baseEncodingName);
  23266. }
  23267. if (properties.hasEncoding && !this.isSymbolicFont && (cmapPlatformId === 3 && cmapEncodingId === 1 || cmapPlatformId === 1 && cmapEncodingId === 0)) {
  23268. var glyphsUnicodeMap = (0, _glyphlist.getGlyphsUnicode)();
  23269. for (let charCode = 0; charCode < 256; charCode++) {
  23270. var glyphName, standardGlyphName;
  23271. if (this.differences && charCode in this.differences) {
  23272. glyphName = this.differences[charCode];
  23273. } else if (charCode in baseEncoding && baseEncoding[charCode] !== "") {
  23274. glyphName = baseEncoding[charCode];
  23275. } else {
  23276. glyphName = _encodings.StandardEncoding[charCode];
  23277. }
  23278. if (!glyphName) {
  23279. continue;
  23280. }
  23281. standardGlyphName = recoverGlyphName(glyphName, glyphsUnicodeMap);
  23282. var unicodeOrCharCode;
  23283. if (cmapPlatformId === 3 && cmapEncodingId === 1) {
  23284. unicodeOrCharCode = glyphsUnicodeMap[standardGlyphName];
  23285. } else if (cmapPlatformId === 1 && cmapEncodingId === 0) {
  23286. unicodeOrCharCode = _encodings.MacRomanEncoding.indexOf(standardGlyphName);
  23287. }
  23288. for (let i = 0; i < cmapMappingsLength; ++i) {
  23289. if (cmapMappings[i].charCode !== unicodeOrCharCode) {
  23290. continue;
  23291. }
  23292. charCodeToGlyphId[charCode] = cmapMappings[i].glyphId;
  23293. break;
  23294. }
  23295. }
  23296. } else if (cmapPlatformId === 0) {
  23297. for (let i = 0; i < cmapMappingsLength; ++i) {
  23298. charCodeToGlyphId[cmapMappings[i].charCode] = cmapMappings[i].glyphId;
  23299. }
  23300. } else {
  23301. for (let i = 0; i < cmapMappingsLength; ++i) {
  23302. let charCode = cmapMappings[i].charCode;
  23303. if (cmapPlatformId === 3 && charCode >= 0xf000 && charCode <= 0xf0ff) {
  23304. charCode &= 0xff;
  23305. }
  23306. charCodeToGlyphId[charCode] = cmapMappings[i].glyphId;
  23307. }
  23308. }
  23309. if (properties.glyphNames && baseEncoding.length) {
  23310. for (let i = 0; i < 256; ++i) {
  23311. if (charCodeToGlyphId[i] === undefined && baseEncoding[i]) {
  23312. glyphName = baseEncoding[i];
  23313. const glyphId = properties.glyphNames.indexOf(glyphName);
  23314. if (glyphId > 0 && hasGlyph(glyphId)) {
  23315. charCodeToGlyphId[i] = glyphId;
  23316. }
  23317. }
  23318. }
  23319. }
  23320. }
  23321. if (charCodeToGlyphId.length === 0) {
  23322. charCodeToGlyphId[0] = 0;
  23323. }
  23324. let glyphZeroId = numGlyphsOut - 1;
  23325. if (!dupFirstEntry) {
  23326. glyphZeroId = 0;
  23327. }
  23328. var newMapping = adjustMapping(charCodeToGlyphId, hasGlyph, glyphZeroId);
  23329. this.toFontChar = newMapping.toFontChar;
  23330. tables.cmap = {
  23331. tag: "cmap",
  23332. data: createCmapTable(newMapping.charCodeToGlyphId, numGlyphsOut)
  23333. };
  23334. if (!tables["OS/2"] || !validateOS2Table(tables["OS/2"], font)) {
  23335. tables["OS/2"] = {
  23336. tag: "OS/2",
  23337. data: createOS2Table(properties, newMapping.charCodeToGlyphId, metricsOverride)
  23338. };
  23339. }
  23340. if (!isTrueType) {
  23341. try {
  23342. cffFile = new _stream.Stream(tables["CFF "].data);
  23343. var parser = new _cff_parser.CFFParser(cffFile, properties, SEAC_ANALYSIS_ENABLED);
  23344. cff = parser.parse();
  23345. cff.duplicateFirstGlyph();
  23346. var compiler = new _cff_parser.CFFCompiler(cff);
  23347. tables["CFF "].data = compiler.compile();
  23348. } catch (e) {
  23349. (0, _util.warn)("Failed to compile font " + properties.loadedName);
  23350. }
  23351. }
  23352. if (!tables.name) {
  23353. tables.name = {
  23354. tag: "name",
  23355. data: createNameTable(this.name)
  23356. };
  23357. } else {
  23358. var namePrototype = readNameTable(tables.name);
  23359. tables.name.data = createNameTable(name, namePrototype);
  23360. }
  23361. var builder = new OpenTypeFileBuilder(header.version);
  23362. for (var tableTag in tables) {
  23363. builder.addTable(tableTag, tables[tableTag].data);
  23364. }
  23365. return builder.toArray();
  23366. },
  23367. convert: function Font_convert(fontName, font, properties) {
  23368. properties.fixedPitch = false;
  23369. if (properties.builtInEncoding) {
  23370. adjustToUnicode(properties, properties.builtInEncoding);
  23371. }
  23372. let glyphZeroId = 1;
  23373. if (font instanceof CFFFont) {
  23374. glyphZeroId = font.numGlyphs - 1;
  23375. }
  23376. var mapping = font.getGlyphMapping(properties);
  23377. var newMapping = adjustMapping(mapping, font.hasGlyphId.bind(font), glyphZeroId);
  23378. this.toFontChar = newMapping.toFontChar;
  23379. var numGlyphs = font.numGlyphs;
  23380. function getCharCodes(charCodeToGlyphId, glyphId) {
  23381. var charCodes = null;
  23382. for (var charCode in charCodeToGlyphId) {
  23383. if (glyphId === charCodeToGlyphId[charCode]) {
  23384. if (!charCodes) {
  23385. charCodes = [];
  23386. }
  23387. charCodes.push(charCode | 0);
  23388. }
  23389. }
  23390. return charCodes;
  23391. }
  23392. function createCharCode(charCodeToGlyphId, glyphId) {
  23393. for (var charCode in charCodeToGlyphId) {
  23394. if (glyphId === charCodeToGlyphId[charCode]) {
  23395. return charCode | 0;
  23396. }
  23397. }
  23398. newMapping.charCodeToGlyphId[newMapping.nextAvailableFontCharCode] = glyphId;
  23399. return newMapping.nextAvailableFontCharCode++;
  23400. }
  23401. var seacs = font.seacs;
  23402. if (SEAC_ANALYSIS_ENABLED && seacs && seacs.length) {
  23403. var matrix = properties.fontMatrix || _util.FONT_IDENTITY_MATRIX;
  23404. var charset = font.getCharset();
  23405. var seacMap = Object.create(null);
  23406. for (var glyphId in seacs) {
  23407. glyphId |= 0;
  23408. var seac = seacs[glyphId];
  23409. var baseGlyphName = _encodings.StandardEncoding[seac[2]];
  23410. var accentGlyphName = _encodings.StandardEncoding[seac[3]];
  23411. var baseGlyphId = charset.indexOf(baseGlyphName);
  23412. var accentGlyphId = charset.indexOf(accentGlyphName);
  23413. if (baseGlyphId < 0 || accentGlyphId < 0) {
  23414. continue;
  23415. }
  23416. var accentOffset = {
  23417. x: seac[0] * matrix[0] + seac[1] * matrix[2] + matrix[4],
  23418. y: seac[0] * matrix[1] + seac[1] * matrix[3] + matrix[5]
  23419. };
  23420. var charCodes = getCharCodes(mapping, glyphId);
  23421. if (!charCodes) {
  23422. continue;
  23423. }
  23424. for (let i = 0, ii = charCodes.length; i < ii; i++) {
  23425. var charCode = charCodes[i];
  23426. var charCodeToGlyphId = newMapping.charCodeToGlyphId;
  23427. var baseFontCharCode = createCharCode(charCodeToGlyphId, baseGlyphId);
  23428. var accentFontCharCode = createCharCode(charCodeToGlyphId, accentGlyphId);
  23429. seacMap[charCode] = {
  23430. baseFontCharCode,
  23431. accentFontCharCode,
  23432. accentOffset
  23433. };
  23434. }
  23435. }
  23436. properties.seacMap = seacMap;
  23437. }
  23438. var unitsPerEm = 1 / (properties.fontMatrix || _util.FONT_IDENTITY_MATRIX)[0];
  23439. var builder = new OpenTypeFileBuilder("\x4F\x54\x54\x4F");
  23440. builder.addTable("CFF ", font.data);
  23441. builder.addTable("OS/2", createOS2Table(properties, newMapping.charCodeToGlyphId));
  23442. builder.addTable("cmap", createCmapTable(newMapping.charCodeToGlyphId, numGlyphs));
  23443. 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");
  23444. 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));
  23445. builder.addTable("hmtx", function fontFieldsHmtx() {
  23446. var charstrings = font.charstrings;
  23447. var cffWidths = font.cff ? font.cff.widths : null;
  23448. var hmtx = "\x00\x00\x00\x00";
  23449. for (let i = 1, ii = numGlyphs; i < ii; i++) {
  23450. var width = 0;
  23451. if (charstrings) {
  23452. var charstring = charstrings[i - 1];
  23453. width = "width" in charstring ? charstring.width : 0;
  23454. } else if (cffWidths) {
  23455. width = Math.ceil(cffWidths[i] || 0);
  23456. }
  23457. hmtx += string16(width) + string16(0);
  23458. }
  23459. return hmtx;
  23460. }());
  23461. builder.addTable("maxp", "\x00\x00\x50\x00" + string16(numGlyphs));
  23462. builder.addTable("name", createNameTable(fontName));
  23463. builder.addTable("post", createPostTable(properties));
  23464. return builder.toArray();
  23465. },
  23466. get spaceWidth() {
  23467. var possibleSpaceReplacements = ["space", "minus", "one", "i", "I"];
  23468. var width;
  23469. for (var i = 0, ii = possibleSpaceReplacements.length; i < ii; i++) {
  23470. var glyphName = possibleSpaceReplacements[i];
  23471. if (glyphName in this.widths) {
  23472. width = this.widths[glyphName];
  23473. break;
  23474. }
  23475. var glyphsUnicodeMap = (0, _glyphlist.getGlyphsUnicode)();
  23476. var glyphUnicode = glyphsUnicodeMap[glyphName];
  23477. var charcode = 0;
  23478. if (this.composite && this.cMap.contains(glyphUnicode)) {
  23479. charcode = this.cMap.lookup(glyphUnicode);
  23480. }
  23481. if (!charcode && this.toUnicode) {
  23482. charcode = this.toUnicode.charCodeOf(glyphUnicode);
  23483. }
  23484. if (charcode <= 0) {
  23485. charcode = glyphUnicode;
  23486. }
  23487. width = this.widths[charcode];
  23488. if (width) {
  23489. break;
  23490. }
  23491. }
  23492. width = width || this.defaultWidth;
  23493. return (0, _util.shadow)(this, "spaceWidth", width);
  23494. },
  23495. _charToGlyph(charcode, isSpace = false) {
  23496. var fontCharCode, width, operatorListId;
  23497. var widthCode = charcode;
  23498. if (this.cMap && this.cMap.contains(charcode)) {
  23499. widthCode = this.cMap.lookup(charcode);
  23500. }
  23501. width = this.widths[widthCode];
  23502. width = (0, _util.isNum)(width) ? width : this.defaultWidth;
  23503. var vmetric = this.vmetrics && this.vmetrics[widthCode];
  23504. let unicode = this.toUnicode.get(charcode) || this.fallbackToUnicode.get(charcode) || charcode;
  23505. if (typeof unicode === "number") {
  23506. unicode = String.fromCharCode(unicode);
  23507. }
  23508. var isInFont = (charcode in this.toFontChar);
  23509. fontCharCode = this.toFontChar[charcode] || charcode;
  23510. if (this.missingFile) {
  23511. const glyphName = this.differences[charcode] || this.defaultEncoding[charcode];
  23512. if ((glyphName === ".notdef" || glyphName === "") && this.type === "Type1") {
  23513. fontCharCode = 0x20;
  23514. }
  23515. fontCharCode = (0, _unicode.mapSpecialUnicodeValues)(fontCharCode);
  23516. }
  23517. if (this.isType3Font) {
  23518. operatorListId = fontCharCode;
  23519. }
  23520. var accent = null;
  23521. if (this.seacMap && this.seacMap[charcode]) {
  23522. isInFont = true;
  23523. var seac = this.seacMap[charcode];
  23524. fontCharCode = seac.baseFontCharCode;
  23525. accent = {
  23526. fontChar: String.fromCodePoint(seac.accentFontCharCode),
  23527. offset: seac.accentOffset
  23528. };
  23529. }
  23530. let fontChar = "";
  23531. if (typeof fontCharCode === "number") {
  23532. if (fontCharCode <= 0x10ffff) {
  23533. fontChar = String.fromCodePoint(fontCharCode);
  23534. } else {
  23535. (0, _util.warn)(`charToGlyph - invalid fontCharCode: ${fontCharCode}`);
  23536. }
  23537. }
  23538. var glyph = this.glyphCache[charcode];
  23539. if (!glyph || !glyph.matchesForCache(fontChar, unicode, accent, width, vmetric, operatorListId, isSpace, isInFont)) {
  23540. glyph = new Glyph(fontChar, unicode, accent, width, vmetric, operatorListId, isSpace, isInFont);
  23541. this.glyphCache[charcode] = glyph;
  23542. }
  23543. return glyph;
  23544. },
  23545. charsToGlyphs: function Font_charsToGlyphs(chars) {
  23546. var charsCache = this.charsCache;
  23547. var glyphs, glyph, charcode;
  23548. if (charsCache) {
  23549. glyphs = charsCache[chars];
  23550. if (glyphs) {
  23551. return glyphs;
  23552. }
  23553. }
  23554. if (!charsCache) {
  23555. charsCache = this.charsCache = Object.create(null);
  23556. }
  23557. glyphs = [];
  23558. var charsCacheKey = chars;
  23559. var i = 0,
  23560. ii;
  23561. if (this.cMap) {
  23562. var c = Object.create(null);
  23563. while (i < chars.length) {
  23564. this.cMap.readCharCode(chars, i, c);
  23565. charcode = c.charcode;
  23566. var length = c.length;
  23567. i += length;
  23568. var isSpace = length === 1 && chars.charCodeAt(i - 1) === 0x20;
  23569. glyph = this._charToGlyph(charcode, isSpace);
  23570. glyphs.push(glyph);
  23571. }
  23572. } else {
  23573. for (i = 0, ii = chars.length; i < ii; ++i) {
  23574. charcode = chars.charCodeAt(i);
  23575. glyph = this._charToGlyph(charcode, charcode === 0x20);
  23576. glyphs.push(glyph);
  23577. }
  23578. }
  23579. return charsCache[charsCacheKey] = glyphs;
  23580. },
  23581. getCharPositions(chars) {
  23582. const positions = [];
  23583. if (this.cMap) {
  23584. const c = Object.create(null);
  23585. let i = 0;
  23586. while (i < chars.length) {
  23587. this.cMap.readCharCode(chars, i, c);
  23588. const length = c.length;
  23589. positions.push([i, i + length]);
  23590. i += length;
  23591. }
  23592. } else {
  23593. for (let i = 0, ii = chars.length; i < ii; ++i) {
  23594. positions.push([i, i + 1]);
  23595. }
  23596. }
  23597. return positions;
  23598. },
  23599. get glyphCacheValues() {
  23600. return Object.values(this.glyphCache);
  23601. },
  23602. encodeString(str) {
  23603. const buffers = [];
  23604. const currentBuf = [];
  23605. const hasCurrentBufErrors = () => buffers.length % 2 === 1;
  23606. for (let i = 0, ii = str.length; i < ii; i++) {
  23607. const unicode = str.codePointAt(i);
  23608. if (unicode > 0xd7ff && (unicode < 0xe000 || unicode > 0xfffd)) {
  23609. i++;
  23610. }
  23611. if (this.toUnicode) {
  23612. const char = String.fromCodePoint(unicode);
  23613. const charCode = this.toUnicode.charCodeOf(char);
  23614. if (charCode !== -1) {
  23615. if (hasCurrentBufErrors()) {
  23616. buffers.push(currentBuf.join(""));
  23617. currentBuf.length = 0;
  23618. }
  23619. const charCodeLength = this.cMap ? this.cMap.getCharCodeLength(charCode) : 1;
  23620. for (let j = charCodeLength - 1; j >= 0; j--) {
  23621. currentBuf.push(String.fromCharCode(charCode >> 8 * j & 0xff));
  23622. }
  23623. continue;
  23624. }
  23625. }
  23626. if (!hasCurrentBufErrors()) {
  23627. buffers.push(currentBuf.join(""));
  23628. currentBuf.length = 0;
  23629. }
  23630. currentBuf.push(String.fromCodePoint(unicode));
  23631. }
  23632. buffers.push(currentBuf.join(""));
  23633. return buffers;
  23634. }
  23635. };
  23636. return Font;
  23637. }();
  23638. exports.Font = Font;
  23639. var ErrorFont = function ErrorFontClosure() {
  23640. function ErrorFont(error) {
  23641. this.error = error;
  23642. this.loadedName = "g_font_error";
  23643. this.missingFile = true;
  23644. }
  23645. ErrorFont.prototype = {
  23646. charsToGlyphs: function ErrorFont_charsToGlyphs() {
  23647. return [];
  23648. },
  23649. encodeString: function ErrorFont_encodeString(chars) {
  23650. return [chars];
  23651. },
  23652. exportData(extraProperties = false) {
  23653. return {
  23654. error: this.error
  23655. };
  23656. }
  23657. };
  23658. return ErrorFont;
  23659. }();
  23660. exports.ErrorFont = ErrorFont;
  23661. function type1FontGlyphMapping(properties, builtInEncoding, glyphNames) {
  23662. var charCodeToGlyphId = Object.create(null);
  23663. var glyphId, charCode, baseEncoding;
  23664. var isSymbolicFont = !!(properties.flags & FontFlags.Symbolic);
  23665. if (properties.baseEncodingName) {
  23666. baseEncoding = (0, _encodings.getEncoding)(properties.baseEncodingName);
  23667. for (charCode = 0; charCode < baseEncoding.length; charCode++) {
  23668. glyphId = glyphNames.indexOf(baseEncoding[charCode]);
  23669. if (glyphId >= 0) {
  23670. charCodeToGlyphId[charCode] = glyphId;
  23671. } else {
  23672. charCodeToGlyphId[charCode] = 0;
  23673. }
  23674. }
  23675. } else if (isSymbolicFont) {
  23676. for (charCode in builtInEncoding) {
  23677. charCodeToGlyphId[charCode] = builtInEncoding[charCode];
  23678. }
  23679. } else {
  23680. baseEncoding = _encodings.StandardEncoding;
  23681. for (charCode = 0; charCode < baseEncoding.length; charCode++) {
  23682. glyphId = glyphNames.indexOf(baseEncoding[charCode]);
  23683. if (glyphId >= 0) {
  23684. charCodeToGlyphId[charCode] = glyphId;
  23685. } else {
  23686. charCodeToGlyphId[charCode] = 0;
  23687. }
  23688. }
  23689. }
  23690. var differences = properties.differences,
  23691. glyphsUnicodeMap;
  23692. if (differences) {
  23693. for (charCode in differences) {
  23694. var glyphName = differences[charCode];
  23695. glyphId = glyphNames.indexOf(glyphName);
  23696. if (glyphId === -1) {
  23697. if (!glyphsUnicodeMap) {
  23698. glyphsUnicodeMap = (0, _glyphlist.getGlyphsUnicode)();
  23699. }
  23700. var standardGlyphName = recoverGlyphName(glyphName, glyphsUnicodeMap);
  23701. if (standardGlyphName !== glyphName) {
  23702. glyphId = glyphNames.indexOf(standardGlyphName);
  23703. }
  23704. }
  23705. if (glyphId >= 0) {
  23706. charCodeToGlyphId[charCode] = glyphId;
  23707. } else {
  23708. charCodeToGlyphId[charCode] = 0;
  23709. }
  23710. }
  23711. }
  23712. return charCodeToGlyphId;
  23713. }
  23714. var Type1Font = function Type1FontClosure() {
  23715. function findBlock(streamBytes, signature, startIndex) {
  23716. var streamBytesLength = streamBytes.length;
  23717. var signatureLength = signature.length;
  23718. var scanLength = streamBytesLength - signatureLength;
  23719. var i = startIndex,
  23720. j,
  23721. found = false;
  23722. while (i < scanLength) {
  23723. j = 0;
  23724. while (j < signatureLength && streamBytes[i + j] === signature[j]) {
  23725. j++;
  23726. }
  23727. if (j >= signatureLength) {
  23728. i += j;
  23729. while (i < streamBytesLength && (0, _core_utils.isWhiteSpace)(streamBytes[i])) {
  23730. i++;
  23731. }
  23732. found = true;
  23733. break;
  23734. }
  23735. i++;
  23736. }
  23737. return {
  23738. found,
  23739. length: i
  23740. };
  23741. }
  23742. function getHeaderBlock(stream, suggestedLength) {
  23743. var EEXEC_SIGNATURE = [0x65, 0x65, 0x78, 0x65, 0x63];
  23744. var streamStartPos = stream.pos;
  23745. var headerBytes, headerBytesLength, block;
  23746. try {
  23747. headerBytes = stream.getBytes(suggestedLength);
  23748. headerBytesLength = headerBytes.length;
  23749. } catch (ex) {
  23750. if (ex instanceof _core_utils.MissingDataException) {
  23751. throw ex;
  23752. }
  23753. }
  23754. if (headerBytesLength === suggestedLength) {
  23755. block = findBlock(headerBytes, EEXEC_SIGNATURE, suggestedLength - 2 * EEXEC_SIGNATURE.length);
  23756. if (block.found && block.length === suggestedLength) {
  23757. return {
  23758. stream: new _stream.Stream(headerBytes),
  23759. length: suggestedLength
  23760. };
  23761. }
  23762. }
  23763. (0, _util.warn)('Invalid "Length1" property in Type1 font -- trying to recover.');
  23764. stream.pos = streamStartPos;
  23765. var SCAN_BLOCK_LENGTH = 2048;
  23766. var actualLength;
  23767. while (true) {
  23768. var scanBytes = stream.peekBytes(SCAN_BLOCK_LENGTH);
  23769. block = findBlock(scanBytes, EEXEC_SIGNATURE, 0);
  23770. if (block.length === 0) {
  23771. break;
  23772. }
  23773. stream.pos += block.length;
  23774. if (block.found) {
  23775. actualLength = stream.pos - streamStartPos;
  23776. break;
  23777. }
  23778. }
  23779. stream.pos = streamStartPos;
  23780. if (actualLength) {
  23781. return {
  23782. stream: new _stream.Stream(stream.getBytes(actualLength)),
  23783. length: actualLength
  23784. };
  23785. }
  23786. (0, _util.warn)('Unable to recover "Length1" property in Type1 font -- using as is.');
  23787. return {
  23788. stream: new _stream.Stream(stream.getBytes(suggestedLength)),
  23789. length: suggestedLength
  23790. };
  23791. }
  23792. function getEexecBlock(stream, suggestedLength) {
  23793. var eexecBytes = stream.getBytes();
  23794. return {
  23795. stream: new _stream.Stream(eexecBytes),
  23796. length: eexecBytes.length
  23797. };
  23798. }
  23799. function Type1Font(name, file, properties) {
  23800. var PFB_HEADER_SIZE = 6;
  23801. var headerBlockLength = properties.length1;
  23802. var eexecBlockLength = properties.length2;
  23803. var pfbHeader = file.peekBytes(PFB_HEADER_SIZE);
  23804. var pfbHeaderPresent = pfbHeader[0] === 0x80 && pfbHeader[1] === 0x01;
  23805. if (pfbHeaderPresent) {
  23806. file.skip(PFB_HEADER_SIZE);
  23807. headerBlockLength = pfbHeader[5] << 24 | pfbHeader[4] << 16 | pfbHeader[3] << 8 | pfbHeader[2];
  23808. }
  23809. var headerBlock = getHeaderBlock(file, headerBlockLength);
  23810. var headerBlockParser = new _type1_parser.Type1Parser(headerBlock.stream, false, SEAC_ANALYSIS_ENABLED);
  23811. headerBlockParser.extractFontHeader(properties);
  23812. if (pfbHeaderPresent) {
  23813. pfbHeader = file.getBytes(PFB_HEADER_SIZE);
  23814. eexecBlockLength = pfbHeader[5] << 24 | pfbHeader[4] << 16 | pfbHeader[3] << 8 | pfbHeader[2];
  23815. }
  23816. var eexecBlock = getEexecBlock(file, eexecBlockLength);
  23817. var eexecBlockParser = new _type1_parser.Type1Parser(eexecBlock.stream, true, SEAC_ANALYSIS_ENABLED);
  23818. var data = eexecBlockParser.extractFontProgram(properties);
  23819. for (const key in data.properties) {
  23820. properties[key] = data.properties[key];
  23821. }
  23822. var charstrings = data.charstrings;
  23823. var type2Charstrings = this.getType2Charstrings(charstrings);
  23824. var subrs = this.getType2Subrs(data.subrs);
  23825. this.charstrings = charstrings;
  23826. this.data = this.wrap(name, type2Charstrings, this.charstrings, subrs, properties);
  23827. this.seacs = this.getSeacs(data.charstrings);
  23828. }
  23829. Type1Font.prototype = {
  23830. get numGlyphs() {
  23831. return this.charstrings.length + 1;
  23832. },
  23833. getCharset: function Type1Font_getCharset() {
  23834. var charset = [".notdef"];
  23835. var charstrings = this.charstrings;
  23836. for (var glyphId = 0; glyphId < charstrings.length; glyphId++) {
  23837. charset.push(charstrings[glyphId].glyphName);
  23838. }
  23839. return charset;
  23840. },
  23841. getGlyphMapping: function Type1Font_getGlyphMapping(properties) {
  23842. var charstrings = this.charstrings;
  23843. if (properties.composite) {
  23844. const charCodeToGlyphId = Object.create(null);
  23845. for (let glyphId = 0, charstringsLen = charstrings.length; glyphId < charstringsLen; glyphId++) {
  23846. const charCode = properties.cMap.charCodeOf(glyphId);
  23847. charCodeToGlyphId[charCode] = glyphId + 1;
  23848. }
  23849. return charCodeToGlyphId;
  23850. }
  23851. var glyphNames = [".notdef"],
  23852. glyphId;
  23853. for (glyphId = 0; glyphId < charstrings.length; glyphId++) {
  23854. glyphNames.push(charstrings[glyphId].glyphName);
  23855. }
  23856. var encoding = properties.builtInEncoding;
  23857. if (encoding) {
  23858. var builtInEncoding = Object.create(null);
  23859. for (var charCode in encoding) {
  23860. glyphId = glyphNames.indexOf(encoding[charCode]);
  23861. if (glyphId >= 0) {
  23862. builtInEncoding[charCode] = glyphId;
  23863. }
  23864. }
  23865. }
  23866. return type1FontGlyphMapping(properties, builtInEncoding, glyphNames);
  23867. },
  23868. hasGlyphId: function Type1Font_hasGlyphID(id) {
  23869. if (id < 0 || id >= this.numGlyphs) {
  23870. return false;
  23871. }
  23872. if (id === 0) {
  23873. return true;
  23874. }
  23875. var glyph = this.charstrings[id - 1];
  23876. return glyph.charstring.length > 0;
  23877. },
  23878. getSeacs: function Type1Font_getSeacs(charstrings) {
  23879. var i, ii;
  23880. var seacMap = [];
  23881. for (i = 0, ii = charstrings.length; i < ii; i++) {
  23882. var charstring = charstrings[i];
  23883. if (charstring.seac) {
  23884. seacMap[i + 1] = charstring.seac;
  23885. }
  23886. }
  23887. return seacMap;
  23888. },
  23889. getType2Charstrings: function Type1Font_getType2Charstrings(type1Charstrings) {
  23890. var type2Charstrings = [];
  23891. for (var i = 0, ii = type1Charstrings.length; i < ii; i++) {
  23892. type2Charstrings.push(type1Charstrings[i].charstring);
  23893. }
  23894. return type2Charstrings;
  23895. },
  23896. getType2Subrs: function Type1Font_getType2Subrs(type1Subrs) {
  23897. var bias = 0;
  23898. var count = type1Subrs.length;
  23899. if (count < 1133) {
  23900. bias = 107;
  23901. } else if (count < 33769) {
  23902. bias = 1131;
  23903. } else {
  23904. bias = 32768;
  23905. }
  23906. var type2Subrs = [];
  23907. var i;
  23908. for (i = 0; i < bias; i++) {
  23909. type2Subrs.push([0x0b]);
  23910. }
  23911. for (i = 0; i < count; i++) {
  23912. type2Subrs.push(type1Subrs[i]);
  23913. }
  23914. return type2Subrs;
  23915. },
  23916. wrap: function Type1Font_wrap(name, glyphs, charstrings, subrs, properties) {
  23917. var cff = new _cff_parser.CFF();
  23918. cff.header = new _cff_parser.CFFHeader(1, 0, 4, 4);
  23919. cff.names = [name];
  23920. var topDict = new _cff_parser.CFFTopDict();
  23921. topDict.setByName("version", 391);
  23922. topDict.setByName("Notice", 392);
  23923. topDict.setByName("FullName", 393);
  23924. topDict.setByName("FamilyName", 394);
  23925. topDict.setByName("Weight", 395);
  23926. topDict.setByName("Encoding", null);
  23927. topDict.setByName("FontMatrix", properties.fontMatrix);
  23928. topDict.setByName("FontBBox", properties.bbox);
  23929. topDict.setByName("charset", null);
  23930. topDict.setByName("CharStrings", null);
  23931. topDict.setByName("Private", null);
  23932. cff.topDict = topDict;
  23933. var strings = new _cff_parser.CFFStrings();
  23934. strings.add("Version 0.11");
  23935. strings.add("See original notice");
  23936. strings.add(name);
  23937. strings.add(name);
  23938. strings.add("Medium");
  23939. cff.strings = strings;
  23940. cff.globalSubrIndex = new _cff_parser.CFFIndex();
  23941. var count = glyphs.length;
  23942. var charsetArray = [".notdef"];
  23943. var i, ii;
  23944. for (i = 0; i < count; i++) {
  23945. const glyphName = charstrings[i].glyphName;
  23946. const index = _cff_parser.CFFStandardStrings.indexOf(glyphName);
  23947. if (index === -1) {
  23948. strings.add(glyphName);
  23949. }
  23950. charsetArray.push(glyphName);
  23951. }
  23952. cff.charset = new _cff_parser.CFFCharset(false, 0, charsetArray);
  23953. var charStringsIndex = new _cff_parser.CFFIndex();
  23954. charStringsIndex.add([0x8b, 0x0e]);
  23955. for (i = 0; i < count; i++) {
  23956. charStringsIndex.add(glyphs[i]);
  23957. }
  23958. cff.charStrings = charStringsIndex;
  23959. var privateDict = new _cff_parser.CFFPrivateDict();
  23960. privateDict.setByName("Subrs", null);
  23961. var fields = ["BlueValues", "OtherBlues", "FamilyBlues", "FamilyOtherBlues", "StemSnapH", "StemSnapV", "BlueShift", "BlueFuzz", "BlueScale", "LanguageGroup", "ExpansionFactor", "ForceBold", "StdHW", "StdVW"];
  23962. for (i = 0, ii = fields.length; i < ii; i++) {
  23963. var field = fields[i];
  23964. if (!(field in properties.privateData)) {
  23965. continue;
  23966. }
  23967. var value = properties.privateData[field];
  23968. if (Array.isArray(value)) {
  23969. for (var j = value.length - 1; j > 0; j--) {
  23970. value[j] -= value[j - 1];
  23971. }
  23972. }
  23973. privateDict.setByName(field, value);
  23974. }
  23975. cff.topDict.privateDict = privateDict;
  23976. var subrIndex = new _cff_parser.CFFIndex();
  23977. for (i = 0, ii = subrs.length; i < ii; i++) {
  23978. subrIndex.add(subrs[i]);
  23979. }
  23980. privateDict.subrsIndex = subrIndex;
  23981. var compiler = new _cff_parser.CFFCompiler(cff);
  23982. return compiler.compile();
  23983. }
  23984. };
  23985. return Type1Font;
  23986. }();
  23987. var CFFFont = function CFFFontClosure() {
  23988. function CFFFont(file, properties) {
  23989. this.properties = properties;
  23990. var parser = new _cff_parser.CFFParser(file, properties, SEAC_ANALYSIS_ENABLED);
  23991. this.cff = parser.parse();
  23992. this.cff.duplicateFirstGlyph();
  23993. var compiler = new _cff_parser.CFFCompiler(this.cff);
  23994. this.seacs = this.cff.seacs;
  23995. try {
  23996. this.data = compiler.compile();
  23997. } catch (e) {
  23998. (0, _util.warn)("Failed to compile font " + properties.loadedName);
  23999. this.data = file;
  24000. }
  24001. }
  24002. CFFFont.prototype = {
  24003. get numGlyphs() {
  24004. return this.cff.charStrings.count;
  24005. },
  24006. getCharset: function CFFFont_getCharset() {
  24007. return this.cff.charset.charset;
  24008. },
  24009. getGlyphMapping: function CFFFont_getGlyphMapping() {
  24010. var cff = this.cff;
  24011. var properties = this.properties;
  24012. var charsets = cff.charset.charset;
  24013. var charCodeToGlyphId;
  24014. var glyphId;
  24015. if (properties.composite) {
  24016. charCodeToGlyphId = Object.create(null);
  24017. let charCode;
  24018. if (cff.isCIDFont) {
  24019. for (glyphId = 0; glyphId < charsets.length; glyphId++) {
  24020. var cid = charsets[glyphId];
  24021. charCode = properties.cMap.charCodeOf(cid);
  24022. charCodeToGlyphId[charCode] = glyphId;
  24023. }
  24024. } else {
  24025. for (glyphId = 0; glyphId < cff.charStrings.count; glyphId++) {
  24026. charCode = properties.cMap.charCodeOf(glyphId);
  24027. charCodeToGlyphId[charCode] = glyphId;
  24028. }
  24029. }
  24030. return charCodeToGlyphId;
  24031. }
  24032. var encoding = cff.encoding ? cff.encoding.encoding : null;
  24033. charCodeToGlyphId = type1FontGlyphMapping(properties, encoding, charsets);
  24034. return charCodeToGlyphId;
  24035. },
  24036. hasGlyphId: function CFFFont_hasGlyphID(id) {
  24037. return this.cff.hasGlyphId(id);
  24038. }
  24039. };
  24040. return CFFFont;
  24041. }();
  24042. /***/ }),
  24043. /* 30 */
  24044. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  24045. Object.defineProperty(exports, "__esModule", ({
  24046. value: true
  24047. }));
  24048. exports.CFFTopDict = exports.CFFStrings = exports.CFFStandardStrings = exports.CFFPrivateDict = exports.CFFParser = exports.CFFIndex = exports.CFFHeader = exports.CFFFDSelect = exports.CFFCompiler = exports.CFFCharset = exports.CFF = void 0;
  24049. var _util = __w_pdfjs_require__(2);
  24050. var _charsets = __w_pdfjs_require__(31);
  24051. var _encodings = __w_pdfjs_require__(32);
  24052. var MAX_SUBR_NESTING = 10;
  24053. var CFFStandardStrings = [".notdef", "space", "exclam", "quotedbl", "numbersign", "dollar", "percent", "ampersand", "quoteright", "parenleft", "parenright", "asterisk", "plus", "comma", "hyphen", "period", "slash", "zero", "one", "two", "three", "four", "five", "six", "seven", "eight", "nine", "colon", "semicolon", "less", "equal", "greater", "question", "at", "A", "B", "C", "D", "E", "F", "G", "H", "I", "J", "K", "L", "M", "N", "O", "P", "Q", "R", "S", "T", "U", "V", "W", "X", "Y", "Z", "bracketleft", "backslash", "bracketright", "asciicircum", "underscore", "quoteleft", "a", "b", "c", "d", "e", "f", "g", "h", "i", "j", "k", "l", "m", "n", "o", "p", "q", "r", "s", "t", "u", "v", "w", "x", "y", "z", "braceleft", "bar", "braceright", "asciitilde", "exclamdown", "cent", "sterling", "fraction", "yen", "florin", "section", "currency", "quotesingle", "quotedblleft", "guillemotleft", "guilsinglleft", "guilsinglright", "fi", "fl", "endash", "dagger", "daggerdbl", "periodcentered", "paragraph", "bullet", "quotesinglbase", "quotedblbase", "quotedblright", "guillemotright", "ellipsis", "perthousand", "questiondown", "grave", "acute", "circumflex", "tilde", "macron", "breve", "dotaccent", "dieresis", "ring", "cedilla", "hungarumlaut", "ogonek", "caron", "emdash", "AE", "ordfeminine", "Lslash", "Oslash", "OE", "ordmasculine", "ae", "dotlessi", "lslash", "oslash", "oe", "germandbls", "onesuperior", "logicalnot", "mu", "trademark", "Eth", "onehalf", "plusminus", "Thorn", "onequarter", "divide", "brokenbar", "degree", "thorn", "threequarters", "twosuperior", "registered", "minus", "eth", "multiply", "threesuperior", "copyright", "Aacute", "Acircumflex", "Adieresis", "Agrave", "Aring", "Atilde", "Ccedilla", "Eacute", "Ecircumflex", "Edieresis", "Egrave", "Iacute", "Icircumflex", "Idieresis", "Igrave", "Ntilde", "Oacute", "Ocircumflex", "Odieresis", "Ograve", "Otilde", "Scaron", "Uacute", "Ucircumflex", "Udieresis", "Ugrave", "Yacute", "Ydieresis", "Zcaron", "aacute", "acircumflex", "adieresis", "agrave", "aring", "atilde", "ccedilla", "eacute", "ecircumflex", "edieresis", "egrave", "iacute", "icircumflex", "idieresis", "igrave", "ntilde", "oacute", "ocircumflex", "odieresis", "ograve", "otilde", "scaron", "uacute", "ucircumflex", "udieresis", "ugrave", "yacute", "ydieresis", "zcaron", "exclamsmall", "Hungarumlautsmall", "dollaroldstyle", "dollarsuperior", "ampersandsmall", "Acutesmall", "parenleftsuperior", "parenrightsuperior", "twodotenleader", "onedotenleader", "zerooldstyle", "oneoldstyle", "twooldstyle", "threeoldstyle", "fouroldstyle", "fiveoldstyle", "sixoldstyle", "sevenoldstyle", "eightoldstyle", "nineoldstyle", "commasuperior", "threequartersemdash", "periodsuperior", "questionsmall", "asuperior", "bsuperior", "centsuperior", "dsuperior", "esuperior", "isuperior", "lsuperior", "msuperior", "nsuperior", "osuperior", "rsuperior", "ssuperior", "tsuperior", "ff", "ffi", "ffl", "parenleftinferior", "parenrightinferior", "Circumflexsmall", "hyphensuperior", "Gravesmall", "Asmall", "Bsmall", "Csmall", "Dsmall", "Esmall", "Fsmall", "Gsmall", "Hsmall", "Ismall", "Jsmall", "Ksmall", "Lsmall", "Msmall", "Nsmall", "Osmall", "Psmall", "Qsmall", "Rsmall", "Ssmall", "Tsmall", "Usmall", "Vsmall", "Wsmall", "Xsmall", "Ysmall", "Zsmall", "colonmonetary", "onefitted", "rupiah", "Tildesmall", "exclamdownsmall", "centoldstyle", "Lslashsmall", "Scaronsmall", "Zcaronsmall", "Dieresissmall", "Brevesmall", "Caronsmall", "Dotaccentsmall", "Macronsmall", "figuredash", "hypheninferior", "Ogoneksmall", "Ringsmall", "Cedillasmall", "questiondownsmall", "oneeighth", "threeeighths", "fiveeighths", "seveneighths", "onethird", "twothirds", "zerosuperior", "foursuperior", "fivesuperior", "sixsuperior", "sevensuperior", "eightsuperior", "ninesuperior", "zeroinferior", "oneinferior", "twoinferior", "threeinferior", "fourinferior", "fiveinferior", "sixinferior", "seveninferior", "eightinferior", "nineinferior", "centinferior", "dollarinferior", "periodinferior", "commainferior", "Agravesmall", "Aacutesmall", "Acircumflexsmall", "Atildesmall", "Adieresissmall", "Aringsmall", "AEsmall", "Ccedillasmall", "Egravesmall", "Eacutesmall", "Ecircumflexsmall", "Edieresissmall", "Igravesmall", "Iacutesmall", "Icircumflexsmall", "Idieresissmall", "Ethsmall", "Ntildesmall", "Ogravesmall", "Oacutesmall", "Ocircumflexsmall", "Otildesmall", "Odieresissmall", "OEsmall", "Oslashsmall", "Ugravesmall", "Uacutesmall", "Ucircumflexsmall", "Udieresissmall", "Yacutesmall", "Thornsmall", "Ydieresissmall", "001.000", "001.001", "001.002", "001.003", "Black", "Bold", "Book", "Light", "Medium", "Regular", "Roman", "Semibold"];
  24054. exports.CFFStandardStrings = CFFStandardStrings;
  24055. const NUM_STANDARD_CFF_STRINGS = 391;
  24056. var CFFParser = function CFFParserClosure() {
  24057. var CharstringValidationData = [null, {
  24058. id: "hstem",
  24059. min: 2,
  24060. stackClearing: true,
  24061. stem: true
  24062. }, null, {
  24063. id: "vstem",
  24064. min: 2,
  24065. stackClearing: true,
  24066. stem: true
  24067. }, {
  24068. id: "vmoveto",
  24069. min: 1,
  24070. stackClearing: true
  24071. }, {
  24072. id: "rlineto",
  24073. min: 2,
  24074. resetStack: true
  24075. }, {
  24076. id: "hlineto",
  24077. min: 1,
  24078. resetStack: true
  24079. }, {
  24080. id: "vlineto",
  24081. min: 1,
  24082. resetStack: true
  24083. }, {
  24084. id: "rrcurveto",
  24085. min: 6,
  24086. resetStack: true
  24087. }, null, {
  24088. id: "callsubr",
  24089. min: 1,
  24090. undefStack: true
  24091. }, {
  24092. id: "return",
  24093. min: 0,
  24094. undefStack: true
  24095. }, null, null, {
  24096. id: "endchar",
  24097. min: 0,
  24098. stackClearing: true
  24099. }, null, null, null, {
  24100. id: "hstemhm",
  24101. min: 2,
  24102. stackClearing: true,
  24103. stem: true
  24104. }, {
  24105. id: "hintmask",
  24106. min: 0,
  24107. stackClearing: true
  24108. }, {
  24109. id: "cntrmask",
  24110. min: 0,
  24111. stackClearing: true
  24112. }, {
  24113. id: "rmoveto",
  24114. min: 2,
  24115. stackClearing: true
  24116. }, {
  24117. id: "hmoveto",
  24118. min: 1,
  24119. stackClearing: true
  24120. }, {
  24121. id: "vstemhm",
  24122. min: 2,
  24123. stackClearing: true,
  24124. stem: true
  24125. }, {
  24126. id: "rcurveline",
  24127. min: 8,
  24128. resetStack: true
  24129. }, {
  24130. id: "rlinecurve",
  24131. min: 8,
  24132. resetStack: true
  24133. }, {
  24134. id: "vvcurveto",
  24135. min: 4,
  24136. resetStack: true
  24137. }, {
  24138. id: "hhcurveto",
  24139. min: 4,
  24140. resetStack: true
  24141. }, null, {
  24142. id: "callgsubr",
  24143. min: 1,
  24144. undefStack: true
  24145. }, {
  24146. id: "vhcurveto",
  24147. min: 4,
  24148. resetStack: true
  24149. }, {
  24150. id: "hvcurveto",
  24151. min: 4,
  24152. resetStack: true
  24153. }];
  24154. var CharstringValidationData12 = [null, null, null, {
  24155. id: "and",
  24156. min: 2,
  24157. stackDelta: -1
  24158. }, {
  24159. id: "or",
  24160. min: 2,
  24161. stackDelta: -1
  24162. }, {
  24163. id: "not",
  24164. min: 1,
  24165. stackDelta: 0
  24166. }, null, null, null, {
  24167. id: "abs",
  24168. min: 1,
  24169. stackDelta: 0
  24170. }, {
  24171. id: "add",
  24172. min: 2,
  24173. stackDelta: -1,
  24174. stackFn: function stack_div(stack, index) {
  24175. stack[index - 2] = stack[index - 2] + stack[index - 1];
  24176. }
  24177. }, {
  24178. id: "sub",
  24179. min: 2,
  24180. stackDelta: -1,
  24181. stackFn: function stack_div(stack, index) {
  24182. stack[index - 2] = stack[index - 2] - stack[index - 1];
  24183. }
  24184. }, {
  24185. id: "div",
  24186. min: 2,
  24187. stackDelta: -1,
  24188. stackFn: function stack_div(stack, index) {
  24189. stack[index - 2] = stack[index - 2] / stack[index - 1];
  24190. }
  24191. }, null, {
  24192. id: "neg",
  24193. min: 1,
  24194. stackDelta: 0,
  24195. stackFn: function stack_div(stack, index) {
  24196. stack[index - 1] = -stack[index - 1];
  24197. }
  24198. }, {
  24199. id: "eq",
  24200. min: 2,
  24201. stackDelta: -1
  24202. }, null, null, {
  24203. id: "drop",
  24204. min: 1,
  24205. stackDelta: -1
  24206. }, null, {
  24207. id: "put",
  24208. min: 2,
  24209. stackDelta: -2
  24210. }, {
  24211. id: "get",
  24212. min: 1,
  24213. stackDelta: 0
  24214. }, {
  24215. id: "ifelse",
  24216. min: 4,
  24217. stackDelta: -3
  24218. }, {
  24219. id: "random",
  24220. min: 0,
  24221. stackDelta: 1
  24222. }, {
  24223. id: "mul",
  24224. min: 2,
  24225. stackDelta: -1,
  24226. stackFn: function stack_div(stack, index) {
  24227. stack[index - 2] = stack[index - 2] * stack[index - 1];
  24228. }
  24229. }, null, {
  24230. id: "sqrt",
  24231. min: 1,
  24232. stackDelta: 0
  24233. }, {
  24234. id: "dup",
  24235. min: 1,
  24236. stackDelta: 1
  24237. }, {
  24238. id: "exch",
  24239. min: 2,
  24240. stackDelta: 0
  24241. }, {
  24242. id: "index",
  24243. min: 2,
  24244. stackDelta: 0
  24245. }, {
  24246. id: "roll",
  24247. min: 3,
  24248. stackDelta: -2
  24249. }, null, null, null, {
  24250. id: "hflex",
  24251. min: 7,
  24252. resetStack: true
  24253. }, {
  24254. id: "flex",
  24255. min: 13,
  24256. resetStack: true
  24257. }, {
  24258. id: "hflex1",
  24259. min: 9,
  24260. resetStack: true
  24261. }, {
  24262. id: "flex1",
  24263. min: 11,
  24264. resetStack: true
  24265. }];
  24266. class CFFParser {
  24267. constructor(file, properties, seacAnalysisEnabled) {
  24268. this.bytes = file.getBytes();
  24269. this.properties = properties;
  24270. this.seacAnalysisEnabled = !!seacAnalysisEnabled;
  24271. }
  24272. parse() {
  24273. var properties = this.properties;
  24274. var cff = new CFF();
  24275. this.cff = cff;
  24276. var header = this.parseHeader();
  24277. var nameIndex = this.parseIndex(header.endPos);
  24278. var topDictIndex = this.parseIndex(nameIndex.endPos);
  24279. var stringIndex = this.parseIndex(topDictIndex.endPos);
  24280. var globalSubrIndex = this.parseIndex(stringIndex.endPos);
  24281. var topDictParsed = this.parseDict(topDictIndex.obj.get(0));
  24282. var topDict = this.createDict(CFFTopDict, topDictParsed, cff.strings);
  24283. cff.header = header.obj;
  24284. cff.names = this.parseNameIndex(nameIndex.obj);
  24285. cff.strings = this.parseStringIndex(stringIndex.obj);
  24286. cff.topDict = topDict;
  24287. cff.globalSubrIndex = globalSubrIndex.obj;
  24288. this.parsePrivateDict(cff.topDict);
  24289. cff.isCIDFont = topDict.hasName("ROS");
  24290. var charStringOffset = topDict.getByName("CharStrings");
  24291. var charStringIndex = this.parseIndex(charStringOffset).obj;
  24292. var fontMatrix = topDict.getByName("FontMatrix");
  24293. if (fontMatrix) {
  24294. properties.fontMatrix = fontMatrix;
  24295. }
  24296. var fontBBox = topDict.getByName("FontBBox");
  24297. if (fontBBox) {
  24298. properties.ascent = Math.max(fontBBox[3], fontBBox[1]);
  24299. properties.descent = Math.min(fontBBox[1], fontBBox[3]);
  24300. properties.ascentScaled = true;
  24301. }
  24302. var charset, encoding;
  24303. if (cff.isCIDFont) {
  24304. var fdArrayIndex = this.parseIndex(topDict.getByName("FDArray")).obj;
  24305. for (var i = 0, ii = fdArrayIndex.count; i < ii; ++i) {
  24306. var dictRaw = fdArrayIndex.get(i);
  24307. var fontDict = this.createDict(CFFTopDict, this.parseDict(dictRaw), cff.strings);
  24308. this.parsePrivateDict(fontDict);
  24309. cff.fdArray.push(fontDict);
  24310. }
  24311. encoding = null;
  24312. charset = this.parseCharsets(topDict.getByName("charset"), charStringIndex.count, cff.strings, true);
  24313. cff.fdSelect = this.parseFDSelect(topDict.getByName("FDSelect"), charStringIndex.count);
  24314. } else {
  24315. charset = this.parseCharsets(topDict.getByName("charset"), charStringIndex.count, cff.strings, false);
  24316. encoding = this.parseEncoding(topDict.getByName("Encoding"), properties, cff.strings, charset.charset);
  24317. }
  24318. cff.charset = charset;
  24319. cff.encoding = encoding;
  24320. var charStringsAndSeacs = this.parseCharStrings({
  24321. charStrings: charStringIndex,
  24322. localSubrIndex: topDict.privateDict.subrsIndex,
  24323. globalSubrIndex: globalSubrIndex.obj,
  24324. fdSelect: cff.fdSelect,
  24325. fdArray: cff.fdArray,
  24326. privateDict: topDict.privateDict
  24327. });
  24328. cff.charStrings = charStringsAndSeacs.charStrings;
  24329. cff.seacs = charStringsAndSeacs.seacs;
  24330. cff.widths = charStringsAndSeacs.widths;
  24331. return cff;
  24332. }
  24333. parseHeader() {
  24334. var bytes = this.bytes;
  24335. var bytesLength = bytes.length;
  24336. var offset = 0;
  24337. while (offset < bytesLength && bytes[offset] !== 1) {
  24338. ++offset;
  24339. }
  24340. if (offset >= bytesLength) {
  24341. throw new _util.FormatError("Invalid CFF header");
  24342. }
  24343. if (offset !== 0) {
  24344. (0, _util.info)("cff data is shifted");
  24345. bytes = bytes.subarray(offset);
  24346. this.bytes = bytes;
  24347. }
  24348. var major = bytes[0];
  24349. var minor = bytes[1];
  24350. var hdrSize = bytes[2];
  24351. var offSize = bytes[3];
  24352. var header = new CFFHeader(major, minor, hdrSize, offSize);
  24353. return {
  24354. obj: header,
  24355. endPos: hdrSize
  24356. };
  24357. }
  24358. parseDict(dict) {
  24359. var pos = 0;
  24360. function parseOperand() {
  24361. var value = dict[pos++];
  24362. if (value === 30) {
  24363. return parseFloatOperand();
  24364. } else if (value === 28) {
  24365. value = dict[pos++];
  24366. value = (value << 24 | dict[pos++] << 16) >> 16;
  24367. return value;
  24368. } else if (value === 29) {
  24369. value = dict[pos++];
  24370. value = value << 8 | dict[pos++];
  24371. value = value << 8 | dict[pos++];
  24372. value = value << 8 | dict[pos++];
  24373. return value;
  24374. } else if (value >= 32 && value <= 246) {
  24375. return value - 139;
  24376. } else if (value >= 247 && value <= 250) {
  24377. return (value - 247) * 256 + dict[pos++] + 108;
  24378. } else if (value >= 251 && value <= 254) {
  24379. return -((value - 251) * 256) - dict[pos++] - 108;
  24380. }
  24381. (0, _util.warn)('CFFParser_parseDict: "' + value + '" is a reserved command.');
  24382. return NaN;
  24383. }
  24384. function parseFloatOperand() {
  24385. var str = "";
  24386. var eof = 15;
  24387. const lookup = ["0", "1", "2", "3", "4", "5", "6", "7", "8", "9", ".", "E", "E-", null, "-"];
  24388. var length = dict.length;
  24389. while (pos < length) {
  24390. var b = dict[pos++];
  24391. var b1 = b >> 4;
  24392. var b2 = b & 15;
  24393. if (b1 === eof) {
  24394. break;
  24395. }
  24396. str += lookup[b1];
  24397. if (b2 === eof) {
  24398. break;
  24399. }
  24400. str += lookup[b2];
  24401. }
  24402. return parseFloat(str);
  24403. }
  24404. var operands = [];
  24405. var entries = [];
  24406. pos = 0;
  24407. var end = dict.length;
  24408. while (pos < end) {
  24409. var b = dict[pos];
  24410. if (b <= 21) {
  24411. if (b === 12) {
  24412. b = b << 8 | dict[++pos];
  24413. }
  24414. entries.push([b, operands]);
  24415. operands = [];
  24416. ++pos;
  24417. } else {
  24418. operands.push(parseOperand());
  24419. }
  24420. }
  24421. return entries;
  24422. }
  24423. parseIndex(pos) {
  24424. var cffIndex = new CFFIndex();
  24425. var bytes = this.bytes;
  24426. var count = bytes[pos++] << 8 | bytes[pos++];
  24427. var offsets = [];
  24428. var end = pos;
  24429. var i, ii;
  24430. if (count !== 0) {
  24431. var offsetSize = bytes[pos++];
  24432. var startPos = pos + (count + 1) * offsetSize - 1;
  24433. for (i = 0, ii = count + 1; i < ii; ++i) {
  24434. var offset = 0;
  24435. for (var j = 0; j < offsetSize; ++j) {
  24436. offset <<= 8;
  24437. offset += bytes[pos++];
  24438. }
  24439. offsets.push(startPos + offset);
  24440. }
  24441. end = offsets[count];
  24442. }
  24443. for (i = 0, ii = offsets.length - 1; i < ii; ++i) {
  24444. var offsetStart = offsets[i];
  24445. var offsetEnd = offsets[i + 1];
  24446. cffIndex.add(bytes.subarray(offsetStart, offsetEnd));
  24447. }
  24448. return {
  24449. obj: cffIndex,
  24450. endPos: end
  24451. };
  24452. }
  24453. parseNameIndex(index) {
  24454. var names = [];
  24455. for (var i = 0, ii = index.count; i < ii; ++i) {
  24456. var name = index.get(i);
  24457. names.push((0, _util.bytesToString)(name));
  24458. }
  24459. return names;
  24460. }
  24461. parseStringIndex(index) {
  24462. var strings = new CFFStrings();
  24463. for (var i = 0, ii = index.count; i < ii; ++i) {
  24464. var data = index.get(i);
  24465. strings.add((0, _util.bytesToString)(data));
  24466. }
  24467. return strings;
  24468. }
  24469. createDict(Type, dict, strings) {
  24470. var cffDict = new Type(strings);
  24471. for (var i = 0, ii = dict.length; i < ii; ++i) {
  24472. var pair = dict[i];
  24473. var key = pair[0];
  24474. var value = pair[1];
  24475. cffDict.setByKey(key, value);
  24476. }
  24477. return cffDict;
  24478. }
  24479. parseCharString(state, data, localSubrIndex, globalSubrIndex) {
  24480. if (!data || state.callDepth > MAX_SUBR_NESTING) {
  24481. return false;
  24482. }
  24483. var stackSize = state.stackSize;
  24484. var stack = state.stack;
  24485. var length = data.length;
  24486. for (var j = 0; j < length;) {
  24487. var value = data[j++];
  24488. var validationCommand = null;
  24489. if (value === 12) {
  24490. var q = data[j++];
  24491. if (q === 0) {
  24492. data[j - 2] = 139;
  24493. data[j - 1] = 22;
  24494. stackSize = 0;
  24495. } else {
  24496. validationCommand = CharstringValidationData12[q];
  24497. }
  24498. } else if (value === 28) {
  24499. stack[stackSize] = (data[j] << 24 | data[j + 1] << 16) >> 16;
  24500. j += 2;
  24501. stackSize++;
  24502. } else if (value === 14) {
  24503. if (stackSize >= 4) {
  24504. stackSize -= 4;
  24505. if (this.seacAnalysisEnabled) {
  24506. state.seac = stack.slice(stackSize, stackSize + 4);
  24507. return false;
  24508. }
  24509. }
  24510. validationCommand = CharstringValidationData[value];
  24511. } else if (value >= 32 && value <= 246) {
  24512. stack[stackSize] = value - 139;
  24513. stackSize++;
  24514. } else if (value >= 247 && value <= 254) {
  24515. stack[stackSize] = value < 251 ? (value - 247 << 8) + data[j] + 108 : -(value - 251 << 8) - data[j] - 108;
  24516. j++;
  24517. stackSize++;
  24518. } else if (value === 255) {
  24519. stack[stackSize] = (data[j] << 24 | data[j + 1] << 16 | data[j + 2] << 8 | data[j + 3]) / 65536;
  24520. j += 4;
  24521. stackSize++;
  24522. } else if (value === 19 || value === 20) {
  24523. state.hints += stackSize >> 1;
  24524. j += state.hints + 7 >> 3;
  24525. stackSize %= 2;
  24526. validationCommand = CharstringValidationData[value];
  24527. } else if (value === 10 || value === 29) {
  24528. var subrsIndex;
  24529. if (value === 10) {
  24530. subrsIndex = localSubrIndex;
  24531. } else {
  24532. subrsIndex = globalSubrIndex;
  24533. }
  24534. if (!subrsIndex) {
  24535. validationCommand = CharstringValidationData[value];
  24536. (0, _util.warn)("Missing subrsIndex for " + validationCommand.id);
  24537. return false;
  24538. }
  24539. var bias = 32768;
  24540. if (subrsIndex.count < 1240) {
  24541. bias = 107;
  24542. } else if (subrsIndex.count < 33900) {
  24543. bias = 1131;
  24544. }
  24545. var subrNumber = stack[--stackSize] + bias;
  24546. if (subrNumber < 0 || subrNumber >= subrsIndex.count || isNaN(subrNumber)) {
  24547. validationCommand = CharstringValidationData[value];
  24548. (0, _util.warn)("Out of bounds subrIndex for " + validationCommand.id);
  24549. return false;
  24550. }
  24551. state.stackSize = stackSize;
  24552. state.callDepth++;
  24553. var valid = this.parseCharString(state, subrsIndex.get(subrNumber), localSubrIndex, globalSubrIndex);
  24554. if (!valid) {
  24555. return false;
  24556. }
  24557. state.callDepth--;
  24558. stackSize = state.stackSize;
  24559. continue;
  24560. } else if (value === 11) {
  24561. state.stackSize = stackSize;
  24562. return true;
  24563. } else {
  24564. validationCommand = CharstringValidationData[value];
  24565. }
  24566. if (validationCommand) {
  24567. if (validationCommand.stem) {
  24568. state.hints += stackSize >> 1;
  24569. if (value === 3 || value === 23) {
  24570. state.hasVStems = true;
  24571. } else if (state.hasVStems && (value === 1 || value === 18)) {
  24572. (0, _util.warn)("CFF stem hints are in wrong order");
  24573. data[j - 1] = value === 1 ? 3 : 23;
  24574. }
  24575. }
  24576. if ("min" in validationCommand) {
  24577. if (!state.undefStack && stackSize < validationCommand.min) {
  24578. (0, _util.warn)("Not enough parameters for " + validationCommand.id + "; actual: " + stackSize + ", expected: " + validationCommand.min);
  24579. return false;
  24580. }
  24581. }
  24582. if (state.firstStackClearing && validationCommand.stackClearing) {
  24583. state.firstStackClearing = false;
  24584. stackSize -= validationCommand.min;
  24585. if (stackSize >= 2 && validationCommand.stem) {
  24586. stackSize %= 2;
  24587. } else if (stackSize > 1) {
  24588. (0, _util.warn)("Found too many parameters for stack-clearing command");
  24589. }
  24590. if (stackSize > 0 && stack[stackSize - 1] >= 0) {
  24591. state.width = stack[stackSize - 1];
  24592. }
  24593. }
  24594. if ("stackDelta" in validationCommand) {
  24595. if ("stackFn" in validationCommand) {
  24596. validationCommand.stackFn(stack, stackSize);
  24597. }
  24598. stackSize += validationCommand.stackDelta;
  24599. } else if (validationCommand.stackClearing) {
  24600. stackSize = 0;
  24601. } else if (validationCommand.resetStack) {
  24602. stackSize = 0;
  24603. state.undefStack = false;
  24604. } else if (validationCommand.undefStack) {
  24605. stackSize = 0;
  24606. state.undefStack = true;
  24607. state.firstStackClearing = false;
  24608. }
  24609. }
  24610. }
  24611. state.stackSize = stackSize;
  24612. return true;
  24613. }
  24614. parseCharStrings({
  24615. charStrings,
  24616. localSubrIndex,
  24617. globalSubrIndex,
  24618. fdSelect,
  24619. fdArray,
  24620. privateDict
  24621. }) {
  24622. var seacs = [];
  24623. var widths = [];
  24624. var count = charStrings.count;
  24625. for (var i = 0; i < count; i++) {
  24626. var charstring = charStrings.get(i);
  24627. var state = {
  24628. callDepth: 0,
  24629. stackSize: 0,
  24630. stack: [],
  24631. undefStack: true,
  24632. hints: 0,
  24633. firstStackClearing: true,
  24634. seac: null,
  24635. width: null,
  24636. hasVStems: false
  24637. };
  24638. var valid = true;
  24639. var localSubrToUse = null;
  24640. var privateDictToUse = privateDict;
  24641. if (fdSelect && fdArray.length) {
  24642. var fdIndex = fdSelect.getFDIndex(i);
  24643. if (fdIndex === -1) {
  24644. (0, _util.warn)("Glyph index is not in fd select.");
  24645. valid = false;
  24646. }
  24647. if (fdIndex >= fdArray.length) {
  24648. (0, _util.warn)("Invalid fd index for glyph index.");
  24649. valid = false;
  24650. }
  24651. if (valid) {
  24652. privateDictToUse = fdArray[fdIndex].privateDict;
  24653. localSubrToUse = privateDictToUse.subrsIndex;
  24654. }
  24655. } else if (localSubrIndex) {
  24656. localSubrToUse = localSubrIndex;
  24657. }
  24658. if (valid) {
  24659. valid = this.parseCharString(state, charstring, localSubrToUse, globalSubrIndex);
  24660. }
  24661. if (state.width !== null) {
  24662. const nominalWidth = privateDictToUse.getByName("nominalWidthX");
  24663. widths[i] = nominalWidth + state.width;
  24664. } else {
  24665. const defaultWidth = privateDictToUse.getByName("defaultWidthX");
  24666. widths[i] = defaultWidth;
  24667. }
  24668. if (state.seac !== null) {
  24669. seacs[i] = state.seac;
  24670. }
  24671. if (!valid) {
  24672. charStrings.set(i, new Uint8Array([14]));
  24673. }
  24674. }
  24675. return {
  24676. charStrings,
  24677. seacs,
  24678. widths
  24679. };
  24680. }
  24681. emptyPrivateDictionary(parentDict) {
  24682. var privateDict = this.createDict(CFFPrivateDict, [], parentDict.strings);
  24683. parentDict.setByKey(18, [0, 0]);
  24684. parentDict.privateDict = privateDict;
  24685. }
  24686. parsePrivateDict(parentDict) {
  24687. if (!parentDict.hasName("Private")) {
  24688. this.emptyPrivateDictionary(parentDict);
  24689. return;
  24690. }
  24691. var privateOffset = parentDict.getByName("Private");
  24692. if (!Array.isArray(privateOffset) || privateOffset.length !== 2) {
  24693. parentDict.removeByName("Private");
  24694. return;
  24695. }
  24696. var size = privateOffset[0];
  24697. var offset = privateOffset[1];
  24698. if (size === 0 || offset >= this.bytes.length) {
  24699. this.emptyPrivateDictionary(parentDict);
  24700. return;
  24701. }
  24702. var privateDictEnd = offset + size;
  24703. var dictData = this.bytes.subarray(offset, privateDictEnd);
  24704. var dict = this.parseDict(dictData);
  24705. var privateDict = this.createDict(CFFPrivateDict, dict, parentDict.strings);
  24706. parentDict.privateDict = privateDict;
  24707. if (!privateDict.getByName("Subrs")) {
  24708. return;
  24709. }
  24710. var subrsOffset = privateDict.getByName("Subrs");
  24711. var relativeOffset = offset + subrsOffset;
  24712. if (subrsOffset === 0 || relativeOffset >= this.bytes.length) {
  24713. this.emptyPrivateDictionary(parentDict);
  24714. return;
  24715. }
  24716. var subrsIndex = this.parseIndex(relativeOffset);
  24717. privateDict.subrsIndex = subrsIndex.obj;
  24718. }
  24719. parseCharsets(pos, length, strings, cid) {
  24720. if (pos === 0) {
  24721. return new CFFCharset(true, CFFCharsetPredefinedTypes.ISO_ADOBE, _charsets.ISOAdobeCharset);
  24722. } else if (pos === 1) {
  24723. return new CFFCharset(true, CFFCharsetPredefinedTypes.EXPERT, _charsets.ExpertCharset);
  24724. } else if (pos === 2) {
  24725. return new CFFCharset(true, CFFCharsetPredefinedTypes.EXPERT_SUBSET, _charsets.ExpertSubsetCharset);
  24726. }
  24727. var bytes = this.bytes;
  24728. var start = pos;
  24729. var format = bytes[pos++];
  24730. const charset = [cid ? 0 : ".notdef"];
  24731. var id, count, i;
  24732. length -= 1;
  24733. switch (format) {
  24734. case 0:
  24735. for (i = 0; i < length; i++) {
  24736. id = bytes[pos++] << 8 | bytes[pos++];
  24737. charset.push(cid ? id : strings.get(id));
  24738. }
  24739. break;
  24740. case 1:
  24741. while (charset.length <= length) {
  24742. id = bytes[pos++] << 8 | bytes[pos++];
  24743. count = bytes[pos++];
  24744. for (i = 0; i <= count; i++) {
  24745. charset.push(cid ? id++ : strings.get(id++));
  24746. }
  24747. }
  24748. break;
  24749. case 2:
  24750. while (charset.length <= length) {
  24751. id = bytes[pos++] << 8 | bytes[pos++];
  24752. count = bytes[pos++] << 8 | bytes[pos++];
  24753. for (i = 0; i <= count; i++) {
  24754. charset.push(cid ? id++ : strings.get(id++));
  24755. }
  24756. }
  24757. break;
  24758. default:
  24759. throw new _util.FormatError("Unknown charset format");
  24760. }
  24761. var end = pos;
  24762. var raw = bytes.subarray(start, end);
  24763. return new CFFCharset(false, format, charset, raw);
  24764. }
  24765. parseEncoding(pos, properties, strings, charset) {
  24766. var encoding = Object.create(null);
  24767. var bytes = this.bytes;
  24768. var predefined = false;
  24769. var format, i, ii;
  24770. var raw = null;
  24771. function readSupplement() {
  24772. var supplementsCount = bytes[pos++];
  24773. for (i = 0; i < supplementsCount; i++) {
  24774. var code = bytes[pos++];
  24775. var sid = (bytes[pos++] << 8) + (bytes[pos++] & 0xff);
  24776. encoding[code] = charset.indexOf(strings.get(sid));
  24777. }
  24778. }
  24779. if (pos === 0 || pos === 1) {
  24780. predefined = true;
  24781. format = pos;
  24782. var baseEncoding = pos ? _encodings.ExpertEncoding : _encodings.StandardEncoding;
  24783. for (i = 0, ii = charset.length; i < ii; i++) {
  24784. var index = baseEncoding.indexOf(charset[i]);
  24785. if (index !== -1) {
  24786. encoding[index] = i;
  24787. }
  24788. }
  24789. } else {
  24790. var dataStart = pos;
  24791. format = bytes[pos++];
  24792. switch (format & 0x7f) {
  24793. case 0:
  24794. var glyphsCount = bytes[pos++];
  24795. for (i = 1; i <= glyphsCount; i++) {
  24796. encoding[bytes[pos++]] = i;
  24797. }
  24798. break;
  24799. case 1:
  24800. var rangesCount = bytes[pos++];
  24801. var gid = 1;
  24802. for (i = 0; i < rangesCount; i++) {
  24803. var start = bytes[pos++];
  24804. var left = bytes[pos++];
  24805. for (var j = start; j <= start + left; j++) {
  24806. encoding[j] = gid++;
  24807. }
  24808. }
  24809. break;
  24810. default:
  24811. throw new _util.FormatError(`Unknown encoding format: ${format} in CFF`);
  24812. }
  24813. var dataEnd = pos;
  24814. if (format & 0x80) {
  24815. bytes[dataStart] &= 0x7f;
  24816. readSupplement();
  24817. }
  24818. raw = bytes.subarray(dataStart, dataEnd);
  24819. }
  24820. format = format & 0x7f;
  24821. return new CFFEncoding(predefined, format, encoding, raw);
  24822. }
  24823. parseFDSelect(pos, length) {
  24824. var bytes = this.bytes;
  24825. var format = bytes[pos++];
  24826. var fdSelect = [];
  24827. var i;
  24828. switch (format) {
  24829. case 0:
  24830. for (i = 0; i < length; ++i) {
  24831. var id = bytes[pos++];
  24832. fdSelect.push(id);
  24833. }
  24834. break;
  24835. case 3:
  24836. var rangesCount = bytes[pos++] << 8 | bytes[pos++];
  24837. for (i = 0; i < rangesCount; ++i) {
  24838. var first = bytes[pos++] << 8 | bytes[pos++];
  24839. if (i === 0 && first !== 0) {
  24840. (0, _util.warn)("parseFDSelect: The first range must have a first GID of 0" + " -- trying to recover.");
  24841. first = 0;
  24842. }
  24843. var fdIndex = bytes[pos++];
  24844. var next = bytes[pos] << 8 | bytes[pos + 1];
  24845. for (var j = first; j < next; ++j) {
  24846. fdSelect.push(fdIndex);
  24847. }
  24848. }
  24849. pos += 2;
  24850. break;
  24851. default:
  24852. throw new _util.FormatError(`parseFDSelect: Unknown format "${format}".`);
  24853. }
  24854. if (fdSelect.length !== length) {
  24855. throw new _util.FormatError("parseFDSelect: Invalid font data.");
  24856. }
  24857. return new CFFFDSelect(format, fdSelect);
  24858. }
  24859. }
  24860. return CFFParser;
  24861. }();
  24862. exports.CFFParser = CFFParser;
  24863. class CFF {
  24864. constructor() {
  24865. this.header = null;
  24866. this.names = [];
  24867. this.topDict = null;
  24868. this.strings = new CFFStrings();
  24869. this.globalSubrIndex = null;
  24870. this.encoding = null;
  24871. this.charset = null;
  24872. this.charStrings = null;
  24873. this.fdArray = [];
  24874. this.fdSelect = null;
  24875. this.isCIDFont = false;
  24876. }
  24877. duplicateFirstGlyph() {
  24878. if (this.charStrings.count >= 65535) {
  24879. (0, _util.warn)("Not enough space in charstrings to duplicate first glyph.");
  24880. return;
  24881. }
  24882. var glyphZero = this.charStrings.get(0);
  24883. this.charStrings.add(glyphZero);
  24884. if (this.isCIDFont) {
  24885. this.fdSelect.fdSelect.push(this.fdSelect.fdSelect[0]);
  24886. }
  24887. }
  24888. hasGlyphId(id) {
  24889. if (id < 0 || id >= this.charStrings.count) {
  24890. return false;
  24891. }
  24892. var glyph = this.charStrings.get(id);
  24893. return glyph.length > 0;
  24894. }
  24895. }
  24896. exports.CFF = CFF;
  24897. class CFFHeader {
  24898. constructor(major, minor, hdrSize, offSize) {
  24899. this.major = major;
  24900. this.minor = minor;
  24901. this.hdrSize = hdrSize;
  24902. this.offSize = offSize;
  24903. }
  24904. }
  24905. exports.CFFHeader = CFFHeader;
  24906. class CFFStrings {
  24907. constructor() {
  24908. this.strings = [];
  24909. }
  24910. get(index) {
  24911. if (index >= 0 && index <= NUM_STANDARD_CFF_STRINGS - 1) {
  24912. return CFFStandardStrings[index];
  24913. }
  24914. if (index - NUM_STANDARD_CFF_STRINGS <= this.strings.length) {
  24915. return this.strings[index - NUM_STANDARD_CFF_STRINGS];
  24916. }
  24917. return CFFStandardStrings[0];
  24918. }
  24919. getSID(str) {
  24920. let index = CFFStandardStrings.indexOf(str);
  24921. if (index !== -1) {
  24922. return index;
  24923. }
  24924. index = this.strings.indexOf(str);
  24925. if (index !== -1) {
  24926. return index + NUM_STANDARD_CFF_STRINGS;
  24927. }
  24928. return -1;
  24929. }
  24930. add(value) {
  24931. this.strings.push(value);
  24932. }
  24933. get count() {
  24934. return this.strings.length;
  24935. }
  24936. }
  24937. exports.CFFStrings = CFFStrings;
  24938. class CFFIndex {
  24939. constructor() {
  24940. this.objects = [];
  24941. this.length = 0;
  24942. }
  24943. add(data) {
  24944. this.length += data.length;
  24945. this.objects.push(data);
  24946. }
  24947. set(index, data) {
  24948. this.length += data.length - this.objects[index].length;
  24949. this.objects[index] = data;
  24950. }
  24951. get(index) {
  24952. return this.objects[index];
  24953. }
  24954. get count() {
  24955. return this.objects.length;
  24956. }
  24957. }
  24958. exports.CFFIndex = CFFIndex;
  24959. class CFFDict {
  24960. constructor(tables, strings) {
  24961. this.keyToNameMap = tables.keyToNameMap;
  24962. this.nameToKeyMap = tables.nameToKeyMap;
  24963. this.defaults = tables.defaults;
  24964. this.types = tables.types;
  24965. this.opcodes = tables.opcodes;
  24966. this.order = tables.order;
  24967. this.strings = strings;
  24968. this.values = Object.create(null);
  24969. }
  24970. setByKey(key, value) {
  24971. if (!(key in this.keyToNameMap)) {
  24972. return false;
  24973. }
  24974. var valueLength = value.length;
  24975. if (valueLength === 0) {
  24976. return true;
  24977. }
  24978. for (var i = 0; i < valueLength; i++) {
  24979. if (isNaN(value[i])) {
  24980. (0, _util.warn)('Invalid CFFDict value: "' + value + '" for key "' + key + '".');
  24981. return true;
  24982. }
  24983. }
  24984. var type = this.types[key];
  24985. if (type === "num" || type === "sid" || type === "offset") {
  24986. value = value[0];
  24987. }
  24988. this.values[key] = value;
  24989. return true;
  24990. }
  24991. setByName(name, value) {
  24992. if (!(name in this.nameToKeyMap)) {
  24993. throw new _util.FormatError(`Invalid dictionary name "${name}"`);
  24994. }
  24995. this.values[this.nameToKeyMap[name]] = value;
  24996. }
  24997. hasName(name) {
  24998. return this.nameToKeyMap[name] in this.values;
  24999. }
  25000. getByName(name) {
  25001. if (!(name in this.nameToKeyMap)) {
  25002. throw new _util.FormatError(`Invalid dictionary name ${name}"`);
  25003. }
  25004. var key = this.nameToKeyMap[name];
  25005. if (!(key in this.values)) {
  25006. return this.defaults[key];
  25007. }
  25008. return this.values[key];
  25009. }
  25010. removeByName(name) {
  25011. delete this.values[this.nameToKeyMap[name]];
  25012. }
  25013. static createTables(layout) {
  25014. var tables = {
  25015. keyToNameMap: {},
  25016. nameToKeyMap: {},
  25017. defaults: {},
  25018. types: {},
  25019. opcodes: {},
  25020. order: []
  25021. };
  25022. for (var i = 0, ii = layout.length; i < ii; ++i) {
  25023. var entry = layout[i];
  25024. var key = Array.isArray(entry[0]) ? (entry[0][0] << 8) + entry[0][1] : entry[0];
  25025. tables.keyToNameMap[key] = entry[1];
  25026. tables.nameToKeyMap[entry[1]] = key;
  25027. tables.types[key] = entry[2];
  25028. tables.defaults[key] = entry[3];
  25029. tables.opcodes[key] = Array.isArray(entry[0]) ? entry[0] : [entry[0]];
  25030. tables.order.push(key);
  25031. }
  25032. return tables;
  25033. }
  25034. }
  25035. var CFFTopDict = function CFFTopDictClosure() {
  25036. var layout = [[[12, 30], "ROS", ["sid", "sid", "num"], null], [[12, 20], "SyntheticBase", "num", null], [0, "version", "sid", null], [1, "Notice", "sid", null], [[12, 0], "Copyright", "sid", null], [2, "FullName", "sid", null], [3, "FamilyName", "sid", null], [4, "Weight", "sid", null], [[12, 1], "isFixedPitch", "num", 0], [[12, 2], "ItalicAngle", "num", 0], [[12, 3], "UnderlinePosition", "num", -100], [[12, 4], "UnderlineThickness", "num", 50], [[12, 5], "PaintType", "num", 0], [[12, 6], "CharstringType", "num", 2], [[12, 7], "FontMatrix", ["num", "num", "num", "num", "num", "num"], [0.001, 0, 0, 0.001, 0, 0]], [13, "UniqueID", "num", null], [5, "FontBBox", ["num", "num", "num", "num"], [0, 0, 0, 0]], [[12, 8], "StrokeWidth", "num", 0], [14, "XUID", "array", null], [15, "charset", "offset", 0], [16, "Encoding", "offset", 0], [17, "CharStrings", "offset", 0], [18, "Private", ["offset", "offset"], null], [[12, 21], "PostScript", "sid", null], [[12, 22], "BaseFontName", "sid", null], [[12, 23], "BaseFontBlend", "delta", null], [[12, 31], "CIDFontVersion", "num", 0], [[12, 32], "CIDFontRevision", "num", 0], [[12, 33], "CIDFontType", "num", 0], [[12, 34], "CIDCount", "num", 8720], [[12, 35], "UIDBase", "num", null], [[12, 37], "FDSelect", "offset", null], [[12, 36], "FDArray", "offset", null], [[12, 38], "FontName", "sid", null]];
  25037. var tables = null;
  25038. class CFFTopDict extends CFFDict {
  25039. constructor(strings) {
  25040. if (tables === null) {
  25041. tables = CFFDict.createTables(layout);
  25042. }
  25043. super(tables, strings);
  25044. this.privateDict = null;
  25045. }
  25046. }
  25047. return CFFTopDict;
  25048. }();
  25049. exports.CFFTopDict = CFFTopDict;
  25050. var CFFPrivateDict = function CFFPrivateDictClosure() {
  25051. var layout = [[6, "BlueValues", "delta", null], [7, "OtherBlues", "delta", null], [8, "FamilyBlues", "delta", null], [9, "FamilyOtherBlues", "delta", null], [[12, 9], "BlueScale", "num", 0.039625], [[12, 10], "BlueShift", "num", 7], [[12, 11], "BlueFuzz", "num", 1], [10, "StdHW", "num", null], [11, "StdVW", "num", null], [[12, 12], "StemSnapH", "delta", null], [[12, 13], "StemSnapV", "delta", null], [[12, 14], "ForceBold", "num", 0], [[12, 17], "LanguageGroup", "num", 0], [[12, 18], "ExpansionFactor", "num", 0.06], [[12, 19], "initialRandomSeed", "num", 0], [20, "defaultWidthX", "num", 0], [21, "nominalWidthX", "num", 0], [19, "Subrs", "offset", null]];
  25052. var tables = null;
  25053. class CFFPrivateDict extends CFFDict {
  25054. constructor(strings) {
  25055. if (tables === null) {
  25056. tables = CFFDict.createTables(layout);
  25057. }
  25058. super(tables, strings);
  25059. this.subrsIndex = null;
  25060. }
  25061. }
  25062. return CFFPrivateDict;
  25063. }();
  25064. exports.CFFPrivateDict = CFFPrivateDict;
  25065. var CFFCharsetPredefinedTypes = {
  25066. ISO_ADOBE: 0,
  25067. EXPERT: 1,
  25068. EXPERT_SUBSET: 2
  25069. };
  25070. class CFFCharset {
  25071. constructor(predefined, format, charset, raw) {
  25072. this.predefined = predefined;
  25073. this.format = format;
  25074. this.charset = charset;
  25075. this.raw = raw;
  25076. }
  25077. }
  25078. exports.CFFCharset = CFFCharset;
  25079. class CFFEncoding {
  25080. constructor(predefined, format, encoding, raw) {
  25081. this.predefined = predefined;
  25082. this.format = format;
  25083. this.encoding = encoding;
  25084. this.raw = raw;
  25085. }
  25086. }
  25087. class CFFFDSelect {
  25088. constructor(format, fdSelect) {
  25089. this.format = format;
  25090. this.fdSelect = fdSelect;
  25091. }
  25092. getFDIndex(glyphIndex) {
  25093. if (glyphIndex < 0 || glyphIndex >= this.fdSelect.length) {
  25094. return -1;
  25095. }
  25096. return this.fdSelect[glyphIndex];
  25097. }
  25098. }
  25099. exports.CFFFDSelect = CFFFDSelect;
  25100. class CFFOffsetTracker {
  25101. constructor() {
  25102. this.offsets = Object.create(null);
  25103. }
  25104. isTracking(key) {
  25105. return key in this.offsets;
  25106. }
  25107. track(key, location) {
  25108. if (key in this.offsets) {
  25109. throw new _util.FormatError(`Already tracking location of ${key}`);
  25110. }
  25111. this.offsets[key] = location;
  25112. }
  25113. offset(value) {
  25114. for (var key in this.offsets) {
  25115. this.offsets[key] += value;
  25116. }
  25117. }
  25118. setEntryLocation(key, values, output) {
  25119. if (!(key in this.offsets)) {
  25120. throw new _util.FormatError(`Not tracking location of ${key}`);
  25121. }
  25122. var data = output.data;
  25123. var dataOffset = this.offsets[key];
  25124. var size = 5;
  25125. for (var i = 0, ii = values.length; i < ii; ++i) {
  25126. var offset0 = i * size + dataOffset;
  25127. var offset1 = offset0 + 1;
  25128. var offset2 = offset0 + 2;
  25129. var offset3 = offset0 + 3;
  25130. var offset4 = offset0 + 4;
  25131. if (data[offset0] !== 0x1d || data[offset1] !== 0 || data[offset2] !== 0 || data[offset3] !== 0 || data[offset4] !== 0) {
  25132. throw new _util.FormatError("writing to an offset that is not empty");
  25133. }
  25134. var value = values[i];
  25135. data[offset0] = 0x1d;
  25136. data[offset1] = value >> 24 & 0xff;
  25137. data[offset2] = value >> 16 & 0xff;
  25138. data[offset3] = value >> 8 & 0xff;
  25139. data[offset4] = value & 0xff;
  25140. }
  25141. }
  25142. }
  25143. class CFFCompiler {
  25144. constructor(cff) {
  25145. this.cff = cff;
  25146. }
  25147. compile() {
  25148. var cff = this.cff;
  25149. var output = {
  25150. data: [],
  25151. length: 0,
  25152. add: function CFFCompiler_add(data) {
  25153. this.data = this.data.concat(data);
  25154. this.length = this.data.length;
  25155. }
  25156. };
  25157. var header = this.compileHeader(cff.header);
  25158. output.add(header);
  25159. var nameIndex = this.compileNameIndex(cff.names);
  25160. output.add(nameIndex);
  25161. if (cff.isCIDFont) {
  25162. if (cff.topDict.hasName("FontMatrix")) {
  25163. var base = cff.topDict.getByName("FontMatrix");
  25164. cff.topDict.removeByName("FontMatrix");
  25165. for (var i = 0, ii = cff.fdArray.length; i < ii; i++) {
  25166. var subDict = cff.fdArray[i];
  25167. var matrix = base.slice(0);
  25168. if (subDict.hasName("FontMatrix")) {
  25169. matrix = _util.Util.transform(matrix, subDict.getByName("FontMatrix"));
  25170. }
  25171. subDict.setByName("FontMatrix", matrix);
  25172. }
  25173. }
  25174. }
  25175. const xuid = cff.topDict.getByName("XUID");
  25176. if (xuid && xuid.length > 16) {
  25177. cff.topDict.removeByName("XUID");
  25178. }
  25179. cff.topDict.setByName("charset", 0);
  25180. var compiled = this.compileTopDicts([cff.topDict], output.length, cff.isCIDFont);
  25181. output.add(compiled.output);
  25182. var topDictTracker = compiled.trackers[0];
  25183. var stringIndex = this.compileStringIndex(cff.strings.strings);
  25184. output.add(stringIndex);
  25185. var globalSubrIndex = this.compileIndex(cff.globalSubrIndex);
  25186. output.add(globalSubrIndex);
  25187. if (cff.encoding && cff.topDict.hasName("Encoding")) {
  25188. if (cff.encoding.predefined) {
  25189. topDictTracker.setEntryLocation("Encoding", [cff.encoding.format], output);
  25190. } else {
  25191. var encoding = this.compileEncoding(cff.encoding);
  25192. topDictTracker.setEntryLocation("Encoding", [output.length], output);
  25193. output.add(encoding);
  25194. }
  25195. }
  25196. var charset = this.compileCharset(cff.charset, cff.charStrings.count, cff.strings, cff.isCIDFont);
  25197. topDictTracker.setEntryLocation("charset", [output.length], output);
  25198. output.add(charset);
  25199. var charStrings = this.compileCharStrings(cff.charStrings);
  25200. topDictTracker.setEntryLocation("CharStrings", [output.length], output);
  25201. output.add(charStrings);
  25202. if (cff.isCIDFont) {
  25203. topDictTracker.setEntryLocation("FDSelect", [output.length], output);
  25204. var fdSelect = this.compileFDSelect(cff.fdSelect);
  25205. output.add(fdSelect);
  25206. compiled = this.compileTopDicts(cff.fdArray, output.length, true);
  25207. topDictTracker.setEntryLocation("FDArray", [output.length], output);
  25208. output.add(compiled.output);
  25209. var fontDictTrackers = compiled.trackers;
  25210. this.compilePrivateDicts(cff.fdArray, fontDictTrackers, output);
  25211. }
  25212. this.compilePrivateDicts([cff.topDict], [topDictTracker], output);
  25213. output.add([0]);
  25214. return output.data;
  25215. }
  25216. encodeNumber(value) {
  25217. if (Number.isInteger(value)) {
  25218. return this.encodeInteger(value);
  25219. }
  25220. return this.encodeFloat(value);
  25221. }
  25222. static get EncodeFloatRegExp() {
  25223. return (0, _util.shadow)(this, "EncodeFloatRegExp", /\.(\d*?)(?:9{5,20}|0{5,20})\d{0,2}(?:e(.+)|$)/);
  25224. }
  25225. encodeFloat(num) {
  25226. var value = num.toString();
  25227. var m = CFFCompiler.EncodeFloatRegExp.exec(value);
  25228. if (m) {
  25229. var epsilon = parseFloat("1e" + ((m[2] ? +m[2] : 0) + m[1].length));
  25230. value = (Math.round(num * epsilon) / epsilon).toString();
  25231. }
  25232. var nibbles = "";
  25233. var i, ii;
  25234. for (i = 0, ii = value.length; i < ii; ++i) {
  25235. var a = value[i];
  25236. if (a === "e") {
  25237. nibbles += value[++i] === "-" ? "c" : "b";
  25238. } else if (a === ".") {
  25239. nibbles += "a";
  25240. } else if (a === "-") {
  25241. nibbles += "e";
  25242. } else {
  25243. nibbles += a;
  25244. }
  25245. }
  25246. nibbles += nibbles.length & 1 ? "f" : "ff";
  25247. var out = [30];
  25248. for (i = 0, ii = nibbles.length; i < ii; i += 2) {
  25249. out.push(parseInt(nibbles.substring(i, i + 2), 16));
  25250. }
  25251. return out;
  25252. }
  25253. encodeInteger(value) {
  25254. var code;
  25255. if (value >= -107 && value <= 107) {
  25256. code = [value + 139];
  25257. } else if (value >= 108 && value <= 1131) {
  25258. value = value - 108;
  25259. code = [(value >> 8) + 247, value & 0xff];
  25260. } else if (value >= -1131 && value <= -108) {
  25261. value = -value - 108;
  25262. code = [(value >> 8) + 251, value & 0xff];
  25263. } else if (value >= -32768 && value <= 32767) {
  25264. code = [0x1c, value >> 8 & 0xff, value & 0xff];
  25265. } else {
  25266. code = [0x1d, value >> 24 & 0xff, value >> 16 & 0xff, value >> 8 & 0xff, value & 0xff];
  25267. }
  25268. return code;
  25269. }
  25270. compileHeader(header) {
  25271. return [header.major, header.minor, header.hdrSize, header.offSize];
  25272. }
  25273. compileNameIndex(names) {
  25274. var nameIndex = new CFFIndex();
  25275. for (var i = 0, ii = names.length; i < ii; ++i) {
  25276. var name = names[i];
  25277. var length = Math.min(name.length, 127);
  25278. var sanitizedName = new Array(length);
  25279. for (var j = 0; j < length; j++) {
  25280. var char = name[j];
  25281. if (char < "!" || char > "~" || char === "[" || char === "]" || char === "(" || char === ")" || char === "{" || char === "}" || char === "<" || char === ">" || char === "/" || char === "%") {
  25282. char = "_";
  25283. }
  25284. sanitizedName[j] = char;
  25285. }
  25286. sanitizedName = sanitizedName.join("");
  25287. if (sanitizedName === "") {
  25288. sanitizedName = "Bad_Font_Name";
  25289. }
  25290. nameIndex.add((0, _util.stringToBytes)(sanitizedName));
  25291. }
  25292. return this.compileIndex(nameIndex);
  25293. }
  25294. compileTopDicts(dicts, length, removeCidKeys) {
  25295. var fontDictTrackers = [];
  25296. var fdArrayIndex = new CFFIndex();
  25297. for (var i = 0, ii = dicts.length; i < ii; ++i) {
  25298. var fontDict = dicts[i];
  25299. if (removeCidKeys) {
  25300. fontDict.removeByName("CIDFontVersion");
  25301. fontDict.removeByName("CIDFontRevision");
  25302. fontDict.removeByName("CIDFontType");
  25303. fontDict.removeByName("CIDCount");
  25304. fontDict.removeByName("UIDBase");
  25305. }
  25306. var fontDictTracker = new CFFOffsetTracker();
  25307. var fontDictData = this.compileDict(fontDict, fontDictTracker);
  25308. fontDictTrackers.push(fontDictTracker);
  25309. fdArrayIndex.add(fontDictData);
  25310. fontDictTracker.offset(length);
  25311. }
  25312. fdArrayIndex = this.compileIndex(fdArrayIndex, fontDictTrackers);
  25313. return {
  25314. trackers: fontDictTrackers,
  25315. output: fdArrayIndex
  25316. };
  25317. }
  25318. compilePrivateDicts(dicts, trackers, output) {
  25319. for (var i = 0, ii = dicts.length; i < ii; ++i) {
  25320. var fontDict = dicts[i];
  25321. var privateDict = fontDict.privateDict;
  25322. if (!privateDict || !fontDict.hasName("Private")) {
  25323. throw new _util.FormatError("There must be a private dictionary.");
  25324. }
  25325. var privateDictTracker = new CFFOffsetTracker();
  25326. var privateDictData = this.compileDict(privateDict, privateDictTracker);
  25327. var outputLength = output.length;
  25328. privateDictTracker.offset(outputLength);
  25329. if (!privateDictData.length) {
  25330. outputLength = 0;
  25331. }
  25332. trackers[i].setEntryLocation("Private", [privateDictData.length, outputLength], output);
  25333. output.add(privateDictData);
  25334. if (privateDict.subrsIndex && privateDict.hasName("Subrs")) {
  25335. var subrs = this.compileIndex(privateDict.subrsIndex);
  25336. privateDictTracker.setEntryLocation("Subrs", [privateDictData.length], output);
  25337. output.add(subrs);
  25338. }
  25339. }
  25340. }
  25341. compileDict(dict, offsetTracker) {
  25342. var out = [];
  25343. var order = dict.order;
  25344. for (var i = 0; i < order.length; ++i) {
  25345. var key = order[i];
  25346. if (!(key in dict.values)) {
  25347. continue;
  25348. }
  25349. var values = dict.values[key];
  25350. var types = dict.types[key];
  25351. if (!Array.isArray(types)) {
  25352. types = [types];
  25353. }
  25354. if (!Array.isArray(values)) {
  25355. values = [values];
  25356. }
  25357. if (values.length === 0) {
  25358. continue;
  25359. }
  25360. for (var j = 0, jj = types.length; j < jj; ++j) {
  25361. var type = types[j];
  25362. var value = values[j];
  25363. switch (type) {
  25364. case "num":
  25365. case "sid":
  25366. out = out.concat(this.encodeNumber(value));
  25367. break;
  25368. case "offset":
  25369. var name = dict.keyToNameMap[key];
  25370. if (!offsetTracker.isTracking(name)) {
  25371. offsetTracker.track(name, out.length);
  25372. }
  25373. out = out.concat([0x1d, 0, 0, 0, 0]);
  25374. break;
  25375. case "array":
  25376. case "delta":
  25377. out = out.concat(this.encodeNumber(value));
  25378. for (var k = 1, kk = values.length; k < kk; ++k) {
  25379. out = out.concat(this.encodeNumber(values[k]));
  25380. }
  25381. break;
  25382. default:
  25383. throw new _util.FormatError(`Unknown data type of ${type}`);
  25384. }
  25385. }
  25386. out = out.concat(dict.opcodes[key]);
  25387. }
  25388. return out;
  25389. }
  25390. compileStringIndex(strings) {
  25391. var stringIndex = new CFFIndex();
  25392. for (var i = 0, ii = strings.length; i < ii; ++i) {
  25393. stringIndex.add((0, _util.stringToBytes)(strings[i]));
  25394. }
  25395. return this.compileIndex(stringIndex);
  25396. }
  25397. compileGlobalSubrIndex() {
  25398. var globalSubrIndex = this.cff.globalSubrIndex;
  25399. this.out.writeByteArray(this.compileIndex(globalSubrIndex));
  25400. }
  25401. compileCharStrings(charStrings) {
  25402. var charStringsIndex = new CFFIndex();
  25403. for (var i = 0; i < charStrings.count; i++) {
  25404. var glyph = charStrings.get(i);
  25405. if (glyph.length === 0) {
  25406. charStringsIndex.add(new Uint8Array([0x8b, 0x0e]));
  25407. continue;
  25408. }
  25409. charStringsIndex.add(glyph);
  25410. }
  25411. return this.compileIndex(charStringsIndex);
  25412. }
  25413. compileCharset(charset, numGlyphs, strings, isCIDFont) {
  25414. let out;
  25415. const numGlyphsLessNotDef = numGlyphs - 1;
  25416. if (isCIDFont) {
  25417. out = new Uint8Array([2, 0, 0, numGlyphsLessNotDef >> 8 & 0xff, numGlyphsLessNotDef & 0xff]);
  25418. } else {
  25419. const length = 1 + numGlyphsLessNotDef * 2;
  25420. out = new Uint8Array(length);
  25421. out[0] = 0;
  25422. let charsetIndex = 0;
  25423. const numCharsets = charset.charset.length;
  25424. let warned = false;
  25425. for (let i = 1; i < out.length; i += 2) {
  25426. let sid = 0;
  25427. if (charsetIndex < numCharsets) {
  25428. const name = charset.charset[charsetIndex++];
  25429. sid = strings.getSID(name);
  25430. if (sid === -1) {
  25431. sid = 0;
  25432. if (!warned) {
  25433. warned = true;
  25434. (0, _util.warn)(`Couldn't find ${name} in CFF strings`);
  25435. }
  25436. }
  25437. }
  25438. out[i] = sid >> 8 & 0xff;
  25439. out[i + 1] = sid & 0xff;
  25440. }
  25441. }
  25442. return this.compileTypedArray(out);
  25443. }
  25444. compileEncoding(encoding) {
  25445. return this.compileTypedArray(encoding.raw);
  25446. }
  25447. compileFDSelect(fdSelect) {
  25448. const format = fdSelect.format;
  25449. let out, i;
  25450. switch (format) {
  25451. case 0:
  25452. out = new Uint8Array(1 + fdSelect.fdSelect.length);
  25453. out[0] = format;
  25454. for (i = 0; i < fdSelect.fdSelect.length; i++) {
  25455. out[i + 1] = fdSelect.fdSelect[i];
  25456. }
  25457. break;
  25458. case 3:
  25459. const start = 0;
  25460. let lastFD = fdSelect.fdSelect[0];
  25461. const ranges = [format, 0, 0, start >> 8 & 0xff, start & 0xff, lastFD];
  25462. for (i = 1; i < fdSelect.fdSelect.length; i++) {
  25463. const currentFD = fdSelect.fdSelect[i];
  25464. if (currentFD !== lastFD) {
  25465. ranges.push(i >> 8 & 0xff, i & 0xff, currentFD);
  25466. lastFD = currentFD;
  25467. }
  25468. }
  25469. const numRanges = (ranges.length - 3) / 3;
  25470. ranges[1] = numRanges >> 8 & 0xff;
  25471. ranges[2] = numRanges & 0xff;
  25472. ranges.push(i >> 8 & 0xff, i & 0xff);
  25473. out = new Uint8Array(ranges);
  25474. break;
  25475. }
  25476. return this.compileTypedArray(out);
  25477. }
  25478. compileTypedArray(data) {
  25479. var out = [];
  25480. for (var i = 0, ii = data.length; i < ii; ++i) {
  25481. out[i] = data[i];
  25482. }
  25483. return out;
  25484. }
  25485. compileIndex(index, trackers = []) {
  25486. var objects = index.objects;
  25487. var count = objects.length;
  25488. if (count === 0) {
  25489. return [0, 0, 0];
  25490. }
  25491. var data = [count >> 8 & 0xff, count & 0xff];
  25492. var lastOffset = 1,
  25493. i;
  25494. for (i = 0; i < count; ++i) {
  25495. lastOffset += objects[i].length;
  25496. }
  25497. var offsetSize;
  25498. if (lastOffset < 0x100) {
  25499. offsetSize = 1;
  25500. } else if (lastOffset < 0x10000) {
  25501. offsetSize = 2;
  25502. } else if (lastOffset < 0x1000000) {
  25503. offsetSize = 3;
  25504. } else {
  25505. offsetSize = 4;
  25506. }
  25507. data.push(offsetSize);
  25508. var relativeOffset = 1;
  25509. for (i = 0; i < count + 1; i++) {
  25510. if (offsetSize === 1) {
  25511. data.push(relativeOffset & 0xff);
  25512. } else if (offsetSize === 2) {
  25513. data.push(relativeOffset >> 8 & 0xff, relativeOffset & 0xff);
  25514. } else if (offsetSize === 3) {
  25515. data.push(relativeOffset >> 16 & 0xff, relativeOffset >> 8 & 0xff, relativeOffset & 0xff);
  25516. } else {
  25517. data.push(relativeOffset >>> 24 & 0xff, relativeOffset >> 16 & 0xff, relativeOffset >> 8 & 0xff, relativeOffset & 0xff);
  25518. }
  25519. if (objects[i]) {
  25520. relativeOffset += objects[i].length;
  25521. }
  25522. }
  25523. for (i = 0; i < count; i++) {
  25524. if (trackers[i]) {
  25525. trackers[i].offset(data.length);
  25526. }
  25527. for (var j = 0, jj = objects[i].length; j < jj; j++) {
  25528. data.push(objects[i][j]);
  25529. }
  25530. }
  25531. return data;
  25532. }
  25533. }
  25534. exports.CFFCompiler = CFFCompiler;
  25535. /***/ }),
  25536. /* 31 */
  25537. /***/ ((__unused_webpack_module, exports) => {
  25538. Object.defineProperty(exports, "__esModule", ({
  25539. value: true
  25540. }));
  25541. exports.ISOAdobeCharset = exports.ExpertSubsetCharset = exports.ExpertCharset = void 0;
  25542. const ISOAdobeCharset = [".notdef", "space", "exclam", "quotedbl", "numbersign", "dollar", "percent", "ampersand", "quoteright", "parenleft", "parenright", "asterisk", "plus", "comma", "hyphen", "period", "slash", "zero", "one", "two", "three", "four", "five", "six", "seven", "eight", "nine", "colon", "semicolon", "less", "equal", "greater", "question", "at", "A", "B", "C", "D", "E", "F", "G", "H", "I", "J", "K", "L", "M", "N", "O", "P", "Q", "R", "S", "T", "U", "V", "W", "X", "Y", "Z", "bracketleft", "backslash", "bracketright", "asciicircum", "underscore", "quoteleft", "a", "b", "c", "d", "e", "f", "g", "h", "i", "j", "k", "l", "m", "n", "o", "p", "q", "r", "s", "t", "u", "v", "w", "x", "y", "z", "braceleft", "bar", "braceright", "asciitilde", "exclamdown", "cent", "sterling", "fraction", "yen", "florin", "section", "currency", "quotesingle", "quotedblleft", "guillemotleft", "guilsinglleft", "guilsinglright", "fi", "fl", "endash", "dagger", "daggerdbl", "periodcentered", "paragraph", "bullet", "quotesinglbase", "quotedblbase", "quotedblright", "guillemotright", "ellipsis", "perthousand", "questiondown", "grave", "acute", "circumflex", "tilde", "macron", "breve", "dotaccent", "dieresis", "ring", "cedilla", "hungarumlaut", "ogonek", "caron", "emdash", "AE", "ordfeminine", "Lslash", "Oslash", "OE", "ordmasculine", "ae", "dotlessi", "lslash", "oslash", "oe", "germandbls", "onesuperior", "logicalnot", "mu", "trademark", "Eth", "onehalf", "plusminus", "Thorn", "onequarter", "divide", "brokenbar", "degree", "thorn", "threequarters", "twosuperior", "registered", "minus", "eth", "multiply", "threesuperior", "copyright", "Aacute", "Acircumflex", "Adieresis", "Agrave", "Aring", "Atilde", "Ccedilla", "Eacute", "Ecircumflex", "Edieresis", "Egrave", "Iacute", "Icircumflex", "Idieresis", "Igrave", "Ntilde", "Oacute", "Ocircumflex", "Odieresis", "Ograve", "Otilde", "Scaron", "Uacute", "Ucircumflex", "Udieresis", "Ugrave", "Yacute", "Ydieresis", "Zcaron", "aacute", "acircumflex", "adieresis", "agrave", "aring", "atilde", "ccedilla", "eacute", "ecircumflex", "edieresis", "egrave", "iacute", "icircumflex", "idieresis", "igrave", "ntilde", "oacute", "ocircumflex", "odieresis", "ograve", "otilde", "scaron", "uacute", "ucircumflex", "udieresis", "ugrave", "yacute", "ydieresis", "zcaron"];
  25543. exports.ISOAdobeCharset = ISOAdobeCharset;
  25544. const ExpertCharset = [".notdef", "space", "exclamsmall", "Hungarumlautsmall", "dollaroldstyle", "dollarsuperior", "ampersandsmall", "Acutesmall", "parenleftsuperior", "parenrightsuperior", "twodotenleader", "onedotenleader", "comma", "hyphen", "period", "fraction", "zerooldstyle", "oneoldstyle", "twooldstyle", "threeoldstyle", "fouroldstyle", "fiveoldstyle", "sixoldstyle", "sevenoldstyle", "eightoldstyle", "nineoldstyle", "colon", "semicolon", "commasuperior", "threequartersemdash", "periodsuperior", "questionsmall", "asuperior", "bsuperior", "centsuperior", "dsuperior", "esuperior", "isuperior", "lsuperior", "msuperior", "nsuperior", "osuperior", "rsuperior", "ssuperior", "tsuperior", "ff", "fi", "fl", "ffi", "ffl", "parenleftinferior", "parenrightinferior", "Circumflexsmall", "hyphensuperior", "Gravesmall", "Asmall", "Bsmall", "Csmall", "Dsmall", "Esmall", "Fsmall", "Gsmall", "Hsmall", "Ismall", "Jsmall", "Ksmall", "Lsmall", "Msmall", "Nsmall", "Osmall", "Psmall", "Qsmall", "Rsmall", "Ssmall", "Tsmall", "Usmall", "Vsmall", "Wsmall", "Xsmall", "Ysmall", "Zsmall", "colonmonetary", "onefitted", "rupiah", "Tildesmall", "exclamdownsmall", "centoldstyle", "Lslashsmall", "Scaronsmall", "Zcaronsmall", "Dieresissmall", "Brevesmall", "Caronsmall", "Dotaccentsmall", "Macronsmall", "figuredash", "hypheninferior", "Ogoneksmall", "Ringsmall", "Cedillasmall", "onequarter", "onehalf", "threequarters", "questiondownsmall", "oneeighth", "threeeighths", "fiveeighths", "seveneighths", "onethird", "twothirds", "zerosuperior", "onesuperior", "twosuperior", "threesuperior", "foursuperior", "fivesuperior", "sixsuperior", "sevensuperior", "eightsuperior", "ninesuperior", "zeroinferior", "oneinferior", "twoinferior", "threeinferior", "fourinferior", "fiveinferior", "sixinferior", "seveninferior", "eightinferior", "nineinferior", "centinferior", "dollarinferior", "periodinferior", "commainferior", "Agravesmall", "Aacutesmall", "Acircumflexsmall", "Atildesmall", "Adieresissmall", "Aringsmall", "AEsmall", "Ccedillasmall", "Egravesmall", "Eacutesmall", "Ecircumflexsmall", "Edieresissmall", "Igravesmall", "Iacutesmall", "Icircumflexsmall", "Idieresissmall", "Ethsmall", "Ntildesmall", "Ogravesmall", "Oacutesmall", "Ocircumflexsmall", "Otildesmall", "Odieresissmall", "OEsmall", "Oslashsmall", "Ugravesmall", "Uacutesmall", "Ucircumflexsmall", "Udieresissmall", "Yacutesmall", "Thornsmall", "Ydieresissmall"];
  25545. exports.ExpertCharset = ExpertCharset;
  25546. const ExpertSubsetCharset = [".notdef", "space", "dollaroldstyle", "dollarsuperior", "parenleftsuperior", "parenrightsuperior", "twodotenleader", "onedotenleader", "comma", "hyphen", "period", "fraction", "zerooldstyle", "oneoldstyle", "twooldstyle", "threeoldstyle", "fouroldstyle", "fiveoldstyle", "sixoldstyle", "sevenoldstyle", "eightoldstyle", "nineoldstyle", "colon", "semicolon", "commasuperior", "threequartersemdash", "periodsuperior", "asuperior", "bsuperior", "centsuperior", "dsuperior", "esuperior", "isuperior", "lsuperior", "msuperior", "nsuperior", "osuperior", "rsuperior", "ssuperior", "tsuperior", "ff", "fi", "fl", "ffi", "ffl", "parenleftinferior", "parenrightinferior", "hyphensuperior", "colonmonetary", "onefitted", "rupiah", "centoldstyle", "figuredash", "hypheninferior", "onequarter", "onehalf", "threequarters", "oneeighth", "threeeighths", "fiveeighths", "seveneighths", "onethird", "twothirds", "zerosuperior", "onesuperior", "twosuperior", "threesuperior", "foursuperior", "fivesuperior", "sixsuperior", "sevensuperior", "eightsuperior", "ninesuperior", "zeroinferior", "oneinferior", "twoinferior", "threeinferior", "fourinferior", "fiveinferior", "sixinferior", "seveninferior", "eightinferior", "nineinferior", "centinferior", "dollarinferior", "periodinferior", "commainferior"];
  25547. exports.ExpertSubsetCharset = ExpertSubsetCharset;
  25548. /***/ }),
  25549. /* 32 */
  25550. /***/ ((__unused_webpack_module, exports) => {
  25551. Object.defineProperty(exports, "__esModule", ({
  25552. value: true
  25553. }));
  25554. exports.getEncoding = getEncoding;
  25555. exports.ZapfDingbatsEncoding = exports.WinAnsiEncoding = exports.SymbolSetEncoding = exports.StandardEncoding = exports.MacRomanEncoding = exports.ExpertEncoding = void 0;
  25556. const ExpertEncoding = ["", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "space", "exclamsmall", "Hungarumlautsmall", "", "dollaroldstyle", "dollarsuperior", "ampersandsmall", "Acutesmall", "parenleftsuperior", "parenrightsuperior", "twodotenleader", "onedotenleader", "comma", "hyphen", "period", "fraction", "zerooldstyle", "oneoldstyle", "twooldstyle", "threeoldstyle", "fouroldstyle", "fiveoldstyle", "sixoldstyle", "sevenoldstyle", "eightoldstyle", "nineoldstyle", "colon", "semicolon", "commasuperior", "threequartersemdash", "periodsuperior", "questionsmall", "", "asuperior", "bsuperior", "centsuperior", "dsuperior", "esuperior", "", "", "", "isuperior", "", "", "lsuperior", "msuperior", "nsuperior", "osuperior", "", "", "rsuperior", "ssuperior", "tsuperior", "", "ff", "fi", "fl", "ffi", "ffl", "parenleftinferior", "", "parenrightinferior", "Circumflexsmall", "hyphensuperior", "Gravesmall", "Asmall", "Bsmall", "Csmall", "Dsmall", "Esmall", "Fsmall", "Gsmall", "Hsmall", "Ismall", "Jsmall", "Ksmall", "Lsmall", "Msmall", "Nsmall", "Osmall", "Psmall", "Qsmall", "Rsmall", "Ssmall", "Tsmall", "Usmall", "Vsmall", "Wsmall", "Xsmall", "Ysmall", "Zsmall", "colonmonetary", "onefitted", "rupiah", "Tildesmall", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "exclamdownsmall", "centoldstyle", "Lslashsmall", "", "", "Scaronsmall", "Zcaronsmall", "Dieresissmall", "Brevesmall", "Caronsmall", "", "Dotaccentsmall", "", "", "Macronsmall", "", "", "figuredash", "hypheninferior", "", "", "Ogoneksmall", "Ringsmall", "Cedillasmall", "", "", "", "onequarter", "onehalf", "threequarters", "questiondownsmall", "oneeighth", "threeeighths", "fiveeighths", "seveneighths", "onethird", "twothirds", "", "", "zerosuperior", "onesuperior", "twosuperior", "threesuperior", "foursuperior", "fivesuperior", "sixsuperior", "sevensuperior", "eightsuperior", "ninesuperior", "zeroinferior", "oneinferior", "twoinferior", "threeinferior", "fourinferior", "fiveinferior", "sixinferior", "seveninferior", "eightinferior", "nineinferior", "centinferior", "dollarinferior", "periodinferior", "commainferior", "Agravesmall", "Aacutesmall", "Acircumflexsmall", "Atildesmall", "Adieresissmall", "Aringsmall", "AEsmall", "Ccedillasmall", "Egravesmall", "Eacutesmall", "Ecircumflexsmall", "Edieresissmall", "Igravesmall", "Iacutesmall", "Icircumflexsmall", "Idieresissmall", "Ethsmall", "Ntildesmall", "Ogravesmall", "Oacutesmall", "Ocircumflexsmall", "Otildesmall", "Odieresissmall", "OEsmall", "Oslashsmall", "Ugravesmall", "Uacutesmall", "Ucircumflexsmall", "Udieresissmall", "Yacutesmall", "Thornsmall", "Ydieresissmall"];
  25557. exports.ExpertEncoding = ExpertEncoding;
  25558. const MacExpertEncoding = ["", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "space", "exclamsmall", "Hungarumlautsmall", "centoldstyle", "dollaroldstyle", "dollarsuperior", "ampersandsmall", "Acutesmall", "parenleftsuperior", "parenrightsuperior", "twodotenleader", "onedotenleader", "comma", "hyphen", "period", "fraction", "zerooldstyle", "oneoldstyle", "twooldstyle", "threeoldstyle", "fouroldstyle", "fiveoldstyle", "sixoldstyle", "sevenoldstyle", "eightoldstyle", "nineoldstyle", "colon", "semicolon", "", "threequartersemdash", "", "questionsmall", "", "", "", "", "Ethsmall", "", "", "onequarter", "onehalf", "threequarters", "oneeighth", "threeeighths", "fiveeighths", "seveneighths", "onethird", "twothirds", "", "", "", "", "", "", "ff", "fi", "fl", "ffi", "ffl", "parenleftinferior", "", "parenrightinferior", "Circumflexsmall", "hypheninferior", "Gravesmall", "Asmall", "Bsmall", "Csmall", "Dsmall", "Esmall", "Fsmall", "Gsmall", "Hsmall", "Ismall", "Jsmall", "Ksmall", "Lsmall", "Msmall", "Nsmall", "Osmall", "Psmall", "Qsmall", "Rsmall", "Ssmall", "Tsmall", "Usmall", "Vsmall", "Wsmall", "Xsmall", "Ysmall", "Zsmall", "colonmonetary", "onefitted", "rupiah", "Tildesmall", "", "", "asuperior", "centsuperior", "", "", "", "", "Aacutesmall", "Agravesmall", "Acircumflexsmall", "Adieresissmall", "Atildesmall", "Aringsmall", "Ccedillasmall", "Eacutesmall", "Egravesmall", "Ecircumflexsmall", "Edieresissmall", "Iacutesmall", "Igravesmall", "Icircumflexsmall", "Idieresissmall", "Ntildesmall", "Oacutesmall", "Ogravesmall", "Ocircumflexsmall", "Odieresissmall", "Otildesmall", "Uacutesmall", "Ugravesmall", "Ucircumflexsmall", "Udieresissmall", "", "eightsuperior", "fourinferior", "threeinferior", "sixinferior", "eightinferior", "seveninferior", "Scaronsmall", "", "centinferior", "twoinferior", "", "Dieresissmall", "", "Caronsmall", "osuperior", "fiveinferior", "", "commainferior", "periodinferior", "Yacutesmall", "", "dollarinferior", "", "", "Thornsmall", "", "nineinferior", "zeroinferior", "Zcaronsmall", "AEsmall", "Oslashsmall", "questiondownsmall", "oneinferior", "Lslashsmall", "", "", "", "", "", "", "Cedillasmall", "", "", "", "", "", "OEsmall", "figuredash", "hyphensuperior", "", "", "", "", "exclamdownsmall", "", "Ydieresissmall", "", "onesuperior", "twosuperior", "threesuperior", "foursuperior", "fivesuperior", "sixsuperior", "sevensuperior", "ninesuperior", "zerosuperior", "", "esuperior", "rsuperior", "tsuperior", "", "", "isuperior", "ssuperior", "dsuperior", "", "", "", "", "", "lsuperior", "Ogoneksmall", "Brevesmall", "Macronsmall", "bsuperior", "nsuperior", "msuperior", "commasuperior", "periodsuperior", "Dotaccentsmall", "Ringsmall", "", "", "", ""];
  25559. const MacRomanEncoding = ["", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "space", "exclam", "quotedbl", "numbersign", "dollar", "percent", "ampersand", "quotesingle", "parenleft", "parenright", "asterisk", "plus", "comma", "hyphen", "period", "slash", "zero", "one", "two", "three", "four", "five", "six", "seven", "eight", "nine", "colon", "semicolon", "less", "equal", "greater", "question", "at", "A", "B", "C", "D", "E", "F", "G", "H", "I", "J", "K", "L", "M", "N", "O", "P", "Q", "R", "S", "T", "U", "V", "W", "X", "Y", "Z", "bracketleft", "backslash", "bracketright", "asciicircum", "underscore", "grave", "a", "b", "c", "d", "e", "f", "g", "h", "i", "j", "k", "l", "m", "n", "o", "p", "q", "r", "s", "t", "u", "v", "w", "x", "y", "z", "braceleft", "bar", "braceright", "asciitilde", "", "Adieresis", "Aring", "Ccedilla", "Eacute", "Ntilde", "Odieresis", "Udieresis", "aacute", "agrave", "acircumflex", "adieresis", "atilde", "aring", "ccedilla", "eacute", "egrave", "ecircumflex", "edieresis", "iacute", "igrave", "icircumflex", "idieresis", "ntilde", "oacute", "ograve", "ocircumflex", "odieresis", "otilde", "uacute", "ugrave", "ucircumflex", "udieresis", "dagger", "degree", "cent", "sterling", "section", "bullet", "paragraph", "germandbls", "registered", "copyright", "trademark", "acute", "dieresis", "notequal", "AE", "Oslash", "infinity", "plusminus", "lessequal", "greaterequal", "yen", "mu", "partialdiff", "summation", "product", "pi", "integral", "ordfeminine", "ordmasculine", "Omega", "ae", "oslash", "questiondown", "exclamdown", "logicalnot", "radical", "florin", "approxequal", "Delta", "guillemotleft", "guillemotright", "ellipsis", "space", "Agrave", "Atilde", "Otilde", "OE", "oe", "endash", "emdash", "quotedblleft", "quotedblright", "quoteleft", "quoteright", "divide", "lozenge", "ydieresis", "Ydieresis", "fraction", "currency", "guilsinglleft", "guilsinglright", "fi", "fl", "daggerdbl", "periodcentered", "quotesinglbase", "quotedblbase", "perthousand", "Acircumflex", "Ecircumflex", "Aacute", "Edieresis", "Egrave", "Iacute", "Icircumflex", "Idieresis", "Igrave", "Oacute", "Ocircumflex", "apple", "Ograve", "Uacute", "Ucircumflex", "Ugrave", "dotlessi", "circumflex", "tilde", "macron", "breve", "dotaccent", "ring", "cedilla", "hungarumlaut", "ogonek", "caron"];
  25560. exports.MacRomanEncoding = MacRomanEncoding;
  25561. const StandardEncoding = ["", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "space", "exclam", "quotedbl", "numbersign", "dollar", "percent", "ampersand", "quoteright", "parenleft", "parenright", "asterisk", "plus", "comma", "hyphen", "period", "slash", "zero", "one", "two", "three", "four", "five", "six", "seven", "eight", "nine", "colon", "semicolon", "less", "equal", "greater", "question", "at", "A", "B", "C", "D", "E", "F", "G", "H", "I", "J", "K", "L", "M", "N", "O", "P", "Q", "R", "S", "T", "U", "V", "W", "X", "Y", "Z", "bracketleft", "backslash", "bracketright", "asciicircum", "underscore", "quoteleft", "a", "b", "c", "d", "e", "f", "g", "h", "i", "j", "k", "l", "m", "n", "o", "p", "q", "r", "s", "t", "u", "v", "w", "x", "y", "z", "braceleft", "bar", "braceright", "asciitilde", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "exclamdown", "cent", "sterling", "fraction", "yen", "florin", "section", "currency", "quotesingle", "quotedblleft", "guillemotleft", "guilsinglleft", "guilsinglright", "fi", "fl", "", "endash", "dagger", "daggerdbl", "periodcentered", "", "paragraph", "bullet", "quotesinglbase", "quotedblbase", "quotedblright", "guillemotright", "ellipsis", "perthousand", "", "questiondown", "", "grave", "acute", "circumflex", "tilde", "macron", "breve", "dotaccent", "dieresis", "", "ring", "cedilla", "", "hungarumlaut", "ogonek", "caron", "emdash", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "AE", "", "ordfeminine", "", "", "", "", "Lslash", "Oslash", "OE", "ordmasculine", "", "", "", "", "", "ae", "", "", "", "dotlessi", "", "", "lslash", "oslash", "oe", "germandbls", "", "", "", ""];
  25562. exports.StandardEncoding = StandardEncoding;
  25563. const WinAnsiEncoding = ["", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "space", "exclam", "quotedbl", "numbersign", "dollar", "percent", "ampersand", "quotesingle", "parenleft", "parenright", "asterisk", "plus", "comma", "hyphen", "period", "slash", "zero", "one", "two", "three", "four", "five", "six", "seven", "eight", "nine", "colon", "semicolon", "less", "equal", "greater", "question", "at", "A", "B", "C", "D", "E", "F", "G", "H", "I", "J", "K", "L", "M", "N", "O", "P", "Q", "R", "S", "T", "U", "V", "W", "X", "Y", "Z", "bracketleft", "backslash", "bracketright", "asciicircum", "underscore", "grave", "a", "b", "c", "d", "e", "f", "g", "h", "i", "j", "k", "l", "m", "n", "o", "p", "q", "r", "s", "t", "u", "v", "w", "x", "y", "z", "braceleft", "bar", "braceright", "asciitilde", "bullet", "Euro", "bullet", "quotesinglbase", "florin", "quotedblbase", "ellipsis", "dagger", "daggerdbl", "circumflex", "perthousand", "Scaron", "guilsinglleft", "OE", "bullet", "Zcaron", "bullet", "bullet", "quoteleft", "quoteright", "quotedblleft", "quotedblright", "bullet", "endash", "emdash", "tilde", "trademark", "scaron", "guilsinglright", "oe", "bullet", "zcaron", "Ydieresis", "space", "exclamdown", "cent", "sterling", "currency", "yen", "brokenbar", "section", "dieresis", "copyright", "ordfeminine", "guillemotleft", "logicalnot", "hyphen", "registered", "macron", "degree", "plusminus", "twosuperior", "threesuperior", "acute", "mu", "paragraph", "periodcentered", "cedilla", "onesuperior", "ordmasculine", "guillemotright", "onequarter", "onehalf", "threequarters", "questiondown", "Agrave", "Aacute", "Acircumflex", "Atilde", "Adieresis", "Aring", "AE", "Ccedilla", "Egrave", "Eacute", "Ecircumflex", "Edieresis", "Igrave", "Iacute", "Icircumflex", "Idieresis", "Eth", "Ntilde", "Ograve", "Oacute", "Ocircumflex", "Otilde", "Odieresis", "multiply", "Oslash", "Ugrave", "Uacute", "Ucircumflex", "Udieresis", "Yacute", "Thorn", "germandbls", "agrave", "aacute", "acircumflex", "atilde", "adieresis", "aring", "ae", "ccedilla", "egrave", "eacute", "ecircumflex", "edieresis", "igrave", "iacute", "icircumflex", "idieresis", "eth", "ntilde", "ograve", "oacute", "ocircumflex", "otilde", "odieresis", "divide", "oslash", "ugrave", "uacute", "ucircumflex", "udieresis", "yacute", "thorn", "ydieresis"];
  25564. exports.WinAnsiEncoding = WinAnsiEncoding;
  25565. const SymbolSetEncoding = ["", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "space", "exclam", "universal", "numbersign", "existential", "percent", "ampersand", "suchthat", "parenleft", "parenright", "asteriskmath", "plus", "comma", "minus", "period", "slash", "zero", "one", "two", "three", "four", "five", "six", "seven", "eight", "nine", "colon", "semicolon", "less", "equal", "greater", "question", "congruent", "Alpha", "Beta", "Chi", "Delta", "Epsilon", "Phi", "Gamma", "Eta", "Iota", "theta1", "Kappa", "Lambda", "Mu", "Nu", "Omicron", "Pi", "Theta", "Rho", "Sigma", "Tau", "Upsilon", "sigma1", "Omega", "Xi", "Psi", "Zeta", "bracketleft", "therefore", "bracketright", "perpendicular", "underscore", "radicalex", "alpha", "beta", "chi", "delta", "epsilon", "phi", "gamma", "eta", "iota", "phi1", "kappa", "lambda", "mu", "nu", "omicron", "pi", "theta", "rho", "sigma", "tau", "upsilon", "omega1", "omega", "xi", "psi", "zeta", "braceleft", "bar", "braceright", "similar", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "Euro", "Upsilon1", "minute", "lessequal", "fraction", "infinity", "florin", "club", "diamond", "heart", "spade", "arrowboth", "arrowleft", "arrowup", "arrowright", "arrowdown", "degree", "plusminus", "second", "greaterequal", "multiply", "proportional", "partialdiff", "bullet", "divide", "notequal", "equivalence", "approxequal", "ellipsis", "arrowvertex", "arrowhorizex", "carriagereturn", "aleph", "Ifraktur", "Rfraktur", "weierstrass", "circlemultiply", "circleplus", "emptyset", "intersection", "union", "propersuperset", "reflexsuperset", "notsubset", "propersubset", "reflexsubset", "element", "notelement", "angle", "gradient", "registerserif", "copyrightserif", "trademarkserif", "product", "radical", "dotmath", "logicalnot", "logicaland", "logicalor", "arrowdblboth", "arrowdblleft", "arrowdblup", "arrowdblright", "arrowdbldown", "lozenge", "angleleft", "registersans", "copyrightsans", "trademarksans", "summation", "parenlefttp", "parenleftex", "parenleftbt", "bracketlefttp", "bracketleftex", "bracketleftbt", "bracelefttp", "braceleftmid", "braceleftbt", "braceex", "", "angleright", "integral", "integraltp", "integralex", "integralbt", "parenrighttp", "parenrightex", "parenrightbt", "bracketrighttp", "bracketrightex", "bracketrightbt", "bracerighttp", "bracerightmid", "bracerightbt", ""];
  25566. exports.SymbolSetEncoding = SymbolSetEncoding;
  25567. const ZapfDingbatsEncoding = ["", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "space", "a1", "a2", "a202", "a3", "a4", "a5", "a119", "a118", "a117", "a11", "a12", "a13", "a14", "a15", "a16", "a105", "a17", "a18", "a19", "a20", "a21", "a22", "a23", "a24", "a25", "a26", "a27", "a28", "a6", "a7", "a8", "a9", "a10", "a29", "a30", "a31", "a32", "a33", "a34", "a35", "a36", "a37", "a38", "a39", "a40", "a41", "a42", "a43", "a44", "a45", "a46", "a47", "a48", "a49", "a50", "a51", "a52", "a53", "a54", "a55", "a56", "a57", "a58", "a59", "a60", "a61", "a62", "a63", "a64", "a65", "a66", "a67", "a68", "a69", "a70", "a71", "a72", "a73", "a74", "a203", "a75", "a204", "a76", "a77", "a78", "a79", "a81", "a82", "a83", "a84", "a97", "a98", "a99", "a100", "", "a89", "a90", "a93", "a94", "a91", "a92", "a205", "a85", "a206", "a86", "a87", "a88", "a95", "a96", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "a101", "a102", "a103", "a104", "a106", "a107", "a108", "a112", "a111", "a110", "a109", "a120", "a121", "a122", "a123", "a124", "a125", "a126", "a127", "a128", "a129", "a130", "a131", "a132", "a133", "a134", "a135", "a136", "a137", "a138", "a139", "a140", "a141", "a142", "a143", "a144", "a145", "a146", "a147", "a148", "a149", "a150", "a151", "a152", "a153", "a154", "a155", "a156", "a157", "a158", "a159", "a160", "a161", "a163", "a164", "a196", "a165", "a192", "a166", "a167", "a168", "a169", "a170", "a171", "a172", "a173", "a162", "a174", "a175", "a176", "a177", "a178", "a179", "a193", "a180", "a199", "a181", "a200", "a182", "", "a201", "a183", "a184", "a197", "a185", "a194", "a198", "a186", "a195", "a187", "a188", "a189", "a190", "a191", ""];
  25568. exports.ZapfDingbatsEncoding = ZapfDingbatsEncoding;
  25569. function getEncoding(encodingName) {
  25570. switch (encodingName) {
  25571. case "WinAnsiEncoding":
  25572. return WinAnsiEncoding;
  25573. case "StandardEncoding":
  25574. return StandardEncoding;
  25575. case "MacRomanEncoding":
  25576. return MacRomanEncoding;
  25577. case "SymbolSetEncoding":
  25578. return SymbolSetEncoding;
  25579. case "ZapfDingbatsEncoding":
  25580. return ZapfDingbatsEncoding;
  25581. case "ExpertEncoding":
  25582. return ExpertEncoding;
  25583. case "MacExpertEncoding":
  25584. return MacExpertEncoding;
  25585. default:
  25586. return null;
  25587. }
  25588. }
  25589. /***/ }),
  25590. /* 33 */
  25591. /***/ ((__unused_webpack_module, __webpack_exports__, __w_pdfjs_require__) => {
  25592. __w_pdfjs_require__.r(__webpack_exports__);
  25593. /* harmony export */ __w_pdfjs_require__.d(__webpack_exports__, {
  25594. /* harmony export */ "getDingbatsGlyphsUnicode": () => /* binding */ getDingbatsGlyphsUnicode,
  25595. /* harmony export */ "getGlyphsUnicode": () => /* binding */ getGlyphsUnicode
  25596. /* harmony export */ });
  25597. /* harmony import */ var _core_utils_js__WEBPACK_IMPORTED_MODULE_0__ = __w_pdfjs_require__(8);
  25598. var getGlyphsUnicode = (0,_core_utils_js__WEBPACK_IMPORTED_MODULE_0__.getArrayLookupTableFactory)(function () {
  25599. return [
  25600. "A",
  25601. 0x0041,
  25602. "AE",
  25603. 0x00c6,
  25604. "AEacute",
  25605. 0x01fc,
  25606. "AEmacron",
  25607. 0x01e2,
  25608. "AEsmall",
  25609. 0xf7e6,
  25610. "Aacute",
  25611. 0x00c1,
  25612. "Aacutesmall",
  25613. 0xf7e1,
  25614. "Abreve",
  25615. 0x0102,
  25616. "Abreveacute",
  25617. 0x1eae,
  25618. "Abrevecyrillic",
  25619. 0x04d0,
  25620. "Abrevedotbelow",
  25621. 0x1eb6,
  25622. "Abrevegrave",
  25623. 0x1eb0,
  25624. "Abrevehookabove",
  25625. 0x1eb2,
  25626. "Abrevetilde",
  25627. 0x1eb4,
  25628. "Acaron",
  25629. 0x01cd,
  25630. "Acircle",
  25631. 0x24b6,
  25632. "Acircumflex",
  25633. 0x00c2,
  25634. "Acircumflexacute",
  25635. 0x1ea4,
  25636. "Acircumflexdotbelow",
  25637. 0x1eac,
  25638. "Acircumflexgrave",
  25639. 0x1ea6,
  25640. "Acircumflexhookabove",
  25641. 0x1ea8,
  25642. "Acircumflexsmall",
  25643. 0xf7e2,
  25644. "Acircumflextilde",
  25645. 0x1eaa,
  25646. "Acute",
  25647. 0xf6c9,
  25648. "Acutesmall",
  25649. 0xf7b4,
  25650. "Acyrillic",
  25651. 0x0410,
  25652. "Adblgrave",
  25653. 0x0200,
  25654. "Adieresis",
  25655. 0x00c4,
  25656. "Adieresiscyrillic",
  25657. 0x04d2,
  25658. "Adieresismacron",
  25659. 0x01de,
  25660. "Adieresissmall",
  25661. 0xf7e4,
  25662. "Adotbelow",
  25663. 0x1ea0,
  25664. "Adotmacron",
  25665. 0x01e0,
  25666. "Agrave",
  25667. 0x00c0,
  25668. "Agravesmall",
  25669. 0xf7e0,
  25670. "Ahookabove",
  25671. 0x1ea2,
  25672. "Aiecyrillic",
  25673. 0x04d4,
  25674. "Ainvertedbreve",
  25675. 0x0202,
  25676. "Alpha",
  25677. 0x0391,
  25678. "Alphatonos",
  25679. 0x0386,
  25680. "Amacron",
  25681. 0x0100,
  25682. "Amonospace",
  25683. 0xff21,
  25684. "Aogonek",
  25685. 0x0104,
  25686. "Aring",
  25687. 0x00c5,
  25688. "Aringacute",
  25689. 0x01fa,
  25690. "Aringbelow",
  25691. 0x1e00,
  25692. "Aringsmall",
  25693. 0xf7e5,
  25694. "Asmall",
  25695. 0xf761,
  25696. "Atilde",
  25697. 0x00c3,
  25698. "Atildesmall",
  25699. 0xf7e3,
  25700. "Aybarmenian",
  25701. 0x0531,
  25702. "B",
  25703. 0x0042,
  25704. "Bcircle",
  25705. 0x24b7,
  25706. "Bdotaccent",
  25707. 0x1e02,
  25708. "Bdotbelow",
  25709. 0x1e04,
  25710. "Becyrillic",
  25711. 0x0411,
  25712. "Benarmenian",
  25713. 0x0532,
  25714. "Beta",
  25715. 0x0392,
  25716. "Bhook",
  25717. 0x0181,
  25718. "Blinebelow",
  25719. 0x1e06,
  25720. "Bmonospace",
  25721. 0xff22,
  25722. "Brevesmall",
  25723. 0xf6f4,
  25724. "Bsmall",
  25725. 0xf762,
  25726. "Btopbar",
  25727. 0x0182,
  25728. "C",
  25729. 0x0043,
  25730. "Caarmenian",
  25731. 0x053e,
  25732. "Cacute",
  25733. 0x0106,
  25734. "Caron",
  25735. 0xf6ca,
  25736. "Caronsmall",
  25737. 0xf6f5,
  25738. "Ccaron",
  25739. 0x010c,
  25740. "Ccedilla",
  25741. 0x00c7,
  25742. "Ccedillaacute",
  25743. 0x1e08,
  25744. "Ccedillasmall",
  25745. 0xf7e7,
  25746. "Ccircle",
  25747. 0x24b8,
  25748. "Ccircumflex",
  25749. 0x0108,
  25750. "Cdot",
  25751. 0x010a,
  25752. "Cdotaccent",
  25753. 0x010a,
  25754. "Cedillasmall",
  25755. 0xf7b8,
  25756. "Chaarmenian",
  25757. 0x0549,
  25758. "Cheabkhasiancyrillic",
  25759. 0x04bc,
  25760. "Checyrillic",
  25761. 0x0427,
  25762. "Chedescenderabkhasiancyrillic",
  25763. 0x04be,
  25764. "Chedescendercyrillic",
  25765. 0x04b6,
  25766. "Chedieresiscyrillic",
  25767. 0x04f4,
  25768. "Cheharmenian",
  25769. 0x0543,
  25770. "Chekhakassiancyrillic",
  25771. 0x04cb,
  25772. "Cheverticalstrokecyrillic",
  25773. 0x04b8,
  25774. "Chi",
  25775. 0x03a7,
  25776. "Chook",
  25777. 0x0187,
  25778. "Circumflexsmall",
  25779. 0xf6f6,
  25780. "Cmonospace",
  25781. 0xff23,
  25782. "Coarmenian",
  25783. 0x0551,
  25784. "Csmall",
  25785. 0xf763,
  25786. "D",
  25787. 0x0044,
  25788. "DZ",
  25789. 0x01f1,
  25790. "DZcaron",
  25791. 0x01c4,
  25792. "Daarmenian",
  25793. 0x0534,
  25794. "Dafrican",
  25795. 0x0189,
  25796. "Dcaron",
  25797. 0x010e,
  25798. "Dcedilla",
  25799. 0x1e10,
  25800. "Dcircle",
  25801. 0x24b9,
  25802. "Dcircumflexbelow",
  25803. 0x1e12,
  25804. "Dcroat",
  25805. 0x0110,
  25806. "Ddotaccent",
  25807. 0x1e0a,
  25808. "Ddotbelow",
  25809. 0x1e0c,
  25810. "Decyrillic",
  25811. 0x0414,
  25812. "Deicoptic",
  25813. 0x03ee,
  25814. "Delta",
  25815. 0x2206,
  25816. "Deltagreek",
  25817. 0x0394,
  25818. "Dhook",
  25819. 0x018a,
  25820. "Dieresis",
  25821. 0xf6cb,
  25822. "DieresisAcute",
  25823. 0xf6cc,
  25824. "DieresisGrave",
  25825. 0xf6cd,
  25826. "Dieresissmall",
  25827. 0xf7a8,
  25828. "Digammagreek",
  25829. 0x03dc,
  25830. "Djecyrillic",
  25831. 0x0402,
  25832. "Dlinebelow",
  25833. 0x1e0e,
  25834. "Dmonospace",
  25835. 0xff24,
  25836. "Dotaccentsmall",
  25837. 0xf6f7,
  25838. "Dslash",
  25839. 0x0110,
  25840. "Dsmall",
  25841. 0xf764,
  25842. "Dtopbar",
  25843. 0x018b,
  25844. "Dz",
  25845. 0x01f2,
  25846. "Dzcaron",
  25847. 0x01c5,
  25848. "Dzeabkhasiancyrillic",
  25849. 0x04e0,
  25850. "Dzecyrillic",
  25851. 0x0405,
  25852. "Dzhecyrillic",
  25853. 0x040f,
  25854. "E",
  25855. 0x0045,
  25856. "Eacute",
  25857. 0x00c9,
  25858. "Eacutesmall",
  25859. 0xf7e9,
  25860. "Ebreve",
  25861. 0x0114,
  25862. "Ecaron",
  25863. 0x011a,
  25864. "Ecedillabreve",
  25865. 0x1e1c,
  25866. "Echarmenian",
  25867. 0x0535,
  25868. "Ecircle",
  25869. 0x24ba,
  25870. "Ecircumflex",
  25871. 0x00ca,
  25872. "Ecircumflexacute",
  25873. 0x1ebe,
  25874. "Ecircumflexbelow",
  25875. 0x1e18,
  25876. "Ecircumflexdotbelow",
  25877. 0x1ec6,
  25878. "Ecircumflexgrave",
  25879. 0x1ec0,
  25880. "Ecircumflexhookabove",
  25881. 0x1ec2,
  25882. "Ecircumflexsmall",
  25883. 0xf7ea,
  25884. "Ecircumflextilde",
  25885. 0x1ec4,
  25886. "Ecyrillic",
  25887. 0x0404,
  25888. "Edblgrave",
  25889. 0x0204,
  25890. "Edieresis",
  25891. 0x00cb,
  25892. "Edieresissmall",
  25893. 0xf7eb,
  25894. "Edot",
  25895. 0x0116,
  25896. "Edotaccent",
  25897. 0x0116,
  25898. "Edotbelow",
  25899. 0x1eb8,
  25900. "Efcyrillic",
  25901. 0x0424,
  25902. "Egrave",
  25903. 0x00c8,
  25904. "Egravesmall",
  25905. 0xf7e8,
  25906. "Eharmenian",
  25907. 0x0537,
  25908. "Ehookabove",
  25909. 0x1eba,
  25910. "Eightroman",
  25911. 0x2167,
  25912. "Einvertedbreve",
  25913. 0x0206,
  25914. "Eiotifiedcyrillic",
  25915. 0x0464,
  25916. "Elcyrillic",
  25917. 0x041b,
  25918. "Elevenroman",
  25919. 0x216a,
  25920. "Emacron",
  25921. 0x0112,
  25922. "Emacronacute",
  25923. 0x1e16,
  25924. "Emacrongrave",
  25925. 0x1e14,
  25926. "Emcyrillic",
  25927. 0x041c,
  25928. "Emonospace",
  25929. 0xff25,
  25930. "Encyrillic",
  25931. 0x041d,
  25932. "Endescendercyrillic",
  25933. 0x04a2,
  25934. "Eng",
  25935. 0x014a,
  25936. "Enghecyrillic",
  25937. 0x04a4,
  25938. "Enhookcyrillic",
  25939. 0x04c7,
  25940. "Eogonek",
  25941. 0x0118,
  25942. "Eopen",
  25943. 0x0190,
  25944. "Epsilon",
  25945. 0x0395,
  25946. "Epsilontonos",
  25947. 0x0388,
  25948. "Ercyrillic",
  25949. 0x0420,
  25950. "Ereversed",
  25951. 0x018e,
  25952. "Ereversedcyrillic",
  25953. 0x042d,
  25954. "Escyrillic",
  25955. 0x0421,
  25956. "Esdescendercyrillic",
  25957. 0x04aa,
  25958. "Esh",
  25959. 0x01a9,
  25960. "Esmall",
  25961. 0xf765,
  25962. "Eta",
  25963. 0x0397,
  25964. "Etarmenian",
  25965. 0x0538,
  25966. "Etatonos",
  25967. 0x0389,
  25968. "Eth",
  25969. 0x00d0,
  25970. "Ethsmall",
  25971. 0xf7f0,
  25972. "Etilde",
  25973. 0x1ebc,
  25974. "Etildebelow",
  25975. 0x1e1a,
  25976. "Euro",
  25977. 0x20ac,
  25978. "Ezh",
  25979. 0x01b7,
  25980. "Ezhcaron",
  25981. 0x01ee,
  25982. "Ezhreversed",
  25983. 0x01b8,
  25984. "F",
  25985. 0x0046,
  25986. "Fcircle",
  25987. 0x24bb,
  25988. "Fdotaccent",
  25989. 0x1e1e,
  25990. "Feharmenian",
  25991. 0x0556,
  25992. "Feicoptic",
  25993. 0x03e4,
  25994. "Fhook",
  25995. 0x0191,
  25996. "Fitacyrillic",
  25997. 0x0472,
  25998. "Fiveroman",
  25999. 0x2164,
  26000. "Fmonospace",
  26001. 0xff26,
  26002. "Fourroman",
  26003. 0x2163,
  26004. "Fsmall",
  26005. 0xf766,
  26006. "G",
  26007. 0x0047,
  26008. "GBsquare",
  26009. 0x3387,
  26010. "Gacute",
  26011. 0x01f4,
  26012. "Gamma",
  26013. 0x0393,
  26014. "Gammaafrican",
  26015. 0x0194,
  26016. "Gangiacoptic",
  26017. 0x03ea,
  26018. "Gbreve",
  26019. 0x011e,
  26020. "Gcaron",
  26021. 0x01e6,
  26022. "Gcedilla",
  26023. 0x0122,
  26024. "Gcircle",
  26025. 0x24bc,
  26026. "Gcircumflex",
  26027. 0x011c,
  26028. "Gcommaaccent",
  26029. 0x0122,
  26030. "Gdot",
  26031. 0x0120,
  26032. "Gdotaccent",
  26033. 0x0120,
  26034. "Gecyrillic",
  26035. 0x0413,
  26036. "Ghadarmenian",
  26037. 0x0542,
  26038. "Ghemiddlehookcyrillic",
  26039. 0x0494,
  26040. "Ghestrokecyrillic",
  26041. 0x0492,
  26042. "Gheupturncyrillic",
  26043. 0x0490,
  26044. "Ghook",
  26045. 0x0193,
  26046. "Gimarmenian",
  26047. 0x0533,
  26048. "Gjecyrillic",
  26049. 0x0403,
  26050. "Gmacron",
  26051. 0x1e20,
  26052. "Gmonospace",
  26053. 0xff27,
  26054. "Grave",
  26055. 0xf6ce,
  26056. "Gravesmall",
  26057. 0xf760,
  26058. "Gsmall",
  26059. 0xf767,
  26060. "Gsmallhook",
  26061. 0x029b,
  26062. "Gstroke",
  26063. 0x01e4,
  26064. "H",
  26065. 0x0048,
  26066. "H18533",
  26067. 0x25cf,
  26068. "H18543",
  26069. 0x25aa,
  26070. "H18551",
  26071. 0x25ab,
  26072. "H22073",
  26073. 0x25a1,
  26074. "HPsquare",
  26075. 0x33cb,
  26076. "Haabkhasiancyrillic",
  26077. 0x04a8,
  26078. "Hadescendercyrillic",
  26079. 0x04b2,
  26080. "Hardsigncyrillic",
  26081. 0x042a,
  26082. "Hbar",
  26083. 0x0126,
  26084. "Hbrevebelow",
  26085. 0x1e2a,
  26086. "Hcedilla",
  26087. 0x1e28,
  26088. "Hcircle",
  26089. 0x24bd,
  26090. "Hcircumflex",
  26091. 0x0124,
  26092. "Hdieresis",
  26093. 0x1e26,
  26094. "Hdotaccent",
  26095. 0x1e22,
  26096. "Hdotbelow",
  26097. 0x1e24,
  26098. "Hmonospace",
  26099. 0xff28,
  26100. "Hoarmenian",
  26101. 0x0540,
  26102. "Horicoptic",
  26103. 0x03e8,
  26104. "Hsmall",
  26105. 0xf768,
  26106. "Hungarumlaut",
  26107. 0xf6cf,
  26108. "Hungarumlautsmall",
  26109. 0xf6f8,
  26110. "Hzsquare",
  26111. 0x3390,
  26112. "I",
  26113. 0x0049,
  26114. "IAcyrillic",
  26115. 0x042f,
  26116. "IJ",
  26117. 0x0132,
  26118. "IUcyrillic",
  26119. 0x042e,
  26120. "Iacute",
  26121. 0x00cd,
  26122. "Iacutesmall",
  26123. 0xf7ed,
  26124. "Ibreve",
  26125. 0x012c,
  26126. "Icaron",
  26127. 0x01cf,
  26128. "Icircle",
  26129. 0x24be,
  26130. "Icircumflex",
  26131. 0x00ce,
  26132. "Icircumflexsmall",
  26133. 0xf7ee,
  26134. "Icyrillic",
  26135. 0x0406,
  26136. "Idblgrave",
  26137. 0x0208,
  26138. "Idieresis",
  26139. 0x00cf,
  26140. "Idieresisacute",
  26141. 0x1e2e,
  26142. "Idieresiscyrillic",
  26143. 0x04e4,
  26144. "Idieresissmall",
  26145. 0xf7ef,
  26146. "Idot",
  26147. 0x0130,
  26148. "Idotaccent",
  26149. 0x0130,
  26150. "Idotbelow",
  26151. 0x1eca,
  26152. "Iebrevecyrillic",
  26153. 0x04d6,
  26154. "Iecyrillic",
  26155. 0x0415,
  26156. "Ifraktur",
  26157. 0x2111,
  26158. "Igrave",
  26159. 0x00cc,
  26160. "Igravesmall",
  26161. 0xf7ec,
  26162. "Ihookabove",
  26163. 0x1ec8,
  26164. "Iicyrillic",
  26165. 0x0418,
  26166. "Iinvertedbreve",
  26167. 0x020a,
  26168. "Iishortcyrillic",
  26169. 0x0419,
  26170. "Imacron",
  26171. 0x012a,
  26172. "Imacroncyrillic",
  26173. 0x04e2,
  26174. "Imonospace",
  26175. 0xff29,
  26176. "Iniarmenian",
  26177. 0x053b,
  26178. "Iocyrillic",
  26179. 0x0401,
  26180. "Iogonek",
  26181. 0x012e,
  26182. "Iota",
  26183. 0x0399,
  26184. "Iotaafrican",
  26185. 0x0196,
  26186. "Iotadieresis",
  26187. 0x03aa,
  26188. "Iotatonos",
  26189. 0x038a,
  26190. "Ismall",
  26191. 0xf769,
  26192. "Istroke",
  26193. 0x0197,
  26194. "Itilde",
  26195. 0x0128,
  26196. "Itildebelow",
  26197. 0x1e2c,
  26198. "Izhitsacyrillic",
  26199. 0x0474,
  26200. "Izhitsadblgravecyrillic",
  26201. 0x0476,
  26202. "J",
  26203. 0x004a,
  26204. "Jaarmenian",
  26205. 0x0541,
  26206. "Jcircle",
  26207. 0x24bf,
  26208. "Jcircumflex",
  26209. 0x0134,
  26210. "Jecyrillic",
  26211. 0x0408,
  26212. "Jheharmenian",
  26213. 0x054b,
  26214. "Jmonospace",
  26215. 0xff2a,
  26216. "Jsmall",
  26217. 0xf76a,
  26218. "K",
  26219. 0x004b,
  26220. "KBsquare",
  26221. 0x3385,
  26222. "KKsquare",
  26223. 0x33cd,
  26224. "Kabashkircyrillic",
  26225. 0x04a0,
  26226. "Kacute",
  26227. 0x1e30,
  26228. "Kacyrillic",
  26229. 0x041a,
  26230. "Kadescendercyrillic",
  26231. 0x049a,
  26232. "Kahookcyrillic",
  26233. 0x04c3,
  26234. "Kappa",
  26235. 0x039a,
  26236. "Kastrokecyrillic",
  26237. 0x049e,
  26238. "Kaverticalstrokecyrillic",
  26239. 0x049c,
  26240. "Kcaron",
  26241. 0x01e8,
  26242. "Kcedilla",
  26243. 0x0136,
  26244. "Kcircle",
  26245. 0x24c0,
  26246. "Kcommaaccent",
  26247. 0x0136,
  26248. "Kdotbelow",
  26249. 0x1e32,
  26250. "Keharmenian",
  26251. 0x0554,
  26252. "Kenarmenian",
  26253. 0x053f,
  26254. "Khacyrillic",
  26255. 0x0425,
  26256. "Kheicoptic",
  26257. 0x03e6,
  26258. "Khook",
  26259. 0x0198,
  26260. "Kjecyrillic",
  26261. 0x040c,
  26262. "Klinebelow",
  26263. 0x1e34,
  26264. "Kmonospace",
  26265. 0xff2b,
  26266. "Koppacyrillic",
  26267. 0x0480,
  26268. "Koppagreek",
  26269. 0x03de,
  26270. "Ksicyrillic",
  26271. 0x046e,
  26272. "Ksmall",
  26273. 0xf76b,
  26274. "L",
  26275. 0x004c,
  26276. "LJ",
  26277. 0x01c7,
  26278. "LL",
  26279. 0xf6bf,
  26280. "Lacute",
  26281. 0x0139,
  26282. "Lambda",
  26283. 0x039b,
  26284. "Lcaron",
  26285. 0x013d,
  26286. "Lcedilla",
  26287. 0x013b,
  26288. "Lcircle",
  26289. 0x24c1,
  26290. "Lcircumflexbelow",
  26291. 0x1e3c,
  26292. "Lcommaaccent",
  26293. 0x013b,
  26294. "Ldot",
  26295. 0x013f,
  26296. "Ldotaccent",
  26297. 0x013f,
  26298. "Ldotbelow",
  26299. 0x1e36,
  26300. "Ldotbelowmacron",
  26301. 0x1e38,
  26302. "Liwnarmenian",
  26303. 0x053c,
  26304. "Lj",
  26305. 0x01c8,
  26306. "Ljecyrillic",
  26307. 0x0409,
  26308. "Llinebelow",
  26309. 0x1e3a,
  26310. "Lmonospace",
  26311. 0xff2c,
  26312. "Lslash",
  26313. 0x0141,
  26314. "Lslashsmall",
  26315. 0xf6f9,
  26316. "Lsmall",
  26317. 0xf76c,
  26318. "M",
  26319. 0x004d,
  26320. "MBsquare",
  26321. 0x3386,
  26322. "Macron",
  26323. 0xf6d0,
  26324. "Macronsmall",
  26325. 0xf7af,
  26326. "Macute",
  26327. 0x1e3e,
  26328. "Mcircle",
  26329. 0x24c2,
  26330. "Mdotaccent",
  26331. 0x1e40,
  26332. "Mdotbelow",
  26333. 0x1e42,
  26334. "Menarmenian",
  26335. 0x0544,
  26336. "Mmonospace",
  26337. 0xff2d,
  26338. "Msmall",
  26339. 0xf76d,
  26340. "Mturned",
  26341. 0x019c,
  26342. "Mu",
  26343. 0x039c,
  26344. "N",
  26345. 0x004e,
  26346. "NJ",
  26347. 0x01ca,
  26348. "Nacute",
  26349. 0x0143,
  26350. "Ncaron",
  26351. 0x0147,
  26352. "Ncedilla",
  26353. 0x0145,
  26354. "Ncircle",
  26355. 0x24c3,
  26356. "Ncircumflexbelow",
  26357. 0x1e4a,
  26358. "Ncommaaccent",
  26359. 0x0145,
  26360. "Ndotaccent",
  26361. 0x1e44,
  26362. "Ndotbelow",
  26363. 0x1e46,
  26364. "Nhookleft",
  26365. 0x019d,
  26366. "Nineroman",
  26367. 0x2168,
  26368. "Nj",
  26369. 0x01cb,
  26370. "Njecyrillic",
  26371. 0x040a,
  26372. "Nlinebelow",
  26373. 0x1e48,
  26374. "Nmonospace",
  26375. 0xff2e,
  26376. "Nowarmenian",
  26377. 0x0546,
  26378. "Nsmall",
  26379. 0xf76e,
  26380. "Ntilde",
  26381. 0x00d1,
  26382. "Ntildesmall",
  26383. 0xf7f1,
  26384. "Nu",
  26385. 0x039d,
  26386. "O",
  26387. 0x004f,
  26388. "OE",
  26389. 0x0152,
  26390. "OEsmall",
  26391. 0xf6fa,
  26392. "Oacute",
  26393. 0x00d3,
  26394. "Oacutesmall",
  26395. 0xf7f3,
  26396. "Obarredcyrillic",
  26397. 0x04e8,
  26398. "Obarreddieresiscyrillic",
  26399. 0x04ea,
  26400. "Obreve",
  26401. 0x014e,
  26402. "Ocaron",
  26403. 0x01d1,
  26404. "Ocenteredtilde",
  26405. 0x019f,
  26406. "Ocircle",
  26407. 0x24c4,
  26408. "Ocircumflex",
  26409. 0x00d4,
  26410. "Ocircumflexacute",
  26411. 0x1ed0,
  26412. "Ocircumflexdotbelow",
  26413. 0x1ed8,
  26414. "Ocircumflexgrave",
  26415. 0x1ed2,
  26416. "Ocircumflexhookabove",
  26417. 0x1ed4,
  26418. "Ocircumflexsmall",
  26419. 0xf7f4,
  26420. "Ocircumflextilde",
  26421. 0x1ed6,
  26422. "Ocyrillic",
  26423. 0x041e,
  26424. "Odblacute",
  26425. 0x0150,
  26426. "Odblgrave",
  26427. 0x020c,
  26428. "Odieresis",
  26429. 0x00d6,
  26430. "Odieresiscyrillic",
  26431. 0x04e6,
  26432. "Odieresissmall",
  26433. 0xf7f6,
  26434. "Odotbelow",
  26435. 0x1ecc,
  26436. "Ogoneksmall",
  26437. 0xf6fb,
  26438. "Ograve",
  26439. 0x00d2,
  26440. "Ogravesmall",
  26441. 0xf7f2,
  26442. "Oharmenian",
  26443. 0x0555,
  26444. "Ohm",
  26445. 0x2126,
  26446. "Ohookabove",
  26447. 0x1ece,
  26448. "Ohorn",
  26449. 0x01a0,
  26450. "Ohornacute",
  26451. 0x1eda,
  26452. "Ohorndotbelow",
  26453. 0x1ee2,
  26454. "Ohorngrave",
  26455. 0x1edc,
  26456. "Ohornhookabove",
  26457. 0x1ede,
  26458. "Ohorntilde",
  26459. 0x1ee0,
  26460. "Ohungarumlaut",
  26461. 0x0150,
  26462. "Oi",
  26463. 0x01a2,
  26464. "Oinvertedbreve",
  26465. 0x020e,
  26466. "Omacron",
  26467. 0x014c,
  26468. "Omacronacute",
  26469. 0x1e52,
  26470. "Omacrongrave",
  26471. 0x1e50,
  26472. "Omega",
  26473. 0x2126,
  26474. "Omegacyrillic",
  26475. 0x0460,
  26476. "Omegagreek",
  26477. 0x03a9,
  26478. "Omegaroundcyrillic",
  26479. 0x047a,
  26480. "Omegatitlocyrillic",
  26481. 0x047c,
  26482. "Omegatonos",
  26483. 0x038f,
  26484. "Omicron",
  26485. 0x039f,
  26486. "Omicrontonos",
  26487. 0x038c,
  26488. "Omonospace",
  26489. 0xff2f,
  26490. "Oneroman",
  26491. 0x2160,
  26492. "Oogonek",
  26493. 0x01ea,
  26494. "Oogonekmacron",
  26495. 0x01ec,
  26496. "Oopen",
  26497. 0x0186,
  26498. "Oslash",
  26499. 0x00d8,
  26500. "Oslashacute",
  26501. 0x01fe,
  26502. "Oslashsmall",
  26503. 0xf7f8,
  26504. "Osmall",
  26505. 0xf76f,
  26506. "Ostrokeacute",
  26507. 0x01fe,
  26508. "Otcyrillic",
  26509. 0x047e,
  26510. "Otilde",
  26511. 0x00d5,
  26512. "Otildeacute",
  26513. 0x1e4c,
  26514. "Otildedieresis",
  26515. 0x1e4e,
  26516. "Otildesmall",
  26517. 0xf7f5,
  26518. "P",
  26519. 0x0050,
  26520. "Pacute",
  26521. 0x1e54,
  26522. "Pcircle",
  26523. 0x24c5,
  26524. "Pdotaccent",
  26525. 0x1e56,
  26526. "Pecyrillic",
  26527. 0x041f,
  26528. "Peharmenian",
  26529. 0x054a,
  26530. "Pemiddlehookcyrillic",
  26531. 0x04a6,
  26532. "Phi",
  26533. 0x03a6,
  26534. "Phook",
  26535. 0x01a4,
  26536. "Pi",
  26537. 0x03a0,
  26538. "Piwrarmenian",
  26539. 0x0553,
  26540. "Pmonospace",
  26541. 0xff30,
  26542. "Psi",
  26543. 0x03a8,
  26544. "Psicyrillic",
  26545. 0x0470,
  26546. "Psmall",
  26547. 0xf770,
  26548. "Q",
  26549. 0x0051,
  26550. "Qcircle",
  26551. 0x24c6,
  26552. "Qmonospace",
  26553. 0xff31,
  26554. "Qsmall",
  26555. 0xf771,
  26556. "R",
  26557. 0x0052,
  26558. "Raarmenian",
  26559. 0x054c,
  26560. "Racute",
  26561. 0x0154,
  26562. "Rcaron",
  26563. 0x0158,
  26564. "Rcedilla",
  26565. 0x0156,
  26566. "Rcircle",
  26567. 0x24c7,
  26568. "Rcommaaccent",
  26569. 0x0156,
  26570. "Rdblgrave",
  26571. 0x0210,
  26572. "Rdotaccent",
  26573. 0x1e58,
  26574. "Rdotbelow",
  26575. 0x1e5a,
  26576. "Rdotbelowmacron",
  26577. 0x1e5c,
  26578. "Reharmenian",
  26579. 0x0550,
  26580. "Rfraktur",
  26581. 0x211c,
  26582. "Rho",
  26583. 0x03a1,
  26584. "Ringsmall",
  26585. 0xf6fc,
  26586. "Rinvertedbreve",
  26587. 0x0212,
  26588. "Rlinebelow",
  26589. 0x1e5e,
  26590. "Rmonospace",
  26591. 0xff32,
  26592. "Rsmall",
  26593. 0xf772,
  26594. "Rsmallinverted",
  26595. 0x0281,
  26596. "Rsmallinvertedsuperior",
  26597. 0x02b6,
  26598. "S",
  26599. 0x0053,
  26600. "SF010000",
  26601. 0x250c,
  26602. "SF020000",
  26603. 0x2514,
  26604. "SF030000",
  26605. 0x2510,
  26606. "SF040000",
  26607. 0x2518,
  26608. "SF050000",
  26609. 0x253c,
  26610. "SF060000",
  26611. 0x252c,
  26612. "SF070000",
  26613. 0x2534,
  26614. "SF080000",
  26615. 0x251c,
  26616. "SF090000",
  26617. 0x2524,
  26618. "SF100000",
  26619. 0x2500,
  26620. "SF110000",
  26621. 0x2502,
  26622. "SF190000",
  26623. 0x2561,
  26624. "SF200000",
  26625. 0x2562,
  26626. "SF210000",
  26627. 0x2556,
  26628. "SF220000",
  26629. 0x2555,
  26630. "SF230000",
  26631. 0x2563,
  26632. "SF240000",
  26633. 0x2551,
  26634. "SF250000",
  26635. 0x2557,
  26636. "SF260000",
  26637. 0x255d,
  26638. "SF270000",
  26639. 0x255c,
  26640. "SF280000",
  26641. 0x255b,
  26642. "SF360000",
  26643. 0x255e,
  26644. "SF370000",
  26645. 0x255f,
  26646. "SF380000",
  26647. 0x255a,
  26648. "SF390000",
  26649. 0x2554,
  26650. "SF400000",
  26651. 0x2569,
  26652. "SF410000",
  26653. 0x2566,
  26654. "SF420000",
  26655. 0x2560,
  26656. "SF430000",
  26657. 0x2550,
  26658. "SF440000",
  26659. 0x256c,
  26660. "SF450000",
  26661. 0x2567,
  26662. "SF460000",
  26663. 0x2568,
  26664. "SF470000",
  26665. 0x2564,
  26666. "SF480000",
  26667. 0x2565,
  26668. "SF490000",
  26669. 0x2559,
  26670. "SF500000",
  26671. 0x2558,
  26672. "SF510000",
  26673. 0x2552,
  26674. "SF520000",
  26675. 0x2553,
  26676. "SF530000",
  26677. 0x256b,
  26678. "SF540000",
  26679. 0x256a,
  26680. "Sacute",
  26681. 0x015a,
  26682. "Sacutedotaccent",
  26683. 0x1e64,
  26684. "Sampigreek",
  26685. 0x03e0,
  26686. "Scaron",
  26687. 0x0160,
  26688. "Scarondotaccent",
  26689. 0x1e66,
  26690. "Scaronsmall",
  26691. 0xf6fd,
  26692. "Scedilla",
  26693. 0x015e,
  26694. "Schwa",
  26695. 0x018f,
  26696. "Schwacyrillic",
  26697. 0x04d8,
  26698. "Schwadieresiscyrillic",
  26699. 0x04da,
  26700. "Scircle",
  26701. 0x24c8,
  26702. "Scircumflex",
  26703. 0x015c,
  26704. "Scommaaccent",
  26705. 0x0218,
  26706. "Sdotaccent",
  26707. 0x1e60,
  26708. "Sdotbelow",
  26709. 0x1e62,
  26710. "Sdotbelowdotaccent",
  26711. 0x1e68,
  26712. "Seharmenian",
  26713. 0x054d,
  26714. "Sevenroman",
  26715. 0x2166,
  26716. "Shaarmenian",
  26717. 0x0547,
  26718. "Shacyrillic",
  26719. 0x0428,
  26720. "Shchacyrillic",
  26721. 0x0429,
  26722. "Sheicoptic",
  26723. 0x03e2,
  26724. "Shhacyrillic",
  26725. 0x04ba,
  26726. "Shimacoptic",
  26727. 0x03ec,
  26728. "Sigma",
  26729. 0x03a3,
  26730. "Sixroman",
  26731. 0x2165,
  26732. "Smonospace",
  26733. 0xff33,
  26734. "Softsigncyrillic",
  26735. 0x042c,
  26736. "Ssmall",
  26737. 0xf773,
  26738. "Stigmagreek",
  26739. 0x03da,
  26740. "T",
  26741. 0x0054,
  26742. "Tau",
  26743. 0x03a4,
  26744. "Tbar",
  26745. 0x0166,
  26746. "Tcaron",
  26747. 0x0164,
  26748. "Tcedilla",
  26749. 0x0162,
  26750. "Tcircle",
  26751. 0x24c9,
  26752. "Tcircumflexbelow",
  26753. 0x1e70,
  26754. "Tcommaaccent",
  26755. 0x0162,
  26756. "Tdotaccent",
  26757. 0x1e6a,
  26758. "Tdotbelow",
  26759. 0x1e6c,
  26760. "Tecyrillic",
  26761. 0x0422,
  26762. "Tedescendercyrillic",
  26763. 0x04ac,
  26764. "Tenroman",
  26765. 0x2169,
  26766. "Tetsecyrillic",
  26767. 0x04b4,
  26768. "Theta",
  26769. 0x0398,
  26770. "Thook",
  26771. 0x01ac,
  26772. "Thorn",
  26773. 0x00de,
  26774. "Thornsmall",
  26775. 0xf7fe,
  26776. "Threeroman",
  26777. 0x2162,
  26778. "Tildesmall",
  26779. 0xf6fe,
  26780. "Tiwnarmenian",
  26781. 0x054f,
  26782. "Tlinebelow",
  26783. 0x1e6e,
  26784. "Tmonospace",
  26785. 0xff34,
  26786. "Toarmenian",
  26787. 0x0539,
  26788. "Tonefive",
  26789. 0x01bc,
  26790. "Tonesix",
  26791. 0x0184,
  26792. "Tonetwo",
  26793. 0x01a7,
  26794. "Tretroflexhook",
  26795. 0x01ae,
  26796. "Tsecyrillic",
  26797. 0x0426,
  26798. "Tshecyrillic",
  26799. 0x040b,
  26800. "Tsmall",
  26801. 0xf774,
  26802. "Twelveroman",
  26803. 0x216b,
  26804. "Tworoman",
  26805. 0x2161,
  26806. "U",
  26807. 0x0055,
  26808. "Uacute",
  26809. 0x00da,
  26810. "Uacutesmall",
  26811. 0xf7fa,
  26812. "Ubreve",
  26813. 0x016c,
  26814. "Ucaron",
  26815. 0x01d3,
  26816. "Ucircle",
  26817. 0x24ca,
  26818. "Ucircumflex",
  26819. 0x00db,
  26820. "Ucircumflexbelow",
  26821. 0x1e76,
  26822. "Ucircumflexsmall",
  26823. 0xf7fb,
  26824. "Ucyrillic",
  26825. 0x0423,
  26826. "Udblacute",
  26827. 0x0170,
  26828. "Udblgrave",
  26829. 0x0214,
  26830. "Udieresis",
  26831. 0x00dc,
  26832. "Udieresisacute",
  26833. 0x01d7,
  26834. "Udieresisbelow",
  26835. 0x1e72,
  26836. "Udieresiscaron",
  26837. 0x01d9,
  26838. "Udieresiscyrillic",
  26839. 0x04f0,
  26840. "Udieresisgrave",
  26841. 0x01db,
  26842. "Udieresismacron",
  26843. 0x01d5,
  26844. "Udieresissmall",
  26845. 0xf7fc,
  26846. "Udotbelow",
  26847. 0x1ee4,
  26848. "Ugrave",
  26849. 0x00d9,
  26850. "Ugravesmall",
  26851. 0xf7f9,
  26852. "Uhookabove",
  26853. 0x1ee6,
  26854. "Uhorn",
  26855. 0x01af,
  26856. "Uhornacute",
  26857. 0x1ee8,
  26858. "Uhorndotbelow",
  26859. 0x1ef0,
  26860. "Uhorngrave",
  26861. 0x1eea,
  26862. "Uhornhookabove",
  26863. 0x1eec,
  26864. "Uhorntilde",
  26865. 0x1eee,
  26866. "Uhungarumlaut",
  26867. 0x0170,
  26868. "Uhungarumlautcyrillic",
  26869. 0x04f2,
  26870. "Uinvertedbreve",
  26871. 0x0216,
  26872. "Ukcyrillic",
  26873. 0x0478,
  26874. "Umacron",
  26875. 0x016a,
  26876. "Umacroncyrillic",
  26877. 0x04ee,
  26878. "Umacrondieresis",
  26879. 0x1e7a,
  26880. "Umonospace",
  26881. 0xff35,
  26882. "Uogonek",
  26883. 0x0172,
  26884. "Upsilon",
  26885. 0x03a5,
  26886. "Upsilon1",
  26887. 0x03d2,
  26888. "Upsilonacutehooksymbolgreek",
  26889. 0x03d3,
  26890. "Upsilonafrican",
  26891. 0x01b1,
  26892. "Upsilondieresis",
  26893. 0x03ab,
  26894. "Upsilondieresishooksymbolgreek",
  26895. 0x03d4,
  26896. "Upsilonhooksymbol",
  26897. 0x03d2,
  26898. "Upsilontonos",
  26899. 0x038e,
  26900. "Uring",
  26901. 0x016e,
  26902. "Ushortcyrillic",
  26903. 0x040e,
  26904. "Usmall",
  26905. 0xf775,
  26906. "Ustraightcyrillic",
  26907. 0x04ae,
  26908. "Ustraightstrokecyrillic",
  26909. 0x04b0,
  26910. "Utilde",
  26911. 0x0168,
  26912. "Utildeacute",
  26913. 0x1e78,
  26914. "Utildebelow",
  26915. 0x1e74,
  26916. "V",
  26917. 0x0056,
  26918. "Vcircle",
  26919. 0x24cb,
  26920. "Vdotbelow",
  26921. 0x1e7e,
  26922. "Vecyrillic",
  26923. 0x0412,
  26924. "Vewarmenian",
  26925. 0x054e,
  26926. "Vhook",
  26927. 0x01b2,
  26928. "Vmonospace",
  26929. 0xff36,
  26930. "Voarmenian",
  26931. 0x0548,
  26932. "Vsmall",
  26933. 0xf776,
  26934. "Vtilde",
  26935. 0x1e7c,
  26936. "W",
  26937. 0x0057,
  26938. "Wacute",
  26939. 0x1e82,
  26940. "Wcircle",
  26941. 0x24cc,
  26942. "Wcircumflex",
  26943. 0x0174,
  26944. "Wdieresis",
  26945. 0x1e84,
  26946. "Wdotaccent",
  26947. 0x1e86,
  26948. "Wdotbelow",
  26949. 0x1e88,
  26950. "Wgrave",
  26951. 0x1e80,
  26952. "Wmonospace",
  26953. 0xff37,
  26954. "Wsmall",
  26955. 0xf777,
  26956. "X",
  26957. 0x0058,
  26958. "Xcircle",
  26959. 0x24cd,
  26960. "Xdieresis",
  26961. 0x1e8c,
  26962. "Xdotaccent",
  26963. 0x1e8a,
  26964. "Xeharmenian",
  26965. 0x053d,
  26966. "Xi",
  26967. 0x039e,
  26968. "Xmonospace",
  26969. 0xff38,
  26970. "Xsmall",
  26971. 0xf778,
  26972. "Y",
  26973. 0x0059,
  26974. "Yacute",
  26975. 0x00dd,
  26976. "Yacutesmall",
  26977. 0xf7fd,
  26978. "Yatcyrillic",
  26979. 0x0462,
  26980. "Ycircle",
  26981. 0x24ce,
  26982. "Ycircumflex",
  26983. 0x0176,
  26984. "Ydieresis",
  26985. 0x0178,
  26986. "Ydieresissmall",
  26987. 0xf7ff,
  26988. "Ydotaccent",
  26989. 0x1e8e,
  26990. "Ydotbelow",
  26991. 0x1ef4,
  26992. "Yericyrillic",
  26993. 0x042b,
  26994. "Yerudieresiscyrillic",
  26995. 0x04f8,
  26996. "Ygrave",
  26997. 0x1ef2,
  26998. "Yhook",
  26999. 0x01b3,
  27000. "Yhookabove",
  27001. 0x1ef6,
  27002. "Yiarmenian",
  27003. 0x0545,
  27004. "Yicyrillic",
  27005. 0x0407,
  27006. "Yiwnarmenian",
  27007. 0x0552,
  27008. "Ymonospace",
  27009. 0xff39,
  27010. "Ysmall",
  27011. 0xf779,
  27012. "Ytilde",
  27013. 0x1ef8,
  27014. "Yusbigcyrillic",
  27015. 0x046a,
  27016. "Yusbigiotifiedcyrillic",
  27017. 0x046c,
  27018. "Yuslittlecyrillic",
  27019. 0x0466,
  27020. "Yuslittleiotifiedcyrillic",
  27021. 0x0468,
  27022. "Z",
  27023. 0x005a,
  27024. "Zaarmenian",
  27025. 0x0536,
  27026. "Zacute",
  27027. 0x0179,
  27028. "Zcaron",
  27029. 0x017d,
  27030. "Zcaronsmall",
  27031. 0xf6ff,
  27032. "Zcircle",
  27033. 0x24cf,
  27034. "Zcircumflex",
  27035. 0x1e90,
  27036. "Zdot",
  27037. 0x017b,
  27038. "Zdotaccent",
  27039. 0x017b,
  27040. "Zdotbelow",
  27041. 0x1e92,
  27042. "Zecyrillic",
  27043. 0x0417,
  27044. "Zedescendercyrillic",
  27045. 0x0498,
  27046. "Zedieresiscyrillic",
  27047. 0x04de,
  27048. "Zeta",
  27049. 0x0396,
  27050. "Zhearmenian",
  27051. 0x053a,
  27052. "Zhebrevecyrillic",
  27053. 0x04c1,
  27054. "Zhecyrillic",
  27055. 0x0416,
  27056. "Zhedescendercyrillic",
  27057. 0x0496,
  27058. "Zhedieresiscyrillic",
  27059. 0x04dc,
  27060. "Zlinebelow",
  27061. 0x1e94,
  27062. "Zmonospace",
  27063. 0xff3a,
  27064. "Zsmall",
  27065. 0xf77a,
  27066. "Zstroke",
  27067. 0x01b5,
  27068. "a",
  27069. 0x0061,
  27070. "aabengali",
  27071. 0x0986,
  27072. "aacute",
  27073. 0x00e1,
  27074. "aadeva",
  27075. 0x0906,
  27076. "aagujarati",
  27077. 0x0a86,
  27078. "aagurmukhi",
  27079. 0x0a06,
  27080. "aamatragurmukhi",
  27081. 0x0a3e,
  27082. "aarusquare",
  27083. 0x3303,
  27084. "aavowelsignbengali",
  27085. 0x09be,
  27086. "aavowelsigndeva",
  27087. 0x093e,
  27088. "aavowelsigngujarati",
  27089. 0x0abe,
  27090. "abbreviationmarkarmenian",
  27091. 0x055f,
  27092. "abbreviationsigndeva",
  27093. 0x0970,
  27094. "abengali",
  27095. 0x0985,
  27096. "abopomofo",
  27097. 0x311a,
  27098. "abreve",
  27099. 0x0103,
  27100. "abreveacute",
  27101. 0x1eaf,
  27102. "abrevecyrillic",
  27103. 0x04d1,
  27104. "abrevedotbelow",
  27105. 0x1eb7,
  27106. "abrevegrave",
  27107. 0x1eb1,
  27108. "abrevehookabove",
  27109. 0x1eb3,
  27110. "abrevetilde",
  27111. 0x1eb5,
  27112. "acaron",
  27113. 0x01ce,
  27114. "acircle",
  27115. 0x24d0,
  27116. "acircumflex",
  27117. 0x00e2,
  27118. "acircumflexacute",
  27119. 0x1ea5,
  27120. "acircumflexdotbelow",
  27121. 0x1ead,
  27122. "acircumflexgrave",
  27123. 0x1ea7,
  27124. "acircumflexhookabove",
  27125. 0x1ea9,
  27126. "acircumflextilde",
  27127. 0x1eab,
  27128. "acute",
  27129. 0x00b4,
  27130. "acutebelowcmb",
  27131. 0x0317,
  27132. "acutecmb",
  27133. 0x0301,
  27134. "acutecomb",
  27135. 0x0301,
  27136. "acutedeva",
  27137. 0x0954,
  27138. "acutelowmod",
  27139. 0x02cf,
  27140. "acutetonecmb",
  27141. 0x0341,
  27142. "acyrillic",
  27143. 0x0430,
  27144. "adblgrave",
  27145. 0x0201,
  27146. "addakgurmukhi",
  27147. 0x0a71,
  27148. "adeva",
  27149. 0x0905,
  27150. "adieresis",
  27151. 0x00e4,
  27152. "adieresiscyrillic",
  27153. 0x04d3,
  27154. "adieresismacron",
  27155. 0x01df,
  27156. "adotbelow",
  27157. 0x1ea1,
  27158. "adotmacron",
  27159. 0x01e1,
  27160. "ae",
  27161. 0x00e6,
  27162. "aeacute",
  27163. 0x01fd,
  27164. "aekorean",
  27165. 0x3150,
  27166. "aemacron",
  27167. 0x01e3,
  27168. "afii00208",
  27169. 0x2015,
  27170. "afii08941",
  27171. 0x20a4,
  27172. "afii10017",
  27173. 0x0410,
  27174. "afii10018",
  27175. 0x0411,
  27176. "afii10019",
  27177. 0x0412,
  27178. "afii10020",
  27179. 0x0413,
  27180. "afii10021",
  27181. 0x0414,
  27182. "afii10022",
  27183. 0x0415,
  27184. "afii10023",
  27185. 0x0401,
  27186. "afii10024",
  27187. 0x0416,
  27188. "afii10025",
  27189. 0x0417,
  27190. "afii10026",
  27191. 0x0418,
  27192. "afii10027",
  27193. 0x0419,
  27194. "afii10028",
  27195. 0x041a,
  27196. "afii10029",
  27197. 0x041b,
  27198. "afii10030",
  27199. 0x041c,
  27200. "afii10031",
  27201. 0x041d,
  27202. "afii10032",
  27203. 0x041e,
  27204. "afii10033",
  27205. 0x041f,
  27206. "afii10034",
  27207. 0x0420,
  27208. "afii10035",
  27209. 0x0421,
  27210. "afii10036",
  27211. 0x0422,
  27212. "afii10037",
  27213. 0x0423,
  27214. "afii10038",
  27215. 0x0424,
  27216. "afii10039",
  27217. 0x0425,
  27218. "afii10040",
  27219. 0x0426,
  27220. "afii10041",
  27221. 0x0427,
  27222. "afii10042",
  27223. 0x0428,
  27224. "afii10043",
  27225. 0x0429,
  27226. "afii10044",
  27227. 0x042a,
  27228. "afii10045",
  27229. 0x042b,
  27230. "afii10046",
  27231. 0x042c,
  27232. "afii10047",
  27233. 0x042d,
  27234. "afii10048",
  27235. 0x042e,
  27236. "afii10049",
  27237. 0x042f,
  27238. "afii10050",
  27239. 0x0490,
  27240. "afii10051",
  27241. 0x0402,
  27242. "afii10052",
  27243. 0x0403,
  27244. "afii10053",
  27245. 0x0404,
  27246. "afii10054",
  27247. 0x0405,
  27248. "afii10055",
  27249. 0x0406,
  27250. "afii10056",
  27251. 0x0407,
  27252. "afii10057",
  27253. 0x0408,
  27254. "afii10058",
  27255. 0x0409,
  27256. "afii10059",
  27257. 0x040a,
  27258. "afii10060",
  27259. 0x040b,
  27260. "afii10061",
  27261. 0x040c,
  27262. "afii10062",
  27263. 0x040e,
  27264. "afii10063",
  27265. 0xf6c4,
  27266. "afii10064",
  27267. 0xf6c5,
  27268. "afii10065",
  27269. 0x0430,
  27270. "afii10066",
  27271. 0x0431,
  27272. "afii10067",
  27273. 0x0432,
  27274. "afii10068",
  27275. 0x0433,
  27276. "afii10069",
  27277. 0x0434,
  27278. "afii10070",
  27279. 0x0435,
  27280. "afii10071",
  27281. 0x0451,
  27282. "afii10072",
  27283. 0x0436,
  27284. "afii10073",
  27285. 0x0437,
  27286. "afii10074",
  27287. 0x0438,
  27288. "afii10075",
  27289. 0x0439,
  27290. "afii10076",
  27291. 0x043a,
  27292. "afii10077",
  27293. 0x043b,
  27294. "afii10078",
  27295. 0x043c,
  27296. "afii10079",
  27297. 0x043d,
  27298. "afii10080",
  27299. 0x043e,
  27300. "afii10081",
  27301. 0x043f,
  27302. "afii10082",
  27303. 0x0440,
  27304. "afii10083",
  27305. 0x0441,
  27306. "afii10084",
  27307. 0x0442,
  27308. "afii10085",
  27309. 0x0443,
  27310. "afii10086",
  27311. 0x0444,
  27312. "afii10087",
  27313. 0x0445,
  27314. "afii10088",
  27315. 0x0446,
  27316. "afii10089",
  27317. 0x0447,
  27318. "afii10090",
  27319. 0x0448,
  27320. "afii10091",
  27321. 0x0449,
  27322. "afii10092",
  27323. 0x044a,
  27324. "afii10093",
  27325. 0x044b,
  27326. "afii10094",
  27327. 0x044c,
  27328. "afii10095",
  27329. 0x044d,
  27330. "afii10096",
  27331. 0x044e,
  27332. "afii10097",
  27333. 0x044f,
  27334. "afii10098",
  27335. 0x0491,
  27336. "afii10099",
  27337. 0x0452,
  27338. "afii10100",
  27339. 0x0453,
  27340. "afii10101",
  27341. 0x0454,
  27342. "afii10102",
  27343. 0x0455,
  27344. "afii10103",
  27345. 0x0456,
  27346. "afii10104",
  27347. 0x0457,
  27348. "afii10105",
  27349. 0x0458,
  27350. "afii10106",
  27351. 0x0459,
  27352. "afii10107",
  27353. 0x045a,
  27354. "afii10108",
  27355. 0x045b,
  27356. "afii10109",
  27357. 0x045c,
  27358. "afii10110",
  27359. 0x045e,
  27360. "afii10145",
  27361. 0x040f,
  27362. "afii10146",
  27363. 0x0462,
  27364. "afii10147",
  27365. 0x0472,
  27366. "afii10148",
  27367. 0x0474,
  27368. "afii10192",
  27369. 0xf6c6,
  27370. "afii10193",
  27371. 0x045f,
  27372. "afii10194",
  27373. 0x0463,
  27374. "afii10195",
  27375. 0x0473,
  27376. "afii10196",
  27377. 0x0475,
  27378. "afii10831",
  27379. 0xf6c7,
  27380. "afii10832",
  27381. 0xf6c8,
  27382. "afii10846",
  27383. 0x04d9,
  27384. "afii299",
  27385. 0x200e,
  27386. "afii300",
  27387. 0x200f,
  27388. "afii301",
  27389. 0x200d,
  27390. "afii57381",
  27391. 0x066a,
  27392. "afii57388",
  27393. 0x060c,
  27394. "afii57392",
  27395. 0x0660,
  27396. "afii57393",
  27397. 0x0661,
  27398. "afii57394",
  27399. 0x0662,
  27400. "afii57395",
  27401. 0x0663,
  27402. "afii57396",
  27403. 0x0664,
  27404. "afii57397",
  27405. 0x0665,
  27406. "afii57398",
  27407. 0x0666,
  27408. "afii57399",
  27409. 0x0667,
  27410. "afii57400",
  27411. 0x0668,
  27412. "afii57401",
  27413. 0x0669,
  27414. "afii57403",
  27415. 0x061b,
  27416. "afii57407",
  27417. 0x061f,
  27418. "afii57409",
  27419. 0x0621,
  27420. "afii57410",
  27421. 0x0622,
  27422. "afii57411",
  27423. 0x0623,
  27424. "afii57412",
  27425. 0x0624,
  27426. "afii57413",
  27427. 0x0625,
  27428. "afii57414",
  27429. 0x0626,
  27430. "afii57415",
  27431. 0x0627,
  27432. "afii57416",
  27433. 0x0628,
  27434. "afii57417",
  27435. 0x0629,
  27436. "afii57418",
  27437. 0x062a,
  27438. "afii57419",
  27439. 0x062b,
  27440. "afii57420",
  27441. 0x062c,
  27442. "afii57421",
  27443. 0x062d,
  27444. "afii57422",
  27445. 0x062e,
  27446. "afii57423",
  27447. 0x062f,
  27448. "afii57424",
  27449. 0x0630,
  27450. "afii57425",
  27451. 0x0631,
  27452. "afii57426",
  27453. 0x0632,
  27454. "afii57427",
  27455. 0x0633,
  27456. "afii57428",
  27457. 0x0634,
  27458. "afii57429",
  27459. 0x0635,
  27460. "afii57430",
  27461. 0x0636,
  27462. "afii57431",
  27463. 0x0637,
  27464. "afii57432",
  27465. 0x0638,
  27466. "afii57433",
  27467. 0x0639,
  27468. "afii57434",
  27469. 0x063a,
  27470. "afii57440",
  27471. 0x0640,
  27472. "afii57441",
  27473. 0x0641,
  27474. "afii57442",
  27475. 0x0642,
  27476. "afii57443",
  27477. 0x0643,
  27478. "afii57444",
  27479. 0x0644,
  27480. "afii57445",
  27481. 0x0645,
  27482. "afii57446",
  27483. 0x0646,
  27484. "afii57448",
  27485. 0x0648,
  27486. "afii57449",
  27487. 0x0649,
  27488. "afii57450",
  27489. 0x064a,
  27490. "afii57451",
  27491. 0x064b,
  27492. "afii57452",
  27493. 0x064c,
  27494. "afii57453",
  27495. 0x064d,
  27496. "afii57454",
  27497. 0x064e,
  27498. "afii57455",
  27499. 0x064f,
  27500. "afii57456",
  27501. 0x0650,
  27502. "afii57457",
  27503. 0x0651,
  27504. "afii57458",
  27505. 0x0652,
  27506. "afii57470",
  27507. 0x0647,
  27508. "afii57505",
  27509. 0x06a4,
  27510. "afii57506",
  27511. 0x067e,
  27512. "afii57507",
  27513. 0x0686,
  27514. "afii57508",
  27515. 0x0698,
  27516. "afii57509",
  27517. 0x06af,
  27518. "afii57511",
  27519. 0x0679,
  27520. "afii57512",
  27521. 0x0688,
  27522. "afii57513",
  27523. 0x0691,
  27524. "afii57514",
  27525. 0x06ba,
  27526. "afii57519",
  27527. 0x06d2,
  27528. "afii57534",
  27529. 0x06d5,
  27530. "afii57636",
  27531. 0x20aa,
  27532. "afii57645",
  27533. 0x05be,
  27534. "afii57658",
  27535. 0x05c3,
  27536. "afii57664",
  27537. 0x05d0,
  27538. "afii57665",
  27539. 0x05d1,
  27540. "afii57666",
  27541. 0x05d2,
  27542. "afii57667",
  27543. 0x05d3,
  27544. "afii57668",
  27545. 0x05d4,
  27546. "afii57669",
  27547. 0x05d5,
  27548. "afii57670",
  27549. 0x05d6,
  27550. "afii57671",
  27551. 0x05d7,
  27552. "afii57672",
  27553. 0x05d8,
  27554. "afii57673",
  27555. 0x05d9,
  27556. "afii57674",
  27557. 0x05da,
  27558. "afii57675",
  27559. 0x05db,
  27560. "afii57676",
  27561. 0x05dc,
  27562. "afii57677",
  27563. 0x05dd,
  27564. "afii57678",
  27565. 0x05de,
  27566. "afii57679",
  27567. 0x05df,
  27568. "afii57680",
  27569. 0x05e0,
  27570. "afii57681",
  27571. 0x05e1,
  27572. "afii57682",
  27573. 0x05e2,
  27574. "afii57683",
  27575. 0x05e3,
  27576. "afii57684",
  27577. 0x05e4,
  27578. "afii57685",
  27579. 0x05e5,
  27580. "afii57686",
  27581. 0x05e6,
  27582. "afii57687",
  27583. 0x05e7,
  27584. "afii57688",
  27585. 0x05e8,
  27586. "afii57689",
  27587. 0x05e9,
  27588. "afii57690",
  27589. 0x05ea,
  27590. "afii57694",
  27591. 0xfb2a,
  27592. "afii57695",
  27593. 0xfb2b,
  27594. "afii57700",
  27595. 0xfb4b,
  27596. "afii57705",
  27597. 0xfb1f,
  27598. "afii57716",
  27599. 0x05f0,
  27600. "afii57717",
  27601. 0x05f1,
  27602. "afii57718",
  27603. 0x05f2,
  27604. "afii57723",
  27605. 0xfb35,
  27606. "afii57793",
  27607. 0x05b4,
  27608. "afii57794",
  27609. 0x05b5,
  27610. "afii57795",
  27611. 0x05b6,
  27612. "afii57796",
  27613. 0x05bb,
  27614. "afii57797",
  27615. 0x05b8,
  27616. "afii57798",
  27617. 0x05b7,
  27618. "afii57799",
  27619. 0x05b0,
  27620. "afii57800",
  27621. 0x05b2,
  27622. "afii57801",
  27623. 0x05b1,
  27624. "afii57802",
  27625. 0x05b3,
  27626. "afii57803",
  27627. 0x05c2,
  27628. "afii57804",
  27629. 0x05c1,
  27630. "afii57806",
  27631. 0x05b9,
  27632. "afii57807",
  27633. 0x05bc,
  27634. "afii57839",
  27635. 0x05bd,
  27636. "afii57841",
  27637. 0x05bf,
  27638. "afii57842",
  27639. 0x05c0,
  27640. "afii57929",
  27641. 0x02bc,
  27642. "afii61248",
  27643. 0x2105,
  27644. "afii61289",
  27645. 0x2113,
  27646. "afii61352",
  27647. 0x2116,
  27648. "afii61573",
  27649. 0x202c,
  27650. "afii61574",
  27651. 0x202d,
  27652. "afii61575",
  27653. 0x202e,
  27654. "afii61664",
  27655. 0x200c,
  27656. "afii63167",
  27657. 0x066d,
  27658. "afii64937",
  27659. 0x02bd,
  27660. "agrave",
  27661. 0x00e0,
  27662. "agujarati",
  27663. 0x0a85,
  27664. "agurmukhi",
  27665. 0x0a05,
  27666. "ahiragana",
  27667. 0x3042,
  27668. "ahookabove",
  27669. 0x1ea3,
  27670. "aibengali",
  27671. 0x0990,
  27672. "aibopomofo",
  27673. 0x311e,
  27674. "aideva",
  27675. 0x0910,
  27676. "aiecyrillic",
  27677. 0x04d5,
  27678. "aigujarati",
  27679. 0x0a90,
  27680. "aigurmukhi",
  27681. 0x0a10,
  27682. "aimatragurmukhi",
  27683. 0x0a48,
  27684. "ainarabic",
  27685. 0x0639,
  27686. "ainfinalarabic",
  27687. 0xfeca,
  27688. "aininitialarabic",
  27689. 0xfecb,
  27690. "ainmedialarabic",
  27691. 0xfecc,
  27692. "ainvertedbreve",
  27693. 0x0203,
  27694. "aivowelsignbengali",
  27695. 0x09c8,
  27696. "aivowelsigndeva",
  27697. 0x0948,
  27698. "aivowelsigngujarati",
  27699. 0x0ac8,
  27700. "akatakana",
  27701. 0x30a2,
  27702. "akatakanahalfwidth",
  27703. 0xff71,
  27704. "akorean",
  27705. 0x314f,
  27706. "alef",
  27707. 0x05d0,
  27708. "alefarabic",
  27709. 0x0627,
  27710. "alefdageshhebrew",
  27711. 0xfb30,
  27712. "aleffinalarabic",
  27713. 0xfe8e,
  27714. "alefhamzaabovearabic",
  27715. 0x0623,
  27716. "alefhamzaabovefinalarabic",
  27717. 0xfe84,
  27718. "alefhamzabelowarabic",
  27719. 0x0625,
  27720. "alefhamzabelowfinalarabic",
  27721. 0xfe88,
  27722. "alefhebrew",
  27723. 0x05d0,
  27724. "aleflamedhebrew",
  27725. 0xfb4f,
  27726. "alefmaddaabovearabic",
  27727. 0x0622,
  27728. "alefmaddaabovefinalarabic",
  27729. 0xfe82,
  27730. "alefmaksuraarabic",
  27731. 0x0649,
  27732. "alefmaksurafinalarabic",
  27733. 0xfef0,
  27734. "alefmaksurainitialarabic",
  27735. 0xfef3,
  27736. "alefmaksuramedialarabic",
  27737. 0xfef4,
  27738. "alefpatahhebrew",
  27739. 0xfb2e,
  27740. "alefqamatshebrew",
  27741. 0xfb2f,
  27742. "aleph",
  27743. 0x2135,
  27744. "allequal",
  27745. 0x224c,
  27746. "alpha",
  27747. 0x03b1,
  27748. "alphatonos",
  27749. 0x03ac,
  27750. "amacron",
  27751. 0x0101,
  27752. "amonospace",
  27753. 0xff41,
  27754. "ampersand",
  27755. 0x0026,
  27756. "ampersandmonospace",
  27757. 0xff06,
  27758. "ampersandsmall",
  27759. 0xf726,
  27760. "amsquare",
  27761. 0x33c2,
  27762. "anbopomofo",
  27763. 0x3122,
  27764. "angbopomofo",
  27765. 0x3124,
  27766. "angbracketleft",
  27767. 0x3008,
  27768. "angbracketright",
  27769. 0x3009,
  27770. "angkhankhuthai",
  27771. 0x0e5a,
  27772. "angle",
  27773. 0x2220,
  27774. "anglebracketleft",
  27775. 0x3008,
  27776. "anglebracketleftvertical",
  27777. 0xfe3f,
  27778. "anglebracketright",
  27779. 0x3009,
  27780. "anglebracketrightvertical",
  27781. 0xfe40,
  27782. "angleleft",
  27783. 0x2329,
  27784. "angleright",
  27785. 0x232a,
  27786. "angstrom",
  27787. 0x212b,
  27788. "anoteleia",
  27789. 0x0387,
  27790. "anudattadeva",
  27791. 0x0952,
  27792. "anusvarabengali",
  27793. 0x0982,
  27794. "anusvaradeva",
  27795. 0x0902,
  27796. "anusvaragujarati",
  27797. 0x0a82,
  27798. "aogonek",
  27799. 0x0105,
  27800. "apaatosquare",
  27801. 0x3300,
  27802. "aparen",
  27803. 0x249c,
  27804. "apostrophearmenian",
  27805. 0x055a,
  27806. "apostrophemod",
  27807. 0x02bc,
  27808. "apple",
  27809. 0xf8ff,
  27810. "approaches",
  27811. 0x2250,
  27812. "approxequal",
  27813. 0x2248,
  27814. "approxequalorimage",
  27815. 0x2252,
  27816. "approximatelyequal",
  27817. 0x2245,
  27818. "araeaekorean",
  27819. 0x318e,
  27820. "araeakorean",
  27821. 0x318d,
  27822. "arc",
  27823. 0x2312,
  27824. "arighthalfring",
  27825. 0x1e9a,
  27826. "aring",
  27827. 0x00e5,
  27828. "aringacute",
  27829. 0x01fb,
  27830. "aringbelow",
  27831. 0x1e01,
  27832. "arrowboth",
  27833. 0x2194,
  27834. "arrowdashdown",
  27835. 0x21e3,
  27836. "arrowdashleft",
  27837. 0x21e0,
  27838. "arrowdashright",
  27839. 0x21e2,
  27840. "arrowdashup",
  27841. 0x21e1,
  27842. "arrowdblboth",
  27843. 0x21d4,
  27844. "arrowdbldown",
  27845. 0x21d3,
  27846. "arrowdblleft",
  27847. 0x21d0,
  27848. "arrowdblright",
  27849. 0x21d2,
  27850. "arrowdblup",
  27851. 0x21d1,
  27852. "arrowdown",
  27853. 0x2193,
  27854. "arrowdownleft",
  27855. 0x2199,
  27856. "arrowdownright",
  27857. 0x2198,
  27858. "arrowdownwhite",
  27859. 0x21e9,
  27860. "arrowheaddownmod",
  27861. 0x02c5,
  27862. "arrowheadleftmod",
  27863. 0x02c2,
  27864. "arrowheadrightmod",
  27865. 0x02c3,
  27866. "arrowheadupmod",
  27867. 0x02c4,
  27868. "arrowhorizex",
  27869. 0xf8e7,
  27870. "arrowleft",
  27871. 0x2190,
  27872. "arrowleftdbl",
  27873. 0x21d0,
  27874. "arrowleftdblstroke",
  27875. 0x21cd,
  27876. "arrowleftoverright",
  27877. 0x21c6,
  27878. "arrowleftwhite",
  27879. 0x21e6,
  27880. "arrowright",
  27881. 0x2192,
  27882. "arrowrightdblstroke",
  27883. 0x21cf,
  27884. "arrowrightheavy",
  27885. 0x279e,
  27886. "arrowrightoverleft",
  27887. 0x21c4,
  27888. "arrowrightwhite",
  27889. 0x21e8,
  27890. "arrowtableft",
  27891. 0x21e4,
  27892. "arrowtabright",
  27893. 0x21e5,
  27894. "arrowup",
  27895. 0x2191,
  27896. "arrowupdn",
  27897. 0x2195,
  27898. "arrowupdnbse",
  27899. 0x21a8,
  27900. "arrowupdownbase",
  27901. 0x21a8,
  27902. "arrowupleft",
  27903. 0x2196,
  27904. "arrowupleftofdown",
  27905. 0x21c5,
  27906. "arrowupright",
  27907. 0x2197,
  27908. "arrowupwhite",
  27909. 0x21e7,
  27910. "arrowvertex",
  27911. 0xf8e6,
  27912. "asciicircum",
  27913. 0x005e,
  27914. "asciicircummonospace",
  27915. 0xff3e,
  27916. "asciitilde",
  27917. 0x007e,
  27918. "asciitildemonospace",
  27919. 0xff5e,
  27920. "ascript",
  27921. 0x0251,
  27922. "ascriptturned",
  27923. 0x0252,
  27924. "asmallhiragana",
  27925. 0x3041,
  27926. "asmallkatakana",
  27927. 0x30a1,
  27928. "asmallkatakanahalfwidth",
  27929. 0xff67,
  27930. "asterisk",
  27931. 0x002a,
  27932. "asteriskaltonearabic",
  27933. 0x066d,
  27934. "asteriskarabic",
  27935. 0x066d,
  27936. "asteriskmath",
  27937. 0x2217,
  27938. "asteriskmonospace",
  27939. 0xff0a,
  27940. "asterisksmall",
  27941. 0xfe61,
  27942. "asterism",
  27943. 0x2042,
  27944. "asuperior",
  27945. 0xf6e9,
  27946. "asymptoticallyequal",
  27947. 0x2243,
  27948. "at",
  27949. 0x0040,
  27950. "atilde",
  27951. 0x00e3,
  27952. "atmonospace",
  27953. 0xff20,
  27954. "atsmall",
  27955. 0xfe6b,
  27956. "aturned",
  27957. 0x0250,
  27958. "aubengali",
  27959. 0x0994,
  27960. "aubopomofo",
  27961. 0x3120,
  27962. "audeva",
  27963. 0x0914,
  27964. "augujarati",
  27965. 0x0a94,
  27966. "augurmukhi",
  27967. 0x0a14,
  27968. "aulengthmarkbengali",
  27969. 0x09d7,
  27970. "aumatragurmukhi",
  27971. 0x0a4c,
  27972. "auvowelsignbengali",
  27973. 0x09cc,
  27974. "auvowelsigndeva",
  27975. 0x094c,
  27976. "auvowelsigngujarati",
  27977. 0x0acc,
  27978. "avagrahadeva",
  27979. 0x093d,
  27980. "aybarmenian",
  27981. 0x0561,
  27982. "ayin",
  27983. 0x05e2,
  27984. "ayinaltonehebrew",
  27985. 0xfb20,
  27986. "ayinhebrew",
  27987. 0x05e2,
  27988. "b",
  27989. 0x0062,
  27990. "babengali",
  27991. 0x09ac,
  27992. "backslash",
  27993. 0x005c,
  27994. "backslashmonospace",
  27995. 0xff3c,
  27996. "badeva",
  27997. 0x092c,
  27998. "bagujarati",
  27999. 0x0aac,
  28000. "bagurmukhi",
  28001. 0x0a2c,
  28002. "bahiragana",
  28003. 0x3070,
  28004. "bahtthai",
  28005. 0x0e3f,
  28006. "bakatakana",
  28007. 0x30d0,
  28008. "bar",
  28009. 0x007c,
  28010. "barmonospace",
  28011. 0xff5c,
  28012. "bbopomofo",
  28013. 0x3105,
  28014. "bcircle",
  28015. 0x24d1,
  28016. "bdotaccent",
  28017. 0x1e03,
  28018. "bdotbelow",
  28019. 0x1e05,
  28020. "beamedsixteenthnotes",
  28021. 0x266c,
  28022. "because",
  28023. 0x2235,
  28024. "becyrillic",
  28025. 0x0431,
  28026. "beharabic",
  28027. 0x0628,
  28028. "behfinalarabic",
  28029. 0xfe90,
  28030. "behinitialarabic",
  28031. 0xfe91,
  28032. "behiragana",
  28033. 0x3079,
  28034. "behmedialarabic",
  28035. 0xfe92,
  28036. "behmeeminitialarabic",
  28037. 0xfc9f,
  28038. "behmeemisolatedarabic",
  28039. 0xfc08,
  28040. "behnoonfinalarabic",
  28041. 0xfc6d,
  28042. "bekatakana",
  28043. 0x30d9,
  28044. "benarmenian",
  28045. 0x0562,
  28046. "bet",
  28047. 0x05d1,
  28048. "beta",
  28049. 0x03b2,
  28050. "betasymbolgreek",
  28051. 0x03d0,
  28052. "betdagesh",
  28053. 0xfb31,
  28054. "betdageshhebrew",
  28055. 0xfb31,
  28056. "bethebrew",
  28057. 0x05d1,
  28058. "betrafehebrew",
  28059. 0xfb4c,
  28060. "bhabengali",
  28061. 0x09ad,
  28062. "bhadeva",
  28063. 0x092d,
  28064. "bhagujarati",
  28065. 0x0aad,
  28066. "bhagurmukhi",
  28067. 0x0a2d,
  28068. "bhook",
  28069. 0x0253,
  28070. "bihiragana",
  28071. 0x3073,
  28072. "bikatakana",
  28073. 0x30d3,
  28074. "bilabialclick",
  28075. 0x0298,
  28076. "bindigurmukhi",
  28077. 0x0a02,
  28078. "birusquare",
  28079. 0x3331,
  28080. "blackcircle",
  28081. 0x25cf,
  28082. "blackdiamond",
  28083. 0x25c6,
  28084. "blackdownpointingtriangle",
  28085. 0x25bc,
  28086. "blackleftpointingpointer",
  28087. 0x25c4,
  28088. "blackleftpointingtriangle",
  28089. 0x25c0,
  28090. "blacklenticularbracketleft",
  28091. 0x3010,
  28092. "blacklenticularbracketleftvertical",
  28093. 0xfe3b,
  28094. "blacklenticularbracketright",
  28095. 0x3011,
  28096. "blacklenticularbracketrightvertical",
  28097. 0xfe3c,
  28098. "blacklowerlefttriangle",
  28099. 0x25e3,
  28100. "blacklowerrighttriangle",
  28101. 0x25e2,
  28102. "blackrectangle",
  28103. 0x25ac,
  28104. "blackrightpointingpointer",
  28105. 0x25ba,
  28106. "blackrightpointingtriangle",
  28107. 0x25b6,
  28108. "blacksmallsquare",
  28109. 0x25aa,
  28110. "blacksmilingface",
  28111. 0x263b,
  28112. "blacksquare",
  28113. 0x25a0,
  28114. "blackstar",
  28115. 0x2605,
  28116. "blackupperlefttriangle",
  28117. 0x25e4,
  28118. "blackupperrighttriangle",
  28119. 0x25e5,
  28120. "blackuppointingsmalltriangle",
  28121. 0x25b4,
  28122. "blackuppointingtriangle",
  28123. 0x25b2,
  28124. "blank",
  28125. 0x2423,
  28126. "blinebelow",
  28127. 0x1e07,
  28128. "block",
  28129. 0x2588,
  28130. "bmonospace",
  28131. 0xff42,
  28132. "bobaimaithai",
  28133. 0x0e1a,
  28134. "bohiragana",
  28135. 0x307c,
  28136. "bokatakana",
  28137. 0x30dc,
  28138. "bparen",
  28139. 0x249d,
  28140. "bqsquare",
  28141. 0x33c3,
  28142. "braceex",
  28143. 0xf8f4,
  28144. "braceleft",
  28145. 0x007b,
  28146. "braceleftbt",
  28147. 0xf8f3,
  28148. "braceleftmid",
  28149. 0xf8f2,
  28150. "braceleftmonospace",
  28151. 0xff5b,
  28152. "braceleftsmall",
  28153. 0xfe5b,
  28154. "bracelefttp",
  28155. 0xf8f1,
  28156. "braceleftvertical",
  28157. 0xfe37,
  28158. "braceright",
  28159. 0x007d,
  28160. "bracerightbt",
  28161. 0xf8fe,
  28162. "bracerightmid",
  28163. 0xf8fd,
  28164. "bracerightmonospace",
  28165. 0xff5d,
  28166. "bracerightsmall",
  28167. 0xfe5c,
  28168. "bracerighttp",
  28169. 0xf8fc,
  28170. "bracerightvertical",
  28171. 0xfe38,
  28172. "bracketleft",
  28173. 0x005b,
  28174. "bracketleftbt",
  28175. 0xf8f0,
  28176. "bracketleftex",
  28177. 0xf8ef,
  28178. "bracketleftmonospace",
  28179. 0xff3b,
  28180. "bracketlefttp",
  28181. 0xf8ee,
  28182. "bracketright",
  28183. 0x005d,
  28184. "bracketrightbt",
  28185. 0xf8fb,
  28186. "bracketrightex",
  28187. 0xf8fa,
  28188. "bracketrightmonospace",
  28189. 0xff3d,
  28190. "bracketrighttp",
  28191. 0xf8f9,
  28192. "breve",
  28193. 0x02d8,
  28194. "brevebelowcmb",
  28195. 0x032e,
  28196. "brevecmb",
  28197. 0x0306,
  28198. "breveinvertedbelowcmb",
  28199. 0x032f,
  28200. "breveinvertedcmb",
  28201. 0x0311,
  28202. "breveinverteddoublecmb",
  28203. 0x0361,
  28204. "bridgebelowcmb",
  28205. 0x032a,
  28206. "bridgeinvertedbelowcmb",
  28207. 0x033a,
  28208. "brokenbar",
  28209. 0x00a6,
  28210. "bstroke",
  28211. 0x0180,
  28212. "bsuperior",
  28213. 0xf6ea,
  28214. "btopbar",
  28215. 0x0183,
  28216. "buhiragana",
  28217. 0x3076,
  28218. "bukatakana",
  28219. 0x30d6,
  28220. "bullet",
  28221. 0x2022,
  28222. "bulletinverse",
  28223. 0x25d8,
  28224. "bulletoperator",
  28225. 0x2219,
  28226. "bullseye",
  28227. 0x25ce,
  28228. "c",
  28229. 0x0063,
  28230. "caarmenian",
  28231. 0x056e,
  28232. "cabengali",
  28233. 0x099a,
  28234. "cacute",
  28235. 0x0107,
  28236. "cadeva",
  28237. 0x091a,
  28238. "cagujarati",
  28239. 0x0a9a,
  28240. "cagurmukhi",
  28241. 0x0a1a,
  28242. "calsquare",
  28243. 0x3388,
  28244. "candrabindubengali",
  28245. 0x0981,
  28246. "candrabinducmb",
  28247. 0x0310,
  28248. "candrabindudeva",
  28249. 0x0901,
  28250. "candrabindugujarati",
  28251. 0x0a81,
  28252. "capslock",
  28253. 0x21ea,
  28254. "careof",
  28255. 0x2105,
  28256. "caron",
  28257. 0x02c7,
  28258. "caronbelowcmb",
  28259. 0x032c,
  28260. "caroncmb",
  28261. 0x030c,
  28262. "carriagereturn",
  28263. 0x21b5,
  28264. "cbopomofo",
  28265. 0x3118,
  28266. "ccaron",
  28267. 0x010d,
  28268. "ccedilla",
  28269. 0x00e7,
  28270. "ccedillaacute",
  28271. 0x1e09,
  28272. "ccircle",
  28273. 0x24d2,
  28274. "ccircumflex",
  28275. 0x0109,
  28276. "ccurl",
  28277. 0x0255,
  28278. "cdot",
  28279. 0x010b,
  28280. "cdotaccent",
  28281. 0x010b,
  28282. "cdsquare",
  28283. 0x33c5,
  28284. "cedilla",
  28285. 0x00b8,
  28286. "cedillacmb",
  28287. 0x0327,
  28288. "cent",
  28289. 0x00a2,
  28290. "centigrade",
  28291. 0x2103,
  28292. "centinferior",
  28293. 0xf6df,
  28294. "centmonospace",
  28295. 0xffe0,
  28296. "centoldstyle",
  28297. 0xf7a2,
  28298. "centsuperior",
  28299. 0xf6e0,
  28300. "chaarmenian",
  28301. 0x0579,
  28302. "chabengali",
  28303. 0x099b,
  28304. "chadeva",
  28305. 0x091b,
  28306. "chagujarati",
  28307. 0x0a9b,
  28308. "chagurmukhi",
  28309. 0x0a1b,
  28310. "chbopomofo",
  28311. 0x3114,
  28312. "cheabkhasiancyrillic",
  28313. 0x04bd,
  28314. "checkmark",
  28315. 0x2713,
  28316. "checyrillic",
  28317. 0x0447,
  28318. "chedescenderabkhasiancyrillic",
  28319. 0x04bf,
  28320. "chedescendercyrillic",
  28321. 0x04b7,
  28322. "chedieresiscyrillic",
  28323. 0x04f5,
  28324. "cheharmenian",
  28325. 0x0573,
  28326. "chekhakassiancyrillic",
  28327. 0x04cc,
  28328. "cheverticalstrokecyrillic",
  28329. 0x04b9,
  28330. "chi",
  28331. 0x03c7,
  28332. "chieuchacirclekorean",
  28333. 0x3277,
  28334. "chieuchaparenkorean",
  28335. 0x3217,
  28336. "chieuchcirclekorean",
  28337. 0x3269,
  28338. "chieuchkorean",
  28339. 0x314a,
  28340. "chieuchparenkorean",
  28341. 0x3209,
  28342. "chochangthai",
  28343. 0x0e0a,
  28344. "chochanthai",
  28345. 0x0e08,
  28346. "chochingthai",
  28347. 0x0e09,
  28348. "chochoethai",
  28349. 0x0e0c,
  28350. "chook",
  28351. 0x0188,
  28352. "cieucacirclekorean",
  28353. 0x3276,
  28354. "cieucaparenkorean",
  28355. 0x3216,
  28356. "cieuccirclekorean",
  28357. 0x3268,
  28358. "cieuckorean",
  28359. 0x3148,
  28360. "cieucparenkorean",
  28361. 0x3208,
  28362. "cieucuparenkorean",
  28363. 0x321c,
  28364. "circle",
  28365. 0x25cb,
  28366. "circlecopyrt",
  28367. 0x00a9,
  28368. "circlemultiply",
  28369. 0x2297,
  28370. "circleot",
  28371. 0x2299,
  28372. "circleplus",
  28373. 0x2295,
  28374. "circlepostalmark",
  28375. 0x3036,
  28376. "circlewithlefthalfblack",
  28377. 0x25d0,
  28378. "circlewithrighthalfblack",
  28379. 0x25d1,
  28380. "circumflex",
  28381. 0x02c6,
  28382. "circumflexbelowcmb",
  28383. 0x032d,
  28384. "circumflexcmb",
  28385. 0x0302,
  28386. "clear",
  28387. 0x2327,
  28388. "clickalveolar",
  28389. 0x01c2,
  28390. "clickdental",
  28391. 0x01c0,
  28392. "clicklateral",
  28393. 0x01c1,
  28394. "clickretroflex",
  28395. 0x01c3,
  28396. "club",
  28397. 0x2663,
  28398. "clubsuitblack",
  28399. 0x2663,
  28400. "clubsuitwhite",
  28401. 0x2667,
  28402. "cmcubedsquare",
  28403. 0x33a4,
  28404. "cmonospace",
  28405. 0xff43,
  28406. "cmsquaredsquare",
  28407. 0x33a0,
  28408. "coarmenian",
  28409. 0x0581,
  28410. "colon",
  28411. 0x003a,
  28412. "colonmonetary",
  28413. 0x20a1,
  28414. "colonmonospace",
  28415. 0xff1a,
  28416. "colonsign",
  28417. 0x20a1,
  28418. "colonsmall",
  28419. 0xfe55,
  28420. "colontriangularhalfmod",
  28421. 0x02d1,
  28422. "colontriangularmod",
  28423. 0x02d0,
  28424. "comma",
  28425. 0x002c,
  28426. "commaabovecmb",
  28427. 0x0313,
  28428. "commaaboverightcmb",
  28429. 0x0315,
  28430. "commaaccent",
  28431. 0xf6c3,
  28432. "commaarabic",
  28433. 0x060c,
  28434. "commaarmenian",
  28435. 0x055d,
  28436. "commainferior",
  28437. 0xf6e1,
  28438. "commamonospace",
  28439. 0xff0c,
  28440. "commareversedabovecmb",
  28441. 0x0314,
  28442. "commareversedmod",
  28443. 0x02bd,
  28444. "commasmall",
  28445. 0xfe50,
  28446. "commasuperior",
  28447. 0xf6e2,
  28448. "commaturnedabovecmb",
  28449. 0x0312,
  28450. "commaturnedmod",
  28451. 0x02bb,
  28452. "compass",
  28453. 0x263c,
  28454. "congruent",
  28455. 0x2245,
  28456. "contourintegral",
  28457. 0x222e,
  28458. "control",
  28459. 0x2303,
  28460. "controlACK",
  28461. 0x0006,
  28462. "controlBEL",
  28463. 0x0007,
  28464. "controlBS",
  28465. 0x0008,
  28466. "controlCAN",
  28467. 0x0018,
  28468. "controlCR",
  28469. 0x000d,
  28470. "controlDC1",
  28471. 0x0011,
  28472. "controlDC2",
  28473. 0x0012,
  28474. "controlDC3",
  28475. 0x0013,
  28476. "controlDC4",
  28477. 0x0014,
  28478. "controlDEL",
  28479. 0x007f,
  28480. "controlDLE",
  28481. 0x0010,
  28482. "controlEM",
  28483. 0x0019,
  28484. "controlENQ",
  28485. 0x0005,
  28486. "controlEOT",
  28487. 0x0004,
  28488. "controlESC",
  28489. 0x001b,
  28490. "controlETB",
  28491. 0x0017,
  28492. "controlETX",
  28493. 0x0003,
  28494. "controlFF",
  28495. 0x000c,
  28496. "controlFS",
  28497. 0x001c,
  28498. "controlGS",
  28499. 0x001d,
  28500. "controlHT",
  28501. 0x0009,
  28502. "controlLF",
  28503. 0x000a,
  28504. "controlNAK",
  28505. 0x0015,
  28506. "controlNULL",
  28507. 0x0000,
  28508. "controlRS",
  28509. 0x001e,
  28510. "controlSI",
  28511. 0x000f,
  28512. "controlSO",
  28513. 0x000e,
  28514. "controlSOT",
  28515. 0x0002,
  28516. "controlSTX",
  28517. 0x0001,
  28518. "controlSUB",
  28519. 0x001a,
  28520. "controlSYN",
  28521. 0x0016,
  28522. "controlUS",
  28523. 0x001f,
  28524. "controlVT",
  28525. 0x000b,
  28526. "copyright",
  28527. 0x00a9,
  28528. "copyrightsans",
  28529. 0xf8e9,
  28530. "copyrightserif",
  28531. 0xf6d9,
  28532. "cornerbracketleft",
  28533. 0x300c,
  28534. "cornerbracketlefthalfwidth",
  28535. 0xff62,
  28536. "cornerbracketleftvertical",
  28537. 0xfe41,
  28538. "cornerbracketright",
  28539. 0x300d,
  28540. "cornerbracketrighthalfwidth",
  28541. 0xff63,
  28542. "cornerbracketrightvertical",
  28543. 0xfe42,
  28544. "corporationsquare",
  28545. 0x337f,
  28546. "cosquare",
  28547. 0x33c7,
  28548. "coverkgsquare",
  28549. 0x33c6,
  28550. "cparen",
  28551. 0x249e,
  28552. "cruzeiro",
  28553. 0x20a2,
  28554. "cstretched",
  28555. 0x0297,
  28556. "curlyand",
  28557. 0x22cf,
  28558. "curlyor",
  28559. 0x22ce,
  28560. "currency",
  28561. 0x00a4,
  28562. "cyrBreve",
  28563. 0xf6d1,
  28564. "cyrFlex",
  28565. 0xf6d2,
  28566. "cyrbreve",
  28567. 0xf6d4,
  28568. "cyrflex",
  28569. 0xf6d5,
  28570. "d",
  28571. 0x0064,
  28572. "daarmenian",
  28573. 0x0564,
  28574. "dabengali",
  28575. 0x09a6,
  28576. "dadarabic",
  28577. 0x0636,
  28578. "dadeva",
  28579. 0x0926,
  28580. "dadfinalarabic",
  28581. 0xfebe,
  28582. "dadinitialarabic",
  28583. 0xfebf,
  28584. "dadmedialarabic",
  28585. 0xfec0,
  28586. "dagesh",
  28587. 0x05bc,
  28588. "dageshhebrew",
  28589. 0x05bc,
  28590. "dagger",
  28591. 0x2020,
  28592. "daggerdbl",
  28593. 0x2021,
  28594. "dagujarati",
  28595. 0x0aa6,
  28596. "dagurmukhi",
  28597. 0x0a26,
  28598. "dahiragana",
  28599. 0x3060,
  28600. "dakatakana",
  28601. 0x30c0,
  28602. "dalarabic",
  28603. 0x062f,
  28604. "dalet",
  28605. 0x05d3,
  28606. "daletdagesh",
  28607. 0xfb33,
  28608. "daletdageshhebrew",
  28609. 0xfb33,
  28610. "dalethebrew",
  28611. 0x05d3,
  28612. "dalfinalarabic",
  28613. 0xfeaa,
  28614. "dammaarabic",
  28615. 0x064f,
  28616. "dammalowarabic",
  28617. 0x064f,
  28618. "dammatanaltonearabic",
  28619. 0x064c,
  28620. "dammatanarabic",
  28621. 0x064c,
  28622. "danda",
  28623. 0x0964,
  28624. "dargahebrew",
  28625. 0x05a7,
  28626. "dargalefthebrew",
  28627. 0x05a7,
  28628. "dasiapneumatacyrilliccmb",
  28629. 0x0485,
  28630. "dblGrave",
  28631. 0xf6d3,
  28632. "dblanglebracketleft",
  28633. 0x300a,
  28634. "dblanglebracketleftvertical",
  28635. 0xfe3d,
  28636. "dblanglebracketright",
  28637. 0x300b,
  28638. "dblanglebracketrightvertical",
  28639. 0xfe3e,
  28640. "dblarchinvertedbelowcmb",
  28641. 0x032b,
  28642. "dblarrowleft",
  28643. 0x21d4,
  28644. "dblarrowright",
  28645. 0x21d2,
  28646. "dbldanda",
  28647. 0x0965,
  28648. "dblgrave",
  28649. 0xf6d6,
  28650. "dblgravecmb",
  28651. 0x030f,
  28652. "dblintegral",
  28653. 0x222c,
  28654. "dbllowline",
  28655. 0x2017,
  28656. "dbllowlinecmb",
  28657. 0x0333,
  28658. "dbloverlinecmb",
  28659. 0x033f,
  28660. "dblprimemod",
  28661. 0x02ba,
  28662. "dblverticalbar",
  28663. 0x2016,
  28664. "dblverticallineabovecmb",
  28665. 0x030e,
  28666. "dbopomofo",
  28667. 0x3109,
  28668. "dbsquare",
  28669. 0x33c8,
  28670. "dcaron",
  28671. 0x010f,
  28672. "dcedilla",
  28673. 0x1e11,
  28674. "dcircle",
  28675. 0x24d3,
  28676. "dcircumflexbelow",
  28677. 0x1e13,
  28678. "dcroat",
  28679. 0x0111,
  28680. "ddabengali",
  28681. 0x09a1,
  28682. "ddadeva",
  28683. 0x0921,
  28684. "ddagujarati",
  28685. 0x0aa1,
  28686. "ddagurmukhi",
  28687. 0x0a21,
  28688. "ddalarabic",
  28689. 0x0688,
  28690. "ddalfinalarabic",
  28691. 0xfb89,
  28692. "dddhadeva",
  28693. 0x095c,
  28694. "ddhabengali",
  28695. 0x09a2,
  28696. "ddhadeva",
  28697. 0x0922,
  28698. "ddhagujarati",
  28699. 0x0aa2,
  28700. "ddhagurmukhi",
  28701. 0x0a22,
  28702. "ddotaccent",
  28703. 0x1e0b,
  28704. "ddotbelow",
  28705. 0x1e0d,
  28706. "decimalseparatorarabic",
  28707. 0x066b,
  28708. "decimalseparatorpersian",
  28709. 0x066b,
  28710. "decyrillic",
  28711. 0x0434,
  28712. "degree",
  28713. 0x00b0,
  28714. "dehihebrew",
  28715. 0x05ad,
  28716. "dehiragana",
  28717. 0x3067,
  28718. "deicoptic",
  28719. 0x03ef,
  28720. "dekatakana",
  28721. 0x30c7,
  28722. "deleteleft",
  28723. 0x232b,
  28724. "deleteright",
  28725. 0x2326,
  28726. "delta",
  28727. 0x03b4,
  28728. "deltaturned",
  28729. 0x018d,
  28730. "denominatorminusonenumeratorbengali",
  28731. 0x09f8,
  28732. "dezh",
  28733. 0x02a4,
  28734. "dhabengali",
  28735. 0x09a7,
  28736. "dhadeva",
  28737. 0x0927,
  28738. "dhagujarati",
  28739. 0x0aa7,
  28740. "dhagurmukhi",
  28741. 0x0a27,
  28742. "dhook",
  28743. 0x0257,
  28744. "dialytikatonos",
  28745. 0x0385,
  28746. "dialytikatonoscmb",
  28747. 0x0344,
  28748. "diamond",
  28749. 0x2666,
  28750. "diamondsuitwhite",
  28751. 0x2662,
  28752. "dieresis",
  28753. 0x00a8,
  28754. "dieresisacute",
  28755. 0xf6d7,
  28756. "dieresisbelowcmb",
  28757. 0x0324,
  28758. "dieresiscmb",
  28759. 0x0308,
  28760. "dieresisgrave",
  28761. 0xf6d8,
  28762. "dieresistonos",
  28763. 0x0385,
  28764. "dihiragana",
  28765. 0x3062,
  28766. "dikatakana",
  28767. 0x30c2,
  28768. "dittomark",
  28769. 0x3003,
  28770. "divide",
  28771. 0x00f7,
  28772. "divides",
  28773. 0x2223,
  28774. "divisionslash",
  28775. 0x2215,
  28776. "djecyrillic",
  28777. 0x0452,
  28778. "dkshade",
  28779. 0x2593,
  28780. "dlinebelow",
  28781. 0x1e0f,
  28782. "dlsquare",
  28783. 0x3397,
  28784. "dmacron",
  28785. 0x0111,
  28786. "dmonospace",
  28787. 0xff44,
  28788. "dnblock",
  28789. 0x2584,
  28790. "dochadathai",
  28791. 0x0e0e,
  28792. "dodekthai",
  28793. 0x0e14,
  28794. "dohiragana",
  28795. 0x3069,
  28796. "dokatakana",
  28797. 0x30c9,
  28798. "dollar",
  28799. 0x0024,
  28800. "dollarinferior",
  28801. 0xf6e3,
  28802. "dollarmonospace",
  28803. 0xff04,
  28804. "dollaroldstyle",
  28805. 0xf724,
  28806. "dollarsmall",
  28807. 0xfe69,
  28808. "dollarsuperior",
  28809. 0xf6e4,
  28810. "dong",
  28811. 0x20ab,
  28812. "dorusquare",
  28813. 0x3326,
  28814. "dotaccent",
  28815. 0x02d9,
  28816. "dotaccentcmb",
  28817. 0x0307,
  28818. "dotbelowcmb",
  28819. 0x0323,
  28820. "dotbelowcomb",
  28821. 0x0323,
  28822. "dotkatakana",
  28823. 0x30fb,
  28824. "dotlessi",
  28825. 0x0131,
  28826. "dotlessj",
  28827. 0xf6be,
  28828. "dotlessjstrokehook",
  28829. 0x0284,
  28830. "dotmath",
  28831. 0x22c5,
  28832. "dottedcircle",
  28833. 0x25cc,
  28834. "doubleyodpatah",
  28835. 0xfb1f,
  28836. "doubleyodpatahhebrew",
  28837. 0xfb1f,
  28838. "downtackbelowcmb",
  28839. 0x031e,
  28840. "downtackmod",
  28841. 0x02d5,
  28842. "dparen",
  28843. 0x249f,
  28844. "dsuperior",
  28845. 0xf6eb,
  28846. "dtail",
  28847. 0x0256,
  28848. "dtopbar",
  28849. 0x018c,
  28850. "duhiragana",
  28851. 0x3065,
  28852. "dukatakana",
  28853. 0x30c5,
  28854. "dz",
  28855. 0x01f3,
  28856. "dzaltone",
  28857. 0x02a3,
  28858. "dzcaron",
  28859. 0x01c6,
  28860. "dzcurl",
  28861. 0x02a5,
  28862. "dzeabkhasiancyrillic",
  28863. 0x04e1,
  28864. "dzecyrillic",
  28865. 0x0455,
  28866. "dzhecyrillic",
  28867. 0x045f,
  28868. "e",
  28869. 0x0065,
  28870. "eacute",
  28871. 0x00e9,
  28872. "earth",
  28873. 0x2641,
  28874. "ebengali",
  28875. 0x098f,
  28876. "ebopomofo",
  28877. 0x311c,
  28878. "ebreve",
  28879. 0x0115,
  28880. "ecandradeva",
  28881. 0x090d,
  28882. "ecandragujarati",
  28883. 0x0a8d,
  28884. "ecandravowelsigndeva",
  28885. 0x0945,
  28886. "ecandravowelsigngujarati",
  28887. 0x0ac5,
  28888. "ecaron",
  28889. 0x011b,
  28890. "ecedillabreve",
  28891. 0x1e1d,
  28892. "echarmenian",
  28893. 0x0565,
  28894. "echyiwnarmenian",
  28895. 0x0587,
  28896. "ecircle",
  28897. 0x24d4,
  28898. "ecircumflex",
  28899. 0x00ea,
  28900. "ecircumflexacute",
  28901. 0x1ebf,
  28902. "ecircumflexbelow",
  28903. 0x1e19,
  28904. "ecircumflexdotbelow",
  28905. 0x1ec7,
  28906. "ecircumflexgrave",
  28907. 0x1ec1,
  28908. "ecircumflexhookabove",
  28909. 0x1ec3,
  28910. "ecircumflextilde",
  28911. 0x1ec5,
  28912. "ecyrillic",
  28913. 0x0454,
  28914. "edblgrave",
  28915. 0x0205,
  28916. "edeva",
  28917. 0x090f,
  28918. "edieresis",
  28919. 0x00eb,
  28920. "edot",
  28921. 0x0117,
  28922. "edotaccent",
  28923. 0x0117,
  28924. "edotbelow",
  28925. 0x1eb9,
  28926. "eegurmukhi",
  28927. 0x0a0f,
  28928. "eematragurmukhi",
  28929. 0x0a47,
  28930. "efcyrillic",
  28931. 0x0444,
  28932. "egrave",
  28933. 0x00e8,
  28934. "egujarati",
  28935. 0x0a8f,
  28936. "eharmenian",
  28937. 0x0567,
  28938. "ehbopomofo",
  28939. 0x311d,
  28940. "ehiragana",
  28941. 0x3048,
  28942. "ehookabove",
  28943. 0x1ebb,
  28944. "eibopomofo",
  28945. 0x311f,
  28946. "eight",
  28947. 0x0038,
  28948. "eightarabic",
  28949. 0x0668,
  28950. "eightbengali",
  28951. 0x09ee,
  28952. "eightcircle",
  28953. 0x2467,
  28954. "eightcircleinversesansserif",
  28955. 0x2791,
  28956. "eightdeva",
  28957. 0x096e,
  28958. "eighteencircle",
  28959. 0x2471,
  28960. "eighteenparen",
  28961. 0x2485,
  28962. "eighteenperiod",
  28963. 0x2499,
  28964. "eightgujarati",
  28965. 0x0aee,
  28966. "eightgurmukhi",
  28967. 0x0a6e,
  28968. "eighthackarabic",
  28969. 0x0668,
  28970. "eighthangzhou",
  28971. 0x3028,
  28972. "eighthnotebeamed",
  28973. 0x266b,
  28974. "eightideographicparen",
  28975. 0x3227,
  28976. "eightinferior",
  28977. 0x2088,
  28978. "eightmonospace",
  28979. 0xff18,
  28980. "eightoldstyle",
  28981. 0xf738,
  28982. "eightparen",
  28983. 0x247b,
  28984. "eightperiod",
  28985. 0x248f,
  28986. "eightpersian",
  28987. 0x06f8,
  28988. "eightroman",
  28989. 0x2177,
  28990. "eightsuperior",
  28991. 0x2078,
  28992. "eightthai",
  28993. 0x0e58,
  28994. "einvertedbreve",
  28995. 0x0207,
  28996. "eiotifiedcyrillic",
  28997. 0x0465,
  28998. "ekatakana",
  28999. 0x30a8,
  29000. "ekatakanahalfwidth",
  29001. 0xff74,
  29002. "ekonkargurmukhi",
  29003. 0x0a74,
  29004. "ekorean",
  29005. 0x3154,
  29006. "elcyrillic",
  29007. 0x043b,
  29008. "element",
  29009. 0x2208,
  29010. "elevencircle",
  29011. 0x246a,
  29012. "elevenparen",
  29013. 0x247e,
  29014. "elevenperiod",
  29015. 0x2492,
  29016. "elevenroman",
  29017. 0x217a,
  29018. "ellipsis",
  29019. 0x2026,
  29020. "ellipsisvertical",
  29021. 0x22ee,
  29022. "emacron",
  29023. 0x0113,
  29024. "emacronacute",
  29025. 0x1e17,
  29026. "emacrongrave",
  29027. 0x1e15,
  29028. "emcyrillic",
  29029. 0x043c,
  29030. "emdash",
  29031. 0x2014,
  29032. "emdashvertical",
  29033. 0xfe31,
  29034. "emonospace",
  29035. 0xff45,
  29036. "emphasismarkarmenian",
  29037. 0x055b,
  29038. "emptyset",
  29039. 0x2205,
  29040. "enbopomofo",
  29041. 0x3123,
  29042. "encyrillic",
  29043. 0x043d,
  29044. "endash",
  29045. 0x2013,
  29046. "endashvertical",
  29047. 0xfe32,
  29048. "endescendercyrillic",
  29049. 0x04a3,
  29050. "eng",
  29051. 0x014b,
  29052. "engbopomofo",
  29053. 0x3125,
  29054. "enghecyrillic",
  29055. 0x04a5,
  29056. "enhookcyrillic",
  29057. 0x04c8,
  29058. "enspace",
  29059. 0x2002,
  29060. "eogonek",
  29061. 0x0119,
  29062. "eokorean",
  29063. 0x3153,
  29064. "eopen",
  29065. 0x025b,
  29066. "eopenclosed",
  29067. 0x029a,
  29068. "eopenreversed",
  29069. 0x025c,
  29070. "eopenreversedclosed",
  29071. 0x025e,
  29072. "eopenreversedhook",
  29073. 0x025d,
  29074. "eparen",
  29075. 0x24a0,
  29076. "epsilon",
  29077. 0x03b5,
  29078. "epsilontonos",
  29079. 0x03ad,
  29080. "equal",
  29081. 0x003d,
  29082. "equalmonospace",
  29083. 0xff1d,
  29084. "equalsmall",
  29085. 0xfe66,
  29086. "equalsuperior",
  29087. 0x207c,
  29088. "equivalence",
  29089. 0x2261,
  29090. "erbopomofo",
  29091. 0x3126,
  29092. "ercyrillic",
  29093. 0x0440,
  29094. "ereversed",
  29095. 0x0258,
  29096. "ereversedcyrillic",
  29097. 0x044d,
  29098. "escyrillic",
  29099. 0x0441,
  29100. "esdescendercyrillic",
  29101. 0x04ab,
  29102. "esh",
  29103. 0x0283,
  29104. "eshcurl",
  29105. 0x0286,
  29106. "eshortdeva",
  29107. 0x090e,
  29108. "eshortvowelsigndeva",
  29109. 0x0946,
  29110. "eshreversedloop",
  29111. 0x01aa,
  29112. "eshsquatreversed",
  29113. 0x0285,
  29114. "esmallhiragana",
  29115. 0x3047,
  29116. "esmallkatakana",
  29117. 0x30a7,
  29118. "esmallkatakanahalfwidth",
  29119. 0xff6a,
  29120. "estimated",
  29121. 0x212e,
  29122. "esuperior",
  29123. 0xf6ec,
  29124. "eta",
  29125. 0x03b7,
  29126. "etarmenian",
  29127. 0x0568,
  29128. "etatonos",
  29129. 0x03ae,
  29130. "eth",
  29131. 0x00f0,
  29132. "etilde",
  29133. 0x1ebd,
  29134. "etildebelow",
  29135. 0x1e1b,
  29136. "etnahtafoukhhebrew",
  29137. 0x0591,
  29138. "etnahtafoukhlefthebrew",
  29139. 0x0591,
  29140. "etnahtahebrew",
  29141. 0x0591,
  29142. "etnahtalefthebrew",
  29143. 0x0591,
  29144. "eturned",
  29145. 0x01dd,
  29146. "eukorean",
  29147. 0x3161,
  29148. "euro",
  29149. 0x20ac,
  29150. "evowelsignbengali",
  29151. 0x09c7,
  29152. "evowelsigndeva",
  29153. 0x0947,
  29154. "evowelsigngujarati",
  29155. 0x0ac7,
  29156. "exclam",
  29157. 0x0021,
  29158. "exclamarmenian",
  29159. 0x055c,
  29160. "exclamdbl",
  29161. 0x203c,
  29162. "exclamdown",
  29163. 0x00a1,
  29164. "exclamdownsmall",
  29165. 0xf7a1,
  29166. "exclammonospace",
  29167. 0xff01,
  29168. "exclamsmall",
  29169. 0xf721,
  29170. "existential",
  29171. 0x2203,
  29172. "ezh",
  29173. 0x0292,
  29174. "ezhcaron",
  29175. 0x01ef,
  29176. "ezhcurl",
  29177. 0x0293,
  29178. "ezhreversed",
  29179. 0x01b9,
  29180. "ezhtail",
  29181. 0x01ba,
  29182. "f",
  29183. 0x0066,
  29184. "fadeva",
  29185. 0x095e,
  29186. "fagurmukhi",
  29187. 0x0a5e,
  29188. "fahrenheit",
  29189. 0x2109,
  29190. "fathaarabic",
  29191. 0x064e,
  29192. "fathalowarabic",
  29193. 0x064e,
  29194. "fathatanarabic",
  29195. 0x064b,
  29196. "fbopomofo",
  29197. 0x3108,
  29198. "fcircle",
  29199. 0x24d5,
  29200. "fdotaccent",
  29201. 0x1e1f,
  29202. "feharabic",
  29203. 0x0641,
  29204. "feharmenian",
  29205. 0x0586,
  29206. "fehfinalarabic",
  29207. 0xfed2,
  29208. "fehinitialarabic",
  29209. 0xfed3,
  29210. "fehmedialarabic",
  29211. 0xfed4,
  29212. "feicoptic",
  29213. 0x03e5,
  29214. "female",
  29215. 0x2640,
  29216. "ff",
  29217. 0xfb00,
  29218. "f_f",
  29219. 0xfb00,
  29220. "ffi",
  29221. 0xfb03,
  29222. "ffl",
  29223. 0xfb04,
  29224. "fi",
  29225. 0xfb01,
  29226. "fifteencircle",
  29227. 0x246e,
  29228. "fifteenparen",
  29229. 0x2482,
  29230. "fifteenperiod",
  29231. 0x2496,
  29232. "figuredash",
  29233. 0x2012,
  29234. "filledbox",
  29235. 0x25a0,
  29236. "filledrect",
  29237. 0x25ac,
  29238. "finalkaf",
  29239. 0x05da,
  29240. "finalkafdagesh",
  29241. 0xfb3a,
  29242. "finalkafdageshhebrew",
  29243. 0xfb3a,
  29244. "finalkafhebrew",
  29245. 0x05da,
  29246. "finalmem",
  29247. 0x05dd,
  29248. "finalmemhebrew",
  29249. 0x05dd,
  29250. "finalnun",
  29251. 0x05df,
  29252. "finalnunhebrew",
  29253. 0x05df,
  29254. "finalpe",
  29255. 0x05e3,
  29256. "finalpehebrew",
  29257. 0x05e3,
  29258. "finaltsadi",
  29259. 0x05e5,
  29260. "finaltsadihebrew",
  29261. 0x05e5,
  29262. "firsttonechinese",
  29263. 0x02c9,
  29264. "fisheye",
  29265. 0x25c9,
  29266. "fitacyrillic",
  29267. 0x0473,
  29268. "five",
  29269. 0x0035,
  29270. "fivearabic",
  29271. 0x0665,
  29272. "fivebengali",
  29273. 0x09eb,
  29274. "fivecircle",
  29275. 0x2464,
  29276. "fivecircleinversesansserif",
  29277. 0x278e,
  29278. "fivedeva",
  29279. 0x096b,
  29280. "fiveeighths",
  29281. 0x215d,
  29282. "fivegujarati",
  29283. 0x0aeb,
  29284. "fivegurmukhi",
  29285. 0x0a6b,
  29286. "fivehackarabic",
  29287. 0x0665,
  29288. "fivehangzhou",
  29289. 0x3025,
  29290. "fiveideographicparen",
  29291. 0x3224,
  29292. "fiveinferior",
  29293. 0x2085,
  29294. "fivemonospace",
  29295. 0xff15,
  29296. "fiveoldstyle",
  29297. 0xf735,
  29298. "fiveparen",
  29299. 0x2478,
  29300. "fiveperiod",
  29301. 0x248c,
  29302. "fivepersian",
  29303. 0x06f5,
  29304. "fiveroman",
  29305. 0x2174,
  29306. "fivesuperior",
  29307. 0x2075,
  29308. "fivethai",
  29309. 0x0e55,
  29310. "fl",
  29311. 0xfb02,
  29312. "florin",
  29313. 0x0192,
  29314. "fmonospace",
  29315. 0xff46,
  29316. "fmsquare",
  29317. 0x3399,
  29318. "fofanthai",
  29319. 0x0e1f,
  29320. "fofathai",
  29321. 0x0e1d,
  29322. "fongmanthai",
  29323. 0x0e4f,
  29324. "forall",
  29325. 0x2200,
  29326. "four",
  29327. 0x0034,
  29328. "fourarabic",
  29329. 0x0664,
  29330. "fourbengali",
  29331. 0x09ea,
  29332. "fourcircle",
  29333. 0x2463,
  29334. "fourcircleinversesansserif",
  29335. 0x278d,
  29336. "fourdeva",
  29337. 0x096a,
  29338. "fourgujarati",
  29339. 0x0aea,
  29340. "fourgurmukhi",
  29341. 0x0a6a,
  29342. "fourhackarabic",
  29343. 0x0664,
  29344. "fourhangzhou",
  29345. 0x3024,
  29346. "fourideographicparen",
  29347. 0x3223,
  29348. "fourinferior",
  29349. 0x2084,
  29350. "fourmonospace",
  29351. 0xff14,
  29352. "fournumeratorbengali",
  29353. 0x09f7,
  29354. "fouroldstyle",
  29355. 0xf734,
  29356. "fourparen",
  29357. 0x2477,
  29358. "fourperiod",
  29359. 0x248b,
  29360. "fourpersian",
  29361. 0x06f4,
  29362. "fourroman",
  29363. 0x2173,
  29364. "foursuperior",
  29365. 0x2074,
  29366. "fourteencircle",
  29367. 0x246d,
  29368. "fourteenparen",
  29369. 0x2481,
  29370. "fourteenperiod",
  29371. 0x2495,
  29372. "fourthai",
  29373. 0x0e54,
  29374. "fourthtonechinese",
  29375. 0x02cb,
  29376. "fparen",
  29377. 0x24a1,
  29378. "fraction",
  29379. 0x2044,
  29380. "franc",
  29381. 0x20a3,
  29382. "g",
  29383. 0x0067,
  29384. "gabengali",
  29385. 0x0997,
  29386. "gacute",
  29387. 0x01f5,
  29388. "gadeva",
  29389. 0x0917,
  29390. "gafarabic",
  29391. 0x06af,
  29392. "gaffinalarabic",
  29393. 0xfb93,
  29394. "gafinitialarabic",
  29395. 0xfb94,
  29396. "gafmedialarabic",
  29397. 0xfb95,
  29398. "gagujarati",
  29399. 0x0a97,
  29400. "gagurmukhi",
  29401. 0x0a17,
  29402. "gahiragana",
  29403. 0x304c,
  29404. "gakatakana",
  29405. 0x30ac,
  29406. "gamma",
  29407. 0x03b3,
  29408. "gammalatinsmall",
  29409. 0x0263,
  29410. "gammasuperior",
  29411. 0x02e0,
  29412. "gangiacoptic",
  29413. 0x03eb,
  29414. "gbopomofo",
  29415. 0x310d,
  29416. "gbreve",
  29417. 0x011f,
  29418. "gcaron",
  29419. 0x01e7,
  29420. "gcedilla",
  29421. 0x0123,
  29422. "gcircle",
  29423. 0x24d6,
  29424. "gcircumflex",
  29425. 0x011d,
  29426. "gcommaaccent",
  29427. 0x0123,
  29428. "gdot",
  29429. 0x0121,
  29430. "gdotaccent",
  29431. 0x0121,
  29432. "gecyrillic",
  29433. 0x0433,
  29434. "gehiragana",
  29435. 0x3052,
  29436. "gekatakana",
  29437. 0x30b2,
  29438. "geometricallyequal",
  29439. 0x2251,
  29440. "gereshaccenthebrew",
  29441. 0x059c,
  29442. "gereshhebrew",
  29443. 0x05f3,
  29444. "gereshmuqdamhebrew",
  29445. 0x059d,
  29446. "germandbls",
  29447. 0x00df,
  29448. "gershayimaccenthebrew",
  29449. 0x059e,
  29450. "gershayimhebrew",
  29451. 0x05f4,
  29452. "getamark",
  29453. 0x3013,
  29454. "ghabengali",
  29455. 0x0998,
  29456. "ghadarmenian",
  29457. 0x0572,
  29458. "ghadeva",
  29459. 0x0918,
  29460. "ghagujarati",
  29461. 0x0a98,
  29462. "ghagurmukhi",
  29463. 0x0a18,
  29464. "ghainarabic",
  29465. 0x063a,
  29466. "ghainfinalarabic",
  29467. 0xfece,
  29468. "ghaininitialarabic",
  29469. 0xfecf,
  29470. "ghainmedialarabic",
  29471. 0xfed0,
  29472. "ghemiddlehookcyrillic",
  29473. 0x0495,
  29474. "ghestrokecyrillic",
  29475. 0x0493,
  29476. "gheupturncyrillic",
  29477. 0x0491,
  29478. "ghhadeva",
  29479. 0x095a,
  29480. "ghhagurmukhi",
  29481. 0x0a5a,
  29482. "ghook",
  29483. 0x0260,
  29484. "ghzsquare",
  29485. 0x3393,
  29486. "gihiragana",
  29487. 0x304e,
  29488. "gikatakana",
  29489. 0x30ae,
  29490. "gimarmenian",
  29491. 0x0563,
  29492. "gimel",
  29493. 0x05d2,
  29494. "gimeldagesh",
  29495. 0xfb32,
  29496. "gimeldageshhebrew",
  29497. 0xfb32,
  29498. "gimelhebrew",
  29499. 0x05d2,
  29500. "gjecyrillic",
  29501. 0x0453,
  29502. "glottalinvertedstroke",
  29503. 0x01be,
  29504. "glottalstop",
  29505. 0x0294,
  29506. "glottalstopinverted",
  29507. 0x0296,
  29508. "glottalstopmod",
  29509. 0x02c0,
  29510. "glottalstopreversed",
  29511. 0x0295,
  29512. "glottalstopreversedmod",
  29513. 0x02c1,
  29514. "glottalstopreversedsuperior",
  29515. 0x02e4,
  29516. "glottalstopstroke",
  29517. 0x02a1,
  29518. "glottalstopstrokereversed",
  29519. 0x02a2,
  29520. "gmacron",
  29521. 0x1e21,
  29522. "gmonospace",
  29523. 0xff47,
  29524. "gohiragana",
  29525. 0x3054,
  29526. "gokatakana",
  29527. 0x30b4,
  29528. "gparen",
  29529. 0x24a2,
  29530. "gpasquare",
  29531. 0x33ac,
  29532. "gradient",
  29533. 0x2207,
  29534. "grave",
  29535. 0x0060,
  29536. "gravebelowcmb",
  29537. 0x0316,
  29538. "gravecmb",
  29539. 0x0300,
  29540. "gravecomb",
  29541. 0x0300,
  29542. "gravedeva",
  29543. 0x0953,
  29544. "gravelowmod",
  29545. 0x02ce,
  29546. "gravemonospace",
  29547. 0xff40,
  29548. "gravetonecmb",
  29549. 0x0340,
  29550. "greater",
  29551. 0x003e,
  29552. "greaterequal",
  29553. 0x2265,
  29554. "greaterequalorless",
  29555. 0x22db,
  29556. "greatermonospace",
  29557. 0xff1e,
  29558. "greaterorequivalent",
  29559. 0x2273,
  29560. "greaterorless",
  29561. 0x2277,
  29562. "greateroverequal",
  29563. 0x2267,
  29564. "greatersmall",
  29565. 0xfe65,
  29566. "gscript",
  29567. 0x0261,
  29568. "gstroke",
  29569. 0x01e5,
  29570. "guhiragana",
  29571. 0x3050,
  29572. "guillemotleft",
  29573. 0x00ab,
  29574. "guillemotright",
  29575. 0x00bb,
  29576. "guilsinglleft",
  29577. 0x2039,
  29578. "guilsinglright",
  29579. 0x203a,
  29580. "gukatakana",
  29581. 0x30b0,
  29582. "guramusquare",
  29583. 0x3318,
  29584. "gysquare",
  29585. 0x33c9,
  29586. "h",
  29587. 0x0068,
  29588. "haabkhasiancyrillic",
  29589. 0x04a9,
  29590. "haaltonearabic",
  29591. 0x06c1,
  29592. "habengali",
  29593. 0x09b9,
  29594. "hadescendercyrillic",
  29595. 0x04b3,
  29596. "hadeva",
  29597. 0x0939,
  29598. "hagujarati",
  29599. 0x0ab9,
  29600. "hagurmukhi",
  29601. 0x0a39,
  29602. "haharabic",
  29603. 0x062d,
  29604. "hahfinalarabic",
  29605. 0xfea2,
  29606. "hahinitialarabic",
  29607. 0xfea3,
  29608. "hahiragana",
  29609. 0x306f,
  29610. "hahmedialarabic",
  29611. 0xfea4,
  29612. "haitusquare",
  29613. 0x332a,
  29614. "hakatakana",
  29615. 0x30cf,
  29616. "hakatakanahalfwidth",
  29617. 0xff8a,
  29618. "halantgurmukhi",
  29619. 0x0a4d,
  29620. "hamzaarabic",
  29621. 0x0621,
  29622. "hamzalowarabic",
  29623. 0x0621,
  29624. "hangulfiller",
  29625. 0x3164,
  29626. "hardsigncyrillic",
  29627. 0x044a,
  29628. "harpoonleftbarbup",
  29629. 0x21bc,
  29630. "harpoonrightbarbup",
  29631. 0x21c0,
  29632. "hasquare",
  29633. 0x33ca,
  29634. "hatafpatah",
  29635. 0x05b2,
  29636. "hatafpatah16",
  29637. 0x05b2,
  29638. "hatafpatah23",
  29639. 0x05b2,
  29640. "hatafpatah2f",
  29641. 0x05b2,
  29642. "hatafpatahhebrew",
  29643. 0x05b2,
  29644. "hatafpatahnarrowhebrew",
  29645. 0x05b2,
  29646. "hatafpatahquarterhebrew",
  29647. 0x05b2,
  29648. "hatafpatahwidehebrew",
  29649. 0x05b2,
  29650. "hatafqamats",
  29651. 0x05b3,
  29652. "hatafqamats1b",
  29653. 0x05b3,
  29654. "hatafqamats28",
  29655. 0x05b3,
  29656. "hatafqamats34",
  29657. 0x05b3,
  29658. "hatafqamatshebrew",
  29659. 0x05b3,
  29660. "hatafqamatsnarrowhebrew",
  29661. 0x05b3,
  29662. "hatafqamatsquarterhebrew",
  29663. 0x05b3,
  29664. "hatafqamatswidehebrew",
  29665. 0x05b3,
  29666. "hatafsegol",
  29667. 0x05b1,
  29668. "hatafsegol17",
  29669. 0x05b1,
  29670. "hatafsegol24",
  29671. 0x05b1,
  29672. "hatafsegol30",
  29673. 0x05b1,
  29674. "hatafsegolhebrew",
  29675. 0x05b1,
  29676. "hatafsegolnarrowhebrew",
  29677. 0x05b1,
  29678. "hatafsegolquarterhebrew",
  29679. 0x05b1,
  29680. "hatafsegolwidehebrew",
  29681. 0x05b1,
  29682. "hbar",
  29683. 0x0127,
  29684. "hbopomofo",
  29685. 0x310f,
  29686. "hbrevebelow",
  29687. 0x1e2b,
  29688. "hcedilla",
  29689. 0x1e29,
  29690. "hcircle",
  29691. 0x24d7,
  29692. "hcircumflex",
  29693. 0x0125,
  29694. "hdieresis",
  29695. 0x1e27,
  29696. "hdotaccent",
  29697. 0x1e23,
  29698. "hdotbelow",
  29699. 0x1e25,
  29700. "he",
  29701. 0x05d4,
  29702. "heart",
  29703. 0x2665,
  29704. "heartsuitblack",
  29705. 0x2665,
  29706. "heartsuitwhite",
  29707. 0x2661,
  29708. "hedagesh",
  29709. 0xfb34,
  29710. "hedageshhebrew",
  29711. 0xfb34,
  29712. "hehaltonearabic",
  29713. 0x06c1,
  29714. "heharabic",
  29715. 0x0647,
  29716. "hehebrew",
  29717. 0x05d4,
  29718. "hehfinalaltonearabic",
  29719. 0xfba7,
  29720. "hehfinalalttwoarabic",
  29721. 0xfeea,
  29722. "hehfinalarabic",
  29723. 0xfeea,
  29724. "hehhamzaabovefinalarabic",
  29725. 0xfba5,
  29726. "hehhamzaaboveisolatedarabic",
  29727. 0xfba4,
  29728. "hehinitialaltonearabic",
  29729. 0xfba8,
  29730. "hehinitialarabic",
  29731. 0xfeeb,
  29732. "hehiragana",
  29733. 0x3078,
  29734. "hehmedialaltonearabic",
  29735. 0xfba9,
  29736. "hehmedialarabic",
  29737. 0xfeec,
  29738. "heiseierasquare",
  29739. 0x337b,
  29740. "hekatakana",
  29741. 0x30d8,
  29742. "hekatakanahalfwidth",
  29743. 0xff8d,
  29744. "hekutaarusquare",
  29745. 0x3336,
  29746. "henghook",
  29747. 0x0267,
  29748. "herutusquare",
  29749. 0x3339,
  29750. "het",
  29751. 0x05d7,
  29752. "hethebrew",
  29753. 0x05d7,
  29754. "hhook",
  29755. 0x0266,
  29756. "hhooksuperior",
  29757. 0x02b1,
  29758. "hieuhacirclekorean",
  29759. 0x327b,
  29760. "hieuhaparenkorean",
  29761. 0x321b,
  29762. "hieuhcirclekorean",
  29763. 0x326d,
  29764. "hieuhkorean",
  29765. 0x314e,
  29766. "hieuhparenkorean",
  29767. 0x320d,
  29768. "hihiragana",
  29769. 0x3072,
  29770. "hikatakana",
  29771. 0x30d2,
  29772. "hikatakanahalfwidth",
  29773. 0xff8b,
  29774. "hiriq",
  29775. 0x05b4,
  29776. "hiriq14",
  29777. 0x05b4,
  29778. "hiriq21",
  29779. 0x05b4,
  29780. "hiriq2d",
  29781. 0x05b4,
  29782. "hiriqhebrew",
  29783. 0x05b4,
  29784. "hiriqnarrowhebrew",
  29785. 0x05b4,
  29786. "hiriqquarterhebrew",
  29787. 0x05b4,
  29788. "hiriqwidehebrew",
  29789. 0x05b4,
  29790. "hlinebelow",
  29791. 0x1e96,
  29792. "hmonospace",
  29793. 0xff48,
  29794. "hoarmenian",
  29795. 0x0570,
  29796. "hohipthai",
  29797. 0x0e2b,
  29798. "hohiragana",
  29799. 0x307b,
  29800. "hokatakana",
  29801. 0x30db,
  29802. "hokatakanahalfwidth",
  29803. 0xff8e,
  29804. "holam",
  29805. 0x05b9,
  29806. "holam19",
  29807. 0x05b9,
  29808. "holam26",
  29809. 0x05b9,
  29810. "holam32",
  29811. 0x05b9,
  29812. "holamhebrew",
  29813. 0x05b9,
  29814. "holamnarrowhebrew",
  29815. 0x05b9,
  29816. "holamquarterhebrew",
  29817. 0x05b9,
  29818. "holamwidehebrew",
  29819. 0x05b9,
  29820. "honokhukthai",
  29821. 0x0e2e,
  29822. "hookabovecomb",
  29823. 0x0309,
  29824. "hookcmb",
  29825. 0x0309,
  29826. "hookpalatalizedbelowcmb",
  29827. 0x0321,
  29828. "hookretroflexbelowcmb",
  29829. 0x0322,
  29830. "hoonsquare",
  29831. 0x3342,
  29832. "horicoptic",
  29833. 0x03e9,
  29834. "horizontalbar",
  29835. 0x2015,
  29836. "horncmb",
  29837. 0x031b,
  29838. "hotsprings",
  29839. 0x2668,
  29840. "house",
  29841. 0x2302,
  29842. "hparen",
  29843. 0x24a3,
  29844. "hsuperior",
  29845. 0x02b0,
  29846. "hturned",
  29847. 0x0265,
  29848. "huhiragana",
  29849. 0x3075,
  29850. "huiitosquare",
  29851. 0x3333,
  29852. "hukatakana",
  29853. 0x30d5,
  29854. "hukatakanahalfwidth",
  29855. 0xff8c,
  29856. "hungarumlaut",
  29857. 0x02dd,
  29858. "hungarumlautcmb",
  29859. 0x030b,
  29860. "hv",
  29861. 0x0195,
  29862. "hyphen",
  29863. 0x002d,
  29864. "hypheninferior",
  29865. 0xf6e5,
  29866. "hyphenmonospace",
  29867. 0xff0d,
  29868. "hyphensmall",
  29869. 0xfe63,
  29870. "hyphensuperior",
  29871. 0xf6e6,
  29872. "hyphentwo",
  29873. 0x2010,
  29874. "i",
  29875. 0x0069,
  29876. "iacute",
  29877. 0x00ed,
  29878. "iacyrillic",
  29879. 0x044f,
  29880. "ibengali",
  29881. 0x0987,
  29882. "ibopomofo",
  29883. 0x3127,
  29884. "ibreve",
  29885. 0x012d,
  29886. "icaron",
  29887. 0x01d0,
  29888. "icircle",
  29889. 0x24d8,
  29890. "icircumflex",
  29891. 0x00ee,
  29892. "icyrillic",
  29893. 0x0456,
  29894. "idblgrave",
  29895. 0x0209,
  29896. "ideographearthcircle",
  29897. 0x328f,
  29898. "ideographfirecircle",
  29899. 0x328b,
  29900. "ideographicallianceparen",
  29901. 0x323f,
  29902. "ideographiccallparen",
  29903. 0x323a,
  29904. "ideographiccentrecircle",
  29905. 0x32a5,
  29906. "ideographicclose",
  29907. 0x3006,
  29908. "ideographiccomma",
  29909. 0x3001,
  29910. "ideographiccommaleft",
  29911. 0xff64,
  29912. "ideographiccongratulationparen",
  29913. 0x3237,
  29914. "ideographiccorrectcircle",
  29915. 0x32a3,
  29916. "ideographicearthparen",
  29917. 0x322f,
  29918. "ideographicenterpriseparen",
  29919. 0x323d,
  29920. "ideographicexcellentcircle",
  29921. 0x329d,
  29922. "ideographicfestivalparen",
  29923. 0x3240,
  29924. "ideographicfinancialcircle",
  29925. 0x3296,
  29926. "ideographicfinancialparen",
  29927. 0x3236,
  29928. "ideographicfireparen",
  29929. 0x322b,
  29930. "ideographichaveparen",
  29931. 0x3232,
  29932. "ideographichighcircle",
  29933. 0x32a4,
  29934. "ideographiciterationmark",
  29935. 0x3005,
  29936. "ideographiclaborcircle",
  29937. 0x3298,
  29938. "ideographiclaborparen",
  29939. 0x3238,
  29940. "ideographicleftcircle",
  29941. 0x32a7,
  29942. "ideographiclowcircle",
  29943. 0x32a6,
  29944. "ideographicmedicinecircle",
  29945. 0x32a9,
  29946. "ideographicmetalparen",
  29947. 0x322e,
  29948. "ideographicmoonparen",
  29949. 0x322a,
  29950. "ideographicnameparen",
  29951. 0x3234,
  29952. "ideographicperiod",
  29953. 0x3002,
  29954. "ideographicprintcircle",
  29955. 0x329e,
  29956. "ideographicreachparen",
  29957. 0x3243,
  29958. "ideographicrepresentparen",
  29959. 0x3239,
  29960. "ideographicresourceparen",
  29961. 0x323e,
  29962. "ideographicrightcircle",
  29963. 0x32a8,
  29964. "ideographicsecretcircle",
  29965. 0x3299,
  29966. "ideographicselfparen",
  29967. 0x3242,
  29968. "ideographicsocietyparen",
  29969. 0x3233,
  29970. "ideographicspace",
  29971. 0x3000,
  29972. "ideographicspecialparen",
  29973. 0x3235,
  29974. "ideographicstockparen",
  29975. 0x3231,
  29976. "ideographicstudyparen",
  29977. 0x323b,
  29978. "ideographicsunparen",
  29979. 0x3230,
  29980. "ideographicsuperviseparen",
  29981. 0x323c,
  29982. "ideographicwaterparen",
  29983. 0x322c,
  29984. "ideographicwoodparen",
  29985. 0x322d,
  29986. "ideographiczero",
  29987. 0x3007,
  29988. "ideographmetalcircle",
  29989. 0x328e,
  29990. "ideographmooncircle",
  29991. 0x328a,
  29992. "ideographnamecircle",
  29993. 0x3294,
  29994. "ideographsuncircle",
  29995. 0x3290,
  29996. "ideographwatercircle",
  29997. 0x328c,
  29998. "ideographwoodcircle",
  29999. 0x328d,
  30000. "ideva",
  30001. 0x0907,
  30002. "idieresis",
  30003. 0x00ef,
  30004. "idieresisacute",
  30005. 0x1e2f,
  30006. "idieresiscyrillic",
  30007. 0x04e5,
  30008. "idotbelow",
  30009. 0x1ecb,
  30010. "iebrevecyrillic",
  30011. 0x04d7,
  30012. "iecyrillic",
  30013. 0x0435,
  30014. "ieungacirclekorean",
  30015. 0x3275,
  30016. "ieungaparenkorean",
  30017. 0x3215,
  30018. "ieungcirclekorean",
  30019. 0x3267,
  30020. "ieungkorean",
  30021. 0x3147,
  30022. "ieungparenkorean",
  30023. 0x3207,
  30024. "igrave",
  30025. 0x00ec,
  30026. "igujarati",
  30027. 0x0a87,
  30028. "igurmukhi",
  30029. 0x0a07,
  30030. "ihiragana",
  30031. 0x3044,
  30032. "ihookabove",
  30033. 0x1ec9,
  30034. "iibengali",
  30035. 0x0988,
  30036. "iicyrillic",
  30037. 0x0438,
  30038. "iideva",
  30039. 0x0908,
  30040. "iigujarati",
  30041. 0x0a88,
  30042. "iigurmukhi",
  30043. 0x0a08,
  30044. "iimatragurmukhi",
  30045. 0x0a40,
  30046. "iinvertedbreve",
  30047. 0x020b,
  30048. "iishortcyrillic",
  30049. 0x0439,
  30050. "iivowelsignbengali",
  30051. 0x09c0,
  30052. "iivowelsigndeva",
  30053. 0x0940,
  30054. "iivowelsigngujarati",
  30055. 0x0ac0,
  30056. "ij",
  30057. 0x0133,
  30058. "ikatakana",
  30059. 0x30a4,
  30060. "ikatakanahalfwidth",
  30061. 0xff72,
  30062. "ikorean",
  30063. 0x3163,
  30064. "ilde",
  30065. 0x02dc,
  30066. "iluyhebrew",
  30067. 0x05ac,
  30068. "imacron",
  30069. 0x012b,
  30070. "imacroncyrillic",
  30071. 0x04e3,
  30072. "imageorapproximatelyequal",
  30073. 0x2253,
  30074. "imatragurmukhi",
  30075. 0x0a3f,
  30076. "imonospace",
  30077. 0xff49,
  30078. "increment",
  30079. 0x2206,
  30080. "infinity",
  30081. 0x221e,
  30082. "iniarmenian",
  30083. 0x056b,
  30084. "integral",
  30085. 0x222b,
  30086. "integralbottom",
  30087. 0x2321,
  30088. "integralbt",
  30089. 0x2321,
  30090. "integralex",
  30091. 0xf8f5,
  30092. "integraltop",
  30093. 0x2320,
  30094. "integraltp",
  30095. 0x2320,
  30096. "intersection",
  30097. 0x2229,
  30098. "intisquare",
  30099. 0x3305,
  30100. "invbullet",
  30101. 0x25d8,
  30102. "invcircle",
  30103. 0x25d9,
  30104. "invsmileface",
  30105. 0x263b,
  30106. "iocyrillic",
  30107. 0x0451,
  30108. "iogonek",
  30109. 0x012f,
  30110. "iota",
  30111. 0x03b9,
  30112. "iotadieresis",
  30113. 0x03ca,
  30114. "iotadieresistonos",
  30115. 0x0390,
  30116. "iotalatin",
  30117. 0x0269,
  30118. "iotatonos",
  30119. 0x03af,
  30120. "iparen",
  30121. 0x24a4,
  30122. "irigurmukhi",
  30123. 0x0a72,
  30124. "ismallhiragana",
  30125. 0x3043,
  30126. "ismallkatakana",
  30127. 0x30a3,
  30128. "ismallkatakanahalfwidth",
  30129. 0xff68,
  30130. "issharbengali",
  30131. 0x09fa,
  30132. "istroke",
  30133. 0x0268,
  30134. "isuperior",
  30135. 0xf6ed,
  30136. "iterationhiragana",
  30137. 0x309d,
  30138. "iterationkatakana",
  30139. 0x30fd,
  30140. "itilde",
  30141. 0x0129,
  30142. "itildebelow",
  30143. 0x1e2d,
  30144. "iubopomofo",
  30145. 0x3129,
  30146. "iucyrillic",
  30147. 0x044e,
  30148. "ivowelsignbengali",
  30149. 0x09bf,
  30150. "ivowelsigndeva",
  30151. 0x093f,
  30152. "ivowelsigngujarati",
  30153. 0x0abf,
  30154. "izhitsacyrillic",
  30155. 0x0475,
  30156. "izhitsadblgravecyrillic",
  30157. 0x0477,
  30158. "j",
  30159. 0x006a,
  30160. "jaarmenian",
  30161. 0x0571,
  30162. "jabengali",
  30163. 0x099c,
  30164. "jadeva",
  30165. 0x091c,
  30166. "jagujarati",
  30167. 0x0a9c,
  30168. "jagurmukhi",
  30169. 0x0a1c,
  30170. "jbopomofo",
  30171. 0x3110,
  30172. "jcaron",
  30173. 0x01f0,
  30174. "jcircle",
  30175. 0x24d9,
  30176. "jcircumflex",
  30177. 0x0135,
  30178. "jcrossedtail",
  30179. 0x029d,
  30180. "jdotlessstroke",
  30181. 0x025f,
  30182. "jecyrillic",
  30183. 0x0458,
  30184. "jeemarabic",
  30185. 0x062c,
  30186. "jeemfinalarabic",
  30187. 0xfe9e,
  30188. "jeeminitialarabic",
  30189. 0xfe9f,
  30190. "jeemmedialarabic",
  30191. 0xfea0,
  30192. "jeharabic",
  30193. 0x0698,
  30194. "jehfinalarabic",
  30195. 0xfb8b,
  30196. "jhabengali",
  30197. 0x099d,
  30198. "jhadeva",
  30199. 0x091d,
  30200. "jhagujarati",
  30201. 0x0a9d,
  30202. "jhagurmukhi",
  30203. 0x0a1d,
  30204. "jheharmenian",
  30205. 0x057b,
  30206. "jis",
  30207. 0x3004,
  30208. "jmonospace",
  30209. 0xff4a,
  30210. "jparen",
  30211. 0x24a5,
  30212. "jsuperior",
  30213. 0x02b2,
  30214. "k",
  30215. 0x006b,
  30216. "kabashkircyrillic",
  30217. 0x04a1,
  30218. "kabengali",
  30219. 0x0995,
  30220. "kacute",
  30221. 0x1e31,
  30222. "kacyrillic",
  30223. 0x043a,
  30224. "kadescendercyrillic",
  30225. 0x049b,
  30226. "kadeva",
  30227. 0x0915,
  30228. "kaf",
  30229. 0x05db,
  30230. "kafarabic",
  30231. 0x0643,
  30232. "kafdagesh",
  30233. 0xfb3b,
  30234. "kafdageshhebrew",
  30235. 0xfb3b,
  30236. "kaffinalarabic",
  30237. 0xfeda,
  30238. "kafhebrew",
  30239. 0x05db,
  30240. "kafinitialarabic",
  30241. 0xfedb,
  30242. "kafmedialarabic",
  30243. 0xfedc,
  30244. "kafrafehebrew",
  30245. 0xfb4d,
  30246. "kagujarati",
  30247. 0x0a95,
  30248. "kagurmukhi",
  30249. 0x0a15,
  30250. "kahiragana",
  30251. 0x304b,
  30252. "kahookcyrillic",
  30253. 0x04c4,
  30254. "kakatakana",
  30255. 0x30ab,
  30256. "kakatakanahalfwidth",
  30257. 0xff76,
  30258. "kappa",
  30259. 0x03ba,
  30260. "kappasymbolgreek",
  30261. 0x03f0,
  30262. "kapyeounmieumkorean",
  30263. 0x3171,
  30264. "kapyeounphieuphkorean",
  30265. 0x3184,
  30266. "kapyeounpieupkorean",
  30267. 0x3178,
  30268. "kapyeounssangpieupkorean",
  30269. 0x3179,
  30270. "karoriisquare",
  30271. 0x330d,
  30272. "kashidaautoarabic",
  30273. 0x0640,
  30274. "kashidaautonosidebearingarabic",
  30275. 0x0640,
  30276. "kasmallkatakana",
  30277. 0x30f5,
  30278. "kasquare",
  30279. 0x3384,
  30280. "kasraarabic",
  30281. 0x0650,
  30282. "kasratanarabic",
  30283. 0x064d,
  30284. "kastrokecyrillic",
  30285. 0x049f,
  30286. "katahiraprolongmarkhalfwidth",
  30287. 0xff70,
  30288. "kaverticalstrokecyrillic",
  30289. 0x049d,
  30290. "kbopomofo",
  30291. 0x310e,
  30292. "kcalsquare",
  30293. 0x3389,
  30294. "kcaron",
  30295. 0x01e9,
  30296. "kcedilla",
  30297. 0x0137,
  30298. "kcircle",
  30299. 0x24da,
  30300. "kcommaaccent",
  30301. 0x0137,
  30302. "kdotbelow",
  30303. 0x1e33,
  30304. "keharmenian",
  30305. 0x0584,
  30306. "kehiragana",
  30307. 0x3051,
  30308. "kekatakana",
  30309. 0x30b1,
  30310. "kekatakanahalfwidth",
  30311. 0xff79,
  30312. "kenarmenian",
  30313. 0x056f,
  30314. "kesmallkatakana",
  30315. 0x30f6,
  30316. "kgreenlandic",
  30317. 0x0138,
  30318. "khabengali",
  30319. 0x0996,
  30320. "khacyrillic",
  30321. 0x0445,
  30322. "khadeva",
  30323. 0x0916,
  30324. "khagujarati",
  30325. 0x0a96,
  30326. "khagurmukhi",
  30327. 0x0a16,
  30328. "khaharabic",
  30329. 0x062e,
  30330. "khahfinalarabic",
  30331. 0xfea6,
  30332. "khahinitialarabic",
  30333. 0xfea7,
  30334. "khahmedialarabic",
  30335. 0xfea8,
  30336. "kheicoptic",
  30337. 0x03e7,
  30338. "khhadeva",
  30339. 0x0959,
  30340. "khhagurmukhi",
  30341. 0x0a59,
  30342. "khieukhacirclekorean",
  30343. 0x3278,
  30344. "khieukhaparenkorean",
  30345. 0x3218,
  30346. "khieukhcirclekorean",
  30347. 0x326a,
  30348. "khieukhkorean",
  30349. 0x314b,
  30350. "khieukhparenkorean",
  30351. 0x320a,
  30352. "khokhaithai",
  30353. 0x0e02,
  30354. "khokhonthai",
  30355. 0x0e05,
  30356. "khokhuatthai",
  30357. 0x0e03,
  30358. "khokhwaithai",
  30359. 0x0e04,
  30360. "khomutthai",
  30361. 0x0e5b,
  30362. "khook",
  30363. 0x0199,
  30364. "khorakhangthai",
  30365. 0x0e06,
  30366. "khzsquare",
  30367. 0x3391,
  30368. "kihiragana",
  30369. 0x304d,
  30370. "kikatakana",
  30371. 0x30ad,
  30372. "kikatakanahalfwidth",
  30373. 0xff77,
  30374. "kiroguramusquare",
  30375. 0x3315,
  30376. "kiromeetorusquare",
  30377. 0x3316,
  30378. "kirosquare",
  30379. 0x3314,
  30380. "kiyeokacirclekorean",
  30381. 0x326e,
  30382. "kiyeokaparenkorean",
  30383. 0x320e,
  30384. "kiyeokcirclekorean",
  30385. 0x3260,
  30386. "kiyeokkorean",
  30387. 0x3131,
  30388. "kiyeokparenkorean",
  30389. 0x3200,
  30390. "kiyeoksioskorean",
  30391. 0x3133,
  30392. "kjecyrillic",
  30393. 0x045c,
  30394. "klinebelow",
  30395. 0x1e35,
  30396. "klsquare",
  30397. 0x3398,
  30398. "kmcubedsquare",
  30399. 0x33a6,
  30400. "kmonospace",
  30401. 0xff4b,
  30402. "kmsquaredsquare",
  30403. 0x33a2,
  30404. "kohiragana",
  30405. 0x3053,
  30406. "kohmsquare",
  30407. 0x33c0,
  30408. "kokaithai",
  30409. 0x0e01,
  30410. "kokatakana",
  30411. 0x30b3,
  30412. "kokatakanahalfwidth",
  30413. 0xff7a,
  30414. "kooposquare",
  30415. 0x331e,
  30416. "koppacyrillic",
  30417. 0x0481,
  30418. "koreanstandardsymbol",
  30419. 0x327f,
  30420. "koroniscmb",
  30421. 0x0343,
  30422. "kparen",
  30423. 0x24a6,
  30424. "kpasquare",
  30425. 0x33aa,
  30426. "ksicyrillic",
  30427. 0x046f,
  30428. "ktsquare",
  30429. 0x33cf,
  30430. "kturned",
  30431. 0x029e,
  30432. "kuhiragana",
  30433. 0x304f,
  30434. "kukatakana",
  30435. 0x30af,
  30436. "kukatakanahalfwidth",
  30437. 0xff78,
  30438. "kvsquare",
  30439. 0x33b8,
  30440. "kwsquare",
  30441. 0x33be,
  30442. "l",
  30443. 0x006c,
  30444. "labengali",
  30445. 0x09b2,
  30446. "lacute",
  30447. 0x013a,
  30448. "ladeva",
  30449. 0x0932,
  30450. "lagujarati",
  30451. 0x0ab2,
  30452. "lagurmukhi",
  30453. 0x0a32,
  30454. "lakkhangyaothai",
  30455. 0x0e45,
  30456. "lamaleffinalarabic",
  30457. 0xfefc,
  30458. "lamalefhamzaabovefinalarabic",
  30459. 0xfef8,
  30460. "lamalefhamzaaboveisolatedarabic",
  30461. 0xfef7,
  30462. "lamalefhamzabelowfinalarabic",
  30463. 0xfefa,
  30464. "lamalefhamzabelowisolatedarabic",
  30465. 0xfef9,
  30466. "lamalefisolatedarabic",
  30467. 0xfefb,
  30468. "lamalefmaddaabovefinalarabic",
  30469. 0xfef6,
  30470. "lamalefmaddaaboveisolatedarabic",
  30471. 0xfef5,
  30472. "lamarabic",
  30473. 0x0644,
  30474. "lambda",
  30475. 0x03bb,
  30476. "lambdastroke",
  30477. 0x019b,
  30478. "lamed",
  30479. 0x05dc,
  30480. "lameddagesh",
  30481. 0xfb3c,
  30482. "lameddageshhebrew",
  30483. 0xfb3c,
  30484. "lamedhebrew",
  30485. 0x05dc,
  30486. "lamfinalarabic",
  30487. 0xfede,
  30488. "lamhahinitialarabic",
  30489. 0xfcca,
  30490. "laminitialarabic",
  30491. 0xfedf,
  30492. "lamjeeminitialarabic",
  30493. 0xfcc9,
  30494. "lamkhahinitialarabic",
  30495. 0xfccb,
  30496. "lamlamhehisolatedarabic",
  30497. 0xfdf2,
  30498. "lammedialarabic",
  30499. 0xfee0,
  30500. "lammeemhahinitialarabic",
  30501. 0xfd88,
  30502. "lammeeminitialarabic",
  30503. 0xfccc,
  30504. "largecircle",
  30505. 0x25ef,
  30506. "lbar",
  30507. 0x019a,
  30508. "lbelt",
  30509. 0x026c,
  30510. "lbopomofo",
  30511. 0x310c,
  30512. "lcaron",
  30513. 0x013e,
  30514. "lcedilla",
  30515. 0x013c,
  30516. "lcircle",
  30517. 0x24db,
  30518. "lcircumflexbelow",
  30519. 0x1e3d,
  30520. "lcommaaccent",
  30521. 0x013c,
  30522. "ldot",
  30523. 0x0140,
  30524. "ldotaccent",
  30525. 0x0140,
  30526. "ldotbelow",
  30527. 0x1e37,
  30528. "ldotbelowmacron",
  30529. 0x1e39,
  30530. "leftangleabovecmb",
  30531. 0x031a,
  30532. "lefttackbelowcmb",
  30533. 0x0318,
  30534. "less",
  30535. 0x003c,
  30536. "lessequal",
  30537. 0x2264,
  30538. "lessequalorgreater",
  30539. 0x22da,
  30540. "lessmonospace",
  30541. 0xff1c,
  30542. "lessorequivalent",
  30543. 0x2272,
  30544. "lessorgreater",
  30545. 0x2276,
  30546. "lessoverequal",
  30547. 0x2266,
  30548. "lesssmall",
  30549. 0xfe64,
  30550. "lezh",
  30551. 0x026e,
  30552. "lfblock",
  30553. 0x258c,
  30554. "lhookretroflex",
  30555. 0x026d,
  30556. "lira",
  30557. 0x20a4,
  30558. "liwnarmenian",
  30559. 0x056c,
  30560. "lj",
  30561. 0x01c9,
  30562. "ljecyrillic",
  30563. 0x0459,
  30564. "ll",
  30565. 0xf6c0,
  30566. "lladeva",
  30567. 0x0933,
  30568. "llagujarati",
  30569. 0x0ab3,
  30570. "llinebelow",
  30571. 0x1e3b,
  30572. "llladeva",
  30573. 0x0934,
  30574. "llvocalicbengali",
  30575. 0x09e1,
  30576. "llvocalicdeva",
  30577. 0x0961,
  30578. "llvocalicvowelsignbengali",
  30579. 0x09e3,
  30580. "llvocalicvowelsigndeva",
  30581. 0x0963,
  30582. "lmiddletilde",
  30583. 0x026b,
  30584. "lmonospace",
  30585. 0xff4c,
  30586. "lmsquare",
  30587. 0x33d0,
  30588. "lochulathai",
  30589. 0x0e2c,
  30590. "logicaland",
  30591. 0x2227,
  30592. "logicalnot",
  30593. 0x00ac,
  30594. "logicalnotreversed",
  30595. 0x2310,
  30596. "logicalor",
  30597. 0x2228,
  30598. "lolingthai",
  30599. 0x0e25,
  30600. "longs",
  30601. 0x017f,
  30602. "lowlinecenterline",
  30603. 0xfe4e,
  30604. "lowlinecmb",
  30605. 0x0332,
  30606. "lowlinedashed",
  30607. 0xfe4d,
  30608. "lozenge",
  30609. 0x25ca,
  30610. "lparen",
  30611. 0x24a7,
  30612. "lslash",
  30613. 0x0142,
  30614. "lsquare",
  30615. 0x2113,
  30616. "lsuperior",
  30617. 0xf6ee,
  30618. "ltshade",
  30619. 0x2591,
  30620. "luthai",
  30621. 0x0e26,
  30622. "lvocalicbengali",
  30623. 0x098c,
  30624. "lvocalicdeva",
  30625. 0x090c,
  30626. "lvocalicvowelsignbengali",
  30627. 0x09e2,
  30628. "lvocalicvowelsigndeva",
  30629. 0x0962,
  30630. "lxsquare",
  30631. 0x33d3,
  30632. "m",
  30633. 0x006d,
  30634. "mabengali",
  30635. 0x09ae,
  30636. "macron",
  30637. 0x00af,
  30638. "macronbelowcmb",
  30639. 0x0331,
  30640. "macroncmb",
  30641. 0x0304,
  30642. "macronlowmod",
  30643. 0x02cd,
  30644. "macronmonospace",
  30645. 0xffe3,
  30646. "macute",
  30647. 0x1e3f,
  30648. "madeva",
  30649. 0x092e,
  30650. "magujarati",
  30651. 0x0aae,
  30652. "magurmukhi",
  30653. 0x0a2e,
  30654. "mahapakhhebrew",
  30655. 0x05a4,
  30656. "mahapakhlefthebrew",
  30657. 0x05a4,
  30658. "mahiragana",
  30659. 0x307e,
  30660. "maichattawalowleftthai",
  30661. 0xf895,
  30662. "maichattawalowrightthai",
  30663. 0xf894,
  30664. "maichattawathai",
  30665. 0x0e4b,
  30666. "maichattawaupperleftthai",
  30667. 0xf893,
  30668. "maieklowleftthai",
  30669. 0xf88c,
  30670. "maieklowrightthai",
  30671. 0xf88b,
  30672. "maiekthai",
  30673. 0x0e48,
  30674. "maiekupperleftthai",
  30675. 0xf88a,
  30676. "maihanakatleftthai",
  30677. 0xf884,
  30678. "maihanakatthai",
  30679. 0x0e31,
  30680. "maitaikhuleftthai",
  30681. 0xf889,
  30682. "maitaikhuthai",
  30683. 0x0e47,
  30684. "maitholowleftthai",
  30685. 0xf88f,
  30686. "maitholowrightthai",
  30687. 0xf88e,
  30688. "maithothai",
  30689. 0x0e49,
  30690. "maithoupperleftthai",
  30691. 0xf88d,
  30692. "maitrilowleftthai",
  30693. 0xf892,
  30694. "maitrilowrightthai",
  30695. 0xf891,
  30696. "maitrithai",
  30697. 0x0e4a,
  30698. "maitriupperleftthai",
  30699. 0xf890,
  30700. "maiyamokthai",
  30701. 0x0e46,
  30702. "makatakana",
  30703. 0x30de,
  30704. "makatakanahalfwidth",
  30705. 0xff8f,
  30706. "male",
  30707. 0x2642,
  30708. "mansyonsquare",
  30709. 0x3347,
  30710. "maqafhebrew",
  30711. 0x05be,
  30712. "mars",
  30713. 0x2642,
  30714. "masoracirclehebrew",
  30715. 0x05af,
  30716. "masquare",
  30717. 0x3383,
  30718. "mbopomofo",
  30719. 0x3107,
  30720. "mbsquare",
  30721. 0x33d4,
  30722. "mcircle",
  30723. 0x24dc,
  30724. "mcubedsquare",
  30725. 0x33a5,
  30726. "mdotaccent",
  30727. 0x1e41,
  30728. "mdotbelow",
  30729. 0x1e43,
  30730. "meemarabic",
  30731. 0x0645,
  30732. "meemfinalarabic",
  30733. 0xfee2,
  30734. "meeminitialarabic",
  30735. 0xfee3,
  30736. "meemmedialarabic",
  30737. 0xfee4,
  30738. "meemmeeminitialarabic",
  30739. 0xfcd1,
  30740. "meemmeemisolatedarabic",
  30741. 0xfc48,
  30742. "meetorusquare",
  30743. 0x334d,
  30744. "mehiragana",
  30745. 0x3081,
  30746. "meizierasquare",
  30747. 0x337e,
  30748. "mekatakana",
  30749. 0x30e1,
  30750. "mekatakanahalfwidth",
  30751. 0xff92,
  30752. "mem",
  30753. 0x05de,
  30754. "memdagesh",
  30755. 0xfb3e,
  30756. "memdageshhebrew",
  30757. 0xfb3e,
  30758. "memhebrew",
  30759. 0x05de,
  30760. "menarmenian",
  30761. 0x0574,
  30762. "merkhahebrew",
  30763. 0x05a5,
  30764. "merkhakefulahebrew",
  30765. 0x05a6,
  30766. "merkhakefulalefthebrew",
  30767. 0x05a6,
  30768. "merkhalefthebrew",
  30769. 0x05a5,
  30770. "mhook",
  30771. 0x0271,
  30772. "mhzsquare",
  30773. 0x3392,
  30774. "middledotkatakanahalfwidth",
  30775. 0xff65,
  30776. "middot",
  30777. 0x00b7,
  30778. "mieumacirclekorean",
  30779. 0x3272,
  30780. "mieumaparenkorean",
  30781. 0x3212,
  30782. "mieumcirclekorean",
  30783. 0x3264,
  30784. "mieumkorean",
  30785. 0x3141,
  30786. "mieumpansioskorean",
  30787. 0x3170,
  30788. "mieumparenkorean",
  30789. 0x3204,
  30790. "mieumpieupkorean",
  30791. 0x316e,
  30792. "mieumsioskorean",
  30793. 0x316f,
  30794. "mihiragana",
  30795. 0x307f,
  30796. "mikatakana",
  30797. 0x30df,
  30798. "mikatakanahalfwidth",
  30799. 0xff90,
  30800. "minus",
  30801. 0x2212,
  30802. "minusbelowcmb",
  30803. 0x0320,
  30804. "minuscircle",
  30805. 0x2296,
  30806. "minusmod",
  30807. 0x02d7,
  30808. "minusplus",
  30809. 0x2213,
  30810. "minute",
  30811. 0x2032,
  30812. "miribaarusquare",
  30813. 0x334a,
  30814. "mirisquare",
  30815. 0x3349,
  30816. "mlonglegturned",
  30817. 0x0270,
  30818. "mlsquare",
  30819. 0x3396,
  30820. "mmcubedsquare",
  30821. 0x33a3,
  30822. "mmonospace",
  30823. 0xff4d,
  30824. "mmsquaredsquare",
  30825. 0x339f,
  30826. "mohiragana",
  30827. 0x3082,
  30828. "mohmsquare",
  30829. 0x33c1,
  30830. "mokatakana",
  30831. 0x30e2,
  30832. "mokatakanahalfwidth",
  30833. 0xff93,
  30834. "molsquare",
  30835. 0x33d6,
  30836. "momathai",
  30837. 0x0e21,
  30838. "moverssquare",
  30839. 0x33a7,
  30840. "moverssquaredsquare",
  30841. 0x33a8,
  30842. "mparen",
  30843. 0x24a8,
  30844. "mpasquare",
  30845. 0x33ab,
  30846. "mssquare",
  30847. 0x33b3,
  30848. "msuperior",
  30849. 0xf6ef,
  30850. "mturned",
  30851. 0x026f,
  30852. "mu",
  30853. 0x00b5,
  30854. "mu1",
  30855. 0x00b5,
  30856. "muasquare",
  30857. 0x3382,
  30858. "muchgreater",
  30859. 0x226b,
  30860. "muchless",
  30861. 0x226a,
  30862. "mufsquare",
  30863. 0x338c,
  30864. "mugreek",
  30865. 0x03bc,
  30866. "mugsquare",
  30867. 0x338d,
  30868. "muhiragana",
  30869. 0x3080,
  30870. "mukatakana",
  30871. 0x30e0,
  30872. "mukatakanahalfwidth",
  30873. 0xff91,
  30874. "mulsquare",
  30875. 0x3395,
  30876. "multiply",
  30877. 0x00d7,
  30878. "mumsquare",
  30879. 0x339b,
  30880. "munahhebrew",
  30881. 0x05a3,
  30882. "munahlefthebrew",
  30883. 0x05a3,
  30884. "musicalnote",
  30885. 0x266a,
  30886. "musicalnotedbl",
  30887. 0x266b,
  30888. "musicflatsign",
  30889. 0x266d,
  30890. "musicsharpsign",
  30891. 0x266f,
  30892. "mussquare",
  30893. 0x33b2,
  30894. "muvsquare",
  30895. 0x33b6,
  30896. "muwsquare",
  30897. 0x33bc,
  30898. "mvmegasquare",
  30899. 0x33b9,
  30900. "mvsquare",
  30901. 0x33b7,
  30902. "mwmegasquare",
  30903. 0x33bf,
  30904. "mwsquare",
  30905. 0x33bd,
  30906. "n",
  30907. 0x006e,
  30908. "nabengali",
  30909. 0x09a8,
  30910. "nabla",
  30911. 0x2207,
  30912. "nacute",
  30913. 0x0144,
  30914. "nadeva",
  30915. 0x0928,
  30916. "nagujarati",
  30917. 0x0aa8,
  30918. "nagurmukhi",
  30919. 0x0a28,
  30920. "nahiragana",
  30921. 0x306a,
  30922. "nakatakana",
  30923. 0x30ca,
  30924. "nakatakanahalfwidth",
  30925. 0xff85,
  30926. "napostrophe",
  30927. 0x0149,
  30928. "nasquare",
  30929. 0x3381,
  30930. "nbopomofo",
  30931. 0x310b,
  30932. "nbspace",
  30933. 0x00a0,
  30934. "ncaron",
  30935. 0x0148,
  30936. "ncedilla",
  30937. 0x0146,
  30938. "ncircle",
  30939. 0x24dd,
  30940. "ncircumflexbelow",
  30941. 0x1e4b,
  30942. "ncommaaccent",
  30943. 0x0146,
  30944. "ndotaccent",
  30945. 0x1e45,
  30946. "ndotbelow",
  30947. 0x1e47,
  30948. "nehiragana",
  30949. 0x306d,
  30950. "nekatakana",
  30951. 0x30cd,
  30952. "nekatakanahalfwidth",
  30953. 0xff88,
  30954. "newsheqelsign",
  30955. 0x20aa,
  30956. "nfsquare",
  30957. 0x338b,
  30958. "ngabengali",
  30959. 0x0999,
  30960. "ngadeva",
  30961. 0x0919,
  30962. "ngagujarati",
  30963. 0x0a99,
  30964. "ngagurmukhi",
  30965. 0x0a19,
  30966. "ngonguthai",
  30967. 0x0e07,
  30968. "nhiragana",
  30969. 0x3093,
  30970. "nhookleft",
  30971. 0x0272,
  30972. "nhookretroflex",
  30973. 0x0273,
  30974. "nieunacirclekorean",
  30975. 0x326f,
  30976. "nieunaparenkorean",
  30977. 0x320f,
  30978. "nieuncieuckorean",
  30979. 0x3135,
  30980. "nieuncirclekorean",
  30981. 0x3261,
  30982. "nieunhieuhkorean",
  30983. 0x3136,
  30984. "nieunkorean",
  30985. 0x3134,
  30986. "nieunpansioskorean",
  30987. 0x3168,
  30988. "nieunparenkorean",
  30989. 0x3201,
  30990. "nieunsioskorean",
  30991. 0x3167,
  30992. "nieuntikeutkorean",
  30993. 0x3166,
  30994. "nihiragana",
  30995. 0x306b,
  30996. "nikatakana",
  30997. 0x30cb,
  30998. "nikatakanahalfwidth",
  30999. 0xff86,
  31000. "nikhahitleftthai",
  31001. 0xf899,
  31002. "nikhahitthai",
  31003. 0x0e4d,
  31004. "nine",
  31005. 0x0039,
  31006. "ninearabic",
  31007. 0x0669,
  31008. "ninebengali",
  31009. 0x09ef,
  31010. "ninecircle",
  31011. 0x2468,
  31012. "ninecircleinversesansserif",
  31013. 0x2792,
  31014. "ninedeva",
  31015. 0x096f,
  31016. "ninegujarati",
  31017. 0x0aef,
  31018. "ninegurmukhi",
  31019. 0x0a6f,
  31020. "ninehackarabic",
  31021. 0x0669,
  31022. "ninehangzhou",
  31023. 0x3029,
  31024. "nineideographicparen",
  31025. 0x3228,
  31026. "nineinferior",
  31027. 0x2089,
  31028. "ninemonospace",
  31029. 0xff19,
  31030. "nineoldstyle",
  31031. 0xf739,
  31032. "nineparen",
  31033. 0x247c,
  31034. "nineperiod",
  31035. 0x2490,
  31036. "ninepersian",
  31037. 0x06f9,
  31038. "nineroman",
  31039. 0x2178,
  31040. "ninesuperior",
  31041. 0x2079,
  31042. "nineteencircle",
  31043. 0x2472,
  31044. "nineteenparen",
  31045. 0x2486,
  31046. "nineteenperiod",
  31047. 0x249a,
  31048. "ninethai",
  31049. 0x0e59,
  31050. "nj",
  31051. 0x01cc,
  31052. "njecyrillic",
  31053. 0x045a,
  31054. "nkatakana",
  31055. 0x30f3,
  31056. "nkatakanahalfwidth",
  31057. 0xff9d,
  31058. "nlegrightlong",
  31059. 0x019e,
  31060. "nlinebelow",
  31061. 0x1e49,
  31062. "nmonospace",
  31063. 0xff4e,
  31064. "nmsquare",
  31065. 0x339a,
  31066. "nnabengali",
  31067. 0x09a3,
  31068. "nnadeva",
  31069. 0x0923,
  31070. "nnagujarati",
  31071. 0x0aa3,
  31072. "nnagurmukhi",
  31073. 0x0a23,
  31074. "nnnadeva",
  31075. 0x0929,
  31076. "nohiragana",
  31077. 0x306e,
  31078. "nokatakana",
  31079. 0x30ce,
  31080. "nokatakanahalfwidth",
  31081. 0xff89,
  31082. "nonbreakingspace",
  31083. 0x00a0,
  31084. "nonenthai",
  31085. 0x0e13,
  31086. "nonuthai",
  31087. 0x0e19,
  31088. "noonarabic",
  31089. 0x0646,
  31090. "noonfinalarabic",
  31091. 0xfee6,
  31092. "noonghunnaarabic",
  31093. 0x06ba,
  31094. "noonghunnafinalarabic",
  31095. 0xfb9f,
  31096. "nooninitialarabic",
  31097. 0xfee7,
  31098. "noonjeeminitialarabic",
  31099. 0xfcd2,
  31100. "noonjeemisolatedarabic",
  31101. 0xfc4b,
  31102. "noonmedialarabic",
  31103. 0xfee8,
  31104. "noonmeeminitialarabic",
  31105. 0xfcd5,
  31106. "noonmeemisolatedarabic",
  31107. 0xfc4e,
  31108. "noonnoonfinalarabic",
  31109. 0xfc8d,
  31110. "notcontains",
  31111. 0x220c,
  31112. "notelement",
  31113. 0x2209,
  31114. "notelementof",
  31115. 0x2209,
  31116. "notequal",
  31117. 0x2260,
  31118. "notgreater",
  31119. 0x226f,
  31120. "notgreaternorequal",
  31121. 0x2271,
  31122. "notgreaternorless",
  31123. 0x2279,
  31124. "notidentical",
  31125. 0x2262,
  31126. "notless",
  31127. 0x226e,
  31128. "notlessnorequal",
  31129. 0x2270,
  31130. "notparallel",
  31131. 0x2226,
  31132. "notprecedes",
  31133. 0x2280,
  31134. "notsubset",
  31135. 0x2284,
  31136. "notsucceeds",
  31137. 0x2281,
  31138. "notsuperset",
  31139. 0x2285,
  31140. "nowarmenian",
  31141. 0x0576,
  31142. "nparen",
  31143. 0x24a9,
  31144. "nssquare",
  31145. 0x33b1,
  31146. "nsuperior",
  31147. 0x207f,
  31148. "ntilde",
  31149. 0x00f1,
  31150. "nu",
  31151. 0x03bd,
  31152. "nuhiragana",
  31153. 0x306c,
  31154. "nukatakana",
  31155. 0x30cc,
  31156. "nukatakanahalfwidth",
  31157. 0xff87,
  31158. "nuktabengali",
  31159. 0x09bc,
  31160. "nuktadeva",
  31161. 0x093c,
  31162. "nuktagujarati",
  31163. 0x0abc,
  31164. "nuktagurmukhi",
  31165. 0x0a3c,
  31166. "numbersign",
  31167. 0x0023,
  31168. "numbersignmonospace",
  31169. 0xff03,
  31170. "numbersignsmall",
  31171. 0xfe5f,
  31172. "numeralsigngreek",
  31173. 0x0374,
  31174. "numeralsignlowergreek",
  31175. 0x0375,
  31176. "numero",
  31177. 0x2116,
  31178. "nun",
  31179. 0x05e0,
  31180. "nundagesh",
  31181. 0xfb40,
  31182. "nundageshhebrew",
  31183. 0xfb40,
  31184. "nunhebrew",
  31185. 0x05e0,
  31186. "nvsquare",
  31187. 0x33b5,
  31188. "nwsquare",
  31189. 0x33bb,
  31190. "nyabengali",
  31191. 0x099e,
  31192. "nyadeva",
  31193. 0x091e,
  31194. "nyagujarati",
  31195. 0x0a9e,
  31196. "nyagurmukhi",
  31197. 0x0a1e,
  31198. "o",
  31199. 0x006f,
  31200. "oacute",
  31201. 0x00f3,
  31202. "oangthai",
  31203. 0x0e2d,
  31204. "obarred",
  31205. 0x0275,
  31206. "obarredcyrillic",
  31207. 0x04e9,
  31208. "obarreddieresiscyrillic",
  31209. 0x04eb,
  31210. "obengali",
  31211. 0x0993,
  31212. "obopomofo",
  31213. 0x311b,
  31214. "obreve",
  31215. 0x014f,
  31216. "ocandradeva",
  31217. 0x0911,
  31218. "ocandragujarati",
  31219. 0x0a91,
  31220. "ocandravowelsigndeva",
  31221. 0x0949,
  31222. "ocandravowelsigngujarati",
  31223. 0x0ac9,
  31224. "ocaron",
  31225. 0x01d2,
  31226. "ocircle",
  31227. 0x24de,
  31228. "ocircumflex",
  31229. 0x00f4,
  31230. "ocircumflexacute",
  31231. 0x1ed1,
  31232. "ocircumflexdotbelow",
  31233. 0x1ed9,
  31234. "ocircumflexgrave",
  31235. 0x1ed3,
  31236. "ocircumflexhookabove",
  31237. 0x1ed5,
  31238. "ocircumflextilde",
  31239. 0x1ed7,
  31240. "ocyrillic",
  31241. 0x043e,
  31242. "odblacute",
  31243. 0x0151,
  31244. "odblgrave",
  31245. 0x020d,
  31246. "odeva",
  31247. 0x0913,
  31248. "odieresis",
  31249. 0x00f6,
  31250. "odieresiscyrillic",
  31251. 0x04e7,
  31252. "odotbelow",
  31253. 0x1ecd,
  31254. "oe",
  31255. 0x0153,
  31256. "oekorean",
  31257. 0x315a,
  31258. "ogonek",
  31259. 0x02db,
  31260. "ogonekcmb",
  31261. 0x0328,
  31262. "ograve",
  31263. 0x00f2,
  31264. "ogujarati",
  31265. 0x0a93,
  31266. "oharmenian",
  31267. 0x0585,
  31268. "ohiragana",
  31269. 0x304a,
  31270. "ohookabove",
  31271. 0x1ecf,
  31272. "ohorn",
  31273. 0x01a1,
  31274. "ohornacute",
  31275. 0x1edb,
  31276. "ohorndotbelow",
  31277. 0x1ee3,
  31278. "ohorngrave",
  31279. 0x1edd,
  31280. "ohornhookabove",
  31281. 0x1edf,
  31282. "ohorntilde",
  31283. 0x1ee1,
  31284. "ohungarumlaut",
  31285. 0x0151,
  31286. "oi",
  31287. 0x01a3,
  31288. "oinvertedbreve",
  31289. 0x020f,
  31290. "okatakana",
  31291. 0x30aa,
  31292. "okatakanahalfwidth",
  31293. 0xff75,
  31294. "okorean",
  31295. 0x3157,
  31296. "olehebrew",
  31297. 0x05ab,
  31298. "omacron",
  31299. 0x014d,
  31300. "omacronacute",
  31301. 0x1e53,
  31302. "omacrongrave",
  31303. 0x1e51,
  31304. "omdeva",
  31305. 0x0950,
  31306. "omega",
  31307. 0x03c9,
  31308. "omega1",
  31309. 0x03d6,
  31310. "omegacyrillic",
  31311. 0x0461,
  31312. "omegalatinclosed",
  31313. 0x0277,
  31314. "omegaroundcyrillic",
  31315. 0x047b,
  31316. "omegatitlocyrillic",
  31317. 0x047d,
  31318. "omegatonos",
  31319. 0x03ce,
  31320. "omgujarati",
  31321. 0x0ad0,
  31322. "omicron",
  31323. 0x03bf,
  31324. "omicrontonos",
  31325. 0x03cc,
  31326. "omonospace",
  31327. 0xff4f,
  31328. "one",
  31329. 0x0031,
  31330. "onearabic",
  31331. 0x0661,
  31332. "onebengali",
  31333. 0x09e7,
  31334. "onecircle",
  31335. 0x2460,
  31336. "onecircleinversesansserif",
  31337. 0x278a,
  31338. "onedeva",
  31339. 0x0967,
  31340. "onedotenleader",
  31341. 0x2024,
  31342. "oneeighth",
  31343. 0x215b,
  31344. "onefitted",
  31345. 0xf6dc,
  31346. "onegujarati",
  31347. 0x0ae7,
  31348. "onegurmukhi",
  31349. 0x0a67,
  31350. "onehackarabic",
  31351. 0x0661,
  31352. "onehalf",
  31353. 0x00bd,
  31354. "onehangzhou",
  31355. 0x3021,
  31356. "oneideographicparen",
  31357. 0x3220,
  31358. "oneinferior",
  31359. 0x2081,
  31360. "onemonospace",
  31361. 0xff11,
  31362. "onenumeratorbengali",
  31363. 0x09f4,
  31364. "oneoldstyle",
  31365. 0xf731,
  31366. "oneparen",
  31367. 0x2474,
  31368. "oneperiod",
  31369. 0x2488,
  31370. "onepersian",
  31371. 0x06f1,
  31372. "onequarter",
  31373. 0x00bc,
  31374. "oneroman",
  31375. 0x2170,
  31376. "onesuperior",
  31377. 0x00b9,
  31378. "onethai",
  31379. 0x0e51,
  31380. "onethird",
  31381. 0x2153,
  31382. "oogonek",
  31383. 0x01eb,
  31384. "oogonekmacron",
  31385. 0x01ed,
  31386. "oogurmukhi",
  31387. 0x0a13,
  31388. "oomatragurmukhi",
  31389. 0x0a4b,
  31390. "oopen",
  31391. 0x0254,
  31392. "oparen",
  31393. 0x24aa,
  31394. "openbullet",
  31395. 0x25e6,
  31396. "option",
  31397. 0x2325,
  31398. "ordfeminine",
  31399. 0x00aa,
  31400. "ordmasculine",
  31401. 0x00ba,
  31402. "orthogonal",
  31403. 0x221f,
  31404. "oshortdeva",
  31405. 0x0912,
  31406. "oshortvowelsigndeva",
  31407. 0x094a,
  31408. "oslash",
  31409. 0x00f8,
  31410. "oslashacute",
  31411. 0x01ff,
  31412. "osmallhiragana",
  31413. 0x3049,
  31414. "osmallkatakana",
  31415. 0x30a9,
  31416. "osmallkatakanahalfwidth",
  31417. 0xff6b,
  31418. "ostrokeacute",
  31419. 0x01ff,
  31420. "osuperior",
  31421. 0xf6f0,
  31422. "otcyrillic",
  31423. 0x047f,
  31424. "otilde",
  31425. 0x00f5,
  31426. "otildeacute",
  31427. 0x1e4d,
  31428. "otildedieresis",
  31429. 0x1e4f,
  31430. "oubopomofo",
  31431. 0x3121,
  31432. "overline",
  31433. 0x203e,
  31434. "overlinecenterline",
  31435. 0xfe4a,
  31436. "overlinecmb",
  31437. 0x0305,
  31438. "overlinedashed",
  31439. 0xfe49,
  31440. "overlinedblwavy",
  31441. 0xfe4c,
  31442. "overlinewavy",
  31443. 0xfe4b,
  31444. "overscore",
  31445. 0x00af,
  31446. "ovowelsignbengali",
  31447. 0x09cb,
  31448. "ovowelsigndeva",
  31449. 0x094b,
  31450. "ovowelsigngujarati",
  31451. 0x0acb,
  31452. "p",
  31453. 0x0070,
  31454. "paampssquare",
  31455. 0x3380,
  31456. "paasentosquare",
  31457. 0x332b,
  31458. "pabengali",
  31459. 0x09aa,
  31460. "pacute",
  31461. 0x1e55,
  31462. "padeva",
  31463. 0x092a,
  31464. "pagedown",
  31465. 0x21df,
  31466. "pageup",
  31467. 0x21de,
  31468. "pagujarati",
  31469. 0x0aaa,
  31470. "pagurmukhi",
  31471. 0x0a2a,
  31472. "pahiragana",
  31473. 0x3071,
  31474. "paiyannoithai",
  31475. 0x0e2f,
  31476. "pakatakana",
  31477. 0x30d1,
  31478. "palatalizationcyrilliccmb",
  31479. 0x0484,
  31480. "palochkacyrillic",
  31481. 0x04c0,
  31482. "pansioskorean",
  31483. 0x317f,
  31484. "paragraph",
  31485. 0x00b6,
  31486. "parallel",
  31487. 0x2225,
  31488. "parenleft",
  31489. 0x0028,
  31490. "parenleftaltonearabic",
  31491. 0xfd3e,
  31492. "parenleftbt",
  31493. 0xf8ed,
  31494. "parenleftex",
  31495. 0xf8ec,
  31496. "parenleftinferior",
  31497. 0x208d,
  31498. "parenleftmonospace",
  31499. 0xff08,
  31500. "parenleftsmall",
  31501. 0xfe59,
  31502. "parenleftsuperior",
  31503. 0x207d,
  31504. "parenlefttp",
  31505. 0xf8eb,
  31506. "parenleftvertical",
  31507. 0xfe35,
  31508. "parenright",
  31509. 0x0029,
  31510. "parenrightaltonearabic",
  31511. 0xfd3f,
  31512. "parenrightbt",
  31513. 0xf8f8,
  31514. "parenrightex",
  31515. 0xf8f7,
  31516. "parenrightinferior",
  31517. 0x208e,
  31518. "parenrightmonospace",
  31519. 0xff09,
  31520. "parenrightsmall",
  31521. 0xfe5a,
  31522. "parenrightsuperior",
  31523. 0x207e,
  31524. "parenrighttp",
  31525. 0xf8f6,
  31526. "parenrightvertical",
  31527. 0xfe36,
  31528. "partialdiff",
  31529. 0x2202,
  31530. "paseqhebrew",
  31531. 0x05c0,
  31532. "pashtahebrew",
  31533. 0x0599,
  31534. "pasquare",
  31535. 0x33a9,
  31536. "patah",
  31537. 0x05b7,
  31538. "patah11",
  31539. 0x05b7,
  31540. "patah1d",
  31541. 0x05b7,
  31542. "patah2a",
  31543. 0x05b7,
  31544. "patahhebrew",
  31545. 0x05b7,
  31546. "patahnarrowhebrew",
  31547. 0x05b7,
  31548. "patahquarterhebrew",
  31549. 0x05b7,
  31550. "patahwidehebrew",
  31551. 0x05b7,
  31552. "pazerhebrew",
  31553. 0x05a1,
  31554. "pbopomofo",
  31555. 0x3106,
  31556. "pcircle",
  31557. 0x24df,
  31558. "pdotaccent",
  31559. 0x1e57,
  31560. "pe",
  31561. 0x05e4,
  31562. "pecyrillic",
  31563. 0x043f,
  31564. "pedagesh",
  31565. 0xfb44,
  31566. "pedageshhebrew",
  31567. 0xfb44,
  31568. "peezisquare",
  31569. 0x333b,
  31570. "pefinaldageshhebrew",
  31571. 0xfb43,
  31572. "peharabic",
  31573. 0x067e,
  31574. "peharmenian",
  31575. 0x057a,
  31576. "pehebrew",
  31577. 0x05e4,
  31578. "pehfinalarabic",
  31579. 0xfb57,
  31580. "pehinitialarabic",
  31581. 0xfb58,
  31582. "pehiragana",
  31583. 0x307a,
  31584. "pehmedialarabic",
  31585. 0xfb59,
  31586. "pekatakana",
  31587. 0x30da,
  31588. "pemiddlehookcyrillic",
  31589. 0x04a7,
  31590. "perafehebrew",
  31591. 0xfb4e,
  31592. "percent",
  31593. 0x0025,
  31594. "percentarabic",
  31595. 0x066a,
  31596. "percentmonospace",
  31597. 0xff05,
  31598. "percentsmall",
  31599. 0xfe6a,
  31600. "period",
  31601. 0x002e,
  31602. "periodarmenian",
  31603. 0x0589,
  31604. "periodcentered",
  31605. 0x00b7,
  31606. "periodhalfwidth",
  31607. 0xff61,
  31608. "periodinferior",
  31609. 0xf6e7,
  31610. "periodmonospace",
  31611. 0xff0e,
  31612. "periodsmall",
  31613. 0xfe52,
  31614. "periodsuperior",
  31615. 0xf6e8,
  31616. "perispomenigreekcmb",
  31617. 0x0342,
  31618. "perpendicular",
  31619. 0x22a5,
  31620. "perthousand",
  31621. 0x2030,
  31622. "peseta",
  31623. 0x20a7,
  31624. "pfsquare",
  31625. 0x338a,
  31626. "phabengali",
  31627. 0x09ab,
  31628. "phadeva",
  31629. 0x092b,
  31630. "phagujarati",
  31631. 0x0aab,
  31632. "phagurmukhi",
  31633. 0x0a2b,
  31634. "phi",
  31635. 0x03c6,
  31636. "phi1",
  31637. 0x03d5,
  31638. "phieuphacirclekorean",
  31639. 0x327a,
  31640. "phieuphaparenkorean",
  31641. 0x321a,
  31642. "phieuphcirclekorean",
  31643. 0x326c,
  31644. "phieuphkorean",
  31645. 0x314d,
  31646. "phieuphparenkorean",
  31647. 0x320c,
  31648. "philatin",
  31649. 0x0278,
  31650. "phinthuthai",
  31651. 0x0e3a,
  31652. "phisymbolgreek",
  31653. 0x03d5,
  31654. "phook",
  31655. 0x01a5,
  31656. "phophanthai",
  31657. 0x0e1e,
  31658. "phophungthai",
  31659. 0x0e1c,
  31660. "phosamphaothai",
  31661. 0x0e20,
  31662. "pi",
  31663. 0x03c0,
  31664. "pieupacirclekorean",
  31665. 0x3273,
  31666. "pieupaparenkorean",
  31667. 0x3213,
  31668. "pieupcieuckorean",
  31669. 0x3176,
  31670. "pieupcirclekorean",
  31671. 0x3265,
  31672. "pieupkiyeokkorean",
  31673. 0x3172,
  31674. "pieupkorean",
  31675. 0x3142,
  31676. "pieupparenkorean",
  31677. 0x3205,
  31678. "pieupsioskiyeokkorean",
  31679. 0x3174,
  31680. "pieupsioskorean",
  31681. 0x3144,
  31682. "pieupsiostikeutkorean",
  31683. 0x3175,
  31684. "pieupthieuthkorean",
  31685. 0x3177,
  31686. "pieuptikeutkorean",
  31687. 0x3173,
  31688. "pihiragana",
  31689. 0x3074,
  31690. "pikatakana",
  31691. 0x30d4,
  31692. "pisymbolgreek",
  31693. 0x03d6,
  31694. "piwrarmenian",
  31695. 0x0583,
  31696. "plus",
  31697. 0x002b,
  31698. "plusbelowcmb",
  31699. 0x031f,
  31700. "pluscircle",
  31701. 0x2295,
  31702. "plusminus",
  31703. 0x00b1,
  31704. "plusmod",
  31705. 0x02d6,
  31706. "plusmonospace",
  31707. 0xff0b,
  31708. "plussmall",
  31709. 0xfe62,
  31710. "plussuperior",
  31711. 0x207a,
  31712. "pmonospace",
  31713. 0xff50,
  31714. "pmsquare",
  31715. 0x33d8,
  31716. "pohiragana",
  31717. 0x307d,
  31718. "pointingindexdownwhite",
  31719. 0x261f,
  31720. "pointingindexleftwhite",
  31721. 0x261c,
  31722. "pointingindexrightwhite",
  31723. 0x261e,
  31724. "pointingindexupwhite",
  31725. 0x261d,
  31726. "pokatakana",
  31727. 0x30dd,
  31728. "poplathai",
  31729. 0x0e1b,
  31730. "postalmark",
  31731. 0x3012,
  31732. "postalmarkface",
  31733. 0x3020,
  31734. "pparen",
  31735. 0x24ab,
  31736. "precedes",
  31737. 0x227a,
  31738. "prescription",
  31739. 0x211e,
  31740. "primemod",
  31741. 0x02b9,
  31742. "primereversed",
  31743. 0x2035,
  31744. "product",
  31745. 0x220f,
  31746. "projective",
  31747. 0x2305,
  31748. "prolongedkana",
  31749. 0x30fc,
  31750. "propellor",
  31751. 0x2318,
  31752. "propersubset",
  31753. 0x2282,
  31754. "propersuperset",
  31755. 0x2283,
  31756. "proportion",
  31757. 0x2237,
  31758. "proportional",
  31759. 0x221d,
  31760. "psi",
  31761. 0x03c8,
  31762. "psicyrillic",
  31763. 0x0471,
  31764. "psilipneumatacyrilliccmb",
  31765. 0x0486,
  31766. "pssquare",
  31767. 0x33b0,
  31768. "puhiragana",
  31769. 0x3077,
  31770. "pukatakana",
  31771. 0x30d7,
  31772. "pvsquare",
  31773. 0x33b4,
  31774. "pwsquare",
  31775. 0x33ba,
  31776. "q",
  31777. 0x0071,
  31778. "qadeva",
  31779. 0x0958,
  31780. "qadmahebrew",
  31781. 0x05a8,
  31782. "qafarabic",
  31783. 0x0642,
  31784. "qaffinalarabic",
  31785. 0xfed6,
  31786. "qafinitialarabic",
  31787. 0xfed7,
  31788. "qafmedialarabic",
  31789. 0xfed8,
  31790. "qamats",
  31791. 0x05b8,
  31792. "qamats10",
  31793. 0x05b8,
  31794. "qamats1a",
  31795. 0x05b8,
  31796. "qamats1c",
  31797. 0x05b8,
  31798. "qamats27",
  31799. 0x05b8,
  31800. "qamats29",
  31801. 0x05b8,
  31802. "qamats33",
  31803. 0x05b8,
  31804. "qamatsde",
  31805. 0x05b8,
  31806. "qamatshebrew",
  31807. 0x05b8,
  31808. "qamatsnarrowhebrew",
  31809. 0x05b8,
  31810. "qamatsqatanhebrew",
  31811. 0x05b8,
  31812. "qamatsqatannarrowhebrew",
  31813. 0x05b8,
  31814. "qamatsqatanquarterhebrew",
  31815. 0x05b8,
  31816. "qamatsqatanwidehebrew",
  31817. 0x05b8,
  31818. "qamatsquarterhebrew",
  31819. 0x05b8,
  31820. "qamatswidehebrew",
  31821. 0x05b8,
  31822. "qarneyparahebrew",
  31823. 0x059f,
  31824. "qbopomofo",
  31825. 0x3111,
  31826. "qcircle",
  31827. 0x24e0,
  31828. "qhook",
  31829. 0x02a0,
  31830. "qmonospace",
  31831. 0xff51,
  31832. "qof",
  31833. 0x05e7,
  31834. "qofdagesh",
  31835. 0xfb47,
  31836. "qofdageshhebrew",
  31837. 0xfb47,
  31838. "qofhebrew",
  31839. 0x05e7,
  31840. "qparen",
  31841. 0x24ac,
  31842. "quarternote",
  31843. 0x2669,
  31844. "qubuts",
  31845. 0x05bb,
  31846. "qubuts18",
  31847. 0x05bb,
  31848. "qubuts25",
  31849. 0x05bb,
  31850. "qubuts31",
  31851. 0x05bb,
  31852. "qubutshebrew",
  31853. 0x05bb,
  31854. "qubutsnarrowhebrew",
  31855. 0x05bb,
  31856. "qubutsquarterhebrew",
  31857. 0x05bb,
  31858. "qubutswidehebrew",
  31859. 0x05bb,
  31860. "question",
  31861. 0x003f,
  31862. "questionarabic",
  31863. 0x061f,
  31864. "questionarmenian",
  31865. 0x055e,
  31866. "questiondown",
  31867. 0x00bf,
  31868. "questiondownsmall",
  31869. 0xf7bf,
  31870. "questiongreek",
  31871. 0x037e,
  31872. "questionmonospace",
  31873. 0xff1f,
  31874. "questionsmall",
  31875. 0xf73f,
  31876. "quotedbl",
  31877. 0x0022,
  31878. "quotedblbase",
  31879. 0x201e,
  31880. "quotedblleft",
  31881. 0x201c,
  31882. "quotedblmonospace",
  31883. 0xff02,
  31884. "quotedblprime",
  31885. 0x301e,
  31886. "quotedblprimereversed",
  31887. 0x301d,
  31888. "quotedblright",
  31889. 0x201d,
  31890. "quoteleft",
  31891. 0x2018,
  31892. "quoteleftreversed",
  31893. 0x201b,
  31894. "quotereversed",
  31895. 0x201b,
  31896. "quoteright",
  31897. 0x2019,
  31898. "quoterightn",
  31899. 0x0149,
  31900. "quotesinglbase",
  31901. 0x201a,
  31902. "quotesingle",
  31903. 0x0027,
  31904. "quotesinglemonospace",
  31905. 0xff07,
  31906. "r",
  31907. 0x0072,
  31908. "raarmenian",
  31909. 0x057c,
  31910. "rabengali",
  31911. 0x09b0,
  31912. "racute",
  31913. 0x0155,
  31914. "radeva",
  31915. 0x0930,
  31916. "radical",
  31917. 0x221a,
  31918. "radicalex",
  31919. 0xf8e5,
  31920. "radoverssquare",
  31921. 0x33ae,
  31922. "radoverssquaredsquare",
  31923. 0x33af,
  31924. "radsquare",
  31925. 0x33ad,
  31926. "rafe",
  31927. 0x05bf,
  31928. "rafehebrew",
  31929. 0x05bf,
  31930. "ragujarati",
  31931. 0x0ab0,
  31932. "ragurmukhi",
  31933. 0x0a30,
  31934. "rahiragana",
  31935. 0x3089,
  31936. "rakatakana",
  31937. 0x30e9,
  31938. "rakatakanahalfwidth",
  31939. 0xff97,
  31940. "ralowerdiagonalbengali",
  31941. 0x09f1,
  31942. "ramiddlediagonalbengali",
  31943. 0x09f0,
  31944. "ramshorn",
  31945. 0x0264,
  31946. "ratio",
  31947. 0x2236,
  31948. "rbopomofo",
  31949. 0x3116,
  31950. "rcaron",
  31951. 0x0159,
  31952. "rcedilla",
  31953. 0x0157,
  31954. "rcircle",
  31955. 0x24e1,
  31956. "rcommaaccent",
  31957. 0x0157,
  31958. "rdblgrave",
  31959. 0x0211,
  31960. "rdotaccent",
  31961. 0x1e59,
  31962. "rdotbelow",
  31963. 0x1e5b,
  31964. "rdotbelowmacron",
  31965. 0x1e5d,
  31966. "referencemark",
  31967. 0x203b,
  31968. "reflexsubset",
  31969. 0x2286,
  31970. "reflexsuperset",
  31971. 0x2287,
  31972. "registered",
  31973. 0x00ae,
  31974. "registersans",
  31975. 0xf8e8,
  31976. "registerserif",
  31977. 0xf6da,
  31978. "reharabic",
  31979. 0x0631,
  31980. "reharmenian",
  31981. 0x0580,
  31982. "rehfinalarabic",
  31983. 0xfeae,
  31984. "rehiragana",
  31985. 0x308c,
  31986. "rekatakana",
  31987. 0x30ec,
  31988. "rekatakanahalfwidth",
  31989. 0xff9a,
  31990. "resh",
  31991. 0x05e8,
  31992. "reshdageshhebrew",
  31993. 0xfb48,
  31994. "reshhebrew",
  31995. 0x05e8,
  31996. "reversedtilde",
  31997. 0x223d,
  31998. "reviahebrew",
  31999. 0x0597,
  32000. "reviamugrashhebrew",
  32001. 0x0597,
  32002. "revlogicalnot",
  32003. 0x2310,
  32004. "rfishhook",
  32005. 0x027e,
  32006. "rfishhookreversed",
  32007. 0x027f,
  32008. "rhabengali",
  32009. 0x09dd,
  32010. "rhadeva",
  32011. 0x095d,
  32012. "rho",
  32013. 0x03c1,
  32014. "rhook",
  32015. 0x027d,
  32016. "rhookturned",
  32017. 0x027b,
  32018. "rhookturnedsuperior",
  32019. 0x02b5,
  32020. "rhosymbolgreek",
  32021. 0x03f1,
  32022. "rhotichookmod",
  32023. 0x02de,
  32024. "rieulacirclekorean",
  32025. 0x3271,
  32026. "rieulaparenkorean",
  32027. 0x3211,
  32028. "rieulcirclekorean",
  32029. 0x3263,
  32030. "rieulhieuhkorean",
  32031. 0x3140,
  32032. "rieulkiyeokkorean",
  32033. 0x313a,
  32034. "rieulkiyeoksioskorean",
  32035. 0x3169,
  32036. "rieulkorean",
  32037. 0x3139,
  32038. "rieulmieumkorean",
  32039. 0x313b,
  32040. "rieulpansioskorean",
  32041. 0x316c,
  32042. "rieulparenkorean",
  32043. 0x3203,
  32044. "rieulphieuphkorean",
  32045. 0x313f,
  32046. "rieulpieupkorean",
  32047. 0x313c,
  32048. "rieulpieupsioskorean",
  32049. 0x316b,
  32050. "rieulsioskorean",
  32051. 0x313d,
  32052. "rieulthieuthkorean",
  32053. 0x313e,
  32054. "rieultikeutkorean",
  32055. 0x316a,
  32056. "rieulyeorinhieuhkorean",
  32057. 0x316d,
  32058. "rightangle",
  32059. 0x221f,
  32060. "righttackbelowcmb",
  32061. 0x0319,
  32062. "righttriangle",
  32063. 0x22bf,
  32064. "rihiragana",
  32065. 0x308a,
  32066. "rikatakana",
  32067. 0x30ea,
  32068. "rikatakanahalfwidth",
  32069. 0xff98,
  32070. "ring",
  32071. 0x02da,
  32072. "ringbelowcmb",
  32073. 0x0325,
  32074. "ringcmb",
  32075. 0x030a,
  32076. "ringhalfleft",
  32077. 0x02bf,
  32078. "ringhalfleftarmenian",
  32079. 0x0559,
  32080. "ringhalfleftbelowcmb",
  32081. 0x031c,
  32082. "ringhalfleftcentered",
  32083. 0x02d3,
  32084. "ringhalfright",
  32085. 0x02be,
  32086. "ringhalfrightbelowcmb",
  32087. 0x0339,
  32088. "ringhalfrightcentered",
  32089. 0x02d2,
  32090. "rinvertedbreve",
  32091. 0x0213,
  32092. "rittorusquare",
  32093. 0x3351,
  32094. "rlinebelow",
  32095. 0x1e5f,
  32096. "rlongleg",
  32097. 0x027c,
  32098. "rlonglegturned",
  32099. 0x027a,
  32100. "rmonospace",
  32101. 0xff52,
  32102. "rohiragana",
  32103. 0x308d,
  32104. "rokatakana",
  32105. 0x30ed,
  32106. "rokatakanahalfwidth",
  32107. 0xff9b,
  32108. "roruathai",
  32109. 0x0e23,
  32110. "rparen",
  32111. 0x24ad,
  32112. "rrabengali",
  32113. 0x09dc,
  32114. "rradeva",
  32115. 0x0931,
  32116. "rragurmukhi",
  32117. 0x0a5c,
  32118. "rreharabic",
  32119. 0x0691,
  32120. "rrehfinalarabic",
  32121. 0xfb8d,
  32122. "rrvocalicbengali",
  32123. 0x09e0,
  32124. "rrvocalicdeva",
  32125. 0x0960,
  32126. "rrvocalicgujarati",
  32127. 0x0ae0,
  32128. "rrvocalicvowelsignbengali",
  32129. 0x09c4,
  32130. "rrvocalicvowelsigndeva",
  32131. 0x0944,
  32132. "rrvocalicvowelsigngujarati",
  32133. 0x0ac4,
  32134. "rsuperior",
  32135. 0xf6f1,
  32136. "rtblock",
  32137. 0x2590,
  32138. "rturned",
  32139. 0x0279,
  32140. "rturnedsuperior",
  32141. 0x02b4,
  32142. "ruhiragana",
  32143. 0x308b,
  32144. "rukatakana",
  32145. 0x30eb,
  32146. "rukatakanahalfwidth",
  32147. 0xff99,
  32148. "rupeemarkbengali",
  32149. 0x09f2,
  32150. "rupeesignbengali",
  32151. 0x09f3,
  32152. "rupiah",
  32153. 0xf6dd,
  32154. "ruthai",
  32155. 0x0e24,
  32156. "rvocalicbengali",
  32157. 0x098b,
  32158. "rvocalicdeva",
  32159. 0x090b,
  32160. "rvocalicgujarati",
  32161. 0x0a8b,
  32162. "rvocalicvowelsignbengali",
  32163. 0x09c3,
  32164. "rvocalicvowelsigndeva",
  32165. 0x0943,
  32166. "rvocalicvowelsigngujarati",
  32167. 0x0ac3,
  32168. "s",
  32169. 0x0073,
  32170. "sabengali",
  32171. 0x09b8,
  32172. "sacute",
  32173. 0x015b,
  32174. "sacutedotaccent",
  32175. 0x1e65,
  32176. "sadarabic",
  32177. 0x0635,
  32178. "sadeva",
  32179. 0x0938,
  32180. "sadfinalarabic",
  32181. 0xfeba,
  32182. "sadinitialarabic",
  32183. 0xfebb,
  32184. "sadmedialarabic",
  32185. 0xfebc,
  32186. "sagujarati",
  32187. 0x0ab8,
  32188. "sagurmukhi",
  32189. 0x0a38,
  32190. "sahiragana",
  32191. 0x3055,
  32192. "sakatakana",
  32193. 0x30b5,
  32194. "sakatakanahalfwidth",
  32195. 0xff7b,
  32196. "sallallahoualayhewasallamarabic",
  32197. 0xfdfa,
  32198. "samekh",
  32199. 0x05e1,
  32200. "samekhdagesh",
  32201. 0xfb41,
  32202. "samekhdageshhebrew",
  32203. 0xfb41,
  32204. "samekhhebrew",
  32205. 0x05e1,
  32206. "saraaathai",
  32207. 0x0e32,
  32208. "saraaethai",
  32209. 0x0e41,
  32210. "saraaimaimalaithai",
  32211. 0x0e44,
  32212. "saraaimaimuanthai",
  32213. 0x0e43,
  32214. "saraamthai",
  32215. 0x0e33,
  32216. "saraathai",
  32217. 0x0e30,
  32218. "saraethai",
  32219. 0x0e40,
  32220. "saraiileftthai",
  32221. 0xf886,
  32222. "saraiithai",
  32223. 0x0e35,
  32224. "saraileftthai",
  32225. 0xf885,
  32226. "saraithai",
  32227. 0x0e34,
  32228. "saraothai",
  32229. 0x0e42,
  32230. "saraueeleftthai",
  32231. 0xf888,
  32232. "saraueethai",
  32233. 0x0e37,
  32234. "saraueleftthai",
  32235. 0xf887,
  32236. "sarauethai",
  32237. 0x0e36,
  32238. "sarauthai",
  32239. 0x0e38,
  32240. "sarauuthai",
  32241. 0x0e39,
  32242. "sbopomofo",
  32243. 0x3119,
  32244. "scaron",
  32245. 0x0161,
  32246. "scarondotaccent",
  32247. 0x1e67,
  32248. "scedilla",
  32249. 0x015f,
  32250. "schwa",
  32251. 0x0259,
  32252. "schwacyrillic",
  32253. 0x04d9,
  32254. "schwadieresiscyrillic",
  32255. 0x04db,
  32256. "schwahook",
  32257. 0x025a,
  32258. "scircle",
  32259. 0x24e2,
  32260. "scircumflex",
  32261. 0x015d,
  32262. "scommaaccent",
  32263. 0x0219,
  32264. "sdotaccent",
  32265. 0x1e61,
  32266. "sdotbelow",
  32267. 0x1e63,
  32268. "sdotbelowdotaccent",
  32269. 0x1e69,
  32270. "seagullbelowcmb",
  32271. 0x033c,
  32272. "second",
  32273. 0x2033,
  32274. "secondtonechinese",
  32275. 0x02ca,
  32276. "section",
  32277. 0x00a7,
  32278. "seenarabic",
  32279. 0x0633,
  32280. "seenfinalarabic",
  32281. 0xfeb2,
  32282. "seeninitialarabic",
  32283. 0xfeb3,
  32284. "seenmedialarabic",
  32285. 0xfeb4,
  32286. "segol",
  32287. 0x05b6,
  32288. "segol13",
  32289. 0x05b6,
  32290. "segol1f",
  32291. 0x05b6,
  32292. "segol2c",
  32293. 0x05b6,
  32294. "segolhebrew",
  32295. 0x05b6,
  32296. "segolnarrowhebrew",
  32297. 0x05b6,
  32298. "segolquarterhebrew",
  32299. 0x05b6,
  32300. "segoltahebrew",
  32301. 0x0592,
  32302. "segolwidehebrew",
  32303. 0x05b6,
  32304. "seharmenian",
  32305. 0x057d,
  32306. "sehiragana",
  32307. 0x305b,
  32308. "sekatakana",
  32309. 0x30bb,
  32310. "sekatakanahalfwidth",
  32311. 0xff7e,
  32312. "semicolon",
  32313. 0x003b,
  32314. "semicolonarabic",
  32315. 0x061b,
  32316. "semicolonmonospace",
  32317. 0xff1b,
  32318. "semicolonsmall",
  32319. 0xfe54,
  32320. "semivoicedmarkkana",
  32321. 0x309c,
  32322. "semivoicedmarkkanahalfwidth",
  32323. 0xff9f,
  32324. "sentisquare",
  32325. 0x3322,
  32326. "sentosquare",
  32327. 0x3323,
  32328. "seven",
  32329. 0x0037,
  32330. "sevenarabic",
  32331. 0x0667,
  32332. "sevenbengali",
  32333. 0x09ed,
  32334. "sevencircle",
  32335. 0x2466,
  32336. "sevencircleinversesansserif",
  32337. 0x2790,
  32338. "sevendeva",
  32339. 0x096d,
  32340. "seveneighths",
  32341. 0x215e,
  32342. "sevengujarati",
  32343. 0x0aed,
  32344. "sevengurmukhi",
  32345. 0x0a6d,
  32346. "sevenhackarabic",
  32347. 0x0667,
  32348. "sevenhangzhou",
  32349. 0x3027,
  32350. "sevenideographicparen",
  32351. 0x3226,
  32352. "seveninferior",
  32353. 0x2087,
  32354. "sevenmonospace",
  32355. 0xff17,
  32356. "sevenoldstyle",
  32357. 0xf737,
  32358. "sevenparen",
  32359. 0x247a,
  32360. "sevenperiod",
  32361. 0x248e,
  32362. "sevenpersian",
  32363. 0x06f7,
  32364. "sevenroman",
  32365. 0x2176,
  32366. "sevensuperior",
  32367. 0x2077,
  32368. "seventeencircle",
  32369. 0x2470,
  32370. "seventeenparen",
  32371. 0x2484,
  32372. "seventeenperiod",
  32373. 0x2498,
  32374. "seventhai",
  32375. 0x0e57,
  32376. "sfthyphen",
  32377. 0x00ad,
  32378. "shaarmenian",
  32379. 0x0577,
  32380. "shabengali",
  32381. 0x09b6,
  32382. "shacyrillic",
  32383. 0x0448,
  32384. "shaddaarabic",
  32385. 0x0651,
  32386. "shaddadammaarabic",
  32387. 0xfc61,
  32388. "shaddadammatanarabic",
  32389. 0xfc5e,
  32390. "shaddafathaarabic",
  32391. 0xfc60,
  32392. "shaddakasraarabic",
  32393. 0xfc62,
  32394. "shaddakasratanarabic",
  32395. 0xfc5f,
  32396. "shade",
  32397. 0x2592,
  32398. "shadedark",
  32399. 0x2593,
  32400. "shadelight",
  32401. 0x2591,
  32402. "shademedium",
  32403. 0x2592,
  32404. "shadeva",
  32405. 0x0936,
  32406. "shagujarati",
  32407. 0x0ab6,
  32408. "shagurmukhi",
  32409. 0x0a36,
  32410. "shalshelethebrew",
  32411. 0x0593,
  32412. "shbopomofo",
  32413. 0x3115,
  32414. "shchacyrillic",
  32415. 0x0449,
  32416. "sheenarabic",
  32417. 0x0634,
  32418. "sheenfinalarabic",
  32419. 0xfeb6,
  32420. "sheeninitialarabic",
  32421. 0xfeb7,
  32422. "sheenmedialarabic",
  32423. 0xfeb8,
  32424. "sheicoptic",
  32425. 0x03e3,
  32426. "sheqel",
  32427. 0x20aa,
  32428. "sheqelhebrew",
  32429. 0x20aa,
  32430. "sheva",
  32431. 0x05b0,
  32432. "sheva115",
  32433. 0x05b0,
  32434. "sheva15",
  32435. 0x05b0,
  32436. "sheva22",
  32437. 0x05b0,
  32438. "sheva2e",
  32439. 0x05b0,
  32440. "shevahebrew",
  32441. 0x05b0,
  32442. "shevanarrowhebrew",
  32443. 0x05b0,
  32444. "shevaquarterhebrew",
  32445. 0x05b0,
  32446. "shevawidehebrew",
  32447. 0x05b0,
  32448. "shhacyrillic",
  32449. 0x04bb,
  32450. "shimacoptic",
  32451. 0x03ed,
  32452. "shin",
  32453. 0x05e9,
  32454. "shindagesh",
  32455. 0xfb49,
  32456. "shindageshhebrew",
  32457. 0xfb49,
  32458. "shindageshshindot",
  32459. 0xfb2c,
  32460. "shindageshshindothebrew",
  32461. 0xfb2c,
  32462. "shindageshsindot",
  32463. 0xfb2d,
  32464. "shindageshsindothebrew",
  32465. 0xfb2d,
  32466. "shindothebrew",
  32467. 0x05c1,
  32468. "shinhebrew",
  32469. 0x05e9,
  32470. "shinshindot",
  32471. 0xfb2a,
  32472. "shinshindothebrew",
  32473. 0xfb2a,
  32474. "shinsindot",
  32475. 0xfb2b,
  32476. "shinsindothebrew",
  32477. 0xfb2b,
  32478. "shook",
  32479. 0x0282,
  32480. "sigma",
  32481. 0x03c3,
  32482. "sigma1",
  32483. 0x03c2,
  32484. "sigmafinal",
  32485. 0x03c2,
  32486. "sigmalunatesymbolgreek",
  32487. 0x03f2,
  32488. "sihiragana",
  32489. 0x3057,
  32490. "sikatakana",
  32491. 0x30b7,
  32492. "sikatakanahalfwidth",
  32493. 0xff7c,
  32494. "siluqhebrew",
  32495. 0x05bd,
  32496. "siluqlefthebrew",
  32497. 0x05bd,
  32498. "similar",
  32499. 0x223c,
  32500. "sindothebrew",
  32501. 0x05c2,
  32502. "siosacirclekorean",
  32503. 0x3274,
  32504. "siosaparenkorean",
  32505. 0x3214,
  32506. "sioscieuckorean",
  32507. 0x317e,
  32508. "sioscirclekorean",
  32509. 0x3266,
  32510. "sioskiyeokkorean",
  32511. 0x317a,
  32512. "sioskorean",
  32513. 0x3145,
  32514. "siosnieunkorean",
  32515. 0x317b,
  32516. "siosparenkorean",
  32517. 0x3206,
  32518. "siospieupkorean",
  32519. 0x317d,
  32520. "siostikeutkorean",
  32521. 0x317c,
  32522. "six",
  32523. 0x0036,
  32524. "sixarabic",
  32525. 0x0666,
  32526. "sixbengali",
  32527. 0x09ec,
  32528. "sixcircle",
  32529. 0x2465,
  32530. "sixcircleinversesansserif",
  32531. 0x278f,
  32532. "sixdeva",
  32533. 0x096c,
  32534. "sixgujarati",
  32535. 0x0aec,
  32536. "sixgurmukhi",
  32537. 0x0a6c,
  32538. "sixhackarabic",
  32539. 0x0666,
  32540. "sixhangzhou",
  32541. 0x3026,
  32542. "sixideographicparen",
  32543. 0x3225,
  32544. "sixinferior",
  32545. 0x2086,
  32546. "sixmonospace",
  32547. 0xff16,
  32548. "sixoldstyle",
  32549. 0xf736,
  32550. "sixparen",
  32551. 0x2479,
  32552. "sixperiod",
  32553. 0x248d,
  32554. "sixpersian",
  32555. 0x06f6,
  32556. "sixroman",
  32557. 0x2175,
  32558. "sixsuperior",
  32559. 0x2076,
  32560. "sixteencircle",
  32561. 0x246f,
  32562. "sixteencurrencydenominatorbengali",
  32563. 0x09f9,
  32564. "sixteenparen",
  32565. 0x2483,
  32566. "sixteenperiod",
  32567. 0x2497,
  32568. "sixthai",
  32569. 0x0e56,
  32570. "slash",
  32571. 0x002f,
  32572. "slashmonospace",
  32573. 0xff0f,
  32574. "slong",
  32575. 0x017f,
  32576. "slongdotaccent",
  32577. 0x1e9b,
  32578. "smileface",
  32579. 0x263a,
  32580. "smonospace",
  32581. 0xff53,
  32582. "sofpasuqhebrew",
  32583. 0x05c3,
  32584. "softhyphen",
  32585. 0x00ad,
  32586. "softsigncyrillic",
  32587. 0x044c,
  32588. "sohiragana",
  32589. 0x305d,
  32590. "sokatakana",
  32591. 0x30bd,
  32592. "sokatakanahalfwidth",
  32593. 0xff7f,
  32594. "soliduslongoverlaycmb",
  32595. 0x0338,
  32596. "solidusshortoverlaycmb",
  32597. 0x0337,
  32598. "sorusithai",
  32599. 0x0e29,
  32600. "sosalathai",
  32601. 0x0e28,
  32602. "sosothai",
  32603. 0x0e0b,
  32604. "sosuathai",
  32605. 0x0e2a,
  32606. "space",
  32607. 0x0020,
  32608. "spacehackarabic",
  32609. 0x0020,
  32610. "spade",
  32611. 0x2660,
  32612. "spadesuitblack",
  32613. 0x2660,
  32614. "spadesuitwhite",
  32615. 0x2664,
  32616. "sparen",
  32617. 0x24ae,
  32618. "squarebelowcmb",
  32619. 0x033b,
  32620. "squarecc",
  32621. 0x33c4,
  32622. "squarecm",
  32623. 0x339d,
  32624. "squarediagonalcrosshatchfill",
  32625. 0x25a9,
  32626. "squarehorizontalfill",
  32627. 0x25a4,
  32628. "squarekg",
  32629. 0x338f,
  32630. "squarekm",
  32631. 0x339e,
  32632. "squarekmcapital",
  32633. 0x33ce,
  32634. "squareln",
  32635. 0x33d1,
  32636. "squarelog",
  32637. 0x33d2,
  32638. "squaremg",
  32639. 0x338e,
  32640. "squaremil",
  32641. 0x33d5,
  32642. "squaremm",
  32643. 0x339c,
  32644. "squaremsquared",
  32645. 0x33a1,
  32646. "squareorthogonalcrosshatchfill",
  32647. 0x25a6,
  32648. "squareupperlefttolowerrightfill",
  32649. 0x25a7,
  32650. "squareupperrighttolowerleftfill",
  32651. 0x25a8,
  32652. "squareverticalfill",
  32653. 0x25a5,
  32654. "squarewhitewithsmallblack",
  32655. 0x25a3,
  32656. "srsquare",
  32657. 0x33db,
  32658. "ssabengali",
  32659. 0x09b7,
  32660. "ssadeva",
  32661. 0x0937,
  32662. "ssagujarati",
  32663. 0x0ab7,
  32664. "ssangcieuckorean",
  32665. 0x3149,
  32666. "ssanghieuhkorean",
  32667. 0x3185,
  32668. "ssangieungkorean",
  32669. 0x3180,
  32670. "ssangkiyeokkorean",
  32671. 0x3132,
  32672. "ssangnieunkorean",
  32673. 0x3165,
  32674. "ssangpieupkorean",
  32675. 0x3143,
  32676. "ssangsioskorean",
  32677. 0x3146,
  32678. "ssangtikeutkorean",
  32679. 0x3138,
  32680. "ssuperior",
  32681. 0xf6f2,
  32682. "sterling",
  32683. 0x00a3,
  32684. "sterlingmonospace",
  32685. 0xffe1,
  32686. "strokelongoverlaycmb",
  32687. 0x0336,
  32688. "strokeshortoverlaycmb",
  32689. 0x0335,
  32690. "subset",
  32691. 0x2282,
  32692. "subsetnotequal",
  32693. 0x228a,
  32694. "subsetorequal",
  32695. 0x2286,
  32696. "succeeds",
  32697. 0x227b,
  32698. "suchthat",
  32699. 0x220b,
  32700. "suhiragana",
  32701. 0x3059,
  32702. "sukatakana",
  32703. 0x30b9,
  32704. "sukatakanahalfwidth",
  32705. 0xff7d,
  32706. "sukunarabic",
  32707. 0x0652,
  32708. "summation",
  32709. 0x2211,
  32710. "sun",
  32711. 0x263c,
  32712. "superset",
  32713. 0x2283,
  32714. "supersetnotequal",
  32715. 0x228b,
  32716. "supersetorequal",
  32717. 0x2287,
  32718. "svsquare",
  32719. 0x33dc,
  32720. "syouwaerasquare",
  32721. 0x337c,
  32722. "t",
  32723. 0x0074,
  32724. "tabengali",
  32725. 0x09a4,
  32726. "tackdown",
  32727. 0x22a4,
  32728. "tackleft",
  32729. 0x22a3,
  32730. "tadeva",
  32731. 0x0924,
  32732. "tagujarati",
  32733. 0x0aa4,
  32734. "tagurmukhi",
  32735. 0x0a24,
  32736. "taharabic",
  32737. 0x0637,
  32738. "tahfinalarabic",
  32739. 0xfec2,
  32740. "tahinitialarabic",
  32741. 0xfec3,
  32742. "tahiragana",
  32743. 0x305f,
  32744. "tahmedialarabic",
  32745. 0xfec4,
  32746. "taisyouerasquare",
  32747. 0x337d,
  32748. "takatakana",
  32749. 0x30bf,
  32750. "takatakanahalfwidth",
  32751. 0xff80,
  32752. "tatweelarabic",
  32753. 0x0640,
  32754. "tau",
  32755. 0x03c4,
  32756. "tav",
  32757. 0x05ea,
  32758. "tavdages",
  32759. 0xfb4a,
  32760. "tavdagesh",
  32761. 0xfb4a,
  32762. "tavdageshhebrew",
  32763. 0xfb4a,
  32764. "tavhebrew",
  32765. 0x05ea,
  32766. "tbar",
  32767. 0x0167,
  32768. "tbopomofo",
  32769. 0x310a,
  32770. "tcaron",
  32771. 0x0165,
  32772. "tccurl",
  32773. 0x02a8,
  32774. "tcedilla",
  32775. 0x0163,
  32776. "tcheharabic",
  32777. 0x0686,
  32778. "tchehfinalarabic",
  32779. 0xfb7b,
  32780. "tchehinitialarabic",
  32781. 0xfb7c,
  32782. "tchehmedialarabic",
  32783. 0xfb7d,
  32784. "tcircle",
  32785. 0x24e3,
  32786. "tcircumflexbelow",
  32787. 0x1e71,
  32788. "tcommaaccent",
  32789. 0x0163,
  32790. "tdieresis",
  32791. 0x1e97,
  32792. "tdotaccent",
  32793. 0x1e6b,
  32794. "tdotbelow",
  32795. 0x1e6d,
  32796. "tecyrillic",
  32797. 0x0442,
  32798. "tedescendercyrillic",
  32799. 0x04ad,
  32800. "teharabic",
  32801. 0x062a,
  32802. "tehfinalarabic",
  32803. 0xfe96,
  32804. "tehhahinitialarabic",
  32805. 0xfca2,
  32806. "tehhahisolatedarabic",
  32807. 0xfc0c,
  32808. "tehinitialarabic",
  32809. 0xfe97,
  32810. "tehiragana",
  32811. 0x3066,
  32812. "tehjeeminitialarabic",
  32813. 0xfca1,
  32814. "tehjeemisolatedarabic",
  32815. 0xfc0b,
  32816. "tehmarbutaarabic",
  32817. 0x0629,
  32818. "tehmarbutafinalarabic",
  32819. 0xfe94,
  32820. "tehmedialarabic",
  32821. 0xfe98,
  32822. "tehmeeminitialarabic",
  32823. 0xfca4,
  32824. "tehmeemisolatedarabic",
  32825. 0xfc0e,
  32826. "tehnoonfinalarabic",
  32827. 0xfc73,
  32828. "tekatakana",
  32829. 0x30c6,
  32830. "tekatakanahalfwidth",
  32831. 0xff83,
  32832. "telephone",
  32833. 0x2121,
  32834. "telephoneblack",
  32835. 0x260e,
  32836. "telishagedolahebrew",
  32837. 0x05a0,
  32838. "telishaqetanahebrew",
  32839. 0x05a9,
  32840. "tencircle",
  32841. 0x2469,
  32842. "tenideographicparen",
  32843. 0x3229,
  32844. "tenparen",
  32845. 0x247d,
  32846. "tenperiod",
  32847. 0x2491,
  32848. "tenroman",
  32849. 0x2179,
  32850. "tesh",
  32851. 0x02a7,
  32852. "tet",
  32853. 0x05d8,
  32854. "tetdagesh",
  32855. 0xfb38,
  32856. "tetdageshhebrew",
  32857. 0xfb38,
  32858. "tethebrew",
  32859. 0x05d8,
  32860. "tetsecyrillic",
  32861. 0x04b5,
  32862. "tevirhebrew",
  32863. 0x059b,
  32864. "tevirlefthebrew",
  32865. 0x059b,
  32866. "thabengali",
  32867. 0x09a5,
  32868. "thadeva",
  32869. 0x0925,
  32870. "thagujarati",
  32871. 0x0aa5,
  32872. "thagurmukhi",
  32873. 0x0a25,
  32874. "thalarabic",
  32875. 0x0630,
  32876. "thalfinalarabic",
  32877. 0xfeac,
  32878. "thanthakhatlowleftthai",
  32879. 0xf898,
  32880. "thanthakhatlowrightthai",
  32881. 0xf897,
  32882. "thanthakhatthai",
  32883. 0x0e4c,
  32884. "thanthakhatupperleftthai",
  32885. 0xf896,
  32886. "theharabic",
  32887. 0x062b,
  32888. "thehfinalarabic",
  32889. 0xfe9a,
  32890. "thehinitialarabic",
  32891. 0xfe9b,
  32892. "thehmedialarabic",
  32893. 0xfe9c,
  32894. "thereexists",
  32895. 0x2203,
  32896. "therefore",
  32897. 0x2234,
  32898. "theta",
  32899. 0x03b8,
  32900. "theta1",
  32901. 0x03d1,
  32902. "thetasymbolgreek",
  32903. 0x03d1,
  32904. "thieuthacirclekorean",
  32905. 0x3279,
  32906. "thieuthaparenkorean",
  32907. 0x3219,
  32908. "thieuthcirclekorean",
  32909. 0x326b,
  32910. "thieuthkorean",
  32911. 0x314c,
  32912. "thieuthparenkorean",
  32913. 0x320b,
  32914. "thirteencircle",
  32915. 0x246c,
  32916. "thirteenparen",
  32917. 0x2480,
  32918. "thirteenperiod",
  32919. 0x2494,
  32920. "thonangmonthothai",
  32921. 0x0e11,
  32922. "thook",
  32923. 0x01ad,
  32924. "thophuthaothai",
  32925. 0x0e12,
  32926. "thorn",
  32927. 0x00fe,
  32928. "thothahanthai",
  32929. 0x0e17,
  32930. "thothanthai",
  32931. 0x0e10,
  32932. "thothongthai",
  32933. 0x0e18,
  32934. "thothungthai",
  32935. 0x0e16,
  32936. "thousandcyrillic",
  32937. 0x0482,
  32938. "thousandsseparatorarabic",
  32939. 0x066c,
  32940. "thousandsseparatorpersian",
  32941. 0x066c,
  32942. "three",
  32943. 0x0033,
  32944. "threearabic",
  32945. 0x0663,
  32946. "threebengali",
  32947. 0x09e9,
  32948. "threecircle",
  32949. 0x2462,
  32950. "threecircleinversesansserif",
  32951. 0x278c,
  32952. "threedeva",
  32953. 0x0969,
  32954. "threeeighths",
  32955. 0x215c,
  32956. "threegujarati",
  32957. 0x0ae9,
  32958. "threegurmukhi",
  32959. 0x0a69,
  32960. "threehackarabic",
  32961. 0x0663,
  32962. "threehangzhou",
  32963. 0x3023,
  32964. "threeideographicparen",
  32965. 0x3222,
  32966. "threeinferior",
  32967. 0x2083,
  32968. "threemonospace",
  32969. 0xff13,
  32970. "threenumeratorbengali",
  32971. 0x09f6,
  32972. "threeoldstyle",
  32973. 0xf733,
  32974. "threeparen",
  32975. 0x2476,
  32976. "threeperiod",
  32977. 0x248a,
  32978. "threepersian",
  32979. 0x06f3,
  32980. "threequarters",
  32981. 0x00be,
  32982. "threequartersemdash",
  32983. 0xf6de,
  32984. "threeroman",
  32985. 0x2172,
  32986. "threesuperior",
  32987. 0x00b3,
  32988. "threethai",
  32989. 0x0e53,
  32990. "thzsquare",
  32991. 0x3394,
  32992. "tihiragana",
  32993. 0x3061,
  32994. "tikatakana",
  32995. 0x30c1,
  32996. "tikatakanahalfwidth",
  32997. 0xff81,
  32998. "tikeutacirclekorean",
  32999. 0x3270,
  33000. "tikeutaparenkorean",
  33001. 0x3210,
  33002. "tikeutcirclekorean",
  33003. 0x3262,
  33004. "tikeutkorean",
  33005. 0x3137,
  33006. "tikeutparenkorean",
  33007. 0x3202,
  33008. "tilde",
  33009. 0x02dc,
  33010. "tildebelowcmb",
  33011. 0x0330,
  33012. "tildecmb",
  33013. 0x0303,
  33014. "tildecomb",
  33015. 0x0303,
  33016. "tildedoublecmb",
  33017. 0x0360,
  33018. "tildeoperator",
  33019. 0x223c,
  33020. "tildeoverlaycmb",
  33021. 0x0334,
  33022. "tildeverticalcmb",
  33023. 0x033e,
  33024. "timescircle",
  33025. 0x2297,
  33026. "tipehahebrew",
  33027. 0x0596,
  33028. "tipehalefthebrew",
  33029. 0x0596,
  33030. "tippigurmukhi",
  33031. 0x0a70,
  33032. "titlocyrilliccmb",
  33033. 0x0483,
  33034. "tiwnarmenian",
  33035. 0x057f,
  33036. "tlinebelow",
  33037. 0x1e6f,
  33038. "tmonospace",
  33039. 0xff54,
  33040. "toarmenian",
  33041. 0x0569,
  33042. "tohiragana",
  33043. 0x3068,
  33044. "tokatakana",
  33045. 0x30c8,
  33046. "tokatakanahalfwidth",
  33047. 0xff84,
  33048. "tonebarextrahighmod",
  33049. 0x02e5,
  33050. "tonebarextralowmod",
  33051. 0x02e9,
  33052. "tonebarhighmod",
  33053. 0x02e6,
  33054. "tonebarlowmod",
  33055. 0x02e8,
  33056. "tonebarmidmod",
  33057. 0x02e7,
  33058. "tonefive",
  33059. 0x01bd,
  33060. "tonesix",
  33061. 0x0185,
  33062. "tonetwo",
  33063. 0x01a8,
  33064. "tonos",
  33065. 0x0384,
  33066. "tonsquare",
  33067. 0x3327,
  33068. "topatakthai",
  33069. 0x0e0f,
  33070. "tortoiseshellbracketleft",
  33071. 0x3014,
  33072. "tortoiseshellbracketleftsmall",
  33073. 0xfe5d,
  33074. "tortoiseshellbracketleftvertical",
  33075. 0xfe39,
  33076. "tortoiseshellbracketright",
  33077. 0x3015,
  33078. "tortoiseshellbracketrightsmall",
  33079. 0xfe5e,
  33080. "tortoiseshellbracketrightvertical",
  33081. 0xfe3a,
  33082. "totaothai",
  33083. 0x0e15,
  33084. "tpalatalhook",
  33085. 0x01ab,
  33086. "tparen",
  33087. 0x24af,
  33088. "trademark",
  33089. 0x2122,
  33090. "trademarksans",
  33091. 0xf8ea,
  33092. "trademarkserif",
  33093. 0xf6db,
  33094. "tretroflexhook",
  33095. 0x0288,
  33096. "triagdn",
  33097. 0x25bc,
  33098. "triaglf",
  33099. 0x25c4,
  33100. "triagrt",
  33101. 0x25ba,
  33102. "triagup",
  33103. 0x25b2,
  33104. "ts",
  33105. 0x02a6,
  33106. "tsadi",
  33107. 0x05e6,
  33108. "tsadidagesh",
  33109. 0xfb46,
  33110. "tsadidageshhebrew",
  33111. 0xfb46,
  33112. "tsadihebrew",
  33113. 0x05e6,
  33114. "tsecyrillic",
  33115. 0x0446,
  33116. "tsere",
  33117. 0x05b5,
  33118. "tsere12",
  33119. 0x05b5,
  33120. "tsere1e",
  33121. 0x05b5,
  33122. "tsere2b",
  33123. 0x05b5,
  33124. "tserehebrew",
  33125. 0x05b5,
  33126. "tserenarrowhebrew",
  33127. 0x05b5,
  33128. "tserequarterhebrew",
  33129. 0x05b5,
  33130. "tserewidehebrew",
  33131. 0x05b5,
  33132. "tshecyrillic",
  33133. 0x045b,
  33134. "tsuperior",
  33135. 0xf6f3,
  33136. "ttabengali",
  33137. 0x099f,
  33138. "ttadeva",
  33139. 0x091f,
  33140. "ttagujarati",
  33141. 0x0a9f,
  33142. "ttagurmukhi",
  33143. 0x0a1f,
  33144. "tteharabic",
  33145. 0x0679,
  33146. "ttehfinalarabic",
  33147. 0xfb67,
  33148. "ttehinitialarabic",
  33149. 0xfb68,
  33150. "ttehmedialarabic",
  33151. 0xfb69,
  33152. "tthabengali",
  33153. 0x09a0,
  33154. "tthadeva",
  33155. 0x0920,
  33156. "tthagujarati",
  33157. 0x0aa0,
  33158. "tthagurmukhi",
  33159. 0x0a20,
  33160. "tturned",
  33161. 0x0287,
  33162. "tuhiragana",
  33163. 0x3064,
  33164. "tukatakana",
  33165. 0x30c4,
  33166. "tukatakanahalfwidth",
  33167. 0xff82,
  33168. "tusmallhiragana",
  33169. 0x3063,
  33170. "tusmallkatakana",
  33171. 0x30c3,
  33172. "tusmallkatakanahalfwidth",
  33173. 0xff6f,
  33174. "twelvecircle",
  33175. 0x246b,
  33176. "twelveparen",
  33177. 0x247f,
  33178. "twelveperiod",
  33179. 0x2493,
  33180. "twelveroman",
  33181. 0x217b,
  33182. "twentycircle",
  33183. 0x2473,
  33184. "twentyhangzhou",
  33185. 0x5344,
  33186. "twentyparen",
  33187. 0x2487,
  33188. "twentyperiod",
  33189. 0x249b,
  33190. "two",
  33191. 0x0032,
  33192. "twoarabic",
  33193. 0x0662,
  33194. "twobengali",
  33195. 0x09e8,
  33196. "twocircle",
  33197. 0x2461,
  33198. "twocircleinversesansserif",
  33199. 0x278b,
  33200. "twodeva",
  33201. 0x0968,
  33202. "twodotenleader",
  33203. 0x2025,
  33204. "twodotleader",
  33205. 0x2025,
  33206. "twodotleadervertical",
  33207. 0xfe30,
  33208. "twogujarati",
  33209. 0x0ae8,
  33210. "twogurmukhi",
  33211. 0x0a68,
  33212. "twohackarabic",
  33213. 0x0662,
  33214. "twohangzhou",
  33215. 0x3022,
  33216. "twoideographicparen",
  33217. 0x3221,
  33218. "twoinferior",
  33219. 0x2082,
  33220. "twomonospace",
  33221. 0xff12,
  33222. "twonumeratorbengali",
  33223. 0x09f5,
  33224. "twooldstyle",
  33225. 0xf732,
  33226. "twoparen",
  33227. 0x2475,
  33228. "twoperiod",
  33229. 0x2489,
  33230. "twopersian",
  33231. 0x06f2,
  33232. "tworoman",
  33233. 0x2171,
  33234. "twostroke",
  33235. 0x01bb,
  33236. "twosuperior",
  33237. 0x00b2,
  33238. "twothai",
  33239. 0x0e52,
  33240. "twothirds",
  33241. 0x2154,
  33242. "u",
  33243. 0x0075,
  33244. "uacute",
  33245. 0x00fa,
  33246. "ubar",
  33247. 0x0289,
  33248. "ubengali",
  33249. 0x0989,
  33250. "ubopomofo",
  33251. 0x3128,
  33252. "ubreve",
  33253. 0x016d,
  33254. "ucaron",
  33255. 0x01d4,
  33256. "ucircle",
  33257. 0x24e4,
  33258. "ucircumflex",
  33259. 0x00fb,
  33260. "ucircumflexbelow",
  33261. 0x1e77,
  33262. "ucyrillic",
  33263. 0x0443,
  33264. "udattadeva",
  33265. 0x0951,
  33266. "udblacute",
  33267. 0x0171,
  33268. "udblgrave",
  33269. 0x0215,
  33270. "udeva",
  33271. 0x0909,
  33272. "udieresis",
  33273. 0x00fc,
  33274. "udieresisacute",
  33275. 0x01d8,
  33276. "udieresisbelow",
  33277. 0x1e73,
  33278. "udieresiscaron",
  33279. 0x01da,
  33280. "udieresiscyrillic",
  33281. 0x04f1,
  33282. "udieresisgrave",
  33283. 0x01dc,
  33284. "udieresismacron",
  33285. 0x01d6,
  33286. "udotbelow",
  33287. 0x1ee5,
  33288. "ugrave",
  33289. 0x00f9,
  33290. "ugujarati",
  33291. 0x0a89,
  33292. "ugurmukhi",
  33293. 0x0a09,
  33294. "uhiragana",
  33295. 0x3046,
  33296. "uhookabove",
  33297. 0x1ee7,
  33298. "uhorn",
  33299. 0x01b0,
  33300. "uhornacute",
  33301. 0x1ee9,
  33302. "uhorndotbelow",
  33303. 0x1ef1,
  33304. "uhorngrave",
  33305. 0x1eeb,
  33306. "uhornhookabove",
  33307. 0x1eed,
  33308. "uhorntilde",
  33309. 0x1eef,
  33310. "uhungarumlaut",
  33311. 0x0171,
  33312. "uhungarumlautcyrillic",
  33313. 0x04f3,
  33314. "uinvertedbreve",
  33315. 0x0217,
  33316. "ukatakana",
  33317. 0x30a6,
  33318. "ukatakanahalfwidth",
  33319. 0xff73,
  33320. "ukcyrillic",
  33321. 0x0479,
  33322. "ukorean",
  33323. 0x315c,
  33324. "umacron",
  33325. 0x016b,
  33326. "umacroncyrillic",
  33327. 0x04ef,
  33328. "umacrondieresis",
  33329. 0x1e7b,
  33330. "umatragurmukhi",
  33331. 0x0a41,
  33332. "umonospace",
  33333. 0xff55,
  33334. "underscore",
  33335. 0x005f,
  33336. "underscoredbl",
  33337. 0x2017,
  33338. "underscoremonospace",
  33339. 0xff3f,
  33340. "underscorevertical",
  33341. 0xfe33,
  33342. "underscorewavy",
  33343. 0xfe4f,
  33344. "union",
  33345. 0x222a,
  33346. "universal",
  33347. 0x2200,
  33348. "uogonek",
  33349. 0x0173,
  33350. "uparen",
  33351. 0x24b0,
  33352. "upblock",
  33353. 0x2580,
  33354. "upperdothebrew",
  33355. 0x05c4,
  33356. "upsilon",
  33357. 0x03c5,
  33358. "upsilondieresis",
  33359. 0x03cb,
  33360. "upsilondieresistonos",
  33361. 0x03b0,
  33362. "upsilonlatin",
  33363. 0x028a,
  33364. "upsilontonos",
  33365. 0x03cd,
  33366. "uptackbelowcmb",
  33367. 0x031d,
  33368. "uptackmod",
  33369. 0x02d4,
  33370. "uragurmukhi",
  33371. 0x0a73,
  33372. "uring",
  33373. 0x016f,
  33374. "ushortcyrillic",
  33375. 0x045e,
  33376. "usmallhiragana",
  33377. 0x3045,
  33378. "usmallkatakana",
  33379. 0x30a5,
  33380. "usmallkatakanahalfwidth",
  33381. 0xff69,
  33382. "ustraightcyrillic",
  33383. 0x04af,
  33384. "ustraightstrokecyrillic",
  33385. 0x04b1,
  33386. "utilde",
  33387. 0x0169,
  33388. "utildeacute",
  33389. 0x1e79,
  33390. "utildebelow",
  33391. 0x1e75,
  33392. "uubengali",
  33393. 0x098a,
  33394. "uudeva",
  33395. 0x090a,
  33396. "uugujarati",
  33397. 0x0a8a,
  33398. "uugurmukhi",
  33399. 0x0a0a,
  33400. "uumatragurmukhi",
  33401. 0x0a42,
  33402. "uuvowelsignbengali",
  33403. 0x09c2,
  33404. "uuvowelsigndeva",
  33405. 0x0942,
  33406. "uuvowelsigngujarati",
  33407. 0x0ac2,
  33408. "uvowelsignbengali",
  33409. 0x09c1,
  33410. "uvowelsigndeva",
  33411. 0x0941,
  33412. "uvowelsigngujarati",
  33413. 0x0ac1,
  33414. "v",
  33415. 0x0076,
  33416. "vadeva",
  33417. 0x0935,
  33418. "vagujarati",
  33419. 0x0ab5,
  33420. "vagurmukhi",
  33421. 0x0a35,
  33422. "vakatakana",
  33423. 0x30f7,
  33424. "vav",
  33425. 0x05d5,
  33426. "vavdagesh",
  33427. 0xfb35,
  33428. "vavdagesh65",
  33429. 0xfb35,
  33430. "vavdageshhebrew",
  33431. 0xfb35,
  33432. "vavhebrew",
  33433. 0x05d5,
  33434. "vavholam",
  33435. 0xfb4b,
  33436. "vavholamhebrew",
  33437. 0xfb4b,
  33438. "vavvavhebrew",
  33439. 0x05f0,
  33440. "vavyodhebrew",
  33441. 0x05f1,
  33442. "vcircle",
  33443. 0x24e5,
  33444. "vdotbelow",
  33445. 0x1e7f,
  33446. "vecyrillic",
  33447. 0x0432,
  33448. "veharabic",
  33449. 0x06a4,
  33450. "vehfinalarabic",
  33451. 0xfb6b,
  33452. "vehinitialarabic",
  33453. 0xfb6c,
  33454. "vehmedialarabic",
  33455. 0xfb6d,
  33456. "vekatakana",
  33457. 0x30f9,
  33458. "venus",
  33459. 0x2640,
  33460. "verticalbar",
  33461. 0x007c,
  33462. "verticallineabovecmb",
  33463. 0x030d,
  33464. "verticallinebelowcmb",
  33465. 0x0329,
  33466. "verticallinelowmod",
  33467. 0x02cc,
  33468. "verticallinemod",
  33469. 0x02c8,
  33470. "vewarmenian",
  33471. 0x057e,
  33472. "vhook",
  33473. 0x028b,
  33474. "vikatakana",
  33475. 0x30f8,
  33476. "viramabengali",
  33477. 0x09cd,
  33478. "viramadeva",
  33479. 0x094d,
  33480. "viramagujarati",
  33481. 0x0acd,
  33482. "visargabengali",
  33483. 0x0983,
  33484. "visargadeva",
  33485. 0x0903,
  33486. "visargagujarati",
  33487. 0x0a83,
  33488. "vmonospace",
  33489. 0xff56,
  33490. "voarmenian",
  33491. 0x0578,
  33492. "voicediterationhiragana",
  33493. 0x309e,
  33494. "voicediterationkatakana",
  33495. 0x30fe,
  33496. "voicedmarkkana",
  33497. 0x309b,
  33498. "voicedmarkkanahalfwidth",
  33499. 0xff9e,
  33500. "vokatakana",
  33501. 0x30fa,
  33502. "vparen",
  33503. 0x24b1,
  33504. "vtilde",
  33505. 0x1e7d,
  33506. "vturned",
  33507. 0x028c,
  33508. "vuhiragana",
  33509. 0x3094,
  33510. "vukatakana",
  33511. 0x30f4,
  33512. "w",
  33513. 0x0077,
  33514. "wacute",
  33515. 0x1e83,
  33516. "waekorean",
  33517. 0x3159,
  33518. "wahiragana",
  33519. 0x308f,
  33520. "wakatakana",
  33521. 0x30ef,
  33522. "wakatakanahalfwidth",
  33523. 0xff9c,
  33524. "wakorean",
  33525. 0x3158,
  33526. "wasmallhiragana",
  33527. 0x308e,
  33528. "wasmallkatakana",
  33529. 0x30ee,
  33530. "wattosquare",
  33531. 0x3357,
  33532. "wavedash",
  33533. 0x301c,
  33534. "wavyunderscorevertical",
  33535. 0xfe34,
  33536. "wawarabic",
  33537. 0x0648,
  33538. "wawfinalarabic",
  33539. 0xfeee,
  33540. "wawhamzaabovearabic",
  33541. 0x0624,
  33542. "wawhamzaabovefinalarabic",
  33543. 0xfe86,
  33544. "wbsquare",
  33545. 0x33dd,
  33546. "wcircle",
  33547. 0x24e6,
  33548. "wcircumflex",
  33549. 0x0175,
  33550. "wdieresis",
  33551. 0x1e85,
  33552. "wdotaccent",
  33553. 0x1e87,
  33554. "wdotbelow",
  33555. 0x1e89,
  33556. "wehiragana",
  33557. 0x3091,
  33558. "weierstrass",
  33559. 0x2118,
  33560. "wekatakana",
  33561. 0x30f1,
  33562. "wekorean",
  33563. 0x315e,
  33564. "weokorean",
  33565. 0x315d,
  33566. "wgrave",
  33567. 0x1e81,
  33568. "whitebullet",
  33569. 0x25e6,
  33570. "whitecircle",
  33571. 0x25cb,
  33572. "whitecircleinverse",
  33573. 0x25d9,
  33574. "whitecornerbracketleft",
  33575. 0x300e,
  33576. "whitecornerbracketleftvertical",
  33577. 0xfe43,
  33578. "whitecornerbracketright",
  33579. 0x300f,
  33580. "whitecornerbracketrightvertical",
  33581. 0xfe44,
  33582. "whitediamond",
  33583. 0x25c7,
  33584. "whitediamondcontainingblacksmalldiamond",
  33585. 0x25c8,
  33586. "whitedownpointingsmalltriangle",
  33587. 0x25bf,
  33588. "whitedownpointingtriangle",
  33589. 0x25bd,
  33590. "whiteleftpointingsmalltriangle",
  33591. 0x25c3,
  33592. "whiteleftpointingtriangle",
  33593. 0x25c1,
  33594. "whitelenticularbracketleft",
  33595. 0x3016,
  33596. "whitelenticularbracketright",
  33597. 0x3017,
  33598. "whiterightpointingsmalltriangle",
  33599. 0x25b9,
  33600. "whiterightpointingtriangle",
  33601. 0x25b7,
  33602. "whitesmallsquare",
  33603. 0x25ab,
  33604. "whitesmilingface",
  33605. 0x263a,
  33606. "whitesquare",
  33607. 0x25a1,
  33608. "whitestar",
  33609. 0x2606,
  33610. "whitetelephone",
  33611. 0x260f,
  33612. "whitetortoiseshellbracketleft",
  33613. 0x3018,
  33614. "whitetortoiseshellbracketright",
  33615. 0x3019,
  33616. "whiteuppointingsmalltriangle",
  33617. 0x25b5,
  33618. "whiteuppointingtriangle",
  33619. 0x25b3,
  33620. "wihiragana",
  33621. 0x3090,
  33622. "wikatakana",
  33623. 0x30f0,
  33624. "wikorean",
  33625. 0x315f,
  33626. "wmonospace",
  33627. 0xff57,
  33628. "wohiragana",
  33629. 0x3092,
  33630. "wokatakana",
  33631. 0x30f2,
  33632. "wokatakanahalfwidth",
  33633. 0xff66,
  33634. "won",
  33635. 0x20a9,
  33636. "wonmonospace",
  33637. 0xffe6,
  33638. "wowaenthai",
  33639. 0x0e27,
  33640. "wparen",
  33641. 0x24b2,
  33642. "wring",
  33643. 0x1e98,
  33644. "wsuperior",
  33645. 0x02b7,
  33646. "wturned",
  33647. 0x028d,
  33648. "wynn",
  33649. 0x01bf,
  33650. "x",
  33651. 0x0078,
  33652. "xabovecmb",
  33653. 0x033d,
  33654. "xbopomofo",
  33655. 0x3112,
  33656. "xcircle",
  33657. 0x24e7,
  33658. "xdieresis",
  33659. 0x1e8d,
  33660. "xdotaccent",
  33661. 0x1e8b,
  33662. "xeharmenian",
  33663. 0x056d,
  33664. "xi",
  33665. 0x03be,
  33666. "xmonospace",
  33667. 0xff58,
  33668. "xparen",
  33669. 0x24b3,
  33670. "xsuperior",
  33671. 0x02e3,
  33672. "y",
  33673. 0x0079,
  33674. "yaadosquare",
  33675. 0x334e,
  33676. "yabengali",
  33677. 0x09af,
  33678. "yacute",
  33679. 0x00fd,
  33680. "yadeva",
  33681. 0x092f,
  33682. "yaekorean",
  33683. 0x3152,
  33684. "yagujarati",
  33685. 0x0aaf,
  33686. "yagurmukhi",
  33687. 0x0a2f,
  33688. "yahiragana",
  33689. 0x3084,
  33690. "yakatakana",
  33691. 0x30e4,
  33692. "yakatakanahalfwidth",
  33693. 0xff94,
  33694. "yakorean",
  33695. 0x3151,
  33696. "yamakkanthai",
  33697. 0x0e4e,
  33698. "yasmallhiragana",
  33699. 0x3083,
  33700. "yasmallkatakana",
  33701. 0x30e3,
  33702. "yasmallkatakanahalfwidth",
  33703. 0xff6c,
  33704. "yatcyrillic",
  33705. 0x0463,
  33706. "ycircle",
  33707. 0x24e8,
  33708. "ycircumflex",
  33709. 0x0177,
  33710. "ydieresis",
  33711. 0x00ff,
  33712. "ydotaccent",
  33713. 0x1e8f,
  33714. "ydotbelow",
  33715. 0x1ef5,
  33716. "yeharabic",
  33717. 0x064a,
  33718. "yehbarreearabic",
  33719. 0x06d2,
  33720. "yehbarreefinalarabic",
  33721. 0xfbaf,
  33722. "yehfinalarabic",
  33723. 0xfef2,
  33724. "yehhamzaabovearabic",
  33725. 0x0626,
  33726. "yehhamzaabovefinalarabic",
  33727. 0xfe8a,
  33728. "yehhamzaaboveinitialarabic",
  33729. 0xfe8b,
  33730. "yehhamzaabovemedialarabic",
  33731. 0xfe8c,
  33732. "yehinitialarabic",
  33733. 0xfef3,
  33734. "yehmedialarabic",
  33735. 0xfef4,
  33736. "yehmeeminitialarabic",
  33737. 0xfcdd,
  33738. "yehmeemisolatedarabic",
  33739. 0xfc58,
  33740. "yehnoonfinalarabic",
  33741. 0xfc94,
  33742. "yehthreedotsbelowarabic",
  33743. 0x06d1,
  33744. "yekorean",
  33745. 0x3156,
  33746. "yen",
  33747. 0x00a5,
  33748. "yenmonospace",
  33749. 0xffe5,
  33750. "yeokorean",
  33751. 0x3155,
  33752. "yeorinhieuhkorean",
  33753. 0x3186,
  33754. "yerahbenyomohebrew",
  33755. 0x05aa,
  33756. "yerahbenyomolefthebrew",
  33757. 0x05aa,
  33758. "yericyrillic",
  33759. 0x044b,
  33760. "yerudieresiscyrillic",
  33761. 0x04f9,
  33762. "yesieungkorean",
  33763. 0x3181,
  33764. "yesieungpansioskorean",
  33765. 0x3183,
  33766. "yesieungsioskorean",
  33767. 0x3182,
  33768. "yetivhebrew",
  33769. 0x059a,
  33770. "ygrave",
  33771. 0x1ef3,
  33772. "yhook",
  33773. 0x01b4,
  33774. "yhookabove",
  33775. 0x1ef7,
  33776. "yiarmenian",
  33777. 0x0575,
  33778. "yicyrillic",
  33779. 0x0457,
  33780. "yikorean",
  33781. 0x3162,
  33782. "yinyang",
  33783. 0x262f,
  33784. "yiwnarmenian",
  33785. 0x0582,
  33786. "ymonospace",
  33787. 0xff59,
  33788. "yod",
  33789. 0x05d9,
  33790. "yoddagesh",
  33791. 0xfb39,
  33792. "yoddageshhebrew",
  33793. 0xfb39,
  33794. "yodhebrew",
  33795. 0x05d9,
  33796. "yodyodhebrew",
  33797. 0x05f2,
  33798. "yodyodpatahhebrew",
  33799. 0xfb1f,
  33800. "yohiragana",
  33801. 0x3088,
  33802. "yoikorean",
  33803. 0x3189,
  33804. "yokatakana",
  33805. 0x30e8,
  33806. "yokatakanahalfwidth",
  33807. 0xff96,
  33808. "yokorean",
  33809. 0x315b,
  33810. "yosmallhiragana",
  33811. 0x3087,
  33812. "yosmallkatakana",
  33813. 0x30e7,
  33814. "yosmallkatakanahalfwidth",
  33815. 0xff6e,
  33816. "yotgreek",
  33817. 0x03f3,
  33818. "yoyaekorean",
  33819. 0x3188,
  33820. "yoyakorean",
  33821. 0x3187,
  33822. "yoyakthai",
  33823. 0x0e22,
  33824. "yoyingthai",
  33825. 0x0e0d,
  33826. "yparen",
  33827. 0x24b4,
  33828. "ypogegrammeni",
  33829. 0x037a,
  33830. "ypogegrammenigreekcmb",
  33831. 0x0345,
  33832. "yr",
  33833. 0x01a6,
  33834. "yring",
  33835. 0x1e99,
  33836. "ysuperior",
  33837. 0x02b8,
  33838. "ytilde",
  33839. 0x1ef9,
  33840. "yturned",
  33841. 0x028e,
  33842. "yuhiragana",
  33843. 0x3086,
  33844. "yuikorean",
  33845. 0x318c,
  33846. "yukatakana",
  33847. 0x30e6,
  33848. "yukatakanahalfwidth",
  33849. 0xff95,
  33850. "yukorean",
  33851. 0x3160,
  33852. "yusbigcyrillic",
  33853. 0x046b,
  33854. "yusbigiotifiedcyrillic",
  33855. 0x046d,
  33856. "yuslittlecyrillic",
  33857. 0x0467,
  33858. "yuslittleiotifiedcyrillic",
  33859. 0x0469,
  33860. "yusmallhiragana",
  33861. 0x3085,
  33862. "yusmallkatakana",
  33863. 0x30e5,
  33864. "yusmallkatakanahalfwidth",
  33865. 0xff6d,
  33866. "yuyekorean",
  33867. 0x318b,
  33868. "yuyeokorean",
  33869. 0x318a,
  33870. "yyabengali",
  33871. 0x09df,
  33872. "yyadeva",
  33873. 0x095f,
  33874. "z",
  33875. 0x007a,
  33876. "zaarmenian",
  33877. 0x0566,
  33878. "zacute",
  33879. 0x017a,
  33880. "zadeva",
  33881. 0x095b,
  33882. "zagurmukhi",
  33883. 0x0a5b,
  33884. "zaharabic",
  33885. 0x0638,
  33886. "zahfinalarabic",
  33887. 0xfec6,
  33888. "zahinitialarabic",
  33889. 0xfec7,
  33890. "zahiragana",
  33891. 0x3056,
  33892. "zahmedialarabic",
  33893. 0xfec8,
  33894. "zainarabic",
  33895. 0x0632,
  33896. "zainfinalarabic",
  33897. 0xfeb0,
  33898. "zakatakana",
  33899. 0x30b6,
  33900. "zaqefgadolhebrew",
  33901. 0x0595,
  33902. "zaqefqatanhebrew",
  33903. 0x0594,
  33904. "zarqahebrew",
  33905. 0x0598,
  33906. "zayin",
  33907. 0x05d6,
  33908. "zayindagesh",
  33909. 0xfb36,
  33910. "zayindageshhebrew",
  33911. 0xfb36,
  33912. "zayinhebrew",
  33913. 0x05d6,
  33914. "zbopomofo",
  33915. 0x3117,
  33916. "zcaron",
  33917. 0x017e,
  33918. "zcircle",
  33919. 0x24e9,
  33920. "zcircumflex",
  33921. 0x1e91,
  33922. "zcurl",
  33923. 0x0291,
  33924. "zdot",
  33925. 0x017c,
  33926. "zdotaccent",
  33927. 0x017c,
  33928. "zdotbelow",
  33929. 0x1e93,
  33930. "zecyrillic",
  33931. 0x0437,
  33932. "zedescendercyrillic",
  33933. 0x0499,
  33934. "zedieresiscyrillic",
  33935. 0x04df,
  33936. "zehiragana",
  33937. 0x305c,
  33938. "zekatakana",
  33939. 0x30bc,
  33940. "zero",
  33941. 0x0030,
  33942. "zeroarabic",
  33943. 0x0660,
  33944. "zerobengali",
  33945. 0x09e6,
  33946. "zerodeva",
  33947. 0x0966,
  33948. "zerogujarati",
  33949. 0x0ae6,
  33950. "zerogurmukhi",
  33951. 0x0a66,
  33952. "zerohackarabic",
  33953. 0x0660,
  33954. "zeroinferior",
  33955. 0x2080,
  33956. "zeromonospace",
  33957. 0xff10,
  33958. "zerooldstyle",
  33959. 0xf730,
  33960. "zeropersian",
  33961. 0x06f0,
  33962. "zerosuperior",
  33963. 0x2070,
  33964. "zerothai",
  33965. 0x0e50,
  33966. "zerowidthjoiner",
  33967. 0xfeff,
  33968. "zerowidthnonjoiner",
  33969. 0x200c,
  33970. "zerowidthspace",
  33971. 0x200b,
  33972. "zeta",
  33973. 0x03b6,
  33974. "zhbopomofo",
  33975. 0x3113,
  33976. "zhearmenian",
  33977. 0x056a,
  33978. "zhebrevecyrillic",
  33979. 0x04c2,
  33980. "zhecyrillic",
  33981. 0x0436,
  33982. "zhedescendercyrillic",
  33983. 0x0497,
  33984. "zhedieresiscyrillic",
  33985. 0x04dd,
  33986. "zihiragana",
  33987. 0x3058,
  33988. "zikatakana",
  33989. 0x30b8,
  33990. "zinorhebrew",
  33991. 0x05ae,
  33992. "zlinebelow",
  33993. 0x1e95,
  33994. "zmonospace",
  33995. 0xff5a,
  33996. "zohiragana",
  33997. 0x305e,
  33998. "zokatakana",
  33999. 0x30be,
  34000. "zparen",
  34001. 0x24b5,
  34002. "zretroflexhook",
  34003. 0x0290,
  34004. "zstroke",
  34005. 0x01b6,
  34006. "zuhiragana",
  34007. 0x305a,
  34008. "zukatakana",
  34009. 0x30ba,
  34010. ".notdef",
  34011. 0x0000,
  34012. "angbracketleftbig",
  34013. 0x2329,
  34014. "angbracketleftBig",
  34015. 0x2329,
  34016. "angbracketleftbigg",
  34017. 0x2329,
  34018. "angbracketleftBigg",
  34019. 0x2329,
  34020. "angbracketrightBig",
  34021. 0x232a,
  34022. "angbracketrightbig",
  34023. 0x232a,
  34024. "angbracketrightBigg",
  34025. 0x232a,
  34026. "angbracketrightbigg",
  34027. 0x232a,
  34028. "arrowhookleft",
  34029. 0x21aa,
  34030. "arrowhookright",
  34031. 0x21a9,
  34032. "arrowlefttophalf",
  34033. 0x21bc,
  34034. "arrowleftbothalf",
  34035. 0x21bd,
  34036. "arrownortheast",
  34037. 0x2197,
  34038. "arrownorthwest",
  34039. 0x2196,
  34040. "arrowrighttophalf",
  34041. 0x21c0,
  34042. "arrowrightbothalf",
  34043. 0x21c1,
  34044. "arrowsoutheast",
  34045. 0x2198,
  34046. "arrowsouthwest",
  34047. 0x2199,
  34048. "backslashbig",
  34049. 0x2216,
  34050. "backslashBig",
  34051. 0x2216,
  34052. "backslashBigg",
  34053. 0x2216,
  34054. "backslashbigg",
  34055. 0x2216,
  34056. "bardbl",
  34057. 0x2016,
  34058. "bracehtipdownleft",
  34059. 0xfe37,
  34060. "bracehtipdownright",
  34061. 0xfe37,
  34062. "bracehtipupleft",
  34063. 0xfe38,
  34064. "bracehtipupright",
  34065. 0xfe38,
  34066. "braceleftBig",
  34067. 0x007b,
  34068. "braceleftbig",
  34069. 0x007b,
  34070. "braceleftbigg",
  34071. 0x007b,
  34072. "braceleftBigg",
  34073. 0x007b,
  34074. "bracerightBig",
  34075. 0x007d,
  34076. "bracerightbig",
  34077. 0x007d,
  34078. "bracerightbigg",
  34079. 0x007d,
  34080. "bracerightBigg",
  34081. 0x007d,
  34082. "bracketleftbig",
  34083. 0x005b,
  34084. "bracketleftBig",
  34085. 0x005b,
  34086. "bracketleftbigg",
  34087. 0x005b,
  34088. "bracketleftBigg",
  34089. 0x005b,
  34090. "bracketrightBig",
  34091. 0x005d,
  34092. "bracketrightbig",
  34093. 0x005d,
  34094. "bracketrightbigg",
  34095. 0x005d,
  34096. "bracketrightBigg",
  34097. 0x005d,
  34098. "ceilingleftbig",
  34099. 0x2308,
  34100. "ceilingleftBig",
  34101. 0x2308,
  34102. "ceilingleftBigg",
  34103. 0x2308,
  34104. "ceilingleftbigg",
  34105. 0x2308,
  34106. "ceilingrightbig",
  34107. 0x2309,
  34108. "ceilingrightBig",
  34109. 0x2309,
  34110. "ceilingrightbigg",
  34111. 0x2309,
  34112. "ceilingrightBigg",
  34113. 0x2309,
  34114. "circledotdisplay",
  34115. 0x2299,
  34116. "circledottext",
  34117. 0x2299,
  34118. "circlemultiplydisplay",
  34119. 0x2297,
  34120. "circlemultiplytext",
  34121. 0x2297,
  34122. "circleplusdisplay",
  34123. 0x2295,
  34124. "circleplustext",
  34125. 0x2295,
  34126. "contintegraldisplay",
  34127. 0x222e,
  34128. "contintegraltext",
  34129. 0x222e,
  34130. "coproductdisplay",
  34131. 0x2210,
  34132. "coproducttext",
  34133. 0x2210,
  34134. "floorleftBig",
  34135. 0x230a,
  34136. "floorleftbig",
  34137. 0x230a,
  34138. "floorleftbigg",
  34139. 0x230a,
  34140. "floorleftBigg",
  34141. 0x230a,
  34142. "floorrightbig",
  34143. 0x230b,
  34144. "floorrightBig",
  34145. 0x230b,
  34146. "floorrightBigg",
  34147. 0x230b,
  34148. "floorrightbigg",
  34149. 0x230b,
  34150. "hatwide",
  34151. 0x0302,
  34152. "hatwider",
  34153. 0x0302,
  34154. "hatwidest",
  34155. 0x0302,
  34156. "intercal",
  34157. 0x1d40,
  34158. "integraldisplay",
  34159. 0x222b,
  34160. "integraltext",
  34161. 0x222b,
  34162. "intersectiondisplay",
  34163. 0x22c2,
  34164. "intersectiontext",
  34165. 0x22c2,
  34166. "logicalanddisplay",
  34167. 0x2227,
  34168. "logicalandtext",
  34169. 0x2227,
  34170. "logicalordisplay",
  34171. 0x2228,
  34172. "logicalortext",
  34173. 0x2228,
  34174. "parenleftBig",
  34175. 0x0028,
  34176. "parenleftbig",
  34177. 0x0028,
  34178. "parenleftBigg",
  34179. 0x0028,
  34180. "parenleftbigg",
  34181. 0x0028,
  34182. "parenrightBig",
  34183. 0x0029,
  34184. "parenrightbig",
  34185. 0x0029,
  34186. "parenrightBigg",
  34187. 0x0029,
  34188. "parenrightbigg",
  34189. 0x0029,
  34190. "prime",
  34191. 0x2032,
  34192. "productdisplay",
  34193. 0x220f,
  34194. "producttext",
  34195. 0x220f,
  34196. "radicalbig",
  34197. 0x221a,
  34198. "radicalBig",
  34199. 0x221a,
  34200. "radicalBigg",
  34201. 0x221a,
  34202. "radicalbigg",
  34203. 0x221a,
  34204. "radicalbt",
  34205. 0x221a,
  34206. "radicaltp",
  34207. 0x221a,
  34208. "radicalvertex",
  34209. 0x221a,
  34210. "slashbig",
  34211. 0x002f,
  34212. "slashBig",
  34213. 0x002f,
  34214. "slashBigg",
  34215. 0x002f,
  34216. "slashbigg",
  34217. 0x002f,
  34218. "summationdisplay",
  34219. 0x2211,
  34220. "summationtext",
  34221. 0x2211,
  34222. "tildewide",
  34223. 0x02dc,
  34224. "tildewider",
  34225. 0x02dc,
  34226. "tildewidest",
  34227. 0x02dc,
  34228. "uniondisplay",
  34229. 0x22c3,
  34230. "unionmultidisplay",
  34231. 0x228e,
  34232. "unionmultitext",
  34233. 0x228e,
  34234. "unionsqdisplay",
  34235. 0x2294,
  34236. "unionsqtext",
  34237. 0x2294,
  34238. "uniontext",
  34239. 0x22c3,
  34240. "vextenddouble",
  34241. 0x2225,
  34242. "vextendsingle",
  34243. 0x2223
  34244. ];
  34245. });
  34246. var getDingbatsGlyphsUnicode = (0,_core_utils_js__WEBPACK_IMPORTED_MODULE_0__.getArrayLookupTableFactory)(function () {
  34247. return [
  34248. "space",
  34249. 0x0020,
  34250. "a1",
  34251. 0x2701,
  34252. "a2",
  34253. 0x2702,
  34254. "a202",
  34255. 0x2703,
  34256. "a3",
  34257. 0x2704,
  34258. "a4",
  34259. 0x260e,
  34260. "a5",
  34261. 0x2706,
  34262. "a119",
  34263. 0x2707,
  34264. "a118",
  34265. 0x2708,
  34266. "a117",
  34267. 0x2709,
  34268. "a11",
  34269. 0x261b,
  34270. "a12",
  34271. 0x261e,
  34272. "a13",
  34273. 0x270c,
  34274. "a14",
  34275. 0x270d,
  34276. "a15",
  34277. 0x270e,
  34278. "a16",
  34279. 0x270f,
  34280. "a105",
  34281. 0x2710,
  34282. "a17",
  34283. 0x2711,
  34284. "a18",
  34285. 0x2712,
  34286. "a19",
  34287. 0x2713,
  34288. "a20",
  34289. 0x2714,
  34290. "a21",
  34291. 0x2715,
  34292. "a22",
  34293. 0x2716,
  34294. "a23",
  34295. 0x2717,
  34296. "a24",
  34297. 0x2718,
  34298. "a25",
  34299. 0x2719,
  34300. "a26",
  34301. 0x271a,
  34302. "a27",
  34303. 0x271b,
  34304. "a28",
  34305. 0x271c,
  34306. "a6",
  34307. 0x271d,
  34308. "a7",
  34309. 0x271e,
  34310. "a8",
  34311. 0x271f,
  34312. "a9",
  34313. 0x2720,
  34314. "a10",
  34315. 0x2721,
  34316. "a29",
  34317. 0x2722,
  34318. "a30",
  34319. 0x2723,
  34320. "a31",
  34321. 0x2724,
  34322. "a32",
  34323. 0x2725,
  34324. "a33",
  34325. 0x2726,
  34326. "a34",
  34327. 0x2727,
  34328. "a35",
  34329. 0x2605,
  34330. "a36",
  34331. 0x2729,
  34332. "a37",
  34333. 0x272a,
  34334. "a38",
  34335. 0x272b,
  34336. "a39",
  34337. 0x272c,
  34338. "a40",
  34339. 0x272d,
  34340. "a41",
  34341. 0x272e,
  34342. "a42",
  34343. 0x272f,
  34344. "a43",
  34345. 0x2730,
  34346. "a44",
  34347. 0x2731,
  34348. "a45",
  34349. 0x2732,
  34350. "a46",
  34351. 0x2733,
  34352. "a47",
  34353. 0x2734,
  34354. "a48",
  34355. 0x2735,
  34356. "a49",
  34357. 0x2736,
  34358. "a50",
  34359. 0x2737,
  34360. "a51",
  34361. 0x2738,
  34362. "a52",
  34363. 0x2739,
  34364. "a53",
  34365. 0x273a,
  34366. "a54",
  34367. 0x273b,
  34368. "a55",
  34369. 0x273c,
  34370. "a56",
  34371. 0x273d,
  34372. "a57",
  34373. 0x273e,
  34374. "a58",
  34375. 0x273f,
  34376. "a59",
  34377. 0x2740,
  34378. "a60",
  34379. 0x2741,
  34380. "a61",
  34381. 0x2742,
  34382. "a62",
  34383. 0x2743,
  34384. "a63",
  34385. 0x2744,
  34386. "a64",
  34387. 0x2745,
  34388. "a65",
  34389. 0x2746,
  34390. "a66",
  34391. 0x2747,
  34392. "a67",
  34393. 0x2748,
  34394. "a68",
  34395. 0x2749,
  34396. "a69",
  34397. 0x274a,
  34398. "a70",
  34399. 0x274b,
  34400. "a71",
  34401. 0x25cf,
  34402. "a72",
  34403. 0x274d,
  34404. "a73",
  34405. 0x25a0,
  34406. "a74",
  34407. 0x274f,
  34408. "a203",
  34409. 0x2750,
  34410. "a75",
  34411. 0x2751,
  34412. "a204",
  34413. 0x2752,
  34414. "a76",
  34415. 0x25b2,
  34416. "a77",
  34417. 0x25bc,
  34418. "a78",
  34419. 0x25c6,
  34420. "a79",
  34421. 0x2756,
  34422. "a81",
  34423. 0x25d7,
  34424. "a82",
  34425. 0x2758,
  34426. "a83",
  34427. 0x2759,
  34428. "a84",
  34429. 0x275a,
  34430. "a97",
  34431. 0x275b,
  34432. "a98",
  34433. 0x275c,
  34434. "a99",
  34435. 0x275d,
  34436. "a100",
  34437. 0x275e,
  34438. "a101",
  34439. 0x2761,
  34440. "a102",
  34441. 0x2762,
  34442. "a103",
  34443. 0x2763,
  34444. "a104",
  34445. 0x2764,
  34446. "a106",
  34447. 0x2765,
  34448. "a107",
  34449. 0x2766,
  34450. "a108",
  34451. 0x2767,
  34452. "a112",
  34453. 0x2663,
  34454. "a111",
  34455. 0x2666,
  34456. "a110",
  34457. 0x2665,
  34458. "a109",
  34459. 0x2660,
  34460. "a120",
  34461. 0x2460,
  34462. "a121",
  34463. 0x2461,
  34464. "a122",
  34465. 0x2462,
  34466. "a123",
  34467. 0x2463,
  34468. "a124",
  34469. 0x2464,
  34470. "a125",
  34471. 0x2465,
  34472. "a126",
  34473. 0x2466,
  34474. "a127",
  34475. 0x2467,
  34476. "a128",
  34477. 0x2468,
  34478. "a129",
  34479. 0x2469,
  34480. "a130",
  34481. 0x2776,
  34482. "a131",
  34483. 0x2777,
  34484. "a132",
  34485. 0x2778,
  34486. "a133",
  34487. 0x2779,
  34488. "a134",
  34489. 0x277a,
  34490. "a135",
  34491. 0x277b,
  34492. "a136",
  34493. 0x277c,
  34494. "a137",
  34495. 0x277d,
  34496. "a138",
  34497. 0x277e,
  34498. "a139",
  34499. 0x277f,
  34500. "a140",
  34501. 0x2780,
  34502. "a141",
  34503. 0x2781,
  34504. "a142",
  34505. 0x2782,
  34506. "a143",
  34507. 0x2783,
  34508. "a144",
  34509. 0x2784,
  34510. "a145",
  34511. 0x2785,
  34512. "a146",
  34513. 0x2786,
  34514. "a147",
  34515. 0x2787,
  34516. "a148",
  34517. 0x2788,
  34518. "a149",
  34519. 0x2789,
  34520. "a150",
  34521. 0x278a,
  34522. "a151",
  34523. 0x278b,
  34524. "a152",
  34525. 0x278c,
  34526. "a153",
  34527. 0x278d,
  34528. "a154",
  34529. 0x278e,
  34530. "a155",
  34531. 0x278f,
  34532. "a156",
  34533. 0x2790,
  34534. "a157",
  34535. 0x2791,
  34536. "a158",
  34537. 0x2792,
  34538. "a159",
  34539. 0x2793,
  34540. "a160",
  34541. 0x2794,
  34542. "a161",
  34543. 0x2192,
  34544. "a163",
  34545. 0x2194,
  34546. "a164",
  34547. 0x2195,
  34548. "a196",
  34549. 0x2798,
  34550. "a165",
  34551. 0x2799,
  34552. "a192",
  34553. 0x279a,
  34554. "a166",
  34555. 0x279b,
  34556. "a167",
  34557. 0x279c,
  34558. "a168",
  34559. 0x279d,
  34560. "a169",
  34561. 0x279e,
  34562. "a170",
  34563. 0x279f,
  34564. "a171",
  34565. 0x27a0,
  34566. "a172",
  34567. 0x27a1,
  34568. "a173",
  34569. 0x27a2,
  34570. "a162",
  34571. 0x27a3,
  34572. "a174",
  34573. 0x27a4,
  34574. "a175",
  34575. 0x27a5,
  34576. "a176",
  34577. 0x27a6,
  34578. "a177",
  34579. 0x27a7,
  34580. "a178",
  34581. 0x27a8,
  34582. "a179",
  34583. 0x27a9,
  34584. "a193",
  34585. 0x27aa,
  34586. "a180",
  34587. 0x27ab,
  34588. "a199",
  34589. 0x27ac,
  34590. "a181",
  34591. 0x27ad,
  34592. "a200",
  34593. 0x27ae,
  34594. "a182",
  34595. 0x27af,
  34596. "a201",
  34597. 0x27b1,
  34598. "a183",
  34599. 0x27b2,
  34600. "a184",
  34601. 0x27b3,
  34602. "a197",
  34603. 0x27b4,
  34604. "a185",
  34605. 0x27b5,
  34606. "a194",
  34607. 0x27b6,
  34608. "a198",
  34609. 0x27b7,
  34610. "a186",
  34611. 0x27b8,
  34612. "a195",
  34613. 0x27b9,
  34614. "a187",
  34615. 0x27ba,
  34616. "a188",
  34617. 0x27bb,
  34618. "a189",
  34619. 0x27bc,
  34620. "a190",
  34621. 0x27bd,
  34622. "a191",
  34623. 0x27be,
  34624. "a89",
  34625. 0x2768,
  34626. "a90",
  34627. 0x2769,
  34628. "a93",
  34629. 0x276a,
  34630. "a94",
  34631. 0x276b,
  34632. "a91",
  34633. 0x276c,
  34634. "a92",
  34635. 0x276d,
  34636. "a205",
  34637. 0x276e,
  34638. "a85",
  34639. 0x276f,
  34640. "a206",
  34641. 0x2770,
  34642. "a86",
  34643. 0x2771,
  34644. "a87",
  34645. 0x2772,
  34646. "a88",
  34647. 0x2773,
  34648. "a95",
  34649. 0x2774,
  34650. "a96",
  34651. 0x2775,
  34652. ".notdef",
  34653. 0x0000
  34654. ];
  34655. });
  34656. /***/ }),
  34657. /* 34 */
  34658. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  34659. Object.defineProperty(exports, "__esModule", ({
  34660. value: true
  34661. }));
  34662. exports.getSymbolsFonts = exports.getSupplementalGlyphMapForCalibri = exports.getSupplementalGlyphMapForArialBlack = exports.getStdFontMap = exports.getSerifFonts = exports.getNonStdFontMap = exports.getGlyphMapForStandardFonts = void 0;
  34663. var _core_utils = __w_pdfjs_require__(8);
  34664. const getStdFontMap = (0, _core_utils.getLookupTableFactory)(function (t) {
  34665. t.ArialNarrow = "Helvetica";
  34666. t["ArialNarrow-Bold"] = "Helvetica-Bold";
  34667. t["ArialNarrow-BoldItalic"] = "Helvetica-BoldOblique";
  34668. t["ArialNarrow-Italic"] = "Helvetica-Oblique";
  34669. t.ArialBlack = "Helvetica";
  34670. t["ArialBlack-Bold"] = "Helvetica-Bold";
  34671. t["ArialBlack-BoldItalic"] = "Helvetica-BoldOblique";
  34672. t["ArialBlack-Italic"] = "Helvetica-Oblique";
  34673. t["Arial-Black"] = "Helvetica";
  34674. t["Arial-Black-Bold"] = "Helvetica-Bold";
  34675. t["Arial-Black-BoldItalic"] = "Helvetica-BoldOblique";
  34676. t["Arial-Black-Italic"] = "Helvetica-Oblique";
  34677. t.Arial = "Helvetica";
  34678. t["Arial-Bold"] = "Helvetica-Bold";
  34679. t["Arial-BoldItalic"] = "Helvetica-BoldOblique";
  34680. t["Arial-Italic"] = "Helvetica-Oblique";
  34681. t["Arial-BoldItalicMT"] = "Helvetica-BoldOblique";
  34682. t["Arial-BoldMT"] = "Helvetica-Bold";
  34683. t["Arial-ItalicMT"] = "Helvetica-Oblique";
  34684. t.ArialMT = "Helvetica";
  34685. t["Courier-Bold"] = "Courier-Bold";
  34686. t["Courier-BoldItalic"] = "Courier-BoldOblique";
  34687. t["Courier-Italic"] = "Courier-Oblique";
  34688. t.CourierNew = "Courier";
  34689. t["CourierNew-Bold"] = "Courier-Bold";
  34690. t["CourierNew-BoldItalic"] = "Courier-BoldOblique";
  34691. t["CourierNew-Italic"] = "Courier-Oblique";
  34692. t["CourierNewPS-BoldItalicMT"] = "Courier-BoldOblique";
  34693. t["CourierNewPS-BoldMT"] = "Courier-Bold";
  34694. t["CourierNewPS-ItalicMT"] = "Courier-Oblique";
  34695. t.CourierNewPSMT = "Courier";
  34696. t.Helvetica = "Helvetica";
  34697. t["Helvetica-Bold"] = "Helvetica-Bold";
  34698. t["Helvetica-BoldItalic"] = "Helvetica-BoldOblique";
  34699. t["Helvetica-BoldOblique"] = "Helvetica-BoldOblique";
  34700. t["Helvetica-Italic"] = "Helvetica-Oblique";
  34701. t["Helvetica-Oblique"] = "Helvetica-Oblique";
  34702. t["Symbol-Bold"] = "Symbol";
  34703. t["Symbol-BoldItalic"] = "Symbol";
  34704. t["Symbol-Italic"] = "Symbol";
  34705. t.TimesNewRoman = "Times-Roman";
  34706. t["TimesNewRoman-Bold"] = "Times-Bold";
  34707. t["TimesNewRoman-BoldItalic"] = "Times-BoldItalic";
  34708. t["TimesNewRoman-Italic"] = "Times-Italic";
  34709. t.TimesNewRomanPS = "Times-Roman";
  34710. t["TimesNewRomanPS-Bold"] = "Times-Bold";
  34711. t["TimesNewRomanPS-BoldItalic"] = "Times-BoldItalic";
  34712. t["TimesNewRomanPS-BoldItalicMT"] = "Times-BoldItalic";
  34713. t["TimesNewRomanPS-BoldMT"] = "Times-Bold";
  34714. t["TimesNewRomanPS-Italic"] = "Times-Italic";
  34715. t["TimesNewRomanPS-ItalicMT"] = "Times-Italic";
  34716. t.TimesNewRomanPSMT = "Times-Roman";
  34717. t["TimesNewRomanPSMT-Bold"] = "Times-Bold";
  34718. t["TimesNewRomanPSMT-BoldItalic"] = "Times-BoldItalic";
  34719. t["TimesNewRomanPSMT-Italic"] = "Times-Italic";
  34720. });
  34721. exports.getStdFontMap = getStdFontMap;
  34722. const getNonStdFontMap = (0, _core_utils.getLookupTableFactory)(function (t) {
  34723. t.Calibri = "Helvetica";
  34724. t["Calibri-Bold"] = "Helvetica-Bold";
  34725. t["Calibri-BoldItalic"] = "Helvetica-BoldOblique";
  34726. t["Calibri-Italic"] = "Helvetica-Oblique";
  34727. t.CenturyGothic = "Helvetica";
  34728. t["CenturyGothic-Bold"] = "Helvetica-Bold";
  34729. t["CenturyGothic-BoldItalic"] = "Helvetica-BoldOblique";
  34730. t["CenturyGothic-Italic"] = "Helvetica-Oblique";
  34731. t.ComicSansMS = "Comic Sans MS";
  34732. t["ComicSansMS-Bold"] = "Comic Sans MS-Bold";
  34733. t["ComicSansMS-BoldItalic"] = "Comic Sans MS-BoldItalic";
  34734. t["ComicSansMS-Italic"] = "Comic Sans MS-Italic";
  34735. t.LucidaConsole = "Courier";
  34736. t["LucidaConsole-Bold"] = "Courier-Bold";
  34737. t["LucidaConsole-BoldItalic"] = "Courier-BoldOblique";
  34738. t["LucidaConsole-Italic"] = "Courier-Oblique";
  34739. t["LucidaSans-Demi"] = "Helvetica-Bold";
  34740. t["MS-Gothic"] = "MS Gothic";
  34741. t["MS-Gothic-Bold"] = "MS Gothic-Bold";
  34742. t["MS-Gothic-BoldItalic"] = "MS Gothic-BoldItalic";
  34743. t["MS-Gothic-Italic"] = "MS Gothic-Italic";
  34744. t["MS-Mincho"] = "MS Mincho";
  34745. t["MS-Mincho-Bold"] = "MS Mincho-Bold";
  34746. t["MS-Mincho-BoldItalic"] = "MS Mincho-BoldItalic";
  34747. t["MS-Mincho-Italic"] = "MS Mincho-Italic";
  34748. t["MS-PGothic"] = "MS PGothic";
  34749. t["MS-PGothic-Bold"] = "MS PGothic-Bold";
  34750. t["MS-PGothic-BoldItalic"] = "MS PGothic-BoldItalic";
  34751. t["MS-PGothic-Italic"] = "MS PGothic-Italic";
  34752. t["MS-PMincho"] = "MS PMincho";
  34753. t["MS-PMincho-Bold"] = "MS PMincho-Bold";
  34754. t["MS-PMincho-BoldItalic"] = "MS PMincho-BoldItalic";
  34755. t["MS-PMincho-Italic"] = "MS PMincho-Italic";
  34756. t.NuptialScript = "Times-Italic";
  34757. t.SegoeUISymbol = "Helvetica";
  34758. t.Wingdings = "ZapfDingbats";
  34759. t["Wingdings-Regular"] = "ZapfDingbats";
  34760. });
  34761. exports.getNonStdFontMap = getNonStdFontMap;
  34762. const getSerifFonts = (0, _core_utils.getLookupTableFactory)(function (t) {
  34763. t["Adobe Jenson"] = true;
  34764. t["Adobe Text"] = true;
  34765. t.Albertus = true;
  34766. t.Aldus = true;
  34767. t.Alexandria = true;
  34768. t.Algerian = true;
  34769. t["American Typewriter"] = true;
  34770. t.Antiqua = true;
  34771. t.Apex = true;
  34772. t.Arno = true;
  34773. t.Aster = true;
  34774. t.Aurora = true;
  34775. t.Baskerville = true;
  34776. t.Bell = true;
  34777. t.Bembo = true;
  34778. t["Bembo Schoolbook"] = true;
  34779. t.Benguiat = true;
  34780. t["Berkeley Old Style"] = true;
  34781. t["Bernhard Modern"] = true;
  34782. t["Berthold City"] = true;
  34783. t.Bodoni = true;
  34784. t["Bauer Bodoni"] = true;
  34785. t["Book Antiqua"] = true;
  34786. t.Bookman = true;
  34787. t["Bordeaux Roman"] = true;
  34788. t["Californian FB"] = true;
  34789. t.Calisto = true;
  34790. t.Calvert = true;
  34791. t.Capitals = true;
  34792. t.Cambria = true;
  34793. t.Cartier = true;
  34794. t.Caslon = true;
  34795. t.Catull = true;
  34796. t.Centaur = true;
  34797. t["Century Old Style"] = true;
  34798. t["Century Schoolbook"] = true;
  34799. t.Chaparral = true;
  34800. t["Charis SIL"] = true;
  34801. t.Cheltenham = true;
  34802. t["Cholla Slab"] = true;
  34803. t.Clarendon = true;
  34804. t.Clearface = true;
  34805. t.Cochin = true;
  34806. t.Colonna = true;
  34807. t["Computer Modern"] = true;
  34808. t["Concrete Roman"] = true;
  34809. t.Constantia = true;
  34810. t["Cooper Black"] = true;
  34811. t.Corona = true;
  34812. t.Ecotype = true;
  34813. t.Egyptienne = true;
  34814. t.Elephant = true;
  34815. t.Excelsior = true;
  34816. t.Fairfield = true;
  34817. t["FF Scala"] = true;
  34818. t.Folkard = true;
  34819. t.Footlight = true;
  34820. t.FreeSerif = true;
  34821. t["Friz Quadrata"] = true;
  34822. t.Garamond = true;
  34823. t.Gentium = true;
  34824. t.Georgia = true;
  34825. t.Gloucester = true;
  34826. t["Goudy Old Style"] = true;
  34827. t["Goudy Schoolbook"] = true;
  34828. t["Goudy Pro Font"] = true;
  34829. t.Granjon = true;
  34830. t["Guardian Egyptian"] = true;
  34831. t.Heather = true;
  34832. t.Hercules = true;
  34833. t["High Tower Text"] = true;
  34834. t.Hiroshige = true;
  34835. t["Hoefler Text"] = true;
  34836. t["Humana Serif"] = true;
  34837. t.Imprint = true;
  34838. t["Ionic No. 5"] = true;
  34839. t.Janson = true;
  34840. t.Joanna = true;
  34841. t.Korinna = true;
  34842. t.Lexicon = true;
  34843. t["Liberation Serif"] = true;
  34844. t["Linux Libertine"] = true;
  34845. t.Literaturnaya = true;
  34846. t.Lucida = true;
  34847. t["Lucida Bright"] = true;
  34848. t.Melior = true;
  34849. t.Memphis = true;
  34850. t.Miller = true;
  34851. t.Minion = true;
  34852. t.Modern = true;
  34853. t["Mona Lisa"] = true;
  34854. t["Mrs Eaves"] = true;
  34855. t["MS Serif"] = true;
  34856. t["Museo Slab"] = true;
  34857. t["New York"] = true;
  34858. t["Nimbus Roman"] = true;
  34859. t["NPS Rawlinson Roadway"] = true;
  34860. t.NuptialScript = true;
  34861. t.Palatino = true;
  34862. t.Perpetua = true;
  34863. t.Plantin = true;
  34864. t["Plantin Schoolbook"] = true;
  34865. t.Playbill = true;
  34866. t["Poor Richard"] = true;
  34867. t["Rawlinson Roadway"] = true;
  34868. t.Renault = true;
  34869. t.Requiem = true;
  34870. t.Rockwell = true;
  34871. t.Roman = true;
  34872. t["Rotis Serif"] = true;
  34873. t.Sabon = true;
  34874. t.Scala = true;
  34875. t.Seagull = true;
  34876. t.Sistina = true;
  34877. t.Souvenir = true;
  34878. t.STIX = true;
  34879. t["Stone Informal"] = true;
  34880. t["Stone Serif"] = true;
  34881. t.Sylfaen = true;
  34882. t.Times = true;
  34883. t.Trajan = true;
  34884. t["Trinité"] = true;
  34885. t["Trump Mediaeval"] = true;
  34886. t.Utopia = true;
  34887. t["Vale Type"] = true;
  34888. t["Bitstream Vera"] = true;
  34889. t["Vera Serif"] = true;
  34890. t.Versailles = true;
  34891. t.Wanted = true;
  34892. t.Weiss = true;
  34893. t["Wide Latin"] = true;
  34894. t.Windsor = true;
  34895. t.XITS = true;
  34896. });
  34897. exports.getSerifFonts = getSerifFonts;
  34898. const getSymbolsFonts = (0, _core_utils.getLookupTableFactory)(function (t) {
  34899. t.Dingbats = true;
  34900. t.Symbol = true;
  34901. t.ZapfDingbats = true;
  34902. });
  34903. exports.getSymbolsFonts = getSymbolsFonts;
  34904. const getGlyphMapForStandardFonts = (0, _core_utils.getLookupTableFactory)(function (t) {
  34905. t[2] = 10;
  34906. t[3] = 32;
  34907. t[4] = 33;
  34908. t[5] = 34;
  34909. t[6] = 35;
  34910. t[7] = 36;
  34911. t[8] = 37;
  34912. t[9] = 38;
  34913. t[10] = 39;
  34914. t[11] = 40;
  34915. t[12] = 41;
  34916. t[13] = 42;
  34917. t[14] = 43;
  34918. t[15] = 44;
  34919. t[16] = 45;
  34920. t[17] = 46;
  34921. t[18] = 47;
  34922. t[19] = 48;
  34923. t[20] = 49;
  34924. t[21] = 50;
  34925. t[22] = 51;
  34926. t[23] = 52;
  34927. t[24] = 53;
  34928. t[25] = 54;
  34929. t[26] = 55;
  34930. t[27] = 56;
  34931. t[28] = 57;
  34932. t[29] = 58;
  34933. t[30] = 894;
  34934. t[31] = 60;
  34935. t[32] = 61;
  34936. t[33] = 62;
  34937. t[34] = 63;
  34938. t[35] = 64;
  34939. t[36] = 65;
  34940. t[37] = 66;
  34941. t[38] = 67;
  34942. t[39] = 68;
  34943. t[40] = 69;
  34944. t[41] = 70;
  34945. t[42] = 71;
  34946. t[43] = 72;
  34947. t[44] = 73;
  34948. t[45] = 74;
  34949. t[46] = 75;
  34950. t[47] = 76;
  34951. t[48] = 77;
  34952. t[49] = 78;
  34953. t[50] = 79;
  34954. t[51] = 80;
  34955. t[52] = 81;
  34956. t[53] = 82;
  34957. t[54] = 83;
  34958. t[55] = 84;
  34959. t[56] = 85;
  34960. t[57] = 86;
  34961. t[58] = 87;
  34962. t[59] = 88;
  34963. t[60] = 89;
  34964. t[61] = 90;
  34965. t[62] = 91;
  34966. t[63] = 92;
  34967. t[64] = 93;
  34968. t[65] = 94;
  34969. t[66] = 95;
  34970. t[67] = 96;
  34971. t[68] = 97;
  34972. t[69] = 98;
  34973. t[70] = 99;
  34974. t[71] = 100;
  34975. t[72] = 101;
  34976. t[73] = 102;
  34977. t[74] = 103;
  34978. t[75] = 104;
  34979. t[76] = 105;
  34980. t[77] = 106;
  34981. t[78] = 107;
  34982. t[79] = 108;
  34983. t[80] = 109;
  34984. t[81] = 110;
  34985. t[82] = 111;
  34986. t[83] = 112;
  34987. t[84] = 113;
  34988. t[85] = 114;
  34989. t[86] = 115;
  34990. t[87] = 116;
  34991. t[88] = 117;
  34992. t[89] = 118;
  34993. t[90] = 119;
  34994. t[91] = 120;
  34995. t[92] = 121;
  34996. t[93] = 122;
  34997. t[94] = 123;
  34998. t[95] = 124;
  34999. t[96] = 125;
  35000. t[97] = 126;
  35001. t[98] = 196;
  35002. t[99] = 197;
  35003. t[100] = 199;
  35004. t[101] = 201;
  35005. t[102] = 209;
  35006. t[103] = 214;
  35007. t[104] = 220;
  35008. t[105] = 225;
  35009. t[106] = 224;
  35010. t[107] = 226;
  35011. t[108] = 228;
  35012. t[109] = 227;
  35013. t[110] = 229;
  35014. t[111] = 231;
  35015. t[112] = 233;
  35016. t[113] = 232;
  35017. t[114] = 234;
  35018. t[115] = 235;
  35019. t[116] = 237;
  35020. t[117] = 236;
  35021. t[118] = 238;
  35022. t[119] = 239;
  35023. t[120] = 241;
  35024. t[121] = 243;
  35025. t[122] = 242;
  35026. t[123] = 244;
  35027. t[124] = 246;
  35028. t[125] = 245;
  35029. t[126] = 250;
  35030. t[127] = 249;
  35031. t[128] = 251;
  35032. t[129] = 252;
  35033. t[130] = 8224;
  35034. t[131] = 176;
  35035. t[132] = 162;
  35036. t[133] = 163;
  35037. t[134] = 167;
  35038. t[135] = 8226;
  35039. t[136] = 182;
  35040. t[137] = 223;
  35041. t[138] = 174;
  35042. t[139] = 169;
  35043. t[140] = 8482;
  35044. t[141] = 180;
  35045. t[142] = 168;
  35046. t[143] = 8800;
  35047. t[144] = 198;
  35048. t[145] = 216;
  35049. t[146] = 8734;
  35050. t[147] = 177;
  35051. t[148] = 8804;
  35052. t[149] = 8805;
  35053. t[150] = 165;
  35054. t[151] = 181;
  35055. t[152] = 8706;
  35056. t[153] = 8721;
  35057. t[154] = 8719;
  35058. t[156] = 8747;
  35059. t[157] = 170;
  35060. t[158] = 186;
  35061. t[159] = 8486;
  35062. t[160] = 230;
  35063. t[161] = 248;
  35064. t[162] = 191;
  35065. t[163] = 161;
  35066. t[164] = 172;
  35067. t[165] = 8730;
  35068. t[166] = 402;
  35069. t[167] = 8776;
  35070. t[168] = 8710;
  35071. t[169] = 171;
  35072. t[170] = 187;
  35073. t[171] = 8230;
  35074. t[210] = 218;
  35075. t[223] = 711;
  35076. t[224] = 321;
  35077. t[225] = 322;
  35078. t[227] = 353;
  35079. t[229] = 382;
  35080. t[234] = 253;
  35081. t[252] = 263;
  35082. t[253] = 268;
  35083. t[254] = 269;
  35084. t[258] = 258;
  35085. t[260] = 260;
  35086. t[261] = 261;
  35087. t[265] = 280;
  35088. t[266] = 281;
  35089. t[268] = 283;
  35090. t[269] = 313;
  35091. t[275] = 323;
  35092. t[276] = 324;
  35093. t[278] = 328;
  35094. t[284] = 345;
  35095. t[285] = 346;
  35096. t[286] = 347;
  35097. t[292] = 367;
  35098. t[295] = 377;
  35099. t[296] = 378;
  35100. t[298] = 380;
  35101. t[305] = 963;
  35102. t[306] = 964;
  35103. t[307] = 966;
  35104. t[308] = 8215;
  35105. t[309] = 8252;
  35106. t[310] = 8319;
  35107. t[311] = 8359;
  35108. t[312] = 8592;
  35109. t[313] = 8593;
  35110. t[337] = 9552;
  35111. t[493] = 1039;
  35112. t[494] = 1040;
  35113. t[705] = 1524;
  35114. t[706] = 8362;
  35115. t[710] = 64288;
  35116. t[711] = 64298;
  35117. t[759] = 1617;
  35118. t[761] = 1776;
  35119. t[763] = 1778;
  35120. t[775] = 1652;
  35121. t[777] = 1764;
  35122. t[778] = 1780;
  35123. t[779] = 1781;
  35124. t[780] = 1782;
  35125. t[782] = 771;
  35126. t[783] = 64726;
  35127. t[786] = 8363;
  35128. t[788] = 8532;
  35129. t[790] = 768;
  35130. t[791] = 769;
  35131. t[792] = 768;
  35132. t[795] = 803;
  35133. t[797] = 64336;
  35134. t[798] = 64337;
  35135. t[799] = 64342;
  35136. t[800] = 64343;
  35137. t[801] = 64344;
  35138. t[802] = 64345;
  35139. t[803] = 64362;
  35140. t[804] = 64363;
  35141. t[805] = 64364;
  35142. t[2424] = 7821;
  35143. t[2425] = 7822;
  35144. t[2426] = 7823;
  35145. t[2427] = 7824;
  35146. t[2428] = 7825;
  35147. t[2429] = 7826;
  35148. t[2430] = 7827;
  35149. t[2433] = 7682;
  35150. t[2678] = 8045;
  35151. t[2679] = 8046;
  35152. t[2830] = 1552;
  35153. t[2838] = 686;
  35154. t[2840] = 751;
  35155. t[2842] = 753;
  35156. t[2843] = 754;
  35157. t[2844] = 755;
  35158. t[2846] = 757;
  35159. t[2856] = 767;
  35160. t[2857] = 848;
  35161. t[2858] = 849;
  35162. t[2862] = 853;
  35163. t[2863] = 854;
  35164. t[2864] = 855;
  35165. t[2865] = 861;
  35166. t[2866] = 862;
  35167. t[2906] = 7460;
  35168. t[2908] = 7462;
  35169. t[2909] = 7463;
  35170. t[2910] = 7464;
  35171. t[2912] = 7466;
  35172. t[2913] = 7467;
  35173. t[2914] = 7468;
  35174. t[2916] = 7470;
  35175. t[2917] = 7471;
  35176. t[2918] = 7472;
  35177. t[2920] = 7474;
  35178. t[2921] = 7475;
  35179. t[2922] = 7476;
  35180. t[2924] = 7478;
  35181. t[2925] = 7479;
  35182. t[2926] = 7480;
  35183. t[2928] = 7482;
  35184. t[2929] = 7483;
  35185. t[2930] = 7484;
  35186. t[2932] = 7486;
  35187. t[2933] = 7487;
  35188. t[2934] = 7488;
  35189. t[2936] = 7490;
  35190. t[2937] = 7491;
  35191. t[2938] = 7492;
  35192. t[2940] = 7494;
  35193. t[2941] = 7495;
  35194. t[2942] = 7496;
  35195. t[2944] = 7498;
  35196. t[2946] = 7500;
  35197. t[2948] = 7502;
  35198. t[2950] = 7504;
  35199. t[2951] = 7505;
  35200. t[2952] = 7506;
  35201. t[2954] = 7508;
  35202. t[2955] = 7509;
  35203. t[2956] = 7510;
  35204. t[2958] = 7512;
  35205. t[2959] = 7513;
  35206. t[2960] = 7514;
  35207. t[2962] = 7516;
  35208. t[2963] = 7517;
  35209. t[2964] = 7518;
  35210. t[2966] = 7520;
  35211. t[2967] = 7521;
  35212. t[2968] = 7522;
  35213. t[2970] = 7524;
  35214. t[2971] = 7525;
  35215. t[2972] = 7526;
  35216. t[2974] = 7528;
  35217. t[2975] = 7529;
  35218. t[2976] = 7530;
  35219. t[2978] = 1537;
  35220. t[2979] = 1538;
  35221. t[2980] = 1539;
  35222. t[2982] = 1549;
  35223. t[2983] = 1551;
  35224. t[2984] = 1552;
  35225. t[2986] = 1554;
  35226. t[2987] = 1555;
  35227. t[2988] = 1556;
  35228. t[2990] = 1623;
  35229. t[2991] = 1624;
  35230. t[2995] = 1775;
  35231. t[2999] = 1791;
  35232. t[3002] = 64290;
  35233. t[3003] = 64291;
  35234. t[3004] = 64292;
  35235. t[3006] = 64294;
  35236. t[3007] = 64295;
  35237. t[3008] = 64296;
  35238. t[3011] = 1900;
  35239. t[3014] = 8223;
  35240. t[3015] = 8244;
  35241. t[3017] = 7532;
  35242. t[3018] = 7533;
  35243. t[3019] = 7534;
  35244. t[3075] = 7590;
  35245. t[3076] = 7591;
  35246. t[3079] = 7594;
  35247. t[3080] = 7595;
  35248. t[3083] = 7598;
  35249. t[3084] = 7599;
  35250. t[3087] = 7602;
  35251. t[3088] = 7603;
  35252. t[3091] = 7606;
  35253. t[3092] = 7607;
  35254. t[3095] = 7610;
  35255. t[3096] = 7611;
  35256. t[3099] = 7614;
  35257. t[3100] = 7615;
  35258. t[3103] = 7618;
  35259. t[3104] = 7619;
  35260. t[3107] = 8337;
  35261. t[3108] = 8338;
  35262. t[3116] = 1884;
  35263. t[3119] = 1885;
  35264. t[3120] = 1885;
  35265. t[3123] = 1886;
  35266. t[3124] = 1886;
  35267. t[3127] = 1887;
  35268. t[3128] = 1887;
  35269. t[3131] = 1888;
  35270. t[3132] = 1888;
  35271. t[3135] = 1889;
  35272. t[3136] = 1889;
  35273. t[3139] = 1890;
  35274. t[3140] = 1890;
  35275. t[3143] = 1891;
  35276. t[3144] = 1891;
  35277. t[3147] = 1892;
  35278. t[3148] = 1892;
  35279. t[3153] = 580;
  35280. t[3154] = 581;
  35281. t[3157] = 584;
  35282. t[3158] = 585;
  35283. t[3161] = 588;
  35284. t[3162] = 589;
  35285. t[3165] = 891;
  35286. t[3166] = 892;
  35287. t[3169] = 1274;
  35288. t[3170] = 1275;
  35289. t[3173] = 1278;
  35290. t[3174] = 1279;
  35291. t[3181] = 7622;
  35292. t[3182] = 7623;
  35293. t[3282] = 11799;
  35294. t[3316] = 578;
  35295. t[3379] = 42785;
  35296. t[3393] = 1159;
  35297. t[3416] = 8377;
  35298. });
  35299. exports.getGlyphMapForStandardFonts = getGlyphMapForStandardFonts;
  35300. const getSupplementalGlyphMapForArialBlack = (0, _core_utils.getLookupTableFactory)(function (t) {
  35301. t[227] = 322;
  35302. t[264] = 261;
  35303. t[291] = 346;
  35304. });
  35305. exports.getSupplementalGlyphMapForArialBlack = getSupplementalGlyphMapForArialBlack;
  35306. const getSupplementalGlyphMapForCalibri = (0, _core_utils.getLookupTableFactory)(function (t) {
  35307. t[1] = 32;
  35308. t[4] = 65;
  35309. t[17] = 66;
  35310. t[18] = 67;
  35311. t[24] = 68;
  35312. t[28] = 69;
  35313. t[38] = 70;
  35314. t[39] = 71;
  35315. t[44] = 72;
  35316. t[47] = 73;
  35317. t[58] = 74;
  35318. t[60] = 75;
  35319. t[62] = 76;
  35320. t[68] = 77;
  35321. t[69] = 78;
  35322. t[75] = 79;
  35323. t[87] = 80;
  35324. t[89] = 81;
  35325. t[90] = 82;
  35326. t[94] = 83;
  35327. t[100] = 84;
  35328. t[104] = 85;
  35329. t[115] = 86;
  35330. t[116] = 87;
  35331. t[121] = 88;
  35332. t[122] = 89;
  35333. t[127] = 90;
  35334. t[258] = 97;
  35335. t[268] = 261;
  35336. t[271] = 98;
  35337. t[272] = 99;
  35338. t[273] = 263;
  35339. t[282] = 100;
  35340. t[286] = 101;
  35341. t[295] = 281;
  35342. t[296] = 102;
  35343. t[336] = 103;
  35344. t[346] = 104;
  35345. t[349] = 105;
  35346. t[361] = 106;
  35347. t[364] = 107;
  35348. t[367] = 108;
  35349. t[371] = 322;
  35350. t[373] = 109;
  35351. t[374] = 110;
  35352. t[381] = 111;
  35353. t[383] = 243;
  35354. t[393] = 112;
  35355. t[395] = 113;
  35356. t[396] = 114;
  35357. t[400] = 115;
  35358. t[401] = 347;
  35359. t[410] = 116;
  35360. t[437] = 117;
  35361. t[448] = 118;
  35362. t[449] = 119;
  35363. t[454] = 120;
  35364. t[455] = 121;
  35365. t[460] = 122;
  35366. t[463] = 380;
  35367. t[853] = 44;
  35368. t[855] = 58;
  35369. t[856] = 46;
  35370. t[876] = 47;
  35371. t[878] = 45;
  35372. t[882] = 45;
  35373. t[894] = 40;
  35374. t[895] = 41;
  35375. t[896] = 91;
  35376. t[897] = 93;
  35377. t[923] = 64;
  35378. t[1004] = 48;
  35379. t[1005] = 49;
  35380. t[1006] = 50;
  35381. t[1007] = 51;
  35382. t[1008] = 52;
  35383. t[1009] = 53;
  35384. t[1010] = 54;
  35385. t[1011] = 55;
  35386. t[1012] = 56;
  35387. t[1013] = 57;
  35388. t[1081] = 37;
  35389. t[1085] = 43;
  35390. t[1086] = 45;
  35391. });
  35392. exports.getSupplementalGlyphMapForCalibri = getSupplementalGlyphMapForCalibri;
  35393. /***/ }),
  35394. /* 35 */
  35395. /***/ ((__unused_webpack_module, __webpack_exports__, __w_pdfjs_require__) => {
  35396. __w_pdfjs_require__.r(__webpack_exports__);
  35397. /* harmony export */ __w_pdfjs_require__.d(__webpack_exports__, {
  35398. /* harmony export */ "getNormalizedUnicodes": () => /* binding */ getNormalizedUnicodes,
  35399. /* harmony export */ "getUnicodeForGlyph": () => /* binding */ getUnicodeForGlyph,
  35400. /* harmony export */ "getUnicodeRangeFor": () => /* binding */ getUnicodeRangeFor,
  35401. /* harmony export */ "mapSpecialUnicodeValues": () => /* binding */ mapSpecialUnicodeValues,
  35402. /* harmony export */ "reverseIfRtl": () => /* binding */ reverseIfRtl
  35403. /* harmony export */ });
  35404. /* harmony import */ var _core_utils_js__WEBPACK_IMPORTED_MODULE_0__ = __w_pdfjs_require__(8);
  35405. var getSpecialPUASymbols = (0,_core_utils_js__WEBPACK_IMPORTED_MODULE_0__.getLookupTableFactory)(function (t) {
  35406. t[63721] = 0x00a9;
  35407. t[63193] = 0x00a9;
  35408. t[63720] = 0x00ae;
  35409. t[63194] = 0x00ae;
  35410. t[63722] = 0x2122;
  35411. t[63195] = 0x2122;
  35412. t[63729] = 0x23a7;
  35413. t[63730] = 0x23a8;
  35414. t[63731] = 0x23a9;
  35415. t[63740] = 0x23ab;
  35416. t[63741] = 0x23ac;
  35417. t[63742] = 0x23ad;
  35418. t[63726] = 0x23a1;
  35419. t[63727] = 0x23a2;
  35420. t[63728] = 0x23a3;
  35421. t[63737] = 0x23a4;
  35422. t[63738] = 0x23a5;
  35423. t[63739] = 0x23a6;
  35424. t[63723] = 0x239b;
  35425. t[63724] = 0x239c;
  35426. t[63725] = 0x239d;
  35427. t[63734] = 0x239e;
  35428. t[63735] = 0x239f;
  35429. t[63736] = 0x23a0;
  35430. });
  35431. function mapSpecialUnicodeValues(code) {
  35432. if (code >= 0xfff0 && code <= 0xffff) {
  35433. return 0;
  35434. } else if (code >= 0xf600 && code <= 0xf8ff) {
  35435. return getSpecialPUASymbols()[code] || code;
  35436. } else if (code === 0x00ad) {
  35437. return 0x002d;
  35438. }
  35439. return code;
  35440. }
  35441. function getUnicodeForGlyph(name, glyphsUnicodeMap) {
  35442. var unicode = glyphsUnicodeMap[name];
  35443. if (unicode !== undefined) {
  35444. return unicode;
  35445. }
  35446. if (!name) {
  35447. return -1;
  35448. }
  35449. if (name[0] === "u") {
  35450. var nameLen = name.length, hexStr;
  35451. if (nameLen === 7 && name[1] === "n" && name[2] === "i") {
  35452. hexStr = name.substring(3);
  35453. } else if (nameLen >= 5 && nameLen <= 7) {
  35454. hexStr = name.substring(1);
  35455. } else {
  35456. return -1;
  35457. }
  35458. if (hexStr === hexStr.toUpperCase()) {
  35459. unicode = parseInt(hexStr, 16);
  35460. if (unicode >= 0) {
  35461. return unicode;
  35462. }
  35463. }
  35464. }
  35465. return -1;
  35466. }
  35467. var UnicodeRanges = [
  35468. {
  35469. begin: 0x0000,
  35470. end: 0x007f
  35471. },
  35472. {
  35473. begin: 0x0080,
  35474. end: 0x00ff
  35475. },
  35476. {
  35477. begin: 0x0100,
  35478. end: 0x017f
  35479. },
  35480. {
  35481. begin: 0x0180,
  35482. end: 0x024f
  35483. },
  35484. {
  35485. begin: 0x0250,
  35486. end: 0x02af
  35487. },
  35488. {
  35489. begin: 0x02b0,
  35490. end: 0x02ff
  35491. },
  35492. {
  35493. begin: 0x0300,
  35494. end: 0x036f
  35495. },
  35496. {
  35497. begin: 0x0370,
  35498. end: 0x03ff
  35499. },
  35500. {
  35501. begin: 0x2c80,
  35502. end: 0x2cff
  35503. },
  35504. {
  35505. begin: 0x0400,
  35506. end: 0x04ff
  35507. },
  35508. {
  35509. begin: 0x0530,
  35510. end: 0x058f
  35511. },
  35512. {
  35513. begin: 0x0590,
  35514. end: 0x05ff
  35515. },
  35516. {
  35517. begin: 0xa500,
  35518. end: 0xa63f
  35519. },
  35520. {
  35521. begin: 0x0600,
  35522. end: 0x06ff
  35523. },
  35524. {
  35525. begin: 0x07c0,
  35526. end: 0x07ff
  35527. },
  35528. {
  35529. begin: 0x0900,
  35530. end: 0x097f
  35531. },
  35532. {
  35533. begin: 0x0980,
  35534. end: 0x09ff
  35535. },
  35536. {
  35537. begin: 0x0a00,
  35538. end: 0x0a7f
  35539. },
  35540. {
  35541. begin: 0x0a80,
  35542. end: 0x0aff
  35543. },
  35544. {
  35545. begin: 0x0b00,
  35546. end: 0x0b7f
  35547. },
  35548. {
  35549. begin: 0x0b80,
  35550. end: 0x0bff
  35551. },
  35552. {
  35553. begin: 0x0c00,
  35554. end: 0x0c7f
  35555. },
  35556. {
  35557. begin: 0x0c80,
  35558. end: 0x0cff
  35559. },
  35560. {
  35561. begin: 0x0d00,
  35562. end: 0x0d7f
  35563. },
  35564. {
  35565. begin: 0x0e00,
  35566. end: 0x0e7f
  35567. },
  35568. {
  35569. begin: 0x0e80,
  35570. end: 0x0eff
  35571. },
  35572. {
  35573. begin: 0x10a0,
  35574. end: 0x10ff
  35575. },
  35576. {
  35577. begin: 0x1b00,
  35578. end: 0x1b7f
  35579. },
  35580. {
  35581. begin: 0x1100,
  35582. end: 0x11ff
  35583. },
  35584. {
  35585. begin: 0x1e00,
  35586. end: 0x1eff
  35587. },
  35588. {
  35589. begin: 0x1f00,
  35590. end: 0x1fff
  35591. },
  35592. {
  35593. begin: 0x2000,
  35594. end: 0x206f
  35595. },
  35596. {
  35597. begin: 0x2070,
  35598. end: 0x209f
  35599. },
  35600. {
  35601. begin: 0x20a0,
  35602. end: 0x20cf
  35603. },
  35604. {
  35605. begin: 0x20d0,
  35606. end: 0x20ff
  35607. },
  35608. {
  35609. begin: 0x2100,
  35610. end: 0x214f
  35611. },
  35612. {
  35613. begin: 0x2150,
  35614. end: 0x218f
  35615. },
  35616. {
  35617. begin: 0x2190,
  35618. end: 0x21ff
  35619. },
  35620. {
  35621. begin: 0x2200,
  35622. end: 0x22ff
  35623. },
  35624. {
  35625. begin: 0x2300,
  35626. end: 0x23ff
  35627. },
  35628. {
  35629. begin: 0x2400,
  35630. end: 0x243f
  35631. },
  35632. {
  35633. begin: 0x2440,
  35634. end: 0x245f
  35635. },
  35636. {
  35637. begin: 0x2460,
  35638. end: 0x24ff
  35639. },
  35640. {
  35641. begin: 0x2500,
  35642. end: 0x257f
  35643. },
  35644. {
  35645. begin: 0x2580,
  35646. end: 0x259f
  35647. },
  35648. {
  35649. begin: 0x25a0,
  35650. end: 0x25ff
  35651. },
  35652. {
  35653. begin: 0x2600,
  35654. end: 0x26ff
  35655. },
  35656. {
  35657. begin: 0x2700,
  35658. end: 0x27bf
  35659. },
  35660. {
  35661. begin: 0x3000,
  35662. end: 0x303f
  35663. },
  35664. {
  35665. begin: 0x3040,
  35666. end: 0x309f
  35667. },
  35668. {
  35669. begin: 0x30a0,
  35670. end: 0x30ff
  35671. },
  35672. {
  35673. begin: 0x3100,
  35674. end: 0x312f
  35675. },
  35676. {
  35677. begin: 0x3130,
  35678. end: 0x318f
  35679. },
  35680. {
  35681. begin: 0xa840,
  35682. end: 0xa87f
  35683. },
  35684. {
  35685. begin: 0x3200,
  35686. end: 0x32ff
  35687. },
  35688. {
  35689. begin: 0x3300,
  35690. end: 0x33ff
  35691. },
  35692. {
  35693. begin: 0xac00,
  35694. end: 0xd7af
  35695. },
  35696. {
  35697. begin: 0xd800,
  35698. end: 0xdfff
  35699. },
  35700. {
  35701. begin: 0x10900,
  35702. end: 0x1091f
  35703. },
  35704. {
  35705. begin: 0x4e00,
  35706. end: 0x9fff
  35707. },
  35708. {
  35709. begin: 0xe000,
  35710. end: 0xf8ff
  35711. },
  35712. {
  35713. begin: 0x31c0,
  35714. end: 0x31ef
  35715. },
  35716. {
  35717. begin: 0xfb00,
  35718. end: 0xfb4f
  35719. },
  35720. {
  35721. begin: 0xfb50,
  35722. end: 0xfdff
  35723. },
  35724. {
  35725. begin: 0xfe20,
  35726. end: 0xfe2f
  35727. },
  35728. {
  35729. begin: 0xfe10,
  35730. end: 0xfe1f
  35731. },
  35732. {
  35733. begin: 0xfe50,
  35734. end: 0xfe6f
  35735. },
  35736. {
  35737. begin: 0xfe70,
  35738. end: 0xfeff
  35739. },
  35740. {
  35741. begin: 0xff00,
  35742. end: 0xffef
  35743. },
  35744. {
  35745. begin: 0xfff0,
  35746. end: 0xffff
  35747. },
  35748. {
  35749. begin: 0x0f00,
  35750. end: 0x0fff
  35751. },
  35752. {
  35753. begin: 0x0700,
  35754. end: 0x074f
  35755. },
  35756. {
  35757. begin: 0x0780,
  35758. end: 0x07bf
  35759. },
  35760. {
  35761. begin: 0x0d80,
  35762. end: 0x0dff
  35763. },
  35764. {
  35765. begin: 0x1000,
  35766. end: 0x109f
  35767. },
  35768. {
  35769. begin: 0x1200,
  35770. end: 0x137f
  35771. },
  35772. {
  35773. begin: 0x13a0,
  35774. end: 0x13ff
  35775. },
  35776. {
  35777. begin: 0x1400,
  35778. end: 0x167f
  35779. },
  35780. {
  35781. begin: 0x1680,
  35782. end: 0x169f
  35783. },
  35784. {
  35785. begin: 0x16a0,
  35786. end: 0x16ff
  35787. },
  35788. {
  35789. begin: 0x1780,
  35790. end: 0x17ff
  35791. },
  35792. {
  35793. begin: 0x1800,
  35794. end: 0x18af
  35795. },
  35796. {
  35797. begin: 0x2800,
  35798. end: 0x28ff
  35799. },
  35800. {
  35801. begin: 0xa000,
  35802. end: 0xa48f
  35803. },
  35804. {
  35805. begin: 0x1700,
  35806. end: 0x171f
  35807. },
  35808. {
  35809. begin: 0x10300,
  35810. end: 0x1032f
  35811. },
  35812. {
  35813. begin: 0x10330,
  35814. end: 0x1034f
  35815. },
  35816. {
  35817. begin: 0x10400,
  35818. end: 0x1044f
  35819. },
  35820. {
  35821. begin: 0x1d000,
  35822. end: 0x1d0ff
  35823. },
  35824. {
  35825. begin: 0x1d400,
  35826. end: 0x1d7ff
  35827. },
  35828. {
  35829. begin: 0xff000,
  35830. end: 0xffffd
  35831. },
  35832. {
  35833. begin: 0xfe00,
  35834. end: 0xfe0f
  35835. },
  35836. {
  35837. begin: 0xe0000,
  35838. end: 0xe007f
  35839. },
  35840. {
  35841. begin: 0x1900,
  35842. end: 0x194f
  35843. },
  35844. {
  35845. begin: 0x1950,
  35846. end: 0x197f
  35847. },
  35848. {
  35849. begin: 0x1980,
  35850. end: 0x19df
  35851. },
  35852. {
  35853. begin: 0x1a00,
  35854. end: 0x1a1f
  35855. },
  35856. {
  35857. begin: 0x2c00,
  35858. end: 0x2c5f
  35859. },
  35860. {
  35861. begin: 0x2d30,
  35862. end: 0x2d7f
  35863. },
  35864. {
  35865. begin: 0x4dc0,
  35866. end: 0x4dff
  35867. },
  35868. {
  35869. begin: 0xa800,
  35870. end: 0xa82f
  35871. },
  35872. {
  35873. begin: 0x10000,
  35874. end: 0x1007f
  35875. },
  35876. {
  35877. begin: 0x10140,
  35878. end: 0x1018f
  35879. },
  35880. {
  35881. begin: 0x10380,
  35882. end: 0x1039f
  35883. },
  35884. {
  35885. begin: 0x103a0,
  35886. end: 0x103df
  35887. },
  35888. {
  35889. begin: 0x10450,
  35890. end: 0x1047f
  35891. },
  35892. {
  35893. begin: 0x10480,
  35894. end: 0x104af
  35895. },
  35896. {
  35897. begin: 0x10800,
  35898. end: 0x1083f
  35899. },
  35900. {
  35901. begin: 0x10a00,
  35902. end: 0x10a5f
  35903. },
  35904. {
  35905. begin: 0x1d300,
  35906. end: 0x1d35f
  35907. },
  35908. {
  35909. begin: 0x12000,
  35910. end: 0x123ff
  35911. },
  35912. {
  35913. begin: 0x1d360,
  35914. end: 0x1d37f
  35915. },
  35916. {
  35917. begin: 0x1b80,
  35918. end: 0x1bbf
  35919. },
  35920. {
  35921. begin: 0x1c00,
  35922. end: 0x1c4f
  35923. },
  35924. {
  35925. begin: 0x1c50,
  35926. end: 0x1c7f
  35927. },
  35928. {
  35929. begin: 0xa880,
  35930. end: 0xa8df
  35931. },
  35932. {
  35933. begin: 0xa900,
  35934. end: 0xa92f
  35935. },
  35936. {
  35937. begin: 0xa930,
  35938. end: 0xa95f
  35939. },
  35940. {
  35941. begin: 0xaa00,
  35942. end: 0xaa5f
  35943. },
  35944. {
  35945. begin: 0x10190,
  35946. end: 0x101cf
  35947. },
  35948. {
  35949. begin: 0x101d0,
  35950. end: 0x101ff
  35951. },
  35952. {
  35953. begin: 0x102a0,
  35954. end: 0x102df
  35955. },
  35956. {
  35957. begin: 0x1f030,
  35958. end: 0x1f09f
  35959. }
  35960. ];
  35961. function getUnicodeRangeFor(value) {
  35962. for (var i = 0, ii = UnicodeRanges.length; i < ii; i++) {
  35963. var range = UnicodeRanges[i];
  35964. if (value >= range.begin && value < range.end) {
  35965. return i;
  35966. }
  35967. }
  35968. return -1;
  35969. }
  35970. function isRTLRangeFor(value) {
  35971. var range = UnicodeRanges[13];
  35972. if (value >= range.begin && value < range.end) {
  35973. return true;
  35974. }
  35975. range = UnicodeRanges[11];
  35976. if (value >= range.begin && value < range.end) {
  35977. return true;
  35978. }
  35979. return false;
  35980. }
  35981. var getNormalizedUnicodes = (0,_core_utils_js__WEBPACK_IMPORTED_MODULE_0__.getArrayLookupTableFactory)(function () {
  35982. return [
  35983. "\u00A8",
  35984. "\u0020\u0308",
  35985. "\u00AF",
  35986. "\u0020\u0304",
  35987. "\u00B4",
  35988. "\u0020\u0301",
  35989. "\u00B5",
  35990. "\u03BC",
  35991. "\u00B8",
  35992. "\u0020\u0327",
  35993. "\u0132",
  35994. "\u0049\u004A",
  35995. "\u0133",
  35996. "\u0069\u006A",
  35997. "\u013F",
  35998. "\u004C\u00B7",
  35999. "\u0140",
  36000. "\u006C\u00B7",
  36001. "\u0149",
  36002. "\u02BC\u006E",
  36003. "\u017F",
  36004. "\u0073",
  36005. "\u01C4",
  36006. "\u0044\u017D",
  36007. "\u01C5",
  36008. "\u0044\u017E",
  36009. "\u01C6",
  36010. "\u0064\u017E",
  36011. "\u01C7",
  36012. "\u004C\u004A",
  36013. "\u01C8",
  36014. "\u004C\u006A",
  36015. "\u01C9",
  36016. "\u006C\u006A",
  36017. "\u01CA",
  36018. "\u004E\u004A",
  36019. "\u01CB",
  36020. "\u004E\u006A",
  36021. "\u01CC",
  36022. "\u006E\u006A",
  36023. "\u01F1",
  36024. "\u0044\u005A",
  36025. "\u01F2",
  36026. "\u0044\u007A",
  36027. "\u01F3",
  36028. "\u0064\u007A",
  36029. "\u02D8",
  36030. "\u0020\u0306",
  36031. "\u02D9",
  36032. "\u0020\u0307",
  36033. "\u02DA",
  36034. "\u0020\u030A",
  36035. "\u02DB",
  36036. "\u0020\u0328",
  36037. "\u02DC",
  36038. "\u0020\u0303",
  36039. "\u02DD",
  36040. "\u0020\u030B",
  36041. "\u037A",
  36042. "\u0020\u0345",
  36043. "\u0384",
  36044. "\u0020\u0301",
  36045. "\u03D0",
  36046. "\u03B2",
  36047. "\u03D1",
  36048. "\u03B8",
  36049. "\u03D2",
  36050. "\u03A5",
  36051. "\u03D5",
  36052. "\u03C6",
  36053. "\u03D6",
  36054. "\u03C0",
  36055. "\u03F0",
  36056. "\u03BA",
  36057. "\u03F1",
  36058. "\u03C1",
  36059. "\u03F2",
  36060. "\u03C2",
  36061. "\u03F4",
  36062. "\u0398",
  36063. "\u03F5",
  36064. "\u03B5",
  36065. "\u03F9",
  36066. "\u03A3",
  36067. "\u0587",
  36068. "\u0565\u0582",
  36069. "\u0675",
  36070. "\u0627\u0674",
  36071. "\u0676",
  36072. "\u0648\u0674",
  36073. "\u0677",
  36074. "\u06C7\u0674",
  36075. "\u0678",
  36076. "\u064A\u0674",
  36077. "\u0E33",
  36078. "\u0E4D\u0E32",
  36079. "\u0EB3",
  36080. "\u0ECD\u0EB2",
  36081. "\u0EDC",
  36082. "\u0EAB\u0E99",
  36083. "\u0EDD",
  36084. "\u0EAB\u0EA1",
  36085. "\u0F77",
  36086. "\u0FB2\u0F81",
  36087. "\u0F79",
  36088. "\u0FB3\u0F81",
  36089. "\u1E9A",
  36090. "\u0061\u02BE",
  36091. "\u1FBD",
  36092. "\u0020\u0313",
  36093. "\u1FBF",
  36094. "\u0020\u0313",
  36095. "\u1FC0",
  36096. "\u0020\u0342",
  36097. "\u1FFE",
  36098. "\u0020\u0314",
  36099. "\u2002",
  36100. "\u0020",
  36101. "\u2003",
  36102. "\u0020",
  36103. "\u2004",
  36104. "\u0020",
  36105. "\u2005",
  36106. "\u0020",
  36107. "\u2006",
  36108. "\u0020",
  36109. "\u2008",
  36110. "\u0020",
  36111. "\u2009",
  36112. "\u0020",
  36113. "\u200A",
  36114. "\u0020",
  36115. "\u2017",
  36116. "\u0020\u0333",
  36117. "\u2024",
  36118. "\u002E",
  36119. "\u2025",
  36120. "\u002E\u002E",
  36121. "\u2026",
  36122. "\u002E\u002E\u002E",
  36123. "\u2033",
  36124. "\u2032\u2032",
  36125. "\u2034",
  36126. "\u2032\u2032\u2032",
  36127. "\u2036",
  36128. "\u2035\u2035",
  36129. "\u2037",
  36130. "\u2035\u2035\u2035",
  36131. "\u203C",
  36132. "\u0021\u0021",
  36133. "\u203E",
  36134. "\u0020\u0305",
  36135. "\u2047",
  36136. "\u003F\u003F",
  36137. "\u2048",
  36138. "\u003F\u0021",
  36139. "\u2049",
  36140. "\u0021\u003F",
  36141. "\u2057",
  36142. "\u2032\u2032\u2032\u2032",
  36143. "\u205F",
  36144. "\u0020",
  36145. "\u20A8",
  36146. "\u0052\u0073",
  36147. "\u2100",
  36148. "\u0061\u002F\u0063",
  36149. "\u2101",
  36150. "\u0061\u002F\u0073",
  36151. "\u2103",
  36152. "\u00B0\u0043",
  36153. "\u2105",
  36154. "\u0063\u002F\u006F",
  36155. "\u2106",
  36156. "\u0063\u002F\u0075",
  36157. "\u2107",
  36158. "\u0190",
  36159. "\u2109",
  36160. "\u00B0\u0046",
  36161. "\u2116",
  36162. "\u004E\u006F",
  36163. "\u2121",
  36164. "\u0054\u0045\u004C",
  36165. "\u2135",
  36166. "\u05D0",
  36167. "\u2136",
  36168. "\u05D1",
  36169. "\u2137",
  36170. "\u05D2",
  36171. "\u2138",
  36172. "\u05D3",
  36173. "\u213B",
  36174. "\u0046\u0041\u0058",
  36175. "\u2160",
  36176. "\u0049",
  36177. "\u2161",
  36178. "\u0049\u0049",
  36179. "\u2162",
  36180. "\u0049\u0049\u0049",
  36181. "\u2163",
  36182. "\u0049\u0056",
  36183. "\u2164",
  36184. "\u0056",
  36185. "\u2165",
  36186. "\u0056\u0049",
  36187. "\u2166",
  36188. "\u0056\u0049\u0049",
  36189. "\u2167",
  36190. "\u0056\u0049\u0049\u0049",
  36191. "\u2168",
  36192. "\u0049\u0058",
  36193. "\u2169",
  36194. "\u0058",
  36195. "\u216A",
  36196. "\u0058\u0049",
  36197. "\u216B",
  36198. "\u0058\u0049\u0049",
  36199. "\u216C",
  36200. "\u004C",
  36201. "\u216D",
  36202. "\u0043",
  36203. "\u216E",
  36204. "\u0044",
  36205. "\u216F",
  36206. "\u004D",
  36207. "\u2170",
  36208. "\u0069",
  36209. "\u2171",
  36210. "\u0069\u0069",
  36211. "\u2172",
  36212. "\u0069\u0069\u0069",
  36213. "\u2173",
  36214. "\u0069\u0076",
  36215. "\u2174",
  36216. "\u0076",
  36217. "\u2175",
  36218. "\u0076\u0069",
  36219. "\u2176",
  36220. "\u0076\u0069\u0069",
  36221. "\u2177",
  36222. "\u0076\u0069\u0069\u0069",
  36223. "\u2178",
  36224. "\u0069\u0078",
  36225. "\u2179",
  36226. "\u0078",
  36227. "\u217A",
  36228. "\u0078\u0069",
  36229. "\u217B",
  36230. "\u0078\u0069\u0069",
  36231. "\u217C",
  36232. "\u006C",
  36233. "\u217D",
  36234. "\u0063",
  36235. "\u217E",
  36236. "\u0064",
  36237. "\u217F",
  36238. "\u006D",
  36239. "\u222C",
  36240. "\u222B\u222B",
  36241. "\u222D",
  36242. "\u222B\u222B\u222B",
  36243. "\u222F",
  36244. "\u222E\u222E",
  36245. "\u2230",
  36246. "\u222E\u222E\u222E",
  36247. "\u2474",
  36248. "\u0028\u0031\u0029",
  36249. "\u2475",
  36250. "\u0028\u0032\u0029",
  36251. "\u2476",
  36252. "\u0028\u0033\u0029",
  36253. "\u2477",
  36254. "\u0028\u0034\u0029",
  36255. "\u2478",
  36256. "\u0028\u0035\u0029",
  36257. "\u2479",
  36258. "\u0028\u0036\u0029",
  36259. "\u247A",
  36260. "\u0028\u0037\u0029",
  36261. "\u247B",
  36262. "\u0028\u0038\u0029",
  36263. "\u247C",
  36264. "\u0028\u0039\u0029",
  36265. "\u247D",
  36266. "\u0028\u0031\u0030\u0029",
  36267. "\u247E",
  36268. "\u0028\u0031\u0031\u0029",
  36269. "\u247F",
  36270. "\u0028\u0031\u0032\u0029",
  36271. "\u2480",
  36272. "\u0028\u0031\u0033\u0029",
  36273. "\u2481",
  36274. "\u0028\u0031\u0034\u0029",
  36275. "\u2482",
  36276. "\u0028\u0031\u0035\u0029",
  36277. "\u2483",
  36278. "\u0028\u0031\u0036\u0029",
  36279. "\u2484",
  36280. "\u0028\u0031\u0037\u0029",
  36281. "\u2485",
  36282. "\u0028\u0031\u0038\u0029",
  36283. "\u2486",
  36284. "\u0028\u0031\u0039\u0029",
  36285. "\u2487",
  36286. "\u0028\u0032\u0030\u0029",
  36287. "\u2488",
  36288. "\u0031\u002E",
  36289. "\u2489",
  36290. "\u0032\u002E",
  36291. "\u248A",
  36292. "\u0033\u002E",
  36293. "\u248B",
  36294. "\u0034\u002E",
  36295. "\u248C",
  36296. "\u0035\u002E",
  36297. "\u248D",
  36298. "\u0036\u002E",
  36299. "\u248E",
  36300. "\u0037\u002E",
  36301. "\u248F",
  36302. "\u0038\u002E",
  36303. "\u2490",
  36304. "\u0039\u002E",
  36305. "\u2491",
  36306. "\u0031\u0030\u002E",
  36307. "\u2492",
  36308. "\u0031\u0031\u002E",
  36309. "\u2493",
  36310. "\u0031\u0032\u002E",
  36311. "\u2494",
  36312. "\u0031\u0033\u002E",
  36313. "\u2495",
  36314. "\u0031\u0034\u002E",
  36315. "\u2496",
  36316. "\u0031\u0035\u002E",
  36317. "\u2497",
  36318. "\u0031\u0036\u002E",
  36319. "\u2498",
  36320. "\u0031\u0037\u002E",
  36321. "\u2499",
  36322. "\u0031\u0038\u002E",
  36323. "\u249A",
  36324. "\u0031\u0039\u002E",
  36325. "\u249B",
  36326. "\u0032\u0030\u002E",
  36327. "\u249C",
  36328. "\u0028\u0061\u0029",
  36329. "\u249D",
  36330. "\u0028\u0062\u0029",
  36331. "\u249E",
  36332. "\u0028\u0063\u0029",
  36333. "\u249F",
  36334. "\u0028\u0064\u0029",
  36335. "\u24A0",
  36336. "\u0028\u0065\u0029",
  36337. "\u24A1",
  36338. "\u0028\u0066\u0029",
  36339. "\u24A2",
  36340. "\u0028\u0067\u0029",
  36341. "\u24A3",
  36342. "\u0028\u0068\u0029",
  36343. "\u24A4",
  36344. "\u0028\u0069\u0029",
  36345. "\u24A5",
  36346. "\u0028\u006A\u0029",
  36347. "\u24A6",
  36348. "\u0028\u006B\u0029",
  36349. "\u24A7",
  36350. "\u0028\u006C\u0029",
  36351. "\u24A8",
  36352. "\u0028\u006D\u0029",
  36353. "\u24A9",
  36354. "\u0028\u006E\u0029",
  36355. "\u24AA",
  36356. "\u0028\u006F\u0029",
  36357. "\u24AB",
  36358. "\u0028\u0070\u0029",
  36359. "\u24AC",
  36360. "\u0028\u0071\u0029",
  36361. "\u24AD",
  36362. "\u0028\u0072\u0029",
  36363. "\u24AE",
  36364. "\u0028\u0073\u0029",
  36365. "\u24AF",
  36366. "\u0028\u0074\u0029",
  36367. "\u24B0",
  36368. "\u0028\u0075\u0029",
  36369. "\u24B1",
  36370. "\u0028\u0076\u0029",
  36371. "\u24B2",
  36372. "\u0028\u0077\u0029",
  36373. "\u24B3",
  36374. "\u0028\u0078\u0029",
  36375. "\u24B4",
  36376. "\u0028\u0079\u0029",
  36377. "\u24B5",
  36378. "\u0028\u007A\u0029",
  36379. "\u2A0C",
  36380. "\u222B\u222B\u222B\u222B",
  36381. "\u2A74",
  36382. "\u003A\u003A\u003D",
  36383. "\u2A75",
  36384. "\u003D\u003D",
  36385. "\u2A76",
  36386. "\u003D\u003D\u003D",
  36387. "\u2E9F",
  36388. "\u6BCD",
  36389. "\u2EF3",
  36390. "\u9F9F",
  36391. "\u2F00",
  36392. "\u4E00",
  36393. "\u2F01",
  36394. "\u4E28",
  36395. "\u2F02",
  36396. "\u4E36",
  36397. "\u2F03",
  36398. "\u4E3F",
  36399. "\u2F04",
  36400. "\u4E59",
  36401. "\u2F05",
  36402. "\u4E85",
  36403. "\u2F06",
  36404. "\u4E8C",
  36405. "\u2F07",
  36406. "\u4EA0",
  36407. "\u2F08",
  36408. "\u4EBA",
  36409. "\u2F09",
  36410. "\u513F",
  36411. "\u2F0A",
  36412. "\u5165",
  36413. "\u2F0B",
  36414. "\u516B",
  36415. "\u2F0C",
  36416. "\u5182",
  36417. "\u2F0D",
  36418. "\u5196",
  36419. "\u2F0E",
  36420. "\u51AB",
  36421. "\u2F0F",
  36422. "\u51E0",
  36423. "\u2F10",
  36424. "\u51F5",
  36425. "\u2F11",
  36426. "\u5200",
  36427. "\u2F12",
  36428. "\u529B",
  36429. "\u2F13",
  36430. "\u52F9",
  36431. "\u2F14",
  36432. "\u5315",
  36433. "\u2F15",
  36434. "\u531A",
  36435. "\u2F16",
  36436. "\u5338",
  36437. "\u2F17",
  36438. "\u5341",
  36439. "\u2F18",
  36440. "\u535C",
  36441. "\u2F19",
  36442. "\u5369",
  36443. "\u2F1A",
  36444. "\u5382",
  36445. "\u2F1B",
  36446. "\u53B6",
  36447. "\u2F1C",
  36448. "\u53C8",
  36449. "\u2F1D",
  36450. "\u53E3",
  36451. "\u2F1E",
  36452. "\u56D7",
  36453. "\u2F1F",
  36454. "\u571F",
  36455. "\u2F20",
  36456. "\u58EB",
  36457. "\u2F21",
  36458. "\u5902",
  36459. "\u2F22",
  36460. "\u590A",
  36461. "\u2F23",
  36462. "\u5915",
  36463. "\u2F24",
  36464. "\u5927",
  36465. "\u2F25",
  36466. "\u5973",
  36467. "\u2F26",
  36468. "\u5B50",
  36469. "\u2F27",
  36470. "\u5B80",
  36471. "\u2F28",
  36472. "\u5BF8",
  36473. "\u2F29",
  36474. "\u5C0F",
  36475. "\u2F2A",
  36476. "\u5C22",
  36477. "\u2F2B",
  36478. "\u5C38",
  36479. "\u2F2C",
  36480. "\u5C6E",
  36481. "\u2F2D",
  36482. "\u5C71",
  36483. "\u2F2E",
  36484. "\u5DDB",
  36485. "\u2F2F",
  36486. "\u5DE5",
  36487. "\u2F30",
  36488. "\u5DF1",
  36489. "\u2F31",
  36490. "\u5DFE",
  36491. "\u2F32",
  36492. "\u5E72",
  36493. "\u2F33",
  36494. "\u5E7A",
  36495. "\u2F34",
  36496. "\u5E7F",
  36497. "\u2F35",
  36498. "\u5EF4",
  36499. "\u2F36",
  36500. "\u5EFE",
  36501. "\u2F37",
  36502. "\u5F0B",
  36503. "\u2F38",
  36504. "\u5F13",
  36505. "\u2F39",
  36506. "\u5F50",
  36507. "\u2F3A",
  36508. "\u5F61",
  36509. "\u2F3B",
  36510. "\u5F73",
  36511. "\u2F3C",
  36512. "\u5FC3",
  36513. "\u2F3D",
  36514. "\u6208",
  36515. "\u2F3E",
  36516. "\u6236",
  36517. "\u2F3F",
  36518. "\u624B",
  36519. "\u2F40",
  36520. "\u652F",
  36521. "\u2F41",
  36522. "\u6534",
  36523. "\u2F42",
  36524. "\u6587",
  36525. "\u2F43",
  36526. "\u6597",
  36527. "\u2F44",
  36528. "\u65A4",
  36529. "\u2F45",
  36530. "\u65B9",
  36531. "\u2F46",
  36532. "\u65E0",
  36533. "\u2F47",
  36534. "\u65E5",
  36535. "\u2F48",
  36536. "\u66F0",
  36537. "\u2F49",
  36538. "\u6708",
  36539. "\u2F4A",
  36540. "\u6728",
  36541. "\u2F4B",
  36542. "\u6B20",
  36543. "\u2F4C",
  36544. "\u6B62",
  36545. "\u2F4D",
  36546. "\u6B79",
  36547. "\u2F4E",
  36548. "\u6BB3",
  36549. "\u2F4F",
  36550. "\u6BCB",
  36551. "\u2F50",
  36552. "\u6BD4",
  36553. "\u2F51",
  36554. "\u6BDB",
  36555. "\u2F52",
  36556. "\u6C0F",
  36557. "\u2F53",
  36558. "\u6C14",
  36559. "\u2F54",
  36560. "\u6C34",
  36561. "\u2F55",
  36562. "\u706B",
  36563. "\u2F56",
  36564. "\u722A",
  36565. "\u2F57",
  36566. "\u7236",
  36567. "\u2F58",
  36568. "\u723B",
  36569. "\u2F59",
  36570. "\u723F",
  36571. "\u2F5A",
  36572. "\u7247",
  36573. "\u2F5B",
  36574. "\u7259",
  36575. "\u2F5C",
  36576. "\u725B",
  36577. "\u2F5D",
  36578. "\u72AC",
  36579. "\u2F5E",
  36580. "\u7384",
  36581. "\u2F5F",
  36582. "\u7389",
  36583. "\u2F60",
  36584. "\u74DC",
  36585. "\u2F61",
  36586. "\u74E6",
  36587. "\u2F62",
  36588. "\u7518",
  36589. "\u2F63",
  36590. "\u751F",
  36591. "\u2F64",
  36592. "\u7528",
  36593. "\u2F65",
  36594. "\u7530",
  36595. "\u2F66",
  36596. "\u758B",
  36597. "\u2F67",
  36598. "\u7592",
  36599. "\u2F68",
  36600. "\u7676",
  36601. "\u2F69",
  36602. "\u767D",
  36603. "\u2F6A",
  36604. "\u76AE",
  36605. "\u2F6B",
  36606. "\u76BF",
  36607. "\u2F6C",
  36608. "\u76EE",
  36609. "\u2F6D",
  36610. "\u77DB",
  36611. "\u2F6E",
  36612. "\u77E2",
  36613. "\u2F6F",
  36614. "\u77F3",
  36615. "\u2F70",
  36616. "\u793A",
  36617. "\u2F71",
  36618. "\u79B8",
  36619. "\u2F72",
  36620. "\u79BE",
  36621. "\u2F73",
  36622. "\u7A74",
  36623. "\u2F74",
  36624. "\u7ACB",
  36625. "\u2F75",
  36626. "\u7AF9",
  36627. "\u2F76",
  36628. "\u7C73",
  36629. "\u2F77",
  36630. "\u7CF8",
  36631. "\u2F78",
  36632. "\u7F36",
  36633. "\u2F79",
  36634. "\u7F51",
  36635. "\u2F7A",
  36636. "\u7F8A",
  36637. "\u2F7B",
  36638. "\u7FBD",
  36639. "\u2F7C",
  36640. "\u8001",
  36641. "\u2F7D",
  36642. "\u800C",
  36643. "\u2F7E",
  36644. "\u8012",
  36645. "\u2F7F",
  36646. "\u8033",
  36647. "\u2F80",
  36648. "\u807F",
  36649. "\u2F81",
  36650. "\u8089",
  36651. "\u2F82",
  36652. "\u81E3",
  36653. "\u2F83",
  36654. "\u81EA",
  36655. "\u2F84",
  36656. "\u81F3",
  36657. "\u2F85",
  36658. "\u81FC",
  36659. "\u2F86",
  36660. "\u820C",
  36661. "\u2F87",
  36662. "\u821B",
  36663. "\u2F88",
  36664. "\u821F",
  36665. "\u2F89",
  36666. "\u826E",
  36667. "\u2F8A",
  36668. "\u8272",
  36669. "\u2F8B",
  36670. "\u8278",
  36671. "\u2F8C",
  36672. "\u864D",
  36673. "\u2F8D",
  36674. "\u866B",
  36675. "\u2F8E",
  36676. "\u8840",
  36677. "\u2F8F",
  36678. "\u884C",
  36679. "\u2F90",
  36680. "\u8863",
  36681. "\u2F91",
  36682. "\u897E",
  36683. "\u2F92",
  36684. "\u898B",
  36685. "\u2F93",
  36686. "\u89D2",
  36687. "\u2F94",
  36688. "\u8A00",
  36689. "\u2F95",
  36690. "\u8C37",
  36691. "\u2F96",
  36692. "\u8C46",
  36693. "\u2F97",
  36694. "\u8C55",
  36695. "\u2F98",
  36696. "\u8C78",
  36697. "\u2F99",
  36698. "\u8C9D",
  36699. "\u2F9A",
  36700. "\u8D64",
  36701. "\u2F9B",
  36702. "\u8D70",
  36703. "\u2F9C",
  36704. "\u8DB3",
  36705. "\u2F9D",
  36706. "\u8EAB",
  36707. "\u2F9E",
  36708. "\u8ECA",
  36709. "\u2F9F",
  36710. "\u8F9B",
  36711. "\u2FA0",
  36712. "\u8FB0",
  36713. "\u2FA1",
  36714. "\u8FB5",
  36715. "\u2FA2",
  36716. "\u9091",
  36717. "\u2FA3",
  36718. "\u9149",
  36719. "\u2FA4",
  36720. "\u91C6",
  36721. "\u2FA5",
  36722. "\u91CC",
  36723. "\u2FA6",
  36724. "\u91D1",
  36725. "\u2FA7",
  36726. "\u9577",
  36727. "\u2FA8",
  36728. "\u9580",
  36729. "\u2FA9",
  36730. "\u961C",
  36731. "\u2FAA",
  36732. "\u96B6",
  36733. "\u2FAB",
  36734. "\u96B9",
  36735. "\u2FAC",
  36736. "\u96E8",
  36737. "\u2FAD",
  36738. "\u9751",
  36739. "\u2FAE",
  36740. "\u975E",
  36741. "\u2FAF",
  36742. "\u9762",
  36743. "\u2FB0",
  36744. "\u9769",
  36745. "\u2FB1",
  36746. "\u97CB",
  36747. "\u2FB2",
  36748. "\u97ED",
  36749. "\u2FB3",
  36750. "\u97F3",
  36751. "\u2FB4",
  36752. "\u9801",
  36753. "\u2FB5",
  36754. "\u98A8",
  36755. "\u2FB6",
  36756. "\u98DB",
  36757. "\u2FB7",
  36758. "\u98DF",
  36759. "\u2FB8",
  36760. "\u9996",
  36761. "\u2FB9",
  36762. "\u9999",
  36763. "\u2FBA",
  36764. "\u99AC",
  36765. "\u2FBB",
  36766. "\u9AA8",
  36767. "\u2FBC",
  36768. "\u9AD8",
  36769. "\u2FBD",
  36770. "\u9ADF",
  36771. "\u2FBE",
  36772. "\u9B25",
  36773. "\u2FBF",
  36774. "\u9B2F",
  36775. "\u2FC0",
  36776. "\u9B32",
  36777. "\u2FC1",
  36778. "\u9B3C",
  36779. "\u2FC2",
  36780. "\u9B5A",
  36781. "\u2FC3",
  36782. "\u9CE5",
  36783. "\u2FC4",
  36784. "\u9E75",
  36785. "\u2FC5",
  36786. "\u9E7F",
  36787. "\u2FC6",
  36788. "\u9EA5",
  36789. "\u2FC7",
  36790. "\u9EBB",
  36791. "\u2FC8",
  36792. "\u9EC3",
  36793. "\u2FC9",
  36794. "\u9ECD",
  36795. "\u2FCA",
  36796. "\u9ED1",
  36797. "\u2FCB",
  36798. "\u9EF9",
  36799. "\u2FCC",
  36800. "\u9EFD",
  36801. "\u2FCD",
  36802. "\u9F0E",
  36803. "\u2FCE",
  36804. "\u9F13",
  36805. "\u2FCF",
  36806. "\u9F20",
  36807. "\u2FD0",
  36808. "\u9F3B",
  36809. "\u2FD1",
  36810. "\u9F4A",
  36811. "\u2FD2",
  36812. "\u9F52",
  36813. "\u2FD3",
  36814. "\u9F8D",
  36815. "\u2FD4",
  36816. "\u9F9C",
  36817. "\u2FD5",
  36818. "\u9FA0",
  36819. "\u3036",
  36820. "\u3012",
  36821. "\u3038",
  36822. "\u5341",
  36823. "\u3039",
  36824. "\u5344",
  36825. "\u303A",
  36826. "\u5345",
  36827. "\u309B",
  36828. "\u0020\u3099",
  36829. "\u309C",
  36830. "\u0020\u309A",
  36831. "\u3131",
  36832. "\u1100",
  36833. "\u3132",
  36834. "\u1101",
  36835. "\u3133",
  36836. "\u11AA",
  36837. "\u3134",
  36838. "\u1102",
  36839. "\u3135",
  36840. "\u11AC",
  36841. "\u3136",
  36842. "\u11AD",
  36843. "\u3137",
  36844. "\u1103",
  36845. "\u3138",
  36846. "\u1104",
  36847. "\u3139",
  36848. "\u1105",
  36849. "\u313A",
  36850. "\u11B0",
  36851. "\u313B",
  36852. "\u11B1",
  36853. "\u313C",
  36854. "\u11B2",
  36855. "\u313D",
  36856. "\u11B3",
  36857. "\u313E",
  36858. "\u11B4",
  36859. "\u313F",
  36860. "\u11B5",
  36861. "\u3140",
  36862. "\u111A",
  36863. "\u3141",
  36864. "\u1106",
  36865. "\u3142",
  36866. "\u1107",
  36867. "\u3143",
  36868. "\u1108",
  36869. "\u3144",
  36870. "\u1121",
  36871. "\u3145",
  36872. "\u1109",
  36873. "\u3146",
  36874. "\u110A",
  36875. "\u3147",
  36876. "\u110B",
  36877. "\u3148",
  36878. "\u110C",
  36879. "\u3149",
  36880. "\u110D",
  36881. "\u314A",
  36882. "\u110E",
  36883. "\u314B",
  36884. "\u110F",
  36885. "\u314C",
  36886. "\u1110",
  36887. "\u314D",
  36888. "\u1111",
  36889. "\u314E",
  36890. "\u1112",
  36891. "\u314F",
  36892. "\u1161",
  36893. "\u3150",
  36894. "\u1162",
  36895. "\u3151",
  36896. "\u1163",
  36897. "\u3152",
  36898. "\u1164",
  36899. "\u3153",
  36900. "\u1165",
  36901. "\u3154",
  36902. "\u1166",
  36903. "\u3155",
  36904. "\u1167",
  36905. "\u3156",
  36906. "\u1168",
  36907. "\u3157",
  36908. "\u1169",
  36909. "\u3158",
  36910. "\u116A",
  36911. "\u3159",
  36912. "\u116B",
  36913. "\u315A",
  36914. "\u116C",
  36915. "\u315B",
  36916. "\u116D",
  36917. "\u315C",
  36918. "\u116E",
  36919. "\u315D",
  36920. "\u116F",
  36921. "\u315E",
  36922. "\u1170",
  36923. "\u315F",
  36924. "\u1171",
  36925. "\u3160",
  36926. "\u1172",
  36927. "\u3161",
  36928. "\u1173",
  36929. "\u3162",
  36930. "\u1174",
  36931. "\u3163",
  36932. "\u1175",
  36933. "\u3164",
  36934. "\u1160",
  36935. "\u3165",
  36936. "\u1114",
  36937. "\u3166",
  36938. "\u1115",
  36939. "\u3167",
  36940. "\u11C7",
  36941. "\u3168",
  36942. "\u11C8",
  36943. "\u3169",
  36944. "\u11CC",
  36945. "\u316A",
  36946. "\u11CE",
  36947. "\u316B",
  36948. "\u11D3",
  36949. "\u316C",
  36950. "\u11D7",
  36951. "\u316D",
  36952. "\u11D9",
  36953. "\u316E",
  36954. "\u111C",
  36955. "\u316F",
  36956. "\u11DD",
  36957. "\u3170",
  36958. "\u11DF",
  36959. "\u3171",
  36960. "\u111D",
  36961. "\u3172",
  36962. "\u111E",
  36963. "\u3173",
  36964. "\u1120",
  36965. "\u3174",
  36966. "\u1122",
  36967. "\u3175",
  36968. "\u1123",
  36969. "\u3176",
  36970. "\u1127",
  36971. "\u3177",
  36972. "\u1129",
  36973. "\u3178",
  36974. "\u112B",
  36975. "\u3179",
  36976. "\u112C",
  36977. "\u317A",
  36978. "\u112D",
  36979. "\u317B",
  36980. "\u112E",
  36981. "\u317C",
  36982. "\u112F",
  36983. "\u317D",
  36984. "\u1132",
  36985. "\u317E",
  36986. "\u1136",
  36987. "\u317F",
  36988. "\u1140",
  36989. "\u3180",
  36990. "\u1147",
  36991. "\u3181",
  36992. "\u114C",
  36993. "\u3182",
  36994. "\u11F1",
  36995. "\u3183",
  36996. "\u11F2",
  36997. "\u3184",
  36998. "\u1157",
  36999. "\u3185",
  37000. "\u1158",
  37001. "\u3186",
  37002. "\u1159",
  37003. "\u3187",
  37004. "\u1184",
  37005. "\u3188",
  37006. "\u1185",
  37007. "\u3189",
  37008. "\u1188",
  37009. "\u318A",
  37010. "\u1191",
  37011. "\u318B",
  37012. "\u1192",
  37013. "\u318C",
  37014. "\u1194",
  37015. "\u318D",
  37016. "\u119E",
  37017. "\u318E",
  37018. "\u11A1",
  37019. "\u3200",
  37020. "\u0028\u1100\u0029",
  37021. "\u3201",
  37022. "\u0028\u1102\u0029",
  37023. "\u3202",
  37024. "\u0028\u1103\u0029",
  37025. "\u3203",
  37026. "\u0028\u1105\u0029",
  37027. "\u3204",
  37028. "\u0028\u1106\u0029",
  37029. "\u3205",
  37030. "\u0028\u1107\u0029",
  37031. "\u3206",
  37032. "\u0028\u1109\u0029",
  37033. "\u3207",
  37034. "\u0028\u110B\u0029",
  37035. "\u3208",
  37036. "\u0028\u110C\u0029",
  37037. "\u3209",
  37038. "\u0028\u110E\u0029",
  37039. "\u320A",
  37040. "\u0028\u110F\u0029",
  37041. "\u320B",
  37042. "\u0028\u1110\u0029",
  37043. "\u320C",
  37044. "\u0028\u1111\u0029",
  37045. "\u320D",
  37046. "\u0028\u1112\u0029",
  37047. "\u320E",
  37048. "\u0028\u1100\u1161\u0029",
  37049. "\u320F",
  37050. "\u0028\u1102\u1161\u0029",
  37051. "\u3210",
  37052. "\u0028\u1103\u1161\u0029",
  37053. "\u3211",
  37054. "\u0028\u1105\u1161\u0029",
  37055. "\u3212",
  37056. "\u0028\u1106\u1161\u0029",
  37057. "\u3213",
  37058. "\u0028\u1107\u1161\u0029",
  37059. "\u3214",
  37060. "\u0028\u1109\u1161\u0029",
  37061. "\u3215",
  37062. "\u0028\u110B\u1161\u0029",
  37063. "\u3216",
  37064. "\u0028\u110C\u1161\u0029",
  37065. "\u3217",
  37066. "\u0028\u110E\u1161\u0029",
  37067. "\u3218",
  37068. "\u0028\u110F\u1161\u0029",
  37069. "\u3219",
  37070. "\u0028\u1110\u1161\u0029",
  37071. "\u321A",
  37072. "\u0028\u1111\u1161\u0029",
  37073. "\u321B",
  37074. "\u0028\u1112\u1161\u0029",
  37075. "\u321C",
  37076. "\u0028\u110C\u116E\u0029",
  37077. "\u321D",
  37078. "\u0028\u110B\u1169\u110C\u1165\u11AB\u0029",
  37079. "\u321E",
  37080. "\u0028\u110B\u1169\u1112\u116E\u0029",
  37081. "\u3220",
  37082. "\u0028\u4E00\u0029",
  37083. "\u3221",
  37084. "\u0028\u4E8C\u0029",
  37085. "\u3222",
  37086. "\u0028\u4E09\u0029",
  37087. "\u3223",
  37088. "\u0028\u56DB\u0029",
  37089. "\u3224",
  37090. "\u0028\u4E94\u0029",
  37091. "\u3225",
  37092. "\u0028\u516D\u0029",
  37093. "\u3226",
  37094. "\u0028\u4E03\u0029",
  37095. "\u3227",
  37096. "\u0028\u516B\u0029",
  37097. "\u3228",
  37098. "\u0028\u4E5D\u0029",
  37099. "\u3229",
  37100. "\u0028\u5341\u0029",
  37101. "\u322A",
  37102. "\u0028\u6708\u0029",
  37103. "\u322B",
  37104. "\u0028\u706B\u0029",
  37105. "\u322C",
  37106. "\u0028\u6C34\u0029",
  37107. "\u322D",
  37108. "\u0028\u6728\u0029",
  37109. "\u322E",
  37110. "\u0028\u91D1\u0029",
  37111. "\u322F",
  37112. "\u0028\u571F\u0029",
  37113. "\u3230",
  37114. "\u0028\u65E5\u0029",
  37115. "\u3231",
  37116. "\u0028\u682A\u0029",
  37117. "\u3232",
  37118. "\u0028\u6709\u0029",
  37119. "\u3233",
  37120. "\u0028\u793E\u0029",
  37121. "\u3234",
  37122. "\u0028\u540D\u0029",
  37123. "\u3235",
  37124. "\u0028\u7279\u0029",
  37125. "\u3236",
  37126. "\u0028\u8CA1\u0029",
  37127. "\u3237",
  37128. "\u0028\u795D\u0029",
  37129. "\u3238",
  37130. "\u0028\u52B4\u0029",
  37131. "\u3239",
  37132. "\u0028\u4EE3\u0029",
  37133. "\u323A",
  37134. "\u0028\u547C\u0029",
  37135. "\u323B",
  37136. "\u0028\u5B66\u0029",
  37137. "\u323C",
  37138. "\u0028\u76E3\u0029",
  37139. "\u323D",
  37140. "\u0028\u4F01\u0029",
  37141. "\u323E",
  37142. "\u0028\u8CC7\u0029",
  37143. "\u323F",
  37144. "\u0028\u5354\u0029",
  37145. "\u3240",
  37146. "\u0028\u796D\u0029",
  37147. "\u3241",
  37148. "\u0028\u4F11\u0029",
  37149. "\u3242",
  37150. "\u0028\u81EA\u0029",
  37151. "\u3243",
  37152. "\u0028\u81F3\u0029",
  37153. "\u32C0",
  37154. "\u0031\u6708",
  37155. "\u32C1",
  37156. "\u0032\u6708",
  37157. "\u32C2",
  37158. "\u0033\u6708",
  37159. "\u32C3",
  37160. "\u0034\u6708",
  37161. "\u32C4",
  37162. "\u0035\u6708",
  37163. "\u32C5",
  37164. "\u0036\u6708",
  37165. "\u32C6",
  37166. "\u0037\u6708",
  37167. "\u32C7",
  37168. "\u0038\u6708",
  37169. "\u32C8",
  37170. "\u0039\u6708",
  37171. "\u32C9",
  37172. "\u0031\u0030\u6708",
  37173. "\u32CA",
  37174. "\u0031\u0031\u6708",
  37175. "\u32CB",
  37176. "\u0031\u0032\u6708",
  37177. "\u3358",
  37178. "\u0030\u70B9",
  37179. "\u3359",
  37180. "\u0031\u70B9",
  37181. "\u335A",
  37182. "\u0032\u70B9",
  37183. "\u335B",
  37184. "\u0033\u70B9",
  37185. "\u335C",
  37186. "\u0034\u70B9",
  37187. "\u335D",
  37188. "\u0035\u70B9",
  37189. "\u335E",
  37190. "\u0036\u70B9",
  37191. "\u335F",
  37192. "\u0037\u70B9",
  37193. "\u3360",
  37194. "\u0038\u70B9",
  37195. "\u3361",
  37196. "\u0039\u70B9",
  37197. "\u3362",
  37198. "\u0031\u0030\u70B9",
  37199. "\u3363",
  37200. "\u0031\u0031\u70B9",
  37201. "\u3364",
  37202. "\u0031\u0032\u70B9",
  37203. "\u3365",
  37204. "\u0031\u0033\u70B9",
  37205. "\u3366",
  37206. "\u0031\u0034\u70B9",
  37207. "\u3367",
  37208. "\u0031\u0035\u70B9",
  37209. "\u3368",
  37210. "\u0031\u0036\u70B9",
  37211. "\u3369",
  37212. "\u0031\u0037\u70B9",
  37213. "\u336A",
  37214. "\u0031\u0038\u70B9",
  37215. "\u336B",
  37216. "\u0031\u0039\u70B9",
  37217. "\u336C",
  37218. "\u0032\u0030\u70B9",
  37219. "\u336D",
  37220. "\u0032\u0031\u70B9",
  37221. "\u336E",
  37222. "\u0032\u0032\u70B9",
  37223. "\u336F",
  37224. "\u0032\u0033\u70B9",
  37225. "\u3370",
  37226. "\u0032\u0034\u70B9",
  37227. "\u33E0",
  37228. "\u0031\u65E5",
  37229. "\u33E1",
  37230. "\u0032\u65E5",
  37231. "\u33E2",
  37232. "\u0033\u65E5",
  37233. "\u33E3",
  37234. "\u0034\u65E5",
  37235. "\u33E4",
  37236. "\u0035\u65E5",
  37237. "\u33E5",
  37238. "\u0036\u65E5",
  37239. "\u33E6",
  37240. "\u0037\u65E5",
  37241. "\u33E7",
  37242. "\u0038\u65E5",
  37243. "\u33E8",
  37244. "\u0039\u65E5",
  37245. "\u33E9",
  37246. "\u0031\u0030\u65E5",
  37247. "\u33EA",
  37248. "\u0031\u0031\u65E5",
  37249. "\u33EB",
  37250. "\u0031\u0032\u65E5",
  37251. "\u33EC",
  37252. "\u0031\u0033\u65E5",
  37253. "\u33ED",
  37254. "\u0031\u0034\u65E5",
  37255. "\u33EE",
  37256. "\u0031\u0035\u65E5",
  37257. "\u33EF",
  37258. "\u0031\u0036\u65E5",
  37259. "\u33F0",
  37260. "\u0031\u0037\u65E5",
  37261. "\u33F1",
  37262. "\u0031\u0038\u65E5",
  37263. "\u33F2",
  37264. "\u0031\u0039\u65E5",
  37265. "\u33F3",
  37266. "\u0032\u0030\u65E5",
  37267. "\u33F4",
  37268. "\u0032\u0031\u65E5",
  37269. "\u33F5",
  37270. "\u0032\u0032\u65E5",
  37271. "\u33F6",
  37272. "\u0032\u0033\u65E5",
  37273. "\u33F7",
  37274. "\u0032\u0034\u65E5",
  37275. "\u33F8",
  37276. "\u0032\u0035\u65E5",
  37277. "\u33F9",
  37278. "\u0032\u0036\u65E5",
  37279. "\u33FA",
  37280. "\u0032\u0037\u65E5",
  37281. "\u33FB",
  37282. "\u0032\u0038\u65E5",
  37283. "\u33FC",
  37284. "\u0032\u0039\u65E5",
  37285. "\u33FD",
  37286. "\u0033\u0030\u65E5",
  37287. "\u33FE",
  37288. "\u0033\u0031\u65E5",
  37289. "\uFB00",
  37290. "\u0066\u0066",
  37291. "\uFB01",
  37292. "\u0066\u0069",
  37293. "\uFB02",
  37294. "\u0066\u006C",
  37295. "\uFB03",
  37296. "\u0066\u0066\u0069",
  37297. "\uFB04",
  37298. "\u0066\u0066\u006C",
  37299. "\uFB05",
  37300. "\u017F\u0074",
  37301. "\uFB06",
  37302. "\u0073\u0074",
  37303. "\uFB13",
  37304. "\u0574\u0576",
  37305. "\uFB14",
  37306. "\u0574\u0565",
  37307. "\uFB15",
  37308. "\u0574\u056B",
  37309. "\uFB16",
  37310. "\u057E\u0576",
  37311. "\uFB17",
  37312. "\u0574\u056D",
  37313. "\uFB4F",
  37314. "\u05D0\u05DC",
  37315. "\uFB50",
  37316. "\u0671",
  37317. "\uFB51",
  37318. "\u0671",
  37319. "\uFB52",
  37320. "\u067B",
  37321. "\uFB53",
  37322. "\u067B",
  37323. "\uFB54",
  37324. "\u067B",
  37325. "\uFB55",
  37326. "\u067B",
  37327. "\uFB56",
  37328. "\u067E",
  37329. "\uFB57",
  37330. "\u067E",
  37331. "\uFB58",
  37332. "\u067E",
  37333. "\uFB59",
  37334. "\u067E",
  37335. "\uFB5A",
  37336. "\u0680",
  37337. "\uFB5B",
  37338. "\u0680",
  37339. "\uFB5C",
  37340. "\u0680",
  37341. "\uFB5D",
  37342. "\u0680",
  37343. "\uFB5E",
  37344. "\u067A",
  37345. "\uFB5F",
  37346. "\u067A",
  37347. "\uFB60",
  37348. "\u067A",
  37349. "\uFB61",
  37350. "\u067A",
  37351. "\uFB62",
  37352. "\u067F",
  37353. "\uFB63",
  37354. "\u067F",
  37355. "\uFB64",
  37356. "\u067F",
  37357. "\uFB65",
  37358. "\u067F",
  37359. "\uFB66",
  37360. "\u0679",
  37361. "\uFB67",
  37362. "\u0679",
  37363. "\uFB68",
  37364. "\u0679",
  37365. "\uFB69",
  37366. "\u0679",
  37367. "\uFB6A",
  37368. "\u06A4",
  37369. "\uFB6B",
  37370. "\u06A4",
  37371. "\uFB6C",
  37372. "\u06A4",
  37373. "\uFB6D",
  37374. "\u06A4",
  37375. "\uFB6E",
  37376. "\u06A6",
  37377. "\uFB6F",
  37378. "\u06A6",
  37379. "\uFB70",
  37380. "\u06A6",
  37381. "\uFB71",
  37382. "\u06A6",
  37383. "\uFB72",
  37384. "\u0684",
  37385. "\uFB73",
  37386. "\u0684",
  37387. "\uFB74",
  37388. "\u0684",
  37389. "\uFB75",
  37390. "\u0684",
  37391. "\uFB76",
  37392. "\u0683",
  37393. "\uFB77",
  37394. "\u0683",
  37395. "\uFB78",
  37396. "\u0683",
  37397. "\uFB79",
  37398. "\u0683",
  37399. "\uFB7A",
  37400. "\u0686",
  37401. "\uFB7B",
  37402. "\u0686",
  37403. "\uFB7C",
  37404. "\u0686",
  37405. "\uFB7D",
  37406. "\u0686",
  37407. "\uFB7E",
  37408. "\u0687",
  37409. "\uFB7F",
  37410. "\u0687",
  37411. "\uFB80",
  37412. "\u0687",
  37413. "\uFB81",
  37414. "\u0687",
  37415. "\uFB82",
  37416. "\u068D",
  37417. "\uFB83",
  37418. "\u068D",
  37419. "\uFB84",
  37420. "\u068C",
  37421. "\uFB85",
  37422. "\u068C",
  37423. "\uFB86",
  37424. "\u068E",
  37425. "\uFB87",
  37426. "\u068E",
  37427. "\uFB88",
  37428. "\u0688",
  37429. "\uFB89",
  37430. "\u0688",
  37431. "\uFB8A",
  37432. "\u0698",
  37433. "\uFB8B",
  37434. "\u0698",
  37435. "\uFB8C",
  37436. "\u0691",
  37437. "\uFB8D",
  37438. "\u0691",
  37439. "\uFB8E",
  37440. "\u06A9",
  37441. "\uFB8F",
  37442. "\u06A9",
  37443. "\uFB90",
  37444. "\u06A9",
  37445. "\uFB91",
  37446. "\u06A9",
  37447. "\uFB92",
  37448. "\u06AF",
  37449. "\uFB93",
  37450. "\u06AF",
  37451. "\uFB94",
  37452. "\u06AF",
  37453. "\uFB95",
  37454. "\u06AF",
  37455. "\uFB96",
  37456. "\u06B3",
  37457. "\uFB97",
  37458. "\u06B3",
  37459. "\uFB98",
  37460. "\u06B3",
  37461. "\uFB99",
  37462. "\u06B3",
  37463. "\uFB9A",
  37464. "\u06B1",
  37465. "\uFB9B",
  37466. "\u06B1",
  37467. "\uFB9C",
  37468. "\u06B1",
  37469. "\uFB9D",
  37470. "\u06B1",
  37471. "\uFB9E",
  37472. "\u06BA",
  37473. "\uFB9F",
  37474. "\u06BA",
  37475. "\uFBA0",
  37476. "\u06BB",
  37477. "\uFBA1",
  37478. "\u06BB",
  37479. "\uFBA2",
  37480. "\u06BB",
  37481. "\uFBA3",
  37482. "\u06BB",
  37483. "\uFBA4",
  37484. "\u06C0",
  37485. "\uFBA5",
  37486. "\u06C0",
  37487. "\uFBA6",
  37488. "\u06C1",
  37489. "\uFBA7",
  37490. "\u06C1",
  37491. "\uFBA8",
  37492. "\u06C1",
  37493. "\uFBA9",
  37494. "\u06C1",
  37495. "\uFBAA",
  37496. "\u06BE",
  37497. "\uFBAB",
  37498. "\u06BE",
  37499. "\uFBAC",
  37500. "\u06BE",
  37501. "\uFBAD",
  37502. "\u06BE",
  37503. "\uFBAE",
  37504. "\u06D2",
  37505. "\uFBAF",
  37506. "\u06D2",
  37507. "\uFBB0",
  37508. "\u06D3",
  37509. "\uFBB1",
  37510. "\u06D3",
  37511. "\uFBD3",
  37512. "\u06AD",
  37513. "\uFBD4",
  37514. "\u06AD",
  37515. "\uFBD5",
  37516. "\u06AD",
  37517. "\uFBD6",
  37518. "\u06AD",
  37519. "\uFBD7",
  37520. "\u06C7",
  37521. "\uFBD8",
  37522. "\u06C7",
  37523. "\uFBD9",
  37524. "\u06C6",
  37525. "\uFBDA",
  37526. "\u06C6",
  37527. "\uFBDB",
  37528. "\u06C8",
  37529. "\uFBDC",
  37530. "\u06C8",
  37531. "\uFBDD",
  37532. "\u0677",
  37533. "\uFBDE",
  37534. "\u06CB",
  37535. "\uFBDF",
  37536. "\u06CB",
  37537. "\uFBE0",
  37538. "\u06C5",
  37539. "\uFBE1",
  37540. "\u06C5",
  37541. "\uFBE2",
  37542. "\u06C9",
  37543. "\uFBE3",
  37544. "\u06C9",
  37545. "\uFBE4",
  37546. "\u06D0",
  37547. "\uFBE5",
  37548. "\u06D0",
  37549. "\uFBE6",
  37550. "\u06D0",
  37551. "\uFBE7",
  37552. "\u06D0",
  37553. "\uFBE8",
  37554. "\u0649",
  37555. "\uFBE9",
  37556. "\u0649",
  37557. "\uFBEA",
  37558. "\u0626\u0627",
  37559. "\uFBEB",
  37560. "\u0626\u0627",
  37561. "\uFBEC",
  37562. "\u0626\u06D5",
  37563. "\uFBED",
  37564. "\u0626\u06D5",
  37565. "\uFBEE",
  37566. "\u0626\u0648",
  37567. "\uFBEF",
  37568. "\u0626\u0648",
  37569. "\uFBF0",
  37570. "\u0626\u06C7",
  37571. "\uFBF1",
  37572. "\u0626\u06C7",
  37573. "\uFBF2",
  37574. "\u0626\u06C6",
  37575. "\uFBF3",
  37576. "\u0626\u06C6",
  37577. "\uFBF4",
  37578. "\u0626\u06C8",
  37579. "\uFBF5",
  37580. "\u0626\u06C8",
  37581. "\uFBF6",
  37582. "\u0626\u06D0",
  37583. "\uFBF7",
  37584. "\u0626\u06D0",
  37585. "\uFBF8",
  37586. "\u0626\u06D0",
  37587. "\uFBF9",
  37588. "\u0626\u0649",
  37589. "\uFBFA",
  37590. "\u0626\u0649",
  37591. "\uFBFB",
  37592. "\u0626\u0649",
  37593. "\uFBFC",
  37594. "\u06CC",
  37595. "\uFBFD",
  37596. "\u06CC",
  37597. "\uFBFE",
  37598. "\u06CC",
  37599. "\uFBFF",
  37600. "\u06CC",
  37601. "\uFC00",
  37602. "\u0626\u062C",
  37603. "\uFC01",
  37604. "\u0626\u062D",
  37605. "\uFC02",
  37606. "\u0626\u0645",
  37607. "\uFC03",
  37608. "\u0626\u0649",
  37609. "\uFC04",
  37610. "\u0626\u064A",
  37611. "\uFC05",
  37612. "\u0628\u062C",
  37613. "\uFC06",
  37614. "\u0628\u062D",
  37615. "\uFC07",
  37616. "\u0628\u062E",
  37617. "\uFC08",
  37618. "\u0628\u0645",
  37619. "\uFC09",
  37620. "\u0628\u0649",
  37621. "\uFC0A",
  37622. "\u0628\u064A",
  37623. "\uFC0B",
  37624. "\u062A\u062C",
  37625. "\uFC0C",
  37626. "\u062A\u062D",
  37627. "\uFC0D",
  37628. "\u062A\u062E",
  37629. "\uFC0E",
  37630. "\u062A\u0645",
  37631. "\uFC0F",
  37632. "\u062A\u0649",
  37633. "\uFC10",
  37634. "\u062A\u064A",
  37635. "\uFC11",
  37636. "\u062B\u062C",
  37637. "\uFC12",
  37638. "\u062B\u0645",
  37639. "\uFC13",
  37640. "\u062B\u0649",
  37641. "\uFC14",
  37642. "\u062B\u064A",
  37643. "\uFC15",
  37644. "\u062C\u062D",
  37645. "\uFC16",
  37646. "\u062C\u0645",
  37647. "\uFC17",
  37648. "\u062D\u062C",
  37649. "\uFC18",
  37650. "\u062D\u0645",
  37651. "\uFC19",
  37652. "\u062E\u062C",
  37653. "\uFC1A",
  37654. "\u062E\u062D",
  37655. "\uFC1B",
  37656. "\u062E\u0645",
  37657. "\uFC1C",
  37658. "\u0633\u062C",
  37659. "\uFC1D",
  37660. "\u0633\u062D",
  37661. "\uFC1E",
  37662. "\u0633\u062E",
  37663. "\uFC1F",
  37664. "\u0633\u0645",
  37665. "\uFC20",
  37666. "\u0635\u062D",
  37667. "\uFC21",
  37668. "\u0635\u0645",
  37669. "\uFC22",
  37670. "\u0636\u062C",
  37671. "\uFC23",
  37672. "\u0636\u062D",
  37673. "\uFC24",
  37674. "\u0636\u062E",
  37675. "\uFC25",
  37676. "\u0636\u0645",
  37677. "\uFC26",
  37678. "\u0637\u062D",
  37679. "\uFC27",
  37680. "\u0637\u0645",
  37681. "\uFC28",
  37682. "\u0638\u0645",
  37683. "\uFC29",
  37684. "\u0639\u062C",
  37685. "\uFC2A",
  37686. "\u0639\u0645",
  37687. "\uFC2B",
  37688. "\u063A\u062C",
  37689. "\uFC2C",
  37690. "\u063A\u0645",
  37691. "\uFC2D",
  37692. "\u0641\u062C",
  37693. "\uFC2E",
  37694. "\u0641\u062D",
  37695. "\uFC2F",
  37696. "\u0641\u062E",
  37697. "\uFC30",
  37698. "\u0641\u0645",
  37699. "\uFC31",
  37700. "\u0641\u0649",
  37701. "\uFC32",
  37702. "\u0641\u064A",
  37703. "\uFC33",
  37704. "\u0642\u062D",
  37705. "\uFC34",
  37706. "\u0642\u0645",
  37707. "\uFC35",
  37708. "\u0642\u0649",
  37709. "\uFC36",
  37710. "\u0642\u064A",
  37711. "\uFC37",
  37712. "\u0643\u0627",
  37713. "\uFC38",
  37714. "\u0643\u062C",
  37715. "\uFC39",
  37716. "\u0643\u062D",
  37717. "\uFC3A",
  37718. "\u0643\u062E",
  37719. "\uFC3B",
  37720. "\u0643\u0644",
  37721. "\uFC3C",
  37722. "\u0643\u0645",
  37723. "\uFC3D",
  37724. "\u0643\u0649",
  37725. "\uFC3E",
  37726. "\u0643\u064A",
  37727. "\uFC3F",
  37728. "\u0644\u062C",
  37729. "\uFC40",
  37730. "\u0644\u062D",
  37731. "\uFC41",
  37732. "\u0644\u062E",
  37733. "\uFC42",
  37734. "\u0644\u0645",
  37735. "\uFC43",
  37736. "\u0644\u0649",
  37737. "\uFC44",
  37738. "\u0644\u064A",
  37739. "\uFC45",
  37740. "\u0645\u062C",
  37741. "\uFC46",
  37742. "\u0645\u062D",
  37743. "\uFC47",
  37744. "\u0645\u062E",
  37745. "\uFC48",
  37746. "\u0645\u0645",
  37747. "\uFC49",
  37748. "\u0645\u0649",
  37749. "\uFC4A",
  37750. "\u0645\u064A",
  37751. "\uFC4B",
  37752. "\u0646\u062C",
  37753. "\uFC4C",
  37754. "\u0646\u062D",
  37755. "\uFC4D",
  37756. "\u0646\u062E",
  37757. "\uFC4E",
  37758. "\u0646\u0645",
  37759. "\uFC4F",
  37760. "\u0646\u0649",
  37761. "\uFC50",
  37762. "\u0646\u064A",
  37763. "\uFC51",
  37764. "\u0647\u062C",
  37765. "\uFC52",
  37766. "\u0647\u0645",
  37767. "\uFC53",
  37768. "\u0647\u0649",
  37769. "\uFC54",
  37770. "\u0647\u064A",
  37771. "\uFC55",
  37772. "\u064A\u062C",
  37773. "\uFC56",
  37774. "\u064A\u062D",
  37775. "\uFC57",
  37776. "\u064A\u062E",
  37777. "\uFC58",
  37778. "\u064A\u0645",
  37779. "\uFC59",
  37780. "\u064A\u0649",
  37781. "\uFC5A",
  37782. "\u064A\u064A",
  37783. "\uFC5B",
  37784. "\u0630\u0670",
  37785. "\uFC5C",
  37786. "\u0631\u0670",
  37787. "\uFC5D",
  37788. "\u0649\u0670",
  37789. "\uFC5E",
  37790. "\u0020\u064C\u0651",
  37791. "\uFC5F",
  37792. "\u0020\u064D\u0651",
  37793. "\uFC60",
  37794. "\u0020\u064E\u0651",
  37795. "\uFC61",
  37796. "\u0020\u064F\u0651",
  37797. "\uFC62",
  37798. "\u0020\u0650\u0651",
  37799. "\uFC63",
  37800. "\u0020\u0651\u0670",
  37801. "\uFC64",
  37802. "\u0626\u0631",
  37803. "\uFC65",
  37804. "\u0626\u0632",
  37805. "\uFC66",
  37806. "\u0626\u0645",
  37807. "\uFC67",
  37808. "\u0626\u0646",
  37809. "\uFC68",
  37810. "\u0626\u0649",
  37811. "\uFC69",
  37812. "\u0626\u064A",
  37813. "\uFC6A",
  37814. "\u0628\u0631",
  37815. "\uFC6B",
  37816. "\u0628\u0632",
  37817. "\uFC6C",
  37818. "\u0628\u0645",
  37819. "\uFC6D",
  37820. "\u0628\u0646",
  37821. "\uFC6E",
  37822. "\u0628\u0649",
  37823. "\uFC6F",
  37824. "\u0628\u064A",
  37825. "\uFC70",
  37826. "\u062A\u0631",
  37827. "\uFC71",
  37828. "\u062A\u0632",
  37829. "\uFC72",
  37830. "\u062A\u0645",
  37831. "\uFC73",
  37832. "\u062A\u0646",
  37833. "\uFC74",
  37834. "\u062A\u0649",
  37835. "\uFC75",
  37836. "\u062A\u064A",
  37837. "\uFC76",
  37838. "\u062B\u0631",
  37839. "\uFC77",
  37840. "\u062B\u0632",
  37841. "\uFC78",
  37842. "\u062B\u0645",
  37843. "\uFC79",
  37844. "\u062B\u0646",
  37845. "\uFC7A",
  37846. "\u062B\u0649",
  37847. "\uFC7B",
  37848. "\u062B\u064A",
  37849. "\uFC7C",
  37850. "\u0641\u0649",
  37851. "\uFC7D",
  37852. "\u0641\u064A",
  37853. "\uFC7E",
  37854. "\u0642\u0649",
  37855. "\uFC7F",
  37856. "\u0642\u064A",
  37857. "\uFC80",
  37858. "\u0643\u0627",
  37859. "\uFC81",
  37860. "\u0643\u0644",
  37861. "\uFC82",
  37862. "\u0643\u0645",
  37863. "\uFC83",
  37864. "\u0643\u0649",
  37865. "\uFC84",
  37866. "\u0643\u064A",
  37867. "\uFC85",
  37868. "\u0644\u0645",
  37869. "\uFC86",
  37870. "\u0644\u0649",
  37871. "\uFC87",
  37872. "\u0644\u064A",
  37873. "\uFC88",
  37874. "\u0645\u0627",
  37875. "\uFC89",
  37876. "\u0645\u0645",
  37877. "\uFC8A",
  37878. "\u0646\u0631",
  37879. "\uFC8B",
  37880. "\u0646\u0632",
  37881. "\uFC8C",
  37882. "\u0646\u0645",
  37883. "\uFC8D",
  37884. "\u0646\u0646",
  37885. "\uFC8E",
  37886. "\u0646\u0649",
  37887. "\uFC8F",
  37888. "\u0646\u064A",
  37889. "\uFC90",
  37890. "\u0649\u0670",
  37891. "\uFC91",
  37892. "\u064A\u0631",
  37893. "\uFC92",
  37894. "\u064A\u0632",
  37895. "\uFC93",
  37896. "\u064A\u0645",
  37897. "\uFC94",
  37898. "\u064A\u0646",
  37899. "\uFC95",
  37900. "\u064A\u0649",
  37901. "\uFC96",
  37902. "\u064A\u064A",
  37903. "\uFC97",
  37904. "\u0626\u062C",
  37905. "\uFC98",
  37906. "\u0626\u062D",
  37907. "\uFC99",
  37908. "\u0626\u062E",
  37909. "\uFC9A",
  37910. "\u0626\u0645",
  37911. "\uFC9B",
  37912. "\u0626\u0647",
  37913. "\uFC9C",
  37914. "\u0628\u062C",
  37915. "\uFC9D",
  37916. "\u0628\u062D",
  37917. "\uFC9E",
  37918. "\u0628\u062E",
  37919. "\uFC9F",
  37920. "\u0628\u0645",
  37921. "\uFCA0",
  37922. "\u0628\u0647",
  37923. "\uFCA1",
  37924. "\u062A\u062C",
  37925. "\uFCA2",
  37926. "\u062A\u062D",
  37927. "\uFCA3",
  37928. "\u062A\u062E",
  37929. "\uFCA4",
  37930. "\u062A\u0645",
  37931. "\uFCA5",
  37932. "\u062A\u0647",
  37933. "\uFCA6",
  37934. "\u062B\u0645",
  37935. "\uFCA7",
  37936. "\u062C\u062D",
  37937. "\uFCA8",
  37938. "\u062C\u0645",
  37939. "\uFCA9",
  37940. "\u062D\u062C",
  37941. "\uFCAA",
  37942. "\u062D\u0645",
  37943. "\uFCAB",
  37944. "\u062E\u062C",
  37945. "\uFCAC",
  37946. "\u062E\u0645",
  37947. "\uFCAD",
  37948. "\u0633\u062C",
  37949. "\uFCAE",
  37950. "\u0633\u062D",
  37951. "\uFCAF",
  37952. "\u0633\u062E",
  37953. "\uFCB0",
  37954. "\u0633\u0645",
  37955. "\uFCB1",
  37956. "\u0635\u062D",
  37957. "\uFCB2",
  37958. "\u0635\u062E",
  37959. "\uFCB3",
  37960. "\u0635\u0645",
  37961. "\uFCB4",
  37962. "\u0636\u062C",
  37963. "\uFCB5",
  37964. "\u0636\u062D",
  37965. "\uFCB6",
  37966. "\u0636\u062E",
  37967. "\uFCB7",
  37968. "\u0636\u0645",
  37969. "\uFCB8",
  37970. "\u0637\u062D",
  37971. "\uFCB9",
  37972. "\u0638\u0645",
  37973. "\uFCBA",
  37974. "\u0639\u062C",
  37975. "\uFCBB",
  37976. "\u0639\u0645",
  37977. "\uFCBC",
  37978. "\u063A\u062C",
  37979. "\uFCBD",
  37980. "\u063A\u0645",
  37981. "\uFCBE",
  37982. "\u0641\u062C",
  37983. "\uFCBF",
  37984. "\u0641\u062D",
  37985. "\uFCC0",
  37986. "\u0641\u062E",
  37987. "\uFCC1",
  37988. "\u0641\u0645",
  37989. "\uFCC2",
  37990. "\u0642\u062D",
  37991. "\uFCC3",
  37992. "\u0642\u0645",
  37993. "\uFCC4",
  37994. "\u0643\u062C",
  37995. "\uFCC5",
  37996. "\u0643\u062D",
  37997. "\uFCC6",
  37998. "\u0643\u062E",
  37999. "\uFCC7",
  38000. "\u0643\u0644",
  38001. "\uFCC8",
  38002. "\u0643\u0645",
  38003. "\uFCC9",
  38004. "\u0644\u062C",
  38005. "\uFCCA",
  38006. "\u0644\u062D",
  38007. "\uFCCB",
  38008. "\u0644\u062E",
  38009. "\uFCCC",
  38010. "\u0644\u0645",
  38011. "\uFCCD",
  38012. "\u0644\u0647",
  38013. "\uFCCE",
  38014. "\u0645\u062C",
  38015. "\uFCCF",
  38016. "\u0645\u062D",
  38017. "\uFCD0",
  38018. "\u0645\u062E",
  38019. "\uFCD1",
  38020. "\u0645\u0645",
  38021. "\uFCD2",
  38022. "\u0646\u062C",
  38023. "\uFCD3",
  38024. "\u0646\u062D",
  38025. "\uFCD4",
  38026. "\u0646\u062E",
  38027. "\uFCD5",
  38028. "\u0646\u0645",
  38029. "\uFCD6",
  38030. "\u0646\u0647",
  38031. "\uFCD7",
  38032. "\u0647\u062C",
  38033. "\uFCD8",
  38034. "\u0647\u0645",
  38035. "\uFCD9",
  38036. "\u0647\u0670",
  38037. "\uFCDA",
  38038. "\u064A\u062C",
  38039. "\uFCDB",
  38040. "\u064A\u062D",
  38041. "\uFCDC",
  38042. "\u064A\u062E",
  38043. "\uFCDD",
  38044. "\u064A\u0645",
  38045. "\uFCDE",
  38046. "\u064A\u0647",
  38047. "\uFCDF",
  38048. "\u0626\u0645",
  38049. "\uFCE0",
  38050. "\u0626\u0647",
  38051. "\uFCE1",
  38052. "\u0628\u0645",
  38053. "\uFCE2",
  38054. "\u0628\u0647",
  38055. "\uFCE3",
  38056. "\u062A\u0645",
  38057. "\uFCE4",
  38058. "\u062A\u0647",
  38059. "\uFCE5",
  38060. "\u062B\u0645",
  38061. "\uFCE6",
  38062. "\u062B\u0647",
  38063. "\uFCE7",
  38064. "\u0633\u0645",
  38065. "\uFCE8",
  38066. "\u0633\u0647",
  38067. "\uFCE9",
  38068. "\u0634\u0645",
  38069. "\uFCEA",
  38070. "\u0634\u0647",
  38071. "\uFCEB",
  38072. "\u0643\u0644",
  38073. "\uFCEC",
  38074. "\u0643\u0645",
  38075. "\uFCED",
  38076. "\u0644\u0645",
  38077. "\uFCEE",
  38078. "\u0646\u0645",
  38079. "\uFCEF",
  38080. "\u0646\u0647",
  38081. "\uFCF0",
  38082. "\u064A\u0645",
  38083. "\uFCF1",
  38084. "\u064A\u0647",
  38085. "\uFCF2",
  38086. "\u0640\u064E\u0651",
  38087. "\uFCF3",
  38088. "\u0640\u064F\u0651",
  38089. "\uFCF4",
  38090. "\u0640\u0650\u0651",
  38091. "\uFCF5",
  38092. "\u0637\u0649",
  38093. "\uFCF6",
  38094. "\u0637\u064A",
  38095. "\uFCF7",
  38096. "\u0639\u0649",
  38097. "\uFCF8",
  38098. "\u0639\u064A",
  38099. "\uFCF9",
  38100. "\u063A\u0649",
  38101. "\uFCFA",
  38102. "\u063A\u064A",
  38103. "\uFCFB",
  38104. "\u0633\u0649",
  38105. "\uFCFC",
  38106. "\u0633\u064A",
  38107. "\uFCFD",
  38108. "\u0634\u0649",
  38109. "\uFCFE",
  38110. "\u0634\u064A",
  38111. "\uFCFF",
  38112. "\u062D\u0649",
  38113. "\uFD00",
  38114. "\u062D\u064A",
  38115. "\uFD01",
  38116. "\u062C\u0649",
  38117. "\uFD02",
  38118. "\u062C\u064A",
  38119. "\uFD03",
  38120. "\u062E\u0649",
  38121. "\uFD04",
  38122. "\u062E\u064A",
  38123. "\uFD05",
  38124. "\u0635\u0649",
  38125. "\uFD06",
  38126. "\u0635\u064A",
  38127. "\uFD07",
  38128. "\u0636\u0649",
  38129. "\uFD08",
  38130. "\u0636\u064A",
  38131. "\uFD09",
  38132. "\u0634\u062C",
  38133. "\uFD0A",
  38134. "\u0634\u062D",
  38135. "\uFD0B",
  38136. "\u0634\u062E",
  38137. "\uFD0C",
  38138. "\u0634\u0645",
  38139. "\uFD0D",
  38140. "\u0634\u0631",
  38141. "\uFD0E",
  38142. "\u0633\u0631",
  38143. "\uFD0F",
  38144. "\u0635\u0631",
  38145. "\uFD10",
  38146. "\u0636\u0631",
  38147. "\uFD11",
  38148. "\u0637\u0649",
  38149. "\uFD12",
  38150. "\u0637\u064A",
  38151. "\uFD13",
  38152. "\u0639\u0649",
  38153. "\uFD14",
  38154. "\u0639\u064A",
  38155. "\uFD15",
  38156. "\u063A\u0649",
  38157. "\uFD16",
  38158. "\u063A\u064A",
  38159. "\uFD17",
  38160. "\u0633\u0649",
  38161. "\uFD18",
  38162. "\u0633\u064A",
  38163. "\uFD19",
  38164. "\u0634\u0649",
  38165. "\uFD1A",
  38166. "\u0634\u064A",
  38167. "\uFD1B",
  38168. "\u062D\u0649",
  38169. "\uFD1C",
  38170. "\u062D\u064A",
  38171. "\uFD1D",
  38172. "\u062C\u0649",
  38173. "\uFD1E",
  38174. "\u062C\u064A",
  38175. "\uFD1F",
  38176. "\u062E\u0649",
  38177. "\uFD20",
  38178. "\u062E\u064A",
  38179. "\uFD21",
  38180. "\u0635\u0649",
  38181. "\uFD22",
  38182. "\u0635\u064A",
  38183. "\uFD23",
  38184. "\u0636\u0649",
  38185. "\uFD24",
  38186. "\u0636\u064A",
  38187. "\uFD25",
  38188. "\u0634\u062C",
  38189. "\uFD26",
  38190. "\u0634\u062D",
  38191. "\uFD27",
  38192. "\u0634\u062E",
  38193. "\uFD28",
  38194. "\u0634\u0645",
  38195. "\uFD29",
  38196. "\u0634\u0631",
  38197. "\uFD2A",
  38198. "\u0633\u0631",
  38199. "\uFD2B",
  38200. "\u0635\u0631",
  38201. "\uFD2C",
  38202. "\u0636\u0631",
  38203. "\uFD2D",
  38204. "\u0634\u062C",
  38205. "\uFD2E",
  38206. "\u0634\u062D",
  38207. "\uFD2F",
  38208. "\u0634\u062E",
  38209. "\uFD30",
  38210. "\u0634\u0645",
  38211. "\uFD31",
  38212. "\u0633\u0647",
  38213. "\uFD32",
  38214. "\u0634\u0647",
  38215. "\uFD33",
  38216. "\u0637\u0645",
  38217. "\uFD34",
  38218. "\u0633\u062C",
  38219. "\uFD35",
  38220. "\u0633\u062D",
  38221. "\uFD36",
  38222. "\u0633\u062E",
  38223. "\uFD37",
  38224. "\u0634\u062C",
  38225. "\uFD38",
  38226. "\u0634\u062D",
  38227. "\uFD39",
  38228. "\u0634\u062E",
  38229. "\uFD3A",
  38230. "\u0637\u0645",
  38231. "\uFD3B",
  38232. "\u0638\u0645",
  38233. "\uFD3C",
  38234. "\u0627\u064B",
  38235. "\uFD3D",
  38236. "\u0627\u064B",
  38237. "\uFD50",
  38238. "\u062A\u062C\u0645",
  38239. "\uFD51",
  38240. "\u062A\u062D\u062C",
  38241. "\uFD52",
  38242. "\u062A\u062D\u062C",
  38243. "\uFD53",
  38244. "\u062A\u062D\u0645",
  38245. "\uFD54",
  38246. "\u062A\u062E\u0645",
  38247. "\uFD55",
  38248. "\u062A\u0645\u062C",
  38249. "\uFD56",
  38250. "\u062A\u0645\u062D",
  38251. "\uFD57",
  38252. "\u062A\u0645\u062E",
  38253. "\uFD58",
  38254. "\u062C\u0645\u062D",
  38255. "\uFD59",
  38256. "\u062C\u0645\u062D",
  38257. "\uFD5A",
  38258. "\u062D\u0645\u064A",
  38259. "\uFD5B",
  38260. "\u062D\u0645\u0649",
  38261. "\uFD5C",
  38262. "\u0633\u062D\u062C",
  38263. "\uFD5D",
  38264. "\u0633\u062C\u062D",
  38265. "\uFD5E",
  38266. "\u0633\u062C\u0649",
  38267. "\uFD5F",
  38268. "\u0633\u0645\u062D",
  38269. "\uFD60",
  38270. "\u0633\u0645\u062D",
  38271. "\uFD61",
  38272. "\u0633\u0645\u062C",
  38273. "\uFD62",
  38274. "\u0633\u0645\u0645",
  38275. "\uFD63",
  38276. "\u0633\u0645\u0645",
  38277. "\uFD64",
  38278. "\u0635\u062D\u062D",
  38279. "\uFD65",
  38280. "\u0635\u062D\u062D",
  38281. "\uFD66",
  38282. "\u0635\u0645\u0645",
  38283. "\uFD67",
  38284. "\u0634\u062D\u0645",
  38285. "\uFD68",
  38286. "\u0634\u062D\u0645",
  38287. "\uFD69",
  38288. "\u0634\u062C\u064A",
  38289. "\uFD6A",
  38290. "\u0634\u0645\u062E",
  38291. "\uFD6B",
  38292. "\u0634\u0645\u062E",
  38293. "\uFD6C",
  38294. "\u0634\u0645\u0645",
  38295. "\uFD6D",
  38296. "\u0634\u0645\u0645",
  38297. "\uFD6E",
  38298. "\u0636\u062D\u0649",
  38299. "\uFD6F",
  38300. "\u0636\u062E\u0645",
  38301. "\uFD70",
  38302. "\u0636\u062E\u0645",
  38303. "\uFD71",
  38304. "\u0637\u0645\u062D",
  38305. "\uFD72",
  38306. "\u0637\u0645\u062D",
  38307. "\uFD73",
  38308. "\u0637\u0645\u0645",
  38309. "\uFD74",
  38310. "\u0637\u0645\u064A",
  38311. "\uFD75",
  38312. "\u0639\u062C\u0645",
  38313. "\uFD76",
  38314. "\u0639\u0645\u0645",
  38315. "\uFD77",
  38316. "\u0639\u0645\u0645",
  38317. "\uFD78",
  38318. "\u0639\u0645\u0649",
  38319. "\uFD79",
  38320. "\u063A\u0645\u0645",
  38321. "\uFD7A",
  38322. "\u063A\u0645\u064A",
  38323. "\uFD7B",
  38324. "\u063A\u0645\u0649",
  38325. "\uFD7C",
  38326. "\u0641\u062E\u0645",
  38327. "\uFD7D",
  38328. "\u0641\u062E\u0645",
  38329. "\uFD7E",
  38330. "\u0642\u0645\u062D",
  38331. "\uFD7F",
  38332. "\u0642\u0645\u0645",
  38333. "\uFD80",
  38334. "\u0644\u062D\u0645",
  38335. "\uFD81",
  38336. "\u0644\u062D\u064A",
  38337. "\uFD82",
  38338. "\u0644\u062D\u0649",
  38339. "\uFD83",
  38340. "\u0644\u062C\u062C",
  38341. "\uFD84",
  38342. "\u0644\u062C\u062C",
  38343. "\uFD85",
  38344. "\u0644\u062E\u0645",
  38345. "\uFD86",
  38346. "\u0644\u062E\u0645",
  38347. "\uFD87",
  38348. "\u0644\u0645\u062D",
  38349. "\uFD88",
  38350. "\u0644\u0645\u062D",
  38351. "\uFD89",
  38352. "\u0645\u062D\u062C",
  38353. "\uFD8A",
  38354. "\u0645\u062D\u0645",
  38355. "\uFD8B",
  38356. "\u0645\u062D\u064A",
  38357. "\uFD8C",
  38358. "\u0645\u062C\u062D",
  38359. "\uFD8D",
  38360. "\u0645\u062C\u0645",
  38361. "\uFD8E",
  38362. "\u0645\u062E\u062C",
  38363. "\uFD8F",
  38364. "\u0645\u062E\u0645",
  38365. "\uFD92",
  38366. "\u0645\u062C\u062E",
  38367. "\uFD93",
  38368. "\u0647\u0645\u062C",
  38369. "\uFD94",
  38370. "\u0647\u0645\u0645",
  38371. "\uFD95",
  38372. "\u0646\u062D\u0645",
  38373. "\uFD96",
  38374. "\u0646\u062D\u0649",
  38375. "\uFD97",
  38376. "\u0646\u062C\u0645",
  38377. "\uFD98",
  38378. "\u0646\u062C\u0645",
  38379. "\uFD99",
  38380. "\u0646\u062C\u0649",
  38381. "\uFD9A",
  38382. "\u0646\u0645\u064A",
  38383. "\uFD9B",
  38384. "\u0646\u0645\u0649",
  38385. "\uFD9C",
  38386. "\u064A\u0645\u0645",
  38387. "\uFD9D",
  38388. "\u064A\u0645\u0645",
  38389. "\uFD9E",
  38390. "\u0628\u062E\u064A",
  38391. "\uFD9F",
  38392. "\u062A\u062C\u064A",
  38393. "\uFDA0",
  38394. "\u062A\u062C\u0649",
  38395. "\uFDA1",
  38396. "\u062A\u062E\u064A",
  38397. "\uFDA2",
  38398. "\u062A\u062E\u0649",
  38399. "\uFDA3",
  38400. "\u062A\u0645\u064A",
  38401. "\uFDA4",
  38402. "\u062A\u0645\u0649",
  38403. "\uFDA5",
  38404. "\u062C\u0645\u064A",
  38405. "\uFDA6",
  38406. "\u062C\u062D\u0649",
  38407. "\uFDA7",
  38408. "\u062C\u0645\u0649",
  38409. "\uFDA8",
  38410. "\u0633\u062E\u0649",
  38411. "\uFDA9",
  38412. "\u0635\u062D\u064A",
  38413. "\uFDAA",
  38414. "\u0634\u062D\u064A",
  38415. "\uFDAB",
  38416. "\u0636\u062D\u064A",
  38417. "\uFDAC",
  38418. "\u0644\u062C\u064A",
  38419. "\uFDAD",
  38420. "\u0644\u0645\u064A",
  38421. "\uFDAE",
  38422. "\u064A\u062D\u064A",
  38423. "\uFDAF",
  38424. "\u064A\u062C\u064A",
  38425. "\uFDB0",
  38426. "\u064A\u0645\u064A",
  38427. "\uFDB1",
  38428. "\u0645\u0645\u064A",
  38429. "\uFDB2",
  38430. "\u0642\u0645\u064A",
  38431. "\uFDB3",
  38432. "\u0646\u062D\u064A",
  38433. "\uFDB4",
  38434. "\u0642\u0645\u062D",
  38435. "\uFDB5",
  38436. "\u0644\u062D\u0645",
  38437. "\uFDB6",
  38438. "\u0639\u0645\u064A",
  38439. "\uFDB7",
  38440. "\u0643\u0645\u064A",
  38441. "\uFDB8",
  38442. "\u0646\u062C\u062D",
  38443. "\uFDB9",
  38444. "\u0645\u062E\u064A",
  38445. "\uFDBA",
  38446. "\u0644\u062C\u0645",
  38447. "\uFDBB",
  38448. "\u0643\u0645\u0645",
  38449. "\uFDBC",
  38450. "\u0644\u062C\u0645",
  38451. "\uFDBD",
  38452. "\u0646\u062C\u062D",
  38453. "\uFDBE",
  38454. "\u062C\u062D\u064A",
  38455. "\uFDBF",
  38456. "\u062D\u062C\u064A",
  38457. "\uFDC0",
  38458. "\u0645\u062C\u064A",
  38459. "\uFDC1",
  38460. "\u0641\u0645\u064A",
  38461. "\uFDC2",
  38462. "\u0628\u062D\u064A",
  38463. "\uFDC3",
  38464. "\u0643\u0645\u0645",
  38465. "\uFDC4",
  38466. "\u0639\u062C\u0645",
  38467. "\uFDC5",
  38468. "\u0635\u0645\u0645",
  38469. "\uFDC6",
  38470. "\u0633\u062E\u064A",
  38471. "\uFDC7",
  38472. "\u0646\u062C\u064A",
  38473. "\uFE49",
  38474. "\u203E",
  38475. "\uFE4A",
  38476. "\u203E",
  38477. "\uFE4B",
  38478. "\u203E",
  38479. "\uFE4C",
  38480. "\u203E",
  38481. "\uFE4D",
  38482. "\u005F",
  38483. "\uFE4E",
  38484. "\u005F",
  38485. "\uFE4F",
  38486. "\u005F",
  38487. "\uFE80",
  38488. "\u0621",
  38489. "\uFE81",
  38490. "\u0622",
  38491. "\uFE82",
  38492. "\u0622",
  38493. "\uFE83",
  38494. "\u0623",
  38495. "\uFE84",
  38496. "\u0623",
  38497. "\uFE85",
  38498. "\u0624",
  38499. "\uFE86",
  38500. "\u0624",
  38501. "\uFE87",
  38502. "\u0625",
  38503. "\uFE88",
  38504. "\u0625",
  38505. "\uFE89",
  38506. "\u0626",
  38507. "\uFE8A",
  38508. "\u0626",
  38509. "\uFE8B",
  38510. "\u0626",
  38511. "\uFE8C",
  38512. "\u0626",
  38513. "\uFE8D",
  38514. "\u0627",
  38515. "\uFE8E",
  38516. "\u0627",
  38517. "\uFE8F",
  38518. "\u0628",
  38519. "\uFE90",
  38520. "\u0628",
  38521. "\uFE91",
  38522. "\u0628",
  38523. "\uFE92",
  38524. "\u0628",
  38525. "\uFE93",
  38526. "\u0629",
  38527. "\uFE94",
  38528. "\u0629",
  38529. "\uFE95",
  38530. "\u062A",
  38531. "\uFE96",
  38532. "\u062A",
  38533. "\uFE97",
  38534. "\u062A",
  38535. "\uFE98",
  38536. "\u062A",
  38537. "\uFE99",
  38538. "\u062B",
  38539. "\uFE9A",
  38540. "\u062B",
  38541. "\uFE9B",
  38542. "\u062B",
  38543. "\uFE9C",
  38544. "\u062B",
  38545. "\uFE9D",
  38546. "\u062C",
  38547. "\uFE9E",
  38548. "\u062C",
  38549. "\uFE9F",
  38550. "\u062C",
  38551. "\uFEA0",
  38552. "\u062C",
  38553. "\uFEA1",
  38554. "\u062D",
  38555. "\uFEA2",
  38556. "\u062D",
  38557. "\uFEA3",
  38558. "\u062D",
  38559. "\uFEA4",
  38560. "\u062D",
  38561. "\uFEA5",
  38562. "\u062E",
  38563. "\uFEA6",
  38564. "\u062E",
  38565. "\uFEA7",
  38566. "\u062E",
  38567. "\uFEA8",
  38568. "\u062E",
  38569. "\uFEA9",
  38570. "\u062F",
  38571. "\uFEAA",
  38572. "\u062F",
  38573. "\uFEAB",
  38574. "\u0630",
  38575. "\uFEAC",
  38576. "\u0630",
  38577. "\uFEAD",
  38578. "\u0631",
  38579. "\uFEAE",
  38580. "\u0631",
  38581. "\uFEAF",
  38582. "\u0632",
  38583. "\uFEB0",
  38584. "\u0632",
  38585. "\uFEB1",
  38586. "\u0633",
  38587. "\uFEB2",
  38588. "\u0633",
  38589. "\uFEB3",
  38590. "\u0633",
  38591. "\uFEB4",
  38592. "\u0633",
  38593. "\uFEB5",
  38594. "\u0634",
  38595. "\uFEB6",
  38596. "\u0634",
  38597. "\uFEB7",
  38598. "\u0634",
  38599. "\uFEB8",
  38600. "\u0634",
  38601. "\uFEB9",
  38602. "\u0635",
  38603. "\uFEBA",
  38604. "\u0635",
  38605. "\uFEBB",
  38606. "\u0635",
  38607. "\uFEBC",
  38608. "\u0635",
  38609. "\uFEBD",
  38610. "\u0636",
  38611. "\uFEBE",
  38612. "\u0636",
  38613. "\uFEBF",
  38614. "\u0636",
  38615. "\uFEC0",
  38616. "\u0636",
  38617. "\uFEC1",
  38618. "\u0637",
  38619. "\uFEC2",
  38620. "\u0637",
  38621. "\uFEC3",
  38622. "\u0637",
  38623. "\uFEC4",
  38624. "\u0637",
  38625. "\uFEC5",
  38626. "\u0638",
  38627. "\uFEC6",
  38628. "\u0638",
  38629. "\uFEC7",
  38630. "\u0638",
  38631. "\uFEC8",
  38632. "\u0638",
  38633. "\uFEC9",
  38634. "\u0639",
  38635. "\uFECA",
  38636. "\u0639",
  38637. "\uFECB",
  38638. "\u0639",
  38639. "\uFECC",
  38640. "\u0639",
  38641. "\uFECD",
  38642. "\u063A",
  38643. "\uFECE",
  38644. "\u063A",
  38645. "\uFECF",
  38646. "\u063A",
  38647. "\uFED0",
  38648. "\u063A",
  38649. "\uFED1",
  38650. "\u0641",
  38651. "\uFED2",
  38652. "\u0641",
  38653. "\uFED3",
  38654. "\u0641",
  38655. "\uFED4",
  38656. "\u0641",
  38657. "\uFED5",
  38658. "\u0642",
  38659. "\uFED6",
  38660. "\u0642",
  38661. "\uFED7",
  38662. "\u0642",
  38663. "\uFED8",
  38664. "\u0642",
  38665. "\uFED9",
  38666. "\u0643",
  38667. "\uFEDA",
  38668. "\u0643",
  38669. "\uFEDB",
  38670. "\u0643",
  38671. "\uFEDC",
  38672. "\u0643",
  38673. "\uFEDD",
  38674. "\u0644",
  38675. "\uFEDE",
  38676. "\u0644",
  38677. "\uFEDF",
  38678. "\u0644",
  38679. "\uFEE0",
  38680. "\u0644",
  38681. "\uFEE1",
  38682. "\u0645",
  38683. "\uFEE2",
  38684. "\u0645",
  38685. "\uFEE3",
  38686. "\u0645",
  38687. "\uFEE4",
  38688. "\u0645",
  38689. "\uFEE5",
  38690. "\u0646",
  38691. "\uFEE6",
  38692. "\u0646",
  38693. "\uFEE7",
  38694. "\u0646",
  38695. "\uFEE8",
  38696. "\u0646",
  38697. "\uFEE9",
  38698. "\u0647",
  38699. "\uFEEA",
  38700. "\u0647",
  38701. "\uFEEB",
  38702. "\u0647",
  38703. "\uFEEC",
  38704. "\u0647",
  38705. "\uFEED",
  38706. "\u0648",
  38707. "\uFEEE",
  38708. "\u0648",
  38709. "\uFEEF",
  38710. "\u0649",
  38711. "\uFEF0",
  38712. "\u0649",
  38713. "\uFEF1",
  38714. "\u064A",
  38715. "\uFEF2",
  38716. "\u064A",
  38717. "\uFEF3",
  38718. "\u064A",
  38719. "\uFEF4",
  38720. "\u064A",
  38721. "\uFEF5",
  38722. "\u0644\u0622",
  38723. "\uFEF6",
  38724. "\u0644\u0622",
  38725. "\uFEF7",
  38726. "\u0644\u0623",
  38727. "\uFEF8",
  38728. "\u0644\u0623",
  38729. "\uFEF9",
  38730. "\u0644\u0625",
  38731. "\uFEFA",
  38732. "\u0644\u0625",
  38733. "\uFEFB",
  38734. "\u0644\u0627",
  38735. "\uFEFC",
  38736. "\u0644\u0627"
  38737. ];
  38738. });
  38739. function reverseIfRtl(chars) {
  38740. var charsLength = chars.length;
  38741. if (charsLength <= 1 || !isRTLRangeFor(chars.charCodeAt(0))) {
  38742. return chars;
  38743. }
  38744. var s = "";
  38745. for (var ii = charsLength - 1; ii >= 0; ii--) {
  38746. s += chars[ii];
  38747. }
  38748. return s;
  38749. }
  38750. /***/ }),
  38751. /* 36 */
  38752. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  38753. Object.defineProperty(exports, "__esModule", ({
  38754. value: true
  38755. }));
  38756. exports.FontRendererFactory = void 0;
  38757. var _util = __w_pdfjs_require__(2);
  38758. var _cff_parser = __w_pdfjs_require__(30);
  38759. var _glyphlist = __w_pdfjs_require__(33);
  38760. var _encodings = __w_pdfjs_require__(32);
  38761. var _stream = __w_pdfjs_require__(12);
  38762. var FontRendererFactory = function FontRendererFactoryClosure() {
  38763. function getLong(data, offset) {
  38764. return data[offset] << 24 | data[offset + 1] << 16 | data[offset + 2] << 8 | data[offset + 3];
  38765. }
  38766. function getUshort(data, offset) {
  38767. return data[offset] << 8 | data[offset + 1];
  38768. }
  38769. function getSubroutineBias(subrs) {
  38770. const numSubrs = subrs.length;
  38771. let bias = 32768;
  38772. if (numSubrs < 1240) {
  38773. bias = 107;
  38774. } else if (numSubrs < 33900) {
  38775. bias = 1131;
  38776. }
  38777. return bias;
  38778. }
  38779. function parseCmap(data, start, end) {
  38780. var offset = getUshort(data, start + 2) === 1 ? getLong(data, start + 8) : getLong(data, start + 16);
  38781. var format = getUshort(data, start + offset);
  38782. var ranges, p, i;
  38783. if (format === 4) {
  38784. getUshort(data, start + offset + 2);
  38785. var segCount = getUshort(data, start + offset + 6) >> 1;
  38786. p = start + offset + 14;
  38787. ranges = [];
  38788. for (i = 0; i < segCount; i++, p += 2) {
  38789. ranges[i] = {
  38790. end: getUshort(data, p)
  38791. };
  38792. }
  38793. p += 2;
  38794. for (i = 0; i < segCount; i++, p += 2) {
  38795. ranges[i].start = getUshort(data, p);
  38796. }
  38797. for (i = 0; i < segCount; i++, p += 2) {
  38798. ranges[i].idDelta = getUshort(data, p);
  38799. }
  38800. for (i = 0; i < segCount; i++, p += 2) {
  38801. var idOffset = getUshort(data, p);
  38802. if (idOffset === 0) {
  38803. continue;
  38804. }
  38805. ranges[i].ids = [];
  38806. for (var j = 0, jj = ranges[i].end - ranges[i].start + 1; j < jj; j++) {
  38807. ranges[i].ids[j] = getUshort(data, p + idOffset);
  38808. idOffset += 2;
  38809. }
  38810. }
  38811. return ranges;
  38812. } else if (format === 12) {
  38813. getLong(data, start + offset + 4);
  38814. var groups = getLong(data, start + offset + 12);
  38815. p = start + offset + 16;
  38816. ranges = [];
  38817. for (i = 0; i < groups; i++) {
  38818. ranges.push({
  38819. start: getLong(data, p),
  38820. end: getLong(data, p + 4),
  38821. idDelta: getLong(data, p + 8) - getLong(data, p)
  38822. });
  38823. p += 12;
  38824. }
  38825. return ranges;
  38826. }
  38827. throw new _util.FormatError(`unsupported cmap: ${format}`);
  38828. }
  38829. function parseCff(data, start, end, seacAnalysisEnabled) {
  38830. var properties = {};
  38831. var parser = new _cff_parser.CFFParser(new _stream.Stream(data, start, end - start), properties, seacAnalysisEnabled);
  38832. var cff = parser.parse();
  38833. return {
  38834. glyphs: cff.charStrings.objects,
  38835. subrs: cff.topDict.privateDict && cff.topDict.privateDict.subrsIndex && cff.topDict.privateDict.subrsIndex.objects,
  38836. gsubrs: cff.globalSubrIndex && cff.globalSubrIndex.objects,
  38837. isCFFCIDFont: cff.isCIDFont,
  38838. fdSelect: cff.fdSelect,
  38839. fdArray: cff.fdArray
  38840. };
  38841. }
  38842. function parseGlyfTable(glyf, loca, isGlyphLocationsLong) {
  38843. var itemSize, itemDecode;
  38844. if (isGlyphLocationsLong) {
  38845. itemSize = 4;
  38846. itemDecode = function fontItemDecodeLong(data, offset) {
  38847. return data[offset] << 24 | data[offset + 1] << 16 | data[offset + 2] << 8 | data[offset + 3];
  38848. };
  38849. } else {
  38850. itemSize = 2;
  38851. itemDecode = function fontItemDecode(data, offset) {
  38852. return data[offset] << 9 | data[offset + 1] << 1;
  38853. };
  38854. }
  38855. var glyphs = [];
  38856. var startOffset = itemDecode(loca, 0);
  38857. for (var j = itemSize; j < loca.length; j += itemSize) {
  38858. var endOffset = itemDecode(loca, j);
  38859. glyphs.push(glyf.subarray(startOffset, endOffset));
  38860. startOffset = endOffset;
  38861. }
  38862. return glyphs;
  38863. }
  38864. function lookupCmap(ranges, unicode) {
  38865. var code = unicode.codePointAt(0),
  38866. gid = 0;
  38867. var l = 0,
  38868. r = ranges.length - 1;
  38869. while (l < r) {
  38870. var c = l + r + 1 >> 1;
  38871. if (code < ranges[c].start) {
  38872. r = c - 1;
  38873. } else {
  38874. l = c;
  38875. }
  38876. }
  38877. if (ranges[l].start <= code && code <= ranges[l].end) {
  38878. gid = ranges[l].idDelta + (ranges[l].ids ? ranges[l].ids[code - ranges[l].start] : code) & 0xffff;
  38879. }
  38880. return {
  38881. charCode: code,
  38882. glyphId: gid
  38883. };
  38884. }
  38885. function compileGlyf(code, cmds, font) {
  38886. function moveTo(x, y) {
  38887. cmds.push({
  38888. cmd: "moveTo",
  38889. args: [x, y]
  38890. });
  38891. }
  38892. function lineTo(x, y) {
  38893. cmds.push({
  38894. cmd: "lineTo",
  38895. args: [x, y]
  38896. });
  38897. }
  38898. function quadraticCurveTo(xa, ya, x, y) {
  38899. cmds.push({
  38900. cmd: "quadraticCurveTo",
  38901. args: [xa, ya, x, y]
  38902. });
  38903. }
  38904. var i = 0;
  38905. var numberOfContours = (code[i] << 24 | code[i + 1] << 16) >> 16;
  38906. var flags;
  38907. var x = 0,
  38908. y = 0;
  38909. i += 10;
  38910. if (numberOfContours < 0) {
  38911. do {
  38912. flags = code[i] << 8 | code[i + 1];
  38913. var glyphIndex = code[i + 2] << 8 | code[i + 3];
  38914. i += 4;
  38915. var arg1, arg2;
  38916. if (flags & 0x01) {
  38917. arg1 = (code[i] << 24 | code[i + 1] << 16) >> 16;
  38918. arg2 = (code[i + 2] << 24 | code[i + 3] << 16) >> 16;
  38919. i += 4;
  38920. } else {
  38921. arg1 = code[i++];
  38922. arg2 = code[i++];
  38923. }
  38924. if (flags & 0x02) {
  38925. x = arg1;
  38926. y = arg2;
  38927. } else {
  38928. x = 0;
  38929. y = 0;
  38930. }
  38931. var scaleX = 1,
  38932. scaleY = 1,
  38933. scale01 = 0,
  38934. scale10 = 0;
  38935. if (flags & 0x08) {
  38936. scaleX = scaleY = (code[i] << 24 | code[i + 1] << 16) / 1073741824;
  38937. i += 2;
  38938. } else if (flags & 0x40) {
  38939. scaleX = (code[i] << 24 | code[i + 1] << 16) / 1073741824;
  38940. scaleY = (code[i + 2] << 24 | code[i + 3] << 16) / 1073741824;
  38941. i += 4;
  38942. } else if (flags & 0x80) {
  38943. scaleX = (code[i] << 24 | code[i + 1] << 16) / 1073741824;
  38944. scale01 = (code[i + 2] << 24 | code[i + 3] << 16) / 1073741824;
  38945. scale10 = (code[i + 4] << 24 | code[i + 5] << 16) / 1073741824;
  38946. scaleY = (code[i + 6] << 24 | code[i + 7] << 16) / 1073741824;
  38947. i += 8;
  38948. }
  38949. var subglyph = font.glyphs[glyphIndex];
  38950. if (subglyph) {
  38951. cmds.push({
  38952. cmd: "save"
  38953. });
  38954. cmds.push({
  38955. cmd: "transform",
  38956. args: [scaleX, scale01, scale10, scaleY, x, y]
  38957. });
  38958. compileGlyf(subglyph, cmds, font);
  38959. cmds.push({
  38960. cmd: "restore"
  38961. });
  38962. }
  38963. } while (flags & 0x20);
  38964. } else {
  38965. var endPtsOfContours = [];
  38966. var j, jj;
  38967. for (j = 0; j < numberOfContours; j++) {
  38968. endPtsOfContours.push(code[i] << 8 | code[i + 1]);
  38969. i += 2;
  38970. }
  38971. var instructionLength = code[i] << 8 | code[i + 1];
  38972. i += 2 + instructionLength;
  38973. var numberOfPoints = endPtsOfContours[endPtsOfContours.length - 1] + 1;
  38974. var points = [];
  38975. while (points.length < numberOfPoints) {
  38976. flags = code[i++];
  38977. var repeat = 1;
  38978. if (flags & 0x08) {
  38979. repeat += code[i++];
  38980. }
  38981. while (repeat-- > 0) {
  38982. points.push({
  38983. flags
  38984. });
  38985. }
  38986. }
  38987. for (j = 0; j < numberOfPoints; j++) {
  38988. switch (points[j].flags & 0x12) {
  38989. case 0x00:
  38990. x += (code[i] << 24 | code[i + 1] << 16) >> 16;
  38991. i += 2;
  38992. break;
  38993. case 0x02:
  38994. x -= code[i++];
  38995. break;
  38996. case 0x12:
  38997. x += code[i++];
  38998. break;
  38999. }
  39000. points[j].x = x;
  39001. }
  39002. for (j = 0; j < numberOfPoints; j++) {
  39003. switch (points[j].flags & 0x24) {
  39004. case 0x00:
  39005. y += (code[i] << 24 | code[i + 1] << 16) >> 16;
  39006. i += 2;
  39007. break;
  39008. case 0x04:
  39009. y -= code[i++];
  39010. break;
  39011. case 0x24:
  39012. y += code[i++];
  39013. break;
  39014. }
  39015. points[j].y = y;
  39016. }
  39017. var startPoint = 0;
  39018. for (i = 0; i < numberOfContours; i++) {
  39019. var endPoint = endPtsOfContours[i];
  39020. var contour = points.slice(startPoint, endPoint + 1);
  39021. if (contour[0].flags & 1) {
  39022. contour.push(contour[0]);
  39023. } else if (contour[contour.length - 1].flags & 1) {
  39024. contour.unshift(contour[contour.length - 1]);
  39025. } else {
  39026. var p = {
  39027. flags: 1,
  39028. x: (contour[0].x + contour[contour.length - 1].x) / 2,
  39029. y: (contour[0].y + contour[contour.length - 1].y) / 2
  39030. };
  39031. contour.unshift(p);
  39032. contour.push(p);
  39033. }
  39034. moveTo(contour[0].x, contour[0].y);
  39035. for (j = 1, jj = contour.length; j < jj; j++) {
  39036. if (contour[j].flags & 1) {
  39037. lineTo(contour[j].x, contour[j].y);
  39038. } else if (contour[j + 1].flags & 1) {
  39039. quadraticCurveTo(contour[j].x, contour[j].y, contour[j + 1].x, contour[j + 1].y);
  39040. j++;
  39041. } else {
  39042. quadraticCurveTo(contour[j].x, contour[j].y, (contour[j].x + contour[j + 1].x) / 2, (contour[j].y + contour[j + 1].y) / 2);
  39043. }
  39044. }
  39045. startPoint = endPoint + 1;
  39046. }
  39047. }
  39048. }
  39049. function compileCharString(charStringCode, cmds, font, glyphId) {
  39050. function moveTo(x, y) {
  39051. cmds.push({
  39052. cmd: "moveTo",
  39053. args: [x, y]
  39054. });
  39055. }
  39056. function lineTo(x, y) {
  39057. cmds.push({
  39058. cmd: "lineTo",
  39059. args: [x, y]
  39060. });
  39061. }
  39062. function bezierCurveTo(x1, y1, x2, y2, x, y) {
  39063. cmds.push({
  39064. cmd: "bezierCurveTo",
  39065. args: [x1, y1, x2, y2, x, y]
  39066. });
  39067. }
  39068. var stack = [];
  39069. var x = 0,
  39070. y = 0;
  39071. var stems = 0;
  39072. function parse(code) {
  39073. var i = 0;
  39074. while (i < code.length) {
  39075. var stackClean = false;
  39076. var v = code[i++];
  39077. var xa, xb, ya, yb, y1, y2, y3, n, subrCode;
  39078. switch (v) {
  39079. case 1:
  39080. stems += stack.length >> 1;
  39081. stackClean = true;
  39082. break;
  39083. case 3:
  39084. stems += stack.length >> 1;
  39085. stackClean = true;
  39086. break;
  39087. case 4:
  39088. y += stack.pop();
  39089. moveTo(x, y);
  39090. stackClean = true;
  39091. break;
  39092. case 5:
  39093. while (stack.length > 0) {
  39094. x += stack.shift();
  39095. y += stack.shift();
  39096. lineTo(x, y);
  39097. }
  39098. break;
  39099. case 6:
  39100. while (stack.length > 0) {
  39101. x += stack.shift();
  39102. lineTo(x, y);
  39103. if (stack.length === 0) {
  39104. break;
  39105. }
  39106. y += stack.shift();
  39107. lineTo(x, y);
  39108. }
  39109. break;
  39110. case 7:
  39111. while (stack.length > 0) {
  39112. y += stack.shift();
  39113. lineTo(x, y);
  39114. if (stack.length === 0) {
  39115. break;
  39116. }
  39117. x += stack.shift();
  39118. lineTo(x, y);
  39119. }
  39120. break;
  39121. case 8:
  39122. while (stack.length > 0) {
  39123. xa = x + stack.shift();
  39124. ya = y + stack.shift();
  39125. xb = xa + stack.shift();
  39126. yb = ya + stack.shift();
  39127. x = xb + stack.shift();
  39128. y = yb + stack.shift();
  39129. bezierCurveTo(xa, ya, xb, yb, x, y);
  39130. }
  39131. break;
  39132. case 10:
  39133. n = stack.pop();
  39134. subrCode = null;
  39135. if (font.isCFFCIDFont) {
  39136. const fdIndex = font.fdSelect.getFDIndex(glyphId);
  39137. if (fdIndex >= 0 && fdIndex < font.fdArray.length) {
  39138. const fontDict = font.fdArray[fdIndex];
  39139. let subrs;
  39140. if (fontDict.privateDict && fontDict.privateDict.subrsIndex) {
  39141. subrs = fontDict.privateDict.subrsIndex.objects;
  39142. }
  39143. if (subrs) {
  39144. n += getSubroutineBias(subrs);
  39145. subrCode = subrs[n];
  39146. }
  39147. } else {
  39148. (0, _util.warn)("Invalid fd index for glyph index.");
  39149. }
  39150. } else {
  39151. subrCode = font.subrs[n + font.subrsBias];
  39152. }
  39153. if (subrCode) {
  39154. parse(subrCode);
  39155. }
  39156. break;
  39157. case 11:
  39158. return;
  39159. case 12:
  39160. v = code[i++];
  39161. switch (v) {
  39162. case 34:
  39163. xa = x + stack.shift();
  39164. xb = xa + stack.shift();
  39165. y1 = y + stack.shift();
  39166. x = xb + stack.shift();
  39167. bezierCurveTo(xa, y, xb, y1, x, y1);
  39168. xa = x + stack.shift();
  39169. xb = xa + stack.shift();
  39170. x = xb + stack.shift();
  39171. bezierCurveTo(xa, y1, xb, y, x, y);
  39172. break;
  39173. case 35:
  39174. xa = x + stack.shift();
  39175. ya = y + stack.shift();
  39176. xb = xa + stack.shift();
  39177. yb = ya + stack.shift();
  39178. x = xb + stack.shift();
  39179. y = yb + stack.shift();
  39180. bezierCurveTo(xa, ya, xb, yb, x, y);
  39181. xa = x + stack.shift();
  39182. ya = y + stack.shift();
  39183. xb = xa + stack.shift();
  39184. yb = ya + stack.shift();
  39185. x = xb + stack.shift();
  39186. y = yb + stack.shift();
  39187. bezierCurveTo(xa, ya, xb, yb, x, y);
  39188. stack.pop();
  39189. break;
  39190. case 36:
  39191. xa = x + stack.shift();
  39192. y1 = y + stack.shift();
  39193. xb = xa + stack.shift();
  39194. y2 = y1 + stack.shift();
  39195. x = xb + stack.shift();
  39196. bezierCurveTo(xa, y1, xb, y2, x, y2);
  39197. xa = x + stack.shift();
  39198. xb = xa + stack.shift();
  39199. y3 = y2 + stack.shift();
  39200. x = xb + stack.shift();
  39201. bezierCurveTo(xa, y2, xb, y3, x, y);
  39202. break;
  39203. case 37:
  39204. var x0 = x,
  39205. y0 = y;
  39206. xa = x + stack.shift();
  39207. ya = y + stack.shift();
  39208. xb = xa + stack.shift();
  39209. yb = ya + stack.shift();
  39210. x = xb + stack.shift();
  39211. y = yb + stack.shift();
  39212. bezierCurveTo(xa, ya, xb, yb, x, y);
  39213. xa = x + stack.shift();
  39214. ya = y + stack.shift();
  39215. xb = xa + stack.shift();
  39216. yb = ya + stack.shift();
  39217. x = xb;
  39218. y = yb;
  39219. if (Math.abs(x - x0) > Math.abs(y - y0)) {
  39220. x += stack.shift();
  39221. } else {
  39222. y += stack.shift();
  39223. }
  39224. bezierCurveTo(xa, ya, xb, yb, x, y);
  39225. break;
  39226. default:
  39227. throw new _util.FormatError(`unknown operator: 12 ${v}`);
  39228. }
  39229. break;
  39230. case 14:
  39231. if (stack.length >= 4) {
  39232. var achar = stack.pop();
  39233. var bchar = stack.pop();
  39234. y = stack.pop();
  39235. x = stack.pop();
  39236. cmds.push({
  39237. cmd: "save"
  39238. });
  39239. cmds.push({
  39240. cmd: "translate",
  39241. args: [x, y]
  39242. });
  39243. var cmap = lookupCmap(font.cmap, String.fromCharCode(font.glyphNameMap[_encodings.StandardEncoding[achar]]));
  39244. compileCharString(font.glyphs[cmap.glyphId], cmds, font, cmap.glyphId);
  39245. cmds.push({
  39246. cmd: "restore"
  39247. });
  39248. cmap = lookupCmap(font.cmap, String.fromCharCode(font.glyphNameMap[_encodings.StandardEncoding[bchar]]));
  39249. compileCharString(font.glyphs[cmap.glyphId], cmds, font, cmap.glyphId);
  39250. }
  39251. return;
  39252. case 18:
  39253. stems += stack.length >> 1;
  39254. stackClean = true;
  39255. break;
  39256. case 19:
  39257. stems += stack.length >> 1;
  39258. i += stems + 7 >> 3;
  39259. stackClean = true;
  39260. break;
  39261. case 20:
  39262. stems += stack.length >> 1;
  39263. i += stems + 7 >> 3;
  39264. stackClean = true;
  39265. break;
  39266. case 21:
  39267. y += stack.pop();
  39268. x += stack.pop();
  39269. moveTo(x, y);
  39270. stackClean = true;
  39271. break;
  39272. case 22:
  39273. x += stack.pop();
  39274. moveTo(x, y);
  39275. stackClean = true;
  39276. break;
  39277. case 23:
  39278. stems += stack.length >> 1;
  39279. stackClean = true;
  39280. break;
  39281. case 24:
  39282. while (stack.length > 2) {
  39283. xa = x + stack.shift();
  39284. ya = y + stack.shift();
  39285. xb = xa + stack.shift();
  39286. yb = ya + stack.shift();
  39287. x = xb + stack.shift();
  39288. y = yb + stack.shift();
  39289. bezierCurveTo(xa, ya, xb, yb, x, y);
  39290. }
  39291. x += stack.shift();
  39292. y += stack.shift();
  39293. lineTo(x, y);
  39294. break;
  39295. case 25:
  39296. while (stack.length > 6) {
  39297. x += stack.shift();
  39298. y += stack.shift();
  39299. lineTo(x, y);
  39300. }
  39301. xa = x + stack.shift();
  39302. ya = y + stack.shift();
  39303. xb = xa + stack.shift();
  39304. yb = ya + stack.shift();
  39305. x = xb + stack.shift();
  39306. y = yb + stack.shift();
  39307. bezierCurveTo(xa, ya, xb, yb, x, y);
  39308. break;
  39309. case 26:
  39310. if (stack.length % 2) {
  39311. x += stack.shift();
  39312. }
  39313. while (stack.length > 0) {
  39314. xa = x;
  39315. ya = y + stack.shift();
  39316. xb = xa + stack.shift();
  39317. yb = ya + stack.shift();
  39318. x = xb;
  39319. y = yb + stack.shift();
  39320. bezierCurveTo(xa, ya, xb, yb, x, y);
  39321. }
  39322. break;
  39323. case 27:
  39324. if (stack.length % 2) {
  39325. y += stack.shift();
  39326. }
  39327. while (stack.length > 0) {
  39328. xa = x + stack.shift();
  39329. ya = y;
  39330. xb = xa + stack.shift();
  39331. yb = ya + stack.shift();
  39332. x = xb + stack.shift();
  39333. y = yb;
  39334. bezierCurveTo(xa, ya, xb, yb, x, y);
  39335. }
  39336. break;
  39337. case 28:
  39338. stack.push((code[i] << 24 | code[i + 1] << 16) >> 16);
  39339. i += 2;
  39340. break;
  39341. case 29:
  39342. n = stack.pop() + font.gsubrsBias;
  39343. subrCode = font.gsubrs[n];
  39344. if (subrCode) {
  39345. parse(subrCode);
  39346. }
  39347. break;
  39348. case 30:
  39349. while (stack.length > 0) {
  39350. xa = x;
  39351. ya = y + stack.shift();
  39352. xb = xa + stack.shift();
  39353. yb = ya + stack.shift();
  39354. x = xb + stack.shift();
  39355. y = yb + (stack.length === 1 ? stack.shift() : 0);
  39356. bezierCurveTo(xa, ya, xb, yb, x, y);
  39357. if (stack.length === 0) {
  39358. break;
  39359. }
  39360. xa = x + stack.shift();
  39361. ya = y;
  39362. xb = xa + stack.shift();
  39363. yb = ya + stack.shift();
  39364. y = yb + stack.shift();
  39365. x = xb + (stack.length === 1 ? stack.shift() : 0);
  39366. bezierCurveTo(xa, ya, xb, yb, x, y);
  39367. }
  39368. break;
  39369. case 31:
  39370. while (stack.length > 0) {
  39371. xa = x + stack.shift();
  39372. ya = y;
  39373. xb = xa + stack.shift();
  39374. yb = ya + stack.shift();
  39375. y = yb + stack.shift();
  39376. x = xb + (stack.length === 1 ? stack.shift() : 0);
  39377. bezierCurveTo(xa, ya, xb, yb, x, y);
  39378. if (stack.length === 0) {
  39379. break;
  39380. }
  39381. xa = x;
  39382. ya = y + stack.shift();
  39383. xb = xa + stack.shift();
  39384. yb = ya + stack.shift();
  39385. x = xb + stack.shift();
  39386. y = yb + (stack.length === 1 ? stack.shift() : 0);
  39387. bezierCurveTo(xa, ya, xb, yb, x, y);
  39388. }
  39389. break;
  39390. default:
  39391. if (v < 32) {
  39392. throw new _util.FormatError(`unknown operator: ${v}`);
  39393. }
  39394. if (v < 247) {
  39395. stack.push(v - 139);
  39396. } else if (v < 251) {
  39397. stack.push((v - 247) * 256 + code[i++] + 108);
  39398. } else if (v < 255) {
  39399. stack.push(-(v - 251) * 256 - code[i++] - 108);
  39400. } else {
  39401. stack.push((code[i] << 24 | code[i + 1] << 16 | code[i + 2] << 8 | code[i + 3]) / 65536);
  39402. i += 4;
  39403. }
  39404. break;
  39405. }
  39406. if (stackClean) {
  39407. stack.length = 0;
  39408. }
  39409. }
  39410. }
  39411. parse(charStringCode);
  39412. }
  39413. const NOOP = [];
  39414. class CompiledFont {
  39415. constructor(fontMatrix) {
  39416. if (this.constructor === CompiledFont) {
  39417. (0, _util.unreachable)("Cannot initialize CompiledFont.");
  39418. }
  39419. this.fontMatrix = fontMatrix;
  39420. this.compiledGlyphs = Object.create(null);
  39421. this.compiledCharCodeToGlyphId = Object.create(null);
  39422. }
  39423. getPathJs(unicode) {
  39424. const cmap = lookupCmap(this.cmap, unicode);
  39425. let fn = this.compiledGlyphs[cmap.glyphId];
  39426. if (!fn) {
  39427. fn = this.compileGlyph(this.glyphs[cmap.glyphId], cmap.glyphId);
  39428. this.compiledGlyphs[cmap.glyphId] = fn;
  39429. }
  39430. if (this.compiledCharCodeToGlyphId[cmap.charCode] === undefined) {
  39431. this.compiledCharCodeToGlyphId[cmap.charCode] = cmap.glyphId;
  39432. }
  39433. return fn;
  39434. }
  39435. compileGlyph(code, glyphId) {
  39436. if (!code || code.length === 0 || code[0] === 14) {
  39437. return NOOP;
  39438. }
  39439. let fontMatrix = this.fontMatrix;
  39440. if (this.isCFFCIDFont) {
  39441. const fdIndex = this.fdSelect.getFDIndex(glyphId);
  39442. if (fdIndex >= 0 && fdIndex < this.fdArray.length) {
  39443. const fontDict = this.fdArray[fdIndex];
  39444. fontMatrix = fontDict.getByName("FontMatrix") || _util.FONT_IDENTITY_MATRIX;
  39445. } else {
  39446. (0, _util.warn)("Invalid fd index for glyph index.");
  39447. }
  39448. }
  39449. const cmds = [];
  39450. cmds.push({
  39451. cmd: "save"
  39452. });
  39453. cmds.push({
  39454. cmd: "transform",
  39455. args: fontMatrix.slice()
  39456. });
  39457. cmds.push({
  39458. cmd: "scale",
  39459. args: ["size", "-size"]
  39460. });
  39461. this.compileGlyphImpl(code, cmds, glyphId);
  39462. cmds.push({
  39463. cmd: "restore"
  39464. });
  39465. return cmds;
  39466. }
  39467. compileGlyphImpl() {
  39468. (0, _util.unreachable)("Children classes should implement this.");
  39469. }
  39470. hasBuiltPath(unicode) {
  39471. const cmap = lookupCmap(this.cmap, unicode);
  39472. return this.compiledGlyphs[cmap.glyphId] !== undefined && this.compiledCharCodeToGlyphId[cmap.charCode] !== undefined;
  39473. }
  39474. }
  39475. class TrueTypeCompiled extends CompiledFont {
  39476. constructor(glyphs, cmap, fontMatrix) {
  39477. super(fontMatrix || [0.000488, 0, 0, 0.000488, 0, 0]);
  39478. this.glyphs = glyphs;
  39479. this.cmap = cmap;
  39480. }
  39481. compileGlyphImpl(code, cmds) {
  39482. compileGlyf(code, cmds, this);
  39483. }
  39484. }
  39485. class Type2Compiled extends CompiledFont {
  39486. constructor(cffInfo, cmap, fontMatrix, glyphNameMap) {
  39487. super(fontMatrix || [0.001, 0, 0, 0.001, 0, 0]);
  39488. this.glyphs = cffInfo.glyphs;
  39489. this.gsubrs = cffInfo.gsubrs || [];
  39490. this.subrs = cffInfo.subrs || [];
  39491. this.cmap = cmap;
  39492. this.glyphNameMap = glyphNameMap || (0, _glyphlist.getGlyphsUnicode)();
  39493. this.gsubrsBias = getSubroutineBias(this.gsubrs);
  39494. this.subrsBias = getSubroutineBias(this.subrs);
  39495. this.isCFFCIDFont = cffInfo.isCFFCIDFont;
  39496. this.fdSelect = cffInfo.fdSelect;
  39497. this.fdArray = cffInfo.fdArray;
  39498. }
  39499. compileGlyphImpl(code, cmds, glyphId) {
  39500. compileCharString(code, cmds, this, glyphId);
  39501. }
  39502. }
  39503. return {
  39504. create: function FontRendererFactory_create(font, seacAnalysisEnabled) {
  39505. var data = new Uint8Array(font.data);
  39506. var cmap, glyf, loca, cff, indexToLocFormat, unitsPerEm;
  39507. var numTables = getUshort(data, 4);
  39508. for (var i = 0, p = 12; i < numTables; i++, p += 16) {
  39509. var tag = (0, _util.bytesToString)(data.subarray(p, p + 4));
  39510. var offset = getLong(data, p + 8);
  39511. var length = getLong(data, p + 12);
  39512. switch (tag) {
  39513. case "cmap":
  39514. cmap = parseCmap(data, offset, offset + length);
  39515. break;
  39516. case "glyf":
  39517. glyf = data.subarray(offset, offset + length);
  39518. break;
  39519. case "loca":
  39520. loca = data.subarray(offset, offset + length);
  39521. break;
  39522. case "head":
  39523. unitsPerEm = getUshort(data, offset + 18);
  39524. indexToLocFormat = getUshort(data, offset + 50);
  39525. break;
  39526. case "CFF ":
  39527. cff = parseCff(data, offset, offset + length, seacAnalysisEnabled);
  39528. break;
  39529. }
  39530. }
  39531. if (glyf) {
  39532. var fontMatrix = !unitsPerEm ? font.fontMatrix : [1 / unitsPerEm, 0, 0, 1 / unitsPerEm, 0, 0];
  39533. return new TrueTypeCompiled(parseGlyfTable(glyf, loca, indexToLocFormat), cmap, fontMatrix);
  39534. }
  39535. return new Type2Compiled(cff, cmap, font.fontMatrix, font.glyphNameMap);
  39536. }
  39537. };
  39538. }();
  39539. exports.FontRendererFactory = FontRendererFactory;
  39540. /***/ }),
  39541. /* 37 */
  39542. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  39543. Object.defineProperty(exports, "__esModule", ({
  39544. value: true
  39545. }));
  39546. exports.Type1Parser = void 0;
  39547. var _encodings = __w_pdfjs_require__(32);
  39548. var _core_utils = __w_pdfjs_require__(8);
  39549. var _stream = __w_pdfjs_require__(12);
  39550. var _util = __w_pdfjs_require__(2);
  39551. var HINTING_ENABLED = false;
  39552. var Type1CharString = function Type1CharStringClosure() {
  39553. var COMMAND_MAP = {
  39554. hstem: [1],
  39555. vstem: [3],
  39556. vmoveto: [4],
  39557. rlineto: [5],
  39558. hlineto: [6],
  39559. vlineto: [7],
  39560. rrcurveto: [8],
  39561. callsubr: [10],
  39562. flex: [12, 35],
  39563. drop: [12, 18],
  39564. endchar: [14],
  39565. rmoveto: [21],
  39566. hmoveto: [22],
  39567. vhcurveto: [30],
  39568. hvcurveto: [31]
  39569. };
  39570. function Type1CharString() {
  39571. this.width = 0;
  39572. this.lsb = 0;
  39573. this.flexing = false;
  39574. this.output = [];
  39575. this.stack = [];
  39576. }
  39577. Type1CharString.prototype = {
  39578. convert: function Type1CharString_convert(encoded, subrs, seacAnalysisEnabled) {
  39579. var count = encoded.length;
  39580. var error = false;
  39581. var wx, sbx, subrNumber;
  39582. for (var i = 0; i < count; i++) {
  39583. var value = encoded[i];
  39584. if (value < 32) {
  39585. if (value === 12) {
  39586. value = (value << 8) + encoded[++i];
  39587. }
  39588. switch (value) {
  39589. case 1:
  39590. if (!HINTING_ENABLED) {
  39591. this.stack = [];
  39592. break;
  39593. }
  39594. error = this.executeCommand(2, COMMAND_MAP.hstem);
  39595. break;
  39596. case 3:
  39597. if (!HINTING_ENABLED) {
  39598. this.stack = [];
  39599. break;
  39600. }
  39601. error = this.executeCommand(2, COMMAND_MAP.vstem);
  39602. break;
  39603. case 4:
  39604. if (this.flexing) {
  39605. if (this.stack.length < 1) {
  39606. error = true;
  39607. break;
  39608. }
  39609. var dy = this.stack.pop();
  39610. this.stack.push(0, dy);
  39611. break;
  39612. }
  39613. error = this.executeCommand(1, COMMAND_MAP.vmoveto);
  39614. break;
  39615. case 5:
  39616. error = this.executeCommand(2, COMMAND_MAP.rlineto);
  39617. break;
  39618. case 6:
  39619. error = this.executeCommand(1, COMMAND_MAP.hlineto);
  39620. break;
  39621. case 7:
  39622. error = this.executeCommand(1, COMMAND_MAP.vlineto);
  39623. break;
  39624. case 8:
  39625. error = this.executeCommand(6, COMMAND_MAP.rrcurveto);
  39626. break;
  39627. case 9:
  39628. this.stack = [];
  39629. break;
  39630. case 10:
  39631. if (this.stack.length < 1) {
  39632. error = true;
  39633. break;
  39634. }
  39635. subrNumber = this.stack.pop();
  39636. if (!subrs[subrNumber]) {
  39637. error = true;
  39638. break;
  39639. }
  39640. error = this.convert(subrs[subrNumber], subrs, seacAnalysisEnabled);
  39641. break;
  39642. case 11:
  39643. return error;
  39644. case 13:
  39645. if (this.stack.length < 2) {
  39646. error = true;
  39647. break;
  39648. }
  39649. wx = this.stack.pop();
  39650. sbx = this.stack.pop();
  39651. this.lsb = sbx;
  39652. this.width = wx;
  39653. this.stack.push(wx, sbx);
  39654. error = this.executeCommand(2, COMMAND_MAP.hmoveto);
  39655. break;
  39656. case 14:
  39657. this.output.push(COMMAND_MAP.endchar[0]);
  39658. break;
  39659. case 21:
  39660. if (this.flexing) {
  39661. break;
  39662. }
  39663. error = this.executeCommand(2, COMMAND_MAP.rmoveto);
  39664. break;
  39665. case 22:
  39666. if (this.flexing) {
  39667. this.stack.push(0);
  39668. break;
  39669. }
  39670. error = this.executeCommand(1, COMMAND_MAP.hmoveto);
  39671. break;
  39672. case 30:
  39673. error = this.executeCommand(4, COMMAND_MAP.vhcurveto);
  39674. break;
  39675. case 31:
  39676. error = this.executeCommand(4, COMMAND_MAP.hvcurveto);
  39677. break;
  39678. case (12 << 8) + 0:
  39679. this.stack = [];
  39680. break;
  39681. case (12 << 8) + 1:
  39682. if (!HINTING_ENABLED) {
  39683. this.stack = [];
  39684. break;
  39685. }
  39686. error = this.executeCommand(2, COMMAND_MAP.vstem);
  39687. break;
  39688. case (12 << 8) + 2:
  39689. if (!HINTING_ENABLED) {
  39690. this.stack = [];
  39691. break;
  39692. }
  39693. error = this.executeCommand(2, COMMAND_MAP.hstem);
  39694. break;
  39695. case (12 << 8) + 6:
  39696. if (seacAnalysisEnabled) {
  39697. const asb = this.stack[this.stack.length - 5];
  39698. this.seac = this.stack.splice(-4, 4);
  39699. this.seac[0] += this.lsb - asb;
  39700. error = this.executeCommand(0, COMMAND_MAP.endchar);
  39701. } else {
  39702. error = this.executeCommand(4, COMMAND_MAP.endchar);
  39703. }
  39704. break;
  39705. case (12 << 8) + 7:
  39706. if (this.stack.length < 4) {
  39707. error = true;
  39708. break;
  39709. }
  39710. this.stack.pop();
  39711. wx = this.stack.pop();
  39712. var sby = this.stack.pop();
  39713. sbx = this.stack.pop();
  39714. this.lsb = sbx;
  39715. this.width = wx;
  39716. this.stack.push(wx, sbx, sby);
  39717. error = this.executeCommand(3, COMMAND_MAP.rmoveto);
  39718. break;
  39719. case (12 << 8) + 12:
  39720. if (this.stack.length < 2) {
  39721. error = true;
  39722. break;
  39723. }
  39724. var num2 = this.stack.pop();
  39725. var num1 = this.stack.pop();
  39726. this.stack.push(num1 / num2);
  39727. break;
  39728. case (12 << 8) + 16:
  39729. if (this.stack.length < 2) {
  39730. error = true;
  39731. break;
  39732. }
  39733. subrNumber = this.stack.pop();
  39734. var numArgs = this.stack.pop();
  39735. if (subrNumber === 0 && numArgs === 3) {
  39736. var flexArgs = this.stack.splice(this.stack.length - 17, 17);
  39737. 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]);
  39738. error = this.executeCommand(13, COMMAND_MAP.flex, true);
  39739. this.flexing = false;
  39740. this.stack.push(flexArgs[15], flexArgs[16]);
  39741. } else if (subrNumber === 1 && numArgs === 0) {
  39742. this.flexing = true;
  39743. }
  39744. break;
  39745. case (12 << 8) + 17:
  39746. break;
  39747. case (12 << 8) + 33:
  39748. this.stack = [];
  39749. break;
  39750. default:
  39751. (0, _util.warn)('Unknown type 1 charstring command of "' + value + '"');
  39752. break;
  39753. }
  39754. if (error) {
  39755. break;
  39756. }
  39757. continue;
  39758. } else if (value <= 246) {
  39759. value = value - 139;
  39760. } else if (value <= 250) {
  39761. value = (value - 247) * 256 + encoded[++i] + 108;
  39762. } else if (value <= 254) {
  39763. value = -((value - 251) * 256) - encoded[++i] - 108;
  39764. } else {
  39765. value = (encoded[++i] & 0xff) << 24 | (encoded[++i] & 0xff) << 16 | (encoded[++i] & 0xff) << 8 | (encoded[++i] & 0xff) << 0;
  39766. }
  39767. this.stack.push(value);
  39768. }
  39769. return error;
  39770. },
  39771. executeCommand(howManyArgs, command, keepStack) {
  39772. var stackLength = this.stack.length;
  39773. if (howManyArgs > stackLength) {
  39774. return true;
  39775. }
  39776. var start = stackLength - howManyArgs;
  39777. for (var i = start; i < stackLength; i++) {
  39778. var value = this.stack[i];
  39779. if (Number.isInteger(value)) {
  39780. this.output.push(28, value >> 8 & 0xff, value & 0xff);
  39781. } else {
  39782. value = 65536 * value | 0;
  39783. this.output.push(255, value >> 24 & 0xff, value >> 16 & 0xff, value >> 8 & 0xff, value & 0xff);
  39784. }
  39785. }
  39786. this.output.push.apply(this.output, command);
  39787. if (keepStack) {
  39788. this.stack.splice(start, howManyArgs);
  39789. } else {
  39790. this.stack.length = 0;
  39791. }
  39792. return false;
  39793. }
  39794. };
  39795. return Type1CharString;
  39796. }();
  39797. var Type1Parser = function Type1ParserClosure() {
  39798. var EEXEC_ENCRYPT_KEY = 55665;
  39799. var CHAR_STRS_ENCRYPT_KEY = 4330;
  39800. function isHexDigit(code) {
  39801. return code >= 48 && code <= 57 || code >= 65 && code <= 70 || code >= 97 && code <= 102;
  39802. }
  39803. function decrypt(data, key, discardNumber) {
  39804. if (discardNumber >= data.length) {
  39805. return new Uint8Array(0);
  39806. }
  39807. var r = key | 0,
  39808. c1 = 52845,
  39809. c2 = 22719,
  39810. i,
  39811. j;
  39812. for (i = 0; i < discardNumber; i++) {
  39813. r = (data[i] + r) * c1 + c2 & (1 << 16) - 1;
  39814. }
  39815. var count = data.length - discardNumber;
  39816. var decrypted = new Uint8Array(count);
  39817. for (i = discardNumber, j = 0; j < count; i++, j++) {
  39818. var value = data[i];
  39819. decrypted[j] = value ^ r >> 8;
  39820. r = (value + r) * c1 + c2 & (1 << 16) - 1;
  39821. }
  39822. return decrypted;
  39823. }
  39824. function decryptAscii(data, key, discardNumber) {
  39825. var r = key | 0,
  39826. c1 = 52845,
  39827. c2 = 22719;
  39828. var count = data.length,
  39829. maybeLength = count >>> 1;
  39830. var decrypted = new Uint8Array(maybeLength);
  39831. var i, j;
  39832. for (i = 0, j = 0; i < count; i++) {
  39833. var digit1 = data[i];
  39834. if (!isHexDigit(digit1)) {
  39835. continue;
  39836. }
  39837. i++;
  39838. var digit2;
  39839. while (i < count && !isHexDigit(digit2 = data[i])) {
  39840. i++;
  39841. }
  39842. if (i < count) {
  39843. var value = parseInt(String.fromCharCode(digit1, digit2), 16);
  39844. decrypted[j++] = value ^ r >> 8;
  39845. r = (value + r) * c1 + c2 & (1 << 16) - 1;
  39846. }
  39847. }
  39848. return decrypted.slice(discardNumber, j);
  39849. }
  39850. function isSpecial(c) {
  39851. return c === 0x2f || c === 0x5b || c === 0x5d || c === 0x7b || c === 0x7d || c === 0x28 || c === 0x29;
  39852. }
  39853. function Type1Parser(stream, encrypted, seacAnalysisEnabled) {
  39854. if (encrypted) {
  39855. var data = stream.getBytes();
  39856. var isBinary = !((isHexDigit(data[0]) || (0, _core_utils.isWhiteSpace)(data[0])) && isHexDigit(data[1]) && isHexDigit(data[2]) && isHexDigit(data[3]) && isHexDigit(data[4]) && isHexDigit(data[5]) && isHexDigit(data[6]) && isHexDigit(data[7]));
  39857. stream = new _stream.Stream(isBinary ? decrypt(data, EEXEC_ENCRYPT_KEY, 4) : decryptAscii(data, EEXEC_ENCRYPT_KEY, 4));
  39858. }
  39859. this.seacAnalysisEnabled = !!seacAnalysisEnabled;
  39860. this.stream = stream;
  39861. this.nextChar();
  39862. }
  39863. Type1Parser.prototype = {
  39864. readNumberArray: function Type1Parser_readNumberArray() {
  39865. this.getToken();
  39866. var array = [];
  39867. while (true) {
  39868. var token = this.getToken();
  39869. if (token === null || token === "]" || token === "}") {
  39870. break;
  39871. }
  39872. array.push(parseFloat(token || 0));
  39873. }
  39874. return array;
  39875. },
  39876. readNumber: function Type1Parser_readNumber() {
  39877. var token = this.getToken();
  39878. return parseFloat(token || 0);
  39879. },
  39880. readInt: function Type1Parser_readInt() {
  39881. var token = this.getToken();
  39882. return parseInt(token || 0, 10) | 0;
  39883. },
  39884. readBoolean: function Type1Parser_readBoolean() {
  39885. var token = this.getToken();
  39886. return token === "true" ? 1 : 0;
  39887. },
  39888. nextChar: function Type1_nextChar() {
  39889. return this.currentChar = this.stream.getByte();
  39890. },
  39891. getToken: function Type1Parser_getToken() {
  39892. var comment = false;
  39893. var ch = this.currentChar;
  39894. while (true) {
  39895. if (ch === -1) {
  39896. return null;
  39897. }
  39898. if (comment) {
  39899. if (ch === 0x0a || ch === 0x0d) {
  39900. comment = false;
  39901. }
  39902. } else if (ch === 0x25) {
  39903. comment = true;
  39904. } else if (!(0, _core_utils.isWhiteSpace)(ch)) {
  39905. break;
  39906. }
  39907. ch = this.nextChar();
  39908. }
  39909. if (isSpecial(ch)) {
  39910. this.nextChar();
  39911. return String.fromCharCode(ch);
  39912. }
  39913. var token = "";
  39914. do {
  39915. token += String.fromCharCode(ch);
  39916. ch = this.nextChar();
  39917. } while (ch >= 0 && !(0, _core_utils.isWhiteSpace)(ch) && !isSpecial(ch));
  39918. return token;
  39919. },
  39920. readCharStrings: function Type1Parser_readCharStrings(bytes, lenIV) {
  39921. if (lenIV === -1) {
  39922. return bytes;
  39923. }
  39924. return decrypt(bytes, CHAR_STRS_ENCRYPT_KEY, lenIV);
  39925. },
  39926. extractFontProgram: function Type1Parser_extractFontProgram(properties) {
  39927. var stream = this.stream;
  39928. var subrs = [],
  39929. charstrings = [];
  39930. var privateData = Object.create(null);
  39931. privateData.lenIV = 4;
  39932. var program = {
  39933. subrs: [],
  39934. charstrings: [],
  39935. properties: {
  39936. privateData
  39937. }
  39938. };
  39939. var token, length, data, lenIV, encoded;
  39940. while ((token = this.getToken()) !== null) {
  39941. if (token !== "/") {
  39942. continue;
  39943. }
  39944. token = this.getToken();
  39945. switch (token) {
  39946. case "CharStrings":
  39947. this.getToken();
  39948. this.getToken();
  39949. this.getToken();
  39950. this.getToken();
  39951. while (true) {
  39952. token = this.getToken();
  39953. if (token === null || token === "end") {
  39954. break;
  39955. }
  39956. if (token !== "/") {
  39957. continue;
  39958. }
  39959. var glyph = this.getToken();
  39960. length = this.readInt();
  39961. this.getToken();
  39962. data = length > 0 ? stream.getBytes(length) : new Uint8Array(0);
  39963. lenIV = program.properties.privateData.lenIV;
  39964. encoded = this.readCharStrings(data, lenIV);
  39965. this.nextChar();
  39966. token = this.getToken();
  39967. if (token === "noaccess") {
  39968. this.getToken();
  39969. }
  39970. charstrings.push({
  39971. glyph,
  39972. encoded
  39973. });
  39974. }
  39975. break;
  39976. case "Subrs":
  39977. this.readInt();
  39978. this.getToken();
  39979. while (this.getToken() === "dup") {
  39980. const index = this.readInt();
  39981. length = this.readInt();
  39982. this.getToken();
  39983. data = length > 0 ? stream.getBytes(length) : new Uint8Array(0);
  39984. lenIV = program.properties.privateData.lenIV;
  39985. encoded = this.readCharStrings(data, lenIV);
  39986. this.nextChar();
  39987. token = this.getToken();
  39988. if (token === "noaccess") {
  39989. this.getToken();
  39990. }
  39991. subrs[index] = encoded;
  39992. }
  39993. break;
  39994. case "BlueValues":
  39995. case "OtherBlues":
  39996. case "FamilyBlues":
  39997. case "FamilyOtherBlues":
  39998. var blueArray = this.readNumberArray();
  39999. if (blueArray.length > 0 && blueArray.length % 2 === 0 && HINTING_ENABLED) {
  40000. program.properties.privateData[token] = blueArray;
  40001. }
  40002. break;
  40003. case "StemSnapH":
  40004. case "StemSnapV":
  40005. program.properties.privateData[token] = this.readNumberArray();
  40006. break;
  40007. case "StdHW":
  40008. case "StdVW":
  40009. program.properties.privateData[token] = this.readNumberArray()[0];
  40010. break;
  40011. case "BlueShift":
  40012. case "lenIV":
  40013. case "BlueFuzz":
  40014. case "BlueScale":
  40015. case "LanguageGroup":
  40016. case "ExpansionFactor":
  40017. program.properties.privateData[token] = this.readNumber();
  40018. break;
  40019. case "ForceBold":
  40020. program.properties.privateData[token] = this.readBoolean();
  40021. break;
  40022. }
  40023. }
  40024. for (var i = 0; i < charstrings.length; i++) {
  40025. glyph = charstrings[i].glyph;
  40026. encoded = charstrings[i].encoded;
  40027. var charString = new Type1CharString();
  40028. var error = charString.convert(encoded, subrs, this.seacAnalysisEnabled);
  40029. var output = charString.output;
  40030. if (error) {
  40031. output = [14];
  40032. }
  40033. const charStringObject = {
  40034. glyphName: glyph,
  40035. charstring: output,
  40036. width: charString.width,
  40037. lsb: charString.lsb,
  40038. seac: charString.seac
  40039. };
  40040. if (glyph === ".notdef") {
  40041. program.charstrings.unshift(charStringObject);
  40042. } else {
  40043. program.charstrings.push(charStringObject);
  40044. }
  40045. if (properties.builtInEncoding) {
  40046. const index = properties.builtInEncoding.indexOf(glyph);
  40047. if (index > -1 && properties.widths[index] === undefined && index >= properties.firstChar && index <= properties.lastChar) {
  40048. properties.widths[index] = charString.width;
  40049. }
  40050. }
  40051. }
  40052. return program;
  40053. },
  40054. extractFontHeader: function Type1Parser_extractFontHeader(properties) {
  40055. var token;
  40056. while ((token = this.getToken()) !== null) {
  40057. if (token !== "/") {
  40058. continue;
  40059. }
  40060. token = this.getToken();
  40061. switch (token) {
  40062. case "FontMatrix":
  40063. var matrix = this.readNumberArray();
  40064. properties.fontMatrix = matrix;
  40065. break;
  40066. case "Encoding":
  40067. var encodingArg = this.getToken();
  40068. var encoding;
  40069. if (!/^\d+$/.test(encodingArg)) {
  40070. encoding = (0, _encodings.getEncoding)(encodingArg);
  40071. } else {
  40072. encoding = [];
  40073. var size = parseInt(encodingArg, 10) | 0;
  40074. this.getToken();
  40075. for (var j = 0; j < size; j++) {
  40076. token = this.getToken();
  40077. while (token !== "dup" && token !== "def") {
  40078. token = this.getToken();
  40079. if (token === null) {
  40080. return;
  40081. }
  40082. }
  40083. if (token === "def") {
  40084. break;
  40085. }
  40086. var index = this.readInt();
  40087. this.getToken();
  40088. var glyph = this.getToken();
  40089. encoding[index] = glyph;
  40090. this.getToken();
  40091. }
  40092. }
  40093. properties.builtInEncoding = encoding;
  40094. break;
  40095. case "FontBBox":
  40096. var fontBBox = this.readNumberArray();
  40097. properties.ascent = Math.max(fontBBox[3], fontBBox[1]);
  40098. properties.descent = Math.min(fontBBox[1], fontBBox[3]);
  40099. properties.ascentScaled = true;
  40100. break;
  40101. }
  40102. }
  40103. }
  40104. };
  40105. return Type1Parser;
  40106. }();
  40107. exports.Type1Parser = Type1Parser;
  40108. /***/ }),
  40109. /* 38 */
  40110. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  40111. Object.defineProperty(exports, "__esModule", ({
  40112. value: true
  40113. }));
  40114. exports.getTilingPatternIR = getTilingPatternIR;
  40115. exports.Pattern = void 0;
  40116. var _util = __w_pdfjs_require__(2);
  40117. var _colorspace = __w_pdfjs_require__(23);
  40118. var _primitives = __w_pdfjs_require__(5);
  40119. var _core_utils = __w_pdfjs_require__(8);
  40120. var ShadingType = {
  40121. FUNCTION_BASED: 1,
  40122. AXIAL: 2,
  40123. RADIAL: 3,
  40124. FREE_FORM_MESH: 4,
  40125. LATTICE_FORM_MESH: 5,
  40126. COONS_PATCH_MESH: 6,
  40127. TENSOR_PATCH_MESH: 7
  40128. };
  40129. var Pattern = function PatternClosure() {
  40130. function Pattern() {
  40131. (0, _util.unreachable)("should not call Pattern constructor");
  40132. }
  40133. Pattern.prototype = {
  40134. getPattern: function Pattern_getPattern(ctx) {
  40135. (0, _util.unreachable)(`Should not call Pattern.getStyle: ${ctx}`);
  40136. }
  40137. };
  40138. Pattern.parseShading = function (shading, matrix, xref, res, handler, pdfFunctionFactory, localColorSpaceCache) {
  40139. var dict = (0, _primitives.isStream)(shading) ? shading.dict : shading;
  40140. var type = dict.get("ShadingType");
  40141. try {
  40142. switch (type) {
  40143. case ShadingType.AXIAL:
  40144. case ShadingType.RADIAL:
  40145. return new Shadings.RadialAxial(dict, matrix, xref, res, pdfFunctionFactory, localColorSpaceCache);
  40146. case ShadingType.FREE_FORM_MESH:
  40147. case ShadingType.LATTICE_FORM_MESH:
  40148. case ShadingType.COONS_PATCH_MESH:
  40149. case ShadingType.TENSOR_PATCH_MESH:
  40150. return new Shadings.Mesh(shading, matrix, xref, res, pdfFunctionFactory, localColorSpaceCache);
  40151. default:
  40152. throw new _util.FormatError("Unsupported ShadingType: " + type);
  40153. }
  40154. } catch (ex) {
  40155. if (ex instanceof _core_utils.MissingDataException) {
  40156. throw ex;
  40157. }
  40158. handler.send("UnsupportedFeature", {
  40159. featureId: _util.UNSUPPORTED_FEATURES.shadingPattern
  40160. });
  40161. (0, _util.warn)(ex);
  40162. return new Shadings.Dummy();
  40163. }
  40164. };
  40165. return Pattern;
  40166. }();
  40167. exports.Pattern = Pattern;
  40168. var Shadings = {};
  40169. Shadings.SMALL_NUMBER = 1e-6;
  40170. Shadings.RadialAxial = function RadialAxialClosure() {
  40171. function RadialAxial(dict, matrix, xref, resources, pdfFunctionFactory, localColorSpaceCache) {
  40172. this.matrix = matrix;
  40173. this.coordsArr = dict.getArray("Coords");
  40174. this.shadingType = dict.get("ShadingType");
  40175. this.type = "Pattern";
  40176. const cs = _colorspace.ColorSpace.parse({
  40177. cs: dict.getRaw("ColorSpace") || dict.getRaw("CS"),
  40178. xref,
  40179. resources,
  40180. pdfFunctionFactory,
  40181. localColorSpaceCache
  40182. });
  40183. this.cs = cs;
  40184. const bbox = dict.getArray("BBox");
  40185. if (Array.isArray(bbox) && bbox.length === 4) {
  40186. this.bbox = _util.Util.normalizeRect(bbox);
  40187. } else {
  40188. this.bbox = null;
  40189. }
  40190. var t0 = 0.0,
  40191. t1 = 1.0;
  40192. if (dict.has("Domain")) {
  40193. var domainArr = dict.getArray("Domain");
  40194. t0 = domainArr[0];
  40195. t1 = domainArr[1];
  40196. }
  40197. var extendStart = false,
  40198. extendEnd = false;
  40199. if (dict.has("Extend")) {
  40200. var extendArr = dict.getArray("Extend");
  40201. extendStart = extendArr[0];
  40202. extendEnd = extendArr[1];
  40203. }
  40204. if (this.shadingType === ShadingType.RADIAL && (!extendStart || !extendEnd)) {
  40205. var x1 = this.coordsArr[0];
  40206. var y1 = this.coordsArr[1];
  40207. var r1 = this.coordsArr[2];
  40208. var x2 = this.coordsArr[3];
  40209. var y2 = this.coordsArr[4];
  40210. var r2 = this.coordsArr[5];
  40211. var distance = Math.sqrt((x1 - x2) * (x1 - x2) + (y1 - y2) * (y1 - y2));
  40212. if (r1 <= r2 + distance && r2 <= r1 + distance) {
  40213. (0, _util.warn)("Unsupported radial gradient.");
  40214. }
  40215. }
  40216. this.extendStart = extendStart;
  40217. this.extendEnd = extendEnd;
  40218. var fnObj = dict.getRaw("Function");
  40219. var fn = pdfFunctionFactory.createFromArray(fnObj);
  40220. const NUMBER_OF_SAMPLES = 10;
  40221. const step = (t1 - t0) / NUMBER_OF_SAMPLES;
  40222. var colorStops = this.colorStops = [];
  40223. if (t0 >= t1 || step <= 0) {
  40224. (0, _util.info)("Bad shading domain.");
  40225. return;
  40226. }
  40227. var color = new Float32Array(cs.numComps),
  40228. ratio = new Float32Array(1);
  40229. var rgbColor;
  40230. for (let i = 0; i <= NUMBER_OF_SAMPLES; i++) {
  40231. ratio[0] = t0 + i * step;
  40232. fn(ratio, 0, color, 0);
  40233. rgbColor = cs.getRgb(color, 0);
  40234. var cssColor = _util.Util.makeHexColor(rgbColor[0], rgbColor[1], rgbColor[2]);
  40235. colorStops.push([i / NUMBER_OF_SAMPLES, cssColor]);
  40236. }
  40237. var background = "transparent";
  40238. if (dict.has("Background")) {
  40239. rgbColor = cs.getRgb(dict.get("Background"), 0);
  40240. background = _util.Util.makeHexColor(rgbColor[0], rgbColor[1], rgbColor[2]);
  40241. }
  40242. if (!extendStart) {
  40243. colorStops.unshift([0, background]);
  40244. colorStops[1][0] += Shadings.SMALL_NUMBER;
  40245. }
  40246. if (!extendEnd) {
  40247. colorStops[colorStops.length - 1][0] -= Shadings.SMALL_NUMBER;
  40248. colorStops.push([1, background]);
  40249. }
  40250. this.colorStops = colorStops;
  40251. }
  40252. RadialAxial.prototype = {
  40253. getIR: function RadialAxial_getIR() {
  40254. var coordsArr = this.coordsArr;
  40255. var shadingType = this.shadingType;
  40256. var type, p0, p1, r0, r1;
  40257. if (shadingType === ShadingType.AXIAL) {
  40258. p0 = [coordsArr[0], coordsArr[1]];
  40259. p1 = [coordsArr[2], coordsArr[3]];
  40260. r0 = null;
  40261. r1 = null;
  40262. type = "axial";
  40263. } else if (shadingType === ShadingType.RADIAL) {
  40264. p0 = [coordsArr[0], coordsArr[1]];
  40265. p1 = [coordsArr[3], coordsArr[4]];
  40266. r0 = coordsArr[2];
  40267. r1 = coordsArr[5];
  40268. type = "radial";
  40269. } else {
  40270. (0, _util.unreachable)(`getPattern type unknown: ${shadingType}`);
  40271. }
  40272. var matrix = this.matrix;
  40273. if (matrix) {
  40274. p0 = _util.Util.applyTransform(p0, matrix);
  40275. p1 = _util.Util.applyTransform(p1, matrix);
  40276. if (shadingType === ShadingType.RADIAL) {
  40277. var scale = _util.Util.singularValueDecompose2dScale(matrix);
  40278. r0 *= scale[0];
  40279. r1 *= scale[1];
  40280. }
  40281. }
  40282. return ["RadialAxial", type, this.bbox, this.colorStops, p0, p1, r0, r1];
  40283. }
  40284. };
  40285. return RadialAxial;
  40286. }();
  40287. Shadings.Mesh = function MeshClosure() {
  40288. function MeshStreamReader(stream, context) {
  40289. this.stream = stream;
  40290. this.context = context;
  40291. this.buffer = 0;
  40292. this.bufferLength = 0;
  40293. var numComps = context.numComps;
  40294. this.tmpCompsBuf = new Float32Array(numComps);
  40295. var csNumComps = context.colorSpace.numComps;
  40296. this.tmpCsCompsBuf = context.colorFn ? new Float32Array(csNumComps) : this.tmpCompsBuf;
  40297. }
  40298. MeshStreamReader.prototype = {
  40299. get hasData() {
  40300. if (this.stream.end) {
  40301. return this.stream.pos < this.stream.end;
  40302. }
  40303. if (this.bufferLength > 0) {
  40304. return true;
  40305. }
  40306. var nextByte = this.stream.getByte();
  40307. if (nextByte < 0) {
  40308. return false;
  40309. }
  40310. this.buffer = nextByte;
  40311. this.bufferLength = 8;
  40312. return true;
  40313. },
  40314. readBits: function MeshStreamReader_readBits(n) {
  40315. var buffer = this.buffer;
  40316. var bufferLength = this.bufferLength;
  40317. if (n === 32) {
  40318. if (bufferLength === 0) {
  40319. return (this.stream.getByte() << 24 | this.stream.getByte() << 16 | this.stream.getByte() << 8 | this.stream.getByte()) >>> 0;
  40320. }
  40321. buffer = buffer << 24 | this.stream.getByte() << 16 | this.stream.getByte() << 8 | this.stream.getByte();
  40322. var nextByte = this.stream.getByte();
  40323. this.buffer = nextByte & (1 << bufferLength) - 1;
  40324. return (buffer << 8 - bufferLength | (nextByte & 0xff) >> bufferLength) >>> 0;
  40325. }
  40326. if (n === 8 && bufferLength === 0) {
  40327. return this.stream.getByte();
  40328. }
  40329. while (bufferLength < n) {
  40330. buffer = buffer << 8 | this.stream.getByte();
  40331. bufferLength += 8;
  40332. }
  40333. bufferLength -= n;
  40334. this.bufferLength = bufferLength;
  40335. this.buffer = buffer & (1 << bufferLength) - 1;
  40336. return buffer >> bufferLength;
  40337. },
  40338. align: function MeshStreamReader_align() {
  40339. this.buffer = 0;
  40340. this.bufferLength = 0;
  40341. },
  40342. readFlag: function MeshStreamReader_readFlag() {
  40343. return this.readBits(this.context.bitsPerFlag);
  40344. },
  40345. readCoordinate: function MeshStreamReader_readCoordinate() {
  40346. var bitsPerCoordinate = this.context.bitsPerCoordinate;
  40347. var xi = this.readBits(bitsPerCoordinate);
  40348. var yi = this.readBits(bitsPerCoordinate);
  40349. var decode = this.context.decode;
  40350. var scale = bitsPerCoordinate < 32 ? 1 / ((1 << bitsPerCoordinate) - 1) : 2.3283064365386963e-10;
  40351. return [xi * scale * (decode[1] - decode[0]) + decode[0], yi * scale * (decode[3] - decode[2]) + decode[2]];
  40352. },
  40353. readComponents: function MeshStreamReader_readComponents() {
  40354. var numComps = this.context.numComps;
  40355. var bitsPerComponent = this.context.bitsPerComponent;
  40356. var scale = bitsPerComponent < 32 ? 1 / ((1 << bitsPerComponent) - 1) : 2.3283064365386963e-10;
  40357. var decode = this.context.decode;
  40358. var components = this.tmpCompsBuf;
  40359. for (var i = 0, j = 4; i < numComps; i++, j += 2) {
  40360. var ci = this.readBits(bitsPerComponent);
  40361. components[i] = ci * scale * (decode[j + 1] - decode[j]) + decode[j];
  40362. }
  40363. var color = this.tmpCsCompsBuf;
  40364. if (this.context.colorFn) {
  40365. this.context.colorFn(components, 0, color, 0);
  40366. }
  40367. return this.context.colorSpace.getRgb(color, 0);
  40368. }
  40369. };
  40370. function decodeType4Shading(mesh, reader) {
  40371. var coords = mesh.coords;
  40372. var colors = mesh.colors;
  40373. var operators = [];
  40374. var ps = [];
  40375. var verticesLeft = 0;
  40376. while (reader.hasData) {
  40377. var f = reader.readFlag();
  40378. var coord = reader.readCoordinate();
  40379. var color = reader.readComponents();
  40380. if (verticesLeft === 0) {
  40381. if (!(0 <= f && f <= 2)) {
  40382. throw new _util.FormatError("Unknown type4 flag");
  40383. }
  40384. switch (f) {
  40385. case 0:
  40386. verticesLeft = 3;
  40387. break;
  40388. case 1:
  40389. ps.push(ps[ps.length - 2], ps[ps.length - 1]);
  40390. verticesLeft = 1;
  40391. break;
  40392. case 2:
  40393. ps.push(ps[ps.length - 3], ps[ps.length - 1]);
  40394. verticesLeft = 1;
  40395. break;
  40396. }
  40397. operators.push(f);
  40398. }
  40399. ps.push(coords.length);
  40400. coords.push(coord);
  40401. colors.push(color);
  40402. verticesLeft--;
  40403. reader.align();
  40404. }
  40405. mesh.figures.push({
  40406. type: "triangles",
  40407. coords: new Int32Array(ps),
  40408. colors: new Int32Array(ps)
  40409. });
  40410. }
  40411. function decodeType5Shading(mesh, reader, verticesPerRow) {
  40412. var coords = mesh.coords;
  40413. var colors = mesh.colors;
  40414. var ps = [];
  40415. while (reader.hasData) {
  40416. var coord = reader.readCoordinate();
  40417. var color = reader.readComponents();
  40418. ps.push(coords.length);
  40419. coords.push(coord);
  40420. colors.push(color);
  40421. }
  40422. mesh.figures.push({
  40423. type: "lattice",
  40424. coords: new Int32Array(ps),
  40425. colors: new Int32Array(ps),
  40426. verticesPerRow
  40427. });
  40428. }
  40429. var MIN_SPLIT_PATCH_CHUNKS_AMOUNT = 3;
  40430. var MAX_SPLIT_PATCH_CHUNKS_AMOUNT = 20;
  40431. var TRIANGLE_DENSITY = 20;
  40432. var getB = function getBClosure() {
  40433. function buildB(count) {
  40434. var lut = [];
  40435. for (var i = 0; i <= count; i++) {
  40436. var t = i / count,
  40437. t_ = 1 - t;
  40438. lut.push(new Float32Array([t_ * t_ * t_, 3 * t * t_ * t_, 3 * t * t * t_, t * t * t]));
  40439. }
  40440. return lut;
  40441. }
  40442. var cache = [];
  40443. return function getB(count) {
  40444. if (!cache[count]) {
  40445. cache[count] = buildB(count);
  40446. }
  40447. return cache[count];
  40448. };
  40449. }();
  40450. function buildFigureFromPatch(mesh, index) {
  40451. var figure = mesh.figures[index];
  40452. (0, _util.assert)(figure.type === "patch", "Unexpected patch mesh figure");
  40453. var coords = mesh.coords,
  40454. colors = mesh.colors;
  40455. var pi = figure.coords;
  40456. var ci = figure.colors;
  40457. var figureMinX = Math.min(coords[pi[0]][0], coords[pi[3]][0], coords[pi[12]][0], coords[pi[15]][0]);
  40458. var figureMinY = Math.min(coords[pi[0]][1], coords[pi[3]][1], coords[pi[12]][1], coords[pi[15]][1]);
  40459. var figureMaxX = Math.max(coords[pi[0]][0], coords[pi[3]][0], coords[pi[12]][0], coords[pi[15]][0]);
  40460. var figureMaxY = Math.max(coords[pi[0]][1], coords[pi[3]][1], coords[pi[12]][1], coords[pi[15]][1]);
  40461. var splitXBy = Math.ceil((figureMaxX - figureMinX) * TRIANGLE_DENSITY / (mesh.bounds[2] - mesh.bounds[0]));
  40462. splitXBy = Math.max(MIN_SPLIT_PATCH_CHUNKS_AMOUNT, Math.min(MAX_SPLIT_PATCH_CHUNKS_AMOUNT, splitXBy));
  40463. var splitYBy = Math.ceil((figureMaxY - figureMinY) * TRIANGLE_DENSITY / (mesh.bounds[3] - mesh.bounds[1]));
  40464. splitYBy = Math.max(MIN_SPLIT_PATCH_CHUNKS_AMOUNT, Math.min(MAX_SPLIT_PATCH_CHUNKS_AMOUNT, splitYBy));
  40465. var verticesPerRow = splitXBy + 1;
  40466. var figureCoords = new Int32Array((splitYBy + 1) * verticesPerRow);
  40467. var figureColors = new Int32Array((splitYBy + 1) * verticesPerRow);
  40468. var k = 0;
  40469. var cl = new Uint8Array(3),
  40470. cr = new Uint8Array(3);
  40471. var c0 = colors[ci[0]],
  40472. c1 = colors[ci[1]],
  40473. c2 = colors[ci[2]],
  40474. c3 = colors[ci[3]];
  40475. var bRow = getB(splitYBy),
  40476. bCol = getB(splitXBy);
  40477. for (var row = 0; row <= splitYBy; row++) {
  40478. cl[0] = (c0[0] * (splitYBy - row) + c2[0] * row) / splitYBy | 0;
  40479. cl[1] = (c0[1] * (splitYBy - row) + c2[1] * row) / splitYBy | 0;
  40480. cl[2] = (c0[2] * (splitYBy - row) + c2[2] * row) / splitYBy | 0;
  40481. cr[0] = (c1[0] * (splitYBy - row) + c3[0] * row) / splitYBy | 0;
  40482. cr[1] = (c1[1] * (splitYBy - row) + c3[1] * row) / splitYBy | 0;
  40483. cr[2] = (c1[2] * (splitYBy - row) + c3[2] * row) / splitYBy | 0;
  40484. for (var col = 0; col <= splitXBy; col++, k++) {
  40485. if ((row === 0 || row === splitYBy) && (col === 0 || col === splitXBy)) {
  40486. continue;
  40487. }
  40488. var x = 0,
  40489. y = 0;
  40490. var q = 0;
  40491. for (var i = 0; i <= 3; i++) {
  40492. for (var j = 0; j <= 3; j++, q++) {
  40493. var m = bRow[row][i] * bCol[col][j];
  40494. x += coords[pi[q]][0] * m;
  40495. y += coords[pi[q]][1] * m;
  40496. }
  40497. }
  40498. figureCoords[k] = coords.length;
  40499. coords.push([x, y]);
  40500. figureColors[k] = colors.length;
  40501. var newColor = new Uint8Array(3);
  40502. newColor[0] = (cl[0] * (splitXBy - col) + cr[0] * col) / splitXBy | 0;
  40503. newColor[1] = (cl[1] * (splitXBy - col) + cr[1] * col) / splitXBy | 0;
  40504. newColor[2] = (cl[2] * (splitXBy - col) + cr[2] * col) / splitXBy | 0;
  40505. colors.push(newColor);
  40506. }
  40507. }
  40508. figureCoords[0] = pi[0];
  40509. figureColors[0] = ci[0];
  40510. figureCoords[splitXBy] = pi[3];
  40511. figureColors[splitXBy] = ci[1];
  40512. figureCoords[verticesPerRow * splitYBy] = pi[12];
  40513. figureColors[verticesPerRow * splitYBy] = ci[2];
  40514. figureCoords[verticesPerRow * splitYBy + splitXBy] = pi[15];
  40515. figureColors[verticesPerRow * splitYBy + splitXBy] = ci[3];
  40516. mesh.figures[index] = {
  40517. type: "lattice",
  40518. coords: figureCoords,
  40519. colors: figureColors,
  40520. verticesPerRow
  40521. };
  40522. }
  40523. function decodeType6Shading(mesh, reader) {
  40524. var coords = mesh.coords;
  40525. var colors = mesh.colors;
  40526. var ps = new Int32Array(16);
  40527. var cs = new Int32Array(4);
  40528. while (reader.hasData) {
  40529. var f = reader.readFlag();
  40530. if (!(0 <= f && f <= 3)) {
  40531. throw new _util.FormatError("Unknown type6 flag");
  40532. }
  40533. var i, ii;
  40534. var pi = coords.length;
  40535. for (i = 0, ii = f !== 0 ? 8 : 12; i < ii; i++) {
  40536. coords.push(reader.readCoordinate());
  40537. }
  40538. var ci = colors.length;
  40539. for (i = 0, ii = f !== 0 ? 2 : 4; i < ii; i++) {
  40540. colors.push(reader.readComponents());
  40541. }
  40542. var tmp1, tmp2, tmp3, tmp4;
  40543. switch (f) {
  40544. case 0:
  40545. ps[12] = pi + 3;
  40546. ps[13] = pi + 4;
  40547. ps[14] = pi + 5;
  40548. ps[15] = pi + 6;
  40549. ps[8] = pi + 2;
  40550. ps[11] = pi + 7;
  40551. ps[4] = pi + 1;
  40552. ps[7] = pi + 8;
  40553. ps[0] = pi;
  40554. ps[1] = pi + 11;
  40555. ps[2] = pi + 10;
  40556. ps[3] = pi + 9;
  40557. cs[2] = ci + 1;
  40558. cs[3] = ci + 2;
  40559. cs[0] = ci;
  40560. cs[1] = ci + 3;
  40561. break;
  40562. case 1:
  40563. tmp1 = ps[12];
  40564. tmp2 = ps[13];
  40565. tmp3 = ps[14];
  40566. tmp4 = ps[15];
  40567. ps[12] = tmp4;
  40568. ps[13] = pi + 0;
  40569. ps[14] = pi + 1;
  40570. ps[15] = pi + 2;
  40571. ps[8] = tmp3;
  40572. ps[11] = pi + 3;
  40573. ps[4] = tmp2;
  40574. ps[7] = pi + 4;
  40575. ps[0] = tmp1;
  40576. ps[1] = pi + 7;
  40577. ps[2] = pi + 6;
  40578. ps[3] = pi + 5;
  40579. tmp1 = cs[2];
  40580. tmp2 = cs[3];
  40581. cs[2] = tmp2;
  40582. cs[3] = ci;
  40583. cs[0] = tmp1;
  40584. cs[1] = ci + 1;
  40585. break;
  40586. case 2:
  40587. tmp1 = ps[15];
  40588. tmp2 = ps[11];
  40589. ps[12] = ps[3];
  40590. ps[13] = pi + 0;
  40591. ps[14] = pi + 1;
  40592. ps[15] = pi + 2;
  40593. ps[8] = ps[7];
  40594. ps[11] = pi + 3;
  40595. ps[4] = tmp2;
  40596. ps[7] = pi + 4;
  40597. ps[0] = tmp1;
  40598. ps[1] = pi + 7;
  40599. ps[2] = pi + 6;
  40600. ps[3] = pi + 5;
  40601. tmp1 = cs[3];
  40602. cs[2] = cs[1];
  40603. cs[3] = ci;
  40604. cs[0] = tmp1;
  40605. cs[1] = ci + 1;
  40606. break;
  40607. case 3:
  40608. ps[12] = ps[0];
  40609. ps[13] = pi + 0;
  40610. ps[14] = pi + 1;
  40611. ps[15] = pi + 2;
  40612. ps[8] = ps[1];
  40613. ps[11] = pi + 3;
  40614. ps[4] = ps[2];
  40615. ps[7] = pi + 4;
  40616. ps[0] = ps[3];
  40617. ps[1] = pi + 7;
  40618. ps[2] = pi + 6;
  40619. ps[3] = pi + 5;
  40620. cs[2] = cs[0];
  40621. cs[3] = ci;
  40622. cs[0] = cs[1];
  40623. cs[1] = ci + 1;
  40624. break;
  40625. }
  40626. ps[5] = coords.length;
  40627. coords.push([(-4 * coords[ps[0]][0] - coords[ps[15]][0] + 6 * (coords[ps[4]][0] + coords[ps[1]][0]) - 2 * (coords[ps[12]][0] + coords[ps[3]][0]) + 3 * (coords[ps[13]][0] + coords[ps[7]][0])) / 9, (-4 * coords[ps[0]][1] - coords[ps[15]][1] + 6 * (coords[ps[4]][1] + coords[ps[1]][1]) - 2 * (coords[ps[12]][1] + coords[ps[3]][1]) + 3 * (coords[ps[13]][1] + coords[ps[7]][1])) / 9]);
  40628. ps[6] = coords.length;
  40629. coords.push([(-4 * coords[ps[3]][0] - coords[ps[12]][0] + 6 * (coords[ps[2]][0] + coords[ps[7]][0]) - 2 * (coords[ps[0]][0] + coords[ps[15]][0]) + 3 * (coords[ps[4]][0] + coords[ps[14]][0])) / 9, (-4 * coords[ps[3]][1] - coords[ps[12]][1] + 6 * (coords[ps[2]][1] + coords[ps[7]][1]) - 2 * (coords[ps[0]][1] + coords[ps[15]][1]) + 3 * (coords[ps[4]][1] + coords[ps[14]][1])) / 9]);
  40630. ps[9] = coords.length;
  40631. coords.push([(-4 * coords[ps[12]][0] - coords[ps[3]][0] + 6 * (coords[ps[8]][0] + coords[ps[13]][0]) - 2 * (coords[ps[0]][0] + coords[ps[15]][0]) + 3 * (coords[ps[11]][0] + coords[ps[1]][0])) / 9, (-4 * coords[ps[12]][1] - coords[ps[3]][1] + 6 * (coords[ps[8]][1] + coords[ps[13]][1]) - 2 * (coords[ps[0]][1] + coords[ps[15]][1]) + 3 * (coords[ps[11]][1] + coords[ps[1]][1])) / 9]);
  40632. ps[10] = coords.length;
  40633. coords.push([(-4 * coords[ps[15]][0] - coords[ps[0]][0] + 6 * (coords[ps[11]][0] + coords[ps[14]][0]) - 2 * (coords[ps[12]][0] + coords[ps[3]][0]) + 3 * (coords[ps[2]][0] + coords[ps[8]][0])) / 9, (-4 * coords[ps[15]][1] - coords[ps[0]][1] + 6 * (coords[ps[11]][1] + coords[ps[14]][1]) - 2 * (coords[ps[12]][1] + coords[ps[3]][1]) + 3 * (coords[ps[2]][1] + coords[ps[8]][1])) / 9]);
  40634. mesh.figures.push({
  40635. type: "patch",
  40636. coords: new Int32Array(ps),
  40637. colors: new Int32Array(cs)
  40638. });
  40639. }
  40640. }
  40641. function decodeType7Shading(mesh, reader) {
  40642. var coords = mesh.coords;
  40643. var colors = mesh.colors;
  40644. var ps = new Int32Array(16);
  40645. var cs = new Int32Array(4);
  40646. while (reader.hasData) {
  40647. var f = reader.readFlag();
  40648. if (!(0 <= f && f <= 3)) {
  40649. throw new _util.FormatError("Unknown type7 flag");
  40650. }
  40651. var i, ii;
  40652. var pi = coords.length;
  40653. for (i = 0, ii = f !== 0 ? 12 : 16; i < ii; i++) {
  40654. coords.push(reader.readCoordinate());
  40655. }
  40656. var ci = colors.length;
  40657. for (i = 0, ii = f !== 0 ? 2 : 4; i < ii; i++) {
  40658. colors.push(reader.readComponents());
  40659. }
  40660. var tmp1, tmp2, tmp3, tmp4;
  40661. switch (f) {
  40662. case 0:
  40663. ps[12] = pi + 3;
  40664. ps[13] = pi + 4;
  40665. ps[14] = pi + 5;
  40666. ps[15] = pi + 6;
  40667. ps[8] = pi + 2;
  40668. ps[9] = pi + 13;
  40669. ps[10] = pi + 14;
  40670. ps[11] = pi + 7;
  40671. ps[4] = pi + 1;
  40672. ps[5] = pi + 12;
  40673. ps[6] = pi + 15;
  40674. ps[7] = pi + 8;
  40675. ps[0] = pi;
  40676. ps[1] = pi + 11;
  40677. ps[2] = pi + 10;
  40678. ps[3] = pi + 9;
  40679. cs[2] = ci + 1;
  40680. cs[3] = ci + 2;
  40681. cs[0] = ci;
  40682. cs[1] = ci + 3;
  40683. break;
  40684. case 1:
  40685. tmp1 = ps[12];
  40686. tmp2 = ps[13];
  40687. tmp3 = ps[14];
  40688. tmp4 = ps[15];
  40689. ps[12] = tmp4;
  40690. ps[13] = pi + 0;
  40691. ps[14] = pi + 1;
  40692. ps[15] = pi + 2;
  40693. ps[8] = tmp3;
  40694. ps[9] = pi + 9;
  40695. ps[10] = pi + 10;
  40696. ps[11] = pi + 3;
  40697. ps[4] = tmp2;
  40698. ps[5] = pi + 8;
  40699. ps[6] = pi + 11;
  40700. ps[7] = pi + 4;
  40701. ps[0] = tmp1;
  40702. ps[1] = pi + 7;
  40703. ps[2] = pi + 6;
  40704. ps[3] = pi + 5;
  40705. tmp1 = cs[2];
  40706. tmp2 = cs[3];
  40707. cs[2] = tmp2;
  40708. cs[3] = ci;
  40709. cs[0] = tmp1;
  40710. cs[1] = ci + 1;
  40711. break;
  40712. case 2:
  40713. tmp1 = ps[15];
  40714. tmp2 = ps[11];
  40715. ps[12] = ps[3];
  40716. ps[13] = pi + 0;
  40717. ps[14] = pi + 1;
  40718. ps[15] = pi + 2;
  40719. ps[8] = ps[7];
  40720. ps[9] = pi + 9;
  40721. ps[10] = pi + 10;
  40722. ps[11] = pi + 3;
  40723. ps[4] = tmp2;
  40724. ps[5] = pi + 8;
  40725. ps[6] = pi + 11;
  40726. ps[7] = pi + 4;
  40727. ps[0] = tmp1;
  40728. ps[1] = pi + 7;
  40729. ps[2] = pi + 6;
  40730. ps[3] = pi + 5;
  40731. tmp1 = cs[3];
  40732. cs[2] = cs[1];
  40733. cs[3] = ci;
  40734. cs[0] = tmp1;
  40735. cs[1] = ci + 1;
  40736. break;
  40737. case 3:
  40738. ps[12] = ps[0];
  40739. ps[13] = pi + 0;
  40740. ps[14] = pi + 1;
  40741. ps[15] = pi + 2;
  40742. ps[8] = ps[1];
  40743. ps[9] = pi + 9;
  40744. ps[10] = pi + 10;
  40745. ps[11] = pi + 3;
  40746. ps[4] = ps[2];
  40747. ps[5] = pi + 8;
  40748. ps[6] = pi + 11;
  40749. ps[7] = pi + 4;
  40750. ps[0] = ps[3];
  40751. ps[1] = pi + 7;
  40752. ps[2] = pi + 6;
  40753. ps[3] = pi + 5;
  40754. cs[2] = cs[0];
  40755. cs[3] = ci;
  40756. cs[0] = cs[1];
  40757. cs[1] = ci + 1;
  40758. break;
  40759. }
  40760. mesh.figures.push({
  40761. type: "patch",
  40762. coords: new Int32Array(ps),
  40763. colors: new Int32Array(cs)
  40764. });
  40765. }
  40766. }
  40767. function updateBounds(mesh) {
  40768. var minX = mesh.coords[0][0],
  40769. minY = mesh.coords[0][1],
  40770. maxX = minX,
  40771. maxY = minY;
  40772. for (var i = 1, ii = mesh.coords.length; i < ii; i++) {
  40773. var x = mesh.coords[i][0],
  40774. y = mesh.coords[i][1];
  40775. minX = minX > x ? x : minX;
  40776. minY = minY > y ? y : minY;
  40777. maxX = maxX < x ? x : maxX;
  40778. maxY = maxY < y ? y : maxY;
  40779. }
  40780. mesh.bounds = [minX, minY, maxX, maxY];
  40781. }
  40782. function packData(mesh) {
  40783. var i, ii, j, jj;
  40784. var coords = mesh.coords;
  40785. var coordsPacked = new Float32Array(coords.length * 2);
  40786. for (i = 0, j = 0, ii = coords.length; i < ii; i++) {
  40787. var xy = coords[i];
  40788. coordsPacked[j++] = xy[0];
  40789. coordsPacked[j++] = xy[1];
  40790. }
  40791. mesh.coords = coordsPacked;
  40792. var colors = mesh.colors;
  40793. var colorsPacked = new Uint8Array(colors.length * 3);
  40794. for (i = 0, j = 0, ii = colors.length; i < ii; i++) {
  40795. var c = colors[i];
  40796. colorsPacked[j++] = c[0];
  40797. colorsPacked[j++] = c[1];
  40798. colorsPacked[j++] = c[2];
  40799. }
  40800. mesh.colors = colorsPacked;
  40801. var figures = mesh.figures;
  40802. for (i = 0, ii = figures.length; i < ii; i++) {
  40803. var figure = figures[i],
  40804. ps = figure.coords,
  40805. cs = figure.colors;
  40806. for (j = 0, jj = ps.length; j < jj; j++) {
  40807. ps[j] *= 2;
  40808. cs[j] *= 3;
  40809. }
  40810. }
  40811. }
  40812. function Mesh(stream, matrix, xref, resources, pdfFunctionFactory, localColorSpaceCache) {
  40813. if (!(0, _primitives.isStream)(stream)) {
  40814. throw new _util.FormatError("Mesh data is not a stream");
  40815. }
  40816. var dict = stream.dict;
  40817. this.matrix = matrix;
  40818. this.shadingType = dict.get("ShadingType");
  40819. this.type = "Pattern";
  40820. const bbox = dict.getArray("BBox");
  40821. if (Array.isArray(bbox) && bbox.length === 4) {
  40822. this.bbox = _util.Util.normalizeRect(bbox);
  40823. } else {
  40824. this.bbox = null;
  40825. }
  40826. const cs = _colorspace.ColorSpace.parse({
  40827. cs: dict.getRaw("ColorSpace") || dict.getRaw("CS"),
  40828. xref,
  40829. resources,
  40830. pdfFunctionFactory,
  40831. localColorSpaceCache
  40832. });
  40833. this.cs = cs;
  40834. this.background = dict.has("Background") ? cs.getRgb(dict.get("Background"), 0) : null;
  40835. var fnObj = dict.getRaw("Function");
  40836. var fn = fnObj ? pdfFunctionFactory.createFromArray(fnObj) : null;
  40837. this.coords = [];
  40838. this.colors = [];
  40839. this.figures = [];
  40840. var decodeContext = {
  40841. bitsPerCoordinate: dict.get("BitsPerCoordinate"),
  40842. bitsPerComponent: dict.get("BitsPerComponent"),
  40843. bitsPerFlag: dict.get("BitsPerFlag"),
  40844. decode: dict.getArray("Decode"),
  40845. colorFn: fn,
  40846. colorSpace: cs,
  40847. numComps: fn ? 1 : cs.numComps
  40848. };
  40849. var reader = new MeshStreamReader(stream, decodeContext);
  40850. var patchMesh = false;
  40851. switch (this.shadingType) {
  40852. case ShadingType.FREE_FORM_MESH:
  40853. decodeType4Shading(this, reader);
  40854. break;
  40855. case ShadingType.LATTICE_FORM_MESH:
  40856. var verticesPerRow = dict.get("VerticesPerRow") | 0;
  40857. if (verticesPerRow < 2) {
  40858. throw new _util.FormatError("Invalid VerticesPerRow");
  40859. }
  40860. decodeType5Shading(this, reader, verticesPerRow);
  40861. break;
  40862. case ShadingType.COONS_PATCH_MESH:
  40863. decodeType6Shading(this, reader);
  40864. patchMesh = true;
  40865. break;
  40866. case ShadingType.TENSOR_PATCH_MESH:
  40867. decodeType7Shading(this, reader);
  40868. patchMesh = true;
  40869. break;
  40870. default:
  40871. (0, _util.unreachable)("Unsupported mesh type.");
  40872. break;
  40873. }
  40874. if (patchMesh) {
  40875. updateBounds(this);
  40876. for (var i = 0, ii = this.figures.length; i < ii; i++) {
  40877. buildFigureFromPatch(this, i);
  40878. }
  40879. }
  40880. updateBounds(this);
  40881. packData(this);
  40882. }
  40883. Mesh.prototype = {
  40884. getIR: function Mesh_getIR() {
  40885. return ["Mesh", this.shadingType, this.coords, this.colors, this.figures, this.bounds, this.matrix, this.bbox, this.background];
  40886. }
  40887. };
  40888. return Mesh;
  40889. }();
  40890. Shadings.Dummy = function DummyClosure() {
  40891. function Dummy() {
  40892. this.type = "Pattern";
  40893. }
  40894. Dummy.prototype = {
  40895. getIR: function Dummy_getIR() {
  40896. return ["Dummy"];
  40897. }
  40898. };
  40899. return Dummy;
  40900. }();
  40901. function getTilingPatternIR(operatorList, dict, color) {
  40902. const matrix = dict.getArray("Matrix");
  40903. const bbox = _util.Util.normalizeRect(dict.getArray("BBox"));
  40904. const xstep = dict.get("XStep");
  40905. const ystep = dict.get("YStep");
  40906. const paintType = dict.get("PaintType");
  40907. const tilingType = dict.get("TilingType");
  40908. if (bbox[2] - bbox[0] === 0 || bbox[3] - bbox[1] === 0) {
  40909. throw new _util.FormatError(`Invalid getTilingPatternIR /BBox array: [${bbox}].`);
  40910. }
  40911. return ["TilingPattern", color, operatorList, matrix, bbox, xstep, ystep, paintType, tilingType];
  40912. }
  40913. /***/ }),
  40914. /* 39 */
  40915. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  40916. Object.defineProperty(exports, "__esModule", ({
  40917. value: true
  40918. }));
  40919. exports.isPDFFunction = isPDFFunction;
  40920. exports.PostScriptEvaluator = exports.PostScriptCompiler = exports.PDFFunctionFactory = void 0;
  40921. var _primitives = __w_pdfjs_require__(5);
  40922. var _util = __w_pdfjs_require__(2);
  40923. var _ps_parser = __w_pdfjs_require__(40);
  40924. var _image_utils = __w_pdfjs_require__(24);
  40925. class PDFFunctionFactory {
  40926. constructor({
  40927. xref,
  40928. isEvalSupported = true
  40929. }) {
  40930. this.xref = xref;
  40931. this.isEvalSupported = isEvalSupported !== false;
  40932. }
  40933. create(fn) {
  40934. const cachedFunction = this.getCached(fn);
  40935. if (cachedFunction) {
  40936. return cachedFunction;
  40937. }
  40938. const parsedFunction = PDFFunction.parse({
  40939. xref: this.xref,
  40940. isEvalSupported: this.isEvalSupported,
  40941. fn: fn instanceof _primitives.Ref ? this.xref.fetch(fn) : fn
  40942. });
  40943. this._cache(fn, parsedFunction);
  40944. return parsedFunction;
  40945. }
  40946. createFromArray(fnObj) {
  40947. const cachedFunction = this.getCached(fnObj);
  40948. if (cachedFunction) {
  40949. return cachedFunction;
  40950. }
  40951. const parsedFunction = PDFFunction.parseArray({
  40952. xref: this.xref,
  40953. isEvalSupported: this.isEvalSupported,
  40954. fnObj: fnObj instanceof _primitives.Ref ? this.xref.fetch(fnObj) : fnObj
  40955. });
  40956. this._cache(fnObj, parsedFunction);
  40957. return parsedFunction;
  40958. }
  40959. getCached(cacheKey) {
  40960. let fnRef;
  40961. if (cacheKey instanceof _primitives.Ref) {
  40962. fnRef = cacheKey;
  40963. } else if (cacheKey instanceof _primitives.Dict) {
  40964. fnRef = cacheKey.objId;
  40965. } else if ((0, _primitives.isStream)(cacheKey)) {
  40966. fnRef = cacheKey.dict && cacheKey.dict.objId;
  40967. }
  40968. if (fnRef) {
  40969. const localFunction = this._localFunctionCache.getByRef(fnRef);
  40970. if (localFunction) {
  40971. return localFunction;
  40972. }
  40973. }
  40974. return null;
  40975. }
  40976. _cache(cacheKey, parsedFunction) {
  40977. if (!parsedFunction) {
  40978. throw new Error('PDFFunctionFactory._cache - expected "parsedFunction" argument.');
  40979. }
  40980. let fnRef;
  40981. if (cacheKey instanceof _primitives.Ref) {
  40982. fnRef = cacheKey;
  40983. } else if (cacheKey instanceof _primitives.Dict) {
  40984. fnRef = cacheKey.objId;
  40985. } else if ((0, _primitives.isStream)(cacheKey)) {
  40986. fnRef = cacheKey.dict && cacheKey.dict.objId;
  40987. }
  40988. if (fnRef) {
  40989. this._localFunctionCache.set(null, fnRef, parsedFunction);
  40990. }
  40991. }
  40992. get _localFunctionCache() {
  40993. return (0, _util.shadow)(this, "_localFunctionCache", new _image_utils.LocalFunctionCache());
  40994. }
  40995. }
  40996. exports.PDFFunctionFactory = PDFFunctionFactory;
  40997. function toNumberArray(arr) {
  40998. if (!Array.isArray(arr)) {
  40999. return null;
  41000. }
  41001. const length = arr.length;
  41002. for (let i = 0; i < length; i++) {
  41003. if (typeof arr[i] !== "number") {
  41004. const result = new Array(length);
  41005. for (let j = 0; j < length; j++) {
  41006. result[j] = +arr[j];
  41007. }
  41008. return result;
  41009. }
  41010. }
  41011. return arr;
  41012. }
  41013. var PDFFunction = function PDFFunctionClosure() {
  41014. const CONSTRUCT_SAMPLED = 0;
  41015. const CONSTRUCT_INTERPOLATED = 2;
  41016. const CONSTRUCT_STICHED = 3;
  41017. const CONSTRUCT_POSTSCRIPT = 4;
  41018. return {
  41019. getSampleArray(size, outputSize, bps, stream) {
  41020. var i, ii;
  41021. var length = 1;
  41022. for (i = 0, ii = size.length; i < ii; i++) {
  41023. length *= size[i];
  41024. }
  41025. length *= outputSize;
  41026. var array = new Array(length);
  41027. var codeSize = 0;
  41028. var codeBuf = 0;
  41029. var sampleMul = 1.0 / (2.0 ** bps - 1);
  41030. var strBytes = stream.getBytes((length * bps + 7) / 8);
  41031. var strIdx = 0;
  41032. for (i = 0; i < length; i++) {
  41033. while (codeSize < bps) {
  41034. codeBuf <<= 8;
  41035. codeBuf |= strBytes[strIdx++];
  41036. codeSize += 8;
  41037. }
  41038. codeSize -= bps;
  41039. array[i] = (codeBuf >> codeSize) * sampleMul;
  41040. codeBuf &= (1 << codeSize) - 1;
  41041. }
  41042. return array;
  41043. },
  41044. getIR({
  41045. xref,
  41046. isEvalSupported,
  41047. fn
  41048. }) {
  41049. var dict = fn.dict;
  41050. if (!dict) {
  41051. dict = fn;
  41052. }
  41053. var types = [this.constructSampled, null, this.constructInterpolated, this.constructStiched, this.constructPostScript];
  41054. var typeNum = dict.get("FunctionType");
  41055. var typeFn = types[typeNum];
  41056. if (!typeFn) {
  41057. throw new _util.FormatError("Unknown type of function");
  41058. }
  41059. return typeFn.call(this, {
  41060. xref,
  41061. isEvalSupported,
  41062. fn,
  41063. dict
  41064. });
  41065. },
  41066. fromIR({
  41067. xref,
  41068. isEvalSupported,
  41069. IR
  41070. }) {
  41071. var type = IR[0];
  41072. switch (type) {
  41073. case CONSTRUCT_SAMPLED:
  41074. return this.constructSampledFromIR({
  41075. xref,
  41076. isEvalSupported,
  41077. IR
  41078. });
  41079. case CONSTRUCT_INTERPOLATED:
  41080. return this.constructInterpolatedFromIR({
  41081. xref,
  41082. isEvalSupported,
  41083. IR
  41084. });
  41085. case CONSTRUCT_STICHED:
  41086. return this.constructStichedFromIR({
  41087. xref,
  41088. isEvalSupported,
  41089. IR
  41090. });
  41091. default:
  41092. return this.constructPostScriptFromIR({
  41093. xref,
  41094. isEvalSupported,
  41095. IR
  41096. });
  41097. }
  41098. },
  41099. parse({
  41100. xref,
  41101. isEvalSupported,
  41102. fn
  41103. }) {
  41104. const IR = this.getIR({
  41105. xref,
  41106. isEvalSupported,
  41107. fn
  41108. });
  41109. return this.fromIR({
  41110. xref,
  41111. isEvalSupported,
  41112. IR
  41113. });
  41114. },
  41115. parseArray({
  41116. xref,
  41117. isEvalSupported,
  41118. fnObj
  41119. }) {
  41120. if (!Array.isArray(fnObj)) {
  41121. return this.parse({
  41122. xref,
  41123. isEvalSupported,
  41124. fn: fnObj
  41125. });
  41126. }
  41127. var fnArray = [];
  41128. for (var j = 0, jj = fnObj.length; j < jj; j++) {
  41129. fnArray.push(this.parse({
  41130. xref,
  41131. isEvalSupported,
  41132. fn: xref.fetchIfRef(fnObj[j])
  41133. }));
  41134. }
  41135. return function (src, srcOffset, dest, destOffset) {
  41136. for (var i = 0, ii = fnArray.length; i < ii; i++) {
  41137. fnArray[i](src, srcOffset, dest, destOffset + i);
  41138. }
  41139. };
  41140. },
  41141. constructSampled({
  41142. xref,
  41143. isEvalSupported,
  41144. fn,
  41145. dict
  41146. }) {
  41147. function toMultiArray(arr) {
  41148. var inputLength = arr.length;
  41149. var out = [];
  41150. var index = 0;
  41151. for (var i = 0; i < inputLength; i += 2) {
  41152. out[index] = [arr[i], arr[i + 1]];
  41153. ++index;
  41154. }
  41155. return out;
  41156. }
  41157. var domain = toNumberArray(dict.getArray("Domain"));
  41158. var range = toNumberArray(dict.getArray("Range"));
  41159. if (!domain || !range) {
  41160. throw new _util.FormatError("No domain or range");
  41161. }
  41162. var inputSize = domain.length / 2;
  41163. var outputSize = range.length / 2;
  41164. domain = toMultiArray(domain);
  41165. range = toMultiArray(range);
  41166. var size = toNumberArray(dict.getArray("Size"));
  41167. var bps = dict.get("BitsPerSample");
  41168. var order = dict.get("Order") || 1;
  41169. if (order !== 1) {
  41170. (0, _util.info)("No support for cubic spline interpolation: " + order);
  41171. }
  41172. var encode = toNumberArray(dict.getArray("Encode"));
  41173. if (!encode) {
  41174. encode = [];
  41175. for (var i = 0; i < inputSize; ++i) {
  41176. encode.push([0, size[i] - 1]);
  41177. }
  41178. } else {
  41179. encode = toMultiArray(encode);
  41180. }
  41181. var decode = toNumberArray(dict.getArray("Decode"));
  41182. if (!decode) {
  41183. decode = range;
  41184. } else {
  41185. decode = toMultiArray(decode);
  41186. }
  41187. var samples = this.getSampleArray(size, outputSize, bps, fn);
  41188. return [CONSTRUCT_SAMPLED, inputSize, domain, encode, decode, samples, size, outputSize, 2 ** bps - 1, range];
  41189. },
  41190. constructSampledFromIR({
  41191. xref,
  41192. isEvalSupported,
  41193. IR
  41194. }) {
  41195. function interpolate(x, xmin, xmax, ymin, ymax) {
  41196. return ymin + (x - xmin) * ((ymax - ymin) / (xmax - xmin));
  41197. }
  41198. return function constructSampledFromIRResult(src, srcOffset, dest, destOffset) {
  41199. var m = IR[1];
  41200. var domain = IR[2];
  41201. var encode = IR[3];
  41202. var decode = IR[4];
  41203. var samples = IR[5];
  41204. var size = IR[6];
  41205. var n = IR[7];
  41206. var range = IR[9];
  41207. var cubeVertices = 1 << m;
  41208. var cubeN = new Float64Array(cubeVertices);
  41209. var cubeVertex = new Uint32Array(cubeVertices);
  41210. var i, j;
  41211. for (j = 0; j < cubeVertices; j++) {
  41212. cubeN[j] = 1;
  41213. }
  41214. var k = n,
  41215. pos = 1;
  41216. for (i = 0; i < m; ++i) {
  41217. var domain_2i = domain[i][0];
  41218. var domain_2i_1 = domain[i][1];
  41219. var xi = Math.min(Math.max(src[srcOffset + i], domain_2i), domain_2i_1);
  41220. var e = interpolate(xi, domain_2i, domain_2i_1, encode[i][0], encode[i][1]);
  41221. var size_i = size[i];
  41222. e = Math.min(Math.max(e, 0), size_i - 1);
  41223. var e0 = e < size_i - 1 ? Math.floor(e) : e - 1;
  41224. var n0 = e0 + 1 - e;
  41225. var n1 = e - e0;
  41226. var offset0 = e0 * k;
  41227. var offset1 = offset0 + k;
  41228. for (j = 0; j < cubeVertices; j++) {
  41229. if (j & pos) {
  41230. cubeN[j] *= n1;
  41231. cubeVertex[j] += offset1;
  41232. } else {
  41233. cubeN[j] *= n0;
  41234. cubeVertex[j] += offset0;
  41235. }
  41236. }
  41237. k *= size_i;
  41238. pos <<= 1;
  41239. }
  41240. for (j = 0; j < n; ++j) {
  41241. var rj = 0;
  41242. for (i = 0; i < cubeVertices; i++) {
  41243. rj += samples[cubeVertex[i] + j] * cubeN[i];
  41244. }
  41245. rj = interpolate(rj, 0, 1, decode[j][0], decode[j][1]);
  41246. dest[destOffset + j] = Math.min(Math.max(rj, range[j][0]), range[j][1]);
  41247. }
  41248. };
  41249. },
  41250. constructInterpolated({
  41251. xref,
  41252. isEvalSupported,
  41253. fn,
  41254. dict
  41255. }) {
  41256. var c0 = toNumberArray(dict.getArray("C0")) || [0];
  41257. var c1 = toNumberArray(dict.getArray("C1")) || [1];
  41258. var n = dict.get("N");
  41259. var length = c0.length;
  41260. var diff = [];
  41261. for (var i = 0; i < length; ++i) {
  41262. diff.push(c1[i] - c0[i]);
  41263. }
  41264. return [CONSTRUCT_INTERPOLATED, c0, diff, n];
  41265. },
  41266. constructInterpolatedFromIR({
  41267. xref,
  41268. isEvalSupported,
  41269. IR
  41270. }) {
  41271. var c0 = IR[1];
  41272. var diff = IR[2];
  41273. var n = IR[3];
  41274. var length = diff.length;
  41275. return function constructInterpolatedFromIRResult(src, srcOffset, dest, destOffset) {
  41276. var x = n === 1 ? src[srcOffset] : src[srcOffset] ** n;
  41277. for (var j = 0; j < length; ++j) {
  41278. dest[destOffset + j] = c0[j] + x * diff[j];
  41279. }
  41280. };
  41281. },
  41282. constructStiched({
  41283. xref,
  41284. isEvalSupported,
  41285. fn,
  41286. dict
  41287. }) {
  41288. var domain = toNumberArray(dict.getArray("Domain"));
  41289. if (!domain) {
  41290. throw new _util.FormatError("No domain");
  41291. }
  41292. var inputSize = domain.length / 2;
  41293. if (inputSize !== 1) {
  41294. throw new _util.FormatError("Bad domain for stiched function");
  41295. }
  41296. var fnRefs = dict.get("Functions");
  41297. var fns = [];
  41298. for (var i = 0, ii = fnRefs.length; i < ii; ++i) {
  41299. fns.push(this.parse({
  41300. xref,
  41301. isEvalSupported,
  41302. fn: xref.fetchIfRef(fnRefs[i])
  41303. }));
  41304. }
  41305. var bounds = toNumberArray(dict.getArray("Bounds"));
  41306. var encode = toNumberArray(dict.getArray("Encode"));
  41307. return [CONSTRUCT_STICHED, domain, bounds, encode, fns];
  41308. },
  41309. constructStichedFromIR({
  41310. xref,
  41311. isEvalSupported,
  41312. IR
  41313. }) {
  41314. var domain = IR[1];
  41315. var bounds = IR[2];
  41316. var encode = IR[3];
  41317. var fns = IR[4];
  41318. var tmpBuf = new Float32Array(1);
  41319. return function constructStichedFromIRResult(src, srcOffset, dest, destOffset) {
  41320. var clip = function constructStichedFromIRClip(v, min, max) {
  41321. if (v > max) {
  41322. v = max;
  41323. } else if (v < min) {
  41324. v = min;
  41325. }
  41326. return v;
  41327. };
  41328. var v = clip(src[srcOffset], domain[0], domain[1]);
  41329. for (var i = 0, ii = bounds.length; i < ii; ++i) {
  41330. if (v < bounds[i]) {
  41331. break;
  41332. }
  41333. }
  41334. var dmin = domain[0];
  41335. if (i > 0) {
  41336. dmin = bounds[i - 1];
  41337. }
  41338. var dmax = domain[1];
  41339. if (i < bounds.length) {
  41340. dmax = bounds[i];
  41341. }
  41342. var rmin = encode[2 * i];
  41343. var rmax = encode[2 * i + 1];
  41344. tmpBuf[0] = dmin === dmax ? rmin : rmin + (v - dmin) * (rmax - rmin) / (dmax - dmin);
  41345. fns[i](tmpBuf, 0, dest, destOffset);
  41346. };
  41347. },
  41348. constructPostScript({
  41349. xref,
  41350. isEvalSupported,
  41351. fn,
  41352. dict
  41353. }) {
  41354. var domain = toNumberArray(dict.getArray("Domain"));
  41355. var range = toNumberArray(dict.getArray("Range"));
  41356. if (!domain) {
  41357. throw new _util.FormatError("No domain.");
  41358. }
  41359. if (!range) {
  41360. throw new _util.FormatError("No range.");
  41361. }
  41362. var lexer = new _ps_parser.PostScriptLexer(fn);
  41363. var parser = new _ps_parser.PostScriptParser(lexer);
  41364. var code = parser.parse();
  41365. return [CONSTRUCT_POSTSCRIPT, domain, range, code];
  41366. },
  41367. constructPostScriptFromIR({
  41368. xref,
  41369. isEvalSupported,
  41370. IR
  41371. }) {
  41372. var domain = IR[1];
  41373. var range = IR[2];
  41374. var code = IR[3];
  41375. if (isEvalSupported && _util.IsEvalSupportedCached.value) {
  41376. const compiled = new PostScriptCompiler().compile(code, domain, range);
  41377. if (compiled) {
  41378. return new Function("src", "srcOffset", "dest", "destOffset", compiled);
  41379. }
  41380. }
  41381. (0, _util.info)("Unable to compile PS function");
  41382. var numOutputs = range.length >> 1;
  41383. var numInputs = domain.length >> 1;
  41384. var evaluator = new PostScriptEvaluator(code);
  41385. var cache = Object.create(null);
  41386. var MAX_CACHE_SIZE = 2048 * 4;
  41387. var cache_available = MAX_CACHE_SIZE;
  41388. var tmpBuf = new Float32Array(numInputs);
  41389. return function constructPostScriptFromIRResult(src, srcOffset, dest, destOffset) {
  41390. var i, value;
  41391. var key = "";
  41392. var input = tmpBuf;
  41393. for (i = 0; i < numInputs; i++) {
  41394. value = src[srcOffset + i];
  41395. input[i] = value;
  41396. key += value + "_";
  41397. }
  41398. var cachedValue = cache[key];
  41399. if (cachedValue !== undefined) {
  41400. dest.set(cachedValue, destOffset);
  41401. return;
  41402. }
  41403. var output = new Float32Array(numOutputs);
  41404. var stack = evaluator.execute(input);
  41405. var stackIndex = stack.length - numOutputs;
  41406. for (i = 0; i < numOutputs; i++) {
  41407. value = stack[stackIndex + i];
  41408. var bound = range[i * 2];
  41409. if (value < bound) {
  41410. value = bound;
  41411. } else {
  41412. bound = range[i * 2 + 1];
  41413. if (value > bound) {
  41414. value = bound;
  41415. }
  41416. }
  41417. output[i] = value;
  41418. }
  41419. if (cache_available > 0) {
  41420. cache_available--;
  41421. cache[key] = output;
  41422. }
  41423. dest.set(output, destOffset);
  41424. };
  41425. }
  41426. };
  41427. }();
  41428. function isPDFFunction(v) {
  41429. var fnDict;
  41430. if (typeof v !== "object") {
  41431. return false;
  41432. } else if ((0, _primitives.isDict)(v)) {
  41433. fnDict = v;
  41434. } else if ((0, _primitives.isStream)(v)) {
  41435. fnDict = v.dict;
  41436. } else {
  41437. return false;
  41438. }
  41439. return fnDict.has("FunctionType");
  41440. }
  41441. var PostScriptStack = function PostScriptStackClosure() {
  41442. var MAX_STACK_SIZE = 100;
  41443. function PostScriptStack(initialStack) {
  41444. this.stack = !initialStack ? [] : Array.prototype.slice.call(initialStack, 0);
  41445. }
  41446. PostScriptStack.prototype = {
  41447. push: function PostScriptStack_push(value) {
  41448. if (this.stack.length >= MAX_STACK_SIZE) {
  41449. throw new Error("PostScript function stack overflow.");
  41450. }
  41451. this.stack.push(value);
  41452. },
  41453. pop: function PostScriptStack_pop() {
  41454. if (this.stack.length <= 0) {
  41455. throw new Error("PostScript function stack underflow.");
  41456. }
  41457. return this.stack.pop();
  41458. },
  41459. copy: function PostScriptStack_copy(n) {
  41460. if (this.stack.length + n >= MAX_STACK_SIZE) {
  41461. throw new Error("PostScript function stack overflow.");
  41462. }
  41463. var stack = this.stack;
  41464. for (var i = stack.length - n, j = n - 1; j >= 0; j--, i++) {
  41465. stack.push(stack[i]);
  41466. }
  41467. },
  41468. index: function PostScriptStack_index(n) {
  41469. this.push(this.stack[this.stack.length - n - 1]);
  41470. },
  41471. roll: function PostScriptStack_roll(n, p) {
  41472. var stack = this.stack;
  41473. var l = stack.length - n;
  41474. var r = stack.length - 1,
  41475. c = l + (p - Math.floor(p / n) * n),
  41476. i,
  41477. j,
  41478. t;
  41479. for (i = l, j = r; i < j; i++, j--) {
  41480. t = stack[i];
  41481. stack[i] = stack[j];
  41482. stack[j] = t;
  41483. }
  41484. for (i = l, j = c - 1; i < j; i++, j--) {
  41485. t = stack[i];
  41486. stack[i] = stack[j];
  41487. stack[j] = t;
  41488. }
  41489. for (i = c, j = r; i < j; i++, j--) {
  41490. t = stack[i];
  41491. stack[i] = stack[j];
  41492. stack[j] = t;
  41493. }
  41494. }
  41495. };
  41496. return PostScriptStack;
  41497. }();
  41498. var PostScriptEvaluator = function PostScriptEvaluatorClosure() {
  41499. function PostScriptEvaluator(operators) {
  41500. this.operators = operators;
  41501. }
  41502. PostScriptEvaluator.prototype = {
  41503. execute: function PostScriptEvaluator_execute(initialStack) {
  41504. var stack = new PostScriptStack(initialStack);
  41505. var counter = 0;
  41506. var operators = this.operators;
  41507. var length = operators.length;
  41508. var operator, a, b;
  41509. while (counter < length) {
  41510. operator = operators[counter++];
  41511. if (typeof operator === "number") {
  41512. stack.push(operator);
  41513. continue;
  41514. }
  41515. switch (operator) {
  41516. case "jz":
  41517. b = stack.pop();
  41518. a = stack.pop();
  41519. if (!a) {
  41520. counter = b;
  41521. }
  41522. break;
  41523. case "j":
  41524. a = stack.pop();
  41525. counter = a;
  41526. break;
  41527. case "abs":
  41528. a = stack.pop();
  41529. stack.push(Math.abs(a));
  41530. break;
  41531. case "add":
  41532. b = stack.pop();
  41533. a = stack.pop();
  41534. stack.push(a + b);
  41535. break;
  41536. case "and":
  41537. b = stack.pop();
  41538. a = stack.pop();
  41539. if ((0, _util.isBool)(a) && (0, _util.isBool)(b)) {
  41540. stack.push(a && b);
  41541. } else {
  41542. stack.push(a & b);
  41543. }
  41544. break;
  41545. case "atan":
  41546. a = stack.pop();
  41547. stack.push(Math.atan(a));
  41548. break;
  41549. case "bitshift":
  41550. b = stack.pop();
  41551. a = stack.pop();
  41552. if (a > 0) {
  41553. stack.push(a << b);
  41554. } else {
  41555. stack.push(a >> b);
  41556. }
  41557. break;
  41558. case "ceiling":
  41559. a = stack.pop();
  41560. stack.push(Math.ceil(a));
  41561. break;
  41562. case "copy":
  41563. a = stack.pop();
  41564. stack.copy(a);
  41565. break;
  41566. case "cos":
  41567. a = stack.pop();
  41568. stack.push(Math.cos(a));
  41569. break;
  41570. case "cvi":
  41571. a = stack.pop() | 0;
  41572. stack.push(a);
  41573. break;
  41574. case "cvr":
  41575. break;
  41576. case "div":
  41577. b = stack.pop();
  41578. a = stack.pop();
  41579. stack.push(a / b);
  41580. break;
  41581. case "dup":
  41582. stack.copy(1);
  41583. break;
  41584. case "eq":
  41585. b = stack.pop();
  41586. a = stack.pop();
  41587. stack.push(a === b);
  41588. break;
  41589. case "exch":
  41590. stack.roll(2, 1);
  41591. break;
  41592. case "exp":
  41593. b = stack.pop();
  41594. a = stack.pop();
  41595. stack.push(a ** b);
  41596. break;
  41597. case "false":
  41598. stack.push(false);
  41599. break;
  41600. case "floor":
  41601. a = stack.pop();
  41602. stack.push(Math.floor(a));
  41603. break;
  41604. case "ge":
  41605. b = stack.pop();
  41606. a = stack.pop();
  41607. stack.push(a >= b);
  41608. break;
  41609. case "gt":
  41610. b = stack.pop();
  41611. a = stack.pop();
  41612. stack.push(a > b);
  41613. break;
  41614. case "idiv":
  41615. b = stack.pop();
  41616. a = stack.pop();
  41617. stack.push(a / b | 0);
  41618. break;
  41619. case "index":
  41620. a = stack.pop();
  41621. stack.index(a);
  41622. break;
  41623. case "le":
  41624. b = stack.pop();
  41625. a = stack.pop();
  41626. stack.push(a <= b);
  41627. break;
  41628. case "ln":
  41629. a = stack.pop();
  41630. stack.push(Math.log(a));
  41631. break;
  41632. case "log":
  41633. a = stack.pop();
  41634. stack.push(Math.log(a) / Math.LN10);
  41635. break;
  41636. case "lt":
  41637. b = stack.pop();
  41638. a = stack.pop();
  41639. stack.push(a < b);
  41640. break;
  41641. case "mod":
  41642. b = stack.pop();
  41643. a = stack.pop();
  41644. stack.push(a % b);
  41645. break;
  41646. case "mul":
  41647. b = stack.pop();
  41648. a = stack.pop();
  41649. stack.push(a * b);
  41650. break;
  41651. case "ne":
  41652. b = stack.pop();
  41653. a = stack.pop();
  41654. stack.push(a !== b);
  41655. break;
  41656. case "neg":
  41657. a = stack.pop();
  41658. stack.push(-a);
  41659. break;
  41660. case "not":
  41661. a = stack.pop();
  41662. if ((0, _util.isBool)(a)) {
  41663. stack.push(!a);
  41664. } else {
  41665. stack.push(~a);
  41666. }
  41667. break;
  41668. case "or":
  41669. b = stack.pop();
  41670. a = stack.pop();
  41671. if ((0, _util.isBool)(a) && (0, _util.isBool)(b)) {
  41672. stack.push(a || b);
  41673. } else {
  41674. stack.push(a | b);
  41675. }
  41676. break;
  41677. case "pop":
  41678. stack.pop();
  41679. break;
  41680. case "roll":
  41681. b = stack.pop();
  41682. a = stack.pop();
  41683. stack.roll(a, b);
  41684. break;
  41685. case "round":
  41686. a = stack.pop();
  41687. stack.push(Math.round(a));
  41688. break;
  41689. case "sin":
  41690. a = stack.pop();
  41691. stack.push(Math.sin(a));
  41692. break;
  41693. case "sqrt":
  41694. a = stack.pop();
  41695. stack.push(Math.sqrt(a));
  41696. break;
  41697. case "sub":
  41698. b = stack.pop();
  41699. a = stack.pop();
  41700. stack.push(a - b);
  41701. break;
  41702. case "true":
  41703. stack.push(true);
  41704. break;
  41705. case "truncate":
  41706. a = stack.pop();
  41707. a = a < 0 ? Math.ceil(a) : Math.floor(a);
  41708. stack.push(a);
  41709. break;
  41710. case "xor":
  41711. b = stack.pop();
  41712. a = stack.pop();
  41713. if ((0, _util.isBool)(a) && (0, _util.isBool)(b)) {
  41714. stack.push(a !== b);
  41715. } else {
  41716. stack.push(a ^ b);
  41717. }
  41718. break;
  41719. default:
  41720. throw new _util.FormatError(`Unknown operator ${operator}`);
  41721. }
  41722. }
  41723. return stack.stack;
  41724. }
  41725. };
  41726. return PostScriptEvaluator;
  41727. }();
  41728. exports.PostScriptEvaluator = PostScriptEvaluator;
  41729. var PostScriptCompiler = function PostScriptCompilerClosure() {
  41730. function AstNode(type) {
  41731. this.type = type;
  41732. }
  41733. AstNode.prototype.visit = function (visitor) {
  41734. (0, _util.unreachable)("abstract method");
  41735. };
  41736. function AstArgument(index, min, max) {
  41737. AstNode.call(this, "args");
  41738. this.index = index;
  41739. this.min = min;
  41740. this.max = max;
  41741. }
  41742. AstArgument.prototype = Object.create(AstNode.prototype);
  41743. AstArgument.prototype.visit = function (visitor) {
  41744. visitor.visitArgument(this);
  41745. };
  41746. function AstLiteral(number) {
  41747. AstNode.call(this, "literal");
  41748. this.number = number;
  41749. this.min = number;
  41750. this.max = number;
  41751. }
  41752. AstLiteral.prototype = Object.create(AstNode.prototype);
  41753. AstLiteral.prototype.visit = function (visitor) {
  41754. visitor.visitLiteral(this);
  41755. };
  41756. function AstBinaryOperation(op, arg1, arg2, min, max) {
  41757. AstNode.call(this, "binary");
  41758. this.op = op;
  41759. this.arg1 = arg1;
  41760. this.arg2 = arg2;
  41761. this.min = min;
  41762. this.max = max;
  41763. }
  41764. AstBinaryOperation.prototype = Object.create(AstNode.prototype);
  41765. AstBinaryOperation.prototype.visit = function (visitor) {
  41766. visitor.visitBinaryOperation(this);
  41767. };
  41768. function AstMin(arg, max) {
  41769. AstNode.call(this, "max");
  41770. this.arg = arg;
  41771. this.min = arg.min;
  41772. this.max = max;
  41773. }
  41774. AstMin.prototype = Object.create(AstNode.prototype);
  41775. AstMin.prototype.visit = function (visitor) {
  41776. visitor.visitMin(this);
  41777. };
  41778. function AstVariable(index, min, max) {
  41779. AstNode.call(this, "var");
  41780. this.index = index;
  41781. this.min = min;
  41782. this.max = max;
  41783. }
  41784. AstVariable.prototype = Object.create(AstNode.prototype);
  41785. AstVariable.prototype.visit = function (visitor) {
  41786. visitor.visitVariable(this);
  41787. };
  41788. function AstVariableDefinition(variable, arg) {
  41789. AstNode.call(this, "definition");
  41790. this.variable = variable;
  41791. this.arg = arg;
  41792. }
  41793. AstVariableDefinition.prototype = Object.create(AstNode.prototype);
  41794. AstVariableDefinition.prototype.visit = function (visitor) {
  41795. visitor.visitVariableDefinition(this);
  41796. };
  41797. function ExpressionBuilderVisitor() {
  41798. this.parts = [];
  41799. }
  41800. ExpressionBuilderVisitor.prototype = {
  41801. visitArgument(arg) {
  41802. this.parts.push("Math.max(", arg.min, ", Math.min(", arg.max, ", src[srcOffset + ", arg.index, "]))");
  41803. },
  41804. visitVariable(variable) {
  41805. this.parts.push("v", variable.index);
  41806. },
  41807. visitLiteral(literal) {
  41808. this.parts.push(literal.number);
  41809. },
  41810. visitBinaryOperation(operation) {
  41811. this.parts.push("(");
  41812. operation.arg1.visit(this);
  41813. this.parts.push(" ", operation.op, " ");
  41814. operation.arg2.visit(this);
  41815. this.parts.push(")");
  41816. },
  41817. visitVariableDefinition(definition) {
  41818. this.parts.push("var ");
  41819. definition.variable.visit(this);
  41820. this.parts.push(" = ");
  41821. definition.arg.visit(this);
  41822. this.parts.push(";");
  41823. },
  41824. visitMin(max) {
  41825. this.parts.push("Math.min(");
  41826. max.arg.visit(this);
  41827. this.parts.push(", ", max.max, ")");
  41828. },
  41829. toString() {
  41830. return this.parts.join("");
  41831. }
  41832. };
  41833. function buildAddOperation(num1, num2) {
  41834. if (num2.type === "literal" && num2.number === 0) {
  41835. return num1;
  41836. }
  41837. if (num1.type === "literal" && num1.number === 0) {
  41838. return num2;
  41839. }
  41840. if (num2.type === "literal" && num1.type === "literal") {
  41841. return new AstLiteral(num1.number + num2.number);
  41842. }
  41843. return new AstBinaryOperation("+", num1, num2, num1.min + num2.min, num1.max + num2.max);
  41844. }
  41845. function buildMulOperation(num1, num2) {
  41846. if (num2.type === "literal") {
  41847. if (num2.number === 0) {
  41848. return new AstLiteral(0);
  41849. } else if (num2.number === 1) {
  41850. return num1;
  41851. } else if (num1.type === "literal") {
  41852. return new AstLiteral(num1.number * num2.number);
  41853. }
  41854. }
  41855. if (num1.type === "literal") {
  41856. if (num1.number === 0) {
  41857. return new AstLiteral(0);
  41858. } else if (num1.number === 1) {
  41859. return num2;
  41860. }
  41861. }
  41862. var min = Math.min(num1.min * num2.min, num1.min * num2.max, num1.max * num2.min, num1.max * num2.max);
  41863. var max = Math.max(num1.min * num2.min, num1.min * num2.max, num1.max * num2.min, num1.max * num2.max);
  41864. return new AstBinaryOperation("*", num1, num2, min, max);
  41865. }
  41866. function buildSubOperation(num1, num2) {
  41867. if (num2.type === "literal") {
  41868. if (num2.number === 0) {
  41869. return num1;
  41870. } else if (num1.type === "literal") {
  41871. return new AstLiteral(num1.number - num2.number);
  41872. }
  41873. }
  41874. if (num2.type === "binary" && num2.op === "-" && num1.type === "literal" && num1.number === 1 && num2.arg1.type === "literal" && num2.arg1.number === 1) {
  41875. return num2.arg2;
  41876. }
  41877. return new AstBinaryOperation("-", num1, num2, num1.min - num2.max, num1.max - num2.min);
  41878. }
  41879. function buildMinOperation(num1, max) {
  41880. if (num1.min >= max) {
  41881. return new AstLiteral(max);
  41882. } else if (num1.max <= max) {
  41883. return num1;
  41884. }
  41885. return new AstMin(num1, max);
  41886. }
  41887. function PostScriptCompiler() {}
  41888. PostScriptCompiler.prototype = {
  41889. compile: function PostScriptCompiler_compile(code, domain, range) {
  41890. var stack = [];
  41891. var instructions = [];
  41892. var inputSize = domain.length >> 1,
  41893. outputSize = range.length >> 1;
  41894. var lastRegister = 0;
  41895. var n, j;
  41896. var num1, num2, ast1, ast2, tmpVar, item;
  41897. for (let i = 0; i < inputSize; i++) {
  41898. stack.push(new AstArgument(i, domain[i * 2], domain[i * 2 + 1]));
  41899. }
  41900. for (let i = 0, ii = code.length; i < ii; i++) {
  41901. item = code[i];
  41902. if (typeof item === "number") {
  41903. stack.push(new AstLiteral(item));
  41904. continue;
  41905. }
  41906. switch (item) {
  41907. case "add":
  41908. if (stack.length < 2) {
  41909. return null;
  41910. }
  41911. num2 = stack.pop();
  41912. num1 = stack.pop();
  41913. stack.push(buildAddOperation(num1, num2));
  41914. break;
  41915. case "cvr":
  41916. if (stack.length < 1) {
  41917. return null;
  41918. }
  41919. break;
  41920. case "mul":
  41921. if (stack.length < 2) {
  41922. return null;
  41923. }
  41924. num2 = stack.pop();
  41925. num1 = stack.pop();
  41926. stack.push(buildMulOperation(num1, num2));
  41927. break;
  41928. case "sub":
  41929. if (stack.length < 2) {
  41930. return null;
  41931. }
  41932. num2 = stack.pop();
  41933. num1 = stack.pop();
  41934. stack.push(buildSubOperation(num1, num2));
  41935. break;
  41936. case "exch":
  41937. if (stack.length < 2) {
  41938. return null;
  41939. }
  41940. ast1 = stack.pop();
  41941. ast2 = stack.pop();
  41942. stack.push(ast1, ast2);
  41943. break;
  41944. case "pop":
  41945. if (stack.length < 1) {
  41946. return null;
  41947. }
  41948. stack.pop();
  41949. break;
  41950. case "index":
  41951. if (stack.length < 1) {
  41952. return null;
  41953. }
  41954. num1 = stack.pop();
  41955. if (num1.type !== "literal") {
  41956. return null;
  41957. }
  41958. n = num1.number;
  41959. if (n < 0 || !Number.isInteger(n) || stack.length < n) {
  41960. return null;
  41961. }
  41962. ast1 = stack[stack.length - n - 1];
  41963. if (ast1.type === "literal" || ast1.type === "var") {
  41964. stack.push(ast1);
  41965. break;
  41966. }
  41967. tmpVar = new AstVariable(lastRegister++, ast1.min, ast1.max);
  41968. stack[stack.length - n - 1] = tmpVar;
  41969. stack.push(tmpVar);
  41970. instructions.push(new AstVariableDefinition(tmpVar, ast1));
  41971. break;
  41972. case "dup":
  41973. if (stack.length < 1) {
  41974. return null;
  41975. }
  41976. 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]) {
  41977. num1 = stack.pop();
  41978. stack.push(buildMinOperation(num1, code[i + 1]));
  41979. i += 6;
  41980. break;
  41981. }
  41982. ast1 = stack[stack.length - 1];
  41983. if (ast1.type === "literal" || ast1.type === "var") {
  41984. stack.push(ast1);
  41985. break;
  41986. }
  41987. tmpVar = new AstVariable(lastRegister++, ast1.min, ast1.max);
  41988. stack[stack.length - 1] = tmpVar;
  41989. stack.push(tmpVar);
  41990. instructions.push(new AstVariableDefinition(tmpVar, ast1));
  41991. break;
  41992. case "roll":
  41993. if (stack.length < 2) {
  41994. return null;
  41995. }
  41996. num2 = stack.pop();
  41997. num1 = stack.pop();
  41998. if (num2.type !== "literal" || num1.type !== "literal") {
  41999. return null;
  42000. }
  42001. j = num2.number;
  42002. n = num1.number;
  42003. if (n <= 0 || !Number.isInteger(n) || !Number.isInteger(j) || stack.length < n) {
  42004. return null;
  42005. }
  42006. j = (j % n + n) % n;
  42007. if (j === 0) {
  42008. break;
  42009. }
  42010. Array.prototype.push.apply(stack, stack.splice(stack.length - n, n - j));
  42011. break;
  42012. default:
  42013. return null;
  42014. }
  42015. }
  42016. if (stack.length !== outputSize) {
  42017. return null;
  42018. }
  42019. var result = [];
  42020. instructions.forEach(function (instruction) {
  42021. var statementBuilder = new ExpressionBuilderVisitor();
  42022. instruction.visit(statementBuilder);
  42023. result.push(statementBuilder.toString());
  42024. });
  42025. stack.forEach(function (expr, i) {
  42026. var statementBuilder = new ExpressionBuilderVisitor();
  42027. expr.visit(statementBuilder);
  42028. var min = range[i * 2],
  42029. max = range[i * 2 + 1];
  42030. var out = [statementBuilder.toString()];
  42031. if (min > expr.min) {
  42032. out.unshift("Math.max(", min, ", ");
  42033. out.push(")");
  42034. }
  42035. if (max < expr.max) {
  42036. out.unshift("Math.min(", max, ", ");
  42037. out.push(")");
  42038. }
  42039. out.unshift("dest[destOffset + ", i, "] = ");
  42040. out.push(";");
  42041. result.push(out.join(""));
  42042. });
  42043. return result.join("\n");
  42044. }
  42045. };
  42046. return PostScriptCompiler;
  42047. }();
  42048. exports.PostScriptCompiler = PostScriptCompiler;
  42049. /***/ }),
  42050. /* 40 */
  42051. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  42052. Object.defineProperty(exports, "__esModule", ({
  42053. value: true
  42054. }));
  42055. exports.PostScriptParser = exports.PostScriptLexer = void 0;
  42056. var _util = __w_pdfjs_require__(2);
  42057. var _primitives = __w_pdfjs_require__(5);
  42058. var _core_utils = __w_pdfjs_require__(8);
  42059. class PostScriptParser {
  42060. constructor(lexer) {
  42061. this.lexer = lexer;
  42062. this.operators = [];
  42063. this.token = null;
  42064. this.prev = null;
  42065. }
  42066. nextToken() {
  42067. this.prev = this.token;
  42068. this.token = this.lexer.getToken();
  42069. }
  42070. accept(type) {
  42071. if (this.token.type === type) {
  42072. this.nextToken();
  42073. return true;
  42074. }
  42075. return false;
  42076. }
  42077. expect(type) {
  42078. if (this.accept(type)) {
  42079. return true;
  42080. }
  42081. throw new _util.FormatError(`Unexpected symbol: found ${this.token.type} expected ${type}.`);
  42082. }
  42083. parse() {
  42084. this.nextToken();
  42085. this.expect(PostScriptTokenTypes.LBRACE);
  42086. this.parseBlock();
  42087. this.expect(PostScriptTokenTypes.RBRACE);
  42088. return this.operators;
  42089. }
  42090. parseBlock() {
  42091. while (true) {
  42092. if (this.accept(PostScriptTokenTypes.NUMBER)) {
  42093. this.operators.push(this.prev.value);
  42094. } else if (this.accept(PostScriptTokenTypes.OPERATOR)) {
  42095. this.operators.push(this.prev.value);
  42096. } else if (this.accept(PostScriptTokenTypes.LBRACE)) {
  42097. this.parseCondition();
  42098. } else {
  42099. return;
  42100. }
  42101. }
  42102. }
  42103. parseCondition() {
  42104. const conditionLocation = this.operators.length;
  42105. this.operators.push(null, null);
  42106. this.parseBlock();
  42107. this.expect(PostScriptTokenTypes.RBRACE);
  42108. if (this.accept(PostScriptTokenTypes.IF)) {
  42109. this.operators[conditionLocation] = this.operators.length;
  42110. this.operators[conditionLocation + 1] = "jz";
  42111. } else if (this.accept(PostScriptTokenTypes.LBRACE)) {
  42112. const jumpLocation = this.operators.length;
  42113. this.operators.push(null, null);
  42114. const endOfTrue = this.operators.length;
  42115. this.parseBlock();
  42116. this.expect(PostScriptTokenTypes.RBRACE);
  42117. this.expect(PostScriptTokenTypes.IFELSE);
  42118. this.operators[jumpLocation] = this.operators.length;
  42119. this.operators[jumpLocation + 1] = "j";
  42120. this.operators[conditionLocation] = endOfTrue;
  42121. this.operators[conditionLocation + 1] = "jz";
  42122. } else {
  42123. throw new _util.FormatError("PS Function: error parsing conditional.");
  42124. }
  42125. }
  42126. }
  42127. exports.PostScriptParser = PostScriptParser;
  42128. const PostScriptTokenTypes = {
  42129. LBRACE: 0,
  42130. RBRACE: 1,
  42131. NUMBER: 2,
  42132. OPERATOR: 3,
  42133. IF: 4,
  42134. IFELSE: 5
  42135. };
  42136. const PostScriptToken = function PostScriptTokenClosure() {
  42137. const opCache = Object.create(null);
  42138. class PostScriptToken {
  42139. constructor(type, value) {
  42140. this.type = type;
  42141. this.value = value;
  42142. }
  42143. static getOperator(op) {
  42144. const opValue = opCache[op];
  42145. if (opValue) {
  42146. return opValue;
  42147. }
  42148. return opCache[op] = new PostScriptToken(PostScriptTokenTypes.OPERATOR, op);
  42149. }
  42150. static get LBRACE() {
  42151. return (0, _util.shadow)(this, "LBRACE", new PostScriptToken(PostScriptTokenTypes.LBRACE, "{"));
  42152. }
  42153. static get RBRACE() {
  42154. return (0, _util.shadow)(this, "RBRACE", new PostScriptToken(PostScriptTokenTypes.RBRACE, "}"));
  42155. }
  42156. static get IF() {
  42157. return (0, _util.shadow)(this, "IF", new PostScriptToken(PostScriptTokenTypes.IF, "IF"));
  42158. }
  42159. static get IFELSE() {
  42160. return (0, _util.shadow)(this, "IFELSE", new PostScriptToken(PostScriptTokenTypes.IFELSE, "IFELSE"));
  42161. }
  42162. }
  42163. return PostScriptToken;
  42164. }();
  42165. class PostScriptLexer {
  42166. constructor(stream) {
  42167. this.stream = stream;
  42168. this.nextChar();
  42169. this.strBuf = [];
  42170. }
  42171. nextChar() {
  42172. return this.currentChar = this.stream.getByte();
  42173. }
  42174. getToken() {
  42175. let comment = false;
  42176. let ch = this.currentChar;
  42177. while (true) {
  42178. if (ch < 0) {
  42179. return _primitives.EOF;
  42180. }
  42181. if (comment) {
  42182. if (ch === 0x0a || ch === 0x0d) {
  42183. comment = false;
  42184. }
  42185. } else if (ch === 0x25) {
  42186. comment = true;
  42187. } else if (!(0, _core_utils.isWhiteSpace)(ch)) {
  42188. break;
  42189. }
  42190. ch = this.nextChar();
  42191. }
  42192. switch (ch | 0) {
  42193. case 0x30:
  42194. case 0x31:
  42195. case 0x32:
  42196. case 0x33:
  42197. case 0x34:
  42198. case 0x35:
  42199. case 0x36:
  42200. case 0x37:
  42201. case 0x38:
  42202. case 0x39:
  42203. case 0x2b:
  42204. case 0x2d:
  42205. case 0x2e:
  42206. return new PostScriptToken(PostScriptTokenTypes.NUMBER, this.getNumber());
  42207. case 0x7b:
  42208. this.nextChar();
  42209. return PostScriptToken.LBRACE;
  42210. case 0x7d:
  42211. this.nextChar();
  42212. return PostScriptToken.RBRACE;
  42213. }
  42214. const strBuf = this.strBuf;
  42215. strBuf.length = 0;
  42216. strBuf[0] = String.fromCharCode(ch);
  42217. while ((ch = this.nextChar()) >= 0 && (ch >= 0x41 && ch <= 0x5a || ch >= 0x61 && ch <= 0x7a)) {
  42218. strBuf.push(String.fromCharCode(ch));
  42219. }
  42220. const str = strBuf.join("");
  42221. switch (str.toLowerCase()) {
  42222. case "if":
  42223. return PostScriptToken.IF;
  42224. case "ifelse":
  42225. return PostScriptToken.IFELSE;
  42226. default:
  42227. return PostScriptToken.getOperator(str);
  42228. }
  42229. }
  42230. getNumber() {
  42231. let ch = this.currentChar;
  42232. const strBuf = this.strBuf;
  42233. strBuf.length = 0;
  42234. strBuf[0] = String.fromCharCode(ch);
  42235. while ((ch = this.nextChar()) >= 0) {
  42236. if (ch >= 0x30 && ch <= 0x39 || ch === 0x2d || ch === 0x2e) {
  42237. strBuf.push(String.fromCharCode(ch));
  42238. } else {
  42239. break;
  42240. }
  42241. }
  42242. const value = parseFloat(strBuf.join(""));
  42243. if (isNaN(value)) {
  42244. throw new _util.FormatError(`Invalid floating point number: ${value}`);
  42245. }
  42246. return value;
  42247. }
  42248. }
  42249. exports.PostScriptLexer = PostScriptLexer;
  42250. /***/ }),
  42251. /* 41 */
  42252. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  42253. Object.defineProperty(exports, "__esModule", ({
  42254. value: true
  42255. }));
  42256. exports.bidi = bidi;
  42257. var _util = __w_pdfjs_require__(2);
  42258. var baseTypes = ["BN", "BN", "BN", "BN", "BN", "BN", "BN", "BN", "BN", "S", "B", "S", "WS", "B", "BN", "BN", "BN", "BN", "BN", "BN", "BN", "BN", "BN", "BN", "BN", "BN", "BN", "BN", "B", "B", "B", "S", "WS", "ON", "ON", "ET", "ET", "ET", "ON", "ON", "ON", "ON", "ON", "ES", "CS", "ES", "CS", "CS", "EN", "EN", "EN", "EN", "EN", "EN", "EN", "EN", "EN", "EN", "CS", "ON", "ON", "ON", "ON", "ON", "ON", "L", "L", "L", "L", "L", "L", "L", "L", "L", "L", "L", "L", "L", "L", "L", "L", "L", "L", "L", "L", "L", "L", "L", "L", "L", "L", "ON", "ON", "ON", "ON", "ON", "ON", "L", "L", "L", "L", "L", "L", "L", "L", "L", "L", "L", "L", "L", "L", "L", "L", "L", "L", "L", "L", "L", "L", "L", "L", "L", "L", "ON", "ON", "ON", "ON", "BN", "BN", "BN", "BN", "BN", "BN", "B", "BN", "BN", "BN", "BN", "BN", "BN", "BN", "BN", "BN", "BN", "BN", "BN", "BN", "BN", "BN", "BN", "BN", "BN", "BN", "BN", "BN", "BN", "BN", "BN", "BN", "BN", "CS", "ON", "ET", "ET", "ET", "ET", "ON", "ON", "ON", "ON", "L", "ON", "ON", "BN", "ON", "ON", "ET", "ET", "EN", "EN", "ON", "L", "ON", "ON", "ON", "EN", "L", "ON", "ON", "ON", "ON", "ON", "L", "L", "L", "L", "L", "L", "L", "L", "L", "L", "L", "L", "L", "L", "L", "L", "L", "L", "L", "L", "L", "L", "L", "ON", "L", "L", "L", "L", "L", "L", "L", "L", "L", "L", "L", "L", "L", "L", "L", "L", "L", "L", "L", "L", "L", "L", "L", "L", "L", "L", "L", "L", "L", "L", "L", "ON", "L", "L", "L", "L", "L", "L", "L", "L"];
  42259. var arabicTypes = ["AN", "AN", "AN", "AN", "AN", "AN", "ON", "ON", "AL", "ET", "ET", "AL", "CS", "AL", "ON", "ON", "NSM", "NSM", "NSM", "NSM", "NSM", "NSM", "NSM", "NSM", "NSM", "NSM", "NSM", "AL", "AL", "", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "NSM", "NSM", "NSM", "NSM", "NSM", "NSM", "NSM", "NSM", "NSM", "NSM", "NSM", "NSM", "NSM", "NSM", "NSM", "NSM", "NSM", "NSM", "NSM", "NSM", "NSM", "AN", "AN", "AN", "AN", "AN", "AN", "AN", "AN", "AN", "AN", "ET", "AN", "AN", "AL", "AL", "AL", "NSM", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "NSM", "NSM", "NSM", "NSM", "NSM", "NSM", "NSM", "AN", "ON", "NSM", "NSM", "NSM", "NSM", "NSM", "NSM", "AL", "AL", "NSM", "NSM", "ON", "NSM", "NSM", "NSM", "NSM", "AL", "AL", "EN", "EN", "EN", "EN", "EN", "EN", "EN", "EN", "EN", "EN", "AL", "AL", "AL", "AL", "AL", "AL"];
  42260. function isOdd(i) {
  42261. return (i & 1) !== 0;
  42262. }
  42263. function isEven(i) {
  42264. return (i & 1) === 0;
  42265. }
  42266. function findUnequal(arr, start, value) {
  42267. for (var j = start, jj = arr.length; j < jj; ++j) {
  42268. if (arr[j] !== value) {
  42269. return j;
  42270. }
  42271. }
  42272. return j;
  42273. }
  42274. function setValues(arr, start, end, value) {
  42275. for (var j = start; j < end; ++j) {
  42276. arr[j] = value;
  42277. }
  42278. }
  42279. function reverseValues(arr, start, end) {
  42280. for (var i = start, j = end - 1; i < j; ++i, --j) {
  42281. var temp = arr[i];
  42282. arr[i] = arr[j];
  42283. arr[j] = temp;
  42284. }
  42285. }
  42286. function createBidiText(str, isLTR, vertical = false) {
  42287. let dir = "ltr";
  42288. if (vertical) {
  42289. dir = "ttb";
  42290. } else if (!isLTR) {
  42291. dir = "rtl";
  42292. }
  42293. return {
  42294. str,
  42295. dir
  42296. };
  42297. }
  42298. var chars = [];
  42299. var types = [];
  42300. function bidi(str, startLevel, vertical) {
  42301. var isLTR = true;
  42302. var strLength = str.length;
  42303. if (strLength === 0 || vertical) {
  42304. return createBidiText(str, isLTR, vertical);
  42305. }
  42306. chars.length = strLength;
  42307. types.length = strLength;
  42308. var numBidi = 0;
  42309. var i, ii;
  42310. for (i = 0; i < strLength; ++i) {
  42311. chars[i] = str.charAt(i);
  42312. var charCode = str.charCodeAt(i);
  42313. var charType = "L";
  42314. if (charCode <= 0x00ff) {
  42315. charType = baseTypes[charCode];
  42316. } else if (0x0590 <= charCode && charCode <= 0x05f4) {
  42317. charType = "R";
  42318. } else if (0x0600 <= charCode && charCode <= 0x06ff) {
  42319. charType = arabicTypes[charCode & 0xff];
  42320. if (!charType) {
  42321. (0, _util.warn)("Bidi: invalid Unicode character " + charCode.toString(16));
  42322. }
  42323. } else if (0x0700 <= charCode && charCode <= 0x08ac) {
  42324. charType = "AL";
  42325. }
  42326. if (charType === "R" || charType === "AL" || charType === "AN") {
  42327. numBidi++;
  42328. }
  42329. types[i] = charType;
  42330. }
  42331. if (numBidi === 0) {
  42332. isLTR = true;
  42333. return createBidiText(str, isLTR);
  42334. }
  42335. if (startLevel === -1) {
  42336. if (numBidi / strLength < 0.3) {
  42337. isLTR = true;
  42338. startLevel = 0;
  42339. } else {
  42340. isLTR = false;
  42341. startLevel = 1;
  42342. }
  42343. }
  42344. var levels = [];
  42345. for (i = 0; i < strLength; ++i) {
  42346. levels[i] = startLevel;
  42347. }
  42348. var e = isOdd(startLevel) ? "R" : "L";
  42349. var sor = e;
  42350. var eor = sor;
  42351. var lastType = sor;
  42352. for (i = 0; i < strLength; ++i) {
  42353. if (types[i] === "NSM") {
  42354. types[i] = lastType;
  42355. } else {
  42356. lastType = types[i];
  42357. }
  42358. }
  42359. lastType = sor;
  42360. var t;
  42361. for (i = 0; i < strLength; ++i) {
  42362. t = types[i];
  42363. if (t === "EN") {
  42364. types[i] = lastType === "AL" ? "AN" : "EN";
  42365. } else if (t === "R" || t === "L" || t === "AL") {
  42366. lastType = t;
  42367. }
  42368. }
  42369. for (i = 0; i < strLength; ++i) {
  42370. t = types[i];
  42371. if (t === "AL") {
  42372. types[i] = "R";
  42373. }
  42374. }
  42375. for (i = 1; i < strLength - 1; ++i) {
  42376. if (types[i] === "ES" && types[i - 1] === "EN" && types[i + 1] === "EN") {
  42377. types[i] = "EN";
  42378. }
  42379. if (types[i] === "CS" && (types[i - 1] === "EN" || types[i - 1] === "AN") && types[i + 1] === types[i - 1]) {
  42380. types[i] = types[i - 1];
  42381. }
  42382. }
  42383. for (i = 0; i < strLength; ++i) {
  42384. if (types[i] === "EN") {
  42385. var j;
  42386. for (j = i - 1; j >= 0; --j) {
  42387. if (types[j] !== "ET") {
  42388. break;
  42389. }
  42390. types[j] = "EN";
  42391. }
  42392. for (j = i + 1; j < strLength; ++j) {
  42393. if (types[j] !== "ET") {
  42394. break;
  42395. }
  42396. types[j] = "EN";
  42397. }
  42398. }
  42399. }
  42400. for (i = 0; i < strLength; ++i) {
  42401. t = types[i];
  42402. if (t === "WS" || t === "ES" || t === "ET" || t === "CS") {
  42403. types[i] = "ON";
  42404. }
  42405. }
  42406. lastType = sor;
  42407. for (i = 0; i < strLength; ++i) {
  42408. t = types[i];
  42409. if (t === "EN") {
  42410. types[i] = lastType === "L" ? "L" : "EN";
  42411. } else if (t === "R" || t === "L") {
  42412. lastType = t;
  42413. }
  42414. }
  42415. for (i = 0; i < strLength; ++i) {
  42416. if (types[i] === "ON") {
  42417. var end = findUnequal(types, i + 1, "ON");
  42418. var before = sor;
  42419. if (i > 0) {
  42420. before = types[i - 1];
  42421. }
  42422. var after = eor;
  42423. if (end + 1 < strLength) {
  42424. after = types[end + 1];
  42425. }
  42426. if (before !== "L") {
  42427. before = "R";
  42428. }
  42429. if (after !== "L") {
  42430. after = "R";
  42431. }
  42432. if (before === after) {
  42433. setValues(types, i, end, before);
  42434. }
  42435. i = end - 1;
  42436. }
  42437. }
  42438. for (i = 0; i < strLength; ++i) {
  42439. if (types[i] === "ON") {
  42440. types[i] = e;
  42441. }
  42442. }
  42443. for (i = 0; i < strLength; ++i) {
  42444. t = types[i];
  42445. if (isEven(levels[i])) {
  42446. if (t === "R") {
  42447. levels[i] += 1;
  42448. } else if (t === "AN" || t === "EN") {
  42449. levels[i] += 2;
  42450. }
  42451. } else {
  42452. if (t === "L" || t === "AN" || t === "EN") {
  42453. levels[i] += 1;
  42454. }
  42455. }
  42456. }
  42457. var highestLevel = -1;
  42458. var lowestOddLevel = 99;
  42459. var level;
  42460. for (i = 0, ii = levels.length; i < ii; ++i) {
  42461. level = levels[i];
  42462. if (highestLevel < level) {
  42463. highestLevel = level;
  42464. }
  42465. if (lowestOddLevel > level && isOdd(level)) {
  42466. lowestOddLevel = level;
  42467. }
  42468. }
  42469. for (level = highestLevel; level >= lowestOddLevel; --level) {
  42470. var start = -1;
  42471. for (i = 0, ii = levels.length; i < ii; ++i) {
  42472. if (levels[i] < level) {
  42473. if (start >= 0) {
  42474. reverseValues(chars, start, i);
  42475. start = -1;
  42476. }
  42477. } else if (start < 0) {
  42478. start = i;
  42479. }
  42480. }
  42481. if (start >= 0) {
  42482. reverseValues(chars, start, levels.length);
  42483. }
  42484. }
  42485. for (i = 0, ii = chars.length; i < ii; ++i) {
  42486. var ch = chars[i];
  42487. if (ch === "<" || ch === ">") {
  42488. chars[i] = "";
  42489. }
  42490. }
  42491. return createBidiText(chars.join(""), isLTR);
  42492. }
  42493. /***/ }),
  42494. /* 42 */
  42495. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  42496. Object.defineProperty(exports, "__esModule", ({
  42497. value: true
  42498. }));
  42499. exports.getMetrics = void 0;
  42500. var _core_utils = __w_pdfjs_require__(8);
  42501. var getMetrics = (0, _core_utils.getLookupTableFactory)(function (t) {
  42502. t.Courier = 600;
  42503. t["Courier-Bold"] = 600;
  42504. t["Courier-BoldOblique"] = 600;
  42505. t["Courier-Oblique"] = 600;
  42506. t.Helvetica = (0, _core_utils.getLookupTableFactory)(function (t) {
  42507. t.space = 278;
  42508. t.exclam = 278;
  42509. t.quotedbl = 355;
  42510. t.numbersign = 556;
  42511. t.dollar = 556;
  42512. t.percent = 889;
  42513. t.ampersand = 667;
  42514. t.quoteright = 222;
  42515. t.parenleft = 333;
  42516. t.parenright = 333;
  42517. t.asterisk = 389;
  42518. t.plus = 584;
  42519. t.comma = 278;
  42520. t.hyphen = 333;
  42521. t.period = 278;
  42522. t.slash = 278;
  42523. t.zero = 556;
  42524. t.one = 556;
  42525. t.two = 556;
  42526. t.three = 556;
  42527. t.four = 556;
  42528. t.five = 556;
  42529. t.six = 556;
  42530. t.seven = 556;
  42531. t.eight = 556;
  42532. t.nine = 556;
  42533. t.colon = 278;
  42534. t.semicolon = 278;
  42535. t.less = 584;
  42536. t.equal = 584;
  42537. t.greater = 584;
  42538. t.question = 556;
  42539. t.at = 1015;
  42540. t.A = 667;
  42541. t.B = 667;
  42542. t.C = 722;
  42543. t.D = 722;
  42544. t.E = 667;
  42545. t.F = 611;
  42546. t.G = 778;
  42547. t.H = 722;
  42548. t.I = 278;
  42549. t.J = 500;
  42550. t.K = 667;
  42551. t.L = 556;
  42552. t.M = 833;
  42553. t.N = 722;
  42554. t.O = 778;
  42555. t.P = 667;
  42556. t.Q = 778;
  42557. t.R = 722;
  42558. t.S = 667;
  42559. t.T = 611;
  42560. t.U = 722;
  42561. t.V = 667;
  42562. t.W = 944;
  42563. t.X = 667;
  42564. t.Y = 667;
  42565. t.Z = 611;
  42566. t.bracketleft = 278;
  42567. t.backslash = 278;
  42568. t.bracketright = 278;
  42569. t.asciicircum = 469;
  42570. t.underscore = 556;
  42571. t.quoteleft = 222;
  42572. t.a = 556;
  42573. t.b = 556;
  42574. t.c = 500;
  42575. t.d = 556;
  42576. t.e = 556;
  42577. t.f = 278;
  42578. t.g = 556;
  42579. t.h = 556;
  42580. t.i = 222;
  42581. t.j = 222;
  42582. t.k = 500;
  42583. t.l = 222;
  42584. t.m = 833;
  42585. t.n = 556;
  42586. t.o = 556;
  42587. t.p = 556;
  42588. t.q = 556;
  42589. t.r = 333;
  42590. t.s = 500;
  42591. t.t = 278;
  42592. t.u = 556;
  42593. t.v = 500;
  42594. t.w = 722;
  42595. t.x = 500;
  42596. t.y = 500;
  42597. t.z = 500;
  42598. t.braceleft = 334;
  42599. t.bar = 260;
  42600. t.braceright = 334;
  42601. t.asciitilde = 584;
  42602. t.exclamdown = 333;
  42603. t.cent = 556;
  42604. t.sterling = 556;
  42605. t.fraction = 167;
  42606. t.yen = 556;
  42607. t.florin = 556;
  42608. t.section = 556;
  42609. t.currency = 556;
  42610. t.quotesingle = 191;
  42611. t.quotedblleft = 333;
  42612. t.guillemotleft = 556;
  42613. t.guilsinglleft = 333;
  42614. t.guilsinglright = 333;
  42615. t.fi = 500;
  42616. t.fl = 500;
  42617. t.endash = 556;
  42618. t.dagger = 556;
  42619. t.daggerdbl = 556;
  42620. t.periodcentered = 278;
  42621. t.paragraph = 537;
  42622. t.bullet = 350;
  42623. t.quotesinglbase = 222;
  42624. t.quotedblbase = 333;
  42625. t.quotedblright = 333;
  42626. t.guillemotright = 556;
  42627. t.ellipsis = 1000;
  42628. t.perthousand = 1000;
  42629. t.questiondown = 611;
  42630. t.grave = 333;
  42631. t.acute = 333;
  42632. t.circumflex = 333;
  42633. t.tilde = 333;
  42634. t.macron = 333;
  42635. t.breve = 333;
  42636. t.dotaccent = 333;
  42637. t.dieresis = 333;
  42638. t.ring = 333;
  42639. t.cedilla = 333;
  42640. t.hungarumlaut = 333;
  42641. t.ogonek = 333;
  42642. t.caron = 333;
  42643. t.emdash = 1000;
  42644. t.AE = 1000;
  42645. t.ordfeminine = 370;
  42646. t.Lslash = 556;
  42647. t.Oslash = 778;
  42648. t.OE = 1000;
  42649. t.ordmasculine = 365;
  42650. t.ae = 889;
  42651. t.dotlessi = 278;
  42652. t.lslash = 222;
  42653. t.oslash = 611;
  42654. t.oe = 944;
  42655. t.germandbls = 611;
  42656. t.Idieresis = 278;
  42657. t.eacute = 556;
  42658. t.abreve = 556;
  42659. t.uhungarumlaut = 556;
  42660. t.ecaron = 556;
  42661. t.Ydieresis = 667;
  42662. t.divide = 584;
  42663. t.Yacute = 667;
  42664. t.Acircumflex = 667;
  42665. t.aacute = 556;
  42666. t.Ucircumflex = 722;
  42667. t.yacute = 500;
  42668. t.scommaaccent = 500;
  42669. t.ecircumflex = 556;
  42670. t.Uring = 722;
  42671. t.Udieresis = 722;
  42672. t.aogonek = 556;
  42673. t.Uacute = 722;
  42674. t.uogonek = 556;
  42675. t.Edieresis = 667;
  42676. t.Dcroat = 722;
  42677. t.commaaccent = 250;
  42678. t.copyright = 737;
  42679. t.Emacron = 667;
  42680. t.ccaron = 500;
  42681. t.aring = 556;
  42682. t.Ncommaaccent = 722;
  42683. t.lacute = 222;
  42684. t.agrave = 556;
  42685. t.Tcommaaccent = 611;
  42686. t.Cacute = 722;
  42687. t.atilde = 556;
  42688. t.Edotaccent = 667;
  42689. t.scaron = 500;
  42690. t.scedilla = 500;
  42691. t.iacute = 278;
  42692. t.lozenge = 471;
  42693. t.Rcaron = 722;
  42694. t.Gcommaaccent = 778;
  42695. t.ucircumflex = 556;
  42696. t.acircumflex = 556;
  42697. t.Amacron = 667;
  42698. t.rcaron = 333;
  42699. t.ccedilla = 500;
  42700. t.Zdotaccent = 611;
  42701. t.Thorn = 667;
  42702. t.Omacron = 778;
  42703. t.Racute = 722;
  42704. t.Sacute = 667;
  42705. t.dcaron = 643;
  42706. t.Umacron = 722;
  42707. t.uring = 556;
  42708. t.threesuperior = 333;
  42709. t.Ograve = 778;
  42710. t.Agrave = 667;
  42711. t.Abreve = 667;
  42712. t.multiply = 584;
  42713. t.uacute = 556;
  42714. t.Tcaron = 611;
  42715. t.partialdiff = 476;
  42716. t.ydieresis = 500;
  42717. t.Nacute = 722;
  42718. t.icircumflex = 278;
  42719. t.Ecircumflex = 667;
  42720. t.adieresis = 556;
  42721. t.edieresis = 556;
  42722. t.cacute = 500;
  42723. t.nacute = 556;
  42724. t.umacron = 556;
  42725. t.Ncaron = 722;
  42726. t.Iacute = 278;
  42727. t.plusminus = 584;
  42728. t.brokenbar = 260;
  42729. t.registered = 737;
  42730. t.Gbreve = 778;
  42731. t.Idotaccent = 278;
  42732. t.summation = 600;
  42733. t.Egrave = 667;
  42734. t.racute = 333;
  42735. t.omacron = 556;
  42736. t.Zacute = 611;
  42737. t.Zcaron = 611;
  42738. t.greaterequal = 549;
  42739. t.Eth = 722;
  42740. t.Ccedilla = 722;
  42741. t.lcommaaccent = 222;
  42742. t.tcaron = 317;
  42743. t.eogonek = 556;
  42744. t.Uogonek = 722;
  42745. t.Aacute = 667;
  42746. t.Adieresis = 667;
  42747. t.egrave = 556;
  42748. t.zacute = 500;
  42749. t.iogonek = 222;
  42750. t.Oacute = 778;
  42751. t.oacute = 556;
  42752. t.amacron = 556;
  42753. t.sacute = 500;
  42754. t.idieresis = 278;
  42755. t.Ocircumflex = 778;
  42756. t.Ugrave = 722;
  42757. t.Delta = 612;
  42758. t.thorn = 556;
  42759. t.twosuperior = 333;
  42760. t.Odieresis = 778;
  42761. t.mu = 556;
  42762. t.igrave = 278;
  42763. t.ohungarumlaut = 556;
  42764. t.Eogonek = 667;
  42765. t.dcroat = 556;
  42766. t.threequarters = 834;
  42767. t.Scedilla = 667;
  42768. t.lcaron = 299;
  42769. t.Kcommaaccent = 667;
  42770. t.Lacute = 556;
  42771. t.trademark = 1000;
  42772. t.edotaccent = 556;
  42773. t.Igrave = 278;
  42774. t.Imacron = 278;
  42775. t.Lcaron = 556;
  42776. t.onehalf = 834;
  42777. t.lessequal = 549;
  42778. t.ocircumflex = 556;
  42779. t.ntilde = 556;
  42780. t.Uhungarumlaut = 722;
  42781. t.Eacute = 667;
  42782. t.emacron = 556;
  42783. t.gbreve = 556;
  42784. t.onequarter = 834;
  42785. t.Scaron = 667;
  42786. t.Scommaaccent = 667;
  42787. t.Ohungarumlaut = 778;
  42788. t.degree = 400;
  42789. t.ograve = 556;
  42790. t.Ccaron = 722;
  42791. t.ugrave = 556;
  42792. t.radical = 453;
  42793. t.Dcaron = 722;
  42794. t.rcommaaccent = 333;
  42795. t.Ntilde = 722;
  42796. t.otilde = 556;
  42797. t.Rcommaaccent = 722;
  42798. t.Lcommaaccent = 556;
  42799. t.Atilde = 667;
  42800. t.Aogonek = 667;
  42801. t.Aring = 667;
  42802. t.Otilde = 778;
  42803. t.zdotaccent = 500;
  42804. t.Ecaron = 667;
  42805. t.Iogonek = 278;
  42806. t.kcommaaccent = 500;
  42807. t.minus = 584;
  42808. t.Icircumflex = 278;
  42809. t.ncaron = 556;
  42810. t.tcommaaccent = 278;
  42811. t.logicalnot = 584;
  42812. t.odieresis = 556;
  42813. t.udieresis = 556;
  42814. t.notequal = 549;
  42815. t.gcommaaccent = 556;
  42816. t.eth = 556;
  42817. t.zcaron = 500;
  42818. t.ncommaaccent = 556;
  42819. t.onesuperior = 333;
  42820. t.imacron = 278;
  42821. t.Euro = 556;
  42822. });
  42823. t["Helvetica-Bold"] = (0, _core_utils.getLookupTableFactory)(function (t) {
  42824. t.space = 278;
  42825. t.exclam = 333;
  42826. t.quotedbl = 474;
  42827. t.numbersign = 556;
  42828. t.dollar = 556;
  42829. t.percent = 889;
  42830. t.ampersand = 722;
  42831. t.quoteright = 278;
  42832. t.parenleft = 333;
  42833. t.parenright = 333;
  42834. t.asterisk = 389;
  42835. t.plus = 584;
  42836. t.comma = 278;
  42837. t.hyphen = 333;
  42838. t.period = 278;
  42839. t.slash = 278;
  42840. t.zero = 556;
  42841. t.one = 556;
  42842. t.two = 556;
  42843. t.three = 556;
  42844. t.four = 556;
  42845. t.five = 556;
  42846. t.six = 556;
  42847. t.seven = 556;
  42848. t.eight = 556;
  42849. t.nine = 556;
  42850. t.colon = 333;
  42851. t.semicolon = 333;
  42852. t.less = 584;
  42853. t.equal = 584;
  42854. t.greater = 584;
  42855. t.question = 611;
  42856. t.at = 975;
  42857. t.A = 722;
  42858. t.B = 722;
  42859. t.C = 722;
  42860. t.D = 722;
  42861. t.E = 667;
  42862. t.F = 611;
  42863. t.G = 778;
  42864. t.H = 722;
  42865. t.I = 278;
  42866. t.J = 556;
  42867. t.K = 722;
  42868. t.L = 611;
  42869. t.M = 833;
  42870. t.N = 722;
  42871. t.O = 778;
  42872. t.P = 667;
  42873. t.Q = 778;
  42874. t.R = 722;
  42875. t.S = 667;
  42876. t.T = 611;
  42877. t.U = 722;
  42878. t.V = 667;
  42879. t.W = 944;
  42880. t.X = 667;
  42881. t.Y = 667;
  42882. t.Z = 611;
  42883. t.bracketleft = 333;
  42884. t.backslash = 278;
  42885. t.bracketright = 333;
  42886. t.asciicircum = 584;
  42887. t.underscore = 556;
  42888. t.quoteleft = 278;
  42889. t.a = 556;
  42890. t.b = 611;
  42891. t.c = 556;
  42892. t.d = 611;
  42893. t.e = 556;
  42894. t.f = 333;
  42895. t.g = 611;
  42896. t.h = 611;
  42897. t.i = 278;
  42898. t.j = 278;
  42899. t.k = 556;
  42900. t.l = 278;
  42901. t.m = 889;
  42902. t.n = 611;
  42903. t.o = 611;
  42904. t.p = 611;
  42905. t.q = 611;
  42906. t.r = 389;
  42907. t.s = 556;
  42908. t.t = 333;
  42909. t.u = 611;
  42910. t.v = 556;
  42911. t.w = 778;
  42912. t.x = 556;
  42913. t.y = 556;
  42914. t.z = 500;
  42915. t.braceleft = 389;
  42916. t.bar = 280;
  42917. t.braceright = 389;
  42918. t.asciitilde = 584;
  42919. t.exclamdown = 333;
  42920. t.cent = 556;
  42921. t.sterling = 556;
  42922. t.fraction = 167;
  42923. t.yen = 556;
  42924. t.florin = 556;
  42925. t.section = 556;
  42926. t.currency = 556;
  42927. t.quotesingle = 238;
  42928. t.quotedblleft = 500;
  42929. t.guillemotleft = 556;
  42930. t.guilsinglleft = 333;
  42931. t.guilsinglright = 333;
  42932. t.fi = 611;
  42933. t.fl = 611;
  42934. t.endash = 556;
  42935. t.dagger = 556;
  42936. t.daggerdbl = 556;
  42937. t.periodcentered = 278;
  42938. t.paragraph = 556;
  42939. t.bullet = 350;
  42940. t.quotesinglbase = 278;
  42941. t.quotedblbase = 500;
  42942. t.quotedblright = 500;
  42943. t.guillemotright = 556;
  42944. t.ellipsis = 1000;
  42945. t.perthousand = 1000;
  42946. t.questiondown = 611;
  42947. t.grave = 333;
  42948. t.acute = 333;
  42949. t.circumflex = 333;
  42950. t.tilde = 333;
  42951. t.macron = 333;
  42952. t.breve = 333;
  42953. t.dotaccent = 333;
  42954. t.dieresis = 333;
  42955. t.ring = 333;
  42956. t.cedilla = 333;
  42957. t.hungarumlaut = 333;
  42958. t.ogonek = 333;
  42959. t.caron = 333;
  42960. t.emdash = 1000;
  42961. t.AE = 1000;
  42962. t.ordfeminine = 370;
  42963. t.Lslash = 611;
  42964. t.Oslash = 778;
  42965. t.OE = 1000;
  42966. t.ordmasculine = 365;
  42967. t.ae = 889;
  42968. t.dotlessi = 278;
  42969. t.lslash = 278;
  42970. t.oslash = 611;
  42971. t.oe = 944;
  42972. t.germandbls = 611;
  42973. t.Idieresis = 278;
  42974. t.eacute = 556;
  42975. t.abreve = 556;
  42976. t.uhungarumlaut = 611;
  42977. t.ecaron = 556;
  42978. t.Ydieresis = 667;
  42979. t.divide = 584;
  42980. t.Yacute = 667;
  42981. t.Acircumflex = 722;
  42982. t.aacute = 556;
  42983. t.Ucircumflex = 722;
  42984. t.yacute = 556;
  42985. t.scommaaccent = 556;
  42986. t.ecircumflex = 556;
  42987. t.Uring = 722;
  42988. t.Udieresis = 722;
  42989. t.aogonek = 556;
  42990. t.Uacute = 722;
  42991. t.uogonek = 611;
  42992. t.Edieresis = 667;
  42993. t.Dcroat = 722;
  42994. t.commaaccent = 250;
  42995. t.copyright = 737;
  42996. t.Emacron = 667;
  42997. t.ccaron = 556;
  42998. t.aring = 556;
  42999. t.Ncommaaccent = 722;
  43000. t.lacute = 278;
  43001. t.agrave = 556;
  43002. t.Tcommaaccent = 611;
  43003. t.Cacute = 722;
  43004. t.atilde = 556;
  43005. t.Edotaccent = 667;
  43006. t.scaron = 556;
  43007. t.scedilla = 556;
  43008. t.iacute = 278;
  43009. t.lozenge = 494;
  43010. t.Rcaron = 722;
  43011. t.Gcommaaccent = 778;
  43012. t.ucircumflex = 611;
  43013. t.acircumflex = 556;
  43014. t.Amacron = 722;
  43015. t.rcaron = 389;
  43016. t.ccedilla = 556;
  43017. t.Zdotaccent = 611;
  43018. t.Thorn = 667;
  43019. t.Omacron = 778;
  43020. t.Racute = 722;
  43021. t.Sacute = 667;
  43022. t.dcaron = 743;
  43023. t.Umacron = 722;
  43024. t.uring = 611;
  43025. t.threesuperior = 333;
  43026. t.Ograve = 778;
  43027. t.Agrave = 722;
  43028. t.Abreve = 722;
  43029. t.multiply = 584;
  43030. t.uacute = 611;
  43031. t.Tcaron = 611;
  43032. t.partialdiff = 494;
  43033. t.ydieresis = 556;
  43034. t.Nacute = 722;
  43035. t.icircumflex = 278;
  43036. t.Ecircumflex = 667;
  43037. t.adieresis = 556;
  43038. t.edieresis = 556;
  43039. t.cacute = 556;
  43040. t.nacute = 611;
  43041. t.umacron = 611;
  43042. t.Ncaron = 722;
  43043. t.Iacute = 278;
  43044. t.plusminus = 584;
  43045. t.brokenbar = 280;
  43046. t.registered = 737;
  43047. t.Gbreve = 778;
  43048. t.Idotaccent = 278;
  43049. t.summation = 600;
  43050. t.Egrave = 667;
  43051. t.racute = 389;
  43052. t.omacron = 611;
  43053. t.Zacute = 611;
  43054. t.Zcaron = 611;
  43055. t.greaterequal = 549;
  43056. t.Eth = 722;
  43057. t.Ccedilla = 722;
  43058. t.lcommaaccent = 278;
  43059. t.tcaron = 389;
  43060. t.eogonek = 556;
  43061. t.Uogonek = 722;
  43062. t.Aacute = 722;
  43063. t.Adieresis = 722;
  43064. t.egrave = 556;
  43065. t.zacute = 500;
  43066. t.iogonek = 278;
  43067. t.Oacute = 778;
  43068. t.oacute = 611;
  43069. t.amacron = 556;
  43070. t.sacute = 556;
  43071. t.idieresis = 278;
  43072. t.Ocircumflex = 778;
  43073. t.Ugrave = 722;
  43074. t.Delta = 612;
  43075. t.thorn = 611;
  43076. t.twosuperior = 333;
  43077. t.Odieresis = 778;
  43078. t.mu = 611;
  43079. t.igrave = 278;
  43080. t.ohungarumlaut = 611;
  43081. t.Eogonek = 667;
  43082. t.dcroat = 611;
  43083. t.threequarters = 834;
  43084. t.Scedilla = 667;
  43085. t.lcaron = 400;
  43086. t.Kcommaaccent = 722;
  43087. t.Lacute = 611;
  43088. t.trademark = 1000;
  43089. t.edotaccent = 556;
  43090. t.Igrave = 278;
  43091. t.Imacron = 278;
  43092. t.Lcaron = 611;
  43093. t.onehalf = 834;
  43094. t.lessequal = 549;
  43095. t.ocircumflex = 611;
  43096. t.ntilde = 611;
  43097. t.Uhungarumlaut = 722;
  43098. t.Eacute = 667;
  43099. t.emacron = 556;
  43100. t.gbreve = 611;
  43101. t.onequarter = 834;
  43102. t.Scaron = 667;
  43103. t.Scommaaccent = 667;
  43104. t.Ohungarumlaut = 778;
  43105. t.degree = 400;
  43106. t.ograve = 611;
  43107. t.Ccaron = 722;
  43108. t.ugrave = 611;
  43109. t.radical = 549;
  43110. t.Dcaron = 722;
  43111. t.rcommaaccent = 389;
  43112. t.Ntilde = 722;
  43113. t.otilde = 611;
  43114. t.Rcommaaccent = 722;
  43115. t.Lcommaaccent = 611;
  43116. t.Atilde = 722;
  43117. t.Aogonek = 722;
  43118. t.Aring = 722;
  43119. t.Otilde = 778;
  43120. t.zdotaccent = 500;
  43121. t.Ecaron = 667;
  43122. t.Iogonek = 278;
  43123. t.kcommaaccent = 556;
  43124. t.minus = 584;
  43125. t.Icircumflex = 278;
  43126. t.ncaron = 611;
  43127. t.tcommaaccent = 333;
  43128. t.logicalnot = 584;
  43129. t.odieresis = 611;
  43130. t.udieresis = 611;
  43131. t.notequal = 549;
  43132. t.gcommaaccent = 611;
  43133. t.eth = 611;
  43134. t.zcaron = 500;
  43135. t.ncommaaccent = 611;
  43136. t.onesuperior = 333;
  43137. t.imacron = 278;
  43138. t.Euro = 556;
  43139. });
  43140. t["Helvetica-BoldOblique"] = (0, _core_utils.getLookupTableFactory)(function (t) {
  43141. t.space = 278;
  43142. t.exclam = 333;
  43143. t.quotedbl = 474;
  43144. t.numbersign = 556;
  43145. t.dollar = 556;
  43146. t.percent = 889;
  43147. t.ampersand = 722;
  43148. t.quoteright = 278;
  43149. t.parenleft = 333;
  43150. t.parenright = 333;
  43151. t.asterisk = 389;
  43152. t.plus = 584;
  43153. t.comma = 278;
  43154. t.hyphen = 333;
  43155. t.period = 278;
  43156. t.slash = 278;
  43157. t.zero = 556;
  43158. t.one = 556;
  43159. t.two = 556;
  43160. t.three = 556;
  43161. t.four = 556;
  43162. t.five = 556;
  43163. t.six = 556;
  43164. t.seven = 556;
  43165. t.eight = 556;
  43166. t.nine = 556;
  43167. t.colon = 333;
  43168. t.semicolon = 333;
  43169. t.less = 584;
  43170. t.equal = 584;
  43171. t.greater = 584;
  43172. t.question = 611;
  43173. t.at = 975;
  43174. t.A = 722;
  43175. t.B = 722;
  43176. t.C = 722;
  43177. t.D = 722;
  43178. t.E = 667;
  43179. t.F = 611;
  43180. t.G = 778;
  43181. t.H = 722;
  43182. t.I = 278;
  43183. t.J = 556;
  43184. t.K = 722;
  43185. t.L = 611;
  43186. t.M = 833;
  43187. t.N = 722;
  43188. t.O = 778;
  43189. t.P = 667;
  43190. t.Q = 778;
  43191. t.R = 722;
  43192. t.S = 667;
  43193. t.T = 611;
  43194. t.U = 722;
  43195. t.V = 667;
  43196. t.W = 944;
  43197. t.X = 667;
  43198. t.Y = 667;
  43199. t.Z = 611;
  43200. t.bracketleft = 333;
  43201. t.backslash = 278;
  43202. t.bracketright = 333;
  43203. t.asciicircum = 584;
  43204. t.underscore = 556;
  43205. t.quoteleft = 278;
  43206. t.a = 556;
  43207. t.b = 611;
  43208. t.c = 556;
  43209. t.d = 611;
  43210. t.e = 556;
  43211. t.f = 333;
  43212. t.g = 611;
  43213. t.h = 611;
  43214. t.i = 278;
  43215. t.j = 278;
  43216. t.k = 556;
  43217. t.l = 278;
  43218. t.m = 889;
  43219. t.n = 611;
  43220. t.o = 611;
  43221. t.p = 611;
  43222. t.q = 611;
  43223. t.r = 389;
  43224. t.s = 556;
  43225. t.t = 333;
  43226. t.u = 611;
  43227. t.v = 556;
  43228. t.w = 778;
  43229. t.x = 556;
  43230. t.y = 556;
  43231. t.z = 500;
  43232. t.braceleft = 389;
  43233. t.bar = 280;
  43234. t.braceright = 389;
  43235. t.asciitilde = 584;
  43236. t.exclamdown = 333;
  43237. t.cent = 556;
  43238. t.sterling = 556;
  43239. t.fraction = 167;
  43240. t.yen = 556;
  43241. t.florin = 556;
  43242. t.section = 556;
  43243. t.currency = 556;
  43244. t.quotesingle = 238;
  43245. t.quotedblleft = 500;
  43246. t.guillemotleft = 556;
  43247. t.guilsinglleft = 333;
  43248. t.guilsinglright = 333;
  43249. t.fi = 611;
  43250. t.fl = 611;
  43251. t.endash = 556;
  43252. t.dagger = 556;
  43253. t.daggerdbl = 556;
  43254. t.periodcentered = 278;
  43255. t.paragraph = 556;
  43256. t.bullet = 350;
  43257. t.quotesinglbase = 278;
  43258. t.quotedblbase = 500;
  43259. t.quotedblright = 500;
  43260. t.guillemotright = 556;
  43261. t.ellipsis = 1000;
  43262. t.perthousand = 1000;
  43263. t.questiondown = 611;
  43264. t.grave = 333;
  43265. t.acute = 333;
  43266. t.circumflex = 333;
  43267. t.tilde = 333;
  43268. t.macron = 333;
  43269. t.breve = 333;
  43270. t.dotaccent = 333;
  43271. t.dieresis = 333;
  43272. t.ring = 333;
  43273. t.cedilla = 333;
  43274. t.hungarumlaut = 333;
  43275. t.ogonek = 333;
  43276. t.caron = 333;
  43277. t.emdash = 1000;
  43278. t.AE = 1000;
  43279. t.ordfeminine = 370;
  43280. t.Lslash = 611;
  43281. t.Oslash = 778;
  43282. t.OE = 1000;
  43283. t.ordmasculine = 365;
  43284. t.ae = 889;
  43285. t.dotlessi = 278;
  43286. t.lslash = 278;
  43287. t.oslash = 611;
  43288. t.oe = 944;
  43289. t.germandbls = 611;
  43290. t.Idieresis = 278;
  43291. t.eacute = 556;
  43292. t.abreve = 556;
  43293. t.uhungarumlaut = 611;
  43294. t.ecaron = 556;
  43295. t.Ydieresis = 667;
  43296. t.divide = 584;
  43297. t.Yacute = 667;
  43298. t.Acircumflex = 722;
  43299. t.aacute = 556;
  43300. t.Ucircumflex = 722;
  43301. t.yacute = 556;
  43302. t.scommaaccent = 556;
  43303. t.ecircumflex = 556;
  43304. t.Uring = 722;
  43305. t.Udieresis = 722;
  43306. t.aogonek = 556;
  43307. t.Uacute = 722;
  43308. t.uogonek = 611;
  43309. t.Edieresis = 667;
  43310. t.Dcroat = 722;
  43311. t.commaaccent = 250;
  43312. t.copyright = 737;
  43313. t.Emacron = 667;
  43314. t.ccaron = 556;
  43315. t.aring = 556;
  43316. t.Ncommaaccent = 722;
  43317. t.lacute = 278;
  43318. t.agrave = 556;
  43319. t.Tcommaaccent = 611;
  43320. t.Cacute = 722;
  43321. t.atilde = 556;
  43322. t.Edotaccent = 667;
  43323. t.scaron = 556;
  43324. t.scedilla = 556;
  43325. t.iacute = 278;
  43326. t.lozenge = 494;
  43327. t.Rcaron = 722;
  43328. t.Gcommaaccent = 778;
  43329. t.ucircumflex = 611;
  43330. t.acircumflex = 556;
  43331. t.Amacron = 722;
  43332. t.rcaron = 389;
  43333. t.ccedilla = 556;
  43334. t.Zdotaccent = 611;
  43335. t.Thorn = 667;
  43336. t.Omacron = 778;
  43337. t.Racute = 722;
  43338. t.Sacute = 667;
  43339. t.dcaron = 743;
  43340. t.Umacron = 722;
  43341. t.uring = 611;
  43342. t.threesuperior = 333;
  43343. t.Ograve = 778;
  43344. t.Agrave = 722;
  43345. t.Abreve = 722;
  43346. t.multiply = 584;
  43347. t.uacute = 611;
  43348. t.Tcaron = 611;
  43349. t.partialdiff = 494;
  43350. t.ydieresis = 556;
  43351. t.Nacute = 722;
  43352. t.icircumflex = 278;
  43353. t.Ecircumflex = 667;
  43354. t.adieresis = 556;
  43355. t.edieresis = 556;
  43356. t.cacute = 556;
  43357. t.nacute = 611;
  43358. t.umacron = 611;
  43359. t.Ncaron = 722;
  43360. t.Iacute = 278;
  43361. t.plusminus = 584;
  43362. t.brokenbar = 280;
  43363. t.registered = 737;
  43364. t.Gbreve = 778;
  43365. t.Idotaccent = 278;
  43366. t.summation = 600;
  43367. t.Egrave = 667;
  43368. t.racute = 389;
  43369. t.omacron = 611;
  43370. t.Zacute = 611;
  43371. t.Zcaron = 611;
  43372. t.greaterequal = 549;
  43373. t.Eth = 722;
  43374. t.Ccedilla = 722;
  43375. t.lcommaaccent = 278;
  43376. t.tcaron = 389;
  43377. t.eogonek = 556;
  43378. t.Uogonek = 722;
  43379. t.Aacute = 722;
  43380. t.Adieresis = 722;
  43381. t.egrave = 556;
  43382. t.zacute = 500;
  43383. t.iogonek = 278;
  43384. t.Oacute = 778;
  43385. t.oacute = 611;
  43386. t.amacron = 556;
  43387. t.sacute = 556;
  43388. t.idieresis = 278;
  43389. t.Ocircumflex = 778;
  43390. t.Ugrave = 722;
  43391. t.Delta = 612;
  43392. t.thorn = 611;
  43393. t.twosuperior = 333;
  43394. t.Odieresis = 778;
  43395. t.mu = 611;
  43396. t.igrave = 278;
  43397. t.ohungarumlaut = 611;
  43398. t.Eogonek = 667;
  43399. t.dcroat = 611;
  43400. t.threequarters = 834;
  43401. t.Scedilla = 667;
  43402. t.lcaron = 400;
  43403. t.Kcommaaccent = 722;
  43404. t.Lacute = 611;
  43405. t.trademark = 1000;
  43406. t.edotaccent = 556;
  43407. t.Igrave = 278;
  43408. t.Imacron = 278;
  43409. t.Lcaron = 611;
  43410. t.onehalf = 834;
  43411. t.lessequal = 549;
  43412. t.ocircumflex = 611;
  43413. t.ntilde = 611;
  43414. t.Uhungarumlaut = 722;
  43415. t.Eacute = 667;
  43416. t.emacron = 556;
  43417. t.gbreve = 611;
  43418. t.onequarter = 834;
  43419. t.Scaron = 667;
  43420. t.Scommaaccent = 667;
  43421. t.Ohungarumlaut = 778;
  43422. t.degree = 400;
  43423. t.ograve = 611;
  43424. t.Ccaron = 722;
  43425. t.ugrave = 611;
  43426. t.radical = 549;
  43427. t.Dcaron = 722;
  43428. t.rcommaaccent = 389;
  43429. t.Ntilde = 722;
  43430. t.otilde = 611;
  43431. t.Rcommaaccent = 722;
  43432. t.Lcommaaccent = 611;
  43433. t.Atilde = 722;
  43434. t.Aogonek = 722;
  43435. t.Aring = 722;
  43436. t.Otilde = 778;
  43437. t.zdotaccent = 500;
  43438. t.Ecaron = 667;
  43439. t.Iogonek = 278;
  43440. t.kcommaaccent = 556;
  43441. t.minus = 584;
  43442. t.Icircumflex = 278;
  43443. t.ncaron = 611;
  43444. t.tcommaaccent = 333;
  43445. t.logicalnot = 584;
  43446. t.odieresis = 611;
  43447. t.udieresis = 611;
  43448. t.notequal = 549;
  43449. t.gcommaaccent = 611;
  43450. t.eth = 611;
  43451. t.zcaron = 500;
  43452. t.ncommaaccent = 611;
  43453. t.onesuperior = 333;
  43454. t.imacron = 278;
  43455. t.Euro = 556;
  43456. });
  43457. t["Helvetica-Oblique"] = (0, _core_utils.getLookupTableFactory)(function (t) {
  43458. t.space = 278;
  43459. t.exclam = 278;
  43460. t.quotedbl = 355;
  43461. t.numbersign = 556;
  43462. t.dollar = 556;
  43463. t.percent = 889;
  43464. t.ampersand = 667;
  43465. t.quoteright = 222;
  43466. t.parenleft = 333;
  43467. t.parenright = 333;
  43468. t.asterisk = 389;
  43469. t.plus = 584;
  43470. t.comma = 278;
  43471. t.hyphen = 333;
  43472. t.period = 278;
  43473. t.slash = 278;
  43474. t.zero = 556;
  43475. t.one = 556;
  43476. t.two = 556;
  43477. t.three = 556;
  43478. t.four = 556;
  43479. t.five = 556;
  43480. t.six = 556;
  43481. t.seven = 556;
  43482. t.eight = 556;
  43483. t.nine = 556;
  43484. t.colon = 278;
  43485. t.semicolon = 278;
  43486. t.less = 584;
  43487. t.equal = 584;
  43488. t.greater = 584;
  43489. t.question = 556;
  43490. t.at = 1015;
  43491. t.A = 667;
  43492. t.B = 667;
  43493. t.C = 722;
  43494. t.D = 722;
  43495. t.E = 667;
  43496. t.F = 611;
  43497. t.G = 778;
  43498. t.H = 722;
  43499. t.I = 278;
  43500. t.J = 500;
  43501. t.K = 667;
  43502. t.L = 556;
  43503. t.M = 833;
  43504. t.N = 722;
  43505. t.O = 778;
  43506. t.P = 667;
  43507. t.Q = 778;
  43508. t.R = 722;
  43509. t.S = 667;
  43510. t.T = 611;
  43511. t.U = 722;
  43512. t.V = 667;
  43513. t.W = 944;
  43514. t.X = 667;
  43515. t.Y = 667;
  43516. t.Z = 611;
  43517. t.bracketleft = 278;
  43518. t.backslash = 278;
  43519. t.bracketright = 278;
  43520. t.asciicircum = 469;
  43521. t.underscore = 556;
  43522. t.quoteleft = 222;
  43523. t.a = 556;
  43524. t.b = 556;
  43525. t.c = 500;
  43526. t.d = 556;
  43527. t.e = 556;
  43528. t.f = 278;
  43529. t.g = 556;
  43530. t.h = 556;
  43531. t.i = 222;
  43532. t.j = 222;
  43533. t.k = 500;
  43534. t.l = 222;
  43535. t.m = 833;
  43536. t.n = 556;
  43537. t.o = 556;
  43538. t.p = 556;
  43539. t.q = 556;
  43540. t.r = 333;
  43541. t.s = 500;
  43542. t.t = 278;
  43543. t.u = 556;
  43544. t.v = 500;
  43545. t.w = 722;
  43546. t.x = 500;
  43547. t.y = 500;
  43548. t.z = 500;
  43549. t.braceleft = 334;
  43550. t.bar = 260;
  43551. t.braceright = 334;
  43552. t.asciitilde = 584;
  43553. t.exclamdown = 333;
  43554. t.cent = 556;
  43555. t.sterling = 556;
  43556. t.fraction = 167;
  43557. t.yen = 556;
  43558. t.florin = 556;
  43559. t.section = 556;
  43560. t.currency = 556;
  43561. t.quotesingle = 191;
  43562. t.quotedblleft = 333;
  43563. t.guillemotleft = 556;
  43564. t.guilsinglleft = 333;
  43565. t.guilsinglright = 333;
  43566. t.fi = 500;
  43567. t.fl = 500;
  43568. t.endash = 556;
  43569. t.dagger = 556;
  43570. t.daggerdbl = 556;
  43571. t.periodcentered = 278;
  43572. t.paragraph = 537;
  43573. t.bullet = 350;
  43574. t.quotesinglbase = 222;
  43575. t.quotedblbase = 333;
  43576. t.quotedblright = 333;
  43577. t.guillemotright = 556;
  43578. t.ellipsis = 1000;
  43579. t.perthousand = 1000;
  43580. t.questiondown = 611;
  43581. t.grave = 333;
  43582. t.acute = 333;
  43583. t.circumflex = 333;
  43584. t.tilde = 333;
  43585. t.macron = 333;
  43586. t.breve = 333;
  43587. t.dotaccent = 333;
  43588. t.dieresis = 333;
  43589. t.ring = 333;
  43590. t.cedilla = 333;
  43591. t.hungarumlaut = 333;
  43592. t.ogonek = 333;
  43593. t.caron = 333;
  43594. t.emdash = 1000;
  43595. t.AE = 1000;
  43596. t.ordfeminine = 370;
  43597. t.Lslash = 556;
  43598. t.Oslash = 778;
  43599. t.OE = 1000;
  43600. t.ordmasculine = 365;
  43601. t.ae = 889;
  43602. t.dotlessi = 278;
  43603. t.lslash = 222;
  43604. t.oslash = 611;
  43605. t.oe = 944;
  43606. t.germandbls = 611;
  43607. t.Idieresis = 278;
  43608. t.eacute = 556;
  43609. t.abreve = 556;
  43610. t.uhungarumlaut = 556;
  43611. t.ecaron = 556;
  43612. t.Ydieresis = 667;
  43613. t.divide = 584;
  43614. t.Yacute = 667;
  43615. t.Acircumflex = 667;
  43616. t.aacute = 556;
  43617. t.Ucircumflex = 722;
  43618. t.yacute = 500;
  43619. t.scommaaccent = 500;
  43620. t.ecircumflex = 556;
  43621. t.Uring = 722;
  43622. t.Udieresis = 722;
  43623. t.aogonek = 556;
  43624. t.Uacute = 722;
  43625. t.uogonek = 556;
  43626. t.Edieresis = 667;
  43627. t.Dcroat = 722;
  43628. t.commaaccent = 250;
  43629. t.copyright = 737;
  43630. t.Emacron = 667;
  43631. t.ccaron = 500;
  43632. t.aring = 556;
  43633. t.Ncommaaccent = 722;
  43634. t.lacute = 222;
  43635. t.agrave = 556;
  43636. t.Tcommaaccent = 611;
  43637. t.Cacute = 722;
  43638. t.atilde = 556;
  43639. t.Edotaccent = 667;
  43640. t.scaron = 500;
  43641. t.scedilla = 500;
  43642. t.iacute = 278;
  43643. t.lozenge = 471;
  43644. t.Rcaron = 722;
  43645. t.Gcommaaccent = 778;
  43646. t.ucircumflex = 556;
  43647. t.acircumflex = 556;
  43648. t.Amacron = 667;
  43649. t.rcaron = 333;
  43650. t.ccedilla = 500;
  43651. t.Zdotaccent = 611;
  43652. t.Thorn = 667;
  43653. t.Omacron = 778;
  43654. t.Racute = 722;
  43655. t.Sacute = 667;
  43656. t.dcaron = 643;
  43657. t.Umacron = 722;
  43658. t.uring = 556;
  43659. t.threesuperior = 333;
  43660. t.Ograve = 778;
  43661. t.Agrave = 667;
  43662. t.Abreve = 667;
  43663. t.multiply = 584;
  43664. t.uacute = 556;
  43665. t.Tcaron = 611;
  43666. t.partialdiff = 476;
  43667. t.ydieresis = 500;
  43668. t.Nacute = 722;
  43669. t.icircumflex = 278;
  43670. t.Ecircumflex = 667;
  43671. t.adieresis = 556;
  43672. t.edieresis = 556;
  43673. t.cacute = 500;
  43674. t.nacute = 556;
  43675. t.umacron = 556;
  43676. t.Ncaron = 722;
  43677. t.Iacute = 278;
  43678. t.plusminus = 584;
  43679. t.brokenbar = 260;
  43680. t.registered = 737;
  43681. t.Gbreve = 778;
  43682. t.Idotaccent = 278;
  43683. t.summation = 600;
  43684. t.Egrave = 667;
  43685. t.racute = 333;
  43686. t.omacron = 556;
  43687. t.Zacute = 611;
  43688. t.Zcaron = 611;
  43689. t.greaterequal = 549;
  43690. t.Eth = 722;
  43691. t.Ccedilla = 722;
  43692. t.lcommaaccent = 222;
  43693. t.tcaron = 317;
  43694. t.eogonek = 556;
  43695. t.Uogonek = 722;
  43696. t.Aacute = 667;
  43697. t.Adieresis = 667;
  43698. t.egrave = 556;
  43699. t.zacute = 500;
  43700. t.iogonek = 222;
  43701. t.Oacute = 778;
  43702. t.oacute = 556;
  43703. t.amacron = 556;
  43704. t.sacute = 500;
  43705. t.idieresis = 278;
  43706. t.Ocircumflex = 778;
  43707. t.Ugrave = 722;
  43708. t.Delta = 612;
  43709. t.thorn = 556;
  43710. t.twosuperior = 333;
  43711. t.Odieresis = 778;
  43712. t.mu = 556;
  43713. t.igrave = 278;
  43714. t.ohungarumlaut = 556;
  43715. t.Eogonek = 667;
  43716. t.dcroat = 556;
  43717. t.threequarters = 834;
  43718. t.Scedilla = 667;
  43719. t.lcaron = 299;
  43720. t.Kcommaaccent = 667;
  43721. t.Lacute = 556;
  43722. t.trademark = 1000;
  43723. t.edotaccent = 556;
  43724. t.Igrave = 278;
  43725. t.Imacron = 278;
  43726. t.Lcaron = 556;
  43727. t.onehalf = 834;
  43728. t.lessequal = 549;
  43729. t.ocircumflex = 556;
  43730. t.ntilde = 556;
  43731. t.Uhungarumlaut = 722;
  43732. t.Eacute = 667;
  43733. t.emacron = 556;
  43734. t.gbreve = 556;
  43735. t.onequarter = 834;
  43736. t.Scaron = 667;
  43737. t.Scommaaccent = 667;
  43738. t.Ohungarumlaut = 778;
  43739. t.degree = 400;
  43740. t.ograve = 556;
  43741. t.Ccaron = 722;
  43742. t.ugrave = 556;
  43743. t.radical = 453;
  43744. t.Dcaron = 722;
  43745. t.rcommaaccent = 333;
  43746. t.Ntilde = 722;
  43747. t.otilde = 556;
  43748. t.Rcommaaccent = 722;
  43749. t.Lcommaaccent = 556;
  43750. t.Atilde = 667;
  43751. t.Aogonek = 667;
  43752. t.Aring = 667;
  43753. t.Otilde = 778;
  43754. t.zdotaccent = 500;
  43755. t.Ecaron = 667;
  43756. t.Iogonek = 278;
  43757. t.kcommaaccent = 500;
  43758. t.minus = 584;
  43759. t.Icircumflex = 278;
  43760. t.ncaron = 556;
  43761. t.tcommaaccent = 278;
  43762. t.logicalnot = 584;
  43763. t.odieresis = 556;
  43764. t.udieresis = 556;
  43765. t.notequal = 549;
  43766. t.gcommaaccent = 556;
  43767. t.eth = 556;
  43768. t.zcaron = 500;
  43769. t.ncommaaccent = 556;
  43770. t.onesuperior = 333;
  43771. t.imacron = 278;
  43772. t.Euro = 556;
  43773. });
  43774. t.Symbol = (0, _core_utils.getLookupTableFactory)(function (t) {
  43775. t.space = 250;
  43776. t.exclam = 333;
  43777. t.universal = 713;
  43778. t.numbersign = 500;
  43779. t.existential = 549;
  43780. t.percent = 833;
  43781. t.ampersand = 778;
  43782. t.suchthat = 439;
  43783. t.parenleft = 333;
  43784. t.parenright = 333;
  43785. t.asteriskmath = 500;
  43786. t.plus = 549;
  43787. t.comma = 250;
  43788. t.minus = 549;
  43789. t.period = 250;
  43790. t.slash = 278;
  43791. t.zero = 500;
  43792. t.one = 500;
  43793. t.two = 500;
  43794. t.three = 500;
  43795. t.four = 500;
  43796. t.five = 500;
  43797. t.six = 500;
  43798. t.seven = 500;
  43799. t.eight = 500;
  43800. t.nine = 500;
  43801. t.colon = 278;
  43802. t.semicolon = 278;
  43803. t.less = 549;
  43804. t.equal = 549;
  43805. t.greater = 549;
  43806. t.question = 444;
  43807. t.congruent = 549;
  43808. t.Alpha = 722;
  43809. t.Beta = 667;
  43810. t.Chi = 722;
  43811. t.Delta = 612;
  43812. t.Epsilon = 611;
  43813. t.Phi = 763;
  43814. t.Gamma = 603;
  43815. t.Eta = 722;
  43816. t.Iota = 333;
  43817. t.theta1 = 631;
  43818. t.Kappa = 722;
  43819. t.Lambda = 686;
  43820. t.Mu = 889;
  43821. t.Nu = 722;
  43822. t.Omicron = 722;
  43823. t.Pi = 768;
  43824. t.Theta = 741;
  43825. t.Rho = 556;
  43826. t.Sigma = 592;
  43827. t.Tau = 611;
  43828. t.Upsilon = 690;
  43829. t.sigma1 = 439;
  43830. t.Omega = 768;
  43831. t.Xi = 645;
  43832. t.Psi = 795;
  43833. t.Zeta = 611;
  43834. t.bracketleft = 333;
  43835. t.therefore = 863;
  43836. t.bracketright = 333;
  43837. t.perpendicular = 658;
  43838. t.underscore = 500;
  43839. t.radicalex = 500;
  43840. t.alpha = 631;
  43841. t.beta = 549;
  43842. t.chi = 549;
  43843. t.delta = 494;
  43844. t.epsilon = 439;
  43845. t.phi = 521;
  43846. t.gamma = 411;
  43847. t.eta = 603;
  43848. t.iota = 329;
  43849. t.phi1 = 603;
  43850. t.kappa = 549;
  43851. t.lambda = 549;
  43852. t.mu = 576;
  43853. t.nu = 521;
  43854. t.omicron = 549;
  43855. t.pi = 549;
  43856. t.theta = 521;
  43857. t.rho = 549;
  43858. t.sigma = 603;
  43859. t.tau = 439;
  43860. t.upsilon = 576;
  43861. t.omega1 = 713;
  43862. t.omega = 686;
  43863. t.xi = 493;
  43864. t.psi = 686;
  43865. t.zeta = 494;
  43866. t.braceleft = 480;
  43867. t.bar = 200;
  43868. t.braceright = 480;
  43869. t.similar = 549;
  43870. t.Euro = 750;
  43871. t.Upsilon1 = 620;
  43872. t.minute = 247;
  43873. t.lessequal = 549;
  43874. t.fraction = 167;
  43875. t.infinity = 713;
  43876. t.florin = 500;
  43877. t.club = 753;
  43878. t.diamond = 753;
  43879. t.heart = 753;
  43880. t.spade = 753;
  43881. t.arrowboth = 1042;
  43882. t.arrowleft = 987;
  43883. t.arrowup = 603;
  43884. t.arrowright = 987;
  43885. t.arrowdown = 603;
  43886. t.degree = 400;
  43887. t.plusminus = 549;
  43888. t.second = 411;
  43889. t.greaterequal = 549;
  43890. t.multiply = 549;
  43891. t.proportional = 713;
  43892. t.partialdiff = 494;
  43893. t.bullet = 460;
  43894. t.divide = 549;
  43895. t.notequal = 549;
  43896. t.equivalence = 549;
  43897. t.approxequal = 549;
  43898. t.ellipsis = 1000;
  43899. t.arrowvertex = 603;
  43900. t.arrowhorizex = 1000;
  43901. t.carriagereturn = 658;
  43902. t.aleph = 823;
  43903. t.Ifraktur = 686;
  43904. t.Rfraktur = 795;
  43905. t.weierstrass = 987;
  43906. t.circlemultiply = 768;
  43907. t.circleplus = 768;
  43908. t.emptyset = 823;
  43909. t.intersection = 768;
  43910. t.union = 768;
  43911. t.propersuperset = 713;
  43912. t.reflexsuperset = 713;
  43913. t.notsubset = 713;
  43914. t.propersubset = 713;
  43915. t.reflexsubset = 713;
  43916. t.element = 713;
  43917. t.notelement = 713;
  43918. t.angle = 768;
  43919. t.gradient = 713;
  43920. t.registerserif = 790;
  43921. t.copyrightserif = 790;
  43922. t.trademarkserif = 890;
  43923. t.product = 823;
  43924. t.radical = 549;
  43925. t.dotmath = 250;
  43926. t.logicalnot = 713;
  43927. t.logicaland = 603;
  43928. t.logicalor = 603;
  43929. t.arrowdblboth = 1042;
  43930. t.arrowdblleft = 987;
  43931. t.arrowdblup = 603;
  43932. t.arrowdblright = 987;
  43933. t.arrowdbldown = 603;
  43934. t.lozenge = 494;
  43935. t.angleleft = 329;
  43936. t.registersans = 790;
  43937. t.copyrightsans = 790;
  43938. t.trademarksans = 786;
  43939. t.summation = 713;
  43940. t.parenlefttp = 384;
  43941. t.parenleftex = 384;
  43942. t.parenleftbt = 384;
  43943. t.bracketlefttp = 384;
  43944. t.bracketleftex = 384;
  43945. t.bracketleftbt = 384;
  43946. t.bracelefttp = 494;
  43947. t.braceleftmid = 494;
  43948. t.braceleftbt = 494;
  43949. t.braceex = 494;
  43950. t.angleright = 329;
  43951. t.integral = 274;
  43952. t.integraltp = 686;
  43953. t.integralex = 686;
  43954. t.integralbt = 686;
  43955. t.parenrighttp = 384;
  43956. t.parenrightex = 384;
  43957. t.parenrightbt = 384;
  43958. t.bracketrighttp = 384;
  43959. t.bracketrightex = 384;
  43960. t.bracketrightbt = 384;
  43961. t.bracerighttp = 494;
  43962. t.bracerightmid = 494;
  43963. t.bracerightbt = 494;
  43964. t.apple = 790;
  43965. });
  43966. t["Times-Roman"] = (0, _core_utils.getLookupTableFactory)(function (t) {
  43967. t.space = 250;
  43968. t.exclam = 333;
  43969. t.quotedbl = 408;
  43970. t.numbersign = 500;
  43971. t.dollar = 500;
  43972. t.percent = 833;
  43973. t.ampersand = 778;
  43974. t.quoteright = 333;
  43975. t.parenleft = 333;
  43976. t.parenright = 333;
  43977. t.asterisk = 500;
  43978. t.plus = 564;
  43979. t.comma = 250;
  43980. t.hyphen = 333;
  43981. t.period = 250;
  43982. t.slash = 278;
  43983. t.zero = 500;
  43984. t.one = 500;
  43985. t.two = 500;
  43986. t.three = 500;
  43987. t.four = 500;
  43988. t.five = 500;
  43989. t.six = 500;
  43990. t.seven = 500;
  43991. t.eight = 500;
  43992. t.nine = 500;
  43993. t.colon = 278;
  43994. t.semicolon = 278;
  43995. t.less = 564;
  43996. t.equal = 564;
  43997. t.greater = 564;
  43998. t.question = 444;
  43999. t.at = 921;
  44000. t.A = 722;
  44001. t.B = 667;
  44002. t.C = 667;
  44003. t.D = 722;
  44004. t.E = 611;
  44005. t.F = 556;
  44006. t.G = 722;
  44007. t.H = 722;
  44008. t.I = 333;
  44009. t.J = 389;
  44010. t.K = 722;
  44011. t.L = 611;
  44012. t.M = 889;
  44013. t.N = 722;
  44014. t.O = 722;
  44015. t.P = 556;
  44016. t.Q = 722;
  44017. t.R = 667;
  44018. t.S = 556;
  44019. t.T = 611;
  44020. t.U = 722;
  44021. t.V = 722;
  44022. t.W = 944;
  44023. t.X = 722;
  44024. t.Y = 722;
  44025. t.Z = 611;
  44026. t.bracketleft = 333;
  44027. t.backslash = 278;
  44028. t.bracketright = 333;
  44029. t.asciicircum = 469;
  44030. t.underscore = 500;
  44031. t.quoteleft = 333;
  44032. t.a = 444;
  44033. t.b = 500;
  44034. t.c = 444;
  44035. t.d = 500;
  44036. t.e = 444;
  44037. t.f = 333;
  44038. t.g = 500;
  44039. t.h = 500;
  44040. t.i = 278;
  44041. t.j = 278;
  44042. t.k = 500;
  44043. t.l = 278;
  44044. t.m = 778;
  44045. t.n = 500;
  44046. t.o = 500;
  44047. t.p = 500;
  44048. t.q = 500;
  44049. t.r = 333;
  44050. t.s = 389;
  44051. t.t = 278;
  44052. t.u = 500;
  44053. t.v = 500;
  44054. t.w = 722;
  44055. t.x = 500;
  44056. t.y = 500;
  44057. t.z = 444;
  44058. t.braceleft = 480;
  44059. t.bar = 200;
  44060. t.braceright = 480;
  44061. t.asciitilde = 541;
  44062. t.exclamdown = 333;
  44063. t.cent = 500;
  44064. t.sterling = 500;
  44065. t.fraction = 167;
  44066. t.yen = 500;
  44067. t.florin = 500;
  44068. t.section = 500;
  44069. t.currency = 500;
  44070. t.quotesingle = 180;
  44071. t.quotedblleft = 444;
  44072. t.guillemotleft = 500;
  44073. t.guilsinglleft = 333;
  44074. t.guilsinglright = 333;
  44075. t.fi = 556;
  44076. t.fl = 556;
  44077. t.endash = 500;
  44078. t.dagger = 500;
  44079. t.daggerdbl = 500;
  44080. t.periodcentered = 250;
  44081. t.paragraph = 453;
  44082. t.bullet = 350;
  44083. t.quotesinglbase = 333;
  44084. t.quotedblbase = 444;
  44085. t.quotedblright = 444;
  44086. t.guillemotright = 500;
  44087. t.ellipsis = 1000;
  44088. t.perthousand = 1000;
  44089. t.questiondown = 444;
  44090. t.grave = 333;
  44091. t.acute = 333;
  44092. t.circumflex = 333;
  44093. t.tilde = 333;
  44094. t.macron = 333;
  44095. t.breve = 333;
  44096. t.dotaccent = 333;
  44097. t.dieresis = 333;
  44098. t.ring = 333;
  44099. t.cedilla = 333;
  44100. t.hungarumlaut = 333;
  44101. t.ogonek = 333;
  44102. t.caron = 333;
  44103. t.emdash = 1000;
  44104. t.AE = 889;
  44105. t.ordfeminine = 276;
  44106. t.Lslash = 611;
  44107. t.Oslash = 722;
  44108. t.OE = 889;
  44109. t.ordmasculine = 310;
  44110. t.ae = 667;
  44111. t.dotlessi = 278;
  44112. t.lslash = 278;
  44113. t.oslash = 500;
  44114. t.oe = 722;
  44115. t.germandbls = 500;
  44116. t.Idieresis = 333;
  44117. t.eacute = 444;
  44118. t.abreve = 444;
  44119. t.uhungarumlaut = 500;
  44120. t.ecaron = 444;
  44121. t.Ydieresis = 722;
  44122. t.divide = 564;
  44123. t.Yacute = 722;
  44124. t.Acircumflex = 722;
  44125. t.aacute = 444;
  44126. t.Ucircumflex = 722;
  44127. t.yacute = 500;
  44128. t.scommaaccent = 389;
  44129. t.ecircumflex = 444;
  44130. t.Uring = 722;
  44131. t.Udieresis = 722;
  44132. t.aogonek = 444;
  44133. t.Uacute = 722;
  44134. t.uogonek = 500;
  44135. t.Edieresis = 611;
  44136. t.Dcroat = 722;
  44137. t.commaaccent = 250;
  44138. t.copyright = 760;
  44139. t.Emacron = 611;
  44140. t.ccaron = 444;
  44141. t.aring = 444;
  44142. t.Ncommaaccent = 722;
  44143. t.lacute = 278;
  44144. t.agrave = 444;
  44145. t.Tcommaaccent = 611;
  44146. t.Cacute = 667;
  44147. t.atilde = 444;
  44148. t.Edotaccent = 611;
  44149. t.scaron = 389;
  44150. t.scedilla = 389;
  44151. t.iacute = 278;
  44152. t.lozenge = 471;
  44153. t.Rcaron = 667;
  44154. t.Gcommaaccent = 722;
  44155. t.ucircumflex = 500;
  44156. t.acircumflex = 444;
  44157. t.Amacron = 722;
  44158. t.rcaron = 333;
  44159. t.ccedilla = 444;
  44160. t.Zdotaccent = 611;
  44161. t.Thorn = 556;
  44162. t.Omacron = 722;
  44163. t.Racute = 667;
  44164. t.Sacute = 556;
  44165. t.dcaron = 588;
  44166. t.Umacron = 722;
  44167. t.uring = 500;
  44168. t.threesuperior = 300;
  44169. t.Ograve = 722;
  44170. t.Agrave = 722;
  44171. t.Abreve = 722;
  44172. t.multiply = 564;
  44173. t.uacute = 500;
  44174. t.Tcaron = 611;
  44175. t.partialdiff = 476;
  44176. t.ydieresis = 500;
  44177. t.Nacute = 722;
  44178. t.icircumflex = 278;
  44179. t.Ecircumflex = 611;
  44180. t.adieresis = 444;
  44181. t.edieresis = 444;
  44182. t.cacute = 444;
  44183. t.nacute = 500;
  44184. t.umacron = 500;
  44185. t.Ncaron = 722;
  44186. t.Iacute = 333;
  44187. t.plusminus = 564;
  44188. t.brokenbar = 200;
  44189. t.registered = 760;
  44190. t.Gbreve = 722;
  44191. t.Idotaccent = 333;
  44192. t.summation = 600;
  44193. t.Egrave = 611;
  44194. t.racute = 333;
  44195. t.omacron = 500;
  44196. t.Zacute = 611;
  44197. t.Zcaron = 611;
  44198. t.greaterequal = 549;
  44199. t.Eth = 722;
  44200. t.Ccedilla = 667;
  44201. t.lcommaaccent = 278;
  44202. t.tcaron = 326;
  44203. t.eogonek = 444;
  44204. t.Uogonek = 722;
  44205. t.Aacute = 722;
  44206. t.Adieresis = 722;
  44207. t.egrave = 444;
  44208. t.zacute = 444;
  44209. t.iogonek = 278;
  44210. t.Oacute = 722;
  44211. t.oacute = 500;
  44212. t.amacron = 444;
  44213. t.sacute = 389;
  44214. t.idieresis = 278;
  44215. t.Ocircumflex = 722;
  44216. t.Ugrave = 722;
  44217. t.Delta = 612;
  44218. t.thorn = 500;
  44219. t.twosuperior = 300;
  44220. t.Odieresis = 722;
  44221. t.mu = 500;
  44222. t.igrave = 278;
  44223. t.ohungarumlaut = 500;
  44224. t.Eogonek = 611;
  44225. t.dcroat = 500;
  44226. t.threequarters = 750;
  44227. t.Scedilla = 556;
  44228. t.lcaron = 344;
  44229. t.Kcommaaccent = 722;
  44230. t.Lacute = 611;
  44231. t.trademark = 980;
  44232. t.edotaccent = 444;
  44233. t.Igrave = 333;
  44234. t.Imacron = 333;
  44235. t.Lcaron = 611;
  44236. t.onehalf = 750;
  44237. t.lessequal = 549;
  44238. t.ocircumflex = 500;
  44239. t.ntilde = 500;
  44240. t.Uhungarumlaut = 722;
  44241. t.Eacute = 611;
  44242. t.emacron = 444;
  44243. t.gbreve = 500;
  44244. t.onequarter = 750;
  44245. t.Scaron = 556;
  44246. t.Scommaaccent = 556;
  44247. t.Ohungarumlaut = 722;
  44248. t.degree = 400;
  44249. t.ograve = 500;
  44250. t.Ccaron = 667;
  44251. t.ugrave = 500;
  44252. t.radical = 453;
  44253. t.Dcaron = 722;
  44254. t.rcommaaccent = 333;
  44255. t.Ntilde = 722;
  44256. t.otilde = 500;
  44257. t.Rcommaaccent = 667;
  44258. t.Lcommaaccent = 611;
  44259. t.Atilde = 722;
  44260. t.Aogonek = 722;
  44261. t.Aring = 722;
  44262. t.Otilde = 722;
  44263. t.zdotaccent = 444;
  44264. t.Ecaron = 611;
  44265. t.Iogonek = 333;
  44266. t.kcommaaccent = 500;
  44267. t.minus = 564;
  44268. t.Icircumflex = 333;
  44269. t.ncaron = 500;
  44270. t.tcommaaccent = 278;
  44271. t.logicalnot = 564;
  44272. t.odieresis = 500;
  44273. t.udieresis = 500;
  44274. t.notequal = 549;
  44275. t.gcommaaccent = 500;
  44276. t.eth = 500;
  44277. t.zcaron = 444;
  44278. t.ncommaaccent = 500;
  44279. t.onesuperior = 300;
  44280. t.imacron = 278;
  44281. t.Euro = 500;
  44282. });
  44283. t["Times-Bold"] = (0, _core_utils.getLookupTableFactory)(function (t) {
  44284. t.space = 250;
  44285. t.exclam = 333;
  44286. t.quotedbl = 555;
  44287. t.numbersign = 500;
  44288. t.dollar = 500;
  44289. t.percent = 1000;
  44290. t.ampersand = 833;
  44291. t.quoteright = 333;
  44292. t.parenleft = 333;
  44293. t.parenright = 333;
  44294. t.asterisk = 500;
  44295. t.plus = 570;
  44296. t.comma = 250;
  44297. t.hyphen = 333;
  44298. t.period = 250;
  44299. t.slash = 278;
  44300. t.zero = 500;
  44301. t.one = 500;
  44302. t.two = 500;
  44303. t.three = 500;
  44304. t.four = 500;
  44305. t.five = 500;
  44306. t.six = 500;
  44307. t.seven = 500;
  44308. t.eight = 500;
  44309. t.nine = 500;
  44310. t.colon = 333;
  44311. t.semicolon = 333;
  44312. t.less = 570;
  44313. t.equal = 570;
  44314. t.greater = 570;
  44315. t.question = 500;
  44316. t.at = 930;
  44317. t.A = 722;
  44318. t.B = 667;
  44319. t.C = 722;
  44320. t.D = 722;
  44321. t.E = 667;
  44322. t.F = 611;
  44323. t.G = 778;
  44324. t.H = 778;
  44325. t.I = 389;
  44326. t.J = 500;
  44327. t.K = 778;
  44328. t.L = 667;
  44329. t.M = 944;
  44330. t.N = 722;
  44331. t.O = 778;
  44332. t.P = 611;
  44333. t.Q = 778;
  44334. t.R = 722;
  44335. t.S = 556;
  44336. t.T = 667;
  44337. t.U = 722;
  44338. t.V = 722;
  44339. t.W = 1000;
  44340. t.X = 722;
  44341. t.Y = 722;
  44342. t.Z = 667;
  44343. t.bracketleft = 333;
  44344. t.backslash = 278;
  44345. t.bracketright = 333;
  44346. t.asciicircum = 581;
  44347. t.underscore = 500;
  44348. t.quoteleft = 333;
  44349. t.a = 500;
  44350. t.b = 556;
  44351. t.c = 444;
  44352. t.d = 556;
  44353. t.e = 444;
  44354. t.f = 333;
  44355. t.g = 500;
  44356. t.h = 556;
  44357. t.i = 278;
  44358. t.j = 333;
  44359. t.k = 556;
  44360. t.l = 278;
  44361. t.m = 833;
  44362. t.n = 556;
  44363. t.o = 500;
  44364. t.p = 556;
  44365. t.q = 556;
  44366. t.r = 444;
  44367. t.s = 389;
  44368. t.t = 333;
  44369. t.u = 556;
  44370. t.v = 500;
  44371. t.w = 722;
  44372. t.x = 500;
  44373. t.y = 500;
  44374. t.z = 444;
  44375. t.braceleft = 394;
  44376. t.bar = 220;
  44377. t.braceright = 394;
  44378. t.asciitilde = 520;
  44379. t.exclamdown = 333;
  44380. t.cent = 500;
  44381. t.sterling = 500;
  44382. t.fraction = 167;
  44383. t.yen = 500;
  44384. t.florin = 500;
  44385. t.section = 500;
  44386. t.currency = 500;
  44387. t.quotesingle = 278;
  44388. t.quotedblleft = 500;
  44389. t.guillemotleft = 500;
  44390. t.guilsinglleft = 333;
  44391. t.guilsinglright = 333;
  44392. t.fi = 556;
  44393. t.fl = 556;
  44394. t.endash = 500;
  44395. t.dagger = 500;
  44396. t.daggerdbl = 500;
  44397. t.periodcentered = 250;
  44398. t.paragraph = 540;
  44399. t.bullet = 350;
  44400. t.quotesinglbase = 333;
  44401. t.quotedblbase = 500;
  44402. t.quotedblright = 500;
  44403. t.guillemotright = 500;
  44404. t.ellipsis = 1000;
  44405. t.perthousand = 1000;
  44406. t.questiondown = 500;
  44407. t.grave = 333;
  44408. t.acute = 333;
  44409. t.circumflex = 333;
  44410. t.tilde = 333;
  44411. t.macron = 333;
  44412. t.breve = 333;
  44413. t.dotaccent = 333;
  44414. t.dieresis = 333;
  44415. t.ring = 333;
  44416. t.cedilla = 333;
  44417. t.hungarumlaut = 333;
  44418. t.ogonek = 333;
  44419. t.caron = 333;
  44420. t.emdash = 1000;
  44421. t.AE = 1000;
  44422. t.ordfeminine = 300;
  44423. t.Lslash = 667;
  44424. t.Oslash = 778;
  44425. t.OE = 1000;
  44426. t.ordmasculine = 330;
  44427. t.ae = 722;
  44428. t.dotlessi = 278;
  44429. t.lslash = 278;
  44430. t.oslash = 500;
  44431. t.oe = 722;
  44432. t.germandbls = 556;
  44433. t.Idieresis = 389;
  44434. t.eacute = 444;
  44435. t.abreve = 500;
  44436. t.uhungarumlaut = 556;
  44437. t.ecaron = 444;
  44438. t.Ydieresis = 722;
  44439. t.divide = 570;
  44440. t.Yacute = 722;
  44441. t.Acircumflex = 722;
  44442. t.aacute = 500;
  44443. t.Ucircumflex = 722;
  44444. t.yacute = 500;
  44445. t.scommaaccent = 389;
  44446. t.ecircumflex = 444;
  44447. t.Uring = 722;
  44448. t.Udieresis = 722;
  44449. t.aogonek = 500;
  44450. t.Uacute = 722;
  44451. t.uogonek = 556;
  44452. t.Edieresis = 667;
  44453. t.Dcroat = 722;
  44454. t.commaaccent = 250;
  44455. t.copyright = 747;
  44456. t.Emacron = 667;
  44457. t.ccaron = 444;
  44458. t.aring = 500;
  44459. t.Ncommaaccent = 722;
  44460. t.lacute = 278;
  44461. t.agrave = 500;
  44462. t.Tcommaaccent = 667;
  44463. t.Cacute = 722;
  44464. t.atilde = 500;
  44465. t.Edotaccent = 667;
  44466. t.scaron = 389;
  44467. t.scedilla = 389;
  44468. t.iacute = 278;
  44469. t.lozenge = 494;
  44470. t.Rcaron = 722;
  44471. t.Gcommaaccent = 778;
  44472. t.ucircumflex = 556;
  44473. t.acircumflex = 500;
  44474. t.Amacron = 722;
  44475. t.rcaron = 444;
  44476. t.ccedilla = 444;
  44477. t.Zdotaccent = 667;
  44478. t.Thorn = 611;
  44479. t.Omacron = 778;
  44480. t.Racute = 722;
  44481. t.Sacute = 556;
  44482. t.dcaron = 672;
  44483. t.Umacron = 722;
  44484. t.uring = 556;
  44485. t.threesuperior = 300;
  44486. t.Ograve = 778;
  44487. t.Agrave = 722;
  44488. t.Abreve = 722;
  44489. t.multiply = 570;
  44490. t.uacute = 556;
  44491. t.Tcaron = 667;
  44492. t.partialdiff = 494;
  44493. t.ydieresis = 500;
  44494. t.Nacute = 722;
  44495. t.icircumflex = 278;
  44496. t.Ecircumflex = 667;
  44497. t.adieresis = 500;
  44498. t.edieresis = 444;
  44499. t.cacute = 444;
  44500. t.nacute = 556;
  44501. t.umacron = 556;
  44502. t.Ncaron = 722;
  44503. t.Iacute = 389;
  44504. t.plusminus = 570;
  44505. t.brokenbar = 220;
  44506. t.registered = 747;
  44507. t.Gbreve = 778;
  44508. t.Idotaccent = 389;
  44509. t.summation = 600;
  44510. t.Egrave = 667;
  44511. t.racute = 444;
  44512. t.omacron = 500;
  44513. t.Zacute = 667;
  44514. t.Zcaron = 667;
  44515. t.greaterequal = 549;
  44516. t.Eth = 722;
  44517. t.Ccedilla = 722;
  44518. t.lcommaaccent = 278;
  44519. t.tcaron = 416;
  44520. t.eogonek = 444;
  44521. t.Uogonek = 722;
  44522. t.Aacute = 722;
  44523. t.Adieresis = 722;
  44524. t.egrave = 444;
  44525. t.zacute = 444;
  44526. t.iogonek = 278;
  44527. t.Oacute = 778;
  44528. t.oacute = 500;
  44529. t.amacron = 500;
  44530. t.sacute = 389;
  44531. t.idieresis = 278;
  44532. t.Ocircumflex = 778;
  44533. t.Ugrave = 722;
  44534. t.Delta = 612;
  44535. t.thorn = 556;
  44536. t.twosuperior = 300;
  44537. t.Odieresis = 778;
  44538. t.mu = 556;
  44539. t.igrave = 278;
  44540. t.ohungarumlaut = 500;
  44541. t.Eogonek = 667;
  44542. t.dcroat = 556;
  44543. t.threequarters = 750;
  44544. t.Scedilla = 556;
  44545. t.lcaron = 394;
  44546. t.Kcommaaccent = 778;
  44547. t.Lacute = 667;
  44548. t.trademark = 1000;
  44549. t.edotaccent = 444;
  44550. t.Igrave = 389;
  44551. t.Imacron = 389;
  44552. t.Lcaron = 667;
  44553. t.onehalf = 750;
  44554. t.lessequal = 549;
  44555. t.ocircumflex = 500;
  44556. t.ntilde = 556;
  44557. t.Uhungarumlaut = 722;
  44558. t.Eacute = 667;
  44559. t.emacron = 444;
  44560. t.gbreve = 500;
  44561. t.onequarter = 750;
  44562. t.Scaron = 556;
  44563. t.Scommaaccent = 556;
  44564. t.Ohungarumlaut = 778;
  44565. t.degree = 400;
  44566. t.ograve = 500;
  44567. t.Ccaron = 722;
  44568. t.ugrave = 556;
  44569. t.radical = 549;
  44570. t.Dcaron = 722;
  44571. t.rcommaaccent = 444;
  44572. t.Ntilde = 722;
  44573. t.otilde = 500;
  44574. t.Rcommaaccent = 722;
  44575. t.Lcommaaccent = 667;
  44576. t.Atilde = 722;
  44577. t.Aogonek = 722;
  44578. t.Aring = 722;
  44579. t.Otilde = 778;
  44580. t.zdotaccent = 444;
  44581. t.Ecaron = 667;
  44582. t.Iogonek = 389;
  44583. t.kcommaaccent = 556;
  44584. t.minus = 570;
  44585. t.Icircumflex = 389;
  44586. t.ncaron = 556;
  44587. t.tcommaaccent = 333;
  44588. t.logicalnot = 570;
  44589. t.odieresis = 500;
  44590. t.udieresis = 556;
  44591. t.notequal = 549;
  44592. t.gcommaaccent = 500;
  44593. t.eth = 500;
  44594. t.zcaron = 444;
  44595. t.ncommaaccent = 556;
  44596. t.onesuperior = 300;
  44597. t.imacron = 278;
  44598. t.Euro = 500;
  44599. });
  44600. t["Times-BoldItalic"] = (0, _core_utils.getLookupTableFactory)(function (t) {
  44601. t.space = 250;
  44602. t.exclam = 389;
  44603. t.quotedbl = 555;
  44604. t.numbersign = 500;
  44605. t.dollar = 500;
  44606. t.percent = 833;
  44607. t.ampersand = 778;
  44608. t.quoteright = 333;
  44609. t.parenleft = 333;
  44610. t.parenright = 333;
  44611. t.asterisk = 500;
  44612. t.plus = 570;
  44613. t.comma = 250;
  44614. t.hyphen = 333;
  44615. t.period = 250;
  44616. t.slash = 278;
  44617. t.zero = 500;
  44618. t.one = 500;
  44619. t.two = 500;
  44620. t.three = 500;
  44621. t.four = 500;
  44622. t.five = 500;
  44623. t.six = 500;
  44624. t.seven = 500;
  44625. t.eight = 500;
  44626. t.nine = 500;
  44627. t.colon = 333;
  44628. t.semicolon = 333;
  44629. t.less = 570;
  44630. t.equal = 570;
  44631. t.greater = 570;
  44632. t.question = 500;
  44633. t.at = 832;
  44634. t.A = 667;
  44635. t.B = 667;
  44636. t.C = 667;
  44637. t.D = 722;
  44638. t.E = 667;
  44639. t.F = 667;
  44640. t.G = 722;
  44641. t.H = 778;
  44642. t.I = 389;
  44643. t.J = 500;
  44644. t.K = 667;
  44645. t.L = 611;
  44646. t.M = 889;
  44647. t.N = 722;
  44648. t.O = 722;
  44649. t.P = 611;
  44650. t.Q = 722;
  44651. t.R = 667;
  44652. t.S = 556;
  44653. t.T = 611;
  44654. t.U = 722;
  44655. t.V = 667;
  44656. t.W = 889;
  44657. t.X = 667;
  44658. t.Y = 611;
  44659. t.Z = 611;
  44660. t.bracketleft = 333;
  44661. t.backslash = 278;
  44662. t.bracketright = 333;
  44663. t.asciicircum = 570;
  44664. t.underscore = 500;
  44665. t.quoteleft = 333;
  44666. t.a = 500;
  44667. t.b = 500;
  44668. t.c = 444;
  44669. t.d = 500;
  44670. t.e = 444;
  44671. t.f = 333;
  44672. t.g = 500;
  44673. t.h = 556;
  44674. t.i = 278;
  44675. t.j = 278;
  44676. t.k = 500;
  44677. t.l = 278;
  44678. t.m = 778;
  44679. t.n = 556;
  44680. t.o = 500;
  44681. t.p = 500;
  44682. t.q = 500;
  44683. t.r = 389;
  44684. t.s = 389;
  44685. t.t = 278;
  44686. t.u = 556;
  44687. t.v = 444;
  44688. t.w = 667;
  44689. t.x = 500;
  44690. t.y = 444;
  44691. t.z = 389;
  44692. t.braceleft = 348;
  44693. t.bar = 220;
  44694. t.braceright = 348;
  44695. t.asciitilde = 570;
  44696. t.exclamdown = 389;
  44697. t.cent = 500;
  44698. t.sterling = 500;
  44699. t.fraction = 167;
  44700. t.yen = 500;
  44701. t.florin = 500;
  44702. t.section = 500;
  44703. t.currency = 500;
  44704. t.quotesingle = 278;
  44705. t.quotedblleft = 500;
  44706. t.guillemotleft = 500;
  44707. t.guilsinglleft = 333;
  44708. t.guilsinglright = 333;
  44709. t.fi = 556;
  44710. t.fl = 556;
  44711. t.endash = 500;
  44712. t.dagger = 500;
  44713. t.daggerdbl = 500;
  44714. t.periodcentered = 250;
  44715. t.paragraph = 500;
  44716. t.bullet = 350;
  44717. t.quotesinglbase = 333;
  44718. t.quotedblbase = 500;
  44719. t.quotedblright = 500;
  44720. t.guillemotright = 500;
  44721. t.ellipsis = 1000;
  44722. t.perthousand = 1000;
  44723. t.questiondown = 500;
  44724. t.grave = 333;
  44725. t.acute = 333;
  44726. t.circumflex = 333;
  44727. t.tilde = 333;
  44728. t.macron = 333;
  44729. t.breve = 333;
  44730. t.dotaccent = 333;
  44731. t.dieresis = 333;
  44732. t.ring = 333;
  44733. t.cedilla = 333;
  44734. t.hungarumlaut = 333;
  44735. t.ogonek = 333;
  44736. t.caron = 333;
  44737. t.emdash = 1000;
  44738. t.AE = 944;
  44739. t.ordfeminine = 266;
  44740. t.Lslash = 611;
  44741. t.Oslash = 722;
  44742. t.OE = 944;
  44743. t.ordmasculine = 300;
  44744. t.ae = 722;
  44745. t.dotlessi = 278;
  44746. t.lslash = 278;
  44747. t.oslash = 500;
  44748. t.oe = 722;
  44749. t.germandbls = 500;
  44750. t.Idieresis = 389;
  44751. t.eacute = 444;
  44752. t.abreve = 500;
  44753. t.uhungarumlaut = 556;
  44754. t.ecaron = 444;
  44755. t.Ydieresis = 611;
  44756. t.divide = 570;
  44757. t.Yacute = 611;
  44758. t.Acircumflex = 667;
  44759. t.aacute = 500;
  44760. t.Ucircumflex = 722;
  44761. t.yacute = 444;
  44762. t.scommaaccent = 389;
  44763. t.ecircumflex = 444;
  44764. t.Uring = 722;
  44765. t.Udieresis = 722;
  44766. t.aogonek = 500;
  44767. t.Uacute = 722;
  44768. t.uogonek = 556;
  44769. t.Edieresis = 667;
  44770. t.Dcroat = 722;
  44771. t.commaaccent = 250;
  44772. t.copyright = 747;
  44773. t.Emacron = 667;
  44774. t.ccaron = 444;
  44775. t.aring = 500;
  44776. t.Ncommaaccent = 722;
  44777. t.lacute = 278;
  44778. t.agrave = 500;
  44779. t.Tcommaaccent = 611;
  44780. t.Cacute = 667;
  44781. t.atilde = 500;
  44782. t.Edotaccent = 667;
  44783. t.scaron = 389;
  44784. t.scedilla = 389;
  44785. t.iacute = 278;
  44786. t.lozenge = 494;
  44787. t.Rcaron = 667;
  44788. t.Gcommaaccent = 722;
  44789. t.ucircumflex = 556;
  44790. t.acircumflex = 500;
  44791. t.Amacron = 667;
  44792. t.rcaron = 389;
  44793. t.ccedilla = 444;
  44794. t.Zdotaccent = 611;
  44795. t.Thorn = 611;
  44796. t.Omacron = 722;
  44797. t.Racute = 667;
  44798. t.Sacute = 556;
  44799. t.dcaron = 608;
  44800. t.Umacron = 722;
  44801. t.uring = 556;
  44802. t.threesuperior = 300;
  44803. t.Ograve = 722;
  44804. t.Agrave = 667;
  44805. t.Abreve = 667;
  44806. t.multiply = 570;
  44807. t.uacute = 556;
  44808. t.Tcaron = 611;
  44809. t.partialdiff = 494;
  44810. t.ydieresis = 444;
  44811. t.Nacute = 722;
  44812. t.icircumflex = 278;
  44813. t.Ecircumflex = 667;
  44814. t.adieresis = 500;
  44815. t.edieresis = 444;
  44816. t.cacute = 444;
  44817. t.nacute = 556;
  44818. t.umacron = 556;
  44819. t.Ncaron = 722;
  44820. t.Iacute = 389;
  44821. t.plusminus = 570;
  44822. t.brokenbar = 220;
  44823. t.registered = 747;
  44824. t.Gbreve = 722;
  44825. t.Idotaccent = 389;
  44826. t.summation = 600;
  44827. t.Egrave = 667;
  44828. t.racute = 389;
  44829. t.omacron = 500;
  44830. t.Zacute = 611;
  44831. t.Zcaron = 611;
  44832. t.greaterequal = 549;
  44833. t.Eth = 722;
  44834. t.Ccedilla = 667;
  44835. t.lcommaaccent = 278;
  44836. t.tcaron = 366;
  44837. t.eogonek = 444;
  44838. t.Uogonek = 722;
  44839. t.Aacute = 667;
  44840. t.Adieresis = 667;
  44841. t.egrave = 444;
  44842. t.zacute = 389;
  44843. t.iogonek = 278;
  44844. t.Oacute = 722;
  44845. t.oacute = 500;
  44846. t.amacron = 500;
  44847. t.sacute = 389;
  44848. t.idieresis = 278;
  44849. t.Ocircumflex = 722;
  44850. t.Ugrave = 722;
  44851. t.Delta = 612;
  44852. t.thorn = 500;
  44853. t.twosuperior = 300;
  44854. t.Odieresis = 722;
  44855. t.mu = 576;
  44856. t.igrave = 278;
  44857. t.ohungarumlaut = 500;
  44858. t.Eogonek = 667;
  44859. t.dcroat = 500;
  44860. t.threequarters = 750;
  44861. t.Scedilla = 556;
  44862. t.lcaron = 382;
  44863. t.Kcommaaccent = 667;
  44864. t.Lacute = 611;
  44865. t.trademark = 1000;
  44866. t.edotaccent = 444;
  44867. t.Igrave = 389;
  44868. t.Imacron = 389;
  44869. t.Lcaron = 611;
  44870. t.onehalf = 750;
  44871. t.lessequal = 549;
  44872. t.ocircumflex = 500;
  44873. t.ntilde = 556;
  44874. t.Uhungarumlaut = 722;
  44875. t.Eacute = 667;
  44876. t.emacron = 444;
  44877. t.gbreve = 500;
  44878. t.onequarter = 750;
  44879. t.Scaron = 556;
  44880. t.Scommaaccent = 556;
  44881. t.Ohungarumlaut = 722;
  44882. t.degree = 400;
  44883. t.ograve = 500;
  44884. t.Ccaron = 667;
  44885. t.ugrave = 556;
  44886. t.radical = 549;
  44887. t.Dcaron = 722;
  44888. t.rcommaaccent = 389;
  44889. t.Ntilde = 722;
  44890. t.otilde = 500;
  44891. t.Rcommaaccent = 667;
  44892. t.Lcommaaccent = 611;
  44893. t.Atilde = 667;
  44894. t.Aogonek = 667;
  44895. t.Aring = 667;
  44896. t.Otilde = 722;
  44897. t.zdotaccent = 389;
  44898. t.Ecaron = 667;
  44899. t.Iogonek = 389;
  44900. t.kcommaaccent = 500;
  44901. t.minus = 606;
  44902. t.Icircumflex = 389;
  44903. t.ncaron = 556;
  44904. t.tcommaaccent = 278;
  44905. t.logicalnot = 606;
  44906. t.odieresis = 500;
  44907. t.udieresis = 556;
  44908. t.notequal = 549;
  44909. t.gcommaaccent = 500;
  44910. t.eth = 500;
  44911. t.zcaron = 389;
  44912. t.ncommaaccent = 556;
  44913. t.onesuperior = 300;
  44914. t.imacron = 278;
  44915. t.Euro = 500;
  44916. });
  44917. t["Times-Italic"] = (0, _core_utils.getLookupTableFactory)(function (t) {
  44918. t.space = 250;
  44919. t.exclam = 333;
  44920. t.quotedbl = 420;
  44921. t.numbersign = 500;
  44922. t.dollar = 500;
  44923. t.percent = 833;
  44924. t.ampersand = 778;
  44925. t.quoteright = 333;
  44926. t.parenleft = 333;
  44927. t.parenright = 333;
  44928. t.asterisk = 500;
  44929. t.plus = 675;
  44930. t.comma = 250;
  44931. t.hyphen = 333;
  44932. t.period = 250;
  44933. t.slash = 278;
  44934. t.zero = 500;
  44935. t.one = 500;
  44936. t.two = 500;
  44937. t.three = 500;
  44938. t.four = 500;
  44939. t.five = 500;
  44940. t.six = 500;
  44941. t.seven = 500;
  44942. t.eight = 500;
  44943. t.nine = 500;
  44944. t.colon = 333;
  44945. t.semicolon = 333;
  44946. t.less = 675;
  44947. t.equal = 675;
  44948. t.greater = 675;
  44949. t.question = 500;
  44950. t.at = 920;
  44951. t.A = 611;
  44952. t.B = 611;
  44953. t.C = 667;
  44954. t.D = 722;
  44955. t.E = 611;
  44956. t.F = 611;
  44957. t.G = 722;
  44958. t.H = 722;
  44959. t.I = 333;
  44960. t.J = 444;
  44961. t.K = 667;
  44962. t.L = 556;
  44963. t.M = 833;
  44964. t.N = 667;
  44965. t.O = 722;
  44966. t.P = 611;
  44967. t.Q = 722;
  44968. t.R = 611;
  44969. t.S = 500;
  44970. t.T = 556;
  44971. t.U = 722;
  44972. t.V = 611;
  44973. t.W = 833;
  44974. t.X = 611;
  44975. t.Y = 556;
  44976. t.Z = 556;
  44977. t.bracketleft = 389;
  44978. t.backslash = 278;
  44979. t.bracketright = 389;
  44980. t.asciicircum = 422;
  44981. t.underscore = 500;
  44982. t.quoteleft = 333;
  44983. t.a = 500;
  44984. t.b = 500;
  44985. t.c = 444;
  44986. t.d = 500;
  44987. t.e = 444;
  44988. t.f = 278;
  44989. t.g = 500;
  44990. t.h = 500;
  44991. t.i = 278;
  44992. t.j = 278;
  44993. t.k = 444;
  44994. t.l = 278;
  44995. t.m = 722;
  44996. t.n = 500;
  44997. t.o = 500;
  44998. t.p = 500;
  44999. t.q = 500;
  45000. t.r = 389;
  45001. t.s = 389;
  45002. t.t = 278;
  45003. t.u = 500;
  45004. t.v = 444;
  45005. t.w = 667;
  45006. t.x = 444;
  45007. t.y = 444;
  45008. t.z = 389;
  45009. t.braceleft = 400;
  45010. t.bar = 275;
  45011. t.braceright = 400;
  45012. t.asciitilde = 541;
  45013. t.exclamdown = 389;
  45014. t.cent = 500;
  45015. t.sterling = 500;
  45016. t.fraction = 167;
  45017. t.yen = 500;
  45018. t.florin = 500;
  45019. t.section = 500;
  45020. t.currency = 500;
  45021. t.quotesingle = 214;
  45022. t.quotedblleft = 556;
  45023. t.guillemotleft = 500;
  45024. t.guilsinglleft = 333;
  45025. t.guilsinglright = 333;
  45026. t.fi = 500;
  45027. t.fl = 500;
  45028. t.endash = 500;
  45029. t.dagger = 500;
  45030. t.daggerdbl = 500;
  45031. t.periodcentered = 250;
  45032. t.paragraph = 523;
  45033. t.bullet = 350;
  45034. t.quotesinglbase = 333;
  45035. t.quotedblbase = 556;
  45036. t.quotedblright = 556;
  45037. t.guillemotright = 500;
  45038. t.ellipsis = 889;
  45039. t.perthousand = 1000;
  45040. t.questiondown = 500;
  45041. t.grave = 333;
  45042. t.acute = 333;
  45043. t.circumflex = 333;
  45044. t.tilde = 333;
  45045. t.macron = 333;
  45046. t.breve = 333;
  45047. t.dotaccent = 333;
  45048. t.dieresis = 333;
  45049. t.ring = 333;
  45050. t.cedilla = 333;
  45051. t.hungarumlaut = 333;
  45052. t.ogonek = 333;
  45053. t.caron = 333;
  45054. t.emdash = 889;
  45055. t.AE = 889;
  45056. t.ordfeminine = 276;
  45057. t.Lslash = 556;
  45058. t.Oslash = 722;
  45059. t.OE = 944;
  45060. t.ordmasculine = 310;
  45061. t.ae = 667;
  45062. t.dotlessi = 278;
  45063. t.lslash = 278;
  45064. t.oslash = 500;
  45065. t.oe = 667;
  45066. t.germandbls = 500;
  45067. t.Idieresis = 333;
  45068. t.eacute = 444;
  45069. t.abreve = 500;
  45070. t.uhungarumlaut = 500;
  45071. t.ecaron = 444;
  45072. t.Ydieresis = 556;
  45073. t.divide = 675;
  45074. t.Yacute = 556;
  45075. t.Acircumflex = 611;
  45076. t.aacute = 500;
  45077. t.Ucircumflex = 722;
  45078. t.yacute = 444;
  45079. t.scommaaccent = 389;
  45080. t.ecircumflex = 444;
  45081. t.Uring = 722;
  45082. t.Udieresis = 722;
  45083. t.aogonek = 500;
  45084. t.Uacute = 722;
  45085. t.uogonek = 500;
  45086. t.Edieresis = 611;
  45087. t.Dcroat = 722;
  45088. t.commaaccent = 250;
  45089. t.copyright = 760;
  45090. t.Emacron = 611;
  45091. t.ccaron = 444;
  45092. t.aring = 500;
  45093. t.Ncommaaccent = 667;
  45094. t.lacute = 278;
  45095. t.agrave = 500;
  45096. t.Tcommaaccent = 556;
  45097. t.Cacute = 667;
  45098. t.atilde = 500;
  45099. t.Edotaccent = 611;
  45100. t.scaron = 389;
  45101. t.scedilla = 389;
  45102. t.iacute = 278;
  45103. t.lozenge = 471;
  45104. t.Rcaron = 611;
  45105. t.Gcommaaccent = 722;
  45106. t.ucircumflex = 500;
  45107. t.acircumflex = 500;
  45108. t.Amacron = 611;
  45109. t.rcaron = 389;
  45110. t.ccedilla = 444;
  45111. t.Zdotaccent = 556;
  45112. t.Thorn = 611;
  45113. t.Omacron = 722;
  45114. t.Racute = 611;
  45115. t.Sacute = 500;
  45116. t.dcaron = 544;
  45117. t.Umacron = 722;
  45118. t.uring = 500;
  45119. t.threesuperior = 300;
  45120. t.Ograve = 722;
  45121. t.Agrave = 611;
  45122. t.Abreve = 611;
  45123. t.multiply = 675;
  45124. t.uacute = 500;
  45125. t.Tcaron = 556;
  45126. t.partialdiff = 476;
  45127. t.ydieresis = 444;
  45128. t.Nacute = 667;
  45129. t.icircumflex = 278;
  45130. t.Ecircumflex = 611;
  45131. t.adieresis = 500;
  45132. t.edieresis = 444;
  45133. t.cacute = 444;
  45134. t.nacute = 500;
  45135. t.umacron = 500;
  45136. t.Ncaron = 667;
  45137. t.Iacute = 333;
  45138. t.plusminus = 675;
  45139. t.brokenbar = 275;
  45140. t.registered = 760;
  45141. t.Gbreve = 722;
  45142. t.Idotaccent = 333;
  45143. t.summation = 600;
  45144. t.Egrave = 611;
  45145. t.racute = 389;
  45146. t.omacron = 500;
  45147. t.Zacute = 556;
  45148. t.Zcaron = 556;
  45149. t.greaterequal = 549;
  45150. t.Eth = 722;
  45151. t.Ccedilla = 667;
  45152. t.lcommaaccent = 278;
  45153. t.tcaron = 300;
  45154. t.eogonek = 444;
  45155. t.Uogonek = 722;
  45156. t.Aacute = 611;
  45157. t.Adieresis = 611;
  45158. t.egrave = 444;
  45159. t.zacute = 389;
  45160. t.iogonek = 278;
  45161. t.Oacute = 722;
  45162. t.oacute = 500;
  45163. t.amacron = 500;
  45164. t.sacute = 389;
  45165. t.idieresis = 278;
  45166. t.Ocircumflex = 722;
  45167. t.Ugrave = 722;
  45168. t.Delta = 612;
  45169. t.thorn = 500;
  45170. t.twosuperior = 300;
  45171. t.Odieresis = 722;
  45172. t.mu = 500;
  45173. t.igrave = 278;
  45174. t.ohungarumlaut = 500;
  45175. t.Eogonek = 611;
  45176. t.dcroat = 500;
  45177. t.threequarters = 750;
  45178. t.Scedilla = 500;
  45179. t.lcaron = 300;
  45180. t.Kcommaaccent = 667;
  45181. t.Lacute = 556;
  45182. t.trademark = 980;
  45183. t.edotaccent = 444;
  45184. t.Igrave = 333;
  45185. t.Imacron = 333;
  45186. t.Lcaron = 611;
  45187. t.onehalf = 750;
  45188. t.lessequal = 549;
  45189. t.ocircumflex = 500;
  45190. t.ntilde = 500;
  45191. t.Uhungarumlaut = 722;
  45192. t.Eacute = 611;
  45193. t.emacron = 444;
  45194. t.gbreve = 500;
  45195. t.onequarter = 750;
  45196. t.Scaron = 500;
  45197. t.Scommaaccent = 500;
  45198. t.Ohungarumlaut = 722;
  45199. t.degree = 400;
  45200. t.ograve = 500;
  45201. t.Ccaron = 667;
  45202. t.ugrave = 500;
  45203. t.radical = 453;
  45204. t.Dcaron = 722;
  45205. t.rcommaaccent = 389;
  45206. t.Ntilde = 667;
  45207. t.otilde = 500;
  45208. t.Rcommaaccent = 611;
  45209. t.Lcommaaccent = 556;
  45210. t.Atilde = 611;
  45211. t.Aogonek = 611;
  45212. t.Aring = 611;
  45213. t.Otilde = 722;
  45214. t.zdotaccent = 389;
  45215. t.Ecaron = 611;
  45216. t.Iogonek = 333;
  45217. t.kcommaaccent = 444;
  45218. t.minus = 675;
  45219. t.Icircumflex = 333;
  45220. t.ncaron = 500;
  45221. t.tcommaaccent = 278;
  45222. t.logicalnot = 675;
  45223. t.odieresis = 500;
  45224. t.udieresis = 500;
  45225. t.notequal = 549;
  45226. t.gcommaaccent = 500;
  45227. t.eth = 500;
  45228. t.zcaron = 389;
  45229. t.ncommaaccent = 500;
  45230. t.onesuperior = 300;
  45231. t.imacron = 278;
  45232. t.Euro = 500;
  45233. });
  45234. t.ZapfDingbats = (0, _core_utils.getLookupTableFactory)(function (t) {
  45235. t.space = 278;
  45236. t.a1 = 974;
  45237. t.a2 = 961;
  45238. t.a202 = 974;
  45239. t.a3 = 980;
  45240. t.a4 = 719;
  45241. t.a5 = 789;
  45242. t.a119 = 790;
  45243. t.a118 = 791;
  45244. t.a117 = 690;
  45245. t.a11 = 960;
  45246. t.a12 = 939;
  45247. t.a13 = 549;
  45248. t.a14 = 855;
  45249. t.a15 = 911;
  45250. t.a16 = 933;
  45251. t.a105 = 911;
  45252. t.a17 = 945;
  45253. t.a18 = 974;
  45254. t.a19 = 755;
  45255. t.a20 = 846;
  45256. t.a21 = 762;
  45257. t.a22 = 761;
  45258. t.a23 = 571;
  45259. t.a24 = 677;
  45260. t.a25 = 763;
  45261. t.a26 = 760;
  45262. t.a27 = 759;
  45263. t.a28 = 754;
  45264. t.a6 = 494;
  45265. t.a7 = 552;
  45266. t.a8 = 537;
  45267. t.a9 = 577;
  45268. t.a10 = 692;
  45269. t.a29 = 786;
  45270. t.a30 = 788;
  45271. t.a31 = 788;
  45272. t.a32 = 790;
  45273. t.a33 = 793;
  45274. t.a34 = 794;
  45275. t.a35 = 816;
  45276. t.a36 = 823;
  45277. t.a37 = 789;
  45278. t.a38 = 841;
  45279. t.a39 = 823;
  45280. t.a40 = 833;
  45281. t.a41 = 816;
  45282. t.a42 = 831;
  45283. t.a43 = 923;
  45284. t.a44 = 744;
  45285. t.a45 = 723;
  45286. t.a46 = 749;
  45287. t.a47 = 790;
  45288. t.a48 = 792;
  45289. t.a49 = 695;
  45290. t.a50 = 776;
  45291. t.a51 = 768;
  45292. t.a52 = 792;
  45293. t.a53 = 759;
  45294. t.a54 = 707;
  45295. t.a55 = 708;
  45296. t.a56 = 682;
  45297. t.a57 = 701;
  45298. t.a58 = 826;
  45299. t.a59 = 815;
  45300. t.a60 = 789;
  45301. t.a61 = 789;
  45302. t.a62 = 707;
  45303. t.a63 = 687;
  45304. t.a64 = 696;
  45305. t.a65 = 689;
  45306. t.a66 = 786;
  45307. t.a67 = 787;
  45308. t.a68 = 713;
  45309. t.a69 = 791;
  45310. t.a70 = 785;
  45311. t.a71 = 791;
  45312. t.a72 = 873;
  45313. t.a73 = 761;
  45314. t.a74 = 762;
  45315. t.a203 = 762;
  45316. t.a75 = 759;
  45317. t.a204 = 759;
  45318. t.a76 = 892;
  45319. t.a77 = 892;
  45320. t.a78 = 788;
  45321. t.a79 = 784;
  45322. t.a81 = 438;
  45323. t.a82 = 138;
  45324. t.a83 = 277;
  45325. t.a84 = 415;
  45326. t.a97 = 392;
  45327. t.a98 = 392;
  45328. t.a99 = 668;
  45329. t.a100 = 668;
  45330. t.a89 = 390;
  45331. t.a90 = 390;
  45332. t.a93 = 317;
  45333. t.a94 = 317;
  45334. t.a91 = 276;
  45335. t.a92 = 276;
  45336. t.a205 = 509;
  45337. t.a85 = 509;
  45338. t.a206 = 410;
  45339. t.a86 = 410;
  45340. t.a87 = 234;
  45341. t.a88 = 234;
  45342. t.a95 = 334;
  45343. t.a96 = 334;
  45344. t.a101 = 732;
  45345. t.a102 = 544;
  45346. t.a103 = 544;
  45347. t.a104 = 910;
  45348. t.a106 = 667;
  45349. t.a107 = 760;
  45350. t.a108 = 760;
  45351. t.a112 = 776;
  45352. t.a111 = 595;
  45353. t.a110 = 694;
  45354. t.a109 = 626;
  45355. t.a120 = 788;
  45356. t.a121 = 788;
  45357. t.a122 = 788;
  45358. t.a123 = 788;
  45359. t.a124 = 788;
  45360. t.a125 = 788;
  45361. t.a126 = 788;
  45362. t.a127 = 788;
  45363. t.a128 = 788;
  45364. t.a129 = 788;
  45365. t.a130 = 788;
  45366. t.a131 = 788;
  45367. t.a132 = 788;
  45368. t.a133 = 788;
  45369. t.a134 = 788;
  45370. t.a135 = 788;
  45371. t.a136 = 788;
  45372. t.a137 = 788;
  45373. t.a138 = 788;
  45374. t.a139 = 788;
  45375. t.a140 = 788;
  45376. t.a141 = 788;
  45377. t.a142 = 788;
  45378. t.a143 = 788;
  45379. t.a144 = 788;
  45380. t.a145 = 788;
  45381. t.a146 = 788;
  45382. t.a147 = 788;
  45383. t.a148 = 788;
  45384. t.a149 = 788;
  45385. t.a150 = 788;
  45386. t.a151 = 788;
  45387. t.a152 = 788;
  45388. t.a153 = 788;
  45389. t.a154 = 788;
  45390. t.a155 = 788;
  45391. t.a156 = 788;
  45392. t.a157 = 788;
  45393. t.a158 = 788;
  45394. t.a159 = 788;
  45395. t.a160 = 894;
  45396. t.a161 = 838;
  45397. t.a163 = 1016;
  45398. t.a164 = 458;
  45399. t.a196 = 748;
  45400. t.a165 = 924;
  45401. t.a192 = 748;
  45402. t.a166 = 918;
  45403. t.a167 = 927;
  45404. t.a168 = 928;
  45405. t.a169 = 928;
  45406. t.a170 = 834;
  45407. t.a171 = 873;
  45408. t.a172 = 828;
  45409. t.a173 = 924;
  45410. t.a162 = 924;
  45411. t.a174 = 917;
  45412. t.a175 = 930;
  45413. t.a176 = 931;
  45414. t.a177 = 463;
  45415. t.a178 = 883;
  45416. t.a179 = 836;
  45417. t.a193 = 836;
  45418. t.a180 = 867;
  45419. t.a199 = 867;
  45420. t.a181 = 696;
  45421. t.a200 = 696;
  45422. t.a182 = 874;
  45423. t.a201 = 874;
  45424. t.a183 = 760;
  45425. t.a184 = 946;
  45426. t.a197 = 771;
  45427. t.a185 = 865;
  45428. t.a194 = 771;
  45429. t.a198 = 888;
  45430. t.a186 = 967;
  45431. t.a195 = 888;
  45432. t.a187 = 831;
  45433. t.a188 = 873;
  45434. t.a189 = 927;
  45435. t.a190 = 970;
  45436. t.a191 = 918;
  45437. });
  45438. });
  45439. exports.getMetrics = getMetrics;
  45440. /***/ }),
  45441. /* 43 */
  45442. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  45443. Object.defineProperty(exports, "__esModule", ({
  45444. value: true
  45445. }));
  45446. exports.MurmurHash3_64 = void 0;
  45447. var _util = __w_pdfjs_require__(2);
  45448. const SEED = 0xc3d2e1f0;
  45449. const MASK_HIGH = 0xffff0000;
  45450. const MASK_LOW = 0xffff;
  45451. class MurmurHash3_64 {
  45452. constructor(seed) {
  45453. this.h1 = seed ? seed & 0xffffffff : SEED;
  45454. this.h2 = seed ? seed & 0xffffffff : SEED;
  45455. }
  45456. update(input) {
  45457. let data, length;
  45458. if ((0, _util.isString)(input)) {
  45459. data = new Uint8Array(input.length * 2);
  45460. length = 0;
  45461. for (let i = 0, ii = input.length; i < ii; i++) {
  45462. const code = input.charCodeAt(i);
  45463. if (code <= 0xff) {
  45464. data[length++] = code;
  45465. } else {
  45466. data[length++] = code >>> 8;
  45467. data[length++] = code & 0xff;
  45468. }
  45469. }
  45470. } else if ((0, _util.isArrayBuffer)(input)) {
  45471. data = input.slice();
  45472. length = data.byteLength;
  45473. } else {
  45474. throw new Error("Wrong data format in MurmurHash3_64_update. " + "Input must be a string or array.");
  45475. }
  45476. const blockCounts = length >> 2;
  45477. const tailLength = length - blockCounts * 4;
  45478. const dataUint32 = new Uint32Array(data.buffer, 0, blockCounts);
  45479. let k1 = 0,
  45480. k2 = 0;
  45481. let h1 = this.h1,
  45482. h2 = this.h2;
  45483. const C1 = 0xcc9e2d51,
  45484. C2 = 0x1b873593;
  45485. const C1_LOW = C1 & MASK_LOW,
  45486. C2_LOW = C2 & MASK_LOW;
  45487. for (let i = 0; i < blockCounts; i++) {
  45488. if (i & 1) {
  45489. k1 = dataUint32[i];
  45490. k1 = k1 * C1 & MASK_HIGH | k1 * C1_LOW & MASK_LOW;
  45491. k1 = k1 << 15 | k1 >>> 17;
  45492. k1 = k1 * C2 & MASK_HIGH | k1 * C2_LOW & MASK_LOW;
  45493. h1 ^= k1;
  45494. h1 = h1 << 13 | h1 >>> 19;
  45495. h1 = h1 * 5 + 0xe6546b64;
  45496. } else {
  45497. k2 = dataUint32[i];
  45498. k2 = k2 * C1 & MASK_HIGH | k2 * C1_LOW & MASK_LOW;
  45499. k2 = k2 << 15 | k2 >>> 17;
  45500. k2 = k2 * C2 & MASK_HIGH | k2 * C2_LOW & MASK_LOW;
  45501. h2 ^= k2;
  45502. h2 = h2 << 13 | h2 >>> 19;
  45503. h2 = h2 * 5 + 0xe6546b64;
  45504. }
  45505. }
  45506. k1 = 0;
  45507. switch (tailLength) {
  45508. case 3:
  45509. k1 ^= data[blockCounts * 4 + 2] << 16;
  45510. case 2:
  45511. k1 ^= data[blockCounts * 4 + 1] << 8;
  45512. case 1:
  45513. k1 ^= data[blockCounts * 4];
  45514. k1 = k1 * C1 & MASK_HIGH | k1 * C1_LOW & MASK_LOW;
  45515. k1 = k1 << 15 | k1 >>> 17;
  45516. k1 = k1 * C2 & MASK_HIGH | k1 * C2_LOW & MASK_LOW;
  45517. if (blockCounts & 1) {
  45518. h1 ^= k1;
  45519. } else {
  45520. h2 ^= k1;
  45521. }
  45522. }
  45523. this.h1 = h1;
  45524. this.h2 = h2;
  45525. }
  45526. hexdigest() {
  45527. let h1 = this.h1,
  45528. h2 = this.h2;
  45529. h1 ^= h2 >>> 1;
  45530. h1 = h1 * 0xed558ccd & MASK_HIGH | h1 * 0x8ccd & MASK_LOW;
  45531. h2 = h2 * 0xff51afd7 & MASK_HIGH | ((h2 << 16 | h1 >>> 16) * 0xafd7ed55 & MASK_HIGH) >>> 16;
  45532. h1 ^= h2 >>> 1;
  45533. h1 = h1 * 0x1a85ec53 & MASK_HIGH | h1 * 0xec53 & MASK_LOW;
  45534. h2 = h2 * 0xc4ceb9fe & MASK_HIGH | ((h2 << 16 | h1 >>> 16) * 0xb9fe1a85 & MASK_HIGH) >>> 16;
  45535. h1 ^= h2 >>> 1;
  45536. const hex1 = (h1 >>> 0).toString(16),
  45537. hex2 = (h2 >>> 0).toString(16);
  45538. return hex1.padStart(8, "0") + hex2.padStart(8, "0");
  45539. }
  45540. }
  45541. exports.MurmurHash3_64 = MurmurHash3_64;
  45542. /***/ }),
  45543. /* 44 */
  45544. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  45545. Object.defineProperty(exports, "__esModule", ({
  45546. value: true
  45547. }));
  45548. exports.OperatorList = void 0;
  45549. var _util = __w_pdfjs_require__(2);
  45550. var QueueOptimizer = function QueueOptimizerClosure() {
  45551. function addState(parentState, pattern, checkFn, iterateFn, processFn) {
  45552. var state = parentState;
  45553. for (var i = 0, ii = pattern.length - 1; i < ii; i++) {
  45554. var item = pattern[i];
  45555. state = state[item] || (state[item] = []);
  45556. }
  45557. state[pattern[pattern.length - 1]] = {
  45558. checkFn,
  45559. iterateFn,
  45560. processFn
  45561. };
  45562. }
  45563. function handlePaintSolidColorImageMask(iFirstSave, count, fnArray, argsArray) {
  45564. var iFirstPIMXO = iFirstSave + 2;
  45565. for (var i = 0; i < count; i++) {
  45566. var arg = argsArray[iFirstPIMXO + 4 * i];
  45567. var imageMask = arg.length === 1 && arg[0];
  45568. if (imageMask && imageMask.width === 1 && imageMask.height === 1 && (!imageMask.data.length || imageMask.data.length === 1 && imageMask.data[0] === 0)) {
  45569. fnArray[iFirstPIMXO + 4 * i] = _util.OPS.paintSolidColorImageMask;
  45570. continue;
  45571. }
  45572. break;
  45573. }
  45574. return count - i;
  45575. }
  45576. var InitialState = [];
  45577. addState(InitialState, [_util.OPS.save, _util.OPS.transform, _util.OPS.paintInlineImageXObject, _util.OPS.restore], null, function iterateInlineImageGroup(context, i) {
  45578. var fnArray = context.fnArray;
  45579. var iFirstSave = context.iCurr - 3;
  45580. var pos = (i - iFirstSave) % 4;
  45581. switch (pos) {
  45582. case 0:
  45583. return fnArray[i] === _util.OPS.save;
  45584. case 1:
  45585. return fnArray[i] === _util.OPS.transform;
  45586. case 2:
  45587. return fnArray[i] === _util.OPS.paintInlineImageXObject;
  45588. case 3:
  45589. return fnArray[i] === _util.OPS.restore;
  45590. }
  45591. throw new Error(`iterateInlineImageGroup - invalid pos: ${pos}`);
  45592. }, function foundInlineImageGroup(context, i) {
  45593. var MIN_IMAGES_IN_INLINE_IMAGES_BLOCK = 10;
  45594. var MAX_IMAGES_IN_INLINE_IMAGES_BLOCK = 200;
  45595. var MAX_WIDTH = 1000;
  45596. var IMAGE_PADDING = 1;
  45597. var fnArray = context.fnArray,
  45598. argsArray = context.argsArray;
  45599. var curr = context.iCurr;
  45600. var iFirstSave = curr - 3;
  45601. var iFirstTransform = curr - 2;
  45602. var iFirstPIIXO = curr - 1;
  45603. var count = Math.min(Math.floor((i - iFirstSave) / 4), MAX_IMAGES_IN_INLINE_IMAGES_BLOCK);
  45604. if (count < MIN_IMAGES_IN_INLINE_IMAGES_BLOCK) {
  45605. return i - (i - iFirstSave) % 4;
  45606. }
  45607. var maxX = 0;
  45608. var map = [],
  45609. maxLineHeight = 0;
  45610. var currentX = IMAGE_PADDING,
  45611. currentY = IMAGE_PADDING;
  45612. var q;
  45613. for (q = 0; q < count; q++) {
  45614. var transform = argsArray[iFirstTransform + (q << 2)];
  45615. var img = argsArray[iFirstPIIXO + (q << 2)][0];
  45616. if (currentX + img.width > MAX_WIDTH) {
  45617. maxX = Math.max(maxX, currentX);
  45618. currentY += maxLineHeight + 2 * IMAGE_PADDING;
  45619. currentX = 0;
  45620. maxLineHeight = 0;
  45621. }
  45622. map.push({
  45623. transform,
  45624. x: currentX,
  45625. y: currentY,
  45626. w: img.width,
  45627. h: img.height
  45628. });
  45629. currentX += img.width + 2 * IMAGE_PADDING;
  45630. maxLineHeight = Math.max(maxLineHeight, img.height);
  45631. }
  45632. var imgWidth = Math.max(maxX, currentX) + IMAGE_PADDING;
  45633. var imgHeight = currentY + maxLineHeight + IMAGE_PADDING;
  45634. var imgData = new Uint8ClampedArray(imgWidth * imgHeight * 4);
  45635. var imgRowSize = imgWidth << 2;
  45636. for (q = 0; q < count; q++) {
  45637. var data = argsArray[iFirstPIIXO + (q << 2)][0].data;
  45638. var rowSize = map[q].w << 2;
  45639. var dataOffset = 0;
  45640. var offset = map[q].x + map[q].y * imgWidth << 2;
  45641. imgData.set(data.subarray(0, rowSize), offset - imgRowSize);
  45642. for (var k = 0, kk = map[q].h; k < kk; k++) {
  45643. imgData.set(data.subarray(dataOffset, dataOffset + rowSize), offset);
  45644. dataOffset += rowSize;
  45645. offset += imgRowSize;
  45646. }
  45647. imgData.set(data.subarray(dataOffset - rowSize, dataOffset), offset);
  45648. while (offset >= 0) {
  45649. data[offset - 4] = data[offset];
  45650. data[offset - 3] = data[offset + 1];
  45651. data[offset - 2] = data[offset + 2];
  45652. data[offset - 1] = data[offset + 3];
  45653. data[offset + rowSize] = data[offset + rowSize - 4];
  45654. data[offset + rowSize + 1] = data[offset + rowSize - 3];
  45655. data[offset + rowSize + 2] = data[offset + rowSize - 2];
  45656. data[offset + rowSize + 3] = data[offset + rowSize - 1];
  45657. offset -= imgRowSize;
  45658. }
  45659. }
  45660. fnArray.splice(iFirstSave, count * 4, _util.OPS.paintInlineImageXObjectGroup);
  45661. argsArray.splice(iFirstSave, count * 4, [{
  45662. width: imgWidth,
  45663. height: imgHeight,
  45664. kind: _util.ImageKind.RGBA_32BPP,
  45665. data: imgData
  45666. }, map]);
  45667. return iFirstSave + 1;
  45668. });
  45669. addState(InitialState, [_util.OPS.save, _util.OPS.transform, _util.OPS.paintImageMaskXObject, _util.OPS.restore], null, function iterateImageMaskGroup(context, i) {
  45670. var fnArray = context.fnArray;
  45671. var iFirstSave = context.iCurr - 3;
  45672. var pos = (i - iFirstSave) % 4;
  45673. switch (pos) {
  45674. case 0:
  45675. return fnArray[i] === _util.OPS.save;
  45676. case 1:
  45677. return fnArray[i] === _util.OPS.transform;
  45678. case 2:
  45679. return fnArray[i] === _util.OPS.paintImageMaskXObject;
  45680. case 3:
  45681. return fnArray[i] === _util.OPS.restore;
  45682. }
  45683. throw new Error(`iterateImageMaskGroup - invalid pos: ${pos}`);
  45684. }, function foundImageMaskGroup(context, i) {
  45685. var MIN_IMAGES_IN_MASKS_BLOCK = 10;
  45686. var MAX_IMAGES_IN_MASKS_BLOCK = 100;
  45687. var MAX_SAME_IMAGES_IN_MASKS_BLOCK = 1000;
  45688. var fnArray = context.fnArray,
  45689. argsArray = context.argsArray;
  45690. var curr = context.iCurr;
  45691. var iFirstSave = curr - 3;
  45692. var iFirstTransform = curr - 2;
  45693. var iFirstPIMXO = curr - 1;
  45694. var count = Math.floor((i - iFirstSave) / 4);
  45695. count = handlePaintSolidColorImageMask(iFirstSave, count, fnArray, argsArray);
  45696. if (count < MIN_IMAGES_IN_MASKS_BLOCK) {
  45697. return i - (i - iFirstSave) % 4;
  45698. }
  45699. var q;
  45700. var isSameImage = false;
  45701. var iTransform, transformArgs;
  45702. var firstPIMXOArg0 = argsArray[iFirstPIMXO][0];
  45703. const firstTransformArg0 = argsArray[iFirstTransform][0],
  45704. firstTransformArg1 = argsArray[iFirstTransform][1],
  45705. firstTransformArg2 = argsArray[iFirstTransform][2],
  45706. firstTransformArg3 = argsArray[iFirstTransform][3];
  45707. if (firstTransformArg1 === firstTransformArg2) {
  45708. isSameImage = true;
  45709. iTransform = iFirstTransform + 4;
  45710. var iPIMXO = iFirstPIMXO + 4;
  45711. for (q = 1; q < count; q++, iTransform += 4, iPIMXO += 4) {
  45712. transformArgs = argsArray[iTransform];
  45713. if (argsArray[iPIMXO][0] !== firstPIMXOArg0 || transformArgs[0] !== firstTransformArg0 || transformArgs[1] !== firstTransformArg1 || transformArgs[2] !== firstTransformArg2 || transformArgs[3] !== firstTransformArg3) {
  45714. if (q < MIN_IMAGES_IN_MASKS_BLOCK) {
  45715. isSameImage = false;
  45716. } else {
  45717. count = q;
  45718. }
  45719. break;
  45720. }
  45721. }
  45722. }
  45723. if (isSameImage) {
  45724. count = Math.min(count, MAX_SAME_IMAGES_IN_MASKS_BLOCK);
  45725. var positions = new Float32Array(count * 2);
  45726. iTransform = iFirstTransform;
  45727. for (q = 0; q < count; q++, iTransform += 4) {
  45728. transformArgs = argsArray[iTransform];
  45729. positions[q << 1] = transformArgs[4];
  45730. positions[(q << 1) + 1] = transformArgs[5];
  45731. }
  45732. fnArray.splice(iFirstSave, count * 4, _util.OPS.paintImageMaskXObjectRepeat);
  45733. argsArray.splice(iFirstSave, count * 4, [firstPIMXOArg0, firstTransformArg0, firstTransformArg1, firstTransformArg2, firstTransformArg3, positions]);
  45734. } else {
  45735. count = Math.min(count, MAX_IMAGES_IN_MASKS_BLOCK);
  45736. var images = [];
  45737. for (q = 0; q < count; q++) {
  45738. transformArgs = argsArray[iFirstTransform + (q << 2)];
  45739. var maskParams = argsArray[iFirstPIMXO + (q << 2)][0];
  45740. images.push({
  45741. data: maskParams.data,
  45742. width: maskParams.width,
  45743. height: maskParams.height,
  45744. transform: transformArgs
  45745. });
  45746. }
  45747. fnArray.splice(iFirstSave, count * 4, _util.OPS.paintImageMaskXObjectGroup);
  45748. argsArray.splice(iFirstSave, count * 4, [images]);
  45749. }
  45750. return iFirstSave + 1;
  45751. });
  45752. addState(InitialState, [_util.OPS.save, _util.OPS.transform, _util.OPS.paintImageXObject, _util.OPS.restore], function (context) {
  45753. var argsArray = context.argsArray;
  45754. var iFirstTransform = context.iCurr - 2;
  45755. return argsArray[iFirstTransform][1] === 0 && argsArray[iFirstTransform][2] === 0;
  45756. }, function iterateImageGroup(context, i) {
  45757. var fnArray = context.fnArray,
  45758. argsArray = context.argsArray;
  45759. var iFirstSave = context.iCurr - 3;
  45760. var pos = (i - iFirstSave) % 4;
  45761. switch (pos) {
  45762. case 0:
  45763. return fnArray[i] === _util.OPS.save;
  45764. case 1:
  45765. if (fnArray[i] !== _util.OPS.transform) {
  45766. return false;
  45767. }
  45768. var iFirstTransform = context.iCurr - 2;
  45769. var firstTransformArg0 = argsArray[iFirstTransform][0];
  45770. var firstTransformArg3 = argsArray[iFirstTransform][3];
  45771. if (argsArray[i][0] !== firstTransformArg0 || argsArray[i][1] !== 0 || argsArray[i][2] !== 0 || argsArray[i][3] !== firstTransformArg3) {
  45772. return false;
  45773. }
  45774. return true;
  45775. case 2:
  45776. if (fnArray[i] !== _util.OPS.paintImageXObject) {
  45777. return false;
  45778. }
  45779. var iFirstPIXO = context.iCurr - 1;
  45780. var firstPIXOArg0 = argsArray[iFirstPIXO][0];
  45781. if (argsArray[i][0] !== firstPIXOArg0) {
  45782. return false;
  45783. }
  45784. return true;
  45785. case 3:
  45786. return fnArray[i] === _util.OPS.restore;
  45787. }
  45788. throw new Error(`iterateImageGroup - invalid pos: ${pos}`);
  45789. }, function (context, i) {
  45790. var MIN_IMAGES_IN_BLOCK = 3;
  45791. var MAX_IMAGES_IN_BLOCK = 1000;
  45792. var fnArray = context.fnArray,
  45793. argsArray = context.argsArray;
  45794. var curr = context.iCurr;
  45795. var iFirstSave = curr - 3;
  45796. var iFirstTransform = curr - 2;
  45797. var iFirstPIXO = curr - 1;
  45798. var firstPIXOArg0 = argsArray[iFirstPIXO][0];
  45799. var firstTransformArg0 = argsArray[iFirstTransform][0];
  45800. var firstTransformArg3 = argsArray[iFirstTransform][3];
  45801. var count = Math.min(Math.floor((i - iFirstSave) / 4), MAX_IMAGES_IN_BLOCK);
  45802. if (count < MIN_IMAGES_IN_BLOCK) {
  45803. return i - (i - iFirstSave) % 4;
  45804. }
  45805. var positions = new Float32Array(count * 2);
  45806. var iTransform = iFirstTransform;
  45807. for (var q = 0; q < count; q++, iTransform += 4) {
  45808. var transformArgs = argsArray[iTransform];
  45809. positions[q << 1] = transformArgs[4];
  45810. positions[(q << 1) + 1] = transformArgs[5];
  45811. }
  45812. var args = [firstPIXOArg0, firstTransformArg0, firstTransformArg3, positions];
  45813. fnArray.splice(iFirstSave, count * 4, _util.OPS.paintImageXObjectRepeat);
  45814. argsArray.splice(iFirstSave, count * 4, args);
  45815. return iFirstSave + 1;
  45816. });
  45817. addState(InitialState, [_util.OPS.beginText, _util.OPS.setFont, _util.OPS.setTextMatrix, _util.OPS.showText, _util.OPS.endText], null, function iterateShowTextGroup(context, i) {
  45818. var fnArray = context.fnArray,
  45819. argsArray = context.argsArray;
  45820. var iFirstSave = context.iCurr - 4;
  45821. var pos = (i - iFirstSave) % 5;
  45822. switch (pos) {
  45823. case 0:
  45824. return fnArray[i] === _util.OPS.beginText;
  45825. case 1:
  45826. return fnArray[i] === _util.OPS.setFont;
  45827. case 2:
  45828. return fnArray[i] === _util.OPS.setTextMatrix;
  45829. case 3:
  45830. if (fnArray[i] !== _util.OPS.showText) {
  45831. return false;
  45832. }
  45833. var iFirstSetFont = context.iCurr - 3;
  45834. var firstSetFontArg0 = argsArray[iFirstSetFont][0];
  45835. var firstSetFontArg1 = argsArray[iFirstSetFont][1];
  45836. if (argsArray[i][0] !== firstSetFontArg0 || argsArray[i][1] !== firstSetFontArg1) {
  45837. return false;
  45838. }
  45839. return true;
  45840. case 4:
  45841. return fnArray[i] === _util.OPS.endText;
  45842. }
  45843. throw new Error(`iterateShowTextGroup - invalid pos: ${pos}`);
  45844. }, function (context, i) {
  45845. var MIN_CHARS_IN_BLOCK = 3;
  45846. var MAX_CHARS_IN_BLOCK = 1000;
  45847. var fnArray = context.fnArray,
  45848. argsArray = context.argsArray;
  45849. var curr = context.iCurr;
  45850. var iFirstBeginText = curr - 4;
  45851. var iFirstSetFont = curr - 3;
  45852. var iFirstSetTextMatrix = curr - 2;
  45853. var iFirstShowText = curr - 1;
  45854. var iFirstEndText = curr;
  45855. var firstSetFontArg0 = argsArray[iFirstSetFont][0];
  45856. var firstSetFontArg1 = argsArray[iFirstSetFont][1];
  45857. var count = Math.min(Math.floor((i - iFirstBeginText) / 5), MAX_CHARS_IN_BLOCK);
  45858. if (count < MIN_CHARS_IN_BLOCK) {
  45859. return i - (i - iFirstBeginText) % 5;
  45860. }
  45861. var iFirst = iFirstBeginText;
  45862. 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) {
  45863. count++;
  45864. iFirst -= 5;
  45865. }
  45866. var iEndText = iFirst + 4;
  45867. for (var q = 1; q < count; q++) {
  45868. fnArray.splice(iEndText, 3);
  45869. argsArray.splice(iEndText, 3);
  45870. iEndText += 2;
  45871. }
  45872. return iEndText + 1;
  45873. });
  45874. function QueueOptimizer(queue) {
  45875. this.queue = queue;
  45876. this.state = null;
  45877. this.context = {
  45878. iCurr: 0,
  45879. fnArray: queue.fnArray,
  45880. argsArray: queue.argsArray
  45881. };
  45882. this.match = null;
  45883. this.lastProcessed = 0;
  45884. }
  45885. QueueOptimizer.prototype = {
  45886. _optimize() {
  45887. const fnArray = this.queue.fnArray;
  45888. let i = this.lastProcessed,
  45889. ii = fnArray.length;
  45890. let state = this.state;
  45891. let match = this.match;
  45892. if (!state && !match && i + 1 === ii && !InitialState[fnArray[i]]) {
  45893. this.lastProcessed = ii;
  45894. return;
  45895. }
  45896. const context = this.context;
  45897. while (i < ii) {
  45898. if (match) {
  45899. const iterate = (0, match.iterateFn)(context, i);
  45900. if (iterate) {
  45901. i++;
  45902. continue;
  45903. }
  45904. i = (0, match.processFn)(context, i + 1);
  45905. ii = fnArray.length;
  45906. match = null;
  45907. state = null;
  45908. if (i >= ii) {
  45909. break;
  45910. }
  45911. }
  45912. state = (state || InitialState)[fnArray[i]];
  45913. if (!state || Array.isArray(state)) {
  45914. i++;
  45915. continue;
  45916. }
  45917. context.iCurr = i;
  45918. i++;
  45919. if (state.checkFn && !(0, state.checkFn)(context)) {
  45920. state = null;
  45921. continue;
  45922. }
  45923. match = state;
  45924. state = null;
  45925. }
  45926. this.state = state;
  45927. this.match = match;
  45928. this.lastProcessed = i;
  45929. },
  45930. push(fn, args) {
  45931. this.queue.fnArray.push(fn);
  45932. this.queue.argsArray.push(args);
  45933. this._optimize();
  45934. },
  45935. flush() {
  45936. while (this.match) {
  45937. const length = this.queue.fnArray.length;
  45938. this.lastProcessed = (0, this.match.processFn)(this.context, length);
  45939. this.match = null;
  45940. this.state = null;
  45941. this._optimize();
  45942. }
  45943. },
  45944. reset() {
  45945. this.state = null;
  45946. this.match = null;
  45947. this.lastProcessed = 0;
  45948. }
  45949. };
  45950. return QueueOptimizer;
  45951. }();
  45952. var NullOptimizer = function NullOptimizerClosure() {
  45953. function NullOptimizer(queue) {
  45954. this.queue = queue;
  45955. }
  45956. NullOptimizer.prototype = {
  45957. push(fn, args) {
  45958. this.queue.fnArray.push(fn);
  45959. this.queue.argsArray.push(args);
  45960. },
  45961. flush() {},
  45962. reset() {}
  45963. };
  45964. return NullOptimizer;
  45965. }();
  45966. var OperatorList = function OperatorListClosure() {
  45967. var CHUNK_SIZE = 1000;
  45968. var CHUNK_SIZE_ABOUT = CHUNK_SIZE - 5;
  45969. function OperatorList(intent, streamSink) {
  45970. this._streamSink = streamSink;
  45971. this.fnArray = [];
  45972. this.argsArray = [];
  45973. if (streamSink && intent !== "oplist") {
  45974. this.optimizer = new QueueOptimizer(this);
  45975. } else {
  45976. this.optimizer = new NullOptimizer(this);
  45977. }
  45978. this.dependencies = new Set();
  45979. this._totalLength = 0;
  45980. this.weight = 0;
  45981. this._resolved = streamSink ? null : Promise.resolve();
  45982. }
  45983. OperatorList.prototype = {
  45984. get length() {
  45985. return this.argsArray.length;
  45986. },
  45987. get ready() {
  45988. return this._resolved || this._streamSink.ready;
  45989. },
  45990. get totalLength() {
  45991. return this._totalLength + this.length;
  45992. },
  45993. addOp(fn, args) {
  45994. this.optimizer.push(fn, args);
  45995. this.weight++;
  45996. if (this._streamSink) {
  45997. if (this.weight >= CHUNK_SIZE) {
  45998. this.flush();
  45999. } else if (this.weight >= CHUNK_SIZE_ABOUT && (fn === _util.OPS.restore || fn === _util.OPS.endText)) {
  46000. this.flush();
  46001. }
  46002. }
  46003. },
  46004. addDependency(dependency) {
  46005. if (this.dependencies.has(dependency)) {
  46006. return;
  46007. }
  46008. this.dependencies.add(dependency);
  46009. this.addOp(_util.OPS.dependency, [dependency]);
  46010. },
  46011. addDependencies(dependencies) {
  46012. for (const dependency of dependencies) {
  46013. this.addDependency(dependency);
  46014. }
  46015. },
  46016. addOpList(opList) {
  46017. if (!(opList instanceof OperatorList)) {
  46018. (0, _util.warn)('addOpList - ignoring invalid "opList" parameter.');
  46019. return;
  46020. }
  46021. for (const dependency of opList.dependencies) {
  46022. this.dependencies.add(dependency);
  46023. }
  46024. for (var i = 0, ii = opList.length; i < ii; i++) {
  46025. this.addOp(opList.fnArray[i], opList.argsArray[i]);
  46026. }
  46027. },
  46028. getIR() {
  46029. return {
  46030. fnArray: this.fnArray,
  46031. argsArray: this.argsArray,
  46032. length: this.length
  46033. };
  46034. },
  46035. get _transfers() {
  46036. const transfers = [];
  46037. const {
  46038. fnArray,
  46039. argsArray,
  46040. length
  46041. } = this;
  46042. for (let i = 0; i < length; i++) {
  46043. switch (fnArray[i]) {
  46044. case _util.OPS.paintInlineImageXObject:
  46045. case _util.OPS.paintInlineImageXObjectGroup:
  46046. case _util.OPS.paintImageMaskXObject:
  46047. const arg = argsArray[i][0];
  46048. ;
  46049. if (!arg.cached) {
  46050. transfers.push(arg.data.buffer);
  46051. }
  46052. break;
  46053. }
  46054. }
  46055. return transfers;
  46056. },
  46057. flush(lastChunk = false) {
  46058. this.optimizer.flush();
  46059. const length = this.length;
  46060. this._totalLength += length;
  46061. this._streamSink.enqueue({
  46062. fnArray: this.fnArray,
  46063. argsArray: this.argsArray,
  46064. lastChunk,
  46065. length
  46066. }, 1, this._transfers);
  46067. this.dependencies.clear();
  46068. this.fnArray.length = 0;
  46069. this.argsArray.length = 0;
  46070. this.weight = 0;
  46071. this.optimizer.reset();
  46072. }
  46073. };
  46074. return OperatorList;
  46075. }();
  46076. exports.OperatorList = OperatorList;
  46077. /***/ }),
  46078. /* 45 */
  46079. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  46080. Object.defineProperty(exports, "__esModule", ({
  46081. value: true
  46082. }));
  46083. exports.PDFImage = void 0;
  46084. var _util = __w_pdfjs_require__(2);
  46085. var _primitives = __w_pdfjs_require__(5);
  46086. var _colorspace = __w_pdfjs_require__(23);
  46087. var _stream = __w_pdfjs_require__(12);
  46088. var _jpeg_stream = __w_pdfjs_require__(18);
  46089. var _jpx = __w_pdfjs_require__(21);
  46090. function decodeAndClamp(value, addend, coefficient, max) {
  46091. value = addend + value * coefficient;
  46092. if (value < 0) {
  46093. value = 0;
  46094. } else if (value > max) {
  46095. value = max;
  46096. }
  46097. return value;
  46098. }
  46099. function resizeImageMask(src, bpc, w1, h1, w2, h2) {
  46100. var length = w2 * h2;
  46101. let dest;
  46102. if (bpc <= 8) {
  46103. dest = new Uint8Array(length);
  46104. } else if (bpc <= 16) {
  46105. dest = new Uint16Array(length);
  46106. } else {
  46107. dest = new Uint32Array(length);
  46108. }
  46109. var xRatio = w1 / w2;
  46110. var yRatio = h1 / h2;
  46111. var i,
  46112. j,
  46113. py,
  46114. newIndex = 0,
  46115. oldIndex;
  46116. var xScaled = new Uint16Array(w2);
  46117. var w1Scanline = w1;
  46118. for (i = 0; i < w2; i++) {
  46119. xScaled[i] = Math.floor(i * xRatio);
  46120. }
  46121. for (i = 0; i < h2; i++) {
  46122. py = Math.floor(i * yRatio) * w1Scanline;
  46123. for (j = 0; j < w2; j++) {
  46124. oldIndex = py + xScaled[j];
  46125. dest[newIndex++] = src[oldIndex];
  46126. }
  46127. }
  46128. return dest;
  46129. }
  46130. class PDFImage {
  46131. constructor({
  46132. xref,
  46133. res,
  46134. image,
  46135. isInline = false,
  46136. smask = null,
  46137. mask = null,
  46138. isMask = false,
  46139. pdfFunctionFactory,
  46140. localColorSpaceCache
  46141. }) {
  46142. this.image = image;
  46143. var dict = image.dict;
  46144. const filter = dict.get("Filter");
  46145. if ((0, _primitives.isName)(filter)) {
  46146. switch (filter.name) {
  46147. case "JPXDecode":
  46148. var jpxImage = new _jpx.JpxImage();
  46149. jpxImage.parseImageProperties(image.stream);
  46150. image.stream.reset();
  46151. image.width = jpxImage.width;
  46152. image.height = jpxImage.height;
  46153. image.bitsPerComponent = jpxImage.bitsPerComponent;
  46154. image.numComps = jpxImage.componentsCount;
  46155. break;
  46156. case "JBIG2Decode":
  46157. image.bitsPerComponent = 1;
  46158. image.numComps = 1;
  46159. break;
  46160. }
  46161. }
  46162. let width = dict.get("Width", "W");
  46163. let height = dict.get("Height", "H");
  46164. if (Number.isInteger(image.width) && image.width > 0 && Number.isInteger(image.height) && image.height > 0 && (image.width !== width || image.height !== height)) {
  46165. (0, _util.warn)("PDFImage - using the Width/Height of the image data, " + "rather than the image dictionary.");
  46166. width = image.width;
  46167. height = image.height;
  46168. }
  46169. if (width < 1 || height < 1) {
  46170. throw new _util.FormatError(`Invalid image width: ${width} or height: ${height}`);
  46171. }
  46172. this.width = width;
  46173. this.height = height;
  46174. this.interpolate = dict.get("Interpolate", "I") || false;
  46175. this.imageMask = dict.get("ImageMask", "IM") || false;
  46176. this.matte = dict.get("Matte") || false;
  46177. var bitsPerComponent = image.bitsPerComponent;
  46178. if (!bitsPerComponent) {
  46179. bitsPerComponent = dict.get("BitsPerComponent", "BPC");
  46180. if (!bitsPerComponent) {
  46181. if (this.imageMask) {
  46182. bitsPerComponent = 1;
  46183. } else {
  46184. throw new _util.FormatError(`Bits per component missing in image: ${this.imageMask}`);
  46185. }
  46186. }
  46187. }
  46188. this.bpc = bitsPerComponent;
  46189. if (!this.imageMask) {
  46190. let colorSpace = dict.getRaw("ColorSpace") || dict.getRaw("CS");
  46191. if (!colorSpace) {
  46192. (0, _util.info)("JPX images (which do not require color spaces)");
  46193. switch (image.numComps) {
  46194. case 1:
  46195. colorSpace = _primitives.Name.get("DeviceGray");
  46196. break;
  46197. case 3:
  46198. colorSpace = _primitives.Name.get("DeviceRGB");
  46199. break;
  46200. case 4:
  46201. colorSpace = _primitives.Name.get("DeviceCMYK");
  46202. break;
  46203. default:
  46204. throw new Error(`JPX images with ${image.numComps} ` + "color components not supported.");
  46205. }
  46206. }
  46207. this.colorSpace = _colorspace.ColorSpace.parse({
  46208. cs: colorSpace,
  46209. xref,
  46210. resources: isInline ? res : null,
  46211. pdfFunctionFactory,
  46212. localColorSpaceCache
  46213. });
  46214. this.numComps = this.colorSpace.numComps;
  46215. }
  46216. this.decode = dict.getArray("Decode", "D");
  46217. this.needsDecode = false;
  46218. if (this.decode && (this.colorSpace && !this.colorSpace.isDefaultDecode(this.decode, bitsPerComponent) || isMask && !_colorspace.ColorSpace.isDefaultDecode(this.decode, 1))) {
  46219. this.needsDecode = true;
  46220. var max = (1 << bitsPerComponent) - 1;
  46221. this.decodeCoefficients = [];
  46222. this.decodeAddends = [];
  46223. const isIndexed = this.colorSpace && this.colorSpace.name === "Indexed";
  46224. for (var i = 0, j = 0; i < this.decode.length; i += 2, ++j) {
  46225. var dmin = this.decode[i];
  46226. var dmax = this.decode[i + 1];
  46227. this.decodeCoefficients[j] = isIndexed ? (dmax - dmin) / max : dmax - dmin;
  46228. this.decodeAddends[j] = isIndexed ? dmin : max * dmin;
  46229. }
  46230. }
  46231. if (smask) {
  46232. this.smask = new PDFImage({
  46233. xref,
  46234. res,
  46235. image: smask,
  46236. isInline,
  46237. pdfFunctionFactory,
  46238. localColorSpaceCache
  46239. });
  46240. } else if (mask) {
  46241. if ((0, _primitives.isStream)(mask)) {
  46242. var maskDict = mask.dict,
  46243. imageMask = maskDict.get("ImageMask", "IM");
  46244. if (!imageMask) {
  46245. (0, _util.warn)("Ignoring /Mask in image without /ImageMask.");
  46246. } else {
  46247. this.mask = new PDFImage({
  46248. xref,
  46249. res,
  46250. image: mask,
  46251. isInline,
  46252. isMask: true,
  46253. pdfFunctionFactory,
  46254. localColorSpaceCache
  46255. });
  46256. }
  46257. } else {
  46258. this.mask = mask;
  46259. }
  46260. }
  46261. }
  46262. static async buildImage({
  46263. xref,
  46264. res,
  46265. image,
  46266. isInline = false,
  46267. pdfFunctionFactory,
  46268. localColorSpaceCache
  46269. }) {
  46270. const imageData = image;
  46271. let smaskData = null;
  46272. let maskData = null;
  46273. const smask = image.dict.get("SMask");
  46274. const mask = image.dict.get("Mask");
  46275. if (smask) {
  46276. smaskData = smask;
  46277. } else if (mask) {
  46278. if ((0, _primitives.isStream)(mask) || Array.isArray(mask)) {
  46279. maskData = mask;
  46280. } else {
  46281. (0, _util.warn)("Unsupported mask format.");
  46282. }
  46283. }
  46284. return new PDFImage({
  46285. xref,
  46286. res,
  46287. image: imageData,
  46288. isInline,
  46289. smask: smaskData,
  46290. mask: maskData,
  46291. pdfFunctionFactory,
  46292. localColorSpaceCache
  46293. });
  46294. }
  46295. static createMask({
  46296. imgArray,
  46297. width,
  46298. height,
  46299. imageIsFromDecodeStream,
  46300. inverseDecode
  46301. }) {
  46302. var computedLength = (width + 7 >> 3) * height;
  46303. var actualLength = imgArray.byteLength;
  46304. var haveFullData = computedLength === actualLength;
  46305. var data, i;
  46306. if (imageIsFromDecodeStream && (!inverseDecode || haveFullData)) {
  46307. data = imgArray;
  46308. } else if (!inverseDecode) {
  46309. data = new Uint8ClampedArray(actualLength);
  46310. data.set(imgArray);
  46311. } else {
  46312. data = new Uint8ClampedArray(computedLength);
  46313. data.set(imgArray);
  46314. for (i = actualLength; i < computedLength; i++) {
  46315. data[i] = 0xff;
  46316. }
  46317. }
  46318. if (inverseDecode) {
  46319. for (i = 0; i < actualLength; i++) {
  46320. data[i] ^= 0xff;
  46321. }
  46322. }
  46323. return {
  46324. data,
  46325. width,
  46326. height
  46327. };
  46328. }
  46329. get drawWidth() {
  46330. return Math.max(this.width, this.smask && this.smask.width || 0, this.mask && this.mask.width || 0);
  46331. }
  46332. get drawHeight() {
  46333. return Math.max(this.height, this.smask && this.smask.height || 0, this.mask && this.mask.height || 0);
  46334. }
  46335. decodeBuffer(buffer) {
  46336. var bpc = this.bpc;
  46337. var numComps = this.numComps;
  46338. var decodeAddends = this.decodeAddends;
  46339. var decodeCoefficients = this.decodeCoefficients;
  46340. var max = (1 << bpc) - 1;
  46341. var i, ii;
  46342. if (bpc === 1) {
  46343. for (i = 0, ii = buffer.length; i < ii; i++) {
  46344. buffer[i] = +!buffer[i];
  46345. }
  46346. return;
  46347. }
  46348. var index = 0;
  46349. for (i = 0, ii = this.width * this.height; i < ii; i++) {
  46350. for (var j = 0; j < numComps; j++) {
  46351. buffer[index] = decodeAndClamp(buffer[index], decodeAddends[j], decodeCoefficients[j], max);
  46352. index++;
  46353. }
  46354. }
  46355. }
  46356. getComponents(buffer) {
  46357. var bpc = this.bpc;
  46358. if (bpc === 8) {
  46359. return buffer;
  46360. }
  46361. var width = this.width;
  46362. var height = this.height;
  46363. var numComps = this.numComps;
  46364. var length = width * height * numComps;
  46365. var bufferPos = 0;
  46366. let output;
  46367. if (bpc <= 8) {
  46368. output = new Uint8Array(length);
  46369. } else if (bpc <= 16) {
  46370. output = new Uint16Array(length);
  46371. } else {
  46372. output = new Uint32Array(length);
  46373. }
  46374. var rowComps = width * numComps;
  46375. var max = (1 << bpc) - 1;
  46376. var i = 0,
  46377. ii,
  46378. buf;
  46379. if (bpc === 1) {
  46380. var mask, loop1End, loop2End;
  46381. for (var j = 0; j < height; j++) {
  46382. loop1End = i + (rowComps & ~7);
  46383. loop2End = i + rowComps;
  46384. while (i < loop1End) {
  46385. buf = buffer[bufferPos++];
  46386. output[i] = buf >> 7 & 1;
  46387. output[i + 1] = buf >> 6 & 1;
  46388. output[i + 2] = buf >> 5 & 1;
  46389. output[i + 3] = buf >> 4 & 1;
  46390. output[i + 4] = buf >> 3 & 1;
  46391. output[i + 5] = buf >> 2 & 1;
  46392. output[i + 6] = buf >> 1 & 1;
  46393. output[i + 7] = buf & 1;
  46394. i += 8;
  46395. }
  46396. if (i < loop2End) {
  46397. buf = buffer[bufferPos++];
  46398. mask = 128;
  46399. while (i < loop2End) {
  46400. output[i++] = +!!(buf & mask);
  46401. mask >>= 1;
  46402. }
  46403. }
  46404. }
  46405. } else {
  46406. var bits = 0;
  46407. buf = 0;
  46408. for (i = 0, ii = length; i < ii; ++i) {
  46409. if (i % rowComps === 0) {
  46410. buf = 0;
  46411. bits = 0;
  46412. }
  46413. while (bits < bpc) {
  46414. buf = buf << 8 | buffer[bufferPos++];
  46415. bits += 8;
  46416. }
  46417. var remainingBits = bits - bpc;
  46418. let value = buf >> remainingBits;
  46419. if (value < 0) {
  46420. value = 0;
  46421. } else if (value > max) {
  46422. value = max;
  46423. }
  46424. output[i] = value;
  46425. buf = buf & (1 << remainingBits) - 1;
  46426. bits = remainingBits;
  46427. }
  46428. }
  46429. return output;
  46430. }
  46431. fillOpacity(rgbaBuf, width, height, actualHeight, image) {
  46432. var smask = this.smask;
  46433. var mask = this.mask;
  46434. var alphaBuf, sw, sh, i, ii, j;
  46435. if (smask) {
  46436. sw = smask.width;
  46437. sh = smask.height;
  46438. alphaBuf = new Uint8ClampedArray(sw * sh);
  46439. smask.fillGrayBuffer(alphaBuf);
  46440. if (sw !== width || sh !== height) {
  46441. alphaBuf = resizeImageMask(alphaBuf, smask.bpc, sw, sh, width, height);
  46442. }
  46443. } else if (mask) {
  46444. if (mask instanceof PDFImage) {
  46445. sw = mask.width;
  46446. sh = mask.height;
  46447. alphaBuf = new Uint8ClampedArray(sw * sh);
  46448. mask.numComps = 1;
  46449. mask.fillGrayBuffer(alphaBuf);
  46450. for (i = 0, ii = sw * sh; i < ii; ++i) {
  46451. alphaBuf[i] = 255 - alphaBuf[i];
  46452. }
  46453. if (sw !== width || sh !== height) {
  46454. alphaBuf = resizeImageMask(alphaBuf, mask.bpc, sw, sh, width, height);
  46455. }
  46456. } else if (Array.isArray(mask)) {
  46457. alphaBuf = new Uint8ClampedArray(width * height);
  46458. var numComps = this.numComps;
  46459. for (i = 0, ii = width * height; i < ii; ++i) {
  46460. var opacity = 0;
  46461. var imageOffset = i * numComps;
  46462. for (j = 0; j < numComps; ++j) {
  46463. var color = image[imageOffset + j];
  46464. var maskOffset = j * 2;
  46465. if (color < mask[maskOffset] || color > mask[maskOffset + 1]) {
  46466. opacity = 255;
  46467. break;
  46468. }
  46469. }
  46470. alphaBuf[i] = opacity;
  46471. }
  46472. } else {
  46473. throw new _util.FormatError("Unknown mask format.");
  46474. }
  46475. }
  46476. if (alphaBuf) {
  46477. for (i = 0, j = 3, ii = width * actualHeight; i < ii; ++i, j += 4) {
  46478. rgbaBuf[j] = alphaBuf[i];
  46479. }
  46480. } else {
  46481. for (i = 0, j = 3, ii = width * actualHeight; i < ii; ++i, j += 4) {
  46482. rgbaBuf[j] = 255;
  46483. }
  46484. }
  46485. }
  46486. undoPreblend(buffer, width, height) {
  46487. var matte = this.smask && this.smask.matte;
  46488. if (!matte) {
  46489. return;
  46490. }
  46491. var matteRgb = this.colorSpace.getRgb(matte, 0);
  46492. var matteR = matteRgb[0];
  46493. var matteG = matteRgb[1];
  46494. var matteB = matteRgb[2];
  46495. var length = width * height * 4;
  46496. for (var i = 0; i < length; i += 4) {
  46497. var alpha = buffer[i + 3];
  46498. if (alpha === 0) {
  46499. buffer[i] = 255;
  46500. buffer[i + 1] = 255;
  46501. buffer[i + 2] = 255;
  46502. continue;
  46503. }
  46504. var k = 255 / alpha;
  46505. buffer[i] = (buffer[i] - matteR) * k + matteR;
  46506. buffer[i + 1] = (buffer[i + 1] - matteG) * k + matteG;
  46507. buffer[i + 2] = (buffer[i + 2] - matteB) * k + matteB;
  46508. }
  46509. }
  46510. createImageData(forceRGBA = false) {
  46511. var drawWidth = this.drawWidth;
  46512. var drawHeight = this.drawHeight;
  46513. var imgData = {
  46514. width: drawWidth,
  46515. height: drawHeight,
  46516. kind: 0,
  46517. data: null
  46518. };
  46519. var numComps = this.numComps;
  46520. var originalWidth = this.width;
  46521. var originalHeight = this.height;
  46522. var bpc = this.bpc;
  46523. var rowBytes = originalWidth * numComps * bpc + 7 >> 3;
  46524. var imgArray;
  46525. if (!forceRGBA) {
  46526. var kind;
  46527. if (this.colorSpace.name === "DeviceGray" && bpc === 1) {
  46528. kind = _util.ImageKind.GRAYSCALE_1BPP;
  46529. } else if (this.colorSpace.name === "DeviceRGB" && bpc === 8 && !this.needsDecode) {
  46530. kind = _util.ImageKind.RGB_24BPP;
  46531. }
  46532. if (kind && !this.smask && !this.mask && drawWidth === originalWidth && drawHeight === originalHeight) {
  46533. imgData.kind = kind;
  46534. imgArray = this.getImageBytes(originalHeight * rowBytes);
  46535. if (this.image instanceof _stream.DecodeStream) {
  46536. imgData.data = imgArray;
  46537. } else {
  46538. var newArray = new Uint8ClampedArray(imgArray.length);
  46539. newArray.set(imgArray);
  46540. imgData.data = newArray;
  46541. }
  46542. if (this.needsDecode) {
  46543. (0, _util.assert)(kind === _util.ImageKind.GRAYSCALE_1BPP, "PDFImage.createImageData: The image must be grayscale.");
  46544. var buffer = imgData.data;
  46545. for (var i = 0, ii = buffer.length; i < ii; i++) {
  46546. buffer[i] ^= 0xff;
  46547. }
  46548. }
  46549. return imgData;
  46550. }
  46551. if (this.image instanceof _jpeg_stream.JpegStream && !this.smask && !this.mask) {
  46552. let imageLength = originalHeight * rowBytes;
  46553. switch (this.colorSpace.name) {
  46554. case "DeviceGray":
  46555. imageLength *= 3;
  46556. case "DeviceRGB":
  46557. case "DeviceCMYK":
  46558. imgData.kind = _util.ImageKind.RGB_24BPP;
  46559. imgData.data = this.getImageBytes(imageLength, drawWidth, drawHeight, true);
  46560. return imgData;
  46561. }
  46562. }
  46563. }
  46564. imgArray = this.getImageBytes(originalHeight * rowBytes);
  46565. var actualHeight = 0 | imgArray.length / rowBytes * drawHeight / originalHeight;
  46566. var comps = this.getComponents(imgArray);
  46567. var alpha01, maybeUndoPreblend;
  46568. if (!forceRGBA && !this.smask && !this.mask) {
  46569. imgData.kind = _util.ImageKind.RGB_24BPP;
  46570. imgData.data = new Uint8ClampedArray(drawWidth * drawHeight * 3);
  46571. alpha01 = 0;
  46572. maybeUndoPreblend = false;
  46573. } else {
  46574. imgData.kind = _util.ImageKind.RGBA_32BPP;
  46575. imgData.data = new Uint8ClampedArray(drawWidth * drawHeight * 4);
  46576. alpha01 = 1;
  46577. maybeUndoPreblend = true;
  46578. this.fillOpacity(imgData.data, drawWidth, drawHeight, actualHeight, comps);
  46579. }
  46580. if (this.needsDecode) {
  46581. this.decodeBuffer(comps);
  46582. }
  46583. this.colorSpace.fillRgb(imgData.data, originalWidth, originalHeight, drawWidth, drawHeight, actualHeight, bpc, comps, alpha01);
  46584. if (maybeUndoPreblend) {
  46585. this.undoPreblend(imgData.data, drawWidth, actualHeight);
  46586. }
  46587. return imgData;
  46588. }
  46589. fillGrayBuffer(buffer) {
  46590. var numComps = this.numComps;
  46591. if (numComps !== 1) {
  46592. throw new _util.FormatError(`Reading gray scale from a color image: ${numComps}`);
  46593. }
  46594. var width = this.width;
  46595. var height = this.height;
  46596. var bpc = this.bpc;
  46597. var rowBytes = width * numComps * bpc + 7 >> 3;
  46598. var imgArray = this.getImageBytes(height * rowBytes);
  46599. var comps = this.getComponents(imgArray);
  46600. var i, length;
  46601. if (bpc === 1) {
  46602. length = width * height;
  46603. if (this.needsDecode) {
  46604. for (i = 0; i < length; ++i) {
  46605. buffer[i] = comps[i] - 1 & 255;
  46606. }
  46607. } else {
  46608. for (i = 0; i < length; ++i) {
  46609. buffer[i] = -comps[i] & 255;
  46610. }
  46611. }
  46612. return;
  46613. }
  46614. if (this.needsDecode) {
  46615. this.decodeBuffer(comps);
  46616. }
  46617. length = width * height;
  46618. var scale = 255 / ((1 << bpc) - 1);
  46619. for (i = 0; i < length; ++i) {
  46620. buffer[i] = scale * comps[i];
  46621. }
  46622. }
  46623. getImageBytes(length, drawWidth, drawHeight, forceRGB = false) {
  46624. this.image.reset();
  46625. this.image.drawWidth = drawWidth || this.width;
  46626. this.image.drawHeight = drawHeight || this.height;
  46627. this.image.forceRGB = !!forceRGB;
  46628. return this.image.getBytes(length, true);
  46629. }
  46630. }
  46631. exports.PDFImage = PDFImage;
  46632. /***/ }),
  46633. /* 46 */
  46634. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  46635. Object.defineProperty(exports, "__esModule", ({
  46636. value: true
  46637. }));
  46638. exports.incrementalUpdate = incrementalUpdate;
  46639. exports.writeDict = writeDict;
  46640. var _util = __w_pdfjs_require__(2);
  46641. var _primitives = __w_pdfjs_require__(5);
  46642. var _core_utils = __w_pdfjs_require__(8);
  46643. var _xml_parser = __w_pdfjs_require__(47);
  46644. var _crypto = __w_pdfjs_require__(22);
  46645. function writeDict(dict, buffer, transform) {
  46646. buffer.push("<<");
  46647. for (const key of dict.getKeys()) {
  46648. buffer.push(` /${(0, _core_utils.escapePDFName)(key)} `);
  46649. writeValue(dict.getRaw(key), buffer, transform);
  46650. }
  46651. buffer.push(">>");
  46652. }
  46653. function writeStream(stream, buffer, transform) {
  46654. writeDict(stream.dict, buffer, transform);
  46655. buffer.push(" stream\n");
  46656. let string = (0, _util.bytesToString)(stream.getBytes());
  46657. if (transform !== null) {
  46658. string = transform.encryptString(string);
  46659. }
  46660. buffer.push(string);
  46661. buffer.push("\nendstream\n");
  46662. }
  46663. function writeArray(array, buffer, transform) {
  46664. buffer.push("[");
  46665. let first = true;
  46666. for (const val of array) {
  46667. if (!first) {
  46668. buffer.push(" ");
  46669. } else {
  46670. first = false;
  46671. }
  46672. writeValue(val, buffer, transform);
  46673. }
  46674. buffer.push("]");
  46675. }
  46676. function numberToString(value) {
  46677. if (Number.isInteger(value)) {
  46678. return value.toString();
  46679. }
  46680. const roundedValue = Math.round(value * 100);
  46681. if (roundedValue % 100 === 0) {
  46682. return (roundedValue / 100).toString();
  46683. }
  46684. if (roundedValue % 10 === 0) {
  46685. return value.toFixed(1);
  46686. }
  46687. return value.toFixed(2);
  46688. }
  46689. function writeValue(value, buffer, transform) {
  46690. if ((0, _primitives.isName)(value)) {
  46691. buffer.push(`/${(0, _core_utils.escapePDFName)(value.name)}`);
  46692. } else if ((0, _primitives.isRef)(value)) {
  46693. buffer.push(`${value.num} ${value.gen} R`);
  46694. } else if (Array.isArray(value)) {
  46695. writeArray(value, buffer, transform);
  46696. } else if (typeof value === "string") {
  46697. if (transform !== null) {
  46698. value = transform.encryptString(value);
  46699. }
  46700. buffer.push(`(${(0, _util.escapeString)(value)})`);
  46701. } else if (typeof value === "number") {
  46702. buffer.push(numberToString(value));
  46703. } else if ((0, _primitives.isDict)(value)) {
  46704. writeDict(value, buffer, transform);
  46705. } else if ((0, _primitives.isStream)(value)) {
  46706. writeStream(value, buffer, transform);
  46707. }
  46708. }
  46709. function writeInt(number, size, offset, buffer) {
  46710. for (let i = size + offset - 1; i > offset - 1; i--) {
  46711. buffer[i] = number & 0xff;
  46712. number >>= 8;
  46713. }
  46714. return offset + size;
  46715. }
  46716. function writeString(string, offset, buffer) {
  46717. for (let i = 0, len = string.length; i < len; i++) {
  46718. buffer[offset + i] = string.charCodeAt(i) & 0xff;
  46719. }
  46720. }
  46721. function computeMD5(filesize, xrefInfo) {
  46722. const time = Math.floor(Date.now() / 1000);
  46723. const filename = xrefInfo.filename || "";
  46724. const md5Buffer = [time.toString(), filename, filesize.toString()];
  46725. let md5BufferLen = md5Buffer.reduce((a, str) => a + str.length, 0);
  46726. for (const value of Object.values(xrefInfo.info)) {
  46727. md5Buffer.push(value);
  46728. md5BufferLen += value.length;
  46729. }
  46730. const array = new Uint8Array(md5BufferLen);
  46731. let offset = 0;
  46732. for (const str of md5Buffer) {
  46733. writeString(str, offset, array);
  46734. offset += str.length;
  46735. }
  46736. return (0, _util.bytesToString)((0, _crypto.calculateMD5)(array));
  46737. }
  46738. function updateXFA(datasetsRef, newRefs, xref) {
  46739. if (datasetsRef === null || xref === null) {
  46740. return;
  46741. }
  46742. const datasets = xref.fetchIfRef(datasetsRef);
  46743. const str = (0, _util.bytesToString)(datasets.getBytes());
  46744. const xml = new _xml_parser.SimpleXMLParser({
  46745. hasAttributes: true
  46746. }).parseFromString(str);
  46747. for (const {
  46748. xfa
  46749. } of newRefs) {
  46750. if (!xfa) {
  46751. continue;
  46752. }
  46753. const {
  46754. path,
  46755. value
  46756. } = xfa;
  46757. if (!path) {
  46758. continue;
  46759. }
  46760. const node = xml.documentElement.searchNode((0, _core_utils.parseXFAPath)(path), 0);
  46761. if (node) {
  46762. node.childNodes = [new _xml_parser.SimpleDOMNode("#text", value)];
  46763. } else {
  46764. (0, _util.warn)(`Node not found for path: ${path}`);
  46765. }
  46766. }
  46767. const buffer = [];
  46768. xml.documentElement.dump(buffer);
  46769. let updatedXml = buffer.join("");
  46770. const encrypt = xref.encrypt;
  46771. if (encrypt) {
  46772. const transform = encrypt.createCipherTransform(datasetsRef.num, datasetsRef.gen);
  46773. updatedXml = transform.encryptString(updatedXml);
  46774. }
  46775. const data = `${datasetsRef.num} ${datasetsRef.gen} obj\n` + `<< /Type /EmbeddedFile /Length ${updatedXml.length}>>\nstream\n` + updatedXml + "\nendstream\nendobj\n";
  46776. newRefs.push({
  46777. ref: datasetsRef,
  46778. data
  46779. });
  46780. }
  46781. function incrementalUpdate({
  46782. originalData,
  46783. xrefInfo,
  46784. newRefs,
  46785. xref = null,
  46786. datasetsRef = null
  46787. }) {
  46788. updateXFA(datasetsRef, newRefs, xref);
  46789. const newXref = new _primitives.Dict(null);
  46790. const refForXrefTable = xrefInfo.newRef;
  46791. let buffer, baseOffset;
  46792. const lastByte = originalData[originalData.length - 1];
  46793. if (lastByte === 0x0a || lastByte === 0x0d) {
  46794. buffer = [];
  46795. baseOffset = originalData.length;
  46796. } else {
  46797. buffer = ["\n"];
  46798. baseOffset = originalData.length + 1;
  46799. }
  46800. newXref.set("Size", refForXrefTable.num + 1);
  46801. newXref.set("Prev", xrefInfo.startXRef);
  46802. newXref.set("Type", _primitives.Name.get("XRef"));
  46803. if (xrefInfo.rootRef !== null) {
  46804. newXref.set("Root", xrefInfo.rootRef);
  46805. }
  46806. if (xrefInfo.infoRef !== null) {
  46807. newXref.set("Info", xrefInfo.infoRef);
  46808. }
  46809. if (xrefInfo.encrypt !== null) {
  46810. newXref.set("Encrypt", xrefInfo.encrypt);
  46811. }
  46812. newRefs.push({
  46813. ref: refForXrefTable,
  46814. data: ""
  46815. });
  46816. newRefs = newRefs.sort((a, b) => {
  46817. return a.ref.num - b.ref.num;
  46818. });
  46819. const xrefTableData = [[0, 1, 0xffff]];
  46820. const indexes = [0, 1];
  46821. let maxOffset = 0;
  46822. for (const {
  46823. ref,
  46824. data
  46825. } of newRefs) {
  46826. maxOffset = Math.max(maxOffset, baseOffset);
  46827. xrefTableData.push([1, baseOffset, Math.min(ref.gen, 0xffff)]);
  46828. baseOffset += data.length;
  46829. indexes.push(ref.num);
  46830. indexes.push(1);
  46831. buffer.push(data);
  46832. }
  46833. newXref.set("Index", indexes);
  46834. if (xrefInfo.fileIds.length !== 0) {
  46835. const md5 = computeMD5(baseOffset, xrefInfo);
  46836. newXref.set("ID", [xrefInfo.fileIds[0], md5]);
  46837. }
  46838. const offsetSize = Math.ceil(Math.log2(maxOffset) / 8);
  46839. const sizes = [1, offsetSize, 2];
  46840. const structSize = sizes[0] + sizes[1] + sizes[2];
  46841. const tableLength = structSize * xrefTableData.length;
  46842. newXref.set("W", sizes);
  46843. newXref.set("Length", tableLength);
  46844. buffer.push(`${refForXrefTable.num} ${refForXrefTable.gen} obj\n`);
  46845. writeDict(newXref, buffer, null);
  46846. buffer.push(" stream\n");
  46847. const bufferLen = buffer.reduce((a, str) => a + str.length, 0);
  46848. const footer = `\nendstream\nendobj\nstartxref\n${baseOffset}\n%%EOF\n`;
  46849. const array = new Uint8Array(originalData.length + bufferLen + tableLength + footer.length);
  46850. array.set(originalData);
  46851. let offset = originalData.length;
  46852. for (const str of buffer) {
  46853. writeString(str, offset, array);
  46854. offset += str.length;
  46855. }
  46856. for (const [type, objOffset, gen] of xrefTableData) {
  46857. offset = writeInt(type, sizes[0], offset, array);
  46858. offset = writeInt(objOffset, sizes[1], offset, array);
  46859. offset = writeInt(gen, sizes[2], offset, array);
  46860. }
  46861. writeString(footer, offset, array);
  46862. return array;
  46863. }
  46864. /***/ }),
  46865. /* 47 */
  46866. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  46867. Object.defineProperty(exports, "__esModule", ({
  46868. value: true
  46869. }));
  46870. exports.SimpleXMLParser = exports.SimpleDOMNode = void 0;
  46871. var _util = __w_pdfjs_require__(2);
  46872. const XMLParserErrorCode = {
  46873. NoError: 0,
  46874. EndOfDocument: -1,
  46875. UnterminatedCdat: -2,
  46876. UnterminatedXmlDeclaration: -3,
  46877. UnterminatedDoctypeDeclaration: -4,
  46878. UnterminatedComment: -5,
  46879. MalformedElement: -6,
  46880. OutOfMemory: -7,
  46881. UnterminatedAttributeValue: -8,
  46882. UnterminatedElement: -9,
  46883. ElementNeverBegun: -10
  46884. };
  46885. function isWhitespace(s, index) {
  46886. const ch = s[index];
  46887. return ch === " " || ch === "\n" || ch === "\r" || ch === "\t";
  46888. }
  46889. function isWhitespaceString(s) {
  46890. for (let i = 0, ii = s.length; i < ii; i++) {
  46891. if (!isWhitespace(s, i)) {
  46892. return false;
  46893. }
  46894. }
  46895. return true;
  46896. }
  46897. class XMLParserBase {
  46898. _resolveEntities(s) {
  46899. return s.replace(/&([^;]+);/g, (all, entity) => {
  46900. if (entity.substring(0, 2) === "#x") {
  46901. return String.fromCodePoint(parseInt(entity.substring(2), 16));
  46902. } else if (entity.substring(0, 1) === "#") {
  46903. return String.fromCodePoint(parseInt(entity.substring(1), 10));
  46904. }
  46905. switch (entity) {
  46906. case "lt":
  46907. return "<";
  46908. case "gt":
  46909. return ">";
  46910. case "amp":
  46911. return "&";
  46912. case "quot":
  46913. return '"';
  46914. }
  46915. return this.onResolveEntity(entity);
  46916. });
  46917. }
  46918. _parseContent(s, start) {
  46919. const attributes = [];
  46920. let pos = start;
  46921. function skipWs() {
  46922. while (pos < s.length && isWhitespace(s, pos)) {
  46923. ++pos;
  46924. }
  46925. }
  46926. while (pos < s.length && !isWhitespace(s, pos) && s[pos] !== ">" && s[pos] !== "/") {
  46927. ++pos;
  46928. }
  46929. const name = s.substring(start, pos);
  46930. skipWs();
  46931. while (pos < s.length && s[pos] !== ">" && s[pos] !== "/" && s[pos] !== "?") {
  46932. skipWs();
  46933. let attrName = "",
  46934. attrValue = "";
  46935. while (pos < s.length && !isWhitespace(s, pos) && s[pos] !== "=") {
  46936. attrName += s[pos];
  46937. ++pos;
  46938. }
  46939. skipWs();
  46940. if (s[pos] !== "=") {
  46941. return null;
  46942. }
  46943. ++pos;
  46944. skipWs();
  46945. const attrEndChar = s[pos];
  46946. if (attrEndChar !== '"' && attrEndChar !== "'") {
  46947. return null;
  46948. }
  46949. const attrEndIndex = s.indexOf(attrEndChar, ++pos);
  46950. if (attrEndIndex < 0) {
  46951. return null;
  46952. }
  46953. attrValue = s.substring(pos, attrEndIndex);
  46954. attributes.push({
  46955. name: attrName,
  46956. value: this._resolveEntities(attrValue)
  46957. });
  46958. pos = attrEndIndex + 1;
  46959. skipWs();
  46960. }
  46961. return {
  46962. name,
  46963. attributes,
  46964. parsed: pos - start
  46965. };
  46966. }
  46967. _parseProcessingInstruction(s, start) {
  46968. let pos = start;
  46969. function skipWs() {
  46970. while (pos < s.length && isWhitespace(s, pos)) {
  46971. ++pos;
  46972. }
  46973. }
  46974. while (pos < s.length && !isWhitespace(s, pos) && s[pos] !== ">" && s[pos] !== "/") {
  46975. ++pos;
  46976. }
  46977. const name = s.substring(start, pos);
  46978. skipWs();
  46979. const attrStart = pos;
  46980. while (pos < s.length && (s[pos] !== "?" || s[pos + 1] !== ">")) {
  46981. ++pos;
  46982. }
  46983. const value = s.substring(attrStart, pos);
  46984. return {
  46985. name,
  46986. value,
  46987. parsed: pos - start
  46988. };
  46989. }
  46990. parseXml(s) {
  46991. let i = 0;
  46992. while (i < s.length) {
  46993. const ch = s[i];
  46994. let j = i;
  46995. if (ch === "<") {
  46996. ++j;
  46997. const ch2 = s[j];
  46998. let q;
  46999. switch (ch2) {
  47000. case "/":
  47001. ++j;
  47002. q = s.indexOf(">", j);
  47003. if (q < 0) {
  47004. this.onError(XMLParserErrorCode.UnterminatedElement);
  47005. return;
  47006. }
  47007. this.onEndElement(s.substring(j, q));
  47008. j = q + 1;
  47009. break;
  47010. case "?":
  47011. ++j;
  47012. const pi = this._parseProcessingInstruction(s, j);
  47013. if (s.substring(j + pi.parsed, j + pi.parsed + 2) !== "?>") {
  47014. this.onError(XMLParserErrorCode.UnterminatedXmlDeclaration);
  47015. return;
  47016. }
  47017. this.onPi(pi.name, pi.value);
  47018. j += pi.parsed + 2;
  47019. break;
  47020. case "!":
  47021. if (s.substring(j + 1, j + 3) === "--") {
  47022. q = s.indexOf("-->", j + 3);
  47023. if (q < 0) {
  47024. this.onError(XMLParserErrorCode.UnterminatedComment);
  47025. return;
  47026. }
  47027. this.onComment(s.substring(j + 3, q));
  47028. j = q + 3;
  47029. } else if (s.substring(j + 1, j + 8) === "[CDATA[") {
  47030. q = s.indexOf("]]>", j + 8);
  47031. if (q < 0) {
  47032. this.onError(XMLParserErrorCode.UnterminatedCdat);
  47033. return;
  47034. }
  47035. this.onCdata(s.substring(j + 8, q));
  47036. j = q + 3;
  47037. } else if (s.substring(j + 1, j + 8) === "DOCTYPE") {
  47038. const q2 = s.indexOf("[", j + 8);
  47039. let complexDoctype = false;
  47040. q = s.indexOf(">", j + 8);
  47041. if (q < 0) {
  47042. this.onError(XMLParserErrorCode.UnterminatedDoctypeDeclaration);
  47043. return;
  47044. }
  47045. if (q2 > 0 && q > q2) {
  47046. q = s.indexOf("]>", j + 8);
  47047. if (q < 0) {
  47048. this.onError(XMLParserErrorCode.UnterminatedDoctypeDeclaration);
  47049. return;
  47050. }
  47051. complexDoctype = true;
  47052. }
  47053. const doctypeContent = s.substring(j + 8, q + (complexDoctype ? 1 : 0));
  47054. this.onDoctype(doctypeContent);
  47055. j = q + (complexDoctype ? 2 : 1);
  47056. } else {
  47057. this.onError(XMLParserErrorCode.MalformedElement);
  47058. return;
  47059. }
  47060. break;
  47061. default:
  47062. const content = this._parseContent(s, j);
  47063. if (content === null) {
  47064. this.onError(XMLParserErrorCode.MalformedElement);
  47065. return;
  47066. }
  47067. let isClosed = false;
  47068. if (s.substring(j + content.parsed, j + content.parsed + 2) === "/>") {
  47069. isClosed = true;
  47070. } else if (s.substring(j + content.parsed, j + content.parsed + 1) !== ">") {
  47071. this.onError(XMLParserErrorCode.UnterminatedElement);
  47072. return;
  47073. }
  47074. this.onBeginElement(content.name, content.attributes, isClosed);
  47075. j += content.parsed + (isClosed ? 2 : 1);
  47076. break;
  47077. }
  47078. } else {
  47079. while (j < s.length && s[j] !== "<") {
  47080. j++;
  47081. }
  47082. const text = s.substring(i, j);
  47083. this.onText(this._resolveEntities(text));
  47084. }
  47085. i = j;
  47086. }
  47087. }
  47088. onResolveEntity(name) {
  47089. return `&${name};`;
  47090. }
  47091. onPi(name, value) {}
  47092. onComment(text) {}
  47093. onCdata(text) {}
  47094. onDoctype(doctypeContent) {}
  47095. onText(text) {}
  47096. onBeginElement(name, attributes, isEmpty) {}
  47097. onEndElement(name) {}
  47098. onError(code) {}
  47099. }
  47100. class SimpleDOMNode {
  47101. constructor(nodeName, nodeValue) {
  47102. this.nodeName = nodeName;
  47103. this.nodeValue = nodeValue;
  47104. Object.defineProperty(this, "parentNode", {
  47105. value: null,
  47106. writable: true
  47107. });
  47108. }
  47109. get firstChild() {
  47110. return this.childNodes && this.childNodes[0];
  47111. }
  47112. get nextSibling() {
  47113. const childNodes = this.parentNode.childNodes;
  47114. if (!childNodes) {
  47115. return undefined;
  47116. }
  47117. const index = childNodes.indexOf(this);
  47118. if (index === -1) {
  47119. return undefined;
  47120. }
  47121. return childNodes[index + 1];
  47122. }
  47123. get textContent() {
  47124. if (!this.childNodes) {
  47125. return this.nodeValue || "";
  47126. }
  47127. return this.childNodes.map(function (child) {
  47128. return child.textContent;
  47129. }).join("");
  47130. }
  47131. hasChildNodes() {
  47132. return this.childNodes && this.childNodes.length > 0;
  47133. }
  47134. searchNode(paths, pos) {
  47135. if (pos >= paths.length) {
  47136. return this;
  47137. }
  47138. const component = paths[pos];
  47139. const stack = [];
  47140. let node = this;
  47141. while (true) {
  47142. if (component.name === node.nodeName) {
  47143. if (component.pos === 0) {
  47144. const res = node.searchNode(paths, pos + 1);
  47145. if (res !== null) {
  47146. return res;
  47147. }
  47148. } else if (stack.length === 0) {
  47149. return null;
  47150. } else {
  47151. const [parent] = stack.pop();
  47152. let siblingPos = 0;
  47153. for (const child of parent.childNodes) {
  47154. if (component.name === child.nodeName) {
  47155. if (siblingPos === component.pos) {
  47156. return child.searchNode(paths, pos + 1);
  47157. }
  47158. siblingPos++;
  47159. }
  47160. }
  47161. return node.searchNode(paths, pos + 1);
  47162. }
  47163. }
  47164. if (node.childNodes && node.childNodes.length !== 0) {
  47165. stack.push([node, 0]);
  47166. node = node.childNodes[0];
  47167. } else if (stack.length === 0) {
  47168. return null;
  47169. } else {
  47170. while (stack.length !== 0) {
  47171. const [parent, currentPos] = stack.pop();
  47172. const newPos = currentPos + 1;
  47173. if (newPos < parent.childNodes.length) {
  47174. stack.push([parent, newPos]);
  47175. node = parent.childNodes[newPos];
  47176. break;
  47177. }
  47178. }
  47179. if (stack.length === 0) {
  47180. return null;
  47181. }
  47182. }
  47183. }
  47184. }
  47185. dump(buffer) {
  47186. if (this.nodeName === "#text") {
  47187. buffer.push((0, _util.encodeToXmlString)(this.nodeValue));
  47188. return;
  47189. }
  47190. buffer.push(`<${this.nodeName}`);
  47191. if (this.attributes) {
  47192. for (const attribute of this.attributes) {
  47193. buffer.push(` ${attribute.name}="${(0, _util.encodeToXmlString)(attribute.value)}"`);
  47194. }
  47195. }
  47196. if (this.hasChildNodes()) {
  47197. buffer.push(">");
  47198. for (const child of this.childNodes) {
  47199. child.dump(buffer);
  47200. }
  47201. buffer.push(`</${this.nodeName}>`);
  47202. } else if (this.nodeValue) {
  47203. buffer.push(`>${(0, _util.encodeToXmlString)(this.nodeValue)}</${this.nodeName}>`);
  47204. } else {
  47205. buffer.push("/>");
  47206. }
  47207. }
  47208. }
  47209. exports.SimpleDOMNode = SimpleDOMNode;
  47210. class SimpleXMLParser extends XMLParserBase {
  47211. constructor({
  47212. hasAttributes = false,
  47213. lowerCaseName = false
  47214. }) {
  47215. super();
  47216. this._currentFragment = null;
  47217. this._stack = null;
  47218. this._errorCode = XMLParserErrorCode.NoError;
  47219. this._hasAttributes = hasAttributes;
  47220. this._lowerCaseName = lowerCaseName;
  47221. }
  47222. parseFromString(data) {
  47223. this._currentFragment = [];
  47224. this._stack = [];
  47225. this._errorCode = XMLParserErrorCode.NoError;
  47226. this.parseXml(data);
  47227. if (this._errorCode !== XMLParserErrorCode.NoError) {
  47228. return undefined;
  47229. }
  47230. const [documentElement] = this._currentFragment;
  47231. if (!documentElement) {
  47232. return undefined;
  47233. }
  47234. return {
  47235. documentElement
  47236. };
  47237. }
  47238. onResolveEntity(name) {
  47239. switch (name) {
  47240. case "apos":
  47241. return "'";
  47242. }
  47243. return super.onResolveEntity(name);
  47244. }
  47245. onText(text) {
  47246. if (isWhitespaceString(text)) {
  47247. return;
  47248. }
  47249. const node = new SimpleDOMNode("#text", text);
  47250. this._currentFragment.push(node);
  47251. }
  47252. onCdata(text) {
  47253. const node = new SimpleDOMNode("#text", text);
  47254. this._currentFragment.push(node);
  47255. }
  47256. onBeginElement(name, attributes, isEmpty) {
  47257. if (this._lowerCaseName) {
  47258. name = name.toLowerCase();
  47259. }
  47260. const node = new SimpleDOMNode(name);
  47261. node.childNodes = [];
  47262. if (this._hasAttributes) {
  47263. node.attributes = attributes;
  47264. }
  47265. this._currentFragment.push(node);
  47266. if (isEmpty) {
  47267. return;
  47268. }
  47269. this._stack.push(this._currentFragment);
  47270. this._currentFragment = node.childNodes;
  47271. }
  47272. onEndElement(name) {
  47273. this._currentFragment = this._stack.pop() || [];
  47274. const lastElement = this._currentFragment[this._currentFragment.length - 1];
  47275. if (!lastElement) {
  47276. return;
  47277. }
  47278. for (let i = 0, ii = lastElement.childNodes.length; i < ii; i++) {
  47279. lastElement.childNodes[i].parentNode = lastElement;
  47280. }
  47281. }
  47282. onError(code) {
  47283. this._errorCode = code;
  47284. }
  47285. }
  47286. exports.SimpleXMLParser = SimpleXMLParser;
  47287. /***/ }),
  47288. /* 48 */
  47289. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  47290. Object.defineProperty(exports, "__esModule", ({
  47291. value: true
  47292. }));
  47293. exports.MessageHandler = void 0;
  47294. var _util = __w_pdfjs_require__(2);
  47295. const CallbackKind = {
  47296. UNKNOWN: 0,
  47297. DATA: 1,
  47298. ERROR: 2
  47299. };
  47300. const StreamKind = {
  47301. UNKNOWN: 0,
  47302. CANCEL: 1,
  47303. CANCEL_COMPLETE: 2,
  47304. CLOSE: 3,
  47305. ENQUEUE: 4,
  47306. ERROR: 5,
  47307. PULL: 6,
  47308. PULL_COMPLETE: 7,
  47309. START_COMPLETE: 8
  47310. };
  47311. function wrapReason(reason) {
  47312. if (typeof reason !== "object" || reason === null) {
  47313. return reason;
  47314. }
  47315. switch (reason.name) {
  47316. case "AbortException":
  47317. return new _util.AbortException(reason.message);
  47318. case "MissingPDFException":
  47319. return new _util.MissingPDFException(reason.message);
  47320. case "UnexpectedResponseException":
  47321. return new _util.UnexpectedResponseException(reason.message, reason.status);
  47322. case "UnknownErrorException":
  47323. return new _util.UnknownErrorException(reason.message, reason.details);
  47324. default:
  47325. return new _util.UnknownErrorException(reason.message, reason.toString());
  47326. }
  47327. }
  47328. class MessageHandler {
  47329. constructor(sourceName, targetName, comObj) {
  47330. this.sourceName = sourceName;
  47331. this.targetName = targetName;
  47332. this.comObj = comObj;
  47333. this.callbackId = 1;
  47334. this.streamId = 1;
  47335. this.postMessageTransfers = true;
  47336. this.streamSinks = Object.create(null);
  47337. this.streamControllers = Object.create(null);
  47338. this.callbackCapabilities = Object.create(null);
  47339. this.actionHandler = Object.create(null);
  47340. this._onComObjOnMessage = event => {
  47341. const data = event.data;
  47342. if (data.targetName !== this.sourceName) {
  47343. return;
  47344. }
  47345. if (data.stream) {
  47346. this._processStreamMessage(data);
  47347. return;
  47348. }
  47349. if (data.callback) {
  47350. const callbackId = data.callbackId;
  47351. const capability = this.callbackCapabilities[callbackId];
  47352. if (!capability) {
  47353. throw new Error(`Cannot resolve callback ${callbackId}`);
  47354. }
  47355. delete this.callbackCapabilities[callbackId];
  47356. if (data.callback === CallbackKind.DATA) {
  47357. capability.resolve(data.data);
  47358. } else if (data.callback === CallbackKind.ERROR) {
  47359. capability.reject(wrapReason(data.reason));
  47360. } else {
  47361. throw new Error("Unexpected callback case");
  47362. }
  47363. return;
  47364. }
  47365. const action = this.actionHandler[data.action];
  47366. if (!action) {
  47367. throw new Error(`Unknown action from worker: ${data.action}`);
  47368. }
  47369. if (data.callbackId) {
  47370. const cbSourceName = this.sourceName;
  47371. const cbTargetName = data.sourceName;
  47372. new Promise(function (resolve) {
  47373. resolve(action(data.data));
  47374. }).then(function (result) {
  47375. comObj.postMessage({
  47376. sourceName: cbSourceName,
  47377. targetName: cbTargetName,
  47378. callback: CallbackKind.DATA,
  47379. callbackId: data.callbackId,
  47380. data: result
  47381. });
  47382. }, function (reason) {
  47383. comObj.postMessage({
  47384. sourceName: cbSourceName,
  47385. targetName: cbTargetName,
  47386. callback: CallbackKind.ERROR,
  47387. callbackId: data.callbackId,
  47388. reason: wrapReason(reason)
  47389. });
  47390. });
  47391. return;
  47392. }
  47393. if (data.streamId) {
  47394. this._createStreamSink(data);
  47395. return;
  47396. }
  47397. action(data.data);
  47398. };
  47399. comObj.addEventListener("message", this._onComObjOnMessage);
  47400. }
  47401. on(actionName, handler) {
  47402. const ah = this.actionHandler;
  47403. if (ah[actionName]) {
  47404. throw new Error(`There is already an actionName called "${actionName}"`);
  47405. }
  47406. ah[actionName] = handler;
  47407. }
  47408. send(actionName, data, transfers) {
  47409. this._postMessage({
  47410. sourceName: this.sourceName,
  47411. targetName: this.targetName,
  47412. action: actionName,
  47413. data
  47414. }, transfers);
  47415. }
  47416. sendWithPromise(actionName, data, transfers) {
  47417. const callbackId = this.callbackId++;
  47418. const capability = (0, _util.createPromiseCapability)();
  47419. this.callbackCapabilities[callbackId] = capability;
  47420. try {
  47421. this._postMessage({
  47422. sourceName: this.sourceName,
  47423. targetName: this.targetName,
  47424. action: actionName,
  47425. callbackId,
  47426. data
  47427. }, transfers);
  47428. } catch (ex) {
  47429. capability.reject(ex);
  47430. }
  47431. return capability.promise;
  47432. }
  47433. sendWithStream(actionName, data, queueingStrategy, transfers) {
  47434. const streamId = this.streamId++;
  47435. const sourceName = this.sourceName;
  47436. const targetName = this.targetName;
  47437. const comObj = this.comObj;
  47438. return new ReadableStream({
  47439. start: controller => {
  47440. const startCapability = (0, _util.createPromiseCapability)();
  47441. this.streamControllers[streamId] = {
  47442. controller,
  47443. startCall: startCapability,
  47444. pullCall: null,
  47445. cancelCall: null,
  47446. isClosed: false
  47447. };
  47448. this._postMessage({
  47449. sourceName,
  47450. targetName,
  47451. action: actionName,
  47452. streamId,
  47453. data,
  47454. desiredSize: controller.desiredSize
  47455. }, transfers);
  47456. return startCapability.promise;
  47457. },
  47458. pull: controller => {
  47459. const pullCapability = (0, _util.createPromiseCapability)();
  47460. this.streamControllers[streamId].pullCall = pullCapability;
  47461. comObj.postMessage({
  47462. sourceName,
  47463. targetName,
  47464. stream: StreamKind.PULL,
  47465. streamId,
  47466. desiredSize: controller.desiredSize
  47467. });
  47468. return pullCapability.promise;
  47469. },
  47470. cancel: reason => {
  47471. (0, _util.assert)(reason instanceof Error, "cancel must have a valid reason");
  47472. const cancelCapability = (0, _util.createPromiseCapability)();
  47473. this.streamControllers[streamId].cancelCall = cancelCapability;
  47474. this.streamControllers[streamId].isClosed = true;
  47475. comObj.postMessage({
  47476. sourceName,
  47477. targetName,
  47478. stream: StreamKind.CANCEL,
  47479. streamId,
  47480. reason: wrapReason(reason)
  47481. });
  47482. return cancelCapability.promise;
  47483. }
  47484. }, queueingStrategy);
  47485. }
  47486. _createStreamSink(data) {
  47487. const self = this;
  47488. const action = this.actionHandler[data.action];
  47489. const streamId = data.streamId;
  47490. const sourceName = this.sourceName;
  47491. const targetName = data.sourceName;
  47492. const comObj = this.comObj;
  47493. const streamSink = {
  47494. enqueue(chunk, size = 1, transfers) {
  47495. if (this.isCancelled) {
  47496. return;
  47497. }
  47498. const lastDesiredSize = this.desiredSize;
  47499. this.desiredSize -= size;
  47500. if (lastDesiredSize > 0 && this.desiredSize <= 0) {
  47501. this.sinkCapability = (0, _util.createPromiseCapability)();
  47502. this.ready = this.sinkCapability.promise;
  47503. }
  47504. self._postMessage({
  47505. sourceName,
  47506. targetName,
  47507. stream: StreamKind.ENQUEUE,
  47508. streamId,
  47509. chunk
  47510. }, transfers);
  47511. },
  47512. close() {
  47513. if (this.isCancelled) {
  47514. return;
  47515. }
  47516. this.isCancelled = true;
  47517. comObj.postMessage({
  47518. sourceName,
  47519. targetName,
  47520. stream: StreamKind.CLOSE,
  47521. streamId
  47522. });
  47523. delete self.streamSinks[streamId];
  47524. },
  47525. error(reason) {
  47526. (0, _util.assert)(reason instanceof Error, "error must have a valid reason");
  47527. if (this.isCancelled) {
  47528. return;
  47529. }
  47530. this.isCancelled = true;
  47531. comObj.postMessage({
  47532. sourceName,
  47533. targetName,
  47534. stream: StreamKind.ERROR,
  47535. streamId,
  47536. reason: wrapReason(reason)
  47537. });
  47538. },
  47539. sinkCapability: (0, _util.createPromiseCapability)(),
  47540. onPull: null,
  47541. onCancel: null,
  47542. isCancelled: false,
  47543. desiredSize: data.desiredSize,
  47544. ready: null
  47545. };
  47546. streamSink.sinkCapability.resolve();
  47547. streamSink.ready = streamSink.sinkCapability.promise;
  47548. this.streamSinks[streamId] = streamSink;
  47549. new Promise(function (resolve) {
  47550. resolve(action(data.data, streamSink));
  47551. }).then(function () {
  47552. comObj.postMessage({
  47553. sourceName,
  47554. targetName,
  47555. stream: StreamKind.START_COMPLETE,
  47556. streamId,
  47557. success: true
  47558. });
  47559. }, function (reason) {
  47560. comObj.postMessage({
  47561. sourceName,
  47562. targetName,
  47563. stream: StreamKind.START_COMPLETE,
  47564. streamId,
  47565. reason: wrapReason(reason)
  47566. });
  47567. });
  47568. }
  47569. _processStreamMessage(data) {
  47570. const streamId = data.streamId;
  47571. const sourceName = this.sourceName;
  47572. const targetName = data.sourceName;
  47573. const comObj = this.comObj;
  47574. switch (data.stream) {
  47575. case StreamKind.START_COMPLETE:
  47576. if (data.success) {
  47577. this.streamControllers[streamId].startCall.resolve();
  47578. } else {
  47579. this.streamControllers[streamId].startCall.reject(wrapReason(data.reason));
  47580. }
  47581. break;
  47582. case StreamKind.PULL_COMPLETE:
  47583. if (data.success) {
  47584. this.streamControllers[streamId].pullCall.resolve();
  47585. } else {
  47586. this.streamControllers[streamId].pullCall.reject(wrapReason(data.reason));
  47587. }
  47588. break;
  47589. case StreamKind.PULL:
  47590. if (!this.streamSinks[streamId]) {
  47591. comObj.postMessage({
  47592. sourceName,
  47593. targetName,
  47594. stream: StreamKind.PULL_COMPLETE,
  47595. streamId,
  47596. success: true
  47597. });
  47598. break;
  47599. }
  47600. if (this.streamSinks[streamId].desiredSize <= 0 && data.desiredSize > 0) {
  47601. this.streamSinks[streamId].sinkCapability.resolve();
  47602. }
  47603. this.streamSinks[streamId].desiredSize = data.desiredSize;
  47604. const {
  47605. onPull
  47606. } = this.streamSinks[data.streamId];
  47607. new Promise(function (resolve) {
  47608. resolve(onPull && onPull());
  47609. }).then(function () {
  47610. comObj.postMessage({
  47611. sourceName,
  47612. targetName,
  47613. stream: StreamKind.PULL_COMPLETE,
  47614. streamId,
  47615. success: true
  47616. });
  47617. }, function (reason) {
  47618. comObj.postMessage({
  47619. sourceName,
  47620. targetName,
  47621. stream: StreamKind.PULL_COMPLETE,
  47622. streamId,
  47623. reason: wrapReason(reason)
  47624. });
  47625. });
  47626. break;
  47627. case StreamKind.ENQUEUE:
  47628. (0, _util.assert)(this.streamControllers[streamId], "enqueue should have stream controller");
  47629. if (this.streamControllers[streamId].isClosed) {
  47630. break;
  47631. }
  47632. this.streamControllers[streamId].controller.enqueue(data.chunk);
  47633. break;
  47634. case StreamKind.CLOSE:
  47635. (0, _util.assert)(this.streamControllers[streamId], "close should have stream controller");
  47636. if (this.streamControllers[streamId].isClosed) {
  47637. break;
  47638. }
  47639. this.streamControllers[streamId].isClosed = true;
  47640. this.streamControllers[streamId].controller.close();
  47641. this._deleteStreamController(streamId);
  47642. break;
  47643. case StreamKind.ERROR:
  47644. (0, _util.assert)(this.streamControllers[streamId], "error should have stream controller");
  47645. this.streamControllers[streamId].controller.error(wrapReason(data.reason));
  47646. this._deleteStreamController(streamId);
  47647. break;
  47648. case StreamKind.CANCEL_COMPLETE:
  47649. if (data.success) {
  47650. this.streamControllers[streamId].cancelCall.resolve();
  47651. } else {
  47652. this.streamControllers[streamId].cancelCall.reject(wrapReason(data.reason));
  47653. }
  47654. this._deleteStreamController(streamId);
  47655. break;
  47656. case StreamKind.CANCEL:
  47657. if (!this.streamSinks[streamId]) {
  47658. break;
  47659. }
  47660. const {
  47661. onCancel
  47662. } = this.streamSinks[data.streamId];
  47663. new Promise(function (resolve) {
  47664. resolve(onCancel && onCancel(wrapReason(data.reason)));
  47665. }).then(function () {
  47666. comObj.postMessage({
  47667. sourceName,
  47668. targetName,
  47669. stream: StreamKind.CANCEL_COMPLETE,
  47670. streamId,
  47671. success: true
  47672. });
  47673. }, function (reason) {
  47674. comObj.postMessage({
  47675. sourceName,
  47676. targetName,
  47677. stream: StreamKind.CANCEL_COMPLETE,
  47678. streamId,
  47679. reason: wrapReason(reason)
  47680. });
  47681. });
  47682. this.streamSinks[streamId].sinkCapability.reject(wrapReason(data.reason));
  47683. this.streamSinks[streamId].isCancelled = true;
  47684. delete this.streamSinks[streamId];
  47685. break;
  47686. default:
  47687. throw new Error("Unexpected stream case");
  47688. }
  47689. }
  47690. async _deleteStreamController(streamId) {
  47691. await Promise.allSettled([this.streamControllers[streamId].startCall, this.streamControllers[streamId].pullCall, this.streamControllers[streamId].cancelCall].map(function (capability) {
  47692. return capability && capability.promise;
  47693. }));
  47694. delete this.streamControllers[streamId];
  47695. }
  47696. _postMessage(message, transfers) {
  47697. if (transfers && this.postMessageTransfers) {
  47698. this.comObj.postMessage(message, transfers);
  47699. } else {
  47700. this.comObj.postMessage(message);
  47701. }
  47702. }
  47703. destroy() {
  47704. this.comObj.removeEventListener("message", this._onComObjOnMessage);
  47705. }
  47706. }
  47707. exports.MessageHandler = MessageHandler;
  47708. /***/ }),
  47709. /* 49 */
  47710. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  47711. Object.defineProperty(exports, "__esModule", ({
  47712. value: true
  47713. }));
  47714. exports.PDFWorkerStream = void 0;
  47715. var _util = __w_pdfjs_require__(2);
  47716. class PDFWorkerStream {
  47717. constructor(msgHandler) {
  47718. this._msgHandler = msgHandler;
  47719. this._contentLength = null;
  47720. this._fullRequestReader = null;
  47721. this._rangeRequestReaders = [];
  47722. }
  47723. getFullReader() {
  47724. (0, _util.assert)(!this._fullRequestReader, "PDFWorkerStream.getFullReader can only be called once.");
  47725. this._fullRequestReader = new PDFWorkerStreamReader(this._msgHandler);
  47726. return this._fullRequestReader;
  47727. }
  47728. getRangeReader(begin, end) {
  47729. const reader = new PDFWorkerStreamRangeReader(begin, end, this._msgHandler);
  47730. this._rangeRequestReaders.push(reader);
  47731. return reader;
  47732. }
  47733. cancelAllRequests(reason) {
  47734. if (this._fullRequestReader) {
  47735. this._fullRequestReader.cancel(reason);
  47736. }
  47737. const readers = this._rangeRequestReaders.slice(0);
  47738. readers.forEach(function (reader) {
  47739. reader.cancel(reason);
  47740. });
  47741. }
  47742. }
  47743. exports.PDFWorkerStream = PDFWorkerStream;
  47744. class PDFWorkerStreamReader {
  47745. constructor(msgHandler) {
  47746. this._msgHandler = msgHandler;
  47747. this.onProgress = null;
  47748. this._contentLength = null;
  47749. this._isRangeSupported = false;
  47750. this._isStreamingSupported = false;
  47751. const readableStream = this._msgHandler.sendWithStream("GetReader");
  47752. this._reader = readableStream.getReader();
  47753. this._headersReady = this._msgHandler.sendWithPromise("ReaderHeadersReady").then(data => {
  47754. this._isStreamingSupported = data.isStreamingSupported;
  47755. this._isRangeSupported = data.isRangeSupported;
  47756. this._contentLength = data.contentLength;
  47757. });
  47758. }
  47759. get headersReady() {
  47760. return this._headersReady;
  47761. }
  47762. get contentLength() {
  47763. return this._contentLength;
  47764. }
  47765. get isStreamingSupported() {
  47766. return this._isStreamingSupported;
  47767. }
  47768. get isRangeSupported() {
  47769. return this._isRangeSupported;
  47770. }
  47771. async read() {
  47772. const {
  47773. value,
  47774. done
  47775. } = await this._reader.read();
  47776. if (done) {
  47777. return {
  47778. value: undefined,
  47779. done: true
  47780. };
  47781. }
  47782. return {
  47783. value: value.buffer,
  47784. done: false
  47785. };
  47786. }
  47787. cancel(reason) {
  47788. this._reader.cancel(reason);
  47789. }
  47790. }
  47791. class PDFWorkerStreamRangeReader {
  47792. constructor(begin, end, msgHandler) {
  47793. this._msgHandler = msgHandler;
  47794. this.onProgress = null;
  47795. const readableStream = this._msgHandler.sendWithStream("GetRangeReader", {
  47796. begin,
  47797. end
  47798. });
  47799. this._reader = readableStream.getReader();
  47800. }
  47801. get isStreamingSupported() {
  47802. return false;
  47803. }
  47804. async read() {
  47805. const {
  47806. value,
  47807. done
  47808. } = await this._reader.read();
  47809. if (done) {
  47810. return {
  47811. value: undefined,
  47812. done: true
  47813. };
  47814. }
  47815. return {
  47816. value: value.buffer,
  47817. done: false
  47818. };
  47819. }
  47820. cancel(reason) {
  47821. this._reader.cancel(reason);
  47822. }
  47823. }
  47824. /***/ })
  47825. /******/ ]);
  47826. /************************************************************************/
  47827. /******/ // The module cache
  47828. /******/ var __webpack_module_cache__ = {};
  47829. /******/
  47830. /******/ // The require function
  47831. /******/ function __w_pdfjs_require__(moduleId) {
  47832. /******/ // Check if module is in cache
  47833. /******/ if(__webpack_module_cache__[moduleId]) {
  47834. /******/ return __webpack_module_cache__[moduleId].exports;
  47835. /******/ }
  47836. /******/ // Create a new module (and put it into the cache)
  47837. /******/ var module = __webpack_module_cache__[moduleId] = {
  47838. /******/ // no module.id needed
  47839. /******/ // no module.loaded needed
  47840. /******/ exports: {}
  47841. /******/ };
  47842. /******/
  47843. /******/ // Execute the module function
  47844. /******/ __webpack_modules__[moduleId](module, module.exports, __w_pdfjs_require__);
  47845. /******/
  47846. /******/ // Return the exports of the module
  47847. /******/ return module.exports;
  47848. /******/ }
  47849. /******/
  47850. /************************************************************************/
  47851. /******/ /* webpack/runtime/define property getters */
  47852. /******/ (() => {
  47853. /******/ // define getter functions for harmony exports
  47854. /******/ __w_pdfjs_require__.d = (exports, definition) => {
  47855. /******/ for(var key in definition) {
  47856. /******/ if(__w_pdfjs_require__.o(definition, key) && !__w_pdfjs_require__.o(exports, key)) {
  47857. /******/ Object.defineProperty(exports, key, { enumerable: true, get: definition[key] });
  47858. /******/ }
  47859. /******/ }
  47860. /******/ };
  47861. /******/ })();
  47862. /******/
  47863. /******/ /* webpack/runtime/hasOwnProperty shorthand */
  47864. /******/ (() => {
  47865. /******/ __w_pdfjs_require__.o = (obj, prop) => Object.prototype.hasOwnProperty.call(obj, prop)
  47866. /******/ })();
  47867. /******/
  47868. /******/ /* webpack/runtime/make namespace object */
  47869. /******/ (() => {
  47870. /******/ // define __esModule on exports
  47871. /******/ __w_pdfjs_require__.r = (exports) => {
  47872. /******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
  47873. /******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
  47874. /******/ }
  47875. /******/ Object.defineProperty(exports, '__esModule', { value: true });
  47876. /******/ };
  47877. /******/ })();
  47878. /******/
  47879. /************************************************************************/
  47880. /******/ // module exports must be returned from runtime so entry inlining is disabled
  47881. /******/ // startup
  47882. /******/ // Load entry module and return exports
  47883. /******/ return __w_pdfjs_require__(0);
  47884. /******/ })()
  47885. ;
  47886. });
  47887. //# sourceMappingURL=pdf.worker.js.map